From bd448b121e9b7636daa4ec1d1629c3c2615fb2b9 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期六, 03 八月 2024 11:36:03 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/FeedbackCtrl.java | 97 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 97 insertions(+), 0 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 dcc040c..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 @@ -5,7 +5,9 @@ import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; 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; @@ -132,4 +134,99 @@ return BaseResponseUtils.buildException(e.getMessage()); } } + + + /** + * 娣诲姞闂鍙嶉鍥炲 + * @param reply + * @param bindingResult + * @return + */ + @PostMapping(path = "addReply", consumes = MediaType.APPLICATION_JSON_VALUE) + @Transactional(rollbackFor = Exception.class) + @SsoAop + public BaseResponse<Boolean> addReply(@RequestBody @Valid OpeFeedbackReply reply, @Parameter(hidden = true) BindingResult bindingResult){ + if (bindingResult != null && bindingResult.hasErrors()) { + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + 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