|  |  |  | 
|---|
|  |  |  | import com.dy.common.webUtil.QueryResultVo; | 
|---|
|  |  |  | 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 com.dy.pipIrrStatistics.result.StatisticlResultCode; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Objects; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取指定时间段内用水量低于指定值的农户 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @param bindingResult | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(path = "/getSmallWaterConsumptionClients") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoClient>>> getSmallWaterConsumptionClients(@Valid WaterConsumptionQO qo, BindingResult bindingResult) { | 
|---|
|  |  |  | if(bindingResult != null && bindingResult.hasErrors()){ | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(clientSv.getSmallWaterConsumptionClients(qo)); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("获取记录异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取指定时间段内消费金额超过指定值的农户 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @param bindingResult | 
|---|
|  |  |  | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(clientSv.getLargeAmountSpentClients(qo)); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("获取开卡记录异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取指定时间段内消费金额低于指定值的农户 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @param bindingResult | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(path = "/getSmallAmountSpentClients") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoClient>>> getSmallAmountSpentClients(@Valid AmountSpentQO qo, BindingResult bindingResult) { | 
|---|
|  |  |  | if(bindingResult != null && bindingResult.hasErrors()){ | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(clientSv.getSmallAmountSpentClients(qo)); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("获取记录异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取指定时间段内用水时长低于指定值的农户 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @param bindingResult | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(path = "/getSmallWaterDurationClients") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoClient>>> getSmallWaterDurationClients(@Valid WaterDurationQO qo, BindingResult bindingResult) { | 
|---|
|  |  |  | if(bindingResult != null && bindingResult.hasErrors()){ | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(clientSv.getSmallWaterDurationClients(qo)); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("获取开卡记录异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 统计指定月份各农户各天用水量及消费金额 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | 
|---|
|  |  |  | @GetMapping(path = "/getDayAmountAndMoney") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoDayClient>>> getDayAmountAndMoney(ClientAmountQO qo) { | 
|---|
|  |  |  | if(qo.getYearMonth() == null) { | 
|---|
|  |  |  | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); | 
|---|
|  |  |  | String yearMonth = qo.getYearMonth(); | 
|---|
|  |  |  | if(yearMonth == null) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.YEAR_AND_MONTH_CANNOT_BE_NULL.getMessage()); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | yearMonth = yearMonth + "-01"; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Date date = dateFormat.parse(yearMonth); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.YEAR_OR_MONTH_IS_ERROR.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 指定时间段内开物理卡农户 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 指定时间段内每个农户充值合计(物理卡) | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 最近未充值的农户 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(path = "/getNotRechargeLastClients") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoClient>>> getNotRechargeLastClients(CommonQO qo) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | QueryResultVo<List<VoClient>> res = clientSv.getNotRechargeLastClients(qo); | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(res); | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("获取记录异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取指定时间段农户:充值合计、消费合计、余额 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | //* @param bindingResult | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(path = "/client_usage") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoCardUsage>>> getClientUsages(@Valid CardUsageQO qo, BindingResult bindingResult) { | 
|---|
|  |  |  | if(bindingResult != null && bindingResult.hasErrors()){ | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(clientSv.getClientUsages(qo)); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("获取开卡记录异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|