| | |
| | | |
| | | import static com.vci.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST; |
| | | |
| | | |
| | | /** |
| | | * UIä¸çæ°æ®æ¥è¯¢(éç¨æ¥è¯¢æå¡) |
| | | * @author Ludc |
| | |
| | | if(Func.isNotEmpty(dataGridQuery.getSourceData())){ |
| | | dataGridQuery.setSourceData(this.convertMapValueJson2Map(dataGridQuery.getSourceData())); |
| | | } |
| | | //å
夿æ¥è¯¢æ¨¡æ¿ |
| | | UITableDefineVO tableDefineVO = uiEngineService.getComponentByOid(dataGridQuery.getComponentOid(),null).getTableDefineVO(); |
| | | String queryTemplate = Func.isNotEmpty(dataGridQuery.getSourceData())? (String) dataGridQuery.getSourceData().getOrDefault("querytemplate",tableDefineVO.getQueryTemplateName()) :tableDefineVO.getQueryTemplateName(); |
| | | if(StringUtils.isBlank(queryTemplate)){ |
| | | //è¯´ææ²¡æè®¾ç½®æ¥è¯¢æ¨¡æ¿ï¼éè¦ççå¨è¿ä¸ªè¡¨æ ¼æå¨çç»ä»¶ææ²¡æè®¾ç½® |
| | | tableDefineVO = uiEngineService.getTableById(dataGridQuery.getBtmName(), dataGridQuery.getTableDefineId()); |
| | | queryTemplate = tableDefineVO.getQueryTemplateName(); |
| | | } |
| | | //ççææ²¡æèªå®ä¹çSQL |
| | | Set<String> queryFieldList = new HashSet<>(); |
| | | tableDefineVO.getCols().forEach(cols->{ |
| | | //è·ååç
§ |
| | | List<UITableFieldVO> referFieldList = cols.stream().filter(s -> UIFieldTypeEnum.REFER.getValue().equalsIgnoreCase(s.getFieldType())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(referFieldList)){ |
| | | referFieldList.stream().forEach(field->{ |
| | | queryFieldList.add(field.getField()); |
| | | if(StringUtils.isNotBlank(field.getShowField())) { |
| | | queryFieldList.add(field.getShowField()); |
| | | } |
| | | }); |
| | | //å
夿æ¥è¯¢æ¨¡æ¿æ¯å¦é
ç½®äºèªå®ä¹æ¥è¯¢ç±» |
| | | UIComponentVO componentVO = uiEngineService.getComponentByOid(dataGridQuery.getComponentOid(), null); |
| | | UITableDefineVO tableDefineVO = componentVO.getTableDefineVO(); |
| | | String bsCustQueryCLsOrUrl = componentVO.getBsCustQueryCLsOrUrl(); |
| | | // TODO: 2024/12/5 Ludc æ ¹æ®UIé
ç½®çè¿è¡å¤ææ¯å¦ä½¿ç¨èªå®ä¹ç±»è¿è¡æ¥è¯¢(èªå®ä¹ç±»æ¥è¯¢æ¹å¼ä¼å
级é«äºæ¥è¯¢æ¨¡æ¿) |
| | | if(Func.isNotBlank(bsCustQueryCLsOrUrl) && isCustomClass(bsCustQueryCLsOrUrl)){ |
| | | //éè¿åå°è°ç¨bsCustQueryCLsOrUrlä¸å®ä¹çæå¡ç±»ä¸çæ¥è¯¢æ¹æ³ |
| | | try { |
| | | // è·åç±»ç Class 对象 |
| | | Class<?> clazz = Class.forName(bsCustQueryCLsOrUrl.replace("@","")); |
| | | // å建类çå®ä¾ |
| | | Object instance = clazz.getDeclaredConstructor().newInstance(); |
| | | // è·åæ¹æ³getDataForGridï¼è¯¥æ¹æ³æ¯æ¥å£ä¸ç»ä¸å®ä¹çæ¹æ³ï¼ |
| | | Method method = clazz.getMethod("getDataForGrid", UIDataGridQuery.class); |
| | | // è°ç¨æ¹æ³ |
| | | DataGrid dataGrid = (DataGrid) method.invoke(instance, dataGridQuery); |
| | | return dataGrid; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | throw new VciBaseException("è·åè¡¨æ ¼æ°æ®æ¶åºç°é误ï¼åå ï¼"+e.getMessage()); |
| | | } |
| | | Map<String, String> comboxMap = cols.stream().filter(s -> UIFieldTypeEnum.COMBOX.getValue().equalsIgnoreCase(s.getFieldType()) && StringUtils.isNotBlank(s.getComboxKey())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getField(), t -> t.getComboxKey())); |
| | | if(!CollectionUtils.isEmpty(comboxMap)) { |
| | | comboxMap.forEach((field,comboxKey)->{ |
| | | queryFieldList.add(comboxKey+"_" + field.substring(0,field.length()-4) + "#" + field); |
| | | }); |
| | | } |
| | | queryFieldList.addAll(cols.stream().filter(s -> !UIFieldTypeEnum.REFER.getValue().equalsIgnoreCase(s.getFieldType()) && !UIFieldTypeEnum.COMBOX.getValue().equalsIgnoreCase(s.getFieldType())).map(s -> s.getField()).collect(Collectors.toList())); |
| | | }); |
| | | |
| | | //é对åç
§çï¼æä»¬éè¦æ·»å 对åºç |
| | | //è¿ä¸ªä¸å¡ç±»åå
å«ç屿§ |
| | | OsBtmTypeVO btmTypeVO = null; |
| | | OsLinkTypeVO linkTypeVO = null; |
| | | if(dataGridQuery.isLinkTypeFlag()){ |
| | | linkTypeVO = linkTypeService.getLinkTypeById(dataGridQuery.getBtmName()); |
| | | queryFieldList.addAll(linkTypeVO.getAttributes().stream().map(OsLinkTypeAttributeVO::getId).collect(Collectors.toList())); |
| | | queryFieldList.addAll(WebLoServiceImpl.LO_BASE_FIELD_MAP.values()); |
| | | }else{ |
| | | //btmTypeVO = btmService.getBtmById(dataGridQuery.getBtmname()); |
| | | btmTypeVO = btmService.getBtmByName(dataGridQuery.getBtmName()); |
| | | queryFieldList.addAll(btmTypeVO.getAttributes().stream().map(OsBtmTypeAttributeVO::getId).collect(Collectors.toList())); |
| | | queryFieldList.addAll(WebBoServiceImpl.BO_BASE_FIELD_MAP.values()); |
| | | } |
| | | queryFieldList.add("creator_name"); |
| | | queryFieldList.add("lastmodifier_name"); |
| | | //æä»¬å¨åå°æ¥è¯¢ä¸å¡æ°æ® |
| | | Map<String, Object> replaceMap = wrapperReplaceMap(dataGridQuery.getSourceData()); |
| | | |
| | | if(dataGridQuery.isLinkTypeFlag()){ |
| | | UILinkTypeDataQuery linkTypeDataQuery = new UILinkTypeDataQuery(); |
| | | linkTypeDataQuery.setQueryTemplateName(queryTemplate); |
| | | linkTypeDataQuery.setReplaceMap(replaceMap); |
| | | linkTypeDataQuery.setConditionMap(dataGridQuery.getConditionMap()); |
| | | linkTypeDataQuery.setClauseList(queryFieldList); |
| | | linkTypeDataQuery.setLinkType(dataGridQuery.getBtmName()); |
| | | if(dataGridQuery.isTreeTableFlag()){ |
| | | linkTypeDataQuery.setLevel(-1); |
| | | String queryTemplate = Func.isNotEmpty(dataGridQuery.getSourceData())? (String) dataGridQuery.getSourceData().getOrDefault("querytemplate",tableDefineVO.getQueryTemplateName()) :tableDefineVO.getQueryTemplateName(); |
| | | if(StringUtils.isBlank(queryTemplate)){ |
| | | //è¯´ææ²¡æè®¾ç½®æ¥è¯¢æ¨¡æ¿ï¼éè¦ççå¨è¿ä¸ªè¡¨æ ¼æå¨çç»ä»¶ææ²¡æè®¾ç½® |
| | | tableDefineVO = uiEngineService.getTableById(dataGridQuery.getBtmName(), dataGridQuery.getTableDefineId()); |
| | | queryTemplate = tableDefineVO.getQueryTemplateName(); |
| | | } |
| | | return loService.queryGridByScheme(linkTypeDataQuery); |
| | | }else { |
| | | DataGrid dataGrid = boService.queryGridByScheme(queryTemplate, |
| | | dataGridQuery.getConditionMap(), replaceMap, dataGridQuery.getPageHelper(), queryFieldList.stream().collect(Collectors.toList())); |
| | | return dataGrid; |
| | | //ççææ²¡æèªå®ä¹çSQL |
| | | Set<String> queryFieldList = new HashSet<>(); |
| | | tableDefineVO.getCols().forEach(cols->{ |
| | | //è·ååç
§ |
| | | List<UITableFieldVO> referFieldList = cols.stream().filter(s -> UIFieldTypeEnum.REFER.getValue().equalsIgnoreCase(s.getFieldType())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(referFieldList)){ |
| | | referFieldList.stream().forEach(field->{ |
| | | queryFieldList.add(field.getField()); |
| | | if(StringUtils.isNotBlank(field.getShowField())) { |
| | | queryFieldList.add(field.getShowField()); |
| | | } |
| | | }); |
| | | } |
| | | Map<String, String> comboxMap = cols.stream().filter(s -> UIFieldTypeEnum.COMBOX.getValue().equalsIgnoreCase(s.getFieldType()) && StringUtils.isNotBlank(s.getComboxKey())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getField(), t -> t.getComboxKey())); |
| | | if(!CollectionUtils.isEmpty(comboxMap)) { |
| | | comboxMap.forEach((field,comboxKey)->{ |
| | | queryFieldList.add(comboxKey+"_" + field.substring(0,field.length()-4) + "#" + field); |
| | | }); |
| | | } |
| | | queryFieldList.addAll(cols.stream().filter(s -> !UIFieldTypeEnum.REFER.getValue().equalsIgnoreCase(s.getFieldType()) && !UIFieldTypeEnum.COMBOX.getValue().equalsIgnoreCase(s.getFieldType())).map(s -> s.getField()).collect(Collectors.toList())); |
| | | }); |
| | | |
| | | //é对åç
§çï¼æä»¬éè¦æ·»å 对åºç |
| | | //è¿ä¸ªä¸å¡ç±»åå
å«ç屿§ |
| | | OsBtmTypeVO btmTypeVO = null; |
| | | OsLinkTypeVO linkTypeVO = null; |
| | | if(dataGridQuery.isLinkTypeFlag()){ |
| | | linkTypeVO = linkTypeService.getLinkTypeById(dataGridQuery.getBtmName()); |
| | | queryFieldList.addAll(linkTypeVO.getAttributes().stream().map(OsLinkTypeAttributeVO::getId).collect(Collectors.toList())); |
| | | queryFieldList.addAll(WebLoServiceImpl.LO_BASE_FIELD_MAP.values()); |
| | | }else{ |
| | | //btmTypeVO = btmService.getBtmById(dataGridQuery.getBtmname()); |
| | | btmTypeVO = btmService.getBtmByName(dataGridQuery.getBtmName()); |
| | | queryFieldList.addAll(btmTypeVO.getAttributes().stream().map(OsBtmTypeAttributeVO::getId).collect(Collectors.toList())); |
| | | queryFieldList.addAll(WebBoServiceImpl.BO_BASE_FIELD_MAP.values()); |
| | | } |
| | | queryFieldList.add("creator_name"); |
| | | queryFieldList.add("lastmodifier_name"); |
| | | //æä»¬å¨åå°æ¥è¯¢ä¸å¡æ°æ® |
| | | Map<String, Object> replaceMap = wrapperReplaceMap(dataGridQuery.getSourceData()); |
| | | |
| | | if(dataGridQuery.isLinkTypeFlag()){ |
| | | UILinkTypeDataQuery linkTypeDataQuery = new UILinkTypeDataQuery(); |
| | | linkTypeDataQuery.setQueryTemplateName(queryTemplate); |
| | | linkTypeDataQuery.setReplaceMap(replaceMap); |
| | | linkTypeDataQuery.setConditionMap(dataGridQuery.getConditionMap()); |
| | | linkTypeDataQuery.setClauseList(queryFieldList); |
| | | linkTypeDataQuery.setLinkType(dataGridQuery.getBtmName()); |
| | | if(dataGridQuery.isTreeTableFlag()){ |
| | | linkTypeDataQuery.setLevel(-1); |
| | | } |
| | | return loService.queryGridByScheme(linkTypeDataQuery); |
| | | }else { |
| | | DataGrid dataGrid = boService.queryGridByScheme(queryTemplate, |
| | | dataGridQuery.getConditionMap(), replaceMap, dataGridQuery.getPageHelper(), queryFieldList.stream().collect(Collectors.toList())); |
| | | return dataGrid; |
| | | } |
| | | } |
| | | //çå½å¨æå¨å
¶ä¸æ¥è¯¢åå°±ä¼å¤ç |
| | | //æä¸¾ä¹ä¼è¢«å¤çäº |
| | | } |
| | | |
| | | /** |
| | |
| | | if(Func.isNotEmpty(formQuery.getSourceData())){ |
| | | formQuery.setSourceData(this.convertMapValueJson2Map(formQuery.getSourceData())); |
| | | } |
| | | UIFormDefineVO formDefineVO = uiEngineService.getFormById(formQuery.getBtmName(),formQuery.getFormDefineId()); |
| | | String queryTemplate = !CollectionUtils.isEmpty(formQuery.getSourceData())? (String) formQuery.getSourceData().getOrDefault("querytemplate",formDefineVO.getQueryTemplateName()) :formDefineVO.getQueryTemplateName(); |
| | | Set<String> queryFieldList = formDefineVO.getItems().stream().filter(s->!UIFieldTypeEnum.CUSTOM.getValue().equalsIgnoreCase(s.getType())).map(UIFormItemVO::getField).collect(Collectors.toSet()); |
| | | //è·ååç
§ |
| | | List<UIFormItemVO> referFieldList = formDefineVO.getItems().stream().filter(s -> UIFieldTypeEnum.REFER.getValue().equalsIgnoreCase(s.getType())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(referFieldList)){ |
| | | referFieldList.stream().forEach(field->{ |
| | | queryFieldList.add(field.getField()); |
| | | if(StringUtils.isNotBlank(field.getShowField())) { |
| | | queryFieldList.add(field.getShowField()); |
| | | } |
| | | }); |
| | | } |
| | | Map<String, String> comboxMap = formDefineVO.getItems().stream().filter(s -> UIFieldTypeEnum.COMBOX.getValue().equalsIgnoreCase(s.getType()) && StringUtils.isNotBlank(s.getComboxKey())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getField(), t -> t.getComboxKey())); |
| | | if(!CollectionUtils.isEmpty(comboxMap)) { |
| | | comboxMap.forEach((field,comboxKey)->{ |
| | | //è¦ææä¸¾ç屿§æ¥è¯¢åºæ¥ï¼åè¡¨æ ¼é¢å°æ¹ä¸ä¸æ ·ï¼å 为é£è¾¹ä¼æfieldç´æ¥å äºtext |
| | | queryFieldList.add(comboxKey+"_" + field + "#" + field +"text"); |
| | | }); |
| | | } |
| | | //è¿ä¸ªä¸å¡ç±»åå
å«ç屿§ |
| | | OsBtmTypeVO btmTypeVO = null; |
| | | OsLinkTypeVO linkTypeVO = null; |
| | | if(formDefineVO.isLinkTypeFlag()){ |
| | | linkTypeVO = linkTypeService.getLinkTypeById(formQuery.getBtmName()); |
| | | queryFieldList.addAll(linkTypeVO.getAttributes().stream().map(OsLinkTypeAttributeVO::getId).collect(Collectors.toList())); |
| | | queryFieldList.addAll(WebLoServiceImpl.LO_BASE_FIELD_MAP.values()); |
| | | }else{ |
| | | btmTypeVO = btmService.getBtmByName(formQuery.getBtmName()); |
| | | queryFieldList.addAll(btmTypeVO.getAttributes().stream().map(OsBtmTypeAttributeVO::getId).collect(Collectors.toList())); |
| | | } |
| | | queryFieldList.add("creator_name"); |
| | | queryFieldList.add("lastmodifier_name"); |
| | | Map<String,String> conditionMap = WebUtil.getOidQuery(formQuery.getSourceOid()); |
| | | Map<String, Object> replaceMap = wrapperReplaceMap(formQuery.getSourceData()); |
| | | UIFormDataVO formDataVO = new UIFormDataVO(); |
| | | replaceMap.put("oid", formQuery.getSourceOid().trim()); |
| | | if(!formDefineVO.isLinkTypeFlag()) { |
| | | List<BusinessObject> cbos = null; |
| | | if (StringUtils.isNotBlank(queryTemplate)) { |
| | | // replaceMap.put("oid", formQuery.getOid().trim()); |
| | | cbos = boService.queryCBOByScheme(queryTemplate, conditionMap, replaceMap, null, queryFieldList.stream().collect(Collectors.toList())); |
| | | } else { |
| | | //æ²¡ææ¥è¯¢æ¨¡æ¿ï¼é£æä»¬å°±ç´æ¥ä¸»é®åä¸å¡ç±»å廿¥è¯¢ |
| | | cbos = boService.queryCBO(formQuery.getBtmName(), conditionMap, null, queryFieldList.stream().collect(Collectors.toList())); |
| | | } |
| | | if (!CollectionUtils.isEmpty(cbos)) { |
| | | BusinessObject cbo = cbos.get(0); |
| | | formDataVO.setData(boService.cbo2Map(cbo)); |
| | | } else { |
| | | throw new VciBaseException(DATA_OID_NOT_EXIST); |
| | | //å
夿æ¥è¯¢æ¨¡æ¿æ¯å¦é
ç½®äºèªå®ä¹æ¥è¯¢ç±» |
| | | UIComponentVO componentVO = uiEngineService.getComponentByOid(formQuery.getComponentOid(), null); |
| | | UIFormDefineVO formDefineVO = componentVO.getFormDefineVO(); |
| | | //UIFormDefineVO formDefineVO = uiEngineService.getFormById(formQuery.getBtmName(),formQuery.getFormDefineId()); |
| | | String bsCustQueryCLsOrUrl = componentVO.getBsCustQueryCLsOrUrl(); |
| | | if(Func.isNotBlank(bsCustQueryCLsOrUrl) && isCustomClass(bsCustQueryCLsOrUrl)){ |
| | | //éè¿åå°è°ç¨bsCustQueryCLsOrUrlä¸å®ä¹çæå¡ç±»ä¸çæ¥è¯¢æ¹æ³ |
| | | try { |
| | | // è·åç±»ç Class 对象 |
| | | Class<?> clazz = Class.forName(bsCustQueryCLsOrUrl.replace("@","")); |
| | | // å建类çå®ä¾ |
| | | Object instance = clazz.getDeclaredConstructor().newInstance(); |
| | | // è·åæ¹æ³getDataForGridï¼è¯¥æ¹æ³æ¯æ¥å£ä¸ç»ä¸å®ä¹çæ¹æ³ï¼ |
| | | Method method = clazz.getMethod("getDataForForm", UIDataGridQuery.class); |
| | | // è°ç¨æ¹æ³ |
| | | UIFormDataVO uiFormDataVO = (UIFormDataVO) method.invoke(instance, formQuery); |
| | | return uiFormDataVO; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | throw new VciBaseException("è·åè¡¨æ ¼æ°æ®æ¶åºç°é误ï¼åå ï¼"+e.getMessage()); |
| | | } |
| | | }else{ |
| | | UILinkTypeDataQuery linkTypeDataQuery = new UILinkTypeDataQuery(); |
| | | linkTypeDataQuery.setQueryTemplateName(queryTemplate); |
| | | linkTypeDataQuery.setReplaceMap(replaceMap); |
| | | linkTypeDataQuery.setConditionMap(conditionMap); |
| | | linkTypeDataQuery.setClauseList(queryFieldList); |
| | | linkTypeDataQuery.setLinkType(formQuery.getBtmName()); |
| | | //linkTypeDataQuery.setDirection(formQuery.isOrientation()); |
| | | //linkTypeDataQuery.setToBtmType(treeDefineVO.getBtmType()); |
| | | DataGrid dataGrid = loService.queryGridByScheme(linkTypeDataQuery); |
| | | if (dataGrid != null && !CollectionUtils.isEmpty(dataGrid.getData())) { |
| | | formDataVO.setData((Map<String, Object>) dataGrid.getData().get(0)); |
| | | } |
| | | } |
| | | //æ¥è¯¢éä»¶ |
| | | formDataVO.setAttachmentFileVOs(fileObjectService.listFilesByOwnbiz(formQuery.getSourceOid(), formQuery.getBtmName(), "attachment")); |
| | | List<UIFormItemVO> fileItems = formDefineVO.getItems().stream().filter(s -> UIFieldTypeEnum.FILE.getValue().equalsIgnoreCase(s.getType())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(fileItems)){ |
| | | //åæ®µç屿§è¯å®ä¸ä¼è¶
è¿1000个 |
| | | //æ¥è¯¢è¿äºçå¼ |
| | | List<String> filePathList = new ArrayList<>(); |
| | | fileItems.stream().forEach(field->{ |
| | | Object value = formDataVO.getData().getOrDefault(field.getField(),null); |
| | | if(value!=null && StringUtils.isNotBlank(value.toString())){ |
| | | filePathList.add(value.toString()); |
| | | } |
| | | }); |
| | | List<VciFileObjectVO> fileObjectVOS = fileObjectService.listFileObjectByPath(filePathList, "filePathField"); |
| | | if(!CollectionUtils.isEmpty(fileObjectVOS)){ |
| | | Map<String,VciFileObjectVO> fileObjectVOMap = fileObjectVOS.stream().collect(Collectors.toMap(s->s.getFilePath(),t->t,(o1,o2)->o2)); |
| | | Map<String,VciFileObjectVO> fieldFileVOMap = new HashMap<>(); |
| | | fileItems.stream().forEach(field->{ |
| | | Object value = formDataVO.getData().getOrDefault(field.getField(),null); |
| | | if(value!=null){ |
| | | VciFileObjectVO fileObjectVO = fileObjectVOMap.getOrDefault(value.toString(),null); |
| | | if(fileObjectVO!=null){ |
| | | fieldFileVOMap.put(field.getField(),fileObjectVO); |
| | | } |
| | | String queryTemplate = !CollectionUtils.isEmpty(formQuery.getSourceData())? (String) formQuery.getSourceData().getOrDefault("querytemplate",formDefineVO.getQueryTemplateName()) :formDefineVO.getQueryTemplateName(); |
| | | Set<String> queryFieldList = formDefineVO.getItems().stream().filter(s->!UIFieldTypeEnum.CUSTOM.getValue().equalsIgnoreCase(s.getType())).map(UIFormItemVO::getField).collect(Collectors.toSet()); |
| | | //è·ååç
§ |
| | | List<UIFormItemVO> referFieldList = formDefineVO.getItems().stream().filter(s -> UIFieldTypeEnum.REFER.getValue().equalsIgnoreCase(s.getType())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(referFieldList)){ |
| | | referFieldList.stream().forEach(field->{ |
| | | queryFieldList.add(field.getField()); |
| | | if(StringUtils.isNotBlank(field.getShowField())) { |
| | | queryFieldList.add(field.getShowField()); |
| | | } |
| | | }); |
| | | formDataVO.setFilePathFieldMap(fieldFileVOMap); |
| | | } |
| | | Map<String, String> comboxMap = formDefineVO.getItems().stream().filter(s -> UIFieldTypeEnum.COMBOX.getValue().equalsIgnoreCase(s.getType()) && StringUtils.isNotBlank(s.getComboxKey())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getField(), t -> t.getComboxKey())); |
| | | if(!CollectionUtils.isEmpty(comboxMap)) { |
| | | comboxMap.forEach((field,comboxKey)->{ |
| | | //è¦ææä¸¾ç屿§æ¥è¯¢åºæ¥ï¼åè¡¨æ ¼é¢å°æ¹ä¸ä¸æ ·ï¼å 为é£è¾¹ä¼æfieldç´æ¥å äºtext |
| | | queryFieldList.add(comboxKey+"_" + field + "#" + field +"text"); |
| | | }); |
| | | } |
| | | //è¿ä¸ªä¸å¡ç±»åå
å«ç屿§ |
| | | OsBtmTypeVO btmTypeVO = null; |
| | | OsLinkTypeVO linkTypeVO = null; |
| | | if(formDefineVO.isLinkTypeFlag()){ |
| | | linkTypeVO = linkTypeService.getLinkTypeById(formQuery.getBtmName()); |
| | | queryFieldList.addAll(linkTypeVO.getAttributes().stream().map(OsLinkTypeAttributeVO::getId).collect(Collectors.toList())); |
| | | queryFieldList.addAll(WebLoServiceImpl.LO_BASE_FIELD_MAP.values()); |
| | | }else{ |
| | | btmTypeVO = btmService.getBtmByName(formQuery.getBtmName()); |
| | | queryFieldList.addAll(btmTypeVO.getAttributes().stream().map(OsBtmTypeAttributeVO::getId).collect(Collectors.toList())); |
| | | } |
| | | queryFieldList.add("creator_name"); |
| | | queryFieldList.add("lastmodifier_name"); |
| | | Map<String,String> conditionMap = WebUtil.getOidQuery(formQuery.getSourceOid()); |
| | | Map<String, Object> replaceMap = wrapperReplaceMap(formQuery.getSourceData()); |
| | | UIFormDataVO formDataVO = new UIFormDataVO(); |
| | | replaceMap.put("oid", formQuery.getSourceOid().trim()); |
| | | if(!formDefineVO.isLinkTypeFlag()) { |
| | | List<BusinessObject> cbos = null; |
| | | if (StringUtils.isNotBlank(queryTemplate)) { |
| | | // replaceMap.put("oid", formQuery.getOid().trim()); |
| | | cbos = boService.queryCBOByScheme(queryTemplate, conditionMap, replaceMap, null, queryFieldList.stream().collect(Collectors.toList())); |
| | | } else { |
| | | //æ²¡ææ¥è¯¢æ¨¡æ¿ï¼é£æä»¬å°±ç´æ¥ä¸»é®åä¸å¡ç±»å廿¥è¯¢ |
| | | cbos = boService.queryCBO(formQuery.getBtmName(), conditionMap, null, queryFieldList.stream().collect(Collectors.toList())); |
| | | } |
| | | if (!CollectionUtils.isEmpty(cbos)) { |
| | | BusinessObject cbo = cbos.get(0); |
| | | formDataVO.setData(boService.cbo2Map(cbo)); |
| | | } else { |
| | | throw new VciBaseException(DATA_OID_NOT_EXIST); |
| | | } |
| | | }else{ |
| | | UILinkTypeDataQuery linkTypeDataQuery = new UILinkTypeDataQuery(); |
| | | linkTypeDataQuery.setQueryTemplateName(queryTemplate); |
| | | linkTypeDataQuery.setReplaceMap(replaceMap); |
| | | linkTypeDataQuery.setConditionMap(conditionMap); |
| | | linkTypeDataQuery.setClauseList(queryFieldList); |
| | | linkTypeDataQuery.setLinkType(formQuery.getBtmName()); |
| | | //linkTypeDataQuery.setDirection(formQuery.isOrientation()); |
| | | //linkTypeDataQuery.setToBtmType(treeDefineVO.getBtmType()); |
| | | DataGrid dataGrid = loService.queryGridByScheme(linkTypeDataQuery); |
| | | if (dataGrid != null && !CollectionUtils.isEmpty(dataGrid.getData())) { |
| | | formDataVO.setData((Map<String, Object>) dataGrid.getData().get(0)); |
| | | } |
| | | } |
| | | //æ¥è¯¢éä»¶ |
| | | formDataVO.setAttachmentFileVOs(fileObjectService.listFilesByOwnbiz(formQuery.getSourceOid(), formQuery.getBtmName(), "attachment")); |
| | | List<UIFormItemVO> fileItems = formDefineVO.getItems().stream().filter(s -> UIFieldTypeEnum.FILE.getValue().equalsIgnoreCase(s.getType())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(fileItems)){ |
| | | //åæ®µç屿§è¯å®ä¸ä¼è¶
è¿1000个 |
| | | //æ¥è¯¢è¿äºçå¼ |
| | | List<String> filePathList = new ArrayList<>(); |
| | | fileItems.stream().forEach(field->{ |
| | | Object value = formDataVO.getData().getOrDefault(field.getField(),null); |
| | | if(value!=null && StringUtils.isNotBlank(value.toString())){ |
| | | filePathList.add(value.toString()); |
| | | } |
| | | }); |
| | | List<VciFileObjectVO> fileObjectVOS = fileObjectService.listFileObjectByPath(filePathList, "filePathField"); |
| | | if(!CollectionUtils.isEmpty(fileObjectVOS)){ |
| | | Map<String,VciFileObjectVO> fileObjectVOMap = fileObjectVOS.stream().collect(Collectors.toMap(s->s.getFilePath(),t->t,(o1,o2)->o2)); |
| | | Map<String,VciFileObjectVO> fieldFileVOMap = new HashMap<>(); |
| | | fileItems.stream().forEach(field->{ |
| | | Object value = formDataVO.getData().getOrDefault(field.getField(),null); |
| | | if(value!=null){ |
| | | VciFileObjectVO fileObjectVO = fileObjectVOMap.getOrDefault(value.toString(),null); |
| | | if(fileObjectVO!=null){ |
| | | fieldFileVOMap.put(field.getField(),fileObjectVO); |
| | | } |
| | | } |
| | | }); |
| | | formDataVO.setFilePathFieldMap(fieldFileVOMap); |
| | | } |
| | | } |
| | | return formDataVO; |
| | | } |
| | | return formDataVO; |
| | | } |
| | | |
| | | /** |