diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowConfig.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowConfig.java index 7577891..fa9c58a 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowConfig.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowConfig.java @@ -54,7 +54,7 @@ public class FlowConfig { Action countersignAction = Action.of(ActionEnum.countersign.getValue(), "发起会签", "primary", false, "发起会签"); - Action submitCountersignAction = Action.of("submitCountersign", "提交会签", "primary", false, "提交会签"); + Action submitCountersignAction = Action.of("submitCountersign", "提交会签", "primary", false, "提交会签意见"); Action applyExtensionSubmitAction = Action.of("applyExtensionSubmit", "申请延期", "primary", true, "申请延期"); diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/CountersignFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/CountersignFlow.java index 3437753..6706d5f 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/CountersignFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/CountersignFlow.java @@ -2,8 +2,10 @@ package com.biutag.lan.flow.node; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.*; +import com.biutag.lan.enums.WorkType; import com.biutag.lan.flow.Flow; import com.biutag.lan.service.*; import lombok.RequiredArgsConstructor; @@ -13,6 +15,7 @@ import org.springframework.util.Assert; import java.time.LocalDateTime; import java.util.Comparator; import java.util.List; +import java.util.Objects; import java.util.Optional; @RequiredArgsConstructor @@ -29,6 +32,8 @@ public class CountersignFlow extends Flow { private final FlowNodeService flowNodeService; + private final NoticeService noticeService; + @Override public Flow next(String nextActionKey, String mailId, JSONObject data) { String comments = data.getString("comments"); @@ -37,7 +42,7 @@ public class CountersignFlow extends Flow { LocalDateTime now = LocalDateTime.now(); List list = mailCountersignService.list(mailId); int count = Long.valueOf(list.stream().filter(item -> StrUtil.isNotBlank(item.getComments())).count()).intValue(); - MailCountersign mailCountersign = list.stream().filter(item -> item.getDeptId().equals(deptId)).findFirst().get(); + MailCountersign mailCountersign = list.stream().filter(item -> Objects.isNull(item.getComments()) && item.getDeptId().equals(deptId)).findFirst().get(); mailCountersign.setComments(comments); mailCountersign.setAttachments(Optional.ofNullable(data.getJSONArray("attachments")).map(item -> item.toJSONString()).orElse("[]")); mailCountersign.setHandlerEmpNo(AdminThreadLocal.getEmpNo()); @@ -49,6 +54,9 @@ public class CountersignFlow extends Flow { workService.updateById(work); Mail mail = mailService.getById(mailId); mail.setCountersignCompleted(count + 1).setUpdateTime(now); + // 通知发起会签人 + Work initiateCountersignWork = workService.getOne(new LambdaQueryWrapper().eq(Work::getMailId, mailId).eq(Work::getWorkState, Work.State.todo.name()).eq(Work::getWorkType, WorkType.processing.name()).eq(Work::getMainDeptFlag, true)); + noticeService.sendNoticeDoneByWork(initiateCountersignWork); if (mail.getCountersignCompleted() < mail.getCountersignTotal()) { mailService.updateById(mail); return null; @@ -62,4 +70,5 @@ public class CountersignFlow extends Flow { mailService.updateById(mail); return null; } + } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/NoticeService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/NoticeService.java index db3c1fc..2dcf449 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/NoticeService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/NoticeService.java @@ -32,7 +32,6 @@ public class NoticeService extends ServiceImpl { private final SimpMessagingTemplate messagingTemplate; - public void save(Integer roleId, Integer deptId, String content, Integer workId) { Notice notice = new Notice().setRoleId(roleId).setDeptId(deptId).setContent(content).setCreateTime(LocalDateTime.now()).setReadFlag(AppConstants.N).setWorkId(workId); save(notice); @@ -40,7 +39,6 @@ public class NoticeService extends ServiceImpl { log.info("发送通知:{}", String.format("/topic/role/%s/%s", roleId, deptId)); } - public void save(String empNo, String content, Integer workId) { Notice notice = new Notice().setEmpNo(empNo).setContent(content).setCreateTime(LocalDateTime.now()).setReadFlag(AppConstants.N).setWorkId(workId); save(notice); @@ -48,6 +46,15 @@ public class NoticeService extends ServiceImpl { log.info("发送通知:{}", String.format("/topic/user/%s", empNo)); } + public void sendNoticeDoneByWork(Work work) { + if (Objects.nonNull(work.getSignRoleId())) { + log.info("发送通知:{}", String.format("/topic/role/%s/%s", work.getSignRoleId(), work.getSignDeptId())); + messagingTemplate.convertAndSend(String.format("/topic/role/%s/%s", work.getSignRoleId(), work.getSignDeptId()), Work.State.todo.name()); + } else { + log.info("发送通知:{}", String.format("/topic/user/%s", work.getPoliceEmpNo())); + messagingTemplate.convertAndSend(String.format("/topic/user/%s", work.getPoliceEmpNo()), Work.State.todo.name()); + } + } public void sendNoticeDoneByRole() { Integer roleId = AdminThreadLocal.getRoleId(); diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java index 5062364..83a5caa 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java @@ -77,7 +77,6 @@ public class WorkService extends ServiceImpl { private final MailMarkService mailMarkService; - public boolean saveBatch(List mailSources) { LocalDateTime now = LocalDateTime.now(); List list = mailSources.stream().map(mail -> { @@ -480,7 +479,11 @@ public class WorkService extends ServiceImpl { .le("mm.completion_time", mailQuery.getCompletionTime().get(1)); } // 申诉状态 - queryWrapper.eq(StrUtil.isNotBlank(mailQuery.getAppealState()), "ma.appeal_state", mailQuery.getAppealState()); + if (AppealState.UN_APPEAL.getValue().equals(mailQuery.getAppealState())) { + queryWrapper.eq("mm.satisfied", AppConstants.FALSE).isNull("ma.appeal_state"); + } else { + queryWrapper.eq(StrUtil.isNotBlank(mailQuery.getAppealState()), "ma.appeal_state", mailQuery.getAppealState()); + } // 排序 queryWrapper.orderByDesc("m.mail_time");