1.增加第三方系统授权码,更新和查询接口同步回显和更新本系统授权码和秘钥字段

第三方系统表增加字段sql

ALTER TABLE `basic_third_sys`
ADD COLUMN `apikey` varchar(255) NULL COMMENT '第三方系统接口授权码' AFTER `thirdName`,
ADD COLUMN `secretkey` varchar(255) NULL COMMENT '第三方系统接口秘钥' AFTER `apikey`;
master
MrZhai 3 years ago
parent e79295e8ec
commit b2d6be59f7

@ -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-nCoVIgM/IgG抗体检测试剂盒胶体金法\",\"brandName\":\"新型冠状病毒2019-nCoVIgM/IgG抗体检测试剂盒胶体金法\",\"model\":\"50人份/盒\",\"spec\":\"50人份/盒\",\"prodMaterial\":\"玻璃瓶\",\"priceUnitText\":\"盒\",\"negotiatedPrice\":\"46\",\"regNum\":\"国械注准20203400239\",\"regName\":\"新型冠状病毒2019-nCoVIgM/IgG抗体检测试剂盒胶体金法\",\"regValidTo\":\"1615478400000\",\"manufactureId\":\"23290\",\"distributorId\":\"8893\",\"proxyId\":\"\",\"addReason\":\"\",\"remarkHosp\":\"\"}]" + "&secretKey=" + headRequest.getSecretKey() + "&time=" + headRequest.getTime()
+ "&userName=" + headRequest.getUserName();
// String sign = Md5Utils.stringToMD5(url);

@ -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);
}

@ -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;
}

@ -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<BasicThirdSysEntity> 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;
}

@ -38,4 +38,17 @@
from auth_license
where customerId = #{customerId}
</delete>
<select id="selectLicenseByName" resultType="com.glxp.sale.admin.entity.auth.AuthLicense">
select apikey, secretkey from auth_license where name = #{name}
</select>
<update id="updateLicenseByName">
update auth_license
<set>
<if test="apikey != null">apikey=#{apikey},</if>
<if test="secretkey != null">secretkey=#{secretkey},</if>
</set>
where name = #{name}
</update>
</mapper>

@ -2,19 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.sale.admin.dao.basic.BasicThirdSysDao">
<insert id="insert" parameterType="com.glxp.sale.admin.entity.basic.BasicThirdSysEntity">
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})
</insert>
<update id="updateBasicThiSys" parameterType="com.glxp.sale.admin.entity.basic.BasicThirdSysEntity">
@ -27,6 +25,8 @@
<if test="thridUrl != null">thridUrl=#{thridUrl},</if>
<if test="enabled != null">enabled=#{enabled},</if>
<if test="mainSys != null">mainSys=#{mainSys},</if>
<if test="apikey != null">apikey=#{apikey},</if>
<if test="secretkey != null">secretkey=#{secretkey}</if>
</trim>
WHERE id=#{id}
</update>

Loading…
Cancel
Save