From 321d1fae7dbd5b399d8df3491ef60a8ea2575451 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Sun, 27 Dec 2020 10:53:41 +0800
Subject: [PATCH] Merge branch 'ty_urgent' into api

---
 zq-erp/src/main/java/com/matrix/system/hive/dao/MoneyCardUseDao.java                     |    1 
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html                |    1 
 zq-erp/src/main/resources/mybatis/mapper/hive/SysStoreInfoDao.xml                        |    6 +++
 zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml                          |   22 ++++++++---
 zq-erp/src/main/java/com/matrix/system/job/InvalidTimeJob.java                           |   48 ++++++++++++++++++++++++
 zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml                          |    5 ++
 zq-erp/src/main/resources/templates/views/admin/hive/statistics/custom-consume-list.html |    6 +++
 zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjUseDao.java                       |    2 +
 zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardUseDao.xml                        |    4 ++
 9 files changed, 89 insertions(+), 6 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/MoneyCardUseDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/MoneyCardUseDao.java
index c989c1f..d0d0ad3 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/dao/MoneyCardUseDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/MoneyCardUseDao.java
@@ -84,5 +84,6 @@
 	public Double  selectVipCardTotalMoney(@Param("vipId") Long vipId);
 
 
+	List<MoneyCardUse> selectHasValidMoneyCardUse();
     
 }
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjUseDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjUseDao.java
index 58dc577..faf7254 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjUseDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjUseDao.java
@@ -122,4 +122,6 @@
 
 
 	public int updateTcStatus(@Param("id") Long id, @Param("status") String status);
+
+	List<SysProjUse> selectHasValidProjUse();
 }
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/job/InvalidTimeJob.java b/zq-erp/src/main/java/com/matrix/system/job/InvalidTimeJob.java
new file mode 100644
index 0000000..2cd048a
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/job/InvalidTimeJob.java
@@ -0,0 +1,48 @@
+package com.matrix.system.job;
+
+import com.matrix.system.constance.Dictionary;
+import com.matrix.system.hive.bean.MoneyCardUse;
+import com.matrix.system.hive.bean.SysProjUse;
+import com.matrix.system.hive.dao.MoneyCardUseDao;
+import com.matrix.system.hive.dao.SysProjUseDao;
+import com.matrix.system.hive.plugin.util.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @author wzy19
+ */
+@Component
+public class InvalidTimeJob {
+
+    @Autowired
+    private SysProjUseDao sysProjUseDao;
+
+    @Autowired
+    private MoneyCardUseDao moneyCardUseDao;
+
+
+    @Scheduled(cron = "0 0 0 * * ?")
+    public void setProjUseToInvalid() {
+        List<SysProjUse> sysProjUses = sysProjUseDao.selectHasValidProjUse();
+
+        List<MoneyCardUse> moneyCardUses = moneyCardUseDao.selectHasValidMoneyCardUse();
+
+        if (CollectionUtils.isNotEmpty(sysProjUses)) {
+            sysProjUses.forEach(item -> {
+                item.setStatus(Dictionary.MONEYCARD_STATUS_WX);
+                sysProjUseDao.update(item);
+            });
+        }
+
+        if (CollectionUtils.isNotEmpty(moneyCardUses)) {
+            moneyCardUses.forEach(item -> {
+                item.setStatus(Dictionary.MONEYCARD_STATUS_WX);
+                moneyCardUseDao.update(item);
+            });
+        }
+    }
+}
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 59d13de..1994fd2 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
@@ -873,12 +873,17 @@
 		<if test="record.shopId != null">
 			and a.shop_id=#{record.shopId}
 		</if>
-		<if test="record.beginTime != null and record.endTime!=null">
-			and date_format(b.datatime, '%Y-%m-%d') between #{record.beginTime} and #{record.endTime}
+		<if test="record.beginTime != null">
+			and date_format(b.datatime, '%Y-%m-%d') >= date_format(#{record.beginTime}, '%Y-%m-%d')
 		</if>
-
+		<if test="record.endTime!=null">
+			and date_format(b.datatime, '%Y-%m-%d') >= date_format(#{record.endTime}, '%Y-%m-%d')
+		</if>
 		<if test="record.beaultId != null and record.beaultId!=''">
 			and FIND_IN_SET(#{record.beaultId}, a.BEATUY_ID)
+		</if>
+		<if test='record.t1 == "on"'>
+			and a.BEATUY_ID is not null
 		</if>
 		group by a.PHONE
 		<if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
@@ -915,13 +920,18 @@
 		<if test="record.shopId != null">
 			and a.shop_id=#{record.shopId}
 		</if>
-		<if test="record.beginTime != null and record.endTime!=null">
-			and date_format(b.datatime, '%Y-%m-%d') between #{record.beginTime} and #{record.endTime}
+		<if test="record.beginTime != null">
+			and date_format(b.datatime, '%Y-%m-%d') >= date_format(#{record.beginTime}, '%Y-%m-%d')
 		</if>
-
+		<if test="record.endTime!=null">
+			and date_format(b.datatime, '%Y-%m-%d') >= date_format(#{record.endTime}, '%Y-%m-%d')
+		</if>
 		<if test="record.beaultId != null and record.beaultId!=''">
 			and FIND_IN_SET(#{record.beaultId}, a.BEATUY_ID)
 		</if>
+		<if test='record.t1 == "on"'>
+			and a.BEATUY_ID is not null
+		</if>
 	</select>
 
 
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardUseDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardUseDao.xml
index b632b39..94d6c2d 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardUseDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardUseDao.xml
@@ -616,4 +616,8 @@
     </select>
 
 
+    <select id="selectHasValidMoneyCardUse" resultMap="MoneyCardUseSimpleMap">
+        select * from money_card_use
+        where date_format(now(), '%Y-%m-%d') > date_format(FAIL_TIME, '%Y-%m-%d') and STATUS='有效'
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml
index fee7b2f..90f8a1c 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml
@@ -727,4 +727,9 @@
         group by b.id) t
     </select>
 
+    <select id="selectHasValidProjUse" resultMap="SysProjUseMap">
+        select * from sys_proj_use
+        where date_format(now(), '%Y-%m-%d') > date_format(FAIL_TIME, '%Y-%m-%d') and STATUS='有效'
+    </select>
+
 </mapper>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysStoreInfoDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysStoreInfoDao.xml
index df354d5..8a8975c 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysStoreInfoDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysStoreInfoDao.xml
@@ -813,6 +813,9 @@
 			<if test=" record.endTime!=null  ">
 				<![CDATA[ 	and #{record.endTime} >=b.create_time]]>
 			</if>
+			<if test="record.companyId != null and record.companyId !='' ">
+				and	b.company_id = #{record.companyId}
+			</if>
 		</where>
 		UNION ALL
 		SELECT
@@ -848,6 +851,9 @@
 			<if test=" record.endTime!=null   ">
 				<![CDATA[ 	and #{record.endTime} >= t2_b.create_time  ]]>
 			</if>
+			<if test="record.companyId != null and record.companyId !='' ">
+				and	t2_b.company_id = #{record.companyId}
+			</if>
 		</where>
 		) t
 
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
index 52b161d..dfaf184 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
@@ -777,6 +777,7 @@
                     _this.serviceOrderTableQueryFn();
                     _this.orderTableDataQueryFn();
                     _this.skinCheckTableDataQueryFn();
+                    _this.refreshTable();
                 });
             },
             addLabelFn(key) {
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/statistics/custom-consume-list.html b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/custom-consume-list.html
index bef3210..05550de 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/statistics/custom-consume-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/custom-consume-list.html
@@ -53,6 +53,12 @@
 				</select>
 			</div>
 
+			<div class="form-group mr-20">
+				<label>
+				<input type="checkbox" name="t1"> 指定客
+				</label>
+			</div>
+
 			<div class="row mb-10">
 				<div class="col-sm-8">
 					<button  onclick="myGrid.serchData()" type="button" class="btn btn-info btn-sm"><i class="fa fa-search" ></i> 搜索</button>

--
Gitblit v1.9.1