From 92d8d06d8ae38c407715a5e9389691b446413e0a Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 27 三月 2026 10:06:09 +0800
Subject: [PATCH] yys 1.生产逻辑修改
---
src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
index 26715f3..51437ec 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
@@ -16,14 +16,19 @@
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.other.mapper.TempFileMapper;
+import com.ruoyi.other.service.impl.TempFileServiceImpl;
+import com.ruoyi.sales.mapper.CommonFileMapper;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import com.ruoyi.sales.service.impl.CommonFileServiceImpl;
import lombok.AllArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
+import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.AbstractMap;
@@ -45,9 +50,12 @@
private final ProductMapper productMapper;
private final SalesLedgerProductMapper salesLedgerProductMapper;
private ProductModelMapper productModelMapper;
+ private final CommonFileServiceImpl commonFileService;
+
+ private final TempFileServiceImpl tempFileService;
@Override
- public int addOrEditProductModel(ProductModelDto productModelDto) {
+ public int addOrEditProductModel(ProductModelDto productModelDto) throws IOException {
if(StringUtils.isEmpty(productModelDto.getProductName())){
throw new RuntimeException("浜у搧鍚嶇О涓嶈兘涓虹┖");
}
@@ -63,16 +71,23 @@
ProductModel productModel = new ProductModel();
BeanUtils.copyProperties(productModelDto,productModel);
productModel.setProductId(product.getId());
- return productModelMapper.insert(productModel);
+ productModelMapper.insert(productModel);
+ if(CollectionUtils.isNotEmpty(productModelDto.getTempFileIds())){
+ commonFileService.migrateTempFilesToFormal(productModel.getId(), productModelDto.getTempFileIds());
+ }
+ return 1;
} else {
Product product1 = productMapper.selectById(productModelDto.getProductId());
if(product1 != null){
product1.setProductName(productModelDto.getProductName());
productMapper.updateById(product1);
}
-
+ if(CollectionUtils.isNotEmpty(productModelDto.getTempFileIds())){
+ commonFileService.migrateTempFilesToFormal(productModelDto.getId(), productModelDto.getTempFileIds());
+ }
return productModelMapper.updateById(productModelDto);
}
+
}
@@ -116,11 +131,6 @@
try {
ExcelUtil<ProductModelExcelCopyDto> productModelExcelUtil = new ExcelUtil<>(ProductModelExcelCopyDto.class);
List<ProductModelExcelCopyDto> productModelList = productModelExcelUtil.importExcel(file.getInputStream());
-// List<Product> productList = productMapper.selectList(new LambdaQueryWrapper<Product>()
-// .isNull(Product::getParentId));
-// if(CollectionUtils.isEmpty(productList)) {
-// throw new RuntimeException("璇峰厛娣诲姞鐖剁骇浜у搧");
-// }
if(CollectionUtils.isNotEmpty(productModelList)){
// 2. 鎸変骇鍝佸悕绉�,鍥剧焊缂栧彿鍒嗙粍
Map<Map.Entry<String, String>, List<ProductModelExcelCopyDto>> groupedByProductNameAndDrawingNumber =
--
Gitblit v1.9.3