From b37c85e07919d6bb740ac85b4c398040d01de5e5 Mon Sep 17 00:00:00 2001 From: xiejun <xj@2023> Date: 星期五, 13 十月 2023 11:33:07 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/util/gennerAttrMapUtil.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 53 insertions(+), 0 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/util/gennerAttrMapUtil.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/util/gennerAttrMapUtil.java index e69de29..8916bdc 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/util/gennerAttrMapUtil.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/util/gennerAttrMapUtil.java @@ -0,0 +1,53 @@ +package com.vci.ubcs.code.util; + +import com.alibaba.cloud.commons.lang.StringUtils; +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.io.xml.DomDriver; +import com.vci.ubcs.code.vo.webserviceModel.attrmap.LibraryDO; +import com.vci.ubcs.code.webService.config.AttributeMapConfig; +import com.vci.ubcs.starter.util.LocalFileUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Map; + +@Slf4j +public class gennerAttrMapUtil { + @Autowired(required = false) + private AttributeMapConfig attributeMapConfig; + private static String fileName=""; + private static gennerAttrMapUtil newInstance=null; + public static gennerAttrMapUtil getNewInstance() { + if(newInstance==null){ + newInstance=new gennerAttrMapUtil(); + } + return newInstance; + } + + /**** + * 鑾峰彇 + * @param systemId + */ + public LibraryDO gennerAttrMapBySystem(String systemId, Map<String, String> system_attrmap) throws Throwable{ + log.info("绯荤粺鏍囪瘑->"+systemId); + if(StringUtils.isBlank(systemId)){ + throw new Throwable("绯荤粺鏍囪瘑涓虹┖"); + } + LibraryDO rootDataVO=new LibraryDO(); + if(system_attrmap.containsKey(systemId)){ + String path=system_attrmap.get(systemId); + log.info("绯荤粺鏍囪瘑->"+systemId+"锛涙枃浠跺睘鎬ч厤缃枃浠惰矾寰�->"+path); + String attributeMapData= LocalFileUtil.readContentForFile(path); + log.info("璇诲彇鍚庣殑灞炴�ф槧灏勫唴瀹�"+attributeMapData); + XStream xStream = new XStream(new DomDriver()); + xStream.processAnnotations(LibraryDO.class); + xStream.autodetectAnnotations(true); + log.info("杞崲鎴愬璞tart"); + rootDataVO = (LibraryDO) xStream.fromXML(attributeMapData); + log.info("杞崲鎴愬璞nd"); + + } + return rootDataVO; + } + +} -- Gitblit v1.9.3