1.
phpcjl
2024-12-09 83e3542043aa031da4d0cd22e3284d279337e2f5
1.
21个文件已修改
379 ■■■■ 已修改文件
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/VipSetting.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OrderClient.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/VipCenterService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java 254 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java
@@ -35,6 +35,11 @@
            public R<Void> updateOrderStatus(Order order) {
                return R.fail("更新订单状态失败");
            }
            @Override
            public R<Void> subscribe(Long id, Integer technicianId) {
                return R.fail("预约失败");
            }
        };
    }
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java
@@ -40,4 +40,10 @@
     */
    @PostMapping("/order/updateOrderStatus")
    public R<Void> updateOrderStatus(@RequestBody Order order);
    /**
     * 预约技师
     */
    @PostMapping("/order/subscribe")
    public R<Void> subscribe(@RequestParam(value = "id" , required = false) Long id ,@RequestParam(value = "technicianId", required = false) Integer technicianId);
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java
@@ -79,5 +79,13 @@
    @TableField(exist = false)
    private String userName;
    @ApiModelProperty(value = "商品名字")
    @TableField(exist = false)
    private String goodsName;
    @ApiModelProperty(value = "商品图片")
    @TableField(exist = false)
    private String goodsImg;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java
@@ -70,5 +70,10 @@
    private LocalDateTime createTime;
    @ApiModelProperty(value = "订单id")
    @TableField(exist = false)
    private Long orderId;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/VipSetting.java
@@ -131,5 +131,9 @@
    @TableField("keep_shop_point")
    private Integer keepShopPoint;
    @ApiModelProperty(value = "会员等级是否必须达到代理: 0-否 1-是")
    @TableField("vip_level_up_proxy_role")
    private Integer vipLevelUpProxyRole;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java
@@ -6,6 +6,8 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import java.util.List;
@Slf4j
public class ShopClientFallbackFactory implements FallbackFactory<ShopClient> {
    @Override
@@ -20,6 +22,11 @@
            public R<Shop> getShopByPhone(String phone) {
                return R.fail("根据店铺管理员电话获取门店数据失败:" + cause.getMessage());
            }
            @Override
            public R<List<Shop>> getShopByUserIds(List<Long> userIds) {
                return R.fail("根据用户id集合获取门店数据失败");
            }
        };
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OrderClient.java
@@ -17,6 +17,4 @@
public interface OrderClient {
    @PostMapping(value = "/management/give/vip")
    public R<List<Long>> getOrderIdsByTechId(@RequestParam("id") Integer id);
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java
@@ -1,12 +1,16 @@
package com.ruoyi.other.api.feignClient;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.factory.ShopClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
 * @author zhibing.pu
@@ -32,4 +36,7 @@
     */
    @PostMapping("/shop/getShopByPhone")
    R<Shop> getShopByPhone(@RequestParam("phone") String phone);
    @PostMapping("/getShopByUserIds")
    public R<List<Shop>> getShopByUserIds(@RequestBody List<Long> userIds);
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java
@@ -1,7 +1,6 @@
package com.ruoyi.account.controller;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.account.service.AppUserService;
import com.ruoyi.account.service.VipCenterService;
import com.ruoyi.account.service.VipSettingService;
import com.ruoyi.account.vo.vip.Level;
@@ -13,8 +12,6 @@
import com.ruoyi.other.api.feignClient.BaseSettingClient;
import com.ruoyi.other.api.feignClient.GoodsVipClient;
import com.ruoyi.other.api.feignClient.RemoteVipSettingClient;
import com.ruoyi.other.api.feignClient.VipGoodClient;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -46,10 +43,6 @@
    private VipSettingService vipSettingService;
    @Resource
    private TokenService tokenService;
    @Resource
    private VipGoodClient vipGoodClient;
    @Resource
    private AppUserService appUserService;
    @Resource
    private VipCenterService vipCenterService;
@@ -130,22 +123,8 @@
    @GetMapping("/check")
    @ApiOperation(value = "会员申请检查", tags = {"会员中心-小程序"})
    public R<Boolean> check(@ApiParam("4:准代理,5:代理,6:总代理,7:合伙人") @RequestParam Integer type) {
        LoginUser loginUser = tokenService.getLoginUser();
        Long userid = loginUser.getUserid();
        if (type == 4){
            return R.ok(vipCenterService.checkReadyToBeProxy(userid, type));
        }else if (type == 5){
            return R.ok(vipCenterService.checkReadyToBeAgent(userid));
        }else if (type == 6){
            return R.ok(vipCenterService.checkReadyToBeTotalAgent(userid));
        }else if (type == 7){
            return R.ok(vipCenterService.checkReadyToBePartner(userid));
        }else {
            return R.fail("参数错误");
        return R.ok(vipCenterService.check(type));
        }
    }
    private boolean checkSuccess(R<?> r) {
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java
@@ -39,5 +39,6 @@
        return AjaxResult.success();
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/VipCenterService.java
@@ -21,4 +21,7 @@
     * 校验合伙人的申请条件
     */
    Boolean checkReadyToBePartner(Long userId);
    Boolean check(Integer type);
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java
@@ -8,16 +8,23 @@
import com.ruoyi.account.service.VipCenterService;
import com.ruoyi.account.service.VipSettingService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
import com.ruoyi.order.model.Order;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.domain.VipGood;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.api.feignClient.ShopClient;
import com.ruoyi.other.api.feignClient.VipGoodClient;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@Service
@@ -30,6 +37,11 @@
    private VipGoodClient vipGoodClient;
    @Resource
    private VipSettingService vipSettingService;
    @Resource
    private ShopClient shopClient;
    @Resource
    private TokenService tokenService;
    @Override
    public Boolean checkReadyToBeProxy(Long userId,Integer vipId) {
@@ -40,34 +52,276 @@
        Integer sharePoint = appUser.getSharePoint();
        // 准代理会员设置
        VipSetting vipSetting = vipSettingService.getVipSettingById(4);
        // 获取通过消费积分达成会员等级的开关
        Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole();
        if (vipLevelUpShopRole == 1){
        // 消费积分阈值
        Integer vipLevelUpShop = vipSetting.getVipLevelUpShop();
        // 返佣积分阈值
        Integer vipLevelUpShare = vipSetting.getVipLevelUpShare();
            // 判断是否满足消费积分和返佣积分
        if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){
            return true;
        }
        }
        Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole();
        if (vipLevelUpNumRole == 1){
        // 直推钻石用户数阈值
        Integer vipDirectNum = vipSetting.getVipDirectNum();
        // 获取用户直推钻石用户数量
        long userDiamondsCount = appUserService.count(new LambdaQueryWrapper<AppUser>()
                .eq(AppUser::getInviteUserId, userId)
                .eq(AppUser::getVipId, 3));
            // 判断是否满足直推钻石用户数量
            if (userDiamondsCount >= vipDirectNum){
                return true;
            }
        }
        // 获取指定购买商品
        R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(4);
        if (R.isSuccess(vipGoodsByVipId)){
            List<VipGood> vipGoods = vipGoodsByVipId.getData();
            if (CollectionUtil.isNotEmpty(vipGoods)){
                for (VipGood vipGood : vipGoods) {
                    String goodJson = vipGood.getGoodJson();
                    Goods goods = JSONObject.parseObject(goodJson, Goods.class);
                    R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId());
                    if (R.isSuccess(orderListByUserIdAndGoodsId)){
                        List<Order> orderList = orderListByUserIdAndGoodsId.getData();
                        if (CollectionUtil.isEmpty(orderList)){
                            return false;
                        }
                    }
                }
                return true;
            }
        }
        return false;
    }
    @Override
    public Boolean checkReadyToBeAgent(Long userId) {
        AppUser appUser = appUserService.getById(userId);
        // 消费积分
        Integer shopPoint = appUser.getShopPoint();
        // 返佣积分
        Integer sharePoint = appUser.getSharePoint();
        // 代理会员设置
        VipSetting vipSetting = vipSettingService.getVipSettingById(5);
        // 获取通过消费积分达成会员等级的开关
        Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole();
        if (vipLevelUpShopRole == 1){
            // 消费积分阈值
            Integer vipLevelUpShop = vipSetting.getVipLevelUpShop();
            // 返佣积分阈值
            Integer vipLevelUpShare = vipSetting.getVipLevelUpShare();
            // 判断是否满足消费积分和返佣积分
            if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){
                return true;
            }
        }
        Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole();
        if (vipLevelUpNumRole == 1){
            // 直推钻石用户数阈值
            Integer vipDirectNum = vipSetting.getVipDirectNum();
            // 获取用户直推钻石用户数量
            long userDiamondsCount = appUserService.count(new LambdaQueryWrapper<AppUser>()
                    .eq(AppUser::getInviteUserId, userId)
                    .eq(AppUser::getVipId, 3));
            // 判断是否满足直推钻石用户数量
            if (userDiamondsCount >= vipDirectNum){
                return true;
            }
        }
        R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(5);
        if (R.isSuccess(vipGoodsByVipId)){
            List<VipGood> vipGoods = vipGoodsByVipId.getData();
            if (CollectionUtil.isNotEmpty(vipGoods)){
                for (VipGood vipGood : vipGoods) {
                    String goodJson = vipGood.getGoodJson();
                    Goods goods = JSONObject.parseObject(goodJson, Goods.class);
                    R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId());
                    if (R.isSuccess(orderListByUserIdAndGoodsId)){
                        List<Order> orderList = orderListByUserIdAndGoodsId.getData();
                        if (CollectionUtil.isEmpty(orderList)){
                            return false;
                        }
                    }
                }
                return true;
            }
        }
        return false;
    }
    @Override
    public Boolean checkReadyToBeTotalAgent(Long userId) {
        AppUser appUser = appUserService.getById(userId);
        // 获取总代会员设置
        VipSetting vipSetting = vipSettingService.getVipSettingById(6);
        // 获取会员等级是否必须达到代理
        Integer vipLevelUpProxyRole = vipSetting.getVipLevelUpProxyRole();
        if (vipLevelUpProxyRole == 1 && appUser.getVipId() == 5){
            return true;
        }
        // 消费积分
        Integer shopPoint = appUser.getShopPoint();
        // 返佣积分
        Integer sharePoint = appUser.getSharePoint();
        // 获取通过消费积分达成会员等级的开关
        Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole();
        if (vipLevelUpShopRole == 1){
            // 消费积分阈值
            Integer vipLevelUpShop = vipSetting.getVipLevelUpShop();
            // 返佣积分阈值
            Integer vipLevelUpShare = vipSetting.getVipLevelUpShare();
            // 判断是否满足消费积分和返佣积分
            if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){
                return true;
            }
        }
        Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole();
        if (vipLevelUpNumRole == 1){
            // 直推代理用户数阈值
            Integer vipDirectNum = vipSetting.getVipDirectNum();
            // 准代理用户数阈值
            Integer vipDirectVipNum = vipSetting.getVipDirectVipNum();
            // 获取用户直推代理用户数量
            List<AppUser> userAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>()
                    .eq(AppUser::getInviteUserId, userId)
                    .eq(AppUser::getVipId, 5));
            // 代理下的准代理数量
            List<Long> userQuasiAgent = userAgentList.stream().map(AppUser::getId).collect(Collectors.toList());
            long userQuasiAgentCount = appUserService.count(new LambdaQueryWrapper<AppUser>()
                    .in(AppUser::getInviteUserId, userQuasiAgent)
                    .eq(AppUser::getVipId, 4));
            // 判断是否满足直推代理用户数量和准代理数量
            if (userAgentList.size() >= vipDirectNum && userQuasiAgentCount >= vipDirectVipNum){
                return true;
            }
        }
        // 获取指定购买商品
        R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(5);
        if (R.isSuccess(vipGoodsByVipId)){
            List<VipGood> vipGoods = vipGoodsByVipId.getData();
            if (CollectionUtil.isNotEmpty(vipGoods)){
                for (VipGood vipGood : vipGoods) {
                    String goodJson = vipGood.getGoodJson();
                    Goods goods = JSONObject.parseObject(goodJson, Goods.class);
                    R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId());
                    if (R.isSuccess(orderListByUserIdAndGoodsId)){
                        List<Order> orderList = orderListByUserIdAndGoodsId.getData();
                        if (CollectionUtil.isEmpty(orderList)){
                            return false;
                        }
                    }
                }
                return true;
            }
        }
        return false;
    }
    @Override
    public Boolean checkReadyToBePartner(Long userId) {
        AppUser appUser = appUserService.getById(userId);
        // 消费积分
        Integer shopPoint = appUser.getShopPoint();
        // 返佣积分
        Integer sharePoint = appUser.getSharePoint();
        // 合伙人会员设置
        VipSetting vipSetting = vipSettingService.getVipSettingById(7);
        // 获取通过消费积分达成会员等级的开关
        Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole();
        if (vipLevelUpShopRole == 1){
            // 消费积分阈值
            Integer vipLevelUpShop = vipSetting.getVipLevelUpShop();
            // 返佣积分阈值
            Integer vipLevelUpShare = vipSetting.getVipLevelUpShare();
            // 判断是否满足消费积分和返佣积分
            if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){
                return true;
            }
            Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole();
            if (vipLevelUpNumRole == 1){
                // 直推代理用户数阈值
                Integer vipDirectNum = vipSetting.getVipDirectNum();
                // 准代理用户数阈值
                Integer vipDirectVipNum = vipSetting.getVipDirectVipNum();
                // 总代用户数阈值
                Integer vipTeamVipNum = vipSetting.getVipTeamVipNum();
                // 获取开店数量阈值
                Integer vipOpenShopNum = vipSetting.getVipOpenShopNum();
                // 获取直推用户有超过指定门店数量的用户
                List<Long> userShopList = appUserService.list(new LambdaQueryWrapper<AppUser>()
                        .eq(AppUser::getInviteUserId, userId))
                        .stream().map(AppUser::getId).collect(Collectors.toList());
                if (CollectionUtil.isNotEmpty(userShopList)){
                    R<List<Shop>> r = shopClient.getShopByUserIds(userShopList);
                    List<Shop> shopList = r.getData();
                    if (CollectionUtil.isNotEmpty(shopList)){
                        Map<Long, List<Shop>> shopUserMap = shopList.stream().collect(Collectors.groupingBy(Shop::getAppUserId));
                        // 查找 list 长度大于 3 的 key
                        Set<Long> shopUserIdSet = shopUserMap.entrySet().stream()
                                .filter(entry -> entry.getValue().size() >= vipOpenShopNum)
                                .map(Map.Entry::getKey)
                                .collect(Collectors.toSet());
                        // 获取用户直推总代理数量
                        List<AppUser> userTotalAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>()
                                .in(AppUser::getInviteUserId, shopUserIdSet)
                                .eq(AppUser::getVipId, 6));
                        // 获取用户直推代理用户数量
                        List<AppUser> userAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>()
                                .in(AppUser::getInviteUserId, shopUserIdSet)
                                .eq(AppUser::getVipId, 5));
                        // 代理下的准代理数量
                        List<Long> userQuasiAgent = userAgentList.stream().map(AppUser::getId).collect(Collectors.toList());
                        long userQuasiAgentCount = appUserService.count(new LambdaQueryWrapper<AppUser>()
                                .in(AppUser::getInviteUserId, userQuasiAgent)
                                .eq(AppUser::getVipId, 4));
                        // 判断是否满足直推代理用户数量和准代理数量
                        return userTotalAgentList.size() >= vipTeamVipNum && userAgentList.size() >= vipDirectNum &&
                                userQuasiAgentCount >= vipDirectVipNum;
                    }
                }
            }
        }
        return false;
    }
    @Override
    public Boolean check(Integer type) {
        LoginUser loginUser = tokenService.getLoginUser();
        Long userid = loginUser.getUserid();
        if (type == 4){
            return checkReadyToBeProxy(userid, type);
        }else if (type == 5){
            return checkReadyToBeAgent(userid);
        }else if (type == 6){
            return checkReadyToBeTotalAgent(userid);
        }else if (type == 7){
            return checkReadyToBePartner(userid);
        }else {
            throw new ServiceException("参数错误");
        }
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -166,6 +166,18 @@
    }
    /**
     * 预约技师
     */
    @PostMapping("/subscribe")
    public R<Void> subscribe(@RequestParam(value = "id", required = false) Long id ,@RequestParam(value = "technicianId", required = false) Integer technicianId){
        Order order = orderService.getById(id);
        order.setTechnicianId(technicianId);
        orderService.updateById(order);
        return R.ok();
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
@@ -31,6 +31,9 @@
    @Resource
    private GoodsService goodsService;
    /**
     * 商品列表
     */
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
@@ -7,6 +7,7 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.GoodsEvaluate;
import com.ruoyi.other.service.GoodsEvaluateService;
import com.ruoyi.other.service.GoodsService;
import com.ruoyi.other.vo.GoodsEvaluateVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -32,6 +33,8 @@
    private GoodsEvaluateService goodsEvaluateService;
    @Resource
    private AppUserClient appUserClient;
    @Resource
    private GoodsService goodsService;
    @GetMapping("/goodsList")
    @ApiOperation(value = "获取商品评价", tags = {"小程序-获取商品评价"})
@@ -64,6 +67,9 @@
        List<GoodsEvaluate> list = goodsEvaluateService.list(new LambdaQueryWrapper<GoodsEvaluate>()
                .eq(GoodsEvaluate::getStatus, 2)
                .eq(GoodsEvaluate::getOrderId, orderId));
        for (GoodsEvaluate goodsEvaluate : list) {
        }
        return R.ok(list);
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -54,6 +54,7 @@
    private TokenService tokenService;
    @PostMapping("/getDetailById")
    public R<Shop> getDetailById(@RequestParam("id") Long id){
        Shop byId = shopService.getById(id);
@@ -152,5 +153,12 @@
        Shop one = shopService.getOne(new LambdaQueryWrapper<Shop>().eq(Shop::getPhone, phone).eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1));
        return R.ok(one);
    }
    @PostMapping("/getShopByUserIds")
    public R<List<Shop>> getShopByUserIds(@RequestBody List<Long> userIds){
        List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().in(Shop::getAppUserId, userIds));
        return R.ok(list);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java
@@ -52,7 +52,7 @@
    @PostMapping("/subscribe")
    @ApiOperation(value = "预约技师", notes = "预约技师", tags = {"小程序-个人中心-门店管理-预约列表-预约技师"})
    public R<Void> subscribe(@RequestBody TechnicianSubscribe technicianSubscribe) {
        technicianSubscribeService.subscribe(technicianSubscribe, technicianSubscribe.getTechnicianId());
        technicianSubscribeService.subscribe(technicianSubscribe);
        return R.ok();
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java
@@ -21,4 +21,5 @@
    List<NearbyShopVO> nearbyShopList(BigDecimal longitude, BigDecimal latitude);
    ShopDetailVO getShopDetail(Integer shopId, BigDecimal longitude, BigDecimal latitude);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java
@@ -25,5 +25,5 @@
    IPage<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Page<TechnicianSubscribe> page, Long userId, Integer status);
    void subscribe(TechnicianSubscribe technicianSubscribe, Long technicianId);
    void subscribe(TechnicianSubscribe technicianSubscribe);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java
@@ -35,7 +35,7 @@
        for (GoodsEvaluate goodsEvaluate : evaluates) {
            goodsEvaluate.setStatus(2);
        }
        this.saveBatch(evaluates);
        this.saveOrUpdateBatch(evaluates);
        if (CollectionUtil.isNotEmpty(evaluates)){
            Order order = new Order();
            order.setId(goodsEvaluateVO.getEvaluates().get(0).getOrderId());
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java
@@ -4,9 +4,9 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
import com.ruoyi.other.api.domain.TechnicianSubscribe;
import com.ruoyi.other.enums.TechnicianStatus;
import com.ruoyi.other.mapper.TechnicianMapper;
import com.ruoyi.other.mapper.TechnicianSubscribeMapper;
import com.ruoyi.other.service.TechnicianSubscribeService;
import com.ruoyi.other.vo.TechnicianSubscribeVO;
@@ -29,7 +29,7 @@
    @Resource
    private TechnicianSubscribeMapper technicianSubscribeMapper;
    @Resource
    private TechnicianMapper technicianMapper;
    private RemoteOrderGoodsClient orderGoodsClient;
    @Override
    public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long userId, Long shopId) {
@@ -41,15 +41,7 @@
    }
    @Override
//    @DistributedLock(lockNamePre = "#technician_subscribe_lock", lockNamePost = "#technicianId")
    public void subscribe(TechnicianSubscribe subscribe, Long technicianId) {
//        Long count = technicianSubscribeMapper.selectCount(new LambdaQueryWrapper<TechnicianSubscribe>()
//                .eq(TechnicianSubscribe::getTechnicianId, technicianId)
//                .eq(TechnicianSubscribe::getSubscribeTime, subscribe.getSubscribeTime())
//                .eq(TechnicianSubscribe::getStatus, TechnicianStatus.UNSUBSCRIBE.getCode()));
//        if (count > 0) {
//            throw new ServiceException("当前时间段已被预约", TechnicianErrorCode.TECHNICIAN_ALREADY_SUBSCRIBED.getCode());
//        }
    public void subscribe(TechnicianSubscribe subscribe) {
        // 创建技师预约单
        Long userId = SecurityUtils.getUserId();
        subscribe.setAppUserId(userId);
@@ -58,5 +50,9 @@
        subscribe.setCreateTime(LocalDateTime.now());
        technicianSubscribeMapper.insert(subscribe);
        if (subscribe.getTechnicianId() != null){
            orderGoodsClient.subscribe(subscribe.getOrderId(), Math.toIntExact(subscribe.getId()));
        }
    }
}