|
@@ -480,22 +480,58 @@ public class NoCarServiceImpl implements NoCarService {
|
|
|
insertOrUpdateBillStart(noCarWayBill);
|
|
|
return respR;
|
|
|
}
|
|
|
- WaybillHistoryStartRequest waybillHistoryStartRequest = buildNoCarHisWaybill(noCarWayBill);
|
|
|
- RespR<WaybillHistoryStartResponse> responseRespR = noCarInterface.waybillHistoryStart(waybillHistoryStartRequest);
|
|
|
-
|
|
|
- if (responseRespR.getCode() == 1) {
|
|
|
- log.info("历史运单开始上传失败:NoCarServiceImpl.noCarHisWaybillStart{},msg{}", noCarWayBill, responseRespR.getMsg());
|
|
|
- noCarWayBill.setBillwayStatus(-2);
|
|
|
- noCarWayBill.setFailReason(responseRespR.getMsg());
|
|
|
- insertOrUpdateBillStart(noCarWayBill);
|
|
|
- return new RespR(false, responseRespR.getMsg());
|
|
|
- } else {
|
|
|
+ if(noCarWayBill.getSplitFlag() == NoCarWayBill.SPLIT_FALG_TRUE){
|
|
|
+ //TODO 拆分运单特殊处理
|
|
|
+ List<String> startAndEndTimes = DateUtil.getSplitTimeOver96(noCarWayBill.getStartTime(),noCarWayBill.getPredictEndTime());
|
|
|
+ int i = 0;
|
|
|
+ for(String startAndEndTime :startAndEndTimes ){
|
|
|
+ try {
|
|
|
+ String [] startAndEndTimeStr = startAndEndTime.split("#");
|
|
|
+ NoCarWayBill noCarWayBillClone = noCarWayBill.clone();
|
|
|
+ noCarWayBillClone.setStartTime(startAndEndTimeStr[0]);
|
|
|
+ noCarWayBillClone.setPredictEndTime(startAndEndTimeStr[1]);
|
|
|
+ noCarWayBillClone.setBillNum(noCarWayBill.getBillNum()+"-jk0"+i);
|
|
|
+ WaybillHistoryStartRequest waybillHistoryStartRequest = buildNoCarHisWaybill(noCarWayBillClone);
|
|
|
+ RespR<WaybillHistoryStartResponse> responseRespR = noCarInterface.waybillHistoryStart(waybillHistoryStartRequest);
|
|
|
+ if (responseRespR.getCode() == 1) {
|
|
|
+ log.info("历史运单开始上传失败:NoCarServiceImpl.noCarHisWaybillStart{},msg{}", noCarWayBillClone, responseRespR.getMsg());
|
|
|
+ noCarWayBill.setBillwayStatus(-2);
|
|
|
+ noCarWayBill.setFailReason(responseRespR.getMsg());
|
|
|
+ insertOrUpdateBillStart(noCarWayBill);
|
|
|
+ return new RespR(false, responseRespR.getMsg());
|
|
|
+ }
|
|
|
+ } catch (CloneNotSupportedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ noCarWayBill.setBillwayStatus(-2);
|
|
|
+ noCarWayBill.setFailReason(e.getMessage());
|
|
|
+ insertOrUpdateBillStart(noCarWayBill);
|
|
|
+ return new RespR(false,e.getMessage());
|
|
|
+ }
|
|
|
+ i++;
|
|
|
+ }
|
|
|
noCarWayBill.setIntfaceStartTime(DateUtil.getCurrentDateStr());
|
|
|
noCarWayBill.setUpdateTime(DateUtil.getCurrentDateStr());
|
|
|
noCarWayBill.setBillwayStatus(1);
|
|
|
insertOrUpdateBillStart(noCarWayBill);
|
|
|
+ return new RespR(true);
|
|
|
+ }else{
|
|
|
+ WaybillHistoryStartRequest waybillHistoryStartRequest = buildNoCarHisWaybill(noCarWayBill);
|
|
|
+ RespR<WaybillHistoryStartResponse> responseRespR = noCarInterface.waybillHistoryStart(waybillHistoryStartRequest);
|
|
|
+
|
|
|
+ if (responseRespR.getCode() == 1) {
|
|
|
+ log.info("历史运单开始上传失败:NoCarServiceImpl.noCarHisWaybillStart{},msg{}", noCarWayBill, responseRespR.getMsg());
|
|
|
+ noCarWayBill.setBillwayStatus(-2);
|
|
|
+ noCarWayBill.setFailReason(responseRespR.getMsg());
|
|
|
+ insertOrUpdateBillStart(noCarWayBill);
|
|
|
+ return new RespR(false, responseRespR.getMsg());
|
|
|
+ } else {
|
|
|
+ noCarWayBill.setIntfaceStartTime(DateUtil.getCurrentDateStr());
|
|
|
+ noCarWayBill.setUpdateTime(DateUtil.getCurrentDateStr());
|
|
|
+ noCarWayBill.setBillwayStatus(1);
|
|
|
+ insertOrUpdateBillStart(noCarWayBill);
|
|
|
+ }
|
|
|
+ return new RespR(responseRespR.getData());
|
|
|
}
|
|
|
- return new RespR(responseRespR.getData());
|
|
|
}
|
|
|
|
|
|
public WaybillHistoryStartRequest buildNoCarHisWaybill(NoCarWayBill noCarWayBill) {
|
|
@@ -557,23 +593,46 @@ public class NoCarServiceImpl implements NoCarService {
|
|
|
waybillEndRequest.setNum(noCarWayBillDb.getBillNum());
|
|
|
waybillEndRequest.setRealDestAddr(noCarWayBillDb.getDestAddr());
|
|
|
waybillEndRequest.setEndTime(DateUtil.dateFormate(noCarWayBillDb.getPredictEndTime()));
|
|
|
- RespR<WaybillHistoryEndResponse> waybillEndResponseRespR = noCarInterface.waybillHistoryEnd(waybillEndRequest);
|
|
|
- if (waybillEndResponseRespR.getCode() == 1) {
|
|
|
- noCarWayBillDb.setBillwayStatus(-3);
|
|
|
- noCarWayBillDb.setFailReason(waybillEndResponseRespR.getMsg());
|
|
|
+ if(noCarWayBillDb.getSplitFlag() == NoCarWayBill.SPLIT_FALG_TRUE){
|
|
|
+ List<String> startAndEndTimes = DateUtil.getSplitTimeOver96(noCarWayBillDb.getStartTime(),noCarWayBillDb.getPredictEndTime());
|
|
|
+ int i = 0;
|
|
|
+ for(String startAndEndTime :startAndEndTimes ){
|
|
|
+ String [] startAndEndTimeStr = startAndEndTime.split("#");
|
|
|
+ waybillEndRequest.setEndTime(DateUtil.dateFormate(startAndEndTimeStr[1]));
|
|
|
+ waybillEndRequest.setNum(noCarWayBillDb.getBillNum()+"-jk0"+i);
|
|
|
+ RespR<WaybillHistoryEndResponse> waybillEndResponseRespR = noCarInterface.waybillHistoryEnd(waybillEndRequest);
|
|
|
+ if (waybillEndResponseRespR.getCode() == 1) {
|
|
|
+ noCarWayBillDb.setBillwayStatus(-3);
|
|
|
+ noCarWayBillDb.setFailReason(waybillEndResponseRespR.getMsg());
|
|
|
+ insertOrUpdateBillEnd(noCarWayBillDb);
|
|
|
+ log.info("历史运单结束上传失败:NoCarServiceImpl.noCarHisWaybillEnd{},msg{}", noCarWayBillDb, waybillEndResponseRespR.getMsg());
|
|
|
+
|
|
|
+ return new RespR(false, waybillEndResponseRespR.getMsg());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ noCarWayBillDb.setBillwayStatus(2);
|
|
|
insertOrUpdateBillEnd(noCarWayBillDb);
|
|
|
- log.info("历史运单结束上传失败:NoCarServiceImpl.noCarHisWaybillEnd{},msg{}", noCarWayBillDb, waybillEndResponseRespR.getMsg());
|
|
|
-
|
|
|
- return new RespR(false, waybillEndResponseRespR.getMsg());
|
|
|
- } else if (FOR.equals(waybillEndResponseRespR.getData().getInfo())) {
|
|
|
- noCarWayBill.setBillwayStatus(4);
|
|
|
+ return new RespR(true);
|
|
|
+ }else{
|
|
|
+ RespR<WaybillHistoryEndResponse> waybillEndResponseRespR = noCarInterface.waybillHistoryEnd(waybillEndRequest);
|
|
|
+ if (waybillEndResponseRespR.getCode() == 1) {
|
|
|
+ noCarWayBillDb.setBillwayStatus(-3);
|
|
|
+ noCarWayBillDb.setFailReason(waybillEndResponseRespR.getMsg());
|
|
|
+ insertOrUpdateBillEnd(noCarWayBillDb);
|
|
|
+ log.info("历史运单结束上传失败:NoCarServiceImpl.noCarHisWaybillEnd{},msg{}", noCarWayBillDb, waybillEndResponseRespR.getMsg());
|
|
|
+
|
|
|
+ return new RespR(false, waybillEndResponseRespR.getMsg());
|
|
|
+ } else if (FOR.equals(waybillEndResponseRespR.getData().getInfo())) {
|
|
|
+ noCarWayBill.setBillwayStatus(4);
|
|
|
+ insertOrUpdateBillEnd(noCarWayBillDb);
|
|
|
+ log.info("历史运单结束上传失败:NoCarServiceImpl.noCarHisWaybillEnd{},msg{}", noCarWayBillDb, "运单已经超时,请拆分");
|
|
|
+ return new RespR(false, "运单已经超时");
|
|
|
+ }
|
|
|
+ noCarWayBillDb.setBillwayStatus(2);
|
|
|
insertOrUpdateBillEnd(noCarWayBillDb);
|
|
|
- log.info("历史运单结束上传失败:NoCarServiceImpl.noCarHisWaybillEnd{},msg{}", noCarWayBillDb, "运单已经超时,请拆分");
|
|
|
- return new RespR(false, "运单已经超时");
|
|
|
+ return new RespR(waybillEndResponseRespR.getData());
|
|
|
}
|
|
|
- noCarWayBillDb.setBillwayStatus(2);
|
|
|
- insertOrUpdateBillEnd(noCarWayBillDb);
|
|
|
- return new RespR(waybillEndResponseRespR.getData());
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public WaybillNumFindInvoiceResponse buildInterFaceVoiceData(NoCarWayBill noCarWayBill, List<BillInvoice> billInvoices) {
|
|
@@ -637,12 +696,40 @@ public class NoCarServiceImpl implements NoCarService {
|
|
|
log.info("取票失败啦:NoCarServiceImpl.getInvoiceByWayBillNumReal{},isCurr{},msg{}", noCarWayBill, isInterface, respR.getMsg());
|
|
|
return respR;
|
|
|
}
|
|
|
- //进行取票操作
|
|
|
- WaybillNumFindInvoiceRequest waybillNumFindInvoiceRequest = new WaybillNumFindInvoiceRequest();
|
|
|
- String companyNum = paramService.getParamsByParamName("REQUEST_COMPANY_NUM").getParamValue();
|
|
|
- waybillNumFindInvoiceRequest.setCompanyNum(companyNum);
|
|
|
- waybillNumFindInvoiceRequest.setWaybillNum(noCarWayBill.getBillNum());
|
|
|
- RespR<WaybillNumFindInvoiceResponse> responseRespR = noCarInterface.waybillNumFindInvoice(waybillNumFindInvoiceRequest);
|
|
|
+ RespR<WaybillNumFindInvoiceResponse> responseRespR=null;
|
|
|
+ if(noCarWayBill.getSplitFlag() == NoCarWayBill.SPLIT_FALG_TRUE){
|
|
|
+ int size = DateUtil.getSplitTimeOver96(noCarWayBill.getStartTime(),noCarWayBill.getPredictEndTime()).size();
|
|
|
+ for(int i=0;i<size;i++){
|
|
|
+ String newBillNum = noCarWayBill.getBillNum()+"-jk0"+i;
|
|
|
+ WaybillNumFindInvoiceRequest waybillNumFindInvoiceRequest = new WaybillNumFindInvoiceRequest();
|
|
|
+ String companyNum = paramService.getParamsByParamName("REQUEST_COMPANY_NUM").getParamValue();
|
|
|
+ waybillNumFindInvoiceRequest.setCompanyNum(companyNum);
|
|
|
+ waybillNumFindInvoiceRequest.setWaybillNum(newBillNum);
|
|
|
+ RespR<WaybillNumFindInvoiceResponse> responseRespRrec = noCarInterface.waybillNumFindInvoice(waybillNumFindInvoiceRequest);
|
|
|
+ if (responseRespRrec.getCode() == 1) {
|
|
|
+ log.info("取票失败啦:NoCarServiceImpl.getInvoiceByWayBillNumReal{},isCurr{},msg{}", noCarWayBill, isInterface, responseRespR.getMsg());
|
|
|
+ return new RespR(false, responseRespR.getMsg());
|
|
|
+ }
|
|
|
+ if(responseRespR == null){
|
|
|
+ responseRespR = responseRespRrec;
|
|
|
+ responseRespR.getData().setWaybillNum(noCarWayBill.getBillNum());
|
|
|
+ }else{
|
|
|
+ if(responseRespR.getData().getWaybillStatus()<responseRespRrec.getData().getWaybillStatus()){
|
|
|
+ responseRespR.getData().setWaybillStatus(responseRespRrec.getData().getWaybillStatus());
|
|
|
+ }
|
|
|
+ responseRespR.getData().getResult().addAll(responseRespRrec.getData().getResult());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ //进行取票操作
|
|
|
+ WaybillNumFindInvoiceRequest waybillNumFindInvoiceRequest = new WaybillNumFindInvoiceRequest();
|
|
|
+ String companyNum = paramService.getParamsByParamName("REQUEST_COMPANY_NUM").getParamValue();
|
|
|
+ waybillNumFindInvoiceRequest.setCompanyNum(companyNum);
|
|
|
+ waybillNumFindInvoiceRequest.setWaybillNum(noCarWayBill.getBillNum());
|
|
|
+ responseRespR = noCarInterface.waybillNumFindInvoice(waybillNumFindInvoiceRequest);
|
|
|
+ }
|
|
|
+
|
|
|
if (responseRespR.getCode() == 1) {
|
|
|
log.info("取票失败啦:NoCarServiceImpl.getInvoiceByWayBillNumReal{},isCurr{},msg{}", noCarWayBill, isInterface, responseRespR.getMsg());
|
|
|
return new RespR(false, responseRespR.getMsg());
|