From 257d66798aa538f8737980f13d94c547bf0b51ea Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期三, 15 一月 2025 15:37:15 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java | 205 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 195 insertions(+), 10 deletions(-)
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java
index 3a37e7b..8811191 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java
@@ -1,23 +1,28 @@
package com.ruoyi.other.controller;
-import com.ruoyi.account.api.model.AppUser;
+import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.security.service.TokenService;
+import com.ruoyi.other.api.domain.BaseSetting;
+import com.ruoyi.other.api.domain.Goods;
+import com.ruoyi.other.api.domain.VipGood;
import com.ruoyi.other.api.domain.VipSetting;
+import com.ruoyi.other.api.feignClient.GoodsClient;
+import com.ruoyi.other.dto.SetDto;
+import com.ruoyi.other.dto.VipSetDto;
+import com.ruoyi.other.service.BaseSettingService;
+import com.ruoyi.other.service.VipGoodService;
import com.ruoyi.other.service.VipSettingService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
-import com.ruoyi.common.core.domain.R;
-import com.ruoyi.other.api.domain.VipSetting;
-import com.ruoyi.other.service.VipSettingService;
import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.ArrayList;
import java.util.List;
-
-import javax.annotation.Resource;
/**
* <p>
@@ -33,18 +38,198 @@
public class VipSettingController {
@Resource
private VipSettingService vipSettingService;
+ @Resource
+ private AppUserClient appUserClient;
+ @Resource
+ private TokenService tokenService;
+ @Resource
+ private VipGoodService vipGoodService;
+ @Resource
+ private BaseSettingService baseSettingService;
+ @Resource
+ private GoodsClient goodsClient;
+
+ @Resource
+ private VipGoodService getVipGoodService;
+
@GetMapping("/info")
- @ApiOperation(value = "获取各级会员信息", tags = {"小程序-个人中心首页"})
- public R<List<VipSetting>> info(){
+ @ApiOperation(value = "获取各级会员信息", tags = {"小程序-个人中心首页", "小程序-会员中心"})
+ public R<List<VipSetting>> info() {
List<VipSetting> list = vipSettingService.list();
return R.ok(list);
}
+// @PostMapping("/button/agent/check")
+// @ApiOperation(value = "准代理,代理按钮是否展示", tags = {"小程序-个人中心首页","小程序-会员中心"})
+// public R<Boolean> buttoncheck(@ApiParam("4准代理,5代理")Integer id) {
+// Long userid = tokenService.getLoginUserApplet().getUserid();
+// AppUser appUserById = appUserClient.getAppUserById(userid);
+// Boolean back = true;
+// VipSetting byId = vipSettingService.getById(id);
+// //第一种判断
+// if (byId == null) {
+// back = false;
+// } else {
+// if (byId.getVipAgentLevelUpRole() == null || byId.getVipAgentLevelUpRole() == 0) {
+// back = false;
+// }
+// if (byId.getVipLevelUpShop() == null || byId.getVipLevelUpShare() == null) {
+// back = false;
+// } else {
+// if (back && appUserById.getShopPoint().compareTo(byId.getVipLevelUpShop()) > 0 && appUserById.getSharePoint().compareTo(byId.getVipLevelUpShare()) > 0) {
+// back = true;
+// }
+// }
+// if (back) {
+// return R.ok(true);
+// }
+// //第二种判断
+// if (byId.getVipDirectVipRole() == null || byId.getVipDirectVipRole() == 0 || byId.getVipDirectVipNum() == null) {
+// back = false;
+// } else {
+// //拿到当前用户直推钻石会员人数
+// Long data = appUserClient.getVipCount(userid, 3).getData();
+// if (data >= byId.getVipDirectVipNum()) {
+// return R.ok(true);
+// }
+// }
+// //第三种判断
+// List<VipGood> list = vipGoodService.lambdaQuery().eq(VipGood::getVipId, id).list();
+// for (VipGood vipGood : list) {
+// //挨个判断是否购买商品
+//
+//
+// }
+// }
+//
+// return R.ok();
+// }
+
@GetMapping("getVipSettingById")
@ApiOperation(value = "获取会员设置")
- public R<VipSetting> getVipSettingById(@ApiParam(value = "会员id") @RequestParam Integer id){
+ public R<VipSetting> getVipSettingById(@ApiParam(value = "会员id") @RequestParam("id") Integer id) {
return R.ok(vipSettingService.getById(id));
}
+
+
+ @PostMapping("getVipSettingById1")
+ public R<VipSetting> getVipSettingById1(@RequestParam("id") Integer id) {
+ return R.ok(vipSettingService.getById(id));
+ }
+
+
+
+ /**
+ * 查询会员配置
+ * @param id
+ * @return
+ */
+ @PostMapping("/getVipSetting")
+ public R<VipSetting> getVipSetting(@RequestParam("id") Integer id) {
+ return R.ok(vipSettingService.getById(id));
+ }
+
+ @GetMapping("/list")
+ public R<List<VipSetting>> getList(){
+ return R.ok(vipSettingService.list());
+ }
+
+ @GetMapping("/manage/info")
+ @ApiOperation(value = "查询", tags = {"后台-会员设置"})
+ public R<VipSetDto> managesetinfo() {
+ VipSetDto vipSetDto = new VipSetDto();
+ VipSetting byId1 = vipSettingService.getById(1);
+ vipSetDto.setLevel1Name(byId1.getVipName());
+ VipSetting byId2 = vipSettingService.getById(2);
+ vipSetDto.setLevel2Name(byId2.getVipName());
+ VipSetting byId3 = vipSettingService.getById(3);
+ vipSetDto.setLevel3Name(byId3.getVipName());
+ VipSetting byId4 = vipSettingService.getById(4);
+ vipSetDto.setLevel4Name(byId4.getVipName());
+ VipSetting byId5 = vipSettingService.getById(5);
+ vipSetDto.setLevel5Name(byId5.getVipName());
+ VipSetting byId6 = vipSettingService.getById(6);
+ vipSetDto.setLevel6Name(byId6.getVipName());
+ VipSetting byId7 = vipSettingService.getById(7);
+ vipSetDto.setLevel7Name(byId7.getVipName());
+
+ BaseSetting base1 = baseSettingService.getById(1);
+ vipSetDto.setPartPoint(new BigDecimal(base1.getContent()));
+ BaseSetting base2 = baseSettingService.getById(2);
+ vipSetDto.setBottomPartPoint(new BigDecimal(base2.getContent()));
+ BaseSetting base3 = baseSettingService.getById(3);
+ vipSetDto.setVipInfo(base3.getContent());
+ return R.ok(vipSetDto);
+ }
+
+
+ @PostMapping("/manage/set")
+ @ApiOperation(value = "设置", tags = {"后台-会员设置"})
+ public R<List<VipSetting>> manageset(@RequestBody VipSetDto vipSetDto) {
+ List<VipSetting> vipSettingList = new ArrayList<>();
+ VipSetting byId1 = vipSettingService.getById(1);
+ byId1.setVipName(vipSetDto.getLevel1Name());
+ vipSettingList.add(byId1);
+ VipSetting byId2 = vipSettingService.getById(2);
+ byId2.setVipName(vipSetDto.getLevel2Name());
+ vipSettingList.add(byId2);
+ VipSetting byId3 = vipSettingService.getById(3);
+ byId3.setVipName(vipSetDto.getLevel3Name());
+ vipSettingList.add(byId3);
+ VipSetting byId4 = vipSettingService.getById(4);
+ byId4.setVipName(vipSetDto.getLevel4Name());
+ vipSettingList.add(byId4);
+ VipSetting byId5 = vipSettingService.getById(5);
+ byId5.setVipName(vipSetDto.getLevel5Name());
+ vipSettingList.add(byId5);
+ VipSetting byId6 = vipSettingService.getById(6);
+ byId6.setVipName(vipSetDto.getLevel6Name());
+ vipSettingList.add(byId6);
+ VipSetting byId7 = vipSettingService.getById(7);
+ byId7.setVipName(vipSetDto.getLevel7Name());
+ vipSettingList.add(byId7);
+ vipSettingService.updateBatchById(vipSettingList);
+
+ BaseSetting base1 = baseSettingService.getById(1);
+ base1.setContent(String.valueOf(vipSetDto.getPartPoint()));
+ baseSettingService.updateById(base1);
+ BaseSetting base2 = baseSettingService.getById(2);
+ base2.setContent(String.valueOf(vipSetDto.getBottomPartPoint()));
+ baseSettingService.updateById(base2);
+ BaseSetting base3 = baseSettingService.getById(3);
+ base3.setContent(vipSetDto.getVipInfo());
+ baseSettingService.updateById(base3);
+
+ return R.ok();
+ }
+ @PostMapping("/manage/level/set")
+ @ApiOperation(value = "设置", tags = {"后台-会员等级设置"})
+ public R<Void> managelevelset(@RequestBody SetDto setDto) {
+ vipSettingService.updateBatchById(setDto.getVipSettingList());
+ //会员降级检测
+ appUserClient.demotionDetection();
+ return R.ok();
+ }
+
+ @GetMapping("/manage/level/info")
+ @ApiOperation(value = "查询", tags = {"后台-会员等级设置"})
+ public R<List<VipSetting>> managelevelinfo() {
+ List<VipSetting> list = vipSettingService.list();
+ for (VipSetting vipSetting : list) {
+ if (vipSetting.getGoodIds()!=null){
+ String[] split = vipSetting.getGoodIds().split(",");
+ R<List<Goods>> goodsById = goodsClient.getGoodsById(split);
+ if (goodsById.getData()!=null){
+ vipSetting.setGoodsList(goodsById.getData());
+ }
+ }
+ }
+ return R.ok(list);
+ }
+
}
+
+
+
--
Gitblit v1.7.1