|
@@ -20,6 +20,7 @@ import org.springblade.business.feign.MessageWarningClient;
|
|
|
import org.springblade.business.feign.OperationLogClient;
|
|
|
import org.springblade.business.feign.RecycleBinClient;
|
|
|
import org.springblade.business.feign.TaskClient;
|
|
|
+import org.springblade.business.mapper.InformationQueryMapper;
|
|
|
import org.springblade.business.service.*;
|
|
|
import org.springblade.business.socket.WebSocket;
|
|
|
import org.springblade.business.utils.FileUtils;
|
|
@@ -45,6 +46,7 @@ import org.springblade.manager.entity.*;
|
|
|
import org.springblade.manager.feign.*;
|
|
|
import org.springblade.manager.vo.WbsTreeContractLazyVO;
|
|
|
import org.springblade.manager.vo.WbsTreeContractTreeVOS;
|
|
|
+import org.springblade.manager.vo.WbsTreeContractVO8;
|
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
|
import org.springblade.system.cache.ParamCache;
|
|
|
import org.springblade.system.entity.DictBiz;
|
|
@@ -93,6 +95,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
private final IInformationQueryService informationQueryService;
|
|
|
|
|
|
+ private final InformationQueryMapper informationQueryMapper;
|
|
|
+
|
|
|
private final IInformationQueryFileService informationQueryFileService;
|
|
|
|
|
|
private final IDictBizClient dictBizClient;
|
|
@@ -3513,16 +3517,49 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
node = this.wbsTreeContractClient.getContractWbsTreeByContractIdAndId(vo.getWbsId(), Long.parseLong(vo.getContractIdRelation()));
|
|
|
}
|
|
|
List<QueryProcessDataVO> queryDataResult = new ArrayList<>();
|
|
|
+ List<WbsTreeContractVO8> lowestNodes = new ArrayList<>();
|
|
|
if (!new Integer("6").equals(node.getNodeType()) && !Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType() + "")) {
|
|
|
+ /**
|
|
|
+ * 更改逻辑
|
|
|
+ * 使用queryProcessDataByParentIdAndContractId_3中,通过pKeyId查询;
|
|
|
+ * 放弃使用queryProcessDataByParentIdAndContractIdTwo中,通过ancestors字段查询,ancestors有问题
|
|
|
+ * @author liuyc
|
|
|
+ * @date 2023年9月8日11:26:46
|
|
|
+ */
|
|
|
//不是工序,则查询当前节点下的所有填报节点
|
|
|
if (node.getParentId() == 0) {
|
|
|
- queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractIdTwo("", contract.getContractType(), StringUtils.isNotEmpty(vo.getContractIdRelation()) ? vo.getContractIdRelation() : vo.getContractId().toString());
|
|
|
+ //当前合同段最底层节点pKeyIds
|
|
|
+ List<WbsTreeContract> lowestNodesAll = jdbcTemplate.query("select a.p_key_id,a.id,(SELECT CASE WHEN COUNT(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.contract_id = " + node.getContractId() + " AND b.status = 1 AND b.type = 1 AND b.is_deleted = 0) AS hasChildren from m_wbs_tree_contract a where a.type = 1 and a.status = 1 and a.is_deleted = 0 and a.contract_id = " + node.getContractId() + " HAVING hasChildren = 0", new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
+ List<String> pKeyIds = lowestNodesAll.stream().map(WbsTreeContract::getPKeyId).map(String::valueOf).collect(Collectors.toList());
|
|
|
+ List<List<String>> partition = Lists.partition(pKeyIds, 1000);
|
|
|
+ for (List<String> items : partition) {
|
|
|
+ //获取填报节点信息
|
|
|
+ List<QueryProcessDataVO> result = this.informationQueryMapper.queryProcessDataByParentIdAndContractId_3(contract.getContractType(), items);
|
|
|
+ if (result.size() > 0) {
|
|
|
+ queryDataResult.addAll(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractIdTwo("", contract.getContractType(), StringUtils.isNotEmpty(vo.getContractIdRelation()) ? vo.getContractIdRelation() : vo.getContractId().toString());
|
|
|
} else {
|
|
|
- queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractIdTwo(node.getId().toString(), contract.getContractType(), StringUtils.isNotEmpty(vo.getContractIdRelation()) ? vo.getContractIdRelation() : vo.getContractId().toString());
|
|
|
+ //获取当前选择的节点下的所有最底层节点
|
|
|
+ WbsTreeContractVO8 vo8 = BeanUtil.copyProperties(node, WbsTreeContractVO8.class);
|
|
|
+ this.lowestNodesRecursively(lowestNodes, Collections.singleton(vo8), node.getContractId());
|
|
|
+ List<String> pKeyIds = lowestNodes.stream().map(WbsTreeContractVO8::getPKeyId).map(String::valueOf).collect(Collectors.toList());
|
|
|
+ List<List<String>> partition = Lists.partition(pKeyIds, 1000);
|
|
|
+ for (List<String> items : partition) {
|
|
|
+ //获取填报节点信息
|
|
|
+ List<QueryProcessDataVO> result = this.informationQueryMapper.queryProcessDataByParentIdAndContractId_3(contract.getContractType(), items);
|
|
|
+ if (result.size() > 0) {
|
|
|
+ queryDataResult.addAll(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ //queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractIdTwo(node.getId().toString(), contract.getContractType(), StringUtils.isNotEmpty(vo.getContractIdRelation()) ? vo.getContractIdRelation() : vo.getContractId().toString());
|
|
|
}
|
|
|
+
|
|
|
//如果是首件列表请求,则删掉没有标记为首件的数据
|
|
|
- if (queryDataResult != null && queryDataResult.size() > 0) {
|
|
|
+ if (queryDataResult.size() > 0) {
|
|
|
if (StringUtils.isNotEmpty(vo.getIsFirst())) {
|
|
|
if (StringUtils.isNotEmpty(vo.getFirstTitle())) {
|
|
|
queryDataResult = queryDataResult.stream().filter(qdr -> "3".equals(qdr.getQueryType())).collect(Collectors.toList());
|
|
@@ -3538,6 +3575,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
submitNodeKeyIds.addAll(queryDataResult.stream().map(QueryProcessDataVO::getPrimaryKeyId).distinct().collect(Collectors.toList()));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//设置进集合中
|
|
|
vo.setWbsIds(submitNodeKeyIds);
|
|
|
if (StringUtils.isNotEmpty(vo.getContractIdRelation())) {
|
|
@@ -3547,6 +3585,32 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
return R.data(this.informationQueryService.selectInformationQueryPage(Condition.getPage(query), vo, node));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取一个节点下的所有最底层节点
|
|
|
+ *
|
|
|
+ * @param lowestNodes 结果集
|
|
|
+ * @param nodes 初始入参节点
|
|
|
+ */
|
|
|
+ private void lowestNodesRecursively(List<WbsTreeContractVO8> lowestNodes, Set<WbsTreeContractVO8> nodes, String contractId) {
|
|
|
+ if (nodes.size() > 0) {
|
|
|
+ Set<Long> ids = nodes.stream().map(WbsTreeContractVO8::getId).collect(Collectors.toSet());
|
|
|
+ if (ids.size() > 0) {
|
|
|
+ List<WbsTreeContractVO8> childNodes = jdbcTemplate.query("select a.p_key_id,a.id,(SELECT CASE WHEN COUNT(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.contract_id = " + contractId + " AND b.status = 1 AND b.type = 1 AND b.is_deleted = 0) AS hasChildren from m_wbs_tree_contract a where a.type = 1 and a.status = 1 and a.is_deleted = 0 and a.contract_id = " + contractId + " and a.parent_id in(" + StringUtils.join(ids, ",") + ")", new BeanPropertyRowMapper<>(WbsTreeContractVO8.class));
|
|
|
+ if (childNodes.size() > 0) {
|
|
|
+ Set<WbsTreeContractVO8> lowestNode = childNodes.stream().filter(f -> f.getHasChildren().equals(0)).collect(Collectors.toSet());
|
|
|
+ Set<WbsTreeContractVO8> noLowestNode = childNodes.stream().filter(f -> f.getHasChildren().equals(1)).collect(Collectors.toSet());
|
|
|
+ if (lowestNode.size() > 0) { //最底层节点加入结果集
|
|
|
+ lowestNodes.addAll(lowestNode);
|
|
|
+ }
|
|
|
+ if (noLowestNode.size() > 0) { //非最底层节点继续递归
|
|
|
+ this.lowestNodesRecursively(lowestNodes, noLowestNode, contractId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取当前合同段的划分树
|
|
|
*
|