ソースを参照

notify 代码

tags/24080901
PoffyZhang 1年前
コミット
0d1bc87f6b
7個のファイルの変更162行の追加64行の削除
  1. +14
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/staging/enums/MsgTypeEnum.java
  2. +15
    -51
      pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NotifyController.java
  3. +41
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NotifyManage.java
  4. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NotifyMapper.xml
  5. +34
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NotifyListReq.java
  6. +53
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NotifyVO.java
  7. +4
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java

+ 14
- 8
pmapi/src/main/java/com/ningdatech/pmapi/staging/enums/MsgTypeEnum.java ファイルの表示

@@ -17,15 +17,21 @@ import java.util.Objects;
@NoArgsConstructor
public enum MsgTypeEnum {
/**
* 消息类型
* 消息类型 项目评审
*/
AUDIT(1, "项目审核(待审核)"),
PASS(2, "项目审核(通过)"),
REJECTED(3,"项目审核(被驳回)"),
BACKED(4,"项目审核(被退回)"),
WARING(5,"预警提醒"),
EXPORT_REVIEW(6,"专家评审"),
REVIEW_MEETING(7,"评审会议");
PROJECT_REVIEW,
/**
* 异常告警
*/
WARING,
/**
* 专家评审
*/
EXPERT_REVIEW,
/**
* 专家会议
*/
REVIEW_MEETING;

private Integer code;
private String desc;


+ 15
- 51
pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NotifyController.java ファイルの表示

@@ -1,21 +1,14 @@
package com.ningdatech.pmapi.sys.controller;

import com.ningdatech.basic.model.IdVo;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.sys.manage.NoticeManage;
import com.ningdatech.pmapi.sys.model.req.NoticeListReq;
import com.ningdatech.pmapi.sys.model.req.NoticeSaveReq;
import com.ningdatech.pmapi.sys.model.req.NoticeStatusModifyReq;
import com.ningdatech.pmapi.sys.model.vo.NoticeDetailVO;
import com.ningdatech.pmapi.sys.model.vo.NoticeListItemVO;
import com.ningdatech.pmapi.sys.manage.NotifyManage;
import com.ningdatech.pmapi.sys.model.req.NotifyListReq;
import com.ningdatech.pmapi.sys.model.vo.NotifyVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
* <p>
* 通知消息 前端控制器
@@ -30,53 +23,24 @@ import javax.validation.Valid;
@RequestMapping("/api/v1/notify")
public class NotifyController {

private final NoticeManage noticeManage;
private final NotifyManage notifyManage;

@PostMapping("/save")
@ApiOperation("新增公告")
@WebLog("新增公告")
public IdVo<Long> save(@Valid @RequestBody NoticeSaveReq req) {
return noticeManage.saveOrModify(req);
@GetMapping("/list")
@ApiOperation("通知列表")
public PageVo<NotifyVO> page(@ModelAttribute NotifyListReq notifyListReq){
return notifyManage.page(notifyListReq);
}

@GetMapping("/detail/{id}")
@ApiOperation("公告详情")
public NoticeDetailVO save(@PathVariable Long id) {
return noticeManage.detail(id);
}

@PostMapping("/enabled")
@ApiOperation("启用/禁用")
@WebLog("启用/禁用")
public Boolean save(@Valid @RequestBody NoticeStatusModifyReq req) {
return noticeManage.changeEnabled(req);
}

@PostMapping("/topped")
@ApiOperation("置顶")
@WebLog("置顶")
public void topped(@RequestBody IdVo<Long> id) {
noticeManage.topped(id.getId());
}

@GetMapping("/dashboard/list")
@ApiOperation("工作台公告列表")
public PageVo<NoticeListItemVO> dashboardList(@RequestParam(required = false, defaultValue = "3") Integer limit,
@RequestParam(required = false) Integer type) {
return noticeManage.dashboardList(limit, type);
}

@GetMapping("/manage/list")
@ApiOperation("公告管理列表")
public PageVo<NoticeListItemVO> listByManager(NoticeListReq req) {
return noticeManage.listByManager(req);
@ApiOperation("通知详情")
public NotifyVO save(@PathVariable Long id) {
return notifyManage.detail(id);
}

@DeleteMapping("/del")
@ApiOperation("删除公告")
@WebLog("删除公告")
public void delNotice(@RequestBody IdVo<Long> req) {
noticeManage.delNotice(req.getId());
@PostMapping("/read/{id}")
@ApiOperation("已读")
public Boolean read(@PathVariable Long id) {
return notifyManage.read(id);
}

}

+ 41
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NotifyManage.java ファイルの表示

@@ -1,9 +1,22 @@
package com.ningdatech.pmapi.sys.manage;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.sys.model.entity.Notify;
import com.ningdatech.pmapi.sys.model.req.NotifyListReq;
import com.ningdatech.pmapi.sys.model.vo.NotifyVO;
import com.ningdatech.pmapi.sys.service.INotifyService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* <p>
* NotifyManage
@@ -18,4 +31,32 @@ public class NotifyManage {

private final INotifyService notifyService;

public PageVo<NotifyVO> page(NotifyListReq notifyListReq) {
Page<Notify> page = notifyListReq.page();
LambdaQueryWrapper<Notify> wrapper = Wrappers.lambdaQuery(Notify.class)
.eq(Objects.nonNull(notifyListReq.getReaded()), Notify::getReaded, notifyListReq.getReaded())
.eq(Objects.nonNull(notifyListReq.getUserId()), Notify::getUserId, notifyListReq.getUserId())
.like(Objects.nonNull(notifyListReq.getTitle()), Notify::getTitle, notifyListReq.getTitle())
.eq(Objects.nonNull(notifyListReq.getType()), Notify::getType, notifyListReq.getType());
notifyService.page(page,wrapper);
if(page.getTotal() == 0L){
return PageVo.empty();
}
List<NotifyVO> list = page.getRecords().stream()
.map(n -> BeanUtil.copyProperties(n,NotifyVO.class))
.collect(Collectors.toList());
return PageVo.of(list,page.getTotal());
}

public NotifyVO detail(Long id) {
Notify one = notifyService.getById(id);
return BeanUtil.copyProperties(one,NotifyVO.class);
}

public Boolean read(Long id) {
Notify one = notifyService.getById(id);
VUtils.isTrue(Objects.isNull(one)).throwMessage("该通知不存在");
one.setReaded(Boolean.TRUE);
return notifyService.updateById(one);
}
}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NotifyMapper.xml ファイルの表示

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.pmapi.sys.mapper.NotifyMapperr">
<mapper namespace="com.ningdatech.pmapi.sys.mapper.NotifyMapper">

</mapper>

+ 34
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NotifyListReq.java ファイルの表示

@@ -0,0 +1,34 @@
package com.ningdatech.pmapi.sys.model.req;

import com.ningdatech.basic.model.PagePo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
* <p>
* NoticeListReq
* </p>
*
* @author zpf
* @since 00:32 2023/3/23
*/
@Data
@ApiModel("通知查询参数类")
@EqualsAndHashCode(callSuper = true)
public class NotifyListReq extends PagePo {

@ApiModelProperty("用户ID")
private Integer userId;

@ApiModelProperty("是否已读")
private Boolean readed;

@ApiModelProperty("公告标题")
private String title;

@ApiModelProperty("类型")
private String type;

}

+ 53
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NotifyVO.java ファイルの表示

@@ -0,0 +1,53 @@
package com.ningdatech.pmapi.sys.model.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 通知
* </p>
*
* @author zpf
* @since 2023-03-21
*/
@Data
@ApiModel(value = "消息通知VO", description = "消息通知")
public class NotifyVO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("ID")
@TableId(type = IdType.AUTO)
private Long id;

@ApiModelProperty("消息类型")
private String type;

@ApiModelProperty("标题")
private String title;

@ApiModelProperty("内容")
private String content;

@ApiModelProperty("实例id")
private String instanceId;

@ApiModelProperty("是否已读")
private Boolean readed;

@ApiModelProperty("用户ID")
private Long userId;

@ApiModelProperty("link")
private String link;

@ApiModelProperty("创建时间")
private LocalDateTime createTime;

}

+ 4
- 4
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java ファイルの表示

@@ -371,7 +371,7 @@ public class TodoCenterManage {
String passMsg2 = String.format(PASS_MSG_TEMPLATE2, projectName, processDefinitionName);
passWorkNoticeInfo2.setMsg(passMsg2);
// 放入工作通知暂存表中,通过扫表异步发送
workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo2, MsgTypeEnum.PASS);
workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo2, MsgTypeEnum.PROJECT_REVIEW);
} else {
// 若有下一个审核人(当前节点的用户),
// 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。
@@ -383,7 +383,7 @@ public class TodoCenterManage {
String msg = String.format(PASS_MSG_TEMPLATE, sendWorkNoticeInfo.getOrganizationName(), projectName);
sendWorkNoticeInfo.setMsg(msg);
// 放入工作通知暂存表中,通过扫表异步发送
workNoticeStagingService.addByWorkNotice(sendWorkNoticeInfo, MsgTypeEnum.AUDIT);
workNoticeStagingService.addByWorkNotice(sendWorkNoticeInfo, MsgTypeEnum.PROJECT_REVIEW);
}
break;
// 驳回
@@ -398,7 +398,7 @@ public class TodoCenterManage {
String rejectMsg = String.format(REJECT_MSG_TEMPLATE, projectName, processDefinitionName);
rejectWorkNoticeInfo.setMsg(rejectMsg);
// 放入工作通知暂存表中,通过扫表异步发送
workNoticeStagingService.addByWorkNotice(rejectWorkNoticeInfo, MsgTypeEnum.REJECTED);
workNoticeStagingService.addByWorkNotice(rejectWorkNoticeInfo, MsgTypeEnum.PROJECT_REVIEW);
break;
// 退回
case BACK:
@@ -410,7 +410,7 @@ public class TodoCenterManage {
String backMsg = String.format(BACK_MSG_TEMPLATE, projectName, processDefinitionName);
backWorkNoticeInfo.setMsg(backMsg);
// 放入工作通知暂存表中,通过扫表异步发送
workNoticeStagingService.addByWorkNotice(backWorkNoticeInfo, MsgTypeEnum.BACKED);
workNoticeStagingService.addByWorkNotice(backWorkNoticeInfo, MsgTypeEnum.PROJECT_REVIEW);
break;
// 撤回(流程发起人和当前流程审核人的前一个审核人操作)
case WITHDRAW:


読み込み中…
キャンセル
保存