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

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