Browse Source

代码修改

liubing 3 years ago
parent
commit
0db2930391

+ 13 - 9
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/endpoint/DeviceController.java

@ -171,10 +171,13 @@ public class DeviceController {
            @RequestParam(value = "time_begin",required = false) String time_begin,
            @RequestParam(value = "time_begin",required = false) String time_begin,
            HttpServletRequest request) {
            HttpServletRequest request) {
        try {
        try {
            String paraString = JSON.toJSONString(request.getParameterMap());
            logger.info("爱牵挂设备sos数据接收,请求参数:\n"+paraString);
            long startTime=System.currentTimeMillis();
            String paraString = JSON.toJSONString(request.getParameterMap());
            deviceService.aqgsos(imei, label_mac, time_begin,request);
            deviceService.aqgsos(imei, label_mac, time_begin,request);
            long endTime=System.currentTimeMillis();
            logger.info("爱牵挂设备sos数据接收,请求参数:\n"+paraString+"\n"+(endTime-startTime)+"ms");
            return success();
            return success();
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
@ -217,11 +220,11 @@ public class DeviceController {
            @RequestParam(value = "communityid",required = false) String communityid,
            @RequestParam(value = "communityid",required = false) String communityid,
            HttpServletRequest request) {
            HttpServletRequest request) {
        try {
        try {
            long startTime=System.currentTimeMillis();
            String paraString = JSON.toJSONString(request.getParameterMap());
            String paraString = JSON.toJSONString(request.getParameterMap());
            logger.info("爱牵挂设备消息通知数据接收,请求参数:\n"+paraString);
            deviceService.pushdata(type, deviceid, communityid, request);
            deviceService.pushdata(type, deviceid, communityid, request);
            long endTime=System.currentTimeMillis();
            logger.info("爱牵挂设备消息通知数据接收,请求参数:\n"+paraString+"\n"+(endTime-startTime)+"ms");
            return success();
            return success();
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
@ -383,7 +386,7 @@ public class DeviceController {
            @RequestParam(value = "heartrate",required = false) String heartrate,
            @RequestParam(value = "heartrate",required = false) String heartrate,
            @ApiParam(name="breath",required = false,value="呼吸率(离床或翻身测量失败时为0)")
            @ApiParam(name="breath",required = false,value="呼吸率(离床或翻身测量失败时为0)")
            @RequestParam(value = "breath",required = false) String breath,
            @RequestParam(value = "breath",required = false) String breath,
            @ApiParam(name="bed_status",required = false,value="在离床状态(0 离床,1 在床) ")
                @ApiParam(name="bed_status",required = false,value="在离床状态(0 离床,1 在床) ")
            @RequestParam(value = "bed_status",required = false) String bed_status,
            @RequestParam(value = "bed_status",required = false) String bed_status,
            @ApiParam(name="turn_over",required = false,value="翻身状态(0 没翻身,1 在翻身)")
            @ApiParam(name="turn_over",required = false,value="翻身状态(0 没翻身,1 在翻身)")
            @RequestParam(value = "turn_over",required = false)String turn_over,
            @RequestParam(value = "turn_over",required = false)String turn_over,
@ -391,11 +394,12 @@ public class DeviceController {
            @RequestParam(value = "is_warn",required = false)String is_warn,
            @RequestParam(value = "is_warn",required = false)String is_warn,
            HttpServletRequest request) {
            HttpServletRequest request) {
        try {
        try {
            long startTime=System.currentTimeMillis();
            String paraString = JSON.toJSONString(request.getParameterMap());
            String paraString = JSON.toJSONString(request.getParameterMap());
            logger.info("爱牵挂-睡眠带接收,请求参数:"+paraString);
            deviceService.bySleep(device,time_begin,heartrate,breath,bed_status,turn_over,is_warn);
            deviceService.bySleep(device,time_begin,heartrate,breath,bed_status,turn_over,is_warn);
            long endTime=System.currentTimeMillis();
            logger.info("爱牵挂-睡眠带接收,请求参数:"+paraString+"\n"+(endTime-startTime)+"ms");
            return success();
            return success();
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();

+ 19 - 6
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceUploadService.java

@ -474,6 +474,9 @@ public class DeviceUploadService {
                        double dulat =Double.parseDouble(lat);
                        double dulat =Double.parseDouble(lat);
                        double dulon = Double.parseDouble(lon);
                        double dulon = Double.parseDouble(lon);
                        if (!(dulat==0.0&&dulon==0.0)){//判断是否触发工单
                        if (!(dulat==0.0&&dulon==0.0)){//判断是否触发工单
                            com.alibaba.fastjson.JSONObject position = gpsUtil.Gps84_To_bd09(dulat,dulon);
                            dulat = position.getDouble("lat");
                            dulon = position.getDouble("lon");
                            List<DevicePatientDevice> patientDeviceList = patientDeviceDao.findByDeviceSn(sn);
                            List<DevicePatientDevice> patientDeviceList = patientDeviceDao.findByDeviceSn(sn);
                            DevicePatientDevice patientDevice = null;
                            DevicePatientDevice patientDevice = null;
                            if (patientDeviceList.size()>0){
                            if (patientDeviceList.size()>0){
@ -507,8 +510,8 @@ public class DeviceUploadService {
                        BaseYxDeviceIndex deviceIndex = new BaseYxDeviceIndex();
                        BaseYxDeviceIndex deviceIndex = new BaseYxDeviceIndex();
                        deviceIndex.setSn(sn);
                        deviceIndex.setSn(sn);
                        deviceIndex.setLat(lat);
                        deviceIndex.setLon(lon);
                        deviceIndex.setLat(dulat+"");
                        deviceIndex.setLon(dulon+"");
                        yxDeviceIndexDao.save(deviceIndex);
                        yxDeviceIndexDao.save(deviceIndex);
                        hvDeviceService.updContactStatus(sn,1);
                        hvDeviceService.updContactStatus(sn,1);
                    }
                    }
@ -522,6 +525,7 @@ public class DeviceUploadService {
                            lat = tmp1[4];
                            lat = tmp1[4];
                            lon = tmp1[6];
                            lon = tmp1[6];
                        }
                        }
                        double dulat =Double.parseDouble(lat);
                        double dulat =Double.parseDouble(lat);
                        double dulon = Double.parseDouble(lon);
                        double dulon = Double.parseDouble(lon);
@ -547,6 +551,10 @@ public class DeviceUploadService {
                                }else {
                                }else {
                                    return;
                                    return;
                                }
                                }
                            }else {
                                com.alibaba.fastjson.JSONObject position = gpsUtil.Gps84_To_bd09(dulat,dulon);
                                dulat = position.getDouble("lat");
                                dulon = position.getDouble("lon");
                            }
                            }
                            if ((dulat==0.0&&dulon==0.0)){
                            if ((dulat==0.0&&dulon==0.0)){
                                return;
                                return;
@ -559,13 +567,18 @@ public class DeviceUploadService {
                            logDO.setDeviceSn(deviceDO.getDeviceSn());
                            logDO.setDeviceSn(deviceDO.getDeviceSn());
                            logDO.setCreateTime(new Date());
                            logDO.setCreateTime(new Date());
                            com.alibaba.fastjson.JSONObject position = gpsUtil.Gps84_To_bd09(dulat,dulon);
                            //坐标
                            //坐标
                            logDO.setSosLat(position.getDouble("lat")+"");
                            logDO.setSosLon(position.getDouble("lon")+"");
                            logDO.setSosAddress(LatitudeUtils.getLocationAddress(position.getDouble("lat")+"",position.getDouble("lon")+""));
                            logDO.setSosLat(dulat+"");
                            logDO.setSosLon(dulon+"");
                            logDO.setSosAddress(LatitudeUtils.getLocationAddress(dulat+"",dulon+""));
                            orderUtil.createEmeOrder(logDO,"4");
                            orderUtil.createEmeOrder(logDO,"4");
                        }
                        }
                        BaseYxDeviceIndex deviceIndex = new BaseYxDeviceIndex();
                        deviceIndex.setSn(sn);
                        deviceIndex.setLat(dulat+"");
                        deviceIndex.setLon(dulon+"");
                        yxDeviceIndexDao.save(deviceIndex);
                        hvDeviceService.updContactStatus(sn,1);
                    }
                    }
                }
                }
            }
            }