Переглянути джерело

无车优化,自有车接口返回

Administrator 3 роки тому
батько
коміт
380022f847

+ 13 - 34
src/main/java/com/jkcredit/invoice/service/lowerService/impl/NoCarServiceImpl.java

@@ -453,6 +453,14 @@ public class NoCarServiceImpl implements NoCarService{
     public WaybillNumFindInvoiceResponse buildInterFaceVoiceData(NoCarWayBill noCarWayBill,List<BillInvoice> billInvoices){
         WaybillNumFindInvoiceResponse waybillNumFindInvoiceResponse = new WaybillNumFindInvoiceResponse();
         List<InvoiceProcessingListModel> invoiceProcessingListModels = new ArrayList<>();
+        waybillNumFindInvoiceResponse.setResult(invoiceProcessingListModels);
+        waybillNumFindInvoiceResponse.setPlateNum(noCarWayBill.getPlateNum());
+        waybillNumFindInvoiceResponse.setInfo("成功");
+        waybillNumFindInvoiceResponse.setWaybillStartTime(DateUtil.dateToTime(noCarWayBill.getStartTime()));
+        waybillNumFindInvoiceResponse.setWaybillEndTime(DateUtil.dateToTime(noCarWayBill.getPredictEndTime()));
+        waybillNumFindInvoiceResponse.setWaybillStatus(noCarWayBill.getBillwayStatus());
+        waybillNumFindInvoiceResponse.setReceiveTime(DateUtil.dateToTime(DateUtil.getCurrentDateStr()));
+        waybillNumFindInvoiceResponse.setWaybillNum(noCarWayBill.getBillNum());
         if(billInvoices != null && billInvoices.size()>0){
             billInvoices.stream().forEach(billInvoice -> {
                 InvoiceProcessingListModel invoiceProcessingListModel = new InvoiceProcessingListModel();
@@ -464,54 +472,25 @@ public class NoCarServiceImpl implements NoCarService{
                 invoiceProcessingListModel.setWaybillEndTime(DateUtil.dateToTime(invoiceProcessingListModel.getWaybillEndTime()));
                 invoiceProcessingListModels.add(invoiceProcessingListModel);
             });
-        }else{
-            return null;
         }
-        waybillNumFindInvoiceResponse.setResult(invoiceProcessingListModels);
-        waybillNumFindInvoiceResponse.setPlateNum(noCarWayBill.getPlateNum());
-        waybillNumFindInvoiceResponse.setInfo("成功");
-        waybillNumFindInvoiceResponse.setWaybillStartTime(DateUtil.dateToTime(noCarWayBill.getStartTime()));
-        waybillNumFindInvoiceResponse.setWaybillEndTime(DateUtil.dateToTime(noCarWayBill.getPredictEndTime()));
-        waybillNumFindInvoiceResponse.setWaybillStatus(noCarWayBill.getBillwayStatus());
-        waybillNumFindInvoiceResponse.setReceiveTime(DateUtil.dateToTime(DateUtil.getCurrentDateStr()));
-        waybillNumFindInvoiceResponse.setWaybillNum(noCarWayBill.getBillNum());
         return waybillNumFindInvoiceResponse;
     }
     @Override
     @Transactional
     public RespR getInvoiceByWayBillNumReal(NoCarWayBill noCarWayBill, boolean isInterface) {
         log.info("取票啦:NoCarServiceImpl.getInvoiceByWayBillNumReal{},isCurr{}",noCarWayBill,isInterface);
-       if(noCarWayBill.getBillwayStatus() == 3){
-
-            if(isInterface){
+        if(isInterface){
+            if(noCarWayBill.getBillwayStatus() == 1 || noCarWayBill.getBillwayStatus() == 2 || noCarWayBill.getBillwayStatus() == 3 || noCarWayBill.getBillwayStatus() == 4){
                 //直接返回发票信息
                 List<BillInvoice> billInvoices = billInvoiceMapper.selectByBillNum(noCarWayBill.getBillNum());
                 WaybillNumFindInvoiceResponse waybillNumFindInvoiceResponse = buildInterFaceVoiceData(noCarWayBill,billInvoices);
-                if(waybillNumFindInvoiceResponse == null){
-                    return new RespR(false,"未查得");
-                }
                 return new RespR(waybillNumFindInvoiceResponse);
             }else{
-                return new RespR("success");
-            }
-
-        }
-        if(noCarWayBill.getBillwayStatus() == 2){
-
-            if(isInterface){
-                //直接返回发票信息
-                List<BillInvoice> billInvoices = billInvoiceMapper.selectByBillNum(noCarWayBill.getBillNum());
-                WaybillNumFindInvoiceResponse waybillNumFindInvoiceResponse = buildInterFaceVoiceData(noCarWayBill,billInvoices);
-                if(waybillNumFindInvoiceResponse == null){
-                    return new RespR(false,"未查得");
-                }
-                return new RespR(waybillNumFindInvoiceResponse);
+                return new RespR(false,noCarWayBill.getFailReason()==null?"运单未知异常":noCarWayBill.getFailReason());
             }
         }
-        int status = noCarWayBill.getBillwayStatus();
-        if(status !=2){
-            log.info("取票失败啦:NoCarServiceImpl.getInvoiceByWayBillNumReal{},isCurr{},msg{}",noCarWayBill,isInterface,"运单转态,无法开票");
-            return new RespR(false,"运单状态无法开票");
+        if(noCarWayBill.getBillwayStatus()!=2){
+           return new RespR(false,"不是开票中的状态,别取票啦");
         }
         RespR respR = checkCarWayBillAndSetInfo(noCarWayBill);
         if(respR.getCode() == 1){