新增 青海平台配置信息

This commit is contained in:
Lemon
2024-04-22 11:29:28 +08:00
parent 01319e7648
commit 2c8c52f95b
5 changed files with 80 additions and 10 deletions

View File

@@ -32,7 +32,7 @@ import java.util.Map;
*/
@Anonymous
@RestController
@RequestMapping("/qinghai")
@RequestMapping("/qinghai/evcs")
public class QingHaiController extends BaseController {
@Autowired
@@ -74,6 +74,7 @@ public class QingHaiController extends BaseController {
// 校验失败
return CommonResult.failed("令牌校验错误");
}
// 查询配置信息
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
String operatorSecret = platformConfig.getOperatorSecret();
@@ -81,6 +82,12 @@ public class QingHaiController extends BaseController {
String dataSecret = platformConfig.getDataSecret();
String dataSecretIV = platformConfig.getDataSecretIv();
// 校验签名
boolean verifyResult = qingHaiPlatformServiceImpl.verifySignature(dto, platformConfig.getSignSecret());
if (!verifyResult) {
// 验签失败
return CommonResult.failed("签名错误");
}
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8);
@@ -116,6 +123,12 @@ public class QingHaiController extends BaseController {
String dataSecret = platformConfig.getDataSecret();
String dataSecretIV = platformConfig.getDataSecretIv();
// 校验签名
boolean verifyResult = qingHaiPlatformServiceImpl.verifySignature(dto, platformConfig.getSignSecret());
if (!verifyResult) {
// 验签失败
return CommonResult.failed("签名错误");
}
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8);