| | |
| | | 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 ArrayList<>(); |
| | | List<ClientBusinessObject> cboList = new CopyOnWriteArrayList<>(); |
| | | String fullPath = getFullPath(classifyFullInfo); |
| | | //我们需要获取到所有的下级分类的oid的路径,因为后面需要 |
| | | Map<String/**主键**/, String/**路径**/> childOidPathMap = getChildClassifyPathMap(classifyFullInfo, fullPath); |
| | |
| | | if (CollectionUtils.isEmpty(ruleOidMap.values())) { |
| | | throw new VciBaseException("导入的数据所选择的分类都没有设置编码规则"); |
| | | } |
| | | // TODO: 改用oid查询规则的,别用id |
| | | // TODO: 该用oid查询规则的,别用id |
| | | Map<String, CodeRuleVO> ruleVOMap = ruleService.listCodeRuleByOids(ruleOidMap.values()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)); |
| | | //校验编码规则和码段是否正确 |
| | | Map<String, List<String>> ruleRowIndexMap = new ConcurrentHashMap<>(); |
| | |
| | | total += commonsMapper.queryCountBySql(countSql); |
| | | } |
| | | }else{ |
| | | |
| | | total = commonsMapper.queryCountBySql(countSql); |
| | | } |
| | | List<String> selectFieldList = new ArrayList<>(); |
| | |
| | | |
| | | //都转换完了。需要批量检查 |
| | | //如果出错了,我们依然执行有效的数据,无效的数据写回到excel中 |
| | | |
| | | |
| | | Map<String,String> errorKeyMap=new HashMap<>(); |
| | | //1.分类注入 |
| | |
| | | }); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * excel转换为cbo的对象 |
| | | * @param classifyFullInfo 分类的全部信息 |
| | |
| | | ClientBusinessObject cbo=new ClientBusinessObject(); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(cbo, classifyFullInfo.getTopClassifyVO().getBtmTypeId()); |
| | | rowData.getData().forEach((index,value)->{ |
| | | String field = fieldIndexMap.get(index); |
| | | String field = fieldIndexMap.get(index); |
| | | if (StringUtils.isBlank(field)) { |
| | | throw new VciBaseException("第" + (index + 1) + "列的标题在系统中不存在"); |
| | | } |
| | |
| | | }); |
| | | } |
| | | } |
| | | |
| | | /*** |
| | | * 校验分类对应的模板信息 |
| | | * @param titleRowData |
| | |
| | | } |
| | | return codeClassifyTemplateVOList ; |
| | | } |
| | | |
| | | /** |
| | | * 从属性上获取参照的内容 |
| | | * @param attrVO 属性的信息 |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理分类注入 |
| | | * @param attrVOS 模板属性 |
| | |
| | | //因为数据量很大,所以得想办法并行 |
| | | //SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); |
| | | Map<String,List<BaseModel>> indexTODataMap=new ConcurrentHashMap<>(); |
| | | // 查询不需要参与关键属性校验的除自己以外的所有分类oid |
| | | String isParticipateCheckOids = classifyService.selectLeafByParentClassifyOid(classifyFullInfo.getTopClassifyVO().getOid(), classifyFullInfo.getCurrentClassifyVO().getOid()); |
| | | List<ClientBusinessObject> repeatDataMap = cboList.parallelStream().filter(cbo -> { |
| | | //每行都得查询.如果其中出现了错误,我们就直接抛出异常,其余的显示 |
| | | //VciBaseUtil.setCurrentUserSessionInfo(sessionInfo); |
| | |
| | | engineService.wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap); |
| | | }); |
| | | if (!CollectionUtils.isEmpty(ketAttrMap)) { |
| | | // 添加不参与关键属性校验的分类oid判断 |
| | | if(Func.isNotBlank(isParticipateCheckOids)){ |
| | | conditionMap.put("t.codeclsfid",QueryOptionConstant.NOTIN+isParticipateCheckOids); |
| | | } |
| | | CodeTemplateAttrSqlBO sqlBO = engineService.getSqlByTemplateVO(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), templateVO, conditionMap, null); |
| | | boolean isKeyCheck= commonsMapper.queryCountBySql(sqlBO.getSqlCount()) > 0; |
| | | if(isKeyCheck){ |
| | |
| | | if(StringUtils.isBlank(classifyPath)){ |
| | | classifyPath = "#current#"; |
| | | } |
| | | if ( !pathMap.containsKey(classifyPath)) { |
| | | if (!pathMap.containsKey(classifyPath)) { |
| | | String row_index = cbo.getAttributeValue(IMPORT_ROW_INDEX); |
| | | errorMap.put(row_index,errorMap.getOrDefault(row_index,"") + ";分类路径不存在"); |
| | | } else { |
| | |
| | | List<String>newOidList=new ArrayList<>(); |
| | | newOidList.add(oid); |
| | | if(keyAttrOkOidTORepeatOidMap.containsKey(okOid)){ |
| | | List<String> oldOidList= keyAttrOkOidTORepeatOidMap.get(okOid); |
| | | List<String> oldOidList = keyAttrOkOidTORepeatOidMap.get(okOid); |
| | | newOidList.addAll(oldOidList); |
| | | |
| | | } |