package com.hzs.common.core.utils;

/**
 * 生成指定规则的编号
 */
public class CreateNormsCodeUtils {

    /**
     * 产品前缀
     */
    private static final String CP = "CP";
    /**
     * 商品前缀
     */
    private static final String SP = "SP";

    /**
     * 生成产品规则的编号
     *
     * @return
     */
    public static String createProductCode(String lastProductCode) {
        if (StringUtils.isNotBlank(lastProductCode)) {
            return SP + System.currentTimeMillis();
        } else {
            String code = "000001";
            return CP + code;
        }
    }

    /**
     * 生成商品规则的编号
     *
     * @return
     */
    public static String createWaresCode(String lastWaresCode) {
        if (StringUtils.isNotBlank(lastWaresCode)) {
            return SP + System.currentTimeMillis();
        } else {
            String code = "000001";
            return SP + code;
        }
    }

}
