|  |  | 
 |  |  | 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; | 
 |  |  | 
 |  |  |             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("请传入id"); | 
 |  |  |         } | 
 |  |  |         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()); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } |