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 结果
*/
public int deleteDockingPlatformConfigByIds(Integer[] ids);
/**
* 通过operatorId查询配置信息
* @param operatorId
* @return
*/
DockingPlatformConfig getInfoByOperatorId(String operatorId);
}

View File

@@ -58,4 +58,11 @@ public interface IDockingPlatformConfigService
* @return 结果
*/
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;
import java.util.List;
import com.jsowell.common.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -10,87 +11,91 @@ import com.jsowell.pile.service.IDockingPlatformConfigService;
/**
* 对接平台配置信息Service业务层处理
*
*
* @author jsowell
* @date 2023-05-27
*/
@Service
public class DockingPlatformConfigServiceImpl implements IDockingPlatformConfigService
{
public class DockingPlatformConfigServiceImpl implements IDockingPlatformConfigService {
@Autowired
private DockingPlatformConfigMapper dockingPlatformConfigMapper;
/**
* 查询对接平台配置信息
*
*
* @param id 对接平台配置信息主键
* @return 对接平台配置信息
*/
@Override
public DockingPlatformConfig selectDockingPlatformConfigById(Integer id)
{
public DockingPlatformConfig selectDockingPlatformConfigById(Integer id) {
return dockingPlatformConfigMapper.selectDockingPlatformConfigById(id);
}
/**
* 查询对接平台配置信息列表
*
*
* @param dockingPlatformConfig 对接平台配置信息
* @return 对接平台配置信息
*/
@Override
public List<DockingPlatformConfig> selectDockingPlatformConfigList(DockingPlatformConfig dockingPlatformConfig)
{
public List<DockingPlatformConfig> selectDockingPlatformConfigList(DockingPlatformConfig dockingPlatformConfig) {
return dockingPlatformConfigMapper.selectDockingPlatformConfigList(dockingPlatformConfig);
}
/**
* 新增对接平台配置信息
*
*
* @param dockingPlatformConfig 对接平台配置信息
* @return 结果
*/
@Override
public int insertDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig)
{
public int insertDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig) {
dockingPlatformConfig.setCreateTime(DateUtils.getNowDate());
return dockingPlatformConfigMapper.insertDockingPlatformConfig(dockingPlatformConfig);
}
/**
* 修改对接平台配置信息
*
*
* @param dockingPlatformConfig 对接平台配置信息
* @return 结果
*/
@Override
public int updateDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig)
{
public int updateDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig) {
dockingPlatformConfig.setUpdateTime(DateUtils.getNowDate());
return dockingPlatformConfigMapper.updateDockingPlatformConfig(dockingPlatformConfig);
}
/**
* 批量删除对接平台配置信息
*
*
* @param ids 需要删除的对接平台配置信息主键
* @return 结果
*/
@Override
public int deleteDockingPlatformConfigByIds(Integer[] ids)
{
public int deleteDockingPlatformConfigByIds(Integer[] ids) {
return dockingPlatformConfigMapper.deleteDockingPlatformConfigByIds(ids);
}
/**
* 删除对接平台配置信息信息
*
*
* @param id 对接平台配置信息主键
* @return 结果
*/
@Override
public int deleteDockingPlatformConfigById(Integer id)
{
public int deleteDockingPlatformConfigById(Integer 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
</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">
<include refid="selectDockingPlatformConfigVo"/>
<where>
@@ -98,4 +103,10 @@
#{id}
</foreach>
</delete>
<select id="getInfoByOperatorId" resultMap="DockingPlatformConfigResult">
select <include refid="Base_Column_List"/>
from docking_platform_config
where operator_id = #{operatorId,jdbcType=VARCHAR}
</select>
</mapper>

View File

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