From bc075b3ca65b8015715d3e54733424a95178babf Mon Sep 17 00:00:00 2001 From: xingze <13153582609@163.com> Date: Mon, 18 Mar 2024 10:04:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E4=B8=BB=E6=8E=88=E6=9D=83=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E9=85=8D=E7=BD=AE=E6=8F=90=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-dev.yml | 6 +++++- .../src/main/resources/application-prod.yml | 6 +++++- .../jianshui/common/config/JianshuiConfig.java | 11 +++++++++++ .../com/jianshui/common/constant/Constants.java | 3 ++- .../service/impl/AutonomousSqServiceImpl.java | 16 ++++++++++------ 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/jianshui-admin/src/main/resources/application-dev.yml b/jianshui-admin/src/main/resources/application-dev.yml index c1108e3..2e437a6 100644 --- a/jianshui-admin/src/main/resources/application-dev.yml +++ b/jianshui-admin/src/main/resources/application-dev.yml @@ -108,4 +108,8 @@ invoice: file: save: # 文件上传方式 0:数据库 1:oss 2:本地 - type: 1 \ No newline at end of file + type: 1 +# 自主授权相关配置 +autonomous: + authorization: + callbackUrl: http://dev.goldentaxcloud.com:8081 \ No newline at end of file diff --git a/jianshui-admin/src/main/resources/application-prod.yml b/jianshui-admin/src/main/resources/application-prod.yml index b793c5b..5f3181b 100644 --- a/jianshui-admin/src/main/resources/application-prod.yml +++ b/jianshui-admin/src/main/resources/application-prod.yml @@ -97,4 +97,8 @@ invoice: file: save: # 文件上传方式 0:数据库 1:oss 2:本地 - type: 1 \ No newline at end of file + type: 1 +# 自主授权相关配置 +autonomous: + authorization: + callbackUrl: http://www.goldentaxcloud.com:8080 \ No newline at end of file diff --git a/jianshui-common/src/main/java/com/jianshui/common/config/JianshuiConfig.java b/jianshui-common/src/main/java/com/jianshui/common/config/JianshuiConfig.java index 3b43b59..6fbef43 100644 --- a/jianshui-common/src/main/java/com/jianshui/common/config/JianshuiConfig.java +++ b/jianshui-common/src/main/java/com/jianshui/common/config/JianshuiConfig.java @@ -1,5 +1,6 @@ package com.jianshui.common.config; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @@ -33,6 +34,16 @@ public class JianshuiConfig /** 验证码类型 */ private static String captchaType; + /** 自主授权回调地址 */ + @Value("${autonomous.authorization.callbackUrl:}") + private String callbackUrl; + + /** 自主授权回调地址 */ + public String configCallbackUrl() + { + return callbackUrl + "/api/invoice_all/v1/autonomousAuthorization"; + } + public String getName() { return name; diff --git a/jianshui-common/src/main/java/com/jianshui/common/constant/Constants.java b/jianshui-common/src/main/java/com/jianshui/common/constant/Constants.java index 16111d4..ee9046a 100644 --- a/jianshui-common/src/main/java/com/jianshui/common/constant/Constants.java +++ b/jianshui-common/src/main/java/com/jianshui/common/constant/Constants.java @@ -189,7 +189,8 @@ public class Constants { public static final String INVOICE_FILE_SAVE_TYPE = "invoice.file.save.type"; public static final String ESCAPE = "/"; - + public static final String QD_LOGIN = "http://zzsq.jcsk100.com/login/getLogin2"; + public static final String SUBMIT_SMS = "http://zzsq.jcsk100.com/login/submitSms"; } \ No newline at end of file diff --git a/jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/impl/AutonomousSqServiceImpl.java b/jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/impl/AutonomousSqServiceImpl.java index f30eb15..6df5be9 100644 --- a/jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/impl/AutonomousSqServiceImpl.java +++ b/jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/impl/AutonomousSqServiceImpl.java @@ -4,6 +4,8 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.jianshui.common.config.JianshuiConfig; +import com.jianshui.common.constant.Constants; import com.jianshui.common.core.domain.AjaxResult; import com.jianshui.common.core.domain.entity.Companyservice; import com.jianshui.common.enums.ErrorCode; @@ -44,6 +46,8 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { private InvoiceAllLoginResultMapper invoiceAllLoginResultMapper; @Autowired private CompanyserviceMapper companyserviceMapper; + @Autowired + private JianshuiConfig jianshuiConfig; /** * 功能描述: 自主授权回调接口 @@ -219,10 +223,10 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { try { // 回调地址 inoviceAllQdLoginDTO.setLoginType("1"); - inoviceAllQdLoginDTO.setCallback("http://www.goldentaxcloud.com:8081/api/invoice_all/v1/autonomousAuthorization"); - log.info("全电登录接口,请求上游,地址:{},参数:{}", "http://zzsq.jcsk100.com/login/getLogin2", JSONUtil.toJsonStr(inoviceAllQdLoginDTO)); + inoviceAllQdLoginDTO.setCallback(jianshuiConfig.configCallbackUrl()); + log.info("全电登录接口,请求上游,地址:{},参数:{}", Constants.QD_LOGIN, JSONUtil.toJsonStr(inoviceAllQdLoginDTO)); Thread requestThread = new Thread(() -> { - HttpUtils.sendJsonPost("http://zzsq.jcsk100.com/login/getLogin2", inoviceAllQdLoginDTO); + HttpUtils.sendJsonPost(Constants.QD_LOGIN, inoviceAllQdLoginDTO); }); requestThread.start(); // 用户信息封装 @@ -240,7 +244,7 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { invoiceAllApiLog.setCreateTime(new Date()); invoiceAllApiLog.setCompany(companyservice.getSellertax()); invoiceAllApiLog.setIdentityId(companyservice.getIdentity()); - invoiceAllApiLog.setUrl("http://zzsq.jcsk100.com/login/getLogin2"); + invoiceAllApiLog.setUrl(Constants.QD_LOGIN); invoiceAllApiLog.setSendMsg(JSONUtil.toJsonStr(inoviceAllQdLoginDTO)); invoiceAllApiLog.setRequestId(qqlsh); allApiLogMapper.insert(invoiceAllApiLog); @@ -282,9 +286,9 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { if ("SMS".equals(invoiceAllLoginResult.getCode()) || "F000".equals(invoiceAllLoginResult.getCode())) { try { // 请求封装 - log.info("自主授权短信提交接口,请求上游地址:{},入参:{}", "http://zzsq.jcsk100.com/login/submitSms", JSONUtil.toJsonStr(invoiceAllSubmitNoteDTO)); + log.info("自主授权短信提交接口,请求上游地址:{},入参:{}", Constants.SUBMIT_SMS, JSONUtil.toJsonStr(invoiceAllSubmitNoteDTO)); Thread requestThread = new Thread(() -> { - HttpUtils.sendJsonPost("http://zzsq.jcsk100.com/login/submitSms", invoiceAllSubmitNoteDTO); + HttpUtils.sendJsonPost(Constants.SUBMIT_SMS,invoiceAllSubmitNoteDTO); }); requestThread.start(); } catch (Exception e) {