| | |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceDto; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.system.domain.Job; |
| | | import me.zhengjie.modules.system.domain.Role; |
| | | import me.zhengjie.modules.system.domain.SysConfigProportion; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.system.repository.RoleRepository; |
| | | import me.zhengjie.modules.system.repository.SysConfigProportionRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.domain.*;
|
| | | import me.zhengjie.modules.system.repository.*;
|
| | | import me.zhengjie.modules.system.service.SysConfigHolidayService;
|
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceCardreplacementRepository; |
| | |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate;
|
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | private final AttendanceRepository attendanceRepository; |
| | | private final SysConfigProportionRepository sysConfigProportionRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository;
|
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AttendanceCardreplacementQueryCriteria criteria, Pageable pageable){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 只能补3个工作日的卡
|
| | | * @param resources
|
| | | */
|
| | | public void checkCardreplacement(AttendanceCardreplacement resources) {
|
| | |
|
| | | LocalDate toLocalDate = resources.getCardReplacementTime().toLocalDateTime().toLocalDate();
|
| | | LocalDate localDate = LocalDate.now();
|
| | | int count = 0;
|
| | | while (localDate.isAfter(toLocalDate)) {
|
| | | if (count >= 3) {
|
| | | throw new BadRequestException("只能申请3个工作日的补卡");
|
| | | }
|
| | | if (localDate.getDayOfWeek().getValue() == 6 || localDate.getDayOfWeek().getValue() == 7) {
|
| | | SysConfigHoliday holidayDate = sysConfigHolidayRepository.findByHolidayDate(localDate.toString());
|
| | | if (holidayDate != null && holidayDate.getDateType().equals(Constant.DATE_TYPE_WEEKDAY)) {
|
| | | count++;
|
| | | }
|
| | | } else {
|
| | | SysConfigHoliday holidayDate = sysConfigHolidayRepository.findByHolidayDate(localDate.toString());
|
| | | if (holidayDate == null || holidayDate.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS) || holidayDate.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS)) {
|
| | | count++;
|
| | | }
|
| | | }
|
| | | localDate = localDate.plusDays(-1);
|
| | | count++;
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 返回前三个工作日的日期
|
| | | * @param resources
|
| | | */
|
| | | public List<String> getCardreplacementAbleDateList(AttendanceCardreplacement resources) {
|
| | | List<String> dateList = new ArrayList<>();
|
| | | LocalDate toLocalDate = resources.getCardReplacementTime().toLocalDateTime().toLocalDate();
|
| | | LocalDate localDate = LocalDate.now();
|
| | | int count = 0;
|
| | | while (localDate.isAfter(toLocalDate)) {
|
| | | if (count >= 3) {
|
| | | break;
|
| | | }
|
| | | if (localDate.getDayOfWeek().getValue() == 6 || localDate.getDayOfWeek().getValue() == 7) {
|
| | | SysConfigHoliday holidayDate = sysConfigHolidayRepository.findByHolidayDate(localDate.toString());
|
| | | if (holidayDate != null && holidayDate.getDateType().equals(Constant.DATE_TYPE_WEEKDAY)) {
|
| | | dateList.add(localDate.toString());
|
| | | count++;
|
| | | }
|
| | | } else {
|
| | | SysConfigHoliday holidayDate = sysConfigHolidayRepository.findByHolidayDate(localDate.toString());
|
| | | if (holidayDate == null || holidayDate.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS) || holidayDate.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS)) {
|
| | | dateList.add(localDate.toString());
|
| | | count++;
|
| | | }
|
| | | }
|
| | | localDate = localDate.plusDays(-1);
|
| | | count++;
|
| | | }
|
| | | return dateList;
|
| | | }
|
| | | /**
|
| | | * 查询剩余补卡次数 |
| | | */ |
| | | public void getCardreplacement(Timestamp cardReplacementTime, Long userId){ |