|
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
|
|
@@ -28,7 +29,6 @@ import org.springblade.business.dto.CustomAddContractNodeDTO;
|
|
|
import org.springblade.business.dto.ImportTreeDto;
|
|
|
import org.springblade.business.dto.WbsTreeContractStatisticsDTO;
|
|
|
import org.springblade.business.dto.FlushQueryNameDTO;
|
|
|
-import org.springblade.business.dto.FlushQueryNameDTO;
|
|
|
import org.springblade.business.dto.PreviewNodeNameDTO;
|
|
|
import org.springblade.business.dto.PreviewNodeNameDTO1;
|
|
|
import org.springblade.business.entity.*;
|
|
@@ -68,6 +68,7 @@ import org.springblade.manager.vo.WbsTreeContractVO8;
|
|
|
import org.springblade.manager.vo.WbsTreePrivateAddVO;
|
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
|
import org.springblade.system.cache.ParamCache;
|
|
|
+import org.springblade.system.entity.Dept;
|
|
|
import org.springblade.system.entity.DictBiz;
|
|
|
import org.springblade.system.feign.IDictBizClient;
|
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
@@ -87,6 +88,9 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
import java.io.*;
|
|
|
import java.net.URLEncoder;
|
|
|
+import java.nio.file.Files;
|
|
|
+import java.nio.file.Path;
|
|
|
+import java.nio.file.StandardCopyOption;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
@@ -113,6 +117,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
private final ContractClient contractClient;
|
|
|
|
|
|
private final WbsTreeContractClient wbsTreeContractClient;
|
|
|
+ private final WbsTreeContractOldHtmlClient wbsTreeContractOldHtmlClient;
|
|
|
|
|
|
private final WbsTreePrivateClient wbsTreePrivateClient;
|
|
|
|
|
@@ -159,6 +164,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
private final IRecycleBinService recycleBinService;
|
|
|
private final WbsTreeContractStatisticsClientImpl wbsTreeContractStatisticsClient;
|
|
|
private final IRecycleBinInfoService recycleBinInfoService;
|
|
|
+ private final INodeBaseInfoServiceClient nodeBaseInfoServiceClient;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
@@ -217,7 +223,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
String sgSuffix="";
|
|
|
String jlSuffix="";
|
|
|
if(queryList.size()>0){
|
|
|
- String sql1="Select sg_suffix,jl_suffix from m_project_info where id="+queryList.get(0).getProjectId()+" and is_deleted=0";
|
|
|
+ String sql1="Select sg_suffix,jl_suffix,template_type from m_project_info where id="+queryList.get(0).getProjectId()+" and is_deleted=0";
|
|
|
List<ProjectInfo> projectInfos = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(ProjectInfo.class));
|
|
|
if(projectInfos.size()>0){
|
|
|
sgSuffix=projectInfos.get(0).getSgSuffix()==null?"":projectInfos.get(0).getSgSuffix();
|
|
@@ -228,7 +234,16 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
String sql="select * from m_wbs_tree_contract where p_key_id="+query.getWbsId()+" and is_deleted=0";
|
|
|
WbsTreeContract contract = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
if(dto.getType()==1){
|
|
|
- result=wbsParamClient.createFileTitle(contract);
|
|
|
+ R<List<String>> nameRuleList = wbsParamClient.getNameRuleByPkeyId(contract.getPKeyId(), Long.valueOf(contract.getProjectId()));
|
|
|
+ String nameRule = "";
|
|
|
+ if (nameRuleList != null && nameRuleList.getData() != null && !nameRuleList.getData().isEmpty()) {
|
|
|
+ nameRule = String.join("-", nameRuleList.getData());
|
|
|
+ }
|
|
|
+ if(projectInfos.get(0)!=null&&projectInfos.get(0).getTemplateType()==2){
|
|
|
+ result = nodeBaseInfoServiceClient.getNameRuleByRule(nameRule, contract.getPKeyId()+"");
|
|
|
+ }else {
|
|
|
+ result=wbsParamClient.createFileTitle(contract);
|
|
|
+ }
|
|
|
}else {
|
|
|
result=nodeNameMap.get(query.getId());
|
|
|
//同时修改工程划分节点命名规则
|
|
@@ -262,6 +277,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
return R.status(this.informationQueryService.updateBatchById(queryList));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
public List<String> getNameRuleByPkeyId(Long pKeyId, Long projectId) {
|
|
|
NameRuleVo vo = new NameRuleVo();
|
|
|
String sql2="select * from m_wbs_param where node_id="+pKeyId+" and type=200"+" and is_deleted=0 and k='FILE_TITLE'";
|
|
@@ -393,13 +409,14 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
if(StringUtils.isEmpty(dto1.getNameRule())){
|
|
|
throw new ServiceException("请输入题名规则");
|
|
|
}
|
|
|
- String sql="select p_key_id,ancestors_p_id from m_wbs_tree_contract where p_key_id="+dto1.getWbsId()+" and is_deleted=0";
|
|
|
- WbsTreeContract contract = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
- String result="";
|
|
|
- if(contract!=null){
|
|
|
- result= createFileTitle(contract, dto1.getNameRule());
|
|
|
- }
|
|
|
- list.add(new PreviewNodeNameVO1(dto1.getWbsId(),result));
|
|
|
+ String result=nodeBaseInfoServiceClient.getNameRuleByRule(dto1.getNameRule(),dto1.getWbsId());
|
|
|
+// String sql="select p_key_id,ancestors_p_id from m_wbs_tree_contract where p_key_id="+dto1.getWbsId()+" and is_deleted=0";
|
|
|
+// WbsTreeContract contract = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
+// String result="";
|
|
|
+// if(contract!=null){
|
|
|
+// result= createFileTitle(contract, dto1.getNameRule());
|
|
|
+// }
|
|
|
+ list.add(new PreviewNodeNameVO1(dto1.getWbsId(),result.toString()));
|
|
|
}
|
|
|
return R.data(list);
|
|
|
}
|
|
@@ -414,7 +431,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
WbsTreeContract contract = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
String result="";
|
|
|
if(nameRules!=null){
|
|
|
- result= createFileTitle(contract, String.join("-", nameRules));
|
|
|
+ result = nodeBaseInfoServiceClient.getNameRuleByRule(String.join("-", nameRules), contract.getPKeyId() + "");
|
|
|
}
|
|
|
list.add(new PreviewNodeNameVO(dto.getWbsId(),result,nameRules));
|
|
|
}
|
|
@@ -1214,8 +1231,48 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
return R.data(300, false, "未查询到填报信息,上报失败");
|
|
|
}
|
|
|
} else { //质检
|
|
|
+ //记录选中节点的所有表单旧html
|
|
|
+ List<Long> list = Arrays.stream(startTaskVO.getIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
|
|
+ List<WbsTreeContract> wbsTreeContracts = wbsTreeContractClient.queryListByPIds(list,startTaskVO.getClassify());
|
|
|
+
|
|
|
+
|
|
|
businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, startTaskVO.getIds().replaceAll(",", "")).eq(InformationQuery::getClassify, startTaskVO.getClassify().toString()).eq(InformationQuery::getType, 1).last("order by id desc limit 1"));
|
|
|
if (businessData != null) {
|
|
|
+
|
|
|
+ //处理html 复制之后记录在新表中w
|
|
|
+ if (CollectionUtils.isNotEmpty(wbsTreeContracts)) {
|
|
|
+ List<WbsTreeContractOldHtml> data = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ for (WbsTreeContract wbsTreeContract : wbsTreeContracts) {
|
|
|
+ ExcelTab byId = excelTabClient.getById(String.valueOf(wbsTreeContract.getExcelId()));
|
|
|
+ WbsTreeContractOldHtml oldHtml = new WbsTreeContractOldHtml();
|
|
|
+ oldHtml.setId(SnowFlakeUtil.getId());
|
|
|
+ oldHtml.setCreateUser(getUser().getUserId());
|
|
|
+ String htmlUrl = wbsTreeContract.getHtmlUrl();
|
|
|
+ // 获取或下载文件
|
|
|
+ Path sourcePath = FileUtils.getOrDownloadFile(htmlUrl);
|
|
|
+ // 生成副本路径
|
|
|
+ Path copyPath = FileUtils.generateCopyPath(sourcePath,wbsTreeContract.getPKeyId());
|
|
|
+ // 执行复制操作(覆盖已存在的文件)
|
|
|
+ Files.copy(sourcePath, copyPath, StandardCopyOption.REPLACE_EXISTING);
|
|
|
+
|
|
|
+ oldHtml.setContractFormId(wbsTreeContract.getPKeyId());
|
|
|
+ oldHtml.setOldHtmlUrl(copyPath.toFile().getAbsolutePath());
|
|
|
+ //记录历史excel路径
|
|
|
+ oldHtml.setOldExcelUrl(byId.getFileUrl());
|
|
|
+ data.add(oldHtml);
|
|
|
+ }
|
|
|
+ List<Long> collect = data.stream().map(WbsTreeContractOldHtml::getContractFormId).collect(Collectors.toList());
|
|
|
+ //删除旧记录
|
|
|
+ wbsTreeContractOldHtmlClient.deleteByContractFormIds(collect);
|
|
|
+
|
|
|
+ wbsTreeContractOldHtmlClient.save(data);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new ServiceException(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//设置业务数据ID
|
|
|
startTaskVO.setIds(businessData.getId().toString());
|
|
|
return this.batchTask(startTaskVO);
|
|
@@ -1388,6 +1445,7 @@ public R<String> batchDownloadFileToZip(String ids, HttpServletResponse response
|
|
|
/* result.forEach(query -> urls.add(
|
|
|
StringUtils.isNotEmpty(query.getNodePdfUrl()) ? query.getNodePdfUrl() + "@@@" + query.getName() + "-" + query.getId() : query.getPdfUrl() + "@@@" + query.getName() + "-" + query.getId()));
|
|
|
*/
|
|
|
+ Map<String, Integer> nameMap = new HashMap<>();
|
|
|
for (int i=0;i<result.size();i++) {
|
|
|
String url_link = "";
|
|
|
List<TaskApprovalVO.ApprovalFile> files = jdbcTemplate.query("select name as fileName,domain_url as fileUrl from m_table_file where is_deleted = 0 and type in(10,11,12)and tab_id = ?", new BeanPropertyRowMapper<>(TaskApprovalVO.ApprovalFile.class), result.get(i).getWbsId());
|
|
@@ -1415,7 +1473,16 @@ public R<String> batchDownloadFileToZip(String ids, HttpServletResponse response
|
|
|
} else if (url != null && url.size() == 1) {
|
|
|
url_link = url.get(0);
|
|
|
}
|
|
|
- urls.add(url_link + "@@@" + result.get(i).getName() + "-" + result.get(i).getId());
|
|
|
+ String fileName = result.get(i).getName();
|
|
|
+ fileName = fileName == null ? "找不到文件题目" : fileName.replaceAll("\\\\", "_").replaceAll("/", "_");
|
|
|
+ if (nameMap.containsKey(fileName)) {
|
|
|
+ int num = nameMap.get(fileName) == null ? 1 : nameMap.get(fileName);
|
|
|
+ nameMap.put(fileName, num + 1);
|
|
|
+ fileName = fileName + "_" + num;
|
|
|
+ } else {
|
|
|
+ nameMap.put(fileName, 1);
|
|
|
+ }
|
|
|
+ urls.add(url_link + "@@@" + fileName);
|
|
|
}
|
|
|
|
|
|
//删除空数据
|
|
@@ -1985,7 +2052,6 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
|
|
|
.filter(ObjectUtil::isNotEmpty)
|
|
|
.distinct()
|
|
|
.collect(Collectors.toList());
|
|
|
- //表名集合转逗号拼接的字符串
|
|
|
if (!tabNames.isEmpty()) {
|
|
|
String inClausePlaceholders = String.join(",", Collections.nCopies(tabNames.size(), "?"));
|
|
|
String sql = "SELECT table_name AS queryType, GROUP_CONCAT(COLUMN_name) AS ancestors " +
|
|
@@ -2229,6 +2295,29 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
|
|
|
if (StringUtils.isEmpty(contractId)) {
|
|
|
contractId = toCopyNode.getContractId();
|
|
|
}
|
|
|
+ String userRole = AuthUtil.getUserRole();
|
|
|
+ if(!"administrator".equals(userRole) && vo.getIsCopyData() == 1){
|
|
|
+ // 查询当前节点有没有数据,有数据则不能复制
|
|
|
+ if(vo.getClassifyType() != null && !vo.getClassifyType().isEmpty()) {
|
|
|
+ List<InformationQuery> queries = informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getContractId, contractId)
|
|
|
+ .in(InformationQuery::getClassify, vo.getClassifyType()).eq(InformationQuery::getWbsId, toCopyNode.getPKeyId()).in(InformationQuery::getStatus, 1, 2));
|
|
|
+ if (!queries.isEmpty()) {
|
|
|
+ Map<Integer, List<InformationQuery>> map = queries.stream().collect(Collectors.groupingBy(InformationQuery::getClassify));
|
|
|
+ if (vo.getClassifyType().contains("1")) {
|
|
|
+ List<InformationQuery> queryList = map.get(1);
|
|
|
+ if (queryList != null && !queryList.isEmpty()) {
|
|
|
+ throw new ServiceException(toCopyNode.getFullName() + "节点有施工上报数据,不允许复制");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (vo.getClassifyType().contains("2")) {
|
|
|
+ List<InformationQuery> queryList = map.get(2);
|
|
|
+ if (queryList != null && !queryList.isEmpty()) {
|
|
|
+ throw new ServiceException(toCopyNode.getFullName() + "节点有监理上报数据,不允许复制");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
WbsTreeContract needCopyNodeRoot = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
|
|
@@ -2719,8 +2808,8 @@ private List<WbsTreeContract> reBuildAncestors(List<WbsTreeContract> list) {
|
|
|
public void addCopyTabFile(Set<WbsTreeContract> addChildNodesTables,
|
|
|
Set<WbsTreeContract> addChildNodesTablesOld) {
|
|
|
//获取所有数据源附件文件
|
|
|
- List<Long> tabFileIds = addChildNodesTablesOld.stream().distinct().map(WbsTreeContract::getPKeyId).collect(Collectors.toList());
|
|
|
- Map<String, List<TableFile>> tableFileOldMap = tableFileClient.getTabFilesByTabIds(StringUtils.join(tabFileIds, ",")).stream().collect(Collectors.groupingBy(TableFile::getTabId));
|
|
|
+ List<String> tabFileIds = addChildNodesTablesOld.stream().distinct().map(item -> item.getPKeyId() + "").collect(Collectors.toList());
|
|
|
+ Map<String, List<TableFile>> tableFileOldMap = tableFileClient.getTabFilesByTabIds(tabFileIds).stream().collect(Collectors.groupingBy(TableFile::getTabId));
|
|
|
if (tableFileOldMap != null && tableFileOldMap.size() > 0) {
|
|
|
List<TableFile> resultFileData = new ArrayList<>();
|
|
|
Set<Long> updatePKeyIds = new HashSet<>();
|
|
@@ -3056,7 +3145,7 @@ private void addCopyNodesAndTabsBuildData(List<WbsTreeContract> addNodeList, Lis
|
|
|
List<String> initTabNames = needTabs.stream().map(WbsTreeContract::getInitTableName).distinct().filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
|
|
|
String joined = StringUtils.join(initTabNames, ",");
|
|
|
joined = "'" + joined.replaceAll(",", "','") + "'";
|
|
|
- Map<String, QueryProcessDataVO> tabColsAllByTabNameMaps = jdbcTemplate.query("SELECT table_name as queryType, GROUP_CONCAT(COLUMN_name) as ancestors from information_schema.COLUMNS where table_name in (" + joined + ") GROUP BY table_name", new BeanPropertyRowMapper<>(QueryProcessDataVO.class)).stream().collect(Collectors.toMap(QueryProcessDataVO::getQueryType, Function.identity()));
|
|
|
+ Map<String, QueryProcessDataVO> tabColsAllByTabNameMaps = jdbcTemplate.query("SELECT table_name as queryType, GROUP_CONCAT(DISTINCT COLUMN_name) as ancestors from information_schema.COLUMNS where table_name in (" + joined + ") GROUP BY table_name", new BeanPropertyRowMapper<>(QueryProcessDataVO.class)).stream().collect(Collectors.toMap(QueryProcessDataVO::getQueryType, Function.identity()));
|
|
|
for (WbsTreeContract node : needNodes) {
|
|
|
Long oldId = node.getId();
|
|
|
//新节点
|
|
@@ -5248,4 +5337,42 @@ public R<Object> customAddContractNode(@RequestBody CustomAddContractNodeDTO dto
|
|
|
}
|
|
|
throw new IllegalArgumentException("新数据中未找到根节点");
|
|
|
}
|
|
|
+
|
|
|
+ // pdf 检查任务添加
|
|
|
+ /**
|
|
|
+ * 首件wbs 树
|
|
|
+ *
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @GetMapping("/updateCheckPdfInfo")
|
|
|
+ @ApiOperationSupport(order = 40)
|
|
|
+ @ApiOperation(value = "添加pdf检查接口")
|
|
|
+ @ApiImplicitParams(value = {
|
|
|
+ @ApiImplicitParam(name = "type", value = "1:节点添加 2:文件添加",required = true),
|
|
|
+ @ApiImplicitParam(name = "classify", value = "1施工2监理",required = true),
|
|
|
+ @ApiImplicitParam(name = "ids", value = "多个用,拼接", required = true)
|
|
|
+ })
|
|
|
+ public R updateCheckPdfInfo(@RequestParam String type, @RequestParam String ids,@RequestParam String classify) {
|
|
|
+
|
|
|
+ return informationQueryService.updateCheckPdfInfo(type, ids,classify);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 首件wbs 树
|
|
|
+ *
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @GetMapping("/getCheckPdfPaceInfo")
|
|
|
+ @ApiOperationSupport(order = 40)
|
|
|
+ @ApiOperation(value = "添加pdf检查接口")
|
|
|
+ @ApiImplicitParams(value = {
|
|
|
+ @ApiImplicitParam(name = "type", value = "1:节点添加 2:文件添加",required = true),
|
|
|
+ @ApiImplicitParam(name = "classify", value = "1施工2监理",required = true),
|
|
|
+ @ApiImplicitParam(name = "ids", value = "多个用,拼接", required = true)
|
|
|
+ })
|
|
|
+ public R<ChekPdfPaceVo> getCheckPdfPaceInfo(@RequestParam String contractId,@RequestParam String classify) {
|
|
|
+
|
|
|
+ ChekPdfPaceVo checkPdfPaceInfo = informationQueryService.getCheckPdfPaceInfo(contractId, classify);
|
|
|
+ return R.data(checkPdfPaceInfo);
|
|
|
+ }
|
|
|
}
|