jiazx0107@163.com
2023-05-17 620eab6cca2bc9ef9ea6d3067a0a5ba1deadbd1c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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, "设备状态查询成功并完成解析!");
    }
}