Merge remote-tracking branch 'origin/dev_2307' into dev_2307

dev^2
zjh 1 year ago
commit 862ee3c6ad
  1. 2
      ant-design-vue-jeecg/src/views/modulex/ModulexList.vue
  2. 14
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java
  3. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/entity/Fieldx.java
  4. 20
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java
  5. 75
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/controller/TablexController.java

@ -575,7 +575,7 @@ export default {
'表名(非空): 请填写实体表的名称',
'中文名称(非空): 请填写字段名称',
'英文名称(非空): 请填写字段名称的英语名称',
'数据类型(非空): 请填写数据类型,{char,varchar,int}这些等等,具体可以查看数据字典',
'数据类型(非空): 请填写数据类型,大写{CHAR,VARCHAR,INT}这些等等,具体可以查看数据字典',
'数据长度: 请填写该字段对应的长度',
'浮点精度: 请填写浮点精度',
'显示形式: 请填写该字段显示的形式',

@ -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<Fieldx, IFieldxService> {
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<Fieldx, IFieldxService> {
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<Fieldx, IFieldxService> {
}
fieldx222.setFieldName(excelInfo.getFieldName());
LambdaQueryWrapper<Fieldx> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(Fieldx::getTableId,fieldx222.getTableId()).eq(Fieldx::getFieldName,fieldx222.getFieldName());
List<Fieldx> 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) + "的”英文名称”不能为空");

@ -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;
/**英文名称*/

@ -390,6 +390,9 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> 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<ModulexMapper, Modulex> 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<ModulexMapper, Modulex> 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();

@ -293,7 +293,7 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
message.put("uploaded", "0");
message.put("status", "判断文件结构");
message.put("isError", "false");
message.put("closeable","false");
message.put("closeable", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
try {
@ -303,8 +303,8 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
(!originalFilename.endsWith("xls") &&
!originalFilename.endsWith("xlsx"))) {
message.put("isError", "true");
message.put("status","文件格式不正确");
message.put("closeable","true");
message.put("status", "文件格式不正确");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("文件格式不正确");
}
@ -320,16 +320,16 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
list = ExcelImportUtil.importExcel(file.getInputStream(), TablexVo.class, params);
} catch (Exception e) {
message.put("isError", "true");
message.put("status","文件读取失败");
message.put("closeable","true");
message.put("status", "文件读取失败");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("文件读取失败");
}
//判断文件中是否存在数据
if (list == null || list.size() == 0) {
message.put("isError", "true");
message.put("status","Excel数据为空");
message.put("closeable","true");
message.put("status", "Excel数据为空");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("Excel数据为空");
}
@ -363,8 +363,8 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
if (voList.size() == 0) {
message.put("isError", "true");
message.put("status","导入失败,数据为空");
message.put("closeable","true");
message.put("status", "导入失败,数据为空");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,数据为空");
}
@ -382,20 +382,20 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
String moduleId = voList.get(i).getModuleId();
if (moduleId == null || moduleId.equals("")) {
message.put("isError", "true");
message.put("status","导入失败,对应模块填写不能为空");
message.put("closeable","true");
message.put("status", "导入失败,对应模块填写不能为空");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("对应模块填写不能为空");
}
//判断实体是否已存在
LambdaQueryWrapper<Tablex> query = new LambdaQueryWrapper<>();
query.eq(Tablex::getModuleId,voList.get(i).getModuleId());
query.eq(Tablex::getModuleId, voList.get(i).getModuleId());
Tablex tablex1 = tablexService.getOne(query);
if (tablex1 != null){
if (tablex1 != null) {
message.put("isError", "true");
message.put("status","导入失败,第" + (i + 1) + "条的实体已存在");
message.put("closeable","true");
message.put("status", "导入失败,第" + (i + 1) + "条的实体已存在");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + (i + 1) + "条的实体已存在");
}
@ -405,8 +405,8 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
Modulex modulex = modulexService.getOne(queryWrapper);
if (modulex == null) {
message.put("isError", "true");
message.put("status","导入失败,对应模块填写错误");
message.put("closeable","true");
message.put("status", "导入失败,对应模块填写错误");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("对应模块填写错误");
}
@ -421,19 +421,19 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
//int verisonStatusInt = verisonStatus.equals("当前") ? 1 : verisonStatus.equals("历史") ? 0 : 3;
//判断版本号
if(voList.get(i).getVerison() == null || voList.get(i).getVerison().equals("")){
if (voList.get(i).getVerison() == null || voList.get(i).getVerison().equals("")) {
message.put("isError", "true");
message.put("status","导入失败,第" + (i + 1) + "条的版本号填写不能为空!");
message.put("closeable","true");
message.put("status", "导入失败,第" + (i + 1) + "条的版本号填写不能为空!");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + (i + 1) + "条的版本号填写不能为空!");
}
//判断版本号是否为正整数且长度不能大于5
if (!voList.get(i).getVerison().matches("^[0-9]*[1-9][0-9]*$") || voList.get(i).getVerison().length() > 5){
if (!voList.get(i).getVerison().matches("^[0-9]*[1-9][0-9]*$") || voList.get(i).getVerison().length() > 5) {
message.put("isError", "true");
message.put("status","导入失败,第" + (i + 1) + "条的版本状态填写错误!");
message.put("closeable","true");
message.put("status", "导入失败,第" + (i + 1) + "条的版本状态填写错误!");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + (i + 1) + "条的版本状态填写错误!");
}
@ -460,41 +460,42 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
tablex.setCreateBy(loginUser.getRealname());
tablex.setStatus(Integer.valueOf(voList.get(i).getStatus()));
tablex.setVerisonStatus(Integer.valueOf(voList.get(i).getVerisonStatus()));
tablex.setTableStructure("CREATE TABLE '" + voList.get(i).getTableEnName() + "' ();");
tablexList.add(tablex);
} else {
message.put("isError", "true");
message.put("status","导入失败,第" + (i + 1) + "条的版本状态填写错误!");
message.put("closeable","true");
message.put("status", "导入失败,第" + (i + 1) + "条的版本状态填写错误!");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + (i + 1) + "条的版本状态填写错误!");
}
} else {
message.put("isError", "true");
message.put("status","导入失败,第" + (i + 1) + "条的实体状态填写错误!");
message.put("closeable","true");
message.put("status", "导入失败,第" + (i + 1) + "条的实体状态填写错误!");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + (i + 1) + "条的实体状态填写错误!");
}
} else {
message.put("isError", "true");
message.put("status","导入失败,第" + (i + 1) + "条的英文名称填写错误!");
message.put("closeable","true");
message.put("status", "导入失败,第" + (i + 1) + "条的英文名称填写错误!");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + (i + 1) + "条的英文名称填写错误!");
}
} else {
message.put("isError", "true");
message.put("status","导入失败,第" + (i + 1) + "条的中文名称填写错误!");
message.put("closeable","true");
message.put("status", "导入失败,第" + (i + 1) + "条的中文名称填写错误!");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + (i + 1) + "条的中文名称填写错误!");
}
} else {
message.put("isError", "true");
message.put("status","导入失败,第" + (i + 1) + "条的对应模块填写错误!");
message.put("closeable","true");
message.put("status", "导入失败,第" + (i + 1) + "条的对应模块填写错误!");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + (i + 1) + "条的对应模块填写错误!");
}
@ -506,15 +507,15 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
tablexService.saveSingleBatch(tablexList, loginUser, message);
message.put("status", "上传成功");
message.put("closeable","true");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
} catch (Exception e) {
message.put("isError", "true");
message.put("status","文件导入失败");
message.put("closeable","true");
message.put("status", "文件导入失败");
message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message);
log.error(e.getMessage(),e);
log.error(e.getMessage(), e);
return Result.error("文件导入失败");
}
return Result.ok("文件导入成功!");

Loading…
Cancel
Save