TFCustomFlowController.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. package com.qmth.distributed.print.api;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
  4. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  5. import com.google.gson.Gson;
  6. import com.google.gson.reflect.TypeToken;
  7. import com.qmth.boot.api.constant.ApiConstant;
  8. import com.qmth.boot.api.exception.ApiException;
  9. import com.qmth.distributed.print.business.bean.flow.CustomFlowCommonDto;
  10. import com.qmth.distributed.print.business.bean.flow.CustomFlowEditDto;
  11. import com.qmth.distributed.print.business.bean.flow.CustomFlowSaveDto;
  12. import com.qmth.distributed.print.business.bean.params.CustomFlowParam;
  13. import com.qmth.distributed.print.business.bean.params.CustomFlowRenameParam;
  14. import com.qmth.distributed.print.business.bean.params.FlowTaskApproveParam;
  15. import com.qmth.distributed.print.business.bean.result.*;
  16. import com.qmth.distributed.print.business.entity.TFCustomFlow;
  17. import com.qmth.distributed.print.business.entity.TFCustomFlowEntity;
  18. import com.qmth.distributed.print.business.entity.TFFlowApprove;
  19. import com.qmth.distributed.print.business.service.ActivitiService;
  20. import com.qmth.distributed.print.business.service.TFCustomFlowEntityService;
  21. import com.qmth.distributed.print.business.service.TFCustomFlowService;
  22. import com.qmth.distributed.print.business.service.TFFlowApproveService;
  23. import com.qmth.teachcloud.common.annotation.OperationLogDetail;
  24. import com.qmth.teachcloud.common.contant.SystemConstant;
  25. import com.qmth.teachcloud.common.entity.BasicSchool;
  26. import com.qmth.teachcloud.common.entity.SysUser;
  27. import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
  28. import com.qmth.teachcloud.common.enums.FieldUniqueEnum;
  29. import com.qmth.teachcloud.common.enums.FlowStatusEnum;
  30. import com.qmth.teachcloud.common.enums.TFCustomTypeEnum;
  31. import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
  32. import com.qmth.teachcloud.common.service.CommonCacheService;
  33. import com.qmth.teachcloud.common.util.*;
  34. import io.swagger.annotations.*;
  35. import org.slf4j.Logger;
  36. import org.slf4j.LoggerFactory;
  37. import org.springframework.dao.DuplicateKeyException;
  38. import org.springframework.transaction.annotation.Transactional;
  39. import org.springframework.validation.BindingResult;
  40. import org.springframework.validation.annotation.Validated;
  41. import org.springframework.web.bind.annotation.*;
  42. import javax.annotation.Resource;
  43. import javax.validation.Valid;
  44. import javax.validation.constraints.Max;
  45. import javax.validation.constraints.Min;
  46. import java.security.NoSuchAlgorithmException;
  47. import java.util.*;
  48. import java.util.concurrent.atomic.AtomicInteger;
  49. import java.util.stream.Collectors;
  50. /**
  51. * <p>
  52. * 自定义流程表 前端控制器
  53. * </p>
  54. *
  55. * @author wangliang
  56. * @since 2022-01-21
  57. */
  58. @Api(tags = "自定义流程Controller")
  59. @RestController
  60. @RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_CUSTOM_FLOW)
  61. @Validated
  62. public class TFCustomFlowController {
  63. private final static Logger log = LoggerFactory.getLogger(TFCustomFlowController.class);
  64. @Resource
  65. TFCustomFlowService tfCustomFlowService;
  66. @Resource
  67. RedisUtil redisUtil;
  68. @Resource
  69. ActivitiService activitiService;
  70. @Resource
  71. CommonCacheService commonCacheService;
  72. @Resource
  73. TFFlowApproveService tfFlowApproveService;
  74. @Resource
  75. TFCustomFlowEntityService tfCustomFlowEntityService;
  76. @ApiOperation(value = "保存和发布流程")
  77. @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
  78. @RequestMapping(value = "/save", method = RequestMethod.POST)
  79. @Transactional
  80. @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.ADD)
  81. public Result save(@Valid @RequestBody CustomFlowSaveDto customFlowSaveDto, BindingResult bindingResult) throws NoSuchAlgorithmException {
  82. if (bindingResult.hasErrors()) {
  83. return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
  84. }
  85. SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
  86. Long schoolId = Objects.isNull(sysUser.getSchoolId()) ? SystemConstant.getHeadOrUserSchoolId() : sysUser.getSchoolId();
  87. customFlowSaveDto.setSchoolAndOrgInfo(schoolId, sysUser.getOrgId());
  88. String flowBpmnId = MD5Util.encoder(customFlowSaveDto.toString());
  89. BasicSchool basicSchool = commonCacheService.schoolCache(customFlowSaveDto.getSchoolId());
  90. flowBpmnId = basicSchool.getCode() + "_" + flowBpmnId;
  91. boolean lock = redisUtil.lock(SystemConstant.REDIS_LOCK_CUSTOM_FLOW_PREFIX + flowBpmnId, SystemConstant.REDIS_LOCK_CUSTOM_FLOW_TIME_OUT);
  92. if (!lock) {
  93. throw ExceptionResultEnum.ERROR.exception("正在发布中,请稍候再试!");
  94. }
  95. try {
  96. TFCustomFlow dbTfCustomFlow = tfCustomFlowService.findMaxVersion(customFlowSaveDto.getSchoolId(), null, customFlowSaveDto.getType());
  97. TFCustomFlow tfCustomFlow = null;
  98. if (Objects.isNull(customFlowSaveDto.getCustomFlowId())) {
  99. tfCustomFlow = new TFCustomFlow(customFlowSaveDto.getSchoolId(), customFlowSaveDto.getOrgId(), customFlowSaveDto.getName(), customFlowSaveDto.getType(), customFlowSaveDto.getPublish(), JacksonUtil.parseJson(customFlowSaveDto.getCustomFlowLists()), sysUser.getId(), flowBpmnId, customFlowSaveDto.getModelType());
  100. } else {
  101. tfCustomFlow = tfCustomFlowService.getById(customFlowSaveDto.getCustomFlowId());
  102. Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("自定义流程数据为空"));
  103. if (!tfCustomFlow.getEnable()) {
  104. throw ExceptionResultEnum.ERROR.exception("自定义流程数据已删除");
  105. }
  106. tfCustomFlow.setInfo(customFlowSaveDto);
  107. tfCustomFlow.updateInfo(sysUser.getId());
  108. }
  109. AtomicInteger atomicInteger = null;
  110. if (Objects.isNull(dbTfCustomFlow)) {//新增
  111. atomicInteger = new AtomicInteger(1);
  112. tfCustomFlow.setVersion(atomicInteger.get());
  113. } else {//版本号递增
  114. atomicInteger = new AtomicInteger(dbTfCustomFlow.getVersion());
  115. tfCustomFlow.setVersion(atomicInteger.incrementAndGet());
  116. }
  117. //自定义流程处理开始
  118. Map<String, Object> map = activitiService.dynamicBuildBpmn(customFlowSaveDto, flowBpmnId, tfCustomFlow.getVersion());
  119. String actFlowId = tfCustomFlowService.findActIdByFlowKey(flowBpmnId);
  120. tfCustomFlow.setActFlowId(actFlowId);
  121. tfCustomFlow.setFlowProcessVar(JacksonUtil.parseJson(map));
  122. tfCustomFlowService.saveOrUpdate(tfCustomFlow);
  123. } catch (Exception e) {
  124. log.error(SystemConstant.LOG_ERROR, e);
  125. if (e instanceof DuplicateKeyException) {
  126. String errorColumn = e.getCause().toString();
  127. String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
  128. throw ExceptionResultEnum.SQL_ERROR.exception("[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
  129. } else if (e instanceof ApiException) {
  130. ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
  131. } else {
  132. ResultUtil.error(e.getMessage());
  133. }
  134. } finally {
  135. redisUtil.releaseLock(SystemConstant.REDIS_LOCK_CUSTOM_FLOW_PREFIX + flowBpmnId);
  136. }
  137. return ResultUtil.ok(true);
  138. }
  139. // @ApiOperation(value = "测试启动流程")
  140. // @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
  141. // @RequestMapping(value = "/testStart", method = RequestMethod.POST)
  142. // @Transactional
  143. // public Result testStart(@ApiParam(value = "命题任务id", required = true) @RequestParam String taskId,
  144. // @ApiParam(value = "命题老师id", required = true) @RequestParam String approveId) {
  145. // Map<String, Object> map = new HashMap<>();
  146. // map.computeIfAbsent(SystemConstant.OBJECT_ID, v -> SystemConstant.convertIdToLong(taskId));
  147. // map.computeIfAbsent(SystemConstant.APPROVE_ID, v -> SystemConstant.convertIdToLong(approveId));
  148. // map.computeIfAbsent(SystemConstant.FLOW_TYPE, v -> TFCustomTypeEnum.ELECTRON_FLOW);
  149. // activitiService.customFlowStart(map);
  150. // return ResultUtil.ok(true);
  151. // }
  152. @ApiOperation(value = "审批流程")
  153. @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
  154. @RequestMapping(value = "/task/approve", method = RequestMethod.POST)
  155. @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UN_KNOW)
  156. public Result taskApprove(@Valid @RequestBody FlowTaskApproveParam flowTaskApproveParam, BindingResult bindingResult) {
  157. if (bindingResult.hasErrors()) {
  158. return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
  159. }
  160. Map<String, Object> map = new HashMap<>();
  161. map.computeIfAbsent(SystemConstant.FLOW_TASK_ID, v -> flowTaskApproveParam.getTaskId());
  162. map.computeIfAbsent(SystemConstant.APPROVE_OPERATION, v -> flowTaskApproveParam.getApprovePass());
  163. map.computeIfAbsent(SystemConstant.APPROVE_REMARK, v -> flowTaskApproveParam.getRemark());
  164. map.computeIfAbsent(SystemConstant.APPROVE_SETUP, v -> flowTaskApproveParam.getSetup());
  165. map.computeIfAbsent(SystemConstant.APPROVE_USER_IDS, v -> flowTaskApproveParam.getApproveUserIds());
  166. activitiService.taskApprove(map);
  167. activitiService.sendFlowTaskApproveMsg(map);
  168. /*TFFlowLog tfFlowLog = (TFFlowLog) map.get(SystemConstant.APPROVE_TF_FLOW_LOG);
  169. TFFlowApprove tfFlowApprove = (TFFlowApprove) map.get(SystemConstant.APPROVE_TF_FLOW_APPROVE);
  170. if (Objects.nonNull(tfFlowLog.getObjectTable())) {
  171. if (Objects.equals(tfFlowLog.getObjectTable(), TFCustomTypeEnum.ELECTRON_FLOW.getTable())
  172. && tfFlowApprove.getStatus() == FlowStatusEnum.FINISH) {//如果是命题任务交卷
  173. ExamTask examTask = examTaskService.getById(tfFlowLog.getObjectId());
  174. //取命题老师ID
  175. SysUser sysUser = sysUserService.getById(examTask.getUserId());
  176. try {
  177. printCommonService.checkData(examTask.getSchoolId(), examTask.getExamId(), examTask.getCourseCode(), examTask.getPaperNumber(), sysUser);
  178. } catch (IOException e) {
  179. throw ExceptionResultEnum.ERROR.exception("生成pdf失败");
  180. }
  181. }
  182. }*/
  183. return ResultUtil.ok(true);
  184. }
  185. @ApiOperation(value = "流程审批记录列表")
  186. @ApiResponses({@ApiResponse(code = 200, message = "流程审批记录信息", response = FlowApproveListResult.class)})
  187. @RequestMapping(value = "/approve/list", method = RequestMethod.POST)
  188. public Result taskApproveList(@ApiParam(value = "学期", required = false) @RequestParam(value = "semesterId", required = false) Long semesterId,
  189. @ApiParam(value = "考试", required = false) @RequestParam(value = "examId", required = false) Long examId,
  190. @ApiParam(value = "课程代码", required = false) @RequestParam(value = "courseCode", required = false) String courseCode,
  191. @ApiParam(value = "试着编号", required = false) @RequestParam(value = "paperNumber", required = false) String paperNumber,
  192. @ApiParam(value = "状态", required = false) @RequestParam(required = false) FlowStatusEnum status,
  193. @ApiParam(value = "提交人名称", required = false) @RequestParam(required = false) String teacherUserName,
  194. @ApiParam(value = "教研室", required = false) @RequestParam(required = false) String teachingRoomId,
  195. @ApiParam(value = "提交开始时间", required = false) @RequestParam(required = false) Long startTime,
  196. @ApiParam(value = "提交结束时间", required = false) @RequestParam(required = false) Long endTime,
  197. @ApiParam(value = "提交人名称", required = false) @RequestParam(required = false) String pendApproveUserName,
  198. @ApiParam(value = "页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
  199. @ApiParam(value = "数量", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
  200. return ResultUtil.ok(tfFlowApproveService.findApproveList(new Page<>(pageNumber, pageSize), semesterId, examId, courseCode, paperNumber, status, teacherUserName, SystemConstant.convertIdToLong(teachingRoomId), startTime, endTime, pendApproveUserName, SystemConstant.getHeadOrUserSchoolId(), null));
  201. }
  202. @ApiOperation(value = "流程列表")
  203. @ApiResponses({@ApiResponse(code = 200, message = "流程信息", response = TFCustomFlow.class)})
  204. @RequestMapping(value = "/list", method = RequestMethod.POST)
  205. public Result list(@ApiParam(value = "流程名称", required = false) @RequestParam(required = false) String name,
  206. @ApiParam(value = "页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
  207. @ApiParam(value = "数量", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
  208. return ResultUtil.ok(tfCustomFlowService.list(new Page<>(pageNumber, pageSize), name, SystemConstant.getHeadOrUserSchoolId(), null));
  209. }
  210. @ApiOperation(value = "流程编辑")
  211. @ApiResponses({@ApiResponse(code = 200, message = "流程信息", response = ResultUtil.class)})
  212. @RequestMapping(value = "/edit", method = RequestMethod.POST)
  213. @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.EDIT)
  214. public Result edit(@ApiParam(value = "自定义流程id", required = true) @RequestParam String id) {
  215. TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(SystemConstant.convertIdToLong(id));
  216. Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("自定义流程数据为空"));
  217. Optional.ofNullable(tfCustomFlow.getObjectData()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("自定义流程绘图数据为空"));
  218. List<CustomFlowCommonDto> customFlowLists = new Gson().fromJson(tfCustomFlow.getObjectData(), new TypeToken<List<CustomFlowCommonDto>>() {
  219. }.getType());
  220. return ResultUtil.ok(new CustomFlowEditDto(tfCustomFlow, customFlowLists), null);
  221. }
  222. @ApiOperation(value = "流程逻辑删除")
  223. @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
  224. @RequestMapping(value = "/enable", method = RequestMethod.POST)
  225. @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.DELETE)
  226. public Result enable(@Valid @RequestBody CustomFlowParam customFlowParam, BindingResult bindingResult) {
  227. if (bindingResult.hasErrors()) {
  228. return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
  229. }
  230. TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(customFlowParam.getId());
  231. Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("自定义流程数据为空"));
  232. if (!customFlowParam.getEnable()) {
  233. List<TFCustomFlowEntity> tfCustomFlowEntityList = tfCustomFlowEntityService.findListByCustomFlowId(customFlowParam.getId());
  234. if (Objects.nonNull(tfCustomFlowEntityList) && tfCustomFlowEntityList.size() > 0) {
  235. List<Long> flowIds = tfCustomFlowEntityList.stream().map(e -> e.getFlowId()).collect(Collectors.toList());
  236. int min = 0;
  237. int max = SystemConstant.IN_SIZE_MAX, size = flowIds.size();
  238. if (max >= size) {
  239. max = size;
  240. }
  241. while (max <= size) {
  242. QueryWrapper<TFFlowApprove> tfFlowApproveQueryWrapper = new QueryWrapper<>();
  243. tfFlowApproveQueryWrapper.lambda().ne(TFFlowApprove::getStatus, FlowStatusEnum.FINISH)
  244. .ne(TFFlowApprove::getStatus, FlowStatusEnum.END)
  245. .in(TFFlowApprove::getFlowId, flowIds.subList(min, max));
  246. int count = tfFlowApproveService.count(tfFlowApproveQueryWrapper);
  247. if (count > 0) {
  248. throw ExceptionResultEnum.ERROR.exception("已存在流程数据,不能删除");
  249. }
  250. if (max == size) {
  251. break;
  252. }
  253. min = max;
  254. max += SystemConstant.IN_SIZE_MAX;
  255. if (max >= size) {
  256. max = size;
  257. }
  258. }
  259. }
  260. }
  261. tfCustomFlow.setEnable(!customFlowParam.getEnable() ? null : customFlowParam.getEnable());
  262. return ResultUtil.ok(tfCustomFlowService.updateById(tfCustomFlow));
  263. }
  264. @ApiOperation(value = "查看流程信息")
  265. @ApiResponses({@ApiResponse(code = 200, message = "审批流程信息", response = FlowViewResult.class)})
  266. @RequestMapping(value = "/view", method = RequestMethod.POST)
  267. public Result view(@ApiParam(value = "流程id", required = true) @RequestParam String flowId) {
  268. return ResultUtil.ok(activitiService.getFlowView(SystemConstant.convertIdToLong(flowId)));
  269. }
  270. @ApiOperation(value = "流程审批记录逻辑删除")
  271. @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
  272. @RequestMapping(value = "/approve/enable", method = RequestMethod.POST)
  273. @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.DELETE)
  274. public Result approveEnable(@Valid @RequestBody CustomFlowParam customFlowParam, BindingResult bindingResult) {
  275. if (bindingResult.hasErrors()) {
  276. return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
  277. }
  278. TFFlowApprove tfFlowApprove = tfFlowApproveService.getById(customFlowParam.getId());
  279. Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("流程审批记录数据为空"));
  280. tfFlowApprove.setEnable(customFlowParam.getEnable());
  281. return ResultUtil.ok(tfFlowApproveService.updateById(tfFlowApprove));
  282. }
  283. @ApiOperation(value = "流程终止")
  284. @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
  285. @RequestMapping(value = "/end", method = RequestMethod.POST)
  286. @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UN_KNOW)
  287. public Result end(@ApiParam(value = "流程id", required = true) @RequestParam String flowId) {
  288. activitiService.flowEnd(flowId);
  289. return ResultUtil.ok();
  290. }
  291. @ApiOperation(value = "获取所有流程节点")
  292. @ApiResponses({@ApiResponse(code = 200, message = "流程节点", response = FlowTaskResult.class)})
  293. @RequestMapping(value = "/task/all", method = RequestMethod.POST)
  294. public Result taskAll(@ApiParam(value = "流程id", required = true) @RequestParam String flowId) {
  295. return ResultUtil.ok(activitiService.getTaskAll(flowId));
  296. }
  297. @ApiOperation(value = "流程节点转他人审批")
  298. @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
  299. @RequestMapping(value = "/task/approver/exchange", method = RequestMethod.POST)
  300. @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
  301. public Result taskApproverExchange(@ApiParam(value = "审批人id", required = true) @RequestParam String userId,
  302. @ApiParam(value = "流程节点id", required = true) @RequestParam String taskId) {
  303. Map<String, Object> map = activitiService.taskApproverExchange(userId, taskId);
  304. activitiService.sendFlowTaskExchangeMsg(map);
  305. return ResultUtil.ok(map.get(SystemConstant.SUCCESS));
  306. }
  307. @ApiOperation(value = "获取当前流程节点信息")
  308. @ApiResponses({@ApiResponse(code = 200, message = "当前流程节点信息", response = TaskInfoResult.class)})
  309. @RequestMapping(value = "/task/info", method = RequestMethod.POST)
  310. public Result taskInfo(@ApiParam(value = "流程节点id", required = true) @RequestParam String taskId) {
  311. return ResultUtil.ok(activitiService.getTaskInfo(SystemConstant.convertIdToLong(taskId)));
  312. }
  313. @ApiOperation(value = "重命名自定义流程名称")
  314. @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
  315. @RequestMapping(value = "/rename", method = RequestMethod.POST)
  316. @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
  317. public Result rename(@Valid @RequestBody CustomFlowRenameParam customFlowRenameParam, BindingResult bindingResult) {
  318. if (bindingResult.hasErrors()) {
  319. return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
  320. }
  321. SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
  322. UpdateWrapper<TFCustomFlow> tfCustomFlowUpdateWrapper = new UpdateWrapper<>();
  323. tfCustomFlowUpdateWrapper.lambda().eq(TFCustomFlow::getId, customFlowRenameParam.getId())
  324. .set(TFCustomFlow::getName, customFlowRenameParam.getName())
  325. .set(TFCustomFlow::getUpdateId, sysUser.getId())
  326. .set(TFCustomFlow::getUpdateTime, System.currentTimeMillis());
  327. return ResultUtil.ok(tfCustomFlowService.update(tfCustomFlowUpdateWrapper));
  328. }
  329. @ApiOperation(value = "根据流程类型获取流程节点")
  330. @ApiResponses({@ApiResponse(code = 200, message = "当前流程节点信息", response = FlowInfoResult.class)})
  331. @RequestMapping(value = "/get_flow_info_by_type", method = RequestMethod.POST)
  332. public Result getFlowInfoByType(@ApiParam(value = "流程类型", required = false) @RequestParam(required = false) TFCustomTypeEnum type,
  333. @ApiParam(value = "流程id", required = false) @RequestParam(required = false) String flowId) {
  334. if (Objects.isNull(type) && Objects.isNull(flowId)) {
  335. throw ExceptionResultEnum.ERROR.exception("流程类型或流程id必须输入一项");
  336. }
  337. return ResultUtil.ok(activitiService.getFlowInfoByType(type, Objects.nonNull(flowId) ? SystemConstant.convertIdToLong(flowId) : null));
  338. }
  339. }