|
@@ -166,22 +166,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
|
|
|
|
|
|
customerCarRecList.add(customerCarRec);
|
|
|
|
|
|
- RespR rs = noCarService.customerCarRec(customerCarRecList);
|
|
|
- long costtimeend = System.currentTimeMillis();
|
|
|
- log.info("[-NoCarInterServiceImpl.customerCarRec-] result is "
|
|
|
- + rs.toString() + ", request is " + data + " ,costtime="
|
|
|
- + (costtimeend - costtimestart));
|
|
|
- if (null != rs && rs.getCode() == 0) {
|
|
|
- result.setData(1);
|
|
|
- result.setCode(200);
|
|
|
- result.setMsg(rs.getData().toString());
|
|
|
- return result;
|
|
|
- } else {
|
|
|
- result.setData(3);
|
|
|
- result.setCode(200);
|
|
|
- result.setMsg(rs.getMsg());
|
|
|
- return result;
|
|
|
- }
|
|
|
+ return getDataResultss(data, costtimestart, result, noCarService.customerCarRec(customerCarRecList), "[-NoCarInterServiceImpl.customerCarRec-] result is ");
|
|
|
} catch (Exception e) {
|
|
|
log.error("[-NoCarInterServiceImpl.customerCarRec-] get httpclient exception is "
|
|
|
+ e + ", request is " + data);
|
|
@@ -340,37 +325,8 @@ public class NoCarInterServiceImpl implements NoCarInterService {
|
|
|
result.setMsg("客户:" + appKey + ";税号" + taxplayerCode + "未在平台备案成功,请先做备案");
|
|
|
return result;
|
|
|
}
|
|
|
- NoCarWayBill noCarWayBill = new NoCarWayBill();
|
|
|
- noCarWayBill.setCustomerName(appKey);
|
|
|
- noCarWayBill.setCompanyName(customerRec.getCompanyName());
|
|
|
- noCarWayBill.setPlateNum(plateNumber);
|
|
|
- noCarWayBill.setBillNum(num);
|
|
|
- noCarWayBill.setPlateColor(plateColor);
|
|
|
- noCarWayBill.setStartTime(DateUtil.getDistanceHoursFormat(startTime));
|
|
|
- noCarWayBill.setSourceAddr(sourceAddr);
|
|
|
- noCarWayBill.setDestAddr(destAddr);
|
|
|
- noCarWayBill.setPredictEndTime(DateUtil.getDistanceHoursFormat(predictEndTime));
|
|
|
- noCarWayBill.setFee(fee.longValue());
|
|
|
- noCarWayBill.setTitleType(titleType);
|
|
|
- noCarWayBill.setTaxplayerCode(taxplayerCode);
|
|
|
- noCarWayBill.setHisFlag(0);
|
|
|
- noCarWayBill.setIntfaceStartTime(DateUtil.getCurrentDateStr());
|
|
|
- List<CustomerCarRec> customerCarRecs = new ArrayList<>();
|
|
|
- CustomerCarRec customerCarRec = new CustomerCarRec();
|
|
|
- customerCarRec.setCompanyName(noCarWayBill.getCompanyName());
|
|
|
- customerCarRec.setCarNum(noCarWayBill.getPlateNum());
|
|
|
- customerCarRec.setCarColor(noCarWayBill.getPlateColor());
|
|
|
- customerCarRec.setCustomerName(appKey);
|
|
|
- //接口
|
|
|
- customerCarRec.setInterType(0);
|
|
|
- customerCarRec.setCompanyNum(customerRec.getCompanyNum());
|
|
|
- customerCarRec.setBusinessType("2");
|
|
|
- //默认运营车辆
|
|
|
- customerCarRec.setServiceOperation(1);
|
|
|
- noCarWayBill.setTitleType(2);
|
|
|
- //接口
|
|
|
- noCarWayBill.setInterType(0);
|
|
|
- return getDataResult(data, costtimestart, result, noCarWayBill, customerCarRecs, customerCarRec);
|
|
|
+ NoCarWayBill noCarWayBill = getNoCarWayBill(appKey, num, plateNumber, plateColor, startTime, sourceAddr, destAddr, predictEndTime, fee, titleType, taxplayerCode, customerRec);
|
|
|
+ return getDataResult(appKey, data, costtimestart, result, customerRec, noCarWayBill);
|
|
|
} catch (Exception e) {
|
|
|
log.error("[-NoCarInterServiceImpl.noCarBillStart-] get httpclient exception is "
|
|
|
+ e + ", request is " + data);
|
|
@@ -378,6 +334,44 @@ public class NoCarInterServiceImpl implements NoCarInterService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ private DataResult getDataResult(String appKey, String data, long costtimestart, DataResult result, CustomerRec customerRec, NoCarWayBill noCarWayBill) {
|
|
|
+ List<CustomerCarRec> customerCarRecs = new ArrayList<>();
|
|
|
+ CustomerCarRec customerCarRec = new CustomerCarRec();
|
|
|
+ customerCarRec.setCompanyName(noCarWayBill.getCompanyName());
|
|
|
+ customerCarRec.setCarNum(noCarWayBill.getPlateNum());
|
|
|
+ customerCarRec.setCarColor(noCarWayBill.getPlateColor());
|
|
|
+ customerCarRec.setCustomerName(appKey);
|
|
|
+ //接口
|
|
|
+ customerCarRec.setInterType(0);
|
|
|
+ customerCarRec.setCompanyNum(customerRec.getCompanyNum());
|
|
|
+ customerCarRec.setBusinessType("2");
|
|
|
+ //默认运营车辆
|
|
|
+ customerCarRec.setServiceOperation(1);
|
|
|
+ noCarWayBill.setTitleType(2);
|
|
|
+ //接口
|
|
|
+ noCarWayBill.setInterType(0);
|
|
|
+ return getDataResult(data, costtimestart, result, noCarWayBill, customerCarRecs, customerCarRec);
|
|
|
+ }
|
|
|
+
|
|
|
+ private NoCarWayBill getNoCarWayBill(String appKey, String num, String plateNumber, String plateColor, String startTime, String sourceAddr, String destAddr, String predictEndTime, Integer fee, Integer titleType, String taxplayerCode, CustomerRec customerRec) {
|
|
|
+ NoCarWayBill noCarWayBill = new NoCarWayBill();
|
|
|
+ noCarWayBill.setCustomerName(appKey);
|
|
|
+ noCarWayBill.setCompanyName(customerRec.getCompanyName());
|
|
|
+ noCarWayBill.setPlateNum(plateNumber);
|
|
|
+ noCarWayBill.setBillNum(num);
|
|
|
+ noCarWayBill.setPlateColor(plateColor);
|
|
|
+ noCarWayBill.setStartTime(DateUtil.getDistanceHoursFormat(startTime));
|
|
|
+ noCarWayBill.setSourceAddr(sourceAddr);
|
|
|
+ noCarWayBill.setDestAddr(destAddr);
|
|
|
+ noCarWayBill.setPredictEndTime(DateUtil.getDistanceHoursFormat(predictEndTime));
|
|
|
+ noCarWayBill.setFee(fee.longValue());
|
|
|
+ noCarWayBill.setTitleType(titleType);
|
|
|
+ noCarWayBill.setTaxplayerCode(taxplayerCode);
|
|
|
+ noCarWayBill.setHisFlag(0);
|
|
|
+ noCarWayBill.setIntfaceStartTime(DateUtil.getCurrentDateStr());
|
|
|
+ return noCarWayBill;
|
|
|
+ }
|
|
|
+
|
|
|
private DataResult getDataResult(String data, long costtimestart, DataResult result, NoCarWayBill noCarWayBill, List<CustomerCarRec> customerCarRecs, CustomerCarRec customerCarRec) {
|
|
|
//先查询上游是否已经备案
|
|
|
RespR<VehicleQueryResponse> respRquery = noCarService.customerCarRecQueryUpper(customerCarRec);
|
|
@@ -392,22 +386,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
- RespR rs = noCarService.noCarWaybillStart(noCarWayBill);
|
|
|
- long costtimeend = System.currentTimeMillis();
|
|
|
- log.info("[-NoCarInterServiceImpl.noCarBillStart-] result is "
|
|
|
- + rs.toString() + ", request is " + data + " ,costtime="
|
|
|
- + (costtimeend - costtimestart));
|
|
|
- if (null != rs && rs.getCode() == 0) {
|
|
|
- result.setData(1);
|
|
|
- result.setCode(200);
|
|
|
- result.setMsg(rs.getData().toString());
|
|
|
- return result;
|
|
|
- } else {
|
|
|
- result.setData(3);
|
|
|
- result.setCode(200);
|
|
|
- result.setMsg(rs.getMsg());
|
|
|
- return result;
|
|
|
- }
|
|
|
+ return getDataResultss(data, costtimestart, result, noCarService.noCarWaybillStart(noCarWayBill), "[-NoCarInterServiceImpl.noCarBillStart-] result is ");
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -462,22 +441,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
|
|
|
noCarWayBill.setHisFlag(0);
|
|
|
//接口
|
|
|
noCarWayBill.setInterType(0);
|
|
|
- RespR rs = noCarService.noCarWaybillEnd(noCarWayBill);
|
|
|
- long costtimeend = System.currentTimeMillis();
|
|
|
- log.info("[-NoCarInterServiceImpl.noCarBillEnd-] result is "
|
|
|
- + rs.toString() + ", request is " + data + " ,costtime="
|
|
|
- + (costtimeend - costtimestart));
|
|
|
- if (null != rs && rs.getCode() == 0) {
|
|
|
- result.setData(1);
|
|
|
- result.setCode(200);
|
|
|
- result.setMsg(rs.getData().toString());
|
|
|
- return result;
|
|
|
- } else {
|
|
|
- result.setData(3);
|
|
|
- result.setCode(200);
|
|
|
- result.setMsg(rs.getMsg());
|
|
|
- return result;
|
|
|
- }
|
|
|
+ return getDataResultss(data, costtimestart, result, noCarService.noCarWaybillEnd(noCarWayBill), "[-NoCarInterServiceImpl.noCarBillEnd-] result is ");
|
|
|
} catch (Exception e) {
|
|
|
log.error("[-NoCarInterServiceImpl.noCarBillEnd-] get httpclient exception is "
|
|
|
+ e + ", request is " + data);
|
|
@@ -555,24 +519,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
|
|
|
result.setMsg("客户:" + appKey + ";税号" + taxplayerCode + "未在平台备案成功,请先做备案");
|
|
|
return result;
|
|
|
}
|
|
|
- NoCarWayBill noCarWayBill = new NoCarWayBill();
|
|
|
- noCarWayBill.setCustomerName(appKey);
|
|
|
- noCarWayBill.setCompanyName(customerRec.getCompanyName());
|
|
|
- noCarWayBill.setPlateNum(plateNumber);
|
|
|
- noCarWayBill.setBillNum(num);
|
|
|
- noCarWayBill.setPlateColor(plateColor);
|
|
|
- noCarWayBill.setStartTime(DateUtil.getDistanceHoursFormat(startTime));
|
|
|
- noCarWayBill.setSourceAddr(sourceAddr);
|
|
|
- noCarWayBill.setDestAddr(destAddr);
|
|
|
- noCarWayBill.setPredictEndTime(DateUtil.getDistanceHoursFormat(predictEndTime));
|
|
|
- noCarWayBill.setFee(fee.longValue());
|
|
|
- noCarWayBill.setTitleType(titleType);
|
|
|
- noCarWayBill.setTaxplayerCode(taxplayerCode);
|
|
|
- noCarWayBill.setHisFlag(1);
|
|
|
- noCarWayBill.setUpdateTime(DateUtil.getCurrentDateStr());
|
|
|
- noCarWayBill.setIntfaceStartTime(DateUtil.getCurrentDateStr());
|
|
|
- //接口
|
|
|
- noCarWayBill.setInterType(0);
|
|
|
+ NoCarWayBill noCarWayBill = getNoCarWayBills(appKey, num, plateNumber, plateColor, startTime, sourceAddr, destAddr, predictEndTime, fee, titleType, taxplayerCode, customerRec);
|
|
|
List<CustomerCarRec> customerCarRecs = new ArrayList<>();
|
|
|
CustomerCarRec customerCarRec = new CustomerCarRec();
|
|
|
customerCarRec.setCompanyName(noCarWayBill.getCompanyName());
|
|
@@ -585,35 +532,10 @@ public class NoCarInterServiceImpl implements NoCarInterService {
|
|
|
//默认运营车辆
|
|
|
customerCarRec.setServiceOperation(1);
|
|
|
noCarWayBill.setTitleType(2);
|
|
|
- //先查询上游是否已经备案
|
|
|
- RespR<VehicleQueryResponse> respRquery = noCarService.customerCarRecQueryUpper(customerCarRec);
|
|
|
- if (respRquery.getCode() == 1 || respRquery.getData() == null || respRquery.getData().getResult() == null || respRquery.getData().getResult().size() <= 0) {
|
|
|
- customerCarRecs.add(customerCarRec);
|
|
|
- RespR respR = noCarService.customerCarRec(customerCarRecs);
|
|
|
- if (respR.getCode() == 1) {
|
|
|
- result.setMsg("车牌号备案失败,失败原因:" + respR.getMsg());
|
|
|
- noCarWayBill.setFailReason(respR.getMsg());
|
|
|
- noCarWayBill.setBillwayStatus(-2);
|
|
|
- insertOrUpdateBillStart(noCarWayBill);
|
|
|
- return result;
|
|
|
- }
|
|
|
- }
|
|
|
- RespR rs = noCarService.noCarHisWaybillStart(noCarWayBill);
|
|
|
- long costtimeend = System.currentTimeMillis();
|
|
|
- log.info("[-NoCarInterServiceImpl.noCarHisWaybillStart-] result is "
|
|
|
- + rs.toString() + ", request is " + data + " ,costtime="
|
|
|
- + (costtimeend - costtimestart));
|
|
|
- if (null != rs && rs.getCode() == 0) {
|
|
|
- result.setData(1);
|
|
|
- result.setCode(200);
|
|
|
- result.setMsg(rs.getData().toString());
|
|
|
- return result;
|
|
|
- } else {
|
|
|
- result.setData(3);
|
|
|
- result.setCode(200);
|
|
|
- result.setMsg(rs.getMsg());
|
|
|
+ if (checkCustomerCarRecQueryResult(result, noCarWayBill, customerCarRecs, customerCarRec)) {
|
|
|
return result;
|
|
|
}
|
|
|
+ return getDataResultss(data, costtimestart, result, noCarService.noCarHisWaybillStart(noCarWayBill), "[-NoCarInterServiceImpl.noCarHisWaybillStart-] result is ");
|
|
|
} catch (Exception e) {
|
|
|
log.error("[-NoCarInterServiceImpl.noCarHisWaybillStart-] get httpclient exception is "
|
|
|
+ e + ", request is " + data);
|
|
@@ -621,6 +543,64 @@ public class NoCarInterServiceImpl implements NoCarInterService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ private DataResult getDataResultss(String data, long costtimestart, DataResult result, RespR respR, String s) {
|
|
|
+ RespR rs = respR;
|
|
|
+ long costtimeend = System.currentTimeMillis();
|
|
|
+ log.info(s
|
|
|
+ + rs.toString() + ", request is " + data + " ,costtime="
|
|
|
+ + (costtimeend - costtimestart));
|
|
|
+ if (null != rs && rs.getCode() == 0) {
|
|
|
+ result.setData(1);
|
|
|
+ result.setCode(200);
|
|
|
+ result.setMsg(rs.getData().toString());
|
|
|
+ return result;
|
|
|
+ } else {
|
|
|
+ result.setData(3);
|
|
|
+ result.setCode(200);
|
|
|
+ result.setMsg(rs.getMsg());
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean checkCustomerCarRecQueryResult(DataResult result, NoCarWayBill noCarWayBill, List<CustomerCarRec> customerCarRecs, CustomerCarRec customerCarRec) {
|
|
|
+ //先查询上游是否已经备案
|
|
|
+ RespR<VehicleQueryResponse> respRquery = noCarService.customerCarRecQueryUpper(customerCarRec);
|
|
|
+ if (respRquery.getCode() == 1 || respRquery.getData() == null || respRquery.getData().getResult() == null || respRquery.getData().getResult().size() <= 0) {
|
|
|
+ customerCarRecs.add(customerCarRec);
|
|
|
+ RespR respR = noCarService.customerCarRec(customerCarRecs);
|
|
|
+ if (respR.getCode() == 1) {
|
|
|
+ result.setMsg("车牌号备案失败,失败原因:" + respR.getMsg());
|
|
|
+ noCarWayBill.setFailReason(respR.getMsg());
|
|
|
+ noCarWayBill.setBillwayStatus(-2);
|
|
|
+ insertOrUpdateBillStart(noCarWayBill);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ private NoCarWayBill getNoCarWayBills(String appKey, String num, String plateNumber, String plateColor, String startTime, String sourceAddr, String destAddr, String predictEndTime, Integer fee, Integer titleType, String taxplayerCode, CustomerRec customerRec) {
|
|
|
+ NoCarWayBill noCarWayBill = new NoCarWayBill();
|
|
|
+ noCarWayBill.setCustomerName(appKey);
|
|
|
+ noCarWayBill.setCompanyName(customerRec.getCompanyName());
|
|
|
+ noCarWayBill.setPlateNum(plateNumber);
|
|
|
+ noCarWayBill.setBillNum(num);
|
|
|
+ noCarWayBill.setPlateColor(plateColor);
|
|
|
+ noCarWayBill.setStartTime(DateUtil.getDistanceHoursFormat(startTime));
|
|
|
+ noCarWayBill.setSourceAddr(sourceAddr);
|
|
|
+ noCarWayBill.setDestAddr(destAddr);
|
|
|
+ noCarWayBill.setPredictEndTime(DateUtil.getDistanceHoursFormat(predictEndTime));
|
|
|
+ noCarWayBill.setFee(fee.longValue());
|
|
|
+ noCarWayBill.setTitleType(titleType);
|
|
|
+ noCarWayBill.setTaxplayerCode(taxplayerCode);
|
|
|
+ noCarWayBill.setHisFlag(1);
|
|
|
+ noCarWayBill.setUpdateTime(DateUtil.getCurrentDateStr());
|
|
|
+ noCarWayBill.setIntfaceStartTime(DateUtil.getCurrentDateStr());
|
|
|
+ //接口
|
|
|
+ noCarWayBill.setInterType(0);
|
|
|
+ return noCarWayBill;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 插入或者更新运单
|
|
|
* @param noCarWayBill
|
|
@@ -691,22 +671,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
|
|
|
noCarWayBill.setCustomerName(appKey);
|
|
|
//接口
|
|
|
noCarWayBill.setInterType(0);
|
|
|
- RespR rs = noCarService.noCarHisWaybillEnd(noCarWayBill);
|
|
|
- long costtimeend = System.currentTimeMillis();
|
|
|
- log.info("[-NoCarInterServiceImpl.noCarHisWaybillEnd-] result is "
|
|
|
- + rs.toString() + ", request is " + data + " ,costtime="
|
|
|
- + (costtimeend - costtimestart));
|
|
|
- if (null != rs && rs.getCode() == 0) {
|
|
|
- result.setData(1);
|
|
|
- result.setCode(200);
|
|
|
- result.setMsg(rs.getData().toString());
|
|
|
- return result;
|
|
|
- } else {
|
|
|
- result.setData(3);
|
|
|
- result.setCode(200);
|
|
|
- result.setMsg(rs.getMsg());
|
|
|
- return result;
|
|
|
- }
|
|
|
+ return getDataResultss(data, costtimestart, result, noCarService.noCarHisWaybillEnd(noCarWayBill), "[-NoCarInterServiceImpl.noCarHisWaybillEnd-] result is ");
|
|
|
} catch (Exception e) {
|
|
|
log.error("[-NoCarInterServiceImpl.noCarHisWaybillEnd-] get httpclient exception is "
|
|
|
+ e + ", request is " + data);
|