liwenxuan 7 days ago
parent
commit
2ebd40bf18
  1. 4
      data-query/data-query-service/src/main/resources/bootstrap.yml
  2. 1
      dlp/base-info/src/main/java/com/lnsoft/sdhxgk/base/info/controller/FileController.java
  3. 1
      dlp/device_life/src/main/resources/mapper/DlpAlarmKpisMapper.xml
  4. 44
      dlp/device_life/src/main/resources/mapper/DlpAlarmRecordsDao.xml
  5. 6
      dlp/point-inspect/pom.xml
  6. 167
      dlp/point-inspect/src/main/java/com/lnsoft/sdhxgk/point/inspect/utils/GoApiClient.java
  7. 4
      dlp/point-inspect/src/main/java/com/lnsoft/sdhxgk/point/inspect/utils/HttpClientUtil.java
  8. 49
      dlp/point-inspect/src/main/java/com/lnsoft/sdhxgk/point/inspect/utils/RandomStringUtil.java
  9. 216
      dlp/point-inspect/src/main/java/com/lnsoft/sdhxgk/point/inspect/utils/SM4Utils.java
  10. 31
      dlp/point-inspect/src/main/java/com/lnsoft/sdhxgk/point/inspect/utils/TeamRemoteCallConfig.java
  11. 6
      job/job-alarm/src/main/java/com/lnsoft/sdhxgk/job/alarm/JobAlarmApplication.java

4
data-query/data-query-service/src/main/resources/bootstrap.yml

@ -19,11 +19,14 @@ spring:
discovery:
# 服务注册地址(开发环境)
contextPath: /nacos
#server-addr: ${NACOS_DISCOVERY_SERVER_ADDR:22.40.215.240:9999}
server-addr: ${NACOS_DISCOVERY_SERVER_ADDR:172.20.2.57:8848}
#namespace: c9d0eb40-a675-4b35-b1a4-03dbf9f5a32b
namespace: dlp
config:
# 配置中心地址(开发环境)
contextPath: /nacos
#server-addr: ${NACOS_DISCOVERY_SERVER_ADDR:22.40.215.240:9999}
server-addr: ${NACOS_DISCOVERY_SERVER_ADDR:172.20.2.57:8848}
# 配置文件格式
file-extension: yml
@ -31,6 +34,7 @@ spring:
shared-dataids: application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
# namespace: c9d0eb40-a675-4b35-b1a4-03dbf9f5a32b
username: nacos
#password: Soft@5569
password: nacos
mybatis-plus:

1
dlp/base-info/src/main/java/com/lnsoft/sdhxgk/base/info/controller/FileController.java

@ -61,6 +61,7 @@ public class FileController extends BaseController {
@GetMapping(value = "/fileVersionList")
public AjaxResult fileVersionList(@RequestParam("file")String file) {
// return AjaxResult.error("系统已过期!");
return AjaxResult.success(this.fileService.fileVersionList(file));
}

1
dlp/device_life/src/main/resources/mapper/DlpAlarmKpisMapper.xml

@ -35,6 +35,7 @@
<if test="beginStartTime !=null and endStartTime !=null">AND a.start_time BETWEEN beginStartTime AND endStartTime </if>
</where>
GROUP BY a.kpi_code, a.kpi_name, a.warn_type,b.id,a.alarm_level
ORDER BY MAX(a.start_time) DESC
</select>
<select id="queryInfo" resultType="com.lnsoft.sdhxgk.asset.device.life.domain.DlpAlarmKpis">
SELECT

44
dlp/device_life/src/main/resources/mapper/DlpAlarmRecordsDao.xml

@ -447,6 +447,7 @@
FROM
dlp_alarm_records
<where>
TIMESTAMPDIFF(MINUTE, start_time, COALESCE(end_time, NOW())) > 5
<if test="id != null and id != ''">
and id = #{id}
</if>
@ -570,6 +571,7 @@
SELECT workshop_name as name,COUNT(workshop_name) AS value FROM
dlp_alarm_records
<where>
workshop_name is not null and workshop_name != ''
<if test="workshopCode !=null and workshopCode !=''">AND workshop_code=#{workshopCode}</if>
<if test="endStartTime!=null and beginStartTime!=null">AND start_time BETWEEN #{beginStartTime} AND
#{endStartTime}
@ -577,15 +579,43 @@
</where>
GROUP BY workshop_name
</select>
<!-- <select id="getWarnDeviceType" resultType="com.lnsoft.sdhxgk.asset.device.life.dto.WarningCountType">-->
<!-- SELECT B.device_type,COUNT(B.device_type)AS NUMS ,A.issue_leve_name FROM dlp_alarm_records AS A INNER JOIN bus_device_copy AS B-->
<!-- <where>-->
<!-- A.device_code=B.id-->
<!-- <if test="endStartTime!=null and beginStartTime!=null">AND A.start_time BETWEEN #{beginStartTime} AND-->
<!-- #{endStartTime}-->
<!-- </if>-->
<!-- </where>-->
<!-- GROUP BY B.device_type,A.issue_leve_name-->
<!-- </select>-->
<select id="getWarnDeviceType" resultType="com.lnsoft.sdhxgk.asset.device.life.dto.WarningCountType">
SELECT B.device_type,COUNT(B.device_type)AS NUMS ,A.issue_leve_name FROM dlp_alarm_records AS A INNER JOIN bus_device_copy AS B
SELECT
B.device_type,
COUNT(*) AS NUMS,
CASE
WHEN A.issue_leve_name IN ('低','一般报警','普通报警') OR A.issue_leve_name IS NULL THEN '普通报警'
WHEN A.issue_leve_name IN ('中','重要报警') THEN '重要报警'
WHEN A.issue_leve_name IN ('高','紧急报警') THEN '紧急报警'
ELSE '普通报警'
END AS issue_leve_name
FROM dlp_alarm_records AS A
INNER JOIN bus_device_copy AS B ON A.device_code = B.id
<where>
A.device_code=B.id
<if test="endStartTime!=null and beginStartTime!=null">AND A.start_time BETWEEN #{beginStartTime} AND
#{endStartTime}
B.device_type IS NOT NULL
AND A.workshop_name is not null and A.workshop_name != ''
<if test="endStartTime!=null and beginStartTime!=null">
AND A.start_time BETWEEN #{beginStartTime} AND #{endStartTime}
</if>
</where>
GROUP BY B.device_type,A.issue_leve_name
GROUP BY
B.device_type,
CASE
WHEN A.issue_leve_name IN ('低','一般报警','普通报警') OR A.issue_leve_name IS NULL THEN '普通报警'
WHEN A.issue_leve_name IN ('中','重要报警') THEN '重要报警'
WHEN A.issue_leve_name IN ('高','紧急报警') THEN '紧急报警'
ELSE '普通报警'
END
</select>
<select id="selectInfo" resultType="com.lnsoft.sdhxgk.asset.device.life.domain.DlpAlarmRecords">
SELECT id,
@ -614,18 +644,20 @@
FROM
dlp_alarm_records
<where>
workshop_name is not null and workshop_name != ''
<if test="workshopCode!=null and workshopCode!=''">AND workshop_code=#{workshopCode} </if>
<if test="workshopName!=null and workshopName!=''">AND workshop_name=#{workshopName} </if>
<if test="sectionName!=null and sectionName!=''">AND section_name=#{sectionName} </if>
<if test="deviceName!=null and deviceName!=''">AND device_name LIKE CONCAT ('%',#{deviceName},'%') </if>
<if test="state !=null and state!=''"> AND state=#{state}</if>
</where>
ORDER BY id
ORDER BY start_time desc
</select>
<select id="getFactory" resultType="java.util.Map" parameterType="com.lnsoft.sdhxgk.asset.device.life.vo.DlpAlarmRecordsVo">
SELECT section_name as name,COUNT(workshop_name) AS value FROM
dlp_alarm_records
<where>
workshop_name is not null and workshop_name != ''
<if test="sectionName !=null and sectionName !=''">AND section_name=#{sectionName}</if>
<if test="endStartTime!=null and beginStartTime!=null">AND start_time BETWEEN #{beginStartTime} AND
#{endStartTime}

6
dlp/point-inspect/pom.xml

@ -82,6 +82,12 @@
<artifactId>okhttp</artifactId>
<version>3.14.5</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.70</version>
</dependency>
</dependencies>
<build>

167
dlp/point-inspect/src/main/java/com/lnsoft/sdhxgk/point/inspect/utils/GoApiClient.java

@ -0,0 +1,167 @@
package com.lnsoft.sdhxgk.point.inspect.utils;
//import com.alibaba.fastjson2.JSON;
//import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
@Slf4j
@Component
public class GoApiClient {
private static final int TIMEOUT = 100000;
/**
* 调用 Go 接口使用加密通信
* @param url Go接口地址
* @param param 请求参数
* @param userKey User-Key
* @param userToken User-Token
* @return 解密后的响应字符串
* @throws IOException
*/
public String callGoApi(String url, Object param, String userKey, String userToken) throws IOException {
// 1. 生成随机 Auth-key(16位)
String authKey = RandomStringUtil.generateRandomString(16);
// 2. 加密请求数据
String encryptedData;
try {
String jsonParam = JSON.toJSONString(param);
encryptedData = SM4Utils.encrypt(jsonParam, authKey);
} catch (Exception e) {
log.error("加密请求数据失败", e);
throw new IOException("加密请求数据失败: " + e.getMessage(), e);
}
// 3. 构建加密请求体
Map<String, String> encryptedBody = new HashMap<>();
encryptedBody.put("data", encryptedData); // Go后端期望data字段
String requestBody = JSON.toJSONString(encryptedBody);
// 4. 发送 HTTP 请求
CloseableHttpClient httpClient = null;
try {
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(TIMEOUT)
.setSocketTimeout(TIMEOUT)
.setConnectionRequestTimeout(TIMEOUT)
.build();
httpClient = HttpClients.custom()
.setDefaultRequestConfig(requestConfig)
.build();
HttpPost httpPost = new HttpPost(url);
// 设置请求头
// httpPost.setHeader("User-Key", userKey);
// httpPost.setHeader("User-Token", userToken);
httpPost.setHeader("Origin", "http://120.224.6.6");
httpPost.setHeader("number", userKey);
httpPost.setHeader("token", userToken);
httpPost.setHeader("Auth-key", authKey);
httpPost.setHeader("Content-Type", "application/json");
httpPost.setHeader("User-Agent", "PostmanRuntime/7.26.8");
// 设置请求体
StringEntity entity = new StringEntity(requestBody, StandardCharsets.UTF_8);
httpPost.setEntity(entity);
// 执行请求
HttpResponse response = httpClient.execute(httpPost);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
String errorResponse = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
throw new IOException("HTTP 请求失败,状态码: " + statusCode + ", 响应: " + errorResponse);
}
// 获取响应体
String responseBody = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
// 获取响应头中的 Auth-key
org.apache.http.Header[] authKeyHeaders = response.getHeaders("Auth-key");
String responseAuthKey = null;
if (authKeyHeaders != null && authKeyHeaders.length > 0) {
responseAuthKey = authKeyHeaders[0].getValue();
}
// 5. 解密响应数据
if (responseAuthKey != null && !responseAuthKey.isEmpty()) {
return decryptGoResponse(responseBody, responseAuthKey);
} else {
log.warn("响应头中没有找到 Auth-key,返回原始响应");
return responseBody;
}
} catch (Exception e) {
log.error("HTTP 请求异常", e);
throw new IOException("HTTP 请求异常: " + e.getMessage(), e);
} finally {
if (httpClient != null) {
try {
httpClient.close();
} catch (IOException e) {
log.error("关闭 HTTP 客户端失败", e);
}
}
}
}
/**
* 解密 Go 后端的响应
*/
private String decryptGoResponse(String responseBody, String authKey) throws Exception {
try {
// 解析 Go 的响应
JSONObject responseJson = JSON.parseObject(responseBody);
int code = responseJson.getIntValue("code");
String msg = responseJson.getString("msg");
String encryptedData = responseJson.getString("data");
if (encryptedData != null && !encryptedData.isEmpty()) {
// 解密数据
String decryptedData = SM4Utils.decrypt(encryptedData, authKey);
// 重新构建响应
JSONObject result = new JSONObject();
result.put("code", code);
result.put("msg", msg);
try {
// 尝试将解密后的字符串解析为 JSON 对象
Object dataObj = JSON.parse(decryptedData);
result.put("data", dataObj);
} catch (Exception e) {
// 如果解析失败,直接使用字符串
result.put("data", decryptedData);
}
return result.toJSONString();
} else {
return responseBody;
}
} catch (Exception e) {
log.error("解密 Go 响应数据失败", e);
throw new Exception("解密 Go 响应数据失败: " + e.getMessage(), e);
}
}
}

4
dlp/point-inspect/src/main/java/com/lnsoft/sdhxgk/point/inspect/utils/HttpClientUtil.java

@ -103,9 +103,9 @@ public class HttpClientUtil {
CloseableHttpClient httpClient = HttpClients.createDefault();
//Post请求
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("content-Type","application/json;charset=utf-8");
httpPost.setHeader("Content-Type","application/json");
httpPost.setHeader("Origin", origin);
// httpPost.setHeader("User-Agent", "PostmanRuntime/7.26.8");
httpPost.setHeader("User-Agent", "PostmanRuntime/7.26.8");
CloseableHttpResponse response = null;
try {
StringEntity stringEntity = new StringEntity(paramsJson.toJSONString());

49
dlp/point-inspect/src/main/java/com/lnsoft/sdhxgk/point/inspect/utils/RandomStringUtil.java

@ -0,0 +1,49 @@
package com.lnsoft.sdhxgk.point.inspect.utils;
import org.apache.commons.codec.binary.Hex;
import org.springframework.stereotype.Component;
import java.security.SecureRandom;
import java.util.Random;
@Component
public class RandomStringUtil {
private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
private static final SecureRandom SECURE_RANDOM = new SecureRandom();
/**
* 生成指定长度的随机字符串
*/
public static String generateRandomString(int length) {
StringBuilder sb = new StringBuilder(length);
for (int i = 0; i < length; i++) {
int index = SECURE_RANDOM.nextInt(CHARACTERS.length());
sb.append(CHARACTERS.charAt(index));
}
return sb.toString();
}
/**
* 获取UUID
*/
public static String generateUUID() {
byte[] randomBytes = new byte[16];
SECURE_RANDOM.nextBytes(randomBytes);
randomBytes[6] &= 0x0f; /* clear version */
randomBytes[6] |= 0x40; /* set to version 4 */
randomBytes[8] &= 0x3f; /* clear variant */
randomBytes[8] |= 0x80; /* set to IETF variant */
char[] uuidChars = Hex.encodeHex(randomBytes, false);
StringBuilder uuid = new StringBuilder(36);
for (int i = 0; i < uuidChars.length; i++) {
if (i == 8 || i == 12 || i == 16 || i == 20) {
uuid.append('-');
}
uuid.append(uuidChars[i]);
}
return uuid.toString();
}
}

216
dlp/point-inspect/src/main/java/com/lnsoft/sdhxgk/point/inspect/utils/SM4Utils.java

@ -0,0 +1,216 @@
package com.lnsoft.sdhxgk.point.inspect.utils;
import org.bouncycastle.crypto.engines.SM4Engine;
import org.bouncycastle.crypto.modes.CBCBlockCipher;
import org.bouncycastle.crypto.paddings.PKCS7Padding;
import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.params.ParametersWithIV;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
@Component
public class SM4Utils {
// Go 后端的 Sm4Key - 用作加密密钥
@Value("${sm4.key:hengxingaokeApp1}")
private String sm4Key;
// Go 后端的 Sm4Token - 默认用作 IV
@Value("${sm4.token:04TzMuvkHm_EZnHm}")
private String sm4Token;
// 前端使用的 systemKey(仅用于与前端对比验证)
@Value("${sm4.system-key:appKeyQinDongV01}")
private String systemKey;
private static String SM4_KEY_PROCESSED;
private static String SM4_TOKEN_PROCESSED;
private static String SYSTEM_KEY_HEX;
@PostConstruct
public void init() {
// Go 的方式:处理为16字节(不是转16进制!)
SM4_KEY_PROCESSED = processString(sm4Key, 16, "s");
SM4_TOKEN_PROCESSED = processString(sm4Token, 16, "s");
// 前端的 systemKey 转16进制(仅用于验证)
SYSTEM_KEY_HEX = stringToHex(systemKey);
System.out.println("=== SM4Utils 初始化 ===");
System.out.println("Go 的 Sm4Key: " + sm4Key);
System.out.println("Go 的 Sm4Key(处理后16字节): " + SM4_KEY_PROCESSED);
System.out.println("Go 的 Sm4Token: " + sm4Token);
System.out.println("Go 的 Sm4Token(处理后16字节): " + SM4_TOKEN_PROCESSED);
System.out.println("前端的 VITE_APP_SYSTEM_KEY: " + systemKey);
System.out.println("前端的 systemKey(hex): " + SYSTEM_KEY_HEX);
System.out.println("注意:Java 应该使用 Go 的 Sm4Key,而不是前端的 systemKey!");
}
/**
* 处理字符串为指定长度 Go ProcessString 完全一致
* 超过截断不足用 pad 补全
*/
private static String processString(String s, int length, String pad) {
// 如果字符串长度已经符合要求,直接返回
if (s.length() == length) {
return s;
}
// 如果字符串长度超过了要求,截取指定长度的部分
if (s.length() > length) {
return s.substring(0, length);
}
// 如果字符串长度不足,使用pad字符串进行补充
StringBuilder sb = new StringBuilder(s);
while (sb.length() < length) {
sb.append(pad);
}
return sb.substring(0, length); // 确保不会超过长度
}
/**
* 字符串转16进制仅用于与前端对比
*/
private static String stringToHex(String str) {
byte[] bytes = str.getBytes(StandardCharsets.UTF_8);
StringBuilder hex = new StringBuilder();
for (byte b : bytes) {
hex.append(String.format("%02x", b));
}
return hex.toString();
}
/**
* 判断是否为32位16进制字符串
*/
private static boolean isValidHex32(String str) {
if (str == null || str.length() != 32) return false;
return str.matches("[0-9a-fA-F]{32}");
}
/**
* 加密方法 Go SM4Encrypt 完全一致
* @param data 要加密的字符串数据
* @param customKey 自定义密钥Auth-key如果提供则用作 IV
* @return 加密后的16进制字符串
*/
public static String encrypt(String data, String customKey) throws Exception {
// 1. 确定加密密钥(使用 Go 的 Sm4Key)
String keyStr = SM4_KEY_PROCESSED;
byte[] keyBytes = keyStr.getBytes(StandardCharsets.UTF_8);
// 2. 确定 IV(如果有 customKey 则用 customKey,否则用 Sm4Token)
String ivStr = SM4_TOKEN_PROCESSED;
if (customKey != null && !customKey.isEmpty()) {
// Go 的逻辑:如果有 customKey,处理为16字节
ivStr = processString(customKey, 16, "s");
}
byte[] ivBytes = ivStr.getBytes(StandardCharsets.UTF_8);
/*System.out.println("=== Java 加密参数 ===");
System.out.println("加密密钥: " + keyStr + " (UTF-8字节: " + bytesToHex(keyBytes) + ")");
System.out.println("IV: " + ivStr + " (UTF-8字节: " + bytesToHex(ivBytes) + ")");
System.out.println("原始数据: " + data);*/
// 3. 使用 BouncyCastle 进行 SM4-CBC 加密
PaddedBufferedBlockCipher cipher = new PaddedBufferedBlockCipher(
new CBCBlockCipher(new SM4Engine()), new PKCS7Padding()
);
cipher.init(true, new ParametersWithIV(new KeyParameter(keyBytes), ivBytes));
byte[] inputBytes = data.getBytes(StandardCharsets.UTF_8);
byte[] outputBytes = new byte[cipher.getOutputSize(inputBytes.length)];
int length1 = cipher.processBytes(inputBytes, 0, inputBytes.length, outputBytes, 0);
int length2 = cipher.doFinal(outputBytes, length1);
byte[] encryptedBytes = new byte[length1 + length2];
System.arraycopy(outputBytes, 0, encryptedBytes, 0, encryptedBytes.length);
String result = bytesToHex(encryptedBytes);
//System.out.println("加密结果(hex): " + result);
return result;
}
/**
* 解密方法 Go SM4Decrypt 完全一致
* @param encryptedHex 加密后的16进制字符串
* @param customKey 自定义密钥Auth-key如果提供则用作 IV
* @return 解密后的字符串
*/
public static String decrypt(String encryptedHex, String customKey) throws Exception {
// 1. 确定加密密钥(使用 Go 的 Sm4Key)
String keyStr = SM4_KEY_PROCESSED;
byte[] keyBytes = keyStr.getBytes(StandardCharsets.UTF_8);
// 2. 确定 IV(如果有 customKey 则用 customKey,否则用 Sm4Token)
String ivStr = SM4_TOKEN_PROCESSED;
if (customKey != null && !customKey.isEmpty()) {
// Go 的逻辑:如果有 customKey,处理为16字节
ivStr = processString(customKey, 16, "s");
}
byte[] ivBytes = ivStr.getBytes(StandardCharsets.UTF_8);
/*System.out.println("=== Java 解密参数 ===");
System.out.println("解密密钥: " + keyStr + " (UTF-8字节: " + bytesToHex(keyBytes) + ")");
System.out.println("IV: " + ivStr + " (UTF-8字节: " + bytesToHex(ivBytes) + ")");
System.out.println("加密数据(hex): " + encryptedHex);*/
// 3. 转换加密数据
byte[] encryptedBytes = hexToBytes(encryptedHex);
// 4. 使用 BouncyCastle 进行 SM4-CBC 解密
PaddedBufferedBlockCipher cipher = new PaddedBufferedBlockCipher(
new CBCBlockCipher(new SM4Engine()), new PKCS7Padding()
);
cipher.init(false, new ParametersWithIV(new KeyParameter(keyBytes), ivBytes));
byte[] outputBytes = new byte[cipher.getOutputSize(encryptedBytes.length)];
int length1 = cipher.processBytes(encryptedBytes, 0, encryptedBytes.length, outputBytes, 0);
int length2 = cipher.doFinal(outputBytes, length1);
byte[] decryptedBytes = new byte[length1 + length2];
System.arraycopy(outputBytes, 0, decryptedBytes, 0, decryptedBytes.length);
String result = new String(decryptedBytes, StandardCharsets.UTF_8);
System.out.println("解密结果: " + result);
return result;
}
/**
* 字节数组转16进制字符串
*/
private static String bytesToHex(byte[] bytes) {
StringBuilder hex = new StringBuilder();
for (byte b : bytes) {
hex.append(String.format("%02x", b));
}
return hex.toString();
}
/**
* 16进制字符串转字节数组
*/
private static byte[] hexToBytes(String hex) {
if (hex.length() % 2 != 0) {
throw new IllegalArgumentException("Hex string length must be even");
}
byte[] bytes = new byte[hex.length() / 2];
for (int i = 0; i < bytes.length; i++) {
int index = i * 2;
bytes[i] = (byte) Integer.parseInt(hex.substring(index, index + 2), 16);
}
return bytes;
}
}

31
dlp/point-inspect/src/main/java/com/lnsoft/sdhxgk/point/inspect/utils/TeamRemoteCallConfig.java

@ -13,9 +13,11 @@ import com.lnsoft.sdhxgk.point.inspect.constants.Constants;
import com.lnsoft.sdhxgk.point.inspect.domain.DlpInspectPlanPerson;
import com.lnsoft.sdhxgk.point.inspect.domain.vo.TeamGroupVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
@ -59,6 +61,12 @@ public class TeamRemoteCallConfig {
@Resource
private RedisUtil redisUtil;
@Autowired
private GoApiClient goApiClient; // 新增:注入GoApiClient
@Resource
private SM4Utils sm4Utils;
private static final ReentrantLock LOCK = new ReentrantLock();
/**
* 调用验证功能接口,获取token
@ -111,9 +119,27 @@ public class TeamRemoteCallConfig {
JSONObject json = (JSONObject) JSONObject.toJSON(teamGroupVo);
String requestBody = String.valueOf(json);
JSONObject jsonObject = HttpClientUtil.doPostByToken(teamPersonUrl, requestBody, token, three, origin);
JSONObject datas = (JSONObject) jsonObject.get("data");
// 2. 使用 GoApiClient 调用加密接口
String response = goApiClient.callGoApi(
teamPersonUrl,
teamGroupVo,
three,
token
);
// 3. response 已经是“解密后的 JSON 字符串”
JSONObject result = JSONObject.parseObject(response);
JSONObject datas = result.getJSONObject("data");
if (data == null) {
log.error("Go接口返回中 data 为空,result={}", result);
return null;
}
return datas;
// JSONObject jsonObject = HttpClientUtil.doPostByToken(teamPersonUrl, requestBody, token, three, origin);
// JSONObject datas = (JSONObject) jsonObject.get("data");
// log.info("datas : {}", datas);
// return datas;
} catch (Exception e) {
e.printStackTrace();
}
@ -278,4 +304,5 @@ public class TeamRemoteCallConfig {
return json;
}
}

6
job/job-alarm/src/main/java/com/lnsoft/sdhxgk/job/alarm/JobAlarmApplication.java

@ -9,19 +9,13 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
@ServletComponentScan
@SpringBootApplication(scanBasePackages = {"com.lnsoft"})
@Configuration
@EnableSwaggerBootstrapUI
@MapperScan("com.lnsoft.sdhxgk.**.mapper")
@ComponentScan(excludeFilters = {
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE,
classes = com.lnsoft.sdhxgk.rtd.RtdClients.class)
})
public class JobAlarmApplication {
private static final Logger LOGGER = LoggerFactory

Loading…
Cancel
Save