diff --git a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeConfigController.java b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeConfigController.java index 28d9ae75..b53dbf70 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeConfigController.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeConfigController.java @@ -60,6 +60,7 @@ public class ExecutiveCommitteeConfigController { dbt.name as delegationName, dbt.code as delegationCode, (SELECT count( 1 ) FROM vw_user where unitId IN ( SELECT unitId FROM teacher_congress_delegation_unit unit WHERE unit.delegationId = dbt.id ) and member = 1) as memberCount, + (SELECT count( 1 ) FROM teacher_congress_delegate where unitId IN ( SELECT unitId FROM teacher_congress_delegation_unit unit WHERE unit.delegationId = dbt.id ) and sessionId=@sessionId) as dbCount, 0 as quotaCount FROM teacher_congress_delegation dbt diff --git a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeDelegationOnePushController.java b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeDelegationOnePushController.java index 3f05bf84..9d67f241 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeDelegationOnePushController.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeDelegationOnePushController.java @@ -1,11 +1,14 @@ package com.budwk.app.zhgh.democratic.executiveCommittee.controller; import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.lang.Validator; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.extra.pinyin.PinyinUtil; import com.budwk.app.base.annotation.SLog; +import com.budwk.app.base.constant.RoleConstant; import com.budwk.app.base.param.PageForm; import com.budwk.app.base.result.Result; import com.budwk.app.base.service.BaseService; @@ -20,9 +23,10 @@ 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.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; -import org.nutz.lang.Strings; +import org.nutz.lang.Lang; import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; @@ -62,13 +66,9 @@ public class ExecutiveCommitteeDelegationOnePushController { @SaCheckPermission("executiveCommittee.delegationOnePush") public Result pageData(PageForm pageForm, String teacherMeetId, + String delegationId, String unionId) { - Teacher_congress_delegate db = dao.fetch(Teacher_congress_delegate.class, - Cnd.where(Teacher_congress_delegate::getSessionId, "=", teacherMeetId) - .and(Teacher_congress_delegate::getUserId, "=", SecurityUtil.getUserId())); - if (ObjectUtil.isEmpty(db)) { - return Result.error("没有权限,只有代表团团长才能推选"); - } + Sql sql = Sqls.create(""" SELECT t1.*, @@ -78,21 +78,38 @@ public class ExecutiveCommitteeDelegationOnePushController { TIMESTAMPDIFF( YEAR, t4.birthday, - CURDATE()) AS age + CURDATE()) AS age, + t5.name AS delegationName FROM `executive_committee_one_push` t1 LEFT JOIN sys_unit t2 ON t1.unitId = t2.id LEFT JOIN `sys_union` t3 ON t3.id = t2.unionid LEFT JOIN `vw_user` t4 ON t4.id = t1.userId + LEFT JOIN teacher_congress_delegation t5 ON t5.id = t1.delegationId $condition """); Cnd cnd = Cnd.NEW(); cnd.andEX("t1.teacherMeetId", "=", teacherMeetId); - cnd.andEX("t1.delegationId", "=", db.getDelegationId()); + if (StpUtil.hasRole(RoleConstant.SYSADMIN.name()) || + StpUtil.hasRole(RoleConstant.SCHOOL_UNION_ADMIN.name())) { + cnd.andEX("t1.delegationId", "=", delegationId); + }else{ + Teacher_congress_delegate db = dao.fetch(Teacher_congress_delegate.class, + Cnd.where(Teacher_congress_delegate::getSessionId, "=", teacherMeetId) + .and(Teacher_congress_delegate::getUserId, "=", SecurityUtil.getUserId())); + if (ObjectUtil.isEmpty(db)) { + return Result.error("没有权限,只有代表团团长才能推选"); + } + cnd.andEX("t1.delegationId", "=", db.getDelegationId()); + } + cnd.andEX("t3.id", "=", unionId); cnd.andEX("t1.addType", "=", 1); - if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) { - cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%"); + if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { + SqlExpressionGroup group = new SqlExpressionGroup(); + group.orLike("t1.userName", pageForm.getSearchKeyword()); + group.orLike("t1.loginName", pageForm.getSearchKeyword()); + cnd.and(group); } cnd.asc("t1.firstLetter"); sql.setCondition(cnd); @@ -135,6 +152,8 @@ public class ExecutiveCommitteeDelegationOnePushController { Sql sql = Sqls.create(""" SELECT db.*, + u.professionalTitle, + u.professionalLevel, TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age FROM teacher_congress_delegate db @@ -143,7 +162,14 @@ public class ExecutiveCommitteeDelegationOnePushController { """); sql.setCondition(cnd); List userData = baseService.listMap(sql); - return Result.success(Map.of("userData", userData, "userValue", userValue)); + + + List delegationQuotaList = config.getDelegationQuotaList(); + NutMap delegationQuota = delegationQuotaList.stream().filter(v -> v.get("delegationId").equals(db.getDelegationId())).findFirst().orElse(null); + if (Lang.isNotEmpty(delegationQuota)) { + return Result.success(Map.of("userData", userData, "userValue", userValue, "quotaCount", delegationQuota.getInt("quotaCount"))); + } + return Result.success(Map.of("userData", userData, "userValue", userValue, "quotaCount", 0)); } @At @@ -182,7 +208,7 @@ public class ExecutiveCommitteeDelegationOnePushController { .and("teacherMeetId", "=", teacherMeetId) .and("addType", "=", 1)); if (dbCount + userValue.length > delegationQuota.getInt("quotaCount")) { - return Result.error("代表团人数限报" + delegationQuota.getInt("quotaCount") + "人"); + return Result.error("推选人数限制" + delegationQuota.getInt("quotaCount") + "人"); } Sql sql = Sqls.create(""" SELECT diff --git a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeDelegationTwoPushController.java b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeDelegationTwoPushController.java index 7ca468e3..712a5ce1 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeDelegationTwoPushController.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeDelegationTwoPushController.java @@ -3,6 +3,7 @@ package com.budwk.app.zhgh.democratic.executiveCommittee.controller; import cn.dev33.satoken.annotation.SaCheckPermission; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.budwk.app.base.annotation.SLog; import com.budwk.app.base.param.PageForm; import com.budwk.app.base.result.Result; @@ -16,9 +17,9 @@ 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.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; -import org.nutz.lang.Strings; import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; @@ -87,8 +88,11 @@ public class ExecutiveCommitteeDelegationTwoPushController { cnd.andEX("t1.teacherMeetId", "=", teacherMeetId); cnd.andEX("t2.delegationId", "=", delegationId); cnd.andEX("t4.id", "=", unionId); - if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) { - cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%"); + if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { + SqlExpressionGroup group = new SqlExpressionGroup(); + group.orLike("t2.userName", pageForm.getSearchKeyword()); + group.orLike("t2.loginName", pageForm.getSearchKeyword()); + cnd.and(group); } cnd.asc("t6.code").asc("t2.firstLetter"); sql.setCondition(cnd); @@ -129,6 +133,8 @@ public class ExecutiveCommitteeDelegationTwoPushController { SELECT t1.*, t2.sex, + t2.professionalTitle, + t2.professionalLevel, TIMESTAMPDIFF( YEAR, t2.birthday, @@ -140,7 +146,7 @@ public class ExecutiveCommitteeDelegationTwoPushController { """); sql.setCondition(cnd); List userData = baseService.listMap(sql); - return Result.success(Map.of("userData", userData, "userValue", userValue)); + return Result.success(Map.of("userData", userData, "userValue", userValue,"delegationQuotaCount",config.getDelegationQuotaCount())); } @At @@ -172,7 +178,7 @@ public class ExecutiveCommitteeDelegationTwoPushController { Cnd.where("pushUserId", "=", SecurityUtil.getUserId()) .and("teacherMeetId", "=", teacherMeetId)); if (dbCount + userValue.length > config.getCommitteeQuotaCount()) { - return Result.error("人数限报" + config.getCommitteeQuotaCount() + "人"); + return Result.error("推选人数限制" + config.getCommitteeQuotaCount() + "人"); } List dbList = dao.query(Teacher_congress_delegate.class, diff --git a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteePushController.java b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteePushController.java index 3af23dbf..9ced36ae 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteePushController.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteePushController.java @@ -4,6 +4,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission; import cn.hutool.core.date.DateUtil; import cn.hutool.core.lang.Validator; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.extra.pinyin.PinyinUtil; import com.budwk.app.base.annotation.SLog; import com.budwk.app.base.param.PageForm; @@ -19,9 +20,9 @@ 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.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; -import org.nutz.lang.Strings; import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; @@ -87,8 +88,11 @@ public class ExecutiveCommitteePushController { cnd.andEX("t1.delegationId", "=", delegationId); cnd.andEX("t3.id", "=", unionId); cnd.andEX("t1.addType", "=", 2); - if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) { - cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%"); + if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { + SqlExpressionGroup group = new SqlExpressionGroup(); + group.orLike("t1.userName", pageForm.getSearchKeyword()); + group.orLike("t1.loginName", pageForm.getSearchKeyword()); + cnd.and(group); } cnd.asc("t5.code").asc("t1.firstLetter"); sql.setCondition(cnd); @@ -105,7 +109,8 @@ public class ExecutiveCommitteePushController { .and("addType", "=", 2)); List onePushList = dao.query(ExecutiveCommitteeOnePush.class, Cnd.NEW()); List userIds = onePushList.stream().map(ExecutiveCommitteeOnePush::getUserId).collect(Collectors.toList()); - + ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class, + Cnd.where("teacherMeetId", "=", teacherMeetId)); Cnd cnd = Cnd.NEW(); cnd.andEX("db.sessionId", "=", teacherMeetId); cnd.andEX("db.userId", "not in", userIds); @@ -113,6 +118,8 @@ public class ExecutiveCommitteePushController { Sql sql = Sqls.create(""" SELECT db.*, + u.professionalTitle, + u.professionalLevel, TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age FROM teacher_congress_delegate db @@ -121,7 +128,7 @@ public class ExecutiveCommitteePushController { """); sql.setCondition(cnd); List userData = baseService.listMap(sql); - return Result.success(Map.of("userData", userData, "userValue", userValue)); + return Result.success(Map.of("userData", userData, "userValue", userValue,"prepareGroupQuotaCount",config.getPrepareGroupQuotaCount())); } @At @@ -147,7 +154,7 @@ public class ExecutiveCommitteePushController { Cnd.where("teacherMeetId", "=", teacherMeetId) .and("addType", "=", 2)); if (dbCount + userValue.length > config.getPrepareGroupQuotaCount()) { - return Result.error("人数限报" + config.getPrepareGroupQuotaCount() + "人"); + return Result.error("推选人数限制" + config.getPrepareGroupQuotaCount() + "人"); } Sql sql = Sqls.create(""" diff --git a/src/main/java/com/budwk/app/zhgh/democratic/teachercongress/delegate/controller/TeacherCongressDelegatePushController.java b/src/main/java/com/budwk/app/zhgh/democratic/teachercongress/delegate/controller/TeacherCongressDelegatePushController.java index 33fd8820..bd12cd7b 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/teachercongress/delegate/controller/TeacherCongressDelegatePushController.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/teachercongress/delegate/controller/TeacherCongressDelegatePushController.java @@ -6,6 +6,7 @@ import cn.hutool.core.lang.Dict; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.budwk.app.base.annotation.SLog; +import com.budwk.app.base.constant.RoleConstant; import com.budwk.app.base.page.Pagination; import com.budwk.app.base.param.PageForm; import com.budwk.app.base.result.Result; @@ -17,6 +18,7 @@ import com.budwk.app.flow.entity.ProcessTask; import com.budwk.app.flow.enums.ProcessSubmitTypeEnum; import com.budwk.app.flow.enums.ProcessTaskStateEnum; import com.budwk.app.sys.views.View_user; +import com.budwk.app.web.commons.auth.utils.AuthUtil; import com.budwk.app.web.commons.auth.utils.SecurityUtil; import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.TeacherCongressDelegatePush; import com.budwk.app.zhgh.democratic.teachercongress.delegate.service.TeacherCongressDelegatePushService; @@ -79,6 +81,7 @@ public class TeacherCongressDelegatePushController { @SaCheckPermission("tc.delegate.push") public Result pageData(PageForm pageForm, @Param(value = "sessionId") String sessionId, + @Param(value = "unionId") String unionId, @Param(value = "isFormalOrAttendance") String isFormalOrAttendance) { Sql sql = Sqls.create(""" SELECT @@ -108,6 +111,7 @@ public class TeacherCongressDelegatePushController { """); Cnd cnd = Cnd.NEW(); cnd.andEX("info.sessionId", "=", sessionId); + cnd.andEX("info.unionId", "=", unionId); if (!"全部".equals(isFormalOrAttendance)) { cnd.and("info.representativeType", "=", isFormalOrAttendance); @@ -119,7 +123,9 @@ public class TeacherCongressDelegatePushController { cnd.and(group); } cnd.desc("info.createdAt"); - cnd.and("info.createdBy", "=", SecurityUtil.getUserId()); + if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) { + cnd.and("info.createdBy", "=", SecurityUtil.getUserId()); + } sql.setCondition(cnd); Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); return Result.success(pagination); diff --git a/src/main/java/com/budwk/app/zhgh/democratic/teachercongress/delegate/controller/TeacherCongressDelegatePushWriteController.java b/src/main/java/com/budwk/app/zhgh/democratic/teachercongress/delegate/controller/TeacherCongressDelegatePushWriteController.java index 2628b390..f0217d78 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/teachercongress/delegate/controller/TeacherCongressDelegatePushWriteController.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/teachercongress/delegate/controller/TeacherCongressDelegatePushWriteController.java @@ -1,5 +1,6 @@ package com.budwk.app.zhgh.democratic.teachercongress.delegate.controller; +import cn.dev33.satoken.annotation.SaCheckLogin; import cn.dev33.satoken.annotation.SaCheckPermission; import cn.hutool.core.lang.Dict; import cn.hutool.core.util.ObjectUtil; @@ -56,7 +57,7 @@ public class TeacherCongressDelegatePushWriteController { @At @ApiOperation("代表信息初始信息") - @SaCheckPermission("tc.delegate.push.write") + @SaCheckLogin public Result info(String sessionId, String userId) { userId = StrUtil.blankToDefault(userId, SecurityUtil.getUserId()); Sql sql = Sqls.create(""" diff --git a/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/delegationOnePush/index.html b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/delegationOnePush/index.html index 4925da5c..6cf41562 100644 --- a/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/delegationOnePush/index.html +++ b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/delegationOnePush/index.html @@ -7,17 +7,8 @@ layout("/layouts/platform.html"){