¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.controller; |
| | | |
| | | 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.warm.flow.core.service.InsService; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.domain.bo.FlowCancelBo; |
| | | import org.dromara.workflow.domain.bo.FlowInstanceBo; |
| | | import org.dromara.workflow.domain.bo.FlowInvalidBo; |
| | | import org.dromara.workflow.domain.vo.FlowInstanceVo; |
| | | import org.dromara.workflow.service.IFlwInstanceService; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾ç®¡ç æ§å¶å± |
| | | * |
| | | * @author may |
| | | */ |
| | | @ConditionalOnEnable |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/workflow/instance") |
| | | public class FlwInstanceController extends BaseController { |
| | | |
| | | private final InsService insService; |
| | | private final IFlwInstanceService flwInstanceService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£å¨è¿è¡çæµç¨å®ä¾å表 |
| | | * |
| | | * @param flowInstanceBo æµç¨å®ä¾ |
| | | * @param pageQuery å页 |
| | | */ |
| | | @GetMapping("/pageByRunning") |
| | | public TableDataInfo<FlowInstanceVo> selectRunningInstanceList(FlowInstanceBo flowInstanceBo, PageQuery pageQuery) { |
| | | return flwInstanceService.selectRunningInstanceList(flowInstanceBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å·²ç»æçæµç¨å®ä¾å表 |
| | | * |
| | | * @param flowInstanceBo æµç¨å®ä¾ |
| | | * @param pageQuery å页 |
| | | */ |
| | | @GetMapping("/pageByFinish") |
| | | public TableDataInfo<FlowInstanceVo> selectFinishInstanceList(FlowInstanceBo flowInstanceBo, PageQuery pageQuery) { |
| | | return flwInstanceService.selectFinishInstanceList(flowInstanceBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ä¸å¡idæ¥è¯¢æµç¨å®ä¾è¯¦ç»ä¿¡æ¯ |
| | | * |
| | | * @param businessId ä¸å¡id |
| | | */ |
| | | @GetMapping("/getInfo/{businessId}") |
| | | public R<FlowInstanceVo> getInfo(@PathVariable Long businessId) { |
| | | return R.ok(flwInstanceService.queryByBusinessId(businessId)); |
| | | } |
| | | |
| | | /** |
| | | * æç
§ä¸å¡idå 餿µç¨å®ä¾ |
| | | * |
| | | * @param businessIds ä¸å¡id |
| | | */ |
| | | @DeleteMapping("/deleteByBusinessIds/{businessIds}") |
| | | public R<Void> deleteByBusinessIds(@PathVariable List<Long> businessIds) { |
| | | return toAjax(flwInstanceService.deleteByBusinessIds(businessIds)); |
| | | } |
| | | |
| | | /** |
| | | * æç
§å®ä¾idå 餿µç¨å®ä¾ |
| | | * |
| | | * @param instanceIds å®ä¾id |
| | | */ |
| | | @DeleteMapping("/deleteByInstanceIds/{instanceIds}") |
| | | public R<Void> deleteByInstanceIds(@PathVariable List<Long> instanceIds) { |
| | | return toAjax(flwInstanceService.deleteByInstanceIds(instanceIds)); |
| | | } |
| | | |
| | | /** |
| | | * æ¤éæµç¨ |
| | | * |
| | | * @param bo åæ° |
| | | */ |
| | | @RepeatSubmit() |
| | | @PutMapping("/cancelProcessApply") |
| | | public R<Void> cancelProcessApply(@RequestBody FlowCancelBo bo) { |
| | | return toAjax(flwInstanceService.cancelProcessApply(bo)); |
| | | } |
| | | |
| | | /** |
| | | * æ¿æ´»/æèµ·æµç¨å®ä¾ |
| | | * |
| | | * @param id æµç¨å®ä¾id |
| | | * @param active æ¿æ´»/æèµ· |
| | | */ |
| | | @RepeatSubmit() |
| | | @PutMapping("/active/{id}") |
| | | public R<Boolean> active(@PathVariable Long id, @RequestParam boolean active) { |
| | | return R.ok(active ? insService.active(id) : insService.unActive(id)); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åç»é人åèµ·çæµç¨å®ä¾ |
| | | * |
| | | * @param flowInstanceBo åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | @GetMapping("/pageByCurrent") |
| | | public TableDataInfo<FlowInstanceVo> selectCurrentInstanceList(FlowInstanceBo flowInstanceBo, PageQuery pageQuery) { |
| | | return flwInstanceService.selectCurrentInstanceList(flowInstanceBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * è·åæµç¨å¾ï¼æµç¨è®°å½ |
| | | * |
| | | * @param businessId ä¸å¡id |
| | | */ |
| | | @GetMapping("/flowImage/{businessId}") |
| | | public R<Map<String, Object>> flowImage(@PathVariable String businessId) { |
| | | return R.ok(flwInstanceService.flowImage(businessId)); |
| | | } |
| | | |
| | | /** |
| | | * è·åæµç¨åé |
| | | * |
| | | * @param instanceId æµç¨å®ä¾id |
| | | */ |
| | | @GetMapping("/instanceVariable/{instanceId}") |
| | | public R<Map<String, Object>> instanceVariable(@PathVariable Long instanceId) { |
| | | return R.ok(flwInstanceService.instanceVariable(instanceId)); |
| | | } |
| | | |
| | | /** |
| | | * ä½åºæµç¨ |
| | | * |
| | | * @param bo åæ° |
| | | */ |
| | | @Log(title = "æµç¨å®ä¾ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/invalid") |
| | | public R<Boolean> invalid(@Validated @RequestBody FlowInvalidBo bo) { |
| | | return R.ok(flwInstanceService.processInvalid(bo)); |
| | | } |
| | | |
| | | } |