diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java index bbc73d67c..726188fbc 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java @@ -8,7 +8,7 @@ public interface ModuleNameConstant { /** * 如果不需要 "" */ - public static final String DEVAUTH =""; + public static final String DEVAUTH ="-pref"; /** diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java index eb062356e..2276aa92c 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java @@ -17,11 +17,14 @@ import org.springblade.common.constant.RabbitConstant; import org.springblade.common.exception.CustomerException; import org.springblade.common.utils.CommonUtil; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.StringUtil; import org.springframework.amqp.rabbit.connection.CorrelationData; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -42,8 +45,8 @@ public class FactoryCommonController { @ApiOperationSupport(order = 1) @ApiOperation(value = "订单数据推送", notes = "传入orderInfoDTO") public R sendOrders(@Validated @RequestBody OrderInfoDTO orderInfoDTO) { - log.info("############sendOrders: 请求参数{}",orderInfoDTO); - try{ + log.info("############sendOrders: 请求参数{}", orderInfoDTO); + try { //先保存原始请求数据 OrderStatusLog orderStatusLog = new OrderStatusLog(); @@ -52,22 +55,22 @@ public class FactoryCommonController { orderStatusLog.setType(1); orderStatusLogService.save(orderStatusLog); - Map<String,Object> map=new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("messageId", CommonUtil.getUUID()); map.put("logId", orderStatusLog.getId()); - map.put("messageData",orderInfoDTO); - map.put("createTime",new Date().getTime()); + map.put("messageData", orderInfoDTO); + map.put("createTime", new Date().getTime()); //将消息携带绑定键值 - rabbitTemplate.convertAndSend(RabbitConstant.OPEN_ORDER_EXCHANGE, RabbitConstant.OPEN_ORDER_ROUTING, map,new CorrelationData(String.valueOf(orderStatusLog.getId()))); + rabbitTemplate.convertAndSend(RabbitConstant.OPEN_ORDER_EXCHANGE, RabbitConstant.OPEN_ORDER_ROUTING, map, new CorrelationData(String.valueOf(orderStatusLog.getId()))); // R r = factoryDataService.handleData(orderInfoDTO); return R.success("调用成功"); - }catch (CustomerException e){ - log.error(e.message,e); - return R.fail(e.code,e.message); - }catch (Exception e){ - log.error("############sendOrders: 系统异常",e); - return R.fail(500,"############sendOrders: 系统异常"); + } catch (CustomerException e) { + log.error(e.message, e); + return R.fail(e.code, e.message); + } catch (Exception e) { + log.error("############sendOrders: 系统异常", e); + return R.fail(500, "############sendOrders: 系统异常"); } } @@ -77,8 +80,8 @@ public class FactoryCommonController { @ApiOperationSupport(order = 1) @ApiOperation(value = "订单状态推送", notes = "传入orderInfoDTO") public R sendOrderStatus(@RequestBody OrderStatusDTO orderStatusDTO) { - log.info("############sendOrderStatus: 请求参数{}",orderStatusDTO); - try{ + log.info("############sendOrderStatus: 请求参数{}", orderStatusDTO); + try { //先保存原始请求数据 OrderStatusLog orderStatusLog = new OrderStatusLog(); @@ -87,26 +90,26 @@ public class FactoryCommonController { orderStatusLog.setType(2); orderStatusLogService.save(orderStatusLog); - Map<String,Object> map=new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("messageId", CommonUtil.getUUID()); map.put("logId", orderStatusLog.getId()); map.put("type", "Push"); - map.put("messageData",orderStatusDTO); - map.put("createTime",new Date().getTime()); + map.put("messageData", orderStatusDTO); + map.put("createTime", new Date().getTime()); //将消息携带绑定键值 rabbitTemplate.convertAndSend(RabbitConstant.ORDER_STATUS_EXCHANGE, RabbitConstant.ORDER_STATUS_ROUTING, map); map.put("type", "DealWith"); - rabbitTemplate.convertAndSend(RabbitConstant.DEAL_WITH_EXCHANGE, RabbitConstant.DEAL_WITH_ROUTING,map); + rabbitTemplate.convertAndSend(RabbitConstant.DEAL_WITH_EXCHANGE, RabbitConstant.DEAL_WITH_ROUTING, map); // R r = factoryDataService.handleStatusData(orderStatusDTO); return R.success("调用成功"); - }catch (CustomerException e){ - log.error(e.message,e); - return R.fail(e.code,e.message); - }catch (Exception e){ - log.error("############sendOrderStatus: 系统异常",e); - return R.fail(500,"############sendOrderStatus: 系统异常"); + } catch (CustomerException e) { + log.error(e.message, e); + return R.fail(e.code, e.message); + } catch (Exception e) { + log.error("############sendOrderStatus: 系统异常", e); + return R.fail(500, "############sendOrderStatus: 系统异常"); } } @@ -119,7 +122,7 @@ public class FactoryCommonController { log.info("############sendReceiveInfo: 请求参数{}", receiveInfoDTO); //处理数据 // R r = factoryCommonService.sendReceiveInfo(receiveInfoDTO); - try{ + try { //先保存原始请求数据 OrderStatusLog orderStatusLog = new OrderStatusLog(); @@ -128,21 +131,21 @@ public class FactoryCommonController { orderStatusLog.setType(4); orderStatusLogService.save(orderStatusLog); - Map<String,Object> map=new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("messageId", CommonUtil.getUUID()); map.put("logId", orderStatusLog.getId()); - map.put("messageData",receiveInfoDTO); - map.put("createTime",new Date().getTime()); + map.put("messageData", receiveInfoDTO); + map.put("createTime", new Date().getTime()); //将消息携带绑定键值 rabbitTemplate.convertAndSend(RabbitConstant.RECEIVE_INFO_EXCHANGE, RabbitConstant.RECEIVE_INFO_ROUTING, map); return R.success("调用成功"); - }catch (CustomerException e){ - log.error(e.message,e); - return R.fail(e.code,e.message); - }catch (Exception e){ - log.error("############sendReceiveInfo: 系统异常",e); - return R.fail(500,"############sendReceiveInfo: 系统异常"); + } catch (CustomerException e) { + log.error(e.message, e); + return R.fail(e.code, e.message); + } catch (Exception e) { + log.error("############sendReceiveInfo: 系统异常", e); + return R.fail(500, "############sendReceiveInfo: 系统异常"); } } @@ -155,8 +158,12 @@ public class FactoryCommonController { public R sendUnloadCarComInfo(@RequestBody UnloadCarDTO receiveInfoDTO) { log.info("############sendUnloadCarComInfo: 请求参数{}", receiveInfoDTO); //处理数据 -// R r = factoryCommonService.sendReceiveInfo(receiveInfoDTO); - try{ + try { + + if (StringUtil.isBlank(receiveInfoDTO.getCompleteDate())) { + String data = DateUtil.format(new Date(), "yyyy-mm-dd HH:mm:ss"); + receiveInfoDTO.setCompleteDate(data); + } //先保存原始请求数据 OrderStatusLog orderStatusLog = new OrderStatusLog(); @@ -165,27 +172,23 @@ public class FactoryCommonController { orderStatusLog.setType(5); orderStatusLogService.save(orderStatusLog); - Map<String,Object> map=new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("messageId", CommonUtil.getUUID()); map.put("logId", orderStatusLog.getId()); - map.put("messageData",receiveInfoDTO); - map.put("createTime",new Date().getTime()); + map.put("messageData", receiveInfoDTO); + map.put("createTime", new Date().getTime()); //将消息携带绑定键值 // rabbitTemplate.convertAndSend(RabbitConstant.UNLOAD_CAR_COM_INFO_EXCHANGE, RabbitConstant.UNLOAD_CAR_COM_INFO_ROUTING, map); return R.success("调用成功"); - }catch (CustomerException e){ - log.error(e.message,e); - return R.fail(e.code,e.message); - }catch (Exception e){ - log.error("############sendReceiveInfo: 系统异常",e); - return R.fail(500,"############sendReceiveInfo: 系统异常"); + } catch (CustomerException e) { + log.error(e.message, e); + return R.fail(e.code, e.message); + } catch (Exception e) { + log.error("############sendReceiveInfo: 系统异常", e); + return R.fail(500, "############sendReceiveInfo: 系统异常"); } } - - - - } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtUnLoadCarNumDTO.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtUnLoadCarNumDTO.java index cba11e26b..dcc1f1113 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtUnLoadCarNumDTO.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtUnLoadCarNumDTO.java @@ -15,6 +15,6 @@ public class MtUnLoadCarNumDTO implements Serializable { @JsonProperty("确认收货时间") - private Date invoiceTime; + private String invoiceTime; } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryDataService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryDataService.java index e464e8281..23fc91a8d 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryDataService.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryDataService.java @@ -30,5 +30,5 @@ public interface IMtFactoryDataService { * @param data 确认收货时间 * @return */ - R sendUnloadCarNum(String unloadCarNum, Date data) throws ParseException, JsonProcessingException, NoSuchAlgorithmException; + R sendUnloadCarNum(String unloadCarNum, String data) throws ParseException, JsonProcessingException, NoSuchAlgorithmException; } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java index b13922124..7bed149f4 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java @@ -486,7 +486,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { @Override - public R sendUnloadCarNum(String unloadCarNum, Date data) throws ParseException, JsonProcessingException, NoSuchAlgorithmException { + public R sendUnloadCarNum(String unloadCarNum, String data) throws ParseException, JsonProcessingException, NoSuchAlgorithmException { MtUnLoadCarNumDTO unLoadCarNumDTO = new MtUnLoadCarNumDTO(); diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/UnloadCarComHandler.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/UnloadCarComHandler.java index ef1ac2d32..bb481c46a 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/UnloadCarComHandler.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/UnloadCarComHandler.java @@ -12,6 +12,7 @@ import com.logpm.oldproject.entity.AdvanceDetailEntity; import com.logpm.oldproject.feign.IAdvanceClient; import com.logpm.oldproject.feign.IAdvanceDetailClient; import com.rabbitmq.client.Channel; +import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.springblade.common.constant.RabbitConstant; import org.springblade.core.tool.api.R; @@ -60,12 +61,16 @@ public class UnloadCarComHandler { 4.查询包间对应的梦天发给我们的批次号 */ UnloadCarDTO unloadCarDTO = (UnloadCarDTO) map.get("messageData"); + log.info("##################unloadCarComDataHandler:消费内容{}",unloadCarDTO); + /* 2.通过车次查询来系统中车次绑定的运单 3.通过运单查询货物上的包件 4.需要过滤出来 只要梦天的 */ List<AdvanceDetailEntity> carNumList = advanceDetailClient.getByCarNum(unloadCarDTO.getUnloadCarNum()); + log.info("##################unloadCarComDataHandler carNumList:{}",carNumList); + /** * 安装品类进行分组 @@ -109,13 +114,13 @@ public class UnloadCarComHandler { } if (isPush) { try { - Date data = new SimpleDateFormat().parse(unloadCarDTO.getCompleteDate()); - R r = mtFactoryDataService.sendUnloadCarNum(unloadCarDTO.getUnloadCarNum(), data); + + R r = mtFactoryDataService.sendUnloadCarNum(unloadCarDTO.getUnloadCarNum(), unloadCarDTO.getCompleteDate()); if(r.isSuccess()){ // 更新订单状态 UpdateChainWrapper<MtFactoryOrderMain> updateChainWrapper =new UpdateChainWrapper<MtFactoryOrderMain>(MtFactoryOrderMain.class); updateChainWrapper.set("push_status","1"); - updateChainWrapper.set("push_time",data); + updateChainWrapper.set("push_time",new Date()); updateChainWrapper.eq("invoice_order_code",unloadCarDTO.getUnloadCarNum()); mtFactoryOrderMainService.update(updateChainWrapper); } @@ -130,6 +135,9 @@ public class UnloadCarComHandler { } + }else { + log.info("##################{} 车次 没有匹配需要推送的数据", unloadCarDTO.getUnloadCarNum()); + }