Merge remote-tracking branch 'origin/main'

This commit is contained in:
2026-05-18 10:37:25 +08:00
40 changed files with 470 additions and 185 deletions
@@ -146,20 +146,22 @@ public class SysUnitController {
@At
@ApiOperation("按关键字查询单位下的人员")
@Ok("json:{ignoreNull:true}")
public Result listUserSelect(@Valid String unitId, @Valid String keyWord) {
Sql sql = Sqls.create("select id,loginname,username,unitname from vw_user $condition");
Cnd cnd = Cnd.NEW();
cnd.and(View_user::getUnitId, "=", unitId);
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike(View_user::getLoginname, keyWord, true);
seg.orLike(View_user::getUsername, keyWord, true);
cnd.and(seg);
cnd.limit(1, 10);
sql.setCondition(cnd);
sql.setCallback(Sqls.callback.entities());
sql.setEntity(sysUnitService.dao().getEntity(View_user.class));
sysUnitService.dao().execute(sql);
List<View_user> list = sql.getList(View_user.class);
public Result listUserSelect(@Valid String unitId, @Valid String keyWord, @Valid String roleCode) {
// Sql sql = Sqls.create("select id,loginname,username,unitname from vw_user $condition");
// Cnd cnd = Cnd.NEW();
// cnd.and(View_user::getUnitId, "=", unitId);
// SqlExpressionGroup seg = new SqlExpressionGroup();
// seg.orLike(View_user::getLoginname, keyWord, true);
// seg.orLike(View_user::getUsername, keyWord, true);
// cnd.and(seg);
// cnd.limit(1, 10);
// sql.setCondition(cnd);
// sql.setCallback(Sqls.callback.entities());
// sql.setEntity(sysUnitService.dao().getEntity(View_user.class));
// sysUnitService.dao().execute(sql);
// List<View_user> list = sql.getList(View_user.class);
// 人员范围判断放到 service 层,便于按单位干部角色复用同一套查询规则。
List<View_user> list = sysUnitService.listUserSelect(unitId, keyWord, roleCode);
return Result.success(list);
}
@@ -2,6 +2,9 @@ package com.budwk.app.sys.services;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.sys.models.Sys_unit;
import com.budwk.app.sys.views.View_user;
import java.util.List;
/**
* Created by wizzer on 2016/12/22.
@@ -22,6 +25,16 @@ public interface SysUnitService extends BaseService<Sys_unit> {
*/
void deleteAndChild(Sys_unit unit);
/**
* 按单位干部角色查询可选择人员。
*
* @param unitId 当前单位ID
* @param keyWord 人员工号或姓名关键字
* @param roleCode 当前选择的单位干部角色编码
* @return 可选择人员列表
*/
List<View_user> listUserSelect(String unitId, String keyWord, String roleCode);
/**
* 清空缓存
*/
@@ -1,21 +1,27 @@
package com.budwk.app.sys.services.impl;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.constant.RedisConstant;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.sys.models.Sys_unit;
import com.budwk.app.sys.services.SysUnitService;
import com.budwk.app.sys.views.View_user;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
import org.nutz.plugins.wkcache.annotation.CacheRemoveAll;
import java.util.List;
/**
* Created by wizzer on 2016/12/22.
*/
@@ -69,6 +75,71 @@ public class SysUnitServiceImpl extends BaseServiceImpl<Sys_unit> implements Sys
}
}
/**
* 按单位干部角色查询可选择人员。
* 选择单位党委书记时,人员范围放大到当前单位所属分工会下所有单位的人员;
* 选择单位分管校领导时,查询已关联单位分管校领导角色的人员;其他角色保持当前单位范围。
*
* @param unitId 当前单位ID
* @param keyWord 人员工号或姓名关键字
* @param roleCode 当前选择的单位干部角色编码
* @return 可选择人员列表
*/
@Override
public List<View_user> listUserSelect(String unitId, String keyWord, String roleCode) {
Sql sql;
Cnd cnd = Cnd.NEW();
if ("UNIT_SCHOOL_LEADER".equals(roleCode)) {
sql = Sqls.create("""
select distinct
u.id,
u.loginname,
u.username,
u.unitname
from vw_user u
inner join sys_user_role ur on ur.userId = u.id
inner join sys_role r on r.id = ur.roleId
$condition
""");
// 单位分管校领导从已绑定 UNIT_SCHOOL_LEADER 角色的人员中选择。
cnd.and("r.code", "=", "UNIT_SCHOOL_LEADER");
} else {
sql = Sqls.create("select id,loginname,username,unitname from vw_user $condition");
}
if (RoleConstant.UNIT_PARTY_SECRETARY.name().equals(roleCode)) {
Sys_unit unit = this.fetch(unitId);
if (unit != null && Strings.isNotBlank(unit.getUnionId())) {
SqlExpressionGroup scopeGroup = new SqlExpressionGroup();
// 单位党委书记可从当前单位所属分工会下选择人员,同时保留本单位人员兜底。
scopeGroup.or(View_user::getUnionId, "=", unit.getUnionId());
scopeGroup.or(View_user::getUnitId, "=", unitId);
cnd.and(scopeGroup);
} else {
// 当前单位未维护分工会时,至少保留本单位人员可选。
cnd.and(View_user::getUnitId, "=", unitId);
}
} else if ("UNIT_SCHOOL_LEADER".equals(roleCode)) {
// 角色范围已经通过 sys_user_role 与 sys_role 关联限定,这里不再叠加单位范围。
} else {
cnd.and(View_user::getUnitId, "=", unitId);
}
SqlExpressionGroup seg = new SqlExpressionGroup();
if ("UNIT_SCHOOL_LEADER".equals(roleCode)) {
seg.orLike("u.loginname", keyWord, true);
seg.orLike("u.username", keyWord, true);
} else {
seg.orLike(View_user::getLoginname, keyWord, true);
seg.orLike(View_user::getUsername, keyWord, true);
}
cnd.and(seg);
cnd.limit(1, 10);
sql.setCondition(cnd);
sql.setCallback(Sqls.callback.entities());
sql.setEntity(dao().getEntity(View_user.class));
dao().execute(sql);
return sql.getList(View_user.class);
}
@CacheRemoveAll
public void clearCache() {
@@ -135,7 +135,7 @@ public class CommonController {
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("unit.unionId", "=", unionId);
cnd.and("unit.unitTypeCode", "=", "1");
cnd.and("unit.unitLevel", "=", "2");
cnd.asc("unit.unitcode");
sql.setCondition(cnd);
List<NutMap> unitList = sysUserService.listMap(sql);
@@ -24,6 +24,8 @@ import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
import com.budwk.app.zhgh.activity.basic.param.ActivityUserScopePageParam;
import com.budwk.app.zhgh.activity.basic.service.ActivityBasicScopeService;
import com.budwk.app.zhgh.activity.basic.template.UserTemp;
import com.budwk.app.zhgh.club.model.SysClub;
import com.budwk.app.zhgh.club.service.SysClubService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ArrayUtils;
@@ -73,6 +75,9 @@ public class ActivityBasicScopeController {
@Inject
private ActivityBasicScopeService activityBasicScopeService;
@Inject
private SysClubService sysClubService;
@Inject
private Dao dao;
@@ -244,6 +249,8 @@ public class ActivityBasicScopeController {
return Result.success(new NutMap() {{
addv("is_A06", StpUtil.hasRole(RoleConstant.SCHOOL_UNION_ADMIN.name()));
addv("is_H04", StpUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()));
addv("is_H02", StpUtil.hasRole(RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name()));
addv("is_CLUB_PRESIDENT", StpUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name()));
addv("is_sysadmin", StpUtil.hasRole(RoleConstant.SYSADMIN.name()));
addv("unionid", SecurityUtil.getUnionId());
}});
@@ -377,7 +384,23 @@ public class ActivityBasicScopeController {
try {
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())){
cnd.andEX("u.unionid", "=", SecurityUtil.getUnionId());
boolean isBranchUnionChairman = AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name());
boolean isClubPresident = AuthUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name());
List<String> manageClubIdList = sysClubService.getMyManageClub().stream().map(SysClub::getId).toList();
if (isBranchUnionChairman && isClubPresident) {
// Users with both roles can search their union users and their managed club members.
SqlExpressionGroup scopeGroup = new SqlExpressionGroup();
scopeGroup.or("u.unionid", "=", SecurityUtil.getUnionId());
if (Lang.isNotEmpty(manageClubIdList)) {
scopeGroup.or("clubuser.clubid", "in", manageClubIdList);
}
cnd.and(scopeGroup);
} else if (isClubPresident) {
// Club presidents can only search members from clubs they manage.
cnd.and("clubuser.clubid", "in", Lang.isNotEmpty(manageClubIdList) ? manageClubIdList : List.of("__EMPTY_CLUB_ID__"));
} else {
cnd.andEX("u.unionid", "=", SecurityUtil.getUnionId());
}
}
cnd.andEX("u.unionid", EQ_OR_NEQ_OP, activityUserScopePageParam.getUnionId());
cnd.andEX("u.unitid", EQ_OR_NEQ_OP, activityUserScopePageParam.getUnitId());
@@ -141,7 +141,8 @@ public class ActivityCultureApplyActivityController {
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
args.set(FlowConst.FORM_DATA, tissue);
args.set("activity_type", tissue.getActivity_type());
ProcessInstance instance = flowEngine.startProcessInstanceByKey(tissue.getActivity_type().equals(40002) ? "FGHWHHD" : "XHWHHD", tissue.getId(), SecurityUtil.getUserId(), args);
// ProcessInstance instance = flowEngine.startProcessInstanceByKey(tissue.getActivity_type().equals(40002) ? "FGHWHHD" : "XHWHHD", tissue.getId(), SecurityUtil.getUserId(), args);
ProcessInstance instance = flowEngine.startProcessInstanceByKey("WHHD", tissue.getId(), SecurityUtil.getUserId(), args);
// 自动完成第一个申请任务
List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null);
@@ -82,4 +82,11 @@ public class ClubCommonController {
return Result.success(list);
}
@At
@SaCheckLogin
public Result listManageClubByRole() {
// Activity user scope uses manageable clubs, not all clubs the user has joined.
return Result.success(sysClubService.getMyManageClub());
}
}
@@ -282,7 +282,8 @@ public class ClubInfoManageController {
}
Sys_role sysRole = sysRoleService.getByCode(roleCode);
for (String user : users) {
if (AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name()) || !Objects.equals(RoleConstant.CLUB_MEMBER.name(), roleCode)) {
// 校工会主席可按校级管理角色录入协会会员并同步用户角色。
if (AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name(), RoleConstant.SCHOOL_UNION_CHAIRMAN.name()) || !Objects.equals(RoleConstant.CLUB_MEMBER.name(), roleCode)) {
Sys_user_role sysUserRole = new Sys_user_role();
sysUserRole.setUserId(user);
sysUserRole.setRoleId(sysRole.getId());
@@ -118,8 +118,10 @@ public class ClubRefreshReportController {
public Object submit(@Param("data") SysClubRefresh clubRefresh) {
Cnd cnd = Cnd.NEW();
cnd.and("userId", "=", SecurityUtil.getUserId());
// cnd.and("userId", "=", SecurityUtil.getUserId());
// cnd.and("clubId", "=", clubRefresh.getClubId());
// 只校验当前协会的未完成换届报告申请,避免其他协会记录误拦截。
cnd.and(SysClubRefresh::getClubId, "=", clubRefresh.getClubId());
if(StrUtil.isNotBlank(clubRefresh.getId())) {
cnd.and(SysClubRefresh::getId, "!=", clubRefresh.getId());
}
@@ -119,6 +119,8 @@ public class ClubRuleUpdateController {
public Object submit(@Param("data")SysClubRule clubRule) {
Cnd cnd = Cnd.NEW();
// 只校验当前协会的未完成章程备案申请,避免其他协会记录误拦截。
cnd.and(SysClubRule::getClubId, "=", clubRule.getClubId());
if(StrUtil.isNotBlank(clubRule.getId())) {
cnd.and(SysClubRule::getId, "!=", clubRule.getId());
}
@@ -291,8 +291,20 @@ public class ClubStatisticsController {
response.setHeader("Content-Disposition", "attachment;filename=" + URLUtil.encode("上传资料数据.zip"));
LinkedHashMap<String, List<JSONObject>> fileList = new LinkedHashMap<>();
//查询社团
List<SysClub> clubList = sysClubService.query(Cnd.NEW().andEX("id", "=", clubId));
// 导出上传资料时只取未删除且注册流程已完成的协会,避免历史删除协会资料被打包。
Cnd clubCnd = Cnd.NEW();
clubCnd.andEX("id", "=", clubId);
clubCnd.and("dismiss", "=", false);
List<SysClub> clubList = sysClubService.query(clubCnd);
if (!clubList.isEmpty()) {
List<ProcessInstance> instanceList = sysClubService.dao().query(
ProcessInstance.class,
Cnd.where(ProcessInstance::getBusinessNo, "in", clubList.stream().map(SysClub::getId).toList())
.and(ProcessInstance::getState, "=", ProcessInstanceStateEnum.FINISHED.getCode())
);
List<String> passList = instanceList.stream().map(ProcessInstance::getBusinessNo).toList();
clubList = clubList.stream().filter(o -> passList.contains(o.getId())).toList();
}
clubList.forEach(item -> {
List<JSONObject> file = new ArrayList<>();
file.addAll(Optional.ofNullable(item.getFiles()).orElseGet(ArrayList::new));
@@ -301,7 +313,6 @@ public class ClubStatisticsController {
file.addAll(Optional.ofNullable(item.getManageFile()).orElseGet(ArrayList::new));
file.addAll(Optional.ofNullable(item.getYearPlanFile()).orElseGet(ArrayList::new));
file.addAll(Optional.ofNullable(item.getReplaceReport()).orElseGet(ArrayList::new));
file.addAll(Optional.ofNullable(item.getRulesFile()).orElseGet(ArrayList::new));
fileList.put(item.getId(), file);
});
@@ -113,7 +113,8 @@ public class SysClubInfoManageServiceImpl extends BaseServiceImpl<ClubCommonPage
cnd.andEX("year(c.createTime)", "=", pageForm.getYear());
cnd.and("c.dismiss", "=", false);
cnd.and("ins.state", "=", ProcessInstanceStateEnum.FINISHED.getCode());
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name())) {
// 校工会主席在协会管理界面按校级管理角色查看全部协会。
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name(), RoleConstant.SCHOOL_UNION_CHAIRMAN.name())) {
List<String> roleList = commonService.findUserRoleByRoleCode(List.of(RoleConstant.CLUB_PRESIDENT.name(), RoleConstant.CLUB_VICE_PRESIDENT.name(), RoleConstant.CLUB_SECRETARY.name(), RoleConstant.CLUB_VICE_SECRETARY.name(), RoleConstant.CLUB_OPERATOR.name()));
List<Sys_user_role> clubList = dao().query(Sys_user_role.class, Cnd.where("roleId", "in", roleList).and("userId", "=", SecurityUtil.getUserId()).and("clubId", "is not", null));
List<String> clubIdList = clubList.stream().map(Sys_user_role::getClubId).toList();
@@ -114,7 +114,8 @@ public class SysClubServiceImpl extends BaseServiceImpl<SysClub> implements SysC
Cnd cnd = Cnd.where("dismiss", "=", false);
cnd.asc("createTime");
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name())) {
// 校工会主席在协会管理界面按校级管理角色查看全部协会。
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name(), RoleConstant.SCHOOL_UNION_CHAIRMAN.name())) {
List<String> roleList = commonService.findUserRoleByRoleCode(List.of(RoleConstant.CLUB_PRESIDENT.name(), RoleConstant.CLUB_VICE_PRESIDENT.name(), RoleConstant.CLUB_SECRETARY.name(), RoleConstant.CLUB_VICE_SECRETARY.name(),RoleConstant.CLUB_OPERATOR.name()));
List<Sys_user_role> clubList = dao().query(Sys_user_role.class, Cnd.where("roleId", "in", roleList).and("userId", "=", SecurityUtil.getUserId()).and("clubId", "is not", null));
List<String> clubIdList = clubList.stream().map(Sys_user_role::getClubId).toList();
@@ -245,6 +246,7 @@ public class SysClubServiceImpl extends BaseServiceImpl<SysClub> implements SysC
cnd.andEX("year(info.createTime)", "=", pageForm.getYear());
cnd.and("info.userId", "=", SecurityUtil.getUserId());
cnd.desc("createTime");
// cnd.groupBy("info.id");
sql.setCondition(cnd);
return listPageVO(pageForm, sql, ClubRegisterPageVo.class);
}
@@ -8,6 +8,7 @@ import com.budwk.app.sys.models.Sys_dict;
import com.budwk.app.sys.services.SysDictService;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -35,6 +36,9 @@ public class ProposalQueryDelegationController {
@Inject
private SysDictService sysDictService;
@Inject
private ProposalCommonService proposalCommonService;
@At("")
@Ok("beetl:/platform/zhgh/democratic/proposal/query/delegation/index.html")
@@ -66,6 +70,7 @@ public class ProposalQueryDelegationController {
Cnd cnd = Cnd.NEW();
cnd.andEX("dbt.sessionId", "=", sessionId);
if (!AuthUtil.hasRoleOr("SYSADMIN", "SCHOOL_UNION_ADMIN")) {
cnd.and("dbt.id", "in", proposalCommonService.getSelfManageDelegationIds());
}
cnd.asc("dbt.`code`");
sql.setCondition(cnd);
@@ -101,6 +106,9 @@ public class ProposalQueryDelegationController {
$condition
""");
Cnd cnd = Cnd.NEW();
if (!AuthUtil.hasRoleOr("SYSADMIN", "SCHOOL_UNION_ADMIN")) {
cnd.and("info.delegationId", "in", proposalCommonService.getSelfManageDelegationIds());
}
ProposalSearchParam.buildSearch(cnd, pageForm);
cnd.groupBy("info.id");
sql.setCondition(cnd);
@@ -71,7 +71,10 @@ public class ProposalWriteController {
@ApiOperation("保存提案")
@SLog(tag = "提案管理系统-我的提案", msg = "保存提案")
public Result save(@Param("info") ProposalInfo proposalInfo) {
if (StrUtil.isBlank(proposalInfo.getCode())) {
// 保存草稿允许表单未填完整,只有具备生成编号所需信息时才生成提案编号。
if (StrUtil.isBlank(proposalInfo.getCode())
&& StrUtil.isNotBlank(proposalInfo.getSessionId())
&& StrUtil.isNotBlank(proposalInfo.getDelegationId())) {
proposalInfo.setCode(proposalWriteService.generateProposalCode(proposalInfo.getSessionId(), proposalInfo.getDelegationId()));
}
dao.insertOrUpdate(proposalInfo);
@@ -76,7 +76,7 @@ public class ProposalQueryComprehensiveParam extends PageForm {
//教代会届次
if (Lang.isNotEmpty(searchParam.getSessionIds())) {
cnd.and("info.sessionId", "in", searchParam.getSessionIds());
} else {
} else if (StrUtil.isNotBlank(searchParam.getSessionId())) {
cnd.andEX("info.sessionId", "=", searchParam.getSessionId());
}
@@ -296,9 +296,6 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> imp
info.put(FlowUtil.variableToDict(feedbackTask.getVariable()).getStr("tf_feedback"), "√");
info.put("tf_feedback", FlowUtil.variableToDict(feedbackTask.getVariable()).getStr("tf_feedback"));
info.put("tf_opinion", FlowUtil.variableToDict(feedbackTask.getVariable()).getStr("tf_opinion"));
info.put("tf_phone", FlowUtil.variableToDict(feedbackTask.getVariable()).getStr("tf_phone"));
info.put("tf_address", FlowUtil.variableToDict(feedbackTask.getVariable()).getStr("tf_address"));
info.put("tf_postcode", FlowUtil.variableToDict(feedbackTask.getVariable()).getStr("tf_postcode"));
}
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
@@ -165,7 +165,6 @@ public class ProposalExportServiceImpl extends BaseServiceImpl<ProposalInfo> imp
info.id,
info.name,
info.code,
info.researchFindings,
info.brief,
info.measures,
info.createUserName,
@@ -221,7 +220,6 @@ public class ProposalExportServiceImpl extends BaseServiceImpl<ProposalInfo> imp
exportEntities.add(new ExcelExportEntity("提案编号", "code", 20));
exportEntities.add(new ExcelExportEntity("提案名称", "name", 20));
exportEntities.add(new ExcelExportEntity("提案案由", "brief", 40));
exportEntities.add(new ExcelExportEntity("代表调研情况", "researchFindings", 40));
exportEntities.add(new ExcelExportEntity("代表建议措施", "measures", 40));
exportEntities.add(new ExcelExportEntity("提案人", "createUserName", 20));
exportEntities.add(new ExcelExportEntity("提案人电话", "mobile", 20));
@@ -397,7 +395,6 @@ public class ProposalExportServiceImpl extends BaseServiceImpl<ProposalInfo> imp
info.code,
DATE_FORMAT(info.createTime, '%Y年%m月%d日') AS createTime,
info.suggestUnits,
info.researchFindings,
info.brief,
info.measures,
info.createUserName,
@@ -540,7 +537,6 @@ public class ProposalExportServiceImpl extends BaseServiceImpl<ProposalInfo> imp
info.id,
info.name,
info.code,
info.researchFindings,
info.brief,
info.measures,
info.createUserName,
@@ -207,17 +207,29 @@ public class TeacherCongressDelegateManageController {
`sys_user` t1
LEFT JOIN sys_unit t2 ON t2.id = t1.unitId
WHERE
t1.id NOT IN ( SELECT userId FROM teacher_congress_delegate WHERE sessionId = @sessionId AND delegationId = @delegationId )
-- 原逻辑只排除当前代表团已有人员:t1.id NOT IN ( SELECT userId FROM teacher_congress_delegate WHERE sessionId = @sessionId AND delegationId = @delegationId )
t1.id NOT IN ( SELECT userId FROM teacher_congress_delegate WHERE sessionId = @sessionId )
AND
t1.unitId in (@unitIds)
AND
(t1.loginname like @keyWord or username like @keyWord)
""");
sql.setParam("sessionId", param.getSessionId());
sql.setParam("delegationId", param.getDelegationId());
sql.setParam("unitIds", unitIds);
sql.setParam("keyWord", "%" + param.getKeyWord() + "%");
Pagination pagination = sysUserService.listPageMap(1, 50, sql);
if (ObjectUtil.isEmpty(pagination.getList())) {
// 可选人员为空时,额外检查当前关键字是否命中了已存在代表,给出重复新增提示。
List<Teacher_congress_delegate> repeatDelegates = dao.query(Teacher_congress_delegate.class,
Cnd.where(Teacher_congress_delegate::getSessionId, "=", param.getSessionId())
.and(Cnd.exps(Teacher_congress_delegate::getLoginName, "like", "%" + param.getKeyWord() + "%")
.or(Teacher_congress_delegate::getUserName, "like", "%" + param.getKeyWord() + "%"))
.limit(1, 1));
if (ObjectUtil.isNotEmpty(repeatDelegates)) {
Teacher_congress_delegate repeatDelegate = repeatDelegates.get(0);
return Result.error("工号" + repeatDelegate.getLoginName() + " " + repeatDelegate.getUserName() + "已是当前届次代表,不能重复新增");
}
}
return Result.success(pagination.getList());
}
@@ -21,6 +21,8 @@ import com.budwk.app.flow.service.FlowCommonService;
import com.budwk.app.sys.models.Sys_role;
import com.budwk.app.sys.models.Sys_user;
import com.budwk.app.sys.models.Sys_user_role;
import com.budwk.app.sys.services.SysRoleService;
import com.budwk.app.sys.services.SysUserService;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.TeacherCongressDelegatePush;
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
@@ -66,6 +68,10 @@ public class TeacherCongressDelegatePushZgAuditController {
@Inject
private FlowCommonService flowCommonService;
@Inject
private SysUserService sysUserService;
@Inject
private SysRoleService sysRoleService;
@At("")
@Ok("beetl:/platform/zhgh/democratic/teachercongress/delegate/push/zcAudit.html")
@@ -255,6 +261,8 @@ public class TeacherCongressDelegatePushZgAuditController {
userRole.setTcSessionId(delegatePush.getSessionId());
baseService.dao().insert(delegate);
// baseService.dao().insert(userRole);
// 资格审查通过进入代表库后,同步设置教代会代表角色,保证用户立即拥有正式/列席代表权限。
insertDelegateUserRole(userRole);
// 去改改用户表的手机号
baseService.dao().update(
@@ -337,6 +345,8 @@ public class TeacherCongressDelegatePushZgAuditController {
userRole.setTcSessionId(delegatePush.getSessionId());
baseService.dao().insert(delegate);
// 资格审查批量通过进入代表库后,同步设置教代会代表角色,保证用户立即拥有正式/列席代表权限。
insertDelegateUserRole(userRole);
// 去改改用户表的手机号
baseService.dao().update(
@@ -358,4 +368,19 @@ public class TeacherCongressDelegatePushZgAuditController {
return Result.success();
}
/**
* 同步代表角色关系。
* 资格审查通过后代表库会新增记录,这里补充 sys_user_role,避免用户已是代表但没有代表角色。
*
* @param userRole 待写入的代表角色关系,必须包含 userId、roleId、tcSessionId
*/
private void insertDelegateUserRole(Sys_user_role userRole) {
baseService.dao().clear(Sys_user_role.class, Cnd.where(Sys_user_role::getUserId, "=", userRole.getUserId())
.and(Sys_user_role::getRoleId, "=", userRole.getRoleId())
.and(Sys_user_role::getTcSessionId, "=", userRole.getTcSessionId()));
baseService.dao().insert(userRole);
sysUserService.clearCache();
sysRoleService.clearCache();
}
}
@@ -190,8 +190,8 @@ public class TeacherCongressDelegateTransitionController {
// 当前代表团
Teacher_congress_delegation delegation = dao.fetch(Teacher_congress_delegation.class, delegationId);
// 当前届次代表团代表
List<Teacher_congress_delegate> delegates = dao.query(Teacher_congress_delegate.class, Cnd.where(Teacher_congress_delegate::getSessionId, "=", sessionId).and(Teacher_congress_delegate::getDelegationId, "=", delegation.getId()));
// 当前届次全部代表。转出人员本届已不在当前代表团,必须用全部代表与上一届代表做对比。
List<Teacher_congress_delegate> delegates = dao.query(Teacher_congress_delegate.class, Cnd.where(Teacher_congress_delegate::getSessionId, "=", sessionId));
dao.fetchLinks(delegates, "delegation");
// 上一届次代表
@@ -240,8 +240,8 @@ public class TeacherCongressDelegateTransitionController {
// 减少代表数据 (上一届次是代表 本届次不是代表)
List<NutMap> reduceUser = delegateFull.stream().filter(delegate -> delegate.getString("lastDelegationCode").equals(delegation.getCode()) && StrUtil.isBlank(delegate.getString("delegationCode"))).toList();
// 当前代表人数
int currentCount = delegates.size();
// 当前代表人数只统计本届仍在当前代表团的人员。
long currentCount = delegateFull.stream().filter(delegate -> delegate.getString("delegationCode").equals(delegation.getCode())).count();
HashMap<String, Object> map = new HashMap<>();
map.put("addUser", addUser);
@@ -14,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.Static;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
@@ -50,8 +51,6 @@ public class HuiminMineController {
t1.*
FROM
huimin t1
LEFT JOIN activity_user_scope aus ON t1.groupId = aus.groupId
AND aus.userId = @userId
$condition
""");
Cnd cnd = Cnd.NEW();
@@ -62,8 +61,8 @@ public class HuiminMineController {
// 添加启用状态过滤(只显示启用的记录)
cnd.and("t1.enable", "=", true);
// 添加权限过滤
cnd.and(Cnd.exps("t1.groupId", "is", null).or("aus.groupId", "is not", null));
sql.params().set("userId", SecurityUtil.getUserId());
cnd.and(Cnd.exps("t1.groupId", "is", null)
.or(new Static("EXISTS (SELECT 1 FROM activity_user_scope aus WHERE aus.groupId = t1.groupId AND aus.userId = '%s')".formatted(SecurityUtil.getUserId()))));
sql.setCondition(cnd);
Pagination pagination = huiminService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);