Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
H.X 2 years ago
parent
commit
582be61f30
  1. 38
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AlarmHandleController.java
  2. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java
  3. 32
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java

38
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<AlarmHandleEntity> 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<List<User>> 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)));
}
}

5
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<AlarmHandleEntity> {
boolean execute(AlarmHandleVo param);
IPage<AlarmHandleVo> pageCondition(Query query, HandleQueryVo param);
List<User> handleUser();
}

32
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<AlarmHandleMapper, A
private final AlarmHandleDetailService detailService;
private final IUserClient userClient;
private final ISysClient sysClient;
/**
* 告警处理
*
@ -63,4 +76,21 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl<AlarmHandleMapper, A
IPage<AlarmHandleVo> pages = this.baseMapper.selectHandlePage(Condition.getPage(query), param);
return pages;
}
/**
* 告警处理人
* @return
*/
@Override
public List<User> handleUser() {
R<List<Dept>> result = sysClient.getDeptByCurrentUser();
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
throw new ServiceException("查询告警处理人失败!");
}
List<User> users = new ArrayList<>();
result.getData().forEach(dept->{
users.addAll(userClient.userListByDeptId(dept.getId()).getData());
});
return users.stream().distinct().collect(Collectors.toList());
}
}

Loading…
Cancel
Save