| | |
| | | import com.vci.ubcs.code.util.ClientBusinessObject; |
| | | import com.vci.ubcs.code.util.gennerAttrMapUtil; |
| | | import com.vci.ubcs.code.vo.pagemodel.*; |
| | | import com.vci.ubcs.code.vo.webserviceModel.person.*; |
| | | import com.vci.ubcs.code.vo.webserviceModel.apply.*; |
| | | import com.vci.ubcs.code.vo.webserviceModel.attrmap.*; |
| | | import com.vci.ubcs.code.vo.webserviceModel.attrmap.DataObjectVO; |
| | |
| | | import com.vci.ubcs.code.vo.webserviceModel.result.xml.XMLResultSystemVO; |
| | | import com.vci.ubcs.code.webService.annotation.VciWebservice; |
| | | import com.vci.ubcs.code.webService.config.AttributeMapConfig; |
| | | import com.vci.ubcs.code.webService.config.PersonAndDeptConfig; |
| | | import com.vci.ubcs.code.wrapper.CodeClassifyWrapper; |
| | | import com.vci.ubcs.omd.feign.IBtmTypeClient; |
| | | import com.vci.ubcs.omd.vo.BtmTypeVO; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vci.ubcs.code.constant.MdmEngineConstant.DEFAULT_SYNC_ATTR_LIST; |
| | |
| | | public boolean CODE_CHECKCONFIG; |
| | | @Autowired(required = false) |
| | | private AttributeMapConfig attributeMapConfig; |
| | | /*** |
| | | * 人员相关配置服务 |
| | | */ |
| | | @Autowired(required = false) |
| | | private PersonAndDeptConfig personAndDeptConfig; |
| | | /** |
| | | * 缓存服务 |
| | | */ |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /**** |
| | | * 人员数据同步 |
| | | * @param personData |
| | | * @return |
| | | * @throws Throwable |
| | | */ |
| | | @Override |
| | | public ResultOrgData syncDataForPerson(PersonData personData) { |
| | | boolean isUsedFlag= personAndDeptConfig.isUsedFlag(); |
| | | ResultOrgData resultOrgData=new ResultOrgData(); |
| | | boolean success=true; |
| | | String message=""; |
| | | if(isUsedFlag){ |
| | | List<PersonMasterData> masterDataList = personData.getMasterData(); |
| | | try { |
| | | String personLibrary = personAndDeptConfig.getPersonLibrary(); |
| | | if (StringUtils.isBlank(personLibrary)) { |
| | | success=false; |
| | | log.info("集成配置缺少人员库节点信息,personLibrary->" + personLibrary); |
| | | throw new Throwable("集成配置缺少人员库节点信息,personLibrary->" + personLibrary); |
| | | } |
| | | String personClassCode = personAndDeptConfig.getPersonClassCode(); |
| | | ClassfyVO classfyVO = new ClassfyVO(); |
| | | classfyVO.setLibrary(personLibrary); |
| | | classfyVO.setClassCode(personClassCode); |
| | | CodeClassifyVO codeClassifyVO=this.getClassfy(classfyVO,personLibrary); |
| | | log.info("end:分类查询完毕"); |
| | | //获取分类模板信息 |
| | | if(codeClassifyVO==null || StringUtils.isBlank(codeClassifyVO.getOid())){ |
| | | success=false; |
| | | throw new Throwable ("根据配置分类的分类编号,未获取到分类信息"); |
| | | } |
| | | CodeClassifyTemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(codeClassifyVO.getOid()); |
| | | if(templateVO==null||StringUtils.isBlank(templateVO.getOid())){ |
| | | success=false; |
| | | throw new Throwable ("根据传输的分类,未获取MDM系统中对应模板"); |
| | | } |
| | | List<PersonMasterData> personMasterDataList= personData.getMasterData(); |
| | | List<Map> dataList=new ArrayList<>(); |
| | | ApplyDatasVO applyDatasVO=new ApplyDatasVO(); |
| | | |
| | | |
| | | List<ApplyDataVO> applyDataVOList=new ArrayList<>(); |
| | | personMasterDataList.stream().forEach(personMasterData -> { |
| | | ApplyDataVO object=new ApplyDataVO(); |
| | | object.setCode(personMasterData.getLm_code());//编码 |
| | | object.setCreator(personMasterData.getCreator());//创建者 |
| | | object.setEditor(personMasterData.getModifier());//修改者 |
| | | object.setId(personMasterData.getId());//主键 |
| | | object.setStatus(CodeDefaultLC.RELEASED.getValue());//状态则需要判断 |
| | | Map<String,String> dataMap= VciBaseUtil.objectToMapString(personMasterData); |
| | | List<ProppertyVO> proppertyVOList=new ArrayList<>(); |
| | | dataMap.forEach((key,vaule)->{ |
| | | ProppertyVO proppertyVO=new ProppertyVO(); |
| | | proppertyVO.setKey(key); |
| | | proppertyVO.setValue(vaule); |
| | | proppertyVOList.add(proppertyVO); |
| | | }); |
| | | object.setProp(proppertyVOList); |
| | | applyDataVOList.add(object); |
| | | }); |
| | | applyDatasVO.setObject(applyDataVOList); |
| | | DataObjectVO dataObjectVO = new DataObjectVO(); |
| | | List<CodeClassifyTemplateAttrVO> attrVOS = templateVO.getAttributes().stream().filter(s -> !DEFAULT_SYNC_ATTR_LIST.contains(s.getId()) && VciBaseUtil.getBoolean(s.getFormDisplayFlag()) |
| | | ).collect(Collectors.toList()); |
| | | this.getConfigDatas("ERP", personLibrary, applyDatasVO, attrVOS, dataObjectVO); |
| | | log.info("end:数据组织完毕"); |
| | | //规则的主键需要去获取 |
| | | CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyVO.getOid()); |
| | | if(classifyFullInfo==null ||classifyFullInfo.getCurrentClassifyVO()==null || StringUtils.isBlank(classifyFullInfo.getCurrentClassifyVO().getOid())){ |
| | | success=false; |
| | | log.info("classifyFullInfo:"+"根据传输的分类,未获取分类相关信息"); |
| | | throw new Throwable ("根据传输的分类,未获取分类相关信息"); |
| | | } |
| | | CodeRuleVO ruleVO = engineService.getCodeRuleByClassifyFullInfo(classifyFullInfo); |
| | | if(ruleVO==null||StringUtils.isBlank(ruleVO.getOid())){ |
| | | success=false; |
| | | throw new Throwable ("根据传输的分类,未获取MDM系统中对应规则"); |
| | | } |
| | | log.info("end:规则获取完毕"); |
| | | |
| | | }catch (Throwable e){ |
| | | success=false; |
| | | message="人员数据接受失败:"+e.getMessage(); |
| | | }finally { |
| | | //组织返回结果 |
| | | masterDataList.stream().forEach(masterData -> { |
| | | ResultMdMapping resultMdMapping=new ResultMdMapping(); |
| | | resultMdMapping.setBusiDataId(masterData.getId()); |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | return resultOrgData; |
| | | } |
| | | /**** |
| | | * 部门数据同步 |
| | | * @param orgData |
| | | * @return |
| | | * @throws Throwable |
| | | */ |
| | | @Override |
| | | public ResultOrgData syncDataForOrg(OrgData orgData) { |
| | | return null; |
| | | } |
| | | /*** |
| | | * 统一更新接口(更改状态,更改属性信息)接口 |
| | | * @param data |
| | |
| | | throw new Throwable ("根据传输的分类,未获取到分类信息"); |
| | | } |
| | | log.info("end:分类查询完毕"); |
| | | |
| | | String operation=""; |
| | | if(CODE_CHECKCONFIG) { |
| | | //校验是否配置 |
| | |
| | | log.info("查询分类的数据类型:->"+dataType); |
| | | ResultClassifyVO resultClassifyVO =new ResultClassifyVO(); |
| | | List<ClassifyVO> classifyVOList=new ArrayList<>(); |
| | | ResultData resultData=new ResultData(); |
| | | com.vci.ubcs.code.vo.webserviceModel.classify.ResultData resultData=new com.vci.ubcs.code.vo.webserviceModel.classify.ResultData(); |
| | | try { |
| | | if (StringUtils.isBlank(data)) { |
| | | errorid = "101"; |