diff --git a/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/job/FactoryJob.java b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/job/FactoryJob.java index 48360803b..25531f382 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/job/FactoryJob.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/job/FactoryJob.java @@ -87,6 +87,7 @@ public class FactoryJob { JSONObject jsonObject = JSONUtil.parseObj(s); if (StrUtil.equals(jsonObject.getStr("result_code"), "0000")) { List orderFullInfoEntities = new ArrayList<>(); + List mainOrderCodes = new ArrayList<>(); // 推送成功 JSONArray fullSetInfos = jsonObject.getJSONArray("fullSetInfo"); if (CollUtil.isNotEmpty(fullSetInfos)) { @@ -94,48 +95,57 @@ public class FactoryJob { JSONObject fullSetInfo = JSONUtil.parseObj(fullSetInfoObj); String mainOrderNo = fullSetInfo.getStr("mainOrderNo"); String fullSet = fullSetInfo.getStr("fullSet"); - // 家品数据取 orderDetail 衣柜取 paNos - if ("Z".equals(orderType)) { - JSONArray orderDetails = fullSetInfo.getJSONArray("orderDetail"); - if (CollUtil.isNotEmpty(orderDetails)) { - for (Object orderDetailObj : orderDetails) { - JSONObject orderDetail = JSONUtil.parseObj(orderDetailObj); - String orderNo = orderDetail.getStr("orderNo"); - String itemCode = orderDetail.getStr("itemCode"); - String itemName = orderDetail.getStr("itemName"); - String quantity = orderDetail.getStr("quantity"); - OrderFullInfoEntity entity = new OrderFullInfoEntity(); - entity.setMainOrderNo(mainOrderNo); - entity.setOrderNo(orderNo); - entity.setItemCode(itemCode); - entity.setItemName(itemName); - entity.setQuantity(quantity); - entity.setFullSet(fullSet); - entity.setOrderType(orderType); - entity.setTenantCode(tenantCode); - orderFullInfoEntities.add(entity); + if ("N".equals(fullSet)) { + // 家品数据取 orderDetail 衣柜取 paNos + if ("Z".equals(orderType)) { + JSONArray orderDetails = fullSetInfo.getJSONArray("orderDetail"); + if (CollUtil.isNotEmpty(orderDetails)) { + for (Object orderDetailObj : orderDetails) { + JSONObject orderDetail = JSONUtil.parseObj(orderDetailObj); + String orderNo = orderDetail.getStr("orderNo"); + String itemCode = orderDetail.getStr("itemCode"); + String itemName = orderDetail.getStr("itemName"); + String quantity = orderDetail.getStr("quantity"); + OrderFullInfoEntity entity = new OrderFullInfoEntity(); + entity.setMainOrderNo(mainOrderNo); + entity.setOrderNo(orderNo); + entity.setItemCode(itemCode); + entity.setItemName(itemName); + entity.setQuantity(quantity); + entity.setFullSet(fullSet); + entity.setOrderType(orderType); + entity.setTenantCode(tenantCode); + orderFullInfoEntities.add(entity); + } } - } - } else { - JSONArray paNos = fullSetInfo.getJSONArray("paNo"); - if (CollUtil.isNotEmpty(paNos)) { - for (Object paNo : paNos) { - String str = Convert.toStr(paNo); - OrderFullInfoEntity entity = new OrderFullInfoEntity(); - entity.setMainOrderNo(mainOrderNo); - entity.setPaNo(str); - entity.setFullSet(fullSet); - entity.setOrderType(orderType); - entity.setTenantCode(tenantCode); - orderFullInfoEntities.add(entity); + } else { + JSONArray paNos = fullSetInfo.getJSONArray("paNo"); + if (CollUtil.isNotEmpty(paNos)) { + for (Object paNo : paNos) { + String str = Convert.toStr(paNo); + OrderFullInfoEntity entity = new OrderFullInfoEntity(); + entity.setMainOrderNo(mainOrderNo); + entity.setPaNo(str); + entity.setFullSet(fullSet); + entity.setOrderType(orderType); + entity.setTenantCode(tenantCode); + entity.setQuantity("1"); + orderFullInfoEntities.add(entity); + } } } } + if ("Y".equals(fullSet)) { + mainOrderCodes.add(mainOrderNo); + } } } if (CollUtil.isNotEmpty(orderFullInfoEntities)) { orderFullInfoService.saveBatch(orderFullInfoEntities); } + if (CollUtil.isNotEmpty(mainOrderCodes)) { + orderInfoService.updateFullSetByMianOrderCode(mainOrderCodes); + } } } } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/mapper/OrderInfoMapper.java b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/mapper/OrderInfoMapper.java index 90fd73ba4..64a1f7617 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/mapper/OrderInfoMapper.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/mapper/OrderInfoMapper.java @@ -3,6 +3,7 @@ package com.logpm.factorydata.suofeiya.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.logpm.factorydata.suofeiya.entity.OrderInfoEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -17,4 +18,5 @@ public interface OrderInfoMapper extends BaseMapper { List findNotFullOrder(); + void updateFullSetByMianOrderCode(@Param("mainOrderNo") List mainOrderNo); } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/mapper/OrderInfoMapper.xml b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/mapper/OrderInfoMapper.xml index a8bc89a9b..271cc87bd 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/mapper/OrderInfoMapper.xml +++ b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/mapper/OrderInfoMapper.xml @@ -7,4 +7,13 @@ from sfy_order_info where order_full = 'N' + + + update sfy_order_info + set order_full = 'Y' + where main_order_no in + + #{item} + + diff --git a/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/OrderInfoService.java b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/OrderInfoService.java index d44dc3fff..ac772fcb2 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/OrderInfoService.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/OrderInfoService.java @@ -15,4 +15,6 @@ public interface OrderInfoService extends BaseService { List findNotFullOrder(); + + void updateFullSetByMianOrderCode(List mainOrderNo); } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/impl/OrderInfoServiceImpl.java b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/impl/OrderInfoServiceImpl.java index 97defd371..61475ade5 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/impl/OrderInfoServiceImpl.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/impl/OrderInfoServiceImpl.java @@ -25,4 +25,9 @@ public class OrderInfoServiceImpl extends BaseServiceImpl findNotFullOrder() { return baseMapper.findNotFullOrder(); } + + @Override + public void updateFullSetByMianOrderCode(List mainOrderNo) { + baseMapper.updateFullSetByMianOrderCode(mainOrderNo); + } }