package com.skyline.electricity.timer; import org.springframework.stereotype.*; import org.springframework.context.annotation.*; import org.springframework.beans.factory.annotation.*; import org.springframework.messaging.simp.*; import java.text.ParseException; import java.util.concurrent.*; import com.skyline.electricity.service.*; import com.vividsolutions.jts.geom.*; import java.text.*; import java.nio.charset.*; import org.springframework.http.converter.*; import org.springframework.web.client.*; import com.vividsolutions.jts.io.*; import com.alibaba.fastjson.*; import org.springframework.http.*; import java.util.*; import org.springframework.scheduling.annotation.*; import org.springframework.util.*; import com.skyline.electricity.entity.*; import com.skyline.electricity.pojo.*; import com.skyline.electricity.controller.*; import java.io.*; import java.util.stream.Collectors; import org.slf4j.*; @Component @Configuration @EnableScheduling public class SchedulerTask { private static Logger log; public static List personlocationentity; @Autowired private ConfigInfo configInfo; private static int locationEnable; @Autowired SimpMessagingTemplate simpMessagingTemplate; @Autowired private DetectService detectService; @Autowired private OutService outService; private ConcurrentHashMap cmap; @Autowired private RemoteController remoteController; @Autowired private InfoSynchService infoSynchService; @Autowired private DeviceController deviceController ; @Autowired private InformationService informationService ; @Autowired WebSocketController webSocketController ; GeometryFactory geometryFactory; WKTReader reader; private Point point; private Polygon polygon; private Map map; private static final SimpleDateFormat dateFormat; public Integer mux; public SchedulerTask() { this.cmap = new ConcurrentHashMap(); this.geometryFactory = new GeometryFactory(); this.reader = new WKTReader(this.geometryFactory); this.map = new HashMap(); this.mux = 1; } // 读取information表数据,此表保留用户最后一次定位信息 @Scheduled(fixedRate = 5000L) public void webSocketGetInfo( ) { List list = informationService.listInformations().stream().map(r->r.getXy()).collect(Collectors.toList()); List rlist = new ArrayList<>(); list.stream().forEach(r->rlist.add(JSONObject.parseObject(r,RetInfo.class))) ; if( list != null && list.size() > 0){ System.out.println("scheduled....push size:"+list.size()); webSocketController.sendAllMessage(JSONObject.toJSONString(rlist)); } // System.out.println( "websocket status ..["+JSONObject.toJSONString(rlist)+"]" ); //推送报警信息 //pushIM(rlist); } /** * { *     "type":"3", *     "source":"2", *     "vedioUrl":"", *     "cameraCode":"", *     "cameraName":"", *     "startDate":"1234567890", *     "warnName": "张三进入围栏大厂区" * } */ @Async public void pushIM(List rlist){ final RestTemplate template = new RestTemplate(); Map map = new HashMap<>(); rlist.stream().forEach((k) -> { // if( k.getStatus().equals("ok")) return ; //System.out.println( "k====="+k.getLongitude()+" "+k.getLatitude()) ; MonitorInfo monitor = informationService.queryMinDistance(k.getLongitude(),k.getLatitude()); if( monitor == null ) return ; //严谨的处理应该有判断高度,这里暂时不处理 map.put("type", "3"); map.put("source", "2"); map.put("vedioUrl", monitor.getHk_rtsp()); map.put("cameraCode", monitor.getMonitor_id()); map.put("cameraName", monitor.getMonitor_name()); Date date = new Date(); // try { // date = DateFormat.getDateInstance().parse(k.getStartTime()); // } catch (ParseException e) { // e.printStackTrace(); // date = new Date(); // } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String formattedDate = sdf.format(date); map.put("startDate",formattedDate); map.put("warnName", k.getUserName()+"进入"+k.getFence_name()); String url = configInfo.getWarn_url(); //System.out.println( "post url warning "+url) ; //System.out.println( "post url warning "+configInfo.getServer_url()) ; url = "http://10.69.206.205:8080/a/ew/ewWarning/warning"; ResponseEntity result = template.postForEntity(url, map,String.class); //System.out.println("【user info】:"+result); }); } // @Scheduled(fixedRate = 5000L) public void getInfo() { final RestTemplate template = new RestTemplate(); final Map configInfo = (Map)this.remoteController.getConfigInfo(); final String appid = configInfo.get("appid"); final String tenantId = configInfo.get("tenantId"); final String secret = configInfo.get("secret"); final String coUrl = configInfo.get("coUrl"); final String imUrl = configInfo.get("imUrl"); final String dzzzUrl = configInfo.get("dzzzUrl"); final String shopId = configInfo.get("shopId"); final String modId = configInfo.get("modId"); final String modKey = configInfo.get("modKey"); final Integer pageNum = Integer.parseInt(configInfo.get("pageNum")); final Integer pageSize = Integer.parseInt(configInfo.get("pageSize")); final Integer value = Integer.parseInt(configInfo.get("value")); final String safeSystem_ip = configInfo.get("safeSystem_ip"); final String senderName = "围栏预警"; final String url = safeSystem_ip + "/a/in/api/woWt/savePersonAccess"; template.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); final HttpHeaders header = new HttpHeaders(); header.setContentType(MediaType.APPLICATION_JSON_UTF8); final Map configMap = new HashMap(); configMap.put("appid", appid); configMap.put("secret", secret); configMap.put("tenantId", tenantId); // ResponseEntity response = null; // try { // response = (ResponseEntity)template.getForEntity(coUrl + "/oapi/gettoken?appid={appid}&secret={secret}&tenantId={tenantId}", (Class)String.class, (Map)configMap); // // } // catch (RestClientException e7) { // for (int i = 0; i < 10; ++i) { // response = (ResponseEntity)template.getForEntity(coUrl + "/oapi/gettoken?appid={appid}&secret={secret}&tenantId={tenantId}", (Class)String.class, (Map)configMap); // } // } // final String body = (String)response.getBody(); // System.out.println("weilan resp:["+body+"]"); // final JSONObject jsonObjectResult = JSONObject.parseObject(body); // final String access_token = jsonObjectResult.getString("access_token"); final String access_token = ""; final MultiValueMap params = (MultiValueMap)new LinkedMultiValueMap(); params.add("token", access_token); params.add("senderName", senderName); params.add("sender", appid); final JSONObject message = new JSONObject(); final List recipientsIds = (List)this.infoSynchService.getRecipientsIds(); final StringBuffer stringBuffer = new StringBuffer(); for (int j = 0; j < recipientsIds.size(); ++j) { if (j != recipientsIds.size() - 1) { stringBuffer.append(recipientsIds.get(j) + ","); } else { stringBuffer.append(recipientsIds.get(j)); } } message.put("recipient", (Object)stringBuffer.toString().trim()); message.put("msgId", (Object)UUID.randomUUID().toString()); message.put("displayType", (Object)"microapp"); message.put("handleState", (Object)"false"); final JSONObject msg = new JSONObject(); msg.put("type", (Object)"text"); msg.put("url", (Object)""); msg.put("redirectUrl", (Object)""); msg.put("fun", (Object)""); msg.put("avatar", (Object)""); final Map map = new HashMap(); final Map locations = (Map)this.remoteController.getMultiPersonlocations(shopId, modId, modKey, pageNum, pageSize, (int)value); //final List list = SchedulerTask.personlocationentity = locations.get("list"); final List list = (List)locations.get("list"); final List> personlist = new ArrayList>(); final Iterator it = list.iterator(); while (it.hasNext()) { final PersonPosition p = it.next(); if (p.getAlitude() == null || p.getLatitude() == null || p.getLongitude() == null) { it.remove(); } } final List fencePositionList = (List)this.detectService.getFenceInfoByStatus(); final Information information = new Information(); final String glpoly = this.configInfo.getGl(); final String qjpoly = this.configInfo.getQj(); Polygon glpolygon = null; Polygon qjpolygon = null; try { glpolygon = (Polygon)this.reader.read("POLYGON((" + glpoly + "))"); qjpolygon = (Polygon)this.reader.read("POLYGON((" + qjpoly + "))"); } catch (Exception e1) { e1.printStackTrace(); } final List> fixedPolygon = new ArrayList>(); double startaltitude = 0.0; double endaltitude = 6.3; for (int k = 1; k < 4; ++k) { final Map polyinfo = new HashMap(); polyinfo.put("polygon", qjpolygon.toString()); polyinfo.put("startaltitude", startaltitude); polyinfo.put("endaltitude", endaltitude); polyinfo.put("name", "qj" + k); startaltitude += 6.3; endaltitude += 6.3; fixedPolygon.add(polyinfo); } startaltitude = 0.0; endaltitude = 6.3; for (int k = 1; k < 3; ++k) { final Map polyinfo = new HashMap(); polyinfo.put("polygon", glpolygon.toString()); polyinfo.put("startaltitude", startaltitude); polyinfo.put("endaltitude", endaltitude); if (k == 2) { polyinfo.put("name", "gl3"); } else { polyinfo.put("name", "gl" + k); } startaltitude += 12.6; endaltitude += 12.6; fixedPolygon.add(polyinfo); } int personcount = 0; SchedulerTask.log.warn("人员位置list" + list.toString()); if (list.size() > 0) { for (int l = 0; l < fixedPolygon.size(); ++l) { personcount = 0; personlist.clear(); for (int m = 0; m < list.size(); ++m) { final String compoint = list.get(m).getLongitude() + " " + list.get(m).getLatitude(); final String userId = list.get(m).getUserId(); try { this.point = (Point)this.reader.read("POINT(" + compoint + ")"); } catch (Exception e2) { e2.printStackTrace(); } if (this.point != null) { map.put("point", this.point.toString()); } map.put("polygon", fixedPolygon.get(l).get("polygon")); final String flag = this.detectService.judge((Map)map); final boolean mark = Double.parseDouble(list.get(m).getAlitude()) > Double.parseDouble(fixedPolygon.get(l).get("startaltitude").toString()) && Double.parseDouble(list.get(m).getAlitude()) < Double.parseDouble(fixedPolygon.get(l).get("endaltitude").toString()); if (flag.equals("t") && mark) { final Map tempmap = new HashMap(); tempmap.put("workid", fixedPolygon.get(l).get("name")); tempmap.put("userid", list.get(m).getUserId().toString()); personlist.add(tempmap); ++personcount; } if (m == list.size() - 1) { this.detectService.insertfixareaPersonRel((List)personlist, fixedPolygon.get(l).get("name").toString(), personcount); } } } for (int l = 0; l < fencePositionList.size(); ++l) { personcount = 0; personlist.clear(); final String workId = fencePositionList.get(l).getWorkId(); final List allowList = (List)this.infoSynchService.selectAllowList(workId); try { this.polygon = (Polygon)this.reader.read("POLYGON((" + fencePositionList.get(l).getFenceposition() + "))"); } catch (Exception e3) { e3.printStackTrace(); } for (int j2 = 0; j2 < list.size(); ++j2) { final String compoint2 = list.get(j2).getLongitude() + " " + list.get(j2).getLatitude(); final String userId2 = list.get(j2).getUserId(); final boolean isExist = allowList.contains(userId2); final Information info = this.detectService.selectPosition(userId2, fencePositionList.get(l).getWorkId()); try { this.point = (Point)this.reader.read("POINT(" + compoint2 + ")"); } catch (Exception e4) { e4.printStackTrace(); } if (this.point != null) { map.put("point", this.point.toString()); } map.put("polygon", this.polygon.toString()); final String flag2 = this.detectService.judge((Map)map); final boolean mark2 = Double.parseDouble(list.get(j2).getAlitude()) > fencePositionList.get(l).getStartaltitude() && Double.parseDouble(list.get(j2).getAlitude()) < fencePositionList.get(l).getEndaltitude(); if (flag2.equals("t") && mark2) { final Map tempmap2 = new HashMap(); tempmap2.put("fname", fencePositionList.get(l).getFname()); tempmap2.put("workid", fencePositionList.get(l).getWorkId()); tempmap2.put("userid", list.get(j2).getUserId().toString()); personlist.add(tempmap2); ++personcount; } if (j2 == list.size() - 1) { final FencePosition fencePost = fencePositionList.get(l); fencePost.setPersoncount(Integer.valueOf(personcount)); this.detectService.updateFenceInfo(fencePost); for (final Map map2 : personlist) { map2.put("personcount", personcount); } this.detectService.insertFencePersonRel((List)personlist, fencePost.getWorkId()); } if (info == null && mark2) { if (flag2.equals("t")) { information.setWtId(fencePositionList.get(l).getWorkId()); information.setUserId(list.get(j2).getUserId()); information.setUserName(list.get(j2).getUserName()); information.setStartTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()).toString()); information.setName(fencePositionList.get(l).getFname()); information.setFence_type(fencePositionList.get(l).getType()); information.setStatus("in"); SchedulerTask.log.warn("in调用插入时间 " + information.toString()); this.cmap.put(list.get(j2).getUserId(), 1); final String json = JSON.toJSONString((Object)information); this.detectService.insertInfo(information); if (fencePositionList.get(l).getType().equals("temp")) { final HttpEntity> as_request = (HttpEntity>)new HttpEntity((Object)json, (MultiValueMap)header); template.postForEntity(url, (Object)as_request, (Class)String.class, new Object[0]); SchedulerTask.log.warn("临时围栏工作票:+" + fencePositionList.get(l).getWorkId()); final List workleader = (List)this.detectService.selectWorkLeader(fencePositionList.get(l).getWorkId()); SchedulerTask.log.warn("工作票负责人" + workleader.toString()); if (workleader.get(0).get("id").equals(list.get(j2).getUserId())) { SchedulerTask.log.warn(list.get(j2).getUserName() + "该员工是工作票负责人"); final Information lastInformation = this.detectService.queryInformation(information.getWtId(), workleader.get(0).get("id").toString()); SchedulerTask.log.warn("上次的出记录" + lastInformation.toString()); SchedulerTask.log.warn("本次出入记录" + information.toString()); if (lastInformation != null) { final String startWorkTimeAM = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString() + " 08:30"; final String endWorkTimeAM = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString() + " 11:30"; final String startWorkTimePM = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString() + " 13:30"; final String endWorkTimePM = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString() + " 17:30"; final String currentTime = information.getStartTime(); final String lastTime = lastInformation.getStartTime(); boolean fig = false; try { final Date now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(currentTime); final Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(lastTime); final long l2 = (now.getTime() - date.getTime()) / 1000L / 60L; if (l2 > 10L) { if (lastTime.compareTo(startWorkTimeAM) > 0 && lastTime.compareTo(endWorkTimeAM) < 0 && currentTime.compareTo(startWorkTimeAM) > 0 && currentTime.compareTo(endWorkTimeAM) < 0) { fig = true; } if (currentTime.compareTo(startWorkTimePM) > 0 && currentTime.compareTo(endWorkTimePM) < 0 && lastTime.compareTo(startWorkTimePM) > 0 && lastTime.compareTo(endWorkTimePM) < 0) { fig = true; } } if (fig) { SchedulerTask.log.warn("推送信息给工作台"); msg.put("title", (Object)"离开工作票区域超时告警"); final String enter_msg = "工作票负责人:" + workleader.get(0).get("name") + "离开" + fencePositionList.get(l).getFname() + "\u56f4\u680f\uff0c\u65f6\u95f4" + l2 + "\u5206\u949f"; msg.put("msg", (Object)enter_msg); message.put("message", (Object)msg.toString()); SchedulerTask.log.warn("gengxin"); this.detectService.updateFenceAlarmCount(fencePositionList.get(l).getWorkId()); SchedulerTask.log.warn("gengxinwanchen"); SchedulerTask.log.warn("工作票负责人告警前"); this.pushMessage(list.get(j2).getUserId(), dzzzUrl, imUrl, tenantId, params, headers, template, configMap, message); SchedulerTask.log.warn("工作票负责人告警后"); } } catch (Exception e5) { e5.printStackTrace(); } } } } } } else if (info != null) { SchedulerTask.log.warn("1"); if (flag2.equals("t") && mark2) { SchedulerTask.log.warn("2"); if (!isExist) { SchedulerTask.log.warn("3"); if (list.get(j2).getType().equals("UWB") && !fencePositionList.get(l).getType().equals("temp")) { final Information entryinfo = this.detectService.selectPosition(userId2, fencePositionList.get(l).getWorkId()); SchedulerTask.log.warn("固定围栏进入记录" + entryinfo.toString()); Date entrydata = null; try { entrydata = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(entryinfo.getStartTime()); } catch (Exception e6) { SchedulerTask.log.warn(e6.toString()); e6.printStackTrace(); } SchedulerTask.log.warn("时间判断" + (System.currentTimeMillis() - entrydata.getTime() > 20000L) + (System.currentTimeMillis() - entrydata.getTime() < 25000L)); SchedulerTask.log.warn(this.cmap.toString()); if (System.currentTimeMillis() - entrydata.getTime() > 20000L) { synchronized (this.mux) { final int a = l; final int b = j2; if (this.cmap.containsKey(userId2)) { this.cmap.remove(list.get(b).getUserId()); SchedulerTask.log.warn("固定围栏进入超过1分钟"); msg.put("title", (Object)"异常进入告警"); final String quit_msg = "未授权人" + list.get(b).getUserName() + "进入" + fencePositionList.get(a).getFname(); msg.put("msg", (Object)quit_msg); message.put("message", (Object)msg.toString()); SchedulerTask.log.warn("推送标签前" + msg.toString()); final Object uwbBody = this.remoteController.sendMessageToUWB(list.get(b).getShopId(), list.get(b).getUserId(), Integer.valueOf(0), "BELL_VIBRATE"); SchedulerTask.log.warn("推送标签后"); SchedulerTask.log.warn("uwp固定围栏报警开始"); SchedulerTask.log.warn("更新预警次数" + fencePositionList.get(a).getWorkId()); this.detectService.updateFenceAlarmCount(fencePositionList.get(a).getWorkId()); SchedulerTask.log.warn("更新预警次数完成"); this.pushCommonMessage(list.get(b).getUserId(), dzzzUrl, imUrl, tenantId, params, headers, template, configMap, message); SchedulerTask.log.warn("uwp固定围栏报警结束"); SchedulerTask.log.warn("cmap清除" + list.get(b).getUserId()); } } } } } } else { if (this.cmap.contains(userId2)) { this.cmap.remove(userId2); } SchedulerTask.log.warn(this.cmap.toString()); this.detectService.changeStatus(userId2, fencePositionList.get(l).getWorkId()); SchedulerTask.log.warn("改变状态" + userId2.toString()); information.setUserId(list.get(j2).getUserId()); information.setUserName(list.get(j2).getUserName()); information.setWtId(fencePositionList.get(l).getWorkId()); information.setStartTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()).toString()); information.setName(fencePositionList.get(l).getFname()); information.setFence_type(fencePositionList.get(l).getType()); information.setStatus("out"); final String json = JSON.toJSONString((Object)information); SchedulerTask.log.warn("out\u8c03\u7528" + information.toString()); this.detectService.insertInfo(information); if (fencePositionList.get(l).getType().equals("temp")) { final HttpEntity> request = (HttpEntity>)new HttpEntity((Object)json, (MultiValueMap)header); template.postForEntity(url, (Object)request, (Class)String.class, new Object[0]); } } } } } } else { this.detectService.delAllFencePersonRel(); } } public void pushMessage(final String userid, final String dzzzUrl, final String imUrl, final String tenantId, final MultiValueMap params, final HttpHeaders headers, final RestTemplate template, final Map configMap, final JSONObject message) { final StringBuilder recipent = new StringBuilder(message.get((Object)"recipient").toString()); final List zhurenlist = (List)this.detectService.selectDepartDeputyDirectorByStaffid(userid); if (',' != recipent.charAt(recipent.length() - 1)) { recipent.append(","); } for (final Map zhuren : zhurenlist) { recipent.append(zhuren.get("id")).append(","); } SchedulerTask.log.warn("recip" + recipent.toString()); SchedulerTask.log.warn("当值值长"); SchedulerTask.log.warn("configMap" + configMap.toString()); final String dzzzresponse = (String)template.getForObject(dzzzUrl, (Class)String.class, new Object[0]); final JSONObject json = JSONObject.parseObject(dzzzresponse); SchedulerTask.log.warn(dzzzresponse.toString()); SchedulerTask.log.warn(json.getJSONObject("data").getString("id")); //System.out.println(json.getJSONObject("data").getString("id")); if (',' == recipent.charAt(recipent.length() - 1)) { recipent.append(json.getJSONObject("data").getString("id")); } else { recipent.append(',' + json.getJSONObject("data").getString("id")); } message.put("recipient", recipent.toString()); params.add("message", message.toString()); final HttpEntity> httpEntity = (HttpEntity>)new HttpEntity((Object)params, (MultiValueMap)headers); SchedulerTask.log.warn("推送参数" + params.toString()); SchedulerTask.log.warn("推送实体httpEnitty", (Object)httpEntity.toString()); final ResponseEntity responseEntity = template.postForEntity(imUrl + "/oapi/message/sendworkmsg?tenantId=" + tenantId, (Object)httpEntity, (Class)String.class, new Object[0]); SchedulerTask.log.warn("推送结果" + responseEntity.toString()); } public void pushCommonMessage(final String userid, final String dzzzUrl, final String imUrl, final String tenantId, final MultiValueMap params, final HttpHeaders headers, final RestTemplate template, final Map configMap, final JSONObject message) { final StringBuilder recipent = new StringBuilder(message.get((Object)"recipient").toString()); if (',' != recipent.charAt(recipent.length() - 1)) { recipent.append(","); } final List zhurenlist = (List)this.detectService.selectDepartDeputyDirectorByStaffid(userid); for (final Map zhuren : zhurenlist) { recipent.append(zhuren.get("id")).append(","); } SchedulerTask.log.warn("recip" + recipent.toString()); SchedulerTask.log.warn("当值值长"); SchedulerTask.log.warn("configMap" + configMap.toString()); final List outlist = (List)this.outService.selectExternPeople(userid); for (final Map map : outlist) { recipent.append(map.get("PRO_LEADER").toString() + ","); } final String dzzzresponse = (String)template.getForObject(dzzzUrl, (Class)String.class, new Object[0]); final JSONObject json = JSONObject.parseObject(dzzzresponse); SchedulerTask.log.warn(dzzzresponse.toString()); SchedulerTask.log.warn(json.getJSONObject("data").getString("id")); //System.out.println(json.getJSONObject("data").getString("id")); if (',' == recipent.charAt(recipent.length() - 1)) { recipent.append(json.getJSONObject("data").getString("id")); } else { recipent.append(',' + json.getJSONObject("data").getString("id")); } message.put("recipient", recipent.toString()); params.add("message", message.toString()); final HttpEntity> httpEntity = (HttpEntity>)new HttpEntity((Object)params, (MultiValueMap)headers); SchedulerTask.log.warn("推送参数" + params.toString()); SchedulerTask.log.warn("推送实体httpEnitty", (Object)httpEntity.toString()); final ResponseEntity responseEntity = template.postForEntity(imUrl + "/oapi/message/sendworkmsg?tenantId=" + tenantId, (Object)httpEntity, (Class)String.class, new Object[0]); SchedulerTask.log.warn("推送结果" + responseEntity.toString()); } // @Scheduled(fixedRate = 5000L) public void changeFenceStatus() { final List fencePositions = (List)this.detectService.getTempFenceInfo(); for (final FencePosition fencePosition : fencePositions) { if (!StringUtils.isEmpty((Object)fencePosition.getStarttime()) && StringUtils.isEmpty((Object)fencePosition.getDisabledtime())) { if (SchedulerTask.dateFormat.format(new Date()).compareTo(fencePosition.getStarttime()) >= 0) { this.detectService.setFenceEnabledByStartTime(fencePosition.getWorkId()); } else { this.detectService.setFenceDisabled(fencePosition.getWorkId()); } } else if (!StringUtils.isEmpty((Object)fencePosition.getStarttime()) && !StringUtils.isEmpty((Object)fencePosition.getDisabledtime())) { if (SchedulerTask.dateFormat.format(new Date()).compareTo(fencePosition.getDisabledtime()) <= 0 && SchedulerTask.dateFormat.format(new Date()).compareTo(fencePosition.getStarttime()) >= 0) { this.detectService.setFenceEnabled(fencePosition.getWorkId()); } else { if (SchedulerTask.dateFormat.format(new Date()).compareTo(fencePosition.getDisabledtime()) < 0 && SchedulerTask.dateFormat.format(new Date()).compareTo(fencePosition.getStarttime()) > 0) { continue; } this.detectService.setFenceDisabled(fencePosition.getWorkId()); } } else { if (!StringUtils.isEmpty((Object)fencePosition.getStarttime())) { continue; } this.detectService.setFenceDisabled(fencePosition.getWorkId()); } } } // @Scheduled(fixedRate = 60000L) public void setRecipients() { final List recipients_list = (List)this.infoSynchService.selectRecipients(); final List recipients = (List)this.infoSynchService.getRecipients(); for (final Recipients recipient : recipients_list) { if (!recipients.contains(recipient)) { this.infoSynchService.setRecipients(recipient); } } } public void setPermissions() { final List permissions_list = (List)this.infoSynchService.selectPermissions(); final List permissions = (List)this.infoSynchService.getPermissions(); for (final Permissions permission : permissions_list) { if (!permissions.contains(permission)) { this.infoSynchService.setPermissions(permission); } } } // @Scheduled(fixedRate = 300000L) public void setWhiteList() { final List list = (List)this.infoSynchService.selectWhiteList(); final List fenceList = (List)this.detectService.getFixedFenceInfo(); for (int i = 0; i < fenceList.size(); ++i) { final String workId = fenceList.get(i).getWorkId(); for (final Fence_User user : list) { user.setWorkId(workId); final Fence_User fence_user = this.infoSynchService.selectUniqueInfo(user); if (fence_user == null) { this.infoSynchService.insertWhiteList(user); } } } } //@Scheduled(fixedRate = 5000L) public void test() { SchedulerTask.locationEnable = this.configInfo.getLocationEnable(); if (SchedulerTask.locationEnable == 1) { final Map map = new HashMap(); if (SchedulerTask.personlocationentity != null) { map.put("list", SchedulerTask.personlocationentity); } try { WebSocketServer.BroadCastInfo(JSONObject.toJSONString((Object)map)); } catch (IOException e) { e.printStackTrace(); } } } public static void main(final String[] args) { } static { SchedulerTask.log = LoggerFactory.getLogger((Class)SchedulerTask.class); SchedulerTask.personlocationentity = null; dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); } }