diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java index 7524de6..e8fb418 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java @@ -389,7 +389,6 @@ public class FieldxController extends JeecgController { //读取表 message.put("status", "数据预读入"); webSocketUtils.sendMessage(loginUser.getId(), message); - List list = new ArrayList<>(); //获取excel的所有页 HashSet zt = new HashSet<>(); zt.add("0"); @@ -444,6 +443,7 @@ public class FieldxController extends JeecgController { message.put("isError", "true"); message.put("status","序号为" + (r - 2) + "的”表名”不能为空或是此表不存在"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的表名不能为空或是此表不纯在"); } fieldx222.setTableId(excelInfo.getTableId()); @@ -452,37 +452,35 @@ public class FieldxController extends JeecgController { message.put("status","序号为 "+ (r - 2) + "的”中文名称”不能为空"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的中文名称不能为空"); } - String fieldname= String.valueOf(fieldx222Service.query().eq("field_name",excelInfo.getFieldName()).one()); - if(!StringUtil.isBlank(fieldname)){ + Fieldx222 fieldx2221=fieldx222Service.query().eq("field_name",excelInfo.getFieldName()).one(); + if(fieldx2221!=null){ message.put("isError", "true"); message.put("status","序号为 "+ (r - 2) + "的”中文名称”与表中数据已重复"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的中文名称与表中数据已重复"); } - if (StringUtil.isBlank(excelInfo.getFieldName())) { - message.put("isError", "true"); - message.put("status","序号为 "+ (r - 2) +" 的”中文名称”不能为空"); - message.put("closeable","true"); - webSocketUtils.sendMessage(loginUser.getId(), message); - return Result.error("序号为" + (r - 2) + "的中文名称不能为空"); - } + fieldx222.setFieldName(excelInfo.getFieldName()); if (StringUtil.isBlank(excelInfo.getFieldEnName())) { message.put("isError", "true"); message.put("status","序号为" + (r - 2) + "的”英文名称”不能为空"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的英文名称不能为空"); } - String enname= String.valueOf(fieldx222Service.query().eq("field_en_name",excelInfo.getFieldEnName()).one()); - if(!StringUtil.isBlank(fieldname)){ + Fieldx222 fieldx2222=fieldx222Service.query().eq("field_en_name",excelInfo.getFieldEnName()).one(); + if(fieldx2222!=null){ message.put("isError", "true"); message.put("status","序号为" + (r - 2) +" 的”英文名称”与表中数据已重复"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的英文名称与表中数据已重复"); } fieldx222.setFieldEnName(excelInfo.getFieldEnName()); @@ -491,6 +489,7 @@ public class FieldxController extends JeecgController { message.put("status","序号为" + (r - 2) + "的”数据类型”不能为空"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的数据类型不能为空"); } else if(!sjlx.contains(excelInfo.getType())){ @@ -498,6 +497,7 @@ public class FieldxController extends JeecgController { message.put("status","序号为" + (r - 2) + "的”数据类型”输入格式不正确"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的数据类型输入格式不正确"); } fieldx222.setType(excelInfo.getType()); @@ -510,6 +510,7 @@ public class FieldxController extends JeecgController { message.put("status","序号为" + (r - 2) + "的”是否主键”输入格式不正确"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的是否主键输入格式不正确"); } fieldx222.setIsPk(excelInfo.getIsPk()); @@ -521,6 +522,7 @@ public class FieldxController extends JeecgController { message.put("status","序号为" + (r - 2) + "的”是否外键”输入格式不正确"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的是否外键输入格式不正确"); } fieldx222.setIsFk(excelInfo.getIsFk()); @@ -529,6 +531,7 @@ public class FieldxController extends JeecgController { message.put("status","序号为" + (r - 2) + "的”是否为空”不能为空"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的是否为空不能为空"); } else if(!sf.contains(excelInfo.getIsNull())){ @@ -536,6 +539,7 @@ public class FieldxController extends JeecgController { message.put("status","序号为" + (r - 2) + "的”是否为空”输入格式不正确"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的是否为空输入格式不正确"); } fieldx222.setIsNull(excelInfo.getIsNull()); @@ -544,6 +548,7 @@ public class FieldxController extends JeecgController { message.put("status","序号为" + (r - 2) + "的”是否重复”不能为空"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的是否重复不能为空"); } else if(!sf.contains(excelInfo.getIsUniqueness())){ @@ -551,6 +556,7 @@ public class FieldxController extends JeecgController { message.put("status","序号为" + (r - 2) + "的”是否重复”输入格式不正确"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的是否重复输入格式不正确"); } fieldx222.setIsUniqueness(excelInfo.getIsUniqueness()); @@ -559,6 +565,7 @@ public class FieldxController extends JeecgController { message.put("status","序号为" + (r - 2) + "的”字段状态”不能为空"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的”字段状态”不能为空"); } else if(!zt.contains(excelInfo.getStatus())){ @@ -566,6 +573,7 @@ public class FieldxController extends JeecgController { message.put("status","序号为" + (r - 2) + "的”字段状态”输入格式不正确"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的字段状态输入格式不正确"); } fieldx222.setStatus(excelInfo.getStatus()); @@ -574,6 +582,7 @@ public class FieldxController extends JeecgController { message.put("status","序号为" + (r - 2) + "的”版本状态”不能为空"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的”版本状态”不能为空"); } else if(!sf.contains(excelInfo.getVerisonStatus())){ @@ -581,6 +590,7 @@ public class FieldxController extends JeecgController { message.put("status","序号为" + (r - 2) + "的”版本状态”输入格式不正确"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的版本状态输入格式不正确"); } fieldx222.setVerisonStatus(excelInfo.getVerisonStatus()); @@ -597,7 +607,7 @@ public class FieldxController extends JeecgController { fieldx222.setRull(excelInfo.getRule()); if (!StringUtils.isEmpty(excelInfo.getLength())) fieldx222.setLength(excelInfo.getLength()); - list.add(fieldx222); + fieldx222Service.save(fieldx222); } } @@ -607,7 +617,6 @@ public class FieldxController extends JeecgController { message.put("status", "正在上传"); webSocketUtils.sendMessage(loginUser.getId(), message); - fieldx222Service.saveBatch(list); List list222 = fieldx222Service.list(); message.put("records", String.valueOf(list222.size())); webSocketUtils.sendMessage(loginUser.getId(), message);