From 717fc5108619373bd7528c7b8b80ca31dd3f3cea Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 09 Apr 2021 17:53:52 +0800
Subject: [PATCH] modify

---
 zq-erp/src/main/java/com/matrix/system/hiveErp/dao/TjVipSumDao.java        |    6 ++++++
 zq-erp/src/main/java/com/matrix/system/app/action/ApiStatisticsAction.java |    8 ++++++++
 zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml              |   40 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/app/action/ApiStatisticsAction.java b/zq-erp/src/main/java/com/matrix/system/app/action/ApiStatisticsAction.java
index 71d838c..3cdc992 100644
--- a/zq-erp/src/main/java/com/matrix/system/app/action/ApiStatisticsAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/app/action/ApiStatisticsAction.java
@@ -154,6 +154,10 @@
                             return tjVipSumDao.selectProjConsumeCnt(timeSpaceParam, shopId, null);
                         case "20" :
                             return tjVipSumDao.selectTimeLength(timeSpaceParam, shopId, null);
+                        case "21" :
+                            return tjVipSumDao.selectCardAmount(timeSpaceParam, shopId, null);
+                        case "22" :
+                            return tjVipSumDao.selectFreeAmount(timeSpaceParam, shopId, null);
                         default :
                             return tjVipSumDao.selectBusinessInCome(timeSpaceParam, shopId, null);
                     }
@@ -205,6 +209,10 @@
                             return tjVipSumDao.selectProjConsumeCnt(timeSpaceParam, null, companyId);
                         case "20" :
                             return tjVipSumDao.selectTimeLength(timeSpaceParam, null, companyId);
+                        case "21" :
+                            return tjVipSumDao.selectCardAmount(timeSpaceParam, null, companyId);
+                        case "22" :
+                            return tjVipSumDao.selectFreeAmount(timeSpaceParam, null, companyId);
                         default :
                             return tjVipSumDao.selectBusinessInCome(timeSpaceParam, null, companyId);
                     }
diff --git a/zq-erp/src/main/java/com/matrix/system/hiveErp/dao/TjVipSumDao.java b/zq-erp/src/main/java/com/matrix/system/hiveErp/dao/TjVipSumDao.java
index 3677903..3f1d10e 100644
--- a/zq-erp/src/main/java/com/matrix/system/hiveErp/dao/TjVipSumDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/hiveErp/dao/TjVipSumDao.java
@@ -81,6 +81,12 @@
 	// 服务时长
 	Map<String, BigDecimal> selectTimeLength(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
 
+	// 储值卡本金扣款
+	Map<String, BigDecimal> selectCardAmount(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+
+	// 储值卡赠金扣款
+	Map<String, BigDecimal> selectFreeAmount(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+
 	List<VipAchieveDataShowVo> selectVipAchieveInPage(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("userId") Long userId);
 
 	// 订单业绩
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml
index 7a46366..deb14c6 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml
@@ -523,6 +523,46 @@
 		from area where id=1
 	</select>
 
+	<select id="selectCardAmount" resultType="java.util.TreeMap">
+		select
+		<foreach collection="list" index="index" item="item"   separator=","  >
+			(
+			select IFNULL(sum(IFNULL(amount, 0)), 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>
+			) as t${index}
+
+		</foreach>
+		from area where id=1
+	</select>
+
+	<select id="selectFreeAmount" resultType="java.util.TreeMap">
+		select
+		<foreach collection="list" index="index" item="item"   separator=","  >
+			(
+			select IFNULL(sum(IFNULL(amount, 0)), 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>
+			) as t${index}
+
+		</foreach>
+		from area where id=1
+	</select>
+
 	<select id="selectVipAchieveInPage" resultType="com.matrix.system.app.vo.VipAchieveDataShowVo">
 		<foreach collection="list" index="index" item="item"   separator="union all"  >
 			select

--
Gitblit v1.9.1