Browse Source

代码修改

LAPTOP-KB9HII50\70708 3 years ago
parent
commit
a9635380d2

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/OnenetDevice.java

@ -22,6 +22,7 @@ public class OnenetDevice extends UuidIdentityEntityWithCreateTime{
    private String imsi;//sim的imsi
    private String psk;//onenet DTLS加密所使用的PSK
    private String deviceId;//onenet平台设备id
    private String deviceType;//设备厂商类型1未来鹰2 海康
    private String categoryCode;//设备类型标识 14气感,15烟感
    @Column(name="name")
@ -64,6 +65,15 @@ public class OnenetDevice extends UuidIdentityEntityWithCreateTime{
        return deviceId;
    }
    @Column(name="device_type")
    public String getDeviceType() {
        return deviceType;
    }
    public void setDeviceType(String deviceType) {
        this.deviceType = deviceType;
    }
    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

+ 14 - 9
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/OnenetService.java

@ -80,22 +80,23 @@ public class OnenetService {
            JSONObject msg = jsonObject.getJSONObject("msg");
            String deviceSn = msg.getString("imei");
            OnenetDevice onenetDevice = onenetDeviceDao.findBySn(deviceSn);
            String categoryCode = "";
            if(onenetDevice == null){
                logger.info("onenetDevice 设备不存在"+body);
                return;
            }
            String title = "";
            if(onenetDevice!=null){
                categoryCode = onenetDevice.getCategoryCode();
                if("14".equals(categoryCode)){
                    title = "可燃气体探测器报警信息接收";
                }else if("15".equals(categoryCode)){
                    title = "烟探测器监测信息接收";
                }
            String categoryCode = onenetDevice.getCategoryCode();
            if("14".equals(categoryCode)){
                title = "可燃气体探测器报警信息接收";
            }else if("15".equals(categoryCode)){
                title = "烟探测器监测信息接收";
            }
            hvDeviceService.updContactStatus(deviceSn,1);
            dataPushLogUtil.savePushLog(deviceSn,msg.toJSONString(),title);
            //未来鹰设备 类型2是设备状态(不准)
            Integer type = msg.getInteger("type");
            String value = msg.getString("value");
            if(type==1){
            if("1".equals(onenetDevice.getDeviceType())){
                String order = value.substring(10,14);
                if("1401".equals(order)){
                    //自定义命令数据更新(心跳/设备状态上报)
@ -129,6 +130,10 @@ public class OnenetService {
                    index.setRecordTime(DateUtil.getStringDate());
                    deviceHealthIndexDao.save(index);
                }
            }else if("2".equals(onenetDevice.getDeviceType())){
                //海康设备
            }
            record.setContent(msg.toJSONString());