|
@@ -21,14 +21,17 @@ import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.universal.OaUniversalDO;
|
|
|
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.universal.OaUniversalMapper;
|
|
|
import cn.iocoder.yudao.module.bpm.enums.DictDataConstants;
|
|
|
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.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.dto.EmployeeRespDTO;
|
|
|
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
|
|
import cn.iocoder.yudao.module.infra.api.file.dto.FileDTO;
|
|
|
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.notify.NotifyMessageSendApi;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -82,6 +85,9 @@ public class OaUniversalServiceImpl implements OaUniversalService {
|
|
|
@Resource
|
|
|
private EmployeeApi employeeApi;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private NotifyMessageSendApi notifyMessageSendApi;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Long stagingOaUniversal(OaUniversalSaveReqVO stagingReqVO) {
|
|
@@ -199,7 +205,22 @@ public class OaUniversalServiceImpl implements OaUniversalService {
|
|
|
.setStartUserSelectAssignees(selectAssignees.stream().map(String::valueOf).collect(Collectors.joining(","))));
|
|
|
// 保存业务uuid到附件中
|
|
|
fileApi.updateFileBiz(commitReqVO.getFileIdList(), oaUniversal.getUniversalId());
|
|
|
- // 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 oaUniversal.getId();
|
|
|
}
|
|
|
|
|
@@ -261,6 +282,32 @@ public class OaUniversalServiceImpl implements OaUniversalService {
|
|
|
}
|
|
|
oaUniversalMapper.updateById(oaUniversalDO);
|
|
|
// 发送通知
|
|
|
+ Long assignId = -1L;
|
|
|
+ String assigneeName = "";
|
|
|
+ Long applyId = -1L;
|
|
|
+ String applyName = "";
|
|
|
+ String processName = ProcessKeyEnum.getByProcessKey(PROCESS_KEY);
|
|
|
+
|
|
|
+ EmployeeRespDTO applyEmployee = employeeApi.getEmployeeById(oaUniversal.getEmployeeId());
|
|
|
+ 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;
|
|
@@ -293,7 +340,21 @@ public class OaUniversalServiceImpl implements OaUniversalService {
|
|
|
.eq(OaUniversalDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
oaUniversalMapper.update(updateWrapper);
|
|
|
|
|
|
- // 发送通知
|
|
|
+ // 给申请人发送驳回站内信
|
|
|
+ String assigneeName = loginEmployee.getName();
|
|
|
+ Long applyId = -1L;
|
|
|
+ String applyName = "";
|
|
|
+ String processName = ProcessKeyEnum.getByProcessKey(PROCESS_KEY);
|
|
|
+ OaUniversalDO oaUniversalDO = oaUniversalMapper.selectOne(OaUniversalDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
+ if (oaUniversalDO != null) {
|
|
|
+ EmployeeRespDTO applyEmployee = employeeApi.getEmployeeById(oaUniversalDO.getEmployeeId());
|
|
|
+ if (applyEmployee != null) {
|
|
|
+ applyId = applyEmployee.getId();
|
|
|
+ applyName = applyEmployee.getName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ StringBuilder content = OANotifyContentUtil.buildContentSendToApplyForDisagree(assigneeName, applyName, processName);
|
|
|
+ notifyMessageSendApi.sendSingleMessageToMemberForOA(applyId, content.toString());
|
|
|
|
|
|
return 1L;
|
|
|
}
|
|
@@ -388,6 +449,23 @@ public class OaUniversalServiceImpl implements OaUniversalService {
|
|
|
// 保存业务uuid到附件中
|
|
|
fileApi.updateFileBiz(reCommitReqVO.getFileIdList(), oaUniversalNew.getUniversalId());
|
|
|
|
|
|
+ // 给审批人发送审批站内信
|
|
|
+ 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;
|
|
|
}
|
|
|
|