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; } 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); } 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); } 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); } } zq-erp/src/main/java/com/matrix/system/hive/statistics/VipStatisticsAction.java
New file @@ -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); } } 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>