diff --git a/README.md b/README.md
index d6dff6e1..132640a1 100644
--- a/README.md
+++ b/README.md
@@ -30,19 +30,26 @@
# 演示
+> 艿艿:目前的开发者,都是后端出身。所以,一帮没有审美自觉的人,撸出来的前端界面,可能是东半球倒数第二难看。
+>
+> 迫切希望,有前端能力不错的小伙伴,加入我们,一起来完善「一个商城」。
+>
+> 啊啊啊!我好像做店铺装修功能。
+
## H5 商城
[体验传送门](http://h5.shop.iocoder.cn:18099)
-TODO 此处应有一个演示的装逼 GIF 图。
+![GIF 图-耐心等待](https://raw.githubusercontent.com/YunaiV/Blog/master/Mall/onemall-h5-min.gif)
## 管理后台
[体验传送门](http://admin.shop.iocoder.cn:18099)
-TODO 暂时不提供管理后台的账号密码,等后面提供。
+* 账号:yudaoyuanma
+* 密码:yudaoyuanma
-TODO 此处应有一个演示的装逼 GIF 图。
+![GIF 图-耐心等待](https://raw.githubusercontent.com/YunaiV/Blog/master/Mall/onemall-admin-min.gif)
## 其它演示
diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/util/StringUtil.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/util/StringUtil.java
index c947894d..61ebff37 100644
--- a/common/common-framework/src/main/java/cn/iocoder/common/framework/util/StringUtil.java
+++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/util/StringUtil.java
@@ -35,4 +35,8 @@ public class StringUtil {
return org.apache.commons.lang3.StringUtils.substring(str, start);
}
+ public static void main(String[] args) {
+ System.out.println(StringUtil.split("cn.iocoder.mall.order.api.OrderService#updatePaySuccess#1.0.0", "#").size());
+ }
+
}
diff --git a/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/package-info.java b/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/package-info.java
deleted file mode 100644
index e8b0e471..00000000
--- a/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package cn.iocoder.mall.spring.boot;
diff --git a/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/web/AdminMVCAutoConfiguration.java b/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/web/AdminMVCAutoConfiguration.java
index f2c947b5..b83ecbdd 100644
--- a/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/web/AdminMVCAutoConfiguration.java
+++ b/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/web/AdminMVCAutoConfiguration.java
@@ -2,6 +2,7 @@ package cn.iocoder.mall.spring.boot.web;
import cn.iocoder.common.framework.constant.MallConstants;
import cn.iocoder.common.framework.servlet.CorsFilter;
+import cn.iocoder.mall.admin.sdk.interceptor.AdminDemoInterceptor;
import cn.iocoder.mall.spring.boot.web.interceptor.AccessLogInterceptor;
import cn.iocoder.mall.admin.sdk.interceptor.AdminSecurityInterceptor;
import cn.iocoder.mall.spring.boot.web.handler.GlobalExceptionHandler;
@@ -34,6 +35,12 @@ public class AdminMVCAutoConfiguration implements WebMvcConfigurer {
return new AdminSecurityInterceptor();
}
+ @Bean
+ @ConditionalOnMissingBean(AdminDemoInterceptor.class)
+ public AdminDemoInterceptor adminDemoInterceptor() {
+ return new AdminDemoInterceptor();
+ }
+
@Bean
@ConditionalOnMissingBean(GlobalResponseBodyHandler.class)
public GlobalResponseBodyHandler globalReturnValueHandler() {
@@ -50,6 +57,7 @@ public class AdminMVCAutoConfiguration implements WebMvcConfigurer {
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(adminAccessLogInterceptor()).addPathPatterns(MallConstants.ROOT_PATH_ADMIN + "/**");
registry.addInterceptor(adminSecurityInterceptor()).addPathPatterns(MallConstants.ROOT_PATH_ADMIN + "/**");
+ registry.addInterceptor(adminDemoInterceptor()).addPathPatterns(MallConstants.ROOT_PATH_ADMIN + "/**");
}
@Bean
diff --git a/docs/guides/功能列表/功能列表-H5 商城.md b/docs/guides/功能列表/功能列表-H5 商城.md
index 56f33d3e..1cd19aa1 100644
--- a/docs/guides/功能列表/功能列表-H5 商城.md
+++ b/docs/guides/功能列表/功能列表-H5 商城.md
@@ -29,4 +29,6 @@
- 用户相关
- [x] 登陆
- [x] 注册
- - [ ] 个人信息
+ - [x] 个人信息
+ - [ ] 手机改绑
+ - [ ] 微信登陆
diff --git a/docs/guides/功能列表/功能列表-管理后台.md b/docs/guides/功能列表/功能列表-管理后台.md
index bb534edf..b53a5322 100644
--- a/docs/guides/功能列表/功能列表-管理后台.md
+++ b/docs/guides/功能列表/功能列表-管理后台.md
@@ -10,31 +10,48 @@
- [ ] 支付单 20% 【待认领】
- [ ] 退款单 20% 【待认领】
- TODO 需要补充
+- [ ] 店铺装修【迫切需要靠谱前端一起做】
+ - [ ] H5 装修
+ - [ ] 小程序装修
+ - [ ] 自定义页面
- [ ] 商品管理
- [x] 发布商品
- [x] 商品列表
- [x] 展示类目
- - [ ] 品牌管理【待认领】
+ - [ ] 品牌管理【开发中 @黑子】
+ - [ ] 商品标签
- [ ] 订单管理
- - [ ] 销售单 开发中
- - [ ] 售后单 开发中
- - [ ] 订单评价【开发中】
+ - [x] 销售单
+ - [x] 售后单
+ - [ ] 订单评价【开发中 @wang171776704】
- [ ] 会员管理
- [ ] 会员资料 20%【待认领】
+ - [ ] 会员等级
+ - [ ] 会员积分
+ - [ ] 用户标签
- TODO 需要补充
- [ ] 营销管理
- [x] 首页广告
- [x] 商品推荐
- [x] 优惠劵
- - [ ] 优惠码【待认领】
+ - [ ] 优惠码【开发中 @native8623 2019-05-17】
- [ ] 满减送 20% 【待认领】
- [ ] 限制折扣 20% 【待认领】
- [ ] 多人拼团【待认领】
+ - [ ] 积分商城
+ - [ ] 问卷调查
+ - [ ] 幸运大转盘
+- [ ] 分销管理
+ - [ ] 分销设置
+ - [ ] 分销员管理
+ - [ ] 提现管理
- [ ] 系统管理
- [x] 员工管理
- [x] 角色管理
- - [ ] 权限管理
- - [ ] 短信管理
+ - [x] 权限管理
+ - [ ] 部门管理【待认领】
+ - [x] 数据字典
+ - [ ] 短信管理【开发中 @小范】
- [ ] 短信模板
- [ ] 发送日志
- [ ] 员工操作日志
diff --git a/mobile-web/src/config/request.js b/mobile-web/src/config/request.js
index 90183546..9d92692e 100644
--- a/mobile-web/src/config/request.js
+++ b/mobile-web/src/config/request.js
@@ -229,11 +229,11 @@ service.interceptors.response.use(
// TODO token 过期
// TODO 需要拿 refresh token 置换
- if (code === 1001001011 // 访问令牌不存在
- || code === 1001001013 // 访问令牌已失效
- || code === 1001001021 // 刷新令牌不存在
- || code === 1001001022 // 刷新令牌已过期
- || code === 1001001023) { // 刷新令牌已失效
+ if (code === 1002001011 // 访问令牌不存在
+ || code === 1002001013 // 访问令牌已失效
+ || code === 1002001017 // 刷新令牌不存在
+ || code === 1002001018 // 刷新令牌已过期
+ || code === 1002001019) { // 刷新令牌已失效
Dialog.confirm({
title: '系统提示',
message: res.message,
@@ -249,7 +249,7 @@ service.interceptors.response.use(
}
}
});
- } else if (code === 1001001012) { // 访问令牌已过期
+ } else if (code === 1002001012) { // 访问令牌已过期
return refreshToken(response);
} else {
Dialog.alert({
diff --git a/mobile-web/src/page/account/phonelogin.vue b/mobile-web/src/page/account/phonelogin.vue
index 66bf1921..a17b071f 100644
--- a/mobile-web/src/page/account/phonelogin.vue
+++ b/mobile-web/src/page/account/phonelogin.vue
@@ -69,7 +69,7 @@ export default {
let that = this;
let response = doPassportMobileRegister(this.mobile, this.code);
response.then(data => {
- setLoginToken(data.accessToken, data.refreshToken);
+ setLoginToken(data.token.accessToken, data.token.refreshToken);
Dialog.alert({
title: '系统提示',
message: '登陆成功',
diff --git a/mobile-web/src/page/category/index.vue b/mobile-web/src/page/category/index.vue
index 2f7cd5da..5baa9837 100644
--- a/mobile-web/src/page/category/index.vue
+++ b/mobile-web/src/page/category/index.vue
@@ -50,21 +50,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mobile-web/src/page/user/info/detail.vue b/mobile-web/src/page/user/info/detail.vue
index 155a303b..be4913e8 100644
--- a/mobile-web/src/page/user/info/detail.vue
+++ b/mobile-web/src/page/user/info/detail.vue
@@ -1,7 +1,7 @@
-
+
@@ -14,6 +14,10 @@
+
+
+
+
-
\ No newline at end of file
+
diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java
index de95a304..d7591408 100644
--- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java
+++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java
@@ -9,7 +9,6 @@ import cn.iocoder.mall.order.application.convert.OrderReturnConvert;
import cn.iocoder.mall.order.application.po.admin.OrderReturnQueryPO;
import io.swagger.annotations.Api;
import org.apache.dubbo.config.annotation.Reference;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -26,8 +25,7 @@ import javax.servlet.http.HttpServletRequest;
@Api("订单退货(admins api)")
public class AdminOrderReturnController {
- @Autowired
- @Reference(validation = "true")
+ @Reference(validation = "true", version = "${dubbo.provider.OrderReturnService.version}")
private OrderReturnService orderReturnService;
@GetMapping("list")
diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminsOrderController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminsOrderController.java
index 668607c5..7dd02565 100644
--- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminsOrderController.java
+++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminsOrderController.java
@@ -5,7 +5,9 @@ import cn.iocoder.mall.order.api.OrderService;
import cn.iocoder.mall.order.api.bo.OrderItemBO;
import cn.iocoder.mall.order.api.bo.OrderPageBO;
import cn.iocoder.mall.order.api.bo.OrderRecipientBO;
-import cn.iocoder.mall.order.api.dto.*;
+import cn.iocoder.mall.order.api.dto.OrderItemUpdateDTO;
+import cn.iocoder.mall.order.api.dto.OrderLogisticsUpdateDTO;
+import cn.iocoder.mall.order.api.dto.OrderQueryDTO;
import cn.iocoder.mall.order.application.convert.OrderConvertAPP;
import cn.iocoder.mall.order.application.convert.OrderDeliveryConvert;
import cn.iocoder.mall.order.application.po.admin.OrderDeliverPO;
@@ -15,7 +17,6 @@ import cn.iocoder.mall.order.application.po.admin.OrderPageQueryPO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -29,10 +30,10 @@ import java.util.List;
*/
@RestController
@RequestMapping("admins/order")
-@Api(value = "订单API(admins)")
+@Api(value = "订单 API(admins)")
public class AdminsOrderController {
- @Reference(validation = "true")
+ @Reference(validation = "true", version = "${dubbo.provider.OrderService.version}")
private OrderService orderService;
@GetMapping("page")
diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderController.java
index 587559b1..3f235c0c 100644
--- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderController.java
+++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderController.java
@@ -19,6 +19,7 @@ import cn.iocoder.mall.order.application.po.user.OrderCreatePO;
import cn.iocoder.mall.order.application.vo.UsersOrderConfirmCreateVO;
import cn.iocoder.mall.promotion.api.CouponService;
import cn.iocoder.mall.promotion.api.bo.CouponCardAvailableBO;
+import cn.iocoder.mall.user.sdk.annotation.RequiresLogin;
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -41,19 +42,23 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
*/
@RestController
@RequestMapping("users/order")
-@Api(description = "用户订单")
+@Api(description = "用户订单") // TODO FROM 芋艿 to 小范,description 已经废弃啦
public class OrderController {
- @Reference(validation = "true")
+ @Reference(validation = "true", version = "${dubbo.provider.OrderReturnService.version}")
private OrderService orderService;
+
@Reference(validation = "true", version = "${dubbo.provider.CartService.version}")
private CartService cartService;
+
@Reference(validation = "true", version = "${dubbo.consumer.DataDictService.version}")
private DataDictService dataDictService;
+
@Reference(validation = "true", version = "${dubbo.consumer.CouponService.version}")
private CouponService couponService;
@GetMapping("order_page")
+ @RequiresLogin
@ApiOperation("订单分页")
public CommonResult getOrderPage(@Validated OrderQueryDTO orderQueryDTO) {
Integer userId = UserSecurityContextHolder.getContext().getUserId();
@@ -62,6 +67,7 @@ public class OrderController {
}
@PostMapping("create_order")
+ @RequiresLogin
@ApiOperation("创建订单")
public CommonResult createOrder(@RequestBody @Validated OrderCreatePO orderCreatePO,
HttpServletRequest request) {
@@ -72,6 +78,7 @@ public class OrderController {
}
@PostMapping("create_order_from_cart")
+ @RequiresLogin
@ApiOperation("创建订单购物车")
public CommonResult createOrderFromCart(@RequestParam("userAddressId") Integer userAddressId,
@RequestParam(value = "couponCardId", required = false) Integer couponCardId,
@@ -99,6 +106,7 @@ public class OrderController {
}
@GetMapping("confirm_create_order")
+ @RequiresLogin
@ApiOperation("确认创建订单")
public CommonResult getConfirmCreateOrder(@RequestParam("skuId") Integer skuId,
@RequestParam("quantity") Integer quantity,
@@ -118,6 +126,7 @@ public class OrderController {
}
@PostMapping("confirm_receiving")
+ @RequiresLogin
@ApiOperation("确认收货")
public CommonResult confirmReceiving(@RequestParam("orderId") Integer orderId) {
Integer userId = UserSecurityContextHolder.getContext().getUserId();
@@ -125,6 +134,7 @@ public class OrderController {
}
@GetMapping("info")
+ @RequiresLogin
@ApiOperation("订单详情")
public CommonResult orderInfo(@RequestParam("orderId") Integer orderId) {
Integer userId = UserSecurityContextHolder.getContext().getUserId();
diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderLogisticsController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderLogisticsController.java
index 34cbcf97..e3a96ee0 100644
--- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderLogisticsController.java
+++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderLogisticsController.java
@@ -35,8 +35,9 @@ import java.util.stream.Collectors;
@Api(description = "订单物流信息")
public class OrderLogisticsController {
- @Reference(validation = "true")
+ @Reference(validation = "true", version = "${dubbo.provider.OrderLogisticsService.version}")
private OrderLogisticsService orderLogisticsService;
+
@Reference(validation = "true", version = "${dubbo.consumer.DataDictService.version}")
private DataDictService dataDictService;
diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderReturnController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderReturnController.java
index b1735979..2a78b1c0 100644
--- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderReturnController.java
+++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderReturnController.java
@@ -25,8 +25,9 @@ import java.util.List;
@RequestMapping("users/order_return")
public class OrderReturnController {
- @Reference(validation = "true")
+ @Reference(validation = "true", version = "${dubbo.provider.OrderReturnService.version}")
private OrderReturnService orderReturnService;
+
@Reference(validation = "true", version = "${dubbo.consumer.DataDictService.version}")
private DataDictService dataDictService;
diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersCartController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersCartController.java
index 08e92fd1..5e021055 100644
--- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersCartController.java
+++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersCartController.java
@@ -13,7 +13,6 @@ import cn.iocoder.mall.order.application.vo.UsersCartDetailVO;
import cn.iocoder.mall.order.application.vo.UsersOrderConfirmCreateVO;
import cn.iocoder.mall.promotion.api.CouponService;
import cn.iocoder.mall.promotion.api.bo.CouponCardAvailableBO;
-import cn.iocoder.mall.user.sdk.annotation.PermitAll;
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;
@@ -31,8 +30,10 @@ public class UsersCartController {
@Reference(validation = "true", version = "${dubbo.provider.CartService.version}")
private CartService cartService;
- @Reference(validation = "true")
+
+ @Reference(validation = "true", version = "${dubbo.provider.OrderService.version}")
private OrderService orderService;
+
@Reference(validation = "true", version = "${dubbo.consumer.CouponService.version}")
private CouponService couponService;
@@ -125,7 +126,6 @@ public class UsersCartController {
}
@GetMapping("/calc_sku_price")
- @PermitAll
public CommonResult calcSkuPrice(@RequestParam("skuId") Integer skuId) {
// 计算 sku 的价格
CalcSkuPriceBO calcSkuPrice = cartService.calcSkuPrice(skuId);
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java
index 5ceea1df..33691753 100644
--- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java
+++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java
@@ -127,7 +127,7 @@ public interface OrderService {
CommonResult updateLogistics(OrderLogisticsUpdateDTO orderLogisticsDTO);
/**
- * 删除订单
+ * 删除订单 // TODO FROM 芋艿 to 小范。删除订单,不要使用 deleted 字段,对于用户是删除,实际是隐藏。
*
* @param id
*/
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderRecipientBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderRecipientBO.java
index 62e44a18..af4206cc 100644
--- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderRecipientBO.java
+++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderRecipientBO.java
@@ -12,7 +12,7 @@ import lombok.experimental.Accessors;
*/
@Data
@Accessors(chain = true)
-public class OrderRecipientBO extends BaseDO {
+public class OrderRecipientBO extends BaseDO { // TODO FROM 芋艿 TO 小范,不要继承 BaseDO
/**
* 编号
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/CalcOrderPriceDTO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/CalcOrderPriceDTO.java
index 71781754..a40e35de 100644
--- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/CalcOrderPriceDTO.java
+++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/CalcOrderPriceDTO.java
@@ -15,10 +15,12 @@ public class CalcOrderPriceDTO {
@NotNull(message = "用户编号不能为空")
private Integer userId;
+
/**
* 优惠劵编号
*/
private Integer couponCardId;
+
@NotNull(message = "商品数组不能为空")
private List- items;
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/package-info.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/package-info.java
deleted file mode 100644
index 80054d29..00000000
--- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/package-info.java
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * 订单 api
- *
- * @author Sin
- * @time 2019-03-16 13:15
- */
-package cn.iocoder.mall.order.api;
\ No newline at end of file
diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/config/ServiceExceptionConfiguration.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/config/ServiceExceptionConfiguration.java
index 0a1a466f..b3f95e54 100644
--- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/config/ServiceExceptionConfiguration.java
+++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/config/ServiceExceptionConfiguration.java
@@ -16,5 +16,5 @@ public class ServiceExceptionConfiguration {
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
- }
-}
\ No newline at end of file
+ } // TODO FROM 芋艿 to 小范,这里记得配置下,不然错误提示不出去呀。
+}
diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/constants/package-info.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/constants/package-info.java
deleted file mode 100644
index ec085dee..00000000
--- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/constants/package-info.java
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * 定义常量,以及枚举信息
- *
- * @author Sin
- * @time 2019-03-20 21:16
- */
-package cn.iocoder.mall.order.biz.constants;
\ No newline at end of file
diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentDO.java
index a74e9bc9..85b1932e 100644
--- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentDO.java
+++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentDO.java
@@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
public class OrderCommentDO extends BaseDO {
/**
- * 评论id
+ * 评论id // TODO FROM 芋艿 TO wtz 中英文之间,要有空格
*/
private Integer id;
@@ -103,7 +103,7 @@ public class OrderCommentDO extends BaseDO {
private Integer replayCount;
/**
- * 点赞数
+ * 点赞数 // TODO FROM 芋艿 TO wtz collect 是收藏的意思,最好换个单词噢。
*/
private Integer collectCount;
diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentReplayDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentReplayDO.java
index 45dc4346..5145b41e 100644
--- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentReplayDO.java
+++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentReplayDO.java
@@ -8,6 +8,8 @@ import lombok.experimental.Accessors;
/**
* 商品评价回复表
*
+ * // TODO FROM 芋艿 TO wtz 商品评价回复表 =》订单评论回复表
+ *
* @author wtz
* @time 2019-05-14 21:00
*
@@ -28,7 +30,7 @@ public class OrderCommentReplayDO extends BaseDO {
private Integer commentId;
/**
- * 回复的类型
+ * 回复的类型 // TODO FROM 芋艿 TO wtz 记得加下枚举类
*/
private Integer replyType;
@@ -73,7 +75,7 @@ public class OrderCommentReplayDO extends BaseDO {
private String replyUserAvatar;
/**
- * 回复用户身份
+ * 回复用户身份 // TODO FROM 芋艿 TO wtz 【提示】userType 和 UserTypeEnum 记录保持一致。
*/
private Integer replyUserType;
diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderReturnDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderReturnDO.java
index 24284496..92495fad 100644
--- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderReturnDO.java
+++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderReturnDO.java
@@ -1,7 +1,6 @@
package cn.iocoder.mall.order.biz.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO;
-import cn.iocoder.common.framework.dataobject.DeletableDO;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -17,6 +16,8 @@ import java.util.Date;
@Accessors(chain = true)
public class OrderReturnDO extends BaseDO {
+ // TODO FROM 芋艿 TO 小范,存储下支付中心的退款单号
+
/**
* 编号自动增长
*/
@@ -24,6 +25,7 @@ public class OrderReturnDO extends BaseDO {
/**
* 服务号
*/
+ // TODO FROM 芋艿 to 小范,换个名字,看着怪怪的 哈哈哈哈。
private String serviceNumber;
/**
* 订单编号
@@ -54,6 +56,7 @@ public class OrderReturnDO extends BaseDO {
/**
* 问题描述
*/
+ // TODO FROM 芋艿 to 小范,describe 是动词,换成名词 description
private String describe;
///
diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnServiceImpl.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnServiceImpl.java
index 5919b66e..eba36ab9 100644
--- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnServiceImpl.java
+++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnServiceImpl.java
@@ -21,7 +21,7 @@ import cn.iocoder.mall.order.biz.dataobject.OrderDO;
import cn.iocoder.mall.order.biz.dataobject.OrderItemDO;
import cn.iocoder.mall.order.biz.dataobject.OrderReturnDO;
import cn.iocoder.mall.pay.api.PayRefundService;
-import cn.iocoder.mall.pay.api.dto.PayRefundSubmitDTO;
+import cn.iocoder.mall.pay.api.dto.refund.PayRefundSubmitDTO;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java
index e3f13568..8535612c 100644
--- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java
+++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java
@@ -14,8 +14,8 @@ import cn.iocoder.mall.order.biz.convert.*;
import cn.iocoder.mall.order.biz.dao.*;
import cn.iocoder.mall.order.biz.dataobject.*;
import cn.iocoder.mall.pay.api.PayTransactionService;
-import cn.iocoder.mall.pay.api.bo.PayTransactionBO;
-import cn.iocoder.mall.pay.api.dto.PayTransactionCreateDTO;
+import cn.iocoder.mall.pay.api.bo.transaction.PayTransactionBO;
+import cn.iocoder.mall.pay.api.dto.transaction.PayTransactionCreateDTO;
import cn.iocoder.mall.product.api.ProductSpuService;
import cn.iocoder.mall.product.api.bo.ProductSkuDetailBO;
import cn.iocoder.mall.promotion.api.CouponService;
@@ -79,7 +79,7 @@ public class OrderServiceImpl implements OrderService {
public CommonResult getOrderPage(OrderQueryDTO orderQueryDTO) {
int totalCount = orderMapper.selectPageCount(orderQueryDTO);
- if (totalCount == 0) {
+ if (totalCount == 0) { // TODO FROM 芋艿 TO 小范 Collections.EMPTY_LIST 改成 Collections.emptyList()
return CommonResult.success(new OrderPageBO().setOrders(Collections.EMPTY_LIST).setTotal(0));
}
@@ -92,7 +92,7 @@ public class OrderServiceImpl implements OrderService {
// 获取订单 id
Set orderIds = orderDOList.stream()
- .map(orderDO -> orderDO.getId())
+ .map(orderDO -> orderDO.getId()) // TODO FROM 芋艿 to 小范,记得用 Lambda
.collect(Collectors.toSet());
// 获取配送信息
@@ -231,10 +231,10 @@ public class OrderServiceImpl implements OrderService {
// 设置 orderItem
Map productSpuBOMap = productList
.stream().collect(Collectors.toMap(ProductSkuDetailBO::getId, o -> o)); // 商品 SKU 信息的集合
- Map priceItemMap = new HashMap<>();
+ Map priceItemMap = new HashMap<>(); // 商品 SKU 价格的映射
calcOrderPrice.getItemGroups().forEach(itemGroup ->
itemGroup.getItems().forEach(item -> priceItemMap.put(item.getId(), item)));
-
+ // 遍历 orderItemDOList 数组,将商品信息、商品价格,设置到其中
for (OrderItemDO orderItemDO : orderItemDOList) {
ProductSkuDetailBO productSkuDetailBO = productSpuBOMap.get(orderItemDO.getSkuId());
if (productSkuDetailBO.getQuantity() <= 0) {
@@ -267,6 +267,7 @@ public class OrderServiceImpl implements OrderService {
// order
// TODO: 2019-04-11 Sin 订单号需要生成规则
+ // TODO FROM 芋艿 to 小范:可以考虑抽象成一个方法,下面几个也是。
String orderNo = UUID.randomUUID().toString().replace("-", "").substring(0, 16);
// Integer totalAmount = orderCommon.calculatedAmount(orderItemDOList);
// Integer totalPrice = orderCommon.calculatedPrice(orderItemDOList);
@@ -323,10 +324,6 @@ public class OrderServiceImpl implements OrderService {
// 一次性插入
orderItemMapper.insert(orderItemDOList);
- if (true) {
- throw new RuntimeException("测试 seata 事务回滚");
- }
-
// 创建预订单
createPayTransaction(orderDO, orderItemDOList, orderCreateDTO.getIp());
@@ -358,7 +355,7 @@ public class OrderServiceImpl implements OrderService {
return cartService.calcOrderPrice(calcOrderPriceDTO);
}
- private CommonResult createPayTransaction(OrderDO order, List orderItems, String ip) {
+ private PayTransactionBO createPayTransaction(OrderDO order, List orderItems, String ip) {
// TODO sin 支付订单 orderSubject 暂时取第一个子订单商品信息
String orderSubject = orderItems.get(0).getSkuName();
Date expireTime = DateUtil.addDate(Calendar.MINUTE, PAY_EXPIRE_TIME);
@@ -441,6 +438,7 @@ public class OrderServiceImpl implements OrderService {
.setUpdateTime(null);
// 关闭订单,修改状态 item
+ // TODO FROM 芋艿 TO 小范,更新的时候,where 里面带下 status 避免并发的问题
orderItemMapper.updateByOrderId(
orderId,
new OrderItemDO().setStatus(OrderStatusEnum.CLOSED.getValue())
@@ -454,18 +452,18 @@ public class OrderServiceImpl implements OrderService {
}
@Override
- @Transactional
+ @Transactional // TODO FROM 芋艿 TO 小范:泛型,一定要明确哈。
public CommonResult orderDelivery(OrderDeliveryDTO orderDelivery) {
List orderItemIds = orderDelivery.getOrderItemIds();
- // 获取所有订单 items
+ // 获取所有订单 items // TODO FROM 芋艿 TO 小范,deleted 是默认条件,所以 by 里面可以不带哈
List allOrderItems = orderItemMapper.selectByDeletedAndOrderId(orderDelivery.getOrderId(), DeletedStatusEnum.DELETED_NO.getValue());
// 当前需要发货订单,检查 id 和 status
List needDeliveryOrderItems = allOrderItems.stream()
.filter(orderItemDO -> orderItemIds.contains(orderItemDO.getId())
&& OrderStatusEnum.WAIT_SHIPMENT.getValue() == orderItemDO.getStatus())
- .collect(Collectors.toList());
+ .collect(Collectors.toList()); // TODO 芋艿,如果这里只是比对数字,可以用 Lambda 求和,不需要弄成一个集合的
// 发货订单,检查
if (needDeliveryOrderItems.size() != orderItemIds.size()) {
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_DELIVERY_INCORRECT_DATA.getCode());
@@ -482,6 +480,7 @@ public class OrderServiceImpl implements OrderService {
orderLogisticsMapper.insert(orderLogisticsDO);
// 关联订单item 和 物流信息
+ // TODO FROM 芋艿 TO 小范,更新的时候,where 里面带下 status 避免并发的问题,然后判断下更新数量,不对,就抛出异常。
orderItemMapper.updateByIds(
orderItemIds,
new OrderItemDO()
@@ -495,6 +494,7 @@ public class OrderServiceImpl implements OrderService {
&& !orderItemIds.contains(orderItemDO.getId()))
.collect(Collectors.toList());
if (unShippedOrderItems.size() <= 0) {
+ // TODO FROM 芋艿 TO 小范,更新的时候,where 里面带下 status 避免并发的问题
orderMapper.updateById(
new OrderDO()
.setId(orderDelivery.getOrderId())
@@ -513,7 +513,7 @@ public class OrderServiceImpl implements OrderService {
}
@Override
- @Transactional
+ @Transactional // TODO FROM 芋艿 to 小范,先不做这个功能,电商一班不存在这个功能哈。
public CommonResult deleteOrderItem(OrderItemDeletedDTO orderItemDeletedDTO) {
Integer orderId = orderItemDeletedDTO.getOrderId();
List orderItemIds = orderItemDeletedDTO.getOrderItemIds();
@@ -562,6 +562,7 @@ public class OrderServiceImpl implements OrderService {
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_UNABLE_CONFIRM_ORDER.getCode());
}
+ // TODO FROM 芋艿 TO 小范,更新的时候,where 里面带下 status 避免并发的问题
orderMapper.updateById(
new OrderDO()
.setId(orderId)
@@ -617,7 +618,7 @@ public class OrderServiceImpl implements OrderService {
if (updateCount <= 0) {
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_STATUS_NOT_WAITING_PAYMENT.getCode()).getMessage();
}
- // TODO 芋艿 更新 OrderItemDO
+ // TODO FROM 芋艿 to 小范,把更新 OrderItem 给补全。
return "success";
}
diff --git a/order/order-service-impl/src/main/resources/config/application.yaml b/order/order-service-impl/src/main/resources/config/application.yaml
index 8a1097df..0b869298 100644
--- a/order/order-service-impl/src/main/resources/config/application.yaml
+++ b/order/order-service-impl/src/main/resources/config/application.yaml
@@ -21,7 +21,6 @@ mybatis-plus:
id-type: auto
mapper-locations: classpath*:mapper/*.xml
type-aliases-package: cn.iocoder.mall.order.biz.dataobject
- config-location: classpath:mybatis-config.xml
# dubbo
dubbo:
diff --git a/order/order-service-impl/src/main/resources/mybatis-config.xml b/order/order-service-impl/src/main/resources/mybatis-config.xml
deleted file mode 100644
index 7f604cc7..00000000
--- a/order/order-service-impl/src/main/resources/mybatis-config.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/order/order-service-impl/src/test/java/cn/iocoder/mall/order/biz/mapper/OrderMapperTest.java b/order/order-service-impl/src/test/java/cn/iocoder/mall/order/biz/mapper/OrderMapperTest.java
index 0a57e40e..d30fdaa9 100644
--- a/order/order-service-impl/src/test/java/cn/iocoder/mall/order/biz/mapper/OrderMapperTest.java
+++ b/order/order-service-impl/src/test/java/cn/iocoder/mall/order/biz/mapper/OrderMapperTest.java
@@ -3,8 +3,6 @@ package cn.iocoder.mall.order.biz.mapper;
import cn.iocoder.mall.order.biz.OrderApplicationTest;
import cn.iocoder.mall.order.biz.dao.OrderMapper;
import cn.iocoder.mall.order.biz.dataobject.OrderDO;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/controller/admins/AdminsPayRefundController.java b/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/controller/admins/AdminsPayRefundController.java
index 8246b7c8..c831d6f5 100644
--- a/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/controller/admins/AdminsPayRefundController.java
+++ b/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/controller/admins/AdminsPayRefundController.java
@@ -3,10 +3,10 @@ package cn.iocoder.mall.pay.application.controller.admins;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.pay.api.PayRefundService;
import cn.iocoder.mall.pay.api.PayTransactionService;
-import cn.iocoder.mall.pay.api.bo.PayRefundBO;
-import cn.iocoder.mall.pay.api.bo.PayRefundPageBO;
-import cn.iocoder.mall.pay.api.bo.PayTransactionBO;
-import cn.iocoder.mall.pay.api.dto.PayRefundPageDTO;
+import cn.iocoder.mall.pay.api.bo.refund.PayRefundBO;
+import cn.iocoder.mall.pay.api.bo.refund.PayRefundPageBO;
+import cn.iocoder.mall.pay.api.bo.transaction.PayTransactionBO;
+import cn.iocoder.mall.pay.api.dto.refund.PayRefundPageDTO;
import cn.iocoder.mall.pay.application.convert.PayRefundConvert;
import cn.iocoder.mall.pay.application.vo.admins.AdminsPayRefundPageVO;
import org.apache.dubbo.config.annotation.Reference;
diff --git a/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/controller/admins/AdminsPayTransactionController.java b/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/controller/admins/AdminsPayTransactionController.java
index 936add24..15b16606 100644
--- a/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/controller/admins/AdminsPayTransactionController.java
+++ b/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/controller/admins/AdminsPayTransactionController.java
@@ -2,8 +2,8 @@ package cn.iocoder.mall.pay.application.controller.admins;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.pay.api.PayTransactionService;
-import cn.iocoder.mall.pay.api.bo.PayTransactionPageBO;
-import cn.iocoder.mall.pay.api.dto.PayTransactionPageDTO;
+import cn.iocoder.mall.pay.api.bo.transaction.PayTransactionPageBO;
+import cn.iocoder.mall.pay.api.dto.transaction.PayTransactionPageDTO;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
diff --git a/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/controller/users/UsersPayTransactionController.java b/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/controller/users/UsersPayTransactionController.java
index d6cde4bd..eff2c35e 100644
--- a/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/controller/users/UsersPayTransactionController.java
+++ b/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/controller/users/UsersPayTransactionController.java
@@ -3,11 +3,14 @@ package cn.iocoder.mall.pay.application.controller.users;
import cn.iocoder.common.framework.util.HttpUtil;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.pay.api.PayTransactionService;
-import cn.iocoder.mall.pay.api.bo.PayTransactionBO;
-import cn.iocoder.mall.pay.api.bo.PayTransactionSubmitBO;
+import cn.iocoder.mall.pay.api.bo.transaction.PayTransactionBO;
+import cn.iocoder.mall.pay.api.bo.transaction.PayTransactionSubmitBO;
import cn.iocoder.mall.pay.api.constant.PayChannelEnum;
-import cn.iocoder.mall.pay.api.dto.PayTransactionSubmitDTO;
+import cn.iocoder.mall.pay.api.dto.transaction.PayTransactionGetDTO;
+import cn.iocoder.mall.pay.api.dto.transaction.PayTransactionSubmitDTO;
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -18,8 +21,11 @@ import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
+import static cn.iocoder.common.framework.vo.CommonResult.success;
+
@RestController
-@RequestMapping("users/transaction") // TODO 芋艿,理论来说,是用户无关的。这里先酱紫先~
+@RequestMapping("users/transaction")
+@Api("【用户】支付交易 API")
public class UsersPayTransactionController {
private Logger logger = LoggerFactory.getLogger(getClass());
@@ -28,23 +34,19 @@ public class UsersPayTransactionController {
private PayTransactionService payTransactionService;
@GetMapping("/get")
- // TODO result 后面改下
- public CommonResult get(@RequestParam("appId") String appId,
- @RequestParam("orderId") String orderId) {
- return payTransactionService.getTransaction(UserSecurityContextHolder.getContext().getUserId(), appId, orderId);
+ @ApiOperation("获得支付交易")
+ public CommonResult get(PayTransactionGetDTO payTransactionGetDTO) {
+ payTransactionGetDTO.setUserId(UserSecurityContextHolder.getContext().getUserId());
+ return success(payTransactionService.getTransaction(payTransactionGetDTO));
}
- @PostMapping("/submit") // TODO api 注释
- // TODO result 后面改下
+ @PostMapping("/submit")
+ @ApiOperation("提交支付交易")
public CommonResult submit(HttpServletRequest request,
- @RequestParam("appId") String appId,
- @RequestParam("orderId") String orderId,
- @RequestParam("payChannel") Integer payChannel) {
- PayTransactionSubmitDTO payTransactionSubmitDTO = new PayTransactionSubmitDTO()
- .setAppId(appId).setOrderId(orderId).setPayChannel(payChannel)
- .setCreateIp(HttpUtil.getIp(request));
+ PayTransactionSubmitDTO payTransactionSubmitDTO) {
+ payTransactionSubmitDTO.setCreateIp(HttpUtil.getIp(request));
// 提交支付提交
- return payTransactionService.submitTransaction(payTransactionSubmitDTO);
+ return success(payTransactionService.submitTransaction(payTransactionSubmitDTO));
}
@PostMapping(value = "pingxx_pay_success", consumes = MediaType.APPLICATION_JSON_VALUE)
@@ -63,11 +65,7 @@ public class UsersPayTransactionController {
// JSONObject bodyObj = JSON.parseObject(sb.toString());
// bodyObj.put("webhookId", bodyObj.remove("id"));
// String body = bodyObj.toString();
- CommonResult result = payTransactionService.updateTransactionPaySuccess(PayChannelEnum.PINGXX.getId(), sb.toString());
- if (result.isError()) {
- logger.error("[pingxxPaySuccess][message({}) result({})]", sb, result);
- return "failure";
- }
+ payTransactionService.updateTransactionPaySuccess(PayChannelEnum.PINGXX.getId(), sb.toString());
return "success";
}
diff --git a/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/convert/PayRefundConvert.java b/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/convert/PayRefundConvert.java
index f1894d75..5f2c50e6 100644
--- a/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/convert/PayRefundConvert.java
+++ b/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/convert/PayRefundConvert.java
@@ -1,6 +1,6 @@
package cn.iocoder.mall.pay.application.convert;
-import cn.iocoder.mall.pay.api.bo.PayRefundBO;
+import cn.iocoder.mall.pay.api.bo.refund.PayRefundBO;
import cn.iocoder.mall.pay.application.vo.admins.AdminsPayRefundDetailVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
diff --git a/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/vo/admins/AdminsPayRefundDetailVO.java b/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/vo/admins/AdminsPayRefundDetailVO.java
index 2d24c60d..1a596620 100644
--- a/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/vo/admins/AdminsPayRefundDetailVO.java
+++ b/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/vo/admins/AdminsPayRefundDetailVO.java
@@ -1,7 +1,7 @@
package cn.iocoder.mall.pay.application.vo.admins;
-import cn.iocoder.mall.pay.api.bo.PayRefundBO;
-import cn.iocoder.mall.pay.api.bo.PayTransactionBO;
+import cn.iocoder.mall.pay.api.bo.refund.PayRefundBO;
+import cn.iocoder.mall.pay.api.bo.transaction.PayTransactionBO;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/PayRefundService.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/PayRefundService.java
index e652d654..6c8ed94c 100644
--- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/PayRefundService.java
+++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/PayRefundService.java
@@ -1,10 +1,10 @@
package cn.iocoder.mall.pay.api;
import cn.iocoder.common.framework.vo.CommonResult;
-import cn.iocoder.mall.pay.api.bo.PayRefundPageBO;
-import cn.iocoder.mall.pay.api.bo.PayRefundSubmitBO;
-import cn.iocoder.mall.pay.api.dto.PayRefundPageDTO;
-import cn.iocoder.mall.pay.api.dto.PayRefundSubmitDTO;
+import cn.iocoder.mall.pay.api.bo.refund.PayRefundPageBO;
+import cn.iocoder.mall.pay.api.bo.refund.PayRefundSubmitBO;
+import cn.iocoder.mall.pay.api.dto.refund.PayRefundPageDTO;
+import cn.iocoder.mall.pay.api.dto.refund.PayRefundSubmitDTO;
public interface PayRefundService {
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/PayTransactionService.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/PayTransactionService.java
index 0cba24cd..49869c61 100644
--- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/PayTransactionService.java
+++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/PayTransactionService.java
@@ -1,23 +1,24 @@
package cn.iocoder.mall.pay.api;
import cn.iocoder.common.framework.vo.CommonResult;
-import cn.iocoder.mall.pay.api.bo.PayTransactionBO;
-import cn.iocoder.mall.pay.api.bo.PayTransactionPageBO;
-import cn.iocoder.mall.pay.api.bo.PayTransactionSubmitBO;
-import cn.iocoder.mall.pay.api.dto.PayTransactionCreateDTO;
-import cn.iocoder.mall.pay.api.dto.PayTransactionPageDTO;
-import cn.iocoder.mall.pay.api.dto.PayTransactionSubmitDTO;
+import cn.iocoder.mall.pay.api.bo.transaction.PayTransactionBO;
+import cn.iocoder.mall.pay.api.bo.transaction.PayTransactionPageBO;
+import cn.iocoder.mall.pay.api.bo.transaction.PayTransactionSubmitBO;
+import cn.iocoder.mall.pay.api.dto.transaction.PayTransactionCreateDTO;
+import cn.iocoder.mall.pay.api.dto.transaction.PayTransactionGetDTO;
+import cn.iocoder.mall.pay.api.dto.transaction.PayTransactionPageDTO;
+import cn.iocoder.mall.pay.api.dto.transaction.PayTransactionSubmitDTO;
import java.util.Collection;
import java.util.List;
public interface PayTransactionService {
- CommonResult getTransaction(Integer userId, String appId, String orderId);
+ PayTransactionBO getTransaction(PayTransactionGetDTO payTransactionGetDTO);
- CommonResult createTransaction(PayTransactionCreateDTO payTransactionCreateDTO);
+ PayTransactionBO createTransaction(PayTransactionCreateDTO payTransactionCreateDTO);
- CommonResult submitTransaction(PayTransactionSubmitDTO payTransactionSubmitDTO);
+ PayTransactionSubmitBO submitTransaction(PayTransactionSubmitDTO payTransactionSubmitDTO);
/**
* 更新交易支付成功
@@ -29,7 +30,7 @@ public interface PayTransactionService {
* 因为不同平台,能够提供的参数不同,所以使用 String 类型统一接收,然后在使用不同的 AbstractPaySDK 进行处理。
* @return 是否支付成功
*/
- CommonResult updateTransactionPaySuccess(Integer payChannel, String params);
+ Boolean updateTransactionPaySuccess(Integer payChannel, String params);
List getTransactionList(Collection ids);
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayTransactionSubmitBO.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayTransactionSubmitBO.java
deleted file mode 100644
index 6d227753..00000000
--- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayTransactionSubmitBO.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package cn.iocoder.mall.pay.api.bo;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-
-/**
- * 支付交易提交结果 BO
- */
-@Data
-@Accessors(chain = true)
-public class PayTransactionSubmitBO implements Serializable {
-
- /**
- * 支付交易拓展单编号
- */
- private Integer id;
- /**
- * 调用三方平台的响应结果
- */
- private String invokeResponse;
-
-}
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayRefundBO.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/refund/PayRefundBO.java
similarity index 97%
rename from pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayRefundBO.java
rename to pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/refund/PayRefundBO.java
index 23f104ca..66621718 100644
--- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayRefundBO.java
+++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/refund/PayRefundBO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.pay.api.bo;
+package cn.iocoder.mall.pay.api.bo.refund;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayRefundPageBO.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/refund/PayRefundPageBO.java
similarity index 89%
rename from pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayRefundPageBO.java
rename to pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/refund/PayRefundPageBO.java
index 00f3c1bb..e3d1bc44 100644
--- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayRefundPageBO.java
+++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/refund/PayRefundPageBO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.pay.api.bo;
+package cn.iocoder.mall.pay.api.bo.refund;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayRefundSubmitBO.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/refund/PayRefundSubmitBO.java
similarity index 83%
rename from pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayRefundSubmitBO.java
rename to pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/refund/PayRefundSubmitBO.java
index f24f2cb2..7fc734bc 100644
--- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayRefundSubmitBO.java
+++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/refund/PayRefundSubmitBO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.pay.api.bo;
+package cn.iocoder.mall.pay.api.bo.refund;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayTransactionBO.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/transaction/PayTransactionBO.java
similarity index 54%
rename from pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayTransactionBO.java
rename to pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/transaction/PayTransactionBO.java
index d49a0dad..c676d715 100644
--- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayTransactionBO.java
+++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/transaction/PayTransactionBO.java
@@ -1,63 +1,48 @@
-package cn.iocoder.mall.pay.api.bo;
+package cn.iocoder.mall.pay.api.bo.transaction;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
-/**
- * 支付交易 BO
- */
+@ApiModel("支付交易 BO")
@Data
@Accessors(chain = true)
public class PayTransactionBO implements Serializable {
- /**
- * 编号,自增
- */
+ @ApiModelProperty(value = "交易编号", required = true, example = "POd4RC6a")
private Integer id;
- /**
- * 应用编号
- */
+
+ @ApiModelProperty(value = "应用编号", required = true, example = "POd4RC6a")
private String appId;
- /**
- * 发起交易的 IP
- */
+
+ @ApiModelProperty(value = "发起交易的 IP", required = true, example = "192.168.10.1")
private String createIp;
- /**
- * 业务线的订单编号
- *
- * 1. 使用 String 的原因是,业务线可能使用 String 做为编号
- * 2. 每个 appId 下,orderId 唯一
- */
+
+ @ApiModelProperty(value = "订单号不能为空", required = true, example = "1024")
private String orderId;
- /**
- * 订单商品名
- */
+
+ @ApiModelProperty(value = "商品名", required = true, example = "芋道源码")
private String orderSubject;
- /**
- * 订单商品描述
- */
+
+ @ApiModelProperty(value = "订单商品描述", required = true, example = "绵啾啾的")
private String orderDescription;
- /**
- * 订单备注
- */
+
+ @ApiModelProperty(value = "订单商品备注", example = "绵啾啾的")
private String orderMemo;
- /**
- * 支付金额,单位:分。
- */
+
+ @ApiModelProperty(value = "支付金额,单位:分。", required = true, example = "10")
private Integer price;
- /**
- * 订单状态
- *
- * @see cn.iocoder.mall.pay.api.constant.PayTransactionStatusEnum
- */
+
+ @ApiModelProperty(value = "订单状态", required = true, example = "1", notes = "参见 PayTransactionStatusEnum 枚举")
private Integer status;
- /**
- * 交易过期时间
- */
+
+ @ApiModelProperty(value = "交易过期时间", required = true)
private Date expireTime;
+
/**
* 回调业务线完成时间
*/
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayTransactionPageBO.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/transaction/PayTransactionPageBO.java
similarity index 88%
rename from pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayTransactionPageBO.java
rename to pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/transaction/PayTransactionPageBO.java
index d91b1a6e..325ae02a 100644
--- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/PayTransactionPageBO.java
+++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/transaction/PayTransactionPageBO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.pay.api.bo;
+package cn.iocoder.mall.pay.api.bo.transaction;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/transaction/PayTransactionSubmitBO.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/transaction/PayTransactionSubmitBO.java
new file mode 100644
index 00000000..558ad3ff
--- /dev/null
+++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/bo/transaction/PayTransactionSubmitBO.java
@@ -0,0 +1,21 @@
+package cn.iocoder.mall.pay.api.bo.transaction;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+@ApiModel("支付交易提交结果 BO")
+@Data
+@Accessors(chain = true)
+public class PayTransactionSubmitBO implements Serializable {
+
+ @ApiModelProperty(value = "支付交易拓展单编号", required = true, example = "1")
+ private Integer id;
+
+ @ApiModelProperty(value = "调用三方平台的响应结果", required = true)
+ private String invokeResponse;
+
+}
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/constant/PayChannelEnum.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/constant/PayChannelEnum.java
index 72c6cd3f..aca41062 100644
--- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/constant/PayChannelEnum.java
+++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/constant/PayChannelEnum.java
@@ -1,9 +1,13 @@
package cn.iocoder.mall.pay.api.constant;
+import cn.iocoder.common.framework.core.IntArrayValuable;
+
+import java.util.Arrays;
+
/**
* 支付通道
*/
-public enum PayChannelEnum {
+public enum PayChannelEnum implements IntArrayValuable {
WEIXIN_APP(100, "wx", "微信 App 支付"),
WEIXIN_PUB(101, "wxjs", "微信 JS API 支付"),
@@ -13,6 +17,8 @@ public enum PayChannelEnum {
PINGXX(9999, "ping++", "ping++ 支付"),
;
+ public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(PayChannelEnum::getId).toArray();
+
/**
* 渠道编号
*/
@@ -44,4 +50,9 @@ public enum PayChannelEnum {
return name;
}
+ @Override
+ public int[] array() {
+ return ARRAYS;
+ }
+
}
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/PayTransactionSubmitDTO.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/PayTransactionSubmitDTO.java
deleted file mode 100644
index c0050a0e..00000000
--- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/PayTransactionSubmitDTO.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package cn.iocoder.mall.pay.api.dto;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-
-/**
- * 支付交易提交 DTO
- */
-@Data
-@Accessors(chain = true)
-public class PayTransactionSubmitDTO {
-
- /**
- * 应用编号
- */
- @NotEmpty(message = "应用编号不能为空")
- private String appId;
- /**
- * 发起交易的 IP
- */
- @NotEmpty(message = "IP 不能为空")
- private String createIp;
- /**
- * 业务线的订单编号
- */
- @NotEmpty(message = "订单号不能为空")
- private String orderId;
- /**
- * 支付渠道
- */
- @NotNull(message = "支付渠道")
- private Integer payChannel;
-
-}
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/PayRefundPageDTO.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/refund/PayRefundPageDTO.java
similarity index 95%
rename from pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/PayRefundPageDTO.java
rename to pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/refund/PayRefundPageDTO.java
index e1d0dd3f..8c10689b 100644
--- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/PayRefundPageDTO.java
+++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/refund/PayRefundPageDTO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.pay.api.dto;
+package cn.iocoder.mall.pay.api.dto.refund;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/PayRefundSubmitDTO.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/refund/PayRefundSubmitDTO.java
similarity index 96%
rename from pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/PayRefundSubmitDTO.java
rename to pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/refund/PayRefundSubmitDTO.java
index 173d7435..2f9cf990 100644
--- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/PayRefundSubmitDTO.java
+++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/refund/PayRefundSubmitDTO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.pay.api.dto;
+package cn.iocoder.mall.pay.api.dto.refund;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/PayTransactionCreateDTO.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionCreateDTO.java
similarity index 56%
rename from pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/PayTransactionCreateDTO.java
rename to pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionCreateDTO.java
index 857098d4..b854ed84 100644
--- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/PayTransactionCreateDTO.java
+++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionCreateDTO.java
@@ -1,5 +1,7 @@
-package cn.iocoder.mall.pay.api.dto;
+package cn.iocoder.mall.pay.api.dto.transaction;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
@@ -10,54 +12,43 @@ import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
-/**
- * 支付交易创建 DTO
- */
+@ApiModel("支付交易创建 DTO")
@Data
@Accessors(chain = true)
public class PayTransactionCreateDTO implements Serializable {
- /**
- * 应用编号
- */
+ @ApiModelProperty(value = "应用编号", required = true, example = "POd4RC6a")
@NotEmpty(message = "应用编号不能为空")
private String appId;
- /**
- * 发起交易的 IP
- */
+
+ @ApiModelProperty(value = "发起交易的 IP", required = true, example = "192.168.10.1")
@NotEmpty(message = "IP 不能为空")
private String createIp;
- /**
- * 业务线的订单编号
- */
+
+ @ApiModelProperty(value = "订单号不能为空", required = true, example = "1024")
@NotEmpty(message = "订单号不能为空")
private String orderId;
- /**
- * 订单商品名
- */
+
+ @ApiModelProperty(value = "商品名", required = true, example = "芋道源码")
@NotEmpty(message = "商品名不能为空")
@Length(max = 32, message = "商品名不能超过32")
private String orderSubject;
- /**
- * 订单商品描述
- */
+
+ @ApiModelProperty(value = "订单商品描述", required = true, example = "绵啾啾的")
@NotEmpty(message = "商品描述不能为空")
@Length(max = 128, message = "商品描述长度不能超过128")
private String orderDescription;
- /**
- * 订单备注
- */
- @Length(max = 256, message = "商品描述长度不能超过256")
+
+ @ApiModelProperty(value = "订单商品备注", example = "绵啾啾的")
+ @Length(max = 256, message = "商品备注长度不能超过256")
private String orderMemo;
- /**
- * 支付金额,单位:分。
- */
+
+ @ApiModelProperty(value = "支付金额,单位:分。", required = true, example = "10")
@NotNull(message = "金额不能为空")
@DecimalMin(value = "0", inclusive = false, message = "金额必须大于零")
private Integer price;
- /**
- * 交易过期时间
- */
+
+ @ApiModelProperty(value = "交易过期时间", required = true)
@NotNull(message = "交易过期时间不能为空")
private Date expireTime;
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionGetDTO.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionGetDTO.java
new file mode 100644
index 00000000..26ff9e78
--- /dev/null
+++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionGetDTO.java
@@ -0,0 +1,28 @@
+package cn.iocoder.mall.pay.api.dto.transaction;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+@ApiModel("支付交易获得 DTO")
+@Data
+@Accessors(chain = true)
+public class PayTransactionGetDTO {
+
+ @ApiModelProperty(value = "用户编号", required = true, example = "1", hidden = true) // hidden 的原因是,Service DTO 自己传入,无需暴露的 Controller API 里
+ @NotNull(message = "用户编号不能为空")
+ private Integer userId;
+
+ @ApiModelProperty(value = "应用编号", required = true, example = "POd4RC6a")
+ @NotEmpty(message = "应用编号不能为空")
+ private String appId;
+
+ @ApiModelProperty(value = "订单号不能为空", required = true, example = "1024")
+ @NotEmpty(message = "订单号不能为空")
+ private String orderId;
+
+}
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/PayTransactionPageDTO.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionPageDTO.java
similarity index 95%
rename from pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/PayTransactionPageDTO.java
rename to pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionPageDTO.java
index f77aa3fb..c64380fe 100644
--- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/PayTransactionPageDTO.java
+++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionPageDTO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.pay.api.dto;
+package cn.iocoder.mall.pay.api.dto.transaction;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionSubmitDTO.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionSubmitDTO.java
new file mode 100644
index 00000000..8800bfaa
--- /dev/null
+++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionSubmitDTO.java
@@ -0,0 +1,35 @@
+package cn.iocoder.mall.pay.api.dto.transaction;
+
+import cn.iocoder.common.framework.validator.InEnum;
+import cn.iocoder.mall.pay.api.constant.PayChannelEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+@ApiModel("支付交易提交 DTO")
+@Data
+@Accessors(chain = true)
+public class PayTransactionSubmitDTO {
+
+ @ApiModelProperty(value = "应用编号", required = true, example = "POd4RC6a")
+ @NotEmpty(message = "应用编号不能为空")
+ private String appId;
+
+ @ApiModelProperty(value = "发起交易的 IP", required = true, example = "192.168.10.1", hidden = true) // hidden 的原因是,Service DTO 自己传入,无需暴露的 Controller API 里
+ @NotEmpty(message = "IP 不能为空")
+ private String createIp;
+
+ @ApiModelProperty(value = "订单号", required = true, example = "1024")
+ @NotEmpty(message = "订单号不能为空")
+ private String orderId;
+
+ @ApiModelProperty(value = "支付渠道", required = true, example = "1", notes = "参见 PayChannelEnum 枚举")
+ @InEnum(value = PayChannelEnum.class, message = "支付渠道必须是 {value}")
+ @NotNull(message = "支付渠道")
+ private Integer payChannel;
+
+}
diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/component/DubboReferencePool.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/component/DubboReferencePool.java
index 85837009..62d6e6ad 100644
--- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/component/DubboReferencePool.java
+++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/component/DubboReferencePool.java
@@ -1,17 +1,20 @@
package cn.iocoder.mall.pay.biz.component;
-import org.apache.dubbo.config.ApplicationConfig;
-import org.apache.dubbo.config.ReferenceConfig;
-import org.apache.dubbo.config.RegistryConfig;
-import org.apache.dubbo.rpc.service.GenericService;
+import cn.iocoder.common.framework.util.StringUtil;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import lombok.Data;
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ReferenceConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.rpc.service.GenericService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
+import java.util.List;
+
@Component
public class DubboReferencePool {
@@ -44,7 +47,8 @@ public class DubboReferencePool {
private String dubboApplicationName;
private ReferenceMeta createGenericService(String notifyUrl) {
- String[] notifyUrlParts = notifyUrl.split("#");
+ // 使用 # 号分隔,格式为 服务名#方法名#版本号
+ List notifyUrlParts = StringUtil.split(notifyUrl, "#");
// 创建 ApplicationConfig 对象
ApplicationConfig application = new ApplicationConfig();
application.setName(dubboApplicationName);
@@ -55,14 +59,14 @@ public class DubboReferencePool {
application.setRegistry(registry);
// 创建 ReferenceConfig 对象
ReferenceConfig reference = new ReferenceConfig<>();
- reference.setInterface(notifyUrlParts[0]); // 弱类型接口名
+ reference.setInterface(notifyUrlParts.get(0)); // 弱类型接口名
reference.setGeneric(true); // 声明为泛化接口
reference.setApplication(application);
-// reference.setVersion("*"); // TODO 芋艿,后面要优化下。
+ reference.setVersion(notifyUrlParts.size() > 2 ? notifyUrlParts.get(2) : "1.0.0"); // 如果未配置服务的版本号,则默认使用 1.0.0
// 获得 GenericService 对象
GenericService genericService = reference.get();
// 构建最终的 ReferenceMeta 对象
- return new ReferenceMeta(reference, genericService, notifyUrlParts[1]);
+ return new ReferenceMeta(reference, genericService, notifyUrlParts.get(1));
}
public ReferenceMeta getReferenceMeta(String notifyUrl) {
diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/convert/PayRefundConvert.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/convert/PayRefundConvert.java
index 66ea9691..9b99490f 100644
--- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/convert/PayRefundConvert.java
+++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/convert/PayRefundConvert.java
@@ -1,7 +1,7 @@
package cn.iocoder.mall.pay.biz.convert;
-import cn.iocoder.mall.pay.api.bo.PayRefundBO;
-import cn.iocoder.mall.pay.api.dto.PayRefundSubmitDTO;
+import cn.iocoder.mall.pay.api.bo.refund.PayRefundBO;
+import cn.iocoder.mall.pay.api.dto.refund.PayRefundSubmitDTO;
import cn.iocoder.mall.pay.biz.dataobject.PayRefundDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/convert/PayTransactionConvert.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/convert/PayTransactionConvert.java
index d034a5d6..9b35b468 100644
--- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/convert/PayTransactionConvert.java
+++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/convert/PayTransactionConvert.java
@@ -1,8 +1,8 @@
package cn.iocoder.mall.pay.biz.convert;
-import cn.iocoder.mall.pay.api.bo.PayTransactionBO;
-import cn.iocoder.mall.pay.api.dto.PayTransactionCreateDTO;
-import cn.iocoder.mall.pay.api.dto.PayTransactionSubmitDTO;
+import cn.iocoder.mall.pay.api.bo.transaction.PayTransactionBO;
+import cn.iocoder.mall.pay.api.dto.transaction.PayTransactionCreateDTO;
+import cn.iocoder.mall.pay.api.dto.transaction.PayTransactionSubmitDTO;
import cn.iocoder.mall.pay.biz.dataobject.PayTransactionDO;
import cn.iocoder.mall.pay.biz.dataobject.PayTransactionExtensionDO;
import org.mapstruct.Mapper;
diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/mq/PayRefundSuccessConsumer.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/mq/PayRefundSuccessConsumer.java
index c35e7be5..2f6afc10 100644
--- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/mq/PayRefundSuccessConsumer.java
+++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/mq/PayRefundSuccessConsumer.java
@@ -18,6 +18,7 @@ import java.util.Date;
topic = PayRefundSuccessMessage.TOPIC,
consumerGroup = "pay-consumer-group-" + PayRefundSuccessMessage.TOPIC
)
+@Deprecated // 艿艿:突然发现,业务方实际无需回调。参考了 https://help.youzan.com/displaylist/detail_4_998 的文章。业务方,只要记录下退款单号,进行关联即可。
public class PayRefundSuccessConsumer extends AbstractPayNotifySuccessConsumer
implements RocketMQListener {
diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayAppServiceImpl.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayAppServiceImpl.java
index 0046ae67..fcd52405 100644
--- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayAppServiceImpl.java
+++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayAppServiceImpl.java
@@ -2,7 +2,6 @@ package cn.iocoder.mall.pay.biz.service;
import cn.iocoder.common.framework.constant.CommonStatusEnum;
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
-import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.pay.api.constant.PayErrorCodeEnum;
import cn.iocoder.mall.pay.biz.dao.PayAppMapper;
import cn.iocoder.mall.pay.biz.dataobject.PayAppDO;
@@ -15,17 +14,17 @@ public class PayAppServiceImpl {
@Autowired
private PayAppMapper payAppMapper;
- public CommonResult validPayApp(String appId) {
+ public PayAppDO validPayApp(String appId) {
PayAppDO payAppDO = payAppMapper.selectById(appId);
// 校验是否存在
if (payAppDO == null) {
- return ServiceExceptionUtil.error(PayErrorCodeEnum.PAY_APP_NOT_FOUND.getCode());
+ throw ServiceExceptionUtil.exception(PayErrorCodeEnum.PAY_APP_NOT_FOUND.getCode());
}
// 校验是否禁用
if (CommonStatusEnum.DISABLE.getValue().equals(payAppDO.getStatus())) {
- return ServiceExceptionUtil.error(PayErrorCodeEnum.PAY_APP_IS_DISABLE.getCode());
+ throw ServiceExceptionUtil.exception(PayErrorCodeEnum.PAY_APP_IS_DISABLE.getCode());
}
- return CommonResult.success(payAppDO);
+ return payAppDO;
}
-}
\ No newline at end of file
+}
diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayNotifyServiceImpl.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayNotifyServiceImpl.java
index 5e36ff69..b2ecc1f8 100644
--- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayNotifyServiceImpl.java
+++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayNotifyServiceImpl.java
@@ -27,6 +27,7 @@ public class PayNotifyServiceImpl {
@Resource
private RocketMQTemplate rocketMQTemplate;
+ @Deprecated // 参见 PayRefundSuccessConsumer 类的说明
public void addRefundNotifyTask(PayRefundDO refund) {
PayNotifyTaskDO payTransactionNotifyTask = this.createBasePayNotifyTaskDO(refund.getAppId(), refund.getNotifyUrl())
.setType(PayNotifyType.REFUND.getValue());
diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayRefundServiceImpl.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayRefundServiceImpl.java
index eb8c8ea9..f701eac5 100644
--- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayRefundServiceImpl.java
+++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayRefundServiceImpl.java
@@ -5,13 +5,13 @@ import cn.iocoder.common.framework.util.MathUtil;
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.pay.api.PayRefundService;
-import cn.iocoder.mall.pay.api.bo.PayRefundPageBO;
-import cn.iocoder.mall.pay.api.bo.PayRefundSubmitBO;
+import cn.iocoder.mall.pay.api.bo.refund.PayRefundPageBO;
+import cn.iocoder.mall.pay.api.bo.refund.PayRefundSubmitBO;
import cn.iocoder.mall.pay.api.constant.PayErrorCodeEnum;
import cn.iocoder.mall.pay.api.constant.PayRefundStatus;
import cn.iocoder.mall.pay.api.constant.PayTransactionStatusEnum;
-import cn.iocoder.mall.pay.api.dto.PayRefundPageDTO;
-import cn.iocoder.mall.pay.api.dto.PayRefundSubmitDTO;
+import cn.iocoder.mall.pay.api.dto.refund.PayRefundPageDTO;
+import cn.iocoder.mall.pay.api.dto.refund.PayRefundSubmitDTO;
import cn.iocoder.mall.pay.biz.client.AbstractPaySDK;
import cn.iocoder.mall.pay.biz.client.PaySDKFactory;
import cn.iocoder.mall.pay.biz.client.RefundSuccessBO;
@@ -51,13 +51,9 @@ public class PayRefundServiceImpl implements PayRefundService {
private RocketMQTemplate rocketMQTemplate;
@Override
- @SuppressWarnings("Duplicates")
public CommonResult submitRefund(PayRefundSubmitDTO payRefundSubmitDTO) {
// 校验 App 是否有效
- CommonResult appResult = payAppService.validPayApp(payRefundSubmitDTO.getAppId());
- if (appResult.isError()) {
- return CommonResult.error(appResult);
- }
+ PayAppDO payAppDO = payAppService.validPayApp(payRefundSubmitDTO.getAppId());
// 获得 PayTransactionDO ,并校验其是否存在
PayTransactionDO payTransaction = payTransactionService.getTransaction(payRefundSubmitDTO.getAppId(), payRefundSubmitDTO.getOrderId());
if (payTransaction == null) { // 是否存在
@@ -82,7 +78,7 @@ public class PayRefundServiceImpl implements PayRefundService {
.setTransactionId(payTransaction.getId())
.setRefundCode(generateTransactionCode()) // TODO 芋艿,后续调整
.setStatus(PayRefundStatus.WAITING.getValue())
- .setNotifyUrl(appResult.getData().getRefundNotifyUrl())
+ .setNotifyUrl(payAppDO.getRefundNotifyUrl())
.setRefundChannel(payTransaction.getPayChannel());
payRefundDO.setCreateTime(new Date());
payRefundMapper.insert(payRefundDO);
diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayTransactionServiceImpl.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayTransactionServiceImpl.java
index 374abbba..31001240 100644
--- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayTransactionServiceImpl.java
+++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayTransactionServiceImpl.java
@@ -5,14 +5,15 @@ import cn.iocoder.common.framework.util.MathUtil;
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.pay.api.PayTransactionService;
-import cn.iocoder.mall.pay.api.bo.PayTransactionBO;
-import cn.iocoder.mall.pay.api.bo.PayTransactionPageBO;
-import cn.iocoder.mall.pay.api.bo.PayTransactionSubmitBO;
+import cn.iocoder.mall.pay.api.bo.transaction.PayTransactionBO;
+import cn.iocoder.mall.pay.api.bo.transaction.PayTransactionPageBO;
+import cn.iocoder.mall.pay.api.bo.transaction.PayTransactionSubmitBO;
import cn.iocoder.mall.pay.api.constant.PayErrorCodeEnum;
import cn.iocoder.mall.pay.api.constant.PayTransactionStatusEnum;
-import cn.iocoder.mall.pay.api.dto.PayTransactionCreateDTO;
-import cn.iocoder.mall.pay.api.dto.PayTransactionPageDTO;
-import cn.iocoder.mall.pay.api.dto.PayTransactionSubmitDTO;
+import cn.iocoder.mall.pay.api.dto.transaction.PayTransactionCreateDTO;
+import cn.iocoder.mall.pay.api.dto.transaction.PayTransactionGetDTO;
+import cn.iocoder.mall.pay.api.dto.transaction.PayTransactionPageDTO;
+import cn.iocoder.mall.pay.api.dto.transaction.PayTransactionSubmitDTO;
import cn.iocoder.mall.pay.biz.client.AbstractPaySDK;
import cn.iocoder.mall.pay.biz.client.PaySDKFactory;
import cn.iocoder.mall.pay.biz.client.TransactionSuccessBO;
@@ -68,23 +69,21 @@ public class PayTransactionServiceImpl implements PayTransactionService {
}
@Override
- public CommonResult getTransaction(Integer userId, String appId, String orderId) {
- PayTransactionDO payTransaction = payTransactionMapper.selectByAppIdAndOrderId(appId, orderId);
+ public PayTransactionBO getTransaction(PayTransactionGetDTO payTransactionGetDTO) {
+ PayTransactionDO payTransaction = payTransactionMapper.selectByAppIdAndOrderId(payTransactionGetDTO.getAppId(),
+ payTransactionGetDTO.getOrderId());
if (payTransaction == null) {
- return ServiceExceptionUtil.error(PayErrorCodeEnum.PAY_TRANSACTION_NOT_FOUND.getCode());
+ throw ServiceExceptionUtil.exception(PayErrorCodeEnum.PAY_TRANSACTION_NOT_FOUND.getCode());
}
// TODO 芋艿 userId 的校验
- return CommonResult.success(PayTransactionConvert.INSTANCE.convert(payTransaction));
+ return PayTransactionConvert.INSTANCE.convert(payTransaction);
}
@Override
@SuppressWarnings("Duplicates")
- public CommonResult createTransaction(PayTransactionCreateDTO payTransactionCreateDTO) {
+ public PayTransactionBO createTransaction(PayTransactionCreateDTO payTransactionCreateDTO) {
// 校验 App
- CommonResult appResult = payAppService.validPayApp(payTransactionCreateDTO.getAppId());
- if (appResult.isError()) {
- return CommonResult.error(appResult);
- }
+ PayAppDO payAppDO = payAppService.validPayApp(payTransactionCreateDTO.getAppId());
// 插入 PayTransactionDO
PayTransactionDO payTransaction = payTransactionMapper.selectByAppIdAndOrderId(
payTransactionCreateDTO.getAppId(), payTransactionCreateDTO.getOrderId());
@@ -95,31 +94,28 @@ public class PayTransactionServiceImpl implements PayTransactionService {
} else {
payTransaction = PayTransactionConvert.INSTANCE.convert(payTransactionCreateDTO);
payTransaction.setStatus(PayTransactionStatusEnum.WAITING.getValue())
- .setNotifyUrl(appResult.getData().getNotifyUrl());
+ .setNotifyUrl(payAppDO.getNotifyUrl());
payTransaction.setCreateTime(new Date());
payTransactionMapper.insert(payTransaction);
}
// 返回成功
- return CommonResult.success(PayTransactionConvert.INSTANCE.convert(payTransaction));
+ return PayTransactionConvert.INSTANCE.convert(payTransaction);
}
@Override
@SuppressWarnings("Duplicates")
- public CommonResult submitTransaction(PayTransactionSubmitDTO payTransactionSubmitDTO) {
+ public PayTransactionSubmitBO submitTransaction(PayTransactionSubmitDTO payTransactionSubmitDTO) {
// TODO 校验支付渠道是否有效
// 校验 App 是否有效
- CommonResult appResult = payAppService.validPayApp(payTransactionSubmitDTO.getAppId());
- if (appResult.isError()) {
- return CommonResult.error(appResult);
- }
+ payAppService.validPayApp(payTransactionSubmitDTO.getAppId());
// 获得 PayTransactionDO ,并校验其是否存在
PayTransactionDO payTransaction = payTransactionMapper.selectByAppIdAndOrderId(
payTransactionSubmitDTO.getAppId(), payTransactionSubmitDTO.getOrderId());
if (payTransaction == null) { // 是否存在
- return ServiceExceptionUtil.error(PayErrorCodeEnum.PAY_TRANSACTION_NOT_FOUND.getCode());
+ throw ServiceExceptionUtil.exception(PayErrorCodeEnum.PAY_TRANSACTION_NOT_FOUND.getCode());
}
if (!PayTransactionStatusEnum.WAITING.getValue().equals(payTransaction.getStatus())) { // 校验状态,必须是待支付
- return ServiceExceptionUtil.error(PayErrorCodeEnum.PAY_TRANSACTION_STATUS_IS_NOT_WAITING.getCode());
+ throw ServiceExceptionUtil.exception(PayErrorCodeEnum.PAY_TRANSACTION_STATUS_IS_NOT_WAITING.getCode());
}
// 插入 PayTransactionExtensionDO
PayTransactionExtensionDO payTransactionExtensionDO = PayTransactionConvert.INSTANCE.convert(payTransactionSubmitDTO)
@@ -131,33 +127,32 @@ public class PayTransactionServiceImpl implements PayTransactionService {
AbstractPaySDK paySDK = PaySDKFactory.getSDK(payTransactionSubmitDTO.getPayChannel());
CommonResult invokeResult = paySDK.submitTransaction(payTransaction, payTransactionExtensionDO, null); // TODO 暂时传入 extra = null
if (invokeResult.isError()) {
- return CommonResult.error(invokeResult);
+ throw ServiceExceptionUtil.exception(invokeResult.getCode(), invokeResult.getMessage());
}
// TODO 轮询三方接口,是否已经支付的任务
// 返回成功
- PayTransactionSubmitBO payTransactionSubmitBO = new PayTransactionSubmitBO()
- .setId(payTransactionExtensionDO.getId()).setInvokeResponse(invokeResult.getData());
- return CommonResult.success(payTransactionSubmitBO);
+ return new PayTransactionSubmitBO().setId(payTransactionExtensionDO.getId())
+ .setInvokeResponse(invokeResult.getData());
}
@Override
@Transactional
- public CommonResult updateTransactionPaySuccess(Integer payChannel, String params) {
+ public Boolean updateTransactionPaySuccess(Integer payChannel, String params) {
// TODO 芋艿,记录回调日志
// 解析传入的参数,成 TransactionSuccessBO 对象
AbstractPaySDK paySDK = PaySDKFactory.getSDK(payChannel);
CommonResult paySuccessResult = paySDK.parseTransactionSuccessParams(params);
if (paySuccessResult.isError()) {
- return CommonResult.error(paySuccessResult);
+ throw ServiceExceptionUtil.exception(paySuccessResult.getCode(), paySuccessResult.getMessage());
}
// TODO 芋艿,先最严格的校验。即使调用方重复调用,实际哪个订单已经被重复回调的支付,也返回 false 。也没问题,因为实际已经回调成功了。
// 1.1 查询 PayTransactionExtensionDO
PayTransactionExtensionDO extension = payTransactionExtensionMapper.selectByTransactionCode(paySuccessResult.getData().getTransactionCode());
if (extension == null) {
- return ServiceExceptionUtil.error(PayErrorCodeEnum.PAY_TRANSACTION_EXTENSION_NOT_FOUND.getCode());
+ throw ServiceExceptionUtil.exception(PayErrorCodeEnum.PAY_TRANSACTION_EXTENSION_NOT_FOUND.getCode());
}
if (!PayTransactionStatusEnum.WAITING.getValue().equals(extension.getStatus())) { // 校验状态,必须是待支付
- return ServiceExceptionUtil.error(PayErrorCodeEnum.PAY_TRANSACTION_EXTENSION_STATUS_IS_NOT_WAITING.getCode());
+ throw ServiceExceptionUtil.exception(PayErrorCodeEnum.PAY_TRANSACTION_EXTENSION_STATUS_IS_NOT_WAITING.getCode());
}
// 1.2 更新 PayTransactionExtensionDO
PayTransactionExtensionDO updatePayTransactionExtension = new PayTransactionExtensionDO()
@@ -172,7 +167,7 @@ public class PayTransactionServiceImpl implements PayTransactionService {
// 2.1 判断 PayTransactionDO 是否处于待支付
PayTransactionDO transaction = payTransactionMapper.selectById(extension.getTransactionId());
if (transaction == null) {
- return ServiceExceptionUtil.error(PayErrorCodeEnum.PAY_TRANSACTION_NOT_FOUND.getCode());
+ throw ServiceExceptionUtil.exception(PayErrorCodeEnum.PAY_TRANSACTION_NOT_FOUND.getCode());
}
if (!PayTransactionStatusEnum.WAITING.getValue().equals(transaction.getStatus())) { // 校验状态,必须是待支付
throw ServiceExceptionUtil.exception(PayErrorCodeEnum.PAY_TRANSACTION_STATUS_IS_NOT_WAITING.getCode());
@@ -191,10 +186,10 @@ public class PayTransactionServiceImpl implements PayTransactionService {
throw ServiceExceptionUtil.exception(PayErrorCodeEnum.PAY_TRANSACTION_STATUS_IS_NOT_WAITING.getCode());
}
logger.info("[updateTransactionPaySuccess][PayTransactionDO({}) 更新为已支付]", transaction.getId());
- // 3 新增 PayNotifyTaskDO
- payNotifyService.addTransactionNotifyTask(transaction, extension);
+ // 3 新增 PayNotifyTaskDO 注释原因,参见 PayRefundSuccessConsumer 类。
+// payNotifyService.addTransactionNotifyTask(transaction, extension);
// 返回结果
- return CommonResult.success(true);
+ return true;
}
@Override
diff --git a/pay/pay-service-impl/src/test/java/cn/iocoder/mall/pay/biz/service/PayRefundServiceImplTest.java b/pay/pay-service-impl/src/test/java/cn/iocoder/mall/pay/biz/service/PayRefundServiceImplTest.java
index 80c6b72b..35c18810 100644
--- a/pay/pay-service-impl/src/test/java/cn/iocoder/mall/pay/biz/service/PayRefundServiceImplTest.java
+++ b/pay/pay-service-impl/src/test/java/cn/iocoder/mall/pay/biz/service/PayRefundServiceImplTest.java
@@ -1,7 +1,7 @@
package cn.iocoder.mall.pay.biz.service;
import cn.iocoder.mall.pay.api.PayRefundService;
-import cn.iocoder.mall.pay.api.dto.PayRefundSubmitDTO;
+import cn.iocoder.mall.pay.api.dto.refund.PayRefundSubmitDTO;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/pay/pay-service-impl/src/test/java/cn/iocoder/mall/pay/biz/service/PayTransactionServiceImplTest.java b/pay/pay-service-impl/src/test/java/cn/iocoder/mall/pay/biz/service/PayTransactionServiceImplTest.java
index e3a34f04..ef905bfc 100644
--- a/pay/pay-service-impl/src/test/java/cn/iocoder/mall/pay/biz/service/PayTransactionServiceImplTest.java
+++ b/pay/pay-service-impl/src/test/java/cn/iocoder/mall/pay/biz/service/PayTransactionServiceImplTest.java
@@ -1,10 +1,6 @@
package cn.iocoder.mall.pay.biz.service;
-import cn.iocoder.mall.pay.api.dto.PayRefundSubmitDTO;
-import org.junit.Ignore;
-import org.junit.Test;
import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/users/UsersProductCategoryController.java b/product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/users/UsersProductCategoryController.java
index e9a9543e..8e2b6603 100644
--- a/product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/users/UsersProductCategoryController.java
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/users/UsersProductCategoryController.java
@@ -5,11 +5,10 @@ import cn.iocoder.mall.product.api.ProductCategoryService;
import cn.iocoder.mall.product.api.bo.ProductCategoryBO;
import cn.iocoder.mall.product.application.convert.ProductCategoryConvert;
import cn.iocoder.mall.product.application.vo.users.UsersProductCategoryVO;
-import cn.iocoder.mall.user.sdk.annotation.PermitAll;
-import org.apache.dubbo.config.annotation.Reference;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
+import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -30,7 +29,6 @@ public class UsersProductCategoryController {
@GetMapping("/list")
@ApiOperation("获得指定编号下的子分类的数组")
@ApiImplicitParam(name = "pid", value = "指定分类编号", required = true, example = "0")
- @PermitAll
public CommonResult
> list(@RequestParam("pid") Integer pid) {
List result = productCategoryService.getListByPid(pid);
return CommonResult.success(ProductCategoryConvert.Users.INSTANCE.convertToVO(result));
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/users/UsersProductSpuController.java b/product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/users/UsersProductSpuController.java
index 6aece980..4f3e3c32 100644
--- a/product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/users/UsersProductSpuController.java
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/users/UsersProductSpuController.java
@@ -7,7 +7,6 @@ import cn.iocoder.mall.product.api.dto.ProductSpuPageDTO;
import cn.iocoder.mall.product.application.convert.ProductSpuConvert;
import cn.iocoder.mall.product.application.vo.users.UsersProductSpuDetailVO;
import cn.iocoder.mall.product.application.vo.users.UsersProductSpuPageVO;
-import cn.iocoder.mall.user.sdk.annotation.PermitAll;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -31,7 +30,6 @@ public class UsersProductSpuController {
@GetMapping("/info")
@ApiOperation("商品 SPU 明细")
@ApiImplicitParam(name = "id", value = "SPU 编号", required = true, example = "100")
- @PermitAll
public CommonResult info(@RequestParam("id") Integer id) {
return success(ProductSpuConvert.INSTANCE.convert4(productSpuService.getProductSpuDetail(id)));
}
@@ -43,7 +41,6 @@ public class UsersProductSpuController {
@ApiImplicitParam(name = "pageNo", value = "页码,从 1 开始", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, example = "10"),
})
- @PermitAll
@Deprecated // 使用商品搜索接口
public CommonResult page(@RequestParam(value = "cid", required = false) Integer cid,
@RequestParam(value = "pageNo", defaultValue = "0") Integer pageNo,
diff --git a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersBannerController.java b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersBannerController.java
index 1181bee6..68619434 100644
--- a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersBannerController.java
+++ b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersBannerController.java
@@ -6,7 +6,6 @@ import cn.iocoder.mall.promotion.api.BannerService;
import cn.iocoder.mall.promotion.api.bo.BannerBO;
import cn.iocoder.mall.promotion.application.convert.BannerConvert;
import cn.iocoder.mall.promotion.application.vo.users.UsersBannerVO;
-import cn.iocoder.mall.user.sdk.annotation.PermitAll;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference;
@@ -27,7 +26,6 @@ public class UsersBannerController {
@GetMapping("/list")
@ApiOperation("获得所有 Banner 列表")
- @PermitAll
public CommonResult> list() {
// 查询 Banner 列表
List result = bannerService.getBannerListByStatus(CommonStatusEnum.ENABLE.getValue());
diff --git a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersCouponController.java b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersCouponController.java
index e7b1fb5a..dce496e1 100644
--- a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersCouponController.java
+++ b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersCouponController.java
@@ -11,7 +11,6 @@ import cn.iocoder.mall.promotion.application.convert.CouponTemplateConvert;
import cn.iocoder.mall.promotion.application.vo.users.UsersCouponCardPageVO;
import cn.iocoder.mall.promotion.application.vo.users.UsersCouponCardVO;
import cn.iocoder.mall.promotion.application.vo.users.UsersCouponTemplateVO;
-import cn.iocoder.mall.user.sdk.annotation.PermitAll;
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -35,7 +34,6 @@ public class UsersCouponController {
@GetMapping("/template/get")
@ApiOperation(value = "优惠劵(码)模板信息")
@ApiImplicitParam(name = "id", value = "优惠劵(码)模板编号", required = true, example = "10")
- @PermitAll
public CommonResult templateGet(@RequestParam("id") Integer id) {
CouponTemplateBO template = couponService.getCouponTemplate(id);
return success(CouponTemplateConvert.USERS.convert2(template));
diff --git a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersProductRecommendController.java b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersProductRecommendController.java
index 124f7191..e9bf154b 100644
--- a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersProductRecommendController.java
+++ b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersProductRecommendController.java
@@ -8,7 +8,6 @@ import cn.iocoder.mall.promotion.api.ProductRecommendService;
import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO;
import cn.iocoder.mall.promotion.application.convert.ProductRecommendConvert;
import cn.iocoder.mall.promotion.application.vo.users.UsersProductRecommendVO;
-import cn.iocoder.mall.user.sdk.annotation.PermitAll;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import io.swagger.annotations.Api;
@@ -36,7 +35,6 @@ public class UsersProductRecommendController {
@GetMapping("/list")
@ApiOperation("获得所有 Banner 列表")
- @PermitAll
public CommonResult