Browse Source

后端代码提交

mashengyi 3 years ago
parent
commit
212cad577d
54 changed files with 1256 additions and 654 deletions
  1. 7 237
      src/main/java/com/jkcredit/invoice/common/CommonConstants.java
  2. 103 4
      src/main/java/com/jkcredit/invoice/controller/localBussiness/CustomerController.java
  3. 19 2
      src/main/java/com/jkcredit/invoice/controller/localBussiness/NoCarController.java
  4. 6 32
      src/main/java/com/jkcredit/invoice/controller/service/CustomerLowerServiceController.java
  5. 37 0
      src/main/java/com/jkcredit/invoice/controller/service/NoCarServiceController.java
  6. 58 3
      src/main/java/com/jkcredit/invoice/controller/service/SelfCarServiceController.java
  7. 1 3
      src/main/java/com/jkcredit/invoice/mapper/Binvoce/SelfCarInvoiceMapper.java
  8. 0 19
      src/main/java/com/jkcredit/invoice/mapper/CustomerRechargeMapper.java
  9. 6 0
      src/main/java/com/jkcredit/invoice/mapper/customer/CustomerCarRecMapper.java
  10. 7 2
      src/main/java/com/jkcredit/invoice/mapper/customer/CustomerRecMapper.java
  11. 28 0
      src/main/java/com/jkcredit/invoice/mapper/customer/CustomerRechargeMapper.java
  12. 2 0
      src/main/java/com/jkcredit/invoice/mapper/waybill/NoCarWaybillMapper.java
  13. 3 3
      src/main/java/com/jkcredit/invoice/model/entity/Calculate/NoCarCalculateInfor.java
  14. 9 0
      src/main/java/com/jkcredit/invoice/model/entity/Calculate/SelfCarCalculateInfor.java
  15. 2 5
      src/main/java/com/jkcredit/invoice/model/entity/customer/Customer.java
  16. 11 1
      src/main/java/com/jkcredit/invoice/model/entity/customer/CustomerCarRec.java
  17. 2 2
      src/main/java/com/jkcredit/invoice/model/entity/customer/CustomerRec.java
  18. 9 1
      src/main/java/com/jkcredit/invoice/model/entity/invoice/BillInvoice.java
  19. 4 3
      src/main/java/com/jkcredit/invoice/model/entity/invoice/SelfCarAppl.java
  20. 3 3
      src/main/java/com/jkcredit/invoice/model/entity/invoice/SelfCarInvoice.java
  21. 1 1
      src/main/java/com/jkcredit/invoice/model/entity/waybill/NoCarWayBill.java
  22. 3 3
      src/main/java/com/jkcredit/invoice/model/entity/waybill/SelfCarTrade.java
  23. 15 0
      src/main/java/com/jkcredit/invoice/service/customer/CustomerRecService.java
  24. 16 0
      src/main/java/com/jkcredit/invoice/service/customer/CustomerRechargeService.java
  25. 21 0
      src/main/java/com/jkcredit/invoice/service/customer/CustomerService.java
  26. 20 0
      src/main/java/com/jkcredit/invoice/service/customer/impl/CustomerRecServiceImpl.java
  27. 20 0
      src/main/java/com/jkcredit/invoice/service/customer/impl/CustomerRechargeServiceImpl.java
  28. 23 4
      src/main/java/com/jkcredit/invoice/service/customer/impl/CustomerServiceImpl.java
  29. 2 21
      src/main/java/com/jkcredit/invoice/service/lowerService/CustomeLowerService.java
  30. 25 0
      src/main/java/com/jkcredit/invoice/service/lowerService/NoCarService.java
  31. 31 4
      src/main/java/com/jkcredit/invoice/service/lowerService/SelfCarServiceL.java
  32. 3 185
      src/main/java/com/jkcredit/invoice/service/lowerService/impl/CustomerLowerServiceImpl.java
  33. 123 17
      src/main/java/com/jkcredit/invoice/service/lowerService/impl/NoCarServiceImpl.java
  34. 245 39
      src/main/java/com/jkcredit/invoice/service/lowerService/impl/SelfCarServiceLImpl.java
  35. 55 0
      src/main/java/com/jkcredit/invoice/service/lowerService/vo/ApplQueryInvVo.java
  36. 34 0
      src/main/java/com/jkcredit/invoice/service/lowerService/vo/CarVo.java
  37. 61 0
      src/main/java/com/jkcredit/invoice/service/lowerService/vo/EtcBindVo.java
  38. 39 0
      src/main/java/com/jkcredit/invoice/service/lowerService/vo/EtcQueryVo.java
  39. 58 0
      src/main/java/com/jkcredit/invoice/service/lowerService/vo/EtcValidVo.java
  40. 8 0
      src/main/java/com/jkcredit/invoice/service/nocar/NoCarBillWayService.java
  41. 5 0
      src/main/java/com/jkcredit/invoice/service/nocar/impl/NoCarBillWayServiceImpl.java
  42. 3 2
      src/main/java/com/jkcredit/invoice/service/selfCar/impl/SelfCarServiceImpl.java
  43. 2 2
      src/main/java/com/jkcredit/invoice/task/ScheduledBillTask.java
  44. 3 3
      src/main/java/com/jkcredit/invoice/util/DateUtil.java
  45. 3 3
      src/main/java/com/jkcredit/invoice/util/DownExcelTemplateUtil.java
  46. 2 2
      src/main/java/com/jkcredit/invoice/util/ReadExcelUtil.java
  47. 1 1
      src/main/resources/mapper/calculateInfor/NoCarCalculateInforMapper.xml
  48. 66 5
      src/main/resources/mapper/customer/CustomerCarRecMapper.xml
  49. 6 0
      src/main/resources/mapper/customer/CustomerRecMapper.xml
  50. 6 1
      src/main/resources/mapper/CustomerRechargeMapper.xml
  51. 4 4
      src/main/resources/mapper/invoice/BillInvoiceMapper.xml
  52. 4 31
      src/main/resources/mapper/invoice/SelfCarInvoiceMapper.xml
  53. 30 5
      src/main/resources/mapper/waybill/NoCarWaybillMapper.xml
  54. 1 1
      src/main/resources/sdk.properties

+ 7 - 237
src/main/java/com/jkcredit/invoice/common/CommonConstants.java

@@ -10,247 +10,17 @@ public interface CommonConstants {
 
     String TOKEN_KEY = "user:token:";
 
-    String B2B_CHARGE_KEY = "b2b:charge:";
+    String BUSSINESS_TYPE_SELFCAR = "0";
 
-    /**
-     * 发票信息key
-     */
-    String NUM_FIND_INVOICE_KEY = "num:find:invoice";
+    String BUSSINESS_TYPE_NOCAR = "2";
 
-    /**
-     * 发票交易id key
-     */
-    String TRANSACTION_ID_KEY = "num:transactionId:invoice";
+    /***********备案状态*********/
+    Integer REC_STATUS_FAIL = 0;
 
-    /**
-     * 成功
-     */
-    Integer SUCCESS = 1;
+    Integer REC_STATUS_SUC = 1;
 
-    /**
-     * 失败
-     */
-    Integer ERROR = 2;
+    Integer REC_STATUS_UN = 2;
+    Integer REC_STATUS_WAIT = 3;
 
-    /**
-     * 自动开票
-     */
-    Integer AUTO_INVOICE = 1;
 
-    /**
-     * 不自动开票
-     */
-    Integer NOT_AUTO_INVOICE = 2;
-
-    /**
-     * 已备案
-     */
-    Integer ALREADY_REGISTER = 3;
-
-    /**
-     * 查询结果为空
-     */
-    Integer NULL = 3;
-
-    /**
-     * 未完结
-     */
-    Integer UNFINISHED = 1;
-
-    /**
-     * 完结
-     */
-    Integer FINISHED = 2;
-
-    /**
-     * 开票中
-     */
-    Integer INVOICE_PROCESS = 4;
-
-    /**
-     * 开票完成
-     */
-    Integer INVOICE_FINISHED = 3;
-
-    /**
-     * 运单错误
-     */
-    Integer BILL_ERROR = 9;
-
-    /**
-     * 车辆备案
-     */
-    Integer VEHICLE_REGISTER = 1;
-
-    /**
-     * 运单开始
-     */
-    Integer WAY_BILL_START = 2;
-
-    /**
-     * 运单开始
-     */
-    Integer WAY_BILL_END = 5;
-
-    /**
-     * 历史运单开始
-     */
-    Integer WAY_BILL_HISTORY_START = 3;
-
-    /**
-     * 发票查询
-     */
-    Integer WAY_BILL_NUM_FIND_INVOICE = 4;
-
-    /**
-     * 模板路径
-     */
-//    String BASE_PATH = "/Users/Administrator/Desktop/excel";
-    String BASE_PATH = "/home/invoiceSrv/app/bin";
-
-    /**
-     * 打包发票下载路径
-     */
-    String PACKAGE_BASE_PATH = "/home/invoiceSrv/app/bin/package";
-
-    /**
-     * 模板路径
-     */
-    String TEMPLATE_PATH = "/classes/static/templates/excel/";
-
-    /**
-     * 备案API
-     */
-    String VEHICLE_REGISTER_API = "VEHICLE_REGISTER";
-
-    /**
-     * 运单开始API
-     */
-    String WAY_BILL_START_API = "WAY_BILL_START";
-
-    /**
-     * 运单结束API
-     */
-    String WAY_BILL_END_API = "WAY_BILL_END";
-
-    /**
-     * 历史运单开始API
-     */
-    String WAY_BILL_HISTORY_START_API = "WAY_BILL_HISTORY_START";
-
-    /**
-     * 历史运单结束API
-     */
-    String WAY_BILL_HISTORY_END_API = "WAY_BILL_HISTORY_END";
-
-    /**
-     * 运单号查询运单API
-     */
-    String WAY_BILL_NUM_FIND_INVOICE_API = "WAY_BILL_NUM_FIND_INVOICE";
-
-    /**
-     * 企业查询api
-     */
-    String COMPANY_QUERY_V1_API = "COMPANY_QUERY_V1";
-
-    /**
-     * 企业新增api
-     */
-    String COMPANY_ADD_V1_API = "COMPANY_ADD_V1";
-
-    /**
-     * 用户卡查询api
-     */
-    String CARD_QUERY_CARD_V1_API = "CARD_QUERY_CARD_V1";
-
-    /**
-     * 卡绑定接口api
-     */
-    String CARD_BINDING_V1_API = "CARD_BINDING_V1";
-
-    /**
-     * 卡验证码接口api
-     */
-    String CARD_VALID_CODE_V1_API = "CARD_VALID_CODE_V1";
-
-    /**
-     * 申请开票api
-     */
-    String B2B_INVOICE_APPLY_V1_API = "B2B_INVOICE_APPLY_V1";
-
-    /**
-     * 交易查询接口api
-     */
-    String CARD_TRADE_V1_API = "CARD_TRADE_V1";
-
-    /**
-     * 已开票接口api
-     */
-    String B2B_INVOICE_QUERY_V1_API = "B2B_INVOICE_QUERY_V1";
-
-    /**
-     * 发票打包接口api
-     */
-    String B2B_INVOICE_PACKAGE_V1_API = "B2B_INVOICE_PACKAGE_V1";
-
-    /**
-     * 历史运单开始运单号key
-     */
-    String HISTORY_NUM_KEY_START = "waybill:history:num:start:";
-
-    /**
-     * 历史运单结束运单号key
-     */
-    String HISTORY_NUM_KEY_END = "waybill:history:num:end:";
-
-    /**
-     * 运单结束运单号key
-     */
-    String NUM_KEY_END = "waybill:num:end:";
-
-    /**
-     * 运单开始运单号key
-     */
-    String NUM_KEY = "waybill:num:start:";
-
-    /**
-     * 运单预估结果key
-     */
-    String BILL_ESTIMATE_KEY = "bill:estimate:";
-
-    /**
-     * 计费队列
-     */
-    String CHARGE_QUEUE = "charge_queue";
-
-    /**
-     * b2b计费队列
-     */
-    String B2B_CHARGE_QUEUE = "b2b_charge_queue";
-
-    /**
-     * 计费交换机
-     */
-    String CHARGE_EXCHANGE = "charge_exchange";
-
-    /**
-     * b2b计费交换机
-     */
-    String B2B_CHARGE_EXCHANGE = "b2b_charge_exchange";
-
-
-    /**
-     * 待开票
-     */
-    Integer NO_TRADE_STATUS = 1;
-
-    /**
-     * 开票中
-     */
-    Integer IN_TRADE_STATUS = 2;
-
-    /**
-     * 开票完成
-     */
-    Integer FINISH_TRADE_STATUS = 2;
 }

+ 103 - 4
src/main/java/com/jkcredit/invoice/controller/localBussiness/CustomerController.java

@@ -5,15 +5,23 @@ import com.jkcredit.invoice.annotation.LoginRequired;
 import com.jkcredit.invoice.model.entity.customer.Customer;
 import com.jkcredit.invoice.model.entity.CustomerRecharge;
 import com.jkcredit.invoice.model.entity.customer.CustomerRec;
+import com.jkcredit.invoice.service.customer.CustomerRecService;
+import com.jkcredit.invoice.service.customer.CustomerRechargeService;
 import com.jkcredit.invoice.service.customer.CustomerService;
+import com.jkcredit.invoice.service.lowerService.CustomeLowerService;
 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.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.List;
 
 /**
  * 客户操作
@@ -24,6 +32,14 @@ import org.springframework.web.bind.annotation.RestController;
 public class CustomerController {
     @Autowired
     CustomerService customerService;
+    @Autowired
+    CustomerRechargeService customerRechargeService;
+
+    @Autowired
+    CustomeLowerService lowerService;
+
+    @Autowired
+    CustomerRecService customerRecService;
     /**
      * 分页查询客户
      *
@@ -37,6 +53,34 @@ public class CustomerController {
 
         return new RespR(customerService.findAllCustomers(page, customer));
     }
+
+    /**
+     * 分页查询客户
+     *
+     * @param page    参数集
+     * @return 用户集合
+     */
+    @PostMapping("/findCustomerRecharge")
+    @ApiOperation(value="分页查询客户充值信息", notes="分页查询客户充值信息")
+    @LoginRequired
+    public RespR findCustomerRecharge(Page page, CustomerRecharge customerRecharge) {
+
+        return new RespR(customerRechargeService.findAllCustomerRecharge(page, customerRecharge));
+    }
+
+    /**
+     * 分页查询客户注册信息
+     *
+     * @param page    参数集
+     * @return 用户集合
+     */
+    @PostMapping("/findCustomerRecList")
+    @ApiOperation(value="分页查询客户注册信息", notes="分页查询客户注册信息")
+    @LoginRequired
+    public RespR findCustomerRecList(Page page, CustomerRec customerRec) {
+
+        return new RespR(customerRecService.findAllCustomerRec(page, customerRec));
+    }
     /**
      * 添加客户
      * @return 用户集合
@@ -59,6 +103,30 @@ public class CustomerController {
         return new RespR(customerService.updateCustomer(customer));
     }
     /**
+     * 修改客户状态
+     * @return 用户集合
+     */
+    @PostMapping("/customeRecStop")
+    @ApiOperation(value="停用备案用户", notes="停用备案用户")
+    @LoginRequired
+    public RespR customeRecStop(@RequestBody  CustomerRec customerRec) {
+        customerRec.setRecStatus(4);
+        return customerService.updateCustomerRecStatus(customerRec);
+    }
+    /**
+     * 修改客户状态
+     * @return 用户集合customerRecAdd
+     */
+    @PostMapping("/customerRecAdd")
+    @ApiOperation(value="手工添加备案信息", notes="手工添加备案信息")
+    @LoginRequired
+    public RespR customerRecAdd(@RequestBody  CustomerRec customerRec) {
+        customerRec.setInterType(3);
+        List<CustomerRec> customerRecList = new ArrayList<>();
+        customerRecList.add(customerRec);
+        return lowerService.customeRec(customerRecList);
+    }
+    /**
      * 充值
      * @return 用户集合
      */
@@ -77,5 +145,36 @@ public class CustomerController {
         return customerService.customeRec(customerRec);
     }
 
+    @PostMapping("/contractAdd")
+    @ApiOperation(value="协议上传确认", notes="协议上传确认")
+    @LoginRequired
+    public RespR contractAdd(@RequestBody CustomerRec customerRec){
+        return customerService.contractAdd(customerRec);
+    }
+    @GetMapping("/contractDownload")
+    @ApiOperation(value="协议下载", notes="协议下载")
+    public RespR contractDownload(String customerRecId,HttpServletResponse response){
+        CustomerRec customerRec = (CustomerRec) customerService.contractDownload(customerRecId).getData();
+        String fileName = customerRec.getContractFileName();
+        if(customerRec.getBase64Str()!=null){
+            byte [] byteArray = Base64.getDecoder().decode(customerRec.getBase64Str());
+            InputStream inputStream = new ByteArrayInputStream(byteArray);
+
+            OutputStream outputStream = null;
+            try {
+                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);
+    }
 }

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

@@ -70,7 +70,24 @@ public class NoCarController {
             return new RespR(false,e.getMessage());
         }
     }
-
+    /**
+     * 分页查询异常运单信息
+     *
+     * @param page    参数集
+     * @return 用户集合
+     */
+    @PostMapping("/findBillWayException")
+    @ApiOperation(value="分页查询异常运单信息", notes="分页查询异常运单信息")
+    @LoginRequired
+    public RespR findBillWayException(Page page, NoCarWayBill noCarWayBill) {
+        try {
+            RespR respR = new RespR(noCarBillWayService.findByPageAndWayBillException(page, noCarWayBill));
+            return respR;
+        }catch (Exception e){
+            e.printStackTrace();
+            return new RespR(false,e.getMessage());
+        }
+    }
     /**
      * 分页查询无车运单信息
      *
@@ -78,7 +95,7 @@ public class NoCarController {
      * @return 用户集合
      */
     @PostMapping("/findNocarInvoices")
-    @ApiOperation(value="分页查询无车运单信息", notes="分页查询无车运单信息")
+    @ApiOperation(value="分页查询无车发票信息", notes="分页查询无车发票信息")
     @LoginRequired
     public RespR findNocarInvoices(Page page, BillInvoice billInvoice) {
         try {

+ 6 - 32
src/main/java/com/jkcredit/invoice/controller/service/CustomerLowerServiceController.java

@@ -5,6 +5,8 @@ import com.jkcredit.invoice.model.entity.customer.CustomerRec;
 import com.jkcredit.invoice.service.customer.CustomerService;
 import com.jkcredit.invoice.service.customer.impl.CustomerServiceImpl;
 import com.jkcredit.invoice.service.lowerService.CustomeLowerService;
+import com.jkcredit.invoice.service.lowerService.vo.EtcBindVo;
+import com.jkcredit.invoice.service.lowerService.vo.EtcValidVo;
 import com.jkcredit.invoice.service.upService.CommInterFace;
 import com.jkcredit.invoice.util.RespR;
 import io.swagger.annotations.Api;
@@ -56,7 +58,7 @@ public class CustomerLowerServiceController {
     @PostMapping("/customeRecQueryUpper")
     @ApiOperation(value="企业备案信息上游查询", notes="企业备案上游查询")
     //@LoginRequired
-    public RespR customeRecQuery(@RequestBody CustomerRec customerRec){
+    public RespR customeRecQueryUpper(@RequestBody CustomerRec customerRec){
         return customerService.customerRecQuery(customerRec);
     }
     /**
@@ -66,38 +68,10 @@ public class CustomerLowerServiceController {
     @PostMapping("/customeRecQuery")
     @ApiOperation(value="用户备案信息查询", notes="用户备案信息查询")
     //@LoginRequired
-    public RespR customeRecQueryListUpper(@RequestBody CustomerRec customerRec){
+    public RespR customeRecQuery(@RequestBody CustomerRec customerRec){
         return lowerService.customeRecQuery(customerRec);
     }
-    /**
-     * @param customerCarRecs
-     * @return
-     */
-    @PostMapping("/customerCarRec")
-    @ApiOperation(value="", notes="车辆备案")
-    //@LoginRequired
-    public RespR customerCarRec(@RequestBody List<CustomerCarRec> customerCarRecs){
-        return lowerService.customerCarRec(customerCarRecs);
-    }
-    /**
-     * @param customerCarRecs
-     * @return
-     */
-    @PostMapping("/customerCarUnRec")
-    @ApiOperation(value="", notes="etc解绑")
-    //@LoginRequired
-    public RespR customerCarUnRec(@RequestBody List<CustomerCarRec> customerCarRecs){
-        return lowerService.customerCarRec(customerCarRecs);
-    }
-    /**
-     * @param customerCarRec
-     * @return
-     */
-    @PostMapping("/customerCarRecQuery")
-    @ApiOperation(value="", notes="车辆备案查询")
-   // @LoginRequired
-    public RespR customerCarRecQuery(@RequestBody CustomerCarRec customerCarRec){
-        return lowerService.customerCarRecQuery(customerCarRec);
-    }
+
+
 
 }

+ 37 - 0
src/main/java/com/jkcredit/invoice/controller/service/NoCarServiceController.java

@@ -1,7 +1,9 @@
 package com.jkcredit.invoice.controller.service;
 
+import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
 import com.jkcredit.invoice.model.entity.customer.CustomerRec;
 import com.jkcredit.invoice.model.entity.waybill.NoCarWayBill;
+import com.jkcredit.invoice.service.lowerService.CustomeLowerService;
 import com.jkcredit.invoice.service.lowerService.NoCarService;
 import com.jkcredit.invoice.service.lowerService.vo.HCInvoiceQueryVo;
 import com.jkcredit.invoice.service.lowerService.vo.MonthAccountQueryVo;
@@ -22,6 +24,7 @@ import java.util.List;
 public class NoCarServiceController {
     @Autowired
     private NoCarService noCarService;
+
     /**
      * @param noCarWayBill
      * @return
@@ -95,4 +98,38 @@ public class NoCarServiceController {
     public RespR monthAccQuery(@RequestBody MonthAccountQueryVo monthAccountQueryVo){
         return noCarService.monthAccQuery(monthAccountQueryVo);
     }
+
+    /**
+     * @param customerCarRecs
+     * @return
+     */
+    @PostMapping("/customerCarRec")
+    @ApiOperation(value="", notes="车辆备案")
+    //@LoginRequired
+    public RespR customerCarRec(@RequestBody List<CustomerCarRec> customerCarRecs){
+        return noCarService.customerCarRec(customerCarRecs);
+    }
+    /**
+     * @param customerCarRec
+     * @return
+     */
+    @PostMapping("/customeRecUpperQuery")
+    @ApiOperation(value="车辆备案信息查询", notes="用户备案信息查询")
+    //@LoginRequired
+    public RespR customeRecUpperQuery(@RequestBody CustomerCarRec customerCarRec){
+        return noCarService.customerCarRecQueryUpper(customerCarRec);
+    }
+
+
+
+    /**
+     * @param customerCarRec
+     * @return
+     */
+    @PostMapping("/customerCarRecQuery")
+    @ApiOperation(value="", notes="车辆备案查询")
+    // @LoginRequired
+    public RespR customerCarRecQuery(@RequestBody CustomerCarRec customerCarRec){
+        return noCarService.customerCarRecQuery(customerCarRec);
+    }
 }

+ 58 - 3
src/main/java/com/jkcredit/invoice/controller/service/SelfCarServiceController.java

@@ -1,9 +1,8 @@
 package com.jkcredit.invoice.controller.service;
 
+import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
 import com.jkcredit.invoice.service.lowerService.SelfCarServiceL;
-import com.jkcredit.invoice.service.lowerService.vo.InvoiceApplVo;
-import com.jkcredit.invoice.service.lowerService.vo.SelfCarDueQueryVo;
-import com.jkcredit.invoice.service.lowerService.vo.TradeRequestVo;
+import com.jkcredit.invoice.service.lowerService.vo.*;
 import com.jkcredit.invoice.util.RespR;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -13,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 @Api(tags = "自有车下游接口")
 @RestController
 @RequestMapping(value = {"/selfCarService"})
@@ -51,4 +52,58 @@ public class SelfCarServiceController {
     public RespR getSelfCarInvoicesByTime(@RequestBody SelfCarDueQueryVo selfCarDueQueryVo){
         return selfCarService.getSelfCarInvoicesByTime(selfCarDueQueryVo);
     }
+
+    /**
+     * @param ApplQueryInvVo
+     * @return
+     */
+    @PostMapping("/getSelfCarInvoicesByAppl")
+    @ApiOperation(value="按申请id查询发票", notes="按申请id查询发票")
+    //@LoginRequired
+    public RespR getSelfCarInvoicesByAppl(@RequestBody ApplQueryInvVo ApplQueryInvVo){
+        return selfCarService.getSelfCarInvoicesByApplyIds(ApplQueryInvVo);
+    }
+    /**
+     * @param etcQueryVo
+     * @return
+     */
+    @PostMapping("/customerETCQuery")
+    @ApiOperation(value="", notes="ETC查询")
+    //@LoginRequired
+    public RespR customerETCQuery(@RequestBody EtcQueryVo etcQueryVo){
+        return selfCarService.getEtcInfo(etcQueryVo);
+    }
+    /**
+     * @param etcBindVo
+     * @return
+     */
+    @PostMapping("/customerETCRec")
+    @ApiOperation(value="", notes="ETC备案")
+    //@LoginRequired
+    public RespR customerETCRec(@RequestBody EtcBindVo etcBindVo){
+        return selfCarService.customerEtcRec(etcBindVo);
+    }
+
+
+    /**
+     * @param etcValidVo
+     * @return
+     */
+    @PostMapping("/customerETCRecValid")
+    @ApiOperation(value="", notes="ETC备案验证")
+    //@LoginRequired
+    public RespR customerETCRecValid(@RequestBody EtcValidVo etcValidVo){
+        return selfCarService.customerEtcRecValid(etcValidVo);
+    }
+
+    /**
+     * @param customerCarRecs
+     * @return
+     */
+    @PostMapping("/customerCarUnRec")
+    @ApiOperation(value="", notes="etc解绑")
+    //@LoginRequired
+    public RespR customerCarUnRec(@RequestBody List<CustomerCarRec> customerCarRecs){
+        return selfCarService.customerCarUnRec(customerCarRecs);
+    }
 }

+ 1 - 3
src/main/java/com/jkcredit/invoice/mapper/Binvoce/SelfCarInvoiceMapper.java

@@ -16,9 +16,7 @@ public interface SelfCarInvoiceMapper extends BaseMapper<SelfCarInvoice> {
 
     int updateByPrimaryKey(SelfCarInvoice record);
 
-    int updateByInvoiceNum(SelfCarInvoice record);
-
     List<SelfCarInvoice> selectByTrade(String tradeId);
 
-    SelfCarInvoice selectByInvoiceNum(String wayBillNum);
+    List<SelfCarInvoice> selectByTradeAndInvoiceMakeTime(SelfCarInvoice record);
 }

+ 0 - 19
src/main/java/com/jkcredit/invoice/mapper/CustomerRechargeMapper.java

@@ -1,19 +0,0 @@
-package com.jkcredit.invoice.mapper;
-
-import com.jkcredit.invoice.model.entity.CustomerRecharge;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface CustomerRechargeMapper {
-    int deleteByPrimaryKey(Integer id);
-
-    int insert(CustomerRecharge record);
-
-    int insertSelective(CustomerRecharge record);
-
-    CustomerRecharge selectByPrimaryKey(Integer id);
-
-    int updateByPrimaryKeySelective(CustomerRecharge record);
-
-    int updateByPrimaryKey(CustomerRecharge record);
-}

+ 6 - 0
src/main/java/com/jkcredit/invoice/mapper/customer/CustomerCarRecMapper.java

@@ -25,5 +25,11 @@ public interface CustomerCarRecMapper extends BaseMapper<CustomerCarRec> {
 
     int updateByPrimaryKey(CustomerCarRec record);
 
+    int updateETCByPrimaryKeySelective(CustomerCarRec record);
+
+    int updateETCByPrimaryKey(CustomerCarRec record);
+
+    int updateWaitETCStatus(CustomerCarRec record);
+
     IPage<List<CustomerCarRec>> selectAllByPage(Page page, @Param("query") CustomerCarRec customerCarRec);
 }

+ 7 - 2
src/main/java/com/jkcredit/invoice/mapper/customer/CustomerRecMapper.java

@@ -1,12 +1,16 @@
 package com.jkcredit.invoice.mapper.customer;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jkcredit.invoice.model.entity.customer.CustomerRec;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
 
 @Repository
-public interface CustomerRecMapper {
+public interface CustomerRecMapper extends BaseMapper<CustomerRec> {
     int deleteByPrimaryKey(Integer id);
 
     int insert(CustomerRec record);
@@ -14,7 +18,7 @@ public interface CustomerRecMapper {
     int insertSelective(CustomerRec record);
 
     CustomerRec selectByPrimaryKey(Integer id);
-
+    CustomerRec selectByPrimaryKeyHasBase64(Integer id);
     List<CustomerRec> selectByCustomerName(String customerName);
 
     CustomerRec selectByCustomerNameAndCompany(CustomerRec record);
@@ -23,4 +27,5 @@ public interface CustomerRecMapper {
     int updateByPrimaryKeySelective(CustomerRec record);
 
     int updateByPrimaryKey(CustomerRec record);
+    IPage<List<CustomerRec>> selectAllByPage(Page page, @Param("customerRec") CustomerRec customerRec);
 }

+ 28 - 0
src/main/java/com/jkcredit/invoice/mapper/customer/CustomerRechargeMapper.java

@@ -0,0 +1,28 @@
+package com.jkcredit.invoice.mapper.customer;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jkcredit.invoice.model.entity.CustomerRecharge;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface CustomerRechargeMapper extends BaseMapper<CustomerRecharge> {
+
+    IPage<List<CustomerRecharge>> selectAllByPage(Page page, @Param("customerRecharge") CustomerRecharge customer);
+
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(CustomerRecharge record);
+
+    int insertSelective(CustomerRecharge record);
+
+    CustomerRecharge selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(CustomerRecharge record);
+
+    int updateByPrimaryKey(CustomerRecharge record);
+}

+ 2 - 0
src/main/java/com/jkcredit/invoice/mapper/waybill/NoCarWaybillMapper.java

@@ -14,6 +14,8 @@ public interface NoCarWaybillMapper extends BaseMapper<NoCarWayBill>{
 
     IPage<List<NoCarWayBill>> selectAllByPage(Page page, @Param("noCarWayBill") NoCarWayBill noCarWayBill);
 
+    IPage<List<NoCarWayBill>> selectAllByPageException(Page page, @Param("noCarWayBill") NoCarWayBill noCarWayBill);
+
     int insert(NoCarWayBill record);
 
     int updateByPrimaryKey(NoCarWayBill record);

+ 3 - 3
src/main/java/com/jkcredit/invoice/model/entity/Calculate/NoCarCalculateInfor.java

@@ -7,7 +7,7 @@ public class NoCarCalculateInfor {
     /**
      * 计费id号
      */
-    private Integer Id;
+    private Long Id;
     /**
      *  交易Id
      */
@@ -37,11 +37,11 @@ public class NoCarCalculateInfor {
      */
     private Integer ctype;
 
-    public Integer getId() {
+    public Long getId() {
         return Id;
     }
 
-    public void setId(Integer id) {
+    public void setId(Long id) {
         Id = id;
     }
 

+ 9 - 0
src/main/java/com/jkcredit/invoice/model/entity/Calculate/SelfCarCalculateInfor.java

@@ -4,6 +4,7 @@ package com.jkcredit.invoice.model.entity.Calculate;
  * 自有车计费
  */
 public class SelfCarCalculateInfor {
+    private Long id;
     /**
      * 客户号
      */
@@ -27,6 +28,14 @@ public class SelfCarCalculateInfor {
      */
     private String calTime;
 
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
     public String getCustomId() {
         return customId;
     }

+ 2 - 5
src/main/java/com/jkcredit/invoice/model/entity/customer/Customer.java

@@ -1,13 +1,10 @@
 package com.jkcredit.invoice.model.entity.customer;
-
-import java.util.Date;
-
 public class Customer {
     private int id;
     /**
      * etc收费费用
      */
-    private long fee;
+    private long fee =5000;//todo 先写死
     private String customerName;
 
     private String invoiceTime;
@@ -22,7 +19,7 @@ public class Customer {
 
     private Integer bussinessType;
 
-    private Integer integrationType;
+    private Integer integrationType=0;
 
     private String firstSign;
     //0 -正常 1-停用

+ 11 - 1
src/main/java/com/jkcredit/invoice/model/entity/customer/CustomerCarRec.java

@@ -3,6 +3,8 @@ public class CustomerCarRec {
     private String customerName;
 
     private String companyName;
+
+    private String companyNum;
     //0 -自有车 1 -外协车 2 -无车
     private String businessType;
 
@@ -20,7 +22,7 @@ public class CustomerCarRec {
     /**
      * 0-备案失败 1-备案成功 2-解绑
      */
-    private Integer recStatus;
+    private Integer recStatus = 0;
 
     private String failReason;
 
@@ -42,6 +44,14 @@ public class CustomerCarRec {
         this.companyName = companyName == null ? null : companyName.trim();
     }
 
+    public String getCompanyNum() {
+        return companyNum;
+    }
+
+    public void setCompanyNum(String companyNum) {
+        this.companyNum = companyNum;
+    }
+
     public String getCarNum() {
         return carNum;
     }

+ 2 - 2
src/main/java/com/jkcredit/invoice/model/entity/customer/CustomerRec.java

@@ -74,11 +74,11 @@ public class CustomerRec {
 
     private String companyBelongName;
     /**
-     * 2-失败 1-成功
+     * 2-失败 1-成功 3-等待协议上传 4-停用 0-备案中
      */
     private Integer recStatus;
 
-    private Integer interType; //0-接口 1-平台
+    private Integer interType; //0-接口 1-平台 3.手工录入
 
     /**
      * 业务类型 0 -自有车 1-外协车 2-无车

+ 9 - 1
src/main/java/com/jkcredit/invoice/model/entity/invoice/BillInvoice.java

@@ -4,7 +4,7 @@ package com.jkcredit.invoice.model.entity.invoice;
  * 运单发票
  */
 public class BillInvoice {
-    private Integer id;
+    private Long id;
     /**
      * 发票号码
      */
@@ -322,4 +322,12 @@ public class BillInvoice {
     public void setBuyerTaxpayerCode(String buyerTaxpayerCode) {
         this.buyerTaxpayerCode = buyerTaxpayerCode;
     }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
 }

+ 4 - 3
src/main/java/com/jkcredit/invoice/model/entity/invoice/SelfCarAppl.java

@@ -4,7 +4,7 @@ package com.jkcredit.invoice.model.entity.invoice;
  * 自有车申请记录
  */
 public class SelfCarAppl {
-    private Integer id;
+    private Long id;
     /**
      * 客户号
      */
@@ -48,11 +48,12 @@ public class SelfCarAppl {
      * @return
      */
     private Integer voiceFlag =0;
-    public Integer getId() {
+
+    public Long getId() {
         return id;
     }
 
-    public void setId(Integer id) {
+    public void setId(Long id) {
         this.id = id;
     }
 

+ 3 - 3
src/main/java/com/jkcredit/invoice/model/entity/invoice/SelfCarInvoice.java

@@ -4,7 +4,7 @@ package com.jkcredit.invoice.model.entity.invoice;
  * 自有车发票
  */
 public class SelfCarInvoice {
-    private Integer id;
+    private Long id;
     /**
      * etc卡号
      */
@@ -96,11 +96,11 @@ public class SelfCarInvoice {
      */
     private String buyerTaxpayerCode;
 
-    public Integer getId() {
+    public Long getId() {
         return id;
     }
 
-    public void setId(Integer id) {
+    public void setId(Long id) {
         this.id = id;
     }
 

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

@@ -78,7 +78,7 @@ public class NoCarWayBill {
     private String InterfaceEndTime;
 
     /**
-     * 运单转态 -2-运单超时 -1-指令开始 0-指令结束   1-开票中 2-作废 3-开票完成
+     * 运单转态  -1-指令开始 0-指令结束   1-开票中 2-作废 3-开票完成
      */
     private int billwayStatus;
 

+ 3 - 3
src/main/java/com/jkcredit/invoice/model/entity/waybill/SelfCarTrade.java

@@ -4,7 +4,7 @@ package com.jkcredit.invoice.model.entity.waybill;
  * 自有车交易
  */
 public class SelfCarTrade {
-    private Integer id;
+    private Long id;
     /**
      * 客户号
      */
@@ -54,11 +54,11 @@ public class SelfCarTrade {
      */
     private String aclTime;
 
-    public Integer getId() {
+    public Long getId() {
         return id;
     }
 
-    public void setId(Integer id) {
+    public void setId(Long id) {
         this.id = id;
     }
 

+ 15 - 0
src/main/java/com/jkcredit/invoice/service/customer/CustomerRecService.java

@@ -0,0 +1,15 @@
+package com.jkcredit.invoice.service.customer;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jkcredit.invoice.model.entity.customer.CustomerRec;
+
+public interface CustomerRecService {
+    /**
+     * 查找所有备案信息
+     * @param page
+     * @param customerRec
+     * @return
+     */
+    IPage findAllCustomerRec(Page page, CustomerRec customerRec);
+}

+ 16 - 0
src/main/java/com/jkcredit/invoice/service/customer/CustomerRechargeService.java

@@ -0,0 +1,16 @@
+package com.jkcredit.invoice.service.customer;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jkcredit.invoice.model.entity.CustomerRecharge;
+
+public interface CustomerRechargeService {
+    /**
+     * 查找所有充值信息
+     * @param page
+     * @param customerRecharge
+     * @return
+     */
+    IPage findAllCustomerRecharge(Page page, CustomerRecharge customerRecharge);
+
+}

+ 21 - 0
src/main/java/com/jkcredit/invoice/service/customer/CustomerService.java

@@ -42,6 +42,20 @@ public interface CustomerService extends IService<Customer>{
     Boolean customRecharge(CustomerRecharge customerRecharge);
 
     /**
+     * 协议上传
+     * @param customerRec
+     * @return
+     */
+    RespR  contractAdd(CustomerRec customerRec);
+
+    /**
+     * 协议下载
+     * @param id
+     * @return
+     */
+    RespR  contractDownload(String id);
+
+    /**
      * 用户备案
      * @param customerRec
      * @return
@@ -54,4 +68,11 @@ public interface CustomerService extends IService<Customer>{
      * @return
      */
     RespR customerRecQuery(CustomerRec customerRec);
+
+    /**
+     * 更新企业备案状态
+     * @param customerRec
+     * @return
+     */
+    RespR updateCustomerRecStatus(CustomerRec customerRec);
 }

+ 20 - 0
src/main/java/com/jkcredit/invoice/service/customer/impl/CustomerRecServiceImpl.java

@@ -0,0 +1,20 @@
+package com.jkcredit.invoice.service.customer.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jkcredit.invoice.mapper.customer.CustomerRecMapper;
+import com.jkcredit.invoice.model.entity.customer.CustomerRec;
+import com.jkcredit.invoice.service.customer.CustomerRecService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service("customerRecService")
+public class CustomerRecServiceImpl extends ServiceImpl<CustomerRecMapper,CustomerRec>   implements CustomerRecService{
+    @Autowired
+    CustomerRecMapper customerRecMapper;
+    @Override
+    public IPage findAllCustomerRec(Page page, CustomerRec customerRec) {
+        return customerRecMapper.selectAllByPage(page,customerRec);
+    }
+}

+ 20 - 0
src/main/java/com/jkcredit/invoice/service/customer/impl/CustomerRechargeServiceImpl.java

@@ -0,0 +1,20 @@
+package com.jkcredit.invoice.service.customer.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jkcredit.invoice.mapper.customer.CustomerRechargeMapper;
+import com.jkcredit.invoice.model.entity.CustomerRecharge;
+import com.jkcredit.invoice.service.customer.CustomerRechargeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service("customerRechargeService")
+public class CustomerRechargeServiceImpl extends ServiceImpl<CustomerRechargeMapper,CustomerRecharge> implements CustomerRechargeService{
+    @Autowired
+    CustomerRechargeMapper customerRechargeMapper;
+    @Override
+    public IPage findAllCustomerRecharge(Page page, CustomerRecharge customerRecharge) {
+        return customerRechargeMapper.selectAllByPage(page,customerRecharge);
+    }
+}

+ 23 - 4
src/main/java/com/jkcredit/invoice/service/customer/impl/CustomerServiceImpl.java

@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.jkcredit.invoice.mapper.customer.CustomerMapper;
-import com.jkcredit.invoice.mapper.CustomerRechargeMapper;
+import com.jkcredit.invoice.mapper.customer.CustomerRechargeMapper;
 import com.jkcredit.invoice.mapper.customer.CustomerRecMapper;
 import com.jkcredit.invoice.model.entity.customer.Customer;
 import com.jkcredit.invoice.model.entity.CustomerRecharge;
@@ -62,6 +62,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper,Customer> im
         return true;
     }
     public RespR contractAdd(CustomerRec customerRec){
+        customerRec = customerRecMapper.selectByCustomerNameAndCompanyConcat(customerRec);
         if(customerRec.getRecStatus().intValue() == 2){
             return new RespR(false,"无法上传协议,未注册");
         }
@@ -85,14 +86,21 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper,Customer> im
         }
 
     }
+
+    @Override
+    public RespR contractDownload(String id) {
+        CustomerRec customerRec = customerRecMapper.selectByPrimaryKeyHasBase64(Integer.valueOf(id));
+        return new RespR(customerRec);
+    }
+
     public RespR customeRec(CustomerRec customerRec){
         customerRec = customerRecMapper.selectByCustomerNameAndCompanyConcat(customerRec);
         if(customerRec.getRecStatus().intValue() == 1 && customerRec.getContractSuc() == 1){
             return new RespR(false,"已经注册过了");
         }
-        if(customerRec.getRecStatus().intValue() == 1){
+        /*if(customerRec.getRecStatus().intValue() == 1){
             return contractAdd(customerRec);
-        }
+        }*/
         CompanyAddRequest companyAddRequest = buildCompany(customerRec);
         //注册企业
         RespR<CompanyAddResponse> respR = commInterFace.addCompany(companyAddRequest);
@@ -108,7 +116,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper,Customer> im
         customerRec.setRecStatus(1);
         customerRec.setCompanyNum(companyNum);
         customerRecMapper.updateByPrimaryKeySelective(customerRec);
-        contractAdd(customerRec);
+        //contractAdd(customerRec);
         return new RespR(true);
     };
 
@@ -144,4 +152,15 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper,Customer> im
             return new RespR(responseRespR.getData().getItems());
         }
     }
+
+    @Override
+    public RespR updateCustomerRecStatus(CustomerRec customerRec) {
+        CustomerRec customerRec1 = customerRecMapper.selectByCustomerNameAndCompany(customerRec);
+        customerRec1.setRecStatus(customerRec.getRecStatus());
+        int i = customerRecMapper.updateByPrimaryKey(customerRec1);
+        if(i<=0){
+            return new RespR(false);
+        }
+        return new RespR(true);
+    }
 }

+ 2 - 21
src/main/java/com/jkcredit/invoice/service/lowerService/CustomeLowerService.java

@@ -2,6 +2,8 @@ package com.jkcredit.invoice.service.lowerService;
 
 import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
 import com.jkcredit.invoice.model.entity.customer.CustomerRec;
+import com.jkcredit.invoice.service.lowerService.vo.EtcBindVo;
+import com.jkcredit.invoice.service.lowerService.vo.EtcValidVo;
 import com.jkcredit.invoice.util.RespR;
 
 import java.util.List;
@@ -30,25 +32,4 @@ public interface CustomeLowerService {
      * @return
      */
     RespR customeRecQuery(CustomerRec customerRec);
-
-    /**
-     * 车辆备案
-     * @param customerCarRec
-     * @return
-     */
-    RespR customerCarRec(List<CustomerCarRec> customerCarRec);
-
-    /**
-     * 车辆解绑
-     * @param customerCarRec
-     * @return
-     */
-    RespR customerCarUnRec(List<CustomerCarRec> customerCarRec);
-
-    /**
-     * 无车车辆备案查询
-     * @param customerCarRec
-     * @return
-     */
-    RespR customerCarRecQuery(CustomerCarRec customerCarRec);
 }

+ 25 - 0
src/main/java/com/jkcredit/invoice/service/lowerService/NoCarService.java

@@ -1,15 +1,40 @@
 package com.jkcredit.invoice.service.lowerService;
 
+import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
 import com.jkcredit.invoice.model.entity.waybill.NoCarWayBill;
 import com.jkcredit.invoice.service.lowerService.vo.HCInvoiceQueryVo;
 import com.jkcredit.invoice.service.lowerService.vo.MonthAccountQueryVo;
 import com.jkcredit.invoice.util.RespR;
 
+import java.util.List;
+
 /**
  * 无车接口
  */
 public interface NoCarService {
     /**
+     * 车辆备案
+     * @param customerCarRec
+     * @return
+     */
+    RespR customerCarRec(List<CustomerCarRec> customerCarRec);
+
+    /**
+     * 车辆备案查询查上游
+     * @param customerCarRec
+     * @return
+     */
+    RespR customerCarRecQueryUpper(CustomerCarRec customerCarRec);
+
+
+
+    /**
+     * 无车车辆备案查询
+     * @param customerCarRec
+     * @return
+     */
+    RespR customerCarRecQuery(CustomerCarRec customerCarRec);
+    /**
      * 运单指令开始
      * @return
      */

+ 31 - 4
src/main/java/com/jkcredit/invoice/service/lowerService/SelfCarServiceL.java

@@ -1,11 +1,10 @@
 package com.jkcredit.invoice.service.lowerService;
 
+import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
 import com.jkcredit.invoice.model.entity.invoice.SelfCarAppl;
 import com.jkcredit.invoice.model.entity.invoice.SelfCarInvoice;
 import com.jkcredit.invoice.model.entity.waybill.SelfCarTrade;
-import com.jkcredit.invoice.service.lowerService.vo.InvoiceApplVo;
-import com.jkcredit.invoice.service.lowerService.vo.SelfCarDueQueryVo;
-import com.jkcredit.invoice.service.lowerService.vo.TradeRequestVo;
+import com.jkcredit.invoice.service.lowerService.vo.*;
 import com.jkcredit.invoice.util.RespR;
 
 import java.util.List;
@@ -32,11 +31,39 @@ public interface SelfCarServiceL {
     /**
      *按申请id取发票
      */
-    RespR<List<SelfCarInvoice>> getSelfCarInvoicesByApplyIds(SelfCarAppl selfCarAppl);
+    RespR<List<SelfCarInvoice>> getSelfCarInvoicesByApplyIds(ApplQueryInvVo applQueryInvVo);
 
     /**
      *已开发票查询接口
      */
     RespR<List<SelfCarInvoice>> getSelfCarInvoicesByTime(SelfCarDueQueryVo selfCarDueQueryVo);
 
+    /**
+     * 根据车牌获取ETC卡信息
+     * @param etcQueryVo
+     * @return
+     */
+    RespR getEtcInfo(EtcQueryVo etcQueryVo);
+
+    /**
+     * ETC备案
+     * @param
+     * @return
+     */
+    RespR customerEtcRec(EtcBindVo etcBindVo);
+
+
+    /**
+     * ETC校验
+     * @param
+     * @return
+     */
+    RespR customerEtcRecValid(EtcValidVo etcValidVo);
+
+    /**
+     * 车辆解绑
+     * @param customerCarRec
+     * @return
+     */
+    RespR customerCarUnRec(List<CustomerCarRec> customerCarRec);
 }

+ 3 - 185
src/main/java/com/jkcredit/invoice/service/lowerService/impl/CustomerLowerServiceImpl.java

@@ -3,6 +3,7 @@ package com.jkcredit.invoice.service.lowerService.impl;
 import cn.com.taiji.sdk.model.comm.protocol.tts.card.server.*;
 import cn.com.taiji.sdk.model.comm.protocol.tts.vehicle.VehicleRegisterRequest;
 import cn.com.taiji.sdk.model.comm.protocol.tts.vehicle.VehicleRegisterResponse;
+import com.jkcredit.invoice.common.CommonConstants;
 import com.jkcredit.invoice.mapper.customer.CustomerCarRecMapper;
 import com.jkcredit.invoice.mapper.customer.CustomerMapper;
 import com.jkcredit.invoice.mapper.customer.CustomerRecMapper;
@@ -10,6 +11,8 @@ import com.jkcredit.invoice.model.entity.customer.Customer;
 import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
 import com.jkcredit.invoice.model.entity.customer.CustomerRec;
 import com.jkcredit.invoice.service.lowerService.CustomeLowerService;
+import com.jkcredit.invoice.service.lowerService.vo.EtcBindVo;
+import com.jkcredit.invoice.service.lowerService.vo.EtcValidVo;
 import com.jkcredit.invoice.service.upService.NoCarInterface;
 import com.jkcredit.invoice.service.upService.SelfCarInterface;
 import com.jkcredit.invoice.util.DateUtil;
@@ -80,190 +83,5 @@ public class CustomerLowerServiceImpl implements CustomeLowerService {
 
         return new RespR(customerRecMapper.selectByCustomerNameAndCompany(customerRec));
     }
-    @Override
-    public RespR customerCarRec(List<CustomerCarRec> customerCarRecs) {
-        if(customerCarRecs== null || customerCarRecs.size()<=0){
-            return new RespR(false,"无备案车辆");
-        }
-        StringBuffer res = new StringBuffer();
-        CustomerCarRec customerCarRec2 = customerCarRecs.get(0);
-        Customer customer = customerMapper.selectByCustomerName(customerCarRec2.getCustomerName());
-        if(customer == null || customer.getAccstatus()!=0){
-            res.append("#客户:"+customerCarRec2.getCustomerName()+"不存在或状态异常");
-            return new RespR(false,res.toString());
-        }
-        CustomerRec customerRecP = new CustomerRec();
-        customerRecP.setCustomerName(customerCarRec2.getCustomerName());
-        customerRecP.setCompanyName(customerCarRec2.getCompanyName());
-        CustomerRec customerRec = customerRecMapper.selectByCustomerNameAndCompany(customerRecP);
-        if(customerRec == null){
-            res.append("#客户:"+customerCarRec2.getCustomerName()+"企业:"+customerCarRec2.getCompanyName()+"备案信息不存在");
-            return new RespR(false,res.toString());
-        }
-        if("0".equals(customerCarRec2.getBusinessType())){
-            boolean isValidate = false;
-            if(!StringUtils.isEmpty(customerCarRec2.getValidateCode())){
-                isValidate = true;
-            }
-            return customerCarrRecForSelfCar(customerCarRecs,res,customerRec,isValidate);
-        }else if("2".equals(customerCarRec2.getBusinessType())){
-            return customerCarRecForNoCar(customerCarRecs,res,customerRec);
-        }
-        return new RespR(false,"业务类型不支持");
-    }
-    public RespR customerCarrRecForSelfCar(List<CustomerCarRec> customerCarRecs,StringBuffer res,CustomerRec customerRec,boolean isValid){
-        List<CardBindingToBModel> cardBindingToBModels = new ArrayList<>();
-        try {
-            if(isValid){
-                //校验
-                CardValidCodeToBRequest cardValidCodeToBRequest = new CardValidCodeToBRequest();
-                cardValidCodeToBRequest.setCompanyNum(customerRec.getCompanyNum());
-                cardValidCodeToBRequest.setMobile(customerRec.getCompanyPhone());
-                cardValidCodeToBRequest.setValidCode(customerCarRecs.get(0).getValidateCode());
-                RespR<CardValidCodeToBResponse> respR = selfCarInterface.cardValidCodeToB(cardValidCodeToBRequest);
-                if(respR.getCode() == 1){
-                    for(CustomerCarRec customerCarRec:customerCarRecs){
-                        customerCarRec.setRecStatus(0);
-                        customerCarRec.setFailReason(respR.getMsg());
-                        customerCarRec.setFailTime(DateUtil.getCurrentDateStr());
-                        updateCustomerCarRec(customerCarRec);
-                    }
-                    return new RespR(false,"验证失败");
-                }else{
-                    for(CustomerCarRec customerCarRec:customerCarRecs){
-                        if(!customerRec.getBussinessType().equals(customerCarRec.getBusinessType())){
-                            res.append("#客户:"+customerCarRec.getCustomerName()+"企业:"+customerCarRec.getCompanyName()+"车辆:"+customerCarRec.getCarNum()+"业务类型错误");
-                            continue;
-                        }
-                        customerCarRec.setRecStatus(1);
-                        customerCarRec.setSuccTime(DateUtil.getCurrentDateStr());
-                        updateCustomerCarRec(customerCarRec);
-                    }
-                    if(StringUtils.isEmpty(res.toString())) {
-                        return new RespR("绑定成功");
-                    }else{
-                        return new RespR(false,res.toString());
-                    }
-                }
-
-            }else{
-                for(CustomerCarRec customerCarRec:customerCarRecs){
-
-                    if(!customerRec.getBussinessType().equals(customerCarRec.getBusinessType())){
-                        res.append("#客户:"+customerCarRec.getCustomerName()+"企业:"+customerCarRec.getCompanyName()+"etc:"+customerCarRec.getEtcNum()+"业务类型错误");
-                        throw new Exception(res.toString());
-                    }
-                    CardBindingToBModel cardBindingToBModel = new CardBindingToBModel();
-                    cardBindingToBModel.setCardId(customerCarRec.getEtcNum());
-                    cardBindingToBModels.add(cardBindingToBModel);
-                }
-                CardBindingToBRequest cardBindingToBRequest = new CardBindingToBRequest();
-                cardBindingToBRequest.setMobile(customerRec.getCompanyPhone());
-                cardBindingToBRequest.setCompanyNum(customerRec.getCompanyNum());
-                cardBindingToBRequest.setCardIdList(cardBindingToBModels);
-                RespR<CardBindingToBResponse> respR = selfCarInterface.cardBindingToB(cardBindingToBRequest);
-                if(respR.getCode() == 1){
-                    return new RespR(false,"注册失败:"+respR.getMsg());
-                }else{
-                    return new RespR("已经发送绑定请求,请发送收到的验证码");
-                }
-            }
-        }catch (Exception e){
-            e.printStackTrace();
-            return new RespR(false,e.getMessage());
-        }
-
-
-    }
-    public void updateCustomerCarRec(CustomerCarRec customerCarRec){
-        //根据车牌号查询是新增还是更新
-        CustomerCarRec customerCarRec1 = customerCarRecMapper.selectByCarNum(customerCarRec.getCarNum());
-        customerCarRec.setRecStatus(0);
-        customerCarRec.setFailTime(DateUtil.getCurrentDateStr());
-        if (customerCarRec1 == null) {
-            customerCarRecMapper.insert(customerCarRec);
-        } else {
-            customerCarRecMapper.updateByPrimaryKey(customerCarRec);
-        }
-    }
-    @Transactional
-    public  RespR customerCarRecForNoCar(List<CustomerCarRec> customerCarRecs,StringBuffer res,CustomerRec customerRec) {
-        try {
-
-            for (CustomerCarRec customerCarRec : customerCarRecs) {
-                if(!customerRec.getBussinessType().equals(customerCarRec.getBusinessType())){
-                    res.append("#客户:"+customerCarRec.getCustomerName()+"企业:"+customerCarRec.getCompanyName()+"车辆:"+customerCarRec.getCarNum()+"业务类型错误");
-                   continue;
-                }
-                //如果业务类型是无车
-                VehicleRegisterRequest vehicleRegisterRequest = new VehicleRegisterRequest();
-                vehicleRegisterRequest.setCompanyName(customerCarRec.getCompanyName());
-                vehicleRegisterRequest.setCompanyNum(customerRec.getCompanyNum());
-                vehicleRegisterRequest.setPlateColor(Integer.parseInt(customerCarRec.getCarColor()));
-                vehicleRegisterRequest.setPlateNum(customerCarRec.getCarNum());
-                RespR<VehicleRegisterResponse> respR = noCarInterface.vehicleRegister(vehicleRegisterRequest);
-                if (respR.getCode() == 1) {
-                    res.append("#客户:" + customerCarRec.getCustomerName() + "企业:" + customerCarRec.getCompanyName() + "车辆:" + customerCarRec.getCarNum() + "注册失败,原因:" + respR.getMsg());
-                    customerCarRec.setRecStatus(0);
-                    customerCarRec.setFailReason(respR.getMsg());
-                    customerCarRec.setFailTime(DateUtil.getCurrentDateStr());
-                } else {
-                    customerCarRec.setRecStatus(1);
-                    customerCarRec.setSuccTime(DateUtil.getCurrentDateStr());
-                }
-                //根据车牌号查询是新增还是更新
-                updateCustomerCarRec(customerCarRec);
-
-            }
-            if(StringUtils.isEmpty(res.toString())){
-                return new RespR("成功");
-            }else {
-                return new RespR(false,res.toString());
-            }
-
-        }catch (Exception e){
-            e.printStackTrace();
-            return new RespR(false,e.getMessage());
-        }
-
-    }
-    @Override
-    public RespR customerCarRecQuery(CustomerCarRec customerCarRec) {
-
-        return new RespR(customerCarRecMapper.selectByCustName(customerCarRec.getCustomerName()));
-    }
-
-    @Override
-    public RespR customerCarUnRec(List<CustomerCarRec> customerCarRecs) {
-        if(customerCarRecs!=null || customerCarRecs.size()<=0){
-            return new RespR(false,"无解绑信息");
-        }
-        StringBuffer res = new StringBuffer();
-        try {
-            for(CustomerCarRec customerCarRec:customerCarRecs){
-                if("0".equals(customerCarRec.getBusinessType())){
-                    CardUnbindToBRequest cardUnbindToBRequest = new CardUnbindToBRequest();
-                    cardUnbindToBRequest.setCardId(customerCarRec.getEtcNum());
-                    cardUnbindToBRequest.setCompanyNum(customerCarRec.getCarNum());
-                    RespR<CardUnbindToBResponse> respR = selfCarInterface.cardUnbindToB(cardUnbindToBRequest);
-                    if(respR.getCode() == 1){
-                        res.append(customerCarRec.getEtcNum()+","+customerCarRec.getCarNum()+"解绑失败;"+"#");
-                    }else{
-                        customerCarRec.setRecStatus(2);
-                        customerCarRecMapper.updateByPrimaryKeySelective(customerCarRec);
-                    }
-                }
-            }
-            if(StringUtils.isEmpty(res.toString())){
-                return new RespR("解绑成功");
-            }else{
-                return new RespR(false,res.toString());
-            }
-
-        }catch (Exception e){
-            return new RespR(false,e.getMessage());
-        }
-
-    }
 
 }

+ 123 - 17
src/main/java/com/jkcredit/invoice/service/lowerService/impl/NoCarServiceImpl.java

@@ -1,6 +1,9 @@
 package com.jkcredit.invoice.service.lowerService.impl;
 
+import cn.com.taiji.sdk.model.comm.protocol.tts.vehicle.VehicleRegisterRequest;
+import cn.com.taiji.sdk.model.comm.protocol.tts.vehicle.VehicleRegisterResponse;
 import cn.com.taiji.sdk.model.comm.protocol.tts.waybill.*;
+import com.jkcredit.invoice.common.CommonConstants;
 import com.jkcredit.invoice.mapper.Binvoce.BillInvoiceMapper;
 import com.jkcredit.invoice.mapper.calculateInfor.NoCarCalculateInforMapper;
 import com.jkcredit.invoice.mapper.customer.CustomerCarRecMapper;
@@ -23,6 +26,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
 
 import java.util.Date;
 import java.util.List;
@@ -49,6 +53,94 @@ public class NoCarServiceImpl implements NoCarService{
 
     @Autowired
     NoCarCalculateInforMapper calculateInforMapper;
+
+
+
+    @Override
+    public RespR customerCarRec(List<CustomerCarRec> customerCarRecs) {
+        if(customerCarRecs== null || customerCarRecs.size()<=0){
+            return new RespR(false,"无备案车辆");
+        }
+        StringBuffer res = new StringBuffer();
+        CustomerCarRec customerCarRec2 = customerCarRecs.get(0);
+        Customer customer = customerMapper.selectByCustomerName(customerCarRec2.getCustomerName());
+        if(customer == null || customer.getAccstatus()!=0){
+            res.append("#客户:"+customerCarRec2.getCustomerName()+"不存在或状态异常");
+            return new RespR(false,res.toString());
+        }
+        CustomerRec customerRecP = new CustomerRec();
+        customerRecP.setCustomerName(customerCarRec2.getCustomerName());
+        customerRecP.setCompanyName(customerCarRec2.getCompanyName());
+        CustomerRec customerRec = customerRecMapper.selectByCustomerNameAndCompany(customerRecP);
+        if(customerRec == null){
+            res.append("#客户:"+customerCarRec2.getCustomerName()+"企业:"+customerCarRec2.getCompanyName()+"备案信息不存在");
+            return new RespR(false,res.toString());
+        }
+        return customerCarRecForNoCar(customerCarRecs,res,customerRec);
+    }
+    public  RespR customerCarRecForNoCar(List<CustomerCarRec> customerCarRecs, StringBuffer res, CustomerRec customerRec) {
+        try {
+
+            for (CustomerCarRec customerCarRec : customerCarRecs) {
+                if(!customerRec.getBussinessType().equals(customerCarRec.getBusinessType())){
+                    res.append("#客户:"+customerCarRec.getCustomerName()+"企业:"+customerCarRec.getCompanyName()+"车辆:"+customerCarRec.getCarNum()+"业务类型错误");
+                    continue;
+                }
+                //如果业务类型是无车
+                VehicleRegisterRequest vehicleRegisterRequest = new VehicleRegisterRequest();
+                vehicleRegisterRequest.setCompanyName(customerCarRec.getCompanyName());
+                vehicleRegisterRequest.setCompanyNum(customerRec.getCompanyNum());
+                vehicleRegisterRequest.setPlateColor(Integer.parseInt(customerCarRec.getCarColor()));
+                vehicleRegisterRequest.setPlateNum(customerCarRec.getCarNum());
+                RespR<VehicleRegisterResponse> respR = noCarInterface.vehicleRegister(vehicleRegisterRequest);
+                if (respR.getCode() == 1) {
+                    res.append("#客户:" + customerCarRec.getCustomerName() + "企业:" + customerCarRec.getCompanyName() + "车辆:" + customerCarRec.getCarNum() + "注册失败,原因:" + respR.getMsg());
+                    customerCarRec.setRecStatus(CommonConstants.REC_STATUS_FAIL);
+                    customerCarRec.setFailReason(respR.getMsg());
+                    customerCarRec.setFailTime(DateUtil.getCurrentDateStr());
+                } else {
+                    customerCarRec.setRecStatus(CommonConstants.REC_STATUS_SUC);
+                    customerCarRec.setSuccTime(DateUtil.getCurrentDateStr());
+                }
+                //根据车牌号查询是新增还是更新
+                updateCustomerCarRec(customerCarRec);
+
+            }
+            if(StringUtils.isEmpty(res.toString())){
+                return new RespR("成功");
+            }else {
+                return new RespR(false,res.toString());
+            }
+
+        }catch (Exception e){
+            e.printStackTrace();
+            return new RespR(false,e.getMessage());
+        }
+
+    }
+
+    @Override
+    public RespR customerCarRecQueryUpper(CustomerCarRec customerCarRec) {
+        return null;
+    }
+
+    public void updateCustomerCarRec(CustomerCarRec customerCarRec){
+        //根据车牌号查询是新增还是更新
+        CustomerCarRec customerCarRec1 = customerCarRecMapper.selectByCarNum(customerCarRec.getCarNum());
+        if (customerCarRec1 == null) {
+            customerCarRecMapper.insert(customerCarRec);
+        } else {
+            customerCarRecMapper.updateByPrimaryKey(customerCarRec);
+        }
+    }
+
+
+    @Override
+    public RespR customerCarRecQuery(CustomerCarRec customerCarRec) {
+
+        return new RespR(customerCarRecMapper.selectByCustName(customerCarRec.getCustomerName()));
+    }
+
     @Override
     public RespR noCarWaybillStart(NoCarWayBill noCarWayBill) {
         //如果运单时间和当前时间差了三天,直接返回
@@ -81,9 +173,10 @@ public class NoCarServiceImpl implements NoCarService{
         waybillStartRequest.setNum(noCarWayBill.getBillNum());
         waybillStartRequest.setPlateNum(noCarWayBill.getPlateNum());
         waybillStartRequest.setPlateColor(Integer.parseInt(noCarWayBill.getPlateColor()));
-        waybillStartRequest.setStartTime(DateUtil.dateToTTime(noCarWayBill.getStartTime()));
+        waybillStartRequest.setStartTime(DateUtil.dateFormate(noCarWayBill.getStartTime()));
         waybillStartRequest.setSourceAddr(noCarWayBill.getSourceAddr());
-        waybillStartRequest.setPredictEndTime(noCarWayBill.getPredictEndTime());
+        waybillStartRequest.setDestAddr(noCarWayBill.getDestAddr());
+        waybillStartRequest.setPredictEndTime(DateUtil.dateFormate(noCarWayBill.getPredictEndTime()));
         waybillStartRequest.setFee(noCarWayBill.getFee());
         waybillStartRequest.setTitleType(noCarWayBill.getTitleType());
         waybillStartRequest.setTaxplayerCode(noCarWayBill.getTaxplayerCode());
@@ -92,6 +185,7 @@ public class NoCarServiceImpl implements NoCarService{
         waybillStartRequest.setTel(noCarWayBill.getCompanyTel());
         waybillStartRequest.setBank(noCarWayBill.getCompanyBank());
         waybillStartRequest.setBankAccount(noCarWayBill.getCompanyBankAcc());
+        waybillStartRequest.setCompanyName(noCarWayBill.getCompanyName());
         return waybillStartRequest;
     }
     public RespR checkCarWayBillAndSetInfo(NoCarWayBill noCarWayBill){
@@ -103,7 +197,7 @@ public class NoCarServiceImpl implements NoCarService{
         customerRecParm.setCompanyName(noCarWayBill.getCompanyName());
         customerRecParm.setCustomerName(noCarWayBill.getCustomerName());
         CustomerRec customerRec = customerRecMapper.selectByCustomerNameAndCompany(customerRecParm);
-        if(customerRec == null || customerRec.getRecStatus()==1){
+        if(customerRec == null || customerRec.getRecStatus()!=1){
             return new RespR(false,"客户未备案或备案失败");
         }
         CustomerCarRec customerCarRec = customerCarRecMapper.selectByCarNum(noCarWayBill.getPlateNum());
@@ -111,10 +205,10 @@ public class NoCarServiceImpl implements NoCarService{
             return new RespR(false,"未正常备案的车辆");
         }
         noCarWayBill.setCompanyNum(customerRec.getCompanyNum());
-       /* noCarWayBill.setCompanyAdress(customerRec.getCompanyAdress());
+        noCarWayBill.setCompanyAdress(customerRec.getCompanyAdress());
         noCarWayBill.setCompanyTel(customerRec.getCompanyPhone());
         noCarWayBill.setCompanyBank(customerRec.getCompanyOpenbank());
-        noCarWayBill.setCompanyBankAcc(customerRec.getCompanyOpenbankAcc());*/
+        noCarWayBill.setCompanyBankAcc(customerRec.getCompanyOpenbankAcc());
         return new RespR();
     }
     @Override
@@ -134,7 +228,7 @@ public class NoCarServiceImpl implements NoCarService{
         waybillEndRequest.setCompanyNum(noCarWayBill1.getCompanyNum());
         waybillEndRequest.setNum(noCarWayBill1.getBillNum());
         waybillEndRequest.setRealDestAddr(noCarWayBill1.getDestAddr());
-        waybillEndRequest.setEndTime(noCarWayBill1.getPredictEndTime());
+        waybillEndRequest.setEndTime(DateUtil.dateFormate(noCarWayBill1.getPredictEndTime()));
         RespR<WaybillEndResponse> waybillEndResponseRespR = noCarInterface.waybillEnd(waybillEndRequest);
         if(waybillEndResponseRespR.getCode() == 1){
             return new RespR(false,"运单结束指令失败");
@@ -236,7 +330,9 @@ public class NoCarServiceImpl implements NoCarService{
         if(!isCurr){
             //查询本地数据库 如果有发票直接返回
            List<BillInvoice> billInvoices = billInvoiceMapper.selectByBillNum(noCarWayBill.getBillNum());
-           return new RespR(billInvoices);
+           if(billInvoices!=null && billInvoices.size()>0){
+               return new RespR(billInvoices);
+           }
         }
         if(noCarWayBillDb.getBillwayStatus() == 3){
             //直接返回发票信息
@@ -254,9 +350,18 @@ public class NoCarServiceImpl implements NoCarService{
             int tempStatus = responseRespR.getData().getWaybillStatus().intValue();
             //更改票状态
             noCarWayBillDb.setBillwayStatus(1);
-            if(tempStatus == 3){
+            if(tempStatus ==3){
                 noCarWayBillDb.setBillwayStatus(3);
-                //发票入库 这里只会有一个TransactionId么?
+            }else if(tempStatus == 4){
+                noCarWayBillDb.setBillwayStatus(2);
+            }
+            noCarWaybillMapper.updateByBillNum(noCarWayBillDb);
+            if(tempStatus == 2 || tempStatus==3){
+                List<BillInvoice> billInvoices = billInvoiceMapper.selectByBillNum(noCarWayBill.getBillNum());
+                if(billInvoices!=null && billInvoices.size()>0){
+                    return new RespR(billInvoices);
+                }
+                //发票入库
                 List<InvoiceProcessingListModel> invoiceProcessingListModels = responseRespR.getData().getResult();
                 invoiceProcessingListModels.stream().forEach(invoiceProcessingListModel -> {
                     BillInvoice billInvoice = buildFromInvoiceProcessingListModel(invoiceProcessingListModel);
@@ -278,14 +383,12 @@ public class NoCarServiceImpl implements NoCarService{
                     }
 
                 });
-
-                //扣费
-                List<BillInvoice> billInvoices = billInvoiceMapper.selectByBillNum(noCarWayBill.getBillNum());
-                return new RespR(billInvoices);
-            }else if(tempStatus == 4){
-                noCarWayBillDb.setBillwayStatus(-2);
+                List<BillInvoice> billInvoices1 = billInvoiceMapper.selectByBillNum(noCarWayBill.getBillNum());
+                if(billInvoices!=null && billInvoices.size()>0){
+                    return new RespR(billInvoices);
+                }
             }
-            noCarWaybillMapper.updateByBillNum(noCarWayBillDb);
+
         }
         //查询
         return new RespR(false,"未获取到发票,请联系管理员");
@@ -307,13 +410,16 @@ public class NoCarServiceImpl implements NoCarService{
         customerRecParm.setCompanyName(hcInvoiceQueryVo.getCompanyName());
         customerRecParm.setCustomerName(hcInvoiceQueryVo.getCustomerName());
         CustomerRec customerRec = customerRecMapper.selectByCustomerNameAndCompany(customerRecParm);
-        if(customerRec == null || customerRec.getRecStatus()==1){
+        if(customerRec == null || customerRec.getRecStatus()!=1){
             return new RespR(false,"客户未备案或备案失败");
         }
         WaybillInvoiceRedQueryRequest redQueryRequest = new WaybillInvoiceRedQueryRequest();
         redQueryRequest.setCompanyNum(customerRec.getCompanyNum());
         redQueryRequest.setMonth(hcInvoiceQueryVo.getMonth());
         RespR<WaybillInvoiceRedQueryResponse> respR = noCarInterface.waybillInvoiceRedQuery(redQueryRequest);
+        if(respR.getCode() == 1){
+            return new RespR(false,respR.getMsg());
+        }
         return new RespR(respR.getData().getResult());
 
     }

+ 245 - 39
src/main/java/com/jkcredit/invoice/service/lowerService/impl/SelfCarServiceLImpl.java

@@ -1,9 +1,11 @@
 package com.jkcredit.invoice.service.lowerService.impl;
 
+import cn.com.taiji.sdk.model.comm.protocol.tts.card.server.*;
 import cn.com.taiji.sdk.model.comm.protocol.tts.invoice.server.*;
 import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.CardTradeModel;
 import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.CardTradeRequest;
 import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.CardTradeResponse;
+import com.jkcredit.invoice.common.CommonConstants;
 import com.jkcredit.invoice.mapper.Binvoce.SelfCarApplMapper;
 import com.jkcredit.invoice.mapper.Binvoce.SelfCarInvoiceMapper;
 import com.jkcredit.invoice.mapper.calculateInfor.SelfCarCalculateInforMapper;
@@ -19,9 +21,7 @@ import com.jkcredit.invoice.model.entity.invoice.SelfCarAppl;
 import com.jkcredit.invoice.model.entity.invoice.SelfCarInvoice;
 import com.jkcredit.invoice.model.entity.waybill.SelfCarTrade;
 import com.jkcredit.invoice.service.lowerService.SelfCarServiceL;
-import com.jkcredit.invoice.service.lowerService.vo.InvoiceApplVo;
-import com.jkcredit.invoice.service.lowerService.vo.SelfCarDueQueryVo;
-import com.jkcredit.invoice.service.lowerService.vo.TradeRequestVo;
+import com.jkcredit.invoice.service.lowerService.vo.*;
 import com.jkcredit.invoice.service.upService.SelfCarInterface;
 import com.jkcredit.invoice.util.DateUtil;
 import com.jkcredit.invoice.util.RespR;
@@ -32,9 +32,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 @Service
 public class SelfCarServiceLImpl implements SelfCarServiceL {
     @Autowired
@@ -54,19 +52,23 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
     @Autowired
     SelfCarCalculateInforMapper calculateInforMapper;
     @Override
+    @Transactional
     public RespR<List<SelfCarTrade>> getTradeList(TradeRequestVo tradeRequestVo) {
         Customer customer = customerMapper.selectByCustomerName(tradeRequestVo.getCustomerName());
         if(customer == null || customer.getAccstatus().intValue() == 1){
             return new RespR(false,"客户已经停用");
         }
-        if(DateUtil.getDistanceDays(tradeRequestVo.getEndTime(),tradeRequestVo.getStartTime())>30){
+        if(StringUtils.isEmpty(tradeRequestVo.getStartTime()) || StringUtils.isEmpty(tradeRequestVo.getEndTime())){
+            return new RespR(false,"时间为空");
+        }
+        if(DateUtil.getDistanceDays(tradeRequestVo.getEndTime(),tradeRequestVo.getStartTime())>90){
             return new RespR(false,"不能查询大于90天的交易");
         }
         CustomerRec customerRec = new CustomerRec();
         customerRec.setCustomerName(tradeRequestVo.getCustomerName());
         customerRec.setCompanyName(tradeRequestVo.getCompanyName());
         customerRec = customerRecMapper.selectByCustomerNameAndCompany(customerRec);
-        if(customerRec == null || customerRec.getRecStatus().intValue() ==1 ){
+        if(customerRec == null || customerRec.getRecStatus().intValue() !=1 ){
             return new RespR(false,"客户未备案");
         }
         CustomerCarRec customerCarRec = customerCarRecMapper.selectByETC(tradeRequestVo.getEtcId());
@@ -76,8 +78,8 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
         CardTradeRequest cardTradeRequest = new CardTradeRequest();
         cardTradeRequest.setCardId(tradeRequestVo.getEtcId());
         cardTradeRequest.setCompanyNum(customerRec.getCompanyNum());
-        cardTradeRequest.setStartExTime(tradeRequestVo.getStartTime());
-        cardTradeRequest.setEndExTime(tradeRequestVo.getEndTime());
+        cardTradeRequest.setStartExTime(DateUtil.dateFormate(tradeRequestVo.getStartTime()));
+        cardTradeRequest.setEndExTime(DateUtil.dateFormate(tradeRequestVo.getEndTime()));
         cardTradeRequest.setTradeStatus(tradeRequestVo.getTradeStatus());
         RespR<CardTradeResponse> resp = selfCarInterface.cardTrade(cardTradeRequest);
         if(resp.getCode() == 1){
@@ -95,21 +97,27 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
                         selfCarTrade.setCompanyNum(customerRec.getCompanyNum());
                         selfCarTrade.setCardId(cardTradeModel.getCardId());
                         selfCarTrade.setTradeId(cardTradeModel.getTradeId());
-                        selfCarTrade.setAclTime(cardTradeModel.getExTime());
+                        selfCarTrade.setAclTime(DateUtil.dateToTTime(cardTradeModel.getExTime()));
+                        selfCarTrade.setExTime(DateUtil.dateToTTime(cardTradeModel.getExTime()));
                         selfCarTrade.setFee(cardTradeModel.getFee());
-                        selfCarTrade.setStatus(0);
+                        selfCarTrade.setStatus(tradeRequestVo.getTradeStatus());
                         sellCarTradeMapper.insert(selfCarTrade);
                         //计费
                         SelfCarCalculateInfor carCalculateInfor = new SelfCarCalculateInfor();
                         carCalculateInfor.setCustomId(customerRec.getCustomerName());
                         carCalculateInfor.setCompanyNum(customerRec.getCompanyName());
-                        carCalculateInfor.setCalTime(StringUtils.substring(cardTradeModel.getExTime(),0,6));
+                        carCalculateInfor.setCalTime(StringUtils.substring(cardTradeModel.getExTime(),0,7));
                         carCalculateInfor.setFee(customer.getFee());
                         carCalculateInfor.setEtcNum(cardTradeModel.getCardId());
                         if(calculateInforMapper.selectByEtcAndTime(carCalculateInfor) == null){
                             calculateInforMapper.insert(carCalculateInfor);
                         }
 
+                    }else{
+                        if(selfCarTrade.getStatus()!=tradeRequestVo.getTradeStatus()){
+                            selfCarTrade.setStatus(tradeRequestVo.getTradeStatus());
+                            sellCarTradeMapper.updateByTradeId(selfCarTrade);
+                        }
                     }
                 };
             }
@@ -118,7 +126,6 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
     }
 
     @Override
-    @Transactional
     public RespR<Boolean> applInvoice(InvoiceApplVo invoiceApplVo) {
         Customer customer = customerMapper.selectByCustomerName(invoiceApplVo.getCustomerName());
         if(customer == null || customer.getAccstatus().intValue() == 1){
@@ -128,7 +135,7 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
         customerRec.setCustomerName(invoiceApplVo.getCustomerName());
         customerRec.setCompanyName(invoiceApplVo.getCompanyName());
         customerRec = customerRecMapper.selectByCustomerNameAndCompany(customerRec);
-        if(customerRec == null || customerRec.getRecStatus().intValue() ==1 ){
+        if(customerRec == null || customerRec.getRecStatus().intValue() !=1 ){
             return new RespR(false,"客户未备案");
         }
         CustomerCarRec customerCarRec = customerCarRecMapper.selectByETC(invoiceApplVo.getCardId());
@@ -164,46 +171,38 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
             selfCarAppl.setInvoiceCount(b2BInvoiceApplyResponse.getInvoiceCount());
             selfCarAppl.setInvoiceTaxAmount(b2BInvoiceApplyResponse.getInvoiceTaxAmount());
             selfCarApplMapper.insert(selfCarAppl);
-            for(String tradeId:tradeIds){
-               SelfCarTrade selfCarTrade = sellCarTradeMapper.selectByTradeId(tradeId);
-               selfCarTrade.setApplId(b2BInvoiceApplyResponse.getApplyId());
-               selfCarTrade.setStatus(1);
-               sellCarTradeMapper.updateByPrimaryKey(selfCarTrade);
-            }
         }
         return new RespR<>(true);
     }
 
     @Override
-    public RespR<List<SelfCarInvoice>> getSelfCarInvoicesByApplyIds(SelfCarAppl selfCarAppl) {
-        //TODO 查找是否已经开过票 如果开过就直接返回,查看所有返回的时机
-       // selfCarApplMapper
-
+    public RespR<List<SelfCarInvoice>> getSelfCarInvoicesByApplyIds(ApplQueryInvVo applQueryInvVo) {
         B2BInvoiceQueryByApplyRequest b2BInvoiceQueryRequest = new B2BInvoiceQueryByApplyRequest();
-        b2BInvoiceQueryRequest.setCardId(selfCarAppl.getCardId());
-        b2BInvoiceQueryRequest.setCompanyNum(selfCarAppl.getCompanyNum());
-        b2BInvoiceQueryRequest.setApplyId(selfCarAppl.getApplId());
+        CustomerRec customerRec = new CustomerRec();
+        customerRec.setCustomerName(applQueryInvVo.getCustomerName());
+        customerRec.setCompanyName(applQueryInvVo.getCompanyName());
+        customerRec = customerRecMapper.selectByCustomerNameAndCompany(customerRec);
+        if(customerRec == null || customerRec.getRecStatus().intValue() !=1 ){
+            return new RespR(false,"客户未备案");
+        }
+        b2BInvoiceQueryRequest.setCardId(applQueryInvVo.getEtcNum());
+        b2BInvoiceQueryRequest.setCompanyNum(customerRec.getCompanyNum());
+        b2BInvoiceQueryRequest.setApplyId(applQueryInvVo.getApplId());
         RespR<B2BInvoiceQueryByApplyResponse> responseRespR = selfCarInterface.b2bContractQuery(b2BInvoiceQueryRequest);
         if(responseRespR.getCode() == 1){
             return new RespR(false,responseRespR.getMsg());
         }else{
             B2BInvoiceQueryByApplyResponse response = responseRespR.getData();
             List<B2BInvoiceQueryByApplyModel> b2BInvoiceQueryByApplyModels = response.getResult();
-            Set<String> tradeIds = new HashSet<>();
             for(B2BInvoiceQueryByApplyModel b2BInvoiceQueryByApplyModel:b2BInvoiceQueryByApplyModels){
                 SelfCarInvoice selfCarInvoice = new SelfCarInvoice();
                 BeanUtils.copyProperties(b2BInvoiceQueryByApplyModel,selfCarInvoice);
-                tradeIds.add(selfCarInvoice.getTradeId());
-                selfCarInvoiceMapper.insert(selfCarInvoice);
-            }
-            for(String tradeId:tradeIds){
-                //更新tradeId为开票完成
-                SelfCarTrade selfCarTrade = sellCarTradeMapper.selectByTradeId(tradeId);
-                selfCarTrade.setStatus(2);
-                sellCarTradeMapper.updateByPrimaryKey(selfCarTrade);
-
+                selfCarInvoice.setInvoiceMakeTime(DateUtil.dateToTTime(selfCarInvoice.getInvoiceMakeTime()));
+                selfCarInvoice.setExTime(DateUtil.dateToTTime(selfCarInvoice.getExTime()));
+                if(selfCarInvoiceMapper.selectByTradeAndInvoiceMakeTime(selfCarInvoice)==null || selfCarInvoiceMapper.selectByTradeAndInvoiceMakeTime(selfCarInvoice).size()==0){
+                    selfCarInvoiceMapper.insert(selfCarInvoice);
+                }
             }
-
             //返回相应的发票
             return new RespR(b2BInvoiceQueryByApplyModels);
         }
@@ -243,11 +242,218 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
                 for(B2BInvoiceListModel b2BInvoiceListModel:b2BInvoiceListModels){
                     SelfCarInvoice selfCarInvoice = new SelfCarInvoice();
                     BeanUtils.copyProperties(b2BInvoiceListModel,selfCarInvoice);
+                    selfCarInvoice.setInvoiceMakeTime(DateUtil.dateFormate(selfCarInvoice.getInvoiceMakeTime()));
+                    selfCarInvoice.setExTime(DateUtil.dateFormate(selfCarInvoice.getExTime()));
+                    if(selfCarInvoiceMapper.selectByTradeAndInvoiceMakeTime(selfCarInvoice)==null || selfCarInvoiceMapper.selectByTradeAndInvoiceMakeTime(selfCarInvoice).size()==0){
+                        selfCarInvoiceMapper.insert(selfCarInvoice);
+                    }
                     selfCarInvoices.add(selfCarInvoice);
                 }
             }
-            return new RespR(selfCarInvoices);
+            return new RespR(b2BInvoiceListModels);
+        }
+    }
+
+    @Override
+    public RespR getEtcInfo(EtcQueryVo etcQueryVo) {
+        if(etcQueryVo.getCarList()==null || etcQueryVo.getCarList().size()<=0){
+            return new RespR(false,"车辆信息为空");
+        }
+        Customer customer = customerMapper.selectByCustomerName(etcQueryVo.getCustomerName());
+        if(customer == null || customer.getAccstatus().intValue() == 1){
+            return new RespR(false,"客户已经停用");
+        }
+        CustomerRec customerRec = new CustomerRec();
+        customerRec.setCustomerName(etcQueryVo.getCustomerName());
+        customerRec.setCompanyName(etcQueryVo.getCompanyName());
+        customerRec = customerRecMapper.selectByCustomerNameAndCompany(customerRec);
+        if(customerRec == null || customerRec.getRecStatus().intValue() !=1 ){
+            return new RespR(false,"客户未备案");
+        }
+        CardQueryCardToBRequest cardQueryCardToBRequest = new CardQueryCardToBRequest();
+        cardQueryCardToBRequest.setCompanyNum(customerRec.getCompanyNum());
+        List<CardQueryCardToBModel> cardQueryCardToBModels = new ArrayList<>();
+        etcQueryVo.getCarList().forEach(carVo -> {
+            CardQueryCardToBModel cardQueryCardToBModel = new CardQueryCardToBModel();
+            cardQueryCardToBModel.setPlateNum(carVo.getNum());
+            cardQueryCardToBModel.setPlateColor(carVo.getColor());
+            cardQueryCardToBModels.add(cardQueryCardToBModel);
+        });
+        cardQueryCardToBRequest.setVehicleList(cardQueryCardToBModels);
+        RespR<CardQueryCardToBResponse> respR = selfCarInterface.cardQueryCardToB(cardQueryCardToBRequest);
+        if(respR.getCode() == 1){
+            return new RespR(false,respR.getMsg());
+        }
+        return new RespR(respR.getData().getResult());
+    }
+
+    @Override
+    public RespR customerEtcRec(EtcBindVo etcBindVo) {
+        if(etcBindVo== null || etcBindVo.getCards() ==null || etcBindVo.getCards().size()<=0){
+            return new RespR(false,"无备案Etc");
+        }
+        StringBuffer res = new StringBuffer();
+        Customer customer = customerMapper.selectByCustomerName(etcBindVo.getCustomerName());
+        if(customer == null || customer.getAccstatus()!=0){
+            res.append("#客户:"+etcBindVo.getCustomerName()+"不存在或状态异常");
+            return new RespR(false,res.toString());
+        }
+        CustomerRec customerRecP = new CustomerRec();
+        customerRecP.setCustomerName(etcBindVo.getCustomerName());
+        customerRecP.setCompanyName(etcBindVo.getCompanyName());
+        CustomerRec customerRec = customerRecMapper.selectByCustomerNameAndCompany(customerRecP);
+        if(customerRec == null || customerRec.getRecStatus()!=1){
+            res.append("#客户:"+etcBindVo.getCustomerName()+"企业:"+etcBindVo.getCompanyName()+"请先备案");
+            return new RespR(false,res.toString());
+        }
+        return recEtc(etcBindVo,customerRec);
+    }
+    public RespR recEtc(EtcBindVo etcBindVo,CustomerRec customerRec){
+        CardQueryCardToBRequest cardQueryCardToBRequest = new CardQueryCardToBRequest();
+        cardQueryCardToBRequest.setCompanyNum(customerRec.getCompanyNum());
+        List<CardQueryCardToBModel> cardQueryCardToBModels = new ArrayList<>();
+        etcBindVo.getCards().forEach(carVo -> {
+            CardQueryCardToBModel cardQueryCardToBModel = new CardQueryCardToBModel();
+            cardQueryCardToBModel.setPlateNum(carVo.getNum());
+            cardQueryCardToBModel.setPlateColor(carVo.getColor());
+            cardQueryCardToBModels.add(cardQueryCardToBModel);
+        });
+        cardQueryCardToBRequest.setVehicleList(cardQueryCardToBModels);
+        RespR<CardQueryCardToBResponse> respR = selfCarInterface.cardQueryCardToB(cardQueryCardToBRequest);
+        if(respR.getCode() == 1){
+            return new RespR(false,respR.getMsg());
+        }
+        if(respR.getData().getResult() == null){
+            return new RespR("成功");
+        }
+        List<CustomerCarRec> customerCarRecs = new ArrayList<>();
+        List<CardBindingToBModel> cardBindingToBModels = new ArrayList<>();
+        for(int i=0;i<respR.getData().getResult().size();i++){
+            CardQueryCardResultToBModel cardQueryCardResultToBModel = respR.getData().getResult().get(i);
+            CarVo carVo = etcBindVo.getCards().get(i);
+            CustomerCarRec customerCarRec = new CustomerCarRec();
+            customerCarRec.setBusinessType(CommonConstants.BUSSINESS_TYPE_SELFCAR);
+            customerCarRec.setCompanyName(customerRec.getCompanyName());
+            customerCarRec.setCustomerName(customerRec.getCustomerName());
+            customerCarRec.setCompanyNum(customerRec.getCompanyNum());
+            customerCarRec.setCustPhone(etcBindVo.getMobile());
+            customerCarRec.setRecStatus(CommonConstants.REC_STATUS_WAIT);
+            customerCarRec.setCarNum(carVo.getNum());
+            customerCarRec.setEtcNum(carVo.getEtcNum());
+            customerCarRec.setCarColor(carVo.getColor()+"");
+            customerCarRecs.add(customerCarRec);
+            CardBindingToBModel cardBindingToBModel = new CardBindingToBModel();
+            cardBindingToBModel.setCardId(cardQueryCardResultToBModel.getId());
+            cardBindingToBModels.add(cardBindingToBModel);
+        }
+        CardBindingToBRequest cardBindingToBRequest = new CardBindingToBRequest();
+        cardBindingToBRequest.setMobile(etcBindVo.getMobile());
+        cardBindingToBRequest.setCompanyNum(customerRec.getCompanyNum());
+        cardBindingToBRequest.setCardIdList(cardBindingToBModels);
+        RespR<CardBindingToBResponse> respR1 = selfCarInterface.cardBindingToB(cardBindingToBRequest);
+        if(respR1.getCode() == 1){
+            /**
+             * etc入库
+             */
+            customerCarRecs.forEach(customerCarRec -> {
+                customerCarRec.setRecStatus(CommonConstants.REC_STATUS_FAIL);
+                customerCarRec.setFailTime(DateUtil.getCurrentDateStr());
+                customerCarRec.setFailReason(respR1.getMsg());
+                updateETCRec(customerCarRec);
+            });
+            return new RespR(false,"注册失败:"+respR.getMsg());
+        }else{
+            /**
+             * etc入库
+             */
+            customerCarRecs.forEach(customerCarRec -> {
+                customerCarRec.setRecStatus(CommonConstants.REC_STATUS_WAIT);
+                updateETCRec(customerCarRec);
+            });
+            return new RespR("已经发送绑定请求,请发送收到的验证码");
         }
     }
 
+    public void updateETCRec(CustomerCarRec customerCarRec){
+        //根据车牌号查询是新增还是更新
+        CustomerCarRec customerCarRec1 = customerCarRecMapper.selectByETC(customerCarRec.getEtcNum());
+        if (customerCarRec1 == null) {
+            customerCarRecMapper.insert(customerCarRec);
+        } else {
+            customerCarRecMapper.updateETCByPrimaryKey(customerCarRec);
+        }
+    }
+    @Override
+    public RespR customerEtcRecValid(EtcValidVo etcValidVo) {
+        StringBuffer res = new StringBuffer();
+        Customer customer = customerMapper.selectByCustomerName(etcValidVo.getCustomerName());
+        if(customer == null || customer.getAccstatus()!=0){
+            res.append("#客户:"+etcValidVo.getCustomerName()+"不存在或状态异常");
+            return new RespR(false,res.toString());
+        }
+        CustomerRec customerRecP = new CustomerRec();
+        customerRecP.setCustomerName(etcValidVo.getCustomerName());
+        customerRecP.setCompanyName(etcValidVo.getCompanyName());
+        CustomerRec customerRec = customerRecMapper.selectByCustomerNameAndCompany(customerRecP);
+        if(customerRec == null || customerRec.getRecStatus()!=1){
+            res.append("#客户:"+etcValidVo.getCustomerName()+"企业:"+etcValidVo.getCompanyName()+"请先备案");
+            return new RespR(false,res.toString());
+        }
+        CardValidCodeToBRequest cardValidCodeToBRequest = new CardValidCodeToBRequest();
+        cardValidCodeToBRequest.setCompanyNum(customerRec.getCompanyNum());
+        cardValidCodeToBRequest.setMobile(etcValidVo.getMobile());
+        cardValidCodeToBRequest.setValidCode(etcValidVo.getValidCode());
+        RespR<CardValidCodeToBResponse> respR = selfCarInterface.cardValidCodeToB(cardValidCodeToBRequest);
+        CustomerCarRec customerCarRec;
+        if(respR.getCode() == 1){
+            customerCarRec = new CustomerCarRec();
+            customerCarRec.setRecStatus(CommonConstants.REC_STATUS_FAIL);
+            customerCarRec.setFailReason(respR.getMsg());
+            customerCarRec.setFailTime(DateUtil.getCurrentDateStr());
+            customerCarRec.setCompanyNum(customerRec.getCompanyNum());
+            customerCarRec.setCustPhone(etcValidVo.getMobile());
+            customerCarRecMapper.updateWaitETCStatus(customerCarRec);
+            return new RespR(false,"验证失败");
+        }else{
+            customerCarRec = new CustomerCarRec();
+            customerCarRec.setRecStatus(CommonConstants.REC_STATUS_SUC);
+            customerCarRec.setSuccTime(DateUtil.getCurrentDateStr());
+            customerCarRec.setCompanyNum(customerRec.getCompanyNum());
+            customerCarRec.setCustPhone(etcValidVo.getMobile());
+            customerCarRecMapper.updateWaitETCStatus(customerCarRec);
+            return new RespR(false,"校验成功");
+        }
+    }
+    @Override
+    public RespR customerCarUnRec(List<CustomerCarRec> customerCarRecs) {
+        if(customerCarRecs!=null || customerCarRecs.size()<=0){
+            return new RespR(false,"无解绑信息");
+        }
+        StringBuffer res = new StringBuffer();
+        try {
+            for(CustomerCarRec customerCarRec:customerCarRecs){
+                if("0".equals(customerCarRec.getBusinessType())){
+                    CardUnbindToBRequest cardUnbindToBRequest = new CardUnbindToBRequest();
+                    cardUnbindToBRequest.setCardId(customerCarRec.getEtcNum());
+                    cardUnbindToBRequest.setCompanyNum(customerCarRec.getCarNum());
+                    RespR<CardUnbindToBResponse> respR = selfCarInterface.cardUnbindToB(cardUnbindToBRequest);
+                    if(respR.getCode() == 1){
+                        res.append(customerCarRec.getEtcNum()+","+customerCarRec.getCarNum()+"解绑失败;"+"#");
+                    }else{
+                        customerCarRec.setRecStatus(2);
+                        customerCarRecMapper.updateByPrimaryKeySelective(customerCarRec);
+                    }
+                }
+            }
+            if(org.springframework.util.StringUtils.isEmpty(res.toString())){
+                return new RespR("解绑成功");
+            }else{
+                return new RespR(false,res.toString());
+            }
+
+        }catch (Exception e){
+            return new RespR(false,e.getMessage());
+        }
+
+    }
 }

+ 55 - 0
src/main/java/com/jkcredit/invoice/service/lowerService/vo/ApplQueryInvVo.java

@@ -0,0 +1,55 @@
+package com.jkcredit.invoice.service.lowerService.vo;
+
+public class ApplQueryInvVo {
+    /**
+     * 公司名称
+     */
+    private String companyName;
+
+    /**
+     * 客户名称
+     */
+    private String customerName;
+
+    /**
+     * 申请id
+     */
+    private String applId;
+
+    /**
+     * etc卡号
+     */
+    private String etcNum;
+
+    public String getCompanyName() {
+        return companyName;
+    }
+
+    public void setCompanyName(String companyName) {
+        this.companyName = companyName;
+    }
+
+    public String getCustomerName() {
+        return customerName;
+    }
+
+    public void setCustomerName(String customerName) {
+        this.customerName = customerName;
+    }
+
+    public String getApplId() {
+        return applId;
+    }
+
+    public void setApplId(String applId) {
+        this.applId = applId;
+    }
+
+    public String getEtcNum() {
+        return etcNum;
+    }
+
+    public void setEtcNum(String etcNum) {
+        this.etcNum = etcNum;
+    }
+}

+ 34 - 0
src/main/java/com/jkcredit/invoice/service/lowerService/vo/CarVo.java

@@ -0,0 +1,34 @@
+package com.jkcredit.invoice.service.lowerService.vo;
+
+/**
+ * 车辆属性
+ */
+public class CarVo {
+    private String num;
+    private Integer color;
+    private String etcNum;
+
+    public String getNum() {
+        return num;
+    }
+
+    public void setNum(String num) {
+        this.num = num;
+    }
+
+    public Integer getColor() {
+        return color;
+    }
+
+    public void setColor(Integer color) {
+        this.color = color;
+    }
+
+    public String getEtcNum() {
+        return etcNum;
+    }
+
+    public void setEtcNum(String etcNum) {
+        this.etcNum = etcNum;
+    }
+}

+ 61 - 0
src/main/java/com/jkcredit/invoice/service/lowerService/vo/EtcBindVo.java

@@ -0,0 +1,61 @@
+package com.jkcredit.invoice.service.lowerService.vo;
+
+import java.util.List;
+
+/**
+ * ETC绑定参数
+ */
+public class EtcBindVo {
+    /**
+     * 手机号
+     */
+    private String mobile;
+
+    /**
+     * 公司名称
+     */
+    private String companyName;
+
+    /**
+     * 客户名称
+     */
+    private String customerName;
+
+    /**
+     * etc卡号
+     */
+    private List<CarVo> cards;
+
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getCompanyName() {
+        return companyName;
+    }
+
+    public void setCompanyName(String companyName) {
+        this.companyName = companyName;
+    }
+
+    public String getCustomerName() {
+        return customerName;
+    }
+
+    public void setCustomerName(String customerName) {
+        this.customerName = customerName;
+    }
+
+    public List<CarVo> getCards() {
+        return cards;
+    }
+
+    public void setCards(List<CarVo> cards) {
+        this.cards = cards;
+    }
+}

+ 39 - 0
src/main/java/com/jkcredit/invoice/service/lowerService/vo/EtcQueryVo.java

@@ -0,0 +1,39 @@
+package com.jkcredit.invoice.service.lowerService.vo;
+
+import java.util.List;
+
+/**
+ * 用户卡查询vo
+ */
+public class EtcQueryVo {
+    /**
+     * 用户名
+     */
+    private String customerName;
+    private String companyName;
+    private List<CarVo> carList;
+
+    public String getCustomerName() {
+        return customerName;
+    }
+
+    public void setCustomerName(String customerName) {
+        this.customerName = customerName;
+    }
+
+    public String getCompanyName() {
+        return companyName;
+    }
+
+    public void setCompanyName(String companyName) {
+        this.companyName = companyName;
+    }
+
+    public List<CarVo> getCarList() {
+        return carList;
+    }
+
+    public void setCarList(List<CarVo> carList) {
+        this.carList = carList;
+    }
+}

+ 58 - 0
src/main/java/com/jkcredit/invoice/service/lowerService/vo/EtcValidVo.java

@@ -0,0 +1,58 @@
+package com.jkcredit.invoice.service.lowerService.vo;
+
+/**
+ * etc校验Vo
+ */
+public class EtcValidVo {
+    /**
+     * 企业手机号
+     */
+    private String mobile;
+
+    /**
+     * 公司名称
+     */
+    private String companyName;
+
+    /**
+     * 客户名称
+     */
+    private String customerName;
+
+    /**
+     * 校验号
+     */
+    private String validCode;
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getCompanyName() {
+        return companyName;
+    }
+
+    public void setCompanyName(String companyName) {
+        this.companyName = companyName;
+    }
+
+    public String getCustomerName() {
+        return customerName;
+    }
+
+    public void setCustomerName(String customerName) {
+        this.customerName = customerName;
+    }
+
+    public String getValidCode() {
+        return validCode;
+    }
+
+    public void setValidCode(String validCode) {
+        this.validCode = validCode;
+    }
+}

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

@@ -14,4 +14,12 @@ public interface NoCarBillWayService {
      * @return
      */
     IPage<List<NoCarWayBill>> findByPageAndWayBill(Page page, NoCarWayBill noCarWayBill);
+
+    /**
+     * 查询所有异常运单号接口
+     * @param page
+     * @param noCarWayBill
+     * @return
+     */
+    IPage<List<NoCarWayBill>> findByPageAndWayBillException(Page page, NoCarWayBill noCarWayBill);
 }

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

@@ -19,4 +19,9 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
     public IPage<List<NoCarWayBill>> findByPageAndWayBill(Page page, NoCarWayBill noCarWayBill) {
         return noCarWaybillMapper.selectAllByPage(page,noCarWayBill);
     }
+
+    @Override
+    public IPage<List<NoCarWayBill>> findByPageAndWayBillException(Page page, NoCarWayBill noCarWayBill) {
+        return noCarWaybillMapper.selectAllByPageException(page,noCarWayBill);
+    }
 }

+ 3 - 2
src/main/java/com/jkcredit/invoice/service/selfCar/impl/SelfCarServiceImpl.java

@@ -3,6 +3,7 @@ package com.jkcredit.invoice.service.selfCar.impl;
 import com.jkcredit.invoice.mapper.customer.CustomerCarRecMapper;
 import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
 import com.jkcredit.invoice.service.lowerService.CustomeLowerService;
+import com.jkcredit.invoice.service.lowerService.SelfCarServiceL;
 import com.jkcredit.invoice.service.selfCar.SelfCarService;
 import com.jkcredit.invoice.util.RespR;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,7 +14,7 @@ import java.util.List;
 @Service
 public class SelfCarServiceImpl implements SelfCarService{
     @Autowired
-    CustomeLowerService lowerService;
+    SelfCarServiceL selfCarService;
     @Autowired
     CustomerCarRecMapper customerCarRecMapper;
     @Override
@@ -24,6 +25,6 @@ public class SelfCarServiceImpl implements SelfCarService{
         }
         List<CustomerCarRec> customerCarRecs = new ArrayList<>();
         customerCarRecs.add(customerCarRec);
-        return  lowerService.customerCarUnRec(customerCarRecs);
+        return  selfCarService.customerCarUnRec(customerCarRecs);
     }
 }

+ 2 - 2
src/main/java/com/jkcredit/invoice/task/ScheduledBillTask.java

@@ -78,7 +78,7 @@ public class ScheduledBillTask {
         }
     }
 
-    @Scheduled(cron = "0 0 23 * * ?", zone = "Asia/Shanghai")
+   /* @Scheduled(cron = "0 0 23 * * ?", zone = "Asia/Shanghai")
     public void getSefCarInvoice() {
         try {
             List<SelfCarAppl> selfCarAppls = selfCarApplMapper.selectAllNoRec();
@@ -88,5 +88,5 @@ public class ScheduledBillTask {
         }catch (Exception e){
             e.printStackTrace();
         }
-    }
+    }*/
 }

+ 3 - 3
src/main/java/com/jkcredit/invoice/util/DateUtil.java

@@ -62,7 +62,7 @@ public class DateUtil {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
         SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         try {
-            formatDate =  sdf2.format(sdf.parse(time).getTime());
+            formatDate =  sdf.format(sdf2.parse(time).getTime());
         } catch (ParseException e) {
             e.printStackTrace();
         }
@@ -207,7 +207,7 @@ public class DateUtil {
             long time1 = time.getTime();
             long time2 = now.getTime();
             long diff = time1 - time2;
-            days = diff / (60 * 60 * 24);
+            days = diff / (60 * 60 * 24*1000);
 
         } catch (Exception e) {
             e.printStackTrace();
@@ -232,7 +232,7 @@ public class DateUtil {
             long time1 = time.getTime();
             long time2 = now.getTime();
             long diff = time1 - time2;
-            hours = diff / (60 * 60 );
+            hours = diff / (60 * 60*1000 );
 
         } catch (Exception e) {
             e.printStackTrace();

+ 3 - 3
src/main/java/com/jkcredit/invoice/util/DownExcelTemplateUtil.java

@@ -19,11 +19,11 @@ import java.net.URLEncoder;
 public class DownExcelTemplateUtil {
 
     public static void downloadExcel(HttpServletResponse response,String fileName) {
-        try {
+       /* try {
 
             // 读到流中
             //文件的存放路径
-            InputStream inStream = new FileInputStream( CommonConstants.BASE_PATH + CommonConstants.TEMPLATE_PATH +fileName);
+           // InputStream inStream = new FileInputStream( CommonConstants.BASE_PATH + CommonConstants.TEMPLATE_PATH +fileName);
             // 设置输出的格式
             response.reset();
             response.setContentType("bin");
@@ -39,7 +39,7 @@ public class DownExcelTemplateUtil {
             inStream.close();
         } catch (IOException e) {
             e.printStackTrace();
-        }
+        }*/
     }
 
 }

+ 2 - 2
src/main/java/com/jkcredit/invoice/util/ReadExcelUtil.java

@@ -22,7 +22,7 @@ import java.util.List;
 public class ReadExcelUtil {
 
 
-    public static <T> List<T> readExcel(MultipartFile file,Class<?> clazz){
+    /*public static <T> List<T> readExcel(MultipartFile file,Class<?> clazz){
         //将本地文件上传到服务器/static/upload/excel
         String filePath = null;
         try {
@@ -104,5 +104,5 @@ public class ReadExcelUtil {
         //删除文件
         FileHandleUtil.delete(filePath);
         return list;
-    }
+    }*/
 }

+ 1 - 1
src/main/resources/mapper/calculateInfor/NoCarCalculateInforMapper.xml

@@ -41,7 +41,7 @@
         ctype
         )
         values ( #{customId,jdbcType=VARCHAR}, #{companyNum,jdbcType=VARCHAR},
-        #{tradeId,jdbcType=VARCHAR}, #{fee,jdbcType=INTEGER},#{calculateTime,jdbcType=VARCHAR},#{ctype,jdbcType=INTEGER},
+        #{tradeId,jdbcType=VARCHAR}, #{fee,jdbcType=INTEGER},#{calculateTime,jdbcType=VARCHAR},#{ctype,jdbcType=INTEGER}
         )
     </insert>
 </mapper>

+ 66 - 5
src/main/resources/mapper/customer/CustomerCarRecMapper.xml

@@ -4,6 +4,7 @@
   <resultMap id="BaseResultMap" type="com.jkcredit.invoice.model.entity.customer.CustomerCarRec">
     <id column="customer_name" jdbcType="VARCHAR" property="customerName" />
     <result column="company_name" jdbcType="VARCHAR" property="companyName" />
+    <result column="companyNum" jdbcType="VARCHAR" property="companyNum" />
     <result column="car_num" jdbcType="VARCHAR" property="carNum" />
     <result column="car_color" jdbcType="VARCHAR" property="carColor" />
     <result column="cust_phone" jdbcType="VARCHAR" property="custPhone" />
@@ -15,7 +16,7 @@
     <result column="fail_reason" jdbcType="VARCHAR" property="failReason" />
   </resultMap>
   <sql id="Base_Column_List">
-    customer_name, company_name, car_num, car_color, cust_phone, etc_num, succ_time, 
+    customer_name,companyNum,company_name, car_num, car_color, cust_phone, etc_num, succ_time,
     fail_time, rec_status,bussiness_type, fail_reason
   </sql>
 
@@ -53,16 +54,21 @@
     from t_customer_carRec
     where etc_num = #{etcNum,jdbcType=VARCHAR} AND bussiness_type=0
   </select>
+  <update id="updateWaitETCStatus" parameterType="com.jkcredit.invoice.model.entity.customer.CustomerCarRec">
+    update t_customer_carRec set rec_status = #{recStatus,jdbcType=INTEGER} ,succ_time = #{succTime,jdbcType=VARCHAR}, fail_time = #{failTime,jdbcType=VARCHAR}
+    , fail_reason = #{failReason,jdbcType=VARCHAR}
+    where companyNum = #{companyNum,jdbcType=VARCHAR} and cust_phone = #{custPhone,jdbcType=VARCHAR} AND bussiness_type=0 and rec_status = 3
+  </update>
   <delete id="selectByCustomerName" parameterType="java.lang.String">
     delete from t_customer_carRec
     where customer_name = #{customerName,jdbcType=VARCHAR}
   </delete>
   <insert id="insert" parameterType="com.jkcredit.invoice.model.entity.customer.CustomerCarRec">
-    insert into t_customer_carRec (customer_name, company_name, car_num, 
+    insert into t_customer_carRec (customer_name,companyNum, company_name, car_num,
       car_color, cust_phone, etc_num, 
       succ_time, fail_time, rec_status,bussiness_type,
       fail_reason)
-    values (#{customerName,jdbcType=VARCHAR}, #{companyName,jdbcType=VARCHAR}, #{carNum,jdbcType=VARCHAR}, 
+    values (#{customerName,jdbcType=VARCHAR},#{companyNum,jdbcType=VARCHAR}, #{companyName,jdbcType=VARCHAR}, #{carNum,jdbcType=VARCHAR},
       #{carColor,jdbcType=VARCHAR}, #{custPhone,jdbcType=VARCHAR}, #{etcNum,jdbcType=VARCHAR}, 
       #{succTime,jdbcType=VARCHAR}, #{failTime,jdbcType=VARCHAR}, #{recStatus,jdbcType=INTEGER},#{businessType,jdbcType=INTEGER},
       #{failReason,jdbcType=VARCHAR})
@@ -73,6 +79,9 @@
       <if test="customerName != null">
         customer_name,
       </if>
+      <if test="companyNum != null">
+        companyNum,
+      </if>
       <if test="companyName != null">
         company_name,
       </if>
@@ -105,6 +114,9 @@
       <if test="customerName != null">
         #{customerName,jdbcType=VARCHAR},
       </if>
+      <if test="companyNum != null">
+        #{companyNum,jdbcType=VARCHAR},
+      </if>
       <if test="companyName != null">
         #{companyName,jdbcType=VARCHAR},
       </if>
@@ -165,7 +177,40 @@
         fail_reason = #{failReason,jdbcType=VARCHAR},
       </if>
     </set>
-    where car_num = #{carNum,jdbcType=VARCHAR}
+    where car_num = #{carNum,jdbcType=VARCHAR}  and bussiness_type=2
+  </update>
+  <update id="updateETCByPrimaryKeySelective" parameterType="com.jkcredit.invoice.model.entity.customer.CustomerCarRec">
+    update t_customer_carRec
+    <set>
+      <if test="companyName != null">
+        company_name = #{companyName,jdbcType=VARCHAR},
+      </if>
+      <if test="carNum != null">
+        car_num = #{carNum,jdbcType=VARCHAR},
+      </if>
+      <if test="carColor != null">
+        car_color = #{carColor,jdbcType=VARCHAR},
+      </if>
+      <if test="custPhone != null">
+        cust_phone = #{custPhone,jdbcType=VARCHAR},
+      </if>
+      <if test="etcNum != null">
+        etc_num = #{etcNum,jdbcType=VARCHAR},
+      </if>
+      <if test="succTime != null">
+        succ_time = #{succTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="failTime != null">
+        fail_time = #{failTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="recStatus != null">
+        rec_status = #{recStatus,jdbcType=INTEGER},
+      </if>
+      <if test="failReason != null">
+        fail_reason = #{failReason,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where etc_num = #{etcNum,jdbcType=VARCHAR} and bussiness_type=0
   </update>
   <update id="updateByPrimaryKey" parameterType="com.jkcredit.invoice.model.entity.customer.CustomerCarRec">
     update t_customer_carRec
@@ -180,6 +225,22 @@
       fail_time = #{failTime,jdbcType=TIMESTAMP},
       rec_status = #{recStatus,jdbcType=INTEGER},
       fail_reason = #{failReason,jdbcType=VARCHAR}
-    where car_num = #{carNum,jdbcType=VARCHAR}
+    where car_num = #{carNum,jdbcType=VARCHAR}  and bussiness_type=2
+  </update>
+
+  <update id="updateETCByPrimaryKey" parameterType="com.jkcredit.invoice.model.entity.customer.CustomerCarRec">
+    update t_customer_carRec
+    set
+    customer_name = #{customerName,jdbcType=VARCHAR},
+    company_name = #{companyName,jdbcType=VARCHAR},
+    car_num = #{carNum,jdbcType=VARCHAR},
+    car_color = #{carColor,jdbcType=VARCHAR},
+    cust_phone = #{custPhone,jdbcType=VARCHAR},
+    etc_num = #{etcNum,jdbcType=VARCHAR},
+    succ_time = #{succTime,jdbcType=TIMESTAMP},
+    fail_time = #{failTime,jdbcType=TIMESTAMP},
+    rec_status = #{recStatus,jdbcType=INTEGER},
+    fail_reason = #{failReason,jdbcType=VARCHAR}
+    where etc_num = #{etcNum,jdbcType=VARCHAR} and bussiness_type=0
   </update>
 </mapper>

+ 6 - 0
src/main/resources/mapper/customer/CustomerRecMapper.xml

@@ -45,6 +45,12 @@
     from t_customer_rec
     where id = #{id,jdbcType=INTEGER}
   </select>
+  <select id="selectByPrimaryKeyHasBase64" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+    select
+    <include refid="Base_Column_List" />,base64Str
+    from t_customer_rec
+    where id = #{id,jdbcType=INTEGER}
+  </select>
   <select id="selectByCustomerName" resultMap="BaseResultMap" parameterType="java.lang.String" >
     select
     <include refid="Base_Column_List" />

+ 6 - 1
src/main/resources/mapper/CustomerRechargeMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.jkcredit.invoice.mapper.CustomerRechargeMapper" >
+<mapper namespace="com.jkcredit.invoice.mapper.customer.CustomerRechargeMapper" >
   <resultMap id="BaseResultMap" type="com.jkcredit.invoice.model.entity.CustomerRecharge" >
     <id column="id" property="id" jdbcType="INTEGER" />
     <result column="customer_name" property="customerName" jdbcType="VARCHAR" />
@@ -10,6 +10,11 @@
   <sql id="Base_Column_List" >
     id, customer_name, recharge_mony, recharge_time
   </sql>
+  <select id="selectAllByPage" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from t_customer_recharge
+  </select>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
     select 
     <include refid="Base_Column_List" />

+ 4 - 4
src/main/resources/mapper/invoice/BillInvoiceMapper.xml

@@ -100,9 +100,9 @@
                 #{invoiceCode,jdbcType=VARCHAR}, #{invoiceMakeTime,jdbcType=VARCHAR}, #{invoiceUrl,jdbcType=VARCHAR},
                 #{invoiceHtmlUrl,jdbcType=VARCHAR}, #{enStation,jdbcType=VARCHAR}, #{exStation,jdbcType=VARCHAR},
                 #{exTime,jdbcType=VARCHAR}, #{fee,jdbcType=INTEGER}, #{totalTaxAmount,jdbcType=INTEGER},
-                #{plateNum,jdbcType=VARCHAR},#{vehicleType,jdbcType=INTEGER},#{sellerName,jdbcType=VARCHAR},
+                #{plateNum,jdbcType=VARCHAR},#{vehicleType,jdbcType=VARCHAR},#{sellerName,jdbcType=VARCHAR},
                 #{sellerTaxpayerCode,jdbcType=VARCHAR},#{waybillStatus,jdbcType=INTEGER}, #{waybillStartTime,jdbcType=VARCHAR}, #{waybillEndTime,jdbcType=VARCHAR}
-                , #{totalAmount,jdbcType=INTEGER}, #{taxRate,jdbcType=DOUBLE},#{invoiceType,jdbcType=INTEGER},#{amount,jdbcType=INTEGER},
+                , #{totalAmount,jdbcType=INTEGER}, #{taxRate,jdbcType=DOUBLE},#{invoiceType,jdbcType=VARCHAR},#{amount,jdbcType=INTEGER},
                 #{transactionId,jdbcType=VARCHAR},#{tradeMatchTime,jdbcType=VARCHAR},#{buyerName,jdbcType=VARCHAR},#{buyerTaxpayerCode,jdbcType=VARCHAR}
         )
     </insert>
@@ -128,7 +128,7 @@
         waybillEndTime	= #{waybillEndTime,jdbcType=VARCHAR},
         totalAmount     = #{totalAmount,jdbcType=INTEGER},
         taxRate			= #{taxRate,jdbcType=DOUBLE},
-        invoiceType		= #{invoiceType,jdbcType=INTEGER},
+        invoiceType		= #{invoiceType,jdbcType=VARCHAR},
         amount			= #{amount,jdbcType=INTEGER},
         transactionId   = #{transactionId,jdbcType=VARCHAR},
         tradeMatchTime	= #{tradeMatchTime,jdbcType=VARCHAR},
@@ -159,7 +159,7 @@
             waybillEndTime	= #{waybillEndTime,jdbcType=VARCHAR},
             totalAmount     = #{totalAmount,jdbcType=INTEGER},
             taxRate			= #{taxRate,jdbcType=DOUBLE},
-            invoiceType		= #{invoiceType,jdbcType=INTEGER},
+            invoiceType		= #{invoiceType,jdbcType=VARCHAR},
             amount			= #{amount,jdbcType=INTEGER},
             transactionId   = #{transactionId,jdbcType=VARCHAR},
             tradeMatchTime	= #{tradeMatchTime,jdbcType=VARCHAR},

+ 4 - 31
src/main/resources/mapper/invoice/SelfCarInvoiceMapper.xml

@@ -89,7 +89,7 @@
         #{exTime,jdbcType=VARCHAR}, #{fee,jdbcType=INTEGER}, #{totalTaxAmount,jdbcType=INTEGER},
         #{plateNum,jdbcType=VARCHAR},#{vehicleType,jdbcType=INTEGER},#{sellerName,jdbcType=VARCHAR},
         #{sellerTaxpayerCode,jdbcType=VARCHAR},
-         #{totalAmount,jdbcType=INTEGER}, #{taxRate,jdbcType=DOUBLE},#{invoiceType,jdbcType=INTEGER},#{amount,jdbcType=INTEGER},
+         #{totalAmount,jdbcType=INTEGER}, #{taxRate,jdbcType=DOUBLE},#{invoiceType,jdbcType=VARCHAR},#{amount,jdbcType=INTEGER},
         #{tradeId,jdbcType=VARCHAR},#{buyerName,jdbcType=VARCHAR},#{buyerTaxpayerCode,jdbcType=VARCHAR}
         )
     </insert>
@@ -112,50 +112,23 @@
         sellerTaxpayerCode = #{sellerTaxpayerCode,jdbcType=VARCHAR},
         totalAmount     = #{totalAmount,jdbcType=INTEGER},
         taxRate			= #{taxRate,jdbcType=DOUBLE},
-        invoiceType		= #{invoiceType,jdbcType=INTEGER},
+        invoiceType		= #{invoiceType,jdbcType=VARCHAR},
         amount			= #{amount,jdbcType=INTEGER},
         tradeId   = #{transactionId,jdbcType=VARCHAR},
         buyerName		= #{buyerName,jdbcType=VARCHAR},
         buyerTaxpayerCode = #{buyerTaxpayerCode,jdbcType=VARCHAR}
         where id = #{id,jdbcType=INTEGER}
     </update>
-
-    <update id="updateByInvoiceNum" parameterType="com.jkcredit.invoice.model.entity.invoice.SelfCarInvoice" >
-        update t_SelfCarInvoice
-         set cardId	    = #{cardId,jdbcType=VARCHAR},
-        invoiceNum	    = #{invoiceNum,jdbcType=VARCHAR},
-        invoiceCode     = #{invoiceCode,jdbcType=VARCHAR},
-        invoiceMakeTime = #{invoiceMakeTime,jdbcType=VARCHAR},
-        invoiceUrl		= #{invoiceUrl,jdbcType=VARCHAR},
-        invoiceHtmlUrl  = #{invoiceHtmlUrl,jdbcType=VARCHAR},
-        enStation	    = #{enStation,jdbcType=VARCHAR},
-        exStation		= #{exStation,jdbcType=VARCHAR},
-        exTime          = #{exTime,jdbcType=VARCHAR},
-        fee			    = #{fee,jdbcType=INTEGER},
-        totalTaxAmount	= #{totalTaxAmount,jdbcType=INTEGER},
-        plateNum        = #{plateNum,jdbcType=VARCHAR},
-        vehicleType		= #{vehicleType,jdbcType=INTEGER},
-        sellerName		= #{sellerName,jdbcType=VARCHAR},
-        sellerTaxpayerCode = #{sellerTaxpayerCode,jdbcType=VARCHAR},
-        totalAmount     = #{totalAmount,jdbcType=INTEGER},
-        taxRate			= #{taxRate,jdbcType=DOUBLE},
-        invoiceType		= #{invoiceType,jdbcType=INTEGER},
-        amount			= #{amount,jdbcType=INTEGER},
-        tradeId   = #{transactionId,jdbcType=VARCHAR},
-        buyerName		= #{buyerName,jdbcType=VARCHAR},
-        buyerTaxpayerCode = #{buyerTaxpayerCode,jdbcType=VARCHAR}
-        where invoiceNum = #{invoiceNum,jdbcType=VARCHAR}
-    </update>
     <select id="selectByTrade" resultMap="BaseResultMap" parameterType="java.lang.String" >
         select
         <include refid="baseSql" />
         from t_SelfCarInvoice
         where tradeId = #{tradeId,jdbcType=VARCHAR}
     </select>
-    <select id="selectByInvoiceNum" resultMap="BaseResultMap" parameterType="java.lang.String" >
+    <select id="selectByTradeAndInvoiceMakeTime" resultMap="BaseResultMap" parameterType="java.lang.String" >
         select
         <include refid="baseSql" />
         from t_SelfCarInvoice
-        where invoiceNum = #{invoiceNum,jdbcType=VARCHAR}
+        where tradeId = #{tradeId,jdbcType=VARCHAR} and invoiceMakeTime = #{invoiceMakeTime,jdbcType=VARCHAR}
     </select>
 </mapper>

+ 30 - 5
src/main/resources/mapper/waybill/NoCarWaybillMapper.xml

@@ -45,12 +45,35 @@
         companyAdress,
         companyBank,
         companyBankAcc,
-        companyTel
+        companyTel,companyNum
     </sql>
     <select id="selectAllByPage" resultMap="BaseResultMap">
         select
         <include refid="baseSql" />
         from t_waybill_no
+        <where>
+            <if test="noCarWayBill.customerName != null and noCarWayBill.customerName != ''">
+                and customerName LIKE CONCAT('%',#{noCarWayBill.customerName},'%')
+            </if>
+            <if test="noCarWayBill.hisFlag != null and noCarWayBill.hisFlag != ''">
+                and hisFlag = #{noCarWayBill.hisFlag}
+            </if>
+        </where>
+    </select>
+    <select id="selectAllByPageException" resultMap="BaseResultMap">
+        select
+        <include refid="baseSql" />
+        from t_waybill_no
+        <where>
+            <if test="noCarWayBill.customerName != null and noCarWayBill.customerName != ''">
+                and customerName LIKE CONCAT('%',#{noCarWayBill.customerName},'%')
+            </if>
+            <if test="noCarWayBill.hisFlag != null and noCarWayBill.hisFlag != ''">
+                and hisFlag = #{noCarWayBill.hisFlag}
+            </if>
+
+             and billwayStatus =2
+        </where>
     </select>
     <insert id="insert" parameterType="com.jkcredit.invoice.model.entity.waybill.NoCarWayBill" >
         insert into t_waybill_no (
@@ -73,7 +96,7 @@
             companyAdress,
             companyBank,
             companyBankAcc,
-            companyTel
+            companyTel,companyNum
         )
         values ( #{customerName,jdbcType=VARCHAR}, #{companyName,jdbcType=VARCHAR},
         #{billNum,jdbcType=VARCHAR}, #{plateNum,jdbcType=VARCHAR}, #{plateColor,jdbcType=VARCHAR},
@@ -81,7 +104,7 @@
         #{predictEndTime,jdbcType=VARCHAR}, #{fee,jdbcType=INTEGER}, #{titleType,jdbcType=INTEGER},
         #{taxplayerCode,jdbcType=VARCHAR},#{intfaceStartTime,jdbcType=VARCHAR},#{InterfaceEndTime,jdbcType=VARCHAR},
         #{billwayStatus,jdbcType=INTEGER},#{hisFlag,jdbcType=INTEGER}, #{companyAdress,jdbcType=VARCHAR}, #{companyBank,jdbcType=VARCHAR}
-        , #{companyBankAcc,jdbcType=VARCHAR}, #{companyTel,jdbcType=VARCHAR}
+        , #{companyBankAcc,jdbcType=VARCHAR}, #{companyTel,jdbcType=VARCHAR},#{companyNum,jdbcType=VARCHAR}
         )
     </insert>
     <update id="updateByPrimaryKey" parameterType="com.jkcredit.invoice.model.entity.waybill.NoCarWayBill" >
@@ -105,7 +128,8 @@
         companyAdress = #{companyAdress,jdbcType=VARCHAR},
         companyBank = #{companyBank,jdbcType=VARCHAR},
         companyBankAcc = #{companyBankAcc,jdbcType=VARCHAR},
-        companyTel = #{companyTel,jdbcType=VARCHAR}
+        companyTel = #{companyTel,jdbcType=VARCHAR},
+        companyNum = #{companyNum,jdbcType=VARCHAR}
         where id = #{id,jdbcType=INTEGER}
     </update>
 
@@ -130,7 +154,8 @@
         companyAdress = #{companyAdress,jdbcType=VARCHAR},
         companyBank = #{companyBank,jdbcType=VARCHAR},
         companyBankAcc = #{companyBankAcc,jdbcType=VARCHAR},
-        companyTel = #{companyTel,jdbcType=VARCHAR}
+        companyTel = #{companyTel,jdbcType=VARCHAR},
+        companyNum = #{companyNum,jdbcType=VARCHAR}
         where billNum = #{billNum,jdbcType=VARCHAR}
     </update>
     <select id="selectByBillNum" resultMap="BaseResultMap" parameterType="java.lang.String" >

+ 1 - 1
src/main/resources/sdk.properties

@@ -2,4 +2,4 @@ dtsServiceURL=https://testdts.txffp.com
 tempPath=e:/dts/tmp
 enableGzip=true
 enableEvent=false
-authStr=000000_issuer123456
+authStr=110017_C1nAi1nC0i