From 120cd38deee93f2f2011a567aa90d101e4b5fb55 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 6 May 2024 18:18:31 +0800 Subject: [PATCH] =?UTF-8?q?#=E6=B0=B4=E7=94=B5=E7=AB=99=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=9C=88=E6=8A=A5=E8=AE=BE=E5=A4=87=E7=B1=BB=E5=9E=8B=E8=BF=87?= =?UTF-8?q?=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../safeproduct-api/safeproduct-api.iml | 306 +-------------------- .../service/equipment/impl/DeviceServiceImpl.java | 4 + .../operation/home/impl/RealTargetServiceImpl.java | 2 +- .../operation/report/impl/ReportServiceImpl.java | 37 ++- .../mapper/equipment/DeviceParamMapper.xml | 2 +- .../census/service/impl/TargetServiceImpl.java | 12 +- .../controller/StationVideoTypeController.java | 2 +- .../operational/src/main/resources/db/2.0.4.sql | 1 + 8 files changed, 39 insertions(+), 327 deletions(-) create mode 100644 hzims-service/operational/src/main/resources/db/2.0.4.sql diff --git a/hzims-service-api/safeproduct-api/safeproduct-api.iml b/hzims-service-api/safeproduct-api/safeproduct-api.iml index 7d717b0..1daccae 100644 --- a/hzims-service-api/safeproduct-api/safeproduct-api.iml +++ b/hzims-service-api/safeproduct-api/safeproduct-api.iml @@ -1,312 +1,8 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/DeviceServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/DeviceServiceImpl.java index beca1a3..ff5b613 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/DeviceServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/DeviceServiceImpl.java @@ -68,9 +68,11 @@ public class DeviceServiceImpl extends BaseServiceImpl stations = stationService.list(Wrappers.lambdaQuery() .eq(StationEntity::getType,HomePageConstant.HYDROPOWER) - .eq(StationEntity::getDataOrigin,"0") + //.eq(StationEntity::getDataOrigin,"0") ); if(CollectionUtil.isEmpty(stations)){ return; diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java index 994d944..e071cd8 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java @@ -633,7 +633,7 @@ public class ReportServiceImpl implements ReportService { run.setStationCode(station.getCode()); run.setStationName(station.getName()); Calendar calendar = Calendar.getInstance(); - calendar.setTime(new Date()); + calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); calendar.add(Calendar.DAY_OF_MONTH,-1); run.setMonth(DateUtil.format(calendar.getTime(),"yyyy-MM")); List stationDevices = devices.stream().filter(device->device.getDepartment().equals(station.getRefDept())).collect(Collectors.toList()); @@ -667,13 +667,23 @@ public class ReportServiceImpl implements ReportService { // 运行时长 run.setRunHours(this.runHours(device)); // 月发电量 - run.setGenerate(this.generate(0,device.getNumber(),device.getRide())); + Double day = this.generate(0,device.getNumber(),device.getRide()); + if(ObjectUtil.isEmpty(day)){ + run.setGenerate(0.0); + }else{ + run.setGenerate(day/10000); + } // 年发电量 - run.setGenerateYear(this.generate(1,device.getNumber(),device.getRide())); + Double year = this.generate(1,device.getNumber(),device.getRide()); + if(ObjectUtil.isEmpty(day)){ + run.setGenerateYear(0.0); + }else{ + run.setGenerateYear(year/10000); + } // 计划发电量 - run.setPlan(this.planGenerate(0,stationCode,plans)); + run.setPlan(this.planGenerate(0,stationCode,plans)/10000); // 年计划发电量 - run.setPlanYear(this.planGenerate(1,stationCode,plans)); + run.setPlanYear(this.planGenerate(1,stationCode,plans)/10000); runs.add(run); }); return JSONObject.toJSONString(runs); @@ -689,7 +699,7 @@ public class ReportServiceImpl implements ReportService { */ private Double generate(int type,String deviceCode,double ride) { Calendar calendar = Calendar.getInstance(); - calendar.setTime(new Date()); + calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); String end = null,start = null; int cycleType = 5; switch (type){ @@ -710,6 +720,7 @@ public class ReportServiceImpl implements ReportService { calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); + calendar.add(Calendar.DAY_OF_MONTH,1); start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); break; } @@ -725,7 +736,7 @@ public class ReportServiceImpl implements ReportService { */ private Double planGenerate(int type, String stationCode,List plans) { Calendar calendar = Calendar.getInstance(); - calendar.setTime(new Date()); + calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); if(type == 0){ calendar.add(Calendar.DAY_OF_MONTH,-1); calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY) + 1); @@ -762,7 +773,7 @@ public class ReportServiceImpl implements ReportService { // 确定查询时间范围: 年、月 Date startDate,endDate; Calendar calendar = Calendar.getInstance(); - calendar.setTime(new Date()); + calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); endDate = calendar.getTime(); calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); @@ -835,7 +846,7 @@ public class ReportServiceImpl implements ReportService { */ private String alarmData(String code) { Calendar calendar = Calendar.getInstance(); - calendar.setTime(new Date()); + calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); calendar.add(Calendar.DAY_OF_MONTH,-1); String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); calendar.add(Calendar.MONTH,-1); @@ -891,8 +902,7 @@ public class ReportServiceImpl implements ReportService { param.setStartTime(LocalDateTime.parse(start,DateUtil.DATETIME_FORMATTER)); param.setEndTime(LocalDateTime.parse(end, DateUtil.DATETIME_FORMATTER)); param.setStations(Collections.singletonList(code)); - param.setPage(0); - param.setPageSize(100000); + param.setNeedPage(false); Result> result = soeDataClient.pageStbAnalysis(param); if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())){ return new ArrayList<>(); @@ -900,7 +910,7 @@ public class ReportServiceImpl implements ReportService { return result.getData().getRecords().stream().collect(Collectors.groupingBy(StbAnalysisVO::getName)).entrySet().stream().map(entry->{ RunAlarmVo alarm = new RunAlarmVo(); alarm.setAlarmTime(entry.getValue().stream().sorted(Comparator.comparing(StbAnalysisVO::getTs)).collect(Collectors.toList()).get(0).getTs()); - alarm.setDeviceName(entry.getValue().get(0).getDevicename()); + alarm.setDeviceName(entry.getValue().get(0).getOrd()); alarm.setContent(entry.getKey()); alarm.setType(String.valueOf(AlarmConstants.EARLY)); alarm.setTypeName("智能预警"); @@ -942,7 +952,8 @@ public class ReportServiceImpl implements ReportService { */ private List curve(List attributes, String deviceCode) { Calendar calendar = Calendar.getInstance(); - calendar.setTime(DateUtil.parse(DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59",DateUtil.PATTERN_DATETIME)); + calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); + //calendar.setTime(DateUtil.parse(DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59",DateUtil.PATTERN_DATETIME)); calendar.add(Calendar.DAY_OF_MONTH,-1); String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); calendar.add(Calendar.MONTH,-1); diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/DeviceParamMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/DeviceParamMapper.xml index 644212b..9992f8f 100644 --- a/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/DeviceParamMapper.xml +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/DeviceParamMapper.xml @@ -15,7 +15,7 @@