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
@@ -0,0 +1,125 @@
package io.v.nutz.base.config;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;
/**
* @version 1.0
* @Author zzr
* @nameThreadPoolConfig
* @Date 2024/12/6 14:35
* @注释
*/
@Slf4j
@IocBean
public class ThreadPoolConfig {
@Inject
private Dao dao;
/**
* 核心线程数(默认线程数)
*/
private static final int CORE_POOL_SIZE = 2 * Runtime.getRuntime().availableProcessors() + 1;
/**
* 最大线程数
*/
private static final int MAX_POOL_SIZE = 128;
/**
* 允许线程空闲时间(单位:默认为秒)
*/
private static final int KEEP_ALIVE_TIME = 5;
/**
* 任务的等待时间
*/
private static final int AWAIT_TERMINATION_TIME = 30;
/**
* 缓冲队列数
*/
private static final int QUEUE_CAPACITY = 1200;
/**
* 线程池名前缀
*/
private static final String THREAD_NAME_PREFIX = "dd3s-thread-pool";
/**
* bean的名称,默认为首字母小写的方法名
* spring管理的线程池,顶级父类也是Executor
*/
@IocBean(name = "executorService")
public ThreadPoolTaskExecutor executorService() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(CORE_POOL_SIZE);
executor.setMaxPoolSize(MAX_POOL_SIZE);
executor.setQueueCapacity(QUEUE_CAPACITY);
executor.setKeepAliveSeconds(KEEP_ALIVE_TIME);
executor.setThreadNamePrefix(THREAD_NAME_PREFIX);
executor.setAwaitTerminationSeconds(AWAIT_TERMINATION_TIME);
executor.setWaitForTasksToCompleteOnShutdown(true);
// 线程池对拒绝任务的处理策略
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
executor.initialize();
return executor;
}
/**
* 异步执行
*
* @param list 泛型list,任意实体类集合
* @param batchSize 期望单次操作的数量,默认200
* @param mode insert插入 update更新 insertOrUpdate插入或更新
* @param isFastInsertOrUpdateIgnoreNull mode为新增此值为true代表fastInsertmode为修改时此值为true代表updateIgnoreNull
* @param <T>
*/
public <T> void asyncExecute(List<T> list, Integer batchSize, String mode, boolean isFastInsertOrUpdateIgnoreNull) {
if (Lang.isEmpty(list)) {
return;
}
if (batchSize == null || batchSize <= 0) {
batchSize = 200;
}
for (int i = 0; i < list.size(); i += batchSize) {
final int end = Math.min(i + batchSize, list.size());
List<T> batch = list.subList(i, end);
executorService().execute(() -> {
try {
switch(mode) {
case "insert" -> {
if (isFastInsertOrUpdateIgnoreNull) {
dao.fastInsert(batch);
} else {
dao.insert(batch);
}
}
case "update" -> {
if (isFastInsertOrUpdateIgnoreNull) {
dao.updateIgnoreNull(batch);
} else {
dao.update(batch);
}
}
case "insertOrUpdate" -> dao.insertOrUpdate(batch);
}
} catch (Exception e) {
// 日志记录异常信息
System.err.println("Error occurred while inserting batch: " + e.getMessage());
e.printStackTrace();
}
});
}
}
}
@@ -0,0 +1,82 @@
package io.v.nutz.base.utils;
import io.v.nutz.base.config.ThreadPoolConfig;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import java.util.List;
/**
* @version 1.0
* @Author zzr
* @nameManyAddOrRenewUtil
* @Date 2024/7/24 16:16
* @注释
*/
@IocBean
public class ManyAddOrRenewUtil {
@Inject
private ThreadPoolConfig threadPoolConfig;
/**
* 批量快速插入,异步执行
*
* @param list 泛型list,任意实体类集合
* @param batchSize 期望单次操作的数量,默认200
* @param <T>
*/
public <T> void asyncExecuteFastInsert(List<T> list, Integer batchSize) {
threadPoolConfig.asyncExecute(list, batchSize, "insert", true);
}
/**
* 批量插入(非快速),异步执行
*
* @param list 泛型list,任意实体类集合
* @param batchSize 期望单次操作的数量,默认200
* @param <T>
*/
public <T> void asyncExecuteInsert(List<T> list, Integer batchSize) {
threadPoolConfig.asyncExecute(list, batchSize, "insert", true);
}
/**
* 批量修改(忽略空值),异步执行
*
* @param list 泛型list,任意实体类集合
* @param batchSize 期望单次操作的数量,默认200
* @param <T>
*/
public <T> void asyncExecuteUpdateIgnoreNull(List<T> list, Integer batchSize) {
threadPoolConfig.asyncExecute(list, batchSize, "update", true);
}
/**
* 批量修改(不忽略空值),异步执行
*
* @param list 泛型list,任意实体类集合
* @param batchSize 期望单次操作的数量,默认200
* @param <T>
*/
public <T> void asyncExecuteUpdate(List<T> list, Integer batchSize) {
threadPoolConfig.asyncExecute(list, batchSize, "update", false);
}
/**
* 新增或修改,异步执行
*
* @param list 泛型list,任意实体类集合
* @param batchSize 期望单次操作的数量,默认200
* @param <T>
*/
public <T> void asyncExecuteInsertOrUpdate(List<T> list, Integer batchSize) {
threadPoolConfig.asyncExecute(list, batchSize, "insertOrUpdate", false);
}
}
@@ -110,6 +110,7 @@ public class SysUnitMangeController {
public Object pageData(@Param(value = "parentId", required = false) String parentId, PageForm pageForm) {
CndPlus cnd = CndPlus.create();
cnd.andEx("parentId", "=", parentId);
cnd.asc("location");
return sysUnitService.list(pageForm, cnd);
}
@@ -211,7 +212,7 @@ public class SysUnitMangeController {
private AsyncService asyncService;
private List<Sys_unit> child(String parentId) {
List<Sys_unit> units = sysUnitService.query(Cnd.where("parentId", "=", parentId));
List<Sys_unit> units = sysUnitService.query(Cnd.where("parentId", "=", parentId).asc("location"));
units.forEach(unit -> {
unit.setChild(child(unit.getId()));
@@ -13,4 +13,6 @@ public interface UserPatUpService extends ViService<UserPartUp> {
void largeDataInsert(List<UserPartUp> list);
void renewUserState();
void deleteNotInSourceUser();
}
@@ -3,12 +3,18 @@ package io.v.nutz.web.commons.controller.userpartupdate.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import io.v.nutz.base.service.impl.ViServiceImpl;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.web.commons.controller.userpartupdate.models.UserPartUp;
import io.v.nutz.web.commons.controller.userpartupdate.service.UserPatUpService;
import io.v.nutz.sys.models.Sys_dict;
import io.v.nutz.sys.services.SysDictService;
import io.v.nutz.zhgh.data.model.UserSource;
import lombok.extern.slf4j.Slf4j;
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.impl.NutTxDao;
@@ -17,6 +23,7 @@ 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 java.util.ArrayList;
import java.util.List;
@@ -143,4 +150,36 @@ public class UserPartUpServiceImpl extends ViServiceImpl<UserPartUp> implements
sysDictService.clearCache();
}
@Override
@Aop(TransAop.READ_COMMITTED)
public void deleteNotInSourceUser() {
Sql maxPullTimeSql = Sqls.create("select pullTime from user_source GROUP BY pullTime ORDER BY pullTime desc LIMIT 1");
maxPullTimeSql.setCallback(Sqls.callback.map());
dao().execute(maxPullTimeSql);
NutMap map = (NutMap) maxPullTimeSql.getResult();
// 修改不在人事库的人员状态
Sql querySql = Sqls.create("select id,loginname from sys_user where loginname not in (select loginname from user_source where pullTime = @pullTime) and loginname != 'superadmin'")
.setParam("pullTime", map.getString("pullTime"));
querySql.setCallback(Sqls.callback.maps());
dao().execute(querySql);
List<NutMap> list = (List<NutMap>) querySql.getResult();
if (Lang.isEmpty(list)) {
return;
}
List<String> userIdList = list.stream().map(v -> v.getString("id")).toList();
List<String> userLoginNameList = list.stream().map(v -> v.getString("loginname")).toList();
// 修改不在人事库人员的状态
dao().update(Sys_user.class, Chain.make("userState", "非人事库人员").add("personType", "非人事库人员")
.add("member", 0).add("welfareMember", 0),
Cnd.where("loginname", "in", userLoginNameList));
// 去除不在人事库的人员角色,只保留公共角色
dao().clear(Sys_user_role.class, Cnd.where("userId", "in", userIdList).and("roleId", "!=", Roles.PUBLIC));
}
}
@@ -0,0 +1,78 @@
package io.v.nutz.web.commons.ext.beetl;
import org.beetl.core.Resource;
import org.beetl.core.misc.BeetlUtil;
import org.beetl.core.resource.ClasspathResource;
import org.beetl.core.resource.ClasspathResourceLoader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class BeetlCustomResourceLoader extends ClasspathResourceLoader {
public Resource getResource(String key) {
Resource resource = new ClasspathResource(key, this.getChildPath(super.getRoot(), key), this);
return resource;
}
public String getResourceId(Resource resource, String id) {
// return resource == null ? id : BeetlUtil.getRelPath(resource.getId(), id);
return getRelPath(resource.getId(), id);
}
/**
* 增加判断相对路径
* 光见鬼
*/
private String getRelPath(String siblings, String resourceId) {
// 参数校验
if (resourceId == null || resourceId.isEmpty()) {
throw new RuntimeException("资源ID为空,参数错");
}
// 如果是绝对路径,直接返回(以 / 或 \ 开头)
if (resourceId.charAt(0) == '\\' || resourceId.charAt(0) == '/') {
if (BeetlUtil.isOutsideOfRoot(resourceId)) {
throw new RuntimeException("不能访问外部文件或者模板");
}
return resourceId;
}
// 处理相对路径
String baseDir = siblings;
// 如果siblings是文件路径,获取其所在目录
int lastSeparatorIndex = Math.max(siblings.lastIndexOf('/'), siblings.lastIndexOf('\\'));
if (lastSeparatorIndex > 0) {
baseDir = siblings.substring(0, lastSeparatorIndex + 1);
}
// 分割路径
String[] parts = resourceId.replace('\\', '/').split("/");
List<String> baseParts = new ArrayList<>(
Arrays.asList(baseDir.replace('\\', '/').split("/"))
);
baseParts.removeIf(String::isEmpty);
// 处理 ../ 和 ./
for (String part : parts) {
if ("..".equals(part)) {
if (!baseParts.isEmpty()) {
baseParts.remove(baseParts.size() - 1);
}
} else if (!".".equals(part) && !part.isEmpty()) {
baseParts.add(part);
}
}
// 组合最终路径
String result = "/" + String.join("/", baseParts);
// 检查是否访问外部文件
if (BeetlUtil.isOutsideOfRoot(result)) {
throw new RuntimeException("不能访问外部文件或者模板");
}
return result;
}
}
@@ -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);
@@ -0,0 +1,172 @@
!(function (e, r) {
"object" == typeof exports && "undefined" != typeof module
? (module.exports = r())
: "function" == typeof define && define.amd
? define(r)
: ((e || self).createPersistedState = r())
})(this, function () {
var e = function (e) {
return (
(function (e) {
return !!e && "object" == typeof e
})(e) &&
!(function (e) {
var t = Object.prototype.toString.call(e)
return (
"[object RegExp]" === t ||
"[object Date]" === t ||
(function (e) {
return e.$$typeof === r
})(e)
)
})(e)
)
},
r = "function" == typeof Symbol && Symbol.for ? Symbol.for("react.element") : 60103
function t(e, r) {
return !1 !== r.clone && r.isMergeableObject(e) ? u(Array.isArray(e) ? [] : {}, e, r) : e
}
function n(e, r, n) {
return e.concat(r).map(function (e) {
return t(e, n)
})
}
function o(e) {
return Object.keys(e).concat(
(function (e) {
return Object.getOwnPropertySymbols
? Object.getOwnPropertySymbols(e).filter(function (r) {
return e.propertyIsEnumerable(r)
})
: []
})(e)
)
}
function c(e, r) {
try {
return r in e
} catch (e) {
return !1
}
}
function u(r, i, a) {
;((a = a || {}).arrayMerge = a.arrayMerge || n), (a.isMergeableObject = a.isMergeableObject || e), (a.cloneUnlessOtherwiseSpecified = t)
var f = Array.isArray(i)
return f === Array.isArray(r)
? f
? a.arrayMerge(r, i, a)
: (function (e, r, n) {
var i = {}
return (
n.isMergeableObject(e) &&
o(e).forEach(function (r) {
i[r] = t(e[r], n)
}),
o(r).forEach(function (o) {
;(function (e, r) {
return c(e, r) && !(Object.hasOwnProperty.call(e, r) && Object.propertyIsEnumerable.call(e, r))
})(e, o) ||
(i[o] =
c(e, o) && n.isMergeableObject(r[o])
? (function (e, r) {
if (!r.customMerge) return u
var t = r.customMerge(e)
return "function" == typeof t ? t : u
})(o, n)(e[o], r[o], n)
: t(r[o], n))
}),
i
)
})(r, i, a)
: t(i, a)
}
u.all = function (e, r) {
if (!Array.isArray(e)) throw new Error("first argument should be an array")
return e.reduce(function (e, t) {
return u(e, t, r)
}, {})
}
var i = u
return function (e) {
var r = (e = e || {}).storage || (window && window.localStorage),
t = e.key || "vuex"
function n(e, r) {
var t = r.getItem(e)
try {
return "string" == typeof t ? JSON.parse(t) : "object" == typeof t ? t : void 0
} catch (e) {}
}
function o() {
return !0
}
function c(e, r, t) {
return t.setItem(e, JSON.stringify(r))
}
function u(e, r) {
return Array.isArray(r)
? r.reduce(function (r, t) {
return (function (e, r, t, n) {
return (
!/^(__proto__|constructor|prototype)$/.test(r) &&
((r = r.split ? r.split(".") : r.slice(0)).slice(0, -1).reduce(function (e, r) {
return (e[r] = e[r] || {})
}, e)[r.pop()] = t),
e
)
})(
r,
t,
((n = e),
void 0 ===
(n = ((o = t).split ? o.split(".") : o).reduce(function (e, r) {
return e && e[r]
}, n))
? void 0
: n)
)
var n, o
}, {})
: e
}
function a(e) {
return function (r) {
return e.subscribe(r)
}
}
;(
e.assertStorage ||
function () {
r.setItem("@@", 1), r.removeItem("@@")
}
)(r)
var f,
s = function () {
return (e.getState || n)(t, r)
}
return (
e.fetchBeforeUse && (f = s()),
function (n) {
e.fetchBeforeUse || (f = s()),
"object" == typeof f &&
null !== f &&
(n.replaceState(
e.overwrite
? f
: i(n.state, f, {
arrayMerge:
e.arrayMerger ||
function (e, r) {
return r
},
clone: !1
})
),
(e.rehydrated || function () {})(n)),
(e.subscriber || a)(n)(function (n, i) {
;(e.filter || o)(n) && (e.setState || c)(t, (e.reducer || u)(i, e.paths), r)
})
}
)
}
})
//# sourceMappingURL=vuex-persistedstate.umd.js.map
File diff suppressed because it is too large Load Diff
@@ -336,7 +336,6 @@
<script>
window.sessionStorage.setItem('moduleMenus', JSON.stringify(${@shiro.userModuleMenus()}))
const leftMenuApp = new Vue({
el: '#asideMenu',
data() {
@@ -447,7 +446,6 @@
},
methods: {
getUnReadMsgNum() {
console.log('-----------------------')
$.get('/platform/sys/msg/user/unread_num').then(res => {
if (res.code === 0) {
const totalSum = Object.values(res.data).reduce(function (sum, value) {
@@ -97,7 +97,7 @@ layout("/layouts/platform.html"){
</el-row>
</el-card>
<el-card shadow="never" class="mt10">
<el-card shadow="never">
<el-row type="flex" align="middle" class="query-row">
<el-col class="query-row-content">
<el-row>
@@ -130,44 +130,46 @@ layout("/layouts/platform.html"){
</el-col>
</el-row>
<!-- <el-row type="flex" align="middle" class="query-row">-->
<!-- <el-col class="query-row-content">-->
<!-- <el-row>-->
<!-- <el-col :span="12">-->
<!-- <span>工会小组:</span>-->
<!-- <el-select v-model="pageForm.unionGroupId"-->
<!-- filterable-->
<!-- clearable-->
<!-- multiple-->
<!-- style="margin-left: 33px;width: 80%"-->
<!-- @change="getThreeUnitsByGroupIdsOrUnitIds"-->
<!-- placeholder="请选择">-->
<!-- <el-option-->
<!-- v-for="item in unionGroups"-->
<!-- :key="item.id"-->
<!-- :label="item.groupName"-->
<!-- :value="item.id">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <span>组成科室:</span>-->
<!-- <el-select v-model="pageForm.threeUnitId" filterable-->
<!-- clearable-->
<!-- multiple-->
<!-- style="margin-left: 33px;width: 80%"-->
<!-- placeholder="请选择">-->
<!-- <el-option-->
<!-- v-for="item in threeUnits"-->
<!-- :key="item.id"-->
<!-- :label="item.name"-->
<!-- :value="item.id">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- </el-col>-->
<!-- </el-row>-->
<template v-if="isThreeUnit">
<el-row type="flex" align="middle" class="query-row">
<el-col class="query-row-content">
<el-row>
<el-col :span="12">
<span>工会小组:</span>
<el-select v-model="pageForm.unionGroupId"
filterable
clearable
multiple
style="margin-left: 33px;width: 80%"
@change="getThreeUnitsByGroupIdsOrUnitIds"
placeholder="请选择">
<el-option
v-for="item in unionGroups"
:key="item.id"
:label="item.groupName"
:value="item.id">
</el-option>
</el-select>
</el-col>
<el-col :span="12">
<span>组成科室:</span>
<el-select v-model="pageForm.threeUnitId" filterable
clearable
multiple
style="margin-left: 33px;width: 80%"
placeholder="请选择">
<el-option
v-for="item in threeUnits"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-col>
</el-row>
</el-col>
</el-row>
</template>
<el-row class="query-row">
<el-col class="query-row-title">性别:</el-col>
@@ -350,7 +352,7 @@ layout("/layouts/platform.html"){
</el-col>
</el-row>
<!--<el-row class="query-row"
v-if="is_H10===true||is_SchoolUnionMemberAdmin===true||is_sysadmin===true||is_H04===true">
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H04===true">
<el-col class="query-title">条件匹配:</el-col>
<el-col class="query-content">
<user-cnd @cnd="(v)=>{this.$set(this.pageForm,'activityUserCnd',v)}"></user-cnd>
@@ -376,26 +378,36 @@ layout("/layouts/platform.html"){
<template #func>
<el-select v-model="pageForm.isUnit" placeholder="是否有单位" clearable
class="mr10" size="small">
style="width: 150px"
class="mr10">
<el-option label="有单位" :value="true"></el-option>
<el-option label="无单位" :value="false"></el-option>
</el-select>
<el-select v-model="pageForm.isUnion" placeholder="是否有工会" clearable
class="mr10" size="small">
style="width: 150px"
class="mr10">
<el-option label="有工会" :value="true"></el-option>
<el-option label="无工会" :value="false"></el-option>
</el-select>
<!-- <el-button slot="reference"-->
<!-- @click="allIsWelfareMember"-->
<!-- v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('SchoolUnionMemberAdmin')||@shiro.hasRole('H03')}"-->
<!-- type="primary" :loading="welfareMemberLoading" size="small">-->
<!-- 全部设置为福利会员-->
<!-- </el-button>-->
<el-select v-model="pageForm.memberType" placeholder="会员状态" clearable
style="width: 150px" @change="doSearch"
class="mr10">
<el-option label="全部教工" :value="1"></el-option>
<el-option label="是会员" :value="2"></el-option>
<el-option label="非会员" :value="3"></el-option>
</el-select>
<el-button slot="reference"
@click="allIsWelfareMember"
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}"
type="primary" :loading="welfareMemberLoading" size="medium">
全部设置为福利会员
</el-button>
<!-- <el-popconfirm-->
<!-- v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('SchoolUnionMemberAdmin')||@shiro.hasRole('H03')}"-->
<!-- v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}"-->
<!-- title="确定要将所有会员设为福利会员吗?"-->
<!-- @confirm="allIsWelfareMember"-->
<!-- >-->
@@ -410,7 +422,7 @@ layout("/layouts/platform.html"){
<el-button icon="el-icon-printer" class="m10" type="primary"
style="float: right"
size="small" @click="doExportByUnion">导出
size="medium" @click="doExportByUnion">导出
</el-button>
@@ -448,7 +460,7 @@ layout("/layouts/platform.html"){
<el-table-column align="center" header-align="center" label="操作" width="100px">
<template scope="{row:{id}}">
<el-button size="mini" @click="openView(id)" type="primary">查看</el-button>
<el-button size="small" @click="openView(id)">查看</el-button>
</template>
</el-table-column>
</el-table>
@@ -500,6 +512,7 @@ layout("/layouts/platform.html"){
mixins: [initTableMixins],
data() {
return {
isThreeUnit: false,
sexTypeOptions: [
{code: '男', name: '男'},
{code: '女', name: '女'}
@@ -537,7 +550,8 @@ layout("/layouts/platform.html"){
reverseSelection: false,
activityUserCnd: '',
startDate: '',
endDate: ''
endDate: '',
memberType:2,
},
personTypeOptions: [],
@@ -565,8 +579,8 @@ layout("/layouts/platform.html"){
{prop: 'userState', label: '在职状态', sortable: true},
{prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true},
// {prop: 'threeUnitName', label: '所在科室', sortable: true},
// {prop: 'unionGroupName', label: '工会小组', sortable: true},
{prop: 'threeUnitName', label: '所在科室', sortable: true},
{prop: 'unionGroupName', label: '工会小组', sortable: true},
{prop: 'campusName', label: '所属校区', sortable: true, checked: 0},
{prop: 'marriage', label: '婚否', checked: 0},
{prop: 'education', label: '学历', checked: 0},
@@ -580,10 +594,12 @@ layout("/layouts/platform.html"){
}
},
components: {
'member': httpVueLoader('/components/member/MemberInfo.vue?v=' + new Date().getTime()),
'mem-change-records': httpVueLoader('/components/member/MemChangeRecords.vue?v=' + new Date().getTime()),
'member-cnd': httpVueLoader('/components/member/MemberCnd.vue?v=' + new Date().getTime()),
'user-cnd': httpVueLoader('/components/plugins/UserCnd.vue?v=' + new Date().getTime())
'guava': httpVueLoader('/components/plugins/Guava.vue'),
'member': httpVueLoader('/components/member/MemberInfo.vue?v=1.0.3'),
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.1'),
'mem-change-records': httpVueLoader('/components/member/MemChangeRecords.vue?v=1.0.2'),
'member-cnd': httpVueLoader('/components/member/MemberCnd.vue'),
'user-cnd': httpVueLoader('/components/plugins/UserCnd.vue'),
},
methods: {
async allIsWelfareMember() {
@@ -651,6 +667,7 @@ layout("/layouts/platform.html"){
startDate,
endDate,
campus,
memberType,
reverseSelection,
memberSearchName,
memberSearchKeyWord
@@ -658,7 +675,7 @@ layout("/layouts/platform.html"){
window.location.href = loc() + "/doExportByUnion?=searchName=" + this.pageForm.searchName
+ "&searchKeyword=" + this.pageForm.searchKeyword + "&unitId=" + unitId + "&unionId=" + unionId
+ "&unionGroupId=" + unionGroupId + "&threeUnitId=" + threeUnitId + "&sexTypes=" + sexTypes
+ "&unionGroupId=" + unionGroupId + "&threeUnitId=" + threeUnitId + "&sexTypes=" + sexTypes + "&memberType=" + memberType
+ "&roleIds=" + roleIds + "&age=" + age + "&year=" + this.pageForm.year + "&memberStatus=" + memberStatus
+ "&startDate=" + (startDate ? this.getDate(startDate) : '') + "&endDate=" + (endDate ? this.getDate(endDate) : '') + "&campus=" + (campus ? campus : '')
+ "&reverseSelection=" + (reverseSelection ? reverseSelection : '') + "&memberSearchName=" + (memberSearchName ? memberSearchName : '')
@@ -832,7 +849,7 @@ layout("/layouts/platform.html"){
},
},
async created() {
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('SchoolUnionMemberAdmin')||@shiro.hasRole('H03')}" === 'true') {
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.unions = await getUnions(null, false)
} else {
this.unions = await getUnions(null, true)
@@ -19,13 +19,14 @@ layout("/layouts/platform.html"){
</el-card>
<el-card class="mt10" shadow="never">
<el-table :data="tableData" :highlight-current-row="true" :key="tableKey"
:load="loadChild" lazy row-key="id"
:load="loadChild" lazy row-key="id" ref="tableData"
:expand-row-keys="expandedRowKeysRenew"
@expand-change="handleExpandChange"
style="width: 100%">
<el-table-column :show-overflow-tooltip="true" align="left" header-align="center"
label="字典名称" prop="name" width="200">
</el-table-column>
<el-table-column :show-overflow-tooltip="true" header-align="center" label="字典代码"
prop="code">
</el-table-column>
@@ -62,11 +63,11 @@ layout("/layouts/platform.html"){
:command="{type:'disable',id:scope.row.id,name:scope.row.name,row:scope.row}">
禁用
</el-dropdown-item>
<el-dropdown-item :command="{type:'edit',id:scope.row.id,name:scope.row.name}"
<el-dropdown-item :command="{type:'edit',data:scope.row}"
divided>
修改
</el-dropdown-item>
<el-dropdown-item :command="{type:'delete',id:scope.row.id,name:scope.row.name}">
<el-dropdown-item :command="{type:'delete',data:scope.row}">
删除
</el-dropdown-item>
</el-dropdown-menu>
@@ -164,7 +165,7 @@ layout("/layouts/platform.html"){
</el-dialog>
</div>
<script>
new Vue({
const vue = new Vue({
el: "#app",
data: function () {
return {
@@ -210,6 +211,9 @@ layout("/layouts/platform.html"){
children: 'children',
label: 'label'
},
// 保存展开状态的数组
expandedRowKeysRenew: [],
tableTreeRefreshTool: {}
}
},
methods: {
@@ -297,7 +301,7 @@ layout("/layouts/platform.html"){
type: 'success'
});
self.addDialogVisible = false;
self.initTreeTable();
self.loadChildByExpandedKeys();
} else {
self.$message({
message: data.msg,
@@ -320,7 +324,7 @@ layout("/layouts/platform.html"){
type: 'success'
});
self.editDialogVisible = false;
self.initTreeTable();
self.loadChildByExpandedKeys()
} else {
self.$message({
message: data.msg,
@@ -335,7 +339,7 @@ layout("/layouts/platform.html"){
var self = this;
var url = base + "/platform/sys/dict/child";
$.post(url, {pid: ""}, function (data) {
if (data.code == 0) {
if (data.code === 0) {
self.tableData = data.data;
self.tableKey = +new Date();
}
@@ -343,6 +347,12 @@ layout("/layouts/platform.html"){
},
loadChild: function (tree, treeNode, resolve) {
// 在之前声明的全局变量中,增加一个key为 本条数据的id,id可替换为你数据中的任意唯一值
this.tableTreeRefreshTool[tree.id] = {}
// 重要!保存resolve方法,以便后续使用
this.tableTreeRefreshTool[tree.id].resolve = resolve
// 记录展开次数,具体作用后续介绍
this.tableTreeRefreshTool[tree.id].expandCount = 0
var url = base + "/platform/sys/dict/child";
$.post(url, {pid: tree.id}, function (data) {
if (data.code == 0) {
@@ -359,8 +369,9 @@ layout("/layouts/platform.html"){
self.isAddFromSub = true;
}
if ("edit" == command.type) {
$.post(base + "/platform/sys/dict/edit/" + command.id, {}, function (data) {
$.post(base + "/platform/sys/dict/edit/" + command.data.id, {}, function (data) {
if (data.code == 0) {
self.beforeEditData = command.data
self.formData = data.data;//加载后台表单数据
self.editDialogVisible = true;//打开编辑窗口
} else {
@@ -393,19 +404,19 @@ layout("/layouts/platform.html"){
}, "json");
}
if ("delete" == command.type) {
self.$confirm('此操作将删除 ' + command.name, '提示', {
self.$confirm('此操作将删除 ' + command.data.name, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: function (a, b) {
if ("confirm" == a) {//确认后再执行
$.post(base + "/platform/sys/dict/delete/" + command.id, {}, function (data) {
$.post(base + "/platform/sys/dict/delete/" + command.data.id, {}, function (data) {
if (data.code == 0) {
self.$message({
message: data.msg,
type: 'success'
});
self.initTreeTable();
self.loadChildByExpandedKeys();
} else {
self.$message({
message: data.msg,
@@ -418,6 +429,31 @@ layout("/layouts/platform.html"){
});
}
},
handleExpandChange(row, expanded) {
if ((row.parentId === '' || row.parentId == null) && !expanded) {
this.expandedRowKeysRenew = []
return
}
if (expanded) {
this.expandedRowKeysRenew.push(row.id)
} else {
const index = this.expandedRowKeysRenew.findIndex(v => v === row.id)
this.expandedRowKeysRenew.splice(index, 1)
}
},
loadChildByExpandedKeys() {
if (this.expandedRowKeysRenew && this.expandedRowKeysRenew.length > 0) {
this.expandedRowKeysRenew.forEach((v) => {
const curr = this.tableTreeRefreshTool[v]
// api请求
$.get('/platform/sys/dict/child', {pid: v}).then(res => {
curr.resolve(res.data)
})
})
} else {
this.initTreeTable()
}
}
},
created: function () {
this.initTreeTable();
@@ -19,13 +19,14 @@ const appModule = {
`,
data() {
return {
id: ""
id: "",
entranceModules: []
}
},
computed: {
entranceModules() {
return JSON.parse(window.sessionStorage.getItem('moduleMenus'))
}
// entranceModules() {
// return JSON.parse(window.sessionStorage.getItem('moduleMenus'))
// }
},
methods: {
enterEntranceModules(item) {
@@ -35,9 +36,10 @@ const appModule = {
}
},
created() {
// setTimeout(()=>{
// // this.id = headerApp.appModuleId
// this.enterEntranceModules({id: headerApp.appModuleId})
// },500)
setTimeout(()=>{
// this.id = headerApp.appModuleId
// this.enterEntranceModules({id: headerApp.appModuleId})
this.entranceModules = JSON.parse(window.sessionStorage.getItem('moduleMenus'))
},500)
}
}
@@ -1,60 +0,0 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>CSS Grid 布局示例</title>
<style>
.grid-container {
display: grid;
grid-template-columns: repeat(3, 1fr); /* 定义3列,每列宽度相等 */
grid-template-rows: repeat(3, 100px); /* 定义3行,每行高度为100px */
gap: 10px; /* 设置网格间距 */
width: 600px; /* 容器宽度 */
height: 400px; /* 容器高度 */
margin: 0 auto; /* 居中容器 */
}
.item {
background-color: #4CAF50;
color: white;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.2em;
border-radius: 5px;
}
.item1 {
grid-column: 1 / 3; /* 元素1占据第1和第2列 */
grid-row: 1 / 2; /* 元素1占据第1行 */
}
.item2 {
grid-column: 3 / 4; /* 元素2占据第3列 */
grid-row: 1 / 3; /* 元素2跨越第1和第2行 */
}
.item3 {
grid-column: 1 / 3; /* 元素3占据第1和第2列 */
grid-row: 2 / 3; /* 元素3占据第2行 */
}
.item4,
.item5,
.item6 {
grid-column: span 1; /* 每个元素占据1列 */
grid-row: 3 / 4; /* 所有元素都在第3行 */
}
</style>
</head>
<body>
<div class="grid-container">
<div class="item item1">元素 1</div>
<div class="item item2">元素 2</div>
<div class="item item3">元素 3</div>
<div class="item item4">元素 4</div>
<div class="item item5">元素 5</div>
<div class="item item6">元素 6</div>
</div>
</body>
</html>
@@ -5,8 +5,8 @@ layout("/layouts/platform.html"){
<guava>
<el-card shadow="never">
<el-row justify="end" type="flex">
<!--<el-col>
<div class="search">
<el-col>
<!--<div class="search">
<div class="search-item">
<div class="search-item-label">菜单名称:</div>
<div class="search-item-option">
@@ -18,8 +18,8 @@ layout("/layouts/platform.html"){
<div class="search-query">
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
</div>
</div>
</el-col>-->
</div>-->
</el-col>
<el-button @click="openAdd" size="medium" type="primary">
<i class="ti-plus"></i>