package com.zksy.utils;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Random;

/**
 * @author Administrator
 * @version 1.0
 * @project enterprise-assets-service
 * @description 工具类
 * @date 2025/7/8 14:39:32
 */
public class util {
    public static String generateAssetNumber() {
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
        String timePart = now.format(formatter);

        // 生成3位随机数
        Random random = new Random();
        int randomNum = random.nextInt(900) + 100; // 范围是100-999

        // 组合成资产编号
        return timePart + randomNum;
    }
}
