package com.nq.pojo; import lombok.Data; import java.math.BigDecimal; import java.util.Map; /** * @program: dabaogp * @description: * @create: 2026-01-15 19:49 **/ @Data public class StockRealTimeDto { private String Id; private String Name; private String Symbol; private String Last; private String High; private String Low; private String PrevClose; private String Time; private String Volume; private String Chg; private String ChgPct; private String country_id; private String type; private String Bid; private String Ask; private String Open; private String PrevLast; private String PrevChg; private String PrevChgPct; private String PrevPrevClose; /** * 从Map转换的静态方法 */ public static StockRealTimeDto fromMap(Map map) { if (map == null) { return null; } StockRealTimeDto stock = new StockRealTimeDto(); // 逐个字段设置 if (map.containsKey("Id")) { Object idObj = map.get("Id"); if (idObj != null) { stock.setId(idObj.toString()); } } if (map.containsKey("Name")) { Object nameObj = map.get("Name"); if (nameObj != null) { stock.setName(nameObj.toString()); } } if (map.containsKey("Symbol")) { Object symbolObj = map.get("Symbol"); if (symbolObj != null) { stock.setSymbol(symbolObj.toString()); } } if (map.containsKey("Last")) { Object lastObj = map.get("Last"); if (lastObj != null) { stock.setLast(lastObj.toString()); } } if (map.containsKey("High")) { Object highObj = map.get("High"); if (highObj != null) { stock.setHigh(highObj.toString()); } } if (map.containsKey("Low")) { Object lowObj = map.get("Low"); if (lowObj != null) { stock.setLow(lowObj.toString()); } } if (map.containsKey("PrevClose")) { Object prevCloseObj = map.get("PrevClose"); if (prevCloseObj != null) { stock.setPrevClose(prevCloseObj.toString()); } } if (map.containsKey("Time")) { Object timeObj = map.get("Time"); if (timeObj != null) { stock.setTime(timeObj.toString()); } } if (map.containsKey("Volume")) { Object volumeObj = map.get("Volume"); if (volumeObj != null) { stock.setVolume(volumeObj.toString()); } } if (map.containsKey("Chg")) { Object chgObj = map.get("Chg"); if (chgObj != null) { stock.setChg(chgObj.toString()); } } if (map.containsKey("ChgPct")) { Object chgPctObj = map.get("ChgPct"); if (chgPctObj != null) { stock.setChgPct(chgPctObj.toString()); } } if (map.containsKey("country_id")) { Object countryIdObj = map.get("country_id"); if (countryIdObj != null) { stock.setCountry_id(countryIdObj.toString()); } } if (map.containsKey("type")) { Object typeObj = map.get("type"); if (typeObj != null) { stock.setType(typeObj.toString()); } } if (map.containsKey("Bid")) { Object bidObj = map.get("Bid"); if (bidObj != null) { stock.setBid(bidObj.toString()); } } if (map.containsKey("Ask")) { Object askObj = map.get("Ask"); if (askObj != null) { stock.setAsk(askObj.toString()); } } if (map.containsKey("Open")) { Object openObj = map.get("Open"); if (openObj != null) { stock.setOpen(openObj.toString()); } } if (map.containsKey("PrevLast")) { Object prevLastObj = map.get("PrevLast"); if (prevLastObj != null) { stock.setPrevLast(prevLastObj.toString()); } } if (map.containsKey("PrevChg")) { Object prevChgObj = map.get("PrevChg"); if (prevChgObj != null) { stock.setPrevChg(prevChgObj.toString()); } } if (map.containsKey("PrevChgPct")) { Object prevChgPctObj = map.get("PrevChgPct"); if (prevChgPctObj != null) { stock.setPrevChgPct(prevChgPctObj.toString()); } } if (map.containsKey("PrevPrevClose")) { Object prevPrevCloseObj = map.get("PrevPrevClose"); if (prevPrevCloseObj != null) { stock.setPrevPrevClose(prevPrevCloseObj.toString()); } } return stock; } }