Commit bda42bee775e3b25edb1bb5a5b96bd4181e8c33e
1 parent
73ea71bc
1.DVR外链变更(地址+验证方式)
Showing
5 changed files
with
457 additions
and
294 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 getLineCode(@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/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 | 131 | </div> |
| 132 | 132 | \ No newline at end of file | ... | ... |