From 183ad4afa2f8038271907270e5406c606fa8b075 Mon Sep 17 00:00:00 2001 From: wuzeyu <1223318623@qq.com> Date: 星期三, 07 八月 2024 10:12:00 +0800 Subject: [PATCH] 指定时间段内用水量超过指定值的取水口,修改上一次提交查询为查累积流量 --- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java | 170 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 147 insertions(+), 23 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java index 01bd5ae..f0fba29 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java @@ -4,20 +4,28 @@ import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; +import com.dy.pipIrrGlobal.voSt.*; +import com.dy.pipIrrStatistics.intake.qo.*; +import com.dy.pipIrrGlobal.voSt.VoBatteryVolt; import com.dy.pipIrrGlobal.voSt.VoCumulativeFlow; import com.dy.pipIrrGlobal.voSt.VoIntake; +import com.dy.pipIrrGlobal.voSt.VoSignalIntensity; +import com.dy.pipIrrStatistics.intake.qo.BatteryVoltQO; import com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount; import com.dy.pipIrrStatistics.intake.qo.CumulativeFlowQO; -import com.dy.pipIrrStatistics.intake.qo.IntakeQO; -import com.dy.pipIrrStatistics.intake.qo.IntakeValueQO; +import com.dy.pipIrrStatistics.intake.qo.SignalIntensityQO; +import com.dy.pipIrrStatistics.intake.qo.IntakeCountValueQO; import com.dy.pipIrrStatistics.result.StatisticlResultCode; +import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; +import java.util.Objects; /** * @author ZhuBaoMin @@ -40,13 +48,13 @@ */ @GetMapping(path = "/getNotOnlineIntakes") @SsoAop() - public BaseResponse<QueryResultVo<List<VoIntake>>> getNotOnlineIntakes(IntakeQO qo) { + public BaseResponse<QueryResultVo<List<VoIntake>>> getNotOnlineIntakes(@Valid CommonQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + try { - QueryResultVo<List<VoIntake>> res = intakeSv.getNotOnlineIntakes(qo); - if(res.itemTotal == 0) { - return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.NO_RECORDS.getMessage()); - } - return BaseResponseUtils.buildSuccess(res); + return BaseResponseUtils.buildSuccess(intakeSv.getNotOnlineIntakes(qo)); } catch (Exception e) { log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e); return BaseResponseUtils.buildException(e.getMessage()) ; @@ -60,13 +68,12 @@ */ @GetMapping(path = "/getLargeFlowIntakes") @SsoAop() - public BaseResponse<QueryResultVo<List<VoCumulativeFlow>>> getLargeFlowIntakes(CumulativeFlowQO qo) { + public BaseResponse<QueryResultVo<List<VoCumulativeFlow>>> getLargeFlowIntakes(@Valid CumulativeFlowQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } try { - QueryResultVo<List<VoCumulativeFlow>> res = intakeSv.getLargeFlowIntakes(qo); - if(res.itemTotal == 0) { - return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.NO_RECORDS.getMessage()); - } - return BaseResponseUtils.buildSuccess(res); + return BaseResponseUtils.buildSuccess(intakeSv.getLargeFlowIntakes(qo)); } catch (Exception e) { log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e); return BaseResponseUtils.buildException(e.getMessage()) ; @@ -80,13 +87,88 @@ */ @GetMapping(path = "/getSmallFlowIntakes") @SsoAop() - public BaseResponse<QueryResultVo<List<VoCumulativeFlow>>> getSmallFlowIntakes(CumulativeFlowQO qo) { + public BaseResponse<QueryResultVo<List<VoCumulativeFlow>>> getSmallFlowIntakes(@Valid CumulativeFlowQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } try { - QueryResultVo<List<VoCumulativeFlow>> res = intakeSv.getSmallFlowIntakes(qo); - if(res.itemTotal == 0) { - return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.NO_RECORDS.getMessage()); - } - return BaseResponseUtils.buildSuccess(res); + return BaseResponseUtils.buildSuccess(intakeSv.getSmallFlowIntakes(qo)); + } catch (Exception e) { + log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + /** + * 鑾峰彇娆犲帇鍙栨按鍙� + * @param qo + * @return + */ + @GetMapping(path = "/getUnderVoltIntakes") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoBatteryVolt>>> getUnderVoltIntakes(@Valid BatteryVoltQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + try { + return BaseResponseUtils.buildSuccess(intakeSv.getUnderVoltIntakes(qo)); + } catch (Exception e) { + log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + /** + * 鑾峰彇鎸囧畾淇″彿寮哄害鐨勫彇姘村彛 + * @param qo + * @return + */ + @GetMapping(path = "/getSpecifiedSignalIntakes") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoSignalIntensity>>> getSpecifiedSignalIntakes(@Valid SignalIntensityQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + try { + return BaseResponseUtils.buildSuccess(intakeSv.getSpecifiedSignalIntakes(qo)); + } catch (Exception e) { + log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + /** + * 鏍规嵁寮�闃�绫诲瀷鑾峰彇鎿嶄綔娆℃暟 + * @param qo + * @return + */ + @GetMapping(path = "/getCountByOpenType") + @SsoAop() + public BaseResponse<QueryResultVo<VoCountOfOpenType>> getCountByOpenType(@Valid OpenTypeQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + try { + return BaseResponseUtils.buildSuccess(intakeSv.getCountByOpenType(qo)); + } catch (Exception e) { + log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + /** + * 鏍规嵁鍏抽榾绫诲瀷鑾峰彇鎿嶄綔娆℃暟 + * @param qo + * @return + */ + @GetMapping(path = "/getCountByCloseType") + @SsoAop() + public BaseResponse<QueryResultVo<VoCountOfCloseType>> getCountByCloseType(@Valid CloseTypeQo qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + try { + return BaseResponseUtils.buildSuccess(intakeSv.getCountByCloseType(qo)); } catch (Exception e) { log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e); return BaseResponseUtils.buildException(e.getMessage()) ; @@ -101,7 +183,7 @@ */ @GetMapping(path = "/getNeverOpenValveIntakes") @SsoAop() - public BaseResponse<QueryResultVo<List<VoIntake>>> getNeverOpenValveIntakes(IntakeQO qo) { + public BaseResponse<QueryResultVo<List<VoIntake>>> getNeverOpenValveIntakes(CommonQO qo) { try { QueryResultVo<List<VoIntake>> res = intakeSv.getNeverOpenValveIntakes(qo); if(res.itemTotal == 0) { @@ -122,7 +204,7 @@ */ @GetMapping(path = "/getOpenValveGtIntakes") @SsoAop() - public BaseResponse<QueryResultVo<List<VoIntakeOpenCount>>> getOpenValveGtIntakes(IntakeValueQO qo) { + public BaseResponse<QueryResultVo<List<VoIntakeOpenCount>>> getOpenValveGtIntakes(IntakeCountValueQO qo) { try { QueryResultVo<List<VoIntakeOpenCount>> res = intakeSv.getOpenValveGtIntakes(qo); if(res.itemTotal == 0) { @@ -143,7 +225,7 @@ */ @GetMapping(path = "/getOpenValveLtIntakes") @SsoAop() - public BaseResponse<QueryResultVo<List<VoIntakeOpenCount>>> getOpenValveLtIntakes(IntakeValueQO qo) { + public BaseResponse<QueryResultVo<List<VoIntakeOpenCount>>> getOpenValveLtIntakes(IntakeCountValueQO qo) { try { QueryResultVo<List<VoIntakeOpenCount>> res = intakeSv.getOpenValveLtIntakes(qo); if(res.itemTotal == 0) { @@ -155,4 +237,46 @@ return BaseResponseUtils.buildException(e.getMessage()) ; } } + + + /** + * 鎸囧畾鏃堕棿娈靛唴绱Н娴侀噺(瀹氭椂鎶ラ噷鐨勭疮绉祦閲�)瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙� + * @param + * @return + */ + @GetMapping(path = "/getTotalFlowGtValueIntakes") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoIntakeAccumulateAmount>>> getTotalFlowGtValueIntakes(IntakeAmountValueQO qo) { + try { + QueryResultVo<List<VoIntakeAccumulateAmount>> res = intakeSv.getTotalFlowGtValueIntakes(qo); + if(res.itemTotal == 0) { + return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.NO_RECORDS.getMessage()); + } + return BaseResponseUtils.buildSuccess(res); + } catch (Exception e) { + log.error("鑾峰彇璁板綍寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + + /** + * 鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忚秴杩囨寚瀹氬�肩殑鍙栨按鍙� + * @param + * @return + */ + @GetMapping(path = "/getUseWaterGtValueIntakes") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoIntakeAccumulateAmount>>> getUseWaterGtValueIntakes(IntakeAmountValueQO qo) { + try { + QueryResultVo<List<VoIntakeAccumulateAmount>> res = intakeSv.getUseWaterGtValueIntakes(qo); + if(res.itemTotal == 0) { + return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.NO_RECORDS.getMessage()); + } + return BaseResponseUtils.buildSuccess(res); + } catch (Exception e) { + log.error("鑾峰彇璁板綍寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } } -- Gitblit v1.8.0