whycxzp
2023-06-25 19e5ccb1aee7c0e0d308386e03cad72bf4997d0d
问题修复
1个文件已修改
12 ■■■■■ 已修改文件
src/main/java/com/whyc/service/SOPService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/SOPService.java
@@ -18,9 +18,11 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
@@ -306,10 +308,12 @@
        fileUrlTemp = fileUrlTemp.replace("sop_submit", "sop");
        sop.setFileUrl(fileUrlTemp);
        mapper.insert(sop);
        sopProductList.forEach(product -> product.setSopId(sop.getId()));
        productService.insertBatch(sopProductList);
        if(sopProductList.size()>0) {
            sopProductList.forEach(product -> product.setSopId(sop.getId()));
            productService.insertBatch(sopProductList);
        }
        //文件转移
        /*String fileUrl = sop.getFileUrl();
        String fileUrl = sop.getFileUrl();
        String projectDir = CommonUtil.getProjectDir();
        String filePathFrom = projectDir + File.separator + fileUrl.replace("sop","sop_submit");
        File fileFrom = new File(filePathFrom);
@@ -318,7 +322,7 @@
        if(!fileTo.getParentFile().exists()){
            fileTo.getParentFile().mkdirs();
        }
        FileCopyUtils.copy(fileFrom,fileTo);*/
        FileCopyUtils.copy(fileFrom,fileTo);
        //新增的文件类型,追加到表中
        List<SOPFileType> typeList = new LinkedList<>();