From 6f7059beb3f44bcb4bc18cc4bf13285d0913e065 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期四, 22 八月 2024 10:57:03 +0800
Subject: [PATCH] 2024-08-22 朱宝民 优化代码-财务对账

---
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoGeneral.java                         |   18 +++++++-
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml                                 |   25 ++++++------
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml                             |   38 +++++++++---------
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java |   10 ++--
 4 files changed, 52 insertions(+), 39 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoGeneral.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoGeneral.java
index 522b01a..49ef7bb 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoGeneral.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoGeneral.java
@@ -1,6 +1,9 @@
 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.JsonPropertyOrder;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
@@ -8,19 +11,22 @@
  * @author ZhuBaoMin
  * @date 2024-01-24 17:00
  * @LastEditTime 2024-01-24 17:00
- * @Description
+ * @Description 2024-08-22 鏈卞疂姘戝鍔犳�婚瀛楁
  */
 
 @Data
+@JsonPropertyOrder({ "generalId", "cashierId", "cashierName", "tradeAmount", "gift", "refundAmount", "totalAmount", "operateDate", "auditStatus"})
 @Schema(title = "璐㈠姟瀵硅处涔嬫�昏处瑙嗗浘瀵硅薄")
 public class VoGeneral implements BaseEntity {
     private static final long serialVersionUID = 202401241706001L;
 
     @Schema(title = "鎬昏处ID")
-    private String generalId;
+    @JSONField(serializeUsing= ObjectWriterImplToString.class)
+    private Long generalId;
 
     @Schema(title = "鏀堕摱鍛業D")
-    private String cashierId;
+    @JSONField(serializeUsing= ObjectWriterImplToString.class)
+    private Long cashierId;
 
     @Schema(title = "鏀堕摱鍛樺鍚�")
     private String cashierName;
@@ -34,6 +40,12 @@
     @Schema(title = "杩旇繕閲戦")
     private Float refundAmount;
 
+    /**
+     * 鎬婚 = 瀹炴敹閲戦 + 璧犻�侀噾棰� + 杩旇繕閲戦
+     */
+    @Schema(title = "鎬婚")
+    private Float totalAmount;
+
     @Schema(title = "浜ゆ槗鏃ユ湡")
     private String operateDate;
 
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 401848d..8c1b53c 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
@@ -287,9 +287,9 @@
       ope.price,
       us.name AS opr,
       (CASE
-        WHEN ope.operate_type = 1 THEN "寮�鍗�"
-        WHEN ope.operate_type = 2 THEN "鍏呭��"
-        WHEN ope.operate_type = 5 THEN "杩旇繕"
+        WHEN ope.operate_type = 1 THEN '寮�鍗�'
+        WHEN ope.operate_type = 2 THEN '鍏呭��'
+        WHEN ope.operate_type = 5 THEN '杩旇繕'
       END) AS operateType,
       ope.operate_dt
     FROM se_card_operate ope
@@ -334,7 +334,7 @@
     FROM v_trade_details
     <where>
       <if test = "villageId != null and villageId > 0">
-        AND villageId = ${villageId}
+        AND villageId = #{villageId}
       </if>
 
       <if test = "operateTimeStart != null and operateTimeStop != null">
@@ -342,7 +342,7 @@
       </if>
 
       <if test = "cashierId != null and cashierId > 0">
-        AND cashierId = ${cashierId}
+        AND cashierId = #{cashierId}
       </if>
 
       <if test = "tradeTime != null">
@@ -356,7 +356,7 @@
     SELECT * FROM v_trade_details
     <where>
       <if test = "villageId != null and villageId > 0">
-        AND villageId = ${villageId}
+        AND villageId = #{villageId}
       </if>
 
       <if test = "operateTimeStart != null and operateTimeStop != null">
@@ -364,12 +364,12 @@
       </if>
 
       <if test = "cashierId != null and cashierId > 0">
-        AND cashierId = ${cashierId}
+        AND cashierId = #{cashierId}
       </if>
     </where>
     ORDER BY tradeTime
     <if test="pageCurr != null and pageSize != null">
-      LIMIT ${pageCurr}, ${pageSize}
+      LIMIT #{pageCurr}, #{pageSize}
     </if>
   </select>
 
@@ -391,7 +391,7 @@
       </if>
 
       <if test = "state != null and state > 0">
-        AND card.state = ${state}
+        AND card.state = #{state}
       </if>
 
       <if test = "activeTimeStart != null and activeTimeStop != null">
@@ -409,9 +409,9 @@
     card.cardNum AS cardNum,
     card.state AS state,
     (CASE
-    WHEN card.state = 1 THEN "姝e父"
-    WHEN card.state = 2 THEN "宸叉敞閿�"
-    WHEN card.state = 3 THEN "宸叉寕澶�"
+    WHEN card.state = 1 THEN '姝e父'
+    WHEN card.state = 2 THEN '宸叉敞閿�'
+    WHEN card.state = 3 THEN '宸叉寕澶�'
     END) AS stateName,
     ope.card_cost AS cardCost,
     ope.payment_id AS paymentId,
@@ -431,7 +431,7 @@
       </if>
 
       <if test = "state != null and state > 0">
-        AND card.state = ${state}
+        AND card.state = #{state}
       </if>
 
       <if test = "activeTimeStart != null and activeTimeStop != null">
@@ -515,7 +515,7 @@
         INNER JOIN ba_user us ON ope.operator = us.id
     <where>
       <if test = "operateType != null and operateType > 0">
-        AND ope.operate_type = ${operateType}
+        AND ope.operate_type = #{operateType}
       </if>
 
       <if test = "clientName != null and clientName !=''">
@@ -542,7 +542,7 @@
         ope.operate_dt AS operateDt,
         IFNULL(ope.trade_amount,0) AS refund,
         (CASE
-            WHEN ope.payment_id = 1 THEN "鐜伴噾"
+            WHEN ope.payment_id = 1 THEN '鐜伴噾'
         END) AS refundTypeName,
         card.money,
         IFNULL(ope.system_balance,0) AS systemBalance
@@ -552,7 +552,7 @@
         INNER JOIN ba_user us ON ope.operator = us.id
     <where>
       <if test = "operateType != null and operateType > 0">
-        AND ope.operate_type = ${operateType}
+        AND ope.operate_type = #{operateType}
       </if>
 
       <if test = "clientName != null and clientName !=''">
@@ -589,7 +589,7 @@
     <where>
       AND ope.operate_type IN(1,2)
       <if test = "operateId != null and operateId > 0">
-        AND ope.id = ${operateId}
+        AND ope.id = #{operateId}
       </if>
 
       <if test = "clientName != null and clientName !=''">
@@ -634,7 +634,7 @@
     <where>
       AND ope.operate_type IN(1,2)
       <if test = "operateId != null and operateId > 0">
-        AND ope.id = ${operateId}
+        AND ope.id = #{operateId}
       </if>
 
       <if test = "clientName != null and clientName !=''">
@@ -667,7 +667,7 @@
     <where>
       AND ope.operate_type IN(1,2)
       <if test = "operateId != null and operateId > 0">
-        AND ope.id = ${operateId}
+        AND ope.id = #{operateId}
       </if>
 
       <if test = "clientName != null and clientName !=''">
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml
index 785e7b2..977aa19 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml
@@ -198,7 +198,7 @@
       </if>
 
       <if test = "auditStatus != null and auditStatus > 0">
-        AND audit_status = ${auditStatus}
+        AND audit_status = #{auditStatus}
       </if>
 
       <if test = "operateDateStart != null and operateDateStop != null">
@@ -210,17 +210,18 @@
   <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鎬昏处璁板綍-->
   <select id="getGenerals" resultType="com.dy.pipIrrGlobal.voSe.VoGeneral">
     SELECT
-        CAST(id AS  char) AS generalId,
-        CAST(cashier_id AS char) AS cashierId,
+        id AS generalId,
+        cashier_id AS cashierId,
         cashier_name AS cashierName,
         trade_amount AS tradeAmount,
         gift,
         refund_amount AS refundAmount,
+        (trade_amount + gift + refund_amount) AS totalAmount,
         Date(operate_date) AS operateDate,
         (CASE
-          WHEN audit_status = 1 THEN "鏈鏍�"
-          WHEN audit_status = 2 THEN "鍚屾剰"
-          WHEN audit_status = 3 THEN "椹冲洖"
+          WHEN audit_status = 1 THEN '鏈鏍�'
+          WHEN audit_status = 2 THEN '鍚屾剰'
+          WHEN audit_status = 3 THEN '椹冲洖'
         END) AS auditStatus
     FROM se_general
     <where>
@@ -229,7 +230,7 @@
       </if>
 
       <if test = "auditStatus != null and auditStatus > 0">
-        AND audit_status = ${auditStatus}
+        AND audit_status = #{auditStatus}
       </if>
 
       <if test = "operateDateStart != null and operateDateStop != null">
@@ -255,11 +256,11 @@
       </if>
 
       <if test = "paymentId != null and paymentId >0">
-        AND ope.payment_id = ${paymentId}
+        AND ope.payment_id = #{paymentId}
       </if>
 
       <if test = "cashierId != null and cashierId >0">
-        AND ope.operator = ${cashierId}
+        AND ope.operator = #{cashierId}
       </if>
     </where>
     GROUP BY ope.payment_id,  Date(ope.operate_dt)
@@ -286,7 +287,7 @@
     SELECT * FROM v_trade_summary
     <where>
       <if test = "cashierId != null and cashierId > 0">
-        AND cashierId = ${cashierId}
+        AND cashierId = #{cashierId}
       </if>
 
       <if test = "timeStart != null and timeStop != null">
@@ -303,7 +304,7 @@
     FROM v_trade_details
     <where>
       <if test = "cashierId != null and cashierId > 0">
-        AND cashierId = ${cashierId}
+        AND cashierId = #{cashierId}
       </if>
 
       <if test = "tradeDate != null">
@@ -317,7 +318,7 @@
     SELECT * FROM v_trade_details
     <where>
       <if test = "cashierId != null and cashierId > 0">
-        AND cashierId = ${cashierId}
+        AND cashierId = #{cashierId}
       </if>
 
       <if test = "tradeDate != null">
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 c0d9ffb..5bc30ff 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
@@ -971,11 +971,11 @@
     @SsoAop()
     public BaseResponse<Map> getReceipts(QoReceipt vo){
         try {
-            Map res = Optional.ofNullable(cardOperateSv.getReceipts(vo)).orElse(new HashMap());
-            if(res.size() == 0) {
-                return BaseResponseUtils.buildErrorMsg(SellResultCode.No_RECEIPTS.getMessage());
-            }
-            return BaseResponseUtils.buildSuccess(res);
+        //    Map res = Optional.ofNullable(cardOperateSv.getReceipts(vo)).orElse(new HashMap());
+        //    if(res.size() == 0) {
+        //        return BaseResponseUtils.buildErrorMsg(SellResultCode.No_RECEIPTS.getMessage());
+        //    }
+            return BaseResponseUtils.buildSuccess(cardOperateSv.getReceipts(vo));
         } catch (Exception e) {
             log.error("鑾峰彇鐢靛瓙閽卞寘璐︽埛璁板綍", e);
             return BaseResponseUtils.buildException(e.getMessage()) ;

--
Gitblit v1.8.0