|
|
|
|
@@ -2,7 +2,11 @@ package org.nl.wms.flow_manage.flow.controller.model;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaIgnore;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import org.nl.common.TableDataInfo;
|
|
|
|
|
import org.nl.common.domain.entity.PageQuery;
|
|
|
|
|
import org.nl.common.utils.FileUtil;
|
|
|
|
|
import org.nl.common.utils.SecurityUtils;
|
|
|
|
|
import org.nl.wms.flow_manage.flow.framework.engine.cmd.CommandExecutor;
|
|
|
|
|
import org.nl.wms.flow_manage.flow.framework.engine.cmd.unify.impl.StartInstanceCmd;
|
|
|
|
|
import org.nl.wms.flow_manage.flow.framework.entity.ExecutionEntity;
|
|
|
|
|
@@ -11,16 +15,15 @@ import org.nl.wms.flow_manage.flow.service.deployment.dao.ActReProcdef;
|
|
|
|
|
import org.nl.wms.flow_manage.flow.service.model.IActDeModelService;
|
|
|
|
|
import org.nl.wms.flow_manage.flow.service.model.dao.ActDeModel;
|
|
|
|
|
import org.nl.wms.flow_manage.flow.service.model.dto.ModelInfoVo;
|
|
|
|
|
import org.nl.wms.flow_manage.flow.service.model.dto.ModelQuery;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <p>
|
|
|
|
|
@@ -31,20 +34,48 @@ import java.io.FileInputStream;
|
|
|
|
|
* @since 2024-03-18
|
|
|
|
|
*/
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("api/flow/bpmnDesigner")
|
|
|
|
|
@RequestMapping("api/flow")
|
|
|
|
|
@SaIgnore
|
|
|
|
|
public class ActDeModelController {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
IActDeModelService modelService;
|
|
|
|
|
private IActDeModelService modelService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IActReProcdefService reProcdefService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private CommandExecutor commandExecutor;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
IActReProcdefService reProcdefService;
|
|
|
|
|
@Autowired
|
|
|
|
|
CommandExecutor commandExecutor;
|
|
|
|
|
@GetMapping
|
|
|
|
|
public ResponseEntity<Object> getAll(ModelQuery query, PageQuery page) {
|
|
|
|
|
return new ResponseEntity<>(TableDataInfo.build(modelService.page(page.build(), query.build())), HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping
|
|
|
|
|
public ResponseEntity<Object> add(@Validated @RequestBody ActDeModel dto) {
|
|
|
|
|
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
|
|
|
|
dto.setCreate_time(DateUtil.now());
|
|
|
|
|
modelService.save(dto);
|
|
|
|
|
return new ResponseEntity<>(HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PutMapping
|
|
|
|
|
public ResponseEntity<Object> update(@Validated @RequestBody ActDeModel dto) {
|
|
|
|
|
dto.setUpdated_id(SecurityUtils.getCurrentUserId());
|
|
|
|
|
dto.setUpdate_time(DateUtil.now());
|
|
|
|
|
modelService.updateById(dto);
|
|
|
|
|
return new ResponseEntity<>(HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@DeleteMapping
|
|
|
|
|
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
|
|
|
|
if (ids.length > 0) {
|
|
|
|
|
modelService.removeByIds(Arrays.asList(ids));
|
|
|
|
|
}
|
|
|
|
|
return new ResponseEntity<>(HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/select/{modelId}", produces = "application/json")
|
|
|
|
|
public ResponseEntity<ModelInfoVo> getBpmnByModelId(@PathVariable String modelId){
|
|
|
|
|
public ResponseEntity<ModelInfoVo> getBpmnByModelId(@PathVariable String modelId) {
|
|
|
|
|
ActDeModel byId = modelService.getById(modelId);
|
|
|
|
|
ModelInfoVo vo = new ModelInfoVo();
|
|
|
|
|
vo.setModelId(byId.getId());
|
|
|
|
|
@@ -59,12 +90,12 @@ public class ActDeModelController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/start/{deployment_id}", produces = "application/json")
|
|
|
|
|
public ResponseEntity<ModelInfoVo> startByModelId(@PathVariable String deployment_id){
|
|
|
|
|
public ResponseEntity<ModelInfoVo> startByModelId(@PathVariable String deployment_id) {
|
|
|
|
|
ActReProcdef deployment = reProcdefService.getById(deployment_id);
|
|
|
|
|
String model_editor_json = deployment.getModel_editor_json();
|
|
|
|
|
//TODO:转成bpmnModel对象:创建ExecutionEntity参数
|
|
|
|
|
ExecutionEntity entity = new ExecutionEntity();
|
|
|
|
|
commandExecutor.execute(new StartInstanceCmd(),new ExecutionEntity());
|
|
|
|
|
commandExecutor.execute(new StartInstanceCmd(), new ExecutionEntity());
|
|
|
|
|
return new ResponseEntity<>(HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|