This commit is contained in:
2026-06-18 15:33:11 +08:00
parent 47e971ebc8
commit bedf31bf0c
4 changed files with 215 additions and 12 deletions
@@ -52,9 +52,9 @@ public class TourSchoolUserAssignmentController {
@At
@SaCheckPermission("tour.schoolUserAssignment")
public Result pageData(PageForm pageForm, Integer year, String settingId, String matterId, String unionId,
String personType, String keyword, String assignSource) {
String personType, String keyword, String assignSource, Boolean cancelled) {
return Result.success(tourUserAssignmentService.schoolAssignmentPage(pageForm, year, settingId, matterId,
unionId, personType, keyword, assignSource));
unionId, personType, keyword, assignSource, cancelled));
}
/**
@@ -64,9 +64,9 @@ public class TourSchoolUserAssignmentController {
@SaCheckPermission("tour.schoolUserAssignment")
@Ok("void")
public void exportData(PageForm pageForm, Integer year, String settingId, String matterId, String unionId,
String personType, String keyword, String assignSource, HttpServletResponse response) {
String personType, String keyword, String assignSource, Boolean cancelled, HttpServletResponse response) {
List<NutMap> rows = tourUserAssignmentService.schoolAssignmentExportRows(pageForm, year, settingId, matterId,
unionId, personType, keyword, assignSource);
unionId, personType, keyword, assignSource, cancelled);
ExportParams exportParams = new ExportParams();
exportParams.setSheetName("校工会人员分配");
exportParams.setType(ExcelType.XSSF);
@@ -74,6 +74,27 @@ public class TourSchoolUserAssignmentController {
CommonDownloadUtil.download("校工会人员分配.xlsx", workbook, response);
}
/**
* 按页面当前查询条件给人员分配列表中的可报名人员发送提醒。
* 参数包括列表筛选条件和 content 提醒内容;返回 Resultdata.receiverCount 表示实际接收人数。
*/
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("tour.schoolUserAssignment")
@SLog(type = "tour", tag = "疗休养校工会人员分配", msg = "发送校工会人员分配提醒")
public Result sendReminder(PageForm pageForm, Integer year, String settingId, String matterId, String unionId,
String personType, String keyword, String assignSource, Boolean cancelled, String content) {
if (StrUtil.isBlank(content)) {
return Result.error("请输入提醒内容");
}
try {
return Result.success(tourUserAssignmentService.sendSchoolAssignmentReminder(pageForm, year, settingId,
matterId, unionId, personType, keyword, assignSource, cancelled, content));
} catch (IllegalArgumentException e) {
return Result.error(e.getMessage());
}
}
/**
* 分页查询候选人员,候选范围由疗休养配置的可参加人员范围决定;userIds 仅作为人员选择器筛选条件。
*/
@@ -21,10 +21,12 @@ public interface TourUserAssignmentService extends BaseService<TourUserAssignmen
* @param personType 人员类型:FORMAL 正式人员,BACKUP 替补人员
* @param keyword 姓名或工号关键字
* @param assignSource 分配类别:SCHOOL_UNION 校工会分配,BRANCH_UNION 分工会分配;为空时查询全部
* @param cancelled 是否退出:true 已退出,false 未退出,空时查询全部
* @return 校工会分配记录分页数据
*/
Pagination<NutMap> schoolAssignmentPage(PageForm pageForm, Integer year, String settingId, String matterId,
String unionId, String personType, String keyword, String assignSource);
String unionId, String personType, String keyword, String assignSource,
Boolean cancelled);
/**
* 按校工会人员分配页面当前筛选条件查询导出数据,不做分页截断。
@@ -37,10 +39,31 @@ public interface TourUserAssignmentService extends BaseService<TourUserAssignmen
* @param personType 人员类型:FORMAL 正式人员,BACKUP 替补人员
* @param keyword 姓名或工号关键字
* @param assignSource 分配类别:SCHOOL_UNION 校工会分配,BRANCH_UNION 分工会分配;为空时查询全部
* @param cancelled 是否退出:true 已退出,false 未退出,空时查询全部
* @return 符合当前页面查询条件的人员分配导出数据
*/
List<NutMap> schoolAssignmentExportRows(PageForm pageForm, Integer year, String settingId, String matterId,
String unionId, String personType, String keyword, String assignSource);
String unionId, String personType, String keyword, String assignSource,
Boolean cancelled);
/**
* 按校工会人员分配页面当前筛选条件发送报名提醒。
*
* @param pageForm 排序参数,提醒接收人范围与当前列表筛选口径保持一致,不按当前分页截断
* @param year 疗休养年度
* @param settingId 疗休养配置ID
* @param matterId 疗休养事项ID
* @param unionId 所属分工会ID
* @param personType 人员类型:FORMAL 正式人员,BACKUP 替补人员
* @param keyword 姓名或工号关键字
* @param assignSource 分配类别:SCHOOL_UNION 校工会分配,BRANCH_UNION 分工会分配;为空时查询全部
* @param cancelled 是否退出:true 已退出,false 未退出,空时查询全部
* @param content 提醒内容,由页面弹框输入,不能为空
* @return 发送结果,receiverCount 表示本次去重后的接收人数
*/
NutMap sendSchoolAssignmentReminder(PageForm pageForm, Integer year, String settingId, String matterId,
String unionId, String personType, String keyword, String assignSource,
Boolean cancelled, String content);
/**
* 分页查询校工会可分配候选人,候选人来自疗休养配置的可参加人员范围,并排除同一配置下已分配人员。
@@ -2,12 +2,15 @@ package com.budwk.app.zhgh.dayofficework.tour.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.sys.models.Sys_config;
import com.budwk.app.sys.services.SysConfigService;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.web.commons.base.Globals;
import com.budwk.app.zhgh.dayofficework.message.service.GlobalMessageSendService;
import com.budwk.app.zhgh.dayofficework.tour.models.*;
import com.budwk.app.zhgh.dayofficework.tour.service.TourUserAssignmentService;
import org.nutz.dao.Chain;
@@ -39,13 +42,17 @@ public class TourUserAssignmentServiceImpl extends BaseServiceImpl<TourUserAssig
@Inject
private SysConfigService sysConfigService;
@Inject
private GlobalMessageSendService globalMessageSendService;
public TourUserAssignmentServiceImpl(Dao dao) {
super(dao);
}
@Override
public Pagination<NutMap> schoolAssignmentPage(PageForm pageForm, Integer year, String settingId, String matterId,
String unionId, String personType, String keyword, String assignSource) {
String unionId, String personType, String keyword, String assignSource,
Boolean cancelled) {
Sql sql = Sqls.create("""
SELECT
a.*,
@@ -70,6 +77,7 @@ public class TourUserAssignmentServiceImpl extends BaseServiceImpl<TourUserAssig
cnd.andEX("a.matterId", "=", matterId);
cnd.andEX("a.unionId", "=", unionId);
cnd.andEX("a.personType", "=", personType);
appendCancelledCondition(cnd, cancelled);
if (StrUtil.isNotBlank(keyword)) {
SqlExpressionGroup group = new SqlExpressionGroup();
group.orLike("a.userName", keyword);
@@ -83,12 +91,36 @@ public class TourUserAssignmentServiceImpl extends BaseServiceImpl<TourUserAssig
@Override
public List<NutMap> schoolAssignmentExportRows(PageForm pageForm, Integer year, String settingId, String matterId,
String unionId, String personType, String keyword, String assignSource) {
List<NutMap> rows = assignmentExportRows(pageForm, year, settingId, matterId, unionId, personType, keyword, assignSource);
String unionId, String personType, String keyword, String assignSource,
Boolean cancelled) {
List<NutMap> rows = assignmentExportRows(pageForm, year, settingId, matterId, unionId, personType, keyword, assignSource, cancelled);
fillAssignmentExportText(rows);
return rows;
}
@Override
public NutMap sendSchoolAssignmentReminder(PageForm pageForm, Integer year, String settingId, String matterId,
String unionId, String personType, String keyword, String assignSource,
Boolean cancelled, String content) {
if (StrUtil.isBlank(content)) {
throw new IllegalArgumentException("请输入提醒内容");
}
List<NutMap> rows = assignmentExportRows(pageForm, year, settingId, matterId, unionId, personType, keyword, assignSource, cancelled);
List<String> receiverIds = rows.stream()
.map(row -> row.getString("userId"))
.filter(StrUtil::isNotBlank)
.distinct()
.collect(Collectors.toList());
if (Lang.isEmpty(receiverIds)) {
throw new IllegalArgumentException("当前查询条件下暂无可发送人员");
}
JSONObject config = new JSONObject();
config.set("pcUrl", Globals.AppDomain + "/platform/tour/schoolUserAssignment");
config.set("mobileUrl", Globals.AppDomain + "/platform/tooltip/h5");
globalMessageSendService.sendMessage("疗休养报名提醒", content.trim(), 1, receiverIds, config);
return NutMap.NEW().addv("receiverCount", receiverIds.size());
}
@Override
public Pagination<NutMap> schoolCandidatePage(PageForm pageForm, String settingId, String unionId, String keyword, List<String> userIds) {
TourSetting setting = fetchSettingForAssignment(settingId);
@@ -128,7 +160,7 @@ public class TourUserAssignmentServiceImpl extends BaseServiceImpl<TourUserAssig
return Collections.emptyList();
}
List<NutMap> rows = assignmentExportRows(pageForm, year, settingId, matterId, unionId, personType, keyword,
TourUserAssignment.ASSIGN_SOURCE_BRANCH_UNION);
TourUserAssignment.ASSIGN_SOURCE_BRANCH_UNION, null);
fillAssignmentExportText(rows);
return rows;
}
@@ -146,7 +178,8 @@ public class TourUserAssignmentServiceImpl extends BaseServiceImpl<TourUserAssig
* 构建人员分配导出查询,筛选条件与页面分页列表保持一致,但导出时不追加分页。
*/
private List<NutMap> assignmentExportRows(PageForm pageForm, Integer year, String settingId, String matterId,
String unionId, String personType, String keyword, String assignSource) {
String unionId, String personType, String keyword, String assignSource,
Boolean cancelled) {
Sql sql = Sqls.create("""
SELECT
a.*,
@@ -170,6 +203,7 @@ public class TourUserAssignmentServiceImpl extends BaseServiceImpl<TourUserAssig
cnd.andEX("a.matterId", "=", matterId);
cnd.andEX("a.unionId", "=", unionId);
cnd.andEX("a.personType", "=", personType);
appendCancelledCondition(cnd, cancelled);
if (StrUtil.isNotBlank(keyword)) {
SqlExpressionGroup group = new SqlExpressionGroup();
group.orLike("a.userName", keyword);
@@ -181,6 +215,20 @@ public class TourUserAssignmentServiceImpl extends BaseServiceImpl<TourUserAssig
return listMap(sql);
}
/**
* 按是否退出筛选人员分配记录;未退出需要兼容历史空值,与页面展示逻辑保持一致。
*/
private void appendCancelledCondition(Cnd cnd, Boolean cancelled) {
if (cancelled == null) {
return;
}
if (Boolean.TRUE.equals(cancelled)) {
cnd.and("a.cancelled", "=", true);
return;
}
cnd.and(Cnd.exps("a.cancelled", "=", false).or("a.cancelled", "is", null));
}
/**
* 为 Excel 导出补充字典文本,避免前端标签渲染值直接出现在表格里。
*/