From 97675aaafec74cc653d2dff70636241ba0de367d Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期一, 09 九月 2024 14:22:23 +0800
Subject: [PATCH] 2024-09-09 朱宝民 优化交易明细接口

---
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoTradeDetails.java                    |   64 ++++++++++++++++++++++++++++----
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java   |   17 ++++++++
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml                             |   12 ++---
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java |   13 ------
 4 files changed, 79 insertions(+), 27 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoTradeDetails.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoTradeDetails.java
index 559f77e..95468e4 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoTradeDetails.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoTradeDetails.java
@@ -5,9 +5,10 @@
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
 import com.alibaba.excel.annotation.write.style.ContentRowHeight;
 import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import com.alibaba.fastjson2.annotation.JSONField;
+import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
 import com.dy.common.po.BaseEntity;
 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -21,64 +22,111 @@
  */
 
 @Data
-@JsonPropertyOrder({ "cashierId", "villageId", "clientNum", "districtTitle", "clientName", "phone", "operateType", "tradeAmount", "waterCost", "cardCost", "gift", "refundAmount", "paymentName", "tradeTime"})
+@JsonPropertyOrder({"cardNum", "cashierId", "villageId", "clientNum", "districtTitle", "clientName", "phone", "operateType", "tradeAmount", "waterCost", "cardCost", "gift", "refundAmount", "paymentName", "tradeTime"})
 @HeadRowHeight(30)
 @ContentRowHeight(20)
 public class VoTradeDetails implements BaseEntity {
     private static final long serialVersionUID = 202402012040001L;
 
-    @Schema(title = "鏀堕摱鍛業D")
-    @ExcelIgnore
-    private String cashierId;
+    /**
+     * 姘村崱缂栧彿
+     */
+    @JSONField(serializeUsing= ObjectWriterImplToString.class)
+    private Long cardNum;
 
-    @Schema(title = "鏉戝簞ID")
+    /**
+     * 鏀堕摱鍛業D
+     */
+    @JSONField(serializeUsing= ObjectWriterImplToString.class)
     @ExcelIgnore
-    private String villageId;
+    private Long cashierId;
 
-    @Schema(title = "鍐滄埛缂栧彿")
+    /**
+     * 鏉戝簞ID
+     */
+    @JSONField(serializeUsing= ObjectWriterImplToString.class)
+    @ExcelIgnore
+    private Long villageId;
+
+    /**
+     * 鍐滄埛缂栧彿
+     */
     @ExcelIgnore
     private String clientNum;
 
+    /**
+     * 鏉戝簞鍚嶇О
+     */
     @ExcelProperty(value = {"${title}", "鏉戝簞鍚嶇О"})
     @ColumnWidth(20)
     private String districtTitle;
 
+    /**
+     * 鍐滄埛濮撳悕
+     */
     @ExcelProperty(value = {"${title}", "鍐滄埛濮撳悕"})
     @ColumnWidth(15)
     private String clientName;
 
+    /**
+     * 鑱旂郴鐢佃瘽
+     */
     @ExcelProperty(value = {"${title}", "鑱旂郴鐢佃瘽"})
     @ColumnWidth(15)
     private String phone;
 
+    /**
+     * 涓氬姟绫诲瀷
+     */
     @ExcelProperty(value = {"${title}", "涓氬姟绫诲瀷"})
     @ColumnWidth(15)
     private String operateType;
 
+    /**
+     * 浜ゆ槗閲戦
+     */
     @ExcelProperty(value = {"${title}", "浜ゆ槗閲戦"})
     @ColumnWidth(15)
     private Double tradeAmount;
 
+    /**
+     * 璐按閲戦
+     */
     @ExcelProperty(value = {"${title}", "璐按閲戦"})
     @ColumnWidth(15)
     private Double waterCost;
 
+    /**
+     * 璐崱閲戦
+     */
     @ExcelProperty(value = {"${title}", "璐崱閲戦"})
     @ColumnWidth(15)
     private Double cardCost;
 
+    /**
+     * 璧犻�侀噾棰�
+     */
     @ExcelProperty(value = {"${title}", "璧犻�侀噾棰�"})
     @ColumnWidth(15)
     private Double gift;
 
+    /**
+     * 杩旇繕閲戦
+     */
     @ExcelProperty(value = {"${title}", "杩旇繕閲戦"})
     @ColumnWidth(15)
     private Double refundAmount;
 
+    /**
+     * 浠樻鏂瑰紡
+     */
     @ExcelProperty(value = {"${title}", "浠樻鏂瑰紡"})
     @ColumnWidth(15)
     private String paymentName;
 
+    /**
+     * 浜ゆ槗鏃堕棿
+     */
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @ExcelProperty(value = {"${title}", "浜ゆ槗鏃堕棿"})
     @ColumnWidth(20)
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 8c1b53c..d413173 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
@@ -344,10 +344,6 @@
       <if test = "cashierId != null and cashierId > 0">
         AND cashierId = #{cashierId}
       </if>
-
-      <if test = "tradeTime != null">
-        AND tradeTime = #{tradeTime}
-      </if>
     </where>
   </select>
 
@@ -368,9 +364,11 @@
       </if>
     </where>
     ORDER BY tradeTime
-    <if test="pageCurr != null and pageSize != null">
-      LIMIT #{pageCurr}, #{pageSize}
-    </if>
+    <trim prefix="limit ">
+      <if test="start != null and count != null">
+        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
+      </if>
+    </trim>
   </select>
 
   <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇寮�鍗¤褰曟暟閲�-->
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java
index ba2542c..3367773 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java
@@ -7,7 +7,6 @@
 import com.dy.common.webUtil.BaseResponseUtils;
 import com.dy.common.webUtil.QueryResultVo;
 import com.dy.common.webUtil.ResultCodeMsg;
-import com.dy.pipIrrGlobal.pojoBa.BaClient;
 import com.dy.pipIrrGlobal.pojoSe.SeCardOperate;
 import com.dy.pipIrrGlobal.pojoSe.SeClientCard;
 import com.dy.pipIrrGlobal.pojoSe.SeManagerCard;
@@ -848,21 +847,11 @@
      * @param vo
      * @return
      */
-    @Operation(summary = "鑾峰緱浜ゆ槗璁板綍鏄庣粏", description = "杩斿洖浜ゆ槗璁板綍鏄庣粏")
-    @ApiResponses(value = {
-            @ApiResponse(
-                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
-                    description = "杩斿洖涓�椤靛啘鎴锋暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�",
-                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
-                            schema = @Schema(implementation = BaClient.class))}
-            )
-    })
     @GetMapping(path = "getTransactions")
     @SsoAop()
     public BaseResponse<Map> getOperates(QoTransaction vo){
         try {
-            Map res = cardOperateSv.getTransactions(vo);
-            return BaseResponseUtils.buildSuccess(res);
+            return BaseResponseUtils.buildSuccess(cardOperateSv.getTransactions(vo));
         } catch (Exception e) {
             log.error("鏌ヨ浜ゆ槗璁板綍寮傚父", e);
             return BaseResponseUtils.buildException(e.getMessage()) ;
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java
index a927bb2..7fb7ae2 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java
@@ -291,6 +291,11 @@
         // 鑾峰彇绗﹀悎鏉′欢鐨勮褰曟暟
         Long itemTotal = Optional.ofNullable(seCardOperateMapper.getTransactionRecordCount(params)).orElse(0L);
 
+        QueryResultVo rsVo = new QueryResultVo<>() ;
+        rsVo.pageSize = vo.pageSize ;
+        rsVo.pageCurr = vo.pageCurr ;
+        rsVo.calculateAndSet(itemTotal, params);
+
         List<VoTradeDetails> list = seCardOperateMapper.getTransactions(params);
         if(list.size() == 0) {
             return new HashMap();
@@ -299,13 +304,21 @@
         // 閬嶅巻浜ゆ槗鏄庣粏璁板綍锛屾眹鎬昏喘姘撮噾棰濄�佽喘鍗¢噾棰�
         Double totalWaterCost = 0.0;
         Double totalCardCost = 0.0;
+        Double totalGift = 0.0;
+        Double totalRefund = 0.0;
+
         JSONArray array= JSONArray.parseArray(JSON.toJSONString(list));
         for(int i = 0; i < array.size(); i++) {
             JSONObject job = array.getJSONObject(i);
             Double waterCost = Optional.ofNullable(job.getDouble("waterCost")).orElse(0.0);
             Double cardCost = Optional.ofNullable(job.getDouble("cardCost")).orElse(0.0);
+            Double gift = Optional.ofNullable(job.getDouble("gift")).orElse(0.0);
+            Double refundAmount = Optional.ofNullable(job.getDouble("refundAmount")).orElse(0.0);
+
             totalWaterCost = totalWaterCost + waterCost;
             totalCardCost = totalCardCost + cardCost;
+            totalGift = totalGift + gift;
+            totalRefund = totalRefund + refundAmount;
         }
 
         Map map_record = new HashMap();
@@ -315,6 +328,10 @@
         Map map_result = new HashMap();
         map_result.put("waterCost", df.format(totalWaterCost));
         map_result.put("cardCost", df.format(totalCardCost));
+        map_result.put("gift", df.format(totalGift));
+        map_result.put("refund", df.format(totalRefund));
+
+
         map_result.put("records", map_record);
 
         return map_result;

--
Gitblit v1.8.0