| | |
| | | CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid); |
| | | |
| | | List<UIFormItemVO> itemVOS = new ArrayList<>(); |
| | | Map<String, List<CodeClassifyTemplateAttrVO>> attrGroupMap = templateVO.getAttributes().stream(). |
| | | filter(s -> StringUtils.isNotBlank(s.getAttributeGroup())).collect(Collectors.groupingBy(s -> s.getAttributeGroup())); |
| | | |
| | | templateVO.getAttributes().forEach(attrVO -> { |
| | | UIFormItemVO formItemVO = templateAttr2FormField(attrVO, templateVO.getBtmTypeId()); |
| | | itemVOS.add(formItemVO); |
| | | }); |
| | | Map<String, List<CodeClassifyTemplateAttrVO>> attrGroupMap = new HashMap<>(); |
| | | if (Func.isNotEmpty(templateVO.getAttributes())) { |
| | | attrGroupMap = templateVO.getAttributes().stream(). |
| | | filter(s -> StringUtils.isNotBlank(s.getAttributeGroup())).collect(Collectors.groupingBy(s -> s.getAttributeGroup())); |
| | | templateVO.getAttributes().forEach(attrVO -> { |
| | | UIFormItemVO formItemVO = templateAttr2FormField(attrVO, templateVO.getBtmTypeId()); |
| | | itemVOS.add(formItemVO); |
| | | }); |
| | | } |
| | | //处理属性分组 |
| | | if (!CollectionUtils.isEmpty(attrGroupMap)) { |
| | | //按照分组的属性排列,找到每一个分组的第一个属性 |
| | |
| | | } |
| | | //先转换一下时间格式 |
| | | List<String> finalOnlySelectAttrIdList = onlySelectAttrIdList.stream().collect(Collectors.toList()); |
| | | List<CodeClassifyTemplateAttrVO> dateFormatAttrVOs = templateVO.getAttributes().stream().filter( |
| | | s -> StringUtils.isNotBlank(s.getCodeDateFormat()) && |
| | | (finalOnlySelectAttrIdList.size() == 0 || finalOnlySelectAttrIdList.contains(s.getId().toLowerCase(Locale.ROOT))) |
| | | ).collect(Collectors.toList()); |
| | | //枚举的内容 |
| | | List<CodeClassifyTemplateAttrVO> enumAttrVOs = templateVO.getAttributes().stream().filter( |
| | | s -> (StringUtils.isNotBlank(s.getEnumId()) || StringUtils.isNotBlank(s.getEnumString())) |
| | | && |
| | | (finalOnlySelectAttrIdList.size() == 0 || finalOnlySelectAttrIdList.contains(s.getId().toLowerCase(Locale.ROOT))) |
| | | ).collect(Collectors.toList()); |
| | | List<CodeClassifyTemplateAttrVO> dateFormatAttrVOs = new ArrayList<>(); |
| | | List<CodeClassifyTemplateAttrVO> enumAttrVOs = new ArrayList<>(); |
| | | if (Func.isNotEmpty(templateVO.getAttributes())) { |
| | | dateFormatAttrVOs = templateVO.getAttributes().stream().filter( |
| | | s -> StringUtils.isNotBlank(s.getCodeDateFormat()) && |
| | | (finalOnlySelectAttrIdList.size() == 0 || finalOnlySelectAttrIdList.contains(s.getId().toLowerCase(Locale.ROOT))) |
| | | ).collect(Collectors.toList()); |
| | | //枚举的内容 |
| | | enumAttrVOs = templateVO.getAttributes().stream().filter( |
| | | s -> (StringUtils.isNotBlank(s.getEnumId()) || StringUtils.isNotBlank(s.getEnumString())) |
| | | && |
| | | (finalOnlySelectAttrIdList.size() == 0 || finalOnlySelectAttrIdList.contains(s.getId().toLowerCase(Locale.ROOT))) |
| | | ).collect(Collectors.toList()); |
| | | } |
| | | |
| | | List<String> userIds = new ArrayList<>(); |
| | | dataMap.stream().forEach(data -> { |
| | | List<CodeClassifyTemplateAttrVO> finalDateFormatAttrVOs = dateFormatAttrVOs; |
| | | List<CodeClassifyTemplateAttrVO> finalEnumAttrVOs = enumAttrVOs; |
| | | dataMap.stream().forEach(data -> { |
| | | //处理时间 |
| | | if (!form) { |
| | | //表单的时候只能用统一的时间格式 |
| | | wrapperDateFormat(dateFormatAttrVOs, data); |
| | | wrapperDateFormat(finalDateFormatAttrVOs, data); |
| | | } |
| | | //处理枚举 |
| | | wrapperEnum(enumAttrVOs, data); |
| | | wrapperEnum(finalEnumAttrVOs, data); |
| | | String lcstatus = data.get(VciQueryWrapperForDO.LC_STATUS_FIELD); |
| | | String copyFromVersion = data.getOrDefault(COPY_FROM_VERSION, ""); |
| | | if ((CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(lcstatus) || CodeDefaultLC.AUDITING.getValue().equalsIgnoreCase(lcstatus)) |
| | |
| | | //因为参照不一定是在平台的属性池里面设置,所以我们得需要自行处理 |
| | | //参考VciQueryWrapper来处理 |
| | | //1. 找到所有的字段, |
| | | Map<String, CodeClassifyTemplateAttrVO> attrVOMap = templateVO.getAttributes().stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); |
| | | List<String> selectFieldList = attrVOMap.keySet().stream().collect(Collectors.toList()); |
| | | Map<String, CodeClassifyTemplateAttrVO> attrVOMap = new HashMap<>(); |
| | | List<String> selectFieldList = new ArrayList<>(); |
| | | if(Func.isNotEmpty(templateVO.getAttributes())){ |
| | | attrVOMap = templateVO.getAttributes().stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); |
| | | selectFieldList = attrVOMap.keySet().stream().collect(Collectors.toList()); |
| | | } |
| | | |
| | | //所有的参照的字段 |
| | | Map<String/**属性字段**/, String> joinTableList = new ConcurrentHashMap<>(); |
| | | List<CodeClassifyTemplateAttrVO> referAttrVOs = templateVO.getAttributes().stream().filter( |
| | | s -> StringUtils.isNotBlank(s.getReferBtmId()) || StringUtils.isNotBlank(s.getReferConfig()) |
| | | ).collect(Collectors.toList()); |
| | | List<CodeClassifyTemplateAttrVO> referAttrVOs = null; |
| | | if (Func.isNotEmpty(templateVO.getAttributes())) { |
| | | referAttrVOs = templateVO.getAttributes().stream().filter( |
| | | s -> StringUtils.isNotBlank(s.getReferBtmId()) || StringUtils.isNotBlank(s.getReferConfig()) |
| | | ).collect(Collectors.toList()); |
| | | } |
| | | Map<String/**参照的属性**/, String/**实际的字段**/> referFieldMap = new ConcurrentHashMap<>(); |
| | | if (!CollectionUtils.isEmpty(referAttrVOs)) { |
| | | referAttrVOs.parallelStream().forEach(attrVO -> { |
| | | List<String> finalSelectFieldList = selectFieldList; |
| | | referAttrVOs.parallelStream().forEach(attrVO -> { |
| | | UIFormReferVO referVO = null; |
| | | if (StringUtils.isNotBlank(attrVO.getReferConfig())) { |
| | | referVO = JSONObject.parseObject(attrVO.getReferConfig(), UIFormReferVO.class); |
| | |
| | | showFieldInSource = textFields.get(0); |
| | | } |
| | | referFieldMap.put(attrVO.getId(), referTableNick + "." + showFieldInSource); |
| | | selectFieldList.add(referTableNick + "." + showFieldInSource + " as " + referShowField); |
| | | finalSelectFieldList.add(referTableNick + "." + showFieldInSource + " as " + referShowField); |
| | | }); |
| | | } |
| | | R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getDefaultAttrByBtmId(btmType); |
| | |
| | | } |
| | | }); |
| | | |
| | | andCondtionMap.forEach((k, v) -> { |
| | | andSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, attrVOMap, btmType)); |
| | | Map<String, CodeClassifyTemplateAttrVO> finalAttrVOMap = attrVOMap; |
| | | andCondtionMap.forEach((k, v) -> { |
| | | andSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, finalAttrVOMap, btmType)); |
| | | }); |
| | | orConditionMap.forEach((k, v) -> { |
| | | orSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, attrVOMap, btmType)); |
| | | orSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, finalAttrVOMap, btmType)); |
| | | }); |
| | | } |
| | | //组合起来 |
| | |
| | | List<UITableFieldVO> fieldVOList = new ArrayList<>(); |
| | | Map<String, String> comboxOrReferFieldMap = new HashMap<>(); |
| | | |
| | | templateVO.getAttributes().forEach(attrVO -> { |
| | | UITableFieldVO tableFieldVO = templateAttr2TableField(attrVO, forEdit); |
| | | if ("combox".equalsIgnoreCase(tableFieldVO.getFieldType())) { |
| | | comboxOrReferFieldMap.put(tableFieldVO.getSortField(), tableFieldVO.getField()); |
| | | } |
| | | if ("refer".equalsIgnoreCase(tableFieldVO.getFieldType())) { |
| | | comboxOrReferFieldMap.put(tableFieldVO.getSortField(), tableFieldVO.getField()); |
| | | } |
| | | if (StringUtils.isNotBlank(tableFieldVO.getEdit())) { |
| | | tableDefineVO.setHasEditor(true); |
| | | } |
| | | fieldVOList.add(tableFieldVO); |
| | | }); |
| | | if (Func.isNotEmpty(templateVO.getAttributes())) { |
| | | templateVO.getAttributes().forEach(attrVO -> { |
| | | UITableFieldVO tableFieldVO = templateAttr2TableField(attrVO, forEdit); |
| | | if ("combox".equalsIgnoreCase(tableFieldVO.getFieldType())) { |
| | | comboxOrReferFieldMap.put(tableFieldVO.getSortField(), tableFieldVO.getField()); |
| | | } |
| | | if ("refer".equalsIgnoreCase(tableFieldVO.getFieldType())) { |
| | | comboxOrReferFieldMap.put(tableFieldVO.getSortField(), tableFieldVO.getField()); |
| | | } |
| | | if (StringUtils.isNotBlank(tableFieldVO.getEdit())) { |
| | | tableDefineVO.setHasEditor(true); |
| | | } |
| | | fieldVOList.add(tableFieldVO); |
| | | }); |
| | | } |
| | | List<List<UITableFieldVO>> cols = new ArrayList<>(); |
| | | cols.add(fieldVOList); |
| | | tableDefineVO.setCols(cols); |
| | | Map<String, UITableFieldVO> fieldVOMap = fieldVOList.stream().collect(Collectors.toMap(s -> s.getField().toLowerCase(Locale.ROOT), t -> t)); |
| | | //查询属性 |
| | | List<CodeClassifyTemplateAttrVO> queryAttrVOs = templateVO.getAttributes().stream().filter(s -> BooleanEnum.TRUE.getValue().equalsIgnoreCase(s.getQueryAttrFlag())).collect(Collectors.toList()); |
| | | if (!CollectionUtils.isEmpty(queryAttrVOs)) { |
| | | List<UITableFieldVO> queryFieldVOs = new ArrayList<>(); |
| | | queryAttrVOs.stream().forEach(attrVO -> { |
| | | String attrId = attrVO.getId().toLowerCase(Locale.ROOT); |
| | | attrId = comboxOrReferFieldMap.getOrDefault(attrId, attrVO.getId()).toLowerCase(Locale.ROOT); |
| | | if (fieldVOMap.containsKey(attrId)) { |
| | | queryFieldVOs.add(fieldVOMap.get(attrId)); |
| | | } |
| | | }); |
| | | tableDefineVO.setQueryColumns(queryFieldVOs); |
| | | } |
| | | //高级属性 |
| | | List<CodeClassifyTemplateAttrVO> seniorQueryAttrVOs = templateVO.getAttributes().stream().filter(s -> BooleanEnum.TRUE.getValue().equalsIgnoreCase(s.getSeniorQueryAttrFlag())).collect(Collectors.toList()); |
| | | List<CodeClassifyTemplateAttrVO> seniorQueryAttrVOs = null; |
| | | if (Func.isNotEmpty(templateVO.getAttributes())) { |
| | | //查询属性 |
| | | List<CodeClassifyTemplateAttrVO> queryAttrVOs = templateVO.getAttributes().stream().filter(s -> BooleanEnum.TRUE.getValue().equalsIgnoreCase(s.getQueryAttrFlag())).collect(Collectors.toList()); |
| | | if (!CollectionUtils.isEmpty(queryAttrVOs)) { |
| | | List<UITableFieldVO> queryFieldVOs = new ArrayList<>(); |
| | | queryAttrVOs.stream().forEach(attrVO -> { |
| | | String attrId = attrVO.getId().toLowerCase(Locale.ROOT); |
| | | attrId = comboxOrReferFieldMap.getOrDefault(attrId, attrVO.getId()).toLowerCase(Locale.ROOT); |
| | | if (fieldVOMap.containsKey(attrId)) { |
| | | queryFieldVOs.add(fieldVOMap.get(attrId)); |
| | | } |
| | | }); |
| | | tableDefineVO.setQueryColumns(queryFieldVOs); |
| | | } |
| | | //高级属性 |
| | | seniorQueryAttrVOs = templateVO.getAttributes().stream().filter(s -> BooleanEnum.TRUE.getValue().equalsIgnoreCase(s.getSeniorQueryAttrFlag())).collect(Collectors.toList()); |
| | | } |
| | | if (!CollectionUtils.isEmpty(seniorQueryAttrVOs)) { |
| | | List<UITableFieldVO> queryFieldVOs = new ArrayList<>(); |
| | | seniorQueryAttrVOs.stream().forEach(attrVO -> { |