Commit 6265e4a736b2ca6a9d4d6a8a2e441aa3a969a314
1 parent
26798a88
支付的 code review
Showing
8 changed files
with
26 additions
and
25 deletions
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantBaseVO.java
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/merchant/impl/PayMerchantServiceImpl.java
| ... | ... | @@ -9,7 +9,6 @@ import cn.iocoder.yudao.adminserver.modules.pay.convert.merchant.PayMerchantConv |
| 9 | 9 | import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.merchant.PayMerchantMapper; |
| 10 | 10 | import cn.iocoder.yudao.adminserver.modules.pay.service.merchant.PayMerchantService; |
| 11 | 11 | import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; |
| 12 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; | |
| 13 | 12 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 14 | 13 | import com.google.common.annotations.VisibleForTesting; |
| 15 | 14 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -20,7 +19,7 @@ import java.time.LocalDateTime; |
| 20 | 19 | import java.util.Collection; |
| 21 | 20 | import java.util.List; |
| 22 | 21 | |
| 23 | -import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.*; | |
| 22 | +import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.MERCHANT_NOT_EXISTS; | |
| 24 | 23 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 25 | 24 | /** |
| 26 | 25 | * 支付商户信息 Service 实现类 |
| ... | ... | @@ -39,6 +38,7 @@ public class PayMerchantServiceImpl implements PayMerchantService { |
| 39 | 38 | // 插入 |
| 40 | 39 | PayMerchantDO merchant = PayMerchantConvert.INSTANCE.convert(createReqVO); |
| 41 | 40 | // 根据 年月日时分秒毫秒 生成时间戳 |
| 41 | + // TODO @aquan:生成 no 可以单独一个小方法 | |
| 42 | 42 | String merchantNo = "M" + DateUtil.format(LocalDateTime.now(),"yyyyMMddHHmmssSSS"); |
| 43 | 43 | merchant.setNo(merchantNo); |
| 44 | 44 | merchantMapper.insert(merchant); | ... | ... |
yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/merchant/service/PayMerchantServiceTest.java
| ... | ... | @@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.*; |
| 28 | 28 | /** |
| 29 | 29 | * {@link PayMerchantServiceImpl} 的单元测试类 |
| 30 | 30 | * |
| 31 | -* @author 芋艿 | |
| 31 | +* @author 芋艿 // TODO @aquan:修改成自己的。。。 | |
| 32 | 32 | */ |
| 33 | 33 | @Import(PayMerchantServiceImpl.class) |
| 34 | 34 | public class PayMerchantServiceTest extends BaseDbUnitTest { |
| ... | ... | @@ -51,6 +51,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest { |
| 51 | 51 | assertNotNull(merchantId); |
| 52 | 52 | // 校验记录的属性是否正确 |
| 53 | 53 | PayMerchantDO merchant = merchantMapper.selectById(merchantId); |
| 54 | + // TODO @aquan:需要判断 no 非空 | |
| 54 | 55 | assertPojoEquals(reqVO, merchant,"no"); |
| 55 | 56 | } |
| 56 | 57 | ... | ... |
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/merchant/PayMerchantDO.java
| ... | ... | @@ -33,7 +33,7 @@ public class PayMerchantDO extends BaseDO { |
| 33 | 33 | * 例如说,M233666999 |
| 34 | 34 | * 只有新增时插入,不允许修改 |
| 35 | 35 | */ |
| 36 | - @TableField(fill = FieldFill.INSERT) | |
| 36 | + @TableField(fill = FieldFill.INSERT) // TODO @aquan:Service 逻辑里设置,所以不用这个注解哈 | |
| 37 | 37 | private String no; |
| 38 | 38 | /** |
| 39 | 39 | * 商户全称 | ... | ... |
yudao-core-service/src/test-integration/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/merchant/PayChannelCoreMapperTest.java
| ... | ... | @@ -21,10 +21,10 @@ public class PayChannelCoreMapperTest extends BaseDbAndRedisIntegrationTest { |
| 21 | 21 | private PayChannelCoreMapper payChannelCoreMapper; |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | - * 插入初始配置 | |
| 24 | + * 插入 {@link PayChannelEnum#WX_PUB} 初始配置 | |
| 25 | 25 | */ |
| 26 | 26 | @Test |
| 27 | - public void testInsert() throws FileNotFoundException { | |
| 27 | + public void testInsertWxPub() throws FileNotFoundException { | |
| 28 | 28 | PayChannelDO payChannelDO = new PayChannelDO(); |
| 29 | 29 | payChannelDO.setCode(PayChannelEnum.WX_PUB.getCode()); |
| 30 | 30 | payChannelDO.setStatus(CommonStatusEnum.ENABLE.getStatus()); |
| ... | ... | @@ -45,11 +45,12 @@ public class PayChannelCoreMapperTest extends BaseDbAndRedisIntegrationTest { |
| 45 | 45 | payChannelCoreMapper.insert(payChannelDO); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | + // TODO @ouyang:Zfb 改成 AlipayQr | |
| 48 | 49 | /** |
| 49 | - * 插入支付宝 初始配置 | |
| 50 | + * 插入 {@link PayChannelEnum#ALIPAY_QR} 初始配置 | |
| 50 | 51 | */ |
| 51 | 52 | @Test |
| 52 | - public void testInsertZfb() throws FileNotFoundException { | |
| 53 | + public void testInsertZfb() { | |
| 53 | 54 | PayChannelDO payChannelDO = new PayChannelDO(); |
| 54 | 55 | payChannelDO.setCode(PayChannelEnum.ALIPAY_QR.getCode()); |
| 55 | 56 | payChannelDO.setStatus(CommonStatusEnum.ENABLE.getStatus()); | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayNotifyDataDTO.java
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderNotifyRespDTO.java
yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayOrderController.java
| ... | ... | @@ -72,15 +72,16 @@ public class PayOrderController { |
| 72 | 72 | return "success"; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - @RequestMapping("/notify/test") | |
| 76 | - @ApiOperation("通知的测试接口") | |
| 77 | - public String notifyTest() { | |
| 78 | -// System.out.println(data); | |
| 79 | - return "success"; | |
| 75 | + @GetMapping(value = "/return/alipay-qr/{channelId}") | |
| 76 | + @ApiOperation("支付宝 wap 页面回跳") | |
| 77 | + public String returnAliPayQrPayOrder(@PathVariable("channelId") Long channelId){ | |
| 78 | + //TODO @jason 校验 是否支付宝调用。 支付宝publickey 可以根据 appId 跳转不同的页面 | |
| 79 | + System.out.println("支付成功"); | |
| 80 | + return "支付成功"; | |
| 80 | 81 | } |
| 81 | 82 | |
| 82 | 83 | @PostMapping(value = "/notify/alipay-wap/{channelId}", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) |
| 83 | - @ApiOperation("支付宝wap页面回调") | |
| 84 | + @ApiOperation("支付宝 wap 页面回调") | |
| 84 | 85 | public String notifyAliPayWapPayOrder(@PathVariable("channelId") Long channelId, |
| 85 | 86 | @RequestParam Map<String, String> params, |
| 86 | 87 | @RequestBody String originData) throws Exception { |
| ... | ... | @@ -89,25 +90,23 @@ public class PayOrderController { |
| 89 | 90 | return "success"; |
| 90 | 91 | } |
| 91 | 92 | |
| 92 | - | |
| 93 | 93 | /** |
| 94 | 94 | * https://opendocs.alipay.com/open/203/105285#%E5%89%8D%E5%8F%B0%E5%9B%9E%E8%B7%B3%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E |
| 95 | 95 | * @param channelId 渠道id |
| 96 | 96 | * @return 返回跳转页面 |
| 97 | 97 | */ |
| 98 | 98 | @GetMapping(value = "/return/alipay-wap/{channelId}") |
| 99 | - @ApiOperation("支付宝wap页面回跳") | |
| 99 | + @ApiOperation("支付宝 wap 页面回跳") | |
| 100 | 100 | public String returnAliPayWapPayOrder(@PathVariable("channelId") Long channelId){ |
| 101 | 101 | //TODO 校验 是否支付宝调用。 可以根据 appId 跳转不同的页面 |
| 102 | 102 | return "支付成功"; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - | |
| 106 | - @GetMapping(value = "/return/alipay-qr/{channelId}") | |
| 107 | - @ApiOperation("支付宝wap页面回跳") | |
| 108 | - public String returnAliPayQrPayOrder(@PathVariable("channelId") Long channelId){ | |
| 109 | - //TODO @jason 校验 是否支付宝调用。 支付宝publickey 可以根据 appId 跳转不同的页面 | |
| 110 | - System.out.println("支付成功"); | |
| 111 | - return "支付成功"; | |
| 105 | + @RequestMapping("/notify/test") | |
| 106 | + @ApiOperation("通知的测试接口") | |
| 107 | + public String notifyTest() { | |
| 108 | +// System.out.println(data); | |
| 109 | + return "success"; | |
| 112 | 110 | } |
| 111 | + | |
| 113 | 112 | } | ... | ... |