Commit 76240a6e256a1c021c82b9e3446da6dd0d34696e
Merge branch 'pudong_jdk8' of http://61.169.120.202:8888/panzhaov5/bsth_control into pudong_jdk8
Showing
8 changed files
with
862 additions
and
699 deletions
src/main/java/com/bsth/common/SystemParamKeys.java
| 1 | -package com.bsth.common; | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | - * @author Hill | ||
| 5 | - */ | ||
| 6 | -public class SystemParamKeys { | ||
| 7 | - | ||
| 8 | - public static final String SPECIAL_ROLES = "special.roles"; | ||
| 9 | - | ||
| 10 | - public static final String SPECIAL_DAYS = "special.days"; | ||
| 11 | - | ||
| 12 | - public static final String URL_HTTP_GPS_REAL_CACHE = "url.http.gps.real.cache"; | ||
| 13 | - | ||
| 14 | - public static final String URL_HTTP_GPS_REAL = "url.http.gps.real"; | ||
| 15 | - | ||
| 16 | - public static final String URL_HTTP_DIRECTIVE = "url.http.directive"; | ||
| 17 | - | ||
| 18 | - public static final String URL_HTTP_RFID = "url.http.rfid"; | ||
| 19 | - | ||
| 20 | - public static final String URL_HTTP_REPORT = "url.http.report.%s"; | ||
| 21 | - | ||
| 22 | - public static final String URL_HTTP_TICKETING = "url.http.ticketing"; | ||
| 23 | - | ||
| 24 | - public static final String URL_HTTP_DSM_ACK = "url.http.dsm.ack"; | ||
| 25 | - | ||
| 26 | - public static final String URL_HTTP_CP_ACK = "url.http.cp.ack"; | ||
| 27 | - | ||
| 28 | - public static final String MAIL_ADMIN = "mail.admin"; | ||
| 29 | - | ||
| 30 | - public static final String MAIL_WAYBILL = "mail.waybill"; | ||
| 31 | - | ||
| 32 | - public static final String ENABLED_FIRST_LAST_GENERATION = "enabled.first.last.generation"; | ||
| 33 | - | ||
| 34 | - public static final String ENABLED_FILTER_SQL_INJECTION = "enabled.filter.sql.injection"; | ||
| 35 | - | ||
| 36 | - public static final String ENABLED_SSO = "enabled.sso"; | ||
| 37 | - | ||
| 38 | - public static final String SSO_SYSTEM_CODE = "sso.system.code"; | ||
| 39 | - | ||
| 40 | - public static final String URL_HTTP_SSO_LOGIN = "url.http.sso.login"; | ||
| 41 | - | ||
| 42 | - public static final String URL_HTTP_SSO_LOGOUT = "url.http.sso.logout"; | ||
| 43 | - | ||
| 44 | - public static final String URL_HTTP_SSO_AUTH = "url.http.sso.auth"; | ||
| 45 | - | ||
| 46 | - public static final String URL_HTTP_MAINTENANCE = "url.http.maintenance"; | ||
| 47 | - | ||
| 48 | - public static final String ENABLED_WHITE_IP = "enabled.white.ip"; | ||
| 49 | - | ||
| 50 | - public static final String ENABLED_FILTER_AUTHORITY = "enabled.filter.authority"; | ||
| 51 | -} | 1 | +package com.bsth.common; |
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * @author Hill | ||
| 5 | + */ | ||
| 6 | +public class SystemParamKeys { | ||
| 7 | + | ||
| 8 | + public static final String SPECIAL_ROLES = "special.roles"; | ||
| 9 | + | ||
| 10 | + public static final String SPECIAL_DAYS = "special.days"; | ||
| 11 | + | ||
| 12 | + public static final String URL_HTTP_GPS_REAL_CACHE = "url.http.gps.real.cache"; | ||
| 13 | + | ||
| 14 | + public static final String URL_HTTP_GPS_REAL = "url.http.gps.real"; | ||
| 15 | + | ||
| 16 | + public static final String URL_HTTP_DIRECTIVE = "url.http.directive"; | ||
| 17 | + | ||
| 18 | + public static final String URL_HTTP_RFID = "url.http.rfid"; | ||
| 19 | + | ||
| 20 | + public static final String URL_HTTP_REPORT = "url.http.report.%s"; | ||
| 21 | + | ||
| 22 | + public static final String URL_HTTP_TICKETING = "url.http.ticketing"; | ||
| 23 | + | ||
| 24 | + public static final String URL_HTTP_DSM_ACK = "url.http.dsm.ack"; | ||
| 25 | + | ||
| 26 | + public static final String URL_HTTP_CP_ACK = "url.http.cp.ack"; | ||
| 27 | + | ||
| 28 | + public static final String MAIL_ADMIN = "mail.admin"; | ||
| 29 | + | ||
| 30 | + public static final String MAIL_WAYBILL = "mail.waybill"; | ||
| 31 | + | ||
| 32 | + public static final String ENABLED_FIRST_LAST_GENERATION = "enabled.first.last.generation"; | ||
| 33 | + | ||
| 34 | + public static final String ENABLED_FILTER_SQL_INJECTION = "enabled.filter.sql.injection"; | ||
| 35 | + | ||
| 36 | + public static final String ENABLED_SSO = "enabled.sso"; | ||
| 37 | + | ||
| 38 | + public static final String SSO_SYSTEM_CODE = "sso.system.code"; | ||
| 39 | + | ||
| 40 | + public static final String URL_HTTP_SSO_LOGIN = "url.http.sso.login"; | ||
| 41 | + | ||
| 42 | + public static final String URL_HTTP_SSO_LOGOUT = "url.http.sso.logout"; | ||
| 43 | + | ||
| 44 | + public static final String URL_HTTP_SSO_AUTH = "url.http.sso.auth"; | ||
| 45 | + | ||
| 46 | + public static final String URL_HTTP_MAINTENANCE = "url.http.maintenance"; | ||
| 47 | + | ||
| 48 | + public static final String ENABLED_WHITE_IP = "enabled.white.ip"; | ||
| 49 | + | ||
| 50 | + public static final String ENABLED_FILTER_AUTHORITY = "enabled.filter.authority"; | ||
| 51 | + | ||
| 52 | + public static final String URL_HTTP_DVR = "url.http.dvr"; | ||
| 53 | + | ||
| 54 | + public static final String URL_HTTP_DVR_PWD = "url.http.dvr.pwd"; | ||
| 55 | +} |
src/main/java/com/bsth/controller/DvrController.java
0 → 100644
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import com.bsth.common.SystemParamKeys; | ||
| 4 | +import com.bsth.data.SystemParamCache; | ||
| 5 | +import com.bsth.security.util.SecurityUtils; | ||
| 6 | +import com.bsth.util.WebserviceSign; | ||
| 7 | +import org.slf4j.Logger; | ||
| 8 | +import org.slf4j.LoggerFactory; | ||
| 9 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 12 | +import org.springframework.web.bind.annotation.RestController; | ||
| 13 | + | ||
| 14 | +import javax.servlet.http.HttpServletResponse; | ||
| 15 | +import java.io.IOException; | ||
| 16 | +import java.util.HashMap; | ||
| 17 | +import java.util.Map; | ||
| 18 | + | ||
| 19 | +@RestController | ||
| 20 | +@RequestMapping("dvr") | ||
| 21 | +public class DvrController { | ||
| 22 | + | ||
| 23 | + private final static Logger log = LoggerFactory.getLogger(DvrController.class); | ||
| 24 | + | ||
| 25 | + @RequestMapping(value = "/{deviceId}/redirect", method = RequestMethod.GET) | ||
| 26 | + public void redirect(@PathVariable("deviceId") String deviceId, HttpServletResponse response) { | ||
| 27 | + try { | ||
| 28 | + String url = SystemParamCache.getUrlHttpDvr(), password = SystemParamCache.getUrlHttpDvrPwd(), nonce = WebserviceSign.getRandomString(5); | ||
| 29 | + String userName = SecurityUtils.getCurrentUser().getJobCode(), timestamp = String.valueOf(System.currentTimeMillis()); | ||
| 30 | + Map<String, String> params = new HashMap<>(); | ||
| 31 | + params.put("timestamp", timestamp); | ||
| 32 | + params.put("nonce", nonce); | ||
| 33 | + params.put("password", password); | ||
| 34 | + params.put("username", userName); | ||
| 35 | + String sign = WebserviceSign.getSHA1(params); | ||
| 36 | + url = String.format(url, timestamp, nonce, password, userName, sign, deviceId); | ||
| 37 | + log.error("dvr url: {}", url); | ||
| 38 | + | ||
| 39 | + response.sendRedirect(url); | ||
| 40 | + } catch (IOException e) { | ||
| 41 | + throw new RuntimeException(e); | ||
| 42 | + } catch (Exception e) { | ||
| 43 | + throw new RuntimeException(e); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | +} |
src/main/java/com/bsth/data/SystemParamCache.java
| 1 | -package com.bsth.data; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.SystemParamKeys; | ||
| 4 | -import com.bsth.service.SystemParamService; | ||
| 5 | -import org.springframework.beans.factory.InitializingBean; | ||
| 6 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | -import org.springframework.stereotype.Component; | ||
| 8 | - | ||
| 9 | -/** | ||
| 10 | - * @author Hill | ||
| 11 | - */ | ||
| 12 | -@Component | ||
| 13 | -public class SystemParamCache implements InitializingBean { | ||
| 14 | - | ||
| 15 | - @Autowired | ||
| 16 | - private SystemParamService systemParamService; | ||
| 17 | - | ||
| 18 | - private static SystemParamService systemParamService1; | ||
| 19 | - | ||
| 20 | - public static String getSpecialRoles() { | ||
| 21 | - return systemParamService1.getValue(SystemParamKeys.SPECIAL_ROLES); | ||
| 22 | - } | ||
| 23 | - | ||
| 24 | - public static String getSpecialDays() { | ||
| 25 | - return systemParamService1.getValue(SystemParamKeys.SPECIAL_DAYS); | ||
| 26 | - } | ||
| 27 | - | ||
| 28 | - public static String getUrlHttpGpsRealCache() { | ||
| 29 | - return systemParamService1.getValue(SystemParamKeys.URL_HTTP_GPS_REAL_CACHE); | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | - public static String getUrlHttpGpsReal() { | ||
| 33 | - return systemParamService1.getValue(SystemParamKeys.URL_HTTP_GPS_REAL); | ||
| 34 | - } | ||
| 35 | - | ||
| 36 | - public static String getUrlHttpDirective() { | ||
| 37 | - return systemParamService1.getValue(SystemParamKeys.URL_HTTP_DIRECTIVE); | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - public static String getUrlHttpRfid() { | ||
| 41 | - return systemParamService1.getValue(SystemParamKeys.URL_HTTP_RFID); | ||
| 42 | - } | ||
| 43 | - | ||
| 44 | - public static String getUrlHttpReport(String param) { | ||
| 45 | - return systemParamService1.getValue(String.format(SystemParamKeys.URL_HTTP_REPORT, param)); | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - public static String getUrlHttpTicketing() { | ||
| 49 | - return systemParamService1.getValue(SystemParamKeys.URL_HTTP_TICKETING); | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - public static String getUrlHttpDsmAck() { | ||
| 53 | - return systemParamService1.getValue(SystemParamKeys.URL_HTTP_DSM_ACK); | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - public static String getUrlHttpCpAck() { | ||
| 57 | - return systemParamService1.getValue(SystemParamKeys.URL_HTTP_CP_ACK); | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - public static String getMailAdmin() { | ||
| 61 | - return systemParamService1.getValue(SystemParamKeys.MAIL_ADMIN); | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | - public static String getMailWaybill() { | ||
| 65 | - return systemParamService1.getValue(SystemParamKeys.MAIL_WAYBILL); | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - public static boolean getEnabledFirstLastGeneration() { | ||
| 69 | - return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_FIRST_LAST_GENERATION)); | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - public static boolean getEnabledFilterSqlInjection() { | ||
| 73 | - return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_FILTER_SQL_INJECTION)); | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - public static boolean getEnabledSso() { | ||
| 77 | - return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_SSO)); | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - public static String getSsoSystemCode() { | ||
| 81 | - return systemParamService1.getValue(SystemParamKeys.SSO_SYSTEM_CODE); | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - public static String getUrlHttpSsoLogin() { | ||
| 85 | - return systemParamService1.getValue(SystemParamKeys.URL_HTTP_SSO_LOGIN); | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - public static String getUrlHttpSsoLogout() { | ||
| 89 | - return systemParamService1.getValue(SystemParamKeys.URL_HTTP_SSO_LOGOUT); | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - public static String getUrlHttpSsoAuth() { | ||
| 93 | - return systemParamService1.getValue(SystemParamKeys.URL_HTTP_SSO_AUTH); | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | - public static String getUrlHttpMaintenance() { | ||
| 97 | - return systemParamService1.getValue(SystemParamKeys.URL_HTTP_MAINTENANCE); | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - public static boolean getEnabledWhiteIp() { | ||
| 101 | - return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_WHITE_IP)); | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - public static boolean getEnableFilterAuthority() { | ||
| 105 | - return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_FILTER_AUTHORITY)); | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | - @Override | ||
| 109 | - public void afterPropertiesSet() throws Exception { | ||
| 110 | - systemParamService1 = systemParamService; | ||
| 111 | - systemParamService1.refresh(); | ||
| 112 | - } | ||
| 113 | -} | 1 | +package com.bsth.data; |
| 2 | + | ||
| 3 | +import com.bsth.common.SystemParamKeys; | ||
| 4 | +import com.bsth.service.SystemParamService; | ||
| 5 | +import org.springframework.beans.factory.InitializingBean; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.stereotype.Component; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @author Hill | ||
| 11 | + */ | ||
| 12 | +@Component | ||
| 13 | +public class SystemParamCache implements InitializingBean { | ||
| 14 | + | ||
| 15 | + @Autowired | ||
| 16 | + private SystemParamService systemParamService; | ||
| 17 | + | ||
| 18 | + private static SystemParamService systemParamService1; | ||
| 19 | + | ||
| 20 | + public static String getSpecialRoles() { | ||
| 21 | + return systemParamService1.getValue(SystemParamKeys.SPECIAL_ROLES); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + public static String getSpecialDays() { | ||
| 25 | + return systemParamService1.getValue(SystemParamKeys.SPECIAL_DAYS); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public static String getUrlHttpGpsRealCache() { | ||
| 29 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_GPS_REAL_CACHE); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public static String getUrlHttpGpsReal() { | ||
| 33 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_GPS_REAL); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public static String getUrlHttpDirective() { | ||
| 37 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_DIRECTIVE); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public static String getUrlHttpRfid() { | ||
| 41 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_RFID); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public static String getUrlHttpReport(String param) { | ||
| 45 | + return systemParamService1.getValue(String.format(SystemParamKeys.URL_HTTP_REPORT, param)); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public static String getUrlHttpTicketing() { | ||
| 49 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_TICKETING); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public static String getUrlHttpDsmAck() { | ||
| 53 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_DSM_ACK); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + public static String getUrlHttpCpAck() { | ||
| 57 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_CP_ACK); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + public static String getMailAdmin() { | ||
| 61 | + return systemParamService1.getValue(SystemParamKeys.MAIL_ADMIN); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + public static String getMailWaybill() { | ||
| 65 | + return systemParamService1.getValue(SystemParamKeys.MAIL_WAYBILL); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + public static boolean getEnabledFirstLastGeneration() { | ||
| 69 | + return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_FIRST_LAST_GENERATION)); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public static boolean getEnabledFilterSqlInjection() { | ||
| 73 | + return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_FILTER_SQL_INJECTION)); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public static boolean getEnabledSso() { | ||
| 77 | + return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_SSO)); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public static String getSsoSystemCode() { | ||
| 81 | + return systemParamService1.getValue(SystemParamKeys.SSO_SYSTEM_CODE); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public static String getUrlHttpSsoLogin() { | ||
| 85 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_SSO_LOGIN); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public static String getUrlHttpSsoLogout() { | ||
| 89 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_SSO_LOGOUT); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public static String getUrlHttpSsoAuth() { | ||
| 93 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_SSO_AUTH); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public static String getUrlHttpMaintenance() { | ||
| 97 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_MAINTENANCE); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public static boolean getEnabledWhiteIp() { | ||
| 101 | + return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_WHITE_IP)); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public static boolean getEnableFilterAuthority() { | ||
| 105 | + return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_FILTER_AUTHORITY)); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + public static String getUrlHttpDvr() { | ||
| 109 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_DVR); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public static String getUrlHttpDvrPwd() { | ||
| 113 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_DVR_PWD); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + @Override | ||
| 117 | + public void afterPropertiesSet() throws Exception { | ||
| 118 | + systemParamService1 = systemParamService; | ||
| 119 | + systemParamService1.refresh(); | ||
| 120 | + } | ||
| 121 | +} |
src/main/java/com/bsth/filter/AccessLogFilter.java
| 1 | -package com.bsth.filter; | ||
| 2 | - | ||
| 3 | -import com.alibaba.fastjson.JSON; | ||
| 4 | -import com.bsth.entity.sys.SysUser; | ||
| 5 | -import com.bsth.security.util.SecurityUtils; | ||
| 6 | -import com.bsth.util.IpUtils; | ||
| 7 | -import com.google.common.collect.Lists; | ||
| 8 | -import com.google.common.collect.Maps; | ||
| 9 | -import org.slf4j.Logger; | ||
| 10 | -import org.slf4j.LoggerFactory; | ||
| 11 | -import org.springframework.stereotype.Component; | ||
| 12 | - | ||
| 13 | -import javax.servlet.FilterChain; | ||
| 14 | -import javax.servlet.ServletException; | ||
| 15 | -import javax.servlet.http.HttpServletRequest; | ||
| 16 | -import javax.servlet.http.HttpServletResponse; | ||
| 17 | -import java.io.IOException; | ||
| 18 | -import java.util.Enumeration; | ||
| 19 | -import java.util.List; | ||
| 20 | -import java.util.Map; | ||
| 21 | - | ||
| 22 | -/** | ||
| 23 | - * | ||
| 24 | - * @ClassName: AccessLogFilter | ||
| 25 | - * @Description: TODO(记录访问日志) | ||
| 26 | - * @author PanZhao | ||
| 27 | - * @date 2016年3月17日 下午4:28:31 | ||
| 28 | - * | ||
| 29 | - */ | ||
| 30 | -@Component | ||
| 31 | -public class AccessLogFilter extends BaseFilter { | ||
| 32 | - | ||
| 33 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 34 | - | ||
| 35 | - @Override | ||
| 36 | - public void doFilter(HttpServletRequest request, | ||
| 37 | - HttpServletResponse response, FilterChain chain) | ||
| 38 | - throws IOException, ServletException { | ||
| 39 | - | ||
| 40 | - response.setHeader("Referrer-Policy", "strict-origin-when-cross-origin"); | ||
| 41 | - response.setHeader("Content-Security-Policy", "script-src * 'unsafe-inline' 'unsafe-eval'"); | ||
| 42 | - response.setHeader("X-Download-Options", "noopen"); | ||
| 43 | - response.setHeader("X-Permitted-Cross-Domain-Policies", "none"); | ||
| 44 | - response.setHeader("X-Frame-Options", "sameorigin"); | ||
| 45 | - SysUser user = null; | ||
| 46 | - if (request.getParameter("token") != null) { | ||
| 47 | - user = new SysUser(); | ||
| 48 | - user.setUserName("admin"); | ||
| 49 | - } else { | ||
| 50 | - user = SecurityUtils.getCurrentUser(); | ||
| 51 | - } | ||
| 52 | - String username = user.getUserName(); | ||
| 53 | - String name = user.getName(); | ||
| 54 | - String jsessionId = request.getRequestedSessionId(); | ||
| 55 | - String ip = IpUtils.getIpAddr(request); | ||
| 56 | - String userAgent = request.getHeader("User-Agent"); | ||
| 57 | - String url = request.getRequestURI(); | ||
| 58 | - String params = getParams(request); | ||
| 59 | - String headers = getHeaders(request); | ||
| 60 | - String method = request.getMethod(); | ||
| 61 | - | ||
| 62 | - StringBuilder s = new StringBuilder(); | ||
| 63 | - s.append(getBlock(username + " -" + name)); | ||
| 64 | - s.append(getBlock(jsessionId)); | ||
| 65 | - s.append(getBlock(ip)); | ||
| 66 | - s.append(getBlock(userAgent)); | ||
| 67 | - s.append(getBlock(url)); | ||
| 68 | - s.append(getBlock(method)); | ||
| 69 | - s.append(getBlock(params)); | ||
| 70 | - s.append(getBlock(headers)); | ||
| 71 | - s.append(getBlock(request.getHeader("Referer"))); | ||
| 72 | - | ||
| 73 | - long now = System.currentTimeMillis(); | ||
| 74 | - chain.doFilter(request, response); | ||
| 75 | - s.append("<cost time:").append(System.currentTimeMillis() - now).append(">"); | ||
| 76 | - logger.info(s.toString()); | ||
| 77 | - } | ||
| 78 | - | ||
| 79 | - private static String getParams(HttpServletRequest request) { | ||
| 80 | - Map<String, String[]> params = request.getParameterMap(); | ||
| 81 | - return JSON.toJSONString(params); | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - private static String getHeaders(HttpServletRequest request) { | ||
| 85 | - Map<String, List<String>> headers = Maps.newHashMap(); | ||
| 86 | - Enumeration<String> namesEnumeration = request.getHeaderNames(); | ||
| 87 | - while (namesEnumeration.hasMoreElements()) { | ||
| 88 | - String name = namesEnumeration.nextElement(); | ||
| 89 | - Enumeration<String> valueEnumeration = request.getHeaders(name); | ||
| 90 | - List<String> values = Lists.newArrayList(); | ||
| 91 | - while (valueEnumeration.hasMoreElements()) { | ||
| 92 | - values.add(valueEnumeration.nextElement()); | ||
| 93 | - } | ||
| 94 | - headers.put(name, values); | ||
| 95 | - } | ||
| 96 | - return JSON.toJSONString(headers); | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - public static String getBlock(Object msg) { | ||
| 100 | - if (msg == null) { | ||
| 101 | - msg = ""; | ||
| 102 | - } | ||
| 103 | - return "[" + msg.toString() + "]"; | ||
| 104 | - } | ||
| 105 | -} | 1 | +package com.bsth.filter; |
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.bsth.entity.sys.SysUser; | ||
| 5 | +import com.bsth.security.util.SecurityUtils; | ||
| 6 | +import com.bsth.util.IpUtils; | ||
| 7 | +import com.google.common.collect.Lists; | ||
| 8 | +import com.google.common.collect.Maps; | ||
| 9 | +import org.slf4j.Logger; | ||
| 10 | +import org.slf4j.LoggerFactory; | ||
| 11 | +import org.springframework.stereotype.Component; | ||
| 12 | + | ||
| 13 | +import javax.servlet.FilterChain; | ||
| 14 | +import javax.servlet.ServletException; | ||
| 15 | +import javax.servlet.http.HttpServletRequest; | ||
| 16 | +import javax.servlet.http.HttpServletResponse; | ||
| 17 | +import java.io.IOException; | ||
| 18 | +import java.util.Enumeration; | ||
| 19 | +import java.util.List; | ||
| 20 | +import java.util.Map; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * | ||
| 24 | + * @ClassName: AccessLogFilter | ||
| 25 | + * @Description: TODO(记录访问日志) | ||
| 26 | + * @author PanZhao | ||
| 27 | + * @date 2016年3月17日 下午4:28:31 | ||
| 28 | + * | ||
| 29 | + */ | ||
| 30 | +@Component | ||
| 31 | +public class AccessLogFilter extends BaseFilter { | ||
| 32 | + | ||
| 33 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public void doFilter(HttpServletRequest request, | ||
| 37 | + HttpServletResponse response, FilterChain chain) | ||
| 38 | + throws IOException, ServletException { | ||
| 39 | + | ||
| 40 | + response.setHeader("Referrer-Policy", "strict-origin-when-cross-origin"); | ||
| 41 | + //response.setHeader("Content-Security-Policy", "script-src * 'unsafe-inline' 'unsafe-eval'"); | ||
| 42 | + response.setHeader("X-Download-Options", "noopen"); | ||
| 43 | + response.setHeader("X-Permitted-Cross-Domain-Policies", "none"); | ||
| 44 | + response.setHeader("X-Frame-Options", "sameorigin"); | ||
| 45 | + SysUser user = null; | ||
| 46 | + if (request.getParameter("token") != null) { | ||
| 47 | + user = new SysUser(); | ||
| 48 | + user.setUserName("admin"); | ||
| 49 | + } else { | ||
| 50 | + user = SecurityUtils.getCurrentUser(); | ||
| 51 | + } | ||
| 52 | + String username = user.getUserName(); | ||
| 53 | + String name = user.getName(); | ||
| 54 | + String jsessionId = request.getRequestedSessionId(); | ||
| 55 | + String ip = IpUtils.getIpAddr(request); | ||
| 56 | + String userAgent = request.getHeader("User-Agent"); | ||
| 57 | + String url = request.getRequestURI(); | ||
| 58 | + String params = getParams(request); | ||
| 59 | + String headers = getHeaders(request); | ||
| 60 | + String method = request.getMethod(); | ||
| 61 | + | ||
| 62 | + StringBuilder s = new StringBuilder(); | ||
| 63 | + s.append(getBlock(username + " -" + name)); | ||
| 64 | + s.append(getBlock(jsessionId)); | ||
| 65 | + s.append(getBlock(ip)); | ||
| 66 | + s.append(getBlock(userAgent)); | ||
| 67 | + s.append(getBlock(url)); | ||
| 68 | + s.append(getBlock(method)); | ||
| 69 | + s.append(getBlock(params)); | ||
| 70 | + s.append(getBlock(headers)); | ||
| 71 | + s.append(getBlock(request.getHeader("Referer"))); | ||
| 72 | + | ||
| 73 | + long now = System.currentTimeMillis(); | ||
| 74 | + chain.doFilter(request, response); | ||
| 75 | + s.append("<cost time:").append(System.currentTimeMillis() - now).append(">"); | ||
| 76 | + logger.info(s.toString()); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + private static String getParams(HttpServletRequest request) { | ||
| 80 | + Map<String, String[]> params = request.getParameterMap(); | ||
| 81 | + return JSON.toJSONString(params); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + private static String getHeaders(HttpServletRequest request) { | ||
| 85 | + Map<String, List<String>> headers = Maps.newHashMap(); | ||
| 86 | + Enumeration<String> namesEnumeration = request.getHeaderNames(); | ||
| 87 | + while (namesEnumeration.hasMoreElements()) { | ||
| 88 | + String name = namesEnumeration.nextElement(); | ||
| 89 | + Enumeration<String> valueEnumeration = request.getHeaders(name); | ||
| 90 | + List<String> values = Lists.newArrayList(); | ||
| 91 | + while (valueEnumeration.hasMoreElements()) { | ||
| 92 | + values.add(valueEnumeration.nextElement()); | ||
| 93 | + } | ||
| 94 | + headers.put(name, values); | ||
| 95 | + } | ||
| 96 | + return JSON.toJSONString(headers); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public static String getBlock(Object msg) { | ||
| 100 | + if (msg == null) { | ||
| 101 | + msg = ""; | ||
| 102 | + } | ||
| 103 | + return "[" + msg.toString() + "]"; | ||
| 104 | + } | ||
| 105 | +} |
src/main/java/com/bsth/service/gps/entity/GpsOutbound_DTO.java
| 1 | -package com.bsth.service.gps.entity; | ||
| 2 | - | ||
| 3 | -import com.alibaba.fastjson.JSON; | ||
| 4 | -import com.alibaba.fastjson.JSONObject; | ||
| 5 | -import com.bsth.data.BasicData; | ||
| 6 | - | ||
| 7 | -import java.util.*; | ||
| 8 | - | ||
| 9 | -/** | ||
| 10 | - * 越界异常 dto | ||
| 11 | - * Created by panzhao on 2017/4/7. | ||
| 12 | - */ | ||
| 13 | -public class GpsOutbound_DTO { | ||
| 14 | - | ||
| 15 | - public static List<GpsOutbound_DTO> create(List<Map<String, Object>> mapList){ | ||
| 16 | - //默认都是一辆车的数据 | ||
| 17 | - List<GpsOutbound> list = JSONObject.parseArray(JSON.toJSONString(mapList), GpsOutbound.class); | ||
| 18 | - GpsOutbound outbound; | ||
| 19 | - | ||
| 20 | - //排序 | ||
| 21 | - Collections.sort(list, new Comparator<GpsOutbound>() { | ||
| 22 | - @Override | ||
| 23 | - public int compare(GpsOutbound o1, GpsOutbound o2) { | ||
| 24 | - return (int) (o1.getTimestamp() - o2.getTimestamp()); | ||
| 25 | - } | ||
| 26 | - }); | ||
| 27 | - | ||
| 28 | - int space = 1000 * 60; | ||
| 29 | - int size = list.size(); | ||
| 30 | - StringBuffer locations = new StringBuffer(""); | ||
| 31 | - | ||
| 32 | - List<GpsOutbound_DTO> rsList = new ArrayList<>(); | ||
| 33 | - GpsOutbound_DTO dto = null; | ||
| 34 | - | ||
| 35 | - for(int i = 0; i < size; i++){ | ||
| 36 | - outbound = list.get(i); | ||
| 37 | - locations.append(outbound.location() + ";"); | ||
| 38 | - if(dto == null){ | ||
| 39 | - dto = new GpsOutbound_DTO(); | ||
| 40 | - dto.setDeviceId(outbound.getVehicle()); | ||
| 41 | - dto.setNbbm(BasicData.deviceId2NbbmMap.get(outbound.getVehicle())); | ||
| 42 | - dto.setSt(outbound.getTimestamp()); | ||
| 43 | - } | ||
| 44 | - else{ | ||
| 45 | - //越界结束 | ||
| 46 | - if((i < size - 1 && list.get(i + 1).getTimestamp() - outbound.getTimestamp() > space)){ | ||
| 47 | - dto.setEt(outbound.getTimestamp()); | ||
| 48 | - dto.setLocations(locations.toString()); | ||
| 49 | - | ||
| 50 | - rsList.add(dto); | ||
| 51 | - dto = null; | ||
| 52 | - locations = new StringBuffer(""); | ||
| 53 | - continue; | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - if(i == size - 1) | ||
| 57 | - rsList.add(dto); | ||
| 58 | - } | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - return rsList; | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | - /** | ||
| 65 | - * 设备号 | ||
| 66 | - */ | ||
| 67 | - private String deviceId; | ||
| 68 | - | ||
| 69 | - /** | ||
| 70 | - * 自编号 | ||
| 71 | - */ | ||
| 72 | - private String nbbm; | ||
| 73 | - | ||
| 74 | - /** | ||
| 75 | - * 越界开始时间 | ||
| 76 | - */ | ||
| 77 | - private long st; | ||
| 78 | - | ||
| 79 | - /** | ||
| 80 | - * 越界结束时间 | ||
| 81 | - */ | ||
| 82 | - private long et; | ||
| 83 | - | ||
| 84 | - /** | ||
| 85 | - * 越界点位集合 | ||
| 86 | - */ | ||
| 87 | - private String locations; | ||
| 88 | - | ||
| 89 | - /** | ||
| 90 | - * 所在路段 | ||
| 91 | - */ | ||
| 92 | - private String sectionName; | ||
| 93 | - | ||
| 94 | - private String abnormalType = "outbound"; | ||
| 95 | - | ||
| 96 | - public String getDeviceId() { | ||
| 97 | - return deviceId; | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - public void setDeviceId(String deviceId) { | ||
| 101 | - this.deviceId = deviceId; | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - public String getNbbm() { | ||
| 105 | - return nbbm; | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | - public void setNbbm(String nbbm) { | ||
| 109 | - this.nbbm = nbbm; | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | - public long getSt() { | ||
| 113 | - return st; | ||
| 114 | - } | ||
| 115 | - | ||
| 116 | - public void setSt(long st) { | ||
| 117 | - this.st = st; | ||
| 118 | - } | ||
| 119 | - | ||
| 120 | - public long getEt() { | ||
| 121 | - return et; | ||
| 122 | - } | ||
| 123 | - | ||
| 124 | - public void setEt(long et) { | ||
| 125 | - this.et = et; | ||
| 126 | - } | ||
| 127 | - | ||
| 128 | - public String getLocations() { | ||
| 129 | - return locations; | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - public void setLocations(String locations) { | ||
| 133 | - this.locations = locations; | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | - public String getAbnormalType() { | ||
| 137 | - return abnormalType; | ||
| 138 | - } | ||
| 139 | - | ||
| 140 | - public void setAbnormalType(String abnormalType) { | ||
| 141 | - this.abnormalType = abnormalType; | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | - public String getSectionName() { | ||
| 145 | - return sectionName; | ||
| 146 | - } | ||
| 147 | - | ||
| 148 | - public void setSectionName(String sectionName) { | ||
| 149 | - this.sectionName = sectionName; | ||
| 150 | - } | ||
| 151 | -} | 1 | +package com.bsth.service.gps.entity; |
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.alibaba.fastjson.JSONObject; | ||
| 5 | +import com.bsth.data.BasicData; | ||
| 6 | + | ||
| 7 | +import java.util.*; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 越界异常 dto | ||
| 11 | + * Created by panzhao on 2017/4/7. | ||
| 12 | + */ | ||
| 13 | +public class GpsOutbound_DTO { | ||
| 14 | + | ||
| 15 | + public static List<GpsOutbound_DTO> create(List<Map<String, Object>> mapList){ | ||
| 16 | + //默认都是一辆车的数据 | ||
| 17 | + List<GpsOutbound> list = JSONObject.parseArray(JSON.toJSONString(mapList), GpsOutbound.class); | ||
| 18 | + GpsOutbound outbound; | ||
| 19 | + | ||
| 20 | + //排序 | ||
| 21 | + Collections.sort(list, new Comparator<GpsOutbound>() { | ||
| 22 | + @Override | ||
| 23 | + public int compare(GpsOutbound o1, GpsOutbound o2) { | ||
| 24 | + return (int) (o1.getTimestamp() - o2.getTimestamp()); | ||
| 25 | + } | ||
| 26 | + }); | ||
| 27 | + | ||
| 28 | + int space = 1000 * 10; | ||
| 29 | + int size = list.size(); | ||
| 30 | + StringBuffer locations = new StringBuffer(""); | ||
| 31 | + | ||
| 32 | + List<GpsOutbound_DTO> rsList = new ArrayList<>(); | ||
| 33 | + GpsOutbound_DTO dto = null; | ||
| 34 | + | ||
| 35 | + for(int i = 0; i < size; i++){ | ||
| 36 | + outbound = list.get(i); | ||
| 37 | + locations.append(outbound.location() + ";"); | ||
| 38 | + if(dto == null){ | ||
| 39 | + dto = new GpsOutbound_DTO(); | ||
| 40 | + dto.setDeviceId(outbound.getVehicle()); | ||
| 41 | + dto.setNbbm(BasicData.deviceId2NbbmMap.get(outbound.getVehicle())); | ||
| 42 | + dto.setSt(outbound.getTimestamp()); | ||
| 43 | + } | ||
| 44 | + if (dto != null) { | ||
| 45 | + //越界结束 | ||
| 46 | + if((i < size - 1 && list.get(i + 1).getTimestamp() - outbound.getTimestamp() > space)){ | ||
| 47 | + dto.setEt(outbound.getTimestamp()); | ||
| 48 | + dto.setLocations(locations.toString()); | ||
| 49 | + | ||
| 50 | + rsList.add(dto); | ||
| 51 | + dto = null; | ||
| 52 | + locations = new StringBuffer(""); | ||
| 53 | + continue; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + if(i == size - 1 && dto.getEt() > 0) | ||
| 57 | + rsList.add(dto); | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + return rsList; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * 设备号 | ||
| 66 | + */ | ||
| 67 | + private String deviceId; | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * 自编号 | ||
| 71 | + */ | ||
| 72 | + private String nbbm; | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * 越界开始时间 | ||
| 76 | + */ | ||
| 77 | + private long st; | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * 越界结束时间 | ||
| 81 | + */ | ||
| 82 | + private long et; | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * 越界点位集合 | ||
| 86 | + */ | ||
| 87 | + private String locations; | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * 所在路段 | ||
| 91 | + */ | ||
| 92 | + private String sectionName; | ||
| 93 | + | ||
| 94 | + private String abnormalType = "outbound"; | ||
| 95 | + | ||
| 96 | + public String getDeviceId() { | ||
| 97 | + return deviceId; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public void setDeviceId(String deviceId) { | ||
| 101 | + this.deviceId = deviceId; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public String getNbbm() { | ||
| 105 | + return nbbm; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + public void setNbbm(String nbbm) { | ||
| 109 | + this.nbbm = nbbm; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public long getSt() { | ||
| 113 | + return st; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + public void setSt(long st) { | ||
| 117 | + this.st = st; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public long getEt() { | ||
| 121 | + return et; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + public void setEt(long et) { | ||
| 125 | + this.et = et; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + public String getLocations() { | ||
| 129 | + return locations; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + public void setLocations(String locations) { | ||
| 133 | + this.locations = locations; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + public String getAbnormalType() { | ||
| 137 | + return abnormalType; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + public void setAbnormalType(String abnormalType) { | ||
| 141 | + this.abnormalType = abnormalType; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + public String getSectionName() { | ||
| 145 | + return sectionName; | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + public void setSectionName(String sectionName) { | ||
| 149 | + this.sectionName = sectionName; | ||
| 150 | + } | ||
| 151 | +} |
src/main/java/com/bsth/service/gps/entity/GpsSpeed_DTO.java
| 1 | -package com.bsth.service.gps.entity; | ||
| 2 | - | ||
| 3 | -import com.alibaba.fastjson.JSON; | ||
| 4 | -import com.alibaba.fastjson.JSONObject; | ||
| 5 | -import com.bsth.data.BasicData; | ||
| 6 | - | ||
| 7 | -import java.util.*; | ||
| 8 | - | ||
| 9 | -/** | ||
| 10 | - * 超速异常 dto | ||
| 11 | - * Created by panzhao on 2017/4/7. | ||
| 12 | - */ | ||
| 13 | -public class GpsSpeed_DTO { | ||
| 14 | - | ||
| 15 | - public static List<GpsSpeed_DTO> create(List<Map<String, Object>> mapList){ | ||
| 16 | - //默认都是一辆车的数据 | ||
| 17 | - List<GpsSpeed> list = JSONObject.parseArray(JSON.toJSONString(mapList), GpsSpeed.class); | ||
| 18 | - GpsSpeed gs; | ||
| 19 | - //排序 | ||
| 20 | - Collections.sort(list, new Comparator<GpsSpeed>() { | ||
| 21 | - @Override | ||
| 22 | - public int compare(GpsSpeed o1, GpsSpeed o2) { | ||
| 23 | - return (int) (o1.getTimestamp() - o2.getTimestamp()); | ||
| 24 | - } | ||
| 25 | - }); | ||
| 26 | - | ||
| 27 | - int space = 1000 * 60; | ||
| 28 | - int size = list.size(); | ||
| 29 | - | ||
| 30 | - List<GpsSpeed_DTO> rsList = new ArrayList<>(); | ||
| 31 | - GpsSpeed_DTO dto = null; | ||
| 32 | - | ||
| 33 | - for(int i = 0; i < size; i++){ | ||
| 34 | - gs = list.get(i); | ||
| 35 | - if(dto == null){ | ||
| 36 | - dto = new GpsSpeed_DTO(); | ||
| 37 | - dto.setDeviceId(gs.getVehicle()); | ||
| 38 | - dto.setNbbm(BasicData.deviceId2NbbmMap.get(gs.getVehicle())); | ||
| 39 | - dto.setSt(gs.getTimestamp()); | ||
| 40 | - dto.setSpeed(gs.getSpeed()); | ||
| 41 | - } | ||
| 42 | - else{ | ||
| 43 | - //超速结束 | ||
| 44 | - if((i < size - 1 && list.get(i + 1).getTimestamp() - gs.getTimestamp() > space)){ | ||
| 45 | - dto.setEt(gs.getTimestamp()); | ||
| 46 | - rsList.add(dto); | ||
| 47 | - dto = null; | ||
| 48 | - continue; | ||
| 49 | - } | ||
| 50 | - | ||
| 51 | - //记录最大速度 | ||
| 52 | - if(gs.getSpeed() > dto.getSpeed()) | ||
| 53 | - dto.setSpeed(gs.getSpeed()); | ||
| 54 | - | ||
| 55 | - if(i == size - 1) | ||
| 56 | - rsList.add(dto); | ||
| 57 | - } | ||
| 58 | - } | ||
| 59 | - return rsList; | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - /** | ||
| 63 | - * 设备号 | ||
| 64 | - */ | ||
| 65 | - private String deviceId; | ||
| 66 | - | ||
| 67 | - /** | ||
| 68 | - * 自编号 | ||
| 69 | - */ | ||
| 70 | - private String nbbm; | ||
| 71 | - | ||
| 72 | - /** | ||
| 73 | - * 超速开始时间 | ||
| 74 | - */ | ||
| 75 | - private long st; | ||
| 76 | - | ||
| 77 | - /** | ||
| 78 | - * 超速结束时间 | ||
| 79 | - */ | ||
| 80 | - private long et; | ||
| 81 | - | ||
| 82 | - /** | ||
| 83 | - * 速度 | ||
| 84 | - */ | ||
| 85 | - private float speed; | ||
| 86 | - | ||
| 87 | - /** | ||
| 88 | - * 所在路段 | ||
| 89 | - */ | ||
| 90 | - private String sectionName; | ||
| 91 | - | ||
| 92 | - private String abnormalType = "speed"; | ||
| 93 | - | ||
| 94 | - public String getDeviceId() { | ||
| 95 | - return deviceId; | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | - public void setDeviceId(String deviceId) { | ||
| 99 | - this.deviceId = deviceId; | ||
| 100 | - } | ||
| 101 | - | ||
| 102 | - public String getNbbm() { | ||
| 103 | - return nbbm; | ||
| 104 | - } | ||
| 105 | - | ||
| 106 | - public void setNbbm(String nbbm) { | ||
| 107 | - this.nbbm = nbbm; | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - public long getSt() { | ||
| 111 | - return st; | ||
| 112 | - } | ||
| 113 | - | ||
| 114 | - public void setSt(long st) { | ||
| 115 | - this.st = st; | ||
| 116 | - } | ||
| 117 | - | ||
| 118 | - public long getEt() { | ||
| 119 | - return et; | ||
| 120 | - } | ||
| 121 | - | ||
| 122 | - public void setEt(long et) { | ||
| 123 | - this.et = et; | ||
| 124 | - } | ||
| 125 | - | ||
| 126 | - public float getSpeed() { | ||
| 127 | - return speed; | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - public void setSpeed(float speed) { | ||
| 131 | - this.speed = speed; | ||
| 132 | - } | ||
| 133 | - | ||
| 134 | - public String getAbnormalType() { | ||
| 135 | - return abnormalType; | ||
| 136 | - } | ||
| 137 | - | ||
| 138 | - public void setAbnormalType(String abnormalType) { | ||
| 139 | - this.abnormalType = abnormalType; | ||
| 140 | - } | ||
| 141 | - | ||
| 142 | - public String getSectionName() { | ||
| 143 | - return sectionName; | ||
| 144 | - } | ||
| 145 | - | ||
| 146 | - public void setSectionName(String sectionName) { | ||
| 147 | - this.sectionName = sectionName; | ||
| 148 | - } | ||
| 149 | -} | 1 | +package com.bsth.service.gps.entity; |
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.alibaba.fastjson.JSONObject; | ||
| 5 | +import com.bsth.data.BasicData; | ||
| 6 | + | ||
| 7 | +import java.util.*; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 超速异常 dto | ||
| 11 | + * Created by panzhao on 2017/4/7. | ||
| 12 | + */ | ||
| 13 | +public class GpsSpeed_DTO { | ||
| 14 | + | ||
| 15 | + public static List<GpsSpeed_DTO> create(List<Map<String, Object>> mapList){ | ||
| 16 | + //默认都是一辆车的数据 | ||
| 17 | + List<GpsSpeed> list = JSONObject.parseArray(JSON.toJSONString(mapList), GpsSpeed.class); | ||
| 18 | + GpsSpeed gs; | ||
| 19 | + //排序 | ||
| 20 | + Collections.sort(list, new Comparator<GpsSpeed>() { | ||
| 21 | + @Override | ||
| 22 | + public int compare(GpsSpeed o1, GpsSpeed o2) { | ||
| 23 | + return (int) (o1.getTimestamp() - o2.getTimestamp()); | ||
| 24 | + } | ||
| 25 | + }); | ||
| 26 | + | ||
| 27 | + int space = 1000 * 10; | ||
| 28 | + int size = list.size(); | ||
| 29 | + | ||
| 30 | + List<GpsSpeed_DTO> rsList = new ArrayList<>(); | ||
| 31 | + GpsSpeed_DTO dto = null; | ||
| 32 | + | ||
| 33 | + for(int i = 0; i < size; i++){ | ||
| 34 | + gs = list.get(i); | ||
| 35 | + if(dto == null){ | ||
| 36 | + dto = new GpsSpeed_DTO(); | ||
| 37 | + dto.setDeviceId(gs.getVehicle()); | ||
| 38 | + dto.setNbbm(BasicData.deviceId2NbbmMap.get(gs.getVehicle())); | ||
| 39 | + dto.setSt(gs.getTimestamp()); | ||
| 40 | + dto.setSpeed(gs.getSpeed()); | ||
| 41 | + } | ||
| 42 | + if (dto != null) { | ||
| 43 | + //超速结束 | ||
| 44 | + if((i < size - 1 && list.get(i + 1).getTimestamp() - gs.getTimestamp() > space)){ | ||
| 45 | + dto.setEt(gs.getTimestamp()); | ||
| 46 | + rsList.add(dto); | ||
| 47 | + dto = null; | ||
| 48 | + continue; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + //记录最大速度 | ||
| 52 | + if(gs.getSpeed() > dto.getSpeed()) | ||
| 53 | + dto.setSpeed(gs.getSpeed()); | ||
| 54 | + | ||
| 55 | + if(i == size - 1 && dto.getEt() > 0) | ||
| 56 | + rsList.add(dto); | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + return rsList; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 设备号 | ||
| 64 | + */ | ||
| 65 | + private String deviceId; | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 自编号 | ||
| 69 | + */ | ||
| 70 | + private String nbbm; | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 超速开始时间 | ||
| 74 | + */ | ||
| 75 | + private long st; | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * 超速结束时间 | ||
| 79 | + */ | ||
| 80 | + private long et; | ||
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * 速度 | ||
| 84 | + */ | ||
| 85 | + private float speed; | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * 所在路段 | ||
| 89 | + */ | ||
| 90 | + private String sectionName; | ||
| 91 | + | ||
| 92 | + private String abnormalType = "speed"; | ||
| 93 | + | ||
| 94 | + public String getDeviceId() { | ||
| 95 | + return deviceId; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + public void setDeviceId(String deviceId) { | ||
| 99 | + this.deviceId = deviceId; | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + public String getNbbm() { | ||
| 103 | + return nbbm; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + public void setNbbm(String nbbm) { | ||
| 107 | + this.nbbm = nbbm; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + public long getSt() { | ||
| 111 | + return st; | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + public void setSt(long st) { | ||
| 115 | + this.st = st; | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + public long getEt() { | ||
| 119 | + return et; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + public void setEt(long et) { | ||
| 123 | + this.et = et; | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + public float getSpeed() { | ||
| 127 | + return speed; | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + public void setSpeed(float speed) { | ||
| 131 | + this.speed = speed; | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + public String getAbnormalType() { | ||
| 135 | + return abnormalType; | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + public void setAbnormalType(String abnormalType) { | ||
| 139 | + this.abnormalType = abnormalType; | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + public String getSectionName() { | ||
| 143 | + return sectionName; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + public void setSectionName(String sectionName) { | ||
| 147 | + this.sectionName = sectionName; | ||
| 148 | + } | ||
| 149 | +} |
src/main/java/com/bsth/util/WebserviceSign.java
0 → 100644
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +import java.security.MessageDigest; | ||
| 4 | +import java.util.Arrays; | ||
| 5 | +import java.util.Map; | ||
| 6 | +import java.util.Random; | ||
| 7 | + | ||
| 8 | +public class WebserviceSign { | ||
| 9 | + | ||
| 10 | + /** | ||
| 11 | + * 生成签名 | ||
| 12 | + * @param map | ||
| 13 | + * @return | ||
| 14 | + * @throws Exception | ||
| 15 | + */ | ||
| 16 | + public static String getSHA1(Map<String, String> map) throws Exception { | ||
| 17 | + try { | ||
| 18 | + String[] array = new String[map.size()]; | ||
| 19 | + map.values().toArray(array); | ||
| 20 | + StringBuffer sb = new StringBuffer(); | ||
| 21 | + // 字符串排序 | ||
| 22 | + Arrays.sort(array); | ||
| 23 | + for (int i = 0; i < array.length; i++) { | ||
| 24 | + sb.append(array[i]); | ||
| 25 | + } | ||
| 26 | + String str = sb.toString(); | ||
| 27 | + // SHA1签名生成 | ||
| 28 | + MessageDigest md = MessageDigest.getInstance("SHA-1"); | ||
| 29 | + md.update(str.getBytes()); | ||
| 30 | + byte[] digest = md.digest(); | ||
| 31 | + StringBuffer hexstr = new StringBuffer(); | ||
| 32 | + String shaHex = ""; | ||
| 33 | + for (int i = 0; i < digest.length; i++) { | ||
| 34 | + shaHex = Integer.toHexString(digest[i] & 0xFF); | ||
| 35 | + if (shaHex.length() < 2) { | ||
| 36 | + hexstr.append(0); | ||
| 37 | + } | ||
| 38 | + hexstr.append(shaHex); | ||
| 39 | + } | ||
| 40 | + return hexstr.toString(); | ||
| 41 | + } catch (Exception e) { | ||
| 42 | + throw e; | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 生成签名 | ||
| 48 | + * @param map | ||
| 49 | + * @return | ||
| 50 | + * @throws Exception | ||
| 51 | + */ | ||
| 52 | + public static String getMD5(Map<String, String> map) throws Exception { | ||
| 53 | + try { | ||
| 54 | + String[] array = new String[map.size()]; | ||
| 55 | + map.values().toArray(array); | ||
| 56 | + StringBuffer sb = new StringBuffer(); | ||
| 57 | + // 字符串排序 | ||
| 58 | + //Arrays.sort(array); | ||
| 59 | + array = new String[] {"appoint","apple","{\"isShowCode\":\"0\",\"autoAddCart\":\"0\",\"check\":\"0\",\"skuId\":\"100012043978\",\"type\":\"1\",\"appointMoreTimeFlag\":false,\"mad\":\"0\"}","1644199231241","101"}; | ||
| 60 | + for (int i = 0; i < array.length; i++) { | ||
| 61 | + sb.append(array[i]); | ||
| 62 | + } | ||
| 63 | + String str = sb.toString(); | ||
| 64 | + // SHA1签名生成 | ||
| 65 | + MessageDigest md = MessageDigest.getInstance("MD5"); | ||
| 66 | + md.update(str.getBytes()); | ||
| 67 | + byte[] digest = md.digest(); | ||
| 68 | + StringBuffer hexstr = new StringBuffer(); | ||
| 69 | + String shaHex = ""; | ||
| 70 | + for (int i = 0; i < digest.length; i++) { | ||
| 71 | + shaHex = Integer.toHexString(digest[i] & 0xFF); | ||
| 72 | + if (shaHex.length() < 2) { | ||
| 73 | + hexstr.append(0); | ||
| 74 | + } | ||
| 75 | + hexstr.append(shaHex); | ||
| 76 | + } | ||
| 77 | + return hexstr.toString(); | ||
| 78 | + } catch (Exception e) { | ||
| 79 | + throw e; | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * 生成随机字符串 | ||
| 85 | + * @param length | ||
| 86 | + * @return | ||
| 87 | + */ | ||
| 88 | + public static String getRandomString(int length) { //length表示生成字符串的长度 | ||
| 89 | + String base = "abcdefghijklmnopqrstuvwxyz0123456789"; | ||
| 90 | + Random random = new Random(); | ||
| 91 | + StringBuffer sb = new StringBuffer(); | ||
| 92 | + for (int i = 0; i < length; i++) { | ||
| 93 | + int number = random.nextInt(base.length()); | ||
| 94 | + sb.append(base.charAt(number)); | ||
| 95 | + } | ||
| 96 | + return sb.toString(); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public static void main(String[] args) { | ||
| 100 | + // TODO Auto-generated method stub | ||
| 101 | + | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + | ||
| 105 | +} |
src/main/resources/static/real_control_v2/mapmonitor/fragments/map_infowindow.html
| 1 | -<div> | ||
| 2 | - <script id="map-win-gps-detail-temp" type="text/html"> | ||
| 3 | - <div class="gps_info_win" style="width: 200px;"> | ||
| 4 | - <h4>{{nbbm}}</h4> | ||
| 5 | - <h5> | ||
| 6 | - {{lineName}} | ||
| 7 | - </h5> | ||
| 8 | - <h5> | ||
| 9 | - {{if stationName!=null}} | ||
| 10 | - {{stationName}} 站 | ||
| 11 | - {{else}} | ||
| 12 | - 未知站点 | ||
| 13 | - {{/if}} | ||
| 14 | - </h5> | ||
| 15 | - <p>设备状态: | ||
| 16 | - {{if valid==1}} | ||
| 17 | - invalid(-1 | ||
| 18 | - {{else if abnormalStatus=='outBounds'}} | ||
| 19 | - 越界 | ||
| 20 | - {{else if abnormalStatus=='overspeed'}} | ||
| 21 | - 超速 | ||
| 22 | - {{else if abnormalStatus=='gps-offline'}} | ||
| 23 | - GPS掉线 | ||
| 24 | - {{else if abnormalStatus=='offline'}} | ||
| 25 | - 离线 | ||
| 26 | - {{else}} | ||
| 27 | - . | ||
| 28 | - {{/if}} | ||
| 29 | - </p> | ||
| 30 | - <p>设备号:{{deviceId}}</p> | ||
| 31 | - {{if sch!=null}} | ||
| 32 | - <div> | ||
| 33 | - <span class="field">驾驶员:</span>{{sch.jGh}}/{{sch.jName}} | ||
| 34 | - </div> | ||
| 35 | - {{if sch.mobile!=null && sch.mobile!=""}} | ||
| 36 | - <div> | ||
| 37 | - <span class="field">电话:</span>{{sch.mobile}} | ||
| 38 | - </div> | ||
| 39 | - {{/if}} | ||
| 40 | - {{if sch.sGh!=null && sch.sGh!=""}} | ||
| 41 | - <div> | ||
| 42 | - <span class="field">售票员:</span>{{sch.sGh}}/{{sch.sName}} | ||
| 43 | - </div> | ||
| 44 | - {{/if}} | ||
| 45 | - {{/if}} | ||
| 46 | - <p>速度:{{speed>99?'..':speed}}</p> | ||
| 47 | - <p>角度:{{direction}}</p> | ||
| 48 | - <p>经度:{{lon}}</p> | ||
| 49 | - <p>纬度:{{lat}}</p> | ||
| 50 | - {{if num !=null}} | ||
| 51 | - <p>人数:{{num}}</p> | ||
| 52 | - {{/if}} | ||
| 53 | - {{if num !=null && num <= 5}} | ||
| 54 | - <p>状态:<a href="javascript:;" style="color:green" onclick="javascript:gb_map_play_back.showPhoto('{{photo}}');">舒适</a></p> | ||
| 55 | - {{/if}} | ||
| 56 | - {{if num > 5 && num <= 10}} | ||
| 57 | - <p>状态:<a href="javascript:;" style="color:chocolate" onclick="javascript:gb_map_play_back.showPhoto('{{photo}}');">一般</a></p> | ||
| 58 | - {{/if}} | ||
| 59 | - {{if num > 10}} | ||
| 60 | - <p>状态:<a href="javascript:;" style="color:red" onclick="javascript:gb_map_play_back.showPhoto('{{photo}}');">拥挤</a></p> | ||
| 61 | - {{/if}} | ||
| 62 | - {{if energy == 0}} | ||
| 63 | - <div><span class="field">电量:</span><span style="color: red;">{{energy}}% (异常)</span></div> | ||
| 64 | - {{/if}} | ||
| 65 | - {{if energy > 0}} | ||
| 66 | - <p>电量:{{energy}}%</p> | ||
| 67 | - {{/if}} | ||
| 68 | - <p class="date-str">{{dateStr}}</p> | ||
| 69 | - <hr> | ||
| 70 | - {{if expectStopTime!=null}} | ||
| 71 | - <a href="javascript:;" style="color: #07D;margin-right: 7px;">预计 {{expectStopTime}} 分钟到达终点</a> | ||
| 72 | - {{/if}} | ||
| 73 | - <a href="javascript:;" style="float: left;" onclick="javascript:window.open('http://211.95.61.66:9020/transport_server/dvr_monitor2.html?userid=4&zbh={{nbbm}}');">DVR</a> | ||
| 74 | - {{if dvrcode != null}}<a href="W9:1@139.196.29.203@?method=call&1111:{{dvrcode}}" style="margin-left: 50px;" >拨打电话</a>{{/if}} | ||
| 75 | - <a href="javascript:;" style="float: right;" onclick="javascript:gb_map_play_back.initParams({deviceId: '{{deviceId}}', nbbm: '{{nbbm}}'});">轨迹回放</a> | ||
| 76 | - </div> | ||
| 77 | - </script> | ||
| 78 | - | ||
| 79 | - <script id="map-win-station-detail-temp" type="text/html"> | ||
| 80 | - <div class="gps_info_win"> | ||
| 81 | - <h4>{{stationName}}</h4> | ||
| 82 | - <p>站点编码: {{stationCode}}</p> | ||
| 83 | - <p>站点类型: | ||
| 84 | - {{if stationMark=='B'}} | ||
| 85 | - 起点站 | ||
| 86 | - {{else if stationMark=='E'}} | ||
| 87 | - 终点站 | ||
| 88 | - {{else if stationMark=='Z'}} | ||
| 89 | - 中途站 | ||
| 90 | - {{/if}} | ||
| 91 | - </p> | ||
| 92 | - <p> | ||
| 93 | - 经度: {{lon}} | ||
| 94 | - </p> | ||
| 95 | - <p>纬度: {{lat}}</p> | ||
| 96 | - {{if distances > 0}} | ||
| 97 | - <p>到站距离: {{distances}} 公里</p> | ||
| 98 | - {{/if}} | ||
| 99 | - <p> | ||
| 100 | - 电子围栏类型: | ||
| 101 | - {{if shapesType=='r'}} | ||
| 102 | - 圆形 | ||
| 103 | - {{else if shapesType=='d'}} | ||
| 104 | - 多边形 | ||
| 105 | - {{/if}} | ||
| 106 | - </p> | ||
| 107 | - <p> | ||
| 108 | - {{if shapesType=='r'}} | ||
| 109 | - 半径:{{radius}} | ||
| 110 | - {{else if shapesType=='d'}} | ||
| 111 | - 面积:{{_polygonArea}} 平方米 | ||
| 112 | - {{/if}} | ||
| 113 | - </p> | ||
| 114 | - </div> | ||
| 115 | - </script> | ||
| 116 | - | ||
| 117 | - <script id="map-win-carpark-detail-temp" type="text/html"> | ||
| 118 | - <div class="gps_info_win"> | ||
| 119 | - <h4>{{parkName}}</h4> | ||
| 120 | - <p>停车场编码: {{parkCode}}</p> | ||
| 121 | - <p>面积:{{area}}</p> | ||
| 122 | - <p> | ||
| 123 | - {{if shapesType=='r'}} | ||
| 124 | - 电子围栏半径:{{radius}} | ||
| 125 | - {{else if shapesType=='d'}} | ||
| 126 | - 电子围栏面积:{{_polygonArea}} 平方米 | ||
| 127 | - {{/if}} | ||
| 128 | - </p> | ||
| 129 | - </div> | ||
| 130 | - </script> | 1 | +<div> |
| 2 | + <script id="map-win-gps-detail-temp" type="text/html"> | ||
| 3 | + <div class="gps_info_win" style="width: 200px;"> | ||
| 4 | + <h4>{{nbbm}}</h4> | ||
| 5 | + <h5> | ||
| 6 | + {{lineName}} | ||
| 7 | + </h5> | ||
| 8 | + <h5> | ||
| 9 | + {{if stationName!=null}} | ||
| 10 | + {{stationName}} 站 | ||
| 11 | + {{else}} | ||
| 12 | + 未知站点 | ||
| 13 | + {{/if}} | ||
| 14 | + </h5> | ||
| 15 | + <p>设备状态: | ||
| 16 | + {{if valid==1}} | ||
| 17 | + invalid(-1 | ||
| 18 | + {{else if abnormalStatus=='outBounds'}} | ||
| 19 | + 越界 | ||
| 20 | + {{else if abnormalStatus=='overspeed'}} | ||
| 21 | + 超速 | ||
| 22 | + {{else if abnormalStatus=='gps-offline'}} | ||
| 23 | + GPS掉线 | ||
| 24 | + {{else if abnormalStatus=='offline'}} | ||
| 25 | + 离线 | ||
| 26 | + {{else}} | ||
| 27 | + . | ||
| 28 | + {{/if}} | ||
| 29 | + </p> | ||
| 30 | + <p>设备号:{{deviceId}}</p> | ||
| 31 | + {{if sch!=null}} | ||
| 32 | + <div> | ||
| 33 | + <span class="field">驾驶员:</span>{{sch.jGh}}/{{sch.jName}} | ||
| 34 | + </div> | ||
| 35 | + {{if sch.mobile!=null && sch.mobile!=""}} | ||
| 36 | + <div> | ||
| 37 | + <span class="field">电话:</span>{{sch.mobile}} | ||
| 38 | + </div> | ||
| 39 | + {{/if}} | ||
| 40 | + {{if sch.sGh!=null && sch.sGh!=""}} | ||
| 41 | + <div> | ||
| 42 | + <span class="field">售票员:</span>{{sch.sGh}}/{{sch.sName}} | ||
| 43 | + </div> | ||
| 44 | + {{/if}} | ||
| 45 | + {{/if}} | ||
| 46 | + <p>速度:{{speed>99?'..':speed}}</p> | ||
| 47 | + <p>角度:{{direction}}</p> | ||
| 48 | + <p>经度:{{lon}}</p> | ||
| 49 | + <p>纬度:{{lat}}</p> | ||
| 50 | + {{if num !=null}} | ||
| 51 | + <p>人数:{{num}}</p> | ||
| 52 | + {{/if}} | ||
| 53 | + {{if num !=null && num <= 5}} | ||
| 54 | + <p>状态:<a href="javascript:;" style="color:green" onclick="javascript:gb_map_play_back.showPhoto('{{photo}}');">舒适</a></p> | ||
| 55 | + {{/if}} | ||
| 56 | + {{if num > 5 && num <= 10}} | ||
| 57 | + <p>状态:<a href="javascript:;" style="color:chocolate" onclick="javascript:gb_map_play_back.showPhoto('{{photo}}');">一般</a></p> | ||
| 58 | + {{/if}} | ||
| 59 | + {{if num > 10}} | ||
| 60 | + <p>状态:<a href="javascript:;" style="color:red" onclick="javascript:gb_map_play_back.showPhoto('{{photo}}');">拥挤</a></p> | ||
| 61 | + {{/if}} | ||
| 62 | + {{if energy == 0}} | ||
| 63 | + <div><span class="field">电量:</span><span style="color: red;">{{energy}}% (异常)</span></div> | ||
| 64 | + {{/if}} | ||
| 65 | + {{if energy > 0}} | ||
| 66 | + <p>电量:{{energy}}%</p> | ||
| 67 | + {{/if}} | ||
| 68 | + <p class="date-str">{{dateStr}}</p> | ||
| 69 | + <hr> | ||
| 70 | + {{if expectStopTime!=null}} | ||
| 71 | + <a href="javascript:;" style="color: #07D;margin-right: 7px;">预计 {{expectStopTime}} 分钟到达终点</a> | ||
| 72 | + {{/if}} | ||
| 73 | + <a href="javascript:;" style="float: left;" onclick="javascript:window.open('/dvr/{{deviceId}}/redirect');">DVR</a> | ||
| 74 | + {{if dvrcode != null}}<a href="W9:1@139.196.29.203@?method=call&1111:{{dvrcode}}" style="margin-left: 50px;" >拨打电话</a>{{/if}} | ||
| 75 | + <a href="javascript:;" style="float: right;" onclick="javascript:gb_map_play_back.initParams({deviceId: '{{deviceId}}', nbbm: '{{nbbm}}'});">轨迹回放</a> | ||
| 76 | + </div> | ||
| 77 | + </script> | ||
| 78 | + | ||
| 79 | + <script id="map-win-station-detail-temp" type="text/html"> | ||
| 80 | + <div class="gps_info_win"> | ||
| 81 | + <h4>{{stationName}}</h4> | ||
| 82 | + <p>站点编码: {{stationCode}}</p> | ||
| 83 | + <p>站点类型: | ||
| 84 | + {{if stationMark=='B'}} | ||
| 85 | + 起点站 | ||
| 86 | + {{else if stationMark=='E'}} | ||
| 87 | + 终点站 | ||
| 88 | + {{else if stationMark=='Z'}} | ||
| 89 | + 中途站 | ||
| 90 | + {{/if}} | ||
| 91 | + </p> | ||
| 92 | + <p> | ||
| 93 | + 经度: {{lon}} | ||
| 94 | + </p> | ||
| 95 | + <p>纬度: {{lat}}</p> | ||
| 96 | + {{if distances > 0}} | ||
| 97 | + <p>到站距离: {{distances}} 公里</p> | ||
| 98 | + {{/if}} | ||
| 99 | + <p> | ||
| 100 | + 电子围栏类型: | ||
| 101 | + {{if shapesType=='r'}} | ||
| 102 | + 圆形 | ||
| 103 | + {{else if shapesType=='d'}} | ||
| 104 | + 多边形 | ||
| 105 | + {{/if}} | ||
| 106 | + </p> | ||
| 107 | + <p> | ||
| 108 | + {{if shapesType=='r'}} | ||
| 109 | + 半径:{{radius}} | ||
| 110 | + {{else if shapesType=='d'}} | ||
| 111 | + 面积:{{_polygonArea}} 平方米 | ||
| 112 | + {{/if}} | ||
| 113 | + </p> | ||
| 114 | + </div> | ||
| 115 | + </script> | ||
| 116 | + | ||
| 117 | + <script id="map-win-carpark-detail-temp" type="text/html"> | ||
| 118 | + <div class="gps_info_win"> | ||
| 119 | + <h4>{{parkName}}</h4> | ||
| 120 | + <p>停车场编码: {{parkCode}}</p> | ||
| 121 | + <p>面积:{{area}}</p> | ||
| 122 | + <p> | ||
| 123 | + {{if shapesType=='r'}} | ||
| 124 | + 电子围栏半径:{{radius}} | ||
| 125 | + {{else if shapesType=='d'}} | ||
| 126 | + 电子围栏面积:{{_polygonArea}} 平方米 | ||
| 127 | + {{/if}} | ||
| 128 | + </p> | ||
| 129 | + </div> | ||
| 130 | + </script> | ||
| 131 | </div> | 131 | </div> |
| 132 | \ No newline at end of file | 132 | \ No newline at end of file |