文章目录
- cubemall-order
- config
- AlipayTemplate.java
- service
- OrderServiceImpl.java
- PayServiceImpl.java
- OrderService
- PayService.java
- vo
- PayVo.java
- controller
- PayController.java
- pom.xml
支付宝支付:使用非对称加密的方式实现支付安全处理,同时为了防止秘钥被篡改,使用加签,验签的模式
cubemall-order
config
AlipayTemplate.java
package com.xd.cubemall.order.config;import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;@Component
@ConfigurationProperties(prefix = "alipay")
@Data
public class AlipayTemplate {// 应用IDprivate String app_id;// 商户私钥private String merchant_private_key;// 阿里公钥private String alipay_public_key;// 回调地址,必须是公网地址,外部必须可以访问的地址private String notify_url;// 支付成功,跳转到本地项目的地址private String return_url;// 指定签名的方式private String sign_type;// 支付的编码格式private String charset;// 网关地址private String gateway_url;// 格式private String alipay_format;// 超时时间private String timeout;}
service
OrderServiceImpl.java
package com.xd.cubemall.order.service.impl;import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.xd.cubemall.common.utils.R;
import com.xd.cubemall.order.entity.OrderItemEntity;
import com.xd.cubemall.order.entity.UserEntity;
import com.xd.cubemall.order.enume.OrderStatusEnum;
import com.xd.cubemall.order.feign.AuthRemoteClient;
import com.xd.cubemall.order.feign.CartRemoteClient;
import com.xd.cubemall.order.feign.ProductRemoteClient;
import com.xd.cubemall.order.feign.StockRemoteClient;
import com.xd.cubemall.order.interceptor.OrderInterceptor;
import com.xd.cubemall.order.service.OrderItemService;
import com.xd.cubemall.order.service.dto.OrderDTO;
import com.xd.cubemall.order.service.dto.SubmitOrderDTO;
import com.xd.cubemall.order.utils.Constants;
import com.xd.cubemall.order.web.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.stereotype.Service;import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xd.cubemall.common.utils.PageUtils;
import com.xd.cubemall.common.utils.Query;import com.xd.cubemall.order.dao.OrderDao;
import com.xd.cubemall.order.entity.OrderEntity;
import com.xd.cubemall.order.service.OrderService;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;@Service("orderService")
public class OrderServiceImpl extends ServiceImpl<OrderDao, OrderEntity> implements OrderService {//定义全局threadLocalprivate ThreadLocal<SubmitOrderDTO> submitOrderDTOThreadLocal = new ThreadLocal<>();// 注入线程池对象@Autowiredprivate ThreadPoolExecutor poolExecutor;// 注入远程调用地址接口@Autowiredprivate AuthRemoteClient authRemoteClient;// 注入购物车远程调用接口@Autowiredprivate CartRemoteClient cartRemoteClient;// 注入库存服务@Autowiredprivate StockRemoteClient stockRemoteClient;// 注入redis模板服务@Autowired@Qualifier("stringRedisTemplate")private RedisTemplate<String,String> redisTemplate;@Autowired@Qualifier("redisTemplate")private RedisTemplate redisTemplate2;// 注入商品服务@Autowiredprivate ProductRemoteClient productRemoteClient;// 注入订单明细服务对象@Autowiredprivate OrderItemService orderItemService;@Overridepublic PageUtils queryPage(Map<String, Object> params) {IPage<OrderEntity> page = this.page(new Query<OrderEntity>().getPage(params),new QueryWrapper<OrderEntity>());return new PageUtils(page);}/*查询订单结算页相关数据*/// 1.地址收货信息// 2.购物清单// 3.支付方式(x)@Overridepublic OrderConfirmVo confirmOrder() {// 创建订单结算页视图对象OrderConfirmVo confirmVo = new OrderConfirmVo();//获取请求上下文信息RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();// 1.查询用户地址信息// 获取当前用户信息UserEntity userInfo = OrderInterceptor.dtoThreadLocal.get();// 根据用户id查询用户信息CompletableFuture<Void> addressFuture = CompletableFuture.runAsync(() -> {// 异步请求之前,共享请求数据RequestContextHolder.setRequestAttributes(requestAttributes);// 远程调用用户授权认证,用户中心服务,查询用户数据List<UserReceiveAddressVo> userReceiveAddressVos = authRemoteClient.addressList(userInfo.getId());// 把用户地址信息添加到订单结算实体对象confirmVo.setUserReceiveAddressList(userReceiveAddressVos);}, poolExecutor);// 2.查询购物车清单数据CompletableFuture<Void> cartItemsFuture = CompletableFuture.runAsync(() -> {// 异步请求之前,共享请求数据RequestContextHolder.setRequestAttributes(requestAttributes);// 远程调用购物车服务方法,查询购物车清单List<CartItemVo> cartItems = cartRemoteClient.getCartItems();confirmVo.setItems(cartItems);}, poolExecutor).thenRunAsync(()->{// 获取购物车清单数据List<CartItemVo> items = confirmVo.getItems();// 获取所有的skuIdsList<Long> skuIds = items.stream().map(itemVo -> itemVo.getSkuId()).collect(Collectors.toList());// 根据商品skuID查询每一个商品的库存信息// 调用库存服务R skuStock = stockRemoteClient.getSkuStock(skuIds);// 获取是否具有库存数据List<StockSkuVo> skuStockDataList = skuStock.getData("data", new TypeReference<List<StockSkuVo>>() {});// 把是否具有库存的数据转换为map结构数据if(skuStockDataList!=null && skuStockDataList.size()>0){Map<Long, Boolean> hasStock = skuStockDataList.stream().collect(Collectors.toMap(StockSkuVo::getSkuId, StockSkuVo::getHasStock));// 添加对象confirmVo.setStocks(hasStock);}},poolExecutor);// 3.获取用户优惠券信息Integer integration = userInfo.getIntegration();confirmVo.setIntegration(integration);//4.获取商品库存信息,判断商品是否具有库存// 防重令牌// 由于网络延迟(重试),订单提交按钮可能多次提交// 防重令牌,提交订单时携带此令牌String token = UUID.randomUUID().toString();redisTemplate.opsForValue().set(Constants.ORDER_TOKEN_PREFIX+userInfo.getId(),token,30, TimeUnit.MINUTES);// 放入令牌对象属性confirmVo.setOrderToken(token);//同步调用try {CompletableFuture.allOf(addressFuture,cartItemsFuture).get();} catch (InterruptedException e) {e.printStackTrace();} catch (ExecutionException e) {e.printStackTrace();}return confirmVo;}/*** 提交订单的方法* @param submitOrderDTO* @return*/@Overridepublic OrderResultVo submitOrder(SubmitOrderDTO submitOrderDTO) {//放入threadLocal对象submitOrderDTOThreadLocal.set(submitOrderDTO);// 构建一个返回值对象OrderResultVo resultVo = new OrderResultVo();// 获取登录用户信息UserEntity userInfo = OrderInterceptor.dtoThreadLocal.get();// 根据参数令牌,验证令牌信息,防止订单重复提交// 获取,验证令牌整个操作必须是一个原子性的操作String script = "if redis.call('get',KEYS[1]) == ARGV[1] then return 1 else return 0 end";// 获取传递的令牌String orderToken = submitOrderDTO.getOrderToken();// 执行lua脚本,返回执行结果:1,0Long res = redisTemplate.execute(new DefaultRedisScript<Long>(script, Long.class),Arrays.asList(Constants.ORDER_TOKEN_PREFIX + userInfo.getId()),orderToken);// 判断验证令牌是否成功if(res == 0L){// 令牌验证失败// 1表示验证令牌失败resultVo.setCode(1);return resultVo;}// 抽取一个方法,构造订单数据OrderDTO orderDTO = this.createOrderDTO();// 保存订单数据this.saveOrder(orderDTO);// 库存// 定义锁定库存对象StockSkuLockVo stockSkuLockVo = new StockSkuLockVo();// 设置属性值stockSkuLockVo.setOrderId(orderDTO.getOrderEntity().getOrderSn());// 设定锁定商品数据信息List<OrderItemVo> itemVos = orderDTO.getOrderItemList().stream().map(item -> {OrderItemVo itemVo = new OrderItemVo();itemVo.setSkuId(item.getSkuId());itemVo.setCount(item.getSkuQuantity());itemVo.setTitle(item.getSkuName());return itemVo;}).collect(Collectors.toList());// 把需要锁定库存商品信息放入锁定对象stockSkuLockVo.setLockList(itemVos);// 开始锁定库存R r = stockRemoteClient.lockOrderStock(stockSkuLockVo);// 判断库存是否锁定成功if(r.getCode() == 0){// 返回值对象resultVo.setOrder(orderDTO.getOrderEntity());resultVo.setCode(0);// 清除购物车数据redisTemplate2.delete(Constants.CART_PREFIX+userInfo.getId());return resultVo;}else{// 库存锁定失败resultVo.setCode(2);return resultVo;}}/*** 保存订单数据* @param orderDTO*/private void saveOrder(OrderDTO orderDTO) {// 获取订单对象OrderEntity orderEntity = orderDTO.getOrderEntity();orderEntity.setCreateTime(new Date());orderEntity.setModifyTime(new Date());// 保存订单this.baseMapper.insert(orderEntity);// 保存订单明细List<OrderItemEntity> orderItemList = orderDTO.getOrderItemList();// 保存订单明细的数据orderItemService.saveBatch(orderItemList);}/*** 构造订单数据* @return*/private OrderDTO createOrderDTO() {// 验证令牌成功,可以开始下单,开始构建订单数据// 创建一个订单数据OrderDTO orderDTO = new OrderDTO();// 构造订单数据// 1.生成一个订单号String orderId = IdWorker.getTimeId();// 构造订单数据OrderEntity orderEntity = this.builderOrder(orderId);// 把订单数据添加到对象orderDTO.setOrderEntity(orderEntity);// 构造订单明细数据List<OrderItemEntity> orderItemEntityList = this.builderOrderItems(orderId);orderDTO.setOrderItemList(orderItemEntityList);// 计算整个订单总价格this.computePrice(orderEntity,orderItemEntityList);return orderDTO;}/*** 计算订单商品总价格* @param orderEntity* @param orderItemEntityList*/private void computePrice(OrderEntity orderEntity, List<OrderItemEntity> orderItemEntityList) {// 订单变量,赋值价格BigDecimal totalPrice = new BigDecimal("0.0");// 优惠价BigDecimal coupon = new BigDecimal("0.0");BigDecimal intergration = new BigDecimal("0.0");BigDecimal promotion = new BigDecimal("0.0");BigDecimal freight = new BigDecimal("0.0");// 循环订单明细for (OrderItemEntity orderItemEntity : orderItemEntityList) {coupon = coupon.add(orderItemEntity.getCouponAmount());promotion = promotion.add(orderItemEntity.getPromotionAmount());intergration = intergration.add(orderItemEntity.getIntegrationAmount());// 总价totalPrice = totalPrice.add(orderItemEntity.getRealAmount());}// 订单价格相关数据orderEntity.setTotalAmount(totalPrice);// 设置应付总金额orderEntity.setPayAmount(totalPrice.add(freight));orderEntity.setCouponAmount(coupon);orderEntity.setPromotionAmount(promotion);orderEntity.setIntegrationAmount(intergration);// 删除orderEntity.setDeleteStatus(0);}/*** 构造订单明细* @param orderId* @return*/private List<OrderItemEntity> builderOrderItems(String orderId) {// 获取登录用户信息UserEntity userInfo = OrderInterceptor.dtoThreadLocal.get();// 构造订单明细数据List<OrderItemEntity> orderItemEntityList = new ArrayList<>();// 从购物车中查询订单明细数据List<CartItemVo> cartItems = cartRemoteClient.getCartItems();if(cartItems!=null && cartItems.size()>0){orderItemEntityList = cartItems.stream().map(item->{// 获取购物车明细数据,变成订单明细// 创建对象OrderItemEntity orderItemEntity = new OrderItemEntity();// 订单号orderItemEntity.setOrderSn(orderId);// sku信息orderItemEntity.setSkuId(item.getSkuId());orderItemEntity.setSkuName(item.getTitle());orderItemEntity.setSkuPic(item.getImage());orderItemEntity.setSkuPrice(item.getPrice());orderItemEntity.setSkuQuantity(item.getCount());orderItemEntity.setSkuAttrsVals(StringUtils.collectionToDelimitedString(item.getSkuAttr(),";"));// 获取spu数据,根据skuId查询spu数据R r1 = productRemoteClient.getSpuInfoBySkuId(item.getSkuId());// 获取spu数据SpuInfoVo spuInfoVo = r1.getData("data", new TypeReference<SpuInfoVo>() {});// 构造spu相关订单明细数据orderItemEntity.setSpuId(spuInfoVo.getId());orderItemEntity.setSpuName(spuInfoVo.getSpuName());orderItemEntity.setCategoryId(spuInfoVo.getCategoryId());orderItemEntity.setSpuBrand(spuInfoVo.getBrandName());// 用户名orderItemEntity.setMemberUsername(userInfo.getUsername());// 运费orderItemEntity.setFreightAmount(BigDecimal.ZERO);// 订单项优惠金额orderItemEntity.setPromotionAmount(BigDecimal.ZERO);orderItemEntity.setCouponAmount(BigDecimal.ZERO);orderItemEntity.setIntegrationAmount(BigDecimal.ZERO);// 原价BigDecimal originPrice = orderItemEntity.getSkuPrice().multiply(new BigDecimal(orderItemEntity.getSkuQuantity().toString()));// 实际金额:原价-订单优惠价格BigDecimal subtract = originPrice.subtract(orderItemEntity.getCouponAmount()).subtract(orderItemEntity.getIntegrationAmount()).subtract(orderItemEntity.getPromotionAmount());// 设置真实价格orderItemEntity.setRealAmount(subtract);return orderItemEntity;}).collect(Collectors.toList());}return orderItemEntityList;}/*** 构造订单数据* @param orderId* @return*/private OrderEntity builderOrder(String orderId) {// 获取登录用户信息UserEntity userInfo = OrderInterceptor.dtoThreadLocal.get();// 2.创建一个订单实体对象,添加数据OrderEntity orderEntity = new OrderEntity();orderEntity.setMemberId(userInfo.getId());orderEntity.setOrderSn(orderId);orderEntity.setMemberUsername(userInfo.getUsername());// 获取对应的dto对象SubmitOrderDTO submitOrderDTO = submitOrderDTOThreadLocal.get();// 获取订单地址信息R r = authRemoteClient.getAddressById(submitOrderDTO.getAddrId());UserReceiveAddressVo userReceiveAddressVo = r.getData("userReceiveAddress", new TypeReference<UserReceiveAddressVo>() {});// 构造订单地址数据信息orderEntity.setReceiverName(userReceiveAddressVo.getName());orderEntity.setReceiverPhone(userReceiveAddressVo.getPhone());orderEntity.setReceiverPostCode(userReceiveAddressVo.getPostCode());orderEntity.setReceiverProvince(userReceiveAddressVo.getProvince());orderEntity.setReceiverCity(userReceiveAddressVo.getCity());orderEntity.setReceiverRegion(userReceiveAddressVo.getRegion());orderEntity.setReceiverDetailAddress(userReceiveAddressVo.getDetailAddress());// 构造订单状态数据orderEntity.setStatus(OrderStatusEnum.ORDER_NEW.getCode());orderEntity.setAutoConfirmDay(7);orderEntity.setConfirmStatus(0);return orderEntity;}/*** 根据订单id查询订单信息* @param orderId* @return*/@Overridepublic PayVo getOrderById(String orderId) {// 创建支付vo对象PayVo payVo = new PayVo();// 根据订单id查询订单实体数据OrderEntity orderEntity = this.getOrderbyOrderSn(orderId);BigDecimal payAmount = orderEntity.getPayAmount().setScale(2, BigDecimal.ROUND_UP);payVo.setOut_trade_no(orderId);payVo.setTotal_amount(payAmount.toString());// 查询商品明细数据List<OrderItemEntity> orderItemEntityList = orderItemService.list(new QueryWrapper<OrderItemEntity>().eq("order_sn", orderId));// 判断if(orderItemEntityList!=null && orderItemEntityList.size()>0){// 获取一个商品明细数据OrderItemEntity orderItemEntity = orderItemEntityList.get(0);payVo.setBody(orderItemEntity.getSkuAttrsVals());payVo.setSubject(orderItemEntity.getSkuName());}return payVo;}/*** 根据订单id查询订单实体数据* @param orderId* @return*/private OrderEntity getOrderbyOrderSn(String orderId) {OrderEntity orderEntity = this.baseMapper.selectOne(new QueryWrapper<OrderEntity>().eq("order_sn",orderId));return orderEntity;}
}
PayServiceImpl.java
package com.xd.cubemall.order.service.impl;import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayTradePagePayRequest;
import com.xd.cubemall.order.config.AlipayTemplate;
import com.xd.cubemall.order.service.OrderService;
import com.xd.cubemall.order.service.PayService;
import com.xd.cubemall.order.web.vo.PayVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;@Service
public class PayServiceImpl implements PayService {// 注入订单服务对象@Autowiredprivate OrderService orderService;// 注入阿里支付配置对象@Autowiredprivate AlipayTemplate alipayTemplate;/*** 实现支付宝的支付* @param orderId* @return: 支付宝会给商户返回一个页面,展示支付二维码,实现支付*/@Overridepublic String alipayOrder(String orderId) {// 根据订单id查询支付需要的数据// 支付金额// 订单描述// 商户订单号// 订单名称PayVo payVo = orderService.getOrderById(orderId);// 开始实现支付操作// 1.根据支付配置生成支付客户端AlipayClient alipayClient = new DefaultAlipayClient(alipayTemplate.getGateway_url(),alipayTemplate.getApp_id(),alipayTemplate.getMerchant_private_key(),alipayTemplate.getAlipay_format(),alipayTemplate.getCharset(),alipayTemplate.getAlipay_public_key(),alipayTemplate.getSign_type());// 2.创建阿里支付请求AlipayTradePagePayRequest alipayRequest = new AlipayTradePagePayRequest();// 重定向地址alipayRequest.setReturnUrl(alipayTemplate.getReturn_url());// 回调地址alipayRequest.setNotifyUrl(alipayTemplate.getNotify_url());// 获取待构造的数据String out_trade_no = payVo.getOut_trade_no();String total_amount = payVo.getTotal_amount();String body = payVo.getBody();String subject = payVo.getSubject();String jsonData = "{\"out_trade_no\": \""+out_trade_no+"\"," +"\"total_amount\":\""+total_amount+"\"," +" \"body\":\""+body+"\"," +" \"subject\":\""+subject+"\"," +" \"product_code\": \"FAST_INSTANT_TRADE_PAY\" }";alipayRequest.setBizContent(jsonData);String result = null;try {// 发送请求result = alipayClient.pageExecute(alipayRequest).getBody();} catch (AlipayApiException e) {e.printStackTrace();}return result;}
}
OrderService
package com.xd.cubemall.order.service;import com.baomidou.mybatisplus.extension.service.IService;
import com.xd.cubemall.common.utils.PageUtils;
import com.xd.cubemall.order.entity.OrderEntity;
import com.xd.cubemall.order.service.dto.SubmitOrderDTO;
import com.xd.cubemall.order.web.vo.OrderConfirmVo;
import com.xd.cubemall.order.web.vo.OrderResultVo;
import com.xd.cubemall.order.web.vo.PayVo;import java.util.Map;/*** 订单** @author xuedong* @email email@gmail.com* @date 2024-11-23 16:42:02*/
public interface OrderService extends IService<OrderEntity> {PageUtils queryPage(Map<String, Object> params);/*查询订单结算页相关数据*/// 1.地址收货信息// 2.购物清单// 3.支付方式(x)OrderConfirmVo confirmOrder();/*** 提交订单的方法* @param submitOrderDTO* @return*/OrderResultVo submitOrder(SubmitOrderDTO submitOrderDTO);/*** 根据订单id查询订单信息* @param orderId* @return*/PayVo getOrderById(String orderId);
}
PayService.java
package com.xd.cubemall.order.service;public interface PayService {/*** 实现支付宝的支付* @param orderId* @return: 支付宝会给商户返回一个页面,展示支付二维码,实现支付*/public String alipayOrder(String orderId);}
vo
PayVo.java
package com.xd.cubemall.order.web.vo;import lombok.Data;
import lombok.ToString;@ToString
@Data
public class PayVo {// 商户订单号private String out_trade_no;// 订单名称private String subject;// 付款金额private String total_amount;// 订单描述private String body;}
controller
PayController.java
package com.xd.cubemall.order.web;import com.xd.cubemall.order.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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.ResponseBody;@Controller
public class PayController {// 注入支付服务@Autowiredprivate PayService payService;/*** 实现支付宝的支付* @param orderId* @return: 支付宝会给商户返回一个页面,展示支付二维码,实现支付*/@ResponseBody@GetMapping(value = "/alipay/order/pay",produces = "text/html")public String alipayOrder(@RequestParam("orderId") String orderId){String res = payService.alipayOrder(orderId);return res;}/*** 支付完成后,重定向到支付成功页面*/@RequestMapping("/pay/success")public String paySuccess(@RequestParam("total_amount") String total_amount, Model model){//把支付金额放入model域model.addAttribute("payPrice",total_amount);//返回到支付成功页面return "paysuccess";}}
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.1.18.RELEASE</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>com.xd.cubemall</groupId><artifactId>cubemall-order</artifactId><version>0.0.1-SNAPSHOT</version><name>cubemall-order</name><description>cubemall-order</description><properties><java.version>1.8</java.version><spring-cloud.version>Greenwich.SR3</spring-cloud.version></properties><dependencies><!--引入common公共模块--><dependency><groupId>com.xd.cubemall</groupId><artifactId>cubemall-common</artifactId><version>0.0.1-SNAPSHOT</version></dependency><!-- https://mvnrepository.com/artifact/org.projectlombok/lombok --><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.16</version><scope>provided</scope></dependency><!--添加模板技术渲染页面--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-thymeleaf</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-configuration-processor</artifactId><optional>true</optional></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><!--阿里云OSS--><!-- <dependency>--><!-- <groupId>com.aliyun.oss</groupId>--><!-- <artifactId>aliyun-sdk-oss</artifactId>--><!-- <version>3.17.4</version>--><!-- </dependency>--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-configuration-processor</artifactId><optional>true</optional></dependency><!-- https://mvnrepository.com/artifact/com.alipay.sdk/alipay-sdk-java --><dependency><groupId>com.alipay.sdk</groupId><artifactId>alipay-sdk-java</artifactId><version>4.13.58.ALL</version></dependency></dependencies><dependencyManagement><dependencies><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-alibaba-dependencies</artifactId><version>2.1.0.RELEASE</version><type>pom</type><scope>import</scope></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>${spring-cloud.version}</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>