获取考勤页面

This commit is contained in:
aikai 2024-04-17 16:49:40 +08:00
parent ba2005cd9a
commit 38592292df
7 changed files with 76 additions and 33 deletions

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.system.controller.app.attendance.dto;
import cn.iocoder.yudao.module.system.dal.dataobject.group.AttendanceGroupDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
@ -14,7 +15,13 @@ public class AttendancePunchPageDTO {
@Schema(description = "纬度")
private String latitude;
@Schema(description = "当前用户id", hidden = true)
/**
* 当前用户id
*/
private Long userId;
/**
* 考勤组
*/
private AttendanceGroupDO activationGroup;
}

View File

@ -6,13 +6,18 @@ import lombok.Data;
@Data
public class AttendancePunchPageVO {
@Schema(description = "是否在考勤组 0否 1是")
private Integer inGroup;
private Integer inGroup = 1;
@Schema(description = "当天是否需要考勤 0否 1是")
private Integer todayNeedAttendance;
private Integer todayNeedAttendance = 1;
@Schema(description = "是否允许外勤打卡 0否 1是")
private Integer fieldworkFlag;
@Schema(description = "是否在打卡点 0否 1是")
private Integer checkInPoint;
@Schema(description = "当天打卡记录")
@Schema(description = "打卡页面顶部 当天打卡记录 已打卡 0/4")
private String checkInRecordToday;
@Schema(description = "打卡类型(0上班卡 1下班卡 2迟到卡 3外勤卡)")
private String punchType;
//打卡状态 0正常 1迟到 2缺卡 3外勤 4补卡 5早退
@Schema(description = "考勤规则/打卡记录 JSON格式 [{name:上班 09:00,punchTime:yyyy-MM-dd HH:mm:ss,status:1},{name:下班 12:00,punchTime:yyyy-MM-dd HH:mm:ss,status:2}]")
private String punchJson;
}

View File

@ -20,7 +20,11 @@ import lombok.*;
@NoArgsConstructor
@AllArgsConstructor
public class AttendanceGroupDO extends BaseDO {
/**
* 0否 1是
*/
public static final Integer FALSE = 0;
public static final Integer TRUE = 1;
/**
* 编号
*/

View File

@ -23,18 +23,17 @@ public class AttendanceServiceImpl implements AttendanceService {
private AttendanceGroupService attendanceGroupService;
@Override
public AttendancePunchPageVO getPunchPage(AttendancePunchPageDTO attendancePunchPageDTO) {
public AttendancePunchPageVO getPunchPage(AttendancePunchPageDTO dto) {
AttendancePunchPageVO vo = new AttendancePunchPageVO();
//获取当前登录用户所在群组
AttendanceGroupDO activationGroup = attendanceGroupService.getByUserId(attendancePunchPageDTO.getUserId());
AttendanceGroupDO activationGroup = attendanceGroupService.getByUserId(dto.getUserId());
//不在考勤组 - 返回回去
if (activationGroup == null) {
// TODO: 2024/4/10 不在考勤组 - 返回回去
vo.setInGroup(AttendanceGroupDO.FALSE);
return vo;
}
//判断目前是否在班次内
// 策略模式 - 将不同考勤类型的 分散开逻辑 - 后续好拓展
PunchService punchService = punchHandler.getResource(AttendanceGroupDO.getCodeByType(activationGroup.getType()));
// TODO: 2024/4/10 处理打卡
return null;
return punchService.getPunchPage(dto.setActivationGroup(activationGroup));
}
}

View File

@ -1,18 +1,22 @@
package cn.iocoder.yudao.module.system.service.attendance.fixed;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.module.system.controller.admin.fixed.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.fixed.AttendanceFixedDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.controller.admin.fixed.vo.AttendanceFixedPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.fixed.vo.AttendanceFixedSaveReqVO;
import cn.iocoder.yudao.module.system.controller.app.attendance.dto.AttendancePunchPageDTO;
import cn.iocoder.yudao.module.system.controller.app.attendance.vo.AttendancePunchPageVO;
import cn.iocoder.yudao.module.system.dal.dataobject.fixed.AttendanceFixedDO;
import cn.iocoder.yudao.module.system.dal.dataobject.group.AttendanceGroupDO;
import cn.iocoder.yudao.module.system.dal.mysql.attendance.fixed.AttendanceFixedMapper;
import cn.iocoder.yudao.module.system.service.attendance.punch.PunchService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.FIXED_NOT_EXISTS;
/**
* 固定班制考勤设置 Service 实现类
@ -21,8 +25,7 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
*/
@Service("fixed")
@Validated
public class AttendanceFixedServiceImpl implements AttendanceFixedService {
public class AttendanceFixedServiceImpl implements AttendanceFixedService, PunchService {
@Resource
private AttendanceFixedMapper fixedMapper;
@ -68,4 +71,14 @@ public class AttendanceFixedServiceImpl implements AttendanceFixedService {
return fixedMapper.selectPage(pageReqVO);
}
@Override
public AttendancePunchPageVO getPunchPage(AttendancePunchPageDTO dto) {
AttendancePunchPageVO vo = new AttendancePunchPageVO();
AttendanceGroupDO activationGroup = dto.getActivationGroup();
//判断当天是否需要考勤 -
//获取到当天是周几
return null;
}
}

View File

@ -1,5 +1,8 @@
package cn.iocoder.yudao.module.system.service.attendance.punch;
import cn.iocoder.yudao.module.system.controller.app.attendance.dto.AttendancePunchPageDTO;
import cn.iocoder.yudao.module.system.controller.app.attendance.vo.AttendancePunchPageVO;
/**
* 打卡 Service 接口
*
@ -7,6 +10,11 @@ package cn.iocoder.yudao.module.system.service.attendance.punch;
*/
public interface PunchService {
/**
* 获取考勤页面
*
* @param dto
* @return
*/
AttendancePunchPageVO getPunchPage(AttendancePunchPageDTO dto);
}

View File

@ -1,18 +1,21 @@
package cn.iocoder.yudao.module.system.service.attendance.scheduling;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.module.system.controller.admin.scheduling.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.scheduling.AttendanceSchedulingDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.controller.admin.scheduling.vo.AttendanceSchedulingPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.scheduling.vo.AttendanceSchedulingSaveReqVO;
import cn.iocoder.yudao.module.system.controller.app.attendance.dto.AttendancePunchPageDTO;
import cn.iocoder.yudao.module.system.controller.app.attendance.vo.AttendancePunchPageVO;
import cn.iocoder.yudao.module.system.dal.dataobject.scheduling.AttendanceSchedulingDO;
import cn.iocoder.yudao.module.system.dal.mysql.attendance.scheduling.AttendanceSchedulingMapper;
import cn.iocoder.yudao.module.system.service.attendance.punch.PunchService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.SCHEDULING_NOT_EXISTS;
/**
* 排班制考勤设置 Service 实现类
@ -21,7 +24,7 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
*/
@Service("scheduling")
@Validated
public class AttendanceSchedulingServiceImpl implements AttendanceSchedulingService {
public class AttendanceSchedulingServiceImpl implements AttendanceSchedulingService, PunchService {
@Resource
private AttendanceSchedulingMapper schedulingMapper;
@ -68,4 +71,8 @@ public class AttendanceSchedulingServiceImpl implements AttendanceSchedulingServ
return schedulingMapper.selectPage(pageReqVO);
}
@Override
public AttendancePunchPageVO getPunchPage(AttendancePunchPageDTO dto) {
return null;
}
}