会员
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 会员状态
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/25
|
||||
* @since 1.0
|
||||
*/
|
||||
@Getter
|
||||
public enum MemberMode {
|
||||
|
||||
NONE(0, "非会员"), NORMAL(1, "正式会员");
|
||||
|
||||
|
||||
private int code;
|
||||
private String description;
|
||||
|
||||
MemberMode(int code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member;
|
||||
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.ViResource;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import org.apache.shiro.crypto.hash.Sha256Hash;
|
||||
import org.apache.shiro.util.ByteSource;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.Ioc;
|
||||
import org.nutz.lang.random.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Todo
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/2/3
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface UserMode {
|
||||
|
||||
Ioc ioc = ViResource.ioc;
|
||||
|
||||
/**
|
||||
* 添加角色
|
||||
*
|
||||
* @param userId
|
||||
* @param roleId
|
||||
*/
|
||||
static void addRole(String userId, String roleId) {
|
||||
SysUserService sysUserService = ioc.getByType(SysUserService.class);
|
||||
sysUserService.insert("sys_user_role", Chain.make("userid", userId).add("roleId", roleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加角色
|
||||
*
|
||||
* @param userIds
|
||||
* @param roleId
|
||||
*/
|
||||
static void addRole(String[] userIds, String roleId) {
|
||||
SysUserService sysUserService = ioc.getByType(SysUserService.class);
|
||||
List<Sys_user_role> sysUserRoles = new ArrayList<>();
|
||||
for (String userId : userIds) {
|
||||
Sys_user_role sysUserRole = new Sys_user_role();
|
||||
sysUserRole.setUserId(userId);
|
||||
sysUserRole.setRoleId(roleId);
|
||||
sysUserRoles.add(sysUserRole);
|
||||
}
|
||||
sysUserService.dao().insert(sysUserRoles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加角色之前先删
|
||||
*
|
||||
* @param userId
|
||||
* @param roleId
|
||||
*/
|
||||
static void addRoleAndFlush(String userId, String roleId) {
|
||||
removeRole(userId, roleId);
|
||||
addRole(userId, roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加角色之前先删
|
||||
*
|
||||
* @param userIds
|
||||
* @param roleId
|
||||
*/
|
||||
static void addRoleAndFlush(String[] userIds, String roleId) {
|
||||
removeRole(userIds, roleId);
|
||||
addRole(userIds, roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除角色
|
||||
*
|
||||
* @param userId
|
||||
* @param roleId
|
||||
*/
|
||||
static void removeRole(String userId, String roleId) {
|
||||
ioc.getByType(SysUserService.class).clear("sys_user_role", Cnd.where("userid", "=", userId).and("roleId", "=", roleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除角色
|
||||
*
|
||||
* @param userIds
|
||||
* @param roleId
|
||||
*/
|
||||
static void removeRole(String[] userIds, String roleId) {
|
||||
ioc.getByType(SysUserService.class).clear("sys_user_role", Cnd.where("userid", "in", userIds).and("roleId", "=", roleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化用户并持久化
|
||||
*
|
||||
* @param user
|
||||
* @param <E>
|
||||
* @return
|
||||
*/
|
||||
static <E extends Sys_user> E initUserPush(E user) {
|
||||
SysUserService sysUserService = ioc.getByType(SysUserService.class);
|
||||
return sysUserService.insert(initUser(user));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化用户
|
||||
*
|
||||
* @param user
|
||||
* @param <E>
|
||||
* @return
|
||||
*/
|
||||
static <E extends Sys_user> E initUser(E user) {
|
||||
String salt = R.UU32();
|
||||
user.setId(R.UU32());
|
||||
user.setSalt(salt);
|
||||
user.setPassword(R.UU16());
|
||||
user.setPassword(new Sha256Hash(user.getPassword(), ByteSource.Util.bytes(salt), 1024).toHex());
|
||||
user.setLoginPjax(true);
|
||||
user.setMenuTheme("left");
|
||||
user.setLoginCount(0);
|
||||
user.setMember(0);
|
||||
user.setWelfareMember(0);
|
||||
user.setRetired(false);
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加普通用户的角色
|
||||
*
|
||||
* @param userid
|
||||
*/
|
||||
static void addPublicRole(String userid) {
|
||||
SysUserService sysUserService = ioc.getByType(SysUserService.class);
|
||||
addRoleAndFlush(userid, Roles.PUBLIC);
|
||||
sysUserService.deleteCache(userid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一个用户
|
||||
*
|
||||
* @param userid
|
||||
*/
|
||||
static void removeUser(String userid) {
|
||||
SysUserService sysUserService = ioc.getByType(SysUserService.class);
|
||||
Dao dao = sysUserService.dao();
|
||||
|
||||
removeMemberRole(userid);
|
||||
sysUserService.delete(userid);
|
||||
dao.clear("member_apply_record", Cnd.where("userid", "=", userid));
|
||||
dao.clear("member_change_record", Cnd.where("userid", "=", userid));
|
||||
|
||||
//...
|
||||
|
||||
sysUserService.deleteCache(userid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加会员角色
|
||||
*
|
||||
* @param userid
|
||||
*/
|
||||
static void addMemberRole(String userid) {
|
||||
SysUserService sysUserService = ioc.getByType(SysUserService.class);
|
||||
|
||||
sysUserService.update(Chain.make("member", MemberMode.NORMAL.getCode()).add("memberJoinTime", new Date()), Cnd.where("id", "=", userid));
|
||||
|
||||
addRoleAndFlush(userid, Roles.MEMBER);
|
||||
|
||||
sysUserService.deleteCache(userid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加会员角色(多个)
|
||||
*
|
||||
* @param userids
|
||||
*/
|
||||
static void addMemberRole(String[] userids) {
|
||||
SysUserService sysUserService = ioc.getByType(SysUserService.class);
|
||||
|
||||
sysUserService.update(Chain.make("member", MemberMode.NORMAL.getCode()).add("memberJoinTime", new Date()), Cnd.where("id", "in", userids));
|
||||
|
||||
addRoleAndFlush(userids, Roles.MEMBER);
|
||||
|
||||
sysUserService.clearCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除会员角色
|
||||
*
|
||||
* @param userid
|
||||
*/
|
||||
static void removeMemberRole(String userid) {
|
||||
SysUserService sysUserService = ioc.getByType(SysUserService.class);
|
||||
|
||||
sysUserService.update(Chain.make("member", MemberMode.NONE.getCode()), Cnd.where("id", "=", userid));
|
||||
removeRole(userid, Roles.MEMBER);
|
||||
|
||||
sysUserService.deleteCache(userid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除会员角色(多个)
|
||||
*
|
||||
* @param userids
|
||||
*/
|
||||
static void removeMemberRole(String[] userids) {
|
||||
SysUserService sysUserService = ioc.getByType(SysUserService.class);
|
||||
|
||||
sysUserService.update(Chain.make("member", MemberMode.NONE.getCode()), Cnd.where("id", "in", userids));
|
||||
removeRole(userids, Roles.MEMBER);
|
||||
|
||||
sysUserService.clearCache();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 福利会员状态
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/25
|
||||
* @since 1.0
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum WelfareMemberMode {
|
||||
|
||||
NONE(0, "非福利会员"), NORMAL(1, "正式福利会员");
|
||||
|
||||
private int code;
|
||||
private String description;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.constant;
|
||||
|
||||
import io.v.nutz.base.annontation.SelectEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 会员变更来源
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/25
|
||||
* @since 1.0
|
||||
*/
|
||||
@Getter
|
||||
@SelectEnum
|
||||
@AllArgsConstructor
|
||||
public enum MemberChangeOrigin {
|
||||
|
||||
PERSONAL("个人申请变更"),
|
||||
BRANCH_UNION("分工会变更"),
|
||||
BRANCH_UNION_VERIFICATION("分工会名单事项核对"),
|
||||
UNION_GROUP("工会小组变更"),
|
||||
SCHOOL_UNION("校工会变更"),
|
||||
SCHOOL_UNION_VERIFICATION("校工会名单事项核对"),
|
||||
SYSTEM("系统数据更新"),
|
||||
HAND_MOVEMENT("手动数据更新"),
|
||||
OTHER("其他方式变更");
|
||||
|
||||
/**
|
||||
* 避免和枚举类的name冲突
|
||||
*/
|
||||
public final String changeOriginName;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.constant;
|
||||
|
||||
import io.v.nutz.base.annontation.SelectEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:MemberChangeType
|
||||
* @Date 2025/1/20 18:57
|
||||
* @注释
|
||||
*/
|
||||
@Getter
|
||||
@SelectEnum
|
||||
@AllArgsConstructor
|
||||
public enum MemberChangeType {
|
||||
|
||||
//变更类型
|
||||
NEW("NEW","新入职"),
|
||||
RESTORE("RESTORE","入会"),
|
||||
WITHDRAWAL("WITHDRAWAL","退会"),
|
||||
WORK("WORK","在职"),
|
||||
LEAVE_SCHOOL("LEAVE_SCHOOL","离校"),
|
||||
RETIRE("RETIRE","退休"),
|
||||
RESIGN("RESIGN","辞职"),
|
||||
OUT("OUT","调出"),
|
||||
LEAVE_OFFICE("LEAVE_OFFICE","离职"),
|
||||
OTHER("OTHER","其他"),
|
||||
UNIT_CHANGE("UNIT_CHANGE","单位异动"),
|
||||
UNION_CHANGE("UNION_CHANGE","工会关系异动"),
|
||||
BASIC_CHANGE("BASIC_CHANGE","基本信息异动");
|
||||
|
||||
private final String type;
|
||||
private final String changeTypeName;
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_menu;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
//import io.v.nutz.zhgh.member.constant.MemberApplyState;
|
||||
//import io.v.nutz.zhgh.member.constant.MemberChangeApplyState;
|
||||
//import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
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.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 会员待办
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/2/21
|
||||
* @since 1.0
|
||||
*/
|
||||
@At("/platform/member/agenda")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
@RequiresAuthentication
|
||||
public class MemberAgendaController {
|
||||
@Inject
|
||||
private MemberCommonService memberService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getAgenda() {
|
||||
final String title = "【会员系统】";
|
||||
|
||||
List<NutMap> list = new ArrayList<>();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,H04,H03")) {
|
||||
return list;
|
||||
}
|
||||
boolean anyRoles = ShiroUtil.hasAnyRoles("sysadmin,A06,H03");
|
||||
|
||||
|
||||
// 入会申请
|
||||
Sql marSql = Sqls.create("""
|
||||
SELECT
|
||||
count( 1 )
|
||||
FROM
|
||||
member_apply_record mar
|
||||
LEFT JOIN `user` u ON mar.userId = u.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
int marUnionNum = 0;
|
||||
// Cnd marUnionCnd = Cnd.where("mar.stateId", "=", MemberApplyState.UNION);
|
||||
if (!anyRoles) {
|
||||
// marUnionCnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
// marSql.setCondition(marUnionCnd);
|
||||
marUnionNum = memberService.count(marSql);
|
||||
list.add(new NutMap().addv("title", title).addv("iconClass", vi.getIconByPath("/platform/member/apply/audit/union")).addv("label", "待院级工会入会审核").addv("number", marUnionNum).addv("url", "/platform/member/apply/audit/union"));
|
||||
|
||||
int marSchoolNum = 0;
|
||||
// Cnd marSchoolCnd = Cnd.where("mar.stateId", "=", MemberApplyState.SCHOOL_UNION);
|
||||
// marSql.setCondition(marSchoolCnd);
|
||||
marSchoolNum = memberService.count(marSql);
|
||||
list.add(new NutMap().addv("title", title).addv("iconClass", vi.getIconByPath("/platform/member/apply/audit/school")).addv("label", "待校工会入会审核").addv("number", marSchoolNum).addv("url", "/platform/member/apply/audit/school"));
|
||||
|
||||
|
||||
// 会员变更
|
||||
Sql mcrSql = Sqls.create("""
|
||||
SELECT
|
||||
count( 1 )\s
|
||||
FROM
|
||||
member_change_record mcr\s
|
||||
LEFT JOIN `user` u ON mcr.userId = u.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
int mcrUnionNum = 0;
|
||||
// Cnd mcrUnionCnd = Cnd.where("mcr.stateId", "=", MemberChangeApplyState.UNION).and("recordMode", "=", MemberChangeRecordMode.MEMBER.getCode());
|
||||
// if (!anyRoles) {
|
||||
// mcrUnionCnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
// }
|
||||
// mcrSql.setCondition(mcrUnionCnd);
|
||||
// mcrUnionNum = memberService.count(mcrSql);
|
||||
// list.add(new NutMap().addv("title", title).addv("iconClass", vi.getIconByPath("/platform/member/apply/audit/union")).addv("label", "待院级工会变更审核").addv("number", mcrUnionNum).addv("url", "/platform/member/change/audit/union"));
|
||||
//
|
||||
// int mcrSchoolNum = 0;
|
||||
// Cnd mcrSchoolCnd = Cnd.where("mcr.stateId", "=", MemberChangeApplyState.SCHOOL_UNION).and("recordMode", "=", MemberChangeRecordMode.MEMBER.getCode());
|
||||
// mcrSql.setCondition(mcrSchoolCnd);
|
||||
// mcrSchoolNum = memberService.count(mcrSql);
|
||||
// list.add(new NutMap().addv("title", title).addv("iconClass", vi.getIconByPath("/platform/member/apply/audit/school")).addv("label", "待校工会变更审核").addv("number", mcrSchoolNum).addv("url", "/platform/member/change/audit/school"));
|
||||
|
||||
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
List<Sys_menu> menus = Optional.ofNullable(user).orElse(new Sys_user()).getMenus();
|
||||
return list.stream().filter(v -> Strings.isNotBlank(v.getString("url")) && menus.stream().anyMatch(x -> Strings.isNotBlank(x.getHref()) && v.getString("url").contains(x.getHref()))).distinct().collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
+351
@@ -0,0 +1,351 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_unit;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.data.model.UserHistory;
|
||||
import io.v.nutz.zhgh.staffmanage.member.UserMode;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberApplyRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
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.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@At("/platform/member/common")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MemberCommonController {
|
||||
|
||||
@Inject
|
||||
private MemberCommonService memberService;
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject("Sys_user")
|
||||
private ViService<Sys_user> sysUserViService;
|
||||
|
||||
@Inject("MemberApplyRecord")
|
||||
private ViService<MemberApplyRecord> recordViService;
|
||||
|
||||
@Inject("MemberChangeRecord")
|
||||
private ViService<MemberChangeRecord> changeRecordViService;
|
||||
|
||||
|
||||
@At
|
||||
@RequiresAuthentication
|
||||
public Object fetchMemberUserById(String userId){
|
||||
if (StrUtil.isBlank(userId)) {
|
||||
return Result.error("未获取到参数,无法查询");
|
||||
}
|
||||
// 根据权限判断是否可以查询用户信息
|
||||
User user = dao.fetch(User.class, Cnd.where("id", "=", userId));
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin, SchoolUnionAdmin, SchoolUnionMemberAdmin")) {
|
||||
if (ShiroUtil.hasAnyRoles("H04, branchUnionMemberAdmin")) {
|
||||
if (!Vi.getUnionId().equals(user.getUnionid())) {
|
||||
return Result.error("您没有权限!");
|
||||
}
|
||||
} else {
|
||||
if (user.getId().equals(ShiroUtil.getUserId())){
|
||||
return Result.error("您没有权限!");
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.success().addData(user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:{locked:'password|salt',ignoreNull:false}")
|
||||
public Object userInfo(String userId, @Param(value = "source", required = false) String source) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,H04,ghxzzz") && !userId.equals(ShiroUtil.getPrincipalProperty("id"))) {
|
||||
return Result.error("您没有权限!");
|
||||
}
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.*,unit.`name` unitname,un.unionname,unit.unionid,
|
||||
su.registeredResidence,
|
||||
su.homeAddress,
|
||||
su.specialSkill
|
||||
FROM
|
||||
$source u
|
||||
LEFT JOIN sys_unit unit ON u.unitid = unit.id
|
||||
left join sys_union un on unit.unionid = un.id
|
||||
left join sys_user su on su.id = u.id
|
||||
WHERE u.id = @id
|
||||
""").setVar("source", StringUtils.isEmpty(source) ? "user" : source).setParam("id", userId);
|
||||
NutMap user = sysUserViService.fetch(sql);
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存用户信息
|
||||
*
|
||||
* @param sys_user
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object saveUser(Sys_user sys_user) {
|
||||
if (Strings.isBlank(sys_user.getId())) {
|
||||
int count = sysUserViService.count(Cnd.where("loginname", "=", sys_user.getLoginname()));
|
||||
if (count > 0) {
|
||||
return Result.error("工号已存在!");
|
||||
}
|
||||
|
||||
UserMode.initUserPush(sys_user);
|
||||
UserMode.addPublicRole(sys_user.getId());
|
||||
} else {
|
||||
sys_user.setPassword(null);
|
||||
sys_user.setSalt(null);
|
||||
sysUserViService.updateIgnoreNull(sys_user);
|
||||
}
|
||||
|
||||
sysUserService.deleteCache(sys_user.getId());
|
||||
|
||||
return userInfo(sys_user.getId(), null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询申请的详细信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findApplyInfo(String id) {
|
||||
MemberApplyRecord record = recordViService.fetch(id);
|
||||
record = recordViService.fetchLinks(record, "unionAudit");
|
||||
record = recordViService.fetchLinks(record, "schoolAudit");
|
||||
record = recordViService.fetchLinks(record, "auditState");
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询变更申请的详细信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findChangeApplyInfo(String id) {
|
||||
MemberChangeRecord record = changeRecordViService.fetchLinks(id);
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询某个会员的变更记录
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object memberChangeRecords(String userId) {
|
||||
return memberService.memberChangeRecords(userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取会员变更状态
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getUserChangType(){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
`sys_dict`
|
||||
WHERE
|
||||
parentId = (
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
sys_dict
|
||||
WHERE
|
||||
`code` = 'MemberChangeType')
|
||||
and `code` not in (@code)
|
||||
ORDER BY FIELD(`code`,1,2,3,4,5,6,7,8,9,10,11,12)
|
||||
""").setParam("code", Lang.list(9));
|
||||
return memberService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据某条历史记录ID查询变更信息
|
||||
* @param hisId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object userChangeInfo(String hisId) {
|
||||
NutMap resultMap = NutMap.NEW();
|
||||
|
||||
List<NutMap> compareData = new ArrayList<>();
|
||||
|
||||
UserHistory userHistory = dao.fetch(UserHistory.class, hisId);
|
||||
Map<String, String> unitMap = dao.query(Sys_unit.class, null).stream().collect(Collectors.toMap(v -> v.getId(), v -> v.getName()));
|
||||
NutMap sysUserMap = (NutMap) Daos.query(dao, Sqls.create("select * from sys_user where loginname=@loginname").setParam("loginname", userHistory.getLoginname()).toString(), Sqls.callback.map());
|
||||
NutMap userHisMap = Lang.obj2nutmap(userHistory);
|
||||
|
||||
if (StrUtil.isNotBlank(userHistory.getRecordId())) {
|
||||
//从变更来的 特殊 需要审核
|
||||
// MemberChangeRecord changeRecord = dao.fetch(MemberChangeRecord.class, userHistory.getRecordId());
|
||||
// String originUnitId = StrUtil.blankToDefault(changeRecord.getOriginUnitId(), "");
|
||||
// String currentUnitId = StrUtil.blankToDefault(changeRecord.getCurrentUnitId(), "");
|
||||
//
|
||||
// if (!originUnitId.equals(currentUnitId) && StrUtil.isNotBlank(currentUnitId)) {
|
||||
// compareData.add(NutMap.NEW()
|
||||
// .addv("columnName", "单位")
|
||||
// .addv("newValue", unitMap.get(currentUnitId))
|
||||
// .addv("oldValue", unitMap.get(originUnitId))
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// String userState = StrUtil.blankToDefault(changeRecord.getChangeUserState(), "");
|
||||
// if (StrUtil.isNotBlank(userState) && !userState.equals(sysUserMap.getString("userState", ""))) {
|
||||
// compareData.add(NutMap.NEW()
|
||||
// .addv("columnName", "在职状态")
|
||||
// .addv("newValue", userState)
|
||||
// .addv("oldValue", sysUserMap.getString("userState"))
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// String personType = StrUtil.blankToDefault(changeRecord.getChangePersonType(), "");
|
||||
// if (StrUtil.isNotBlank(personType) && !personType.equals(sysUserMap.getString("personType", ""))) {
|
||||
// compareData.add(NutMap.NEW()
|
||||
// .addv("columnName", "人员类型")
|
||||
// .addv("newValue", personType)
|
||||
// .addv("oldValue", sysUserMap.getString("personType"))
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// //在职,退休,离职可能会发生会员和福利会员的变化
|
||||
// if(changeRecord.getUpdateMember()!=null && changeRecord.getUpdateMember()){
|
||||
// //说明要改变会员状态
|
||||
// compareData.add(NutMap.NEW()
|
||||
// .addv("columnName", "会员资格")
|
||||
// .addv("newValue", "否")
|
||||
// .addv("oldValue", "是")
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// if(changeRecord.getUpdateWelfareMember()!=null && changeRecord.getUpdateWelfareMember()){
|
||||
// //说明要改变福利会员状态
|
||||
// compareData.add(NutMap.NEW()
|
||||
// .addv("columnName", "福利会员资格")
|
||||
// .addv("newValue", "否")
|
||||
// .addv("oldValue", "是")
|
||||
// );
|
||||
// }
|
||||
|
||||
//需要包含分工会、校工会审核信息
|
||||
String memberChangeRecordId = userHistory.getRecordId();
|
||||
MemberChangeRecord memberChangeRecord = dao.fetch(MemberChangeRecord.class, memberChangeRecordId);
|
||||
dao.fetchLinks(memberChangeRecord,"auditState|unionAudit|schoolAudit");
|
||||
|
||||
resultMap.put("changeHistory", userHistory);
|
||||
resultMap.put("compareData", compareData);
|
||||
resultMap.put("memberChangeRecord", memberChangeRecord);
|
||||
return resultMap;
|
||||
} else {
|
||||
Sql userColumnSql = Sqls.create("""
|
||||
SELECT
|
||||
COLUMN_NAME,
|
||||
DATA_TYPE,
|
||||
CHARACTER_MAXIMUM_LENGTH,
|
||||
COLUMN_COMMENT
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_NAME = 'sys_user'
|
||||
AND TABLE_SCHEMA = 'zhgh_hmc'
|
||||
""");
|
||||
List<NutMap> userTableColumnInfos = sysUserService.listMap(userColumnSql);
|
||||
|
||||
List<String> columns = List.of("unitid", "nation", "birthday", "personType", "political", "schoolTime", "jobTitle", "education", "academicDegree", "position");
|
||||
|
||||
|
||||
for (String column : columns) {
|
||||
if (!sysUserMap.getString(column, "").equals(userHisMap.getString(column, ""))) {
|
||||
String columnName = userTableColumnInfos.stream().filter(c -> c.getString("COLUMN_NAME").equals(column)).findFirst().map(c -> c.getString("COLUMN_COMMENT")).orElse(column);
|
||||
|
||||
if (column.equals("unitid")) {
|
||||
compareData.add(NutMap.NEW()
|
||||
.addv("columnName", columnName)
|
||||
.addv("newValue", unitMap.get(sysUserMap.getString(column)))
|
||||
.addv("oldValue", unitMap.get(userHisMap.getString(column)))
|
||||
);
|
||||
} else {
|
||||
compareData.add(NutMap.NEW()
|
||||
.addv("columnName", columnName)
|
||||
.addv("newValue", sysUserMap.getString(column))
|
||||
.addv("oldValue", userHisMap.getString(column))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
resultMap.put("changeHistory", userHistory);
|
||||
resultMap.put("compareData", compareData);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 会员历史变更记录
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object memberHistoryRecords(String userId) {
|
||||
return memberService.memberHistoryRecordsByUserId(userId);
|
||||
}
|
||||
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
//import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberCheckSelfTask;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberCheckTask;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName MemberSelfAgentController
|
||||
* @Description 会员待办用户自己用
|
||||
* @Author zhf
|
||||
* @Date 2023/6/14 10:18
|
||||
*/
|
||||
@At("/platform/memberSelf/agenda")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
@RequiresAuthentication
|
||||
public class MemberSelfAgentController {
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getAgenda() {
|
||||
|
||||
List<MemberCheckTask> checkTasks = baseService.dao().query(MemberCheckTask.class, Cnd.where("startTime", "<", DateUtil.date())
|
||||
.and("endTime", ">", DateUtil.date())
|
||||
.and("createTaskMode", "=", 2)
|
||||
.and("year", "=", DateUtil.thisYear()));
|
||||
// .and("taskMode", "=", MemberChangeRecordMode.MEMBER.getCode()));
|
||||
|
||||
final String title = "【会员系统】";
|
||||
List<NutMap> list = new ArrayList<>();
|
||||
if (Lang.isNotEmpty(checkTasks)) {
|
||||
checkTasks.forEach(v -> {
|
||||
int count = baseService.dao().count(MemberCheckSelfTask.class, Cnd.where("taskId", "=", v.getId())
|
||||
.and("userId", "=", ShiroUtil.getUserId()).and("isFinish", "=", false));
|
||||
list.add(new NutMap().addv("title", title)
|
||||
.addv("iconClass", "")
|
||||
.addv("name", "核对个人信息").addv("count", count)
|
||||
.addv("mobileHref", "/mobile/member/edit?taskId=" + v.getId()));
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+166
@@ -0,0 +1,166 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.apply;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.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.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.member.handle.MemberApplyToDoHandler;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberApplyRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.param.pageForm.MemberApplyPageForm;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import io.v.nutz.zhgh.staffmanage.specialstaff.model.SpecialStaff;
|
||||
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.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.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:MemberApplyBranchUnionAuditController
|
||||
* @Date 2025/2/12 8:38
|
||||
* @注释
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/member/apply/branchUnion/audit")
|
||||
public class MemberApplyBranchUnionAuditController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private MemberCommonService memberCommonService;
|
||||
@Inject
|
||||
private SysLocalProcessService localProcessService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/member/apply/branchUnionAudit/index.html")
|
||||
@RequiresPermissions("member.apply.branchUnion.audit")
|
||||
public void index() {}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("member.apply.branchUnion.audit")
|
||||
public Object pageData(MemberApplyPageForm pageForm){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
record.*,
|
||||
state.stateName,
|
||||
su.unionname AS allocationUnionName
|
||||
FROM
|
||||
member_apply_record record
|
||||
LEFT JOIN audit_state state ON state.stateId = record.applyStateId
|
||||
LEFT JOIN sys_union su ON su.id = record.allocationUnionId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
pageForm.buildSearch(cnd, "record.");
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin, A06, SchoolUnionMemberAdmin")) {
|
||||
cnd.and("record.allocationUnionId", "=", Vi.getUnionId());
|
||||
}
|
||||
if (pageForm.getAudit()) {
|
||||
cnd.and("record.applyStateId", ">", 50);
|
||||
} else {
|
||||
cnd.and("record.applyStateId", "=", 50);
|
||||
}
|
||||
cnd.desc("record.applyDateTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = memberCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.apply.branchUnion.audit")
|
||||
@SLog(type = "memberApply", tag = "会员入会申请", msg = "分工会审核")
|
||||
public Object approval(@Param("audit") Audit audit, String id){
|
||||
audit.setAuditor(ShiroUtil.getUserId());
|
||||
audit.setLoginname(ShiroUtil.getPlatformLoginname());
|
||||
audit.setUsername(ShiroUtil.getPlatformUsername());
|
||||
audit.setAuditTime(DateUtil.date());
|
||||
audit = dao.insert(audit);
|
||||
|
||||
MemberApplyRecord record = dao.fetch(MemberApplyRecord.class, id);
|
||||
if (audit.getAuditType() == 2) {
|
||||
// 退回修改
|
||||
record.setApplyStateId(60);
|
||||
} else if (audit.getAuditType() == 1) {
|
||||
// 通过
|
||||
record.setApplyStateId(80);
|
||||
} else {
|
||||
// 拒绝
|
||||
record.setApplyStateId(70);
|
||||
}
|
||||
|
||||
record.setBranchUnionAuditId(audit.getId());
|
||||
dao.updateIgnoreNull(record);
|
||||
|
||||
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())) {
|
||||
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());
|
||||
staff.setPersonnelRelationUnitName(user.getUnitname());
|
||||
staff.setUnionRelationUnionId(union.getId());
|
||||
staff.setUnionRelationUnionName(union.getUnionname());
|
||||
staff.setIsManyUnit(false);
|
||||
staff.setSpecialStaffType("HMC_RELATION");
|
||||
dao.insert(staff);
|
||||
}
|
||||
|
||||
Sys_user sysUser = new Sys_user();
|
||||
BeanUtil.copyProperties(record, sysUser);
|
||||
sysUser.setId(user.getId());
|
||||
dao.updateIgnoreNull(sysUser);
|
||||
} else {
|
||||
MemberApplyToDoHandler.REFUSE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会审核拒绝"));
|
||||
}
|
||||
MemberApplyToDoHandler.COMPLETE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会审核完成"));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.apply.branchUnion.audit")
|
||||
@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)
|
||||
.add("branchUnionAuditId", null), Cnd.where("id", "=", id));
|
||||
dao.clear(Audit.class, Cnd.where("id", "=", record.getBranchUnionAuditId()));
|
||||
// 待办撤回
|
||||
localProcessService.revokeTask("MEMBER_APPLY@" + id, "分工会审核");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
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.sys.models.User;
|
||||
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;
|
||||
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeType;
|
||||
import io.v.nutz.zhgh.staffmanage.member.handle.MemberApplyToDoHandler;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberApplyRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
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.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:MemberApplyController
|
||||
* @Date 2025/1/20 19:01
|
||||
* @注释 会员申请
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/member/apply/submit")
|
||||
public class MemberApplyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
@Inject
|
||||
private MemberCommonService commonService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/member/apply/submit/index.html")
|
||||
@RequiresPermissions("member.apply.submit")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/member/apply/submit/index.html")
|
||||
@RequiresPermissions("member.apply.submit")
|
||||
public void h5() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.apply.submit")
|
||||
public Object findOne(String id, Boolean isEdit){
|
||||
if (isEdit) {
|
||||
return dao.fetch(MemberApplyRecord.class, id);
|
||||
}
|
||||
return dao.fetch(User.class, Cnd.where("id", "=", id));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("member.apply.submit")
|
||||
public Object findApplyById(String id){
|
||||
return Result.success().addData(dao.fetch(MemberApplyRecord.class, id));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.apply.submit")
|
||||
@SLog(tag = "会员入会申请", msg = "保存申请")
|
||||
public Object doSave(MemberApplyRecord record){
|
||||
record.setMember(true);
|
||||
record.setUserId(ShiroUtil.getUserId());
|
||||
// 变更来源 个人
|
||||
record.setChangeOrigin(MemberChangeOrigin.PERSONAL.name());
|
||||
// 变更类型 入会
|
||||
record.setChangeType(MemberChangeType.RESTORE.name());
|
||||
record.setChangeTypes(List.of(MemberChangeType.RESTORE.name()));
|
||||
// 待提交
|
||||
record.setApplyStateId(10);
|
||||
dao.insertOrUpdate(record);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.apply.submit")
|
||||
@SLog(tag = "会员入会申请", msg = "提交申请")
|
||||
public Object doSubmit(MemberApplyRecord record){
|
||||
record.setMember(true);
|
||||
record.setUserId(ShiroUtil.getUserId());
|
||||
record.setChangeOrigin(MemberChangeOrigin.PERSONAL.name());
|
||||
record.setChangeType(MemberChangeType.RESTORE.name());
|
||||
record.setChangeTypes(List.of(MemberChangeType.RESTORE.name()));
|
||||
// 待校工会审核
|
||||
record.setApplyStateId(20);
|
||||
dao.insertOrUpdate(record);
|
||||
|
||||
// 审核流程开始
|
||||
MemberApplyToDoHandler.START_PROCESS.exec(record, null);
|
||||
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, "", "");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.apply;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.Vi;
|
||||
import io.v.nutz.sys.services.SysLocalProcessService;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberApplyRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.param.pageForm.MemberApplyPageForm;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import io.v.nutz.zhgh.zgfw.model.difficult.Zgfw_knbf;
|
||||
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;
|
||||
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.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:MemberApplyMineController
|
||||
* @Date 2025/2/12 8:39
|
||||
* @注释 会员入会 我的申请
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/member/apply/mine")
|
||||
public class MemberApplyMineController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private MemberCommonService memberCommonService;
|
||||
@Inject
|
||||
private SysLocalProcessService sysLocalProcessService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/member/apply/mine/index.html")
|
||||
@RequiresPermissions("member.apply.mine")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("member.apply.mine")
|
||||
public Object pageData(MemberApplyPageForm pageForm){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
record.*,
|
||||
state.stateName
|
||||
FROM
|
||||
member_apply_record record
|
||||
LEFT JOIN audit_state state ON state.stateId = record.applyStateId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
pageForm.buildSearch(cnd, "record.");
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionMemberAdmin")) {
|
||||
if (ShiroUtil.hasAnyRoles("H04,branchUnionMemberAdmin")) {
|
||||
cnd.and("record.unionId", "=", Vi.getUnionId());
|
||||
} else {
|
||||
cnd.and("record.userId", "=", ShiroUtil.getUserId());
|
||||
}
|
||||
}
|
||||
cnd.desc("record.applyDateTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = memberCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.apply.mine")
|
||||
@SLog(tag = "会员入会申请", msg = "撤回申请")
|
||||
public Object doRevoke(String id){
|
||||
dao.update(MemberApplyRecord.class, Chain.make("applyStateId", 10), Cnd.where("id", "=", id));
|
||||
sysLocalProcessService.revokeTask("MEMBER_APPLY@" + id,"待提交申请");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.apply.mine")
|
||||
@SLog(tag = "会员入会申请", msg = "删除申请")
|
||||
public Object doDelete(String id){
|
||||
dao.clear(MemberApplyRecord.class, Cnd.where("id", "=", id));
|
||||
sysLocalProcessService.deleteProcessInstance("MEMBER_APPLY@" + id);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"member.apply.mine", "member.apply.branchUnion.audit", "member.apply.schoolUnion.audit"}, logical = Logical.OR)
|
||||
public Object findMemberApplyRecord(String id){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
record.*,
|
||||
u.unionname AS userUnionName,
|
||||
u.unitname AS userUnitName,
|
||||
state.stateName,
|
||||
su.unionname AS allocationUnionName
|
||||
FROM
|
||||
member_apply_record record
|
||||
LEFT JOIN audit_state state ON state.stateId = record.applyStateId
|
||||
LEFT JOIN `user` u ON u.id = record.userId
|
||||
LEFT JOIN sys_union su ON su.id = record.allocationUnionId
|
||||
WHERE
|
||||
record.id = @id
|
||||
""").setParam("id", id);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap nutMap = (NutMap) sql.getResult();
|
||||
|
||||
if (StrUtil.isNotBlank(nutMap.getString("schoolUnionAuditId"))) {
|
||||
Audit audit = dao.fetch(Audit.class, Cnd.where("id", "=", nutMap.getString("schoolUnionAuditId")));
|
||||
nutMap.addv("schoolAudit", audit);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(nutMap.getString("branchUnionAuditId"))) {
|
||||
Audit audit = dao.fetch(Audit.class, Cnd.where("id", "=", nutMap.getString("branchUnionAuditId")));
|
||||
nutMap.addv("branchAudit", audit);
|
||||
}
|
||||
return nutMap;
|
||||
}
|
||||
}
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.apply;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.sys.services.SysLocalProcessService;
|
||||
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;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberApplyRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.param.pageForm.MemberApplyPageForm;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
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.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.util.NutMap;
|
||||
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
|
||||
* @name:MemberApplySchoolUnionAuditController
|
||||
* @Date 2025/2/12 8:38
|
||||
* @注释 会员入会申请,校工会审核
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/member/apply/schoolUnion/audit")
|
||||
public class MemberApplySchoolUnionAuditController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private MemberCommonService memberCommonService;
|
||||
@Inject
|
||||
private SysLocalProcessService localProcessService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/member/apply/schoolUnionAudit/index.html")
|
||||
@RequiresPermissions("member.apply.schoolUnion.audit")
|
||||
public void index() {}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("member.apply.schoolUnion.audit")
|
||||
public Object pageData(MemberApplyPageForm pageForm){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
record.*,
|
||||
state.stateName,
|
||||
su.unionname AS allocationUnionName
|
||||
FROM
|
||||
member_apply_record record
|
||||
LEFT JOIN audit_state state ON state.stateId = record.applyStateId
|
||||
LEFT JOIN sys_union su ON su.id = record.allocationUnionId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
pageForm.buildSearch(cnd, "record.");
|
||||
if (pageForm.getAudit()) {
|
||||
cnd.and("record.applyStateId", ">", 20);
|
||||
} else {
|
||||
cnd.and("record.applyStateId", "=", 20);
|
||||
}
|
||||
cnd.desc("record.applyDateTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = memberCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@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){
|
||||
audit.setAuditor(ShiroUtil.getUserId());
|
||||
audit.setLoginname(ShiroUtil.getPlatformLoginname());
|
||||
audit.setUsername(ShiroUtil.getPlatformUsername());
|
||||
audit.setAuditTime(DateUtil.date());
|
||||
audit = dao.insert(audit);
|
||||
|
||||
MemberApplyRecord record = dao.fetch(MemberApplyRecord.class, id);
|
||||
if (audit.getAuditType() == 2) {
|
||||
// 退回修改
|
||||
record.setApplyStateId(30);
|
||||
} else if (audit.getAuditType() == 1) {
|
||||
// 通过
|
||||
record.setApplyStateId(50);
|
||||
} else {
|
||||
// 拒绝
|
||||
record.setApplyStateId(40);
|
||||
}
|
||||
|
||||
record.setAllocationUnionId(unionId);
|
||||
record.setSchoolUnionAuditId(audit.getId());
|
||||
dao.updateIgnoreNull(record);
|
||||
|
||||
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);
|
||||
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));
|
||||
|
||||
for (NutMap map : list) {
|
||||
String content = "%s老师您好,%s老师的入会申请校工会已通过,现将工会关系划入本工会,请您点击此消息或前往智慧工会进行接收"
|
||||
.formatted(map.getString("username"), record.getUsername());
|
||||
}
|
||||
} else {
|
||||
MemberApplyToDoHandler.REFUSE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核拒绝"));
|
||||
String content = "%s老师您好,您的入会申请被校工会拒绝,如有疑问请及时联系校工会".formatted(record.getUsername());
|
||||
}
|
||||
MemberApplyToDoHandler.COMPLETE_SCHOOL_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核完成"));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.apply.schoolUnion.audit")
|
||||
@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)
|
||||
.add("schoolUnionAuditId", null), Cnd.where("id", "=", id));
|
||||
dao.clear(Audit.class, Cnd.where("id", "=", record.getSchoolUnionAuditId()));
|
||||
// 待办撤回
|
||||
localProcessService.revokeTask("MEMBER_APPLY@" + id, "校工会审核");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.change;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_union;
|
||||
import io.v.nutz.sys.models.Sys_unit;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.User;
|
||||
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;
|
||||
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeType;
|
||||
import io.v.nutz.zhgh.staffmanage.member.handle.MemberChangeToDoHandler;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
@At("/platform/member/change/apply")
|
||||
public class MemberChangeApplyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/change/submit/index.html")
|
||||
@RequiresPermissions("member.change.apply")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private MemberCommonService memberService;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.apply")
|
||||
public Object findChangeById(String id){
|
||||
return dao.fetch(MemberChangeRecord.class, id);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("member.change.apply")
|
||||
@SLog(tag = "会员变更申请", msg = "保存我的申请")
|
||||
public Object doSave(MemberChangeRecord record){
|
||||
// 检验是否有变更
|
||||
if (Lang.isEmpty(record)) {
|
||||
return Result.error("未获取到异动数据");
|
||||
}
|
||||
List<NutMap> changeInfos = memberService.getChangeInfos(record);
|
||||
if (Lang.isEmpty(changeInfos)) {
|
||||
return Result.error("未校验到变更数据,请确认数据是否存在变更");
|
||||
}
|
||||
|
||||
try {
|
||||
User user = dao.fetch(User.class, Cnd.where("id", "=", record.getUserId()));
|
||||
// 比较有哪些变更类型
|
||||
List<String> changeTypes = memberService.compareChangeType(record, user);
|
||||
|
||||
record.setChangeTypes(changeTypes);
|
||||
record.setUserId(ShiroUtil.getUserId());
|
||||
// 变更来源 个人
|
||||
record.setChangeOrigin(MemberChangeOrigin.PERSONAL.name());
|
||||
// 待提交
|
||||
record.setApplyStateId(10010);
|
||||
dao.insertOrUpdate(record);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error("保存失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("member.change.apply")
|
||||
@SLog(tag = "会员变更申请", msg = "提交我的申请")
|
||||
public Object doSubmit(MemberChangeRecord record){
|
||||
// 检验是否有变更
|
||||
if (Lang.isEmpty(record)) {
|
||||
return Result.error("未获取到异动数据");
|
||||
}
|
||||
List<NutMap> changeInfos = memberService.getChangeInfos(record);
|
||||
if (Lang.isEmpty(changeInfos)) {
|
||||
return Result.error("未校验到变更数据,请确认数据是否存在变更");
|
||||
}
|
||||
|
||||
try {
|
||||
User user = dao.fetch(User.class, Cnd.where("id", "=", record.getUserId()));
|
||||
// 比较有哪些变更类型
|
||||
List<String> changeTypes = memberService.compareChangeType(record, user);
|
||||
record.setChangeTypes(changeTypes);
|
||||
record.setUserId(ShiroUtil.getUserId());
|
||||
// 变更来源 个人
|
||||
record.setChangeOrigin(MemberChangeOrigin.PERSONAL.name());
|
||||
// 待分工会审核
|
||||
record.setApplyStateId(10020);
|
||||
dao.insertOrUpdate(record);
|
||||
|
||||
MemberChangeToDoHandler.START_PROCESS.exec(record, null);
|
||||
MemberChangeToDoHandler.CREATE_UNION_TASK.exec(record, null);
|
||||
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
log.error("提交失败", e);
|
||||
return Result.error("提交失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"member.change.branchUnion.audit","member.change.schoolUnion.audit"}, logical = Logical.OR)
|
||||
public Object getUserByIdForMemberChange(String userId){
|
||||
User user = dao.fetch(User.class, Cnd.where("id", "=", userId));
|
||||
NutMap nutMap = Lang.obj2nutmap(user);
|
||||
if (StrUtil.isNotBlank(user.getUnionid())) {
|
||||
Sys_union union = dao.fetch(Sys_union.class, Cnd.where("id", "=", user.getUnionid()));
|
||||
nutMap.put("union", union);
|
||||
}
|
||||
if (StrUtil.isNotBlank(user.getUnitid())) {
|
||||
Sys_unit unit = dao.fetch(Sys_unit.class, Cnd.where("id", "=", user.getUnitid()));
|
||||
nutMap.put("unit", unit);
|
||||
}
|
||||
return nutMap;
|
||||
}
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.change;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.sys.services.SysLocalProcessService;
|
||||
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.MemberChangeToDoHandler;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.param.pageForm.MemberChangePageForm;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
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.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.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:MemberChangeBranchUnionAuditController
|
||||
* @Date 2025/2/14 14:13
|
||||
* @注释
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/member/change/branchUnion/audit")
|
||||
public class MemberChangeBranchUnionAuditController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private MemberCommonService memberCommonService;
|
||||
@Inject
|
||||
private SysLocalProcessService localProcessService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/change/branchUnionAudit/index.html")
|
||||
@RequiresPermissions("member.change.branchUnion.audit")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("member.change.branchUnion.audit")
|
||||
public Object pageData(MemberChangePageForm pageForm){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
record.*,
|
||||
state.stateName
|
||||
FROM
|
||||
member_change_record record
|
||||
LEFT JOIN audit_state state ON state.stateId = record.applyStateId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
pageForm.buildSearch(cnd, "record.");
|
||||
if (pageForm.getAudit()) {
|
||||
cnd.and("record.applyStateId", ">", 10020);
|
||||
} else {
|
||||
cnd.and("record.applyStateId", "=", 10020);
|
||||
}
|
||||
cnd.desc("record.applyDateTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = memberCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.change.branchUnion.audit")
|
||||
@SLog(type = "memberChange", tag = "会员变更", msg = "分工会审核")
|
||||
public Object approval(@Param("audit") Audit audit, String id){
|
||||
audit.setAuditor(ShiroUtil.getUserId());
|
||||
audit.setLoginname(ShiroUtil.getPlatformLoginname());
|
||||
audit.setUsername(ShiroUtil.getPlatformUsername());
|
||||
audit.setAuditTime(DateUtil.date());
|
||||
audit = dao.insert(audit);
|
||||
|
||||
MemberChangeRecord record = dao.fetch(MemberChangeRecord.class, id);
|
||||
if (audit.getAuditType() == 2) {
|
||||
// 退回修改
|
||||
record.setApplyStateId(10030);
|
||||
} else if (audit.getAuditType() == 1) {
|
||||
// 通过
|
||||
record.setApplyStateId(10050);
|
||||
} else {
|
||||
// 拒绝
|
||||
record.setApplyStateId(10040);
|
||||
}
|
||||
|
||||
record.setBranchUnionAuditId(audit.getId());
|
||||
dao.updateIgnoreNull(record);
|
||||
|
||||
MemberChangeToDoHandler.COMPLETE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会审核完成"));
|
||||
if (audit.getAuditType() == 2) {
|
||||
MemberChangeToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会退回"));
|
||||
} else if (audit.getAuditType() == 1) {
|
||||
MemberChangeToDoHandler.CREATE_SCHOOL_TASK.exec(record, null);
|
||||
} else {
|
||||
MemberChangeToDoHandler.REFUSE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会审核拒绝"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.change.branchUnion.audit")
|
||||
@SLog(type = "memberChange", tag = "会员变更", msg = "分工会撤回")
|
||||
public Object doRevoke(String id){
|
||||
MemberChangeRecord record = dao.fetch(MemberChangeRecord.class, id);
|
||||
dao.update(MemberChangeRecord.class, Chain.make("applyStateId", 10020)
|
||||
.add("branchUnionAuditId", null), Cnd.where("id", "=", id));
|
||||
dao.clear(Audit.class, Cnd.where("id", "=", record.getBranchUnionAuditId()));
|
||||
// 待办撤回
|
||||
localProcessService.revokeTask("MEMBER_CHANGE@" + id, "分工会审核");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+747
@@ -0,0 +1,747 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.change;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
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 cn.wizzer.framework.base.Result;
|
||||
import com.google.common.base.Joiner;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.AuditService;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.sys.models.*;
|
||||
import io.v.nutz.sys.services.SysUnitService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.data.constant.UserChangeType;
|
||||
import io.v.nutz.zhgh.staffmanage.member.MemberMode;
|
||||
import io.v.nutz.zhgh.staffmanage.member.UserMode;
|
||||
import io.v.nutz.zhgh.staffmanage.member.WelfareMemberMode;
|
||||
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeOrigin;
|
||||
import io.v.nutz.zhgh.staffmanage.member.handle.MemberChangeToDoHandler;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
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.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.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.AdaptBy;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@At("/platform/member/change/mange")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
@Slf4j
|
||||
public class MemberChangeManageController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/change/manage/index.html")
|
||||
@RequiresPermissions("member.change.mange")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private MemberCommonService memberService;
|
||||
|
||||
@Inject
|
||||
private AuditService auditService;
|
||||
|
||||
@Inject("MemberChangeRecord")
|
||||
private ViService<MemberChangeRecord> recordViService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SysUnitService sysUnitService;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
public Object pageData(@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "changeDateBefore", required = false) String changeDateBefore,
|
||||
@Param(value = "changeDateEnd", required = false) String changeDateEnd,
|
||||
PageForm pageForm,
|
||||
@Param(value = "campus", required = false) String campus,
|
||||
@Param(value = "sex", required = false) String sex,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
@Param(value = "preparedBy", required = false) String preparedBy,
|
||||
@Param(value = "changeDate", required = false) String changeDate,
|
||||
@Param(value = "changeTypes", required = false) String[] changeTypes,
|
||||
@Param(value = "changed", required = false) Integer changed,
|
||||
@Param(value = "myUnionGroupUser", required = false) Integer myUnionGroupUser,
|
||||
@Param(value = "isMember", required = false) Integer isMember) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.*,
|
||||
his.id hisId,
|
||||
his.changeType,
|
||||
his.changeTypes,
|
||||
his.changeTime,
|
||||
IF( his.id IS NULL, FALSE, TRUE ) hasHis,
|
||||
state.stateId,
|
||||
state.stateName,
|
||||
state.stateColor
|
||||
FROM
|
||||
`user` u
|
||||
LEFT JOIN user_history his ON his.loginname = u.loginname
|
||||
LEFT JOIN member_change_record mcr on mcr.userId = u.id
|
||||
LEFT JOIN audit_state state ON mcr.applyStateId = state.stateId
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("u.member", "=", isMember);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H03,A06")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
if (myUnionGroupUser == null) {
|
||||
seg.or("u.unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||
seg.or("u.unionGroupId", "is", null);
|
||||
cnd.and(seg);
|
||||
} else if (myUnionGroupUser == 1) {
|
||||
cnd.and("u.unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||
} else {
|
||||
seg.or("u.unionGroupId", "is", null);
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
|
||||
}
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("u.unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("u.campusId", "=", campus);
|
||||
cnd.andEX("u.sex", "=", sex);
|
||||
cnd.andEX("u.personType", "=", personType);
|
||||
cnd.andEX("u.userState", "=", userState);
|
||||
cnd.andEX("u.preparedBy", "=", preparedBy);
|
||||
|
||||
if (StrUtil.isAllNotBlank(pageForm.getSearchName(), pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(pageForm.getSearchName(), "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.or(pageForm.getSearchName(), "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(changeDateBefore) && StrUtil.isNotBlank(changeDateEnd)) {
|
||||
cnd.and(new Static(String.format("Date(his.changeTime) >= '%s' and Date(his.changeTime) <= '%s'", changeDateBefore, changeDateEnd)));
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy((List.of("changeTime", "changeType", "changeTypes").contains(pageForm.getPageOrderName()) ? "his." : "u.") + pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
} else {
|
||||
cnd.desc("his.changeTime");
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(changeTypes)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (String type : changeTypes) {
|
||||
seg.or(new Static("JSON_CONTAINS(his.changeTypes, JSON_QUOTE('%s'), '$')".formatted(type)));
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (changed != null) {
|
||||
if (changed == 1) {
|
||||
cnd.and(new Static("his.changeTypes is not null"));
|
||||
} else if (changed == 2){
|
||||
cnd.desc("his.changeTime");
|
||||
} else {
|
||||
cnd.and(new Static("his.changeTypes is null"));
|
||||
}
|
||||
}
|
||||
cnd.groupBy("u.id");
|
||||
sql.setCondition(cnd);
|
||||
return memberService.list(pageForm, sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getButtonNum(@Param(value = "changeDateBefore", required = false) String changeDateBefore,
|
||||
@Param(value = "changeDateEnd", required = false) String changeDateEnd,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "campus", required = false) String campus,
|
||||
@Param(value = "sex", required = false) String sex,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
@Param(value = "changeDate", required = false) String changeDate,
|
||||
@Param(value = "changeType", required = false) String changeType,
|
||||
PageForm pageForm,
|
||||
@Param(value = "changed", required = false) Integer changed,
|
||||
@Param(value = "isMember", required = false) Integer isMember) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
(sum( CASE WHEN his.changeType IS NOT NULL THEN 1 ELSE 0 END )) as 'changeNum',
|
||||
(sum( CASE WHEN his.changeType IS NULL THEN 1 ELSE 0 END )) as 'notChangeNum',
|
||||
count(u.id) as 'userSumNum',
|
||||
(sum( CASE WHEN u.member = 1 THEN 1 ELSE 0 END )) as 'memberNum',
|
||||
(sum( CASE WHEN u.member != 1 THEN 1 ELSE 0 END )) as 'notMemberNum'
|
||||
FROM
|
||||
`user` u
|
||||
LEFT JOIN user_history_latest his ON his.loginname = u.loginname
|
||||
LEFT JOIN member_change_record_latest mcr on mcr.userId = u.id
|
||||
LEFT JOIN audit_state state ON mcr.stateId = state.stateId
|
||||
$condition
|
||||
""");
|
||||
// .setParam("recordMode", MemberChangeRecordMode.MEMBER.getCode())
|
||||
// .setParam("changeUnitAuditing", MemberChangeApplyState.SCHOOL_UNION)
|
||||
// .setParam("changeUnitError", MemberChangeApplyState.SCHOOL_UNION_FAIL)
|
||||
// .setParam("success", MemberChangeApplyState.SUCCESS)
|
||||
// .setVar("failStates", Joiner.on(",").join(List.of(MemberChangeApplyState.UNION_FAIL, MemberChangeApplyState.SCHOOL_UNION_FAIL)));
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.andEX("u.member", "=", isMember);
|
||||
cnd.and(pageForm);
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H03,A06")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("u.unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||
seg.or("u.unionGroupId", "is", null);
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("u.unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("u.campusId", "=", campus);
|
||||
cnd.andEX("u.sex", "=", sex);
|
||||
cnd.andEX("u.personType", "=", personType);
|
||||
cnd.andEX("u.userState", "=", userState);
|
||||
if (StrUtil.isNotBlank(changeDateBefore) && StrUtil.isNotBlank(changeDateEnd)) {
|
||||
cnd.and(new Static(String.format("Date(his.changeTime) >= '%s' and Date(his.changeTime) <= '%s'", changeDateBefore, changeDateEnd)));
|
||||
}
|
||||
cnd.andEX("his.changeType", "=", changeType);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return memberService.fetch(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@SLog(tag = "会员高级管理-会员变更", msg = "分工会/校工会会员管理员提交变更")
|
||||
public Object doSubmitChange(MemberChangeRecord record) {
|
||||
// 检验是否有变更
|
||||
if (Lang.isEmpty(record)) {
|
||||
return Result.error("未获取到异动数据");
|
||||
}
|
||||
List<NutMap> changeInfos = memberService.getChangeInfos(record);
|
||||
if (Lang.isEmpty(changeInfos)) {
|
||||
return Result.error("未校验到变更数据,请确认数据是否存在变更");
|
||||
}
|
||||
|
||||
try {
|
||||
// 变更就表明,当前审核人审核通过
|
||||
Audit audit = new Audit();
|
||||
audit.setAuditor(ShiroUtil.getUserId());
|
||||
audit.setLoginname(ShiroUtil.getPlatformLoginname());
|
||||
audit.setUsername(ShiroUtil.getPlatformUsername());
|
||||
audit.setAuditOpinion("通过");
|
||||
audit.setAuditTime(DateUtil.date());
|
||||
dao.insert(audit);
|
||||
|
||||
User user = dao.fetch(User.class, Cnd.where("id", "=", record.getUserId()));
|
||||
// 比较有哪些变更类型
|
||||
List<String> changeTypes = memberService.compareChangeType(record, user);
|
||||
record.setChangeTypes(changeTypes);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin, SchoolUnionMemberAdmin")) {
|
||||
// 分工会变更,分工会审核通过,转为校工会审核
|
||||
record.setChangeOrigin(MemberChangeOrigin.BRANCH_UNION.name());
|
||||
record.setApplyStateId(10050);
|
||||
record.setBranchUnionAuditId(audit.getId());
|
||||
dao.insert(record);
|
||||
|
||||
// 创建流程任务
|
||||
MemberChangeToDoHandler.START_PROCESS.exec(record, null);
|
||||
MemberChangeToDoHandler.CREATE_UNION_TASK.exec(record, null);
|
||||
MemberChangeToDoHandler.COMPLETE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会审核完成"));
|
||||
MemberChangeToDoHandler.CREATE_SCHOOL_TASK.exec(record, null);
|
||||
} else {
|
||||
// 校工会变更,变更直接完成
|
||||
record.setChangeOrigin(MemberChangeOrigin.SCHOOL_UNION.name());
|
||||
record.setApplyStateId(10080);
|
||||
record.setBranchUnionAuditId(audit.getId());
|
||||
record.setSchoolUnionAuditId(audit.getId());
|
||||
dao.insert(record);
|
||||
|
||||
// 创建流程任务
|
||||
MemberChangeToDoHandler.START_PROCESS.exec(record, null);
|
||||
MemberChangeToDoHandler.CREATE_UNION_TASK.exec(record, null);
|
||||
MemberChangeToDoHandler.COMPLETE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会审核完成"));
|
||||
MemberChangeToDoHandler.CREATE_SCHOOL_TASK.exec(record, null);
|
||||
MemberChangeToDoHandler.COMPLETE_SCHOOL_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核完成"));
|
||||
MemberChangeToDoHandler.COMPLETE_PROCESS.exec(record, null);
|
||||
memberService.compareChangeInfoAndUpdateMember(record.getId());
|
||||
}
|
||||
return Result.success("操作成功");
|
||||
} catch (Exception e) {
|
||||
log.error("分工会/校工会会员管理员提交变更:", e);
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Inject
|
||||
private SysUserService userService;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
public Object sendSms(String userid) {
|
||||
Sys_user user = userService.fetch(userid);
|
||||
/*if (Strings.isNotBlank(user.getMobile())) {
|
||||
RCSCloudAPI.sendTplSms("9159ed9ef1654c0ea2d7475520049a6f", user.getMobile(), "@1@=" + user.getUsername(), "");
|
||||
}*/
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 全部设置为福利会员
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
public Object allIsWelfareMember(PageForm pageForm,
|
||||
@Param(value = "startDate", required = false) String startDate,
|
||||
@Param(value = "endDate", required = false) String endDate,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unionId", required = false) String[] unionId,
|
||||
@Param(value = "unitId", required = false) String[] unitId,
|
||||
@Param(value = "threeUnitId", required = false) String[] threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String[] unionGroupId,
|
||||
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||
@Param(value = "userStates", required = false) String[] userStates,
|
||||
@Param(value = "memberStatus", required = false) String[] memberStatus,
|
||||
@Param(value = "campus", required = false) String campus,
|
||||
@Param(value = "memberTypes", required = false) String[] memberTypes,
|
||||
@Param(value = "sexTypes", required = false) String[] sexTypes,
|
||||
@Param(value = "roleIds", required = false) String[] roleIds,
|
||||
@Param(value = "age", required = false) String[] age,
|
||||
@Param(value = "reverseSelection") boolean reverseSelection,
|
||||
@Param(value = "memberSearchName", required = false) String memberSearchName,
|
||||
@Param(value = "memberSearchKeyWord", required = false) String memberSearchKeyWord,
|
||||
@Param(value = "isAppendWelfareMember", required = false) Boolean isAppendWelfareMember) {
|
||||
int yyyy = Calendar.getInstance().get(Calendar.YEAR);
|
||||
Cnd cnd = MemberUtils.getCnd(pageForm, startDate, endDate, unionId, unitId, personTypes, userStates, null, memberTypes, sexTypes, age, null, roleIds, null, null, memberStatus, threeUnitId, unionGroupId, reverseSelection, null, null, campus);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT u.* from $table
|
||||
LEFT JOIN sys_user_role sur ON sur.userid = u.id
|
||||
$condition
|
||||
""");
|
||||
if (year == yyyy) {
|
||||
sql.setVar("table", "user u");
|
||||
} else {
|
||||
sql.setVar("table", "member_his u");
|
||||
cnd.andEX("u.year", "=", year);
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(new SqlExpressionGroup().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(memberSearchName)) {
|
||||
cnd.and(new SqlExpressionGroup().andLike(memberSearchName, memberSearchKeyWord));
|
||||
}
|
||||
List<Integer> status = new ArrayList<>();
|
||||
// status.add(MemberStatus.NORMAL.getCode());
|
||||
// status.add(MemberStatus.TURN_IN.getCode());
|
||||
// status.add(MemberStatus.RESTORE.getCode());
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,H03")) {
|
||||
cnd.and("unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
if (StrUtil.isBlank(pageForm.getPageOrderName()) && StrUtil.isBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.asc("u.loginname");
|
||||
}
|
||||
cnd.groupBy("u.id");
|
||||
sql.setCondition(cnd);
|
||||
List<String> ids = memberService.list(sql).stream().map(v -> v.getString("id")).collect(Collectors.toList());
|
||||
|
||||
Trans.exec(() -> {
|
||||
if (!isAppendWelfareMember) {
|
||||
memberService.update(Chain.make("welfareMember", WelfareMemberMode.NONE.getCode()), Cnd.where("welfareMember", "=", WelfareMemberMode.NORMAL.getCode()));
|
||||
}
|
||||
memberService.update(Chain.make("welfareMember", WelfareMemberMode.NORMAL.getCode()), Cnd.where("member", "=", MemberMode.NORMAL.getCode()).and("id", "in", ids));
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量设置用户新单位
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
public Object userUnitMove(String threeUnitId, String unitId, @Param("userId[]") String[] userId) {
|
||||
|
||||
Sys_unit unit = memberService.dao().fetch(Sys_unit.class, unitId);
|
||||
|
||||
Trans.exec(() -> {
|
||||
|
||||
Chain updateUnitChain = Chain.make("unitid", unit.getId())
|
||||
.add("unionid", unit.getUnionid())
|
||||
.add("threeUnitId", threeUnitId);
|
||||
memberService.update("sys_user", updateUnitChain, Cnd.where("id", "in", userId));
|
||||
|
||||
for (String uid : userId) {
|
||||
// MemberChangeRecord record = new MemberChangeRecord();
|
||||
//// record.setRecordMode(MemberChangeRecordMode.MEMBER.getCode());
|
||||
// record.setType(UserChangeType.UNIT_CHANGE.getCode());
|
||||
// record.setUserId(uid);
|
||||
// record.setApplyTime(new Date());
|
||||
//// record.setApplyOrigin(MemberChangeOrigin.SCHOOL.getCode());
|
||||
//// record.setRecordMode(MemberChangeRecordMode.MEMBER.getCode());
|
||||
//// record.setStateId(MemberChangeApplyState.SUCCESS);
|
||||
//
|
||||
// Audit audit = new Audit();
|
||||
// audit.setAuditPass(true);
|
||||
//// audit.setAuditOpinion(MemberOrigin.BATCH.getDescription());
|
||||
// String id = auditService.insert(audit).getId();
|
||||
//
|
||||
// record.setSchoolAuditId(id);
|
||||
// memberService.insert(record);
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
public Object userPageData(PageForm pageForm,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "member", required = false) Boolean member,
|
||||
@Param(value = "sqlCnd", required = false) String[] sqlCnd) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.*
|
||||
FROM
|
||||
`user` u
|
||||
LEFT JOIN member_change_record c ON u.id = c.userId
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
pageForm.defaultSortAsc("u.unitid");
|
||||
cnd.and(pageForm);
|
||||
|
||||
cnd.andEX("u.unitid", "=", unionId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
|
||||
// cnd.and("u.member", "=", member);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,flwyh01")) {
|
||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
// for (String s : sqlCnd) {
|
||||
// cnd.and(new Static(s));
|
||||
// }
|
||||
cnd.groupBy("u.loginname");
|
||||
cnd.asc("u.loginname");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return memberService.list(pageForm, sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.change.mange")
|
||||
public Object joinWelfareMember(String[] userIds, String taskId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unitId", required = false) String unitId) {
|
||||
if (ShiroUtil.hasAnyRoles("sysadmin,A06,flwyh01")) {
|
||||
UserMode.addMemberRole(userIds);
|
||||
return null;
|
||||
}
|
||||
List<MemberChangeRecord> maps = new ArrayList<>();
|
||||
Audit audit = new Audit();
|
||||
audit.setAuditor(ShiroUtil.getUserId());
|
||||
audit.setAuditPass(true);
|
||||
audit.setAuditTime(new Date());
|
||||
audit.setAuditOpinion("新增会员");
|
||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
memberService.insert(audit);
|
||||
for (String userId : userIds) {
|
||||
// User user = memberService.dao().fetch(User.class, Cnd.where("id", "=", userId));
|
||||
// MemberChangeRecord changeRecord = new MemberChangeRecord();
|
||||
// changeRecord.setType(UserChangeType.NEW.getCode());
|
||||
//// changeRecord.setApplyOrigin(ShiroUtil.hasRole("H04") ? MemberChangeOrigin.UNION.getCode() : MemberChangeOrigin.UNION_GROUP.getCode());
|
||||
//// changeRecord.setStateId(MemberChangeApplyState.SCHOOL_UNION);
|
||||
// changeRecord.setUpdateWelfareMember(true);
|
||||
// changeRecord.setUserId(userId);
|
||||
// changeRecord.setApplyTime(new Date());
|
||||
// changeRecord.setOriginUnitId(user.getUnitid());
|
||||
// changeRecord.setOriginUnionId(user.getUnionid());
|
||||
// changeRecord.setOriginThreeUnitId(user.getThreeUnitId());
|
||||
// changeRecord.setCurrentUnionId(user.getUnionid());
|
||||
// changeRecord.setCurrentUnitId(unitId);
|
||||
// changeRecord.setCurrentThreeUnitId(threeUnitId);
|
||||
// changeRecord.setUnionAuditId(audit.getId());
|
||||
//// changeRecord.setRecordMode(MemberChangeRecordMode.MEMBER.getCode());
|
||||
// changeRecord.setTaskId(taskId);
|
||||
// maps.add(changeRecord);
|
||||
}
|
||||
memberService.insert(maps);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
public Object units() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("unitlevel", "=", 2);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin")) {
|
||||
cnd.and("id", "!=", "DZJF000");
|
||||
}
|
||||
return sysUnitService.dao().query("unit_union", cnd);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
public Object batchUpdatePersonType(@Param("users") String data) {
|
||||
List<Sys_user> users = Json.fromJsonAsList(Sys_user.class, data);
|
||||
for (Sys_user user : users) {
|
||||
userService.update(Chain.make("personType", user.getPersonType()), Cnd.where("id", "=", user.getId()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
public Object batchUpdateUserState(@Param("users") String data) {
|
||||
List<Sys_user> users = Json.fromJsonAsList(Sys_user.class, data);
|
||||
for (Sys_user user : users) {
|
||||
userService.update(Chain.make("userState", user.getUserState()), Cnd.where("id", "=", user.getId()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("member.change.mange")
|
||||
public void downloadImport(HttpServletResponse response) {
|
||||
try {
|
||||
ViTool.excelResponse(response, "会员导入模版.xlsx");
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
entityList.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
entityList.add(new ExcelExportEntity("性别", "sex", 10));
|
||||
entityList.add(new ExcelExportEntity("单位名称", "unitName", 20));
|
||||
entityList.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
if (ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
entityList.add(new ExcelExportEntity("身份证号", "idcard", 30));
|
||||
}
|
||||
entityList.add(new ExcelExportEntity("在职状态", "userState", 20));
|
||||
entityList.add(new ExcelExportEntity("人员类型", "personType", 20));
|
||||
entityList.add(new ExcelExportEntity("入会时间", "memberJoinTime", 20));
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, new ArrayList<>());
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock(true);
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@SLog(type = "会员管理系统", tag = "信息维护-会员高级管理", msg = "导入会员", param = true, result = true)
|
||||
public Object doImport(TempFile file) {
|
||||
try {
|
||||
lock.lock();
|
||||
List<MemberTemp> memberImportList = ExcelImportUtil.importExcel(file.getFile(), MemberTemp.class, new ImportParams());
|
||||
//获取系统用户
|
||||
List<Sys_user> dataUserList = dao.query(Sys_user.class, Cnd.NEW());
|
||||
Map<String, Sys_user> userMap = dataUserList.stream().collect(Collectors.toMap(Sys_user::getLoginname, v -> v));
|
||||
|
||||
List<Sys_unit> unitList = sysUnitService.query(Cnd.where("unitlevel","=",2));
|
||||
|
||||
//判断单位
|
||||
Map<String, String> unitMap = unitList.stream().collect(Collectors.toMap(Sys_unit::getName, Sys_unit::getId));
|
||||
|
||||
//系统中有此用户,修改
|
||||
List<String> needUpdateUserIds = new ArrayList<>();
|
||||
|
||||
//系统中没有,新增
|
||||
List<Sys_user> needInsertUser = new ArrayList<>();
|
||||
|
||||
//赋予角色
|
||||
List<Sys_user_role> userRoles = new ArrayList<>();
|
||||
|
||||
//返回错误记录
|
||||
List<MemberTemp> errorInfos = new ArrayList<>();
|
||||
|
||||
List<Sys_user> needUpdateUser = new ArrayList<>();
|
||||
|
||||
memberImportList.forEach(v -> {
|
||||
|
||||
//判断是否填写单位、单位是否存在
|
||||
String unitId = unitMap.get(v.getUnitName());
|
||||
if (Strings.isNotBlank(v.getUnitName()) && Strings.isBlank(unitId)) {
|
||||
v.setErrorInfo("获取不到该用户的单位信息!");
|
||||
errorInfos.add(v);
|
||||
return;
|
||||
}
|
||||
|
||||
//判断是否在系统中
|
||||
Sys_user user = userMap.get(v.getLoginname());
|
||||
Sys_user_role userRole = new Sys_user_role();
|
||||
if (Lang.isNotEmpty(user)) {
|
||||
user.setUnitid(unitId);
|
||||
user.setSex(v.getSex());
|
||||
user.setMobile(v.getMobile());
|
||||
user.setMember(1);
|
||||
user.setUserState(v.getUserState());
|
||||
user.setPersonType(v.getPersonType());
|
||||
if (StrUtil.isNotBlank(v.getIdcard())) {
|
||||
user.setIdcard(v.getIdcard());
|
||||
}
|
||||
userRole.setUserId(user.getId());
|
||||
needUpdateUser.add(user);
|
||||
needUpdateUserIds.add(user.getId());
|
||||
} else {
|
||||
//不在就初始化新用户,工号用导入表中的
|
||||
Sys_user initUser = UserMode.initUser(new Sys_user());
|
||||
initUser.setUnitid(unitId);
|
||||
initUser.setUsername(v.getUsername());
|
||||
initUser.setLoginname(v.getLoginname());
|
||||
initUser.setMember(1);
|
||||
initUser.setSex(v.getSex());
|
||||
initUser.setMobile(v.getMobile());
|
||||
initUser.setUserState(v.getUserState());
|
||||
initUser.setPersonType(v.getPersonType());
|
||||
if (StrUtil.isNotBlank(v.getIdcard())) {
|
||||
initUser.setIdcard(v.getIdcard());
|
||||
}
|
||||
userRole.setUserId(initUser.getId());
|
||||
needInsertUser.add(initUser);
|
||||
}
|
||||
userRole.setRoleId(Roles.MEMBER);
|
||||
userRoles.add(userRole);
|
||||
});
|
||||
|
||||
//需要删除角色的用户ID
|
||||
List<String> doCleanRoleUsers = needInsertUser.stream().map(Sys_user::getId).collect(Collectors.toList());
|
||||
doCleanRoleUsers.addAll(needUpdateUserIds);
|
||||
sysUnitService.dao().clear(Sys_user_role.class, Cnd.where("userId", "in", doCleanRoleUsers).and("roleId", "=", Roles.MEMBER));
|
||||
//新增会员角色
|
||||
sysUnitService.dao().insert(userRoles);
|
||||
//系统中存在就修改
|
||||
sysUnitService.dao().update(Sys_user.class, Chain.make("member", 1), Cnd.where("id", "in", needUpdateUserIds));
|
||||
//系统中不存在就新增
|
||||
sysUnitService.dao().insert(needInsertUser);
|
||||
|
||||
sysUnitService.dao().updateIgnoreNull(needUpdateUser);
|
||||
|
||||
//如果有错误数据就返回给前端
|
||||
if (Lang.isNotEmpty(errorInfos)) {
|
||||
NutMap nutMap = NutMap.NEW();
|
||||
nutMap.setv("totalCount", memberImportList.size());
|
||||
nutMap.setv("successCount", doCleanRoleUsers.size());
|
||||
nutMap.setv("errorCount", errorInfos.size());
|
||||
nutMap.setv("errorList", errorInfos.stream().map(v -> {
|
||||
return NutMap.NEW().addv("工号", v.getLoginname()).addv("姓名", v.getUsername()).addv("错误原因", v.getErrorInfo());
|
||||
}).collect(Collectors.toList()));
|
||||
return io.v.nutz.base.result.Result.success(nutMap);
|
||||
}
|
||||
|
||||
sysUnitService.dao().clear(Sys_user.class,Cnd.where("loginname","is",null));
|
||||
lock.unlock();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
public Object getAllChangeMemberInfo(String userId){
|
||||
List<NutMap> mapList = memberService.getAllChangeInfo(userId);
|
||||
if (Lang.isEmpty(mapList)) {
|
||||
return Result.error("未获取到异动数据");
|
||||
}
|
||||
|
||||
User user = dao.fetch(User.class, Cnd.where("id", "=", userId));
|
||||
NutMap map = Lang.obj2nutmap(user);
|
||||
map.put("user",user);
|
||||
map.put("allChangeInfo", mapList);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.change;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.Vi;
|
||||
import io.v.nutz.sys.services.SysLocalProcessService;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberApplyRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.param.pageForm.MemberChangePageForm;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
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.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.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:MemberChangeMineController
|
||||
* @Date 2025/2/14 11:13
|
||||
* @注释
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/member/change/mine")
|
||||
public class MemberChangeMineController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private MemberCommonService memberCommonService;
|
||||
@Inject
|
||||
private SysLocalProcessService sysLocalProcessService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/change/mine/index.html")
|
||||
@RequiresPermissions("member.change.mine")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("member.change.mine")
|
||||
public Object pageData(MemberChangePageForm pageForm){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
record.*,
|
||||
state.stateName
|
||||
FROM
|
||||
member_change_record record
|
||||
LEFT JOIN audit_state state ON state.stateId = record.applyStateId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
pageForm.buildSearch(cnd, "record.");
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionMemberAdmin")) {
|
||||
if (ShiroUtil.hasAnyRoles("H04,branchUnionMemberAdmin")) {
|
||||
cnd.and("record.unionId", "=", Vi.getUnionId());
|
||||
} else {
|
||||
cnd.and("record.userId", "=", ShiroUtil.getUserId());
|
||||
}
|
||||
}
|
||||
cnd.desc("record.applyDateTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = memberCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.change.mine")
|
||||
@SLog(tag = "会员入会申请", msg = "撤回申请")
|
||||
public Object doRevoke(String id){
|
||||
dao.update(MemberChangeRecord.class, Chain.make("applyStateId", 10), Cnd.where("id", "=", id));
|
||||
sysLocalProcessService.revokeTask("MEMBER_CHANGE@" + id,"待提交申请");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.change.mine")
|
||||
@SLog(tag = "会员入会申请", msg = "删除申请")
|
||||
public Object doDelete(String id){
|
||||
dao.clear(MemberChangeRecord.class, Cnd.where("id", "=", id));
|
||||
sysLocalProcessService.deleteProcessInstance("MEMBER_CHANGE@" + id);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mine")
|
||||
public Object findMemberChangeRecord(String id){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.*,
|
||||
record.id AS recordId,
|
||||
record.applyDateTime,
|
||||
record.branchUnionAuditId,
|
||||
record.schoolUnionAuditId,
|
||||
state.stateName
|
||||
FROM
|
||||
member_change_record record
|
||||
LEFT JOIN audit_state state ON state.stateId = record.applyStateId
|
||||
LEFT JOIN `user` u ON u.id = record.userId
|
||||
WHERE
|
||||
record.id = @id
|
||||
""").setParam("id", id);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap nutMap = (NutMap) sql.getResult();
|
||||
|
||||
List<NutMap> changeInfos = memberCommonService.getChangeInfos(nutMap.getString("recordId"));
|
||||
nutMap.put("changeInfos", changeInfos);
|
||||
|
||||
if (StrUtil.isNotBlank(nutMap.getString("schoolUnionAuditId"))) {
|
||||
Audit audit = dao.fetch(Audit.class, Cnd.where("id", "=", nutMap.getString("schoolUnionAuditId")));
|
||||
nutMap.addv("schoolAudit", audit);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(nutMap.getString("branchUnionAuditId"))) {
|
||||
Audit audit = dao.fetch(Audit.class, Cnd.where("id", "=", nutMap.getString("branchUnionAuditId")));
|
||||
nutMap.addv("branchAudit", audit);
|
||||
}
|
||||
return nutMap;
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.change;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
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;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 变更记录查看
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/28
|
||||
* @since 1.0
|
||||
*/
|
||||
@At("/platform/member/change/records")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MemberChangeRecordsController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/change/record/index.html")
|
||||
@RequiresPermissions("member.change.records")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private MemberCommonService memberService;
|
||||
|
||||
@Inject("MemberChangeRecord")
|
||||
private ViService<MemberChangeRecord> recordViService;
|
||||
|
||||
@Inject("Audit")
|
||||
private ViService<Audit> auditViService;
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.records")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "userType", required = false) String userType,
|
||||
@Param(value = "changeTypes", required = false) String[] changeTypes,
|
||||
@Param(value = "applyOrigin", required = false) String applyOrigin) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
pageForm.defaultSortDesc("mcr.applyDateTime");
|
||||
cnd.and(pageForm);
|
||||
//查询是否记录模式来自对会员还是福利会员
|
||||
//cnd.and("mcr.recordMode", "=", MemberChangeRecordMode.MEMBER.getCode());
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitId", "=", unitId);
|
||||
cnd.andEX("u.threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("u.unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("u.personType", "=", userType);
|
||||
cnd.andEX("mcr.changeOrigin", "=", applyOrigin);
|
||||
|
||||
if (Lang.isNotEmpty(changeTypes)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (String type : changeTypes) {
|
||||
seg.or(new Static("JSON_CONTAINS(his.changeTypes, JSON_QUOTE('%s'), '$')".formatted(type)));
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H03,A06")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("u.unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||
seg.or("u.unionGroupId", "is", null);
|
||||
cnd.and(seg);
|
||||
}
|
||||
}
|
||||
|
||||
Pagination pagination = memberService.memberChangeRecords(pageForm, cnd);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
}
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.change;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.sys.services.SysLocalProcessService;
|
||||
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.MemberChangeToDoHandler;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.param.pageForm.MemberChangePageForm;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
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.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.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:MemberChangeSchoolUnionAuditController
|
||||
* @Date 2025/2/14 14:13
|
||||
* @注释
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/member/change/schoolUnion/audit")
|
||||
public class MemberChangeSchoolUnionAuditController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private MemberCommonService memberCommonService;
|
||||
@Inject
|
||||
private SysLocalProcessService localProcessService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/change/schoolUnionAudit/index.html")
|
||||
@RequiresPermissions("member.change.schoolUnion.audit")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("member.change.schoolUnion.audit")
|
||||
public Object pageData(MemberChangePageForm pageForm){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
record.*,
|
||||
state.stateName
|
||||
FROM
|
||||
member_change_record record
|
||||
LEFT JOIN audit_state state ON state.stateId = record.applyStateId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
pageForm.buildSearch(cnd, "record.");
|
||||
if (pageForm.getAudit()) {
|
||||
cnd.and("record.applyStateId", ">", 10050);
|
||||
} else {
|
||||
cnd.and("record.applyStateId", "=", 10050);
|
||||
}
|
||||
cnd.desc("record.applyDateTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = memberCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.change.schoolUnion.audit")
|
||||
@SLog(type = "memberChange", tag = "会员变更", msg = "校工会审核")
|
||||
public Object approval(@Param("audit") Audit audit, String id){
|
||||
audit.setAuditor(ShiroUtil.getUserId());
|
||||
audit.setLoginname(ShiroUtil.getPlatformLoginname());
|
||||
audit.setUsername(ShiroUtil.getPlatformUsername());
|
||||
audit.setAuditTime(DateUtil.date());
|
||||
audit = dao.insert(audit);
|
||||
|
||||
MemberChangeRecord record = dao.fetch(MemberChangeRecord.class, id);
|
||||
if (audit.getAuditType() == 2) {
|
||||
// 退回修改
|
||||
record.setApplyStateId(10060);
|
||||
} else if (audit.getAuditType() == 1) {
|
||||
// 通过
|
||||
record.setApplyStateId(10080);
|
||||
} else {
|
||||
// 拒绝
|
||||
record.setApplyStateId(10070);
|
||||
}
|
||||
|
||||
record.setSchoolUnionAuditId(audit.getId());
|
||||
dao.updateIgnoreNull(record);
|
||||
|
||||
MemberChangeToDoHandler.COMPLETE_SCHOOL_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核完成"));
|
||||
if (audit.getAuditType() == 2) {
|
||||
MemberChangeToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会退回"));
|
||||
} else if (audit.getAuditType() == 1) {
|
||||
MemberChangeToDoHandler.COMPLETE_PROCESS.exec(record, null);
|
||||
memberCommonService.compareChangeInfoAndUpdateMember(record.getId());
|
||||
} else {
|
||||
MemberChangeToDoHandler.REFUSE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核拒绝"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.change.schoolUnion.audit")
|
||||
@SLog(type = "memberChange", tag = "会员变更", msg = "校工会撤回")
|
||||
public Object doRevoke(String id){
|
||||
MemberChangeRecord record = dao.fetch(MemberChangeRecord.class, id);
|
||||
dao.update(MemberChangeRecord.class, Chain.make("applyStateId", 10050)
|
||||
.add("schoolUnionAuditId", null), Cnd.where("id", "=", id));
|
||||
dao.clear(Audit.class, Cnd.where("id", "=", record.getSchoolUnionAuditId()));
|
||||
// 待办撤回
|
||||
localProcessService.revokeTask("MEMBER_CHANGE@" + id, "校工会审核");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.check;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCheckPersonalService;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.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 javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName WelfareCheckPersonalController
|
||||
* @Author zzr
|
||||
* @Date 2023/6/14 14:19
|
||||
*/
|
||||
|
||||
@At("/platform/member/check/personal")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MemberCheckPersonalController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private MemberCheckPersonalService memberCheckPersonalService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/check/personal.html")
|
||||
@RequiresPermissions("member.check.personal")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "taskId", required = false) String taskId,
|
||||
@Param(value = "mobile", required = false) String mobile,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "showFinish", required = false) Integer showFinish,
|
||||
@Param(value = "year", required = false) Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
mcst.id,
|
||||
mcst.taskId,
|
||||
mcst.userId,
|
||||
mcst.isFinish,
|
||||
mct.taskName,
|
||||
su.loginname,
|
||||
su.username,
|
||||
su.sex,
|
||||
su.birthday,
|
||||
su.unionname,
|
||||
su.unitname,
|
||||
su.personType,
|
||||
su.mobile
|
||||
from `member_check_self_task` mcst
|
||||
left join `member_check_task` mct on mct.id=mcst.taskId
|
||||
left join `user` su on su.id = mcst.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.and("su.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.and("mcst.taskId", "=", taskId);
|
||||
cnd.andEX("su.unionid", "=", unionId);
|
||||
cnd.andEX("su.unitid", "=", unitId);
|
||||
cnd.andEX("mct.`year`", "=", year);
|
||||
cnd.and(Cnd.likeEX("su.mobile", mobile));
|
||||
cnd.and(Cnd.likeEX("su." + pageForm.getSearchName(), pageForm.getSearchKeyword().trim()));
|
||||
switch (showFinish) {
|
||||
case -1 -> cnd.and("mcst.isFinish", "=", "0");
|
||||
case 1 -> cnd.and("mcst.isFinish", "=", "1");
|
||||
}
|
||||
cnd.desc("mcst.isFinish");
|
||||
cnd.asc("su.id");
|
||||
sql.setCondition(cnd);
|
||||
return memberCheckPersonalService.list(pageForm, sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取核对情况总人数
|
||||
*
|
||||
* @param unionId
|
||||
* @param unitId
|
||||
* @param taskId
|
||||
* @param year
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getFinishNum(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "mobile", required = false) String mobile,
|
||||
@Param(value = "taskId", required = false) String taskId,
|
||||
@Param(value = "year", required = false) Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
count(mcst.id) allFinish,
|
||||
(sum( CASE WHEN mcst.isFinish = 1 THEN 1 ELSE 0 END )) doFinish,
|
||||
(sum( CASE WHEN mcst.isFinish != 1 THEN 1 ELSE 0 END )) noFinish
|
||||
FROM
|
||||
`member_check_self_task` mcst
|
||||
left join `member_check_task` mct on mct.id=mcst.taskId
|
||||
left join `user` u on u.id = mcst.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.andEX("mcst.taskId", "=", taskId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.and(Cnd.likeEX("u.mobile", mobile));
|
||||
cnd.andEX("mct.`year`", "=", year);
|
||||
cnd.and(Cnd.likeEX("u." + pageForm.getSearchName(), pageForm.getSearchKeyword().trim()));
|
||||
sql.setCondition(cnd);
|
||||
return memberCheckPersonalService.fetch(sql);
|
||||
}
|
||||
|
||||
|
||||
@At("/exportExcel")
|
||||
@Ok("void")
|
||||
public void exportExcel(HttpServletResponse response,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||
@Param(value = "showFinish", required = false) Integer showFinish,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "taskId", required = false) String taskId,
|
||||
@Param(value = "taskName", required = false) String taskName,
|
||||
@Param(value = "mobile", required = false) String mobile) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
mcst.id,
|
||||
mcst.taskId,
|
||||
mcst.userId,
|
||||
mcst.isFinish,
|
||||
mct.taskName,
|
||||
su.loginname,
|
||||
su.username,
|
||||
su.sex,
|
||||
su.birthday,
|
||||
su.unionname,
|
||||
su.unitname,
|
||||
su.personType,
|
||||
su.mobile
|
||||
from `member_check_self_task` mcst
|
||||
left join `member_check_task` mct on mct.id=mcst.taskId
|
||||
left join `user` su on su.id = mcst.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
switch (showFinish) {
|
||||
case -1 -> cnd.and("mcst.isFinish", "=", "0");
|
||||
case 1 -> cnd.and("mcst.isFinish", "=", "1");
|
||||
}
|
||||
cnd.andEX("mct.`year`", "=", year);
|
||||
if (Strings.isNotBlank(unionId)) {
|
||||
cnd.and("su.unionid", "=", unionId);
|
||||
}
|
||||
cnd.andEX("mcst.taskId", "=", taskId);
|
||||
cnd.andEX("su.unitid", "=", unitId);
|
||||
cnd.and(Cnd.likeEX("su.mobile", mobile));
|
||||
cnd.andEX("su.username", "like", searchKeyword).orEX("su.loginname", "like", searchKeyword);
|
||||
cnd.desc("mcst.isFinish");
|
||||
cnd.asc("su.id");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> personalList = memberCheckPersonalService.listMap(sql);
|
||||
personalList.forEach(v -> {
|
||||
v.setv("year", year);
|
||||
v.setv("isfinish", Boolean.parseBoolean(v.getString("isFinish")) ? "已核对" : "未核对");
|
||||
});
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("年度", "year", 20));
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
exportEntities.add(new ExcelExportEntity("联系电话", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("人员类型", "personType", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属工会", "unionname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所在单位", "unitname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("核对情况", "isfinish", 20));
|
||||
|
||||
try {
|
||||
ViTool.excelResponse(response, taskName + "任务个人核对信息名单.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, personalList);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.check;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.SimpleService;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
//import io.v.nutz.zhgh.member.constant.MemberChangeApplyState;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.member.controller.check.MemberCheckUnionController
|
||||
* @Description: 校工会核对
|
||||
* @Author zxc
|
||||
* @Date 2022/10/21:10:31
|
||||
* @Version V1.0
|
||||
**/
|
||||
@At("/platform/member/check/school")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MemberCheckSchoolController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SimpleService simpleService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/check/school.html")
|
||||
@RequiresPermissions("member.check.school")
|
||||
public void union() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.check.school")
|
||||
public Object pageData(PageForm pageForm,
|
||||
String taskId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.id,
|
||||
gh.unioncode,
|
||||
gh.unionname,
|
||||
mcut.isFinish,
|
||||
IF(mcut.isFinish is true,'是','否') as isFinishText,
|
||||
( SELECT COUNT( 1 ) FROM `user` WHERE member = 1 AND unionid=gh.id) memberNum,
|
||||
(SELECT COUNT( 1 ) FROM member_check_union_task WHERE unionid = gh.id and taskId=mcut.taskId ) unionGroupNum,
|
||||
(SELECT COUNT( 1 ) FROM member_check_union_task WHERE isFinish = false AND unionid = gh.id and taskId=mcut.taskId ) fouUnionGroupNum,
|
||||
(SELECT COUNT( 1 ) FROM member_check_union_task WHERE isFinish = true AND unionid = gh.id and taskId=mcut.taskId ) shiUnionGroupNum
|
||||
FROM
|
||||
member_check_union_task mcut
|
||||
LEFT JOIN sys_union gh ON gh.id = mcut.unionId
|
||||
$condition
|
||||
""");
|
||||
// sql.setParam("stateId", MemberChangeApplyState.SCHOOL_UNION);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("gh.id", "=", unionId);
|
||||
cnd.and("mcut.taskId", "=", taskId);
|
||||
cnd.and("gh.id", "is not", null);
|
||||
cnd.groupBy("gh.id");
|
||||
cnd.asc("gh.unioncode");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> map = simpleService.listMap(sql);
|
||||
List<MemberChangeRecord> changeRecords = simpleService.dao().query(MemberChangeRecord.class,
|
||||
Cnd.where("taskId", "=", taskId));
|
||||
return map;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.check.school")
|
||||
public Object getNotCheckUsers(String taskId, String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.member,
|
||||
mcr.id,
|
||||
u.username AS userName,
|
||||
u.loginname AS loginName,
|
||||
u.unitname,
|
||||
u.threeUnitName,
|
||||
it.`name` newUnitName,
|
||||
threeit.`name` newThreeUnitName,
|
||||
mcr.type changeType,
|
||||
mcr.applyTime changeTime,
|
||||
state.stateId,
|
||||
state.stateName,
|
||||
his.id hisId,
|
||||
his.changeType,
|
||||
his.changeTypes
|
||||
FROM
|
||||
member_change_record mcr
|
||||
LEFT JOIN `user` u ON u.id = mcr.userId
|
||||
LEFT JOIN audit_state state ON mcr.stateId = state.stateId
|
||||
LEFT JOIN user_history_latest his ON his.loginname = u.loginname
|
||||
LEFT JOIN sys_unit it ON it.id=mcr.currentUnitId
|
||||
LEFT JOIN sys_unit threeit ON threeit.id=mcr.currentThreeUnitId
|
||||
WHERE
|
||||
mcr.taskId = @taskId
|
||||
AND mcr.originUnionId = @unionId
|
||||
AND mcr.stateId = @stateId
|
||||
""");
|
||||
sql.setParam("taskId", taskId);
|
||||
sql.setParam("unionId", unionId);
|
||||
// sql.setParam("stateId", MemberChangeApplyState.SCHOOL_UNION);
|
||||
List<NutMap> list = simpleService.listMap(sql);
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.check.school")
|
||||
public Object unionGroupData(@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "taskId", required = false) String taskId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
sug.* ,
|
||||
mcut.isFinish,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.mobile
|
||||
FROM
|
||||
member_check_union_task mcut
|
||||
LEFT JOIN sys_union_group sug ON mcut.groupUnionId = sug.id
|
||||
LEFT JOIN sys_user_role sur ON sur.unionGroupId = sug.id
|
||||
AND roleId = @roleId
|
||||
LEFT JOIN sys_user u ON u.id = sur.userId
|
||||
$condition
|
||||
""").setParam("roleId", Roles.ghxzzz);
|
||||
cnd.andEX("mcut.unionid", "=", unionId);
|
||||
cnd.andEX("mcut.taskId", "=", taskId);
|
||||
cnd.asc("mcut.isFinish");
|
||||
cnd.asc("sug.groupCode");
|
||||
sql.setCondition(cnd);
|
||||
return simpleService.listMap(sql);
|
||||
}
|
||||
|
||||
}
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.check;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.SimpleService;
|
||||
import io.v.nutz.sys.models.Sys_union;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
//import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberCheckSelfTask;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberCheckTask;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberCheckUnionTask;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.member.controller.check.MemberCheckTaskController
|
||||
* @Description: TODO
|
||||
* @Author zxc
|
||||
* @Date 2022/10/21:10:33
|
||||
* @Version V1.0
|
||||
**/
|
||||
@At("/platform/member/check/task")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MemberCheckTaskController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SimpleService simpleService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/check/task.html")
|
||||
@RequiresPermissions("member.check.task")
|
||||
public void union() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.check.task")
|
||||
public Object pageData(PageForm pageForm, Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
select * from member_check_task $condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
// cnd.and("taskMode", "=", MemberChangeRecordMode.MEMBER.getCode());
|
||||
cnd.andEX("year", "=", year);
|
||||
sql.setCondition(cnd);
|
||||
return simpleService.list(pageForm, sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.check.task")
|
||||
public Object doAdd(MemberCheckTask task) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(task.getStartTime());
|
||||
List<Sys_union> sysUnions = dao.query(Sys_union.class, null);
|
||||
Trans.exec(() -> {
|
||||
task.setYear(calendar.get(Calendar.YEAR));
|
||||
// task.setTaskMode(MemberChangeRecordMode.MEMBER.getCode());
|
||||
dao.insert(task);
|
||||
if (task.getCreateTaskMode() == 1) {
|
||||
List<MemberCheckUnionTask> unionTasks = sysUnions.stream().map(v -> {
|
||||
MemberCheckUnionTask unionTask = new MemberCheckUnionTask();
|
||||
unionTask.setTaskId(task.getId());
|
||||
unionTask.setUnionId(v.getId());
|
||||
unionTask.setIsFinish(false);
|
||||
return unionTask;
|
||||
}).collect(Collectors.toList());
|
||||
dao.insert(unionTasks);
|
||||
} else {
|
||||
List<Sys_user> sysUsers = dao.query(Sys_user.class, Cnd.where("member", "=", 1));
|
||||
List<MemberCheckSelfTask> selfTasks = sysUsers.stream().map(v -> {
|
||||
MemberCheckSelfTask selfTask = new MemberCheckSelfTask();
|
||||
selfTask.setTaskId(task.getId());
|
||||
selfTask.setUserId(v.getId());
|
||||
selfTask.setIsFinish(false);
|
||||
return selfTask;
|
||||
}).collect(Collectors.toList());
|
||||
dao.insert(selfTasks);
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.check.task")
|
||||
public Object doEdit(MemberCheckTask task) {
|
||||
Trans.exec(() -> {
|
||||
if (task.getCreateTaskMode() == 2) {
|
||||
List<MemberCheckSelfTask> checkSelfTasks = dao.query(MemberCheckSelfTask.class, Cnd.where("taskId", "=", task.getId()));
|
||||
List<String> userIdList = checkSelfTasks.stream().map(MemberCheckSelfTask::getUserId).collect(Collectors.toList());
|
||||
List<Sys_user> sysUsers = dao.query(Sys_user.class, Cnd.where("member", "=", 1).and("id", "not in", userIdList));
|
||||
List<MemberCheckSelfTask> selfTasks = sysUsers.stream().map(v -> {
|
||||
MemberCheckSelfTask selfTask = new MemberCheckSelfTask();
|
||||
selfTask.setTaskId(task.getId());
|
||||
selfTask.setUserId(v.getId());
|
||||
selfTask.setIsFinish(false);
|
||||
return selfTask;
|
||||
}).collect(Collectors.toList());
|
||||
dao.insert(selfTasks);
|
||||
}
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(task.getStartTime());
|
||||
// task.setTaskMode(MemberChangeRecordMode.MEMBER.getCode());
|
||||
task.setYear(calendar.get(Calendar.YEAR));
|
||||
dao.updateIgnoreNull(task);
|
||||
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.check.task")
|
||||
public Object doDelete(@Param("id") String id) {
|
||||
Assert.notBlank(id);
|
||||
Trans.exec(() -> {
|
||||
dao.clear(MemberCheckTask.class, Cnd.where("id", "=", id));
|
||||
dao.clear(MemberCheckUnionTask.class, Cnd.where("taskId", "=", id));
|
||||
dao.clear(MemberChangeRecord.class, Cnd.where("taskId", "=", id));
|
||||
dao.clear(MemberCheckSelfTask.class, Cnd.where("taskId", "=", id));
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getAllTask(@Param(value = "year", required = false) Integer year) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("year", "=", year);
|
||||
cnd.and("createTaskMode", "=", 1);
|
||||
// cnd.and("taskMode", "=", MemberChangeRecordMode.MEMBER.getCode());
|
||||
cnd.desc("year");
|
||||
return dao.query(MemberCheckTask.class, cnd);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getTaskModePersonal(@Param(value = "year", required = false) Integer year) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("year", "=", year);
|
||||
cnd.andEX("createTaskMode", "=", 2);
|
||||
// cnd.and("taskMode", "=", MemberChangeRecordMode.MEMBER.getCode());
|
||||
return dao.query(MemberCheckTask.class, cnd);
|
||||
}
|
||||
|
||||
}
|
||||
+323
@@ -0,0 +1,323 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.check;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import com.google.common.base.Joiner;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.SimpleService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_config;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.data.constant.UserChangeType;
|
||||
//import io.v.nutz.zhgh.member.constant.MemberChangeApplyState;
|
||||
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeOrigin;
|
||||
//import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
||||
//import io.v.nutz.zhgh.staffmanage.member.handle.MemberChangeAuditHandle;
|
||||
//import io.v.nutz.zhgh.staffmanage.member.handle.MemberChangeAuditHandle;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberCheckUnionTask;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.member.controller.check.MemberCheckUnionController
|
||||
* @Description: 院级工会核对
|
||||
* @Author zxc
|
||||
* @Date 2022/10/21:10:31
|
||||
* @Version V1.0
|
||||
**/
|
||||
@At("/platform/member/check/union")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MemberCheckUnionController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SimpleService simpleService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/check/union.html")
|
||||
@RequiresPermissions("member.check.union")
|
||||
public void union() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.check.union")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "taskId", required = false) String taskId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "changed", required = false) Integer changed,
|
||||
@Param(value = "isMember", required = false) Integer isMember,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "preparedBy", required = false) String preparedBy,
|
||||
@Param(value = "userStates", required = false) String[] userStates,
|
||||
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||
@Param(value = "changeTypes", required = false) Integer[] changeTypes,
|
||||
@Param(value = "changeOrigin", required = false) Integer[] changeOrigins
|
||||
) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
u.id,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.birthday,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.preparedBy,
|
||||
u.unionname,
|
||||
u.unitname,
|
||||
u.threeUnitName,
|
||||
u.unionGroupName,
|
||||
u.mobile,
|
||||
u.idcard,
|
||||
u.member,
|
||||
his.id hisId,
|
||||
his.changeType,
|
||||
his.changeTypes,
|
||||
his.changeTime,
|
||||
state.stateId,
|
||||
state.stateName,
|
||||
IF( mcr.userId IS NULL OR mcr.stateId = @success, TRUE, FALSE ) apply,
|
||||
IF( mcr.stateId IN ( $failStates ), TRUE, FALSE ) reApply
|
||||
from
|
||||
`user` u
|
||||
LEFT JOIN user_history_latest his ON his.loginname = u.loginname
|
||||
LEFT JOIN member_change_record_latest mcr on mcr.userId = u.id
|
||||
LEFT JOIN audit_state state ON mcr.stateId = state.stateId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionMemberAdmin,SchoolUnionWelfareAdmin")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("u.unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||
seg.or("u.unionGroupId", "is", null);
|
||||
cnd.and(seg);
|
||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
|
||||
}
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("u.threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("u.preparedBy", "=", preparedBy);
|
||||
cnd.and(Cnd.likeEX("u." + pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
|
||||
cnd.andEX("u.member", "=", isMember);
|
||||
if (changed != null) {
|
||||
if (changed == 1) {
|
||||
cnd.and(new Static("his.changeTypes is not null"));
|
||||
} else {
|
||||
cnd.and(new Static("his.changeTypes is null"));
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), "ascending".equals(pageForm.getPageOrderBy()) ? "asc" : "desc");
|
||||
} else {
|
||||
cnd.desc("changeTime");
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(changeTypes)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (Integer type : changeTypes) {
|
||||
seg.or(new Static("JSON_CONTAINS(his.changeTypes, CAST(%d AS JSON), '$')".formatted(type)));
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(userStates)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (String state : userStates) {
|
||||
seg.orEquals("u.userState", state);
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(personTypes)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (String personType : personTypes) {
|
||||
seg.orEquals("u.personType", personType);
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(changeOrigins)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (Integer c : changeOrigins) {
|
||||
seg.orEquals("u.changeOrigin", c);
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
|
||||
sql.setCondition(cnd);
|
||||
// sql.setParam("success", MemberChangeApplyState.SUCCESS);
|
||||
// sql.setVar("failStates", Joiner.on(",").join(List.of(MemberChangeApplyState.UNION_FAIL, MemberChangeApplyState.SCHOOL_UNION_FAIL)));
|
||||
return simpleService.list(pageForm, sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.check.union")
|
||||
public Object getButtonNum(
|
||||
@Param(value = "isMember", required = false) Integer isMember,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "userStates", required = false) String[] userStates,
|
||||
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||
@Param(value = "changeTypes", required = false) Integer[] changeTypes,
|
||||
@Param(value = "changeOrigin", required = false) Integer[] changeOrigins
|
||||
) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
(sum( CASE WHEN his.changeType IS NOT NULL THEN 1 ELSE 0 END )) as 'changeNum',
|
||||
(sum( CASE WHEN his.changeType IS NULL THEN 1 ELSE 0 END )) as 'notChangeNum',
|
||||
count(u.id) as 'userSumNum',
|
||||
(sum( CASE WHEN u.member = 1 THEN 1 ELSE 0 END )) as 'memberNum',
|
||||
(sum( CASE WHEN u.member IS NULL OR u.member = 0 THEN 1 ELSE 0 END )) as 'notMemberNum'
|
||||
from
|
||||
`user` u
|
||||
LEFT JOIN user_history_latest his ON his.loginname = u.loginname
|
||||
LEFT JOIN member_change_record_latest mcr on mcr.userId = u.id
|
||||
LEFT JOIN audit_state state ON mcr.stateId = state.stateId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionMemberAdmin,SchoolUnionWelfareAdmin")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("u.unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||
seg.or("u.unionGroupId", "is", null);
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.andEX("u.unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("u.threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.member", "=", isMember);
|
||||
|
||||
if (Lang.isNotEmpty(changeTypes)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (Integer type : changeTypes) {
|
||||
seg.or(new Static("JSON_CONTAINS(his.changeTypes, CAST(%d AS JSON), '$')".formatted(type)));
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(userStates)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (String state : userStates) {
|
||||
seg.orEquals("u.userState", state);
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(personTypes)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (String personType : personTypes) {
|
||||
seg.orEquals("u.personType", personType);
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(changeOrigins)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (Integer c : changeOrigins) {
|
||||
seg.orEquals("u.changeOrigin", c);
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
// sql.setParam("success", MemberChangeApplyState.SUCCESS);
|
||||
// sql.setVar("failStates", Joiner.on(",").join(List.of(MemberChangeApplyState.UNION_FAIL, MemberChangeApplyState.SCHOOL_UNION_FAIL)));
|
||||
return simpleService.fetch(sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.check.union")
|
||||
public Object submitCheck(String taskId, @Param(value = "unionid", required = false) String unionid) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionMemberAdmin,SchoolUnionWelfareAdmin")) {
|
||||
cnd.andEX("unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.andEX("unionid", "=", unionid);
|
||||
cnd.and("taskId", "=", taskId);
|
||||
dao.update(MemberCheckUnionTask.class, Chain.make("isFinish", true), cnd);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.check.union")
|
||||
public Object doSubmitChangeUser(MemberChangeRecord memberChangeRecord) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.check.union")
|
||||
public Object getUnionTaskStatus(String taskId, @Param(value = "unionId", required = false) String unionId, @Param(value = "unionGroupId", required = false) String unionGroupId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionMemberAdmin,SchoolUnionWelfareAdmin")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.andEX("unionId", "=", unionId);
|
||||
cnd.and("taskId", "=", taskId);
|
||||
MemberCheckUnionTask unionTask = dao.fetch(MemberCheckUnionTask.class, cnd);
|
||||
return unionTask != null && unionTask.getIsFinish();
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.check.union")
|
||||
public Object checkAgain(String taskId, @Param(value = "unionId", required = false) String unionId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionMemberAdmin,SchoolUnionWelfareAdmin")) {
|
||||
cnd.and("unionId", "in", Vi.getUnionId());
|
||||
}
|
||||
cnd.andEX("unionId", "=", unionId);
|
||||
cnd.and("taskId", "=", taskId);
|
||||
dao.update(MemberCheckUnionTask.class, Chain.make("isFinish", false), cnd);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+248
@@ -0,0 +1,248 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.info;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.AsyncService;
|
||||
import io.v.nutz.base.service.AuditService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.data.constant.UserChangeType;
|
||||
import io.v.nutz.zhgh.staffmanage.member.MemberMode;
|
||||
import io.v.nutz.zhgh.staffmanage.member.UserMode;
|
||||
//import io.v.nutz.zhgh.member.constant.MemberChangeApplyState;
|
||||
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeOrigin;
|
||||
//import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
||||
//import io.v.nutz.zhgh.member.constant.MemberOrigin;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
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 javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 批量设置会员
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/28
|
||||
* @since 1.0
|
||||
*/
|
||||
@At("/platform/member/info/batchMake")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MemberBatchMakeController {
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/info/BatchMake.html")
|
||||
@RequiresPermissions("member.info.batchMake")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private MemberCommonService memberService;
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Inject
|
||||
private AuditService auditService;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.info.batchMake")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false)String unitId,
|
||||
@Param(value = "unionGroupId", required = false)String unionGroupId,
|
||||
@Param(value = "threeUnitId", required = false)String threeUnitId,
|
||||
@Param(value = "personType", required = false)String personType,
|
||||
@Param(value = "userState", required = false)String userState,
|
||||
@Param(value = "memberStatus", required = false)Integer memberStatus,
|
||||
@Param(value = "campus", required = false)String campus) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname,
|
||||
username,
|
||||
sex,
|
||||
member,
|
||||
personType,
|
||||
userState,
|
||||
unioncode,
|
||||
unionname,
|
||||
unionid,
|
||||
unitname,
|
||||
unitcode,
|
||||
unitid,
|
||||
threeUnitName,
|
||||
threeUnitCode,
|
||||
unionGroupName,
|
||||
mobile,
|
||||
campusName
|
||||
from
|
||||
`user`
|
||||
$condition
|
||||
""");
|
||||
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and(Cnd.exps("member", "=", MemberMode.NONE.getCode()).or("member", "is", null));
|
||||
|
||||
cnd.andEX("unionid", "=", unionId);
|
||||
cnd.andEX("unitId", "=", unitId);
|
||||
cnd.andEX("threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("personType", "=", personType);
|
||||
cnd.andEX("userState", "=", userState);
|
||||
cnd.andEX("campusName", "=", campus);
|
||||
cnd.andEX("memberStatus", "=", memberStatus);
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H03,A06")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||
seg.or("unionGroupId", "is", null);
|
||||
cnd.and(seg);
|
||||
}
|
||||
}
|
||||
|
||||
cnd.and(pageForm);
|
||||
cnd.asc("unionid");
|
||||
cnd.desc("username");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return memberService.list(pageForm, sql);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private AsyncService asyncService;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.info.batchMake")
|
||||
public Object joinMemberFamily(String[] userIds) {
|
||||
Trans.exec(() -> {
|
||||
UserMode.addMemberRole(userIds);
|
||||
for (String v : userIds) {
|
||||
// MemberChangeRecord record = new MemberChangeRecord();
|
||||
//// record.setRecordMode(MemberChangeRecordMode.MEMBER.getCode());
|
||||
// record.setType(UserChangeType.RESTORE.getCode());
|
||||
// record.setUserId(v);
|
||||
// record.setApplyTime(new Date());
|
||||
//// record.setApplyOrigin(MemberChangeOrigin.SCHOOL.getCode());/////////
|
||||
//// record.setRecordMode(MemberChangeRecordMode.MEMBER.getCode());
|
||||
//// record.setStateId(MemberChangeApplyState.SUCCESS);
|
||||
//
|
||||
// Audit audit = new Audit();
|
||||
// audit.setAuditPass(true);
|
||||
//// audit.setAuditOpinion(MemberOrigin.BATCH.getDescription());
|
||||
// String id = auditService.insert(audit).getId();
|
||||
//
|
||||
// record.setSchoolAuditId(id);
|
||||
// sysUserService.insert(record);
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void exportNotMember(String searchName, String searchKeyword, String unionId, String unitId, String unionGroupId,
|
||||
String threeUnitId, String personType,String userState,HttpServletResponse response){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname,
|
||||
username,
|
||||
sex,
|
||||
member,
|
||||
personType,
|
||||
userState,
|
||||
unioncode,
|
||||
unionname,
|
||||
unionid,
|
||||
unitname,
|
||||
unitcode,
|
||||
unitid,
|
||||
threeUnitName,
|
||||
threeUnitCode,
|
||||
unionGroupName,
|
||||
mobile,
|
||||
campusName
|
||||
from
|
||||
`user`
|
||||
$condition
|
||||
""");
|
||||
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and(Cnd.exps("member", "=", MemberMode.NONE.getCode()).or("member", "is", null));
|
||||
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
cnd.and(searchName, "like", "%" + searchKeyword + "%");
|
||||
}
|
||||
cnd.andEX("unionid", "=", unionId);
|
||||
cnd.andEX("unitId", "=", unitId);
|
||||
cnd.andEX("threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("personType", "=", personType);
|
||||
cnd.andEX("userState", "=", userState);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H03,A06")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||
seg.or("unionGroupId", "is", null);
|
||||
cnd.and(seg);
|
||||
}
|
||||
}
|
||||
cnd.asc("unionid");
|
||||
cnd.desc("username");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> notMemberList = memberService.listMap(sql);
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
entityList.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
entityList.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
entityList.add(new ExcelExportEntity("联系电话", "mobile", 20));
|
||||
entityList.add(new ExcelExportEntity("人员类型", "personType", 20));
|
||||
entityList.add(new ExcelExportEntity("在职状态", "userState", 20));
|
||||
entityList.add(new ExcelExportEntity("所属工会", "unionname", 50));
|
||||
entityList.add(new ExcelExportEntity("所属单位", "unitname", 50));
|
||||
entityList.add(new ExcelExportEntity("所属校区", "campusName", 20));
|
||||
try {
|
||||
ViTool.excelResponse(response, "非会员名单.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, notMemberList);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
+410
@@ -0,0 +1,410 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.info;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.data.constant.UserChangeType;
|
||||
import io.v.nutz.zhgh.staffmanage.member.MemberMode;
|
||||
import io.v.nutz.zhgh.staffmanage.member.UserMode;
|
||||
import io.v.nutz.zhgh.staffmanage.member.WelfareMemberMode;
|
||||
//import io.v.nutz.zhgh.member.constant.MemberChangeApplyState;
|
||||
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeOrigin;
|
||||
//import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
||||
//import io.v.nutz.zhgh.member.constant.MemberOrigin;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
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.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@At("/platform/member/dataManage")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MemberDataManageController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/info/dataManage.html")
|
||||
@RequiresPermissions("member.info.dataManage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private MemberCommonService memberService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.info.dataManage")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
@Param(value = "campus", required = false) String campus,
|
||||
@Param(value = "startLoginNames", required = false) String startLoginNames,
|
||||
@Param(value = "endLoginNames", required = false) String endLoginNames,
|
||||
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||
@Param(value = "userStates", required = false) String[] userStates,
|
||||
@Param(value = "preparedBys", required = false) String[] preparedBys
|
||||
) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname,
|
||||
username,
|
||||
sex,
|
||||
member,
|
||||
welfareMember,
|
||||
personType,
|
||||
userState,
|
||||
preparedBy,
|
||||
unioncode,
|
||||
unionname,
|
||||
unionid,
|
||||
unitname,
|
||||
unitcode,
|
||||
unitid,
|
||||
threeUnitName,
|
||||
threeUnitCode,
|
||||
unionGroupName,
|
||||
mobile,
|
||||
campusName,
|
||||
birthday
|
||||
from
|
||||
`user`
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("username", pageForm.getSearchKeyword());
|
||||
seg.orLike("loginname", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
} else {
|
||||
cnd.desc("member");
|
||||
}
|
||||
|
||||
cnd.andEX("unionid", "=", unionId);
|
||||
cnd.andEX("unitid", "=", unitId);
|
||||
cnd.andEX("threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("personType", "=", personType);
|
||||
cnd.andEX("userState", "=", userState);
|
||||
cnd.andEX("campusName", "=", campus);
|
||||
cnd.andEX("personType", "in", personTypes);
|
||||
cnd.andEX("userState", "in", userStates);
|
||||
cnd.andEX("preparedBy", "in", preparedBys);
|
||||
|
||||
if (StrUtil.isNotBlank(startLoginNames)) {
|
||||
String[] loginNames = startLoginNames.split(",");
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (String loginName : loginNames) {
|
||||
seg.orLikeL("loginname", loginName);
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(endLoginNames)) {
|
||||
String[] loginNames = endLoginNames.split(",");
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (String loginName : loginNames) {
|
||||
seg.orLikeR("loginname", loginName);
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,H03")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("unionid", "=", Vi.getUnionId());
|
||||
} else {
|
||||
cnd.and("unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||
}
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return memberService.list(pageForm, sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.info.dataManage")
|
||||
public Object setBirthdayByIdCard() {
|
||||
Sql sql = Sqls.create("""
|
||||
UPDATE sys_user
|
||||
SET birthday = STR_TO_DATE(SUBSTRING(idcard, 7, 8), '%Y%m%d')
|
||||
WHERE (birthday IS NULL OR birthday = '') AND length(idcard)=18
|
||||
""");
|
||||
memberService.execute(sql);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置会员
|
||||
*
|
||||
* @param pageForm 页面形式
|
||||
* @param unionId 工会id
|
||||
* @param unitId 单位id
|
||||
* @param threeUnitId 三个单元id
|
||||
* @param unionGroupId 工会小组id
|
||||
* @param personType 人类型
|
||||
* @param userState 用户状态
|
||||
* @param campus 校园
|
||||
* @param startLoginNames 开始登录名称
|
||||
* @param endLoginNames 端登录名称
|
||||
* @param personTypes 人类型
|
||||
* @param userStates 用户状态
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.info.dataManage")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object setMemberByCnd(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
@Param(value = "campus", required = false) String campus,
|
||||
@Param(value = "startLoginNames", required = false) String startLoginNames,
|
||||
@Param(value = "endLoginNames", required = false) String endLoginNames,
|
||||
@Param(value = "confirm", required = false) Boolean confirm,
|
||||
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||
@Param(value = "userStates", required = false) String[] userStates) {
|
||||
|
||||
//如果是先清空再追加
|
||||
if (confirm) {
|
||||
// dao.update(Sys_user.class, Chain.make("member", MemberMode.NONE.getCode()).add("memberOrigin", MemberOrigin.BATCH.getCode()), Cnd.NEW());
|
||||
}
|
||||
|
||||
Sql sql = Sqls.create("SELECT id from `user` $condition");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("username", pageForm.getSearchKeyword());
|
||||
seg.orLike("loginname", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
cnd.andEX("unionid", "=", unionId);
|
||||
cnd.andEX("unitid", "=", unitId);
|
||||
cnd.andEX("threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("personType", "=", personType);
|
||||
cnd.andEX("userState", "=", userState);
|
||||
cnd.andEX("campusName", "=", campus);
|
||||
cnd.andEX("personType", "in", personTypes);
|
||||
cnd.andEX("userState", "in", userStates);
|
||||
|
||||
if (StrUtil.isNotBlank(startLoginNames)) {
|
||||
String[] loginNames = startLoginNames.split(",");
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (String loginName : loginNames) {
|
||||
seg.orLikeL("loginname", loginName);
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(endLoginNames)) {
|
||||
String[] loginNames = endLoginNames.split(",");
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (String loginName : loginNames) {
|
||||
seg.orLikeR("loginname", loginName);
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,H03")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("unionid", "=", Vi.getUnionId());
|
||||
} else {
|
||||
cnd.and("unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||
}
|
||||
}
|
||||
|
||||
cnd.and(Cnd.exps("member", "=", MemberMode.NONE.getCode()).or("member", "is", null));
|
||||
|
||||
sql.setCondition(cnd);
|
||||
String[] userIds = (String[]) Daos.query(dao, sql.toString(), Sqls.callback.strs());
|
||||
|
||||
|
||||
//批量设置会员
|
||||
UserMode.addMemberRole(userIds);
|
||||
Audit audit = new Audit();
|
||||
audit.setAuditPass(true);
|
||||
// audit.setAuditOpinion("数据管理工具" + MemberOrigin.BATCH.getDescription());
|
||||
dao.insert(audit);
|
||||
List<MemberChangeRecord> insertMemberChangeRecords = Arrays.stream(userIds).map(v -> {
|
||||
MemberChangeRecord record = new MemberChangeRecord();
|
||||
//// record.setRecordMode(MemberChangeRecordMode.MEMBER.getCode());
|
||||
// record.setType(UserChangeType.RESTORE.getCode());
|
||||
// record.setUserId(v);
|
||||
// record.setApplyTime(new Date());
|
||||
//// record.setApplyOrigin(MemberChangeOrigin.SCHOOL.getCode());
|
||||
//// record.setRecordMode(MemberChangeRecordMode.MEMBER.getCode());
|
||||
//// record.setStateId(MemberChangeApplyState.SUCCESS);
|
||||
// record.setSchoolAuditId(audit.getId());
|
||||
return record;
|
||||
}).collect(Collectors.toList());
|
||||
dao.insert(insertMemberChangeRecords);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置福利会员
|
||||
*
|
||||
* @param pageForm 页面形式
|
||||
* @param unionId 工会id
|
||||
* @param unitId 单位id
|
||||
* @param threeUnitId 三个单元id
|
||||
* @param unionGroupId 工会小组id
|
||||
* @param personType 人类型
|
||||
* @param userState 用户状态
|
||||
* @param campus 校园
|
||||
* @param startLoginNames 开始登录名称
|
||||
* @param endLoginNames 端登录名称
|
||||
* @param personTypes 人类型
|
||||
* @param userStates 用户状态
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.info.dataManage")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object setWelfareMemberByCnd(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
@Param(value = "campus", required = false) String campus,
|
||||
@Param(value = "startLoginNames", required = false) String startLoginNames,
|
||||
@Param(value = "endLoginNames", required = false) String endLoginNames,
|
||||
@Param(value = "confirm", required = false) Boolean confirm,
|
||||
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||
@Param(value = "preparedBys", required = false) String[] preparedBys,
|
||||
@Param(value = "userStates", required = false) String[] userStates) {
|
||||
|
||||
|
||||
//如果是先清空再追加
|
||||
if (confirm) {
|
||||
dao.update(Sys_user.class, Chain.make("welfareMember", WelfareMemberMode.NONE.getCode()), Cnd.NEW());
|
||||
}
|
||||
|
||||
|
||||
Sql sql = Sqls.create("SELECT id from `user` $condition");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("username", pageForm.getSearchKeyword());
|
||||
seg.orLike("loginname", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
cnd.andEX("unionid", "=", unionId);
|
||||
cnd.andEX("unitid", "=", unitId);
|
||||
cnd.andEX("threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("personType", "=", personType);
|
||||
cnd.andEX("userState", "=", userState);
|
||||
cnd.andEX("campusName", "=", campus);
|
||||
cnd.andEX("personType", "in", personTypes);
|
||||
cnd.andEX("userState", "in", userStates);
|
||||
cnd.andEX("preparedBy", "in", preparedBys);
|
||||
|
||||
if (StrUtil.isNotBlank(startLoginNames)) {
|
||||
String[] loginNames = startLoginNames.split(",");
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (String loginName : loginNames) {
|
||||
seg.orLikeL("loginname", loginName);
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(endLoginNames)) {
|
||||
String[] loginNames = endLoginNames.split(",");
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (String loginName : loginNames) {
|
||||
seg.orLikeR("loginname", loginName);
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,H03")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("unionid", "=", Vi.getUnionId());
|
||||
} else {
|
||||
cnd.and("unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||
}
|
||||
}
|
||||
|
||||
cnd.and("welfareMember", "=", MemberMode.NONE.getCode());
|
||||
|
||||
sql.setCondition(cnd);
|
||||
String[] userIds = (String[]) Daos.query(dao, sql.toString(), Sqls.callback.strs());
|
||||
|
||||
//批量设置会员
|
||||
Cnd cndUpdate = Cnd.NEW();
|
||||
cndUpdate.and("id", "in", userIds);
|
||||
cndUpdate.and(Cnd.exps("welfareMember", "is not", null).or("welfareMember", "!=", 1));
|
||||
dao.update(Sys_user.class, Chain.make("welfareMember", WelfareMemberMode.NORMAL.getCode())
|
||||
.add("welfareMemberJoinTime", new Date()), cndUpdate);
|
||||
|
||||
Audit audit = new Audit();
|
||||
audit.setAuditPass(true);
|
||||
// audit.setAuditOpinion("数据管理工具" + MemberOrigin.BATCH.getDescription());
|
||||
dao.insert(audit);
|
||||
List<MemberChangeRecord> insertMemberChangeRecords = Arrays.stream(userIds).map(v -> {
|
||||
MemberChangeRecord record = new MemberChangeRecord();
|
||||
//// record.setRecordMode(MemberChangeRecordMode.MEMBER.getCode());
|
||||
// record.setType(UserChangeType.RESTORE.getCode());
|
||||
// record.setUserId(v);
|
||||
// record.setApplyTime(new Date());
|
||||
//// record.setApplyOrigin(MemberChangeOrigin.SCHOOL.getCode());
|
||||
//// record.setRecordMode(MemberChangeRecordMode.MEMBER.getCode());
|
||||
//// record.setStateId(MemberChangeApplyState.SUCCESS);
|
||||
// record.setSchoolAuditId(audit.getId());
|
||||
return record;
|
||||
}).collect(Collectors.toList());
|
||||
dao.insert(insertMemberChangeRecords);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+270
@@ -0,0 +1,270 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.info;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.result.Result;
|
||||
import io.v.nutz.base.service.AsyncService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.sys.services.SysRoleService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.member.MemberMode;
|
||||
import io.v.nutz.zhgh.staffmanage.member.UserMode;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberHistory;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberHistoryService;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.random.R;
|
||||
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 javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 会员档案管理
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/28
|
||||
* @since 1.0
|
||||
*/
|
||||
@At("/platform/member/group/info")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MemberGroupInfoController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/info/GroupInfo.html")
|
||||
@RequiresPermissions("member.group.person")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private MemberCommonService memberService;
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Inject
|
||||
private MemberHistoryService memberHistoryService;
|
||||
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@Inject
|
||||
private AsyncService asyncService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
private Sql dataSql(PageForm pageForm,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String threeUnitId,
|
||||
String unionGroupId,
|
||||
String[] personTypes,
|
||||
String[] userStates,
|
||||
String campus,
|
||||
String sex,
|
||||
Integer memberStatus,
|
||||
String position,
|
||||
String jobTitle,
|
||||
String memberSearchName,
|
||||
String memberSearchKeyWord) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname,
|
||||
username,
|
||||
sex,
|
||||
birthday,
|
||||
mobile,
|
||||
idcard,
|
||||
personType,
|
||||
userState,
|
||||
unionid,
|
||||
unioncode,
|
||||
unionname,
|
||||
unitid,
|
||||
unitname,
|
||||
unitcode,
|
||||
threeUnitName,
|
||||
threeUnitCode,
|
||||
unionGroupName,
|
||||
position,
|
||||
jobTitle,
|
||||
campusName,
|
||||
marriage,
|
||||
education,
|
||||
hometown,
|
||||
nation
|
||||
from
|
||||
user
|
||||
$condition
|
||||
""");
|
||||
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
cnd.andEX("unionid", "=", unionId);
|
||||
cnd.andEX("unitId", "=", unitId);
|
||||
cnd.andEX("threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("unionGroupId", "=", unionGroupId);
|
||||
|
||||
if (StrUtil.isNotBlank(memberSearchName)) {
|
||||
cnd.and(new SqlExpressionGroup().andLike(memberSearchName, memberSearchKeyWord));
|
||||
}
|
||||
|
||||
if (personTypes != null && personTypes.length > 0) {
|
||||
cnd.andEX("personType", "in", personTypes);
|
||||
}
|
||||
if (userStates != null && userStates.length > 0) {
|
||||
cnd.andEX("userState", "in", userStates);
|
||||
}
|
||||
cnd.andEX("campusName", "=", campus);
|
||||
cnd.andEX("sex", "=", sex);
|
||||
|
||||
cnd.andEX("member", "=", 1);
|
||||
cnd.andEX("memberStatus", "=", memberStatus);
|
||||
|
||||
if (Strings.isNotBlank(position)) {
|
||||
cnd.where().andLike("position", position);
|
||||
}
|
||||
if (Strings.isNotBlank(jobTitle)) {
|
||||
cnd.where().andLike("jobTitle", jobTitle);
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H03,A06")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||
seg.or("unionGroupId", "is", null);
|
||||
cnd.and(seg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cnd.and(pageForm);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return sql;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("member.group.person")
|
||||
public Integer getMemberHistoryNum(Integer year) {
|
||||
return memberHistoryService.count(Cnd.where("year", "=", year));
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("member.group.person")
|
||||
public Object archive(Integer year) {
|
||||
try {
|
||||
|
||||
List<MemberHistory> members = memberHistoryService.listEntity(Sqls.create("SELECT * from sys_user where member = @memberType").setParam("memberType", MemberMode.NORMAL.getCode()));
|
||||
Integer memberHistoryNum = getMemberHistoryNum(year);
|
||||
if (memberHistoryNum > 0) {
|
||||
memberHistoryService.clear(Cnd.where("year", "=", year));
|
||||
}
|
||||
asyncService.exe2(members, (member) -> {
|
||||
member.setUserId(member.getId());
|
||||
member.setId(R.UU32());
|
||||
member.setYear(year);
|
||||
memberHistoryService.insert(member);
|
||||
});
|
||||
|
||||
return Result.success("备份成功");
|
||||
} catch (Exception e) {
|
||||
return Result.error("备份失败");
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.group.person")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||
@Param(value = "userStates", required = false) String[] userStates,
|
||||
@Param(value = "campus", required = false) String campus,
|
||||
@Param(value = "sex", required = false) String sex,
|
||||
@Param(value = "memberStatus", required = false) Integer memberStatus,
|
||||
@Param(value = "position", required = false) String position,
|
||||
@Param(value = "jobTitle", required = false) String jobTitle,
|
||||
@Param(value = "memberSearchName", required = false) String memberSearchName,
|
||||
@Param(value = "memberSearchKeyWord", required = false) String memberSearchKeyWord) {
|
||||
return memberService.list(pageForm, dataSql(pageForm, unionId, unitId, threeUnitId, unionGroupId, personTypes, userStates, campus, sex, memberStatus, position, jobTitle, memberSearchName, memberSearchKeyWord));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.group.person")
|
||||
public Object delete(String userId) {
|
||||
UserMode.removeMemberRole(userId);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("member.group.person")
|
||||
public void export(HttpServletResponse response,
|
||||
String props,
|
||||
PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personTypes", required = false) String personTypes,
|
||||
@Param(value = "userStates", required = false) String userStates,
|
||||
@Param(value = "campus", required = false) String campus,
|
||||
@Param(value = "sex", required = false) String sex,
|
||||
@Param(value = "memberStatus", required = false) Integer memberStatus,
|
||||
@Param(value = "position", required = false) String position,
|
||||
@Param(value = "jobTitle", required = false) String jobTitle,
|
||||
@Param(value = "memberSearchName", required = false) String memberSearchName,
|
||||
@Param(value = "memberSearchKeyWord", required = false) String memberSearchKeyWord) {
|
||||
try {
|
||||
ViTool.excelResponse(response, "会员名单.xls");
|
||||
List<NutMap> dataList = memberService.listMap(dataSql(pageForm, unionId, unitId, threeUnitId, unionGroupId, Json.fromJsonAsArray(String.class, personTypes), Json.fromJsonAsArray(String.class, userStates), campus, sex, memberStatus, position, jobTitle, memberSearchName, memberSearchKeyWord));
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
ExcelExportEntity no = new ExcelExportEntity("序号", "no", 10);
|
||||
no.setFormat("isAddIndex");
|
||||
entityList.add(no);
|
||||
|
||||
Map<String, String> propMap = Json.fromJson(Map.class, props);
|
||||
propMap.forEach((k, v) -> {
|
||||
entityList.add(new ExcelExportEntity(v, k, 20));
|
||||
});
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, dataList);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.info;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.data.constant.UserChangeType;
|
||||
import io.v.nutz.zhgh.data.model.UserHistory;
|
||||
import io.v.nutz.zhgh.data.service.HistoryUserService;
|
||||
import io.v.nutz.zhgh.staffmanage.member.UserMode;
|
||||
//import io.v.nutz.zhgh.member.constant.*;
|
||||
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeOrigin;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员补录
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/28
|
||||
* @since 1.0
|
||||
*/
|
||||
@At("/platform/member/info/make")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MemberMakeController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/info/Make.html")
|
||||
@RequiresPermissions("member.info.make")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private MemberCommonService memberService;
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Inject
|
||||
private HistoryUserService historyUserService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.info.make")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
@Param(value = "memberStatus", required = false) Integer memberStatus,
|
||||
@Param(value = "campus", required = false) String campus) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname,
|
||||
username,
|
||||
sex,
|
||||
member,
|
||||
personType,
|
||||
userState,
|
||||
unioncode,
|
||||
unionname,
|
||||
unionid,
|
||||
unitname,
|
||||
unitcode,
|
||||
unitid,
|
||||
threeUnitName,
|
||||
threeUnitCode,
|
||||
unionGroupName,
|
||||
mobile,
|
||||
campusName
|
||||
from
|
||||
`user`
|
||||
$condition
|
||||
""");
|
||||
|
||||
CndPlus cnd = CndPlus.create();
|
||||
// cnd.and("memberOrigin", "=", MemberOrigin.MAKE.getCode());
|
||||
|
||||
cnd.andEX("unionid", "=", unionId);
|
||||
cnd.andEX("unitid", "=", unitId);
|
||||
cnd.andEX("threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("personType", "=", personType);
|
||||
cnd.andEX("userState", "=", userState);
|
||||
cnd.andEX("campusName", "=", campus);
|
||||
|
||||
List<Integer> status = new ArrayList<>();
|
||||
// status.add(MemberStatus.NORMAL.getCode());
|
||||
// status.add(MemberStatus.TURN_IN.getCode());
|
||||
// status.add(MemberStatus.RESTORE.getCode());
|
||||
|
||||
if (memberStatus == null || status.contains(memberStatus)) {
|
||||
cnd.andEX("member", "=", 1);
|
||||
}
|
||||
|
||||
if (memberStatus == null) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.and("memberStatus", "in", status);
|
||||
group.or("memberStatus", "IS", null);
|
||||
cnd.and(group);
|
||||
} else {
|
||||
cnd.andEX("memberStatus", "=", memberStatus);
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,H03")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("unionid", "=", Vi.getUnionId());
|
||||
} else {
|
||||
cnd.and("unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||
}
|
||||
}
|
||||
|
||||
cnd.and(pageForm);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return memberService.list(pageForm, sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.info.make")
|
||||
public Object joinMemberFamily(Sys_user sys_user) {
|
||||
memberService.transactional(() -> {
|
||||
// sysUserService.update(Chain.make("memberOrigin", MemberOrigin.MAKE.getCode()), Cnd.where("id", "=", sys_user.getId()));
|
||||
UserMode.addMemberRole(sys_user.getId());
|
||||
|
||||
|
||||
//添加到用户历史表
|
||||
Sys_user new_user = sysUserService.fetch(sys_user.getId());
|
||||
UserHistory userHistory = new UserHistory();
|
||||
BeanUtils.copyProperties(new_user, userHistory);
|
||||
userHistory.setChangeTime(new Date());
|
||||
// userHistory.setChangeType(UserChangeType.NEW.getCode());
|
||||
historyUserService.insert(userHistory);
|
||||
|
||||
//添加到会员变更表
|
||||
MemberChangeRecord record = new MemberChangeRecord();
|
||||
// record.setRecordMode(MemberChangeRecordMode.MEMBER.getCode());
|
||||
// record.setType(UserChangeType.NEW.getCode());
|
||||
// record.setUserId(new_user.getId());
|
||||
// record.setCurrentUnitId(sys_user.getUnitid());
|
||||
// record.setCurrentUnionId(sys_user.getUnionid());
|
||||
// record.setApplyTime(new Date());
|
||||
if (ShiroUtil.hasAnyRoles("sysadmin,A06,H03")) {
|
||||
// record.setApplyOrigin(MemberChangeOrigin.SCHOOL.getCode());
|
||||
} else if (ShiroUtil.hasAnyRoles("H04")) {
|
||||
// record.setApplyOrigin(MemberChangeOrigin.UNION.getCode());
|
||||
} else {
|
||||
// record.setApplyOrigin(MemberChangeOrigin.UNION_GROUP.getCode());
|
||||
}
|
||||
// record.setRecordMode(MemberChangeRecordMode.MEMBER.getCode());
|
||||
// record.setStateId(MemberChangeApplyState.SUCCESS);
|
||||
|
||||
historyUserService.insert(record);
|
||||
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.info.make")
|
||||
public Object delete(String userId) {
|
||||
UserMode.removeMemberRole(userId);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.info;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* 个人信息维护
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/28
|
||||
* @since 1.0
|
||||
*/
|
||||
@At("/platform/member/person/info")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MemberPersonInfoController {
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/info/PersonInfo.html")
|
||||
@RequiresPermissions("member.info.person")
|
||||
public void index() {
|
||||
}
|
||||
}
|
||||
+363
@@ -0,0 +1,363 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.inquire;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
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.Lang;
|
||||
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 javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@At("/platform/member/inquire/analysis")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MemberAnalysisController {
|
||||
|
||||
@Inject
|
||||
private MemberCommonService memberService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/inquire/Analysis.html")
|
||||
@RequiresPermissions("member.inquire.analysis")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.inquire.analysis")
|
||||
public Object pageData(@Param(value = "unionId", required = false) String unionId,
|
||||
Integer currentYear) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.id,
|
||||
gh.unioncode as unionCode,
|
||||
gh.unionname as unionName,
|
||||
( SELECT count( 1 ) FROM member_his WHERE `year` = @lastYear AND unionid = gh.id ) AS '往年会员人数',
|
||||
( SELECT count( 1 ) FROM member_change_record WHERE currentUnionId = gh.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动变动到我工会人数',
|
||||
( SELECT count( 1 ) FROM member_change_record WHERE originUnionId = gh.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动我工会减少人数',
|
||||
(
|
||||
SELECT
|
||||
count( 1 )
|
||||
FROM
|
||||
member_change_record mcr
|
||||
LEFT JOIN `user` u ON u.id = mcr.userId
|
||||
WHERE
|
||||
mcr.`type` IN ( 2, 7 )
|
||||
AND u.unionid = gh.id
|
||||
AND YEAR ( mcr.applyTime ) = @currentYear
|
||||
) AS '新入职、恢复人数',
|
||||
(
|
||||
SELECT
|
||||
count( 1 )
|
||||
FROM
|
||||
member_change_record mcr
|
||||
LEFT JOIN `user` u ON u.id = mcr.userId
|
||||
WHERE
|
||||
mcr.`type` IN ( 3, 4, 5, 6, 8 )
|
||||
AND u.unionid = gh.id
|
||||
AND YEAR ( mcr.applyTime ) = @currentYear
|
||||
) AS '离职、去世、退休、开除、退会人数',
|
||||
(select count(1) from `user` where member = 1 and unionid = gh.id) as currentYearMemberNum
|
||||
FROM
|
||||
sys_union gh
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "H03"))) {
|
||||
cnd.and("gh.id", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.asc("gh.unioncode");
|
||||
sql.setCondition(cnd);
|
||||
sql.setParam("lastYear", currentYear - 1);
|
||||
sql.setParam("currentYear", currentYear);
|
||||
List<NutMap> list = memberService.listMap(sql);
|
||||
list.forEach(v -> {
|
||||
v.put("lastYearMemberNum", v.getInt("往年会员人数"));
|
||||
|
||||
v.put("newResetMemberNum", v.getInt("新入职、恢复人数"));
|
||||
|
||||
v.put("memberUnitChangeNumIn", v.getInt("校内异动变动到我工会人数"));
|
||||
|
||||
v.put("memberUnitChangeNumOut", v.getInt("校内异动我工会减少人数"));
|
||||
|
||||
int newMemberNum = v.getInt("校内异动变动到我工会人数") + v.getInt("新入职、恢复人数");
|
||||
v.put("newMemberNum", newMemberNum);
|
||||
|
||||
int reduceMemberNum = v.getInt("校内异动我工会减少人数") + v.getInt("离职、去世、退休、开除、退会人数");
|
||||
v.put("reduceMemberNum", reduceMemberNum);
|
||||
|
||||
v.put("reduceOtherNum", v.getInt("离职、去世、退休、开除、退会人数"));
|
||||
|
||||
});
|
||||
|
||||
return list.stream().filter(v -> v.getInt("currentYearMemberNum") != 0).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.inquire.analysis")
|
||||
public Object pageData2(@Param(value = "unitId", required = false) String unitId, Integer currentYear) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dw.id,
|
||||
dw.unitcode as unitCode,
|
||||
dw.`name` as unitName,
|
||||
( SELECT count( 1 ) FROM member_his WHERE `year` = @lastYear AND unitid = dw.id ) AS '往年会员人数',
|
||||
( SELECT count( 1 ) FROM member_change_record WHERE currentUnitId = dw.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动变动到我单位人数',
|
||||
( SELECT count( 1 ) FROM member_change_record WHERE originUnitId = dw.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动我单位减少人数',
|
||||
(
|
||||
SELECT
|
||||
count( 1 )
|
||||
FROM
|
||||
member_change_record mcr
|
||||
LEFT JOIN `user` u ON u.id = mcr.userId
|
||||
WHERE
|
||||
mcr.`type` IN ( 2, 7 )
|
||||
AND u.unitid = dw.id
|
||||
AND YEAR ( mcr.applyTime ) = @currentYear
|
||||
) AS '新入职、恢复人数',
|
||||
(
|
||||
SELECT
|
||||
count( 1 )
|
||||
FROM
|
||||
member_change_record mcr
|
||||
LEFT JOIN `user` u ON u.id = mcr.userId
|
||||
WHERE
|
||||
mcr.`type` IN ( 3, 4, 5, 6, 8 )
|
||||
AND u.unitid = dw.id
|
||||
AND YEAR ( mcr.applyTime ) = @currentYear
|
||||
) AS '离职、去世、退休、开除、退会人数',
|
||||
(select count(1) from `user` where member = 1 and unitid = dw.id) as currentYearMemberNum
|
||||
FROM
|
||||
sys_unit dw
|
||||
$condition
|
||||
""");
|
||||
// WHERE 1=1 AND dw.parentId = 0 AND id NOT IN ('0','000') ORDER BY dw.unitcode ASC
|
||||
Cnd cnd = Cnd.NEW();
|
||||
// cnd.and("dw.parentId", "=", 0).and("id", "not in", Lang.array("0", "000"));
|
||||
// cnd.and("dw.parentId", "=", 0);
|
||||
cnd.asc("dw.unitcode");
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "H03"))) {
|
||||
cnd.and("dw.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
sql.setParam("lastYear", currentYear - 1);
|
||||
sql.setParam("currentYear", currentYear);
|
||||
List<NutMap> list = memberService.listMap(sql);
|
||||
list.forEach(v -> {
|
||||
v.put("lastYearMemberNum", v.getInt("往年会员人数"));
|
||||
|
||||
v.put("newResetMemberNum", v.getInt("新入职、恢复人数"));
|
||||
|
||||
v.put("memberUnitChangeNumIn", v.getInt("校内异动变动到我单位人数"));
|
||||
|
||||
v.put("memberUnitChangeNumOut", v.getInt("校内异动我单位减少人数"));
|
||||
|
||||
int newMemberNum = v.getInt("校内异动变动到我单位人数") + v.getInt("新入职、恢复人数");
|
||||
v.put("newMemberNum", newMemberNum);
|
||||
|
||||
int reduceMemberNum = v.getInt("校内异动我单位减少人数") + v.getInt("离职、去世、退休、开除、退会人数");
|
||||
v.put("reduceMemberNum", reduceMemberNum);
|
||||
|
||||
v.put("reduceOtherNum", v.getInt("离职、去世、退休、开除、退会人数"));
|
||||
|
||||
});
|
||||
return list.stream().filter(v -> v.getInt("currentYearMemberNum") != 0).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
private static final String UNITSQL = """
|
||||
SELECT
|
||||
dw.id,
|
||||
dw.unitcode as unitCode,
|
||||
dw.`name` as unitName,
|
||||
( SELECT count( 1 ) FROM member_his WHERE `year` = @lastYear AND unitid = dw.id ) AS '往年会员人数',
|
||||
( SELECT count( 1 ) FROM member_change_record WHERE currentUnitId = dw.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动变动到我单位人数',
|
||||
( SELECT count( 1 ) FROM member_change_record WHERE originUnitId = dw.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动我单位减少人数',
|
||||
(
|
||||
SELECT
|
||||
count( 1 )
|
||||
FROM
|
||||
member_change_record mcr
|
||||
LEFT JOIN `user` u ON u.id = mcr.userId
|
||||
WHERE
|
||||
mcr.`type` IN ( 2, 7 )
|
||||
AND u.unitid = dw.id
|
||||
AND YEAR ( mcr.applyTime ) = @currentYear
|
||||
) AS '新入职、恢复人数',
|
||||
(
|
||||
SELECT
|
||||
count( 1 )
|
||||
FROM
|
||||
member_change_record mcr
|
||||
LEFT JOIN `user` u ON u.id = mcr.userId
|
||||
WHERE
|
||||
mcr.`type` IN ( 3, 4, 5, 6, 8 )
|
||||
AND u.unitid = dw.id
|
||||
AND YEAR ( mcr.applyTime ) = @currentYear
|
||||
) AS '离职、去世、退休、开除、退会人数',
|
||||
(select count(1) from `user` where member = 1 and unitid = dw.id) as currentYearMemberNum
|
||||
FROM
|
||||
sys_unit dw
|
||||
$condition
|
||||
""";
|
||||
|
||||
private static final String UNIONSQL = """
|
||||
SELECT
|
||||
gh.id,
|
||||
gh.unioncode as unionCode,
|
||||
gh.unionname as unionName,
|
||||
( SELECT count( 1 ) FROM member_his WHERE `year` = @lastYear AND unionid = gh.id ) AS '往年会员人数',
|
||||
( SELECT count( 1 ) FROM member_change_record WHERE currentUnionId = gh.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动变动到我单位人数',
|
||||
( SELECT count( 1 ) FROM member_change_record WHERE originUnionId = gh.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动我单位减少人数',
|
||||
(
|
||||
SELECT
|
||||
count( 1 )
|
||||
FROM
|
||||
member_change_record mcr
|
||||
LEFT JOIN `user` u ON u.id = mcr.userId
|
||||
WHERE
|
||||
mcr.`type` IN ( 2, 7 )
|
||||
AND u.unionid = gh.id
|
||||
AND YEAR ( mcr.applyTime ) = @currentYear
|
||||
) AS '新入职、恢复人数',
|
||||
(
|
||||
SELECT
|
||||
count( 1 )
|
||||
FROM
|
||||
member_change_record mcr
|
||||
LEFT JOIN `user` u ON u.id = mcr.userId
|
||||
WHERE
|
||||
mcr.`type` IN ( 3, 4, 5, 6, 8 )
|
||||
AND u.unionid = gh.id
|
||||
AND YEAR ( mcr.applyTime ) = @currentYear
|
||||
) AS '离职、去世、退休、开除、退会人数',
|
||||
(select count(1) from `user` where member = 1 and unionid = gh.id) as currentYearMemberNum
|
||||
FROM
|
||||
sys_union gh
|
||||
$condition
|
||||
""";
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("member.inquire.analysis")
|
||||
public void doExport(HttpServletResponse response,
|
||||
@Param(value = "searchType", required = false) String searchType,
|
||||
@Param(value = "currentYear", required = false) Integer currentYear,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId) {
|
||||
Sql sql = Sqls.create(searchType.equals("按单位分析") ? UNITSQL : UNIONSQL);
|
||||
sql.setParam("lastYear", currentYear - 1);
|
||||
sql.setParam("currentYear", currentYear);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (searchType.equals("按单位分析")) {
|
||||
if (Strings.isNotBlank(unitId)) {
|
||||
cnd.and("dw.id", "=", unitId);
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "H03"))) {
|
||||
cnd.and("dw.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
// cnd.and("dw.parentId", "=", 0).and("dw.id", "not in ", Lang.array("0", "000"));
|
||||
cnd.asc("dw.unitcode");
|
||||
}
|
||||
if (searchType.equals("按分工会分析")) {
|
||||
if (Strings.isNotBlank(unionId)) {
|
||||
cnd.and("gh.id", "=", unionId);
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "H03"))) {
|
||||
cnd.and("gh.id", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.asc("gh.unioncode");
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> NutMaplist = memberService.listMap(sql);
|
||||
|
||||
|
||||
List<NutMap> list = NutMaplist.stream().filter(v -> v.getInt("currentYearMemberNum") != 0).collect(Collectors.toList());
|
||||
list.forEach(v -> {
|
||||
if (searchType.equals("按分工会分析")) {
|
||||
v.put("分工会代码", v.getString("unionCode"));
|
||||
v.put("分工会名称", v.getString("unionName"));
|
||||
|
||||
} else {
|
||||
v.put("单位代码", v.getString("unitCode"));
|
||||
v.put("单位名称", v.getString("unitName"));
|
||||
}
|
||||
|
||||
v.put("年初数量", v.getInt("往年会员人数"));
|
||||
int newMemberNum = v.getInt("校内异动变动到我单位人数") + v.getInt("新入职、恢复人数");
|
||||
v.put("新增人数", newMemberNum);
|
||||
v.put("新入职(恢复)", v.getInt("新入职、恢复人数"));
|
||||
v.put("校内转入", v.getInt("校内异动变动到我单位人数"));
|
||||
|
||||
int reduceMemberNum = v.getInt("校内异动我单位减少人数") + v.getInt("离职、去世、退休、开除、退会人数");
|
||||
v.put("减少人数", reduceMemberNum);
|
||||
v.put("校内转出", v.getInt("校内异动我单位减少人数"));
|
||||
v.put("其他(离职)", v.getInt("离职、去世、退休、开除、退会人数"));
|
||||
|
||||
v.put("当前数量", v.getInt("currentYearMemberNum"));
|
||||
});
|
||||
|
||||
NutMap sumMap = new NutMap() {{
|
||||
put(searchType.equals("按分工会分析") ? "分工会名称" : "单位名称", "合计");
|
||||
put(searchType.equals("按分工会分析") ? "分工会代码" : "单位代码", "");
|
||||
put("年初数量", list.stream().mapToInt(v -> v.getInt("年初数量")).sum());
|
||||
put("新增人数", list.stream().mapToInt(v -> v.getInt("新增人数")).sum());
|
||||
put("新入职(恢复)", list.stream().mapToInt(v -> v.getInt("新入职(恢复)")).sum());
|
||||
put("校内转入", list.stream().mapToInt(v -> v.getInt("校内转入")).sum());
|
||||
put("减少人数", list.stream().mapToInt(v -> v.getInt("减少人数")).sum());
|
||||
put("校内转出", list.stream().mapToInt(v -> v.getInt("校内转出")).sum());
|
||||
put("其他(离职)", list.stream().mapToInt(v -> v.getInt("其他(离职)")).sum());
|
||||
put("当前数量", list.stream().mapToInt(v -> v.getInt("当前数量")).sum());
|
||||
}};
|
||||
|
||||
list.add(sumMap);
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
if (searchType.equals("按分工会分析")) {
|
||||
entityList.add(new ExcelExportEntity("分工会代码", "分工会代码", 20));
|
||||
entityList.add(new ExcelExportEntity("分工会名称", "分工会名称", 20));
|
||||
|
||||
} else {
|
||||
entityList.add(new ExcelExportEntity("单位代码", "单位代码", 20));
|
||||
entityList.add(new ExcelExportEntity("单位名称", "单位名称", 20));
|
||||
}
|
||||
|
||||
String[] excelNames = Lang.array("年初数量", "新增人数", "新入职(恢复)", "校内转入", "减少人数", "校内转出", "其他(离职)", "当前数量");
|
||||
for (String excelName : excelNames) {
|
||||
entityList.add(new ExcelExportEntity(excelName, excelName, 20));
|
||||
}
|
||||
try {
|
||||
ViTool.excelResponse(response, "会员分析.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, list);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.inquire;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 会员数据看板
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/29
|
||||
* @since 1.0
|
||||
*/
|
||||
@At("/platform/member/inquire/board")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MemberDataBoardController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/inquire/DataBoard.html")
|
||||
@RequiresPermissions("member.inquire.board")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private MemberCommonService memberService;
|
||||
|
||||
|
||||
/**
|
||||
* @return 今年和去年的会员数
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.inquire.board")
|
||||
public Object memberNumber() {
|
||||
int memberNum = memberService.count(Sqls.create("select count(1) from member"));
|
||||
int lastYearMemberNum = memberService.count(Sqls.create("select * from member_his where year = year(now()) -1 "));
|
||||
return Map.of("memberNum", memberNum, "lastYearMemberNum", lastYearMemberNum);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 会员增长趋势
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.inquire.board")
|
||||
public Object growthTrend() {
|
||||
List<Map> result = new ArrayList<>();
|
||||
Integer year = DateUtil.getYear();
|
||||
for (int i = year - 5; i < year; i++) {
|
||||
int count = memberService.count(Sqls.create("select * from member_his where year = @year ").setParam("year", year));
|
||||
result.add(Map.of("label", i, "value", count));
|
||||
}
|
||||
result.add(Map.of("label", year, "value", memberService.count(Sqls.create("select count(1) from member"))));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 会员占比
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.inquire.board")
|
||||
public Object memberPercentage() {
|
||||
int member = memberService.count(Sqls.create("select count(1) from member"));
|
||||
int user = memberService.count(Sqls.create("select count(1) from sys_user"));
|
||||
return (float) member / (float) user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 男女占比
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.inquire.board")
|
||||
public Object memberSexPercentage() {
|
||||
// int count = memberService.count(Sqls.create("select count(1) from member where sex in ('男','女')"));
|
||||
int men = memberService.count(Sqls.create("select count(1) from member where sex = '男' "));
|
||||
int women = memberService.count(Sqls.create("select count(1) from member where sex = '女' "));
|
||||
|
||||
return List.of(Map.of("type", "男", "value", men), Map.of("type", "女", "value", women));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 各工会会员数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.inquire.board")
|
||||
public Object unionMember() {
|
||||
String str = """
|
||||
SELECT
|
||||
un.unionname,
|
||||
un.unioncode,
|
||||
( SELECT count( 1 ) FROM member WHERE unionid = un.id ) `value`
|
||||
FROM
|
||||
sys_union un
|
||||
ORDER BY
|
||||
$order
|
||||
""";
|
||||
List<Record> chartData = memberService.list(Sqls.create(str).setVar("order", "un.unioncode"));
|
||||
List<Record> tableData = memberService.list(Sqls.create(str).setVar("order", "un.unioncode"));
|
||||
|
||||
return Map.of("chartData", chartData, "tableData", tableData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据人员类型查找会员数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.inquire.board")
|
||||
public Object personTypeMember() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dict.`name`,
|
||||
dict.`code` label,
|
||||
( SELECT COUNT( 1 ) FROM member WHERE personType = dict.`code` ) value
|
||||
FROM
|
||||
sys_dict dict
|
||||
LEFT JOIN sys_dict parent ON dict.parentId = parent.id
|
||||
WHERE
|
||||
parent.`code` = 'UserType'
|
||||
ORDER BY
|
||||
dict.location
|
||||
""");
|
||||
return memberService.list(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据在职状态查找会员数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.inquire.board")
|
||||
public Object userStateMember() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dict.`name`,
|
||||
dict.`code` label,
|
||||
( SELECT COUNT( 1 ) FROM member WHERE userState = dict.`code` ) value
|
||||
FROM
|
||||
sys_dict dict
|
||||
LEFT JOIN sys_dict parent ON dict.parentId = parent.id
|
||||
WHERE
|
||||
parent.`code` = 'UserState'
|
||||
ORDER BY
|
||||
dict.location
|
||||
""");
|
||||
return memberService.list(sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.inquire;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.data.model.UserHistory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/8/21 9:07
|
||||
* @description
|
||||
*/
|
||||
@At("/platform/member/inquire/history")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MemberHistoyController {
|
||||
|
||||
@Inject("UserHistory")
|
||||
private ViService<UserHistory> userHistoryViService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/inquire/History.html")
|
||||
@RequiresPermissions("member.inquire.History")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.inquire.History")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
@Param(value = "memberStatus", required = false) Integer memberStatus,
|
||||
@Param(value = "memberSearchName", required = false) String memberSearchName,
|
||||
@Param(value = "memberSearchKeyWord", required = false) String memberSearchKeyWord) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.*,
|
||||
(select id from sys_user where loginname = u.loginname) as userId
|
||||
FROM
|
||||
`member_his` u
|
||||
LEFT JOIN sys_unit unit ON unit.id = u.unitid
|
||||
LEFT JOIN sys_union unin ON unin.id = unit.unionid $condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H03,A06")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("u.unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||
seg.or("u.unionGroupId", "is", null);
|
||||
cnd.and(seg);
|
||||
}
|
||||
}
|
||||
|
||||
// cnd.andEX("unin.id", "=", unionId);
|
||||
// cnd.andEX("unit.id", "=", unitId);
|
||||
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitId", "=", unitId);
|
||||
cnd.andEX("u.threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("u.unionGroupId", "=", unionGroupId);
|
||||
|
||||
cnd.andEX("u.year", "=", year);
|
||||
cnd.andEX("u.personType", "=", personType);
|
||||
cnd.andEX("u.userState", "=", userState);
|
||||
cnd.andEX("u.memberStatus", "=", memberStatus);
|
||||
|
||||
if (StrUtil.isNotBlank(memberSearchName)) {
|
||||
cnd.and(new SqlExpressionGroup().andLike(memberSearchName, memberSearchKeyWord));
|
||||
}
|
||||
|
||||
cnd.and(pageForm);
|
||||
cnd.desc("unit.name");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
|
||||
return userHistoryViService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+539
@@ -0,0 +1,539 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.inquire;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
//import io.v.nutz.zhgh.member.constant.MemberStatus;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import io.v.nutz.zhgh.staffmanage.member.utils.MemberUtils;
|
||||
import lombok.Data;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 综合查询
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/29
|
||||
* @since 1.0
|
||||
*/
|
||||
@At("/platform/member/inquire/integrate")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MemberInquireIntegrateController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/inquire/Integrate.html")
|
||||
@RequiresPermissions("member.inquire.Integrate")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private MemberCommonService memberService;
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.inquire.Integrate")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "isUnit", required = false) String isUnit,
|
||||
@Param(value = "isUnion", required = false) String isUnion,
|
||||
@Param(value = "startDate", required = false) String startDate,
|
||||
@Param(value = "endDate", required = false) String endDate,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unionId", required = false) String[] unionId,
|
||||
@Param(value = "unitId", required = false) String[] unitId,
|
||||
@Param(value = "threeUnitId", required = false) String[] threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String[] unionGroupId,
|
||||
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||
@Param(value = "userStates", required = false) String[] userStates,
|
||||
@Param(value = "preparedBys", required = false) String[] preparedBys,
|
||||
@Param(value = "memberStatus", required = false) String[] memberStatus,
|
||||
@Param(value = "campus", required = false) String campus,
|
||||
@Param(value = "memberType", required = false) String memberType,
|
||||
@Param(value = "memberTypes", required = false) String[] memberTypes,
|
||||
@Param(value = "sexTypes", required = false) String[] sexTypes,
|
||||
@Param(value = "roleIds", required = false) String[] roleIds,
|
||||
@Param(value = "age", required = false) String[] age,
|
||||
@Param(value = "reverseSelection") boolean reverseSelection,
|
||||
@Param(value = "memberSearchName", required = false) String memberSearchName,
|
||||
@Param(value = "memberSearchKeyWord", required = false) String memberSearchKeyWord) {
|
||||
int yyyy = Calendar.getInstance().get(Calendar.YEAR);
|
||||
|
||||
Cnd cnd = MemberUtils.getCnd(pageForm, startDate, endDate, unionId, unitId, personTypes, userStates, preparedBys, memberTypes, sexTypes, age, null, roleIds, null, null, memberStatus, threeUnitId, unionGroupId, reverseSelection, null, null, campus);
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT u.* from $table
|
||||
LEFT JOIN sys_user_role sur ON sur.userid = u.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
if (year == yyyy) {
|
||||
sql.setVar("table", "user u");
|
||||
} else {
|
||||
sql.setVar("table", "member_his u");
|
||||
cnd.andEX("u.year", "=", year);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(isUnit)) {
|
||||
cnd.and("u.unitid", isUnit.equals("true") ? "is not" : "is", null);
|
||||
}
|
||||
if (StrUtil.isNotBlank(isUnion)) {
|
||||
cnd.and("u.unionid", isUnion.equals("true") ? "is not" : "is", null);
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(new SqlExpressionGroup().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(memberSearchName)) {
|
||||
cnd.and(new SqlExpressionGroup().andLike(memberSearchName, memberSearchKeyWord));
|
||||
}
|
||||
|
||||
List<Integer> status = new ArrayList<>();
|
||||
// status.add(MemberStatus.NORMAL.getCode());
|
||||
// status.add(MemberStatus.TURN_IN.getCode());
|
||||
// status.add(MemberStatus.RESTORE.getCode());
|
||||
|
||||
// if (memberStatus != null && memberStatus.length > 0) {
|
||||
// cnd.andEX("memberStatus", "in", memberStatus);
|
||||
// } else {
|
||||
// cnd.andEX("member", "=", 1);
|
||||
// /* SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
// group.and("memberStatus", "in", status);
|
||||
// group.or("memberStatus", "IS", null);
|
||||
// cnd.and(group);*/
|
||||
// }
|
||||
|
||||
if ("2".equals(memberType)) {
|
||||
cnd.and("u.member","=",1);
|
||||
} else if ("3".equals(memberType)) {
|
||||
cnd.and(Cnd.exps("u.member","=",0).or("u.member","is",null).or("u.member","=",""));
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,H03")) {
|
||||
if (ShiroUtil.hasAnyRoles("H04,gh01")) {
|
||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||
cnd.and("u.unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||
// cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(pageForm.getPageOrderName()) && StrUtil.isBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.asc("u.loginname");
|
||||
}
|
||||
|
||||
cnd.groupBy("u.id");
|
||||
sql.setCondition(cnd);
|
||||
// NutMap nutMap = new NutMap();
|
||||
// List<String> ids = memberService.list(sql).stream().map(v -> v.getString("id")).collect(Collectors.toList());
|
||||
// nutMap.addv("ids",ids);
|
||||
// nutMap.addv("list",memberService.list(pageForm, sql));
|
||||
return memberService.list(pageForm, sql);
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class ExportEntityUser {
|
||||
|
||||
@Excel(name = "工号", width = 20d)
|
||||
private String loginname;
|
||||
|
||||
@Excel(name = "姓名", width = 20d)
|
||||
private String username;
|
||||
|
||||
@Excel(name = "性别", width = 20d)
|
||||
private String sex;
|
||||
|
||||
@Excel(name = "身份证号", width = 40d)
|
||||
private String idcard;
|
||||
|
||||
@Excel(name = "户籍类型", width = 20d)
|
||||
private String householdType;
|
||||
|
||||
@Excel(name = "手机号码", width = 20d)
|
||||
private String mobile;
|
||||
|
||||
@Excel(name = "所在工会全称", width = 30d)
|
||||
private String unionName;
|
||||
|
||||
@Excel(name = "所在工会代码", width = 30d)
|
||||
private String unionCode;
|
||||
|
||||
@Excel(name = "所在单位全称", width = 30d)
|
||||
private String unitName;
|
||||
|
||||
@Excel(name = "所在单位代码", width = 30d)
|
||||
private String unitCode;
|
||||
|
||||
@Excel(name = "在职状态", width = 30d)
|
||||
private String userState;
|
||||
|
||||
@Excel(name = "人员类型", width = 30d)
|
||||
private String personType;
|
||||
|
||||
@Excel(name = "微信号", width = 30d)
|
||||
private String weChat;
|
||||
|
||||
@Excel(name = "QQ号", width = 30d)
|
||||
private String qqnum;
|
||||
|
||||
@Excel(name = "国籍", width = 20d)
|
||||
private String nationality;
|
||||
|
||||
@Excel(name = "曾用名", width = 20d)
|
||||
private String nameUsedBefore;
|
||||
|
||||
@Excel(name = "民族", width = 20d)
|
||||
private String nation;
|
||||
|
||||
@Excel(name = "婚姻状况", width = 20d)
|
||||
private String marriage;
|
||||
|
||||
@Excel(name = "政治面貌", width = 20d)
|
||||
private String political;
|
||||
|
||||
@Excel(name = "学历", width = 20d)
|
||||
private String education;
|
||||
|
||||
@Excel(name = "学位", width = 20d)
|
||||
private String academicDegree;
|
||||
|
||||
@Excel(name = "入会时间", width = 20d)
|
||||
private String memberJoinTime;
|
||||
|
||||
@Excel(name = "会员状态", width = 20d)
|
||||
private String memberStatus;
|
||||
|
||||
@Excel(name = "有效证件类型", width = 20d)
|
||||
private String idType;
|
||||
|
||||
@Excel(name = "有效证件起始日期", width = 20d)
|
||||
private String beginningDate;
|
||||
|
||||
@Excel(name = "有效证件截止日期", width = 20d)
|
||||
private String endDate;
|
||||
|
||||
@Excel(name = "参加工作日期", width = 20d)
|
||||
private String workDate;
|
||||
|
||||
@Excel(name = "录用职位", width = 20d)
|
||||
private String position;
|
||||
|
||||
@Excel(name = "所学专业类别", width = 20d)
|
||||
private String majorCategory;
|
||||
|
||||
@Excel(name = "注释", width = 20d)
|
||||
private String notes;
|
||||
|
||||
@Excel(name = "是否外来务工人员", width = 20d)
|
||||
private String isOutsiders;
|
||||
|
||||
@Excel(name = "劳动合同制用工形式", width = 20d)
|
||||
private String laborContractType;
|
||||
|
||||
@Excel(name = "会员号", width = 20d)
|
||||
private String memberNumber;
|
||||
|
||||
@Excel(name = "是否工会干部", width = 20d)
|
||||
private String isLeader;
|
||||
|
||||
@Excel(name = "是否缴纳会费", width = 20d)
|
||||
private String isPay;
|
||||
|
||||
@Excel(name = "工会特殊项标识", width = 20d)
|
||||
private String isAwardWinning;
|
||||
|
||||
@Excel(name = "会员卡类型", width = 20d)
|
||||
private String membershipCardType;
|
||||
|
||||
@Excel(name = "是否办理工会实体卡", width = 20d)
|
||||
private String isPhysicaisCard;
|
||||
|
||||
@Excel(name = "工会实体卡是否激活", width = 20d)
|
||||
private String isCardActivated;
|
||||
|
||||
@Excel(name = "工会实体卡卡号", width = 50d)
|
||||
private String cardNum;
|
||||
|
||||
@Excel(name = "工会实体卡银行卡卡号", width = 50d)
|
||||
private String cardBankNum;
|
||||
|
||||
@Excel(name = "电子会员卡卡号", width = 50d)
|
||||
private String electronicCardNumber;
|
||||
|
||||
@Excel(name = "电子会员卡发放时间", width = 20d)
|
||||
private String electronicCardNumberTime;
|
||||
|
||||
@Excel(name = "出生年月", width = 20d)
|
||||
private String birthday;
|
||||
|
||||
@Excel(name = "籍贯", width = 20d)
|
||||
private String hometown;
|
||||
|
||||
@Excel(name = "出生地点", width = 50d)
|
||||
private String birthPlace;
|
||||
|
||||
@Excel(name = "健康状况", width = 20d)
|
||||
private String health;
|
||||
|
||||
@Excel(name = "残疾类别", width = 20d)
|
||||
private String diseaseType;
|
||||
|
||||
@Excel(name = "疾病说明", width = 20d)
|
||||
private String diseaseDescription;
|
||||
|
||||
@Excel(name = "个人身份", width = 20d)
|
||||
private String personalStatus;
|
||||
|
||||
@Excel(name = "社会身份", width = 20d)
|
||||
private String socialIdentity;
|
||||
|
||||
@Excel(name = "其他社会身份", width = 20d)
|
||||
private String otherIdentity;
|
||||
|
||||
@Excel(name = "就业状况", width = 20d)
|
||||
private String employmentStatus;
|
||||
|
||||
@Excel(name = "家庭住址", width = 50d)
|
||||
private String homeAddress;
|
||||
|
||||
@Excel(name = "住宅电话", width = 30d)
|
||||
private String homePhone;
|
||||
|
||||
@Excel(name = "其他电话", width = 30d)
|
||||
private String otherPhone;
|
||||
|
||||
@Excel(name = "通信地址", width = 50d)
|
||||
private String mailingAddress;
|
||||
|
||||
@Excel(name = "邮政编码", width = 30d)
|
||||
private String postalCode;
|
||||
|
||||
@Excel(name = "其他联系方式", width = 30d)
|
||||
private String otherContactInformation;
|
||||
|
||||
@Excel(name = "职业类别", width = 30d)
|
||||
private String occupationType;
|
||||
|
||||
@Excel(name = "从事专业", width = 30d)
|
||||
private String profession;
|
||||
|
||||
@Excel(name = "户籍所在地", width = 50d)
|
||||
private String registeredResidence;
|
||||
|
||||
@Excel(name = "专长", width = 30d)
|
||||
private String specialSkill;
|
||||
|
||||
@Excel(name = "兴趣爱好", width = 30d)
|
||||
private String hobby;
|
||||
|
||||
@Excel(name = "工作经历", width = 70d)
|
||||
private String vita;
|
||||
|
||||
@Excel(name = "家庭人口数", width = 30d)
|
||||
private String familyPopulation;
|
||||
}
|
||||
|
||||
@Inject("Sys_user")
|
||||
private ViService<Sys_user> sys_userViService;
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("member.inquire.Integrate")
|
||||
public void doExport(HttpServletResponse response,
|
||||
Integer year,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "memberStatus", required = false) String memberStatus,
|
||||
@Param(value = "personTypes", required = false) String personTypes,
|
||||
@Param(value = "userStates", required = false) String userStates) {
|
||||
try {
|
||||
int yyyy = Calendar.getInstance().get(Calendar.YEAR);
|
||||
CndPlus cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
*,
|
||||
unitname unitName,
|
||||
unionname unionName,
|
||||
unitcode unitCode,
|
||||
unioncode unionCode
|
||||
FROM
|
||||
$table
|
||||
$condition
|
||||
""");
|
||||
|
||||
if (year == yyyy) {
|
||||
sql.setVar("table", "user");
|
||||
} else {
|
||||
sql.setVar("table", "member_his");
|
||||
cnd.andEX("year", "=", year);
|
||||
}
|
||||
|
||||
cnd.and("member", "=", 1);
|
||||
cnd.andEX("unionid", "=", unionId);
|
||||
cnd.andEX("unitid", "=", unitId);
|
||||
if (Json.fromJsonAsArray(Integer.class, memberStatus).length > 0) {
|
||||
cnd.andEX("memberStatus", "in", Json.fromJsonAsArray(Integer.class, memberStatus));
|
||||
}
|
||||
if (Json.fromJsonAsArray(String.class, personTypes).length > 0) {
|
||||
cnd.andEX("personType", "in", Json.fromJsonAsArray(String.class, personTypes));
|
||||
}
|
||||
if (Json.fromJsonAsArray(String.class, userStates).length > 0) {
|
||||
cnd.andEX("userState", "in", Json.fromJsonAsArray(String.class, userStates));
|
||||
}
|
||||
|
||||
|
||||
cnd.asc("unioncode");
|
||||
sql.setCondition(cnd);
|
||||
List<ExportEntityUser> exportList = sys_userViService.listEntity(sql, ExportEntityUser.class);
|
||||
// exportList.stream().forEach(v -> {
|
||||
// v.setMemberStatus(MemberStatus.EXPELLED.getDescByCode(v.getMemberStatus()));
|
||||
// });
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(("会员信息.xls").getBytes("utf-8"), "ISO8859-1"));
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ExportEntityUser.class, exportList);
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("member.inquire.Integrate")
|
||||
public void doExportByUnion(HttpServletResponse response,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||
@Param(value = "startDate", required = false) String startDate,
|
||||
@Param(value = "endDate", required = false) String endDate,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unionId", required = false) String[] unionId,
|
||||
@Param(value = "unitId", required = false) String[] unitId,
|
||||
@Param(value = "threeUnitId", required = false) String[] threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String[] unionGroupId,
|
||||
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||
@Param(value = "userStates", required = false) String[] userStates,
|
||||
@Param(value = "preparedBys", required = false) String[] preparedBys,
|
||||
@Param(value = "memberStatus", required = false) String[] memberStatus,
|
||||
@Param(value = "campus", required = false) String campus,
|
||||
@Param(value = "memberType", required = false) String memberType,
|
||||
@Param(value = "memberTypes", required = false) String[] memberTypes,
|
||||
@Param(value = "sexTypes", required = false) String[] sexTypes,
|
||||
@Param(value = "roleIds", required = false) String[] roleIds,
|
||||
@Param(value = "age", required = false) String[] age,
|
||||
@Param(value = "reverseSelection") boolean reverseSelection,
|
||||
@Param(value = "memberSearchName", required = false) String memberSearchName,
|
||||
@Param(value = "memberSearchKeyWord", required = false) String memberSearchKeyWord,
|
||||
String props) {
|
||||
try {
|
||||
int yyyy = Calendar.getInstance().get(Calendar.YEAR);
|
||||
|
||||
Cnd cnd = MemberUtils.getCnd(null, startDate, endDate, unionId, unitId, personTypes, userStates, preparedBys, memberTypes, sexTypes, age, null, roleIds, null, null, memberStatus, threeUnitId, unionGroupId, reverseSelection, null, null, campus);
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT u.* from $table
|
||||
LEFT JOIN sys_user_role sur ON sur.userid = u.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
if (year == yyyy) {
|
||||
sql.setVar("table", "user u");
|
||||
} else {
|
||||
sql.setVar("table", "member_his u");
|
||||
cnd.andEX("u.year", "=", year);
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(memberSearchName)) {
|
||||
cnd.and(new SqlExpressionGroup().andLike(memberSearchName, memberSearchKeyWord));
|
||||
}
|
||||
|
||||
if ("2".equals(memberType)) {
|
||||
cnd.and("u.member","=",1);
|
||||
} else if ("3".equals(memberType)) {
|
||||
cnd.and(Cnd.exps("u.member","=",0).or("u.member","is",null).or("u.member","=",""));
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,H03")) {
|
||||
cnd.and("unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.asc("unitcode");
|
||||
cnd.asc("unioncode");
|
||||
cnd.asc("memberJoinTime");
|
||||
cnd.groupBy("u.id");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
Map<String, String> propMap = Json.fromJson(Map.class, props);
|
||||
propMap.put("unioncode", "所属工会代码");
|
||||
propMap.put("unitcode", "所属单位代码");
|
||||
|
||||
propMap.forEach((k, v) -> {
|
||||
if (k.equals("unioncode")) {
|
||||
entityList.add(7, new ExcelExportEntity(v, k, 20));
|
||||
} else if (k.equals("unitcode")) {
|
||||
entityList.add(9, new ExcelExportEntity(v, k, 20));
|
||||
} else {
|
||||
entityList.add(new ExcelExportEntity(v, k, 20));
|
||||
}
|
||||
});
|
||||
|
||||
// List<ExportEntityUser> exportList = sys_userViService.listEntity(sql, ExportEntityUser.class);
|
||||
|
||||
List<Record> memberList = memberService.list(sql);
|
||||
memberList.forEach(v -> {
|
||||
if (StrUtil.isNotEmpty(v.getString("memberJoinTime"))) {
|
||||
v.set("memberJoinTime", v.getString("memberJoinTime").substring(0, 10));
|
||||
}
|
||||
});
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(("会员信息.xls").getBytes("utf-8"), "ISO8859-1"));
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, memberList);
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+258
@@ -0,0 +1,258 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.inquire;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/8/21 16:12
|
||||
* @description
|
||||
*/
|
||||
@At("/platform/member/inquire/statistics")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
@RequiresAuthentication
|
||||
public class MemberStatisticsController {
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/inquire/Statistics.html")
|
||||
@RequiresPermissions("member.inquire.Statistics")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
private String unionSql = """
|
||||
SELECT
|
||||
un.id,
|
||||
un.unioncode AS unionCode,
|
||||
unionName,
|
||||
( SELECT COUNT( 1 ) FROM $table where member = 1 AND un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=40 $personCnd $yearCnd) AS smallForty,
|
||||
( SELECT COUNT( 1 ) FROM $table where member = 1 AND un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=41 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=50 $personCnd $yearCnd) AS smallFifty,
|
||||
( SELECT COUNT( 1 ) FROM $table where member = 1 AND un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=51 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=55 $personCnd $yearCnd) AS smallFiftyFive,
|
||||
( SELECT COUNT( 1 ) FROM $table where member = 1 AND un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>55 $personCnd $yearCnd) AS smallFiftyFive2,
|
||||
( SELECT COUNT( 1 ) FROM $table where member = 1 AND un.id = unionid $personCnd $yearCnd) TotalNumber,
|
||||
( SELECT COUNT( 1 ) FROM $table where member = 1 AND sex = '男' AND un.id = unionid $personCnd $yearCnd) maleMember,
|
||||
( SELECT COUNT( 1 ) FROM $table where member = 1 AND sex = '女' AND un.id = unionid $personCnd $yearCnd) femaleMember
|
||||
FROM
|
||||
sys_union un
|
||||
$condition
|
||||
""";
|
||||
|
||||
|
||||
private String unitSql = """
|
||||
SELECT
|
||||
un.id,
|
||||
un.unitcode AS unitCode,
|
||||
`name` AS unitName,
|
||||
( SELECT COUNT( 1 ) FROM `user` where member = 1 AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=40 $personCnd $yearCnd) AS smallForty,
|
||||
( SELECT COUNT( 1 ) FROM `user` where member = 1 AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=41 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=50 $personCnd $yearCnd) AS smallFifty,
|
||||
( SELECT COUNT( 1 ) FROM `user` where member = 1 AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=51 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=55 $personCnd $yearCnd) AS smallFiftyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where member = 1 AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>55 $personCnd $yearCnd) AS smallFiftyFive2,
|
||||
( SELECT COUNT( 1 ) FROM `user` where member = 1 AND un.id = unitid $personCnd $yearCnd) TotalNumber,
|
||||
( SELECT COUNT( 1 ) FROM `user` where member = 1 AND sex = '男' AND un.id = unitid $personCnd $yearCnd) maleMember,
|
||||
( SELECT COUNT( 1 ) FROM `user` where member = 1 AND sex = '女' AND un.id = unitid $personCnd $yearCnd) femaleMember
|
||||
FROM
|
||||
sys_unit un
|
||||
$condition
|
||||
""";
|
||||
|
||||
|
||||
@At
|
||||
public Object pageData(String[] personTypes, String unionId, Integer year) {
|
||||
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
||||
CndPlus cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create(unionSql);
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "H03"))) {
|
||||
cnd.and("un.id", "=", Vi.getUnionId());
|
||||
}
|
||||
if(StrUtil.isNotBlank(unionId)) {
|
||||
cnd.and("un.id", "=", unionId);
|
||||
}
|
||||
if (personTypes != null && personTypes.length > 0) {
|
||||
String join = StringUtils.join(personTypes, "','");
|
||||
sql.setVar("personCnd", "and personType in ('" + join + "')");
|
||||
}
|
||||
if (year != null && year != currentYear) {
|
||||
sql.setVar("yearCnd", "and year=" + year);
|
||||
}
|
||||
sql.setVar("table", year == currentYear ? "`user`" : "`member_his`");
|
||||
cnd.asc("un.unioncode");
|
||||
sql.setCondition(cnd);
|
||||
return sysUserService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
public Object pageData1(String[] personTypes, String unitId, Integer year) {
|
||||
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
||||
CndPlus cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create(unitSql);
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "H03"))) {
|
||||
cnd.and("un.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.and("unitlevel", "=", 2).and("unitcode", "!=", "000");
|
||||
if(StrUtil.isNotBlank(unitId)) {
|
||||
cnd.and("un.id", "=", unitId);
|
||||
}
|
||||
if (personTypes != null && personTypes.length > 0) {
|
||||
String join = StringUtils.join(personTypes, "','");
|
||||
sql.setVar("personCnd", "and personType in ('" + join + "')");
|
||||
}
|
||||
if (year != null && year != currentYear) {
|
||||
sql.setVar("yearCnd", "and year=" + year);
|
||||
}
|
||||
sql.setVar("table", year == currentYear ? "`user`" : "`member_his`");
|
||||
cnd.asc("un.unitcode");
|
||||
sql.setCondition(cnd);
|
||||
return sysUserService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* @At
|
||||
public Object historyMember(String[] personTypes, String unionId, Integer year) {
|
||||
CndPlus cndPlus = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
unionName ,
|
||||
unioncode as unionCode,
|
||||
( SELECT COUNT( 1 ) FROM `member_his` WHERE member = 1 AND un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<40 $yearCnd $personCnd) AS smallForty,
|
||||
( SELECT COUNT( 1 ) FROM `member_his` WHERE member = 1 AND un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=40 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<50 $yearCnd $personCnd) AS smallFifty,
|
||||
( SELECT COUNT( 1 ) FROM `member_his` WHERE member = 1 AND un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=50 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<55 $yearCnd $personCnd) AS smallFiftyFive,
|
||||
( SELECT COUNT( 1 ) FROM `member_his` WHERE member = 1 AND un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=55 $yearCnd $personCnd) AS smallFiftyFive2,
|
||||
( SELECT COUNT( 1 ) FROM `member_his` WHERE member = 1 AND un.id = unionid $yearCnd $personCnd) TotalNumber,
|
||||
( SELECT COUNT( 1 ) FROM `member_his` WHERE sex = '男' AND member = 1 AND un.id = unionid $yearCnd $personCnd) maleMember,
|
||||
( SELECT COUNT( 1 ) FROM `member_his` WHERE sex = '女' AND member = 1 AND un.id = unionid $yearCnd $personCnd) femaleMember
|
||||
FROM
|
||||
sys_union un $condition
|
||||
""");
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "H03"))) {
|
||||
cndPlus.and("un.id", "=", Vi.getUnionId());
|
||||
} else {
|
||||
cndPlus.andEX("un.id", "=", unionId);
|
||||
}
|
||||
if (personTypes != null && personTypes.length > 0) {
|
||||
String join = StringUtils.join(personTypes, "','");
|
||||
sql.setVar("personCnd", "and personType in ('" + join + "')");
|
||||
}
|
||||
if (year != null) {
|
||||
sql.setVar("yearCnd", "and year=" + year);
|
||||
}
|
||||
cndPlus.asc("un.unioncode");
|
||||
sql.setCondition(cndPlus);
|
||||
return sysUserService.listMap(sql);
|
||||
}*/
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void doExport(boolean union, Integer year, String unionId, String unitId, String[] personTypes, HttpServletResponse response) {
|
||||
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
||||
CndPlus cndPlus = CndPlus.create();
|
||||
Sql sql = Sqls.create(union ? unionSql : unitSql);
|
||||
|
||||
if (union) {
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "H03"))) {
|
||||
cndPlus.and("un.id", "=", Vi.getUnionId());
|
||||
}
|
||||
if (Strings.isNotBlank(unionId)) {
|
||||
cndPlus.andEX("un.id", "=", unionId);
|
||||
}
|
||||
} else {
|
||||
cndPlus.and("unitlevel", "=", 2).and("unitcode", "!=", "000");
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "H03"))) {
|
||||
cndPlus.and("un.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
if (Strings.isNotBlank(unitId)) {
|
||||
cndPlus.andEX("un.id", "=", unitId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (personTypes != null && personTypes.length > 0) {
|
||||
String join = StringUtils.join(personTypes, "','");
|
||||
sql.setVar("personCnd", "and personType in ('" + join + "')");
|
||||
}
|
||||
|
||||
if (year != null && year != currentYear) {
|
||||
sql.setVar("yearCnd", "and year=" + year);
|
||||
}
|
||||
|
||||
cndPlus.asc(union ? "un.unioncode" : "un.unitcode");
|
||||
sql.setCondition(cndPlus);
|
||||
sql.setVar("table", year == currentYear ? "`user`" : "`member_his`");
|
||||
|
||||
List<NutMap> memberList = sysUserService.listMap(sql);
|
||||
|
||||
|
||||
List<NutMap> finalMemberList = memberList;
|
||||
NutMap sumMap = new NutMap() {{
|
||||
addv(union?"unionCode":"unitCode", "合计");
|
||||
addv("TotalNumber", finalMemberList.stream().mapToInt(v -> v.getInt("TotalNumber")).sum());
|
||||
addv("maleMember", finalMemberList.stream().mapToInt(v -> v.getInt("maleMember")).sum());
|
||||
addv("femaleMember", finalMemberList.stream().mapToInt(v -> v.getInt("femaleMember")).sum());
|
||||
addv("smallForty", finalMemberList.stream().mapToInt(v -> v.getInt("smallForty")).sum());
|
||||
addv("smallFifty", finalMemberList.stream().mapToInt(v -> v.getInt("smallFifty")).sum());
|
||||
addv("smallFiftyFive", finalMemberList.stream().mapToInt(v -> v.getInt("smallFiftyFive")).sum());
|
||||
addv("smallFiftyFive2", finalMemberList.stream().mapToInt(v -> v.getInt("smallFiftyFive2")).sum());
|
||||
}};
|
||||
|
||||
memberList.add(sumMap);
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
if (union) {
|
||||
entityList.add(new ExcelExportEntity("分工会代码", "unionCode", 20));
|
||||
entityList.add(new ExcelExportEntity("分工会名称", "unionName", 20));
|
||||
}else{
|
||||
entityList.add(new ExcelExportEntity("单位代码", "unitCode", 20));
|
||||
entityList.add(new ExcelExportEntity("单位名称", "unitName", 20));
|
||||
}
|
||||
entityList.add(new ExcelExportEntity("总人数", "TotalNumber", 20));
|
||||
entityList.add(new ExcelExportEntity("男会员", "maleMember", 20));
|
||||
entityList.add(new ExcelExportEntity("女会员", "femaleMember", 20));
|
||||
entityList.add(new ExcelExportEntity("小于等于40岁会员", "smallForty", 20));
|
||||
entityList.add(new ExcelExportEntity("40-50", "smallFifty", 20));
|
||||
entityList.add(new ExcelExportEntity("50-55", "smallFiftyFive", 20));
|
||||
entityList.add(new ExcelExportEntity("大于55", "smallFiftyFive2", 20));
|
||||
|
||||
try {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(("会员统计名单.xls").getBytes("utf-8"), "ISO8859-1"));
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, memberList);
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
workbook.close();
|
||||
outputStream.close();
|
||||
outputStream.flush();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+281
@@ -0,0 +1,281 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.controller.inquire;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_dict;
|
||||
import io.v.nutz.sys.services.SysDictService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/member/inquire/usertype")
|
||||
@Ok("json:full")
|
||||
public class MemberUserTypeController {
|
||||
|
||||
@Inject
|
||||
private MemberCommonService memberService;
|
||||
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/inquire/usertype.html")
|
||||
@RequiresPermissions("member.inquire.usertype")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
private List<String> personTypes;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(String searchType) {
|
||||
List<Sys_dict> userType = sysDictService.getSubListByCode("UserType");
|
||||
personTypes = userType.stream().map(v -> v.getName()).collect(Collectors.toList());
|
||||
|
||||
Sql sql = null;
|
||||
|
||||
if (ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "H03"))) {
|
||||
if (searchType.equals("按分工会统计")) {
|
||||
sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.id as ghid,
|
||||
gh.unionname AS unionName,
|
||||
gh.unioncode AS unionCode,
|
||||
$personTypeSql
|
||||
FROM
|
||||
sys_union gh
|
||||
LEFT JOIN `user` u ON u.unionid = gh.id
|
||||
WHERE
|
||||
u.member = 1
|
||||
GROUP BY
|
||||
gh.id
|
||||
ORDER BY gh.unioncode
|
||||
""");
|
||||
} else if (searchType.equals("按单位统计")) {
|
||||
sql = Sqls.create("""
|
||||
SELECT
|
||||
dw.id as dwid,
|
||||
dw.`name` AS unitName,
|
||||
dw.unitcode AS unitCode,
|
||||
gh.id as ghid,
|
||||
gh.unionname as unionName,
|
||||
gh.unioncode as unionCode,
|
||||
$personTypeSql
|
||||
FROM
|
||||
sys_unit dw
|
||||
LEFT JOIN `user` u ON u.unitid = dw.id
|
||||
LEFT JOIN sys_union gh on gh.id = dw.unionid
|
||||
WHERE
|
||||
u.member = 1
|
||||
GROUP BY
|
||||
dw.id
|
||||
ORDER BY
|
||||
dw.unitcode
|
||||
""");
|
||||
}
|
||||
} else {
|
||||
sql = Sqls.create("""
|
||||
SELECT
|
||||
dw.id as dwid,
|
||||
dw.`name` AS unitName,
|
||||
dw.unitcode AS unitCode,
|
||||
gh.id as ghid,
|
||||
gh.unionname as unionName,
|
||||
gh.unioncode as unionCode,
|
||||
$personTypeSql
|
||||
FROM
|
||||
sys_unit dw
|
||||
LEFT JOIN `user` u ON u.unitid = dw.id
|
||||
LEFT JOIN sys_union gh on gh.id = dw.unionid
|
||||
WHERE
|
||||
u.member = 1
|
||||
AND u.unionid = @unionid
|
||||
GROUP BY
|
||||
dw.id
|
||||
ORDER BY
|
||||
dw.unitcode
|
||||
""");
|
||||
sql.setParam("unionid", Vi.getUnionId());
|
||||
}
|
||||
|
||||
StringBuffer personTypeSql = new StringBuffer();
|
||||
for (String personType : personTypes) {
|
||||
personTypeSql.append("count( CASE WHEN u.personType = '" + personType + "' THEN 1 ELSE NULL END ) AS '" + personType + "',");
|
||||
}
|
||||
personTypeSql.append("1=1");
|
||||
|
||||
sql.setVar("personTypeSql", personTypeSql.toString());
|
||||
return memberService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
public void doExport(HttpServletResponse response, String searchType) throws IOException {
|
||||
List<Sys_dict> userType = sysDictService.getSubListByCode("UserType");
|
||||
personTypes = userType.stream().map(v -> v.getName()).collect(Collectors.toList());
|
||||
|
||||
Sql sql = null;
|
||||
boolean hasAdminRoles = ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "H03"));
|
||||
|
||||
if (hasAdminRoles) {
|
||||
if (searchType.equals("按分工会统计")) {
|
||||
sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.id,
|
||||
gh.unionname AS unionName,
|
||||
gh.unioncode AS unionCode,
|
||||
$personTypeSql
|
||||
FROM
|
||||
sys_union gh
|
||||
LEFT JOIN `user` u ON u.unionid = gh.id
|
||||
WHERE
|
||||
u.member = 1
|
||||
GROUP BY
|
||||
gh.id
|
||||
ORDER BY gh.unioncode
|
||||
""");
|
||||
} else if (searchType.equals("按单位统计")) {
|
||||
sql = Sqls.create("""
|
||||
SELECT
|
||||
dw.id as dwid,
|
||||
dw.`name` AS unitName,
|
||||
dw.unitcode AS unitCode,
|
||||
gh.id as ghid,
|
||||
gh.unionname as unionName,
|
||||
gh.unioncode as unionCode,
|
||||
$personTypeSql
|
||||
FROM
|
||||
sys_unit dw
|
||||
LEFT JOIN `user` u ON u.unitid = dw.id
|
||||
LEFT JOIN sys_union gh on gh.id = dw.unionid
|
||||
WHERE
|
||||
u.member = 1
|
||||
GROUP BY
|
||||
dw.id
|
||||
ORDER BY
|
||||
dw.unitcode
|
||||
""");
|
||||
}
|
||||
|
||||
} else {
|
||||
sql = Sqls.create("""
|
||||
SELECT
|
||||
dw.id,
|
||||
dw.`name` AS unitName,
|
||||
dw.unitcode AS unitCode,
|
||||
$personTypeSql
|
||||
FROM
|
||||
sys_unit dw
|
||||
LEFT JOIN `user` u ON u.unitid = dw.id
|
||||
WHERE
|
||||
u.member = 1
|
||||
AND u.unionid = @unionid
|
||||
GROUP BY
|
||||
dw.id
|
||||
ORDER BY
|
||||
dw.unitcode
|
||||
""");
|
||||
sql.setParam("unionid", Vi.getUnionId());
|
||||
}
|
||||
StringBuffer personTypeSql = new StringBuffer();
|
||||
for (String personType : personTypes) {
|
||||
personTypeSql.append("count( CASE WHEN u.personType = '" + personType + "' THEN 1 ELSE NULL END ) AS '" + personType + "',");
|
||||
}
|
||||
personTypeSql.append("1=1");
|
||||
|
||||
sql.setVar("personTypeSql", personTypeSql.toString());
|
||||
|
||||
List<NutMap> memberList = memberService.listMap(sql);
|
||||
|
||||
memberList.forEach(v -> {
|
||||
int sum = 0;
|
||||
for (String personType : personTypes) {
|
||||
sum += v.getInt(personType);
|
||||
}
|
||||
v.addv("totalNum", sum);
|
||||
});
|
||||
|
||||
NutMap excelNameMap = new NutMap() {{
|
||||
put("小计", "totalNum");
|
||||
}};
|
||||
|
||||
for (String personType : personTypes) {
|
||||
excelNameMap.put(personType, personType);
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
if (hasAdminRoles) {
|
||||
if (searchType.equals("按分工会统计")) {
|
||||
entityList.add(new ExcelExportEntity("分工会代码", "unionCode", 20));
|
||||
entityList.add(new ExcelExportEntity("分工会名称", "unionName", 20));
|
||||
} else {
|
||||
entityList.add(new ExcelExportEntity("单位代码", "unitCode", 20));
|
||||
entityList.add(new ExcelExportEntity("单位名称", "unitName", 20));
|
||||
entityList.add(new ExcelExportEntity("分工会代码", "unionCode", 20));
|
||||
entityList.add(new ExcelExportEntity("分工会名称", "unionName", 20));
|
||||
}
|
||||
} else {
|
||||
entityList.add(new ExcelExportEntity("单位名称", "unitName", 20));
|
||||
entityList.add(new ExcelExportEntity("单位代码", "unitCode", 20));
|
||||
}
|
||||
|
||||
excelNameMap.forEach((k, v) -> {
|
||||
entityList.add(new ExcelExportEntity(k, v, 20));
|
||||
});
|
||||
|
||||
/*NutMap sumMap = new NutMap() {{
|
||||
if (hasAdminRoles) {
|
||||
if (searchType.equals("按分工会统计")) {
|
||||
put("unionName", "合计");
|
||||
} else {
|
||||
put("unitName", "合计");
|
||||
}
|
||||
} else {
|
||||
put("unitName", "合计");
|
||||
}
|
||||
// put(hasAdminRoles ? "unionName" : "unitName", "合计");
|
||||
put("teacherNum", memberList.stream().mapToInt(v -> v.getInt("teacherNum")).sum());
|
||||
put("wqxNum", memberList.stream().mapToInt(v -> v.getInt("wqxNum")).sum());
|
||||
put("schoolLaborNum", memberList.stream().mapToInt(v -> v.getInt("schoolLaborNum")).sum());
|
||||
put("unitLaborNum", memberList.stream().mapToInt(v -> v.getInt("unitLaborNum")).sum());
|
||||
put("CompLaborNum", memberList.stream().mapToInt(v -> v.getInt("CompLaborNum")).sum());
|
||||
put("logisticsNum", memberList.stream().mapToInt(v -> v.getInt("logisticsNum")).sum());
|
||||
put("unitSelfNum", memberList.stream().mapToInt(v -> v.getInt("unitSelfNum")).sum());
|
||||
put("retireNum", memberList.stream().mapToInt(v -> v.getInt("retireNum")).sum());
|
||||
put("totalNum", memberList.stream().mapToInt(v -> v.getInt("totalNum")).sum());
|
||||
}};
|
||||
|
||||
memberList.add(sumMap);*/
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(("人员类型.xls").getBytes("utf-8"), "ISO8859-1"));
|
||||
ExportParams exportParams = new ExportParams();
|
||||
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, memberList);
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.handle;
|
||||
|
||||
import io.v.nutz.base.utils.ViResource;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.sys.services.SysLocalProcessService;
|
||||
import io.v.nutz.sys.services.impl.SysLocalProcessServiceImpl;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberApplyRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.impl.MemberCommonServiceImpl;
|
||||
import lombok.Getter;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:MemberApplyController
|
||||
* @Date 2025/1/20 19:01
|
||||
* @注释 会员申请流程
|
||||
*/
|
||||
|
||||
@Getter
|
||||
public enum MemberApplyToDoHandler {
|
||||
|
||||
/**
|
||||
* 流程开始
|
||||
*/
|
||||
START_PROCESS() {
|
||||
@Override
|
||||
public void exec(MemberApplyRecord record, NutMap extra) {
|
||||
User user = dao.fetch(User.class, Cnd.where("id", "=", record.getUserId()));
|
||||
localProcessService.startProcess(
|
||||
"【会员入会申请】" + user.getUsername(),
|
||||
"MEMBER_APPLY@" + record.getId(),
|
||||
"",
|
||||
record.getUserId(),
|
||||
"/platform/member/apply",
|
||||
"/platform/member/apply/h5"
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 审核拒绝,重新修改申请
|
||||
*/
|
||||
CREATE_APPLY_RE_MODIFY_TASK() {
|
||||
@Override
|
||||
public void exec(MemberApplyRecord record, NutMap extra) {
|
||||
Sql sql = Sqls.fetchString(Sqls.create("select loginname from sys_user where id = @id").setParam("id", record.getUserId()).toString());
|
||||
dao.execute(sql);
|
||||
String loginname = sql.getString();
|
||||
|
||||
localProcessService.createTask(
|
||||
"MEMBER_APPLY@" + record.getId(),
|
||||
"MEMBER_APPLY_BACK",
|
||||
"退回重新修改",
|
||||
ShiroUtil.getUserId(),
|
||||
List.of(loginname),
|
||||
"/platform/member/apply",
|
||||
"/platform/member/apply",
|
||||
"/platform/member/apply",
|
||||
"/platform/member/apply"
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("MEMBER_APPLY@" + record.getId(), "退回重新修改");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 退回修改完成后提交
|
||||
*/
|
||||
COMPLETE_APPLY_RE_MODIFY_TASK() {
|
||||
@Override
|
||||
public void exec(MemberApplyRecord record, NutMap extra) {
|
||||
String nodeName = extra.getString("nodeName");
|
||||
localProcessService.completeTask(
|
||||
"MEMBER_APPLY_BACK",
|
||||
"MEMBER_APPLY@" + record.getId(),
|
||||
ShiroUtil.getUserId(),
|
||||
nodeName
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("MEMBER_APPLY@" + record.getId(), nodeName);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 创建校工会任务
|
||||
*/
|
||||
CREATE_SCHOOL_TASK() {
|
||||
@Override
|
||||
public void exec(MemberApplyRecord record, NutMap extra) {
|
||||
// 获取校工会会员管理员
|
||||
List<String> schoolLeaderLoginNames = memberService.getSchoolOrBranchUnionMemberAdminLoginNames("school", record.getUserId());
|
||||
localProcessService.createTask(
|
||||
"MEMBER_APPLY@" + record.getId(),
|
||||
"MEMBER_APPLY_SCHOOL_AUDIT",
|
||||
"校工会审核",
|
||||
ShiroUtil.getUserId(),
|
||||
schoolLeaderLoginNames,
|
||||
"/platform/member/apply/audit/school",
|
||||
"/platform/member/apply/audit/school",
|
||||
"/platform/member/apply/audit/school",
|
||||
"/platform/member/apply/audit/school"
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("MEMBER_APPLY@" + record.getId(), "校工会审核");
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 校工会完成
|
||||
*/
|
||||
COMPLETE_SCHOOL_TASK() {
|
||||
@Override
|
||||
public void exec(MemberApplyRecord record, NutMap extra) {
|
||||
String nodeName = extra.getString("nodeName");
|
||||
localProcessService.completeTask(
|
||||
"MEMBER_APPLY_SCHOOL_AUDIT",
|
||||
"MEMBER_APPLY@" + record.getId(),
|
||||
ShiroUtil.getUserId(),
|
||||
nodeName
|
||||
);
|
||||
localProcessService.updateProcessNodeName("MEMBER_APPLY@" + record.getId(), nodeName);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 创建分工会任务
|
||||
*/
|
||||
CREATE_UNION_TASK() {
|
||||
@Override
|
||||
public void exec(MemberApplyRecord record, NutMap extra) {
|
||||
List<String> unionLeaderLoginNames = extra.getAsList("unionLeaderLoginNames", String.class);
|
||||
localProcessService.createTask(
|
||||
"MEMBER_APPLY@" + record.getId(),
|
||||
"MEMBER_APPLY_UNION_AUDIT",
|
||||
"分工会审核",
|
||||
ShiroUtil.getUserId(),
|
||||
unionLeaderLoginNames,
|
||||
"/platform/member/apply/audit/union",
|
||||
"/platform/member/apply/audit/union",
|
||||
"/platform/member/apply/audit/union",
|
||||
"/platform/member/apply/audit/union"
|
||||
);
|
||||
localProcessService.updateProcessNodeName("MEMBER_APPLY@" + record.getId(), "分工会审核");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 分工会完成
|
||||
*/
|
||||
COMPLETE_UNION_TASK() {
|
||||
@Override
|
||||
public void exec(MemberApplyRecord record, NutMap extra) {
|
||||
String nodeName = extra.getString("nodeName");
|
||||
localProcessService.completeTask(
|
||||
"MEMBER_APPLY_UNION_AUDIT",
|
||||
"MEMBER_APPLY@" + record.getId(),
|
||||
ShiroUtil.getUserId(),
|
||||
nodeName
|
||||
);
|
||||
localProcessService.updateProcessNodeName("MEMBER_APPLY@" + record.getId(), nodeName);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 审核拒绝
|
||||
*/
|
||||
REFUSE_UNION_TASK(){
|
||||
@Override
|
||||
public void exec(MemberApplyRecord record, NutMap extra) {
|
||||
localProcessService.refuseProcess("MEMBER_APPLY@" + record.getId(),extra.getString("nodeName"));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 流程结束
|
||||
*/
|
||||
COMPLETE_PROCESS() {
|
||||
@Override
|
||||
public void exec(MemberApplyRecord record, NutMap extra) {
|
||||
localProcessService.completeProcess("MEMBER_APPLY@" + record.getId());
|
||||
localProcessService.updateProcessNodeName("MEMBER_APPLY@" + record.getId(), "审核通过");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public abstract void exec(MemberApplyRecord record, NutMap extra);
|
||||
|
||||
public Dao dao = ViResource.dao;
|
||||
public MemberCommonService memberService = ViResource.ioc.get(MemberCommonServiceImpl.class);
|
||||
public SysLocalProcessService localProcessService = ViResource.ioc.get(SysLocalProcessServiceImpl.class);
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.handle;
|
||||
|
||||
import io.v.nutz.base.utils.ViResource;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.sys.services.SysLocalProcessService;
|
||||
import io.v.nutz.sys.services.impl.SysLocalProcessServiceImpl;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.impl.MemberCommonServiceImpl;
|
||||
import lombok.Getter;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
public enum MemberChangeToDoHandler {
|
||||
|
||||
/**
|
||||
* 流程开始
|
||||
*/
|
||||
START_PROCESS() {
|
||||
@Override
|
||||
public void exec(MemberChangeRecord record, NutMap extra) {
|
||||
User user = dao.fetch(User.class, Cnd.where("id", "=", record.getUserId()));
|
||||
localProcessService.startProcess(
|
||||
"【会员变更】" + user.getUsername(),
|
||||
"MEMBER_CHANGE@" + record.getId(),
|
||||
"",
|
||||
record.getUserId(),
|
||||
"/platform/member/change/apply",
|
||||
"/platform/member/change/apply"
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 审核拒绝
|
||||
*/
|
||||
REFUSE_UNION_TASK(){
|
||||
@Override
|
||||
public void exec(MemberChangeRecord record, NutMap extra) {
|
||||
localProcessService.refuseProcess("MEMBER_CHANGE@" + record.getId(),extra.getString("nodeName"));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 审核退回,重新修改申请
|
||||
*/
|
||||
CREATE_APPLY_RE_MODIFY_TASK() {
|
||||
@Override
|
||||
public void exec(MemberChangeRecord record, NutMap extra) {
|
||||
String nodeName = extra.getString("nodeName");
|
||||
Sql sql = Sqls.fetchString(Sqls.create("select loginname from sys_user where id = @id").setParam("id", record.getUserId()).toString());
|
||||
dao.execute(sql);
|
||||
String loginname = sql.getString();
|
||||
|
||||
localProcessService.createTask(
|
||||
"MEMBER_CHANGE@" + record.getId(),
|
||||
"MEMBER_CHANGE_BACK",
|
||||
nodeName,
|
||||
ShiroUtil.getUserId(),
|
||||
List.of(loginname),
|
||||
"/platform/member/change/apply",
|
||||
"/platform/member/change/apply",
|
||||
"/platform/member/change/apply",
|
||||
"/platform/member/change/apply"
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("MEMBER_CHANGE@" + record.getId(), nodeName);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 退回修改完成后提交
|
||||
*/
|
||||
COMPLETE_APPLY_RE_MODIFY_TASK() {
|
||||
@Override
|
||||
public void exec(MemberChangeRecord record, NutMap extra) {
|
||||
String nodeName = extra.getString("nodeName");
|
||||
localProcessService.completeTask(
|
||||
"MEMBER_CHANGE_BACK",
|
||||
"MEMBER_CHANGE@" + record.getId(),
|
||||
ShiroUtil.getUserId(),
|
||||
nodeName
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("MEMBER_CHANGE@" + record.getId(), nodeName);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建分工会任务
|
||||
*/
|
||||
CREATE_UNION_TASK() {
|
||||
@Override
|
||||
public void exec(MemberChangeRecord record, NutMap extra) {
|
||||
List<String> branchLeaders = memberService.getSchoolOrBranchUnionMemberAdminLoginNames("branch", record.getUserId());
|
||||
localProcessService.createTask(
|
||||
"MEMBER_CHANGE@" + record.getId(),
|
||||
"MEMBER_CHANGE_BRANCH_UNION_AUDIT",
|
||||
"分工会审核",
|
||||
ShiroUtil.getUserId(),
|
||||
branchLeaders,
|
||||
"/platform/member/change/audit/union",
|
||||
"/platform/member/change/audit/union",
|
||||
"/platform/member/change/audit/union",
|
||||
"/platform/member/change/audit/union"
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("MEMBER_CHANGE@" + record.getId(), "分工会审核");
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 分工会完成
|
||||
*/
|
||||
COMPLETE_UNION_TASK() {
|
||||
@Override
|
||||
public void exec(MemberChangeRecord record, NutMap extra) {
|
||||
String nodeName = extra.getString("nodeName");
|
||||
localProcessService.completeTask(
|
||||
"MEMBER_CHANGE_BRANCH_UNION_AUDIT",
|
||||
"MEMBER_CHANGE@" + record.getId(),
|
||||
ShiroUtil.getUserId(),
|
||||
nodeName
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("MEMBER_CHANGE@" + record.getId(), nodeName);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建校工会任务
|
||||
*/
|
||||
CREATE_SCHOOL_TASK() {
|
||||
@Override
|
||||
public void exec(MemberChangeRecord record, NutMap extra) {
|
||||
List<String> schoolLeaders = memberService.getSchoolOrBranchUnionMemberAdminLoginNames("school", record.getUserId());
|
||||
localProcessService.createTask(
|
||||
"MEMBER_CHANGE@" + record.getId(),
|
||||
"MEMBER_CHANGE_SCHOOL_UNION_AUDIT",
|
||||
"校工会审核",
|
||||
ShiroUtil.getUserId(),
|
||||
schoolLeaders,
|
||||
"/platform/member/change/audit/school",
|
||||
"/platform/member/change/audit/school",
|
||||
"/platform/member/change/audit/school",
|
||||
"/platform/member/change/audit/school"
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("MEMBER_CHANGE@" + record.getId(), "校工会审核");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 校工会完成
|
||||
*/
|
||||
COMPLETE_SCHOOL_TASK() {
|
||||
@Override
|
||||
public void exec(MemberChangeRecord record, NutMap extra) {
|
||||
String nodeName = extra.getString("nodeName");
|
||||
localProcessService.completeTask(
|
||||
"MEMBER_CHANGE_SCHOOL_UNION_AUDIT",
|
||||
"MEMBER_CHANGE@" + record.getId(),
|
||||
ShiroUtil.getUserId(),
|
||||
nodeName
|
||||
);
|
||||
localProcessService.updateProcessNodeName("MEMBER_CHANGE@" + record.getId(), nodeName);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 流程结束
|
||||
*/
|
||||
COMPLETE_PROCESS() {
|
||||
@Override
|
||||
public void exec(MemberChangeRecord record, NutMap extra) {
|
||||
localProcessService.completeProcess("MEMBER_CHANGE@" + record.getId());
|
||||
localProcessService.updateProcessNodeName("MEMBER_CHANGE@" + record.getId(), "审核通过");
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 删除流程及任务
|
||||
*/
|
||||
DELETE_PROCESS_AND_TASK() {
|
||||
@Override
|
||||
public void exec(MemberChangeRecord record, NutMap extra) {
|
||||
localProcessService.deleteProcessInstance("MEMBER_CHANGE@" + record.getId());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public abstract void exec(MemberChangeRecord record, NutMap extra);
|
||||
|
||||
public Dao dao = ViResource.dao;
|
||||
public MemberCommonService memberService = ViResource.ioc.get(MemberCommonServiceImpl.class);
|
||||
public SysLocalProcessService localProcessService = ViResource.ioc.get(SysLocalProcessServiceImpl.class);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.job;
|
||||
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberHistoryService;
|
||||
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;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
/**
|
||||
* Todo
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/29
|
||||
* @since 1.0
|
||||
*/
|
||||
@IocBean
|
||||
@Slf4j
|
||||
public class MemberArchiveJob implements Job {
|
||||
|
||||
@Inject
|
||||
private MemberHistoryService memberHistoryService;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
log.info("新的一年到了,备份会员咯....");
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
memberHistoryService.archive();
|
||||
log.info("备份成功!!!睡觉觉咯,来年再见!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info("备份失败!!!玩个锤子。");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.model;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员申请记录
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/25
|
||||
* @since 1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Table("member_apply_record")
|
||||
public class MemberApplyRecord {
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("用户id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Size(max = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Size(max = 100)
|
||||
private String username;
|
||||
|
||||
@Column
|
||||
@Comment("工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Size(max = 100)
|
||||
private String loginname;
|
||||
|
||||
@Column
|
||||
@Comment("出生日期")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String birthday;
|
||||
|
||||
@Column
|
||||
@Comment("单位id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Size(max = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
@Size(max = 200)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Size(max = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("工会名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Size(max = 50)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("性别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
@Size(max = 10)
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@Comment("证件号码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@Size(max = 30)
|
||||
private String idCard;
|
||||
|
||||
@Column
|
||||
@Comment("民族")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Size(max = 20)
|
||||
private String nation;
|
||||
|
||||
@Column
|
||||
@Comment("政治面貌")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Size(max = 100)
|
||||
private String political;
|
||||
|
||||
@Column
|
||||
@Comment("学历")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Size(max = 20)
|
||||
private String education;
|
||||
|
||||
@Column
|
||||
@Comment("学位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String academicDegree;
|
||||
|
||||
@Column
|
||||
@Comment("党政职务")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Size(max = 50)
|
||||
private String position;
|
||||
|
||||
@Column
|
||||
@Comment("在职状态")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Size(max = 50)
|
||||
private String userState;
|
||||
|
||||
@Column
|
||||
@Comment("人事编制")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Size(max = 50)
|
||||
private String preparedBy;
|
||||
|
||||
@Column
|
||||
@Comment("人员类别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Size(max = 50)
|
||||
private String personType;
|
||||
|
||||
@Column
|
||||
@Comment("手机号码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Size(max = 32)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("电子邮箱")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
@Size(max = 255)
|
||||
private String email;
|
||||
|
||||
@Column
|
||||
@Comment("会员状态")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default(value = "0")
|
||||
private Boolean member;
|
||||
|
||||
@Column
|
||||
@Comment("福利会员状态")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default(value = "0")
|
||||
private Boolean welfareMember;
|
||||
|
||||
@Column
|
||||
@Comment("校区")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String campus;
|
||||
|
||||
@Column
|
||||
@Comment("家庭主要成员及其工作单位")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> families;
|
||||
|
||||
@Column
|
||||
@Comment("个人简况")
|
||||
@ColDefine(type = ColType.VARCHAR, customType = "text")
|
||||
private String vita;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String notes;
|
||||
|
||||
@Column
|
||||
@Comment("当前状态")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer applyStateId;
|
||||
|
||||
@Column
|
||||
@Comment("校工会审核id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String schoolUnionAuditId;
|
||||
|
||||
@Column
|
||||
@Comment("分工会审核id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String branchUnionAuditId;
|
||||
|
||||
@Column
|
||||
@Comment("变更类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String changeType;
|
||||
|
||||
@Column
|
||||
@Comment("变更类型集合")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> changeTypes;
|
||||
|
||||
@Column
|
||||
@Comment("变更来源")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String changeOrigin;
|
||||
|
||||
@Column
|
||||
@Comment("申请时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@PrevInsert(now = true)
|
||||
private Date applyDateTime;
|
||||
|
||||
@Column
|
||||
@Comment("分配的工会关系")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String allocationUnionId;
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.model;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员变更记录
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/25
|
||||
* @since 1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Table("member_change_record")
|
||||
public class MemberChangeRecord {
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("用户id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Size(max = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Size(max = 100)
|
||||
private String username;
|
||||
|
||||
@Column
|
||||
@Comment("工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Size(max = 100)
|
||||
private String loginname;
|
||||
|
||||
@Column
|
||||
@Comment("单位id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Size(max = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
@Size(max = 200)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Size(max = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("工会名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Size(max = 50)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("性别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
@Size(max = 10)
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@Comment("出生日期")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
@Size(max = 10)
|
||||
private String birthday;
|
||||
|
||||
@Column
|
||||
@Comment("证件号码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@Size(max = 30)
|
||||
private String idCard;
|
||||
|
||||
@Column
|
||||
@Comment("民族")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Size(max = 20)
|
||||
private String nation;
|
||||
|
||||
@Column
|
||||
@Comment("政治面貌")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Size(max = 100)
|
||||
private String political;
|
||||
|
||||
@Column
|
||||
@Comment("学历")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Size(max = 20)
|
||||
private String education;
|
||||
|
||||
@Column
|
||||
@Comment("学位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String academicDegree;
|
||||
|
||||
@Column
|
||||
@Comment("党政职务")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Size(max = 50)
|
||||
private String position;
|
||||
|
||||
@Column
|
||||
@Comment("在职状态")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Size(max = 50)
|
||||
private String userState;
|
||||
|
||||
@Column
|
||||
@Comment("人事编制")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Size(max = 50)
|
||||
private String preparedBy;
|
||||
|
||||
@Column
|
||||
@Comment("人员类别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Size(max = 50)
|
||||
private String personType;
|
||||
|
||||
@Column
|
||||
@Comment("手机号码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Size(max = 32)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("电子邮箱")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
@Size(max = 255)
|
||||
private String email;
|
||||
|
||||
@Column
|
||||
@Comment("会员状态")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default(value = "0")
|
||||
private Boolean member;
|
||||
|
||||
@Column
|
||||
@Comment("福利会员状态")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default(value = "0")
|
||||
private Boolean welfareMember;
|
||||
|
||||
@Column
|
||||
@Comment("校区")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String campus;
|
||||
|
||||
@Column
|
||||
@Comment("家庭主要成员及其工作单位")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> families;
|
||||
|
||||
@Column
|
||||
@Comment("个人简况")
|
||||
@ColDefine(type = ColType.VARCHAR, customType = "text")
|
||||
private String vita;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String notes;
|
||||
|
||||
@Column
|
||||
@Comment("当前状态")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer applyStateId;
|
||||
|
||||
@Column
|
||||
@Comment("校工会审核id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String schoolUnionAuditId;
|
||||
|
||||
@Column
|
||||
@Comment("分工会审核id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String branchUnionAuditId;
|
||||
|
||||
@Column
|
||||
@Comment("是否加入会员组别")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isJoinActivityMemberScope;
|
||||
|
||||
@Column
|
||||
@Comment("是否退出会员组别")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isExitActivityMemberScope;
|
||||
|
||||
@Column
|
||||
@Comment("是否加入福利项目")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isJoinWelfareProject;
|
||||
|
||||
@Column
|
||||
@Comment("福利项目id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String welfareProjectId;
|
||||
|
||||
@Column
|
||||
@Comment("变更类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String changeType;
|
||||
|
||||
@Column
|
||||
@Comment("变更类型集合")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> changeTypes;
|
||||
|
||||
@Column
|
||||
@Comment("变更来源")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String changeOrigin;
|
||||
|
||||
@Column
|
||||
@Comment("申请时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@PrevInsert(now = true)
|
||||
private Date applyDateTime;
|
||||
|
||||
private Boolean edit;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.model;
|
||||
|
||||
import cn.wizzer.framework.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @ClassName MemberCheckSelfTask
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2023/6/14 9:59
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Table
|
||||
public class MemberCheckSelfTask extends BaseModel {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("任务ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String taskId;
|
||||
|
||||
@Column
|
||||
@Comment("用户ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("是否核对完成")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isFinish;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.model;
|
||||
|
||||
import cn.wizzer.framework.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.zhgh.member.model.MemberCheckTask
|
||||
* @Description: TODO
|
||||
* @Author zxc
|
||||
* @Date 2022/10/21:10:34
|
||||
* @Version V1.0
|
||||
**/
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Table
|
||||
public class MemberCheckTask extends BaseModel {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("任务名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String taskName;
|
||||
|
||||
@Column
|
||||
@Comment("年度")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer year;
|
||||
|
||||
@Column
|
||||
@Comment("说明")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String description;
|
||||
|
||||
@Column
|
||||
@Comment("开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date startTime;
|
||||
|
||||
@Column
|
||||
@Comment("结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* @see io.v.nutz.zhgh.member.constant.MemberChangeRecordMode
|
||||
*/
|
||||
@Column
|
||||
@Comment("模式")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer taskMode;
|
||||
|
||||
@Column
|
||||
@Comment("创建模式1.小组核对2.个人核对")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer createTaskMode;
|
||||
|
||||
@Column
|
||||
@Comment("核对模式(字典)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer welfareCheckFilterMode;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.model;
|
||||
|
||||
import cn.wizzer.framework.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.zhgh.member.model.MemberCheckUnionTask
|
||||
* @Description: TODO
|
||||
* @Author zxc
|
||||
* @Date 2022/10/21:10:34
|
||||
* @Version V1.0
|
||||
**/
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Table
|
||||
public class MemberCheckUnionTask extends BaseModel {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("任务ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String taskId;
|
||||
|
||||
@Column
|
||||
@Comment("工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("小组ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String groupUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("是否核对完成")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isFinish;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.model;
|
||||
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
/**
|
||||
* 历史会员表
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/29
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("member_history")
|
||||
public class MemberHistory extends Sys_user {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("年度")
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
private Integer year;
|
||||
|
||||
@Column
|
||||
@Comment("用户ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.param.pageForm;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:MemberApplyPageForm
|
||||
* @Date 2025/2/12 16:09
|
||||
* @注释 会员入会查询表单
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MemberApplyPageForm extends PageForm {
|
||||
|
||||
// 是否审核
|
||||
private Boolean audit;
|
||||
|
||||
// 工会id
|
||||
private String unionId;
|
||||
|
||||
// 单位id
|
||||
private String unitId;
|
||||
|
||||
// 在职状态
|
||||
private String userState;
|
||||
|
||||
// 人员类型
|
||||
private String personType;
|
||||
|
||||
|
||||
public void buildSearch(Cnd cnd, String prefix){
|
||||
if (cnd == null) {
|
||||
cnd = Cnd.NEW();
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(this.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike(prefix + "username", this.getSearchKeyword());
|
||||
seg.orLike(prefix + "loginname", this.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
cnd.andEX(prefix + "unionId", "=", this.getUnionId());
|
||||
cnd.andEX(prefix + "unitId", "=", this.getUnitId());
|
||||
cnd.andEX(prefix + "userState", "=", this.getUserState());
|
||||
cnd.andEX(prefix + "personType", "=", this.getPersonType());
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.param.pageForm;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:MemberChangePageForm
|
||||
* @Date 2025/2/14 14:05
|
||||
* @注释
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MemberChangePageForm extends PageForm {
|
||||
|
||||
// 是否审核
|
||||
private Boolean audit;
|
||||
|
||||
// 工会id
|
||||
private String unionId;
|
||||
|
||||
// 单位id
|
||||
private String unitId;
|
||||
|
||||
// 在职状态
|
||||
private String userState;
|
||||
|
||||
// 人员类型
|
||||
private String personType;
|
||||
|
||||
|
||||
public void buildSearch(Cnd cnd, String prefix){
|
||||
if (cnd == null) {
|
||||
cnd = Cnd.NEW();
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(this.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike(prefix + "username", this.getSearchKeyword());
|
||||
seg.orLike(prefix + "loginname", this.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
cnd.andEX(prefix + "unionId", "=", this.getUnionId());
|
||||
cnd.andEX(prefix + "unitId", "=", this.getUnitId());
|
||||
cnd.andEX(prefix + "userState", "=", this.getUserState());
|
||||
cnd.andEX(prefix + "personType", "=", this.getPersonType());
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.service;
|
||||
|
||||
|
||||
import io.v.nutz.base.service.ViService;
|
||||
|
||||
/**
|
||||
* @ClassName MemberCheckPersonalService
|
||||
* @Author zzr
|
||||
* @Date 2023/6/14 14:19
|
||||
*/
|
||||
public interface MemberCheckPersonalService extends ViService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Todo
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/25
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface MemberCommonService extends ViService<Sys_user> {
|
||||
|
||||
/**
|
||||
* 会员变更记录
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> memberChangeRecords(String userId);
|
||||
|
||||
|
||||
/**
|
||||
* 会员变更记录
|
||||
*
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Pagination memberChangeRecords(PageForm pageForm, CndPlus cnd);
|
||||
|
||||
/**
|
||||
* 某会员历史变更记录
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> memberHistoryRecordsByUserId(String userId);
|
||||
|
||||
|
||||
/**
|
||||
* 获取校工会或分工会会员管理员的工号
|
||||
* queryType 传 school 查询校工会会员管理员工号,branch 查询分工会会员管理员工号
|
||||
* @return
|
||||
*/
|
||||
List<String> getSchoolOrBranchUnionMemberAdminLoginNames(String queryType, String userId);
|
||||
|
||||
|
||||
NutMap getDictAllowChangeFields();
|
||||
|
||||
/**
|
||||
* 获取变更详情
|
||||
* @param recordId 变更记录id
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> getChangeInfos(String recordId);
|
||||
|
||||
List<NutMap> getChangeInfos(MemberChangeRecord record);
|
||||
|
||||
/**
|
||||
* 比较有哪些变更类型
|
||||
* @param record
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
List<String> compareChangeType(MemberChangeRecord record, User user);
|
||||
|
||||
/**
|
||||
* 存储比较变更信息并更新会员信息
|
||||
* @param recordId
|
||||
*/
|
||||
void compareChangeInfoAndUpdateMember(String recordId);
|
||||
|
||||
/**
|
||||
* 获取会员的变更信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> getAllChangeInfo(String userId);
|
||||
|
||||
|
||||
/**
|
||||
* 比较两个对象,并记录变更的字段工具
|
||||
*
|
||||
* @param newMap 新数据
|
||||
* @param sourceMap 原数据
|
||||
* @param fieldsMap 变更字段
|
||||
* @param changeList 变更集合
|
||||
*/
|
||||
void extractChange(NutMap newMap, NutMap sourceMap, String fieldName, Map<String, String> fieldsMap, List<NutMap> changeList);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.service;
|
||||
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberHistory;
|
||||
|
||||
/**
|
||||
* Todo
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/1/25
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface MemberHistoryService extends ViService<MemberHistory> {
|
||||
|
||||
/**
|
||||
* 存档
|
||||
*/
|
||||
void archive();
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.service.impl;
|
||||
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCheckPersonalService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @ClassName MemberCheckPersonalServiceImpl
|
||||
* @Author zzr
|
||||
* @Date 2023/6/14 14:19
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class MemberCheckPersonalServiceImpl extends ViServiceImpl implements MemberCheckPersonalService {
|
||||
|
||||
public MemberCheckPersonalServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+442
@@ -0,0 +1,442 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.*;
|
||||
import io.v.nutz.sys.services.SysDictService;
|
||||
import io.v.nutz.sys.services.SysRoleService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityUserScope;
|
||||
import io.v.nutz.zhgh.data.model.UserHistory;
|
||||
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeOrigin;
|
||||
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeType;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import io.v.nutz.zhgh.staffmanage.specialstaff.model.SpecialStaff;
|
||||
import io.v.nutz.zhgh.welfare.model.WelfareList;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.Lang;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @author 1V
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@CacheDefaults(cacheName = "member")
|
||||
public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements MemberCommonService {
|
||||
public MemberCommonServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
private final String MEMBER_CHANGE_RECORDS = """
|
||||
SELECT
|
||||
mcr.*,
|
||||
u.unitname AS userUnitName,
|
||||
u.unionname AS userUnionName,
|
||||
u.threeUnitName AS userThreeUnitName,
|
||||
u.unionGroupName AS userUnionGroupName,
|
||||
state.stateId,
|
||||
state.stateName,
|
||||
state.stateColor
|
||||
FROM
|
||||
member_change_record mcr
|
||||
LEFT JOIN `user` u ON mcr.userId = u.id
|
||||
LEFT JOIN audit_state state ON mcr.applyStateId = state.stateId
|
||||
$condition
|
||||
""";
|
||||
|
||||
@Override
|
||||
public List<NutMap> memberChangeRecords(String userId) {
|
||||
Sql sql = Sqls.create(MEMBER_CHANGE_RECORDS);
|
||||
sql.setCondition(Cnd.where("mcr.userId", "=", userId).desc("mcr.applyTime"));
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination memberChangeRecords(PageForm pageForm, CndPlus cnd) {
|
||||
Sql sql = Sqls.create(MEMBER_CHANGE_RECORDS).setCondition(cnd);
|
||||
return list(pageForm, sql);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<NutMap> memberHistoryRecordsByUserId(String userId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
his.id,
|
||||
his.changeTime,
|
||||
his.loginname,
|
||||
his.username,
|
||||
his.mobile,
|
||||
his.birthday,
|
||||
his.userState,
|
||||
his.personType,
|
||||
his.sex,
|
||||
his.changeTypes,
|
||||
his.changeOrigin,
|
||||
his.changeOperator,
|
||||
his.memberChangeRecordId,
|
||||
his.changeReason,
|
||||
his.lastHistoryId,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
mcr.stateId,
|
||||
state.stateName,
|
||||
state.stateColor
|
||||
FROM
|
||||
`user_history` his
|
||||
LEFT JOIN member_change_record mcr ON mcr.id = his.memberChangeRecordId
|
||||
LEFT JOIN audit_state state ON mcr.stateId = state.stateId
|
||||
LEFT JOIN `user` u ON u.loginname = his.loginname
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("u.id", "=", userId);
|
||||
cnd.desc("his.changeTime");
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> getSchoolOrBranchUnionMemberAdminLoginNames(String queryType, String userId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname
|
||||
FROM
|
||||
`sys_user_role` userRole
|
||||
LEFT JOIN sys_role role ON role.id = userRole.roleId
|
||||
LEFT JOIN `user` u ON u.id = userRole.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if ("school".equals(queryType)) {
|
||||
cnd.and("role.`code`", "=", "SchoolUnionMemberAdmin");
|
||||
} else {
|
||||
Sql sqlUnionId = Sqls.fetchString(Sqls.create("select unionid from `user` where id = @id").setParam("id", userId).toString());
|
||||
dao().execute(sqlUnionId);
|
||||
String unionid = sql.getString();
|
||||
cnd.and("u.unionid", "=",unionid);
|
||||
cnd.and("role.`code`", "=", "BranchUnionMemberAdmin");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.strList());
|
||||
dao().execute(sql);
|
||||
return sql.getList(String.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap getDictAllowChangeFields() {
|
||||
//获取可变更字段
|
||||
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");
|
||||
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
|
||||
dictMap.put("member", "会员状态");
|
||||
dictMap.put("welfareMember", "福利会员状态");
|
||||
return NutMap.NEW().addv("allowChangeFieldNames", allowChangeFieldNames).addv("dictMap", dictMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取变更记录详情
|
||||
*
|
||||
* @param recordId 变更记录id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<NutMap> getChangeInfos(String recordId) {
|
||||
UserHistory history = dao().fetch(UserHistory.class, Cnd.where("recordId", "=", recordId));
|
||||
if (Lang.isNotEmpty(history)) {
|
||||
return history.getChangeInfos();
|
||||
} else {
|
||||
MemberChangeRecord record = dao().fetch(MemberChangeRecord.class, recordId);
|
||||
return getChangeInfos(record);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> getChangeInfos(MemberChangeRecord record) {
|
||||
User info = dao().fetch(User.class, Cnd.where("id", "=", record.getUserId()));
|
||||
|
||||
NutMap map = getDictAllowChangeFields();
|
||||
Set<String> allowChangeFieldNames = map.getAs("allowChangeFieldNames", Set.class);
|
||||
Map<String, String> dictMap = map.getAs("dictMap", Map.class);
|
||||
|
||||
// 新数据
|
||||
NutMap newMap = Lang.obj2nutmap(record);
|
||||
// 原数据
|
||||
NutMap sourceMap = Lang.obj2nutmap(info);
|
||||
List<NutMap> changeList = new ArrayList<>();
|
||||
|
||||
for (String fieldName : allowChangeFieldNames) {
|
||||
extractChange(newMap, sourceMap, fieldName, dictMap, changeList);
|
||||
}
|
||||
return changeList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> compareChangeType(MemberChangeRecord record, User user) {
|
||||
List<String> changeTypes = new ArrayList<>();
|
||||
changeTypes.add(MemberChangeType.BASIC_CHANGE.getType());
|
||||
if (!ObjectUtil.equals(user.getUserState(), record.getUserState())) {
|
||||
List<MemberChangeType> list = Arrays.stream(MemberChangeType.values())
|
||||
.filter(v -> v.getChangeTypeName().equals(record.getUserState())).toList();
|
||||
if (Lang.isNotEmpty(list)) {
|
||||
changeTypes.add(list.get(0).getType());
|
||||
}
|
||||
}
|
||||
if (!ObjectUtil.equals(user.getMember() == 1, record.getMember())){
|
||||
if (record.getMember()) {
|
||||
changeTypes.add(MemberChangeType.RESTORE.getType());
|
||||
} else {
|
||||
changeTypes.add(MemberChangeType.WITHDRAWAL.getType());
|
||||
}
|
||||
}
|
||||
if (!ObjectUtil.equals(user.getUnitid(), record.getUnitId())) {
|
||||
changeTypes.add(MemberChangeType.UNIT_CHANGE.getType());
|
||||
}
|
||||
if (!ObjectUtil.equals(user.getUnionid(), record.getUnionId())) {
|
||||
changeTypes.add(MemberChangeType.UNION_CHANGE.getType());
|
||||
}
|
||||
return changeTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void compareChangeInfoAndUpdateMember(String recordId) {
|
||||
MemberChangeRecord record = dao().fetch(MemberChangeRecord.class, recordId);
|
||||
List<NutMap> changeList = getChangeInfos(record);
|
||||
|
||||
// 如果有工会关系人员,这个user用来存储数据
|
||||
User user = dao().fetch(User.class, Cnd.where("id", "=", record.getUserId()));
|
||||
// 获取会员信息,用于存储变更记录
|
||||
Sys_user info = dao().fetch(Sys_user.class, Cnd.where("id", "=", record.getUserId()));
|
||||
String userId = info.getId();
|
||||
UserHistory history = new UserHistory();
|
||||
if (Lang.isNotEmpty(changeList)) {
|
||||
BeanUtil.copyProperties(info, history);
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(history)) {
|
||||
history.setRecordId(recordId);
|
||||
history.setChangeTime(DateUtil.date());
|
||||
history.setChangeTypes(record.getChangeTypes());
|
||||
history.setChangeOrigin(record.getChangeOrigin());
|
||||
history.setChangeInfos(changeList);
|
||||
String changeInfos = changeList.stream().map(v -> {
|
||||
return "(变更字段:" + v.getString("fieldName") + ",变更前:" + HtmlUtil.cleanHtmlTag(v.getString("sourceValue")) + ",变更后:" + HtmlUtil.cleanHtmlTag(v.getString("newValue")) + ")";
|
||||
}).collect(Collectors.joining(";"));
|
||||
history.setChangeInfosStr(changeInfos);
|
||||
|
||||
// 加入会员
|
||||
if (record.getMember()) {
|
||||
int activityCount = dao().count(ActivityUserScope.class, Cnd.where("userId", "=", userId).and("groupId", "=", 1));
|
||||
int memberCount = dao().count(Sys_user_role.class, Cnd.where("userId", "=", userId).and("roleId", "=", Roles.MEMBER));
|
||||
if (activityCount <= 0) {
|
||||
// 取消或加入会员组别
|
||||
if (record.getIsJoinActivityMemberScope() != null && record.getIsJoinActivityMemberScope()) {
|
||||
ActivityUserScope scope = new ActivityUserScope();
|
||||
scope.setUserId(userId);
|
||||
scope.setGroupId(1);
|
||||
scope.setGroupName("工会会员");
|
||||
dao().insert(scope);
|
||||
}
|
||||
}
|
||||
if (memberCount <= 0) {
|
||||
Sys_user_role userRole = new Sys_user_role();
|
||||
userRole.setUserId(userId);
|
||||
userRole.setRoleId(Roles.MEMBER);
|
||||
dao().insert(userRole);
|
||||
}
|
||||
// 杭医特有,其他学校请删除
|
||||
record.setPreparedBy("会员");
|
||||
} else {
|
||||
if (record.getIsExitActivityMemberScope() != null && record.getIsExitActivityMemberScope()) {
|
||||
dao().clear(ActivityUserScope.class, Cnd.where("userId", "=", userId).and("groupId", "=", 1));
|
||||
}
|
||||
dao().clear(Sys_user_role.class, Cnd.where("userId", "=", userId).and("roleId", "=", Roles.MEMBER));
|
||||
// 杭医特有,其他学校请删除
|
||||
record.setPreparedBy("教职工");
|
||||
}
|
||||
|
||||
// 加入福利会员 是否加入福利项目
|
||||
if (record.getWelfareMember() && record.getIsJoinWelfareProject() != null && record.getIsJoinWelfareProject()) {
|
||||
WelfareList welfareList = new WelfareList();
|
||||
welfareList.setId(R.UU32());
|
||||
welfareList.setProjectId(record.getWelfareProjectId());
|
||||
welfareList.setUserId(userId);
|
||||
welfareList.setIsReceive(false);
|
||||
welfareList.setIsAutoSelect(false);
|
||||
welfareList.setUserState(record.getUserState());
|
||||
welfareList.setPersonType(record.getPersonType());
|
||||
welfareList.setWelfareUnitId(record.getUnitId());
|
||||
dao().insert(welfareList);
|
||||
}
|
||||
|
||||
// 到此,表明审核通过,需要存储历史数据,并修改用户数据
|
||||
BeanUtil.copyProperties(record, info);
|
||||
info.setId(userId);
|
||||
info.setIdcard(record.getIdCard());
|
||||
|
||||
// 如果有单位变更,则需要记录单位关系
|
||||
if (record.getChangeTypes().contains(MemberChangeType.UNIT_CHANGE.getType())) {
|
||||
info.setUnitid(record.getUnitId());
|
||||
}
|
||||
|
||||
// 如果工会发生变更了,就是工会关系变更,记录到特殊人员表中
|
||||
if (record.getChangeTypes().contains(MemberChangeType.UNION_CHANGE.getType())) {
|
||||
Sys_union union = dao().fetch(Sys_union.class, Cnd.where("id", "=", record.getUnionId()));
|
||||
SpecialStaff staff = new SpecialStaff();
|
||||
staff.setUserId(userId);
|
||||
staff.setPersonnelRelationUnitId(user.getUnitid());
|
||||
staff.setPersonnelRelationUnitName(user.getUnitname());
|
||||
staff.setUnionRelationUnionId(union.getId());
|
||||
staff.setUnionRelationUnionName(union.getUnionname());
|
||||
staff.setIsManyUnit(false);
|
||||
staff.setSpecialStaffType("HMC_RELATION");
|
||||
dao().insert(staff);
|
||||
}
|
||||
|
||||
dao().updateIgnoreNull(info);
|
||||
dao().insert(history);
|
||||
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有变更记录
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<NutMap> getAllChangeInfo(String userId) {
|
||||
List<NutMap> resultMapList = new ArrayList<>();
|
||||
|
||||
Sql sql = Sqls.fetchString(Sqls.create("select loginname from sys_user where id = @id").setParam("id", userId).toString());
|
||||
dao().execute(sql);
|
||||
String loginName = sql.getString();
|
||||
|
||||
MemberChangeRecord record = dao().fetch(MemberChangeRecord.class, Cnd.where("userId", "=", userId).desc("applyDateTime"));
|
||||
|
||||
List<UserHistory> historyList = dao().query(UserHistory.class, Cnd.where("loginname", "=", loginName)
|
||||
.and("changeInfos", "is not", null).desc("changeTime"));
|
||||
|
||||
List<String> recordList = historyList.stream().map(UserHistory::getRecordId).toList();
|
||||
|
||||
if (Lang.isNotEmpty(record) && !recordList.contains(record.getId())) {
|
||||
NutMap map = NutMap.NEW();
|
||||
List<NutMap> changeInfos = getChangeInfos(record.getId());
|
||||
map.put("changeInfos", changeInfos);
|
||||
map.put("timestamp", DateUtil.format(record.getApplyDateTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
map.put("changeOriginName", MemberChangeOrigin.valueOf(MemberChangeOrigin.class, record.getChangeOrigin()).changeOriginName);
|
||||
resultMapList.add(map);
|
||||
}
|
||||
for (UserHistory history : historyList) {
|
||||
NutMap map = NutMap.NEW();
|
||||
List<NutMap> changeInfos = history.getChangeInfos();
|
||||
map.put("changeInfos", changeInfos);
|
||||
map.put("timestamp", DateUtil.format(history.getChangeTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
map.put("changeOriginName", MemberChangeOrigin.valueOf(MemberChangeOrigin.class, history.getChangeOrigin()).changeOriginName);
|
||||
resultMapList.add(map);
|
||||
}
|
||||
return resultMapList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 比较两个对象,并记录变更的字段工具
|
||||
*
|
||||
* @param newMap 新数据
|
||||
* @param sourceMap 原数据
|
||||
* @param fieldsMap 变更字段
|
||||
* @param changeList 变更集合
|
||||
*/
|
||||
@Override
|
||||
public void extractChange(NutMap newMap, NutMap sourceMap, String fieldName, Map<String, String> fieldsMap, List<NutMap> changeList) {
|
||||
try {
|
||||
Object currentValue = this.booleanVerification(newMap.get(fieldName));
|
||||
Object previousValue = this.booleanVerification(sourceMap.get(fieldName));
|
||||
|
||||
if (!ObjectUtil.equals(currentValue, previousValue)) {
|
||||
String name = fieldsMap.getOrDefault(fieldName, fieldName);
|
||||
if ("unitId".equals(fieldName)) {
|
||||
List<Sys_unit> unitList = dao().query(Sys_unit.class,
|
||||
Cnd.where("id", "in", List.of(previousValue, currentValue)));
|
||||
Object finalPreviousValue = previousValue;
|
||||
previousValue = unitList.stream().filter(v -> v.getId().equals(String.valueOf(finalPreviousValue)))
|
||||
.findFirst().orElse(new Sys_unit()).getName();
|
||||
Object finalCurrentValue = currentValue;
|
||||
currentValue = unitList.stream().filter(v -> v.getId().equals(String.valueOf(finalCurrentValue)))
|
||||
.findFirst().orElse(new Sys_unit()).getName();
|
||||
}
|
||||
changeList.add(NutMap.NEW()
|
||||
.setv("field", fieldName)
|
||||
.setv("fieldName", name)
|
||||
.setv("sourceValue", previousValue)
|
||||
.setv("newValue", currentValue));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Error while extracting and comparing changes for field: {}", fieldName, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理布尔值和数值类型
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
private String booleanVerification(Object value) {
|
||||
// 检查是否为null或空字符串
|
||||
if (ObjectUtil.isAllEmpty(value, "")) {
|
||||
return "无数据";
|
||||
}
|
||||
// 处理布尔值
|
||||
if (value instanceof Boolean) {
|
||||
return ((Boolean) value) ? "是" : "否";
|
||||
}
|
||||
// 处理数值类型
|
||||
if (value instanceof Number && List.of(0, 1).contains((Integer) value)) {
|
||||
return ((Number) value).intValue() != 0 ? "是" : "否";
|
||||
}
|
||||
// 其他对象,返回其字符串表示
|
||||
if (value instanceof Date) {
|
||||
return DateUtil.format((Date) value, "yyyy-MM-dd");
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.service.impl;
|
||||
|
||||
import io.v.nutz.base.service.AsyncService;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.sys.services.SysRoleService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.zhgh.staffmanage.member.model.MemberHistory;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberHistoryService;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author 1V
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@CacheDefaults(cacheName = "member_history")
|
||||
public class MemberHistoryServiceImpl extends ViServiceImpl<MemberHistory> implements MemberHistoryService {
|
||||
public MemberHistoryServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@Inject
|
||||
private AsyncService asyncService;
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void archive() {
|
||||
|
||||
int year = Calendar.getInstance().get(Calendar.YEAR);
|
||||
|
||||
// Sql sql = Sqls.create("SELECT * from sys_user WHERE member = @normal").setParam("normal", MemberMode.NORMAL.getCode());
|
||||
List<MemberHistory> members = listEntity(Sqls.create("SELECT * from sys_user"));
|
||||
|
||||
// clear(Cnd.where("year", "=", year - 1));
|
||||
|
||||
asyncService.exe2(members, (member) -> {
|
||||
member.setId(R.UU32());
|
||||
member.setUserId(member.getId());
|
||||
member.setYear(year - 1);
|
||||
insert(member);
|
||||
});
|
||||
|
||||
/* sysUserService.update(Chain.make("member", MemberMode.NONE.getCode()), Cnd.where("member", "=", MemberMode.NORMAL.getCode()));
|
||||
dao().clear("sys_user_role", Cnd.where("roleId", "=", Roles.MEMBER));*/
|
||||
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.template;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MemberTemp {
|
||||
|
||||
@Excel(name = "工号")
|
||||
private String loginname;
|
||||
|
||||
@Excel(name = "姓名")
|
||||
private String username;
|
||||
|
||||
@Excel(name = "性别")
|
||||
private String sex;
|
||||
|
||||
@Excel(name = "单位名称")
|
||||
private String unitName;
|
||||
|
||||
@Excel(name = "联系方式")
|
||||
private String mobile;
|
||||
|
||||
@Excel(name = "身份证号")
|
||||
private String idcard;
|
||||
|
||||
@Excel(name = "在职状态")
|
||||
private String userState;
|
||||
|
||||
@Excel(name = "人员类型")
|
||||
private String personType;
|
||||
|
||||
@Excel(name = "入会时间")
|
||||
private String memberJoinTime;
|
||||
|
||||
private String errorInfo;
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package io.v.nutz.zhgh.staffmanage.member.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityUserCnd;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-05-19 13:41
|
||||
* @description:
|
||||
**/
|
||||
public class MemberUtils {
|
||||
|
||||
public static Cnd getCnd(PageForm pageForm,
|
||||
String startDate,
|
||||
String endDate,
|
||||
String[] unionId,
|
||||
String[] unitId,
|
||||
String[] personTypes,
|
||||
String[] userStates,
|
||||
String[] preparedBys,
|
||||
String[] memberTypes,
|
||||
String[] sexTypes,
|
||||
String[] age,
|
||||
String teacherMeetingId,
|
||||
String[] roleIds,
|
||||
String[] userId,
|
||||
String clubId,
|
||||
String[] memberStatus,
|
||||
String[] threeUnitId,
|
||||
String[] unionGroupId,
|
||||
boolean reverseSelection,
|
||||
Integer activityGroupId,
|
||||
String activityUserCndStr,
|
||||
String campus) {
|
||||
String IN_OR_NIN_OP = reverseSelection ? "NOT IN" : "IN";
|
||||
String EQ_OR_NEQ_OP = reverseSelection ? "!=" : "=";
|
||||
//小于等于
|
||||
String LE_OR_NLE_OP = reverseSelection ? ">=" : "<=";
|
||||
//大于等于
|
||||
String GE_OR_NGE_OP = reverseSelection ? "<=" : ">=";
|
||||
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (pageForm!=null) {
|
||||
if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
}
|
||||
}
|
||||
|
||||
if (activityGroupId != null) {
|
||||
Sql sqlx = Sqls.createf("SELECT userId FROM activity_user_scope where groupId = '%s'", activityGroupId);
|
||||
cnd.and("u.id", reverseSelection ? "IN" : "NOT IN", sqlx);
|
||||
}
|
||||
|
||||
cnd.andEX("u.id", IN_OR_NIN_OP, userId);
|
||||
|
||||
if (Lang.isNotEmpty(memberTypes)) {
|
||||
if (ArrayUtils.contains(memberTypes, "工会会员")) {
|
||||
cnd.and("u.member", EQ_OR_NEQ_OP, 1);
|
||||
}
|
||||
if (ArrayUtils.contains(memberTypes, "福利会员")) {
|
||||
cnd.and("u.welfareMember", EQ_OR_NEQ_OP, 1);
|
||||
}
|
||||
if (ArrayUtils.contains(memberTypes, "基金会员")) {
|
||||
cnd.and(new Static(" u.loginname " + IN_OR_NIN_OP + " (select loginname from sick_fund_member)"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!Lang.isEmptyArray(age)) {
|
||||
if (!age[1].equals("0")) {
|
||||
if (reverseSelection) {
|
||||
cnd.andNot("TIMESTAMPDIFF(YEAR, u.birthday, CURDATE())", "between", age);
|
||||
} else {
|
||||
cnd.and("TIMESTAMPDIFF(YEAR, u.birthday, CURDATE())", "between", age);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(startDate) && Strings.isNotBlank(endDate)){
|
||||
if (reverseSelection) {
|
||||
cnd.andNot("DATE(u.birthday)", "between",new String[]{startDate,endDate});
|
||||
} else {
|
||||
cnd.and("DATE(u.birthday)", "between",new String[]{startDate,endDate});
|
||||
}
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(startDate) && Strings.isBlank(endDate)){
|
||||
cnd.and("DATE(u.birthday)",GE_OR_NGE_OP,startDate);
|
||||
}
|
||||
|
||||
if (Strings.isBlank(startDate) && Strings.isNotBlank(endDate)){
|
||||
cnd.and("DATE(u.birthday)",LE_OR_NLE_OP,endDate);
|
||||
}
|
||||
|
||||
try {
|
||||
SqlExpressionGroup sqlExpressionGroup = ActivityUserCnd.formatSql("u", activityUserCndStr, reverseSelection);
|
||||
if (!sqlExpressionGroup.isEmpty()) {
|
||||
cnd.and(sqlExpressionGroup);
|
||||
}
|
||||
|
||||
if (memberStatus != null && memberStatus.length > 0) {
|
||||
cnd.andEX("u.memberStatus", IN_OR_NIN_OP, memberStatus);
|
||||
} else {
|
||||
// cnd.andEX("u.member","=", 1);
|
||||
/* SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.and("memberStatus", "in", status);
|
||||
group.or("memberStatus", "IS", null);
|
||||
cnd.and(group);*/
|
||||
}
|
||||
|
||||
cnd.andEX("u.unionid", IN_OR_NIN_OP, unionId);
|
||||
cnd.andEX("u.unitid", IN_OR_NIN_OP, unitId);
|
||||
cnd.andEX("u.threeUnitId", IN_OR_NIN_OP, threeUnitId);
|
||||
cnd.andEX("u.unionGroupId", IN_OR_NIN_OP, unionGroupId);
|
||||
cnd.andEX("u.campus", EQ_OR_NEQ_OP, campus);
|
||||
cnd.andEX("u.personType", IN_OR_NIN_OP, personTypes);
|
||||
cnd.andEX("u.userState", IN_OR_NIN_OP, userStates);
|
||||
cnd.andEX("u.preparedBy", IN_OR_NIN_OP, preparedBys);
|
||||
cnd.andEX("u.sex", IN_OR_NIN_OP, sexTypes);
|
||||
cnd.andEX("sur.jdhid", EQ_OR_NEQ_OP, teacherMeetingId);
|
||||
cnd.andEX("sur.roleid", IN_OR_NIN_OP, roleIds);
|
||||
//cnd.andEX("clubuser.clubid", EQ_OR_NEQ_OP, clubId);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return cnd;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package io.v.nutz.zhgh.staffmanage.single.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.result.Result;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.zhgh.staffmanage.single.service.SingleUserService;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.zhgh.staffmanage.thirtyteach.template.ThirtyTeachTemp;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.AdaptBy;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName SingleUserController
|
||||
* @Description TODO 单身教工台账
|
||||
* @Author zzr
|
||||
* @Date 2023/7/24 10:22
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/single/list")
|
||||
public class SingleUserController {
|
||||
|
||||
@Inject
|
||||
private SingleUserService userService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/single/list.html")
|
||||
@RequiresPermissions("single.user.list")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("single.user.list")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||
@Param(value = "userStates", required = false) String[] userStates,
|
||||
@Param(value = "campus", required = false) String campus,
|
||||
@Param(value = "sex", required = false) String sex,
|
||||
@Param(value = "memberStatus", required = false) Integer memberStatus,
|
||||
@Param(value = "position", required = false) String position,
|
||||
@Param(value = "jobTitle", required = false) String jobTitle,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyWord", required = false) String searchKeyWord) {
|
||||
return userService.singlePageList(pageForm.getPageNumber(), pageForm.getPageSize(), unionId, unitId, threeUnitId, unionGroupId,
|
||||
personTypes, userStates, campus, sex, memberStatus, position, jobTitle, searchName, searchKeyWord);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("member.group.person")
|
||||
public void export(HttpServletResponse response,
|
||||
String props,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personTypes", required = false) String personTypes,
|
||||
@Param(value = "userStates", required = false) String userStates,
|
||||
@Param(value = "campus", required = false) String campus,
|
||||
@Param(value = "sex", required = false) String sex,
|
||||
@Param(value = "memberStatus", required = false) Integer memberStatus,
|
||||
@Param(value = "position", required = false) String position,
|
||||
@Param(value = "jobTitle", required = false) String jobTitle,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyWord", required = false) String searchKeyWord) {
|
||||
try {
|
||||
ViTool.excelResponse(response, "单身教工名单.xls");
|
||||
List<NutMap> dataList = userService.singlePageList(unionId, unitId, threeUnitId, unionGroupId, Json.fromJsonAsArray(String.class, personTypes),
|
||||
Json.fromJsonAsArray(String.class, userStates), campus, sex, memberStatus, position, jobTitle, searchName, searchKeyWord);
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
ExcelExportEntity no = new ExcelExportEntity("序号", "no", 10);
|
||||
no.setFormat("isAddIndex");
|
||||
entityList.add(no);
|
||||
|
||||
Map<String, String> propMap = Json.fromJson(Map.class, props);
|
||||
propMap.forEach((k, v) -> {
|
||||
entityList.add(new ExcelExportEntity(v, k, 20));
|
||||
});
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, dataList);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@SLog(tag = "单身教工", msg = "删除", param = true, result = true)
|
||||
public Object delete(String userId) {
|
||||
userService.update(Chain.make("marriage", "已婚"), Cnd.where("id", "=", userId));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导入模板下载
|
||||
* @param response
|
||||
*/
|
||||
@At
|
||||
@Ok("void")
|
||||
public void downloadImport(HttpServletResponse response) {
|
||||
try {
|
||||
ViTool.excelResponse(response, "单身教工导入模版.xlsx");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
List<ExcelExportEntity> list = new ArrayList<>();
|
||||
list.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
list.add(new ExcelExportEntity("身份证号码", "idCard", 20));
|
||||
list.add(new ExcelExportEntity("出生年月", "birthday", 20));
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, list, new ArrayList<>());
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Object doImport(TempFile file, boolean isFlag) {
|
||||
try {
|
||||
List<ThirtyTeachTemp> thirtyTeachImportList = ExcelImportUtil.importExcel(file.getFile(), ThirtyTeachTemp.class, new ImportParams());
|
||||
|
||||
List<Sys_user> users = userService.query();
|
||||
List<String> allUserList = users.stream().map(Sys_user::getLoginname).collect(Collectors.toList());
|
||||
|
||||
List<ThirtyTeachTemp> errorInfos = new ArrayList<>();
|
||||
List<String> insertUserIds = new ArrayList<>();
|
||||
thirtyTeachImportList.forEach(v -> {
|
||||
if (allUserList.contains(v.getLoginName().trim())){
|
||||
insertUserIds.add(v.getLoginName());
|
||||
}else {
|
||||
v.setRemark("获取不到该用户的工号,请检查工号是否正确!");
|
||||
errorInfos.add(v);
|
||||
}
|
||||
});
|
||||
|
||||
int i = 0;
|
||||
if (Lang.isNotEmpty(insertUserIds)){
|
||||
if (isFlag) {
|
||||
userService.update(Chain.make("marriage", null),Cnd.where("marriage","=","未婚"));
|
||||
}
|
||||
i = userService.update(Chain.make("marriage", "已婚"), Cnd.where("loginname", "in", insertUserIds));
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(errorInfos)) {
|
||||
NutMap nutMap = NutMap.NEW();
|
||||
nutMap.setv("totalCount", thirtyTeachImportList.size());
|
||||
nutMap.setv("successCount", i);
|
||||
nutMap.setv("errorCount", errorInfos.size());
|
||||
nutMap.setv("errorList", errorInfos.stream().map(v -> {
|
||||
return NutMap.NEW().addv("工号", v.getLoginName()).addv("姓名", v.getUserName()).addv("错误原因", v.getRemark());
|
||||
}).collect(Collectors.toList()));
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
package io.v.nutz.zhgh.staffmanage.single.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.staffmanage.single.service.SingleUserService;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
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 javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName SingleUserStatisticsController
|
||||
* @Description TODO 单身教工统计
|
||||
* @Author zzr
|
||||
* @Date 2023/7/24 10:22
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/single/statistics")
|
||||
public class SingleUserStatisticsController {
|
||||
|
||||
@Inject
|
||||
private SingleUserService userService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/single/statistics.html")
|
||||
@RequiresPermissions("single.user.statistics")
|
||||
public void index() {}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("single.user.statistics")
|
||||
public Object pageData(@Param(value = "unionId",required = false) String unionId,
|
||||
@Param(value = "unitId",required = false) String unitId,
|
||||
@Param(value = "personTypes",required = false) String[] personTypes,
|
||||
@Param(value = "analyze",required = false) String analyze) {
|
||||
return userService.singleStatisticsList(personTypes, unionId, unitId, analyze);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void doExport(String unionId, String unitId, String[] personTypes, String analyze, HttpServletResponse response) {
|
||||
List<NutMap> singleUserList = userService.singleStatisticsList(personTypes, unionId, unitId, analyze);
|
||||
List<NutMap> finalMemberList = singleUserList;
|
||||
NutMap sumMap = new NutMap() {{
|
||||
addv("0".equals(analyze)?"unionCode":"unitCode", "合计");
|
||||
addv("totalNumber", finalMemberList.stream().mapToInt(v -> v.getInt("totalNumber")).sum());
|
||||
addv("male", finalMemberList.stream().mapToInt(v -> v.getInt("male")).sum());
|
||||
addv("female", finalMemberList.stream().mapToInt(v -> v.getInt("female")).sum());
|
||||
addv("lessTwentyFive", finalMemberList.stream().mapToInt(v -> v.getInt("lessTwentyFive")).sum());
|
||||
addv("thirty", finalMemberList.stream().mapToInt(v -> v.getInt("thirty")).sum());
|
||||
addv("thirtyFive", finalMemberList.stream().mapToInt(v -> v.getInt("thirtyFive")).sum());
|
||||
addv("forty", finalMemberList.stream().mapToInt(v -> v.getInt("forty")).sum());
|
||||
addv("fortyFive", finalMemberList.stream().mapToInt(v -> v.getInt("fortyFive")).sum());
|
||||
addv("fifty", finalMemberList.stream().mapToInt(v -> v.getInt("fifty")).sum());
|
||||
addv("fiftyFive", finalMemberList.stream().mapToInt(v -> v.getInt("fiftyFive")).sum());
|
||||
addv("moreFiftyFive", finalMemberList.stream().mapToInt(v -> v.getInt("moreFiftyFive")).sum());
|
||||
}};
|
||||
singleUserList.add(sumMap);
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
if ("0".equals(analyze)) {
|
||||
entityList.add(new ExcelExportEntity("分工会代码", "unionCode", 20));
|
||||
entityList.add(new ExcelExportEntity("分工会名称", "unionName", 20));
|
||||
}else if("1".equals(analyze)){
|
||||
entityList.add(new ExcelExportEntity("单位代码", "unitCode", 20));
|
||||
entityList.add(new ExcelExportEntity("单位名称", "unitName", 20));
|
||||
}
|
||||
entityList.add(new ExcelExportEntity("总人数", "totalNumber", 20));
|
||||
entityList.add(new ExcelExportEntity("男", "male", 20));
|
||||
entityList.add(new ExcelExportEntity("女", "female", 20));
|
||||
entityList.add(new ExcelExportEntity("小于25", "lessTwentyFive", 20));
|
||||
entityList.add(new ExcelExportEntity("26-30", "thirty", 20));
|
||||
entityList.add(new ExcelExportEntity("31-35", "thirtyFive", 20));
|
||||
entityList.add(new ExcelExportEntity("36-40", "forty", 20));
|
||||
entityList.add(new ExcelExportEntity("41-45", "fortyFive", 20));
|
||||
entityList.add(new ExcelExportEntity("46-50", "fifty", 20));
|
||||
entityList.add(new ExcelExportEntity("51-55", "fiftyFive", 20));
|
||||
entityList.add(new ExcelExportEntity("大于55", "moreFiftyFive", 20));
|
||||
|
||||
try {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(("单身教工统计表.xls").getBytes("utf-8"), "ISO8859-1"));
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, singleUserList);
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
workbook.close();
|
||||
outputStream.close();
|
||||
outputStream.flush();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package io.v.nutz.zhgh.staffmanage.single.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SingleUserService extends ViService<Sys_user> {
|
||||
|
||||
Pagination singlePageList(Integer pageNumber,Integer pageSize, String unionId, String unitId, String threeUnitId,
|
||||
String unionGroupId, String[] personTypes, String[] userStates,
|
||||
String campus, String sex, Integer memberStatus, String position,
|
||||
String jobTitle, String searchName, String searchKeyWord);
|
||||
|
||||
List<NutMap> singlePageList(String unionId, String unitId, String threeUnitId, String unionGroupId, String[] personTypes,
|
||||
String[] userStates, String campus, String sex, Integer memberStatus, String position,
|
||||
String jobTitle, String searchName, String searchKeyWord);
|
||||
|
||||
List<NutMap> singleStatisticsList(String[] personTypes,String unionId,String unitId,String analyze);
|
||||
}
|
||||
+257
@@ -0,0 +1,257 @@
|
||||
package io.v.nutz.zhgh.staffmanage.single.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.zhgh.staffmanage.single.service.SingleUserService;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SingleUserServiceImpl extends ViServiceImpl<Sys_user> implements SingleUserService {
|
||||
|
||||
public SingleUserServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination singlePageList(Integer pageNumber,Integer pageSize, String unionId, String unitId, String threeUnitId,
|
||||
String unionGroupId, String[] personTypes, String[] userStates,
|
||||
String campus, String sex, Integer memberStatus, String position,
|
||||
String jobTitle, String searchName, String searchKeyWord) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname,
|
||||
username,
|
||||
sex,
|
||||
birthday,
|
||||
mobile,
|
||||
idcard,
|
||||
personType,
|
||||
userState,
|
||||
unionid,
|
||||
unioncode,
|
||||
unionname,
|
||||
unitid,
|
||||
unitname,
|
||||
unitcode,
|
||||
threeUnitName,
|
||||
threeUnitCode,
|
||||
unionGroupName,
|
||||
position,
|
||||
jobTitle,
|
||||
campusName,
|
||||
marriage,
|
||||
education,
|
||||
hometown,
|
||||
nation
|
||||
From
|
||||
user
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("marriage","=","未婚");
|
||||
cnd.andEX("unionid", "=", unionId);
|
||||
cnd.andEX("unitId", "=", unitId);
|
||||
cnd.andEX("threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("unionGroupId", "=", unionGroupId);
|
||||
if (StrUtil.isNotBlank(searchName) && Strings.isNotBlank(searchKeyWord)) {
|
||||
cnd.and(new SqlExpressionGroup().andLike(searchName, searchKeyWord));
|
||||
}
|
||||
|
||||
if (personTypes != null && personTypes.length > 0) {
|
||||
cnd.andEX("personType", "in", personTypes);
|
||||
}
|
||||
if (userStates != null && userStates.length > 0) {
|
||||
cnd.andEX("userState", "in", userStates);
|
||||
}
|
||||
cnd.andEX("campusName", "=", campus);
|
||||
cnd.andEX("sex", "=", sex);
|
||||
|
||||
/*cnd.andEX("member", "=", 1);*/
|
||||
cnd.andEX("memberStatus", "=", memberStatus);
|
||||
|
||||
if (Strings.isNotBlank(position)) {
|
||||
cnd.where().andLike("position", position);
|
||||
}
|
||||
if (Strings.isNotBlank(jobTitle)) {
|
||||
cnd.where().andLike("jobTitle", jobTitle);
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionMemberAdmin,A06")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds());
|
||||
seg.or("unionGroupId", "is", null);
|
||||
cnd.and(seg);
|
||||
}
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageNumber,pageSize,sql);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<NutMap> singleStatisticsList(String[] personTypes,String unionId, String unitId,String analyze) {
|
||||
Sql sql = null;
|
||||
CndPlus cnd = CndPlus.create();
|
||||
if ("0".equals(analyze)){//按分工会统计
|
||||
sql = Sqls.create("""
|
||||
SELECT
|
||||
un.id,
|
||||
un.unioncode AS unionCode,
|
||||
unionName,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<25 $personCnd) AS lessTwentyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=25 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=30 $personCnd) AS thirty,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=31 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=35 $personCnd) AS thirtyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=36 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=40 $personCnd) AS forty,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=41 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=45 $personCnd) AS fortyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=46 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=50 $personCnd) AS fifty,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=51 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=55 $personCnd) AS fiftyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>55 $personCnd $yearCnd) AS moreFiftyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid $personCnd) totalNumber,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and sex = '男' AND un.id = unionid $personCnd) male,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and sex = '女' AND un.id = unionid $personCnd) female
|
||||
FROM
|
||||
sys_union un
|
||||
$condition
|
||||
""");
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "SchoolUnionMemberAdmin"))) {
|
||||
cnd.and("un.id", "=", Vi.getUnionId());
|
||||
}
|
||||
if(StrUtil.isNotBlank(unionId)) {
|
||||
cnd.and("un.id", "=", unionId);
|
||||
}
|
||||
cnd.asc("un.unioncode");
|
||||
}else if ("1".equals(analyze)){//按单位统计
|
||||
sql = Sqls.create("""
|
||||
SELECT
|
||||
un.id,
|
||||
un.unitcode AS unitCode,
|
||||
`name` AS unitName,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<25 $personCnd) AS lessTwentyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=26 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=30 $personCnd) AS thirty,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=31 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=35 $personCnd) AS thirtyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=36 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=40 $personCnd) AS forty,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=41 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=45 $personCnd) AS fortyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=46 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=50 $personCnd) AS fifty,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=51 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=55 $personCnd) AS fiftyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>55 $personCnd) AS moreFiftyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid $personCnd) totalNumber,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND sex = '男' AND un.id = unitid $personCnd) male,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND sex = '女' AND un.id = unitid $personCnd) female
|
||||
FROM
|
||||
sys_unit un
|
||||
$condition
|
||||
""");
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "SchoolUnionMemberAdmin"))) {
|
||||
cnd.and("un.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
if(StrUtil.isNotBlank(unitId)) {
|
||||
cnd.and("un.id", "=", unitId);
|
||||
}
|
||||
cnd.and("unitlevel", "=", 2).and("unitcode", "!=", "000");
|
||||
cnd.asc("un.unitcode");
|
||||
}
|
||||
|
||||
if (personTypes != null && personTypes.length > 0) {
|
||||
String join = StringUtils.join(personTypes, "','");
|
||||
sql.setVar("personCnd", "and personType in ('" + join + "')");
|
||||
}
|
||||
assert sql != null;
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> singlePageList(String unionId, String unitId, String threeUnitId, String unionGroupId, String[] personTypes, String[] userStates, String campus, String sex, Integer memberStatus, String position, String jobTitle, String searchName, String searchKeyWord) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname,
|
||||
username,
|
||||
sex,
|
||||
birthday,
|
||||
mobile,
|
||||
idcard,
|
||||
personType,
|
||||
userState,
|
||||
unionid,
|
||||
unioncode,
|
||||
unionname,
|
||||
unitid,
|
||||
unitname,
|
||||
unitcode,
|
||||
threeUnitName,
|
||||
threeUnitCode,
|
||||
unionGroupName,
|
||||
position,
|
||||
jobTitle,
|
||||
campusName,
|
||||
marriage,
|
||||
education,
|
||||
hometown,
|
||||
nation
|
||||
From
|
||||
user
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("marriage","=","未婚");
|
||||
cnd.andEX("unionid", "=", unionId);
|
||||
cnd.andEX("unitId", "=", unitId);
|
||||
cnd.andEX("threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("unionGroupId", "=", unionGroupId);
|
||||
if (StrUtil.isNotBlank(searchName) && Strings.isNotBlank(searchKeyWord)) {
|
||||
cnd.and(new SqlExpressionGroup().andLike(searchName, searchKeyWord));
|
||||
}
|
||||
if (personTypes != null && personTypes.length > 0) {
|
||||
cnd.andEX("personType", "in", personTypes);
|
||||
}
|
||||
if (userStates != null && userStates.length > 0) {
|
||||
cnd.andEX("userState", "in", userStates);
|
||||
}
|
||||
cnd.andEX("campusName", "=", campus);
|
||||
cnd.andEX("sex", "=", sex);
|
||||
/*cnd.andEX("member", "=", 1);*/
|
||||
cnd.andEX("memberStatus", "=", memberStatus);
|
||||
|
||||
if (Strings.isNotBlank(position)) {
|
||||
cnd.where().andLike("position", position);
|
||||
}
|
||||
if (Strings.isNotBlank(jobTitle)) {
|
||||
cnd.where().andLike("jobTitle", jobTitle);
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionMemberAdmin,A06")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds());
|
||||
seg.or("unionGroupId", "is", null);
|
||||
cnd.and(seg);
|
||||
}
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package io.v.nutz.zhgh.staffmanage.sourcechange.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.zhgh.staffmanage.sourcechange.model.SourceChangeConfig;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SourceChangeConfigController
|
||||
* @Date 2025/2/13 15:45
|
||||
* @注释 会员更新配置
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/sourcechange/config")
|
||||
public class SourceChangeConfigController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/sourcechange/config/index.html")
|
||||
@RequiresPermissions("sourcechange.config")
|
||||
public void index() {}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sourcechange.config")
|
||||
public Object getSourceChangeConfig(){
|
||||
SourceChangeConfig config = dao.fetch(SourceChangeConfig.class, Cnd.NEW());
|
||||
List<SourceChangeConfig.MemberSift> memberSiftList = config.getMemberSiftList();
|
||||
for (SourceChangeConfig.MemberSift sift : memberSiftList) {
|
||||
Object siftValue = sift.getSiftValue();
|
||||
System.out.println(siftValue);
|
||||
List<String> list = (List<String>) siftValue;
|
||||
System.out.println(list);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sourcechange.config")
|
||||
public Object doAddOrModify(@Param("data") SourceChangeConfig config){
|
||||
System.out.println(config);
|
||||
dao.insertOrUpdate(config);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sourcechange.config")
|
||||
public Object getRemoteSearchUser(String query){
|
||||
Sql sql = Sqls.create("select id,loginname,username,unitname,unionname from `user` $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("loginname", query);
|
||||
seg.orLike("username", query);
|
||||
cnd.and(seg);
|
||||
sql.setCondition(cnd);
|
||||
return sysUserService.listPageMap(1, 10, sql);
|
||||
}
|
||||
}
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
package io.v.nutz.zhgh.staffmanage.sourcechange.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.sys.models.Sys_dict;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.sys.services.SysDictService;
|
||||
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;
|
||||
import io.v.nutz.zhgh.staffmanage.sourcechange.service.SourceChangeManageService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
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;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SourceChangeManageController
|
||||
* @Date 2025/2/17 16:08
|
||||
* @注释 人员异动查看
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@At("/platform/sourcechange/manage")
|
||||
public class SourceChangeManageController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private MemberCommonService commonService;
|
||||
@Inject
|
||||
private SourceChangeManageService sourceChangeManageService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sourcechange/manage/index.html")
|
||||
@RequiresPermissions("sourcechange.manage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sourcechange.manage")
|
||||
public Object pageData(SourceChangePageForm pageForm){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
scmt.id,
|
||||
scmt.loginname,
|
||||
scmt.username,
|
||||
u.sex,
|
||||
u.unitName,
|
||||
u.unionName,
|
||||
scmt.userState,
|
||||
scmt.personType,
|
||||
scmt.preparedBy,
|
||||
scmt.changeTime,
|
||||
scmt.changeTypes,
|
||||
scmt.changeOrigin,
|
||||
scmt.isOperate,
|
||||
u.id AS userId
|
||||
FROM
|
||||
source_change_middle_table scmt
|
||||
LEFT JOIN `user` u ON scmt.loginname = u.loginname
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if(StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("username",pageForm.getSearchKeyword());
|
||||
seg.orLike("loginname",pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
} else {
|
||||
cnd.desc("changeTime");
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(pageForm.getChangeTypes())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (String type : pageForm.getChangeTypes()) {
|
||||
seg.or(new Static("JSON_CONTAINS(scmt.changeTypes, JSON_QUOTE('%s'), '$')".formatted(type)));
|
||||
}
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
cnd.andEX("unionId", "=", pageForm.getUnionId());
|
||||
cnd.andEX("unitId", "=", pageForm.getUnitId());
|
||||
cnd.andEX("sex", "=", pageForm.getSex());
|
||||
cnd.andEX("personType", "=", pageForm.getPersonType());
|
||||
cnd.andEX("preparedBy", "=", pageForm.getPreparedBy());
|
||||
cnd.andEX("userState", "=", pageForm.getUserState());
|
||||
cnd.andEX("isOperate", "=", pageForm.getIsOperate());
|
||||
if (StrUtil.isAllNotBlank(pageForm.getChangeDateBefore(), pageForm.getChangeDateEnd())) {
|
||||
cnd.and(new Static(String.format("Date(changeTime) >= '%s' and Date(changeTime) <= '%s'", pageForm.getChangeDateBefore(), pageForm.getChangeDateEnd())));
|
||||
} else {
|
||||
cnd.and("Date(changeTime)", "=", DateUtil.today());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return commonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取比变更信息和当前人员信息
|
||||
* @param sourceChangeId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sourcechange.manage")
|
||||
public Object getSourceChangeAndCurrent(String sourceChangeId){
|
||||
SourceChangeMiddleTable middleTable = dao.fetch(SourceChangeMiddleTable.class, sourceChangeId);
|
||||
User user = dao.fetch(User.class, Cnd.where("loginname", "=", middleTable.getLoginname()));
|
||||
|
||||
NutMap map = NutMap.NEW();
|
||||
map.put("middleTable", middleTable);
|
||||
map.put("userData", user);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sourcechange.manage")
|
||||
@SLog(tag = "人员变更管理", msg = "手动提交变更")
|
||||
public Object doSubmit(SourceChangeMiddleTable middleTable) {
|
||||
sourceChangeManageService.doSourceChange(middleTable);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package io.v.nutz.zhgh.staffmanage.sourcechange.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SourceChangeConfig
|
||||
* @Date 2025/2/12 10:48
|
||||
* @注释 更新配置
|
||||
*/
|
||||
@Data
|
||||
@Table
|
||||
public class SourceChangeConfig {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("人员更新模式(自动、手动)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String sourceChangeType;
|
||||
|
||||
// ========================================= 会员相关 start
|
||||
@Column
|
||||
@Comment("会员区分")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<MemberSift> memberSiftList;
|
||||
|
||||
@Data
|
||||
public static class MemberSift implements Serializable {
|
||||
// 筛选名称
|
||||
private String siftName;
|
||||
// 筛选值
|
||||
private Object siftValue;
|
||||
}
|
||||
|
||||
@Column
|
||||
@Comment("新进职工是否加入会员组别")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isJoinMemberActivityScope;
|
||||
|
||||
@Column
|
||||
@Comment("非会员是否剔除会员组别")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isDeleteMemberActivityScope;
|
||||
// ========================================= 会员相关 end
|
||||
|
||||
|
||||
// ========================================= 福利会员相关 start
|
||||
@Column
|
||||
@Comment("福利会员区分")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<WelfareMemberSift> welfareMemberSiftList;
|
||||
|
||||
@Data
|
||||
public static class WelfareMemberSift implements Serializable {
|
||||
// 筛选名称
|
||||
private String siftName;
|
||||
// 筛选编码
|
||||
private String siftCode;
|
||||
// 筛选值
|
||||
private Object siftValue;
|
||||
}
|
||||
|
||||
@Column
|
||||
@Comment("新进职工是否加入正在进行中的福利项目")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isJoinWelfareProject;
|
||||
// ========================================= 福利会员相关 end
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package io.v.nutz.zhgh.staffmanage.sourcechange.model;
|
||||
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SourceChangeMiddleTable
|
||||
* @Date 2025/2/17 17:24
|
||||
* @注释
|
||||
*/
|
||||
@Data
|
||||
@Table
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableIndexes({
|
||||
@Index(name = "INDEX_HISTORY_USER_LOGIN_NAME", fields = {"loginname"}, unique = false),
|
||||
@Index(name = "INDEX_HISTORY_USER_UNIT", fields = {"unitid"}, unique = false),
|
||||
@Index(name = "INDEX_HISTORY_USER_UNION", fields = {"unionid"}, unique = false),
|
||||
})
|
||||
public class SourceChangeMiddleTable extends Sys_user {
|
||||
|
||||
@Name
|
||||
@Column
|
||||
@Comment("ID")
|
||||
@PrevInsert(uu32 = true)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("是否加入会员组别")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isJoinActivityMemberScope;
|
||||
|
||||
@Column
|
||||
@Comment("是否退出会员组别")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isExitActivityMemberScope;
|
||||
|
||||
@Column
|
||||
@Comment("是否加入福利项目")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isJoinWelfareProject;
|
||||
|
||||
@Column
|
||||
@Comment("福利项目id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String welfareProjectId;
|
||||
|
||||
@Column
|
||||
@Comment("更新时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date changeTime;
|
||||
|
||||
/**
|
||||
* @see io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeType
|
||||
*/
|
||||
@Column
|
||||
@Comment("变更类型(多种)")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> changeTypes;
|
||||
|
||||
@Column
|
||||
@Comment("变更来源")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String changeOrigin;
|
||||
|
||||
@Column
|
||||
@Comment("详细变更记录,用于查询、列表展示")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<NutMap> changeInfos;
|
||||
|
||||
@Column
|
||||
@Comment("详细变更记录,文本类型,可用于导出")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String changeInfosStr;
|
||||
|
||||
@Column
|
||||
@Comment("是否操作")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isOperate;
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package io.v.nutz.zhgh.staffmanage.sourcechange.param.pageform;
|
||||
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SourceChangePageForm
|
||||
* @Date 2025/2/17 17:20
|
||||
* @注释
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SourceChangePageForm extends PageForm {
|
||||
|
||||
// 工会id
|
||||
private String unionId;
|
||||
|
||||
// 单位id
|
||||
private String unitId;
|
||||
|
||||
// 性别
|
||||
private String sex;
|
||||
|
||||
// 人员类型
|
||||
private String personType;
|
||||
|
||||
// 杭医是人员区分,其他为人员编制
|
||||
private String preparedBy;
|
||||
|
||||
// 在职状态
|
||||
private String userState;
|
||||
|
||||
//变更状态数组
|
||||
private List<String> changeTypes;
|
||||
|
||||
// 变更开始查询时间
|
||||
private String changeDateBefore;
|
||||
|
||||
// 变更结束查询时间
|
||||
private String changeDateEnd;
|
||||
|
||||
// 是否操作
|
||||
private Boolean isOperate;
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package io.v.nutz.zhgh.staffmanage.sourcechange.service;
|
||||
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.staffmanage.sourcechange.model.SourceChangeMiddleTable;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SourceChangeManageService
|
||||
* @Date 2025/2/19 14:54
|
||||
* @注释 :人员变更管理
|
||||
*/
|
||||
public interface SourceChangeManageService extends BaseService<SourceChangeMiddleTable> {
|
||||
|
||||
/**
|
||||
* 人工变更,做变更
|
||||
* @param middleTable
|
||||
*/
|
||||
void doSourceChange(SourceChangeMiddleTable middleTable);
|
||||
}
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
package io.v.nutz.zhgh.staffmanage.sourcechange.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
import io.v.nutz.base.service.impl.BaseServiceImpl;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.sys.models.Sys_union;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.sys.services.SysRoleService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityUserScope;
|
||||
import io.v.nutz.zhgh.data.model.UserHistory;
|
||||
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeOrigin;
|
||||
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.service.SourceChangeManageService;
|
||||
import io.v.nutz.zhgh.staffmanage.specialstaff.model.SpecialStaff;
|
||||
import io.v.nutz.zhgh.welfare.model.WelfareList;
|
||||
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;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SourceChangeManageServiceImpl
|
||||
* @Date 2025/2/19 14:55
|
||||
* @注释
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeMiddleTable> implements SourceChangeManageService {
|
||||
public SourceChangeManageServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private MemberCommonService commonService;
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doSourceChange(SourceChangeMiddleTable middleTable) {
|
||||
User user = dao().fetch(User.class, Cnd.where("loginname", "=", middleTable.getLoginname()));
|
||||
|
||||
//获取可变更字段
|
||||
NutMap map = commonService.getDictAllowChangeFields();
|
||||
Set<String> allowChangeFieldNames = map.getAs("allowChangeFieldNames", Set.class);
|
||||
Map<String, String> dictMap = map.getAs("dictMap", Map.class);
|
||||
|
||||
// 新数据
|
||||
NutMap newMap = Lang.obj2nutmap(middleTable);
|
||||
// 原数据
|
||||
NutMap sourceMap = Lang.obj2nutmap(user);
|
||||
List<NutMap> changeList = new ArrayList<>();
|
||||
|
||||
for (String fieldName : allowChangeFieldNames) {
|
||||
commonService.extractChange(newMap, sourceMap, fieldName, dictMap, changeList);
|
||||
}
|
||||
|
||||
List<String> changeTypes = new ArrayList<>();
|
||||
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.getMember(), middleTable.getMember())){
|
||||
if (middleTable.getMember() == 1) {
|
||||
changeTypes.add(MemberChangeType.RESTORE.getType());
|
||||
} else {
|
||||
changeTypes.add(MemberChangeType.WITHDRAWAL.getType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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)) {
|
||||
BeanUtil.copyProperties(info, history);
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(history)) {
|
||||
history.setChangeTime(DateUtil.date());
|
||||
history.setChangeOrigin(MemberChangeOrigin.HAND_MOVEMENT.name());
|
||||
history.setChangeInfos(changeList);
|
||||
String changeInfos = changeList.stream().map(v -> {
|
||||
return "(变更字段:" + v.getString("fieldName") + ",变更前:" + HtmlUtil.cleanHtmlTag(v.getString("sourceValue")) + ",变更后:" + HtmlUtil.cleanHtmlTag(v.getString("newValue")) + ")";
|
||||
}).collect(Collectors.joining(";"));
|
||||
history.setChangeInfosStr(changeInfos);
|
||||
|
||||
// 加入会员
|
||||
if (middleTable.getMember() == 1) {
|
||||
int activityCount = dao().count(ActivityUserScope.class, Cnd.where("userId", "=", userId).and("groupId", "=", 1));
|
||||
int memberCount = dao().count(Sys_user_role.class, Cnd.where("userId", "=", userId).and("roleId", "=", Roles.MEMBER));
|
||||
if (activityCount <= 0) {
|
||||
// 取消或加入会员组别
|
||||
if (middleTable.getIsJoinActivityMemberScope()) {
|
||||
ActivityUserScope scope = new ActivityUserScope();
|
||||
scope.setUserId(userId);
|
||||
scope.setGroupId(1);
|
||||
scope.setGroupName("工会会员");
|
||||
dao().insert(scope);
|
||||
}
|
||||
}
|
||||
if (memberCount <= 0) {
|
||||
Sys_user_role userRole = new Sys_user_role();
|
||||
userRole.setUserId(userId);
|
||||
userRole.setRoleId(Roles.MEMBER);
|
||||
dao().insert(userRole);
|
||||
}
|
||||
// 杭医特有,其他学校请删除
|
||||
middleTable.setPreparedBy("会员");
|
||||
} else {
|
||||
if (middleTable.getIsExitActivityMemberScope()) {
|
||||
dao().clear(ActivityUserScope.class, Cnd.where("userId", "=", userId).and("groupId", "=", 1));
|
||||
}
|
||||
dao().clear(Sys_user_role.class, Cnd.where("userId", "=", userId).and("roleId", "=", Roles.MEMBER));
|
||||
// 杭医特有,其他学校请删除
|
||||
middleTable.setPreparedBy("教职工");
|
||||
}
|
||||
|
||||
// 加入福利会员 是否加入福利项目
|
||||
if (middleTable.getWelfareMember() == 1 && middleTable.getIsJoinWelfareProject()) {
|
||||
WelfareList welfareList = new WelfareList();
|
||||
welfareList.setId(R.UU32());
|
||||
welfareList.setProjectId(middleTable.getWelfareProjectId());
|
||||
welfareList.setUserId(userId);
|
||||
welfareList.setIsReceive(false);
|
||||
welfareList.setIsAutoSelect(false);
|
||||
welfareList.setUserState(middleTable.getUserState());
|
||||
welfareList.setPersonType(middleTable.getPersonType());
|
||||
welfareList.setWelfareUnitId(middleTable.getUnitid());
|
||||
dao().insert(welfareList);
|
||||
}
|
||||
|
||||
// 到此,表明审核通过,需要存储历史数据,并修改用户数据
|
||||
BeanUtil.copyProperties(middleTable, info);
|
||||
info.setId(userId);
|
||||
info.setIdcard(middleTable.getIdcard());
|
||||
|
||||
// 如果有单位变更,则需要记录单位关系
|
||||
if (!ObjectUtil.equals(user.getUnitid(), middleTable.getUnitid())) {
|
||||
changeTypes.add(MemberChangeType.UNIT_CHANGE.getType());
|
||||
info.setUnitid(middleTable.getUnitid());
|
||||
}
|
||||
|
||||
// 如果工会发生变更了,就是工会关系变更,记录到特殊人员表中
|
||||
if (!ObjectUtil.equals(user.getUnionid(), middleTable.getUnionid())) {
|
||||
changeTypes.add(MemberChangeType.UNION_CHANGE.getType());
|
||||
Sys_union union = dao().fetch(Sys_union.class, Cnd.where("id", "=", middleTable.getUnionid()));
|
||||
SpecialStaff staff = new SpecialStaff();
|
||||
staff.setUserId(userId);
|
||||
staff.setPersonnelRelationUnitId(user.getUnitid());
|
||||
staff.setPersonnelRelationUnitName(user.getUnitname());
|
||||
staff.setUnionRelationUnionId(union.getId());
|
||||
staff.setUnionRelationUnionName(union.getUnionname());
|
||||
staff.setIsManyUnit(false);
|
||||
staff.setSpecialStaffType("HMC_RELATION");
|
||||
dao().insert(staff);
|
||||
}
|
||||
|
||||
dao().updateIgnoreNull(info);
|
||||
history.setChangeTypes(changeTypes);
|
||||
dao().insert(history);
|
||||
|
||||
dao().update(SourceChangeMiddleTable.class, Chain.make("isOperate", 2), Cnd.where("id", "=", middleTable.getId()));
|
||||
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
package io.v.nutz.zhgh.staffmanage.specialstaff.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.result.Result;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.zhgh.staffmanage.specialstaff.model.SpecialStaff;
|
||||
import io.v.nutz.zhgh.staffmanage.specialstaff.param.SpecialStaffPageForm;
|
||||
import io.v.nutz.zhgh.staffmanage.specialstaff.service.SpecialStaffManageService;
|
||||
import io.v.nutz.zhgh.staffmanage.specialstaff.vo.SpecialStaffVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
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;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SpecialStaffManageController
|
||||
* @Date 2024/10/25 9:03
|
||||
* @注释 特殊人员管理
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@At("/platform/staff/special/manage")
|
||||
public class SpecialStaffManageController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SpecialStaffManageService specialStaffManageService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/specialstaff/manage/index.html")
|
||||
@RequiresPermissions("staff.special.manage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("staff.special.manage")
|
||||
public Object pageData(SpecialStaffPageForm pageForm) {
|
||||
Pagination pagination = specialStaffManageService.pageData(pageForm);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("staff.special.manage")
|
||||
public Result getUserInfo(String userId) {
|
||||
NutMap userInfo = specialStaffManageService.getUserInfo(userId);
|
||||
return Result.success(userInfo);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("staff.special.manage")
|
||||
public Result getSpecialStaffUserInfo(String userId) {
|
||||
NutMap specialStaffUserInfo = specialStaffManageService.getSpecialStaffUserInfo(userId);
|
||||
return Result.success(specialStaffUserInfo);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("staff.special.manage")
|
||||
public Result addSpecialStaff(@Param("data") SpecialStaffVo specialStaffVo) {
|
||||
SpecialStaff staff = new SpecialStaff();
|
||||
Sys_user user = dao.fetch(Sys_user.class, specialStaffVo.getUserId());
|
||||
User viewUser = dao.fetch(User.class, Cnd.where("id", "=", specialStaffVo.getUserId()));
|
||||
SpecialStaff specialStaff = dao.fetch(SpecialStaff.class, Cnd.where("userId", "=", specialStaffVo.getUserId()));
|
||||
if (Lang.isNotEmpty(specialStaff)) {
|
||||
staff = specialStaff;
|
||||
}
|
||||
BeanUtil.copyProperties(specialStaffVo, staff);
|
||||
if (specialStaffVo.getIsManyUnit()!=null && specialStaffVo.getIsManyUnit()) {
|
||||
// 如果是多单位人员, 更改单位为工会关系
|
||||
// user.setUnitid(specialStaffVo.getUnionRelationUnitId());
|
||||
// user.setThreeUnitId(specialStaffVo.getUnionRelationThreeUnitId());
|
||||
// user.setIsManyUnit(true);
|
||||
dao.updateIgnoreNull(user);
|
||||
|
||||
staff.setPersonnelRelationUnitId(viewUser.getUnitid());
|
||||
staff.setPersonnelRelationUnitName(viewUser.getUnitname());
|
||||
staff.setPersonnelRelationUnionId(viewUser.getUnionid());
|
||||
staff.setPersonnelRelationUnionName(viewUser.getUnionname());
|
||||
// staff.setPersonnelRelationThreeUnitId(viewUser.getThreeUnitId());
|
||||
// staff.setPersonnelRelationThreeUnitName(viewUser.getThreeUnitName());
|
||||
// staff.setPersonnelRelationUnionGroupId(viewUser.getUnionGroupId());
|
||||
// staff.setPersonnelRelationUnionGroupName(viewUser.getUnionGroupName());
|
||||
}
|
||||
staff.setUserId(user.getId());
|
||||
dao.insertOrUpdate(staff);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("staff.special.manage")
|
||||
public Result removeSpecialStaff(@Valid String userId) {
|
||||
SpecialStaff staff = dao.fetch(SpecialStaff.class, Cnd.where("userId", "=", userId));
|
||||
if (staff.getIsManyUnit()) {
|
||||
dao.update(Sys_user.class, Chain.make("unitid", staff.getPersonnelRelationUnitId())
|
||||
.add("threeUnitId", staff.getPersonnelRelationThreeUnitId())
|
||||
.add("isManyUnit", null), Cnd.where("id", "=", userId));
|
||||
}
|
||||
dao.clear(SpecialStaff.class, Cnd.where("userId", "=", userId));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("staff.special.manage")
|
||||
public Result queryUser(String keyWord) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
id,
|
||||
username,
|
||||
loginname,
|
||||
unitid AS unitId,
|
||||
unitname AS unitName,
|
||||
unionid AS unionId,
|
||||
unionname AS unionName
|
||||
from
|
||||
`user`
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.where("id", "not in", "(select userId from special_staff)");
|
||||
if (StrUtil.isNotBlank(keyWord)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("username", keyWord);
|
||||
seg.orLike("loginname", keyWord);
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.limit(0, 10);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = specialStaffManageService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package io.v.nutz.zhgh.staffmanage.specialstaff.model;
|
||||
|
||||
import io.v.nutz.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SpecialStaff
|
||||
* @Date 2024/10/25 9:05
|
||||
* @注释
|
||||
*/
|
||||
@Data
|
||||
@Comment("特别人员")
|
||||
@Table("special_staff")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SpecialStaff extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@PrevInsert(uu32 = true)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("组员对应的用户id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 人事关系
|
||||
*/
|
||||
@Column
|
||||
@Comment("人事关系部门")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String personnelRelationUnitId;
|
||||
|
||||
@Column
|
||||
@Comment("人事关系部门名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String personnelRelationUnitName;
|
||||
|
||||
@Column
|
||||
@Comment("人事关系工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String personnelRelationUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("人事关系工会名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String personnelRelationUnionName;
|
||||
|
||||
@Column
|
||||
@Comment("人事关系三级单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String personnelRelationThreeUnitId;
|
||||
|
||||
@Column
|
||||
@Comment("人事关系三级单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String personnelRelationThreeUnitName;
|
||||
|
||||
@Column
|
||||
@Comment("人事关系工会小组")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String personnelRelationUnionGroupId;
|
||||
|
||||
@Column
|
||||
@Comment("人事关系工会小组名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String personnelRelationUnionGroupName;
|
||||
|
||||
|
||||
/**
|
||||
* 工会关系
|
||||
*/
|
||||
@Column
|
||||
@Comment("工会关系部门")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionRelationUnitId;
|
||||
|
||||
@Column
|
||||
@Comment("工会关系部门名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionRelationUnitName;
|
||||
|
||||
@Column
|
||||
@Comment("工会关系工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionRelationUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("工会关系工会名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionRelationUnionName;
|
||||
|
||||
@Column
|
||||
@Comment("工会关系三级单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionRelationThreeUnitId;
|
||||
|
||||
@Column
|
||||
@Comment("工会关系三级单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionRelationThreeUnitName;
|
||||
|
||||
@Column
|
||||
@Comment("工会关系小组")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionRelationUnionGroupId;
|
||||
|
||||
@Column
|
||||
@Comment("工会关系小组名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String unionRelationUnionGroupName;
|
||||
|
||||
@Column
|
||||
@Comment("特殊人员类型")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean isManyUnit;
|
||||
|
||||
@Column
|
||||
@Comment("特殊人员类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String specialStaffType;
|
||||
|
||||
@Column
|
||||
@Comment("特殊人员备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String specialStaffRemark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.v.nutz.zhgh.staffmanage.specialstaff.param;
|
||||
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SpecialStaffPageForm
|
||||
* @Date 2024/10/25 9:31
|
||||
* @注释
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SpecialStaffPageForm extends PageForm {
|
||||
|
||||
private String unionId;
|
||||
|
||||
private String unitId;
|
||||
|
||||
private String unionGroupId;
|
||||
|
||||
private String threeUnitId;
|
||||
|
||||
private String personType;
|
||||
|
||||
private String userState;
|
||||
|
||||
private String specialStaffType;
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package io.v.nutz.zhgh.staffmanage.specialstaff.service;
|
||||
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.staffmanage.specialstaff.model.SpecialStaff;
|
||||
import io.v.nutz.zhgh.staffmanage.specialstaff.param.SpecialStaffPageForm;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SpecialStaffManageService
|
||||
* @Date 2024/10/25 9:42
|
||||
* @注释
|
||||
*/
|
||||
public interface SpecialStaffManageService extends BaseService<SpecialStaff> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param pageForm
|
||||
* @return
|
||||
*/
|
||||
Pagination pageData(SpecialStaffPageForm pageForm);
|
||||
|
||||
/**
|
||||
* 获取用户信息(人事关系)
|
||||
* @param userId 用户id
|
||||
* @return
|
||||
*/
|
||||
NutMap getUserInfo(String userId);
|
||||
|
||||
/**
|
||||
* 获取用户信息(特殊人员)
|
||||
* @param userId 用户id
|
||||
* @return
|
||||
*/
|
||||
NutMap getSpecialStaffUserInfo(String userId);
|
||||
}
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
package io.v.nutz.zhgh.staffmanage.specialstaff.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.service.impl.BaseServiceImpl;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.specialstaff.model.SpecialStaff;
|
||||
import io.v.nutz.zhgh.staffmanage.specialstaff.param.SpecialStaffPageForm;
|
||||
import io.v.nutz.zhgh.staffmanage.specialstaff.service.SpecialStaffManageService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SpecialStaffManageServiceImpl
|
||||
* @Date 2024/10/25 9:43
|
||||
* @注释
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SpecialStaffManageServiceImpl extends BaseServiceImpl<SpecialStaff> implements SpecialStaffManageService {
|
||||
public SpecialStaffManageServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(SpecialStaffPageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
s.*,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.member,
|
||||
u.welfareMember,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.mobile,
|
||||
dict.`name` AS distSpecialStaffType,
|
||||
u.birthday
|
||||
FROM
|
||||
`special_staff` s
|
||||
LEFT JOIN `user` u ON s.userId = u.id
|
||||
LEFT JOIN `sys_dict` dict ON dict.`code` = s.specialStaffType
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("u.username", pageForm.getSearchKeyword());
|
||||
seg.orLike("u.loginname", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
} else {
|
||||
cnd.asc("u.unitcode");
|
||||
cnd.asc("u.loginname");
|
||||
}
|
||||
|
||||
cnd.andEX("u.unionId", "=", pageForm.getUnionId());
|
||||
cnd.andEX("u.unitId", "=", pageForm.getUnitId());
|
||||
cnd.andEX("u.personType", "=", pageForm.getPersonType());
|
||||
cnd.andEX("u.userState", "=", pageForm.getUserState());
|
||||
cnd.andEX("u.personType", "=", pageForm.getPersonType());
|
||||
cnd.andEX("s.specialStaffType", "=", pageForm.getSpecialStaffType());
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NutMap getUserInfo(String userId) {
|
||||
// threeUnitId AS personnelRelationThreeUnitId,
|
||||
// threeUnitName AS personnelRelationThreeUnitName,
|
||||
// unionGroupId AS personnelRelationUnionGroupId,
|
||||
// unionGroupName AS personnelRelationUnionGroupName,
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id AS userId,
|
||||
username,
|
||||
loginname,
|
||||
unitid AS personnelRelationUnitId,
|
||||
unitname AS personnelRelationUnitName,
|
||||
unionname AS personnelRelationUnionName,
|
||||
threeUnitId AS personnelRelationThreeUnitId,
|
||||
threeUnitName AS personnelRelationThreeUnitName,
|
||||
unionGroupId AS personnelRelationUnionGroupId,
|
||||
unionGroupName AS personnelRelationUnionGroupName,
|
||||
userState,
|
||||
personType,
|
||||
mobile
|
||||
FROM
|
||||
`user`
|
||||
WHERE
|
||||
id = @userId
|
||||
""");
|
||||
sql.setParam("userId", userId);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao().execute(sql);
|
||||
return (NutMap) sql.getResult();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NutMap getSpecialStaffUserInfo(String userId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
s.*,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.member,
|
||||
u.welfareMember,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.unitname AS unionRelationUnitName,
|
||||
u.unionname AS unionRelationUnionName,
|
||||
u.mobile,
|
||||
u.birthday
|
||||
FROM
|
||||
`special_staff` s
|
||||
LEFT JOIN `user` u ON s.userId = u.id
|
||||
WHERE
|
||||
s.userId=@userId
|
||||
""");
|
||||
sql.setParam("userId", userId);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao().execute(sql);
|
||||
return (NutMap) sql.getResult();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.v.nutz.zhgh.staffmanage.specialstaff.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SpecialStaffVo
|
||||
* @Date 2024/10/25 9:36
|
||||
* @注释
|
||||
*/
|
||||
@Data
|
||||
public class SpecialStaffVo {
|
||||
|
||||
private String id;
|
||||
private String userId;
|
||||
private String personnelRelationUnitId;
|
||||
private String personnelRelationUnitName;
|
||||
private String personnelRelationUnionId;
|
||||
private String personnelRelationUnionName;
|
||||
private String personnelRelationThreeUnitId;
|
||||
private String personnelRelationThreeUnitName;
|
||||
private String personnelRelationUnionGroupId;
|
||||
private String personnelRelationUnionGroupName;
|
||||
private String unionRelationUnitId;
|
||||
private String unionRelationUnitName;
|
||||
private String unionRelationUnionId;
|
||||
private String unionRelationUnionName;
|
||||
private String unionRelationThreeUnitId;
|
||||
private String unionRelationThreeUnitName;
|
||||
private String unionRelationUnionGroupId;
|
||||
private String unionRelationUnionGroupName;
|
||||
private Boolean isManyUnit;
|
||||
private String specialStaffType;
|
||||
private String specialStaffRemark;
|
||||
|
||||
}
|
||||
+392
@@ -0,0 +1,392 @@
|
||||
package io.v.nutz.zhgh.staffmanage.thirtyteach.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.result.Result;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.zhgh.staffmanage.thirtyteach.template.ThirtyTeachTemp;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
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.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
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.AdaptBy;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@At("/platform/thirtyTeach/manage")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class ThirtyTeachController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/thirtyteach/manage.html")
|
||||
@RequiresPermissions("thirtyTeach.manage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("thirtyTeach.manage")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
@Param(value = "teachNum", required = false) String teachNum,
|
||||
@Param(value = "thirtyCertificateProcessingTime",required = false)String thirtyCertificateProcessingTime) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname,
|
||||
username,
|
||||
sex,
|
||||
member,
|
||||
welfareMember,
|
||||
personType,
|
||||
userState,
|
||||
unioncode,
|
||||
unionname,
|
||||
unionid,
|
||||
unitname,
|
||||
unitcode,
|
||||
unitid,
|
||||
threeUnitName,
|
||||
threeUnitCode,
|
||||
unionGroupName,
|
||||
mobile,
|
||||
campusName,
|
||||
TIMESTAMPDIFF(YEAR, schoolTime, CURDATE()) AS teachNum,
|
||||
birthday,
|
||||
thirtyCertificateProcessingTime
|
||||
from
|
||||
`user`
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("isThirtyTeach", "=", 1);
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("username", pageForm.getSearchKeyword());
|
||||
seg.orLike("loginname", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SchoolUnionMemberAdmin")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("unionid", "=", Vi.getUnionId());
|
||||
} else {
|
||||
cnd.and("unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds());
|
||||
}
|
||||
}
|
||||
cnd.andEX("TIMESTAMPDIFF(YEAR, schoolTime, CURDATE())", "=", teachNum);
|
||||
cnd.andEX("unionid", "=", unionId);
|
||||
cnd.andEX("unitid", "=", unitId);
|
||||
cnd.andEX("threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("personType", "=", personType);
|
||||
cnd.andEX("userState", "=", userState);
|
||||
cnd.and(Cnd.likeEX("thirtyCertificateProcessingTime",thirtyCertificateProcessingTime));
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 一键设置三十年教工
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("thirtyTeach.manage")
|
||||
public Object setThirtyTeach(Integer setNum, boolean isFlag) {
|
||||
if (isFlag) {
|
||||
sysUserService.update(Chain.make("isThirtyTeach", 0), Cnd.NEW());
|
||||
}
|
||||
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("schoolTime", "is not", null);
|
||||
cnd.and("schoolTime", "!=", "");
|
||||
cnd.and("TIMESTAMPDIFF(YEAR, schoolTime, CURDATE())", ">", setNum);
|
||||
sysUserService.update(Chain.make("isThirtyTeach", 1), cnd);
|
||||
|
||||
|
||||
// Sql sql = Sqls.create("select id,loginname from `user` $condition");
|
||||
//
|
||||
// if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SchoolUnionMemberAdmin")) {
|
||||
// if (ShiroUtil.hasRole("H04")) {
|
||||
// cnd.and("unionid", "=", Vi.getUnionId());
|
||||
// } else {
|
||||
// cnd.and("unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds());
|
||||
// }
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Object doImport(TempFile file, boolean isFlag) {
|
||||
try {
|
||||
List<ThirtyTeachTemp> thirtyTeachImportList = ExcelImportUtil.importExcel(file.getFile(), ThirtyTeachTemp.class, new ImportParams());
|
||||
|
||||
List<Sys_user> users = sysUserService.query();
|
||||
|
||||
// Map<String, String> userIdMap = users.stream().collect(Collectors.toMap(v -> v.getUsername() + '|' + v.getBirthday(), Sys_user::getId));
|
||||
|
||||
List<ThirtyTeachTemp> errorInfos = new ArrayList<>();
|
||||
List<Sys_user> insertUserList = new ArrayList<>();
|
||||
thirtyTeachImportList.forEach(v -> {
|
||||
if (StrUtil.isBlank(v.getUserName())) {
|
||||
v.setRemark("获取不到该用户的姓名!");
|
||||
errorInfos.add(v);
|
||||
return;
|
||||
} else if (StrUtil.isBlank(v.getBirthday())) {
|
||||
v.setRemark("获取不到该用户的出生日期!");
|
||||
errorInfos.add(v);
|
||||
return;
|
||||
}else if (StrUtil.isBlank(v.getThirtyCertificateProcessingTime())) {
|
||||
v.setRemark("获取不到该用户的荣誉证办理时间!");
|
||||
errorInfos.add(v);
|
||||
return;
|
||||
}
|
||||
|
||||
List<Sys_user> matchUsers = users.stream().filter(u -> (u.getUsername() + "|" + (StrUtil.isNotBlank(u.getBirthday()) ? u.getBirthday().substring(0, 3) : "")).equals(v.getUserName() + "|" + v.getBirthday().substring(0, 3))).map(u -> {
|
||||
Sys_user user = new Sys_user();
|
||||
user.setId(u.getId());
|
||||
user.setLoginname(v.getLoginName());
|
||||
user.setThirtyTeach(true);
|
||||
user.setThirtyCertificateProcessingTime(v.getThirtyCertificateProcessingTime());
|
||||
return user;
|
||||
}).collect(Collectors.toList());
|
||||
insertUserList.addAll(matchUsers);
|
||||
|
||||
boolean b = users.stream().noneMatch(u -> (u.getUsername() + "|" + (StrUtil.isNotBlank(u.getBirthday()) ? u.getBirthday().substring(0, 3) : "")).equals(v.getUserName() + "|" + v.getBirthday().substring(0, 3)));
|
||||
if (b) {
|
||||
v.setRemark("获取不到该用户的信息,请检查工号和出生日期是否正确!");
|
||||
errorInfos.add(v);
|
||||
}
|
||||
|
||||
|
||||
// List<ThirtyTeachTemp> noneMatchUsers = users.stream().filter(u -> !(u.getUsername() + "|" + u.getBirthday()).equals(v.getUserName() + "|" + v.getBirthday())).map(u -> {
|
||||
// v.setRemark("获取不到该用户的信息,请检查工号和出生日期是否正确!");
|
||||
// return v;
|
||||
// }).collect(Collectors.toList());
|
||||
// errorInfos.addAll(noneMatchUsers);
|
||||
|
||||
// if (userIdMap.containsKey(v.getUserName() + "|" + v.getBirthday())) {
|
||||
// Sys_user user = new Sys_user();
|
||||
// user.setId(userIdMap.get(v.getLoginName().trim()));
|
||||
// user.setLoginname(v.getLoginName());
|
||||
// user.setThirtyTeach(true);
|
||||
// insertUserList.add(user);
|
||||
// } else {
|
||||
// v.setRemark("获取不到该用户的信息,请检查工号和出生日期是否正确!");
|
||||
// errorInfos.add(v);
|
||||
// }
|
||||
|
||||
|
||||
// if (userIdMap.containsKey(v.getLoginName())) {
|
||||
// Sys_user user = new Sys_user();
|
||||
// if (v.getSchoolTime() != null) {
|
||||
// user.setSchoolTime(DateUtil.formatDate(v.getSchoolTime()));
|
||||
// } else {
|
||||
// v.setRemark("请填写该教职工的入校时间!");
|
||||
// errorInfos.add(v);
|
||||
// return;
|
||||
// }
|
||||
// user.setId(userIdMap.get(v.getLoginName().trim()));
|
||||
// user.setLoginname(v.getLoginName());
|
||||
// user.setThirtyTeach(true);
|
||||
// insertUserList.add(user);
|
||||
// } else {
|
||||
// v.setRemark("获取不到该用户的工号,请检查工号是否正确!");
|
||||
// errorInfos.add(v);
|
||||
// }
|
||||
});
|
||||
|
||||
int i = 0;
|
||||
if (Lang.isNotEmpty(insertUserList)) {
|
||||
if (isFlag) {
|
||||
sysUserService.update(Chain.make("isThirtyTeach", 0), Cnd.NEW());
|
||||
}
|
||||
i = sysUserService.updateIgnoreNull(insertUserList);
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(errorInfos)) {
|
||||
NutMap nutMap = NutMap.NEW();
|
||||
nutMap.setv("totalCount", thirtyTeachImportList.size());
|
||||
nutMap.setv("successCount", i);
|
||||
nutMap.setv("errorCount", errorInfos.size());
|
||||
nutMap.setv("errorList", errorInfos.stream().map(v -> {
|
||||
return NutMap.NEW().addv("工号", v.getLoginName()).addv("姓名", v.getUserName()).addv("错误原因", v.getRemark());
|
||||
}).collect(Collectors.toList()));
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("thirtyTeach.manage")
|
||||
public void downloadImport(HttpServletResponse response) {
|
||||
try {
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
List<ThirtyTeachTemp> list = new ArrayList<>();
|
||||
ThirtyTeachTemp temp = new ThirtyTeachTemp();
|
||||
temp.setUserName("超级管理员");
|
||||
list.add(temp);
|
||||
ViTool.excelResponse(response, "导入模版.xlsx");
|
||||
Workbook sheets = ExcelExportUtil.exportExcel(exportParams, ThirtyTeachTemp.class, list);
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
sheets.write(outputStream);
|
||||
outputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void doExport(@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
HttpServletResponse response) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname,
|
||||
username,
|
||||
sex,
|
||||
member,
|
||||
welfareMember,
|
||||
personType,
|
||||
userState,
|
||||
unioncode,
|
||||
unionname,
|
||||
unionid,
|
||||
unitname,
|
||||
unitcode,
|
||||
unitid,
|
||||
threeUnitName,
|
||||
threeUnitCode,
|
||||
unionGroupName,
|
||||
mobile,
|
||||
campusName,
|
||||
TIMESTAMPDIFF(YEAR, schoolTime, CURDATE()) AS teachNum,
|
||||
birthday,
|
||||
thirtyCertificateProcessingTime
|
||||
from
|
||||
`user`
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("isThirtyTeach", "=", 1);
|
||||
if (StrUtil.isNotBlank(searchKeyword)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("username", searchKeyword);
|
||||
seg.orLike("loginname", searchKeyword);
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SchoolUnionMemberAdmin")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("unionid", "=", Vi.getUnionId());
|
||||
} else {
|
||||
cnd.and("unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds());
|
||||
}
|
||||
}
|
||||
cnd.andEX("unionid", "=", unionId);
|
||||
cnd.andEX("unitid", "=", unitId);
|
||||
cnd.andEX("threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("personType", "=", personType);
|
||||
cnd.andEX("userState", "=", userState);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> thirtyTeachList = baseService.listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
ExcelExportEntity no = new ExcelExportEntity("序号", "no", 10);
|
||||
no.setFormat("isAddIndex");
|
||||
entityList.add(no);
|
||||
entityList.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
entityList.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
entityList.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
entityList.add(new ExcelExportEntity("教龄(年)", "teachNum", 20));
|
||||
entityList.add(new ExcelExportEntity("电话", "mobile", 20));
|
||||
entityList.add(new ExcelExportEntity("工会", "unionname", 20));
|
||||
entityList.add(new ExcelExportEntity("单位", "unitname", 20));
|
||||
entityList.add(new ExcelExportEntity("在职状态", "userState", 20));
|
||||
entityList.add(new ExcelExportEntity("人员类型", "personType", 20));
|
||||
entityList.add(new ExcelExportEntity("荣誉证办理年月", "thirtyCertificateProcessingTime", 20));
|
||||
|
||||
try {
|
||||
ViTool.excelResponse(response, "30教龄教职工名单.xlsx");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, thirtyTeachList);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("thirtyTeach.manage")
|
||||
public Object doBatchDelete(@Param("userIds") String[] userIds) {
|
||||
List<String> userIdList = Arrays.asList(userIds);
|
||||
if (Lang.isNotEmpty(userIdList)) {
|
||||
sysUserService.update(Chain.make("isThirtyTeach", 0), Cnd.where("id", "in", userIdList));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.v.nutz.zhgh.staffmanage.thirtyteach.template;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class ThirtyTeachTemp {
|
||||
// @Excel(name = "工号")
|
||||
private String loginName;
|
||||
|
||||
@Excel(name = "姓名", width = 20d)
|
||||
private String userName;
|
||||
|
||||
@Excel(name = "身份证号码", width = 40d)
|
||||
private String idCard;
|
||||
|
||||
@Excel(name = "出生日期", importFormat = "yyyy-MM-dd", width = 40d)
|
||||
private String birthday;
|
||||
|
||||
@Excel(name = "《30年教龄荣誉证》办理年月", importFormat = "yyyy-MM", width = 40d)
|
||||
private String thirtyCertificateProcessingTime;
|
||||
|
||||
|
||||
// @Excel(name = "性别")
|
||||
// private String sex;
|
||||
//
|
||||
// @Excel(name = "联系电话")
|
||||
// private String mobile;
|
||||
//
|
||||
// @Excel(name = "入校时间")
|
||||
private Date schoolTime;
|
||||
|
||||
|
||||
private String remark;
|
||||
}
|
||||
Reference in New Issue
Block a user