Browse Source

1.增加梦天的推送 采用延迟队列 进行推送

single_db
pref_mail@163.com 1 year ago
parent
commit
e6065c8c52
  1. 130
      blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java
  2. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java
  3. 60
      blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java
  4. 58
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/feign/MtOrderMainClinet.java
  5. 55
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/receiver/BusinessData2FactoryHandler.java
  6. 49
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/receiver/BusinessDataClerkCheck2FactoryHandler.java
  7. 11
      blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java
  8. 50
      blade-service/logpm-factory/src/test/resources/application.yml

130
blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java

@ -7,114 +7,130 @@ package org.springblade.common.constant;
*/
public interface RabbitConstant {
//消费失败队列
String ERROR_QUEUE = "error_queue"+ModuleNameConstant.DEVAUTH;
String ERROR_EXCHANGE = "error_exchange"+ModuleNameConstant.DEVAUTH;
String ERROR_ROUTING = "error_routing"+ModuleNameConstant.DEVAUTH;
String ERROR_QUEUE = "error_queue" + ModuleNameConstant.DEVAUTH;
String ERROR_EXCHANGE = "error_exchange" + ModuleNameConstant.DEVAUTH;
String ERROR_ROUTING = "error_routing" + ModuleNameConstant.DEVAUTH;
//订单状态消息队列配置
String ORDER_STATUS_QUEUE = "order_status_queue"+ModuleNameConstant.DEVAUTH;
String ORDER_STATUS_EXCHANGE = "order_status_exchange"+ModuleNameConstant.DEVAUTH;
String ORDER_STATUS_ROUTING = "order_status_routing"+ModuleNameConstant.DEVAUTH;
String ORDER_STATUS_QUEUE = "order_status_queue" + ModuleNameConstant.DEVAUTH;
String ORDER_STATUS_EXCHANGE = "order_status_exchange" + ModuleNameConstant.DEVAUTH;
String ORDER_STATUS_ROUTING = "order_status_routing" + ModuleNameConstant.DEVAUTH;
String OPEN_ORDER_QUEUE = "open_order_queue"+ModuleNameConstant.DEVAUTH;
String OPEN_ORDER_EXCHANGE = "open_order_exchange"+ModuleNameConstant.DEVAUTH;
String OPEN_ORDER_ROUTING = "open_order_routing"+ModuleNameConstant.DEVAUTH;
String OPEN_ORDER_QUEUE = "open_order_queue" + ModuleNameConstant.DEVAUTH;
String OPEN_ORDER_EXCHANGE = "open_order_exchange" + ModuleNameConstant.DEVAUTH;
String OPEN_ORDER_ROUTING = "open_order_routing" + ModuleNameConstant.DEVAUTH;
String DEAL_WITH_QUEUE = "deal_with_queue"+ModuleNameConstant.DEVAUTH+ModuleNameConstant.DEVAUTH;
String DEAL_WITH_EXCHANGE = "deal_with_exchange"+ModuleNameConstant.DEVAUTH;
String DEAL_WITH_ROUTING = "deal_with_routing"+ModuleNameConstant.DEVAUTH;
String DEAL_WITH_QUEUE = "deal_with_queue" + ModuleNameConstant.DEVAUTH + ModuleNameConstant.DEVAUTH;
String DEAL_WITH_EXCHANGE = "deal_with_exchange" + ModuleNameConstant.DEVAUTH;
String DEAL_WITH_ROUTING = "deal_with_routing" + ModuleNameConstant.DEVAUTH;
String RECEIVE_INFO_QUEUE = "receive_info_queue"+ModuleNameConstant.DEVAUTH;
String RECEIVE_INFO_EXCHANGE = "receive_info_exchange"+ModuleNameConstant.DEVAUTH;
String RECEIVE_INFO_ROUTING = "receive_info_routing"+ModuleNameConstant.DEVAUTH;
String RECEIVE_INFO_QUEUE = "receive_info_queue" + ModuleNameConstant.DEVAUTH;
String RECEIVE_INFO_EXCHANGE = "receive_info_exchange" + ModuleNameConstant.DEVAUTH;
String RECEIVE_INFO_ROUTING = "receive_info_routing" + ModuleNameConstant.DEVAUTH;
/**
* 卸车完成确认
*/
String UNLOAD_CAR_COM_INFO_QUEUE = "unload_car_com_info_quere";
String UNLOAD_CAR_COM_INFO_EXCHANGE = "unload_car_com_info_exchange"+ModuleNameConstant.DEVAUTH;
String UNLOAD_CAR_COM_INFO_EXCHANGE = "unload_car_com_info_exchange" + ModuleNameConstant.DEVAUTH;
String UNLOAD_CAR_COM_INFO_ROUTING = "unload_car_com_info_routing ";
String WAYBILL_DATA_QUEUE = "waybill_data_queue"+ModuleNameConstant.DEVAUTH;
String WAYBILL_DATA_EXCHANGE = "waybill_data_exchange"+ModuleNameConstant.DEVAUTH;
String WAYBILL_DATA_ROUTING = "waybill_data_routing"+ModuleNameConstant.DEVAUTH;
String WAYBILL_DATA_QUEUE = "waybill_data_queue" + ModuleNameConstant.DEVAUTH;
String WAYBILL_DATA_EXCHANGE = "waybill_data_exchange" + ModuleNameConstant.DEVAUTH;
String WAYBILL_DATA_ROUTING = "waybill_data_routing" + ModuleNameConstant.DEVAUTH;
String WAYBILL_DATA_TEST_QUEUE = "waybill_data_test_queue"+ModuleNameConstant.DEVAUTH;
String WAYBILL_DATA_TEST_EXCHANGE = "waybill_data_test_exchange"+ModuleNameConstant.DEVAUTH;
String WAYBILL_DATA_TEST_ROUTING = "waybill_data_test_routing"+ModuleNameConstant.DEVAUTH;
String WAYBILL_DATA_TEST_QUEUE = "waybill_data_test_queue" + ModuleNameConstant.DEVAUTH;
String WAYBILL_DATA_TEST_EXCHANGE = "waybill_data_test_exchange" + ModuleNameConstant.DEVAUTH;
String WAYBILL_DATA_TEST_ROUTING = "waybill_data_test_routing" + ModuleNameConstant.DEVAUTH;
//消费失败队列
String WAREHOUSE_ERROR_QUEUE = "warehouse_error_queue"+ModuleNameConstant.DEVAUTH;
String WAREHOUSE_ERROR_EXCHANGE = "warehouse_error_exchange"+ModuleNameConstant.DEVAUTH;
String WAREHOUSE_ERROR_ROUTING = "warehouse_error_routing"+ModuleNameConstant.DEVAUTH;
String WAREHOUSE_ERROR_QUEUE = "warehouse_error_queue" + ModuleNameConstant.DEVAUTH;
String WAREHOUSE_ERROR_EXCHANGE = "warehouse_error_exchange" + ModuleNameConstant.DEVAUTH;
String WAREHOUSE_ERROR_ROUTING = "warehouse_error_routing" + ModuleNameConstant.DEVAUTH;
String OUPAI_RECEIVING_QUEUE = "oupai_receiving_queue"+ModuleNameConstant.DEVAUTH;
String OUPAI_RECEIVING_EXCHANGE = "oupai_receiving_exchange"+ModuleNameConstant.DEVAUTH;
String OUPAI_RECEIVING_ROUTING = "oupai_receiving_routing"+ModuleNameConstant.DEVAUTH;
String OUPAI_RECEIVING_QUEUE = "oupai_receiving_queue" + ModuleNameConstant.DEVAUTH;
String OUPAI_RECEIVING_EXCHANGE = "oupai_receiving_exchange" + ModuleNameConstant.DEVAUTH;
String OUPAI_RECEIVING_ROUTING = "oupai_receiving_routing" + ModuleNameConstant.DEVAUTH;
/****************************收货入库 老系统 start ************************************************/
String OUPAI_OLD_RECEIVING_QUEUE = "oupai_old_receiving_queue"+ModuleNameConstant.DEVAUTH;
String OUPAI_OLD_RECEIVING_EXCHANGE = "oupai_old_receiving_exchange"+ModuleNameConstant.DEVAUTH;
String OUPAI_OLD_RECEIVING_ROUTING = "oupai_old_receiving_routing"+ModuleNameConstant.DEVAUTH;
String OUPAI_OLD_RECEIVING_QUEUE = "oupai_old_receiving_queue" + ModuleNameConstant.DEVAUTH;
String OUPAI_OLD_RECEIVING_EXCHANGE = "oupai_old_receiving_exchange" + ModuleNameConstant.DEVAUTH;
String OUPAI_OLD_RECEIVING_ROUTING = "oupai_old_receiving_routing" + ModuleNameConstant.DEVAUTH;
/****************************收货入库 老系统 end ************************************************/
String OUPAI_SIGN_QUEUE = "oupai_sign_queue"+ModuleNameConstant.DEVAUTH;
String OUPAI_SIGN_EXCHANGE = "oupai_sign_exchange"+ModuleNameConstant.DEVAUTH;
String OUPAI_SIGN_ROUTING = "oupai_sign_routing"+ModuleNameConstant.DEVAUTH;
String OUPAI_SIGN_QUEUE = "oupai_sign_queue" + ModuleNameConstant.DEVAUTH;
String OUPAI_SIGN_EXCHANGE = "oupai_sign_exchange" + ModuleNameConstant.DEVAUTH;
String OUPAI_SIGN_ROUTING = "oupai_sign_routing" + ModuleNameConstant.DEVAUTH;
String SYNC_OLD_DATA_QUEUE = "sync_old_data_queue"+ModuleNameConstant.DEVAUTH;
String SYNC_OLD_DATA_EXCHANGE = "sync_old_data_exchange"+ModuleNameConstant.DEVAUTH;
String SYNC_OLD_DATA_ROUTING = "sync_old_data_routing"+ModuleNameConstant.DEVAUTH;
String SYNC_OLD_DATA_QUEUE = "sync_old_data_queue" + ModuleNameConstant.DEVAUTH;
String SYNC_OLD_DATA_EXCHANGE = "sync_old_data_exchange" + ModuleNameConstant.DEVAUTH;
String SYNC_OLD_DATA_ROUTING = "sync_old_data_routing" + ModuleNameConstant.DEVAUTH;
//----------------------distribution---------------------
//备货消费失败队列
String DISTRIBUTION_ERROR_QUEUE = "distribution_error_queue"+ModuleNameConstant.DEVAUTH;
String DISTRIBUTION_ERROR_EXCHANGE = "distribution_error_exchange"+ModuleNameConstant.DEVAUTH;
String DISTRIBUTION_ERROR_ROUTING = "distribution_error_routing"+ModuleNameConstant.DEVAUTH;
String DISTRIBUTION_ERROR_QUEUE = "distribution_error_queue" + ModuleNameConstant.DEVAUTH;
String DISTRIBUTION_ERROR_EXCHANGE = "distribution_error_exchange" + ModuleNameConstant.DEVAUTH;
String DISTRIBUTION_ERROR_ROUTING = "distribution_error_routing" + ModuleNameConstant.DEVAUTH;
String STOCKUP_SCAN_QUEUE = "stockup_scan_queue"+ModuleNameConstant.DEVAUTH;
String STOCKUP_SCAN_EXCHANGE = "stockup_scan_exchange"+ModuleNameConstant.DEVAUTH;
String STOCKUP_SCAN_ROUTING = "stockup_scan_routing"+ModuleNameConstant.DEVAUTH;
String STOCKUP_SCAN_QUEUE = "stockup_scan_queue" + ModuleNameConstant.DEVAUTH;
String STOCKUP_SCAN_EXCHANGE = "stockup_scan_exchange" + ModuleNameConstant.DEVAUTH;
String STOCKUP_SCAN_ROUTING = "stockup_scan_routing" + ModuleNameConstant.DEVAUTH;
/**
* 备货判断是否下架
*/
String STOCKUP_STATE_UPDATE_QUEUE = "stockup_state_update_queue"+ModuleNameConstant.DEVAUTH;
String STOCKUP_STATE_UPDATE_EXCHANGE = "stockup_state_update_exchange"+ModuleNameConstant.DEVAUTH;
String STOCKUP_STATE_UPDATE_ROUTING = "stockup_state_update_routing"+ModuleNameConstant.DEVAUTH;
String STOCKUP_STATE_UPDATE_QUEUE = "stockup_state_update_queue" + ModuleNameConstant.DEVAUTH;
String STOCKUP_STATE_UPDATE_EXCHANGE = "stockup_state_update_exchange" + ModuleNameConstant.DEVAUTH;
String STOCKUP_STATE_UPDATE_ROUTING = "stockup_state_update_routing" + ModuleNameConstant.DEVAUTH;
/****************文员复合签收推送老系统队列 start *************************/
String CLERK_CHECK_PUSH_DATA_QUEUE = "clerk_check_push_data_queue"+ModuleNameConstant.DEVAUTH;
String CLERK_CHECK_PUSH_DATA_EXCHANGE = "clerk_check_push_data_exchange"+ModuleNameConstant.DEVAUTH;
String CLERK_CHECK_PUSH_DATA_ROUTING = "clerk_check_push_data_routing"+ModuleNameConstant.DEVAUTH;
String CLERK_CHECK_PUSH_DATA_QUEUE = "clerk_check_push_data_queue" + ModuleNameConstant.DEVAUTH;
String CLERK_CHECK_PUSH_DATA_EXCHANGE = "clerk_check_push_data_exchange" + ModuleNameConstant.DEVAUTH;
String CLERK_CHECK_PUSH_DATA_ROUTING = "clerk_check_push_data_routing" + ModuleNameConstant.DEVAUTH;
/****************文员复合签收推送老系统队列 end *************************/
/****************包件状态变化 start*************************************************/
String ORDER_PACKAGE_STATUS_INFO_QUEUE = "order_package_status_info_queue"+ModuleNameConstant.DEVAUTH;
String ORDER_PACKAGE_STATUS_INFO_EXCHANGE = "order_package_status_info_exchange"+ModuleNameConstant.DEVAUTH;
String ORDER_PACKAGE_STATUS_INFO_ROUTING = "order_package_status_info_routing"+ModuleNameConstant.DEVAUTH;
String ORDER_PACKAGE_STATUS_INFO_QUEUE = "order_package_status_info_queue" + ModuleNameConstant.DEVAUTH;
String ORDER_PACKAGE_STATUS_INFO_EXCHANGE = "order_package_status_info_exchange" + ModuleNameConstant.DEVAUTH;
String ORDER_PACKAGE_STATUS_INFO_ROUTING = "order_package_status_info_routing" + ModuleNameConstant.DEVAUTH;
/****************包件状态变化 end*************************************************/
/****************************************梦天签收扫描数据推送 start***********************************************/
String MT_BUSINESS_DATA_2_FACTORY_QUEUE = "mt_business_data_2_factory_queue" + ModuleNameConstant.DEVAUTH;
String MT_BUSINESS_DATA_2_FACTORY_EXCHANGE = "mt_business_data_2_factory_exchange" + ModuleNameConstant.DEVAUTH;
String MT_BUSINESS_DATA_2_FACTORY_ROUTING = "mt_business_data_2_factory_routing" + ModuleNameConstant.DEVAUTH;
/***************************************梦天签收扫描数据推送 end************************************************/
/****************************************梦天签收复核数据推送 start***********************************************/
String MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_QUEUE = "mt_business_data_clerk_check_2_factory_queue" + ModuleNameConstant.DEVAUTH;
String MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_EXCHANGE = "mt_business_data_clerk_check_2_factory_exchange" + ModuleNameConstant.DEVAUTH;
String MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_ROUTING = "mt_business_data_clerk_check_2_factory_routing" + ModuleNameConstant.DEVAUTH;
/***************************************梦天签收复核数据推送 end************************************************/
/****************test队列******************/
String TEST_RECEIVE_INFO_QUEUE = "test_receive_info_queue"+ModuleNameConstant.DEVAUTH;
String TEST_RECEIVE_INFO_EXCHANGE = "test_receive_info_exchange"+ModuleNameConstant.DEVAUTH;
String TEST_RECEIVE_INFO_ROUTING = "test_receive_info_routing"+ModuleNameConstant.DEVAUTH;
String TEST_RECEIVE_INFO_QUEUE = "test_receive_info_queue" + ModuleNameConstant.DEVAUTH;
String TEST_RECEIVE_INFO_EXCHANGE = "test_receive_info_exchange" + ModuleNameConstant.DEVAUTH;
String TEST_RECEIVE_INFO_ROUTING = "test_receive_info_routing" + ModuleNameConstant.DEVAUTH;
}

1
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java

@ -1725,6 +1725,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
Map<String, List<DistributionStockArticleEntity>> orderMap = distributionStockArticleEntities.stream().collect(Collectors.groupingBy(DistributionStockArticleEntity::getBrand));
for (String s : split) {
orderMap.forEach((k,v)->{
log.info(">>>> 构建复核签收订单的品牌信息 {}",k);
if (k.equals(s)){
List<MtReceiveContentDTO> mtReceiveContentDTOS = new ArrayList<>();
for (DistributionStockArticleEntity distributionStockArticleEntity : v) {

60
blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java

@ -14,6 +14,8 @@ import org.springframework.context.annotation.Configuration;
import java.util.Map;
import static io.protostuff.MapSchema.MessageFactories.HashMap;
/**
* RabbitMQ配置主要是配置队列如果提前存在该队列可以省略本配置类
*
@ -53,6 +55,12 @@ public class RabbitMqConfiguration {
template.setReturnsCallback(new RabbitTemplate.ReturnsCallback() {
@Override
public void returnedMessage(ReturnedMessage returnedMessage) {
if("mt_business_data_2_factory_exchange-pref".equals(returnedMessage.getExchange())){
return ;
}
System.out.println("返回回调-消息:"+returnedMessage.getMessage());
System.out.println("返回回调-回应码:"+returnedMessage.getReplyCode());
System.out.println("返回回调-回应信息:"+returnedMessage.getReplyText());
@ -288,6 +296,42 @@ public class RabbitMqConfiguration {
return BindingBuilder.bind(syncOldDataQueue).to(syncOldDataExchange).with(RabbitConstant.SYNC_OLD_DATA_ROUTING).noargs();
}
/**************梦天扫描延迟推送 start****************/
@Bean
public Queue mtBusinessData2FactoryQueue() {
Map<String, Object> args =Maps.newHashMap();
args.put("x-message-ttl",5000);
return new Queue(RabbitConstant.MT_BUSINESS_DATA_2_FACTORY_QUEUE,true,false,false,args);
}
@Bean
public CustomExchange mtBusinessData2FactoryExchange() {
Map<String, Object> args =Maps.newHashMap();
args.put("x-delayed-type", "direct");
return new CustomExchange(RabbitConstant.MT_BUSINESS_DATA_2_FACTORY_EXCHANGE,
"x-delayed-message", true, false, args);
}
@Bean
public Binding mtBusinessData2FactoryBinding(Queue mtBusinessData2FactoryQueue, CustomExchange mtBusinessData2FactoryExchange) {
return BindingBuilder.bind(mtBusinessData2FactoryQueue).to(mtBusinessData2FactoryExchange).with(RabbitConstant.MT_BUSINESS_DATA_2_FACTORY_ROUTING).noargs();
}
/**************梦天扫描延迟推送 end****************/
/**************梦天扫描延迟推送 start****************/
@Bean
public Queue mtBusinessDataClerkCheck2FactoryQueue() {
Map<String, Object> args =Maps.newHashMap();
args.put("x-message-ttl",5000);
return new Queue(RabbitConstant.MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_QUEUE,true,false,false,args);
}
@Bean
public Queue normalQueue() {
@ -306,5 +350,21 @@ public class RabbitMqConfiguration {
return BindingBuilder.bind(normalQueue).to(normalExchange).with("normal_routerkey").noargs();
}
@Bean
public CustomExchange mtBusinessDataClerkCheck2FactoryExchange() {
Map<String, Object> args =Maps.newHashMap();
args.put("x-delayed-type", "direct");
return new CustomExchange(RabbitConstant.MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_EXCHANGE,
"x-delayed-message", true, false, args);
}
@Bean
public Binding mtBusinessDataClerkCheck2FactoryBinding(Queue mtBusinessData2FactoryQueue, CustomExchange mtBusinessData2FactoryExchange) {
return BindingBuilder.bind(mtBusinessData2FactoryQueue).to(mtBusinessData2FactoryExchange).with(RabbitConstant.MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_ROUTING).noargs();
}
/**************梦天扫描延迟推送 end****************/
}

58
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/feign/MtOrderMainClinet.java

@ -1,19 +1,30 @@
package com.logpm.factory.mt.feign;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.logpm.factory.mt.dto.MtReceiveDTO;
import com.logpm.factory.mt.service.IMtFactoryDataService;
import com.logpm.factory.mt.service.IMtFactoryOrderMainService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.bridge.MessageUtil;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@NonDS
@ApiIgnore
@ -22,16 +33,38 @@ import java.security.NoSuchAlgorithmException;
@Slf4j
public class MtOrderMainClinet implements IMtOrderMainClinet {
private final IMtFactoryOrderMainService mtFactoryOrderMainService;
private final IMtFactoryDataService mtFactoryDataService;
@Autowired
private RabbitTemplate rabbitTemplate;
@Autowired
private IMtFactoryDataService mtFactoryDataService;
@Override
@GetMapping(TOP)
public R sendOrderPackageScan(String orderPackageCode, String operationTime, String distributionContactId, String distributionContactCode, String destinationWarehouse) throws NoSuchAlgorithmException, JsonProcessingException {
log.info(">>>>>>> 签收扫描 start");
return mtFactoryDataService.qianshouScanForNewSystem(orderPackageCode,operationTime,distributionContactId,destinationWarehouse);
// return null;
Map<String,Object> map = new HashMap<>();
JSONObject jsonObject = new JSONObject();
jsonObject.put("orderPackageCode",orderPackageCode);
jsonObject.put("operationTime",operationTime);
jsonObject.put("distributionContactId",distributionContactId);
jsonObject.put("distributionContactCode",distributionContactCode);
jsonObject.put("destinationWarehouse",destinationWarehouse);
map.put("messageData",jsonObject.toJSONString());
log.info(">>>>>>>>>>>>>>>>> 司机扫描 {}", DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss.SSS"));
rabbitTemplate.convertAndSend(RabbitConstant.MT_BUSINESS_DATA_2_FACTORY_EXCHANGE,RabbitConstant.MT_BUSINESS_DATA_2_FACTORY_ROUTING, map,message -> {
message.getMessageProperties()
.setHeader("x-delay", 5000);
return message;
});
log.info(">>>>>>>>>>>>>>>>> 司机扫描 {}", DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss.SSS"));
return R.success("");
}
@ -39,7 +72,18 @@ public class MtOrderMainClinet implements IMtOrderMainClinet {
@PostMapping(SENDRECEIVEINFOBYNEWSYSTEM)
public R sendReceiveInfoByNewSystem(MtReceiveDTO mtReceiveDTO) throws NoSuchAlgorithmException, JsonProcessingException {
log.info(">>>>>>> 文员复核 start");
return mtFactoryDataService.sendReceiveInfoByNewSystem(mtReceiveDTO);
// return null;
Map<String,Object> map = new HashMap<>();
String mes = JSONObject.toJSONString(mtReceiveDTO);
map.put("messageData",mes);
log.info(">>>>>>>>>>>>>>>>> 文员复核 {}", DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss.SSS"));
rabbitTemplate.convertAndSend(RabbitConstant.MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_EXCHANGE,RabbitConstant.MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_ROUTING, map,message -> {
message.getMessageProperties()
.setHeader("x-delay", 5000);
return message;
});
return R.success("");
}
}

55
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/receiver/BusinessData2FactoryHandler.java

@ -0,0 +1,55 @@
package com.logpm.factory.mt.receiver;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.logpm.factory.mt.service.IMtFactoryDataService;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.Map;
/**
* 将数据回传给梦天工厂
*/
@Slf4j
@RabbitListener(queues = RabbitConstant.MT_BUSINESS_DATA_2_FACTORY_QUEUE)
@Component
public class BusinessData2FactoryHandler {
@Autowired
private IMtFactoryDataService mtFactoryDataService;
@RabbitHandler
public void sendOrderPackageScan(Map map, Message message, Channel channel) throws IOException, NoSuchAlgorithmException {
log.info(">>>>>>>>>>>>>>>>> 司机扫描推送 {}", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS"));
String json = (String) map.get("messageData");
JSONObject object = JSONObject.parseObject(json);
String orderPackageCode = object.getString("orderPackageCode");
String operationTime = object.getString("operationTime");
String distributionContactId = object.getString("distributionContactId");
String destinationWarehouse = object.getString("destinationWarehouse");
try {
mtFactoryDataService.qianshouScanForNewSystem(orderPackageCode, operationTime, distributionContactId, destinationWarehouse);
} catch (Exception e) {
log.error(">>>>>>", e);
}
}
}

49
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/receiver/BusinessDataClerkCheck2FactoryHandler.java

@ -0,0 +1,49 @@
package com.logpm.factory.mt.receiver;
import com.alibaba.fastjson.JSONObject;
import com.logpm.factory.mt.dto.MtReceiveDTO;
import com.logpm.factory.mt.service.IMtFactoryDataService;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.Map;
/**
* 将数据复核回传给梦天工厂
*/
@Slf4j
@RabbitListener(queues = RabbitConstant.MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_QUEUE)
@Component
public class BusinessDataClerkCheck2FactoryHandler {
@Autowired
private IMtFactoryDataService mtFactoryDataService;
@RabbitHandler
public void sendOrderPackageScan(Map map, Message message, Channel channel) throws IOException, NoSuchAlgorithmException {
log.info(">>>>>>>>>>>>>>>>> 文员复核推送 {}", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS"));
String json = (String) map.get("messageData");
MtReceiveDTO mtReceiveDTO = JSONObject.parseObject(json,MtReceiveDTO.class);
try {
mtFactoryDataService.sendReceiveInfoByNewSystem(mtReceiveDTO);
} catch (Exception e) {
log.error(">>>>>>", e);
}
}
}

11
blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java

@ -11,11 +11,13 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.common.utils.MD5Utils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.logpm.factory.excel.ExcelMode14;
import com.logpm.factory.excel.JpDataMode;
import com.logpm.factory.excel.OrderStatusLogMode;
import com.logpm.factory.listener.ExcelListener;
import com.logpm.factory.listener.OrderStatusLogListener;
import com.logpm.factory.mt.feign.IMtOrderMainClinet;
import com.logpm.factory.oupai.entity.FactoryPackageEntity;
import com.logpm.factory.oupai.entity.OpOrderStatusLogEntity;
import com.logpm.factory.oupai.service.IFactoryPackageService;
@ -72,6 +74,8 @@ import static com.logpm.factory.zb.untils.QmSignUntil.areNotEmpty;
@BladeBootTest(appName = "logpm-factory-pref", enableLoader = true)
public class TestService {
@Autowired
private IMtOrderMainClinet mtOrderMainClinet;
@Autowired
private IPanFactoryDataService panFactoryDataService;
@ -813,6 +817,13 @@ public class TestService {
}
@Test
public void test19() throws NoSuchAlgorithmException, JsonProcessingException {
mtOrderMainClinet.sendOrderPackageScan("0","1","2","3","4");
}

50
blade-service/logpm-factory/src/test/resources/application.yml

@ -0,0 +1,50 @@
#mybatis-plus配置
mybatis-plus:
mapper-locations: classpath:com/logpm/**/mapper/*Mapper.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.logpm.**.entity
#swagger扫描路径配置
swagger:
base-packages:
- org.springblade
- com.logpm
#oss配置
oss:
enabled: true
name: minio
tenant-mode: false
endpoint: http://127.0.0.1:9000
access-key: D99KGE6ZTQXSATTJWU24
secret-key: QyVqGnhIQQE734UYSUFlGOZViE6+ZlDEfUG3NjhJ
bucket-name: bladex
#blade配置
blade:
#本地文件上传
file:
remote-mode: true
upload-domain: http://localhost:8999
remote-path: /usr/share/nginx/html
logging:
config: classpath:logback.xml
spring:
main:
allow-circular-references: true
xxl:
job:
accessToken: ''
admin:
addresses: http://192.168.10.200:7009/xxl-job-admin
executor:
appname: logpm-factory-xxljob
ip: 127.0.0.1
logpath: ../data/applogs/logpm-factory-xxljob/jobhandler
logretentiondays: -1
port: 7020
Loading…
Cancel
Save