| | |
| | | String idFieldName = attrVOS.stream().filter(s -> VciQueryWrapperForDO.ID_FIELD.equalsIgnoreCase(s.getId())).findFirst().orElseGet(() -> new CodeClassifyTemplateAttrVO()).getName(); |
| | | getFieldIndexMap(titleRowData, attrNameIdMap, fieldIndexMap); |
| | | //先不用管属性是否都存在,先转换一下数据 |
| | | List<ClientBusinessObject> cboList = new CopyOnWriteArrayList<>(); |
| | | List<ClientBusinessObject> cboList = new ArrayList<>(); |
| | | String fullPath = getFullPath(classifyFullInfo); |
| | | //我们需要获取到所有的下级分类的oid的路径,因为后面需要 |
| | | Map<String/**主键**/, String/**路径**/> childOidPathMap = getChildClassifyPathMap(classifyFullInfo, fullPath); |
| | |
| | | //最后弄组合规则 |
| | | batchSwitchComponentAttrOnOrder(attrVOS,cboList); |
| | | //3.判断关键属性 |
| | | CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,errorMap); |
| | | CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,errorKeyMap); |
| | | Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList(); |
| | | Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); |
| | | |
| | | Map<String,List<String>>keyAttrOkOidTORepeatOidMap= keyResultVO.getKeyAttrOkOidTORepeatOidMap(); |
| | | if(!CollectionUtils.isEmpty(selfRepeatRowIndexList)){ |
| | | selfRepeatRowIndexList.stream().forEach(rowIndex->{ |
| | |
| | | resultDataObjectDetailDO.setMsg(errorMap.getOrDefault(rowIndex,"") + ";关键属性与系统中的重复" ); |
| | | resultDataObjectDetailDOs.add(resultDataObjectDetailDO); |
| | | */ |
| | | errorKeyMap.put(rowIndex, "关键属性与系统中的重复;" + errorMap.getOrDefault(rowIndex,"")); |
| | | Map<String, List<BaseModel>> indexTODataMap=keyResultVO.getIndexTODataMap(); |
| | | if(indexTODataMap.containsKey(rowIndex)){ |
| | | List<BaseModel> baseModelList= indexTODataMap.get(rowIndex); |
| | | } |
| | | errorKeyMap.put(rowIndex, "关键属性与系统中的重复;" + errorKeyMap.getOrDefault(rowIndex,"")); |
| | | }); |
| | | } |
| | | //校验属性是否正确错误信息 |
| | |
| | | Map<String, List<BaseModel>> indexTodataMap = keyResultVO.getIndexTODataMap(); |
| | | cboList.stream().forEach(cbo -> { |
| | | String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX); |
| | | String msg = errorKeyMap.get(rowIndex); |
| | | if (indexTodataMap.containsKey(rowIndex)) { |
| | | String oid = cbo.getOid(); |
| | | String sourceOid = oid; |
| | | String code = ""; |
| | | String groupCode=""; |
| | | String errorid = "201"; |
| | | if(codeOidToSystemOidMap.containsKey(oid)){ |
| | | sourceOid=codeOidToSystemOidMap.get(oid); |
| | | } |
| | | List<BaseModel> newCboList = indexTodataMap.get(rowIndex); |
| | | if (!CollectionUtils.isEmpty(newCboList)) { |
| | | BaseModel newCbo= newCboList.get(0); |
| | | String lcstatus =newCbo.getLcStatus(); |
| | | String newOid =newCbo.getOid(); |
| | | Date ts =newCbo.getTs(); |
| | | code = StringUtils.isBlank(newCbo.getId())?"":newCbo.getId(); |
| | | groupCode=newCbo.getData().getOrDefault("GROUPCODE",""); |
| | | String lastmodifier=newCbo.getLastModifier(); |
| | | if (lcstatus!=null&&!lcstatus.equals(CodeDefaultLC.RELEASED.getValue())) { |
| | | newCbo.setOid(newOid); |
| | | newCbo.setLastModifier(lastmodifier); |
| | | /*if(isCodeOrGroupCode) { |
| | | newCbo.setId(code); |
| | | }else{ |
| | | newCbo.getData().put("groupcode",groupCode); |
| | | }*/ |
| | | newCbo.setTs(ts); |
| | | cbo.setLastModifier(cbo.getLastModifier()); |
| | | editBoList.add(newCbo); |
| | | } |
| | | String mes = errorKeyMap.get(rowIndex); |
| | | XMLResultDataObjectDetailDO resultDataObjectDetailDO = new XMLResultDataObjectDetailDO(); |
| | | if(isCodeOrGroupCode) { |
| | | if(StringUtils.isBlank(groupCode)){ |
| | | errorid="1"; |
| | | mes+=";申请的编码类型为集团码,等待集团编码赋值"; |
| | | //处理关键属性查出多条的话,根据集成调用的当前分类代号取当前分类的码值。 |
| | | Map<String/**编码**/, BaseModel/**重复编码数据**/> classOidTOBaseModelMap = new HashMap<>(); |
| | | newCboList.stream().forEach(baseModel->{ |
| | | String codeclsfid=baseModel.getData().get(CODE_CLASSIFY_OID_FIELD.toUpperCase(Locale.ROOT)); |
| | | classOidTOBaseModelMap.put(codeclsfid,baseModel); |
| | | }); |
| | | String codeclsfid= classifyFullInfo.getCurrentClassifyVO().getOid(); |
| | | if(classOidTOBaseModelMap.containsKey(codeclsfid)){ |
| | | BaseModel newCbo= classOidTOBaseModelMap.get(codeclsfid); |
| | | String lcstatus =newCbo.getLcStatus(); |
| | | String newOid =newCbo.getOid(); |
| | | Date ts =newCbo.getTs(); |
| | | code = StringUtils.isBlank(newCbo.getId())?"":newCbo.getId(); |
| | | if(isCodeOrGroupCode) { |
| | | code=newCbo.getData().getOrDefault("GROUPCODE",""); |
| | | if(StringUtils.isBlank(code)){ |
| | | errorid="1"; |
| | | msg=";申请的编码类型为集团码,等待集团编码赋值"; |
| | | } |
| | | } |
| | | resultDataObjectDetailDO.setCode(groupCode); |
| | | String lastmodifier=newCbo.getLastModifier(); |
| | | if (lcstatus!=null&&!lcstatus.equals(CodeDefaultLC.RELEASED.getValue())) { |
| | | newCbo.setOid(newOid); |
| | | newCbo.setLastModifier(lastmodifier); |
| | | newCbo.setTs(ts); |
| | | cbo.setLastModifier(cbo.getLastModifier()); |
| | | editBoList.add(newCbo); |
| | | } |
| | | }else{ |
| | | resultDataObjectDetailDO.setCode(code); |
| | | errorid="205"; |
| | | msg+=";编码则属于其他分类。"; |
| | | } |
| | | XMLResultDataObjectDetailDO resultDataObjectDetailDO = new XMLResultDataObjectDetailDO(); |
| | | resultDataObjectDetailDO.setCode(code); |
| | | resultDataObjectDetailDO.setId(sourceOid); |
| | | resultDataObjectDetailDO.setErrorid(errorid); |
| | | resultDataObjectDetailDO.setMsg(mes); |
| | | resultDataObjectDetailDO.setMsg(msg); |
| | | |
| | | resultDataObjectDetailDOs.add(resultDataObjectDetailDO); |
| | | } |
| | |
| | | return; |
| | | } |
| | | //final String[] sql = {"select count(*) from " + tableName + " t where 1 = 1 "}; |
| | | final String[] sql = {"select id from " + tableName + " t where 1 = 1 "}; |
| | | final String[] sql = {"select t.id from " + tableName + " t where 1 = 1 "}; |
| | | conditionMap.forEach((key, value) -> { |
| | | if(StringUtils.isBlank(value)||value.equals(QueryOptionConstant.ISNULL)){ |
| | | sql[0] += " and " + key + " is null "; |
| | |
| | | if(!CollectionUtils.isEmpty(nullRowIndex)){ |
| | | String checkAttr = requiredAttrMap.values().stream().map(CodeClassifyTemplateAttrVO::getName).collect(Collectors.joining(",")); |
| | | nullRowIndex.stream().forEach(rowIndex->{ |
| | | errorMap.put(rowIndex,errorMap.getOrDefault(rowIndex,"") + ";校验规则不通过,有校验的属性为" + checkAttr); |
| | | errorMap.put(rowIndex,errorMap.getOrDefault(rowIndex,"") + ";校验规则必填项不通过,如果有必填属性为空,则填【/】代替,有校验的属性为" + checkAttr); |
| | | }); |
| | | } |
| | | } |
| | |
| | | newDataList.stream().forEach(stringStringMap -> { |
| | | BaseModel baseModel=new BaseModel(); |
| | | DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(stringStringMap,baseModel); |
| | | baseModel.setData(stringStringMap); |
| | | newCboList.add(baseModel); |
| | | }); |
| | | // 添加错误值 |
| | |
| | | childOidPathMap.put(childPath.getOid(),thisClassifyPath); |
| | | }); |
| | | } |
| | | String path=classifyFullInfo.getCurrentClassifyVO().getId(); |
| | | //根据客户选择的分类路径未id,还是name确定路径拼接 |
| | | childOidPathMap.put(classifyFullInfo.getCurrentClassifyVO().getOid(),fullPath); |
| | | return childOidPathMap; |
| | | } |
| | | |