Browse Source

信件主流程

dev_ycq
wxc 2 years ago
parent
commit
3efdf0d263
  1. 6
      mailbox-lan/src/main/java/com/biutag/lan/domain/vo/WorkVo.java
  2. 2
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstApprovalFlow.java
  3. 4
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstDistributeFlow.java
  4. 13
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstSignFlow.java
  5. 9
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDistributeFlow.java
  6. 6
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeContactWriterFlow.java
  7. 2
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeInterviewWriterFlow.java
  8. 29
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java
  9. 5
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java
  10. 2
      mailbox-lan/src/main/java/com/biutag/lan/mapper/WorkMapper.java
  11. 3
      mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java
  12. 11
      mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java
  13. 2
      mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml
  14. 9
      mailbox-lan/src/main/resources/mapper/WorkMapper.xml
  15. 20
      mailbox-lan/src/test/java/com/biutag/lan/JsonTest.java

6
mailbox-lan/src/main/java/com/biutag/lan/domain/vo/WorkVo.java

@ -116,4 +116,10 @@ public class WorkVo {
* 会签完成部门数量
*/
private Integer countersignCompleted;
/**
* 当前操作人
*/
private String currentOperator;
}

2
mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstApprovalFlow.java

@ -22,6 +22,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import java.time.LocalDateTime;
import java.util.Optional;
@RequiredArgsConstructor
@Component
@ -70,6 +71,7 @@ public class FirstApprovalFlow extends Flow {
.setProblemSolvingStatus(problemSolvingStatus)
.setSatisfactionStatus(satisfactionStatus)
.setCompletionComment(data.getString("completionComment"))
.setMailLabels(Optional.ofNullable(data.getJSONArray("mailLabels")).map(item -> item.toJSONString()).orElse(null))
.setFlowKey(FlowNodeEnum.COMPLETION.getKey())
.setFlowBeforeName(FlowNodeEnum.COMPLETION.getFullName())
// 信件状态改为已办结

4
mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstDistributeFlow.java

@ -43,9 +43,7 @@ public class FirstDistributeFlow extends Flow {
// 将我的工作待办改成已办
workService.updateDone(mailId, RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId(),now);
List<JSONObject> secondDept = new ArrayList<>();
JSONObject firstDistributeInfo = JSONObject.of("mainDept", JSONObject.of("id", mainDeptId),
"secondDept", secondDept);
JSONObject firstDistributeInfo = JSONObject.of("mainDept", JSONObject.of("id", mainDeptId));
// 下发信件(主责单位)
workService.saveOrUpdate(mail, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mainDeptId, now, true, FlowNameEnum.PENDING_SIGN.getName());
Integer secondDeptId1 = data.getInteger("secondDeptId1");

13
mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstSignFlow.java

@ -95,13 +95,13 @@ public class FirstSignFlow extends Flow {
Assert.notNull(secondDeptId, "二级办理单位不能为空");
Assert.notNull(threeDeptId, "三级办理单位不能为空");
LocalDateTime now = LocalDateTime.now();
Mail mail = mailService.getById(mailId);
mail.setSecondDeptId(secondDeptId)
MailSource mailSource = mailSourceService.getById(mailId);
Mail mail = mailSource.toMail().setSecondDeptId(secondDeptId)
.setThreeDeptId(threeDeptId)
.setFlowKey(FlowNodeEnum.COMPLETION.getKey())
.setFlowBeforeName(FlowNodeEnum.COMPLETION.getFullName())
.setUpdateTime(now);
mailService.updateById(mail);
mailService.save(mail);
// 更新为已办
workService.updateDone(mailId, AdminThreadLocal.getRoleId(), now);
return null;
@ -111,11 +111,12 @@ public class FirstSignFlow extends Flow {
String invalidationReason = data.getString("invalidationReason");
Assert.hasText(invalidationReason, "判定理由不能为空");
LocalDateTime now = LocalDateTime.now();
Mail mail = mailService.getById(mailId);
mail.setFlowKey(FlowNodeEnum.COMPLETION.getKey())
MailSource mailSource = mailSourceService.getById(mailId);
Mail mail = mailSource.toMail()
.setFlowKey(FlowNodeEnum.COMPLETION.getKey())
.setFlowBeforeName(FlowNodeEnum.COMPLETION.getFullName())
.setUpdateTime(now);
mailService.updateById(mail);
mailService.save(mail);
// 更新为已办
workService.updateDone(mailId, AdminThreadLocal.getRoleId(), now);
return null;

9
mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDistributeFlow.java

@ -55,9 +55,7 @@ public class SecondDistributeFlow extends Flow {
myWork.setWorkState(Work.State.done.name()).setUpdateTime(now);
workService.updateById(myWork);
List<JSONObject> secondDept = new ArrayList<>();
JSONObject secondDistributeInfo = JSONObject.of("mainDept", JSONObject.of("id", mainDeptId),
"secondDept", secondDept);
JSONObject secondDistributeInfo = JSONObject.of("mainDept", JSONObject.of("id", mainDeptId));
if (myWork.getMainDeptFlag()) {
// 下发信件(主责单位)
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mainDeptId, now, true, FlowNameEnum.PENDING_SIGN.getName());
@ -66,7 +64,6 @@ public class SecondDistributeFlow extends Flow {
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mainDeptId, now, false,
FlowNameEnum.CO_HANDLING.getName(),
FlowNodeEnum.CO_HANDLING.getKey());
secondDept.add(JSONObject.of("id", mainDeptId));
}
Integer secondDeptId1 = data.getInteger("secondDeptId1");
if (Objects.nonNull(secondDeptId1)) {
@ -74,7 +71,7 @@ public class SecondDistributeFlow extends Flow {
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), secondDeptId1, now, false,
FlowNameEnum.PENDING_SIGN_CO.getName(),
FlowNodeEnum.CO_HANDLING.getKey());
secondDept.add(JSONObject.of("id", secondDeptId1));
secondDistributeInfo.put("secondDept1", JSONObject.of("id", secondDeptId1));
}
Integer secondDeptId2 = data.getInteger("secondDeptId2");
if (Objects.nonNull(secondDeptId2)) {
@ -82,7 +79,7 @@ public class SecondDistributeFlow extends Flow {
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), secondDeptId2, now, false,
FlowNameEnum.PENDING_SIGN_CO.getName(),
FlowNodeEnum.CO_HANDLING.getKey());
secondDept.add(JSONObject.of("id", secondDeptId1));
secondDistributeInfo.put("secondDept2", JSONObject.of("id", secondDeptId2));
}
Flow nextNode = next.get(nextActionKey);
if (myWork.getMainDeptFlag()) {

6
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeContactWriterFlow.java

@ -2,6 +2,7 @@ package com.biutag.lan.flow.node;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.biutag.enums.RoleEnum;
import com.biutag.lan.config.AdminThreadLocal;
@ -14,11 +15,13 @@ import com.biutag.lan.flow.FlowNodeEnum;
import com.biutag.lan.service.MailService;
import com.biutag.lan.service.WorkService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.time.LocalDateTime;
import java.util.Objects;
/**
* 三级机构联系群众
@ -47,6 +50,7 @@ public class ThreeContactWriterFlow extends Flow {
Assert.notNull(contactPolice, "联系民警不能为空");
String contactTime = data.getString("contactTime");
Assert.notNull(contactTime, "联系时间不能为空");
LocalDateTime now = LocalDateTime.now();
// 更新信件
Mail mail = mailService.getById(mailId);
@ -72,6 +76,8 @@ public class ThreeContactWriterFlow extends Flow {
Work work = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), AdminThreadLocal.getDeptId());
work.setFlowName(FlowNameEnum.INTERVIEW_WRITER.getName()).setUpdateTime(now);
workService.updateById(work);
// 处理协办民警
threeSignFlow.saveCoHandling(mail, data);
return nextNode;
}

2
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeInterviewWriterFlow.java

@ -51,6 +51,8 @@ public class ThreeInterviewWriterFlow extends Flow {
.setFlowKey(nextNode.getFlowNode().getKey())
.setFlowBeforeName(nextNode.getFlowNode().getBeforeName());
mailService.updateById(mail);
// 处理协办民警
threeSignFlow.saveCoHandling(mail, data);
return nextNode;
}

29
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java

@ -1,5 +1,6 @@
package com.biutag.lan.flow.node;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.biutag.enums.RoleEnum;
import com.biutag.exception.BusinessException;
@ -15,11 +16,14 @@ import com.biutag.lan.service.MailReturnService;
import com.biutag.lan.service.MailService;
import com.biutag.lan.service.WorkService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.Objects;
/**
* 三级机构签收
@ -99,4 +103,29 @@ public class ThreeSignFlow extends Flow {
return nextNode;
}
public void saveCoHandling(Mail mail, JSONObject data) {
LocalDateTime now = LocalDateTime.now();
// 处理协办民警
JSONArray coHandingPolices = data.getJSONArray("coHandingPolices");
if (Objects.nonNull(coHandingPolices) && coHandingPolices.size() > 0) {
for (Object coHandingPolice : coHandingPolices) {
Map obj = (JSONObject) coHandingPolice;
String empNo = obj.get("empNo").toString();
Work coWork = workService.getOne(mail.getId(), empNo);
if (Objects.nonNull(coWork)) {
continue;
}
Work work = new Work();
BeanUtils.copyProperties(mail, work);
work.setMailId(mail.getId())
.setPoliceEmpNo(empNo)
.setCreateTime(now)
.setWorkState(Work.State.todo.name())
.setFlowName(FlowNameEnum.CO_HANDLING.getName())
.setFlowKey(FlowNodeEnum.CO_HANDLING.getKey()).setUpdateTime(now);
workService.save(work);
}
}
}
}

5
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java

@ -29,6 +29,7 @@ public class ThreeVerifyFlow extends Flow {
private final MailService mailService;
private final WorkService workService;
private final ThreeSignFlow threeSignFlow;
@Override
public Flow next(String nextActionKey, String mailId, JSONObject data) {
@ -107,6 +108,8 @@ public class ThreeVerifyFlow extends Flow {
.setVerifyAttachments(data.getString("verifyAttachments"));
BeanUtil.copyProperties(source, mail, CopyOptions.create().setIgnoreNullValue(true));
mailService.updateById(mail);
// 处理协办民警
threeSignFlow.saveCoHandling(mail, data);
return null;
}
@ -157,6 +160,8 @@ public class ThreeVerifyFlow extends Flow {
mailService.updateById(mail);
// 将本人下的件改为已办
workService.updateDone(mail.getId(), AdminThreadLocal.getRoleId(), now);
// 处理协办民警
threeSignFlow.saveCoHandling(mail, data);
}
public Flow offline(String nextActionKey, String mailId, JSONObject data) {

2
mailbox-lan/src/main/java/com/biutag/lan/mapper/WorkMapper.java

@ -15,7 +15,7 @@ import java.util.Collection;
public interface WorkMapper extends BaseMapper<Work> {
Page<WorkVo> selectPageTodo(@Param("page") Page<Work> page, @Param(Constants.WRAPPER) QueryWrapper<Work> queryWrapper);
Page<WorkVo> selectPage(@Param("page") Page<Work> page, @Param(Constants.WRAPPER) QueryWrapper<Work> queryWrapper);
Page<QueryMailVo> selectQueryPage(@Param("page") Page<Mail> page, @Param(Constants.WRAPPER) QueryWrapper<Mail> queryWrapper);

3
mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java

@ -2,6 +2,7 @@ package com.biutag.lan.service;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -160,7 +161,7 @@ public class MailService extends ServiceImpl<MailMapper, Mail> {
flowDetail.setMailReturns(mailReturnService.list(mailId));
}
// 申请延期
if (ExtensionState.applying.name().equals(mail.getExtensionState())) {
if (StrUtil.isNotBlank(mail.getExtensionState())) {
mailVo.setExtensionApprovals(mailExtensionApprovalService.list(mailId));
}
if (Objects.nonNull(mail.getFlowKey()) && FlowNodeEnum.get(mail.getFlowKey()).getIndex() >= FlowNodeEnum.THREE_LEADER_APPROVAL.getIndex()) {

11
mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java

@ -106,11 +106,12 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
work.setMailId(mail.getId())
.setSignRoleId(roleId)
.setSignDeptId(deptId)
.setCreateTime(time)
.setFlowName(flowName)
.setFlowKey(flowKey);
.setCreateTime(time);
}
work.setWorkState(Work.State.todo.name()).setUpdateTime(time).setMainDeptFlag(mainDeptFlag).setFlowName(flowName).setFlowKey(flowKey);
work.setWorkState(Work.State.todo.name())
.setUpdateTime(time)
.setMainDeptFlag(mainDeptFlag)
.setFlowName(flowName).setFlowKey(flowKey);
return saveOrUpdate(work);
}
@ -230,7 +231,7 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
}
// 排序
queryWrapper.orderByDesc("w.update_time");
Page<WorkVo> workVoPage = baseMapper.selectPageTodo(page, queryWrapper);
Page<WorkVo> workVoPage = baseMapper.selectPage(page, queryWrapper);
workVoPage.getRecords().forEach(item -> {
// 会签中
if (FlowNameEnum.COUNTERSIGNING.getName().equals(item.getFlowName())) {

2
mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml

@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select a.name,CONCAT(ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0),'%') rate,
ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0) rateNumber,
SUM(COALESCE(b.satisfied, 0)) satisfied,count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.category='2' GROUP BY a.name order by rateNumber desc limit 10
from dept a left join mail_mark b on a.id=b.second_dept_id where a.category='2' GROUP BY a.name order by rateNumber desc limit 10
</select>

9
mailbox-lan/src/main/resources/mapper/WorkMapper.xml

@ -4,10 +4,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.biutag.lan.mapper.WorkMapper">
<select id="selectPageTodo" resultType="com.biutag.lan.domain.vo.WorkVo">
select w.id, w.contact_name, w.contact_phone, w.contact_id_card, w.content, w.source, w.mail_time, w.mail_id, w.work_type,
m.mail_state, m.mail_category, m.mail_level, m.three_dept_id, m.three_dept_name, m.flow_key, m.flow_before_name,m.mail_labels,
<!-- 当前流程剩余多少时间(秒) -->
<select id="selectPage" resultType="com.biutag.lan.domain.vo.WorkVo">
select w.id, w.contact_name, w.contact_phone, w.contact_id_card, w.content, w.source, w.mail_time, w.mail_id, w.work_type,w.flow_name,
m.mail_state, m.mail_category, m.mail_level, m.three_dept_id, m.three_dept_name, m.flow_key, m.mail_labels, m.countersign_total, m.countersign_completed,
<!-- 当前流程剩余多少时间(秒) -->
f.limited_time - ROUND(EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - m.flow_limited_last_handler_time))) flow_limited_remaining_time
from work w
left join mail m on w.mail_id = m.id

20
mailbox-lan/src/test/java/com/biutag/lan/JsonTest.java

@ -0,0 +1,20 @@
package com.biutag.lan;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.Map;
public class JsonTest {
@Test
public void testJson() {
Map<String, String> map = new HashMap<>();
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(map));
JSONArray jsonArray = jsonObject.getJSONArray("a");
System.out.println();
}
}
Loading…
Cancel
Save