package org.springnewfiber.dataadapter.entity; import lombok.Data; import java.io.Serializable; import java.util.Date; import java.util.Map; /** * 对接产品化,,通用接受mq */ @Data public class PtReceiveBaseModel implements Serializable { /** * 站点标识符 */ private String st; /** * 传感器标识符 */ @Deprecated private String sn; /** * 观测时间 */ private Date tt; /** * 上报时间 */ private Date ut; /** * 具体数据 */ private Map<String, MqNodeData> dataMap; /** * 数据转换 * * @param rtuReportData * @param elementItemLoader * @return */ // public static PtReceiveBaseModel rtuSl6512014ConvertModel(RtuReportData rtuReportData, ElementItemLoader elementItemLoader) { // Map<String, Object> metaData = rtuReportData.getMap(); // Map<String, Object> objectMap = Maps.newHashMap(metaData); // PtReceiveBaseModel model = new PtReceiveBaseModel(); // Date tt = SaveDbContext.strToDate(objectMap.get(SaveDbContext.MapConstant.TT).toString()); // Date ut = SaveDbContext.strToDate(objectMap.get(SaveDbContext.MapConstant.UT).toString()); // model.setSt(objectMap.get(SaveDbContext.MapConstant.ST).toString()); // model.setTt(tt); // model.setUt(ut); // objectMap.remove(SaveDbContext.MapConstant.ST); // objectMap.remove(SaveDbContext.MapConstant.TT); // objectMap.remove(SaveDbContext.MapConstant.UT); // Map<String, BigDecimal> receiveMap = Maps.newHashMap(); // rtuReportData.getReportResult().getErrorSet().forEach(i -> { // ElementItem elementItem = elementItemLoader.getCodeMap().get(i); // receiveMap.put(i, elementItem == null ? new BigDecimal(MysqlSaveToConfigHandle.CountAsciiVarHandle.defultExceptionValue) : new BigDecimal(elementItem.getExceptionValue())); // }); // objectMap.putAll(receiveMap); // model.setDataMap(objectMap); // return model; // } }