This commit is contained in:
Paidax
2024-12-13 09:37:20 +08:00
parent 014beea7d4
commit c418e37618
20 changed files with 2043 additions and 230 deletions
@@ -308,7 +308,7 @@ public class ActivityBasicScopeController {
COLUMN_COMMENT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'sys_user'
AND TABLE_SCHEMA = 'zhgh_jiangnan'
AND TABLE_SCHEMA = 'zhgh_hmc'
""");
List<NutMap> sqlDataList = activityBasicScopeService.listMap(sql);
// sqlDataList.forEach(v -> v.put("DATA_TYPE", new String((byte[]) v.get("DATA_TYPE"))));
@@ -62,10 +62,6 @@ public class HMCFieldCode {
* 学位码
*/
static Map<String, String> ACADEMIC_DEGREE_CODE = new HashMap<>() {{
put("260", "医学博士专业学位");
put("270", "理学博士专业学位");
put("390", "医学硕士专业学位");
put("391", "理学硕士专业学位");
put("2", "博士");
put("201", "哲学博士学位");
put("202", "经济学博士学位");
@@ -80,9 +76,10 @@ public class HMCFieldCode {
put("211", "军事学博士学位");
put("212", "管理学博士学位");
put("245", "临床医学博士专业学位");
put("380", "农业硕士专业学位");
put("248", "兽医博士专业学位");
put("250", "口腔医学博士专业学位");
put("260", "医学博士专业学位");
put("270", "理学博士专业学位");
put("3", "硕士");
put("301", "哲学硕士学位");
put("302", "经济学硕士学位");
@@ -108,6 +105,9 @@ public class HMCFieldCode {
put("350", "口腔医学硕士专业学位");
put("351", "公共卫生硕士专业学位");
put("352", "军事硕士专业学位");
put("380", "农业硕士专业学位");
put("390", "医学硕士专业学位");
put("391", "理学硕士专业学位");
put("4", "学士");
put("401", "哲学学士学位");
put("402", "经济学学士学位");
@@ -27,7 +27,7 @@ import java.util.Map;
*
* @author 1V
* @date 2021/3/4
* @since 浙江财经
* @since 杭州医学院
*/
public interface SourceData {
@@ -45,13 +45,11 @@ public interface SourceData {
// Assert.isTrue(jsonResult.getBoolean("success"), jsonResult.getString("data"));
}
/* *//**
* 在职状态码
*//*
Map<String, String> USER_STATE_CODE = new HashMap<>() {{
put("100", "在职状态");
put("200", "不在职状态");
}};*/
/**
* 不进系统人员
*/
List<String> NOT_ENTERING_USER = List.of("退休人员", "兼职教师", "非全日用工(项目临聘)", "服务外包和其他人员",
"教学编制2", "教学教师(附属医院)", "教学编制", "离休人员", "临时人员", "非全日制工", "博士后(在职)");
/**
* 接口中的数据跟SourceUser的对应关系
@@ -116,6 +114,9 @@ public interface SourceData {
// checkSuccess(map);
List<NutMap> data = map.getAsList("data", NutMap.class);
for (NutMap row : data) {
if (NOT_ENTERING_USER.contains(row.getString("RYFLMC"))) {
continue;
}
Map entity = new HashMap(500);
row.forEach((k, v) -> {
@@ -148,6 +149,7 @@ public interface SourceData {
put("DWH", new String[]{"id", "unitcode"});
put("DWMC", new String[]{"name"});
put("SJDWH", new String[]{"parentId"});
put("PX", new String[]{"location"});
}};
/**
@@ -3,6 +3,7 @@ package io.v.nutz.zhgh.data.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.utils.ManyAddOrRenewUtil;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.sys.services.SysUserRoleService;
@@ -59,22 +60,23 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
super(dao);
}
// 是会员的人员类型
private final List<String> MEMBER_PERSON_TYPE = List.of("事业编制(员额)", "事业编制", "校聘编外", "同工同酬", "学校编制", "博士后(统招)");
@Inject
private AsyncService asyncService;
@Inject
private SysUserService sysUserService;
@Inject
private HistoryUserService historyUserService;
@Inject
private UserPatUpService userPatUpService;
@Inject
private SysRoleService sysRoleService;
@Inject
private SysUserRoleService sysUserRoleService;
@Inject
private ManyAddOrRenewUtil manyAddOrRenewUtil;
@Override
@Aop(TransAop.READ_COMMITTED)
@@ -97,7 +99,7 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
List<UserSource> sources = new ArrayList<>();
List<UserHistory> histories = new ArrayList<>();
List<UserHistory> histories = new CopyOnWriteArrayList<>();
Map<String, String> userPartMap = new HashMap<>();
if (Strings.isNotBlank(partGroupId)) {
@@ -117,16 +119,20 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
AtomicReference<Dao> filterColumnDao = new AtomicReference<>(dao());
//全部更新时,要修改的用户表
List<Sys_user> needDoUpdateList = new ArrayList<>();
//新增的用户
List<Sys_user> needInitUserList = new ArrayList<>();
//添加角色的用户
List<Sys_user_role> userRoles = new ArrayList<>();
// 全部更新时,要修改的用户表
List<Sys_user> needDoUpdateList = new CopyOnWriteArrayList<>();
// 新增的用户
List<Sys_user> needInitUserList = new CopyOnWriteArrayList<>();
// 添加角色的用户
List<Sys_user_role> userRoles = new CopyOnWriteArrayList<>();
// 添加会员角色
List<String> addMemberUserIds = new CopyOnWriteArrayList<>();
// 移除会员角色
List<String> deleteMemberUserIds = new CopyOnWriteArrayList<>();
// 创建一个固定大小的线程池 可以根据服务器性能调整线程池大小
int numberOfThreads = Runtime.getRuntime().availableProcessors() * 2;
List<CompletableFuture<Void>> futures = new ArrayList<>();
List<CompletableFuture<Void>> futures = new CopyOnWriteArrayList<>();
// 每批处理的数据量,可以根据实际情况调整
int batchSize = 200;
@@ -142,11 +148,25 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
source.setWelfareMember(null);
Sys_user user = userMap.get(source.getLoginname().toLowerCase());
if (MEMBER_PERSON_TYPE.contains(source.getPersonType()) && "在职".equals(source.getUserState())) {
source.setMember(1);
source.setWelfareMember(1);
if (Lang.isNotEmpty(user) && user.getMember() == 1) {
} else {
addMemberUserIds.add(Lang.isNotEmpty(user) ? user.getId() : source.getId());
}
} else {
source.setMember(0);
source.setWelfareMember(0);
deleteMemberUserIds.add(Lang.isNotEmpty(user) ? user.getId() : source.getId());
}
Sys_user u = new Sys_user();
BeanUtils.copyProperties(source, u);
switch (sourceType) {
case "all" -> {
//复制属性到一个新的user对象
// 复制属性到一个新的user对象
u.setId(user == null ? source.getId() : user.getId());
if (user != null) {
needDoUpdateList.add(u);
@@ -195,6 +215,22 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
sysUserRoleService.insert(userRoles);
}
// 添加会员角色
if (Lang.isNotEmpty(addMemberUserIds)) {
String memberRoleId = Roles.MEMBER;
List<Sys_user_role> list = addMemberUserIds.stream().map(v -> {
Sys_user_role userRole = new Sys_user_role();
userRole.setUserId(v);
userRole.setRoleId(memberRoleId);
return userRole;
}).toList();
manyAddOrRenewUtil.asyncExecuteInsert(list, 200);
}
// 不是定义的personType的人员,去除会员角色
if (Lang.isNotEmpty(deleteMemberUserIds)) {
dao().clear(Sys_user_role.class, Cnd.where("userId", "in", deleteMemberUserIds).and("roleId", "=", Roles.MEMBER));
}
// Collection<String[]> updateColumns = SourceData.USER_FIELD_RELATION.values();
if ("part".equals(sourceType)) {
@@ -203,10 +239,12 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
massUpdatesAsync(needDoUpdateList, false, null);
}
//历史记录表插入数据
// 历史记录表插入数据
historyUserService.dao().fastInsert(histories);
//人员状态及在职状态更新
// 人员状态及在职状态更新
userPatUpService.renewUserState();
// 修改不在人事库的人员,删除角色
userPatUpService.deleteNotInSourceUser();
//清除缓存
// sysUserService.clearCache();
// sysRoleService.clearCache();
@@ -17,7 +17,7 @@ import org.nutz.mvc.annotation.Ok;
public class FundsReimbursementViewController {
@At("")
@Ok("beetl:/platform/jf/funds/fundsReimbursementview.html")
@Ok("beetl:/platform/jf/Funds/fundsReimbursementview.html")
@RequiresPermissions("sys.jf.funds.reimbursementview")
public void index() {
}
@@ -455,59 +455,6 @@ public class MemberInquireIntegrateController {
@Param(value = "memberSearchKeyWord", required = false) String memberSearchKeyWord,
String props) {
try {
// int yyyy = Calendar.getInstance().get(Calendar.YEAR);
// CndPlus cnd = CndPlus.create();
// Sql sql = Sqls.create("""
// SELECT
// *,
// unitname,
// unionname,
// unitcode,
// 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);
// if (ShiroUtil.hasAnyRoles("sysadmin,A06,H03")) {
// cnd.andEX("unionid", "=", unionId);
// } else {
// cnd.andEX("unionid", "=", Vi.getUnionId());
// }
// cnd.andEX("unitid", "=", unitId);
// if (memberStatus != null) {
// if (Json.fromJsonAsArray(Integer.class, memberStatus).length > 0) {
// cnd.andEX("memberStatus", "in", Json.fromJsonAsArray(Integer.class, memberStatus));
// } else {
// List<Integer> status = new ArrayList<>();
// status.add(MemberStatus.NORMAL.getCode());
// status.add(MemberStatus.TURN_IN.getCode());
// status.add(MemberStatus.RESTORE.getCode());
// SqlExpressionGroup group = new SqlExpressionGroup();
// group.and("memberStatus", "in", status);
// group.or("memberStatus", "IS", null);
// cnd.and(group);
// }
// }
//
// if (personTypes != null && Json.fromJsonAsArray(String.class, personTypes).length > 0) {
// cnd.andEX("personType", "in", Json.fromJsonAsArray(String.class, personTypes));
// }
// if (userStates != null && Json.fromJsonAsArray(String.class, userStates).length > 0) {
// cnd.andEX("userState", "in", Json.fromJsonAsArray(String.class, userStates));
// }
// cnd.asc("unitcode");
// cnd.asc("unioncode");
// cnd.asc("memberJoinTime");
// sql.setCondition(cnd);
int yyyy = Calendar.getInstance().get(Calendar.YEAR);
Cnd cnd = MemberUtils.getCnd(null, startDate, endDate, unionId, unitId, personTypes, userStates, memberTypes, sexTypes, age, null, roleIds, null, null, memberStatus, threeUnitId, unionGroupId, reverseSelection, null, null, campus);