|
|
|
@ -16,10 +16,12 @@ import com.fasterxml.jackson.databind.json.JsonMapper;
|
|
|
|
|
import com.logpm.factory.mt.dto.MtPushDataDTO; |
|
|
|
|
import com.logpm.factory.mt.feign.MtFactoryDataClient; |
|
|
|
|
import com.logpm.factorydata.feign.IFactoryDataClient; |
|
|
|
|
import com.logpm.factorydata.mengtian.entity.FactoryNodePushEntity; |
|
|
|
|
import com.logpm.factorydata.mengtian.enums.FactoryNodeEnums; |
|
|
|
|
import com.logpm.factorydata.mengtian.enums.NodeMappingEnums; |
|
|
|
|
import com.logpm.factorydata.mengtian.enums.NodeNeedEnums; |
|
|
|
|
import com.logpm.factorydata.mengtian.pros.MengTianProperties; |
|
|
|
|
import com.logpm.factorydata.mengtian.service.FactoryNodePushService; |
|
|
|
|
import com.logpm.factorydata.mengtian.vo.CentralStkInConfirmOrderVO; |
|
|
|
|
import com.logpm.factorydata.mengtian.vo.CentralStkInConfirmPackageVO; |
|
|
|
|
import com.logpm.factorydata.mengtian.vo.CentralStkInConfirmVO; |
|
|
|
@ -59,6 +61,7 @@ public class NodeDataPushListener {
|
|
|
|
|
private final IFactoryDataClient factoryDataClient; |
|
|
|
|
private final MtFactoryDataClient mtFactoryDataClient; |
|
|
|
|
private final MengTianProperties mengTianProperties; |
|
|
|
|
private final FactoryNodePushService factoryNodePushService; |
|
|
|
|
|
|
|
|
|
@RabbitListener(bindings = @QueueBinding( |
|
|
|
|
value = @Queue(name = FactoryDataConstants.Mq.Queues.MENGTIAN_NODE_DATA_PUSH, durable = "true"), |
|
|
|
@ -127,7 +130,13 @@ public class NodeDataPushListener {
|
|
|
|
|
} catch (JsonProcessingException e) { |
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
} |
|
|
|
|
sendFactory(s, "mt.poc.ht_yc_noms.CentralStkIn", mengTianProperties.getCentralStkInUrl()); |
|
|
|
|
FactoryNodePushEntity entity = FactoryNodePushEntity.builder() |
|
|
|
|
.senderCode(centralStkInVO.getSenderCode()) |
|
|
|
|
.orderCode(centralStkInVO.getOrderCode()) |
|
|
|
|
.packageCode(centralStkInVO.getPackageCode()) |
|
|
|
|
.type("收货") |
|
|
|
|
.build(); |
|
|
|
|
sendFactory(s, "mt.poc.ht_yc_noms.CentralStkIn", mengTianProperties.getCentralStkInUrl(), entity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -170,7 +179,21 @@ public class NodeDataPushListener {
|
|
|
|
|
} catch (JsonProcessingException e) { |
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
} |
|
|
|
|
sendFactory(s, "mt.poc.ht_yc_noms.CentralStkInConfirm", mengTianProperties.getCentralStkInConfirmUrl()); |
|
|
|
|
String orderCodes = CollUtil.join(mtPushDataDTOS1.stream().map(pushData -> { |
|
|
|
|
return pushData.getOrderCode(); |
|
|
|
|
}).collect(Collectors.toSet()), ","); |
|
|
|
|
String packageCodes = CollUtil.join(content.stream() |
|
|
|
|
.filter(pushData -> orderCodes.contains(pushData.getOrderCode())) |
|
|
|
|
.map(pushData -> { |
|
|
|
|
return pushData.getPackageCode(); |
|
|
|
|
}).collect(Collectors.toSet()), ","); |
|
|
|
|
FactoryNodePushEntity entity = FactoryNodePushEntity.builder() |
|
|
|
|
.senderCode(senderCode) |
|
|
|
|
.orderCode(orderCodes) |
|
|
|
|
.packageCode(packageCodes) |
|
|
|
|
.type("确认收货") |
|
|
|
|
.build(); |
|
|
|
|
sendFactory(s, "mt.poc.ht_yc_noms.CentralStkInConfirm", mengTianProperties.getCentralStkInConfirmUrl(), entity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -204,7 +227,23 @@ public class NodeDataPushListener {
|
|
|
|
|
} catch (JsonProcessingException e) { |
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
} |
|
|
|
|
sendFactory(s, "mt.poc.ht_yc_noms.SignFor", mengTianProperties.getSignForUrl()); |
|
|
|
|
String orderCodes = CollUtil.join(content.stream().map(pushData -> { |
|
|
|
|
return pushData.getOrderCode(); |
|
|
|
|
}).collect(Collectors.toSet()), ","); |
|
|
|
|
String packageCodes = CollUtil.join(content.stream().map(pushData -> { |
|
|
|
|
return pushData.getPackageCode(); |
|
|
|
|
}).collect(Collectors.toSet()), ","); |
|
|
|
|
String senderCodes = CollUtil.join(mtPushDataDTOS.stream().map(pushData -> { |
|
|
|
|
return pushData.getSenderCode(); |
|
|
|
|
}).collect(Collectors.toSet()), ","); |
|
|
|
|
FactoryNodePushEntity entity = FactoryNodePushEntity.builder() |
|
|
|
|
.senderCode(signForVO.getSenderCode()) |
|
|
|
|
.orderCode(signForVO.getOrderCode()) |
|
|
|
|
.packageCode(signForVO.getPackageCode()) |
|
|
|
|
.type("签收") |
|
|
|
|
.sendTaskId(signForVO.getSendTaskId()) |
|
|
|
|
.build(); |
|
|
|
|
sendFactory(s, "mt.poc.ht_yc_noms.SignFor", mengTianProperties.getSignForUrl(), entity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -216,9 +255,9 @@ public class NodeDataPushListener {
|
|
|
|
|
JSONArray objects = new JSONArray(images); |
|
|
|
|
List<SignForConfirmImageVO> imageVOS = objects.stream() |
|
|
|
|
.filter(m -> !m.toString().contains("blob")) |
|
|
|
|
.map(m ->{ |
|
|
|
|
return SignForConfirmImageVO.builder().image(m.toString()).build(); |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
.map(m -> { |
|
|
|
|
return SignForConfirmImageVO.builder().image(m.toString()).build(); |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
Map<String, MtPushDataDTO> mtPushDataDTOMap = mtPushDataDTOS.stream().collect(Collectors.toMap(MtPushDataDTO::getOrderCode, mtPushDataDTO -> mtPushDataDTO)); |
|
|
|
|
SignForConfirmVO confirmVO = SignForConfirmVO.builder() |
|
|
|
|
.sendTaskId(entries1.getStr("boId")) |
|
|
|
@ -245,11 +284,27 @@ public class NodeDataPushListener {
|
|
|
|
|
} catch (JsonProcessingException e) { |
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
} |
|
|
|
|
sendFactory(s, "mt.poc.ht_yc_noms.SignForConfirm", mengTianProperties.getSignForConfirmUrl()); |
|
|
|
|
String orderCodes = CollUtil.join(content.stream().map(pushData -> { |
|
|
|
|
return pushData.getOrderCode(); |
|
|
|
|
}).collect(Collectors.toSet()), ","); |
|
|
|
|
String packageCodes = CollUtil.join(content.stream().map(pushData -> { |
|
|
|
|
return pushData.getPackageCode(); |
|
|
|
|
}).collect(Collectors.toSet()), ","); |
|
|
|
|
String senderCodes = CollUtil.join(mtPushDataDTOS.stream().map(pushData -> { |
|
|
|
|
return pushData.getSenderCode(); |
|
|
|
|
}).collect(Collectors.toSet()), ","); |
|
|
|
|
FactoryNodePushEntity entity = FactoryNodePushEntity.builder() |
|
|
|
|
.senderCode(senderCodes) |
|
|
|
|
.orderCode(orderCodes) |
|
|
|
|
.packageCode(packageCodes) |
|
|
|
|
.type("确认签收") |
|
|
|
|
.sendTaskId(confirmVO.getSendTaskId()) |
|
|
|
|
.build(); |
|
|
|
|
sendFactory(s, "mt.poc.ht_yc_noms.SignForConfirm", mengTianProperties.getSignForConfirmUrl(), entity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void sendFactory(String body, String operationCode, String url) { |
|
|
|
|
private void sendFactory(String body, String operationCode, String url, FactoryNodePushEntity entity) { |
|
|
|
|
log.info("推送工厂:{}", body); |
|
|
|
|
HttpRequest post = HttpUtil.createPost(mengTianProperties.getHost() + url); |
|
|
|
|
post.header("ClientId", "mt.ht"); |
|
|
|
@ -258,6 +313,12 @@ public class NodeDataPushListener {
|
|
|
|
|
HttpResponse execute = post.execute(); |
|
|
|
|
String resBody = execute.body(); |
|
|
|
|
log.info("推送工厂结果:{}", resBody); |
|
|
|
|
// 存入日志表
|
|
|
|
|
entity.setContent(body); |
|
|
|
|
entity.setOperationCode(operationCode); |
|
|
|
|
entity.setSendUrl(mengTianProperties.getHost() + url); |
|
|
|
|
entity.setResultContent(resBody); |
|
|
|
|
factoryNodePushService.save(entity); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean checkData(String msg) { |
|
|
|
|