3 Commits 6b7edc7c01 ... bb324f8114

Author SHA1 Message Date
  heguanxun bb324f8114 Merge remote-tracking branch 'origin/master' 4 months ago
  heguanxun d6d1ff3231 企业台账新增产品信息表商品序号新增自动生成 4 months ago
  heguanxun ba661918f5 企业台账新增产品信息表商品序号新增自动生成 4 months ago

+ 34 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/qyrecordinfo/entity/BusinessIdGenerator.java

@@ -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());

+ 10 - 2
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/qyrecordinfo/service/impl/QyRecordInfoServiceImpl.java

@@ -121,8 +121,12 @@ public class QyRecordInfoServiceImpl extends ServiceImpl<QyRecordInfoMapper, QyR
             AtomicInteger i = new AtomicInteger();
             qyRecordProductAddParams.stream().forEach(item -> {
                 item.setQyRecordInfoId(qyRecordInfo.getId());
-                String ylCode = BusinessIdGenerator.generateBusinessId(i.get());
+                String ylCode = BusinessIdGenerator.generateBusinessIdForProductYl(i.get());
+                String ylCodeProduce = BusinessIdGenerator.generateBusinessIdForProduct(i.get());
+                String ylCodeProduceZz = BusinessIdGenerator.generateBusinessIdForProductZz(i.get());
                 item.setYlCode(ylCode);
+                item.setProductCode(ylCodeProduce);
+                item.setRecordNumber(ylCodeProduceZz);
                 i.getAndIncrement();
                 QyRecordProduct qyRecordProduct = BeanUtil.toBean(item, QyRecordProduct.class);
                 qyRecordProductService.save(qyRecordProduct);
@@ -202,8 +206,12 @@ public class QyRecordInfoServiceImpl extends ServiceImpl<QyRecordInfoMapper, QyR
             AtomicInteger i = new AtomicInteger();
             productEditParams.stream().forEach(item -> {
                 item.setQyRecordInfoId(qyRecordInfo.getId());
-                String ylCode = BusinessIdGenerator.generateBusinessId(i.get());
+                String ylCode = BusinessIdGenerator.generateBusinessIdForProductYl(i.get());
+                String ylCodeProduce = BusinessIdGenerator.generateBusinessIdForProduct(i.get());
+                String ylCodeProduceZz = BusinessIdGenerator.generateBusinessIdForProductZz(i.get());
                 item.setYlCode(ylCode);
+                item.setProductCode(ylCodeProduce);
+                item.setRecordNumber(ylCodeProduceZz);
                 QyRecardBody qyRecardBody = BeanUtil.toBean(item, QyRecardBody.class);
                 qyRecardBody.setQyRecordInfoId(qyRecordInfo.getId());
                 qyRecardBody.setId(null);