From b088f3e9c595484b84a64bef57208098c92e70cc Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 10 四月 2025 17:24:31 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile

---
 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/util/TCECCJianGuanontroller.java |   67 ++++++++++++++++++++++++++++++---
 1 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/util/TCECCJianGuanontroller.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/util/TCECCJianGuanontroller.java
index 669b5b5..e2425a7 100644
--- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/util/TCECCJianGuanontroller.java
+++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/util/TCECCJianGuanontroller.java
@@ -3,6 +3,9 @@
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.nacos.common.utils.JacksonUtils;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.ruoyi.chargingPile.api.feignClient.*;
 import com.ruoyi.chargingPile.api.model.*;
 import com.ruoyi.common.core.domain.R;
@@ -1744,13 +1747,25 @@
 		String timeStamp = System.currentTimeMillis() + "";
 		SequenceGenerator generator = new SequenceGenerator();
 		String nextSequence = generator.getNextSequence();
-		String data = AesEncryption.encrypt(OurDataSecret, OurDataSecretIV,JSONObject.toJSONString(superviseQueryOperatorInfoResultPage));
+		// 使用 Jackson 转换为 JSON
+		ObjectMapper objectMapper = new ObjectMapper();
+		objectMapper.enable(MapperFeature.USE_ANNOTATIONS); // 启用注解支持
+		String json = null;
+		try {
+			json = objectMapper.writeValueAsString(superviseQueryOperatorInfoResultPage);
+		} catch (JsonProcessingException e) {
+			throw new RuntimeException(e);
+		}
+		String data = AesEncryption.encrypt(OurDataSecret, OurDataSecretIV,json);
 		String hmacMD5 = HMacMD5Util.getHMacMD5(OperatorID,timeStamp, data,nextSequence,OurSigSecret);
 		BaseResult baseResult = new BaseResult();
 		baseResult.setData(data);
 		baseResult.setSig(hmacMD5);
 		baseResult.setRet(0);
 		baseResult.setMsg("OK");
+		Long mapKey = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
+		baseResult.setTimeStamp(mapKey);
+		baseResult.setSeq("0001");
 		baseResult.setOperatorID(OperatorID);
 		return baseResult;
 	}
@@ -1844,16 +1859,29 @@
 		String timeStamp = System.currentTimeMillis() + "";
 		SequenceGenerator generator = new SequenceGenerator();
 		String nextSequence = generator.getNextSequence();
-		String data = AesEncryption.encrypt(OurDataSecret, OurDataSecretIV,JSONObject.toJSONString(queryStationsInfoResult));
+		// 使用 Jackson 转换为 JSON
+		ObjectMapper objectMapper = new ObjectMapper();
+		objectMapper.enable(MapperFeature.USE_ANNOTATIONS); // 启用注解支持
+        String json = null;
+        try {
+            json = objectMapper.writeValueAsString(queryStationsInfoResult);
+        } catch (JsonProcessingException e) {
+            throw new RuntimeException(e);
+        }
+        String data = AesEncryption.encrypt(OurDataSecret, OurDataSecretIV,json);
 		String hmacMD5 = HMacMD5Util.getHMacMD5(OurOperatorID,timeStamp, data,nextSequence,OurSigSecret);
 		BaseResult baseResult = new BaseResult();
 		baseResult.setData(data);
 		baseResult.setSig(hmacMD5);
 		baseResult.setRet(0);
 		baseResult.setMsg("OK");
+		Long mapKey = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
+		baseResult.setTimeStamp(mapKey);
+		baseResult.setSeq("0001");
 		baseResult.setOperatorID("906171535");
 		return baseResult;
 	}
+
 
 
 	/**
@@ -1936,13 +1964,25 @@
 		String timeStamp = System.currentTimeMillis() + "";
 		SequenceGenerator generator = new SequenceGenerator();
 		String nextSequence = generator.getNextSequence();
-		String data = AesEncryption.encrypt(OurDataSecret, OurDataSecretIV,JSONObject.toJSONString(queryStationStatusResult));
+		// 使用 Jackson 转换为 JSON
+		ObjectMapper objectMapper = new ObjectMapper();
+		objectMapper.enable(MapperFeature.USE_ANNOTATIONS); // 启用注解支持
+		String json = null;
+		try {
+			json = objectMapper.writeValueAsString(queryStationStatusResult);
+		} catch (JsonProcessingException e) {
+			throw new RuntimeException(e);
+		}
+		String data = AesEncryption.encrypt(OurDataSecret, OurDataSecretIV,json);
 		String hmacMD5 = HMacMD5Util.getHMacMD5(OurOperatorID,timeStamp, data,nextSequence,OurSigSecret);
 		BaseResult baseResult = new BaseResult();
 		baseResult.setData(data);
 		baseResult.setSig(hmacMD5);
 		baseResult.setRet(0);
 		baseResult.setMsg("OK");
+		Long mapKey = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
+		baseResult.setTimeStamp(mapKey);
+		baseResult.setSeq("0001");
 		baseResult.setOperatorID("906171535");
 		return baseResult;
 	}
@@ -2177,14 +2217,29 @@
 				equipmentInfo.setEquipmentClassification(equipmentInfo.getEquipmentClassification()==null?1:equipmentInfo.getEquipmentClassification());
 
 			}
-			stationInfo.setEquipmentOwnerName("明星新能源");
-			stationInfo.setResidentNo("A1234");
+			if (org.springframework.util.StringUtils.hasLength(site.getEquipmentOwnerName())){
+				stationInfo.setEquipmentOwnerName(site.getEquipmentOwnerName());
+			}else{
+				stationInfo.setEquipmentOwnerName("明星新能源");
+
+			}
+			if (org.springframework.util.StringUtils.hasLength(site.getResidentNo())){
+				stationInfo.setResidentNo(site.getResidentNo());
+			}else{
+				stationInfo.setResidentNo("A1234");
+
+			}
 			stationInfo.setSupplyType(stationInfo.getSupplyType()==null?1:stationInfo.getSupplyType());
 			stationInfo.setWattHourMeterNo(org.springframework.util.StringUtils.hasLength(stationInfo.getWattHourMeterNo())?stationInfo.getWattHourMeterNo():UUID.randomUUID().toString().replaceAll("-", ""));
 			stationInfo.setForwardPower(stationInfo.getForwardPower()==null?"1.3654":stationInfo.getForwardPower());
 			String uuid = UUID.randomUUID().toString();
 			String randomString = uuid.replaceAll("-", ""); // 去除'-'
-			stationInfo.setRecordUniqueNo(randomString);
+			if (org.springframework.util.StringUtils.hasLength(site.getRecordUniqueNo())){
+				stationInfo.setRecordUniqueNo(site.getRecordUniqueNo());
+			}else{
+				stationInfo.setRecordUniqueNo("A123998987hjn4");
+
+			}
 
 		}
 		BaseResult baseResult = new BaseResult();

--
Gitblit v1.7.1