|  |  |  | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.daoRm.RmClientAmountDayLastMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveHistoryMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.daoSe.SeCardOperateMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.daoSe.SeClientMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSt.*; | 
|---|
|  |  |  | import com.dy.pipIrrStatistics.card.IcCardqo.CommonQO; | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | private RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SeCardOperateMapper seCardOperateMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private RmClientAmountDayLastMapper rmClientAmountDayLastMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SeClientMapper seClientMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取指定时间段内开阀次数超过指定值的农户 | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|