diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AlarmHandleController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AlarmHandleController.java index bf3612e..e119cfb 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AlarmHandleController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AlarmHandleController.java @@ -3,22 +3,19 @@ package com.hnac.hzims.operational.alert.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity; import com.hnac.hzims.operational.alert.service.AlarmHandleService; import com.hnac.hzims.operational.alert.vo.AlarmHandleVo; import com.hnac.hzims.operational.alert.vo.HandleQueryVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; +import org.springblade.system.user.entity.User; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; +import java.util.List; /** * @author ysj @@ -35,14 +32,13 @@ public class AlarmHandleController extends BladeController { /** - * 详情 + * 告警处理:处理、延后、误报 */ - @GetMapping("/detail") + @PostMapping("/execute") @ApiOperationSupport(order = 1) - @ApiOperation(value = "详情", notes = "传入AlarmHandleEntity") - public R detail(AlarmHandleEntity entity) { - AlarmHandleEntity detail = service.getOne(Condition.getQueryWrapper(entity)); - return R.data(detail); + @ApiOperation(value = "告警处理", notes = "传入AlarmHandleEntity") + public R execute(@RequestBody AlarmHandleVo param) { + return R.status(service.execute(param)); } /** @@ -57,23 +53,13 @@ public class AlarmHandleController extends BladeController { } /** - * 告警处理:处理、延后、误报 + * 告警处理用户查询 */ - @PostMapping("/execute") + @GetMapping("/handleUser") @ApiOperationSupport(order = 3) - @ApiOperation(value = "告警处理", notes = "传入AlarmHandleEntity") - public R execute(@RequestBody AlarmHandleVo param) { - return R.status(service.execute(param)); + @ApiOperation(value = "告警通知人", notes = "告警通知人") + public R> handleUser() { + return R.data(service.handleUser()); } - - /** - * 删除 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 4) - @ApiOperation(value = "逻辑删除", notes = "传入ids") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(service.deleteLogic(Func.toLongList(ids))); - } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java index e5aa2ed..ecb5b88 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java @@ -6,6 +6,9 @@ import com.hnac.hzims.operational.alert.vo.AlarmHandleVo; import com.hnac.hzims.operational.alert.vo.HandleQueryVo; import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.support.Query; +import org.springblade.system.user.entity.User; + +import java.util.List; /** * @author ysj @@ -17,4 +20,6 @@ public interface AlarmHandleService extends BaseService { boolean execute(AlarmHandleVo param); IPage pageCondition(Query query, HandleQueryVo param); + + List handleUser(); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java index 950d2ad..270d564 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.operational.alert.constants.AbnormalAlarmConstant; import com.hnac.hzims.operational.alert.entity.AlarmHandleDetailEntity; import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity; -import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity; import com.hnac.hzims.operational.alert.mapper.AlarmHandleMapper; import com.hnac.hzims.operational.alert.service.AlarmHandleDetailService; import com.hnac.hzims.operational.alert.service.AlarmHandleService; @@ -16,9 +15,19 @@ import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.system.entity.Dept; +import org.springblade.system.feign.ISysClient; +import org.springblade.system.user.entity.User; +import org.springblade.system.user.feign.IUserClient; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + /** * @author ysj * @version 4.0.0 @@ -31,6 +40,10 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl pages = this.baseMapper.selectHandlePage(Condition.getPage(query), param); return pages; } + + /** + * 告警处理人 + * @return + */ + @Override + public List handleUser() { + R> result = sysClient.getDeptByCurrentUser(); + if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ + throw new ServiceException("查询告警处理人失败!"); + } + List users = new ArrayList<>(); + result.getData().forEach(dept->{ + users.addAll(userClient.userListByDeptId(dept.getId()).getData()); + }); + return users.stream().distinct().collect(Collectors.toList()); + } }