Feat: Api fix log

This commit is contained in:
Owen 2024-12-31 12:35:19 +08:00
parent 7701cd7c6f
commit 708053adf8
6 changed files with 42 additions and 22 deletions

View File

@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "API----------上游接口-------海南电信")
@Tag(name = "API---上游接口---海南电信")
@RestController
@RequestMapping("/haoka/api/hainan-dx")
@Validated

View File

@ -19,7 +19,7 @@ import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "API----------上游接口-------联通-集团")
@Tag(name = "API---上游接口---联通-集团")
@RestController
@RequestMapping("/haoka/api/lian-tong")
@Validated

View File

@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "API----------上游接口-------广州电信")
@Tag(name = "API---上游接口---广州电信")
@RestController
@RequestMapping("/haoka/api/guangzhou-dx")
@Validated

View File

@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "API----------上游接口-------湖南电信")
@Tag(name = "API---上游接口---湖南电信")
@RestController
@RequestMapping("/haoka/api/hunan-dx")
@Validated

View File

@ -22,17 +22,7 @@ public class ApiDealServiceImpl implements ApiDealStrategyService {
@Resource
protected SuperiorApiLogService superiorApiLogService;
private ApiDealStrategy getApiDealStrategy(Long productId) {
OnSaleProductPreOrderRespVO onSaleProductPreOrder = onSaleProductService.getOnSaleProductPreOrder(productId);
if (onSaleProductPreOrder == null) {
return null;
}
ApiFrom apiFrom = onSaleProductPreOrder.getApiFrom();
if (apiFrom == null) {
return null;
}
return this.getApiDealStrategy(apiFrom);
}
@Override
public ApiDealResp<OrderApiCreateResp> createOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiCreateParam param) {
@ -40,12 +30,28 @@ public class ApiDealServiceImpl implements ApiDealStrategyService {
logVO.setHaokaOrderId(param.getId());
logVO.setHaokaProductId(param.getProductId());
try {
ApiDealStrategy apiDealStrategy = this.getApiDealStrategy(param.getProductId());
if (apiDealStrategy == null) {
String noneService = "NoneService";
OnSaleProductPreOrderRespVO onSaleProductPreOrder = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
if (onSaleProductPreOrder == null) {
String msg = "关联上级产品不存在";
logVO.setSuccess(false);
logVO.setErrorInfo(noneService);
return ApiDealResp.failed(noneService);
logVO.setErrorInfo(msg);
return ApiDealResp.failed(msg);
}
ApiFrom apiFrom = onSaleProductPreOrder.getApiFrom();
if (apiFrom == null) {
String msg = "产品上游接口不存在";
logVO.setSuccess(false);
logVO.setErrorInfo(msg);
return ApiDealResp.failed(msg);
}
ApiDealStrategy apiDealStrategy = this.getApiDealStrategy(apiFrom);
if (apiDealStrategy == null) {
String msg = "NoneService";
logVO.setSuccess(false);
logVO.setErrorInfo(msg);
return ApiDealResp.failed(msg);
}
ApiDealResp<OrderApiCreateResp> respApiDealResp = apiDealStrategy.createOrder(param);
if (!respApiDealResp.getIsSupport()){
@ -73,7 +79,21 @@ public class ApiDealServiceImpl implements ApiDealStrategyService {
logVO.setHaokaOrderId(param.getId());
logVO.setHaokaProductId(param.getProductId());
try {
ApiDealStrategy apiDealStrategy = this.getApiDealStrategy(param.getProductId());
OnSaleProductPreOrderRespVO onSaleProductPreOrder = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
if (onSaleProductPreOrder == null) {
String msg = "关联上级产品不存在";
logVO.setSuccess(false);
logVO.setErrorInfo(msg);
return ApiDealResp.failed(msg);
}
ApiFrom apiFrom = onSaleProductPreOrder.getApiFrom();
if (apiFrom == null) {
String msg = "产品上游接口不存在";
logVO.setSuccess(false);
logVO.setErrorInfo(msg);
return ApiDealResp.failed(msg);
}
ApiDealStrategy apiDealStrategy = this.getApiDealStrategy(apiFrom);
if (apiDealStrategy == null) {
logVO.setSuccess(false);
String noneService = "NoneService";

View File

@ -65,7 +65,7 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
KingNumStateChangeResponse stateChangeResponse = apiLianTongService.lianTongZhanHao(stateChangeRequest);
logVO.setResponse(JSON.toJSONString(stateChangeResponse));
if (!"0".equals(stateChangeResponse.getRspCode())) {
return ApiDealResp.failed(stateChangeResponse.getRspCode());
return ApiDealResp.failed(stateChangeResponse.getRspDesc());
}
// 1提交资料 lianTongSubmitUserInfo