|
@@ -1542,63 +1542,65 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
}
|
|
|
|
|
|
List<Long> longs = Func.toLongList(primaryKeyIds);
|
|
|
- for (Long id : longs) {
|
|
|
- //获取添加的表信息
|
|
|
- TableInfo tableInfo = tableInfoService.getById(id);
|
|
|
- WbsTreePrivate wbsPrivate = new WbsTreePrivate();
|
|
|
- Long pKeyId1 = SnowFlakeUtil.getId();
|
|
|
- wbsPrivate.setPKeyId(pKeyId1);
|
|
|
- //查询wbs_tree_contract当前项目下是否已存在相同表
|
|
|
- WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(new LambdaQueryWrapper<WbsTreePrivate>()
|
|
|
- .eq(WbsTreePrivate::getProjectId, projectId)
|
|
|
- .eq(WbsTreePrivate::getInitTableName, tableInfo.getTabEnName())
|
|
|
- .orderByDesc(WbsTreePrivate::getUpdateTime)
|
|
|
- .last("limit 1"));
|
|
|
- //如果存在则复制最新表的配置,调整表单的值
|
|
|
- if (wbsTreePrivate != null) {
|
|
|
-
|
|
|
- if (wbsTreePrivate.getExcelId() != null) {
|
|
|
- if (StringUtils.isNotEmpty(wbsTreePrivate.getExcelId() + "")) {
|
|
|
- wbsPrivate.setExcelId(wbsTreePrivate.getExcelId());
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(wbsTreePrivate.getHtmlUrl())) {
|
|
|
- //复制生成html
|
|
|
- String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
- File file_in = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
|
|
|
+ if (longs != null && longs.size() > 0) {
|
|
|
+ for (Long id : longs) {
|
|
|
+ //获取添加的表信息
|
|
|
+ TableInfo tableInfo = tableInfoService.getById(id);
|
|
|
+ WbsTreePrivate wbsPrivate = new WbsTreePrivate();
|
|
|
+ Long pKeyId1 = SnowFlakeUtil.getId();
|
|
|
+ wbsPrivate.setPKeyId(pKeyId1);
|
|
|
+ //查询wbs_tree_contract当前项目下是否已存在相同表
|
|
|
+ WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(new LambdaQueryWrapper<WbsTreePrivate>()
|
|
|
+ .eq(WbsTreePrivate::getProjectId, projectId)
|
|
|
+ .eq(WbsTreePrivate::getInitTableName, tableInfo.getTabEnName())
|
|
|
+ .orderByDesc(WbsTreePrivate::getUpdateTime)
|
|
|
+ .last("limit 1"));
|
|
|
+ //如果存在则复制最新表的配置,调整表单的值
|
|
|
+ if (wbsTreePrivate != null) {
|
|
|
+
|
|
|
+ if (wbsTreePrivate.getExcelId() != null) {
|
|
|
+ if (StringUtils.isNotEmpty(wbsTreePrivate.getExcelId() + "")) {
|
|
|
+ wbsPrivate.setExcelId(wbsTreePrivate.getExcelId());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(wbsTreePrivate.getHtmlUrl())) {
|
|
|
+ //复制生成html
|
|
|
+ String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ File file_in = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
|
|
|
// File file_in = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1636553444422582272.html");
|
|
|
- String filecode = SnowFlakeUtil.getId() + "";
|
|
|
- String thmlUrl = file_path + "/privateUrl/" + filecode + ".html";
|
|
|
+ String filecode = SnowFlakeUtil.getId() + "";
|
|
|
+ String thmlUrl = file_path + "/privateUrl/" + filecode + ".html";
|
|
|
// String thmlUrl = "C:\\Users\\泓创研发01\\Desktop\\privateUrl\\9527.html";
|
|
|
- File file_out = ResourceUtil.getFile(thmlUrl);
|
|
|
- FileUtil.copy(file_in, file_out);
|
|
|
- wbsPrivate.setHtmlUrl(thmlUrl);
|
|
|
- }
|
|
|
- List<TextdictInfo> list = textDictInfoService.list(new LambdaQueryWrapper<TextdictInfo>()
|
|
|
- .eq(TextdictInfo::getTabId, wbsTreePrivate.getPKeyId()));
|
|
|
- if (list.size() >= 0) {
|
|
|
- list.stream().forEach(l -> {
|
|
|
- l.setId(SnowFlakeUtil.getId());
|
|
|
- l.setTabId(wbsPrivate.getPKeyId().toString());
|
|
|
- });
|
|
|
- textDictInfoService.saveBatch(list);
|
|
|
+ File file_out = ResourceUtil.getFile(thmlUrl);
|
|
|
+ FileUtil.copy(file_in, file_out);
|
|
|
+ wbsPrivate.setHtmlUrl(thmlUrl);
|
|
|
+ }
|
|
|
+ List<TextdictInfo> list = textDictInfoService.list(new LambdaQueryWrapper<TextdictInfo>()
|
|
|
+ .eq(TextdictInfo::getTabId, wbsTreePrivate.getPKeyId()));
|
|
|
+ if (list.size() >= 0) {
|
|
|
+ list.stream().forEach(l -> {
|
|
|
+ l.setId(SnowFlakeUtil.getId());
|
|
|
+ l.setTabId(wbsPrivate.getPKeyId().toString());
|
|
|
+ });
|
|
|
+ textDictInfoService.saveBatch(list);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- wbsPrivate.setTableOwner(tableInfo.getTableOwner());
|
|
|
- wbsPrivate.setInitTableId(tableInfo.getId() + "");
|
|
|
- wbsPrivate.setTableType(tableInfo.getTabType());
|
|
|
- wbsPrivate.setInitTableName(tableInfo.getTabEnName());
|
|
|
- wbsPrivate.setNodeName(tableInfo.getTabChName());
|
|
|
- wbsPrivate.setFullName(tableInfo.getTabChName());
|
|
|
- wbsPrivate.setFillRate(tableInfo.getFillRate());
|
|
|
- wbsPrivate.setProjectId(projectId);
|
|
|
- wbsPrivate.setType(10);//带过来的元素信息
|
|
|
- wbsPrivate.setParentId(-10L);
|
|
|
- wbsPrivate.setStatus(1);
|
|
|
- wbsTreePrivateMapper.insert(wbsPrivate);
|
|
|
+ wbsPrivate.setTableOwner(tableInfo.getTableOwner());
|
|
|
+ wbsPrivate.setInitTableId(tableInfo.getId() + "");
|
|
|
+ wbsPrivate.setTableType(tableInfo.getTabType());
|
|
|
+ wbsPrivate.setInitTableName(tableInfo.getTabEnName());
|
|
|
+ wbsPrivate.setNodeName(tableInfo.getTabChName());
|
|
|
+ wbsPrivate.setFullName(tableInfo.getTabChName());
|
|
|
+ wbsPrivate.setFillRate(tableInfo.getFillRate());
|
|
|
+ wbsPrivate.setProjectId(projectId);
|
|
|
+ wbsPrivate.setType(10);//带过来的元素信息
|
|
|
+ wbsPrivate.setParentId(-10L);
|
|
|
+ wbsPrivate.setStatus(1);
|
|
|
+ wbsTreePrivateMapper.insert(wbsPrivate);
|
|
|
/* }else{
|
|
|
return R.success("没有查到主库信息");
|
|
|
}*/
|
|
|
+ }
|
|
|
}
|
|
|
return R.success("添加成功");
|
|
|
}
|