update query_token

This commit is contained in:
2024-05-08 10:35:13 +08:00
parent 7987fef68d
commit dd9badce30

View File

@@ -1,6 +1,7 @@
package com.jsowell.thirdparty.platform.zhongdianlian.service;
import com.alibaba.fastjson2.JSON;
import com.google.common.collect.Lists;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.util.JWTUtils;
import com.jsowell.common.util.StringUtils;
@@ -16,6 +17,7 @@ import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
@@ -55,7 +57,6 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi
String operatorId = StringUtils.isNotBlank(dto.getOperatorID()) ? dto.getOperatorID() : dto.getPlatformID();
// 通过operatorId 查出 operatorSecret
// ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId);
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByOperatorId(operatorId);
if (thirdPartySecretInfoVO == null) {
failReason = 1;
@@ -68,10 +69,14 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi
String decrypt = Cryptos.decrypt(dto.getData(), dataSecret, dataSecretIv);
String inputOperatorSecret = null;
if (StringUtils.isNotBlank(decrypt)) {
inputOperatorSecret = JSON.parseObject(decrypt).getString("PlatformSecret");
inputOperatorSecret = JSON.parseObject(decrypt).getString("OperatorSecret");
if (StringUtils.isBlank(inputOperatorSecret)) {
inputOperatorSecret = JSON.parseObject(decrypt).getString("PlatformSecret");
}
}
// 对比密钥
if (!StringUtils.equals(theirOperatorSecret, inputOperatorSecret)) {
List<String> operatorSecretList = Lists.newArrayList(theirOperatorSecret, thirdPartySecretInfoVO.getOurOperatorSecret());
if (!operatorSecretList.contains(inputOperatorSecret)) {
failReason = 1;
succStat = 1;
} else {