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

This commit is contained in:
高嵩
2023-03-30 01:31:35 +08:00
parent 9fdde4fe56
commit 08f238056c
@@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@@ -48,9 +49,6 @@ public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBa
@Autowired
private IOtaBaSjSjmbclService otaBaSjSjmbclService;
@Autowired
private IOtaBaCxAqcsService otaBaCxAqcsService;
@Autowired
private IOtaBaSjSjxtbhService otaBaSjSjxtbhService;
@@ -60,6 +58,9 @@ public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBa
@Autowired
private IOtaBaSjGgnrfsService otaBaSjGgnrfsService;
@Autowired
private IOtaBaSjSjyxpgService otaBaSjSjyxpgService;
/**
* 保存
@@ -170,7 +171,8 @@ public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBa
String otaId = mbcx.getOtaId();
if (StringUtils.isNotEmpty(otaId)) {
otaBaSjSjmbclService.parseFileList(fileList, otaId, cut);
otaBaCxAqcsService.parseFileList(fileList, otaId, cut);
otaBaSjSjmbcxService.parseFileList(fileList, otaId, cut);
otaBaSjSjyxpgService.parseFileList(fileList, otaId, cut);
otaBaSjSjxtbhService.parseFileList(fileList, otaId, cut);
otaBaSjSjfzbhService.parseFileList(fileList, otaId, cut);
otaBaSjGgnrfsService.parseFileList(fileList, otaId, cut);
@@ -181,6 +183,28 @@ public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBa
@Override
public void exportData(String otaId, HttpServletResponse response, HttpServletRequest request) throws Exception {
String cut = "cn";
File template = new File(templatePath + "在线升级活动备案.zip");
File exportFile = ImportFileUtil.copyZip(ImportFileUtil.createMfileByFile(template), cut, uploadPath);
File jbxxFile = ImportFileUtil.findFile(exportFile, "本次升级涉及的目标车辆.xlsx");
otaBaSjSjmbclService.exportData(jbxxFile, otaId, cut);
File sjmbcxFile = ImportFileUtil.findFile(exportFile, "升级目标车型.xlsx");
otaBaSjSjmbcxService.exportData(sjmbcxFile, otaId, cut);
File pgFile = ImportFileUtil.findFile(exportFile, "升级影响评估.docx");
otaBaSjSjyxpgService.exportData(pgFile, otaId, cut);
File sjSjxtbhFile = ImportFileUtil.findFile(exportFile, "本次升级的系统名称与变更参数.docx");
otaBaSjSjxtbhService.exportData(sjSjxtbhFile, otaId, cut);
File sjfzbhFile = ImportFileUtil.findFile(exportFile, "本次升级的驾驶辅助功能与参数变化.docx");
otaBaSjSjfzbhService.exportData(sjfzbhFile, otaId, cut);
String outPath = uploadPath + "/在线升级活动备案" + System.currentTimeMillis() + ".zip";
FileOutputStream fos1 = new FileOutputStream(outPath);
ImportFileUtil.toZip(exportFile.getCanonicalPath(), fos1, true);
ImportFileUtil.exportTemplate(response, outPath);
}
}