* @param id | * @param id | ||||
* @return | * @return | ||||
*/ | */ | ||||
@PutMapping("/status/{id}/{status}") | |||||
public JsonResult editStatusById(@PathVariable("id") Integer id,@PathVariable("status") Integer status){ | |||||
return warningService.editStatusById(id,status); | |||||
@PutMapping("/messageRead/{id}") | |||||
public JsonResult editStatusById(@PathVariable("id") Integer id){ | |||||
return warningService.editStatusById(id); | |||||
} | } | ||||
} | } |
* 处理结果 | * 处理结果 | ||||
*/ | */ | ||||
private String checkResult; | private String checkResult; | ||||
/** | |||||
* 消息读取标识 0:未读 1已读 | |||||
*/ | |||||
private Integer messageRead; | |||||
} | } |
package com.tuoheng.admin.enums; | |||||
import lombok.Getter; | |||||
/** | |||||
* @Author ChengWang | |||||
* @Date 2023/3/3 | |||||
*/ | |||||
public enum MessageReadEnum { | |||||
MESSAGE_IS_READ(1,"已读"), | |||||
MESSAGE_IS_NO_READ(0,"未读"); | |||||
MessageReadEnum(int code, String description){ | |||||
this.code = code; | |||||
this.description = description; | |||||
} | |||||
@Getter | |||||
private int code; | |||||
@Getter | |||||
private String description; | |||||
} |
* @param id | * @param id | ||||
* @return | * @return | ||||
*/ | */ | ||||
JsonResult editStatusById(Integer id,Integer status); | |||||
JsonResult editStatusById(Integer id); | |||||
} | } |
} | } | ||||
@Override | @Override | ||||
public JsonResult editStatusById(Integer id,Integer status) { | |||||
return warningStatusService.editStatusById(id,status); | |||||
public JsonResult editStatusById(Integer id) { | |||||
return warningStatusService.editStatusById(id); | |||||
} | } | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.tuoheng.admin.entity.domain.Warning; | import com.tuoheng.admin.entity.domain.Warning; | ||||
import com.tuoheng.admin.enums.MarkTypeEnum; | import com.tuoheng.admin.enums.MarkTypeEnum; | ||||
import com.tuoheng.admin.enums.MessageReadEnum; | |||||
import com.tuoheng.admin.mapper.WarningMapper; | import com.tuoheng.admin.mapper.WarningMapper; | ||||
import com.tuoheng.common.utils.JsonResult; | import com.tuoheng.common.utils.JsonResult; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
/** | /** | ||||
* 通知忽略与处理 | * 通知忽略与处理 | ||||
* @param id | * @param id | ||||
* @param status | |||||
* @return | * @return | ||||
*/ | */ | ||||
public JsonResult editStatusById(Integer id,Integer status) { | |||||
public JsonResult editStatusById(Integer id) { | |||||
//根据id查询并更新预警状态 | //根据id查询并更新预警状态 | ||||
Warning warning = warningMapper.selectById(id); | Warning warning = warningMapper.selectById(id); | ||||
if(ObjectUtils.isNotEmpty(warning)){ | if(ObjectUtils.isNotEmpty(warning)){ | ||||
warning.setStatus(status); | |||||
warning.setMessageRead(MessageReadEnum.MESSAGE_IS_READ.getCode()); | |||||
int result = warningMapper.updateById(warning); | int result = warningMapper.updateById(warning); | ||||
if(result<=0){ | if(result<=0){ | ||||
return JsonResult.error(); | return JsonResult.error(); |
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.tuoheng.admin.entity.domain.Warning; | import com.tuoheng.admin.entity.domain.Warning; | ||||
import com.tuoheng.admin.enums.MarkTypeEnum; | import com.tuoheng.admin.enums.MarkTypeEnum; | ||||
import com.tuoheng.admin.enums.MessageReadEnum; | |||||
import com.tuoheng.admin.enums.WarningStatusEnum; | import com.tuoheng.admin.enums.WarningStatusEnum; | ||||
import com.tuoheng.admin.mapper.WarningMapper; | import com.tuoheng.admin.mapper.WarningMapper; | ||||
import com.tuoheng.common.utils.JsonResult; | import com.tuoheng.common.utils.JsonResult; | ||||
List<Warning> warningList = warningMapper.selectList(Wrappers.<Warning>lambdaQuery() | List<Warning> warningList = warningMapper.selectList(Wrappers.<Warning>lambdaQuery() | ||||
.eq(Warning::getTenantId, tenantId) | .eq(Warning::getTenantId, tenantId) | ||||
.eq(Warning::getStatus, WarningStatusEnum.WAIT_CONFIRM.getCode()) | .eq(Warning::getStatus, WarningStatusEnum.WAIT_CONFIRM.getCode()) | ||||
.eq(Warning::getMessageRead, MessageReadEnum.MESSAGE_IS_NO_READ.getCode()) | |||||
.eq(Warning::getMark, MarkTypeEnum.VALID.getCode())); | .eq(Warning::getMark, MarkTypeEnum.VALID.getCode())); | ||||
if(CollectionUtils.isEmpty(warningList) || warningList.size() == 0){ | if(CollectionUtils.isEmpty(warningList) || warningList.size() == 0){ | ||||
return JsonResult.success(); | return JsonResult.success(); |