|
|
|
@ -260,14 +260,12 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
|
|
|
|
|
jsonObject1.put("USERID", userid); |
|
|
|
|
jsonObject1.put("USERPWD", pwd); |
|
|
|
|
jsonObject1.put("Timestamp", time); |
|
|
|
|
logger.info("##############getMengtianToken: 获取梦天token请求参数 {}", jsonObject1); |
|
|
|
|
String result = HttpRequest.post(mtFactoryProperties.getUrl() + "/Auth/Validate") |
|
|
|
|
.header("Content-Type", "application/json").body(jsonObject1.toJSONString()).timeout(5 * 1000) |
|
|
|
|
.execute() |
|
|
|
|
.body(); |
|
|
|
|
//获取的结果转成json对象
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result); |
|
|
|
|
logger.info("##############getMengtianToken: 获取梦天token返回参数 {}", result); |
|
|
|
|
|
|
|
|
|
Integer code = jsonObject.getInteger("Result"); |
|
|
|
|
String access_token = jsonObject.getString("Data"); |
|
|
|
@ -389,16 +387,13 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
|
|
|
|
|
public R sendReceiveInfo(ReceiveInfoDTO receiveInfoDTO) throws JsonProcessingException, NoSuchAlgorithmException { |
|
|
|
|
log.info("###########sendReceiveInfo: 处理签收图片数据开始"); |
|
|
|
|
|
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}", 1); |
|
|
|
|
|
|
|
|
|
Integer newDistributionContactId = receiveInfoDTO.getNewDistributionContactId(); |
|
|
|
|
List<ReceiveBodyDTO> receiveBodyList = receiveInfoDTO.getReceiveBodyList(); |
|
|
|
|
List<ReceivePhotoDTO> receivePhotoList = receiveInfoDTO.getReceivePhotoList(); |
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}", 2); |
|
|
|
|
|
|
|
|
|
//查询签收人
|
|
|
|
|
NewDistributionContactEntity newDistributionContactEntity = newDistributionContactClient.fingByNewDistributionContactId(newDistributionContactId); |
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}", 3); |
|
|
|
|
|
|
|
|
|
String receiver = null; |
|
|
|
|
if (!Objects.isNull(newDistributionContactEntity)) { |
|
|
|
@ -414,7 +409,6 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
|
|
|
|
|
//循环处理签收信息
|
|
|
|
|
List<MtReceiveContentDTO> mtReceiveContentDTOList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}", 4); |
|
|
|
|
|
|
|
|
|
for (ReceiveBodyDTO receiveBodyDTO : receiveBodyList) { |
|
|
|
|
String unitNo = receiveBodyDTO.getUnitNo();//包条码
|
|
|
|
@ -422,7 +416,6 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
|
|
|
|
|
QueryWrapper<MtPackageInfo> packageInfoQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
packageInfoQueryWrapper.eq("package_code", unitNo); |
|
|
|
|
MtPackageInfo one = mtPackageInfoService.getOne(packageInfoQueryWrapper); |
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}", 5); |
|
|
|
|
|
|
|
|
|
if (Objects.isNull(one)) { |
|
|
|
|
logger.info("#############sendReceiveInfo: 当前包条码未找到对应数据unitNo={}", unitNo); |
|
|
|
@ -430,17 +423,14 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
|
|
|
|
|
} |
|
|
|
|
Long orderId = one.getOrderId(); |
|
|
|
|
MtFactoryOrder mtFactoryOrder = mtFactoryOrderService.getById(orderId); |
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}", 6); |
|
|
|
|
|
|
|
|
|
if (Objects.isNull(mtFactoryOrder)) { |
|
|
|
|
logger.info("#############sendReceiveInfo: 未找到对应订单orderId={}", orderId); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Long mainId = mtFactoryOrder.getMainId(); |
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}", 7); |
|
|
|
|
|
|
|
|
|
MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getById(mainId); |
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}", 8); |
|
|
|
|
|
|
|
|
|
if (Objects.isNull(mtFactoryOrderMain)) { |
|
|
|
|
logger.info("#############sendReceiveInfo: 未找到对应订单mainId={}", mainId); |
|
|
|
@ -455,7 +445,6 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
|
|
|
|
|
mtReceiveContentDTO.setUnitNo(unitNo); |
|
|
|
|
mtReceiveContentDTO.setOperateDate(receiveBodyDTO.getOperateDate()); |
|
|
|
|
mtReceiveContentDTOList.add(mtReceiveContentDTO); |
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}", 9); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}", 10); |
|
|
|
@ -476,7 +465,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
|
|
|
|
|
|
String s = objectMapper.writeValueAsString(mtReceiveDTO); |
|
|
|
|
logger.info("#############sendReceiveInfo:tag{}", 11); |
|
|
|
|
log.info("###########sendReceiveInfo: 处理签收返回数据完成 {}",s); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return sendMtFactoryData(mtFactoryProperties.getUrl() + "/ZXCFaHuoDan/QianShouDan", s, 5,mtReceiveDTO.getSendTaskId()); |
|
|
|
@ -499,13 +488,11 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
|
|
|
|
|
//请求参数
|
|
|
|
|
R r =sendMtFactoryData(mtFactoryProperties.getUrl() + "/ZXCFaHuoDan/QueRenShouHuo", s, 4,unloadCarNum); |
|
|
|
|
if (r.getCode() == ResultCode.SUCCESS.getCode()) { |
|
|
|
|
log.info("##################{} 梦天确认签收数据推送2", unloadCarNum); |
|
|
|
|
MtPushData mtPushData = new MtPushData(); |
|
|
|
|
mtPushData.setPushTime(new Date()); |
|
|
|
|
mtPushData.setPushStatus(1);// 推送状态
|
|
|
|
|
mtPushData.setRefCode(unloadCarNum); |
|
|
|
|
mtPushData.setRefType(1);// 订单主表
|
|
|
|
|
// todo 这里需要查询主推送单的 ID
|
|
|
|
|
List<MtFactoryOrderMain> mtFactoryOrderMainList = mtFactoryOrderMainService.findMtFactoryOrderMainByInvoiceOrderCode(unloadCarNum); |
|
|
|
|
if (mtFactoryOrderMainList.size() > 0) { |
|
|
|
|
mtFactoryOrderMainList.get(0); |
|
|
|
@ -529,6 +516,10 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
|
|
|
|
|
* @throws NoSuchAlgorithmException |
|
|
|
|
*/ |
|
|
|
|
private R sendMtFactoryData(String url, String data, Integer type,String refCode) throws NoSuchAlgorithmException { |
|
|
|
|
|
|
|
|
|
logger.info("##############sendMtFactoryData 发送数据: {}", data); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//先获取token
|
|
|
|
|
String token = getMtToken(); |
|
|
|
|
//处理逻辑
|
|
|
|
@ -541,7 +532,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
|
|
|
|
|
.body(data).timeout(5 * 1000) |
|
|
|
|
.execute().body(); |
|
|
|
|
|
|
|
|
|
logger.info("##############sendMtFactoryData: {}", result); |
|
|
|
|
logger.info("##############sendMtFactoryData 接受数据: {}", result); |
|
|
|
|
// 保存数据到数据库
|
|
|
|
|
MtOrderLogEntity mtOrderLogEntity = new MtOrderLogEntity(); |
|
|
|
|
mtOrderLogEntity.setReqArgs(data); |
|
|
|
|