考勤用户过滤/考勤定时任务
This commit is contained in:
parent
c501dea1f4
commit
e1bea33639
@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.annotation.security.PermitAll;
|
||||||
import javax.validation.*;
|
import javax.validation.*;
|
||||||
import javax.servlet.http.*;
|
import javax.servlet.http.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -72,7 +73,7 @@ public class AttendanceGroupController {
|
|||||||
|
|
||||||
|
|
||||||
@GetMapping("/test")
|
@GetMapping("/test")
|
||||||
@Operation(summary = "测试")
|
@PermitAll
|
||||||
public CommonResult test() {
|
public CommonResult test() {
|
||||||
groupService.test();
|
groupService.test();
|
||||||
return success("ok");
|
return success("ok");
|
||||||
|
@ -69,6 +69,10 @@ public class AttendancePunchRecordRespVO {
|
|||||||
@ExcelProperty("打卡时间")
|
@ExcelProperty("打卡时间")
|
||||||
private LocalDateTime punchTime;
|
private LocalDateTime punchTime;
|
||||||
|
|
||||||
|
@Schema(description = "应打卡时间")
|
||||||
|
@ExcelProperty("应打卡时间")
|
||||||
|
private LocalDateTime shouldPunchTime;
|
||||||
|
|
||||||
@Schema(description = "打卡备注", example = "你说的对")
|
@Schema(description = "打卡备注", example = "你说的对")
|
||||||
@ExcelProperty("打卡备注")
|
@ExcelProperty("打卡备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
@ -20,9 +20,15 @@ public class AttendancePunchRecordSaveReqVO {
|
|||||||
@Schema(description = "考勤组id", example = "22293")
|
@Schema(description = "考勤组id", example = "22293")
|
||||||
private Long attendanceGroupId;
|
private Long attendanceGroupId;
|
||||||
|
|
||||||
|
@Schema(description = "考勤组名称", example = "22293")
|
||||||
|
private String attendanceGroupName;
|
||||||
|
|
||||||
@Schema(description = "班次id", example = "10780")
|
@Schema(description = "班次id", example = "10780")
|
||||||
private Long attendanceGroupShiftId;
|
private Long attendanceGroupShiftId;
|
||||||
|
|
||||||
|
@Schema(description = "班次名称", example = "22293")
|
||||||
|
private String attendanceGroupShiftName;
|
||||||
|
|
||||||
@Schema(description = "班次子表id", example = "10780")
|
@Schema(description = "班次子表id", example = "10780")
|
||||||
private Long attendanceGroupShiftItemId;
|
private Long attendanceGroupShiftItemId;
|
||||||
|
|
||||||
|
@ -165,12 +165,21 @@ public class UserController {
|
|||||||
return success(user);
|
return success(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/selectByUserIds")
|
||||||
|
@Operation(summary = "通过用户ids获取用户信息列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:user:query')")
|
||||||
|
public CommonResult<List<UserRespVO>> selectByUserIds(@RequestBody Collection<Long> userIds) {
|
||||||
|
List<AdminUserDO> user = userService.selectByUserIds(userIds);
|
||||||
|
return success(BeanUtils.toBean(user, UserRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/selectByDeptIdsFilterGroupUser")
|
@PostMapping("/selectByDeptIdsFilterGroupUser")
|
||||||
@Operation(summary = "通过部门ids获取用户信息列表(过滤掉已在考勤组的用户)")
|
@Operation(summary = "通过部门ids获取用户信息列表(过滤掉已在考勤组的用户)")
|
||||||
@PreAuthorize("@ss.hasPermission('system:user:query')")
|
@PreAuthorize("@ss.hasPermission('system:user:query')")
|
||||||
public CommonResult<List<UserRespVO>> selectByDeptIdsFilterGroupUser(@RequestBody Collection<Long> deptIds) {
|
public CommonResult<List<UserRespVO>> selectByDeptIdsFilterGroupUser(@RequestParam(required = false) Long groupId, @RequestBody Collection<Long> deptIds) {
|
||||||
|
|
||||||
List<UserRespVO> user = userService.selectByDeptIdsFilterGroupUser(deptIds);
|
List<UserRespVO> user = userService.selectByDeptIdsFilterGroupUser(deptIds, groupId);
|
||||||
return success(user);
|
return success(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,9 +76,10 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
|||||||
* 根据部门ids查询出用户列表 过滤掉考勤组里有的
|
* 根据部门ids查询出用户列表 过滤掉考勤组里有的
|
||||||
*
|
*
|
||||||
* @param deptIds
|
* @param deptIds
|
||||||
|
* @param groupId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<UserRespVO> selectByDeptIdsFilterGroupUser(Collection<Long> deptIds);
|
List<UserRespVO> selectByDeptIdsFilterGroupUser(@Param("deptIds") Collection<Long> deptIds, @Param("groupId") Long groupId);
|
||||||
|
|
||||||
List<Long> selectUserByBoss();
|
List<Long> selectUserByBoss();
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class AttendanceMissingCardJob {
|
|||||||
.eq(AttendancePunchRecordDO::getStatus, AttendanceOnTheDayDTO.PUNCH_STATUS_UN_PUNCH)
|
.eq(AttendancePunchRecordDO::getStatus, AttendanceOnTheDayDTO.PUNCH_STATUS_UN_PUNCH)
|
||||||
.le(AttendancePunchRecordDO::getLatestPunchTime, now);
|
.le(AttendancePunchRecordDO::getLatestPunchTime, now);
|
||||||
AttendancePunchRecordDO attendancePunchRecordDO = new AttendancePunchRecordDO();
|
AttendancePunchRecordDO attendancePunchRecordDO = new AttendancePunchRecordDO();
|
||||||
attendancePunchRecordDO.setStatus(AttendanceOnTheDayDTO.PUNCH_STATUS_MISS);
|
attendancePunchRecordDO.setStatus(AttendanceOnTheDayDTO.PUNCH_STATUS_MISS).setNextDayFlag(Constants.FALSE);
|
||||||
attendancePunchRecordMapper.update(attendancePunchRecordDO, le);
|
attendancePunchRecordMapper.update(attendancePunchRecordDO, le);
|
||||||
log.info("结束 修改考勤缺卡");
|
log.info("结束 修改考勤缺卡");
|
||||||
// 返回执行成功
|
// 返回执行成功
|
||||||
|
@ -139,7 +139,9 @@ public class AttendanceServiceImpl implements AttendanceService {
|
|||||||
AttendancePunchRecordSaveReqVO attendancePunchRecordSaveReqVO = new AttendancePunchRecordSaveReqVO()
|
AttendancePunchRecordSaveReqVO attendancePunchRecordSaveReqVO = new AttendancePunchRecordSaveReqVO()
|
||||||
.setUserId(dto.getUserId())
|
.setUserId(dto.getUserId())
|
||||||
.setAttendanceGroupId(pageVO.getActivationGroup().getId())
|
.setAttendanceGroupId(pageVO.getActivationGroup().getId())
|
||||||
|
.setAttendanceGroupName(pageVO.getActivationGroup().getGroupName())
|
||||||
.setAttendanceGroupShiftId(pageVO.getAttendanceGroupShiftDO().getId())
|
.setAttendanceGroupShiftId(pageVO.getAttendanceGroupShiftDO().getId())
|
||||||
|
.setAttendanceGroupShiftName(pageVO.getAttendanceGroupShiftDO().getName())
|
||||||
.setAttendanceGroupShiftItemId(pageVO.getAttendanceGroupShiftItemId())
|
.setAttendanceGroupShiftItemId(pageVO.getAttendanceGroupShiftItemId())
|
||||||
.setType(pageVO.getActivationGroup().getType())
|
.setType(pageVO.getActivationGroup().getType())
|
||||||
.setPunchType(dto.getPunchType())
|
.setPunchType(dto.getPunchType())
|
||||||
|
@ -128,7 +128,7 @@ public class AttendanceGroupServiceImpl implements AttendanceGroupService {
|
|||||||
Map<Long, List<Long>> groupUserMap = attendanceGroupUserDOS.stream().collect(Collectors.groupingBy(AttendanceGroupUserDO::getAttendanceGroupId,
|
Map<Long, List<Long>> groupUserMap = attendanceGroupUserDOS.stream().collect(Collectors.groupingBy(AttendanceGroupUserDO::getAttendanceGroupId,
|
||||||
Collectors.mapping(AttendanceGroupUserDO::getUserId, Collectors.toList())));
|
Collectors.mapping(AttendanceGroupUserDO::getUserId, Collectors.toList())));
|
||||||
// -- 获取考勤组下考勤规则 - 将将考勤组分组 - 按类型
|
// -- 获取考勤组下考勤规则 - 将将考勤组分组 - 按类型
|
||||||
LocalDateTime tomorrowLocalDateTime = LocalDateTimeUtil.offset(LocalDateTime.now(), 1, ChronoUnit.DAYS);
|
LocalDateTime tomorrowLocalDateTime = LocalDateTime.now();
|
||||||
LocalDateTime theDayAfterTomorrowLocalDateTime = LocalDateTimeUtil.offset(tomorrowLocalDateTime, 1, ChronoUnit.DAYS);
|
LocalDateTime theDayAfterTomorrowLocalDateTime = LocalDateTimeUtil.offset(tomorrowLocalDateTime, 1, ChronoUnit.DAYS);
|
||||||
|
|
||||||
String time = tomorrowLocalDateTime.format(Constants.REPO_DATE_FORMAT);
|
String time = tomorrowLocalDateTime.format(Constants.REPO_DATE_FORMAT);
|
||||||
@ -166,6 +166,7 @@ public class AttendanceGroupServiceImpl implements AttendanceGroupService {
|
|||||||
attendancePunchRecordDO.setLevel(attendanceOnTheDayDTO.getLevel());
|
attendancePunchRecordDO.setLevel(attendanceOnTheDayDTO.getLevel());
|
||||||
attendancePunchRecordDO.setStatus(AttendanceOnTheDayDTO.PUNCH_STATUS_UN_PUNCH);
|
attendancePunchRecordDO.setStatus(AttendanceOnTheDayDTO.PUNCH_STATUS_UN_PUNCH);
|
||||||
attendancePunchRecordDO.setFieldServiceFlag(Constants.FALSE);
|
attendancePunchRecordDO.setFieldServiceFlag(Constants.FALSE);
|
||||||
|
attendancePunchRecordDO.setNextDayFlag(Constants.TRUE);
|
||||||
attendancePunchRecordDO.setDayTime(time);
|
attendancePunchRecordDO.setDayTime(time);
|
||||||
LocalDateTime shouldPunchTime = LocalDateTime.ofInstant(DateUtils.buildHHmmTime(attendanceOnTheDayDTO.getTime(),
|
LocalDateTime shouldPunchTime = LocalDateTime.ofInstant(DateUtils.buildHHmmTime(attendanceOnTheDayDTO.getTime(),
|
||||||
(attendanceOnTheDayDTO.getNextDayFlag() == 0 ? tomorrowLocalDateTime : theDayAfterTomorrowLocalDateTime)).toInstant(), ZoneId.systemDefault());
|
(attendanceOnTheDayDTO.getNextDayFlag() == 0 ? tomorrowLocalDateTime : theDayAfterTomorrowLocalDateTime)).toInstant(), ZoneId.systemDefault());
|
||||||
|
@ -158,9 +158,10 @@ public interface AdminUserService {
|
|||||||
* 获取部门下人员过滤掉考勤组内有的
|
* 获取部门下人员过滤掉考勤组内有的
|
||||||
*
|
*
|
||||||
* @param deptIds
|
* @param deptIds
|
||||||
|
* @param groupId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<UserRespVO> selectByDeptIdsFilterGroupUser(Collection<Long> deptIds);
|
List<UserRespVO> selectByDeptIdsFilterGroupUser(Collection<Long> deptIds, Long groupId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得指定部门的用户数组(除去当前登录者用户)
|
* 获得指定部门的用户数组(除去当前登录者用户)
|
||||||
@ -271,4 +272,12 @@ public interface AdminUserService {
|
|||||||
* @return 用户编号
|
* @return 用户编号
|
||||||
*/
|
*/
|
||||||
List<Long> getUserByBoss();
|
List<Long> getUserByBoss();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ids搜索用户列表
|
||||||
|
*
|
||||||
|
* @param userIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<AdminUserDO> selectByUserIds(Collection<Long> userIds);
|
||||||
}
|
}
|
||||||
|
@ -274,11 +274,11 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UserRespVO> selectByDeptIdsFilterGroupUser(Collection<Long> deptIds) {
|
public List<UserRespVO> selectByDeptIdsFilterGroupUser(Collection<Long> deptIds, Long groupId) {
|
||||||
if (CollUtil.isEmpty(deptIds)) {
|
if (CollUtil.isEmpty(deptIds)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
return userMapper.selectByDeptIdsFilterGroupUser(deptIds);
|
return userMapper.selectByDeptIdsFilterGroupUser(deptIds, groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -562,4 +562,12 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
|
|
||||||
return userMapper.selectUserByBoss();
|
return userMapper.selectUserByBoss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AdminUserDO> selectByUserIds(Collection<Long> userIds) {
|
||||||
|
if (CollectionUtil.isEmpty(userIds)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return userMapper.selectBatchIds(userIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,11 +49,9 @@
|
|||||||
and a.status = 0
|
and a.status = 0
|
||||||
and a.user_type = 1
|
and a.user_type = 1
|
||||||
and a.dept_id in
|
and a.dept_id in
|
||||||
<foreach collection="list" item="deptIds" open="(" close=")" separator=",">
|
<foreach collection="deptIds" item="deptId" open="(" close=")" separator=",">
|
||||||
#{deptIds}
|
#{deptId}
|
||||||
</foreach>
|
</foreach>
|
||||||
<if test="groupId != null">
|
and not exists(select id from kq_attendance_group_user where user_id = a.id and attendance_group_id != #{groupId})
|
||||||
and not exists(select id from kq_attendance_group_user where user_id = a.id)
|
|
||||||
</if>
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user