|
@@ -232,11 +232,19 @@ public class NoCarServiceImpl implements NoCarService{
|
|
|
noCarWayBill.setUpdateTime(DateUtil.getCurrentDateStr());
|
|
|
noCarWayBill.setHisFlag(0);
|
|
|
noCarWayBill.setBillwayStatus(1);
|
|
|
- noCarWaybillMapper.insert(noCarWayBill);
|
|
|
+ insertOrUpdateBill(noCarWayBill);
|
|
|
}
|
|
|
return new RespR("成功");
|
|
|
}
|
|
|
+ //插入或者更新运单
|
|
|
+ public void insertOrUpdateBill(NoCarWayBill noCarWayBill){
|
|
|
|
|
|
+ if(noCarWaybillMapper.selectByBillNum(noCarWayBill.getBillNum()) == null){
|
|
|
+ noCarWaybillMapper.insert(noCarWayBill);
|
|
|
+ }else{
|
|
|
+ noCarWaybillMapper.updateByBillNum(noCarWayBill);
|
|
|
+ }
|
|
|
+ }
|
|
|
/**
|
|
|
* 组装指令报文
|
|
|
*/
|
|
@@ -291,7 +299,12 @@ public class NoCarServiceImpl implements NoCarService{
|
|
|
//查询运单号为开始指令
|
|
|
NoCarWayBill noCarWayBill1 = noCarWaybillMapper.selectByBillNum(noCarWayBill.getBillNum());
|
|
|
if(noCarWayBill1 == null || noCarWayBill1.getBillwayStatus() !=1 || noCarWayBill.getHisFlag() ==1 ){
|
|
|
- log.info("运单结束失败:NoCarServiceImpl.noCarWaybillEnd{},msg{}",noCarWayBill,"当前运单状态无法结束");
|
|
|
+ log.info("运单结束失败:NoCarServiceImpl.noCarWaybillEnd{},msg{}",noCarWayBill,"当前运单状态无法结束,请检查当前指令状态");
|
|
|
+ if(noCarWayBill1 == null){
|
|
|
+ noCarWayBill1.setBillwayStatus(-2);
|
|
|
+ }
|
|
|
+ noCarWayBill1.setFailReason("当前运单状态无法结束,请检查当前指令状态");
|
|
|
+ insertOrUpdateBill(noCarWayBill1);
|
|
|
return new RespR(false,"当前运单状态无法结束");
|
|
|
}
|
|
|
noCarWayBill1.setDestAddr(noCarWayBill.getDestAddr());
|
|
@@ -299,6 +312,7 @@ public class NoCarServiceImpl implements NoCarService{
|
|
|
noCarWayBill1.setBatchNumEnd(noCarWayBill.getBatchNumEnd());
|
|
|
if(DateUtil.getDistanceHours(noCarWayBill.getStartTime(),DateUtil.StringToDate(noCarWayBill.getPredictEndTime()))<-96){
|
|
|
noCarWayBill1.setBillwayStatus(4);
|
|
|
+ noCarWayBill1.setFailReason("运单已经超时,请拆分");
|
|
|
noCarWaybillMapper.updateByBillNum(noCarWayBill1);
|
|
|
log.info("运单结束失败:NoCarServiceImpl.noCarWaybillEnd{},msg{}",noCarWayBill,"运单已经超时,请拆分");
|
|
|
return new RespR(false,"运单已经超时,请拆分");
|
|
@@ -313,10 +327,14 @@ public class NoCarServiceImpl implements NoCarService{
|
|
|
RespR<WaybillEndResponse> waybillEndResponseRespR = noCarInterface.waybillEnd(waybillEndRequest);
|
|
|
if(waybillEndResponseRespR.getCode() == 1){
|
|
|
log.info("运单结束失败:NoCarServiceImpl.noCarWaybillEnd{},msg{}",noCarWayBill,waybillEndResponseRespR.getMsg());
|
|
|
+ noCarWayBill1.setBillwayStatus(-3);
|
|
|
+ noCarWayBill1.setFailReason(waybillEndResponseRespR.getMsg());
|
|
|
+ noCarWaybillMapper.updateByBillNum(noCarWayBill1);
|
|
|
return new RespR(false,waybillEndResponseRespR.getMsg());
|
|
|
}else if("4".equals(waybillEndResponseRespR.getData().getInfo())){
|
|
|
log.info("运单结束失败:NoCarServiceImpl.noCarWaybillEnd{},msg{}",noCarWayBill,"运单已经超时,请拆分");
|
|
|
noCarWayBill1.setBillwayStatus(4);
|
|
|
+ noCarWayBill1.setFailReason(waybillEndResponseRespR.getMsg());
|
|
|
noCarWaybillMapper.updateByBillNum(noCarWayBill1);
|
|
|
return new RespR(false,"运单已经超时,请拆分");
|
|
|
}
|
|
@@ -355,7 +373,7 @@ public class NoCarServiceImpl implements NoCarService{
|
|
|
noCarWayBill.setUpdateTime(DateUtil.getCurrentDateStr());
|
|
|
noCarWayBill.setHisFlag(1);
|
|
|
noCarWayBill.setBillwayStatus(1);
|
|
|
- noCarWaybillMapper.insert(noCarWayBill);
|
|
|
+ insertOrUpdateBill(noCarWayBill);
|
|
|
}
|
|
|
return new RespR(true);
|
|
|
}
|
|
@@ -386,11 +404,20 @@ public class NoCarServiceImpl implements NoCarService{
|
|
|
log.info("历史运单结束上传:NoCarServiceImpl.noCarHisWaybillEnd{},msg{}",noCarWayBill,"开始");
|
|
|
//查询运单号为开始指令
|
|
|
NoCarWayBill noCarWayBill1 = noCarWaybillMapper.selectByBillNum(noCarWayBill.getBillNum());
|
|
|
+ if(noCarWayBill1 == null || noCarWayBill1.getBillwayStatus() !=1 || noCarWayBill.getHisFlag() ==0 ){
|
|
|
+ log.info("运单结束失败:NoCarServiceImpl.noCarWaybillEnd{},msg{}",noCarWayBill,"当前运单状态无法结束");
|
|
|
+ if(noCarWayBill1 == null){
|
|
|
+ noCarWayBill1.setBillwayStatus(-2);
|
|
|
+ }
|
|
|
+ noCarWayBill1.setFailReason("当前运单状态无法结束,请检查当前指令状态");
|
|
|
+ insertOrUpdateBill(noCarWayBill1);
|
|
|
+ return new RespR(false,"当前运单状态无法结束");
|
|
|
+ }
|
|
|
noCarWayBill1.setDestAddr(noCarWayBill.getDestAddr());
|
|
|
noCarWayBill1.setPredictEndTime(noCarWayBill.getPredictEndTime());
|
|
|
- //todo 这里再设计一下
|
|
|
if(DateUtil.getDistanceHours(noCarWayBill.getStartTime(),DateUtil.StringToDate(noCarWayBill.getPredictEndTime()))<-96){
|
|
|
noCarWayBill1.setBillwayStatus(-3);
|
|
|
+ noCarWayBill1.setFailReason("运单已经超时,请拆分");
|
|
|
noCarWaybillMapper.updateByBillNum(noCarWayBill1);
|
|
|
log.info("历史运单结束上传失败:NoCarServiceImpl.noCarHisWaybillEnd{},msg{}",noCarWayBill,"运单已经超时,请拆分");
|
|
|
return new RespR(false,"运单已经超时,请拆分");
|
|
@@ -408,7 +435,11 @@ public class NoCarServiceImpl implements NoCarService{
|
|
|
waybillEndRequest.setEndTime(DateUtil.dateFormate(noCarWayBill1.getPredictEndTime()));
|
|
|
RespR<WaybillEndResponse> waybillEndResponseRespR = noCarInterface.waybillEnd(waybillEndRequest);
|
|
|
if(waybillEndResponseRespR.getCode() == 1){
|
|
|
+ noCarWayBill1.setBillwayStatus(-3);
|
|
|
+ noCarWayBill1.setFailReason(waybillEndResponseRespR.getMsg());
|
|
|
+ noCarWaybillMapper.updateByBillNum(noCarWayBill1);
|
|
|
log.info("历史运单结束上传失败:NoCarServiceImpl.noCarHisWaybillEnd{},msg{}",noCarWayBill1,waybillEndResponseRespR.getMsg());
|
|
|
+
|
|
|
return new RespR(false,waybillEndResponseRespR.getMsg());
|
|
|
}else if("4".equals(waybillEndResponseRespR.getData().getInfo())){
|
|
|
noCarWayBill.setBillwayStatus(4);
|