This commit is contained in:
zhouhefeng
2026-04-30 10:51:59 +08:00
parent 195688cc01
commit b3a84786c3
6 changed files with 142 additions and 6 deletions
@@ -150,8 +150,10 @@ public class SysHomeController {
);
List<Sys_menu> menus = sysUserService.getMenus(SecurityUtil.getUserId());
List<String> allMenuIds = menus.stream().map(Sys_menu::getId).toList();
//List<Sys_menu> sysMenus = list.stream().filter(m -> allMenuIds.contains(m.getId())).sorted(Comparator.comparingInt(Sys_menu::getLocation)).toList();
List<Sys_menu> sysMenus = list.stream().sorted(Comparator.comparingInt(Sys_menu::getLocation)).toList();
List<Sys_menu> sysMenus = list.stream()
.sorted(Comparator.comparing(Sys_menu::getLocation, Comparator.nullsLast(Integer::compareTo))
.thenComparing(Sys_menu::getId))
.toList();
return Result.success(sysMenus);
}
@@ -411,6 +411,24 @@ public class SysMenuController {
}
}
@At
@Ok("json")
@SaCheckPermission("sys.manager.menu.edit")
public Object updateLocation(String id, Integer location) {
try {
if (StrUtil.isBlank(id) || location == null || location < 0) {
return Result.error("排序编码必须是非负整数");
}
sysMenuService.update(Chain.make("location", location), Cnd.where("id", "=", id));
sysMenuService.clearCache();
sysUserService.clearCache();
sysRoleService.clearCache();
return Result.success();
} catch (Exception e) {
return Result.error();
}
}
@At
@Ok("json")
@SaCheckPermission("sys.manager.menu")
@@ -257,7 +257,7 @@ public class SysUnionController {
*/
@At
@SaCheckPermission("sys.manager.union")
public Result branchUnionUserPageData(PageForm pageForm, String unionId) {
public Result branchUnionUserPageData(PageForm pageForm, String unionId, @Param("j") String j) {
List<Sys_dict> branchUnionRoles = sysDictService.getSubListByCode("BRANCH_UNION_ROLES");
if (Lang.isEmpty(branchUnionRoles)) {
return Result.success();
@@ -267,12 +267,18 @@ public class SysUnionController {
Sql sql = Sqls.create("""
SELECT
info.*,
COALESCE(jDict.`name`, info.j, curJDict.`name`, curSession.j) AS jName,
role.`name` AS roleName,
ins.id AS instanceId,
ins.businessNo,
ins.state instanceState,
ins.variable instanceVariable,
ins.processDefineId instanceProcessDefineId,
CASE
WHEN info.isServing = 0 THEN '离任'
WHEN t.id IS NOT NULL THEN t.displayName
ELSE '在任'
END AS displayStatus,
t.id taskId,
t.taskName AS taskKey,
t.displayName taskName,
@@ -287,6 +293,16 @@ public class SysUnionController {
FROM
sys_union_cadre info
LEFT JOIN sys_role role ON role.`code` = info.roleCode
LEFT JOIN sys_dict jParent ON jParent.`code` = 'TEACHER_CONGRESS_J'
LEFT JOIN sys_dict jDict ON jDict.parentId = jParent.id AND jDict.`code` = info.j
LEFT JOIN (
SELECT j
FROM teacher_congress_session
WHERE enable = 1
ORDER BY startDate DESC
LIMIT 1
) curSession ON info.j IS NULL OR info.j = ''
LEFT JOIN sys_dict curJDict ON curJDict.parentId = jParent.id AND curJDict.`code` = curSession.j
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
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
@@ -303,6 +319,9 @@ public class SysUnionController {
case "roleName" -> cnd.where().andLike("role.`name`", pageForm.getSearchKeyword());
}
}
if (StrUtil.isNotBlank(j)) {
cnd.and("COALESCE(NULLIF(info.j, ''), curSession.j)", "=", j);
}
sql.setVar("constructionSql",
new Static(" group by info.id order by field(role.code," + branchUnionRoleCodes.stream().map(code -> "'" + code + "'").collect(Collectors.joining(",")) + ")")
);
@@ -311,11 +330,51 @@ public class SysUnionController {
return Result.success(list);
}
@At
@SaCheckPermission("sys.manager.union")
public Result branchUnionUserUsedJData(String unionId) {
List<Sys_dict> branchUnionRoles = sysDictService.getSubListByCode("BRANCH_UNION_ROLES");
if (Lang.isEmpty(branchUnionRoles)) {
return Result.success(List.of());
}
List<String> branchUnionRoleCodes = branchUnionRoles.stream().map(Sys_dict::getCode).toList();
Sql sql = Sqls.create("""
SELECT DISTINCT
COALESCE(NULLIF(info.j, ''), curSession.j) AS j,
COALESCE(jDict.location, curJDict.location, 0) AS jLocation
FROM
sys_union_cadre info
LEFT JOIN sys_role role ON role.`code` = info.roleCode
LEFT JOIN sys_dict jParent ON jParent.`code` = 'TEACHER_CONGRESS_J'
LEFT JOIN sys_dict jDict ON jDict.parentId = jParent.id AND jDict.`code` = info.j
LEFT JOIN (
SELECT j
FROM teacher_congress_session
WHERE enable = 1
ORDER BY startDate DESC
LIMIT 1
) curSession ON info.j IS NULL OR info.j = ''
LEFT JOIN sys_dict curJDict ON curJDict.parentId = jParent.id AND curJDict.`code` = curSession.j
$condition
ORDER BY jLocation DESC
""");
Cnd cnd = Cnd.where("role.`code`", "in", branchUnionRoleCodes);
cnd.and("info.unionId", "=", unionId);
sql.setCondition(cnd);
List<String> usedJCodes = sysUserService.listMap(sql).stream()
.map(item -> item.getString("j"))
.filter(StrUtil::isNotBlank)
.distinct()
.toList();
return Result.success(usedJCodes);
}
@At
@SaCheckPermission("sys.manager.union.branchOfficer")
@ApiOperation("添加分工会人员角色")
@Aop(TransAop.READ_COMMITTED)
public Result insertBranchUnionUserRole(String userId, String roleCode, String unionId) {
public Result insertBranchUnionUserRole(String userId, String roleCode, String unionId, String j) {
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
if (Lang.isEmpty(role)) {
return Result.success("无法找到" + roleCode + "对应编码的角色");
@@ -353,7 +412,9 @@ public class SysUnionController {
unionCadre.setLoginName(user.getLoginname());
unionCadre.setUserName(user.getUsername());
unionCadre.setRoleCode(roleCode);
unionCadre.setJ(j);
unionCadre.setApplyDate(new Date());
unionCadre.setIsServing(true);
unionCadre.setIsJoin(true);
dao.insert(unionCadre);
@@ -382,6 +443,39 @@ public class SysUnionController {
return Result.success();
}
@At
@ApiOperation("分工会干部离任")
@SaCheckPermission("sys.manager.union.branchOfficer")
@Aop(TransAop.READ_COMMITTED)
public Result leaveBranchUnionUserRole(String id, String leaveDate) {
if (StrUtil.isBlank(id)) {
return Result.error("请选择离任人员");
}
if (StrUtil.isBlank(leaveDate)) {
return Result.error("请选择离任时间");
}
Sys_union_cadre unionCadre = dao.fetch(Sys_union_cadre.class, id);
if (Lang.isEmpty(unionCadre)) {
return Result.error("未找到对应干部记录");
}
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", unionCadre.getRoleCode()));
if (Lang.isEmpty(role)) {
throw new BaseException("无法找到{}对应编码的角色", unionCadre.getRoleCode());
}
Date parsedLeaveDate = cn.hutool.core.date.DateUtil.parseDate(leaveDate);
dao.update(Sys_union_cadre.class,
Chain.make("isServing", false).add("leaveDate", parsedLeaveDate),
Cnd.where("id", "=", id));
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId())
.and("userId", "=", unionCadre.getUserId())
.and("unionId", "=", unionCadre.getUnionId()));
sysRoleService.clearCache();
sysUserService.clearCache();
return Result.success();
}
@At
@ApiOperation("删除分工会人员角色")
@SaCheckPermission("sys.manager.union.branchOfficer")
@@ -72,6 +72,7 @@ public class SysV4AppsController {
m.href,
m.icon,
m.picIcon,
m.location,
sm.`name` AS moduleName,
CASE
WHEN f.userId IS NOT NULL THEN
@@ -91,6 +92,7 @@ public class SysV4AppsController {
cnd.and("m.id","in", menus.stream().map(Sys_menu::getId).toArray());
cnd.andEX("m.moduleId", "=", categoryId);
cnd.asc("m.location");
cnd.asc("m.id");
if (StrUtil.isNotBlank(keyword)) {
cnd.where().andLike("m.name", keyword);
}
@@ -145,6 +147,7 @@ public class SysV4AppsController {
m.href,
m.icon,
m.picIcon,
m.location,
sm.`name` AS moduleName,
1 AS isFavorite
FROM
@@ -159,7 +162,8 @@ public class SysV4AppsController {
AND m.platform = @platform
AND m.disabled = 0
ORDER BY
m.location ASC;
m.location ASC,
m.id ASC;
""");
sql.setParam("userId", SecurityUtil.getUserId());
sql.setParam("platform", platform);
@@ -46,13 +46,14 @@ public class SysV4ServController {
@ApiOperation("获取应用列表")
public Result list(@Param("categoryId") String categoryId, @Param("letter") String letter, @Param("keyword") String keyword, HttpServletRequest req) {
Sql sql = Sqls.create("""
SELECT t.*,(select picIcon from wf_process_design where name = t.name) as picIcon
SELECT t.*, d.picIcon, d.sortNo
FROM wf_process_define t
INNER JOIN (
SELECT name, MAX(id) AS max_id
FROM wf_process_define
GROUP BY name
) sub ON t.name = sub.name AND t.id = sub.max_id
LEFT JOIN wf_process_design d ON d.name = t.name
$condition
""");
Cnd cnd = Cnd.NEW();
@@ -61,6 +62,8 @@ public class SysV4ServController {
}
cnd.andEX("t.category", "=", categoryId);
cnd.andEX("t.pinyinName", "=", letter);
cnd.asc("d.sortNo");
cnd.asc("t.id");
sql.setCondition(cnd);
List<NutMap> list = sysMenuService.listMap(sql);
return Result.success(list);
@@ -61,11 +61,26 @@ public class Sys_union_cadre extends BaseModel {
@ColDefine(type = ColType.VARCHAR, width = 100)
private String roleCode;
@Column
@Comment("届数")
@ColDefine(type = ColType.VARCHAR, width = 8)
private String j;
@Column
@Comment("添加时间")
@ColDefine(type = ColType.DATETIME)
private Date applyDate;
@Column
@Comment("离任时间")
@ColDefine(type = ColType.DATETIME)
private Date leaveDate;
@Column
@Comment("是否在任")
@ColDefine(type = ColType.BOOLEAN)
private Boolean isServing;
@Column
@Comment("加入还是退出")
@ColDefine(type = ColType.BOOLEAN)