| | |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.SysLevelRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.system.repository.SysUserLevelInsuranceRepository; |
| | | import me.zhengjie.modules.system.service.SysUserLevelInsuranceService; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public SysUserLevelInsuranceDto queryTargetYearMonth(SysUserLevelInsuranceQueryCriteria criteria){ |
| | | // 国际时间转中国时间 |
| | | String targetYearMonth = DateUtil.internationalTimeToChinaTime(criteria.getTargetYearMonth()); |
| | | // 获取某年某月最后一天 |
| | | String lastDayOfTargetYearMonth = DateUtil.getLastDayOfMonth(targetYearMonth); |
| | | // 根据用户ID、指定年月查询 |
| | | SysUserLevelInsurance sysUserLevelInsurance = sysUserLevelInsuranceRepository.findTargetYearMonth(criteria.getUserId(), lastDayOfTargetYearMonth); |
| | | // 判断查询结果 |
| | | if (sysUserLevelInsurance == null) { |
| | | throw new BadRequestException("没有获取到当前员工的级别信息!"); |
| | | } |
| | | // 返回 |
| | | return sysUserLevelInsuranceMapper.toDto(sysUserLevelInsurance); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public SysUserLevelInsuranceDto findById(Long id) { |
| | | SysUserLevelInsurance sysUserLevelInsurance = sysUserLevelInsuranceRepository.findById(id).orElseGet(SysUserLevelInsurance::new); |