| | |
| | | import org.dromara.warm.flow.core.entity.Definition; |
| | | import org.dromara.warm.flow.core.service.DefService; |
| | | import org.dromara.warm.flow.orm.entity.FlowDefinition; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.domain.vo.FlowDefinitionVo; |
| | | import org.dromara.workflow.service.IFlwDefinitionService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | * |
| | | * @author may |
| | | */ |
| | | @ConditionalOnEnable |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/workflow/definition") |
| | | public class FlwDefinitionController extends BaseController { |
| | | |
| | | private final IFlwDefinitionService flwDefinitionService; |
| | | private final DefService defService; |
| | | private final IFlwDefinitionService flwDefinitionService; |
| | | |
| | | /** |
| | | * 查询流程定义列表 |
| | |
| | | @Log(title = "流程定义", businessType = BusinessType.INSERT) |
| | | @PutMapping("/publish/{id}") |
| | | @RepeatSubmit() |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Boolean> publish(@PathVariable Long id) { |
| | | return R.ok(flwDefinitionService.publish(id)); |
| | | } |
| | |
| | | */ |
| | | @Log(title = "流程定义", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Void> remove(@PathVariable List<Long> ids) { |
| | | return toAjax(flwDefinitionService.removeDef(ids)); |
| | | } |
| | |
| | | */ |
| | | @Log(title = "流程定义", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importDef") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Boolean> importDef(MultipartFile file, String category) { |
| | | return R.ok(flwDefinitionService.importXml(file, category)); |
| | | return R.ok(flwDefinitionService.importJson(file, category)); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取流程定义xml字符串 |
| | | * 获取流程定义JSON字符串 |
| | | * |
| | | * @param id 流程定义id |
| | | */ |
| | | @GetMapping("/xmlString/{id}") |
| | | public R<String> xmlString(@PathVariable Long id) { |
| | | return R.ok("操作成功", defService.xmlString(id)); |
| | | return R.ok("操作成功", defService.exportJson(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RepeatSubmit() |
| | | @PutMapping("/active/{id}") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Boolean> active(@PathVariable Long id, @RequestParam boolean active) { |
| | | return R.ok(active ? defService.active(id) : defService.unActive(id)); |
| | | } |