From b2d6be59f76e9bda75a0e780b1a7bee3898f3c2b Mon Sep 17 00:00:00 2001 From: MrZhai Date: Thu, 24 Mar 2022 11:08:28 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=8E=88=E6=9D=83=E7=A0=81=EF=BC=8C=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=92=8C=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=9B=9E=E6=98=BE=E5=92=8C=E6=9B=B4=E6=96=B0=E6=9C=AC?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=8E=88=E6=9D=83=E7=A0=81=E5=92=8C=E7=A7=98?= =?UTF-8?q?=E9=92=A5=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 第三方系统表增加字段sql ALTER TABLE `basic_third_sys` ADD COLUMN `apikey` varchar(255) NULL COMMENT '第三方系统接口授权码' AFTER `thirdName`, ADD COLUMN `secretkey` varchar(255) NULL COMMENT '第三方系统接口秘钥' AFTER `apikey`; --- .../admin/controller/test/TestController.java | 17 ++-------- .../sale/admin/dao/auth/AuthLicenseDao.java | 19 +++++++++-- .../entity/basic/BasicThirdSysEntity.java | 14 ++++++++ .../basic/impl/BasicThirdSysServiceImpl.java | 33 ++++++++++++++++--- .../mybatis/mapper/auth/AuthLicenseDao.xml | 13 ++++++++ .../mybatis/mapper/basic/BasicThirdSysDao.xml | 24 +++++++------- 6 files changed, 86 insertions(+), 34 deletions(-) diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/test/TestController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/test/TestController.java index 23eb893..3adc40b 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/test/TestController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/test/TestController.java @@ -1,29 +1,16 @@ package com.glxp.sale.admin.controller.test; import com.alibaba.fastjson.JSON; -import com.github.pagehelper.PageInfo; -import com.glxp.sale.admin.entity.param.SystemPDFModuleEntity; -import com.glxp.sale.admin.entity.param.SystemPDFTemplateEntity; -import com.glxp.sale.admin.req.param.SystemPDFModuleRequest; -import com.glxp.sale.admin.res.PageSimpleResponse; -import com.glxp.sale.admin.res.param.SystemPDFModuleResponse; import com.glxp.sale.admin.util.Md5Utils; -import com.glxp.sale.common.enums.ResultEnum; import com.glxp.sale.common.res.BaseResponse; import com.glxp.sale.common.util.ResultVOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.BeanUtils; -import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import javax.validation.Valid; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.List; -import java.util.stream.Collectors; @RestController public class TestController { @@ -65,9 +52,9 @@ public class TestController { // String url = "appId=" + headRequest.getAppId() + "&secretKey=" + headRequest.getSecretKey() + "&time=" + headRequest.getTime() // + "&userName=" + headRequest.getUserName(); - String body = "&body=" + "{\"hisOrderId\":\"11111\",\"remark\":\"医院采购计划备注\",\"shippingAddress\":\"南诏镇澹园街江厝寨前路65号\",\"shippingLinkMan\":\"叶\",\"shippingLinkTel\":\"17705920868\",\"shippingInvoice\":\"诏安县医院\",\"planTime\":\"\",\"items\":[{\"hisOrderDetailId\":\"5839116516\",\"hospHisCode\":\"3558308\",\"planBuyNum\":\"2\",\"purchaseRemark\":\"自定义订单备注信息\",\"productSpecId\":\"5071763\",\"spec\":\"镍铬合金铸造冠\",\"model\":\"镍铬合金铸造冠\"}]}"; +// String body = "&body=" + "{\"page\":0,\"pageSize\":5}"; - String url = "appId=" + headRequest.getAppId() + body + "&secretKey=" + headRequest.getSecretKey() + "&time=" + headRequest.getTime() + String url = "appId=" + headRequest.getAppId() + "&body=[{\"hospHisCode\":\"6666666\",\"projectGoodsCode\":\"HXQX0000LU2B\",\"productName\":\"新型冠状病毒(2019-nCoV)IgM/IgG抗体检测试剂盒(胶体金法)\",\"brandName\":\"新型冠状病毒(2019-nCoV)IgM/IgG抗体检测试剂盒(胶体金法)\",\"model\":\"50人份/盒\",\"spec\":\"50人份/盒\",\"prodMaterial\":\"玻璃瓶\",\"priceUnitText\":\"盒\",\"negotiatedPrice\":\"46\",\"regNum\":\"国械注准20203400239\",\"regName\":\"新型冠状病毒(2019-nCoV)IgM/IgG抗体检测试剂盒(胶体金法)\",\"regValidTo\":\"1615478400000\",\"manufactureId\":\"23290\",\"distributorId\":\"8893\",\"proxyId\":\"\",\"addReason\":\"\",\"remarkHosp\":\"\"}]" + "&secretKey=" + headRequest.getSecretKey() + "&time=" + headRequest.getTime() + "&userName=" + headRequest.getUserName(); // String sign = Md5Utils.stringToMD5(url); diff --git a/api-admin/src/main/java/com/glxp/sale/admin/dao/auth/AuthLicenseDao.java b/api-admin/src/main/java/com/glxp/sale/admin/dao/auth/AuthLicenseDao.java index 9be81b3..45e1a52 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/dao/auth/AuthLicenseDao.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/dao/auth/AuthLicenseDao.java @@ -4,8 +4,6 @@ import com.glxp.sale.admin.entity.auth.AuthLicense; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import java.util.List; - @Mapper public interface AuthLicenseDao { @@ -18,4 +16,21 @@ public interface AuthLicenseDao { int remove(String appid); int romveByCustomerId(String customerId); + + /** + * 根据名称查询授权码和秘钥 + * + * @param name + * @return + */ + AuthLicense selectLicenseByName(@Param("name") String name); + + /** + * 根据名称修改系统的授权码和秘钥 + * + * @param licenseApikey + * @param secretkey + * @param name + */ + void updateLicenseByName(@Param("apikey") String licenseApikey, @Param("secretkey") String secretkey, @Param("name") String name); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/basic/BasicThirdSysEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/basic/BasicThirdSysEntity.java index 7ab282b..3212fed 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/entity/basic/BasicThirdSysEntity.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/basic/BasicThirdSysEntity.java @@ -12,4 +12,18 @@ public class BasicThirdSysEntity { private String guideUrl; private String thridUrl; private Boolean mainSys; + + //第三方系统授权码 + private String apikey; + + //第三方系统接口秘钥 + private String secretkey; + + //业务字段 + + //本系统授权码 + private String licenseApikey; + + //本系统秘钥 + private String licenseSecretkey; } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/basic/impl/BasicThirdSysServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/basic/impl/BasicThirdSysServiceImpl.java index a950efb..67ad5d7 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/basic/impl/BasicThirdSysServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/basic/impl/BasicThirdSysServiceImpl.java @@ -1,31 +1,46 @@ package com.glxp.sale.admin.service.basic.impl; +import cn.hutool.core.util.StrUtil; import com.github.pagehelper.PageHelper; +import com.glxp.sale.admin.dao.auth.AuthLicenseDao; import com.glxp.sale.admin.dao.basic.BasicThirdSysDao; +import com.glxp.sale.admin.entity.auth.AuthLicense; import com.glxp.sale.admin.entity.basic.BasicThirdSysEntity; -import com.glxp.sale.admin.entity.param.SystemParamConfigEntity; import com.glxp.sale.admin.req.basic.FilterBasicThirdSysRequest; import com.glxp.sale.admin.service.basic.BasicThirdSysService; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Collections; import java.util.List; +@Slf4j @Service public class BasicThirdSysServiceImpl implements BasicThirdSysService { + @Resource + BasicThirdSysDao basicThirdSysDao; + @Resource + private AuthLicenseDao authLicenseDao; + @Override public boolean insert(BasicThirdSysEntity basicThirdSysEntity) { return basicThirdSysDao.insert(basicThirdSysEntity); } - @Resource - BasicThirdSysDao basicThirdSysDao; - @Override public boolean updateBasicThiSys(BasicThirdSysEntity basicThirdSysEntity) { - return basicThirdSysDao.updateBasicThiSys(basicThirdSysEntity); + try { + //同步更新本系统的授权码和秘钥 + if (StrUtil.isNotBlank(basicThirdSysEntity.getLicenseApikey()) || StrUtil.isNotBlank(basicThirdSysEntity.getLicenseSecretkey())) { + authLicenseDao.updateLicenseByName(basicThirdSysEntity.getLicenseApikey(), basicThirdSysEntity.getLicenseSecretkey(), "UDI自助管理平台"); + } + basicThirdSysDao.updateBasicThiSys(basicThirdSysEntity); + } catch (Exception e) { + log.error("更新第三方系统信息异常", e); + } + return true; } @Override @@ -44,6 +59,14 @@ public class BasicThirdSysServiceImpl implements BasicThirdSysService { PageHelper.offsetPage(offset, filterBasicThirdSysRequest.getLimit()); } List data = basicThirdSysDao.filterBasicThiSys(filterBasicThirdSysRequest); + //查询本系统的授权码 + AuthLicense license = authLicenseDao.selectLicenseByName("UDI自助管理平台"); + if (null != license) { + data.forEach(basicThirdSysEntity -> { + basicThirdSysEntity.setLicenseApikey(license.getApiKey()); + basicThirdSysEntity.setLicenseSecretkey(license.getSecretKey()); + }); + } return data; } diff --git a/api-admin/src/main/resources/mybatis/mapper/auth/AuthLicenseDao.xml b/api-admin/src/main/resources/mybatis/mapper/auth/AuthLicenseDao.xml index d90d932..11cabdd 100644 --- a/api-admin/src/main/resources/mybatis/mapper/auth/AuthLicenseDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/auth/AuthLicenseDao.xml @@ -38,4 +38,17 @@ from auth_license where customerId = #{customerId} + + + + + update auth_license + + apikey=#{apikey}, + secretkey=#{secretkey}, + + where name = #{name} + \ No newline at end of file diff --git a/api-admin/src/main/resources/mybatis/mapper/basic/BasicThirdSysDao.xml b/api-admin/src/main/resources/mybatis/mapper/basic/BasicThirdSysDao.xml index ed5aac7..7b2c610 100644 --- a/api-admin/src/main/resources/mybatis/mapper/basic/BasicThirdSysDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/basic/BasicThirdSysDao.xml @@ -2,19 +2,17 @@ - - insert INTO basic_third_sys(thirdId,thirdName,guideUrl,remark,thridUrl,enabled,mainSys - ) values - ( - #{thirdId}, - #{thirdName}, - #{guideUrl}, - #{remark}, - #{thridUrl}, - #{enabled}, - #{mainSys} - ) + insert INTO basic_third_sys(thirdId, thirdName, guideUrl, remark, thridUrl, enabled, mainSys, apikey, secretkey) + values (#{thirdId}, + #{thirdName}, + #{guideUrl}, + #{remark}, + #{thridUrl}, + #{enabled}, + #{mainSys}, + #{apikey}, + #{secretkey}) @@ -27,6 +25,8 @@ thridUrl=#{thridUrl}, enabled=#{enabled}, mainSys=#{mainSys}, + apikey=#{apikey}, + secretkey=#{secretkey} WHERE id=#{id}