From bbb1dbc16f466810d1767c0ec484c3fc2e5cefed Mon Sep 17 00:00:00 2001
From: Administrator <zhubaomin>
Date: 星期五, 02 八月 2024 17:00:38 +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/QueryVo.java      |    4 
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryConditionVo.java                         |   25 ++++
 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/resources/application-global.yml                                         |    2 
 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 +++++++++
 10 files changed, 286 insertions(+), 13 deletions(-)

diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryConditionVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryConditionVo.java
index 62a857a..7bfbf5e 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryConditionVo.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryConditionVo.java
@@ -15,13 +15,34 @@
      */
     @Schema(description = "褰撳墠椤�", requiredMode = Schema.RequiredMode.REQUIRED)
     @NotNull(message = "褰撳墠椤典笉鑳戒负绌�") //涓嶈兘涓虹┖涔熶笉鑳戒负null
-    public Integer pageCurr ;
+    public Integer pageCurr;
 
     /**
      * 姣忛〉鏁版嵁鏉℃暟
      */
     @Schema(description = "姣忛〉璁板綍鏁�", requiredMode = Schema.RequiredMode.REQUIRED)
     @NotNull(message = "姣忛〉璁板綍鏁颁笉鑳戒负绌�") //涓嶈兘涓虹┖涔熶笉鑳戒负null
-    public Integer pageSize ;
+    public Integer pageSize;
 
+    /**
+     * 璁剧疆褰撳墠榛樿绗竴椤�
+     * @return
+     */
+    public Integer getPageCurr() {
+        if (pageCurr == null){
+            return 1;
+        }
+        return pageCurr;
+    }
+
+    /**
+     * 璁剧疆褰撳墠榛樿涓�椤靛崄鏉�
+     * @return
+     */
+    public Integer getPageSize() {
+        if (pageSize == null){
+            return 10;
+        }
+        return pageSize;
+    }
 }
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/application-global.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
index fc10859..3fd34ef 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
@@ -72,7 +72,7 @@
 
 pipIrr:
     global:
-        dev: false   #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse
+        dev: true   #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse
         dsName: ym  #寮�鍙戦樁娈碉紝璁剧疆涓存椂鐨勬暟鎹簱鍚嶇О
     mw:
         webPort: 8070
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 &gt;= #{replyTimeStart}
+      </if>
+      <if test="replyTimeStop != null">
+        and ofbr.reply_time &lt;= #{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 &gt;= #{replyTimeStart}
+      </if>
+      <if test="replyTimeStop != null">
+        and ofbr.reply_time &lt;= #{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