This commit is contained in:
=
2026-08-21 17:56:00 +08:00
parent c5b26eb86a
commit c043980a08
11 changed files with 493 additions and 787 deletions
@@ -149,8 +149,9 @@ public class SysHomeController {
);
List<Sys_menu> menus = sysUserService.getMenus(SecurityUtil.getUserId());
List<String> allMenuIds = menus.stream().map(Sys_menu::getId).toList();
//List<Sys_menu> sysMenus = list.stream().filter(m -> allMenuIds.contains(m.getId())).sorted(Comparator.comparingInt(Sys_menu::getLocation)).toList();
List<Sys_menu> sysMenus = list.stream().sorted(Comparator.comparingInt(Sys_menu::getLocation)).toList();
// 推荐应用必须受当前用户角色菜单权限约束,避免展示无权访问的入口。
List<Sys_menu> sysMenus = list.stream().filter(m -> allMenuIds.contains(m.getId())).sorted(Comparator.comparingInt(Sys_menu::getLocation)).toList();
//List<Sys_menu> sysMenus = list.stream().sorted(Comparator.comparingInt(Sys_menu::getLocation)).toList();
return Result.success(sysMenus);
}
@@ -166,8 +167,9 @@ public class SysHomeController {
);
List<Sys_menu> menus = sysUserService.getMenus(SecurityUtil.getUserId());
List<String> allMenuIds = menus.stream().map(Sys_menu::getId).toList();
//List<Sys_menu> sysMenus = list.stream().filter(m -> allMenuIds.contains(m.getId())).sorted(Comparator.comparingInt(Sys_menu::getLocation)).toList();
List<Sys_menu> sysMenus = list.stream().sorted(Comparator.comparingInt(Sys_menu::getLocation)).toList();
// 推荐服务必须受当前用户角色菜单权限约束,避免展示无权访问的入口。
List<Sys_menu> sysMenus = list.stream().filter(m -> allMenuIds.contains(m.getId())).sorted(Comparator.comparingInt(Sys_menu::getLocation)).toList();
//List<Sys_menu> sysMenus = list.stream().sorted(Comparator.comparingInt(Sys_menu::getLocation)).toList();
return Result.success(sysMenus);
}
@@ -1,54 +1,32 @@
package com.budwk.app.zhgh.staffbenefit.blessing.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.fastjson.JSON;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.utils.DateUtil;
import com.budwk.app.sys.models.Sys_task;
import com.budwk.app.sys.services.SysTaskService;
import com.budwk.app.task.services.TaskPlatformService;
import com.budwk.app.zhgh.staffbenefit.blessing.models.Blessing;
import com.budwk.app.zhgh.staffbenefit.blessing.models.BlessingUser;
import com.budwk.app.zhgh.staffbenefit.blessing.service.BlessingService;
import com.budwk.app.zhgh.staffbenefit.blessing.models.BlessingBirthdayConfig;
import com.budwk.app.zhgh.staffbenefit.blessing.service.BirthdayBlessingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
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 org.nutz.trans.Trans;
import org.quartz.CronExpression;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
/**
* 会员生日祝福管理:生日人员查询、手工发送和贺卡配置。
*/
@IocBean
@Ok("json")
@ApiOperation("职工祝福")
@Ok("json:full")
@Api(tags = "会员生日祝福")
@At("/platform/blessing/applyList")
public class BlessingController {
@Inject
private BlessingService blessingService;
@Inject
private TaskPlatformService taskPlatformService;
@Inject
private SysTaskService sysTaskService;
private BirthdayBlessingService birthdayBlessingService;
@At("")
@Ok("beetl:/platform/zhgh/staffbenefit/blessing/applyList.html")
@@ -56,110 +34,62 @@ public class BlessingController {
public void index() {
}
@At
@SaCheckPermission("blessing.applyList")
public Result pageData(PageForm pageForm, String blessingName) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
bl.*,
aus.groupName
FROM
`blessing` bl
LEFT JOIN activity_user_scope aus ON aus.groupId = bl.activityGroupId
$condition
""");
if (Strings.isNotBlank(blessingName)) {
cnd.where().andLike("bl.blessingName", blessingName);
}
cnd.groupBy("aus.groupId");
sql.setCondition(cnd);
return Result.success(blessingService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
@At("/h5")
@Ok("beetl:/platform/zhghh5/staffbenefit/blessing/index.html")
@SaCheckLogin
public void h5() {
}
@At
@ApiOperation("分页查询会员生日人员")
@SaCheckPermission("blessing.applyList")
public Result pageData(PageForm pageForm, String searchKeyword, String unionId, String unitId, String userState,
String personType, String preparedBy, String employmentType, String birthdayStart, String birthdayEnd) {
return Result.success(birthdayBlessingService.pageUsers(pageForm, searchKeyword, unionId, unitId, userState, personType, preparedBy, employmentType, birthdayStart, birthdayEnd));
}
@At
@Aop(TransAop.READ_COMMITTED)
@Ok("void")
@ApiOperation("导出会员生日人员")
@SaCheckPermission("blessing.applyList")
public Result doAdd(@Param("Blessing") Blessing blessing) {
blessing.setApplyDate(DateUtil.getDate());
blessingService.insert(blessing);
if (blessing.getIsSend().equals("1")) {
blessingService.addTask(blessing);
public void exportXlsx(String searchKeyword, String unionId, String unitId, String userState, String personType,
String preparedBy, String employmentType, String birthdayStart, String birthdayEnd, HttpServletResponse response) {
birthdayBlessingService.exportUsers(searchKeyword, unionId, unitId, userState, personType, preparedBy, employmentType, birthdayStart, birthdayEnd, response);
}
@At
@ApiOperation("按当前筛选条件发送生日祝福")
@SaCheckPermission("blessing.applyList")
public Result sendMsgByQueryUsers(String searchKeyword, String unionId, String unitId, String userState,
String personType, String preparedBy, String employmentType, String birthdayStart, String birthdayEnd, String title, String content) {
if (StrUtil.isBlank(title) || StrUtil.isBlank(content)) {
return Result.error("标题和发送内容不能为空");
}
int count = birthdayBlessingService.sendByQuery(searchKeyword, unionId, unitId, userState, personType, preparedBy, employmentType, birthdayStart, birthdayEnd, title.trim(), content.trim());
return count == 0 ? Result.error("当前筛选条件下没有可发送的会员") : Result.success("已发送给" + count + "");
}
@At
@ApiOperation("向单个会员发送生日祝福")
@SaCheckPermission("blessing.applyList")
public Result sendMsgByUser(String userId, String title, String content) {
if (StrUtil.isBlank(title) || StrUtil.isBlank(content)) {
return Result.error("标题和发送内容不能为空");
}
int count = birthdayBlessingService.sendByUserId(userId, title.trim(), content.trim(), false);
return count == 0 ? Result.error("未获取到可发送的会员") : Result.success("发送成功");
}
@At
@SaCheckLogin
public Result getConfig() {
return Result.success(birthdayBlessingService.getConfig());
}
@At
@SaCheckPermission("blessing.applyList")
public Result saveOrModifyConfig(BlessingBirthdayConfig config) {
birthdayBlessingService.saveConfig(config);
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("blessing.applyList")
public Result doEdit(@Param("Blessing") Blessing blessing) {
if (Strings.isNotBlank(blessing.getBlessingCron()) && !blessing.getBlessingCron().equals("* * * * * ? *")) {
blessing.setApplyDate(DateUtil.getDate());
blessingService.updateIgnoreNull(blessing);
if (blessing.getIsSend().equals("1")) {
blessingService.editTask(blessing);
}
}
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("blessing.applyList")
public Result doDelete(String id) {
blessingService.delete(id);
Sys_task sysTask = sysTaskService.fetch(Cnd.where("name", "=", id));
blessingService.dao().clear(BlessingUser.class, Cnd.where("blessingId", "=", id));
if (sysTask != null) {
taskPlatformService.delete(sysTask.getId(), sysTask.getId());
sysTaskService.delete(sysTask.getId());
}
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("blessing.applyList")
public Result findOne(String id) {
try {
Blessing blessing = blessingService.fetch(id);
NutMap nutMap = NutMap.WRAP(JSON.parseObject(JSON.toJSONString(blessing)));
List<String> result = new ArrayList<>();
try {
CronExpression cronExpression = new CronExpression(nutMap.getString("blessingCron"));
Date lastTime = new Date();
for (int i = 0; i < 5; i++) {
lastTime = cronExpression.getNextValidTimeAfter(lastTime);
if (lastTime != null) {
result.add(DateUtil.formatDateTime(lastTime));
} else {
String[] newStr = nutMap.getString("blessingCron").split(" ");
String second = (newStr[0].equals("?") || newStr[0].equals("*")) ? "00" : newStr[0];
String minute = (newStr[1].equals("?") || newStr[1].equals("*")) ? "00" : newStr[1];
String hour = (newStr[2].equals("?") || newStr[2].equals("*")) ? "00" : newStr[2];
String day = (newStr[3].equals("?") || newStr[3].equals("*")) ? "00" : newStr[3];
String month = (newStr[4].equals("?") || newStr[4].equals("*")) ? "00" : newStr[4];
String s6 = (newStr[5].equals("?") || newStr[5].equals("*")) ? "00" : newStr[5];
String year = (newStr[6].equals("?") || newStr[6].equals("*")) ? "00" : newStr[6];
String Time = year + "/" + month + "/" + day + " " + hour + ":" + minute + ":" + second;
result.add(Time);
break;
}
}
} catch (ParseException e) {
e.printStackTrace();
}
nutMap.setv("blessingDate", result);
return Result.success(nutMap);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -1,73 +1,38 @@
package com.budwk.app.zhgh.staffbenefit.blessing.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.blessing.service.BlessingService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import com.budwk.app.zhgh.staffbenefit.blessing.service.BirthdayBlessingService;
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.lang.Strings;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* 会员生日祝福发送日志。
*/
@IocBean
@Ok("json:full")
@Api(tags = "会员生日祝福日志")
@At("/platform/blessing/userList")
public class BlessingUserController {
@Inject
private BirthdayBlessingService birthdayBlessingService;
@At("")
@Ok("beetl:/platform/zhgh/staffbenefit/blessing/blessingUser.html")
@SaCheckPermission("blessing.user")
public void index() {
}
@Inject
private BlessingService blessingService;
@At
@ApiOperation("分页查询生日祝福发送日志")
@SaCheckPermission("blessing.user")
public Result pageData(PageForm pageForm, String data, String unionId, String unitId, String personType, String userState, String sex, String blessingName) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
u.loginname,
u.username,
u.sex,
u.personType,
u.userState,
u.unionname,
u.unitname,
u.birthday,
blu.*,
bl.blessingName
FROM
blessing_user blu
LEFT JOIN blessing bl ON bl.id = blu.blessingId
LEFT JOIN `vw_user` u ON u.id = blu.userId
$condition
""");
if (Strings.isNotBlank(pageForm.getSearchKeyword()) && Strings.isNotBlank(pageForm.getSearchName())) {
cnd.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword());
}
if (Strings.isNotBlank(blessingName)) {
cnd.where().andLike("bl.blessingName", blessingName);
}
cnd.andEX("u.unionid", "=", unionId);
cnd.andEX("u.unitid", "=", unitId);
cnd.andEX("u.personType", "=", personType);
cnd.andEX("u.userState", "=", userState);
cnd.andEX("u.sex", "=", sex);
cnd.andEX("blu.applyDate", "=", data);
cnd.desc("blu.blessingId");
cnd.desc("blu.applyDate");
cnd.desc("u.unitid");
sql.setCondition(cnd);
return Result.success(blessingService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
public Result pageData(PageForm pageForm, String searchKeyword, String unionId, String unitId) {
return Result.success(birthdayBlessingService.pageLogs(pageForm, searchKeyword, unionId, unitId));
}
}
@@ -0,0 +1,36 @@
package com.budwk.app.zhgh.staffbenefit.blessing.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.Name;
import org.nutz.dao.entity.annotation.EL;
import org.nutz.dao.entity.annotation.Prev;
import org.nutz.dao.entity.annotation.Table;
/**
* 生日贺卡配置。
*/
@Data
@Table("blessing_birthday_config")
@EqualsAndHashCode(callSuper = true)
public class BlessingBirthdayConfig extends BaseModel {
@Name
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("背景图片地址")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String picUrl;
@Column
@Comment("生日贺卡图片地址")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String birthdayUrl;
}
@@ -0,0 +1,62 @@
package com.budwk.app.zhgh.staffbenefit.blessing.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.Name;
import org.nutz.dao.entity.annotation.EL;
import org.nutz.dao.entity.annotation.Prev;
import org.nutz.dao.entity.annotation.Table;
/**
* 生日祝福发送日志,每位接收人保存一条记录。
*/
@Data
@Table("blessing_birthday_msg_log")
@EqualsAndHashCode(callSuper = true)
public class BlessingBirthdayMsgLog extends BaseModel {
@Name
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
private String pushTime;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
private String msgTitle;
@Column
@ColDefine(type = ColType.TEXT)
private String msgContent;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
private String receiveBy;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
private String receiveName;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
private String pushBy;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
private String pushByName;
@Column
@ColDefine(type = ColType.VARCHAR, width = 20)
private String pushType;
@Column
@ColDefine(type = ColType.VARCHAR, width = 500)
private String link;
}
@@ -0,0 +1,32 @@
package com.budwk.app.zhgh.staffbenefit.blessing.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.zhgh.staffbenefit.blessing.models.BlessingBirthdayConfig;
import javax.servlet.http.HttpServletResponse;
/**
* 生日祝福人员查询、消息发送和日志保存服务。
*/
public interface BirthdayBlessingService {
Pagination pageUsers(PageForm pageForm, String searchKeyword, String unionId, String unitId, String userState,
String personType, String preparedBy, String employmentType, String birthdayStart, String birthdayEnd);
void exportUsers(String searchKeyword, String unionId, String unitId, String userState, String personType,
String preparedBy, String employmentType, String birthdayStart, String birthdayEnd, HttpServletResponse response);
int sendByUserId(String userId, String title, String content, boolean automatic);
int sendByQuery(String searchKeyword, String unionId, String unitId, String userState, String personType,
String preparedBy, String employmentType, String birthdayStart, String birthdayEnd, String title, String content);
void executeAutomaticSend();
BlessingBirthdayConfig getConfig();
void saveConfig(BlessingBirthdayConfig config);
Pagination pageLogs(PageForm pageForm, String searchKeyword, String unionId, String unitId);
}
@@ -0,0 +1,224 @@
package com.budwk.app.zhgh.staffbenefit.blessing.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
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.base.sms.SmsService;
import com.budwk.app.base.utils.CommonDownloadUtil;
import com.budwk.app.sys.models.Sys_user;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.dayofficework.message.strategy.impl.LocalMessageSendStrategy;
import com.budwk.app.zhgh.staffbenefit.blessing.models.BlessingBirthdayConfig;
import com.budwk.app.zhgh.staffbenefit.blessing.models.BlessingBirthdayMsgLog;
import com.budwk.app.zhgh.staffbenefit.blessing.service.BirthdayBlessingService;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.random.R;
import org.nutz.lang.util.NutMap;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* 生日祝福业务实现:统一处理会员生日筛选、多渠道发送和发送审计日志。
*/
@IocBean(args = {"refer:dao"})
@Slf4j
public class BirthdayBlessingServiceImpl extends BaseServiceImpl<Sys_user> implements BirthdayBlessingService {
private static final String AUTO_TITLE = "智慧工会生日祝福";
private static final String AUTO_CONTENT = "校工会祝您:生日快乐!幸福安康!";
@Inject
private LocalMessageSendStrategy localMessageSendStrategy;
@Inject
private SmsService smsService;
public BirthdayBlessingServiceImpl(Dao dao) {
super(dao);
}
@Override
public Pagination pageUsers(PageForm pageForm, String searchKeyword, String unionId, String unitId, String userState,
String personType, String preparedBy, String employmentType, String birthdayStart, String birthdayEnd) {
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), buildUserSql(searchKeyword, unionId, unitId, userState, personType, preparedBy, employmentType, birthdayStart, birthdayEnd, false));
}
@Override
public void exportUsers(String searchKeyword, String unionId, String unitId, String userState, String personType,
String preparedBy, String employmentType, String birthdayStart, String birthdayEnd, HttpServletResponse response) {
List<NutMap> users = listMap(buildUserSql(searchKeyword, unionId, unitId, userState, personType, preparedBy, employmentType, birthdayStart, birthdayEnd, false));
List<ExcelExportEntity> columns = new ArrayList<>();
columns.add(new ExcelExportEntity("工号", "loginname", 20));
columns.add(new ExcelExportEntity("姓名", "username", 20));
columns.add(new ExcelExportEntity("性别", "sex", 10));
columns.add(new ExcelExportEntity("联系方式", "mobile", 20));
columns.add(new ExcelExportEntity("出生日期", "birthday", 20));
columns.add(new ExcelExportEntity("生日倒计时(天)", "daysUntilBirthday", 20));
columns.add(new ExcelExportEntity("在职状态", "userState", 20));
columns.add(new ExcelExportEntity("人员类型", "personType", 20));
columns.add(new ExcelExportEntity("人员性质", "preparedBy", 20));
columns.add(new ExcelExportEntity("所属工会", "unionName", 20));
columns.add(new ExcelExportEntity("所属单位", "unitName", 20));
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
try (Workbook workbook = ExcelExportUtil.exportExcel(exportParams, columns, users)) {
CommonDownloadUtil.download("会员生日人员.xlsx", workbook, response);
} catch (Exception e) {
log.error("导出会员生日人员失败", e);
throw new IllegalStateException("导出会员生日人员失败", e);
}
}
@Override
public int sendByUserId(String userId, String title, String content, boolean automatic) {
if (StrUtil.isBlank(userId)) {
return 0;
}
List<Sys_user> users = dao().query(Sys_user.class, Cnd.where(Sys_user::getId, "=", userId)
.and(Sys_user::getMember, "=", true).and("disabled", "=", false));
return sendToUsers(users, title, content, automatic);
}
@Override
public int sendByQuery(String searchKeyword, String unionId, String unitId, String userState, String personType,
String preparedBy, String employmentType, String birthdayStart, String birthdayEnd, String title, String content) {
List<NutMap> rows = listMap(buildUserSql(searchKeyword, unionId, unitId, userState, personType, preparedBy, employmentType, birthdayStart, birthdayEnd, false));
List<String> userIds = rows.stream().map(row -> row.getString("id")).collect(Collectors.toList());
if (userIds.isEmpty()) {
return 0;
}
List<Sys_user> users = dao().query(Sys_user.class, Cnd.where(Sys_user::getId, "in", userIds));
return sendToUsers(users, title, content, false);
}
@Override
public void executeAutomaticSend() {
List<NutMap> rows = listMap(buildUserSql(null, null, null, null, null, null, null, null, null, true));
List<String> userIds = rows.stream().map(row -> row.getString("id")).collect(Collectors.toList());
if (userIds.isEmpty()) {
log.info("今日没有符合条件的会员生日人员");
return;
}
List<Sys_user> users = dao().query(Sys_user.class, Cnd.where(Sys_user::getId, "in", userIds));
sendToUsers(users, AUTO_TITLE, AUTO_CONTENT, true);
}
@Override
public BlessingBirthdayConfig getConfig() {
BlessingBirthdayConfig config = dao().fetch(BlessingBirthdayConfig.class, Cnd.NEW().desc("updatedAt"));
return config == null ? new BlessingBirthdayConfig() : config;
}
@Override
public void saveConfig(BlessingBirthdayConfig config) {
if (StrUtil.isBlank(config.getId())) {
dao().insert(config);
} else {
dao().updateIgnoreNull(config);
}
}
@Override
public Pagination pageLogs(PageForm pageForm, String searchKeyword, String unionId, String unitId) {
Sql sql = Sqls.create("SELECT log.*, u.loginname, u.username, u.unitName, u.unionName FROM blessing_birthday_msg_log log LEFT JOIN vw_user u ON u.id = log.receiveBy $condition");
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(searchKeyword)) {
cnd.and(Cnd.exps("u.username", "like", "%" + searchKeyword + "%").or("u.loginname", "like", "%" + searchKeyword + "%"));
}
cnd.andEX("u.unionId", "=", unionId);
cnd.andEX("u.unitId", "=", unitId);
cnd.desc("log.pushTime");
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
private Sql buildUserSql(String searchKeyword, String unionId, String unitId, String userState, String personType,
String preparedBy, String employmentType, String birthdayStart, String birthdayEnd, boolean todayOnly) {
Sql sql = Sqls.create("SELECT u.id, u.loginname, u.username, u.sex, u.birthday, u.mobile, u.unitName, u.unionName, u.userState, u.personType, u.preparedBy, DATEDIFF(CASE WHEN DATE_FORMAT(u.birthday, '%m-%d') >= DATE_FORMAT(CURDATE(), '%m-%d') THEN STR_TO_DATE(CONCAT(YEAR(CURDATE()), '-', DATE_FORMAT(u.birthday, '%m-%d')), '%Y-%m-%d') ELSE STR_TO_DATE(CONCAT(YEAR(CURDATE()) + 1, '-', DATE_FORMAT(u.birthday, '%m-%d')), '%Y-%m-%d') END, CURDATE()) AS daysUntilBirthday FROM vw_user u $condition");
Cnd cnd = Cnd.NEW();
cnd.and("u.member", "=", 1).and("u.disabled", "=", 0).and("u.birthday", "is not", null);
if (StrUtil.isNotBlank(searchKeyword)) {
cnd.and(Cnd.exps("u.username", "like", "%" + searchKeyword + "%").or("u.loginname", "like", "%" + searchKeyword + "%"));
}
cnd.andEX("u.unionId", "=", unionId);
cnd.andEX("u.unitId", "=", unitId);
cnd.andEX("u.userState", "=", userState);
cnd.andEX("u.personType", "=", personType);
cnd.andEX("u.preparedBy", "=", preparedBy);
cnd.andEX("u.employmentType", "=", employmentType);
cnd.andEX("u.birthday", ">=", birthdayStart);
cnd.andEX("u.birthday", "<=", birthdayEnd);
if (todayOnly) {
cnd.and("MONTH(u.birthday)", "=", "MONTH(CURDATE())").and("DAY(u.birthday)", "=", "DAY(CURDATE())");
} else {
cnd.asc("daysUntilBirthday");
}
sql.setCondition(cnd);
return sql;
}
private int sendToUsers(List<Sys_user> users, String title, String content, boolean automatic) {
if (users == null || users.isEmpty()) {
return 0;
}
List<String> userIds = users.stream().map(Sys_user::getId).collect(Collectors.toList());
localMessageSendStrategy.send(title, content, 2, userIds, null);
if (Boolean.TRUE.equals(com.budwk.app.web.commons.base.Globals.MyConfig.getBoolean("AppSms"))) {
// 生日祝福仅发送文本内容,不附带 PC 或移动端贺卡链接。
smsService.massSendByUsers(users, title, content, null, null);
// 仅在学校统一消息开启且发送成功后保留发送日志。
saveLogs(users, title, content, null, automatic);
}
return users.size();
}
/**
* 记录每位接收人的发送结果,定时任务和人工操作使用不同推送类型。
*/
private void saveLogs(List<Sys_user> users, String title, String content, String link, boolean automatic) {
String operatorId = "system";
String operatorName = "系统推送";
if (!automatic) {
try {
operatorId = SecurityUtil.getUserId();
operatorName = SecurityUtil.getUserUsername();
} catch (Exception e) {
log.warn("未获取到手工生日祝福发送人,按系统推送记录", e);
}
}
final String pushBy = operatorId;
final String pushByName = operatorName;
List<BlessingBirthdayMsgLog> logs = users.stream().map(user -> {
BlessingBirthdayMsgLog logItem = new BlessingBirthdayMsgLog();
// fastInsert 不会执行实体的 @Prev 主键生成,批量写入前显式生成日志主键。
logItem.setId(R.UU32());
logItem.setPushTime(DateUtil.now());
logItem.setMsgTitle(title);
logItem.setMsgContent(content);
logItem.setReceiveBy(user.getId());
logItem.setReceiveName(user.getUsername());
logItem.setPushBy(pushBy);
logItem.setPushByName(pushByName);
logItem.setPushType(automatic ? "系统推送" : "手动推送");
logItem.setLink(link);
return logItem;
}).collect(Collectors.toList());
dao().fastInsert(logs);
}
}
@@ -0,0 +1,32 @@
package com.budwk.app.zhgh.staffbenefit.blessing.task;
import com.budwk.app.web.commons.base.Globals;
import com.budwk.app.zhgh.staffbenefit.blessing.service.BirthdayBlessingService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
/**
* 每日生日祝福定时任务,仅发送给当天公历生日的会员。
*/
@IocBean
@Slf4j
public class BirthdayBlessingTask implements Job {
@Inject
private BirthdayBlessingService birthdayBlessingService;
@Override
public void execute(JobExecutionContext context) {
// 系统参数关闭时不发送自动祝福,手工发送不受此开关限制。
Boolean enabled = Globals.MyConfig.getBoolean("BirthdayBlessingEnabled");
if (Boolean.FALSE.equals(enabled)) {
log.info("生日祝福开关未开启,跳过定时任务:{}", context.getJobDetail().getKey());
return;
}
log.info("执行生日祝福定时任务:{}", context.getJobDetail().getKey());
birthdayBlessingService.executeAutomaticSend();
}
}
@@ -1,398 +1,21 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.box {
width: 500px;
height: 100px;
margin: 150px auto 0;
}
.inp {
width: 300px !important;
margin-right: 20px;
}
</style>
<link href="${base!}/assets/platform/plugins/vue-cron/vcrontab.css" rel="stylesheet"/>
<script src="${base!}/assets/platform/plugins/vue-cron/vcrontab.umd.min.js"></script>
<!--# layout("/layouts/platform.html"){ #-->
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">祝福名称:</div>
<div class="search-item-option">
<el-input placeholder="请输入祝福名称" v-model="pageForm.blessingName" clearable>
<template slot="prepend">祝福名称</template>
</el-input>
</div>
</div>
<div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt20">
<table-tool label="祝福列表">
<el-button icon="el-icon-s-promotion" type="primary" size="small"
@click="openAdd">新建祝福
</el-button>
</table-tool>
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
ref="table"
:size="tableSize" class="vi-table">
<el-table-column align="center" header-align="center" type="index" :index="indexMethod" label="序号"
width="80px"></el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
show-overflow-tooltip
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
>
<template v-if="column.prop==='blessingMode'" scope="{row:{blessingMode}}">
{{blessingMode=='birthday'?'生日祝福':'其它祝福'}}
</template>
<template v-else-if="column.prop==='isSend'" scope="{row:{isSend}}">
{{isSend=='2'?'任务已完成':isSend=='1'?'进行中':'未开启'}}
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作" fixed="right" width="300px">
<template scope="{row}">
<el-button type="primary" @click="openView(row)" size="mini">
查看
</el-button>
<el-button type="primary" @click="openEdit(row)" size="mini" :disabled="row.isSend!=0">
编辑
</el-button>
<el-button type="danger" @click="doDelete(row)" size="mini">删除</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #edit>
<el-form :model="formData" ref="addForm" :rules="formRules" label-width="120px"
style="width: 50%;margin: auto">
<el-row :gutter="20">
<el-col :span="24">
<el-form-item prop="blessingName" label="祝福名称">
<el-input v-model="formData.blessingName" style="width: 100%"
type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="activityGroupId" label="发送范围">
<el-select v-model="formData.activityGroupId" placeholder="请选择发送范围" filterable
clearable
style="width: 100%">
<el-option v-for="item in activityGroupList"
:value="item.groupId"
:key="item.groupId"
:label="item.groupName"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="blessingMode" label="祝福模式">
<el-select v-model="formData.blessingMode" placeholder="请选择祝福模式" filterable clearable
style="width: 100%">
<el-option label="生日祝福" value="birthday"></el-option>
<el-option label="其它祝福" value="other"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="isSend" label="是否发送">
<el-switch
v-model="formData.isSend"
active-color="#13ce66"
active-value="1"
inactive-value="0"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="发送方式" prop="sendTypes">
<el-checkbox-group v-model="formData.sendTypes" size="medium">
<el-checkbox border label="msg">短信发送</el-checkbox>
<el-checkbox border label="WeChat">微信发送</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="日期和时间" prop="blessingCron">
<el-input v-for="a in cronExecuteDate" :value="a" readonly></el-input>
<!-- <el-input v-model="formData.blessingCron" placeholder class="inp" readonly></el-input>-->
<el-button type="primary" @click="showDialog">设置日期和时间</el-button>
<sapn style="color: red" v-if="cronExecuteDate.length>2">只展示最近五次执行时间</sapn>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="blessingContent" label="祝福内容">
<el-input v-model="formData.blessingContent" style="width: 100%"
type="textarea" rows="4"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-row style="float: right">
<el-button type="primary" @click="formData.id?doEdit():doAdd()">创建</el-button>
</el-row>
</el-form-item>
</el-form>
</template>
<template #view>
<el-form label-suffix="" label-width="140px" label-position="left" style="width: 50%;margin: auto">
<el-row gutter="20">
<el-col :span="12">
<el-form-item label="祝福名称">
<el-input readonly :value="viewData.blessingName"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="发送范围">
<el-input readonly :value="viewData.groupName"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="祝福模式">
<el-input readonly
:value="viewData.blessingMode==='other'?'其它祝福':'生日祝福'"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否发送">
<el-input readonly
:value="viewData.isSend==='0'?'未开启':viewData.isSend==='1'?'进行中':'任务已完成'"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="最近五次执行时间">
<el-input readonly v-for="a in viewData.blessingDate" :value="a"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="祝福内容">
<el-input style="width: 100%" readonly :value="viewData.blessingContent" rows="4"
type="textarea"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
</guava>
<el-dialog title="生成 cron" :visible.sync="showCron">
<vcron :expression="formData.blessingCron"
@hide="showCron=false"
@fill="crontabFill"
ref="cron"></vcron>
</el-dialog>
<el-card shadow="never"><search @search="doSearch">
<search-item label="姓名/工号"><el-input v-model="pageForm.searchKeyword" clearable placeholder="请输入姓名或工号查询"></el-input></search-item>
<search-item label="所属工会"><el-select v-model="pageForm.unionId" clearable filterable placeholder="请选择所属工会" @change="changeUnion"><el-option v-for="item in unions" :key="item.id" :label="item.name" :value="item.id"></el-option></el-select></search-item>
<search-item label="所属单位"><el-select v-model="pageForm.unitId" clearable filterable placeholder="请选择所属单位"><el-option v-for="item in units" :key="item.id" :label="item.name" :value="item.id"></el-option></el-select></search-item>
<search-item label="在职状态"><dict-select v-model="pageForm.userState" clearable placeholder="在职状态" code="USER_STATE"></dict-select></search-item>
<search-item label="教职工类别"><dict-select v-model="pageForm.personType" clearable placeholder="请选择教职工类别" code="USER_PERSON_TYPE"></dict-select></search-item>
<search-item label="编制类别"><dict-select v-model="pageForm.preparedBy" clearable placeholder="请选择编制类别" code="USER_PREPARED_BY_TYPE"></dict-select></search-item>
<search-item label="用人方式"><dict-select v-model="pageForm.employmentType" clearable placeholder="请选择用人方式" code="USER_EMPLOYMENT_TYPE"></dict-select></search-item>
<search-item label="生日日期"><el-date-picker v-model="birthdayRange" type="daterange" value-format="yyyy-MM-dd" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="changeBirthdayRange"></el-date-picker></search-item>
</search></el-card>
<el-card shadow="never" class="mt10"><table-tool label="会员生日人员"><el-button type="primary" size="small" @click="exportXlsx">导出 Excel</el-button><el-button type="primary" size="small" @click="openSend()">发送通知</el-button></table-tool>
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder" row-key="id" style="width:100%"><el-table-column type="index" :index="indexMethod" label="序号" width="80"></el-table-column><el-table-column prop="loginname" label="工号" min-width="120"></el-table-column><el-table-column prop="username" label="姓名" min-width="100"></el-table-column><el-table-column prop="sex" label="性别" width="80"></el-table-column><el-table-column prop="mobile" label="联系方式" min-width="120"></el-table-column><el-table-column prop="birthday" label="出生日期" min-width="110"></el-table-column><el-table-column prop="daysUntilBirthday" label="生日倒计时(天)" min-width="130"></el-table-column><el-table-column prop="userState" label="在职状态" min-width="100"></el-table-column><el-table-column prop="personType" label="人员类型" min-width="110"></el-table-column><el-table-column prop="preparedBy" label="人员性质" min-width="110"></el-table-column><el-table-column prop="unionName" label="所属工会" min-width="150"></el-table-column><el-table-column prop="unitName" label="所属单位" min-width="150"></el-table-column><el-table-column label="操作" fixed="right" width="180"><template slot-scope="{row}"><el-button size="mini" type="primary" @click="openView(row.id)">查看</el-button><el-button size="mini" type="primary" @click="openSend(row)">发送通知</el-button></template></el-table-column></el-table><!--#include("/layouts/pagination.html"){}#--></el-card>
<el-dialog title="发送生日祝福" :visible.sync="sendVisible" width="520px"><el-form ref="sendFormRef" :model="sendForm" :rules="sendRules" label-width="80px"><el-form-item label="接收人"><el-input :value="sendUserName" readonly></el-input></el-form-item><el-form-item label="标题" prop="title"><el-input v-model="sendForm.title"></el-input></el-form-item><el-form-item label="内容" prop="content"><el-input v-model="sendForm.content" type="textarea" :rows="5"></el-input></el-form-item></el-form><div slot="footer"><el-button @click="sendVisible=false">取消</el-button><el-button type="primary" :loading="sending" @click="sendMessage">确定</el-button></div></el-dialog>
<el-dialog title="人员信息" :visible.sync="viewVisible" width="90%"><member-info ref="memberInfoRef"></member-info></el-dialog>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
"vcron": typeof vcrontab !== 'undefined' ? vcrontab.default || vcrontab : null
},
data() {
return {
cronExecuteDate: [],
viewData: {},
formData: {
sendTypes: [],
blessingCron: ''
},
pageForm: {
blessingName: ''
},
activityGroupList: [],
dialogVisible: false,
tableColumns: [
{prop: 'blessingName', label: '祝福名称'},
{prop: 'groupName', label: '发送范围'},
{prop: 'blessingMode', label: '祝福模式'},
{prop: 'sendTypesName', label: '发送方式',},
{prop: 'isSend', label: '是否发送',},
],
formRules: {
blessingName: [{required: true, message: '请填写祝福名称', trigger: ['blur', 'change']}],
activityGroupId: [{required: true, message: '请选择发送范围', trigger: ['blur', 'change']}],
blessingMode: [{required: true, message: '请选择祝福模式', trigger: ['blur', 'change']}],
sendTypes: [{required: true, message: '请选择发送方式', trigger: ['blur', 'change']}],
blessingContent: [{required: true, message: '请填写祝福内容', trigger: ['blur', 'change']}],
},
showCron: false,
}
},
methods: {
async openView(row) {
const {data} = await $.post(loc() + '/findOne', {id: row.id})
this.viewData = row
this.viewData.blessingDate = data.blessingDate
this.$refs.guava.view()
},
async openEdit(row) {
const {data} = await $.post(loc() + '/findOne', {id: row.id})
this.$set(this, "formData", data)
this.$refs.guava.edit()
if (this.$refs['addForm']) {
this.$refs['addForm'].resetFields()
}
},
async doDelete(row) {
const confirm = await this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm === "confirm") {
const data = await $.post('/platform/blessing/applyList/doDelete', {id: row.id})
if (data.code == 0) {
this.$message.success(data.msg);
this.$refs.guava.index()
this.doSearch()
} else {
this.$message.error(data.msg);
}
}
},
async doEdit() {
this.$refs["addForm"].validate(async valid => {
if (valid) {
const confirm = await this.$confirm('确定要修改吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm === "confirm") {
const data = await $.post(loc() + '/doEdit', {Blessing: JSON.stringify(this.formData)})
if (data.code == 0) {
this.$message.success(data.msg);
this.$refs.guava.index()
if (this.$refs['addForm']) {
this.$refs['addForm'].resetFields()
}
this.doSearch()
} else {
this.$message.error(data.msg);
}
}
}
})
},
doAdd() {
this.$refs["addForm"].validate(async valid => {
if (valid) {
const confirm = await this.$confirm('确定要创建吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm === "confirm") {
const data = await $.post(loc() + '/doAdd', {Blessing: JSON.stringify(this.formData)})
if (data.code == 0) {
this.$message.success(data.msg);
window.location.reload();
} else {
this.$message.error(data.msg);
}
}
}
})
},
async getActivityGroup() {
const {data} = await $.get('/platform/activity/basic/scope/getActivityUserScopeGroup')
this.activityGroupList = data
},
openAdd() {
this.$refs.guava.edit()
this.formData = {
sendTypes: [],
blessingCron: ''
}
},
crontabFill(value) {
this.$set(this.formData, 'blessingCron', value)
this.cronExecuteDate = this.$refs.cron.cronExecuteDate
},
showDialog() {
this.expression = this.input
this.showCron = true
},
pageData() {
this.tableLoading = true
$.post(loc() + "/pageData", this.pageForm, (data) => {
this.tableLoading = false
if (data.code == 0) {
data.data.list.forEach(v => {
if (v.sendTypes) {
const a = JSON.parse(v.sendTypes).map(z => {
if (z == "msg") {
return "短信"
} else {
return "微信"
}
})
v.sendTypesName = a.toString()
}
})
this.tableData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
} else {
this.$message.error(data.msg);
}
}, "json");
}
},
async created() {
await this.getActivityGroup()
this.pageData()
}
})
</script>
<!--#
}
#-->
<!--#include("../../staffmanage/member/common/info/memberInfo.js"){}#-->
new Vue({el:"#app",mixins:[initTableMixins],components:{"member-info":MEMBER_INFO},data:function(){return{unions:[],units:[],birthdayRange:[],sendVisible:false,viewVisible:false,sending:false,sendUserId:"",sendUserName:"",sendForm:{title:"",content:""},sendRules:{title:[{required:true,message:"请输入发送标题",trigger:"blur"}],content:[{required:true,message:"请输入发送内容",trigger:"blur"}]}}},methods:{changeUnion:function(){var self=this;this.$set(this.pageForm,"unitId",null);this.$set(this,"units",[]);if(this.pageForm.unionId){this.$businessTool.listUnit(this.pageForm.unionId).then(function(data){self.$set(self,"units",data)})}},changeBirthdayRange:function(){this.$set(this.pageForm,"birthdayStart",this.birthdayRange&&this.birthdayRange.length?this.birthdayRange[0]:null);this.$set(this.pageForm,"birthdayEnd",this.birthdayRange&&this.birthdayRange.length?this.birthdayRange[1]:null)},openView:function(id){var self=this;this.$set(this,"viewVisible",true);this.$nextTick(function(){self.$refs.memberInfoRef.onOpen(id)})},exportXlsx:function(){this.$downLoad("/platform/blessing/applyList/exportXlsx",this.pageForm)},openSend:function(row){this.$set(this,"sendUserId",row?row.id:"");this.$set(this,"sendUserName",row?row.username:"当前筛选范围内的会员");this.$set(this,"sendForm",{title:"智慧工会生日祝福",content:"校工会祝您:生日快乐!幸福安康!"});this.$set(this,"sendVisible",true)},sendMessage:function(){var self=this;this.$refs.sendFormRef.validate(function(valid){if(!valid){return}self.$set(self,"sending",true);var url=self.sendUserId?"/platform/blessing/applyList/sendMsgByUser":"/platform/blessing/applyList/sendMsgByQueryUsers";var data={title:self.sendForm.title,content:self.sendForm.content};if(self.sendUserId){self.$set(data,"userId",self.sendUserId)}else{Object.keys(self.pageForm).forEach(function(key){self.$set(data,key,self.pageForm[key])})}self.$axios.post(url,data).then(function(res){if(res.code===0){self.$message.success(res.msg);self.$set(self,"sendVisible",false)}else{self.$message.error(res.msg)}}).finally(function(){self.$set(self,"sending",false)})})}},created:function(){var self=this;this.$businessTool.listUnion().then(function(data){self.$set(self,"unions",data)});this.pageData()}})
</script><!--# } #-->
@@ -1,208 +1,3 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.box {
width: 500px;
height: 100px;
margin: 150px auto 0;
}
.inp {
width: 300px !important;
margin-right: 20px;
}
</style>
<link href="${base!}/assets/platform/plugins/vue-cron/vcrontab.css" rel="stylesheet"/>
<script src="${base!}/assets/platform/plugins/vue-cron/vcrontab.umd.min.js"></script>
<div id="app" class="platform" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">祝福名称:</div>
<div class="search-item-option">
<el-input placeholder="请输入祝福名称" v-model="pageForm.blessingName" clearable>
<template slot="prepend">祝福名称</template>
</el-input>
</div>
</div>
<div class="search-item">
<div class="search-item-label">职工信息:</div>
<div class="search-item-option">
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"
style="width: 100%"
@keyup.enter.native="doSearch">
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型"
style="width: 80px;">
<el-option label="姓名" value="username"></el-option>
<el-option label="工号" value="loginname"></el-option>
</el-select>
</el-input>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select placeholder="所属工会" v-model="pageForm.unionId" style="width: 100%;"
clearable
@change="flushUnits" @clear="flushUnits"
filterable>
<el-option v-for="item in unions" :label="item.unionname" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select placeholder="所属单位" v-model="pageForm.unitId" style="width: 100%;"
clearable
filterable>
<el-option v-for="item in units" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">祝福时间:</div>
<div class="search-item-option">
<el-date-picker
v-model="pageForm.data"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
style="width: 100%">
</el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">人员类型:</div>
<div class="search-item-option">
<dict-select v-model="pageForm.personType" style="width: 100%" clearable
placeholder="人员类型"
code="USER_PERSON_TYPE"></dict-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">在职状态:</div>
<div class="search-item-option">
<dict-select v-model="pageForm.userState" style="width: 100%" clearable
placeholder="在职状态"
code="USER_STATE"></dict-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">&emsp;&emsp;别:</div>
<div class="search-item-option">
<el-select v-model="pageForm.sex" style="width: 100%" clearable
placeholder="请选择">
<el-option v-for="sex in sexOptions" :label="sex" :value="sex"></el-option>
</el-select>
</div>
</div>
<div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt20">
<table-tool label="用户列表" :app="this">
</table-tool>
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
ref="table"
:size="tableSize" class="vi-table">
<el-table-column align="center" header-align="center" type="index" :index="indexMethod" label="序号"
width="80px"></el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
show-overflow-tooltip
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
</guava>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
"vcron": typeof vcrontab !== 'undefined' ? vcrontab.default || vcrontab : null
},
data() {
return {
pageForm: {
data: moment().format('YYYY-MM-DD'),
searchName: "username",
blessingName: ''
},
sexOptions: ['男', '女'],
unions: [],
units: [],
activityGroupList: [],
dialogVisible: false,
tableColumns: [
{prop: 'blessingName', label: '祝福名称'},
{prop: 'loginname', label: '工号'},
{prop: 'username', label: '姓名'},
{prop: 'sex', label: '性别'},
{prop: 'personType', label: '人员类型', sortable: true},
{prop: 'userState', label: '在职状态', sortable: true},
{prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true},
{prop: 'birthday', label: '出生日期', sortable: true},
{prop: 'applyDate', label: '发送时间', sortable: true},
],
formRules: {},
showCron: false,
}
},
methods: {
async getActivityGroup() {
const {data} = await $.get('/platform/activity/basic/scope/getActivityUserScopeGroup')
this.activityGroupList = data
},
async flushUnits() {
this.$set(this.pageForm, "unitId", null)
if (this.$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')) {
this.units = await this.$businessTool.listUnit(this.pageForm.unionId)
} else {
this.units = await this.$businessTool.listUnit(this.$store.state.user.union.id)
}
},
},
async created() {
await this.getActivityGroup()
this.pageData()
this.unions = await this.$businessTool.listUnion()
this.flushUnits()
}
})
</script>
<!--#
}
#-->
<!--# layout("/layouts/platform.html"){ #-->
<div id="app" v-cloak><el-card shadow="never"><search @search="doSearch"><search-item label="姓名/工号"><el-input v-model="pageForm.searchKeyword" clearable placeholder="请输入姓名或工号查询"></el-input></search-item><search-item label="所属工会"><el-select v-model="pageForm.unionId" clearable filterable placeholder="请选择所属工会" @change="changeUnion"><el-option v-for="item in unions" :key="item.id" :label="item.name" :value="item.id"></el-option></el-select></search-item><search-item label="所属单位"><el-select v-model="pageForm.unitId" clearable filterable placeholder="请选择所属单位"><el-option v-for="item in units" :key="item.id" :label="item.name" :value="item.id"></el-option></el-select></search-item></search></el-card><el-card shadow="never" class="mt10"><table-tool label="生日祝福发送日志"></table-tool><el-table :data="tableData" :size="tableSize" @sort-change="pageOrder" row-key="id" style="width:100%"><el-table-column type="index" :index="indexMethod" label="序号" width="80"></el-table-column><el-table-column prop="loginname" label="工号" min-width="120"></el-table-column><el-table-column prop="username" label="姓名" min-width="100"></el-table-column><el-table-column prop="unionName" label="所属工会" min-width="140"></el-table-column><el-table-column prop="unitName" label="所属单位" min-width="140"></el-table-column><el-table-column prop="msgTitle" label="消息标题" min-width="160"></el-table-column><el-table-column prop="msgContent" label="消息内容" min-width="220"></el-table-column><el-table-column prop="pushByName" label="推送人" min-width="100"></el-table-column><el-table-column prop="pushTime" label="推送时间" min-width="170"></el-table-column><el-table-column prop="pushType" label="推送类型" min-width="100"></el-table-column></el-table><!--#include("/layouts/pagination.html"){}#--></el-card></div>
<script nonce="${cspNonce!}">new Vue({el:"#app",mixins:[initTableMixins],data:function(){return{unions:[],units:[]}},methods:{changeUnion:function(){var self=this;this.$set(this.pageForm,"unitId",null);this.$set(this,"units",[]);if(this.pageForm.unionId){this.$businessTool.listUnit(this.pageForm.unionId).then(function(data){self.$set(self,"units",data)})}}},created:function(){var self=this;this.$businessTool.listUnion().then(function(data){self.$set(self,"unions",data)});this.pageData()}})</script><!--# } #-->
@@ -0,0 +1,5 @@
<!--# layout("/layouts/platform_h5.html"){ #-->
<div id="app" v-cloak class="birthday-card" :style="backgroundStyle"><div class="birthday-card-content"><h2>生日快乐</h2><p>校工会祝您:生日快乐!幸福安康!</p><img v-if="config.birthdayUrl" :src="config.birthdayUrl" alt="生日贺卡"></div></div>
<script nonce="${cspNonce!}">new Vue({el:"#app",data:function(){return{config:{picUrl:"",birthdayUrl:""}}},computed:{backgroundStyle:function(){return this.config.picUrl?{backgroundImage:"url("+this.config.picUrl+")"}:{}}},created:function(){var self=this;this.$axios.post("/platform/blessing/applyList/getConfig").then(function(res){if(res.code===0){self.$set(self,"config",res.data||{picUrl:"",birthdayUrl:""})}})}})</script>
<style>.birthday-card{min-height:100vh;display:flex;align-items:center;justify-content:center;background:#fdf2e9 center/cover no-repeat;padding:24px;box-sizing:border-box}.birthday-card-content{width:100%;max-width:420px;text-align:center;padding:30px 20px;border-radius:16px;background:rgba(255,255,255,.9);color:#8b4513;box-shadow:0 8px 28px rgba(0,0,0,.18)}.birthday-card-content img{width:100%;margin-top:16px;border-radius:10px}</style>
<!--# } #-->