whycxzp
2023-06-25 ca3c7bac6c32443d54b5d717d82c0f0761e2f625
问题修复
1个文件已修改
10 ■■■■■ 已修改文件
src/main/java/com/whyc/service/SOPService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/SOPService.java
@@ -18,11 +18,9 @@
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;
@@ -311,7 +309,7 @@
        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);
@@ -320,7 +318,7 @@
        if(!fileTo.getParentFile().exists()){
            fileTo.getParentFile().mkdirs();
        }
        FileCopyUtils.copy(fileFrom,fileTo);
        FileCopyUtils.copy(fileFrom,fileTo);*/
        //新增的文件类型,追加到表中
        List<SOPFileType> typeList = new LinkedList<>();
@@ -339,6 +337,7 @@
            }
        }
        List<SOPFileType> recordListInDB = fileTypeService.getAllInDB(typeList);
        if(typeList.size()!=recordListInDB.size()) {
        List<SOPFileType> newRecordList = new LinkedList<>();
        List<String> uploadTypeStrList = typeList.stream().map(type -> type.getType1() + ";" + type.getType2()).collect(Collectors.toList());
@@ -354,7 +353,10 @@
                newRecordList.add(sopFileType);
            }
        }
            if (newRecordList.size() > 0) {
        fileTypeService.addBatch(newRecordList);
            }
        }
        return new Response().setII(1,"上传完成");
    }