1 changed files with 52 additions and 71 deletions
@ -1,87 +1,68 @@ |
|||||||
package com.logpm.factory.receiver; |
package com.logpm.factory.receiver; |
||||||
|
|
||||||
import cn.hutool.json.JSONObject; |
|
||||||
import cn.hutool.json.JSONUtil; |
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException; |
|
||||||
import com.logpm.factory.mt.service.IMtFactoryDataService; |
import com.logpm.factory.mt.service.IMtFactoryDataService; |
||||||
import lombok.AllArgsConstructor; |
import lombok.AllArgsConstructor; |
||||||
import lombok.extern.slf4j.Slf4j; |
import lombok.extern.slf4j.Slf4j; |
||||||
import org.springblade.common.constant.broadcast.FanoutConstants; |
|
||||||
import org.springblade.common.enums.BizOperationEnums; |
|
||||||
import org.springblade.common.enums.PackageTypeEnums; |
|
||||||
import org.springblade.common.exception.CustomerException; |
|
||||||
import org.springblade.common.model.DistributionSignforVO; |
|
||||||
import org.springblade.common.model.NodeFanoutMsg; |
|
||||||
import org.springblade.common.model.PackageData; |
|
||||||
import org.springblade.core.tool.utils.DateUtil; |
|
||||||
import org.springframework.amqp.core.ExchangeTypes; |
|
||||||
import org.springframework.amqp.rabbit.annotation.Exchange; |
|
||||||
import org.springframework.amqp.rabbit.annotation.Queue; |
|
||||||
import org.springframework.amqp.rabbit.annotation.QueueBinding; |
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener; |
|
||||||
import org.springframework.stereotype.Component; |
|
||||||
|
|
||||||
import java.security.NoSuchAlgorithmException; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
/** |
||||||
* 作业节点数据监听 |
* 作业节点数据监听 |
||||||
*/ |
*/ |
||||||
@Slf4j |
@Slf4j |
||||||
@AllArgsConstructor |
@AllArgsConstructor |
||||||
@Component |
// @Component
|
||||||
public class NodeWorkHandler { |
public class NodeWorkHandler { |
||||||
|
|
||||||
private final IMtFactoryDataService mtFactoryDataService; |
private final IMtFactoryDataService mtFactoryDataService; |
||||||
@RabbitListener(bindings = @QueueBinding( |
// 梦天签收回推走总线了,这里不需要了
|
||||||
value = @Queue(name = FanoutConstants.distribution.DeliveryAndSignfor.QUEUE.FACTORY_NODE_WORK_DISTRIBUTION_SIGNFOR_QUERY), |
// @RabbitListener(bindings = @QueueBinding(
|
||||||
exchange = @Exchange(name = FanoutConstants.distribution.DeliveryAndSignfor.EXCHANGE, type = ExchangeTypes.FANOUT) |
// value = @Queue(name = FanoutConstants.distribution.DeliveryAndSignfor.QUEUE.FACTORY_NODE_WORK_DISTRIBUTION_SIGNFOR_QUERY),
|
||||||
)) |
// exchange = @Exchange(name = FanoutConstants.distribution.DeliveryAndSignfor.EXCHANGE, type = ExchangeTypes.FANOUT)
|
||||||
public void distributionSignforQuery(String message) { |
// ))
|
||||||
|
// public void distributionSignforQuery(String message) {
|
||||||
try { |
//
|
||||||
NodeFanoutMsg bean = JSONUtil.toBean(message, NodeFanoutMsg.class); |
// try {
|
||||||
Object main = bean.getMain(); |
// NodeFanoutMsg bean = JSONUtil.toBean(message, NodeFanoutMsg.class);
|
||||||
JSONObject entries = JSONUtil.parseObj(main); |
// Object main = bean.getMain();
|
||||||
DistributionSignforVO vo = JSONUtil.toBean(entries, DistributionSignforVO.class); |
// JSONObject entries = JSONUtil.parseObj(main);
|
||||||
List<PackageData> details = vo.getPackageDataList(); |
// DistributionSignforVO vo = JSONUtil.toBean(entries, DistributionSignforVO.class);
|
||||||
details.forEach(t->{ |
// List<PackageData> details = vo.getPackageDataList();
|
||||||
if(t.getPackageType().equals(PackageTypeEnums.CMP)){ |
// details.forEach(t->{
|
||||||
String orderPackageCode = t.getPackageCode(); |
// if(t.getPackageType().equals(PackageTypeEnums.CMP)){
|
||||||
String operationTime = DateUtil.format(bean.getOperatorTime(),"yyyy-MM-dd hh:mm:ss"); |
// String orderPackageCode = t.getPackageCode();
|
||||||
Long distributionContactId = vo.getReservationId(); |
// String operationTime = DateUtil.format(bean.getOperatorTime(),"yyyy-MM-dd hh:mm:ss");
|
||||||
String destinationWarehouse = bean.getWarehouse(); |
// Long distributionContactId = vo.getReservationId();
|
||||||
|
// String destinationWarehouse = bean.getWarehouse();
|
||||||
// 获取品牌BrandEnums.MTMM.getValue()
|
//
|
||||||
String o = t.getBrand(); |
// // 获取品牌BrandEnums.MTMM.getValue()
|
||||||
switch (o) { |
// String o = t.getBrand();
|
||||||
case "梦天" : |
// switch (o) {
|
||||||
log.info("工厂节点数据监听:1"); |
// case "梦天" :
|
||||||
try { |
// log.info("工厂节点数据监听:1");
|
||||||
mtFactoryDataService.qianshouScanForNewSystem(orderPackageCode, operationTime, distributionContactId+"", destinationWarehouse); |
// try {
|
||||||
} catch (Exception e) { |
// mtFactoryDataService.qianshouScanForNewSystem(orderPackageCode, operationTime, distributionContactId+"", destinationWarehouse);
|
||||||
throw new CustomerException("服务器异常"+e.getMessage()); |
// } catch (Exception e) {
|
||||||
} |
// throw new CustomerException("服务器异常"+e.getMessage());
|
||||||
break; |
// }
|
||||||
default: |
// break;
|
||||||
log.info("签收扫描没有找到品牌: {}",o); |
// default:
|
||||||
} |
// log.info("签收扫描没有找到品牌: {}",o);
|
||||||
} |
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
}); |
//
|
||||||
|
// });
|
||||||
// JSONObject jsonObject = JSONUtil.parseObj(message);
|
//
|
||||||
|
// // JSONObject jsonObject = JSONUtil.parseObj(message);
|
||||||
}catch (Exception e){ |
//
|
||||||
log.error("工厂节点数据监听异常", e); |
// }catch (Exception e){
|
||||||
} |
// log.error("工厂节点数据监听异常", e);
|
||||||
|
// }
|
||||||
|
//
|
||||||
} |
//
|
||||||
|
// }
|
||||||
|
|
||||||
} |
} |
||||||
|
Loading…
Reference in new issue