From c3a122ccd2b641d875873864055225064b190fbb Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期五, 07 六月 2024 14:48:58 +0800
Subject: [PATCH] 1.提交【管理后台】大屏操作台相关接口 2.提交【管理后台】营销管理-视频管理相关接口

---
 ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/MemberServiceImpl.java |   63 +++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/MemberServiceImpl.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/MemberServiceImpl.java
index aa8db91..e94b931 100644
--- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/MemberServiceImpl.java
+++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/MemberServiceImpl.java
@@ -30,8 +30,10 @@
 import com.ruoyi.member.controller.management.dto.MgtMemberQuery;
 import com.ruoyi.member.controller.management.vo.MgtMemberPointsVO;
 import com.ruoyi.member.controller.management.vo.MgtMemberVO;
+import com.ruoyi.member.domain.MemberLevel;
 import com.ruoyi.member.mapper.MemberMapper;
 import com.ruoyi.member.service.IMemberPointsService;
+import com.ruoyi.member.service.IMemberLevelService;
 import com.ruoyi.member.service.IMemberService;
 import com.ruoyi.member.util.HttpUtils;
 import com.ruoyi.system.api.RemoteUserService;
@@ -40,11 +42,14 @@
 import com.ruoyi.system.api.domain.Member;
 import com.ruoyi.system.api.domain.MemberPoints;
 import com.ruoyi.system.api.domain.SysUser;
+import com.ruoyi.system.api.domain.dto.*;
+
 import com.ruoyi.system.api.domain.dto.AppMiniLoginDTO;
 import com.ruoyi.system.api.domain.dto.MemberDTO;
 import com.ruoyi.system.api.domain.dto.MobileDTO;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
 import java.net.URLEncoder;
 import java.util.HashMap;
 import java.util.List;
@@ -52,6 +57,7 @@
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import javax.annotation.Resource;
+
 import org.apache.commons.io.IOUtils;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
@@ -128,7 +134,13 @@
     private RedisService redisService;
 
     @Resource
+    private IMemberLevelService iMemberLevelService;
+
+
+    @Resource
     private IMemberPointsService memberPointsService;
+
+
     @Override
     public AppMiniLoginVO loginThird(AppMiniLoginDTO appMiniLoginDto) throws Exception {
         AppMiniLoginVO appMiniLoginVo = new AppMiniLoginVO();
@@ -494,6 +506,57 @@
         return PageDTO.of(page, MgtMemberVO.class);
     }
 
+    @Override
+    public void updMembeOne(updMembeOneDTO dMembeOneDTO) {
+        Member byId = this.getById(dMembeOneDTO.getMemberId());
+        if (dMembeOneDTO.getMoney()!=null){
+            if (dMembeOneDTO.getType()==1){
+                BigDecimal big=byId.getMoney().add(dMembeOneDTO.getMoney());
+                byId.setMoney(big);
+            }else {
+                BigDecimal big=byId.getMoney().subtract(dMembeOneDTO.getMoney());
+                byId.setMoney(big);
+            }
+        }  if (dMembeOneDTO.getTotalPoints()!=null){
+            if (dMembeOneDTO.getType()==1){
+                Integer big=byId.getTotalPoints()+dMembeOneDTO.getTotalPoints();
+                byId.setTotalPoints(big);
+            }else {
+                Integer big=byId.getTotalPoints()-dMembeOneDTO.getTotalPoints();
+                byId.setTotalPoints(big);
+            }
+        }
+        this.updateById(byId);
+
+        List<MemberLevel> list = iMemberLevelService.list();
+        for (int i=0;i<list.size();i++){
+            if (i==0){
+                int ia = byId.getMoney().compareTo(list.get(0).getCumulativeConsumption());
+                if (ia<0){
+                    byId.setLevel(0);
+                    break;
+                }
+            }
+            if (i==list.size()-1){
+                BigDecimal cumulative = list.get(i - 1).getCumulativeConsumption();
+                BigDecimal cumulative1 = list.get(i).getCumulativeConsumption();
+                if (cumulative.compareTo(byId.getMoney()) <= 0 && cumulative1.compareTo(byId.getMoney()) >= 0) {
+                    byId.setLevel(list.get(i).getLevel());
+                }else{
+                    byId.setLevel(list.get(i).getLevel());
+                }
+            }else {
+                BigDecimal cumulative = list.get(i - 1).getCumulativeConsumption();
+                BigDecimal cumulative1 = list.get(i).getCumulativeConsumption();
+                if (cumulative.compareTo(byId.getMoney()) <= 0 && cumulative1.compareTo(byId.getMoney()) >= 0) {
+                    byId.setLevel(list.get(i).getLevel());
+                }
+            }
+
+        }
+
+    }
+
     /**
      * 获取用户详情
      *

--
Gitblit v1.7.1