|
|
@ -0,0 +1,647 @@ |
|
|
|
|
|
|
|
package com.logpm.factorydata.zbom.job; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
|
|
|
import cn.hutool.core.convert.Convert; |
|
|
|
|
|
|
|
import cn.hutool.core.date.DateTime; |
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
|
|
|
import cn.hutool.json.JSONObject; |
|
|
|
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
|
|
|
import com.logpm.factorydata.zbom.constants.ZbomConstants; |
|
|
|
|
|
|
|
import com.logpm.factorydata.zbom.entity.CustomPushEntity; |
|
|
|
|
|
|
|
import com.logpm.factorydata.zbom.entity.ZbFactoryNodeOrderEntity; |
|
|
|
|
|
|
|
import com.logpm.factorydata.zbom.entity.ZbFactoryNodePushEntity; |
|
|
|
|
|
|
|
import com.logpm.factorydata.zbom.entity.ZbOrderPackageEntity; |
|
|
|
|
|
|
|
import com.logpm.factorydata.zbom.enums.ZbomNodeEnums; |
|
|
|
|
|
|
|
import com.logpm.factorydata.zbom.pros.ZbFactoryProperties; |
|
|
|
|
|
|
|
import com.logpm.factorydata.zbom.service.CustomPushService; |
|
|
|
|
|
|
|
import com.logpm.factorydata.zbom.service.IFactoryNodeOrderService; |
|
|
|
|
|
|
|
import com.logpm.factorydata.zbom.service.IFactoryNodePushService; |
|
|
|
|
|
|
|
import com.logpm.factorydata.zbom.service.IOrderPackageService; |
|
|
|
|
|
|
|
import com.logpm.factorydata.zbom.util.ZbomUtil; |
|
|
|
|
|
|
|
import com.logpm.factorydata.zbom.vo.NodeConfirmParamDTO; |
|
|
|
|
|
|
|
import com.xxl.job.core.biz.model.ReturnT; |
|
|
|
|
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob; |
|
|
|
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
import org.springblade.common.constant.WorkNodeEnums; |
|
|
|
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 自动回传工厂 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @author zhaoqiaobo |
|
|
|
|
|
|
|
* @create 2024-04-02 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@AllArgsConstructor |
|
|
|
|
|
|
|
@Component |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
|
|
|
|
public class CustomPushJob { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final CustomPushService customPushService; |
|
|
|
|
|
|
|
private final IFactoryNodePushService nodePushService; |
|
|
|
|
|
|
|
private final IOrderPackageService orderPackageService; |
|
|
|
|
|
|
|
private final ZbFactoryProperties zbProperties; |
|
|
|
|
|
|
|
private final IFactoryNodeOrderService nodeOrderService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 自定义回传工厂节点作业数据 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param param |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
* @throws Exception |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@XxlJob("customPushFactoryData") |
|
|
|
|
|
|
|
public ReturnT<String> customPushFactoryData(String param) throws Exception { |
|
|
|
|
|
|
|
// 获取参数 5 场站发车 10 回传在途 20 回传送货抵达 30 回传签收
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(param)) { |
|
|
|
|
|
|
|
return ReturnT.SUCCESS; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Integer type = Integer.valueOf(param); |
|
|
|
|
|
|
|
// 查询出需要回传的数据
|
|
|
|
|
|
|
|
List<CustomPushEntity> customPushEntities = customPushService.findData(type); |
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(customPushEntities)) { |
|
|
|
|
|
|
|
// Set<String> collect = customPushEntities.stream().map(CustomPushEntity::getPackageCode).collect(Collectors.toSet());
|
|
|
|
|
|
|
|
CustomPushEntity customPushEntity = customPushEntities.get(0); |
|
|
|
|
|
|
|
ZbomNodeEnums node = null; |
|
|
|
|
|
|
|
if (type == 5) { |
|
|
|
|
|
|
|
node = ZbomNodeEnums.STATION_DEPART; |
|
|
|
|
|
|
|
WorkNodeEnums initialWarehouseDepart = WorkNodeEnums.INITIAL_WAREHOUSE_DEPART; |
|
|
|
|
|
|
|
String address = "从【基地仓发出】"; |
|
|
|
|
|
|
|
sendFactory(customPushEntity, node, type, initialWarehouseDepart,address); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (type == 10) { |
|
|
|
|
|
|
|
node = ZbomNodeEnums.INTRANSIT; |
|
|
|
|
|
|
|
WorkNodeEnums initialWarehouseDepart = WorkNodeEnums.UNLOAD_INCOMING_WAREHOUSE; |
|
|
|
|
|
|
|
String address = "到达【"+ customPushEntity.getWarehouse() +"】"; |
|
|
|
|
|
|
|
sendFactory(customPushEntity, node, type, initialWarehouseDepart, address); |
|
|
|
|
|
|
|
// List<ZbOrderPackageEntity> list = orderPackageService.list(Wrappers.<ZbOrderPackageEntity>lambdaQuery()
|
|
|
|
|
|
|
|
// .select(ZbOrderPackageEntity::getDepartCode)
|
|
|
|
|
|
|
|
// .eq(ZbOrderPackageEntity::getPackageCode, customPushEntity.getPackageCode())
|
|
|
|
|
|
|
|
// .eq(ZbOrderPackageEntity::getPlatformOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// if (CollUtil.isNotEmpty(list)) {
|
|
|
|
|
|
|
|
// ZbOrderPackageEntity zbOrderPackageEntity = list.get(0);
|
|
|
|
|
|
|
|
// List<ZbFactoryNodePushEntity> list1 = nodePushService.list(Wrappers.<ZbFactoryNodePushEntity>lambdaQuery()
|
|
|
|
|
|
|
|
// .select(ZbFactoryNodePushEntity::getId)
|
|
|
|
|
|
|
|
// .eq(ZbFactoryNodePushEntity::getDepartCode, zbOrderPackageEntity.getDepartCode())
|
|
|
|
|
|
|
|
// .eq(ZbFactoryNodePushEntity::getPlatformOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// // .eq(ZbFactoryNodePushEntity::getWarehouseName, customPushEntity.getWarehouse())
|
|
|
|
|
|
|
|
// .eq(ZbFactoryNodePushEntity::getNode, node.getCode())
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// if (CollUtil.isEmpty(list1)) {
|
|
|
|
|
|
|
|
// NodeConfirmParamDTO nodeConfirmParam = NodeConfirmParamDTO.builder().address("到达【" + customPushEntity.getWarehouse() + "】")
|
|
|
|
|
|
|
|
// .departCode(zbOrderPackageEntity.getDepartCode())
|
|
|
|
|
|
|
|
// .operator(customPushEntity.getExamineUserName())
|
|
|
|
|
|
|
|
// .operatorTime(customPushEntity.getSigningTime())
|
|
|
|
|
|
|
|
// .platformOrderCode(customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// .node(node.getCode()).build();
|
|
|
|
|
|
|
|
// try {
|
|
|
|
|
|
|
|
// // 推送给志邦
|
|
|
|
|
|
|
|
// String body = JSONUtil.toJsonStr(nodeConfirmParam);
|
|
|
|
|
|
|
|
// String result = null;
|
|
|
|
|
|
|
|
// if (zbProperties.getEnable()) {
|
|
|
|
|
|
|
|
// result = ZbomUtil.pushZbomSystem(zbProperties, body, ZbomConstants.Method.ROUTE_NODE_CONFIRM);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// JSONObject jsonObject = new JSONObject();
|
|
|
|
|
|
|
|
// jsonObject.set("code", "0");
|
|
|
|
|
|
|
|
// result = JSONUtil.toJsonStr(jsonObject);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// log.info("zb节点推送数据:参数{},返回值{}。", body, result);
|
|
|
|
|
|
|
|
// if (StrUtil.isNotBlank(result)) {
|
|
|
|
|
|
|
|
// if (!StrUtil.contains(result, "code")) {
|
|
|
|
|
|
|
|
// customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate()
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId())
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getSendStatus, type)
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResultCode, "-1")
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResult, "工厂返回结果异常")
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// JSONObject resultJson = JSONUtil.parseObj(result);
|
|
|
|
|
|
|
|
// String code = resultJson.getStr("code");
|
|
|
|
|
|
|
|
// if (ObjectUtil.equal(code, "0")) {
|
|
|
|
|
|
|
|
// ZbFactoryNodePushEntity pushEntity = ZbFactoryNodePushEntity.builder()
|
|
|
|
|
|
|
|
// .departCode(nodeConfirmParam.getDepartCode())
|
|
|
|
|
|
|
|
// .platformOrderCode(nodeConfirmParam.getPlatformOrderCode())
|
|
|
|
|
|
|
|
// .node(nodeConfirmParam.getNode())
|
|
|
|
|
|
|
|
// .workNode(initialWarehouseDepart.name())
|
|
|
|
|
|
|
|
// .warehouseName(customPushEntity.getWarehouse())
|
|
|
|
|
|
|
|
// .packageCode(customPushEntity.getPackageCode())
|
|
|
|
|
|
|
|
// .content(body)
|
|
|
|
|
|
|
|
// .resultContent(result)
|
|
|
|
|
|
|
|
// .build();
|
|
|
|
|
|
|
|
// // 推送成功
|
|
|
|
|
|
|
|
// nodePushService.save(pushEntity);
|
|
|
|
|
|
|
|
// // 修改加盟商单号+发货单号节点数据
|
|
|
|
|
|
|
|
// List<ZbFactoryNodeOrderEntity> list2 = nodeOrderService.list(Wrappers.<ZbFactoryNodeOrderEntity>lambdaQuery()
|
|
|
|
|
|
|
|
// .eq(ZbFactoryNodeOrderEntity::getPlatformOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// .eq(ZbFactoryNodeOrderEntity::getDepartCode, zbOrderPackageEntity.getDepartCode())
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// if (CollUtil.isNotEmpty(list2)) {
|
|
|
|
|
|
|
|
// ZbFactoryNodeOrderEntity zbFactoryNodeOrderEntity = list2.get(0);
|
|
|
|
|
|
|
|
// String pushNode = zbFactoryNodeOrderEntity.getPushNode();
|
|
|
|
|
|
|
|
// Integer currentNode = zbFactoryNodeOrderEntity.getCurrentNode();
|
|
|
|
|
|
|
|
// Integer index = node.getIndex();
|
|
|
|
|
|
|
|
// if (currentNode < index) {
|
|
|
|
|
|
|
|
// pushNode = pushNode + "," + index;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// zbFactoryNodeOrderEntity.setPushNode(pushNode);
|
|
|
|
|
|
|
|
// zbFactoryNodeOrderEntity.setCurrentNode(index);
|
|
|
|
|
|
|
|
// nodeOrderService.updateNodeOrder(zbFactoryNodeOrderEntity);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// // 处理custom
|
|
|
|
|
|
|
|
// customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate()
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId())
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getSendStatus, type)
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResultCode, code)
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResult, result)
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// // 处理custom
|
|
|
|
|
|
|
|
// customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate()
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId())
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getSendStatus, type)
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResultCode, code)
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResult, result));
|
|
|
|
|
|
|
|
// log.info("自定义回传失败");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
|
|
|
// // 处理推送不成功的异常情况
|
|
|
|
|
|
|
|
// log.error("zb节点推送数据异常:{}", e);
|
|
|
|
|
|
|
|
// // 保存日志
|
|
|
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }else {
|
|
|
|
|
|
|
|
// customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate()
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId())
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getSendStatus, type)
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResultCode, "-1")
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResult, "push里有记录")
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }else{
|
|
|
|
|
|
|
|
// customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate()
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId())
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getSendStatus, type)
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResultCode, "-1")
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResult, "未找到包件订单")
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (type == 20) { |
|
|
|
|
|
|
|
node = ZbomNodeEnums.DELIVERY_ARRIVAL; |
|
|
|
|
|
|
|
WorkNodeEnums clerkReview = WorkNodeEnums.CLERK_REVIEW; |
|
|
|
|
|
|
|
String address = ""; |
|
|
|
|
|
|
|
sendFactory(customPushEntity, node, type, clerkReview, address); |
|
|
|
|
|
|
|
// List<ZbOrderPackageEntity> list = orderPackageService.list(Wrappers.<ZbOrderPackageEntity>lambdaQuery()
|
|
|
|
|
|
|
|
// .select(ZbOrderPackageEntity::getDepartCode)
|
|
|
|
|
|
|
|
// .eq(ZbOrderPackageEntity::getPackageCode, customPushEntity.getPackageCode())
|
|
|
|
|
|
|
|
// .eq(ZbOrderPackageEntity::getPlatformOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// if (CollUtil.isNotEmpty(list)) {
|
|
|
|
|
|
|
|
// ZbOrderPackageEntity zbOrderPackageEntity = list.get(0);
|
|
|
|
|
|
|
|
// List<ZbFactoryNodePushEntity> list1 = nodePushService.list(Wrappers.<ZbFactoryNodePushEntity>lambdaQuery()
|
|
|
|
|
|
|
|
// .select(ZbFactoryNodePushEntity::getId)
|
|
|
|
|
|
|
|
// .eq(ZbFactoryNodePushEntity::getDepartCode, zbOrderPackageEntity.getDepartCode())
|
|
|
|
|
|
|
|
// .eq(ZbFactoryNodePushEntity::getPlatformOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// // .eq(ZbFactoryNodePushEntity::getWarehouseName, customPushEntity.getWarehouse())
|
|
|
|
|
|
|
|
// .eq(ZbFactoryNodePushEntity::getNode, node.getCode())
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// if (CollUtil.isEmpty(list1)) {
|
|
|
|
|
|
|
|
// NodeConfirmParamDTO nodeConfirmParam = NodeConfirmParamDTO.builder()
|
|
|
|
|
|
|
|
// .address("到达【" + customPushEntity.getWarehouse() + "】")
|
|
|
|
|
|
|
|
// .departCode(zbOrderPackageEntity.getDepartCode())
|
|
|
|
|
|
|
|
// .operator(customPushEntity.getExamineUserName())
|
|
|
|
|
|
|
|
// .operatorTime(customPushEntity.getSigningTime())
|
|
|
|
|
|
|
|
// .platformOrderCode(customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// .node(node.getCode()).build();
|
|
|
|
|
|
|
|
// try {
|
|
|
|
|
|
|
|
// // 推送给志邦
|
|
|
|
|
|
|
|
// String body = JSONUtil.toJsonStr(nodeConfirmParam);
|
|
|
|
|
|
|
|
// String result = null;
|
|
|
|
|
|
|
|
// if (zbProperties.getEnable()) {
|
|
|
|
|
|
|
|
// result = ZbomUtil.pushZbomSystem(zbProperties, body, ZbomConstants.Method.ROUTE_NODE_CONFIRM);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// JSONObject jsonObject = new JSONObject();
|
|
|
|
|
|
|
|
// jsonObject.set("code", "0");
|
|
|
|
|
|
|
|
// result = JSONUtil.toJsonStr(jsonObject);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// log.info("zb节点推送数据:参数{},返回值{}。", body, result);
|
|
|
|
|
|
|
|
// if (StrUtil.isNotBlank(result)) {
|
|
|
|
|
|
|
|
// if (!StrUtil.contains(result, "code")) {
|
|
|
|
|
|
|
|
// customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate()
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId())
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getSendStatus, type)
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResultCode, "-1")
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResult, "工厂返回异常")
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// JSONObject resultJson = JSONUtil.parseObj(result);
|
|
|
|
|
|
|
|
// String code = resultJson.getStr("code");
|
|
|
|
|
|
|
|
// if (ObjectUtil.equal(code, "0")) {
|
|
|
|
|
|
|
|
// ZbFactoryNodePushEntity pushEntity = ZbFactoryNodePushEntity.builder()
|
|
|
|
|
|
|
|
// .departCode(nodeConfirmParam.getDepartCode())
|
|
|
|
|
|
|
|
// .platformOrderCode(nodeConfirmParam.getPlatformOrderCode())
|
|
|
|
|
|
|
|
// .node(nodeConfirmParam.getNode())
|
|
|
|
|
|
|
|
// .workNode(WorkNodeEnums.CLERK_REVIEW.name())
|
|
|
|
|
|
|
|
// .warehouseName(customPushEntity.getWarehouse())
|
|
|
|
|
|
|
|
// .packageCode(customPushEntity.getPackageCode())
|
|
|
|
|
|
|
|
// .content(body)
|
|
|
|
|
|
|
|
// .resultContent(result)
|
|
|
|
|
|
|
|
// .build();
|
|
|
|
|
|
|
|
// // 推送成功
|
|
|
|
|
|
|
|
// nodePushService.save(pushEntity);
|
|
|
|
|
|
|
|
// // 修改加盟商单号+发货单号节点数据
|
|
|
|
|
|
|
|
// List<ZbFactoryNodeOrderEntity> list2 = nodeOrderService.list(Wrappers.<ZbFactoryNodeOrderEntity>lambdaQuery()
|
|
|
|
|
|
|
|
// .eq(ZbFactoryNodeOrderEntity::getPlatformOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// .eq(ZbFactoryNodeOrderEntity::getDepartCode, zbOrderPackageEntity.getDepartCode())
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// if (CollUtil.isNotEmpty(list2)) {
|
|
|
|
|
|
|
|
// ZbFactoryNodeOrderEntity zbFactoryNodeOrderEntity = list2.get(0);
|
|
|
|
|
|
|
|
// String pushNode = zbFactoryNodeOrderEntity.getPushNode();
|
|
|
|
|
|
|
|
// Integer currentNode = zbFactoryNodeOrderEntity.getCurrentNode();
|
|
|
|
|
|
|
|
// Integer index = node.getIndex();
|
|
|
|
|
|
|
|
// if (currentNode < index) {
|
|
|
|
|
|
|
|
// pushNode = pushNode + "," + index;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// zbFactoryNodeOrderEntity.setPushNode(pushNode);
|
|
|
|
|
|
|
|
// zbFactoryNodeOrderEntity.setCurrentNode(index);
|
|
|
|
|
|
|
|
// nodeOrderService.updateNodeOrder(zbFactoryNodeOrderEntity);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// // 处理custom
|
|
|
|
|
|
|
|
// customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate()
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId())
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getSendStatus, type)
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResultCode, code)
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResult, result)
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// // 处理custom
|
|
|
|
|
|
|
|
// customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate()
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId())
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getSendStatus, type)
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResultCode, code)
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResult, result));
|
|
|
|
|
|
|
|
// log.info("自定义回传失败");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
|
|
|
// // 处理推送不成功的异常情况
|
|
|
|
|
|
|
|
// log.error("zb节点推送数据异常:{}", e);
|
|
|
|
|
|
|
|
// // 保存日志
|
|
|
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }else {
|
|
|
|
|
|
|
|
// customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate()
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId())
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getSendStatus, type)
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResultCode, "-1")
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResult, "push中有记录")
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }else {
|
|
|
|
|
|
|
|
// customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate()
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId())
|
|
|
|
|
|
|
|
// .eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getSendStatus, type)
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResultCode, "-1")
|
|
|
|
|
|
|
|
// .set(CustomPushEntity::getResult, "未找到包件订单")
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (type == 30) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int size1 = customPushEntities.size(); |
|
|
|
|
|
|
|
List<ZbOrderPackageEntity> list = orderPackageService.list(Wrappers.<ZbOrderPackageEntity>lambdaQuery() |
|
|
|
|
|
|
|
.select(ZbOrderPackageEntity::getDepartCode) |
|
|
|
|
|
|
|
.eq(ZbOrderPackageEntity::getPackageCode, customPushEntity.getPackageCode()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(list)) { |
|
|
|
|
|
|
|
ZbOrderPackageEntity zbOrderPackageEntity = list.get(0); |
|
|
|
|
|
|
|
List<ZbOrderPackageEntity> orderPackageEntities = orderPackageService.list(Wrappers.<ZbOrderPackageEntity>lambdaQuery() |
|
|
|
|
|
|
|
.select(ZbOrderPackageEntity::getDepartCode, ZbOrderPackageEntity::getSignStatus, ZbOrderPackageEntity::getPlatformOrderCode, ZbOrderPackageEntity::getPackageCode) |
|
|
|
|
|
|
|
.eq(ZbOrderPackageEntity::getPlatformOrderCode, customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
.eq(ZbOrderPackageEntity::getDepartCode, zbOrderPackageEntity.getDepartCode()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(orderPackageEntities)) { |
|
|
|
|
|
|
|
// 总包件数
|
|
|
|
|
|
|
|
int size = orderPackageEntities.size(); |
|
|
|
|
|
|
|
List<ZbOrderPackageEntity> collect1 = orderPackageEntities.stream().filter(o -> ObjectUtil.equal(o.getSignStatus(), 1)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
int signNum = 0; |
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(collect1)) { |
|
|
|
|
|
|
|
signNum = collect1.size(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (signNum == (size - size1)) { |
|
|
|
|
|
|
|
node = ZbomNodeEnums.SIGN_FOR; |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
node = ZbomNodeEnums.PARTIAL_RECEIPT; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// List<ZbFactoryNodePushEntity> list1 = nodePushService.list(Wrappers.<ZbFactoryNodePushEntity>lambdaQuery()
|
|
|
|
|
|
|
|
// .select(ZbFactoryNodePushEntity::getId)
|
|
|
|
|
|
|
|
// .eq(ZbFactoryNodePushEntity::getDepartCode, zbOrderPackageEntity.getDepartCode())
|
|
|
|
|
|
|
|
// .eq(ZbFactoryNodePushEntity::getPlatformOrderCode, customPushEntity.getOrderCode())
|
|
|
|
|
|
|
|
// .eq(ZbFactoryNodePushEntity::getNode, node.getCode())
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// if (CollUtil.isEmpty(list1)) {
|
|
|
|
|
|
|
|
NodeConfirmParamDTO nodeConfirmParam = NodeConfirmParamDTO.builder() |
|
|
|
|
|
|
|
// .address("到达【" + customPushEntity.getWarehouse() + "】")
|
|
|
|
|
|
|
|
.departCode(zbOrderPackageEntity.getDepartCode()) |
|
|
|
|
|
|
|
.operator(customPushEntity.getExamineUserName()) |
|
|
|
|
|
|
|
.operatorTime(customPushEntity.getSigningTime()) |
|
|
|
|
|
|
|
.platformOrderCode(customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
.signQty(Convert.toStr(size1)) |
|
|
|
|
|
|
|
.node(node.getCode()).build(); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
// 推送给志邦
|
|
|
|
|
|
|
|
String body = JSONUtil.toJsonStr(nodeConfirmParam); |
|
|
|
|
|
|
|
String result = null; |
|
|
|
|
|
|
|
if (zbProperties.getEnable()) { |
|
|
|
|
|
|
|
result = ZbomUtil.pushZbomSystem(zbProperties, body, ZbomConstants.Method.ROUTE_NODE_CONFIRM); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
|
|
|
|
jsonObject.set("code", "0"); |
|
|
|
|
|
|
|
result = JSONUtil.toJsonStr(jsonObject); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
log.info("zb节点推送数据:参数{},返回值{}。", body, result); |
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(result)) { |
|
|
|
|
|
|
|
if (!StrUtil.contains(result, "code")) { |
|
|
|
|
|
|
|
customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate() |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId()) |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getSendStatus, type) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResultCode, "-1") |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResult, "工厂返回异常") |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
String packageCodes = customPushEntities.stream() |
|
|
|
|
|
|
|
.map(CustomPushEntity::getPackageCode) |
|
|
|
|
|
|
|
.filter(StrUtil::isNotEmpty) // 过滤掉空的包件码
|
|
|
|
|
|
|
|
.collect(Collectors.joining(",")); |
|
|
|
|
|
|
|
JSONObject resultJson = JSONUtil.parseObj(result); |
|
|
|
|
|
|
|
String code = resultJson.getStr("code"); |
|
|
|
|
|
|
|
if (ObjectUtil.equal(code, "0")) { |
|
|
|
|
|
|
|
ZbFactoryNodePushEntity pushEntity = ZbFactoryNodePushEntity.builder() |
|
|
|
|
|
|
|
.departCode(nodeConfirmParam.getDepartCode()) |
|
|
|
|
|
|
|
.platformOrderCode(nodeConfirmParam.getPlatformOrderCode()) |
|
|
|
|
|
|
|
.node(nodeConfirmParam.getNode()) |
|
|
|
|
|
|
|
.workNode(WorkNodeEnums.CLERK_REVIEW.name()) |
|
|
|
|
|
|
|
.warehouseName(customPushEntity.getWarehouse()) |
|
|
|
|
|
|
|
.packageCode(packageCodes) |
|
|
|
|
|
|
|
.content(body) |
|
|
|
|
|
|
|
.resultContent(result) |
|
|
|
|
|
|
|
.build(); |
|
|
|
|
|
|
|
// 推送成功
|
|
|
|
|
|
|
|
nodePushService.save(pushEntity); |
|
|
|
|
|
|
|
// 修改加盟商单号+发货单号节点数据
|
|
|
|
|
|
|
|
List<ZbFactoryNodeOrderEntity> list2 = nodeOrderService.list(Wrappers.<ZbFactoryNodeOrderEntity>lambdaQuery() |
|
|
|
|
|
|
|
.eq(ZbFactoryNodeOrderEntity::getPlatformOrderCode, customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
.eq(ZbFactoryNodeOrderEntity::getDepartCode, zbOrderPackageEntity.getDepartCode()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(list2)) { |
|
|
|
|
|
|
|
ZbFactoryNodeOrderEntity zbFactoryNodeOrderEntity = list2.get(0); |
|
|
|
|
|
|
|
String pushNode = zbFactoryNodeOrderEntity.getPushNode(); |
|
|
|
|
|
|
|
Integer currentNode = zbFactoryNodeOrderEntity.getCurrentNode(); |
|
|
|
|
|
|
|
Integer index = node.getIndex(); |
|
|
|
|
|
|
|
if (currentNode < index) { |
|
|
|
|
|
|
|
pushNode = pushNode + "," + index; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
zbFactoryNodeOrderEntity.setPushNode(pushNode); |
|
|
|
|
|
|
|
zbFactoryNodeOrderEntity.setCurrentNode(index); |
|
|
|
|
|
|
|
nodeOrderService.updateNodeOrder(zbFactoryNodeOrderEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 处理custom
|
|
|
|
|
|
|
|
customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate() |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId()) |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getSendStatus, type) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResultCode, code) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResult, result) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 处理custom
|
|
|
|
|
|
|
|
customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate() |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId()) |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getSendStatus, type) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResultCode, code) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResult, result)); |
|
|
|
|
|
|
|
log.info("自定义回传失败"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
// 处理推送不成功的异常情况
|
|
|
|
|
|
|
|
log.error("zb节点推送数据异常:{}", e); |
|
|
|
|
|
|
|
// 保存日志
|
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate() |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId()) |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getSendStatus, type) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResultCode, "-1") |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResult, "未找到包件订单-发货单订单") |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate() |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId()) |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getSendStatus, type) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResultCode, "-1") |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResult, "未找到包件订单-包件") |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ReturnT.SUCCESS; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void sendFactory(CustomPushEntity customPushEntity, ZbomNodeEnums node, Integer type, WorkNodeEnums initialWarehouseDepart, String address) { |
|
|
|
|
|
|
|
List<ZbOrderPackageEntity> list = orderPackageService.list(Wrappers.<ZbOrderPackageEntity>lambdaQuery() |
|
|
|
|
|
|
|
.select(ZbOrderPackageEntity::getDepartCode) |
|
|
|
|
|
|
|
.eq(ZbOrderPackageEntity::getPackageCode, customPushEntity.getPackageCode()) |
|
|
|
|
|
|
|
.eq(ZbOrderPackageEntity::getPlatformOrderCode, customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(list)) { |
|
|
|
|
|
|
|
ZbOrderPackageEntity zbOrderPackageEntity = list.get(0); |
|
|
|
|
|
|
|
List<ZbFactoryNodePushEntity> list1 = nodePushService.list(Wrappers.<ZbFactoryNodePushEntity>lambdaQuery() |
|
|
|
|
|
|
|
.select(ZbFactoryNodePushEntity::getId) |
|
|
|
|
|
|
|
.eq(ZbFactoryNodePushEntity::getDepartCode, zbOrderPackageEntity.getDepartCode()) |
|
|
|
|
|
|
|
.eq(ZbFactoryNodePushEntity::getPlatformOrderCode, customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
// .eq(ZbFactoryNodePushEntity::getWarehouseName, customPushEntity.getWarehouse())
|
|
|
|
|
|
|
|
.eq(ZbFactoryNodePushEntity::getNode, node.getCode()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (CollUtil.isEmpty(list1)) { |
|
|
|
|
|
|
|
NodeConfirmParamDTO nodeConfirmParam = NodeConfirmParamDTO.builder().address(address) |
|
|
|
|
|
|
|
.departCode(zbOrderPackageEntity.getDepartCode()) |
|
|
|
|
|
|
|
.operator(customPushEntity.getExamineUserName()) |
|
|
|
|
|
|
|
.operatorTime(customPushEntity.getSigningTime()) |
|
|
|
|
|
|
|
.platformOrderCode(customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
.node(node.getCode()).build(); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
// 推送给志邦
|
|
|
|
|
|
|
|
String body = JSONUtil.toJsonStr(nodeConfirmParam); |
|
|
|
|
|
|
|
String result = null; |
|
|
|
|
|
|
|
if (zbProperties.getEnable()) { |
|
|
|
|
|
|
|
result = ZbomUtil.pushZbomSystem(zbProperties, body, ZbomConstants.Method.ROUTE_NODE_CONFIRM); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
|
|
|
|
jsonObject.set("code", "0"); |
|
|
|
|
|
|
|
result = JSONUtil.toJsonStr(jsonObject); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
log.info("zb节点推送数据:参数{},返回值{}。", body, result); |
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(result)) { |
|
|
|
|
|
|
|
if (!StrUtil.contains(result, "code")) { |
|
|
|
|
|
|
|
customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate() |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId()) |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getSendStatus, type) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResultCode, "-1") |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResult, "工厂返回结果异常") |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
JSONObject resultJson = JSONUtil.parseObj(result); |
|
|
|
|
|
|
|
String code = resultJson.getStr("code"); |
|
|
|
|
|
|
|
if (ObjectUtil.equal(code, "0")) { |
|
|
|
|
|
|
|
ZbFactoryNodePushEntity pushEntity = ZbFactoryNodePushEntity.builder() |
|
|
|
|
|
|
|
.departCode(nodeConfirmParam.getDepartCode()) |
|
|
|
|
|
|
|
.platformOrderCode(nodeConfirmParam.getPlatformOrderCode()) |
|
|
|
|
|
|
|
.node(nodeConfirmParam.getNode()) |
|
|
|
|
|
|
|
.workNode(initialWarehouseDepart.name()) |
|
|
|
|
|
|
|
.warehouseName(customPushEntity.getWarehouse()) |
|
|
|
|
|
|
|
.packageCode(customPushEntity.getPackageCode()) |
|
|
|
|
|
|
|
.content(body) |
|
|
|
|
|
|
|
.resultContent(result) |
|
|
|
|
|
|
|
.build(); |
|
|
|
|
|
|
|
// 推送成功
|
|
|
|
|
|
|
|
nodePushService.save(pushEntity); |
|
|
|
|
|
|
|
// 修改加盟商单号+发货单号节点数据
|
|
|
|
|
|
|
|
List<ZbFactoryNodeOrderEntity> list2 = nodeOrderService.list(Wrappers.<ZbFactoryNodeOrderEntity>lambdaQuery() |
|
|
|
|
|
|
|
.eq(ZbFactoryNodeOrderEntity::getPlatformOrderCode, customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
.eq(ZbFactoryNodeOrderEntity::getDepartCode, zbOrderPackageEntity.getDepartCode()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(list2)) { |
|
|
|
|
|
|
|
ZbFactoryNodeOrderEntity zbFactoryNodeOrderEntity = list2.get(0); |
|
|
|
|
|
|
|
String pushNode = zbFactoryNodeOrderEntity.getPushNode(); |
|
|
|
|
|
|
|
Integer currentNode = zbFactoryNodeOrderEntity.getCurrentNode(); |
|
|
|
|
|
|
|
Integer index = node.getIndex(); |
|
|
|
|
|
|
|
if (currentNode < index) { |
|
|
|
|
|
|
|
pushNode = pushNode + "," + index; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
zbFactoryNodeOrderEntity.setPushNode(pushNode); |
|
|
|
|
|
|
|
zbFactoryNodeOrderEntity.setCurrentNode(index); |
|
|
|
|
|
|
|
nodeOrderService.updateNodeOrder(zbFactoryNodeOrderEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 处理custom
|
|
|
|
|
|
|
|
customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate() |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId()) |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getSendStatus, type) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResultCode, code) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResult, result) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 处理custom
|
|
|
|
|
|
|
|
customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate() |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId()) |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getSendStatus, type) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResultCode, code) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResult, result)); |
|
|
|
|
|
|
|
log.info("自定义回传失败"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
// 处理推送不成功的异常情况
|
|
|
|
|
|
|
|
log.error("zb节点推送数据异常:{}", e); |
|
|
|
|
|
|
|
// 保存日志
|
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate() |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId()) |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getSendStatus, type) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResultCode, "-1") |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResult, "push里有记录") |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
customPushService.update(Wrappers.<CustomPushEntity>lambdaUpdate() |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getReservationId, customPushEntity.getReservationId()) |
|
|
|
|
|
|
|
.eq(CustomPushEntity::getOrderCode, customPushEntity.getOrderCode()) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getSendStatus, type) |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResultCode, "-1") |
|
|
|
|
|
|
|
.set(CustomPushEntity::getResult, "未找到包件订单") |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 添加回传数量字段,修正包件回传状态 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param param |
|
|
|
|
|
|
|
* @Return com.xxl.job.core.biz.model.ReturnT<java.lang.String> |
|
|
|
|
|
|
|
* @Author zqb 2024/11/4 |
|
|
|
|
|
|
|
**/ |
|
|
|
|
|
|
|
@XxlJob("checkPackageSignStatus") |
|
|
|
|
|
|
|
public ReturnT<String> checkPackageSignStatus(String param) throws Exception { |
|
|
|
|
|
|
|
// 查询出需要回传的数据
|
|
|
|
|
|
|
|
LambdaQueryWrapper<ZbFactoryNodePushEntity> wrapper = Wrappers.<ZbFactoryNodePushEntity>lambdaQuery() |
|
|
|
|
|
|
|
.select(ZbFactoryNodePushEntity::getPackageCode, ZbFactoryNodePushEntity::getId) |
|
|
|
|
|
|
|
.in(ZbFactoryNodePushEntity::getNode, ZbomNodeEnums.SIGN_FOR.getCode(), ZbomNodeEnums.PARTIAL_RECEIPT.getCode()) |
|
|
|
|
|
|
|
.isNull(ZbFactoryNodePushEntity::getSignNum) |
|
|
|
|
|
|
|
.orderByAsc(ZbFactoryNodePushEntity::getId) |
|
|
|
|
|
|
|
.last(" limit 500"); |
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(param)) { |
|
|
|
|
|
|
|
DateTime dateTime = DateUtil.parseDate(param); |
|
|
|
|
|
|
|
wrapper.ge(ZbFactoryNodePushEntity::getCreateTime, dateTime); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<ZbFactoryNodePushEntity> list = nodePushService.list(wrapper); |
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(list)) { |
|
|
|
|
|
|
|
for (ZbFactoryNodePushEntity entity : list) { |
|
|
|
|
|
|
|
// ZbFactoryNodePushEntity entity = list.get(0);
|
|
|
|
|
|
|
|
String packageCode = entity.getPackageCode(); |
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(packageCode)) { |
|
|
|
|
|
|
|
String[] split = packageCode.split(","); |
|
|
|
|
|
|
|
orderPackageService.update(Wrappers.<ZbOrderPackageEntity>lambdaUpdate() |
|
|
|
|
|
|
|
.set(ZbOrderPackageEntity::getSignStatus, 1) |
|
|
|
|
|
|
|
.in(ZbOrderPackageEntity::getPackageCode, split) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
nodePushService.update(Wrappers.<ZbFactoryNodePushEntity>lambdaUpdate() |
|
|
|
|
|
|
|
.set(ZbFactoryNodePushEntity::getSignNum, split.length) |
|
|
|
|
|
|
|
.eq(ZbFactoryNodePushEntity::getId, entity.getId()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ReturnT.SUCCESS; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |