|
@@ -1,19 +1,21 @@
|
|
package com.qmth.distributed.print.api;
|
|
package com.qmth.distributed.print.api;
|
|
|
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.qmth.boot.api.annotation.Aac;
|
|
import com.qmth.boot.api.annotation.Aac;
|
|
import com.qmth.boot.api.annotation.BOOL;
|
|
import com.qmth.boot.api.annotation.BOOL;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
import com.qmth.distributed.print.business.bean.flow.CustomFlowSaveDto;
|
|
import com.qmth.distributed.print.business.bean.flow.CustomFlowSaveDto;
|
|
-import com.qmth.distributed.print.business.bean.params.FlowApproveParam;
|
|
|
|
-import com.qmth.distributed.print.business.bean.params.FlowParam;
|
|
|
|
import com.qmth.distributed.print.business.bean.params.FlowTaskApproveParam;
|
|
import com.qmth.distributed.print.business.bean.params.FlowTaskApproveParam;
|
|
|
|
+import com.qmth.distributed.print.business.bean.params.customFlowParam;
|
|
import com.qmth.distributed.print.business.bean.result.FlowTaskApprovePeopleAllResult;
|
|
import com.qmth.distributed.print.business.bean.result.FlowTaskApprovePeopleAllResult;
|
|
import com.qmth.distributed.print.business.bean.result.FlowTaskResult;
|
|
import com.qmth.distributed.print.business.bean.result.FlowTaskResult;
|
|
import com.qmth.distributed.print.business.entity.TFCustomFlow;
|
|
import com.qmth.distributed.print.business.entity.TFCustomFlow;
|
|
|
|
+import com.qmth.distributed.print.business.entity.TFFlowApprove;
|
|
import com.qmth.distributed.print.business.service.ActivitiService;
|
|
import com.qmth.distributed.print.business.service.ActivitiService;
|
|
import com.qmth.distributed.print.business.service.TFCustomFlowService;
|
|
import com.qmth.distributed.print.business.service.TFCustomFlowService;
|
|
|
|
+import com.qmth.distributed.print.business.service.TFFlowApproveService;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.entity.BasicSchool;
|
|
import com.qmth.teachcloud.common.entity.BasicSchool;
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
@@ -37,6 +39,7 @@ import java.security.NoSuchAlgorithmException;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
|
|
+import java.util.Optional;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -67,6 +70,9 @@ public class TFCustomFlowController {
|
|
@Resource
|
|
@Resource
|
|
CommonCacheService commonCacheService;
|
|
CommonCacheService commonCacheService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ TFFlowApproveService tfFlowApproveService;
|
|
|
|
+
|
|
@ApiOperation(value = "保存和发布流程")
|
|
@ApiOperation(value = "保存和发布流程")
|
|
@ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
|
|
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
@@ -86,7 +92,13 @@ public class TFCustomFlowController {
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
TFCustomFlow dbTfCustomFlow = tfCustomFlowService.findMaxVersion(customFlowSaveDto.getSchoolId(), customFlowSaveDto.getOrgId(), customFlowSaveDto.getType());
|
|
TFCustomFlow dbTfCustomFlow = tfCustomFlowService.findMaxVersion(customFlowSaveDto.getSchoolId(), customFlowSaveDto.getOrgId(), customFlowSaveDto.getType());
|
|
- TFCustomFlow tfCustomFlow = new TFCustomFlow(customFlowSaveDto.getSchoolId(), customFlowSaveDto.getOrgId(), customFlowSaveDto.getName(), customFlowSaveDto.getType(), customFlowSaveDto.getPublish(), JacksonUtil.parseJson(customFlowSaveDto.getCustomFlowLists()), sysUser.getId(), flowBpmnId);
|
|
|
|
|
|
+ TFCustomFlow tfCustomFlow = null;
|
|
|
|
+ if (Objects.isNull(customFlowSaveDto.getCustomFlowId())) {
|
|
|
|
+ tfCustomFlow = new TFCustomFlow(customFlowSaveDto.getSchoolId(), customFlowSaveDto.getOrgId(), customFlowSaveDto.getName(), customFlowSaveDto.getType(), customFlowSaveDto.getPublish(), JacksonUtil.parseJson(customFlowSaveDto.getCustomFlowLists()), sysUser.getId(), flowBpmnId);
|
|
|
|
+ } else {
|
|
|
|
+ tfCustomFlow = tfCustomFlowService.getById(customFlowSaveDto.getCustomFlowId());
|
|
|
|
+ tfCustomFlow.updateInfo(sysUser.getId());
|
|
|
|
+ }
|
|
AtomicInteger atomicInteger = null;
|
|
AtomicInteger atomicInteger = null;
|
|
if (Objects.isNull(dbTfCustomFlow)) {//新增
|
|
if (Objects.isNull(dbTfCustomFlow)) {//新增
|
|
atomicInteger = new AtomicInteger(1);
|
|
atomicInteger = new AtomicInteger(1);
|
|
@@ -98,7 +110,7 @@ public class TFCustomFlowController {
|
|
//自定义流程处理开始
|
|
//自定义流程处理开始
|
|
Map<String, Object> map = activitiService.dynamicBuildBpmn(customFlowSaveDto, flowBpmnId, tfCustomFlow.getVersion());
|
|
Map<String, Object> map = activitiService.dynamicBuildBpmn(customFlowSaveDto, flowBpmnId, tfCustomFlow.getVersion());
|
|
tfCustomFlow.setFlowProcessVar(JacksonUtil.parseJson(map));
|
|
tfCustomFlow.setFlowProcessVar(JacksonUtil.parseJson(map));
|
|
- tfCustomFlowService.save(tfCustomFlow);
|
|
|
|
|
|
+ tfCustomFlowService.saveOrUpdate(tfCustomFlow);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error(SystemConstant.LOG_ERROR, e);
|
|
log.error(SystemConstant.LOG_ERROR, e);
|
|
if (e instanceof ApiException) {
|
|
if (e instanceof ApiException) {
|
|
@@ -192,27 +204,44 @@ public class TFCustomFlowController {
|
|
public Result list(@ApiParam(value = "流程名称", required = false) @RequestParam(required = false) String name,
|
|
public Result list(@ApiParam(value = "流程名称", required = false) @RequestParam(required = false) String name,
|
|
@ApiParam(value = "页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
|
|
@ApiParam(value = "页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
|
|
@ApiParam(value = "数量", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
|
|
@ApiParam(value = "数量", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
|
|
- return ResultUtil.ok(true);
|
|
|
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
|
+ return ResultUtil.ok(tfCustomFlowService.list(new Page<>(pageNumber, pageSize), name, SystemConstant.getHeadOrUserSchoolId(), sysUser.getOrgId()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "流程编辑")
|
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "流程信息", response = ResultUtil.class)})
|
|
|
|
+ @RequestMapping(value = "/edit", method = RequestMethod.POST)
|
|
|
|
+ public Result edit(@ApiParam(value = "自定义流程id", required = true) @RequestParam String id) {
|
|
|
|
+ TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(SystemConstant.convertIdToLong(id));
|
|
|
|
+ Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("自定义流程数据为空"));
|
|
|
|
+ Optional.ofNullable(tfCustomFlow.getObjectData()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("自定义流程绘图数据为空"));
|
|
|
|
+ return ResultUtil.ok(tfCustomFlow.getObjectData());
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "流程逻辑删除")
|
|
@ApiOperation(value = "流程逻辑删除")
|
|
@ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
|
|
@RequestMapping(value = "/enable", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/enable", method = RequestMethod.POST)
|
|
- public Result enable(@Valid @RequestBody FlowParam flowParam, BindingResult bindingResult) {
|
|
|
|
|
|
+ public Result enable(@Valid @RequestBody customFlowParam customFlowParam, BindingResult bindingResult) {
|
|
if (bindingResult.hasErrors()) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
}
|
|
}
|
|
- return ResultUtil.ok(activitiService.flowDelete(flowParam.getId()));
|
|
|
|
|
|
+ TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(customFlowParam.getId());
|
|
|
|
+ Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("自定义流程数据为空"));
|
|
|
|
+ tfCustomFlow.setEnable(customFlowParam.getEnable());
|
|
|
|
+ return ResultUtil.ok(tfCustomFlowService.updateById(tfCustomFlow));
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "流程审批记录逻辑删除")
|
|
@ApiOperation(value = "流程审批记录逻辑删除")
|
|
@ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
|
|
@RequestMapping(value = "/approve/enable", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/approve/enable", method = RequestMethod.POST)
|
|
- public Result enable(@Valid @RequestBody FlowApproveParam flowApproveParam, BindingResult bindingResult) {
|
|
|
|
|
|
+ public Result approveEnable(@Valid @RequestBody customFlowParam customFlowParam, BindingResult bindingResult) {
|
|
if (bindingResult.hasErrors()) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
}
|
|
}
|
|
- return ResultUtil.ok(true);
|
|
|
|
|
|
+ TFFlowApprove tfFlowApprove = tfFlowApproveService.getById(customFlowParam.getId());
|
|
|
|
+ Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("流程审批记录数据为空"));
|
|
|
|
+ tfFlowApprove.setEnable(customFlowParam.getEnable());
|
|
|
|
+ return ResultUtil.ok(tfFlowApproveService.updateById(tfFlowApprove));
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "流程终止")
|
|
@ApiOperation(value = "流程终止")
|