From 42050b76b23190fca15606f78ee276ce43180214 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 16 May 2023 16:44:46 +0800 Subject: [PATCH 1/3] =?UTF-8?q?#bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hnac/hzinfo/inspect/plan/vo/PlanListQueryVO.java | 4 ++++ .../java/com/hnac/hzinfo/inspect/obj/mapper/InspectObjectMapper.xml | 3 +++ .../main/java/com/hnac/hzinfo/inspect/obj/vo/ContentListQueryVO.java | 4 ++++ .../main/java/com/hnac/hzinfo/inspect/obj/vo/ProjectListQueryVO.java | 4 ++++ .../java/com/hnac/hzinfo/inspect/obj/vo/TemplateListQueryVO.java | 4 +++- .../java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java | 3 +++ .../java/com/hnac/hzinfo/inspect/task/controller/TaskController.java | 2 +- .../src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml | 3 +++ .../src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java | 5 ++++- .../hzims/operational/access/mapper/OperAccessStatisticsMapper.xml | 3 +++ .../alert/service/impl/HistoryAbnormalAlarmServiceImpl.java | 1 - .../hzims/operational/defect/controller/OperDefectController.java | 3 +++ .../defect/controller/OperDefectStatisticsController.java | 4 ++++ .../operational/defect/controller/OperPhenomenonController.java | 3 +++ .../com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.xml | 2 +- .../operational/main/service/impl/MainWorkBenchServiceImpl.java | 2 +- .../operational/station/service/impl/RealMonitorServiceImpl.java | 2 +- .../standardTicket/service/impl/StandardTicketInfoServiceImpl.java | 1 + .../ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java | 1 + 19 files changed, 47 insertions(+), 7 deletions(-) diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/plan/vo/PlanListQueryVO.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/plan/vo/PlanListQueryVO.java index 7face56..a0fa371 100644 --- a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/plan/vo/PlanListQueryVO.java +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/plan/vo/PlanListQueryVO.java @@ -86,4 +86,8 @@ public class PlanListQueryVO implements Serializable { @ApiModelProperty("业务状态 0:待审核-->1:已审核-->2:派发中-->3:暂停-->4:结束-->5审核不通过-->6待提交") @QueryField(condition = SqlCondition.EQUAL) private Integer status; + + @ApiModelProperty("创建机构") + @QueryField(condition = SqlCondition.EQUAL) + private Long createDept; } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/InspectObjectMapper.xml b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/InspectObjectMapper.xml index 1f53260..7a6f8a9 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/InspectObjectMapper.xml +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/InspectObjectMapper.xml @@ -28,6 +28,9 @@ and OBJ.`TENANT_ID` = #{obj.tenantId} + + and OBJ.`CREATE_DEPT` = #{obj.createDept} + ORDER BY OBJ.UPDATE_TIME DESC diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ContentListQueryVO.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ContentListQueryVO.java index d0fa012..af027cf 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ContentListQueryVO.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ContentListQueryVO.java @@ -67,4 +67,8 @@ public class ContentListQueryVO implements Serializable { @QueryField(condition = SqlCondition.EQUAL) @ApiModelProperty(value = "支持的巡检类型 0普通巡检,1视频自动巡检,2机器人巡检") private Integer supportAutoVideo; + + @QueryField(condition = SqlCondition.EQUAL) + @ApiModelProperty(value = "创建机构") + private Long createDept; } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ProjectListQueryVO.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ProjectListQueryVO.java index 417ff9c..9f8eac1 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ProjectListQueryVO.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ProjectListQueryVO.java @@ -51,4 +51,8 @@ public class ProjectListQueryVO implements Serializable { @ApiModelProperty(value = " inspectType 支持的巡检类型 0普通巡检,1视频自动巡检,2机器人巡检") private String supportAutoVideo; + @QueryField(condition = SqlCondition.EQUAL) + @ApiModelProperty(value = "创建机构") + private Long createDept; + } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/TemplateListQueryVO.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/TemplateListQueryVO.java index b92d646..087b09b 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/TemplateListQueryVO.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/TemplateListQueryVO.java @@ -51,5 +51,7 @@ public class TemplateListQueryVO implements Serializable { @ApiModelProperty(value = "是否支持视频自动巡检") private Integer supportAutoVideo; - + @QueryField(condition = SqlCondition.EQUAL) + @ApiModelProperty(value = "创建机构") + private Long createDept; } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java index c41efa0..d2c07ac 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java @@ -80,6 +80,9 @@ public class PlanController extends BladeController { if(plan.getStatus()==null){ queryWrapper.ne(PlanEntity::getStatus, PlanContants.PlanStatusEnum.PLAN_AUTH.getStatus()); } + if(plan.getCreateDept()!=null){ + queryWrapper.eq(PlanEntity::getCreateDept,plan.getCreateDept()); + } queryWrapper.orderByDesc(PlanEntity::getUpdateTime); IPage pages = planService.page(Condition.getPage(query), (!bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) ? queryWrapper.eq(PlanEntity::getTenantId, bladeUser.getTenantId()) : queryWrapper); return R.data(pages); diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java index 3f4ac5d..99cda99 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java @@ -113,7 +113,7 @@ public class TaskController extends BladeController { task.setCurUserId(AuthUtil.getUserId()); task.setTenantId(AuthUtil.getTenantId()); } - if (task.getCurUserId().longValue() == -1) { + if (task.getCurUserId() == -1) { task.setCurUserId(null); } List list = taskService.getListPage(pages,task); diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml index e441257..02bd105 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml @@ -74,6 +74,9 @@ and t.AUTO_VIDEO=#{task.autoVideo} + + and t.CREATE_DEPT=#{task.createDept} + order by t.UPDATE_TIME desc diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java index ef51dd3..b36c94d 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java @@ -126,5 +126,8 @@ public class TaskListQuery implements Serializable { */ private String areaId; - + /** + * 创建机构 + */ + private Long createDept; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml index a9703bd..e390f35 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml @@ -40,6 +40,9 @@ and OT.CREATE_DEPT = #{dto.areaId} + + and OT.CREATE_DEPT = #{dto.createDept} + and date_format(OT.PLAN_START_TIME,'%Y-%m') = #{dto.yearMonth} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java index a0cd6d6..23a3cf7 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java @@ -23,7 +23,6 @@ import com.hnac.hzinfo.datasearch.soe.domian.SoeData; import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation; import com.hnac.hzinfo.sdk.core.response.HzPage; import com.hnac.hzinfo.sdk.core.response.Result; -import com.hnac.hzinfo.sdk.v5.soe.SoeClient; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectController.java index 1ec49af..dbe05cf 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectController.java @@ -85,6 +85,9 @@ public class OperDefectController extends BladeController { if (defect.getEndTime() != null) { queryWrapper.le(OperDefectEntity::getCreateTime, defect.getEndTime()); } + if (defect.getCreateDept() != null) { + queryWrapper.eq(OperDefectEntity::getCreateDept, defect.getCreateDept()); + } queryWrapper.orderByDesc(OperDefectEntity::getActStartTime); IPage pages = defectService.page(Condition.getPage(query), queryWrapper); IPage vos = OperDefectWrapper.build().pageVO(pages); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java index d4ba2f9..c2d7f0c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java @@ -7,6 +7,7 @@ import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.OperatorType; import com.hnac.hzims.operational.defect.dto.OperDefectStatisticsDTO; +import com.hnac.hzims.operational.defect.entity.OperDefectEntity; import com.hnac.hzims.operational.defect.entity.OperDefectStatisticsEntity; import com.hnac.hzims.operational.defect.entity.OperFaultEntity; import com.hnac.hzims.operational.defect.service.IOperDefectStatisticsService; @@ -79,6 +80,9 @@ public class OperDefectStatisticsController extends BladeController { if(entity.getActEndTime()!=null){ queryWrapper.le(OperDefectStatisticsEntity::getActStartTime,entity.getActEndTime()); } + if (entity.getCreateDept() != null) { + queryWrapper.eq(OperDefectStatisticsEntity::getCreateDept, entity.getCreateDept()); + } queryWrapper.orderByDesc(OperDefectStatisticsEntity::getActStartTime); IPage pages = statisticsService.page(Condition.getPage(query), queryWrapper); IPage vos = OperDefectStatisticsWrapper.build().pageVO(pages); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java index 7c4e715..cb94c94 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java @@ -86,6 +86,9 @@ public class OperPhenomenonController extends BladeController { if (Func.isNotEmpty(entity.getDiscriminateStatus())) { queryWrapper.eq(OperPhenomenonEntity::getDiscriminateStatus, entity.getDiscriminateStatus()); } + if (Func.isNotEmpty(entity.getCreateDept())) { + queryWrapper.eq(OperPhenomenonEntity::getCreateDept, entity.getCreateDept()); + } // // 区域Id // if (Func.isNotEmpty(entity.getAreaId())) { diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.xml index e67e305..b5b700f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.xml @@ -69,7 +69,7 @@ and (NOT EXCLUDE_DEPT like #{excludeDept} OR EXCLUDE_DEPT IS NULL OR EXCLUDE_DEPT = '') - and (ASCRIPTION_USER like #{ascriptionUser} OR ASCRIPTION_USER IS NULL OR ASCRIPTION_USER = '') + and (ASCRIPTION_USER like concat('%',#{ascriptionUser},'%') OR ASCRIPTION_USER IS NULL OR ASCRIPTION_USER = '') order by ord diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java index ef98cb7..527f060 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java @@ -163,7 +163,7 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl optionalDept = deptByCurrentUser.getData().stream().min(Comparator.comparing(Dept::getDeptCategory)); Integer deptCategory = optionalDept.isPresent() ? optionalDept.map(Dept::getDeptCategory).orElse(null) : null; - Dept dept = optionalDept.isPresent() ? optionalDept.get() : null; + Dept dept = optionalDept.orElse(null); //Integer deptCategory = deptByCurrentUser.getData().stream().min(Comparator.comparing(Dept::getDeptCategory)).get().getDeptCategory(); // 所属机构 List deptList = deptByCurrentUser.getData().stream().map(Dept::getId).collect(Collectors.toList()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java index f3f2bc7..6fdd376 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java @@ -895,7 +895,6 @@ public class RealMonitorServiceImpl implements IRealMonitorService { weather.setIcon(now.getIcon()); weather.setTemp(now.getTemp()); weather.setText(now.getText()); - station.setPrecipitation(now.getPrecip()); } } // 站点七日内天气 @@ -906,6 +905,7 @@ public class RealMonitorServiceImpl implements IRealMonitorService { Daily daily = dailyList.stream().sorted(Comparator.comparing(Daily::getFxDate)).collect(Collectors.toList()).get(0); weather.setTempMin(daily.getTempMin()); weather.setTempMax(daily.getTempMax()); + station.setPrecipitation(daily.getPrecip()); } } station.setNowWater(weather); diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java index 0ae6d17..4437116 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java @@ -107,6 +107,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl> queryList(StandardTicketInfoDto req, Query query) { LambdaQueryWrapper queryWrapper = this.getQueryWrapper(req); + queryWrapper.eq(StandardTicketInfoEntity::getCreateDept,req.getCreateDept()); queryWrapper.orderByDesc(StandardTicketInfoEntity::getCreateTime); IPage pages = super.page(Condition.getPage(query), queryWrapper); return R.data(pages.setRecords(StandardTicketInfoWrapper.build().listVO(pages.getRecords()))); diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java index 40ace2c..a885c55 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java @@ -236,6 +236,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl> queryList(WorkTicketInfoDto req, Query query) { LambdaQueryWrapper lqw = this.getQueryWrapper(req); + lqw.eq(WorkTicketInfoEntity::getCreateDept,req.getCreateDept()); lqw.orderByDesc(WorkTicketInfoEntity::getCreateTime).orderByDesc(WorkTicketInfoEntity::getUpdateTime); IPage pages = super.page(Condition.getPage(query), lqw); pages.setRecords(WorkTicketInfoWrapper.build().listVO(pages.getRecords())); From ef3ac2deed759b009944bdf9536121cf2f3c608c Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 16 May 2023 18:18:31 +0800 Subject: [PATCH 2/3] =?UTF-8?q?#bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/HistoryAbnormalAlarmServiceImpl.java | 2 +- .../main/service/impl/HydropowerServiceImpl.java | 57 ++++++---------------- .../main/service/impl/PhotovoltaicServiceImpl.java | 33 ++----------- .../main/service/impl/WaterServiceImpl.java | 16 +----- 4 files changed, 20 insertions(+), 88 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java index 23a3cf7..7da6a9e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java @@ -351,7 +351,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl> result = alarmClient.getByStationsAndTime(condition); IPage page = Condition.getPage(query); if(result.isSuccess() && ObjectUtil.isNotEmpty(result)){ - // 步骤3.TODO 过滤完成告警处理数据 + // 步骤3.过滤完成告警处理数据 List alarms = result.getData().getRecords().stream().map(record ->{ AlarmVo alarm = new AlarmVo(); alarm.setId(record.getId()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java index d3dc3df..c9e67f1 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java @@ -281,32 +281,19 @@ public class HydropowerServiceImpl implements HydropowerService { * @return */ private List getLoadsByDay(EminfoAndEmParamVo device) { - // FIXME 当天功率测试数据 - Calendar start = Calendar.getInstance(); - start.add(Calendar.HOUR_OF_DAY,-start.get(Calendar.HOUR_OF_DAY)); - List list = new ArrayList<>(); - Random random = new Random(); - while (start.getTime().compareTo(new Date()) <= 0){ - ActivePowerVo load = new ActivePowerVo(); - load.setHour(start.get(Calendar.HOUR_OF_DAY)); - load.setActivePower(String.valueOf(random.nextDouble() * 500)); - list.add(load); - start.add(Calendar.HOUR_OF_DAY,1); - } - return list; - /*String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; + String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); List records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD); if (CollectionUtil.isEmpty(records)) { return new ArrayList<>(); } return records.stream().map(record -> { - PhotovoltaicPowerVo load = new PhotovoltaicPowerVo(); + ActivePowerVo load = new ActivePowerVo(); Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); - load.setHour(DateUtil.format(time,"yyyy-mm-dd HH")); + load.setHour(time.getHours()); load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); return load; - }).sorted(Comparator.comparing(PhotovoltaicPowerVo::getHour)).collect(Collectors.toList());*/ + }).sorted(Comparator.comparing(ActivePowerVo::getHour)).collect(Collectors.toList()); } /** @@ -527,25 +514,9 @@ public class HydropowerServiceImpl implements HydropowerService { * @return */ private List getGenerationPowerList(EminfoAndEmParamVo device) { - // FIXME 测试数据 - String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME); - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.DAY_OF_MONTH,-29); - 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)); - String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); - Random random = new Random(); - List generates = new ArrayList<>(); - if(calendar.getTime().compareTo(new Date()) <= 0){ - GenerationPowerVo generate = new GenerationPowerVo(); - generate.setDate(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE)); - generate.setGenerate(random.nextFloat() * 500000f); - generates.add(generate); - } - return generates; - - /*List records = analyseDataService.periodTargetData(start,end,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); + String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; + String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); + List records = analyseDataService.periodTargetData(start,end,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); if(CollectionUtil.isEmpty(records)){ return new ArrayList<>(); } @@ -555,7 +526,7 @@ public class HydropowerServiceImpl implements HydropowerService { generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE)); generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); return generate; - }).collect(Collectors.toList());*/ + }).collect(Collectors.toList()); } /** @@ -1499,7 +1470,7 @@ public class HydropowerServiceImpl implements HydropowerService { if(CollectionUtil.isEmpty(list)){ return 0; } - return (float) list.stream().filter(o->createDept.equals(o.getDeptId())).mapToDouble(o->Double.valueOf(o.getActivePower())).sum(); + return (float) list.stream().filter(o->createDept.equals(o.getDeptId())).mapToDouble(HydropowerUnitRealVo::getActivePower).sum(); } /** @@ -1597,7 +1568,7 @@ public class HydropowerServiceImpl implements HydropowerService { this.settingBase(duty,item); // 开始时间、结束时间 LocalDateTime localDateTime = LocalDateTime.ofInstant(duty.getDutyDate().toInstant(), ZoneId.systemDefault()); - LocalDateTime startDate = localDateTime.withHour(duty.getStartTime().getHours()).withMinute(duty.getStartTime().getMinutes()).withSecond(00); + LocalDateTime startDate = localDateTime.withHour(duty.getStartTime().getHours()).withMinute(duty.getStartTime().getMinutes()).withSecond(0); //LocalDateTime endDate = localDateTime.withHour(duty.getEndTime().getHours()).withMinute(duty.getEndTime().getMinutes()).withSecond(00); DateTimeFormatter dtf = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME); String start = dtf.format(startDate); @@ -1605,7 +1576,7 @@ public class HydropowerServiceImpl implements HydropowerService { List deptList = Collections.singletonList(deptId); // 使用多线程处理数据 ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("duty_data-pool-%d").build(); - ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); + ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); CountDownLatch countDownLatch = new CountDownLatch(DUTY_POOL_QUANTITY); // 下一班组 pool.execute(()-> { @@ -1614,7 +1585,7 @@ public class HydropowerServiceImpl implements HydropowerService { }); // 缺陷 pool.execute(()-> { - this.getDutyDefect(item,startDate,null); + this.getDutyDefect(item,startDate); countDownLatch.countDown(); }); // 巡检 @@ -1766,11 +1737,11 @@ public class HydropowerServiceImpl implements HydropowerService { /** * 获取当班缺陷数据 + * * @param item * @param startTime - * @param endTime */ - private void getDutyDefect(AppAreaDutyVo item, LocalDateTime startTime, LocalDateTime endTime) { + private void getDutyDefect(AppAreaDutyVo item, LocalDateTime startTime) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); wrapper.ge(OperPhenomenonEntity::getCreateTime,startTime); //wrapper.le(OperPhenomenonEntity::getCreateTime,endTime); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java index a6f4cf8..c51451f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java @@ -301,20 +301,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { * @return */ private List getLoadsByDay(EminfoAndEmParamVo device) { - // FIXME 当天功率测试数据 - Calendar start = Calendar.getInstance(); - start.add(Calendar.HOUR_OF_DAY,-start.get(Calendar.HOUR_OF_DAY)); - List list = new ArrayList<>(); - Random random = new Random(); - while (start.getTime().compareTo(new Date()) <= 0){ - PhotovoltaicPowerVo load = new PhotovoltaicPowerVo(); - load.setHour(start.get(Calendar.HOUR_OF_DAY)); - load.setActivePower(String.valueOf(random.nextDouble() * 500)); - list.add(load); - start.add(Calendar.HOUR_OF_DAY,1); - } - return list.stream().sorted(Comparator.comparing(PhotovoltaicPowerVo::getHour)).collect(Collectors.toList()); - /*String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; + String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); List records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD); if (CollectionUtil.isEmpty(records)) { @@ -326,7 +313,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { load.setHour(time.getHours()); load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); return load; - }).sorted(Comparator.comparing(PhotovoltaicPowerVo::getHour)).collect(Collectors.toList());*/ + }).sorted(Comparator.comparing(PhotovoltaicPowerVo::getHour)).collect(Collectors.toList()); } /** @@ -1347,20 +1334,6 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { * @return */ private List periodLoadDay(List stations) { - // FIXME 当天功率测试数据 - Calendar start = Calendar.getInstance(); - start.add(Calendar.HOUR_OF_DAY,-start.get(Calendar.HOUR_OF_DAY)); - List list = new ArrayList<>(); - Random random = new Random(); - while (start.getTime().compareTo(new Date()) <= 0){ - PhotovoltaicLoadGenerateVo load = new PhotovoltaicLoadGenerateVo(); - load.setPeriod(DateUtil.format(start.getTime(),"yyyy-mm-dd HH")); - load.setValue(random.nextFloat() * 500); - list.add(load); - start.add(Calendar.HOUR_OF_DAY,1); - } - return list; - /* // redis实时数据 List photovoltaics = (List) redisTemplate.opsForValue().get(load_photovoltaic_target_key); if(CollectionUtil.isEmpty(photovoltaics)){ @@ -1385,7 +1358,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { target.setPeriod(String.valueOf(time.getHour())); target.setValue((float) entry.getValue().stream().mapToDouble(o-> Double.parseDouble(String.valueOf(o.getVal()))).sum()); return target; - }).collect(Collectors.toList());*/ + }).collect(Collectors.toList()); } /** diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java index 13ceb92..198ad61 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java @@ -289,19 +289,7 @@ public class WaterServiceImpl implements IWaterService { * @return */ private Map getWaterLevelMap(String instanceCode, String signage) { - /** - * FIXME 水位测试数据 - */ - Calendar start = Calendar.getInstance(); - start.add(Calendar.HOUR_OF_DAY,-start.get(Calendar.HOUR_OF_DAY)); - Map map = new HashMap<>(); - Random random = new Random(); - while (start.getTime().compareTo(new Date()) <= 0){ - map.put(start.get(Calendar.HOUR_OF_DAY),String.valueOf(random.nextDouble() * 500)); - start.add(Calendar.HOUR_OF_DAY,1); - } - return map; - /*LocalDateTime beginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"), DateUtil.DATETIME_FORMATTER); + LocalDateTime beginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"), DateUtil.DATETIME_FORMATTER); LocalDateTime endTime = LocalDateTime.now(); AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); List signboardConditions = new ArrayList<>(); @@ -334,7 +322,7 @@ public class WaterServiceImpl implements IWaterService { return "0"; } return value.getVal(); - }));*/ + })); } /** From cd67694a99260d1cd1d7a08c9dce251bf75242e5 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 16 May 2023 18:22:07 +0800 Subject: [PATCH 3/3] =?UTF-8?q?#bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/main/service/impl/PhotovoltaicServiceImpl.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java index c51451f..9042377 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java @@ -350,11 +350,8 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { */ private List generateFill(List stations) { Calendar calendar = Calendar.getInstance(); - //String day = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); String mon = DateUtil.format(calendar.getTime(),"yyyy-MM"); String year = String.valueOf(calendar.get(Calendar.YEAR)); - //calendar.add(Calendar.DAY_OF_MONTH,-1); - //String yesterday = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); return stations.stream().map(station ->{ PhotovoltaicTargetVo target = new PhotovoltaicTargetVo(); target.setDeptId(station.getRefDept()); @@ -1344,10 +1341,11 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { if(CollectionUtil.isEmpty(devices)){ return new ArrayList<>(); } - String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); + Calendar calendar = Calendar.getInstance(); + String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; List list = new ArrayList<>(); for(PhotovoltaicTargetVo device : devices){ - list.addAll(analyseDataService.periodTargetData(start,end,1,2,device.getDeviceCode(),HomePageConstant.PV_LOAD)); + list.addAll(analyseDataService.periodTargetData(start,DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME),1,2,device.getDeviceCode(),HomePageConstant.PV_LOAD)); } if(CollectionUtil.isEmpty(list)){ return new ArrayList<>();