| | |
| | | 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; |
| | |
| | | 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); |
| | |
| | | if(!fileTo.getParentFile().exists()){ |
| | | fileTo.getParentFile().mkdirs(); |
| | | } |
| | | FileCopyUtils.copy(fileFrom,fileTo);*/ |
| | | FileCopyUtils.copy(fileFrom,fileTo); |
| | | |
| | | //新增的文件类型,追加到表中 |
| | | List<SOPFileType> typeList = new LinkedList<>(); |