| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.system.domain.SysUserLevelInsurance; |
| | | import me.zhengjie.modules.system.service.dto.SysUserLevelInsuranceDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserLevelInsuranceQueryCriteria; |
| | | import me.zhengjie.utils.*; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import me.zhengjie.modules.treatment.service.dto.UserInsuranceQueryCriteria; |
| | | import me.zhengjie.modules.treatment.service.mapstruct.UserInsuranceGenMapper; |
| | | import me.zhengjie.modules.treatment.service.mapstruct.UserInsuranceMapper; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | } |
| | | |
| | | @Override |
| | | public UserInsuranceDto queryTargetYearMonth(UserInsuranceQueryCriteria criteria) { |
| | | // 国际时间转中国时间 |
| | | String targetYearMonth = criteria.getTargetYearMonth(); |
| | | // 获取某年某月最后一天 |
| | | String yearMonth = targetYearMonth.substring(0,7); |
| | | // 根据用户ID、指定年月查询 |
| | | Optional<UserInsurance> userInsuranceOpt = userInsuranceRepository.findByUserIdAndYearMonth(criteria.getUserId(), yearMonth); |
| | | // 判断查询结果 |
| | | if (userInsuranceOpt.isPresent()) { |
| | | UserInsurance userInsurance = userInsuranceOpt.get(); |
| | | // 返回 |
| | | return userInsuranceMapper.toDto(userInsurance); |
| | | } else { |
| | | // throw new BadRequestException("没有获取到当前员工的级别信息!"); |
| | | throw new RuntimeException("没有获取到当前员工的级别信息!"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public UserInsuranceDto findById(Long id) { |
| | | UserInsurance userInsurance = userInsuranceRepository.findById(id).orElseGet(UserInsurance::new); |