修改OTA
This commit is contained in:
+1
-1
@@ -301,7 +301,7 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
|
||||
|
||||
row = s.getRow(3);
|
||||
cell = row.getCell(1);
|
||||
cell.setCellValue(jbxx.getCplb());
|
||||
cell.setCellValue(ComparisonUtil.queryDictTextByKey("product_category", jbxx.getCplb(), sysDictService));
|
||||
row = s.getRow(4);
|
||||
cell = row.getCell(1);
|
||||
cell.setCellValue(jbxx.getGgpc());
|
||||
|
||||
+2
-2
@@ -288,7 +288,7 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
|
||||
cell = row.getCell(1);
|
||||
str = ImportFileUtil.getCellValue(cell, wb);
|
||||
String[] strs = str.split(",");
|
||||
otaBaCxList.setZxsjjsfj(ImportFileUtil.uploadFiles(attFile, strs, ossFileService, errMsg, "证明材料", cut));
|
||||
otaBaCxList.setZxsjjsfj(ImportFileUtil.uploadFiles(attFile, strs, ossFileService, errMsg, "证明材料", cut, i + 1));
|
||||
otaBaCxListService.editById(otaBaCxList);
|
||||
}
|
||||
break;
|
||||
@@ -351,7 +351,7 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
|
||||
cell = row.createCell(2);
|
||||
cell.setCellValue(ImportFileUtil.getCellValueYesOrNo(mccs.getSfksj()));
|
||||
cell = row.createCell(3);
|
||||
cell.setCellValue(mccs.getJszdhjb());
|
||||
cell.setCellValue(ComparisonUtil.queryDictTextByKey("driving_automation_level", mccs.getJszdhjb(), sysDictService));
|
||||
cell = row.createCell(4);
|
||||
cell.setCellValue(mccs.getSjggcs());
|
||||
cell = row.createCell(5);
|
||||
|
||||
+2
-2
@@ -357,7 +357,7 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
|
||||
cell = row.getCell(1);
|
||||
str = ImportFileUtil.getCellValue(cell, wb);
|
||||
String[] strs = str.split(",");
|
||||
otaBaCxList.setZxsjxtfj(ImportFileUtil.uploadFiles(attFile, strs, ossFileService, errMsg, "证明材料", cut));
|
||||
otaBaCxList.setZxsjxtfj(ImportFileUtil.uploadFiles(attFile, strs, ossFileService, errMsg, "证明材料", cut, i + 1));
|
||||
otaBaCxListService.editById(otaBaCxList);
|
||||
}
|
||||
break;
|
||||
@@ -374,7 +374,7 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
|
||||
mssc.setSjbgcs(ImportFileUtil.getCellValue(cell, wb));
|
||||
cell = row.getCell(3);
|
||||
String[] strs = ImportFileUtil.getCellValue(cell, wb).split(",");
|
||||
mssc.setTpt(ImportFileUtil.uploadFiles(attFile, strs, ossFileService, errMsg, "系统电子控制器架构拓扑图", cut));
|
||||
mssc.setTpt(ImportFileUtil.uploadFiles(attFile, strs, ossFileService, errMsg, "系统电子控制器架构拓扑图", cut, i + 1));
|
||||
cell = row.getCell(4);
|
||||
mssc.setKzqmc(ImportFileUtil.getCellValue(cell, wb));
|
||||
cell = row.getCell(5);
|
||||
|
||||
+1
@@ -152,6 +152,7 @@ public class OtaBaCxQtServiceImpl extends ServiceImpl<OtaBaCxQtMapper, OtaBaCxQt
|
||||
Row row = s.getRow(0);
|
||||
Cell cell = row.getCell(1);
|
||||
cell.setCellValue(qt.getSjbbhcs());
|
||||
wb.write(new FileOutputStream(file));
|
||||
wb.close();
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -168,7 +168,6 @@ public class OtaBaSjQtsjxxServiceImpl extends ServiceImpl<OtaBaSjQtsjxxMapper, O
|
||||
js = sdf.format(qt.getSjjzsj());
|
||||
}
|
||||
cell.setCellValue(js);
|
||||
cell.setCellValue(ks);
|
||||
wb.write(new FileOutputStream(file));
|
||||
wb.close();
|
||||
}
|
||||
|
||||
+23
-11
@@ -71,7 +71,7 @@ public class ImportFileUtil {
|
||||
throw new JeroBootException("Please upload a zip file or rar file");
|
||||
}
|
||||
}
|
||||
String path = uploadPath + File.separator + "modal" + File.separator + System.currentTimeMillis()+ File.separator + filenameorg;
|
||||
String path = uploadPath + File.separator + "modal" + File.separator + System.currentTimeMillis() + File.separator + filenameorg;
|
||||
File saveDirectory = new File(path);
|
||||
if (!saveDirectory.isDirectory()) {
|
||||
saveDirectory.mkdir();
|
||||
@@ -166,7 +166,7 @@ public class ImportFileUtil {
|
||||
|
||||
|
||||
public static String getCellValueHaveOrNot(Cell cell, Workbook workbook) throws Exception {
|
||||
String res = "3";
|
||||
String res = "";
|
||||
String str = getCellValue(cell, workbook);
|
||||
if (StringUtils.isNotEmpty(str)) {
|
||||
if (str.equals("有")) {
|
||||
@@ -179,7 +179,7 @@ public class ImportFileUtil {
|
||||
}
|
||||
|
||||
public static String getCellValueHaveOrNotInt(Integer val) throws Exception {
|
||||
String res = "3";
|
||||
String res = "";
|
||||
if (ObjectUtils.isNotEmpty(val)) {
|
||||
if (val.equals(1)) {
|
||||
res = "有";
|
||||
@@ -191,7 +191,7 @@ public class ImportFileUtil {
|
||||
}
|
||||
|
||||
public static String getCellValueYesOrNo(Cell cell, Workbook workbook) throws Exception {
|
||||
String res = "3";
|
||||
String res = "";
|
||||
String str = getCellValue(cell, workbook);
|
||||
if (StringUtils.isNotEmpty(str)) {
|
||||
if (str.equals("是")) {
|
||||
@@ -204,7 +204,7 @@ public class ImportFileUtil {
|
||||
}
|
||||
|
||||
public static String getCellValueYesOrNoInt(Integer val) throws Exception {
|
||||
String res = "3";
|
||||
String res = "";
|
||||
if (ObjectUtils.isNotEmpty(val)) {
|
||||
if (val.equals(1)) {
|
||||
res = "是";
|
||||
@@ -216,7 +216,7 @@ public class ImportFileUtil {
|
||||
}
|
||||
|
||||
public static String getCellValueHaveOrNot(String str) throws Exception {
|
||||
String res = "3";
|
||||
String res = "";
|
||||
if (StringUtils.isNotEmpty(str)) {
|
||||
if (str.equals("1")) {
|
||||
res = "有";
|
||||
@@ -228,7 +228,7 @@ public class ImportFileUtil {
|
||||
}
|
||||
|
||||
public static String getCellValueYesOrNo(String str) throws Exception {
|
||||
String res = "3";
|
||||
String res = "";
|
||||
if (StringUtils.isNotEmpty(str)) {
|
||||
if (str.equals("1")) {
|
||||
res = "是";
|
||||
@@ -356,7 +356,7 @@ public class ImportFileUtil {
|
||||
return res;
|
||||
}
|
||||
|
||||
public static String uploadFiles(File attFile, String[] strs, IOSSFileService ossFileService, StringBuilder errMsg, String title, String cut) throws Exception {
|
||||
public static String uploadFiles(File attFile, String[] strs, IOSSFileService ossFileService, StringBuilder errMsg, String title, String cut, int row) throws Exception {
|
||||
String res = "";
|
||||
//已导入文件数,用于判断超过20
|
||||
int inFile = 0;
|
||||
@@ -368,16 +368,28 @@ public class ImportFileUtil {
|
||||
if (StringUtils.isNotEmpty(strs[i])) {
|
||||
File file = ImportFileUtil.findFile(attFile, strs[i]);
|
||||
if (null == file) {
|
||||
errMsg.append(title + " 找不到文件:" + strs[i] + ", ");
|
||||
if (row > 0) {
|
||||
errMsg.append("第" + row + "行 " + title + " 找不到文件:" + strs[i] + ", ");
|
||||
} else {
|
||||
errMsg.append(title + " 找不到文件:" + strs[i] + ", ");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!file.getName().endsWith(".doc") && !file.getName().endsWith(".docx") && !file.getName().endsWith(".pdf")
|
||||
&& !file.getName().endsWith(".DOC") && !file.getName().endsWith(".DOCX") && !file.getName().endsWith(".PDF")) {
|
||||
errMsg.append(title + " 只支持doc/docx/pdf格式, ");
|
||||
if (row > 0) {
|
||||
errMsg.append("第" + row + "行 " + title + " 只支持doc/docx/pdf格式, ");
|
||||
} else {
|
||||
errMsg.append(title + " 只支持doc/docx/pdf格式, ");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (file.length() > 50 * 1024 * 1024) {
|
||||
errMsg.append(title + " 上传文件不可以超过50MB, ");
|
||||
if (row > 0) {
|
||||
errMsg.append("第" + row + "行 " + title + " 上传文件不可以超过50MB, ");
|
||||
} else {
|
||||
errMsg.append(title + " 上传文件不可以超过50MB, ");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(file), "", null, null);
|
||||
|
||||
Reference in New Issue
Block a user