diff --git a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/api/ApiDealServiceImpl.java b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/api/ApiDealServiceImpl.java index bdcf4c170d..d2782bd29c 100644 --- a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/api/ApiDealServiceImpl.java +++ b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/api/ApiDealServiceImpl.java @@ -101,8 +101,9 @@ public class ApiDealServiceImpl implements ApiDealStrategyService { logVO.setHaokaProductId(param.getProductId()); logVO.setHaokaSuperiorApiId(param.getSuperiorApiId()); Boolean isSupport = true; + OnSaleProductPreOrderRespVO onSaleProductPreOrder = onSaleProductService.getOnSaleProductPreOrder(param.getOnSaleProductId()); try { - OnSaleProductPreOrderRespVO onSaleProductPreOrder = onSaleProductService.getOnSaleProductPreOrder(param.getOnSaleProductId()); + // OnSaleProductPreOrderRespVO onSaleProductPreOrder = onSaleProductService.getOnSaleProductPreOrder(param.getOnSaleProductId()); if (onSaleProductPreOrder == null) { String msg = "关联上级产品不存在"; logVO.setSuccess(false); @@ -148,7 +149,13 @@ public class ApiDealServiceImpl implements ApiDealStrategyService { return ApiDealResp.failed(e.getMessage()); } finally { if (isSupport) { - superiorApiLogService.createSuperiorApiLog(logVO); + if (onSaleProductPreOrder != null + && onSaleProductPreOrder.getSuperiorApiRespVO() != null + && onSaleProductPreOrder.getSuperiorApiRespVO().getApiFrom() != null + && ApiFrom.fromId(onSaleProductPreOrder.getSuperiorApiRespVO().getApiFrom()) == ApiFrom.LianTong) { + } else { + superiorApiLogService.createSuperiorApiLog(logVO); + } } } } diff --git a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/api/strategy/LianTongApiDealStrategy.java b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/api/strategy/LianTongApiDealStrategy.java index 6ee56b086d..5d50f29dd3 100644 --- a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/api/strategy/LianTongApiDealStrategy.java +++ b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/api/strategy/LianTongApiDealStrategy.java @@ -26,6 +26,7 @@ import cn.iocoder.yudao.module.haoka.service.superiorproductconfig.SuperiorProdu import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import jakarta.annotation.Resource; +import lombok.val; import org.springframework.stereotype.Component; import java.text.SimpleDateFormat; @@ -124,7 +125,11 @@ public class LianTongApiDealStrategy implements ApiDealStrategy { OrderApiCreateResp superApiResponse = new OrderApiCreateResp(); if (!"成功".equals(rspCode)) { superApiResponse.setOrderStatusCode("0"); - superApiResponse.setSupplierOrderStatusDesc(ziLiaoResponse.getRspDesc()); + String rspDesc = ziLiaoResponse.getRspDesc(); + if (StringUtils.isEmpty(rspDesc)){ + rspDesc=rspCode; + } + superApiResponse.setSupplierOrderStatusDesc(rspDesc); return ApiDealResp.ok(superApiResponse); } @@ -233,9 +238,8 @@ public class LianTongApiDealStrategy implements ApiDealStrategy { KingOrderSyncResponse response = apiLianTongService.lianTongOrderSyncV2(haokaSuperiorApiId, syncV2); logVO.setResponse(JSON.toJSONString(response)); if (!"0000".equals(response.getRspCode())) { - superApiResponse.setOrderStatusCode("0"); - superApiResponse.setSupplierOrderStatusDesc(preOrderResponse.getRspDesc()); + superApiResponse.setSupplierOrderStatusDesc(response.getRspDesc()); return ApiDealResp.ok(superApiResponse); // return ApiDealResp.failed(response.getRspDesc()); } @@ -246,7 +250,7 @@ public class LianTongApiDealStrategy implements ApiDealStrategy { // * 商城订单编码:mallOrderId【部分流程返回】 // * 预占号码:preNumber // * 例:{\"mallOrderId\":\"363067187203\",\"orderNo\":\"1962041937730469\",\"preNumber\":\"13104876751\",\"shortUrl\":\"https://uc.gtimg.cn/AjIxeJEl\"} - // */ + // */ {"body":"","rspCode":"E.num.99","rspDesc":"只允许上架、预配、选占号码做选占","uuid":"05e2a454-a896-4055-a94c-cbd2b6c8d98c"} // private String body; diff --git a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersService.java b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersService.java index b2ff9d7198..1a7bf1dd97 100644 --- a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersService.java +++ b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersService.java @@ -54,6 +54,8 @@ public interface OrdersService extends IService { */ PageResult getOrdersPage(OrdersPageReqVO pageReqVO); + void auditOrdersAsync(OrdersSaveReqVO updateReqVO); + void auditOrders(OrdersSaveReqVO updateReqVO); /** @@ -66,12 +68,14 @@ public interface OrdersService extends IService { /** * 提交订单 + * * @param updateReqVO */ void submitOrders(OrdersSaveReqVO updateReqVO); /** * 强制修改订单提交状态 + * * @param updateReqVO */ void submitUpStreamStatus(OrdersSaveReqVO updateReqVO); diff --git a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java index a0de46631d..4898fd51b6 100644 --- a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java +++ b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java @@ -34,6 +34,7 @@ import org.springframework.context.annotation.Lazy; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import jakarta.annotation.Resource; +import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; @@ -341,7 +342,7 @@ public class OrdersServiceImpl extends ServiceImpl imple // 自动生产 调用审核 OrdersSaveReqVO ordersSaveReqVO = BeanUtils.toBean(ordersDO, OrdersSaveReqVO.class); ordersSaveReqVO.setStatus(450L); - ordersService.auditOrders(ordersSaveReqVO); + ordersService.auditOrdersAsync(ordersSaveReqVO); } /** @@ -383,6 +384,26 @@ public class OrdersServiceImpl extends ServiceImpl imple updateObj.setSuperiorProductConfigId(oldOrderDo.getSuperiorProductConfigId()); updateObj.setSuperiorApiId(oldOrderDo.getSuperiorApiId()); ordersMapper.updateById(updateObj); + // 抖音订单判断备注更新 + ordersService.syncDouDian(oldOrderDo,updateObj); + // 状态变化:发送短信提醒 + if (updateObj.getStatus() != null && updateObj.getStatus().equals(oldOrderDo.getStatus())) { + + smsTaskService.sendSMS( + updateObj.getStatus(), + updateObj.getId(), + updateObj.getSource(), + updateObj.getOnSaleProductId(), + updateObj.getRefundStatus(), + updateObj.getCallStatus(), + updateObj.getAddressMobile(), + updateObj + ); + } + } + + @Async + public void syncDouDian(OrdersDO oldOrderDo,OrdersDO updateObj){ // 抖音订单判断备注更新 if("2".equals(oldOrderDo.getSource())){ String sellerMemo = oldOrderDo.getSellerMemo(); @@ -407,20 +428,13 @@ public class OrdersServiceImpl extends ServiceImpl imple douDianOrderCatchService.logisticsAdd(updateObj.getRealSourceId(),"","",trackingNumber); } } - // 状态变化:发送短信提醒 - if (updateObj.getStatus() != null && updateObj.getStatus().equals(oldOrderDo.getStatus())) { + } - smsTaskService.sendSMS( - updateObj.getStatus(), - updateObj.getId(), - updateObj.getSource(), - updateObj.getOnSaleProductId(), - updateObj.getRefundStatus(), - updateObj.getCallStatus(), - updateObj.getAddressMobile(), - updateObj - ); - } + + @Async + @Override + public void auditOrdersAsync(OrdersSaveReqVO updateReqVO){ + auditOrders( updateReqVO); } @Override @@ -532,9 +546,9 @@ public class OrdersServiceImpl extends ServiceImpl imple /** * 调用运营商产生订单(在运营商侧创建订单) * - * @param ordersDO */ - private OrdersDO createOrderToOperators(OrdersDO ordersDO) { + private OrdersDO createOrderToOperators(OrdersDO ordersDOUnreleasable) { + var ordersDO = getOrders(ordersDOUnreleasable.getId()); // 向上游提交订单 OrderApiCreateParam param = new OrderApiCreateParam(); BeanUtils.copyProperties(ordersDO, param); diff --git a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/smstask/SmsTaskService.java b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/smstask/SmsTaskService.java index 42a3952dc9..da5332b7a5 100644 --- a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/smstask/SmsTaskService.java +++ b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/smstask/SmsTaskService.java @@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.haoka.controller.admin.smstask.vo.*; import cn.iocoder.yudao.module.haoka.dal.dataobject.smstask.SmsTaskDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.scheduling.annotation.Async; /** * 短信任务 Service 接口 @@ -53,6 +54,7 @@ public interface SmsTaskService { * @return 短信任务分页 */ PageResult getSmsTaskPage(SmsTaskPageReqVO pageReqVO); + /** * @param orderStatus * @param orderId @@ -62,7 +64,8 @@ public interface SmsTaskService { * @param callStatus * @param sentToPhone */ - public void sendSMS(Long orderStatus, Long orderId, String source, Long onSaleProductId, - String refundStatus, Long callStatus, String sentToPhone, OrdersDO ordersDO); + @Async + void sendSMS(Long orderStatus, Long orderId, String source, Long onSaleProductId, + String refundStatus, Long callStatus, String sentToPhone, OrdersDO ordersDO); } diff --git a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/smstask/SmsTaskServiceImpl.java b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/smstask/SmsTaskServiceImpl.java index c841471a2b..1310fcfefa 100644 --- a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/smstask/SmsTaskServiceImpl.java +++ b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/smstask/SmsTaskServiceImpl.java @@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Lazy; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -99,6 +100,7 @@ public class SmsTaskServiceImpl implements SmsTaskService { * @param callStatus * @param sentToPhone */ + @Async public void sendSMS(Long orderStatus, Long orderId, String source, Long onSaleProductId, String refundStatus, Long callStatus, String sentToPhone, OrdersDO ordersDO) { try {