@@ -7,39 +7,54 @@ import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
import lombok.Data; | |||
/** | |||
* 任务组配置表 | |||
* 对应表: dk_check_in_attendance_team | |||
*/ | |||
@Data | |||
@TableName("dk_check_in_attendance_team") | |||
public class DkAttendanceGroup extends BaseEntity { | |||
/** 主键ID */ | |||
@TableId(value = "id", type = IdType.AUTO) | |||
private long id; | |||
/** 考勤组名称 */ | |||
@TableField(value = "`name`") | |||
private String name; | |||
/** 描述 */ | |||
@TableField(value = "`description`") | |||
private String description; | |||
/** 打卡时间 */ | |||
@TableField(value = "`work_days`") | |||
private String workDays; | |||
/** 开始打卡时间 */ | |||
@TableField(value = "`work_start_time`") | |||
private String workStartTime; | |||
/** 结束打卡时间 */ | |||
@TableField(value = "`work_end_time`") | |||
private String workEndTime; | |||
/** 允许迟到 */ | |||
@TableField(value = "`allow_late`") | |||
private Boolean allowLate; | |||
/** 迟到范围 */ | |||
@TableField(value = "`late_range`") | |||
private Integer lateRange; | |||
/** 允许早退 */ | |||
@TableField(value = "`allow_early`") | |||
private Boolean allowEarly; | |||
/** 早退范围 */ | |||
@TableField(value = "`early_range`") | |||
private Integer earlyRange; | |||
/** 区域配置id */ | |||
@TableField(value = "area_id") | |||
private long areaId; | |||
} |
@@ -7,27 +7,38 @@ import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
import lombok.Data; | |||
/** | |||
* 任务组用户配置表 | |||
* 对应表: dk_check_in_attendance_team_and_user | |||
*/ | |||
@Data | |||
@TableName("dk_check_in_attendance_team_and_user") | |||
public class DkAttendanceGroupAndUser extends BaseEntity { | |||
/** 主键ID */ | |||
@TableId(value = "id", type = IdType.AUTO) | |||
private int id; | |||
/** 考勤组id */ | |||
@TableField(value = "`attendance_team_id`") | |||
private long attendanceTeamId; | |||
/** 考勤组名称 */ | |||
@TableField(value = "`attendance_group_name`") | |||
private String AttendanceGroupName; | |||
/** 用户id */ | |||
@TableField(value = "`user_id`") | |||
private long userId; | |||
/** 姓名 */ | |||
@TableField(value = "`user_name`") | |||
private String userName; | |||
@TableField(value = "`dept_name`") | |||
private String deptName; | |||
/** 用户昵称 */ | |||
@TableField(value = "`nick_name`") | |||
private String nickName; | |||
@TableField(value = "`attendance_group_name`") | |||
private String AttendanceGroupName; | |||
/** 所属部门 */ | |||
@TableField(value = "`dept_name`") | |||
private String deptName; | |||
} |
@@ -7,24 +7,34 @@ import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
import lombok.Data; | |||
/** | |||
* 打卡配置表 | |||
* 对应表: dk_check_in_config | |||
*/ | |||
@Data | |||
@TableName("dk_check_in_config") | |||
public class DkCheckInConfig extends BaseEntity { | |||
/** 主键ID */ | |||
@TableId(value = "id", type = IdType.AUTO) | |||
private int id; | |||
/** 地点名称 */ | |||
@TableField(value = "`name`") | |||
private String name; | |||
/** 打卡半径/米 */ | |||
@TableField(value = "`radius`") | |||
private Integer radius; | |||
/** 启用状态 */ | |||
@TableField(value = "`enabled`") | |||
private Boolean enabled; | |||
/** 经度 */ | |||
@TableField(value = "`lng`") | |||
private String lng; | |||
/** 纬度 */ | |||
@TableField(value = "`lat`") | |||
private String lat; | |||
@@ -9,81 +9,86 @@ import lombok.Data; | |||
import java.time.LocalDateTime; | |||
/** | |||
* 打卡记录表 | |||
* 对应表: dk_check_in_record | |||
*/ | |||
@Data | |||
@TableName("dk_check_in_record") | |||
public class DkCheckInRecord extends BaseEntity { | |||
/** 主键ID */ | |||
@TableId(value = "id", type = IdType.AUTO) | |||
private String id; | |||
// 用户id | |||
/** 用户id */ | |||
@TableField(value = "`sys_user_id`") | |||
private Long sysUserId; | |||
// 用户姓名 | |||
/** 用户名称 */ | |||
@TableField(value = "`sys_user_name`") | |||
private String sysUserName; | |||
// 打卡时间 | |||
/** 用户昵称 */ | |||
@TableField(value = "`nick_name`") | |||
private String nickName; | |||
/** 考勤组id */ | |||
@TableField(value = "`attendance_group_id`") | |||
private long attendanceGroupId; | |||
/** 考勤组名称 */ | |||
@TableField(value = "`attendance_group_name`") | |||
private String attendanceGroupName; | |||
/** 月 */ | |||
@TableField(value = "`month`") | |||
private int month; | |||
/** 周 */ | |||
@TableField(value = "`week`") | |||
private String week; | |||
/** 日 */ | |||
@TableField(value = "`day`") | |||
private int day; | |||
/** 打卡时间 */ | |||
@TableField(value = "`check_in_time`") | |||
private LocalDateTime checkInTime; | |||
// 纬度 | |||
/** 经度 */ | |||
@TableField(value = "`latitude`") | |||
private String latitude; | |||
//经度 | |||
/** 纬度 */ | |||
@TableField(value = "`longitude`") | |||
private String longitude; | |||
// 打卡状态 | |||
@TableField(value = "`check_in_status`") | |||
private String checkInStatus; | |||
// 打卡类型 | |||
/** 打卡分类 */ | |||
@TableField(value = "`check_in_type`") | |||
private String checkInType; | |||
// 上班打卡时间 | |||
@TableField(value = "`clock_in`") | |||
private LocalDateTime clockIn; | |||
/** 打卡状态 0正常 1迟到 2缺卡 */ | |||
@TableField(value = "`check_in_status`") | |||
private String checkInStatus; | |||
// 上班打卡状态 | |||
/** 上班打卡状态 */ | |||
@TableField(value = "`clock_in_status`") | |||
private String clockInStatus; | |||
// 下班打卡状态 | |||
/** 下班打卡状态 */ | |||
@TableField(value = "`clock_out_status`") | |||
private String clockOutStatus; | |||
// 下班打卡时间 | |||
/** 上班打卡 */ | |||
@TableField(value = "`clock_in`") | |||
private LocalDateTime clockIn; | |||
/** 下班打卡 */ | |||
@TableField(value = "`clock_out`") | |||
private LocalDateTime clockOut; | |||
// 打卡月 | |||
@TableField(value = "`month`") | |||
private int month; | |||
// 打卡周 | |||
@TableField(value = "`week`") | |||
private String week; | |||
// 打卡日 | |||
@TableField(value = "`day`") | |||
private int day; | |||
// 描述 | |||
/** 描述 */ | |||
@TableField(value = "`description`") | |||
private String description; | |||
// 考勤组id | |||
@TableField(value = "`attendance_group_id`") | |||
private long attendanceGroupId; | |||
// 考勤组名称 | |||
@TableField(value = "`attendance_group_name`") | |||
private String attendanceGroupName; | |||
// 用户姓名 | |||
@TableField(value = "`nick_name`") | |||
private String nickName; | |||
} |
@@ -6,6 +6,7 @@ import java.util.List; | |||
public class EmployeeAttendance { | |||
private long userId; | |||
private String employeeName; | |||
private String userName; | |||
private String nickName; | |||
private String department; | |||
private String dateTime; | |||
@@ -48,6 +49,14 @@ public class EmployeeAttendance { | |||
this.nickName = nickName; | |||
} | |||
public String getUserName() { | |||
return userName; | |||
} | |||
public void setUserName(String userName) { | |||
this.userName = userName; | |||
} | |||
public String getDepartment() { | |||
return department; | |||
} |
@@ -9,36 +9,50 @@ import lombok.Data; | |||
import java.math.BigDecimal; | |||
/** | |||
* 用户年假管理表 | |||
* 对应表: nj_balance_manage | |||
*/ | |||
@Data | |||
@TableName("nj_balance_manage") | |||
public class NjBalanceManage extends BaseEntity { | |||
/** 主键ID */ | |||
@TableId(value = "id", type = IdType.AUTO) | |||
private long id; | |||
/** 员工编号 */ | |||
@TableField(value = "`user_id`") | |||
private long userId; | |||
/** 员工姓名 */ | |||
@TableField(value = "`user_name`") | |||
private String userName; | |||
/** 员工姓名 */ | |||
@TableField(value = "`nick_name`") | |||
private String nickName; | |||
/** 部门名称 */ | |||
@TableField(value = "`dept_name`") | |||
private String deptName; | |||
/** 年假总额 */ | |||
@TableField(value = "`annual_leave`") | |||
private BigDecimal annualLeave; | |||
/** 已使用天数 */ | |||
@TableField(value = "`used_day`") | |||
private BigDecimal usedDay; | |||
/** 剩余天数 */ | |||
@TableField(value = "`unused_day`") | |||
private BigDecimal unusedDay; | |||
/** 上年结转 */ | |||
@TableField(value = "`last_year_unused_day`") | |||
private BigDecimal lastYearUnusedDay; | |||
/** 状态 */ | |||
@TableField(value = "`is_enable`") | |||
private Boolean isEnable; | |||
} |
@@ -7,30 +7,42 @@ import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
import lombok.Data; | |||
/** | |||
* 年假配置表 | |||
* 对应表: nj_rule_config | |||
*/ | |||
@Data | |||
@TableName("nj_rule_config") | |||
public class NjRuleConfig extends BaseEntity { | |||
/** 主键ID */ | |||
@TableId(value = "id", type = IdType.AUTO) | |||
private long id; | |||
/** 规则名称 */ | |||
@TableField(value = "`rule_name`") | |||
private String ruleName; | |||
/** 年假起算方式 1:自然年,2,入职周年 */ | |||
@TableField(value = "`calculation_method`") | |||
private Integer calculationMethod; | |||
/** 年假发放规则 入职满一年(5天):5, 入职满10年(10天):10,入职满20年(15天):15, 默认规则:0 */ | |||
@TableField(value = "`annualLeave_tiers`") | |||
private Integer annualLeaveTiers; | |||
/** 年假有效期 true:当前年有效 */ | |||
@TableField(value = "`validity_period`") | |||
private Boolean validityPeriod; | |||
/** 可否请半天年假 true:可以,false:不可以 */ | |||
@TableField(value = "`allow_half_day`") | |||
private Boolean allowHalfDay; | |||
/** 适用范围 true:全部,false:指定员工 */ | |||
@TableField(value = "`applicable_range`") | |||
private Boolean applicableRange; | |||
/** 生成周期 true:当前年一月一日 */ | |||
@TableField(value = "`generation_cycle`") | |||
private Boolean generationCycle; | |||
@@ -9,30 +9,42 @@ import lombok.Data; | |||
import java.time.LocalDate; | |||
/** | |||
* 年假用户表 | |||
* 对应表: nj_rule_config_and_user | |||
*/ | |||
@Data | |||
@TableName("nj_rule_config_and_user") | |||
public class NjRuleConfigAndUser extends BaseEntity { | |||
/** 主键ID */ | |||
@TableId(value = "id", type = IdType.AUTO) | |||
private long id; | |||
/** 配置表ID */ | |||
@TableField(value = "`nj_rule_config_id`") | |||
private long njRuleConfigId; | |||
/** 规则名称 */ | |||
@TableField(value = "`rule_name`") | |||
private String ruleName; | |||
/** 用户id */ | |||
@TableField(value = "`user_id`") | |||
private long userId; | |||
/** 用户名称 */ | |||
@TableField(value = "`user_name`") | |||
private String userName; | |||
/** 用户名称 */ | |||
@TableField(value = "`nick_name`") | |||
private String nickName; | |||
/** 部门名称 */ | |||
@TableField(value = "`dept_name`") | |||
private String deptName; | |||
/** 入职时间 */ | |||
@TableField(value = "`joined_date`") | |||
private LocalDate joinedDate; | |||
} |
@@ -23,16 +23,12 @@ public class DkJob { | |||
// 每天18执行 | |||
@Scheduled(cron = "0 0 2 * * ?") | |||
// @Scheduled(cron = "0/10 * * * * ?") | |||
public void executeTask() throws ParseException { | |||
// 任务逻辑 | |||
System.out.println("执行工作日18点定时任务:" + System.currentTimeMillis()); | |||
try { | |||
// 判断当天时间是否为节假日,为0的时候是工作日 | |||
// String yearHoliday = HolidayUtil.isWorkingDay(LocalDate.now().toString()); | |||
// if(yearHoliday.equals("0")){ | |||
// 获取所有员工 | |||
List<JSONObject> jsonObjects = dkRecordMapper.queryAllUsers(); | |||
// 获取所有员工 | |||
List<JSONObject> jsonObjects = dkRecordMapper.queryAllUsers(null); | |||
for (JSONObject jsonObject : jsonObjects) { | |||
// 获取员工id | |||
Long userId = jsonObject.getLong("userId"); | |||
@@ -52,9 +48,6 @@ public class DkJob { | |||
if(appDTO == null){ | |||
continue; | |||
} | |||
// 获取员工打卡记录根据员工id | |||
// List<DkCheckInRecord> records = dkRecordMapper.getRecordHistory(userId); | |||
// if(records == null || records.size() == 0){ | |||
DkCheckInRecord dkCheckInRecord = new DkCheckInRecord(); | |||
dkCheckInRecord.setSysUserId(userId); | |||
dkCheckInRecord.setSysUserName(userName); | |||
@@ -66,11 +59,7 @@ public class DkJob { | |||
dkCheckInRecord.setAttendanceGroupId(appDTO.getId()); | |||
dkCheckInRecord.setAttendanceGroupName(appDTO.getName()); | |||
dkRecordMapper.insertOrUpdate(dkCheckInRecord); | |||
// } | |||
} | |||
// } | |||
System.out.println("执行工作日18点定时任务:" + System.currentTimeMillis()); | |||
// 具体任务逻辑 | |||
} catch (Exception e) { | |||
@@ -78,100 +67,5 @@ public class DkJob { | |||
} | |||
} | |||
// 每周一到周五18点执行 | |||
// @Scheduled(cron = "0 0 18 ? * MON-FRI") | |||
public void executeWeekdayTask() { | |||
System.out.println("执行工作日18点定时任务:" + System.currentTimeMillis()); | |||
try { | |||
// 获取所有员工 | |||
List<JSONObject> jsonObjects = dkRecordMapper.queryAllUsers(); | |||
for (JSONObject jsonObject : jsonObjects) { | |||
// 获取员工id | |||
Long userId = jsonObject.getLong("userId"); | |||
// 如果没有员工id,则跳过 | |||
if (userId == null){ | |||
continue; | |||
} | |||
// 获取员工姓名 | |||
String userName = jsonObject.getString("userName"); | |||
// 根据userId 查询考勤组信息 | |||
DkAttendanceGroup appDTO = dkRecordMapper.queryConfigByUserId(userId); | |||
// 如果没有考勤组信息,则跳过 | |||
if(appDTO == null){ | |||
continue; | |||
} | |||
// 获取员工打卡记录根据员工id | |||
List<DkCheckInRecord> records = dkRecordMapper.getRecordHistory(userId); | |||
if(records == null || records.size() == 0){ | |||
DkCheckInRecord dkCheckInRecord = new DkCheckInRecord(); | |||
dkCheckInRecord.setSysUserId(userId); | |||
dkCheckInRecord.setSysUserName(userName); | |||
dkCheckInRecord.setCheckInTime(LocalDateTime.now()); | |||
dkCheckInRecord.setCheckInStatus(Constans.CHECK_IN_STATUS_0); | |||
dkCheckInRecord.setClockInStatus(Constans.CHECK_IN_STATUS_0); | |||
dkCheckInRecord.setClockOutStatus(Constans.CHECK_IN_STATUS_0); | |||
dkCheckInRecord.setAttendanceGroupId(appDTO.getId()); | |||
dkCheckInRecord.setAttendanceGroupName(appDTO.getName()); | |||
dkRecordMapper.insertOrUpdate(dkCheckInRecord); | |||
} | |||
} | |||
System.out.println("执行工作日18点定时任务:" + System.currentTimeMillis()); | |||
// 具体任务逻辑 | |||
} catch (Exception e) { | |||
System.out.println("执行工作日18点定时任务:" + System.currentTimeMillis()); | |||
} | |||
} | |||
// @Scheduled(cron = "0/10 * * * * MON-FRI") // 每分钟执行 | |||
// public void testTask() { | |||
// System.out.println("执行工作日18点定时任务:" + System.currentTimeMillis()); | |||
// try { | |||
// // 获取所有员工 | |||
// List<JSONObject> jsonObjects = dkRecordMapper.queryAllUsers(); | |||
// for (JSONObject jsonObject : jsonObjects) { | |||
// // 获取员工id | |||
// Long userId = jsonObject.getLong("userId"); | |||
// // 如果没有员工id,则跳过 | |||
// if (userId == null){ | |||
// continue; | |||
// } | |||
// // 获取员工姓名 | |||
// String userName = jsonObject.getString("userName"); | |||
// | |||
// // 根据userId 查询考勤组信息 | |||
// DkAttendanceGroup appDTO = dkRecordMapper.queryConfigByUserId(userId); | |||
// // 如果没有考勤组信息,则跳过 | |||
// if(appDTO == null){ | |||
// continue; | |||
// } | |||
// // 获取员工打卡记录根据员工id | |||
// List<DkCheckInRecord> records = dkRecordMapper.getRecordHistory(userId); | |||
// if(records == null || records.size() == 0){ | |||
// DkCheckInRecord dkCheckInRecord = new DkCheckInRecord(); | |||
// dkCheckInRecord.setSysUserId(userId); | |||
// dkCheckInRecord.setSysUserName(userName); | |||
// dkCheckInRecord.setCheckInTime(LocalDateTime.now()); | |||
// dkCheckInRecord.setCheckInStatus(Constans.CHECK_IN_STATUS_0); | |||
// dkCheckInRecord.setClockInStatus(Constans.CHECK_IN_STATUS_0); | |||
// dkCheckInRecord.setClockOutStatus(Constans.CHECK_IN_STATUS_0); | |||
// dkCheckInRecord.setAttendanceGroupId(appDTO.getId()); | |||
// dkCheckInRecord.setAttendanceGroupName(appDTO.getName()); | |||
// dkRecordMapper.insertOrUpdate(dkCheckInRecord); | |||
// } | |||
// | |||
// } | |||
// | |||
// System.out.println("执行工作日18点定时任务:" + System.currentTimeMillis()); | |||
// // 具体任务逻辑 | |||
// } catch (Exception e) { | |||
// System.out.println("执行工作日18点定时任务:" + System.currentTimeMillis()); | |||
// } | |||
// } | |||
} |
@@ -22,5 +22,5 @@ public interface DkRecordMapper extends BaseMapperPlus<DkRecordMapper, DkCheckIn | |||
List<DkCheckInRecord> getRecordHistory(@Param("userId") long userId); | |||
List<JSONObject> queryAllUsers(); | |||
List<JSONObject> queryAllUsers(@Param("attendanceGroupIds") List<Long> attendanceGroupIds); | |||
} |
@@ -40,7 +40,26 @@ | |||
</select> | |||
<select id="queryAllUsers" resultType="com.alibaba.fastjson.JSONObject"> | |||
SELECT user_id userId, user_name userName , nick_name nickName FROM `sys_user` | |||
SELECT | |||
user_id userId, | |||
user_name userName, | |||
nick_name nickName | |||
FROM | |||
sys_user u | |||
WHERE | |||
del_flag = 0 | |||
AND u.dept_id IN ( SELECT dept_id FROM sys_dept WHERE FIND_IN_SET( '100', ancestors ) OR dept_id = 100 ) | |||
AND user_id != 1 | |||
<if test="attendanceGroupIds != null and attendanceGroupIds.size() > 0"> | |||
AND user_id IN ( | |||
SELECT user_id | |||
FROM dk_check_in_attendance_team_and_user | |||
WHERE attendance_team_id IN | |||
<foreach collection="attendanceGroupIds" item="id" open="(" separator="," close=")"> | |||
#{id} | |||
</foreach> | |||
) | |||
</if> | |||
</select> | |||
<select id="getRecordHistory" resultType="com.ruoyi.zhushi.entity.DkCheckInRecord"> |