diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanFactoryDataServiceImpl.java index 2b9dba596..d2781bda9 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanFactoryDataServiceImpl.java @@ -6,6 +6,7 @@ import com.alibaba.nacos.shaded.com.google.gson.Gson; import com.alibaba.nacos.shaded.com.google.gson.GsonBuilder; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.logpm.factory.props.PanFactoryProperties; +import com.logpm.factory.snm.bean.Resp; import com.logpm.factory.snm.dto.OrderInfoDTO; import com.logpm.factory.snm.dto.OrderStatusDTO; import com.logpm.factory.snm.entity.PanFactoryOrder; @@ -20,6 +21,7 @@ import lombok.AllArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springblade.common.exception.CustomerException; +import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; @@ -89,7 +91,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { @Override - public void handleData(OrderInfoDTO orderInfoDTO) throws CustomerException { + public R handleData(OrderInfoDTO orderInfoDTO) throws CustomerException { //先保存原始请求数据 PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog(); @@ -105,8 +107,8 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { queryWrapper.eq("order_no",orderNo); PanFactoryOrder panFactoryOrder = factoryOrderService.getOne(queryWrapper); if(Objects.isNull(panFactoryOrder)){ - logger.info("#############handleData: 合同自编码orderNo={}",orderNo); - throw new CustomerException(400,"未找到订单数据"); + logger.info("#############handleData: 未找到订单数据 合同自编码orderNo={}",orderNo); + return R.fail(400,"未找到订单数据"); } String plantId = panFactoryOrder.getPlantId();//工厂id String deliveryNumber = panFactoryOrder.getDeliveryNumber(); @@ -116,7 +118,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { //判断数据是都已存在 if(!orderInfoDTO.verifyData()){ logger.info("#############handleData: 数据不齐全 orderInfoDTO={}",orderInfoDTO); - throw new CustomerException(400,"数据不齐全"); + return R.fail(400,"数据不齐全"); } //拼接参数 @@ -151,17 +153,16 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { panOrderStatusLog.setStatus(0); panOrderStatusLogService.saveOrUpdate(panOrderStatusLog); }else{ - throw new CustomerException(400,message); + return R.fail(400,message); } }else{ - throw new CustomerException(400,"返回格式有误:"+result); + return R.fail(400,"返回格式有误:"+result); } - - + return Resp.success("SUCCESS"); } @Override - public void handleStatusData(OrderStatusDTO orderStatusDTO) throws CustomerException { + public R handleStatusData(OrderStatusDTO orderStatusDTO) throws CustomerException { //先保存原始请求数据 PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog(); @@ -173,7 +174,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { String status = orderStatusDTO.getStatus(); if("2".equals(status)||"4".equals(status)||"5".equals(status)||"8".equals(status)||"9".equals(status)){ logger.info("#############handleStatusData: 当前数据的状态不推送 status={}",status); - throw new CustomerException(400,"当前数据的状态不推送"); + return Resp.fail(400,"当前数据的状态不推送"); } //通过包件码查询是否是要推送的订单 @@ -183,18 +184,23 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { PanPackageInfo one = panPackageInfoService.getOne(packageInfoQueryWrapper); if(Objects.isNull(one)){ logger.info("#############handleStatusData: 当前包条码未找到对应数据unitNo={}",unitNo); - throw new CustomerException(400,"未找到包件数据"); + return Resp.fail(400,"未找到包件数据"); } + String plantId = one.getPlantId(); //查询destinationWarehouse logiBillNo plantId数据 Map supplyData = advanceDetailClient.getSupplyData(unitNo); - orderStatusDTO.setPlantId(supplyData.get("plantId")); + orderStatusDTO.setPlantId(plantId); orderStatusDTO.setDestinationWarehouse(supplyData.get("destinationWarehouse")); +// orderStatusDTO.setDestinationWarehouse("南充市"); orderStatusDTO.setLogiBillNo(supplyData.get("logiBillNo")); +// orderStatusDTO.setLogiBillNo("GZ23060001"); + + //判断数据是都已存在 if(!orderStatusDTO.verifyData()){ logger.info("#############handleStatusData: 数据不齐全 orderStatusDTO={}",orderStatusDTO); - throw new CustomerException(400,"数据不齐全"); + return Resp.fail(400,"数据不齐全"); } //拼接参数 @@ -229,11 +235,12 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { panOrderStatusLog.setStatus(0); panOrderStatusLogService.saveOrUpdate(panOrderStatusLog); }else{ - throw new CustomerException(400,message); + return Resp.fail(400,message); } }else{ - throw new CustomerException(400,"返回格式有误:"+result); + return Resp.fail(400,"返回格式有误:"+result); } + return Resp.success("SUCCESS"); }