From 241a49f9653aa83d1dcd9bf646208da3157df35a Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Mon, 05 Apr 2021 22:48:14 +0800
Subject: [PATCH] 合并BizUser表与SysVipInfo表 大部分逻辑已经修正 可能存在问题的 1、拼团秒杀 2、分享图 3、分销结算

---
 zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java |   58 +++++++++++++++-------------------------------------------
 1 files changed, 15 insertions(+), 43 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java b/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java
index 569cd35..1c36562 100644
--- a/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java
+++ b/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java
@@ -3,7 +3,6 @@
 import cn.hutool.core.date.DateTime;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.matrix.biz.dao.BizUserDao;
 import com.matrix.core.constance.MatrixConstance;
 import com.matrix.core.exception.GlobleException;
 import com.matrix.core.tools.DateUtil;
@@ -39,7 +38,7 @@
     ScoreUseRecordDao scoreUseRecordDao;
 
     @Autowired
-    BizUserDao bizUserDao;
+    SysVipInfoDao sysVipInfoDao;
 
     @Autowired
     SysVipInfoDao vipInfoDao;
@@ -54,21 +53,15 @@
      * 扣除用户积分
      */
     @Transactional(rollbackFor = Exception.class)
-    public void deductionScore(String openId, Long vipId,Long oprationUserId,Long shopId, Integer score, Long businessId, int type,String remark) {
-        Long companyId=null;
-        if(openId!=null){
-            companyId= bizUserDao.findByOpenId(openId).getCompanyId();
-        }else if(vipId!=null){
-            companyId= vipInfoDao.selectById(vipId).getCompanyId();
-        }else{
-            throw new IllegalArgumentException("vipId,openId必须有一个");
-        }
+    public void deductionScore(Long vipId,Long oprationUserId,Long shopId, Integer score, Long businessId, int type,String remark) {
+        Long companyId= vipInfoDao.selectById(vipId).getCompanyId();
+
         String createBy=MatrixConstance.SYSTEM_USER;
         if(oprationUserId!=null){
             createBy=sysUsersDao.selectById(oprationUserId).getSuName();
         }
 
-        List<ScoreVipDetail> effectiveScoreList = scoreVipDetailDao.selectEffectiveScore(openId,vipId);
+        List<ScoreVipDetail> effectiveScoreList = scoreVipDetailDao.selectEffectiveScore(vipId);
 
         for (ScoreVipDetail scoreVipDetail : effectiveScoreList) {
 
@@ -109,7 +102,6 @@
             scoreUseRecord.setRecNum(-currentDedution);
             scoreUseRecord.setType(type);
             scoreUseRecord.setShopId(shopId);
-            scoreUseRecord.setOpenId(openId);
             scoreUseRecord.setVipId(vipId);
             scoreUseRecord.setRemarks(remark);
             scoreUseRecord.setOprationUserId(oprationUserId);
@@ -128,15 +120,9 @@
      * 新增用户积分
      */
     @Transactional(rollbackFor = Exception.class)
-    public void addScore(String openId, Long vipId, Long oprationUserId,Long shopId, Integer score, Long businessId, int type,String remark) {
-        Long companyId=null;
-        if(openId!=null){
-            companyId= bizUserDao.findByOpenId(openId).getCompanyId();
-        }else if(vipId!=null){
-            companyId= vipInfoDao.selectById(vipId).getCompanyId();
-        }else{
-            throw new IllegalArgumentException("vipId,openId必须有一个");
-        }
+    public void addScore(Long vipId, Long oprationUserId,Long shopId, Integer score, Long businessId, int type,String remark) {
+        Long companyId= vipInfoDao.selectById(vipId).getCompanyId();
+
         if(score<0){
             throw new IllegalArgumentException("score必须有为大于零的数");
         }
@@ -164,7 +150,6 @@
         scoreVipDetail.setUsedScore(0);
         scoreVipDetail.setBusinessId(businessId);
         scoreVipDetail.setValiditeTime(sxys);
-        scoreVipDetail.setOpenId(openId);
         scoreVipDetail.setVipId(vipId);
         scoreVipDetail.setGainTime(DateTime.now());
         scoreVipDetail.setAllScore(score);
@@ -185,7 +170,6 @@
         scoreUseRecord.setBusinessId(businessId);
         scoreUseRecord.setRecNum(score);
         scoreUseRecord.setType(type);
-        scoreUseRecord.setOpenId(openId);
         scoreUseRecord.setVipId(vipId);
         scoreUseRecord.setShopId(shopId);
         scoreUseRecord.setOprationUserId(oprationUserId);
@@ -198,19 +182,13 @@
     /**
      * 退积分
      */
-    public void refundScore(String openId, Long vipId, Integer score, Long oldBusinessId, int type){
-        Long companyId=null;
-        if(openId!=null){
-            companyId= bizUserDao.findByOpenId(openId).getCompanyId();
-        }else if(vipId!=null){
-            companyId= vipInfoDao.selectById(vipId).getCompanyId();
-        }else{
-            throw new IllegalArgumentException("vipId,openId必须有一个");
-        }
+    public void refundScore(Long vipId, Integer score, Long oldBusinessId, int type){
+
+        Long companyId= vipInfoDao.selectById(vipId).getCompanyId();
+
         if(score<0){
             throw new IllegalArgumentException("score必须有为大于零的数");
         }
-
         //查询原始使用记录
         QueryWrapper queryWrapper=new QueryWrapper();
         queryWrapper.eq("business_id",oldBusinessId);
@@ -233,15 +211,9 @@
         });
     }
 
-    public void removeByBusinessId(String openId, Long vipId,  Long oldBusinessId){
-        Long companyId=null;
-        if(openId!=null){
-            companyId= bizUserDao.findByOpenId(openId).getCompanyId();
-        }else if(vipId!=null){
-            companyId= vipInfoDao.selectById(vipId).getCompanyId();
-        }else{
-            throw new IllegalArgumentException("vipId,openId必须有一个");
-        }
+    public void removeByBusinessId( Long vipId,  Long oldBusinessId){
+        Long companyId= vipInfoDao.selectById(vipId).getCompanyId();
+
         if(oldBusinessId==null){
             throw new IllegalArgumentException("oldBusinessId必须有");
         }

--
Gitblit v1.9.1