diff --git a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/controller/admin/orderCatch/OrderCatchController.java b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/controller/admin/orderCatch/OrderCatchController.java index 7a93dcb5c4..3464add343 100644 --- a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/controller/admin/orderCatch/OrderCatchController.java +++ b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/controller/admin/orderCatch/OrderCatchController.java @@ -1,8 +1,8 @@ package cn.iocoder.yudao.module.haoka.controller.admin.orderCatch; +import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.module.haoka.controller.admin.orderCatch.po.Message; -import cn.iocoder.yudao.module.haoka.controller.admin.orderCatch.vo.OrderCatchRepVO; import cn.iocoder.yudao.module.haoka.service.orderCatch.OrderCatchService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -41,6 +41,7 @@ public class OrderCatchController { */ @Async public void execCatchOrders(List messages) { + TenantContextHolder.setTenantId(162L); orderCatchService.catchOrders(messages); } diff --git a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/controller/admin/orders/vo/OrdersSaveReqVO.java b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/controller/admin/orders/vo/OrdersSaveReqVO.java index 43c1e69b7e..18a4fcae2b 100644 --- a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/controller/admin/orders/vo/OrdersSaveReqVO.java +++ b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/controller/admin/orders/vo/OrdersSaveReqVO.java @@ -202,6 +202,11 @@ public class OrdersSaveReqVO { private String face; @Schema(description = "订单联系状态码") private Long callStatus; + /** + * 生产方式 1 手动生产 2自动生产 + */ + @Schema(description = "生产方式") + private Integer autoType; /** * 请求参数 */ @@ -253,4 +258,5 @@ public class OrdersSaveReqVO { */ @Schema(description = "销售归属名称") private String salesAttributionName; + } diff --git a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orderCatch/DouDianOrderCatchServiceImpl.java b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orderCatch/DouDianOrderCatchServiceImpl.java index 544b0ee681..23251c0079 100644 --- a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orderCatch/DouDianOrderCatchServiceImpl.java +++ b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orderCatch/DouDianOrderCatchServiceImpl.java @@ -1,14 +1,17 @@ package cn.iocoder.yudao.module.haoka.service.orderCatch; import cn.hutool.core.collection.CollectionUtil; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.vo.OnSaleProductPreOrderRespVO; import cn.iocoder.yudao.module.haoka.controller.admin.orderCatch.po.Message; +import cn.iocoder.yudao.module.haoka.controller.admin.orders.vo.OrdersSaveReqVO; import cn.iocoder.yudao.module.haoka.dal.dataobject.onsaleproduct.OnSaleProductDO; import cn.iocoder.yudao.module.haoka.dal.dataobject.orders.OrdersDO; import cn.iocoder.yudao.module.haoka.dal.mysql.onsaleproduct.OnSaleProductMapper; import cn.iocoder.yudao.module.haoka.dal.mysql.orders.OrdersMapper; import cn.iocoder.yudao.module.haoka.service.onsaleproduct.OnSaleProductService; +import cn.iocoder.yudao.module.haoka.service.orders.OrdersService; import cn.iocoder.yudao.module.haoka.service.ordersynclog.OrderSyncLogService; import cn.iocoder.yudao.module.haoka.utils.GroupListUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -69,7 +72,7 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService { @Resource private OnSaleProductService onSaleProductService; @Resource - private OrderSyncLogService orderSyncLogService; + private OrdersService ordersService; @Override public void syncOrder(AccessToken accessToken, long createTimeStart, long createTimeEnd) { // 分页查询订单 @@ -239,6 +242,7 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService { ordersDO.setProductId(onSaleProductPreOrder.getParentProduct().getId()); ordersDO.setSuperiorProductConfigId(onSaleProductPreOrder.getSuperiorProductConfigRespVO().getId()); ordersDO.setSuperiorApiId(onSaleProductPreOrder.getSuperiorApiRespVO().getId()); + ordersDO.setProductSku(onSaleProductPreOrder.getParentProduct().getSku()); } } // 在售商品 @@ -330,7 +334,12 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService { } } orderListAll.addAll(orderList); - ordersMapper.insertBatch(orderList); + for (OrdersDO ordersDO : orderList) { + OrdersSaveReqVO ordersSaveReqVO = new OrdersSaveReqVO(); + BeanUtils.copyProperties(ordersSaveReqVO,ordersDO); + ordersService.createOrders(ordersSaveReqVO); + } +// ordersMapper.insertBatch(orderList); // 执行解密,解密后更新数据库 for (List ordersDOS : GroupListUtil.groupList(orderListAll, 50)) { batchDecryptOrderAndUpdate(ordersDOS); @@ -414,6 +423,7 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService { ordersDO.setProductId(onSaleProductPreOrder.getParentProduct().getId()); ordersDO.setSuperiorProductConfigId(onSaleProductPreOrder.getSuperiorProductConfigRespVO().getId()); ordersDO.setSuperiorApiId(onSaleProductPreOrder.getSuperiorApiRespVO().getId()); + ordersDO.setProductSku(onSaleProductPreOrder.getParentProduct().getSku()); } } // 在售商品 @@ -505,7 +515,13 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService { } } orderListAll.addAll(orderList); - ordersMapper.insertBatch(orderList); + //调用创建订单流程,触发发送短信 + for (OrdersDO ordersDO : orderList) { + OrdersSaveReqVO ordersSaveReqVO = new OrdersSaveReqVO(); + BeanUtils.copyProperties(ordersSaveReqVO,ordersDO); + ordersService.createOrders(ordersSaveReqVO); + } +// ordersMapper.insertBatch(orderList); } // 执行解密,解密后更新数据库 for (List ordersDOS : GroupListUtil.groupList(orderListAll, 50)) { @@ -521,15 +537,15 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService { private void updateOrderFields(OrdersDO order, String cipherText, String decryptText) { // 检查并更新每个加密字段 if (cipherText.equals(order.getEncryptAddress())) { - order.setEncryptAddress(decryptText); // 更新为解密后的值 + order.setAddress(decryptText); // 更新为解密后的值 } else if (cipherText.equals(order.getEncryptIdCardName())) { - order.setEncryptIdCardName(decryptText); + order.setIdCardName(decryptText); } else if (cipherText.equals(order.getEncryptAddressName())) { - order.setEncryptAddressName(decryptText); + order.setAddressName(decryptText); } else if (cipherText.equals(order.getEncryptIdCardNum())) { - order.setEncryptIdCardNum(decryptText); + order.setIdCardNum(decryptText); } else if (cipherText.equals(order.getEncryptAddressMobile())) { - order.setEncryptAddressMobile(decryptText); + order.setAddressMobile(decryptText); } } private void batchDecryptOrderAndUpdate(List orderList) { 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 9dc4291b59..6c3d05333c 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 @@ -117,12 +117,13 @@ public class OrdersServiceImpl extends ServiceImpl imple orders.setProductId(onSaleProductPreOrder.getParentProduct().getId()); orders.setSuperiorProductConfigId(onSaleProductPreOrder.getSuperiorProductConfigRespVO().getId()); orders.setSuperiorApiId(onSaleProductPreOrder.getSuperiorApiRespVO().getId()); + orders.setProductSku(onSaleProductPreOrder.getParentProduct().getSku()); // 订单就绪 - orders.setStatus(100L); + orders.setStatus(ObjectUtil.isEmpty(orders.getStatus()) ? 100L : orders.getStatus()); // 已支付 - orders.setRefundStatus("800"); + orders.setRefundStatus(ObjectUtil.isEmpty(orders.getRefundStatus()) ? "800" : orders.getRefundStatus()); // 未激活 - orders.setActiveStatus("0"); + orders.setActiveStatus(ObjectUtil.isEmpty(orders.getActiveStatus())? "0" : orders.getActiveStatus()); ordersMapper.insert(orders);