From 84ee37e1f485a1d3136535f9ef1c43058d9308ab Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 29 十一月 2023 11:39:42 +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