| | |
| | | package com.vci.ubcs.code.applyjtcodeservice.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.vci.ubcs.code.applyjtcodeservice.service.*; |
| | | import com.vci.ubcs.code.feign.IMdmEngineClient; |
| | | import com.vci.ubcs.code.applyjtcodeservice.entity.*; |
| | | import com.vci.ubcs.code.applyjtcodeservice.service.IGroupMdmInterService; |
| | | import com.vci.ubcs.code.applyjtcodeservice.vo.*; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO; |
| | | import com.vci.ubcs.code.vo.webserviceModel.result.xml.XMLResultDataObjectDetailDO; |
| | | import com.vci.ubcs.starter.util.MdmBtmTypeConstant; |
| | | import com.vci.ubcs.code.applyjtcodeservice.feign.MdmApplyGroupCodeProvider; |
| | | import com.vci.ubcs.code.applyjtcodeservice.mapper.DockingPreAttrMappingMapper; |
| | |
| | | import com.vci.ubcs.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.map.CaseInsensitiveMap; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private String code=""; |
| | | |
| | | private String msg=""; |
| | | @Value("${docking.apply.partCoe:10}") |
| | | public String partCoe; |
| | | @Value("${docking.apply.userFlag:false}") |
| | | |
| | | @Value("${docking.apply.partCode:101}") |
| | | public String partCode; |
| | | |
| | | @Value("${docking.apply.usedFlag:false}") |
| | | public boolean usedFlag; |
| | | @Value("${docking.apply.unitCode:41000}") |
| | | |
| | | @Value("${docking.apply.unitCode:4100}") |
| | | public String dockingApplyUnitCode; |
| | | |
| | | @Value("${docking.apply.sysName:410-MDM}") |
| | | public String dockingApplySysName; |
| | | |
| | | @Value("${docking.apply.personUserAccount:28201728}") |
| | | public String applyCodeUserAccount; |
| | | |
| | | @Autowired(required = false) |
| | | private MdmApplyGroupCodeProvider mdmApplyGroupCodeProvider; |
| | | |
| | | /*** |
| | | * 集团分类服务 |
| | | */ |
| | | @Autowired(required = false) |
| | | private com.vci.ubcs.code.applyjtcodeservice.service.IDockingPreClassifyService dockingPreClassifyService; |
| | | private IDockingPreClassifyService dockingPreClassifyService; |
| | | |
| | | /*** |
| | | * 申请单服务 |
| | | */ |
| | | @Autowired(required = false) |
| | | private com.vci.ubcs.code.applyjtcodeservice.service.IDockingPreApplyFormService dockingPreApplyFormService; |
| | | |
| | | private IDockingPreApplyFormService dockingPreApplyFormService; |
| | | |
| | | /*** |
| | | * 模型视图单服务 |
| | | */ |
| | | @Autowired(required = false) |
| | | private com.vci.ubcs.code.applyjtcodeservice.service.IDockingPreViewModelService dockingPreViewModelService; |
| | | |
| | | private IDockingPreViewModelService dockingPreViewModelService; |
| | | |
| | | /*** |
| | | * 集团分类属性属性映射配置服务 |
| | | */ |
| | | @Autowired(required = false) |
| | | private DockingPreAttrMappingMapper dockingPreAttrMappingMapper; |
| | | |
| | | /*** |
| | | * 属性取值范围服务 |
| | | */ |
| | | @Autowired(required = false) |
| | | private com.vci.ubcs.code.applyjtcodeservice.service.IDockingPreAttrRangeService dockingPreAttrRangeService; |
| | | |
| | | private IDockingPreAttrRangeService dockingPreAttrRangeService; |
| | | |
| | | /*** |
| | | * 集团属性服务 |
| | | */ |
| | | @Autowired(required = false) |
| | | private com.vci.ubcs.code.applyjtcodeservice.service.IDockingPreMetaAttrService dockingPreMetaAttrService; |
| | | private IDockingPreMetaAttrService dockingPreMetaAttrService; |
| | | |
| | | @Autowired(required = false) |
| | | private IMdmEngineClient mdmEngineClient; |
| | | |
| | | /*** |
| | | * 主数据像集团申请编码 |
| | | * 主数据向集团申请编码 |
| | | * @param oids 需要申请的数据主键数组 |
| | | * @param btmName 业务类型 |
| | | * @return 返回结果信息 |
| | | * @throws Exception |
| | | */ |
| | | @Transactional(rollbackFor = VciBaseException.class) |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R applyGroupCode(String oids, String btmName) throws VciBaseException { |
| | | if(usedFlag) { |
| | | try { |
| | |
| | | Map<String, DockingPreApplyForm> addDockingPreApplyFormMap = new HashMap<String, DockingPreApplyForm>(); |
| | | Map<String, DockingPreApplyForm> editDockingPreApplyFormMap = new HashMap<String, DockingPreApplyForm>(); |
| | | Map<String, BaseModel> baseModelMap = new HashMap<String, BaseModel>(); |
| | | //数据库不存在的 |
| | | /*List<BaseModel> newDdataModelList = dataModelList.stream().filter(cbo -> { |
| | | String groupcode =cbo.getData().getOrDefault("GROUPCODE",""); |
| | | return StringUtils.isBlank(groupcode); |
| | | }).collect(Collectors.toList()); |
| | | if(newDdataModelList.size()==0) |
| | | return R.fail("申请接口调用成功,所有数据已经存在集团码");*/ |
| | | |
| | | //组织数据 |
| | | dockingGroupDataVO = queryApplycodeDataObjects(1, dataModelList, addDockingPreApplyFormMap, editDockingPreApplyFormMap, baseModelMap); |
| | | DockingResultVO resultDataObject = mdmApplyGroupCodeProvider.receiveAddApply(dockingGroupDataVO); |
| | | Object object = JSONObject.toJSON(dockingGroupDataVO); |
| | | String resultStr = object.toString(); |
| | | log.info("申请集团码数据格式:->"+resultStr); |
| | | DockingResultVO resultDataObject = new DockingResultVO(); |
| | | resultDataObject = mdmApplyGroupCodeProvider.receiveAddApply(dockingGroupDataVO); |
| | | code = resultDataObject.getCode(); |
| | | msg = resultDataObject.getMsg(); |
| | | if ("1".equals(resultDataObject.getCode())) {//结果正确的情况 |
| | | boolean res=false; |
| | | if ("1".equals(code)) { |
| | | //结果正确的情况 |
| | | List<DockingDataVO> dataObjectVOList = resultDataObject.getData(); |
| | | res=true; |
| | | dataObjectVOList.stream().forEach(dataObject -> { |
| | | boolean isEditDatas = false; |
| | | String code2 = dataObject.getCode(); |
| | | DockingMainDataVO data2 = dataObject.getData(); |
| | | String applyId = data2.getApplyId();//申请单id |
| | | BaseModel baseModel = baseModelMap.get(applyId); |
| | | String customCoding = StringUtils.isBlank(data2.getCustomCoding()) ? "" : data2.getCustomCoding();//集团码段 |
| | | msg = dataObject.getMsg(); |
| | | if (code2.equals("1")) {//结果正确的情况 |
| | |
| | | if (editDockingPreApplyFormMap.containsKey(applyId)) { |
| | | DockingPreApplyForm dockingPreApplyForm = editDockingPreApplyFormMap.get(applyId); |
| | | dockingPreApplyForm.setCode(code2); |
| | | dockingPreApplyForm.setDescription(baseModel.getId()); |
| | | dockingPreApplyForm.setMsg("申请:" + msg); |
| | | dockingPreApplyForm.setGroupCode(customCoding); |
| | | if(StringUtils.isBlank(dockingPreApplyForm.getGroupCode())) { |
| | | dockingPreApplyForm.setGroupCode(customCoding); |
| | | }else{ |
| | | isEditDatas = true; |
| | | if (StringUtils.isBlank(customCoding)) { |
| | | customCoding=dockingPreApplyForm.getGroupCode(); |
| | | } |
| | | } |
| | | ObjectMapper mp = new ObjectMapper(); |
| | | String writeValueAsString = null; |
| | | try { |
| | |
| | | dockingPreApplyForm.setContent(writeValueAsString); |
| | | } catch (JsonProcessingException e) { |
| | | } |
| | | Date date = new Date(); |
| | | baseModel.setLastModifyTime(date); |
| | | baseModel.setTs(date); |
| | | baseModel.setLastModifier(Func.isBlank(AuthUtil.getUserAccount()) ? applyCodeUserAccount:AuthUtil.getUserAccount()); |
| | | //DefaultAttrAssimtUtil.updateDefaultAttrAssimt(dockingPreApplyForm); |
| | | } |
| | | //新增的申请单数据 |
| | | if (addDockingPreApplyFormMap.containsKey(applyId)) { |
| | | DockingPreApplyForm dockingPreApplyForm = addDockingPreApplyFormMap.get(applyId); |
| | | dockingPreApplyForm.setCode(code2); |
| | | dockingPreApplyForm.setDescription(baseModel.getId()); |
| | | dockingPreApplyForm.setMsg("申请:" + msg); |
| | | dockingPreApplyForm.setGroupCode(customCoding); |
| | | ObjectMapper mp = new ObjectMapper(); |
| | |
| | | dockingPreApplyForm.setContent(writeValueAsString); |
| | | } catch (JsonProcessingException e) { |
| | | } |
| | | Date date = new Date(); |
| | | dockingPreApplyForm.setCreateTime(date); |
| | | dockingPreApplyForm.setLastModifyTime(date); |
| | | dockingPreApplyForm.setTs(date); |
| | | dockingPreApplyForm.setBtmname(MdmBtmTypeConstant.DOCKING_PRE_JAPPLYFORM); |
| | | dockingPreApplyForm.setLastModifier(Func.isBlank(AuthUtil.getUserAccount()) ? applyCodeUserAccount:AuthUtil.getUserAccount()); |
| | | dockingPreApplyForm.setCreator(Func.isBlank(AuthUtil.getUserAccount()) ? applyCodeUserAccount:AuthUtil.getUserAccount()); |
| | | // DefaultAttrAssimtUtil.addDefaultAttrAssimt(dockingPreApplyForm, MdmBtmTypeConstant.DOCKING_PRE_JAPPLYFORM); |
| | | } |
| | | //如果有集团码则更新数据 |
| | | if (isEditDatas) { |
| | | if (baseModelMap.containsKey(applyId)) { |
| | | BaseModel baseModel = baseModelMap.get(applyId); |
| | | String classOid=baseModel.getData().getOrDefault("CODECLSFID",""); |
| | | if(partCoe.equals(classOid)){ |
| | | baseModel = baseModelMap.get(applyId); |
| | | Map<String,String> dataValueMap=new CaseInsensitiveMap<>(baseModel.getData()); |
| | | /*String classOid=baseModel.getId(); |
| | | if(partCode.equals(classOid)){ |
| | | baseModel.setId(10+customCoding); |
| | | } |
| | | customCoding=10+customCoding; |
| | | }*/ |
| | | BeanUtilForVCI.copyDeclaredIgnoreCase(baseModel, baseModel); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(baseModel); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(baseModel); |
| | | |
| | | baseModel.getData().getOrDefault("groupCode", customCoding); |
| | | Date date = new Date(); |
| | | baseModel.setLastModifyTime(date); |
| | | baseModel.setTs(date); |
| | | baseModel.setLastModifier(Func.isBlank(AuthUtil.getUserAccount()) ? applyCodeUserAccount:AuthUtil.getUserAccount()); |
| | | //DefaultAttrAssimtUtil.updateDefaultAttrAssimt(baseModel); |
| | | baseModel.getData().put("GROUPCODE",customCoding); |
| | | updateCbos.add(baseModel);//更新数据集团code |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | res=false; |
| | | editDockingPreApplyFormMap.forEach((key, dockingPreApplyForm) -> { |
| | | dockingPreApplyForm.setCode("2"); |
| | | dockingPreApplyForm.setMsg("申请:" + msg); |
| | | dockingPreApplyForm.setContent(""); |
| | | dockingPreApplyForm.setGroupCode(""); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(dockingPreApplyForm); |
| | | Date date = new Date(); |
| | | dockingPreApplyForm.setLastModifyTime(date); |
| | | dockingPreApplyForm.setTs(date); |
| | | dockingPreApplyForm.setLastModifier(Func.isBlank(AuthUtil.getUserAccount()) ? applyCodeUserAccount:AuthUtil.getUserAccount()); |
| | | //DefaultAttrAssimtUtil.updateDefaultAttrAssimt(dockingPreApplyForm); |
| | | }); |
| | | addDockingPreApplyFormMap.forEach((key, dockingPreApplyForm) -> { |
| | | dockingPreApplyForm.setCode("2"); |
| | | dockingPreApplyForm.setMsg("申请:" + msg); |
| | | dockingPreApplyForm.setContent(""); |
| | | dockingPreApplyForm.setGroupCode(""); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(dockingPreApplyForm, MdmBtmTypeConstant.DOCKING_PRE_JAPPLYFORM); |
| | | Date date = new Date(); |
| | | dockingPreApplyForm.setCreateTime(date); |
| | | dockingPreApplyForm.setLastModifyTime(date); |
| | | dockingPreApplyForm.setTs(date); |
| | | dockingPreApplyForm.setLastModifier(Func.isBlank(AuthUtil.getUserAccount()) ? applyCodeUserAccount:AuthUtil.getUserAccount()); |
| | | dockingPreApplyForm.setCreator(Func.isBlank(AuthUtil.getUserAccount()) ? applyCodeUserAccount:AuthUtil.getUserAccount()); |
| | | dockingPreApplyForm.setBtmname(MdmBtmTypeConstant.DOCKING_PRE_JAPPLYFORM); |
| | | //DefaultAttrAssimtUtil.addDefaultAttrAssimt(dockingPreApplyForm, MdmBtmTypeConstant.DOCKING_PRE_JAPPLYFORM); |
| | | }); |
| | | } |
| | | if (editDockingPreApplyFormMap.size() > 0) { |
| | |
| | | //保存表单数据 |
| | | dockingPreApplyFormService.saveOrUpdateBatch(dockingPreAttrMappings); |
| | | mdmEngineClient.updateBatchBtypeDatas(btmName, updateCbos);//保存数据 |
| | | if(!res){ |
| | | throw new VciBaseException(msg); |
| | | } |
| | | } |
| | | return R.success("申请接口调用成功"); |
| | | } catch (VciBaseException e) { |
| | |
| | | return R.fail("申请接口开关已关闭,不申请集团码"); |
| | | } |
| | | } |
| | | |
| | | /*** |
| | | * 主数据像集团更改编码 |
| | | * @param oids 需要修改的数据主键数组 |
| | |
| | | * @return 返回结果信息 |
| | | * @throws Throwable |
| | | */ |
| | | @Transactional(rollbackFor = VciBaseException.class) |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R receiveEditApply(String oids, String btmName) throws VciBaseException { |
| | | if(usedFlag) { |
| | | if(!usedFlag) { |
| | | log.info("更新接口功能已关闭!->"+usedFlag); |
| | | R.success("更新接口功能已关闭!"); |
| | | } |
| | |
| | | //List<BaseModelVO> codeWupins=mdmEngineService.listByIds(VciBaseUtil.str2List(oids)); |
| | | List<BaseModel> dataModelList = new ArrayList<>(); |
| | | try { |
| | | R<List<BaseModel>> listR = mdmEngineClient.selectByTypeAndOid(btmName, oids); |
| | | if(listR.getData().size() == 0){ |
| | | return R.fail("为查询到相关业务数据!"); |
| | | } |
| | | dataModelList = listR.getData(); |
| | | if (!CollectionUtils.isEmpty(dataModelList)) { |
| | | DockingGroupDataVO dockingGroupDataVO = new DockingGroupDataVO(); |
| | | //申请单和申请单对象关系 |
| | |
| | | DockingPreApplyForm dockingPreApplyForm = editDockingPreApplyFormMap.get(applyId); |
| | | dockingPreApplyForm.setCode(code2); |
| | | dockingPreApplyForm.setMsg("修改:" + msg); |
| | | dockingPreApplyForm.setGroupCode(customCoding); |
| | | if(StringUtils.isBlank(dockingPreApplyForm.getGroupCode())) { |
| | | dockingPreApplyForm.setGroupCode(customCoding); |
| | | } |
| | | ObjectMapper mp = new ObjectMapper(); |
| | | String writeValueAsString = null; |
| | | try { |
| | |
| | | dockingPreApplyForm.setContent(writeValueAsString); |
| | | } catch (JsonProcessingException e) { |
| | | } |
| | | Date date = new Date(); |
| | | dockingPreApplyForm.setLastModifyTime(date); |
| | | dockingPreApplyForm.setTs(date); |
| | | dockingPreApplyForm.setLastModifier(Func.isBlank(AuthUtil.getUserAccount()) ? applyCodeUserAccount:AuthUtil.getUserAccount()); |
| | | //DefaultAttrAssimtUtil.updateDefaultAttrAssimt(dockingPreApplyForm); |
| | | } |
| | | //新增的申请单数据 |
| | | if (addDockingPreApplyFormMap.containsKey(applyId)) { |
| | | DockingPreApplyForm dockingPreApplyForm = addDockingPreApplyFormMap.get(applyId); |
| | | dockingPreApplyForm.setCode(code2); |
| | | dockingPreApplyForm.setMsg("修改:" + msg); |
| | | dockingPreApplyForm.setGroupCode(customCoding); |
| | | if(StringUtils.isBlank(dockingPreApplyForm.getGroupCode())) { |
| | | dockingPreApplyForm.setGroupCode(customCoding); |
| | | } |
| | | ObjectMapper mp = new ObjectMapper(); |
| | | String writeValueAsString = null; |
| | | try { |
| | |
| | | dockingPreApplyForm.setContent(writeValueAsString); |
| | | } catch (JsonProcessingException e) { |
| | | } |
| | | Date date = new Date(); |
| | | dockingPreApplyForm.setCreateTime(date); |
| | | dockingPreApplyForm.setLastModifyTime(date); |
| | | dockingPreApplyForm.setTs(date); |
| | | dockingPreApplyForm.setBtmname(MdmBtmTypeConstant.DOCKING_PRE_JAPPLYFORM); |
| | | dockingPreApplyForm.setLastModifier(Func.isBlank(AuthUtil.getUserAccount()) ? applyCodeUserAccount:AuthUtil.getUserAccount()); |
| | | dockingPreApplyForm.setCreator(Func.isBlank(AuthUtil.getUserAccount()) ? applyCodeUserAccount:AuthUtil.getUserAccount()); |
| | | //DefaultAttrAssimtUtil.addDefaultAttrAssimt(dockingPreApplyForm, MdmBtmTypeConstant.DOCKING_PRE_JAPPLYFORM); |
| | | } |
| | | //如果有集团码则更新数据 |
| | | if (isEditDatas) { |
| | | if (baseModelMap.containsKey(applyId)) { |
| | | BaseModel baseModel = baseModelMap.get(applyId); |
| | | //BeanUtilForVCI.copyDeclaredIgnoreCase(baseModelVO, baseModel); |
| | | String classOid=baseModel.getData().getOrDefault("CODECLSFID",""); |
| | | if(partCoe.equals(classOid)){ |
| | | /*String classOid=baseModel.getData().getOrDefault("CODECLSFID",""); |
| | | if(partCode.equals(classOid)){ |
| | | baseModel.setId(10+customCoding); |
| | | } |
| | | }*/ |
| | | Date date = new Date(); |
| | | baseModel.setLastModifyTime(date); |
| | | baseModel.setTs(date); |
| | | baseModel.setLastModifier(Func.isBlank(AuthUtil.getUserAccount()) ? applyCodeUserAccount:AuthUtil.getUserAccount()); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(baseModel); |
| | | // baseModel.setId(customCoding); |
| | | baseModel.getData().put("groupCode", customCoding); |
| | | baseModel.getData().put("GROUPCODE", customCoding); |
| | | updateCbos.add(baseModel);//更新数据集团code |
| | | } |
| | | } |
| | |
| | | dockingPreApplyForm.setMsg("修改:" + msg); |
| | | dockingPreApplyForm.setContent(""); |
| | | dockingPreApplyForm.setGroupCode(""); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(dockingPreApplyForm); |
| | | Date date = new Date(); |
| | | dockingPreApplyForm.setLastModifyTime(date); |
| | | dockingPreApplyForm.setTs(date); |
| | | dockingPreApplyForm.setLastModifier(Func.isBlank(AuthUtil.getUserAccount()) ? applyCodeUserAccount:AuthUtil.getUserAccount()); |
| | | //DefaultAttrAssimtUtil.updateDefaultAttrAssimt(dockingPreApplyForm); |
| | | }); |
| | | addDockingPreApplyFormMap.forEach((key, dockingPreApplyForm) -> { |
| | | dockingPreApplyForm.setCode("2"); |
| | | dockingPreApplyForm.setMsg("修改:" + msg); |
| | | dockingPreApplyForm.setContent(""); |
| | | dockingPreApplyForm.setGroupCode(""); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(dockingPreApplyForm, MdmBtmTypeConstant.DOCKING_PRE_JAPPLYFORM); |
| | | Date date = new Date(); |
| | | dockingPreApplyForm.setCreateTime(date); |
| | | dockingPreApplyForm.setLastModifyTime(date); |
| | | dockingPreApplyForm.setTs(date); |
| | | dockingPreApplyForm.setBtmname(MdmBtmTypeConstant.DOCKING_PRE_JAPPLYFORM); |
| | | dockingPreApplyForm.setLastModifier(Func.isBlank(AuthUtil.getUserAccount()) ? applyCodeUserAccount:AuthUtil.getUserAccount()); |
| | | dockingPreApplyForm.setCreator(Func.isBlank(AuthUtil.getUserAccount()) ? applyCodeUserAccount:AuthUtil.getUserAccount()); |
| | | //DefaultAttrAssimtUtil.addDefaultAttrAssimt(dockingPreApplyForm, MdmBtmTypeConstant.DOCKING_PRE_JAPPLYFORM); |
| | | }); |
| | | } |
| | | if (editDockingPreApplyFormMap.size() > 0) { |
| | |
| | | public R queryClassModel(String groupClassifyId) throws Throwable { |
| | | log.info("获取集团模型详细信息执行保存start"); |
| | | String message="执行成功!"; |
| | | if(usedFlag){ |
| | | if(!usedFlag){ |
| | | log.info("获取集团模型详细信息执行保存功能已关闭!->"+usedFlag); |
| | | return R.fail("获取集团模型详细信息接口已关闭!"); |
| | | } |
| | |
| | | public R queryMdmModel() throws Throwable { |
| | | String message="执行成功!"; |
| | | log.info("从集团获取主模型信息执行保存接口statr"); |
| | | if(usedFlag){ |
| | | if(!usedFlag){ |
| | | log.info("从集团获取主模型信息执行保存接口功能已关闭!->"+usedFlag); |
| | | return R.fail("查询模型视图接口已关闭!"); |
| | | } |
| | |
| | | return R.success(message); |
| | | } |
| | | |
| | | |
| | | |
| | | /*** |
| | | * 查询申请单状态 |
| | | * @param dataOids |
| | |
| | | */ |
| | | @Override |
| | | public R queryApplyState(String dataOids) throws VciBaseException { |
| | | if(usedFlag){ |
| | | if(!usedFlag){ |
| | | log.info("查询申请单状态接口开关已关闭"); |
| | | return R.fail("查询申请单状态接口开关已关闭"); |
| | | } |
| | | String message="执行成功!"; |
| | | log.info("查询申请单状态接口statr"); |
| | | log.info("查询申请单状态接口start"); |
| | | try { |
| | | VciBaseUtil.alertNotNull(dataOids,"所查申请单数据主键"); |
| | | VciBaseUtil.alertNotNull(dockingApplySysName,"系统标识配置:docking.apply.unitCode"); |
| | |
| | | DockingModelQueryVO dockingModelQueryVO=new DockingModelQueryVO(); |
| | | dockingModelQueryVO.setApplyNums(VciBaseUtil.array2String(applyIdList.toArray(new String[]{}))); |
| | | dockingModelQueryVO.setSysName(dockingApplySysName); |
| | | DockingApplyFormQueryStatusVO dockingApplyFormQueryStatusVO=mdmApplyGroupCodeProvider.queryApplyState(dockingModelQueryVO); |
| | | DockingApplyFormQueryStatusVO dockingApplyFormQueryStatusVO = mdmApplyGroupCodeProvider.queryApplyState(dockingModelQueryVO); |
| | | |
| | | if(Func.isEmpty(dockingApplyFormQueryStatusVO)){ |
| | | log.error("获取申请单为空!"); |
| | | return R.fail("没有获取到相关数据信息!"); |
| | | } |
| | | |
| | | int code=dockingApplyFormQueryStatusVO.getCode(); |
| | | String mesg=dockingApplyFormQueryStatusVO.getMsg(); |
| | | if(code==1){ |
| | | message=mesg; |
| | | List<DockingApplyFormStatusVO> dockingApplyFormStatusVOList=dockingApplyFormQueryStatusVO.getData(); |
| | | if(CollectionUtils.isEmpty(dockingApplyFormStatusVOList)){ |
| | | if(!CollectionUtils.isEmpty(dockingApplyFormStatusVOList)){ |
| | | for (DockingApplyFormStatusVO applyFormDataState : dockingApplyFormStatusVOList) { |
| | | String applyId=applyFormDataState.getApplyNum(); |
| | | String state= applyFormDataState.getFormState(); |
| | |
| | | applyFormObject.setMsg(jmsg); |
| | | } |
| | | } |
| | | boolean res=this.dockingPreApplyFormService.saveOrUpdateBatch(dockingPreApplyFormList); |
| | | if(res){ |
| | | R.success("申请集团码状态查询成功:"+mesg); |
| | | } |
| | | boolean res = this.dockingPreApplyFormService.saveOrUpdateBatch(dockingPreApplyFormList); |
| | | }else{ |
| | | throw new Throwable("没有获取到相关数据信息"); |
| | | } |
| | | }else{ |
| | | throw new Throwable(mesg); |
| | | message=mesg; |
| | | dockingPreApplyFormList.stream().forEach(dockingPreApplyForm -> { |
| | | dockingPreApplyForm.setMsg("申请单查看失败:"+mesg); |
| | | }); |
| | | this.dockingPreApplyFormService.saveOrUpdateBatch(dockingPreApplyFormList); |
| | | throw new Throwable(message); |
| | | } |
| | | |
| | | }catch (Throwable e){ |
| | | e.printStackTrace(); |
| | | //message=""+e; |
| | | log.error("获取申请单状态失败"+e); |
| | | throw new VciBaseException(message); |
| | | throw new VciBaseException(e.getMessage()); |
| | | } |
| | | log.info("查询申请单状态接口end"); |
| | | return R.success(message); |
| | |
| | | */ |
| | | @Override |
| | | public R syncClassifyModel(String classifyId, String operationType) throws VciBaseException { |
| | | if(usedFlag){ |
| | | if(!usedFlag){ |
| | | log.info("同步集团模型信息开关已关闭"); |
| | | return R.fail("同步集团模型信息开关已关闭"); |
| | | } |
| | |
| | | */ |
| | | private boolean saveDatas(DockingQueryClassModelVO dockingQueryClassifyModelVO) throws Throwable { |
| | | try { |
| | | DockingClassifyMainVO mainData = dockingQueryClassifyModelVO.getMainData(); |
| | | List<DockingClassifyVO> classList = mainData.getClassList(); |
| | | Map<String,List<DockingClassifyViewVO>>classInfoMap = mainData.getClassInfos(); |
| | | DockingClassifyMainVO data = dockingQueryClassifyModelVO.getData(); |
| | | List<DockingClassifyVO> classList = data.getClassList(); |
| | | Map<String,List<DockingClassifyViewVO>>classInfoMap = data.getClassInfos(); |
| | | ////initVCIInvocationInfo("1"); |
| | | List<DockingPreClassify> dockingPreClassifyArrayList=new ArrayList<>(); |
| | | for (DockingClassifyVO jclassObject : classList) { |
| | |
| | | log.info("classify:-------------->链接名称:"+nodeLinkName); |
| | | |
| | | if (dockingPreClassify == null || StringUtils.isBlank(dockingPreClassify.getOid())) { |
| | | dockingPreClassify=new DockingPreClassify(); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(dockingPreClassify,MdmBtmTypeConstant.DOCKING_PRE_JCLASSIFY); |
| | | } else { |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(dockingPreClassify); |
| | |
| | | Map<String, DockingPreViewModel> jviewmodelMap = new HashMap<String, DockingPreViewModel>(); |
| | | //Map<String, String> condtionMa = new HashMap<String, String>(); |
| | | // condtionMa.put("jsourceclsfid", jclassId); |
| | | List<DockingPreViewModel> dockingPreViewModelList= dockingPreViewModelService.list(Wrappers.<DockingPreViewModel>query().lambda().eq(DockingPreViewModel::getSourceClassifyId,false));// 根据分类查询模型视图对象 |
| | | List<DockingPreViewModel> dockingPreViewModelList= dockingPreViewModelService.list(Wrappers.<DockingPreViewModel>query().lambda().eq(DockingPreViewModel::getSourceClassifyId,jclassId));// 根据分类查询模型视图对象 |
| | | for (DockingPreViewModel dockingPreViewModel : dockingPreViewModelList) { |
| | | jviewmodelMap.put(dockingPreViewModel.getViewName(),dockingPreViewModel); |
| | | } |
| | | |
| | | for (DockingClassifyViewVO viewInfo : list) { |
| | | String viewName = com.alibaba.cloud.commons.lang.StringUtils.isBlank(viewInfo.getViewName())?"":viewInfo.getViewName(); |
| | | String impactList = com.alibaba.cloud.commons.lang.StringUtils.isBlank(viewInfo.getImpactList())?"":viewInfo.getImpactList(); |
| | | String impactList = viewInfo.getImpactList() == null ? "" : viewInfo.getImpactList().get(0)==null||viewInfo.getImpactList().get(0).size()==0?"":viewInfo.getImpactList().get(0).get(0); |
| | | log.info("VilewMode:-------------->视图名称:"+viewName); |
| | | log.info("VilewMode:-------------->影响编码项:"+impactList); |
| | | log.info("VilewMode:--------------> 集团分类主键:"+jclassId); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /*** |
| | | * 获取模型视图属性 |
| | | * @throws Throwable |
| | |
| | | .eq(DockingPreMetaAttr::getSourceClassifyId,jclassId).eq(DockingPreMetaAttr::getViewModelId,jviewModelObject.getOid()) |
| | | .eq(DockingPreMetaAttr:: getPid,pid)); |
| | | Map<String,DockingPreMetaAttr> jmetaattrMap = dockingPreMetaAttrList.stream().filter( |
| | | s -> com.alibaba.cloud.commons.lang.StringUtils.isNotBlank(s.getEnglishName())).collect(Collectors.toMap(s -> s.getEnglishName().toLowerCase(Locale.ROOT), t -> t)); |
| | | s -> com.alibaba.cloud.commons.lang.StringUtils.isNotBlank(s.getEnglishName())).collect(Collectors.toMap(s -> s.getEnglishName(), t -> t)); |
| | | |
| | | for (DockingClassifyMetaAttrVO dockingClassifyMetaAttrVO : metaList) { |
| | | String chineseName = com.alibaba.cloud.commons.lang.StringUtils.isBlank(dockingClassifyMetaAttrVO.getChineseName())?"":dockingClassifyMetaAttrVO.getChineseName();// 属性名称 |
| | |
| | | List<DockingClassifyMetaAttrVO> childMetaList = new ArrayList<>(); |
| | | childMetaList.add(compositeMeta); |
| | | getMetaAttrObject(childMetaList, jclassId,jviewModelObject, pid,allDockingPreMetaAttrList); |
| | | }else{ |
| | | allDockingPreMetaAttrList.add(dockingPreMetaAttr); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | private void getRange(DockingPreMetaAttr metaAttrObject,Map<String, String> range) throws Throwable { |
| | | String metaAttrOid = com.alibaba.cloud.commons.lang.StringUtils.isBlank(metaAttrObject.getOid())?"":metaAttrObject.getOid();// 属性的oid |
| | | |
| | | String jchinesename = com.alibaba.cloud.commons.lang.StringUtils.isBlank(metaAttrObject.getChineseName())?"":metaAttrObject.getChineseName(); |
| | | Map<String, DockingPreAttrRange> rangeMap = new HashMap<>(); |
| | | try { |
| | |
| | | condtionMa.put("jmetalistid", metaAttrOid); |
| | | List<DockingPreAttrRange> jmetaattrList = dockingPreAttrRangeService.selectByWrapper(Wrappers.<DockingPreAttrRange>query().lambda() |
| | | .eq(DockingPreAttrRange::getMetaListId,metaAttrOid));// 根据分类查询模型视图对象 |
| | | rangeMap= jmetaattrList.stream().collect(Collectors.toMap(s -> com.alibaba.cloud.commons.lang.StringUtils.isNotBlank(s.getNumText().toLowerCase(Locale.ROOT))?"":s.getNumText().toLowerCase(Locale.ROOT), t -> t)); |
| | | log.info("获取属性美剧 属性id------->"+metaAttrOid); |
| | | //rangeMap= jmetaattrList.stream().collect(Collectors.toMap(s ->StringUtils.isNotBlank(s.getNumText())?"":s.getNumText(), t -> t)); |
| | | rangeMap=jmetaattrList.stream().filter(data -> data != null && StringUtils.isNotBlank(data.getNumText())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getNumText(), t -> t)); |
| | | |
| | | for (String rangeKey : range.keySet()) { |
| | | DockingPreAttrRange rangeObject = new DockingPreAttrRange(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 组织数据 |
| | | * */ |
| | | private DockingGroupDataVO queryApplycodeDataObjects(int optationtype,List<BaseModel> codeWupins,Map<String,DockingPreApplyForm> addDockingPreApplyFormMap,Map<String,DockingPreApplyForm> editDockingPreApplyFormMap,Map<String,BaseModel> codeWupinMap) throws VciBaseException{ |
| | | * @param optationtype |
| | | * @param codeWupins |
| | | * @param addDockingPreApplyFormMap |
| | | * @param editDockingPreApplyFormMap |
| | | * @param codeWupinMap |
| | | * @return |
| | | * @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(); |
| | | // TODO:主数据推送过来的数据是拿不到可以申请集团码的用户信息的,并且这一块儿的逻辑也还没敲定,所以这儿采用配置的用户来申请集团码 |
| | | String curUserName = Func.isBlank(AuthUtil.getUserAccount()) ? applyCodeUserAccount:AuthUtil.getUserAccount(); |
| | | //申请的数据 |
| | | List<DockingMainData> mainDataList=new ArrayList<DockingMainData>(); |
| | | for (BaseModel dataBusinessObject : codeWupins) { |
| | | String format = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()); |
| | | String codeclsfid = dataBusinessObject.getData().getOrDefault("codeclsfid",""); |
| | | //String codeclsfid = dataBusinessObject.getData().getOrDefault("codeclsfid".toUpperCase(Locale.ROOT),""); |
| | | Map<String,String> dataMap=new CaseInsensitiveMap<>(dataBusinessObject.getData()); |
| | | String codeclsfid=dataMap.getOrDefault("codeclsfid",""); |
| | | String btmName = dataBusinessObject.getBtmname(); |
| | | String oid = dataBusinessObject.getOid(); |
| | | |
| | | DockingPreApplyForm dockingPreApplyForm = new DockingPreApplyForm(); |
| | | |
| | | String dataOid = dataBusinessObject.getOid(); |
| | | Map<String, String> conditionsMap = new HashMap<String, String>(); |
| | | List<DockingPreApplyForm> applyFormObjects = dockingPreApplyFormService.list(Wrappers.<DockingPreApplyForm>query().lambda().eq(DockingPreApplyForm::getDataOid, dataOid).eq(DockingPreApplyForm::getOperationType, optationtype)); |
| | | String apllyCode = ""; |
| | | if (!CollectionUtils.isEmpty(applyFormObjects)) { |
| | | // String dataOid = dataBusinessObject.getOid(); |
| | | // Map<String, String> conditionsMap = new HashMap<String, String>(); |
| | | // List<DockingPreApplyForm> applyFormObjects = dockingPreApplyFormService.list(Wrappers.<DockingPreApplyForm>query().lambda().eq(DockingPreApplyForm::getDataOid, dataOid).eq(DockingPreApplyForm::getOperationType, optationtype)); |
| | | // DockingPreApplyForm dockingPreApplyForm=new DockingPreApplyForm(); |
| | | String applyCode = ""; |
| | | /*if (!CollectionUtils.isEmpty(applyFormObjects)) { |
| | | dockingPreApplyForm = applyFormObjects.get(0); |
| | | apllyCode = dockingPreApplyForm.getId(); |
| | | editDockingPreApplyFormMap.put(apllyCode, dockingPreApplyForm);//申请单和申请单对象关系 |
| | | } else { |
| | | apllyCode = dockingApplyUnitCode + "-" + format; |
| | | dockingPreApplyForm.setId(apllyCode); |
| | | applyCode = dockingPreApplyForm.getId(); |
| | | editDockingPreApplyFormMap.put(applyCode, dockingPreApplyForm);//申请单和申请单对象关系 |
| | | } else {*/ |
| | | applyCode = dockingApplyUnitCode + "-" + format; |
| | | dockingPreApplyForm.setId(applyCode); |
| | | dockingPreApplyForm.setName(""); |
| | | dockingPreApplyForm.setOperationType(optationtype+""); |
| | | dockingPreApplyForm.setDescription(dataBusinessObject.getDescription());//获取数据描述信息 |
| | | dockingPreApplyForm.setDescription(dataBusinessObject.getId());//获取数据描述信息 |
| | | dockingPreApplyForm.setDataOid(oid); |
| | | dockingPreApplyForm.setDataBtmName(btmName); |
| | | addDockingPreApplyFormMap.put(apllyCode, dockingPreApplyForm);//申请单和申请单对象关系 |
| | | } |
| | | addDockingPreApplyFormMap.put(applyCode, dockingPreApplyForm);//申请单和申请单对象关系 |
| | | // } |
| | | |
| | | codeWupinMap.put(apllyCode, dataBusinessObject);//申请单和对应数据关系 |
| | | conditionsMap = new HashMap<String, String>(); |
| | | conditionsMap.put("jtargetclsfid", codeclsfid);//视图oid |
| | | codeWupinMap.put(applyCode, dataBusinessObject);//申请单和对应数据关系 |
| | | // conditionsMap = new HashMap<String, String>(); |
| | | // conditionsMap.put("jtargetclsfid", codeclsfid);//视图oid |
| | | |
| | | List<DockingPreAttrMapping> dockingPreAttrMappingList = dockingPreAttrMappingMapper.selectList(Wrappers.<DockingPreAttrMapping>query().lambda().eq(DockingPreAttrMapping::getTargetClassifyId, codeclsfid)); |
| | | if (CollectionUtils.isEmpty(dockingPreAttrMappingList)) { |
| | |
| | | DockingPreClassify dockingPreClassify = dockingPreClassifyService.getById(jsourceclsfid); |
| | | DockingMainData mainData = new DockingMainData(); |
| | | mainData.setApplyEntId(dockingApplyUnitCode);//申请单位代码 |
| | | mainData.setApplyId(apllyCode);//申请单号 |
| | | mainData.setApplyId(applyCode);//申请单号 |
| | | mainData.setClassName(dockingPreClassify.getNodeLinkName());//分类名称 |
| | | mainData.setCreateBy(curUserName);// |
| | | if(optationtype==2) { |
| | | String groucode=dataBusinessObject.getData().getOrDefault("GROUPCODE",""); |
| | | dockingPreApplyForm.setGroupCode(groucode); |
| | | mainData.setCustomCoding(groucode); |
| | | } |
| | | mainData.setSecretLevel("内部");//密级,默认为内部 |
| | | mainData.setViewInfos(getviewInfos(optationtype,dockingPreClassify, dataBusinessObject));//获取视图模型 |
| | | mainDataList.add(mainData); |
| | |
| | | return postParameters; |
| | | } catch (Throwable e) { |
| | | // TODO Auto-generated catch block |
| | | throw new VciBaseException("查询数据出错"+e); |
| | | throw new VciBaseException("查询数据出错,原因:"+e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | //构造模型视图数据 |
| | | List<Map<String, Object>> viewValueList=new ArrayList<Map<String,Object>>(); |
| | | String oid = dockingPreViewModel.getOid(); |
| | | Map<String,String> dataValueMap=dataBusinessObject.getData(); |
| | | Map<String,String> dataValueMap=new CaseInsensitiveMap<>(dataBusinessObject.getData()); |
| | | String codeClassifyId=dataValueMap.get("codeclsfid"); |
| | | Map<String,String>conditionsMap=new HashMap<String, String>(); |
| | | List<DockingPreAttrMapping> dockingPreAttrMappingList = dockingPreAttrMappingMapper.selectList(Wrappers.<DockingPreAttrMapping>query().lambda() |
| | |
| | | Object newVaue=null; |
| | | if(StringUtils.isNotBlank(jtargetattrkey)){ |
| | | getAttrRange(dockingPreMetaAttr);//获取字段取值范围 |
| | | String value=dataValueMap.get(jtargetattrkey)==null?"":dataValueMap.getOrDefault(jtargetattrkey,""); |
| | | String value=""; |
| | | if(jtargetattrkey.toLowerCase(Locale.ROOT).equals("name")){ |
| | | value=dataBusinessObject.getName(); |
| | | }else if(jtargetattrkey.toLowerCase(Locale.ROOT).equals("id")){ |
| | | value=dataBusinessObject.getId(); |
| | | }else if(jtargetattrkey.toLowerCase(Locale.ROOT).equals("description")){ |
| | | value=dataBusinessObject.getDescription(); |
| | | }else{ |
| | | value=dataValueMap.get(jtargetattrkey)==null?"":dataValueMap.getOrDefault(jtargetattrkey,""); |
| | | } |
| | | newVaue = getVaue(dockingPreMetaAttr, value); |
| | | }else{ |
| | | newVaue = getVaue(dockingPreMetaAttr, ""); |
| | |
| | | if(newVaue==null||"".equals(newVaue)){ |
| | | newVaue= dockingPreMetaAttr.getDefaultValue(); |
| | | } |
| | | //newVaue= Func.isNotEmpty(newVaue)?newVaue:""; |
| | | viewValueMap.put(jenglishname, newVaue); |
| | | } |
| | | } |
| | |
| | | * 获取属性枚举映射配置 |
| | | */ |
| | | Map<String,Map<String, DockingPreAttrRange>> attrRangeMap=new HashMap<String, Map<String,DockingPreAttrRange>>(); |
| | | |
| | | private void getAttrRange(DockingPreMetaAttr jmetaatter) throws Throwable{ |
| | | |
| | | String jmetalistoid = jmetaatter.getOid(); |
| | | if(attrRangeMap.containsKey(jmetalistoid)) { |
| | | return; |
| | | } |
| | | Map<String,String>conditionsMap=new HashMap<String, String>(); |
| | | conditionsMap.put("jmetalistid", jmetalistoid);//视图oid |
| | | // Map<String,String>conditionsMap=new HashMap<String, String>(); |
| | | // conditionsMap.put("jmetalistid", jmetalistoid);//视图oid |
| | | List<DockingPreAttrRange> dockingPreAttrRangeList = dockingPreAttrRangeService.selectByWrapper(Wrappers.<DockingPreAttrRange>query().lambda().eq(DockingPreAttrRange::getMetaListId, jmetalistoid)); |
| | | if (CollectionUtils.isEmpty(dockingPreAttrRangeList)) { |
| | | return; |
| | | } |
| | | Map<String, DockingPreAttrRange> rangeMap = new HashMap<String, DockingPreAttrRange>(); |
| | | rangeMap = dockingPreAttrRangeList.stream().collect(Collectors.toMap(s -> s.getNumTextValue(), t -> t, (o1, o2) -> o2)); |
| | | // TODO: 这儿存内部存储值,无法在后续进行转换 |
| | | rangeMap = dockingPreAttrRangeList.stream().collect(Collectors.toMap(s -> s.getTargetNumText(), t -> t, (o1, o2) -> o2)); |
| | | attrRangeMap.put(jmetalistoid, rangeMap); |
| | | |
| | | } |
| | | |
| | | /**** |
| | | * 值类型转换 |
| | | * @param jmetaatter |
| | |
| | | return null; |
| | | }else { |
| | | try { |
| | | return simpleDateFormat.parse(value); |
| | | return simpleDateFormat.format(simpleDateFormat.parse(value)); |
| | | } catch (ParseException e) { |
| | | throw new VciBaseException("date", new String[]{"日期格式转换错误"}); |
| | | } |
| | |
| | | return null; |
| | | }else{ |
| | | try { |
| | | return simpleDateFormat.parse(value); |
| | | return simpleDateFormat.format(simpleDateFormat.parse(value)); |
| | | } catch (ParseException e) { |
| | | throw new VciBaseException("date", new String[]{"日期格式转换错误"}); |
| | | } |
| | |
| | | } |
| | | return msg; |
| | | } |
| | | |
| | | } |