BatchServiceTest.java 1.22 KB
package com.dituhui.pea.pre;


import cn.hutool.core.util.IdUtil;
import com.dituhui.pea.pre.service.BatchService;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
//import JpaTransactionManager;

import java.sql.SQLException;

@Slf4j
@SpringBootTest
public class BatchServiceTest {

    @Autowired
    BatchService batchService;

    String groupId = "gsuzhou";
    String day = "2023-07-05";

    @Test
    public void test1() {

        log.info("init");
        try {
            batchService.buildBatchNo(groupId, "2023-07-04");
            batchService.buildBatchNo(groupId, "2023-07-05");
            batchService.buildBatchNo(groupId, "2023-07-06");
            batchService.buildBatchNo(groupId, "2023-07-07");

        } catch (SQLException e) {
            log.info("error %s", e);
            throw new RuntimeException(e);
        }
        log.info("done");
    }


    @Test
    public void test2() {
        log.info("init");
        for (int i = 0; i < 100; i++) {

            String orderNO= IdUtil.getSnowflake().nextIdStr();
            log.info("oid:{}", orderNO);
        }
    }
}