¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.controller; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.workflow.domain.bo.ProcessDefinitionBo; |
| | | import org.dromara.workflow.domain.vo.ProcessDefinitionVo; |
| | | import org.dromara.workflow.service.IActProcessDefinitionService; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ç®¡ç æ§å¶å± |
| | | * |
| | | * @author may |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/workflow/processDefinition") |
| | | public class ActProcessDefinitionController extends BaseController { |
| | | |
| | | private final IActProcessDefinitionService actProcessDefinitionService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param bo åæ° |
| | | */ |
| | | @GetMapping("/list") |
| | | public TableDataInfo<ProcessDefinitionVo> page(ProcessDefinitionBo bo, PageQuery pageQuery) { |
| | | return actProcessDefinitionService.page(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å岿µç¨å®ä¹å表 |
| | | * |
| | | * @param key æµç¨å®ä¹key |
| | | */ |
| | | @GetMapping("/getListByKey/{key}") |
| | | public R<List<ProcessDefinitionVo>> getListByKey(@NotEmpty(message = "æµç¨å®ä¹keyä¸è½ä¸ºç©º") @PathVariable String key) { |
| | | return R.ok("æä½æå", actProcessDefinitionService.getListByKey(key)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥çæµç¨å®ä¹å¾ç |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | @GetMapping("/definitionImage/{processDefinitionId}") |
| | | public R<String> definitionImage(@PathVariable String processDefinitionId) { |
| | | return R.ok("æä½æå", actProcessDefinitionService.definitionImage(processDefinitionId)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥çæµç¨å®ä¹xmlæä»¶ |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | @GetMapping("/definitionXml/{processDefinitionId}") |
| | | public R<Map<String, Object>> definitionXml(@NotBlank(message = "æµç¨å®ä¹idä¸è½ä¸ºç©º") @PathVariable String processDefinitionId) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | String xmlStr = actProcessDefinitionService.definitionXml(processDefinitionId); |
| | | map.put("xml", Arrays.asList(xmlStr.split("\n"))); |
| | | map.put("xmlStr", xmlStr); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * å 餿µç¨å®ä¹ |
| | | * |
| | | * @param deploymentIds é¨ç½²id |
| | | * @param processDefinitionIds æµç¨å®ä¹id |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{deploymentIds}/{processDefinitionIds}") |
| | | public R<Void> deleteDeployment(@NotNull(message = "æµç¨é¨ç½²idä¸è½ä¸ºç©º") @PathVariable List<String> deploymentIds, |
| | | @NotNull(message = "æµç¨å®ä¹idä¸è½ä¸ºç©º") @PathVariable List<String> processDefinitionIds) { |
| | | return toAjax(actProcessDefinitionService.deleteDeployment(deploymentIds, processDefinitionIds)); |
| | | } |
| | | |
| | | /** |
| | | * æ¿æ´»æè
æèµ·æµç¨å®ä¹ |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping("/updateDefinitionState/{processDefinitionId}") |
| | | public R<Void> updateDefinitionState(@NotBlank(message = "æµç¨å®ä¹idä¸è½ä¸ºç©º") @PathVariable String processDefinitionId) { |
| | | return toAjax(actProcessDefinitionService.updateDefinitionState(processDefinitionId)); |
| | | } |
| | | |
| | | /** |
| | | * è¿ç§»æµç¨å®ä¹ |
| | | * |
| | | * @param currentProcessDefinitionId å½åæµç¨å®ä¹id |
| | | * @param fromProcessDefinitionId éè¦è¿ç§»å°çæµç¨å®ä¹id |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping("/migrationDefinition/{currentProcessDefinitionId}/{fromProcessDefinitionId}") |
| | | public R<Void> migrationDefinition(@NotBlank(message = "å½åæµç¨å®ä¹id") @PathVariable String currentProcessDefinitionId, |
| | | @NotBlank(message = "éè¦è¿ç§»å°çæµç¨å®ä¹id") @PathVariable String fromProcessDefinitionId) { |
| | | return toAjax(actProcessDefinitionService.migrationDefinition(currentProcessDefinitionId, fromProcessDefinitionId)); |
| | | } |
| | | |
| | | /** |
| | | * æµç¨å®ä¹è½¬æ¢ä¸ºæ¨¡å |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping("/convertToModel/{processDefinitionId}") |
| | | public R<Void> convertToModel(@NotEmpty(message = "æµç¨å®ä¹idä¸è½ä¸ºç©º") @PathVariable String processDefinitionId) { |
| | | return toAjax(actProcessDefinitionService.convertToModel(processDefinitionId)); |
| | | } |
| | | |
| | | /** |
| | | * éè¿zipæxmlé¨ç½²æµç¨å®ä¹ |
| | | * |
| | | * @param file æä»¶ |
| | | * @param categoryCode åç±» |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹ç®¡ç", businessType = BusinessType.INSERT) |
| | | @PostMapping("/deployByFile") |
| | | public void deployByFile(@RequestParam("file") MultipartFile file, @RequestParam("categoryCode") String categoryCode) { |
| | | actProcessDefinitionService.deployByFile(file, categoryCode); |
| | | } |
| | | |
| | | } |