支付的 code review

This commit is contained in:
YunaiV
2021-11-05 08:10:07 +08:00
parent 26798a8816
commit 6265e4a736
8 changed files with 26 additions and 25 deletions

View File

@ -12,6 +12,7 @@ import javax.validation.constraints.NotNull;
@Data
public class PayMerchantBaseVO {
// TODO @aquanno 应该不允许修改。啊哈哈,我的原型没画对
@ApiModelProperty(value = "商户号")
private String no;

View File

@ -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);

View File

@ -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");
}