|
@@ -66,6 +66,7 @@ import org.springblade.business.service.IInformationQueryService;
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.concurrent.atomic.AtomicReference;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -108,6 +109,99 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
private final RecycleBinClient recycleBinClient;
|
|
private final RecycleBinClient recycleBinClient;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 输入框查询合同段树
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/searchContractTree")
|
|
|
|
+ @ApiOperationSupport(order = 26)
|
|
|
|
+ @ApiOperation(value = "输入框查询合同段树")
|
|
|
|
+ public R<List<WbsTreeContractTreeVOS>> searchContractTree(@RequestParam String queryValue, @RequestParam String contractId){
|
|
|
|
+ //获取合同段信息
|
|
|
|
+ ContractInfo contract = this.contractClient.getContractById(Long.parseLong(contractId));
|
|
|
|
+ if(new Integer("2").equals(contract.getContractType())){
|
|
|
|
+ //监理,需要获取监理合同段关联的施工方合同段ID
|
|
|
|
+ } else {
|
|
|
|
+ //施工,直接查询
|
|
|
|
+ //获取当前合同段下所有的数据
|
|
|
|
+ List<WbsTreeContract> contractTreeList = this.wbsTreeContractClient.searchContractTree(contractId);
|
|
|
|
+ Map<String, WbsTreeContractTreeVOS> nodeMap = new HashMap<>();
|
|
|
|
+ Map<String, String> titleToIdMap = new HashMap<>();
|
|
|
|
+ //根节点
|
|
|
|
+ AtomicReference<WbsTreeContract> rootNode = new AtomicReference<>();
|
|
|
|
+
|
|
|
|
+ contractTreeList.forEach(tree -> {
|
|
|
|
+ if(Long.valueOf("0").equals(tree.getParentId())){
|
|
|
|
+ //顺便找到根节点
|
|
|
|
+ rootNode.set(tree);
|
|
|
|
+ }
|
|
|
|
+ //转换类型
|
|
|
|
+ WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
|
|
|
|
+ //设置参数
|
|
|
|
+ vos.setId(tree.getId().toString());
|
|
|
|
+ vos.setKey(tree.getId().toString());
|
|
|
|
+ vos.setPrimaryKeyId(tree.getPKeyId().toString());
|
|
|
|
+ vos.setParentId(tree.getParentId().toString());
|
|
|
|
+ vos.setTitle(StringUtils.isNotEmpty(tree.getFullName()) ? tree.getFullName() : tree.getDeptName());
|
|
|
|
+ vos.setType(tree.getType());
|
|
|
|
+ vos.setWbsType(tree.getWbsType());
|
|
|
|
+
|
|
|
|
+ nodeMap.put(tree.getId().toString(), vos);
|
|
|
|
+ titleToIdMap.put(tree.getId().toString(), StringUtils.isNotEmpty(tree.getFullName()) ? tree.getFullName() : tree.getDeptName());
|
|
|
|
+ });
|
|
|
|
+ if(rootNode.get() == null){
|
|
|
|
+ return R.data(300, null, "未找到相关数据");
|
|
|
|
+ }
|
|
|
|
+ //获得根节点
|
|
|
|
+ WbsTreeContract rootTree = rootNode.get();
|
|
|
|
+
|
|
|
|
+ //查询名称
|
|
|
|
+ titleToIdMap.entrySet().removeIf(map -> !map.getValue().contains(queryValue));
|
|
|
|
+
|
|
|
|
+ //处理后的titleToIdMap就是匹配的结果,向上获取父节点,向下获取所有子节点
|
|
|
|
+ if(titleToIdMap.size() > 0){
|
|
|
|
+ //循环剩下的数据,找到对应的节点
|
|
|
|
+ Set<String> idMap = titleToIdMap.keySet();
|
|
|
|
+ //记录哪些节点已经被获取了
|
|
|
|
+ List<String> recordGetIds = new ArrayList<>();
|
|
|
|
+ for(String nodeId : idMap){
|
|
|
|
+ if(!recordGetIds.contains(nodeId)){
|
|
|
|
+ //获取节点
|
|
|
|
+ WbsTreeContractTreeVOS node = nodeMap.get(nodeId);
|
|
|
|
+ //优先向下获取子节点
|
|
|
|
+ this.foreachQueryChild(node, nodeMap, recordGetIds);
|
|
|
|
+ //其次向上获取父节点
|
|
|
|
+
|
|
|
|
+ int i = 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return R.data(300, null, "未找到相关数据");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void foreachQueryChild(WbsTreeContractTreeVOS parentNode, Map<String, WbsTreeContractTreeVOS> nodeMap, List<String> recordGetIds){
|
|
|
|
+ //校验当前节点是否还有子节点
|
|
|
|
+ Long count = this.wbsTreeContractClient.countChildByPrimaryKeyId(parentNode.getPrimaryKeyId());
|
|
|
|
+ if(count > 0){
|
|
|
|
+ //说明还有子节点
|
|
|
|
+ Set<String> keySet = nodeMap.keySet();
|
|
|
|
+ for(String key : keySet){
|
|
|
|
+ if(!recordGetIds.contains(key)){
|
|
|
|
+ WbsTreeContractTreeVOS child = nodeMap.get(key);
|
|
|
|
+ if(child.getParentId().equals(parentNode.getId())){
|
|
|
|
+ //继续向下获取子节点
|
|
|
|
+ this.foreachQueryChild(child, nodeMap, recordGetIds);
|
|
|
|
+ //添加记录
|
|
|
|
+ recordGetIds.add(key);
|
|
|
|
+ //设置进子节点集合中
|
|
|
|
+ parentNode.getChildren().add(child);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 复制节点填报数据
|
|
* 复制节点填报数据
|
|
*/
|
|
*/
|
|
@@ -851,6 +945,23 @@ public class InformationWriteQueryController extends BladeController {
|
|
//拼接
|
|
//拼接
|
|
ids = ids + "," + String.join(",", JSONArray.parseArray(JSONObject.toJSONString(removeList), String.class));
|
|
ids = ids + "," + String.join(",", JSONArray.parseArray(JSONObject.toJSONString(removeList), String.class));
|
|
|
|
|
|
|
|
+ //获取当前节点下所有填报节点
|
|
|
|
+ List<QueryProcessDataVO> queryProcess = this.informationQueryService.queryProcessDataByParentIdAndContractId(removeNode.getId().toString(), 1, removeNode.getContractId());
|
|
|
|
+ if(queryProcess == null || queryProcess.size() == 0){
|
|
|
|
+ //填报节点
|
|
|
|
+ queryProcess = this.informationQueryService.queryProcessDataByPrimaryKeyIdAndClassify(removeNode.getPKeyId().toString(), 1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(queryProcess != null && queryProcess.size() > 0){
|
|
|
|
+ //检查这些填报节点是否存在已经审批或已经上报的节点,如果存在则不允许删除
|
|
|
|
+ List<QueryProcessDataVO> approvalList = queryProcess.stream().filter(vo -> new Integer("2").equals(vo.getStatus())).collect(Collectors.toList());
|
|
|
|
+ List<QueryProcessDataVO> runTaskList = queryProcess.stream().filter(vo -> new Integer("1").equals(vo.getStatus())).collect(Collectors.toList());
|
|
|
|
+ if(approvalList.size() > 0 || runTaskList.size() > 0){
|
|
|
|
+ //说明存在已经审批或已经上报的节点,不允许删除
|
|
|
|
+ return R.data(300, false, "存在已经上报或审批的节点,不允许删除");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//保存操作记录
|
|
//保存操作记录
|
|
this.operationLogClient.saveUserOperationLog(4, "资料管理", "工序资料", ids);
|
|
this.operationLogClient.saveUserOperationLog(4, "资料管理", "工序资料", ids);
|
|
//保存进回收站
|
|
//保存进回收站
|
|
@@ -1079,24 +1190,26 @@ public class InformationWriteQueryController extends BladeController {
|
|
@ApiImplicitParam(name = "id", value = "点击节点ID")
|
|
@ApiImplicitParam(name = "id", value = "点击节点ID")
|
|
})
|
|
})
|
|
public R<List<WbsTreeContractTreeVOS>> queryWbsTreePrivateByProjectIdAndId(@RequestParam String projectId, @RequestParam String id){
|
|
public R<List<WbsTreeContractTreeVOS>> queryWbsTreePrivateByProjectIdAndId(@RequestParam String projectId, @RequestParam String id){
|
|
-// List<WbsTreeContractTreeVOS> result = new ArrayList<>();
|
|
|
|
-//
|
|
|
|
-// WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
|
|
|
|
-// WbsTreePrivate wbsTreePrivate = this.wbsTreePrivateClient.queryPeersNodeByProjectIdAndId(projectId, Long.parseLong(id));
|
|
|
|
-// //设置参数
|
|
|
|
-// vos.setId(wbsTreePrivate.getId().toString());
|
|
|
|
-// vos.setKey(wbsTreePrivate.getId().toString());
|
|
|
|
-// vos.setPrimaryKeyId(wbsTreePrivate.getPKeyId().toString());
|
|
|
|
-// vos.setParentId(wbsTreePrivate.getParentId().toString());
|
|
|
|
-// vos.setTitle(wbsTreePrivate.getDeptName());
|
|
|
|
-// vos.setType(wbsTreePrivate.getType());
|
|
|
|
-// vos.setWbsType(Integer.parseInt(wbsTreePrivate.getWbsType()));
|
|
|
|
-// //设置子级
|
|
|
|
-// vos.setChildren();
|
|
|
|
-// //添加进结果集合中
|
|
|
|
-// result.add(vos);
|
|
|
|
-
|
|
|
|
- return R.data(this.wbsTreePrivateClient.queryWbsTreePrivateByProjectIdAndId(projectId, Long.parseLong(id)));
|
|
|
|
|
|
+ List<WbsTreeContractTreeVOS> result = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ if(StringUtils.isNotEmpty(id)){
|
|
|
|
+ WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
|
|
|
|
+ WbsTreePrivate wbsTreePrivate = this.wbsTreePrivateClient.queryPeersNodeByProjectIdAndId(projectId, Long.parseLong(id));
|
|
|
|
+ //设置参数
|
|
|
|
+ vos.setId(wbsTreePrivate.getId().toString());
|
|
|
|
+ vos.setKey(wbsTreePrivate.getId().toString());
|
|
|
|
+ vos.setPrimaryKeyId(wbsTreePrivate.getPKeyId().toString());
|
|
|
|
+ vos.setParentId(wbsTreePrivate.getParentId().toString());
|
|
|
|
+ vos.setTitle(wbsTreePrivate.getDeptName());
|
|
|
|
+ vos.setType(wbsTreePrivate.getType());
|
|
|
|
+ vos.setWbsType(Integer.parseInt(wbsTreePrivate.getWbsType()));
|
|
|
|
+ //设置子级
|
|
|
|
+ vos.setChildren(this.wbsTreePrivateClient.queryWbsTreePrivateByProjectIdAndId(projectId, Long.parseLong(id)));
|
|
|
|
+ //添加进结果集合中
|
|
|
|
+ result.add(vos);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return R.data(result);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1197,7 +1310,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
WbsTreeContract node = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(vo.getWbsId());
|
|
WbsTreeContract node = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(vo.getWbsId());
|
|
if(!new Integer("6").equals(node.getDeptCategory()) && !Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType().toString())){
|
|
if(!new Integer("6").equals(node.getDeptCategory()) && !Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType().toString())){
|
|
//不是工序,则查询当前节点下的所有填报节点
|
|
//不是工序,则查询当前节点下的所有填报节点
|
|
- List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(node.getId().toString(), 1, vo.getContractId().toString());
|
|
|
|
|
|
+ List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(node.getId().toString(), vo.getClassify(), vo.getContractId().toString());
|
|
if(StringUtils.isNotEmpty(vo.getIsFirst())){
|
|
if(StringUtils.isNotEmpty(vo.getIsFirst())){
|
|
//如果是首件列表请求,则删掉没有标记为首件的数据
|
|
//如果是首件列表请求,则删掉没有标记为首件的数据
|
|
queryDataResult.removeIf(data -> StringUtils.isEmpty(data.getFirstId()));
|
|
queryDataResult.removeIf(data -> StringUtils.isEmpty(data.getFirstId()));
|