| | |
| | | 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; |
| | |
| | | * @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; |