From 3875ea07f21457da72bcc2c2b7484987d565424d Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 22 Jan 2021 16:03:51 +0800
Subject: [PATCH] modify
---
zq-erp/src/main/java/com/matrix/system/hiveErp/dao/TjVipSumDao.java | 45 +++++++
zq-erp/src/main/java/com/matrix/system/app/action/ApiVipLabelAction.java | 1
zq-erp/src/main/java/com/matrix/system/app/action/ApiStatisticsAction.java | 30 +++-
zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml | 1
zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml | 2
zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml | 232 ++++++++++++++++++++++++++++----------
6 files changed, 237 insertions(+), 74 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 104d16c..6f16768 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
@@ -121,15 +121,29 @@
case "3" :
return tjVipSumDao.selectCardUse(timeSpaceParam, shopId, null);
case "4" :
- return tjVipSumDao.selectHisConsume(timeSpaceParam, shopId, null);
- case "5" :
- return tjVipSumDao.selectFreeConsume(timeSpaceParam, shopId, null);
- case "6" :
- return tjVipSumDao.selectCashRefund(timeSpaceParam, shopId, null);
- case "7" :
- return tjVipSumDao.selectCardRefund(timeSpaceParam, shopId, null);
- case "8" :
return tjVipSumDao.selectArrears(timeSpaceParam, shopId, null);
+ case "5" :
+ return tjVipSumDao.selectCashRefund(timeSpaceParam, shopId, null);
+ case "6" :
+ return tjVipSumDao.selectCardRefund(timeSpaceParam, shopId, null);
+ case "7":
+ return tjVipSumDao.selectProductAchieve(timeSpaceParam, shopId, null);
+ case "8":
+ return tjVipSumDao.selectCardAchieve(timeSpaceParam, shopId, null);
+ case "9":
+ return tjVipSumDao.selectRepayment(timeSpaceParam, shopId, null);
+ case "10":
+ return tjVipSumDao.selectPerCustomCnt(timeSpaceParam, shopId, null);
+ case "16" :
+ return tjVipSumDao.selectHisConsume(timeSpaceParam, shopId, null);
+ case "17" :
+ return tjVipSumDao.selectFreeConsume(timeSpaceParam, shopId, null);
+ case "18" :
+ return tjVipSumDao.selectPeopleCnt(timeSpaceParam, shopId, null);
+ case "19" :
+ return tjVipSumDao.selectProjConsumeCnt(timeSpaceParam, shopId, null);
+ case "20" :
+ return tjVipSumDao.selectTimeLength(timeSpaceParam, shopId, null);
default :
return tjVipSumDao.selectBusinessInCome(timeSpaceParam, shopId, null);
}
diff --git a/zq-erp/src/main/java/com/matrix/system/app/action/ApiVipLabelAction.java b/zq-erp/src/main/java/com/matrix/system/app/action/ApiVipLabelAction.java
index 7db86dd..3399e91 100644
--- a/zq-erp/src/main/java/com/matrix/system/app/action/ApiVipLabelAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/app/action/ApiVipLabelAction.java
@@ -53,6 +53,7 @@
@PostMapping(value = "/addLabel")
public AjaxResult addLabel(@RequestBody LabelDto labelDto) {
SysVipLabel sysVipLabel = new SysVipLabel();
+ sysVipLabel.setCreateBy(getMe().getSuName());
sysVipLabel.setLabel(labelDto.getLabel());
sysVipLabel.setColor(labelDto.getColor());
sysVipLabel.setShopId(getMe().getShopId());
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 e0e6f8f..c197ba8 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
@@ -21,19 +21,60 @@
Map<String, Integer> customerEnterRateCompare(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId);
+ // 营业收入
Map<String, BigDecimal> selectBusinessInCome(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+ // 现金收款
Map<String, BigDecimal> selectCashIncome(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+ // 储值卡收款
Map<String, BigDecimal> selectCardUse(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+ // 欠款
Map<String, BigDecimal> selectArrears(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+ // 卡项退款
+ Map<String, BigDecimal> selectCardRefund(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+
+ // 现金退款
+ Map<String, BigDecimal> selectCashRefund(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+
+ // 产品业绩
+ Map<String, BigDecimal> selectProductAchieve(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+
+ // 卡项业绩
+ Map<String, BigDecimal> selectCardAchieve(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+
+ // 还款
+ Map<String, BigDecimal> selectRepayment(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+
+ // 客单数
+ Map<String, BigDecimal> selectPerCustomCnt(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+
+ // 客品数
+
+ // 客单价
+
+ // 成本
+
+ // 毛利
+
+ // 毛利率
+
+ // 本金消耗
Map<String, BigDecimal> selectHisConsume(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+ // 赠送消耗
Map<String, BigDecimal> selectFreeConsume(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
- Map<String, BigDecimal> selectCardRefund(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
- Map<String, BigDecimal> selectCashRefund(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+
+ // 人头数
+ Map<String, BigDecimal> selectPeopleCnt(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+
+ // 项目消耗数
+ Map<String, BigDecimal> selectProjConsumeCnt(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
+
+ // 服务时长
+ Map<String, BigDecimal> selectTimeLength(@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/SysBeauticianStateDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml
index f6f6e44..7a5a0e5 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml
@@ -329,6 +329,7 @@
and a.STAFF_ID = #{suId} ]]>
and a.STATE !='预约取消'
and a.STATE !='待确认'
+ and a.STATE !='待预约'
order by a.BEGIN_TIME asc
</select>
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml
index da750be..b42140a 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml
@@ -16,7 +16,7 @@
user_id,
color
) values (
- #{createTime},
+ now(),
#{createBy},
#{id},
#{label},
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 16ea29d..119a641 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml
@@ -72,15 +72,13 @@
select
<foreach collection="list" index="index" item="item" separator="," >
(
- select IFNULL(sum(ZK_TOTAL), 0)
- from sys_order
- where STATU in ('已付款', '欠款')
- and <![CDATA[order_time > #{item.beginTime} and order_time < #{item.endTime} ]]>
- <if test="companyId != null and companyId != 0">
- and company_id=#{companyId}
+ select IFNULL(sum(amount),0) from sys_order_flow
+ where <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]> and pay_method!='欠款'
+ <if test="shopId != null">
+ and shop_id=#{shopId}
</if>
- <if test="shopId !=null and shopId !=0 " >
- and SHOP_ID = #{shopId}
+ <if test="companyId != null">
+ and company_id=#{companyId}
</if>
) as t${index}
@@ -92,15 +90,13 @@
select
<foreach collection="list" index="index" item="item" separator="," >
(
- select IFNULL(sum(cash_Pay), 0)
- from sys_order
- where STATU in ('已付款')
- and <![CDATA[order_time > #{item.beginTime} and order_time < #{item.endTime} ]]>
- <if test="companyId != null and companyId != 0">
- and company_id=#{companyId}
+ select IFNULL(sum(amount),0) from sys_order_flow
+ where pay_method not in ('储值卡', '欠款') and flow_type != '退款' and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
+ <if test="shopId != null">
+ and shop_id=#{shopId}
</if>
- <if test="shopId !=null and shopId !=0 " >
- and SHOP_ID = #{shopId}
+ <if test="companyId != null">
+ and company_id=#{companyId}
</if>
) as t${index}
@@ -112,15 +108,13 @@
select
<foreach collection="list" index="index" item="item" separator="," >
(
- select IFNULL(sum(card_Pay), 0)
- from sys_order
- where STATU in ('已付款')
- and <![CDATA[order_time > #{item.beginTime} and order_time < #{item.endTime} ]]>
- <if test="companyId != null and companyId != 0">
- and company_id=#{companyId}
+ select IFNULL(sum(amount),0) from sys_order_flow
+ where pay_method = '储值卡' and flow_type != '退款' and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
+ <if test="shopId != null">
+ and shop_id=#{shopId}
</if>
- <if test="shopId !=null and shopId !=0 " >
- and SHOP_ID = #{shopId}
+ <if test="companyId != null">
+ and company_id=#{companyId}
</if>
) as t${index}
@@ -132,15 +126,13 @@
select
<foreach collection="list" index="index" item="item" separator="," >
(
- select IFNULL(sum(arrears), 0)
- from sys_order
- where STATU in ('欠款')
- and <![CDATA[order_time > #{item.beginTime} and order_time < #{item.endTime} ]]>
- <if test="companyId != null and companyId != 0">
- and company_id=#{companyId}
+ select IFNULL(sum(amount),0) from sys_order_flow
+ where pay_method = '欠款' and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
+ <if test="shopId != null">
+ and shop_id=#{shopId}
</if>
- <if test="shopId !=null and shopId !=0 " >
- and SHOP_ID = #{shopId}
+ <if test="companyId != null">
+ and company_id=#{companyId}
</if>
) as t${index}
@@ -152,15 +144,13 @@
select
<foreach collection="list" index="index" item="item" separator="," >
(
- select IFNULL(sum(his_consume), 0)
- from achieve_new
- where order_type in ('服务单')
- and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>
- <if test="companyId != null and companyId != 0">
- and company_id=#{companyId}
+ select IFNULL(sum(IFNULL(his_consume, 0)),0) from achieve_new
+ where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime}]]>
+ <if test="shopId != null">
+ and shop_id=#{shopId}
</if>
- <if test="shopId !=null and shopId !=0 " >
- and SHOP_ID = #{shopId}
+ <if test="companyId != null">
+ and company_id=#{companyId}
</if>
) as t${index}
@@ -172,15 +162,135 @@
select
<foreach collection="list" index="index" item="item" separator="," >
(
- select IFNULL(sum(free_consume), 0)
- from achieve_new
- where order_type in ('服务单')
- and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>
- <if test="companyId != null and companyId != 0">
+ select IFNULL(sum(IFNULL(free_consume, 0)),0) from achieve_new
+ where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime}]]>
+ <if test="shopId != null">
+ and shop_id=#{shopId}
+ </if>
+ <if test="companyId != null">
and company_id=#{companyId}
</if>
- <if test="shopId !=null and shopId !=0 " >
- and SHOP_ID = #{shopId}
+ ) as t${index}
+ </foreach>
+ from area where id=1
+ </select>
+
+ <select id="selectPeopleCnt" resultType="java.util.TreeMap">
+ select
+ <foreach collection="list" index="index" item="item" separator="," >
+ (
+ select IFNULL(sum(IFNULL(number_of_people, 0)),0) from achieve_new
+ where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime}]]>
+ <if test="shopId != null">
+ and shop_id=#{shopId}
+ </if>
+ <if test="companyId != null">
+ and company_id=#{companyId}
+ </if>
+ ) as t${index}
+ </foreach>
+ from area where id=1
+ </select>
+
+ <select id="selectProjConsumeCnt" resultType="java.util.TreeMap">
+ select
+ <foreach collection="list" index="index" item="item" separator="," >
+ (
+ select IFNULL(sum(IFNULL(proj_num, 0)),0) from achieve_new
+ where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime}]]>
+ <if test="shopId != null">
+ and shop_id=#{shopId}
+ </if>
+ <if test="companyId != null">
+ and company_id=#{companyId}
+ </if>
+ ) as t${index}
+ </foreach>
+ from area where id=1
+ </select>
+
+ <select id="selectTimeLength" resultType="java.util.TreeMap">
+ select
+ <foreach collection="list" index="index" item="item" separator="," >
+ (
+ select IFNULL(sum(IFNULL(proj_time, 0)),0) from achieve_new
+ where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime}]]>
+ <if test="shopId != null">
+ and shop_id=#{shopId}
+ </if>
+ <if test="companyId != null">
+ and company_id=#{companyId}
+ </if>
+ ) as t${index}
+ </foreach>
+ from area where id=1
+ </select>
+
+ <select id="selectProductAchieve" resultType="java.util.TreeMap">
+ select
+ <foreach collection="list" index="index" item="item" separator="," >
+ (
+ select IFNULL(sum(zk_price),0) from sys_order_item a
+ inner join shopping_goods b on a.goods_id=b.id
+ inner join sys_order c on a.ORDER_ID=c.id
+ where b.good_type='家居产品' and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]>
+ <if test="shopId != null">
+ and c.shop_id=#{shopId}
+ </if>
+ <if test="companyId != null">
+ and c.company_id=#{companyId}
+ </if>
+ ) as t${index}
+ </foreach>
+ from area where id=1
+ </select>
+
+ <select id="selectCardAchieve" resultType="java.util.TreeMap">
+ select
+ <foreach collection="list" index="index" item="item" separator="," >
+ (
+ select IFNULL(sum(zk_price),0) from sys_order_item a
+ inner join shopping_goods b on a.goods_id=b.id
+ inner join sys_order c on a.ORDER_ID=c.id
+ where b.good_type!='家居产品' and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]>
+ <if test="shopId != null">
+ and c.shop_id=#{shopId}
+ </if>
+ <if test="companyId != null">
+ and c.company_id=#{companyId}
+ </if>
+ ) as t${index}
+ </foreach>
+ from area where id=1
+ </select>
+
+ <select id="selectRepayment" resultType="java.util.TreeMap">
+ select
+ <foreach collection="list" index="index" item="item" separator="," >
+ (
+ select IFNULL(sum(amount),0) from sys_order_flow where flow_type = '还款' and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
+ <if test="shopId != null">
+ and shop_id=#{shopId}
+ </if>
+ <if test="companyId != null">
+ and company_id=#{companyId}
+ </if>
+ ) as t${index}
+ </foreach>
+ from area where id=1
+ </select>
+
+ <select id="selectPerCustomCnt" resultType="java.util.TreeMap">
+ select
+ <foreach collection="list" index="index" item="item" separator="," >
+ (
+ select IFNULL(count(1),0) from sys_order
+ where STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
+ <if test="shopId != null">
+ and shop_id=#{shopId}
+ </if>
+ <if test="companyId != null">
+ and company_id=#{companyId}
</if>
) as t${index}
</foreach>
@@ -191,15 +301,13 @@
select
<foreach collection="list" index="index" item="item" separator="," >
(
- select IFNULL(sum(cash_Pay), 0)
- from sys_order
- where STATU in ('退款')
- and <![CDATA[order_time > #{item.beginTime} and order_time < #{item.endTime} ]]>
- <if test="companyId != null and companyId != 0">
- and company_id=#{companyId}
+ select IFNULL(sum(amount),0) from sys_order_flow
+ where pay_method not in ('储值卡', '欠款') and flow_type = '退款' and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
+ <if test="shopId != null">
+ and shop_id=#{shopId}
</if>
- <if test="shopId !=null and shopId !=0 " >
- and SHOP_ID = #{shopId}
+ <if test="companyId != null">
+ and company_id=#{companyId}
</if>
) as t${index}
@@ -212,15 +320,13 @@
select
<foreach collection="list" index="index" item="item" separator="," >
(
- select IFNULL(sum(card_Pay), 0)
- from sys_order
- where STATU in ('退款')
- and <![CDATA[order_time > #{item.beginTime} and order_time < #{item.endTime} ]]>
- <if test="companyId != null and companyId != 0">
- and company_id=#{companyId}
+ select IFNULL(sum(amount),0) from sys_order_flow
+ where pay_method in ('储值卡') and flow_type = '退款' and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
+ <if test="shopId != null">
+ and shop_id=#{shopId}
</if>
- <if test="shopId !=null and shopId !=0 " >
- and SHOP_ID = #{shopId}
+ <if test="companyId != null">
+ and company_id=#{companyId}
</if>
) as t${index}
--
Gitblit v1.9.1