|
@@ -2,20 +2,40 @@ package com.xjrsoft.module.oa.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
|
|
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.module.oa.entity.OfficialDocumentReceived;
|
|
import com.xjrsoft.module.oa.entity.OfficialDocumentReceived;
|
|
|
import com.xjrsoft.module.oa.mapper.OfficialDocumentReceivedMapper;
|
|
import com.xjrsoft.module.oa.mapper.OfficialDocumentReceivedMapper;
|
|
|
import com.xjrsoft.module.oa.service.IOfficialDocumentReceivedService;
|
|
import com.xjrsoft.module.oa.service.IOfficialDocumentReceivedService;
|
|
|
import com.xjrsoft.module.oa.utils.PostNumberUtil;
|
|
import com.xjrsoft.module.oa.utils.PostNumberUtil;
|
|
|
|
|
+import com.xjrsoft.module.oa.vo.NextReviewerListVo;
|
|
|
import com.xjrsoft.module.organization.dto.WeChatSendMessageDto;
|
|
import com.xjrsoft.module.organization.dto.WeChatSendMessageDto;
|
|
|
|
|
+import com.xjrsoft.module.organization.entity.Department;
|
|
|
|
|
+import com.xjrsoft.module.organization.entity.Post;
|
|
|
import com.xjrsoft.module.organization.entity.User;
|
|
import com.xjrsoft.module.organization.entity.User;
|
|
|
|
|
+import com.xjrsoft.module.organization.entity.UserPostRelation;
|
|
|
|
|
+import com.xjrsoft.module.organization.mapper.PostMapper;
|
|
|
import com.xjrsoft.module.organization.mapper.UserMapper;
|
|
import com.xjrsoft.module.organization.mapper.UserMapper;
|
|
|
import com.xjrsoft.module.organization.service.IWeChatService;
|
|
import com.xjrsoft.module.organization.service.IWeChatService;
|
|
|
|
|
+import com.xjrsoft.module.teacher.entity.WfTeacherleave;
|
|
|
|
|
+import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
|
|
+import com.xjrsoft.module.teacher.mapper.XjrUserMapper;
|
|
|
|
|
+import com.xjrsoft.module.workflow.entity.WorkflowFormRelation;
|
|
|
|
|
+import com.xjrsoft.module.workflow.entity.WorkflowRecord;
|
|
|
|
|
+import com.xjrsoft.module.workflow.service.IWorkflowFormRelationService;
|
|
|
|
|
+import com.xjrsoft.module.workflow.service.IWorkflowRecordService;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @title: 公文收文
|
|
* @title: 公文收文
|
|
@@ -31,6 +51,11 @@ public class OfficialDocumentReceivedServiceImpl extends MPJBaseServiceImpl<Offi
|
|
|
private final IWeChatService weChatService;
|
|
private final IWeChatService weChatService;
|
|
|
private final UserMapper userMapper;
|
|
private final UserMapper userMapper;
|
|
|
|
|
|
|
|
|
|
+ private final IWorkflowFormRelationService workflowFormRelationService;
|
|
|
|
|
+ private final IWorkflowRecordService workflowRecordService;
|
|
|
|
|
+ private final PostMapper postMapper;
|
|
|
|
|
+ private final XjrUserMapper xjrUserMapper;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public String getMaxReceivedNumber() {
|
|
public String getMaxReceivedNumber() {
|
|
|
Integer maxReceivedNumber = officialDocumentReceivedMapper.getMaxReceivedNumber();
|
|
Integer maxReceivedNumber = officialDocumentReceivedMapper.getMaxReceivedNumber();
|
|
@@ -74,5 +99,149 @@ public class OfficialDocumentReceivedServiceImpl extends MPJBaseServiceImpl<Offi
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public void taskIdPersist(Long id) {
|
|
|
|
|
+ // 根据当前表单数据获取流程信息
|
|
|
|
|
+ LambdaQueryWrapper<WorkflowFormRelation> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ wrapper
|
|
|
|
|
+ .eq(WorkflowFormRelation::getFormKeyValue, id)
|
|
|
|
|
+ ;
|
|
|
|
|
+ WorkflowFormRelation workflowFormRelation = workflowFormRelationService.getOne(wrapper);
|
|
|
|
|
+
|
|
|
|
|
+ if(ObjectUtils.isNotEmpty(workflowFormRelation)){
|
|
|
|
|
+ OfficialDocumentReceived update = new OfficialDocumentReceived();
|
|
|
|
|
+ update.setId(id);
|
|
|
|
|
+ update.setTaskId(workflowFormRelation.getProcessId());
|
|
|
|
|
+ officialDocumentReceivedMapper.updateById(update);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取当前行政收文流程下一节点审核人列表
|
|
|
|
|
+ * @param taskId
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public List<NextReviewerListVo> nextReviewerList(String taskId) {
|
|
|
|
|
+ // 根据流程Id获取分管领导审核节点的审核人
|
|
|
|
|
+ LambdaQueryWrapper<WorkflowRecord> workflowRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ workflowRecordLambdaQueryWrapper
|
|
|
|
|
+ .eq(WorkflowRecord::getNodeType, "用户任务")
|
|
|
|
|
+ .eq(WorkflowRecord::getNodeName, "分管领导意见")
|
|
|
|
|
+ .ne(WorkflowRecord::getCreateUserId, 0)
|
|
|
|
|
+ .orderByDesc(WorkflowRecord::getRecordTime)
|
|
|
|
|
+ .last("limit 1")
|
|
|
|
|
+ ;
|
|
|
|
|
+ WorkflowRecord workflowRecord = workflowRecordService.getOne(workflowRecordLambdaQueryWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ if(ObjectUtils.isEmpty(workflowRecord)){
|
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 根据当前分管领导获取其负责的部门
|
|
|
|
|
+ MPJLambdaWrapper<Post> postMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
|
|
+ postMPJLambdaWrapper
|
|
|
|
|
+ .select(Post::getId)
|
|
|
|
|
+ .innerJoin(UserPostRelation.class, UserPostRelation::getPostId, Post::getId)
|
|
|
|
|
+ .eq(UserPostRelation::getUserId, workflowRecord.getCreateUserId())
|
|
|
|
|
+ ;
|
|
|
|
|
+ List<Post> posts = postMapper.selectJoinList(Post.class, postMPJLambdaWrapper);
|
|
|
|
|
+ List<Long> postIds = posts.stream()
|
|
|
|
|
+ .map(Post::getId)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ if(CollectionUtils.isEmpty(postIds)){
|
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 根据部门获取部门管理人员
|
|
|
|
|
+ MPJLambdaWrapper<XjrUser> xjrUserMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
|
|
+ xjrUserMPJLambdaWrapper
|
|
|
|
|
+ .selectAs(XjrUser::getId, NextReviewerListVo::getValue)
|
|
|
|
|
+ .selectAs(XjrUser::getName, NextReviewerListVo::getLabel)
|
|
|
|
|
+ .selectAs(Department::getName, NextReviewerListVo::getDeptName)
|
|
|
|
|
+ .innerJoin(UserPostRelation.class, UserPostRelation::getUserId, XjrUser::getId)
|
|
|
|
|
+ .innerJoin(Post.class, Post::getId, UserPostRelation::getPostId)
|
|
|
|
|
+ .leftJoin(Department.class, Department::getId, Post::getDeptId)
|
|
|
|
|
+ .in(Post::getParentId, postIds)
|
|
|
|
|
+ .and(wrapper ->
|
|
|
|
|
+ wrapper
|
|
|
|
|
+ .like(Post::getName, "主任")
|
|
|
|
|
+ .or()
|
|
|
|
|
+ .like(Post::getName, "书记")
|
|
|
|
|
+ )
|
|
|
|
|
+ ;
|
|
|
|
|
+ List<NextReviewerListVo> voList = xjrUserMapper.selectJoinList(NextReviewerListVo.class, xjrUserMPJLambdaWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ for (NextReviewerListVo vo : voList){
|
|
|
|
|
+ if(ObjectUtils.isNotEmpty(vo.getDeptName())){
|
|
|
|
|
+ vo.setLabel(vo.getLabel() + "(" + vo.getDeptName() + ")");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return voList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public List<NextReviewerListVo> nextExecutorList(String taskId) {
|
|
|
|
|
+ // 根据流程Id获取部门主任意见审核节点的审核人
|
|
|
|
|
+ LambdaQueryWrapper<WorkflowRecord> workflowRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ workflowRecordLambdaQueryWrapper
|
|
|
|
|
+ .eq(WorkflowRecord::getNodeType, "用户任务")
|
|
|
|
|
+ .eq(WorkflowRecord::getNodeName, "部门主任意见")
|
|
|
|
|
+ .ne(WorkflowRecord::getCreateUserId, 0)
|
|
|
|
|
+ .orderByDesc(WorkflowRecord::getRecordTime)
|
|
|
|
|
+ .last("limit 1")
|
|
|
|
|
+ ;
|
|
|
|
|
+ WorkflowRecord workflowRecord = workflowRecordService.getOne(workflowRecordLambdaQueryWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ if(ObjectUtils.isEmpty(workflowRecord)){
|
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 根据当前主任获取其负责的部门
|
|
|
|
|
+ MPJLambdaWrapper<Post> postMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
|
|
+ postMPJLambdaWrapper
|
|
|
|
|
+ .select(Post::getId)
|
|
|
|
|
+ .innerJoin(UserPostRelation.class, UserPostRelation::getPostId, Post::getId)
|
|
|
|
|
+ .eq(UserPostRelation::getUserId, workflowRecord.getCreateUserId())
|
|
|
|
|
+ ;
|
|
|
|
|
+ List<Post> posts = postMapper.selectJoinList(Post.class, postMPJLambdaWrapper);
|
|
|
|
|
+ List<Long> postIds = posts.stream()
|
|
|
|
|
+ .map(Post::getId)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ if(CollectionUtils.isEmpty(postIds)){
|
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 根据部门获取部门管理人员
|
|
|
|
|
+ MPJLambdaWrapper<XjrUser> xjrUserMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
|
|
+ xjrUserMPJLambdaWrapper
|
|
|
|
|
+ .selectAs(XjrUser::getId, NextReviewerListVo::getValue)
|
|
|
|
|
+ .selectAs(XjrUser::getName, NextReviewerListVo::getLabel)
|
|
|
|
|
+ .selectAs(Department::getName, NextReviewerListVo::getDeptName)
|
|
|
|
|
+ .innerJoin(UserPostRelation.class, UserPostRelation::getUserId, XjrUser::getId)
|
|
|
|
|
+ .innerJoin(Post.class, Post::getId, UserPostRelation::getPostId)
|
|
|
|
|
+ .leftJoin(Department.class, Department::getId, Post::getDeptId)
|
|
|
|
|
+ .in(Post::getParentId, postIds)
|
|
|
|
|
+ .and(wrapper ->
|
|
|
|
|
+ wrapper
|
|
|
|
|
+ .like(Post::getName, "副主任")
|
|
|
|
|
+ .or()
|
|
|
|
|
+ .like(Post::getName, "副书记")
|
|
|
|
|
+ )
|
|
|
|
|
+ ;
|
|
|
|
|
+ List<NextReviewerListVo> voList = xjrUserMapper.selectJoinList(NextReviewerListVo.class, xjrUserMPJLambdaWrapper);
|
|
|
|
|
|
|
|
|
|
+ for (NextReviewerListVo vo : voList){
|
|
|
|
|
+ if(ObjectUtils.isNotEmpty(vo.getDeptName())){
|
|
|
|
|
+ vo.setLabel(vo.getLabel() + "(" + vo.getDeptName() + ")");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return voList;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|