|
|
@@ -114,18 +114,17 @@ public class PunchInManagerImpl implements IPunchInManager {
|
|
|
punchInRecordDto.setPunchInDate(currentDateStr);
|
|
|
recordDtos.add(punchInRecordDto);
|
|
|
|
|
|
- // 还没到当前日期则跳过
|
|
|
+ // 还没到当前日期则跳过,根据过往打卡记录设置打卡状态
|
|
|
if (currentDate.isAfter(today)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- // 根据过往打卡记录设置打卡状态
|
|
|
- if (currentDate.isBefore(punchInCreationDate)) {
|
|
|
- punchInRecordDto.setPunchInStatus(PunchInStatusEnum.UNCREATED.getValue());
|
|
|
+ punchInRecordDto.setPunchInStatus(PunchInStatusEnum.FUTURE_TIME);
|
|
|
+ } else if (currentDate.isBefore(punchInCreationDate)) {
|
|
|
+ punchInRecordDto.setPunchInStatus(PunchInStatusEnum.UNCREATED);
|
|
|
} else if (recordWeekMap.containsKey(currentDateStr)) {
|
|
|
- punchInRecordDto.setPunchInStatus(PunchInStatusEnum.PUNCHIN.getValue());
|
|
|
+ punchInRecordDto.setPunchInStatus(PunchInStatusEnum.PUNCH_IN);
|
|
|
+ } else if (currentDate.isEqual(today) && !recordWeekMap.containsKey(currentDateStr)) {
|
|
|
+ punchInRecordDto.setPunchInStatus(PunchInStatusEnum.TODAY_UNKNOWN);
|
|
|
} else {
|
|
|
- punchInRecordDto.setPunchInStatus(PunchInStatusEnum.UNPUNCHIN.getValue());
|
|
|
+ punchInRecordDto.setPunchInStatus(PunchInStatusEnum.UN_PUNCH_IN);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -135,9 +134,19 @@ public class PunchInManagerImpl implements IPunchInManager {
|
|
|
return punchInWithRecordDtos;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public PunchInDto queryPunchInById(Long punchInId) {
|
|
|
+ Assert.isNullInBusiness(punchInId, "请传入待查询的任务ID");
|
|
|
+ return Optional.ofNullable(punchInService.getById(punchInId)).map(punchIn -> {
|
|
|
+ PunchInDto dto = new PunchInDto();
|
|
|
+ BeanUtils.copyProperties(punchIn, dto);
|
|
|
+ return dto;
|
|
|
+ }).orElseThrow(() -> BusinessException.fail("无法查询到该打卡任务"));
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void saveOrUpdatePunchIn(PunchInDto dto) {
|
|
|
- Assert.isNullInBusiness(dto.getId(), "请传入任务信息");
|
|
|
+ Assert.isNullInBusiness(dto, "请传入任务信息");
|
|
|
|
|
|
PunchIn punchIn = new PunchIn();
|
|
|
BeanUtils.copyProperties(dto, punchIn);
|