|
@@ -19,12 +19,13 @@ import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskApproveR
|
|
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
|
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
|
|
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskReturnReqVO;
|
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskReturnReqVO;
|
|
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.turnover.OaTurnoverDO;
|
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.turnover.OaTurnoverDO;
|
|
|
-import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.turnover.OaTurnoverDO;
|
|
|
|
|
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.turnover.OaTurnOverMapper;
|
|
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.turnover.OaTurnOverMapper;
|
|
|
import cn.iocoder.yudao.module.bpm.enums.DictDataConstants;
|
|
import cn.iocoder.yudao.module.bpm.enums.DictDataConstants;
|
|
|
import cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants;
|
|
import cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants;
|
|
|
|
|
+import cn.iocoder.yudao.module.bpm.enums.ProcessKeyEnum;
|
|
|
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmConstants;
|
|
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmConstants;
|
|
|
import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
|
|
import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
|
|
|
|
|
+import cn.iocoder.yudao.module.bpm.util.OANotifyContentUtil;
|
|
|
import cn.iocoder.yudao.module.employee.api.EmployeeApi;
|
|
import cn.iocoder.yudao.module.employee.api.EmployeeApi;
|
|
|
import cn.iocoder.yudao.module.employee.api.dto.EmployeeRespDTO;
|
|
import cn.iocoder.yudao.module.employee.api.dto.EmployeeRespDTO;
|
|
|
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
|
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
|
@@ -33,6 +34,7 @@ import cn.iocoder.yudao.module.relations.api.turnover.RelationsTurnoverApi;
|
|
|
import cn.iocoder.yudao.module.relations.api.turnover.dto.RelationsTurnoverCreateReqDTO;
|
|
import cn.iocoder.yudao.module.relations.api.turnover.dto.RelationsTurnoverCreateReqDTO;
|
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
|
|
|
+import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -46,7 +48,12 @@ import javax.annotation.Resource;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
-import java.util.*;
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.Arrays;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
@@ -65,7 +72,7 @@ public class OaTurnoverServiceImpl implements OaTurnoverService {
|
|
|
/**
|
|
/**
|
|
|
* 对应的流程定义 KEY
|
|
* 对应的流程定义 KEY
|
|
|
*/
|
|
*/
|
|
|
- public static final String PROCESS_KEY = "oa_turnover";
|
|
|
|
|
|
|
+ public static final String PROCESS_KEY = ProcessKeyEnum.OA_TURNOVER.getProcessKey();
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
@@ -92,6 +99,10 @@ public class OaTurnoverServiceImpl implements OaTurnoverService {
|
|
|
@Resource
|
|
@Resource
|
|
|
private RelationsTurnoverApi relationsTurnoverApi;
|
|
private RelationsTurnoverApi relationsTurnoverApi;
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private NotifyMessageSendApi notifyMessageSendApi;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Long stagingOaTurnover(OaTurnoverSaveReqVO stagingReqVO) {
|
|
public Long stagingOaTurnover(OaTurnoverSaveReqVO stagingReqVO) {
|
|
@@ -239,7 +250,24 @@ public class OaTurnoverServiceImpl implements OaTurnoverService {
|
|
|
.setStartUserSelectAssignees(selectAssignees.stream().map(String::valueOf).collect(Collectors.joining(","))));
|
|
.setStartUserSelectAssignees(selectAssignees.stream().map(String::valueOf).collect(Collectors.joining(","))));
|
|
|
// 保存业务uuid到附件中
|
|
// 保存业务uuid到附件中
|
|
|
fileApi.updateFileBiz(commitReqVO.getFileIdList(), oaTurnover.getTurnoverId());
|
|
fileApi.updateFileBiz(commitReqVO.getFileIdList(), oaTurnover.getTurnoverId());
|
|
|
- // TODO DP 发送提交成功站内信
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 给审批人发送审批站内信
|
|
|
|
|
+ Long assigneeId = -1L;
|
|
|
|
|
+ String assigneeName = "";
|
|
|
|
|
+ String applyName = loginEmployee.getName();
|
|
|
|
|
+ String processName = ProcessKeyEnum.getByProcessKey(PROCESS_KEY);
|
|
|
|
|
+
|
|
|
|
|
+ String assignee = nextTask.getAssignee();
|
|
|
|
|
+ if (StrUtil.isNotBlank(assignee)) {
|
|
|
|
|
+ EmployeeRespDTO employeeAssignee = employeeApi.getEmployeeById(Long.valueOf(assignee));
|
|
|
|
|
+ if (employeeAssignee != null) {
|
|
|
|
|
+ assigneeId = employeeAssignee.getId();
|
|
|
|
|
+ assigneeName = employeeAssignee.getName();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ StringBuilder content = OANotifyContentUtil.buildContentSendToAssignee(assigneeName, applyName, processName);
|
|
|
|
|
+ notifyMessageSendApi.sendSingleMessageToMemberForOA(assigneeId, content.toString());
|
|
|
|
|
+
|
|
|
return oaTurnover.getId();
|
|
return oaTurnover.getId();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -318,7 +346,33 @@ public class OaTurnoverServiceImpl implements OaTurnoverService {
|
|
|
relationsTurnoverApi.createTurnoverInfoAfterAudit(turnoverCreateReqDTO);
|
|
relationsTurnoverApi.createTurnoverInfoAfterAudit(turnoverCreateReqDTO);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 发送通知
|
|
|
|
|
|
|
+ // 发送站内信
|
|
|
|
|
+ Long assignId = -1L;
|
|
|
|
|
+ String assigneeName = "";
|
|
|
|
|
+ Long applyId = -1L;
|
|
|
|
|
+ String applyName = "";
|
|
|
|
|
+ String processName = ProcessKeyEnum.getByProcessKey(PROCESS_KEY);
|
|
|
|
|
+
|
|
|
|
|
+ EmployeeRespDTO applyEmployee = employeeApi.getEmployeeById(oaTurnover.getApplyEmployeeId());
|
|
|
|
|
+ if (applyEmployee != null) {
|
|
|
|
|
+ applyId = applyEmployee.getId();
|
|
|
|
|
+ applyName = applyEmployee.getName();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (nextTask != null) {
|
|
|
|
|
+ EmployeeRespDTO employeeAssignee = employeeApi.getEmployeeById(Long.valueOf(nextTask.getAssignee()));
|
|
|
|
|
+ if (employeeAssignee != null) {
|
|
|
|
|
+ assignId = employeeAssignee.getId();
|
|
|
|
|
+ assigneeName = employeeAssignee.getName();
|
|
|
|
|
+ }
|
|
|
|
|
+ // 给审批人发送审批站内信
|
|
|
|
|
+ StringBuilder content = OANotifyContentUtil.buildContentSendToAssignee(assigneeName, applyName, processName);
|
|
|
|
|
+ notifyMessageSendApi.sendSingleMessageToMemberForOA(assignId, content.toString());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 给申请人发送审批完成站内信
|
|
|
|
|
+ StringBuilder content = OANotifyContentUtil.buildContentSendToApplyForComplete(applyName, processName);
|
|
|
|
|
+ notifyMessageSendApi.sendSingleMessageToMemberForOA(applyId, content.toString());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// 返回
|
|
// 返回
|
|
|
return 1L;
|
|
return 1L;
|
|
@@ -357,7 +411,22 @@ public class OaTurnoverServiceImpl implements OaTurnoverService {
|
|
|
.eq(OaTurnoverDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
.eq(OaTurnoverDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
oaTurnoverMapper.update(updateWrapper);
|
|
oaTurnoverMapper.update(updateWrapper);
|
|
|
|
|
|
|
|
- // 发送通知
|
|
|
|
|
|
|
+ // 给申请人发送驳回站内信
|
|
|
|
|
+ String assigneeName = loginEmployee.getName();
|
|
|
|
|
+ Long applyId = -1L;
|
|
|
|
|
+ String applyName = "";
|
|
|
|
|
+ String processName = ProcessKeyEnum.getByProcessKey(PROCESS_KEY);
|
|
|
|
|
+ OaTurnoverDO oaTurnoverDO = oaTurnoverMapper.selectOne(OaTurnoverDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
|
|
+ if (oaTurnoverDO != null) {
|
|
|
|
|
+ EmployeeRespDTO applyEmployee = employeeApi.getEmployeeById(oaTurnoverDO.getApplyEmployeeId());
|
|
|
|
|
+ if (applyEmployee != null) {
|
|
|
|
|
+ applyId = applyEmployee.getId();
|
|
|
|
|
+ applyName = applyEmployee.getName();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ StringBuilder content = OANotifyContentUtil.buildContentSendToApplyForDisagree(assigneeName, applyName, processName);
|
|
|
|
|
+ notifyMessageSendApi.sendSingleMessageToMemberForOA(applyId, content.toString());
|
|
|
|
|
+
|
|
|
|
|
|
|
|
return 1L;
|
|
return 1L;
|
|
|
}
|
|
}
|
|
@@ -409,8 +478,6 @@ public class OaTurnoverServiceImpl implements OaTurnoverService {
|
|
|
.eq(OaTurnoverDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
.eq(OaTurnoverDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
oaTurnoverMapper.update(updateWrapper);
|
|
oaTurnoverMapper.update(updateWrapper);
|
|
|
|
|
|
|
|
- // 发送通知
|
|
|
|
|
-
|
|
|
|
|
return 1L;
|
|
return 1L;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -482,6 +549,24 @@ public class OaTurnoverServiceImpl implements OaTurnoverService {
|
|
|
// 保存业务uuid到附件中
|
|
// 保存业务uuid到附件中
|
|
|
fileApi.updateFileBiz(reCommitReqVO.getFileIdList(), oaTurnoverNew.getTurnoverId());
|
|
fileApi.updateFileBiz(reCommitReqVO.getFileIdList(), oaTurnoverNew.getTurnoverId());
|
|
|
|
|
|
|
|
|
|
+ // 给审批人发送审批站内信
|
|
|
|
|
+ Long assigneeId = -1L;
|
|
|
|
|
+ String assigneeName = "";
|
|
|
|
|
+ String applyName = loginEmployee.getName();
|
|
|
|
|
+ String processName = ProcessKeyEnum.getByProcessKey(PROCESS_KEY);
|
|
|
|
|
+
|
|
|
|
|
+ String assignee = nextTask.getAssignee();
|
|
|
|
|
+ if (StrUtil.isNotBlank(assignee)) {
|
|
|
|
|
+ EmployeeRespDTO assigneeEmployee = employeeApi.getEmployeeById(Long.valueOf(assignee));
|
|
|
|
|
+ if (assigneeEmployee != null) {
|
|
|
|
|
+ assigneeId = assigneeEmployee.getId();
|
|
|
|
|
+ assigneeName = assigneeEmployee.getName();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ StringBuilder content = OANotifyContentUtil.buildContentSendToAssignee(assigneeName, applyName, processName);
|
|
|
|
|
+ notifyMessageSendApi.sendSingleMessageToMemberForOA(assigneeId, content.toString());
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
return 1L;
|
|
return 1L;
|
|
|
}
|
|
}
|
|
|
|
|
|