Browse Source

企业台账新增产品信息表

heguanxun 4 months ago
parent
commit
0204461632

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

@@ -28,13 +28,12 @@ import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
 import vip.xiaonuo.biz.modular.qyrecardbody.entity.QyRecardBody;
 import vip.xiaonuo.biz.modular.qyrecardbody.param.QyRecardBodyAddParam;
 import vip.xiaonuo.biz.modular.qyrecardbody.param.QyRecardBodyEditParam;
-import vip.xiaonuo.biz.modular.qyrecardbody.param.QyRecardBodyIdParam;
 import vip.xiaonuo.biz.modular.qyrecardbody.service.QyRecardBodyService;
 import vip.xiaonuo.biz.modular.qyrecordattachment.entity.QyRecordAttachment;
 import vip.xiaonuo.biz.modular.qyrecordattachment.param.QyRecordAttachmentAddParam;
 import vip.xiaonuo.biz.modular.qyrecordattachment.param.QyRecordAttachmentEditParam;
-import vip.xiaonuo.biz.modular.qyrecordattachment.param.QyRecordAttachmentIdParam;
 import vip.xiaonuo.biz.modular.qyrecordattachment.service.QyRecordAttachmentService;
+import vip.xiaonuo.biz.modular.qyrecordinfo.entity.BusinessIdGenerator;
 import vip.xiaonuo.biz.modular.qyrecordinfochecklist.entity.QyRecordInfoCheckList;
 import vip.xiaonuo.biz.modular.qyrecordinfochecklist.service.QyRecordInfoCheckListService;
 import vip.xiaonuo.biz.modular.qyrecordproduct.entity.QyRecordProduct;
@@ -55,7 +54,7 @@ import vip.xiaonuo.biz.modular.qyrecordinfo.service.QyRecordInfoService;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.stream.Collectors;
+import java.util.concurrent.atomic.AtomicInteger;
 
 /**
  * 企业备案信息Service接口实现类
@@ -119,8 +118,12 @@ public class QyRecordInfoServiceImpl extends ServiceImpl<QyRecordInfoMapper, QyR
         //2、商品信息
         List<QyRecordProductAddParam> qyRecordProductAddParams = qyRecordInfoAddParam.getQyRecordProductAddParams();
         if(CollectionUtil.isNotEmpty(qyRecordProductAddParams)){
+            AtomicInteger i = new AtomicInteger();
             qyRecordProductAddParams.stream().forEach(item -> {
                 item.setQyRecordInfoId(qyRecordInfo.getId());
+                String ylCode = BusinessIdGenerator.generateBusinessId(i.get());
+                item.setYlCode(ylCode);
+                i.getAndIncrement();
                 QyRecordProduct qyRecordProduct = BeanUtil.toBean(item, QyRecordProduct.class);
                 qyRecordProductService.save(qyRecordProduct);
             });
@@ -196,12 +199,17 @@ public class QyRecordInfoServiceImpl extends ServiceImpl<QyRecordInfoMapper, QyR
 
         List<QyRecordProductEditParam> productEditParams = qyRecordInfoEditParam.getQyRecordProductAddParams();
         if (CollectionUtil.isNotEmpty(productEditParams)){
+            AtomicInteger i = new AtomicInteger();
             productEditParams.stream().forEach(item -> {
                 item.setQyRecordInfoId(qyRecordInfo.getId());
+                String ylCode = BusinessIdGenerator.generateBusinessId(i.get());
+                item.setYlCode(ylCode);
                 QyRecardBody qyRecardBody = BeanUtil.toBean(item, QyRecardBody.class);
                 qyRecardBody.setQyRecordInfoId(qyRecordInfo.getId());
                 qyRecardBody.setId(null);
                 qyRecardBodyService.save(qyRecardBody);
+                i.getAndIncrement();
+
             });
         }