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

This commit is contained in:
高嵩
2023-03-30 22:12:17 +08:00
parent 419a381fa4
commit aca5d3b1ff
4 changed files with 38 additions and 44 deletions
@@ -277,10 +277,10 @@ public class OtaBaSjGgnrfsServiceImpl extends ServiceImpl<OtaBaSjGgnrfsMapper, O
cell.setCellValue(ComparisonUtil.queryDictTextByKey("user_notification_mode", fs.getGzyhfs(), sysDictService));
String attStr = fs.getXgwj();
List<AttachmentEO> attList = JSONArray.parseArray(attStr, AttachmentEO.class);
if (ObjectUtils.isNotEmpty(attList)) {
for (AttachmentEO aeo : attList) {
List<OSSFile> ossFileList = ossFileService.getFileInfos(aeo.getId());
if(StringUtils.isNotEmpty(attStr)){
String[] strs = attStr.split(",");
for (String str : strs) {
List<OSSFile> ossFileList = ossFileService.getFileInfos(str);
for (OSSFile ossFile : ossFileList) {
String filePath = ossFile.getUrl();
boolean b = CosBootUtil.doesObjectExist(filePath);
@@ -187,7 +187,7 @@ 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 template = new File(templatePath + "在线升级活动备案导出.zip");
File exportFile = ImportFileUtil.copyZip(ImportFileUtil.createMfileByFile(template), cut, uploadPath);
File sjmbcxFile = ImportFileUtil.findFile(exportFile, "升级目标车型.xlsx");
@@ -211,8 +211,8 @@ public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBa
otaBaSjSjfzbhService.exportData(sjfzbhFile, otaId, cut);
File fsFile = ImportFileUtil.findFile(exportFile, "用户告知内容及方式.xlsx");
File fsAttFile = ImportFileUtil.findFile(exportFile, "用户告知内容及方式");
otaBaSjGgnrfsService.exportData(sjfzbhFile, fsAttFile, otaId, cut);
File fsAttFile = ImportFileUtil.findFoder(exportFile, "用户告知内容及方式");
otaBaSjGgnrfsService.exportData(fsFile, fsAttFile, otaId, cut);
File qtFile = ImportFileUtil.findFile(exportFile, "其他升级任务信息.xlsx");
otaBaSjQtsjxxService.exportData(qtFile, otaId, cut);
@@ -292,10 +292,10 @@ public class OtaBaSjSjmbclServiceImpl extends ServiceImpl<OtaBaSjSjmbclMapper, O
cell.setCellValue(cl.getVinList());
String attStr = cl.getCsv();
List<AttachmentEO> attList = JSONArray.parseArray(attStr, AttachmentEO.class);
if (ObjectUtils.isNotEmpty(attList)) {
for (AttachmentEO aeo : attList) {
List<OSSFile> ossFileList = ossFileService.getFileInfos(aeo.getId());
if (StringUtils.isNotEmpty(attStr)) {
String[] strs = attStr.split(",");
for (String str : strs) {
List<OSSFile> ossFileList = ossFileService.getFileInfos(str);
for (OSSFile ossFile : ossFileList) {
String filePath = ossFile.getUrl();
boolean b = CosBootUtil.doesObjectExist(filePath);
@@ -291,7 +291,7 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
}
@Override
public void exportData(File file, File attFile1, File attFile2,String otaId, String cut) throws Exception {
public void exportData(File file, File attFile1, File attFile2, String otaId, String cut) throws Exception {
OtaBaSjSjyxpg pg = this.getByOtaId(otaId);
if (ObjectUtils.isNotEmpty(pg)) {
Workbook wb = ImportFileUtil.readExcel(file);
@@ -329,46 +329,40 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
row = s.getRow(10);
cell = row.getCell(1);
cell.setCellValue(ComparisonUtil.queryDictTextByKey("package_test", pg.getSjbcs(), sysDictService));
row = s.getRow(9);
row = s.getRow(11);
cell = row.getCell(1);
cell.setCellValue(ImportFileUtil.getCellValueYesOrNoInt(pg.getAqkkx()));
String attStr = pg.getBgfj();
if(StringUtils.isNotEmpty(attStr)){
List<AttachmentEO> attList = JSONArray.parseArray(attStr, AttachmentEO.class);
if (ObjectUtils.isNotEmpty(attList)) {
for (AttachmentEO aeo : attList) {
List<OSSFile> ossFileList = ossFileService.getFileInfos(aeo.getId());
for (OSSFile ossFile : ossFileList) {
String filePath = ossFile.getUrl();
boolean b = CosBootUtil.doesObjectExist(filePath);
if (b) {
InputStream download = CosBootUtil.download(filePath);
ImportFileUtil.writeToLocal(attFile1.getCanonicalPath() + "/" + ossFile.getFileName(), download);
}
}
}
}
}
String attStr1 = pg.getBgfj();
if(StringUtils.isNotEmpty(attStr1)){
List<AttachmentEO> attList = JSONArray.parseArray(attStr1, AttachmentEO.class);
if (ObjectUtils.isNotEmpty(attList)) {
for (AttachmentEO aeo : attList) {
List<OSSFile> ossFileList = ossFileService.getFileInfos(aeo.getId());
for (OSSFile ossFile : ossFileList) {
String filePath = ossFile.getUrl();
boolean b = CosBootUtil.doesObjectExist(filePath);
if (b) {
InputStream download = CosBootUtil.download(filePath);
ImportFileUtil.writeToLocal(attFile2.getCanonicalPath() + "/" + ossFile.getFileName(), download);
}
if (StringUtils.isNotEmpty(attStr1)) {
String[] strs = attStr1.split(",");
for (String str : strs) {
List<OSSFile> ossFileList = ossFileService.getFileInfos(str);
for (OSSFile ossFile : ossFileList) {
String filePath = ossFile.getUrl();
boolean b = CosBootUtil.doesObjectExist(filePath);
if (b) {
InputStream download = CosBootUtil.download(filePath);
ImportFileUtil.writeToLocal(attFile1.getCanonicalPath() + "/" + ossFile.getFileName(), download);
}
}
}
}
String attStr2 = pg.getBgfj();
if (StringUtils.isNotEmpty(attStr2)) {
String[] strs = attStr2.split(",");
for (String str : strs) {
List<OSSFile> ossFileList = ossFileService.getFileInfos(str);
for (OSSFile ossFile : ossFileList) {
String filePath = ossFile.getUrl();
boolean b = CosBootUtil.doesObjectExist(filePath);
if (b) {
InputStream download = CosBootUtil.download(filePath);
ImportFileUtil.writeToLocal(attFile2.getCanonicalPath() + "/" + ossFile.getFileName(), download);
}
}
}
}
wb.write(new FileOutputStream(file));
wb.close();
}