From f88a72178bb626bde4fbdec1689647098a84edc5 Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期四, 14 十二月 2023 10:51:28 +0800 Subject: [PATCH] 报警分析二级列表 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmTrendDto.java | 1 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEquipmentAlarmAnalyzeService.java | 10 +++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentAlarmAnalyzeServiceImpl.java | 39 ++++++++++++++++++- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentAlarmAnalyzeController.java | 11 +++++ 4 files changed, 58 insertions(+), 3 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentAlarmAnalyzeController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentAlarmAnalyzeController.java index e18ce6f..e2eff9b 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentAlarmAnalyzeController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentAlarmAnalyzeController.java @@ -8,6 +8,7 @@ import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.mdc.dto.MdcAlarmAnalyzeDto; +import org.jeecg.modules.mdc.dto.MdcAlarmListDto; import org.jeecg.modules.mdc.dto.MdcAlarmTrendDto; import org.jeecg.modules.mdc.service.MdcEquipmentAlarmAnalyzeService; import org.jeecg.modules.mdc.vo.MdcAlarmAnalyzeQueryVo; @@ -51,4 +52,14 @@ return Result.OK(result); } + @AutoLog(value = "鎶ヨ鍒嗘瀽-浜岀骇鍒楄〃") + @ApiOperation(value = "鎶ヨ鍒嗘瀽-浜岀骇鍒楄〃", notes = "鎶ヨ鍒嗘瀽-浜岀骇鍒楄〃") + @GetMapping("/equipmentAlarmList") + public Result equipmentAlarmList(MdcAlarmAnalyzeQueryVo vo) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + List<MdcAlarmListDto> result = mdcEquipmentAlarmAnalyzeService.equipmentAlarmList(userId, vo); + return Result.OK(result); + } + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmTrendDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmTrendDto.java index f78e5b3..6b5881f 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmTrendDto.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmTrendDto.java @@ -19,5 +19,4 @@ List<MdcAlarmDto> equipmentCountList; - List<MdcAlarmListDto> alarmList; } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEquipmentAlarmAnalyzeService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEquipmentAlarmAnalyzeService.java index f1272e2..d0b7fe0 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEquipmentAlarmAnalyzeService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEquipmentAlarmAnalyzeService.java @@ -1,6 +1,7 @@ package org.jeecg.modules.mdc.service; import org.jeecg.modules.mdc.dto.MdcAlarmAnalyzeDto; +import org.jeecg.modules.mdc.dto.MdcAlarmListDto; import org.jeecg.modules.mdc.dto.MdcAlarmTrendDto; import org.jeecg.modules.mdc.vo.MdcAlarmAnalyzeQueryVo; @@ -28,4 +29,13 @@ * @return */ MdcAlarmTrendDto alarmTrend(String userId, MdcAlarmAnalyzeQueryVo vo); + + /** + * 浜岀骇鍒楄〃 + * + * @param userId + * @param vo + * @return + */ + List<MdcAlarmListDto> equipmentAlarmList(String userId, MdcAlarmAnalyzeQueryVo vo); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentAlarmAnalyzeServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentAlarmAnalyzeServiceImpl.java index 08bc5a1..d0f0311 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentAlarmAnalyzeServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentAlarmAnalyzeServiceImpl.java @@ -121,8 +121,8 @@ List<MdcAlarmDto> equipmentCountList = new ArrayList<>(); String startDate = DateUtils.format(DateUtils.toDate(vo.getStartDate(), DateUtils.STRDATE), DateUtils.STR_DATE) + " 00:00:00"; String endDate = DateUtils.format(DateUtils.addDays(DateUtils.toDate(vo.getEndDate(), DateUtils.STRDATE), 1), DateUtils.STR_DATE) + " 00:00:00"; - List<MdcAlarmListDto> alarmList = mdcEquipmentRunningSectionService.selectAlarmList(vo, startDate, endDate); - result.setAlarmList(alarmList); + /*List<MdcAlarmListDto> alarmList = mdcEquipmentRunningSectionService.selectAlarmList(vo, startDate, endDate); + result.setAlarmList(alarmList);*/ for (String equipmentId : result.getEquipmentList()) { MdcAlarmDto mdcAlarmDto = new MdcAlarmDto(); mdcAlarmDto.setKey(equipmentId); @@ -153,4 +153,39 @@ result.setDateCountList(dateCountList); return result; } + + @Override + public List<MdcAlarmListDto> equipmentAlarmList(String userId, MdcAlarmAnalyzeQueryVo vo) { + List<String> equipmentIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(vo.getParentId()) && StringUtils.isEmpty(vo.getEquipmentId())) { + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, vo.getParentId()); + } else { + // 浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, vo.getParentId()); + } + } else if (StringUtils.isNotEmpty(vo.getEquipmentId())) { + // 鍗曞彴璁惧淇℃伅 + vo.setEquipmentIdList(Collections.singletonList(vo.getEquipmentId())); + } else { + // 鏌ヨ鐢ㄦ埛鎷ユ湁鐨勬墍鏈夎澶囦俊鎭� + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); + } else { + // 浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); + } + } + if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { + vo.setEquipmentIdList(equipmentIds); + } + if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { + return null; + } + String startDate = DateUtils.format(DateUtils.toDate(vo.getStartDate(), DateUtils.STRDATE), DateUtils.STR_DATE) + " 00:00:00"; + String endDate = DateUtils.format(DateUtils.addDays(DateUtils.toDate(vo.getEndDate(), DateUtils.STRDATE), 1), DateUtils.STR_DATE) + " 00:00:00"; + return mdcEquipmentRunningSectionService.selectAlarmList(vo, startDate, endDate); + } } -- Gitblit v1.9.3