udpate 联联获取令牌接口

This commit is contained in:
Lemon
2023-05-27 09:18:54 +08:00
parent 94d706f49e
commit 53b5432f9f
5 changed files with 63 additions and 26 deletions

View File

@@ -58,4 +58,11 @@ public interface DockingPlatformConfigMapper
* @return 结果 * @return 结果
*/ */
public int deleteDockingPlatformConfigByIds(Integer[] ids); public int deleteDockingPlatformConfigByIds(Integer[] ids);
/**
* 通过operatorId查询配置信息
* @param operatorId
* @return
*/
DockingPlatformConfig getInfoByOperatorId(String operatorId);
} }

View File

@@ -58,4 +58,11 @@ public interface IDockingPlatformConfigService
* @return 结果 * @return 结果
*/ */
public int deleteDockingPlatformConfigById(Integer id); public int deleteDockingPlatformConfigById(Integer id);
/**
* 通过operatorId查询配置信息
* @param operatorId
* @return
*/
DockingPlatformConfig getInfoByOperatorId(String operatorId);
} }

View File

@@ -1,6 +1,7 @@
package com.jsowell.pile.service.impl; package com.jsowell.pile.service.impl;
import java.util.List; import java.util.List;
import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -15,8 +16,7 @@ import com.jsowell.pile.service.IDockingPlatformConfigService;
* @date 2023-05-27 * @date 2023-05-27
*/ */
@Service @Service
public class DockingPlatformConfigServiceImpl implements IDockingPlatformConfigService public class DockingPlatformConfigServiceImpl implements IDockingPlatformConfigService {
{
@Autowired @Autowired
private DockingPlatformConfigMapper dockingPlatformConfigMapper; private DockingPlatformConfigMapper dockingPlatformConfigMapper;
@@ -27,8 +27,7 @@ public class DockingPlatformConfigServiceImpl implements IDockingPlatformConfigS
* @return 对接平台配置信息 * @return 对接平台配置信息
*/ */
@Override @Override
public DockingPlatformConfig selectDockingPlatformConfigById(Integer id) public DockingPlatformConfig selectDockingPlatformConfigById(Integer id) {
{
return dockingPlatformConfigMapper.selectDockingPlatformConfigById(id); return dockingPlatformConfigMapper.selectDockingPlatformConfigById(id);
} }
@@ -39,8 +38,7 @@ public class DockingPlatformConfigServiceImpl implements IDockingPlatformConfigS
* @return 对接平台配置信息 * @return 对接平台配置信息
*/ */
@Override @Override
public List<DockingPlatformConfig> selectDockingPlatformConfigList(DockingPlatformConfig dockingPlatformConfig) public List<DockingPlatformConfig> selectDockingPlatformConfigList(DockingPlatformConfig dockingPlatformConfig) {
{
return dockingPlatformConfigMapper.selectDockingPlatformConfigList(dockingPlatformConfig); return dockingPlatformConfigMapper.selectDockingPlatformConfigList(dockingPlatformConfig);
} }
@@ -51,8 +49,7 @@ public class DockingPlatformConfigServiceImpl implements IDockingPlatformConfigS
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig) public int insertDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig) {
{
dockingPlatformConfig.setCreateTime(DateUtils.getNowDate()); dockingPlatformConfig.setCreateTime(DateUtils.getNowDate());
return dockingPlatformConfigMapper.insertDockingPlatformConfig(dockingPlatformConfig); return dockingPlatformConfigMapper.insertDockingPlatformConfig(dockingPlatformConfig);
} }
@@ -64,8 +61,7 @@ public class DockingPlatformConfigServiceImpl implements IDockingPlatformConfigS
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig) public int updateDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig) {
{
dockingPlatformConfig.setUpdateTime(DateUtils.getNowDate()); dockingPlatformConfig.setUpdateTime(DateUtils.getNowDate());
return dockingPlatformConfigMapper.updateDockingPlatformConfig(dockingPlatformConfig); return dockingPlatformConfigMapper.updateDockingPlatformConfig(dockingPlatformConfig);
} }
@@ -77,8 +73,7 @@ public class DockingPlatformConfigServiceImpl implements IDockingPlatformConfigS
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteDockingPlatformConfigByIds(Integer[] ids) public int deleteDockingPlatformConfigByIds(Integer[] ids) {
{
return dockingPlatformConfigMapper.deleteDockingPlatformConfigByIds(ids); return dockingPlatformConfigMapper.deleteDockingPlatformConfigByIds(ids);
} }
@@ -89,8 +84,18 @@ public class DockingPlatformConfigServiceImpl implements IDockingPlatformConfigS
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteDockingPlatformConfigById(Integer id) public int deleteDockingPlatformConfigById(Integer id) {
{
return dockingPlatformConfigMapper.deleteDockingPlatformConfigById(id); return dockingPlatformConfigMapper.deleteDockingPlatformConfigById(id);
} }
/**
* 通过operatorId查询配置信息
*
* @param operatorId
* @return
*/
@Override
public DockingPlatformConfig getInfoByOperatorId(String operatorId) {
return dockingPlatformConfigMapper.getInfoByOperatorId(operatorId);
}
} }

View File

@@ -23,6 +23,11 @@
select id, name, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag from docking_platform_config select id, name, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag from docking_platform_config
</sql> </sql>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, name, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag
</sql>
<select id="selectDockingPlatformConfigList" parameterType="com.jsowell.pile.domain.DockingPlatformConfig" resultMap="DockingPlatformConfigResult"> <select id="selectDockingPlatformConfigList" parameterType="com.jsowell.pile.domain.DockingPlatformConfig" resultMap="DockingPlatformConfigResult">
<include refid="selectDockingPlatformConfigVo"/> <include refid="selectDockingPlatformConfigVo"/>
<where> <where>
@@ -98,4 +103,10 @@
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="getInfoByOperatorId" resultMap="DockingPlatformConfigResult">
select <include refid="Base_Column_List"/>
from docking_platform_config
where operator_id = #{operatorId,jdbcType=VARCHAR}
</select>
</mapper> </mapper>

View File

@@ -88,6 +88,9 @@ public class LianLianServiceImpl implements LianLianService {
@Autowired @Autowired
private IThirdPartySettingInfoService thirdPartySettingInfoService; private IThirdPartySettingInfoService thirdPartySettingInfoService;
@Autowired
private IDockingPlatformConfigService dockingPlatformConfigService;
@Override @Override
public void pushMerchantInfo(Long merchantId) { public void pushMerchantInfo(Long merchantId) {
// 通过id查询运营商信息 // 通过id查询运营商信息
@@ -1231,7 +1234,11 @@ public class LianLianServiceImpl implements LianLianService {
public Map<String, String> generateToken(QueryTokenDTO dto) throws UnsupportedEncodingException { public Map<String, String> generateToken(QueryTokenDTO dto) throws UnsupportedEncodingException {
String operatorID = dto.getOperatorID(); String operatorID = dto.getOperatorID();
// 通过operatorID 查出 operatorSecret TODO 建表 设置密钥 // 通过operatorID 查出 operatorSecret TODO 建表 设置密钥
String operatorSecret = "123123123123aaaa"; DockingPlatformConfig platformConfig = dockingPlatformConfigService.getInfoByOperatorId(operatorID);
if (platformConfig == null) {
return null;
}
String operatorSecret = platformConfig.getOperatorSecret();
Map<String, String> map = Maps.newLinkedHashMap(); Map<String, String> map = Maps.newLinkedHashMap();
map.put("OperatorID", dto.getOperatorID()); map.put("OperatorID", dto.getOperatorID());
@@ -1270,11 +1277,11 @@ public class LianLianServiceImpl implements LianLianService {
Map<String, String> resultMap = Maps.newLinkedHashMap(); Map<String, String> resultMap = Maps.newLinkedHashMap();
// 加密数据 TODO vo对象加密 // 加密数据 TODO vo对象加密
// byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(vo).getBytes(), byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(vo).getBytes(),
// dataSecret.getBytes(), dataSecretIV.getBytes()); platformConfig.getDataSecret().getBytes(), platformConfig.getDataSecretIv().getBytes());
// String encryptData = Encodes.encodeBase64(encryptText); String encryptData = Encodes.encodeBase64(encryptText);
// resultMap.put("Data", encryptData); resultMap.put("Data", encryptData);
// 生成sig TODO 生成sig // 生成sig TODO 生成sig
String resultSign = GBSignUtils.sign(resultMap, operatorSecret); String resultSign = GBSignUtils.sign(resultMap, operatorSecret);
resultMap.put("Sig", resultSign); resultMap.put("Sig", resultSign);