Browse Source

1.推送皮阿诺开单数据逻辑修改

dev-warehouse
zhenghaoyu 2 years ago
parent
commit
e604971b28
  1. 52
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OpenOrderHandler.java

52
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OpenOrderHandler.java

@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant; import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.exception.CustomerException; import org.springblade.common.exception.CustomerException;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.amqp.core.Message; import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler; import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.rabbit.annotation.RabbitListener;
@ -48,34 +49,43 @@ public class OpenOrderHandler {
String msg = new String(message.getBody()); String msg = new String(message.getBody());
log.info("##################我进入这里了 retryCount={}",retryCount++); log.info("##################我进入这里了 retryCount={}",retryCount++);
OrderInfoDTO orderInfoDTO = (OrderInfoDTO) map.get("messageData"); OrderInfoDTO orderInfoDTO = (OrderInfoDTO) map.get("messageData");
String orderNo = orderInfoDTO.getOrderNo();//订单自编号 String orderNoStr = orderInfoDTO.getOrderNo();//订单自编号
//通过订单自编号去查询该条订单是属于哪个工厂 String[] split = orderNoStr.split(",");
AdvanceEntity advanceEntity = advanceClient.getQueryDataOne(orderNo); for (String orderNo:split){
if(Objects.isNull(advanceEntity)){ if(StringUtil.isBlank(orderNo)){
log.info("##################openOrderStatusHandler: 未找到对应订单 orderNo={}",orderNo); continue;
}
//通过订单自编号去查询该条订单是属于哪个工厂
AdvanceEntity advanceEntity = advanceClient.getQueryDataOne(orderNo);
if(Objects.isNull(advanceEntity)){
log.info("##################openOrderStatusHandler: 未找到对应订单 orderNo={}",orderNo);
// channel.basicAck(deliveryTag,true); // channel.basicAck(deliveryTag,true);
return; return;
} }
String type = advanceEntity.getType();//品牌 String type = advanceEntity.getType();//品牌
R r = null; orderInfoDTO.setOrderNo(orderNo);
switch (type){ R r = null;
case FactoryConstant.PIANO: switch (type){
r = panFactoryDataService.handleData(orderInfoDTO); case FactoryConstant.PIANO:
int code = r.getCode(); r = panFactoryDataService.handleData(orderInfoDTO);
if(code == 400 || code == 200){ int code = r.getCode();
log.info("##################openOrderStatusHandler: 该条数据不用处理 orderNo={}",orderNo); if(code == 400 || code == 200){
log.info("##################openOrderStatusHandler: 该条数据不用处理 orderNo={}",orderNo);
// channel.basicAck(deliveryTag,true); // channel.basicAck(deliveryTag,true);
}else{ }else{
throw new CustomerException(code,r.getMsg()); throw new CustomerException(code,r.getMsg());
} }
break; break;
// case FactoryConstant.MENGT: // case FactoryConstant.MENGT:
// r = mtFactoryDataService.handleData(orderInfoDTO); // r = mtFactoryDataService.handleData(orderInfoDTO);
// break; // break;
default: default:
log.info("##################openOrderStatusHandler: 未知品牌 type={}",type); log.info("##################openOrderStatusHandler: 未知品牌 type={}",type);
// channel.basicAck(deliveryTag,true); // channel.basicAck(deliveryTag,true);
}
} }
} }
} }

Loading…
Cancel
Save