发短信
This commit is contained in:
+5
-1
@@ -17,10 +17,12 @@ import io.v.nutz.zhgh.staffmanage.member.handle.MemberApplyToDoHandler;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
@@ -80,6 +82,7 @@ public class ClubRegistApplyController {
|
||||
@At
|
||||
@POST
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("sys.club.clubRegist.clubRegistApply")
|
||||
public Object doAdd(@Param(value = "club", required = false) Sys_club club,
|
||||
@Param(value = "isSave", required = false) Boolean isSave,
|
||||
@@ -115,7 +118,7 @@ public class ClubRegistApplyController {
|
||||
LEFT JOIN sys_role role ON role.id = userRole.roleId
|
||||
LEFT JOIN `user` u ON u.id = userRole.userId
|
||||
WHERE
|
||||
role.`code` = 'BranchUnionMemberAdmin' and u.unionid = @unionId
|
||||
role.`code` = 'H04' and u.unionid = @unionId
|
||||
group by u.loginname
|
||||
""").setParam("unionId", Vi.getUnionId());
|
||||
List<NutMap> list = memberCommonService.listMap(sql);
|
||||
@@ -217,6 +220,7 @@ public class ClubRegistApplyController {
|
||||
@At
|
||||
@POST
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("sys.club.clubRegist.clubRegistApply")
|
||||
public Object doEdit(@Param(value = "club", required = false) Sys_club club,
|
||||
@Param(value = "isSave", required = false) Boolean isSave,
|
||||
|
||||
+14
-4
@@ -9,12 +9,15 @@ import io.v.nutz.sys.constant.club.ClubRegistAuditState;
|
||||
import io.v.nutz.sys.controllers.platform.sys.handler.ClubRegisterApplyToDoHandler;
|
||||
import io.v.nutz.sys.models.Sys_club;
|
||||
import io.v.nutz.sys.services.SysClubService;
|
||||
import io.v.nutz.sys.services.SysLocalProcessService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.member.handle.MemberApplyToDoHandler;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
@@ -34,11 +37,12 @@ import java.util.Date;
|
||||
@Ok("json")
|
||||
public class ClubUnitPartAuditController {
|
||||
|
||||
@Inject
|
||||
private SysClubService sysClubService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private SysClubService sysClubService;
|
||||
@Inject
|
||||
private SysLocalProcessService localProcessService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/club/regist/unitPartAudit.html")
|
||||
@@ -70,6 +74,7 @@ public class ClubUnitPartAuditController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("sys.club.clubRegist.unitPartAudit")
|
||||
public Object doReview(Audit audit, String clubId, Integer pass) {
|
||||
audit.setAuditor(ShiroUtil.getPlatformUid());
|
||||
@@ -100,9 +105,14 @@ public class ClubUnitPartAuditController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("sys.club.clubRegist.unitPartAudit")
|
||||
public Object rollback(String id) {
|
||||
dao.update(Sys_club.class, Chain.make("state", ClubRegistAuditState.UNIT_PART_READY), Cnd.where("id", "=", id));
|
||||
Sys_club club = dao.fetch(Sys_club.class, id);
|
||||
dao.clear(Audit.class, Cnd.where("id", "=", club.getUnitPartAuditId()));
|
||||
dao.update(Sys_club.class, Chain.make("state", ClubRegistAuditState.UNIT_PART_READY)
|
||||
.add("unitPartAuditId", null), Cnd.where("id", "=", id));
|
||||
localProcessService.revokeTask("CLUB_APPLY@" + id, "分工会审核");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+17
-5
@@ -9,12 +9,15 @@ import io.v.nutz.sys.constant.club.ClubRegistAuditState;
|
||||
import io.v.nutz.sys.controllers.platform.sys.handler.ClubRegisterApplyToDoHandler;
|
||||
import io.v.nutz.sys.models.Sys_club;
|
||||
import io.v.nutz.sys.services.SysClubService;
|
||||
import io.v.nutz.sys.services.SysLocalProcessService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
@@ -34,11 +37,13 @@ import java.util.Date;
|
||||
@Ok("json")
|
||||
public class ClubXTAuditController {
|
||||
|
||||
@Inject
|
||||
private SysClubService sysClubService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private SysClubService sysClubService;
|
||||
@Inject
|
||||
private SysLocalProcessService localProcessService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/club/regist/xtAudit.html")
|
||||
@@ -67,6 +72,7 @@ public class ClubXTAuditController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("sys.club.clubRegist.xtAudit")
|
||||
public Object doReview(Audit audit, String clubId, Integer pass, @Param("..")Sys_club sys_club) {
|
||||
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
@@ -84,7 +90,7 @@ public class ClubXTAuditController {
|
||||
} else if (pass == 2) {
|
||||
club.setState(ClubRegistAuditState.XT_BACK_MODIFY);
|
||||
//退回修改
|
||||
ClubRegisterApplyToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(club, NutMap.NEW().addv("nodeName","校办公室主管退回修改"));
|
||||
ClubRegisterApplyToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(club, NutMap.NEW().addv("nodeName","校工会办公室主管退回修改"));
|
||||
} else {
|
||||
club.setState(ClubRegistAuditState.XGH_READY);
|
||||
//校工会审核
|
||||
@@ -98,9 +104,15 @@ public class ClubXTAuditController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("sys.club.clubRegist.xtAudit")
|
||||
public Object rollback(String id) {
|
||||
dao.update(Sys_club.class, Chain.make("state", ClubRegistAuditState.XT_READY).add("schoolReplyFile", null), Cnd.where("id", "=", id));
|
||||
Sys_club club = dao.fetch(Sys_club.class, id);
|
||||
dao.clear(Audit.class, Cnd.where("id", "=", club.getXtAuditId()));
|
||||
dao.update(Sys_club.class, Chain.make("state", ClubRegistAuditState.XT_READY)
|
||||
.add("schoolReplyFile", null).add("xtAuditId", null)
|
||||
, Cnd.where("id", "=", id));
|
||||
localProcessService.revokeTask("CLUB_APPLY@" + id, "校工会办公室主管审核");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+17
-10
@@ -12,14 +12,17 @@ import io.v.nutz.sys.constant.club.ClubRegistAuditState;
|
||||
import io.v.nutz.sys.controllers.platform.sys.handler.ClubRegisterApplyToDoHandler;
|
||||
import io.v.nutz.sys.models.*;
|
||||
import io.v.nutz.sys.services.SysClubService;
|
||||
import io.v.nutz.sys.services.SysLocalProcessService;
|
||||
import io.v.nutz.sys.services.SysRoleService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
@@ -52,6 +55,8 @@ public class ClubXghReplyController {
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
@Inject
|
||||
private SysLocalProcessService localProcessService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/club/regist/xghReply.html")
|
||||
@@ -80,6 +85,7 @@ public class ClubXghReplyController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("sys.club.clubRegist.xghReply")
|
||||
public Object doReview(Audit audit, String clubId, Integer pass, @Param("..")Sys_club sys_club) {
|
||||
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
@@ -89,7 +95,7 @@ public class ClubXghReplyController {
|
||||
audit = dao.insert(audit);
|
||||
Sys_club club = dao.fetch(Sys_club.class, clubId);
|
||||
|
||||
ClubRegisterApplyToDoHandler.COMPLETE_PROCESS.exec(club, NutMap.NEW().addv("nodeName", "校工会完成审核"));
|
||||
ClubRegisterApplyToDoHandler.COMPLETE_PROCESS.exec(club, NutMap.NEW().addv("nodeName", "校工会批复完成"));
|
||||
if (pass == 1) {
|
||||
club.setState(ClubRegistAuditState.XGH_REJECTED);
|
||||
dao.clear(Sys_user_role.class, Cnd.where("stid", "=", clubId)
|
||||
@@ -104,6 +110,7 @@ public class ClubXghReplyController {
|
||||
} else {
|
||||
club.setState(ClubRegistAuditState.SCHOOL_PASS);
|
||||
//审核通过
|
||||
ClubRegisterApplyToDoHandler.COMPLETE_SCHOOL_TASK.exec(club, null);
|
||||
ClubRegisterApplyToDoHandler.COMPLETE_PROCESS.exec(club, null);
|
||||
//审核通过加角色
|
||||
List<Sys_user_role> userRoles = new ArrayList<>();
|
||||
@@ -126,8 +133,7 @@ public class ClubXghReplyController {
|
||||
if(sysClubUser != null) {
|
||||
Sys_user sysUser = dao.fetch(Sys_user.class, sysClubUser.getUserid());
|
||||
String content = "%s老师您好,您申请注册的%s已经审核通过。".formatted(sysUser.getUsername(), club.getName());
|
||||
String link = "";
|
||||
msgApi.sendMsg(List.of("DingTalk"), sysUser.getLoginname(), 2, "协会注册", content, "", link);
|
||||
msgApi.sendMsg(List.of("DingTalk"), sysUser.getLoginname(), 1, "协会注册", content, "", "");
|
||||
}
|
||||
}
|
||||
club.setXghAuditId(audit.getId());
|
||||
@@ -137,20 +143,21 @@ public class ClubXghReplyController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("sys.club.clubRegist.xghReply")
|
||||
public Object rollback(String id) {
|
||||
Sys_club club = dao.fetch(Sys_club.class, id);
|
||||
dao.clear(Audit.class, Cnd.where("id", "=", club.getXghAuditId()));
|
||||
dao.update(Sys_club.class, Chain.make("state", ClubRegistAuditState.XGH_READY)
|
||||
.add("foundTime", null)
|
||||
.add("foundTime", null).add("xghAuditId", null)
|
||||
, Cnd.where("id", "=", id));
|
||||
//删除对应角色
|
||||
List<Sys_club_user> sysClubUsers = dao.query(Sys_club_user.class,
|
||||
Cnd.where("clubid", "=", id).and("sf", "!=", 2));
|
||||
sysClubUsers.forEach(item -> {
|
||||
dao.clear(Sys_user_role.class, Cnd.where("stid", "=", id)
|
||||
.and("roleid", "=", getRoleId(item.getSf())));
|
||||
});
|
||||
dao.clear(Sys_user_role.class, Cnd.where("stid", "=", id)
|
||||
.and("roleid", "in", List.of(Roles.club01, Roles.club02, Roles.club03, Roles.club04)));
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
|
||||
localProcessService.revokeTask("CLUB_APPLY@" + id, "校工会批复");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+46
-46
@@ -142,8 +142,23 @@ public enum ClubRegisterApplyToDoHandler {
|
||||
@Override
|
||||
public void exec(Sys_club club, NutMap extra) {
|
||||
// 获取校工会办公室主任xcywt
|
||||
Sys_role sysRole = sysRoleService.getByCode("xcywt");
|
||||
List<String> assignments = sysUserRoleService.queryRoleUserLogin(sysRole.getId());
|
||||
// Sys_role sysRole = sysRoleService.getByCode("xcywt");
|
||||
// List<String> assignments = sysUserRoleService.queryRoleUserLogin(sysRole.getId());
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname
|
||||
FROM
|
||||
sys_user_role userRole
|
||||
LEFT JOIN sys_role role ON userRole.roleId = role.id
|
||||
LEFT JOIN sys_user u ON u.id = userRole.userId
|
||||
where role.`code` = 'xcywt'
|
||||
GROUP BY
|
||||
u.id
|
||||
""");
|
||||
sql.setCallback(Sqls.callback.strList());
|
||||
dao.execute(sql);
|
||||
List<String> assignments = sql.getList(String.class);
|
||||
|
||||
localProcessService.createTask(
|
||||
"CLUB_APPLY@" + club.getId(),
|
||||
"CLUB_APPLY_TX_SCHOOL_AUDIT",
|
||||
@@ -183,9 +198,25 @@ public enum ClubRegisterApplyToDoHandler {
|
||||
CREATE_SCHOOL_TASK() {
|
||||
@Override
|
||||
public void exec(Sys_club club, NutMap extra) {
|
||||
// 获取校工会会员管理员
|
||||
Sys_role sysRole = sysRoleService.getByCode("xxhgly");
|
||||
List<String> assignments = sysUserRoleService.queryRoleUserLogin(sysRole.getId());
|
||||
// 获取校协会管理员
|
||||
// Sys_role sysRole = sysRoleService.getByCode("xxhgly");
|
||||
// List<String> assignments = sysUserRoleService.queryRoleUserLogin(sysRole.getId());
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname
|
||||
FROM
|
||||
sys_user_role userRole
|
||||
LEFT JOIN sys_role role ON userRole.roleId = role.id
|
||||
LEFT JOIN sys_user u ON u.id = userRole.userId
|
||||
where role.`code` = 'xxhgly'
|
||||
GROUP BY
|
||||
u.id
|
||||
""");
|
||||
sql.setCallback(Sqls.callback.strList());
|
||||
dao.execute(sql);
|
||||
List<String> assignments = sql.getList(String.class);
|
||||
|
||||
localProcessService.createTask(
|
||||
"CLUB_APPLY@" + club.getId(),
|
||||
"CLUB_APPLY_SCHOOL_AUDIT",
|
||||
@@ -219,47 +250,6 @@ public enum ClubRegisterApplyToDoHandler {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建协会确认任务
|
||||
*/
|
||||
CREATE_CLUB_CONFIRM_TASK() {
|
||||
@Override
|
||||
public void exec(Sys_club club, NutMap extra) {
|
||||
// 获取校工会会员管理员
|
||||
List<String> schoolLeaderLoginNames = memberService.getSchoolOrBranchUnionMemberAdminLoginNames("school", ShiroUtil.getUserId());
|
||||
localProcessService.createTask(
|
||||
"CLUB_APPLY@" + club.getId(),
|
||||
"CLUB_APPLY_CONFIRM_AUDIT",
|
||||
"协会确认",
|
||||
ShiroUtil.getUserId(),
|
||||
schoolLeaderLoginNames,
|
||||
"/platform/sys/club/clubConfirm",
|
||||
"/platform/sys/club/clubConfirm",
|
||||
"/platform/sys/club/clubConfirm",
|
||||
"/platform/sys/club/clubConfirm"
|
||||
);
|
||||
localProcessService.updateProcessNodeName("CLUB_APPLY@" + club.getId(), "协会确认");
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 协会确认完成
|
||||
*/
|
||||
COMPLETE_CLUB_CONFIRM_TASK() {
|
||||
@Override
|
||||
public void exec(Sys_club club, NutMap extra) {
|
||||
String nodeName = extra.getString("nodeName");
|
||||
localProcessService.completeTask(
|
||||
"CLUB_APPLY_CONFIRM_AUDIT",
|
||||
"CLUB_APPLY@" + club.getId(),
|
||||
ShiroUtil.getUserId(),
|
||||
nodeName
|
||||
);
|
||||
localProcessService.updateProcessNodeName("CLUB_APPLY@" + club.getId(), nodeName);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 审核拒绝
|
||||
*/
|
||||
@@ -279,6 +269,16 @@ public enum ClubRegisterApplyToDoHandler {
|
||||
localProcessService.completeProcess("CLUB_APPLY@" + club.getId());
|
||||
localProcessService.updateProcessNodeName("CLUB_APPLY@" + club.getId(), "审核通过");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除流程
|
||||
*/
|
||||
DELETE_PROCESS() {
|
||||
@Override
|
||||
public void exec(Sys_club club, NutMap extra) {
|
||||
localProcessService.deleteProcessInstance("CLUB_APPLY@" + club.getId());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.v.nutz.task.job.sourcechange;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeType;
|
||||
import io.v.nutz.zhgh.staffmanage.sourcechange.model.SourceChangeMiddleTable;
|
||||
@@ -15,6 +16,7 @@ import org.quartz.JobExecutionException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
public class SourceChangeJob implements Job {
|
||||
@@ -25,52 +27,34 @@ public class SourceChangeJob implements Job {
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
// 获取当前日期
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
// 今天的日期,yyyy-MM-dd格式
|
||||
String today = DateUtil.today();
|
||||
// 查询出今天的变更记录
|
||||
List<SourceChangeMiddleTable> list = dao.query(SourceChangeMiddleTable.class,
|
||||
Cnd.where("DATE_FORMAT(changeTime, '%Y-%m-%d')", "=", today));
|
||||
// 抽出所有的变更类型
|
||||
List<String> changeTypeList = list.stream().map(SourceChangeMiddleTable::getChangeTypes).flatMap(List::stream).toList();
|
||||
// 各类型的对应list,例如 NEW -> List<NEW>
|
||||
Map<String, List<String>> collect = changeTypeList.stream().collect(Collectors.groupingBy(item -> item));
|
||||
|
||||
// 定义日期格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
// 获取变更的枚举
|
||||
Map<String, String> map = Arrays.stream(MemberChangeType.values())
|
||||
.collect(Collectors.toMap(MemberChangeType::getType, MemberChangeType::getChangeTypeName));
|
||||
|
||||
// 格式化日期
|
||||
String formattedDate = currentDate.format(formatter);
|
||||
|
||||
List<SourceChangeMiddleTable> list = dao.query(SourceChangeMiddleTable.class, Cnd.NEW().and("changeTime", "like", formattedDate));
|
||||
|
||||
// 统计各类型人数
|
||||
Map<MemberChangeType, Integer> countMap = new HashMap<>();
|
||||
for (MemberChangeType type : MemberChangeType.values()) {
|
||||
countMap.put(type, 0);
|
||||
}
|
||||
for (SourceChangeMiddleTable item : list) {
|
||||
for (MemberChangeType type : MemberChangeType.values()) {
|
||||
if (item.getChangeTypes().contains(type.getType())) {
|
||||
countMap.put(type, countMap.get(type) + 1);
|
||||
}
|
||||
// 更新的变更类型的人数
|
||||
List<NutMap> updateDataList = new ArrayList<>();
|
||||
collect.forEach((key, value) -> {
|
||||
if (map.containsKey(key)) {
|
||||
updateDataList.add(NutMap.NEW().addv("changeType", map.get(key)).addv("count", value.size()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
StringBuffer msg = new StringBuffer();
|
||||
msg.append("日期:"+formattedDate);
|
||||
appendIfPositive(msg, "新入职", countMap.get(MemberChangeType.NEW));
|
||||
appendIfPositive(msg, "在职", countMap.get(MemberChangeType.WORK));
|
||||
appendIfPositive(msg, "离校", countMap.get(MemberChangeType.LEAVE_SCHOOL));
|
||||
appendIfPositive(msg, "退休", countMap.get(MemberChangeType.RETIRE));
|
||||
appendIfPositive(msg, "辞职", countMap.get(MemberChangeType.RESIGN));
|
||||
appendIfPositive(msg, "调出", countMap.get(MemberChangeType.OUT));
|
||||
appendIfPositive(msg, "离职", countMap.get(MemberChangeType.LEAVE_OFFICE));
|
||||
appendIfPositive(msg, "其它", countMap.get(MemberChangeType.OTHER));
|
||||
appendIfPositive(msg, "单位异动", countMap.get(MemberChangeType.UNIT_CHANGE));
|
||||
appendIfPositive(msg, "基本信息异动", countMap.get(MemberChangeType.BASIC_CHANGE));
|
||||
// 收集成发送短信内容
|
||||
String updateDataStr = updateDataList.stream().map(v -> {
|
||||
return v.getString("changeType") + ":" + v.getInt("count") + "人";
|
||||
}).collect(Collectors.joining(","));
|
||||
String content = "智慧工会" + today + "数据更新汇总:" + updateDataStr;
|
||||
|
||||
List<String> channels=new ArrayList<>();
|
||||
channels.add("DingTalk");
|
||||
|
||||
//msgApi.sendMsg(channels, "", 1,"0",msg.toString(),null,null);
|
||||
}
|
||||
|
||||
private void appendIfPositive(StringBuffer msg, String label, Integer count) {
|
||||
if (count > 0) {
|
||||
msg.append("," + label + ":" + count + "人");
|
||||
}
|
||||
msgApi.sendMsg(List.of("DingTalk"), "2004000022", 1, "数据更新汇总", content, "", "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,8 +135,6 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
|
||||
List<Sys_user> needDoUpdateList = new CopyOnWriteArrayList<>();
|
||||
// 新增的用户
|
||||
List<Sys_user> needInitUserList = new CopyOnWriteArrayList<>();
|
||||
// 添加角色的用户
|
||||
List<Sys_user_role> userRoles = new CopyOnWriteArrayList<>();
|
||||
|
||||
// 人员更新配置的对象
|
||||
SourceChangeConfig changeConfig = dao().fetch(SourceChangeConfig.class, Cnd.NEW());
|
||||
@@ -149,15 +147,9 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
|
||||
List<SourceChangeMiddleTable> middleTables = new CopyOnWriteArrayList<>();
|
||||
|
||||
// 获取人员变更字段,用于存储记录
|
||||
List<Sys_dict> dictList = sysDictService.getSubListByCode("ALLOW_CHANGE_FIELDS");
|
||||
Set<String> allowChangeFieldNames = dictList.stream().map(Sys_dict::getCode).collect(Collectors.toSet());
|
||||
allowChangeFieldNames.add("member");
|
||||
allowChangeFieldNames.add("welfareMember");
|
||||
allowChangeFieldNames.add("unitid");
|
||||
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
|
||||
dictMap.put("member", "会员状态");
|
||||
dictMap.put("welfareMember", "福利会员状态");
|
||||
dictMap.put("unitid", "单位");
|
||||
NutMap map = memberCommonService.getDictAllowChangeFields();
|
||||
Set<String> allowChangeFieldNames = map.getAs("allowChangeFieldNames", Set.class);
|
||||
Map<String, String> dictMap = map.getAs("dictMap", Map.class);
|
||||
|
||||
// 添加会员角色
|
||||
List<String> addMemberUserIds = new CopyOnWriteArrayList<>();
|
||||
@@ -252,9 +244,13 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
|
||||
//如果有新用户,增加到用户表同时增加角色
|
||||
if (Lang.isNotEmpty(needInitUserList)) {
|
||||
sysUserService.fastInsert(needInitUserList);
|
||||
List<String> userIdList = userRoles.stream().map(Sys_user_role::getUserId).collect(Collectors.toList());
|
||||
sysUserRoleService.dao().clear(Sys_user_role.class, Cnd.where("userId", "in", userIdList));
|
||||
sysUserRoleService.insert(userRoles);
|
||||
List<Sys_user_role> roleList = needInitUserList.stream().map(item -> {
|
||||
Sys_user_role userRole = new Sys_user_role();
|
||||
userRole.setRoleId(Roles.PUBLIC);
|
||||
userRole.setUserId(item.getId());
|
||||
return userRole;
|
||||
}).toList();
|
||||
manyAddOrRenewUtil.asyncExecuteFastInsert(roleList, 200);
|
||||
}
|
||||
|
||||
// 添加会员
|
||||
|
||||
+30
-7
@@ -7,11 +7,14 @@ import cn.wizzer.framework.base.Result;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_union;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.sys.services.SysLocalProcessService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.member.handle.MemberApplyToDoHandler;
|
||||
@@ -35,6 +38,8 @@ import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
@@ -50,6 +55,10 @@ public class MemberApplyBranchUnionAuditController {
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private MemberCommonService memberCommonService;
|
||||
@Inject
|
||||
private SysLocalProcessService localProcessService;
|
||||
@@ -124,13 +133,15 @@ public class MemberApplyBranchUnionAuditController {
|
||||
record.setBranchUnionAuditId(audit.getId());
|
||||
dao.updateIgnoreNull(record);
|
||||
|
||||
MemberApplyToDoHandler.COMPLETE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会审核完成"));
|
||||
// 获取分配工会信息
|
||||
Sys_union union = dao.fetch(Sys_union.class, Cnd.where("id", "=", record.getAllocationUnionId()));
|
||||
if (audit.getAuditType() == 2) {
|
||||
MemberApplyToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(record, null);
|
||||
} else if (audit.getAuditType() == 1) {
|
||||
MemberApplyToDoHandler.COMPLETE_PROCESS.exec(record, null);
|
||||
// 判断是否改变了工会关系
|
||||
|
||||
User user = dao.fetch(User.class, Cnd.where("id", "=", record.getUserId()));
|
||||
|
||||
if (!ObjectUtil.equals(user.getUnionid(), record.getAllocationUnionId())) {
|
||||
if (dao.count(SpecialStaff.class, Cnd.where("userId", "=", record.getUserId())) > 0) {
|
||||
dao.clear(SpecialStaff.class, Cnd.where("userId", "=", record.getUserId()));
|
||||
@@ -138,7 +149,6 @@ public class MemberApplyBranchUnionAuditController {
|
||||
}
|
||||
|
||||
if (!ObjectUtil.equals(user.getUnionid(), record.getAllocationUnionId())) {
|
||||
Sys_union union = dao.fetch(Sys_union.class, Cnd.where("id", "=", record.getAllocationUnionId()));
|
||||
SpecialStaff staff = new SpecialStaff();
|
||||
staff.setUserId(record.getUserId());
|
||||
staff.setPersonnelRelationUnitId(user.getUnitid());
|
||||
@@ -155,10 +165,23 @@ public class MemberApplyBranchUnionAuditController {
|
||||
BeanUtil.copyProperties(record, sysUser);
|
||||
sysUser.setId(user.getId());
|
||||
dao.updateIgnoreNull(sysUser);
|
||||
|
||||
MemberApplyToDoHandler.COMPLETE_PROCESS.exec(record, null);
|
||||
String content = "尊敬的%s老师,您已正式成为杭医工会会员,会员关系在%s,欢迎您的加入!"
|
||||
.formatted(user.getUsername(), union.getUnionname());
|
||||
System.out.println(content);
|
||||
sysUserService.deleteCacheAndUpdate(record.getUserId());
|
||||
msgApi.sendMsg(List.of("DingTalk"), record.getLoginname(), 1, "入会结果通知", content, "", "");
|
||||
} else {
|
||||
MemberApplyToDoHandler.REFUSE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会审核拒绝"));
|
||||
// 杭州医学院,分工会拒绝接收,还要去创建校工会的审核任务
|
||||
MemberApplyToDoHandler.REFUSE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会拒绝接收"));
|
||||
MemberApplyToDoHandler.CREATE_SCHOOL_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核"));
|
||||
String content = "工会主管您好,%s分拒绝接收%s老师,拒绝原因:%s,请您及时联系该分工会负责人或将工会关系划入其他工会。点击此消息或登录“智慧工会”可重新分配工会关系"
|
||||
.formatted(union.getUnionname(), record.getUsername(), audit.getAuditOpinion());
|
||||
String linkUrl = Globals.AppDomain + "/platform/member/apply/schoolUnion/audit/h5";
|
||||
System.out.println(content);
|
||||
msgApi.sendMsg(List.of("DingTalk"), record.getLoginname(), 2, "入会结果通知", content, "", linkUrl);
|
||||
}
|
||||
MemberApplyToDoHandler.COMPLETE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会审核完成"));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -170,11 +193,11 @@ public class MemberApplyBranchUnionAuditController {
|
||||
@SLog(type = "memberApply", tag = "会员入会申请", msg = "分工会撤回")
|
||||
public Object doRevoke(String id){
|
||||
MemberApplyRecord record = dao.fetch(MemberApplyRecord.class, id);
|
||||
dao.update(MemberApplyRecord.class, Chain.make("applyStateId", 20)
|
||||
dao.update(MemberApplyRecord.class, Chain.make("applyStateId", 50)
|
||||
.add("branchUnionAuditId", null), Cnd.where("id", "=", id));
|
||||
dao.clear(Audit.class, Cnd.where("id", "=", record.getBranchUnionAuditId()));
|
||||
// 待办撤回
|
||||
localProcessService.revokeTask("MEMBER_APPLY@" + id, "分工会审核");
|
||||
localProcessService.revokeTask("MEMBER_APPLY@" + id, "分工会接收");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+15
-5
@@ -3,7 +3,10 @@ package io.v.nutz.zhgh.staffmanage.member.controller.apply;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeOrigin;
|
||||
@@ -101,6 +104,12 @@ public class MemberApplyController {
|
||||
@RequiresPermissions("member.apply.submit")
|
||||
@SLog(tag = "会员入会申请", msg = "提交申请")
|
||||
public Object doSubmit(MemberApplyRecord record){
|
||||
|
||||
int count = dao.count(Sys_user_role.class, Cnd.where("userId", "=", record.getUserId()).and("roleId", "=", Roles.MEMBER));
|
||||
if (count > 0) {
|
||||
return Result.error("您已经是会员,请勿重复申请");
|
||||
}
|
||||
|
||||
record.setMember(true);
|
||||
record.setUserId(ShiroUtil.getUserId());
|
||||
record.setChangeOrigin(MemberChangeOrigin.PERSONAL.name());
|
||||
@@ -119,11 +128,12 @@ public class MemberApplyController {
|
||||
MemberApplyToDoHandler.CREATE_SCHOOL_TASK.exec(record, null);
|
||||
|
||||
// 短信通知
|
||||
// List<String> schoolLoginNameList = commonService.getSchoolOrBranchUnionMemberAdminLoginNames("school", null);
|
||||
// String schoolLoginNameListStr = schoolLoginNameList.stream().distinct().collect(Collectors.joining(","));
|
||||
//
|
||||
// String content = "%s老师正申请加入工会,请您点击此条消息或前往智慧工会进行审核";
|
||||
// msgApi.sendMsg(List.of("DingTalk"), schoolLoginNameListStr, 2, "协会入会邀请", content, "", "");
|
||||
List<String> schoolLoginNameList = commonService.getSchoolOrBranchUnionMemberAdminLoginNames("school", null);
|
||||
String schoolLoginNameListStr = schoolLoginNameList.stream().distinct().collect(Collectors.joining(","));
|
||||
|
||||
String content = "%s老师正申请加入工会,请您点击此条消息或登录“智慧工会”进行审核".formatted(record.getUsername());
|
||||
String linkUrl = Globals.AppDomain + "/platform/member/apply/schoolUnion/audit/h5";
|
||||
msgApi.sendMsg(List.of("DingTalk"), schoolLoginNameListStr, 2, "入会审核通知", content, "", linkUrl);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+47
-27
@@ -5,7 +5,9 @@ import cn.wizzer.framework.base.Result;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.sys.services.SysLocalProcessService;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.member.handle.MemberApplyToDoHandler;
|
||||
@@ -22,6 +24,7 @@ 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.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
@@ -47,20 +50,24 @@ public class MemberApplySchoolUnionAuditController {
|
||||
private MemberCommonService memberCommonService;
|
||||
@Inject
|
||||
private SysLocalProcessService localProcessService;
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/member/apply/schoolUnionAudit/index.html")
|
||||
@RequiresPermissions("member.apply.schoolUnion.audit")
|
||||
public void index() {}
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/h5")
|
||||
@Ok("beetl:/mobile/member/apply/schoolUnionAudit/index.html")
|
||||
@RequiresPermissions("member.apply.schoolUnion.audit")
|
||||
public void h5() {}
|
||||
public void h5() {
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("member.apply.schoolUnion.audit")
|
||||
public Object pageData(MemberApplyPageForm pageForm){
|
||||
public Object pageData(MemberApplyPageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
record.*,
|
||||
@@ -76,8 +83,9 @@ public class MemberApplySchoolUnionAuditController {
|
||||
pageForm.buildSearch(cnd, "record.");
|
||||
if (pageForm.getAudit()) {
|
||||
cnd.and("record.applyStateId", ">", 20);
|
||||
cnd.and("record.applyStateId", "!=", 70);
|
||||
} else {
|
||||
cnd.and("record.applyStateId", "=", 20);
|
||||
cnd.and("record.applyStateId", "in", List.of(20, 70));
|
||||
}
|
||||
cnd.desc("record.applyDateTime");
|
||||
sql.setCondition(cnd);
|
||||
@@ -91,7 +99,7 @@ public class MemberApplySchoolUnionAuditController {
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.apply.schoolUnion.audit")
|
||||
@SLog(type = "memberApply", tag = "会员入会申请", msg = "校工会审核")
|
||||
public Object approval(@Param("audit") Audit audit, String id, String unionId){
|
||||
public Object approval(@Param("audit") Audit audit, String id, String unionId) {
|
||||
audit.setAuditor(ShiroUtil.getUserId());
|
||||
audit.setLoginname(ShiroUtil.getPlatformLoginname());
|
||||
audit.setUsername(ShiroUtil.getPlatformUsername());
|
||||
@@ -114,39 +122,50 @@ public class MemberApplySchoolUnionAuditController {
|
||||
record.setSchoolUnionAuditId(audit.getId());
|
||||
dao.updateIgnoreNull(record);
|
||||
|
||||
MemberApplyToDoHandler.COMPLETE_SCHOOL_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核完成"));
|
||||
if (audit.getAuditType() == 2) {
|
||||
MemberApplyToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(record, null);
|
||||
// 短信通知
|
||||
// String content = "%s老师您好,您的入会申请被校工会退回,您可根据退回原因修改后再次提交,如有疑问请及时联系校工会".formatted(record.getUsername());
|
||||
} else if (audit.getAuditType() == 1) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username
|
||||
FROM
|
||||
`sys_user_role` userRole
|
||||
LEFT JOIN sys_role role ON role.id = userRole.roleId
|
||||
LEFT JOIN `user` u ON u.id = userRole.userId
|
||||
WHERE
|
||||
role.`code` = 'BranchUnionMemberAdmin' and u.unionid = @unionId
|
||||
group by u.loginname
|
||||
""").setParam("unionId", unionId);
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.unionname
|
||||
FROM
|
||||
`sys_user_role` userRole
|
||||
LEFT JOIN sys_role role ON role.id = userRole.roleId
|
||||
LEFT JOIN `user` u ON u.id = userRole.userId
|
||||
WHERE
|
||||
role.`code` = 'BranchUnionMemberAdmin' and u.unionid = @unionId
|
||||
group by u.loginname
|
||||
""").setParam("unionId", unionId);
|
||||
List<NutMap> list = memberCommonService.listMap(sql);
|
||||
|
||||
List<String> unionLeaderLoginNames = list.stream().map(v -> v.getString("loginname")).toList();
|
||||
MemberApplyToDoHandler.CREATE_UNION_TASK.exec(record, NutMap.NEW().addv("unionLeaderLoginNames", unionLeaderLoginNames));
|
||||
if (Lang.isNotEmpty(list)) {
|
||||
List<String> unionLeaderLoginNames = list.stream().map(v -> v.getString("loginname")).toList();
|
||||
MemberApplyToDoHandler.CREATE_UNION_TASK.exec(record, NutMap.NEW().addv("unionLeaderLoginNames", unionLeaderLoginNames));
|
||||
|
||||
// 短信通知
|
||||
// for (NutMap map : list) {
|
||||
// String content = "%s老师您好,%s老师的入会申请校工会已通过,现将工会关系划入本工会,请您点击此消息或前往智慧工会进行接收"
|
||||
// .formatted(map.getString("username"), record.getUsername());
|
||||
// }
|
||||
// 获取审核人的工会
|
||||
NutMap nutMap = list.stream().findFirst().orElse(NutMap.NEW());
|
||||
String unionname = nutMap.getString("unionname");
|
||||
// 短信通知
|
||||
String linkUrl = Globals.AppDomain + "/platform/member/apply/branchUnion/audit/h5";
|
||||
for (NutMap map : list) {
|
||||
String content = "%s,%s老师的入会申请已经通过校工会审核,现将工会关系转入您处,请点击此消息或登录“智慧工会”办理新会员接收手续。"
|
||||
.formatted(unionname, record.getUsername());
|
||||
System.out.println(content);
|
||||
msgApi.sendMsg(List.of("DingTalk"), map.getString("loginname"), 2, "会员入会审核通知", content, "", linkUrl);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MemberApplyToDoHandler.REFUSE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核拒绝"));
|
||||
// 短信通知
|
||||
// String content = "%s老师您好,您的入会申请被校工会拒绝,如有疑问请及时联系校工会".formatted(record.getUsername());
|
||||
String content = "尊敬的%s老师,您的入会申请未被通过,若有疑问请联系校工会,联系电话87692636".formatted(record.getUsername());
|
||||
System.out.println(content);
|
||||
msgApi.sendMsg(List.of("DingTalk"), record.getLoginname(), 1, "会员入会结果通知", content, "", "");
|
||||
}
|
||||
MemberApplyToDoHandler.COMPLETE_SCHOOL_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核完成"));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -156,10 +175,11 @@ public class MemberApplySchoolUnionAuditController {
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.apply.schoolUnion.audit")
|
||||
@SLog(type = "memberApply", tag = "会员入会申请", msg = "校工会撤回")
|
||||
public Object doRevoke(String id){
|
||||
public Object doRevoke(String id) {
|
||||
MemberApplyRecord record = dao.fetch(MemberApplyRecord.class, id);
|
||||
dao.update(MemberApplyRecord.class, Chain.make("applyStateId", 20)
|
||||
.add("schoolUnionAuditId", null), Cnd.where("id", "=", id));
|
||||
.add("schoolUnionAuditId", null).add("allocationUnionId", null)
|
||||
, Cnd.where("id", "=", id));
|
||||
dao.clear(Audit.class, Cnd.where("id", "=", record.getSchoolUnionAuditId()));
|
||||
// 待办撤回
|
||||
localProcessService.revokeTask("MEMBER_APPLY@" + id, "校工会审核");
|
||||
|
||||
+15
-14
@@ -37,6 +37,7 @@ import io.v.nutz.zhgh.staffmanage.member.template.MemberTemp;
|
||||
import io.v.nutz.zhgh.staffmanage.member.utils.MemberUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
@@ -74,7 +75,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/change/manage/index.html")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@@ -98,7 +99,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
|
||||
public Object pageData(@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@@ -277,7 +278,7 @@ public class MemberChangeManageController {
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
|
||||
@SLog(tag = "会员高级管理-会员变更", msg = "分工会/校工会会员管理员提交变更")
|
||||
public Object doSubmitChange(MemberChangeRecord record) {
|
||||
// 检验是否有变更
|
||||
@@ -341,7 +342,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
|
||||
public Object sendSms(String userid) {
|
||||
Sys_user user = userService.fetch(userid);
|
||||
/*if (Strings.isNotBlank(user.getMobile())) {
|
||||
@@ -357,7 +358,7 @@ public class MemberChangeManageController {
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
|
||||
public Object allIsWelfareMember(PageForm pageForm,
|
||||
@Param(value = "startDate", required = false) String startDate,
|
||||
@Param(value = "endDate", required = false) String endDate,
|
||||
@@ -429,7 +430,7 @@ public class MemberChangeManageController {
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
|
||||
public Object userUnitMove(String threeUnitId, String unitId, @Param("userId[]") String[] userId) {
|
||||
|
||||
Sys_unit unit = memberService.dao().fetch(Sys_unit.class, unitId);
|
||||
@@ -466,7 +467,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
|
||||
public Object userPageData(PageForm pageForm,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@@ -505,7 +506,7 @@ public class MemberChangeManageController {
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
|
||||
public Object joinWelfareMember(String[] userIds, String taskId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unitId", required = false) String unitId) {
|
||||
@@ -548,7 +549,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
|
||||
public Object units() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("unitlevel", "=", 2);
|
||||
@@ -560,7 +561,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
|
||||
public Object batchUpdatePersonType(@Param("users") String data) {
|
||||
List<Sys_user> users = Json.fromJsonAsList(Sys_user.class, data);
|
||||
for (Sys_user user : users) {
|
||||
@@ -571,7 +572,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
|
||||
public Object batchUpdateUserState(@Param("users") String data) {
|
||||
List<Sys_user> users = Json.fromJsonAsList(Sys_user.class, data);
|
||||
for (Sys_user user : users) {
|
||||
@@ -583,7 +584,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
|
||||
public void downloadImport(HttpServletResponse response) {
|
||||
try {
|
||||
ViTool.excelResponse(response, "会员导入模版.xlsx");
|
||||
@@ -613,7 +614,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@SLog(type = "会员管理系统", tag = "信息维护-会员高级管理", msg = "导入会员", param = true, result = true)
|
||||
public Object doImport(TempFile file) {
|
||||
@@ -727,7 +728,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
|
||||
public Object getAllChangeMemberInfo(String userId){
|
||||
List<NutMap> mapList = memberService.getAllChangeInfo(userId);
|
||||
if (Lang.isEmpty(mapList)) {
|
||||
|
||||
@@ -196,6 +196,17 @@ public enum MemberApplyToDoHandler {
|
||||
localProcessService.completeProcess("MEMBER_APPLY@" + record.getId());
|
||||
localProcessService.updateProcessNodeName("MEMBER_APPLY@" + record.getId(), "审核通过");
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 删除流程
|
||||
*/
|
||||
DELETE_PROCESS() {
|
||||
@Override
|
||||
public void exec(MemberApplyRecord record, NutMap extra) {
|
||||
localProcessService.deleteProcessInstance("MEMBER_APPLY@" + record.getId());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -217,4 +217,14 @@ public class MemberApplyRecord {
|
||||
@Comment("分配的工会关系")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String allocationUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("是否自愿加入工会")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isVoluntary;
|
||||
|
||||
@Column
|
||||
@Comment("签字")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String sign;
|
||||
}
|
||||
|
||||
+7
-2
@@ -162,11 +162,9 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
|
||||
Set<String> allowChangeFieldNames = dictList.stream().map(Sys_dict::getCode).collect(Collectors.toSet());
|
||||
allowChangeFieldNames.add("member");
|
||||
allowChangeFieldNames.add("welfareMember");
|
||||
allowChangeFieldNames.add("unitid");
|
||||
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
|
||||
dictMap.put("member", "会员状态");
|
||||
dictMap.put("welfareMember", "福利会员状态");
|
||||
dictMap.put("unitid", "单位");
|
||||
return NutMap.NEW().addv("allowChangeFieldNames", allowChangeFieldNames).addv("dictMap", dictMap);
|
||||
}
|
||||
|
||||
@@ -357,6 +355,8 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
|
||||
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
|
||||
sysUserService.deleteCacheAndUpdate(info.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,6 +414,11 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
|
||||
Object currentValue = this.booleanVerification(newMap.get(fieldName));
|
||||
Object previousValue = this.booleanVerification(sourceMap.get(fieldName));
|
||||
|
||||
if ("unitId".equals(fieldName)) {
|
||||
currentValue = (newMap.get(fieldName) == null ? this.booleanVerification(newMap.get("unitid")) : currentValue);
|
||||
previousValue = (sourceMap.get(fieldName) == null ? this.booleanVerification(sourceMap.get("unitid")) : previousValue);
|
||||
}
|
||||
|
||||
if (!ObjectUtil.equals(currentValue, previousValue)) {
|
||||
String name = fieldsMap.getOrDefault(fieldName, fieldName);
|
||||
if ("unitId".equals(fieldName) || "unitid".equals(fieldName)) {
|
||||
|
||||
+13
-2
@@ -7,6 +7,7 @@ import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeType;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import io.v.nutz.zhgh.staffmanage.sourcechange.model.SourceChangeMiddleTable;
|
||||
import io.v.nutz.zhgh.staffmanage.sourcechange.param.pageform.SourceChangePageForm;
|
||||
@@ -145,8 +146,12 @@ public class SourceChangeManageController {
|
||||
@ViReturn
|
||||
@RequiresPermissions("sourcechange.manage")
|
||||
@SLog(tag = "人员变更管理", msg = "手动提交变更")
|
||||
public Object doSubmit(SourceChangeMiddleTable middleTable) {
|
||||
public Object doSubmit(@Param("data") SourceChangeMiddleTable middleTable, @Param("isSendMsg") boolean isSendMsg) {
|
||||
sourceChangeManageService.doSourceChange(middleTable);
|
||||
// 如果是新入职,需要发送邮件
|
||||
if (isSendMsg && "新入职".equals(middleTable.getChangeInfosStr())) {
|
||||
sourceChangeManageService.sendMsgToNewTeacher(middleTable);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -155,13 +160,19 @@ public class SourceChangeManageController {
|
||||
@ViReturn
|
||||
@RequiresPermissions("sourcechange.manage")
|
||||
@SLog(tag = "人员变更管理", msg = "批量确认变更")
|
||||
public Object doBatchChange(@Param("data") String[] ids) {
|
||||
public Object doBatchChange(@Param("data") String[] ids, @Param("isSendMsg") boolean isSendMsg) {
|
||||
if (Lang.isEmpty(ids)) {
|
||||
return Result.error("未获取到选择数据");
|
||||
}
|
||||
List<SourceChangeMiddleTable> list = dao.query(SourceChangeMiddleTable.class, Cnd.where("id", "in", ids));
|
||||
for (SourceChangeMiddleTable middleTable : list) {
|
||||
sourceChangeManageService.doSourceChange(middleTable);
|
||||
|
||||
// 如果是新入职,需要发送邮件
|
||||
if (isSendMsg && "新入职".equals(middleTable.getChangeInfosStr())) {
|
||||
sourceChangeManageService.sendMsgToNewTeacher(middleTable);
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,5 +24,5 @@ public interface SourceChangeManageService extends BaseService<SourceChangeMiddl
|
||||
/**
|
||||
* 发送消息给新入职的老师,提醒可以入会
|
||||
*/
|
||||
void sendMsgToNewTeacher(Date date);
|
||||
void sendMsgToNewTeacher(SourceChangeMiddleTable middleTable);
|
||||
}
|
||||
|
||||
+32
-40
@@ -69,11 +69,10 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
|
||||
public void doSourceChange(SourceChangeMiddleTable middleTable) {
|
||||
// 记录当前操作的时间,用于后续区分短信通知
|
||||
Date date = DateUtil.date();
|
||||
// 是否新入职
|
||||
boolean isNewTeacher = "新入职".equals(middleTable.getChangeInfosStr());
|
||||
|
||||
int count = dao().count(Sys_user.class, Cnd.where("loginname", "=", middleTable.getLoginname()));
|
||||
|
||||
Sys_user info = new Sys_user();
|
||||
User user = new User();
|
||||
User user = dao().fetch(User.class, Cnd.where("loginname", "=", middleTable.getLoginname()));
|
||||
//获取可变更字段
|
||||
NutMap map = commonService.getDictAllowChangeFields();
|
||||
Set<String> allowChangeFieldNames = map.getAs("allowChangeFieldNames", Set.class);
|
||||
@@ -90,34 +89,30 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
|
||||
}
|
||||
|
||||
List<String> changeTypes = new ArrayList<>();
|
||||
if (count <= 0) {
|
||||
|
||||
if (isNewTeacher) {
|
||||
changeTypes.add(MemberChangeType.NEW.getType());
|
||||
Sys_user sysUser = BeanUtil.copyProperties(middleTable, Sys_user.class);
|
||||
dao().insert(sysUser);
|
||||
|
||||
user = dao().fetch(User.class, Cnd.where("loginname", "=", middleTable.getLoginname()));
|
||||
} else {
|
||||
user = dao().fetch(User.class, Cnd.where("loginname", "=", middleTable.getLoginname()));
|
||||
|
||||
}
|
||||
if (Lang.isNotEmpty(changeList)) {
|
||||
changeTypes.add(MemberChangeType.BASIC_CHANGE.getType());
|
||||
}
|
||||
|
||||
if (!ObjectUtil.equals(user.getUserState(), middleTable.getUserState())) {
|
||||
List<MemberChangeType> list = Arrays.stream(MemberChangeType.values())
|
||||
.filter(v -> v.getChangeTypeName().equals(middleTable.getUserState())).toList();
|
||||
if (Lang.isNotEmpty(list)) {
|
||||
changeTypes.add(list.get(0).getType());
|
||||
}
|
||||
if (!ObjectUtil.equals(user.getUserState(), middleTable.getUserState())) {
|
||||
List<MemberChangeType> list = Arrays.stream(MemberChangeType.values())
|
||||
.filter(v -> v.getChangeTypeName().equals(middleTable.getUserState())).toList();
|
||||
if (Lang.isNotEmpty(list)) {
|
||||
changeTypes.add(list.get(0).getType());
|
||||
}
|
||||
if (!ObjectUtil.equals(user.getMember(), middleTable.getMember())){
|
||||
if (middleTable.getMember() == 1) {
|
||||
changeTypes.add(MemberChangeType.RESTORE.getType());
|
||||
} else {
|
||||
changeTypes.add(MemberChangeType.WITHDRAWAL.getType());
|
||||
}
|
||||
}
|
||||
if (!ObjectUtil.equals(user.getMember(), middleTable.getMember())){
|
||||
if (middleTable.getMember() == 1) {
|
||||
changeTypes.add(MemberChangeType.RESTORE.getType());
|
||||
} else {
|
||||
changeTypes.add(MemberChangeType.WITHDRAWAL.getType());
|
||||
}
|
||||
}
|
||||
|
||||
info = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", middleTable.getLoginname()));
|
||||
Sys_user info = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", middleTable.getLoginname()));
|
||||
String userId = info.getId();
|
||||
UserHistory history = new UserHistory();
|
||||
if (Lang.isNotEmpty(changeList)) {
|
||||
@@ -128,7 +123,6 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
|
||||
history.setChangeTime(date);
|
||||
history.setChangeOrigin(MemberChangeOrigin.HAND_MOVEMENT.name());
|
||||
|
||||
|
||||
// 加入会员
|
||||
if (middleTable.getMember() != null && middleTable.getMember() == 1) {
|
||||
int activityCount = dao().count(ActivityUserScope.class, Cnd.where("userId", "=", userId).and("groupId", "=", 1));
|
||||
@@ -222,14 +216,18 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
|
||||
dao().updateIgnoreNull(info);
|
||||
|
||||
history.setChangeInfos(changeList);
|
||||
if (count <= 0) {
|
||||
history.setChangeInfosStr("新入职");
|
||||
} else {
|
||||
if (Lang.isNotEmpty(changeList)) {
|
||||
String changeInfos = changeList.stream().map(v -> {
|
||||
return v.getString("fieldName") + ":" + HtmlUtil.cleanHtmlTag(v.getString("sourceValue")) + "->" + HtmlUtil.cleanHtmlTag(v.getString("newValue"));
|
||||
}).collect(Collectors.joining(";"));
|
||||
if (isNewTeacher) {
|
||||
changeInfos = changeInfos + ";新入职";
|
||||
}
|
||||
history.setChangeInfosStr(changeInfos);
|
||||
} else if (Lang.isEmpty(changeList) && isNewTeacher){
|
||||
history.setChangeInfosStr("新入职");
|
||||
}
|
||||
|
||||
history.setChangeTypes(changeTypes);
|
||||
dao().insert(history);
|
||||
|
||||
@@ -238,20 +236,14 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
}
|
||||
|
||||
sendMsgToNewTeacher(date);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendMsgToNewTeacher(Date date) {
|
||||
List<UserHistory> historyList = dao().query(UserHistory.class, Cnd.where("changeTypes", "like", "%" + MemberChangeType.NEW.getType() + "%")
|
||||
.and("DATE_FORMAT(changeTime,'%Y-%m-%d %H:%i')", "=", DateUtil.format(date, "yyyy-MM-dd HH:mm")));
|
||||
|
||||
// for (UserHistory history : historyList) {
|
||||
// String context = "%s老师您好,欢迎加入杭医大家庭,诚挚邀请您成为工会会员,如有意愿,请您点击此条消息或前往智慧工会平台申请入会,如无意愿请忽略此消息提醒。".formatted(history.getUsername());
|
||||
// String link = Globals.AppDomain + "/platform/member/apply/submit/h5";
|
||||
// msgApi.sendMsg(List.of("DingTalk"), history.getLoginname(), 2, "入会邀请", context, "", link);
|
||||
// }
|
||||
public void sendMsgToNewTeacher(SourceChangeMiddleTable middleTable) {
|
||||
String context = "尊敬的%s老师,欢迎您加入杭州医学院大家庭,请您点击此条信息或登录“智慧工会”平台申请成为杭医工会会员!"
|
||||
.formatted(middleTable.getUsername());
|
||||
String link = Globals.AppDomain + "/platform/member/apply/submit/h5";
|
||||
msgApi.sendMsg(List.of("DingTalk"), middleTable.getLoginname(), 2, "入会邀请", context, "", link);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user