职工福利功能优化-1.2

This commit is contained in:
2026-09-07 08:22:15 +08:00
parent d605391fa5
commit 50937b936d
3 changed files with 33 additions and 6 deletions
@@ -24,9 +24,16 @@ public interface WelfareSelectionSituationService extends BaseService<WelfareLis
* 按选择情况页面的查询条件导出人员选择明细。 * 按选择情况页面的查询条件导出人员选择明细。
* *
* @param pageForm 页面查询条件,包含项目、福利选项、姓名、工号、组织范围、人员类型和选择状态 * @param pageForm 页面查询条件,包含项目、福利选项、姓名、工号、组织范围、人员类型和选择状态
* @param response HTTP响应,返回包含快递单号和签字图片的XLSX文件流 * @param response HTTP响应,返回包含收货备注、快递单号和签字图片的XLSX文件流
*/ */
void exportXlsx(WelfareSelectionSituationPageForm pageForm, HttpServletResponse response); void exportXlsx(WelfareSelectionSituationPageForm pageForm, HttpServletResponse response);
/**
* 导出福利领取表。
*
* @param pageForm 页面查询条件,projectId指定福利项目
* @param response HTTP响应,返回包含福利选项、收货备注和签字图片的XLSX文件流
*/
void receiveXlsx(WelfareSelectionSituationPageForm pageForm, HttpServletResponse response); void receiveXlsx(WelfareSelectionSituationPageForm pageForm, HttpServletResponse response);
/** /**
@@ -49,6 +49,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.util.*; import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@IocBean(args = {"refer:dao"}) @IocBean(args = {"refer:dao"})
@@ -77,6 +78,7 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
GROUP_CONCAT(DISTINCT t3.optionName ,'',t2.selectNum,'份)') AS selectedOptions, GROUP_CONCAT(DISTINCT t3.optionName ,'',t2.selectNum,'份)') AS selectedOptions,
GROUP_CONCAT(DISTINCT t2.mobile) AS mobile, GROUP_CONCAT(DISTINCT t2.mobile) AS mobile,
GROUP_CONCAT(DISTINCT t2.receiveAddress) AS receiveAddress, GROUP_CONCAT(DISTINCT t2.receiveAddress) AS receiveAddress,
MAX(t2.remark) AS remark,
t4.username AS userName, t4.username AS userName,
t4.loginname AS loginName, t4.loginname AS loginName,
t4.sex, t4.sex,
@@ -147,11 +149,7 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
String detailUrl = StrUtil.removeSuffix(Globals.AppDomain, "/") String detailUrl = StrUtil.removeSuffix(Globals.AppDomain, "/")
+ "/platform/welfare/notice/index?id=" + project.getId(); + "/platform/welfare/notice/index?id=" + project.getId();
String detailLine = "查看详情:" + detailUrl; String detailLine = "查看详情:" + detailUrl;
// 移除前端预置的详情行后统一追加到正文末尾,既避免重复链接,也保证最终消息排版一致。 String messageBody = removeExistingNoticeDetailLinks(plainContent, detailUrl);
String messageBody = Arrays.stream(plainContent.split("\\R"))
.filter(line -> !line.trim().startsWith("查看详情:"))
.collect(Collectors.joining("\n"))
.trim();
String sendContent = StrUtil.isBlank(messageBody) ? detailLine : messageBody + "\n" + detailLine; String sendContent = StrUtil.isBlank(messageBody) ? detailLine : messageBody + "\n" + detailLine;
// 详情地址已经包含在消息正文中,跳转参数保持为空,避免消息中心再次追加 PC、移动端详情链接。 // 详情地址已经包含在消息正文中,跳转参数保持为空,避免消息中心再次追加 PC、移动端详情链接。
boolean success = smsService.sendMsg("6", loginNames, null, title, sendContent, null, null); boolean success = smsService.sendMsg("6", loginNames, null, title, sendContent, null, null);
@@ -161,6 +159,23 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
return loginNames.size(); return loginNames.size();
} }
/**
* 删除正文中已存在的当前福利详情链接,避免管理员在默认链接前继续输入文字后重复追加。
*
* @param content 管理员在发送弹窗中编辑的纯文本正文,可在任意位置包含“查看详情:URL”
* @param detailUrl 当前福利项目的标准详情地址
* @return 已移除全部当前项目详情链接并清理空白行的消息正文;没有其他正文时返回空字符串
*/
private String removeExistingNoticeDetailLinks(String content, String detailUrl) {
String detailPattern = "查看详情\\s*[:]\\s*" + Pattern.quote(detailUrl);
String contentWithoutDetail = content.replaceAll(detailPattern, "");
return Arrays.stream(contentWithoutDetail.split("\\R"))
.map(String::trim)
.filter(StrUtil::isNotBlank)
.collect(Collectors.joining("\n"))
.trim();
}
/** /**
* 构建选择情况列表与消息接收人共用的筛选条件。 * 构建选择情况列表与消息接收人共用的筛选条件。
* 除页面条件外会主动叠加当前登录人的分工会数据范围。 * 除页面条件外会主动叠加当前登录人的分工会数据范围。
@@ -210,6 +225,7 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
GROUP_CONCAT(DISTINCT t2.receiveAddress) AS receiveAddress, GROUP_CONCAT(DISTINCT t2.receiveAddress) AS receiveAddress,
GROUP_CONCAT(DISTINCT t2.courierNumber) AS legacyCourierNumber, GROUP_CONCAT(DISTINCT t2.courierNumber) AS legacyCourierNumber,
MAX(t2.userSign) AS userSign, MAX(t2.userSign) AS userSign,
MAX(t2.remark) AS remark,
t4.username AS userName, t4.username AS userName,
t4.loginname AS loginName, t4.loginname AS loginName,
t4.sex t4.sex
@@ -279,6 +295,7 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
if(project.getProvideMode() == 3){ if(project.getProvideMode() == 3){
entities.add(new ExcelExportEntity("收货地址", "receiveAddress", 40)); entities.add(new ExcelExportEntity("收货地址", "receiveAddress", 40));
} }
entities.add(new ExcelExportEntity("备注", "remark", 30));
ExcelExportEntity courierNumberEntity = new ExcelExportEntity("快递单号", "courierNumber", 30); ExcelExportEntity courierNumberEntity = new ExcelExportEntity("快递单号", "courierNumber", 30);
courierNumberEntity.setWrap(true); courierNumberEntity.setWrap(true);
entities.add(courierNumberEntity); entities.add(courierNumberEntity);
@@ -372,6 +389,7 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
SELECT SELECT
t1.*, t1.*,
t2.userSign, t2.userSign,
MAX(t2.remark) AS remark,
t3.username userName, t3.username userName,
t3.loginname loginName, t3.loginname loginName,
GROUP_CONCAT(DISTINCT t2.selectOptionId) AS selectOptionIds GROUP_CONCAT(DISTINCT t2.selectOptionId) AS selectOptionIds
@@ -433,6 +451,7 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
optionList.forEach(option -> { optionList.forEach(option -> {
entities.add(new ExcelExportEntity(option.getOptionName(), option.getOptionName(), 20)); entities.add(new ExcelExportEntity(option.getOptionName(), option.getOptionName(), 20));
}); });
entities.add(new ExcelExportEntity("备注", "remark", 30));
ExcelExportEntity userSignEntity = new ExcelExportEntity("签字", "userSign", 20); ExcelExportEntity userSignEntity = new ExcelExportEntity("签字", "userSign", 20);
userSignEntity.setType(2); userSignEntity.setType(2);
userSignEntity.setExportImageType(2); userSignEntity.setExportImageType(2);
@@ -153,6 +153,7 @@ layout("/layouts/platform.html"){
></el-table-column> ></el-table-column>
<el-table-column label="收货地址" prop="receiveAddress" v-if="provideMode===3"></el-table-column> <el-table-column label="收货地址" prop="receiveAddress" v-if="provideMode===3"></el-table-column>
<el-table-column label="备注" prop="remark" show-overflow-tooltip></el-table-column>
<el-table-column align="center" fixed="right" header-align="center" label="操作" width="100px"> <el-table-column align="center" fixed="right" header-align="center" label="操作" width="100px">
<template slot-scope="{row}"> <template slot-scope="{row}">