|
|
@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
+import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
|
|
@@ -22,12 +23,12 @@ import cn.iocoder.yudao.module.bpm.enums.DictDataConstants;
|
|
|
import cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants;
|
|
|
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.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.user.AdminUserApi;
|
|
|
-import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -76,7 +77,7 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
private FileApi fileApi;
|
|
|
|
|
|
@Resource
|
|
|
- private AdminUserApi adminUserApi;
|
|
|
+ private EmployeeApi employeeApi;
|
|
|
|
|
|
@Resource
|
|
|
private DeptApi deptApi;
|
|
|
@@ -86,10 +87,11 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
public Long stagingOaStamp(OaStampSaveReqVO stagingReqVO) {
|
|
|
// 登录人信息
|
|
|
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
- AdminUserRespDTO loginUser = adminUserApi.getUser(loginUserId);
|
|
|
- Objects.requireNonNull(loginUser, "登录用户不能为空");
|
|
|
- // 人信息
|
|
|
- AdminUserRespDTO employee = adminUserApi.getUser(loginUserId);
|
|
|
+ // 根据登录人查询出对应的员工信息
|
|
|
+ EmployeeRespDTO loginEmployee = employeeApi.getEmployeeByUserId(loginUserId);
|
|
|
+ if (loginEmployee == null) {
|
|
|
+ throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
|
|
|
+ }
|
|
|
|
|
|
OaStampDO oaStamp = BeanUtils.toBean(stagingReqVO, OaStampDO.class);
|
|
|
if (StringUtils.isBlank(oaStamp.getStampUuid())) {
|
|
|
@@ -97,18 +99,18 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
String uuid = IdUtil.fastSimpleUUID();
|
|
|
oaStamp.setStampUuid(uuid);
|
|
|
}
|
|
|
- if (employee != null) {
|
|
|
- oaStamp.setEmployeeId(loginUser.getId());
|
|
|
- oaStamp.setEmployeeName(loginUser.getNickname());
|
|
|
- oaStamp.setEmployeePhone(loginUser.getMobile());
|
|
|
- oaStamp.setDeptId(loginUser.getDeptId());
|
|
|
- oaStamp.setPosition("员工职位");
|
|
|
- oaStamp.setUserId(loginUser.getId());
|
|
|
- }
|
|
|
+ oaStamp.setEmployeeId(loginEmployee.getId());
|
|
|
+ oaStamp.setEmployeeName(loginEmployee.getName());
|
|
|
+ oaStamp.setEmployeePhone(loginEmployee.getPhone());
|
|
|
+ oaStamp.setDeptId(loginEmployee.getDeptId());
|
|
|
+ oaStamp.setPostId(loginEmployee.getPostId());
|
|
|
+ oaStamp.setPosition(loginEmployee.getPosition());
|
|
|
+ oaStamp.setUserId(loginUserId);
|
|
|
oaStamp.setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_STAGING);
|
|
|
oaStamp.setInfoSource("0");
|
|
|
- oaStamp.setApplyEmployeeId(loginUser.getId());
|
|
|
- oaStamp.setApplyEmployeeName(loginUser.getNickname());
|
|
|
+ oaStamp.setApplyEmployeeId(loginEmployee.getId());
|
|
|
+ oaStamp.setApplyEmployeeName(loginEmployee.getName());
|
|
|
+ oaStamp.setCreator(String.valueOf(loginEmployee.getId()));
|
|
|
List<Long> stampSealId = stagingReqVO.getStampSealId();
|
|
|
if (CollectionUtil.isNotEmpty(stampSealId)) {
|
|
|
oaStamp.setStampSealId(stampSealId.stream().map(String::valueOf).collect(Collectors.joining(",")));
|
|
|
@@ -138,13 +140,9 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
}
|
|
|
// 登录人信息
|
|
|
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
- AdminUserRespDTO loginUser = adminUserApi.getUser(loginUserId);
|
|
|
- if (loginUser == null) {
|
|
|
- throw exception(ErrorCodeConstants.OA_LOGIN_USER_NOT_EXISTS);
|
|
|
- }
|
|
|
- // 人信息
|
|
|
- AdminUserRespDTO employee = adminUserApi.getUser(loginUserId);
|
|
|
- if (employee == null) {
|
|
|
+ // 根据登录人查询出对应的员工信息
|
|
|
+ EmployeeRespDTO loginEmployee = employeeApi.getEmployeeByUserId(loginUserId);
|
|
|
+ if (loginEmployee == null) {
|
|
|
throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
|
|
|
}
|
|
|
|
|
|
@@ -155,15 +153,17 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
String uuid = IdUtil.fastSimpleUUID();
|
|
|
oaStamp.setStampUuid(uuid);
|
|
|
}
|
|
|
- oaStamp.setEmployeeId(employee.getId());
|
|
|
- oaStamp.setEmployeeName(employee.getNickname());
|
|
|
- oaStamp.setEmployeePhone(employee.getMobile());
|
|
|
- oaStamp.setDeptId(employee.getDeptId());
|
|
|
- oaStamp.setPosition("员工职位");
|
|
|
- oaStamp.setUserId(loginUser.getId());
|
|
|
+ oaStamp.setEmployeeId(loginEmployee.getId());
|
|
|
+ oaStamp.setEmployeeName(loginEmployee.getName());
|
|
|
+ oaStamp.setEmployeePhone(loginEmployee.getPhone());
|
|
|
+ oaStamp.setDeptId(loginEmployee.getDeptId());
|
|
|
+ oaStamp.setPostId(loginEmployee.getPostId());
|
|
|
+ oaStamp.setPosition(loginEmployee.getPosition());
|
|
|
+ oaStamp.setUserId(loginUserId);
|
|
|
oaStamp.setInfoSource("0");
|
|
|
- oaStamp.setApplyEmployeeId(loginUser.getId());
|
|
|
- oaStamp.setApplyEmployeeName(loginUser.getNickname());
|
|
|
+ oaStamp.setApplyEmployeeId(loginEmployee.getId());
|
|
|
+ oaStamp.setApplyEmployeeName(loginEmployee.getName());
|
|
|
+ oaStamp.setCreator(String.valueOf(loginEmployee.getId()));
|
|
|
List<Long> stampSealId = commitReqVO.getStampSealId();
|
|
|
if (CollectionUtil.isNotEmpty(stampSealId)) {
|
|
|
oaStamp.setStampSealId(stampSealId.stream().map(String::valueOf).collect(Collectors.joining(",")));
|
|
|
@@ -188,7 +188,7 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
List<Long> selectAssignees = commitReqVO.getStartUserSelectAssignees();
|
|
|
startUserSelectAssignees.put("approver", selectAssignees);
|
|
|
String processInstanceId = processInstanceApi
|
|
|
- .createProcessInstance(loginUser.getId(),
|
|
|
+ .createProcessInstance(loginEmployee.getId(),
|
|
|
new BpmProcessInstanceCreateReqDTO()
|
|
|
.setProcessDefinitionKey(PROCESS_KEY)
|
|
|
.setVariables(processInstanceVariables)
|
|
|
@@ -205,14 +205,14 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
agreeReqVO.setTaskStatus(Integer.valueOf(DictDataConstants.OA_AUDIT_STATUS_COMMITTED));
|
|
|
taskService.setVariable(task.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_COMMITTED);
|
|
|
taskService.setVariable(task.getId(), "auditPass", "true");
|
|
|
- bpmTaskService.approveTask(loginUserId, agreeReqVO);
|
|
|
+ bpmTaskService.approveTask(loginEmployee.getId(), agreeReqVO);
|
|
|
|
|
|
Task nextTask = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
|
|
|
if (nextTask == null) {
|
|
|
throw exception(ErrorCodeConstants.TASK_CREATE_FAIL_NO_START_SELECT_ASSIGNEE);
|
|
|
}
|
|
|
Long currentAuditEmployeeId = Long.valueOf(nextTask.getAssignee());
|
|
|
- AdminUserRespDTO currentAuditEmployee = adminUserApi.getUser(currentAuditEmployeeId);
|
|
|
+ EmployeeRespDTO currentAuditEmployee = employeeApi.getEmployeeById(currentAuditEmployeeId);
|
|
|
|
|
|
|
|
|
// 将工作流的流程实例ID、单据状态、最后一次审批时间、当前审批人更新到单据信息中
|
|
|
@@ -222,7 +222,7 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
.setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_COMMITTED)
|
|
|
.setFinalAuditDate(LocalDateTime.now())
|
|
|
.setCurrentAuditEmployeeId(currentAuditEmployeeId)
|
|
|
- .setCurrentAuditEmployeeName(currentAuditEmployee.getNickname())
|
|
|
+ .setCurrentAuditEmployeeName(currentAuditEmployee.getName())
|
|
|
.setStartUserSelectAssignees(selectAssignees.stream().map(String::valueOf).collect(Collectors.joining(","))));
|
|
|
// 保存业务uuid到附件中
|
|
|
saveFileList(commitReqVO.getFileIdList(), oaStamp.getStampUuid());
|
|
|
@@ -235,7 +235,11 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
public Long agreeOaStamp(BpmTaskApproveReqVO agreeReqVO) {
|
|
|
// 登录人信息
|
|
|
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
- // TODO DP 根据登录人查询出对应的员工信息
|
|
|
+ // 根据登录人查询出对应的员工信息
|
|
|
+ EmployeeRespDTO loginEmployee = employeeApi.getEmployeeByUserId(loginUserId);
|
|
|
+ if (loginEmployee == null) {
|
|
|
+ throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
|
|
|
+ }
|
|
|
|
|
|
Task currentTask = bpmTaskService.getTask(agreeReqVO.getId());
|
|
|
if (currentTask == null) {
|
|
|
@@ -263,19 +267,19 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
agreeReqVO.setReason(reason);
|
|
|
agreeReqVO.setTaskStatus(Integer.valueOf(DictDataConstants.OA_AUDIT_STATUS_AUDITING));
|
|
|
taskService.setVariable(agreeReqVO.getId(), "auditPass", "true");
|
|
|
- bpmTaskService.approveTask(loginUserId, agreeReqVO);
|
|
|
+ bpmTaskService.approveTask(loginEmployee.getId(), agreeReqVO);
|
|
|
|
|
|
Task nextTask = taskService.createTaskQuery().processInstanceId(currentTask.getProcessInstanceId()).singleResult();
|
|
|
OaStampDO oaStampDO = new OaStampDO();
|
|
|
if (nextTask != null) {
|
|
|
Long currentAuditEmployeeId = Long.valueOf(nextTask.getAssignee());
|
|
|
- AdminUserRespDTO currentAuditEmployee = adminUserApi.getUser(currentAuditEmployeeId);
|
|
|
+ EmployeeRespDTO currentAuditEmployee = employeeApi.getEmployeeById(currentAuditEmployeeId);
|
|
|
|
|
|
// 如果审批人重复,实际未结束,再次更新为审核中
|
|
|
taskService.setVariable(nextTask.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_AUDITING);
|
|
|
oaStampDO.setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_AUDITING)
|
|
|
.setCurrentAuditEmployeeId(currentAuditEmployeeId)
|
|
|
- .setCurrentAuditEmployeeName(currentAuditEmployee.getNickname())
|
|
|
+ .setCurrentAuditEmployeeName(currentAuditEmployee.getName())
|
|
|
.setFinalAuditDate(LocalDateTime.now())
|
|
|
.setId(oaStamp.getId());
|
|
|
|
|
|
@@ -301,7 +305,11 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
public Long disagreeOaStamp(BpmTaskReturnReqVO disagreeReqVO) {
|
|
|
// 登录人信息
|
|
|
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
- // TODO DP 根据登录人查询出对应的员工信息
|
|
|
+ // 根据登录人查询出对应的员工信息
|
|
|
+ EmployeeRespDTO loginEmployee = employeeApi.getEmployeeByUserId(loginUserId);
|
|
|
+ if (loginEmployee == null) {
|
|
|
+ throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
|
|
|
+ }
|
|
|
|
|
|
Task currentTask = bpmTaskService.getTask(disagreeReqVO.getId());
|
|
|
|
|
|
@@ -310,16 +318,16 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
disagreeReqVO.setTaskStatus(Integer.valueOf(DictDataConstants.OA_AUDIT_STATUS_RETURNED));
|
|
|
taskService.setVariable(disagreeReqVO.getId(), "auditPass", "false");
|
|
|
taskService.setVariable(disagreeReqVO.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_RETURNED);
|
|
|
- bpmTaskService.returnTask(loginUserId, disagreeReqVO);
|
|
|
+ bpmTaskService.returnTask(loginEmployee.getId(), disagreeReqVO);
|
|
|
|
|
|
Task nextTask = taskService.createTaskQuery().processInstanceId(currentTask.getProcessInstanceId()).singleResult();
|
|
|
Long currentAuditEmployeeId = Long.valueOf(nextTask.getAssignee());
|
|
|
- AdminUserRespDTO currentAuditEmployee = adminUserApi.getUser(currentAuditEmployeeId);
|
|
|
+ EmployeeRespDTO currentAuditEmployee = employeeApi.getEmployeeById(currentAuditEmployeeId);
|
|
|
|
|
|
// 更新单据状态,当前处理人,最后处理时间
|
|
|
LambdaUpdateWrapper<OaStampDO> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.set(OaStampDO::getCurrentAuditEmployeeId, currentAuditEmployeeId)
|
|
|
- .set(OaStampDO::getCurrentAuditEmployeeName, currentAuditEmployee.getNickname())
|
|
|
+ .set(OaStampDO::getCurrentAuditEmployeeName, currentAuditEmployee.getName())
|
|
|
.set(OaStampDO::getFinalAuditDate, LocalDateTime.now())
|
|
|
.set(OaStampDO::getAuditStatus, DictDataConstants.OA_AUDIT_STATUS_RETURNED)
|
|
|
.eq(OaStampDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
@@ -335,7 +343,11 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
public Long revocationOaStamp(BpmTaskApproveReqVO revocationReqVO) {
|
|
|
// 登录人信息
|
|
|
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
- // TODO DP 根据登录人查询出对应的员工信息
|
|
|
+ // 根据登录人查询出对应的员工信息
|
|
|
+ EmployeeRespDTO loginEmployee = employeeApi.getEmployeeByUserId(loginUserId);
|
|
|
+ if (loginEmployee == null) {
|
|
|
+ throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
|
|
|
+ }
|
|
|
|
|
|
Task currentTask = bpmTaskService.getTask(revocationReqVO.getId());
|
|
|
if (currentTask == null) {
|
|
|
@@ -345,7 +357,7 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
.eq(OaStampDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
OaStampDO oaStampDO = oaStampMapper.selectOne(lambdaQueryWrapper);
|
|
|
if (!DictDataConstants.OA_AUDIT_STATUS_COMMITTED.equals(oaStampDO.getAuditStatus())
|
|
|
- || !Objects.equals(String.valueOf(loginUserId), oaStampDO.getCreator())) {
|
|
|
+ || !Objects.equals(String.valueOf(loginEmployee.getId()), oaStampDO.getCreator())) {
|
|
|
throw ServiceExceptionUtil.exception(ErrorCodeConstants.TASK_REVOCATION_NOT_ALLOWED);
|
|
|
}
|
|
|
|
|
|
@@ -358,16 +370,16 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
returnReqVO.setReason(reason);
|
|
|
returnReqVO.setTaskStatus(Integer.valueOf(DictDataConstants.OA_AUDIT_STATUS_RECALLED));
|
|
|
taskService.setVariable(currentTask.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_RECALLED);
|
|
|
- bpmTaskService.revocationTask(loginUserId, returnReqVO);
|
|
|
+ bpmTaskService.revocationTask(loginEmployee.getId(), returnReqVO);
|
|
|
|
|
|
Task nextTask = taskService.createTaskQuery().processInstanceId(currentTask.getProcessInstanceId()).singleResult();
|
|
|
Long currentAuditEmployeeId = Long.valueOf(nextTask.getAssignee());
|
|
|
- AdminUserRespDTO currentAuditEmployee = adminUserApi.getUser(currentAuditEmployeeId);
|
|
|
+ EmployeeRespDTO currentAuditEmployee = employeeApi.getEmployeeById(currentAuditEmployeeId);
|
|
|
|
|
|
// 更新单据状态,当前处理人,最后处理时间
|
|
|
LambdaUpdateWrapper<OaStampDO> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.set(OaStampDO::getCurrentAuditEmployeeId, currentAuditEmployeeId)
|
|
|
- .set(OaStampDO::getCurrentAuditEmployeeName, currentAuditEmployee.getNickname())
|
|
|
+ .set(OaStampDO::getCurrentAuditEmployeeName, currentAuditEmployee.getName())
|
|
|
.set(OaStampDO::getFinalAuditDate, LocalDateTime.now())
|
|
|
.set(OaStampDO::getAuditStatus, DictDataConstants.OA_AUDIT_STATUS_RECALLED)
|
|
|
.eq(OaStampDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
@@ -386,13 +398,9 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
}
|
|
|
// 登录人信息
|
|
|
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
- AdminUserRespDTO loginUser = adminUserApi.getUser(loginUserId);
|
|
|
- if (loginUser == null) {
|
|
|
- throw exception(ErrorCodeConstants.OA_LOGIN_USER_NOT_EXISTS);
|
|
|
- }
|
|
|
- // 人信息
|
|
|
- AdminUserRespDTO employee = adminUserApi.getUser(loginUserId);
|
|
|
- if (employee == null) {
|
|
|
+ // 根据登录人查询出对应的员工信息
|
|
|
+ EmployeeRespDTO loginEmployee = employeeApi.getEmployeeByUserId(loginUserId);
|
|
|
+ if (loginEmployee == null) {
|
|
|
throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
|
|
|
}
|
|
|
|
|
|
@@ -401,14 +409,15 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
oaStampNew.setStampSealId(oaStampOld.getStampUuid())
|
|
|
.setProcInstId(oaStampOld.getProcInstId());
|
|
|
|
|
|
- oaStampNew.setEmployeeId(employee.getId());
|
|
|
- oaStampNew.setEmployeeName(employee.getNickname());
|
|
|
- oaStampNew.setEmployeePhone(employee.getMobile());
|
|
|
- oaStampNew.setDeptId(employee.getDeptId());
|
|
|
- oaStampNew.setPosition("员工职位");
|
|
|
- oaStampNew.setUserId(loginUser.getId());
|
|
|
- oaStampNew.setApplyEmployeeId(loginUser.getId());
|
|
|
- oaStampNew.setApplyEmployeeName(loginUser.getNickname());
|
|
|
+ oaStampNew.setEmployeeId(loginEmployee.getId());
|
|
|
+ oaStampNew.setEmployeeName(loginEmployee.getName());
|
|
|
+ oaStampNew.setEmployeePhone(loginEmployee.getPhone());
|
|
|
+ oaStampNew.setDeptId(loginEmployee.getDeptId());
|
|
|
+ oaStampNew.setPostId(loginEmployee.getPostId());
|
|
|
+ oaStampNew.setPosition(loginEmployee.getPosition());
|
|
|
+ oaStampNew.setUserId(loginUserId);
|
|
|
+ oaStampNew.setApplyEmployeeId(loginEmployee.getId());
|
|
|
+ oaStampNew.setApplyEmployeeName(loginEmployee.getName());
|
|
|
List<Long> stampSealId = reCommitReqVO.getStampSealId();
|
|
|
if (CollectionUtil.isNotEmpty(stampSealId)) {
|
|
|
oaStampNew.setStampSealId(stampSealId.stream().map(String::valueOf).collect(Collectors.joining(",")));
|
|
|
@@ -433,14 +442,14 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
taskService.setVariable(currentTask.getId(), "auditPass", "true");
|
|
|
taskService.setVariable(currentTask.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_COMMITTED);
|
|
|
// 再次提交,和审批通过逻辑相同
|
|
|
- bpmTaskService.approveTask(loginUserId, approveReqVO);
|
|
|
+ bpmTaskService.approveTask(loginEmployee.getId(), approveReqVO);
|
|
|
|
|
|
Task nextTask = taskService.createTaskQuery().processInstanceId(currentTask.getProcessInstanceId()).singleResult();
|
|
|
Long currentAuditEmployeeId = Long.valueOf(nextTask.getAssignee());
|
|
|
- AdminUserRespDTO currentAuditEmployee = adminUserApi.getUser(currentAuditEmployeeId);
|
|
|
+ EmployeeRespDTO currentAuditEmployee = employeeApi.getEmployeeById(currentAuditEmployeeId);
|
|
|
oaStampNew.setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_COMMITTED)
|
|
|
.setCurrentAuditEmployeeId(currentAuditEmployeeId)
|
|
|
- .setCurrentAuditEmployeeName(currentAuditEmployee.getNickname())
|
|
|
+ .setCurrentAuditEmployeeName(currentAuditEmployee.getName())
|
|
|
.setFinalAuditDate(LocalDateTime.now());
|
|
|
oaStampMapper.updateById(oaStampNew);
|
|
|
|
|
|
@@ -458,7 +467,11 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
}
|
|
|
// 登录人信息
|
|
|
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
- // TODO DP 根据登录人查询出对应的员工信息
|
|
|
+ // 根据登录人查询出对应的员工信息
|
|
|
+ EmployeeRespDTO loginEmployee = employeeApi.getEmployeeByUserId(loginUserId);
|
|
|
+ if (loginEmployee == null) {
|
|
|
+ throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
|
|
|
+ }
|
|
|
|
|
|
OaStampDO oaStampDO = oaStampMapper.selectById(id);
|
|
|
if (!DictDataConstants.OA_AUDIT_STATUS_RETURNED.equals(oaStampDO.getAuditStatus())
|
|
|
@@ -474,7 +487,7 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
taskService.setVariable(currentTask.getId(), "auditPass", "false");
|
|
|
taskService.setVariable(currentTask.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_CLOSED);
|
|
|
// 关闭,使用审批通过的方法实现
|
|
|
- bpmTaskService.approveTask(loginUserId, approveReqVO);
|
|
|
+ bpmTaskService.approveTask(loginEmployee.getId(), approveReqVO);
|
|
|
|
|
|
LambdaUpdateWrapper<OaStampDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
|
|
lambdaUpdateWrapper.set(OaStampDO::getAuditStatus, DictDataConstants.OA_AUDIT_STATUS_CLOSED)
|
|
|
@@ -498,7 +511,11 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
public OaStampRespVO getOaStamp(Long id) {
|
|
|
// 登录人信息
|
|
|
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
- // TODO DP 根据登录人查询出对应的员工信息
|
|
|
+ // 根据登录人查询出对应的员工信息
|
|
|
+ EmployeeRespDTO loginEmployee = employeeApi.getEmployeeByUserId(loginUserId);
|
|
|
+ if (loginEmployee == null) {
|
|
|
+ throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
|
|
|
+ }
|
|
|
|
|
|
OaStampDO oaStampDO = validateOaStampExists(id);
|
|
|
OaStampRespVO oaStampRespVO = BeanUtils.toBean(oaStampDO, OaStampRespVO.class);
|
|
|
@@ -523,7 +540,7 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
if (StrUtil.isNotBlank(procInstId)) {
|
|
|
Task task = taskService.createTaskQuery()
|
|
|
.processInstanceId(procInstId)
|
|
|
- .taskAssignee(String.valueOf(loginUserId))
|
|
|
+ .taskAssignee(String.valueOf(loginEmployee.getId()))
|
|
|
.singleResult();
|
|
|
if (DictDataConstants.OA_AUDIT_STATUS_COMMITTED.equals(oaStampDO.getAuditStatus())) {
|
|
|
// 如果是已提交,不限制任务处理人是当前登录人,用于直接撤回
|
|
|
@@ -549,16 +566,15 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
// 审批人
|
|
|
String startUserSelectAssignees = oaStampDO.getStartUserSelectAssignees();
|
|
|
if (StrUtil.isNotEmpty(startUserSelectAssignees)) {
|
|
|
- List<Long> userIdList = Arrays.stream(startUserSelectAssignees.split(","))
|
|
|
+ List<Long> employeeIdList = Arrays.stream(startUserSelectAssignees.split(","))
|
|
|
.map(Long::valueOf).collect(Collectors.toList());
|
|
|
- List<AdminUserRespDTO> userList = adminUserApi.getUserList(userIdList);
|
|
|
- List<AdminUserRespDTO> auditUserList = new ArrayList<>();
|
|
|
- for (Long userId : userIdList) {
|
|
|
- for (AdminUserRespDTO adminUserRespDTO : userList) {
|
|
|
- if (Objects.equals(userId, adminUserRespDTO.getId())) {
|
|
|
- auditUserList.add(adminUserRespDTO);
|
|
|
- break;
|
|
|
- }
|
|
|
+ List<EmployeeRespDTO> employeeRespDTOList = employeeApi.getEmployeeListByIds(employeeIdList);
|
|
|
+ Map<Long, EmployeeRespDTO> longEmployeeRespDTOMap = CollectionUtils.convertMap(employeeRespDTOList, EmployeeRespDTO::getId);
|
|
|
+ List<EmployeeRespDTO> auditUserList = new ArrayList<>();
|
|
|
+ for (Long employeeId : employeeIdList) {
|
|
|
+ EmployeeRespDTO employeeRespDTO = longEmployeeRespDTOMap.get(employeeId);
|
|
|
+ if (employeeRespDTO != null) {
|
|
|
+ auditUserList.add(employeeRespDTO);
|
|
|
}
|
|
|
}
|
|
|
oaStampRespVO.setAuditUserList(auditUserList);
|
|
|
@@ -601,16 +617,15 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
// 审批人
|
|
|
String startUserSelectAssignees = oaStampDO.getStartUserSelectAssignees();
|
|
|
if (StrUtil.isNotEmpty(startUserSelectAssignees)) {
|
|
|
- List<Long> userIdList = Arrays.stream(startUserSelectAssignees.split(","))
|
|
|
+ List<Long> employeeIdList = Arrays.stream(startUserSelectAssignees.split(","))
|
|
|
.map(Long::valueOf).collect(Collectors.toList());
|
|
|
- List<AdminUserRespDTO> userList = adminUserApi.getUserList(userIdList);
|
|
|
- List<AdminUserRespDTO> auditUserList = new ArrayList<>();
|
|
|
- for (Long userId : userIdList) {
|
|
|
- for (AdminUserRespDTO adminUserRespDTO : userList) {
|
|
|
- if (Objects.equals(userId, adminUserRespDTO.getId())) {
|
|
|
- auditUserList.add(adminUserRespDTO);
|
|
|
- break;
|
|
|
- }
|
|
|
+ List<EmployeeRespDTO> employeeRespDTOList = employeeApi.getEmployeeListByIds(employeeIdList);
|
|
|
+ Map<Long, EmployeeRespDTO> longEmployeeRespDTOMap = CollectionUtils.convertMap(employeeRespDTOList, EmployeeRespDTO::getId);
|
|
|
+ List<EmployeeRespDTO> auditUserList = new ArrayList<>();
|
|
|
+ for (Long employeeId : employeeIdList) {
|
|
|
+ EmployeeRespDTO employeeRespDTO = longEmployeeRespDTOMap.get(employeeId);
|
|
|
+ if (employeeRespDTO != null) {
|
|
|
+ auditUserList.add(employeeRespDTO);
|
|
|
}
|
|
|
}
|
|
|
oaStampRespVO.setAuditUserList(auditUserList);
|
|
|
@@ -627,13 +642,12 @@ public class OaStampServiceImpl implements OaStampService {
|
|
|
List<OaStampRespVO> oaStampRespVOList = oaStampRespVOPageResult.getList();
|
|
|
if (CollectionUtil.isNotEmpty(oaStampRespVOList)) {
|
|
|
List<Long> employeeIdList = oaStampRespVOList.stream().map(OaStampRespVO::getCurrentAuditEmployeeId).collect(Collectors.toList());
|
|
|
- List<AdminUserRespDTO> employeeList = adminUserApi.getUserList(employeeIdList);
|
|
|
+ List<EmployeeRespDTO> employeeRespDTOList = employeeApi.getEmployeeListByIds(employeeIdList);
|
|
|
+ Map<Long, EmployeeRespDTO> longEmployeeRespDTOMap = CollectionUtils.convertMap(employeeRespDTOList, EmployeeRespDTO::getId);
|
|
|
for (OaStampRespVO respVO : oaStampRespVOList) {
|
|
|
- for (AdminUserRespDTO employee : employeeList) {
|
|
|
- if (employee.getId() != null && employee.getId().equals(respVO.getCurrentAuditEmployeeId())) {
|
|
|
- respVO.setCurrentAuditEmployeeName(employee.getNickname());
|
|
|
- break;
|
|
|
- }
|
|
|
+ EmployeeRespDTO employeeRespDTO = longEmployeeRespDTOMap.get(respVO.getCurrentAuditEmployeeId());
|
|
|
+ if (employeeRespDTO != null) {
|
|
|
+ respVO.setCurrentAuditEmployeeName(employeeRespDTO.getName());
|
|
|
}
|
|
|
}
|
|
|
|