From 3e80937c17135666babd4d58b645cb805fa9d1de Mon Sep 17 00:00:00 2001 From: Jay <csj123456> Date: 星期三, 22 一月 2025 15:22:02 +0800 Subject: [PATCH] 新增年份 --- shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/SyncSegmentedDataTask.java | 8 +++++--- 1 files changed, 5 insertions(+), 3 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 94cfb55..d57d35c 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 @@ -110,11 +110,13 @@ public List<ElectricityPriceSegmentedDTO> getElectricityPriceSegmentedList(String accessToken){ Map<String, String> paramsMap = new HashMap<>(); LocalDate date = LocalDate.now(); // 获取当前日期的LocalDate实例 - int year = date.getYear(); - paramsMap.put("clock", String.valueOf(year)); + String year = String.valueOf(date.getYear()); + paramsMap.put("clock", year); String resp = HttpUtils.sendPost(QUERY_SEGMENTED_DATA_URL, JSON.toJSONString(paramsMap), accessToken); JSONObject jsonObject = JSON.parseObject(resp); - return jsonObject.getJSONArray("data").toJavaList(ElectricityPriceSegmentedDTO.class); + List<ElectricityPriceSegmentedDTO> list = jsonObject.getJSONArray("data").toJavaList(ElectricityPriceSegmentedDTO.class); + list.forEach(item -> item.setYear(year)); + return list; } public static String encryptWithPublicKey(String publicKeyString, String data) throws Exception { -- Gitblit v1.9.3