开发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)); cell.setCellValue(ComparisonUtil.queryDictTextByKey("user_notification_mode", fs.getGzyhfs(), sysDictService));
String attStr = fs.getXgwj(); String attStr = fs.getXgwj();
List<AttachmentEO> attList = JSONArray.parseArray(attStr, AttachmentEO.class); if(StringUtils.isNotEmpty(attStr)){
if (ObjectUtils.isNotEmpty(attList)) { String[] strs = attStr.split(",");
for (AttachmentEO aeo : attList) { for (String str : strs) {
List<OSSFile> ossFileList = ossFileService.getFileInfos(aeo.getId()); List<OSSFile> ossFileList = ossFileService.getFileInfos(str);
for (OSSFile ossFile : ossFileList) { for (OSSFile ossFile : ossFileList) {
String filePath = ossFile.getUrl(); String filePath = ossFile.getUrl();
boolean b = CosBootUtil.doesObjectExist(filePath); boolean b = CosBootUtil.doesObjectExist(filePath);
@@ -187,7 +187,7 @@ public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBa
@Override @Override
public void exportData(String otaId, HttpServletResponse response, HttpServletRequest request) throws Exception { public void exportData(String otaId, HttpServletResponse response, HttpServletRequest request) throws Exception {
String cut = "cn"; 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 exportFile = ImportFileUtil.copyZip(ImportFileUtil.createMfileByFile(template), cut, uploadPath);
File sjmbcxFile = ImportFileUtil.findFile(exportFile, "升级目标车型.xlsx"); File sjmbcxFile = ImportFileUtil.findFile(exportFile, "升级目标车型.xlsx");
@@ -211,8 +211,8 @@ public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBa
otaBaSjSjfzbhService.exportData(sjfzbhFile, otaId, cut); otaBaSjSjfzbhService.exportData(sjfzbhFile, otaId, cut);
File fsFile = ImportFileUtil.findFile(exportFile, "用户告知内容及方式.xlsx"); File fsFile = ImportFileUtil.findFile(exportFile, "用户告知内容及方式.xlsx");
File fsAttFile = ImportFileUtil.findFile(exportFile, "用户告知内容及方式"); File fsAttFile = ImportFileUtil.findFoder(exportFile, "用户告知内容及方式");
otaBaSjGgnrfsService.exportData(sjfzbhFile, fsAttFile, otaId, cut); otaBaSjGgnrfsService.exportData(fsFile, fsAttFile, otaId, cut);
File qtFile = ImportFileUtil.findFile(exportFile, "其他升级任务信息.xlsx"); File qtFile = ImportFileUtil.findFile(exportFile, "其他升级任务信息.xlsx");
otaBaSjQtsjxxService.exportData(qtFile, otaId, cut); otaBaSjQtsjxxService.exportData(qtFile, otaId, cut);
@@ -292,10 +292,10 @@ public class OtaBaSjSjmbclServiceImpl extends ServiceImpl<OtaBaSjSjmbclMapper, O
cell.setCellValue(cl.getVinList()); cell.setCellValue(cl.getVinList());
String attStr = cl.getCsv(); String attStr = cl.getCsv();
List<AttachmentEO> attList = JSONArray.parseArray(attStr, AttachmentEO.class); if (StringUtils.isNotEmpty(attStr)) {
if (ObjectUtils.isNotEmpty(attList)) { String[] strs = attStr.split(",");
for (AttachmentEO aeo : attList) { for (String str : strs) {
List<OSSFile> ossFileList = ossFileService.getFileInfos(aeo.getId()); List<OSSFile> ossFileList = ossFileService.getFileInfos(str);
for (OSSFile ossFile : ossFileList) { for (OSSFile ossFile : ossFileList) {
String filePath = ossFile.getUrl(); String filePath = ossFile.getUrl();
boolean b = CosBootUtil.doesObjectExist(filePath); boolean b = CosBootUtil.doesObjectExist(filePath);
@@ -291,7 +291,7 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
} }
@Override @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); OtaBaSjSjyxpg pg = this.getByOtaId(otaId);
if (ObjectUtils.isNotEmpty(pg)) { if (ObjectUtils.isNotEmpty(pg)) {
Workbook wb = ImportFileUtil.readExcel(file); Workbook wb = ImportFileUtil.readExcel(file);
@@ -329,17 +329,15 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
row = s.getRow(10); row = s.getRow(10);
cell = row.getCell(1); cell = row.getCell(1);
cell.setCellValue(ComparisonUtil.queryDictTextByKey("package_test", pg.getSjbcs(), sysDictService)); cell.setCellValue(ComparisonUtil.queryDictTextByKey("package_test", pg.getSjbcs(), sysDictService));
row = s.getRow(9); row = s.getRow(11);
cell = row.getCell(1); cell = row.getCell(1);
cell.setCellValue(ImportFileUtil.getCellValueYesOrNoInt(pg.getAqkkx())); cell.setCellValue(ImportFileUtil.getCellValueYesOrNoInt(pg.getAqkkx()));
String attStr1 = pg.getBgfj();
String attStr = pg.getBgfj(); if (StringUtils.isNotEmpty(attStr1)) {
if(StringUtils.isNotEmpty(attStr)){ String[] strs = attStr1.split(",");
List<AttachmentEO> attList = JSONArray.parseArray(attStr, AttachmentEO.class); for (String str : strs) {
if (ObjectUtils.isNotEmpty(attList)) { List<OSSFile> ossFileList = ossFileService.getFileInfos(str);
for (AttachmentEO aeo : attList) {
List<OSSFile> ossFileList = ossFileService.getFileInfos(aeo.getId());
for (OSSFile ossFile : ossFileList) { for (OSSFile ossFile : ossFileList) {
String filePath = ossFile.getUrl(); String filePath = ossFile.getUrl();
boolean b = CosBootUtil.doesObjectExist(filePath); boolean b = CosBootUtil.doesObjectExist(filePath);
@@ -350,13 +348,11 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
} }
} }
} }
} String attStr2 = pg.getBgfj();
String attStr1 = pg.getBgfj(); if (StringUtils.isNotEmpty(attStr2)) {
if(StringUtils.isNotEmpty(attStr1)){ String[] strs = attStr2.split(",");
List<AttachmentEO> attList = JSONArray.parseArray(attStr1, AttachmentEO.class); for (String str : strs) {
if (ObjectUtils.isNotEmpty(attList)) { List<OSSFile> ossFileList = ossFileService.getFileInfos(str);
for (AttachmentEO aeo : attList) {
List<OSSFile> ossFileList = ossFileService.getFileInfos(aeo.getId());
for (OSSFile ossFile : ossFileList) { for (OSSFile ossFile : ossFileList) {
String filePath = ossFile.getUrl(); String filePath = ossFile.getUrl();
boolean b = CosBootUtil.doesObjectExist(filePath); boolean b = CosBootUtil.doesObjectExist(filePath);
@@ -367,8 +363,6 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
} }
} }
} }
}
wb.write(new FileOutputStream(file)); wb.write(new FileOutputStream(file));
wb.close(); wb.close();
} }