| | |
| | | package com.skyline.electricity.timer; |
| | | |
| | | import org.apache.http.client.ClientProtocolException; |
| | | import org.apache.http.client.config.RequestConfig; |
| | | import org.apache.http.client.entity.UrlEncodedFormEntity; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.message.BasicNameValuePair; |
| | | import org.apache.http.protocol.HTTP; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.springframework.stereotype.*; |
| | | import org.springframework.context.annotation.*; |
| | | import org.springframework.beans.factory.annotation.*; |
| | |
| | | private Map<Object, Object> map; |
| | | private static final SimpleDateFormat dateFormat; |
| | | public Integer mux; |
| | | |
| | | |
| | | public SchedulerTask() { |
| | | this.cmap = new ConcurrentHashMap(); |
| | | this.geometryFactory = new GeometryFactory(); |
| | |
| | | |
| | | List<RetInfo> rlist = new ArrayList<>(); |
| | | list.stream().forEach(r->rlist.add(JSONObject.parseObject(r,RetInfo.class))) ; |
| | | if( list != null && list.size() > 0) |
| | | System.out.println( "websocket status ..["+webSocketController.sendAllMessage(JSONObject.toJSONString(rlist))+"["+JSONObject.toJSONString(rlist)+"]" ); |
| | | 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); |
| | | //pushIM(rlist); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | rlist.stream().forEach((k) -> { |
| | | // if( k.getStatus().equals("ok")) return ; |
| | | System.out.println( "k====="+k.getLongitude()+" "+k.getLatitude()) ; |
| | | //System.out.println( "k====="+k.getLongitude()+" "+k.getLatitude()) ; |
| | | MonitorInfo monitor = informationService.queryMinDistance(k.getLongitude(),k.getLatitude()); |
| | | if( monitor == null ) return ; |
| | | |
| | |
| | | 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()) ; |
| | | //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<String> result = template.postForEntity(url, map,String.class); |
| | | System.out.println("【user info】:"+result); |
| | | //System.out.println("【user info】:"+result); |
| | | |
| | | }); |
| | | |
| | |
| | | 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")); |
| | | //System.out.println(json.getJSONObject("data").getString("id")); |
| | | if (',' == recipent.charAt(recipent.length() - 1)) { |
| | | recipent.append(json.getJSONObject("data").getString("id")); |
| | | } |
| | |
| | | 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<String, String> params, final HttpHeaders headers, final RestTemplate template, final Map<String, Object> configMap, final JSONObject message) { |
| | | final StringBuilder recipent = new StringBuilder(message.get((Object)"recipient").toString()); |
| | | if (',' != recipent.charAt(recipent.length() - 1)) { |
| | |
| | | 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")); |
| | | //System.out.println(json.getJSONObject("data").getString("id")); |
| | | if (',' == recipent.charAt(recipent.length() - 1)) { |
| | | recipent.append(json.getJSONObject("data").getString("id")); |
| | | } |
| | |
| | | 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<FencePosition> fencePositions = (List<FencePosition>)this.detectService.getTempFenceInfo(); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // @Scheduled(fixedRate = 60000L) |
| | | public void setRecipients() { |
| | | final List<Recipients> recipients_list = (List<Recipients>)this.infoSynchService.selectRecipients(); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | public void setPermissions() { |
| | | final List<Permissions> permissions_list = (List<Permissions>)this.infoSynchService.selectPermissions(); |
| | | final List<Permissions> permissions = (List<Permissions>)this.infoSynchService.getPermissions(); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // @Scheduled(fixedRate = 300000L) |
| | | public void setWhiteList() { |
| | | final List<Fence_User> list = (List<Fence_User>)this.infoSynchService.selectWhiteList(); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //@Scheduled(fixedRate = 5000L) |
| | | public void test() { |
| | | SchedulerTask.locationEnable = this.configInfo.getLocationEnable(); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void main(final String[] args) { |
| | | } |
| | | |
| | | |
| | | static { |
| | | SchedulerTask.log = LoggerFactory.getLogger((Class)SchedulerTask.class); |
| | | SchedulerTask.personlocationentity = null; |