| | |
| | | xmlResultDataObjectDetailDO.setCode(""); |
| | | xmlResultDataObjectDetailDO.setId(applyDataVO.getId()); |
| | | xmlResultDataObjectDetailDO.setErrorid(objerrorCode); |
| | | xmlResultDataObjectDetailDO.setMsg("编码维护失败:" + e.getMessage()); |
| | | xmlResultDataObjectDetailDO.setMsg("编码申请失败:" + e.getMessage()); |
| | | resultDataObjectDetailDOs.add(xmlResultDataObjectDetailDO); |
| | | }); |
| | | }else{ |
| | |
| | | xmlResultDataObjectDetailDO.setCode(""); |
| | | xmlResultDataObjectDetailDO.setId(""); |
| | | xmlResultDataObjectDetailDO.setErrorid(objerrorCode); |
| | | xmlResultDataObjectDetailDO.setMsg("编码维护失败:" + e.getMessage()); |
| | | xmlResultDataObjectDetailDO.setMsg("编码申请失败:" + e.getMessage()); |
| | | resultDataObjectDetailDOs.add(xmlResultDataObjectDetailDO); |
| | | } |
| | | e.printStackTrace(); |
| | |
| | | ApplyDatasVO applyDatasVO=new ApplyDatasVO(); |
| | | ApplyDatasVO editDatasVO=new ApplyDatasVO(); |
| | | if(!CollectionUtils.isEmpty(cboList)){ |
| | | Map<String,ClientBusinessObject> oldpplyDataVOMap= cboList.stream().filter(data -> data != null && StringUtils.isNotBlank(data.getId())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); |
| | | Map<String,ClientBusinessObject> oldpplyDataVOMap = cboList.stream().filter(data -> data != null && StringUtils.isNotBlank(data.getId())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); |
| | | //数据库不存在的 |
| | | List<ApplyDataVO> applyApplyDataVOList = applyDataVOList.stream().filter(cbo -> { |
| | | String code =cbo.getCode(); |
| | |
| | | public ResultOrgData syncDataForOrg(OrgData orgData) { |
| | | boolean isUsedFlag= personAndDeptConfig.isUsedFlag(); |
| | | ResultOrgData resultOrgData=new ResultOrgData(); |
| | | boolean isPersonApplyGroupCode= personAndDeptConfig.isPersonApplyGroupCode(); |
| | | boolean isPersonApplyGroupCode= personAndDeptConfig.isDeptApplyGroupCode(); |
| | | List<ResultMdMapping> resultMdMappingList=new ArrayList<>(); |
| | | AtomicBoolean success= new AtomicBoolean(true); |
| | | String message=""; |
| | | String systemCode=""; |
| | | if(isUsedFlag){ |
| | | List<OrgMasterData> orgMasterDataList=new ArrayList<>(); |
| | | List<String> fields= VciBaseUtil.str2List(personAndDeptConfig.getPersonFields()); |
| | | List<String> fields= VciBaseUtil.str2List(personAndDeptConfig.getDeptFields()); |
| | | try { |
| | | if(orgData==null){ |
| | | throw new Throwable("传入参数为null"); |
| | |
| | | throw new Throwable("用户鉴权失败"); |
| | | } |
| | | orgMasterDataList = orgData.getMasterData(); |
| | | String personLibrary = personAndDeptConfig.getPersonLibrary(); |
| | | if (StringUtils.isBlank(personLibrary)) { |
| | | String deptLibrary = personAndDeptConfig.getDeptLibrary(); |
| | | if (StringUtils.isBlank(deptLibrary)) { |
| | | success.set(false); |
| | | log.info("集成配置缺少人员库节点信息,personLibrary->" + personLibrary); |
| | | throw new Throwable("集成配置缺少人员库节点信息,personLibrary->" + personLibrary); |
| | | log.info("集成配置缺少部门库节点信息,deptLibrary->" + deptLibrary); |
| | | throw new Throwable("集成配置缺少部门库节点信息,deptLibrary->" + deptLibrary); |
| | | } |
| | | String personClassCode = personAndDeptConfig.getPersonClassCode(); |
| | | String deptClassCode = personAndDeptConfig.getDeptClassCode(); |
| | | ClassfyVO classfyVO = new ClassfyVO(); |
| | | classfyVO.setLibrary(personLibrary); |
| | | classfyVO.setClassCode(personClassCode); |
| | | CodeClassifyVO codeClassifyVO=this.getClassfy(classfyVO,personLibrary); |
| | | classfyVO.setLibrary(deptLibrary); |
| | | classfyVO.setClassCode(deptClassCode); |
| | | CodeClassifyVO codeClassifyVO=this.getClassfy(classfyVO,deptLibrary); |
| | | log.info("end:分类查询完毕"); |
| | | //获取分类模板信息 |
| | | if(codeClassifyVO==null || StringUtils.isBlank(codeClassifyVO.getOid())){ |
| | |
| | | CodeClassifyTemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(codeClassifyVO.getOid()); |
| | | if(templateVO==null||StringUtils.isBlank(templateVO.getOid())){ |
| | | success.set(false); |
| | | throw new Throwable ("根据传输的分类,未获取MDM系统中对应模板"); |
| | | throw new Throwable ("根据传输的分类,未获取MDM系统中对应模板"); |
| | | } |
| | | |
| | | List<CodeClassifyTemplateAttrVO> attrVOS = templateVO.getAttributes().stream().filter(s -> !DEFAULT_SYNC_ATTR_LIST.contains(s.getId()) && |
| | |
| | | LinkedList<XMLResultDataObjectDetailDO> resultDataObjectDetailDOs=new LinkedList<>(); |
| | | if(editDatasVO.getObject()!=null&&editDatasVO.getObject().size()>0){ |
| | | DataObjectVO dataObjectVO = new DataObjectVO(); |
| | | this.getConfigDatas(systemCode, personLibrary, editDatasVO, attrVOS, dataObjectVO); |
| | | this.getConfigDatas(systemCode, deptLibrary, editDatasVO, attrVOS, dataObjectVO); |
| | | log.info("start:修改数据执行完毕"); |
| | | boolean personApplyGroupCode =personAndDeptConfig.isPersonApplyGroupCode(); |
| | | mdmIOService.batchSyncEditDatas(codeClassifyVO,dataObjectVO, resultDataObjectDetailDOs,personApplyGroupCode); |
| | |
| | | } |
| | | if(applyDatasVO.getObject()!=null&&applyDatasVO.getObject().size()>0) { |
| | | DataObjectVO dataObjectVO = new DataObjectVO(); |
| | | this.getConfigDatas(systemCode, personLibrary, applyDatasVO, attrVOS, dataObjectVO); |
| | | this.getConfigDatas(systemCode, deptLibrary, applyDatasVO, attrVOS, dataObjectVO); |
| | | |
| | | CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyVO.getOid()); |
| | | CodeRuleVO ruleVO = engineService.getCodeRuleByClassifyFullInfo(classifyFullInfo); |
| | |
| | | } |
| | | }catch (Throwable e){ |
| | | success.set(false); |
| | | message="人员数据接受失败:"+e.getMessage(); |
| | | message="部门数据接受失败:"+e.getMessage(); |
| | | //组织返回结果 |
| | | boolean finalSuccess = success.get(); |
| | | String finalMessage = message; |
| | |
| | | codeBZApplyDTO.setLastModifier(applyBZDataVO.getEditor()); |
| | | codeBZApplyDTO.setLcStatus(applyBZDataVO.getStatus()); |
| | | ApplyBZDatasVO newApplyBZDatasVO=new ApplyBZDatasVO(); |
| | | applyBZDataVO.setProp(proppertyVOList); |
| | | newApplyBZDatasVO.setObject(Arrays.asList(applyBZDataVO)); |
| | | log.info("end:数据组织完毕"); |
| | | this.getConfigDatas(finalSystemId, finalLibray, newApplyBZDatasVO, attrVOS, dataObjectVO); |
| | |
| | | //调用集团申请接口申请集团码 |
| | | return resultStr; |
| | | } |
| | | |
| | | private void setPropertyValue(String key,String value,List<ProppertyVO> proppertyVOList){ |
| | | ProppertyVO proppertyVO=new ProppertyVO(); |
| | | proppertyVO.setKey(key); |
| | |
| | | proppertyVOList.add(proppertyVO); |
| | | |
| | | } |
| | | |
| | | /*** |
| | | * 查询校验分类信息 |
| | | * @param classfyVO |
| | |
| | | } |
| | | return classifyVO; |
| | | } |
| | | |
| | | /*** |
| | | * 查询校验分类信息 |
| | | * @param classfyVO |
| | |
| | | return clientBusinessObjectList; |
| | | } |
| | | |
| | | |
| | | private List<CodeOrderSecDTO> getRuleCodeOrderSecDTOsBZ(CodeRuleVO ruleVO,CodeClassifyFullInfoBO classifyFullInfo){ |
| | | List<CodeBasicSecVO> codeBasicSecVOS= ruleVO.getSecVOList(); |
| | | List<CodeOrderSecDTO> codeOrderSecDTOList=new ArrayList<>(); |
| | |
| | | } |
| | | return codeOrderSecDTOList; |
| | | } |
| | | |
| | | |
| | | /*** |
| | | * 根据传入的参数信息校验码段规则 |
| | |
| | | return codeOrderSecDTOList; |
| | | } |
| | | |
| | | /*** |
| | | * 读取属性映射配置信息 |
| | | * @param systemId |
| | | * @param libray |
| | | * @param applyDatasVO |
| | | * @param codeClassifyTemplateAttrVOList |
| | | * @param dataObjectVO |
| | | * @throws Throwable |
| | | */ |
| | | public void getConfigDatas(String systemId,String libray, ApplyBZDatasVO applyDatasVO,List<CodeClassifyTemplateAttrVO> codeClassifyTemplateAttrVOList,DataObjectVO dataObjectVO) throws Throwable { |
| | | |
| | | LinkedHashMap<String,LinkedHashMap<String,String>> dataKeyValueMap=new LinkedHashMap<>(); |
| | | //如果将数据转换成所需要的数据对象 |
| | | Map<String, String> attrMapConfigMap=new HashMap<>(); |
| | | Map<String, String> propMaps=new HashMap<>(); |
| | | try { |
| | | log.info("开始读取系统配置文件 start"); |
| | | Map<String, String> stringStringMap=attributeMapConfig.getSystem_attrmap(); |
| | | log.info("集成系统属性映射配置文件条目数-》"+stringStringMap.size()); |
| | | //stringStringMap.put("RLM","D:\\RLM.xml"); |
| | | if(!CollectionUtils.isEmpty(stringStringMap)) { |
| | | log.info("开始读取系统配置文件 start"); |
| | | Map<String, String> stringStringMap=attributeMapConfig.getSystem_attrmap(); |
| | | log.info("集成系统属性映射配置文件条目数-》"+stringStringMap.size()); |
| | | //stringStringMap.put("RLM","D:\\RLM.xml"); |
| | | if(!CollectionUtils.isEmpty(stringStringMap)) { |
| | | List<LibraryClsfDO> libraryClsfDOList=new ArrayList<>(); |
| | | try { |
| | | log.info("info:需要读取配置文件"); |
| | | LibraryDO libraryDO = gennerAttrMapUtil.getNewInstance().gennerAttrMapBySystem(systemId, stringStringMap); |
| | | List<LibraryClsfDO> libraryClsfDOList = libraryDO.getClsf(); |
| | | if(!CollectionUtils.isEmpty(libraryClsfDOList)) { |
| | | Map<String, List<ClsfAttrMappingDO>> libPropMaps = libraryClsfDOList.stream().collect(Collectors.toMap(LibraryClsfDO::getLibrary, LibraryClsfDO::getProp, (key1, key2) -> key2)); |
| | | log.info("根据参数:libray:-》" + libray + "从配置文件中找对应属性映射配置"); |
| | | String path=stringStringMap.get(systemId); |
| | | if (libPropMaps.containsKey(libray.toUpperCase(Locale.ROOT))) { |
| | | log.info("根据参数:libray:-》" + libray + "匹配到相应的属性映射信息"); |
| | | List<ClsfAttrMappingDO> clsfAttrMappingDOList = libPropMaps.get(libray.toUpperCase(Locale.ROOT)); |
| | | propMaps = clsfAttrMappingDOList.stream().collect(Collectors.toMap(ClsfAttrMappingDO::getSourceKey, ClsfAttrMappingDO::getTargetKey, (key1, key2) -> key2)); |
| | | log.info("根据参数:libray:-》" + libray + "匹配到相应的属性映射信息,属性映射条目数+" + clsfAttrMappingDOList.size()); |
| | | }else{ |
| | | throw new Throwable("根据系统标识【"+systemId+"】找到对应的配置文件:【"+path+"】,但未获取到对应的库【"+libray+"】属性映射信息配置"); |
| | | } |
| | | } |
| | | libraryClsfDOList = libraryDO.getClsf(); |
| | | } catch (Throwable e) { |
| | | objerrorCode = "1"; |
| | | e.printStackTrace(); |
| | | throw new Throwable("集成系统标识为:【" + systemId + "】,分类库为:【" + libray + "】的集成属性配置文件读取失败"); |
| | | } |
| | | log.info("根据参数:libray:-》"+libray+"从配置文件中找对应属性映射配置 end "); |
| | | }catch (Throwable e){ |
| | | objerrorCode="1"; |
| | | e.printStackTrace(); |
| | | throw new Throwable("集成系统标识为:【"+systemId+"】,分类库为:【"+libray+"】的集成属性配置文件读取失败"); |
| | | // String path = stringStringMap.get(systemId); |
| | | // 忽略key大小写,获取配置的映射文件路径 |
| | | String path = VciBaseUtil.getMapStrValueIgnoreCase(stringStringMap,systemId); |
| | | if (!CollectionUtils.isEmpty(libraryClsfDOList)) { |
| | | Map<String, List<ClsfAttrMappingDO>> libPropMaps = libraryClsfDOList.stream().collect(Collectors.toMap(LibraryClsfDO::getLibrary, LibraryClsfDO::getProp, (key1, key2) -> key2)); |
| | | log.info("根据参数:libray:-》" + libray + "从配置文件中找对应属性映射配置"); |
| | | if (libPropMaps.containsKey(libray.toUpperCase(Locale.ROOT))) { |
| | | log.info("根据参数:libray:-》" + libray + "匹配到相应的属性映射信息"); |
| | | List<ClsfAttrMappingDO> clsfAttrMappingDOList = libPropMaps.get(libray.toUpperCase(Locale.ROOT)); |
| | | propMaps = clsfAttrMappingDOList.stream().collect(Collectors.toMap(ClsfAttrMappingDO::getSourceKey, ClsfAttrMappingDO::getTargetKey, (key1, key2) -> key2)); |
| | | log.info("根据参数:libray:-》" + libray + "匹配到相应的属性映射信息,属性映射条目数+" + clsfAttrMappingDOList.size()); |
| | | } else { |
| | | objerrorCode = "1"; |
| | | throw new Throwable("根据系统标识【" + systemId + "】找到对应的配置文件:【" + path + "】,但未获取到对应的库【" + libray + "】属性映射信息配置"); |
| | | } |
| | | }else{ |
| | | objerrorCode = "1"; |
| | | throw new Throwable("根据系统标识【" + systemId + "】找到对应的配置文件:【" + path + "】,但未获取到对应的库【" + libray + "】属性映射信息配置"); |
| | | } |
| | | }else{ |
| | | objerrorCode = "1"; |
| | | throw new Throwable("未获取到集成属性映射系统配置信息"); |
| | | } |
| | | log.info("根据参数:libray:-》"+libray+"从配置文件中找对应属性映射配置 end "); |
| | | LinkedList<String> rowNameList=new LinkedList<>(); |
| | | LinkedHashMap<String,Integer> filedIndexMap=new LinkedHashMap<>(); |
| | | //根据分类模板组织数据 |
| | |
| | | } |
| | | |
| | | /*** |
| | | * 根据属性映射转换编码所需字段 |
| | | * 读取属性映射配置信息 |
| | | * @param systemId |
| | | * @param libray |
| | | * @param applyDatasVO |
| | | * @param codeClassifyTemplateAttrVOList |
| | | * @param dataObjectVO |
| | | * @throws Throwable |
| | | */ |
| | | public void getConfigDatas(String systemId,String libray, ApplyDatasVO applyDatasVO,List<CodeClassifyTemplateAttrVO> codeClassifyTemplateAttrVOList,DataObjectVO dataObjectVO) throws Throwable { |
| | | |
| | |
| | | //如果将数据转换成所需要的数据对象 |
| | | Map<String, String> attrMapConfigMap=new HashMap<>(); |
| | | Map<String, String> propMaps=new HashMap<>(); |
| | | try { |
| | | log.info("开始读取系统配置文件 start"); |
| | | Map<String, String> stringStringMap=attributeMapConfig.getSystem_attrmap(); |
| | | log.info("集成系统属性映射配置文件条目数-》"+stringStringMap.size()); |
| | | //stringStringMap.put("RLM","D:\\RLM.xml"); |
| | | if(!CollectionUtils.isEmpty(stringStringMap)) { |
| | | log.info("开始读取系统配置文件 start"); |
| | | Map<String, String> stringStringMap=attributeMapConfig.getSystem_attrmap(); |
| | | log.info("集成系统属性映射配置文件条目数-》"+stringStringMap.size()); |
| | | //stringStringMap.put("RLM","D:\\RLM.xml"); |
| | | if(!CollectionUtils.isEmpty(stringStringMap)) { |
| | | List<LibraryClsfDO> libraryClsfDOList=new ArrayList<>(); |
| | | try { |
| | | log.info("info:需要读取配置文件"); |
| | | LibraryDO libraryDO = gennerAttrMapUtil.getNewInstance().gennerAttrMapBySystem(systemId, stringStringMap); |
| | | List<LibraryClsfDO> libraryClsfDOList = libraryDO.getClsf(); |
| | | if(!CollectionUtils.isEmpty(libraryClsfDOList)) { |
| | | Map<String, List<ClsfAttrMappingDO>> libPropMaps = libraryClsfDOList.stream().collect(Collectors.toMap(LibraryClsfDO::getLibrary, LibraryClsfDO::getProp, (key1, key2) -> key2)); |
| | | log.info("根据参数:libray:-》" + libray + "从配置文件中找对应属性映射配置"); |
| | | String path=stringStringMap.get(systemId); |
| | | if (libPropMaps.containsKey(libray.toUpperCase(Locale.ROOT))) { |
| | | log.info("根据参数:libray:-》" + libray + "匹配到相应的属性映射信息"); |
| | | List<ClsfAttrMappingDO> clsfAttrMappingDOList = libPropMaps.get(libray.toUpperCase(Locale.ROOT)); |
| | | propMaps = clsfAttrMappingDOList.stream().collect(Collectors.toMap(ClsfAttrMappingDO::getSourceKey, ClsfAttrMappingDO::getTargetKey, (key1, key2) -> key2)); |
| | | log.info("根据参数:libray:-》" + libray + "匹配到相应的属性映射信息,属性映射条目数+" + clsfAttrMappingDOList.size()); |
| | | }else{ |
| | | throw new Throwable("根据系统标识【"+systemId+"】找到对应的配置文件:【"+path+"】,但未获取到对应的库【"+libray+"】属性映射信息配置"); |
| | | } |
| | | } |
| | | libraryClsfDOList = libraryDO.getClsf(); |
| | | } catch (Throwable e) { |
| | | objerrorCode = "1"; |
| | | e.printStackTrace(); |
| | | throw new Throwable("集成系统标识为:【" + systemId + "】,分类库为:【" + libray + "】的集成属性配置文件读取失败"); |
| | | } |
| | | log.info("根据参数:libray:-》"+libray+"从配置文件中找对应属性映射配置 end "); |
| | | }catch (Throwable e){ |
| | | objerrorCode="1"; |
| | | e.printStackTrace(); |
| | | throw new Throwable("集成系统标识为:【"+systemId+"】,分类库为:【"+libray+"】的集成属性配置文件读取失败"); |
| | | // String path = stringStringMap.get(systemId); |
| | | // 忽略key大小写,获取配置的映射文件路径 |
| | | String path = VciBaseUtil.getMapStrValueIgnoreCase(stringStringMap,systemId); |
| | | if (!CollectionUtils.isEmpty(libraryClsfDOList)) { |
| | | Map<String, List<ClsfAttrMappingDO>> libPropMaps = libraryClsfDOList.stream().collect(Collectors.toMap(LibraryClsfDO::getLibrary, LibraryClsfDO::getProp, (key1, key2) -> key2)); |
| | | log.info("根据参数:libray:-》" + libray + "从配置文件中找对应属性映射配置"); |
| | | if (libPropMaps.containsKey(libray.toUpperCase(Locale.ROOT))) { |
| | | log.info("根据参数:libray:-》" + libray + "匹配到相应的属性映射信息"); |
| | | List<ClsfAttrMappingDO> clsfAttrMappingDOList = libPropMaps.get(libray.toUpperCase(Locale.ROOT)); |
| | | propMaps = clsfAttrMappingDOList.stream().collect(Collectors.toMap(ClsfAttrMappingDO::getSourceKey, ClsfAttrMappingDO::getTargetKey, (key1, key2) -> key2)); |
| | | log.info("根据参数:libray:-》" + libray + "匹配到相应的属性映射信息,属性映射条目数+" + clsfAttrMappingDOList.size()); |
| | | } else { |
| | | objerrorCode = "1"; |
| | | throw new Throwable("根据系统标识【" + systemId + "】找到对应的配置文件:【" + path + "】,但未获取到对应的库【" + libray + "】属性映射信息配置"); |
| | | } |
| | | }else{ |
| | | objerrorCode = "1"; |
| | | throw new Throwable("根据系统标识【" + systemId + "】找到对应的配置文件:【" + path + "】,但未获取到对应的库【" + libray + "】属性映射信息配置"); |
| | | } |
| | | }else{ |
| | | objerrorCode = "1"; |
| | | throw new Throwable("未获取到集成属性映射系统配置信息"); |
| | | } |
| | | log.info("根据参数:libray:-》"+libray+"从配置文件中找对应属性映射配置 end "); |
| | | LinkedList<String> rowNameList=new LinkedList<>(); |
| | | LinkedHashMap<String,Integer> filedIndexMap=new LinkedHashMap<>(); |
| | | //根据分类模板组织数据 |
| | |
| | | throw new Throwable("组织数据映射值失败"); |
| | | } |
| | | } |
| | | |
| | | /*** |
| | | * 记录日志信息 |
| | | * @param systemId |