From d24d060892415caeeead78c9dddd45ab3d81e3c7 Mon Sep 17 00:00:00 2001 From: wuzeyu <1223318623@qq.com> Date: 星期五, 11 十月 2024 14:25:36 +0800 Subject: [PATCH] 实现接口 指定时间段内用水量低于指定值的农户 指定时间段内消费金额低于指定值的农户 指定时间段内用水时长低于指定值的农户 --- pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/FeedbackCtrl.java | 78 +++++++++++++++++++++++++++++++++++++- 1 files changed, 75 insertions(+), 3 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/FeedbackCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/FeedbackCtrl.java index 9dd9134..7308978 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/FeedbackCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/FeedbackCtrl.java @@ -7,6 +7,7 @@ import com.dy.pipIrrGlobal.pojoOp.OpeFeedback; import com.dy.pipIrrGlobal.pojoOp.OpeFeedbackReply; import com.dy.pipIrrGlobal.voOp.Vofeedback; +import com.dy.pipIrrGlobal.voOp.VofeedbackReply; import io.swagger.v3.oas.annotations.Parameter; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -148,13 +149,84 @@ if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } - if (reply.getFeedbackId() == null){ - return BaseResponseUtils.buildFail("璇蜂紶鍏ュ弽棣堢紪鍙穒d"); - } Integer rec = Optional.ofNullable(feedbackSv.addReply(reply)).orElse(0); if (rec == 0) { return BaseResponseUtils.buildFail("娣诲姞鍥炲澶辫触"); } return BaseResponseUtils.buildSuccess(true); } + + /** + * 淇敼闂鍙嶉鍥炲 + * @param reply + * @param bindingResult + * @return + */ + @PostMapping(path = "updateReply", consumes = MediaType.APPLICATION_JSON_VALUE) + @Transactional(rollbackFor = Exception.class) + @SsoAop() + public BaseResponse<Boolean> updateReply(@RequestBody @Parameter(description = "form琛ㄥ崟json鏁版嵁", required = true) @Valid OpeFeedbackReply reply, @Parameter(hidden = true) BindingResult bindingResult) { + if (bindingResult != null && bindingResult.hasErrors()) { + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + int count ; + try { + count = feedbackSv.updateReply(reply); + } catch (Exception e) { + log.error("淇敼闂鍙嶉鍥炲寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("淇敼鍙嶉鍥炲澶辫触"); + } else { + return BaseResponseUtils.buildSuccess(true); + } + } + + /** + * 鍒犻櫎闂鍙嶉鍥炲 + * @param map + * @return + */ + @PostMapping(path = "deleteReply") + @Transactional(rollbackFor = Exception.class) + @SsoAop() + public BaseResponse<Boolean> deleteReply(@RequestBody Map map) { + if (map == null || map.size() <= 0) { + return BaseResponseUtils.buildFail("璇蜂紶鍏d"); + } + Long id = Long.parseLong(map.get("id").toString()); + try { + Integer recordCount = Optional.ofNullable(feedbackSv.deleteReply(id)).orElse(0); + if (recordCount == 0) { + return BaseResponseUtils.buildFail("鍒犻櫎澶辫触"); + } else { + return BaseResponseUtils.buildSuccess(true); + } + } catch (Exception e) { + log.error("鍒犻櫎寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + + /** + * 鍒嗛〉鏌ヨ闂鍙嶉鍥炲 + * @param qo + * @return + */ + @GetMapping(path = "getFeedbackReply") + @SsoAop() + public BaseResponse<QueryResultVo<List<VofeedbackReply>>> getFeedbackReply(ReplyQueryVo qo) { + try { + QueryResultVo<List<VofeedbackReply>> res = feedbackSv.getFeedbackReply(qo); + if (res == null) { + return BaseResponseUtils.buildFail("鏌ヨ澶辫触"); + } + return BaseResponseUtils.buildSuccess(res); + } catch (Exception e) { + log.error("鏌ヨ寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } } -- Gitblit v1.8.0