From 360a7cd8c931c401972655e1b22935c79d457544 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 11 Nov 2021 17:28:11 +0800
Subject: [PATCH] fix

---
 zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-beauty-list.html |   15 ++++---
 zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml                        |   30 +++++++++-----
 zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java                     |    2 +
 zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java     |    9 ++++
 zq-erp/src/main/java/com/matrix/system/hive/vo/DailyBeautyListVo.java                  |    6 +++
 5 files changed, 43 insertions(+), 19 deletions(-)

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 a1e0e1b..ec7c010 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
@@ -97,4 +97,6 @@
 
 	List<DailyBeautyListVo> selectDailyBeautyList(@Param("record") AchieveNew achieveNew, @Param("pageVo") PaginationVO pageVo);
 	int selectDailyBeautyListTotal(@Param("record") AchieveNew achieveNew);
+
+	String selectPlInfoByVipIdAndDate(@Param("datatime") Date datatime, @Param("vipId") Long vipId);
 }
\ 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 f7232e0..f23d9a1 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
@@ -473,7 +473,14 @@
 
     @Override
     public List<DailyBeautyListVo> findDailyBeautyList(AchieveNew achieveNew, PaginationVO pageVo) {
-        return achieveNewDao.selectDailyBeautyList(achieveNew, pageVo);
+        List<DailyBeautyListVo> list = achieveNewDao.selectDailyBeautyList(achieveNew, pageVo);
+        if (CollUtil.isNotEmpty(list)) {
+            for (DailyBeautyListVo item : list) {
+                String pl = achieveNewDao.selectPlInfoByVipIdAndDate(item.getDatatime(), item.getVipId());
+                item.setProjInfo(pl);
+            }
+        }
+        return list;
     }
 
     @Override
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/vo/DailyBeautyListVo.java b/zq-erp/src/main/java/com/matrix/system/hive/vo/DailyBeautyListVo.java
index f74f5bc..37a969d 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/vo/DailyBeautyListVo.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/vo/DailyBeautyListVo.java
@@ -16,6 +16,8 @@
 
     private String vipName;
 
+    private Long vipId;
+
     private int isAppoint;
 
     private String arrivalWay;
@@ -36,9 +38,13 @@
 
     private BigDecimal cardPay;
 
+    private BigDecimal cashPay;
+
     private BigDecimal consume;
 
     private Integer projCnt;
 
     private BigDecimal ticheng;
+
+    private String projInfo;
 }
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 091ac7f..0e05a28 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
@@ -1251,7 +1251,7 @@
 			case when c.BEATUY_ID=a.su_id then 1 else 0 end isAppoint,
 			(select count(distinct date_format(n.datatime, '%Y-%m-%d')) from achieve_new n
 			 where date_format(b.datatime, '%Y-%m') = date_format(n.datatime, '%Y-%m') and n.vip_id=c.ID
-			 group by date_format(n.datatime, '%Y-%m-%d'))arriveCnt,
+			 group by date_format(n.datatime, '%Y-%m'))arriveCnt,
 			(select count(1) from sys_order o where o.statu in ('欠款', '已付款') and o.VIP_ID=c.id)  orderCnt,
 			(select group_concat(distinct q.pay_method) payMethod from sys_order p
 			   inner join sys_order_flow q on p.ID=q.ORDER_ID
@@ -1278,21 +1278,20 @@
 				 inner join achieve_new y on x.order_id=y.order_id
 			 where x.pay_method='储值卡' and date_format(x.create_time, '%Y-%m-%d') = date_format(b.datatime, '%Y-%m-%d')
 			   and y.beault_id=a.su_id and x.vip_id=c.id) cardPay,
+			(select sum(amount) from sys_order_flow x
+				inner join achieve_new y on x.order_id=y.order_id
+			 where x.pay_method not in ('储值卡','欠款') and date_format(x.create_time, '%Y-%m-%d') = date_format(b.datatime, '%Y-%m-%d')
+				and y.beault_id=a.su_id and x.vip_id=c.id) cashPay,
+			(select sum(e.goods_cash) from achieve_new e
+				inner join shopping_goods f on e.shopping_goods_id=f.id and f.is_cooperate=1
+			 where e.order_type='订单' and date_format(e.datatime, '%Y-%m-%d') = date_format(b.datatime, '%Y-%m-%d')
+				and e.beault_id=a.su_id and e.vip_id=c.id) cooperateProj,
 			sum(proj_percentage) ticheng,
 			sum(IFNULL(free_consume,0) + IFNULL(his_consume,0)) consume,
-			(select count(1) from achieve_new z where z.beault_id=a.su_id and c.id=z.vip_id group by z.beault_id,z.vip_id) projCnt
+			(select count(1) from achieve_new z where z.beault_id=a.su_id and c.id=z.vip_id and z.order_type='服务单' group by z.beault_id,z.vip_id) projCnt
 		from sys_users a
 			 left join achieve_new b on a.su_id=b.beault_id
 			 left join sys_vip_info c on b.vip_id=c.ID
-			 left join (
-					select x.vip_id, count(1) arriveCnt
-					from (
-							 select vip_id, date_format(datatime, '%Y-%m-%d')
-							 from achieve_new
-							 where date_format(curdate(), '%Y-%m') = date_format(datatime, '%Y-%m')
-							 group by date_format(datatime, '%Y-%m-%d'), vip_id
-						 ) x group by x.vip_id
-		) d on c.id=d.vip_id
 		where 1=1
 		<if test="record.companyId != null">
 		 and a.company_id=#{record.companyId}
@@ -1364,4 +1363,13 @@
 			 group by date_format(b.datatime, '%Y-%m-%d'), a.su_id, c.ID
 		) a
 	</select>
+
+	<select id="selectPlInfoByVipIdAndDate" resultType="java.lang.String">
+		select group_concat(concat(name,'*', bb))
+		from (select l.name name, 0+CAST(sum(n.amount) as char) bb from sys_out_store m
+		 inner join sys_out_store_item n on m.id=n.OUT_STORE_ID
+		 inner join shopping_goods l on n.SKU_ID=l.id
+	   where m.SERVICE_ID in (select distinct service_order_id from achieve_new where date_format(datatime, '%Y-%m-%d') = date_format(#{datatime}, '%Y-%m-%d') and vip_id=#{vipId})
+	   group by l.id) a
+	</select>
 </mapper>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-beauty-list.html b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-beauty-list.html
index b2e5261..ddbb101 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-beauty-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-beauty-list.html
@@ -73,7 +73,7 @@
 					<span v-else>否</span>
 				</template>
 			</el-table-column>
-			<el-table-column label="客流">
+			<el-table-column label="客流" align="center">
 				<el-table-column prop="orderCnt" label="是否会员">
 					<template slot-scope="scope">
 						<span v-if="scope.row.orderCnt > 0">是</span>
@@ -83,20 +83,20 @@
 				<el-table-column prop="arrivalWay" label="到店途径"></el-table-column>
 				<el-table-column prop="arriveCnt" label="当月到店次数" width="120"></el-table-column>
 			</el-table-column>
-			<el-table-column label="实操业绩">
-				<el-table-column prop="orderType" label="项目->消耗产品" width="130"></el-table-column>
+			<el-table-column label="实操业绩" align="center">
+				<el-table-column prop="projInfo" label="项目->消耗产品" width="230"></el-table-column>
 				<el-table-column prop="projCnt" label="项目数量"></el-table-column>
 				<el-table-column prop="ticheng" label="手工费"></el-table-column>
 				<el-table-column prop="consume" label="耗卡"></el-table-column>
 			</el-table-column>
-			<el-table-column label="现金业绩">
-				<el-table-column prop="payMethods" label="消费类型"></el-table-column>
+			<el-table-column label="现金业绩" align="center">
+				<el-table-column prop="payMethods" label="消费类型"  width="200"></el-table-column>
 				<el-table-column prop="orderType" label="特色项目"></el-table-column>
 				<el-table-column prop="teamPay" label="团购销售"></el-table-column>
 				<el-table-column prop="tcAndProjCash" label="卡项销售"></el-table-column>
 				<el-table-column prop="productCash" label="产品销售"></el-table-column>
 				<el-table-column prop="cardCash" label="会员充值"></el-table-column>
-				<el-table-column prop="orderType" label="总业绩"></el-table-column>
+				<el-table-column prop="cashPay" label="总业绩"></el-table-column>
 				<el-table-column prop="cardPay" label="划卡"></el-table-column>
 			</el-table-column>
 		</el-table>
@@ -136,7 +136,6 @@
 		},
 		created : function() {
 			this.queryTableData();
-			this.queryAchieveUsers();
 		},
 		methods : {
 			queryTableData() {
@@ -160,6 +159,8 @@
 					callback: function (loj) {
 						_this.tableData = loj.rows;
 						_this.page.total = loj.total;
+
+						_this.queryAchieveUsers();
 					}
 				});
 			},

--
Gitblit v1.9.1