From 767ff70eb501aa6d870c2876a434670f38bd5ca9 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 18 Dec 2020 17:45:43 +0800
Subject: [PATCH] add vip consume java code
---
zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml | 76 +++++++++++++++++++++++++
zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java | 4 +
zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java | 8 ++
zq-erp/src/main/java/com/matrix/system/hive/service/AchieveNewService.java | 4 +
zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java | 10 +++
zq-erp/src/main/java/com/matrix/system/hive/statistics/VipStatisticsAction.java | 35 +++++++++++
6 files changed, 136 insertions(+), 1 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java
index cb92933..957fea2 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java
@@ -229,6 +229,8 @@
*/
private String meiliao;
+ private Integer arriveCnt;
+
@@ -252,6 +254,14 @@
@Extend
private Double achieveMoney;
+ public Integer getArriveCnt() {
+ return arriveCnt;
+ }
+
+ public void setArriveCnt(Integer arriveCnt) {
+ this.arriveCnt = arriveCnt;
+ }
+
public String getVipQueryKey() {
return vipQueryKey;
}
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java
index 01f07c0..f39cd28 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java
@@ -52,6 +52,8 @@
public List<AchieveNew> findSumDailyInfoNew(@Param("record") AchieveNew achieveNew, @Param("pageVo") PaginationVO pageVo);
-
+ List<AchieveNew> selectVipConsumeStatisticsList(@Param("record") AchieveNew achieveNew, @Param("pageVo") PaginationVO pageVo);
+
+ int selectVipConsumeStatisticsTotal(@Param("record") AchieveNew achieveNew);
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/AchieveNewService.java b/zq-erp/src/main/java/com/matrix/system/hive/service/AchieveNewService.java
index 09757e9..0b2ec73 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/AchieveNewService.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/AchieveNewService.java
@@ -8,6 +8,7 @@
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.hive.plugin.util.BaseServices;
+import org.apache.ibatis.annotations.Param;
/**
*
@@ -108,5 +109,8 @@
public void modifyAchieveTime(AchieveNew achieveNew);
+ List<AchieveNew> findVipConsumeStatisticsList(AchieveNew achieveNew, PaginationVO pageVo);
+
+ int findVipConsumeStatisticsTotal(AchieveNew achieveNew);
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
index 7211bb8..df7c66e 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
@@ -308,5 +308,13 @@
achieveNewDao.updateAchieveTime(achieveNew);
}
+ @Override
+ public List<AchieveNew> findVipConsumeStatisticsList(AchieveNew achieveNew, PaginationVO pageVo) {
+ return achieveNewDao.selectVipConsumeStatisticsList(achieveNew, pageVo);
+ }
+ @Override
+ public int findVipConsumeStatisticsTotal(AchieveNew achieveNew) {
+ return achieveNewDao.selectVipConsumeStatisticsTotal(achieveNew);
+ }
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/statistics/VipStatisticsAction.java b/zq-erp/src/main/java/com/matrix/system/hive/statistics/VipStatisticsAction.java
new file mode 100644
index 0000000..26641eb
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/hive/statistics/VipStatisticsAction.java
@@ -0,0 +1,35 @@
+package com.matrix.system.hive.statistics;
+
+import com.matrix.core.pojo.AjaxResult;
+import com.matrix.core.pojo.PaginationVO;
+import com.matrix.system.hive.bean.AchieveNew;
+import com.matrix.system.hive.service.AchieveNewService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * 客户数据统计
+ *
+ * @author wzy
+ * @date 2020-12-18
+ **/
+@Controller
+@RequestMapping(value = "/admin/vipStatistics")
+public class VipStatisticsAction {
+
+ @Autowired
+ private AchieveNewService achieveNewService;
+
+ @RequestMapping(value = "/vipConsumeStatistics")
+ @ResponseBody
+ public AjaxResult vipConsumeStatistics(AchieveNew achieveNew, PaginationVO pageVo) {
+ List<AchieveNew> list = achieveNewService.findVipConsumeStatisticsList(achieveNew, pageVo);
+ int total = achieveNewService.findVipConsumeStatisticsTotal(achieveNew);
+ return AjaxResult.buildSuccessInstance(list, total);
+ }
+}
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 e0e4c58..7340d74 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
@@ -48,6 +48,8 @@
<result property="meiliao" column="meiliao" />
<result property="zkTotal" column="zk_total" />
+ <result property="arriveCnt" column="arrive_cnt" />
+
</resultMap>
@@ -840,4 +842,78 @@
where 1=1
<include refid="where_sql"></include>
</select>
+
+
+ <select id="selectVipConsumeStatisticsList" resultMap="AchieveNewMap">
+ select
+ a.VIP_NAME,
+ d.cnt,
+ b.buyConsume,
+ b.freeConsume,
+ b.hisConsume
+ from sys_vip_info a
+ inner join (
+ select vip_id, sum(a.free_consume) freeConsume, sum(a.his_consume) hisConsume, sum(IFNULL(goods_cash, 0) + IFNULL(card_cash, 0)) buyConsume from achieve_new a group by vip_id
+ ) b on a.ID = b.vip_id
+ inner join (
+ select vip_id, count(1) cnt from (
+ select vip_id, date_format(datatime, '%Y-%m-%d')
+ from achieve_new
+ group by date_format(datatime, '%Y-%m-%d'), vip_id
+ ) c group by vip_id
+ ) d on a.ID=d.vip_id
+ where 1=1
+ <if test="record.vipName != null and record.vipName !=''">
+ and (a.vip_name like CONCAT(CONCAT('%', #{record.vipName}), '%') or a.vip_no=#{record.vipName})
+ </if>
+ <if test="record.shopId != null">
+ and a.shop_id=#{shopId}
+ </if>
+ <if test="record.beginTime != null and record.endTime!=null">
+ and date_format(datatime, '%Y-%m-%d') between #{record.beginTime} and #{record.endTime}
+ </if>
+
+ <if test="record.meiliao != null and record.meiliao!=''">
+ and FIND_IN_SET(#{record.meiliao}, a.BEATUY_ID)
+ </if>
+ <if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
+ <if test="pageVo.sort !=null and pageVo.order !=null">
+ order by
+ ${pageVo.sort} ${pageVo.order}
+ </if>
+ <if test="pageVo.offset >=0 and pageVo.limit >0">
+ limit
+ #{pageVo.offset},#{pageVo.limit}
+ </if>
+ </if>
+ </select>
+
+ <select id="selectVipConsumeStatisticsTotal" resultMap="AchieveNewMap">
+ select count(1)
+ from sys_vip_info a
+ inner join (
+ select vip_id, sum(a.free_consume) freeConsume, sum(a.his_consume) hisConsume, sum(IFNULL(goods_cash, 0) + IFNULL(card_cash, 0)) buyConsume from achieve_new a group by vip_id
+ ) b on a.ID = b.vip_id
+ inner join (
+ select vip_id, count(1) cnt from (
+ select vip_id, date_format(datatime, '%Y-%m-%d')
+ from achieve_new
+ group by date_format(datatime, '%Y-%m-%d'), vip_id
+ ) c group by vip_id
+ ) d on a.ID=d.vip_id
+ where 1=1
+ <if test="record.vipName != null and record.vipName !=''">
+ and (a.vip_name like CONCAT(CONCAT('%', #{record.vipName}), '%') or a.vip_no=#{record.vipName})
+ </if>
+ <if test="record.shopId != null">
+ and a.shop_id=#{shopId}
+ </if>
+ <if test="record.beginTime != null and record.endTime!=null">
+ and date_format(datatime, '%Y-%m-%d') between #{record.beginTime} and #{record.endTime}
+ </if>
+
+ <if test="record.meiliao != null and record.meiliao!=''">
+ and FIND_IN_SET(#{record.meiliao}, a.BEATUY_ID)
+ </if>
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.1