Merge branch 'main' of https://dd3skj.picp.vip/zhaoxinyu/v4
This commit is contained in:
@@ -1,15 +1,28 @@
|
||||
package com.budwk.app.flow.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.flow.entity.ProcessCategory;
|
||||
import com.budwk.app.flow.entity.ProcessDefine;
|
||||
import com.budwk.app.flow.service.ProcessDefineService;
|
||||
import com.budwk.app.zhgh.club.model.SysClubRule;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -21,12 +34,59 @@ public class FlowCategoryController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private ProcessDefineService defineService;
|
||||
|
||||
@At
|
||||
@At("")
|
||||
@Ok("beetl:/platform/flow/category/index.html")
|
||||
@SaCheckLogin
|
||||
public void index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("flow.category")
|
||||
public Result pageData(PageForm pageForm, String name) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
*,
|
||||
(select count(1) from wf_process_design where category = pc.id) as categoryCount
|
||||
from
|
||||
wf_process_category pc
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX(ProcessCategory::getName, "=", name);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = defineService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("flow.category")
|
||||
@SLog(tag = "流程管理-流程分类", msg = "新增/编辑流程分类")
|
||||
public Result submit(ProcessCategory category) {
|
||||
dao.insertOrUpdate(category);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("flow.category")
|
||||
@SLog(tag = "流程管理-流程分类", msg = "删除流程分类")
|
||||
public Result delete(String id) {
|
||||
int count = dao.count(ProcessDefine.class, Cnd.where(ProcessDefine::getCategory, "=", id));
|
||||
if(count > 0) {
|
||||
return Result.error("此分类已关联%s个流程,无法删除".formatted(count));
|
||||
}
|
||||
dao.delete(ProcessCategory.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result list() {
|
||||
List<ProcessCategory> list = dao.query(ProcessCategory.class, Cnd.NEW());
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.budwk.app.flow.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.flow.entity.ProcessDefine;
|
||||
import com.budwk.app.flow.entity.ProcessDesign;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.service.ProcessDefineService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -13,14 +16,18 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/flow/define")
|
||||
@@ -35,7 +42,7 @@ public class FlowDefineController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/flow/define/index.html")
|
||||
@SaCheckLogin
|
||||
@SaCheckPermission("flow.define")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@@ -56,11 +63,10 @@ public class FlowDefineController {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("删除流程定义")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("flow.define")
|
||||
public Result delete(@Param("id") Long id) {
|
||||
int count = dao.count(ProcessInstance.class, Cnd.where(ProcessInstance::getProcessDefineId, "=", id));
|
||||
if (count > 0) {
|
||||
@@ -79,17 +85,44 @@ public class FlowDefineController {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("获取流程定义分页列表")
|
||||
public Result pageData(Integer pageNumber, Integer pageSize, String type, String name, String displayName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Pagination pagination = processDefineService.listPage(pageNumber, pageSize, cnd);
|
||||
return Result.success(pagination);
|
||||
@SaCheckPermission("flow.define")
|
||||
public Result pageData(PageForm pageForm, String displayName, String name, String category) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
*,
|
||||
ROW_NUMBER() OVER (ORDER BY name ) AS rowNum
|
||||
FROM
|
||||
( SELECT *, ROW_NUMBER() OVER ( PARTITION BY NAME ORDER BY version DESC ) AS rn FROM wf_process_define ) t
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.and("rn", "=", 1);
|
||||
cnd.and(Cnd.likeEX(ProcessDesign::getDisplayName, displayName));
|
||||
cnd.and(Cnd.likeEX(ProcessDesign::getName, name));
|
||||
cnd.andEX(ProcessDesign::getCategory, "=", category);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = processDefineService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
|
||||
List<NutMap> list = pagination.getList(NutMap.class);
|
||||
for (NutMap nutMap : list) {
|
||||
List<ProcessDefine> defineList = dao.query(
|
||||
ProcessDefine.class,
|
||||
Cnd.where(ProcessDefine::getName, "=", nutMap.getString("name"))
|
||||
.and("id", "!=", nutMap.getString("id"))
|
||||
.desc(ProcessDefine::getVersion)
|
||||
);
|
||||
nutMap.put("children", defineList);
|
||||
}
|
||||
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("启用流程定义")
|
||||
@SaCheckPermission("flow.define")
|
||||
public Result enable(@Param("id") Long id) {
|
||||
ProcessDefine define = new ProcessDefine();
|
||||
define.setId(id);
|
||||
@@ -99,8 +132,8 @@ public class FlowDefineController {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("禁用流程定义")
|
||||
@SaCheckPermission("flow.define")
|
||||
public Result disable(@Param("id") Long id) {
|
||||
ProcessDefine define = new ProcessDefine();
|
||||
define.setId(id);
|
||||
@@ -108,6 +141,4 @@ public class FlowDefineController {
|
||||
dao.updateIgnoreNull(define);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.budwk.app.flow.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.lang.ClassScanner;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.flow.engine.AssignmentHandler;
|
||||
import com.budwk.app.flow.engine.CandidateHandler;
|
||||
@@ -89,10 +91,9 @@ public class FlowDesignController {
|
||||
CANDIDATE_HANDLER_LIST = Collections.unmodifiableList(list);
|
||||
}
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/flow/design/index.html")
|
||||
@SaCheckLogin
|
||||
@SaCheckPermission("flow.design")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@@ -104,17 +105,23 @@ public class FlowDesignController {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("获取流程设计分页列表")
|
||||
public Result pageData(Integer pageNumber, Integer pageSize, String name, String key, String category) {
|
||||
@SaCheckPermission("flow.design")
|
||||
public Result pageData(PageForm pageForm, String displayName, String name, String category, Boolean deployed) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Pagination pagination = processDesignService.listPage(pageNumber, pageSize, cnd);
|
||||
|
||||
cnd.and(Cnd.likeEX(ProcessDesign::getDisplayName, displayName));
|
||||
cnd.and(Cnd.likeEX(ProcessDesign::getName, name));
|
||||
cnd.andEX(ProcessDesign::getCategory, "=", category);
|
||||
cnd.andEX(ProcessDesign::getIsDeployed, "=", deployed);
|
||||
|
||||
Pagination pagination = processDesignService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("保存流程设计")
|
||||
@SaCheckPermission("flow.design")
|
||||
public Result insert(@Param("design") ProcessDesign processDesign) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.set("name", processDesign.getName());
|
||||
@@ -132,8 +139,8 @@ public class FlowDesignController {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("修改流程设计")
|
||||
@SaCheckPermission("flow.design")
|
||||
public Result update(@Param("design") ProcessDesign processDesign) {
|
||||
JSONObject jsonObject = processDesign.getContent();
|
||||
jsonObject.set("name", processDesign.getName());
|
||||
@@ -151,8 +158,8 @@ public class FlowDesignController {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("修改流程设计")
|
||||
@SaCheckPermission("flow.design")
|
||||
public Result updateContent(@Param("design") ProcessDesign processDesign) {
|
||||
JSONObject jsonObject = processDesign.getContent();
|
||||
jsonObject.set("name", processDesign.getName());
|
||||
@@ -170,8 +177,8 @@ public class FlowDesignController {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("删除流程设计")
|
||||
@SaCheckPermission("flow.design")
|
||||
public Result delete(@Param("id") Long id) {
|
||||
dao.delete(ProcessDesign.class, id);
|
||||
return Result.success();
|
||||
@@ -186,9 +193,9 @@ public class FlowDesignController {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("发布流程设计")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("flow.design")
|
||||
public Result deploy(@Param("id") Long id) {
|
||||
processDesignService.deploy(id);
|
||||
return Result.success();
|
||||
@@ -230,5 +237,4 @@ public class FlowDesignController {
|
||||
List<NutMap> list = sysUserService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user