diff --git a/evo-admin/src/main/java/com/evo/attendance/service/impl/RzAttendanceDetailServiceImpl.java b/evo-admin/src/main/java/com/evo/attendance/service/impl/RzAttendanceDetailServiceImpl.java index de4b49d..425f898 100644 --- a/evo-admin/src/main/java/com/evo/attendance/service/impl/RzAttendanceDetailServiceImpl.java +++ b/evo-admin/src/main/java/com/evo/attendance/service/impl/RzAttendanceDetailServiceImpl.java @@ -9,7 +9,6 @@ import com.evo.attendance.domain.vo.RzAttendanceDetailTimeLineVO; import com.evo.attendance.mapper.RzAttendanceDetailMapper; import com.evo.attendance.mapper.RzAttendancePhotoMapper; import com.evo.attendance.service.RzAttendanceDetailService; -import com.evo.attendance.service.RzAttendancePhotoService; import com.evo.common.constant.Constants; import com.evo.common.core.domain.entity.SysDept; import com.evo.common.utils.Collections; @@ -18,9 +17,11 @@ import com.evo.common.utils.ParamUtils; import com.evo.common.utils.StringUtils; import com.evo.personnelMatters.domain.RzLeaveDetail; import com.evo.personnelMatters.mapper.RzLeaveDetailMapper; +import com.evo.system.domain.ExceptionNotification; import com.evo.system.domain.SysStaff; import com.evo.system.mapper.SysDeptMapper; import com.evo.system.mapper.SysStaffMapper; +import com.evo.system.service.ExceptionNotificationService; import com.evo.wechat.service.SendClientService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; @@ -29,14 +30,11 @@ import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; /** * 类 @@ -60,7 +58,8 @@ public class RzAttendanceDetailServiceImpl extends ServiceImpl> threeDayNotCheckList = super.getBaseMapper().getThreeDayNotCheck(); if(Collections.isNotEmpty(threeDayNotCheckList)){ + Long overdueLimit = ParamUtils.overdueLimit(); for (Map threeDayNotCheck : threeDayNotCheckList){ //用户Id Integer userId = Integer.valueOf(String.valueOf(threeDayNotCheck.get("userId"))); @@ -178,7 +178,7 @@ public class RzAttendanceDetailServiceImpl extends ServiceImpl 3天, 继续检查请假 - if(holidayDates.size() > 3){ + if(Long.valueOf(holidayDates.size()).compareTo(overdueLimit) > -1){ //排除假期 List leaveDays = Collections.emptyList(); for (String holidayDate : holidayDates){ @@ -200,25 +200,45 @@ public class RzAttendanceDetailServiceImpl extends ServiceImpl 3天, 则准备推送 - if(holidayDates.size() > 3){ - SysStaff sysStaff = sysStaffMapper.selectById(userId); - if(sysStaff != null) { - SysDept sysDept = sysDeptMapper.selectById(sysStaff.getDeptId()); - String deptName = sysDept != null ? sysDept.getDeptName() : "未知"; - String userName = sysStaff.getName(); - // 查询人资办人员信息 - List rzb = sysStaffMapper.queryysStaffByDeptId(Collections.asList(28l)); - if(Collections.isNotEmpty(rzb)){ - for (SysStaff rz : rzb){ - sendAttendanceDetail(userName, rz.getName(), deptName, rz.getOpenid()); - } - } - //查询部门负责人 - SysStaff leaderSysStaff = sysStaffMapper.selectLeaderSysStaffByDeptId(sysStaff.getDeptId()); - if(leaderSysStaff != null){ - sendAttendanceDetail(userName, leaderSysStaff.getName(), deptName, leaderSysStaff.getOpenid()); - } + if(Long.valueOf(holidayDates.size()).compareTo(overdueLimit) > -1){ + ExceptionNotification exceptionNotification = exceptionNotificationService.getExceptionNotification(2, holidayDates.size()); + List sysStaffList = Collections.emptyList(); + if(exceptionNotification == null){ + // 如果异常订阅为空, 默认使用人资办通知 + sysStaffList.addAll(sysStaffMapper.queryysStaffByDeptId(Collections.asList(28l))); + }else{ + // 异常订阅的信息 + sysStaffList.addAll(sysStaffMapper.selectList(new LambdaQueryWrapper<>(new SysStaff()).in(SysStaff::getUserId, Collections.asList(exceptionNotification.getUserIds().split(","))))); } + SysStaff sysStaff = sysStaffMapper.selectById(userId); + SysDept sysDept = sysDeptMapper.selectById(sysStaff.getDeptId()); + String deptName = sysDept != null ? sysDept.getDeptName() : "未知"; + + for (SysStaff rz : sysStaffList){ + sendAttendanceDetail(sysStaff.getName(), rz.getName(), deptName, rz.getOpenid()); + } + + +// SysStaff sysStaff = sysStaffMapper.selectById(userId); +// if(sysStaff != null) { +// SysDept sysDept = sysDeptMapper.selectById(sysStaff.getDeptId()); +// String deptName = sysDept != null ? sysDept.getDeptName() : "未知"; +// String userName = sysStaff.getName(); +// // 查询人资办人员信息 +// List rzb = sysStaffMapper.queryysStaffByDeptId(Collections.asList(28l)); +// if(Collections.isNotEmpty(rzb)){ +// for (SysStaff rz : rzb){ +// sendAttendanceDetail(userName, rz.getName(), deptName, rz.getOpenid()); +// } +// } +// //查询部门负责人 +// SysStaff leaderSysStaff = sysStaffMapper.selectLeaderSysStaffByDeptId(sysStaff.getDeptId()); +// if(leaderSysStaff != null){ +// sendAttendanceDetail(userName, leaderSysStaff.getName(), deptName, leaderSysStaff.getOpenid()); +// } +// } + + } } } diff --git a/evo-admin/src/main/java/com/evo/common/utils/ParamUtils.java b/evo-admin/src/main/java/com/evo/common/utils/ParamUtils.java index 94c02ff..5667f6c 100644 --- a/evo-admin/src/main/java/com/evo/common/utils/ParamUtils.java +++ b/evo-admin/src/main/java/com/evo/common/utils/ParamUtils.java @@ -125,6 +125,16 @@ public class ParamUtils { RzSysParam param= paramService.getRzSysParam("是否发送微信通知", "send_we_chat","true","是否允许发送微信通知"); return Boolean.valueOf(param.getParamValue()); } + public static Boolean sendEveryDayCheckInWeiXin(){ + RzSysParam param= paramService.getRzSysParam("是否发送每天未打卡考勤信息到微信通知", "send_every_day_check_in_we_chat","false","是否发送每天未打卡考勤信息到微信通知"); + return Boolean.valueOf(param.getParamValue()); + } + public static Long overdueLimit(){ + RzSysParam param= paramService.getRzSysParam("超期未打开天数", "overdue_limit","5","超期未打开天数"); + return Long.valueOf(param.getParamValue()); + } + + /*** * 不住宿的实习生人员 diff --git a/evo-admin/src/main/java/com/evo/system/controller/ExceptionNotificationController.java b/evo-admin/src/main/java/com/evo/system/controller/ExceptionNotificationController.java new file mode 100644 index 0000000..7ecdc60 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/system/controller/ExceptionNotificationController.java @@ -0,0 +1,105 @@ +package com.evo.system.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.evo.common.annotation.Log; +import com.evo.common.annotation.RepeatSubmit; +import com.evo.common.core.controller.BaseController; +import com.evo.common.core.domain.AjaxResult; +import com.evo.common.core.page.TableDataInfo; +import com.evo.common.enums.BusinessType; +import com.evo.common.utils.Collections; +import com.evo.common.utils.StringUtils; +import com.evo.system.domain.ExceptionNotification; +import com.evo.system.domain.SysStaff; +import com.evo.system.mapper.SysDeptMapper; +import com.evo.system.mapper.SysStaffMapper; +import com.evo.system.service.ExceptionNotificationService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @desc: + * @ClassName:ExceptionNotificationController + * @date: 2026年08月25日 17:18 + * @author: andy.shi + * @contact: 17330188597 + * @remark: 开发人员联系方式 1042025947@qq.com/微信同步 + */ +@RestController +@RequestMapping("/system/exceptionNotification") +public class ExceptionNotificationController extends BaseController { + + @Resource + private ExceptionNotificationService exceptionNotificationService; + @Resource + private SysStaffMapper sysStaffMapper; + @Resource + private SysDeptMapper sysDeptMapper; + + /** + * 查询员工管理列表 + */ + @PreAuthorize("@ss.hasPermi('system:exceptionNotification:list')") + @GetMapping("/list") + public TableDataInfo list(ExceptionNotification exceptionNotification) { + startPage(); + List list = exceptionNotificationService.list(new LambdaQueryWrapper() + .eq(exceptionNotification.getNotificationType() != null, ExceptionNotification::getNotificationType, exceptionNotification.getNotificationType())); + list.stream().forEach(item->{ + if(StringUtils.isNotEmpty(item.getUserIds())){ + item.setUserNames(sysStaffMapper.selectNameByUserIds(Collections.asList(item.getUserIds().split(",")).stream().map(Long::parseLong).collect(Collectors.toList()))); + } + if(StringUtils.isNotEmpty(item.getDeptIds())){ + item.setDeptNames(sysDeptMapper.selectNameByIds(Collections.asList(item.getDeptIds().split(",")).stream().map(Long::parseLong).collect(Collectors.toList()))); + } + + }); + return getDataTable(list); + } + + /** + * 新增员工管理 + */ + @PreAuthorize("@ss.hasPermi('system:exceptionNotification:add')") + @Log(title = "异常规则", businessType = BusinessType.INSERT) + @PostMapping + @RepeatSubmit + public AjaxResult add(@RequestBody ExceptionNotification exceptionNotification) { + exceptionNotificationService.save(exceptionNotification); + return AjaxResult.success(); + } + + /** + * 获取员工管理详细信息 + */ + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(exceptionNotificationService.getById(id)); + } + + @PreAuthorize("@ss.hasPermi('system:exceptionNotification:edit')") + @Log(title = "异常规则", businessType = BusinessType.UPDATE) + @PutMapping + @RepeatSubmit + public AjaxResult edit(@RequestBody ExceptionNotification exceptionNotification) { + exceptionNotificationService.updateById(exceptionNotification); + return AjaxResult.success(); + } + + /** + * 删除员工管理 + */ + @PreAuthorize("@ss.hasPermi('system:exceptionNotification:delete')") + @Log(title = "异常规则", businessType = BusinessType.DELETE) + @DeleteMapping("/{id}") + public AjaxResult delete(@PathVariable Long id){ + return toAjax(exceptionNotificationService.removeById(id)); + } + + +} diff --git a/evo-admin/src/main/java/com/evo/system/domain/ExceptionNotification.java b/evo-admin/src/main/java/com/evo/system/domain/ExceptionNotification.java new file mode 100644 index 0000000..66431d8 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/system/domain/ExceptionNotification.java @@ -0,0 +1,42 @@ +package com.evo.system.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; + +import java.io.Serializable; + +/** + * 异常接收人 + * @ClassName:ExceptionNotification + * @date: 2026年08月24日 16:15 + * @author: andy.shi + * @contact: 17330188597 + * @remark: 开发人员联系方式 1042025947@qq.com/微信同步 + */ +@Data +public class ExceptionNotification implements Serializable { + + private static final long serialVersionUID = 1L; + + Long id; + + String userIds; + @TableField(exist = false) + String userNames; + + String deptIds; + @TableField(exist = false) + String deptNames; + /*** + * 什么类型的通知 + * 1. 未打卡通知 + * 2 超过N天未打卡通知 + * 3. 异常通知 + */ + Integer notificationType; + /*** + * 超过几天通知 + * 做级别限制, 比如说, 3天通知部门负责人, 5天通知人资办, 10田通知公司高层 + */ + Integer day; +} diff --git a/evo-admin/src/main/java/com/evo/system/mapper/ExceptionNotificationMapper.java b/evo-admin/src/main/java/com/evo/system/mapper/ExceptionNotificationMapper.java new file mode 100644 index 0000000..7015a53 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/system/mapper/ExceptionNotificationMapper.java @@ -0,0 +1,19 @@ +package com.evo.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.evo.system.domain.ExceptionNotification; +import com.evo.system.domain.SysStaffDetail; + +import java.util.List; + +/** + * 员工详情Mapper接口 + * + * @author evo + * @date 2024-11-22 + */ +public interface ExceptionNotificationMapper extends BaseMapper +{ + + List getExceptionNotification(Integer type); +} diff --git a/evo-admin/src/main/java/com/evo/system/mapper/SysDeptMapper.java b/evo-admin/src/main/java/com/evo/system/mapper/SysDeptMapper.java index a5784fb..2e8a64e 100644 --- a/evo-admin/src/main/java/com/evo/system/mapper/SysDeptMapper.java +++ b/evo-admin/src/main/java/com/evo/system/mapper/SysDeptMapper.java @@ -20,6 +20,9 @@ public interface SysDeptMapper extends BaseMapper * @return 部门信息集合 */ public List selectDeptList(SysDept dept); + + public String selectNameByIds(@Param("deptIds") List deptIds); + /** * 根据角色ID查询部门树信息 * diff --git a/evo-admin/src/main/java/com/evo/system/mapper/SysStaffMapper.java b/evo-admin/src/main/java/com/evo/system/mapper/SysStaffMapper.java index 16e7c71..3329f94 100644 --- a/evo-admin/src/main/java/com/evo/system/mapper/SysStaffMapper.java +++ b/evo-admin/src/main/java/com/evo/system/mapper/SysStaffMapper.java @@ -24,6 +24,8 @@ public interface SysStaffMapper extends BaseMapper */ public SysStaff selectSysStaffByUserId(Long userId); + public String selectNameByUserIds(@Param("userIds") List userIds); + /** * 查询员工管理列表 * diff --git a/evo-admin/src/main/java/com/evo/system/service/ExceptionNotificationService.java b/evo-admin/src/main/java/com/evo/system/service/ExceptionNotificationService.java new file mode 100644 index 0000000..cc87232 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/system/service/ExceptionNotificationService.java @@ -0,0 +1,18 @@ +package com.evo.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.evo.system.domain.ExceptionNotification; + +/** + * 异常通知接口 + * @ClassName:ExceptionNotificationService + * @date: 2026年08月24日 16:43 + * @author: andy.shi + * @contact: 17330188597 + * @remark: 开发人员联系方式 1042025947@qq.com/微信同步 + */ + +public interface ExceptionNotificationService extends IService { + + ExceptionNotification getExceptionNotification(Integer type, Integer day); +} diff --git a/evo-admin/src/main/java/com/evo/system/service/impl/ExceptionNotificationServiceImpl.java b/evo-admin/src/main/java/com/evo/system/service/impl/ExceptionNotificationServiceImpl.java new file mode 100644 index 0000000..306dcd8 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/system/service/impl/ExceptionNotificationServiceImpl.java @@ -0,0 +1,36 @@ +package com.evo.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.evo.common.utils.Collections; +import com.evo.system.domain.ExceptionNotification; +import com.evo.system.mapper.ExceptionNotificationMapper; +import com.evo.system.service.ExceptionNotificationService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @desc: + * @ClassName:ExceptionNotificationServiceImpl + * @date: 2026年08月25日 13:17 + * @author: andy.shi + * @contact: 17330188597 + * @remark: 开发人员联系方式 1042025947@qq.com/微信同步 + */ +@Service +public class ExceptionNotificationServiceImpl extends ServiceImpl implements ExceptionNotificationService { + + @Override + public ExceptionNotification getExceptionNotification(Integer type, Integer day){ + List list = getBaseMapper().getExceptionNotification(type); + if(Collections.isEmpty(list)){ + return null; + } + for (ExceptionNotification notification : list) { + if (day >= notification.getDay()) { + return notification; + } + } + return list.get(0); + } +} diff --git a/evo-admin/src/main/java/com/evo/task/TaskController.java b/evo-admin/src/main/java/com/evo/task/TaskController.java index 64b7683..e753040 100644 --- a/evo-admin/src/main/java/com/evo/task/TaskController.java +++ b/evo-admin/src/main/java/com/evo/task/TaskController.java @@ -22,6 +22,7 @@ import com.evo.system.domain.SysStaff; import com.evo.system.service.DeptMonthHistoryService; import com.evo.system.service.ISysDeptService; import com.evo.system.service.ISysStaffService; +import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -30,6 +31,7 @@ import java.text.ParseException; import java.util.Date; import java.util.List; +@Slf4j @Component public class TaskController { @@ -135,6 +137,10 @@ public class TaskController { */ @Scheduled(cron = "0 0 9 * * ?") public void autoAbnormalAttendance(){ + if(!ParamUtils.sendEveryDayCheckInWeiXin()){ + log.info("系统停止发送每天未打卡通知信息;"); + return; + } rzAttendanceService.sendAbnormalAttendance(); } diff --git a/evo-admin/src/main/resources/mapper/system/ExceptionNotificationMapper.xml b/evo-admin/src/main/resources/mapper/system/ExceptionNotificationMapper.xml new file mode 100644 index 0000000..7e84e90 --- /dev/null +++ b/evo-admin/src/main/resources/mapper/system/ExceptionNotificationMapper.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/evo-admin/src/main/resources/mapper/system/SysDeptMapper.xml b/evo-admin/src/main/resources/mapper/system/SysDeptMapper.xml index 14fcd43..85c2cea 100644 --- a/evo-admin/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/evo-admin/src/main/resources/mapper/system/SysDeptMapper.xml @@ -53,7 +53,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by d.parent_id - + select GROUP_CONCAT(dept_name) from sys_dept + + + dept_id in + + #{deptId} + + + + + + + +