Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -56,101 +56,101 @@ import java.util.stream.Collectors;
|
||||
@At("/platform/sys/union")
|
||||
public class SysUnionController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private SysUnitService sysUnitService;
|
||||
@Inject
|
||||
private SysUnionService sysUnionService;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private SysUnitService sysUnitService;
|
||||
@Inject
|
||||
private SysUnionService sysUnionService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/union/index.html")
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public void index() {
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/union/index.html")
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.add")
|
||||
@ApiOperation("新增分工会")
|
||||
public Result insert(Sys_union union) {
|
||||
try {
|
||||
dao.insert(union);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.add")
|
||||
@ApiOperation("新增分工会")
|
||||
public Result insert(Sys_union union) {
|
||||
try {
|
||||
dao.insert(union);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.edit")
|
||||
@ApiOperation("编辑分工会")
|
||||
public Result update(Sys_union union) {
|
||||
try {
|
||||
dao.updateIgnoreNull(union);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.edit")
|
||||
@ApiOperation("编辑分工会")
|
||||
public Result update(Sys_union union) {
|
||||
try {
|
||||
dao.updateIgnoreNull(union);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result findOne(String id) {
|
||||
Sys_union union = dao.fetch(Sys_union.class, id);
|
||||
return Result.success(union);
|
||||
}
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result findOne(String id) {
|
||||
Sys_union union = dao.fetch(Sys_union.class, id);
|
||||
return Result.success(union);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除分工会")
|
||||
@SaCheckPermission("sys.manager.union.delete")
|
||||
public Result doDelete(String id) {
|
||||
dao.delete(Sys_union.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
@At
|
||||
@ApiOperation("删除分工会")
|
||||
@SaCheckPermission("sys.manager.union.delete")
|
||||
public Result doDelete(String id) {
|
||||
dao.delete(Sys_union.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result tree() {
|
||||
List<Tree<String>> treeList = null;
|
||||
try {
|
||||
boolean schoolUnionAdmin = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name());
|
||||
List<TreeNode<String>> nodeList = CollUtil.newArrayList();
|
||||
nodeList.add(new TreeNode<>("工会委员会", "0", "工会委员会", 1000));
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result tree() {
|
||||
List<Tree<String>> treeList = null;
|
||||
try {
|
||||
boolean schoolUnionAdmin = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name());
|
||||
List<TreeNode<String>> nodeList = CollUtil.newArrayList();
|
||||
nodeList.add(new TreeNode<>("工会委员会", "0", "工会委员会", 1000));
|
||||
|
||||
List<Sys_union> list = new ArrayList<>();
|
||||
List<Sys_union> list = new ArrayList<>();
|
||||
|
||||
if (schoolUnionAdmin) {
|
||||
list = dao.query(Sys_union.class, Cnd.NEW().asc("unionCode"));
|
||||
} else {
|
||||
list = dao.query(Sys_union.class, Cnd.NEW().and("id", "=", SecurityUtil.getUnionId()));
|
||||
}
|
||||
if (schoolUnionAdmin) {
|
||||
list = dao.query(Sys_union.class, Cnd.NEW().asc("unionCode"));
|
||||
} else {
|
||||
list = dao.query(Sys_union.class, Cnd.NEW().and("id", "=", SecurityUtil.getUnionId()));
|
||||
}
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
nodeList.add(new TreeNode<>(list.get(i).getId(), "工会委员会", list.get(i).getName(), i));
|
||||
}
|
||||
treeList = TreeUtil.build(nodeList, "0");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
nodeList.add(new TreeNode<>(list.get(i).getId(), "工会委员会", list.get(i).getName(), i));
|
||||
}
|
||||
treeList = TreeUtil.build(nodeList, "0");
|
||||
|
||||
return Result.success().addData(treeList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
return Result.success().addData(treeList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result pageData(@Valid PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result pageData(@Valid PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.*,
|
||||
GROUP_CONCAT( u.username,'(',u.loginname,')' ) AS chairman
|
||||
@@ -161,32 +161,32 @@ public class SysUnionController {
|
||||
LEFT JOIN sys_user u ON u.id = sur.userId
|
||||
$condition
|
||||
""");
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX("gh.name", pageForm.getSearchKeyword()));
|
||||
}
|
||||
cnd.asc("gh.unionCode");
|
||||
cnd.groupBy("gh.id");
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX("gh.name", pageForm.getSearchKeyword()));
|
||||
}
|
||||
cnd.asc("gh.unionCode");
|
||||
cnd.groupBy("gh.id");
|
||||
|
||||
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
cnd.and("gh.id", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
cnd.and("gh.id", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = sysUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = sysUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result schoolUnionUserPageData(PageForm pageForm) {
|
||||
List<Sys_dict> schoolRoles = sysDictService.getSubListByCode("SCHOOL_UNION_ROLES");
|
||||
List<String> schoolRoleCodes = schoolRoles.stream().map(Sys_dict::getCode).toList();
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result schoolUnionUserPageData(PageForm pageForm) {
|
||||
List<Sys_dict> schoolRoles = sysDictService.getSubListByCode("SCHOOL_UNION_ROLES");
|
||||
List<String> schoolRoleCodes = schoolRoles.stream().map(Sys_dict::getCode).toList();
|
||||
|
||||
if (Lang.isEmpty(schoolRoles)) {
|
||||
return Result.success();
|
||||
}
|
||||
if (Lang.isEmpty(schoolRoles)) {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.userId,
|
||||
t2.username,
|
||||
@@ -200,71 +200,71 @@ public class SysUnionController {
|
||||
LEFT JOIN sys_dict t4 ON t4.code = t3.code
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.where("t3.`code`", "in", schoolRoleCodes);
|
||||
if (StrUtil.isAllNotBlank(pageForm.getSearchName(), pageForm.getSearchKeyword())) {
|
||||
switch (pageForm.getSearchName()) {
|
||||
case "loginname" -> cnd.where().andLike("t2.loginname", pageForm.getSearchKeyword());
|
||||
case "username" -> cnd.where().andLike("t2.username", pageForm.getSearchKeyword());
|
||||
case "roleName" -> cnd.where().andLike("t3.`name`", pageForm.getSearchKeyword());
|
||||
}
|
||||
}
|
||||
cnd.asc("t4.location");
|
||||
cnd.asc("t2.username");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = sysUserService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
Cnd cnd = Cnd.where("t3.`code`", "in", schoolRoleCodes);
|
||||
if (StrUtil.isAllNotBlank(pageForm.getSearchName(), pageForm.getSearchKeyword())) {
|
||||
switch (pageForm.getSearchName()) {
|
||||
case "loginname" -> cnd.where().andLike("t2.loginname", pageForm.getSearchKeyword());
|
||||
case "username" -> cnd.where().andLike("t2.username", pageForm.getSearchKeyword());
|
||||
case "roleName" -> cnd.where().andLike("t3.`name`", pageForm.getSearchKeyword());
|
||||
}
|
||||
}
|
||||
cnd.asc("t4.location");
|
||||
cnd.asc("t2.username");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = sysUserService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.schoolOfficer")
|
||||
@ApiModelProperty("添加校工会人员角色")
|
||||
public Result insertSchoolUnionUserRole(String userId, String roleCode) {
|
||||
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
if (Lang.isEmpty(role)) {
|
||||
return Result.error("无法找到" + roleCode + "对应编码的角色");
|
||||
}
|
||||
int count = dao.count(Sys_user_role.class, Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId));
|
||||
if (count > 0) {
|
||||
return Result.error("请勿重复添加");
|
||||
}
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.schoolOfficer")
|
||||
@ApiModelProperty("添加校工会人员角色")
|
||||
public Result insertSchoolUnionUserRole(String userId, String roleCode) {
|
||||
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
if (Lang.isEmpty(role)) {
|
||||
return Result.error("无法找到" + roleCode + "对应编码的角色");
|
||||
}
|
||||
int count = dao.count(Sys_user_role.class, Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId));
|
||||
if (count > 0) {
|
||||
return Result.error("请勿重复添加");
|
||||
}
|
||||
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId));
|
||||
sysRoleService.insert("sys_user_role", Chain.make("roleId", role.getId()).add("userId", userId));
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
return Result.success();
|
||||
}
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId));
|
||||
sysRoleService.insert("sys_user_role", Chain.make("roleId", role.getId()).add("userId", userId));
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.schoolOfficer")
|
||||
@ApiOperation("删除校工会人员角色")
|
||||
public Result deleteSchoolUnionUserRole(String userId, String roleCode) {
|
||||
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
if (Lang.isEmpty(role)) {
|
||||
throw new BaseException("无法找到{}对应编码的角色", roleCode);
|
||||
}
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId));
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
return Result.success();
|
||||
}
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.schoolOfficer")
|
||||
@ApiOperation("删除校工会人员角色")
|
||||
public Result deleteSchoolUnionUserRole(String userId, String roleCode) {
|
||||
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
if (Lang.isEmpty(role)) {
|
||||
throw new BaseException("无法找到{}对应编码的角色", roleCode);
|
||||
}
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId));
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分工会干部
|
||||
*
|
||||
* @param pageForm
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result branchUnionUserPageData(PageForm pageForm, String unionId) {
|
||||
List<Sys_dict> branchUnionRoles = sysDictService.getSubListByCode("BRANCH_UNION_ROLES");
|
||||
if (Lang.isEmpty(branchUnionRoles)) {
|
||||
return Result.success();
|
||||
}
|
||||
List<String> branchUnionRoleCodes = branchUnionRoles.stream().map(Sys_dict::getCode).toList();
|
||||
/**
|
||||
* 分工会干部
|
||||
*
|
||||
* @param pageForm
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result branchUnionUserPageData(PageForm pageForm, String unionId) {
|
||||
List<Sys_dict> branchUnionRoles = sysDictService.getSubListByCode("BRANCH_UNION_ROLES");
|
||||
if (Lang.isEmpty(branchUnionRoles)) {
|
||||
return Result.success();
|
||||
}
|
||||
List<String> branchUnionRoleCodes = branchUnionRoles.stream().map(Sys_dict::getCode).toList();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
role.`name` AS roleName,
|
||||
@@ -291,36 +291,39 @@ public class SysUnionController {
|
||||
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
$condition
|
||||
$constructionSql
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.where("role.`code`", "in", branchUnionRoleCodes);
|
||||
cnd.and("info.unionId", "=", unionId);
|
||||
if (StrUtil.isAllNotBlank(pageForm.getSearchName(), pageForm.getSearchKeyword())) {
|
||||
switch (pageForm.getSearchName()) {
|
||||
case "loginname" -> cnd.where().andLike("info.loginname", pageForm.getSearchKeyword());
|
||||
case "username" -> cnd.where().andLike("info.username", pageForm.getSearchKeyword());
|
||||
case "roleName" -> cnd.where().andLike("role.`name`", pageForm.getSearchKeyword());
|
||||
}
|
||||
}
|
||||
cnd.and(new Static("1=1 order by field(role.code," + branchUnionRoleCodes.stream().map(code -> "'" + code + "'").collect(Collectors.joining(",")) + ")"));
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = sysUserService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
Cnd cnd = Cnd.where("role.`code`", "in", branchUnionRoleCodes);
|
||||
cnd.and("info.unionId", "=", unionId);
|
||||
if (StrUtil.isAllNotBlank(pageForm.getSearchName(), pageForm.getSearchKeyword())) {
|
||||
switch (pageForm.getSearchName()) {
|
||||
case "loginname" -> cnd.where().andLike("info.loginname", pageForm.getSearchKeyword());
|
||||
case "username" -> cnd.where().andLike("info.username", pageForm.getSearchKeyword());
|
||||
case "roleName" -> cnd.where().andLike("role.`name`", pageForm.getSearchKeyword());
|
||||
}
|
||||
}
|
||||
sql.setVar("constructionSql",
|
||||
new Static(" group by info.id order by field(role.code," + branchUnionRoleCodes.stream().map(code -> "'" + code + "'").collect(Collectors.joining(",")) + ")")
|
||||
);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = sysUserService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.branchOfficer")
|
||||
@ApiOperation("添加分工会人员角色")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result insertBranchUnionUserRole(String userId, String roleCode, String unionId) {
|
||||
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
if (Lang.isEmpty(role)) {
|
||||
return Result.success("无法找到" + roleCode + "对应编码的角色");
|
||||
}
|
||||
int count = dao.count(Sys_user_role.class, Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId));
|
||||
if (count > 0) {
|
||||
return Result.error("请勿重复添加");
|
||||
}
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.branchOfficer")
|
||||
@ApiOperation("添加分工会人员角色")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result insertBranchUnionUserRole(String userId, String roleCode, String unionId) {
|
||||
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
if (Lang.isEmpty(role)) {
|
||||
return Result.success("无法找到" + roleCode + "对应编码的角色");
|
||||
}
|
||||
int count = dao.count(Sys_user_role.class, Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId));
|
||||
if (count > 0) {
|
||||
return Result.error("请勿重复添加");
|
||||
}
|
||||
|
||||
// Sys_branch_union_user_permission permission = new Sys_branch_union_user_permission();
|
||||
// permission.setUserId(userId);
|
||||
@@ -339,142 +342,142 @@ public class SysUnionController {
|
||||
// sysRoleService.clearCache();
|
||||
// sysUserService.clearCache();
|
||||
|
||||
// 构建表结构存储
|
||||
View_user user = dao.fetch(View_user.class, Cnd.where("id", "=", userId));
|
||||
// 构建表结构存储
|
||||
View_user user = dao.fetch(View_user.class, Cnd.where("id", "=", userId));
|
||||
|
||||
Sys_union_cadre unionCadre = new Sys_union_cadre();
|
||||
unionCadre.setUserId(userId);
|
||||
unionCadre.setUnionId(unionId);
|
||||
unionCadre.setMobile(user.getMobile());
|
||||
unionCadre.setUnionName(user.getUnionName());
|
||||
unionCadre.setLoginName(user.getLoginname());
|
||||
unionCadre.setUserName(user.getUsername());
|
||||
unionCadre.setRoleCode(roleCode);
|
||||
unionCadre.setApplyDate(new Date());
|
||||
unionCadre.setIsJoin(true);
|
||||
dao.insert(unionCadre);
|
||||
Sys_union_cadre unionCadre = new Sys_union_cadre();
|
||||
unionCadre.setUserId(userId);
|
||||
unionCadre.setUnionId(unionId);
|
||||
unionCadre.setMobile(user.getMobile());
|
||||
unionCadre.setUnionName(user.getUnionName());
|
||||
unionCadre.setLoginName(user.getLoginname());
|
||||
unionCadre.setUserName(user.getUsername());
|
||||
unionCadre.setRoleCode(roleCode);
|
||||
unionCadre.setApplyDate(new Date());
|
||||
unionCadre.setIsJoin(true);
|
||||
dao.insert(unionCadre);
|
||||
|
||||
// 去走工作流
|
||||
boolean isAdmin = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name());
|
||||
Dict args = Dict.create();
|
||||
args.set("submit", isAdmin ? "admin" : "branch");
|
||||
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
|
||||
args.set(FlowConst.FORM_DATA, unionCadre);
|
||||
// 去走工作流
|
||||
boolean isAdmin = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name());
|
||||
Dict args = Dict.create();
|
||||
args.set("submit", isAdmin ? "admin" : "branch");
|
||||
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
|
||||
args.set(FlowConst.FORM_DATA, unionCadre);
|
||||
|
||||
ProcessInstance instance = flowEngine.startProcessInstanceByKey("JCGHWY", unionCadre.getId(), SecurityUtil.getUserId(), args);
|
||||
// 自动完成第一个申请任务
|
||||
List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null);
|
||||
for (ProcessTask task : doingTaskList) {
|
||||
flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args);
|
||||
}
|
||||
ProcessInstance instance = flowEngine.startProcessInstanceByKey("JCGHWY", unionCadre.getId(), SecurityUtil.getUserId(), args);
|
||||
// 自动完成第一个申请任务
|
||||
List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null);
|
||||
for (ProcessTask task : doingTaskList) {
|
||||
flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args);
|
||||
}
|
||||
|
||||
if (isAdmin) {
|
||||
// 如果是管理员,直接加角色
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId).and("unionId", "=", unionId));
|
||||
sysRoleService.insert("sys_user_role", Chain.make("roleId", role.getId()).add("userId", userId).add("unionId", unionId));
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
}
|
||||
if (isAdmin) {
|
||||
// 如果是管理员,直接加角色
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId).and("unionId", "=", unionId));
|
||||
sysRoleService.insert("sys_user_role", Chain.make("roleId", role.getId()).add("userId", userId).add("unionId", unionId));
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
}
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除分工会人员角色")
|
||||
@SaCheckPermission("sys.manager.union.branchOfficer")
|
||||
public Result deleteBranchUnionUserRole(String userId, String roleCode, String unionId) {
|
||||
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
if (Lang.isEmpty(role)) {
|
||||
throw new BaseException("无法找到{}对应编码的角色", roleCode);
|
||||
}
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("roleId", "=", role.getId());
|
||||
if (StrUtil.isNotBlank(userId)) {
|
||||
cnd.and("userId", "=", userId);
|
||||
} else {
|
||||
cnd.and("userId", "is", null);
|
||||
}
|
||||
cnd.and("unionId", "=", unionId);
|
||||
@At
|
||||
@ApiOperation("删除分工会人员角色")
|
||||
@SaCheckPermission("sys.manager.union.branchOfficer")
|
||||
public Result deleteBranchUnionUserRole(String userId, String roleCode, String unionId) {
|
||||
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
if (Lang.isEmpty(role)) {
|
||||
throw new BaseException("无法找到{}对应编码的角色", roleCode);
|
||||
}
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("roleId", "=", role.getId());
|
||||
if (StrUtil.isNotBlank(userId)) {
|
||||
cnd.and("userId", "=", userId);
|
||||
} else {
|
||||
cnd.and("userId", "is", null);
|
||||
}
|
||||
cnd.and("unionId", "=", unionId);
|
||||
|
||||
sysRoleService.clear("sys_user_role", cnd);
|
||||
sysRoleService.clear("sys_user_role", cnd);
|
||||
|
||||
dao.clear(Sys_union_cadre.class, Cnd.where("userId", "=", userId)
|
||||
.and("unionId", "=", unionId).and("roleCode", "=", roleCode));
|
||||
dao.clear(Sys_union_cadre.class, Cnd.where("userId", "=", userId)
|
||||
.and("unionId", "=", unionId).and("roleCode", "=", roleCode));
|
||||
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
return Result.success();
|
||||
}
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("分工会组成单位分页")
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result branchUnionPartUnitPageData(PageForm pageForm, String unionId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("unionId", "=", unionId);
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("`name`", pageForm.getSearchKeyword());
|
||||
seg.orLike("unitcode", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.desc("unitcode");
|
||||
@At
|
||||
@ApiOperation("分工会组成单位分页")
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result branchUnionPartUnitPageData(PageForm pageForm, String unionId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("unionId", "=", unionId);
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("`name`", pageForm.getSearchKeyword());
|
||||
seg.orLike("unitcode", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.desc("unitcode");
|
||||
|
||||
List<Sys_unit> list = dao.query(Sys_unit.class, cnd);
|
||||
return Result.success(list);
|
||||
}
|
||||
List<Sys_unit> list = dao.query(Sys_unit.class, cnd);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分工会组成单位穿梭框数据")
|
||||
@SaCheckPermission("sys.manager.union.partUnit")
|
||||
public Result branchUnionPartUnitTransferData(String unionId) {
|
||||
@At
|
||||
@ApiOperation("分工会组成单位穿梭框数据")
|
||||
@SaCheckPermission("sys.manager.union.partUnit")
|
||||
public Result branchUnionPartUnitTransferData(String unionId) {
|
||||
// List<Sys_unit> units = dao.query(Sys_unit.class, Cnd.where("unitLevel", "=", 2).asc("unitcode"));
|
||||
List<Sys_unit> units = dao.query(Sys_unit.class, Cnd.where("unitTypeCode", "=", "1").asc("unitcode"));
|
||||
List<String> selectUnitIds = units.stream().filter(unit -> StrUtil.isNotBlank(unit.getUnionId()) && unit.getUnionId().equals(unionId)).map(Sys_unit::getId).toList();
|
||||
List<Sys_unit> matchUnits = units.stream().filter(unit -> StrUtil.isBlank(unit.getUnionId()) || (StrUtil.isNotBlank(unit.getUnionId()) && unit.getUnionId().equals(unionId))).toList();
|
||||
NutMap transferData = NutMap.NEW().addv("selectUnitIds", selectUnitIds).addv("allUnits", matchUnits);
|
||||
return Result.success(transferData);
|
||||
}
|
||||
List<Sys_unit> units = dao.query(Sys_unit.class, Cnd.where("unitTypeCode", "=", "1").asc("unitcode"));
|
||||
List<String> selectUnitIds = units.stream().filter(unit -> StrUtil.isNotBlank(unit.getUnionId()) && unit.getUnionId().equals(unionId)).map(Sys_unit::getId).toList();
|
||||
List<Sys_unit> matchUnits = units.stream().filter(unit -> StrUtil.isBlank(unit.getUnionId()) || (StrUtil.isNotBlank(unit.getUnionId()) && unit.getUnionId().equals(unionId))).toList();
|
||||
NutMap transferData = NutMap.NEW().addv("selectUnitIds", selectUnitIds).addv("allUnits", matchUnits);
|
||||
return Result.success(transferData);
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("删除分工会组成单位")
|
||||
@SaCheckPermission("sys.manager.union.partUnit")
|
||||
public Result branchUnionPartUnitSet(String unionId, @Param("unitIds") String[] unitIds) {
|
||||
sysUnitService.update(Chain.make("unionId", null), Cnd.where("unionId", "=", unionId));
|
||||
if (Lang.isNotEmpty(unitIds)) {
|
||||
sysUnitService.update(Chain.make("unionId", unionId), Cnd.where("id", "in", unitIds));
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("删除分工会组成单位")
|
||||
@SaCheckPermission("sys.manager.union.partUnit")
|
||||
public Result branchUnionPartUnitSet(String unionId, @Param("unitIds") String[] unitIds) {
|
||||
sysUnitService.update(Chain.make("unionId", null), Cnd.where("unionId", "=", unionId));
|
||||
if (Lang.isNotEmpty(unitIds)) {
|
||||
sysUnitService.update(Chain.make("unionId", unionId), Cnd.where("id", "in", unitIds));
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("按关键字查询分工会下的人员")
|
||||
@Ok("json:{ignoreNull:true}")
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result listUserSelect(@Valid String unionId, @Valid String keyWord) {
|
||||
Sql sql = Sqls.create("select id,loginname,username,unitName from vw_user $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(View_user::getUnionId, "=", unionId);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike(View_user::getLoginname, keyWord, true);
|
||||
seg.orLike(View_user::getUsername, keyWord, true);
|
||||
cnd.and(seg);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = sysUnionService.listPageMap(1, 10, sql);
|
||||
return Result.success(pagination.getList());
|
||||
}
|
||||
@At
|
||||
@ApiOperation("按关键字查询分工会下的人员")
|
||||
@Ok("json:{ignoreNull:true}")
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result listUnion(@Valid String unionId, @Valid String keyWord) {
|
||||
Sql sql = Sqls.create("select id,loginname,username,unitName from vw_user $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(View_user::getUnionId, "=", unionId);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike(View_user::getLoginname, keyWord, true);
|
||||
seg.orLike(View_user::getUsername, keyWord, true);
|
||||
cnd.and(seg);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = sysUnionService.listPageMap(1, 10, sql);
|
||||
return Result.success(pagination.getList());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 基层干部审核相关
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("基层干部审核菜单")
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result cadrePageData(PageForm pageForm, @Param("isJoin") Boolean isJoin) {
|
||||
Sql sql = Sqls.create("""
|
||||
/**
|
||||
* 基层干部审核相关
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("基层干部审核菜单")
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result cadrePageData(PageForm pageForm, @Param("isJoin") Boolean isJoin) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
role.`name` AS roleName,
|
||||
@@ -504,26 +507,26 @@ public class SysUnionController {
|
||||
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "2978a74a-75c1-4f95-99f9-9c08c480f1b5");
|
||||
if (pageForm.getAudit()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(),
|
||||
ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "2978a74a-75c1-4f95-99f9-9c08c480f1b5");
|
||||
if (pageForm.getAudit()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(),
|
||||
ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
cnd.andEX("info.isJoin", "=", isJoin);
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("t.createdAt");
|
||||
cnd.desc("info.applyDate");
|
||||
} else {
|
||||
cnd.orderBy("info." + pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = sysUnionService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
cnd.andEX("info.isJoin", "=", isJoin);
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("t.createdAt");
|
||||
cnd.desc("info.applyDate");
|
||||
} else {
|
||||
cnd.orderBy("info." + pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = sysUnionService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user