¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.controller; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | 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.ModelBo; |
| | | import org.dromara.workflow.domain.vo.ModelVo; |
| | | import org.dromara.workflow.service.IActModelService; |
| | | import org.flowable.engine.RepositoryService; |
| | | import org.flowable.engine.repository.Model; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 模åç®¡ç æ§å¶å± |
| | | * |
| | | * @author may |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/workflow/model") |
| | | public class ActModelController extends BaseController { |
| | | |
| | | private final RepositoryService repositoryService; |
| | | |
| | | private final IActModelService actModelService; |
| | | |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ¨¡å |
| | | * |
| | | * @param modelBo 模ååæ° |
| | | */ |
| | | @GetMapping("/list") |
| | | public TableDataInfo<Model> page(ModelBo modelBo, PageQuery pageQuery) { |
| | | return actModelService.page(modelBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ¨¡å |
| | | * |
| | | * @param modelBo 模å请æ±å¯¹è±¡ |
| | | */ |
| | | @Log(title = "模å管ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/save") |
| | | public R<Void> saveNewModel(@Validated(AddGroup.class) @RequestBody ModelBo modelBo) { |
| | | return toAjax(actModelService.saveNewModel(modelBo)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¨¡å |
| | | * |
| | | * @param id 模åid |
| | | */ |
| | | @GetMapping("/getInfo/{id}") |
| | | public R<ModelVo> getInfo(@NotBlank(message = "模åidä¸è½ä¸ºç©º") @PathVariable String id) { |
| | | return R.ok(actModelService.getInfo(id)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¨¡åä¿¡æ¯ |
| | | * |
| | | * @param modelBo æ¨¡åæ°æ® |
| | | */ |
| | | @Log(title = "模å管ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping(value = "/update") |
| | | public R<Void> update(@RequestBody ModelBo modelBo) { |
| | | return toAjax(actModelService.update(modelBo)); |
| | | } |
| | | |
| | | /** |
| | | * ç¼è¾XMl模å |
| | | * |
| | | * @param modelBo æ¨¡åæ°æ® |
| | | */ |
| | | @Log(title = "模å管ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping(value = "/editModelXml") |
| | | public R<Void> editModel(@Validated(EditGroup.class) @RequestBody ModelBo modelBo) { |
| | | return toAjax(actModelService.editModelXml(modelBo)); |
| | | } |
| | | |
| | | /** |
| | | * å 餿µç¨æ¨¡å |
| | | * |
| | | * @param ids 模åid |
| | | */ |
| | | @Log(title = "模å管ç", businessType = BusinessType.DELETE) |
| | | @RepeatSubmit() |
| | | @DeleteMapping("/{ids}") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Void> delete(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") @PathVariable String[] ids) { |
| | | Arrays.stream(ids).parallel().forEachOrdered(repositoryService::deleteModel); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 模åé¨ç½² |
| | | * |
| | | * @param id 模åid |
| | | */ |
| | | @Log(title = "模å管ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/modelDeploy/{id}") |
| | | public R<Void> deploy(@NotBlank(message = "模åidä¸è½ä¸ºç©º") @PathVariable("id") String id) { |
| | | return toAjax(actModelService.modelDeploy(id)); |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åºæ¨¡åzipå缩å
|
| | | * |
| | | * @param modelIds 模åid |
| | | * @param response ç¸åº |
| | | */ |
| | | @GetMapping("/export/zip/{modelIds}") |
| | | public void exportZip(@NotEmpty(message = "模åidä¸è½ä¸ºç©º") @PathVariable List<String> modelIds, |
| | | HttpServletResponse response) { |
| | | actModelService.exportZip(modelIds, response); |
| | | } |
| | | |
| | | /** |
| | | * å¤å¶æ¨¡å |
| | | * |
| | | * @param modelBo æ¨¡åæ°æ® |
| | | */ |
| | | @PostMapping("/copyModel") |
| | | public R<Void> copyModel(@RequestBody ModelBo modelBo) { |
| | | return toAjax(actModelService.copyModel(modelBo)); |
| | | } |
| | | } |