package com.cdzy.user; import com.cdzy.user.enums.EbikePaymentMethod; import com.cdzy.user.enums.EbikePaymentTradeStatus; import com.cdzy.user.mapper.EbikePaymentMapper; import com.cdzy.user.model.entity.EbikePayment; import com.fasterxml.jackson.core.JsonProcessingException; import com.mybatisflex.core.keygen.impl.SnowFlakeIDKeyGenerator; import jakarta.annotation.Resource; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import java.math.BigDecimal; import java.time.LocalDateTime; @SpringBootTest class EbikeUserApplicationTests { @Resource private EbikePaymentMapper ebikePaymentMapper; private static final SnowFlakeIDKeyGenerator snowFlakeIDKeyGenerator = new SnowFlakeIDKeyGenerator(); @Test void contextLoads() throws JsonProcessingException { EbikePayment payment = EbikePayment.builder() .orderId(346502255632748545L) .costPrice(BigDecimal.ONE) .paymentMethod(EbikePaymentMethod.WECHAT) .tradeId(String.valueOf(snowFlakeIDKeyGenerator.nextId())) .currency("CNY") .userId(344326061705474047L) .operatorId(11L) .createTime(LocalDateTime.now()) .tradeStatus(EbikePaymentTradeStatus.NO_PAYMENT) .build(); ebikePaymentMapper.insert(payment); } }