| | |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.inspect.dto.SampleOrderDto; |
| | | import com.ruoyi.inspect.dto.OrderRatesSummaryDto; |
| | | import com.ruoyi.inspect.dto.TemplateRateDto; |
| | | import com.ruoyi.inspect.mapper.InsOrderRatesMapper; |
| | | import com.ruoyi.inspect.pojo.InsOrderRates; |
| | |
| | | */ |
| | | @Override |
| | | public IPage<SampleOrderDto> selectInsOrderRates(Page page, SampleOrderDto sampleOrderDto, String startMonth, String endMonth) { |
| | | return baseMapper.selectInsOrderRates(page, ratesFilter(sampleOrderDto, startMonth, endMonth)); |
| | | } |
| | | |
| | | @Override |
| | | public OrderRatesSummaryDto selectRatesSummary(SampleOrderDto sampleOrderDto, String startMonth, String endMonth) { |
| | | return baseMapper.selectRatesSummary(ratesFilter(sampleOrderDto, startMonth, endMonth)); |
| | | } |
| | | |
| | | private QueryWrapper<SampleOrderDto> ratesFilter(SampleOrderDto sampleOrderDto, String startMonth, String endMonth) { |
| | | QueryWrapper<SampleOrderDto> wrapper = QueryWrappers.queryWrappers(sampleOrderDto); |
| | | if (wrapper == null) { |
| | | wrapper = Wrappers.query(); |
| | | } |
| | | if (StrUtil.isNotBlank(startMonth) || StrUtil.isNotBlank(endMonth)) { |
| | | try { |
| | | if (StrUtil.isNotBlank(startMonth) && StrUtil.isNotBlank(endMonth) |
| | | && YearMonth.parse(startMonth).isAfter(YearMonth.parse(endMonth))) { |
| | | throw new ErrorException("开始月份不能晚于结束月份"); |
| | | } |
| | | if (StrUtil.isNotBlank(startMonth)) { |
| | | wrapper.ge("sample_date", YearMonth.parse(startMonth).atDay(1)); |
| | | } |
| | |
| | | throw new ErrorException("送样时间筛选格式不正确,应为 yyyy-MM"); |
| | | } |
| | | } |
| | | return baseMapper.selectInsOrderRates(page, wrapper); |
| | | return wrapper; |
| | | } |
| | | |
| | | @Override |