ludc
2023-09-19 8381325223bee254168855b1b697db31fc591b9e
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/util/gennerAttrMapUtil.java
@@ -6,10 +6,12 @@
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;
@@ -27,17 +29,22 @@
     * @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);
            rootDataVO = (LibraryDO) xStream.fromXML(attributeMapData);
         log.info("转换成对象start");
           rootDataVO = (LibraryDO) xStream.fromXML(attributeMapData);
         log.info("转换成对象end");
        }
        return rootDataVO;