From bb66ef51805b58448af8edae8e6b04f153d80b5f Mon Sep 17 00:00:00 2001
From: phpcjl <phpcjl@gmail.com>
Date: 星期三, 04 十二月 2024 14:06:17 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java            |   27 +++++
 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java |    7 +
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java              |   71 +++++++++++++
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java             |   42 ++++++++
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java              |  109 ++++++++++-----------
 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java            |   10 +
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/StartPageSetDto.java                      |   18 +++
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/IndexConfigSetDto.java                    |    4 
 8 files changed, 226 insertions(+), 62 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java
index 76ed1fd..c877f44 100644
--- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java
+++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java
@@ -53,6 +53,13 @@
 				log.error("获取用户祖籍列表失败:{}", cause.getMessage());
 				throw new RuntimeException("获取用户祖籍列表失败");
 			}
+			@Override
+			public R<Long> getVipCount(Long userId, Integer vipId) {
+				log.error("获取直推会员数失败:{}", cause.getMessage());
+				throw new RuntimeException("获取直推会员数失败");
+			}
+
+
 		};
 	}
 }
diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java
index 6d11bd2..8d5b424 100644
--- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java
+++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java
@@ -25,16 +25,16 @@
 	 * @param id
 	 * @return
 	 */
-	@PostMapping("/app-user/getAppUserById")
+	@PostMapping("/appUser/getAppUserById")
 	AppUser getAppUserById(@RequestParam("id") Long id);
 
 	/**
 	 * 根据id编辑用户
 	 */
-	@PostMapping("/appUser/editAppUserById")
+	@PostMapping("/app-user/editAppUserById")
 	R<Void> editAppUserById(@RequestParam("appUser") AppUser appUser);
 
-	@PostMapping("/appUser/getCouponCount")
+	@PostMapping("/app-user/getCouponCount")
 	R<Long> getCouponCount(@RequestParam("userId")Long userId, @RequestParam("couponId") Integer couponId );
 
 	/**
@@ -49,4 +49,8 @@
 	@GetMapping("/appletLogin/getUserAncestorList")
 	R<List<AppUser>> getUserAncestorList(@RequestParam("id") Long id);
 
+
+
+	@PostMapping("/app-user/getVipCount")
+	R<Long> getVipCount(@RequestParam("userId")Long userId, @RequestParam("vipId") Integer vipId );
 }
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/IndexConfigSetDto.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/IndexConfigSetDto.java
index 00a8f45..43238d6 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/IndexConfigSetDto.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/IndexConfigSetDto.java
@@ -11,8 +11,12 @@
     private String pic1;
     @ApiModelProperty("跳转类型1 - 1无2外部链接3商品详情4秒杀商品详情5领卷中心")
     private Integer direct1;
+    @ApiModelProperty("跳转内容1")
+    private String content1;
     @ApiModelProperty("宣传图片2")
     private String pic2;
+    @ApiModelProperty("跳转内容2")
+    private String content2;
     @ApiModelProperty("跳转类型2 - 1无2外部链接3商品详情4秒杀商品详情5领卷中心")
     private String direct2;
     @ApiModelProperty("公司简介")
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/StartPageSetDto.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/StartPageSetDto.java
new file mode 100644
index 0000000..0302abf
--- /dev/null
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/StartPageSetDto.java
@@ -0,0 +1,18 @@
+package com.ruoyi.other.api.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class StartPageSetDto {
+    @ApiModelProperty("启动页倒计时")
+    private Integer waitTime;
+    @ApiModelProperty("1图片2视频")
+    private Integer type;
+    @ApiModelProperty("对应文件地址")
+    private String url;
+
+
+
+
+}
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
index 2f5d511..fb71383 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -4,8 +4,10 @@
 
 import com.ruoyi.account.api.model.AppUser;
 import com.ruoyi.account.api.model.UserCancellationLog;
+import com.ruoyi.account.api.model.UserCoupon;
 import com.ruoyi.account.service.AppUserService;
 import com.ruoyi.account.service.UserCancellationLogService;
+import com.ruoyi.account.service.UserCouponService;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.other.api.domain.Shop;
@@ -56,7 +58,16 @@
 	private AppUserService appUserService;
 	@Resource
 	private StoreClient storeClient;
+	@Resource
+	private UserCouponService userCouponService;
 
+
+	@ResponseBody
+	@PostMapping("/mobileLogin")
+	@ApiOperation(value = "手机号登录")
+	public AjaxResult<LoginVo> mobileLogin(@RequestBody MobileLogin mobileLogin){
+		return appUserService.mobileLogin(mobileLogin);
+	}
 
 	@PostMapping("getAppUserById")
 	AppUser getAppUserById(@RequestParam("id") Long id){
@@ -75,12 +86,37 @@
 	
 	
 	@ResponseBody
+	@PostMapping("/getAppUserById")
+	public AppUser getAppUserById(@RequestParam("id") Long id){
+		return appUserService.getById(id);
+	}
+
+	@ResponseBody
+	@PostMapping("/editAppUserById")
+	public R<Void> editAppUserById(@RequestParam("appUser") AppUser appUser){
+		appUserService.updateById(appUser);
+		return R.ok();
 	@PostMapping("/mobileLogin")
 	@ApiOperation(value = "手机号登录")
 	public R<LoginVo> mobileLogin(@RequestBody MobileLogin mobileLogin){
 		return appUserService.mobileLogin(mobileLogin);
 	}
-	
+
+	@ResponseBody
+	@PostMapping("/getCouponCount")
+	public R<Long> getCouponCount(@RequestParam("userId")Long userId, @RequestParam("couponId") Integer couponId ){
+		Long count = userCouponService.lambdaQuery().eq(UserCoupon::getAppUserId, userId).eq(UserCoupon::getCouponId, couponId).count();
+		return R.ok(count);
+	}
+
+	@ResponseBody
+	@PostMapping("/getVipCount")
+	public R<Long> getVipCount(@RequestParam("userId")Long userId, @RequestParam("vipId") Integer vipId ){
+		appUserService.lambdaQuery().eq(AppUser::getInviteUserId, userId).eq(AppUser::getVipId, vipId).count()
+		return R.ok(count);
+	}
+
+
 	
 	
 	@ResponseBody
@@ -154,7 +190,9 @@
 	}
 
 
-    @GetMapping("/index")
+
+
+    @PostMapping("/index")
 	@ApiOperation(value = "个人中心首页", tags = {"小程序-个人中心首页"})
 	public R<AppUser> index(){
         System.err.println("=-====");
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java
index 78d3303..8a05bbc 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java
@@ -6,6 +6,7 @@
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.other.api.domain.SystemConfig;
 import com.ruoyi.other.api.dto.IndexConfigSetDto;
+import com.ruoyi.other.api.dto.StartPageSetDto;
 import com.ruoyi.other.service.SystemConfigService;
 import org.springframework.web.bind.annotation.*;
 import io.swagger.annotations.Api;
@@ -65,5 +66,31 @@
 		return R.ok(one);
 	}
 
+    @PostMapping("/index/start")
+    @ApiOperation(value = "宣传图片-公司简介", tags = {"小程序-启动页"})
+    public R<StartPageSetDto> indexstart(){
+        SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 1).one();
+        if (one==null){
+            return R.ok();
+        }
+        StartPageSetDto indexConfigSetDto = JSONObject.parseObject(one.getContent(), StartPageSetDto.class);
+        return R.ok(indexConfigSetDto);
+
+    }
+
+    @PostMapping("/startPage/add")
+    @ApiOperation(value = "添加", tags = {"后台-广告管理-启动页管理"})
+    public R startPageadd(@RequestBody StartPageSetDto startPageSetDto){
+        //先删除type=1的数据
+        List<SystemConfig> list = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 1).list();
+        systemConfigService.removeBatchByIds(list);
+        SystemConfig  systemConfig = new SystemConfig();
+        systemConfig.setType(1);
+        systemConfig.setContent(JSON.toJSONString(startPageSetDto));
+        systemConfigService.save(systemConfig);
+        return R.ok();
+    }
+
+
 }
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
index d93d7bb..cb7a0ba 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
@@ -54,62 +54,61 @@
     private TechnicianSubscribeService technicianSubscribeService;
     @Resource
     private TokenService tokenService;
-        @PostMapping("/shop/list")
-	@ApiOperation(value = "获取门店的技师列表", tags = {"小程序-门店详情-技师预约"})
-	public R<Page<Technician>> shoplist(@RequestParam Integer shopId,@RequestParam Integer pageNum,@RequestParam Integer pageSize){
-            //查出技师列表
-            Page<Technician> page = technicianService.lambdaQuery().eq(Technician::getShopId, shopId).eq(Technician::getStatus, 2).page(Page.of(pageNum, pageSize));
-            for (Technician technician : page.getRecords()) {
-            //查出技师订单
-                R<List<Long>> orderIdsByTechId = orderClient.getOrderIdsByTechId(technician.getId());
-                if (orderIdsByTechId.getData().isEmpty()){
-                    technician.setGrade(new BigDecimal(0));
-                    technician.setServeCount(0);
-                    continue;
-                }
-                //查出技师评价
-                List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().in(GoodsEvaluate::getOrderId, orderIdsByTechId.getData()).list();
+//        @PostMapping("/shop/list")
+//	@ApiOperation(value = "获取门店的技师列表", tags = {"小程序-门店详情-技师预约"})
+//	public R<Page<Technician>> shoplist(@RequestParam Integer shopId,@RequestParam Integer pageNum,@RequestParam Integer pageSize){
+//            //查出技师列表
+//            Page<Technician> page = technicianService.lambdaQuery().eq(Technician::getShopId, shopId).eq(Technician::getStatus, 2).page(Page.of(pageNum, pageSize));
+//            for (Technician technician : page.getRecords()) {
+//            //查出技师订单
+//                R<List<Long>> orderIdsByTechId = orderClient.getOrderIdsByTechId(technician.getId());
+//                if (orderIdsByTechId.getData().isEmpty()){
+//                    technician.setGrade(new BigDecimal(0));
+//                    technician.setServeCount(0);
+//                    continue;
+//                }
+//                //查出技师评价
+//                List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().in(GoodsEvaluate::getOrderId, orderIdsByTechId.getData()).list();
+//
+//                //算出平均分并保留一位小数
+//                BigDecimal avg = list.stream().map(GoodsEvaluate::getGrade).reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(list.size()), 1, BigDecimal.ROUND_HALF_UP);
+//                technician.setGrade(avg);
+//                technician.setServeCount(orderIdsByTechId.getData().size());
+//
+//                 }
+//            return R.ok(page);
+//        }
 
-                //算出平均分并保留一位小数
-                BigDecimal avg = list.stream().map(GoodsEvaluate::getGrade).reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(list.size()), 1, BigDecimal.ROUND_HALF_UP);
-                technician.setGrade(avg);
-                technician.setServeCount(orderIdsByTechId.getData().size());
-
-                 }
-            return R.ok(page);
-        }
-
-    @PostMapping("/shop/detail")
-    @ApiOperation(value = "获取门店的技师详情", tags = {"小程序-门店详情-技师预约"})
-    public R<Technician> shopdetail(@RequestParam Integer techId) {
-        //查出技师列表
-        Technician technician = technicianService.getById(techId);
-
-        //查出技师订单
-        R<List<Long>> orderIdsByTechId = orderClient.getOrderIdsByTechId(technician.getId());
-        if (orderIdsByTechId.getData().isEmpty()) {
-            technician.setGrade(new BigDecimal(0));
-            technician.setServeCount(0);
-            return R.ok(technician);
-        }
-        //查出技师评价
-        List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().in(GoodsEvaluate::getOrderId, orderIdsByTechId.getData()).list();
-
-        //算出平均分并保留一位小数
-        BigDecimal avg = list.stream().map(GoodsEvaluate::getGrade).reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(list.size()), 1, BigDecimal.ROUND_HALF_UP);
-        technician.setGrade(avg);
-        technician.setServeCount(orderIdsByTechId.getData().size());
-        return R.ok(technician);
-    }
-
-    @PostMapping("/shop/tech")
-    @ApiOperation(value = "预约操作", tags = {"小程序-门店详情-技师预约"})
-    public R<Technician> shoptech(@RequestBody TechnicianSubscribe subscribe) {
-        Long userId = tokenService.getLoginUserApplet().getUserid();
-        subscribe.setAppUserId(userId);
-        technicianSubscribeService.save(subscribe);
-        return R.ok();
-    }
+//                @PostMapping("/shop/detail")
+//	            @ApiOperation(value = "获取门店的技师详情", tags = {"小程序-门店详情-技师预约"})
+//	            public R<Technician> shopdetail(@RequestParam Integer techId){
+//                //查出技师列表
+//                   Technician technician = technicianService.getById(techId);
+//
+//                 //查出技师订单
+//                R<List<Long>> orderIdsByTechId = orderClient.getOrderIdsByTechId(technician.getId());
+//                if (orderIdsByTechId.getData().isEmpty()){
+//                    technician.setGrade(new BigDecimal(0));
+//                    technician.setServeCount(0);
+//                    return R.ok(technician);
+//                }
+//                //查出技师评价
+//                List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().in(GoodsEvaluate::getOrderId, orderIdsByTechId.getData()).list();
+//
+//                //算出平均分并保留一位小数
+//                BigDecimal avg = list.stream().map(GoodsEvaluate::getGrade).reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(list.size()), 1, BigDecimal.ROUND_HALF_UP);
+//                technician.setGrade(avg);
+//                technician.setServeCount(orderIdsByTechId.getData().size());
+//                    return R.ok(technician);
+//                 }
+//           @PostMapping("/shop/tech")
+//	      @ApiOperation(value = "预约操作", tags = {"小程序-门店详情-技师预约"})
+//	      public R<Technician> shoptech(@RequestBody TechnicianSubscribe subscribe){
+//               Long userId = tokenService.getLoginUserApplet().getUserid();
+//                subscribe.setAppUserId(userId);
+//                technicianSubscribeService.save(subscribe);
+//                return R.ok();
+//           }
 
 
     /**
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..2f20fc2 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,9 +1,13 @@
 package com.ruoyi.other.controller;
 
 
+import com.ruoyi.account.api.feignClient.AppUserClient;
 import com.ruoyi.account.api.model.AppUser;
 import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.security.service.TokenService;
+import com.ruoyi.other.api.domain.VipGood;
 import com.ruoyi.other.api.domain.VipSetting;
+import com.ruoyi.other.service.VipGoodService;
 import com.ruoyi.other.service.VipSettingService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.*;
@@ -33,12 +37,72 @@
 public class VipSettingController {
     @Resource
     private VipSettingService vipSettingService;
-    @GetMapping("/info")
-    @ApiOperation(value = "获取各级会员信息", tags = {"小程序-个人中心首页"})
+    @Resource
+    private AppUserClient appUserClient;
+    @Resource
+    private TokenService tokenService;
+    @Resource
+    private VipGoodService vipGoodService;
+
+    @PostMapping("/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(list);
+    }
+
 
 
     @GetMapping("getVipSettingById")
@@ -46,5 +110,8 @@
     public R<VipSetting> getVipSettingById(@ApiParam(value = "会员id") @RequestParam Integer id){
         return R.ok(vipSettingService.getById(id));
     }
+
+
+
 }
 

--
Gitblit v1.7.1