|
@@ -24,8 +24,10 @@ import cn.iocoder.yudao.module.bpm.dal.mysql.oa.expense.OaExpenseMapper;
|
|
|
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.expense.OaExpenseObjMapper;
|
|
|
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.expense.api.expenseinfo.ExpenseInfoApi;
|
|
@@ -39,6 +41,7 @@ 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;
|
|
@@ -51,11 +54,20 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
-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.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
-import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
|
|
|
+import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_EXPENSE_NOT_EXISTS;
|
|
|
+import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_EXPENSE_OBJ_END_DATE_NULL;
|
|
|
+import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_EXPENSE_OBJ_MONEY_ZERO;
|
|
|
+import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_EXPENSE_OBJ_START_DATE_NULL;
|
|
|
|
|
|
/**
|
|
|
* 报销流程信息 Service 实现类
|
|
@@ -70,7 +82,7 @@ public class OaExpenseServiceImpl implements OaExpenseService {
|
|
|
/**
|
|
|
* 对应的流程定义 KEY
|
|
|
*/
|
|
|
- public static final String PROCESS_KEY = "oa_expense";
|
|
|
+ public static final String PROCESS_KEY = ProcessKeyEnum.OA_EXPENSE.getProcessKey();
|
|
|
|
|
|
|
|
|
@Resource
|
|
@@ -106,6 +118,10 @@ public class OaExpenseServiceImpl implements OaExpenseService {
|
|
|
@Resource
|
|
|
private ExpenseInfoApi expenseInfoApi;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private NotifyMessageSendApi notifyMessageSendApi;
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Long stagingOaExpense(OaExpenseSaveReqVO stagingReqVO) {
|
|
@@ -268,7 +284,24 @@ public class OaExpenseServiceImpl implements OaExpenseService {
|
|
|
.setStartUserSelectAssignees(selectAssignees.stream().map(String::valueOf).collect(Collectors.joining(","))));
|
|
|
// 保存业务uuid到附件中
|
|
|
fileApi.updateFileBiz(commitReqVO.getFileIdList(), oaExpense.getExpenseUuid());
|
|
|
- // 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 oaExpense.getId();
|
|
|
}
|
|
|
|
|
@@ -356,7 +389,34 @@ public class OaExpenseServiceImpl implements OaExpenseService {
|
|
|
// 调用接口创建费用信息
|
|
|
expenseInfoApi.createExpenseInfo(expenseInfoCreateReqDTO);
|
|
|
}
|
|
|
- // 发送通知
|
|
|
+
|
|
|
+ // 发送站内信
|
|
|
+ Long assignId = -1L;
|
|
|
+ String assigneeName = "";
|
|
|
+ Long applyId = -1L;
|
|
|
+ String applyName = "";
|
|
|
+ String processName = ProcessKeyEnum.getByProcessKey(PROCESS_KEY);
|
|
|
+
|
|
|
+ EmployeeRespDTO applyEmployee = employeeApi.getEmployeeById(oaExpense.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;
|
|
@@ -395,7 +455,22 @@ public class OaExpenseServiceImpl implements OaExpenseService {
|
|
|
.eq(OaExpenseDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
oaExpenseMapper.update(updateWrapper);
|
|
|
|
|
|
- // 发送通知
|
|
|
+ // 给申请人发送驳回站内信
|
|
|
+ String assigneeName = loginEmployee.getName();
|
|
|
+ Long applyId = -1L;
|
|
|
+ String applyName = "";
|
|
|
+ String processName = ProcessKeyEnum.getByProcessKey(PROCESS_KEY);
|
|
|
+ OaExpenseDO oaExpenseDO = oaExpenseMapper.selectOne(OaExpenseDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
+ if (oaExpenseDO != null) {
|
|
|
+ EmployeeRespDTO applyEmployee = employeeApi.getEmployeeById(oaExpenseDO.getApplyEmployeeId());
|
|
|
+ if (applyEmployee != null) {
|
|
|
+ applyId = applyEmployee.getId();
|
|
|
+ applyName = applyEmployee.getName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ StringBuilder content = OANotifyContentUtil.buildContentSendToApplyForDisagree(assigneeName, applyName, processName);
|
|
|
+ notifyMessageSendApi.sendSingleMessageToMemberForOA(applyId, content.toString());
|
|
|
+
|
|
|
|
|
|
return 1L;
|
|
|
}
|
|
@@ -447,8 +522,6 @@ public class OaExpenseServiceImpl implements OaExpenseService {
|
|
|
.eq(OaExpenseDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
oaExpenseMapper.update(updateWrapper);
|
|
|
|
|
|
- // 发送通知
|
|
|
-
|
|
|
return 1L;
|
|
|
}
|
|
|
|
|
@@ -534,6 +607,24 @@ public class OaExpenseServiceImpl implements OaExpenseService {
|
|
|
// 保存业务uuid到附件中
|
|
|
fileApi.updateFileBiz(reCommitReqVO.getFileIdList(), oaExpenseNew.getExpenseUuid());
|
|
|
|
|
|
+ // 给审批人发送审批站内信
|
|
|
+ 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;
|
|
|
}
|
|
|
|