| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.vci.ubcs.code.feign.IMdmEngineClient; |
| | | import com.vci.ubcs.code.webservice.entity.*; |
| | | import com.vci.ubcs.code.webservice.service.IGroupMdmInterService; |
| | | import com.vci.ubcs.code.webservice.vo.*; |
| | | import com.vci.ubcs.starter.util.MdmBtmTypeConstant; |
| | | import com.vci.ubcs.code.webservice.feign.MdmApplyGroupCodeProvider; |
| | | import com.vci.ubcs.code.webservice.mapper.DockingPreAttrMappingMapper; |
| | | import com.vci.ubcs.code.webservice.service.*; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.revision.model.BaseModel; |
| | | import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil; |
| | | import com.vci.ubcs.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.vci.ubcs.starter.revision.model.BaseModel; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | * 集团分类服务 |
| | | */ |
| | | @Autowired(required = false) |
| | | private IDockingPreClassifyService dockingPreClassifyService; |
| | | private com.vci.ubcs.code.webservice.service.IDockingPreClassifyService dockingPreClassifyService; |
| | | |
| | | /*** |
| | | * 申请单服务 |
| | | */ |
| | | @Autowired(required = false) |
| | | private IDockingPreApplyFormService dockingPreApplyFormService; |
| | | private com.vci.ubcs.code.webservice.service.IDockingPreApplyFormService dockingPreApplyFormService; |
| | | |
| | | |
| | | /*** |
| | | * 模型视图单服务 |
| | | */ |
| | | @Autowired(required = false) |
| | | private IDockingPreViewModelService dockingPreViewModelService; |
| | | private com.vci.ubcs.code.webservice.service.IDockingPreViewModelService dockingPreViewModelService; |
| | | |
| | | |
| | | /*** |
| | |
| | | * 属性取值范围服务 |
| | | */ |
| | | @Autowired(required = false) |
| | | private IDockingPreAttrRangeService dockingPreAttrRangeService; |
| | | private com.vci.ubcs.code.webservice.service.IDockingPreAttrRangeService dockingPreAttrRangeService; |
| | | |
| | | |
| | | /*** |
| | | * 集团属性服务 |
| | | */ |
| | | @Autowired(required = false) |
| | | private IDockingPreMetaAttrService dockingPreMetaAttrService; |
| | | private com.vci.ubcs.code.webservice.service.IDockingPreMetaAttrService dockingPreMetaAttrService; |
| | | |
| | | @Autowired(required = false) |
| | | private IMdmEngineClient mdmEngineClient; |
| | | /*** |
| | | * 主数据像集团申请编码 |
| | | * @param oids 需要申请的数据主键数组 |
| | |
| | | public R applyGroupCode(String oids, String btmName) throws VciBaseException { |
| | | try { |
| | | List<BaseModel> updateCbos = new ArrayList<BaseModel>(); |
| | | |
| | | List<DockingPreApplyForm> dockingPreAttrMappings = new ArrayList<>(); |
| | | VciBaseUtil.alertNotNull(oids, "选择的数据"); |
| | | VciBaseUtil.alertNotNull(btmName, "业务类型"); |
| | | //List<BaseModelVO> codeWupins=mdmEngineService.listByIds(VciBaseUtil.str2List(oids)); |
| | | List<BaseModelVO> dataModelList = new ArrayList<>(); |
| | | R<List<BaseModel>> baseModelR =mdmEngineClient.selectByTypeAndOid(btmName,oids); |
| | | List<BaseModel> dataModelList= baseModelR.getData(); |
| | | if (!CollectionUtils.isEmpty(dataModelList)) { |
| | | DockingGroupDataVO dockingGroupDataVO = new DockingGroupDataVO(); |
| | | //申请单和申请单对象关系 |
| | | Map<String, DockingPreApplyForm> addDockingPreApplyFormMap = new HashMap<String, DockingPreApplyForm>(); |
| | | Map<String, DockingPreApplyForm> editDockingPreApplyFormMap = new HashMap<String, DockingPreApplyForm>(); |
| | | Map<String, BaseModelVO> baseModelVOMap = new HashMap<String, BaseModelVO>(); |
| | | Map<String, BaseModel> baseModelMap = new HashMap<String, BaseModel>(); |
| | | //组织数据 |
| | | dockingGroupDataVO = queryApplycodeDataObjects(1, dataModelList, addDockingPreApplyFormMap, editDockingPreApplyFormMap, baseModelVOMap); |
| | | dockingGroupDataVO = queryApplycodeDataObjects(1, dataModelList, addDockingPreApplyFormMap, editDockingPreApplyFormMap, baseModelMap); |
| | | DockingResultVO resultDataObject = mdmApplyGroupCodeProvider.receiveAddApply(dockingGroupDataVO); |
| | | code = resultDataObject.getCode(); |
| | | msg = resultDataObject.getMsg(); |
| | |
| | | } |
| | | //如果有集团码则更新数据 |
| | | if (isEditDatas) { |
| | | if (baseModelVOMap.containsKey(applyId)) { |
| | | BaseModelVO baseModelVO = baseModelVOMap.get(applyId); |
| | | BaseModel baseModel = new BaseModel(); |
| | | BeanUtilForVCI.copyDeclaredIgnoreCase(baseModelVO, baseModel); |
| | | if (baseModelMap.containsKey(applyId)) { |
| | | BaseModel baseModel = baseModelMap.get(applyId); |
| | | BeanUtilForVCI.copyDeclaredIgnoreCase(baseModel, baseModel); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(baseModel); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(baseModel); |
| | | baseModelVO.setId(customCoding); |
| | | //baseModel.setId(customCoding); |
| | | baseModel.getData().getOrDefault("groupCode",customCoding); |
| | | updateCbos.add(baseModel);//更新数据集团code |
| | | } |
| | | } |
| | |
| | | } |
| | | //保存表单数据 |
| | | dockingPreApplyFormService.saveOrUpdateBatch(dockingPreAttrMappings); |
| | | //mdmEngineService.saveBatch(updateCbos);//保存数据 |
| | | mdmEngineClient.insertBatchByType(btmName,updateCbos);//保存数据 |
| | | } |
| | | return R.success("申请接口调用成功"); |
| | | }catch (VciBaseException e){ |
| | |
| | | VciBaseUtil.alertNotNull(oids,"选择的数据"); |
| | | VciBaseUtil.alertNotNull(btmName,"业务类型"); |
| | | //List<BaseModelVO> codeWupins=mdmEngineService.listByIds(VciBaseUtil.str2List(oids)); |
| | | List<BaseModelVO> dataModelList = new ArrayList<>(); |
| | | List<BaseModel> dataModelList = new ArrayList<>(); |
| | | try { |
| | | if (!CollectionUtils.isEmpty(dataModelList)) { |
| | | DockingGroupDataVO dockingGroupDataVO = new DockingGroupDataVO(); |
| | | //申请单和申请单对象关系 |
| | | Map<String, DockingPreApplyForm> addDockingPreApplyFormMap = new HashMap<String, DockingPreApplyForm>(); |
| | | Map<String, DockingPreApplyForm> editDockingPreApplyFormMap = new HashMap<String, DockingPreApplyForm>(); |
| | | Map<String, BaseModelVO> baseModelVOMap = new HashMap<String, BaseModelVO>(); |
| | | Map<String, BaseModel> baseModelMap = new HashMap<String, BaseModel>(); |
| | | //组织数据 |
| | | dockingGroupDataVO = queryApplycodeDataObjects(2, dataModelList, addDockingPreApplyFormMap, editDockingPreApplyFormMap, baseModelVOMap); |
| | | dockingGroupDataVO = queryApplycodeDataObjects(2, dataModelList, addDockingPreApplyFormMap, editDockingPreApplyFormMap, baseModelMap); |
| | | DockingResultVO resultDataObject = mdmApplyGroupCodeProvider.receiveEditApply(dockingGroupDataVO); |
| | | code = resultDataObject.getCode(); |
| | | msg = resultDataObject.getMsg(); |
| | |
| | | } |
| | | //如果有集团码则更新数据 |
| | | if (isEditDatas) { |
| | | if (baseModelVOMap.containsKey(applyId)) { |
| | | BaseModelVO baseModelVO = baseModelVOMap.get(applyId); |
| | | BaseModel baseModel = new BaseModel(); |
| | | BeanUtilForVCI.copyDeclaredIgnoreCase(baseModelVO, baseModel); |
| | | if (baseModelMap.containsKey(applyId)) { |
| | | BaseModel baseModel = baseModelMap.get(applyId); |
| | | //BeanUtilForVCI.copyDeclaredIgnoreCase(baseModelVO, baseModel); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(baseModel); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(baseModel); |
| | | baseModelVO.setId(customCoding); |
| | | // baseModel.setId(customCoding); |
| | | baseModel.getData().getOrDefault("groupCode",customCoding); |
| | | updateCbos.add(baseModel);//更新数据集团code |
| | | } |
| | | } |
| | |
| | | } |
| | | //保存表单数据 |
| | | dockingPreApplyFormService.saveOrUpdateBatch(dockingPreAttrMappings); |
| | | //mdmEngineService.saveBatch(updateCbos);//保存数据 |
| | | mdmEngineClient.insertBatchByType(btmName,updateCbos);//保存数据 |
| | | } |
| | | return R.success("申请接口调用成功"); |
| | | }catch (VciBaseException e){ |
| | |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public R queryClassModel(String groupClassifyId) throws VciBaseException { |
| | | public R queryClassModel(String groupClassifyId) throws Throwable { |
| | | log.info("获取集团模型详细信息执行保存start"); |
| | | String message="执行成功!"; |
| | | try { |
| | |
| | | throw new Throwable(message); |
| | | } |
| | | }else{ |
| | | message="未获从集团获取到任何模型信息"; |
| | | message="未从集团获取到任何模型信息"; |
| | | log.info(message); |
| | | throw new Throwable(message); |
| | | } |
| | |
| | | dockingPreClassify.setPid(pid); |
| | | dockingPreClassify.setId(classNumber); |
| | | dockingPreClassify.setNodeLink(nodeLink); |
| | | dockingPreClassify.setGetNodeLinkName(nodeLinkName); |
| | | dockingPreClassify.setNodeLinkName(nodeLinkName); |
| | | dockingPreClassify.setClassName(className); |
| | | dockingPreClassify.setVersionValue(version); |
| | | dockingPreClassifyList.add(dockingPreClassify); |
| | |
| | | throw new Throwable(message); |
| | | } |
| | | }else{ |
| | | message="未获从集团获取到任何模型信息"; |
| | | message="未从集团获取到任何模型信息"; |
| | | log.info(message); |
| | | throw new Throwable(message); |
| | | } |
| | |
| | | * @param dataOids |
| | | * @return 执行结果 |
| | | */ |
| | | public R queryApplyState(String dataOids) { |
| | | @Override |
| | | public R queryApplyState(String dataOids) throws VciBaseException { |
| | | |
| | | String message="执行成功!"; |
| | | log.info("查询申请单状态接口statr"); |
| | | try { |
| | | VciBaseUtil.alertNotNull(dataOids,"所查申请单数据主键"); |
| | | VciBaseUtil.alertNotNull(dockingApplySysName,"系统标识配置:docking.apply.unitCode"); |
| | | |
| | | List<String> applyIdList=new ArrayList<>(); |
| | | List<DockingPreApplyForm> dockingPreApplyFormList= this.dockingPreApplyFormService.list(Wrappers.<DockingPreApplyForm>query().lambda().in(DockingPreApplyForm::getDataOid, VciBaseUtil.str2List(dataOids))); |
| | | Map<String,DockingPreApplyForm> dockingPreApplyFormMap=new HashMap<>(); |
| | | dockingPreApplyFormList.stream().forEach(dockingPreApplyForm -> { |
| | | dockingPreApplyForm.getId(); |
| | | |
| | | applyIdList.add(dockingPreApplyForm.getId()); |
| | | dockingPreApplyFormMap.put(dockingPreApplyForm.getId(),dockingPreApplyForm); |
| | | }); |
| | | |
| | | DockingModelQueryVO dockingModelQueryVO=new DockingModelQueryVO(); |
| | | dockingModelQueryVO.setApplyNums(VciBaseUtil.array2String(applyIdList.toArray(new String[]{}))); |
| | | dockingModelQueryVO.setSysName(dockingApplySysName); |
| | | DockingApplyFormQueryStatusVO dockingApplyFormQueryStatusVO=mdmApplyGroupCodeProvider.queryApplyState(dockingModelQueryVO); |
| | | |
| | | int code=dockingApplyFormQueryStatusVO.getCode(); |
| | | String mesg=dockingApplyFormQueryStatusVO.getMsg(); |
| | | if(code==1){ |
| | | List<DockingApplyFormStatusVO> dockingApplyFormStatusVOList=dockingApplyFormQueryStatusVO.getData(); |
| | | if(CollectionUtils.isEmpty(dockingApplyFormStatusVOList)){ |
| | | for (DockingApplyFormStatusVO applyFormDataState : dockingApplyFormStatusVOList) { |
| | | String applyId=applyFormDataState.getApplyNum(); |
| | | String state= applyFormDataState.getFormState(); |
| | | String examineOpinion=applyFormDataState.getExamineOpinion(); |
| | | String jmsg=getCodeState(state)+",意见:"+examineOpinion; |
| | | if(dockingPreApplyFormMap.containsKey(applyId)){ |
| | | DockingPreApplyForm applyFormObject=dockingPreApplyFormMap.get(applyId); |
| | | applyFormObject.setMsg(jmsg); |
| | | } |
| | | } |
| | | boolean res=this.dockingPreApplyFormService.saveOrUpdateBatch(dockingPreApplyFormList); |
| | | if(res){ |
| | | R.success("申请集团码状态查询成功:"+mesg); |
| | | } |
| | | }else{ |
| | | throw new Throwable("没有获取到相关数据信息"); |
| | | } |
| | | }else{ |
| | | throw new Throwable(mesg); |
| | | } |
| | | |
| | | }catch (Throwable e){ |
| | | e.printStackTrace();; |
| | | log.error("获取数据模型失败"+e); |
| | | R.fail(message); |
| | | log.error("获取申请单状态失败"+e); |
| | | throw new VciBaseException(message); |
| | | } |
| | | log.info("查询申请单状态接口end"); |
| | | return R.success(message); |
| | | } |
| | | |
| | | /*** |
| | | * 同步集团模型信息 |
| | | * @param classifyId |
| | | * @param operationType |
| | | * @return 返回执行结果 |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public R syncClassifyModel(String classifyId, String operationType) throws VciBaseException { |
| | | VciBaseUtil.alertNotNull(operationType,"集成操作类型"); |
| | | try { |
| | | if(operationType.equals("all")){ |
| | | return queryMdmModel(); |
| | | }else{ |
| | | VciBaseUtil.alertNotNull(classifyId,"集团分类主键"); |
| | | return queryClassModel(classifyId); |
| | | } |
| | | } catch (Throwable e) { |
| | | throw new VciBaseException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /*** |
| | | * 组织 保存数据方法 |
| | | * |
| | |
| | | dockingPreClassify.setPid(pid); |
| | | dockingPreClassify.setId(classNumber); |
| | | dockingPreClassify.setNodeLink(nodeLink); |
| | | dockingPreClassify.setGetNodeLinkName(nodeLinkName); |
| | | dockingPreClassify.setNodeLinkName(nodeLinkName); |
| | | dockingPreClassify.setClassName(className); |
| | | dockingPreClassifyArrayList.add(dockingPreClassify); |
| | | // 获取对应的分类视图模型 |
| | |
| | | /** |
| | | * 组织数据 |
| | | * */ |
| | | private DockingGroupDataVO queryApplycodeDataObjects(int optationtype,List<BaseModelVO> codeWupins,Map<String,DockingPreApplyForm> addDockingPreApplyFormMap,Map<String,DockingPreApplyForm> editDockingPreApplyFormMap,Map<String,BaseModelVO> codeWupinMap) throws VciBaseException{ |
| | | private DockingGroupDataVO queryApplycodeDataObjects(int optationtype,List<BaseModel> codeWupins,Map<String,DockingPreApplyForm> addDockingPreApplyFormMap,Map<String,DockingPreApplyForm> editDockingPreApplyFormMap,Map<String,BaseModel> codeWupinMap) throws VciBaseException{ |
| | | try { |
| | | String curUserName = AuthUtil.getUser().getUserName(); |
| | | //申请的数据 |
| | | List<DockingMainData> mainDataList=new ArrayList<DockingMainData>(); |
| | | for (BaseModelVO dataBusinessObject : codeWupins) { |
| | | for (BaseModel dataBusinessObject : codeWupins) { |
| | | String format = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()); |
| | | String codeclsfid = dataBusinessObject.getData().getOrDefault("codeclsfid",""); |
| | | String btmName = dataBusinessObject.getBtmname(); |
| | |
| | | DockingMainData mainData = new DockingMainData(); |
| | | mainData.setApplyEntId(dockingApplyUnitCode);//申请单位代码 |
| | | mainData.setApplyId(apllyCode);//申请单号 |
| | | mainData.setClassName(dockingPreClassify.getGetNodeLinkName());//分类名称 |
| | | mainData.setClassName(dockingPreClassify.getNodeLinkName());//分类名称 |
| | | mainData.setCreateBy(curUserName);// |
| | | mainData.setSecretLevel("内部");//密级,默认为内部 |
| | | mainData.setViewInfos(getviewInfos(optationtype,dockingPreClassify, dataBusinessObject));//获取视图模型 |
| | |
| | | * @param dataBusinessObject |
| | | * @throws VciBaseException |
| | | */ |
| | | private List<DockingViewVO>getviewInfos(int type, DockingPreClassify dockingPreClassify, BaseModelVO dataBusinessObject) throws Throwable{ |
| | | private List<DockingViewVO>getviewInfos(int type, DockingPreClassify dockingPreClassify, BaseModel dataBusinessObject) throws Throwable{ |
| | | List<DockingViewVO> viewInfoList=new ArrayList<>(); |
| | | String jclassOid= dockingPreClassify.getOid(); |
| | | List<DockingPreViewModel> dockingPreViewModels=new ArrayList<>(); |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | private List<Map<String, Object>> getViewValueList(DockingPreViewModel dockingPreViewModel,String jclassOid,BaseModelVO dataBusinessObject) throws Throwable{ |
| | | private List<Map<String, Object>> getViewValueList(DockingPreViewModel dockingPreViewModel,String jclassOid,BaseModel dataBusinessObject) throws Throwable{ |
| | | //构造模型视图数据 |
| | | List<Map<String, Object>> viewValueList=new ArrayList<Map<String,Object>>(); |
| | | String oid = dockingPreViewModel.getOid(); |
| | | Map<String,String> dataValueMap=dataBusinessObject.getData(); |
| | | String codeClassifyId=dataValueMap.get("codeclsfid"); |
| | | Map<String,String>conditionsMap=new HashMap<String, String>(); |
| | | |
| | | |
| | | |
| | | List<DockingPreAttrMapping> dockingPreAttrMappingList = dockingPreAttrMappingMapper.selectList(Wrappers.<DockingPreAttrMapping>query().lambda() |
| | | .eq(DockingPreAttrMapping::getSourceClassifyId, jclassOid).eq(DockingPreAttrMapping::getTargetClassifyId, codeClassifyId)); |
| | | if(CollectionUtils.isEmpty(dockingPreAttrMappingList)) { |
| | |
| | | } |
| | | return value; |
| | | } |
| | | |
| | | private String getCodeState(String formState){ |
| | | String msg=""; |
| | | if("1".equals(formState)){ |
| | | msg="集团审核中"; |
| | | }else if("2".equals(formState)){ |
| | | msg="驳回"; |
| | | }else if("3".equals(formState)){ |
| | | msg="集团审核中"; |
| | | }else if("4".equals(formState)){ |
| | | msg="审核结束,赋码失败"; |
| | | }else if("5".equals(formState)){ |
| | | msg="审核结束,赋码成功"; |
| | | }else if("6".equals(formState)){ |
| | | msg="待301赋码"; |
| | | }else if("7".equals(formState)){ |
| | | msg="已赋码"; |
| | | }else if("8".equals(formState)){ |
| | | msg="已赋码(沿用)"; |
| | | }else if("9".equals(formState)){ |
| | | msg="审核中"; |
| | | } |
| | | return msg; |
| | | } |
| | | } |