修改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));
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(aqcs, errMsg, sysDictService, cut);
cu.checkError(aqcs, errMsg, sysDictService, cut, 0);
row = s.getRow(2);
cell = row.getCell(3);
@@ -280,7 +280,7 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
jbxx.setCdotasj(ImportFileUtil.getCellValue(cell, wb));
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(jbxx, errMsg, sysDictService, cut);
cu.checkError(jbxx, errMsg, sysDictService, cut, 0);
return jbxx;
}
@@ -343,7 +343,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
cell = row.getCell(7);
sjmk.setBzwz(ImportFileUtil.getCellValue(cell, wb));
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(sjmk, errMsg, sysDictService, cut);
cu.checkError(sjmk, errMsg, sysDictService, cut, i + 1);
sjmkList.add(sjmk);
}
}
@@ -608,7 +608,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
cell = row.getCell(4);
bass.setEdrScqy(ImportFileUtil.getCellValue(cell, wb));
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(bass, errMsg, sysDictService, cut);
cu.checkError(bass, errMsg, sysDictService, cut, 0);
return bass;
}
@@ -328,7 +328,7 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
mssc.setCreateTime(now);
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(mssc, errMsg, sysDictService, cut);
cu.checkError(mssc, errMsg, sysDictService, cut, i + 1);
mccsList.add(mssc);
}
}
@@ -401,7 +401,7 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
mssc.setUpdateTime(now);
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(mssc, errMsg, sysDictService, cut);
cu.checkError(mssc, errMsg, sysDictService, cut, i + 1);
mccsList.add(mssc);
}
}
@@ -273,7 +273,7 @@ public class OtaBaCxZxsjyqServiceImpl extends ServiceImpl<OtaBaCxZxsjyqMapper, O
otaBaCxZxsjyq.setSjzt(ImportFileUtil.getCellValueYesOrNo(cell, wb));
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(otaBaCxZxsjyq, errMsg, sysDictService, cut);
cu.checkError(otaBaCxZxsjyq, errMsg, sysDictService, cut, 0);
row = s.getRow(2);
cell = row.getCell(3);
@@ -115,6 +115,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
}
}
public List<OtaBaSjSjfzbh> setDefault(String otaId) {
List<OtaBaSjSjfzbh> list = this.getByOtaId(otaId);
Date now = new Date();
@@ -224,7 +225,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
@Override
public void importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception {
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
parseFileList(upLoadFiles, otaId, cut,errMsg);
parseFileList(upLoadFiles, otaId, cut, errMsg);
}
@Override
@@ -243,7 +244,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
if (ObjectUtils.isEmpty(oldList)) {
oldList = new ArrayList<>();
}
List<OtaBaSjSjfzbh> newList = parseFile(upFile, otaId, cut,errMsg);
List<OtaBaSjSjfzbh> newList = parseFile(upFile, otaId, cut, errMsg);
ComparisonUtil cu = new ComparisonUtil();
List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.SJ_SJJSMCBH, OtaTitleEnum.GNMC.getName(), oldList, newList, sysDictService);
deleteByOtaId(otaId);
@@ -283,7 +284,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
fzbh.setCreateTime(now);
fzbh.setUpdateTime(now);
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(fzbh, errMsg, sysDictService, cut);
cu.checkError(fzbh, errMsg, sysDictService, cut, i + 1);
fzbhList.add(fzbh);
}
@@ -246,7 +246,7 @@ public class OtaBaSjSjmbcxServiceImpl extends ServiceImpl<OtaBaSjSjmbcxMapper, O
mbcx.setDllx2(jbxx.getDllx2());
}
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(mbcx, errMsg, sysDictService, cut);
cu.checkError(mbcx, errMsg, sysDictService, cut, 0);
return mbcx;
}
@@ -271,7 +271,7 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, O
cell = row.getCell(10);
xtbh.setSfcfsj(ImportFileUtil.getCellValueYesOrNo(cell, wb));
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(xtbh, errMsg, sysDictService, cut);
cu.checkError(xtbh, errMsg, sysDictService, cut, i + 1);
if (xtbh.isNull()) {
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();
for (Field field : fields) {
OtaTitleEnum ote = OtaTitleEnum.getOtaTitleEnum(field.getName());
@@ -200,17 +200,29 @@ public class ComparisonUtil<T> {
String str = val.toString();
if ("0".equals(ote.getType())) {
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);
}
} else if ("1".equals(ote.getType())) {
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);
}
} else if ("2".equals(ote.getType())) {
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);
}
} else if ("3".equals(ote.getType())) {
@@ -220,7 +232,11 @@ public class ComparisonUtil<T> {
for (String s : strs) {
String res = sysDictService.queryDictTextByKeyEn(ote.getType(), s, cut);
if (StringUtils.isEmpty(res)) {
errMsg.append(title + " 填写了无法识别的选项, ");
if (row > 0) {
errMsg.append("" + row + "" + title + " 填写了无法识别的选项, ");
}else{
errMsg.append(title + " 填写了无法识别的选项, ");
}
field.set(clazz, null);
}
}