|
@@ -6,7 +6,9 @@ import java.util.Date;
|
|
|
public class BusinessIdGenerator {
|
|
|
|
|
|
private static final String PREFIX = "EPD";
|
|
|
+ private static final String PREFIX_P = "P";
|
|
|
private static final String FIXED_MIDDLE_PART = "000";
|
|
|
+ private static final String FIXED_MIDDLE_PART_PRODUCT = "00";
|
|
|
private static final int SERIAL_NUMBER_LENGTH = 1;
|
|
|
|
|
|
private static final String PREFIX_ = "LHTWL";
|
|
@@ -27,6 +29,38 @@ public class BusinessIdGenerator {
|
|
|
return businessId.toString();
|
|
|
}
|
|
|
|
|
|
+ //商品序号
|
|
|
+ public static String generateBusinessIdForProduct(int currentSerialNumber) {
|
|
|
+ StringBuilder businessId = new StringBuilder();
|
|
|
+ businessId.append(PREFIX_P);
|
|
|
+ businessId.append(getDatePart());
|
|
|
+ businessId.append(FIXED_MIDDLE_PART_PRODUCT);
|
|
|
+ businessId.append(getSerialNumberPart(currentSerialNumber));
|
|
|
+ System.out.println(businessId);
|
|
|
+ return businessId.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ //产品录入编号
|
|
|
+ public static String generateBusinessIdForProductYl(int currentSerialNumber) {
|
|
|
+ StringBuilder businessId = new StringBuilder();
|
|
|
+ businessId.append(getDatePart());
|
|
|
+ businessId.append(FIXED_MIDDLE_PART);
|
|
|
+ businessId.append(getSerialNumberPart(currentSerialNumber));
|
|
|
+ System.out.println(businessId);
|
|
|
+ return businessId.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ //产品加工增值
|
|
|
+ public static String generateBusinessIdForProductZz(int currentSerialNumber) {
|
|
|
+ StringBuilder businessId = new StringBuilder();
|
|
|
+ businessId.append("JZ");
|
|
|
+ businessId.append(getDatePart());
|
|
|
+ businessId.append(FIXED_MIDDLE_PART);
|
|
|
+ businessId.append(getSerialNumberPart(currentSerialNumber));
|
|
|
+ System.out.println(businessId);
|
|
|
+ return businessId.toString();
|
|
|
+ }
|
|
|
+
|
|
|
private static String getDatePart() {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
|
|
|
return sdf.format(new Date());
|