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

Loading…
Cancel
Save