Parcourir la source

20220207_4后端日志更新代码_代码质量测试1-编译器自测修复

mashengyi il y a 3 ans
Parent
commit
c826c0e89a

+ 8 - 6
src/main/java/com/jkcredit/invoice/credit/SimpleCORSFilter.java

@@ -39,11 +39,13 @@ public class SimpleCORSFilter implements Filter {
 
 
 
-
+    private static final String PASS_API = "api=credit.sec.data";
+    private static final String PASS_GATEWAY = "/gateway";
+    private static final String PASS_REST = "/api/rest";
 
 
     //全局定义ApiConstant
-    private final static Map<String, String> apiMaps=new HashMap<String, String>(){
+    private final static Map<String, String> API_MAPS=new HashMap<String, String>(){
         {
 
 
@@ -297,16 +299,16 @@ public class SimpleCORSFilter implements Filter {
         try {
 
 
-            if(null != request && null != request.getQueryString() && !request.getQueryString().equals("api=credit.sec.data")){
+            if(null != request && null != request.getQueryString() && !PASS_API.equals(request.getQueryString())){
                 return ResponseCode.UNKNOWN_ERROR;
             };
 
-            if(null != request && null != request.getQueryString() && !request.getRequestURI().equals("/gateway")){
+            if(null != request && null != request.getQueryString() && !PASS_GATEWAY.equals(request.getRequestURI())){
                 return ResponseCode.UNKNOWN_ERROR;
             }
 
 
-            if(null != request && null == request.getQueryString() && !request.getRequestURI().equals("/api/rest")){
+            if(null != request && null == request.getQueryString() && !PASS_REST.equals(request.getRequestURI())){
                 return ResponseCode.UNKNOWN_ERROR;
             }
 
@@ -347,7 +349,7 @@ public class SimpleCORSFilter implements Filter {
             if (0 >= new BigDecimal(customer1.getAccountBalance()).compareTo(new BigDecimal(0.0))) {
                 return ResponseCode.BALANCE_QUERY_ERROR;
             }
-            if(!apiMaps.containsKey(api)){
+            if(!API_MAPS.containsKey(api)){
                 return ResponseCode.CUSTOMER_QUERY_ERROR;
             }
 

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

@@ -38,6 +38,8 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
     @Autowired
     CustomerRecMapper customerRecMapper;
 
+    private static final String PDF = "PDF";
+
 
     /**
      * 无车 自有车 企业注册
@@ -291,7 +293,7 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
 
 
             String fileType = contractFileName.substring(contractFileName.lastIndexOf(".") + 1, contractFileName.length()).toLowerCase();
-            if(!fileType.equals("pdf")){
+            if(!PDF.equals(fileType)){
                 result.setMsg("必须是pdf文件!");
                 return  result;
             }

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

@@ -40,7 +40,7 @@ public class QueryDemo_Test {
 	/**
 	 *	 分配的appKey
 	 */
-							  private static final String appKey = "jkxy";
+							  private static final String APP_KEY = "jkxy";
 							  // 	 private static final String appKey = "junxin_test";
 
 		 	  	//			  	 private static final String appKey = "DATA_TEST";
@@ -88,7 +88,7 @@ public class QueryDemo_Test {
 		 */
 		JSONObject paramJsonObj = new JSONObject();
 		paramJsonObj.put("api", "COMPANY_QUERY_V1");//CMCC_3RD_DETAIL_V15C//CMCC_3RD_DETAIL_V32//CMCC_2ND_V17//CMCC_ONLINE_CHECK_V5
-		paramJsonObj.put("appKey", appKey);
+		paramJsonObj.put("appKey", APP_KEY);
 	    paramJsonObj.put("appSecret",
 	    		//		"D78C393359BF128715C65D91C67051478A4DFC13");
 	    	"7697CE9BB9D5A856CFDDE738320AD34EA53E483C");