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
| @@ -12,6 +12,7 @@ import javax.validation.constraints.NotNull; | @@ -12,6 +12,7 @@ import javax.validation.constraints.NotNull; | ||
| 12 | @Data | 12 | @Data |
| 13 | public class PayMerchantBaseVO { | 13 | public class PayMerchantBaseVO { |
| 14 | 14 | ||
| 15 | + // TODO @aquan:no 应该不允许修改。啊哈哈,我的原型没画对 | ||
| 15 | @ApiModelProperty(value = "商户号") | 16 | @ApiModelProperty(value = "商户号") |
| 16 | private String no; | 17 | private String no; |
| 17 | 18 |
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,7 +9,6 @@ import cn.iocoder.yudao.adminserver.modules.pay.convert.merchant.PayMerchantConv | ||
| 9 | import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.merchant.PayMerchantMapper; | 9 | import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.merchant.PayMerchantMapper; |
| 10 | import cn.iocoder.yudao.adminserver.modules.pay.service.merchant.PayMerchantService; | 10 | import cn.iocoder.yudao.adminserver.modules.pay.service.merchant.PayMerchantService; |
| 11 | import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; | 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 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 12 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 14 | import com.google.common.annotations.VisibleForTesting; | 13 | import com.google.common.annotations.VisibleForTesting; |
| 15 | import org.springframework.stereotype.Service; | 14 | import org.springframework.stereotype.Service; |
| @@ -20,7 +19,7 @@ import java.time.LocalDateTime; | @@ -20,7 +19,7 @@ import java.time.LocalDateTime; | ||
| 20 | import java.util.Collection; | 19 | import java.util.Collection; |
| 21 | import java.util.List; | 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 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 23 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 25 | /** | 24 | /** |
| 26 | * 支付商户信息 Service 实现类 | 25 | * 支付商户信息 Service 实现类 |
| @@ -39,6 +38,7 @@ public class PayMerchantServiceImpl implements PayMerchantService { | @@ -39,6 +38,7 @@ public class PayMerchantServiceImpl implements PayMerchantService { | ||
| 39 | // 插入 | 38 | // 插入 |
| 40 | PayMerchantDO merchant = PayMerchantConvert.INSTANCE.convert(createReqVO); | 39 | PayMerchantDO merchant = PayMerchantConvert.INSTANCE.convert(createReqVO); |
| 41 | // 根据 年月日时分秒毫秒 生成时间戳 | 40 | // 根据 年月日时分秒毫秒 生成时间戳 |
| 41 | + // TODO @aquan:生成 no 可以单独一个小方法 | ||
| 42 | String merchantNo = "M" + DateUtil.format(LocalDateTime.now(),"yyyyMMddHHmmssSSS"); | 42 | String merchantNo = "M" + DateUtil.format(LocalDateTime.now(),"yyyyMMddHHmmssSSS"); |
| 43 | merchant.setNo(merchantNo); | 43 | merchant.setNo(merchantNo); |
| 44 | merchantMapper.insert(merchant); | 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,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.*; | ||
| 28 | /** | 28 | /** |
| 29 | * {@link PayMerchantServiceImpl} 的单元测试类 | 29 | * {@link PayMerchantServiceImpl} 的单元测试类 |
| 30 | * | 30 | * |
| 31 | -* @author 芋艿 | 31 | +* @author 芋艿 // TODO @aquan:修改成自己的。。。 |
| 32 | */ | 32 | */ |
| 33 | @Import(PayMerchantServiceImpl.class) | 33 | @Import(PayMerchantServiceImpl.class) |
| 34 | public class PayMerchantServiceTest extends BaseDbUnitTest { | 34 | public class PayMerchantServiceTest extends BaseDbUnitTest { |
| @@ -51,6 +51,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest { | @@ -51,6 +51,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest { | ||
| 51 | assertNotNull(merchantId); | 51 | assertNotNull(merchantId); |
| 52 | // 校验记录的属性是否正确 | 52 | // 校验记录的属性是否正确 |
| 53 | PayMerchantDO merchant = merchantMapper.selectById(merchantId); | 53 | PayMerchantDO merchant = merchantMapper.selectById(merchantId); |
| 54 | + // TODO @aquan:需要判断 no 非空 | ||
| 54 | assertPojoEquals(reqVO, merchant,"no"); | 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,7 +33,7 @@ public class PayMerchantDO extends BaseDO { | ||
| 33 | * 例如说,M233666999 | 33 | * 例如说,M233666999 |
| 34 | * 只有新增时插入,不允许修改 | 34 | * 只有新增时插入,不允许修改 |
| 35 | */ | 35 | */ |
| 36 | - @TableField(fill = FieldFill.INSERT) | 36 | + @TableField(fill = FieldFill.INSERT) // TODO @aquan:Service 逻辑里设置,所以不用这个注解哈 |
| 37 | private String no; | 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,10 +21,10 @@ public class PayChannelCoreMapperTest extends BaseDbAndRedisIntegrationTest { | ||
| 21 | private PayChannelCoreMapper payChannelCoreMapper; | 21 | private PayChannelCoreMapper payChannelCoreMapper; |
| 22 | 22 | ||
| 23 | /** | 23 | /** |
| 24 | - * 插入初始配置 | 24 | + * 插入 {@link PayChannelEnum#WX_PUB} 初始配置 |
| 25 | */ | 25 | */ |
| 26 | @Test | 26 | @Test |
| 27 | - public void testInsert() throws FileNotFoundException { | 27 | + public void testInsertWxPub() throws FileNotFoundException { |
| 28 | PayChannelDO payChannelDO = new PayChannelDO(); | 28 | PayChannelDO payChannelDO = new PayChannelDO(); |
| 29 | payChannelDO.setCode(PayChannelEnum.WX_PUB.getCode()); | 29 | payChannelDO.setCode(PayChannelEnum.WX_PUB.getCode()); |
| 30 | payChannelDO.setStatus(CommonStatusEnum.ENABLE.getStatus()); | 30 | payChannelDO.setStatus(CommonStatusEnum.ENABLE.getStatus()); |
| @@ -45,11 +45,12 @@ public class PayChannelCoreMapperTest extends BaseDbAndRedisIntegrationTest { | @@ -45,11 +45,12 @@ public class PayChannelCoreMapperTest extends BaseDbAndRedisIntegrationTest { | ||
| 45 | payChannelCoreMapper.insert(payChannelDO); | 45 | payChannelCoreMapper.insert(payChannelDO); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | + // TODO @ouyang:Zfb 改成 AlipayQr | ||
| 48 | /** | 49 | /** |
| 49 | - * 插入支付宝 初始配置 | 50 | + * 插入 {@link PayChannelEnum#ALIPAY_QR} 初始配置 |
| 50 | */ | 51 | */ |
| 51 | @Test | 52 | @Test |
| 52 | - public void testInsertZfb() throws FileNotFoundException { | 53 | + public void testInsertZfb() { |
| 53 | PayChannelDO payChannelDO = new PayChannelDO(); | 54 | PayChannelDO payChannelDO = new PayChannelDO(); |
| 54 | payChannelDO.setCode(PayChannelEnum.ALIPAY_QR.getCode()); | 55 | payChannelDO.setCode(PayChannelEnum.ALIPAY_QR.getCode()); |
| 55 | payChannelDO.setStatus(CommonStatusEnum.ENABLE.getStatus()); | 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,15 +72,16 @@ public class PayOrderController { | ||
| 72 | return "success"; | 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 | @PostMapping(value = "/notify/alipay-wap/{channelId}", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) | 83 | @PostMapping(value = "/notify/alipay-wap/{channelId}", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) |
| 83 | - @ApiOperation("支付宝wap页面回调") | 84 | + @ApiOperation("支付宝 wap 页面回调") |
| 84 | public String notifyAliPayWapPayOrder(@PathVariable("channelId") Long channelId, | 85 | public String notifyAliPayWapPayOrder(@PathVariable("channelId") Long channelId, |
| 85 | @RequestParam Map<String, String> params, | 86 | @RequestParam Map<String, String> params, |
| 86 | @RequestBody String originData) throws Exception { | 87 | @RequestBody String originData) throws Exception { |
| @@ -89,25 +90,23 @@ public class PayOrderController { | @@ -89,25 +90,23 @@ public class PayOrderController { | ||
| 89 | return "success"; | 90 | return "success"; |
| 90 | } | 91 | } |
| 91 | 92 | ||
| 92 | - | ||
| 93 | /** | 93 | /** |
| 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 | 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 | * @param channelId 渠道id | 95 | * @param channelId 渠道id |
| 96 | * @return 返回跳转页面 | 96 | * @return 返回跳转页面 |
| 97 | */ | 97 | */ |
| 98 | @GetMapping(value = "/return/alipay-wap/{channelId}") | 98 | @GetMapping(value = "/return/alipay-wap/{channelId}") |
| 99 | - @ApiOperation("支付宝wap页面回跳") | 99 | + @ApiOperation("支付宝 wap 页面回跳") |
| 100 | public String returnAliPayWapPayOrder(@PathVariable("channelId") Long channelId){ | 100 | public String returnAliPayWapPayOrder(@PathVariable("channelId") Long channelId){ |
| 101 | //TODO 校验 是否支付宝调用。 可以根据 appId 跳转不同的页面 | 101 | //TODO 校验 是否支付宝调用。 可以根据 appId 跳转不同的页面 |
| 102 | return "支付成功"; | 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 | } |