From d5e0c09b2b7f6bc4042ecc92dc576ecf0ac9726b Mon Sep 17 00:00:00 2001
From: = <=>
Date: Fri, 20 Mar 2026 17:05:26 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E5=A6=87=E4=BB=A3=E4=BC=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../budwk/app/base/constant/RoleConstant.java | 5 +
.../budwk/app/sys/models/Sys_user_role.java | 10 +
.../WomanCongressDelegateController.java | 298 ++++++++++++++++
.../WomanCongressDelegateReadController.java | 61 ++++
.../WomanCongressDelegationController.java | 337 ++++++++++++++++++
.../WomanCongressSessionController.java | 104 ++++++
.../common/WomanCongressCommonController.java | 69 ++++
.../WomanCongressDelegateListener.java | 105 ++++++
.../models/Woman_congress_delegate.java | 87 +++++
.../models/Woman_congress_delegation.java | 37 ++
.../Woman_congress_delegation_union.java | 37 ++
.../Woman_congress_delegation_unit.java | 37 ++
.../models/Woman_congress_session.java | 60 ++++
...CongressDelegateManageAdjustUserParam.java | 29 ++
.../WomanCongressDelegateManageIdParam.java | 18 +
...omanCongressDelegateManageInsertParam.java | 29 ++
.../WomanCongressDelegateManagePageParam.java | 26 ++
...CongressDelegateManagePublicUserParam.java | 23 ++
.../service/WomanCongressDelegateService.java | 27 ++
.../service/WomanCongressSessionService.java | 12 +
.../WomanCongressDelegateServiceImpl.java | 116 ++++++
.../impl/WomanCongressSessionServiceImpl.java | 202 +++++++++++
.../womancongress/delegate/manage/addForm.js | 136 +++++++
.../womancongress/delegate/manage/adjust.js | 185 ++++++++++
.../womancongress/delegate/manage/index.html | 207 +++++++++++
.../womancongress/delegate/read/index.html | 163 +++++++++
.../womancongress/delegation/auForm.js | 82 +++++
.../womancongress/delegation/headForm.js | 89 +++++
.../womancongress/delegation/headTable.js | 97 +++++
.../womancongress/delegation/index.html | 166 +++++++++
.../womancongress/delegation/partUnit.js | 74 ++++
.../womancongress/delegation/partUnitTable.js | 70 ++++
.../womancongress/delegation/tree.js | 74 ++++
.../womancongress/session/index.html | 174 +++++++++
34 files changed, 3246 insertions(+)
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressDelegateController.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressDelegateReadController.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressDelegationController.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressSessionController.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/common/WomanCongressCommonController.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/listener/WomanCongressDelegateListener.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegate.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegation.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegation_union.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegation_unit.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_session.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManageAdjustUserParam.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManageIdParam.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManageInsertParam.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManagePageParam.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManagePublicUserParam.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/WomanCongressDelegateService.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/WomanCongressSessionService.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/impl/WomanCongressDelegateServiceImpl.java
create mode 100644 src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/impl/WomanCongressSessionServiceImpl.java
create mode 100644 src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/manage/addForm.js
create mode 100644 src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/manage/adjust.js
create mode 100644 src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/manage/index.html
create mode 100644 src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/read/index.html
create mode 100644 src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/auForm.js
create mode 100644 src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/headForm.js
create mode 100644 src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/headTable.js
create mode 100644 src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/index.html
create mode 100644 src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/partUnit.js
create mode 100644 src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/partUnitTable.js
create mode 100644 src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/tree.js
create mode 100644 src/main/resources/views/platform/zhgh/democratic/womancongress/session/index.html
diff --git a/src/main/java/com/budwk/app/base/constant/RoleConstant.java b/src/main/java/com/budwk/app/base/constant/RoleConstant.java
index cc95632..34ca769 100644
--- a/src/main/java/com/budwk/app/base/constant/RoleConstant.java
+++ b/src/main/java/com/budwk/app/base/constant/RoleConstant.java
@@ -74,6 +74,11 @@ RoleConstant {
WORKER_CONGRESS_DELEGATE_SPECIALLY_INVITE("工代会特邀代表"),
WORKER_CONGRESS_DELEGATION_HEAD("工代会代表团团长"),
+ WOMAN_CONGRESS_DELEGATE_FORMAL("妇代会正式代表"),
+ WOMAN_CONGRESS_DELEGATE_ATTENDANCE("妇代会列席代表"),
+ WOMAN_CONGRESS_DELEGATE_SPECIALLY_INVITE("妇代会特邀代表"),
+ WOMAN_CONGRESS_DELEGATION_HEAD("妇代会代表团团长"),
+
SCHOOL_UNION_WC_AUDIT_ADMIN("基层双代会校工会批复人"),
SCHOOL_HOSPITAL_LEADER("校医院负责人"),
diff --git a/src/main/java/com/budwk/app/sys/models/Sys_user_role.java b/src/main/java/com/budwk/app/sys/models/Sys_user_role.java
index 26a19f7..fb0897f 100644
--- a/src/main/java/com/budwk/app/sys/models/Sys_user_role.java
+++ b/src/main/java/com/budwk/app/sys/models/Sys_user_role.java
@@ -50,6 +50,16 @@ public class Sys_user_role {
@Comment("工代会届次ID")
private String wcSessionId;
+ @Column
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ @Comment("妇代会代表团ID")
+ private String womanDelegationId;
+
+ @Column
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ @Comment("妇代会届次ID")
+ private String womanSessionId;
+
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("协会ID")
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressDelegateController.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressDelegateController.java
new file mode 100644
index 0000000..0082e95
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressDelegateController.java
@@ -0,0 +1,298 @@
+package com.budwk.app.zhgh.democratic.womancongress.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.hutool.core.util.ObjectUtil;
+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.result.Result;
+import com.budwk.app.sys.models.Sys_role;
+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.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
+import com.budwk.app.zhgh.democratic.teachercongress.delegate.param.TeacherCongressDelegateManageSearchAdjustUserParam;
+import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegate;
+import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegation_unit;
+import com.budwk.app.zhgh.democratic.womancongress.param.*;
+import com.budwk.app.zhgh.democratic.womancongress.service.WomanCongressDelegateService;
+import org.nutz.aop.interceptor.ioc.TransAop;
+import org.nutz.dao.*;
+import org.nutz.dao.sql.Sql;
+import org.nutz.dao.util.Daos;
+import org.nutz.dao.util.cri.SqlExpressionGroup;
+import org.nutz.ioc.aop.Aop;
+import org.nutz.ioc.loader.annotation.Inject;
+import org.nutz.ioc.loader.annotation.IocBean;
+import org.nutz.mvc.annotation.At;
+import org.nutz.mvc.annotation.Ok;
+import org.nutz.mvc.annotation.Param;
+
+import javax.validation.Valid;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * @ClassName WomanCongressDelegateController
+ * @Description TODO
+ * @Author zhf
+ * @Date 2024/8/16 10:27
+ */
+@IocBean
+@At("/platform/womanCongress/delegate/manage")
+@Ok("json:full")
+public class WomanCongressDelegateController {
+
+ @At("")
+ @Ok("beetl:/platform/zhgh/democratic/womancongress/delegate/manage/index.html")
+ @SaCheckPermission("woman.delegate.manage")
+ public void index() {
+ }
+
+ @Inject
+ private WomanCongressDelegateService womanCongressDelegateService;
+
+ @Inject
+ private Dao dao;
+
+ @Inject
+ private SysUserService sysUserService;
+
+ @Inject
+ private SysRoleService sysRoleService;
+
+
+ @At
+ @SaCheckPermission("woman.delegate.manage")
+ public Result pageData(@Valid WomanCongressDelegateManagePageParam pageForm) {
+ Pagination pagination = womanCongressDelegateService.pageData(pageForm);
+ return Result.success(pagination);
+ }
+
+
+ @At
+ @SaCheckPermission("woman.delegate.manage")
+ public Result publicUser(@Valid WomanCongressDelegateManagePublicUserParam param) {
+ List units = dao.query(Woman_congress_delegation_unit.class, Cnd.where("sessionId", "=", param.getSessionId()).and("delegationId", "=", param.getDelegationId()));
+ List unitIds = units.stream().map(Woman_congress_delegation_unit::getUnitId).toList();
+ if(ObjectUtil.isEmpty(unitIds)){
+ return Result.error("代表团没有组成单位");
+ }
+
+ Sql sql = Sqls.create("""
+ SELECT
+ t1.id,
+ t1.username AS userName,
+ t1.loginName AS loginName,
+ t2.NAME AS unitName
+ FROM
+ `sys_user` t1
+ LEFT JOIN sys_unit t2 ON t2.id = t1.unitId
+ WHERE
+ t1.id NOT IN ( SELECT userId FROM woman_congress_delegate WHERE sessionId = @sessionId AND delegationId = @delegationId )
+ 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 = womanCongressDelegateService.listPageMap(1, 50, sql);
+ return Result.success(pagination.getList());
+ }
+
+
+ @At
+ @Aop(TransAop.READ_COMMITTED)
+ @SaCheckPermission("woman.delegate.manage")
+ @SLog(tag = "民主管理", msg = "妇代会代表管理新增代表")
+ public Result insert(@Valid @Param("data") WomanCongressDelegateManageInsertParam param) {
+ List userIds = param.getUserIds();
+ Sql sql = Sqls.queryEntity("""
+ SELECT
+ t1.id as userId,
+ t1.username AS userName,
+ t1.loginName AS loginName,
+ t1.sex,
+ t1.mobile,
+ t1.unitId,
+ t2.NAME AS unitName,
+ t3.id AS unionId,
+ t3.NAME AS unionName
+ FROM
+ `sys_user` t1
+ LEFT JOIN sys_unit t2 ON t2.id = t1.unitId
+ LEFT JOIN sys_union t3 ON t3.id = t2.unionId
+ WHERE t1.id in (@userIds)
+ """);
+ sql.setParam("userIds", userIds);
+ sql.setEntity(dao.getEntity(Woman_congress_delegate.class));
+ dao.execute(sql);
+ List delegates = sql.getList(Woman_congress_delegate.class);
+ for (Woman_congress_delegate delegate : delegates) {
+ delegate.setDelegationId(param.getDelegationId());
+ delegate.setSessionId(param.getSessionId());
+ delegate.setRoleId(param.getRoleId());
+ }
+
+ dao.insert(delegates);
+
+ for (String userId : userIds) {
+ dao.insert("sys_user_role", Chain.make("userId", userId).add("roleId", param.getRoleId())
+ .add("womanSessionId", param.getSessionId())
+ .add("womanDelegationId", param.getDelegationId()));
+ }
+ sysUserService.clearCache();
+ return Result.success();
+ }
+
+ @At
+ @Aop(TransAop.READ_COMMITTED)
+ @SaCheckPermission("woman.delegate.manage")
+ @SLog(tag = "民主管理", msg = "妇代会代表管理删除代表")
+ public Result delete(@Valid @Param("data") WomanCongressDelegateManageIdParam param) {
+ Dao extDao = Daos.ext(dao, FieldFilter.create(Woman_congress_delegate.class, "^userId|roleId|sessionId|delegationId$"));
+ List list = extDao.query(Woman_congress_delegate.class, Cnd.where("id", "in", param.getIds()));
+
+ //删除角色
+ for (Woman_congress_delegate delegate : list) {
+ dao.clear("sys_user_role", Cnd.where("userId", "=", delegate.getUserId())
+ .and("roleId", "=", delegate.getRoleId())
+ .and("womanSessionId", "=", delegate.getSessionId())
+ .and("womanDelegationId", "=", delegate.getDelegationId()));
+ }
+
+ dao.clear(Woman_congress_delegate.class, Cnd.where("id", "in", param.getIds()));
+ sysUserService.clearCache();
+ return Result.success();
+ }
+
+ /**
+ * 代表调整搜索用户
+ *
+ * @param param
+ * @return
+ */
+ @At
+ @SaCheckPermission("woman.delegate.manage")
+ @Ok("json:{ignoreNull:true}")
+ public Result adjustUserList(@Valid TeacherCongressDelegateManageSearchAdjustUserParam param) {
+// Dao extDao = Daos.ext(dao, FieldFilter.create(Teacher_congress_delegate.class, "^id|userId|userName|loginName|unitName$"));
+// SqlExpressionGroup seg = new SqlExpressionGroup();
+// seg.orLike("userName", param.getKeyWord());
+// seg.orLike("loginName", param.getKeyWord());
+// List list = extDao.query(Teacher_congress_delegate.class, Cnd.where("sessionId", "=", param.getSessionId()).and(seg).limit(1, 10));
+// return Result.success(list);
+ Sql sql = Sqls.create("""
+ SELECT
+ u.id,
+ u.id AS userId,
+ u.username AS userName,
+ u.loginname AS loginName,
+ u.sex,
+ u.unionName,
+ u.unitName
+ FROM
+ vw_user u
+ LEFT JOIN woman_congress_delegate tcd ON tcd.userId = u.id
+ $condition
+ """);
+ Cnd cnd = Cnd.NEW();
+ SqlExpressionGroup seg = new SqlExpressionGroup();
+ seg.orLike("u.username", param.getKeyWord());
+ seg.orLike("u.loginname", param.getKeyWord());
+ cnd.and(seg);
+ sql.setCondition(cnd);
+ Pagination pagination = sysUserService.listPageMap(1, 10, sql);
+ return Result.success(pagination.getList());
+ }
+
+ /**
+ * 调整代表
+ *
+ * @param params
+ * @return
+ */
+ @At
+ @SaCheckPermission("woman.delegate.manage")
+ @Aop(TransAop.READ_COMMITTED)
+ public Result doAdjustUser(@Valid String sessionId, @Valid @Param("data") WomanCongressDelegateManageAdjustUserParam[] params) {
+ if (ObjectUtil.isEmpty(params)) {
+ return Result.error("调整用户不能为空");
+ }
+
+ //角色数据
+ Sys_role delegateFormalRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_FORMAL.name());
+ Sys_role delegateAttendanceRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_ATTENDANCE.name());
+ Sys_role delegateSpeciallyInviteRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_SPECIALLY_INVITE.name());
+ Sys_role delegationHeadRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD.name());
+
+
+ //删除相关的数据
+ for (WomanCongressDelegateManageAdjustUserParam param : params) {
+ //删除代表表数据
+ dao.clear(Woman_congress_delegate.class, Cnd.where(Woman_congress_delegate::getUserId, "=", param.getUserId())
+ .and(Woman_congress_delegate::getSessionId, "=", param.getSessionId()));
+ //删除角色数据
+ dao.clear(Sys_user_role.class, Cnd.where(Sys_user_role::getUserId, "=", param.getUserId())
+ .and(Sys_user_role::getRoleId, "in", List.of(delegateFormalRole.getId(), delegateAttendanceRole.getId(), delegateSpeciallyInviteRole.getId(), delegationHeadRole.getId()))
+ .and(Sys_user_role::getWomanSessionId, "=", param.getSessionId()));
+ }
+
+ Sql sql = Sqls.queryEntity("""
+ SELECT
+ t1.id as userId,
+ t1.username AS userName,
+ t1.loginName AS loginName,
+ t1.sex,
+ TIMESTAMPDIFF(YEAR,t1.birthday,CURDATE()) AS age,
+ t1.mobile,
+ t1.unitId,
+ t2.NAME AS unitName,
+ t3.id AS unionId,
+ t3.NAME AS unionName
+ FROM
+ `sys_user` t1
+ LEFT JOIN sys_unit t2 ON t2.id = t1.unitId
+ LEFT JOIN sys_union t3 ON t3.id = t2.unionId
+ WHERE t1.id in (@userIds)
+ """);
+ sql.setParam("userIds", Arrays.stream(params).map(WomanCongressDelegateManageAdjustUserParam::getUserId).toList());
+ sql.setEntity(dao.getEntity(Woman_congress_delegate.class));
+ dao.execute(sql);
+ List delegates = sql.getList(Woman_congress_delegate.class);
+
+ //插入到代表表
+ for (Woman_congress_delegate delegate : delegates) {
+ Optional paramOptional = Arrays.stream(params).filter(param -> param.getUserId().equals(delegate.getUserId())).findFirst();
+ if (paramOptional.isPresent()) {
+ String delegationId = paramOptional.get().getDelegationId();
+ String roleId = paramOptional.get().getRoleId();
+ delegate.setDelegationId(delegationId);
+ delegate.setRoleId(roleId);
+ delegate.setSessionId(sessionId);
+ }
+ }
+ dao.insert(delegates);
+
+ //插入权限
+ List sysUserRoles = delegates.stream().map(delegate -> {
+ Sys_user_role sysUserRole = new Sys_user_role();
+ sysUserRole.setUserId(delegate.getUserId());
+ sysUserRole.setRoleId(delegate.getRoleId());
+ sysUserRole.setWomanSessionId(sessionId);
+ sysUserRole.setWomanDelegationId(delegate.getDelegationId());
+ return sysUserRole;
+ }).toList();
+ dao.insert(sysUserRoles);
+
+ sysUserService.clearCache();
+ sysRoleService.clearCache();
+ return Result.success();
+ }
+
+
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressDelegateReadController.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressDelegateReadController.java
new file mode 100644
index 0000000..f9dc444
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressDelegateReadController.java
@@ -0,0 +1,61 @@
+package com.budwk.app.zhgh.democratic.womancongress.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import com.budwk.app.base.page.Pagination;
+import com.budwk.app.base.result.Result;
+import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
+import com.budwk.app.zhgh.democratic.womancongress.param.WomanCongressDelegateManagePageParam;
+import com.budwk.app.zhgh.democratic.womancongress.service.WomanCongressDelegateService;
+import org.nutz.dao.Dao;
+import org.nutz.ioc.loader.annotation.Inject;
+import org.nutz.ioc.loader.annotation.IocBean;
+import org.nutz.mvc.annotation.At;
+import org.nutz.mvc.annotation.Ok;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+
+/**
+ * @ClassName WomanCongressDelegateReadController
+ * @Description TODO
+ * @Author zhf
+ * @Date 2024/11/26 17:47
+ */
+@IocBean
+@At("/platform/womanCongress/delegate/read")
+@Ok("json:full")
+public class WomanCongressDelegateReadController {
+
+ @At("")
+ @Ok("beetl:/platform/zhgh/democratic/womancongress/delegate/read/index.html")
+ @SaCheckPermission("woman.delegate.read")
+ public void index() {
+ }
+
+ @Inject
+ private WomanCongressDelegateService womanCongressDelegateService;
+
+ @Inject
+ private Dao dao;
+
+
+ @At
+ @SaCheckPermission("woman.delegate.read")
+ public Result pageData(@Valid WomanCongressDelegateManagePageParam pageForm) {
+ Pagination pagination = womanCongressDelegateService.pageData(pageForm);
+ return Result.success(pagination);
+ }
+
+ /**
+ * 导出xlsx 这里不要加@valid注解 不需要分页
+ */
+ @At
+ @Ok("void")
+ @SaCheckPermission("woman.delegate.read")
+ public void exportXlsx(WomanCongressDelegateManagePageParam param, HttpServletResponse response) {
+ womanCongressDelegateService.exportXlsx(param, response);
+ }
+
+
+
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressDelegationController.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressDelegationController.java
new file mode 100644
index 0000000..8edbcd0
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressDelegationController.java
@@ -0,0 +1,337 @@
+package com.budwk.app.zhgh.democratic.womancongress.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.lang.tree.Tree;
+import cn.hutool.core.lang.tree.TreeNode;
+import cn.hutool.core.lang.tree.TreeUtil;
+import cn.hutool.core.util.StrUtil;
+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;
+import com.budwk.app.base.service.BaseService;
+import com.budwk.app.sys.models.Sys_role;
+import com.budwk.app.sys.models.Sys_unit;
+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.zhgh.democratic.womancongress.models.Woman_congress_delegation;
+import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegation_unit;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+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.entity.Record;
+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.Inject;
+import org.nutz.ioc.loader.annotation.IocBean;
+import org.nutz.lang.util.NutMap;
+import org.nutz.mvc.annotation.At;
+import org.nutz.mvc.annotation.Ok;
+import org.nutz.mvc.annotation.POST;
+import org.nutz.mvc.annotation.Param;
+
+import javax.validation.Valid;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * 代表团管理
+ */
+@IocBean
+@At("/platform/womanCongress/delegation")
+@Ok("json:full")
+public class WomanCongressDelegationController {
+
+ @Inject
+ private Dao dao;
+
+ @Inject
+ private BaseService baseService;
+
+ @Inject
+ private SysUserService sysUserService;
+
+ @Inject
+ private SysRoleService sysRoleService;
+
+ @At("")
+ @Ok("beetl:/platform/zhgh/democratic/womancongress/delegation/index.html")
+ @SaCheckPermission("woman.delegation")
+ public void index() {
+ }
+
+ @At
+ @SaCheckPermission("woman.delegation")
+ public Result tree(String sessionId) {
+ List> nodeList = CollUtil.newArrayList();
+ nodeList.add(new TreeNode<>("妇代会代表团", "0", "妇代会代表团", 1000));
+
+ List delegations = dao.query(Woman_congress_delegation.class, Cnd.where("sessionId", "=", sessionId).asc("code"));
+ for (int i = 0; i < delegations.size(); i++) {
+ nodeList.add(new TreeNode<>(delegations.get(i).getId(), "妇代会代表团", delegations.get(i).getName(), i));
+ }
+
+ List> treeList = TreeUtil.build(nodeList, "0");
+ return Result.success(treeList);
+ }
+
+ @At
+ @POST
+ @SaCheckPermission("woman.delegation")
+ @ApiOperation(value = "届次信息列表", httpMethod = "POST")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "sessionId", value = "届次ID", dataType = "String", paramType = "query"),
+ @ApiImplicitParam(name = "delegationId", value = "代表团ID", dataType = "String", paramType = "query")
+ })
+ public Result pageData(@Valid @ApiParam(value = "分页表单") PageForm pageForm, @Valid @ApiParam(value = "届次ID") String sessionId) {
+ Sys_role role = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD);
+ Sql sql = Sqls.create("""
+ SELECT
+ wcd.*,
+ wcs.fullName as sessionName,
+ GROUP_CONCAT(u.username,u.loginname) as delegationHead
+ FROM
+ woman_congress_delegation wcd
+ LEFT JOIN woman_congress_session wcs ON wcs.id = wcd.sessionId
+ LEFT JOIN sys_user_role sur ON sur.womanDelegationId = wcd.id
+ AND sur.roleId = @roleId and sur.womanSessionId=@sessionId
+ LEFT JOIN sys_user u ON u.id = sur.userId
+ $condition""");
+ sql.setParam("roleId", role.getId());
+ sql.setParam("sessionId", sessionId);
+ Cnd cnd = Cnd.NEW();
+ cnd.and("wcd.sessionId","=",sessionId);
+ cnd.groupBy("wcd.id");
+ if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
+ cnd.where().andLike("name", pageForm.getSearchKeyword());
+ }
+ cnd.asc("wcd.code");
+ sql.setCondition(cnd);
+ Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
+ return Result.success(pagination);
+ }
+
+
+ @At
+ @Aop(TransAop.READ_COMMITTED)
+ @SaCheckPermission("woman.delegation")
+ public Result insert(Woman_congress_delegation delegation) {
+ dao.insert(delegation);
+ return Result.success();
+ }
+
+ @At
+ @Aop(TransAop.READ_COMMITTED)
+ @SaCheckPermission("woman.delegation")
+ public Result update(Woman_congress_delegation delegation) {
+ dao.updateIgnoreNull(delegation);
+ return Result.success();
+ }
+
+ @At
+ @Aop(TransAop.READ_COMMITTED)
+ @SaCheckPermission("woman.delegation")
+ public Result delete(String id) {
+ dao.delete(Woman_congress_delegation.class, id);
+ return Result.success();
+ }
+
+ @At
+ @Aop(TransAop.READ_COMMITTED)
+ @SaCheckPermission("woman.delegation")
+ public Result findOne(String id) {
+ Woman_congress_delegation delegation = dao.fetch(Woman_congress_delegation.class, id);
+ return Result.success(delegation);
+ }
+
+ /**
+ * 组成单位数据
+ *
+ * @param delegationId 代表团ID
+ * @return
+ */
+ @At
+ @SaCheckPermission("woman.delegation")
+ public Result partUnitTransferData(String delegationId, String sessionId) {
+ //找出本届次已经设置了代表团的所有单位
+ List delegationUnits = dao.query(Woman_congress_delegation_unit.class, Cnd.where("sessionId", "=", sessionId));
+ List unitIds = delegationUnits.stream().map(Woman_congress_delegation_unit::getUnitId).toList();
+
+ //找出本代表团的单位
+ List selectUnitIds = delegationUnits.stream().filter(unit -> unit.getDelegationId().equals(delegationId)).map(Woman_congress_delegation_unit::getUnitId).toList();
+
+ SqlExpressionGroup seg = new SqlExpressionGroup();
+ seg.orEX("id", "not in", unitIds);
+ seg.orEX("id", "in", selectUnitIds);
+
+// Cnd cnd = Cnd.where("unitLevel", "=", 2);
+ Cnd cnd = Cnd.where("unitTypeCode", "=", "1");
+ if (!seg.isEmpty()) {
+ cnd.and(seg);
+ }
+ cnd.asc("unitcode");
+
+ List units = dao.query(Sys_unit.class, cnd);
+
+ NutMap transferData = NutMap.NEW().addv("selectUnitIds", selectUnitIds).addv("allUnits", units);
+ return Result.success(transferData);
+ }
+
+ @At
+ @SaCheckPermission("woman.delegation")
+ @Aop(TransAop.READ_COMMITTED)
+ public Result partUnitSet(String delegationId, String sessionId, @Param("unitIds") String[] unitIds) {
+ dao.clear(Woman_congress_delegation_unit.class, Cnd.where("delegationId", "=", delegationId).and("sessionId", "=", sessionId));
+
+ List insertData = Arrays.stream(unitIds).map(unitId -> {
+ Woman_congress_delegation_unit delegationUnit = new Woman_congress_delegation_unit();
+ delegationUnit.setUnitId(unitId);
+ delegationUnit.setDelegationId(delegationId);
+ delegationUnit.setSessionId(sessionId);
+ return delegationUnit;
+ }).toList();
+
+ dao.insert(insertData);
+ return Result.success();
+ }
+
+ /**
+ * 设置团长
+ *
+ * @param delegationId
+ * @param sessionId
+ * @param userId
+ * @return
+ */
+ @At
+ @SaCheckPermission("woman.delegation")
+ @Aop(TransAop.READ_COMMITTED)
+ public Result insertHead(String delegationId, String sessionId, String userId) {
+ Sys_role role = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD);
+
+ //删除权限 只能有一个团长
+ dao.clear(Sys_user_role.class, Cnd.where(Sys_user_role::getWomanDelegationId, "=", delegationId)
+ .and(Sys_user_role::getWomanSessionId, "=", sessionId)
+ .and(Sys_user_role::getRoleId, "=", role.getId())
+ );
+
+ //再加
+ dao.insert("sys_user_role", Chain.make("userId", userId).add("roleId", role.getId())
+ .add("womanDelegationId", delegationId).add("womanSessionId", sessionId));
+ sysUserService.clearCache();
+ return Result.success();
+ }
+
+ @At
+ @SaCheckPermission("woman.delegation")
+ public Result notHeadUser(@Valid String sessionId, @Valid String delegationId, String keyWord) {
+ Cnd cnd = Cnd.NEW();
+ cnd.andEX("delegationId", "=", delegationId);
+ cnd.andEX("sessionId", "=", sessionId);
+ if (StrUtil.isNotBlank(keyWord)) {
+ SqlExpressionGroup group = new SqlExpressionGroup();
+ group.or("loginName", "like", "%" + keyWord + "%");
+ group.or("userName", "like", "%" + keyWord + "%");
+ cnd.and(group);
+ }
+ Sql sql = Sqls.create("select userId,loginName,userName,unitName from woman_congress_delegate $condition");
+
+ sql.setCondition(cnd);
+ Pagination pagination = sysUserService.listPageMap(1, 10, sql);
+ return Result.success(pagination.getList());
+ }
+
+
+ /**
+ * @param pageForm
+ * @param sessionId
+ * @param delegationId
+ * @return com.budwk.app.base.result.Result
+ * @author zhf
+ * @description 点击组成单位返回分页数据
+ */
+ @At
+ @SaCheckPermission("woman.delegation")
+ public Result partUnitPageData(@Valid PageForm pageForm, @Valid String sessionId, @Valid String delegationId) {
+ Sql sql = Sqls.create("""
+ SELECT
+ t2.id,
+ t2.`name`
+ FROM
+ woman_congress_delegation_unit t1
+ LEFT JOIN sys_unit t2 ON t2.id = t1.unitId
+ $condition
+ """);
+ Cnd cnd = Cnd.NEW();
+ cnd.and("t1.delegationId", "=", delegationId);
+ cnd.and("t1.sessionId", "=", sessionId);
+ if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
+ cnd.where().andLike("t2.name", pageForm.getSearchKeyword());
+ }
+ sql.setCondition(cnd);
+ Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
+ return Result.success(pagination);
+ }
+
+ @At
+ @SaCheckPermission("woman.delegation")
+ public Result headUser(@Valid String sessionId, @Valid String delegationId) {
+ Sys_role role = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD);
+ Record record = dao.fetch("sys_user_role", Cnd.where("womanSessionId", "=", sessionId)
+ .and("womanDelegationId", "=", delegationId)
+ .and("roleId", "=", role.getId()));
+ String userId = Optional.ofNullable(record).map(r -> r.getString("userId")).orElse(null);
+
+ Sql sql = Sqls.create("""
+ SELECT
+ u.id as userId,
+ u.loginname as loginName,
+ u.username as userName,
+ u.mobile,
+ n.name as unitName
+ FROM
+ sys_user u
+ LEFT JOIN sys_unit n on n.id = u.unitId
+ WHERE
+ u.id = @userId
+ """);
+ sql.setParam("userId", userId);
+ sql.setCallback(Sqls.callback.map());
+ dao.execute(sql);
+ NutMap user = (NutMap) sql.getResult();
+ return Result.success().addData(user);
+ }
+
+ /**
+ * 删除团长角色
+ *
+ * @param delegationId
+ * @param sessionId
+ * @param userId
+ * @return
+ */
+ @At
+ @SaCheckPermission("woman.delegation")
+ public Result deleteHead(@Valid String delegationId, @Valid String sessionId, @Valid String userId) {
+ Sys_role role = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD);
+ //先删除角色
+ dao.clear(Sys_user_role.class, Cnd.where(Sys_user_role::getWomanDelegationId, "=", delegationId)
+ .and(Sys_user_role::getWomanSessionId, "=", sessionId)
+ .and(Sys_user_role::getRoleId, "=", role.getId())
+ .and(Sys_user_role::getUserId, "=", userId)
+ );
+ sysUserService.clearCache();
+ return Result.success();
+ }
+
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressSessionController.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressSessionController.java
new file mode 100644
index 0000000..35b5a15
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/WomanCongressSessionController.java
@@ -0,0 +1,104 @@
+package com.budwk.app.zhgh.democratic.womancongress.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import com.budwk.app.base.exception.BaseException;
+import com.budwk.app.base.page.Pagination;
+import com.budwk.app.base.param.PageForm;
+import com.budwk.app.base.result.Result;
+import com.budwk.app.base.service.BaseService;
+import com.budwk.app.sys.services.SysRoleService;
+import com.budwk.app.sys.services.SysUserService;
+import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_session;
+import com.budwk.app.zhgh.democratic.womancongress.service.WomanCongressSessionService;
+import org.nutz.aop.interceptor.ioc.TransAop;
+import org.nutz.dao.Cnd;
+import org.nutz.dao.Dao;
+import org.nutz.dao.Sqls;
+import org.nutz.dao.sql.Sql;
+import org.nutz.ioc.aop.Aop;
+import org.nutz.ioc.loader.annotation.Inject;
+import org.nutz.ioc.loader.annotation.IocBean;
+import org.nutz.mvc.annotation.At;
+import org.nutz.mvc.annotation.Ok;
+
+@IocBean
+@At("/platform/womanCongress/session")
+@Ok("json:full")
+public class WomanCongressSessionController {
+
+ @Inject
+ private Dao dao;
+
+ @Inject
+ private SysUserService sysUserService;
+
+ @Inject
+ private SysRoleService sysRoleService;
+
+ @Inject
+ private BaseService baseService;
+ @Inject
+ private WomanCongressSessionService womanCongressSessionService;
+
+ @At("")
+ @Ok("beetl:/platform/zhgh/democratic/womancongress/session/index.html")
+ @SaCheckPermission("woman.session")
+ public void index() {
+ }
+
+ @At
+ @Aop(TransAop.READ_COMMITTED)
+ @SaCheckPermission("woman.session")
+ public Result pageData(PageForm pageForm, String j, String c, Integer year) {
+ Sql sql = Sqls.create("select * from woman_congress_session $condition");
+ Cnd cnd = Cnd.NEW();
+ cnd.andEX("YEAR(startDate)", "=", year);
+ cnd.andEX("j", "=", j);
+ cnd.andEX("c", "=", c);
+ sql.setCondition(cnd);
+ Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
+ return Result.success(pagination);
+ }
+
+
+ @At
+ @Aop(TransAop.READ_COMMITTED)
+ @SaCheckPermission("woman.session")
+ public Result insert(Woman_congress_session session, boolean isExtend) {
+ womanCongressSessionService.insertSession(session,isExtend);
+ return Result.success();
+ }
+
+ @At
+ @Aop(TransAop.READ_COMMITTED)
+ @SaCheckPermission("woman.session")
+ public Result update(Woman_congress_session session) {
+ int count = dao.count(Woman_congress_session.class,
+ Cnd.where(Woman_congress_session::getJ, "=", session.getJ())
+ .and(Woman_congress_session::getC, "=", session.getC())
+ .and(Woman_congress_session::getId, "!=", session.getId())
+ );
+ if (count > 0) {
+ throw new BaseException("请勿重复创建");
+ }
+ session.setFullName("第" + session.getJ() + "第" + session.getC());
+ dao.updateIgnoreNull(session);
+ return Result.success();
+ }
+
+ @At
+ @Aop(TransAop.READ_COMMITTED)
+ @SaCheckPermission("woman.session")
+ public Result delete(String id) {
+ womanCongressSessionService.deleteSession(id);
+ return Result.success();
+ }
+
+ @At
+ @Aop(TransAop.READ_COMMITTED)
+ @SaCheckPermission("woman.session")
+ public Result findOne(String id) {
+ Woman_congress_session session = dao.fetch(Woman_congress_session.class, id);
+ return Result.success(session);
+ }
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/common/WomanCongressCommonController.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/common/WomanCongressCommonController.java
new file mode 100644
index 0000000..72c934e
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/controller/common/WomanCongressCommonController.java
@@ -0,0 +1,69 @@
+package com.budwk.app.zhgh.democratic.womancongress.controller.common;
+
+import cn.dev33.satoken.annotation.SaCheckLogin;
+import com.budwk.app.base.constant.RoleConstant;
+import com.budwk.app.base.result.Result;
+import com.budwk.app.sys.models.Sys_role;
+import com.budwk.app.sys.services.SysRoleService;
+import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegation;
+import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_session;
+import org.nutz.dao.Cnd;
+import org.nutz.dao.Dao;
+import org.nutz.ioc.loader.annotation.Inject;
+import org.nutz.ioc.loader.annotation.IocBean;
+import org.nutz.mvc.annotation.At;
+import org.nutz.mvc.annotation.Ok;
+
+import javax.validation.Valid;
+import java.util.List;
+
+@IocBean
+@At("/platform/womanCongress/common")
+@Ok("json:full")
+public class WomanCongressCommonController {
+
+ @Inject
+ private Dao dao;
+
+ @Inject
+ private SysRoleService sysRoleService;
+
+ @At
+ @SaCheckLogin
+ public Result listSession() {
+ List list = dao.query(Woman_congress_session.class, Cnd.NEW().desc("startDate"));
+ return Result.success(list);
+ }
+
+ @At
+ @SaCheckLogin
+ public Result listOpenSession() {
+ List list = dao.query(Woman_congress_session.class, Cnd.where("enable", "=", 1).desc("startDate"));
+ return Result.success(list);
+ }
+
+ @At
+ @SaCheckLogin
+ public Result listDelegation(@Valid String sessionId) {
+ List list = dao.query(Woman_congress_delegation.class, Cnd.where("sessionId", "=", sessionId).asc("code"));
+ return Result.success(list);
+ }
+
+ /**
+ * 代表类型
+ *
+ * @return
+ */
+ @At
+ @SaCheckLogin
+ public Result listDelegateRole() {
+ List list = List.of(
+ sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_FORMAL),
+ sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_ATTENDANCE),
+ sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_SPECIALLY_INVITE)
+ );
+ return Result.success(list);
+ }
+
+
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/listener/WomanCongressDelegateListener.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/listener/WomanCongressDelegateListener.java
new file mode 100644
index 0000000..dca2f20
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/listener/WomanCongressDelegateListener.java
@@ -0,0 +1,105 @@
+package com.budwk.app.zhgh.democratic.womancongress.listener;
+
+import cn.hutool.core.util.StrUtil;
+import com.budwk.app.base.constant.RoleConstant;
+import com.budwk.app.base.event.user.SysUserEvent;
+import com.budwk.app.base.event.user.SysUserEventListener;
+import com.budwk.app.sys.models.Sys_role;
+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.proposal.models.ProposalConfig;
+import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegate;
+import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegation_unit;
+import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_session;
+import com.budwk.app.zhgh.staffmanage.member.constant.MemberChangeType;
+import org.nutz.aop.interceptor.async.Async;
+import org.nutz.dao.Cnd;
+import org.nutz.dao.Dao;
+import org.nutz.ioc.loader.annotation.Inject;
+import org.nutz.ioc.loader.annotation.IocBean;
+
+import java.util.List;
+
+/**
+ * @version 1.0
+ * @Author zzr
+ * @name:WomanCongressDelegateListener
+ * @Date 2024/11/29 17:51
+ * @注释
+ */
+@IocBean
+public class WomanCongressDelegateListener implements SysUserEventListener {
+
+ @Inject
+ private Dao dao;
+ @Inject
+ private SysUserService sysUserService;
+ @Inject
+ private SysRoleService sysRoleService;
+
+ @Override
+ @Async
+ public void onEvent(SysUserEvent event) {
+ if (event.getMemberChangeType() != MemberChangeType.UNIT_CHANGE) {
+ return;
+ }
+ //查询当前最新届次
+ Woman_congress_session session = dao.fetch(Woman_congress_session.class, Cnd.NEW().desc(Woman_congress_session::getStartDate));
+ if (session == null) {
+ return;
+ }
+ String userId = event.getUserId();
+ //查询校领导的单位
+ ProposalConfig config = dao.fetch(ProposalConfig.class, Cnd.NEW());
+ List schoolLeaderUnitIds = config.getSchoolLeaderUnitIds();
+
+ View_user user = dao.fetch(View_user.class, Cnd.where(View_user::getId, "=", userId));
+
+ //校领导排除在外
+ if (StrUtil.isNotBlank(user.getUnitId()) && schoolLeaderUnitIds.contains(user.getUnitId())) {
+ return;
+ }
+ //查询当前代表的信息
+ Woman_congress_delegate currentDelegate = dao.fetch(Woman_congress_delegate.class, Cnd.where(Woman_congress_delegate::getUserId, "=", userId).and(Woman_congress_delegate::getSessionId, "=", session.getId()));
+ if (currentDelegate == null) {
+ return;
+ }
+
+ //查询当前分配的单位属于哪个代表团
+ String unitId = user.getUnitId();
+ Woman_congress_delegation_unit unit = dao.fetch(Woman_congress_delegation_unit.class, Cnd.where(Woman_congress_delegation_unit::getSessionId, "=", session)
+ .and(Woman_congress_delegation_unit::getUnitId, "=", unitId));
+ String delegationId = unit.getDelegationId();
+
+ currentDelegate.setDelegationId(delegationId);
+ currentDelegate.setUnitId(user.getUnitId());
+ currentDelegate.setUnitName(user.getUnitName());
+ currentDelegate.setUnionId(user.getUnionId());
+ currentDelegate.setUnionName(user.getUnionName());
+ dao.updateIgnoreNull(currentDelegate);
+
+ //角色数据
+ Sys_role delegateFormalRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_FORMAL.name());
+ Sys_role delegateAttendanceRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_ATTENDANCE.name());
+ Sys_role delegateSpeciallyInviteRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_SPECIALLY_INVITE.name());
+ Sys_role delegationHeadRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD.name());
+
+ //删除角色数据
+ dao.clear(Sys_user_role.class, Cnd.where(Sys_user_role::getUserId, "=", userId)
+ .and(Sys_user_role::getRoleId, "in", List.of(delegateFormalRole.getId(), delegateAttendanceRole.getId(), delegateSpeciallyInviteRole.getId(), delegationHeadRole.getId()))
+ .and(Sys_user_role::getWcSessionId, "=", session.getId()));
+
+ //再加权限
+ Sys_user_role sysUserRole = new Sys_user_role();
+ sysUserRole.setUserId(userId);
+ sysUserRole.setWcSessionId(session.getId());
+ sysUserRole.setWcDelegationId(currentDelegate.getDelegationId());
+ sysUserRole.setRoleId(currentDelegate.getRoleId());
+ dao.insert(sysUserRole);
+
+ sysUserService.clearCache();
+ sysRoleService.clearCache();
+ }
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegate.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegate.java
new file mode 100644
index 0000000..dfd5bc3
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegate.java
@@ -0,0 +1,87 @@
+package com.budwk.app.zhgh.democratic.womancongress.models;
+
+import com.budwk.app.base.model.BaseModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.nutz.dao.entity.annotation.*;
+import org.nutz.dao.interceptor.annotation.PrevInsert;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Table("woman_congress_delegate")
+@TableMeta("{'mysql-charset':'utf8mb4'}")
+@Comment("妇代会代表")
+public class Woman_congress_delegate extends BaseModel {
+
+ @Name
+ @Comment("ID")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ @PrevInsert(uu32 = true)
+ private String id;
+
+ @Column
+ @Comment("代表用户ID")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ private String userId;
+
+ @Column
+ @Comment("代表工号")
+ @ColDefine(type = ColType.VARCHAR, width = 100)
+ private String loginName;
+
+ @Column
+ @Comment("代表姓名")
+ @ColDefine(type = ColType.VARCHAR, width = 100)
+ private String userName;
+
+ @Column
+ @Comment("代表性别")
+ @ColDefine(type = ColType.VARCHAR, width = 20)
+ private String sex;
+
+ @Column
+ @Comment("代表年龄")
+ @ColDefine(type = ColType.INT)
+ private Integer age;
+
+ @Column
+ @Comment("代表手机号")
+ @ColDefine(type = ColType.VARCHAR, width = 20)
+ private String mobile;
+
+ @Column
+ @Comment("代表单位ID")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ private String unitId;
+
+ @Column
+ @Comment("代表单位名称")
+ @ColDefine(type = ColType.VARCHAR, width = 500)
+ private String unitName;
+
+ @Column
+ @Comment("代表工会id")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ private String unionId;
+
+ @Column
+ @Comment("代表基层工会名称")
+ @ColDefine(type = ColType.VARCHAR, width = 50)
+ private String unionName;
+
+ @Column
+ @Comment("代表团ID")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ private String delegationId;
+
+ @Column
+ @Comment("妇代会ID")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ private String sessionId;
+
+ @Column
+ @Comment("角色ID")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ private String roleId;
+
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegation.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegation.java
new file mode 100644
index 0000000..0f554f0
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegation.java
@@ -0,0 +1,37 @@
+package com.budwk.app.zhgh.democratic.womancongress.models;
+
+import com.budwk.app.base.model.BaseModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.nutz.dao.entity.annotation.*;
+import org.nutz.dao.interceptor.annotation.PrevInsert;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Table("woman_congress_delegation")
+@TableMeta("{'mysql-charset':'utf8mb4'}")
+@Comment("妇代会代表团")
+public class Woman_congress_delegation extends BaseModel {
+
+ @Name
+ @Comment("id")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ @PrevInsert(uu32 = true)
+ private String id;
+
+ @Column
+ @Comment("代表团名称")
+ @ColDefine(type = ColType.VARCHAR, width = 100)
+ private String name;
+
+ @Column
+ @Comment("代表团编码")
+ @ColDefine(type = ColType.VARCHAR, width = 50)
+ private String code;
+
+ @Column
+ @Comment("妇代会ID")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ private String sessionId;
+
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegation_union.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegation_union.java
new file mode 100644
index 0000000..d8c7205
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegation_union.java
@@ -0,0 +1,37 @@
+package com.budwk.app.zhgh.democratic.womancongress.models;
+
+import com.budwk.app.base.model.BaseModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.nutz.dao.entity.annotation.*;
+import org.nutz.dao.interceptor.annotation.PrevInsert;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Table("woman_congress_delegation_union")
+@TableMeta("{'mysql-charset':'utf8mb4'}")
+@Comment("妇代会代表团组成分工会")
+public class Woman_congress_delegation_union extends BaseModel {
+
+ @Name
+ @Comment("id")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ @PrevInsert(uu32 = true)
+ private String id;
+
+ @Column
+ @Comment("代表团id")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ private String delegationId;
+
+ @Column
+ @Comment("分工会id")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ private String unionId;
+
+ @Column
+ @Comment("妇代会ID")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ private String sessionId;
+
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegation_unit.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegation_unit.java
new file mode 100644
index 0000000..19e6949
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_delegation_unit.java
@@ -0,0 +1,37 @@
+package com.budwk.app.zhgh.democratic.womancongress.models;
+
+import com.budwk.app.base.model.BaseModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.nutz.dao.entity.annotation.*;
+import org.nutz.dao.interceptor.annotation.PrevInsert;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Table("woman_congress_delegation_unit")
+@TableMeta("{'mysql-charset':'utf8mb4'}")
+@Comment("妇代会代表团组成单位")
+public class Woman_congress_delegation_unit extends BaseModel {
+
+ @Name
+ @Comment("id")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ @PrevInsert(uu32 = true)
+ private String id;
+
+ @Column
+ @Comment("代表团id")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ private String delegationId;
+
+ @Column
+ @Comment("单位id")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ private String unitId;
+
+ @Column
+ @Comment("妇代会ID")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ private String sessionId;
+
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_session.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_session.java
new file mode 100644
index 0000000..760c784
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/models/Woman_congress_session.java
@@ -0,0 +1,60 @@
+package com.budwk.app.zhgh.democratic.womancongress.models;
+
+import com.budwk.app.base.model.BaseModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.nutz.dao.entity.annotation.*;
+import org.nutz.dao.interceptor.annotation.PrevInsert;
+
+import java.util.Date;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Table("woman_congress_session")
+@TableMeta("{'mysql-charset':'utf8mb4'}")
+@Comment("妇代会届次")
+public class Woman_congress_session extends BaseModel {
+
+ @Name
+ @Comment("ID")
+ @ColDefine(type = ColType.VARCHAR, width = 32)
+ @PrevInsert(uu32 = true)
+ private String id;
+
+ @Column
+ @Comment("年份")
+ @ColDefine(type = ColType.INT, width = 4)
+ private Integer year;
+
+ @Column
+ @Comment("届数")
+ @ColDefine(type = ColType.VARCHAR, width = 8)
+ private String j;
+
+ @Column
+ @Comment("次数")
+ @ColDefine(type = ColType.VARCHAR, width = 8)
+ private String c;
+
+ @Column
+ @Comment("教代会全称")
+ @ColDefine(type = ColType.VARCHAR, width = 20)
+ private String fullName;
+
+ @Column
+ @Comment("教代会开启时间")
+ @ColDefine(type = ColType.DATE)
+ private Date startDate;
+
+ @Column
+ @Comment("教代会描述")
+ @ColDefine(type = ColType.VARCHAR, width = 500)
+ private String description;
+
+ @Column
+ @Comment("教代会开启状态")
+ @ColDefine(type = ColType.BOOLEAN)
+ @Default(value = "0")
+ private Boolean enable;
+
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManageAdjustUserParam.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManageAdjustUserParam.java
new file mode 100644
index 0000000..27772b2
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManageAdjustUserParam.java
@@ -0,0 +1,29 @@
+package com.budwk.app.zhgh.democratic.womancongress.param;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @ClassName WomanCongressDelegateManageAdjustUserParam
+ * @Description TODO
+ * @Author zhf
+ * @Date 2024/11/26 18:06
+ */
+@Data
+public class WomanCongressDelegateManageAdjustUserParam {
+ @NotBlank(message = "教代会届次不能为空")
+ private String sessionId;
+
+ @NotBlank(message = "代表主键ID不能为空")
+ private String id;
+
+ @NotBlank(message = "代表ID不能为空")
+ private String userId;
+
+ @NotBlank(message = "代表团ID不能为空")
+ private String delegationId;
+
+ @NotBlank(message = "代表身份不能为空")
+ private String roleId;
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManageIdParam.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManageIdParam.java
new file mode 100644
index 0000000..5bf8c28
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManageIdParam.java
@@ -0,0 +1,18 @@
+package com.budwk.app.zhgh.democratic.womancongress.param;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import java.util.List;
+
+/**
+ * @ClassName WomanCongressDelegateManageIdParam
+ * @Description TODO
+ * @Author zhf
+ * @Date 2024/8/16 15:02
+ */
+@Data
+public class WomanCongressDelegateManageIdParam {
+ @NotEmpty(message = "用户id不能为null")
+ private List ids;
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManageInsertParam.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManageInsertParam.java
new file mode 100644
index 0000000..c28a062
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManageInsertParam.java
@@ -0,0 +1,29 @@
+package com.budwk.app.zhgh.democratic.womancongress.param;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import java.util.List;
+
+/**
+ * @ClassName WomanCongressDelegateManageInsertParam
+ * @Description TODO
+ * @Author zhf
+ * @Date 2024/8/16 14:10
+ */
+@Data
+public class WomanCongressDelegateManageInsertParam {
+
+ @NotBlank(message = "教代会届次不能为空")
+ private String sessionId;
+
+ @NotBlank(message = "代表团不能为空")
+ private String delegationId;
+
+ @NotBlank(message = "代表类型不能为空")
+ private String roleId;
+
+ @NotEmpty(message = "用户不能为空")
+ private List userIds;
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManagePageParam.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManagePageParam.java
new file mode 100644
index 0000000..0196b7a
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManagePageParam.java
@@ -0,0 +1,26 @@
+package com.budwk.app.zhgh.democratic.womancongress.param;
+
+import com.budwk.app.base.param.PageForm;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @ClassName WomanCongressDelegateManagePageParam
+ * @Description TODO
+ * @Author zhf
+ * @Date 2024/8/16 10:57
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class WomanCongressDelegateManagePageParam extends PageForm {
+
+ private String sessionId;
+
+ private String delegationId;
+
+ private String roleId;
+
+ private String unionId;
+
+ private String unitId;
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManagePublicUserParam.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManagePublicUserParam.java
new file mode 100644
index 0000000..644defa
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/param/WomanCongressDelegateManagePublicUserParam.java
@@ -0,0 +1,23 @@
+package com.budwk.app.zhgh.democratic.womancongress.param;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @ClassName WomanCongressDelegateManagePublicUserParam
+ * @Description TODO
+ * @Author zhf
+ * @Date 2024/8/16 11:32
+ */
+@Data
+public class WomanCongressDelegateManagePublicUserParam {
+ @NotBlank(message = "妇代会届次不能为空")
+ private String sessionId;
+
+ @NotBlank(message = "代表团不能为空")
+ private String delegationId;
+
+ @NotBlank(message = "搜索关键字不能为空")
+ private String keyWord;
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/WomanCongressDelegateService.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/WomanCongressDelegateService.java
new file mode 100644
index 0000000..eb047bb
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/WomanCongressDelegateService.java
@@ -0,0 +1,27 @@
+package com.budwk.app.zhgh.democratic.womancongress.service;
+
+import com.budwk.app.base.page.Pagination;
+import com.budwk.app.base.service.BaseService;
+import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
+import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegate;
+import com.budwk.app.zhgh.democratic.womancongress.param.WomanCongressDelegateManagePageParam;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+public interface WomanCongressDelegateService extends BaseService {
+
+ /**
+ * 分页
+ */
+ Pagination pageData(WomanCongressDelegateManagePageParam pageForm);
+
+ /**
+ * 获取自管代表团
+ * @return
+ */
+ List getSelfManageDelegationIds();
+
+ void exportXlsx(WomanCongressDelegateManagePageParam pageForm, HttpServletResponse response);
+
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/WomanCongressSessionService.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/WomanCongressSessionService.java
new file mode 100644
index 0000000..0fafa72
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/WomanCongressSessionService.java
@@ -0,0 +1,12 @@
+package com.budwk.app.zhgh.democratic.womancongress.service;
+
+import com.budwk.app.base.service.BaseService;
+import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_session;
+
+
+public interface WomanCongressSessionService extends BaseService {
+
+ void insertSession(Woman_congress_session session, Boolean isExtend);
+
+ void deleteSession(String id);
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/impl/WomanCongressDelegateServiceImpl.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/impl/WomanCongressDelegateServiceImpl.java
new file mode 100644
index 0000000..889ca39
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/impl/WomanCongressDelegateServiceImpl.java
@@ -0,0 +1,116 @@
+package com.budwk.app.zhgh.democratic.womancongress.service.impl;
+
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
+import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
+import cn.hutool.core.util.StrUtil;
+import com.budwk.app.base.constant.RoleConstant;
+import com.budwk.app.base.page.Pagination;
+import com.budwk.app.base.service.impl.BaseServiceImpl;
+import com.budwk.app.base.utils.CommonDownloadUtil;
+import com.budwk.app.sys.models.Sys_role;
+import com.budwk.app.sys.models.Sys_user_role;
+import com.budwk.app.sys.services.SysRoleService;
+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.Teacher_congress_delegate;
+import com.budwk.app.zhgh.democratic.teachercongress.delegate.vo.TeacherCongressDelegateExcelVO;
+import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegate;
+import com.budwk.app.zhgh.democratic.womancongress.param.WomanCongressDelegateManagePageParam;
+import com.budwk.app.zhgh.democratic.womancongress.service.WomanCongressDelegateService;
+import org.apache.poi.ss.usermodel.Workbook;
+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 javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * @ClassName WomanCongressDelegateServiceImpl
+ * @Description TODO
+ * @Author zhf
+ * @Date 2024/8/16 10:59
+ */
+@IocBean(args = {"refer:dao"})
+public class WomanCongressDelegateServiceImpl extends BaseServiceImpl implements WomanCongressDelegateService {
+ public WomanCongressDelegateServiceImpl(Dao dao) {
+ super(dao);
+ }
+
+ @Inject
+ private SysRoleService sysRoleService;
+ @Override
+ public Pagination pageData(WomanCongressDelegateManagePageParam pageForm) {
+ Cnd cnd = buildCondition(pageForm, "");
+ if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name()) && !AuthUtil.hasRole(RoleConstant.SCHOOL_UNION_WC_ADMIN.name())) {
+ cnd.and("delegationId", "in", getSelfManageDelegationIds());
+ }
+ Pagination pagination = listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
+ return pagination;
+ }
+
+ @Override
+ public List getSelfManageDelegationIds() {
+ Sys_role role = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD.name());
+ List sysUserRoles = dao().query(Sys_user_role.class, Cnd.where(Sys_user_role::getRoleId, "=", role.getId())
+ .and(Sys_user_role::getUserId, "=", SecurityUtil.getUserId()));
+ List delegationIds = sysUserRoles.stream()
+ .map(Sys_user_role::getWcDelegationId)
+ .filter(StrUtil::isNotBlank)
+ .toList();
+ return delegationIds;
+ }
+
+ @Override
+ public void exportXlsx(WomanCongressDelegateManagePageParam pageForm, HttpServletResponse response) {
+ Sql sql = Sqls.create("""
+ SELECT
+ t1.*,
+ t2.`name` AS delegationName,
+ t3.`fullName` AS sessionName,
+ t4.`name` AS roleName
+ FROM
+ woman_congress_delegate t1
+ LEFT JOIN woman_congress_delegation t2 ON t2.id = t1.delegationId
+ LEFT JOIN woman_congress_session t3 ON t3.id = t1.sessionId
+ LEFT JOIN sys_role t4 ON t4.id = t1.roleId
+ $condition
+ """);
+ Cnd cnd = buildCondition(pageForm, "t1.");
+ if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name()) && !AuthUtil.hasRole(RoleConstant.SCHOOL_UNION_WC_ADMIN.name())) {
+ cnd.and("t1.delegationId", "in", getSelfManageDelegationIds());
+ }
+
+ sql.setCondition(cnd);
+ List list = listVO(sql, TeacherCongressDelegateExcelVO.class);
+ ExportParams exportParams = new ExportParams();
+ exportParams.setType(ExcelType.XSSF);
+ Workbook workbook = ExcelExportUtil.exportExcel(exportParams, TeacherCongressDelegateExcelVO.class, list);
+ CommonDownloadUtil.download("代表信息表.xlsx", workbook, response);
+ }
+
+
+
+ private Cnd buildCondition(WomanCongressDelegateManagePageParam pageForm, String prefix) {
+ Cnd cnd = Cnd.NEW();
+ cnd.andEX(prefix + "sessionId", "=", pageForm.getSessionId());
+ cnd.andEX(prefix + "delegationId", "=", pageForm.getDelegationId());
+ cnd.andEX(prefix + "roleId", "=", pageForm.getRoleId());
+ cnd.andEX(prefix + "unionId", "=", pageForm.getUnionId());
+ cnd.andEX(prefix + "unitId", "=", pageForm.getUnitId());
+
+ if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
+ SqlExpressionGroup seg = new SqlExpressionGroup();
+ seg.orLike(prefix + "userName", pageForm.getSearchKeyword(), false);
+ seg.orLike(prefix + "loginName", pageForm.getSearchKeyword(), false);
+ cnd.and(seg);
+ }
+
+ return cnd;
+ }
+}
diff --git a/src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/impl/WomanCongressSessionServiceImpl.java b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/impl/WomanCongressSessionServiceImpl.java
new file mode 100644
index 0000000..00aef74
--- /dev/null
+++ b/src/main/java/com/budwk/app/zhgh/democratic/womancongress/service/impl/WomanCongressSessionServiceImpl.java
@@ -0,0 +1,202 @@
+package com.budwk.app.zhgh.democratic.womancongress.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.budwk.app.base.constant.RoleConstant;
+import com.budwk.app.base.exception.BaseException;
+import com.budwk.app.base.service.impl.BaseServiceImpl;
+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.prepare.models.Teacher_congress_session;
+import com.budwk.app.zhgh.democratic.womancongress.models.*;
+import com.budwk.app.zhgh.democratic.womancongress.service.WomanCongressSessionService;
+import org.nutz.dao.Cnd;
+import org.nutz.dao.Dao;
+import org.nutz.ioc.loader.annotation.Inject;
+import org.nutz.ioc.loader.annotation.IocBean;
+import org.nutz.lang.random.R;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @ClassName WomanCongressSessionServiceImpl
+ * @Description TODO
+ * @Author zhf
+ * @Date 2024/12/28 上午9:55
+ */
+@IocBean(args = {"refer:dao"})
+public class WomanCongressSessionServiceImpl extends BaseServiceImpl implements WomanCongressSessionService {
+
+ @Inject
+ private SysRoleService sysRoleService;
+ @Inject
+ private SysUserService sysUserService;
+
+ public WomanCongressSessionServiceImpl(Dao dao) {
+ super(dao);
+ }
+
+ @Override
+ public void insertSession(Woman_congress_session session, Boolean isExtend) {
+ int count = count(Cnd.where(Woman_congress_session::getJ, "=", session.getJ())
+ .and(Woman_congress_session::getC, "=", session.getC()));
+ if (count > 0) {
+ throw new BaseException("请勿重复创建");
+ }
+ session.setStartDate(new Date());
+ session.setFullName("第" + session.getJ() + "第" + session.getC());
+ insert(session);
+
+ //代表团角色ID
+ Sys_role delegationHeadRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD);
+
+ if (isExtend) {
+
+ // 继承上届信息
+ //查询本届上次的信息
+ int c_num = Convert.chineseToNumber(session.getC().replaceAll("次", ""));
+ if (c_num == 1) return;
+ int last_c_num = c_num - 1;
+ String last_c = Convert.numberToChinese(last_c_num, false);
+ Woman_congress_session lastSession = fetch(Cnd.where(Woman_congress_session::getJ, "=", session.getJ())
+ .and(Teacher_congress_session::getC, "=", last_c + "次"));
+
+ if (ObjectUtil.isEmpty(lastSession)) return;
+
+ //从代表团入手
+ List lastDelegations = dao().query(Woman_congress_delegation.class, Cnd.where("sessionId", "=", lastSession.getId()));
+ for (Woman_congress_delegation lastDelegation : lastDelegations) {
+ //代表团继承
+ Woman_congress_delegation newDelegation = BeanUtil.copyProperties(lastDelegation, Woman_congress_delegation.class);
+ newDelegation.setId(null);
+ newDelegation.setSessionId(session.getId());
+ dao().insert(newDelegation);
+
+ //团长角色权限继承
+ List lastHeadUserRoles = dao().query(Sys_user_role.class, Cnd.where(Sys_user_role::getWcDelegationId, "=", lastDelegation.getId())
+ .and(Sys_user_role::getRoleId, "=", delegationHeadRole.getId()));
+ for (Sys_user_role lastHeadUser : lastHeadUserRoles) {
+ Sys_user_role newHeadUser = BeanUtil.copyProperties(lastHeadUser, Sys_user_role.class);
+ newHeadUser.setWcDelegationId(newDelegation.getId());
+ newHeadUser.setWcSessionId(session.getId());
+ dao().insert(newHeadUser);
+ }
+
+ //组成分工会
+ List lastDelegationUnions = dao().query(Woman_congress_delegation_union.class, Cnd.where(Woman_congress_delegation_union::getDelegationId, "=", lastDelegation.getId()));
+ List newDelegationUnions = lastDelegationUnions.stream().map(lastDelegationUnion -> {
+ Woman_congress_delegation_union newDelegationUnion = BeanUtil.copyProperties(lastDelegationUnion, Woman_congress_delegation_union.class);
+ newDelegationUnion.setId(R.UU32());
+ newDelegationUnion.setDelegationId(newDelegation.getId());
+ newDelegationUnion.setSessionId(session.getId());
+ newDelegationUnion.setCreatedAt(null);
+ newDelegationUnion.setUpdatedAt(null);
+ newDelegationUnion.setCreatedBy(null);
+ newDelegationUnion.setUpdatedBy(null);
+ return newDelegationUnion;
+ }).toList();
+ dao().fastInsert(newDelegationUnions);
+
+
+ //组成单位
+ List lastDelegationUnits = dao().query(Woman_congress_delegation_unit.class, Cnd.where(Woman_congress_delegation_unit::getDelegationId, "=", lastDelegation.getId()));
+ List newDelegationUnits = lastDelegationUnits.stream().map(lastDelegationUnit -> {
+ Woman_congress_delegation_unit newDelegationUnit = BeanUtil.copyProperties(lastDelegationUnit, Woman_congress_delegation_unit.class);
+ newDelegationUnit.setId(R.UU32());
+ newDelegationUnit.setDelegationId(newDelegation.getId());
+ newDelegationUnit.setSessionId(session.getId());
+ newDelegationUnit.setCreatedAt(null);
+ newDelegationUnit.setUpdatedAt(null);
+ newDelegationUnit.setCreatedBy(null);
+ newDelegationUnit.setUpdatedBy(null);
+ return newDelegationUnit;
+ }).toList();
+ dao().fastInsert(newDelegationUnits);
+ }
+
+ //代表数据 单位 分工会 要根据最新的设置来调整
+
+ //代表数据
+ List lastDelegates = dao().query(Woman_congress_delegate.class, Cnd.where(Woman_congress_delegate::getSessionId, "=", lastSession.getId()));
+ List newDelegates = lastDelegates.stream().map(lastDelegate -> {
+ Woman_congress_delegate newDelegate = BeanUtil.copyProperties(lastDelegate, Woman_congress_delegate.class);
+ newDelegate.setId(R.UU32());
+ newDelegate.setSessionId(session.getId());
+ newDelegate.setCreatedAt(null);
+ newDelegate.setUpdatedAt(null);
+ newDelegate.setCreatedBy(null);
+ newDelegate.setUpdatedBy(null);
+
+ //查询本人最新的信息从用户表中
+ View_user vwUser = dao().fetch(View_user.class, Cnd.where(Sys_user::getId, "=", lastDelegate.getUserId()));
+ if (ObjectUtil.isNotEmpty(vwUser)) {
+ newDelegate.setUnitId(vwUser.getUnitId());
+ newDelegate.setUnitName(vwUser.getUnitName());
+ newDelegate.setUnionId(vwUser.getUnionId());
+ newDelegate.setUnionName(vwUser.getUnionName());
+ newDelegate.setSex(vwUser.getSex());
+ newDelegate.setMobile(vwUser.getMobile());
+
+ //去查询他当前所处的单位、分工会处于哪个代表团
+ if (StrUtil.isNotBlank(vwUser.getUnionId())) {
+ Woman_congress_delegation_union delegationUnion = dao().fetch(Woman_congress_delegation_union.class, Cnd.where(Woman_congress_delegation_union::getSessionId, "=", session.getId())
+ .and(Woman_congress_delegation_union::getUnionId, "=", vwUser.getUnionId()));
+ if (ObjectUtil.isNotEmpty(delegationUnion)) {
+ newDelegate.setDelegationId(delegationUnion.getDelegationId());
+ }
+ }
+
+ if (StrUtil.isNotBlank(vwUser.getUnitId())) {
+ Woman_congress_delegation_unit delegationUnit = dao().fetch(Woman_congress_delegation_unit.class, Cnd.where(Woman_congress_delegation_unit::getSessionId, "=", session.getId())
+ .and(Woman_congress_delegation_unit::getUnitId, "=", vwUser.getUnitId()));
+ if (ObjectUtil.isNotEmpty(delegationUnit)) {
+ newDelegate.setDelegationId(delegationUnit.getDelegationId());
+ }
+ }
+ }
+ return newDelegate;
+ }).toList();
+ dao().insert(newDelegates);
+
+ //代表权限数据
+ for (Woman_congress_delegate newDelegate : newDelegates) {
+ Sys_user_role sysUserRole = new Sys_user_role();
+ sysUserRole.setWcSessionId(session.getId());
+ sysUserRole.setWcDelegationId(newDelegate.getDelegationId());
+ sysUserRole.setUserId(newDelegate.getUserId());
+ sysUserRole.setRoleId(newDelegate.getRoleId());
+ dao().insert(sysUserRole);
+ }
+ }
+ sysRoleService.clearCache();
+ sysUserService.clearCache();
+ }
+
+ @Override
+ public void deleteSession(String id) {
+ //届次
+ dao().delete(Woman_congress_session.class, id);
+ //代表团
+ dao().clear(Woman_congress_delegation.class, Cnd.where("sessionId", "=", id));
+ //代表团组成单位
+ dao().clear(Woman_congress_delegation_unit.class, Cnd.where("sessionId", "=", id));
+ //代表团组成分工会
+ dao().clear(Woman_congress_delegation_union.class, Cnd.where("sessionId", "=", id));
+ //代表
+ dao().clear(Woman_congress_delegate.class, Cnd.where("sessionId", "=", id));
+
+ //删除相关权限
+ dao().clear(Sys_user_role.class, Cnd.where(Sys_user_role::getWcSessionId, "=", id));
+ //删除相关待办 todo
+
+ sysUserService.clearCache();
+ sysRoleService.clearCache();
+ }
+}
diff --git a/src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/manage/addForm.js b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/manage/addForm.js
new file mode 100644
index 0000000..97145d6
--- /dev/null
+++ b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/manage/addForm.js
@@ -0,0 +1,136 @@
+const AddForm = {
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ data() {
+ return {
+ dialogFormVisible: false,
+ formData: {
+ userIds: [],
+ sessionId: null,
+ delegationId: null,
+ roleId: null
+ },
+ formRules: {
+ sessionId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
+ delegationId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
+ roleId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
+ userIds: [{ required: true, message: "必填", trigger: ["change", "blur"] }]
+ },
+ sessionOptions: [],
+ delegationOptions: [],
+ roleOptions: []
+ }
+ },
+ methods: {
+ onOpen(sessionId) {
+ if (!sessionId) {
+ return
+ }
+ this.formData = {
+ userIds: [],
+ sessionId: sessionId,
+ delegationId: null,
+ roleId: null
+ }
+
+ this.listSession()
+ this.listDelegation(sessionId)
+ this.listRole()
+
+ this.dialogFormVisible = true
+ },
+
+ listSession() {
+ this.$axios.post("/platform/womanCongress/common/listSession").then((res) => {
+ if (res.code === 0) {
+ this.sessionOptions = res.data
+ }
+ })
+ },
+
+ listDelegation(sessionId) {
+ this.$axios.post("/platform/womanCongress/common/listDelegation", { sessionId }).then((res) => {
+ if (res.code === 0) {
+ this.delegationOptions = res.data
+ }
+ })
+ },
+
+ listRole() {
+ this.$axios.post("/platform/womanCongress/common/listDelegateRole").then((res) => {
+ if (res.code === 0) {
+ this.roleOptions = res.data
+ }
+ })
+ },
+
+ sessionChange(sessionId) {
+ this.listDelegation(sessionId)
+ this.formData.userIds = []
+ },
+
+ delegationChange() {
+ this.formData.userIds = []
+ },
+
+ doSubmit() {
+ this.$refs.formRef.validate((valid) => {
+ if (valid) {
+ this.$axios.post("/platform/womanCongress/delegate/manage/insert", { data: JSON.stringify(this.formData) }).then((res) => {
+ if (res.code === 0) {
+ this.dialogFormVisible = false
+ this.$message.success(res.msg)
+ this.$emit("refresh")
+ }
+ })
+ }
+ })
+ }
+ },
+ created() {}
+}
diff --git a/src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/manage/adjust.js b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/manage/adjust.js
new file mode 100644
index 0000000..4df105f
--- /dev/null
+++ b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/manage/adjust.js
@@ -0,0 +1,185 @@
+var AdjustForm = {
+ template:
+ /*language=HTML*/
+ `
+
+
+
+
+
+
+
+
+
+
+ 添加到待调整列表
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消调整
+
+
+
+
+
+
+
+
+ `,
+ data() {
+ return {
+ dialogFormVisible: false,
+ formData: {},
+ formRules: {
+ sessionId: [{ required: true, message: "必填", trigger: ["change", "blur"] }]
+ },
+ sessionOptions: [],
+ delegationOptions: [],
+ roleOptions: []
+ }
+ },
+ methods: {
+ onOpen(sessionId) {
+ if (!sessionId) {
+ return
+ }
+ this.formData = {
+ sessionId: sessionId,
+ users: []
+ }
+ this.listRole()
+ this.listSession()
+ this.listDelegation(sessionId)
+ this.dialogFormVisible = true
+ },
+
+ listSession() {
+ this.$axios.post("/platform/womanCongress/common/listSession").then((res) => {
+ if (res.code === 0) {
+ this.sessionOptions = res.data
+ }
+ })
+ },
+
+ listDelegation(sessionId) {
+ this.$axios.post("/platform/womanCongress/common/listDelegation", { sessionId }).then((res) => {
+ if (res.code === 0) {
+ this.delegationOptions = res.data
+ }
+ })
+ },
+ listRole() {
+ this.$axios.post("/platform/womanCongress/common/listDelegateRole").then((res) => {
+ if (res.code === 0) {
+ this.roleOptions = res.data
+ }
+ })
+ },
+ sessionChange(sessionId) {
+ this.listDelegation(sessionId)
+ },
+
+ move() {
+ if (!this.formData.userId) {
+ this.$message.warning("请先搜索需要调整的代表")
+ return
+ }
+ const user = this.$refs.userSelectRef.options.find((user) => user.id === this.formData.userId)
+
+ const repeat = this.formData.users.some((u) => u.id === user.id)
+ if (repeat) {
+ this.$message.warning("调整列表中已存在,请勿重复添加")
+ return
+ }
+
+ this.formData.users.unshift(user)
+
+ this.formData.userId = null
+ this.$refs.userSelectRef.clearOptions()
+ },
+
+ doSubmit() {
+ if (this.formData.users.length === 0) {
+ this.$message.warning("请先搜索并添加需要调整的代表")
+ return
+ }
+
+ this.$refs.formRef.validate((valid) => {
+ if (valid) {
+ const data = this.formData.users.map((param) => {
+ return {
+ id: param.id,
+ userId: param.userId,
+ delegationId: param.delegationId,
+ sessionId: this.formData.sessionId,
+ roleId: param.roleId
+ }
+ })
+
+ this.$axios
+ .post("/platform/womanCongress/delegate/manage/doAdjustUser", {
+ data: JSON.stringify(data),
+ sessionId: this.formData.sessionId
+ })
+ .then((res) => {
+ if (res.code === 0) {
+ this.dialogFormVisible = false
+ this.$message.success(res.msg)
+ this.$emit("refresh")
+ }
+ })
+ }
+ })
+ }
+ },
+ created() {}
+}
diff --git a/src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/manage/index.html b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/manage/index.html
new file mode 100644
index 0000000..824fa90
--- /dev/null
+++ b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/manage/index.html
@@ -0,0 +1,207 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 新增代表
+
+ 批量删除
+
+ 代表调整
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/read/index.html b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/read/index.html
new file mode 100644
index 0000000..331b9ac
--- /dev/null
+++ b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegate/read/index.html
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 导出Excel
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/auForm.js b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/auForm.js
new file mode 100644
index 0000000..807b31c
--- /dev/null
+++ b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/auForm.js
@@ -0,0 +1,82 @@
+const AU_FORM_TEMPLATE = {
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ data() {
+ return {
+ dialogFormVisible: false,
+ formData: {},
+ formRules: {
+ sessionId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
+ name: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
+ code: [{ required: true, message: "必填", trigger: ["change", "blur"] }]
+ },
+ sessionOptions: []
+ }
+ },
+ methods: {
+ onOpen(id) {
+ this.dialogFormVisible = true
+ this.listSession()
+ if (id) {
+ this.$axios.post("/platform/womanCongress/delegation/findOne", { id }).then((res) => {
+ if (res.code === 0) {
+ this.formData = res.data
+ }
+ })
+ } else {
+ this.formData = {}
+ this.$nextTick(() => {
+ if (this.$refs.formRef) {
+ this.$refs.formRef.clearValidate()
+ }
+ })
+ }
+ },
+
+ doSubmit() {
+ this.$refs.formRef.validate((valid) => {
+ if (valid) {
+ this.$axios
+ .post("/platform/womanCongress/delegation" + (this.formData.id ? "/update" : "/insert"), this.formData)
+ .then((res) => {
+ if (res.code === 0) {
+ this.dialogFormVisible = false
+ this.$message.success(res.msg)
+ this.$emit("refresh", null)
+ }
+ })
+ }
+ })
+ },
+
+ listSession() {
+ this.$axios.post("/platform/womanCongress/common/listSession").then((res) => {
+ if (res.code === 0) {
+ this.sessionOptions = res.data
+ }
+ })
+ }
+ },
+ created() {
+ this.listSession()
+ }
+}
diff --git a/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/headForm.js b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/headForm.js
new file mode 100644
index 0000000..029bf20
--- /dev/null
+++ b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/headForm.js
@@ -0,0 +1,89 @@
+const HEAD_FORM_TEMPLATE = {
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ data() {
+ return {
+ formData: {},
+ headDialogFormVisible: false,
+ headOptions: [],
+ sessionOptions: [],
+
+ formRules: {
+ sessionId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
+ name: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
+ code: [{ required: true, message: "必填", trigger: ["change", "blur"] }]
+ }
+ }
+ },
+ methods: {
+ onOpen(delegationId, sessionId) {
+ if (!delegationId || !sessionId) {
+ return
+ }
+ this.headDialogFormVisible = true
+ this.listSession()
+ this.formData = {
+ sessionId,
+ delegationId
+ }
+ // this.findHeadUser()
+ },
+
+ // findHeadUser() {
+ // this.$axios.post("/platform/teacherCongress/delegation/headUser", this.formData).then((res) => {
+ // if (res.code === 0) {
+ // if (res.data) {
+ // this.headOptions = [res.data]
+ // this.$set(this.formData, "userId", res.data.id)
+ // }
+ // }
+ // })
+ // },
+
+ doSubmitHead() {
+ this.$refs.headFormRef.validate((valid) => {
+ if (valid) {
+ this.$axios.post("/platform/womanCongress/delegation/insertHead", this.formData).then((res) => {
+ if (res.code === 0) {
+ this.headDialogFormVisible = false
+ this.$message.success(res.msg)
+ this.$emit("refresh", null)
+ }
+ })
+ }
+ })
+ },
+ listSession() {
+ this.$axios.post("/platform/womanCongress/common/listSession").then((res) => {
+ if (res.code === 0) {
+ this.sessionOptions = res.data
+ }
+ })
+ }
+ }
+}
diff --git a/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/headTable.js b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/headTable.js
new file mode 100644
index 0000000..5dbe428
--- /dev/null
+++ b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/headTable.js
@@ -0,0 +1,97 @@
+const HEAD_TABLE_TEMPLATE = {
+ template: `
+
+
+ 添加团长
+
+
+
+
+
+
+
+
+ 删除
+
+
+
+
+ `,
+ props: {
+ session_id: {
+ type: String,
+ required: true
+ },
+ delegation_id: {
+ type: String,
+ required: true
+ }
+ },
+ data() {
+ return {
+ tableData: [],
+ pageForm: {}
+ }
+ },
+ watch: {
+ session_id: {
+ handler: function (val) {
+ if (val) {
+ this.pageData()
+ }
+ },
+ immediate: true
+ },
+ delegation_id: {
+ handler: function (val) {
+ if (val) {
+ this.pageData()
+ }
+ },
+ immediate: true
+ }
+ },
+ methods: {
+ pageData() {
+ this.$axios
+ .post("/platform/womanCongress/delegation/headUser", {
+ ...this.pageForm,
+ sessionId: this.session_id,
+ delegationId: this.delegation_id
+ })
+ .then((res) => {
+ if (res.code === 0) {
+ if (res.data) {
+ this.tableData = [res.data]
+ } else {
+ this.tableData = []
+ }
+ }
+ })
+ },
+ open() {
+ this.$emit("open", this.delegation_id, this.session_id)
+ },
+ doDelete(userId) {
+ this.$confirm("您确定要删除吗?", "提示", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "info"
+ }).then(() => {
+ this.$axios
+ .post("/platform/womanCongress/delegation/deleteHead", {
+ userId,
+ sessionId: this.session_id,
+ delegationId: this.delegation_id
+ })
+ .then((res) => {
+ if (res.code === 0) {
+ this.$message.success(res.msg)
+ this.$emit("refresh")
+ this.pageData()
+ }
+ })
+ })
+ }
+ }
+}
diff --git a/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/index.html b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/index.html
new file mode 100644
index 0000000..ae04cd0
--- /dev/null
+++ b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/index.html
@@ -0,0 +1,166 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 新增
+
+
+
+
+
+
+
+
+
+ 编辑
+
+ 设置团长
+
+
+ 设置组成单位
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+ {$refs.partUnitRef.onOpen(delegation_id,session_id)}"
+ ref="partUnitTableRef"
+ >
+
+
+
+
+ {$refs.headFormRef.onOpen(delegation_id,session_id)}"
+ ref="headTableRef"
+ @refresh="refresh"
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/partUnit.js b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/partUnit.js
new file mode 100644
index 0000000..4a08681
--- /dev/null
+++ b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/partUnit.js
@@ -0,0 +1,74 @@
+const PART_UNIT_TEMPLATE = {
+ template: `
+
+
+
+
+ `,
+ data() {
+ return {
+ partUnitDialogFormVisible: false,
+ selectUnitsIds: [],
+ allUnits: [],
+
+ delegationId: null,
+ sessionId: null
+ }
+ },
+ methods: {
+ onOpen(delegationId, sessionId) {
+ if (!delegationId || !sessionId) {
+ return
+ }
+ this.partUnitDialogFormVisible = true
+ this.delegationId = delegationId
+ this.sessionId = sessionId
+ if (this.$refs.transferRef) {
+ this.$refs.transferRef.clearQuery("left")
+ this.$refs.transferRef.clearQuery("right")
+ }
+
+ this.$axios
+ .post("/platform/womanCongress/delegation/partUnitTransferData", {
+ delegationId,
+ sessionId
+ })
+ .then((res) => {
+ if (res.code === 0) {
+ this.selectUnitsIds = res.data.selectUnitIds
+ this.allUnits = res.data.allUnits
+ }
+ })
+ },
+ doSubmitPartUnit() {
+ this.$axios
+ .post(loc() + "/partUnitSet", {
+ unitIds: JSON.stringify(this.selectUnitsIds),
+ delegationId: this.delegationId,
+ sessionId: this.sessionId
+ })
+ .then((res) => {
+ if (res.code === 0) {
+ this.partUnitDialogFormVisible = false
+ this.$message.success(res.msg)
+ this.$emit("refresh", null)
+ }
+ })
+ }
+ },
+ created() {}
+}
diff --git a/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/partUnitTable.js b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/partUnitTable.js
new file mode 100644
index 0000000..8ec82e7
--- /dev/null
+++ b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/partUnitTable.js
@@ -0,0 +1,70 @@
+const PART_UNIT_TABLE_TEMPLATE = {
+ template: `
+
+ `,
+ mixins: [initTableMixins],
+ props: {
+ session_id: {
+ type: String,
+ required: true
+ },
+ delegation_id: {
+ type: String,
+ required: true
+ }
+ },
+ data() {
+ return {
+ tableData: [],
+ pageForm: {}
+ }
+ },
+ watch: {
+ session_id: {
+ handler: function (val) {
+ if (val) {
+ this.doSearch()
+ }
+ },
+ immediate: true
+ },
+ delegation_id: {
+ handler: function (val) {
+ if (val) {
+ this.doSearch()
+ }
+ },
+ immediate: true
+ }
+ },
+ methods: {
+ pageData() {
+ this.$axios
+ .post("/platform/womanCongress/delegation/partUnitPageData", {
+ ...this.pageForm,
+ sessionId: this.session_id,
+ delegationId: this.delegation_id
+ })
+ .then((res) => {
+ if (res.code === 0) {
+ this.tableData = res.data.list
+ this.pageForm.totalCount = res.data.totalCount
+ }
+ })
+ },
+ open() {
+ this.$emit("open", this.delegation_id, this.session_id)
+ }
+ },
+ created() {
+ }
+}
diff --git a/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/tree.js b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/tree.js
new file mode 100644
index 0000000..1cbf5df
--- /dev/null
+++ b/src/main/resources/views/platform/zhgh/democratic/womancongress/delegation/tree.js
@@ -0,0 +1,74 @@
+const TREE_TEMPLATE = {
+ template: `
+
+
+
+
+
+
+
+
+
+
+ {{node.label}}
+
+
+
+
+ `,
+ data() {
+ return {
+ currentTreeNode: null,
+ currentTreeData: null,
+ sessionOptions: [],
+ sessionId: null,
+ treeData: []
+ }
+ },
+ watch: {
+ sessionId(val) {
+ this.$emit("session-change", val)
+ }
+ },
+ methods: {
+ treeNodeClick(data, node) {
+ this.$emit("node-click", data, node)
+ },
+ filterNode() {},
+ listTree() {
+ this.$axios.post("/platform/womanCongress/delegation/tree", { sessionId: this.sessionId }).then((res) => {
+ if (res.code === 0) {
+ this.treeData = res.data
+ }
+ })
+ },
+ listSession() {
+ this.$axios.post("/platform/womanCongress/common/listSession").then((res) => {
+ if (res.code === 0) {
+ this.sessionOptions = res.data
+ if (this.sessionOptions && this.sessionOptions.length > 0) {
+ this.sessionId = this.sessionOptions[0].id
+ this.listTree()
+ }
+ }
+ })
+ },
+ sessionIdChange() {
+ this.listTree()
+ }
+ },
+ created() {
+ this.listSession()
+ }
+}
diff --git a/src/main/resources/views/platform/zhgh/democratic/womancongress/session/index.html b/src/main/resources/views/platform/zhgh/democratic/womancongress/session/index.html
new file mode 100644
index 0000000..69f18d0
--- /dev/null
+++ b/src/main/resources/views/platform/zhgh/democratic/womancongress/session/index.html
@@ -0,0 +1,174 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 新增
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 编辑
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 开启
+ 关闭
+
+
+
+
+
+ 是
+ 否
+
+
+ 延用上一次妇代会的组织机构及代表信息,包含【代表团;妇代会代表】。
+
+
+
+
+
+
+
+
+
+
From 65e8df435f2892806b460e4cf23d4908f7d9f26c Mon Sep 17 00:00:00 2001
From: JyuHsin <729757837@qq.com>
Date: Tue, 24 Mar 2026 14:19:56 +0800
Subject: [PATCH 2/2] commit
---
.../sys/services/impl/SysMsgServiceImpl.java | 25 ++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/main/java/com/budwk/app/sys/services/impl/SysMsgServiceImpl.java b/src/main/java/com/budwk/app/sys/services/impl/SysMsgServiceImpl.java
index 8026e68..998f801 100644
--- a/src/main/java/com/budwk/app/sys/services/impl/SysMsgServiceImpl.java
+++ b/src/main/java/com/budwk/app/sys/services/impl/SysMsgServiceImpl.java
@@ -14,6 +14,7 @@ import com.budwk.app.sys.services.SysMsgUserService;
import com.budwk.app.sys.services.SysUserService;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
+import org.apache.commons.lang3.StringUtils;
import org.nutz.aop.interceptor.async.Async;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
@@ -108,7 +109,8 @@ public class SysMsgServiceImpl extends BaseServiceImpl implements SysMs
if(sysMsg.getWechatEnterprise()) {
ThreadUtil.execute(() -> {
//smsService.massSend(loginNames, sysMsg.getTitle(), HtmlUtil.cleanHtmlTag(StrUtil.blankToDefault(sysMsg.getNote(),"")), sysMsg.getUrl());
- smsService.massSendMessage(loginNames, HtmlUtil.cleanHtmlTag(StrUtil.blankToDefault(sysMsg.getNote(),"")));
+ String plainText = SysMsgServiceImpl.htmlToPlainText(StrUtil.blankToDefault(sysMsg.getNote(), ""));
+ smsService.massSendMessage(loginNames, HtmlUtil.cleanHtmlTag(plainText));
});
}
return sysMsg;
@@ -319,4 +321,25 @@ public class SysMsgServiceImpl extends BaseServiceImpl implements SysMs
sysMsg.setCreatedBy(sender);
this.saveMsg(sysMsg, loginNames.toArray(new String[]{}), false);
}
+
+ public static String htmlToPlainText(String htmlContent) {
+ if (StrUtil.isBlank(htmlContent)) {
+ return "";
+ }
+
+ // 1. 把 标签 换成 \n
+ String result = htmlContent.replaceAll("
]*>", "\n");
+ // 2. 把
闭合标签去掉
+ result = result.replaceAll("
", "");
+ // 3. 把
都换成 \n
+ result = result.replaceAll("
", "\n");
+ // 4. 清除所有剩余 HTML 标签
+ result = result.replaceAll("<[^>]+>", "");
+ // 5. 清除多余空行(可选)
+ result = result.replaceAll("\\n+", "\n");
+ // 6. 去掉首尾空格
+ result = result.trim();
+
+ return result;
+ }
}