|
@@ -1,5 +1,6 @@
|
|
|
package org.springblade.manager.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -12,6 +13,7 @@ import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.jsoup.nodes.Element;
|
|
|
import org.jsoup.select.Elements;
|
|
|
+import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
@@ -28,6 +30,7 @@ import org.springblade.manager.mapper.*;
|
|
|
import org.springblade.manager.service.ITableInfoService;
|
|
|
import org.springblade.manager.service.IWbsTreePrivateService;
|
|
|
import org.springblade.manager.vo.*;
|
|
|
+import org.springblade.system.cache.ParamCache;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
@@ -37,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
+import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.Callable;
|
|
@@ -1535,7 +1539,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public R addWbsTreeProjectInfo(String primaryKeyIds, String projectId) {
|
|
|
+ public R addWbsTreeProjectInfo(String primaryKeyIds, String projectId) throws IOException {
|
|
|
if (com.alibaba.cloud.commons.lang.StringUtils.isEmpty(projectId)) {
|
|
|
return R.fail("projectId不能为空");
|
|
|
}
|
|
@@ -1545,11 +1549,44 @@ 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 (StringUtils.isNotEmpty(wbsTreePrivate.getExcelId().toString())) {
|
|
|
+ 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 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
wbsPrivate.setTableOwner(tableInfo.getTableOwner());
|
|
|
wbsPrivate.setInitTableId(tableInfo.getId() + "");
|
|
@@ -1633,9 +1670,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
wbsTree.setInitTableId(tableInfo.getId());
|
|
|
wbsTree.setFillRate(tableInfo.getFillRate());
|
|
|
wbsTree.setTableOwner(tableInfo.getTableOwner());
|
|
|
-
|
|
|
wbsTree.setWbsId(wbsId);
|
|
|
-
|
|
|
wbsTreeMapper.updateById(wbsTree);
|
|
|
} else if (type.equals("2")) {
|
|
|
TableInfo tableInfo = tableInfoService.getById(tabId);
|