diff --git a/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue b/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue index 1642c37..e1c9c7d 100644 --- a/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue +++ b/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue @@ -575,7 +575,7 @@ export default { '表名(非空): 请填写实体表的名称', '中文名称(非空): 请填写字段名称', '英文名称(非空): 请填写字段名称的英语名称', - '数据类型(非空): 请填写数据类型,{char,varchar,int}这些等等,具体可以查看数据字典', + '数据类型(非空): 请填写数据类型,大写{CHAR,VARCHAR,INT}这些等等,具体可以查看数据字典', '数据长度: 请填写该字段对应的长度', '浮点精度: 请填写浮点精度', '显示形式: 请填写该字段显示的形式', 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 e8fb418..d7dfab5 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 @@ -8,6 +8,7 @@ import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import com.aliyuncs.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; @@ -436,6 +437,7 @@ public class FieldxController extends JeecgController { if (StringUtils.isEmpty(String.valueOf(cell))) { break; } + ExcelInfo excelInfo = new ExcelInfo(); excelInfo.setcells(cells); Fieldx222 fieldx222 = new Fieldx222(); @@ -455,6 +457,7 @@ public class FieldxController extends JeecgController { fieldx222Service.remove(null); return Result.error("序号为" + (r - 2) + "的中文名称不能为空"); } + fieldx222.setFieldName(excelInfo.getFieldName()); Fieldx222 fieldx2221=fieldx222Service.query().eq("field_name",excelInfo.getFieldName()).one(); if(fieldx2221!=null){ message.put("isError", "true"); @@ -466,6 +469,17 @@ public class FieldxController extends JeecgController { } fieldx222.setFieldName(excelInfo.getFieldName()); + LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.eq(Fieldx::getTableId,fieldx222.getTableId()).eq(Fieldx::getFieldName,fieldx222.getFieldName()); + List list=fieldxService.list(queryWrapper); + if(list!=null&&list.size()!=0){ + 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.getFieldEnName())) { message.put("isError", "true"); message.put("status","序号为" + (r - 2) + "的”英文名称”不能为空"); diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/entity/Fieldx.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/entity/Fieldx.java index d511012..98a281e 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/entity/Fieldx.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/entity/Fieldx.java @@ -41,7 +41,7 @@ public class Fieldx implements Serializable { @Dict(dictTable="tablex",dicText = "table_name",dicCode = "id") private java.lang.String tableId; /**中文名称*/ - @Excel(name = "中文名称", width = 15) + @Excel(name = "中文名称", width = 15,dicCode = "field_name") @ApiModelProperty(value = "中文名称") private java.lang.String fieldName; /**英文名称*/ diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java index a62b731..0245d2a 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java @@ -390,6 +390,9 @@ public class ModulexServiceImpl extends ServiceImpl impl if (j == 2) { for (int k = 0; k < physicalNumberOfCells; k++) { Cell cell = row.getCell(k); + if(cell==null){ + propertyNames.add(null); + } String name = cell.getStringCellValue(); propertyNames.add(name); } @@ -425,6 +428,13 @@ public class ModulexServiceImpl extends ServiceImpl impl int annual = 0; for (int k = 0; k < physicalNumberOfCells; k++) { Cell cell = row.getCell(k); + if(cell==null){ + message.put("isError", "true"); + message.put("status","表格中有空白单元格,"+"请重新导入"); + message.put("closeable","true"); + webSocketUtils.sendMessage(loginUser.getId(), message); + return Result.error("数据匹配读取失败,"+"请重新导入"); + } String value = cell.getStringCellValue(); switch (k){ case 0: @@ -707,8 +717,14 @@ public class ModulexServiceImpl extends ServiceImpl impl webSocketUtils.sendMessage(loginUser.getId(), message); return Result.error("导入失败,责任人信息查询不到"); } - String strip = org.apache.commons.lang.StringUtils.strip(list.toString(), "[]"); - modulex.setManagerUsers(strip); +// String strip = org.apache.commons.lang.StringUtils.strip(list.toString(), "[]"); + String s = ""; + for (int j = 0; j < list.size(); j++) { + s = s + list.get(j); + if (j < list.size() - 1) + s = s + ","; + } + modulex.setManagerUsers(s); } } String workLevel = modulexTemplate.getWorkLevel();