From ad71a6a5a70f9a3f1d4104fa6030117d8823ac44 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 30 Aug 2023 21:11:43 +0800 Subject: [PATCH] =?UTF-8?q?#=E6=B5=81=E7=A8=8Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/scheduled/mapper/inspect/PlanMapper.java | 12 --- .../hzims/scheduled/mapper/inspect/TaskMapper.java | 4 +- .../scheduled/mapper/inspect/TaskPlanMapper.java | 12 +++ .../scheduled/service/inspect/PlanService.java | 12 --- .../scheduled/service/inspect/TaskPlanService.java | 12 +++ .../service/inspect/impl/ObjectServiceImpl.java | 3 + .../service/inspect/impl/PlanServiceImpl.java | 21 ----- .../service/inspect/impl/TaskPlanServiceImpl.java | 21 +++++ .../service/inspect/impl/TaskServiceImpl.java | 2 +- .../main/resources/mapper/inspect/PlanMapper.xml | 5 -- .../resources/mapper/inspect/TaskPlanMapper.xml | 5 ++ .../alert/controller/AbnormalAlarmController.java | 12 --- .../alert/service/HistoryAbnormalAlarmService.java | 2 - .../impl/HistoryAbnormalAlarmServiceImpl.java | 98 ++++++++-------------- 14 files changed, 92 insertions(+), 129 deletions(-) delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskPlanMapper.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskPlanService.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskPlanServiceImpl.java delete mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskPlanMapper.xml diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanMapper.java deleted file mode 100644 index e4a1c2d..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanMapper.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.hnac.hzims.scheduled.mapper.inspect; - -import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; - -/** - * @author ysj - */ -@Mapper -public interface PlanMapper extends UserDataScopeBaseMapper { -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskMapper.java index 1a4a34b..6cf873d 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskMapper.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskMapper.java @@ -1,13 +1,13 @@ package com.hnac.hzims.scheduled.mapper.inspect; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzinfo.inspect.task.entity.TaskEntity; import org.apache.ibatis.annotations.Mapper; -import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; /** * @author ysj */ @Mapper -public interface TaskMapper extends UserDataScopeBaseMapper { +public interface TaskMapper extends BaseMapper { } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskPlanMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskPlanMapper.java new file mode 100644 index 0000000..6faf295 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskPlanMapper.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ysj + */ +@Mapper +public interface TaskPlanMapper extends BaseMapper { +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanService.java deleted file mode 100644 index ac2b6aa..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanService.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.hnac.hzims.scheduled.service.inspect; - -import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; -import org.springblade.core.mp.base.BaseService; - -/** - * @author ysj - */ -public interface PlanService extends BaseService { - - -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskPlanService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskPlanService.java new file mode 100644 index 0000000..442f0bf --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskPlanService.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface TaskPlanService extends BaseService { + + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectServiceImpl.java index 4aa787a..c34fed9 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectServiceImpl.java @@ -10,6 +10,9 @@ import org.springblade.core.mp.base.BaseServiceImpl; import org.springframework.stereotype.Service; +/** + * @author ysj + */ @Service @Slf4j @AllArgsConstructor diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanServiceImpl.java deleted file mode 100644 index 4ac6701..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.hnac.hzims.scheduled.service.inspect.impl; - -import com.baomidou.dynamic.datasource.annotation.DS; -import com.hnac.hzims.scheduled.mapper.inspect.PlanMapper; -import com.hnac.hzims.scheduled.service.inspect.PlanService; -import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springframework.stereotype.Service; - -/** - * @author ysj - */ -@Service -@Slf4j -@AllArgsConstructor -@DS("inspect") -public class PlanServiceImpl extends BaseServiceImpl implements PlanService { - -} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskPlanServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskPlanServiceImpl.java new file mode 100644 index 0000000..9aaa84a --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskPlanServiceImpl.java @@ -0,0 +1,21 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.scheduled.mapper.inspect.TaskPlanMapper; +import com.hnac.hzims.scheduled.service.inspect.TaskPlanService; +import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class TaskPlanServiceImpl extends BaseServiceImpl implements TaskPlanService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java index 0bd0b13..8a47963 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java @@ -52,7 +52,7 @@ import java.util.stream.Collectors; @DS("inspect") public class TaskServiceImpl extends BaseServiceImpl implements TaskService { - private final PlanService planService; + private final TaskPlanService planService; private final ObjectService objectService; diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanMapper.xml deleted file mode 100644 index 09f72d8..0000000 --- a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskPlanMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskPlanMapper.xml new file mode 100644 index 0000000..adb3d05 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskPlanMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java index 7dcd02b..34e318e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java @@ -131,18 +131,6 @@ public class AbnormalAlarmController extends BladeController { } /** - * - */ - @ApiLog - @ApiOperation(value = "站点") - @ApiOperationSupport(order = 7) - @RequestMapping(value = "/stations", method = {RequestMethod.GET, RequestMethod.POST}) - public R stations(){ - service.stations(); - return R.status(true); - } - - /** * 智能告警数量: 时间范围当天 */ @ApiLog diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java index 7d41361..ca936c6 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java @@ -37,6 +37,4 @@ public interface HistoryAbnormalAlarmService extends BaseService alarmData(AlarmDataPageVo page,Query query); List queryStationName(); - - void stations(); } 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 61854ca..906fd0e 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 @@ -35,7 +35,6 @@ import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import java.lang.reflect.Field; @@ -60,8 +59,6 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl voList = historyAbnormalAlarmVos.parallelStream().peek(s -> s.setTimes((s.getEndTime().getTime() - s.getStartTime().getTime()))).collect(Collectors.toList()); //次数统计 Map timesList = voList.stream().collect(Collectors.groupingBy(HistoryAbnormalAlarmEntity::getStationName, - Collectors.counting())); + Collectors.counting())); //时间统计 Map durationList = voList.stream().collect(Collectors.groupingBy(HistoryAbnormalAlarmEntity::getStationName, - Collectors.summingLong(HistoryAbnormalAlarmVo::getTimes))); + Collectors.summingLong(HistoryAbnormalAlarmVo::getTimes))); List res = new ArrayList<>(); for (Map.Entry entry : durationList.entrySet()) { //累计时长 @@ -144,8 +141,8 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl page = Condition.getPage(query); page.setTotal(res.size()); if (entityIsNull(query)) { @@ -236,62 +233,44 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl handles = handleService.handles(types.stream().map(Long::parseLong).collect(Collectors.toList()),AbnormalAlarmConstant.SYSTEM_ALARM); + // 返回数据 AlarmReustVo response = new AlarmReustVo(); - if(types.size() > 1){ - response.setCount((int) result.getData().getTotal()); - response.setTotal(result.getData().getTotal()); - response.setSoeList(result.getData().getRecords().stream().map(alarm -> { - AlarmDataVo record = new AlarmDataVo(); - // 继承类属性拷贝 - BeanUtil.copyProperties(alarm, record); - record.setStationCode(alarm.getStation()); - record.setContent(alarm.getSoeExplain()); - record.setType(alarm.getSoeType()); - record.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(alarm.getSoeType())]); - record.setStationName((String) redisTemplate.opsForValue().get("alarm:station:" + alarm.getStation())); - record.setServeType("2"); - record.setAlarmType(AbnormalAlarmConstant.SYSTEM_ALARM); - return record; - }).sorted(Comparator.comparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList())); - }else{ - // 查询当天类型处理告警 - List handles = handleService.handles(types.stream().map(Long::parseLong).collect(Collectors.toList()),AbnormalAlarmConstant.SYSTEM_ALARM); - - List datas = result.getData().getRecords().stream().map(alarm -> { - AlarmDataVo record = new AlarmDataVo(); - // 继承类属性拷贝 - BeanUtil.copyProperties(alarm, record); - if(CollectionUtil.isEmpty(handles)){ - record.setIsHandle(false); - }else{ - record.setIsHandle(handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(String.valueOf(alarm.getId()))); - } - record.setStationCode(alarm.getStation()); - record.setContent(alarm.getSoeExplain()); - record.setType(alarm.getSoeType()); - record.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(alarm.getSoeType())]); - List filter = stations.stream().filter(station -> station.getCode().equals(alarm.getStation())).collect(Collectors.toList()); - if (CollectionUtil.isEmpty(filter)) { - return record; - } - record.setStationName(filter.get(0).getName()); - record.setServeType(filter.get(0).getServeType()); - record.setAlarmType(AbnormalAlarmConstant.SYSTEM_ALARM); + List datas = result.getData().getRecords().stream().map(alarm -> { + AlarmDataVo record = new AlarmDataVo(); + // 继承类属性拷贝 + BeanUtil.copyProperties(alarm, record); + if(CollectionUtil.isEmpty(handles)){ + record.setIsHandle(false); + }else{ + record.setIsHandle(handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(String.valueOf(alarm.getId()))); + } + record.setStationCode(alarm.getStation()); + record.setContent(alarm.getSoeExplain()); + record.setType(alarm.getSoeType()); + record.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(alarm.getSoeType())]); + List filter = stations.stream().filter(station -> station.getCode().equals(alarm.getStation())).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(filter)) { return record; - }).sorted(Comparator.comparing(AlarmDataVo::getIsHandle) - .thenComparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList()); - - response.setCount((int) (result.getData().getTotal() - handles.size())); - response.setSoeList(datas); - response.setTotal(result.getData().getTotal()); - } + } + record.setStationName(filter.get(0).getName()); + record.setServeType(filter.get(0).getServeType()); + record.setAlarmType(AbnormalAlarmConstant.SYSTEM_ALARM); + return record; + }).sorted(Comparator.comparing(AlarmDataVo::getIsHandle) + .thenComparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList()); + + response.setCount((int) (result.getData().getTotal() - handles.size())); + response.setSoeList(datas); + response.setTotal(result.getData().getTotal()); return response; } - /** * 获取处理数据ID集合 * @return @@ -397,8 +376,8 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl stations = stationService.list(); - stations.forEach(item-> redisTemplate.opsForValue().set("alarm:station:" + item.getCode(),item.getName())); - } private Boolean entityIsNull(Object object) {