|  |  |  | 
|---|
|  |  |  | package com.dy.pipIrrStatistics.client; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.dy.common.webUtil.QueryResultVo; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.daoRm.RmClientAmountDayLastMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveHistoryMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.daoSe.SeCardOperateMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSt.VoClient; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSt.VoClientOpenCardCount; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSt.VoClientRechargeTotal; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSt.VoICCard; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.daoSe.SeClientMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSt.*; | 
|---|
|  |  |  | import com.dy.pipIrrStatistics.card.IcCardqo.CommonQO; | 
|---|
|  |  |  | import com.dy.pipIrrStatistics.client.qo.AmountSpentQO; | 
|---|
|  |  |  | import com.dy.pipIrrStatistics.client.qo.OpenCountQO; | 
|---|
|  |  |  | import com.dy.pipIrrStatistics.client.qo.WaterConsumptionQO; | 
|---|
|  |  |  | import com.dy.pipIrrStatistics.client.qo.WaterDurationQO; | 
|---|
|  |  |  | import com.dy.pipIrrStatistics.card.qo.CardUsageQO; | 
|---|
|  |  |  | import com.dy.pipIrrStatistics.client.qo.*; | 
|---|
|  |  |  | import com.dy.pipIrrStatistics.intake.qo.ClientAmountQO; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.apache.dubbo.common.utils.PojoUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.text.ParseException; | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | import java.time.LocalDate; | 
|---|
|  |  |  | import java.time.LocalDateTime; | 
|---|
|  |  |  | import java.util.Calendar; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | import java.util.Optional; | 
|---|
|  |  |  | 
|---|
|  |  |  | private RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SeCardOperateMapper seCardOperateMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private RmClientAmountDayLastMapper rmClientAmountDayLastMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SeClientMapper seClientMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取指定时间段内开阀次数超过指定值的农户 | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public QueryResultVo<List<VoClient>> getLargeOpenCountClients(OpenCountQO qo) { | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 补齐起止时间,如果开始时间为空,则默认为当前日期 | 
|---|
|  |  |  | * 补齐起止时间 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | String timeStart = qo.getTimeStart(); | 
|---|
|  |  |  | String timeStop = qo.getTimeStop(); | 
|---|
|  |  |  | if(timeStart != null) { | 
|---|
|  |  |  | if(timeStart != null && timeStart != "") { | 
|---|
|  |  |  | timeStart = timeStart + " 00:00:00"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | timeStart = LocalDate.now() + " 00:00:00"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(timeStop != null) { | 
|---|
|  |  |  | if(timeStop != null && timeStop != "") { | 
|---|
|  |  |  | timeStop = timeStop + " 23:59:59"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | qo.setTimeStart(timeStart); | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public QueryResultVo<List<VoClient>> getSmallOpenCountClients(OpenCountQO qo) { | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 补齐起止时间,如果开始时间为空,则默认为当前日期 | 
|---|
|  |  |  | * 补齐起止时间 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | String timeStart = qo.getTimeStart(); | 
|---|
|  |  |  | String timeStop = qo.getTimeStop(); | 
|---|
|  |  |  | if(timeStart != null) { | 
|---|
|  |  |  | if(timeStart != null && timeStart != "") { | 
|---|
|  |  |  | timeStart = timeStart + " 00:00:00"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | timeStart = LocalDate.now() + " 00:00:00"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(timeStop != null) { | 
|---|
|  |  |  | if(timeStop != null && timeStop != "") { | 
|---|
|  |  |  | timeStop = timeStop + " 23:59:59"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | qo.setTimeStart(timeStart); | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public QueryResultVo<List<VoClient>> getLargeWaterConsumptionClients(WaterConsumptionQO qo) { | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 补齐起止时间,如果开始时间为空,则默认为当前日期 | 
|---|
|  |  |  | * 补齐起止时间 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | String timeStart = qo.getTimeStart(); | 
|---|
|  |  |  | String timeStop = qo.getTimeStop(); | 
|---|
|  |  |  | if(timeStart != null) { | 
|---|
|  |  |  | if(timeStart != null && timeStart != "") { | 
|---|
|  |  |  | timeStart = timeStart + " 00:00:00"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | timeStart = LocalDate.now() + " 00:00:00"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(timeStop != null) { | 
|---|
|  |  |  | if(timeStop != null && timeStop != "") { | 
|---|
|  |  |  | timeStop = timeStop + " 23:59:59"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | qo.setTimeStart(timeStart); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取指定时间段内用水量低于指定值的农户 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public QueryResultVo<List<VoClient>> getSmallWaterConsumptionClients(WaterConsumptionQO qo) { | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 补齐起止时间 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | String timeStart = qo.getTimeStart(); | 
|---|
|  |  |  | String timeStop = qo.getTimeStop(); | 
|---|
|  |  |  | if(timeStart != null && timeStart != "") { | 
|---|
|  |  |  | timeStart = timeStart + " 00:00:00"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(timeStop != null && timeStop != "") { | 
|---|
|  |  |  | timeStop = timeStop + " 23:59:59"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | qo.setTimeStart(timeStart); | 
|---|
|  |  |  | qo.setTimeStop(timeStop); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 生成查询参数 | 
|---|
|  |  |  | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 获取符合条件的记录数 | 
|---|
|  |  |  | Long itemTotal = Optional.ofNullable(rmOpenCloseValveHistoryMapper.getSmallWaterConsumptionClientsCount(params)).orElse(0L); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.pageSize = qo.pageSize ; | 
|---|
|  |  |  | rsVo.pageCurr = qo.pageCurr ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.calculateAndSet(itemTotal, params); | 
|---|
|  |  |  | rsVo.obj = rmOpenCloseValveHistoryMapper.getSmallWaterConsumptionClients(params); | 
|---|
|  |  |  | return rsVo ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取指定时间段内消费金额超过指定值的农户 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | String timeStart = qo.getTimeStart(); | 
|---|
|  |  |  | String timeStop = qo.getTimeStop(); | 
|---|
|  |  |  | if(timeStart != null) { | 
|---|
|  |  |  | if(timeStart != null && timeStart != "") { | 
|---|
|  |  |  | timeStart = timeStart + " 00:00:00"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | timeStart = LocalDate.now() + " 00:00:00"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(timeStop != null) { | 
|---|
|  |  |  | if(timeStop != null && timeStop != "") { | 
|---|
|  |  |  | timeStop = timeStop + " 23:59:59"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | qo.setTimeStart(timeStart); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取指定时间段内消费金额低于指定值的农户 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public QueryResultVo<List<VoClient>> getSmallAmountSpentClients(AmountSpentQO qo) { | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 补齐起止时间,如果开始时间为空,则默认为当前日期 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | String timeStart = qo.getTimeStart(); | 
|---|
|  |  |  | String timeStop = qo.getTimeStop(); | 
|---|
|  |  |  | if(timeStart != null && timeStart != "") { | 
|---|
|  |  |  | timeStart = timeStart + " 00:00:00"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(timeStop != null && timeStop != "") { | 
|---|
|  |  |  | timeStop = timeStop + " 23:59:59"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | qo.setTimeStart(timeStart); | 
|---|
|  |  |  | qo.setTimeStop(timeStop); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 生成查询参数 | 
|---|
|  |  |  | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 获取符合条件的记录数 | 
|---|
|  |  |  | Long itemTotal = Optional.ofNullable(rmOpenCloseValveHistoryMapper.getSmallAmountSpentClientsCount(params)).orElse(0L); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.pageSize = qo.pageSize ; | 
|---|
|  |  |  | rsVo.pageCurr = qo.pageCurr ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.calculateAndSet(itemTotal, params); | 
|---|
|  |  |  | rsVo.obj = rmOpenCloseValveHistoryMapper.getSmallAmountSpentClients(params); | 
|---|
|  |  |  | return rsVo ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取指定时间段内用水时长超过指定值的农户 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | String timeStart = qo.getTimeStart(); | 
|---|
|  |  |  | String timeStop = qo.getTimeStop(); | 
|---|
|  |  |  | if(timeStart != null) { | 
|---|
|  |  |  | if(timeStart != null && timeStart != "") { | 
|---|
|  |  |  | timeStart = timeStart + " 00:00:00"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | timeStart = LocalDate.now() + " 00:00:00"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(timeStop != null) { | 
|---|
|  |  |  | if(timeStop != null && timeStop != "") { | 
|---|
|  |  |  | timeStop = timeStop + " 23:59:59"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | qo.setTimeStart(timeStart); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.calculateAndSet(itemTotal, params); | 
|---|
|  |  |  | rsVo.obj = rmOpenCloseValveHistoryMapper.getLargeWaterDurationClients(params); | 
|---|
|  |  |  | return rsVo ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取指定时间段内用水时长低于指定值的农户 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public QueryResultVo<List<VoClient>> getSmallWaterDurationClients(WaterDurationQO qo) { | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 补齐起止时间,如果开始时间为空,则默认为当前日期 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | String timeStart = qo.getTimeStart(); | 
|---|
|  |  |  | String timeStop = qo.getTimeStop(); | 
|---|
|  |  |  | if(timeStart != null && timeStart != "") { | 
|---|
|  |  |  | timeStart = timeStart + " 00:00:00"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(timeStop != null && timeStop != "") { | 
|---|
|  |  |  | timeStop = timeStop + " 23:59:59"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | qo.setTimeStart(timeStart); | 
|---|
|  |  |  | qo.setTimeStop(timeStop); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 生成查询参数 | 
|---|
|  |  |  | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 获取符合条件的记录数 | 
|---|
|  |  |  | Long itemTotal = Optional.ofNullable(rmOpenCloseValveHistoryMapper.getSmallWaterDurationClientsCount(params)).orElse(0L); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.pageSize = qo.pageSize ; | 
|---|
|  |  |  | rsVo.pageCurr = qo.pageCurr ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.calculateAndSet(itemTotal, params); | 
|---|
|  |  |  | rsVo.obj = rmOpenCloseValveHistoryMapper.getSmallWaterDurationClients(params); | 
|---|
|  |  |  | return rsVo ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | rsVo.obj = seCardOperateMapper.getRechargeTotalClients(params); | 
|---|
|  |  |  | return rsVo ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 指定时间段内物理卡充值金额超过指定值的农户 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public QueryResultVo<List<VoClientRechargeTotal>> getRechargeTotalGtValueClients(RechargeTotalGtValueQo qo) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String timeStart = qo.getTimeStart(); | 
|---|
|  |  |  | String timeStop = qo.getTimeStop(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (timeStart != null && timeStart != ""){ | 
|---|
|  |  |  | timeStart = timeStart + " 00:00:00"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | timeStart = LocalDate.now() + " 00:00:00"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (timeStop != null && timeStop != ""){ | 
|---|
|  |  |  | timeStop = timeStop + " 23:59:59"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | timeStop = LocalDateTime.now().toString(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | qo.setTimeStart(timeStart); | 
|---|
|  |  |  | qo.setTimeStop(timeStop); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (qo.getValue() == null || qo.getValue() < 0){ | 
|---|
|  |  |  | qo.setValue(0.0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); | 
|---|
|  |  |  | Long itemTotal = seCardOperateMapper.getRechargeTotalGtValueClientsCount(params); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | QueryResultVo<List<VoClientRechargeTotal>> rsVo = new QueryResultVo<>() ; | 
|---|
|  |  |  | rsVo.pageSize = qo.pageSize ; | 
|---|
|  |  |  | rsVo.pageCurr = qo.pageCurr ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.calculateAndSet(itemTotal, params); | 
|---|
|  |  |  | rsVo.obj = seCardOperateMapper.getRechargeTotalGtValueClients(params); | 
|---|
|  |  |  | return rsVo ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 统计指定月份各农户各天用水量及消费金额 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public QueryResultVo<List<VoDayClient>> getDayAmountAndMoney(ClientAmountQO qo) throws ParseException { | 
|---|
|  |  |  | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); | 
|---|
|  |  |  | String yearMonth = qo.getYearMonth(); | 
|---|
|  |  |  | yearMonth = yearMonth + "-01"; | 
|---|
|  |  |  | yearMonth = dateFormat.format(dateFormat.parse(yearMonth)); | 
|---|
|  |  |  | Integer year = Integer.parseInt(yearMonth.substring(0,4)); | 
|---|
|  |  |  | Integer month = Integer.parseInt(yearMonth.substring(5,7)); | 
|---|
|  |  |  | qo.setYear(year); | 
|---|
|  |  |  | qo.setMonth(month); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 生成查询参数 | 
|---|
|  |  |  | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 获取符合条件的记录数 | 
|---|
|  |  |  | Long itemTotal = Optional.ofNullable(rmClientAmountDayLastMapper.getDayAmountAndMoneyCount(params)).orElse(0L); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | QueryResultVo<List<VoDayClient>> rsVo = new QueryResultVo<>() ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.pageSize = qo.pageSize ; | 
|---|
|  |  |  | rsVo.pageCurr = qo.pageCurr ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.calculateAndSet(itemTotal, params); | 
|---|
|  |  |  | rsVo.obj = rmClientAmountDayLastMapper.getDayAmountAndMoney(params); | 
|---|
|  |  |  | return rsVo ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 统计指定年份各农户各月用水量及消费金额 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public QueryResultVo<List<VoMonthClient>> getMonthAmountAndMoney(ClientAmountQO qo) { | 
|---|
|  |  |  | Calendar calendar = Calendar.getInstance(); | 
|---|
|  |  |  | Integer year = Optional.ofNullable(qo.getYear()).orElse(calendar.get(Calendar.YEAR)); | 
|---|
|  |  |  | qo.setYear(year); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 生成查询参数 | 
|---|
|  |  |  | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 获取符合条件的记录数 | 
|---|
|  |  |  | Long itemTotal = Optional.ofNullable(rmClientAmountDayLastMapper.getMonthAmountAndMoneyCount(params)).orElse(0L); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | QueryResultVo<List<VoMonthClient>> rsVo = new QueryResultVo<>() ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.pageSize = qo.pageSize ; | 
|---|
|  |  |  | rsVo.pageCurr = qo.pageCurr ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.calculateAndSet(itemTotal, params); | 
|---|
|  |  |  | rsVo.obj = rmClientAmountDayLastMapper.getMonthAmountAndMoney(params); | 
|---|
|  |  |  | return rsVo ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 最近未充值的农户 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public QueryResultVo<List<VoClient>> getNotRechargeLastClients(CommonQO qo) { | 
|---|
|  |  |  | String timeStart = qo.getTimeStart(); | 
|---|
|  |  |  | if (timeStart != null && timeStart != ""){ | 
|---|
|  |  |  | timeStart = timeStart + " 00:00:00"; | 
|---|
|  |  |  | qo.setTimeStart(timeStart); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 生成查询参数 | 
|---|
|  |  |  | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 获取符合条件的记录数 | 
|---|
|  |  |  | Long itemTotal = Optional.ofNullable(rmClientAmountDayLastMapper.getNotRechargeLastClientsCount(params)).orElse(0L); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.pageSize = qo.pageSize ; | 
|---|
|  |  |  | rsVo.pageCurr = qo.pageCurr ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.calculateAndSet(itemTotal, params); | 
|---|
|  |  |  | rsVo.obj = rmClientAmountDayLastMapper.getNotRechargeLastClients(params); | 
|---|
|  |  |  | return rsVo ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取指定时间段农户:充值合计、消费合计、余额 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public QueryResultVo<List<VoCardUsage>> getClientUsages(CardUsageQO qo) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String timeStart = qo.getTimeStart(); | 
|---|
|  |  |  | String timeStop = qo.getTimeStop(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (timeStart != null && timeStart != ""){ | 
|---|
|  |  |  | timeStart = timeStart + " 00:00:00"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | timeStart = LocalDateTime.now().minusYears(1).toString(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (timeStop != null && timeStop != ""){ | 
|---|
|  |  |  | timeStop = timeStop + " 23:59:59"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | timeStop = LocalDateTime.now().toString(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | qo.setTimeStart(timeStart); | 
|---|
|  |  |  | qo.setTimeStop(timeStop); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); | 
|---|
|  |  |  | // 获取符合条件的记录数 | 
|---|
|  |  |  | Long itemTotal = Optional.ofNullable(seClientMapper.getClientUsagesCount(params)).orElse(0L); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | QueryResultVo<List<VoCardUsage>> rsVo = new QueryResultVo<>() ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.pageSize = qo.pageSize ; | 
|---|
|  |  |  | rsVo.pageCurr = qo.pageCurr ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.calculateAndSet(itemTotal, params); | 
|---|
|  |  |  | rsVo.obj = seClientMapper.getClientUsages(params); | 
|---|
|  |  |  | return rsVo ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|