| | |
| | | |
| | | import java.util.Map; |
| | | |
| | | import com.qianwen.smartman.modules.mdc.mapper.StateMapper; |
| | | import com.qianwen.smartman.modules.mdc.vo.StateVO; |
| | | import com.qianwen.smartman.modules.mdc.vo.StatusRecordVO; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private static final Logger log = LoggerFactory.getLogger(RealTimeDataService.class); |
| | | @Autowired |
| | | private SuperProcessParameterMapper processParamMapper; |
| | | |
| | | @Autowired |
| | | private StateMapper stateMapper; |
| | | |
| | | public final String statusDpName = "DeviceStatus"; |
| | | /** |
| | |
| | | statusJson.put("t", statusDTO.getT()); |
| | | statusJson.put("v", statusDTO.getV()); |
| | | |
| | | //存在问题,DeviceStastus,DeviceStatus_n会几乎同时过来 |
| | | //存在问题,DeviceStatus,DeviceStatus_n会几乎同时过来 |
| | | long preT = statusDTO.getT(); |
| | | //最后一条不同值(v)的数据 |
| | | |
| | | /* |
| | | ProcessParameterVO diffStatusVO = processParamMapper.lastParameterNotEqValue(workstationId, statusDpName, statusDTO.getV()); |
| | | |
| | | |
| | | ProcessParameterVO tempStatusVO; |
| | | if(diffStatusVO != null) { |
| | | tempStatusVO = processParamMapper.firstParameterEqValueGtTime(workstationId, statusDpName, statusDTO.getV(), diffStatusVO.getTime().getTime()); |
| | |
| | | } |
| | | if(tempStatusVO != null) { |
| | | preT = tempStatusVO.getTime().getTime(); |
| | | } |
| | | }*/ |
| | | Integer val = Integer.parseInt(statusDTO.getV()); |
| | | |
| | | //StateVO diffStatusVO = stateMapper.lastStateNotEqValue(workstationId,val); |
| | | StateVO diffStatusVO = stateMapper.lastStateNotEqValueLtTime(workstationId,val,statusDTO.getT()); |
| | | StateVO tempStatusVO; |
| | | if(diffStatusVO != null) { |
| | | tempStatusVO = stateMapper.firstStateEqValueGtTime(workstationId, val, diffStatusVO.getTime()); |
| | | }else { |
| | | tempStatusVO = stateMapper.firstStateEqValue(workstationId, val); |
| | | } |
| | | if(tempStatusVO != null) { |
| | | preT = tempStatusVO.getTime(); |
| | | } |
| | | statusJson.put("preT", preT); |
| | | |
| | | //statusJson.put("t", System.currentTimeMillis());//时间改为当前) |
| | | map.put(statusDpName, statusJson);//覆盖原来的DeviceStatus |
| | | } |
| | | } |