开发OTA备案工具-导入导出

This commit is contained in:
高嵩
2023-03-28 00:13:46 +08:00
parent f23fb9e9db
commit 3ec7893eda
3 changed files with 51 additions and 36 deletions
@@ -326,7 +326,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
Row row = s.getRow(2);
Cell cell = row.getCell(2);
bass.setJsfzczjPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setJsfzczjPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(2);
cell = row.getCell(4);
bass.setJgldSl(ImportFileUtil.getCellValue(cell, wb));
@@ -342,7 +342,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(6);
cell = row.getCell(2);
bass.setHmbldPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setHmbldPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(6);
cell = row.getCell(4);
bass.setHmbldSl(ImportFileUtil.getCellValue(cell, wb));
@@ -359,7 +359,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(10);
cell = row.getCell(2);
bass.setCsbldPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setCsbldPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(10);
cell = row.getCell(4);
bass.setCsbldSl(ImportFileUtil.getCellValue(cell, wb));
@@ -376,7 +376,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(14);
cell = row.getCell(2);
bass.setSxthsPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setSxthsPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(14);
cell = row.getCell(4);
bass.setSxthsSl(ImportFileUtil.getCellValue(cell, wb));
@@ -392,7 +392,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(18);
cell = row.getCell(2);
bass.setSxtdsdPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setSxtdsdPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(18);
cell = row.getCell(4);
bass.setSxtdsdSl(ImportFileUtil.getCellValue(cell, wb));
@@ -408,7 +408,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(22);
cell = row.getCell(2);
bass.setJsyjkPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setJsyjkPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(22);
cell = row.getCell(4);
bass.setJsyjkSl(ImportFileUtil.getCellValue(cell, wb));
@@ -424,7 +424,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(26);
cell = row.getCell(2);
bass.setJsyhwPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setJsyhwPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(26);
cell = row.getCell(4);
bass.setJsyhwSl(ImportFileUtil.getCellValue(cell, wb));
@@ -440,7 +440,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(30);
cell = row.getCell(2);
bass.setCzwxdwPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setCzwxdwPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(30);
cell = row.getCell(4);
bass.setCzwxdwGgxh(ImportFileUtil.getCellValue(cell, wb));
@@ -450,7 +450,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(32);
cell = row.getCell(2);
bass.setGxdhPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setGxdhPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(32);
cell = row.getCell(4);
bass.setGxdhGgxh(ImportFileUtil.getCellValue(cell, wb));
@@ -460,7 +460,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(34);
cell = row.getCell(2);
bass.setLsjPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setLsjPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(34);
cell = row.getCell(4);
bass.setLsjGgxh(ImportFileUtil.getCellValue(cell, wb));
@@ -470,7 +470,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(36);
cell = row.getCell(2);
bass.setGjddtPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setGjddtPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(36);
cell = row.getCell(4);
bass.setGjddtGgxh(ImportFileUtil.getCellValue(cell, wb));
@@ -480,14 +480,14 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(38);
cell = row.getCell(2);
bass.setDzwlPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setDzwlPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(38);
cell = row.getCell(4);
bass.setDzwlDxxgcs(ImportFileUtil.getCellValue(cell, wb));
row = s.getRow(39);
cell = row.getCell(2);
bass.setCztxPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setCztxPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(39);
cell = row.getCell(4);
bass.setCztxXtmc(ImportFileUtil.getCellValue(cell, wb));
@@ -506,7 +506,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(44);
cell = row.getCell(2);
bass.setJsfzczjPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setJsfzczjPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(44);
cell = row.getCell(4);
bass.setJsfzczjMc(ImportFileUtil.getCellValue(cell, wb));
@@ -519,7 +519,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(47);
cell = row.getCell(2);
bass.setJsfzzsqPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setJsfzzsqPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(47);
cell = row.getCell(4);
bass.setJsfzzsqMc(ImportFileUtil.getCellValue(cell, wb));
@@ -532,7 +532,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(50);
cell = row.getCell(2);
bass.setFxptstsPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setFxptstsPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(50);
cell = row.getCell(4);
bass.setFxptstsMc(ImportFileUtil.getCellValue(cell, wb));
@@ -545,7 +545,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(53);
cell = row.getCell(2);
bass.setJsyzyltsPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setJsyzyltsPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(53);
cell = row.getCell(4);
bass.setJsyzyltsMc(ImportFileUtil.getCellValue(cell, wb));
@@ -558,7 +558,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(56);
cell = row.getCell(2);
bass.setDssadPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setDssadPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(56);
cell = row.getCell(4);
bass.setDssadGgxh(ImportFileUtil.getCellValue(cell, wb));
@@ -568,7 +568,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(58);
cell = row.getCell(2);
bass.setEdrPz(Integer.parseInt(ImportFileUtil.getCellValueYesOrNo(cell, wb)));
bass.setEdrPz(ImportFileUtil.getCellValueYesOrNoInt(cell, wb));
row = s.getRow(58);
cell = row.getCell(4);
bass.setEdrGgxh(ImportFileUtil.getCellValue(cell, wb));
@@ -254,6 +254,8 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
//列表数据数量,在证明材料处结束
OtaBaCxList otaBaCxList = otaBaCxListService.queryById(otaId);
if (ObjectUtils.isNotEmpty(otaBaCxList)) {
cell = row.getCell(1);
str = ImportFileUtil.getCellValue(cell, wb);
String[] strs = str.split(",");
otaBaCxList.setZxsjxtfj(ImportFileUtil.uploadFiles(attFile, strs, ossFileService));
otaBaCxListService.editById(otaBaCxList);
@@ -147,6 +147,15 @@ public class ImportFileUtil {
return "";
}
public static Integer getCellValueYesOrNoInt(Cell cell, Workbook workbook) throws Exception {
Integer res = null;
String str = getCellValueYesOrNo(cell, workbook);
if (StringUtils.isNotEmpty(str)) {
res = Integer.parseInt(str);
}
return res;
}
public static String getCellValueYesOrNo(Cell cell, Workbook workbook) throws Exception {
String res = "";
String str = getCellValue(cell, workbook);
@@ -209,13 +218,15 @@ public class ImportFileUtil {
public static List<OSSFile> uploadFiles1(File attFile, String[] strs, IOSSFileService ossFileService) throws Exception {
List<OSSFile> res = new ArrayList<>();
for (int i = 0; i < strs.length; i++) {
File file = ImportFileUtil.findFile(attFile, strs[i]);
if (null == file) {
throw new JeroBootException("找不到文件:" + strs[i]);
}
OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(file), "", null, null);
if (ObjectUtils.isNotEmpty(ossFile)) {
res.add(ossFile);
if (StringUtils.isNotEmpty(strs[i])) {
File file = ImportFileUtil.findFile(attFile, strs[i]);
if (null == file) {
throw new JeroBootException("找不到文件:" + strs[i]);
}
OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(file), "", null, null);
if (ObjectUtils.isNotEmpty(ossFile)) {
res.add(ossFile);
}
}
}
return res;
@@ -224,16 +235,18 @@ public class ImportFileUtil {
public static String uploadFiles(File attFile, String[] strs, IOSSFileService ossFileService) throws Exception {
String res = "";
for (int i = 0; i < strs.length; i++) {
File file = ImportFileUtil.findFile(attFile, strs[i]);
if (null == file) {
throw new JeroBootException("找不到文件:" + strs[i]);
}
OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(file), "", null, null);
if (ObjectUtils.isNotEmpty(ossFile)) {
if (i >= strs.length - 1) {
res += ossFile.getId();
} else {
res += ossFile.getId() + ",";
if (StringUtils.isNotEmpty(strs[i])) {
File file = ImportFileUtil.findFile(attFile, strs[i]);
if (null == file) {
throw new JeroBootException("找不到文件:" + strs[i]);
}
OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(file), "", null, null);
if (ObjectUtils.isNotEmpty(ossFile)) {
if (i >= strs.length - 1) {
res += ossFile.getId();
} else {
res += ossFile.getId() + ",";
}
}
}
}