From 0840168fb228abb780c6b95ec279813884e72dd6 Mon Sep 17 00:00:00 2001 From: dongxiaoke <1910333201@qq.com> Date: Tue, 25 Apr 2023 15:49:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E7=A8=8E=E6=A1=86=E6=9E=B6=EF=BC=9A?= =?UTF-8?q?=E8=BF=9B=E9=A1=B9=E6=9C=8D=E5=8A=A1=E6=8B=86=E5=88=86=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=EF=BC=8C=E6=8B=86=E5=88=86=E6=9F=A5=E9=AA=8C=E3=80=81?= =?UTF-8?q?=E8=AE=A4=E8=AF=81=E5=8D=95=E7=8B=AC=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../http/income/v1/InvoiceAuthController.java | 31 ++++---- .../service/impl/EleAuthInvoiceImpl.java | 2 +- .../AisinoIncomeRequestAdapterImpl.java | 1 + ...ElephentIncomeAuthRequestAdapterImpl.java} | 4 +- ...ElephentIncomeAuthResponseAdapterImpl.java | 70 +++++++++++++++++++ 5 files changed, 88 insertions(+), 20 deletions(-) rename jianshui-income/src/main/java/com/jianshui/income/service/impl/adapter/request/{ElephentIncomeRequestAdapterImpl.java => ElephentIncomeAuthRequestAdapterImpl.java} (96%) create mode 100644 jianshui-income/src/main/java/com/jianshui/income/service/impl/adapter/response/ElephentIncomeAuthResponseAdapterImpl.java diff --git a/jianshui-admin/src/main/java/com/jianshui/api/controller/http/income/v1/InvoiceAuthController.java b/jianshui-admin/src/main/java/com/jianshui/api/controller/http/income/v1/InvoiceAuthController.java index f34ddac..6d4e768 100644 --- a/jianshui-admin/src/main/java/com/jianshui/api/controller/http/income/v1/InvoiceAuthController.java +++ b/jianshui-admin/src/main/java/com/jianshui/api/controller/http/income/v1/InvoiceAuthController.java @@ -57,10 +57,7 @@ public class InvoiceAuthController { //入口报文适配器标志 这个东西是AisinoIncomeRequestAdapterImpl 中间的那块儿 - private final static String SERVICE_KEY = "income"; - - - // TODO-xkng: 2022/9/20 看看请求的前置处理封到一个service里面去,调用一个。先把接口搞出来着。 + private final static String SERVICE_KEY = "auth"; @ApiOperation("状态采集") @@ -87,7 +84,7 @@ public class InvoiceAuthController { JSONObject requestBody = incomeRequestService.decrypt(request, companyservice); // 获得请求实例(根据companyservicemanager配置获取),并且进行扣费 - String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()) + "_auth"; + String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()); IAuthInvoice iAuthInvoice = collectServiceFactory.getServiceAuth(serviceKey); //请求 @@ -130,7 +127,7 @@ public class InvoiceAuthController { // 获得请求实例,并且进行扣费 - String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()) + "_auth"; + String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()); IAuthInvoice iAuthInvoice = collectServiceFactory.getServiceAuth(serviceKey); //请求 @@ -171,7 +168,7 @@ public class InvoiceAuthController { // 获得请求实例,并且进行扣费 - String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()) + "_auth"; + String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()); IAuthInvoice iAuthInvoice = collectServiceFactory.getServiceAuth(serviceKey); //请求 @@ -212,7 +209,7 @@ public class InvoiceAuthController { // 获得请求实例,并且进行扣费 - String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()) + "_auth"; + String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()); IAuthInvoice iAuthInvoice = collectServiceFactory.getServiceAuth(serviceKey); //请求 @@ -253,7 +250,7 @@ public class InvoiceAuthController { // 获得请求实例,并且进行扣费 - String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()) + "_auth"; + String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()); IAuthInvoice iAuthInvoice = collectServiceFactory.getServiceAuth(serviceKey); //请求 @@ -293,7 +290,7 @@ public class InvoiceAuthController { // 获得请求实例,并且进行扣费 - String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()) + "_auth"; + String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()); IAuthInvoice iAuthInvoice = collectServiceFactory.getServiceAuth(serviceKey); //请求 @@ -334,7 +331,7 @@ public class InvoiceAuthController { // 获得请求实例,并且进行扣费 - String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()) + "_auth"; + String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()); IAuthInvoice iAuthInvoice = collectServiceFactory.getServiceAuth(serviceKey); //请求 @@ -375,7 +372,7 @@ public class InvoiceAuthController { // 获得请求实例,并且进行扣费 - String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()) + "_auth"; + String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()); IAuthInvoice iAuthInvoice = collectServiceFactory.getServiceAuth(serviceKey); //请求 @@ -422,7 +419,7 @@ public class InvoiceAuthController { // 获得请求实例,并且进行扣费 - String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()) + "_auth"; + String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()); IAuthInvoice incomeService = collectServiceFactory.getServiceAuth(serviceKey); // 13位时间戳转10位 String CJKSRQ = requestBody.getString("CJKSRQ"); @@ -472,7 +469,7 @@ public class InvoiceAuthController { // 获得请求实例,并且进行扣费 - String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()) + "_auth"; + String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()); IAuthInvoice incomeService = collectServiceFactory.getServiceAuth(serviceKey); IncomeMasterInformationDTO incomeGetInvoiceDTO = requestBody.toJavaObject(IncomeMasterInformationDTO.class); AjaxResult result = incomeService.masterInformation(incomeGetInvoiceDTO, companyservice); @@ -511,7 +508,7 @@ public class InvoiceAuthController { // 获得请求实例,并且进行扣费 - String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()) + "_auth"; + String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()); IAuthInvoice incomeService = collectServiceFactory.getServiceAuth(serviceKey); IncomeCountInfoDTO incomeGetInvoiceDTO = requestBody.toJavaObject(IncomeCountInfoDTO.class); AjaxResult result = incomeService.getCountInfo(incomeGetInvoiceDTO, companyservice); @@ -551,7 +548,7 @@ public class InvoiceAuthController { // 获得请求实例,并且进行扣费 - String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()) + "_auth"; + String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()); IAuthInvoice incomeService = collectServiceFactory.getServiceAuth(serviceKey); IncomeApplyCountDTO incomeGetInvoiceDTO = requestBody.toJavaObject(IncomeApplyCountDTO.class); AjaxResult result = incomeService.applyCount(incomeGetInvoiceDTO, companyservice); @@ -590,7 +587,7 @@ public class InvoiceAuthController { // 获得请求实例,并且进行扣费 - String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()) + "_auth"; + String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()); IAuthInvoice incomeService = collectServiceFactory.getServiceAuth(serviceKey); IncomeApplyCountResultDTO incomeGetInvoiceDTO = requestBody.toJavaObject(IncomeApplyCountResultDTO.class); AjaxResult result = incomeService.applyCountResult(incomeGetInvoiceDTO, companyservice); diff --git a/jianshui-income/src/main/java/com/jianshui/income/service/impl/EleAuthInvoiceImpl.java b/jianshui-income/src/main/java/com/jianshui/income/service/impl/EleAuthInvoiceImpl.java index 0f152fe..b6320ba 100644 --- a/jianshui-income/src/main/java/com/jianshui/income/service/impl/EleAuthInvoiceImpl.java +++ b/jianshui-income/src/main/java/com/jianshui/income/service/impl/EleAuthInvoiceImpl.java @@ -51,7 +51,7 @@ import static com.jianshui.income.utils.elephant.ElephantCompanyserviceUtils.req * @author xkng * @date 2022/9/9 16:03 */ -@Component(value = "elephant_income_auth") // 这里是后台字典的服务配置键值 配置的 +@Component(value = "elephant_auth") // 这里是后台字典的服务配置键值 配置的 public class EleAuthInvoiceImpl implements IAuthInvoice { private static final Logger log = LoggerFactory.getLogger(EleAuthInvoiceImpl.class); diff --git a/jianshui-income/src/main/java/com/jianshui/income/service/impl/adapter/request/AisinoIncomeRequestAdapterImpl.java b/jianshui-income/src/main/java/com/jianshui/income/service/impl/adapter/request/AisinoIncomeRequestAdapterImpl.java index 05179dd..1cdbe9a 100644 --- a/jianshui-income/src/main/java/com/jianshui/income/service/impl/adapter/request/AisinoIncomeRequestAdapterImpl.java +++ b/jianshui-income/src/main/java/com/jianshui/income/service/impl/adapter/request/AisinoIncomeRequestAdapterImpl.java @@ -18,6 +18,7 @@ import java.util.Map; import java.util.Set; /** + * 进项接口 * @Description * @Author 巩权林 * @Date 2022-03-25 10:03 diff --git a/jianshui-income/src/main/java/com/jianshui/income/service/impl/adapter/request/ElephentIncomeRequestAdapterImpl.java b/jianshui-income/src/main/java/com/jianshui/income/service/impl/adapter/request/ElephentIncomeAuthRequestAdapterImpl.java similarity index 96% rename from jianshui-income/src/main/java/com/jianshui/income/service/impl/adapter/request/ElephentIncomeRequestAdapterImpl.java rename to jianshui-income/src/main/java/com/jianshui/income/service/impl/adapter/request/ElephentIncomeAuthRequestAdapterImpl.java index fd52dcf..746db60 100644 --- a/jianshui-income/src/main/java/com/jianshui/income/service/impl/adapter/request/ElephentIncomeRequestAdapterImpl.java +++ b/jianshui-income/src/main/java/com/jianshui/income/service/impl/adapter/request/ElephentIncomeAuthRequestAdapterImpl.java @@ -25,8 +25,8 @@ import java.util.Set; * @Date 2022-03-25 10:03 **/ @Slf4j -@Component("auth_income_request_adapter") -public class ElephentIncomeRequestAdapterImpl implements IIncomeRequestService { +@Component("jn_aisino_auth_request_adapter") +public class ElephentIncomeAuthRequestAdapterImpl implements IIncomeRequestService { @Autowired private ICompanyserviceService companyserviceService; diff --git a/jianshui-income/src/main/java/com/jianshui/income/service/impl/adapter/response/ElephentIncomeAuthResponseAdapterImpl.java b/jianshui-income/src/main/java/com/jianshui/income/service/impl/adapter/response/ElephentIncomeAuthResponseAdapterImpl.java new file mode 100644 index 0000000..93ee51a --- /dev/null +++ b/jianshui-income/src/main/java/com/jianshui/income/service/impl/adapter/response/ElephentIncomeAuthResponseAdapterImpl.java @@ -0,0 +1,70 @@ +package com.jianshui.income.service.impl.adapter.response; + +import com.alibaba.fastjson.JSONObject; +import com.jianshui.common.core.domain.AjaxResult; +import com.jianshui.common.core.domain.entity.Companyservice; +import com.jianshui.common.exception.jianshui.JianshuiParamErrorException; +import com.jianshui.common.utils.StringUtils; +import com.jianshui.income.service.IIncomeResponseService; +import com.jianshui.system.service.ICompanyserviceService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 进项-认证 + * @Description + * @Author 巩权林 + * @Date 2022-03-25 10:03 + **/ +@Slf4j +@Component("jn_aisino_auth_response_adapter") +public class ElephentIncomeAuthResponseAdapterImpl implements IIncomeResponseService { + + @Autowired + private ICompanyserviceService companyserviceService; + + @Override + public Object response(AjaxResult result, Companyservice companyservice, String src) { + // TODO 这里要利用反射拆分成函数,而不是再用equals + + AjaxResult resp = result; + + if (StringUtils.equals(src, "check_single")) { + if (result.isSuccess()) { + JSONObject content = (JSONObject) result.get("data"); + if (content != null) { + resp = AjaxResult.success(content.getJSONObject("resultContent")); + } + } + } + if (StringUtils.equals(src, "check_multil")) { + + } + + if (StringUtils.equals(src, "check_multilreqult")) { + if (result.isSuccess()) { + JSONObject data = (JSONObject) result.get("data"); + resp = AjaxResult.success(data.getJSONObject("data")); + } + } + + // 全票面采集 + if (StringUtils.equals(src, "get_invoice")) { + + } + + + return resp; + } + + @Override + public Object response(JianshuiParamErrorException result, Companyservice companyservice) { + JSONObject myResult = new JSONObject(); + myResult.put("status", result.getErrorCode()); + myResult.put("message", result.getMsg()); + return myResult; + } + + +}