From cf9bfc85093d4b7e5573422b8fd1a55c459b0d34 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 03 Mar 2022 16:12:10 +0800
Subject: [PATCH] Merge branch 'developer'

---
 zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml                 |    5 ++
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java      |   13 ++++++
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxErpOrderAction.java |    6 +++
 zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java       |   19 +++++++++
 zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java                |   15 +++++++
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java     |   14 ++++++-
 zq-erp/src/main/resources/templates/views/admin/hive/vip/vipInfo-list.html      |   24 +++++++++++
 7 files changed, 93 insertions(+), 3 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java
index 64ae132..d71a0a0 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java
@@ -640,4 +640,23 @@
     public String toImportForm() {
         return "admin/hive/vip/vipImport-form";
     }
+
+    @RequestMapping(value = "/validFlagChange")
+    @ResponseBody
+    public AjaxResult validFlagChange(Long id) {
+        SysVipInfo sysVipInfo = vipInfoService.findById(id);
+
+        if (sysVipInfo == null) {
+            return AjaxResult.buildFailInstance("用户不存在");
+        }
+
+        if (SysVipInfo.VALID_FLAG_Y == sysVipInfo.getValidFlag()) {
+            sysVipInfo.setValidFlag(SysVipInfo.VALID_FLAG_N);
+        } else {
+            sysVipInfo.setValidFlag(SysVipInfo.VALID_FLAG_Y);
+        }
+
+        vipInfoService.modify(sysVipInfo);
+        return AjaxResult.buildSuccessInstance("设置成功");
+    }
 }
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java
index 09224d4..2fafe6a 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java
@@ -40,6 +40,16 @@
 	public static final int UNDEAL_VIP = 2;
 
 	/**
+	 * 生效
+	 */
+	public static final int VALID_FLAG_Y = 1;
+
+	/**
+	 * 失效
+	 */
+	public static final int VALID_FLAG_N = 2;
+
+	/**
 	 * 会员助记码
 	 */
 	private String zjm;
@@ -440,5 +450,10 @@
 
 	private BigDecimal arrears;
 
+	/**
+	 * 生效标识 1-生效 2-失效
+	 */
+	private Integer validFlag;
+
 
 }
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxErpOrderAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxErpOrderAction.java
index e127ce4..78a6730 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxErpOrderAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxErpOrderAction.java
@@ -75,6 +75,12 @@
         SysVipInfo vipInfo = userCacheManager.getLoginUser();
         
         erpOrderListDto.setVipId(vipInfo.getId());
+
+        SysVipInfo sysVipInfo = vipInfoDao.selectById(vipInfo.getId());
+        if (sysVipInfo.getValidFlag() == SysVipInfo.VALID_FLAG_N) {
+            return AjaxResult.buildSuccessInstance(new ArrayList<>(), "查询成功");
+        }
+
         List<ErpOrderDetailVo> rows = sysOrderDao.selectErpOrderList(erpOrderListDto);
         rows.forEach(item -> {
             item.setItems(orderItemDao.selectErpOrderItemByOrderId(item.getOrderId()));
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java
index e07d511..8916a52 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java
@@ -1,6 +1,7 @@
 package com.matrix.system.shopXcx.api.action;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.matrix.system.common.constance.AppConstance;
 import com.matrix.system.common.init.UserCacheManager;
@@ -159,8 +160,17 @@
     AjaxResult findUserInfo() {
         SysVipInfo loginUser = userCacheManager.getLoginUser();
         SysVipInfo sysVipInfo = sysVipInfoService.findById(loginUser.getId());
-        sysVipInfo.setPointAll(scoreVipDetailDao.selectUserTotalScore(loginUser.getId()));
-        sysVipInfo.setBalance(moneyCardUseDao.selectVipCardTotalMoney(loginUser.getId()));
+
+        if (sysVipInfo != null) {
+            if (SysVipInfo.VALID_FLAG_Y == sysVipInfo.getValidFlag()) {
+                sysVipInfo.setBalance(moneyCardUseDao.selectVipCardTotalMoney(loginUser.getId()));
+                sysVipInfo.setPointAll(scoreVipDetailDao.selectUserTotalScore(loginUser.getId()));
+            } else {
+                sysVipInfo.setBalance(0D);
+                sysVipInfo.setPointAll(0);
+            }
+        }
+
         AjaxResult res = new AjaxResult();
         res.putInMap("couponCount", shopCouponRecordDao.countUnuseCouponRecord(loginUser.getId()));
         res.putInMap("prizeCount", activitySignReceiveRecordDao.getSignAwardReceiveCount(loginUser.getId(), loginUser.getCompanyId()));
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java
index 4e958b3..19fc17f 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java
@@ -225,6 +225,13 @@
         if (vipInfo == null) {
             throw new GlobleException("会员不存在");
         }
+
+        if (SysVipInfo.VALID_FLAG_N == vipInfo.getValidFlag()) {
+            AjaxResult ajaxResult = AjaxResult.buildSuccessInstance(new ArrayList<>(), "获取成功");
+            ajaxResult.putInMap("proj", new ServiceProductListVo());
+            return ajaxResult;
+        }
+
         ServiceProductListVo productListVo = new ServiceProductListVo();
         productListVo.setName(vipInfo.getVipName());
         productListVo.setVipId(vipInfo.getId());
@@ -366,6 +373,12 @@
     public AjaxResult findServiceOrderList(@RequestBody @Validated ErpServiceOrderListDto orderListDto) {
         SysVipInfo sysVipInfo = userCacheManager.getLoginUser();
         orderListDto.setVipId(sysVipInfo.getId());
+
+        SysVipInfo vipInfo = sysVipInfoDao.selectById(sysVipInfo.getId());
+        if (SysVipInfo.VALID_FLAG_N == vipInfo.getValidFlag()) {
+            return AjaxResult.buildSuccessInstance(new ArrayList<>(), "查询成功");
+        }
+
         List<ErpServiceOrderListVo> apiServiceOrderListInPage = projServicesDao.findWxServiceOrderList(orderListDto);
         return AjaxResult.buildSuccessInstance(apiServiceOrderListInPage,"查询成功");
     }
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml
index ae9ebb7..b23d511 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml
@@ -61,6 +61,7 @@
         <result property="country" column="country" />
         <result property="sessionKey" column="session_key" />
         <result property="userIsAuthorize" column="user_is_authorize" />
+        <result property="validFlag" column="valid_flag" />
 
         <!-- 扩展属性 -->
         <result property="staffName" column="STAFF_NAME"/>
@@ -124,6 +125,7 @@
         <result property="country" column="country" />
         <result property="sessionKey" column="session_key" />
         <result property="userIsAuthorize" column="user_is_authorize" />
+        <result property="validFlag" column="valid_flag" />
 
         <!-- 扩展属性 -->
         <result property="staffName" column="STAFF_NAME"/>
@@ -537,6 +539,9 @@
             <if test="avatarUrl != null and avatarUrl != '' ">
                 avatar_url  = #{avatarUrl},
             </if>
+            <if test="validFlag != null and validFlag != '' ">
+                valid_flag  = #{validFlag},
+            </if>
 
 
         </set>
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/vip/vipInfo-list.html b/zq-erp/src/main/resources/templates/views/admin/hive/vip/vipInfo-list.html
index 2ad4dad..38879ce 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/vip/vipInfo-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/vip/vipInfo-list.html
@@ -174,7 +174,14 @@
     btns[0]="";
     function buildOperation(value, row, index) {
         var html = "";
+        var desc;
+        if (row.validFlag == 1) {
+            desc = "失效";
+        } else {
+            desc = "生效";
+        }
         html += '<a class="text-info" href="javascript:void(0)" onClick="openVipDetail(\''+row.phone+'\')">查看详情</a>&nbsp;&nbsp;'
+        + btns[0].replace("VALUE", row.id).replace("FLAG", row.validFlag).replace("DESC", desc);
         return html;
     }
 
@@ -407,7 +414,22 @@
         window.location.href=basePath+"/admin/vipInfo/exportExcel?"+param;
     }
 
-</script>
+    function vipInfoValid(id, validFlag) {
+        var desc;
+        if (validFlag == 1) {
+            desc = "确认要设置用户为失效吗?";
+        } else {
+            desc = "确认要设置用户为生效吗?";
+        }
+        MTools.handleItem(
+            basePath + '/admin/vipInfo/validFlagChange?id=' + id, desc, function () {
+                myGrid.serchData();
+            });
+    }
 
+</script>
+<script matrix:btn="vipInfo-youxiao">
+    btns[0]='<a class="text-info" href="javascript:void(0)" onClick="vipInfoValid(\'VALUE\', \'FLAG\')" >DESC</a>&nbsp;&nbsp;'
+</script>
 </body>
 </html>

--
Gitblit v1.9.1