Browse Source

修改消息下发通知接口

tags/v1.2.0^2
chengwang 1 year ago
parent
commit
dbfbe5ed37
7 changed files with 41 additions and 9 deletions
  1. +3
    -3
      tuoheng-admin/src/main/java/com/tuoheng/admin/controller/WarningController.java
  2. +5
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/Warning.java
  3. +25
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/enums/MessageReadEnum.java
  4. +1
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/IWarningService.java
  5. +2
    -2
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/WarningServiceImpl.java
  6. +3
    -3
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/edit/WarningStatusService.java
  7. +2
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/notice/WarningNoticeService.java

+ 3
- 3
tuoheng-admin/src/main/java/com/tuoheng/admin/controller/WarningController.java View File

* @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);
} }
} }

+ 5
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/Warning.java View File

* 处理结果 * 处理结果
*/ */
private String checkResult; private String checkResult;

/**
* 消息读取标识 0:未读 1已读
*/
private Integer messageRead;
} }

+ 25
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/enums/MessageReadEnum.java View File

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;

}

+ 1
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/IWarningService.java View File

* @param id * @param id
* @return * @return
*/ */
JsonResult editStatusById(Integer id,Integer status);
JsonResult editStatusById(Integer id);
} }

+ 2
- 2
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/WarningServiceImpl.java View File

} }


@Override @Override
public JsonResult editStatusById(Integer id,Integer status) {
return warningStatusService.editStatusById(id,status);
public JsonResult editStatusById(Integer id) {
return warningStatusService.editStatusById(id);
} }





+ 3
- 3
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/edit/WarningStatusService.java View File

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();

+ 2
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/notice/WarningNoticeService.java View File

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();

Loading…
Cancel
Save