From 64a71565792d4f2e9fd31eab6e98e972c12daa86 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 27 十一月 2024 20:15:57 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletVO.java | 12 +-
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java | 17 ++
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java | 7
ruoyi-api/ruoyi-api-order/src/main/java/feignClient/RemoteOrderGoodsClient.java | 2
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/RemoteVipSettingFallbackFactory.java | 22 +++
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/RegionService.java | 7 +
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java | 4
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java | 6
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java | 11 +
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/VipSettingServiceImpl.java | 15 ++
ruoyi-common/ruoyi-common-redis/src/main/java/com/ruoyi/common/redis/aspectj/DistributedLockAspect.java | 2
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/WalletService.java | 8 +
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/GeodesyUtil.java | 18 +-
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java | 2
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RegionController.java | 44 +++++++
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Region.java | 29 ++++
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/WithdrawalAuditStatus.java | 16 ++
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java | 64 ++++++++++
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/RemoteVipSettingClient.java | 15 ++
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/VipSettingService.java | 1
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/VipGoodMapper.java | 5
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java | 2
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/RegionServiceImpl.java | 11 +
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java | 13 +
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/RegionMapper.java | 7 +
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java | 13 ++
26 files changed, 316 insertions(+), 37 deletions(-)
diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/feignClient/RemoteOrderGoodsClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/feignClient/RemoteOrderGoodsClient.java
index 12ff392..95afd49 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/feignClient/RemoteOrderGoodsClient.java
+++ b/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;
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Region.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Region.java
new file mode 100644
index 0000000..d3cd1b8
--- /dev/null
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Region.java
@@ -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;
+}
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/RemoteVipSettingFallbackFactory.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/RemoteVipSettingFallbackFactory.java
new file mode 100644
index 0000000..6bd559c
--- /dev/null
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/RemoteVipSettingFallbackFactory.java
@@ -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("获取会员设置信息失败");
+ }
+ };
+ }
+}
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/RemoteVipSettingClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/RemoteVipSettingClient.java
new file mode 100644
index 0000000..7df1f05
--- /dev/null
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/RemoteVipSettingClient.java
@@ -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);
+}
diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/GeodesyUtil.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/GeodesyUtil.java
index ff1cfd1..276d9f1 100644
--- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/GeodesyUtil.java
+++ b/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);
}
}
diff --git a/ruoyi-common/ruoyi-common-redis/src/main/java/com/ruoyi/common/redis/aspectj/DistributedLockAspect.java b/ruoyi-common/ruoyi-common-redis/src/main/java/com/ruoyi/common/redis/aspectj/DistributedLockAspect.java
index fa06f8c..631a3b1 100644
--- a/ruoyi-common/ruoyi-common-redis/src/main/java/com/ruoyi/common/redis/aspectj/DistributedLockAspect.java
+++ b/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 {
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/WithdrawalAuditStatus.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/WithdrawalAuditStatus.java
new file mode 100644
index 0000000..3daa060
--- /dev/null
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/WithdrawalAuditStatus.java
@@ -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;
+ }
+}
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java
index 5cc846e..291de10 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java
+++ b/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);
}
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/WalletService.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/WalletService.java
new file mode 100644
index 0000000..088e35a
--- /dev/null
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/WalletService.java
@@ -0,0 +1,8 @@
+package com.ruoyi.account.service;
+
+import com.ruoyi.account.vo.WalletVO;
+
+public interface WalletService {
+
+ WalletVO getWalletByUserId(Long userId);
+}
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
index f50c1db..5ca3e21 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
+++ b/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);
}
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java
new file mode 100644
index 0000000..4762e9b
--- /dev/null
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java
@@ -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;
+ }
+
+}
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletVO.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletVO.java
index 1b4fc74..d93c21f 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletVO.java
+++ b/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;
}
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
index 5b040db..e424629 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
+++ b/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));
}
/**
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java
index 0961a26..0fb5308 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java
+++ b/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);
}
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
index 8b83866..4cb9ffe 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
+++ b/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;
}
}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RegionController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RegionController.java
new file mode 100644
index 0000000..c01da9f
--- /dev/null
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RegionController.java
@@ -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)));
+ }
+}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
index 3450cb6..db05155 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
+++ b/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));
}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
index 2766c5f..b4cb27a 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
+++ b/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())
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 2854a20..82d8443 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,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));
+ }
}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/RegionMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/RegionMapper.java
new file mode 100644
index 0000000..0f5ea38
--- /dev/null
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/RegionMapper.java
@@ -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> {
+}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/VipGoodMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/VipGoodMapper.java
index a135675..4f6ca6e 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/VipGoodMapper.java
+++ b/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);
+
}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/RegionService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/RegionService.java
new file mode 100644
index 0000000..ef39093
--- /dev/null
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/RegionService.java
@@ -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> {
+}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/VipSettingService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/VipSettingService.java
index 5fedae2..e576300 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/VipSettingService.java
+++ b/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);
}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
index b1de54c..43064ab 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
+++ b/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();
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/RegionServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/RegionServiceImpl.java
new file mode 100644
index 0000000..d1f3777
--- /dev/null
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/RegionServiceImpl.java
@@ -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 {
+}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/VipSettingServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/VipSettingServiceImpl.java
index 16df5b2..be94a0c 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/VipSettingServiceImpl.java
+++ b/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());
+ }
}
--
Gitblit v1.7.1