|
@@ -718,40 +718,53 @@ public class ContractInfoController extends BladeController {
|
|
|
* 资料填报(资料查询)节点搜索输入框查询接口
|
|
|
*
|
|
|
* @author liuyc
|
|
|
- * @since 2023年6月15日11:44:36
|
|
|
+ * @date 2023年6月15日11:44:36
|
|
|
*/
|
|
|
@GetMapping("/getTreeNodeByQueryValueAndContractId")
|
|
|
@ApiOperationSupport(order = 23)
|
|
|
@ApiOperation(value = "资料填报(资料查询)节点搜索输入框查询接口", notes = "传入合同段id、输入框搜索的queryValue、表单所属方tableOwner")
|
|
|
- public R getTreeNodeByValueAndContractId(@RequestParam String queryValue, @RequestParam String contractId, @RequestParam String tableOwner) {
|
|
|
- R list = contractInfoService.getTreeNodeByValueAndContractId(queryValue, contractId, tableOwner);
|
|
|
- if (ObjectUtil.isNotEmpty(list) && ObjectUtil.isNotEmpty(list.getData())) {
|
|
|
- Object data = list.getData();
|
|
|
+ public R<Object> getTreeNodeByValueAndContractId(@RequestParam String queryValue, @RequestParam String contractId, @RequestParam String tableOwner) {
|
|
|
+ R<Object> result = contractInfoService.getTreeNodeByValueAndContractId(queryValue, contractId, tableOwner);
|
|
|
+ if (ObjectUtil.isNotEmpty(result) && ObjectUtil.isNotEmpty(result.getData())) {
|
|
|
+ Object data = result.getData();
|
|
|
ContractInfo contractInfo = contractInfoService.getBaseMapper().selectById(contractId);
|
|
|
if (data instanceof List) {
|
|
|
+ List<?> dataList = (List<?>) data;
|
|
|
if (contractInfo.getContractType().equals(1)) {
|
|
|
- List<WbsTreeContractTreeAllVO> dataList = (List<WbsTreeContractTreeAllVO>) data;
|
|
|
- for (WbsTreeContractTreeAllVO wbsTreeContractVO : dataList) {
|
|
|
- if (ObjectUtil.isNotEmpty(wbsTreeContractVO.getParentId()) && 0L == wbsTreeContractVO.getParentId()) {
|
|
|
- wbsTreeContractVO.setTitle(contractInfo.getContractName());
|
|
|
- break;
|
|
|
+ for (Object item : dataList) {
|
|
|
+ if (item instanceof WbsTreeContractTreeAllVO) {
|
|
|
+ WbsTreeContractTreeAllVO wbsTreeContractVO = (WbsTreeContractTreeAllVO) item;
|
|
|
+ if (ObjectUtil.isNotEmpty(wbsTreeContractVO.getParentId()) && 0L == wbsTreeContractVO.getParentId()) {
|
|
|
+ wbsTreeContractVO.setTitle(contractInfo.getContractName());
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return R.data(data);
|
|
|
}
|
|
|
} else if (data instanceof Map) {
|
|
|
+ Map<?, ?> dataMap = (Map<?, ?>) data;
|
|
|
if (contractInfo.getContractType().equals(2) || contractInfo.getContractType().equals(3)) {
|
|
|
List<WbsTreeContractTreeAllVO> jlYzList = new LinkedList<>();
|
|
|
- Map<Long, List<WbsTreeContractTreeAllVO>> dataMap = (Map<Long, List<WbsTreeContractTreeAllVO>>) data;
|
|
|
- for (Map.Entry<Long, List<WbsTreeContractTreeAllVO>> map : dataMap.entrySet()) {
|
|
|
- ContractInfo contractInfoJlYz = contractInfoService.getBaseMapper().selectById(map.getKey());
|
|
|
- for (WbsTreeContractTreeAllVO wbsTreeContractVO : map.getValue()) {
|
|
|
- if (ObjectUtil.isNotEmpty(wbsTreeContractVO.getParentId()) && 0L == wbsTreeContractVO.getParentId()) {
|
|
|
- wbsTreeContractVO.setTitle(contractInfoJlYz.getContractName());
|
|
|
- break;
|
|
|
+ for (Map.Entry<?, ?> entry : dataMap.entrySet()) {
|
|
|
+ Object key = entry.getKey();
|
|
|
+ Object value = entry.getValue();
|
|
|
+ if (key instanceof Long && value instanceof List) {
|
|
|
+ Long mapKey = (Long) key;
|
|
|
+ List<?> mapValue = (List<?>) value;
|
|
|
+ ContractInfo contractInfoJlYz = contractInfoService.getBaseMapper().selectById(mapKey);
|
|
|
+ List<? extends WbsTreeContractTreeAllVO> typedList = mapValue.stream()
|
|
|
+ .filter(item -> item instanceof WbsTreeContractTreeAllVO)
|
|
|
+ .map(item -> (WbsTreeContractTreeAllVO) item)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ for (WbsTreeContractTreeAllVO wbsTreeContractVO : typedList) {
|
|
|
+ if (ObjectUtil.isNotEmpty(wbsTreeContractVO.getParentId()) && 0L == wbsTreeContractVO.getParentId()) {
|
|
|
+ wbsTreeContractVO.setTitle(contractInfoJlYz.getContractName());
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+ jlYzList.addAll(typedList);
|
|
|
}
|
|
|
- jlYzList.addAll(map.getValue());
|
|
|
}
|
|
|
return R.data(jlYzList);
|
|
|
}
|