package com.hzs.common.core.utils;

/**
 * @Description: 生成指定规则的编号
 * @Author: yuhui
 * @Time: 2022/10/27 17:19
 * @Classname: CreateNormsCodeUtils
 * @PackageName: 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)){
//            String code = lastProductCode.substring(2);
//            int numberCode = Integer.parseInt(code) + 1;
//            return String.format(CP + "%05d", numberCode);
            return SP+System.currentTimeMillis();
        }else {
            String code = "00001";
            return CP+code;
        }
    }

    /**
     * 生成商品规则的编号
     * @return
     */
    public static String  createWaresCode(String lastWaresCode){
        if (StringUtils.isNotBlank(lastWaresCode)){
     //       String code = lastWaresCode.replace(SP, "");
    //        String code = DateUtils.parseDateToFormat(DateUtils.YAMMERERS, DateUtils.currentDate());
        //    int numberCode = Integer.parseInt(code) ;
         //   return String.format(SP + "%05d", numberCode);
            return SP+System.currentTimeMillis();
        }else {
            String code = "00001";
            return SP+code;
        }
    }

}
