Pu Zhibing
2024-11-27 64a71565792d4f2e9fd31eab6e98e972c12daa86
Merge remote-tracking branch 'origin/master'

# Conflicts:
# ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java
16个文件已修改
10个文件已添加
353 ■■■■ 已修改文件
ruoyi-api/ruoyi-api-order/src/main/java/feignClient/RemoteOrderGoodsClient.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Region.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/RemoteVipSettingFallbackFactory.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/RemoteVipSettingClient.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/GeodesyUtil.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/ruoyi-common-redis/src/main/java/com/ruoyi/common/redis/aspectj/DistributedLockAspect.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/WithdrawalAuditStatus.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/WalletService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletVO.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RegionController.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/RegionMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/VipGoodMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/RegionService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/VipSettingService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/RegionServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/VipSettingServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/feignClient/RemoteOrderGoodsClient.java
@@ -6,10 +6,8 @@
import factory.RemoteOrderGoodsFallbackFactory;
import model.OrderGood;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
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;
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Region.java
New file
@@ -0,0 +1,29 @@
package com.ruoyi.other.api.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_region")
@ApiModel(value="Region对象", description="")
public class Region implements Serializable {
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    private String name;
    private String code;
    private String citycode;
    private Long parentId;
    private String english;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/RemoteVipSettingFallbackFactory.java
New file
@@ -0,0 +1,22 @@
package com.ruoyi.other.api.factory;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.api.feignClient.RemoteVipSettingClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
@Slf4j
public class RemoteVipSettingFallbackFactory implements FallbackFactory<RemoteVipSettingClient> {
    @Override
    public RemoteVipSettingClient create(Throwable cause) {
        return new RemoteVipSettingClient(){
            @Override
            public R<VipSetting> getVipSettingById(Integer id) {
                log.error("获取会员设置信息失败:{}", cause.getMessage());
                throw new ServiceException("获取会员设置信息失败");
            }
        };
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/RemoteVipSettingClient.java
New file
@@ -0,0 +1,15 @@
package com.ruoyi.other.api.feignClient;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.api.factory.RemoteVipSettingFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
@FeignClient(contextId = "RemoteOrderGoodsClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = RemoteVipSettingFallbackFactory.class)
public interface RemoteVipSettingClient {
    @GetMapping("/vip-setting/getVipSettingById")
    R<VipSetting> getVipSettingById(Integer id);
}
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/GeodesyUtil.java
@@ -36,14 +36,14 @@
            double WGS72 = getDistanceMeter(source, target, Ellipsoid.WGS72);
            double Clarke1858 = getDistanceMeter(source, target, Ellipsoid.Clarke1858);
            double Clarke1880 = getDistanceMeter(source, target, Ellipsoid.Clarke1880);
//            System.out.println("Sphere坐标系计算结果:"+Sphere + "米");
//            System.out.println("WGS84坐标系计算结果:"+WGS84 + "米");
//            System.out.println("GRS80坐标系计算结果:"+GRS80 + "米");
//            System.out.println("GRS67坐标系计算结果:"+GRS67 + "米");
//            System.out.println("ANS坐标系计算结果:"+ANS + "米");
//            System.out.println("WGS72坐标系计算结果:"+WGS72 + "米");
//            System.out.println("Clarke1858坐标系计算结果:"+Clarke1858 + "米");
//            System.out.println("Clarke1880坐标系计算结果:"+Clarke1880 + "米");
            System.out.println("Sphere坐标系计算结果:"+Sphere + "米");
            System.out.println("WGS84坐标系计算结果:"+WGS84 + "米");
            System.out.println("GRS80坐标系计算结果:"+GRS80 + "米");
            System.out.println("GRS67坐标系计算结果:"+GRS67 + "米");
            System.out.println("ANS坐标系计算结果:"+ANS + "米");
            System.out.println("WGS72坐标系计算结果:"+WGS72 + "米");
            System.out.println("Clarke1858坐标系计算结果:"+Clarke1858 + "米");
            System.out.println("Clarke1880坐标系计算结果:"+Clarke1880 + "米");
            map.put("Sphere", Sphere);
            map.put("WGS84", WGS84);
            map.put("GRS80", GRS80);
@@ -67,7 +67,7 @@
    public static void main(String[] ages){
        GeodesyUtil geodesyUtil = new GeodesyUtil();
        Map<String, Double> distance = geodesyUtil.getDistance("115.481028,39.989643", "114.465302,40.004717");
        Map<String, Double> distance = geodesyUtil.getDistance("104.063855,30.575442", "104.679931,31.471814");
        System.err.println(distance);
    }
}
ruoyi-common/ruoyi-common-redis/src/main/java/com/ruoyi/common/redis/aspectj/DistributedLockAspect.java
@@ -52,7 +52,7 @@
        //
        DistributedLock annotation = method.getAnnotation(DistributedLock.class);
        String lockName = getLockName(annotation, pjp.getArgs(), method);
        //log.info("lockName:"+lockName);
        log.info("lockName:"+lockName);
        RLock lock = redissonClient.getLock(lockName);
        lock.lock();
        try {
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/WithdrawalAuditStatus.java
New file
@@ -0,0 +1,16 @@
package com.ruoyi.account;
import lombok.Getter;
@Getter
public enum WithdrawalAuditStatus {
    WAIT_AUDIT(1, "待审核"),
    AUDIT_SUCCESS(2, "审核通过"),
    AUDIT_FAIL(3, "审核拒绝");
    private final Integer code;
    private final String desc;
    WithdrawalAuditStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java
@@ -3,11 +3,13 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.account.api.model.BalanceChangeRecord;
import com.ruoyi.account.service.BalanceChangeRecordService;
import com.ruoyi.account.service.WalletService;
import com.ruoyi.account.vo.WalletVO;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
@@ -23,6 +25,10 @@
public class WalletController extends BaseController {
    @Resource
    private BalanceChangeRecordService balanceChangeRecordService;
    @Resource
    private TokenService tokenService;
    @Resource
    private WalletService walletService;
    /**
     * 钱包详情
@@ -30,9 +36,8 @@
    @GetMapping("detail")
    @ApiOperation(value = "钱包详情", notes = "钱包详情", tags = {"小程序-个人中心-我的钱包-钱包详情"})
    public R<WalletVO> detail() {
        Long userId = SecurityUtils.getUserId();
        // TODO 查询钱包详情
        WalletVO walletVO = new WalletVO();
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        WalletVO walletVO = walletService.getWalletByUserId(loginUserApplet.getUserid());
        return R.ok(walletVO);
    }
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/WalletService.java
New file
@@ -0,0 +1,8 @@
package com.ruoyi.account.service;
import com.ruoyi.account.vo.WalletVO;
public interface WalletService {
    WalletVO getWalletByUserId(Long userId);
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
@@ -116,7 +116,7 @@
        loginUser.setUsername(appUser.getName());
        Map<String, Object> tokenApplet = tokenService.createTokenApplet(loginUser);
        loginVo.setToken(tokenApplet.get("access_token").toString());
        loginVo.setFailureTime(Long.valueOf(tokenApplet.get("expires_in").toString()));
            loginVo.setFailureTime(Long.valueOf(tokenApplet.get("expires_in").toString()));
        return AjaxResult.success(loginVo);
    }
    
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java
New file
@@ -0,0 +1,64 @@
package com.ruoyi.account.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.account.WithdrawalAuditStatus;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.api.model.WithdrawalRequests;
import com.ruoyi.account.service.AppUserService;
import com.ruoyi.account.service.WalletService;
import com.ruoyi.account.service.WithdrawalRequestsService;
import com.ruoyi.account.vo.WalletVO;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.api.feignClient.RemoteVipSettingClient;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
@Service
public class WalletServiceImpl implements WalletService {
    @Resource
    private AppUserService appUserService;
    @Resource
    private RemoteVipSettingClient remoteVipSettingClient;
    @Resource
    private WithdrawalRequestsService withdrawalRequestsService;
    @Override
    public WalletVO getWalletByUserId(Long userId) {
        AppUser appUser = appUserService.getById(userId);
        if (appUser == null) {
            throw new RuntimeException("用户不存在");
        }
        Integer vipId = appUser.getVipId();
        R<VipSetting> r = remoteVipSettingClient.getVipSettingById(vipId);
        if (r == null || r.getCode() != R.SUCCESS) {
            throw new RuntimeException("获取会员设置信息失败");
        }
        VipSetting data = r.getData();
        if (data == null) {
            throw new RuntimeException("会员设置信息为空");
        }
        // 获取提现审核中的金额
        List<WithdrawalRequests> waitAuditList = withdrawalRequestsService.list(new LambdaQueryWrapper<WithdrawalRequests>()
                .eq(WithdrawalRequests::getAppUserId, userId)
                .eq(WithdrawalRequests::getAuditStatus, WithdrawalAuditStatus.WAIT_AUDIT));
        WalletVO walletVO = new WalletVO();
        walletVO.setWithdrawalAmount(appUser.getWithdrawalAmount());
        walletVO.setWithdrawnAmount(appUser.getWithdrawnAmount());
        walletVO.setVipWithdrawalMinAmount(data.getVipWithdrawalMinAmount());
        walletVO.setTotalRechargeAmount(appUser.getTotalRechargeAmount());
        walletVO.setTotalRedPacketAmount(appUser.getTotalRedPacketAmount());
        walletVO.setTotalDistributionAmount(appUser.getTotalDistributionAmount());
        walletVO.setAuditAmount(waitAuditList.stream()
                .map(WithdrawalRequests::getWithdrawalAmount)
                .reduce(BigDecimal.ZERO, BigDecimal::add));
        return walletVO;
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletVO.java
@@ -11,23 +11,23 @@
public class WalletVO {
    @ApiModelProperty(value = "可提现金额")
    private BigDecimal withdrawal_amount;
    private BigDecimal withdrawalAmount;
    @ApiModelProperty(value = "已提现金额")
    private BigDecimal withdrawn_amount;
    private BigDecimal withdrawnAmount;
    @ApiModelProperty(value = "最低提现门槛")
    private BigDecimal vipWithdrawalMinAmount;
    @ApiModelProperty(value = "提现审核中金额")
    private BigDecimal audit_amount;
    private BigDecimal auditAmount;
    @ApiModelProperty(value = "充值总金额")
    private BigDecimal total_recharge_amount;
    private BigDecimal totalRechargeAmount;
    @ApiModelProperty(value = "红包总金额")
    private BigDecimal total_red_packet_amount;
    private BigDecimal totalRedPacketAmount;
    @ApiModelProperty(value = "分销总金额")
    private BigDecimal total_distribution_amount;
    private BigDecimal totalDistributionAmount;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -64,9 +64,9 @@
    @ApiImplicitParams({
            @ApiImplicitParam(value = "分享id", name = "shareId", required = true, dataType = "int", paramType="query"),
    })
    @GetMapping("/check/{orderId}/{shopId}")
    public R<Boolean> check(@PathVariable("orderId") Long orderId, @PathVariable("shopId") Long shopId){
        return R.ok(orderService.check(orderId, shopId));
    @GetMapping("/check/{orderNumber}/{shopId}")
    public R<Boolean> check(@PathVariable("orderNumber") String orderNumber, @PathVariable("shopId") Long shopId){
        return R.ok(orderService.check(orderNumber, shopId));
    }
    /**
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java
@@ -20,5 +20,5 @@
    OrderDetailVO getOrderDetail(Long orderId);
    boolean check(Long orderId, Long shopId);
    boolean check(String orderNumber, Long shopId);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -1,5 +1,6 @@
package com.ruoyi.order.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.order.mapper.OrderMapper;
import com.ruoyi.order.service.OrderService;
@@ -24,17 +25,21 @@
    @Override
    public List<OrderVO> getOrderList(Integer status) {
        // TODO 待实现
        return Collections.emptyList();
    }
    @Override
    public OrderDetailVO getOrderDetail(Long orderId) {
        // TODO 待实现
        return null;
    }
    @Override
    public boolean check(Long orderId, Long shopId) {
        // TODO 待实现
        return false;
    public boolean check(String orderNumber, Long shopId) {
        Order order = getOne(new LambdaQueryWrapper<Order>()
                .eq(Order::getOrderNumber, orderNumber)
                .eq(Order::getShopId, shopId));
        return order != null;
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RegionController.java
New file
@@ -0,0 +1,44 @@
package com.ruoyi.other.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.Region;
import com.ruoyi.other.service.RegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/region")
@Api("地区")
public class RegionController {
    @Resource
    private RegionService regionService;
    /**
     * 获取省份列表
     */
    @GetMapping("/getProvinceList")
    @ApiOperation("获取省份列表")
    public R<List<Region>> getProvinceList() {
        return R.ok(regionService.list(new LambdaQueryWrapper<Region>()
                .eq(Region::getParentId, 0)));
    }
    /**
     * 获取下级地区列表
     */
    @GetMapping("/getNextRegionList")
    @ApiOperation("获取下级地区列表")
    public R<List<Region>> getNextRegionList(@ApiParam("父级id") @RequestParam Long id) {
        return R.ok(regionService.list(new LambdaQueryWrapper<Region>()
                .eq(Region::getParentId, id)));
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
@@ -49,7 +49,7 @@
    /**
     * 分享添加
     */
    @ApiOperation(value = "小程序-个人中心-门店管理-分享添加", tags = {"分享添加-小程序"})
    @ApiOperation(value = "分享添加", tags = {"小程序-个人中心-门店管理-分享添加"})
    @PostMapping
    public R<Void> add(@RequestBody Share share){
        share.setAddType(ShareAddType.STORE.getCode());
@@ -86,9 +86,8 @@
     */
    @ApiOperation(value = "分享详情", tags = {"小程序-个人中心-门店管理-分享详情-小程序"})
    @GetMapping("/detail/{id}")
    public R<Void> detail(@PathVariable("id") Integer id){
        shareService.getById(id);
        return R.ok();
    public R<Share> detail(@PathVariable("id") Integer id){
        return R.ok(shareService.getById(id));
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -53,7 +53,7 @@
     * 门店详情
     */
    @GetMapping("/shopDetail")
    @ApiOperation(value = "门店详情", tags = {"门店详情-小程序"})
    @ApiOperation(value = "门店详情", tags = {"小程序-首页-门店详情"})
    public R<ShopDetailVO> shopDetail(@ApiParam("门店id") @RequestParam Integer shopId,
                                      @ApiParam("经度") @RequestParam String longitude,
                                      @ApiParam("纬度") @RequestParam String latitude) {
@@ -64,7 +64,7 @@
     * 查询当前店长所属门店
     */
    @GetMapping("/shopByUser")
    @ApiOperation(value = "查询当前店长所属门店", tags = {"小程序-个人中心-首页-关联门店列表"})
    @ApiOperation(value = "查询当前店长所属门店", tags = {"小程序-个人中心-首页"}, notes = "可绑定的门店列表")
    public R<List<Shop>> shopByUser() {
        List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>()
                .eq(Shop::getAppUserId, SecurityUtils.getUserId())
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java
@@ -1,8 +1,17 @@
package com.ruoyi.other.controller;
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 org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
 * <p>
@@ -14,7 +23,15 @@
 */
@RestController
@RequestMapping("/vip-setting")
@Api("会员设置")
public class VipSettingController {
    @Resource
    private VipSettingService vipSettingService;
    @GetMapping("getVipSettingById")
    @ApiOperation(value = "获取会员设置")
    public R<VipSetting> getVipSettingById(@ApiParam(value = "会员id") Integer id){
        return R.ok(vipSettingService.getById(id));
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/RegionMapper.java
New file
@@ -0,0 +1,7 @@
package com.ruoyi.other.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.other.api.domain.Region;
public interface RegionMapper extends BaseMapper<Region> {
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/VipGoodMapper.java
@@ -13,4 +13,9 @@
 */
public interface VipGoodMapper extends BaseMapper<VipGood> {
    /**
     * 查询指定商品的指定会员价格
     */
    VipGood selectVipGood(Long goodsId, Integer vipId);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/RegionService.java
New file
@@ -0,0 +1,7 @@
package com.ruoyi.other.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.other.api.domain.Region;
public interface RegionService extends IService<Region> {
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/VipSettingService.java
@@ -13,4 +13,5 @@
 */
public interface VipSettingService extends IService<VipSetting> {
    VipSetting getVipSettingByUserId(Long userId);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -4,11 +4,15 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.bean.BeanUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.enums.GoodsStatus;
import com.ruoyi.other.mapper.GoodsMapper;
import com.ruoyi.other.service.GoodsService;
import com.ruoyi.other.service.VipSettingService;
import com.ruoyi.other.vo.GoodsVO;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -28,6 +32,10 @@
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService {
    @Resource
    private GoodsMapper goodsMapper;
    @Resource
    private TokenService tokenService;
    @Resource
    private VipSettingService vipSettingService;
    @Override
    public List<GoodsVO> goodsList(Goods search) {
@@ -47,7 +55,10 @@
    @Override
    public GoodsVO goodsDetail(Long goodsId) {
        // TODO 根据会员等级展示价格
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        VipSetting vipSetting = vipSettingService.getVipSettingByUserId(loginUserApplet.getUserid());
        // TODO 根据会员等级计算价格、积分
        Goods goods = this.getById(goodsId);
        if (Objects.nonNull(goods)){
            GoodsVO goodsVO = new GoodsVO();
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/RegionServiceImpl.java
New file
@@ -0,0 +1,11 @@
package com.ruoyi.other.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.other.api.domain.Region;
import com.ruoyi.other.mapper.RegionMapper;
import com.ruoyi.other.service.RegionService;
import org.springframework.stereotype.Service;
@Service
public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> implements RegionService {
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/VipSettingServiceImpl.java
@@ -1,10 +1,15 @@
package com.ruoyi.other.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.other.mapper.VipSettingMapper;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.service.VipSettingService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
 * <p>
@@ -16,5 +21,15 @@
 */
@Service
public class VipSettingServiceImpl extends ServiceImpl<VipSettingMapper, VipSetting> implements VipSettingService {
    @Resource
    private AppUserClient appUserClient;
    @Override
    public VipSetting getVipSettingByUserId(Long userId) {
        AppUser appUser = appUserClient.getAppUserById(userId);
        if(null == appUser){
            throw new ServiceException("用户不存在");
        }
        return this.getById(appUser.getVipId());
    }
}