|
|
@@ -2,19 +2,34 @@ package cn.iocoder.yudao.module.bpm.service.oa.renew;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
+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.object.BeanUtils;
|
|
|
+import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
|
|
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
|
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewRespVO;
|
|
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewSaveReqVO;
|
|
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskApproveReqVO;
|
|
|
+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.dal.dataobject.oa.renew.OaRenewDO;
|
|
|
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.renew.OaRenewMapper;
|
|
|
+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.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 com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.flowable.engine.TaskService;
|
|
|
import org.flowable.task.api.Task;
|
|
|
@@ -24,10 +39,8 @@ import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
+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.OA_RENEW_NOT_EXISTS;
|
|
|
@@ -39,7 +52,7 @@ import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_RENEW_NOT_
|
|
|
*/
|
|
|
@Service
|
|
|
@Validated
|
|
|
-public class OaRenewServiceImpl extends ServiceImpl<OaRenewMapper, OaRenewDO> implements OaRenewService {
|
|
|
+public class OaRenewServiceImpl implements OaRenewService {
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -59,90 +72,215 @@ public class OaRenewServiceImpl extends ServiceImpl<OaRenewMapper, OaRenewDO> im
|
|
|
@Resource
|
|
|
private TaskService taskService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private FileApi fileApi;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private AdminUserApi adminUserApi;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private DeptApi deptApi;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Long startOaRenew(Long userId, OaRenewSaveReqVO createReqVO) {
|
|
|
- //判断是否已经发起流程
|
|
|
- Boolean auditPass = createReqVO.getAuditPass();
|
|
|
- // 创建单据uuid
|
|
|
- String uuid = IdUtil.fastSimpleUUID();
|
|
|
- OaRenewDO oaRenew = BeanUtils.toBean(createReqVO, OaRenewDO.class);
|
|
|
+ public Long stagingOaRenew(OaRenewSaveReqVO stagingReqVO) {
|
|
|
+ // 登录人信息
|
|
|
+ Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
+ AdminUserRespDTO loginUser = adminUserApi.getUser(loginUserId);
|
|
|
+ Objects.requireNonNull(loginUser, "登录用户不能为空");
|
|
|
+ // 转正人信息
|
|
|
+ AdminUserRespDTO employee = adminUserApi.getUser(stagingReqVO.getEmployeeId());
|
|
|
+
|
|
|
+ OaRenewDO oaRenew = BeanUtils.toBean(stagingReqVO, OaRenewDO.class);
|
|
|
if (StringUtils.isBlank(oaRenew.getRenewId())) {
|
|
|
+ // 创建单据uuid
|
|
|
+ String uuid = IdUtil.fastSimpleUUID();
|
|
|
oaRenew.setRenewId(uuid);
|
|
|
}
|
|
|
+ if (employee != null) {
|
|
|
+ oaRenew.setEmployeeId(loginUser.getId());
|
|
|
+ oaRenew.setEmployeeName(loginUser.getNickname());
|
|
|
+ oaRenew.setEmployeePhone(loginUser.getMobile());
|
|
|
+ oaRenew.setDeptId(loginUser.getDeptId());
|
|
|
+ oaRenew.setPosition("员工职位");
|
|
|
+ oaRenew.setOldContractStartDate("2023-01-01");
|
|
|
+ oaRenew.setOldContractEndDate("2023-12-31");
|
|
|
+ oaRenew.setUserId(loginUser.getId());
|
|
|
+ }
|
|
|
+ oaRenew.setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_STAGING);
|
|
|
+ oaRenew.setInfoSource("0");
|
|
|
+ oaRenew.setApplyEmployeeId(loginUser.getId());
|
|
|
+ oaRenew.setApplyEmployeeName(loginUser.getNickname());
|
|
|
+ // 暂存不保存审批人信息
|
|
|
+ oaRenew.setStartUserSelectAssignees(null);
|
|
|
// 保存或更新表单信息
|
|
|
- this.saveOrUpdate(oaRenew);
|
|
|
-
|
|
|
- // 提交
|
|
|
- if (auditPass) {
|
|
|
- // 发起 BPM 流程
|
|
|
- Map<String, Object> processInstanceVariables = new HashMap<>();
|
|
|
- processInstanceVariables.put("auditPass", auditPass);
|
|
|
- //添加审批人信息
|
|
|
- Map<String, List<Long>> startUserSelectAssignees = new HashMap<>();
|
|
|
- startUserSelectAssignees.put("approver", createReqVO.getStartUserSelectAssignees());
|
|
|
- String processInstanceId = processInstanceApi
|
|
|
- .createProcessInstance(userId,
|
|
|
- new BpmProcessInstanceCreateReqDTO()
|
|
|
- .setProcessDefinitionKey(PROCESS_KEY)
|
|
|
- .setVariables(processInstanceVariables)
|
|
|
- .setBusinessKey(String.valueOf(oaRenew.getId()))
|
|
|
- .setStartUserSelectAssignees(startUserSelectAssignees));
|
|
|
-
|
|
|
- //获取下一个审批人
|
|
|
- Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
|
|
|
-
|
|
|
- // 将工作流的编号,单据状态 最后一次审批时间 当前审批人 更新到 OA 转正中
|
|
|
- oaRenewMapper.updateById(new OaRenewDO()
|
|
|
- .setId(oaRenew.getId())
|
|
|
- .setProcInstId(processInstanceId)
|
|
|
- .setAuditStatus("1")
|
|
|
- .setRenewId(uuid)
|
|
|
- .setFinalAuditDate(LocalDateTime.now())
|
|
|
- .setCurrentAuditEmployeeId(Long.valueOf(task.getAssignee())));
|
|
|
+ if (oaRenew.getId() == null) {
|
|
|
+ oaRenewMapper.insert(oaRenew);
|
|
|
+ } else {
|
|
|
+ oaRenewMapper.updateById(oaRenew);
|
|
|
+ }
|
|
|
+ // 保存业务uuid到附件中
|
|
|
+ saveFileList(stagingReqVO.getFileIdList(), oaRenew.getRenewId());
|
|
|
|
|
|
- // TODO 发送通知
|
|
|
+ return oaRenew.getId();
|
|
|
+ }
|
|
|
|
|
|
- }else {
|
|
|
- // 暂存,不发起流程
|
|
|
- // 将单据状态 更新到 OA转正中
|
|
|
- oaRenewMapper.updateById(new OaRenewDO()
|
|
|
- .setId(oaRenew.getId())
|
|
|
- .setAuditStatus("0"));
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public Long commitOaRenew(OaRenewSaveReqVO commitReqVO) {
|
|
|
+ if (CollectionUtil.isEmpty(commitReqVO.getStartUserSelectAssignees())) {
|
|
|
+ throw exception(ErrorCodeConstants.TASK_CREATE_FAIL_NO_START_SELECT_ASSIGNEE);
|
|
|
+ }
|
|
|
+ // 登录人信息
|
|
|
+ Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
+ AdminUserRespDTO loginUser = adminUserApi.getUser(loginUserId);
|
|
|
+ if (loginUser == null) {
|
|
|
+ throw exception(ErrorCodeConstants.OA_LOGIN_USER_NOT_EXISTS);
|
|
|
+ }
|
|
|
+ // 转正人信息
|
|
|
+ AdminUserRespDTO employee = adminUserApi.getUser(commitReqVO.getEmployeeId());
|
|
|
+ if (employee == null) {
|
|
|
+ throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
|
|
|
}
|
|
|
|
|
|
- // TODO 保存或更新附件uuid
|
|
|
- if (CollectionUtil.isNotEmpty(createReqVO.getFileIdList())) {
|
|
|
+
|
|
|
+ OaRenewDO oaRenew = BeanUtils.toBean(commitReqVO, OaRenewDO.class);
|
|
|
+ if (StringUtils.isBlank(oaRenew.getRenewId())) {
|
|
|
+ // 创建单据uuid
|
|
|
+ String uuid = IdUtil.fastSimpleUUID();
|
|
|
+ oaRenew.setRenewId(uuid);
|
|
|
}
|
|
|
+ oaRenew.setEmployeeId(employee.getId());
|
|
|
+ oaRenew.setEmployeeName(employee.getNickname());
|
|
|
+ oaRenew.setEmployeePhone(employee.getMobile());
|
|
|
+ oaRenew.setDeptId(employee.getDeptId());
|
|
|
+ oaRenew.setPosition("员工职位");
|
|
|
+ oaRenew.setOldContractStartDate("2023-01-01");
|
|
|
+ oaRenew.setOldContractEndDate("2023-12-31");
|
|
|
+ oaRenew.setUserId(loginUser.getId());
|
|
|
+ oaRenew.setInfoSource("0");
|
|
|
+ oaRenew.setApplyEmployeeId(loginUser.getId());
|
|
|
+ oaRenew.setApplyEmployeeName(loginUser.getNickname());
|
|
|
+ // 保存或更新表单信息
|
|
|
+ if (oaRenew.getId() == null) {
|
|
|
+ oaRenewMapper.insert(oaRenew);
|
|
|
+ } else {
|
|
|
+ OaRenewDO oaRenewDO = oaRenewMapper.selectById(oaRenew.getId());
|
|
|
+ if (StrUtil.isNotBlank(oaRenewDO.getProcInstId())) {
|
|
|
+ throw exception(ErrorCodeConstants.PROCESS_INSTANCE_CREATE_FAIL_HAS_PROCESS);
|
|
|
+ }
|
|
|
+ oaRenewMapper.updateById(oaRenew);
|
|
|
+ }
|
|
|
+ // 发起流程
|
|
|
+ Map<String, Object> processInstanceVariables = new HashMap<>();
|
|
|
+ processInstanceVariables.put("auditPass", "true");
|
|
|
+ // 添加审批人信息
|
|
|
+ Map<String, List<Long>> startUserSelectAssignees = new HashMap<>();
|
|
|
+ List<Long> selectAssignees = commitReqVO.getStartUserSelectAssignees();
|
|
|
+ startUserSelectAssignees.put("approver", selectAssignees);
|
|
|
+ String processInstanceId = processInstanceApi
|
|
|
+ .createProcessInstance(loginUser.getId(),
|
|
|
+ new BpmProcessInstanceCreateReqDTO()
|
|
|
+ .setProcessDefinitionKey(PROCESS_KEY)
|
|
|
+ .setVariables(processInstanceVariables)
|
|
|
+ .setBusinessKey(String.valueOf(oaRenew.getId()))
|
|
|
+ .setStartUserSelectAssignees(startUserSelectAssignees));
|
|
|
+
|
|
|
+ //获取下一个审批人
|
|
|
+ Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
|
|
|
|
|
|
- // 返回
|
|
|
+ // 审批同意
|
|
|
+ BpmTaskApproveReqVO agreeReqVO = new BpmTaskApproveReqVO();
|
|
|
+ agreeReqVO.setId(task.getId());
|
|
|
+ agreeReqVO.setReason("[首次提交]");
|
|
|
+ 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);
|
|
|
+
|
|
|
+ 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);
|
|
|
+
|
|
|
+
|
|
|
+ // 将工作流的流程实例ID、单据状态、最后一次审批时间、当前审批人更新到单据信息中
|
|
|
+ oaRenewMapper.updateById(new OaRenewDO()
|
|
|
+ .setId(oaRenew.getId())
|
|
|
+ .setProcInstId(processInstanceId)
|
|
|
+ .setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_COMMITTED)
|
|
|
+ .setFinalAuditDate(LocalDateTime.now())
|
|
|
+ .setCurrentAuditEmployeeId(currentAuditEmployeeId)
|
|
|
+ .setCurrentAuditEmployeeName(currentAuditEmployee.getNickname())
|
|
|
+ .setStartUserSelectAssignees(selectAssignees.stream().map(String::valueOf).collect(Collectors.joining(","))));
|
|
|
+ // 保存业务uuid到附件中
|
|
|
+ saveFileList(commitReqVO.getFileIdList(), oaRenew.getRenewId());
|
|
|
+ // TODO DP 发送提交成功站内信
|
|
|
return oaRenew.getId();
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
- public Long completeTrueOaRenew(Long userId, BpmTaskApproveReqVO reqVO) {
|
|
|
- Task currentTask = bpmTaskService.getTask(reqVO.getId());
|
|
|
+ @Transactional
|
|
|
+ public Long agreeOaRenew(BpmTaskApproveReqVO agreeReqVO) {
|
|
|
+ // 登录人信息
|
|
|
+ Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
+ // TODO DP 根据登录人查询出对应的员工信息
|
|
|
+
|
|
|
+ Task currentTask = bpmTaskService.getTask(agreeReqVO.getId());
|
|
|
+ if (currentTask == null) {
|
|
|
+ throw exception(ErrorCodeConstants.TASK_NOT_EXISTS);
|
|
|
+ }
|
|
|
+ // 先更新为审批中
|
|
|
+ taskService.setVariable(currentTask.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_AUDITING);
|
|
|
+ LambdaQueryWrapper<OaRenewDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(OaRenewDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
+ OaRenewDO oaRenew = oaRenewMapper.selectOne(lambdaQueryWrapper);
|
|
|
+ // 如果是最后一个人审批同意,设置流程审批状态为已审核
|
|
|
+ String[] auditPersons = oaRenew.getStartUserSelectAssignees().split(",");
|
|
|
+ String lastAuditPerson = Arrays.stream(auditPersons)
|
|
|
+ .reduce((first, second) -> second)
|
|
|
+ .orElse(null);
|
|
|
+ if (currentTask.getAssignee().equals(lastAuditPerson)) {
|
|
|
+ // 更新为已审核(暂时未生效,未找到原因,先不处理)
|
|
|
+ taskService.setVariable(agreeReqVO.getId(),BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_AUDITED);
|
|
|
+ }
|
|
|
// 审批同意
|
|
|
- bpmTaskService.approveTask(userId, reqVO);
|
|
|
+ String reason = "[同意]";
|
|
|
+ if (StrUtil.isNotBlank(agreeReqVO.getReason())) {
|
|
|
+ reason = reason + agreeReqVO.getReason();
|
|
|
+ }
|
|
|
+ agreeReqVO.setReason(reason);
|
|
|
+ agreeReqVO.setTaskStatus(Integer.valueOf(DictDataConstants.OA_AUDIT_STATUS_AUDITING));
|
|
|
+ taskService.setVariable(agreeReqVO.getId(), "auditPass", "true");
|
|
|
+ bpmTaskService.approveTask(loginUserId, agreeReqVO);
|
|
|
|
|
|
Task nextTask = taskService.createTaskQuery().processInstanceId(currentTask.getProcessInstanceId()).singleResult();
|
|
|
+ OaRenewDO oaRenewDO = new OaRenewDO();
|
|
|
if (nextTask != null) {
|
|
|
- LambdaUpdateWrapper<OaRenewDO> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.set(OaRenewDO::getAuditStatus, "2")
|
|
|
- .set(OaRenewDO::getCurrentAuditEmployeeId, nextTask.getAssignee())
|
|
|
- .set(OaRenewDO::getFinalAuditDate, new Date())
|
|
|
- .eq(OaRenewDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
- oaRenewMapper.update(updateWrapper);
|
|
|
+ Long currentAuditEmployeeId = Long.valueOf(nextTask.getAssignee());
|
|
|
+ AdminUserRespDTO currentAuditEmployee = adminUserApi.getUser(currentAuditEmployeeId);
|
|
|
+
|
|
|
+ // 如果审批人重复,实际未结束,再次更新为审核中
|
|
|
+ taskService.setVariable(nextTask.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_AUDITING);
|
|
|
+ oaRenewDO.setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_AUDITING)
|
|
|
+ .setCurrentAuditEmployeeId(currentAuditEmployeeId)
|
|
|
+ .setCurrentAuditEmployeeName(currentAuditEmployee.getNickname())
|
|
|
+ .setFinalAuditDate(LocalDateTime.now())
|
|
|
+ .setId(oaRenew.getId());
|
|
|
+
|
|
|
} else {
|
|
|
- LambdaUpdateWrapper<OaRenewDO> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.set(OaRenewDO::getAuditStatus, "3")
|
|
|
- .set(OaRenewDO::getCurrentAuditEmployeeId, null)
|
|
|
- .set(OaRenewDO::getFinalAuditDate, new Date())
|
|
|
- .eq(OaRenewDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
- oaRenewMapper.update(updateWrapper);
|
|
|
+ oaRenewDO.setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_AUDITED)
|
|
|
+ .setCurrentAuditEmployeeId(null)
|
|
|
+ .setCurrentAuditEmployeeName(null)
|
|
|
+ .setFinalAuditDate(LocalDateTime.now())
|
|
|
+ .setId(oaRenew.getId());
|
|
|
|
|
|
// TODO 复制业务单据信息到业务模块单据表
|
|
|
|
|
|
}
|
|
|
+ oaRenewMapper.updateById(oaRenewDO);
|
|
|
// 发送通知
|
|
|
|
|
|
// 返回
|
|
|
@@ -150,80 +288,189 @@ public class OaRenewServiceImpl extends ServiceImpl<OaRenewMapper, OaRenewDO> im
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Long completeFalseOaRenew(Long userId, BpmTaskApproveReqVO reqVO) {
|
|
|
+ @Transactional
|
|
|
+ public Long disagreeOaRenew(BpmTaskReturnReqVO disagreeReqVO) {
|
|
|
+ // 登录人信息
|
|
|
+ Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
+ // TODO DP 根据登录人查询出对应的员工信息
|
|
|
|
|
|
- Task currentTask = bpmTaskService.getTask(reqVO.getId());
|
|
|
+ Task currentTask = bpmTaskService.getTask(disagreeReqVO.getId());
|
|
|
|
|
|
- BpmTaskReturnReqVO reqVO2 = BeanUtils.toBean(reqVO, BpmTaskReturnReqVO.class);
|
|
|
- reqVO2.setTargetTaskDefinitionKey("modifyApply");
|
|
|
- bpmTaskService.returnTask(userId, reqVO2);
|
|
|
+ disagreeReqVO.setTargetTaskDefinitionKey("modifyApply");
|
|
|
+ disagreeReqVO.setReason("[驳回]" + disagreeReqVO.getReason());
|
|
|
+ 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);
|
|
|
|
|
|
Task nextTask = taskService.createTaskQuery().processInstanceId(currentTask.getProcessInstanceId()).singleResult();
|
|
|
+ Long currentAuditEmployeeId = Long.valueOf(nextTask.getAssignee());
|
|
|
+ AdminUserRespDTO currentAuditEmployee = adminUserApi.getUser(currentAuditEmployeeId);
|
|
|
|
|
|
// 更新单据状态,当前处理人,最后处理时间
|
|
|
LambdaUpdateWrapper<OaRenewDO> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.set(OaRenewDO::getCurrentAuditEmployeeId, nextTask.getAssignee())
|
|
|
- .set(OaRenewDO::getFinalAuditDate, new Date())
|
|
|
- .set(OaRenewDO::getAuditStatus, "0")
|
|
|
+ updateWrapper.set(OaRenewDO::getCurrentAuditEmployeeId, currentAuditEmployeeId)
|
|
|
+ .set(OaRenewDO::getCurrentAuditEmployeeName, currentAuditEmployee.getNickname())
|
|
|
+ .set(OaRenewDO::getFinalAuditDate, LocalDateTime.now())
|
|
|
+ .set(OaRenewDO::getAuditStatus, DictDataConstants.OA_AUDIT_STATUS_RETURNED)
|
|
|
.eq(OaRenewDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
oaRenewMapper.update(updateWrapper);
|
|
|
|
|
|
// 发送通知
|
|
|
|
|
|
- // 返回
|
|
|
return 1L;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Long updateCompleteOaRenew(Long userId, OaRenewSaveReqVO createReqVO, BpmTaskApproveReqVO reqVO) {
|
|
|
- // 判断是否已经发起流程
|
|
|
- Boolean auditPass = createReqVO.getAuditPass();
|
|
|
+ @Transactional
|
|
|
+ public Long revocationOaRenew(BpmTaskApproveReqVO revocationReqVO) {
|
|
|
+ // 登录人信息
|
|
|
+ Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
+ // TODO DP 根据登录人查询出对应的员工信息
|
|
|
+
|
|
|
+ Task currentTask = bpmTaskService.getTask(revocationReqVO.getId());
|
|
|
+ if (currentTask == null) {
|
|
|
+ throw ServiceExceptionUtil.exception(ErrorCodeConstants.TASK_NOT_EXISTS);
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<OaRenewDO> lambdaQueryWrapper = new LambdaQueryWrapper<OaRenewDO>()
|
|
|
+ .eq(OaRenewDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
+ OaRenewDO oaRenewDO = oaRenewMapper.selectOne(lambdaQueryWrapper);
|
|
|
+ if (!DictDataConstants.OA_AUDIT_STATUS_COMMITTED.equals(oaRenewDO.getAuditStatus())
|
|
|
+ || !Objects.equals(String.valueOf(loginUserId), oaRenewDO.getCreator())) {
|
|
|
+ throw ServiceExceptionUtil.exception(ErrorCodeConstants.TASK_REVOCATION_NOT_ALLOWED);
|
|
|
+ }
|
|
|
|
|
|
- OaRenewDO oaRenew = BeanUtils.toBean(createReqVO, OaRenewDO.class);
|
|
|
+ BpmTaskReturnReqVO returnReqVO = BeanUtils.toBean(revocationReqVO, BpmTaskReturnReqVO.class);
|
|
|
+ returnReqVO.setTargetTaskDefinitionKey("modifyApply");
|
|
|
+ String reason = "[撤回]";
|
|
|
+ if (StrUtil.isNotBlank(returnReqVO.getReason())) {
|
|
|
+ reason = reason + returnReqVO.getReason();
|
|
|
+ }
|
|
|
+ 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);
|
|
|
|
|
|
- Task currentTask = taskService.createTaskQuery().processInstanceId(oaRenew.getProcInstId()).singleResult();
|
|
|
+ Task nextTask = taskService.createTaskQuery().processInstanceId(currentTask.getProcessInstanceId()).singleResult();
|
|
|
+ Long currentAuditEmployeeId = Long.valueOf(nextTask.getAssignee());
|
|
|
+ AdminUserRespDTO currentAuditEmployee = adminUserApi.getUser(currentAuditEmployeeId);
|
|
|
|
|
|
- //审批通过
|
|
|
- bpmTaskService.approveTask(userId, reqVO);
|
|
|
+ // 更新单据状态,当前处理人,最后处理时间
|
|
|
+ LambdaUpdateWrapper<OaRenewDO> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.set(OaRenewDO::getCurrentAuditEmployeeId, currentAuditEmployeeId)
|
|
|
+ .set(OaRenewDO::getCurrentAuditEmployeeName, currentAuditEmployee.getNickname())
|
|
|
+ .set(OaRenewDO::getFinalAuditDate, LocalDateTime.now())
|
|
|
+ .set(OaRenewDO::getAuditStatus, DictDataConstants.OA_AUDIT_STATUS_RECALLED)
|
|
|
+ .eq(OaRenewDO::getProcInstId, currentTask.getProcessInstanceId());
|
|
|
+ oaRenewMapper.update(updateWrapper);
|
|
|
|
|
|
- // 提交
|
|
|
- if (auditPass) {
|
|
|
- Task nextTask = taskService.createTaskQuery().processInstanceId(currentTask.getProcessInstanceId()).singleResult();
|
|
|
+ // 发送通知
|
|
|
|
|
|
- oaRenew.setAuditStatus("1");
|
|
|
- oaRenew.setCurrentAuditEmployeeId(Long.valueOf(nextTask.getAssignee()));
|
|
|
- oaRenew.setFinalAuditDate(LocalDateTime.now());
|
|
|
- oaRenewMapper.updateById(oaRenew);
|
|
|
+ return 1L;
|
|
|
+ }
|
|
|
|
|
|
- } else {
|
|
|
- OaRenewDO oaRenewClose = new OaRenewDO();
|
|
|
- oaRenewClose.setId(oaRenew.getId());
|
|
|
- oaRenewClose.setAuditStatus("4");
|
|
|
- oaRenewClose.setCurrentAuditEmployeeId(null);
|
|
|
- oaRenewClose.setFinalAuditDate(LocalDateTime.now());
|
|
|
- oaRenewMapper.updateById(oaRenewClose);
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public Long reCommitOaRenew(OaRenewSaveReqVO reCommitReqVO) {
|
|
|
+ if (reCommitReqVO.getId() == null) {
|
|
|
+ throw exception(ErrorCodeConstants.SERVICE_ID_NOT_EXISTS);
|
|
|
+ }
|
|
|
+ // 登录人信息
|
|
|
+ Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
+ AdminUserRespDTO loginUser = adminUserApi.getUser(loginUserId);
|
|
|
+ if (loginUser == null) {
|
|
|
+ throw exception(ErrorCodeConstants.OA_LOGIN_USER_NOT_EXISTS);
|
|
|
+ }
|
|
|
+ // 转正人信息
|
|
|
+ AdminUserRespDTO employee = adminUserApi.getUser(reCommitReqVO.getEmployeeId());
|
|
|
+ if (employee == null) {
|
|
|
+ throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
|
|
|
}
|
|
|
|
|
|
- return oaRenew.getId();
|
|
|
- }
|
|
|
+ OaRenewDO oaRenewNew = BeanUtils.toBean(reCommitReqVO, OaRenewDO.class);
|
|
|
+ OaRenewDO oaRenewOld = oaRenewMapper.selectById(oaRenewNew.getId());
|
|
|
+ oaRenewNew.setRenewId(oaRenewOld.getRenewId())
|
|
|
+ .setProcInstId(oaRenewOld.getProcInstId());
|
|
|
+
|
|
|
+ oaRenewNew.setEmployeeId(employee.getId());
|
|
|
+ oaRenewNew.setEmployeeName(employee.getNickname());
|
|
|
+ oaRenewNew.setEmployeePhone(employee.getMobile());
|
|
|
+ oaRenewNew.setDeptId(employee.getDeptId());
|
|
|
+ oaRenewNew.setPosition("员工职位");
|
|
|
+ oaRenewNew.setOldContractStartDate("2023-01-01");
|
|
|
+ oaRenewNew.setOldContractEndDate("2023-12-31");
|
|
|
+ oaRenewNew.setUserId(loginUser.getId());
|
|
|
+ oaRenewNew.setApplyEmployeeId(loginUser.getId());
|
|
|
+ oaRenewNew.setApplyEmployeeName(loginUser.getNickname());
|
|
|
+
|
|
|
+ Task currentTask = taskService.createTaskQuery().processInstanceId(oaRenewNew.getProcInstId()).singleResult();
|
|
|
+ BpmTaskApproveReqVO approveReqVO = new BpmTaskApproveReqVO();
|
|
|
+ approveReqVO.setId(currentTask.getId())
|
|
|
+ .setReason("[再次提交]");
|
|
|
+ approveReqVO.setTaskStatus(Integer.valueOf(DictDataConstants.OA_AUDIT_STATUS_COMMITTED));
|
|
|
+ if (CollectionUtil.isNotEmpty(reCommitReqVO.getStartUserSelectAssignees())) {
|
|
|
+ // 添加审批人信息到流程参数中
|
|
|
+ Map<String, List<Long>> startUserSelectAssignees = new HashMap<>();
|
|
|
+ List<Long> selectAssignees = reCommitReqVO.getStartUserSelectAssignees();
|
|
|
+ startUserSelectAssignees.put("approver", selectAssignees);
|
|
|
+ taskService.setVariable(currentTask.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES, startUserSelectAssignees);
|
|
|
+ // 保存审批人信息
|
|
|
+ oaRenewNew.setStartUserSelectAssignees(selectAssignees.stream().map(String::valueOf).collect(Collectors.joining(",")));
|
|
|
+ }
|
|
|
+ taskService.setVariable(currentTask.getId(), "auditPass", "true");
|
|
|
+ taskService.setVariable(currentTask.getId(),BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_COMMITTED);
|
|
|
+ // 再次提交,和审批通过逻辑相同
|
|
|
+ bpmTaskService.approveTask(loginUserId, approveReqVO);
|
|
|
|
|
|
+ Task nextTask = taskService.createTaskQuery().processInstanceId(currentTask.getProcessInstanceId()).singleResult();
|
|
|
+ Long currentAuditEmployeeId = Long.valueOf(nextTask.getAssignee());
|
|
|
+ AdminUserRespDTO currentAuditEmployee = adminUserApi.getUser(currentAuditEmployeeId);
|
|
|
+ oaRenewNew.setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_COMMITTED)
|
|
|
+ .setCurrentAuditEmployeeId(currentAuditEmployeeId)
|
|
|
+ .setCurrentAuditEmployeeName(currentAuditEmployee.getNickname())
|
|
|
+ .setFinalAuditDate(LocalDateTime.now());
|
|
|
+ oaRenewMapper.updateById(oaRenewNew);
|
|
|
|
|
|
- @Override
|
|
|
- public Long createOaRenew(OaRenewSaveReqVO createReqVO) {
|
|
|
- // 插入
|
|
|
- OaRenewDO oaRenew = BeanUtils.toBean(createReqVO, OaRenewDO.class);
|
|
|
- oaRenewMapper.insert(oaRenew);
|
|
|
- // 返回
|
|
|
- return oaRenew.getId();
|
|
|
+ // 保存业务uuid到附件中
|
|
|
+ saveFileList(reCommitReqVO.getFileIdList(), oaRenewNew.getRenewId());
|
|
|
+
|
|
|
+ return 1L;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void updateOaRenew(OaRenewSaveReqVO updateReqVO) {
|
|
|
- // 校验存在
|
|
|
- validateOaRenewExists(updateReqVO.getId());
|
|
|
- // 更新
|
|
|
- OaRenewDO updateObj = BeanUtils.toBean(updateReqVO, OaRenewDO.class);
|
|
|
- oaRenewMapper.updateById(updateObj);
|
|
|
+ @Transactional
|
|
|
+ public Long closeOaRenew(Long id) {
|
|
|
+ if (id == null) {
|
|
|
+ throw exception(ErrorCodeConstants.SERVICE_ID_NOT_EXISTS);
|
|
|
+ }
|
|
|
+ // 登录人信息
|
|
|
+ Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
+ // TODO DP 根据登录人查询出对应的员工信息
|
|
|
+
|
|
|
+ OaRenewDO oaRenewDO = oaRenewMapper.selectById(id);
|
|
|
+ if (!DictDataConstants.OA_AUDIT_STATUS_RETURNED.equals(oaRenewDO.getAuditStatus())
|
|
|
+ && !DictDataConstants.OA_AUDIT_STATUS_RECALLED.equals(oaRenewDO.getAuditStatus())) {
|
|
|
+ throw exception(ErrorCodeConstants.TASK_CLOSE_NOT_ALLOWED);
|
|
|
+ }
|
|
|
+
|
|
|
+ Task currentTask = taskService.createTaskQuery().processInstanceId(oaRenewDO.getProcInstId()).singleResult();
|
|
|
+ BpmTaskApproveReqVO approveReqVO = new BpmTaskApproveReqVO();
|
|
|
+ approveReqVO.setId(currentTask.getId())
|
|
|
+ .setReason("[关闭]");
|
|
|
+ approveReqVO.setTaskStatus(Integer.valueOf(DictDataConstants.OA_AUDIT_STATUS_CLOSED));
|
|
|
+ taskService.setVariable(currentTask.getId(), "auditPass", "false");
|
|
|
+ taskService.setVariable(currentTask.getId(),BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_CLOSED);
|
|
|
+ // 关闭,使用审批通过的方法实现
|
|
|
+ bpmTaskService.approveTask(loginUserId, approveReqVO);
|
|
|
+
|
|
|
+ LambdaUpdateWrapper<OaRenewDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ lambdaUpdateWrapper.set(OaRenewDO::getAuditStatus, DictDataConstants.OA_AUDIT_STATUS_CLOSED)
|
|
|
+ .set(OaRenewDO::getCurrentAuditEmployeeId, null)
|
|
|
+ .set(OaRenewDO::getCurrentAuditEmployeeName, null)
|
|
|
+ .set(OaRenewDO::getFinalAuditDate, LocalDateTime.now())
|
|
|
+ .eq(OaRenewDO::getId, id);
|
|
|
+ oaRenewMapper.update(lambdaUpdateWrapper);
|
|
|
+ return 1L;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -234,20 +481,167 @@ public class OaRenewServiceImpl extends ServiceImpl<OaRenewMapper, OaRenewDO> im
|
|
|
oaRenewMapper.deleteById(id);
|
|
|
}
|
|
|
|
|
|
- private void validateOaRenewExists(Long id) {
|
|
|
- if (oaRenewMapper.selectById(id) == null) {
|
|
|
- throw exception(OA_RENEW_NOT_EXISTS);
|
|
|
+ @Override
|
|
|
+ public OaRenewRespVO getOaRenew(Long id) {
|
|
|
+ // 登录人信息
|
|
|
+ Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
+ // TODO DP 根据登录人查询出对应的员工信息
|
|
|
+
|
|
|
+ OaRenewDO oaRenewDO = oaRenewMapper.selectById(id);
|
|
|
+ OaRenewRespVO oaRenewRespVO = BeanUtils.toBean(oaRenewDO, OaRenewRespVO.class);
|
|
|
+ if (oaRenewDO.getDeptId() != null) {
|
|
|
+ DeptRespDTO dept = deptApi.getDept(oaRenewDO.getDeptId());
|
|
|
+ if (dept != null) {
|
|
|
+ oaRenewRespVO.setDeptName(dept.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String procInstId = oaRenewDO.getProcInstId();
|
|
|
+ if (StrUtil.isNotBlank(procInstId)) {
|
|
|
+ Task task = taskService.createTaskQuery()
|
|
|
+ .processInstanceId(procInstId)
|
|
|
+ .taskAssignee(String.valueOf(loginUserId))
|
|
|
+ .singleResult();
|
|
|
+ if (DictDataConstants.OA_AUDIT_STATUS_COMMITTED.equals(oaRenewDO.getAuditStatus())) {
|
|
|
+ // 如果是已提交,不限制任务处理人是当前登录人,用于直接撤回
|
|
|
+ task = taskService.createTaskQuery()
|
|
|
+ .processInstanceId(procInstId)
|
|
|
+ .singleResult();
|
|
|
+ }
|
|
|
+ if (task != null) {
|
|
|
+ oaRenewRespVO.setTaskId(task.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 附件列表
|
|
|
+ List<FileDTO> fileList = fileApi.getFileDTOListByBiz(oaRenewDO.getRenewId());
|
|
|
+ oaRenewRespVO.setFileList(fileList);
|
|
|
+
|
|
|
+ // 审批记录
|
|
|
+ if (StrUtil.isNotBlank(oaRenewDO.getProcInstId())) {
|
|
|
+ List<BpmTaskRespVO> auditRecordList = bpmTaskService.getAuditRecordListByProcessInstanceId(oaRenewDO.getProcInstId());
|
|
|
+ oaRenewRespVO.setAuditRecordList(auditRecordList);
|
|
|
}
|
|
|
+
|
|
|
+ // 审批人
|
|
|
+ String startUserSelectAssignees = oaRenewDO.getStartUserSelectAssignees();
|
|
|
+ if (StrUtil.isNotEmpty(startUserSelectAssignees)) {
|
|
|
+ List<Long> userIdList = 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ oaRenewRespVO.setAuditUserList(auditUserList);
|
|
|
+ }
|
|
|
+
|
|
|
+ return oaRenewRespVO;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public OaRenewRespVO getOaRenewByProcInstId(String procInstId) {
|
|
|
+ OaRenewDO oaRenewDO = oaRenewMapper.selectOne(OaRenewDO::getProcInstId, procInstId);
|
|
|
+ OaRenewRespVO oaRenewRespVO = BeanUtils.toBean(oaRenewDO, OaRenewRespVO.class);
|
|
|
+ if (oaRenewDO.getDeptId() != null) {
|
|
|
+ DeptRespDTO dept = deptApi.getDept(oaRenewDO.getDeptId());
|
|
|
+ if (dept != null) {
|
|
|
+ oaRenewRespVO.setDeptName(dept.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 附件列表
|
|
|
+ List<FileDTO> fileList = fileApi.getFileDTOListByBiz(oaRenewDO.getRenewId());
|
|
|
+ oaRenewRespVO.setFileList(fileList);
|
|
|
+
|
|
|
+ // 审批记录
|
|
|
+ if (StrUtil.isNotBlank(oaRenewDO.getProcInstId())) {
|
|
|
+ List<BpmTaskRespVO> auditRecordList = bpmTaskService.getAuditRecordListByProcessInstanceId(oaRenewDO.getProcInstId());
|
|
|
+ oaRenewRespVO.setAuditRecordList(auditRecordList);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 审批人
|
|
|
+ String startUserSelectAssignees = oaRenewDO.getStartUserSelectAssignees();
|
|
|
+ if (StrUtil.isNotEmpty(startUserSelectAssignees)) {
|
|
|
+ List<Long> userIdList = 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ oaRenewRespVO.setAuditUserList(auditUserList);
|
|
|
+ }
|
|
|
+
|
|
|
+ return oaRenewRespVO;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public OaRenewDO getOaRenew(Long id) {
|
|
|
- return oaRenewMapper.selectById(id);
|
|
|
+ public PageResult<OaRenewRespVO> getOaRenewPage(OaRenewPageReqVO pageReqVO) {
|
|
|
+ PageResult<OaRenewDO> oaRenewDOPageResult = oaRenewMapper.selectPage(pageReqVO);
|
|
|
+ PageResult<OaRenewRespVO> oaRenewRespVOPageResult = BeanUtils.toBean(oaRenewDOPageResult, OaRenewRespVO.class);
|
|
|
+
|
|
|
+ List<OaRenewRespVO> oaRenewRespVOList = oaRenewRespVOPageResult.getList();
|
|
|
+ if (CollectionUtil.isNotEmpty(oaRenewRespVOList)) {
|
|
|
+ List<Long> employeeIdList = oaRenewRespVOList.stream().map(OaRenewRespVO::getCurrentAuditEmployeeId).collect(Collectors.toList());
|
|
|
+ List<AdminUserRespDTO> employeeList = adminUserApi.getUserList(employeeIdList);
|
|
|
+ for (OaRenewRespVO respVO : oaRenewRespVOList) {
|
|
|
+ for (AdminUserRespDTO employee : employeeList) {
|
|
|
+ if (respVO.getCurrentAuditEmployeeId() == employee.getId()) {
|
|
|
+ respVO.setCurrentAuditEmployeeName(employee.getNickname());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Long> deptIdList = oaRenewRespVOList.stream().map(OaRenewRespVO::getDeptId).collect(Collectors.toList());
|
|
|
+ List<DeptRespDTO> deptList = deptApi.getDeptList(deptIdList);
|
|
|
+ for (OaRenewRespVO respVO : oaRenewRespVOList) {
|
|
|
+ for (DeptRespDTO dept : deptList) {
|
|
|
+ if (respVO.getDeptId() == dept.getId()) {
|
|
|
+ respVO.setDeptName(dept.getName());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return oaRenewRespVOPageResult;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PageResult<OaRenewDO> getOaRenewPage(OaRenewPageReqVO pageReqVO) {
|
|
|
- return oaRenewMapper.selectPage(pageReqVO);
|
|
|
+ public PageResult<OaRenewRespVO> exportOaRenewExcel(OaRenewPageReqVO pageReqVO) {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ return getOaRenewPage(pageReqVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void validateOaRenewExists(Long id) {
|
|
|
+ OaRenewDO oaRenewDO = oaRenewMapper.selectById(id);
|
|
|
+ if (oaRenewDO == null) {
|
|
|
+ throw exception(OA_RENEW_NOT_EXISTS);
|
|
|
+ }
|
|
|
+ if (!DictDataConstants.OA_AUDIT_STATUS_STAGING.equals(oaRenewDO.getAuditStatus())) {
|
|
|
+ throw exception(ErrorCodeConstants.DELETE_FAIL_NOT_STAGING);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存业务uuid到附件中
|
|
|
+ */
|
|
|
+ private void saveFileList(List<Long> fileIdList, String serviceId) {
|
|
|
+ if (CollectionUtil.isNotEmpty(fileIdList) && StrUtil.isNotEmpty(serviceId)) {
|
|
|
+ fileApi.updateFileBiz(fileIdList, serviceId);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|