Selaa lähdekoodia

修改消息下发通知接口

tags/v1.2.0^2
chengwang 1 vuosi sitten
vanhempi
commit
dbfbe5ed37
7 muutettua tiedostoa jossa 41 lisäystä ja 9 poistoa
  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 Näytä tiedosto

@@ -89,8 +89,8 @@ public class WarningController {
* @param id
* @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 Näytä tiedosto

@@ -72,4 +72,9 @@ public class Warning extends BaseEntity implements Serializable {
* 处理结果
*/
private String checkResult;

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

+ 25
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/enums/MessageReadEnum.java Näytä tiedosto

@@ -0,0 +1,25 @@
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 Näytä tiedosto

@@ -75,5 +75,5 @@ public interface IWarningService extends IBaseService<Warning> {
* @param id
* @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 Näytä tiedosto

@@ -104,8 +104,8 @@ public class WarningServiceImpl extends BaseServiceImpl<WarningMapper, Warning>
}

@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 Näytä tiedosto

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.domain.Warning;
import com.tuoheng.admin.enums.MarkTypeEnum;
import com.tuoheng.admin.enums.MessageReadEnum;
import com.tuoheng.admin.mapper.WarningMapper;
import com.tuoheng.common.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
@@ -25,14 +26,13 @@ public class WarningStatusService {
/**
* 通知忽略与处理
* @param id
* @param status
* @return
*/
public JsonResult editStatusById(Integer id,Integer status) {
public JsonResult editStatusById(Integer id) {
//根据id查询并更新预警状态
Warning warning = warningMapper.selectById(id);
if(ObjectUtils.isNotEmpty(warning)){
warning.setStatus(status);
warning.setMessageRead(MessageReadEnum.MESSAGE_IS_READ.getCode());
int result = warningMapper.updateById(warning);
if(result<=0){
return JsonResult.error();

+ 2
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/notice/WarningNoticeService.java Näytä tiedosto

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.domain.Warning;
import com.tuoheng.admin.enums.MarkTypeEnum;
import com.tuoheng.admin.enums.MessageReadEnum;
import com.tuoheng.admin.enums.WarningStatusEnum;
import com.tuoheng.admin.mapper.WarningMapper;
import com.tuoheng.common.utils.JsonResult;
@@ -40,6 +41,7 @@ public class WarningNoticeService {
List<Warning> warningList = warningMapper.selectList(Wrappers.<Warning>lambdaQuery()
.eq(Warning::getTenantId, tenantId)
.eq(Warning::getStatus, WarningStatusEnum.WAIT_CONFIRM.getCode())
.eq(Warning::getMessageRead, MessageReadEnum.MESSAGE_IS_NO_READ.getCode())
.eq(Warning::getMark, MarkTypeEnum.VALID.getCode()));
if(CollectionUtils.isEmpty(warningList) || warningList.size() == 0){
return JsonResult.success();

Loading…
Peruuta
Tallenna