From 843134665ebc99be4737df87ffe00f1dc0ec49d0 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 29 Feb 2024 15:44:11 +0800 Subject: [PATCH] =?UTF-8?q?#=E4=B9=8C=E5=85=B9=E5=88=AB=E5=85=8B=E5=8A=9F?= =?UTF-8?q?=E7=8E=87=E6=95=B0=E6=8D=AE=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/main/entity/UserDeptEntity.java | 2 -- .../data/service/impl/HzimsDataServiceImpl.java | 15 ++++--------- .../main/service/IAnalyseDataService.java | 2 +- .../main/service/impl/AnalyseDataServiceImpl.java | 26 +++++++++++----------- 4 files changed, 18 insertions(+), 27 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/entity/UserDeptEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/entity/UserDeptEntity.java index ba35e1f..a6a9525 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/entity/UserDeptEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/entity/UserDeptEntity.java @@ -28,6 +28,4 @@ public class UserDeptEntity extends TenantEntity implements Serializable { @ApiModelProperty("机构Id") private Long deptId; - - } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java index 0255687..7990016 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java @@ -411,17 +411,17 @@ public class HzimsDataServiceImpl implements HzimsDataService { calendar.add(Calendar.DAY_OF_MONTH,-30); String startTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); // 功率查询 - List datas = dataService.periodTargetDatas(startTime,endTime,3,2,result.getData(),HomePageConstant.ACTIVE_POWER); + List datas = dataService.periodTargetDatas(startTime,endTime,3,2,result.getData(),HomePageConstant.ACTIVE_POWER); if(CollectionUtil.isEmpty(datas)){ return new ArrayList<>(); } List electricitys = new ArrayList<>(); // 数据累计 datas.forEach(item->{ - if(CollectionUtil.isEmpty(item.getList())){ + if(CollectionUtil.isEmpty(datas)){ return; } - item.getList().forEach(data->{ + datas.forEach(data->{ ConverElectricityVo electricity = new ConverElectricityVo(); Date date = DateUtil.parse(data.getTs(), "yyyy-MM-dd HH:mm:ss.s"); electricity.setTime(DateUtil.format(date,DateUtil.PATTERN_DATE)); @@ -519,14 +519,7 @@ public class HzimsDataServiceImpl implements HzimsDataService { if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ return datas; } - // 功率查询 - List loads = dataService.periodTargetDatas(start,end,3,2,result.getData(),HomePageConstant.ACTIVE_POWER); - if(!CollectionUtil.isEmpty(loads)){ - loads.forEach(load->{ - datas.addAll(load.getList()); - }); - } - return datas; + return dataService.periodTargetDatas(start,end,3,2,result.getData(),HomePageConstant.ACTIVE_POWER); } /** diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAnalyseDataService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAnalyseDataService.java index dbf502e..5dbfdb3 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAnalyseDataService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAnalyseDataService.java @@ -18,7 +18,7 @@ public interface IAnalyseDataService { List periodTargetData(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages); - List periodTargetDatas(String startTime, String endTime, Integer accessRules, Integer cycleType, List deviceCodes, String signages); + List periodTargetDatas(String startTime, String endTime, Integer accessRules, Integer cycleType, List deviceCodes, String signages); Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Integer ride ,String signages); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java index 9e120ec..927d6d2 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java @@ -94,13 +94,13 @@ public class AnalyseDataServiceImpl implements IAnalyseDataService { * @return */ @Override - public List periodTargetDatas(String startTime, String endTime, Integer accessRules, Integer cycleType, List deviceCodes, String signages) { - AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); - List signboardConditions = new ArrayList<>(); + public List periodTargetDatas(String startTime, String endTime, Integer accessRules, Integer cycleType, List deviceCodes, String signages) { + List dataTaos = new ArrayList<>(); deviceCodes.forEach(deviceCode->{ + AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); + po.setDeviceCode(deviceCode); AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO(); analyzeDataConditionPO.setFull(1); - po.setDeviceCode(deviceCode); analyzeDataConditionPO.setSignages(signages); analyzeDataConditionPO.setKeepFigures(2); analyzeDataConditionPO.setAccessRules(accessRules); @@ -109,16 +109,16 @@ public class AnalyseDataServiceImpl implements IAnalyseDataService { analyzeDataConditionPO.setTimeInterval(1); analyzeDataConditionPO.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(), startTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME))); analyzeDataConditionPO.setEndTime(LocalDateTime.parse(DateUtil.format(new Date(), endTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME))); - signboardConditions.add(analyzeDataConditionPO); + po.setSignboardConditions(Collections.singletonList(analyzeDataConditionPO)); + log.error("period_target_data_request {}",po); + R> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po); + if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { + return; + } + log.error("period_target_data_resp {}",result); + dataTaos.addAll(result.getData().get(0).getList()); }); - po.setSignboardConditions(signboardConditions); - log.error("period_target_data_request {}",po); - R> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po); - if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { - return new ArrayList<>(); - } - log.error("period_target_data_resp {}",result); - return result.getData(); + return dataTaos; }