Bladeren bron

企业台账-料件信息-新增商品序号,修复存在多个料件情况下商品序号一致的问题

heguanxun 2 maanden geleden
bovenliggende
commit
ebf9509ded

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

@@ -124,7 +124,7 @@ public class QyRecordInfoServiceImpl extends ServiceImpl<QyRecordInfoMapper, QyR
             qyRecardBodyAddParams.stream().forEach(qyRecardBodyAddParam -> {
                 qyRecardBodyAddParam.setQyRecordInfoId(qyRecordInfo.getId());
                 QyRecardBody qyRecardBody = BeanUtil.toBean(qyRecardBodyAddParam, QyRecardBody.class);
-                String productNum = BusinessIdGenerator.generateBusinessIdForProductNum(i.get());
+                String productNum = BusinessIdGenerator.generateBusinessIdForProductNum(i.incrementAndGet());
                 qyRecardBody.setQyRecordInfoId(qyRecordInfo.getId());
                 qyRecardBody.setProductNum(productNum);
                 qyRecardBodyService.save(qyRecardBody);
@@ -210,11 +210,11 @@ public class QyRecordInfoServiceImpl extends ServiceImpl<QyRecordInfoMapper, QyR
         //料件信息
         List<QyRecardBodyEditParam> bodyAddParams = qyRecordInfoEditParam.getQyRecardBodyEditParams();
         if (CollectionUtil.isNotEmpty(bodyAddParams)){
-            AtomicInteger i = new AtomicInteger();
+            AtomicInteger i = new AtomicInteger(0);
             bodyAddParams.stream().forEach(qyRecardBodyAddParam -> {
                 qyRecardBodyAddParam.setQyRecordInfoId(qyRecordInfo.getId());
                 QyRecardBody qyRecardBody = BeanUtil.toBean(qyRecardBodyAddParam, QyRecardBody.class);
-                String productNum = BusinessIdGenerator.generateBusinessIdForProductNum(i.get());
+                String productNum = BusinessIdGenerator.generateBusinessIdForProductNum(i.incrementAndGet());
                 qyRecardBody.setQyRecordInfoId(qyRecordInfo.getId());
                 qyRecardBody.setProductNum(productNum);
                 qyRecardBody.setId(null);