fix:返回值

This commit is contained in:
Xiang
2026-02-11 15:41:59 +08:00
parent 67e67a911e
commit 03f98fbe1e
8 changed files with 24 additions and 23 deletions

View File

@@ -124,7 +124,7 @@
<dependency> <dependency>
<groupId>com.xiang.starter</groupId> <groupId>com.xiang.starter</groupId>
<artifactId>xmc-common</artifactId> <artifactId>xmc-common</artifactId>
<version>1.0</version> <version>1.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.xiang.starter</groupId> <groupId>com.xiang.starter</groupId>
@@ -134,7 +134,7 @@
<dependency> <dependency>
<groupId>com.xiang.starter</groupId> <groupId>com.xiang.starter</groupId>
<artifactId>xmc-http-starter</artifactId> <artifactId>xmc-http-starter</artifactId>
<version>2.0-SNAPSHOT</version> <version>2.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.xiang.starter</groupId> <groupId>com.xiang.starter</groupId>

View File

@@ -31,13 +31,13 @@ public class IndexController {
@GetMapping("/index") @GetMapping("/index")
public Result<String> index() { public Result<String> index() {
String msg = "已激活环境:" + env + "web端口启用" + port + "使用datasource:" + url; String msg = "已激活环境:" + env + "web端口启用" + port + "使用datasource:" + url;
return Result.success(msg); return Result.data(msg);
} }
@GetMapping("/redisTest") @GetMapping("/redisTest")
private Result<String> redisTest() { private Result<String> redisTest() {
redisTemplate.opsForValue().set("2222", "231"); redisTemplate.opsForValue().set("2222", "231");
return Result.success("redis获取到key为test的值为" + redisTemplate.opsForValue().get("2222")); return Result.data("redis获取到key为test的值为" + redisTemplate.opsForValue().get("2222"));
} }
} }

View File

@@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* 模板管理控制器 * 模板管理控制器
* *
@@ -21,8 +23,8 @@ public class TemplateController {
private final TemplateService templateService; private final TemplateService templateService;
@PostMapping("/all") @PostMapping("/all")
public Result<TemplateList> getAllTemplates() throws Exception { public Result<List<TemplateList>> getAllTemplates() throws Exception {
return Result.success(templateService.getAllTemplates()); return Result.data(templateService.getAllTemplates());
} }
} }

View File

@@ -50,7 +50,7 @@ public class CodeGenServiceImpl implements CodeGenService {
// 3. generate the code by freemarker templates with parameters . // 3. generate the code by freemarker templates with parameters .
// Freemarker根据参数和模板生成代码 // Freemarker根据参数和模板生成代码
Map<String, String> result = getResultByParams(paramInfo.getOptions()); Map<String, String> result = getResultByParams(paramInfo.getOptions());
return Result.success(result); return Result.data(result);
} catch (Exception e) { } catch (Exception e) {
log.error("代码生成失败", e); log.error("代码生成失败", e);
return Result.error("代码生成失败: " + e.getMessage()); return Result.error("代码生成失败: " + e.getMessage());

View File

@@ -37,7 +37,7 @@ public class DynamicDomainController {
log.error("获取公网IP失败 time:{}", LocalDateTime.now(), e); log.error("获取公网IP失败 time:{}", LocalDateTime.now(), e);
return Result.error("获取公网IP失败"); return Result.error("获取公网IP失败");
} }
return Result.success("获取公网IP成功", publicIp); return Result.data(publicIp);
} }
@PostMapping("/ddns") @PostMapping("/ddns")
@@ -46,7 +46,7 @@ public class DynamicDomainController {
String publicIp = IpUtils.getPublicIp(); String publicIp = IpUtils.getPublicIp();
log.info("获取公网IP成功time:{}, ip:{}", LocalDateTime.now(), publicIp); log.info("获取公网IP成功time:{}, ip:{}", LocalDateTime.now(), publicIp);
IDomainService.dynamicDomainAnalysis(publicIp); IDomainService.dynamicDomainAnalysis(publicIp);
return Result.success("获取公网IP成功"); return Result.data("获取公网IP成功");
} catch (Exception e) { } catch (Exception e) {
log.error("获取公网IP失败 time:{}", LocalDateTime.now(), e); log.error("获取公网IP失败 time:{}", LocalDateTime.now(), e);
return Result.error("获取公网IP失败"); return Result.error("获取公网IP失败");

View File

@@ -102,6 +102,6 @@ public class FwdDataController {
} }
} }
} }
return Result.success("success"); return Result.data("success");
} }
} }

View File

@@ -36,37 +36,37 @@ public class FwdOuterController {
@GetMapping("/getShowProjects") @GetMapping("/getShowProjects")
public Result<ProjectsResp> getShowProjects() { public Result<ProjectsResp> getShowProjects() {
ProjectsResp showProjectsFromHttp = performServiceHttp.getShowProjectsFromHttp(new BaseRequest()); ProjectsResp showProjectsFromHttp = performServiceHttp.getShowProjectsFromHttp(new BaseRequest());
return Result.success("查询成功!", showProjectsFromHttp); return Result.data(showProjectsFromHttp);
} }
@GetMapping("/getProjectInfo/{id}") @GetMapping("/getProjectInfo/{id}")
public Result<Perform> getProjectInfo(@PathVariable("id") Long id) { public Result<Perform> getProjectInfo(@PathVariable("id") Long id) {
String token = fwdUserConfigMapper.getAvailableUser().get(0).getToken(); String token = fwdUserConfigMapper.getAvailableUser().get(0).getToken();
Perform performsByProjectIdFromHttp = performServiceHttp.getPerformsByProjectIdFromHttp(id, token); Perform performsByProjectIdFromHttp = performServiceHttp.getPerformsByProjectIdFromHttp(id, token);
return Result.success("查询成功!", performsByProjectIdFromHttp); return Result.data(performsByProjectIdFromHttp);
} }
@GetMapping("/getPerformsByProjectIdFromHttp/{id}") @GetMapping("/getPerformsByProjectIdFromHttp/{id}")
public Result<Perform> getPerformsByProjectIdFromHttp(@PathVariable("id") Long id) { public Result<Perform> getPerformsByProjectIdFromHttp(@PathVariable("id") Long id) {
String token = fwdUserConfigMapper.getAvailableUser().get(0).getToken(); String token = fwdUserConfigMapper.getAvailableUser().get(0).getToken();
Perform performsByProjectIdFromHttp = performServiceHttp.getPerformsByProjectIdFromHttp(id, token); Perform performsByProjectIdFromHttp = performServiceHttp.getPerformsByProjectIdFromHttp(id, token);
return Result.success("查询成功!", performsByProjectIdFromHttp); return Result.data(performsByProjectIdFromHttp);
} }
@PostMapping("/createOrder") @PostMapping("/createOrder")
public Result<String> createOrder(Long projectId) throws Exception { public Result<String> createOrder(Long projectId) throws Exception {
String token = fwdUserConfigMapper.getAvailableUser().get(0).getToken(); String token = fwdUserConfigMapper.getAvailableUser().get(0).getToken();
if (performService.createProjectOrder(projectId, FREQUENT_IDS, token)) { if (performService.createProjectOrder(projectId, FREQUENT_IDS, token)) {
return Result.success("下单成功!"); return Result.data("下单成功!");
} }
return Result.error("下单失败!"); return Result.error("下单失败!");
} }
@GetMapping("/getSeatPlanStatus") @GetMapping("/getSeatPlanStatus")
public Result<SeatPlanStatus> getSeatPlanStatu (@RequestParam List<Long> ids) { public Result<List<SeatPlanStatus>> getSeatPlanStatu (@RequestParam List<Long> ids) {
String token = fwdUserConfigMapper.getAvailableUser().get(0).getToken(); String token = fwdUserConfigMapper.getAvailableUser().get(0).getToken();
List<SeatPlanStatus> seatPlanStatusFromHttp = performServiceHttp.getSeatPlanStatusFromHttp(ids, token); List<SeatPlanStatus> seatPlanStatusFromHttp = performServiceHttp.getSeatPlanStatusFromHttp(ids, token);
return Result.success("查询成功!", seatPlanStatusFromHttp); return Result.data(seatPlanStatusFromHttp);
} }
} }

View File

@@ -1,7 +1,5 @@
package com.xiang.xservice.application.script.xb.controller; package com.xiang.xservice.application.script.xb.controller;
import com.google.common.collect.Lists;
import com.xiang.xservice.basic.common.resp.Result;
import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundList; import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundList;
import com.xiang.xservice.application.script.xb.entity.request.xb.fund.QueryFundInfoReq; import com.xiang.xservice.application.script.xb.entity.request.xb.fund.QueryFundInfoReq;
import com.xiang.xservice.application.script.xb.entity.request.xb.fund.QueryFundListReq; import com.xiang.xservice.application.script.xb.entity.request.xb.fund.QueryFundListReq;
@@ -9,6 +7,7 @@ import com.xiang.xservice.application.script.xb.entity.request.xb.fund.QueryXbFu
import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundInfo; import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundInfo;
import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundList; import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundList;
import com.xiang.xservice.application.script.xb.service.FundService; import com.xiang.xservice.application.script.xb.service.FundService;
import com.xiang.xservice.basic.common.resp.Result;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@@ -31,28 +30,28 @@ public class XBController {
private final FundService fundService; private final FundService fundService;
@PostMapping("/queryFundList") @PostMapping("/queryFundList")
public Result<XbFundList> queryFundList(@RequestBody QueryXbFundListReq req) { public Result<List<XbFundList>> queryFundList(@RequestBody QueryXbFundListReq req) {
List<XbFundList> result = fundService.queryFundList(req.getType()); List<XbFundList> result = fundService.queryFundList(req.getType());
if (CollectionUtils.isEmpty(result)) { if (CollectionUtils.isEmpty(result)) {
return Result.error("基金列表信息为空!"); return Result.error("基金列表信息为空!");
} }
return Result.success("success", result); return Result.data(result);
} }
@PostMapping("/queryList") @PostMapping("/queryList")
public Result<FundList> queryList(@RequestBody QueryFundListReq req) { public Result<List<FundList>> queryList(@RequestBody QueryFundListReq req) {
List<FundList> result = fundService.queryTodayList(req.getDate(), req.getDataResources(), req.getDataSourceSwitch(), req.getCodeArr()); List<FundList> result = fundService.queryTodayList(req.getDate(), req.getDataResources(), req.getDataSourceSwitch(), req.getCodeArr());
if (CollectionUtils.isEmpty(result)) { if (CollectionUtils.isEmpty(result)) {
return Result.error("基金列表信息为空!"); return Result.error("基金列表信息为空!");
} }
return Result.success("success", result); return Result.data(result);
} }
@PostMapping("/queryFundInfo") @PostMapping("/queryFundInfo")
public Result<FundInfo> queryFundInfo(@RequestBody QueryFundInfoReq req) { public Result<FundInfo> queryFundInfo(@RequestBody QueryFundInfoReq req) {
FundInfo fundInfo = fundService.queryFundInfo(req.getCode()); FundInfo fundInfo = fundService.queryFundInfo(req.getCode());
if (Objects.nonNull(fundInfo)) { if (Objects.nonNull(fundInfo)) {
return Result.success("success", Lists.newArrayList(fundInfo)); return Result.data(fundInfo);
} }
return Result.error("查询基金信息为空!"); return Result.error("查询基金信息为空!");
} }