Browse Source

错误信息调整

xusonglin 5 years ago
parent
commit
75f89e4f32

+ 2 - 5
src/main/java/com/jkcredit/invoice/hub/controller/rest/forward/ForwardResource.java

@@ -1,6 +1,5 @@
 package com.jkcredit.invoice.hub.controller.rest.forward;
 
-import cn.com.taiji.common.manager.net.http.binclient.ApiRequestException;
 import com.alibaba.fastjson.JSON;
 import com.jkcredit.invoice.hub.constant.CommonConstant;
 import com.jkcredit.invoice.hub.controller.base.RestResource;
@@ -9,6 +8,7 @@ import com.jkcredit.invoice.hub.service.apiCarFree.ApiCarFreeService;
 import com.jkcredit.invoice.hub.service.apiCompany.ApiCompanyService;
 import com.jkcredit.invoice.hub.service.apiUser.ApiUserService;
 import com.jkcredit.invoice.hub.service.apiWayBillCountQuery.WayBillCountQueryService;
+import com.jkcredit.invoice.hub.spi.lang.exception.ApiRequestException;
 import com.jkcredit.invoice.hub.spi.lang.exception.ServiceException;
 import com.jkcredit.invoice.hub.spi.rest.data.ApiRequestParam;
 import com.jkcredit.invoice.hub.spi.rest.data.ApiResponseData;
@@ -89,10 +89,7 @@ public class ForwardResource extends RestResource {
             return ApiResponseData.failure(ApiResponseCodeEnum.CODE_9998.getValue(), ApiResponseCodeEnum.CODE_9998.getDesc());
         } catch (ApiRequestException ae) {
             log.error("接口业务失败,失败原因:{}", ae.getMessage());
-            if (ae.getErrCode() == 803) {
-                return ApiResponseData.failure(ApiResponseCodeEnum.CODE_200.getValue(), ae.getMessage());
-            }
-            return ApiResponseData.failure(ae.getErrCode(), ae.getMessage());
+            return ApiResponseData.failure(ApiResponseCodeEnum.CODE_200.getValue(), ae.getMessage());
         }
     }
 }

+ 8 - 8
src/main/java/com/jkcredit/invoice/hub/service/apiCarFree/ApiCarFreeServiceImpl.java

@@ -87,7 +87,7 @@ public class ApiCarFreeServiceImpl extends BaseService implements ApiCarFreeServ
             throw new ServiceException(CommonConstant.QUERY_FAILED);
         } catch (ApiRequestException apie) {
             log.error("[-vehicleRegisterQuery-] 错误信息:" + apie.getMessage());
-            throw new ApiRequestException(apie.getMessage(), ApiResponseCodeEnum.CODE_200.getValue());
+            throw new com.jkcredit.invoice.hub.spi.lang.exception.ApiRequestException(apie.getMessage());
         } catch (ServiceException se) {
             log.error("[-vehicleRegisterQuery-] 错误信息:" + se.getMessage());
             throw new ServiceException(se.getMessage());
@@ -123,7 +123,7 @@ public class ApiCarFreeServiceImpl extends BaseService implements ApiCarFreeServ
             throw new ServiceException(CommonConstant.QUERY_FAILED);
         } catch (ApiRequestException apie) {
             log.error("[-apiVehicleRegister-] 错误信息:" + apie.getMessage());
-            throw new ApiRequestException(apie.getMessage(), ApiResponseCodeEnum.CODE_200.getValue());
+            throw new com.jkcredit.invoice.hub.spi.lang.exception.ApiRequestException(apie.getMessage());
         } catch (ServiceException se) {
             log.error("[-apiVehicleRegister-] 错误信息:" + se.getMessage());
             throw new ServiceException(se.getMessage());
@@ -173,7 +173,7 @@ public class ApiCarFreeServiceImpl extends BaseService implements ApiCarFreeServ
             throw new ServiceException(CommonConstant.QUERY_FAILED);
         } catch (ApiRequestException apie) {
             log.error("[-wayBillStart-] 错误信息:" + apie.getMessage());
-            throw new ApiRequestException(apie.getMessage(), ApiResponseCodeEnum.CODE_200.getValue());
+            throw new com.jkcredit.invoice.hub.spi.lang.exception.ApiRequestException(apie.getMessage());
         } catch (ServiceException se) {
             log.error("[-wayBillStart-] 错误信息:" + se.getMessage());
             throw new ServiceException(se.getMessage());
@@ -215,7 +215,7 @@ public class ApiCarFreeServiceImpl extends BaseService implements ApiCarFreeServ
             throw new ServiceException(CommonConstant.QUERY_FAILED);
         } catch (ApiRequestException apie) {
             log.error("[-wayBillEnd-] 错误信息:" + apie.getMessage());
-            throw new ApiRequestException(apie.getMessage(), ApiResponseCodeEnum.CODE_200.getValue());
+            throw new com.jkcredit.invoice.hub.spi.lang.exception.ApiRequestException(apie.getMessage());
         } catch (ServiceException se) {
             log.error("[-wayBillEnd-] 错误信息:" + se.getMessage());
             throw new ServiceException(se.getMessage());
@@ -265,7 +265,7 @@ public class ApiCarFreeServiceImpl extends BaseService implements ApiCarFreeServ
             throw new ServiceException(CommonConstant.QUERY_FAILED);
         } catch (ApiRequestException apie) {
             log.error("[-wayBillHistoryStart-] 错误信息:" + apie.getMessage());
-            throw new ApiRequestException(apie.getMessage(), ApiResponseCodeEnum.CODE_200.getValue());
+            throw new com.jkcredit.invoice.hub.spi.lang.exception.ApiRequestException(apie.getMessage());
         } catch (ServiceException se) {
             log.error("[-wayBillHistoryStart-] 错误信息:" + se.getMessage());
             throw new ServiceException(se.getMessage());
@@ -306,7 +306,7 @@ public class ApiCarFreeServiceImpl extends BaseService implements ApiCarFreeServ
             throw new ServiceException(CommonConstant.QUERY_FAILED);
         } catch (ApiRequestException apie) {
             log.error("[-wayBillHistoryEnd-] 错误信息:" + apie.getMessage());
-            throw new ApiRequestException(apie.getMessage(), ApiResponseCodeEnum.CODE_200.getValue());
+            throw new com.jkcredit.invoice.hub.spi.lang.exception.ApiRequestException(apie.getMessage());
         } catch (ServiceException se) {
             log.error("[-wayBillHistoryEnd-] 错误信息:" + se.getMessage());
             throw new ServiceException(se.getMessage());
@@ -341,7 +341,7 @@ public class ApiCarFreeServiceImpl extends BaseService implements ApiCarFreeServ
             throw new ServiceException(CommonConstant.QUERY_FAILED);
         } catch (ApiRequestException apie) {
             log.error("[-waiBillNumFindInvoice-] 错误信息:" + apie.getMessage());
-            throw new ApiRequestException(apie.getMessage(), ApiResponseCodeEnum.CODE_200.getValue());
+            throw new com.jkcredit.invoice.hub.spi.lang.exception.ApiRequestException(apie.getMessage());
         } catch (ServiceException se) {
             log.error("[-waiBillNumFindInvoice-] 错误信息:" + se.getMessage());
             throw new ServiceException(se.getMessage());
@@ -363,7 +363,7 @@ public class ApiCarFreeServiceImpl extends BaseService implements ApiCarFreeServ
             return apiCarFreeChargeService.charge(po);
         } catch (ServiceException se) {
             log.error("[-findInvoice-] 错误信息:" + se.getMessage());
-            throw new ApiRequestException(se.getMessage(), ApiResponseCodeEnum.CODE_200.getValue());
+            throw new ServiceException(se.getMessage());
         }
     }
 

+ 3 - 3
src/main/java/com/jkcredit/invoice/hub/service/apiCompany/ApiCompanyServiceImpl.java

@@ -40,8 +40,8 @@ public class ApiCompanyServiceImpl extends BaseService implements ApiCompanyServ
             validate(dto);
 
             CompanyQueryRequest request = new CompanyQueryRequest();
-            request.setCompanyName(param.get("companyName").toString().trim());
-            request.setTaxpaterCode(param.get("taxplayerCode").toString().trim());
+            request.setCompanyName(dto.getCompanyName());
+            request.setTaxpaterCode(dto.getTaxplayerCode());
             String fileName = request.getFilename();
 
             // 调用upload 发送数据
@@ -57,7 +57,7 @@ public class ApiCompanyServiceImpl extends BaseService implements ApiCompanyServ
             throw new ServiceException(CommonConstant.QUERY_FAILED);
         } catch (ApiRequestException apie) {
             log.error("[-companyQuery-] 错误信息:" + apie.getMessage());
-            throw new ApiRequestException(apie.getMessage(), ApiResponseCodeEnum.CODE_200.getValue());
+            throw new com.jkcredit.invoice.hub.spi.lang.exception.ApiRequestException(apie.getMessage());
         } catch (ServiceException se) {
             log.error("[-companyQuery-] 错误信息:" + se.getMessage());
             throw new ServiceException(se.getMessage());

+ 16 - 0
src/main/java/com/jkcredit/invoice/hub/spi/lang/exception/ApiRequestException.java

@@ -0,0 +1,16 @@
+package com.jkcredit.invoice.hub.spi.lang.exception;
+
+/**
+ * @description:
+ * @author: xusonglin
+ * @create: 2020/1/20 10:51
+ * @version: V1.0
+ **/
+public class ApiRequestException extends RuntimeException {
+    public ApiRequestException() {
+    }
+
+    public ApiRequestException(String message) {
+        super(message);
+    }
+}