From bbd50cf91c9a8c7cfe48b3c00dde205b7049ae3b Mon Sep 17 00:00:00 2001 From: leutu <leutu@qq.com> Date: 星期二, 20 八月 2024 14:50:32 +0800 Subject: [PATCH] 时间戳/1000 成为秒,围栏采用楼层判断 --- src/main/java/com/skyline/electricity/timer/Consumer.java | 26 +++++++++++--------------- 1 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/skyline/electricity/timer/Consumer.java b/src/main/java/com/skyline/electricity/timer/Consumer.java index 7028f6a..46c6146 100644 --- a/src/main/java/com/skyline/electricity/timer/Consumer.java +++ b/src/main/java/com/skyline/electricity/timer/Consumer.java @@ -19,7 +19,6 @@ import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; -import java.text.SimpleDateFormat; import java.util.*; @Slf4j @@ -73,12 +72,7 @@ System.out.println("銆恥ser]:"+JSONObject.toJSONString(sysUser)); List<RetInfo> list = new ArrayList<>(); //鏌ヨ鐢ㄦ埛鎵�澶勫洿鏍� - List<FencePosition> fencePositionList = null ; - try{ - fencePositionList = (List<FencePosition>)this.detectService.checkInFence(jsonObject.get("w84lat").toString(),jsonObject.get("w84lon").toString()); - }catch (Exception e){ - System.out.println(e.getMessage()); - } + List<FencePosition> fencePositionList = (List<FencePosition>)this.detectService.checkInFence(jsonObject.get("w84lat").toString(),jsonObject.get("w84lon").toString()); System.out.println("銆怓encePosition]:"+JSONObject.toJSONString(fencePositionList)); RetInfo alertinfo = new RetInfo(); initAlertInfos(jsonObject, personNo, sysUser, alertinfo); @@ -88,7 +82,7 @@ Fence_User fence_user = detectService.checkInAlert(f.getWorkId(),sysUser.getId()); alertinfo.setFence_name(f.getFname()); alertinfo.setWtId(f.getWorkId()); - if( fence_user == null && checkHight(alertinfo.getBaseFloor(),f.getStartaltitude())){ + if( fence_user == null && checkHight(alertinfo.getBaseFloor(),f)){ alertinfo.setStatus("alert"); }else{ @@ -120,14 +114,14 @@ alertinfo.setMobile(sysUser.getMobile()); alertinfo.setBaseFloor(jsonObject.get("baseFloor").toString()); - String time = Long.toString(new Date().getTime()); - - alertinfo.setStartTime(time.substring(0,time.length()-3)); - alertinfo.setHb(jsonObject.getIntValue("hb")); + alertinfo.setStartTime(jsonObject.get("timestamp").toString()); + alertinfo.setHb(jsonObject.getInteger("hb").intValue()); } - private boolean checkHight(String basefloor,double start){ - return (Integer.parseInt(basefloor)-2)*6.3 >=start ; + private boolean checkHight(String basefloor,FencePosition f){ + int fl = (int)(f.getEndaltitude()/7)+1 ; + System.out.println("鎺ユ敹锛�"+basefloor+" 鍥存爮妤煎眰:"+f.getFname()+":"+fl); + return (Integer.parseInt(basefloor)-1) ==fl ; } @@ -137,7 +131,9 @@ Information information = new Information(); information.setFence_type(r.getType()); information.setName(r.getFence_name()); - information.setStartTime(r.getStartTime()); + //information.setStartTime(r.getStartTime()); + //閬垮厤鏃堕棿鍚屾闂 + information.setStartTime((new Date()).getTime()/1000+""); information.setStatus(r.getStatus()); information.setUserId(r.getUserId()); information.setWtId(r.getWtId()); -- Gitblit v1.9.3