| | |
| | | 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.vo.*; |
| | | import com.vci.ubcs.starter.util.MdmBtmTypeConstant; |
| | |
| | | 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 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){ |
| | |
| | | throw new VciBaseException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | // /** |
| | | // * 同步主模型 |
| | | // * @return |
| | | // */ |
| | | // private String queryMdmModel() throws VciBaseException { |
| | | // String message="执行成功!"; |
| | | // try { |
| | | // |
| | | // |
| | | // }catch (VciBaseException e){ |
| | | // message=e.getMessage(); |
| | | // throw new VciBaseException(message); |
| | | // }finally { |
| | | // return message; |
| | | // } |
| | | // |
| | | // |
| | | // } |
| | | // |
| | | // /*** |
| | | // * 同步模型详细信息 |
| | | // * @param classifyId |
| | | // * @return |
| | | // */ |
| | | // private String queryClassModel(String classifyId)throws VciBaseException{ |
| | | // String message="执行成功!"; |
| | | // try { |
| | | // |
| | | // }catch (VciBaseException e){ |
| | | // message=e.getMessage(); |
| | | // throw new VciBaseException(message); |
| | | // }finally { |
| | | // return message; |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | |
| | | /*** |
| | | * 组织 保存数据方法 |
| | |
| | | /** |
| | | * 组织数据 |
| | | * */ |
| | | 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(); |
| | |
| | | * @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)) { |