TFCustomFlowController.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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.OperationTypeEnum;
  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(operationType = OperationTypeEnum.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(operationType = OperationTypeEnum.APPROVE, detail = "审核操作,命题任务ID:{{flowTaskApproveParam.taskId}}、审核结果:{{flowTaskApproveParam.approvePass}}")
  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. return ResultUtil.ok(true);
  169. }
  170. @ApiOperation(value = "流程审批记录列表")
  171. @ApiResponses({@ApiResponse(code = 200, message = "流程审批记录信息", response = FlowApproveListResult.class)})
  172. @RequestMapping(value = "/approve/list", method = RequestMethod.POST)
  173. public Result taskApproveList(@ApiParam(value = "学期", required = false) @RequestParam(value = "semesterId", required = false) Long semesterId,
  174. @ApiParam(value = "考试", required = false) @RequestParam(value = "examId", required = false) Long examId,
  175. @ApiParam(value = "课程代码", required = false) @RequestParam(value = "courseCode", required = false) String courseCode,
  176. @ApiParam(value = "试着编号", required = false) @RequestParam(value = "paperNumber", required = false) String paperNumber,
  177. @ApiParam(value = "状态", required = false) @RequestParam(required = false) FlowStatusEnum status,
  178. @ApiParam(value = "提交人名称", required = false) @RequestParam(required = false) String teacherUserName,
  179. @ApiParam(value = "教研室", required = false) @RequestParam(required = false) String teachingRoomId,
  180. @ApiParam(value = "提交开始时间", required = false) @RequestParam(required = false) Long startTime,
  181. @ApiParam(value = "提交结束时间", required = false) @RequestParam(required = false) Long endTime,
  182. @ApiParam(value = "提交人名称", required = false) @RequestParam(required = false) String pendApproveUserName,
  183. @ApiParam(value = "页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
  184. @ApiParam(value = "数量", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
  185. if (semesterId == null) {
  186. throw ExceptionResultEnum.ERROR.exception("请选择学期");
  187. }
  188. if (examId == null) {
  189. throw ExceptionResultEnum.ERROR.exception("请选择考试");
  190. }
  191. return ResultUtil.ok(tfFlowApproveService.findApproveList(new Page<>(pageNumber, pageSize), semesterId, examId, courseCode, paperNumber, status, teacherUserName, SystemConstant.convertIdToLong(teachingRoomId), startTime, endTime, pendApproveUserName, SystemConstant.getHeadOrUserSchoolId(), null));
  192. }
  193. @ApiOperation(value = "流程列表")
  194. @ApiResponses({@ApiResponse(code = 200, message = "流程信息", response = TFCustomFlow.class)})
  195. @RequestMapping(value = "/list", method = RequestMethod.POST)
  196. public Result list(@ApiParam(value = "流程名称", required = false) @RequestParam(required = false) String name,
  197. @ApiParam(value = "页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
  198. @ApiParam(value = "数量", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
  199. return ResultUtil.ok(tfCustomFlowService.list(new Page<>(pageNumber, pageSize), name, SystemConstant.getHeadOrUserSchoolId(), null));
  200. }
  201. @ApiOperation(value = "流程编辑")
  202. @ApiResponses({@ApiResponse(code = 200, message = "流程信息", response = ResultUtil.class)})
  203. @RequestMapping(value = "/edit", method = RequestMethod.POST)
  204. @OperationLogDetail(operationType = OperationTypeEnum.UPDATE)
  205. public Result edit(@ApiParam(value = "自定义流程id", required = true) @RequestParam String id) {
  206. TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(SystemConstant.convertIdToLong(id));
  207. Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("自定义流程数据为空"));
  208. Optional.ofNullable(tfCustomFlow.getObjectData()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("自定义流程绘图数据为空"));
  209. List<CustomFlowCommonDto> customFlowLists = new Gson().fromJson(tfCustomFlow.getObjectData(), new TypeToken<List<CustomFlowCommonDto>>() {
  210. }.getType());
  211. return ResultUtil.ok(new CustomFlowEditDto(tfCustomFlow, customFlowLists), null);
  212. }
  213. @ApiOperation(value = "流程逻辑删除")
  214. @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
  215. @RequestMapping(value = "/enable", method = RequestMethod.POST)
  216. @OperationLogDetail(operationType = OperationTypeEnum.DELETE)
  217. public Result enable(@Valid @RequestBody CustomFlowParam customFlowParam, BindingResult bindingResult) {
  218. if (bindingResult.hasErrors()) {
  219. return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
  220. }
  221. TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(customFlowParam.getId());
  222. Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("自定义流程数据为空"));
  223. if (!customFlowParam.getEnable()) {
  224. List<TFCustomFlowEntity> tfCustomFlowEntityList = tfCustomFlowEntityService.findListByCustomFlowId(customFlowParam.getId());
  225. if (Objects.nonNull(tfCustomFlowEntityList) && tfCustomFlowEntityList.size() > 0) {
  226. List<Long> flowIds = tfCustomFlowEntityList.stream().map(e -> e.getFlowId()).collect(Collectors.toList());
  227. int min = 0;
  228. int max = SystemConstant.IN_SIZE_MAX, size = flowIds.size();
  229. if (max >= size) {
  230. max = size;
  231. }
  232. while (max <= size) {
  233. QueryWrapper<TFFlowApprove> tfFlowApproveQueryWrapper = new QueryWrapper<>();
  234. tfFlowApproveQueryWrapper.lambda().ne(TFFlowApprove::getStatus, FlowStatusEnum.FINISH)
  235. .ne(TFFlowApprove::getStatus, FlowStatusEnum.END)
  236. .in(TFFlowApprove::getFlowId, flowIds.subList(min, max));
  237. int count = tfFlowApproveService.count(tfFlowApproveQueryWrapper);
  238. if (count > 0) {
  239. throw ExceptionResultEnum.ERROR.exception("已存在流程数据,不能删除");
  240. }
  241. if (max == size) {
  242. break;
  243. }
  244. min = max;
  245. max += SystemConstant.IN_SIZE_MAX;
  246. if (max >= size) {
  247. max = size;
  248. }
  249. }
  250. }
  251. }
  252. tfCustomFlow.setEnable(!customFlowParam.getEnable() ? null : customFlowParam.getEnable());
  253. return ResultUtil.ok(tfCustomFlowService.updateById(tfCustomFlow));
  254. }
  255. @ApiOperation(value = "查看流程信息")
  256. @ApiResponses({@ApiResponse(code = 200, message = "审批流程信息", response = FlowViewResult.class)})
  257. @RequestMapping(value = "/view", method = RequestMethod.POST)
  258. public Result view(@ApiParam(value = "流程id", required = true) @RequestParam String flowId) {
  259. return ResultUtil.ok(activitiService.getFlowView(SystemConstant.convertIdToLong(flowId)));
  260. }
  261. @ApiOperation(value = "流程审批记录逻辑删除")
  262. @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
  263. @RequestMapping(value = "/approve/enable", method = RequestMethod.POST)
  264. @OperationLogDetail(operationType = OperationTypeEnum.DELETE)
  265. public Result approveEnable(@Valid @RequestBody CustomFlowParam customFlowParam, BindingResult bindingResult) {
  266. if (bindingResult.hasErrors()) {
  267. return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
  268. }
  269. TFFlowApprove tfFlowApprove = tfFlowApproveService.getById(customFlowParam.getId());
  270. Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("流程审批记录数据为空"));
  271. tfFlowApprove.setEnable(customFlowParam.getEnable());
  272. return ResultUtil.ok(tfFlowApproveService.updateById(tfFlowApprove));
  273. }
  274. @ApiOperation(value = "流程终止")
  275. @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
  276. @RequestMapping(value = "/end", method = RequestMethod.POST)
  277. @OperationLogDetail(operationType = OperationTypeEnum.UPDATE)
  278. public Result end(@ApiParam(value = "流程id", required = true) @RequestParam String flowId) {
  279. activitiService.flowEnd(flowId);
  280. return ResultUtil.ok();
  281. }
  282. @ApiOperation(value = "获取所有流程节点")
  283. @ApiResponses({@ApiResponse(code = 200, message = "流程节点", response = FlowTaskResult.class)})
  284. @RequestMapping(value = "/task/all", method = RequestMethod.POST)
  285. public Result taskAll(@ApiParam(value = "流程id", required = true) @RequestParam String flowId) {
  286. return ResultUtil.ok(activitiService.getTaskAll(flowId));
  287. }
  288. @ApiOperation(value = "流程节点转他人审批")
  289. @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
  290. @RequestMapping(value = "/task/approver/exchange", method = RequestMethod.POST)
  291. @OperationLogDetail(operationType = OperationTypeEnum.UPDATE)
  292. public Result taskApproverExchange(@ApiParam(value = "审批人id", required = true) @RequestParam String userId,
  293. @ApiParam(value = "流程节点id", required = true) @RequestParam String taskId) {
  294. Map<String, Object> map = activitiService.taskApproverExchange(userId, taskId);
  295. activitiService.sendFlowTaskExchangeMsg(map);
  296. return ResultUtil.ok(map.get(SystemConstant.SUCCESS));
  297. }
  298. @ApiOperation(value = "获取当前流程节点信息")
  299. @ApiResponses({@ApiResponse(code = 200, message = "当前流程节点信息", response = TaskInfoResult.class)})
  300. @RequestMapping(value = "/task/info", method = RequestMethod.POST)
  301. public Result taskInfo(@ApiParam(value = "流程节点id") @RequestParam(required = false) String taskId) {
  302. return ResultUtil.ok(activitiService.getTaskInfo(SystemConstant.convertIdToLong(taskId)));
  303. }
  304. @ApiOperation(value = "重命名自定义流程名称")
  305. @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
  306. @RequestMapping(value = "/rename", method = RequestMethod.POST)
  307. @OperationLogDetail(operationType = OperationTypeEnum.UPDATE)
  308. public Result rename(@Valid @RequestBody CustomFlowRenameParam customFlowRenameParam, BindingResult bindingResult) {
  309. if (bindingResult.hasErrors()) {
  310. return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
  311. }
  312. SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
  313. UpdateWrapper<TFCustomFlow> tfCustomFlowUpdateWrapper = new UpdateWrapper<>();
  314. tfCustomFlowUpdateWrapper.lambda().eq(TFCustomFlow::getId, customFlowRenameParam.getId())
  315. .set(TFCustomFlow::getName, customFlowRenameParam.getName())
  316. .set(TFCustomFlow::getUpdateId, sysUser.getId())
  317. .set(TFCustomFlow::getUpdateTime, System.currentTimeMillis());
  318. return ResultUtil.ok(tfCustomFlowService.update(tfCustomFlowUpdateWrapper));
  319. }
  320. @ApiOperation(value = "根据流程类型获取流程节点")
  321. @ApiResponses({@ApiResponse(code = 200, message = "当前流程节点信息", response = FlowInfoResult.class)})
  322. @RequestMapping(value = "/get_flow_info_by_type", method = RequestMethod.POST)
  323. public Result getFlowInfoByType(@ApiParam(value = "流程类型", required = false) @RequestParam(required = false) TFCustomTypeEnum type,
  324. @ApiParam(value = "流程id", required = false) @RequestParam(required = false) String flowId) {
  325. if (Objects.isNull(type) && Objects.isNull(flowId)) {
  326. throw ExceptionResultEnum.ERROR.exception("流程类型或流程id必须输入一项");
  327. }
  328. return ResultUtil.ok(activitiService.getFlowInfoByType(type, Objects.nonNull(flowId) ? SystemConstant.convertIdToLong(flowId) : null));
  329. }
  330. }