From 907bfd7ec81eb7d13dad7da5f7d1e0306368ad28 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 09 Apr 2021 16:48:31 +0800
Subject: [PATCH] modify tj

---
 zq-erp/src/main/java/com/matrix/system/app/vo/BusinessesDataShowVo.java            |   22 ++++++++++++++++++++++
 zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml                    |    6 ++----
 zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html   |    4 +++-
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html |    4 +++-
 zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml               |   24 +++++++++++++++++++++++-
 5 files changed, 53 insertions(+), 7 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/app/vo/BusinessesDataShowVo.java b/zq-erp/src/main/java/com/matrix/system/app/vo/BusinessesDataShowVo.java
index 714b2bf..5fae6d9 100644
--- a/zq-erp/src/main/java/com/matrix/system/app/vo/BusinessesDataShowVo.java
+++ b/zq-erp/src/main/java/com/matrix/system/app/vo/BusinessesDataShowVo.java
@@ -40,6 +40,12 @@
     @ApiModelProperty(value = "卡项业绩")
     private BigDecimal cardAchieve;
 
+    @ApiModelProperty(value = "储值卡本金扣款")
+    private BigDecimal cardAmount;
+
+    @ApiModelProperty(value = "储值卡增金扣款")
+    private BigDecimal cardFreeAmount;
+
     @ApiModelProperty(value = "退款")
     private BigDecimal refund;
 
@@ -297,4 +303,20 @@
     public void setTimeLength(BigDecimal timeLength) {
         this.timeLength = timeLength;
     }
+
+    public BigDecimal getCardAmount() {
+        return cardAmount;
+    }
+
+    public void setCardAmount(BigDecimal cardAmount) {
+        this.cardAmount = cardAmount;
+    }
+
+    public BigDecimal getCardFreeAmount() {
+        return cardFreeAmount;
+    }
+
+    public void setCardFreeAmount(BigDecimal cardFreeAmount) {
+        this.cardFreeAmount = cardFreeAmount;
+    }
 }
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
index 9fd47fb..442d121 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
@@ -920,15 +920,13 @@
 	<select id="selectUserAchieveByTime" resultType="com.matrix.system.app.vo.UserAchieveVo">
 		select
 			sale_id id,
-			(select ifnull(sum(case b.pay_method when '现金' then goods_cash else 0 end),0)
+			(select ifnull(sum(case pay_method when '现金' then goods_cash else 0 end),0)
 				from achieve_new a
-				inner join sys_order_item b on a.order_item_id=b.ID
 			where a.beault_id=#{userId}
 			and (date_format(datatime, '%Y-%m-%d') >= date_format(#{startTime}, '%Y-%m-%d') and date_format(#{endTime}, '%Y-%m-%d') >= date_format(datatime, '%Y-%m-%d'))
 			) orderCash,
-			(select ifnull(sum(case b.pay_method when '划扣' then goods_cash else 0 end),0)
+			(select ifnull(sum(case pay_method when '划扣' then goods_cash else 0 end),0)
 				from achieve_new a
-				inner join sys_order_item b on a.order_item_id=b.ID
 			where  a.beault_id=#{userId}
 			and (date_format(datatime, '%Y-%m-%d') >= date_format(#{startTime}, '%Y-%m-%d') and date_format(#{endTime}, '%Y-%m-%d') >= date_format(datatime, '%Y-%m-%d'))
 			) cash,
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml
index 2cfc1a1..ddb5b13 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml
@@ -636,7 +636,7 @@
                     )totalPay,
                 (select IFNULL(sum(a.amount),0) from sys_order_flow a
                     inner join sys_order b on a.order_id=b.id and b.statu!='已取消'
-                    where a.pay_method not in ('储值卡', '欠款') and a.flow_type != '退款' and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]>
+                    where a.pay_method not in ('储值卡', '欠款') and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]>
                     <if test="shopId != null">
                         and a.shop_id=#{shopId}
                     </if>
@@ -716,6 +716,28 @@
                         and a.company_id=#{companyId}
                     </if>
                 ) refund,
+                (select sum(IFNULL(amount, 0))
+                    from sys_order_flow a
+                    inner join sys_order b on a.order_id=b.id and b.STATU!='已取消'
+                    where a.pay_method='储值卡' and a.is_gift='N' and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]>
+                    <if test="shopId != null">
+                        and a.shop_id=#{shopId}
+                    </if>
+                    <if test="companyId != null">
+                        and a.company_id=#{companyId}
+                    </if>
+                ) cardAmount,
+                (select sum(IFNULL(amount, 0))
+                    from sys_order_flow a
+                    inner join sys_order b on a.order_id=b.id and b.STATU!='已取消'
+                    where a.pay_method='储值卡' and a.is_gift='Y' and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]>
+                    <if test="shopId != null">
+                        and a.shop_id=#{shopId}
+                    </if>
+                    <if test="companyId != null">
+                        and a.company_id=#{companyId}
+                    </if>
+                ) cardFreeAmount,
                 (select IFNULL(count(1),0) from sys_order
                     where STATU in ('已付款', '欠款') and orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                     <if test="shopId != null">
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html b/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html
index 1982dfd..0f3eb7d 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html
@@ -690,7 +690,9 @@
                     callback: function (data) {
                         _this.isRefund = false;
                         _this.dialogSettleVisible = false;
-                        _this.queryOrderDetailData(_this.data.oldOrderId);
+                        var param = {};
+                        param.id = _this.data.oldOrderId;
+                        _this.queryOrderDetailData(param);
                     }
                 });
 
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
index c43d2ce..58db52c 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
@@ -710,7 +710,9 @@
                     callback: function (data) {
                         _this.isRefund = false;
                         _this.dialogSettleVisible = false;
-                        _this.queryOrderDetailData(_this.data.oldOrderId);
+                        var param = {};
+                        param.id = _this.data.oldOrderId;
+                        _this.queryOrderDetailData(param);
                     }
                 });
 

--
Gitblit v1.9.1