From 3787b4f27ed7b29c4b4e4da82fc80f0aa8f1d3e0 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期日, 09 三月 2025 23:52:33 +0800
Subject: [PATCH] 重启model服务

---
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/SyncSegmentedDataTask.java |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/SyncSegmentedDataTask.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/SyncSegmentedDataTask.java
index d57d35c..e88f129 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/SyncSegmentedDataTask.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/SyncSegmentedDataTask.java
@@ -43,13 +43,13 @@
 
     private static final String QUERY_SEGMENTED_DATA_URL = "http://10.88.7.107:8081/SG.Web/api/services/nYJK/DiagnosticsSg/QuerySegmentedDataAsync";
 
-    private static final String USERNAME = "MX001@sgis";
+    private static final String USERNAME = "Mx001@sgis";
 
     private static final String PASSWORD = "123456";
 
     @Override
     public void run(String params) {
-        logger.info("runPredictModuleTask定时任务正在执行,参数为:{}", params);
+        logger.info("syncSegmentedDataTask定时任务正在执行,参数为:{}", params);
         try {
             Calendar calendar = Calendar.getInstance();
             calendar.set(Calendar.SECOND, 0);
@@ -65,19 +65,22 @@
             RequestAccessTokenVO requestAccessToken = new RequestAccessTokenVO();
             requestAccessToken.setUserName(USERNAME);
             // 使用公钥和组合后的密码进行密码加密
-            requestAccessToken.setReaPassword(encryptWithPublicKey(publicKeyKey, password));
+            String realPassword = encryptWithPublicKey(publicKeyKey, password);
+            logger.info("公钥和组合后的密码进行密码加密:" + realPassword);
+            requestAccessToken.setPassword(realPassword);
+            requestAccessToken.setSource(1);
             //获取 token
             String accessToken = "Bearer " + getAccessToken(requestAccessToken);
             //获取保存后的数据
             List<ElectricityPriceSegmentedDTO> list = getElectricityPriceSegmentedList(accessToken);
-            list.forEach(item -> {
-                mcsApi.createElectricityPrice(item);
-            });
+            logger.info("开始保存数据:" + JSON.toJSONString(list));
+            mcsApi.createElectricityPrice(list);
+            logger.info("保存数据完成");
         } catch (Exception ex) {
-            logger.error("runPredictModuleTask运行异常");
+            logger.error("syncSegmentedDataTask运行异常:" + ex.getMessage());
             ex.printStackTrace();
         }
-        logger.info("runPredictModuleTask运行完成");
+        logger.info("syncSegmentedDataTask运行完成");
     }
 
     public String getPublicKey() {
@@ -95,6 +98,7 @@
 
     public String getAccessToken(RequestAccessTokenVO requestAccessToken) {
         String accessToken = "";
+        logger.info("请求参数:" + JSON.toJSONString(requestAccessToken));
         String resp = HttpUtils.sendPost(ACCESS_TOKEN_URL, JSON.toJSONString(requestAccessToken));
         logger.info("获取token的返回值:" + resp);
         JSONObject jsonObject = JSON.parseObject(resp);
@@ -108,11 +112,14 @@
     }
 
     public List<ElectricityPriceSegmentedDTO> getElectricityPriceSegmentedList(String accessToken){
+        logger.info("accessToken: " + accessToken);
         Map<String, String> paramsMap = new HashMap<>();
         LocalDate date = LocalDate.now();  // 获取当前日期的LocalDate实例
         String year = String.valueOf(date.getYear());
         paramsMap.put("clock", year);
+        logger.info("请求参数:" + JSON.toJSONString(paramsMap));
         String resp = HttpUtils.sendPost(QUERY_SEGMENTED_DATA_URL, JSON.toJSONString(paramsMap), accessToken);
+        logger.info("获取分段数据的返回值:" + resp);
         JSONObject jsonObject = JSON.parseObject(resp);
         List<ElectricityPriceSegmentedDTO> list = jsonObject.getJSONArray("data").toJavaList(ElectricityPriceSegmentedDTO.class);
         list.forEach(item -> item.setYear(year));

--
Gitblit v1.9.3