Просмотр исходного кода

Merge branch 'dev' of http://27.154.233.186:10080/Amoy2/wlyy2.0 into dev

wangzhinan 3 лет назад
Родитель
Сommit
74a7ae5116

+ 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;
    }

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorEndpoint.java

@ -43,7 +43,7 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private DoctorServicePermissionsService doctorServicePermissionsService;
    @GetMapping(value = "updOnline")
    @PostMapping(value = "updOnline")
    @ApiOperation(value = "更新在线状态")
    public Envelop updOnline(@ApiParam(name = "doctorId", value = "医生id", required = true)
                                 @RequestParam(value = "doctorId",required = true) String doctorId,

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java

@ -587,8 +587,8 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
            sql+= " and residential_area = '"+residentialArea+"' ";
        }
        sql += filter1;
        sql += " GROUP BY a.id,a.name,a.photo,a.idcard,a.birthday,a.residential_area,a.sex,online,signStatus ";
        sql += " ORDER BY online desc,signStatus desc";
        sql += " GROUP BY a.id,a.name,a.photo,a.idcard,a.birthday,a.residential_area,a.sex,on_line,signStatus ";
        sql += " ORDER BY a.on_line desc,signStatus desc";
        sql += limit;
        List<Map<String,Object>>  list = jdbcTemplate.queryForList(sql);
        String sqlLife= "SELECT COUNT(*) from base_life_care_order where `status` = 2";

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

@ -80,55 +80,28 @@ 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){
                String order = value.substring(10,14);
                if("1401".equals(order)){
                    //自定义命令数据更新(心跳/设备状态上报)
                    String gas_Level = value.substring(22,24);
                    Integer gas = Integer.parseInt(gas_Level, 16);
                    if(gas>0){
                        //气体浓度大于0触发报警
                        String sql = "select count(*) from base_device_health_index where device_sn = '"+deviceSn+"'" +
                                " and value>0 and create_time>='"+DateUtil.getNextMinute(-60)+"' ";
                        Integer count = jdbcTemplate.queryForObject(sql,Integer.class);
                        if(count==0){
                            logger.info("气体浓度大于0触发报警,deviceSn:{}",deviceSn);
                            //1小时内不重复发起
                            JSONObject tmp = new JSONObject();
                            tmp.put("gas",gas);
                            orderUtil.createSecurityOrder(deviceSn,null,new JSONObject(),null,6,"11","preventGasLeakage",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
                        }
                    }
                    DeviceHealthIndex index = new DeviceHealthIndex();
                    index.setDeviceSn(deviceSn);
                    if("14".equals(categoryCode)){
                        index.setUnit("%LEL");
                        index.setDeviceType("1");
                    }else if("15".equals(categoryCode)){
                        index.setUnit("%");
                        index.setDeviceType("2");
                    }
                    index.setValue(gas+"");
                    index.setRecordTime(DateUtil.getStringDate());
                    deviceHealthIndexDao.save(index);
                }
            if("1".equals(onenetDevice.getDeviceType())){
                wlyDateDel(categoryCode,msg);
            }else if("2".equals(onenetDevice.getDeviceType())){
                //海康设备
            }
            record.setContent(msg.toJSONString());
@ -232,4 +205,38 @@ public class OnenetService {
        logger.info("apikeyPost="+result);
        return result;
    }
    /**
     * 未来鹰设备数据处理
     * @param categoryCode
     * @param msg
     */
    public void wlyDateDel(String categoryCode,JSONObject msg){
        String dsId = msg.getString("ds_id");
        String msgId = dsId.split("_")[2];
        String value = msg.getString("value");
        String deviceSn = msg.getString("imei");
        if ("14".equals(categoryCode)){//燃气设备
        }else if ("15".equals(categoryCode)){//烟雾设备
            if ("5504".equals(msgId)){//烟雾浓度消息 大于0 触发报警
                Integer gasValue = Integer.parseInt(value);
                if (gasValue>0){
                    JSONObject tmp = new JSONObject();
                    tmp.put("smoke",value);
                    orderUtil.createSecurityOrder(deviceSn,null,new JSONObject(),null,7,"10","preventFire",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
                }
                DeviceHealthIndex index = new DeviceHealthIndex();
                index.setDeviceSn(deviceSn);
                index.setUnit("%");
                index.setDeviceType("2");
                index.setValue(value);
                index.setRecordTime(DateUtil.getStringDate());
                deviceHealthIndexDao.save(index);
            }
            if ("5503".equals(msgId)){//各消息类型
            }
        }
    }
}