|
|
@ -300,8 +300,6 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
if (StringUtils.isBlank(originalFilename) || |
|
|
|
if (StringUtils.isBlank(originalFilename) || |
|
|
|
(!originalFilename.endsWith("xls") && |
|
|
|
(!originalFilename.endsWith("xls") && |
|
|
|
!originalFilename.endsWith("xlsx"))) { |
|
|
|
!originalFilename.endsWith("xlsx"))) { |
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("文件格式不正确"); |
|
|
|
return Result.error("文件格式不正确"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -311,20 +309,14 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
params.setHeadRows(1);//表头行数,默认1
|
|
|
|
params.setHeadRows(1);//表头行数,默认1
|
|
|
|
params.setNeedSave(true);//是否需要保存上传的Excel,默认为false
|
|
|
|
params.setNeedSave(true);//是否需要保存上传的Excel,默认为false
|
|
|
|
List<TablexVo> list = null; |
|
|
|
List<TablexVo> list = null; |
|
|
|
message.put("status", "读取数据中"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
//读取excel数据
|
|
|
|
//读取excel数据
|
|
|
|
list = ExcelImportUtil.importExcel(file.getInputStream(), TablexVo.class, params); |
|
|
|
list = ExcelImportUtil.importExcel(file.getInputStream(), TablexVo.class, params); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("文件读取失败"); |
|
|
|
return Result.error("文件读取失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
//判断文件中是否存在数据
|
|
|
|
//判断文件中是否存在数据
|
|
|
|
if (list == null || list.size() == 0) { |
|
|
|
if (list == null || list.size() == 0) { |
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("Excel数据为空"); |
|
|
|
return Result.error("Excel数据为空"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -376,16 +368,12 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
|
|
|
|
|
|
|
|
String moduleId = voList.get(i).getModuleId(); |
|
|
|
String moduleId = voList.get(i).getModuleId(); |
|
|
|
if (moduleId == null || moduleId.equals("")) { |
|
|
|
if (moduleId == null || moduleId.equals("")) { |
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("对应模块填写不能为空"); |
|
|
|
return Result.error("对应模块填写不能为空"); |
|
|
|
} |
|
|
|
} |
|
|
|
LambdaQueryWrapper<Modulex> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
LambdaQueryWrapper<Modulex> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(Modulex::getId, moduleId); |
|
|
|
queryWrapper.eq(Modulex::getId, moduleId); |
|
|
|
Modulex modulex = modulexService.getOne(queryWrapper); |
|
|
|
Modulex modulex = modulexService.getOne(queryWrapper); |
|
|
|
if (modulex == null) { |
|
|
|
if (modulex == null) { |
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("对应模块填写错误"); |
|
|
|
return Result.error("对应模块填写错误"); |
|
|
|
} |
|
|
|
} |
|
|
|
String modulexId = modulex.getId(); |
|
|
|
String modulexId = modulex.getId(); |
|
|
@ -410,6 +398,10 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
if (verisonStatus.equals("1") || verisonStatus.equals("0")) { |
|
|
|
if (verisonStatus.equals("1") || verisonStatus.equals("0")) { |
|
|
|
//判断版本号
|
|
|
|
//判断版本号
|
|
|
|
if (voList.get(i).getVerison() != null && !voList.get(i).getVerison().equals("")) { |
|
|
|
if (voList.get(i).getVerison() != null && !voList.get(i).getVerison().equals("")) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message.put("status", "数据校验成功"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
|
|
|
|
tablex.setModuleId(voList.get(i).getModuleId()); |
|
|
|
tablex.setModuleId(voList.get(i).getModuleId()); |
|
|
|
tablex.setTableName(voList.get(i).getTableName()); |
|
|
|
tablex.setTableName(voList.get(i).getTableName()); |
|
|
|
tablex.setTableEnName(voList.get(i).getTableEnName()); |
|
|
|
tablex.setTableEnName(voList.get(i).getTableEnName()); |
|
|
@ -422,47 +414,37 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
|
|
|
|
|
|
|
|
tablexList.add(tablex); |
|
|
|
tablexList.add(tablex); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message.put("status", "正在上传"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
|
|
|
|
//单条保存到真实表中
|
|
|
|
//单条保存到真实表中
|
|
|
|
tablexService.saveSingleBatch(tablexList, loginUser, message); |
|
|
|
tablexService.saveSingleBatch(tablexList, loginUser, message); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
message.put("status", "上传成功"); |
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的版本号填写错误!"); |
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的版本号填写错误!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的版本状态填写错误!"); |
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的版本状态填写错误!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的实体状态填写错误!"); |
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的实体状态填写错误!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的英文名称填写错误!"); |
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的英文名称填写错误!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的中文名称填写错误!"); |
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的中文名称填写错误!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
/*message.put("isVisible", "false");*/ |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的对应模块填写错误!"); |
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的对应模块填写错误!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("文件导入失败"); |
|
|
|
return Result.error("文件导入失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
/*message.put("isVisible", "false");*/ |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.ok("文件导入成功!"); |
|
|
|
return Result.ok("文件导入成功!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|