From 49500246d5ef7b3f5dfdbeda33d65df0ba507f2f Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期五, 02 八月 2024 09:53:12 +0800
Subject: [PATCH] 问题反馈回复 增加、删除、修改、分页查询
---
pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/QueryVo.java | 4
pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/FeedbackCtrl.java | 78 +++++++++++++++
pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/FeedbackSv.java | 39 +++++++
pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/ReplyQueryVo.java | 43 ++++++++
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoOp/OpeFeedbackReply.java | 4
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoOp/OpeFeedbackReplyMapper.java | 16 ++
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voOp/VofeedbackReply.java | 40 ++++++++
pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeFeedbackReplyMapper.xml | 48 +++++++++
8 files changed, 262 insertions(+), 10 deletions(-)
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoOp/OpeFeedbackReplyMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoOp/OpeFeedbackReplyMapper.java
index af187c6..56fc68d 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoOp/OpeFeedbackReplyMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoOp/OpeFeedbackReplyMapper.java
@@ -2,7 +2,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoOp.OpeFeedbackReply;
-import com.dy.pipIrrGlobal.voOp.Vofeedback;
+import com.dy.pipIrrGlobal.voOp.VofeedbackReply;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@@ -28,7 +28,17 @@
int updateByPrimaryKey(OpeFeedbackReply record);
-// Long getRecordCount(Map<String, Object> params);
+ /**
+ * 鑾峰彇鍙嶉鍥炲鏁伴噺
+ * @param params
+ * @return
+ */
+ Long getRecordCount(Map<String, Object> params);
-// List<Vofeedback> getFeedbackReplys(Map<String, Object> params);
+ /**
+ * 鑾峰彇鍙嶉鍥炲
+ * @param params
+ * @return
+ */
+ List<VofeedbackReply> getFeedbackReply(Map<String, Object> params);
}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoOp/OpeFeedbackReply.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoOp/OpeFeedbackReply.java
index 375dc02..e970e7b 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoOp/OpeFeedbackReply.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoOp/OpeFeedbackReply.java
@@ -9,6 +9,7 @@
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.*;
+import org.apache.logging.log4j.core.config.plugins.validation.constraints.NotBlank;
import java.util.Date;
@@ -45,7 +46,7 @@
/**
* 鍥炲鍐呭
*/
- @NotNull
+ @NotBlank
private String replyContent;
/**
@@ -57,6 +58,7 @@
* 鍥炲浜篒D
*/
@NotNull
+ @JSONField(serializeUsing= ObjectWriterImplToString.class)
private Long replierId;
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voOp/VofeedbackReply.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voOp/VofeedbackReply.java
new file mode 100644
index 0000000..bc10947
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voOp/VofeedbackReply.java
@@ -0,0 +1,40 @@
+package com.dy.pipIrrGlobal.voOp;
+
+import com.dy.common.po.BaseEntity;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author :WuZeYu
+ * @Date :2024/8/1 20:07
+ * @LastEditTime :2024/8/1 20:07
+ * @Description
+ */
+@Data
+public class VofeedbackReply implements BaseEntity {
+ private static final long serialVersionUID = 202408012009001L;
+ /**
+ * 涓婚敭id
+ */
+ private String id;
+ /**
+ * 鍙嶉缂栧彿
+ */
+ private String feedbackId;
+
+ /**
+ * 鍥炲鍐呭
+ */
+ private String replyContent;
+
+ /**
+ * 鍥炲鏃堕棿
+ */
+ private Date replyTime;
+
+ /**
+ * 鍥炲浜篒D
+ */
+ private String replierId;
+}
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeFeedbackReplyMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeFeedbackReplyMapper.xml
index 1b5bbf5..9200aaf 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeFeedbackReplyMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeFeedbackReplyMapper.xml
@@ -99,4 +99,52 @@
replier_id = #{replierId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
+
+ <select id="getRecordCount" resultType="java.lang.Long">
+ select count(*) from ope_feedback_reply ofbr
+ inner join ope_feedback ofb on ofbr.feedback_id = ofb.id
+ <where>
+ <if test="feedbackId != null and feedbackId != '' ">
+ and ofbr.feedback_id = #{feedbackId,jdbcType=BIGINT}
+ </if>
+ <if test="replierId != null and replierId != '' ">
+ and ofbr.replier_id = #{replierId,jdbcType=BIGINT}
+ </if>
+ <if test="replyTimeStart != null">
+ and ofbr.reply_time >= #{replyTimeStart}
+ </if>
+ <if test="replyTimeStop != null">
+ and ofbr.reply_time <= #{replyTimeStop}
+ </if>
+ </where>
+ </select>
+
+ <select id="getFeedbackReply" resultType="com.dy.pipIrrGlobal.voOp.VofeedbackReply">
+ select
+ CAST(ofbr.id as char) AS id,
+ CAST(ofbr.feedback_id as char) AS feedbackId,
+ ofbr.reply_content as replyContent,
+ ofbr.reply_time as replyTime,
+ CAST(ofbr.replier_id as char) AS replierId
+ from ope_feedback_reply ofbr
+ inner join ope_feedback ofb on ofbr.feedback_id = ofb.id
+ <where>
+ <if test="feedbackId != null and feedbackId != '' ">
+ and ofbr.feedback_id = #{feedbackId,jdbcType=BIGINT}
+ </if>
+ <if test="replierId != null and replierId != '' ">
+ and ofbr.replier_id = #{replierId,jdbcType=BIGINT}
+ </if>
+ <if test="replyTimeStart != null">
+ and ofbr.reply_time >= #{replyTimeStart}
+ </if>
+ <if test="replyTimeStop != null">
+ and ofbr.reply_time <= #{replyTimeStop}
+ </if>
+ </where>
+ order by ofbr.id desc
+ <if test="pageCurr != null and pageSize != null">
+ LIMIT ${(pageCurr-1)*pageSize}, ${pageSize}
+ </if>
+ </select>
</mapper>
\ No newline at end of file
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());
+ }
+ }
}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/FeedbackSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/FeedbackSv.java
index 6ebe08b..ccc704d 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/FeedbackSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/FeedbackSv.java
@@ -6,6 +6,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 lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
@@ -83,7 +84,7 @@
}
/**
- * 闂鍙嶉鍥炲
+ * 娣诲姞闂鍙嶉鍥炲
* @param reply
* @return
*/
@@ -91,4 +92,40 @@
reply.setReplyTime(new Date());
return opeFeedbackReplyMapper.insertSelective(reply);
}
+
+ /**
+ * 淇敼闂鍙嶉鍥炲
+ * @param reply
+ * @return
+ */
+ public int updateReply(OpeFeedbackReply reply) {
+ reply.setReplyTime(new Date());
+ return opeFeedbackReplyMapper.updateByPrimaryKeySelective(reply);
+ }
+
+ /**
+ * 鍒犻櫎闂鍙嶉鍥炲
+ * @param id
+ * @return
+ */
+ public Integer deleteReply(Long id) {
+ return opeFeedbackReplyMapper.deleteByPrimaryKey(id);
+ }
+
+ /**
+ * 鑾峰彇鍙嶉鍥炲
+ * @param qo
+ * @return
+ */
+ public QueryResultVo<List<VofeedbackReply>> getFeedbackReply(ReplyQueryVo qo) {
+ Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo);
+ Long itemTotal = opeFeedbackReplyMapper.getRecordCount(params);
+
+ QueryResultVo<List<VofeedbackReply>> rsVo = new QueryResultVo<>();
+ rsVo.pageSize = qo.pageSize;
+ rsVo.pageCurr = qo.pageCurr;
+ rsVo.calculateAndSet(itemTotal, params);
+ rsVo.obj = opeFeedbackReplyMapper.getFeedbackReply(params);
+ return rsVo;
+ }
}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/QueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/QueryVo.java
index 3622ecd..d12a8f8 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/QueryVo.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/QueryVo.java
@@ -34,12 +34,12 @@
/**
* 鏌ヨ寮�濮嬫棩鏈�
*/
- @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
private Date timeStart;
/**
* 鏌ヨ缁撴潫鏃ユ湡
*/
- @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
private Date timeStop;
}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/ReplyQueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/ReplyQueryVo.java
new file mode 100644
index 0000000..c9b887d
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/ReplyQueryVo.java
@@ -0,0 +1,43 @@
+package com.dy.pipIrrOperation.feedback;
+
+import com.dy.common.webUtil.QueryConditionVo;
+import lombok.*;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * @author :WuZeYu
+ * @Date :2024/8/1 19:40
+ * @LastEditTime :2024/8/1 19:40
+ * @Description
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@ToString(callSuper = true)
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class ReplyQueryVo extends QueryConditionVo {
+ /**
+ * 鍙嶉缂栧彿
+ */
+ private String feedbackId;
+
+ /**
+ * 鍥炲浜�
+ */
+ private String replierId;
+ /**
+ * 鍥炲鏃堕棿寮�濮嬫棩鏈�
+ */
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private Date replyTimeStart;
+
+ /**
+ * 鍥炲鏃堕棿缁撴潫鏃ユ湡
+ */
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private Date replyTimeStop;
+
+}
--
Gitblit v1.8.0