package com.ld.igds.protocol.fzzy.analysis; import com.alibaba.fastjson.JSONObject; import com.ld.igds.common.CoreDeviceService; import com.ld.igds.io.notify.NotifyWebInvoker; import com.ld.igds.io.constant.OrderRespEnum; import com.ld.igds.models.DeviceSer; import com.ld.igds.protocol.fzzy.ServerUtils; import com.ld.igds.protocol.fzzy.command.BaseRemoteImpl; import com.ld.igds.protocol.fzzy.dto.ReMessage; import com.ld.igds.protocol.fzzy.resp.Response5002; import com.ld.igds.temp.dto.TempParam; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * 温度 * * @author andy.jia */ @Slf4j @Component(AnalysisTemp.BEAN_ID) public class AnalysisTemp extends BaseRemoteImpl { public static final String BEAN_ID = "fzzy.analysisTemp"; @Autowired private CoreDeviceService deviceService; @Autowired private NotifyWebInvoker notifyInvoker; public void analysis5001(ReMessage message, DeviceSer ser) { log.debug("-DO NOTHING-"); //DO NOTHING } public void analysis5002(ReMessage reMessage, DeviceSer ser) { Response5002 resp = JSONObject.parseObject(reMessage.getContent(), Response5002.class); ServerUtils.add2StatusMap(ser.getCompanyId(), ser.getId(), resp.getDeviceId(), resp.getStatus()); TempParam param = new TempParam(); param.setId(ser.getId()); param.setTargetTemp(resp.getTemp()); param.setTargetStatus(resp.getStatus()); param.setTargetModel(resp.getMode()); deviceService.updateTempControlInfo(param); notifyInvoker.notifyAnalysisStatusSuccess(ser.getCompanyId(),ser.getId(), OrderRespEnum.MSG_SUCCESS, "设备状态查询成功并完成解析!"); } }