|
|
@@ -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 OaOutServiceImpl implements OaOutService {
|
|
|
private FileApi fileApi;
|
|
|
|
|
|
@Resource
|
|
|
- private AdminUserApi adminUserApi;
|
|
|
+ private EmployeeApi employeeApi;
|
|
|
|
|
|
@Resource
|
|
|
private DeptApi deptApi;
|
|
|
@@ -86,10 +87,11 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
public Long stagingOaOut(OaOutSaveReqVO 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);
|
|
|
+ }
|
|
|
|
|
|
OaOutDO oaOut = BeanUtils.toBean(stagingReqVO, OaOutDO.class);
|
|
|
if (StringUtils.isBlank(oaOut.getOutId())) {
|
|
|
@@ -97,18 +99,18 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
String uuid = IdUtil.fastSimpleUUID();
|
|
|
oaOut.setOutId(uuid);
|
|
|
}
|
|
|
- if (employee != null) {
|
|
|
- oaOut.setEmployeeId(loginUser.getId());
|
|
|
- oaOut.setEmployeeName(loginUser.getNickname());
|
|
|
- oaOut.setEmployeePhone(loginUser.getMobile());
|
|
|
- oaOut.setDeptId(loginUser.getDeptId());
|
|
|
- oaOut.setPosition("员工职位");
|
|
|
- oaOut.setUserId(loginUser.getId());
|
|
|
- }
|
|
|
+ oaOut.setEmployeeId(loginEmployee.getId());
|
|
|
+ oaOut.setEmployeeName(loginEmployee.getName());
|
|
|
+ oaOut.setEmployeePhone(loginEmployee.getPhone());
|
|
|
+ oaOut.setDeptId(loginEmployee.getDeptId());
|
|
|
+ oaOut.setPostId(loginEmployee.getPostId());
|
|
|
+ oaOut.setPosition(loginEmployee.getPosition());
|
|
|
+ oaOut.setUserId(loginUserId);
|
|
|
oaOut.setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_STAGING);
|
|
|
oaOut.setInfoSource("0");
|
|
|
- oaOut.setApplyEmployeeId(loginUser.getId());
|
|
|
- oaOut.setApplyEmployeeName(loginUser.getNickname());
|
|
|
+ oaOut.setApplyEmployeeId(loginEmployee.getId());
|
|
|
+ oaOut.setApplyEmployeeName(loginEmployee.getName());
|
|
|
+ oaOut.setCreator(String.valueOf(loginEmployee.getId()));
|
|
|
// 暂存不保存审批人信息
|
|
|
oaOut.setStartUserSelectAssignees(null);
|
|
|
// 保存或更新表单信息
|
|
|
@@ -132,13 +134,9 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
}
|
|
|
// 登录人信息
|
|
|
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);
|
|
|
}
|
|
|
|
|
|
@@ -149,15 +147,17 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
String uuid = IdUtil.fastSimpleUUID();
|
|
|
oaOut.setOutId(uuid);
|
|
|
}
|
|
|
- oaOut.setEmployeeId(employee.getId());
|
|
|
- oaOut.setEmployeeName(employee.getNickname());
|
|
|
- oaOut.setEmployeePhone(employee.getMobile());
|
|
|
- oaOut.setDeptId(employee.getDeptId());
|
|
|
- oaOut.setPosition("员工职位");
|
|
|
- oaOut.setUserId(loginUser.getId());
|
|
|
+ oaOut.setEmployeeId(loginEmployee.getId());
|
|
|
+ oaOut.setEmployeeName(loginEmployee.getName());
|
|
|
+ oaOut.setEmployeePhone(loginEmployee.getPhone());
|
|
|
+ oaOut.setDeptId(loginEmployee.getDeptId());
|
|
|
+ oaOut.setPostId(loginEmployee.getPostId());
|
|
|
+ oaOut.setPosition(loginEmployee.getPosition());
|
|
|
+ oaOut.setUserId(loginUserId);
|
|
|
oaOut.setInfoSource("0");
|
|
|
- oaOut.setApplyEmployeeId(loginUser.getId());
|
|
|
- oaOut.setApplyEmployeeName(loginUser.getNickname());
|
|
|
+ oaOut.setApplyEmployeeId(loginEmployee.getId());
|
|
|
+ oaOut.setApplyEmployeeName(loginEmployee.getName());
|
|
|
+ oaOut.setCreator(String.valueOf(loginEmployee.getId()));
|
|
|
// 保存或更新表单信息
|
|
|
if (oaOut.getId() == null) {
|
|
|
oaOutMapper.insert(oaOut);
|
|
|
@@ -176,7 +176,7 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
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)
|
|
|
@@ -193,14 +193,14 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
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、单据状态、最后一次审批时间、当前审批人更新到单据信息中
|
|
|
@@ -210,7 +210,7 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
.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(), oaOut.getOutId());
|
|
|
@@ -223,7 +223,11 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
public Long agreeOaOut(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) {
|
|
|
@@ -251,19 +255,19 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
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();
|
|
|
OaOutDO oaOutDO = new OaOutDO();
|
|
|
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);
|
|
|
oaOutDO.setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_AUDITING)
|
|
|
.setCurrentAuditEmployeeId(currentAuditEmployeeId)
|
|
|
- .setCurrentAuditEmployeeName(currentAuditEmployee.getNickname())
|
|
|
+ .setCurrentAuditEmployeeName(currentAuditEmployee.getName())
|
|
|
.setFinalAuditDate(LocalDateTime.now())
|
|
|
.setId(oaOut.getId());
|
|
|
|
|
|
@@ -274,7 +278,7 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
.setFinalAuditDate(LocalDateTime.now())
|
|
|
.setId(oaOut.getId());
|
|
|
|
|
|
- // TODO 复制业务单据信息到业务模块单据表
|
|
|
+ // TODO DP 复制业务单据信息到业务模块单据表
|
|
|
|
|
|
}
|
|
|
oaOutMapper.updateById(oaOutDO);
|
|
|
@@ -289,7 +293,11 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
public Long disagreeOaOut(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());
|
|
|
|
|
|
@@ -298,16 +306,16 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
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<OaOutDO> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.set(OaOutDO::getCurrentAuditEmployeeId, currentAuditEmployeeId)
|
|
|
- .set(OaOutDO::getCurrentAuditEmployeeName, currentAuditEmployee.getNickname())
|
|
|
+ .set(OaOutDO::getCurrentAuditEmployeeName, currentAuditEmployee.getName())
|
|
|
.set(OaOutDO::getFinalAuditDate, LocalDateTime.now())
|
|
|
.set(OaOutDO::getAuditStatus, DictDataConstants.OA_AUDIT_STATUS_RETURNED)
|
|
|
.eq(OaOutDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
@@ -323,7 +331,11 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
public Long revocationOaOut(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) {
|
|
|
@@ -333,7 +345,7 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
.eq(OaOutDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
OaOutDO oaOutDO = oaOutMapper.selectOne(lambdaQueryWrapper);
|
|
|
if (!DictDataConstants.OA_AUDIT_STATUS_COMMITTED.equals(oaOutDO.getAuditStatus())
|
|
|
- || !Objects.equals(String.valueOf(loginUserId), oaOutDO.getCreator())) {
|
|
|
+ || !Objects.equals(String.valueOf(loginEmployee.getId()), oaOutDO.getCreator())) {
|
|
|
throw ServiceExceptionUtil.exception(ErrorCodeConstants.TASK_REVOCATION_NOT_ALLOWED);
|
|
|
}
|
|
|
|
|
|
@@ -346,16 +358,16 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
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<OaOutDO> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.set(OaOutDO::getCurrentAuditEmployeeId, currentAuditEmployeeId)
|
|
|
- .set(OaOutDO::getCurrentAuditEmployeeName, currentAuditEmployee.getNickname())
|
|
|
+ .set(OaOutDO::getCurrentAuditEmployeeName, currentAuditEmployee.getName())
|
|
|
.set(OaOutDO::getFinalAuditDate, LocalDateTime.now())
|
|
|
.set(OaOutDO::getAuditStatus, DictDataConstants.OA_AUDIT_STATUS_RECALLED)
|
|
|
.eq(OaOutDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
@@ -374,13 +386,9 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
}
|
|
|
// 登录人信息
|
|
|
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);
|
|
|
}
|
|
|
|
|
|
@@ -389,14 +397,15 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
oaOutNew.setOutId(oaOutOld.getOutId())
|
|
|
.setProcInstId(oaOutOld.getProcInstId());
|
|
|
|
|
|
- oaOutNew.setEmployeeId(employee.getId());
|
|
|
- oaOutNew.setEmployeeName(employee.getNickname());
|
|
|
- oaOutNew.setEmployeePhone(employee.getMobile());
|
|
|
- oaOutNew.setDeptId(employee.getDeptId());
|
|
|
- oaOutNew.setPosition("员工职位");
|
|
|
- oaOutNew.setUserId(loginUser.getId());
|
|
|
- oaOutNew.setApplyEmployeeId(loginUser.getId());
|
|
|
- oaOutNew.setApplyEmployeeName(loginUser.getNickname());
|
|
|
+ oaOutNew.setEmployeeId(loginEmployee.getId());
|
|
|
+ oaOutNew.setEmployeeName(loginEmployee.getName());
|
|
|
+ oaOutNew.setEmployeePhone(loginEmployee.getPhone());
|
|
|
+ oaOutNew.setDeptId(loginEmployee.getDeptId());
|
|
|
+ oaOutNew.setPostId(loginEmployee.getPostId());
|
|
|
+ oaOutNew.setPosition(loginEmployee.getPosition());
|
|
|
+ oaOutNew.setUserId(loginUserId);
|
|
|
+ oaOutNew.setApplyEmployeeId(loginEmployee.getId());
|
|
|
+ oaOutNew.setApplyEmployeeName(loginEmployee.getName());
|
|
|
|
|
|
Task currentTask = taskService.createTaskQuery().processInstanceId(oaOutNew.getProcInstId()).singleResult();
|
|
|
BpmTaskApproveReqVO approveReqVO = new BpmTaskApproveReqVO();
|
|
|
@@ -415,14 +424,14 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
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);
|
|
|
oaOutNew.setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_COMMITTED)
|
|
|
.setCurrentAuditEmployeeId(currentAuditEmployeeId)
|
|
|
- .setCurrentAuditEmployeeName(currentAuditEmployee.getNickname())
|
|
|
+ .setCurrentAuditEmployeeName(currentAuditEmployee.getName())
|
|
|
.setFinalAuditDate(LocalDateTime.now());
|
|
|
oaOutMapper.updateById(oaOutNew);
|
|
|
|
|
|
@@ -440,7 +449,11 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
}
|
|
|
// 登录人信息
|
|
|
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
- // TODO DP 根据登录人查询出对应的员工信息
|
|
|
+ // 根据登录人查询出对应的员工信息
|
|
|
+ EmployeeRespDTO loginEmployee = employeeApi.getEmployeeByUserId(loginUserId);
|
|
|
+ if (loginEmployee == null) {
|
|
|
+ throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
|
|
|
+ }
|
|
|
|
|
|
OaOutDO oaOutDO = oaOutMapper.selectById(id);
|
|
|
if (!DictDataConstants.OA_AUDIT_STATUS_RETURNED.equals(oaOutDO.getAuditStatus())
|
|
|
@@ -456,7 +469,7 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
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<OaOutDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
|
|
lambdaUpdateWrapper.set(OaOutDO::getAuditStatus, DictDataConstants.OA_AUDIT_STATUS_CLOSED)
|
|
|
@@ -480,7 +493,11 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
public OaOutRespVO getOaOut(Long id) {
|
|
|
// 登录人信息
|
|
|
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
- // TODO DP 根据登录人查询出对应的员工信息
|
|
|
+ // 根据登录人查询出对应的员工信息
|
|
|
+ EmployeeRespDTO loginEmployee = employeeApi.getEmployeeByUserId(loginUserId);
|
|
|
+ if (loginEmployee == null) {
|
|
|
+ throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
|
|
|
+ }
|
|
|
|
|
|
OaOutDO oaOutDO = validateOaOutExists(id);
|
|
|
OaOutRespVO oaOutRespVO = BeanUtils.toBean(oaOutDO, OaOutRespVO.class);
|
|
|
@@ -495,7 +512,7 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
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(oaOutDO.getAuditStatus())) {
|
|
|
// 如果是已提交,不限制任务处理人是当前登录人,用于直接撤回
|
|
|
@@ -521,16 +538,15 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
// 审批人
|
|
|
String startUserSelectAssignees = oaOutDO.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);
|
|
|
}
|
|
|
}
|
|
|
oaOutRespVO.setAuditUserList(auditUserList);
|
|
|
@@ -563,16 +579,15 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
// 审批人
|
|
|
String startUserSelectAssignees = oaOutDO.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);
|
|
|
}
|
|
|
}
|
|
|
oaOutRespVO.setAuditUserList(auditUserList);
|
|
|
@@ -589,13 +604,12 @@ public class OaOutServiceImpl implements OaOutService {
|
|
|
List<OaOutRespVO> oaOutRespVOList = oaOutRespVOPageResult.getList();
|
|
|
if (CollectionUtil.isNotEmpty(oaOutRespVOList)) {
|
|
|
List<Long> employeeIdList = oaOutRespVOList.stream().map(OaOutRespVO::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 (OaOutRespVO respVO : oaOutRespVOList) {
|
|
|
- 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());
|
|
|
}
|
|
|
}
|
|
|
|