|
@@ -11,6 +11,7 @@ import javax.validation.Valid;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springblade.business.entity.FixedFlowLink;
|
|
|
+import org.springblade.business.entity.Task;
|
|
|
import org.springblade.business.service.IFixedFlowLinkService;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
@@ -25,6 +26,8 @@ import org.springblade.system.user.entity.User;
|
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springblade.system.vo.RoleVO;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -59,6 +62,8 @@ public class FixedFlowController extends BladeController {
|
|
|
|
|
|
private final IUserClient userClient;
|
|
|
|
|
|
+ private final JdbcTemplate jdbcTemplate;
|
|
|
+
|
|
|
/**
|
|
|
* 获取系统所有角色划分
|
|
|
*/
|
|
@@ -206,6 +211,14 @@ public class FixedFlowController extends BladeController {
|
|
|
@ApiOperationSupport(order = 4)
|
|
|
@ApiOperation(value = "修改", notes = "传入fixedFlow对象")
|
|
|
public R<Boolean> update(@Valid @RequestBody FixedFlowVO vo) {
|
|
|
+ //校验是否被使用过
|
|
|
+ List<Task> tasks = jdbcTemplate
|
|
|
+ .query("SELECT * FROM u_task WHERE contract_id = ? and is_deleted = 0 AND fixed_flow_id = ? ",
|
|
|
+ new Object[]{vo.getContractId(),vo.getId()}, new BeanPropertyRowMapper<>(Task.class));
|
|
|
+ if (tasks.size() > 0){
|
|
|
+ return R.fail("当前流程已经使用,不能修改");
|
|
|
+ }
|
|
|
+
|
|
|
//获取环节处理人顺序
|
|
|
String linkUserJoinString = vo.getLinkUserJoinString();
|
|
|
if (StringUtils.isNotEmpty(linkUserJoinString)) {
|
|
@@ -241,6 +254,18 @@ public class FixedFlowController extends BladeController {
|
|
|
@ApiOperationSupport(order = 5)
|
|
|
@ApiOperation(value = "逻辑删除", notes = "传入ids")
|
|
|
public R<Boolean> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
|
|
+ if (StringUtils.isNotBlank(ids)){
|
|
|
+ List<Long> list = Func.toLongList(ids);
|
|
|
+ //前端只能单条删除,不会有大量数据,先就这么写
|
|
|
+ for (Long aLong : list) {
|
|
|
+ List<Task> tasks = jdbcTemplate
|
|
|
+ .query("SELECT * FROM u_task WHERE is_deleted = 0 AND fixed_flow_id = ? ",
|
|
|
+ new Object[]{aLong}, new BeanPropertyRowMapper<>(Task.class));
|
|
|
+ if (tasks.size() > 0){
|
|
|
+ return R.fail("当前流程已经使用,不能删除");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if (this.fixedFlowService.deleteLogic(Func.toLongList(ids))) {
|
|
|
//同步删除环节
|
|
|
this.fixedFlowLinkService.deletedByFixedFlowId(ids);
|