Commit b309f0ef by 王璐琦

fix(sync): 扩展订单状态过滤及标签取消逻辑

- 查询订单时新增撤销和错误类型状态过滤条件
- 修改日志输出,明确支持退款、撤销和错误类型订单
- 调整子订单处理逻辑,准确判断不同状态下的取消标签
- 更改变量命名,反映订单取消相关的语义
- 修改SQL映射文件,订单查询增加状态字段返回
1 parent b23f6c93
...@@ -728,7 +728,7 @@ public class InspectionCustomerTagSyncService { ...@@ -728,7 +728,7 @@ public class InspectionCustomerTagSyncService {
Date beginTime = cn.com.glsx.dj.strategy.util.DateUtil.getStartOfDay(startLocalDate); Date beginTime = cn.com.glsx.dj.strategy.util.DateUtil.getStartOfDay(startLocalDate);
Date endTime = cn.com.glsx.dj.strategy.util.DateUtil.getEndOfDay(endLocalDate); Date endTime = cn.com.glsx.dj.strategy.util.DateUtil.getEndOfDay(endLocalDate);
GoodsOrderDTO condition = GoodsOrderDTO.builder() GoodsOrderDTO condition = GoodsOrderDTO.builder()
.statusList(Collections.singletonList(CarLifeEnum.OrderStatus.REFUNDED.getValue())) .statusList(Arrays.asList(CarLifeEnum.OrderStatus.REFUNDED.getValue(),CarLifeEnum.OrderStatus.REVOKE.getValue(),CarLifeEnum.OrderStatus.WRONG_ORDER.getValue()))
.installUpgradeBeginTime(beginTime) .installUpgradeBeginTime(beginTime)
.installUpgradeEndTime(endTime) .installUpgradeEndTime(endTime)
.sceneType(SceneTypeEnum.SCENE1_1.getValue()) .sceneType(SceneTypeEnum.SCENE1_1.getValue())
...@@ -736,12 +736,12 @@ public class InspectionCustomerTagSyncService { ...@@ -736,12 +736,12 @@ public class InspectionCustomerTagSyncService {
RpcResponse<List<GoodsOrderDTO>> response = goodsOrderRemote.listSimpleGoodsOrder(condition); RpcResponse<List<GoodsOrderDTO>> response = goodsOrderRemote.listSimpleGoodsOrder(condition);
if (response == null || !response.isSuccess() || CollectionUtils.isEmpty(response.getResult())) { if (response == null || !response.isSuccess() || CollectionUtils.isEmpty(response.getResult())) {
log.info("未查询到已退款订单数据,跳过取消产品标签"); log.info("未查询到已退款、撤销、错误类型订单数据,跳过取消产品标签");
return; return;
} }
List<GoodsOrderDTO> orderList = response.getResult(); List<GoodsOrderDTO> orderList = response.getResult();
log.info("查询到 {} 条已退款订单", orderList.size()); log.info("查询到 {} 条已退款、撤销、错误类型订单", orderList.size());
// 3. 品类配置 // 3. 品类配置
//窗膜大类 //窗膜大类
...@@ -813,15 +813,16 @@ public class InspectionCustomerTagSyncService { ...@@ -813,15 +813,16 @@ public class InspectionCustomerTagSyncService {
continue; continue;
} }
Set<String> refundedEnums = new HashSet<>(); Set<String> cancelEnums = new HashSet<>();
for (GoodsOrderDTO order : entry.getValue()) { for (GoodsOrderDTO order : entry.getValue()) {
List<GoodsSubOrderDTO> subOrders = order.getSubOrderList(); List<GoodsSubOrderDTO> subOrders = order.getSubOrderList();
if (CollectionUtils.isEmpty(subOrders)) { if (CollectionUtils.isEmpty(subOrders)) {
continue; continue;
} }
for (GoodsSubOrderDTO sub : subOrders) { for (GoodsSubOrderDTO sub : subOrders) {
// 只处理已退款的子订单 // 已退款的子订单
if (!Objects.equals(sub.getStatus(), RefundGoodsSubOrderStatusEnum.REFUNDED.getValue())) { if (Objects.equals(order.getStatus(), CarLifeEnum.OrderStatus.REFUNDED.getValue())
&& !Objects.equals(sub.getStatus(), RefundGoodsSubOrderStatusEnum.REFUNDED.getValue())) {
continue; continue;
} }
Integer goodsType = sub.getUpgradeGoodsType(); Integer goodsType = sub.getUpgradeGoodsType();
...@@ -832,14 +833,14 @@ public class InspectionCustomerTagSyncService { ...@@ -832,14 +833,14 @@ public class InspectionCustomerTagSyncService {
if (typeIds.contains(goodsType) if (typeIds.contains(goodsType)
|| typeIds.contains(secondaryType) || typeIds.contains(secondaryType)
|| typeIds.contains(thirdLevelType)) { || typeIds.contains(thirdLevelType)) {
refundedEnums.add(goodsTypeEnumentry.getValue()); cancelEnums.add(goodsTypeEnumentry.getValue());
} }
} }
} }
} }
// 取交集:已有标签 ∩ 退款商品标签 → 需要删除 // 取交集:已有标签 ∩ 退款商品标签 → 需要删除
Set<String> toDelete = new HashSet<>(refundedEnums); Set<String> toDelete = new HashSet<>(cancelEnums);
toDelete.retainAll(existingEnums); toDelete.retainAll(existingEnums);
for (String enumCode : toDelete) { for (String enumCode : toDelete) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!