| | |
| | | InformationService informationService ; |
| | | @Override |
| | | public void onMessage(String message) { |
| | | System.out.println("recv msg: "+message); |
| | | //System.out.println("recv msg: "+message); |
| | | sendAllMessage(message); |
| | | } |
| | | |
| | |
| | | */ |
| | | |
| | | public void sendAllMessage(String message) { |
| | | System.out.println("【websocket消息】广播消息:"+message); |
| | | //System.out.println("【websocket消息】广播消息:"+message); |
| | | |
| | | JSONObject jsonObject = JSONObject.parseObject(message); |
| | | String personNo = jsonObject.getString("personNo"); |
| | | |
| | | SysUser sysUser = infoSynchService.selectUserInfoById(personNo) ; |
| | | System.out.println("【user]:"+JSONObject.toJSONString(sysUser)); |
| | | //System.out.println("【user]:"+JSONObject.toJSONString(sysUser)); |
| | | List<RetInfo> list = new ArrayList<>(); |
| | | //查询用户所处围栏 |
| | | List<FencePosition> fencePositionList = null ; |
| | |
| | | }catch (Exception e){ |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | System.out.println("【FencePosition]:"+JSONObject.toJSONString(fencePositionList)); |
| | | //System.out.println("【FencePosition]:"+JSONObject.toJSONString(fencePositionList)); |
| | | RetInfo alertinfo = new RetInfo(); |
| | | initAlertInfos(jsonObject, personNo, sysUser, alertinfo); |
| | | if( fencePositionList != null && fencePositionList.size() > 0){ |
| | |
| | | } |
| | | insertInformation(list); |
| | | System.out.println( "list:"+jsonObject.toJSONString(list)); |
| | | // if( list != null && list.size() > 0) |
| | | // System.out.println( "websocket status ..["+webSocketController.sendAllMessage(JSONObject.toJSONString(list))+"["+JSONObject.toJSONString(list)+"]" ); |
| | | if( list != null && list.size() > 0) |
| | | System.out.println( "websocket status ..["+webSocketController.sendAllMessage(JSONObject.toJSONString(list))+"["+JSONObject.toJSONString(list)+"]" ); |
| | | } |
| | | |
| | | private void initAlertInfos(JSONObject jsonObject, String personNo, SysUser sysUser, RetInfo alertinfo) { |
| | |
| | | alertinfo.setHb(jsonObject.getIntValue("hb")); |
| | | } |
| | | |
| | | /** |
| | | * 判断围栏楼层与上报位置楼层一致,否则不报警 |
| | | * @param basefloor |
| | | * @param start |
| | | * @return |
| | | */ |
| | | private boolean checkHight(String basefloor,double start){ |
| | | return (Integer.parseInt(basefloor)-2)*6.3 >=start ; |
| | | double f = start/6.3; |
| | | int ff = (int)f+2; |
| | | return (ff-Integer.parseInt(basefloor)) >= 0 ; |
| | | } |
| | | |
| | | |