From e1c6652ca142519d26d2f8a59d36420170d1161f Mon Sep 17 00:00:00 2001
From: phpcjl <phpcjl@gmail.com>
Date: 星期三, 04 十二月 2024 16:23:38 +0800
Subject: [PATCH] 1.补充文档
---
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/enums/OrderStatus.java | 32 +
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/NearbyShopVO.java | 6
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/filter/AuthFilter.java | 2
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/ShoppingCartService.java | 50 ++
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java | 972 ++++++++++++++++++++++++++++++++++++++
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java | 16
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderGoodService.java | 16
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java | 9
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderGoodMapper.java | 16
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java | 28 +
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java | 195 +++++++
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/enums/OrderType.java | 26 +
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderGoodServiceImpl.java | 20
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java | 20
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderGoodController.java | 39 +
15 files changed, 1,443 insertions(+), 4 deletions(-)
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 ae1e65c..06c0f0e 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
@@ -3,6 +3,8 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.order.service.OrderService;
import org.springframework.web.bind.annotation.*;
@@ -29,7 +31,7 @@
@Api(tags = "订单")
@RestController
@RequestMapping("/order")
-public class OrderController {
+public class OrderController extends BaseController {
@Resource
private OrderService orderService;
@Resource
@@ -44,9 +46,10 @@
@ApiImplicitParam(value = "订单状态", name = "status", required = true, dataType = "int"),
})
@GetMapping("/getMyOrderList/{status}")
- public R<List<OrderVO>> getMyOrderList(@PathVariable("status") Integer status){
+ public TableDataInfo getMyOrderList(@PathVariable("status") Integer status){
+ startPage();
LoginUser loginUserApplet = tokenService.getLoginUserApplet();
- return R.ok(orderService.selectOrderListByUserId(status, loginUserApplet.getUserid()));
+ return getDataTable(orderService.selectOrderListByUserId(status, loginUserApplet.getUserid()));
}
/**
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderGoodController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderGoodController.java
new file mode 100644
index 0000000..bfc843d
--- /dev/null
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderGoodController.java
@@ -0,0 +1,39 @@
+package com.ruoyi.order.controller;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.order.service.OrderGoodService;
+import com.ruoyi.model.OrderGood;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * <p>
+ * 前端控制器
+ * </p>
+ *
+ * @author luodangjia
+ * @since 2024-11-21
+ */
+@RestController
+@RequestMapping("/order-good")
+public class OrderGoodController extends BaseController {
+ @Resource
+ private OrderGoodService orderGoodService;
+
+ /**
+ * 查询指定商品订单
+ */
+ @PostMapping("/selectGoodsOrder")
+ public R<List<OrderGood>> selectGoodsOrder(@RequestBody List<Long> goodsIds){
+ startPage();
+ List<OrderGood> orderGoods = orderGoodService.list(new LambdaQueryWrapper<OrderGood>()
+ .in(OrderGood::getGoodsId, goodsIds));
+ return R.ok(orderGoods);
+ }
+}
+
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/enums/OrderStatus.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/enums/OrderStatus.java
new file mode 100644
index 0000000..c8cfe81
--- /dev/null
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/enums/OrderStatus.java
@@ -0,0 +1,32 @@
+package com.ruoyi.order.enums;
+
+import lombok.Getter;
+
+@Getter
+public enum OrderStatus {
+ PENDING_SHIPMENT(1, "待发货"),
+ PENDING_RECEIPT(2, "待收货"),
+ PENDING_USE(3, "待使用"),
+ COMPLETED(4, "已完成"),
+ CANCELLED(5, "已取消"),
+ REFUNDED(6, "已退款"),
+ AFTER_SALE(7, "售后中");
+
+ private final int code;
+ private final String description;
+
+ OrderStatus(int code, String description) {
+ this.code = code;
+ this.description = description;
+ }
+
+ // 根据代码获取对应的OrderStatus
+ public static OrderStatus fromCode(int code) {
+ for (OrderStatus status : values()) {
+ if (status.getCode() == code) {
+ return status;
+ }
+ }
+ throw new IllegalArgumentException("Unknown order status code: " + code);
+ }
+}
\ No newline at end of file
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/enums/OrderType.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/enums/OrderType.java
new file mode 100644
index 0000000..c3a581f
--- /dev/null
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/enums/OrderType.java
@@ -0,0 +1,26 @@
+package com.ruoyi.order.enums;
+
+import lombok.Getter;
+
+@Getter
+public enum OrderType {
+ SERVICE(1, "服务单"),
+ GOOD(2, "商品单");
+
+ private final int code;
+ private final String description;
+
+ OrderType(int code, String description) {
+ this.code = code;
+ this.description = description;
+ }
+
+ public static OrderType fromCode(int code) {
+ for (OrderType type : OrderType.values()) {
+ if (type.getCode() == code) {
+ return type;
+ }
+ }
+ return null;
+ }
+}
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderGoodMapper.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderGoodMapper.java
new file mode 100644
index 0000000..b9904fc
--- /dev/null
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderGoodMapper.java
@@ -0,0 +1,16 @@
+package com.ruoyi.order.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.order.model.OrderGood;
+
+/**
+ * <p>
+ * Mapper 接口
+ * </p>
+ *
+ * @author luodangjia
+ * @since 2024-11-21
+ */
+public interface OrderGoodMapper extends BaseMapper<OrderGood> {
+
+}
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderGoodService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderGoodService.java
new file mode 100644
index 0000000..b7dc631
--- /dev/null
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderGoodService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.order.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.model.OrderGood;
+
+/**
+ * <p>
+ * 服务类
+ * </p>
+ *
+ * @author luodangjia
+ * @since 2024-11-21
+ */
+public interface OrderGoodService extends IService<OrderGood> {
+
+}
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
new file mode 100644
index 0000000..6250043
--- /dev/null
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java
@@ -0,0 +1,28 @@
+package com.ruoyi.order.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.order.model.Order;
+import com.ruoyi.order.vo.OrderDetailVO;
+import com.ruoyi.order.vo.OrderVO;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 服务类
+ * </p>
+ *
+ * @author luodangjia
+ * @since 2024-11-21
+ */
+public interface OrderService extends IService<Order> {
+ List<OrderVO> selectOrderListByUserId(Integer status,Long userId);
+
+ OrderDetailVO getOrderDetail(Long orderId);
+
+ boolean check(Order order, Integer shopId, Long userId);
+
+ void writeOff(String code,Integer shopId);
+
+ void commission(Long orderId);
+}
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java
new file mode 100644
index 0000000..2e00db1
--- /dev/null
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.order.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.model.RefundPass;
+
+/**
+ * <p>
+ * 服务类
+ * </p>
+ *
+ * @author luodangjia
+ * @since 2024-11-21
+ */
+public interface RefundPassService extends IService<RefundPass> {
+
+}
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/ShoppingCartService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/ShoppingCartService.java
new file mode 100644
index 0000000..7de8229
--- /dev/null
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/ShoppingCartService.java
@@ -0,0 +1,50 @@
+package com.ruoyi.order.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.order.vo.*;
+import com.ruoyi.model.ShoppingCart;
+
+import java.util.List;
+
+public interface ShoppingCartService extends IService<ShoppingCart> {
+
+
+ /**
+ * 获取购物车列表数据
+ * @param type
+ * @param shopId
+ * @return
+ */
+ List<MyShoppingCartVo> getMyShoppingCart(Integer type, Integer shopId);
+
+ /**
+ * 添加商品
+ * @param shoppingCart
+ */
+ void addGoods(ShoppingCart shoppingCart);
+
+
+ /**
+ * 修改购物车数量
+ * @param setGoodsNumber
+ * @return
+ */
+ R setGoodsNumber(SetGoodsNumber setGoodsNumber);
+
+
+ /**
+ * 确认购物车订单
+ * @param confirmOrder
+ * @return
+ */
+ ConfirmOrderVo confirmOrder(ConfirmOrder confirmOrder);
+
+
+ /**
+ * 购物车支付操作
+ * @param shoppingCartPayment
+ * @return
+ */
+ R shoppingCartPayment(ShoppingCartPayment shoppingCartPayment);
+}
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderGoodServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderGoodServiceImpl.java
new file mode 100644
index 0000000..788112c
--- /dev/null
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderGoodServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.order.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.order.mapper.OrderGoodMapper;
+import com.ruoyi.order.service.OrderGoodService;
+import com.ruoyi.model.OrderGood;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author luodangjia
+ * @since 2024-11-21
+ */
+@Service
+public class OrderGoodServiceImpl extends ServiceImpl<OrderGoodMapper, OrderGood> implements OrderGoodService {
+
+}
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
new file mode 100644
index 0000000..5064e1b
--- /dev/null
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -0,0 +1,195 @@
+package com.ruoyi.order.service.impl;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.api.feignClient.AppUserClient;
+import com.ruoyi.account.api.model.AppUserShop;
+import com.ruoyi.account.api.model.UserAddress;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.exception.ServiceException;
+import com.ruoyi.common.core.utils.StringUtils;
+import com.ruoyi.common.security.service.TokenService;
+import com.ruoyi.order.enums.OrderStatus;
+import com.ruoyi.order.enums.OrderType;
+import com.ruoyi.order.mapper.OrderGoodMapper;
+import com.ruoyi.order.mapper.OrderMapper;
+import com.ruoyi.order.model.Order;
+import com.ruoyi.order.model.OrderGood;
+import com.ruoyi.order.service.OrderService;
+import com.ruoyi.order.vo.OrderDetailVO;
+import com.ruoyi.order.vo.OrderGoodsVO;
+import com.ruoyi.order.vo.OrderVO;
+import com.ruoyi.other.api.domain.CouponInfo;
+import com.ruoyi.other.api.domain.Goods;
+import com.ruoyi.other.api.domain.OrderActivityInfo;
+import com.ruoyi.other.api.domain.Technician;
+import com.ruoyi.other.api.feignClient.TechnicianClient;
+import com.ruoyi.system.api.model.LoginUser;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author luodangjia
+ * @since 2024-11-21
+ */
+@Service
+public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
+ @Resource
+ private OrderMapper orderMapper;
+ @Resource
+ private OrderGoodMapper orderGoodMapper;
+ @Resource
+ private AppUserClient appUserClient;
+ @Resource
+ private TokenService tokenService;
+ @Resource
+ private TechnicianClient technicianClient;
+
+
+ @Override
+ public List<OrderVO> selectOrderListByUserId(Integer status, Long userId) {
+ return orderMapper.selectOrderListByUserId(status, userId);
+ }
+
+
+
+
+ @Override
+ public OrderDetailVO getOrderDetail(Long orderId) {
+ Order order = orderMapper.selectById(orderId);
+ if (order == null){
+ throw new ServiceException("订单不存在");
+ }
+ // 商品
+ List<OrderGood> orderGoods = orderGoodMapper.selectList(new LambdaQueryWrapper<OrderGood>()
+ .eq(OrderGood::getOrderId, orderId));
+
+ List<OrderGoodsVO> goodsList = new ArrayList<>();
+ for (OrderGood orderGood : orderGoods) {
+ String goodJson = orderGood.getGoodJson();
+ Goods goods = JSONObject.parseObject(goodJson, Goods.class);
+
+ OrderGoodsVO orderGoodsVO = new OrderGoodsVO();
+ orderGoodsVO.setGoodsId(orderGood.getGoodsId());
+ orderGoodsVO.setGoodsName(goods.getName());
+ orderGoodsVO.setType(goods.getType());
+ orderGoodsVO.setNum(orderGood.getNum());
+ orderGoodsVO.setGoodsPic(goods.getHomePagePicture());
+ orderGoodsVO.setSellingPrice(goods.getSellingPrice());
+ orderGoodsVO.setOriginalPrice(goods.getOriginalPrice());
+ goodsList.add(orderGoodsVO);
+ }
+
+
+ // 收货地址
+ String addressJson = order.getAddressJson();
+ UserAddress userAddress = new UserAddress();
+ if (StringUtils.isNotEmpty(addressJson)){
+ userAddress = JSONObject.parseObject(addressJson, UserAddress.class);
+
+ }
+
+ // 优惠券
+ String couponJson = order.getCouponJson();
+ CouponInfo couponInfo = new CouponInfo();
+ if (StringUtils.isNotEmpty(couponJson)){
+ couponInfo = JSONObject.parseObject(couponJson, CouponInfo.class);
+ }
+
+ // 参与活动
+ String activityJson = order.getActivityJson();
+ OrderActivityInfo orderActivityInfo = new OrderActivityInfo();
+ if (StringUtils.isNotEmpty(activityJson)){
+ orderActivityInfo = JSONObject.parseObject(activityJson, OrderActivityInfo.class);
+ }
+
+ OrderDetailVO orderDetailVO = new OrderDetailVO();
+ orderDetailVO.setId(order.getId());
+ orderDetailVO.setPoint(order.getPoint());
+ orderDetailVO.setAddressId(userAddress.getId());
+ orderDetailVO.setRecieveName(userAddress.getRecieveName());
+ orderDetailVO.setRecievePhone(userAddress.getRecievePhone());
+ orderDetailVO.setRecieveAddress(userAddress.getRecieveAddress());
+ orderDetailVO.setOrderNumber(order.getOrderNumber());
+ orderDetailVO.setCreateTime(order.getCreateTime());
+ orderDetailVO.setTotalAmount(order.getTotalAmount());
+ orderDetailVO.setCouponName(couponInfo.getCouponName());
+ orderDetailVO.setActivityName(orderActivityInfo.getActivityName());
+ orderDetailVO.setCouponAmount(order.getDiscountTotalAmount());
+ orderDetailVO.setExpressAmount(order.getExpressAmount());
+ orderDetailVO.setPointAmount(order.getGetPoint());
+ orderDetailVO.setPaymentAmount(order.getPaymentAmount());
+ orderDetailVO.setGoodsList(goodsList);
+ return orderDetailVO;
+ }
+
+ @Override
+ public boolean check(Order order, Integer shopId, Long userId) {
+ R<List<AppUserShop>> r = appUserClient.getAppUserShop(userId);
+ if (r.getCode() != R.SUCCESS){
+ throw new ServiceException("获取用户门店信息失败");
+ }
+ List<AppUserShop> appUserShopList = r.getData();
+ if (appUserShopList == null || appUserShopList.isEmpty()){
+ return false;
+ }
+
+ // 判断用户是否拥有该门店
+ List<AppUserShop> userShopList = appUserShopList.stream()
+ .filter(appUserShop -> appUserShop.getShopId().equals(shopId))
+ .collect(Collectors.toList());
+ if (userShopList.isEmpty()){
+ return false;
+ }
+
+ // 判断订单是否属于该门店
+ if (order == null){
+ throw new ServiceException("订单不存在");
+ }
+
+ return order.getShopId().equals(shopId);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void writeOff(String code,Integer shopId) {
+ LoginUser loginUserApplet = tokenService.getLoginUserApplet();
+ Order order = orderMapper.selectOne(new LambdaQueryWrapper<Order>()
+ .eq(Order::getOrderNumber, code));
+ boolean check = check(order, shopId, loginUserApplet.getUserid());
+ if (!check){
+ throw new ServiceException("订单不存在");
+ }
+ order.setOrderStatus(OrderStatus.COMPLETED.getCode());
+ orderMapper.updateById(order);
+ Integer orderType = order.getOrderType();
+ if (orderType.equals(OrderType.SERVICE.getCode())){
+ R<Technician> shopdetail = technicianClient.shopdetail(order.getTechnicianId());
+ if (shopdetail.getCode() != R.SUCCESS){
+ throw new ServiceException("获取技师信息失败");
+ }
+ Technician technician = shopdetail.getData();
+ R<Void> r = technicianClient.updateStatus(2, technician.getId());
+ if (r.getCode() != R.SUCCESS){
+ throw new ServiceException("修改技师状态失败");
+ }
+ }
+ }
+
+
+
+ @Override
+ public void commission(Long orderId) {
+
+ }
+}
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java
new file mode 100644
index 0000000..4bccf3d
--- /dev/null
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.order.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.order.mapper.RefundPassMapper;
+import com.ruoyi.order.service.RefundPassService;
+import com.ruoyi.model.RefundPass;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author luodangjia
+ * @since 2024-11-21
+ */
+@Service
+public class RefundPassServiceImpl extends ServiceImpl<RefundPassMapper, RefundPass> implements RefundPassService {
+
+}
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
new file mode 100644
index 0000000..b20d3cd
--- /dev/null
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -0,0 +1,972 @@
+package com.ruoyi.order.service.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.api.feignClient.*;
+import com.ruoyi.account.api.model.AppUser;
+import com.ruoyi.account.api.model.BalanceChangeRecord;
+import com.ruoyi.account.api.model.UserAddress;
+import com.ruoyi.account.api.model.UserPoint;
+import com.ruoyi.account.api.vo.CouponInfoVo;
+import com.ruoyi.account.api.vo.PaymentUserCoupon;
+import com.ruoyi.account.api.vo.PaymentUserCouponVo;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.security.service.TokenService;
+import com.ruoyi.order.mapper.ShoppingCartMapper;
+import com.ruoyi.order.service.OrderGoodService;
+import com.ruoyi.order.service.OrderService;
+import com.ruoyi.order.service.ShoppingCartService;
+import com.ruoyi.order.vo.*;
+import com.ruoyi.other.api.domain.*;
+import com.ruoyi.other.api.feignClient.*;
+import com.ruoyi.other.api.vo.GetGoodsBargainPrice;
+import com.ruoyi.other.api.vo.GetGoodsShopByGoodsIds;
+import com.ruoyi.other.api.vo.GetSeckillActivityInfo;
+import lombok.Data;
+import com.ruoyi.model.Order;
+import com.ruoyi.model.OrderGood;
+import com.ruoyi.model.ShoppingCart;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, ShoppingCart> implements ShoppingCartService {
+
+ @Resource
+ private TokenService tokenService;
+
+ @Resource
+ private GoodsClient goodsClient;
+
+ @Resource
+ private GoodsShopClient goodsShopClient;
+
+ @Resource
+ private AppUserClient appUserClient;
+
+ @Resource
+ private GoodsAreaClient goodsAreaClient;
+
+ @Resource
+ private GoodsVipClient goodsVipClient;
+
+ @Resource
+ private SeckillActivityInfoClient seckillActivityInfoClient;
+
+ @Resource
+ private GoodsBargainPriceClient goodsBargainPriceClient;
+
+ @Resource
+ private OrderService orderService;
+
+ @Resource
+ private OrderGoodService orderGoodService;
+
+ @Resource
+ private ShopClient shopClient;
+
+ @Resource
+ private OrderActivityInfoClient orderActivityInfoClient;
+
+ @Resource
+ private BaseSettingClient baseSettingClient;
+
+ @Resource
+ private UserAddressClient userAddressClient;
+
+ @Resource
+ private UserCouponClient userCouponClient;
+
+ @Resource
+ private SystemConfigClient systemConfigClient;
+
+ @Resource
+ private UserPointClient userPointClient;
+
+ @Resource
+ private BalanceChangeRecordClient balanceChangeRecordClient;
+
+
+
+
+
+
+ /**
+ * 获取购物车列表
+ * @param type
+ * @param shopId
+ * @return
+ */
+ @Override
+ public List<MyShoppingCartVo> getMyShoppingCart(Integer type, Integer shopId) {
+ Long userid = tokenService.getLoginUserApplet().getUserid();
+ AppUser appUser = appUserClient.getAppUserById(userid);
+ //获取对应类型的商品数据
+ List<Goods> data = goodsClient.getGoodsByType(type).getData();
+ if(null == data){
+ throw new RuntimeException("根据类型(1=服务商品,2=单品商品)获取商品数据失败");
+ }
+ List<Integer> goodsIds = data.stream().map(Goods::getId).collect(Collectors.toList());
+ //查询符合商品类型的商品数据
+ List<ShoppingCart> list = this.list(new LambdaQueryWrapper<ShoppingCart>().eq(ShoppingCart::getAppUserId, userid).in(ShoppingCart::getGoodsId, goodsIds));
+ //构建返回数据
+ List<MyShoppingCartVo> page = buildDetail(appUser, shopId, list, null);
+ return page;
+ }
+
+
+ /**
+ * 获取支付价格
+ * @param appUser
+ * @param goodsId
+ * @param shopId
+ * @return
+ */
+ public Price getPrice(AppUser appUser, Integer goodsId, Integer shopId){
+ //获取支付价格
+ //秒杀活动>门店特价>地区价格>会员价格
+ //判断是否有秒杀活动
+ Price price = new Price();
+ GetSeckillActivityInfo info = new GetSeckillActivityInfo();
+ info.setGoodsId(goodsId);
+ info.setVip(appUser.getVipId());
+ GoodsSeckill goodsSeckill = seckillActivityInfoClient.getSeckillActivityInfo(info).getData();
+ if(null == goodsSeckill){
+ //没有秒杀价,则判断门店特价
+ GetGoodsBargainPrice goodsBargainPrice = new GetGoodsBargainPrice();
+ goodsBargainPrice.setGoodsId(goodsId);
+ goodsBargainPrice.setVip(appUser.getVipId());
+ goodsBargainPrice.setShopId(shopId);
+ GoodsBargainPriceDetail bargainPriceDetail = goodsBargainPriceClient.getGoodsBargainPrice(goodsBargainPrice).getData();
+ if(null == bargainPriceDetail){
+ //没有门店特价,判断地区价格配置
+ GoodsArea area = new GoodsArea();
+ area.setDistrictsCode(appUser.getDistrictCode());
+ area.setCityCode(appUser.getCityCode());
+ area.setProvinceCode(appUser.getProvinceCode());
+ area.setVip(appUser.getVipId());
+ GoodsArea goodsArea = goodsAreaClient.getGoodsArea(area).getData();
+ if(null == goodsArea){
+ //没有地区价格,则使用会员价格
+ GoodsVip goodsVip = goodsVipClient.getGoodsVip(appUser.getVipId()).getData();
+ if(null == goodsVip){
+ //没有配置价格,直接使用原始基础价格
+ return null;
+ }else{
+ price.setCash(goodsVip.getSellingPrice());
+ price.setPoint(goodsVip.getIntegral());
+ price.setCashPayment(goodsVip.getCashPayment() == 1 ? true : false);
+ price.setPointPayment(goodsVip.getPointPayment() == 1 ? true : false);
+ price.setEarnSpendingPoints(goodsVip.getEarnSpendingPoints());
+ price.setSuperiorSubcommission(goodsVip.getSuperiorSubcommission());
+ price.setSuperiorRebatePoints(goodsVip.getSuperiorRebatePoints());
+ price.setSuperiorType(goodsVip.getSuperiorType());
+ price.setServuceShopCharges(goodsVip.getServuceShopCharges());
+ price.setServuceShopPoints(goodsVip.getServuceShopPoints());
+ price.setTechnicianPoints(goodsVip.getTechnicianPoints());
+ price.setBoundShopCharges(goodsVip.getBoundShopCharges());
+ price.setBoundShopPoints(goodsVip.getBoundShopPoints());
+ price.setBoundShopSuperiorsCharges(goodsVip.getBoundShopSuperiorsCharges());
+ price.setBoundShopSuperiorsPoints(goodsVip.getBoundShopSuperiorsPoints());
+ }
+ }else{
+ price.setCash(goodsArea.getSellingPrice());
+ price.setPoint(goodsArea.getIntegral());
+ price.setCashPayment(goodsArea.getCashPayment() == 1 ? true : false);
+ price.setPointPayment(goodsArea.getPointPayment() == 1 ? true : false);
+ price.setEarnSpendingPoints(goodsArea.getEarnSpendingPoints());
+ price.setSuperiorSubcommission(goodsArea.getSuperiorSubcommission());
+ price.setSuperiorRebatePoints(goodsArea.getSuperiorRebatePoints());
+ price.setSuperiorType(goodsArea.getSuperiorType());
+ price.setServuceShopCharges(goodsArea.getServuceShopCharges());
+ price.setServuceShopPoints(goodsArea.getServuceShopPoints());
+ price.setTechnicianPoints(goodsArea.getTechnicianPoints());
+ price.setBoundShopCharges(goodsArea.getBoundShopCharges());
+ price.setBoundShopPoints(goodsArea.getBoundShopPoints());
+ price.setBoundShopSuperiorsCharges(goodsArea.getBoundShopSuperiorsCharges());
+ price.setBoundShopSuperiorsPoints(goodsArea.getBoundShopSuperiorsPoints());
+ }
+ }else{
+ price.setCash(bargainPriceDetail.getSellingPrice());
+ price.setPoint(bargainPriceDetail.getIntegral());
+ price.setCashPayment(bargainPriceDetail.getSellingPrice() != null ? true : false);
+ price.setPointPayment(bargainPriceDetail.getIntegral() != null ? true : false);
+ //门店特价,消费积分使用会员等级的消费积分
+ GoodsArea area = new GoodsArea();
+ area.setDistrictsCode(appUser.getDistrictCode());
+ area.setCityCode(appUser.getCityCode());
+ area.setProvinceCode(appUser.getProvinceCode());
+ area.setVip(appUser.getVipId());
+ GoodsArea goodsArea = goodsAreaClient.getGoodsArea(area).getData();
+ price.setEarnSpendingPoints(goodsArea.getEarnSpendingPoints());
+ price.setSuperiorSubcommission(goodsArea.getSuperiorSubcommission());
+ price.setSuperiorRebatePoints(goodsArea.getSuperiorRebatePoints());
+ price.setSuperiorType(goodsArea.getSuperiorType());
+ price.setServuceShopCharges(goodsArea.getServuceShopCharges());
+ price.setServuceShopPoints(goodsArea.getServuceShopPoints());
+ price.setTechnicianPoints(goodsArea.getTechnicianPoints());
+ price.setBoundShopCharges(goodsArea.getBoundShopCharges());
+ price.setBoundShopPoints(goodsArea.getBoundShopPoints());
+ price.setBoundShopSuperiorsCharges(goodsArea.getBoundShopSuperiorsCharges());
+ price.setBoundShopSuperiorsPoints(goodsArea.getBoundShopSuperiorsPoints());
+ }
+ }else{
+ //构建价格数据
+ if(goodsSeckill.getCashPayment() == 1 && goodsSeckill.getPointPayment() == 1){
+ price.setCash(goodsSeckill.getSellingPrice());
+ price.setPoint(goodsSeckill.getIntegral());
+ }
+ if(goodsSeckill.getCashPayment() == 1 && goodsSeckill.getPointPayment() == 0){
+ price.setCash(goodsSeckill.getSellingPrice());
+ }
+ if(goodsSeckill.getCashPayment() == 0 && goodsSeckill.getPointPayment() == 1){
+ price.setPoint(goodsSeckill.getIntegral());
+ }
+ price.setCashPayment(goodsSeckill.getCashPayment() == 1 ? true : false);
+ price.setPointPayment(goodsSeckill.getPointPayment() == 1 ? true : false);
+ price.setEndTime(goodsSeckill.getEndTime());
+ price.setEarnSpendingPoints(goodsSeckill.getEarnSpendingPoints());
+ price.setSuperiorSubcommission(goodsSeckill.getSuperiorSubcommission());
+ price.setSuperiorRebatePoints(goodsSeckill.getSuperiorRebatePoints());
+ price.setSuperiorType(goodsSeckill.getSuperiorType());
+ price.setServuceShopCharges(goodsSeckill.getServuceShopCharges());
+ price.setServuceShopPoints(goodsSeckill.getServuceShopPoints());
+ price.setTechnicianPoints(goodsSeckill.getTechnicianPoints());
+ price.setBoundShopCharges(goodsSeckill.getBoundShopCharges());
+ price.setBoundShopPoints(goodsSeckill.getBoundShopPoints());
+ price.setBoundShopSuperiorsCharges(goodsSeckill.getBoundShopSuperiorsCharges());
+ price.setBoundShopSuperiorsPoints(goodsSeckill.getBoundShopSuperiorsPoints());
+ }
+ return price;
+ }
+
+
+ @Data
+ class Price {
+ /**
+ * 现金
+ */
+ private BigDecimal cash;
+ /**
+ * 积分
+ */
+ private Integer point;
+ /**
+ * 获取结束时间
+ */
+ private Long endTime;
+ /**
+ * 现金支付
+ */
+ private Boolean cashPayment;
+ /**
+ * 积分支付
+ */
+ private Boolean pointPayment;
+ /**
+ * 可获得消费积分
+ */
+ private Integer earnSpendingPoints;
+ /**
+ * 上级获得分佣金额
+ */
+ private BigDecimal superiorSubcommission;
+ /**
+ * 上级获得返佣积分
+ */
+ private Integer superiorRebatePoints;
+ /**
+ * 获取返佣积分上级类型(1=直推上级,2=直帮上级)
+ */
+ private Integer superiorType;
+ /**
+ * 核销门店可获得服务费
+ */
+ private BigDecimal servuceShopCharges;
+ /**
+ * 核销门店可获得服务积分
+ */
+ private Integer servuceShopPoints;
+ /**
+ * 技师可获得服务积分
+ */
+ private Integer technicianPoints;
+ /**
+ * 绑定门店可获得分佣金额
+ */
+ private BigDecimal boundShopCharges;
+ /**
+ * 绑定门店可获得返佣积分
+ */
+ private Integer boundShopPoints;
+ /**
+ * 绑定门店上级门店可获得分佣金额
+ */
+ private BigDecimal boundShopSuperiorsCharges;
+ /**
+ * 绑定门店上级门店可获得返佣积分
+ */
+ private Integer boundShopSuperiorsPoints;
+ }
+
+
+ @Override
+ public void addGoods(ShoppingCart shoppingCart) {
+ Long userid = tokenService.getLoginUserApplet().getUserid();
+ shoppingCart.setAppUserId(userid);
+ this.save(shoppingCart);
+ }
+
+
+ /**
+ * 修改购物车数量
+ * @param setGoodsNumber
+ * @return
+ */
+ @Override
+ public R setGoodsNumber(SetGoodsNumber setGoodsNumber) {
+ if(0 >= setGoodsNumber.getNumber()){
+ return R.fail("修改数量不能小于等于0");
+ }
+ ShoppingCart shoppingCart = this.getById(setGoodsNumber.getId());
+ Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData();
+ if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit() && goods.getPurchaseLimit() < setGoodsNumber.getNumber()){
+ return R.fail("修改数量不能大于限购数量");
+ }
+ if(null != shoppingCart){
+ shoppingCart.setNumber(setGoodsNumber.getNumber());
+ this.updateById(shoppingCart);
+ }
+ return R.ok();
+ }
+
+
+ /**
+ * 确认购物车订单
+ * @param confirmOrder
+ * @return
+ */
+ @Override
+ public ConfirmOrderVo confirmOrder(ConfirmOrder confirmOrder) {
+ Long userid = tokenService.getLoginUserApplet().getUserid();
+ AppUser appUser = appUserClient.getAppUserById(userid);
+ Integer shopId = confirmOrder.getShopId();
+ Shop shop = shopClient.getShopById(shopId).getData();
+ String goodsJson = confirmOrder.getGoodsJson();
+ List<Long> ids = new ArrayList<>();
+ JSONArray objects = JSON.parseArray(goodsJson);
+ for (int i = 0; i < objects.size(); i++) {
+ Long id = objects.getJSONObject(i).getLong("id");
+ ids.add(id);
+ }
+ List<ShoppingCart> list = this.listByIds(ids);
+ ConfirmOrderVo confirmOrderVo = new ConfirmOrderVo();
+ //构建商品明细列表
+ List<MyShoppingCartVo> goodsList = buildDetail(appUser, shopId, list, objects);
+ confirmOrderVo.setGoodsList(goodsList);
+ confirmOrderVo.setShopId(confirmOrder.getShopId());
+ confirmOrderVo.setShopName(shop.getName());
+ //现金支付
+ if(confirmOrder.getPaymentType() == 1){
+ BigDecimal bigDecimal = goodsList.stream().map(MyShoppingCartVo::getCash).reduce(BigDecimal::add).get();
+ confirmOrderVo.setOrderMoney(bigDecimal);
+ }else{
+ int sum = goodsList.stream().mapToInt(MyShoppingCartVo::getPoint).sum();
+ confirmOrderVo.setOrderPoint(sum);
+ }
+ //查询当前是否有订单活动
+ OrderActivityInfo orderActivityInfo = orderActivityInfoClient.getNowOrderActivityInfo(appUser.getVipId()).getData();
+ BigDecimal orderMoney = confirmOrderVo.getOrderMoney();
+ BigDecimal paymentMoney = orderMoney;
+ //满XX才打折,只有现金才能优惠
+ if(null != orderActivityInfo && confirmOrder.getPaymentType() == 1 && orderActivityInfo.getConditionAmount().compareTo(orderMoney) <= 0){
+ confirmOrderVo.setActivityName(orderActivityInfo.getActivityName());
+ paymentMoney = orderActivityInfo.getDiscount().divide(new BigDecimal(10)).multiply(orderMoney);
+ confirmOrderVo.setDiscountAmount(orderMoney.subtract(paymentMoney).setScale(2, RoundingMode.HALF_EVEN));
+ }
+ BaseSetting baseSetting = baseSettingClient.getBaseSetting(4).getData();
+ confirmOrderVo.setUseSimultaneously(baseSetting.getContent().equals("1") ? true : false);
+ int earnPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getEarnSpendingPoints).sum();
+ confirmOrderVo.setEarnPoint(earnPoint);
+ //支付金额,订单金额-订单优惠
+ confirmOrderVo.setPayMoney(paymentMoney);
+ confirmOrderVo.setResidualPoint(appUser.getLavePoint().intValue());
+ //获取默认收货地址
+ UserAddress userAddress = userAddressClient.getDefaultUserAddress(userid).getData();
+ confirmOrderVo.setUserAddress(userAddress);
+ confirmOrderVo.setPaymentType(confirmOrder.getPaymentType());
+ //获取用户优惠券,用户全部优惠券,不能使用的需要标识出来置灰展示
+ PaymentUserCoupon paymentUserCoupon = new PaymentUserCoupon();
+ paymentUserCoupon.setUserId(userid);
+ paymentUserCoupon.setOrderMoney(orderMoney);
+ paymentUserCoupon.setType(confirmOrder.getType());
+ if(confirmOrder.getPaymentType() == 1){
+ List<PaymentUserCouponVo> data = userCouponClient.getPaymentUserCoupon(paymentUserCoupon).getData();
+ for (PaymentUserCouponVo couponInfo : data) {
+ List<Integer> forGoodIds = couponInfo.getForGoodIds();
+ //全部商品适用
+ if(null == forGoodIds){
+ //满减券
+ if(1 == couponInfo.getCouponType() && orderMoney.compareTo(couponInfo.getConditionAmount()) >= 0){
+ couponInfo.setAvailable(true);
+ }
+ //代金券和折扣券
+ if(2 == couponInfo.getCouponType() || 3 == couponInfo.getCouponType()){
+ couponInfo.setAvailable(true);
+ }
+ }else{
+ //部分商品适用
+ BigDecimal goodsMoney = BigDecimal.ZERO;
+ for (MyShoppingCartVo myShoppingCartVo : goodsList) {
+ Integer goodsId = myShoppingCartVo.getGoodsId();
+ BigDecimal cash = myShoppingCartVo.getCash();
+ if(forGoodIds.contains(goodsId)){
+ goodsMoney = goodsMoney.add(cash);
+ }
+ }
+ //满减
+ if(1 == couponInfo.getCouponType() && couponInfo.getConditionAmount().compareTo(goodsMoney) <= 0){
+ couponInfo.setAvailable(true);
+ }
+ //代金券
+ if(2 == couponInfo.getCouponType() || 3 == couponInfo.getCouponType()){
+ couponInfo.setAvailable(true);
+ }
+ }
+ }
+ confirmOrderVo.setCoupon(data);
+ }
+ //获取快递策略
+ SystemConfig systemConfig = systemConfigClient.getSystemConfig(3).getData();
+ JSONObject jsonObject = JSON.parseObject(systemConfig.getContent());
+ confirmOrderVo.setExpressFee(jsonObject.getBigDecimal("expressFee"));
+ List<Integer> vip = jsonObject.getJSONArray("vip").toList(Integer.class);
+ //包邮条件(所有会员或者满足条件的会员)
+ if(vip.get(0) == -1 || vip.contains(appUser.getVipId())){
+ if(confirmOrder.getPaymentType() == 1){
+ //现金支付,支付金额满足包邮条件
+ BigDecimal cash = jsonObject.getBigDecimal("cash");
+ if(confirmOrderVo.getPayMoney().compareTo(cash) >= 0){
+ confirmOrderVo.setExpressFee(BigDecimal.ZERO);
+ }
+ }else{
+ //积分支付,支付积分是否满足包邮条件
+ Integer point = jsonObject.getInteger("point");
+ if(confirmOrderVo.getOrderPoint().compareTo(point) >= 0){
+ confirmOrderVo.setExpressFee(BigDecimal.ZERO);
+ }
+ }
+ }
+ return confirmOrderVo;
+ }
+
+
+ /**
+ * 构建购物车商品列表
+ * @param appUser
+ * @param shopId
+ * @param list
+ * @param objects
+ * @return
+ */
+ private List<MyShoppingCartVo> buildDetail(AppUser appUser, Integer shopId, List<ShoppingCart> list, JSONArray objects){
+ List<MyShoppingCartVo> page = new ArrayList<>();
+ for (ShoppingCart shoppingCart : list) {
+ Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData();
+ MyShoppingCartVo vo = new MyShoppingCartVo();
+ vo.setId(shoppingCart.getId());
+ vo.setGoodsId(goods.getId());
+ vo.setHomePicture(goods.getHomePagePicture());
+ vo.setName(goods.getName());
+ int num = shoppingCart.getNumber();
+ if(null != objects){
+ for (int i = 0; i < objects.size(); i++) {
+ Long id = objects.getJSONObject(i).getLong("id");
+ if(id.equals(shoppingCart.getId())){
+ num = objects.getJSONObject(i).getInteger("num");
+ break;
+ }
+ }
+ }
+ //获取支付价格
+ Price price = getPrice(appUser, shoppingCart.getGoodsId(), shopId);
+ if(null == price){
+ //使用商品的基础价格
+ price.setCash(1 == goods.getCashPayment() ? goods.getSellingPrice() : null);
+ price.setPoint(1 == goods.getPointPayment() ? goods.getIntegral() : null);
+ price.setCashPayment(goods.getCashPayment() == 1 ? true : false);
+ price.setPointPayment(goods.getPointPayment() == 1 ? true : false);
+ }
+ vo.setCash(price.getCash());
+ vo.setPoint(price.getPoint());
+ vo.setCashPayment(price.getCashPayment());
+ vo.setPointPayment(price.getPointPayment());
+ vo.setEndTime(price.getEndTime());
+ vo.setOriginalPrice(goods.getOriginalPrice().toString());
+ vo.setNumber(num);
+ GoodsShop goodsShop = new GoodsShop();
+ goodsShop.setGoodsId(shoppingCart.getGoodsId());
+ goodsShop.setShopId(shopId);
+ GoodsShop goodsShop1 = goodsShopClient.getGoodsShop(goodsShop).getData();
+ vo.setVerifiable(null == goodsShop1 ? false : true);
+ //判断当前数量是否已经超出限购数量(需要计算已经购买的数量)
+ if(null == goods.getPurchaseLimit() || -1 == goods.getPurchaseLimit()){
+ vo.setPurchaseLimit(false);
+ }else{
+ List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getAppUserId, appUser.getId()).eq(Order::getDelFlag, 0).in(Order::getOrderStatus, Arrays.asList(4, 8)));
+ List<Long> orderIds = orders.stream().map(Order::getId).collect(Collectors.toList());
+ int sum = 0;
+ if(orderIds.size() > 0){
+ List<OrderGood> orderGoodList = orderGoodService.list(new LambdaQueryWrapper<OrderGood>().in(OrderGood::getOrderId, orderIds)
+ .eq(OrderGood::getGoodsId, shoppingCart.getGoodsId()).eq(OrderGood::getDelFlag, 0));
+ sum = orderGoodList.stream().mapToInt(OrderGood::getNum).sum();
+ }
+ vo.setPurchaseLimit((num + sum) > goods.getPurchaseLimit() ? true : false);
+ }
+ vo.setDistributionMode(goods.getDistributionMode());
+ vo.setEarnSpendingPoints(price.getEarnSpendingPoints());
+ vo.setSuperiorSubcommission(price.getSuperiorSubcommission());
+ vo.setSuperiorRebatePoints(price.getSuperiorRebatePoints());
+ vo.setSuperiorType(price.getSuperiorType());
+ vo.setServuceShopCharges(price.getServuceShopCharges());
+ vo.setServuceShopPoints(price.getServuceShopPoints());
+ vo.setTechnicianPoints(price.getTechnicianPoints());
+ vo.setBoundShopCharges(price.getBoundShopCharges());
+ vo.setBoundShopPoints(price.getBoundShopPoints());
+ vo.setBoundShopSuperiorsCharges(price.getBoundShopSuperiorsCharges());
+ vo.setBoundShopSuperiorsPoints(price.getBoundShopSuperiorsPoints());
+ page.add(vo);
+ }
+ return page;
+ }
+
+
+ /**
+ * 购物车支付操作
+ * @param shoppingCartPayment
+ * @return
+ */
+ @Override
+ public R shoppingCartPayment(ShoppingCartPayment shoppingCartPayment) {
+ Long userid = tokenService.getLoginUserApplet().getUserid();
+ AppUser appUser = appUserClient.getAppUserById(userid);
+ Integer shopId = shoppingCartPayment.getShopId();
+ String goodsJson = shoppingCartPayment.getGoodsJson();
+ List<Long> ids = new ArrayList<>();
+ Integer num = 0;
+ JSONArray objects = JSON.parseArray(goodsJson);
+ for (int i = 0; i < objects.size(); i++) {
+ Long id = objects.getJSONObject(i).getLong("id");
+ Integer num1 = objects.getJSONObject(i).getInteger("num");
+ num += num1;
+ ShoppingCart shoppingCart = this.getById(id);
+ //判断当前数量是否已经超出限购数量(需要计算已经购买的数量)
+ Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData();
+ if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit()){
+ List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getAppUserId, appUser.getId()).eq(Order::getDelFlag, 0).in(Order::getOrderStatus, Arrays.asList(4, 8)));
+ List<Long> orderIds = orders.stream().map(Order::getId).collect(Collectors.toList());
+ int sum = 0;
+ if(orderIds.size() > 0){
+ List<OrderGood> orderGoodList = orderGoodService.list(new LambdaQueryWrapper<OrderGood>().in(OrderGood::getOrderId, orderIds)
+ .eq(OrderGood::getGoodsId, shoppingCart.getGoodsId()).eq(OrderGood::getDelFlag, 0));
+ sum = orderGoodList.stream().mapToInt(OrderGood::getNum).sum();
+ }
+ if((num1 + sum) > goods.getPurchaseLimit()){
+ return R.fail(goods.getName() + "已超出购买上限");
+ }
+ }
+ ids.add(id);
+ }
+
+ List<ShoppingCart> list = this.listByIds(ids);
+ //构建商品明细列表
+ List<MyShoppingCartVo> goodsList = buildDetail(appUser, shopId, list, objects);
+ //判断支付当时是否正确
+ if(1 == shoppingCartPayment.getPaymentType() || 2 == shoppingCartPayment.getPaymentType()){
+ //现金支付
+ long count = goodsList.stream().filter(s -> s.getCashPayment()).count();
+ if(count != goodsList.size()){
+ return R.fail("支付方式不正确");
+ }
+ } else if(3 == shoppingCartPayment.getPaymentType()){
+ //积分支付
+ long count = goodsList.stream().filter(s -> s.getPointPayment()).count();
+ if(count != goodsList.size()){
+ return R.fail("支付方式不正确");
+ }
+ }else{
+ return R.fail("支付方式不正确");
+ }
+ //判断门店是都可以核销所有的商品
+ List<Integer> goodsIds = goodsList.stream().map(MyShoppingCartVo::getGoodsId).collect(Collectors.toList());
+ GetGoodsShopByGoodsIds goodsShopByGoodsIds = new GetGoodsShopByGoodsIds();
+ goodsShopByGoodsIds.setGoodsIds(goodsIds);
+ goodsShopByGoodsIds.setShopId(shopId);
+ List<GoodsShop> data = goodsShopClient.getGoodsShopByGoodsIds(goodsShopByGoodsIds).getData();
+ List<Integer> collect = data.stream().map(GoodsShop::getGoodsId).collect(Collectors.toList());
+ if(data.size() != goodsList.size()){
+ String goodsName = "";
+ for (Integer goodsId : goodsIds) {
+ if(!collect.contains(goodsId)){
+ goodsName = goodsClient.getGoodsById(goodsId).getData().getName();
+ break;
+ }
+ }
+ return R.fail(goodsName + "不能在该门店核销");
+ }
+ //开始构建支付信息
+ //现金支付的订单金额
+ BigDecimal orderMoney = BigDecimal.ZERO;
+ //折扣(9折)
+ BigDecimal discount = null;
+ //积分支付的订单积分
+ Integer orderPoint = 0;
+ if(3 != shoppingCartPayment.getPaymentType()){
+ orderMoney = goodsList.stream().map(MyShoppingCartVo::getCash).reduce(BigDecimal::add).get();
+ }else{
+ orderPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getPoint).sum();
+ if(appUser.getLavePoint().intValue() < orderPoint){
+ return R.fail("账户剩余积分不足");
+ }
+ }
+ //现金的支付金额
+ BigDecimal paymentMoney = orderMoney;
+ //满减金额
+ BigDecimal fullReductionAmount = BigDecimal.ZERO;
+ //代金券抵扣金额
+ BigDecimal moneyAmount = BigDecimal.ZERO;
+ //折扣券抵扣金额
+ BigDecimal discountAmount = BigDecimal.ZERO;
+ //活动优惠金额
+ BigDecimal activityAmount = BigDecimal.ZERO;
+
+ //减去优惠券优惠金额
+ CouponInfoVo couponInfoVo = null;
+ if(null != shoppingCartPayment.getUserCouponId() && 3 != shoppingCartPayment.getPaymentType()){
+ couponInfoVo = userCouponClient.getCouponInfo(shoppingCartPayment.getUserCouponId()).getData();
+ String forGoodIds = couponInfoVo.getForGoodIds();
+ List<Integer> parseArray = JSON.parseArray(forGoodIds, Integer.class);
+ //全部商品
+ if(parseArray.contains(-1)){
+ //满减
+ if(1 == couponInfoVo.getCouponType() && couponInfoVo.getConditionAmount().compareTo(paymentMoney) <= 0){
+ paymentMoney = paymentMoney.subtract(couponInfoVo.getDiscountAmount());
+ fullReductionAmount = fullReductionAmount.add(couponInfoVo.getDiscountAmount());
+ }
+ //代金券
+ if(2 == couponInfoVo.getCouponType()){
+ paymentMoney = paymentMoney.subtract(couponInfoVo.getMoneyAmount());
+ moneyAmount = moneyAmount.add(couponInfoVo.getMoneyAmount());
+ if(paymentMoney.compareTo(BigDecimal.ZERO) < 0){
+ paymentMoney = BigDecimal.ZERO;
+ }
+ }
+ //折扣券
+ if(3 == couponInfoVo.getCouponType()){
+ BigDecimal paymentMoney1 = couponInfoVo.getDiscount().divide(new BigDecimal(10)).multiply(paymentMoney);
+ BigDecimal bigDecimal = paymentMoney.subtract(paymentMoney1).setScale(2, RoundingMode.HALF_EVEN);
+ discount = couponInfoVo.getDiscount();
+ paymentMoney = paymentMoney1;
+ discountAmount = discountAmount.add(bigDecimal);
+ }
+ }else{
+ //部分商品,需要计算参与优惠商品的支付金额,然后再对商品进行优惠券处理
+ paymentMoney = BigDecimal.ZERO;
+ BigDecimal goodsMoney = BigDecimal.ZERO;
+ for (MyShoppingCartVo myShoppingCartVo : goodsList) {
+ Integer goodsId = myShoppingCartVo.getGoodsId();
+ BigDecimal cash = myShoppingCartVo.getCash();
+ if(parseArray.contains(goodsId)){
+ goodsMoney = goodsMoney.add(cash);
+ }else{
+ paymentMoney = paymentMoney.add(cash);
+ }
+ }
+
+ //满减
+ if(1 == couponInfoVo.getCouponType() && couponInfoVo.getConditionAmount().compareTo(goodsMoney) <= 0){
+ goodsMoney = goodsMoney.subtract(couponInfoVo.getDiscountAmount());
+ fullReductionAmount = fullReductionAmount.add(couponInfoVo.getDiscountAmount());
+ }
+ //代金券
+ if(2 == couponInfoVo.getCouponType()){
+ goodsMoney = goodsMoney.subtract(couponInfoVo.getMoneyAmount());
+ moneyAmount = moneyAmount.add(couponInfoVo.getMoneyAmount());
+ if(goodsMoney.compareTo(BigDecimal.ZERO) < 0){
+ goodsMoney = BigDecimal.ZERO;
+ }
+ }
+ //折扣券
+ if(3 == couponInfoVo.getCouponType()){
+ BigDecimal paymentMoney1 = couponInfoVo.getDiscount().divide(new BigDecimal(10)).multiply(goodsMoney);
+ BigDecimal bigDecimal = goodsMoney.subtract(paymentMoney1).setScale(2, RoundingMode.HALF_EVEN);
+ discount = couponInfoVo.getDiscount();
+ goodsMoney = paymentMoney1;
+ discountAmount = discountAmount.add(bigDecimal);
+ }
+ paymentMoney = paymentMoney.add(goodsMoney);
+ }
+ }
+
+ //查询当前是否有订单活动
+ OrderActivityInfo orderActivityInfo = orderActivityInfoClient.getNowOrderActivityInfo(appUser.getVipId()).getData();
+ BaseSetting baseSetting = baseSettingClient.getBaseSetting(4).getData();
+ //系统活动设置(优惠券和活动能否同时使用)
+ boolean useSimultaneously = baseSetting.getContent().equals("1") ? true : false;
+ //满XX才打折,只有现金才能优惠
+ //如果使用优惠券,则需要判断是否可以和同时使用,且活动满足使用条件。
+ //没有使用优惠券,只需要判断是都满足使用条件
+ if(((useSimultaneously && null != shoppingCartPayment.getUserCouponId()) || null == shoppingCartPayment.getUserCouponId()) &&
+ null != orderActivityInfo && shoppingCartPayment.getPaymentType() != 3 && orderActivityInfo.getConditionAmount().compareTo(paymentMoney) <= 0){
+ BigDecimal paymentMoney1 = orderActivityInfo.getDiscount().divide(new BigDecimal(10)).multiply(paymentMoney);
+ BigDecimal bigDecimal = paymentMoney.subtract(paymentMoney1).setScale(2, RoundingMode.HALF_EVEN);
+ discount = orderActivityInfo.getDiscount();
+ paymentMoney = paymentMoney1;
+ activityAmount = activityAmount.add(bigDecimal);
+ }
+
+ //可获得的消费积分
+ int earnPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getEarnSpendingPoints).sum();
+ if(null != shoppingCartPayment.getUserAddressId()){
+ userAddressClient.getUserAddressById(shoppingCartPayment.getUserAddressId()).getData();
+ }
+
+ //获取快递策略,计算快递费
+ BigDecimal expressFee = BigDecimal.ZERO;
+ if(null != shoppingCartPayment.getUserAddressId()){
+ SystemConfig systemConfig = systemConfigClient.getSystemConfig(3).getData();
+ JSONObject jsonObject = JSON.parseObject(systemConfig.getContent());
+ //快递费
+ expressFee = jsonObject.getBigDecimal("expressFee");
+ List<Integer> vip = jsonObject.getJSONArray("vip").toList(Integer.class);
+ //包邮条件(所有会员或者满足条件的会员)
+ if(vip.get(0) == -1 || vip.contains(appUser.getVipId())){
+ if(shoppingCartPayment.getPaymentType() != 3){
+ //现金支付,支付金额满足包邮条件
+ BigDecimal cash = jsonObject.getBigDecimal("cash");
+ if(paymentMoney.compareTo(cash) >= 0){
+ expressFee = BigDecimal.ZERO;
+ }
+ }else{
+ //积分支付,支付积分是否满足包邮条件
+ Integer point = jsonObject.getInteger("point");
+ if(orderPoint.compareTo(point) >= 0){
+ expressFee = BigDecimal.ZERO;
+ }
+ }
+ }
+ }
+ //构建订单明细
+ Order order = new Order();
+ order.setAppUserId(userid);
+ order.setNum(num);
+ String goodPics = "";
+ String goodName = "";
+ for (MyShoppingCartVo myShoppingCartVo : goodsList) {
+ goodPics += myShoppingCartVo.getHomePicture() + ",";
+ goodName += myShoppingCartVo.getName() + ",";
+ }
+ order.setGoodPics(goodPics.substring(0, goodPics.length() - 1));
+ order.setGoodName(goodName.substring(0, goodName.length() - 1));
+ Goods goods = goodsClient.getGoodsById(goodsList.get(0).getGoodsId()).getData();
+ order.setOrderType(goods.getType());
+ order.setOrderStatus(1);
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+ order.setOrderNumber("QJS" + getNumber(3) + sdf.format(new Date()));
+ order.setTotalAmount(orderMoney.setScale(2, RoundingMode.HALF_EVEN));
+ order.setFullReductionAmount(fullReductionAmount);
+ order.setMoneyAmount(moneyAmount);
+ order.setDiscountAmount(discountAmount);
+ order.setActivityAmount(activityAmount);
+ order.setDiscountTotalAmount(fullReductionAmount.add(moneyAmount).add(discountAmount).add(activityAmount));
+ order.setPaymentAmount(paymentMoney);
+ order.setPoint(orderPoint);
+ order.setPayMethod(shoppingCartPayment.getPaymentType());
+ if(3 != shoppingCartPayment.getPaymentType() && (fullReductionAmount.compareTo(BigDecimal.ZERO) > 0 ||moneyAmount.compareTo(BigDecimal.ZERO) > 0 || discountAmount.compareTo(BigDecimal.ZERO) > 0)){
+ order.setCouponJson(JSON.toJSONString(couponInfoVo));
+ }
+ if(activityAmount.compareTo(BigDecimal.ZERO) > 0){
+ order.setActivityJson(JSON.toJSONString(orderActivityInfo));
+ }
+ if(null != shoppingCartPayment.getUserAddressId()){
+ UserAddress address = userAddressClient.getUserAddressById(shoppingCartPayment.getUserAddressId()).getData();
+ order.setExpressAmount(expressFee);
+ order.setAddressJson(JSON.toJSONString(address));
+ }
+ order.setGetPoint(earnPoint);
+ order.setPayStatus(1);
+ order.setShopId(shoppingCartPayment.getShopId());
+ order.setDelFlag(0);
+ order.setCreateTime(LocalDateTime.now());
+
+ if(2 == shoppingCartPayment.getPaymentType()){
+ BigDecimal balance = appUser.getBalance();
+ if(balance.compareTo(paymentMoney.add(expressFee)) < 0){
+ return R.fail("账户余额不足");
+ }
+ }
+ orderService.save(order);
+ //构建订单明细数据
+ for (MyShoppingCartVo myShoppingCartVo : goodsList) {
+ OrderGood orderGood = new OrderGood();
+ orderGood.setGoodsId(myShoppingCartVo.getGoodsId());
+ orderGood.setOrderId(order.getId());
+ GetSeckillActivityInfo info = new GetSeckillActivityInfo();
+ info.setGoodsId(myShoppingCartVo.getGoodsId());
+ info.setVip(appUser.getVipId());
+ GoodsSeckill goodsSeckill = seckillActivityInfoClient.getSeckillActivityInfo(info).getData();
+ if(null != goodsSeckill){
+ orderGood.setSeckillJson(JSON.toJSONString(goodsSeckill));
+ }
+ for (int i = 0; i < objects.size(); i++) {
+ Long id = objects.getJSONObject(i).getLong("id");
+ if(myShoppingCartVo.getId().equals(id)){
+ Integer num1 = objects.getJSONObject(i).getInteger("num");
+ orderGood.setNum(num1);
+ Goods goods1 = goodsClient.getGoodsById(myShoppingCartVo.getGoodsId()).getData();
+ orderGood.setGoodJson(JSON.toJSONString(goods1));
+ break;
+ }
+ }
+ orderGood.setDelFlag(0);
+ orderGood.setCreateTime(LocalDateTime.now());
+ orderGood.setEarnSpendingPoints(myShoppingCartVo.getEarnSpendingPoints());
+ orderGood.setSuperiorSubcommission(myShoppingCartVo.getSuperiorSubcommission());
+ orderGood.setSuperiorRebatePoints(myShoppingCartVo.getSuperiorRebatePoints());
+ orderGood.setSuperiorType(myShoppingCartVo.getSuperiorType());
+ orderGood.setServuceShopCharges(myShoppingCartVo.getServuceShopCharges());
+ orderGood.setServuceShopPoints(myShoppingCartVo.getServuceShopPoints());
+ orderGood.setTechnicianPoints(myShoppingCartVo.getTechnicianPoints());
+ orderGood.setBoundShopCharges(myShoppingCartVo.getBoundShopCharges());
+ orderGood.setBoundShopPoints(myShoppingCartVo.getBoundShopPoints());
+ orderGood.setBoundShopSuperiorsCharges(myShoppingCartVo.getBoundShopSuperiorsCharges());
+ orderGood.setBoundShopSuperiorsPoints(myShoppingCartVo.getBoundShopSuperiorsPoints());
+ orderGoodService.save(orderGood);
+ }
+
+ //开始构建支付数据
+ //现金支付
+ paymentMoney = paymentMoney.add(expressFee).setScale(2, RoundingMode.HALF_EVEN);
+ if(1 == shoppingCartPayment.getPaymentType()){
+ //调起微信支付 TODO 待完善
+
+
+
+ }
+ //账户余额
+ if(2 == shoppingCartPayment.getPaymentType()){
+ BigDecimal totalRedPacketAmount = appUser.getTotalRedPacketAmount();
+ BigDecimal totalDistributionAmount = appUser.getTotalDistributionAmount();
+ BigDecimal balance = appUser.getBalance();
+ if(paymentMoney.compareTo(totalRedPacketAmount) <= 0){
+ totalRedPacketAmount = totalRedPacketAmount.subtract(paymentMoney);
+ balance = balance.subtract(paymentMoney);
+ appUser.setTotalRedPacketAmount(totalRedPacketAmount);
+ appUser.setBalance(balance);
+ }else{
+ paymentMoney = paymentMoney.subtract(totalRedPacketAmount);
+ totalRedPacketAmount = BigDecimal.ZERO;
+ if(paymentMoney.compareTo(totalDistributionAmount) <= 0){
+ totalDistributionAmount = totalDistributionAmount.subtract(paymentMoney);
+ balance = balance.subtract(paymentMoney);
+ appUser.setTotalRedPacketAmount(totalRedPacketAmount);
+ appUser.setTotalDistributionAmount(totalDistributionAmount);
+ appUser.setBalance(balance);
+ }else{
+ paymentMoney = paymentMoney.subtract(totalDistributionAmount);
+ totalDistributionAmount = BigDecimal.ZERO;
+ balance = balance.subtract(paymentMoney);
+ appUser.setTotalRedPacketAmount(totalRedPacketAmount);
+ appUser.setTotalDistributionAmount(totalDistributionAmount);
+ appUser.setBalance(balance);
+ }
+ }
+ //构建积分流水记录
+ if(earnPoint > 0){
+ appUser.setShopPoint(appUser.getShopPoint() + earnPoint);
+ appUser.setLavePoint(appUser.getLavePoint() + earnPoint);
+
+ UserPoint userPoint = new UserPoint();
+ userPoint.setType(1);
+ userPoint.setHistoricalPoint(appUser.getLavePoint() - earnPoint);
+ userPoint.setVariablePoint(earnPoint);
+ userPoint.setBalance(appUser.getLavePoint());
+ userPoint.setCreateTime(LocalDateTime.now());
+ userPoint.setAppUserId(appUser.getId());
+ userPoint.setObjectId(order.getId());
+ userPointClient.saveUserPoint(userPoint);
+ }
+ appUserClient.editAppUserById(appUser);
+ //构建余额明细变动记录
+ BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
+ balanceChangeRecord.setAppUserId(appUser.getId());
+ balanceChangeRecord.setOrderId(order.getId());
+ balanceChangeRecord.setChangeType(5);
+ balanceChangeRecord.setBeforeAmount(balance.add(paymentMoney));
+ balanceChangeRecord.setChangeAmount(paymentMoney);
+ balanceChangeRecord.setAfterAmount(balance);
+ balanceChangeRecord.setDelFlag(0);
+ balanceChangeRecord.setCreateTime(LocalDateTime.now());
+ balanceChangeRecordClient.saveBalanceChangeRecord(balanceChangeRecord);
+ //修改订支付状态
+ order.setPayStatus(2);
+ orderService.updateById(order);
+ //删除购物车数据
+ this.removeBatchByIds(ids);
+ }
+ //积分支付
+ if(3 == shoppingCartPayment.getPaymentType()){
+ Integer lavePoint = appUser.getLavePoint();
+ appUser.setLavePoint(lavePoint - orderPoint);
+ appUser.setShopPoint(appUser.getShopPoint() + earnPoint);
+ appUser.setLavePoint(appUser.getLavePoint() + earnPoint);
+ appUserClient.editAppUserById(appUser);
+ //构建积分流水记录
+ UserPoint userPoint = new UserPoint();
+ userPoint.setType(4);
+ userPoint.setHistoricalPoint(lavePoint);
+ userPoint.setVariablePoint(orderPoint);
+ userPoint.setBalance(appUser.getLavePoint());
+ userPoint.setCreateTime(LocalDateTime.now());
+ userPoint.setAppUserId(appUser.getId());
+ userPoint.setObjectId(order.getId());
+ userPointClient.saveUserPoint(userPoint);
+ if(earnPoint > 0){
+ userPoint = new UserPoint();
+ userPoint.setType(1);
+ userPoint.setHistoricalPoint(appUser.getLavePoint() - earnPoint);
+ userPoint.setVariablePoint(earnPoint);
+ userPoint.setBalance(appUser.getLavePoint());
+ userPoint.setCreateTime(LocalDateTime.now());
+ userPoint.setAppUserId(appUser.getId());
+ userPoint.setObjectId(order.getId());
+ userPointClient.saveUserPoint(userPoint);
+ }
+ //修改订支付状态
+ order.setPayStatus(2);
+ orderService.updateById(order);
+ //删除购物车数据
+ this.removeBatchByIds(ids);
+ }
+ return R.ok();
+ }
+
+
+ public String getNumber(Integer size){
+ String str = "";
+ for (Integer i = 0; i < size; i++) {
+ str += Double.valueOf(Math.random() * 10).intValue();
+ }
+ return str;
+ }
+}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/filter/AuthFilter.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/filter/AuthFilter.java
index cb4a599..4ad066f 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/filter/AuthFilter.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/filter/AuthFilter.java
@@ -51,7 +51,7 @@
filterChain.doFilter(servletRequest, servletResponse);
return;
}
- String userType = request.getHeader("user_type");
+ String userType = redquest.getHeader("user_type");
//管理后台用户
if ("system".equals(userType)) {
SysUser sysUser = sysUserClient.getSysUser(Long.valueOf(userid)).getData();
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/NearbyShopVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/NearbyShopVO.java
index e041a4c..52085f7 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/NearbyShopVO.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/NearbyShopVO.java
@@ -18,4 +18,10 @@
@ApiModelProperty(value = "详细地址")
private String address;
+
+ @ApiModelProperty(value = "距离")
+ private String distance;
+
+ @ApiModelProperty(value = "评分")
+ private String score;
}
--
Gitblit v1.7.1