AprilWind
2025-01-15 4ba4ea4fcc559a746daf44f276867e97e580019e
ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/controller/FlwDefinitionController.java
@@ -12,6 +12,7 @@
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;
@@ -27,14 +28,15 @@
 *
 * @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;
    /**
     * 查询流程定义列表
@@ -102,7 +104,6 @@
    @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));
    }
@@ -125,7 +126,6 @@
     */
    @Log(title = "流程定义", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @Transactional(rollbackFor = Exception.class)
    public R<Void> remove(@PathVariable List<Long> ids) {
        return toAjax(flwDefinitionService.removeDef(ids));
    }
@@ -151,9 +151,8 @@
     */
    @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));
    }
    /**
@@ -170,13 +169,13 @@
    }
    /**
     * 获取流程定义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));
    }
    /**
@@ -187,6 +186,7 @@
     */
    @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));
    }