开发OTA备案工具-车辆升级
This commit is contained in:
+2
@@ -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);
|
||||||
|
|||||||
+2
-1
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user