update:订单处理逻辑调整
This commit is contained in:
parent
f5f6e45f43
commit
598b5b084f
|
@ -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<Message> messages) {
|
||||
TenantContextHolder.setTenantId(162L);
|
||||
orderCatchService.catchOrders(messages);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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<OrdersDO> 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<OrdersDO> 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<OrdersDO> orderList) {
|
||||
|
|
|
@ -117,12 +117,13 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> 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);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue