From 7f5b61a32aa6687eac4cebb4705ced19145dd692 Mon Sep 17 00:00:00 2001
From: Administrator <zhubaomin>
Date: 星期三, 03 七月 2024 13:41:53 +0800
Subject: [PATCH] 2024-07-03 朱宝民 获取充值记录接口添加返回值

---
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/qo/QoCommand.java |   40 ++++++++++
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml                         |    5 +
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoRecharge.java                    |   14 +++
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml                      |   48 ++++++++++-
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java    |   36 +++++++++
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java       |   13 +++
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandCtrl.java  |   43 ++++++++++
 7 files changed, 190 insertions(+), 9 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java
index 243d928..34f45dd 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java
@@ -47,6 +47,17 @@
      */
     VoUnclosedParam getUncloseParam(@Param("onLineMap") String onLineMap, @Param("intakeId")Long intakeId);
 
-    //鑾峰彇鍛戒护鍘嗗彶璁板綍
+    /**
+     * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鍛戒护鏃ュ織鍘嗗彶璁板綍鎬绘暟
+     * @param params
+     * @return
+     */
+    Long getCommandHistoriesCount(Map<?, ?> params);
+
+    /**
+     * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鍛戒护鏃ュ織鍘嗗彶璁板綍
+     * @param params
+     * @return
+     */
     List<VoCommand> getCommandHistories(Map<?, ?> params);
 }
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoRecharge.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoRecharge.java
index 3329dc1..e639cf5 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoRecharge.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoRecharge.java
@@ -1,5 +1,7 @@
 package com.dy.pipIrrGlobal.voSe;
 
+import com.alibaba.fastjson2.annotation.JSONField;
+import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
 import com.dy.common.po.BaseEntity;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
@@ -20,8 +22,14 @@
 public class VoRecharge implements BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    @Schema(title = "ID")
-    private String id;
+    //@Schema(title = "ID")
+    //private String id;
+
+    @JSONField(serializeUsing= ObjectWriterImplToString.class)
+    private Long opeId;
+
+    @JSONField(serializeUsing= ObjectWriterImplToString.class)
+    private Long cardId;
 
     @Schema(title = "鍐滄埛濮撳悕")
     private String clientName;
@@ -33,6 +41,8 @@
     @Schema(title = "鍐滄埛缂栧彿")
     private String clientNum;
 
+    private String address;
+
     /**
      * 姘村崱浣欓
      */
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml
index 203967b..2ef9373 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml
@@ -246,8 +246,29 @@
       LIMIT 0,1
   </select>
 
-  <select id="getCommandHistories" resultType="com.dy.pipIrrGlobal.voRm.VoCommand">
+  <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鍛戒护鏃ュ織鍘嗗彶璁板綍鎬绘暟-->
+  <select id="getCommandHistoriesCount" resultType="java.lang.Long">
+    SELECT
+      COUNT(*) AS recordCount
+    FROM rm_command_history his
+      INNER JOIN pr_intake inta ON inta.id = his.intake_id
+      LEFT JOIN se_client cli ON cli.id = his.operator
+      LEFT JOIN ba_user  user ON user.id = his.operator
+    <where>
+      <if test = "commandName != null and commandName !=''">
+        AND his.command_name LIKE CONCAT('%',#{commandName},'%')
+      </if>
+      <if test = "result != null">
+        AND his.result = #{result}
+      </if>
+      <if test = "timeStart != null and timeStop != null">
+        AND his.send_time BETWEEN #{timeStart} AND #{timeStop}
+      </if>
+    </where>
+  </select>
 
+  <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鍛戒护鏃ュ織鍘嗗彶璁板綍-->
+  <select id="getCommandHistories" resultType="com.dy.pipIrrGlobal.voRm.VoCommand">
     SELECT
       his.id,
       his.command_name AS commandName,
@@ -263,10 +284,27 @@
       his.result_text,
       IFNULL(cli.name, user.name) AS userName
     FROM rm_command_history his
-           INNER JOIN pr_intake inta ON inta.id = his.intake_id
-           LEFT JOIN se_client cli ON cli.id = his.operator
-           LEFT JOIN ba_user  user ON user.id = his.operator
-    WHERE his.command_name LIKE '%鍏抽榾%' AND his.result =1 AND his.send_time BETWEEN '2024-06-01 00:00:00' AND '2024-07-31 23:59:59'
+     INNER JOIN pr_intake inta ON inta.id = his.intake_id
+     LEFT JOIN se_client cli ON cli.id = his.operator
+     LEFT JOIN ba_user  user ON user.id = his.operator
+    <where>
+      <if test = "commandName != null and commandName !=''">
+        AND his.command_name LIKE CONCAT('%',#{commandName},'%')
+      </if>
+      <if test = "result != null">
+        AND his.result = #{result}
+      </if>
+
+      <if test = "timeStart != null and timeStop != null">
+        AND his.send_time BETWEEN #{timeStart} AND #{timeStop}
+      </if>
+    </where>
+    ORDER BY his.send_time DESC
+    <trim prefix="limit " >
+      <if test="start != null and count != null">
+        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
+      </if>
+    </trim>
   </select>
 
 </mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
index 6c6907e..33c7923 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
@@ -266,11 +266,14 @@
   <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鍏呭�艰褰�-->
   <select id="getRecharges" resultType="com.dy.pipIrrGlobal.voSe.VoRecharge">
     SELECT
-      CAST(ope.id AS char) AS id,
+<!--      CAST(ope.id AS char) AS id,-->
+      ope.id AS opeId,
+      card.id AS cardId,
       cli.name AS clientName,
       cli.phone,
       cli.idCard,
       cli.clientNum,
+      cli.address,
       card.money,
       CAST(card.cardNum AS char) AS cardNum,
       IFNULL(ope.trade_amount, 0) AS amount,
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandCtrl.java
new file mode 100644
index 0000000..5133c35
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandCtrl.java
@@ -0,0 +1,43 @@
+package com.dy.pipIrrRemote.common;
+
+import com.dy.common.aop.SsoAop;
+import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.common.webUtil.QueryResultVo;
+import com.dy.pipIrrGlobal.voRm.VoCommand;
+import com.dy.pipIrrRemote.common.qo.QoCommand;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-07-03 9:48
+ * @LastEditTime 2024-07-03 9:48
+ * @Description
+ */
+
+@Slf4j
+@RestController
+@RequestMapping(path="get")
+@RequiredArgsConstructor
+public class CommandCtrl {
+    private final CommandSv commandSv;
+
+    @GetMapping(path = "/command_history")
+    @SsoAop()
+    public BaseResponse<QueryResultVo<List<VoCommand>>> get(QoCommand vo){
+        try {
+            QueryResultVo<List<VoCommand>> res = commandSv.getCommandHistories(vo);
+            return BaseResponseUtils.buildSuccess(res);
+        } catch (Exception e) {
+            log.error("鑾峰彇鍏呭�艰褰曞紓甯�", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+    }
+
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java
index 585e387..0fc696d 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java
@@ -15,13 +15,17 @@
 import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory;
 import com.dy.pipIrrGlobal.pojoSe.SeClientCard;
 import com.dy.pipIrrGlobal.voPr.VoOnLineIntake;
+import com.dy.pipIrrGlobal.voRm.VoCommand;
 import com.dy.pipIrrGlobal.voRm.VoUnclosedParam;
 import com.dy.pipIrrGlobal.voRm.VoUnclosedValve;
 import com.dy.pipIrrGlobal.voSe.VoVirtualCard;
+import com.dy.pipIrrRemote.common.qo.QoCommand;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.common.utils.PojoUtils;
 import org.springframework.stereotype.Service;
 
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -179,4 +183,36 @@
     public SeClientCard geClientCardByCardId(Long cardId) {
         return seClientCardMapper.selectByPrimaryKey(cardId);
     }
+
+    /**
+     * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鍛戒护鏃ュ織鍘嗗彶璁板綍
+     * @param query
+     * @return
+     */
+    public QueryResultVo<List<VoCommand>> getCommandHistories(QoCommand query) {
+        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        // 瀹屽杽鏌ヨ璧锋鏃堕棿
+        String timeStart = query.getTimeStart();
+        String timeStop = query.getTimeStop();
+        if(timeStart != null) {
+            timeStart = timeStart + " 00:00:00";
+            query.setTimeStart(timeStart);
+        }
+        if(timeStop != null) {
+            timeStop = timeStop + " 23:59:59";
+            query.setTimeStop(timeStop);
+        }
+
+        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(query);
+
+        Long itemTotal = rmCommandHistoryMapper.getCommandHistoriesCount(params);
+
+        QueryResultVo<List<VoCommand>> rsVo = new QueryResultVo<>() ;
+        rsVo.pageSize = query.pageSize ;
+        rsVo.pageCurr = query.pageCurr ;
+
+        rsVo.calculateAndSet(itemTotal, params);
+        rsVo.obj = rmCommandHistoryMapper.getCommandHistories(params);
+        return rsVo ;
+    }
 }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/qo/QoCommand.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/qo/QoCommand.java
new file mode 100644
index 0000000..8491229
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/qo/QoCommand.java
@@ -0,0 +1,40 @@
+package com.dy.pipIrrRemote.common.qo;
+
+import com.dy.common.webUtil.QueryConditionVo;
+import lombok.*;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-07-03 9:25
+ * @LastEditTime 2024-07-03 9:25
+ * @Description 鍛戒护鏃ュ織鍘嗗彶璁板綍鏌ヨ瑙嗗浘
+ */
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+@ToString(callSuper = true)
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class QoCommand extends QueryConditionVo {
+
+    /**
+     * 鍛戒护鍚嶇О
+     */
+    private String commandName;
+
+    /**
+     * 鍛戒护缁撴灉锛�0-澶辫触锛�1-鎴愬姛
+     */
+    private Integer result;
+
+    /**
+     * 鏌ヨ璧峰鏃堕棿
+     */
+    private String timeStart;
+
+    /**
+     * 鏌ヨ鎴鏃堕棿
+     */
+    private String timeStop;
+}

--
Gitblit v1.8.0