| | |
| | | package com.ycl.service.impl; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import com.ycl.common.constant.ProcessConstants; |
| | | import com.ycl.common.constant.ProcessOverTimeConstants; |
| | | import com.ycl.common.core.domain.entity.SysDept; |
| | | import com.ycl.common.core.domain.entity.SysDictData; |
| | | import com.ycl.common.core.domain.entity.SysRole; |
| | | import com.ycl.common.core.domain.entity.SysUser; |
| | | import com.ycl.common.enums.business.HandlerTypeEnum; |
| | | import com.ycl.common.enums.business.ProcessLogEventTypeEnum; |
| | | import com.ycl.common.enums.business.SuperviseTypeEnum; |
| | | import com.ycl.common.enums.business.TaskStatusEnum; |
| | | import com.ycl.common.enums.business.*; |
| | | import com.ycl.common.utils.SecurityUtils; |
| | | import com.ycl.constant.TaskTypeConstant; |
| | | import com.ycl.domain.entity.*; |
| | | import com.ycl.domain.form.*; |
| | | import com.ycl.domain.json.DelegateData; |
| | | import com.ycl.domain.json.HangupData; |
| | | import com.ycl.domain.json.JumpData; |
| | | import com.ycl.domain.json.SuperviseData; |
| | | import com.ycl.domain.json.*; |
| | | import com.ycl.domain.vo.CustomerTaskVO; |
| | | import com.ycl.domain.vo.IndexCustomerTaskVO; |
| | | import com.ycl.domain.vo.ProjectProcessDetailVO; |
| | |
| | | import com.ycl.domain.query.ProjectProcessQuery; |
| | | import com.ycl.service.common.TaskCommonService; |
| | | import com.ycl.system.service.ISysDeptService; |
| | | import com.ycl.system.service.ISysDictTypeService; |
| | | import com.ycl.system.service.ISysRoleService; |
| | | import com.ycl.system.service.ISysUserService; |
| | | import lombok.Synchronized; |
| | |
| | | private final ApplicationEventPublisher publisher; |
| | | private final ISysDeptService deptService; |
| | | private final ProcessLogService processLogService; |
| | | private final ISysDictTypeService dictTypeService; |
| | | |
| | | /** |
| | | * 分页查询 |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Result startProcess(Long projectId, String processDefId) { |
| | | ProjectInfo project = new LambdaQueryChainWrapper<>(projectInfoMapper) |
| | | .select(ProjectInfo::getCreateBy) |
| | | .eq(ProjectInfo::getId, projectId) |
| | | .one(); |
| | | ProjectInfo project = projectInfoMapper.selectById(projectId); |
| | | if (Objects.isNull(project)) { |
| | | throw new RuntimeException("项目不存在"); |
| | | } |
| | |
| | | return Result.ok("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public Result taskTeamwork(TaskTeamWorkForm form) { |
| | | Task task = taskService.createTaskQuery().taskId(form.getTaskId()).singleResult(); |
| | | if (Objects.isNull(task)) { |
| | | return Result.error("任务不存在"); |
| | | } |
| | | ProjectProcess projectProcess = new LambdaQueryChainWrapper<>(projectProcessMapper) |
| | | .eq(ProjectProcess::getProcessInsId, task.getProcessInstanceId()) |
| | | .eq(ProjectProcess::getProcessDefId, task.getProcessDefinitionId()) |
| | | .one(); |
| | | if (Objects.isNull(projectProcess)) { |
| | | return Result.error("项目流程未绑定"); |
| | | } |
| | | // 1. 保存发起人填写的表单数据,但不直接完成该任务。提交后任务处理人必须等到协同人处理完之后才能完成任务 |
| | | Map<String, Object> processVariables = new HashMap<>(); |
| | | //查出字典中需要注入的字段信息 |
| | | List<String> dictList = dictTypeService.selectDictDataByType("flow_variables").stream().map(SysDictData::getDictValue).collect(Collectors.toList()); |
| | | Map<String, Object> newV = new HashMap<>(2); |
| | | if (!org.springframework.util.CollectionUtils.isEmpty(form.getVariables())) { |
| | | for (String key : form.getVariables().keySet()) { |
| | | newV.put(task.getTaskDefinitionKey() + "&" + key, form.getVariables().get(key)); |
| | | //字典里有就放入流程变量中 |
| | | if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(dictList) && dictList.contains(key)) { |
| | | processVariables.put(key,form.getVariables().get(key)); |
| | | } |
| | | } |
| | | } |
| | | if( !processVariables.isEmpty() ) { |
| | | taskService.setVariables(form.getTaskId(), processVariables); |
| | | } |
| | | |
| | | // 2. 保存日志 |
| | | publisher.publishEvent(new TaskLogEvent(this, |
| | | null, |
| | | SecurityUtils.getUserId(), |
| | | form.getProjectId(), |
| | | form.getProcessInsId(), |
| | | form.getTaskId(), |
| | | task.getName(), |
| | | ProcessLogEventTypeEnum.TEAM_WORK, |
| | | new TeamWorkData(form.getHandlerType(), form.getHandlerIds(), TeamWorkStatusEnum.NOT_FINISHED) |
| | | )); |
| | | return Result.ok("操作成功"); |
| | | } |
| | | |
| | | /** |
| | | * 查询待办任务 |
| | | * |