From 34981c30a78e8bbd7791131059a9210f9928b62c Mon Sep 17 00:00:00 2001
From: 刘光辉 <347230014@qq.com>
Date: 星期四, 17 九月 2026 09:24:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into master
---
jnpf-flowable/jnpf-flowable-controller/src/main/java/jnpf/flowable/controller/TemplateController.java | 655 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 655 insertions(+), 0 deletions(-)
diff --git a/jnpf-flowable/jnpf-flowable-controller/src/main/java/jnpf/flowable/controller/TemplateController.java b/jnpf-flowable/jnpf-flowable-controller/src/main/java/jnpf/flowable/controller/TemplateController.java
new file mode 100644
index 0000000..c00c966
--- /dev/null
+++ b/jnpf-flowable/jnpf-flowable-controller/src/main/java/jnpf/flowable/controller/TemplateController.java
@@ -0,0 +1,655 @@
+package jnpf.flowable.controller;
+
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.hutool.core.util.ObjectUtil;
+import com.google.common.collect.ImmutableList;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import jnpf.base.ActionResult;
+import jnpf.base.UserInfo;
+import jnpf.base.controller.SuperController;
+import jnpf.base.entity.DictionaryDataEntity;
+import jnpf.base.entity.SystemEntity;
+import jnpf.base.entity.VisualdevEntity;
+import jnpf.base.model.export.TemplateExportVo;
+import jnpf.base.vo.DownloadVO;
+import jnpf.base.vo.ListVO;
+import jnpf.base.vo.PageListVO;
+import jnpf.base.vo.PaginationVO;
+import jnpf.constant.MsgCode;
+import jnpf.emnus.ModuleTypeEnum;
+import jnpf.exception.WorkFlowException;
+import jnpf.flowable.TemplateApi;
+import jnpf.flowable.entity.TemplateEntity;
+import jnpf.flowable.entity.TemplateJsonEntity;
+import jnpf.flowable.entity.TemplateNodeEntity;
+import jnpf.flowable.enums.TemplateJsonStatueEnum;
+import jnpf.flowable.enums.TemplateStatueEnum;
+import jnpf.flowable.model.candidates.CandidateUserVo;
+import jnpf.flowable.model.template.*;
+import jnpf.flowable.model.templatejson.FlowListModel;
+import jnpf.flowable.model.templatejson.TemplateJsonExportModel;
+import jnpf.flowable.model.templatejson.TemplateJsonInfoVO;
+import jnpf.flowable.model.templatejson.TemplateJsonSelectVO;
+import jnpf.flowable.model.templatenode.TemplateNodeCrFrom;
+import jnpf.flowable.model.templatenode.TemplateNodeUpFrom;
+import jnpf.flowable.model.util.FlowNature;
+import jnpf.flowable.service.*;
+import jnpf.flowable.util.FlowUtil;
+import jnpf.flowable.util.OperatorUtil;
+import jnpf.flowable.util.ServiceUtil;
+import jnpf.model.FlowWorkListVO;
+import jnpf.permission.entity.UserEntity;
+import jnpf.permission.model.authorize.AuthorizeVO;
+import jnpf.permission.model.user.WorkHandoverModel;
+import jnpf.util.*;
+import jnpf.util.context.RequestContext;
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Tag(name = "娴佺▼妯℃澘", description = "flowTemplate")
+@RestController
+@RequestMapping("/template")
+@RequiredArgsConstructor
+public class TemplateController extends SuperController<TemplateService, TemplateEntity> implements TemplateApi {
+
+
+ private final ServiceUtil serviceUtil;
+
+ private final OperatorUtil operatorUtil;
+
+
+ private final TemplateService templateService;
+
+ private final TemplateJsonService templateJsonService;
+
+ private final CommonService commonService;
+
+ private final OperatorService operatorService;
+
+ private final TemplateUseNumService templateUseNumService;
+
+ private final FlowUtil flowUtil;
+
+ /**
+ * 娴佺▼鍒楄〃
+ *
+ * @param pagination 鍒嗛〉妯″瀷
+ * @return
+ */
+ @Operation(summary = "娴佺▼鍒楄〃")
+ @GetMapping
+ public ActionResult<PageListVO<TemplatePageLisVO>> list(TemplatePagination pagination) {
+ pagination.setSystemId(serviceUtil.getSystemCodeById(RequestContext.getAppCode()));
+ List<TemplateEntity> list = templateService.getList(pagination);
+ List<DictionaryDataEntity> dictionList = serviceUtil.getDictionName(list.stream().map(TemplateEntity::getCategory).collect(Collectors.toList()));
+ List<UserEntity> userList = serviceUtil.getUserName(list.stream().map(TemplateEntity::getCreatorUserId).collect(Collectors.toList()));
+ List<TemplatePageLisVO> listVO = new ArrayList<>();
+ for (TemplateEntity entity : list) {
+ TemplatePageLisVO vo = JsonUtil.getJsonToBean(entity, TemplatePageLisVO.class);
+ DictionaryDataEntity dataEntity = dictionList.stream().filter(t -> t.getId().equals(entity.getCategory())).findFirst().orElse(null);
+ vo.setCategory(dataEntity != null ? dataEntity.getFullName() : "");
+ UserEntity userEntity = userList.stream().filter(t -> t.getId().equals(entity.getCreatorUserId())).findFirst().orElse(null);
+ vo.setCreatorUser(userEntity != null ? userEntity.getRealName() + "/" + userEntity.getAccount() : "");
+ listVO.add(vo);
+ }
+ PaginationVO paginationVO = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
+ return ActionResult.page(listVO, paginationVO);
+ }
+
+ /**
+ * 娴佺▼鍒楄〃
+ *
+ * @param pagination 鍒嗛〉妯″瀷
+ * @return
+ */
+ @Operation(summary = "娴佺▼鍒楄〃")
+ @GetMapping("/Selector")
+ public ActionResult<PageListVO<TemplatePageVo>> selector(TemplatePagination pagination) {
+ List<TemplatePageVo> list = templateService.getSelector(pagination);
+ //娣诲姞搴旂敤淇℃伅
+ List<String> sysIds = list.stream().map(TemplatePageVo::getSystemId).collect(Collectors.toList());
+ Map<String, SystemEntity> sysMap = serviceUtil.getSystemList(sysIds).stream().collect(Collectors.toMap(SystemEntity::getId, t -> t));
+ list.stream().forEach(t -> t.setSystemName(sysMap.get(t.getSystemId()) != null ? sysMap.get(t.getSystemId()).getFullName() : ""));
+ PaginationVO paginationVO = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
+ return ActionResult.page(list, paginationVO);
+ }
+
+ @Operation(summary = "甯哥敤娴佺▼鍓嶅叚")
+ @GetMapping("/useNumSelect")
+ public ActionResult<List<TemplateUseNumVo>> useNumSelector() {
+ AuthorizeVO authorize = serviceUtil.getAuthorizeByUser();
+ List<TemplateUseNumVo> menuUseNum = templateUseNumService.getMenuUseNum(0, authorize.getFlowIdList());
+ return ActionResult.success(menuUseNum);
+ }
+
+ @Operation(summary = "鐢ㄦ埛璁块棶娴佺▼娆℃暟璁板綍")
+ @PostMapping("/useTemplateNum/{templateId}")
+ public ActionResult<Object> useTemplateNum(@PathVariable String templateId) {
+ templateUseNumService.insertOrUpdateUseNum(templateId);
+ return ActionResult.success();
+ }
+
+ @Operation(summary = "鐢ㄦ埛璁块棶娴佺▼娆℃暟娓呯┖")
+ @DeleteMapping("/useTemplateNum/{templateId}")
+ public ActionResult<Object> deleteUseTemplateNum(@PathVariable String templateId) {
+ String userId = UserProvider.getUser().getUserId();
+ templateUseNumService.deleteUseNum(templateId, userId);
+ return ActionResult.success();
+ }
+
+ /**
+ * 甯哥敤娴佺▼鏍�
+ */
+ @Operation(summary = "甯哥敤娴佺▼鏍�")
+ @GetMapping("/CommonFlowTree")
+ public ActionResult<Object> getTreeCommon() {
+ ListVO<TemplateTreeListVo> vo = new ListVO<>();
+ vo.setList(templateService.getTreeCommon());
+ return ActionResult.success(vo);
+ }
+
+ /**
+ * 鏍戝舰鍒楄〃
+ */
+ @Operation(summary = "鏍戝舰鍒楄〃")
+ @GetMapping("/TreeList")
+ public ActionResult<ListVO<TemplateTreeListVo>> treeList(@RequestParam(value = "formType", required = false) Integer formType) {
+ ListVO<TemplateTreeListVo> vo = new ListVO<>();
+ vo.setList(templateService.treeList(formType));
+ return ActionResult.success(vo);
+ }
+
+ /**
+ * 娴佺▼鍩虹淇℃伅
+ *
+ * @param id 涓婚敭
+ * @return
+ */
+ @Operation(summary = "娴佺▼鍩虹淇℃伅")
+ @GetMapping("/{id}")
+ @Parameter(name = "id", description = "涓婚敭", required = true)
+ public ActionResult<TemplateInfoVO> info(@PathVariable("id") String id) throws WorkFlowException {
+ TemplateEntity entity = templateService.getInfo(id);
+ TemplateInfoVO vo = JsonUtil.getJsonToBean(entity, TemplateInfoVO.class);
+ return ActionResult.success(vo);
+ }
+
+ /**
+ * 娴佺▼鐗堟湰鍒楄〃
+ *
+ * @param id 涓婚敭
+ * @return
+ */
+ @Operation(summary = "娴佺▼鐗堟湰鍒楄〃")
+ @GetMapping("/Version/{id}")
+ @Parameter(name = "id", description = "涓婚敭", required = true)
+ public ActionResult<List<TemplateJsonSelectVO>> version(@PathVariable("id") String id) {
+ List<TemplateJsonEntity> list = templateJsonService.getList(id).stream().filter(e -> ObjectUtil.isNotEmpty(e.getVersion())).collect(Collectors.toList());
+ List<TemplateJsonSelectVO> listVO = new ArrayList<>();
+ for (TemplateJsonEntity jsonEntity : list) {
+ TemplateJsonSelectVO vo = JsonUtil.getJsonToBean(jsonEntity, TemplateJsonSelectVO.class);
+ vo.setFlowVersion(jsonEntity.getVersion());
+ vo.setFullName("娴佺▼鐗堟湰V" + jsonEntity.getVersion());
+ listVO.add(vo);
+ }
+ return ActionResult.success(listVO);
+ }
+
+ /**
+ * 娴佺▼妯℃澘淇℃伅
+ *
+ * @param id 涓婚敭
+ * @return
+ */
+ @Operation(summary = "娴佺▼妯℃澘淇℃伅")
+ @GetMapping("/Info/{id}")
+ @Parameter(name = "id", description = "涓婚敭", required = true)
+ public ActionResult<TemplateJsonInfoVO> templateJsonInfo(@PathVariable("id") String id) throws WorkFlowException {
+ return ActionResult.success(templateJsonService.getInfoVo(id));
+ }
+
+ /**
+ * 鏂板缓娴佺▼
+ *
+ * @param form 娴佺▼妯″瀷
+ * @return
+ */
+ @Operation(summary = "鏂板缓娴佺▼")
+ @PostMapping
+ @Parameter(name = "form", description = "娴佺▼妯″瀷", required = true)
+ @SaCheckPermission(value = {"onlineDev.flowEngine"})
+ public ActionResult<Object> create(@RequestBody @Valid TemplateNodeCrFrom form) throws WorkFlowException {
+ TemplateEntity entity = JsonUtil.getJsonToBean(form, TemplateEntity.class);
+ String flowConfig = form.getFlowConfig();
+ FlowConfigModel config = JsonUtil.getJsonToBean(flowConfig, FlowConfigModel.class);
+ config = config == null ? new FlowConfigModel() : config;
+ entity.setVisibleType(config.getVisibleType());
+ templateService.create(entity, form.getFlowXml(), form.getFlowNodes());
+ return ActionResult.success(MsgCode.SU001.get(), entity.getId());
+ }
+
+ /**
+ * 鏇存柊娴佺▼
+ *
+ * @param id 涓婚敭
+ * @param form 娴佺▼妯″瀷
+ * @return
+ */
+ @Operation(summary = "鏇存柊娴佺▼")
+ @PutMapping("/{id}")
+ @Parameter(name = "id", description = "涓婚敭", required = true)
+ @Parameter(name = "form", description = "娴佺▼妯″瀷", required = true)
+ @SaCheckPermission(value = {"onlineDev.flowEngine"})
+ public ActionResult<Object> update(@PathVariable("id") String id, @RequestBody @Valid TemplateNodeUpFrom form) throws WorkFlowException {
+ TemplateEntity entity = JsonUtil.getJsonToBean(form, TemplateEntity.class);
+ String flowConfig = form.getFlowConfig();
+ FlowConfigModel config = JsonUtil.getJsonToBean(flowConfig, FlowConfigModel.class);
+ config = config == null ? new FlowConfigModel() : config;
+ entity.setVisibleType(config.getVisibleType());
+ TemplateEntity info = templateService.getInfo(id);
+ entity.setSystemId(info.getSystemId());
+ templateService.update(id, entity);
+ return ActionResult.success(MsgCode.SU004.get());
+ }
+
+ /**
+ * 鏇存柊娴佺▼绫诲瀷
+ *
+ * @param id 涓婚敭
+ */
+ @Operation(summary = "鏇存柊娴佺▼绫诲瀷")
+ @PutMapping("/{id}/UpdateType")
+ @SaCheckPermission(value = {"onlineDev.flowEngine"})
+ public ActionResult<Object> updateType(@PathVariable("id") String id) throws WorkFlowException {
+ TemplateEntity entity = templateService.getInfo(id);
+ entity.setType(FlowNature.STANDARD);
+ templateService.updateById(entity);
+ return ActionResult.success(MsgCode.SU004.get());
+ }
+
+ /**
+ * 鍒犻櫎娴佺▼寮曟搸
+ *
+ * @param id 涓婚敭
+ * @return
+ */
+ @Operation(summary = "鍒犻櫎娴佺▼寮曟搸")
+ @DeleteMapping("/{id}")
+ @Parameter(name = "id", description = "涓婚敭", required = true)
+ @SaCheckPermission(value = {"onlineDev.flowEngine"})
+ public ActionResult<Object> delete(@PathVariable("id") String id) throws WorkFlowException {
+ TemplateEntity entity = templateService.getInfo(id);
+ templateService.delete(entity);
+ return ActionResult.success(MsgCode.SU003.get());
+ }
+
+ /**
+ * 鍒犻櫎娴佺▼鐗堟湰
+ *
+ * @param id 涓婚敭
+ * @return
+ */
+ @Operation(summary = "鍒犻櫎娴佺▼鐗堟湰")
+ @DeleteMapping("/Info/{id}")
+ @Parameter(name = "id", description = "涓婚敭", required = true)
+ @SaCheckPermission(value = {"onlineDev.flowEngine"})
+ public ActionResult<Object> deleteInfo(@PathVariable("id") String id) throws WorkFlowException {
+ TemplateJsonEntity entity = templateJsonService.getInfo(id);
+ List<TemplateJsonEntity> list = templateJsonService.getList(entity.getTemplateId());
+ if (list.size() == 1) {
+ return ActionResult.fail(MsgCode.WF071.get());
+ }
+ if (Objects.equals(entity.getState(), TemplateJsonStatueEnum.START.getCode())) {
+ return ActionResult.fail(MsgCode.WF072.get());
+ }
+ if (Objects.equals(entity.getState(), TemplateJsonStatueEnum.HISTORY.getCode())) {
+ return ActionResult.fail(MsgCode.WF073.get());
+ }
+ templateJsonService.delete(ImmutableList.of(id));
+ return ActionResult.success(MsgCode.SU003.get());
+ }
+
+ /**
+ * 涓婃灦涓嬫灦
+ *
+ * @param id 涓婚敭
+ * @param fo 鍙傛暟
+ */
+ @Operation(summary = "涓婃灦涓嬫灦")
+ @PutMapping("/{id}/UpDownShelf")
+ @SaCheckPermission(value = {"onlineDev.flowEngine"})
+ public ActionResult<Object> updateStatus(@PathVariable("id") String id, @RequestBody UpDownModel fo) throws WorkFlowException {
+ TemplateEntity entity = templateService.getInfo(id);
+ if (ObjectUtil.equals(fo.getIsUp(), 0)) {
+ entity.setStatus(TemplateStatueEnum.UP.getCode());
+ } else {
+ entity.setStatus(ObjectUtil.equals(fo.getIsHidden(), 0) ? TemplateStatueEnum.DOWN_CONTINUE.getCode() : TemplateStatueEnum.DOWN_HIDDEN.getCode());
+ }
+ templateService.updateById(entity);
+ return ActionResult.success(MsgCode.SU005.get());
+ }
+
+ /**
+ * 澶嶅埗娴佺▼寮曟搸
+ *
+ * @param id 涓婚敭
+ * @return
+ */
+ @Operation(summary = "澶嶅埗娴佺▼寮曟搸")
+ @PostMapping("/{id}/Actions/Copy")
+ @Parameter(name = "id", description = "涓婚敭", required = true)
+ @SaCheckPermission(value = {"onlineDev.flowEngine"})
+ public ActionResult<Object> copy(@PathVariable("id") String id) throws WorkFlowException {
+ TemplateEntity entity = templateService.getInfo(id);
+ templateService.copy(entity);
+ return ActionResult.success(MsgCode.SU007.get());
+ }
+
+ /**
+ * 澶嶅埗娴佺▼鐗堟湰
+ *
+ * @param id 涓婚敭
+ * @return
+ */
+ @Operation(summary = "澶嶅埗娴佺▼鐗堟湰")
+ @PostMapping("/Info/{id}")
+ @Parameter(name = "id", description = "涓婚敭", required = true)
+ @SaCheckPermission(value = {"onlineDev.flowEngine"})
+ public ActionResult<Object> copyVersion(@PathVariable("id") String id) throws WorkFlowException {
+ String templateJsonId = RandomUtil.uuId();
+ TemplateJsonEntity entity = templateJsonService.getInfo(id);
+ templateJsonService.copy(entity, templateJsonId);
+ return ActionResult.success(MsgCode.SU007.get(), templateJsonId);
+ }
+
+ /**
+ * 娴佺▼淇濆瓨鎴栧彂甯�
+ *
+ * @return
+ */
+ @Operation(summary = "娴佺▼淇濆瓨鎴栧彂甯�")
+ @PostMapping("/Save")
+ @SaCheckPermission(value = {"onlineDev.flowEngine"})
+ public ActionResult<Object> save(@RequestBody @Valid TemplateNodeUpFrom form) throws WorkFlowException {
+ templateJsonService.save(form);
+ return ActionResult.success(MsgCode.SU004.get());
+ }
+
+ /**
+ * 瀵煎嚭
+ *
+ * @param id 涓婚敭
+ */
+ @Operation(summary = "瀵煎嚭")
+ @GetMapping("/{id}/Actions/Export")
+ @Parameter(name = "id", description = "涓婚敭", required = true)
+ public ActionResult<DownloadVO> export(@PathVariable("id") String id) throws WorkFlowException {
+ TemplateExportModel model = templateService.export(id);
+ DownloadVO downloadVO = serviceUtil.exportData(model);
+ return ActionResult.success(downloadVO);
+ }
+
+ /**
+ * 瀵煎叆
+ *
+ * @param file 鏂囦欢
+ * @param type 绫诲瀷
+ */
+ @Operation(summary = "瀵煎叆")
+ @PostMapping(value = "/Actions/Import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+ @SaCheckPermission(value = {"onlineDev.flowEngine"})
+ public ActionResult<String> importData(@RequestPart("file") MultipartFile file, @RequestParam("type") String type) throws WorkFlowException {
+ //鍒ゆ柇鏄惁涓�.json缁撳熬
+ if (FileUtil.existsSuffix(file, ModuleTypeEnum.FLOW_FLOWENGINE.getTableName())) {
+ return ActionResult.fail(MsgCode.IMP002.get());
+ }
+ //鑾峰彇鏂囦欢鍐呭
+ String fileContent = FileUtil.getFileContent(file);
+ TemplateExportModel model = JsonUtil.getJsonToBean(fileContent, TemplateExportModel.class);
+ if (ObjectUtil.isEmpty(model.getTemplate())) {
+ return ActionResult.fail(MsgCode.IMP004.get());
+ }
+ templateService.importData(model, type);
+ return ActionResult.success(MsgCode.IMP001.get());
+ }
+
+ /**
+ * 濮旀墭娴佺▼閫夋嫨灞曠ず
+ *
+ * @param ids 鐗堟湰涓婚敭闆嗗悎
+ */
+ @Operation(summary = "濮旀墭娴佺▼閫夋嫨灞曠ず")
+ @PostMapping("/GetFlowList")
+ public ActionResult<Object> getFlowList(@RequestBody List<String> ids) {
+ List<TemplateEntity> list = templateService.getList(ids);
+ List<FlowListModel> voList = new ArrayList<>();
+ for (TemplateEntity templateEntity : list) {
+ FlowListModel model = new FlowListModel();
+ model.setId(templateEntity.getId());
+ model.setFullName(templateEntity.getFullName());
+ model.setEnCode(templateEntity.getEnCode());
+ voList.add(model);
+ }
+ return ActionResult.success(voList);
+ }
+
+ /**
+ * 瀛愭祦绋嬭〃鍗曚俊鎭�
+ *
+ * @param id 鐗堟湰涓婚敭
+ */
+ @Operation(summary = "瀛愭祦绋嬭〃鍗曚俊鎭�")
+ @GetMapping("/{id}/FormInfo")
+ public ActionResult<Object> formInfo(@PathVariable("id") String id) throws WorkFlowException {
+ VisualdevEntity formInfo = templateJsonService.getFormInfo(id);
+ return ActionResult.success(formInfo);
+ }
+
+ /**
+ * 鏍规嵁琛ㄥ崟涓婚敭鑾峰彇娴佺▼
+ *
+ * @param formId 琛ㄥ崟涓婚敭
+ */
+ @Operation(summary = "鏍规嵁琛ㄥ崟涓婚敭鑾峰彇娴佺▼")
+ @GetMapping("/{formId}/FlowList")
+ public ActionResult<Object> getByFormId(@PathVariable("formId") String formId, Boolean start) {
+ FlowByFormModel model = templateService.getFlowByFormId(formId, start);
+ return ActionResult.success(model);
+ }
+
+ /**
+ * 瀛愭祦绋嬪彲鍙戣捣浜哄憳
+ *
+ * @param id 鐗堟湰涓婚敭
+ * @param pagination 鍒嗛〉鍙傛暟
+ */
+ @Operation(summary = "瀛愭祦绋嬪彲鍙戣捣浜哄憳")
+ @GetMapping("/{id}/SubFlowUserList")
+ public ActionResult<PageListVO<CandidateUserVo>> getSubFlowUserList(@PathVariable("id") String id, TemplatePagination pagination) throws WorkFlowException {
+ List<UserEntity> list = templateService.getSubFlowUserList(id, pagination);
+ List<String> userIdList = list.stream().map(UserEntity::getId).collect(Collectors.toList());
+ List<CandidateUserVo> voList = operatorUtil.getUserModel(userIdList, pagination);
+ PaginationVO paginationVO = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
+ return ActionResult.page(voList, paginationVO);
+ }
+
+ /**
+ * 甯哥敤娴佺▼
+ *
+ * @param id 鐗堟湰涓婚敭
+ */
+ @Operation(summary = "甯哥敤娴佺▼")
+ @PostMapping("/SetCommonFlow/{id}")
+ public ActionResult<Object> setCommonFlow(@PathVariable("id") String id) {
+ int flag = commonService.setCommonFLow(id);
+ if (flag == 2) {
+ return ActionResult.success(MsgCode.SU021.get());
+ }
+ return ActionResult.success(MsgCode.SU016.get());
+ }
+
+
+ /**
+ * 甯哥敤娴佺▼鍒楄〃
+ */
+ @Operation(summary = "甯哥敤娴佺▼")
+ @GetMapping("/getCommonFlowList")
+ public ActionResult<Object> getCommonFlowList(TemplatePagination pagination) {
+ pagination.setSystemId(serviceUtil.getSystemCodeById(RequestContext.getAppCode()));
+ List<TemplatePageVo> commonList = templateService.getCommonList(pagination);
+ return ActionResult.success(new ListVO<>(commonList));
+ }
+
+
+ /**
+ * 鏍规嵁妯℃澘涓婚敭鑾峰彇琛ㄥ崟
+ *
+ * @param templateId 娴佺▼妯℃澘涓婚敭
+ */
+ @Operation(summary = "鏍规嵁妯℃澘涓婚敭鑾峰彇琛ㄥ崟")
+ @GetMapping("/StartForm/{templateId}")
+ public ActionResult<Object> getFormByTemplateId(@PathVariable("templateId") String templateId) throws WorkFlowException {
+ return ActionResult.success(templateService.getFormByTemplateId(templateId));
+ }
+
+ /**
+ * 鏍规嵁妯℃澘涓婚敭鑾峰彇琛ㄥ崟涓婚敭鍜屾祦绋嬬増鏈富閿�
+ *
+ * @param templateId 娴佺▼妯℃澘涓婚敭
+ */
+ @Operation(summary = "鏍规嵁妯℃澘涓婚敭鑾峰彇琛ㄥ崟涓婚敭鍜屾祦绋嬬増鏈富閿�")
+ @GetMapping("/StartFormId/{templateId}")
+ public ActionResult<Object> getFormIdAndFlowIdByTemplateId(@PathVariable("templateId") String templateId) throws WorkFlowException {
+ List<String> userIdAll = ImmutableList.of(UserProvider.getLoginUserId());
+ return ActionResult.success(templateService.getFormIdAndFlowId(userIdAll, templateId));
+ }
+
+ @Override
+ @PostMapping("/getFlowByFormId")
+ public FlowByFormModel getFlowByFormId(@RequestParam("formId") String formId, @RequestParam("start") Boolean start) {
+ return templateService.getFlowByFormId(formId, start);
+ }
+
+ @Override
+ @GetMapping("/getFormByFlowId")
+ public String getFormByFlowId(@RequestParam("templateId") String templateId) {
+ String formId = "";
+ try {
+ VisualdevEntity entity = templateService.getFormByTemplateId(templateId);
+ if (null == entity) {
+ throw new WorkFlowException(MsgCode.VS412.get());
+ }
+ formId = entity.getId();
+ } catch (WorkFlowException e) {
+ e.getStackTrace();
+ }
+ return formId;
+ }
+
+ @Override
+ @PostMapping("/getListByFlowIds")
+ public List<TemplateEntity> getListByFlowIds(@RequestBody List<String> flowId) {
+ return templateService.getListByIds(flowId);
+ }
+
+ @Override
+ @GetMapping("/treeListWithPower")
+ public List<TemplateTreeListVo> treeListWithPower() {
+ return templateService.treeListWithPower();
+ }
+
+ @Override
+ @GetMapping("/flowWork")
+ public FlowWorkListVO flowWork(@RequestParam("fromId") String fromId) {
+ return operatorService.flowWork(fromId);
+ }
+
+ @Override
+ @PostMapping("/flowWork")
+ public boolean flowWork(@RequestBody WorkHandoverModel workHandoverModel) {
+ return operatorService.flowWork(workHandoverModel);
+ }
+
+ @Override
+ @PostMapping("/getCommonList")
+ public List<TemplatePageVo> getCommonList(@RequestBody TemplatePagination pagination) {
+ return templateService.getCommonList(pagination);
+ }
+
+
+ @Override
+ @PostMapping("/getMenuUseNum")
+ public List<TemplateUseNumVo> getMenuUseNum(@RequestParam("i") Integer i, @RequestBody List<String> authFlowList) {
+ return templateUseNumService.getMenuUseNum(i, authFlowList);
+ }
+
+ @Override
+ @GetMapping("/getListByCreUser")
+ public List<TemplateEntity> getListByCreUser(@RequestParam("creUser") String creUser) {
+ return templateService.getListByCreUser(creUser);
+ }
+
+ @Override
+ @GetMapping("/getExportList")
+ public List<TemplateExportVo> getExportList(@RequestParam("systemId") String systemId){
+ return templateService.getExportList(systemId);
+ }
+
+ @Override
+ @PostMapping("/importCopy")
+ public boolean importCopy(@RequestBody List<TemplateExportVo> list, @RequestParam("systemId") String systemId){
+ try {
+ if (CollectionUtils.isNotEmpty(list)) {
+ for (TemplateExportVo item : list) {
+ TemplateExportModel model = JsonUtil.getJsonToBean(item, TemplateExportModel.class);
+ if (ObjectUtil.isNotEmpty(model.getTemplate())) {
+ TemplateEntity entity = model.getTemplate();
+ TemplateJsonExportModel versionModel = model.getFlowVersion();
+ Map<String, Map<String, Object>> flowNodes = new HashMap<>();
+ for (TemplateNodeEntity nodeEntity : model.getNodeList()) {
+ flowNodes.put(nodeEntity.getNodeCode(), JsonUtil.stringToMap(nodeEntity.getNodeJson()));
+ }
+ UserInfo userInfo = UserProvider.getUser();
+ entity.setId(RandomUtil.uuId());
+ entity.setEnCode(templateService.getEnCode(entity));
+ entity.setCreatorUserId(userInfo.getUserId());
+ entity.setCreatorTime(new Date());
+ entity.setFlowId(null);
+ entity.setVersion(null);
+ entity.setEnabledMark(0);
+ entity.setStatus(TemplateStatueEnum.NONE.getCode());
+ entity.setLastModifyUserId(null);
+ entity.setLastModifyTime(null);
+ entity.setSystemId(systemId);
+ templateService.save(entity);
+ TemplateNodeUpFrom from = new TemplateNodeUpFrom();
+ from.setId(entity.getId());
+ from.setFlowXml(versionModel.getFlowXml());
+ from.setFlowNodes(flowNodes);
+ flowUtil.create(from);
+ }
+ }
+ }
+ return true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ @Override
+ @GetMapping("/deleteBySystemId")
+ public void deleteBySystemId(@RequestParam("systemId") String systemId){
+ templateService.deleteBySystemId(systemId);
+ }
+}
--
Gitblit v1.8.0