考勤定时增量调整

This commit is contained in:
aikai 2024-06-13 10:41:14 +08:00
parent bbc8e4c6a6
commit 627334e51e
4 changed files with 6 additions and 6 deletions

View File

@ -31,7 +31,7 @@ public interface AttendanceSchedulingMapper extends BaseMapperX<AttendanceSchedu
} }
@MapKey("id") @MapKey("id")
Map<Long, Integer> countGroupId(); Map<Long, Map<String, Object>> countGroupId();
/** /**
* 获取使用的考勤组ids * 获取使用的考勤组ids

View File

@ -27,15 +27,15 @@ public class SchedulingJob {
@TenantJob // --- 这个注解 会将租户列表拉出来 完了后逐个租户执行 定时任务需要注意 @TenantJob // --- 这个注解 会将租户列表拉出来 完了后逐个租户执行 定时任务需要注意
public ReturnT<String> execute() throws Exception { public ReturnT<String> execute() throws Exception {
// -- 获取每个排班考勤组 有多少数量(也就是周期多少日) // -- 获取每个排班考勤组 有多少数量(也就是周期多少日)
Map<Long, Integer> map = attendanceSchedulingService.countGroupId(); Map<Long, Map<String, Object>> map = attendanceSchedulingService.countGroupId();
if (MapUtil.isEmpty(map)) { if (MapUtil.isEmpty(map)) {
return ReturnT.SUCCESS; return ReturnT.SUCCESS;
} }
for (Map.Entry<Long, Integer> entry : map.entrySet()) { for (Map.Entry<Long, Map<String, Object>> entry : map.entrySet()) {
String schedulingKey = Constants.SCHEDULING + Constants.UNDERLINE + entry.getKey(); String schedulingKey = Constants.SCHEDULING + Constants.UNDERLINE + entry.getKey();
String value = stringRedisTemplate.opsForValue().get(schedulingKey); String value = stringRedisTemplate.opsForValue().get(schedulingKey);
// -- 如果大于等于周期数 则重置为1 // -- 如果大于等于周期数 则重置为1
if (StrUtil.isNotEmpty(value) && Integer.parseInt(value) >= entry.getValue()) { if (StrUtil.isNotEmpty(value) && Integer.parseInt(value) >= Integer.parseInt(entry.getValue().get("num").toString())) {
stringRedisTemplate.opsForValue().set(schedulingKey, "1"); stringRedisTemplate.opsForValue().set(schedulingKey, "1");
} else { } else {
stringRedisTemplate.opsForValue().increment(schedulingKey); stringRedisTemplate.opsForValue().increment(schedulingKey);

View File

@ -76,7 +76,7 @@ public interface AttendanceSchedulingService {
* *
* @return * @return
*/ */
Map<Long, Integer> countGroupId(); Map<Long, Map<String, Object>> countGroupId();
/** /**
* 获取考勤组和班次id的map * 获取考勤组和班次id的map

View File

@ -158,7 +158,7 @@ public class AttendanceSchedulingServiceImpl implements AttendanceSchedulingServ
} }
@Override @Override
public Map<Long, Integer> countGroupId() { public Map<Long, Map<String, Object>> countGroupId() {
return schedulingMapper.countGroupId(); return schedulingMapper.countGroupId();
} }