Browse Source

阿里巴巴代码规约问题修改-1 20230115

mashengyi 2 years ago
parent
commit
8fc3cd7ca7
30 changed files with 577 additions and 424 deletions
  1. 5 3
      src/main/java/com/jkcredit/invoice/annotation/annotationdes/AuthenticationInterceptor.java
  2. 110 0
      src/main/java/com/jkcredit/invoice/common/CommonConst.java
  3. 11 0
      src/main/java/com/jkcredit/invoice/common/TokenConst.java
  4. 21 0
      src/main/java/com/jkcredit/invoice/common/WarnMessageConst.java
  5. 8 6
      src/main/java/com/jkcredit/invoice/controller/business/CustomerController.java
  6. 26 34
      src/main/java/com/jkcredit/invoice/controller/business/NoCarController.java
  7. 8 6
      src/main/java/com/jkcredit/invoice/controller/business/SelfCarController.java
  8. 5 2
      src/main/java/com/jkcredit/invoice/controller/user/AuthenticationController.java
  9. 7 17
      src/main/java/com/jkcredit/invoice/credit/InterfaceCheckServer.java
  10. 3 1
      src/main/java/com/jkcredit/invoice/credit/SimpleCoreFilter.java
  11. 90 90
      src/main/java/com/jkcredit/invoice/credit/interserver/CustomerInterLowerServiceImpl.java
  12. 39 55
      src/main/java/com/jkcredit/invoice/credit/interserver/NoCarInterServiceImpl.java
  13. 9 6
      src/main/java/com/jkcredit/invoice/credit/interserver/SelfCarInterServiceImpl.java
  14. 12 8
      src/main/java/com/jkcredit/invoice/service/customer/impl/CustomerServiceImpl.java
  15. 49 49
      src/main/java/com/jkcredit/invoice/service/lowerservice/impl/CustomerLowerServiceImpl.java
  16. 87 77
      src/main/java/com/jkcredit/invoice/service/lowerservice/impl/NoCarServiceImpl.java
  17. 1 1
      src/main/java/com/jkcredit/invoice/service/lowerservice/impl/SelfCarServiceLImpl.java
  18. 6 20
      src/main/java/com/jkcredit/invoice/service/nocar/impl/NoCarBillWayServiceImpl.java
  19. 6 8
      src/main/java/com/jkcredit/invoice/service/nocar/impl/NoCarRecServiceImpl.java
  20. 2 1
      src/main/java/com/jkcredit/invoice/service/upService/CommInterFace.java
  21. 2 2
      src/main/java/com/jkcredit/invoice/service/upService/NoCarInterface.java
  22. 2 1
      src/main/java/com/jkcredit/invoice/service/upService/SelfCarInterface.java
  23. 5 2
      src/main/java/com/jkcredit/invoice/service/upService/impl/CommInterFaceImpl.java
  24. 5 2
      src/main/java/com/jkcredit/invoice/service/upService/impl/NoCarInterfaceImpl.java
  25. 2 2
      src/main/java/com/jkcredit/invoice/service/upService/impl/SelfCarInterfaceImpl.java
  26. 4 2
      src/main/java/com/jkcredit/invoice/service/user/impl/UserServiceImpl.java
  27. 3 1
      src/main/java/com/jkcredit/invoice/util/Base64Util.java
  28. 1 1
      src/main/java/com/jkcredit/invoice/util/Base64Utils.java
  29. 47 26
      src/main/java/com/jkcredit/invoice/util/LogUtils.java
  30. 1 1
      src/main/java/com/jkcredit/invoice/util/QueryDemo_Test.java

+ 5 - 3
src/main/java/com/jkcredit/invoice/annotation/annotationdes/AuthenticationInterceptor.java

@@ -2,7 +2,6 @@ package com.jkcredit.invoice.annotation.annotationdes;
 
 import cn.hutool.json.JSONUtil;
 import com.jkcredit.invoice.annotation.LoginRequired;
-import com.jkcredit.invoice.common.CommonConstants;
 import com.jkcredit.invoice.model.entity.user.User;
 import com.jkcredit.invoice.service.user.UserService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,6 +15,9 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.lang.reflect.Method;
 
+import static com.jkcredit.invoice.common.TokenConst.TOKEN_KEY;
+
+
 /**
  * @description:
  * @author: sunzhaoning
@@ -53,10 +55,10 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
                 throw new RuntimeException("无token,请重新登录");
             }
 
-            if (!redisTemplate.hasKey("user:token:" + token)) {
+            if (!redisTemplate.hasKey(TOKEN_KEY + token)) {
                 throw new RuntimeException("token已过期,请重新登录");
             }
-            User user = JSONUtil.toBean(redisTemplate.opsForValue().get(CommonConstants.TOKEN_KEY + token).toString(), User.class);
+            User user = JSONUtil.toBean(redisTemplate.opsForValue().get(TOKEN_KEY + token).toString(), User.class);
             if (user == null) {
                 throw new RuntimeException("用户不存在,请重新登录");
             }

+ 110 - 0
src/main/java/com/jkcredit/invoice/common/CommonConst.java

@@ -0,0 +1,110 @@
+package com.jkcredit.invoice.common;
+
+/**
+ * @Description:魔法值 相关常量
+ * @Author: junqiang.lu
+ * @Date: 2019/12/3
+ */
+public class CommonConst {
+
+    /**
+     * 逗号
+     */
+    public static final String COMMA = ",";
+
+    /**
+     * 逗号
+     */
+    public static final char COMMAS = ',';
+
+    /**
+     *  0 -自有车
+     *  1 -外协车
+     *  2 -无车
+     */
+    public static final String SELF_CAR = "0";
+    public static final String FOREIGE_CAR = "1";
+    public static final String NO_CAR = "2";
+
+
+
+    public static final String ZERO = "0";
+    public static final String ONE = "1";
+    public static final String TWO = "2";
+    public static final String THREE = "3";
+    public static final String FOR = "4";
+    public static final String FIVE = "5";
+    public static final String SIX = "6";
+    public static final String SEVEN = "7";
+    public static final String EIGHT = "8";
+    public static final String NINE = "9";
+    public static final String TEN = "10";
+
+    public static final int ZERO_NUM = 0;
+    public static final int ONE_NUM = 1;
+    public static final int TWO_NUM = 2;
+    public static final int THREE_NUM = 3;
+    public static final int FOR_NUM = 4;
+    public static final int FIVE_NUM = 5;
+    public static final int SIX_NUM = 6;
+    public static final int SEVEN_NUM = 7;
+    public static final int EIGHT_NUM = 8;
+    public static final int NINE_NUM = 9;
+    public static final int TEN_NUM = 10;
+    public static final int A_THOUSAND = 1000;
+
+
+    public static final int NE_ONE_NUM = -1;
+    public static final int NE_TWO_NUM = -2;
+    public static final int NE_THREE_NUM = -3;
+    public static final int NE_FOR_NUM = -4;
+    public static final int NE_FIVE_NUM = -5;
+    public static final int NE_SIX_NUM = -6;
+    public static final int NE_SEVEN_NUM = -7;
+    public static final int NE_EIGHT_NUM = -8;
+    public static final int NE_NINE_NUM = -9;
+    public static final int NE_TEN_NUM = -10;
+
+    /**
+     * NULL
+     */
+    public static final String NULL = "null";
+
+    public static final int COMPUTE = 10 * 1024 * 1024;
+
+
+    /***********备案状态或者公司类型*********/
+    public static final int REC_STATUS_FAIL = 0;
+    public static final int REC_STATUS_SUC = 1;
+    public static final int REC_STATUS_UN = 2;
+    public static final int REC_STATUS_WAIT = 3;
+
+
+    public static final int INTONE = -72;
+    public static final int INTTOW = -20;
+    public static final int INTTHREE = -96;
+
+
+    /**
+     * result
+     */
+    public static final String RESULT = "result";
+
+    /**
+     * XyWaybillHistoryEnd
+     */
+    public static final String XY_WAYBILL_HISTORY_END = "XyWaybillHistoryEnd";
+
+    /**
+     * 未查得
+     */
+    public static final String NOT_FOUND = "未查得";
+
+    public static final String PATH = "/";
+    public static final String USER_PATH = "/user/";
+    public static final String STATIC_PATH = "/static/";
+    public static final String CONTEXT_PATH = "/jkcredit/";
+
+
+
+}

+ 11 - 0
src/main/java/com/jkcredit/invoice/common/TokenConst.java

@@ -16,6 +16,17 @@ public class TokenConst {
      * token key
      */
     public static final String TOKEN_KEY = "tokenPhone";
+
+    /**
+     * token model
+     */
+    public static final String TOKEN = "user:token:";
+
+    public static final int STATUS_SUC = 1;
+
+    public static final int STATUS_UN = 2;
+
+
     /**
      * Token 刷新时间(单位: 毫秒)
      */

+ 21 - 0
src/main/java/com/jkcredit/invoice/common/WarnMessageConst.java

@@ -0,0 +1,21 @@
+package com.jkcredit.invoice.common;
+
+/**
+ * @Description:魔法值 相关常量
+ * @Author: junqiang.lu
+ * @Date: 2019/12/3
+ */
+public class WarnMessageConst {
+
+    /**
+     * 备案信息为空
+     */
+    public static final String FILING_INFORMATION_IS_EMPTY_MESSAGE = "备案信息为空";
+
+    /**
+     * 协议上传信息为空
+     */
+    public static final String PROTOCOL_UPLOAD_INFO_IS_EMPTY_MESSAGE = "协议上传信息为空";
+
+
+}

+ 8 - 6
src/main/java/com/jkcredit/invoice/controller/business/CustomerController.java

@@ -39,6 +39,8 @@ import java.io.OutputStream;
 import java.net.URLEncoder;
 import java.util.*;
 
+import static com.jkcredit.invoice.common.CommonConst.*;
+
 /**
  * 客户操作
  */
@@ -133,9 +135,9 @@ public class CustomerController {
         if(customerRecs!=null && customerRecs.size()>0){
             customerRecs.stream().forEach(customerRec1 -> {
 
-                if("2".equals(customerRec1.getBussinessType())){
+                if(NO_CAR.equals(customerRec1.getBussinessType())){
                     customerRec1.setBussinessType("无车");
-                }else if("0".equals(customerRec1.getBussinessType())){
+                }else if(SELF_CAR.equals(customerRec1.getBussinessType())){
                     customerRec1.setBussinessType("自有车");
                 }
             });
@@ -395,10 +397,10 @@ public class CustomerController {
     @LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
     public RespR findCustomerRecTimeList(Page page, CustomerRec customerRec) {
         IPage ipage = null;
-        if((StringUtils.isNotEmpty(customerRec.getServiceEndTime())  && !"null".equals(customerRec.getServiceEndTime()))||
-                (StringUtils.isNotEmpty(customerRec.getCompanyName())  && !"null".equals(customerRec.getCompanyName()))||
-        (StringUtils.isNotEmpty(customerRec.getCompanyBelongName())  && !"null".equals(customerRec.getCompanyBelongName()))){
-            if(StringUtils.isNotEmpty(customerRec.getServiceEndTime())  && !"null".equals(customerRec.getServiceEndTime())){
+        if((StringUtils.isNotEmpty(customerRec.getServiceEndTime())  && !NULL.equals(customerRec.getServiceEndTime()))||
+                (StringUtils.isNotEmpty(customerRec.getCompanyName())  && !NULL.equals(customerRec.getCompanyName()))||
+        (StringUtils.isNotEmpty(customerRec.getCompanyBelongName())  && !NULL.equals(customerRec.getCompanyBelongName()))){
+            if(StringUtils.isNotEmpty(customerRec.getServiceEndTime())  && !NULL.equals(customerRec.getServiceEndTime())){
             String [] res =customerRec.getServiceEndTime().split(",");
             customerRec.setServiceEndTimeStart(res[0]);
             customerRec.setServiceEndTimeEnd(res[1].replace("00:00:00","23:59:59"));

+ 26 - 34
src/main/java/com/jkcredit/invoice/controller/business/NoCarController.java

@@ -40,6 +40,9 @@ import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+
+import static com.jkcredit.invoice.common.CommonConst.*;
+
 @Api(tags = "无车操作")
 @RestController
 @RequestMapping(value = {"/noCar"})
@@ -54,8 +57,6 @@ import java.util.List;
 *
 */
 public class NoCarController {
-
-
     
     @Autowired
     NoCarRecService noCarRecService;
@@ -93,7 +94,7 @@ public class NoCarController {
     public RespR getCustomersByPage(Page page, CustomerCarRec customerCarRec,User user) {
         try {
             checkHasAuthRole.checkCustomerRole(user,customerCarRec.getCustomerName());
-            if(!StringUtils.isEmpty(customerCarRec.getStartTime()) && !"null".equals(customerCarRec.getStartTime())){
+            if(!StringUtils.isEmpty(customerCarRec.getStartTime()) && !NULL.equals(customerCarRec.getStartTime())){
                 String [] res = customerCarRec.getStartTime().split(",");
                 customerCarRec.setStartTime(res[0]);
                 customerCarRec.setEndTime(res[1].replace("00:00:00","23:59:59"));
@@ -108,14 +109,14 @@ public class NoCarController {
         }
     }
     public void setTimeDue(NoCarWayBill noCarWayBill){
-        if(!StringUtils.isEmpty(noCarWayBill.getStartBegin()) && !"null".equals(noCarWayBill.getStartBegin())){
+        if(!StringUtils.isEmpty(noCarWayBill.getStartBegin()) && !NULL.equals(noCarWayBill.getStartBegin())){
             String [] res = noCarWayBill.getStartBegin().split(",");
             noCarWayBill.setStartBegin(res[0]);
             noCarWayBill.setStartEnd(res[1].replace("00:00:00","23:59:59"));
         }else{
             noCarWayBill.setStartBegin(null);
         }
-        if(!StringUtils.isEmpty(noCarWayBill.getEndBegin()) && !"null".equals(noCarWayBill.getEndBegin())){
+        if(!StringUtils.isEmpty(noCarWayBill.getEndBegin()) && !NULL.equals(noCarWayBill.getEndBegin())){
             String [] res = noCarWayBill.getEndBegin().split(",");
             noCarWayBill.setEndBegin(res[0]);
             noCarWayBill.setEndEnd(res[1].replace("00:00:00","23:59:59"));
@@ -126,16 +127,16 @@ public class NoCarController {
 
 
     public void setTimeDue2(NoCarWayBill noCarWayBill){
-        if("null".equals(noCarWayBill.getStartBegin())){
+        if(NULL.equals(noCarWayBill.getStartBegin())){
             noCarWayBill.setStartBegin(null);
         }
-        if("null".equals(noCarWayBill.getStartEnd())){
+        if(NULL.equals(noCarWayBill.getStartEnd())){
             noCarWayBill.setStartEnd(null);
         }
-        if("null".equals(noCarWayBill.getEndBegin())){
+        if(NULL.equals(noCarWayBill.getEndBegin())){
             noCarWayBill.setEndBegin(null);
         }
-        if("null".equals(noCarWayBill.getEndEnd())){
+        if(NULL.equals(noCarWayBill.getEndEnd())){
             noCarWayBill.setEndEnd(null);
         }
     }
@@ -274,12 +275,12 @@ public class NoCarController {
         }
     }
     private void setParams(BillInvoice billInvoice){
-        if(!StringUtils.isEmpty(billInvoice.getInvoiceMakeTime()) && !"null".equals(billInvoice.getInvoiceMakeTime())){
+        if(!StringUtils.isEmpty(billInvoice.getInvoiceMakeTime()) && !NULL.equals(billInvoice.getInvoiceMakeTime())){
             String [] res =billInvoice.getInvoiceMakeTime().split(",");
             billInvoice.setInvoiceMakeStart(res[0]);
             billInvoice.setInvoiceMakeEnd(res[1].replace("00:00:00","23:59:59"));
         }
-        if(!StringUtils.isEmpty(billInvoice.getCalculateTime()) && !"null".equals(billInvoice.getCalculateTime())){
+        if(!StringUtils.isEmpty(billInvoice.getCalculateTime()) && !NULL.equals(billInvoice.getCalculateTime())){
             String [] res =billInvoice.getCalculateTime().split(",");
             billInvoice.setCalculateTimeStart(res[0]);
             billInvoice.setCalculateTimeEnd(res[1].replace("00:00:00","23:59:59"));
@@ -289,10 +290,10 @@ public class NoCarController {
             billInvoice.setWaybillNums(Arrays.asList(billNumArr));
         }
         if(!StringUtils.isEmpty(billInvoice.getPlateNum())){
-            String [] plateNums = billInvoice.getPlateNum().split(",");
+            String [] plateNums = billInvoice.getPlateNum().split(COMMA);
             billInvoice.setPlateNums(Arrays.asList(plateNums));
         }
-        if(!StringUtils.isEmpty(billInvoice.getInvoiceCode()) && billInvoice.getInvoiceCode().indexOf(',')>0){
+        if(!StringUtils.isEmpty(billInvoice.getInvoiceCode()) && billInvoice.getInvoiceCode().indexOf(COMMAS)>0){
             String [] invoiceCodeArr = billInvoice.getInvoiceCode().split(",");
             String [] invoiceNumArr=null;
             if( billInvoice.getInvoiceNum()!=null){
@@ -375,12 +376,12 @@ public class NoCarController {
     public RespR findNocarInvoicesStatic(BillInvoice billInvoice,User user) {
         checkHasAuthRole.checkCustomerRole(user,billInvoice.getCustomerName());
         try {
-            if(!StringUtils.isEmpty(billInvoice.getInvoiceMakeTime()) && !"null".equals(billInvoice.getInvoiceMakeTime())){
+            if(!StringUtils.isEmpty(billInvoice.getInvoiceMakeTime()) && !NULL.equals(billInvoice.getInvoiceMakeTime())){
                 String [] res =billInvoice.getInvoiceMakeTime().split(",");
                 billInvoice.setInvoiceMakeStart(res[0]);
                 billInvoice.setInvoiceMakeEnd(res[1].replace("00:00:00","23:59:59"));
             }
-            if(!StringUtils.isEmpty(billInvoice.getCalculateTime()) && !"null".equals(billInvoice.getCalculateTime())){
+            if(!StringUtils.isEmpty(billInvoice.getCalculateTime()) && !NULL.equals(billInvoice.getCalculateTime())){
                 String [] res =billInvoice.getCalculateTime().split(",");
                 billInvoice.setCalculateTimeStart(res[0]);
                 billInvoice.setCalculateTimeEnd(res[1].replace("00:00:00","23:59:59"));
@@ -481,13 +482,10 @@ public class NoCarController {
             NoCarWayBill noCarWayBill = list.get(j);
             try {
                 if(null == noCarWayBill){
-
                     log.error("buildDateError"+sb.toString()+"第"+(j+1)+"行数据存在错误,请检查数据是否未传递");
                     strError =  "第"+(j+1)+"行数据存在错误,请检查数据是否未传递";
                     throw new RuntimeException("第"+(j+1)+"行数据存在错误,请检查数据是否未传递");
                 }
-
-
                 if(org.apache.commons.lang3.StringUtils.isBlank(noCarWayBill.getBillNum())){
                     log.error("buildDateError"+sb.toString()+"第"+(j+1)+"行数据存在错误,请检查运单编号是否未输入或者输入是否正确");
                     strError =   "第"+(j+1)+"行数据存在错误,请检查运单编号是否未输入或者输入是否正确";
@@ -533,8 +531,6 @@ public class NoCarController {
                     strError =   "第"+(j+1)+"行数据存在错误,请检查税号是否未输入或者输入是否正确";
                     throw new RuntimeException("第"+(j+1)+"行数据存在错误,请检查税号是否未输入或者输入是否正确");
                 }
-
-
                 noCarWayBill.setStartTime(format.format(noCarWayBill.getStartTimeDate()));
                 noCarWayBill.setPredictEndTime(format.format(noCarWayBill.getPredictEndTimeDate()));
                 if(noCarWayBill.getFeeD() !=null){
@@ -547,7 +543,6 @@ public class NoCarController {
                 log.error(noCarWayBill.getBillNum());
                 i++;
             }
-
         }
         if(i>0){
             log.error(org.apache.commons.lang3.StringUtils.isBlank(strError)?"buildDateError"+sb.toString()+"第"+i+"行数据存在错误,请检查文件中数据,金额是否有空的,时间是否全是时间格式":"buildDateError"+sb.toString()+strError);
@@ -568,7 +563,6 @@ public class NoCarController {
                     strError =  "第"+(j+1)+"行数据存在错误,请检查数据是否未传递";
                     throw new RuntimeException("第"+(j+1)+"行数据存在错误,请检查数据是否未传递");
                 }
-
                 if(org.apache.commons.lang3.StringUtils.isBlank(noCarWayBill.getBillNum())){
                     log.error("buildDateError"+sb.toString()+"第"+(j+1)+"行数据存在错误,请检查运单编号是否未输入或者输入是否正确");
                     strError =   "第"+(j+1)+"行数据存在错误,请检查运单编号是否未输入或者输入是否正确";
@@ -584,8 +578,6 @@ public class NoCarController {
                     strError =   "第"+(j+1)+"行数据存在错误,请检查运单目的地址是否未输入或者输入是否正确";
                     throw new RuntimeException("第"+(j+1)+"行数据存在错误,请检查运单目的地址是否未输入或者输入是否正确");
                 }
-
-
                 noCarWayBill.setPredictEndTime(format.format(noCarWayBill.getActEndTimeDate()));
             }catch (Exception e){
                 sb.append(noCarWayBill.getBillNum()+"#");
@@ -667,21 +659,21 @@ public class NoCarController {
     @GetMapping("/templateDownload")
     @ApiOperation(value="模板下载", notes="模板下载")
     public RespR contractDownload(String fileName,HttpServletResponse response){
-            if("1".equals(fileName)){
+            if(ONE.equals(fileName)){
                 fileName = "运单模板.xlsx";
-            }else if("2".equals(fileName)){
+            }else if(TWO.equals(fileName)){
                 fileName = "运单结束模板.xlsx";
-            }else if("3".equals(fileName)){
+            }else if(THREE.equals(fileName)){
                 fileName = "历史运单模板.xlsx";
-            }else if("4".equals(fileName)){
+            }else if(FOR.equals(fileName)){
                 fileName = "无车发票查询模板.xlsx";
-            }else if("5".equals(fileName)){
+            }else if(FIVE.equals(fileName)){
                 fileName = "无车运单查询模板.xlsx";
-            }else if("6".equals(fileName)){
+            }else if(SIX.equals(fileName)){
                 fileName = "自有车交易查询模板.xlsx";
-            }else if("7".equals(fileName)){
+            }else if(SEVEN.equals(fileName)){
                 fileName = "自有车发票查询模板.xlsx";
-            }else if("8".equals(fileName)){
+            }else if(EIGHT.equals(fileName)){
                 fileName = "自有车按交易查询申请模板.xlsx";
             }
             OutputStream outputStream = null;
@@ -703,14 +695,14 @@ public class NoCarController {
         return new RespR(false);
     }
     public void setTimeDue1(NoCarCalculateInfor carCalculateInfor){
-        if(!StringUtils.isEmpty(carCalculateInfor.getInvoiceMakeTime()) && !"null".equals(carCalculateInfor.getInvoiceMakeTime())){
+        if(!StringUtils.isEmpty(carCalculateInfor.getInvoiceMakeTime()) && !NULL.equals(carCalculateInfor.getInvoiceMakeTime())){
             String [] res = carCalculateInfor.getInvoiceMakeTime().split(",");
             carCalculateInfor.setInvoiceMakeStart(res[0]);
             carCalculateInfor.setInvoiceMakeEnd(res[1].replace("00:00:00","23:59:59"));
         }else{
             carCalculateInfor.setInvoiceMakeTime(null);
         }
-        if(!StringUtils.isEmpty(carCalculateInfor.getCalculateTime()) && !"null".equals(carCalculateInfor.getCalculateTime())){
+        if(!StringUtils.isEmpty(carCalculateInfor.getCalculateTime()) && !NULL.equals(carCalculateInfor.getCalculateTime())){
             String [] res = carCalculateInfor.getCalculateTime().split(",");
             carCalculateInfor.setCalculateStart(res[0]);
             carCalculateInfor.setCalculateEnd(res[1].replace("00:00:00","23:59:59"));

+ 8 - 6
src/main/java/com/jkcredit/invoice/controller/business/SelfCarController.java

@@ -1,4 +1,5 @@
 package com.jkcredit.invoice.controller.business;
+
 import cn.afterturn.easypoi.excel.ExcelImportUtil;
 import cn.afterturn.easypoi.excel.entity.ImportParams;
 import cn.com.taiji.sdk.model.comm.protocol.tts.invoice.server.B2BInvoiceListModel;
@@ -18,7 +19,6 @@ import com.jkcredit.invoice.model.entity.invoice.SelfCarInvoice;
 import com.jkcredit.invoice.model.entity.user.User;
 import com.jkcredit.invoice.model.entity.waybill.SelfCarTrade;
 import com.jkcredit.invoice.model.vo.CardAndTradeVo;
-import com.jkcredit.invoice.model.vo.CodeAndNumVo;
 import com.jkcredit.invoice.service.calculateinfor.SelfCarCalculateInfoService;
 import com.jkcredit.invoice.service.customer.CustomerService;
 import com.jkcredit.invoice.service.lowerservice.CheckHasAuthRole;
@@ -40,6 +40,8 @@ import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
+import static com.jkcredit.invoice.common.CommonConst.NULL;
+
 @Api(tags = "自有车操作")
 @RestController
 @RequestMapping(value = {"/selfCar"})
@@ -224,14 +226,14 @@ public class SelfCarController {
         }else if(!StringUtils.isEmpty(selfCarTrade.getTradeId())){
             selfCarTrade.setTradeIds(Arrays.asList(selfCarTrade.getTradeId().split(",")));
         }
-        if(!StringUtils.isEmpty(selfCarTrade.getAclTimeBegin()) && !"null".equals(selfCarTrade.getAclTimeBegin())){
+        if(!StringUtils.isEmpty(selfCarTrade.getAclTimeBegin()) && !NULL.equals(selfCarTrade.getAclTimeBegin())){
             String [] res = selfCarTrade.getAclTimeBegin().split(",");
             selfCarTrade.setAclTimeBegin(res[0]);
             selfCarTrade.setAclTimeEnd(res[1].replace("00:00:00","23:59:59"));
         }else{
             selfCarTrade.setAclTimeBegin(null);
         }
-        if(!StringUtils.isEmpty(selfCarTrade.getExTimeBegin()) && !"null".equals(selfCarTrade.getExTimeBegin())){
+        if(!StringUtils.isEmpty(selfCarTrade.getExTimeBegin()) && !NULL.equals(selfCarTrade.getExTimeBegin())){
             String [] res = selfCarTrade.getExTimeBegin().split(",");
             selfCarTrade.setExTimeBegin(res[0]);
             selfCarTrade.setExTimeEnd(res[1].replace("00:00:00","23:59:59"));
@@ -274,7 +276,7 @@ public class SelfCarController {
             }else if(!StringUtils.isEmpty(selfCarInvoice.getTradeId())){
                 selfCarInvoice.setTradeIds(Arrays.asList(selfCarInvoice.getTradeId().split(",")));
             }
-            if(!StringUtils.isEmpty(selfCarInvoice.getInvoiceMakeTime()) && !"null".equals(selfCarInvoice.getInvoiceMakeTime())){
+            if(!StringUtils.isEmpty(selfCarInvoice.getInvoiceMakeTime()) && !NULL.equals(selfCarInvoice.getInvoiceMakeTime())){
                 String [] res =selfCarInvoice.getInvoiceMakeTime().split(",");
                 selfCarInvoice.setInvoiceMakeStart(res[0]);
                 selfCarInvoice.setInvoiceMakeEnd(res[1].replace("00:00:00","23:59:59"));
@@ -299,7 +301,7 @@ public class SelfCarController {
     public RespR findSelfcarCalculateInfo(Page page, SelfCarCalculateInfor carCalculateInfor,User user) {
         try {
             checkHasAuthRole.checkCustomerRole(user,carCalculateInfor.getCustomId());
-            if(!StringUtils.isEmpty(carCalculateInfor.getCalTime()) && !"null".equals(carCalculateInfor.getCalTime())){
+            if(!StringUtils.isEmpty(carCalculateInfor.getCalTime()) && !NULL.equals(carCalculateInfor.getCalTime())){
                 String [] res =carCalculateInfor.getCalTime().split(",");
                 carCalculateInfor.setCalTimeStart(res[0]);
                 carCalculateInfor.setCalTimeEnd(res[1]);
@@ -344,7 +346,7 @@ public class SelfCarController {
     public RespR findSelfcarCalculateInfoSta(SelfCarCalculateInfor carCalculateInfor,User user) {
         try {
             checkHasAuthRole.checkCustomerRole(user,carCalculateInfor.getCustomId());
-            if(!StringUtils.isEmpty(carCalculateInfor.getCalTime()) && !"null".equals(carCalculateInfor.getCalTime())){
+            if(!StringUtils.isEmpty(carCalculateInfor.getCalTime()) && !NULL.equals(carCalculateInfor.getCalTime())){
                 String [] res =carCalculateInfor.getCalTime().split(",");
                 carCalculateInfor.setCalTimeStart(res[0]);
                 carCalculateInfor.setCalTimeEnd(res[1]);

+ 5 - 2
src/main/java/com/jkcredit/invoice/controller/user/AuthenticationController.java

@@ -15,6 +15,9 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import static com.jkcredit.invoice.common.TokenConst.STATUS_SUC;
+import static com.jkcredit.invoice.common.TokenConst.STATUS_UN;
+
 /**
  * @description:
  * @author: sunzhaoning
@@ -43,9 +46,9 @@ public class AuthenticationController {
         String password = user.getPassword();
         if (userInDataBase == null) {
             return new RespR<>(Boolean.FALSE, "用户不存在");
-        } else if (1==userInDataBase.getIsLock()) {
+        } else if (STATUS_SUC == userInDataBase.getIsLock()) {
             return new RespR<>(Boolean.FALSE, "该账号已被锁定");
-        }else if(2==userInDataBase.getIsLock()){
+        }else if(STATUS_UN == userInDataBase.getIsLock()){
             return new RespR<>(Boolean.FALSE, "该账号已停用");
         }else if (!StrUtil.equals(MD5Util.encrypt(password), userInDataBase.getPassword())) {
             return new RespR<>(Boolean.FALSE, "密码不正确");

+ 7 - 17
src/main/java/com/jkcredit/invoice/credit/InterfaceCheckServer.java

@@ -25,20 +25,23 @@ public class InterfaceCheckServer {
 
     //跳转到对应的Service服务处理逻辑
     public  DataResult doJumpHandler(String appKey, String api, String data,String requestid ) {
-
         log.info("[-InterfaceCheckServer.doJumpHandler-] request appKey=" + appKey + " ,api=" + api + " ,data=" +data + " ,requestid=" +requestid);
-
         long startTime = System.currentTimeMillis();
-
         DataResult resultTimeOut = new DataResult();
         resultTimeOut.setData(3);
         resultTimeOut.setCode(200);
         resultTimeOut.setRequestid(requestid);
         resultTimeOut.setMsg("网络异常");
+        DataResult result;
+        result = getDataResult(appKey, api, data, requestid, resultTimeOut);
+        log.info("[-InterfaceCheckServer.doJumpHandler-] result appKey=" + appKey + " ,api=" + api + " ,data=" +data + " ,requestid=" +requestid+ " ,result="+result + " ,costTime="+(System.currentTimeMillis()-startTime) );
+        return result;
 
+    }
+
+    private DataResult getDataResult(String appKey, String api, String data, String requestid, DataResult resultTimeOut) {
         DataResult result;
         switch (api){
-
             //----------------------------自有车、无车公共接口---------------------------------//
             case "COMPANY_ADD_V1"://无车、自有车企业注册
                 if(StatisRequestIdTimeComp.isLimit){
@@ -80,9 +83,6 @@ public class InterfaceCheckServer {
                     statisRequestIdTimeComp.removeReQuestIdAndTime(requestid);
                 }
                 break;
-
-
-
                 //----------------------------自有车下游接口---------------------------------//
             case "CARD_BIND_QUERY_LIST_V1"://自有车 用户卡列表查询
                 if(StatisRequestIdTimeComp.isLimit){
@@ -154,7 +154,6 @@ public class InterfaceCheckServer {
                     statisRequestIdTimeComp.removeReQuestIdAndTime(requestid);
                 }
                 break;
-
             case "B2B_INVOICE_APPL_QUERY_V1"://自有车 已开发票查询接口 根据开票id进行查询。
                 if(StatisRequestIdTimeComp.isLimit){
                     log.info("InterfaceCheckServer.doJumpHandler,appKey=" + appKey + " ,api="+api + " ,data=" + data + " ,requestid=" + requestid +"=被拒绝");
@@ -178,7 +177,6 @@ public class InterfaceCheckServer {
             case "CARD_UNBIND_V1"://自有车 卡解绑接口。
                 result = selfCarInterService.customerCarUnRec(appKey,api,data,requestid);
                 break;
-
             case "B2B_CHANGE_CARD_V1"://自有车 用户卡换绑。
                 result = selfCarInterService.customerCardChange(appKey,api,data,requestid);
                 break;
@@ -188,9 +186,6 @@ public class InterfaceCheckServer {
             case "B2B_QUERY_TRADE_APPLY_V1"://自有车 按交易查申请。
                 result = selfCarInterService.tradeApplyQuery(appKey,api,data,requestid);
                 break;
-
-
-
             //----------------------------无车下游接口---------------------------------//
             case "VEHICLE_REGISTER"://无车 车辆备案接口
                 if(StatisRequestIdTimeComp.isLimit){
@@ -275,7 +270,6 @@ public class InterfaceCheckServer {
                     statisRequestIdTimeComp.removeReQuestIdAndTime(requestid);
                 }
                 break;
-
             case "RED_INK_INVOICE_QUERY"://无车  红冲发票查询接口
                 if(StatisRequestIdTimeComp.isLimit){
                     log.info("InterfaceCheckServer.doJumpHandler,appKey=" + appKey + " ,api="+api + " ,data=" + data + " ,requestid=" + requestid +"=被拒绝");
@@ -293,10 +287,6 @@ public class InterfaceCheckServer {
                 result = null;
                 break;
         }
-
-        log.info("[-InterfaceCheckServer.doJumpHandler-] result appKey=" + appKey + " ,api=" + api + " ,data=" +data + " ,requestid=" +requestid+ " ,result="+result + " ,costTime="+(System.currentTimeMillis()-startTime) );
-
         return result;
-
     }
 }

+ 3 - 1
src/main/java/com/jkcredit/invoice/credit/SimpleCoreFilter.java

@@ -22,6 +22,8 @@ import java.net.URLDecoder;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
+import static com.jkcredit.invoice.common.CommonConst.*;
+
 /**
  * @Description: 跨域请求拦截器
  * @Author: mashengyi
@@ -231,7 +233,7 @@ public class SimpleCoreFilter implements Filter {
          * 这些映射无需进行api/appSecret等参数校验,故过滤
          */
         boolean flag = (!Arrays.asList(NO_TOKEN_API_PATHS).contains(httpRequest.getRequestURI()));
-        if(httpRequest.getRequestURI().contains("/user/") || "/".equals(httpRequest.getRequestURI()) || httpRequest.getRequestURI().contains("/static/") || httpRequest.getRequestURI().contains("/jkcredit/")){
+        if(httpRequest.getRequestURI().contains(USER_PATH) || PATH.equals(httpRequest.getRequestURI()) || httpRequest.getRequestURI().contains(STATIC_PATH) || httpRequest.getRequestURI().contains(CONTEXT_PATH)){
             flag = false;
         }
         if (flag) {

+ 90 - 90
src/main/java/com/jkcredit/invoice/credit/interserver/CustomerInterLowerServiceImpl.java

@@ -8,7 +8,8 @@ import com.jkcredit.invoice.model.entity.customer.Customer;
 import com.jkcredit.invoice.model.entity.customer.CustomerRec;
 import com.jkcredit.invoice.service.customer.CustomerService;
 import com.jkcredit.invoice.service.lowerservice.CustomeLowerService;
-import com.jkcredit.invoice.util.*;
+import com.jkcredit.invoice.util.DateUtil;
+import com.jkcredit.invoice.util.RespR;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,6 +19,8 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
+import static com.jkcredit.invoice.common.CommonConst.COMPUTE;
+
 
 @Service("customerInterLowerService")
 @Slf4j
@@ -121,62 +124,71 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
                 return  result;
             }
 
-            CustomerRec customerRec = new CustomerRec();
-            customerRec.setCustomerName(customerName);//客户名称
-            customerRec.setCompanyLeader(contact);//紧急联系人
-            customerRec.setCompanyLeaderPhone(tel);//紧急联系人电话
-            customerRec.setCompanyName(name);//企业名称
-            customerRec.setCompanyReferencenum(taxpayerCode);//企业税号
-            customerRec.setCompanyOpenbank(buyerBank);//公司开户行
-            customerRec.setCompanyOpenbankAcc(buyerBankAccount);//公司开户行电话
-            customerRec.setCompanyAdress(buyerAddr);//公司地址
-            customerRec.setCompanyPhone(buyerTel);//公司电话
-            customerRec.setInterType(interType);////0-接口 1-平台
-            customerRec.setBussinessType(String.valueOf(cust.getBussinessType()));//业务类型 0 -自有车 1-外协车 2-无车
-            customerRec.setOperatingRangeType(operatingRangeType);//运用类型
-            customerRec.setCompanyType(companyType);//所属类型
-
-            List<CustomerRec> customerRecs = new ArrayList<CustomerRec>();
-            customerRecs.add(customerRec);
-            RespR rs = lowerService.customeRec(customerRecs);
-            long costtimeend = System.currentTimeMillis();
-            log.info("[-CustomerInterLowerServiceImpl.customeInterRec-] result is "
-                    + rs.toString() + ", request is " + data + " ,costtime="
-                    + (costtimeend - costtimestart));
+            CustomerRec customerRec = getCustomerRec(interType, name, taxpayerCode, customerName, cust, companyType, operatingRangeType, contact, tel, buyerAddr, buyerTel, buyerBank, buyerBankAccount);
 
-            //返回成功
-            if(null != rs && rs.getCode() == 0){
+            return getDataResult(data, costtimestart, result, customerRec);
+        } catch (Exception e) {
+            log.error("[-CustomerInterLowerServiceImpl.customeInterRec-] get httpclient exception is "
+                    + e + ", request is " + data);
+        }
+        return result;
+    }
 
-                RespR rs1 =  customerService.customeRec(customerRec);
-                log.info("[-CustomerInterLowerServiceImpl.customeInterRecRc1-] result is "
-                        + rs1.toString() + ", request is " + data + " ,costtime="
-                        + (System.currentTimeMillis() - costtimestart));
+    private DataResult getDataResult(String data, long costtimestart, DataResult result, CustomerRec customerRec) {
+        List<CustomerRec> customerRecs = new ArrayList<CustomerRec>();
+        customerRecs.add(customerRec);
+        RespR rs = lowerService.customeRec(customerRecs);
+        long costtimeend = System.currentTimeMillis();
+        log.info("[-CustomerInterLowerServiceImpl.customeInterRec-] result is "
+                + rs.toString() + ", request is " + data + " ,costtime="
+                + (costtimeend - costtimestart));
 
+        //返回成功
+        if(null != rs && rs.getCode() == 0){
 
-                if(null != rs1 && rs1.getCode() == 0){
-                    result.setData(1);
-                    result.setCode(200);
-                    result.setMsg(rs1.getMsg());
-                    return result;
+            RespR rs1 =  customerService.customeRec(customerRec);
+            log.info("[-CustomerInterLowerServiceImpl.customeInterRecRc1-] result is "
+                    + rs1.toString() + ", request is " + data + " ,costtime="
+                    + (System.currentTimeMillis() - costtimestart));
 
-                }else {
-                    result.setData(3);
-                    result.setCode(200);
-                    result.setMsg(rs1.getMsg());
-                    return result;
-                }
 
-            } else {
+            if(null != rs1 && rs1.getCode() == 0){
+                result.setData(1);
+                result.setCode(200);
+                result.setMsg(rs1.getMsg());
+                return result;
+
+            }else {
                 result.setData(3);
                 result.setCode(200);
-                result.setMsg("无法认证");
+                result.setMsg(rs1.getMsg());
                 return result;
             }
-        } catch (Exception e) {
-            log.error("[-CustomerInterLowerServiceImpl.customeInterRec-] get httpclient exception is "
-                    + e + ", request is " + data);
+
+        } else {
+            result.setData(3);
+            result.setCode(200);
+            result.setMsg("无法认证");
+            return result;
         }
-        return result;
+    }
+
+    private CustomerRec getCustomerRec(Integer interType, String name, String taxpayerCode, String customerName, Customer cust, Integer companyType, Integer operatingRangeType, String contact, String tel, String buyerAddr, String buyerTel, String buyerBank, String buyerBankAccount) {
+        CustomerRec customerRec = new CustomerRec();
+        customerRec.setCustomerName(customerName);//客户名称
+        customerRec.setCompanyLeader(contact);//紧急联系人
+        customerRec.setCompanyLeaderPhone(tel);//紧急联系人电话
+        customerRec.setCompanyName(name);//企业名称
+        customerRec.setCompanyReferencenum(taxpayerCode);//企业税号
+        customerRec.setCompanyOpenbank(buyerBank);//公司开户行
+        customerRec.setCompanyOpenbankAcc(buyerBankAccount);//公司开户行电话
+        customerRec.setCompanyAdress(buyerAddr);//公司地址
+        customerRec.setCompanyPhone(buyerTel);//公司电话
+        customerRec.setInterType(interType);////0-接口 1-平台
+        customerRec.setBussinessType(String.valueOf(cust.getBussinessType()));//业务类型 0 -自有车 1-外协车 2-无车
+        customerRec.setOperatingRangeType(operatingRangeType);//运用类型
+        customerRec.setCompanyType(companyType);//所属类型
+        return customerRec;
     }
 
     /**
@@ -252,14 +264,11 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
     @Override
     public DataResult customeProtocolUpLoad(String appKey, String api, String data, String requestid) {
         long costtimestart = System.currentTimeMillis();
-
         DataResult result = new DataResult();
-
         result.setData(3);
         result.setCode(200);
         result.setRequestid(requestid);
         result.setMsg("无法认证");
-
         try {
             log.info("[-CustomerInterLowerServiceImpl.customeProtocolUpLoad-] request appKey=" + appKey + " ,api=" + api + " ,data=" +data+ " ,requestid=" +requestid);
             JSONObject jsonObject = JSONObject.parseObject(data);
@@ -279,7 +288,6 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
                     || null == serviceType){
                 return  result;
             }
-
             if(!DateUtil.isValidDate(serviceStartTime)){
                 result.setMsg("日期格式有误");
                 return  result;
@@ -288,10 +296,6 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
                 result.setMsg("日期格式有误");
                 return  result;
             }
-
-
-
-
             CustomerRec customerRec2 = new CustomerRec();
             customerRec2.setCustomerName(appKey);
             customerRec2.setCompanyNum(companyNum);
@@ -300,12 +304,10 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
                 result.setMsg("企业还未备案成功!");
                 return result;
             }
-
             if (null != customerRec1 && customerRec1.getRecStatus() != 1){
                 result.setMsg("企业还未备案成功!");
                 return result;
             }
-
             if (null != customerRec1
                     && StringUtils.isNotBlank(customerRec1.getServiceEndTime())
                     //如果协议到期时间超过60天,协议上传成功不允许重新上传协议
@@ -314,47 +316,17 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
                 result.setMsg("协议已上传成功,审批中,请勿重复上传协议!");
                 return result;
             }
-
             String fileType = contractFileName.substring(contractFileName.lastIndexOf(".") + 1, contractFileName.length()).toLowerCase();
             if(!PDF.equals(fileType)){
                 result.setMsg("必须是pdf文件!");
                 return  result;
             }
-
             int base64StrLength = base64Str.length();
-            if(10 * 1024 * 1024 < base64StrLength){
+            if(COMPUTE < base64StrLength){
                 result.setMsg("pdf不可超过10M!");
                 return  result;
             }
-
-            CustomerRec customerRec = new CustomerRec();
-            customerRec.setServiceStartTime(DateUtil.getDistanceHoursFormat(serviceStartTime));//服务开始时间
-            customerRec.setServiceEndTime(DateUtil.getDistanceHoursFormat(serviceEndTime));//服务结束时间
-            customerRec.setServiceType(serviceType);//协议类型
-            customerRec.setLowerFileName(contractFileName);//协议名称
-            customerRec.setLowerBase64Str(base64Str);//协议base64编码
-            customerRec.setCustomerName(appKey);//客户名称
-            customerRec.setCompanyNum(companyNum);
-            customerRec.setInterType(0);//接口
-
-            List<CustomerRec> customerRecs = new ArrayList<CustomerRec>();
-            customerRecs.add(customerRec);
-            RespR rs = lowerService.customeRecUpload(customerRecs);
-            long costtimeend = System.currentTimeMillis();
-            log.info("[-CustomerInterLowerServiceImpl.customeProtocolUpLoad-] result is "
-                    + rs.toString() + ", request is " + data + " ,costtime="
-                    + (costtimeend - costtimestart));
-            if(null != rs && rs.getCode() == 0){
-                result.setData(1);
-                result.setCode(200);
-                result.setMsg(rs.getMsg());
-                return result;
-            } else {
-                result.setData(3);
-                result.setCode(200);
-                result.setMsg(rs.getMsg());
-                return result;
-            }
+            return getDataResult(appKey, data, costtimestart, result, companyNum, serviceStartTime, serviceEndTime, contractFileName, base64Str, serviceType);
         } catch (Exception e) {
             log.error("[-CustomerInterLowerServiceImpl.customeProtocolUpLoad-] get httpclient exception is "
                     + e + ", request is " + data);
@@ -363,8 +335,36 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
         return result;
     }
 
-
-
+    private DataResult getDataResult(String appKey, String data, long costtimestart, DataResult result, String companyNum, String serviceStartTime, String serviceEndTime, String contractFileName, String base64Str, Integer serviceType) {
+        CustomerRec customerRec = new CustomerRec();
+        customerRec.setServiceStartTime(DateUtil.getDistanceHoursFormat(serviceStartTime));//服务开始时间
+        customerRec.setServiceEndTime(DateUtil.getDistanceHoursFormat(serviceEndTime));//服务结束时间
+        customerRec.setServiceType(serviceType);//协议类型
+        customerRec.setLowerFileName(contractFileName);//协议名称
+        customerRec.setLowerBase64Str(base64Str);//协议base64编码
+        customerRec.setCustomerName(appKey);//客户名称
+        customerRec.setCompanyNum(companyNum);
+        customerRec.setInterType(0);//接口
+
+        List<CustomerRec> customerRecs = new ArrayList<CustomerRec>();
+        customerRecs.add(customerRec);
+        RespR rs = lowerService.customeRecUpload(customerRecs);
+        long costtimeend = System.currentTimeMillis();
+        log.info("[-CustomerInterLowerServiceImpl.customeProtocolUpLoad-] result is "
+                + rs.toString() + ", request is " + data + " ,costtime="
+                + (costtimeend - costtimestart));
+        if(null != rs && rs.getCode() == 0){
+            result.setData(1);
+            result.setCode(200);
+            result.setMsg(rs.getMsg());
+            return result;
+        } else {
+            result.setData(3);
+            result.setCode(200);
+            result.setMsg(rs.getMsg());
+            return result;
+        }
+    }
 
 
     /**

+ 39 - 55
src/main/java/com/jkcredit/invoice/credit/interserver/NoCarInterServiceImpl.java

@@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
 import java.util.ArrayList;
 import java.util.List;
 
+import static com.jkcredit.invoice.common.CommonConst.*;
 import static java.util.stream.Collectors.toList;
 
 
@@ -115,7 +116,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
             customerCarRec.setCarColor(plateColor);
             customerCarRec.setCarNum(plateNumber);
             customerCarRec.setInterType(0);
-            if("0".equals(customerCarRec.getCarColor())){
+            if(SELF_CAR.equals(customerCarRec.getCarColor())){
                 customerCarRec.setServiceOperation(1);//默认运营车辆
             }
 
@@ -201,7 +202,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
                 JSONObject jb = JSONObject.parseObject(rs.getData().toString());
                 result.setData(1);
                 result.setMsg("车辆已备案");
-                if(null == jb.getJSONArray("result") || jb.getJSONArray("result").size() == 0){
+                if(null == jb.getJSONArray(RESULT) || jb.getJSONArray(RESULT).size() == 0){
                     result.setData(2);
                     result.setMsg("车辆未备案");
                 }
@@ -232,16 +233,12 @@ public class NoCarInterServiceImpl implements NoCarInterService {
      */
     @Override
     public DataResult noCarBillStart(String appKey, String api, String data,String requestid) {
-
         long costtimestart = System.currentTimeMillis();
-
         DataResult result = new DataResult();
-
         result.setData(3);
         result.setCode(200);
         result.setRequestid(requestid);
         result.setMsg("无法认证");
-
         try {
             log.info("[-NoCarInterServiceImpl.noCarBillStart-] request appKey=" + appKey + " ,api=" + api + " ,data=" +data+ " ,requestid=" +requestid);
             JSONObject jsonObject = JSONObject.parseObject(data);
@@ -271,7 +268,6 @@ public class NoCarInterServiceImpl implements NoCarInterService {
                 result.setMsg("必传参数有空值");
                 return  result;
             }
-
             if(!DateUtil.isValidDate(startTime)){
                 result.setMsg("日期格式有误");
                 return  result;
@@ -280,7 +276,6 @@ public class NoCarInterServiceImpl implements NoCarInterService {
                 result.setMsg("日期格式有误");
                 return  result;
             }
-
             CustomerRec customerRec = new CustomerRec();
             customerRec.setCustomerName(appKey);
             customerRec.setCompanyReferencenum(taxplayerCode);
@@ -289,7 +284,6 @@ public class NoCarInterServiceImpl implements NoCarInterService {
                 result.setMsg("客户:"+appKey+";税号"+taxplayerCode+"未在平台备案成功,请先做备案");
                 return result;
             }
-
             NoCarWayBill noCarWayBill = new NoCarWayBill();
             noCarWayBill.setCustomerName(appKey);
             noCarWayBill.setCompanyName(customerRec.getCompanyName());
@@ -305,7 +299,6 @@ public class NoCarInterServiceImpl implements NoCarInterService {
             noCarWayBill.setTaxplayerCode(taxplayerCode);
             noCarWayBill.setHisFlag(0);
             noCarWayBill.setIntfaceStartTime(DateUtil.getCurrentDateStr());
-
             List<CustomerCarRec> customerCarRecs = new ArrayList<>();
             CustomerCarRec customerCarRec = new CustomerCarRec();
             customerCarRec.setCompanyName(noCarWayBill.getCompanyName());
@@ -318,36 +311,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
             customerCarRec.setServiceOperation(1);//默认运营车辆
             noCarWayBill.setTitleType(2);
             noCarWayBill.setInterType(0);//接口
-
-            //先查询上游是否已经备案
-            RespR<VehicleQueryResponse> respRquery = noCarService.customerCarRecQueryUpper(customerCarRec);
-            if(respRquery.getCode() == 1 || respRquery.getData() == null || respRquery.getData().getResult() == null || respRquery.getData().getResult().size()<=0){
-                customerCarRecs.add(customerCarRec);
-                RespR respR = noCarService.customerCarRec(customerCarRecs);
-                if(respR.getCode() ==1){
-                    noCarWayBill.setFailReason(respR.getMsg());
-                    noCarWayBill.setBillwayStatus(-2);
-                    insertOrUpdateBillStart(noCarWayBill);
-                    result.setMsg("车牌号备案失败,失败原因:"+respR.getMsg());
-                    return result;
-                }
-            }
-            RespR rs = noCarService.noCarWaybillStart(noCarWayBill);
-            long costtimeend = System.currentTimeMillis();
-            log.info("[-NoCarInterServiceImpl.noCarBillStart-] result is "
-                    + rs.toString() + ", request is " + data + " ,costtime="
-                    + (costtimeend - costtimestart));
-            if(null != rs && rs.getCode() == 0){
-                result.setData(1);
-                result.setCode(200);
-                result.setMsg(rs.getData().toString());
-                return result;
-            } else {
-                result.setData(3);
-                result.setCode(200);
-                result.setMsg(rs.getMsg());
-                return result;
-            }
+            return getDataResult(data, costtimestart, result, noCarWayBill, customerCarRecs, customerCarRec);
         } catch (Exception e) {
             log.error("[-NoCarInterServiceImpl.noCarBillStart-] get httpclient exception is "
                     + e + ", request is " + data);
@@ -355,6 +319,37 @@ public class NoCarInterServiceImpl implements NoCarInterService {
         return result;
     }
 
+    private DataResult getDataResult(String data, long costtimestart, DataResult result, NoCarWayBill noCarWayBill, List<CustomerCarRec> customerCarRecs, CustomerCarRec customerCarRec) {
+        //先查询上游是否已经备案
+        RespR<VehicleQueryResponse> respRquery = noCarService.customerCarRecQueryUpper(customerCarRec);
+        if(respRquery.getCode() == 1 || respRquery.getData() == null || respRquery.getData().getResult() == null || respRquery.getData().getResult().size()<=0){
+            customerCarRecs.add(customerCarRec);
+            RespR respR = noCarService.customerCarRec(customerCarRecs);
+            if(respR.getCode() ==1){
+                noCarWayBill.setFailReason(respR.getMsg());
+                noCarWayBill.setBillwayStatus(-2);
+                insertOrUpdateBillStart(noCarWayBill);
+                result.setMsg("车牌号备案失败,失败原因:"+respR.getMsg());
+                return result;
+            }
+        }
+        RespR rs = noCarService.noCarWaybillStart(noCarWayBill);
+        long costtimeend = System.currentTimeMillis();
+        log.info("[-NoCarInterServiceImpl.noCarBillStart-] result is "
+                + rs.toString() + ", request is " + data + " ,costtime="
+                + (costtimeend - costtimestart));
+        if(null != rs && rs.getCode() == 0){
+            result.setData(1);
+            result.setCode(200);
+            result.setMsg(rs.getData().toString());
+            return result;
+        } else {
+            result.setData(3);
+            result.setCode(200);
+            result.setMsg(rs.getMsg());
+            return result;
+        }
+    }
 
 
     /**
@@ -439,16 +434,12 @@ public class NoCarInterServiceImpl implements NoCarInterService {
      */
     @Override
     public DataResult noCarHisWaybillStart(String appKey, String api, String data,String requestid) {
-
         long costtimestart = System.currentTimeMillis();
-
         DataResult result = new DataResult();
-
         result.setData(3);
         result.setCode(200);
         result.setRequestid(requestid);
         result.setMsg("无法认证");
-
         try {
             log.info("[-NoCarInterServiceImpl.noCarHisWaybillStart-] request appKey=" + appKey + " ,api=" + api + " ,data=" +data + " ,requestid=" +requestid);
             JSONObject jsonObject = JSONObject.parseObject(data);
@@ -473,23 +464,18 @@ public class NoCarInterServiceImpl implements NoCarInterService {
                     || null == fee
                     || null == titleType
                     || StringUtils.isEmpty(taxplayerCode)
-
             ){
                 result.setMsg("有空的必填运单要素,请检查");
                 return  result;
             }
-
-
             if(!DateUtil.isValidDate(startTime)){
                 result.setMsg("日期格式有误");
                 return  result;
             }
-
             if(!DateUtil.isValidDate(predictEndTime)){
                 result.setMsg("日期格式有误");
                 return  result;
             }
-
             CustomerRec customerRec = new CustomerRec();
             customerRec.setCustomerName(appKey);
             customerRec.setCompanyReferencenum(taxplayerCode);
@@ -498,7 +484,6 @@ public class NoCarInterServiceImpl implements NoCarInterService {
                 result.setMsg("客户:"+appKey+";税号"+taxplayerCode+"未在平台备案成功,请先做备案");
                 return result;
             }
-
             NoCarWayBill noCarWayBill = new NoCarWayBill();
             noCarWayBill.setCustomerName(appKey);
             noCarWayBill.setCompanyName(customerRec.getCompanyName());
@@ -516,7 +501,6 @@ public class NoCarInterServiceImpl implements NoCarInterService {
             noCarWayBill.setUpdateTime(DateUtil.getCurrentDateStr());
             noCarWayBill.setIntfaceStartTime(DateUtil.getCurrentDateStr());
             noCarWayBill.setInterType(0);//接口
-
             List<CustomerCarRec> customerCarRecs = new ArrayList<>();
             CustomerCarRec customerCarRec = new CustomerCarRec();
             customerCarRec.setCompanyName(noCarWayBill.getCompanyName());
@@ -699,7 +683,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
                noCarWayBill1.setInterType(0);
                noCarWayBill1.setBillwayStatus(-5);
             }
-            if(noCarWayBill1.getInterType() == 3 || (noCarWayBill1.getBillwayStatus()<2 && noCarWayBill1.getFailReason()!=null && noCarWayBill1.getFailReason().contains("XyWaybillHistoryEnd"))){
+            if(noCarWayBill1.getInterType() == REC_STATUS_WAIT || (noCarWayBill1.getBillwayStatus() < REC_STATUS_UN && noCarWayBill1.getFailReason()!=null && noCarWayBill1.getFailReason().contains(XY_WAYBILL_HISTORY_END))){
                 noCarWayBill1.setBillwayStatus(-5);
             }
             noCarWayBill1.setCustomerName(appKey);
@@ -716,7 +700,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
                 return result;
             } else {
                 result.setData(3);
-                if("未查得".equals(rs.getMsg())){
+                if(NOT_FOUND.equals(rs.getMsg())){
                     result.setData(2);
                 }
                 result.setCode(200);
@@ -760,7 +744,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
 
             String param = paramService.getParamsByParamName("FIND_NO_SEARCH_NUM_ON_OFF").getParamValue();;
 
-            if(!StringUtils.equals("1",param)){
+            if(!StringUtils.equals(ONE,param)){
                 result.setMsg("获取未查询过发票的运单编号接口已关闭");
                 return result;
             }
@@ -1034,7 +1018,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
                 return result;
             } else {
                 result.setData(3);
-                if("未查得".equals(rs.getMsg())){
+                if(NOT_FOUND.equals(rs.getMsg())){
                     result.setData(2);
                 }
                 result.setCode(200);

+ 9 - 6
src/main/java/com/jkcredit/invoice/credit/interserver/SelfCarInterServiceImpl.java

@@ -22,6 +22,9 @@ import org.springframework.stereotype.Service;
 import java.util.ArrayList;
 import java.util.List;
 
+import static com.jkcredit.invoice.common.CommonConst.NOT_FOUND;
+import static com.jkcredit.invoice.common.CommonConst.TWO_NUM;
+
 
 @Service("selfCarInterService")
 @Slf4j
@@ -94,7 +97,7 @@ public class SelfCarInterServiceImpl implements SelfCarInterService {
            result.setMsg(rs.getData().toString());
            return result;
         } else {
-            if(rs!=null && rs.getCode()==2){
+            if(rs!=null && rs.getCode() == TWO_NUM){
                 result.setData(2);
                 result.setCode(200);
                 result.setMsg("未查得");
@@ -195,7 +198,7 @@ public class SelfCarInterServiceImpl implements SelfCarInterService {
                 result.setData(3);
                 result.setCode(200);
                 result.setMsg(rs.getMsg());
-                if("未查得".equals(rs.getMsg())){
+                if(NOT_FOUND . equals(rs.getMsg())){
                     result.setData(2);
                 }
                 return result;
@@ -484,7 +487,7 @@ public class SelfCarInterServiceImpl implements SelfCarInterService {
                 return result;
             } else {
                 result.setData(3);
-                if("未查得".equals(rs.getMsg())){
+                if(NOT_FOUND . equals(rs.getMsg())){
                     result.setData(2);
                 }
                 result.setCode(200);
@@ -639,7 +642,7 @@ public class SelfCarInterServiceImpl implements SelfCarInterService {
                 return result;
             } else {
                 result.setData(3);
-                if("未查得".equals(rs.getMsg())){
+                if(NOT_FOUND .equals (rs.getMsg())){
                     result.setData(2);
                 }
                 result.setCode(200);
@@ -728,7 +731,7 @@ public class SelfCarInterServiceImpl implements SelfCarInterService {
                 return result;
             } else {
                 result.setData(3);
-                if("未查得".equals(rs.getMsg())){
+                if(NOT_FOUND .equals (rs.getMsg())){
                     result.setData(2);
                 }
                 result.setCode(200);
@@ -805,7 +808,7 @@ public class SelfCarInterServiceImpl implements SelfCarInterService {
                 return result;
             } else {
                 result.setData(3);
-                if("未查得".equals(rs.getMsg())){
+                if(NOT_FOUND .equals (rs.getMsg())){
                     result.setData(2);
                 }
 

+ 12 - 8
src/main/java/com/jkcredit/invoice/service/customer/impl/CustomerServiceImpl.java

@@ -5,19 +5,23 @@ 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.customer.CustomerRechargeMapper;
 import com.jkcredit.invoice.mapper.customer.CustomerRecMapper;
-import com.jkcredit.invoice.model.entity.customer.Customer;
+import com.jkcredit.invoice.mapper.customer.CustomerRechargeMapper;
 import com.jkcredit.invoice.model.entity.CustomerRecharge;
+import com.jkcredit.invoice.model.entity.customer.Customer;
 import com.jkcredit.invoice.model.entity.customer.CustomerRec;
 import com.jkcredit.invoice.service.customer.CustomerService;
-import com.jkcredit.invoice.service.upService.CommInterFace;
-import com.jkcredit.invoice.util.*;
+import com.jkcredit.invoice.service.upservice.CommInterFace;
+import com.jkcredit.invoice.util.DateUtil;
+import com.jkcredit.invoice.util.MathUtil;
+import com.jkcredit.invoice.util.RespR;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import static com.jkcredit.invoice.common.CommonConst.REC_STATUS_UN;
+
 @Service("customerService")
 @Slf4j
 public class CustomerServiceImpl extends ServiceImpl<CustomerMapper,Customer> implements CustomerService{
@@ -93,7 +97,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper,Customer> im
     @Override
     public RespR contractAdd(CustomerRec customerRec){
         log.info("开始上传协议:CustomerServiceImpl.contractAdd{}",customerRec);
-        if(customerRec.getRecStatus().intValue() == 2){
+        if(customerRec.getRecStatus().intValue() == REC_STATUS_UN){
             return new RespR(false,"无法上传协议,未注册");
         }
         B2bContractAddRequest b2bContractAddRequest = new B2bContractAddRequest();
@@ -128,7 +132,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper,Customer> im
     public RespR contractStatusFail(CustomerRec customerRec){
         log.info("协议上传失败状态确认:CustomerServiceImpl.contractStatusFail{}",customerRec);
 
-        if(customerRec.getRecStatus().intValue() == 2){
+        if(customerRec.getRecStatus().intValue() == REC_STATUS_UN){
             return new RespR(false,"无法更新协议状态,还未注册");
         }
         //协议上传失败状态
@@ -141,7 +145,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper,Customer> im
     public RespR contractStatusProcess(CustomerRec customerRec){
         log.info("协议上传成功,审批中状态确认:CustomerServiceImpl.contractStatusProcess{}",customerRec);
 
-        if(customerRec.getRecStatus().intValue() == 2){
+        if(customerRec.getRecStatus().intValue() == REC_STATUS_UN){
             return new RespR(false,"无法更新协议状态,还未注册");
         }
         //协议上传成功,审批中状态
@@ -154,7 +158,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper,Customer> im
     public RespR contractStatusSuccess(CustomerRec customerRec){
         log.info("备案成功状态确认:CustomerServiceImpl.contractStatusSuccess{}",customerRec);
 
-        if(customerRec.getRecStatus().intValue() == 2){
+        if(customerRec.getRecStatus().intValue() == REC_STATUS_UN){
             return new RespR(false,"无法更新协议状态,还未注册");
         }
         //备案成功状态

+ 49 - 49
src/main/java/com/jkcredit/invoice/service/lowerservice/impl/CustomerLowerServiceImpl.java

@@ -18,8 +18,8 @@ import com.jkcredit.invoice.model.vo.CompanyVo;
 import com.jkcredit.invoice.service.customer.CustomerService;
 import com.jkcredit.invoice.service.lowerservice.CustomeLowerService;
 import com.jkcredit.invoice.service.manager.ParamService;
-import com.jkcredit.invoice.service.upService.NoCarInterface;
-import com.jkcredit.invoice.service.upService.SelfCarInterface;
+import com.jkcredit.invoice.service.upservice.NoCarInterface;
+import com.jkcredit.invoice.service.upservice.SelfCarInterface;
 import com.jkcredit.invoice.util.DateUtil;
 import com.jkcredit.invoice.util.RespR;
 import lombok.extern.slf4j.Slf4j;
@@ -28,6 +28,11 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
 import java.util.List;
+
+import static com.jkcredit.invoice.common.CommonConst.*;
+import static com.jkcredit.invoice.common.WarnMessageConst.FILING_INFORMATION_IS_EMPTY_MESSAGE;
+import static com.jkcredit.invoice.common.WarnMessageConst.PROTOCOL_UPLOAD_INFO_IS_EMPTY_MESSAGE;
+
 @Service("lowerService")
 @Slf4j
 public class CustomerLowerServiceImpl implements CustomeLowerService {
@@ -81,7 +86,7 @@ public class CustomerLowerServiceImpl implements CustomeLowerService {
     @Override
     public RespR customeRec(List<CustomerRec> customerRecs) {
         log.info("客户备案信息:CustomerLowerServiceImpl.customeRec{}",customerRecs);
-        if(customerRecs==null || customerRecs.size()<=0){return new RespR(false,"备案信息为空");};
+        if(customerRecs==null || customerRecs.size()<=0){return new RespR(false,FILING_INFORMATION_IS_EMPTY_MESSAGE);};
         StringBuffer res = new StringBuffer();
         customerRecs.stream().forEach(customerRec -> {
             Customer customer = customerMapper.selectByCustomerName(customerRec.getCustomerName());
@@ -93,33 +98,25 @@ public class CustomerLowerServiceImpl implements CustomeLowerService {
                 res.append("#"+customerRec.getCompanyName()+"业务类型有误;#");
                 return;
             }
-
-
             if(org.apache.commons.lang3.StringUtils.isNotBlank(customerRec.getBase64Str())){
-
                  int length = customerRec.getBase64Str().length() / 1024 / 1024;
                  if(length >= 1){
                      res.append("#"+customerRec.getCompanyName()+"备案信息协议文件不能大于1M;#");
                      return;
                  }
             }
-
-
             if(StringUtils.isEmpty(customerRec.getCompanyName()) || StringUtils.isEmpty(customerRec.getCompanyReferencenum())){
                 res.append("企业备案名称或税号为空");
                 return;
             }
-
-            if("2".equals(customerRec.getBussinessType()) && customerRec.getCompanyType() != 3){
+            if(NO_CAR.equals(customerRec.getBussinessType()) && customerRec.getCompanyType() != REC_STATUS_WAIT){
                 res.append("#无车公司类型必须为合作商户#");
                 return;
             }
-
-            if("0".equals(customerRec.getBussinessType()) && customerRec.getCompanyType() != 1){
+            if(SELF_CAR.equals(customerRec.getBussinessType()) && customerRec.getCompanyType() != REC_STATUS_SUC){
                 res.append("#自有车公司类型必须为行业用户#");
                 return;
             }
-
             //默认备案状态为备案中 2-失败 1-成功 3-等待协议上传 4-停用 0-备案中
             customerRec.setRecStatus(0);
             //主动查询上游接口,如果已经备案则更新
@@ -139,41 +136,7 @@ public class CustomerLowerServiceImpl implements CustomeLowerService {
                    log.info("AAAAAAAAAAA"+customerRec.getCompanyName()+b2bCompanyModels.size());
                }
             }
-            //客户备案信息入表
-            CustomerRec customerRec1 = customerRecMapper.selectByCustomerNameAndCompanyReferenceAll(customerRec);
-            customerRec.setCreatetime(DateUtil.getCurrentDateStr());
-            customerRec.setCompanyBelongName(customer.getCompany());
-            if(customerRec1 == null){
-                customerRecMapper.insert(customerRec);
-            }else{
-                if(customerRec1.getCompanyName()!=null && !customerRec1.getCompanyName().equals(customerRec.getCompanyName())){
-                    CompanyVo companyVo = new CompanyVo();
-                    companyVo.setNewCompanyName(customerRec.getCompanyName());
-                    companyVo.setOldCompanyName(customerRec1.getCompanyName());
-                    if("0".equals(customerRec.getBussinessType())){
-                        //自有车需要更新 各个表的企业名称
-                        selfCarCalculateInforMapper.upDateCompany(companyVo);
-                        selfCarInvoiceMapper.upDateCompany(companyVo);
-                        sellCarTradeMapper.upDateCompany(companyVo);
-                        customerCarRecMapper.upDateCompanySelf(companyVo);
-                    }else if("2".equals(customerRec.getBussinessType())){
-                        //无车需要跟新各个表的企业名称
-                        customerCarRecMapper.upDateCompanyNo(companyVo);
-                        billInvoiceMapper.upDateCompany(companyVo);
-                        noCarCalculateInforMapper.upDateCompany(companyVo);
-                        noCarWaybillMapper.upDateCompany(companyVo);
-                        noCarWaybillImprtMapper.upDateCompany(companyVo);
-                    }
-                }
-                customerRec.setId(customerRec1.getId());
-                customerRec.setContractSuc(customerRec1.getContractSuc());
-                customerRec.setContrantNum(customerRec1.getContrantNum());
-                customerRec.setContractFileName(customerRec.getContractFileName()==null?customerRec1.getContractFileName():customerRec.getContractFileName());
-                customerRec.setBase64Str(customerRec.getBase64Str()==null?customerRec1.getBase64Str():customerRec.getBase64Str());
-                customerRecMapper.updateByPrimaryKey(customerRec);
-            }
-
-
+            customerRecInsertOrUpdate(customerRec, customer);
             try{
                 String mail = paramService.getParamsByParamName("MAILTO").getParamValue();
                 sendMailService.sendMail(mail,
@@ -194,6 +157,43 @@ public class CustomerLowerServiceImpl implements CustomeLowerService {
         }
 
     }
+
+    private void customerRecInsertOrUpdate(CustomerRec customerRec, Customer customer) {
+        //客户备案信息入表
+        CustomerRec customerRec1 = customerRecMapper.selectByCustomerNameAndCompanyReferenceAll(customerRec);
+        customerRec.setCreatetime(DateUtil.getCurrentDateStr());
+        customerRec.setCompanyBelongName(customer.getCompany());
+        if(customerRec1 == null){
+            customerRecMapper.insert(customerRec);
+        }else{
+            if(customerRec1.getCompanyName()!=null && !customerRec1.getCompanyName().equals(customerRec.getCompanyName())){
+                CompanyVo companyVo = new CompanyVo();
+                companyVo.setNewCompanyName(customerRec.getCompanyName());
+                companyVo.setOldCompanyName(customerRec1.getCompanyName());
+                if(SELF_CAR.equals(customerRec.getBussinessType())){
+                    //自有车需要更新 各个表的企业名称
+                    selfCarCalculateInforMapper.upDateCompany(companyVo);
+                    selfCarInvoiceMapper.upDateCompany(companyVo);
+                    sellCarTradeMapper.upDateCompany(companyVo);
+                    customerCarRecMapper.upDateCompanySelf(companyVo);
+                }else if(NO_CAR.equals(customerRec.getBussinessType())){
+                    //无车需要跟新各个表的企业名称
+                    customerCarRecMapper.upDateCompanyNo(companyVo);
+                    billInvoiceMapper.upDateCompany(companyVo);
+                    noCarCalculateInforMapper.upDateCompany(companyVo);
+                    noCarWaybillMapper.upDateCompany(companyVo);
+                    noCarWaybillImprtMapper.upDateCompany(companyVo);
+                }
+            }
+            customerRec.setId(customerRec1.getId());
+            customerRec.setContractSuc(customerRec1.getContractSuc());
+            customerRec.setContrantNum(customerRec1.getContrantNum());
+            customerRec.setContractFileName(customerRec.getContractFileName()==null?customerRec1.getContractFileName():customerRec.getContractFileName());
+            customerRec.setBase64Str(customerRec.getBase64Str()==null?customerRec1.getBase64Str():customerRec.getBase64Str());
+            customerRecMapper.updateByPrimaryKey(customerRec);
+        }
+    }
+
     @Override
     public RespR customeRecQueryList(CustomerRec customerRec) {
 
@@ -219,7 +219,7 @@ public class CustomerLowerServiceImpl implements CustomeLowerService {
     @Override
     public RespR customeRecUpload(List<CustomerRec> customerRecs) {
         log.info("客户协议上传信息:CustomerLowerServiceImpl.customeRecUpload{}",customerRecs);
-        if(customerRecs==null || customerRecs.size()<=0){return new RespR(false,"协议上传信息为空");};
+        if(customerRecs==null || customerRecs.size()<=0){return new RespR(false,PROTOCOL_UPLOAD_INFO_IS_EMPTY_MESSAGE);};
         StringBuffer res = new StringBuffer();
         customerRecs.stream().forEach(customerRec -> {
             Customer customer = customerMapper.selectByCustomerName(customerRec.getCustomerName());

+ 87 - 77
src/main/java/com/jkcredit/invoice/service/lowerservice/impl/NoCarServiceImpl.java

@@ -31,7 +31,7 @@ import com.jkcredit.invoice.service.lowerservice.vo.MonthAccountQueryVo;
 import com.jkcredit.invoice.service.manager.ParamService;
 import com.jkcredit.invoice.service.nocar.HcInvoiceService;
 import com.jkcredit.invoice.service.nocar.NoCarRecService;
-import com.jkcredit.invoice.service.upService.NoCarInterface;
+import com.jkcredit.invoice.service.upservice.NoCarInterface;
 import com.jkcredit.invoice.util.DateUtil;
 import com.jkcredit.invoice.util.MathUtil;
 import com.jkcredit.invoice.util.RespR;
@@ -45,6 +45,8 @@ import org.springframework.util.StringUtils;
 
 import java.util.*;
 
+import static com.jkcredit.invoice.common.CommonConst.*;
+
 @Repository("noCarService")
 @Slf4j
 public class NoCarServiceImpl implements NoCarService{
@@ -195,7 +197,7 @@ public class NoCarServiceImpl implements NoCarService{
         RespR<VehicleQueryResponse> respR = noCarInterface.vehicleQuery(vehicleQueryRequest);
         if(respR.getCode() == 1){
             log.info("车辆备案查询失败NoCarServiceImpl.customerCarRecQueryUpper{},msg{}",customerCarRec,respR.getMsg());
-        }else if(8 != customerCarRec.getInterType()){//此处表示仅适用接口查询,不走业务逻辑
+        }else if(EIGHT_NUM != customerCarRec.getInterType()){//此处表示仅适用接口查询,不走业务逻辑
             customerCarRec.setRecStatus(1);
             updateCustomerCarRec(customerCarRec);
         }
@@ -237,7 +239,7 @@ public class NoCarServiceImpl implements NoCarService{
             return new   RespR(false,"开始指令已经上传成功");
         }
         //如果运单时间和当前时间差了三天,直接返回
-        if(DateUtil.getDistanceHours(noCarWayBill.getStartTime(),new Date())<-72){
+        if(DateUtil.getDistanceHours(noCarWayBill.getStartTime(),new Date())<INTONE){
             noCarWayBill.setFailReason("失败,运单开始时间超72小时");
             noCarWayBill.setBillwayStatus(-2);
             insertOrUpdateBillStart(noCarWayBill);
@@ -375,7 +377,7 @@ public class NoCarServiceImpl implements NoCarService{
             noCarWayBillDb.setFailReason(waybillEndResponseRespR.getMsg());
             insertOrUpdateBillEnd(noCarWayBillDb);
             return new RespR(false,waybillEndResponseRespR.getMsg());
-        }else if("4".equals(waybillEndResponseRespR.getData().getInfo())){
+        }else if(FOR.equals(waybillEndResponseRespR.getData().getInfo())){
             log.info("运单结束失败:NoCarServiceImpl.noCarWaybillEnd{},msg{}",noCarWayBill,"运单已经超时");
             noCarWayBillDb.setBillwayStatus(4);
             noCarWayBillDb.setFailReason(waybillEndResponseRespR.getMsg());
@@ -409,7 +411,7 @@ public class NoCarServiceImpl implements NoCarService{
         if(curr == null){
             noCarWaybillMapper.insert(noCarWayBill);
         }else{
-            if(curr.getBillwayStatus()>2){
+            if(curr.getBillwayStatus() > TWO_NUM){
                 return;
             }
             noCarWaybillMapper.updateByBillNum(noCarWayBill);
@@ -432,7 +434,7 @@ public class NoCarServiceImpl implements NoCarService{
         if(noCarWayBillDb!=null && noCarWayBillDb.getBillwayStatus()>0){
             return new   RespR(false,"开始指令已经上传成功,请勿重复上传");
         }
-        if(DateUtil.getDistanceDays(noCarWayBill.getStartTime(),new Date())>-20){
+        if(DateUtil.getDistanceDays(noCarWayBill.getStartTime(),new Date()) > INTTOW){
             log.info("历史运单开始上传失败:NoCarServiceImpl.noCarHisWaybillStart{},msg{}",noCarWayBill,"必须是二十天前的运单");
             noCarWayBill.setBillwayStatus(-2);
             noCarWayBill.setFailReason("失败,运单未满20天时效");
@@ -532,7 +534,7 @@ public class NoCarServiceImpl implements NoCarService{
             log.info("历史运单结束上传失败:NoCarServiceImpl.noCarHisWaybillEnd{},msg{}",noCarWayBillDb,waybillEndResponseRespR.getMsg());
 
             return new RespR(false,waybillEndResponseRespR.getMsg());
-        }else if("4".equals(waybillEndResponseRespR.getData().getInfo())){
+        }else if(FOR.equals(waybillEndResponseRespR.getData().getInfo())){
             noCarWayBill.setBillwayStatus(4);
             insertOrUpdateBillEnd(noCarWayBillDb);
             log.info("历史运单结束上传失败:NoCarServiceImpl.noCarHisWaybillEnd{},msg{}",noCarWayBillDb,"运单已经超时,请拆分");
@@ -574,18 +576,18 @@ public class NoCarServiceImpl implements NoCarService{
         /**
          * 迁移数据
          */
-        if(noCarWayBill.getInterType() == 3){
+        if(noCarWayBill.getInterType() == THREE_NUM){
             isKf = 3;
         }
         /**
          * 特殊处理数据
          */
-        if(noCarWayBill.getInterType() == 5){
+        if(noCarWayBill.getInterType() == FIVE_NUM){
             isKf = 5;
         }
         log.info("取票啦:NoCarServiceImpl.getInvoiceByWayBillNumReal{},isCurr{}",noCarWayBill,isInterface);
-        if(isInterface && (noCarWayBill.getBillwayStatus()!=-5 || noCarWayBill.getInterType() == 4)){
-            if(noCarWayBill.getBillwayStatus() == 1 || noCarWayBill.getBillwayStatus() == 2 || noCarWayBill.getBillwayStatus() == 3 || noCarWayBill.getBillwayStatus() == 4){
+        if(isInterface && (noCarWayBill.getBillwayStatus() != NE_FIVE_NUM || noCarWayBill.getInterType() == FOR_NUM)){
+            if(noCarWayBill.getBillwayStatus() == ONE_NUM || noCarWayBill.getBillwayStatus() == TWO_NUM || noCarWayBill.getBillwayStatus() == THREE_NUM || noCarWayBill.getBillwayStatus() == FOR_NUM){
                 //直接返回发票信息
                 List<BillInvoice> billInvoices = billInvoiceMapper.selectByBillNum(noCarWayBill.getBillNum());
                 WaybillNumFindInvoiceResponse waybillNumFindInvoiceResponse = buildInterFaceVoiceData(noCarWayBill,billInvoices);
@@ -594,7 +596,7 @@ public class NoCarServiceImpl implements NoCarService{
                 return new RespR(false,noCarWayBill.getFailReason()==null?"运单未知异常":noCarWayBill.getFailReason());
             }
         }
-        if(noCarWayBill.getBillwayStatus()!=2 && noCarWayBill.getBillwayStatus()!=-5){
+        if(noCarWayBill.getBillwayStatus() != TWO_NUM && noCarWayBill.getBillwayStatus() != NE_FIVE_NUM){
            return new RespR(false,"不是开票中的状态,别取票啦");
         }
         RespR respR = checkCarWayBillAndSetInfo(noCarWayBill);
@@ -602,7 +604,6 @@ public class NoCarServiceImpl implements NoCarService{
             log.info("取票失败啦:NoCarServiceImpl.getInvoiceByWayBillNumReal{},isCurr{},msg{}",noCarWayBill,isInterface,respR.getMsg());
             return  respR;
         }
-
         //进行取票操作
         WaybillNumFindInvoiceRequest waybillNumFindInvoiceRequest = new WaybillNumFindInvoiceRequest();
         String companyNum = paramService.getParamsByParamName("REQUEST_COMPANY_NUM").getParamValue();
@@ -614,11 +615,11 @@ public class NoCarServiceImpl implements NoCarService{
             return new RespR(false,responseRespR.getMsg());
         }else{
             int tempStatus = responseRespR.getData().getWaybillStatus().intValue();
-            if(noCarWayBill.getBillwayStatus()==-5){
-                if(isKf != 3){
+            if(noCarWayBill.getBillwayStatus() == NE_FIVE_NUM){
+                if(isKf != THREE_NUM){
                     noCarWayBill.setInterType(0);
                 }else{
-                    if(tempStatus == 3){
+                    if(tempStatus == THREE_NUM){
                         noCarWayBill.setInterType(4);
                     }
                 }
@@ -628,7 +629,6 @@ public class NoCarServiceImpl implements NoCarService{
                 //更改票状态
                 noCarWayBill.setBillwayStatus(tempStatus);
                 insertOrUpdateBill(noCarWayBill);
-
             }else {
                 //更改票状态
                 noCarWayBill.setPlateNum(responseRespR.getData().getPlateNum());
@@ -639,64 +639,10 @@ public class NoCarServiceImpl implements NoCarService{
                 noCarWaybillMapper.updateByBillNum(noCarWayBill);
             }
 
-            if(tempStatus == 2 || tempStatus==3){
-                //删除已有发票
-                billInvoiceMapper.deleteByBillNum(noCarWayBill.getBillNum());
-                //发票入库
-                List<InvoiceProcessingListModel> invoiceProcessingListModels = responseRespR.getData().getResult();
-                //用set来去重计费信息
-                Set<NoCarCalculateInfor> carCalculateInfors = new HashSet<>();
-                invoiceProcessingListModels.stream().forEach(invoiceProcessingListModel -> {
-                    log.info("44444{}",invoiceProcessingListModel.getTransactionId());
-                    BillInvoice billInvoice = buildFromInvoiceProcessingListModel(invoiceProcessingListModel);
-                    billInvoice.setCompanyName(noCarWayBill.getCompanyName());
-                    billInvoice.setCompanyNum(noCarWayBill.getCompanyNum());
-                    billInvoice.setCustomerName(noCarWayBill.getCustomerName());
-                    //扣费明细入账
-                    NoCarCalculateInfor calculateInfor = new NoCarCalculateInfor();
-                    if(noCarWayBill.getInterType()!=4 && noCarWayBill.getInterType()!=3){
-                        calculateInfor.setCalculateTime(DateUtil.getCurrentDateStr());
-                    }else{
-                        calculateInfor.setCalculateTime("2021-01-11 00:00:00");
-                    }
-
-                    calculateInfor.setCompanyNum(noCarWayBill.getCompanyNum());
-                    calculateInfor.setCtype(1);
-                    calculateInfor.setCustomId(noCarWayBill.getCustomerName());
-                    calculateInfor.setBuyerName(invoiceProcessingListModel.getBuyerName());
-                    calculateInfor.setBuyerTaxpayerCode(invoiceProcessingListModel.getBuyerTaxpayerCode());
-                    calculateInfor.setInvoiceMakeTime(billInvoice.getInvoiceMakeTime());
-                    calculateInfor.setTradeId(billInvoice.getTransactionId());
-                    NoCarCalculateInfor noCarCalculateInfor = calculateInforMapper.selectByTradeId(billInvoice.getTransactionId());
-                    if(noCarCalculateInfor!=null){
-                        billInvoice.setCalculateTime(noCarCalculateInfor.getCalculateTime());
-                    }else{
-                        carCalculateInfors.add(calculateInfor);
-                        billInvoice.setCalculateTime(calculateInfor.getCalculateTime());
-                    }
-                    billInvoiceMapper.insert(billInvoice);
-                });
-                log.info("6666666{}",noCarWayBill.getBillNum());
-                if(isKf == 3)  { return new RespR(responseRespR.getData());}
-                //统一插入交易id 和 和计费信息
-                Param param = paramService.getParamsByParamName("CUST_NOCAR_FEE");
-                Double fee = Double.parseDouble(param.getParamValue());
-                Customer customer = customerMapper.selectByCustomerNameForLock(noCarWayBill.getCustomerName());
-                customer.setInvoiceTime(DateUtil.getCurrentDateStr());
-                carCalculateInfors.stream().forEach(calculateInfor -> {
-                    try {
-                        calculateInfor.setCompanyLongName(customer.getCompany());
-                        calculateInfor.setFee(fee);
-                        calculateInforMapper.insert(calculateInfor);
-                        customer.setAccountBalance(MathUtil.sub(customer.getAccountBalance(),calculateInfor.getFee()));
-                    }catch (Exception e){
-                        log.error("重复数据来啦"+calculateInfor.getTradeId());
-                    }
-
-
-                });
-                if(isKf==1){
-                customerMapper.updateByPrimaryKeySelective(customer);}
+            if(tempStatus == TWO_NUM || tempStatus == THREE_NUM){
+                if (countCalculateInfo(noCarWayBill, isKf, responseRespR)) {
+                    return new RespR(responseRespR.getData());
+                }
 
             }
             if(isInterface){
@@ -706,6 +652,70 @@ public class NoCarServiceImpl implements NoCarService{
         log.info("99999999{}",noCarWayBill.getBillNum());
         return new RespR("success");
     }
+
+    private boolean countCalculateInfo(NoCarWayBill noCarWayBill, byte isKf, RespR<WaybillNumFindInvoiceResponse> responseRespR) {
+        //删除已有发票
+        billInvoiceMapper.deleteByBillNum(noCarWayBill.getBillNum());
+        //发票入库
+        List<InvoiceProcessingListModel> invoiceProcessingListModels = responseRespR.getData().getResult();
+        //用set来去重计费信息
+        Set<NoCarCalculateInfor> carCalculateInfors = new HashSet<>();
+        invoiceProcessingListModels.stream().forEach(invoiceProcessingListModel -> {
+            log.info("44444{}",invoiceProcessingListModel.getTransactionId());
+            BillInvoice billInvoice = buildFromInvoiceProcessingListModel(invoiceProcessingListModel);
+            billInvoice.setCompanyName(noCarWayBill.getCompanyName());
+            billInvoice.setCompanyNum(noCarWayBill.getCompanyNum());
+            billInvoice.setCustomerName(noCarWayBill.getCustomerName());
+            //扣费明细入账
+            NoCarCalculateInfor calculateInfor = new NoCarCalculateInfor();
+            if(noCarWayBill.getInterType() != FOR_NUM && noCarWayBill.getInterType() != THREE_NUM){
+                calculateInfor.setCalculateTime(DateUtil.getCurrentDateStr());
+            }else{
+                calculateInfor.setCalculateTime("2021-01-11 00:00:00");
+            }
+
+            calculateInfor.setCompanyNum(noCarWayBill.getCompanyNum());
+            calculateInfor.setCtype(1);
+            calculateInfor.setCustomId(noCarWayBill.getCustomerName());
+            calculateInfor.setBuyerName(invoiceProcessingListModel.getBuyerName());
+            calculateInfor.setBuyerTaxpayerCode(invoiceProcessingListModel.getBuyerTaxpayerCode());
+            calculateInfor.setInvoiceMakeTime(billInvoice.getInvoiceMakeTime());
+            calculateInfor.setTradeId(billInvoice.getTransactionId());
+            NoCarCalculateInfor noCarCalculateInfor = calculateInforMapper.selectByTradeId(billInvoice.getTransactionId());
+            if(noCarCalculateInfor!=null){
+                billInvoice.setCalculateTime(noCarCalculateInfor.getCalculateTime());
+            }else{
+                carCalculateInfors.add(calculateInfor);
+                billInvoice.setCalculateTime(calculateInfor.getCalculateTime());
+            }
+            billInvoiceMapper.insert(billInvoice);
+        });
+        log.info("6666666{}",noCarWayBill.getBillNum());
+        if(isKf == THREE_NUM)  {
+            return true;
+        }
+        //统一插入交易id 和 和计费信息
+        Param param = paramService.getParamsByParamName("CUST_NOCAR_FEE");
+        Double fee = Double.parseDouble(param.getParamValue());
+        Customer customer = customerMapper.selectByCustomerNameForLock(noCarWayBill.getCustomerName());
+        customer.setInvoiceTime(DateUtil.getCurrentDateStr());
+        carCalculateInfors.stream().forEach(calculateInfor -> {
+            try {
+                calculateInfor.setCompanyLongName(customer.getCompany());
+                calculateInfor.setFee(fee);
+                calculateInforMapper.insert(calculateInfor);
+                customer.setAccountBalance(MathUtil.sub(customer.getAccountBalance(),calculateInfor.getFee()));
+            }catch (Exception e){
+                log.error("重复数据来啦"+calculateInfor.getTradeId());
+            }
+
+
+        });
+        if(isKf==1){
+        customerMapper.updateByPrimaryKeySelective(customer);}
+        return false;
+    }
+
     public BillInvoice buildFromInvoiceProcessingListModel(InvoiceProcessingListModel invoiceProcessingListModel){
         BillInvoice billInvoice = new BillInvoice();
         BeanUtils.copyProperties(invoiceProcessingListModel,billInvoice);
@@ -850,9 +860,9 @@ public class NoCarServiceImpl implements NoCarService{
         if(waybillCountQueryResponseRespR.getCode() != 1){
             dealMouthAcc(waybillCountQueryResponseRespR,customerRec);
             log.info(waybillCountQueryResponseRespR.getData().getTotalCount()+"---hehhe----"+monthAccountQueryVo.getCompanyName());
-            if(waybillCountQueryResponseRespR.getData().getTotalCount()>1000){
+            if(waybillCountQueryResponseRespR.getData().getTotalCount() > A_THOUSAND){
                 long pages = waybillCountQueryResponseRespR.getData().getTotalCount()%1000==0?waybillCountQueryResponseRespR.getData().getTotalCount()/1000-1:waybillCountQueryResponseRespR.getData().getTotalCount()/1000;
-                for(int i=2;i<pages+2;i++){
+                for(int i= TWO_NUM ;i<pages+TWO_NUM;i++){
                     waybillCountQueryRequest.setPageNo(i);
                     RespR<WaybillCountQueryResponse> waybillCountQueryResponseRespR1 =  noCarInterface.waybillCountQuery(waybillCountQueryRequest);
                     dealMouthAcc(waybillCountQueryResponseRespR1,customerRec);

+ 1 - 1
src/main/java/com/jkcredit/invoice/service/lowerservice/impl/SelfCarServiceLImpl.java

@@ -25,7 +25,7 @@ import com.jkcredit.invoice.model.entity.waybill.SelfCarTrade;
 import com.jkcredit.invoice.service.customer.CustomerService;
 import com.jkcredit.invoice.service.lowerservice.SelfCarServiceL;
 import com.jkcredit.invoice.service.lowerservice.vo.*;
-import com.jkcredit.invoice.service.upService.SelfCarInterface;
+import com.jkcredit.invoice.service.upservice.SelfCarInterface;
 import com.jkcredit.invoice.util.DateUtil;
 import com.jkcredit.invoice.util.MathUtil;
 import com.jkcredit.invoice.util.RespR;

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

@@ -25,6 +25,9 @@ import org.springframework.util.StringUtils;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+
+import static com.jkcredit.invoice.common.CommonConst.*;
+
 @Service
 @Slf4j
 public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCarWayBill> implements NoCarBillWayService{
@@ -106,7 +109,7 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
                     }
                     noCarWayBill.setCompanyName(customerRec.getCompanyName());
                     noCarWayBill.setCompanyNum(customerRec.getCompanyNum());
-                    if(DateUtil.getDistanceHours(noCarWayBill.getStartTime(),new Date())<-72){
+                    if(DateUtil.getDistanceHours(noCarWayBill.getStartTime(),new Date()) < INTONE){
                         noCarWaybillMapperImprt.updateBillway(-2,"失败,运单开始时间超72小时#",noCarWayBill);
                         noCarWayBill.setBillwayStatus(-2);
                         noCarWayBill.setFailReason("失败,运单开始时间超72小时");
@@ -116,9 +119,7 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
                     }
                     //1.查询是否有车辆备案
                     CustomerCarRec customerCarRec;
-
                     //2.无车车辆备案时进行车辆备案
-
                         List<CustomerCarRec> customerCarRecs = new ArrayList<>();
                         customerCarRec = new CustomerCarRec();
                         customerCarRec.setCompanyName(noCarWayBill.getCompanyName());
@@ -144,9 +145,6 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
                                 return;
                             }
                         }
-
-
-
                     //3.进行上传
                     RespR respR = noCarService.noCarWaybillStart(noCarWayBill);
                     if (respR.getCode() == 1){
@@ -156,13 +154,10 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
                         noCarWaybillMapperImprt.updateBillway(1,"",noCarWayBill);
                         return;
                     }
-
                 });
                 log.error("开始平台指令上传失败NoCarBillWayServiceImpl.batchBillWayStart:{}",stringBuffer.toString());
             }
         }).start();
-
-
         return new RespR("批次号:"+batchNumber);
     }
 
@@ -204,7 +199,7 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
                         }
                         noCarWayBill.setCompanyName(customerRec.getCompanyName());
                         noCarWayBill.setCompanyNum(customerRec.getCompanyNum());
-                        if(DateUtil.getDistanceDays(noCarWayBill.getStartTime(),new Date())>-20){
+                        if(DateUtil.getDistanceDays(noCarWayBill.getStartTime(),new Date()) > INTTOW){
                             log.info("历史运单开始上传失败:NoCarServiceImpl.noCarHisWaybillStart{},msg{}",noCarWayBill,"必须是二十天前的运单");
                             noCarWayBill.setBillwayStatus(-2);
                             noCarWayBill.setFailReason("失败,运单未满20天时效");
@@ -212,7 +207,7 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
                             insertOrUpdateBillStart(noCarWayBill);
                             return;
                         }
-                        if(DateUtil.getDistanceHours(noCarWayBill.getStartTime(),DateUtil.stringToDate(noCarWayBill.getPredictEndTime()))<-96){
+                        if(DateUtil.getDistanceHours(noCarWayBill.getStartTime(),DateUtil.stringToDate(noCarWayBill.getPredictEndTime())) < INTTHREE){
                             noCarWayBill.setBillwayStatus(-2);
                             noCarWayBill.setFailReason("运单已经超时,请拆分");
                             insertOrUpdateBillStart(noCarWayBill);
@@ -222,7 +217,6 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
                         }
                         //1.查询是否有车辆备案 /
                         CustomerCarRec customerCarRec;
-
                         //2.无车车辆备案时进行车辆备案
                             List<CustomerCarRec> customerCarRecs = new ArrayList<>();
                             customerCarRec = new CustomerCarRec();
@@ -247,9 +241,6 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
                                     return;
                                 }
                             }
-
-
-
                         //3.kais指令上传
                         NoCarWayBill noCarWayBillClo = null;
                         try{
@@ -258,7 +249,6 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
                             e.printStackTrace();
                             noCarWayBillClo = noCarWayBill;
                         }
-
                         RespR respR = noCarService.noCarHisWaybillStart(noCarWayBill);
                         if (respR.getCode() == 1){
                             stringBuffer.append("#").append(noCarWayBill.getBillNum()).append(":").append(respR.getMsg()).append("#");
@@ -271,7 +261,6 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
                             log.info(noCarWayBill.getBillNum()+"#开始指令成功"+respR.getMsg());
                             //3.kais指令上传
                             respR = noCarService.noCarHisWaybillEnd(noCarWayBillClo);
-
                             if(respR.getCode() == 1){
                                 noCarWaybillMapperImprt.updateBillway(-3,respR.getMsg(),noCarWayBill);
                                 log.info(noCarWayBill.getBillNum()+"#结束指令失败"+respR.getMsg());
@@ -285,15 +274,12 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
                     }catch (Exception e){
                         e.printStackTrace();
                     }
-
-
                 });
                 if(!StringUtils.isEmpty(stringBuffer.toString())){
                     log.error(stringBuffer.toString());
                 }
             }
         }).start();
-
         return new RespR("批次号:"+batchNumber);
     }
 

+ 6 - 8
src/main/java/com/jkcredit/invoice/service/nocar/impl/NoCarRecServiceImpl.java

@@ -11,7 +11,7 @@ import com.jkcredit.invoice.mapper.customer.CustomerRecMapper;
 import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
 import com.jkcredit.invoice.model.entity.customer.CustomerRec;
 import com.jkcredit.invoice.service.nocar.NoCarRecService;
-import com.jkcredit.invoice.service.upService.SelfCarInterface;
+import com.jkcredit.invoice.service.upservice.SelfCarInterface;
 import com.jkcredit.invoice.util.DateUtil;
 import com.jkcredit.invoice.util.RespR;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -19,6 +19,9 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
 import java.util.List;
+
+import static com.jkcredit.invoice.common.CommonConst.SELF_CAR;
+
 @Service
 public class NoCarRecServiceImpl extends ServiceImpl<CustomerCarRecMapper,CustomerCarRec> implements NoCarRecService {
     @Autowired
@@ -29,7 +32,7 @@ public class NoCarRecServiceImpl extends ServiceImpl<CustomerCarRecMapper,Custom
     SelfCarInterface selfCarInterface;
     @Override
     public IPage<List<CustomerCarRec>> findByPageAndCarRec(Page page, CustomerCarRec customerCarRec) {
-        if("0".equals(customerCarRec.getBusinessType()) && !StringUtils.isEmpty(customerCarRec.getCarNum())){
+        if(SELF_CAR.equals(customerCarRec.getBusinessType()) && !StringUtils.isEmpty(customerCarRec.getCarNum())){
             CustomerRec customerRec = new CustomerRec();
             customerRec.setCompanyName(customerCarRec.getCompanyName());
             customerRec.setCustomerName(customerCarRec.getCustomerName());
@@ -66,7 +69,6 @@ public class NoCarRecServiceImpl extends ServiceImpl<CustomerCarRecMapper,Custom
                                 }
                             });
                         }
-
                         for(CardBindQueryListToBModel bModel :bModels){
                             boolean has = false;
                             if(customerCarRecs != null && customerCarRecs.size()>0){
@@ -77,7 +79,6 @@ public class NoCarRecServiceImpl extends ServiceImpl<CustomerCarRecMapper,Custom
                                     }
                                 }
                             }
-
                            if(!has){
                                CustomerCarRec customerCarRecDb = new CustomerCarRec();
                                customerCarRecDb.setInterType(1);
@@ -92,7 +93,6 @@ public class NoCarRecServiceImpl extends ServiceImpl<CustomerCarRecMapper,Custom
                                customerCarRecDb.setRecStatus(1);
                                customerCarRecMapper.insert(customerCarRecDb);
                            }
-
                         }
                     }else{
                         //车牌下的卡都更新为注销
@@ -103,9 +103,7 @@ public class NoCarRecServiceImpl extends ServiceImpl<CustomerCarRecMapper,Custom
                             });
                         }
                     }
-
-            }
-
+                }
             }
         }
         return customerCarRecMapper.selectAllByPage(page,customerCarRec);

+ 2 - 1
src/main/java/com/jkcredit/invoice/service/upService/CommInterFace.java

@@ -1,10 +1,11 @@
-package com.jkcredit.invoice.service.upService;
+package com.jkcredit.invoice.service.upservice;
 
 import cn.com.taiji.sdk.model.comm.protocol.eoms.company.*;
 import com.jkcredit.invoice.util.RespR;
 
 /**
  * 共同接口
+ * @author mumuxigua
  */
 public interface CommInterFace {
     /**

+ 2 - 2
src/main/java/com/jkcredit/invoice/service/upService/NoCarInterface.java

@@ -1,6 +1,5 @@
-package com.jkcredit.invoice.service.upService;
+package com.jkcredit.invoice.service.upservice;
 
-import cn.com.taiji.sdk.model.comm.protocol.eoms.company.*;
 import cn.com.taiji.sdk.model.comm.protocol.tts.vehicle.VehicleQueryRequest;
 import cn.com.taiji.sdk.model.comm.protocol.tts.vehicle.VehicleQueryResponse;
 import cn.com.taiji.sdk.model.comm.protocol.tts.vehicle.VehicleRegisterRequest;
@@ -10,6 +9,7 @@ import com.jkcredit.invoice.util.RespR;
 
 /**
  * 无车车相关接口
+ * @author mumuxigua
  */
 public interface NoCarInterface {
 

+ 2 - 1
src/main/java/com/jkcredit/invoice/service/upService/SelfCarInterface.java

@@ -1,4 +1,4 @@
-package com.jkcredit.invoice.service.upService;
+package com.jkcredit.invoice.service.upservice;
 
 import cn.com.taiji.sdk.model.comm.protocol.tts.card.server.*;
 import cn.com.taiji.sdk.model.comm.protocol.tts.invoice.server.*;
@@ -10,6 +10,7 @@ import com.jkcredit.invoice.util.RespR;
 
 /**
  * 自有车调用平台接口
+ * @author mumuxigua
  */
 public interface SelfCarInterface {
 

+ 5 - 2
src/main/java/com/jkcredit/invoice/service/upService/impl/CommInterFaceImpl.java

@@ -1,14 +1,17 @@
-package com.jkcredit.invoice.service.upService.impl;
+package com.jkcredit.invoice.service.upservice.impl;
 
 import cn.com.taiji.common.manager.net.http.binclient.ApiRequestException;
 import cn.com.taiji.sdk.comm.ETCCommHelper;
 import cn.com.taiji.sdk.model.comm.protocol.eoms.company.*;
-import com.jkcredit.invoice.service.upService.CommInterFace;
+import com.jkcredit.invoice.service.upservice.CommInterFace;
 import com.jkcredit.invoice.util.RespR;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
 import java.io.IOException;
+/**
+ * @author mumuxigua
+ */
 @Service("commInterFace")
 @Slf4j
 public class CommInterFaceImpl implements CommInterFace{

+ 5 - 2
src/main/java/com/jkcredit/invoice/service/upService/impl/NoCarInterfaceImpl.java

@@ -1,4 +1,4 @@
-package com.jkcredit.invoice.service.upService.impl;
+package com.jkcredit.invoice.service.upservice.impl;
 import cn.com.taiji.common.manager.net.http.binclient.ApiRequestException;
 import cn.com.taiji.sdk.comm.ETCCommHelper;
 import cn.com.taiji.sdk.model.comm.protocol.tts.vehicle.VehicleQueryRequest;
@@ -6,13 +6,16 @@ import cn.com.taiji.sdk.model.comm.protocol.tts.vehicle.VehicleQueryResponse;
 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.service.upService.NoCarInterface;
+import com.jkcredit.invoice.service.upservice.NoCarInterface;
 import com.jkcredit.invoice.util.RespR;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
 import java.io.IOException;
 
+/**
+ * @author mumuxigua
+ */
 @Service("noCarInterface")
 @Slf4j
 public class NoCarInterfaceImpl implements NoCarInterface {

+ 2 - 2
src/main/java/com/jkcredit/invoice/service/upService/impl/SelfCarInterfaceImpl.java

@@ -1,4 +1,4 @@
-package com.jkcredit.invoice.service.upService.impl;
+package com.jkcredit.invoice.service.upservice.impl;
 
 import cn.com.taiji.common.manager.net.http.binclient.ApiRequestException;
 import cn.com.taiji.sdk.comm.ETCCommHelper;
@@ -8,7 +8,7 @@ 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 cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.TradeApplyQueryRequest;
 import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.TradeApplyQueryResponse;
-import com.jkcredit.invoice.service.upService.SelfCarInterface;
+import com.jkcredit.invoice.service.upservice.SelfCarInterface;
 import com.jkcredit.invoice.util.RespR;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;

+ 4 - 2
src/main/java/com/jkcredit/invoice/service/user/impl/UserServiceImpl.java

@@ -4,10 +4,10 @@ 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.user.UserMapper;
 import com.jkcredit.invoice.model.entity.customer.Customer;
 import com.jkcredit.invoice.model.entity.user.Role;
 import com.jkcredit.invoice.model.entity.user.User;
-import com.jkcredit.invoice.mapper.user.UserMapper;
 import com.jkcredit.invoice.service.customer.CustomerService;
 import com.jkcredit.invoice.service.user.RoleService;
 import com.jkcredit.invoice.service.user.UserService;
@@ -20,6 +20,8 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 
+import static com.jkcredit.invoice.common.CommonConst.ONE;
+
 /**
  * @description:
  * @author: sunzhaoning
@@ -99,7 +101,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         //设置创建时间
         user.setCreateTime(System.currentTimeMillis());
         //如果是自有车或无车需要新增客户信息
-        if(!"1".equals(user.getRoleId())){
+        if(!ONE.equals(user.getRoleId())){
             Customer customer = new Customer();
             customer.setCustomerName(user.getUserName());
             customer.setCompany(user.getCompany());

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

@@ -4,6 +4,8 @@ import org.apache.commons.codec.binary.Base64;
 
 import java.io.*;
 
+import static com.jkcredit.invoice.common.CommonConst.COMMA;
+
 public class Base64Util {
     public static void main(String [] args){
         //将PDF格式文件转成base64编码
@@ -71,7 +73,7 @@ public class Base64Util {
      */
     public static double base64FileSize(String base64String) {
         /**检测是否含有base64,文件头)*/
-        if (base64String.lastIndexOf(",") > 0) {
+        if (base64String.lastIndexOf(COMMA) > 0) {
             base64String = base64String.substring(base64String.lastIndexOf(",")+1);
         }
         /** 获取base64字符串长度(不含data:audio/wav;base64,文件头) */

+ 1 - 1
src/main/java/com/jkcredit/invoice/util/Base64Utils.java

@@ -140,7 +140,7 @@ public class Base64Utils {
 
 
     // 测试
-    public static void main(String args[]){
+    public static void main(String[] args){
         // 1.测试:text明文 转 Base64字符串
         String text = "这是一串需要编码的明文,可以是URL、图片、文件或其他。";
         String result1 = Base64Utils.textToBase64Str(text);

+ 47 - 26
src/main/java/com/jkcredit/invoice/util/LogUtils.java

@@ -15,6 +15,27 @@ import java.security.Key;
  */
 public class LogUtils {
 	private static final String PASSWORD_CRYPT_KEY = "3cm.xin.";
+
+	private static final String MOBILE = "mobile";
+
+
+	private static final String NAME = "name";
+
+
+	private static final String ID_NUMBER = "id_number";
+
+
+	private static final String IDCARD = "idcard";
+
+
+	private static final String BANK_CARD_NUMBER = "bank_card_number";
+
+
+	private static final String BANK_NO = "bank_no";
+
+	private static final String UTF = "UTF-8";
+
+	private static final int EIGHT = 8;
     /**
      * @param data
      * @return
@@ -22,23 +43,23 @@ public class LogUtils {
      */
     public static String decode(String data) throws Exception {
     	JSONObject object = JSONObject.parseObject(data);
-    	if(object.get("mobile") != null) {
-    		object.put("mobile", decryptDes(object.getString("mobile")));
+    	if(object.get(MOBILE) != null) {
+    		object.put(MOBILE, decryptDes(object.getString(MOBILE)));
     	}
-    	if(object.get("name") != null) {
-    		object.put("name", decryptDes(object.getString("name")));
+    	if(object.get(NAME) != null) {
+    		object.put(NAME, decryptDes(object.getString(NAME)));
     	}
-    	if(object.get("id_number") != null) {
-    		object.put("id_number", decryptDes(object.getString("id_number")));
+    	if(object.get(ID_NUMBER) != null) {
+    		object.put(ID_NUMBER, decryptDes(object.getString(ID_NUMBER)));
     	}
-    	if(object.get("idcard") != null) {
-    		object.put("idcard", decryptDes(object.getString("idcard")));
+    	if(object.get(IDCARD) != null) {
+    		object.put(IDCARD, decryptDes(object.getString(IDCARD)));
     	}
-    	if(object.get("bank_card_number") != null) {
-    		object.put("bank_card_number", decryptDes(object.getString("bank_card_number")));
+    	if(object.get(BANK_CARD_NUMBER) != null) {
+    		object.put(BANK_CARD_NUMBER, decryptDes(object.getString(BANK_CARD_NUMBER)));
     	}
-    	if(object.get("bank_no") != null) {
-    		object.put("bank_no", decryptDes(object.getString("bank_no")));
+    	if(object.get(BANK_NO) != null) {
+    		object.put(BANK_NO, decryptDes(object.getString(BANK_NO)));
     	}
         return object.toString();
     }
@@ -54,23 +75,23 @@ public class LogUtils {
     	try {
 			data = URLDecoder.decode(data, "utf-8");
 			JSONObject object = JSONObject.parseObject(data);
-	    	if(object.get("mobile") != null) {
-	    		object.put("mobile", encryptDes(object.getString("mobile")));
+	    	if(object.get(MOBILE) != null) {
+	    		object.put(MOBILE, encryptDes(object.getString(MOBILE)));
 	    	}
-	    	if(object.get("name") != null) {
-	    		object.put("name",encryptDes(object.getString("name")));
+	    	if(object.get(NAME) != null) {
+	    		object.put(NAME,encryptDes(object.getString(NAME)));
 	    	}
-	    	if(object.get("id_number") != null) {
-	    		object.put("id_number", encryptDes(object.getString("id_number")));
+	    	if(object.get(ID_NUMBER) != null) {
+	    		object.put(ID_NUMBER, encryptDes(object.getString(ID_NUMBER)));
 	    	}
-	    	if(object.get("idcard") != null) {
-	    		object.put("idcard", encryptDes(object.getString("idcard")));
+	    	if(object.get(IDCARD) != null) {
+	    		object.put(IDCARD, encryptDes(object.getString(IDCARD)));
 	    	}
-	    	if(object.get("bank_card_number") != null) {
-	    		object.put("bank_card_number", encryptDes(object.getString("bank_card_number")));
+	    	if(object.get(BANK_CARD_NUMBER) != null) {
+	    		object.put(BANK_CARD_NUMBER, encryptDes(object.getString(BANK_CARD_NUMBER)));
 	    	}
-	    	if(object.get("bank_no") != null) {
-	    		object.put("bank_no", encryptDes(object.getString("bank_no")));
+	    	if(object.get(BANK_NO) != null) {
+	    		object.put(BANK_NO, encryptDes(object.getString(BANK_NO)));
 	    	}
 	        return object.toString();
 		} catch (UnsupportedEncodingException e) {
@@ -89,7 +110,7 @@ public class LogUtils {
 		try {
 			StringBuffer sb = new StringBuffer();
 			sb.append(encryptString);
-			for (int i = 0; i < 8 - encryptString.getBytes("UTF-8").length % 8 ; i++) {
+			for (int i = 0; i < EIGHT - encryptString.getBytes(UTF).length % EIGHT ; i++) {
 				sb.append("=");
 			}
 			encryptString = sb.toString();
@@ -114,7 +135,7 @@ public class LogUtils {
 		SecretKeySpec key = new SecretKeySpec(getKey(PASSWORD_CRYPT_KEY), "DES");
 		Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding");
 		cipher.init(Cipher.DECRYPT_MODE, key);
-		byte decryptedData[] = cipher.doFinal(Base64.decodeBase64(decryptString));
+		byte[] decryptedData = cipher.doFinal(Base64.decodeBase64(decryptString));
 		return new String(decryptedData).replaceAll("=", "");
 	}
 	

+ 1 - 1
src/main/java/com/jkcredit/invoice/util/QueryDemo_Test.java

@@ -38,7 +38,7 @@ public class QueryDemo_Test {
      *
      * @param args
      */
-    public static void main(String args[]) throws Exception {
+    public static void main(String[] args) throws Exception {
         QueryDemo_Test demo = new QueryDemo_Test();
         demo.runMainService();
     }