This commit is contained in:
Paidax
2025-03-14 18:35:37 +08:00
parent 089959113a
commit a3d02c0f99
11 changed files with 226 additions and 34 deletions
@@ -1,6 +1,8 @@
package io.v.nutz.zhgh.staffmanage.sourcechange.service;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.sys.models.User;
import io.v.nutz.zhgh.data.model.UserHistory;
import io.v.nutz.zhgh.staffmanage.sourcechange.model.SourceChangeMiddleTable;
import java.util.Date;
@@ -25,4 +27,11 @@ public interface SourceChangeManageService extends BaseService<SourceChangeMiddl
* 发送消息给新入职的老师,提醒可以入会
*/
void sendMsgToNewTeacher(SourceChangeMiddleTable middleTable);
/**
* 如果有单位异动的,找出异动前和异动后的分工会,发送消息提醒两个分工会的会员管理员
* 如果在同一个分工会下异动,则只发送一条消息
*/
void sendUnitChangeTeacher(SourceChangeMiddleTable middleTable, UserHistory history);
}
@@ -30,6 +30,8 @@ import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
@@ -233,12 +235,22 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
dao().update(SourceChangeMiddleTable.class, Chain.make("isOperate", 2), Cnd.where("id", "=", middleTable.getId()));
sysUserService.deleteCacheAndUpdate(userId);
sysUserService.clearCache();
sysRoleService.clearCache();
// 如果有单位异动,发送消息提醒分工会
// if (middleTable.getChangeTypes().contains(MemberChangeType.UNIT_CHANGE.name())){
// sendUnitChangeTeacher(middleTable, history);
// }
}
}
/**
* 发送入会邀请
* @param middleTable
*/
@Override
public void sendMsgToNewTeacher(SourceChangeMiddleTable middleTable) {
String context = "尊敬的%s老师,欢迎您加入杭州医学院大家庭,请您点击此条信息或登录“智慧工会”平台申请成为杭医工会会员!"
@@ -246,4 +258,77 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
String link = Globals.AppDomain + "/platform/member/apply/submit/h5";
msgApi.sendMsg(List.of("DingTalk"), middleTable.getLoginname(), 2, "入会邀请", context, "", link);
}
/**
* 如果有单位异动的,找出异动前和异动后的分工会,发送消息提醒两个分工会的会员管理员
* 如果在同一个分工会下异动,则只发送一条消息
*/
@Override
public void sendUnitChangeTeacher(SourceChangeMiddleTable middleTable, UserHistory history) {
// 查询出异动前的工会
Sql beforeUnionSql = Sqls.create("select un.id,un.unionname from sys_union un left join sys_unit unit on unit.unionid where unit.id = @unitId")
.setParam("unitId", history.getUnitid());
beforeUnionSql.setCallback(Sqls.callback.map());
dao().execute(beforeUnionSql);
NutMap beforeUnionMap = (NutMap) beforeUnionSql.getResult();
// 查询出异动后的工会
Sql afterUnionSql = Sqls.create("select un.id,un.unionname from sys_union un left join sys_unit unit on unit.unionid where unit.id = @unitId")
.setParam("unitId", middleTable.getUnitid());
afterUnionSql.setCallback(Sqls.callback.map());
dao().execute(afterUnionSql);
NutMap afterUnionMap = (NutMap) afterUnionSql.getResult();
// 如果这两个单位归属的是不同的分工会,发送消息提醒两个分工会
if (!beforeUnionMap.getString("id").equals(afterUnionMap.getString("id"))) {
// 找到变更前的分工会会员管理员,发送消息提醒
Sql beforeUnionAdminSql = Sqls.create("""
SELECT
u.loginname,
u.username
FROM
`user` u
LEFT JOIN `sys_user_role` userRole ON userRole.userId = u.id
LEFT JOIN sys_role role ON role.id = userRole.roleId
WHERE
role.`code` = 'BranchUnionMemberAdmin'
AND u.unionid = @unionId
""").setParam("unionId", beforeUnionMap.getString("id"));
List<NutMap> beforeMapList = commonService.listMap(beforeUnionAdminSql);
if (Lang.isNotEmpty(beforeMapList)) {
for (NutMap map : beforeMapList) {
String beforeContent = "尊敬的%s老师,根据学校最新人员信息调整,%s老师的工会关系已从您处调整至%s。特此告知,烦请知悉。祝您生活愉快!"
.formatted(map.getString("username"), middleTable.getUsername(), afterUnionMap.getString("unionname"));
// msgApi.sendMsg(List.of("DingTalk"), map.getString("loginname"), 1, "工会关系转出通知", beforeContent, "", "");
}
}
// 找到变更后的分工会会员管理员,发送消息提醒
Sql afterUnionAdminSql = Sqls.create("""
SELECT
u.loginname,
u.username
FROM
`user` u
LEFT JOIN `sys_user_role` userRole ON userRole.userId = u.id
LEFT JOIN sys_role role ON role.id = userRole.roleId
WHERE
role.`code` = 'BranchUnionMemberAdmin'
AND u.unionid = @unionId
""").setParam("unionId", afterUnionMap.getString("id"));
List<NutMap> afterMapList = commonService.listMap(afterUnionAdminSql);
if (Lang.isNotEmpty(afterMapList)) {
for (NutMap map : afterMapList) {
String afterContent = "尊敬的%s老师,根据学校最新人员信息调整,%s老师的工会关系已从%s调整至您处。特此告知,烦请知悉。祝您生活愉快!"
.formatted(map.getString("username"), middleTable.getUsername(), beforeUnionMap.getString("unionname"));
// msgApi.sendMsg(List.of("DingTalk"), map.getString("loginname"), 1, "工会关系转入通知", afterContent, "", "");
}
}
}
}
}
@@ -101,6 +101,7 @@ public class TrainSignUpActivityApplyController {
tsuc.isReceiveGift,
tsuc.giftType,
tsuc.reserveMode,
tsuc.remarks,
type.lxname
FROM
`train_sign_up_course` tsuc
@@ -1,6 +1,8 @@
package io.v.nutz.zhgh.trainSignUp.controller.manage;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.utils.DateUtil;
@@ -81,14 +81,14 @@ public class TrainSignUpActivity extends BaseModel implements Serializable, SysH
private Integer limitNum;
@Column
@ColDefine(type = ColType.MYSQL_JSON)
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("活动封面")
private Sys_file cover;
private String cover;
@Column
@ColDefine(type = ColType.MYSQL_JSON)
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("微信群二维码")
private Sys_file wechat;
private String wechat;
@Column
@ColDefine(type = ColType.BOOLEAN)
@@ -139,7 +139,7 @@ public class TrainSignUpActivity extends BaseModel implements Serializable, SysH
Sys_home_activity sysHomeActivity = new Sys_home_activity();
sysHomeActivity.setId(this.getId());
sysHomeActivity.setName(this.getActivityName());
sysHomeActivity.setCover(this.getCover().getFilepath());
sysHomeActivity.setCover(this.getCover());
sysHomeActivity.setUrl("/platform/trainSingUp/manage/apply");
sysHomeActivity.setH5Url("/platform/mobile/trainSignUpActivity/trainInfo?activityId=" + this.getId() + "&endTime=" + DateUtil.format(this.getActivityEndTime(), "yyyy-MM-dd HH:mm:ss"));
if (Lang.isNotEmpty(this.getActivitySignUpStartTime())) {
@@ -143,6 +143,10 @@ public class TrainSignUpCourse extends BaseModel implements Serializable {
@ColDefine(type = ColType.VARCHAR, width = 30)
private String assort;
@Column
@Comment("详细内容备注")
@ColDefine(type = ColType.TEXT)
private String remarks;
private String courseTimeName;
}