| | |
| | | import com.lunhan.water.common.enums.*; |
| | | import com.lunhan.water.common.model.Tuple; |
| | | import com.lunhan.water.common.util.*; |
| | | import com.lunhan.water.repository.vo.PaymentRecordsVO; |
| | | import org.apache.commons.lang3.BooleanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | public ExecutedResult<PagerResult<RechargeRecordsVO>> search(SearchRechargeRecords search) { |
| | | // 处理创建时间范围-查询参数 |
| | | Tuple<String, String> createTimeRange = ParameterUtil.getTimeRange(search.getCreateTimeRange()); |
| | | if (StringUtil.isNotNullOrEmpty(createTimeRange.getItem1())) { |
| | | search.setCreateTimeStart(LocalDateTimeUtil.getTimeStamp(createTimeRange.getItem1()).getTime()); |
| | | if(search.getDateType()!=null&&search.getDateType()>0){ |
| | | Long beginTime=0L; |
| | | Long endTime=0L; |
| | | switch (search.getDateType()){ |
| | | case 1: |
| | | beginTime=LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.todayStartTime()).getTime(); |
| | | endTime=LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.todayEndTime()).getTime(); |
| | | break; |
| | | case 2: |
| | | beginTime=LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.weekStartTime()).getTime(); |
| | | endTime=LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.weekEndTime()).getTime(); |
| | | break; |
| | | case 3: |
| | | beginTime=LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.monthStartTime()).getTime(); |
| | | endTime=LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.monthEndTime()).getTime(); |
| | | break; |
| | | case 4: |
| | | beginTime=LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.yearStartTime()).getTime(); |
| | | endTime=LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.yearEndTime()).getTime(); |
| | | break; |
| | | } |
| | | if (beginTime>0) { |
| | | search.setCreateTimeStart(beginTime); |
| | | } |
| | | if (endTime>0) { |
| | | search.setCreateTimeEnd(endTime); |
| | | } |
| | | } |
| | | if (StringUtil.isNotNullOrEmpty(createTimeRange.getItem2())) { |
| | | search.setCreateTimeEnd(LocalDateTimeUtil.getTimeStamp(createTimeRange.getItem2()).getTime()); |
| | | } |
| | | |
| | | PagerResult<RechargeRecordsPO> pageList = mapper.search(search); |
| | | List<RechargeRecordsVO> listVo = new ArrayList<>(); |
| | | List<RechargeRecordsPO> list = pageList.getList(); |
| | | if (ListUtil.isNotNullOrEmpty(list)) { |
| | | pageList.setLastId(list.get(list.size() - 1).getId()); |
| | | // 转换vo |
| | | listVo = RechargeRecordsConvert.INSTANCE.toVo(list); |
| | | listVo = CopierUtil.mapTo(list, RechargeRecordsVO.class); |
| | | } |
| | | PagerResult<RechargeRecordsVO> result = new PagerResult<>(pageList.getLimit(), pageList.getPage(), pageList.getTotal(), listVo); |
| | | result.setLastId(pageList.getLastId()); |