修改预警通知相关接口

This commit is contained in:
lxd 2025-06-17 17:20:19 +08:00
parent 0c4818bec2
commit 1b68e6538e
4 changed files with 21 additions and 6 deletions

View File

@ -60,7 +60,11 @@ public class AlertMessageController {
alertMessageService.deleteAlertMessage(id); alertMessageService.deleteAlertMessage(id);
return success(true); return success(true);
} }
@GetMapping("/getAlerMsgList")
@Operation(summary = "获得预警信息")
public CommonResult<List<AlertMessageDO>> getAlertMessageList(@RequestParam("deptid") Integer deptid) {
return success(alertMessageService.getAlertMessageList(deptid));
}
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得预警信息") @Operation(summary = "获得预警信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")

View File

@ -16,14 +16,12 @@ public class AlertMessageSaveReqVO {
private Integer id; private Integer id;
@Schema(description = "预警类型1 SOS/ 2 分析预警", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") @Schema(description = "预警类型1 SOS/ 2 分析预警", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "预警类型1 SOS/ 2 分析预警不能为空")
private Integer alerttype; private Integer alerttype;
@Schema(description = "预警内容") @Schema(description = "预警内容")
private String content; private String content;
@Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20700") @Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20700")
@NotNull(message = "用户ID不能为空")
private Integer userid; private Integer userid;
@Schema(description = "状态0-未读 1-已读", example = "1") @Schema(description = "状态0-未读 1-已读", example = "1")

View File

@ -29,6 +29,10 @@ public interface AlertMessageService {
* @param updateReqVO 更新信息 * @param updateReqVO 更新信息
*/ */
void updateAlertMessage(@Valid AlertMessageSaveReqVO updateReqVO); void updateAlertMessage(@Valid AlertMessageSaveReqVO updateReqVO);
/*
* 根据机构ID查询所有未读预警信息
* */
List<AlertMessageDO> getAlertMessageList(Integer deptid);
/** /**
* 删除预警信息 * 删除预警信息

View File

@ -1,14 +1,13 @@
package cn.iocoder.yudao.module.system.service.alertmessage; package cn.iocoder.yudao.module.system.service.alertmessage;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.*;
import cn.iocoder.yudao.module.system.controller.admin.alertmessage.vo.*; import cn.iocoder.yudao.module.system.controller.admin.alertmessage.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.alertmessage.AlertMessageDO; import cn.iocoder.yudao.module.system.dal.dataobject.alertmessage.AlertMessageDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.dal.mysql.alertmessage.AlertMessageMapper; import cn.iocoder.yudao.module.system.dal.mysql.alertmessage.AlertMessageMapper;
@ -16,7 +15,6 @@ import cn.iocoder.yudao.module.system.dal.mysql.alertmessage.AlertMessageMapper;
import javax.annotation.Resource; import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
/** /**
* 预警信息 Service 实现类 * 预警信息 Service 实现类
@ -47,7 +45,18 @@ public class AlertMessageServiceImpl implements AlertMessageService {
AlertMessageDO updateObj = BeanUtils.toBean(updateReqVO, AlertMessageDO.class); AlertMessageDO updateObj = BeanUtils.toBean(updateReqVO, AlertMessageDO.class);
alertMessageMapper.updateById(updateObj); alertMessageMapper.updateById(updateObj);
} }
@Override
public List<AlertMessageDO> getAlertMessageList(Integer deptid) {
// 创建 LambdaQueryWrapper 实例
LambdaQueryWrapper<AlertMessageDO> queryWrapper = new LambdaQueryWrapper<>();
// 添加查询条件
queryWrapper.eq(AlertMessageDO::getOrgid, deptid)
.eq(AlertMessageDO::getStatus, 0); // status = 0
// 执行查询
return alertMessageMapper.selectList(queryWrapper);
}
@Override @Override
public void deleteAlertMessage(Integer id) { public void deleteAlertMessage(Integer id) {
// 校验存在 // 校验存在