|
@@ -15,19 +15,15 @@ import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.teachcloud.common.service.CommonCacheService;
|
|
|
import com.qmth.teachcloud.common.util.*;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import io.swagger.annotations.ApiResponse;
|
|
|
-import io.swagger.annotations.ApiResponses;
|
|
|
+import io.swagger.annotations.*;
|
|
|
+import org.activiti.engine.TaskService;
|
|
|
+import org.activiti.engine.task.Task;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
@@ -84,7 +80,7 @@ public class TFCustomFlowController {
|
|
|
}
|
|
|
try {
|
|
|
Integer dbVersion = tfCustomFlowService.findMaxVersion(customFlowSaveDto.getSchoolId(), customFlowSaveDto.getOrgId(), customFlowSaveDto.getType());
|
|
|
- TFCustomFlow tfCustomFlow = new TFCustomFlow(customFlowSaveDto.getSchoolId(), customFlowSaveDto.getOrgId(), customFlowSaveDto.getName(), customFlowSaveDto.getType(), customFlowSaveDto.getPublish(), JacksonUtil.parseJson(customFlowSaveDto.getCustomFlowLists()), sysUser.getId());
|
|
|
+ TFCustomFlow tfCustomFlow = new TFCustomFlow(customFlowSaveDto.getSchoolId(), customFlowSaveDto.getOrgId(), customFlowSaveDto.getName(), customFlowSaveDto.getType(), customFlowSaveDto.getPublish(), JacksonUtil.parseJson(customFlowSaveDto.getCustomFlowLists()), sysUser.getId(), flowBpmnId);
|
|
|
AtomicInteger atomicInteger = null;
|
|
|
if (Objects.isNull(dbVersion)) {//新增
|
|
|
atomicInteger = new AtomicInteger(1);
|
|
@@ -99,6 +95,9 @@ public class TFCustomFlowController {
|
|
|
if (Objects.nonNull(map.get(SystemConstant.FLOW_START))) {
|
|
|
tfCustomFlow.setStart((Boolean) map.get(SystemConstant.FLOW_START));
|
|
|
}
|
|
|
+ if (Objects.nonNull(map.get(SystemConstant.PROCESS_DEFINITION_ID))) {
|
|
|
+ tfCustomFlow.setActFlowId((String) map.get(SystemConstant.PROCESS_DEFINITION_ID));
|
|
|
+ }
|
|
|
tfCustomFlowService.save(tfCustomFlow);
|
|
|
} catch (Exception e) {
|
|
|
log.error(SystemConstant.LOG_ERROR, e);
|
|
@@ -112,4 +111,25 @@ public class TFCustomFlowController {
|
|
|
}
|
|
|
return ResultUtil.ok(true);
|
|
|
}
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TaskService taskService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "测试启动流程")
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
|
|
|
+ @RequestMapping(value = "/testStart", method = RequestMethod.POST)
|
|
|
+ @Transactional
|
|
|
+ public Result testStart(@ApiParam(value = "流程id", required = true) @RequestParam String id) {
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+ TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(SystemConstant.convertIdToLong(id));
|
|
|
+ Map<String, Object> map = JacksonUtil.readJson(tfCustomFlow.getFlowProcessVar(), Map.class);
|
|
|
+ Task task = taskService.createTaskQuery().processInstanceId(String.valueOf(map.get(SystemConstant.FLOW_ID))).singleResult();
|
|
|
+ task.setAssignee(String.valueOf(sysUser.getId()));
|
|
|
+ taskService.saveTask(task);
|
|
|
+ Map<String, Object> flowProcessVarMap = (Map<String, Object>) map.get(SystemConstant.FLOW_PROCESS_VAR_MAP);
|
|
|
+ flowProcessVarMap.put(SystemConstant.APPROVE_ID, sysUser.getId());
|
|
|
+ tfCustomFlow.setFlowProcessVar(JacksonUtil.parseJson(map));
|
|
|
+ tfCustomFlowService.updateById(tfCustomFlow);
|
|
|
+ return ResultUtil.ok(true);
|
|
|
+ }
|
|
|
}
|