修改OTA

This commit is contained in:
高嵩
2023-04-13 19:35:56 +08:00
parent aa4c2b5ac0
commit 15e6ff6f06
10 changed files with 34 additions and 17 deletions
@@ -257,7 +257,7 @@ public class OtaBaCxAqcsServiceImpl extends ServiceImpl<OtaBaCxAqcsMapper, OtaBa
aqcs.setXxaqjz(ImportFileUtil.getCellValueDict(cell, wb, "Information_security_mechanism", sysDictService, cut)); aqcs.setXxaqjz(ImportFileUtil.getCellValueDict(cell, wb, "Information_security_mechanism", sysDictService, cut));
ComparisonUtil cu = new ComparisonUtil(); ComparisonUtil cu = new ComparisonUtil();
cu.checkError(aqcs, errMsg, sysDictService, cut); cu.checkError(aqcs, errMsg, sysDictService, cut, 0);
row = s.getRow(2); row = s.getRow(2);
cell = row.getCell(3); cell = row.getCell(3);
@@ -280,7 +280,7 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
jbxx.setCdotasj(ImportFileUtil.getCellValue(cell, wb)); jbxx.setCdotasj(ImportFileUtil.getCellValue(cell, wb));
ComparisonUtil cu = new ComparisonUtil(); ComparisonUtil cu = new ComparisonUtil();
cu.checkError(jbxx, errMsg, sysDictService, cut); cu.checkError(jbxx, errMsg, sysDictService, cut, 0);
return jbxx; return jbxx;
} }
@@ -343,7 +343,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
cell = row.getCell(7); cell = row.getCell(7);
sjmk.setBzwz(ImportFileUtil.getCellValue(cell, wb)); sjmk.setBzwz(ImportFileUtil.getCellValue(cell, wb));
ComparisonUtil cu = new ComparisonUtil(); ComparisonUtil cu = new ComparisonUtil();
cu.checkError(sjmk, errMsg, sysDictService, cut); cu.checkError(sjmk, errMsg, sysDictService, cut, i + 1);
sjmkList.add(sjmk); sjmkList.add(sjmk);
} }
} }
@@ -608,7 +608,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
cell = row.getCell(4); cell = row.getCell(4);
bass.setEdrScqy(ImportFileUtil.getCellValue(cell, wb)); bass.setEdrScqy(ImportFileUtil.getCellValue(cell, wb));
ComparisonUtil cu = new ComparisonUtil(); ComparisonUtil cu = new ComparisonUtil();
cu.checkError(bass, errMsg, sysDictService, cut); cu.checkError(bass, errMsg, sysDictService, cut, 0);
return bass; return bass;
} }
@@ -328,7 +328,7 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
mssc.setCreateTime(now); mssc.setCreateTime(now);
ComparisonUtil cu = new ComparisonUtil(); ComparisonUtil cu = new ComparisonUtil();
cu.checkError(mssc, errMsg, sysDictService, cut); cu.checkError(mssc, errMsg, sysDictService, cut, i + 1);
mccsList.add(mssc); mccsList.add(mssc);
} }
} }
@@ -401,7 +401,7 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
mssc.setUpdateTime(now); mssc.setUpdateTime(now);
ComparisonUtil cu = new ComparisonUtil(); ComparisonUtil cu = new ComparisonUtil();
cu.checkError(mssc, errMsg, sysDictService, cut); cu.checkError(mssc, errMsg, sysDictService, cut, i + 1);
mccsList.add(mssc); mccsList.add(mssc);
} }
} }
@@ -273,7 +273,7 @@ public class OtaBaCxZxsjyqServiceImpl extends ServiceImpl<OtaBaCxZxsjyqMapper, O
otaBaCxZxsjyq.setSjzt(ImportFileUtil.getCellValueYesOrNo(cell, wb)); otaBaCxZxsjyq.setSjzt(ImportFileUtil.getCellValueYesOrNo(cell, wb));
ComparisonUtil cu = new ComparisonUtil(); ComparisonUtil cu = new ComparisonUtil();
cu.checkError(otaBaCxZxsjyq, errMsg, sysDictService, cut); cu.checkError(otaBaCxZxsjyq, errMsg, sysDictService, cut, 0);
row = s.getRow(2); row = s.getRow(2);
cell = row.getCell(3); cell = row.getCell(3);
@@ -115,6 +115,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
} }
} }
public List<OtaBaSjSjfzbh> setDefault(String otaId) { public List<OtaBaSjSjfzbh> setDefault(String otaId) {
List<OtaBaSjSjfzbh> list = this.getByOtaId(otaId); List<OtaBaSjSjfzbh> list = this.getByOtaId(otaId);
Date now = new Date(); Date now = new Date();
@@ -224,7 +225,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
@Override @Override
public void importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception { public void importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception {
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath); List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
parseFileList(upLoadFiles, otaId, cut,errMsg); parseFileList(upLoadFiles, otaId, cut, errMsg);
} }
@Override @Override
@@ -243,7 +244,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
if (ObjectUtils.isEmpty(oldList)) { if (ObjectUtils.isEmpty(oldList)) {
oldList = new ArrayList<>(); oldList = new ArrayList<>();
} }
List<OtaBaSjSjfzbh> newList = parseFile(upFile, otaId, cut,errMsg); List<OtaBaSjSjfzbh> newList = parseFile(upFile, otaId, cut, errMsg);
ComparisonUtil cu = new ComparisonUtil(); ComparisonUtil cu = new ComparisonUtil();
List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.SJ_SJJSMCBH, OtaTitleEnum.GNMC.getName(), oldList, newList, sysDictService); List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.SJ_SJJSMCBH, OtaTitleEnum.GNMC.getName(), oldList, newList, sysDictService);
deleteByOtaId(otaId); deleteByOtaId(otaId);
@@ -283,7 +284,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
fzbh.setCreateTime(now); fzbh.setCreateTime(now);
fzbh.setUpdateTime(now); fzbh.setUpdateTime(now);
ComparisonUtil cu = new ComparisonUtil(); ComparisonUtil cu = new ComparisonUtil();
cu.checkError(fzbh, errMsg, sysDictService, cut); cu.checkError(fzbh, errMsg, sysDictService, cut, i + 1);
fzbhList.add(fzbh); fzbhList.add(fzbh);
} }
@@ -246,7 +246,7 @@ public class OtaBaSjSjmbcxServiceImpl extends ServiceImpl<OtaBaSjSjmbcxMapper, O
mbcx.setDllx2(jbxx.getDllx2()); mbcx.setDllx2(jbxx.getDllx2());
} }
ComparisonUtil cu = new ComparisonUtil(); ComparisonUtil cu = new ComparisonUtil();
cu.checkError(mbcx, errMsg, sysDictService, cut); cu.checkError(mbcx, errMsg, sysDictService, cut, 0);
return mbcx; return mbcx;
} }
@@ -271,7 +271,7 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, O
cell = row.getCell(10); cell = row.getCell(10);
xtbh.setSfcfsj(ImportFileUtil.getCellValueYesOrNo(cell, wb)); xtbh.setSfcfsj(ImportFileUtil.getCellValueYesOrNo(cell, wb));
ComparisonUtil cu = new ComparisonUtil(); ComparisonUtil cu = new ComparisonUtil();
cu.checkError(xtbh, errMsg, sysDictService, cut); cu.checkError(xtbh, errMsg, sysDictService, cut, i + 1);
if (xtbh.isNull()) { if (xtbh.isNull()) {
break; break;
} }
@@ -185,7 +185,7 @@ public class ComparisonUtil<T> {
} }
} }
public void checkError(T clazz, StringBuilder errMsg, ISysDictService sysDictService, String cut) { public void checkError(T clazz, StringBuilder errMsg, ISysDictService sysDictService, String cut,int row) {
Field[] fields = clazz.getClass().getDeclaredFields(); Field[] fields = clazz.getClass().getDeclaredFields();
for (Field field : fields) { for (Field field : fields) {
OtaTitleEnum ote = OtaTitleEnum.getOtaTitleEnum(field.getName()); OtaTitleEnum ote = OtaTitleEnum.getOtaTitleEnum(field.getName());
@@ -200,17 +200,29 @@ public class ComparisonUtil<T> {
String str = val.toString(); String str = val.toString();
if ("0".equals(ote.getType())) { if ("0".equals(ote.getType())) {
if (str.length() > ote.getLen()) { if (str.length() > ote.getLen()) {
errMsg.append(title + " 的长度超过了 " + ote.getLen() + ", "); if (row > 0) {
errMsg.append("" + row + "" + title + " 的长度超过了 " + ote.getLen() + ", ");
} else {
errMsg.append(title + " 的长度超过了 " + ote.getLen() + ", ");
}
field.set(clazz, null); field.set(clazz, null);
} }
} else if ("1".equals(ote.getType())) { } else if ("1".equals(ote.getType())) {
if (!"1".equals(str) && !"2".equals(str)) { if (!"1".equals(str) && !"2".equals(str)) {
errMsg.append(title + " 必须填写有或无, "); if (row > 0) {
errMsg.append("" + row + "" + title + " 必须填写有或无, ");
}else{
errMsg.append(title + " 必须填写有或无, ");
}
field.set(clazz, null); field.set(clazz, null);
} }
} else if ("2".equals(ote.getType())) { } else if ("2".equals(ote.getType())) {
if (!"1".equals(str) && !"2".equals(str)) { if (!"1".equals(str) && !"2".equals(str)) {
errMsg.append(title + " 必须填写是或否, "); if (row > 0) {
errMsg.append("" + row + "" + title + " 必须填写是或否, ");
}else{
errMsg.append(title + " 必须填写是或否, ");
}
field.set(clazz, null); field.set(clazz, null);
} }
} else if ("3".equals(ote.getType())) { } else if ("3".equals(ote.getType())) {
@@ -220,7 +232,11 @@ public class ComparisonUtil<T> {
for (String s : strs) { for (String s : strs) {
String res = sysDictService.queryDictTextByKeyEn(ote.getType(), s, cut); String res = sysDictService.queryDictTextByKeyEn(ote.getType(), s, cut);
if (StringUtils.isEmpty(res)) { if (StringUtils.isEmpty(res)) {
errMsg.append(title + " 填写了无法识别的选项, "); if (row > 0) {
errMsg.append("" + row + "" + title + " 填写了无法识别的选项, ");
}else{
errMsg.append(title + " 填写了无法识别的选项, ");
}
field.set(clazz, null); field.set(clazz, null);
} }
} }