Просмотр исходного кода

代码优化开发202110172327

MSY 3 лет назад
Родитель
Сommit
9903cc6507

+ 34 - 2
src/main/java/com/jkcredit/invoice/controller/localBussiness/NoCarController.java

@@ -232,7 +232,37 @@ public class NoCarController {
             e.printStackTrace();
             return new RespR(false,e.getMessage());
         }
-    }    /**
+    }
+
+
+    /**
+     * 批量查询无车运单信息
+     *
+     * @param file    参数集
+     * @return
+     */
+    @PostMapping("/batchImportNocarBillWay")
+    @ApiOperation(value="批量查询无车运单信息", notes="批量查询无车运单信息")
+    @LoginRequired
+    public RespR batchImportNocarBillWay(@RequestParam("file") MultipartFile file) {
+        try {
+            ImportParams params = new ImportParams();
+            params.setTitleRows(1);
+            params.setHeadRows(1);
+            params.setKeyIndex(2);
+            List<NoCarWayBill> list = ExcelImportUtil.importExcel(file.getInputStream(), NoCarWayBill.class,params) ;
+            RespR respR = noCarBillWayService.findImportNocarBillWay(list);
+            return respR;
+        }catch (Exception e){
+            e.printStackTrace();
+            return new RespR(false,e.getMessage());
+        }
+    }
+
+
+
+
+    /**
      * 分页查询无车运单统计信息
      *
      * @param    billInvoice
@@ -391,11 +421,13 @@ public class NoCarController {
                 fileName = "历史运单模板.xlsx";
             }else if("4".equals(fileName)){
                 fileName = "无车发票查询模板.xlsx";
+            }else if("5".equals(fileName)){
+                fileName = "无车运单查询模板.xlsx";
             }
             OutputStream outputStream = null;
             InputStream inputStream = null;
             try {
-                File file = new File("D:\\sys_invoice_tools\\"+fileName);
+                File file = new File("/home/app/excel/"+fileName);
                 inputStream = new FileInputStream(file);
                 response.setHeader("Content-Disposition", "attachment;filename="+ URLEncoder.encode(fileName, "UTF-8"));
                 outputStream = response.getOutputStream();

+ 1 - 0
src/main/java/com/jkcredit/invoice/credit/SimpleCORSFilter.java

@@ -130,6 +130,7 @@ public class SimpleCORSFilter implements Filter {
             "/noCar/findNocarCalculateInfo",
             "/noCar/templateDownload",
             "/noCar/batchImportNocarInvoices",
+            "/noCar/batchImportNocarBillWay",
 
 
             "/selfCar/selfCarUnBind",

+ 1 - 1
src/main/java/com/jkcredit/invoice/model/entity/waybill/NoCarWayBill.java

@@ -111,7 +111,7 @@ public class NoCarWayBill implements Cloneable{
     /**
      * 运单类型 0-实时运单 1-历史运单
      */
-    private Integer hisFlag = 0;
+    private Integer hisFlag ;
 
     /**
      * 行云公司编号

+ 3 - 0
src/main/java/com/jkcredit/invoice/service/nocar/NoCarBillWayService.java

@@ -44,4 +44,7 @@ public interface NoCarBillWayService {
      * @return
      */
     RespR batchHsitoryBillWay(List<NoCarWayBill> noCarWayBills,String customerName);
+
+
+    RespR findImportNocarBillWay(List<NoCarWayBill> list);
 }

+ 20 - 0
src/main/java/com/jkcredit/invoice/service/nocar/impl/NoCarBillWayServiceImpl.java

@@ -240,4 +240,24 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
         }
         return new RespR(Boolean.TRUE);
     }
+
+
+
+
+
+    @Override
+    public RespR findImportNocarBillWay(List<NoCarWayBill> noCarWayBills) {
+        if(noCarWayBills ==null || 0 == noCarWayBills.size()){
+            return new RespR<>("失败","0");
+        }
+        List<NoCarWayBill> noCarWayBillsTmp = new ArrayList<NoCarWayBill>();
+        for (NoCarWayBill noCarWayBill:noCarWayBills) {
+            if(StringUtils.isEmpty(noCarWayBill.getBillNum()) ){
+                return new RespR<>("失败","0");
+            }
+            NoCarWayBill bill =  noCarWaybillMapper.selectByBillNum(noCarWayBill.getBillNum());
+            noCarWayBillsTmp.add(bill);
+        }
+        return new RespR<>(noCarWayBillsTmp,"1");
+    }
 }

+ 4 - 0
src/main/java/com/jkcredit/invoice/service/nocar/impl/NocarInvoiceServiceImpl.java

@@ -32,6 +32,10 @@ public class NocarInvoiceServiceImpl extends ServiceImpl<BillInvoiceMapper,BillI
 
     @Override
     public RespR findImportNocarInvoices(List<BillInvoice> billInvoices) {
+        if(billInvoices ==null || 0 == billInvoices.size()){
+            return new RespR<>("失败","0");
+        }
+
         List<BillInvoice> billInvoicesTmp = new ArrayList<BillInvoice>();
         for (BillInvoice billInvoice:billInvoices) {
             if(StringUtils.isEmpty(billInvoice.getInvoiceNum()) || StringUtils.isEmpty(billInvoice.getInvoiceCode())){

BIN
src/main/resources/static/templates/excel/无车发票查询模板.xlsx


BIN
src/main/resources/static/templates/excel/无车运单查询模板.xlsx