评议审批加消息通知

This commit is contained in:
周源 2022-05-18 16:50:45 +08:00
parent ae0241666d
commit 4ce99ca39a
3 changed files with 42 additions and 8 deletions

View File

@ -43,6 +43,8 @@ public class Message extends BaseEntity {
public static final Integer TYPE_ACTIVITY_PASS = 10;
//所有人的通知公告
public static final Integer TYPE_NOTICE = 11;
//通知评议审核
public static final Integer TYPE_REVIEW = 12;
//未读
public static final Integer STATUS_UNREAD = 0;
@ -74,7 +76,7 @@ public class Message extends BaseEntity {
/**
* 消息类型
*/
@ApiModelProperty(value = "消息类型 1通知文件轮阅 2通知会议 3通知督事 4通知文件审批 5选民建议 6联系人大 7乡镇选民建议 8活动审核 9活动拒绝 10活动通过 11所有人的通知公告")
@ApiModelProperty(value = "消息类型 1通知文件轮阅 2通知会议 3通知督事 4通知文件审批 5选民建议 6联系人大 7乡镇选民建议 8活动审核 9活动拒绝 10活动通过 11所有人的通知公告 12通知评议审核")
private Integer type;
/**

View File

@ -3,6 +3,8 @@ package com.ydool.boot.modules.rddb.entity.bo;
import com.ydool.boot.modules.rddb.entity.Review;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* <p>
* 上报
@ -18,6 +20,7 @@ public class ReviewBo extends Review {
String opinionAttachmentArrStr;
String resultAttachmentArrStr;
@NotBlank(message = "请选择审批人员")
String inReportAudit1Ids;
String inReportAudit2Ids;
String checkUserIds;

View File

@ -1,6 +1,7 @@
package com.ydool.boot.modules.rddb.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
@ -21,6 +22,7 @@ import com.ydool.boot.modules.rddb.mapper.ReviewMapper;
import com.ydool.boot.modules.rddb.wrapper.ReviewWrapper;
import com.ydool.boot.modules.sys.entity.User;
import com.ydool.boot.modules.sys.service.UserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -52,6 +54,8 @@ public class ReviewService extends BaseService<ReviewMapper, Review> {
ReviewUserService reviewUserService;
@Autowired
UserService userService;
@Autowired
MessageService messageService;
/*后台*/
@Transactional
@ -69,6 +73,7 @@ public class ReviewService extends BaseService<ReviewMapper, Review> {
@Transactional
public Ret adminSaveOrUpdate(ReviewBo reviewBo, User loginUser) {
Boolean isNew = false;
Review review = BeanUtil.copyProperties(reviewBo, Review.class);
if (StrUtil.isNotBlank(review.getId())) {
review.setUpdatedId(loginUser.getId());
@ -76,6 +81,7 @@ public class ReviewService extends BaseService<ReviewMapper, Review> {
review.setState(Review.STATE_IN_REPORT);
review.setStatus(0);
review.setCreatedId(loginUser.getId());
isNew = true;
}
saveOrUpdate(review);
reviewBo.setId(review.getId());
@ -93,9 +99,28 @@ public class ReviewService extends BaseService<ReviewMapper, Review> {
saveReviewAttachment(reviewBo.getId(), reviewBo.getCheckAttachmentArrStr(), loginUser, Review.STATE_CHECK);
saveReviewAttachment(reviewBo.getId(), reviewBo.getOpinionAttachmentArrStr(), loginUser, Review.STATE_OPINION);
saveReviewAttachment(reviewBo.getId(), reviewBo.getResultAttachmentArrStr(), loginUser, Review.STATE_RESULT);
if (isNew) {
sendMsg(review, loginUser, reviewBo.getInReportAudit1Ids().split(",")[0]);
}
return Ret.ok();
}
private void sendMsg(Review review, User loginUser, String userId) {
//一个人一个人审核当手机端有通过操作时找到下一个人发消息
if (StringUtils.isNotBlank(userId)) {
Message message = new Message();
message.setActionId(review.getId());
message.setTitle("您有一个评议需审批,请前往查看!");
message.setContent(review.getReviewSubject());
message.setType(Message.TYPE_REVIEW);
message.setCreatedId(loginUser != null ? loginUser.getId() : "");
message.setStatus(Message.STATUS_UNREAD);
message.setUserId(userId);
messageService.save(message);
}
}
/*接口*/
public Ret comment(ReviewCommentRequest reviewCommentRequest, User loginUser) {
@ -152,15 +177,19 @@ public class ReviewService extends BaseService<ReviewMapper, Review> {
saveOrUpdate(review);
}
//如果没有待审批的,进入下一阶段
int waitAuditCount = reviewAuditService.count(new LambdaQueryWrapper<ReviewAudit>()
List<ReviewAudit> waitAuditList = reviewAuditService.list(new LambdaQueryWrapper<ReviewAudit>()
.eq(ReviewAudit::getReviewId, reviewAuditRequest.getReviewId())
.eq(ReviewAudit::getStatus, 0));
if (waitAuditCount == 0) {
.eq(ReviewAudit::getStatus, 0)
.orderByAsc(ReviewAudit::getSortNo));
if (CollectionUtil.isEmpty(waitAuditList)) {
review.setStatus(1);
// review.setState(Review.STATE_REPORT); 直接跳过
// review.setState(Review.STATE_ASK); 直接跳过
review.setState(Review.STATE_CHECK);
saveOrUpdate(review);
} else {
ReviewAudit nextReviewAudit = waitAuditList.get(0);
sendMsg(review, null, nextReviewAudit.getUserId());
}
return !flag ? Ret.fail("操作失败") : Ret.ok();
}