Browse Source

企业台账-料件信息-新增商品序号

heguanxun 3 months ago
parent
commit
175681f17b

+ 11 - 5
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/qyrecardbody/entity/QyRecardBody.java

@@ -15,6 +15,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
 import com.baomidou.mybatisplus.annotation.*;
 import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
 import lombok.Getter;
 import lombok.Setter;
 import java.math.BigDecimal;
@@ -45,15 +46,20 @@ public class QyRecardBody {
     private String qyRecordInfoId;
 
     /** 商品编码 */
-    @Schema(description = "商品编码")
+    @Schema(description = "商品编码", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotBlank(message = "productNum不能为空")
+    private String productNum;
+
+    /** 料件编码 */
+    @Schema(description = "料件编码")
     @ColumnWidth(12)
-    @ExcelProperty(index = 2,value = "商品编码")
+    @ExcelProperty(index = 2,value = "料件编码")
     private String productCode;
 
-    /** 商品名称 */
-    @Schema(description = "商品名称")
+    /** 料件名称 */
+    @Schema(description = "料件名称")
     @ColumnWidth(12)
-    @ExcelProperty(index = 3,value = "商品名称")
+    @ExcelProperty(index = 3,value = "料件名称")
     private String productName;
 
     /** 规格型号 */

+ 5 - 1
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/qyrecardbody/param/QyRecardBodyAddParam.java

@@ -41,10 +41,14 @@ public class QyRecardBodyAddParam {
 
     /** 商品编码 */
     @Schema(description = "商品编码", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String productNum;
+
+    /** 料件编码 */
+    @Schema(description = "料件编码", requiredMode = Schema.RequiredMode.REQUIRED)
     @NotBlank(message = "productCode不能为空")
     private String productCode;
 
-    /** 商品名称 */
+    /** 料件名称 */
     @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED)
     @NotBlank(message = "productName不能为空")
     private String productName;

+ 3 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/qyrecardbody/param/QyRecardBodyEditParam.java

@@ -39,6 +39,9 @@ public class QyRecardBodyEditParam {
     /** 企业备案信息 */
     @Schema(description = "企业备案信息")
     private String qyRecordInfoId;
+    /** 商品编码 */
+    @Schema(description = "商品编码", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String productNum;
 
     /** 商品编码 */
     @Schema(description = "商品编码", requiredMode = Schema.RequiredMode.REQUIRED)

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

@@ -47,6 +47,17 @@ public class BusinessIdGenerator {
         return businessId.toString();
     }
 
+    //料件-商品序号
+    public static String generateBusinessIdForProductNum(int currentSerialNumber) {
+        StringBuilder businessId = new StringBuilder();
+        businessId.append("LP");
+        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();

+ 3 - 3
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/qyrecordinfo/param/QyRecordInfoAddParam.java

@@ -98,15 +98,15 @@ public class QyRecordInfoAddParam {
     @NotBlank(message = "status不能为空")
     private String status;
 
-    /** 企业备案信息主体*/
+    /** 料件信息*/
     @Schema(description = "料件信息", requiredMode = Schema.RequiredMode.REQUIRED)
     private List<QyRecardBodyAddParam> qyRecardBodyAddParams;
 
-    /** 企业备案信息附件*/
+    /** 附件信息*/
     @Schema(description = "附件信息", requiredMode = Schema.RequiredMode.REQUIRED)
     private List<QyRecordAttachmentAddParam> qyRecordAttachmentAddParams;
 
-    /** 企业备案商品附件*/
+    /** 商品信息*/
     @Schema(description = "商品信息", requiredMode = Schema.RequiredMode.REQUIRED)
     private List<QyRecordProductAddParam> qyRecordProductAddParams;
 }

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

@@ -120,10 +120,13 @@ public class QyRecordInfoServiceImpl extends ServiceImpl<QyRecordInfoMapper, QyR
         List<QyRecardBodyAddParam> qyRecardBodyAddParams = qyRecordInfoAddParam.getQyRecardBodyAddParams();
         //1、料件信息
         if(CollectionUtil.isNotEmpty(qyRecardBodyAddParams)){
+            AtomicInteger i = new AtomicInteger();
             qyRecardBodyAddParams.stream().forEach(qyRecardBodyAddParam -> {
                 qyRecardBodyAddParam.setQyRecordInfoId(qyRecordInfo.getId());
                 QyRecardBody qyRecardBody = BeanUtil.toBean(qyRecardBodyAddParam, QyRecardBody.class);
+                String productNum = BusinessIdGenerator.generateBusinessIdForProductNum(i.get());
                 qyRecardBody.setQyRecordInfoId(qyRecordInfo.getId());
+                qyRecardBody.setProductNum(productNum);
                 qyRecardBodyService.save(qyRecardBody);
             });
         }