修改OTA

This commit is contained in:
高嵩
2023-04-05 14:17:23 +08:00
parent 68bfce4f3d
commit 477718e6eb
3 changed files with 15 additions and 11 deletions
@@ -292,6 +292,8 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
ComparisonUtil cu = new ComparisonUtil(); ComparisonUtil cu = new ComparisonUtil();
if (ObjectUtils.isEmpty(otaBaCxJsfzbacsOld)) { if (ObjectUtils.isEmpty(otaBaCxJsfzbacsOld)) {
otaBaCxJsfzbacsOld = new OtaBaCxJsfzbacs(); otaBaCxJsfzbacsOld = new OtaBaCxJsfzbacs();
}else{
deleteById(otaBaCxJsfzbacsOld.getId());
} }
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaId, OtaModuleEnum.CX_JSFZXTJCBACS, otaBaCxJsfzbacsOld, basc, sysDictService); List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaId, OtaModuleEnum.CX_JSFZXTJCBACS, otaBaCxJsfzbacsOld, basc, sysDictService);
saveOrUpdate(basc); saveOrUpdate(basc);
@@ -314,7 +316,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
Workbook wb = ImportFileUtil.readExcel(upFile); Workbook wb = ImportFileUtil.readExcel(upFile);
Sheet s = wb.getSheetAt(0); Sheet s = wb.getSheetAt(0);
int rows = s.getPhysicalNumberOfRows(); int rows = s.getPhysicalNumberOfRows();
for (int i = 63; i < rows; i++) { for (int i = 64; i < rows; i++) {
Row row = s.getRow(i); Row row = s.getRow(i);
Cell cell = row.getCell(0); Cell cell = row.getCell(0);
String str = ImportFileUtil.getCellValue(cell, wb); String str = ImportFileUtil.getCellValue(cell, wb);
@@ -605,6 +607,8 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
row = s.getRow(59); row = s.getRow(59);
cell = row.getCell(4); cell = row.getCell(4);
bass.setEdrScqy(ImportFileUtil.getCellValue(cell, wb)); bass.setEdrScqy(ImportFileUtil.getCellValue(cell, wb));
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(bass, errMsg, sysDictService, cut);
return bass; return bass;
} }
@@ -201,17 +201,17 @@ public class ComparisonUtil<T> {
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() + ", "); errMsg.append(title + " 的长度超过了 " + ote.getLen() + ", ");
field.set(clazz, ""); 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 + " 必须填写有或无, "); errMsg.append(title + " 必须填写有或无, ");
field.set(clazz, ""); 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 + " 必须填写是或否, "); errMsg.append(title + " 必须填写是或否, ");
field.set(clazz, ""); field.set(clazz, null);
} }
} else if ("3".equals(ote.getType())) { } else if ("3".equals(ote.getType())) {
//不处理 //不处理
@@ -221,7 +221,7 @@ public class ComparisonUtil<T> {
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 + " 填写了无法识别的选项, "); errMsg.append(title + " 填写了无法识别的选项, ");
field.set(clazz, ""); field.set(clazz, null);
} }
} }
} }
@@ -166,7 +166,7 @@ public class ImportFileUtil {
public static String getCellValueHaveOrNot(Cell cell, Workbook workbook) throws Exception { public static String getCellValueHaveOrNot(Cell cell, Workbook workbook) throws Exception {
String res = ""; String res = "3";
String str = getCellValue(cell, workbook); String str = getCellValue(cell, workbook);
if (StringUtils.isNotEmpty(str)) { if (StringUtils.isNotEmpty(str)) {
if (str.equals("有")) { if (str.equals("有")) {
@@ -179,7 +179,7 @@ public class ImportFileUtil {
} }
public static String getCellValueHaveOrNotInt(Integer val) throws Exception { public static String getCellValueHaveOrNotInt(Integer val) throws Exception {
String res = ""; String res = "3";
if (ObjectUtils.isNotEmpty(val)) { if (ObjectUtils.isNotEmpty(val)) {
if (val.equals(1)) { if (val.equals(1)) {
res = "有"; res = "有";
@@ -191,7 +191,7 @@ public class ImportFileUtil {
} }
public static String getCellValueYesOrNo(Cell cell, Workbook workbook) throws Exception { public static String getCellValueYesOrNo(Cell cell, Workbook workbook) throws Exception {
String res = ""; String res = "3";
String str = getCellValue(cell, workbook); String str = getCellValue(cell, workbook);
if (StringUtils.isNotEmpty(str)) { if (StringUtils.isNotEmpty(str)) {
if (str.equals("是")) { if (str.equals("是")) {
@@ -204,7 +204,7 @@ public class ImportFileUtil {
} }
public static String getCellValueYesOrNoInt(Integer val) throws Exception { public static String getCellValueYesOrNoInt(Integer val) throws Exception {
String res = ""; String res = "3";
if (ObjectUtils.isNotEmpty(val)) { if (ObjectUtils.isNotEmpty(val)) {
if (val.equals(1)) { if (val.equals(1)) {
res = "是"; res = "是";
@@ -216,7 +216,7 @@ public class ImportFileUtil {
} }
public static String getCellValueHaveOrNot(String str) throws Exception { public static String getCellValueHaveOrNot(String str) throws Exception {
String res = ""; String res = "3";
if (StringUtils.isNotEmpty(str)) { if (StringUtils.isNotEmpty(str)) {
if (str.equals("1")) { if (str.equals("1")) {
res = "有"; res = "有";
@@ -228,7 +228,7 @@ public class ImportFileUtil {
} }
public static String getCellValueYesOrNo(String str) throws Exception { public static String getCellValueYesOrNo(String str) throws Exception {
String res = ""; String res = "3";
if (StringUtils.isNotEmpty(str)) { if (StringUtils.isNotEmpty(str)) {
if (str.equals("1")) { if (str.equals("1")) {
res = "是"; res = "是";