Compare commits

...
29 Commits
Author SHA1 Message Date
c-hongqw1 5da96a8117 所有协会、社团改成俱乐部;每天定时拉取全量更新人员数据(在职在岗,非临时聘用人员设为会员) 2026-11-04 14:27:37 +08:00
c-hongqw1 3c7e80c428 所有协会、社团改成俱乐部;每天定时拉取全量更新人员数据(在职在岗,非临时聘用人员设为会员) 2026-11-04 14:16:55 +08:00
c-duxc1 d2d3fe9a3f 工会管理:1.校工会主席角色添加分工会相关角色时,加上免审核的权限;(FlowSchoolUnionAdminByArgsAssignmentHandler获取校工会管理员暂不支持校工会主席角色查询,所以也不能审核);2.基层工会审核流程JCGHWY已经加上校工会审核节点后置触发器com.budwk.app.sys.interceptor.SysUnionSchoolAuditInterceptor(修复审核通过后不新增分工会相关角色和基层干部角色的问题); 2026-10-20 14:34:46 +08:00
c-duxc1 e9e6a4d4be 工会管理:新增‘导出基层干部’按钮(改成根据真实角色导出,所属工会读用户的); 2026-10-20 11:13:37 +08:00
c-duxc1 726ae57b96 工会管理:新增‘导出基层干部’按钮; 2026-10-20 09:20:16 +08:00
c-duxc1 56fe0c2933 工会管理-分工会干部:1.新增并初始化“基层干部”角色,并为已成功分配分工会相关角色的人员补齐该角色。2.修复从角色管理页直接添加的分工会相关的历史角色数据没有所属工会id。(暂未覆盖已有工会id的分工会角色); 2026-10-20 09:19:28 +08:00
c-duxc1 1b98a1a24f 工会管理-分工会干部:新增并初始化“基层干部”角色,并为已成功分配分工会干部角色的人员补齐该角色。 2026-10-19 16:52:55 +08:00
c-zhangr1 3a23146903 测试内容整改 2026-09-20 17:26:26 +08:00
c-zhangr1 782426a428 医疗互助补助模块1.1 2026-09-15 09:54:47 +08:00
c-hongqw1 f441623aec 协会创建文化活动删除了也会删除对应人的待办(工作流记录) 2026-09-14 11:03:50 +08:00
c-hongqw1 07b38a2251 协会创建文化活动后活动管理界面出现四条活动记录,已修复 2026-09-14 10:22:45 +08:00
c-chenxs1 8df60b9c5c fix: 优化界面编剧 2026-09-11 18:12:31 +08:00
c-chenxs1 a3cac78d1d fix: 设置 协会负责人 筛选范围全部-同时去掉联系电话列显示 2026-09-11 16:40:35 +08:00
c-chenxs1 89d3475401 fix: 协会会长角色改为 协会负责人 2026-09-11 16:24:10 +08:00
c-chenxs1 c5df88bd92 fix: 协会会长等角色改为 协会负责人 2026-09-11 16:14:54 +08:00
c-chenxs1 ccc29fee66 fix: 优化首页活动排序 2026-09-11 15:18:20 +08:00
c-chenxs1 52d5591d11 fix: 优化活动人数限制2 2026-09-11 14:23:37 +08:00
c-chenxs1 f3c3adaa80 fix: 优化活动人数限制 2026-09-11 13:45:00 +08:00
c-chenxs1 a575fdd958 fix: 修复子活动人数不能为0情况 2026-09-11 09:34:53 +08:00
= e68e71b883 基金会员 2026-07-27 11:29:13 +08:00
c-zhangr1 26646395e0 医疗互助补助模块 2026-07-23 18:26:44 +08:00
c-zhangr1 c34dd44bb4 Merge remote-tracking branch 'origin/main' 2026-07-23 13:58:17 +08:00
c-zhangr1 076f17905d 医疗互助补助模块 2026-07-23 13:57:28 +08:00
c-zhangr1 a17140fbd2 医疗互助补助模块 2026-07-23 11:57:08 +08:00
= 4e9d55bfc0 基金会员 2026-07-23 10:40:17 +08:00
= b45f194355 commit 2026-06-16 15:49:36 +08:00
= ec015a66df commit 2026-06-15 15:47:34 +08:00
dd3s_206 5e4e27023f (人员管理)离退休-离退休人员管理:新增手机h5端查询页; 2026-06-15 09:23:04 +08:00
dd3s_206 38441b30f6 (人员管理)离退休-离退休人员管理:新增手机h5端查询页; 2026-06-13 10:37:01 +08:00
282 changed files with 11018 additions and 1169 deletions
+2 -1
View File
@@ -25,4 +25,5 @@ target/
hs_err_pid*
src/main/resources/application.yaml
src/main/resources/application.yaml
.vscode
@@ -86,6 +86,7 @@ public class MainLauncher {
ioc.get(GlobalMessageSendService.class);
AppIocUtil.setIoc(ioc);
ioc.get(com.budwk.app.sys.services.impl.SysUserDailySyncService.class).register();
}
public void init_auth() {
@@ -0,0 +1,44 @@
package com.budwk.app.base.config;
import com.alibaba.druid.pool.DruidDataSource;
import org.nutz.dao.Dao;
import org.nutz.dao.impl.NutDao;
import org.nutz.ioc.impl.PropertiesProxy;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
/** 推送库独立连接池,仅供人员、单位中间表查询,不能代替系统默认 DAO。 */
@IocBean(create = "init", depose = "close")
public class UserSourceDatabase {
@Inject
private PropertiesProxy conf;
private DruidDataSource dataSource;
private Dao dao;
/** 根据 user-source.jdbc 配置初始化来源连接;连接按需建立,使用只读模式。 */
public void init() {
dataSource = new DruidDataSource();
dataSource.setUrl(conf.get("user-source.jdbc.url"));
dataSource.setUsername(conf.get("user-source.jdbc.username"));
dataSource.setPassword(conf.get("user-source.jdbc.password"));
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setDefaultReadOnly(true);
dataSource.setMaxActive(3);
dataSource.setMaxWait(10000);
dataSource.setValidationQuery("select 1");
dataSource.setTestWhileIdle(true);
dao = new NutDao(dataSource);
}
/** 返回来源库 DAO;调用方只能查询中间表,业务写入继续使用默认 DAO。 */
public Dao dao() {
return dao;
}
/** 应用退出时释放来源库连接。 */
public void close() {
if (dataSource != null) {
dataSource.close();
}
}
}
@@ -26,14 +26,15 @@ RoleConstant {
SCHOOL_UNION_DC_ADMIN("校工会民主管理员"),
SCHOOL_UNION_PROPOSAL_ADMIN("校工会提案管理员"),
APPEAL_COMMITTEE_MEMBER("申诉处理委员会成员"),
SCHOOL_UNION_CLUB_ADMIN("校工会协会管理员"),
SCHOOL_UNION_CLUB_ADMIN("校工会俱乐部管理员"),
SCHOOL_UNION_ACTIVITY_ADMIN("校工会活动管理员"),
SCHOOL_UNION_ARTICLE_CLUB_ADMIN("校工会协会新闻审批管理员"),
SCHOOL_UNION_ARTICLE_CLUB_ADMIN("校工会俱乐部新闻审批管理员"),
SCHOOL_UNION_ARTICLE_FGH_ADMIN("校工会分工会新闻审批管理员"),
SCHOOL_UNION_ARTICLE_ADMIN("校工会新闻审批管理员"),
SCHOOL_OUTLAY_ADMIN("校工会经费管理员"),
BRANCH_UNION_ADMIN("分工会管理员"),
BRANCH_UNION_CADRE("基层干部"),
BRANCH_UNION_CHAIRMAN("分工会主席"),
BRANCH_UNION_VICE_CHAIRMAN("分工会副主席"),
BRANCH_UNION_OPERATOR("分工会操作员"),
@@ -79,15 +80,15 @@ RoleConstant {
SCHOOL_HOSPITAL_LEADER("校医院负责人"),
/*协会模块*/
CLUB_MEMBER("协会会员"),
CLUB_MANAGER("协会负责人"),
CLUB_PRESIDENT("协会会长"),
CLUB_VICE_PRESIDENT("协会副会长"),
CLUB_SECRETARY("协会秘书长"),
CLUB_VICE_SECRETARY("协会副秘书长"),
CLUB_MEMBER("俱乐部会员"),
CLUB_MANAGER("俱乐部负责人"),
CLUB_PRESIDENT("俱乐部会长"),
CLUB_VICE_PRESIDENT("俱乐部副会长"),
CLUB_SECRETARY("俱乐部秘书长"),
CLUB_VICE_SECRETARY("俱乐部副秘书长"),
// SCHOOL_UNION_CLUB_ADMIN("校工会协会管理员"),
CLUB_AUDIT_LEADER("协会分管领导"),
CLUB_OPERATOR("协会操作员"),
CLUB_AUDIT_LEADER("俱乐部分管领导"),
CLUB_OPERATOR("俱乐部操作员"),
/*大病基金会员*/
AID_FUND_MEMBER("大病基金会员"),
@@ -101,7 +102,7 @@ RoleConstant {
LEGAL_DOCTOR("法律顾问"),
UNION_REIMBURSEMENT_MANAGER("分工会报销负责人"),
CLUB_REIMBURSEMENT_MANAGER("协会报销负责人"),
CLUB_REIMBURSEMENT_MANAGER("俱乐部报销负责人"),
SCHOOL_REIMBURSEMENT_MANAGER("校工会报销负责人"),
;
@@ -1,6 +1,7 @@
package com.budwk.app.base.event.role;
import org.nutz.mvc.Mvcs;
import com.budwk.app.base.utils.AppIocUtil;
import org.nutz.ioc.Ioc;
/**
* @version 1.0
@@ -11,10 +12,19 @@ import org.nutz.mvc.Mvcs;
*/
public class RoleEventPublisher {
/**
* 同步发布角色变更,兼容 HTTP 请求与 Quartz 后台线程。
* 无返回值;监听器异常继续向调用方抛出,使外层业务事务可以回滚。
*
* @param event 角色事件:roleCode 为角色编码,userIds 或 unitId 指定人员范围,
* operationType 为 ADD_ROLE、REMOVE_ROLE 或 RENEW_ROLE
*/
public static void broadcast(RoleEventMsg event){
String[] names = Mvcs.getIoc().getNamesByType(RoleEventListener.class);
// 使用应用启动时保存的全局容器,避免后台线程依赖 HTTP 请求上下文。
Ioc ioc = AppIocUtil.get();
String[] names = ioc.getNamesByType(RoleEventListener.class);
for (String name : names) {
RoleEventListener listener = Mvcs.getIoc().get(RoleEventListener.class, name);
RoleEventListener listener = ioc.get(RoleEventListener.class, name);
listener.receive(event);
}
}
@@ -27,14 +27,13 @@ import java.util.Map;
@IocBean
public class SmsJshvcServiceImpl implements SmsService {
private static final String APPID = "1430576717768122368";
private static final String APP_SECRET = "19A0ACB03FBQHL4R4XQD";
private static final String TOKEN_URL = "https://gateway.jshvc.edu.cn/token/gateway/accessToken";
private static final String MSG_URL = "https://gateway.jshvc.edu.cn/mp/restful/v2/message/send";
private static final String REDIS_KEY_MSG_ACCESS_TOKEN = "msg:token:";
private static final String APPID = "";
private static final String APP_SECRET = "";
private static final String TOKEN_URL = "";
private static final String MSG_URL = "";
private static final String REDIS_KEY_MSG_ACCESS_TOKEN = "";
@Inject
@Inject
private RedisService redisService;
@Override
@@ -34,7 +34,7 @@ public class FlowClubPresidentByArgsAssignmentHandler implements AssignmentHandl
}
CommonService commonService = ServiceContext.find(CommonService.class);
List<Sys_user> users = commonService.findUserInfoByRoleCode(Sys_user_role::getClubId, clubId, RoleConstant.CLUB_PRESIDENT);
List<Sys_user> users = commonService.findUserInfoByRoleCode(Sys_user_role::getClubId, clubId, RoleConstant.CLUB_MANAGER);
if(Lang.isEmpty(users)) {
throw new BaseException("未查询到相关审批人");
@@ -45,7 +45,7 @@ public class FlowClubPresidentByArgsAssignmentHandler implements AssignmentHandl
@Override
public String getMessage() {
return "获取协会会长(根据args中的clubId)";
return "获取俱乐部负责人(根据args中的clubId)";
}
@Override
@@ -204,23 +204,24 @@ public class SysHomeController {
FROM sys_home_activity
WHERE enable = 1
ORDER BY
-- 第一优先级:活动状态分组(进行中 → 未开始 → 已结束)
-- 第一优先级:活动状态分组(未开始 → 进行中 → 已结束)
CASE
WHEN startDate <= NOW() AND NOW() <= endDate THEN 0 -- 进行中
WHEN startDate > NOW() THEN 1 -- 未开始
WHEN startDate <= NOW() AND NOW() <= endDate THEN 1 -- 进行中
WHEN startDate > NOW() THEN 0 -- 未开始
ELSE 2 -- 已结束
END ASC,
-- 第二优先级:置顶(如果需要置顶在各自分组内生效)
top DESC,
-- 第三优先级:每组内按时间排序
-- 进行中:按开始时间升序(越早开始的越靠前)
-- 未开始:按开始时间升序(快开始的靠前)
-- 已结束:按结束时间降序(最近结束的靠前)或开始时间降序
-- 第二优先级:进行中、未开始按开始时间升序,已结束按结束时间降序
CASE
WHEN startDate <= NOW() AND NOW() <= endDate THEN startDate
WHEN startDate > NOW() THEN startDate
ELSE endDate
END ASC;
ELSE NULL
END ASC,
CASE
WHEN endDate < NOW() THEN endDate
ELSE NULL
END DESC,
-- 时间相同时置顶优先
top DESC;
""");
List<NutMap> listMap = sysUserService.listMap(activitySql);
List<Sys_home_activity> list = listMap.stream()
@@ -1,5 +1,9 @@
package com.budwk.app.sys.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Dict;
@@ -12,6 +16,7 @@ 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.utils.CommonDownloadUtil;
import com.budwk.app.base.utils.PageUtil;
import com.budwk.app.flow.constant.FlowConst;
import com.budwk.app.flow.engine.FlowEngine;
@@ -27,6 +32,7 @@ import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
@@ -44,6 +50,7 @@ import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Date;
@@ -357,26 +364,30 @@ public class SysUnionController {
unionCadre.setIsJoin(true);
dao.insert(unionCadre);
// 去走工作流
boolean isAdmin = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name());
Dict args = Dict.create();
args.set("submit", isAdmin ? "admin" : "branch");
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
args.set(FlowConst.FORM_DATA, unionCadre);
ProcessInstance instance = flowEngine.startProcessInstanceByKey("JCGHWY", unionCadre.getId(), SecurityUtil.getUserId(), args);
// 自动完成第一个申请任务
List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null);
for (ProcessTask task : doingTaskList) {
flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args);
}
boolean isAdmin = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(),
RoleConstant.SCHOOL_UNION_CHAIRMAN.name());
if (isAdmin) {
// 如果是管理员,直接加角色
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId).and("unionId", "=", unionId));
sysRoleService.insert("sys_user_role", Chain.make("roleId", role.getId()).add("userId", userId).add("unionId", unionId));
Sys_role cadreRole = sysRoleService.getByCode(RoleConstant.BRANCH_UNION_CADRE);
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", cadreRole.getId()).and("userId", "=", userId).and("unionId", "=", unionId));
sysRoleService.insert("sys_user_role", Chain.make("roleId", cadreRole.getId()).add("userId", userId).add("unionId", unionId));
sysRoleService.clearCache();
sysUserService.clearCache();
} else {
// 分工会管理员添加干部时提交校工会审核。
Dict args = Dict.create();
args.set("submit", "branch");
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
args.set(FlowConst.FORM_DATA, unionCadre);
ProcessInstance instance = flowEngine.startProcessInstanceByKey("JCGHWY", unionCadre.getId(), SecurityUtil.getUserId(), args);
// 自动完成第一个申请任务
List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null);
for (ProcessTask task : doingTaskList) {
flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args);
}
}
return Result.success();
@@ -385,11 +396,19 @@ public class SysUnionController {
@At
@ApiOperation("删除分工会人员角色")
@SaCheckPermission("sys.manager.union.branchOfficer")
@Aop(TransAop.READ_COMMITTED)
public Result deleteBranchUnionUserRole(String userId, String roleCode, String unionId) {
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
if (Lang.isEmpty(role)) {
throw new BaseException("无法找到{}对应编码的角色", roleCode);
}
Cnd unionCadreCnd = Cnd.where("userId", "=", userId)
.and("unionId", "=", unionId).and("roleCode", "=", roleCode);
List<Sys_union_cadre> unionCadres = dao.query(Sys_union_cadre.class, unionCadreCnd);
// 删除干部申请时同步删除流程,避免审核列表残留空白待办。
for (Sys_union_cadre unionCadre : unionCadres) {
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(unionCadre.getId());
}
Cnd cnd = Cnd.NEW();
cnd.and("roleId", "=", role.getId());
if (StrUtil.isNotBlank(userId)) {
@@ -401,8 +420,20 @@ public class SysUnionController {
sysRoleService.clear("sys_user_role", cnd);
dao.clear(Sys_union_cadre.class, Cnd.where("userId", "=", userId)
.and("unionId", "=", unionId).and("roleCode", "=", roleCode));
dao.clear(Sys_union_cadre.class, unionCadreCnd);
List<String> branchUnionRoleCodes = sysDictService.getSubListByCode("BRANCH_UNION_ROLES")
.stream().map(Sys_dict::getCode).toList();
List<String> branchUnionRoleIds = CollUtil.isEmpty(branchUnionRoleCodes) ? List.of() :
sysRoleService.query(Cnd.where("code", "in", branchUnionRoleCodes))
.stream().map(Sys_role::getId).toList();
int branchUnionRoleCount = CollUtil.isEmpty(branchUnionRoleIds) ? 0 : dao.count(Sys_user_role.class,
Cnd.where("userId", "=", userId).and("unionId", "=", unionId).and("roleId", "in", branchUnionRoleIds));
if (branchUnionRoleCount == 0) {
Sys_role cadreRole = sysRoleService.getByCode(RoleConstant.BRANCH_UNION_CADRE);
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", cadreRole.getId())
.and("userId", "=", userId).and("unionId", "=", unionId));
}
sysRoleService.clearCache();
sysUserService.clearCache();
@@ -470,6 +501,57 @@ public class SysUnionController {
return Result.success(pagination.getList());
}
@At
@Ok("void")
@ApiOperation("导出基层干部")
@SaCheckPermission("sys.manager.union")
public void exportCadre(HttpServletResponse response) {
Sql sql = Sqls.create("""
SELECT
u.loginname AS loginName,
u.username AS userName,
IFNULL(MAX(branchUnion.`name`), '') AS unionName,
u.mobile,
GROUP_CONCAT(DISTINCT role.`name` ORDER BY role.sort ASC SEPARATOR '、') AS roleName
FROM
sys_role role
INNER JOIN sys_user_role ur ON role.id = ur.roleId
INNER JOIN sys_user u ON u.id = ur.userId
LEFT JOIN vw_user currentUser ON currentUser.id = u.id
LEFT JOIN sys_union branchUnion ON branchUnion.id = COALESCE(NULLIF(currentUser.unionId, ''), NULLIF(ur.unionId, ''))
INNER JOIN sys_dict roleDict ON roleDict.`code` = role.`code`
INNER JOIN sys_dict roleParent ON roleParent.id = roleDict.parentId
AND roleParent.`code` = 'BRANCH_UNION_ROLES'
$condition
""");
Cnd cnd = Cnd.NEW();
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
cnd.and("COALESCE(NULLIF(currentUser.unionId, ''), NULLIF(ur.unionId, ''))", "=", SecurityUtil.getUnionId());
}
cnd.groupBy("ur.userId");
cnd.asc("MIN(branchUnion.unionCode)");
cnd.asc("u.loginname");
sql.setCondition(cnd);
List<NutMap> list = sysUnionService.listMap(sql);
for (int i = 0; i < list.size(); i++) {
list.get(i).put("no", i + 1);
}
List<ExcelExportEntity> exportEntities = new ArrayList<>();
exportEntities.add(new ExcelExportEntity("序号", "no", 10));
exportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
exportEntities.add(new ExcelExportEntity("所属工会", "unionName", 30));
exportEntities.add(new ExcelExportEntity("联系方式", "mobile", 20));
exportEntities.add(new ExcelExportEntity("职务", "roleName", 30));
ExportParams exportParams = new ExportParams();
exportParams.setSheetName("基层干部");
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
CommonDownloadUtil.download("基层干部.xlsx", workbook, response);
}
/**
* 基层干部审核相关
@@ -510,6 +592,7 @@ public class SysUnionController {
""");
Cnd cnd = Cnd.NEW();
cnd.and("t.taskName", "=", "2978a74a-75c1-4f95-99f9-9c08c480f1b5");
cnd.and("info.id", "is not", null);
if (pageForm.getAudit()) {
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(),
ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
@@ -1,6 +1,7 @@
package com.budwk.app.sys.interceptor;
import cn.hutool.json.JSONUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.flow.constant.FlowConst;
import com.budwk.app.flow.engine.FlowInterceptor;
import com.budwk.app.flow.engine.core.Execution;
@@ -44,6 +45,13 @@ public class SysUnionSchoolAuditInterceptor implements FlowInterceptor {
sysRoleService.insert("sys_user_role", Chain.make("roleId", role.getId())
.add("userId", unionBean.getUserId()).add("unionId", unionBean.getUnionId()));
// 分工会干部统一增加基层干部角色,便于按干部身份集中管理。
Sys_role cadreRole = sysRoleService.getByCode(RoleConstant.BRANCH_UNION_CADRE);
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", cadreRole.getId())
.and("userId", "=", unionBean.getUserId()).and("unionId", "=", unionBean.getUnionId()));
sysRoleService.insert("sys_user_role", Chain.make("roleId", cadreRole.getId())
.add("userId", unionBean.getUserId()).add("unionId", unionBean.getUnionId()));
// 清除缓存
sysRoleService.clearCache();
sysUserService.clearCache();
@@ -1,6 +1,7 @@
package com.budwk.app.sys.listener;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.event.user.UserChangeEventListener;
import com.budwk.app.base.event.user.UserChangeMsg;
import com.budwk.app.sys.models.Sys_user_role;
@@ -31,9 +32,17 @@ public class SysUserChangeListener implements UserChangeEventListener {
@Aop(TransAop.READ_COMMITTED)
public void receive(UserChangeMsg message) {
if (ObjectUtil.equals(message.getOperationType(), UserChangeMsg.UNIT_CHANGE_OPERATION)) {
if (StrUtil.isBlank(message.getSourceUnitId())) {
return;
}
// 单位变动,删除原单位的角色
dao.clear(Sys_user_role.class, Cnd.where("userId", "in", message.getUserIds()).and("unitId", "=", message.getSourceUnitId()));
if (StrUtil.isBlank(message.getTargetUnitId())) {
return;
}
// 判断这两个单位是不是在一个工会,如果不是,删除原来工会的所有角色
Sql sql = Sqls.create("""
SELECT
@@ -51,8 +60,9 @@ public class SysUserChangeListener implements UserChangeEventListener {
dao.execute(sql);
NutMap result = (NutMap) sql.getResult();
if (!result.getBoolean("result")) {
dao.clear(Sys_user_role.class, Cnd.where("userId", "in", message.getUserIds()).and("unionId", "=", result.getString("sourceUnionId")));
String sourceUnionId = result.getString("sourceUnionId");
if (!result.getBoolean("result") && StrUtil.isNotBlank(sourceUnionId)) {
dao.clear(Sys_user_role.class, Cnd.where("userId", "in", message.getUserIds()).and("unionId", "=", sourceUnionId));
}
}
@@ -294,6 +294,11 @@ public class Sys_user extends BaseModel implements Serializable {
@Default(value = "0")
private Boolean aidFundMember;
@Column
@Comment("大病基金会员类别")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String aidFundMemberType;
@Column
@Comment("家庭主要成员及其工作单位")
@ColDefine(type = ColType.MYSQL_JSON)
@@ -41,6 +41,9 @@ import java.util.stream.Collectors;
@IocBean(args = {"refer:dao"})
public class SysDataUnitPullServiceImpl extends BaseServiceImpl<Sys_unit> implements SysDataUnitPullService {
@Inject
private com.budwk.app.base.config.UserSourceDatabase userSourceDatabase;
@Inject
private DataCenterProperties dcPro;
@@ -66,7 +69,7 @@ public class SysDataUnitPullServiceImpl extends BaseServiceImpl<Sys_unit> implem
@Aop(TransAop.READ_COMMITTED)
public void updateUnits(List<String> unitIds) {
// 中间表数据
List<Record> unitMiddleList = dao().query("unit_middle", Cnd.NEW());
List<Record> unitMiddleList = userSourceDatabase.dao().query("unit_middle", Cnd.NEW());
List<Sys_unit> sysUnits = dao().query(Sys_unit.class, Cnd.NEW());
Map<String, Sys_unit> unitMapById = sysUnits.stream()
.filter(unit -> StrUtil.isNotBlank(unit.getId()))
@@ -84,7 +87,14 @@ public class SysDataUnitPullServiceImpl extends BaseServiceImpl<Sys_unit> implem
Map<String, String> api2db = Arrays.stream(Api2UnitFiledMap.values())
.collect(Collectors.toMap(e -> e.apiField, e -> e.dbColumn));
for (Record row : unitMiddleList) {
JSONObject jsonRow = JSONUtil.parseObj(JSONUtil.toJsonStr(row));
JSONObject jsonRow = new JSONObject();
// 用映射中的原始键构建 JSON,避免 Record 转 JSON 后列名变小写导致取值失败。
for (String key : api2db.keySet()) {
jsonRow.set(key, row.get(key));
}
jsonRow.set("dwdm", row.get("dwdm"));
jsonRow.set("dwdj", row.get("dwdj"));
jsonRow.set("sjdwmcdm", row.get("sjdwmcdm"));
String unitCode = getDataCenterField(jsonRow, "dwdm");
String unitLevel = getDataCenterField(jsonRow, "dwdj");
if (StrUtil.isBlank(unitCode)) {
@@ -135,6 +145,7 @@ public class SysDataUnitPullServiceImpl extends BaseServiceImpl<Sys_unit> implem
*
* @param updateList 需要更新的单位数据
*/
@Aop(TransAop.READ_COMMITTED)
private void updateDataCenterUnitFields(List<Sys_unit> updateList) {
for (Sys_unit unit : updateList) {
Chain chain = Chain.make("unitcode", unit.getUnitcode());
@@ -2,9 +2,9 @@ package com.budwk.app.sys.services.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HtmlUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.event.role.RoleEventMsg;
@@ -12,6 +12,8 @@ import com.budwk.app.base.event.role.RoleEventPublisher;
import com.budwk.app.base.event.user.UserChangeMsg;
import com.budwk.app.base.event.user.UserChangePublisher;
import com.budwk.app.base.utils.PwdUtil;
import com.budwk.app.base.exception.BaseException;
import com.budwk.app.base.utils.ConditionGroupUtil;
import com.budwk.app.sys.annotation.DataCenterColumn;
import com.budwk.app.sys.models.*;
import com.budwk.app.sys.param.SysDataUserUpdateParam;
@@ -26,13 +28,14 @@ import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.FieldFilter;
import org.nutz.dao.util.Daos;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.random.R;
import org.nutz.lang.util.NutMap;
import org.springframework.beans.BeanUtils;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.lang.reflect.Field;
@@ -64,6 +67,11 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
private static Map<String, String> unitIdNameMap;
/**
* 数据中心允许更新的用户字段表达式。
*/
private static String dataCenterUpdateFields;
/**
* 字段映射类,用于缓存反射结果
*/
@@ -111,31 +119,34 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
}
/**
* 检查用户是否符合会员条件
* 获取数据中心字段白名单表达式,供批量更新时过滤本地业务字段。
*
* @param userState 用户状态
* @param preparedBy 编制类别
* @param postDoctoralJoinDate 博士后进站时间
* @return 是否符合会员条件
* @return 字段过滤表达式
*/
private boolean checkMembershipEligibility(String userState, String preparedBy, Date postDoctoralJoinDate) {
// 博士后单独判断:只要进站时间在两年内就是会员
if ("博士后".equals(preparedBy)) {
if (postDoctoralJoinDate != null) {
Date twoYearsAgo = DateUtil.offset(DateUtil.date(), DateField.YEAR, -2).toJdkDate();
return postDoctoralJoinDate.after(twoYearsAgo);
private static String getDataCenterUpdateFields() {
if (dataCenterUpdateFields == null) {
synchronized (SysDataUserAllUpdateServiceImpl.class) {
if (dataCenterUpdateFields == null) {
dataCenterUpdateFields = getFieldMappings().stream()
.map(mapping -> mapping.field.getName())
.collect(Collectors.joining("|", "^(id|member|", ")$"));
}
}
return false;
}
return dataCenterUpdateFields;
}
// 其他人员需要判断在岗状态和聘用方式
if (!"在岗".equals(userState)) {
return false;
}
// 判断聘用方式
Set<String> memberPreparedByTypes = new HashSet<>(Arrays.asList("新人事代理", "校聘合同制", "事业编制"));
return memberPreparedByTypes.contains(preparedBy);
/**
* 判断本次来源记录是否可自动设为会员。
* @param userState 在职状态,接受“在职”或“在岗”,忽略首尾空格
* @param personType 人员类型,必须非空且不是“临时聘用人员”
* @return true 表示授予会员资格;false 表示取消会员资格(包括状态或人员类型为空)
*/
private boolean checkMembershipEligibility(String userState, String personType) {
String state = StrUtil.trimToNull(userState);
String type = StrUtil.trimToNull(personType);
return ("在职".equals(state) || "在岗".equals(state))
&& type != null && !"临时聘用人员".equals(type);
}
/**
@@ -147,6 +158,9 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
@Override
@Aop(TransAop.READ_COMMITTED)
public String update(SysDataUserUpdateParam updateParam) {
if (updateParam == null || StrUtil.isBlank(updateParam.getPullTime())) {
throw new BaseException("全量更新必须指定拉取批次");
}
long startTime = System.currentTimeMillis();
log.info("开始全量更新用户数据");
@@ -154,6 +168,10 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
Sys_role publicRole = sysRoleService.getByCode(RoleConstant.PUBLIC);
Sys_role memberRole = sysRoleService.getByCode(RoleConstant.MEMBER);
if (publicRole == null || memberRole == null) {
throw new BaseException("公共角色或会员角色不存在,已停止全量更新");
}
// 获取单位信息,后续判断单位变更
List<Sys_unit> unitList = dao.query(Sys_unit.class, Cnd.where("unitTypeCode", "=", "1"));
unitIdNameMap = unitList.stream().collect(Collectors.toMap(Sys_unit::getId, Sys_unit::getName));
@@ -163,34 +181,59 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
// 处理复杂条件
if (updateParam.getConditionGroup() != null) {
// cnd = ConditionGroupUtil.applyConditionGroup(cnd, updateParam.getConditionGroup());
cnd = ConditionGroupUtil.applyConditionGroup(cnd, updateParam.getConditionGroup());
}
List<Sys_user_source> sources = dao.query(Sys_user_source.class, cnd.groupBy("loginname"));
List<Sys_user_source> sources = dao.query(Sys_user_source.class, cnd);
if (sources.isEmpty() || sources.stream().anyMatch(v -> StrUtil.isBlank(v.getLoginname()) || StrUtil.isBlank(v.getUsername()))) {
throw new BaseException("当前批次为空或包含空工号、空姓名,不能执行全量更新");
}
// 不使用 SELECT * GROUP BY,兼容 MySQL 严格模式;重复工号中止,避免随意覆盖。
if (sources.stream().map(Sys_user::getLoginname).distinct().count() != sources.size()) {
throw new BaseException("当前批次存在重复工号,已停止全量更新");
}
log.info("符合条件的数据源记录数: {}", sources.size());
// 查询系统用户
List<Sys_user> sysUsers = dao.query(Sys_user.class, Cnd.NEW().groupBy("loginname"));
Map<String, Sys_user> userMap = sysUsers.stream().collect(Collectors.toMap(Sys_user::getLoginname, sysUser -> sysUser));
List<Sys_user> sysUsers = dao.query(Sys_user.class, Cnd.NEW());
Map<String, Sys_user> userMap = new HashMap<>();
for (Sys_user user : sysUsers) {
if (StrUtil.isNotBlank(user.getLoginname()) && userMap.putIfAbsent(user.getLoginname(), user) != null) {
throw new BaseException("系统存在重复工号,已停止全量更新");
}
}
// 准备数据集合
List<Sys_user> needDoUpdateList = new CopyOnWriteArrayList<>();
List<Sys_user> needInitUserList = new CopyOnWriteArrayList<>();
List<Sys_user_history> histories = new CopyOnWriteArrayList<>();
List<Sys_user> needDoUpdateList = new ArrayList<>();
List<Sys_user> needInitUserList = new ArrayList<>();
List<Sys_user_history> histories = new ArrayList<>();
int newMemberCount = 0;
int withdrawnMemberCount = 0;
List<String> nonMemberUserIds = new ArrayList<>();
// 处理每条数据
for (Sys_user_source source : sources) {
Sys_user user = userMap.get(source.getLoginname());
// 创建用户对象
Sys_user u = new Sys_user();
BeanUtils.copyProperties(source, u);
// 数据中心可能返回三级单位编码,系统用户统一挂到二级单位。
u.setUnitId(normalizeSecondLevelUnitId(u.getUnitId()));
// 仅更新数据中心字段和明确授权同步的会员标记,保留登录、积分等本地字段。
Sys_user u = buildDataCenterUser(source);
boolean eligible = checkMembershipEligibility(source.getUserState(), source.getPersonType());
// 本批次人员严格按来源条件设置会员;不符合条件时同步撤销会员角色。
u.setMember(eligible);
if (eligible && (user == null || !Boolean.TRUE.equals(user.getMember()))) {
newMemberCount++;
}
if (!eligible && user != null) {
nonMemberUserIds.add(user.getId());
if (Boolean.TRUE.equals(user.getMember())) {
withdrawnMemberCount++;
}
}
source.setMember(u.getMember());
if (user == null) {
// 新增用户,初始化数据
u.setId(R.UU32());
String salt = R.UU32();
u.setSalt(salt);
u.setPassword(PwdUtil.getPassword(PwdUtil.generate(12), salt));
@@ -199,8 +242,6 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
} else {
// 修改现有用户
u.setId(user.getId());
// 全量更新只同步数据中心基础资料,会员状态由会员业务流程维护。
u.setMember(null);
needDoUpdateList.add(u);
}
@@ -216,57 +257,18 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
}
}
// 使用CompletableFuture处理并行任务
List<CompletableFuture<Void>> updateTasks = new ArrayList<>();
// 1. 新增用户 - 使用批量处理
if (Lang.isNotEmpty(needInitUserList)) {
CompletableFuture<Void> insertTask = CompletableFuture.runAsync(() -> {
log.info("新增用户: {} 个", needInitUserList.size());
// 分批处理,每批200条
List<List<Sys_user>> batches = ListUtil.split(needInitUserList, 500);
batches.forEach(batch -> {
try {
dao.fastInsert(batch);
} catch (Exception e) {
log.error("批量新增用户异常", e);
}
});
}, executorService);
updateTasks.add(insertTask);
// 人员、角色、历史在当前事务线程同步写入,任一失败抛出异常并回滚。
log.info("全量批次 {}:新增 {} 人,更新 {} 人,新设会员 {} 人,取消会员 {} 人", updateParam.getPullTime(),
needInitUserList.size(), needDoUpdateList.size(), newMemberCount, withdrawnMemberCount);
for (List<Sys_user> batch : ListUtil.split(needInitUserList, 500)) {
dao.fastInsert(batch);
}
Dao extDao = Daos.ext(dao, FieldFilter.create(Sys_user.class, getDataCenterUpdateFields()));
for (List<Sys_user> batch : ListUtil.split(needDoUpdateList, 500)) {
extDao.updateIgnoreNull(batch);
}
// 2. 更新现有用户 - 使用批量处理
if (Lang.isNotEmpty(needDoUpdateList)) {
CompletableFuture<Void> updateTask = CompletableFuture.runAsync(() -> {
log.info("更新用户: {} 个", needDoUpdateList.size());
// 分批处理,每批200条
List<List<Sys_user>> batches = ListUtil.split(needDoUpdateList, 500);
batches.forEach(batch -> {
try {
dao.updateIgnoreNull(batch);
} catch (Exception e) {
log.error("批量更新用户异常", e);
}
});
}, executorService);
updateTasks.add(updateTask);
}
// 等待用户数据更新完成
try {
// 设置超时时间,避免无限等待
CompletableFuture.allOf(updateTasks.toArray(new CompletableFuture[0]))
.get(5, TimeUnit.MINUTES);
} catch (TimeoutException e) {
log.warn("更新用户数据超时");
return "更新超时,请检查数据处理情况";
} catch (Exception e) {
log.error("更新用户数据异常", e);
return "更新失败: " + e.getMessage();
}
// 3. 全量同步不变更会员状态,只按当前用户会员标记补齐基础角色。
// 根据更新后的会员标记补齐基础角色,不移除其他已有权限。
List<Sys_user> roleUsers = dao.query(Sys_user.class, Cnd.NEW());
List<String> publicRoleUserIds = roleUsers.stream().map(Sys_user::getId).toList();
List<String> memberRoleUserIds = roleUsers.stream()
@@ -275,36 +277,37 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
.toList();
int addPublicRoleCount = addMissingUserRole(publicRole.getId(), publicRoleUserIds, "公共角色");
int addMemberRoleCount = addMissingUserRole(memberRole.getId(), memberRoleUserIds, "会员角色");
// 仅删除本次来源中不符合条件人员的 MEMBER 关系,包括历史残留的会员角色。
// 明确限制 roleId,公共角色和其他业务角色不受本次退会操作影响。
int removedMemberRoleCount = 0;
for (List<String> batch : ListUtil.split(nonMemberUserIds, 500)) {
removedMemberRoleCount += dao.clear(Sys_user_role.class,
Cnd.where(Sys_user_role::getRoleId, "=", memberRole.getId())
.and(Sys_user_role::getUserId, "in", batch));
}
log.info("取消会员 {} 人,移除会员角色关系 {} 条", withdrawnMemberCount, removedMemberRoleCount);
sysRoleService.clearCache();
// 4. 异步添加历史记录 - 不等待完成
if (Lang.isNotEmpty(histories)) {
executorService.execute(() -> {
log.info("添加历史记录: {} 条", histories.size());
// 分批处理历史记录
List<List<Sys_user_history>> batches = ListUtil.split(histories, 500);
batches.forEach(batch -> {
try {
dao.fastInsert(batch);
} catch (Exception e) {
log.error("批量添加历史记录异常", e);
}
});
});
// 历史记录必须随业务事务完成,不能在任务报告成功后异步写入。
for (List<Sys_user_history> batch : ListUtil.split(histories, 500)) {
dao.fastInsert(batch);
}
// 5. 处理其他任务
// 5.1 更新提案的校领导角色,发送订阅
ProposalConfig config = dao.fetch(ProposalConfig.class, Cnd.where("delFlag", "=", false).desc("updatedAt"));
for (String unitId : config.getSchoolLeaderUnitIds()) {
RoleEventPublisher.broadcast(new RoleEventMsg(unitId, RoleConstant.PROPOSAL_BRANCH_SCHOOL_LEADER.name(), RoleEventMsg.RENEW_ROLE));
if (config != null && config.getSchoolLeaderUnitIds() != null) {
for (String unitId : config.getSchoolLeaderUnitIds()) {
RoleEventPublisher.broadcast(new RoleEventMsg(unitId, RoleConstant.PROPOSAL_BRANCH_SCHOOL_LEADER.name(), RoleEventMsg.RENEW_ROLE));
}
}
long endTime = System.currentTimeMillis();
log.info("全量更新用户数据完成,耗时: {} 毫秒", (endTime - startTime));
return "更新完成: 新增用户 " + needInitUserList.size() + " 个, 更新用户 " + needDoUpdateList.size()
+ " 个, 补齐公共角色 " + addPublicRoleCount + " 个, 补齐会员角色 " + addMemberRoleCount + " 个";
+ " 个, 新设会员 " + newMemberCount + " 个, 取消会员 " + withdrawnMemberCount
+ " 个, 移除会员角色 " + removedMemberRoleCount + " 条, 补齐公共角色 " + addPublicRoleCount + " 个, 补齐会员角色 " + addMemberRoleCount + " 个";
}
/**
@@ -315,6 +318,7 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
* @param roleName 日志中的角色名称
* @return 本次新增的角色关系数量
*/
@Aop(TransAop.READ_COMMITTED)
private int addMissingUserRole(String roleId, List<String> userIds, String roleName) {
List<String> distinctUserIds = userIds.stream()
.filter(Objects::nonNull)
@@ -369,6 +373,53 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
return unitId;
}
/**
* 构建数据中心同步对象,只写入带有DataCenterColumn注解且来源非空的字段。
*
* @param source 数据中心来源用户
* @return 待新增或更新的系统用户
*/
private Sys_user buildDataCenterUser(Sys_user_source source) {
Sys_user user = new Sys_user();
for (FieldMapping mapping : getFieldMappings()) {
try {
Object sourceValue = mapping.field.get(source);
Object updateValue = normalizeDataCenterValue(mapping.field.getName(), sourceValue);
if (updateValue != null) {
mapping.field.set(user, updateValue);
}
} catch (IllegalAccessException e) {
log.error("数据中心字段赋值失败: {}", mapping.field.getName(), e);
}
}
return user;
}
/**
* 数据中心字段更新值归一化,空字符串和空值不参与更新,单位编码统一归一到二级单位。
*
* @param fieldName 字段名
* @param value 来源值
* @return 可更新值
*/
private Object normalizeDataCenterValue(String fieldName, Object value) {
if (value == null) {
return null;
}
if (value instanceof String) {
String strValue = (String) value;
String trimmedValue = StrUtil.trimToNull(strValue);
if (trimmedValue == null) {
return null;
}
if ("unitId".equals(fieldName)) {
return normalizeSecondLevelUnitId(trimmedValue);
}
return trimmedValue;
}
return value;
}
/**
* 构建变更的历史数据
*
@@ -376,6 +427,7 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
* @param user 系统用户
* @return 历史记录
*/
@Aop(TransAop.READ_COMMITTED)
private Sys_user_history createHistory(Sys_user_source source, Sys_user user) {
List<String> changeTypes = new ArrayList<>();
List<NutMap> changeList = new ArrayList<>();
@@ -403,14 +455,18 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
}
Object sourceValue = mapping.field.get(source);
Object userValue = mapping.field.get(user);
Object updateValue = normalizeDataCenterValue(mapping.field.getName(), sourceValue);
if (updateValue == null) {
continue;
}
// 如果值不相等,记录变更
if (!ObjectUtil.equals(sourceValue, userValue)) {
if (!ObjectUtil.equals(updateValue, userValue)) {
NutMap change = NutMap.NEW();
change.put("fieldName", mapping.name);
change.put("field", mapping.field.getName());
change.put("sourceValue", userValue == null ? "" : userValue.toString());
change.put("newValue", sourceValue == null ? "" : sourceValue.toString());
change.put("newValue", updateValue.toString());
changeList.add(change);
}
} catch (IllegalAccessException e) {
@@ -423,31 +479,34 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
changeTypes.add(MemberChangeType.BASIC_CHANGE.name());
}
// 特殊字段变更处理
// 1. 会员状态变更
// if (!ObjectUtil.equals(user.getMember(), source.getMember())) {
// if (source.getMember()) {
// changeTypes.add(MemberChangeType.RESTORE.name());
// } else {
// changeTypes.add(MemberChangeType.WITHDRAWAL.name());
// }
// }
// 会员标记实际发生变化时记录入会或退会,重复同步不重复生成会员变更历史。
boolean oldMember = Boolean.TRUE.equals(user.getMember());
boolean newMember = Boolean.TRUE.equals(source.getMember());
if (oldMember != newMember) {
changeTypes.add(newMember ? MemberChangeType.RESTORE.name() : MemberChangeType.WITHDRAWAL.name());
changeList.add(NutMap.NEW().addv("fieldName", "会员状态").addv("field", "member")
.addv("sourceValue", oldMember ? "会员" : "非会员")
.addv("newValue", newMember ? "会员" : "非会员"));
}
// 2. 单位变更
String oldUnitId = normalizeSecondLevelUnitId(user.getUnitId());
String newUnitId = normalizeSecondLevelUnitId(source.getUnitId());
if (!ObjectUtil.equals(oldUnitId, newUnitId)) {
if (StrUtil.isNotBlank(newUnitId) && !ObjectUtil.equals(oldUnitId, newUnitId)) {
changeTypes.add(MemberChangeType.UNIT_CHANGE.name());
NutMap change = NutMap.NEW();
change.put("fieldName", "单位");
change.put("field", "unitId");
change.put("sourceValue", unitIdNameMap.get(oldUnitId));
change.put("newValue", unitIdNameMap.get(newUnitId));
change.put("sourceValue", getUnitChangeDisplayValue(oldUnitId));
change.put("newValue", getUnitChangeDisplayValue(newUnitId));
changeList.add(change);
// 单位异动发送订阅消息,清空原单位的所有角色
UserChangePublisher.broadcast(new UserChangeMsg(List.of(user.getId()),
UserChangeMsg.UNIT_CHANGE_OPERATION, oldUnitId, newUnitId));
// 旧单位为空时没有明确的来源单位角色范围,避免清理到全局角色。
if (StrUtil.isNotBlank(oldUnitId)) {
// 单位异动发送订阅消息,清空原单位的所有角色
UserChangePublisher.broadcast(new UserChangeMsg(List.of(user.getId()),
UserChangeMsg.UNIT_CHANGE_OPERATION, oldUnitId, newUnitId));
}
}
// 如果没有任何变更,返回null
@@ -458,8 +517,8 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
// 生成变更信息描述
String changeInfos = changeList.stream()
.map(v -> v.getString("fieldName") + ":" +
HtmlUtil.cleanHtmlTag(v.getString("sourceValue")) + "→" +
HtmlUtil.cleanHtmlTag(v.getString("newValue")))
cleanChangeValue(v.get("sourceValue")) + "→" +
cleanChangeValue(v.get("newValue")))
.collect(Collectors.joining(";"));
// 设置历史记录信息
@@ -469,4 +528,31 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
return history;
}
/**
* 单位变更历史展示值,优先显示单位名称,单位表缺失时显示单位编码,空单位显示空字符串。
*
* @param unitId 单位编码
* @return 历史记录展示值
*/
private String getUnitChangeDisplayValue(String unitId) {
if (StrUtil.isBlank(unitId)) {
return "";
}
String unitName = unitIdNameMap.get(unitId);
return StrUtil.blankToDefault(unitName, unitId);
}
/**
* 生成变更描述前统一处理空值和HTML标签,避免来源数据为空时生成历史记录失败。
*
* @param value 变更前后值
* @return 清洗后的变更展示值
*/
private String cleanChangeValue(Object value) {
if (value == null) {
return "";
}
return HtmlUtil.cleanHtmlTag(value.toString());
}
}
@@ -2,8 +2,6 @@ package com.budwk.app.sys.services.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.thread.AsyncUtil;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.event.role.RoleEventMsg;
@@ -15,10 +13,12 @@ import com.budwk.app.sys.param.SysDataUserUpdateParam;
import com.budwk.app.sys.services.SysDataUserUpdateService;
import com.budwk.app.sys.services.SysRoleService;
import com.budwk.app.zhgh.democratic.proposal.models.ProposalConfig;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.ioc.aop.Aop;
import com.budwk.app.base.exception.BaseException;
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.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.random.R;
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Arrays;
import java.util.Date;
import java.util.Calendar;
import java.util.concurrent.CompletableFuture;
/**
* 增量更新系统用户数据
@@ -40,21 +39,38 @@ public class SysDataUserIncrUpdateServiceImpl implements SysDataUserUpdateServic
@Inject
private SysRoleService sysRoleService;
/**
* 按 pullTime(yyyy-MM-dd HH:mm:ss)批次新增工号,conditionGroup 为可选筛选条件。
* 返回新增人员、单位、会员数量的说明字符串;所有业务写入在同一事务线程执行。
*/
@Override
@Aop(TransAop.READ_COMMITTED)
public String update(SysDataUserUpdateParam updateParam) {
// 基本SQL查询
if (updateParam == null || StrUtil.isBlank(updateParam.getPullTime())) {
throw new BaseException("拉取批次不能为空");
}
// 空工号不参与新增,系统中的空值也不能干扰 NOT IN 判断。
Cnd cnd = Cnd.where("pullTime", "=", updateParam.getPullTime())
.and("loginname", "NOT IN", Sqls.create("SELECT loginname FROM sys_user"));
.and("loginname", "NOT IN", Sqls.create("SELECT loginname FROM sys_user WHERE loginname IS NOT NULL"));
// 处理复杂条件
if (updateParam.getConditionGroup() != null) {
cnd = ConditionGroupUtil.applyConditionGroup(cnd, updateParam.getConditionGroup());
}
cnd.groupBy("loginname");
cnd.and("loginname", "IS NOT", null).and("loginname", "!=", "");
// 执行查询
List<Sys_user_source> userSources = dao.query(Sys_user_source.class, cnd);
List<Sys_user_source> userSources = new java.util.ArrayList<>(dao.query(Sys_user_source.class, cnd).stream()
.collect(java.util.stream.Collectors.toMap(Sys_user_source::getLoginname,
v -> v, (first, duplicate) -> first, java.util.LinkedHashMap::new)).values());
if (userSources.isEmpty()) {
return "增量更新成功,本次无新增人员。";
}
Sys_role publicRole = sysRoleService.getByCode(RoleConstant.PUBLIC);
if (publicRole == null) {
throw new BaseException("公共角色不存在,已停止新增人员");
}
//加入到系统用户表
List<Sys_user> sysUsers = BeanUtil.copyToList(userSources, Sys_user.class);
@@ -98,11 +114,10 @@ public class SysDataUserIncrUpdateServiceImpl implements SysDataUserUpdateServic
}
List<List<Sys_user>> splitSysUsers = ListUtil.split(sysUsers, 500);
List<CompletableFuture<List<Sys_user>>> splitSysUsersFutures = splitSysUsers.stream().map(v -> CompletableFuture.supplyAsync(() -> dao.fastInsert(v))).toList();
//等待任务全部完成
AsyncUtil.waitAll(CompletableFuture.allOf(splitSysUsersFutures.toArray(new CompletableFuture[0])));
Sys_role publicRole = sysRoleService.getByCode(RoleConstant.PUBLIC);
// 分批同步写入,避免异步线程脱离当前事务造成部分成功。
for (List<Sys_user> batch : splitSysUsers) {
dao.fastInsert(batch);
}
//添加公共角色
List<Sys_user_role> sysUserRoles = sysUsers.stream().map(user -> {
@@ -111,13 +126,11 @@ public class SysDataUserIncrUpdateServiceImpl implements SysDataUserUpdateServic
sysUserRole.setRoleId(publicRole.getId());
return sysUserRole;
}).toList();
ThreadUtil.execAsync(() -> {
dao.insert(sysUserRoles);
});
dao.insert(sysUserRoles);
sysRoleService.clearCache();
//比较单位数据
List<Sys_unit> sysUnits = dao.query(Sys_unit.class, Cnd.where(Sys_unit::getUnitLevel, "=", 2));
List<Sys_unit> sysUnits = dao.query(Sys_unit.class, Cnd.NEW());
List<String> sysUnitIds = sysUnits.stream().map(Sys_unit::getId).toList();
//信息中心的数据 转为单位代码 ->单位名称 map
@@ -139,17 +152,17 @@ public class SysDataUserIncrUpdateServiceImpl implements SysDataUserUpdateServic
sysUnit.setUnitLevel(2);
return sysUnit;
}).toList();
ThreadUtil.execAsync(() -> {
dao.insert(insertUnits);
});
dao.insert(insertUnits);
// 计算设置为会员的人数
long memberCount = sysUsers.stream().filter(Sys_user::getMember).count();
// 6.1 更新提案的校领导角色,发送订阅
ProposalConfig config = dao.fetch(ProposalConfig.class, Cnd.where("delFlag", "=", false).desc("updatedAt"));
for (String unitId : config.getSchoolLeaderUnitIds()) {
RoleEventPublisher.broadcast(new RoleEventMsg(unitId, RoleConstant.PROPOSAL_BRANCH_SCHOOL_LEADER.name(), RoleEventMsg.RENEW_ROLE));
if (config != null && config.getSchoolLeaderUnitIds() != null) {
for (String unitId : config.getSchoolLeaderUnitIds()) {
RoleEventPublisher.broadcast(new RoleEventMsg(unitId, RoleConstant.PROPOSAL_BRANCH_SCHOOL_LEADER.name(), RoleEventMsg.RENEW_ROLE));
}
}
return StrUtil.format("增量更新成功,本次更新新入职老师{}人,新增单位{}个,设置为会员{}人。", sysUsers.size(), insertUnits.size(), memberCount);
@@ -49,6 +49,9 @@ import java.util.stream.Collectors;
@Slf4j
public class SysDataUserPullServiceImpl extends BaseServiceImpl<Sys_user_source> implements SysDataUserPullService {
@Inject
private com.budwk.app.base.config.UserSourceDatabase userSourceDatabase;
@Inject
private SysDictService sysDictService;
@Inject
@@ -110,42 +113,43 @@ public class SysDataUserPullServiceImpl extends BaseServiceImpl<Sys_user_source>
public Date pull() {
try {
// 中间表数据
List<NutMap> userMiddleList = sysDataUnitPullService.listMap(Sqls.create("select * from user_middle"));
List<Record> userMiddleList = userSourceDatabase.dao().query("user_middle", Cnd.NEW());
List<JSONObject> rawDataList = new ArrayList<>();
if (!userMiddleList.isEmpty()) {
// 先收集所有原始数据
rawDataList = userMiddleList.stream().map(v -> JSONUtil.parseObj(JSONUtil.toJsonStr(v))).toList();
log.info("数据拉取进度: {}/{}", rawDataList.size(), userMiddleList.size());
} else {
log.warn("当前未获取到数据");
if (userMiddleList.isEmpty()) {
throw new BaseException("来源人员中间表为空,本次同步已停止");
}
log.info("来源人员记录数:{}", userMiddleList.size());
Date nowDate = new Date();
// 与 DATETIME 批次精度保持一致,后续增量更新只消费本次批次。
Date nowDate = new Date(System.currentTimeMillis() / 1000 * 1000);
// 赋值
List<Sys_user_source> latestSourceList = rawDataList.stream().map(raw -> {
List<Sys_user_source> latestSourceList = userMiddleList.stream().map(raw -> {
Sys_user_source sysUser = new Sys_user_source();
// 使用缓存的字段映射
// Record.get 忽略列名大小写;禁止转成普通 JSON 后用大写键读取小写列。
for (FieldMapping mapping : getFieldMappings()) {
try {
// 根据字段类型设置值
if (mapping.field.getType() == String.class) {
mapping.field.set(sysUser, raw.getStr(mapping.key));
mapping.field.set(sysUser, StrUtil.trimToNull(raw.getString(mapping.key)));
} else if (mapping.field.getType() == Date.class) {
mapping.field.set(sysUser, raw.getDate(mapping.key));
mapping.field.set(sysUser, cn.hutool.core.convert.Convert.toDate(raw.get(mapping.key)));
}
} catch (IllegalAccessException e) {
log.error("设置字段值失败: {}", mapping.field.getName(), e);
throw new BaseException("来源字段映射失败:" + mapping.field.getName());
}
}
// 在写入批次前拦截映射异常,不能把空工号批次当成“无新增”成功返回。
if (StrUtil.isBlank(sysUser.getLoginname()) || StrUtil.isBlank(sysUser.getUsername())) {
throw new BaseException("来源人员工号或姓名为空,请检查 ZGH/XM 字段映射;本批次未写入");
}
sysUser.setPullTime(nowDate);
return sysUser;
}).toList();
log.info("用户数据初始化完成,等待插入,当前数据条数{}", latestSourceList.size());
log.info("人员映射校验通过,批次:{},有效人数:{}", DateUtil.formatDateTime(nowDate), latestSourceList.size());
// 插入到数据库
dao().insert(latestSourceList);
// 更新字典数据
@@ -162,13 +166,38 @@ public class SysDataUserPullServiceImpl extends BaseServiceImpl<Sys_user_source>
log.info("单位需要更新,正在同步更新");
sysDataUnitPullService.updateUnits(unitIds);
}
// 新批次及关联数据写入成功后,在当前拉取事务内清理过期来源批次。
retainLatestPullBatches();
return nowDate;
} catch (Exception e) {
throw new BaseException("数据拉取失败,{}", e.getMessage());
}
}
@Async
/**
* 保留最近十个非空 pullTime 对应的完整批次,空时间记录无法归属批次,一并清理。
* 无参数、无返回值;由 pull() 在现有事务内调用,清理失败会使本次拉取回滚。
* 第十批时间作为严格小于的删除边界,避免误删该批次内的其他人员记录。
*/
@Aop(TransAop.READ_COMMITTED)
private void retainLatestPullBatches() {
Sql sql = Sqls.create("SELECT DISTINCT pullTime FROM sys_user_source "
+ "WHERE pullTime IS NOT NULL ORDER BY pullTime DESC LIMIT 1 OFFSET 9");
sql.setCallback((conn, rs, sqlObject) -> rs.next() ? rs.getTimestamp("pullTime") : null);
dao().execute(sql);
Date oldestRetainedTime = sql.getObject(Date.class);
// 不足十批时没有时间边界,只删除空时间记录;严禁退化为无条件清表。
Cnd expired = Cnd.where(Sys_user_source::getPullTime, "IS", null);
if (oldestRetainedTime != null) {
expired.or(Sys_user_source::getPullTime, "<", oldestRetainedTime);
}
int deletedRows = dao().clear(Sys_user_source.class, expired);
log.info("来源批次清理:保留最近10批,最早保留时间:{},删除记录:{}条(随当前事务提交)",
oldestRetainedTime == null ? "不足10批" : DateUtil.formatDateTime(oldestRetainedTime), deletedRows);
}
@Aop(TransAop.READ_COMMITTED)
private void updateDict(List<Sys_user_source> userSources) {
//判断是否要更新在职状态字典
List<String> sourceUserStates = userSources.stream().map(Sys_user::getUserState).filter(StrUtil::isNotBlank).distinct().toList();
@@ -0,0 +1,109 @@
package com.budwk.app.sys.services.impl;
import cn.hutool.core.date.DateUtil;
import com.budwk.app.sys.enums.SysDataUpdateMode;
import com.budwk.app.sys.models.Sys_task;
import com.budwk.app.sys.param.SysDataUserUpdateParam;
import com.budwk.app.sys.services.SysDataUserPullService;
import com.budwk.app.sys.services.SysTaskService;
import com.budwk.app.task.job.SysUserIncrRenewJob;
import com.budwk.app.task.services.TaskPlatformService;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.impl.PropertiesProxy;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import java.util.Date;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/** 每日人员同步的编排及任务登记,复用手动拉取与全量更新服务。 */
@IocBean
@Slf4j
public class SysUserDailySyncService {
@Inject private SysDataUserPullService sysDataUserPullService;
@Inject("refer:sysDataUserAllUpdateServiceImpl")
private SysDataUserAllUpdateServiceImpl sysDataUserAllUpdateService;
@Inject private SysTaskService sysTaskService;
@Inject private TaskPlatformService taskPlatformService;
@Inject private PropertiesProxy conf;
/** 无参数;返回本批次新增统计。拉取失败时抛出异常,不消费历史批次。 */
@Aop(TransAop.READ_COMMITTED)
public String sync() {
Date pullTime = sysDataUserPullService.pull();
log.info("人员拉取完成,开始全量更新,批次:{}", DateUtil.formatDateTime(pullTime));
SysDataUserUpdateParam param = new SysDataUserUpdateParam();
param.setPullTime(DateUtil.formatDateTime(pullTime));
param.setUpdateMode(SysDataUpdateMode.ALL.name());
return sysDataUserAllUpdateService.update(param);
}
/**
* 启动时复用同执行类的真实任务 ID;旧增量任务只更新名称说明,保留页面设置的执行时间。
* 重复的历史任务保留记录但禁用;后续重启保留页面设置的时间和禁用状态。
*/
@Aop(TransAop.READ_COMMITTED)
public void register() {
if (!conf.getBoolean("user-source.sync.enabled", false)) {
return;
}
String jobClass = SysUserIncrRenewJob.class.getName();
List<Sys_task> tasks = sysTaskService.query(Cnd.where("jobClass", "=", jobClass)
.asc("disabled").asc("createdAt").asc("id"));
String name = "每日人员拉取及全量更新";
String cron = conf.get("user-source.sync.cron", "0 0 17 * * ?");
String note = "从推送库全量同步;按在职状态及人员类型同步会员身份和会员角色";
Sys_task task;
if (tasks.isEmpty()) {
task = new Sys_task();
task.setName(name);
task.setJobClass(jobClass);
task.setCron(cron);
task.setNote(note);
task.setData("{}");
task.setDisabled(false);
// Sys_task 插入时自动生成 UUID,必须使用返回的真实 ID 注册和记录执行结果。
task = sysTaskService.insert(task);
} else {
task = tasks.get(0);
if ("每日人员拉取及增量新增".equals(task.getName()) || name.equals(task.getName())) {
task.setName(name);
task.setNote(note);
sysTaskService.update(Chain.make("name", name).add("note", note),
Cnd.where("id", "=", task.getId()));
}
// 兼容旧版本重启生成的重复任务,不删除用户可追溯的任务记录。
for (int i = 1; i < tasks.size(); i++) {
Sys_task duplicate = tasks.get(i);
sysTaskService.update(Chain.make("disabled", true), Cnd.where("id", "=", duplicate.getId()));
if (taskPlatformService.isExist(duplicate.getId(), duplicate.getId())) {
taskPlatformService.delete(duplicate.getId(), duplicate.getId());
}
}
}
String legacyId = "sys-user-daily-incr-sync";
if (taskPlatformService.isExist(legacyId, legacyId)) {
taskPlatformService.delete(legacyId, legacyId);
}
String id = task.getId();
// 使用数据库保存的 Cron 重建调度;配置默认值只用于首次创建,不覆盖页面设置。
if (taskPlatformService.isExist(id, id)) {
taskPlatformService.delete(id, id);
}
if (!task.isDisabled()) {
taskPlatformService.add(id, id, task.getJobClass(), task.getCron(), task.getNote(), task.getData());
}
log.info("人员全量同步任务就绪,任务ID:{},Cron:{},禁用:{},JVM时区:{}",
id, task.getCron(), task.isDisabled(), java.util.TimeZone.getDefault().getID());
}
/** taskId 为调度任务主键,result 为统计或失败说明;结果显示在系统任务列表。 */
@Aop(TransAop.READ_COMMITTED)
public void recordResult(String taskId, String result) {
sysTaskService.update(Chain.make("exeAt", System.currentTimeMillis() / 1000)
.add("exeResult", result), Cnd.where("id", "=", taskId));
}
}
@@ -210,4 +210,7 @@ public class View_user {
@Column
private Boolean aidFundMember;
@Column
private String aidFundMemberType;
}
@@ -0,0 +1,38 @@
package com.budwk.app.task.job;
import com.budwk.app.sys.services.impl.SysUserDailySyncService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.quartz.*;
/** 每天拉取推送库并全量更新;保留原类名以兼容线上已有任务记录。 */
@IocBean
@Slf4j
@DisallowConcurrentExecution
public class SysUserIncrRenewJob implements Job {
@Inject
private SysUserDailySyncService sysUserDailySyncService;
/** Quartz 上下文提供任务 ID;失败交由调度器记录,不立即循环重试。 */
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
String taskId = context.getJobDetail().getKey().getName();
long startTime = System.currentTimeMillis();
log.info("每日人员全量同步开始,任务ID:{}", taskId);
try {
String result = sysUserDailySyncService.sync();
sysUserDailySyncService.recordResult(taskId, result);
log.info("每日人员同步完成,任务ID:{},耗时:{}ms,{}", taskId, System.currentTimeMillis() - startTime, result);
} catch (Exception e) {
log.error("每日人员同步失败,任务ID:" + taskId, e);
// 记录结果失败不能掩盖最初的同步异常。
try {
sysUserDailySyncService.recordResult(taskId, "人员同步失败,请检查来源连接、数据及应用日志。");
} catch (Exception recordError) {
log.error("同步失败结果写入失败,任务ID:" + taskId, recordError);
}
throw new JobExecutionException("每日人员同步失败", e, false);
}
}
}
@@ -206,7 +206,7 @@ public class ActivityBasicScopeController {
if (!StpUtil.hasRole(RoleConstant.SYSADMIN.name()) && !StpUtil.hasRole(RoleConstant.SCHOOL_UNION_ADMIN.name())) {
SqlExpressionGroup group = new SqlExpressionGroup();
group.or("creator", "=", SecurityUtil.getUserId());
if(AuthUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name())) {
if(AuthUtil.hasRole(RoleConstant.CLUB_MANAGER.name())) {
group.or("groupName", "like", "%社%");
}
cnd.and(group);
@@ -250,7 +250,7 @@ public class ActivityBasicScopeController {
addv("is_A06", StpUtil.hasRole(RoleConstant.SCHOOL_UNION_ADMIN.name()));
addv("is_H04", StpUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()));
addv("is_H02", StpUtil.hasRole(RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name()));
addv("is_CLUB_PRESIDENT", StpUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name()));
addv("is_CLUB_MANAGER", StpUtil.hasRole(RoleConstant.CLUB_MANAGER.name()));
addv("is_sysadmin", StpUtil.hasRole(RoleConstant.SYSADMIN.name()));
addv("unionid", SecurityUtil.getUnionId());
}});
@@ -383,24 +383,8 @@ public class ActivityBasicScopeController {
try {
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())){
boolean isBranchUnionChairman = AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name());
boolean isClubPresident = AuthUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name());
List<String> manageClubIdList = sysClubService.getMyManageClub().stream().map(SysClub::getId).toList();
if (isBranchUnionChairman && isClubPresident) {
// Users with both roles can search their union users and their managed club members.
SqlExpressionGroup scopeGroup = new SqlExpressionGroup();
scopeGroup.or("u.unionid", "=", SecurityUtil.getUnionId());
if (Lang.isNotEmpty(manageClubIdList)) {
scopeGroup.or("clubuser.clubid", "in", manageClubIdList);
}
cnd.and(scopeGroup);
} else if (isClubPresident) {
// Club presidents can only search members from clubs they manage.
cnd.and("clubuser.clubid", "in", Lang.isNotEmpty(manageClubIdList) ? manageClubIdList : List.of("__EMPTY_CLUB_ID__"));
} else {
cnd.andEX("u.unionid", "=", SecurityUtil.getUnionId());
}
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.CLUB_MANAGER.name())) {
cnd.andEX("u.unionid", "=", SecurityUtil.getUnionId());
}
cnd.andEX("u.unionid", EQ_OR_NEQ_OP, activityUserScopePageParam.getUnionId());
cnd.andEX("u.unitid", EQ_OR_NEQ_OP, activityUserScopePageParam.getUnitId());
@@ -26,6 +26,7 @@ import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -78,13 +79,12 @@ public class ActivityBasicUnitController {
List<TreeNode<String>> nodeList = CollUtil.newArrayList();
for (int i = 0; i < list.size(); i++) {
// 活动单位的部门类别允许为空,使用可接收 null 的 Map 保存树节点扩展属性。
Map<String, Object> extra = new HashMap<>();
extra.put("unitType", list.get(i).getUnitType());
extra.put("unitTypeCode", list.get(i).getUnitTypeCode());
nodeList.add(new TreeNode<>(list.get(i).getId(), list.get(i).getParentId(), list.get(i).getName(), i)
.setExtra(
Map.of(
"unitType", list.get(i).getUnitType(),
"unitTypeCode", list.get(i).getUnitTypeCode()
)
));
.setExtra(extra));
}
List<Tree<String>> treeList = TreeUtil.build(nodeList, StrUtil.blankToDefault(pid, "0"));
@@ -10,7 +10,6 @@ import com.budwk.app.base.result.Result;
import com.budwk.app.sys.models.Sys_home_activity;
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicSettings;
import com.budwk.app.zhgh.activity.culture.models.ActivityTissue;
import com.budwk.app.zhgh.activity.culture.models.ActivityTissuePerson;
import com.budwk.app.zhgh.activity.culture.service.ActivityCultureService;
import io.swagger.annotations.ApiOperation;
import org.nutz.aop.interceptor.ioc.TransAop;
@@ -81,14 +80,18 @@ public class ActivityCultureInfoManageController {
return Result.success();
}
/**
* 删除指定文化活动及其关联流程。
*
* @param id 文化活动主表 ID,由活动列表当前行传入
* @return Result 成功响应,code 为 0;不返回业务数据
*/
@At
@Aop(TransAop.READ_COMMITTED)
@SLog(tag = "文化活动", msg = "删除了一条活动")
@SaCheckPermission(value = {"activity.culture.infoManage.school", "activity.culture.infoManage.union", "activity.culture.infoManage.club"}, mode = SaMode.OR)
public Result doDelete(@Valid String id) {
activityCultureService.delete(id);
activityCultureService.dao().clear(ActivityTissuePerson.class, Cnd.where(ActivityTissuePerson::getTissueId, "=", id));
activityCultureService.dao().delete(Sys_home_activity.class, id);
activityCultureService.doDeleteActivity(id);
return Result.success();
}
@@ -21,6 +21,13 @@ public interface ActivityCultureService extends BaseService<ActivityTissue> {
void doEditActivity(ActivityTissue tissue);
/**
* 删除文化活动及关联的 WF 流程任务、实例;未发起流程时仅删除业务数据。
*
* @param id 文化活动主表 ID,同时作为 WF 流程的 businessNo
*/
void doDeleteActivity(String id);
Object pageData(PageForm page, String year, String name, String unionId, Integer activity_type);
NutMap findOne(String id);
@@ -5,6 +5,8 @@ import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.model.Audit;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.flow.engine.FlowEngine;
import com.budwk.app.sys.models.Sys_home_activity;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.activity.culture.models.ActivityTissue;
@@ -12,11 +14,13 @@ import com.budwk.app.zhgh.activity.culture.models.ActivityTissuePerson;
import com.budwk.app.zhgh.activity.culture.service.ActivityCultureService;
import com.budwk.app.zhgh.club.model.SysClub;
import com.budwk.app.zhgh.club.service.SysClubService;
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.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.Strings;
@@ -40,6 +44,9 @@ public class ActivityCultureServiceImpl extends BaseServiceImpl<ActivityTissue>
@Inject
private SysClubService sysClubService;
@Inject
private FlowEngine flowEngine;
@Override
public List<NutMap> getUnionData(String activityScopeGroupId) {
if (StrUtil.isBlank(activityScopeGroupId)) {
@@ -74,15 +81,41 @@ public class ActivityCultureServiceImpl extends BaseServiceImpl<ActivityTissue>
}
/**
* 在同一事务内删除活动、活动人员、首页活动展示及关联 WF 任务和实例。
*
* @param id 文化活动主表 ID,同时作为 WF 流程的 businessNo
*/
@Override
@Aop(TransAop.READ_COMMITTED)
public void doDeleteActivity(String id) {
delete(id);
dao().clear(ActivityTissuePerson.class, Cnd.where(ActivityTissuePerson::getTissueId, "=", id));
dao().delete(Sys_home_activity.class, id);
// 复用其他“我的申请”页面的删除能力;无流程实例的校工会活动、草稿会直接跳过流程清理。
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id);
}
@Override
public void doEditActivity(ActivityTissue tissue) {
update(tissue);
}
/**
* 按当前用户的数据权限分页返回文化活动及其流程任务信息。
*
* @param page 分页及排序参数,包含页码、每页条数和排序字段、方向
* @param year 申请年份,如 2026;为空时不限定年份
* @param name 活动名称关键字;为空时不限定名称
* @param unionId 所属工会 ID;为空时不限定工会
* @param activity_type 活动类型:40001 校工会、40002 分工会、40003 协会
* @return Pagination 分页对象,list 包含活动、流程实例和任务字段,totalCount 为查询总条数
*/
@Override
public Object pageData(PageForm page, String year, String name, String unionId, Integer activity_type) {
Cnd cnd = Cnd.NEW();
// 列表不使用任务参与人字段,不关联参与人表,避免同一任务因多名审批人重复显示。
Sql sql = Sqls.create("""
SELECT
tissue.*,
@@ -112,7 +145,6 @@ public class ActivityCultureServiceImpl extends BaseServiceImpl<ActivityTissue>
LEFT JOIN activity_basic_settings abs ON abs.`code`=tissue.projectTypeCode
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = tissue.id
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
$condition
""");
@@ -131,7 +163,7 @@ public class ActivityCultureServiceImpl extends BaseServiceImpl<ActivityTissue>
if (AuthUtil.hasRoleOr(RoleConstant.BRANCH_UNION_ADMIN.name(), RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
group.or("tissue.unionId", "=", SecurityUtil.getUnionId());
}
if (AuthUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name())) {
if (AuthUtil.hasRole(RoleConstant.CLUB_MANAGER.name())) {
List<SysClub> myManageClub = sysClubService.getMyManageClub();
List<String> clubIds = myManageClub.stream().map(SysClub::getId).collect(Collectors.toList());
group.or("tissue.clubId", "in", clubIds);
@@ -223,7 +223,8 @@ public class ActivityDeclareMineController {
});
// 协会负责人审核
doneTaskVos.stream().filter(task -> "协会负责人审核".equals(task.getDisplayName()))
// 同时识别历史与新版节点名称,确保导出保留两种流程版本的负责人审批意见。
doneTaskVos.stream().filter(task -> ("协会负责人审核".equals(task.getDisplayName()) || "俱乐部负责人审核".equals(task.getDisplayName())))
.max(Comparator.comparing(ProcessTaskVO::getCreatedAt))
.ifPresent(v -> {
Dict taskFormData = v.getTaskFormData();
@@ -27,7 +27,7 @@ public enum ActivityDeclareReimbursement {
/**
* 协会
*/
CLUB("协会活动");
CLUB("俱乐部活动");
private final String typeName;
}
@@ -110,7 +110,7 @@ public class ActivityReimbursementBoardController {
list.add(new NutMap() {{
put("year", year);
put("type", "社团活动");
put("type", "俱乐部活动");
put("num", activityReimbursementService.count(sql.setParam("type", "ACTIVITY_BUDGET_TYPE_THREE").setParam("year", year)));
}});
}
@@ -145,7 +145,7 @@ public class ActivityReimbursementBoardController {
put("num", activityReimbursementService.count(sql.setParam("type", "ACTIVITY_BUDGET_TYPE_TWO")));
}});
list.add(new NutMap() {{
put("type", "社团活动");
put("type", "俱乐部活动");
put("num", activityReimbursementService.count(sql.setParam("type", "ACTIVITY_BUDGET_TYPE_THREE")));
}});
return Result.success(list);
@@ -191,7 +191,7 @@ public class ActivityReimbursementBoardController {
list.add(new NutMap() {{
put("year", year);
put("type", "社团费用");
put("type", "俱乐部费用");
put("num", activityReimbursementService.list(sql.setParam("type", "ACTIVITY_BUDGET_TYPE_THREE").setParam("year", year)).get(0).getDouble("money"));
}});
}
@@ -218,7 +218,7 @@ public class ActivityReimbursementBoardController {
put("num", activityReimbursementService.count(unionSql));
}});
list.add(new NutMap() {{
put("type", "社团费用");
put("type", "俱乐部费用");
put("num", activityReimbursementService.count(clubSql));
}});
return Result.success().addData(list);
@@ -325,7 +325,8 @@ public class ActivityReimbursementMineController {
});
// 协会负责人审核
doneTaskVos.stream().filter(task -> "协会负责人审核".equals(task.getDisplayName()))
// 同时识别历史与新版节点名称,确保导出保留两种流程版本的负责人审批意见。
doneTaskVos.stream().filter(task -> ("协会负责人审核".equals(task.getDisplayName()) || "俱乐部负责人审核".equals(task.getDisplayName())))
.max(Comparator.comparing(ProcessTaskVO::getCreatedAt))
.ifPresent(v -> {
Dict taskFormData = v.getTaskFormData();
@@ -57,7 +57,7 @@ public class CommonPageParam extends PageForm {
RoleConstant.BRANCH_UNION_OPERATOR.name())) {
group.or(prefix + "unionid", "=", SecurityUtil.getUnionId());
}
if (AuthUtil.hasRoleOr(RoleConstant.CLUB_MANAGER.name(), RoleConstant.CLUB_PRESIDENT.name())) {
if (AuthUtil.hasRoleOr(RoleConstant.CLUB_MANAGER.name())) {
// cnd.and(prefix + "clubId", "=", );
group.or(prefix + "clubId", "in", SecurityUtil.getClubIds());
}
@@ -145,7 +145,7 @@ public class YearPlanController {
@SaCheckPermission("planSummary.yearPlan.manage")
public Result queryClub() {
Cnd cnd = Cnd.NEW();
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name()) && AuthUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name())) {
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name()) && AuthUtil.hasRole(RoleConstant.CLUB_MANAGER.name())) {
List<SysClub> clubList = sysClubService.getMyManageClub();
List<String> list = clubList.stream().map(SysClub::getId).toList();
cnd.and(SysClub::getId, "in", list);
@@ -71,7 +71,7 @@ public class YearPlanServiceImpl extends BaseServiceImpl<YearPlan> implements Ye
if(AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
group.or("yp.tissueId", "=", SecurityUtil.getUnionId());
}
if(AuthUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name())) {
if(AuthUtil.hasRole(RoleConstant.CLUB_MANAGER.name())) {
List<SysClub> clubList = sysClubService.getMyManageClub();
List<String> list = clubList.stream().map(SysClub::getId).toList();
group.or("yp.tissueId", "in", list);
@@ -68,7 +68,7 @@ public class YearSummaryServiceImpl extends BaseServiceImpl<YearSummary> impleme
if(AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
group.or("ys.tissueId", "=", SecurityUtil.getUnionId());
}
if(AuthUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name())) {
if(AuthUtil.hasRole(RoleConstant.CLUB_MANAGER.name())) {
List<SysClub> clubList = sysClubService.getMyManageClub();
List<String> list = clubList.stream().map(SysClub::getId).toList();
group.or("ys.tissueId", "in", list);
@@ -73,6 +73,7 @@ public class TrainSignUpAdjustController {
public Result pageData(PageForm pageForm,
@Param(value = "activityId") String activityId) {
Pagination pagination = trainSignUpActivityStatisticsService.pageData(pageForm, activityId);
fillMaxPeopleNumber(pagination.getList());
return Result.success(pagination);
}
@@ -103,9 +104,32 @@ public class TrainSignUpAdjustController {
c.put("registerNum", trainSignUpActivityStatisticsService.queryCourseCount(c.getString("id"), c.getString("courseType")));
c.put("hasWaitingNum", trainSignUpActivityStatisticsService.queryCourseWaitCount(c.getString("id"), c.getString("courseType")));
});
fillMaxPeopleNumber(courseList);
return Result.success(courseList);
}
private void fillMaxPeopleNumber(List<NutMap> rows) {
if (rows == null || rows.isEmpty()) return;
List<String> courseIds = rows.stream().map(v -> v.getString("id")).toList();
List<TrainSignUpCourse> courses = dao.query(TrainSignUpCourse.class, Cnd.where("id", "in", courseIds));
List<TrainSignUpActivityCourse> times = dao.query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "in", courseIds));
NutMap maximums = NutMap.NEW();
for (TrainSignUpCourse course : courses) {
Long maximum = course.getCoursePeopleNumber() > 0 ? (long) course.getCoursePeopleNumber() : null;
if (Boolean.TRUE.equals(course.getCourseIsLimitApply())) {
long timeTotal = times.stream().filter(v -> course.getId().equals(v.getCourseId()))
.mapToLong(v -> v.getCourseLimitNum() == null ? 0 : v.getCourseLimitNum()).sum();
maximum = maximum == null ? timeTotal : Math.min(maximum, timeTotal);
}
if (course.getUnionLimit() != null && !course.getUnionLimit().isEmpty()) {
long unionTotal = course.getUnionLimit().stream().mapToLong(v -> v.getInt("limitCount", 0)).sum();
maximum = maximum == null ? unionTotal : Math.min(maximum, unionTotal);
}
maximums.put(course.getId(), maximum);
}
rows.forEach(v -> v.put("maxPeopleNumber", maximums.get(v.getString("id"))));
}
@At
@ApiOperation("报名用户列表")
@SaCheckPermission("trainSignUp.adjust")
@@ -86,6 +86,7 @@ public class TrainSignUpApplyController {
@Param(value = "id") String id,
@Param(value = "dataType") String dataType) {
Cnd cnd = Cnd.NEW();
cnd.and("isDisabled", "=", false);
cnd.andEX("id", "=", id);
cnd.andEX("`year`", "=", year);
//查询报名中
@@ -150,6 +151,7 @@ public class TrainSignUpApplyController {
Cnd cnd = Cnd.NEW();
cnd.andEX("type.id", "=", courseTypeId);
cnd.and("tsuc.activityId", "=", activityId);
cnd.and(new Static("tsuc.activityId in (select id from train_sign_up_activity where isDisabled = 0)"));
if (Lang.isNotEmpty(assortTypes)) {
cnd.and("tsuc.assort", "in", assortTypes);
@@ -174,6 +176,7 @@ public class TrainSignUpApplyController {
List<TrainSignUpActivityCourse> courseTimes = dao.query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", c.getString("id")).asc("courseDate"));
c.put("courseTimes", courseTimes);
c.put("quotaScope", "活动");
c.put("hasRegisterNum", statisticsService.queryCourseCount(c.getString("id"), c.getString("courseType")));
c.put("hasWaitingNum", statisticsService.queryCourseWaitCount(c.getString("id"), c.getString("courseType")));
//当前用户是否报过
@@ -184,10 +187,16 @@ public class TrainSignUpApplyController {
if (Lang.isNotEmpty(unionLimit)) {
NutMap nutMap = unionLimit.stream().filter(o -> o.getString("id").equals(SecurityUtil.getUnionId())).findFirst().orElse(null);
if (nutMap != null) {
c.put("quotaScope", "本工会");
c.put("coursePeopleNumber", nutMap.getInt("limitCount"));
c.put("hasRegisterNum", statisticsService.queryCourseCount(c.getString("id"), c.getString("courseType"), SecurityUtil.getUnionId()));
c.put("courseReservedNumber", 0);
}
}
}
Date now = new Date();
c.put("allTimesExpired", !courseTimes.isEmpty() && courseTimes.stream()
.allMatch(v -> v.getCourseEndTime() != null && !v.getCourseEndTime().after(now)));
});
return Result.success(pagination);
}
@@ -225,7 +234,11 @@ public class TrainSignUpApplyController {
currentFamilyNumber = currentFamilyNumber != null ? currentFamilyNumber : 0;
TrainSignUpCourse course = dao.fetch(TrainSignUpCourse.class, courseId);
if (course == null) return Result.error("子活动不存在");
TrainSignUpActivity activity = dao.fetch(TrainSignUpActivity.class, course.getActivityId());
if (activity == null || activity.isDisabled()) {
return Result.error("活动已关闭或不存在,无法报名");
}
//判断时间
if (DateUtil.compare(new Date(), activity.getActivitySignUpStartTime(), "yyyy-MM-dd HH:mm:ss") < 0) {
@@ -282,6 +295,23 @@ public class TrainSignUpApplyController {
@ApiOperation("查询子活动时间段")
@SaCheckPermission(value = {"trainSignUp.apply", "h5.trainSignUp.apply"}, mode = SaMode.OR)
public Result getCourseTimeSelectList(String courseId) {
TrainSignUpCourse course = dao.fetch(TrainSignUpCourse.class, courseId);
if (course == null) return Result.error("子活动不存在");
int normalRemaining = Integer.MAX_VALUE;
if (course.getCoursePeopleNumber() > 0) {
normalRemaining = Math.max(0, course.getCoursePeopleNumber() - course.getCourseReservedNumber()
- statisticsService.queryCourseCount(courseId, course.getCourseType()));
}
if (Lang.isNotEmpty(course.getUnionLimit())) {
String unionId = SecurityUtil.getUnionId();
NutMap union = course.getUnionLimit().stream().filter(v -> v.getString("id").equals(unionId)).findFirst().orElse(null);
int unionRemaining = union == null || StrUtil.isBlank(unionId) ? 0 : Math.max(0, union.getInt("limitCount")
- statisticsService.queryCourseCount(courseId, course.getCourseType(), unionId));
normalRemaining = Math.min(normalRemaining, unionRemaining);
}
final int availableNormal = normalRemaining;
boolean signFull = trainSignUpActivityService.isSignFull(course, 0)
|| trainSignUpActivityService.isSignFullByUnionId(course, 0);
// 查课程的时间段
List<TrainSignUpActivityCourse> courseList = dao.query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", courseId).asc("courseStartTime"));
@@ -299,14 +329,20 @@ public class TrainSignUpApplyController {
String id = v.getId();
NutMap nutMap = NutMap.NEW();
List<TrainSignUpUserCourse> trainSignUpUserCourses = collectMap.get(id);
int remainingNum = v.getCourseLimitNum() != null ? v.getCourseLimitNum() : 0;
if (Lang.isNotEmpty(trainSignUpUserCourses)) {
remainingNum = v.getCourseLimitNum() - trainSignUpUserCourses.size();
}
int timeRemaining = Math.max(0, (v.getCourseLimitNum() == null ? 0 : v.getCourseLimitNum())
- (trainSignUpUserCourses == null ? 0 : trainSignUpUserCourses.size()));
int remainingNum = Math.min(timeRemaining, availableNormal);
boolean expired = v.getCourseEndTime() == null || !v.getCourseEndTime().after(new Date());
boolean disabled = expired || signFull || timeRemaining == 0;
nutMap.put("remainingNum", remainingNum);
nutMap.put("text", DateUtil.format(v.getCourseStartTime(), "MM月dd日 HH:mm") + "至" + DateUtil.format(v.getCourseEndTime(), "HH:mm") + "段(剩" + remainingNum + ")");
nutMap.put("limitNum", v.getCourseLimitNum() == null ? 0 : v.getCourseLimitNum());
String timeText = DateUtil.format(v.getCourseStartTime(), "MM月dd日 HH:mm") + " - " + DateUtil.format(v.getCourseEndTime(), "HH:mm");
nutMap.put("timeText", timeText);
nutMap.put("text", timeText + " (余" + remainingNum + ")");
nutMap.put("expired", expired);
nutMap.put("endTime", v.getCourseEndTime() == null ? 0 : v.getCourseEndTime().getTime());
nutMap.put("value", id);
nutMap.put("disabled", remainingNum == 0);
nutMap.put("disabled", disabled);
return nutMap;
}).toList();
return Result.success(list);
@@ -319,15 +355,27 @@ public class TrainSignUpApplyController {
try {
lock.lock();
if (StrUtil.isBlank(activityCourseId) || StrUtil.isBlank(courseId)) {
return Result.error("请选择报名时间段");
}
TrainSignUpActivityCourse course = dao.fetch(TrainSignUpActivityCourse.class, activityCourseId);
if (course == null || !courseId.equals(course.getCourseId())) {
return Result.error("报名时间段无效,请重新选择");
}
if (course.getCourseEndTime() == null || !course.getCourseEndTime().after(new Date())) {
return Result.error("该时间段已结束,无法报名,请重新选择");
}
List<TrainSignUpUser> userList = dao.query(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId).and("state", "=", 1));
List<String> isList = userList.stream().map(TrainSignUpUser::getUserId).toList();
// 该时间段下已报名的人数
int count = dao.count(TrainSignUpUserCourse.class, Cnd.where("activityCourseId", "=", activityCourseId)
int count = isList.isEmpty() ? 0 : dao.count(TrainSignUpUserCourse.class, Cnd.where("activityCourseId", "=", activityCourseId)
.and("courseId", "=", courseId).and("userId", "in", isList));
// 获取该时间段下的活动课程限制报名人数
TrainSignUpActivityCourse course = dao.fetch(TrainSignUpActivityCourse.class, activityCourseId);
Integer courseLimitNum = course.getCourseLimitNum();
if (courseLimitNum == null || courseLimitNum < 1) {
return Result.error("该时间段名额设置无效,暂不能报名");
}
// 报名加上自己,如果大于了限制人数,那就无法报名
if (count + 1 > courseLimitNum) {
return Result.error("该时间段名额已报满,请选择其他时段报名");
@@ -356,6 +404,11 @@ public class TrainSignUpApplyController {
//判断人数
int number = 0;
TrainSignUpCourse course = trainSignUpActivityService.dao().fetch(TrainSignUpCourse.class, trainSignUpUser.getCourseId());
if (course == null) return Result.error("子活动不存在");
TrainSignUpActivity activity = dao.fetch(TrainSignUpActivity.class, course.getActivityId());
if (activity == null || activity.isDisabled()) {
return Result.error("活动已关闭或不存在,无法报名");
}
TrainSignUpType type = trainSignUpActivityService.dao().fetch(TrainSignUpType.class, course.getCourseType());
if (type != null) {
if (type.getIsBringFamily() && type.getIsAddFamily()) {
@@ -372,6 +425,12 @@ public class TrainSignUpApplyController {
if (signFullByUnionId) {
return Result.error("该活动您所在的分工会名额不足");
}
if (Boolean.TRUE.equals(course.getCourseIsLimitApply())) {
Result timeResult = validateSourceSignUp(trainSignUpUser.getActivityCourseId(), course.getId());
if (!timeResult.isSuccess()) {
return timeResult;
}
}
trainSignUpActivityService.doSignUp(trainSignUpUser);
return Result.success("报名成功");
} catch (Exception e) {
@@ -154,6 +154,26 @@ public class TrainSignUpManageController {
@SaCheckPermission("trainSignUp.manage")
@SLog(tag = "品牌活动-活动管理", msg = "新增/修改活动")
public Result doHandle(TrainSignUpActivity activity) {
if (activity.getCourseList() != null) {
for (int i = 0; i < activity.getCourseList().size(); i++) {
TrainSignUpCourse course = activity.getCourseList().get(i);
int peopleNumber = course.getCoursePeopleNumber();
if (peopleNumber <= 0) continue;
if (Boolean.TRUE.equals(course.getCourseIsLimitApply()) && course.getCourseTimeList() != null) {
long timeTotal = course.getCourseTimeList().stream()
.mapToLong(v -> v.getCourseLimitNum() == null ? 0 : v.getCourseLimitNum()).sum();
if (timeTotal > peopleNumber) {
return Result.error("第" + (i + 1) + "行各时间段限制人数合计为" + timeTotal + "人,不能超过子活动人数" + peopleNumber + "人");
}
}
if (course.getUnionLimit() != null) {
long unionTotal = course.getUnionLimit().stream().mapToLong(v -> v.getInt("limitCount", 0)).sum();
if (unionTotal > peopleNumber) {
return Result.error("第" + (i + 1) + "行分工会限制总人数为" + unionTotal + "人,不能超过子活动人数" + peopleNumber + "人");
}
}
}
}
if (StrUtil.isBlank(activity.getId())) {
trainSignUpActivityManageService.add(activity, null);
} else {
@@ -70,6 +70,28 @@ public class TrainSignUpActivityStatisticsController {
@Inject
private Dao dao;
private void fillMaxPeopleNumber(List<NutMap> rows) {
if (rows == null || rows.isEmpty()) return;
List<String> courseIds = rows.stream().map(v -> v.getString("id")).toList();
List<TrainSignUpCourse> courses = dao.query(TrainSignUpCourse.class, Cnd.where("id", "in", courseIds));
List<TrainSignUpActivityCourse> times = dao.query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "in", courseIds));
NutMap maximums = NutMap.NEW();
for (TrainSignUpCourse course : courses) {
Long maximum = course.getCoursePeopleNumber() > 0 ? (long) course.getCoursePeopleNumber() : null;
if (Boolean.TRUE.equals(course.getCourseIsLimitApply())) {
long timeTotal = times.stream().filter(v -> course.getId().equals(v.getCourseId()))
.mapToLong(v -> v.getCourseLimitNum() == null ? 0 : v.getCourseLimitNum()).sum();
maximum = maximum == null ? timeTotal : Math.min(maximum, timeTotal);
}
if (course.getUnionLimit() != null && !course.getUnionLimit().isEmpty()) {
long unionTotal = course.getUnionLimit().stream().mapToLong(v -> v.getInt("limitCount", 0)).sum();
maximum = maximum == null ? unionTotal : Math.min(maximum, unionTotal);
}
maximums.put(course.getId(), maximum);
}
rows.forEach(v -> v.put("maxPeopleNumber", maximums.get(v.getString("id"))));
}
@At("")
@SaCheckPermission("trainSignUp.statistics")
@Ok("beetl:/platform/zhgh/activity/trainSignUp/statistics/index.html")
@@ -82,6 +104,7 @@ public class TrainSignUpActivityStatisticsController {
public Result pageData(PageForm pageForm,
@Param(value = "activityId") String activityId) {
Pagination pagination = trainSignUpActivityStatisticsService.pageData(pageForm, activityId);
fillMaxPeopleNumber(pagination.getList());
return Result.success(pagination);
}
@@ -109,7 +132,7 @@ public class TrainSignUpActivityStatisticsController {
result.add(activity);
}
}
if(AuthUtil.hasRoleOr(RoleConstant.CLUB_PRESIDENT.name(), RoleConstant.CLUB_OPERATOR.name())) {
if(AuthUtil.hasRoleOr(RoleConstant.CLUB_MANAGER.name(), RoleConstant.CLUB_OPERATOR.name())) {
if(clubIds.stream().anyMatch(activity.getHostUnits()::contains) || clubIds.stream().anyMatch(activity.getHelpUnits()::contains)) {
result.add(activity);
}
@@ -325,7 +325,7 @@ public class TrainSignUpActivityServiceImpl extends BaseServiceImpl<TrainSignUpA
TrainSignUpCourse course = dao().fetch(TrainSignUpCourse.class, trainSignUpUser.getCourseId());
TrainSignUpType type = dao().fetch(TrainSignUpType.class, course.getCourseType());
//如果这个课程的预留名额方式为报名人数不变
if (course.getReserveMode() == 2) {
if (course.getReserveMode() == 2 && course.getCoursePeopleNumber() > 0) {
//如果当前报名+已报小于这个课程限制人数
//课程已报人数
int normalCount = statisticsService.queryCourseCount(course.getId(), course.getCourseType());
@@ -424,7 +424,7 @@ public class TrainSignUpActivityServiceImpl extends BaseServiceImpl<TrainSignUpA
//课程限制人数
int coursePeopleNumber = course.getCoursePeopleNumber();
if (coursePeopleNumber == 0) {
return true;
return false;
}
//查询课程对应的类型
TrainSignUpType type = dao().fetch(TrainSignUpType.class, course.getCourseType());
@@ -123,7 +123,7 @@ public class ClubUserJoinApplyController {
if (ObjectUtil.isNotEmpty(userApply) && StrUtil.isBlank(userApply.getId())) {
ProcessInstance processInstance = dao.fetch(ProcessInstance.class, Cnd.where(ProcessInstance::getBusinessNo, "=", userApply.getId()));
if (!List.of(ProcessInstanceStateEnum.REJECT.getCode(),ProcessInstanceStateEnum.FINISHED.getCode()).contains(processInstance.getState())) {
return Result.error("您有该协会的申请记录尚未完成,请到我的申请里查看!");
return Result.error("您有该俱乐部的申请记录尚未完成,请到我的申请里查看!");
}
}
@@ -178,7 +178,7 @@ public class ClubUserJoinApplyController {
ProcessInstance processInstance = dao.fetch(ProcessInstance.class, Cnd.where(ProcessInstance::getBusinessNo, "=", userApply.getId()));
if (!List.of(ProcessInstanceStateEnum.REJECT.getCode(),ProcessInstanceStateEnum.FINISHED.getCode()).contains(processInstance.getState())) {
return Result.error(99, "您有该协会的申请记录尚未完成,请到我的申请里查看!");
return Result.error(99, "您有该俱乐部的申请记录尚未完成,请到我的申请里查看!");
}
return Result.success();
}
@@ -63,7 +63,7 @@ public class ClubUserMineClubController {
FROM
sys_club club
LEFT JOIN club_user uc ON club.id = uc.clubId
LEFT JOIN club_user presidentCu ON presidentCu.clubId = club.id AND JSON_CONTAINS(presidentCu.roleCode, '"CLUB_PRESIDENT"')
LEFT JOIN club_user presidentCu ON presidentCu.clubId = club.id AND JSON_CONTAINS(presidentCu.roleCode, '"CLUB_MANAGER"')
LEFT JOIN sys_user presidentUser ON presidentUser.id = presidentCu.userId
LEFT JOIN club_user secretaryCu ON secretaryCu.clubId = club.id AND JSON_CONTAINS(secretaryCu.roleCode, '"CLUB_SECRETARY"')
LEFT JOIN sys_user secretaryUser ON secretaryUser.id = secretaryCu.userId
@@ -62,7 +62,7 @@ public class ClubCommonController {
public Result listClubByRole() {
Cnd cnd = Cnd.NEW();
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_PRESIDENT);
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_MANAGER);
List<Sys_user_role> userRoles = sysClubService.dao().query(Sys_user_role.class, Cnd.where("userId", "=", SecurityUtil.getUserId()).and("roleId", "=", sysRole.getId()));
List<String> myClubId = userRoles.stream().map(Sys_user_role::getClubId).toList();
cnd.and("c.id", "in", myClubId);
@@ -63,7 +63,7 @@ public class ClubEvaluateClubAuditController {
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("club.evaluate.clubAudit")
@SLog(tag = "协会管理系统-协会评优", msg = "会长审核评优申请")
@SLog(tag = "协会管理系统-协会评优", msg = "协会负责人审核评优申请")
public Result approval(@Valid @Param("approval") BpmTaskApprovalParam approvalParam) {
approvalParam.getBpmTaskApprovalTypeEnum();
Map<String, Object> variables = BeanUtil.beanToMap(approvalParam);
@@ -80,7 +80,7 @@ public class ClubEvaluateClubAuditController {
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("club.evaluate.clubAudit")
@SLog(tag = "协会管理系统-协会评优", msg = "会长撤回评优申请")
@SLog(tag = "协会管理系统-协会评优", msg = "协会负责人撤回评优申请")
public Result revoke(@Valid String taskId) {
bpmService.revokeTask(taskId);
return Result.success();
@@ -69,7 +69,7 @@ public class ClubExamineApplyController {
@SaCheckLogin
public Result getCount(String id, Integer year) {
if(StrUtil.isBlank(id)) {
return Result.error("协会信息为空,请核查");
return Result.error("俱乐部信息为空,请核查");
}
if(year == null) {
return Result.error("年份信息为空,请核查");
@@ -94,7 +94,7 @@ public class ClubExamineApplyController {
@SaCheckLogin
public Result getClubUserNum(String clubId) {
if(StrUtil.isBlank(clubId)) {
return Result.error("协会信息为空,请核查");
return Result.error("俱乐部信息为空,请核查");
}
List<NutMap> result = sysClubExamineService.getClubUserNum(clubId);
return Result.success(result);
@@ -104,7 +104,7 @@ public class ClubExamineApplyController {
@SaCheckLogin
public Result getJgUser(String clubId) {
if(StrUtil.isBlank(clubId)) {
return Result.error("协会信息为空,请核查");
return Result.error("俱乐部信息为空,请核查");
}
List<NutMap> result = sysClubExamineService.getJgUser(clubId);
return Result.success(result);
@@ -114,7 +114,7 @@ public class ClubExamineApplyController {
@SaCheckLogin
public Result getClubMemberMoney(String clubId) {
if(StrUtil.isBlank(clubId)) {
return Result.error("协会信息为空,请核查");
return Result.error("俱乐部信息为空,请核查");
}
int count = dao.count(ClubUser.class, Cnd.where("clubId", "=", clubId));
SysClub club = dao.fetch(SysClub.class, clubId);
@@ -134,7 +134,7 @@ public class ClubExamineApplyController {
@SaCheckLogin
public Result getLasYearSurplus(String clubId) {
if(StrUtil.isBlank(clubId)) {
return Result.error("协会信息为空,请核查");
return Result.error("俱乐部信息为空,请核查");
}
SysClubExamineRegister register = dao.fetch(SysClubExamineRegister.class, Cnd.where("clubId", "=", clubId)
.and("YEAR(registerDate)", "=", DateUtil.thisYear() - 1));
@@ -57,7 +57,7 @@ public class ClubExamineClubAuditController {
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("club.examine.clubAudit")
@SLog(tag = "协会管理系统-协会年审", msg = "会长审核年度考核")
@SLog(tag = "协会管理系统-协会年审", msg = "协会负责人审核年度考核")
public Result approval(@Valid @Param("approval") BpmTaskApprovalParam approvalParam) {
approvalParam.getBpmTaskApprovalTypeEnum();
Map<String, Object> variables = BeanUtil.beanToMap(approvalParam);
@@ -74,7 +74,7 @@ public class ClubExamineClubAuditController {
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("club.examine.clubAudit")
@SLog(tag = "协会管理系统-协会年审", msg = "会长撤回年度考核")
@SLog(tag = "协会管理系统-协会年审", msg = "协会负责人撤回年度考核")
public Result revoke(@Valid String taskId) {
bpmService.revokeTask(taskId);
return Result.success();
@@ -107,7 +107,7 @@ public class ClubExamineMineController {
.bind("activityQk", activityQk).build();
try {
String fileName = Globals.MyConfig.getString("AppName") + "教职工社团年度考核登记表";
String fileName = Globals.MyConfig.getString("AppName") + "教职工俱乐部年度考核登记表";
response.addHeader("Content-Type", "application/octet-stream");
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
XWPFTemplate.compile(officeTemplateUtil.getPath("club_examine_register"), config).render(map).writeAndClose(response.getOutputStream());
@@ -3,7 +3,11 @@ package com.budwk.app.zhgh.club.controller.infoManage;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.excel.EasyExcel;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import org.apache.poi.ss.usermodel.Workbook;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
@@ -52,7 +56,6 @@ import org.nutz.mvc.upload.UploadAdaptor;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.ByteArrayOutputStream;
import java.util.*;
import java.util.stream.Collectors;
@@ -196,12 +199,12 @@ public class ClubInfoManageController {
@SLog(tag = "协会管理系统-信息管理", msg = "修改身份")
public Result updateRoleCode(@Param("id") String id, @Valid String[] roleCodes, @Valid String clubId) {
List<String> roleCodeList = Arrays.asList(roleCodes);
//查询社团是否存在会长或者秘书长
if(Arrays.asList(roleCodes).contains(RoleConstant.CLUB_PRESIDENT.name())) {
//查询社团是否存在协会负责人或者秘书长
if(Arrays.asList(roleCodes).contains(RoleConstant.CLUB_MANAGER.name())) {
int count = dao.count(ClubUser.class, Cnd.where("clubId", "=", clubId)
.and(new Static("JSON_CONTAINS(roleCode, '\"%s\"')".formatted(RoleConstant.CLUB_PRESIDENT.name()))));
.and(new Static("JSON_CONTAINS(roleCode, '\"%s\"')".formatted(RoleConstant.CLUB_MANAGER.name()))));
if (count > 0) {
// return Result.error("会长只能有一位");
// return Result.error("协会负责人只能有一位");
}
}
if(Arrays.asList(roleCodes).contains(RoleConstant.CLUB_SECRETARY.name())) {
@@ -272,12 +275,12 @@ public class ClubInfoManageController {
@SLog(tag = "协会管理系统-信息管理", msg = "添加协会成员")
public Result userDoAdd(@Valid String clubId, @Valid String[] users, @Valid String roleCode, @Valid Boolean payed) {
//查询社团是否存在会长或者秘书长
if (List.of(RoleConstant.CLUB_PRESIDENT.name(), RoleConstant.CLUB_SECRETARY.name()).contains(roleCode)) {
//查询社团是否存在协会负责人或者秘书长
if (List.of(RoleConstant.CLUB_MANAGER.name(), RoleConstant.CLUB_SECRETARY.name()).contains(roleCode)) {
int count = clubInfoManageService.dao().count(ClubUser.class, Cnd.where("clubId", "=", clubId)
.and(new Static("JSON_CONTAINS(roleCode, '\"%s\"')".formatted(roleCode))));
if (count > 0) {
return Result.error((Objects.equals(roleCode, RoleConstant.CLUB_PRESIDENT.name()) ? "会长" : "秘书长") + "只能有一位");
return Result.error((Objects.equals(roleCode, RoleConstant.CLUB_MANAGER.name()) ? "俱乐部负责人" : "秘书长") + "只能有一位");
}
}
Sys_role sysRole = sysRoleService.getByCode(roleCode);
@@ -295,7 +298,7 @@ public class ClubInfoManageController {
ClubUser clubUser = dao.fetch(ClubUser.class, Cnd.where("clubId", "=", clubId).and("userId", "=", user));
if(clubUser != null) {
List<String> roleCodeList = clubUser.getRoleCode();
if (List.of(RoleConstant.CLUB_PRESIDENT.name(), RoleConstant.CLUB_VICE_PRESIDENT.name(), RoleConstant.CLUB_SECRETARY.name(), RoleConstant.CLUB_VICE_SECRETARY.name(), RoleConstant.CLUB_OPERATOR.name()).contains(roleCode)) {
if (List.of(RoleConstant.CLUB_MANAGER.name(), RoleConstant.CLUB_VICE_PRESIDENT.name(), RoleConstant.CLUB_SECRETARY.name(), RoleConstant.CLUB_VICE_SECRETARY.name(), RoleConstant.CLUB_OPERATOR.name()).contains(roleCode)) {
roleCodeList.remove(RoleConstant.CLUB_MEMBER.name());
}
if(!roleCodeList.contains(roleCode)) {
@@ -315,6 +318,7 @@ public class ClubInfoManageController {
}
@At
@Ok("void")
@SaCheckPermission("club.infoManage.manage")
@ApiOperation("导出登记表")
public void exportRegistrationDoc(@Valid String clubId, HttpServletResponse response){
@@ -325,11 +329,17 @@ public class ClubInfoManageController {
@Ok("void")
@SaCheckPermission("club.infoManage.manage")
public void downloadUserImport(HttpServletResponse response) {
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();){
EasyExcel.write(byteArrayOutputStream, ClubUserImportVo.class)
.sheet("协会会员导入模版")
.doWrite(ArrayList::new);
CommonDownloadUtil.download("协会会员导入模版.xlsx", byteArrayOutputStream.toByteArray() ,response);
// 模板保留工号、姓名两列及一行表头,兼容原有从第2行开始的导入逻辑。
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
exportParams.setSheetName("俱乐部会员导入模版");
exportParams.setAddIndex(false);
List<ExcelExportEntity> columns = Arrays.asList(
new ExcelExportEntity("工号", "loginname", 25),
new ExcelExportEntity("姓名", "username", 25));
try (Workbook workbook = ExcelExportUtil.exportExcel(exportParams, columns, Collections.emptyList())) {
workbook.getSheetAt(0).getRow(0).setHeightInPoints(20);
CommonDownloadUtil.download("俱乐部会员导入模版.xlsx", workbook, response);
} catch (Exception e) {
e.printStackTrace();
}
@@ -360,7 +370,7 @@ public class ClubInfoManageController {
continue;
}
if (clubUsers.stream().anyMatch(s -> s.getUserId().equals(user.getId()))) {
v.setErrorInfo("该用户已加入该协会");
v.setErrorInfo("该用户已加入该俱乐部");
errorInfos.add(v);
continue;
}
@@ -129,7 +129,7 @@ public class ClubRefreshReportController {
List<String> idList = list.stream().map(SysClubRefresh::getId).toList();
int count = dao.count(ProcessInstance.class, Cnd.where(ProcessInstance::getBusinessNo, "in", idList).and(ProcessInstance::getState, "not in", List.of(ProcessInstanceStateEnum.FINISHED.getCode(), ProcessInstanceStateEnum.REJECT.getCode())));
if (count > 0) {
return Result.error("您有该协会的申请记录尚未完成,请核对!");
return Result.error("您有该俱乐部的申请记录尚未完成,请核对!");
}
SysClub club = clubInfoManageService.dao().fetch(SysClub.class, clubRefresh.getClubId());
@@ -128,7 +128,7 @@ public class ClubRuleUpdateController {
List<String> idList = list.stream().map(SysClubRule::getId).toList();
int count = dao.count(ProcessInstance.class, Cnd.where(ProcessInstance::getBusinessNo, "in", idList).and(ProcessInstance::getState, "not in", List.of(ProcessInstanceStateEnum.FINISHED.getCode(), ProcessInstanceStateEnum.REJECT.getCode())));
if (count > 0) {
return Result.error("您有该协会的申请记录尚未完成,请核对!");
return Result.error("您有该俱乐部的申请记录尚未完成,请核对!");
}
SysClub club = clubInfoManageService.dao().fetch(SysClub.class, clubRule.getClubId());
@@ -98,7 +98,7 @@ public class ClubStatisticsController {
cnd.and("id", auditState ? "in" : "not in", registers.stream().map(SysClubExamineRegister::getClubId).toList());
}*/
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name())) {
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_PRESIDENT);
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_MANAGER);
List<Sys_user_role> userRoles = sysClubService.dao().query(Sys_user_role.class, Cnd.where("userId", "=", SecurityUtil.getUserId()).and("roleId", "=", sysRole.getId()));
List<String> myClubId = userRoles.stream().map(Sys_user_role::getClubId).toList();
cnd.and("id", "in", myClubId);
@@ -136,7 +136,7 @@ public class ClubStatisticsController {
$condition
ORDER BY
CASE
WHEN JSON_CONTAINS(c.roleCode, '"CLUB_PRESIDENT"') THEN 1
WHEN JSON_CONTAINS(c.roleCode, '"CLUB_MANAGER"') THEN 1
WHEN JSON_CONTAINS(c.roleCode, '"CLUB_VICE_PRESIDENT"') THEN 2
WHEN JSON_CONTAINS(c.roleCode, '"CLUB_SECRETARY"') THEN 3
WHEN JSON_CONTAINS(c.roleCode, '"CLUB_VICE_SECRETARY"') THEN 4
@@ -186,7 +186,7 @@ public class ClubStatisticsController {
$condition
ORDER BY
CASE
WHEN JSON_CONTAINS(c.roleCode, '"CLUB_PRESIDENT"') THEN 1
WHEN JSON_CONTAINS(c.roleCode, '"CLUB_MANAGER"') THEN 1
WHEN JSON_CONTAINS(c.roleCode, '"CLUB_VICE_PRESIDENT"') THEN 2
WHEN JSON_CONTAINS(c.roleCode, '"CLUB_SECRETARY"') THEN 3
WHEN JSON_CONTAINS(c.roleCode, '"CLUB_VICE_SECRETARY"') THEN 4
@@ -196,7 +196,7 @@ public class ClubStatisticsController {
""");
Cnd cnd = Cnd.NEW();
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name())) {
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_PRESIDENT);
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_MANAGER);
List<Sys_user_role> userRoles = sysClubService.dao().query(Sys_user_role.class, Cnd.where("userId", "=", SecurityUtil.getUserId()).and("roleId", "=", sysRole.getId()));
List<String> myClubId = userRoles.stream().map(Sys_user_role::getClubId).toList();
cnd.and("c.clubId", "in", myClubId);
@@ -268,9 +268,9 @@ public class ClubStatisticsController {
List<NutMap> list = sysClubService.listMap(sql);
List<ExcelExportEntity> exportEntities = new ArrayList<>();
exportEntities.add(new ExcelExportEntity("社团名称", "clubName", 20));
exportEntities.add(new ExcelExportEntity("俱乐部名称", "clubName", 20));
exportEntities.add(new ExcelExportEntity("编码", "clubCode", 20));
exportEntities.add(new ExcelExportEntity("社团总人数", "total", 20));
exportEntities.add(new ExcelExportEntity("俱乐部总人数", "total", 20));
exportEntities.add(new ExcelExportEntity("在职人数", "work", 20));
exportEntities.add(new ExcelExportEntity("退休人数", "retire", 20));
exportEntities.add(new ExcelExportEntity("男", "man", 20));
@@ -279,7 +279,7 @@ public class ClubStatisticsController {
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
CommonDownloadUtil.download("协会统计表.xlsx", workbook, response);
CommonDownloadUtil.download("俱乐部统计表.xlsx", workbook, response);
}
@At
@@ -371,7 +371,7 @@ public class ClubStatisticsController {
sum( CASE WHEN su.userState in ('退休') $myCondition THEN 1 ELSE 0 END ) AS retire,
sum( CASE WHEN su.sex like '%男%' $myCondition THEN 1 ELSE 0 END ) AS man,
sum( CASE WHEN su.sex like '%女%' $myCondition THEN 1 ELSE 0 END ) AS woman,
sum( CASE WHEN ('CLUB_PRESIDENT' MEMBER OF (cu.roleCode) or 'CLUB_VICE_PRESIDENT' MEMBER OF (cu.roleCode) or 'CLUB_SECRETARY' MEMBER OF (cu.roleCode) or 'CLUB_VICE_SECRETARY' MEMBER OF (cu.roleCode)) AND 1 = 1 $myCondition THEN 1 ELSE 0 END ) AS governing_body
sum( CASE WHEN ('CLUB_MANAGER' MEMBER OF (cu.roleCode) or 'CLUB_VICE_PRESIDENT' MEMBER OF (cu.roleCode) or 'CLUB_SECRETARY' MEMBER OF (cu.roleCode) or 'CLUB_VICE_SECRETARY' MEMBER OF (cu.roleCode)) AND 1 = 1 $myCondition THEN 1 ELSE 0 END ) AS governing_body
FROM
sys_club club
LEFT JOIN club_user cu ON cu.clubId = club.id
@@ -389,7 +389,7 @@ public class ClubStatisticsController {
cnd.and("club.id", auditState ? "in" : "not in", businessNoList);
}
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name())) {
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_PRESIDENT);
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_MANAGER);
List<Sys_user_role> userRoles = sysClubService.dao().query(Sys_user_role.class, Cnd.where("userId", "=", SecurityUtil.getUserId()).and("roleId", "=", sysRole.getId()));
List<String> myClubId = userRoles.stream().map(Sys_user_role::getClubId).toList();
cnd.and("club.id", "in", myClubId);
@@ -34,19 +34,19 @@ public class SysClub extends BaseModel {
@Column
@Comment("协会名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
@NotEmpty(message = "协会名称不能为空")
@NotEmpty(message = "俱乐部名称不能为空")
private String clubName;
@Column
@Comment("协会编码")
@ColDefine(type = ColType.VARCHAR, width = 100)
@NotEmpty(message = "协会编码不能为空")
@NotEmpty(message = "俱乐部编码不能为空")
private String clubCode;
@Column
@Comment("协会类型")
@ColDefine(type = ColType.VARCHAR, width = 30)
@NotEmpty(message = "协会类型不能为空")
@NotEmpty(message = "俱乐部类型不能为空")
private String clubType;
@Column
@@ -34,7 +34,7 @@ public class SysClubEvaluate extends BaseModel {
@Column
@Comment("协会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@NotEmpty(message = "协会id不能为空")
@NotEmpty(message = "俱乐部id不能为空")
private String clubId;
@Column
@@ -31,7 +31,7 @@ public class SysClubSponsor extends BaseModel {
@Column
@Comment("协会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@NotEmpty(message = "协会不能为空")
@NotEmpty(message = "俱乐部不能为空")
private String clubId;
@Column
@@ -108,7 +108,7 @@ public class SysClubExamineServiceImpl extends BaseServiceImpl<SysClubExamineReg
AND NOT JSON_CONTAINS(cl.roleCode, '"CLUB_MEMBER"')
ORDER BY
CASE
WHEN JSON_CONTAINS(cl.roleCode, '"CLUB_PRESIDENT"') THEN 1
WHEN JSON_CONTAINS(cl.roleCode, '"CLUB_MANAGER"') THEN 1
WHEN JSON_CONTAINS(cl.roleCode, '"CLUB_VICE_PRESIDENT"') THEN 2
WHEN JSON_CONTAINS(cl.roleCode, '"CLUB_SECRETARY"') THEN 3
WHEN JSON_CONTAINS(cl.roleCode, '"CLUB_VICE_SECRETARY"') THEN 4
@@ -86,7 +86,7 @@ public class SysClubInfoManageServiceImpl extends BaseServiceImpl<ClubCommonPage
GROUP_CONCAT(secretaryUser.username) AS clubSecretary
FROM
sys_club c
LEFT JOIN club_user presidentCu on presidentCu.clubId = c.id AND JSON_CONTAINS(presidentCu.roleCode, '"CLUB_PRESIDENT"')
LEFT JOIN club_user presidentCu on presidentCu.clubId = c.id AND JSON_CONTAINS(presidentCu.roleCode, '"CLUB_MANAGER"')
LEFT JOIN sys_user presidentUser on presidentUser.id = presidentCu.userId
LEFT JOIN club_user secretaryCu on secretaryCu.clubId = c.id AND JSON_CONTAINS(secretaryCu.roleCode, '"CLUB_SECRETARY"')
LEFT JOIN sys_user secretaryUser on secretaryUser.id = secretaryCu.userId
@@ -115,7 +115,7 @@ public class SysClubInfoManageServiceImpl extends BaseServiceImpl<ClubCommonPage
cnd.and("ins.state", "=", ProcessInstanceStateEnum.FINISHED.getCode());
// 校工会主席在协会管理界面按校级管理角色查看全部协会。
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name(), RoleConstant.SCHOOL_UNION_CHAIRMAN.name())) {
List<String> roleList = commonService.findUserRoleByRoleCode(List.of(RoleConstant.CLUB_PRESIDENT.name(), RoleConstant.CLUB_VICE_PRESIDENT.name(), RoleConstant.CLUB_SECRETARY.name(), RoleConstant.CLUB_VICE_SECRETARY.name(), RoleConstant.CLUB_OPERATOR.name()));
List<String> roleList = commonService.findUserRoleByRoleCode(List.of(RoleConstant.CLUB_MANAGER.name(), RoleConstant.CLUB_VICE_PRESIDENT.name(), RoleConstant.CLUB_SECRETARY.name(), RoleConstant.CLUB_VICE_SECRETARY.name(), RoleConstant.CLUB_OPERATOR.name()));
List<Sys_user_role> clubList = dao().query(Sys_user_role.class, Cnd.where("roleId", "in", roleList).and("userId", "=", SecurityUtil.getUserId()).and("clubId", "is not", null));
List<String> clubIdList = clubList.stream().map(Sys_user_role::getClubId).toList();
@@ -167,7 +167,7 @@ public class SysClubInfoManageServiceImpl extends BaseServiceImpl<ClubCommonPage
sql.setVar("order", """
ORDER BY
CASE
WHEN JSON_CONTAINS(scu.roleCode, '"CLUB_PRESIDENT"') THEN 1
WHEN JSON_CONTAINS(scu.roleCode, '"CLUB_MANAGER"') THEN 1
WHEN JSON_CONTAINS(scu.roleCode, '"CLUB_VICE_PRESIDENT"') THEN 2
WHEN JSON_CONTAINS(scu.roleCode, '"CLUB_SECRETARY"') THEN 3
WHEN JSON_CONTAINS(scu.roleCode, '"CLUB_VICE_SECRETARY"') THEN 4
@@ -261,7 +261,7 @@ public class SysClubInfoManageServiceImpl extends BaseServiceImpl<ClubCommonPage
FROM
sys_club c
LEFT JOIN club_user scu ON scu.clubId = c.id
AND JSON_CONTAINS(scu.roleCode, '"CLUB_PRESIDENT"')
AND JSON_CONTAINS(scu.roleCode, '"CLUB_MANAGER"')
LEFT JOIN vw_user u ON u.id = scu.userId
WHERE
c.id = @clubId
@@ -288,7 +288,7 @@ public class SysClubInfoManageServiceImpl extends BaseServiceImpl<ClubCommonPage
WHERE scu.clubId = @clubId
ORDER BY
CASE
WHEN JSON_CONTAINS(scu.roleCode, '"CLUB_PRESIDENT"') THEN 1
WHEN JSON_CONTAINS(scu.roleCode, '"CLUB_MANAGER"') THEN 1
WHEN JSON_CONTAINS(scu.roleCode, '"CLUB_VICE_PRESIDENT"') THEN 2
WHEN JSON_CONTAINS(scu.roleCode, '"CLUB_SECRETARY"') THEN 3
WHEN JSON_CONTAINS(scu.roleCode, '"CLUB_VICE_SECRETARY"') THEN 4
@@ -317,7 +317,7 @@ public class SysClubInfoManageServiceImpl extends BaseServiceImpl<ClubCommonPage
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate("clubRegis"), config).render(docData).writeAndClose(byteArrayOutputStream);
CommonDownloadUtil.download("教职工文体协会登记表(" + clubInfo.getString("clubName") + ").docx", byteArrayOutputStream.toByteArray(), response);
CommonDownloadUtil.download("教职工文体俱乐部登记表(" + clubInfo.getString("clubName") + ").docx", byteArrayOutputStream.toByteArray(), response);
} catch (IOException e) {
log.error("协会登记表导出失败,id:{},错误信息:{}", clubId, e.getMessage());
}
@@ -68,7 +68,7 @@ public class SysClubServiceImpl extends BaseServiceImpl<SysClub> implements SysC
SELECT
club.*,
u.username as concatPersonName,
(select GROUP_CONCAT(username) from sys_user where id in (select userId from club_user u where u.clubId=club.id and JSON_CONTAINS(u.roleCode, '"CLUB_PRESIDENT"'))) as clubLeader,
(select GROUP_CONCAT(username) from sys_user where id in (select userId from club_user u where u.clubId=club.id and JSON_CONTAINS(u.roleCode, '"CLUB_MANAGER"'))) as clubLeader,
(select GROUP_CONCAT(username) from sys_user where id in (select userId from club_user u where u.clubId=club.id and JSON_CONTAINS(u.roleCode, '"CLUB_SECRETARY"'))) as clubSecretary,
(SELECT count( DISTINCT scu.userId ) FROM club_user scu WHERE scu.clubId = club.id ) currentPeopleNum
FROM
@@ -116,7 +116,7 @@ public class SysClubServiceImpl extends BaseServiceImpl<SysClub> implements SysC
// 校工会主席在协会管理界面按校级管理角色查看全部协会。
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name(), RoleConstant.SCHOOL_UNION_CHAIRMAN.name())) {
List<String> roleList = commonService.findUserRoleByRoleCode(List.of(RoleConstant.CLUB_PRESIDENT.name(), RoleConstant.CLUB_VICE_PRESIDENT.name(), RoleConstant.CLUB_SECRETARY.name(), RoleConstant.CLUB_VICE_SECRETARY.name(),RoleConstant.CLUB_OPERATOR.name()));
List<String> roleList = commonService.findUserRoleByRoleCode(List.of(RoleConstant.CLUB_MANAGER.name(), RoleConstant.CLUB_VICE_PRESIDENT.name(), RoleConstant.CLUB_SECRETARY.name(), RoleConstant.CLUB_VICE_SECRETARY.name(),RoleConstant.CLUB_OPERATOR.name()));
List<Sys_user_role> clubList = dao().query(Sys_user_role.class, Cnd.where("roleId", "in", roleList).and("userId", "=", SecurityUtil.getUserId()).and("clubId", "is not", null));
List<String> clubIdList = clubList.stream().map(Sys_user_role::getClubId).toList();
@@ -150,7 +150,7 @@ public class SysClubServiceImpl extends BaseServiceImpl<SysClub> implements SysC
cnd.and("instance.state", "=", ProcessInstanceStateEnum.FINISHED.getCode());
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name())) {
cnd.and("ur.userId", "=", SecurityUtil.getUserId());
List<String> roleList = commonService.findUserRoleByRoleCode(List.of(RoleConstant.CLUB_PRESIDENT.name(), RoleConstant.CLUB_VICE_PRESIDENT.name(), RoleConstant.CLUB_SECRETARY.name(), RoleConstant.CLUB_VICE_SECRETARY.name(), RoleConstant.CLUB_OPERATOR.name()));
List<String> roleList = commonService.findUserRoleByRoleCode(List.of(RoleConstant.CLUB_MANAGER.name(), RoleConstant.CLUB_VICE_PRESIDENT.name(), RoleConstant.CLUB_SECRETARY.name(), RoleConstant.CLUB_VICE_SECRETARY.name(), RoleConstant.CLUB_OPERATOR.name()));
cnd.and("ur.roleId", "in", roleList);
}
cnd.and("ex.year", "=", year);
@@ -73,7 +73,7 @@ public class SysClubUserServiceImpl extends BaseServiceImpl<ClubUser> implements
WHERE scu.clubId = @clubId
ORDER BY
CASE
WHEN JSON_CONTAINS(scu.roleCode, '"CLUB_PRESIDENT"') THEN 1
WHEN JSON_CONTAINS(scu.roleCode, '"CLUB_MANAGER"') THEN 1
WHEN JSON_CONTAINS(scu.roleCode, '"CLUB_VICE_PRESIDENT"') THEN 2
WHEN JSON_CONTAINS(scu.roleCode, '"CLUB_SECRETARY"') THEN 3
WHEN JSON_CONTAINS(scu.roleCode, '"CLUB_VICE_SECRETARY"') THEN 4
@@ -128,7 +128,7 @@ public class SysClubUserServiceImpl extends BaseServiceImpl<ClubUser> implements
@Override
public String getClubLeader(String clubId) {
List<Sys_user> userList = commonService.findUserInfoByRoleCode("clubId", clubId, RoleConstant.CLUB_PRESIDENT.name());
List<Sys_user> userList = commonService.findUserInfoByRoleCode("clubId", clubId, RoleConstant.CLUB_MANAGER.name());
return userList.stream().map(Sys_user::getLoginname).collect(Collectors.joining(","));
}
@@ -93,7 +93,7 @@ public class ArticleAnalysisController {
// 获取参与协会数量
long clubCount = articleService.count(Sqls.create("SELECT COUNT(distinct clubId) FROM article WHERE clubId IS NOT NULL"));
list.add(ArticleAnalysisOverviewVO.builder()
.label("参与协会")
.label("参与俱乐部")
.value(clubCount)
.icon("el-icon-office-building")
.bgColor("rgba(230, 162, 60, 0.1)")
@@ -138,9 +138,9 @@ public class ArticleFirstExamineController {
}
assignments.add(branchUnionApprovalLoginName);
} else if (result.equals("BACK_TO_CLUB")) {
String branchClubApprovalLoginName = commonService.findUserLoginNameByRoleCode(RoleConstant.CLUB_PRESIDENT, Cnd.where(Sys_user_role::getClubId, "=", article.getClubId()));
String branchClubApprovalLoginName = commonService.findUserLoginNameByRoleCode(RoleConstant.CLUB_MANAGER, Cnd.where(Sys_user_role::getClubId, "=", article.getClubId()));
if (StrUtil.isBlank(branchClubApprovalLoginName)) {
return Result.error("协会未配置审批人,请联系协会!");
return Result.error("俱乐部未配置审批人,请联系俱乐部!");
}
assignments.add(branchClubApprovalLoginName);
} else if (result.equals("PASS")) {
@@ -133,7 +133,7 @@ public class UnionCareDataCon {
double totalBudgetMoney3 = mapList3.stream().mapToDouble(map -> map.getDouble("totalBudgetMoney")).sum();
list.add(new HashMap<String, Object>() {{
put("year", year);
put("type", "协会经费");
put("type", "俱乐部经费");
put("value", totalBudgetMoney3);
}});
@@ -5,7 +5,7 @@ import cn.hutool.core.date.DateUtil;
import com.budwk.app.base.result.Result;
import com.budwk.app.sys.models.Sys_user;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberService;
import com.budwk.app.zhgh.dayofficework.fund.subsidy.models.FundSubsidy;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.model.MutualApply;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
@@ -14,10 +14,10 @@ import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
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 java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
@@ -61,11 +61,11 @@ public class FundDashBoardController {
dao.execute(sql);
int newCount = sql.getInt();
// 医疗补助数
int subsidyCount = dao.count(FundSubsidy.class, Cnd.NEW());
// 医疗补助数:按新的互助金申请主表统计申请数量。
int subsidyCount = dao.count(MutualApply.class, Cnd.NEW());
// 总补助金额
int totalSubsidyCost = dao.func(FundSubsidy.class, "sum", "subsidyCost");
// 医疗补助总金额:按互助金申请主表实际补助金额汇总,保持和审核最终金额一致。
BigDecimal totalSubsidyCost = sumMutualApplyActualSubsidyAmount();
HashMap<String, Object> map = new HashMap<>();
map.put("count", count);
@@ -76,6 +76,30 @@ public class FundDashBoardController {
return Result.success(map);
}
/**
* 汇总互助金申请主表中的实际补助金额,避免按动态分段明细重复或偏差统计。
*/
private BigDecimal sumMutualApplyActualSubsidyAmount() {
Sql sql = Sqls.create("SELECT IFNULL(SUM(actual_subsidy_amount), 0) AS totalSubsidyCost FROM tb_mutual_apply");
sql.setCallback(Sqls.callback.maps());
dao.execute(sql);
List<HashMap> list = sql.getList(HashMap.class);
if (list == null || list.isEmpty()) {
return BigDecimal.ZERO;
}
Object value = list.get(0).get("totalSubsidyCost");
if (value == null) {
return BigDecimal.ZERO;
}
if (value instanceof BigDecimal) {
return (BigDecimal) value;
}
if (value instanceof Number) {
return BigDecimal.valueOf(((Number) value).doubleValue());
}
return new BigDecimal(value.toString());
}
@At
@SaCheckPermission("fund.dashBoard")
@ApiOperation("各分工会基金会员数")
@@ -1,6 +1,7 @@
package com.budwk.app.zhgh.dayofficework.fund.member.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
@@ -39,8 +40,14 @@ public class FundMemberBranchUnionApprovalController {
}
@At("/h5")
@Ok("beetl:/platform/zhghh5/dayofficework/fund/member/branchUnionApproval/index.html")
@SaCheckPermission("h5.fundMember.branchUnionApproval")
public void h5() {
}
@At
@SaCheckPermission("fundMember.branchUnionApproval")
@SaCheckPermission(value = {"fundMember.branchUnionApproval", "h5.fundMember.branchUnionApproval"}, mode = SaMode.OR)
public Result pageData(PageForm pageForm, String taskId, String searchKeyword, Integer year, boolean approval) {
Sql sql = Sqls.create("""
SELECT
@@ -71,7 +78,7 @@ public class FundMemberBranchUnionApprovalController {
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("t.taskName", "in", List.of("fgh", "ltx"));
cnd.and("t.taskName", "=", "fgh");
if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) {
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
}
@@ -4,6 +4,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.utils.CommonDownloadUtil;
import com.budwk.app.base.utils.SysOfficeTemplateUtil;
@@ -31,9 +32,10 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@IocBean
@At("/platform/fundMember/common")
@@ -72,9 +74,12 @@ public class FundMemberCommonController {
FundMemberApply fundMember = dao.fetch(FundMemberApply.class, id);
Map<String, Object> docData = BeanUtil.beanToMap(fundMember);
docData.put("birthday", DateUtil.format(fundMember.getBirthday(), "yyyy年MM月dd日"));
docData.put("joinWorkTime", DateUtil.format(fundMember.getJoinWorkTime(), "yyyy年MM月dd日"));
docData.put("retireTime", DateUtil.format(fundMember.getRetireTime(), "yyyy年MM月dd日"));
docData.put("birthday", formatDate(fundMember.getBirthday(), "yyyy年MM月"));
docData.put("joinWorkTime", formatDate(fundMember.getJoinWorkTime(), "yyyy年MM月dd日"));
docData.put("retireTime", formatDate(fundMember.getRetireTime(), "yyyy年MM月dd日"));
docData.put("submitTime", formatDate(fundMember.getSubmitTime(), "yyyy年MM月dd日"));
docData.put("unionName", StrUtil.nullToEmpty(fundMember.getUnionName()));
docData.put("familyMembers", buildFamilyMembers(fundMember.getFamilies()));
if (StrUtil.isNotBlank(fundMember.getAvatar())) {
docData.put("avatar", sysOfficeTemplateUtil.createPictureRenderData(fundMember.getAvatar()));
}
@@ -88,19 +93,87 @@ public class FundMemberCommonController {
doneTaskVos.add(taskVO);
}
// 按任务节点分组
Map<String, List<ProcessTaskVO>> taskGroups = doneTaskVos.stream().collect(Collectors.groupingBy(ProcessTaskVO::getDisplayName));
docData.putAll(taskGroups);
// 按模板约定输出分工会、校工会审核信息,fgh、xgh 可在模板中直接使用 date 和 opinion 子字段。
putApprovalData(docData, doneTaskVos, List.of("fgh", "ltx"), "fgh");
putApprovalData(docData, doneTaskVos, List.of("xgh"), "xgh");
Configure configure = Configure.builder().build();
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate("fundMember"), configure).render(docData).writeAndClose(byteArrayOutputStream);
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate("fundMemberApply"), configure).render(docData).writeAndClose(byteArrayOutputStream);
CommonDownloadUtil.download(fundMember.getUserName() + "的医疗互助“爱心”基金入会申请表.docx", byteArrayOutputStream.toByteArray(), response);
} catch (Exception e) {
log.error("导出word异常", e);
}
}
/**
* 格式化导出日期,空日期以空字符串输出,避免 Word 模板显示 null。
*
* @param date 日期
* @param pattern Word 模板展示格式
* @return 格式化后的日期文本
*/
private String formatDate(Date date, String pattern) {
return date == null ? "" : DateUtil.format(date, pattern);
}
/**
* 将家庭成员列表转换为 Word 模板单元格可直接展示的多行文本。
*
* @param families 家庭成员列表
* @return 序号、姓名、年龄、与本人关系组成的多行文本
*/
private String buildFamilyMembers(List<JSONObject> families) {
if (families == null || families.isEmpty()) {
return "";
}
StringBuilder content = new StringBuilder();
for (int index = 0; index < families.size(); index++) {
JSONObject family = families.get(index);
if (family == null) {
continue;
}
if (content.length() > 0) {
content.append(System.lineSeparator());
}
String sequence = StrUtil.blankToDefault(family.getStr("sequence"), String.valueOf(index + 1));
content.append(sequence).append("、")
.append(StrUtil.nullToEmpty(family.getStr("name"))).append(",")
.append(StrUtil.nullToEmpty(family.getStr("age"))).append("岁,")
.append(StrUtil.nullToEmpty(family.getStr("relation")));
}
return content.toString();
}
/**
* 从指定流程节点中取最后一次已办记录,组装 Word 模板所需的审核日期与意见。
*
* @param docData 模板数据
* @param doneTasks 已办流程任务
* @param taskNames 对应的流程任务名称
* @param templateKey 模板对象名称,例如 fgh、xgh
*/
private void putApprovalData(Map<String, Object> docData, List<ProcessTaskVO> doneTasks, List<String> taskNames, String templateKey) {
Map<String, Object> approval = new HashMap<>();
approval.put("date", "");
approval.put("opinion", "");
ProcessTaskVO latestTask = null;
for (ProcessTaskVO task : doneTasks) {
if (!taskNames.contains(task.getTaskName())) {
continue;
}
if (latestTask == null || (task.getCreatedAt() != null
&& (latestTask.getCreatedAt() == null || task.getCreatedAt() > latestTask.getCreatedAt()))) {
latestTask = task;
}
}
if (latestTask != null) {
approval.put("date", formatDate(latestTask.getFinishTime(), "yyyy年MM月dd日"));
approval.put("opinion", StrUtil.nullToEmpty(latestTask.getTaskFormData().getStr("tf_opinion")));
}
docData.put(templateKey, approval);
}
}
@@ -35,10 +35,11 @@ public class FundMemberHisController {
@At
@SaCheckPermission("fundMember.his")
public Result pageData(PageForm pageForm, Integer year, String unionId) {
// 同一会员可能存在多次入会记录,加入时间只取最新一条,避免子查询返回多行。
Sql sql = Sqls.create("""
SELECT
his.*,
(SELECT changeTime FROM fund_member_change_record WHERE loginName = his.loginName AND isJoin = 1 ORDER BY changeTime DESC) joinTime
(SELECT changeTime FROM fund_member_change_record WHERE loginName = his.loginName AND isJoin = 1 ORDER BY changeTime DESC LIMIT 1) joinTime
FROM
fund_member_his his
$condition
@@ -46,8 +47,8 @@ public class FundMemberHisController {
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("username", pageForm.getSearchKeyword());
seg.orLike("loginname", pageForm.getSearchKeyword());
seg.orLike("userName", pageForm.getSearchKeyword());
seg.orLike("loginName", pageForm.getSearchKeyword());
cnd.and(seg);
}
cnd.andEX("year", "=", year);
@@ -1,6 +1,7 @@
package com.budwk.app.zhgh.dayofficework.fund.member.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result;
@@ -44,8 +45,14 @@ public class FundMemberMineController {
}
@At("/h5")
@Ok("beetl:/platform/zhghh5/dayofficework/fund/member/mine/index.html")
@SaCheckPermission("h5.fundMember.mine")
public void h5() {
}
@At
@SaCheckPermission("fundMember.mine")
@SaCheckPermission(value = {"fundMember.mine", "h5.fundMember.mine"}, mode = SaMode.OR)
public Result pageData(Integer pageNumber, Integer pageSize, String searchKeyword, Integer year) {
Sql sql = Sqls.create("""
SELECT
@@ -76,13 +83,15 @@ public class FundMemberMineController {
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(info.submitTime)", "=", year);
cnd.and("info.createdBy", "=", SecurityUtil.getUserId());
// 同一流程任务存在多个参与人时,按申请主表主键合并,避免我的申请列表出现重复记录。
cnd.groupBy("info.id");
sql.setCondition(cnd);
Pagination<NutMap> pagination = fundMemberService.listPageMap(pageNumber, pageSize, sql);
return Result.success(pagination);
}
@At
@SaCheckPermission("fundMember.mine")
@SaCheckPermission(value = {"fundMember.mine", "h5.fundMember.mine"}, mode = SaMode.OR)
@Aop(TransAop.READ_COMMITTED)
@ApiOperation("删除")
@SLog(tag = "基金会员-我的申请", msg = "删除")
@@ -0,0 +1,199 @@
package com.budwk.app.zhgh.dayofficework.fund.member.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.ObjectUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.utils.CommonDownloadUtil;
import com.budwk.app.zhgh.dayofficework.fund.member.mode.FundMemberPayImportTemp;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberPay;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberPayService;
import com.budwk.app.zhgh.dayofficework.fund.member.vo.FundMemberPayPageForm;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.config.model.MutualMemberConfig;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.config.service.MedicalMutualAidConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
import org.nutz.dao.sql.Sql;
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.AdaptBy;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 基金会员缴费管理。
*/
@IocBean
@At("/platform/fundMember/payRecord")
@Ok("json:full")
@Api(tags = "基金会员缴费管理")
public class FundMemberPayController {
@Inject
private FundMemberPayService fundMemberPayService;
@Inject
private MedicalMutualAidConfigService medicalMutualAidConfigService;
@At("")
@Ok("beetl:/platform/zhgh/dayofficework/fund/member/payRecord/index.html")
@SaCheckPermission("fundMember.payRecord")
public void index() {
}
@At
@ApiOperation("缴费记录分页查询")
@SaCheckPermission("fundMember.payRecord")
public Result pageData(FundMemberPayPageForm pageForm) {
Sql sql = fundMemberPayService.buildPageSql(pageForm);
Pagination pagination = fundMemberPayService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
/**
* 查询生成指定年度缴费名单时实际采用的月缴费金额,供前端确认提示展示。
*
* @param year 缴费年度
* @return 实际匹配到的会员缴费配置年度和每月缴费金额
*/
@At
@ApiOperation("查询年度缴费配置")
@SaCheckPermission("fundMember.payRecord")
public Result memberConfig(Integer year) {
MutualMemberConfig memberConfig = medicalMutualAidConfigService.getMemberConfigForPay(year);
if (memberConfig == null || memberConfig.getMonthAmount() == null
|| memberConfig.getMonthAmount().signum() <= 0) {
return Result.error("未维护有效的会员缴费配置,请先在医疗互助配置中设置每月缴费金额");
}
return Result.success(NutMap.NEW()
.addv("year", memberConfig.getYear())
.addv("monthAmount", memberConfig.getMonthAmount()));
}
@At
@ApiOperation("生成年度缴费名单")
@SLog(tag = "基金会员缴费管理", msg = "生成年度缴费名单")
@SaCheckPermission("fundMember.payRecord")
public Result createPayList(Integer year) {
int count = fundMemberPayService.createPayList(year);
return Result.success("成功生成" + count + "条缴费记录");
}
@At
@ApiOperation("设置缴费状态")
@SLog(tag = "基金会员缴费管理", msg = "设置缴费状态")
@SaCheckPermission("fundMember.payRecord")
public Result updatePayed(String id, Boolean isPayed) {
if (ObjectUtil.isEmpty(id) || isPayed == null) {
return Result.error("参数错误");
}
fundMemberPayService.updatePayed(id, isPayed);
return Result.success();
}
@At
@ApiOperation("清空当年缴费名单")
@SLog(tag = "基金会员缴费管理", msg = "清空年度缴费名单")
@SaCheckPermission("fundMember.payRecord")
public Result clearPayList(Integer year) {
fundMemberPayService.clearCurrentYearPayList(year);
return Result.success();
}
@At
@Ok("void")
@ApiOperation("下载缴费导入模板")
@SaCheckPermission("fundMember.payRecord")
public void downloadImportTemp(HttpServletResponse response) {
List<ExcelExportEntity> exportEntities = new ArrayList<>();
exportEntities.add(new ExcelExportEntity("年度", "year", 12));
exportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, new ArrayList<>());
CommonDownloadUtil.download("基金会员缴费导入模板.xlsx", workbook, response);
}
@At
@Ok("void")
@ApiOperation("导出缴费记录")
@SaCheckPermission("fundMember.payRecord")
public void exportExcel(FundMemberPayPageForm pageForm, HttpServletResponse response) {
Sql sql = fundMemberPayService.buildPageSql(pageForm);
List<NutMap> records = fundMemberPayService.listMap(sql);
records.forEach(record -> record.put("payState", record.getBoolean("isPayed") ? "已缴费" : "未缴费"));
List<ExcelExportEntity> exportEntities = new ArrayList<>();
exportEntities.add(new ExcelExportEntity("年度", "year", 12));
exportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
exportEntities.add(new ExcelExportEntity("性别", "sex", 10));
exportEntities.add(new ExcelExportEntity("会员类别", "aidFundMemberType", 20));
exportEntities.add(new ExcelExportEntity("所属单位", "unitName", 30));
exportEntities.add(new ExcelExportEntity("所属工会", "unionName", 30));
exportEntities.add(new ExcelExportEntity("缴费金额", "money", 15));
exportEntities.add(new ExcelExportEntity("缴费状态", "payState", 15));
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, records);
CommonDownloadUtil.download(pageForm.getYear() + "年基金会员缴费记录.xlsx", workbook, response);
}
@At
@ApiOperation("导入缴费记录")
@SLog(tag = "基金会员缴费管理", msg = "导入缴费记录")
@SaCheckPermission("fundMember.payRecord")
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
public Result doImport(TempFile file, Integer year) {
if (file == null || year == null) {
return Result.error("文件和缴费年度不能为空");
}
List<FundMemberPayImportTemp> importRows = ExcelImportUtil.importExcel(
file.getFile(), FundMemberPayImportTemp.class, new ImportParams());
if (importRows.isEmpty()) {
return Result.error("导入文件没有缴费记录");
}
for (int i = 0; i < importRows.size(); i++) {
FundMemberPayImportTemp importRow = importRows.get(i);
int rowNumber = i + 2;
// 页面选择的年度与模板年度必须一致,防止将缴费状态写入错误年度。
if (importRow.getYear() == null) {
return Result.error("第" + rowNumber + "行年度不能为空");
}
if (!year.equals(importRow.getYear())) {
return Result.error("第" + rowNumber + "行年度与当前选择的缴费年度不一致");
}
if (cn.hutool.core.util.StrUtil.isBlank(importRow.getLoginName())) {
return Result.error("第" + rowNumber + "行工号不能为空");
}
}
List<String> loginNames = importRows.stream()
.map(FundMemberPayImportTemp::getLoginName)
.collect(Collectors.toList());
List<String> errorLoginNames = fundMemberPayService.markPaidByLoginNames(year, loginNames);
// 无论是否存在异常都返回导入统计,前端据 errorCount 决定提示类型。
NutMap result = NutMap.NEW();
result.setv("totalCount", importRows.size());
result.setv("successCount", importRows.size() - errorLoginNames.size());
result.setv("errorCount", errorLoginNames.size());
result.setv("errorList", errorLoginNames.stream()
.map(loginName -> NutMap.NEW().addv("工号", loginName).addv("错误原因", "未找到该年度缴费记录"))
.collect(Collectors.toList()));
return Result.success(result);
}
}
@@ -39,6 +39,7 @@ 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.Param;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@@ -78,9 +79,16 @@ public class FundMemberQueryController {
u.userState,
u.preparedBy,
u.personType,
COALESCE(NULLIF(u.aidFundMemberType, ''),
(SELECT applyInfo.aidFundMemberType
FROM fund_member_apply applyInfo
WHERE applyInfo.loginName = u.loginName
AND applyInfo.isJoin = 1
ORDER BY applyInfo.submitTime DESC
LIMIT 1)) AS aidFundMemberType,
u.unitName,
u.unionName,
(SELECT changeTime FROM fund_member_change_record WHERE loginName = u.loginName AND isJoin = 1 ORDER BY changeTime DESC limit 1) joinTime
(SELECT changeTime FROM fund_member_change_record WHERE loginName = u.loginName AND isJoin = 1 ORDER BY changeTime DESC LIMIT 1) AS joinTime
FROM
vw_user u
$condition
@@ -93,13 +101,20 @@ public class FundMemberQueryController {
return Result.success(pagination);
}
@At
@SaCheckPermission("fundMember.query")
@ApiOperation("修改大病基金会员类别")
public Result updateAidFundMemberType(@Param("loginName") String loginName, @Param("aidFundMemberType") String aidFundMemberType) {
fundMemberService.updateAidFundMemberType(loginName, aidFundMemberType);
return Result.success();
}
@At
@SaCheckPermission("fundMember.query")
@Ok("void")
@ApiOperation("导出登记汇总Excel")
public void exportExcel(Integer year, String unionId, HttpServletResponse response) {
public void exportExcel(String unionId, HttpServletResponse response) {
Cnd cnd = Cnd.NEW();
cnd.and("YEAR(submitTime)", "=", year);
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
cnd.and("unionId", "=", SecurityUtil.getUnionId());
} else {
@@ -0,0 +1,104 @@
package com.budwk.app.zhgh.dayofficework.fund.member.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode;
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.flow.enums.ProcessTaskStateEnum;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberService;
import io.swagger.annotations.Api;
import org.nutz.dao.Cnd;
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.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.List;
/**
* 基金会员离退休审核。
*/
@IocBean
@At("/platform/fundMember/retiredApproval")
@Ok("json:full")
@Api("基金会员-离退休审核")
public class FundMemberRetiredApprovalController {
@Inject
private FundMemberService fundMemberService;
@At("")
@Ok("beetl:/platform/zhgh/dayofficework/fund/member/retiredApproval/index.html")
@SaCheckPermission("fundMember.retiredApproval")
public void index() {
}
@At("/h5")
@Ok("beetl:/platform/zhghh5/dayofficework/fund/member/retiredApproval/index.html")
@SaCheckPermission("h5.fundMember.retiredApproval")
public void h5() {
}
@At
@SaCheckPermission(value = {"fundMember.retiredApproval", "h5.fundMember.retiredApproval"}, mode = SaMode.OR)
public Result pageData(PageForm pageForm, boolean approval) {
Sql sql = Sqls.create("""
SELECT
info.*,
ins.id AS instanceId,
ins.businessNo,
ins.state instanceState,
ins.variable instanceVariable,
ins.processDefineId instanceProcessDefineId,
t.id taskId,
t.taskName AS taskKey,
t.displayName taskName,
t.taskType,
t.performType taskPerformType,
t.taskState,
t.finishTime,
t.taskParentId,
t.variable taskVariable,
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
FROM
wf_process_task t
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
LEFT JOIN fund_member_apply info ON info.id = ins.businessNo
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("t.taskName", "=", "ltx");
if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) {
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
}
if (approval) {
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
} else {
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
}
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup searchGroup = new SqlExpressionGroup();
searchGroup.orLike("info.loginName", pageForm.getSearchKeyword());
searchGroup.orLike("info.userName", pageForm.getSearchKeyword());
cnd.and(searchGroup);
}
cnd.groupBy("t.id");
cnd.desc("t.createdAt");
sql.setCondition(cnd);
Pagination<NutMap> pagination = fundMemberService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
}
@@ -1,6 +1,7 @@
package com.budwk.app.zhgh.dayofficework.fund.member.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
@@ -39,8 +40,14 @@ public class FundMemberSchoolUnionApprovalController {
}
@At("/h5")
@Ok("beetl:/platform/zhghh5/dayofficework/fund/member/schoolUnionApproval/index.html")
@SaCheckPermission("h5.fundMember.schoolUnionApproval")
public void h5() {
}
@At
@SaCheckPermission("fundMember.schoolUnionApproval")
@SaCheckPermission(value = {"fundMember.schoolUnionApproval", "h5.fundMember.schoolUnionApproval"}, mode = SaMode.OR)
public Result pageData(PageForm pageForm, String unionId, Integer year, boolean approval) {
Sql sql = Sqls.create("""
SELECT
@@ -1,6 +1,7 @@
package com.budwk.app.zhgh.dayofficework.fund.member.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode;
import cn.hutool.core.lang.Dict;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
@@ -50,8 +51,14 @@ public class FundMemberWriteController {
}
@At("/h5")
@Ok("beetl:/platform/zhghh5/dayofficework/fund/member/write/index.html")
@SaCheckPermission("h5.fundMember.write")
public void h5() {
}
@At
@SaCheckPermission("fundMember.write")
@SaCheckPermission(value = {"fundMember.write", "h5.fundMember.write"}, mode = SaMode.OR)
@ApiOperation("保存申请")
@SLog(tag = "建言献策-填写申请", msg = "保存申请")
public Result save(@Param("data") FundMemberApply fundMember) {
@@ -64,11 +71,13 @@ public class FundMemberWriteController {
@At
@SaCheckPermission("fundMember.write")
@SaCheckPermission(value = {"fundMember.write", "h5.fundMember.write"}, mode = SaMode.OR)
@ApiOperation("提交申请")
@Aop(TransAop.READ_COMMITTED)
@SLog(tag = "基金会员-填写申请", msg = "提交申请")
public Result submit(@Param("data") FundMemberApply fundMember) {
fundMemberService.validateCurrentUserNotFundMember();
fundMemberService.validateApplyForm(fundMember);
if (StrUtil.isBlank(fundMember.getId())) {
fundMemberService.validateApply();
}
@@ -80,7 +89,9 @@ public class FundMemberWriteController {
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
args.set(FlowConst.FORM_DATA, fundMember);
args.set(FlowConst.TASK_FORM_DATA_PREFIX + "userState", fundMember.getUserState());
ProcessInstance instance = flowEngine.startProcessInstanceByKey("FUND_MEMBER", fundMember.getId(), SecurityUtil.getUserId(), args);
// 会员类别作为流程条件变量,供 JJHY 的离退休、分工会审核分支使用。
args.set(FlowConst.TASK_FORM_DATA_PREFIX + "aidFundMemberType", fundMember.getAidFundMemberType());
ProcessInstance instance = flowEngine.startProcessInstanceByKey("JJHY", fundMember.getId(), SecurityUtil.getUserId(), args);
// 自动完成第一个申请任务
List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null);
@@ -91,11 +102,13 @@ public class FundMemberWriteController {
}
@At
@SaCheckPermission("fundMember.write")
@SaCheckPermission(value = {"fundMember.write", "h5.fundMember.write"}, mode = SaMode.OR)
@ApiOperation("重新提交申请")
@Aop(TransAop.READ_COMMITTED)
@SLog(tag = "基金会员-填写申请", msg = "重新提交申请")
public Result submitAgain(@Param("data") FundMemberApply fundMember, @Param("taskId") Long taskId) {
fundMemberService.validateCurrentUserNotFundMember();
fundMemberService.validateApplyForm(fundMember);
if (StrUtil.isBlank(fundMember.getId())) {
fundMemberService.validateApply();
}
@@ -104,12 +117,16 @@ public class FundMemberWriteController {
Dict dict = Dict.create();
dict.set(FlowConst.PROCESS_TASK_ID_KEY, taskId);
dict.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.RE_APPLY.getCode());
// 退回后重新提交时同步表单与条件变量,避免分支仍使用首次提交的会员类别。
dict.set(FlowConst.FORM_DATA, fundMember);
dict.set(FlowConst.TASK_FORM_DATA_PREFIX + "userState", fundMember.getUserState());
dict.set(FlowConst.TASK_FORM_DATA_PREFIX + "aidFundMemberType", fundMember.getAidFundMemberType());
flowCommonService.executeTask(dict);
return Result.success();
}
@At
@SaCheckPermission("fundMember.write")
@SaCheckPermission(value = {"fundMember.write", "fundMember.mine", "fundMember.branchUnionApproval", "fundMember.retiredApproval", "fundMember.schoolUnionApproval", "h5.fundMember.write", "h5.fundMember.mine", "h5.fundMember.branchUnionApproval", "h5.fundMember.retiredApproval", "h5.fundMember.schoolUnionApproval"}, mode = SaMode.OR)
@ApiOperation("获取申请信息")
public Result info(@Param("id") String id) {
FundMemberApply box = dao.fetch(FundMemberApply.class, id);
@@ -118,10 +135,20 @@ public class FundMemberWriteController {
@At
@SaCheckPermission("fundMember.write")
@SaCheckPermission(value = {"fundMember.write", "h5.fundMember.write"}, mode = SaMode.OR)
@ApiOperation("获取当前用户基金会员状态")
public Result memberStatus() {
return Result.success(fundMemberService.isCurrentUserFundMember());
}
@At
@SaCheckPermission(value = {"fundMember.write", "h5.fundMember.write"}, mode = SaMode.OR)
@ApiOperation("校验是否有申请在流程中")
public Result validateApply(){
fundMemberService.validateApply();
return Result.success();
boolean isFundMember = fundMemberService.isCurrentUserFundMember();
if (!isFundMember) {
fundMemberService.validateApply();
}
return Result.success(isFundMember);
}
}
@@ -25,11 +25,15 @@ public class FundMemberPassInterceptor implements FlowInterceptor {
public void intercept(Execution execution) {
Dao dao = ServiceContext.find(Dao.class);
FundMemberApply fundMemberApply = Json.fromJson(FundMemberApply.class, execution.getArgs().getStr("f_data"));
// 修改基金会员状态
dao.update(Sys_user.class, Chain.make("aidFundMember", 1), Cnd.where(Sys_user::getLoginname, "=", fundMemberApply.getLoginName()));
// 修改基金会员状态,并同步申请时选择的大病基金会员类别。
dao.update(Sys_user.class,
Chain.make("aidFundMember", 1).add("aidFundMemberType", fundMemberApply.getAidFundMemberType()),
Cnd.where(Sys_user::getLoginname, "=", fundMemberApply.getLoginName()));
// 添加到变更记录
FundMemberChangeRecord record = BeanUtil.copyProperties(fundMemberApply, FundMemberChangeRecord.class, "id");
record.setId(null);
// 后置拦截器只在入会申请审核通过后执行,明确标记为加入记录,供台账展示加入时间。
record.setIsJoin(true);
record.setChangeOrigin("流程申请");
record.setChangeTime(new Date());
dao.insert(record);
@@ -0,0 +1,20 @@
package com.budwk.app.zhgh.dayofficework.fund.member.mode;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
/**
* 基金会员缴费导入模板。
*/
@Data
public class FundMemberPayImportTemp {
@Excel(name = "年度")
private Integer year;
@Excel(name = "工号")
private String loginName;
@Excel(name = "姓名")
private String userName;
}
@@ -1,6 +1,7 @@
package com.budwk.app.zhgh.dayofficework.fund.member.models;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.hutool.json.JSONObject;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -8,6 +9,7 @@ import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.Date;
import java.util.List;
@Data
@Table("fund_member_apply")
@@ -48,7 +50,7 @@ public class FundMemberApply extends BaseModel {
private String idCard;
@Column
@Comment("参加工作时间")
@Comment("入职时间")
@ColDefine(type = ColType.DATE)
private Date joinWorkTime;
@@ -57,11 +59,31 @@ public class FundMemberApply extends BaseModel {
@ColDefine(type = ColType.DATE)
private Date retireTime;
@Column
@Comment("大病基金会员类别")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String aidFundMemberType;
@Column
@Comment("家庭住址")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String address;
@Column
@Comment("籍贯")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String nativePlace;
@Column
@Comment("学历")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String education;
@Column
@Comment("健康状况")
@ColDefine(type = ColType.VARCHAR, width = 200)
private String healthStatus;
@Column
@Comment("手机号码")
@ColDefine(type = ColType.VARCHAR, width = 20)
@@ -72,6 +94,16 @@ public class FundMemberApply extends BaseModel {
@ColDefine(type = ColType.VARCHAR, width = 20)
private String homePhone;
@Column
@Comment("家庭主要成员")
@ColDefine(type = ColType.MYSQL_JSON)
private List<JSONObject> families;
@Column
@Comment("备注")
@ColDefine(type = ColType.VARCHAR, customType = "text")
private String remark;
@Column
@Comment("照片")
@ColDefine(type = ColType.VARCHAR, width = 100)
@@ -0,0 +1,65 @@
package com.budwk.app.zhgh.dayofficework.fund.member.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.ColDefine;
import org.nutz.dao.entity.annotation.ColType;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Default;
import org.nutz.dao.entity.annotation.Index;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Table;
import org.nutz.dao.entity.annotation.TableIndexes;
import org.nutz.dao.entity.annotation.TableMeta;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.math.BigDecimal;
/**
* 基金会员年度缴费记录。
*/
@Data
@Table("fund_member_pay")
@TableMeta("{'mysql-charset':'utf8mb4'}")
@TableIndexes({
@Index(name = "UK_FUND_MEMBER_PAY_USER_YEAR", fields = {"userId", "year"}, unique = true),
@Index(name = "IDX_FUND_MEMBER_PAY_YEAR", fields = {"year"}, unique = false)
})
@EqualsAndHashCode(callSuper = true)
@Comment("基金会员年度缴费记录")
public class FundMemberPay 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.INT)
private Integer year;
@Column
@Comment("缴费金额")
@ColDefine(customType = "decimal(10,2)")
private BigDecimal money;
@Column
@Comment("是否已缴费")
@Default("0")
@ColDefine(type = ColType.BOOLEAN)
private Boolean isPayed;
@Column
@Comment("基金会员类别")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String aidFundMemberType;
}
@@ -0,0 +1,54 @@
package com.budwk.app.zhgh.dayofficework.fund.member.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberPay;
import com.budwk.app.zhgh.dayofficework.fund.member.vo.FundMemberPayPageForm;
import org.nutz.dao.sql.Sql;
import java.util.List;
/**
* 基金会员缴费管理服务。
*/
public interface FundMemberPayService extends BaseService<FundMemberPay> {
/**
* 生成指定年度的基金会员缴费名单。
*
* @param year 缴费年度
* @return 新增的缴费记录数量
*/
int createPayList(Integer year);
/**
* 构建缴费记录分页及导出共用查询。
*
* @param pageForm 查询条件
* @return 缴费记录查询 SQL
*/
Sql buildPageSql(FundMemberPayPageForm pageForm);
/**
* 修改单条缴费记录的缴费状态。
*
* @param id 缴费记录 ID
* @param isPayed 是否已缴费
*/
void updatePayed(String id, Boolean isPayed);
/**
* 清空本年度全部基金会员缴费记录。
*
* @param year 缴费年度,必须为当前年度
*/
void clearCurrentYearPayList(Integer year);
/**
* 根据导入工号批量标记缴费状态。
*
* @param year 缴费年度
* @param loginNames 导入工号集合
* @return 未找到对应年度缴费记录的工号集合
*/
List<String> markPaidByLoginNames(Integer year, List<String> loginNames);
}
@@ -9,4 +9,32 @@ public interface FundMemberService extends BaseService<FundMemberApply> {
* 验证是否已经申请了
*/
void validateApply();
/**
* 判断当前登录用户是否为基金会员。
*
* @return 当前用户是基金会员时返回 true
*/
boolean isCurrentUserFundMember();
/**
* 校验当前登录用户不是基金会员,避免重复发起入会申请。
*/
void validateCurrentUserNotFundMember();
/**
* 校验基金会员申请业务字段。
*
* @param fundMember 基金会员申请信息
*/
void validateApplyForm(FundMemberApply fundMember);
/**
* 修改大病基金会员类别。
*
* @param loginName 工号
* @param aidFundMemberType 大病基金会员类别
*/
void updateAidFundMemberType(String loginName, String aidFundMemberType);
}
@@ -0,0 +1,285 @@
package com.budwk.app.zhgh.dayofficework.fund.member.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.sys.models.Sys_user;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberChangeRecord;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberPay;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberPayService;
import com.budwk.app.zhgh.dayofficework.fund.member.vo.FundMemberPayPageForm;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.model.MutualApply;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.config.model.MutualMemberConfig;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.config.service.MedicalMutualAidConfigService;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 基金会员缴费管理服务实现。
*/
@IocBean(args = {"refer:dao"})
public class FundMemberPayServiceImpl extends BaseServiceImpl<FundMemberPay> implements FundMemberPayService {
@Inject
private MedicalMutualAidConfigService medicalMutualAidConfigService;
public FundMemberPayServiceImpl(Dao dao) {
super(dao);
}
@Override
public int createPayList(Integer year) {
if (year == null) {
throw new RuntimeException("缴费年度不能为空");
}
if (count(Cnd.where(FundMemberPay::getYear, "=", year)) > 0) {
throw new RuntimeException(year + "年缴费名单已生成,请勿重复生成");
}
MutualMemberConfig memberConfig = medicalMutualAidConfigService.getMemberConfigForPay(year);
if (memberConfig == null || memberConfig.getMonthAmount() == null
|| memberConfig.getMonthAmount().compareTo(BigDecimal.ZERO) <= 0) {
throw new RuntimeException("未维护有效的会员缴费配置,请先在医疗互助配置中设置每月缴费金额");
}
if (memberConfig.getHalfPriceYear() == null || memberConfig.getHalfPriceYear() <= 0) {
throw new RuntimeException("会员缴费配置的缴费减半年限必须大于 0");
}
List<Sys_user> members = dao().query(Sys_user.class,
Cnd.where(Sys_user::getAidFundMember, "=", true));
if (members.isEmpty()) {
return 0;
}
List<String> loginNames = members.stream().map(Sys_user::getLoginname).collect(Collectors.toList());
List<FundMemberChangeRecord> joinRecords = dao().query(FundMemberChangeRecord.class,
Cnd.where(FundMemberChangeRecord::getLoginName, "in", loginNames)
.and(FundMemberChangeRecord::getIsJoin, "=", true)
.asc(FundMemberChangeRecord::getChangeTime));
Map<String, Date> joinTimeMap = new HashMap<>();
for (FundMemberChangeRecord joinRecord : joinRecords) {
// 同一会员可能存在多次加入记录,按时间升序覆盖后保留最近一次实际入会时间。
joinTimeMap.put(joinRecord.getLoginName(), joinRecord.getChangeTime());
}
List<MutualApply> approvedApplies = dao().query(MutualApply.class,
Cnd.where(MutualApply::getLoginName, "in", loginNames)
.and(MutualApply::getStatus, "=", 1)
.desc(MutualApply::getSubmitTime));
Map<String, Date> latestApplyTimeMap = new HashMap<>();
for (MutualApply approvedApply : approvedApplies) {
Date submitTime = approvedApply.getSubmitTime();
if (submitTime == null || toLocalDate(submitTime).getYear() > year) {
continue;
}
latestApplyTimeMap.merge(approvedApply.getLoginName(), submitTime,
(oldTime, newTime) -> newTime.after(oldTime) ? newTime : oldTime);
}
List<FundMemberPay> payList = members.stream().map(member -> {
BigDecimal money = calculatePayMoney(year, joinTimeMap.get(member.getLoginname()),
latestApplyTimeMap.get(member.getLoginname()), memberConfig);
if (money.compareTo(BigDecimal.ZERO) <= 0) {
return null;
}
FundMemberPay pay = new FundMemberPay();
pay.setUserId(member.getId());
pay.setYear(year);
pay.setMoney(money);
pay.setIsPayed(false);
pay.setAidFundMemberType(member.getAidFundMemberType());
return pay;
}).filter(java.util.Objects::nonNull).collect(Collectors.toList());
if (payList.isEmpty()) {
return 0;
}
dao().fastInsert(payList);
return payList.size();
}
/**
* 按缴费年度、实际入会年月和会员缴费配置计算缴费金额。
* 缺少历史入会记录的存量会员按全年收费;入会当年按入会当月(含)至年末的月份数收费。
* 入会后已满配置年限,且中间存在已审核医疗互助申请时,从最近申请年份重新计算减半年限。
*
* @param payYear 缴费年度
* @param joinTime 最近一次实际入会时间
* @param latestApplyTime 最近一次已审核医疗互助申请提交时间
* @param memberConfig 会员缴费配置
* @return 应缴金额;缴费年度早于入会年度时返回 0
*/
private BigDecimal calculatePayMoney(Integer payYear, Date joinTime, Date latestApplyTime,
MutualMemberConfig memberConfig) {
BigDecimal money = calculateBasePayMoney(payYear, joinTime, memberConfig.getMonthAmount());
if (money.compareTo(BigDecimal.ZERO) > 0
&& shouldApplyHalfPrice(payYear, joinTime, latestApplyTime, memberConfig.getHalfPriceYear())) {
return money.divide(BigDecimal.valueOf(2));
}
return money;
}
/**
* 按入会时间计算未优惠前的年度应缴金额。
*/
private BigDecimal calculateBasePayMoney(Integer payYear, Date joinTime, BigDecimal monthlyPayAmount) {
if (joinTime == null) {
return monthlyPayAmount.multiply(BigDecimal.valueOf(12));
}
LocalDate joinDate = toLocalDate(joinTime);
if (payYear < joinDate.getYear()) {
return BigDecimal.ZERO;
}
if (payYear > joinDate.getYear()) {
return monthlyPayAmount.multiply(BigDecimal.valueOf(12));
}
int payMonths = 13 - joinDate.getMonthValue();
return monthlyPayAmount.multiply(BigDecimal.valueOf(payMonths));
}
/**
* 判断是否达到减半年限:从入会年份起算,最近一次已审核医疗互助申请会重置起算年份。
*/
private boolean shouldApplyHalfPrice(Integer payYear, Date joinTime, Date latestApplyTime, Integer halfPriceYear) {
if (joinTime == null || halfPriceYear == null || halfPriceYear <= 0) {
return false;
}
int startYear = toLocalDate(joinTime).getYear();
if (latestApplyTime != null) {
startYear = Math.max(startYear, toLocalDate(latestApplyTime).getYear());
}
return payYear - startYear >= halfPriceYear;
}
/**
* 将历史日期统一转换为本地日期,避免年度判断受时区影响。
*/
private LocalDate toLocalDate(Date date) {
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
@Override
public Sql buildPageSql(FundMemberPayPageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
pay.id,
pay.year,
pay.money,
pay.isPayed,
pay.aidFundMemberType,
u.id AS userId,
u.loginname AS loginName,
u.username AS userName,
u.sex,
u.unitName,
u.unionName,
joinRecord.joinTime
FROM
fund_member_pay pay
LEFT JOIN vw_user u ON u.id = pay.userId
LEFT JOIN (
SELECT loginName, MAX(changeTime) AS joinTime
FROM fund_member_change_record
WHERE isJoin = 1
GROUP BY loginName
) joinRecord ON joinRecord.loginName = u.loginname
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("pay.year", "=", pageForm.getYear());
cnd.andEX("pay.isPayed", "=", pageForm.getIsPayed());
cnd.andEX("pay.aidFundMemberType", "=", pageForm.getAidFundMemberType());
cnd.andEX("u.unionId", "=", pageForm.getUnionId());
cnd.andEX("u.unitId", "=", pageForm.getUnitId());
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup searchGroup = new SqlExpressionGroup();
searchGroup.orLike("u.loginname", pageForm.getSearchKeyword());
searchGroup.orLike("u.username", pageForm.getSearchKeyword());
cnd.and(searchGroup);
}
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
cnd.and("u.unionId", "=", SecurityUtil.getUnionId());
}
cnd.desc("u.unitCode");
cnd.asc("u.loginname");
sql.setCondition(cnd);
return sql;
}
@Override
public void updatePayed(String id, Boolean isPayed) {
FundMemberPay pay = fetch(id);
if (pay == null) {
throw new RuntimeException("缴费记录不存在");
}
update(Chain.make("isPayed", isPayed), Cnd.where(FundMemberPay::getId, "=", id));
}
@Override
public void clearCurrentYearPayList(Integer year) {
if (year == null) {
throw new RuntimeException("缴费年度不能为空");
}
if (year != DateUtil.thisYear()) {
throw new RuntimeException("仅允许清空本年度缴费名单");
}
clear(Cnd.where(FundMemberPay::getYear, "=", year));
}
@Override
public List<String> markPaidByLoginNames(Integer year, List<String> loginNames) {
if (year == null) {
throw new RuntimeException("缴费年度不能为空");
}
if (loginNames == null || loginNames.isEmpty()) {
return Collections.emptyList();
}
Set<String> distinctLoginNames = loginNames.stream()
.filter(StrUtil::isNotBlank)
.map(String::trim)
.collect(Collectors.toSet());
if (distinctLoginNames.isEmpty()) {
return Collections.emptyList();
}
List<Sys_user> users = dao().query(Sys_user.class,
Cnd.where(Sys_user::getLoginname, "in", new ArrayList<>(distinctLoginNames)));
Map<String, Sys_user> userMap = users.stream()
.collect(Collectors.toMap(Sys_user::getLoginname, Function.identity()));
List<String> userIds = users.stream().map(Sys_user::getId).collect(Collectors.toList());
List<FundMemberPay> payList = userIds.isEmpty() ? Collections.emptyList() : query(
Cnd.where(FundMemberPay::getYear, "=", year)
.and(FundMemberPay::getUserId, "in", userIds));
Set<String> paidUserIds = payList.stream().map(FundMemberPay::getUserId).collect(Collectors.toSet());
if (!paidUserIds.isEmpty()) {
update(Chain.make("isPayed", true),
Cnd.where(FundMemberPay::getYear, "=", year)
.and(FundMemberPay::getUserId, "in", new ArrayList<>(paidUserIds)));
}
return distinctLoginNames.stream()
.filter(loginName -> !userMap.containsKey(loginName)
|| !paidUserIds.contains(userMap.get(loginName).getId()))
.sorted()
.collect(Collectors.toList());
}
}
@@ -4,9 +4,11 @@ import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.flow.entity.ProcessInstance;
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
import com.budwk.app.sys.models.Sys_user;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberApply;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberService;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
@@ -21,6 +23,7 @@ public class FundMemberServiceImpl extends BaseServiceImpl<FundMemberApply> impl
@Override
public void validateApply() {
validateCurrentUserNotFundMember();
FundMemberApply apply = dao().fetch(FundMemberApply.class,
Cnd.where(FundMemberApply::getLoginName, "=", SecurityUtil.getUserLoginname())
.and("isJoin", "=", 1)
@@ -36,4 +39,42 @@ public class FundMemberServiceImpl extends BaseServiceImpl<FundMemberApply> impl
throw new RuntimeException("您有申请流程正在进行中,请等待流程结束后再次操作");
}
}
@Override
public boolean isCurrentUserFundMember() {
Sys_user user = dao().fetch(Sys_user.class,
Cnd.where(Sys_user::getLoginname, "=", SecurityUtil.getUserLoginname()));
return user != null && Boolean.TRUE.equals(user.getAidFundMember());
}
@Override
public void validateCurrentUserNotFundMember() {
if (isCurrentUserFundMember()) {
throw new RuntimeException("您已是基金会员,无需重复申请");
}
}
@Override
public void validateApplyForm(FundMemberApply fundMember) {
if (fundMember == null || StrUtil.isBlank(fundMember.getAidFundMemberType())) {
throw new RuntimeException("会员类别不能为空");
}
if ("退休".equals(fundMember.getAidFundMemberType()) && fundMember.getRetireTime() == null) {
throw new RuntimeException("会员类别为退休时,退休时间不能为空");
}
}
@Override
public void updateAidFundMemberType(String loginName, String aidFundMemberType) {
if (StrUtil.isBlank(loginName)) {
throw new RuntimeException("工号不能为空");
}
if (StrUtil.isBlank(aidFundMemberType)) {
throw new RuntimeException("会员类别不能为空");
}
dao().update(Sys_user.class,
Chain.make("aidFundMemberType", aidFundMemberType),
Cnd.where(Sys_user::getLoginname, "=", loginName).and(Sys_user::getAidFundMember, "=", 1));
}
}
@@ -43,6 +43,10 @@ public class FundMemberCommonPageForm extends PageForm {
@ApiModelProperty("教职工类别")
private List<String> personTypes;
// 大病基金会员类别
@ApiModelProperty("大病基金会员类别")
private List<String> aidFundMemberTypes;
public void buildSearch(Cnd cnd, String prefix){
if (cnd == null) {
cnd = Cnd.NEW();
@@ -60,5 +64,6 @@ public class FundMemberCommonPageForm extends PageForm {
cnd.andEX(prefix + "userState", "in", this.getUserStates());
cnd.andEX(prefix + "preparedBy", "in", this.getPreparedBys());
cnd.andEX(prefix + "personType", "in", this.getPersonTypes());
cnd.andEX(prefix + "aidFundMemberType", "in", this.getAidFundMemberTypes());
}
}
@@ -0,0 +1,23 @@
package com.budwk.app.zhgh.dayofficework.fund.member.vo;
import com.budwk.app.base.param.PageForm;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 基金会员缴费记录查询参数。
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class FundMemberPayPageForm extends PageForm {
private Integer year;
private String unionId;
private String unitId;
private String aidFundMemberType;
private Boolean isPayed;
}
@@ -17,6 +17,7 @@ import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@@ -31,7 +32,14 @@ public class HealthCheckupSingleServiceImpl extends BaseServiceImpl<HealthChecku
@Override
public NutMap pageData(String projectId, String unionId) {
// 未选择体检项目时返回稳定的空表格结构,避免继续查询并解引用空项目。
if (Strings.isBlank(projectId)) {
return emptyPageData();
}
HealthCheckupProject project = healthCheckupProjectService.findOne(projectId);
if (project == null) {
return emptyPageData();
}
Sql sql = Sqls.create("""
SELECT
su.id,
@@ -48,7 +56,9 @@ public class HealthCheckupSingleServiceImpl extends BaseServiceImpl<HealthChecku
//分工会参加体检人数汇总
List<NutMap> healthCheckupList = listMap(sql);
//该体检项目下的套餐
List<HealthCheckupProjectSubject> subjectList = project.getHealthCheckupProjectSubjects();
List<HealthCheckupProjectSubject> subjectList = project.getHealthCheckupProjectSubjects() == null
? Collections.emptyList()
: project.getHealthCheckupProjectSubjects();
//体检人员详情
List<NutMap> userSelectList = this.getUserSelectionByProjectId(projectId);
@@ -94,6 +104,14 @@ public class HealthCheckupSingleServiceImpl extends BaseServiceImpl<HealthChecku
return NutMap.NEW().addv("tableList", healthCheckupList).addv("tableColumn", labelList);
}
private NutMap emptyPageData() {
List<NutMap> labelList = new ArrayList<>();
labelList.add(NutMap.NEW().addv("label", "本次体检人数").addv("prop", "sumCount"));
labelList.add(NutMap.NEW().addv("label", "参加人数").addv("prop", "totalCount"));
labelList.add(NutMap.NEW().addv("label", "未选人数").addv("prop", "unselectedTeacherSum"));
return NutMap.NEW().addv("tableList", Collections.emptyList()).addv("tableColumn", labelList);
}
/**
* 体检参加人员
*
@@ -157,7 +157,7 @@ public class ActivityBudgetApplyController {
public Result listClub(){
Cnd cnd = Cnd.NEW();
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_PRESIDENT);
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_MANAGER);
List<Sys_user_role> userRoles = sysClubService.dao().query(Sys_user_role.class, Cnd.where("userId", "=", SecurityUtil.getUserId()).and("roleId", "=", sysRole.getId()));
List<String> myClubId = userRoles.stream().map(Sys_user_role::getClubId).toList();
cnd.and("id", "in", myClubId);
@@ -79,7 +79,7 @@ public class ActivityBudgetQueryStatisticsController {
entities.add(new ExcelExportEntity("分工会", "unionName", 20));
}else if (outlayManageSource.equals("ACTIVITY_BUDGET_TYPE_THREE")) {
entities.add(new ExcelExportEntity("编码", "clubCode", 20));
entities.add(new ExcelExportEntity("协会名称", "clubName", 20));
entities.add(new ExcelExportEntity("俱乐部名称", "clubName", 20));
}
ExcelExportEntity draftCodeEntity = new ExcelExportEntity("预算金额", "totalBudgetMoney", 20);
draftCodeEntity.setType(10);
@@ -99,7 +99,7 @@ public class ActivityBudgetServiceImpl extends BaseServiceImpl<ActivityBudget> i
group1.and("info.unionId", "=", SecurityUtil.getUnionId());
group.or(group1);
}
if (AuthUtil.hasRoleOr(RoleConstant.CLUB_PRESIDENT.name(), RoleConstant.CLUB_SECRETARY.name())) {
if (AuthUtil.hasRoleOr(RoleConstant.CLUB_MANAGER.name(), RoleConstant.CLUB_SECRETARY.name())) {
List<SysClub> myManageClub = sysClubService.getMyManageClub();
List<String> clubIds = myManageClub.stream().map(SysClub::getId).toList();
SqlExpressionGroup group1 = new SqlExpressionGroup();
@@ -47,7 +47,7 @@ public class ActivityBudgetTemp extends ExcelImportError {
@ExcelProperty("审核意见")
private String auditOpinion;
@ExcelProperty("申报单位(仅社团申报时可在下拉菜单中选择,其他类型不用填写)")
@ExcelProperty("申报单位(仅俱乐部申报时可在下拉菜单中选择,其他类型不用填写)")
private String helpUnitName;
@@ -66,7 +66,7 @@ public class OutlayManageClubController {
""");
cnd.andEX("year", "=", year);
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_PRESIDENT);
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_MANAGER);
List<Sys_user_role> userRoles = baseService.dao().query(Sys_user_role.class, Cnd.where("userId", "=", SecurityUtil.getUserId()).and("roleId", "=", sysRole.getId()));
List<String> myClubId = userRoles.stream().map(Sys_user_role::getClubId).toList();
cnd.andEX("clubId", "in", myClubId);
@@ -74,7 +74,7 @@ public class OutlayManageClubUseDetailController {
if (AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
cnd.andEX("clubId", "=", clubId);
} else {
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_PRESIDENT);
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_MANAGER);
List<Sys_user_role> userRoles = baseService.dao().query(Sys_user_role.class, Cnd.where("userId", "=", SecurityUtil.getUserId()).and("roleId", "=", sysRole.getId()));
List<String> myClubId = userRoles.stream().map(Sys_user_role::getClubId).toList();
cnd.andEX("clubId", "in", myClubId);
@@ -123,7 +123,7 @@ public class OutlayReimburseApplyServiceImpl extends BaseServiceImpl<OutlayReimb
.and("unionId", "=", StrUtil.isNotBlank(unionId) ? unionId : SecurityUtil.getUnionId()));
map.put("budgetMoney", ObjectUtil.isNotEmpty(union) ? union.getTotalQuota().subtract(union.getUsedQuota()) : 0);
} else if (outlayManageSource.equals("ACTIVITY_BUDGET_TYPE_THREE")) {
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_PRESIDENT);
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_MANAGER);
List<Sys_user_role> userRoles = dao().query(Sys_user_role.class, Cnd.where("userId", "=", SecurityUtil.getUserId()).and("roleId", "=", sysRole.getId()));
List<String> myClubId = userRoles.stream().map(Sys_user_role::getClubId).toList();
@@ -137,7 +137,7 @@ public class SiteCugApplyServiceImpl extends BaseServiceImpl<SiteCugApply> imple
ins.id AS instanceId,
ins.processDefineId instanceProcessDefineId,
CASE WHEN info.backOption LIKE 'YEARLY_BATCH:%' THEN 1 ELSE 0 END AS yearlyBatch,
CASE WHEN info.reserveType = 'club' THEN '协会预约' ELSE '分工会预约' END AS reserveTypeName,
CASE WHEN info.reserveType = 'club' THEN '俱乐部预约' ELSE '分工会预约' END AS reserveTypeName,
CASE WHEN info.reserveType = 'club' THEN info.clubName ELSE info.applyUnionName END AS reserveTargetName,
DATE_FORMAT(info.createdAt, '%Y-%m-%d %H:%i:%s') AS applyTime
FROM
@@ -298,7 +298,7 @@ public class SiteCugApplyServiceImpl extends BaseServiceImpl<SiteCugApply> imple
}
if (StrUtil.equals(apply.getReserveType(), "club")) {
if (StrUtil.isBlank(apply.getClubId())) {
return Map.of(false, "请选择协会");
return Map.of(false, "请选择俱乐部");
}
// 协会预约直接复用项目现成能力;getMyManageClub() 对 SYSADMIN 已放开,因此超级管理员也能代任意协会预约
List<SysClub> myManageClub = sysClubService.getMyManageClub();
@@ -307,7 +307,7 @@ public class SiteCugApplyServiceImpl extends BaseServiceImpl<SiteCugApply> imple
.findFirst()
.orElse(null);
if (club == null) {
return Map.of(false, "所选协会不是您当前管理的协会");
return Map.of(false, "所选俱乐部不是您当前管理的俱乐部");
}
apply.setClubName(club.getClubName());
apply.setApplyUnionId("");
@@ -224,7 +224,7 @@ public class UnionReimburseApplyController {
public Result getClubBudget(@Param("clubId") String clubId) {
// 检查clubId参数是否为空
if (StrUtil.isBlank(clubId)) {
return Result.error("社团ID不能为空");
return Result.error("俱乐部ID不能为空");
}
// 根据社团ID和年份查询特定社团的经费信息
OutlayManageClub outlayManageClub = dao.fetch(OutlayManageClub.class,
@@ -8,7 +8,6 @@ import com.budwk.app.zhgh.democratic.proposal.models.ProposalConfig;
import com.budwk.app.zhgh.democratic.proposal.models.ProposalType;
import com.budwk.app.zhgh.democratic.proposal.models.ProposalUndertake;
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
import com.budwk.app.zhgh.democratic.teachercongress.delegation.models.Teacher_congress_delegation;
import com.budwk.app.zhgh.democratic.teachercongress.prepare.models.Teacher_congress_session;
import io.swagger.annotations.ApiOperation;
import org.nutz.dao.Cnd;
@@ -17,6 +16,7 @@ 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.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@@ -77,9 +77,8 @@ public class ProposalCommonController {
@At
@SaCheckLogin
@ApiOperation("查询当前教代会的代表团")
public Result listDelegation(@Valid String sessionId) {
List<Teacher_congress_delegation> list = dao.query(Teacher_congress_delegation.class, Cnd.where("sessionId", "=", sessionId).asc("code"));
return Result.success(list);
public Result listDelegation(String sessionId, @Param("sessionIds") String[] sessionIds) {
return Result.success(proposalCommonService.listDelegation(sessionId, sessionIds));
}
@At
@@ -3,6 +3,7 @@ package com.budwk.app.zhgh.democratic.proposal.service.common;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
import com.budwk.app.zhgh.democratic.proposal.models.ProposalUndertake;
import com.budwk.app.zhgh.democratic.teachercongress.delegation.models.Teacher_congress_delegation;
import org.nutz.lang.util.NutMap;
import javax.servlet.http.HttpServletResponse;
@@ -11,6 +12,15 @@ import java.util.List;
public interface ProposalCommonService extends BaseService<ProposalInfo> {
/**
* 查询指定教代会届次下的代表团。
*
* @param sessionId 单个教代会届次 ID,供原有单届次页面使用
* @param sessionIds 多个教代会届次 ID,供综合查询的届次多选使用
* @return 代表团列表;两个参数均为空时返回空列表
*/
List<Teacher_congress_delegation> listDelegation(String sessionId, String[] sessionIds);
/**
* 查询提案信息
*/
@@ -30,6 +30,7 @@ import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
import com.budwk.app.zhgh.democratic.proposal.models.ProposalMerge;
import com.budwk.app.zhgh.democratic.proposal.models.ProposalUndertake;
import com.budwk.app.zhgh.democratic.proposal.param.ProposalQueryComprehensiveParam;
import com.budwk.app.zhgh.democratic.teachercongress.delegation.models.Teacher_congress_delegation;
import com.budwk.app.zhgh.democratic.teachercongress.prepare.models.Teacher_congress_session;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
@@ -75,6 +76,19 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> imp
super(dao);
}
@Override
public List<Teacher_congress_delegation> listDelegation(String sessionId, String[] sessionIds) {
Cnd cnd = Cnd.NEW();
if (Lang.isNotEmpty(sessionIds)) {
cnd.and(Teacher_congress_delegation::getSessionId, "in", sessionIds);
} else if (StrUtil.isNotBlank(sessionId)) {
cnd.and(Teacher_congress_delegation::getSessionId, "=", sessionId);
} else {
return Collections.emptyList();
}
return dao().query(Teacher_congress_delegation.class, cnd.asc(Teacher_congress_delegation::getCode));
}
@Override
public NutMap info(String id) {
if (StrUtil.isBlank(id)) {
@@ -0,0 +1,86 @@
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.model.MutualApply;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.service.MedicalMutualAidApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;
/**
* 互助金申请页面控制器,负责申请表单页面入口和表单保存、提交接口。
*/
@IocBean
@At("/platform/medicalMutualAid/apply")
@Api("互助金申请")
@Ok("json:full")
public class MedicalMutualAidApplyFormController {
@Inject
private MedicalMutualAidApplyService medicalMutualAidApplyService;
/**
* 打开互助金申请页面。
*/
@At("/form")
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/apply/form/index.html")
@SaCheckPermission("medicalMutualAid.apply.form")
public void index() {
}
/**
* 查询申请页初始化数据。
*
* @return 当前用户占位信息和疾病下拉数据
*/
@At("/form/initApplyData")
@ApiOperation("查询互助金申请初始化数据")
@SaCheckPermission("medicalMutualAid.apply.form")
public Result initApplyData() {
return Result.success(medicalMutualAidApplyService.initApplyData());
}
/**
* 查询申请详情,用于我的申请查看和编辑复用申请表单页面。
*
* @param id 申请ID
* @return 申请主表详情
*/
@At("/form/detail")
@ApiOperation("查询互助金申请详情")
@SaCheckPermission("medicalMutualAid.apply.form")
public Result detail(@Param("id") Long id) {
return Result.success(medicalMutualAidApplyService.applyDetail(id));
}
/**
* 保存草稿。
*
* @param apply 申请表单
* @return 保存后的申请数据
*/
@At("/form/saveDraft")
@ApiOperation("保存互助金申请草稿")
@SaCheckPermission("medicalMutualAid.apply.form")
public Result saveDraft(MutualApply apply) {
return Result.success(medicalMutualAidApplyService.saveApply(apply, false));
}
/**
* 提交申请。
*
* @param apply 申请表单
* @return 提交后的申请数据
*/
@At("/form/submitApply")
@ApiOperation("提交互助金申请")
@SaCheckPermission("medicalMutualAid.apply.form")
public Result submitApply(MutualApply apply) {
return Result.success(medicalMutualAidApplyService.saveApply(apply, true));
}
}
@@ -0,0 +1,127 @@
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.service.MedicalMutualAidApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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/medicalMutualAid/apply")
@Api("互助会审核")
@Ok("json:full")
public class MedicalMutualAidAuditController {
@Inject
private MedicalMutualAidApplyService medicalMutualAidApplyService;
/**
* 打开互助会审核列表页面。
*/
@At("/audit")
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/apply/audit/index.html")
@SaCheckPermission("medicalMutualAid.apply.audit")
public void index() {
}
/**
* 查询互助会审核列表。
*
* @param pageForm 分页参数
* @param keyword 申请人工号或申请人姓名
* @param diseaseName 大病名称
* @param status 审核状态
* @return 审核分页数据
*/
@At("/audit/page")
@ApiOperation("查询互助会审核列表")
@SaCheckPermission("medicalMutualAid.apply.audit")
public Result page(PageForm pageForm, String keyword, String diseaseName, Integer status) {
return Result.success(medicalMutualAidApplyService.auditPage(pageForm, keyword, diseaseName, status));
}
/**
* 打开互助会审核详情页面。
*/
@At("/audit/review")
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/apply/audit/review.html")
@SaCheckPermission("medicalMutualAid.apply.audit")
public void review() {
}
/**
* 查询审核详情。
*
* @param id 申请ID
* @return 审核详情和动态补助明细
*/
@At("/audit/review/detail")
@ApiOperation("查询互助会审核详情")
@SaCheckPermission("medicalMutualAid.apply.audit")
public Result detail(Long id) {
return Result.success(medicalMutualAidApplyService.auditDetail(id));
}
/**
* 审核通过。
*
* @param id 申请ID
* @param bonusRatio 补助系数
* @param actualSubsidyAmount 实际补助金额
* @param remark 审核备注
* @return 审核后的详情数据
*/
@At("/audit/review/approve")
@ApiOperation("互助会审核通过")
@SaCheckPermission("medicalMutualAid.apply.audit")
public Result approve(Long id, String bonusRatio, String actualSubsidyAmount, String remark) {
return Result.success(medicalMutualAidApplyService.approve(id, bonusRatio, actualSubsidyAmount, remark));
}
/**
* 弃审已审核申请,恢复为未审核状态并清理审核补助结果。
*
* @param id 申请ID
* @return 弃审后的申请数据
*/
@At("/audit/cancelAudit")
@ApiOperation("互助会弃审")
@SaCheckPermission("medicalMutualAid.apply.audit")
public Result cancelAudit(Long id) {
return Result.success(medicalMutualAidApplyService.cancelAudit(id));
}
/**
* 作废未审核申请,状态置为作废并记录审核人和审核时间。
*
* @param id 申请ID
* @return 作废后的申请数据
*/
@At("/audit/discard")
@ApiOperation("互助会作废")
@SaCheckPermission("medicalMutualAid.apply.audit")
public Result discard(Long id) {
return Result.success(medicalMutualAidApplyService.discard(id));
}
/**
* 取消作废申请,状态恢复为未审核并清空审核人和审核时间。
*
* @param id 申请ID
* @return 取消作废后的申请数据
*/
@At("/audit/cancelDiscard")
@ApiOperation("互助会取消作废")
@SaCheckPermission("medicalMutualAid.apply.audit")
public Result cancelDiscard(Long id) {
return Result.success(medicalMutualAidApplyService.cancelDiscard(id));
}
}
@@ -0,0 +1,143 @@
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.utils.CommonDownloadUtil;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.model.MutualApply;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.service.MedicalMutualAidApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.nutz.lang.util.NutMap;
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.servlet.http.HttpServletResponse;
/**
* 我的申请页面控制器,负责个人申请列表页面入口和分页查询接口。
*/
@IocBean
@At("/platform/medicalMutualAid/apply")
@Api("我的互助金申请")
@Ok("json:full")
public class MedicalMutualAidMineApplyController {
@Inject
private MedicalMutualAidApplyService medicalMutualAidApplyService;
/**
* 打开我的申请页面。
*/
@At("/mine")
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/apply/mine/index.html")
@SaCheckPermission("medicalMutualAid.apply.mine")
public void index() {
}
/**
* 打开我的申请查看/编辑页面,页面入口独立于新增申请页,避免新增逻辑与个人记录维护逻辑互相影响。
*/
@At("/mine/form")
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/apply/mine/form.html")
@SaCheckPermission("medicalMutualAid.apply.mine")
public void form() {
}
/**
* 查询我的申请维护页初始化数据,当前主要用于加载疾病类型下拉。
*
* @return 页面初始化数据
*/
@At("/mine/form/initApplyData")
@ApiOperation("查询我的互助金申请维护页初始化数据")
@SaCheckPermission("medicalMutualAid.apply.mine")
public Result initApplyData() {
return Result.success(medicalMutualAidApplyService.initApplyData());
}
/**
* 查询我的申请详情,供个人查看和编辑页面回显使用。
*
* @param id 申请ID
* @return 申请详情
*/
@At("/mine/form/detail")
@ApiOperation("查询我的互助金申请详情")
@SaCheckPermission("medicalMutualAid.apply.mine")
public Result detail(@Param("id") Long id) {
return Result.success(medicalMutualAidApplyService.applyDetail(id));
}
/**
* 保存我的申请草稿,复用申请服务保存逻辑但使用我的申请权限入口。
*
* @param apply 申请表单
* @return 保存后的申请数据
*/
@At("/mine/form/saveDraft")
@ApiOperation("保存我的互助金申请草稿")
@SaCheckPermission("medicalMutualAid.apply.mine")
public Result saveDraft(MutualApply apply) {
return Result.success(medicalMutualAidApplyService.saveApply(apply, false));
}
/**
* 提交我的申请修改,提交后仍进入未审核状态等待审核。
*
* @param apply 申请表单
* @return 提交后的申请数据
*/
@At("/mine/form/submitApply")
@ApiOperation("提交我的互助金申请")
@SaCheckPermission("medicalMutualAid.apply.mine")
public Result submitApply(MutualApply apply) {
return Result.success(medicalMutualAidApplyService.saveApply(apply, true));
}
/**
* 查询我的申请列表。
*
* @param pageForm 分页参数
* @param diseaseName 大病名称
* @return 我的申请分页数据
*/
@At("/mine/page")
@ApiOperation("查询我的互助金申请")
@SaCheckPermission("medicalMutualAid.apply.mine")
public Result page(PageForm pageForm, String diseaseName) {
return Result.success(medicalMutualAidApplyService.minePage(pageForm, diseaseName));
}
/**
* 查询我的申请列表,兼容平台通用 initTableMixins 的默认分页接口命名。
*
* @param pageForm 分页与查询参数
* @param diseaseName 大病名称
* @return 我的申请分页数据
*/
@At("/mine/pageData")
@ApiOperation("查询我的互助金申请")
@SaCheckPermission("medicalMutualAid.apply.mine")
public Result pageData(PageForm pageForm, String diseaseName) {
return Result.success(medicalMutualAidApplyService.minePage(pageForm, diseaseName));
}
/**
* 导出我的申请单,Word 模板来源于系统模板管理,模板编码为 medical_mutual_aid_apply_form。
*
* @param id 申请ID
* @param response HTTP响应
*/
@At("/mine/exportApplyForm")
@Ok("void")
@ApiOperation("导出我的大病医疗互助金申请单")
@SaCheckPermission("medicalMutualAid.apply.mine")
public void exportApplyForm(@Param("id") Long id, HttpServletResponse response) {
NutMap exportData = medicalMutualAidApplyService.exportMineApplyForm(id);
CommonDownloadUtil.download(exportData.getString("fileName"), (byte[]) exportData.get("bytes"), response);
}
}
@@ -0,0 +1,73 @@
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.utils.CommonDownloadUtil;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.service.MedicalMutualAidApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
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;
/**
* 医疗互助汇总控制器,负责汇总页面入口和审核通过数据的汇总查询接口。
*/
@IocBean
@At("/platform/medicalMutualAid/apply")
@Api("医疗互助汇总")
@Ok("json:full")
public class MedicalMutualAidSummaryController {
@Inject
private MedicalMutualAidApplyService medicalMutualAidApplyService;
/**
* 打开医疗互助汇总页面。
*/
@At("/summary")
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/apply/summary/index.html")
@SaCheckPermission("medicalMutualAid.apply.summary")
public void index() {
}
/**
* 查询医疗互助汇总列表。
*
* @param pageForm 分页参数
* @param deptName 所在单位
* @param userName 姓名
* @param joinYear 加入年份
* @param submitYear 申报年份,按申请提交时间所在年份过滤
* @return 汇总分页数据
*/
@At("/summary/page")
@ApiOperation("查询医疗互助汇总")
@SaCheckPermission("medicalMutualAid.apply.summary")
public Result page(PageForm pageForm, String deptName, String userName, Integer joinYear, Integer submitYear) {
return Result.success(medicalMutualAidApplyService.summaryPage(pageForm, deptName, userName, joinYear, submitYear));
}
/**
* 导出医疗互助汇总,导出列与页面当前展示列保持一致。
*
* @param deptName 所在单位
* @param userName 姓名
* @param joinYear 加入年份
* @param submitYear 申报年份,按申请提交时间所在年份过滤
* @param response HTTP 响应
*/
@At("/summary/exportExcel")
@Ok("void")
@ApiOperation("导出医疗互助汇总")
@SaCheckPermission("medicalMutualAid.apply.summary")
public void exportExcel(String deptName, String userName, Integer joinYear, Integer submitYear, HttpServletResponse response) {
Workbook workbook = medicalMutualAidApplyService.exportSummary(deptName, userName, joinYear, submitYear);
CommonDownloadUtil.download("医疗互助汇总.xlsx", workbook, response);
}
}
@@ -0,0 +1,269 @@
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.model;
import lombok.Data;
import org.nutz.dao.entity.annotation.ColDefine;
import org.nutz.dao.entity.annotation.ColType;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Default;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Table;
import org.nutz.dao.entity.annotation.TableMeta;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import org.nutz.dao.interceptor.annotation.PrevUpdate;
import java.util.Date;
/**
* 互助金申请主表实体,承载申请人信息、疾病费用、审核状态和审核后的补助汇总结果。
*/
@Data
@Table("tb_mutual_apply")
@TableMeta("{'mysql-charset':'utf8mb4'}")
@Comment("互助金申请表")
public class MutualApply {
/** 申请主键,数据库自增生成。 */
@Id
@Comment("主键")
private Long id;
/** 申请编号,用于后续查询、打印和业务留痕。 */
@Column("apply_no")
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("申请编号")
private String applyNo;
/** 申请人用户 ID。 */
@Column("user_id")
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("申请人用户ID")
private String userId;
/** 申请人工号或登录名。 */
@Column("login_name")
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("申请人工号/登录名")
private String loginName;
/** 申请人姓名。 */
@Column("user_name")
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("申请人姓名")
private String userName;
/** 性别。 */
@Column("sex")
@ColDefine(type = ColType.VARCHAR, width = 20)
@Comment("性别")
private String sex;
/** 出生年月。 */
@Column("birthday")
@Comment("出生年月")
private Date birthday;
/** 籍贯。 */
@Column("native_place")
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("籍贯")
private String nativePlace;
/** 学历。 */
@Column("education")
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("学历")
private String education;
/** 职称。 */
@Column("professional_title")
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("职称")
private String professionalTitle;
/** 工作部门 ID。 */
@Column("dept_id")
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("工作部门ID")
private String deptId;
/** 工作部门名称。 */
@Column("dept_name")
@ColDefine(type = ColType.VARCHAR, width = 200)
@Comment("工作部门(系部)")
private String deptName;
/** 身份证号码。 */
@Column("id_card")
@ColDefine(type = ColType.VARCHAR, width = 30)
@Comment("身份证号码")
private String idCard;
/** 联系电话。 */
@Column("mobile")
@ColDefine(type = ColType.VARCHAR, width = 30)
@Comment("联系电话")
private String mobile;
/** 工资银行卡号。 */
@Column("bank_card_no")
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("工资银行卡号")
private String bankCardNo;
/** 开户行。 */
@Column("bank_name")
@ColDefine(type = ColType.VARCHAR, width = 200)
@Comment("开户行")
private String bankName;
/** 入会时间。 */
@Column("join_date")
@Comment("入会时间")
private Date joinDate;
/** 加入年份。 */
@Column("join_year")
@Comment("加入年份")
private Integer joinYear;
/** 大病类型 ID,来源于疾病类型档案。 */
@Column("disease_type_id")
@Comment("大病类型ID")
private String diseaseTypeId;
/** 大病名称,落表保存历史名称。 */
@Column("disease_name")
@ColDefine(type = ColType.VARCHAR, width = 200)
@Comment("大病名称")
private String diseaseName;
/** 何时何病住何医院。 */
@Column("hospital_desc")
@ColDefine(type = ColType.TEXT)
@Comment("何时何病住何医院")
private String hospitalDesc;
/** 全年医疗费用总金额。 */
@Column("medical_total_amount")
@Default("0.00")
@Comment("全年医疗费用总金额")
private Double medicalTotalAmount;
/** 自付金额。 */
@Column("self_pay_amount")
@Default("0.00")
@Comment("自付金额")
private Double selfPayAmount;
/** 申请人签名文件 ID。 */
@Column("sign_file_id")
@ColDefine(type = ColType.VARCHAR, width = 64)
@Comment("申请人签名文件ID")
private String signFileId;
/** 申请人签名时间。 */
@Column("sign_time")
@Comment("申请人签名时间")
private Date signTime;
/** 申请状态:0 未审核,1 已审核。 */
@Column("status")
@Default("0")
@Comment("状态 0未审核 1已审核")
private Integer status;
/** 提交时间。 */
@Column("submit_time")
@Comment("提交时间")
private Date submitTime;
/** 审核人。 */
@Column("audit_by")
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("审核人")
private String auditBy;
/** 审核时间。 */
@Column("audit_time")
@Comment("审核时间")
private Date auditTime;
/** 审核意见。 */
@Column("audit_opinion")
@ColDefine(type = ColType.VARCHAR, width = 500)
@Comment("审核意见")
private String auditOpinion;
/** 审核使用的配置 ID。 */
@Column("config_id")
@Comment("审核使用的互助金配置ID")
private Long configId;
/** 审核使用的配置年度。 */
@Column("config_year")
@Comment("审核使用的配置年度")
private Integer configYear;
/** 区间补助小计。 */
@Column("subsidy_total_amount")
@Comment("补助小计")
private Double subsidyTotalAmount;
/** 奖励或补助系数。 */
@Column("bonus_ratio")
@Comment("奖励/补助系数")
private Double bonusRatio;
/** 实际补助金额。 */
@Column("actual_subsidy_amount")
@Comment("实际补助金额")
private Double actualSubsidyAmount;
/** 连续未申请年数。 */
@Column("continuous_unapply_year")
@Comment("连续未申请年数")
private Integer continuousUnapplyYear;
/** 本次适用最高补助限额。 */
@Column("limit_amount")
@Comment("本次适用最高补助限额")
private Double limitAmount;
/** 当前申报年度同申报人同病种已审核补助金额汇总,仅用于审核页提示展示。 */
private Double yearUsedAmount;
/** 当前申报年度同申报人同病种剩余可申报金额,仅用于审核页提示展示。 */
private Double yearRemainAmount;
/** 备注。 */
@Column("remark")
@ColDefine(type = ColType.VARCHAR, width = 500)
@Comment("备注")
private String remark;
/** 创建人。 */
@Column("create_by")
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("创建人")
private String createBy;
/** 创建时间。 */
@Column("create_time")
@PrevInsert(now = true)
@Comment("创建时间")
private Date createTime;
/** 更新人。 */
@Column("update_by")
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("更新人")
private String updateBy;
/** 更新时间。 */
@Column("update_time")
@PrevInsert(now = true)
@PrevUpdate(now = true)
@Comment("更新时间")
private Date updateTime;
}
@@ -0,0 +1,86 @@
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.model;
import lombok.Data;
import org.nutz.dao.entity.annotation.ColDefine;
import org.nutz.dao.entity.annotation.ColType;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Default;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Table;
import org.nutz.dao.entity.annotation.TableMeta;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.Date;
/**
* 互助金动态补贴金额明细实体,一条申请按配置区间拆分为多条补助计算记录。
*/
@Data
@Table("tb_mutual_apply_subsidy")
@TableMeta("{'mysql-charset':'utf8mb4'}")
@Comment("互助金补贴金额明细表")
public class MutualApplySubsidy {
/** 补助明细主键。 */
@Id
@Comment("主键")
private Long id;
/** 所属申请 ID。 */
@Column("apply_id")
@Comment("申请ID")
private Long applyId;
/** 使用的补助比例配置 ID。 */
@Column("ratio_id")
@Comment("使用的补助比例配置ID")
private Long ratioId;
/** 页面展示用的区间名称。 */
@Column("range_name")
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("区间名称")
private String rangeName;
/** 区间开始金额。 */
@Column("start_amount")
@Default("0.00")
@Comment("区间开始金额")
private Double startAmount;
/** 区间结束金额,空表示不设上限。 */
@Column("end_amount")
@Comment("区间结束金额(NULL表示无限)")
private Double endAmount;
/** 该区间的补助比例。 */
@Column("ratio")
@Default("0.00")
@Comment("补助比例(%)")
private Double ratio;
/** 本区间参与补助计算的金额。 */
@Column("base_amount")
@Default("0.00")
@Comment("本区间参与计算金额")
private Double baseAmount;
/** 本区间计算出的补助金额。 */
@Column("subsidy_amount")
@Default("0.00")
@Comment("本区间补助金额")
private Double subsidyAmount;
/** 区间排序。 */
@Column("sort")
@Default("1")
@Comment("排序")
private Integer sort;
/** 创建时间。 */
@Column("create_time")
@PrevInsert(now = true)
@Comment("创建时间")
private Date createTime;
}
@@ -0,0 +1,132 @@
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.apply.model.MutualApply;
import org.apache.poi.ss.usermodel.Workbook;
import org.nutz.lang.util.NutMap;
/**
* 医疗互助申请服务,统一承载申请、我的申请、审核和汇总页面所需的公共业务方法。
*/
public interface MedicalMutualAidApplyService extends BaseService<MutualApply> {
/**
* 构建申请页面初始化数据,包含当前用户占位信息和疾病类型下拉数据。
*
* @return 页面初始化数据
*/
NutMap initApplyData();
/**
* 保存互助金申请,草稿和提交都复用该方法并由 submit 参数控制状态。
*
* @param apply 互助金申请表单
* @param submit 是否提交审核
* @return 保存后的申请数据
*/
MutualApply saveApply(MutualApply apply, boolean submit);
/**
* 查询申请表单详情,用于我的申请查看和编辑时回显原始申请数据。
*
* @param applyId 申请ID
* @return 申请主表数据
*/
MutualApply applyDetail(Long applyId);
/**
* 查询我的申请列表。
*
* @param pageForm 分页参数
* @param diseaseName 大病名称
* @return 我的申请分页列表
*/
Pagination<MutualApply> minePage(PageForm pageForm, String diseaseName);
/**
* 导出我的申请单 Word 文件,模板来源于系统模板管理,参数在服务层统一组装。
*
* @param applyId 申请ID
* @return 包含 fileName 和 bytes 的导出结果
*/
NutMap exportMineApplyForm(Long applyId);
/**
* 查询互助会审核列表。
*
* @param pageForm 分页参数
* @param keyword 申请人工号或申请人姓名
* @param diseaseName 大病名称
* @param status 审核状态
* @return 审核分页列表
*/
Pagination<MutualApply> auditPage(PageForm pageForm, String keyword, String diseaseName, Integer status);
/**
* 查询审核详情并携带动态补助明细。
*
* @param applyId 申请ID
* @return 审核详情数据
*/
NutMap auditDetail(Long applyId);
/**
* 审核通过并保存补助计算结果。
*
* @param applyId 申请ID
* @param bonusRatio 审核页面录入的补助系数
* @param actualSubsidyAmount 实际补助金额
* @param remark 审核备注
* @return 审核后的详情数据
*/
NutMap approve(Long applyId, String bonusRatio, String actualSubsidyAmount, String remark);
/**
* 弃审已审核的互助金申请,将状态恢复为未审核并清理审核结果和补助明细。
*
* @param applyId 申请ID
* @return 弃审后的申请数据
*/
MutualApply cancelAudit(Long applyId);
/**
* 作废未审核的互助金申请,记录作废操作人和操作时间。
*
* @param applyId 申请ID
* @return 作废后的申请数据
*/
MutualApply discard(Long applyId);
/**
* 取消作废互助金申请,将状态恢复为未审核并清空审核人和审核时间。
*
* @param applyId 申请ID
* @return 取消作废后的申请数据
*/
MutualApply cancelDiscard(Long applyId);
/**
* 查询医疗互助汇总列表。
*
* @param pageForm 分页参数
* @param deptName 所在单位
* @param userName 姓名
* @param joinYear 加入年份
* @param submitYear 申报年份,按提交时间所属年份过滤
* @return 汇总分页列表
*/
Pagination<NutMap> summaryPage(PageForm pageForm, String deptName, String userName, Integer joinYear, Integer submitYear);
/**
* 导出医疗互助汇总,导出字段与汇总页面展示列保持一致,动态补助区间按当前查询结果生成。
*
* @param deptName 所在单位
* @param userName 姓名
* @param joinYear 加入年份
* @param submitYear 申报年份,按提交时间所属年份过滤
* @return Excel 工作簿
*/
Workbook exportSummary(String deptName, String userName, Integer joinYear, Integer submitYear);
}
@@ -0,0 +1,158 @@
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.config.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.config.model.MutualBonus;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.config.model.MutualConfig;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.config.model.MutualMemberConfig;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.config.model.MutualRatio;
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.config.service.MedicalMutualAidConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;
/**
* 医疗互助配置 PC 端控制器,负责页面入口与配置管理接口转发。
*/
@IocBean
@At("/platform/medicalMutualAid/config")
@Api("医疗互助配置")
@Ok("json:full")
public class MedicalMutualAidConfigController {
@Inject
private MedicalMutualAidConfigService medicalMutualAidConfigService;
/**
* 打开医疗互助配置页面。
*/
@At("")
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/config/index.html")
@SaCheckPermission("medicalMutualAid.config")
public void index() {
}
/**
* 查询互助金配置列表,供配置列表页按年度和配置名称筛选。
*
* @param year 年度,为空时查询全部年度
* @param configName 配置名称,为空时不限制名称
* @return 互助金配置列表
*/
@At
@ApiOperation("查询医疗互助配置列表")
@SaCheckPermission("medicalMutualAid.config")
public Result listConfigs(Integer year, String configName) {
return Result.success(medicalMutualAidConfigService.listConfigs(year, configName));
}
/**
* 查询指定年度的完整配置数据。
*
* @param year 年度
* @return 聚合配置数据
*/
@At
@ApiOperation("查询医疗互助配置")
@SaCheckPermission("medicalMutualAid.config")
public Result configData(Integer year) {
return Result.success(medicalMutualAidConfigService.getConfigData(year));
}
/**
* 保存互助金基础配置。
*
* @param config 基础配置表单
* @return 保存后的基础配置
*/
@At
@ApiOperation("保存互助金基础配置")
@SaCheckPermission("medicalMutualAid.config")
public Result saveConfig(MutualConfig config) {
return Result.success(medicalMutualAidConfigService.saveConfig(config));
}
/**
* 删除互助金基础配置及其关联配置。
*
* @param id 基础配置 ID
* @return 删除结果
*/
@At
@ApiOperation("删除互助金基础配置")
@SaCheckPermission("medicalMutualAid.config")
public Result deleteConfig(Long id) {
medicalMutualAidConfigService.deleteConfig(id);
return Result.success();
}
/**
* 保存补助比例配置。
*
* @param ratio 补助比例表单
* @return 保存后的补助比例
*/
@At
@ApiOperation("保存补助比例配置")
@SaCheckPermission("medicalMutualAid.config")
public Result saveRatio(MutualRatio ratio) {
return Result.success(medicalMutualAidConfigService.saveRatio(ratio));
}
/**
* 删除补助比例配置。
*
* @param id 补助比例 ID
* @return 删除结果
*/
@At
@ApiOperation("删除补助比例配置")
@SaCheckPermission("medicalMutualAid.config")
public Result deleteRatio(Long id) {
medicalMutualAidConfigService.deleteRatio(id);
return Result.success();
}
/**
* 保存连续未申请奖励配置。
*
* @param bonus 连续未申请奖励表单
* @return 保存后的奖励配置
*/
@At
@ApiOperation("保存连续未申请奖励配置")
@SaCheckPermission("medicalMutualAid.config")
public Result saveBonus(MutualBonus bonus) {
return Result.success(medicalMutualAidConfigService.saveBonus(bonus));
}
/**
* 删除连续未申请奖励配置。
*
* @param id 奖励配置 ID
* @return 删除结果
*/
@At
@ApiOperation("删除连续未申请奖励配置")
@SaCheckPermission("medicalMutualAid.config")
public Result deleteBonus(Long id) {
medicalMutualAidConfigService.deleteBonus(id);
return Result.success();
}
/**
* 保存会员缴费配置。
*
* @param memberConfig 会员缴费配置表单
* @return 保存后的会员缴费配置
*/
@At
@ApiOperation("保存会员缴费配置")
@SaCheckPermission("medicalMutualAid.config")
public Result saveMemberConfig(MutualMemberConfig memberConfig) {
return Result.success(medicalMutualAidConfigService.saveMemberConfig(memberConfig));
}
}

Some files were not shown because too many files have changed in this diff Show More