Merge remote-tracking branch 'origin/main'

This commit is contained in:
JyuHsin
2025-12-10 18:02:08 +08:00
3 changed files with 347 additions and 339 deletions
@@ -56,101 +56,101 @@ import java.util.stream.Collectors;
@At("/platform/sys/union") @At("/platform/sys/union")
public class SysUnionController { public class SysUnionController {
@Inject @Inject
private Dao dao; private Dao dao;
@Inject @Inject
private FlowEngine flowEngine; private FlowEngine flowEngine;
@Inject @Inject
private SysDictService sysDictService; private SysDictService sysDictService;
@Inject @Inject
private SysRoleService sysRoleService; private SysRoleService sysRoleService;
@Inject @Inject
private SysUserService sysUserService; private SysUserService sysUserService;
@Inject @Inject
private SysUnitService sysUnitService; private SysUnitService sysUnitService;
@Inject @Inject
private SysUnionService sysUnionService; private SysUnionService sysUnionService;
@At("") @At("")
@Ok("beetl:/platform/sys/union/index.html") @Ok("beetl:/platform/sys/union/index.html")
@SaCheckPermission("sys.manager.union") @SaCheckPermission("sys.manager.union")
public void index() { public void index() {
} }
@At @At
@SaCheckPermission("sys.manager.union.add") @SaCheckPermission("sys.manager.union.add")
@ApiOperation("新增分工会") @ApiOperation("新增分工会")
public Result insert(Sys_union union) { public Result insert(Sys_union union) {
try { try {
dao.insert(union); dao.insert(union);
return Result.success(); return Result.success();
} catch (Exception e) { } catch (Exception e) {
return Result.error(); return Result.error();
} }
} }
@At @At
@SaCheckPermission("sys.manager.union.edit") @SaCheckPermission("sys.manager.union.edit")
@ApiOperation("编辑分工会") @ApiOperation("编辑分工会")
public Result update(Sys_union union) { public Result update(Sys_union union) {
try { try {
dao.updateIgnoreNull(union); dao.updateIgnoreNull(union);
return Result.success(); return Result.success();
} catch (Exception e) { } catch (Exception e) {
return Result.error(); return Result.error();
} }
} }
@At @At
@SaCheckPermission("sys.manager.union") @SaCheckPermission("sys.manager.union")
public Result findOne(String id) { public Result findOne(String id) {
Sys_union union = dao.fetch(Sys_union.class, id); Sys_union union = dao.fetch(Sys_union.class, id);
return Result.success(union); return Result.success(union);
} }
@At @At
@ApiOperation("删除分工会") @ApiOperation("删除分工会")
@SaCheckPermission("sys.manager.union.delete") @SaCheckPermission("sys.manager.union.delete")
public Result doDelete(String id) { public Result doDelete(String id) {
dao.delete(Sys_union.class, id); dao.delete(Sys_union.class, id);
return Result.success(); return Result.success();
} }
@At @At
@SaCheckPermission("sys.manager.union") @SaCheckPermission("sys.manager.union")
public Result tree() { public Result tree() {
List<Tree<String>> treeList = null; List<Tree<String>> treeList = null;
try { try {
boolean schoolUnionAdmin = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name()); boolean schoolUnionAdmin = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name());
List<TreeNode<String>> nodeList = CollUtil.newArrayList(); List<TreeNode<String>> nodeList = CollUtil.newArrayList();
nodeList.add(new TreeNode<>("工会委员会", "0", "工会委员会", 1000)); nodeList.add(new TreeNode<>("工会委员会", "0", "工会委员会", 1000));
List<Sys_union> list = new ArrayList<>(); List<Sys_union> list = new ArrayList<>();
if (schoolUnionAdmin) { if (schoolUnionAdmin) {
list = dao.query(Sys_union.class, Cnd.NEW().asc("unionCode")); list = dao.query(Sys_union.class, Cnd.NEW().asc("unionCode"));
} else { } else {
list = dao.query(Sys_union.class, Cnd.NEW().and("id", "=", SecurityUtil.getUnionId())); list = dao.query(Sys_union.class, Cnd.NEW().and("id", "=", SecurityUtil.getUnionId()));
} }
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
nodeList.add(new TreeNode<>(list.get(i).getId(), "工会委员会", list.get(i).getName(), i)); nodeList.add(new TreeNode<>(list.get(i).getId(), "工会委员会", list.get(i).getName(), i));
} }
treeList = TreeUtil.build(nodeList, "0"); treeList = TreeUtil.build(nodeList, "0");
return Result.success().addData(treeList); return Result.success().addData(treeList);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return Result.error(); return Result.error();
} }
} }
@At @At
@SaCheckPermission("sys.manager.union") @SaCheckPermission("sys.manager.union")
public Result pageData(@Valid PageForm pageForm) { public Result pageData(@Valid PageForm pageForm) {
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
gh.*, gh.*,
GROUP_CONCAT( u.username,'(',u.loginname,')' ) AS chairman 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 LEFT JOIN sys_user u ON u.id = sur.userId
$condition $condition
"""); """);
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
cnd.and(Cnd.likeEX("gh.name", pageForm.getSearchKeyword())); cnd.and(Cnd.likeEX("gh.name", pageForm.getSearchKeyword()));
} }
cnd.asc("gh.unionCode"); cnd.asc("gh.unionCode");
cnd.groupBy("gh.id"); cnd.groupBy("gh.id");
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) { if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
cnd.and("gh.id", "=", SecurityUtil.getUnionId()); cnd.and("gh.id", "=", SecurityUtil.getUnionId());
} }
sql.setCondition(cnd); sql.setCondition(cnd);
Pagination pagination = sysUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); Pagination pagination = sysUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination); return Result.success(pagination);
} }
@At @At
@SaCheckPermission("sys.manager.union") @SaCheckPermission("sys.manager.union")
public Result schoolUnionUserPageData(PageForm pageForm) { public Result schoolUnionUserPageData(PageForm pageForm) {
List<Sys_dict> schoolRoles = sysDictService.getSubListByCode("SCHOOL_UNION_ROLES"); List<Sys_dict> schoolRoles = sysDictService.getSubListByCode("SCHOOL_UNION_ROLES");
List<String> schoolRoleCodes = schoolRoles.stream().map(Sys_dict::getCode).toList(); List<String> schoolRoleCodes = schoolRoles.stream().map(Sys_dict::getCode).toList();
if (Lang.isEmpty(schoolRoles)) { if (Lang.isEmpty(schoolRoles)) {
return Result.success(); return Result.success();
} }
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
t1.userId, t1.userId,
t2.username, t2.username,
@@ -200,71 +200,71 @@ public class SysUnionController {
LEFT JOIN sys_dict t4 ON t4.code = t3.code LEFT JOIN sys_dict t4 ON t4.code = t3.code
$condition $condition
"""); """);
Cnd cnd = Cnd.where("t3.`code`", "in", schoolRoleCodes); Cnd cnd = Cnd.where("t3.`code`", "in", schoolRoleCodes);
if (StrUtil.isAllNotBlank(pageForm.getSearchName(), pageForm.getSearchKeyword())) { if (StrUtil.isAllNotBlank(pageForm.getSearchName(), pageForm.getSearchKeyword())) {
switch (pageForm.getSearchName()) { switch (pageForm.getSearchName()) {
case "loginname" -> cnd.where().andLike("t2.loginname", pageForm.getSearchKeyword()); case "loginname" -> cnd.where().andLike("t2.loginname", pageForm.getSearchKeyword());
case "username" -> cnd.where().andLike("t2.username", pageForm.getSearchKeyword()); case "username" -> cnd.where().andLike("t2.username", pageForm.getSearchKeyword());
case "roleName" -> cnd.where().andLike("t3.`name`", pageForm.getSearchKeyword()); case "roleName" -> cnd.where().andLike("t3.`name`", pageForm.getSearchKeyword());
} }
} }
cnd.asc("t4.location"); cnd.asc("t4.location");
cnd.asc("t2.username"); cnd.asc("t2.username");
sql.setCondition(cnd); sql.setCondition(cnd);
List<NutMap> list = sysUserService.listMap(sql); List<NutMap> list = sysUserService.listMap(sql);
return Result.success(list); return Result.success(list);
} }
@At @At
@SaCheckPermission("sys.manager.union.schoolOfficer") @SaCheckPermission("sys.manager.union.schoolOfficer")
@ApiModelProperty("添加校工会人员角色") @ApiModelProperty("添加校工会人员角色")
public Result insertSchoolUnionUserRole(String userId, String roleCode) { public Result insertSchoolUnionUserRole(String userId, String roleCode) {
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode)); Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
if (Lang.isEmpty(role)) { if (Lang.isEmpty(role)) {
return Result.error("无法找到" + roleCode + "对应编码的角色"); return Result.error("无法找到" + roleCode + "对应编码的角色");
} }
int count = dao.count(Sys_user_role.class, Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId)); int count = dao.count(Sys_user_role.class, Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId));
if (count > 0) { if (count > 0) {
return Result.error("请勿重复添加"); return Result.error("请勿重复添加");
} }
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId)); 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.insert("sys_user_role", Chain.make("roleId", role.getId()).add("userId", userId));
sysRoleService.clearCache(); sysRoleService.clearCache();
sysUserService.clearCache(); sysUserService.clearCache();
return Result.success(); return Result.success();
} }
@At @At
@SaCheckPermission("sys.manager.union.schoolOfficer") @SaCheckPermission("sys.manager.union.schoolOfficer")
@ApiOperation("删除校工会人员角色") @ApiOperation("删除校工会人员角色")
public Result deleteSchoolUnionUserRole(String userId, String roleCode) { public Result deleteSchoolUnionUserRole(String userId, String roleCode) {
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode)); Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
if (Lang.isEmpty(role)) { if (Lang.isEmpty(role)) {
throw new BaseException("无法找到{}对应编码的角色", roleCode); throw new BaseException("无法找到{}对应编码的角色", roleCode);
} }
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId)); sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId));
sysRoleService.clearCache(); sysRoleService.clearCache();
sysUserService.clearCache(); sysUserService.clearCache();
return Result.success(); return Result.success();
} }
/** /**
* 分工会干部 * 分工会干部
* *
* @param pageForm * @param pageForm
* @return * @return
*/ */
@At @At
@SaCheckPermission("sys.manager.union") @SaCheckPermission("sys.manager.union")
public Result branchUnionUserPageData(PageForm pageForm, String unionId) { public Result branchUnionUserPageData(PageForm pageForm, String unionId) {
List<Sys_dict> branchUnionRoles = sysDictService.getSubListByCode("BRANCH_UNION_ROLES"); List<Sys_dict> branchUnionRoles = sysDictService.getSubListByCode("BRANCH_UNION_ROLES");
if (Lang.isEmpty(branchUnionRoles)) { if (Lang.isEmpty(branchUnionRoles)) {
return Result.success(); return Result.success();
} }
List<String> branchUnionRoleCodes = branchUnionRoles.stream().map(Sys_dict::getCode).toList(); List<String> branchUnionRoleCodes = branchUnionRoles.stream().map(Sys_dict::getCode).toList();
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
info.*, info.*,
role.`name` AS roleName, 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 t ON t.processInstanceId = ins.id AND t.taskState = 10
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
$condition $condition
$constructionSql
"""); """);
Cnd cnd = Cnd.where("role.`code`", "in", branchUnionRoleCodes); Cnd cnd = Cnd.where("role.`code`", "in", branchUnionRoleCodes);
cnd.and("info.unionId", "=", unionId); cnd.and("info.unionId", "=", unionId);
if (StrUtil.isAllNotBlank(pageForm.getSearchName(), pageForm.getSearchKeyword())) { if (StrUtil.isAllNotBlank(pageForm.getSearchName(), pageForm.getSearchKeyword())) {
switch (pageForm.getSearchName()) { switch (pageForm.getSearchName()) {
case "loginname" -> cnd.where().andLike("info.loginname", pageForm.getSearchKeyword()); case "loginname" -> cnd.where().andLike("info.loginname", pageForm.getSearchKeyword());
case "username" -> cnd.where().andLike("info.username", pageForm.getSearchKeyword()); case "username" -> cnd.where().andLike("info.username", pageForm.getSearchKeyword());
case "roleName" -> cnd.where().andLike("role.`name`", 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.setVar("constructionSql",
sql.setCondition(cnd); new Static(" group by info.id order by field(role.code," + branchUnionRoleCodes.stream().map(code -> "'" + code + "'").collect(Collectors.joining(",")) + ")")
List<NutMap> list = sysUserService.listMap(sql); );
return Result.success(list); sql.setCondition(cnd);
} List<NutMap> list = sysUserService.listMap(sql);
return Result.success(list);
}
@At @At
@SaCheckPermission("sys.manager.union.branchOfficer") @SaCheckPermission("sys.manager.union.branchOfficer")
@ApiOperation("添加分工会人员角色") @ApiOperation("添加分工会人员角色")
@Aop(TransAop.READ_COMMITTED) @Aop(TransAop.READ_COMMITTED)
public Result insertBranchUnionUserRole(String userId, String roleCode, String unionId) { public Result insertBranchUnionUserRole(String userId, String roleCode, String unionId) {
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode)); Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
if (Lang.isEmpty(role)) { if (Lang.isEmpty(role)) {
return Result.success("无法找到" + roleCode + "对应编码的角色"); return Result.success("无法找到" + roleCode + "对应编码的角色");
} }
int count = dao.count(Sys_user_role.class, Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId)); int count = dao.count(Sys_user_role.class, Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId));
if (count > 0) { if (count > 0) {
return Result.error("请勿重复添加"); return Result.error("请勿重复添加");
} }
// Sys_branch_union_user_permission permission = new Sys_branch_union_user_permission(); // Sys_branch_union_user_permission permission = new Sys_branch_union_user_permission();
// permission.setUserId(userId); // permission.setUserId(userId);
@@ -339,142 +342,142 @@ public class SysUnionController {
// sysRoleService.clearCache(); // sysRoleService.clearCache();
// sysUserService.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(); Sys_union_cadre unionCadre = new Sys_union_cadre();
unionCadre.setUserId(userId); unionCadre.setUserId(userId);
unionCadre.setUnionId(unionId); unionCadre.setUnionId(unionId);
unionCadre.setMobile(user.getMobile()); unionCadre.setMobile(user.getMobile());
unionCadre.setUnionName(user.getUnionName()); unionCadre.setUnionName(user.getUnionName());
unionCadre.setLoginName(user.getLoginname()); unionCadre.setLoginName(user.getLoginname());
unionCadre.setUserName(user.getUsername()); unionCadre.setUserName(user.getUsername());
unionCadre.setRoleCode(roleCode); unionCadre.setRoleCode(roleCode);
unionCadre.setApplyDate(new Date()); unionCadre.setApplyDate(new Date());
unionCadre.setIsJoin(true); unionCadre.setIsJoin(true);
dao.insert(unionCadre); dao.insert(unionCadre);
// 去走工作流 // 去走工作流
boolean isAdmin = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name()); boolean isAdmin = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name());
Dict args = Dict.create(); Dict args = Dict.create();
args.set("submit", isAdmin ? "admin" : "branch"); args.set("submit", isAdmin ? "admin" : "branch");
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode()); args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
args.set(FlowConst.FORM_DATA, unionCadre); args.set(FlowConst.FORM_DATA, unionCadre);
ProcessInstance instance = flowEngine.startProcessInstanceByKey("JCGHWY", unionCadre.getId(), SecurityUtil.getUserId(), args); ProcessInstance instance = flowEngine.startProcessInstanceByKey("JCGHWY", unionCadre.getId(), SecurityUtil.getUserId(), args);
// 自动完成第一个申请任务 // 自动完成第一个申请任务
List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null); List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null);
for (ProcessTask task : doingTaskList) { for (ProcessTask task : doingTaskList) {
flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args); flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args);
} }
if (isAdmin) { if (isAdmin) {
// 如果是管理员,直接加角色 // 如果是管理员,直接加角色
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId).and("unionId", "=", unionId)); 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.insert("sys_user_role", Chain.make("roleId", role.getId()).add("userId", userId).add("unionId", unionId));
sysRoleService.clearCache(); sysRoleService.clearCache();
sysUserService.clearCache(); sysUserService.clearCache();
} }
return Result.success(); return Result.success();
} }
@At @At
@ApiOperation("删除分工会人员角色") @ApiOperation("删除分工会人员角色")
@SaCheckPermission("sys.manager.union.branchOfficer") @SaCheckPermission("sys.manager.union.branchOfficer")
public Result deleteBranchUnionUserRole(String userId, String roleCode, String unionId) { public Result deleteBranchUnionUserRole(String userId, String roleCode, String unionId) {
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode)); Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
if (Lang.isEmpty(role)) { if (Lang.isEmpty(role)) {
throw new BaseException("无法找到{}对应编码的角色", roleCode); throw new BaseException("无法找到{}对应编码的角色", roleCode);
} }
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
cnd.and("roleId", "=", role.getId()); cnd.and("roleId", "=", role.getId());
if (StrUtil.isNotBlank(userId)) { if (StrUtil.isNotBlank(userId)) {
cnd.and("userId", "=", userId); cnd.and("userId", "=", userId);
} else { } else {
cnd.and("userId", "is", null); cnd.and("userId", "is", null);
} }
cnd.and("unionId", "=", unionId); 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) dao.clear(Sys_union_cadre.class, Cnd.where("userId", "=", userId)
.and("unionId", "=", unionId).and("roleCode", "=", roleCode)); .and("unionId", "=", unionId).and("roleCode", "=", roleCode));
sysRoleService.clearCache(); sysRoleService.clearCache();
sysUserService.clearCache(); sysUserService.clearCache();
return Result.success(); return Result.success();
} }
@At @At
@ApiOperation("分工会组成单位分页") @ApiOperation("分工会组成单位分页")
@SaCheckPermission("sys.manager.union") @SaCheckPermission("sys.manager.union")
public Result branchUnionPartUnitPageData(PageForm pageForm, String unionId) { public Result branchUnionPartUnitPageData(PageForm pageForm, String unionId) {
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
cnd.and("unionId", "=", unionId); cnd.and("unionId", "=", unionId);
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup(); SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("`name`", pageForm.getSearchKeyword()); seg.orLike("`name`", pageForm.getSearchKeyword());
seg.orLike("unitcode", pageForm.getSearchKeyword()); seg.orLike("unitcode", pageForm.getSearchKeyword());
cnd.and(seg); cnd.and(seg);
} }
cnd.desc("unitcode"); cnd.desc("unitcode");
List<Sys_unit> list = dao.query(Sys_unit.class, cnd); List<Sys_unit> list = dao.query(Sys_unit.class, cnd);
return Result.success(list); return Result.success(list);
} }
@At @At
@ApiOperation("分工会组成单位穿梭框数据") @ApiOperation("分工会组成单位穿梭框数据")
@SaCheckPermission("sys.manager.union.partUnit") @SaCheckPermission("sys.manager.union.partUnit")
public Result branchUnionPartUnitTransferData(String unionId) { 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("unitLevel", "=", 2).asc("unitcode"));
List<Sys_unit> units = dao.query(Sys_unit.class, Cnd.where("unitTypeCode", "=", "1").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<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(); 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); NutMap transferData = NutMap.NEW().addv("selectUnitIds", selectUnitIds).addv("allUnits", matchUnits);
return Result.success(transferData); return Result.success(transferData);
} }
@At @At
@Aop(TransAop.READ_COMMITTED) @Aop(TransAop.READ_COMMITTED)
@ApiOperation("删除分工会组成单位") @ApiOperation("删除分工会组成单位")
@SaCheckPermission("sys.manager.union.partUnit") @SaCheckPermission("sys.manager.union.partUnit")
public Result branchUnionPartUnitSet(String unionId, @Param("unitIds") String[] unitIds) { public Result branchUnionPartUnitSet(String unionId, @Param("unitIds") String[] unitIds) {
sysUnitService.update(Chain.make("unionId", null), Cnd.where("unionId", "=", unionId)); sysUnitService.update(Chain.make("unionId", null), Cnd.where("unionId", "=", unionId));
if (Lang.isNotEmpty(unitIds)) { if (Lang.isNotEmpty(unitIds)) {
sysUnitService.update(Chain.make("unionId", unionId), Cnd.where("id", "in", unitIds)); sysUnitService.update(Chain.make("unionId", unionId), Cnd.where("id", "in", unitIds));
} }
return Result.success(); return Result.success();
} }
@At @At
@ApiOperation("按关键字查询分工会下的人员") @ApiOperation("按关键字查询分工会下的人员")
@Ok("json:{ignoreNull:true}") @Ok("json:{ignoreNull:true}")
@SaCheckPermission("sys.manager.union") @SaCheckPermission("sys.manager.union")
public Result listUserSelect(@Valid String unionId, @Valid String keyWord) { public Result listUnion(@Valid String unionId, @Valid String keyWord) {
Sql sql = Sqls.create("select id,loginname,username,unitName from vw_user $condition"); Sql sql = Sqls.create("select id,loginname,username,unitName from vw_user $condition");
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
cnd.and(View_user::getUnionId, "=", unionId); cnd.and(View_user::getUnionId, "=", unionId);
SqlExpressionGroup seg = new SqlExpressionGroup(); SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike(View_user::getLoginname, keyWord, true); seg.orLike(View_user::getLoginname, keyWord, true);
seg.orLike(View_user::getUsername, keyWord, true); seg.orLike(View_user::getUsername, keyWord, true);
cnd.and(seg); cnd.and(seg);
sql.setCondition(cnd); sql.setCondition(cnd);
Pagination pagination = sysUnionService.listPageMap(1, 10, sql); Pagination pagination = sysUnionService.listPageMap(1, 10, sql);
return Result.success(pagination.getList()); return Result.success(pagination.getList());
} }
/** /**
* 基层干部审核相关 * 基层干部审核相关
*/ */
@At @At
@ApiOperation("基层干部审核菜单") @ApiOperation("基层干部审核菜单")
@SaCheckPermission("sys.manager.union") @SaCheckPermission("sys.manager.union")
public Result cadrePageData(PageForm pageForm, @Param("isJoin") Boolean isJoin) { public Result cadrePageData(PageForm pageForm, @Param("isJoin") Boolean isJoin) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
info.*, info.*,
role.`name` AS roleName, 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 LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
$condition $condition
"""); """);
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
cnd.and("t.taskName", "=", "2978a74a-75c1-4f95-99f9-9c08c480f1b5"); cnd.and("t.taskName", "=", "2978a74a-75c1-4f95-99f9-9c08c480f1b5");
if (pageForm.getAudit()) { if (pageForm.getAudit()) {
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(),
ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode())); ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
} else { } else {
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode()); cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
} }
cnd.andEX("info.isJoin", "=", isJoin); cnd.andEX("info.isJoin", "=", isJoin);
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.desc("t.createdAt"); cnd.desc("t.createdAt");
cnd.desc("info.applyDate"); cnd.desc("info.applyDate");
} else { } else {
cnd.orderBy("info." + pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy())); cnd.orderBy("info." + pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
} }
cnd.groupBy("t.id"); cnd.groupBy("t.id");
sql.setCondition(cnd); sql.setCondition(cnd);
Pagination pagination = sysUnionService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); Pagination pagination = sysUnionService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination); return Result.success(pagination);
} }
} }
@@ -92,8 +92,7 @@ const branchUnionCommitteeMemberManage = {
sessionId: [{required: true, message: "必填", trigger: ["change", "blur"]}], sessionId: [{required: true, message: "必填", trigger: ["change", "blur"]}],
userId: [{required: true, message: "必填", trigger: ["change", "blur"]}], userId: [{required: true, message: "必填", trigger: ["change", "blur"]}],
}, },
sessionOptions: [], sessionOptions: []
pageDataUrl:"/platform/sys/committeeMember/pageData"
} }
}, },
methods: { methods: {
@@ -108,6 +107,12 @@ const branchUnionCommitteeMemberManage = {
} }
}) })
}, },
pageData() {
$.get("/platform/sys/committeeMember/pageData", this.pageForm).then((res) => {
this.tableData = res.data.list
this.pageForm.totalCount = res.data.totalCount
})
},
openAdd() { openAdd() {
this.dialogFormVisible = true this.dialogFormVisible = true
this.$nextTick(() => { this.$nextTick(() => {
@@ -119,7 +124,7 @@ const branchUnionCommitteeMemberManage = {
if (!valid) return if (!valid) return
const session = this.sessionOptions.find(item => item.id === this.formData.sessionId) const session = this.sessionOptions.find(item => item.id === this.formData.sessionId)
this.formData.sessionName = session.fullName this.formData.sessionName = session.fullName
this.$axios.post("/platform/sys/committeeMember/insert", this.formData).then((res) => { $.post("/platform/sys/committeeMember/insert", this.formData).then((res) => {
this.dialogFormVisible = false this.dialogFormVisible = false
this.$message.success(res.msg) this.$message.success(res.msg)
this.pageData() this.pageData()
@@ -132,7 +137,7 @@ const branchUnionCommitteeMemberManage = {
cancelButtonText: "取消", cancelButtonText: "取消",
type: "info" type: "info"
}).then(() => { }).then(() => {
this.$axios.post("/platform/sys/committeeMember/delete", {id}).then((res) => { $.post("/platform/sys/committeeMember/delete", {id}).then((res) => {
this.$message.success(res.msg) this.$message.success(res.msg)
this.pageData() this.pageData()
}) })
@@ -144,7 +149,7 @@ const branchUnionCommitteeMemberManage = {
cancelButtonText: "取消", cancelButtonText: "取消",
type: "info" type: "info"
}).then(() => { }).then(() => {
this.$axios.post("/platform/sys/committeeMember/deleteRole", {sessionId:this.pageForm.sessionId}).then((res) => { $.post("/platform/sys/committeeMember/deleteRole", {sessionId:this.pageForm.sessionId}).then((res) => {
this.$message.success(res.msg) this.$message.success(res.msg)
this.pageData() this.pageData()
}) })
@@ -51,13 +51,13 @@ const branchUnionUserManage = {
<user-select <user-select
v-model="formData.userId" v-model="formData.userId"
style="width: 100%" style="width: 100%"
api="/platform/sys/union/listUserSelect" api="/platform/sys/union/listUnion"
:api_params="{ unionId: union_id }" :api_params="{ unionId: union_id }"
:option_label_func=" :option_label_func="
(item) => { (item) => {
return item.username + item.loginname + '(' + item.unitName + ')' return item.username + item.loginname + '(' + item.unitName + ')'
} }
" "
></user-select> ></user-select>
</el-form-item> </el-form-item>
</el-form> </el-form>