Pārlūkot izejas kodu

后端代码提交

mashengyi 3 gadi atpakaļ
vecāks
revīzija
3291ebcda0

+ 36 - 5
src/main/java/com/jkcredit/invoice/controller/localBussiness/NoCarController.java

@@ -8,6 +8,7 @@ import com.jkcredit.invoice.mapper.waybill.NoCarWaybillMapper;
 import com.jkcredit.invoice.model.entity.Calculate.NoCarCalculateInfor;
 import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
 import com.jkcredit.invoice.model.entity.customer.CustomerOper;
+import com.jkcredit.invoice.model.entity.customer.CustomerRec;
 import com.jkcredit.invoice.model.entity.invoice.BillInvoice;
 import com.jkcredit.invoice.model.entity.waybill.NoCarWayBill;
 import com.jkcredit.invoice.service.CalculateInfor.NoCarCalculateInfoService;
@@ -20,18 +21,19 @@ import com.jkcredit.invoice.util.ReadExcelUtil;
 import com.jkcredit.invoice.util.RespR;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.poi.util.IOUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.io.File;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.URLEncoder;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Base64;
 import java.util.List;
 
 @Api(tags = "无车操作")
@@ -329,7 +331,35 @@ public class NoCarController {
             return new RespR(false,e.getMessage());
         }
     }
+    @GetMapping("/templateDownload")
+    @ApiOperation(value="模板下载", notes="模板下载")
+    public RespR contractDownload(String fileName,HttpServletResponse response){
+            if("1".equals(fileName)){
+                fileName = "运单模板.xlsx";
+            }else if("2".equals(fileName)){
+                fileName = "运单结束模板.xlsx";
+            }else if("3".equals(fileName)){
+                fileName = "历史运单模板.xlsx";
+            }
+            String path = this.getClass().getClassLoader().getResource("").getPath();
+            OutputStream outputStream = null;
+            InputStream inputStream = null;
+            try {
+                File file = new File(path+"static/templates/excel/"+fileName);
+                inputStream = new FileInputStream(file);
+                response.setHeader("Content-Disposition", "attachment;filename="+ URLEncoder.encode(fileName, "UTF-8"));
+                outputStream = response.getOutputStream();
+                IOUtils.copy(inputStream, outputStream);
+                response.flushBuffer();
+                return new RespR(true);
+            } catch (IOException e) {
 
+            } finally {
+                IOUtils.closeQuietly(inputStream);
+                IOUtils.closeQuietly(outputStream);
+            }
+        return new RespR(false);
+    }
     public void setTimeDue1(NoCarCalculateInfor carCalculateInfor){
         if(!StringUtils.isEmpty(carCalculateInfor.getInvoiceMakeTime()) && !"null".equals(carCalculateInfor.getInvoiceMakeTime())){
             String [] res = carCalculateInfor.getInvoiceMakeTime().split(",");
@@ -346,4 +376,5 @@ public class NoCarController {
             carCalculateInfor.setCalculateTime(null);
         }
     }
+
 }

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

@@ -127,6 +127,7 @@ public class SimpleCORSFilter implements Filter {
             "/noCar/findNocarInvoices",
             "/noCar/findNocarInvoicesStatic",
             "/noCar/findNocarCalculateInfo",
+            "/noCar/templateDownload",
 
 
             "/selfCar/selfCarUnBind",

+ 1 - 0
src/main/java/com/jkcredit/invoice/service/lowerService/impl/CustomerLowerServiceImpl.java

@@ -68,6 +68,7 @@ public class CustomerLowerServiceImpl implements CustomeLowerService {
                List<B2bCompanyModel> b2bCompanyModels = (List<B2bCompanyModel>)respR.getData();
                if(b2bCompanyModels.size()==1){
                    customerRec.setCompanyNum(b2bCompanyModels.get(0).getCompanyNum());
+                   customerRec.setCompanyType(b2bCompanyModels.get(0).getCompanyType());
                    customerRec.setRecStatus(1);
                }
             }

+ 18 - 9
src/main/java/com/jkcredit/invoice/service/lowerService/impl/NoCarServiceImpl.java

@@ -99,7 +99,8 @@ public class NoCarServiceImpl implements NoCarService{
                 }
                 //先查询上游是否是已经备案
                 VehicleQueryRequest vehicleQueryRequest = new VehicleQueryRequest();
-                vehicleQueryRequest.setCompanyNum(customerRec.getCompanyNum());
+                String companyNum = paramService.getParamsByParamName("REQUEST_COMPANY_NUM").getParamValue();
+                vehicleQueryRequest.setCompanyNum(companyNum);
                 vehicleQueryRequest.setPlateColor(Integer.parseInt(customerCarRec.getCarColor()));
                 vehicleQueryRequest.setPlateNum(customerCarRec.getCarNum());
                 vehicleQueryRequest.setWaybillSource(1);
@@ -170,7 +171,8 @@ public class NoCarServiceImpl implements NoCarService{
         }*/
 
         VehicleQueryRequest vehicleQueryRequest = new VehicleQueryRequest();
-        vehicleQueryRequest.setCompanyNum(customerCarRec.getCompanyNum());
+        String companyNum = paramService.getParamsByParamName("REQUEST_COMPANY_NUM").getParamValue();
+        vehicleQueryRequest.setCompanyNum(companyNum);
         vehicleQueryRequest.setWaybillSource(1);//1 无车承运人
         vehicleQueryRequest.setPlateNum(customerCarRec.getCarNum());
         vehicleQueryRequest.setPlateColor(Integer.valueOf(customerCarRec.getCarColor()));
@@ -228,7 +230,8 @@ public class NoCarServiceImpl implements NoCarService{
      */
     public WaybillStartRequest buildWaybillStartRequest(NoCarWayBill noCarWayBill){
         WaybillStartRequest waybillStartRequest = new WaybillStartRequest();
-        waybillStartRequest.setCompanyNum(noCarWayBill.getCompanyNum());
+        String companyNum = paramService.getParamsByParamName("REQUEST_COMPANY_NUM").getParamValue();
+        waybillStartRequest.setCompanyNum(companyNum);
         waybillStartRequest.setNum(noCarWayBill.getBillNum());
         waybillStartRequest.setPlateNum(noCarWayBill.getPlateNum());
         waybillStartRequest.setPlateColor(Integer.parseInt(noCarWayBill.getPlateColor()));
@@ -287,7 +290,8 @@ public class NoCarServiceImpl implements NoCarService{
         }
 
         WaybillEndRequest waybillEndRequest = new WaybillEndRequest();
-        waybillEndRequest.setCompanyNum(noCarWayBill1.getCompanyNum());
+        String companyNum = paramService.getParamsByParamName("REQUEST_COMPANY_NUM").getParamValue();
+        waybillEndRequest.setCompanyNum(companyNum);
         waybillEndRequest.setNum(noCarWayBill1.getBillNum());
         waybillEndRequest.setRealDestAddr(noCarWayBill1.getDestAddr());
         waybillEndRequest.setEndTime(DateUtil.dateFormate(noCarWayBill1.getPredictEndTime()));
@@ -332,7 +336,8 @@ public class NoCarServiceImpl implements NoCarService{
 
     public WaybillHistoryStartRequest BuildNoCarHisWaybill(NoCarWayBill noCarWayBill){
         WaybillHistoryStartRequest waybillStartRequest = new WaybillHistoryStartRequest();
-        waybillStartRequest.setCompanyNum(noCarWayBill.getCompanyNum());
+        String companyNum = paramService.getParamsByParamName("REQUEST_COMPANY_NUM").getParamValue();
+        waybillStartRequest.setCompanyNum(companyNum);
         waybillStartRequest.setNum(noCarWayBill.getBillNum());
         waybillStartRequest.setPlateNum(noCarWayBill.getPlateNum());
         waybillStartRequest.setPlateColor(Integer.parseInt(noCarWayBill.getPlateColor()));
@@ -364,7 +369,8 @@ public class NoCarServiceImpl implements NoCarService{
             return new RespR(false,"当前运单状态无法结束");
         }
         WaybillEndRequest waybillEndRequest = new WaybillEndRequest();
-        waybillEndRequest.setCompanyNum(noCarWayBill1.getCompanyNum());
+        String companyNum = paramService.getParamsByParamName("REQUEST_COMPANY_NUM").getParamValue();
+        waybillEndRequest.setCompanyNum(companyNum);
         waybillEndRequest.setNum(noCarWayBill1.getBillNum());
         waybillEndRequest.setRealDestAddr(noCarWayBill1.getDestAddr());
         waybillEndRequest.setEndTime(noCarWayBill1.getPredictEndTime());
@@ -414,7 +420,8 @@ public class NoCarServiceImpl implements NoCarService{
         }*/
         //进行取票操作
         WaybillNumFindInvoiceRequest waybillNumFindInvoiceRequest = new WaybillNumFindInvoiceRequest();
-        waybillNumFindInvoiceRequest.setCompanyNum(noCarWayBillDb.getCompanyNum());
+        String companyNum = paramService.getParamsByParamName("REQUEST_COMPANY_NUM").getParamValue();
+        waybillNumFindInvoiceRequest.setCompanyNum(companyNum);
         waybillNumFindInvoiceRequest.setWaybillNum(noCarWayBillDb.getBillNum());
         RespR<WaybillNumFindInvoiceResponse> responseRespR = noCarInterface.waybillNumFindInvoice(waybillNumFindInvoiceRequest);
         if(responseRespR.getCode() == 1){
@@ -486,7 +493,8 @@ public class NoCarServiceImpl implements NoCarService{
     @Override
     public RespR hCInvoiceQuery(HCInvoiceQueryVo hcInvoiceQueryVo) {
         WaybillInvoiceRedQueryRequest redQueryRequest = new WaybillInvoiceRedQueryRequest();
-        redQueryRequest.setCompanyNum(hcInvoiceQueryVo.getCompanyNum());
+        String companyNum = paramService.getParamsByParamName("REQUEST_COMPANY_NUM").getParamValue();
+        redQueryRequest.setCompanyNum(companyNum);
         redQueryRequest.setMonth(hcInvoiceQueryVo.getMonth());
         RespR<WaybillInvoiceRedQueryResponse> respR = noCarInterface.waybillInvoiceRedQuery(redQueryRequest);
         if(respR.getCode() == 1){
@@ -509,7 +517,8 @@ public class NoCarServiceImpl implements NoCarService{
             return new RespR(false,"客户未备案或备案失败");
         }
         WaybillCountQueryRequest waybillCountQueryRequest = new WaybillCountQueryRequest();
-        waybillCountQueryRequest.setCompanyNum(customerRec.getCompanyNum());
+        String companyNum = paramService.getParamsByParamName("REQUEST_COMPANY_NUM").getParamValue();
+        waybillCountQueryRequest.setCompanyNum(companyNum);
         waybillCountQueryRequest.setTaxCode(monthAccountQueryVo.getTaxCode());
         waybillCountQueryRequest.setTradeMonth(monthAccountQueryVo.getTradeMonth());
         waybillCountQueryRequest.setWaybillSource(monthAccountQueryVo.getWaybillSource());

BIN
src/main/resources/static/templates/excel/历史运单模板.xlsx


BIN
src/main/resources/static/templates/excel/运单模板.xlsx