| | |
| | | import com.ycl.flow.FindNextNodeUtil; |
| | | import com.ycl.flow.FlowableUtils; |
| | | import com.ycl.mapper.ProcessCodingMapper; |
| | | import com.ycl.service.FlowLogService; |
| | | import com.ycl.service.ProcessLogService; |
| | | import com.ycl.service.IFlowTaskService; |
| | | import com.ycl.service.ISysDeployFormService; |
| | | import com.ycl.service.ISysFormService; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.InputStream; |
| | | import java.lang.reflect.Field; |
| | | import java.nio.charset.StandardCharsets; |
| | |
| | | private final ISysFormService sysFormService; |
| | | private final TaskCommonService taskCommonService; |
| | | private final ProcessCodingMapper processCodingMapper; |
| | | private final FlowLogService flowLogService; |
| | | private final ProcessLogService processLogService; |
| | | |
| | | /** |
| | | * 完成审核任务 |
| | |
| | | newV.put(task.getTaskDefinitionKey() + "&" + key, variables.get(key)); |
| | | //字典里有就放入流程变量中 |
| | | if (!CollectionUtils.isEmpty(dictList) && dictList.contains(key)) { |
| | | processVariables.put(key, variables.get(key)); |
| | | processVariables.put(key,variables.get(key)); |
| | | } |
| | | } |
| | | } |
| | | //添加流程变量 |
| | | if (!processVariables.isEmpty()) taskService.setVariables(taskId, processVariables); |
| | | if(!processVariables.isEmpty()) taskService.setVariables(taskId,processVariables); |
| | | taskService.addComment(taskId, task.getProcessInstanceId(), FlowComment.SUBMIT.getType(), "完成提交"); |
| | | // 判断当前任务是不是转办过的 |
| | | Boolean delegation = flowLogService.taskDelegation(task.getProcessInstanceId(), task.getId()); |
| | | if (delegation) { |
| | | if (DelegationState.PENDING.equals(task.getDelegationState())) { |
| | | taskService.resolveTask(taskId, newV); |
| | | } else { |
| | | // 先让当前用户认领这个任务 |
| | | taskService.claim(taskId, SecurityUtils.getUserId() + ""); |
| | | taskService.complete(taskId, newV); |
| | | } |
| | | // 先让当前用户认领这个任务 |
| | | taskService.claim(taskId, SecurityUtils.getUserId() + ""); |
| | | taskService.complete(taskId, newV); |
| | | |
| | | return AjaxResult.success("提交成功"); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public AjaxResult flowRecord(String procInsId, String deployId) { |
| | | public AjaxResult flowRecord(String procInsId) { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | if (StringUtils.isNotBlank(procInsId)) { |
| | | List<HistoricActivityInstance> list = historyService |
| | |
| | | List<JSONObject> oldFields = JSON.parseObject(JSON.toJSONString(formJson.get(ProcessConstants.WIDGET_LIST)), new TypeReference<List<JSONObject>>() { |
| | | }); |
| | | |
| | | // 设置已填写的表单为禁用状态 |
| | | if (!CollectionUtils.isEmpty(oldFields)) { |
| | | if(CollectionUtils.isNotEmpty(oldFields)) { |
| | | // 设置已填写的表单为禁用状态 |
| | | for (JSONObject oldField : oldFields) { |
| | | JSONObject options = oldField.getJSONObject("options"); |
| | | options.put("disabled", true); |
| | | } |
| | | formJson.put(ProcessConstants.WIDGET_LIST, oldFields); |
| | | newP.put(ProcessConstants.TASK_FORM_KEY, formJson); |
| | | newP.remove(formDetailVO.getBeforeNodeDefId() + "&" + ProcessConstants.TASK_FORM_KEY); |
| | | formDetailVO.setFormJsonObj(newP); |
| | | } |
| | | // TODO 暂时只处理用户任务上的表单 |
| | | // if (StringUtils.isNotBlank(task.getFormKey())) { |
| | |
| | | // } |
| | | // oldFields.addAll(newFields); |
| | | // } |
| | | formJson.put(ProcessConstants.WIDGET_LIST, oldFields); |
| | | newP.put(ProcessConstants.TASK_FORM_KEY, formJson); |
| | | newP.remove(formDetailVO.getBeforeNodeDefId() + "&" + ProcessConstants.TASK_FORM_KEY); |
| | | formDetailVO.setFormJsonObj(newP); |
| | | |
| | | } |
| | | } |
| | | return beforeNodes; |