commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package com.budwk.app.base.event.role;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:RoleEventListener
|
||||
* @Date 2025/9/3 17:13
|
||||
* @注释
|
||||
*/
|
||||
public interface RoleEventListener {
|
||||
|
||||
void receive(RoleEventMsg message);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.budwk.app.base.event.role;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:RoleEventMsg
|
||||
* @Date 2025/9/3 17:14
|
||||
* @注释
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RoleEventMsg {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private List<String> userIds;
|
||||
|
||||
/**
|
||||
* 角色code
|
||||
*/
|
||||
private String roleCode;
|
||||
|
||||
/**
|
||||
* 单位id
|
||||
*/
|
||||
private String unitId;
|
||||
|
||||
/**
|
||||
* 操作类型
|
||||
*/
|
||||
private Integer operationType;
|
||||
|
||||
/**
|
||||
* 添加角色
|
||||
*/
|
||||
public static final int ADD_ROLE = 1;
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*/
|
||||
public static final int REMOVE_ROLE = 2;
|
||||
|
||||
/**
|
||||
* 更新角色
|
||||
*/
|
||||
public static final int RENEW_ROLE = 3;
|
||||
|
||||
|
||||
public RoleEventMsg(String unitId, String roleCode, Integer operationType){
|
||||
this.unitId = unitId;
|
||||
this.operationType = operationType;
|
||||
}
|
||||
|
||||
public RoleEventMsg(List<String> userIds, String roleCode, Integer operationType){
|
||||
this.userIds = userIds;
|
||||
this.roleCode = roleCode;
|
||||
this.operationType = operationType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.budwk.app.base.event.role;
|
||||
|
||||
import org.nutz.mvc.Mvcs;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:RoleEventPublisher
|
||||
* @Date 2025/9/3 17:14
|
||||
* @注释
|
||||
*/
|
||||
public class RoleEventPublisher {
|
||||
|
||||
public static void broadcast(RoleEventMsg event){
|
||||
String[] names = Mvcs.getIoc().getNamesByType(RoleEventListener.class);
|
||||
for (String name : names) {
|
||||
RoleEventListener listener = Mvcs.getIoc().get(RoleEventListener.class, name);
|
||||
listener.receive(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.budwk.app.sys.listener;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.event.role.RoleEventListener;
|
||||
import com.budwk.app.base.event.role.RoleEventMsg;
|
||||
import com.budwk.app.sys.models.Sys_role;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.sys.models.Sys_user_role;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SysRoleEventListener
|
||||
* @Date 2025/9/3 17:35
|
||||
* @注释
|
||||
*/
|
||||
@IocBean
|
||||
public class SysRoleEventListener implements RoleEventListener {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void receive(RoleEventMsg message) {
|
||||
if (ObjectUtil.isAllEmpty(message.getUserIds(), message.getUnitId(), message.getRoleCode())) {
|
||||
return;
|
||||
}
|
||||
switch (message.getOperationType()) {
|
||||
case RoleEventMsg.ADD_ROLE -> {
|
||||
addRole(message);
|
||||
}
|
||||
case RoleEventMsg.REMOVE_ROLE -> {
|
||||
removeRole(message);
|
||||
}
|
||||
case RoleEventMsg.RENEW_ROLE -> {
|
||||
removeRole(message);
|
||||
addRole(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加角色
|
||||
* @param message 订阅消息
|
||||
*/
|
||||
private void addRole(RoleEventMsg message) {
|
||||
Sys_role role = dao.fetch(Sys_role.class, Cnd.where("code", "=", message.getRoleCode()));
|
||||
|
||||
if (ObjectUtil.isAllNotEmpty(message.getUserIds(), message.getRoleCode())) {
|
||||
List<Sys_user_role> roleList = message.getUserIds().stream().map(item -> {
|
||||
Sys_user_role userRole = new Sys_user_role();
|
||||
userRole.setUserId(item);
|
||||
userRole.setUnitId(StrUtil.isNotBlank(message.getUnitId()) ? message.getUnitId() : null);
|
||||
userRole.setRoleId(role.getId());
|
||||
return userRole;
|
||||
}).toList();
|
||||
dao.insert(roleList);
|
||||
} else if (ObjectUtil.isAllNotEmpty(message.getUnitId(), message.getRoleCode())) {
|
||||
List<Sys_user> userList = dao.query(Sys_user.class, Cnd.where("unitId", "=", message.getUnitId()));
|
||||
List<Sys_user_role> roleList = userList.stream().map(item -> {
|
||||
Sys_user_role userRole = new Sys_user_role();
|
||||
userRole.setUserId(item.getId());
|
||||
userRole.setUnitId(item.getUnitId());
|
||||
userRole.setRoleId(role.getId());
|
||||
return userRole;
|
||||
}).toList();
|
||||
dao.insert(roleList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
* @param message 订阅消息
|
||||
*/
|
||||
private void removeRole(RoleEventMsg message) {
|
||||
// 判断传过来的东西
|
||||
if (ObjectUtil.isAllNotEmpty(message.getUserIds(), message.getUnitId(), message.getRoleCode())) {
|
||||
dao.clear(Sys_user_role.class,
|
||||
Cnd.where("userId", "in", message.getUserIds())
|
||||
.and("unitId", "=", message.getUnitId())
|
||||
.and("roleCode", "=", message.getRoleCode())
|
||||
);
|
||||
} else if (ObjectUtil.isAllNotEmpty(message.getUserIds(), message.getRoleCode())) {
|
||||
dao.clear(Sys_user_role.class,
|
||||
Cnd.where("userId", "in", message.getUserIds())
|
||||
.and("roleCode", "=", message.getRoleCode())
|
||||
);
|
||||
} else if (ObjectUtil.isAllNotEmpty(message.getUnitId(), message.getUnitId())) {
|
||||
dao.clear(Sys_user_role.class,
|
||||
Cnd.where("unitId", "in", message.getUnitId())
|
||||
.and("roleCode", "=", message.getRoleCode())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.event.role.RoleEventMsg;
|
||||
import com.budwk.app.base.event.role.RoleEventPublisher;
|
||||
import com.budwk.app.base.utils.ConditionGroupUtil;
|
||||
import com.budwk.app.base.utils.PwdUtil;
|
||||
import com.budwk.app.sys.annotation.DataCenterColumn;
|
||||
@@ -16,6 +18,7 @@ import com.budwk.app.sys.services.SysDataUserUpdateService;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.sys.services.SysRoleService;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalConfig;
|
||||
import com.budwk.app.zhgh.staffmanage.member.constant.MemberChangeOrigin;
|
||||
import com.budwk.app.zhgh.staffmanage.member.constant.MemberChangeType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -161,9 +164,9 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
|
||||
Map<String, Sys_user> userMap = sysUsers.stream().collect(Collectors.toMap(Sys_user::getLoginname, sysUser -> sysUser));
|
||||
|
||||
// 准备数据集合
|
||||
List<Sys_user> needDoUpdateList = new ArrayList<>();
|
||||
List<Sys_user> needInitUserList = new ArrayList<>();
|
||||
List<Sys_user_history> histories = new ArrayList<>();
|
||||
List<Sys_user> needDoUpdateList = new CopyOnWriteArrayList<>();
|
||||
List<Sys_user> needInitUserList = new CopyOnWriteArrayList<>();
|
||||
List<Sys_user_history> histories = new CopyOnWriteArrayList<>();
|
||||
List<String> addMemberUserIds = Collections.synchronizedList(new ArrayList<>());
|
||||
List<String> removeMemberUserIds = Collections.synchronizedList(new ArrayList<>());
|
||||
|
||||
@@ -380,6 +383,13 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
|
||||
});
|
||||
}
|
||||
|
||||
// 6. 处理其他任务
|
||||
// 6.1 更新提案的校领导角色,发送订阅
|
||||
ProposalConfig config = dao.fetch(ProposalConfig.class, Cnd.where("delFlag", "=", false).desc("updatedAt"));
|
||||
for (String unitId : config.getSchoolLeaderUnitIds()) {
|
||||
RoleEventPublisher.broadcast(new RoleEventMsg(unitId, RoleConstant.PROPOSAL_BRANCH_SCHOOL_LEADER.name(), RoleEventMsg.RENEW_ROLE));
|
||||
}
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
log.info("全量更新用户数据完成,耗时: {} 毫秒", (endTime - startTime));
|
||||
|
||||
|
||||
+1
-2
@@ -137,7 +137,6 @@ public class ActivityDeclareMineController {
|
||||
} else {
|
||||
cnd.orderBy("info." + pageParam.getPageOrderName(), PageUtil.getOrder(pageParam.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = activityDeclareService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
@@ -178,7 +177,7 @@ public class ActivityDeclareMineController {
|
||||
@Ok("void")
|
||||
@SaCheckPermission("activityDeclare.mine")
|
||||
@SLog(tag = "活动申报", msg = "导出活动申报表")
|
||||
public void doExport(@Valid String id, HttpServletResponse response) {
|
||||
public void doExportDeclare(@Valid String id, HttpServletResponse response) {
|
||||
HashMap<String, Object> docData = new HashMap<>();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
|
||||
+28
-15
@@ -37,6 +37,7 @@ import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -87,9 +88,6 @@ public class ActivityReimbursementApplyController {
|
||||
.mapToDouble(v -> ObjectUtil.defaultIfNull(v.getActualPrice(), 0D))
|
||||
.sum();
|
||||
activityReimbursementInfo.setActualMoney(new BigDecimal(sum));
|
||||
if (StrUtil.isBlank(activityReimbursementInfo.getDeclareId())) {
|
||||
activityReimbursementInfo.setDeclareId(activityReimbursementInfo.getId());
|
||||
}
|
||||
dao.insertOrUpdate(activityReimbursementInfo);
|
||||
return Result.success();
|
||||
}
|
||||
@@ -110,9 +108,6 @@ public class ActivityReimbursementApplyController {
|
||||
.mapToDouble(v -> ObjectUtil.defaultIfNull(v.getActualPrice(), 0D))
|
||||
.sum();
|
||||
activityReimbursementInfo.setActualMoney(new BigDecimal(sum));
|
||||
if (StrUtil.isBlank(activityReimbursementInfo.getDeclareId())) {
|
||||
activityReimbursementInfo.setDeclareId(activityReimbursementInfo.getId());
|
||||
}
|
||||
dao.insertOrUpdate(activityReimbursementInfo);
|
||||
|
||||
// 开启流程实例
|
||||
@@ -146,9 +141,6 @@ public class ActivityReimbursementApplyController {
|
||||
.mapToDouble(v -> ObjectUtil.defaultIfNull(v.getActualPrice(), 0D))
|
||||
.sum();
|
||||
activityReimbursementInfo.setActualMoney(new BigDecimal(sum));
|
||||
if (StrUtil.isBlank(activityReimbursementInfo.getDeclareId())) {
|
||||
activityReimbursementInfo.setDeclareId(activityReimbursementInfo.getId());
|
||||
}
|
||||
dao.insertOrUpdate(activityReimbursementInfo);
|
||||
|
||||
Dict dict = Dict.create();
|
||||
@@ -162,14 +154,33 @@ public class ActivityReimbursementApplyController {
|
||||
@At
|
||||
@ApiOperation("获取当前用户活动报销")
|
||||
@SaCheckPermission("activityReimbursement.apply")
|
||||
public Result getActivityReimbursementByUser() {
|
||||
// 查询reimbursement表里面没有,在declare表里面有的申请记录
|
||||
Sql sql = Sqls.create("SELECT declareId FROM activity_reimbursement_info WHERE userId = @userId").setParam("userId", SecurityUtil.getUserId());
|
||||
public Result getActivityReimbursementByUser(String id) {
|
||||
if (StrUtil.isNotBlank(id)) {
|
||||
ActivityReimbursementInfo reimbursementInfo = dao.fetch(ActivityReimbursementInfo.class, id);
|
||||
ActivityDeclareInfo info = dao.fetch(ActivityDeclareInfo.class, reimbursementInfo.getDeclareId());
|
||||
return Result.success().addData(List.of(info));
|
||||
}
|
||||
|
||||
// 查询已经报销成功的记录
|
||||
Sql reiSql = Sqls.create("""
|
||||
SELECT
|
||||
info.declareId
|
||||
FROM
|
||||
activity_reimbursement_info info
|
||||
LEFT JOIN wf_process_instance ins ON ins.businessNo = info.id
|
||||
WHERE
|
||||
userId = @userId
|
||||
AND ins.state IN (10, 20)
|
||||
""").setParam("userId", SecurityUtil.getUserId());
|
||||
reiSql.setCallback(Sqls.callback.strList());
|
||||
dao.execute(reiSql);
|
||||
List<String> reiDecIdList = reiSql.getList(String.class);
|
||||
|
||||
Sql sql = Sqls.create("select declareId from activity_reimbursement_info where userId = @userId").setParam("userId", SecurityUtil.getUserId());
|
||||
sql.setCallback(Sqls.callback.strList());
|
||||
dao.execute(sql);
|
||||
List<String> declareIdList = sql.getList(String.class);
|
||||
|
||||
|
||||
Sql applySql = Sqls.create("""
|
||||
SELECT
|
||||
info.*
|
||||
@@ -178,10 +189,12 @@ public class ActivityReimbursementApplyController {
|
||||
LEFT JOIN wf_process_instance ins ON info.id = ins.businessNo
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Lang.isNotEmpty(declareIdList)) {
|
||||
cnd.and("info.id", "in", declareIdList);
|
||||
cnd.and("info.id", "not in", declareIdList);
|
||||
}
|
||||
if (Lang.isNotEmpty(reiDecIdList)) {
|
||||
cnd.and("info.id", "not in", reiDecIdList);
|
||||
}
|
||||
cnd.and("info.userId", "=", SecurityUtil.getUserId());
|
||||
cnd.and("ins.state", "=", 20);
|
||||
|
||||
+7
@@ -5,6 +5,7 @@ import com.budwk.app.zhgh.activity.declarereimbursement.declare.models.ActivityD
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@@ -22,6 +23,12 @@ import java.util.List;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ActivityReimbursementInfo extends ActivityDeclareInfo {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("申报id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class MemberStatisticsServiceImpl extends BaseServiceImpl<Sys_user> imple
|
||||
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(pageForm.getAge()) && !"0".equals(pageForm.getAge().get(0)) && !"0".equals(pageForm.getAge().get(1))) {
|
||||
if (Lang.isNotEmpty(pageForm.getAge()) && !"0".equals(pageForm.getAge().get(1))) {
|
||||
if (reverseSelection) {
|
||||
cnd.andNot("TIMESTAMPDIFF(YEAR, u.birthday, CURDATE())", "between", pageForm.getAge().toArray());
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -174,7 +174,7 @@ public class MemberPaymentChartSummaryController {
|
||||
) subquery ON subquery.unionId = un.id
|
||||
GROUP BY
|
||||
un.id,
|
||||
un.unionname,
|
||||
un.name,
|
||||
un.unioncode
|
||||
ORDER BY
|
||||
un.unioncode;
|
||||
|
||||
+12
-3
@@ -5,8 +5,10 @@ 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.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
@@ -104,9 +106,9 @@ public class MemberPaymentSummaryController {
|
||||
public Result modify(@Param("ids") String[] ids, String paymentMoney, boolean isPay, String remark) {
|
||||
List<String> idList = Arrays.asList(ids);
|
||||
if (Lang.isNotEmpty(idList)) {
|
||||
if (!isPay) {
|
||||
if (isPay) {
|
||||
//未缴费设为已缴费
|
||||
memberPaymentService.update(Chain.make("paymentMoney", paymentMoney)
|
||||
memberPaymentService.update(Chain.make("paymentMoney", NumberUtil.mul(paymentMoney, "100"))
|
||||
.add("remark", remark).add("isPayment", 1)
|
||||
.add("paymentTime", new Date()),
|
||||
Cnd.where("id", "in", idList));
|
||||
@@ -134,9 +136,16 @@ public class MemberPaymentSummaryController {
|
||||
@ApiOperation("下载导入模版")
|
||||
@SaCheckPermission("member.payment.summary")
|
||||
public void downloadImportTemp(HttpServletResponse response) {
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
exportEntities.add(new ExcelExportEntity("缴纳金额", "paymentBase", 20));
|
||||
exportEntities.add(new ExcelExportEntity("是否缴费", "isPay", 20));
|
||||
exportEntities.add(new ExcelExportEntity("备注", "remark", 20));
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, MemberPaymentTemp.class, new ArrayList<>());
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, new ArrayList<>());
|
||||
CommonDownloadUtil.download("会员缴费导入模版.xlsx", workbook, response);
|
||||
}
|
||||
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.budwk.app.zhgh.user.childManage.h5controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author hqw
|
||||
* @name:H5ChildManageController
|
||||
* @Date 2025/9/4 8:52
|
||||
* @注释
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@At("/platform/childManage/manage/h5")
|
||||
public class H5ChildManageController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhghh5/staffmanage/childmanage/")
|
||||
@SaCheckPermission("childManage.h5")
|
||||
public void index() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user