|
|
@ -311,8 +311,8 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
|
|
|
|
|
|
|
|
//获取上传文件对象
|
|
|
|
//获取上传文件对象
|
|
|
|
ImportParams params = new ImportParams(); |
|
|
|
ImportParams params = new ImportParams(); |
|
|
|
params.setTitleRows(1);//表格标题行数,默认0
|
|
|
|
params.setTitleRows(1);//表格标题条数,默认0
|
|
|
|
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; |
|
|
|
try { |
|
|
|
try { |
|
|
@ -336,8 +336,10 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
|
|
|
|
|
|
|
|
message.put("status", "数据预读入"); |
|
|
|
message.put("status", "数据预读入"); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
Iterator<TablexVo> iterator = list.iterator(); |
|
|
|
|
|
|
|
// for (TablexVo tablexVo : list) {
|
|
|
|
for (TablexVo tablexVo : list) { |
|
|
|
for (TablexVo tablexVo : list) { |
|
|
|
//判断当前存入行是否为空值
|
|
|
|
//判断当前存入条是否为空值
|
|
|
|
if (StringUtils.isBlank(tablexVo.getModuleId()) && |
|
|
|
if (StringUtils.isBlank(tablexVo.getModuleId()) && |
|
|
|
StringUtils.isBlank(tablexVo.getTableName()) && |
|
|
|
StringUtils.isBlank(tablexVo.getTableName()) && |
|
|
|
StringUtils.isBlank(tablexVo.getTableEnName()) && |
|
|
|
StringUtils.isBlank(tablexVo.getTableEnName()) && |
|
|
@ -346,7 +348,8 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
StringUtils.isBlank(tablexVo.getStatus()) && |
|
|
|
StringUtils.isBlank(tablexVo.getStatus()) && |
|
|
|
StringUtils.isBlank(tablexVo.getVerisonStatus()) && |
|
|
|
StringUtils.isBlank(tablexVo.getVerisonStatus()) && |
|
|
|
StringUtils.isBlank(tablexVo.getVerison())) { |
|
|
|
StringUtils.isBlank(tablexVo.getVerison())) { |
|
|
|
list.remove(tablexVo); |
|
|
|
// list.remove(tablexVo);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
//判断版本号长度
|
|
|
|
//判断版本号长度
|
|
|
@ -379,9 +382,11 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
|
|
|
|
|
|
|
|
message.put("status", "开始数据校验"); |
|
|
|
message.put("status", "开始数据校验"); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Tablex> tablexList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < voList.size(); i++) { |
|
|
|
for (int i = 0; i < voList.size(); i++) { |
|
|
|
|
|
|
|
|
|
|
|
List<Tablex> tablexList = new ArrayList<>(); |
|
|
|
|
|
|
|
Tablex tablex = new Tablex(); |
|
|
|
Tablex tablex = new Tablex(); |
|
|
|
|
|
|
|
|
|
|
|
String moduleId = voList.get(i).getModuleId(); |
|
|
|
String moduleId = voList.get(i).getModuleId(); |
|
|
@ -415,9 +420,9 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
//判断对应模块
|
|
|
|
//判断对应模块
|
|
|
|
if (modulexId != null && voList.get(i).getModuleId() != null && !voList.get(i).getModuleId().equals("")) { |
|
|
|
if (modulexId != null && voList.get(i).getModuleId() != null && !voList.get(i).getModuleId().equals("")) { |
|
|
|
//判断中文名称
|
|
|
|
//判断中文名称
|
|
|
|
if (voList.get(i).getTableName() != null && !voList.get(i).getTableName().equals("") && !voList.get(i).getTableName().equals(modulex.getModuleName())) { |
|
|
|
if (voList.get(i).getTableName() != null && !voList.get(i).getTableName().equals("") && voList.get(i).getTableName().equals(modulex.getModuleName())) { |
|
|
|
//判断英文名称
|
|
|
|
//判断英文名称
|
|
|
|
if (voList.get(i).getTableEnName() != null && !voList.get(i).getTableEnName().equals("") && !voList.get(i).getTableEnName().equals(modulex.getModuleEnName())) { |
|
|
|
if (voList.get(i).getTableEnName() != null && !voList.get(i).getTableEnName().equals("") && voList.get(i).getTableEnName().equals(modulex.getModuleEnName())) { |
|
|
|
//判断实体状态
|
|
|
|
//判断实体状态
|
|
|
|
if (status.equals("1") || status.equals("0") || status.equals("9")) { |
|
|
|
if (status.equals("1") || status.equals("0") || status.equals("9")) { |
|
|
|
//判断版本状态
|
|
|
|
//判断版本状态
|
|
|
@ -440,64 +445,65 @@ 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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message.put("status", "上传成功"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("status","导入失败,第" + i + 1 + "行的版本号填写错误!"); |
|
|
|
message.put("status","导入失败,第" + (i + 1) + "条的版本号填写错误!"); |
|
|
|
message.put("closeable","true"); |
|
|
|
message.put("closeable","true"); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的版本号填写错误!"); |
|
|
|
return Result.error("导入失败,第" + (i + 1) + "条的版本号填写错误!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("status","导入失败,第" + i + 1 + "行的版本状态填写错误!"); |
|
|
|
message.put("status","导入失败,第" + (i + 1) + "条的版本状态填写错误!"); |
|
|
|
message.put("closeable","true"); |
|
|
|
message.put("closeable","true"); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的版本状态填写错误!"); |
|
|
|
return Result.error("导入失败,第" + (i + 1) + "条的版本状态填写错误!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("status","导入失败,第" + i + 1 + "行的实体状态填写错误!"); |
|
|
|
message.put("status","导入失败,第" + (i + 1) + "条的实体状态填写错误!"); |
|
|
|
message.put("closeable","true"); |
|
|
|
message.put("closeable","true"); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的实体状态填写错误!"); |
|
|
|
return Result.error("导入失败,第" + (i + 1) + "条的实体状态填写错误!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("status","导入失败,第" + i + 1 + "行的英文名称填写错误!"); |
|
|
|
message.put("status","导入失败,第" + (i + 1) + "条的英文名称填写错误!"); |
|
|
|
message.put("closeable","true"); |
|
|
|
message.put("closeable","true"); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的英文名称填写错误!"); |
|
|
|
return Result.error("导入失败,第" + (i + 1) + "条的英文名称填写错误!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("status","导入失败,第" + i + 1 + "行的中文名称填写错误!"); |
|
|
|
message.put("status","导入失败,第" + (i + 1) + "条的中文名称填写错误!"); |
|
|
|
message.put("closeable","true"); |
|
|
|
message.put("closeable","true"); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的中文名称填写错误!"); |
|
|
|
return Result.error("导入失败,第" + (i + 1) + "条的中文名称填写错误!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("status","导入失败,第" + i + 1 + "行的对应模块填写错误!"); |
|
|
|
message.put("status","导入失败,第" + (i + 1) + "条的对应模块填写错误!"); |
|
|
|
message.put("closeable","true"); |
|
|
|
message.put("closeable","true"); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的对应模块填写错误!"); |
|
|
|
return Result.error("导入失败,第" + (i + 1) + "条的对应模块填写错误!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
message.put("status", "正在上传"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保存到真实表中
|
|
|
|
|
|
|
|
tablexService.saveSingleBatch(tablexList, loginUser, message); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message.put("status", "上传成功"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("status","文件导入失败"); |
|
|
|
message.put("status","文件导入失败"); |
|
|
|
message.put("closeable","true"); |
|
|
|
message.put("closeable","true"); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
log.error(e.getMessage(),e); |
|
|
|
return Result.error("文件导入失败"); |
|
|
|
return Result.error("文件导入失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
return Result.ok("文件导入成功!"); |
|
|
|
return Result.ok("文件导入成功!"); |
|
|
|