|
|
@ -6,16 +6,15 @@ import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.nacos.common.utils.MD5Utils; |
|
|
|
import com.alibaba.nacos.common.utils.MD5Utils; |
|
|
|
import com.alibaba.nacos.shaded.com.google.gson.Gson; |
|
|
|
import com.alibaba.nacos.shaded.com.google.gson.Gson; |
|
|
|
import com.alibaba.nacos.shaded.com.google.gson.GsonBuilder; |
|
|
|
import com.alibaba.nacos.shaded.com.google.gson.GsonBuilder; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import com.fasterxml.jackson.databind.json.JsonMapper; |
|
|
|
import com.fasterxml.jackson.databind.json.JsonMapper; |
|
|
|
import com.logpm.factory.comfac.dto.*; |
|
|
|
import com.logpm.factory.comfac.dto.*; |
|
|
|
import com.logpm.factory.mt.dto.*; |
|
|
|
import com.logpm.factory.mt.dto.*; |
|
|
|
import com.logpm.factory.mt.entity.MtFactoryOrder; |
|
|
|
import com.logpm.factory.mt.entity.*; |
|
|
|
import com.logpm.factory.mt.entity.MtFactoryOrderMain; |
|
|
|
|
|
|
|
import com.logpm.factory.mt.entity.MtOrderLogEntity; |
|
|
|
|
|
|
|
import com.logpm.factory.mt.entity.MtPackageInfo; |
|
|
|
|
|
|
|
import com.logpm.factory.mt.service.*; |
|
|
|
import com.logpm.factory.mt.service.*; |
|
|
|
import com.logpm.factory.props.MtFactoryProperties; |
|
|
|
import com.logpm.factory.props.MtFactoryProperties; |
|
|
|
import com.logpm.factory.snm.bean.Resp; |
|
|
|
import com.logpm.factory.snm.bean.Resp; |
|
|
@ -32,7 +31,9 @@ import org.slf4j.LoggerFactory; |
|
|
|
import org.springblade.common.exception.CustomerException; |
|
|
|
import org.springblade.common.exception.CustomerException; |
|
|
|
import org.springblade.core.redis.cache.BladeRedis; |
|
|
|
import org.springblade.core.redis.cache.BladeRedis; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
|
|
|
import org.springblade.core.tool.api.ResultCode; |
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
@ -62,6 +63,9 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { |
|
|
|
|
|
|
|
|
|
|
|
private final IMtOrderLogService mtOrderLogService; |
|
|
|
private final IMtOrderLogService mtOrderLogService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IMtPushDataService mtPushDataService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional |
|
|
|
@Transactional |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R dealWithData(MtFactoryDataDTO mtFactoryDataDTO) { |
|
|
|
public R dealWithData(MtFactoryDataDTO mtFactoryDataDTO) { |
|
|
@ -293,29 +297,42 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { |
|
|
|
return Resp.fail(400,"当前数据的状态不推送"); |
|
|
|
return Resp.fail(400,"当前数据的状态不推送"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ("4".equals(status)){ |
|
|
|
|
|
|
|
//继续判断是否到达目的仓
|
|
|
|
|
|
|
|
String currentWarehouseId = orderStatusDTO.getCurrentWarehouse();//当前仓Id
|
|
|
|
logger.info("##################orderStatusHandler: 异常tag={}",0); |
|
|
|
//查询destinationWarehouse logiBillNo plantId数据
|
|
|
|
|
|
|
|
logger.info("#############tag{}",1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String,String> supplyData = advanceDetailClient.getSupplyData(orderStatusDTO.getUnitNo()); |
|
|
|
// if("4".equals(status)){
|
|
|
|
logger.info("#############tag{}",2); |
|
|
|
//
|
|
|
|
String destinationWarehouseId = supplyData.get("destinationWarehouseId");//目的仓id
|
|
|
|
// // 需要推送数据
|
|
|
|
logger.info("#############tag{}",3); |
|
|
|
// logger.info("#############handleStatusData: 推送 status={}",status);
|
|
|
|
if(StringUtil.isBlank(currentWarehouseId)||StringUtil.isBlank(destinationWarehouseId)){ |
|
|
|
//
|
|
|
|
logger.info("#############tag{}",4); |
|
|
|
// }
|
|
|
|
log.warn("##############dealWithDataHandler: 仓库数据有问题currentWarehouseId={} destinationWarehouseId={}",currentWarehouseId,destinationWarehouseId); |
|
|
|
|
|
|
|
throw new CustomerException(400,"仓库数据有误"); |
|
|
|
// if ("4".equals(status)){
|
|
|
|
}else{ |
|
|
|
// //继续判断是否到达目的仓
|
|
|
|
logger.info("#############tag{}",5); |
|
|
|
// String currentWarehouseId = orderStatusDTO.getCurrentWarehouse();//当前仓Id
|
|
|
|
if(!currentWarehouseId.equals(destinationWarehouseId)){ |
|
|
|
// //查询destinationWarehouse logiBillNo plantId数据
|
|
|
|
logger.info("#############tag{}",6); |
|
|
|
// logger.info("#############tag{}",1);
|
|
|
|
log.info("##############dealWithDataHandler: 不用处理的状态 currentWarehouseId={} destinationWarehouseId={}",currentWarehouseId,destinationWarehouseId); |
|
|
|
//
|
|
|
|
throw new CustomerException(400,"仓库数据有误"); |
|
|
|
// Map<String,String> supplyData = advanceDetailClient.getSupplyData(orderStatusDTO.getUnitNo());
|
|
|
|
} |
|
|
|
// logger.info("#############tag{}",2);
|
|
|
|
} |
|
|
|
// String destinationWarehouseId = supplyData.get("destinationWarehouseId");//目的仓id
|
|
|
|
} |
|
|
|
// logger.info("#############tag{}",3);
|
|
|
|
|
|
|
|
// if(StringUtil.isBlank(currentWarehouseId)||StringUtil.isBlank(destinationWarehouseId)){
|
|
|
|
|
|
|
|
// logger.info("#############tag{}",4);
|
|
|
|
|
|
|
|
// log.warn("##############dealWithDataHandler: 仓库数据有问题currentWarehouseId={} destinationWarehouseId={}",currentWarehouseId,destinationWarehouseId);
|
|
|
|
|
|
|
|
// throw new CustomerException(400,"仓库数据有误");
|
|
|
|
|
|
|
|
// }else{
|
|
|
|
|
|
|
|
// logger.info("#############tag{}",5);
|
|
|
|
|
|
|
|
// if(!currentWarehouseId.equals(destinationWarehouseId)){
|
|
|
|
|
|
|
|
// logger.info("#############tag{}",6);
|
|
|
|
|
|
|
|
// log.info("##############dealWithDataHandler: 不用处理的状态 currentWarehouseId={} destinationWarehouseId={}",currentWarehouseId,destinationWarehouseId);
|
|
|
|
|
|
|
|
// throw new CustomerException(400,"仓库数据有误");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
//通过包件码查询是否是要推送的订单
|
|
|
|
//通过包件码查询是否是要推送的订单
|
|
|
|
String unitNo = orderStatusDTO.getUnitNo();//包件码
|
|
|
|
String unitNo = orderStatusDTO.getUnitNo();//包件码
|
|
|
@ -341,6 +358,30 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { |
|
|
|
return Resp.fail(400,"未找到对应订单"); |
|
|
|
return Resp.fail(400,"未找到对应订单"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 验证该数据是否推送过
|
|
|
|
|
|
|
|
logger.info("##################orderStatusHandler: 异常tag={}",1); |
|
|
|
|
|
|
|
LambdaQueryWrapper<MtPushData> lambdaQueryChainWrapper = new LambdaQueryWrapper(MtPushData.class); |
|
|
|
|
|
|
|
lambdaQueryChainWrapper.select(MtPushData::getId); |
|
|
|
|
|
|
|
lambdaQueryChainWrapper.eq(MtPushData::getPushStatus,1); |
|
|
|
|
|
|
|
lambdaQueryChainWrapper.eq(MtPushData::getRefCode,unitNo); |
|
|
|
|
|
|
|
lambdaQueryChainWrapper.eq(MtPushData::getRefParentCode,orderNo); |
|
|
|
|
|
|
|
lambdaQueryChainWrapper.eq(MtPushData::getRefType,2); |
|
|
|
|
|
|
|
logger.info("##################orderStatusHandler: 异常tag={}",2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<MtPushData> tempIds =mtPushDataService.getBaseMapper().selectList(lambdaQueryChainWrapper); |
|
|
|
|
|
|
|
logger.info("##################orderStatusHandler: 异常tag={}",3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("##################orderStatusHandler: tempIds={}",tempIds); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(tempIds!=null&& tempIds.size()>0){ |
|
|
|
|
|
|
|
// 标识存在 该项数据已被推送
|
|
|
|
|
|
|
|
return Resp.fail(400,"数据已被推送 ,无需再次重复"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//拼接参数
|
|
|
|
//拼接参数
|
|
|
|
MtOrderStatusDTO mtOrderStatusDTO = new MtOrderStatusDTO(); |
|
|
|
MtOrderStatusDTO mtOrderStatusDTO = new MtOrderStatusDTO(); |
|
|
|
mtOrderStatusDTO.setInvoiceOrderCode(mtFactoryOrderMain.getInvoiceOrderCode()); |
|
|
|
mtOrderStatusDTO.setInvoiceOrderCode(mtFactoryOrderMain.getInvoiceOrderCode()); |
|
|
@ -354,7 +395,23 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { |
|
|
|
|
|
|
|
|
|
|
|
String s = objectMapper.writeValueAsString(mtOrderStatusDTO); |
|
|
|
String s = objectMapper.writeValueAsString(mtOrderStatusDTO); |
|
|
|
|
|
|
|
|
|
|
|
return sendMtFactoryData(mtFactoryProperties.getUrl()+"/ZXCFaHuoDan/ShouHuoRuKu",s,1); |
|
|
|
R rd = sendMtFactoryData(mtFactoryProperties.getUrl() + "/ZXCFaHuoDan/ShouHuoRuKu", s, 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(rd.getCode()==ResultCode.SUCCESS.getCode()){ |
|
|
|
|
|
|
|
MtPushData mtPushData = new MtPushData(); |
|
|
|
|
|
|
|
mtPushData.setPushTime(new Date()); |
|
|
|
|
|
|
|
mtPushData.setPushStatus(1);// 推送状态
|
|
|
|
|
|
|
|
mtPushData.setRefCode(unitNo); |
|
|
|
|
|
|
|
mtPushData.setRefParentCode(orderNo); |
|
|
|
|
|
|
|
mtPushData.setRefType(2);// 包件
|
|
|
|
|
|
|
|
// 插入推送数据
|
|
|
|
|
|
|
|
logger.info("#############handleStatusData:保存推送数据{}",mtPushData); |
|
|
|
|
|
|
|
mtPushDataService.save(mtPushData); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return rd; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -364,11 +421,18 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R sendReceiveInfo(ReceiveInfoDTO receiveInfoDTO) throws JsonProcessingException, NoSuchAlgorithmException { |
|
|
|
public R sendReceiveInfo(ReceiveInfoDTO receiveInfoDTO) throws JsonProcessingException, NoSuchAlgorithmException { |
|
|
|
log.info("###########sendReceiveInfo: 处理签收图片数据开始"); |
|
|
|
log.info("###########sendReceiveInfo: 处理签收图片数据开始"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}",1); |
|
|
|
|
|
|
|
|
|
|
|
Integer newDistributionContactId = receiveInfoDTO.getNewDistributionContactId(); |
|
|
|
Integer newDistributionContactId = receiveInfoDTO.getNewDistributionContactId(); |
|
|
|
List<ReceiveBodyDTO> receiveBodyList = receiveInfoDTO.getReceiveBodyList(); |
|
|
|
List<ReceiveBodyDTO> receiveBodyList = receiveInfoDTO.getReceiveBodyList(); |
|
|
|
List<ReceivePhotoDTO> receivePhotoList = receiveInfoDTO.getReceivePhotoList(); |
|
|
|
List<ReceivePhotoDTO> receivePhotoList = receiveInfoDTO.getReceivePhotoList(); |
|
|
|
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}",2); |
|
|
|
|
|
|
|
|
|
|
|
//查询签收人
|
|
|
|
//查询签收人
|
|
|
|
NewDistributionContactEntity newDistributionContactEntity = newDistributionContactClient.fingByNewDistributionContactId(newDistributionContactId); |
|
|
|
NewDistributionContactEntity newDistributionContactEntity = newDistributionContactClient.fingByNewDistributionContactId(newDistributionContactId); |
|
|
|
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}",3); |
|
|
|
|
|
|
|
|
|
|
|
String receiver = null; |
|
|
|
String receiver = null; |
|
|
|
if (!Objects.isNull(newDistributionContactEntity)){ |
|
|
|
if (!Objects.isNull(newDistributionContactEntity)){ |
|
|
|
receiver = newDistributionContactEntity.getContact(); |
|
|
|
receiver = newDistributionContactEntity.getContact(); |
|
|
@ -381,24 +445,35 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { |
|
|
|
|
|
|
|
|
|
|
|
//循环处理签收信息
|
|
|
|
//循环处理签收信息
|
|
|
|
List<MtReceiveContentDTO> mtReceiveContentDTOList = new ArrayList<>(); |
|
|
|
List<MtReceiveContentDTO> mtReceiveContentDTOList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}",4); |
|
|
|
|
|
|
|
|
|
|
|
for(ReceiveBodyDTO receiveBodyDTO:receiveBodyList){ |
|
|
|
for(ReceiveBodyDTO receiveBodyDTO:receiveBodyList){ |
|
|
|
String unitNo = receiveBodyDTO.getUnitNo();//包条码
|
|
|
|
String unitNo = receiveBodyDTO.getUnitNo();//包条码
|
|
|
|
//通过订单编号查询总单信息
|
|
|
|
//通过订单编号查询总单信息
|
|
|
|
QueryWrapper<MtPackageInfo> packageInfoQueryWrapper = new QueryWrapper<>(); |
|
|
|
QueryWrapper<MtPackageInfo> packageInfoQueryWrapper = new QueryWrapper<>(); |
|
|
|
packageInfoQueryWrapper.eq("package_code",unitNo); |
|
|
|
packageInfoQueryWrapper.eq("package_code",unitNo); |
|
|
|
MtPackageInfo one = mtPackageInfoService.getOne(packageInfoQueryWrapper); |
|
|
|
MtPackageInfo one = mtPackageInfoService.getOne(packageInfoQueryWrapper); |
|
|
|
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}",5); |
|
|
|
|
|
|
|
|
|
|
|
if(Objects.isNull(one)){ |
|
|
|
if(Objects.isNull(one)){ |
|
|
|
logger.info("#############sendReceiveInfo: 当前包条码未找到对应数据unitNo={}",unitNo); |
|
|
|
logger.info("#############sendReceiveInfo: 当前包条码未找到对应数据unitNo={}",unitNo); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
Long orderId = one.getOrderId(); |
|
|
|
Long orderId = one.getOrderId(); |
|
|
|
MtFactoryOrder mtFactoryOrder = mtFactoryOrderService.getById(orderId); |
|
|
|
MtFactoryOrder mtFactoryOrder = mtFactoryOrderService.getById(orderId); |
|
|
|
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}",6); |
|
|
|
|
|
|
|
|
|
|
|
if(Objects.isNull(mtFactoryOrder)){ |
|
|
|
if(Objects.isNull(mtFactoryOrder)){ |
|
|
|
logger.info("#############sendReceiveInfo: 未找到对应订单orderId={}",orderId); |
|
|
|
logger.info("#############sendReceiveInfo: 未找到对应订单orderId={}",orderId); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
Long mainId = mtFactoryOrder.getMainId(); |
|
|
|
Long mainId = mtFactoryOrder.getMainId(); |
|
|
|
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}",7); |
|
|
|
|
|
|
|
|
|
|
|
MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getById(mainId); |
|
|
|
MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getById(mainId); |
|
|
|
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}",8); |
|
|
|
|
|
|
|
|
|
|
|
if(Objects.isNull(mtFactoryOrderMain)){ |
|
|
|
if(Objects.isNull(mtFactoryOrderMain)){ |
|
|
|
logger.info("#############sendReceiveInfo: 未找到对应订单mainId={}",mainId); |
|
|
|
logger.info("#############sendReceiveInfo: 未找到对应订单mainId={}",mainId); |
|
|
|
continue; |
|
|
|
continue; |
|
|
@ -412,7 +487,11 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { |
|
|
|
mtReceiveContentDTO.setUnitNo(unitNo); |
|
|
|
mtReceiveContentDTO.setUnitNo(unitNo); |
|
|
|
mtReceiveContentDTO.setOperateDate(receiveBodyDTO.getOperateDate()); |
|
|
|
mtReceiveContentDTO.setOperateDate(receiveBodyDTO.getOperateDate()); |
|
|
|
mtReceiveContentDTOList.add(mtReceiveContentDTO); |
|
|
|
mtReceiveContentDTOList.add(mtReceiveContentDTO); |
|
|
|
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}",9); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}",10); |
|
|
|
|
|
|
|
|
|
|
|
//签收信息数据存入头部数据
|
|
|
|
//签收信息数据存入头部数据
|
|
|
|
mtReceiveDTO.setReceiveContentList(mtReceiveContentDTOList); |
|
|
|
mtReceiveDTO.setReceiveContentList(mtReceiveContentDTOList); |
|
|
|
|
|
|
|
|
|
|
@ -429,6 +508,8 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { |
|
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
|
|
|
|
|
|
|
|
String s = objectMapper.writeValueAsString(mtReceiveDTO); |
|
|
|
String s = objectMapper.writeValueAsString(mtReceiveDTO); |
|
|
|
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}",11); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return sendMtFactoryData(mtFactoryProperties.getUrl()+"/ZXCFaHuoDan/QianShouDan",s,5); |
|
|
|
return sendMtFactoryData(mtFactoryProperties.getUrl()+"/ZXCFaHuoDan/QianShouDan",s,5); |
|
|
|