mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
支付的 code review
This commit is contained in:
parent
26798a8816
commit
6265e4a736
@ -12,6 +12,7 @@ import javax.validation.constraints.NotNull;
|
||||
@Data
|
||||
public class PayMerchantBaseVO {
|
||||
|
||||
// TODO @aquan:no 应该不允许修改。啊哈哈,我的原型没画对
|
||||
@ApiModelProperty(value = "商户号")
|
||||
private String no;
|
||||
|
||||
|
@ -9,7 +9,6 @@ import cn.iocoder.yudao.adminserver.modules.pay.convert.merchant.PayMerchantConv
|
||||
import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.merchant.PayMerchantMapper;
|
||||
import cn.iocoder.yudao.adminserver.modules.pay.service.merchant.PayMerchantService;
|
||||
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -20,7 +19,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.*;
|
||||
import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.MERCHANT_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
/**
|
||||
* 支付商户信息 Service 实现类
|
||||
@ -39,6 +38,7 @@ public class PayMerchantServiceImpl implements PayMerchantService {
|
||||
// 插入
|
||||
PayMerchantDO merchant = PayMerchantConvert.INSTANCE.convert(createReqVO);
|
||||
// 根据 年月日时分秒毫秒 生成时间戳
|
||||
// TODO @aquan:生成 no 可以单独一个小方法
|
||||
String merchantNo = "M" + DateUtil.format(LocalDateTime.now(),"yyyyMMddHHmmssSSS");
|
||||
merchant.setNo(merchantNo);
|
||||
merchantMapper.insert(merchant);
|
||||
|
@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
/**
|
||||
* {@link PayMerchantServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋艿
|
||||
* @author 芋艿 // TODO @aquan:修改成自己的。。。
|
||||
*/
|
||||
@Import(PayMerchantServiceImpl.class)
|
||||
public class PayMerchantServiceTest extends BaseDbUnitTest {
|
||||
@ -51,6 +51,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest {
|
||||
assertNotNull(merchantId);
|
||||
// 校验记录的属性是否正确
|
||||
PayMerchantDO merchant = merchantMapper.selectById(merchantId);
|
||||
// TODO @aquan:需要判断 no 非空
|
||||
assertPojoEquals(reqVO, merchant,"no");
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class PayMerchantDO extends BaseDO {
|
||||
* 例如说,M233666999
|
||||
* 只有新增时插入,不允许修改
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@TableField(fill = FieldFill.INSERT) // TODO @aquan:Service 逻辑里设置,所以不用这个注解哈
|
||||
private String no;
|
||||
/**
|
||||
* 商户全称
|
||||
|
@ -21,10 +21,10 @@ public class PayChannelCoreMapperTest extends BaseDbAndRedisIntegrationTest {
|
||||
private PayChannelCoreMapper payChannelCoreMapper;
|
||||
|
||||
/**
|
||||
* 插入初始配置
|
||||
* 插入 {@link PayChannelEnum#WX_PUB} 初始配置
|
||||
*/
|
||||
@Test
|
||||
public void testInsert() throws FileNotFoundException {
|
||||
public void testInsertWxPub() throws FileNotFoundException {
|
||||
PayChannelDO payChannelDO = new PayChannelDO();
|
||||
payChannelDO.setCode(PayChannelEnum.WX_PUB.getCode());
|
||||
payChannelDO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
@ -45,11 +45,12 @@ public class PayChannelCoreMapperTest extends BaseDbAndRedisIntegrationTest {
|
||||
payChannelCoreMapper.insert(payChannelDO);
|
||||
}
|
||||
|
||||
// TODO @ouyang:Zfb 改成 AlipayQr
|
||||
/**
|
||||
* 插入支付宝 初始配置
|
||||
* 插入 {@link PayChannelEnum#ALIPAY_QR} 初始配置
|
||||
*/
|
||||
@Test
|
||||
public void testInsertZfb() throws FileNotFoundException {
|
||||
public void testInsertZfb() {
|
||||
PayChannelDO payChannelDO = new PayChannelDO();
|
||||
payChannelDO.setCode(PayChannelEnum.ALIPAY_QR.getCode());
|
||||
payChannelDO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
|
@ -6,7 +6,7 @@ import lombok.ToString;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
// TODO @jason:注释要写下哈。字段不要使用 // 注释,非标准
|
||||
@Data
|
||||
@ToString
|
||||
@Builder
|
||||
|
@ -42,7 +42,6 @@ public class PayOrderNotifyRespDTO {
|
||||
*/
|
||||
private String data;
|
||||
|
||||
|
||||
/**
|
||||
* TODO @jason 结合其他的渠道定义成枚举,
|
||||
* alipay
|
||||
|
@ -72,15 +72,16 @@ public class PayOrderController {
|
||||
return "success";
|
||||
}
|
||||
|
||||
@RequestMapping("/notify/test")
|
||||
@ApiOperation("通知的测试接口")
|
||||
public String notifyTest() {
|
||||
// System.out.println(data);
|
||||
return "success";
|
||||
@GetMapping(value = "/return/alipay-qr/{channelId}")
|
||||
@ApiOperation("支付宝 wap 页面回跳")
|
||||
public String returnAliPayQrPayOrder(@PathVariable("channelId") Long channelId){
|
||||
//TODO @jason 校验 是否支付宝调用。 支付宝publickey 可以根据 appId 跳转不同的页面
|
||||
System.out.println("支付成功");
|
||||
return "支付成功";
|
||||
}
|
||||
|
||||
@PostMapping(value = "/notify/alipay-wap/{channelId}", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||
@ApiOperation("支付宝wap页面回调")
|
||||
@ApiOperation("支付宝 wap 页面回调")
|
||||
public String notifyAliPayWapPayOrder(@PathVariable("channelId") Long channelId,
|
||||
@RequestParam Map<String, String> params,
|
||||
@RequestBody String originData) throws Exception {
|
||||
@ -89,25 +90,23 @@ public class PayOrderController {
|
||||
return "success";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param channelId 渠道id
|
||||
* @return 返回跳转页面
|
||||
*/
|
||||
@GetMapping(value = "/return/alipay-wap/{channelId}")
|
||||
@ApiOperation("支付宝wap页面回跳")
|
||||
@ApiOperation("支付宝 wap 页面回跳")
|
||||
public String returnAliPayWapPayOrder(@PathVariable("channelId") Long channelId){
|
||||
//TODO 校验 是否支付宝调用。 可以根据 appId 跳转不同的页面
|
||||
return "支付成功";
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/return/alipay-qr/{channelId}")
|
||||
@ApiOperation("支付宝wap页面回跳")
|
||||
public String returnAliPayQrPayOrder(@PathVariable("channelId") Long channelId){
|
||||
//TODO @jason 校验 是否支付宝调用。 支付宝publickey 可以根据 appId 跳转不同的页面
|
||||
System.out.println("支付成功");
|
||||
return "支付成功";
|
||||
@RequestMapping("/notify/test")
|
||||
@ApiOperation("通知的测试接口")
|
||||
public String notifyTest() {
|
||||
// System.out.println(data);
|
||||
return "success";
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user