| | |
| | | import com.thoughtworks.xstream.io.xml.DomDriver; |
| | | import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO; |
| | | import com.vci.ubcs.code.constant.MdmDuckingConstant; |
| | | import com.vci.ubcs.code.dto.CodeBZApplyDTO; |
| | | import com.vci.ubcs.code.dto.CodeOrderDTO; |
| | | import com.vci.ubcs.code.dto.CodeOrderSecDTO; |
| | | import com.vci.ubcs.code.entity.*; |
| | |
| | | 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 com.vci.ubcs.starter.exception.VciBaseException; |
| | |
| | | import com.vci.ubcs.system.vo.DeptVO; |
| | | import com.vci.ubcs.system.vo.RoleVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.http.auth.AuthenticationException; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | |
| | | import java.util.*; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vci.ubcs.code.constant.MdmEngineConstant.DEFAULT_SYNC_ATTR_LIST; |
| | |
| | | @Slf4j |
| | | @VciWebservice(path = "/universalInterface") |
| | | public class UniversalInterfaceImpl<IDockingLogeServiceing> implements UniversalInterfaceI { |
| | | |
| | | /*** |
| | | * æä½ç±»å |
| | | */ |
| | | @Value("${bzApply.operationType:operationType}") |
| | | private String operationType; |
| | | /*** |
| | | * æ¯å¦ç³»å |
| | | */ |
| | | @Value("${bzApply.isSeries:isSeries}") |
| | | private String isSeries; |
| | | /*** |
| | | *å叿¶é´ |
| | | */ |
| | | @Value("${bzApply.releaseTime:releaseTime}") |
| | | private String releaseTime; |
| | | /*** |
| | | * æºæ åå· |
| | | */ |
| | | @Value("${bzApply.oldCode:oldCode}") |
| | | private String oldCode; |
| | | |
| | | /*** |
| | | * ç³»åæµæ°´ |
| | | */ |
| | | @Value("${bzApply.seriesFlow:seriesFlow}") |
| | | private String seriesFlow; |
| | | /*** |
| | | * æ¯å¦åæ´ç³»å |
| | | */ |
| | | @Value("${bzApply.isEditSeries:isEditSeries}") |
| | | private String isEditSeries; |
| | | /*** |
| | | * æ§å¶æ¯å¦åå
¥å¼çç æ®µåç§° |
| | | */ |
| | | @Value("${bzApply.secName:ç³»åå·}") |
| | | private String secName; |
| | | |
| | | /*** |
| | | * æ§å¶æ¯å¦åå
¥å¼çç æ®µåç§° |
| | | */ |
| | | @Value("${bzApply.yearSecName:年代å·}") |
| | | private String yearSecName; |
| | | |
| | | |
| | | @Value("${code.universalinterface.checkSystemConfig:true}") |
| | | public boolean CODE_CHECKCONFIG; |
| | |
| | | orderDTO.setData(rowData.getFiledValue()); |
| | | String code=engineService.addSaveCodeNotauthUser(orderDTO,false); |
| | | if(StringUtils.isNotBlank(code)) { |
| | | //rowData.setCode(code); |
| | | StringBuffer sqlsb = new StringBuffer(); |
| | | sqlsb.append(" select * from "); |
| | | sqlsb.append(tableName); |
| | |
| | | try { |
| | | if ("xml".equals(dataType)) { |
| | | XStream xStream = new XStream(new DomDriver()); |
| | | xStream.processAnnotations(RootDataVO.class); |
| | | xStream.processAnnotations(ApplyBZVO.class); |
| | | xStream.autodetectAnnotations(true); |
| | | ApplyBZVO rootDataVO = (ApplyBZVO) xStream.fromXML(data); |
| | | applyBZParamVO.setData(rootDataVO); |
| | |
| | | //å
å¯ç»å½ç³è¯·tokenï¼request䏿·»å ç¨æ·ä¿¡æ¯ |
| | | //passwordFreeLoginService.pwdFreeLoginByBoolean(userVo.getUserName(), this.getRequest()); |
| | | passwordFreeLoginService.pwdFreeLoginByBoolean(systemId.toLowerCase(),this.getRequest()); |
| | | AuthUtil.getUser(); |
| | | //è¿æ¯è´¦å·ä¿¡æ¯ |
| | | SessionInfo sessionInfo = new SessionInfo(); |
| | | sessionInfo.setUserId(userVo.getUserName()); |
| | | sessionInfo.setUserName(userVo.getTrueName()); |
| | | sessionInfo.setIp(userVo.getIp()); |
| | | VciBaseUtil.setCurrentUserSessionInfo(sessionInfo); |
| | | // List<XMLResultDataObjectDetailDO> allResultDataObjectDetailDOS=new ArrayList<>(); |
| | | String finalSystemId = systemId; |
| | | String libray=""; |
| | | boolean isCodeOrGroupCode=false; |
| | | |
| | | libray = classfyBZVO.getLibrary(); |
| | | CodeClassifyVO codeClassifyVO = getClassfy(classfyBZVO,libray); |
| | | log.info("endï¼åç±»æ¥è¯¢å®æ¯"); |
| | |
| | | } |
| | | CodeClassifyTemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(codeClassifyVO.getOid()); |
| | | if(templateVO==null||StringUtils.isBlank(templateVO.getOid())){ |
| | | objerrorCode="1"; |
| | | throw new Throwable ("æ ¹æ®ä¼ è¾çåç±»ï¼æªè·åMDMç³»ç»ä¸å¯¹åºæ¨¡æ¿"); |
| | | objerrorCode="100"; |
| | | throw new Throwable ("æ ¹æ®ä¼ è¾çåç±»ï¼æªè·åç³»ç»ä¸å¯¹åºæ¨¡æ¿"); |
| | | } |
| | | log.info("endï¼æ¨¡æ¿æ¥è¯¢å®æ¯"); |
| | | ApplyBZDatasVO applyBZDatasVO = classfyBZVO.getObjects(); |
| | |
| | | List<CodeClassifyTemplateAttrVO> attrVOS = templateVO.getAttributes().stream().filter(s -> !DEFAULT_SYNC_ATTR_LIST.contains(s.getId()) && VciBaseUtil.getBoolean(s.getFormDisplayFlag()) |
| | | ).collect(Collectors.toList()); |
| | | List<ApplyBZDataVO> applyBZDataVOList= applyBZDatasVO.getObject(); |
| | | if(applyBZDataVOList.size()>1){ |
| | | objerrorCode="1"; |
| | | throw new Throwable ("æ åç³è¯·åªæ¯æä¸æ¡æ°æ®ç³è¯·"); |
| | | } |
| | | String finalLibray = libray; |
| | | ClassfyBZVO finalClassfyBZVO = classfyBZVO; |
| | | //è§åç主é®éè¦å»è·å |
| | | CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyVO.getOid()); |
| | | if(classifyFullInfo==null ||classifyFullInfo.getCurrentClassifyVO()==null || StringUtils.isBlank(classifyFullInfo.getCurrentClassifyVO().getOid())){ |
| | | objerrorCode="1"; |
| | | log.info("classifyFullInfo:"+"æ ¹æ®ä¼ è¾çåç±»ï¼æªè·ååç±»ç¸å
³ä¿¡æ¯"); |
| | | throw new Throwable ("æ ¹æ®ä¼ è¾çåç±»ï¼æªè·ååç±»ç¸å
³ä¿¡æ¯"); |
| | | } |
| | | CodeRuleVO ruleVO = engineService.getCodeRuleByClassifyFullInfo(classifyFullInfo); |
| | | if(ruleVO==null||StringUtils.isBlank(ruleVO.getOid())){ |
| | | objerrorCode="102"; |
| | | throw new Throwable ("æ ¹æ®ä¼ è¾çåç±»ï¼æªè·åMDMç³»ç»ä¸å¯¹åºè§å"); |
| | | } |
| | | log.info("endï¼è§åè·å宿¯"); |
| | | List<CodeOrderSecDTO> codeOrderSecDTOList = getRuleCodeOrderSecDTOs(classfyBZVO.getSections().getSection(), ruleVO,classifyFullInfo); |
| | | log.info("endï¼ç 段è·å宿¯"); |
| | | CodeBZApplyDTO codeBZApplyDTO=new CodeBZApplyDTO(); |
| | | codeBZApplyDTO.setSecDTOList(codeOrderSecDTOList);//åç±»ç æ®µ |
| | | applyBZDataVOList.stream().forEach(applyBZDataVO -> { |
| | | String code=""; |
| | | String id=applyBZDataVO.getId(); |
| | | try { |
| | | this.getConfigDatas(finalSystemId, finalLibray, applyBZDatasVO, attrVOS, dataObjectVO); |
| | | List<ProppertyVO> proppertyVOList=applyBZDataVO.getProp(); |
| | | String oldCodeValue=applyBZDataVO.getOldCode(); |
| | | setPropertyValue(oldCode,oldCodeValue,proppertyVOList);//æºæ åå· |
| | | boolean editSeriesFlag= applyBZDataVO.isEditSeriesFlag(); |
| | | setPropertyValue(isEditSeries,String.valueOf(editSeriesFlag),proppertyVOList);//æ¯å¦æ´ä¸ºç³»å |
| | | boolean seriesFlag=applyBZDataVO.isSeriesFlag(); |
| | | setPropertyValue(isSeries,String.valueOf(seriesFlag),proppertyVOList);//æºæ åç±»å |
| | | String operationTypeValue=applyBZDataVO.getOperationType(); |
| | | setPropertyValue(operationType,operationTypeValue,proppertyVOList);//æä½ç±»å1:å¶å®ï¼2:修订 |
| | | String releaseTimeValue= applyBZDataVO.getReleaseTime(); |
| | | setPropertyValue(releaseTime,releaseTimeValue,proppertyVOList);//å叿¶é´ |
| | | String seriesFlow=applyBZDataVO.getSeriesFlow();//ç³»åæµæ°´ |
| | | codeBZApplyDTO.setOldCode(oldCodeValue); |
| | | codeBZApplyDTO.setReleaseTime(releaseTimeValue); |
| | | codeBZApplyDTO.setEditSeries(editSeriesFlag); |
| | | codeBZApplyDTO.setSeries(seriesFlag); |
| | | codeBZApplyDTO.setOperationType(operationTypeValue); |
| | | codeBZApplyDTO.setSeriesFlow(seriesFlow); |
| | | codeBZApplyDTO.setCodeClassifyOid(codeClassifyVO.getOid()); |
| | | codeBZApplyDTO.setCodeRuleOid(ruleVO.getOid()); |
| | | codeBZApplyDTO.setTemplateOid(templateVO.getOid()); |
| | | codeBZApplyDTO.setCreator(applyBZDataVO.getCreator()); |
| | | codeBZApplyDTO.setLastModifier(applyBZDataVO.getEditor()); |
| | | codeBZApplyDTO.setLcStatus(applyBZDataVO.getStatus()); |
| | | ApplyBZDatasVO newApplyBZDatasVO=new ApplyBZDatasVO(); |
| | | newApplyBZDatasVO.setObject(Arrays.asList(applyBZDataVO)); |
| | | log.info("endï¼æ°æ®ç»ç»å®æ¯"); |
| | | //è§åç主é®éè¦å»è·å |
| | | CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyVO.getOid()); |
| | | if(classifyFullInfo==null ||classifyFullInfo.getCurrentClassifyVO()==null || StringUtils.isBlank(classifyFullInfo.getCurrentClassifyVO().getOid())){ |
| | | objerrorCode="1"; |
| | | log.info("classifyFullInfo:"+"æ ¹æ®ä¼ è¾çåç±»ï¼æªè·ååç±»ç¸å
³ä¿¡æ¯"); |
| | | throw new Throwable ("æ ¹æ®ä¼ è¾çåç±»ï¼æªè·ååç±»ç¸å
³ä¿¡æ¯"); |
| | | } |
| | | CodeRuleVO ruleVO = engineService.getCodeRuleByClassifyFullInfo(classifyFullInfo); |
| | | if(ruleVO==null||StringUtils.isBlank(ruleVO.getOid())){ |
| | | objerrorCode="102"; |
| | | throw new Throwable ("æ ¹æ®ä¼ è¾çåç±»ï¼æªè·åMDMç³»ç»ä¸å¯¹åºè§å"); |
| | | } |
| | | log.info("endï¼è§åè·å宿¯"); |
| | | //List<CodeOrderSecDTO> codeOrderSecDTOList = getRuleCodeOrderSecDTOs(ruleVO,classifyFullInfo); |
| | | log.info("endï¼ç 段è·å宿¯"); |
| | | CodeOrderDTO orderDTO = new CodeOrderDTO(); |
| | | orderDTO.setCodeClassifyOid(codeClassifyVO.getOid());//åç±»ä¸»é® |
| | | //orderDTO.setSecDTOList(codeOrderSecDTOList);//åç±»ç æ®µ |
| | | //mdmIOService.batchSyncApplyCode(orderDTO, dataObjectVO, resultDataObjectDetailDOs,isCodeOrGroupCode); |
| | | //allResultDataObjectDetailDOS.add(resultDataObjectDetailDOs); |
| | | log.info("endï¼ç³è¯·è·å宿¯"); |
| | | this.getConfigDatas(finalSystemId, finalLibray, newApplyBZDatasVO, attrVOS, dataObjectVO); |
| | | log.info("endï¼æ°æ®ç»ç»å®æ¯"); |
| | | codeBZApplyDTO.setData(dataObjectVO.getRowData().get(0).getFiledValue()); |
| | | code=engineService.addSaveBZCodeNotauthUser(codeBZApplyDTO,false); |
| | | msg="ç¼ç ç³è¯·æå:ç¼ç 为ï¼"+code; |
| | | } catch (Throwable e) { |
| | | List<ApplyBZDataVO> applyDataVOList = finalClassfyBZVO.getObjects().getObject(); |
| | | objerrorCode = "1"; |
| | | if (!CollectionUtils.isEmpty(applyDataVOList)) { |
| | | applyDataVOList.stream().forEach(applyDataVO -> { |
| | | XMLResultDataObjectDetailDO xmlResultDataObjectDetailDO = new XMLResultDataObjectDetailDO(); |
| | | xmlResultDataObjectDetailDO.setCode(""); |
| | | xmlResultDataObjectDetailDO.setId(applyDataVO.getId()); |
| | | xmlResultDataObjectDetailDO.setErrorid(objerrorCode); |
| | | xmlResultDataObjectDetailDO.setMsg("ç¼ç ç³è¯·å¤±è´¥:" + e.getMessage()); |
| | | resultDataObjectDetailDOs.add(xmlResultDataObjectDetailDO); |
| | | }); |
| | | } else { |
| | | XMLResultDataObjectDetailDO xmlResultDataObjectDetailDO = new XMLResultDataObjectDetailDO(); |
| | | xmlResultDataObjectDetailDO.setCode(""); |
| | | xmlResultDataObjectDetailDO.setId(""); |
| | | xmlResultDataObjectDetailDO.setErrorid(objerrorCode); |
| | | xmlResultDataObjectDetailDO.setMsg("ç¼ç ç³è¯·å¤±è´¥:" + e.getMessage()); |
| | | resultDataObjectDetailDOs.add(xmlResultDataObjectDetailDO); |
| | | } |
| | | msg="ç¼ç ç³è¯·å¤±è´¥:" +e.getMessage(); |
| | | e.printStackTrace(); |
| | | }finally { |
| | | XMLResultDataObjectDetailDO xmlResultDataObjectDetailDO = new XMLResultDataObjectDetailDO(); |
| | | xmlResultDataObjectDetailDO.setCode(code); |
| | | xmlResultDataObjectDetailDO.setId(id); |
| | | xmlResultDataObjectDetailDO.setErrorid(objerrorCode); |
| | | xmlResultDataObjectDetailDO.setMsg(msg); |
| | | resultDataObjectDetailDOs.add(xmlResultDataObjectDetailDO); |
| | | } |
| | | }); |
| | | XMLResultClassfyVO resultClassfyVO = new XMLResultClassfyVO(); |
| | |
| | | e.printStackTrace(); |
| | | msg="ç³è¯·ç¼ç 失败:"+e.getMessage(); |
| | | }finally { |
| | | |
| | | XMLResultSystemVO xmlResultSystemVO=new XMLResultSystemVO(); |
| | | xmlResultSystemVO.setClassifys(resultClassfyVOList); |
| | | xmlResultSystemVO.setMsg(msg); |
| | |
| | | log.info("è¿ååæ°:"+resultStr); |
| | | //è°ç¨éå¢ç³è¯·æ¥å£ç³è¯·éå¢ç |
| | | return resultStr; |
| | | } |
| | | private void setPropertyValue(String key,String value,List<ProppertyVO> proppertyVOList){ |
| | | ProppertyVO proppertyVO=new ProppertyVO(); |
| | | proppertyVO.setKey(key); |
| | | proppertyVO.setValue(StringUtils.isBlank(value)?"":value); |
| | | proppertyVOList.add(proppertyVO); |
| | | |
| | | } |
| | | /*** |
| | | * æ¥è¯¢æ ¡éªåç±»ä¿¡æ¯ |
| | |
| | | Map<String,String> errorMap=new HashMap<>(); |
| | | for(CodeBasicSecVO codeBasicSecVO: codeBasicSecVOS) { |
| | | String sectype = codeBasicSecVO.getSecType(); |
| | | String newSecName=codeBasicSecVO.getName(); |
| | | String classifySecOid= codeBasicSecVO.getOid(); |
| | | String message=""; |
| | | if (!sectype.equals(CodeSecTypeEnum.CODE_SERIAL_SEC.getValue())) { |
| | |
| | | } |
| | | } |
| | | } |
| | | if(StringUtils.isBlank(sectypeValue)){ |
| | | if(StringUtils.isBlank(sectypeValue)&&!newSecName.equals(secName)){ |
| | | message="ä¼ å
¥çåç±»ç æ®µï¼ã" + name + " ãçå¼ä¸å
许为空"; |
| | | errorMap.put("error",errorMap.getOrDefault("error","")+";"+message); |
| | | } |
| | |
| | | LinkedHashMap<Integer, String> integerValueMap = new LinkedHashMap<>(); |
| | | Map<String, String> filedValueMap = new HashMap<>(); |
| | | if (!CollectionUtils.isEmpty(proppertyVOList)) { |
| | | Map<String, String> sourceKeyValueMap = proppertyVOList.stream().collect(Collectors.toMap(ProppertyVO::getKey, ProppertyVO::getValue, (key1, key2) -> key2)); |
| | | Map<String, String> sourceKeyValueMap = proppertyVOList.stream().collect(Collectors.toMap(ProppertyVO::getKey, ProppertyVO::getValue, (key1, key2) -> key2)); |
| | | Map<String, String> keyValueMap = new HashMap<>(); |
| | | //夿attrMapConfigMapæ¯å¦æå¼ï¼å¦ææ²¡æå说æåºç¡é»è®¤çæ¯ç¼ç ç³»ç»å段 |
| | | if (!CollectionUtils.isEmpty(attrMapConfigMap)) { |