开发OTA备案工具-车辆升级

This commit is contained in:
高嵩
2023-03-30 18:24:12 +08:00
parent b3a23ab01a
commit ce79a5cd27
2 changed files with 4 additions and 1 deletions
@@ -9,6 +9,7 @@ import com.jero.modules.ota.entity.OtaBaCxLsjl;
import com.jero.modules.ota.mapper.OtaBaCxListMapper; import com.jero.modules.ota.mapper.OtaBaCxListMapper;
import com.jero.modules.ota.service.*; import com.jero.modules.ota.service.*;
import com.jero.modules.ota.utils.ImportFileUtil; import com.jero.modules.ota.utils.ImportFileUtil;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.logging.Log; import org.apache.ibatis.logging.Log;
@@ -214,6 +215,7 @@ public class OtaBaCxListServiceImpl extends ServiceImpl<OtaBaCxListMapper, OtaBa
String outPath = uploadPath + "/车型及功能备案" + System.currentTimeMillis() + ".zip"; String outPath = uploadPath + "/车型及功能备案" + System.currentTimeMillis() + ".zip";
//FileUtils.forceDelete(template);
FileOutputStream fos1 = new FileOutputStream(outPath); FileOutputStream fos1 = new FileOutputStream(outPath);
ImportFileUtil.toZip(exportFile.getCanonicalPath(), fos1, true); ImportFileUtil.toZip(exportFile.getCanonicalPath(), fos1, true);
ImportFileUtil.exportTemplate(response, outPath); ImportFileUtil.exportTemplate(response, outPath);
@@ -77,12 +77,13 @@ public class ImportFileUtil {
saveDirectory.mkdir(); saveDirectory.mkdir();
} }
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path + File.separator + file.getOriginalFilename())); FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path + File.separator + file.getOriginalFilename()));
//解压缩 //解压缩
String zipEntryName = ""; String zipEntryName = "";
if (str.equals("zip")) { if (str.equals("zip")) {
zipEntryName = FileUnZip.unZipFiles(path + File.separator + file.getOriginalFilename(), path); zipEntryName = FileUnZip.unZipFiles(path + File.separator + file.getOriginalFilename(), path);
} }
FileUtils.forceDelete(new File(path + File.separator + file.getOriginalFilename()));
return new File(path); return new File(path);
} }