21
	public static final String NORM_TIME_PATTERN = "HH:mm:ss";
22
23
	public static final String PURE_DATETIME_PATTERN = "yyyyMMddHHmmss";
24
	public static final String PURE_DATETIME_MS_PATTERN = "yyyyMMddHHmmssSSS";
25
	public static final String PURE_DATE_PATTERN = "yyyyMMdd";
26
	public static final String PURE_TIME_PATTERN = "HHmmss";
27
28
	public static final String EN_DATE_PATTERN = "yyyy/MM/dd";
29
	public static final String EN_DATETIME_PATTERN = "yyyy/MM/dd HH:mm:ss";
30
31
	public static final String CN_DATE_PATTERN = "yyyy年MM月dd日";
32
	public static final String CN_DATETIME_MINUTE_PATTERN = "yyyy年MM月dd日 HH:mm";
33
	public static final String CN_DATETIME_PATTERN = "yyyy年MM月dd日 HH:mm:ss";
34
35
	/**
36
	 * 在原日期加年数
37
	 * @param dateStr
38
	 * @param amount
39
	 * @return yyyy-MM-dd HH:mm:ss
40
	 * @throws Exception 
41
	 */
42
	public static String dateAddYear(String dateStr, int amount) throws Exception {
43
		return dateAdd(dateStr, Calendar.YEAR, amount, NORM_DATETIME_PATTERN);
44
	}
45
46
	/**
47
	 * 在原日期加月数
48
	 * @param dateStr
49
	 * @param amount
50
	 * @return yyyy-MM-dd HH:mm:ss
51
	 * @throws Exception 
52
	 */
53
	public static String dateAddMonth(String dateStr, int amount) throws Exception {
54
		return dateAdd(dateStr, Calendar.MONTH, amount, NORM_DATETIME_PATTERN);
55
	}
56
57
	/**
58
	 * 在原日期加天数
59
	 * @param dateStr
60
	 * @param amount
61
	 * @return yyyy-MM-dd HH:mm:ss
62
	 * @throws Exception 
63
	 */
64
	public static String dateAddDay(String dateStr, int amount) throws Exception {
65
		return dateAdd(dateStr, Calendar.DATE, amount, NORM_DATETIME_PATTERN);
66
	}
67
68
	/**
69
	 * 在原日期加小时数
70
	 * @param dateStr
71
	 * @param amount
72
	 * @return yyyy-MM-dd HH:mm:ss
73
	 * @throws Exception 
74
	 */
75
	public static String dateAddHour(String dateStr, int amount) throws Exception {
76
		return dateAdd(dateStr, Calendar.HOUR, amount, NORM_DATETIME_PATTERN);
77
	}
78
79
	/**
80
	 * 在原日期加分钟数
81
	 * @param dateStr
82
	 * @param amount
83
	 * @return yyyy-MM-dd HH:mm:ss
84
	 * @throws Exception 
85
	 */
86
	public static String dateAddMinute(String dateStr, int amount) throws Exception {
87
		return dateAdd(dateStr, Calendar.MINUTE, amount, NORM_DATETIME_PATTERN);
88
	}
89
90
	/**
91
	 * 在原日期加秒数
92
	 * @param dateStr
93
	 * @param amount
94
	 * @return yyyy-MM-dd HH:mm:ss
95
	 * @throws Exception 
96
	 */
97
	public static String dateAddSecond(String dateStr, int amount) throws Exception {
98
		return dateAdd(dateStr, Calendar.SECOND, amount, NORM_DATETIME_PATTERN);
99
	}
100
101
	/**
102
	 * 在原日期加一段时间间隔
103
	 * @param date 原日期
104
	 * @param field Calendar中的时间类型
105
	 * @param amount 间隔长度
106
	 * @param pattern 返回日期格式
107
	 * @return
108
	 * @throws Exception 
109
	 */
110
	public static String dateAdd(String dateStr, int field, int amount, String pattern) throws Exception {
111
		Date date = convertDate(dateStr);
112
		Date newDate = dateAdd(date, field, amount);
113
		return formatDate(newDate, pattern);
114
	}
115
116
	/**
117
	 * 在原日期加一段时间间隔
118
	 * @param date 原日期
119
	 * @param field Calendar中的时间类型
120
	 * @param amount 间隔长度
121
	 * @param pattern 返回日期格式
122
	 * @return
123
	 */
124
	public static String dateAdd(Date date, int field, int amount, String pattern) {
125
		Date newDate = dateAdd(date, field, amount);
126
		return formatDate(newDate, pattern);
127
	}
128
129
	/**
130
	 * 在原日期加一段时间间隔
131
	 * @param date 原日期
132
	 * @param field Calendar中的时间类型
133
	 * @param amount 间隔长度
134
	 * @return
135
	 * @throws Exception 
136
	 */
137
	public static Date dateAdd(String dateStr, int field, int amount) throws Exception {
138
		Date date = convertDate(dateStr);
139
		return dateAdd(date, field, amount);
140
	}
141
142
	/**
143
	 * 在原日期加一段时间间隔
144
	 * @param date 原日期
145
	 * @param field Calendar中的时间类型
146
	 * @param amount 间隔长度
147
	 * @return
148
	 */
149
	public static Date dateAdd(Date date, int field, int amount) {
150
		Calendar calendar = Calendar.getInstance();
151
		calendar.setTime(date);
152
		calendar.add(field, amount);
153
		return calendar.getTime();
154
	}
155
156
	/**
157
	 * 比较日期大小
158
	 * @param dateStr0
159
	 * @param dateStr1
160
	 * @return dateStr0<dateStr1 ? -1 : (dateStr0==dateStr1 ? 0 : 1)
161
	 * @throws Exception 
162
	 */
163
	public static int compareDate(String dateStr0, String dateStr1) throws Exception {
164
		if (dateStr0 == null || "".equals(dateStr0)) {
165
			if (dateStr1 == null || "".equals(dateStr1)) {
166
				return 0;
167
			} else {
168
				return -1;
169
			}
170
		}
171
172
		if (dateStr1 == null || "".equals(dateStr1)) {
173
			return 1;
174
		}
175
176
		Date date1 = convertDate(dateStr0);
177
		Date date2 = convertDate(dateStr1);
178
		int result = date1.compareTo(date2);
179
		return result;
180
	}
181
182
	/**
183
	 * 格式化字符串时间
184
	 * @param date
185
	 * @return yyyy-MM-dd HH:mm:ss
186
	 * @throws Exception 
187
	 */
188
	public static String formatStrDate(String dateStr) throws Exception {
189
		Date date = convertDate(dateStr);
190
		return formatDate(date, DateUtil.NORM_DATETIME_PATTERN);
191
	}
192
193
	/**
194
	 * 时间转字符串 
195
	 * @param date
196
	 * @return yyyy-MM-dd HH:mm:ss
197
	 */
198
	public static String formatDate(Date date) {
199
		return formatDate(date, DateUtil.NORM_DATETIME_PATTERN);
200
	}
201
202
	/**
203
	 * 时间转指定格式字符串
204
	 * @param date
205
	 * @param pattern 输出的时间格式
206
	 * @return
207
	 */
208
	public static String formatDate(Date date, String pattern) {
209
		if (date == null) {
210
			return "";
211
		}
212
213
		SimpleDateFormat formatter = new SimpleDateFormat(pattern);
214
		return formatter.format(date);
215
	}
216
217
	/**
218
	 * 时间戳转字符串 
219
	 * @param date
220
	 * @return yyyy-MM-dd HH:mm:ss
221
	 */
222
	public static String formatDate(long timestamp) {
223
		return formatDate(timestamp, DateUtil.NORM_DATETIME_PATTERN);
224
	}
225
226
	/**
227
	 * 时间戳转指定格式字符串
228
	 * @param date
229
	 * @param pattern 输出的时间格式
230
	 * @return
231
	 */
232
	public static String formatDate(long timestamp, String pattern) {
233
		Date date = new Date(timestamp);
234
		SimpleDateFormat formatter = new SimpleDateFormat(pattern);
235
		return formatter.format(date);
236
	}
237
238
	/**
239
	 * 字符串转时间
240
	 * @param dateStr
241
	 * @return
242
	 * @throws Exception 
243
	 */
244
	public static Date convertDate(String dateStr) throws Exception {
245
		if (dateStr == null || "".equals(dateStr)) {
246
			return null;
247
		}
248
249
		String pattern = getTimestampFormat(dateStr);
250
		return convertDate(dateStr, pattern);
251
	}
252
253
	/**
254
	 * 字符串转时间
255
	 * @param dateStr
256
	 * @param pattern 字符串时间格式
257
	 * @return
258
	 * @throws Exception 
259
	 */
260
	public static Date convertDate(String dateStr, String pattern) throws Exception {
261
		if (dateStr == null || "".equals(dateStr)) {
262
			return null;
263
		}
264
265
		if (pattern == null || "".equals(pattern)) {
266
			pattern = getTimestampFormat(dateStr);
267
		}
268
269
		SimpleDateFormat formatter = new SimpleDateFormat(pattern);
270
		Date date = formatter.parse(dateStr);
271
		return date;
272
	}
273
274
	/**
275
	 * 计算两个时间差,返回毫秒数(endDate-beginDate)
276
	 * @param beginDate
277
	 * @param endDate
278
	 * @return 
279
	 * @throws ParseException
280
	 */
281
	public static long getDifferenceMillisecond(Date beginDate, Date endDate) throws ParseException {
282
		long beginDateLong = 0L;
283
		long endDateLong = 0L;
284
		if (beginDate != null) {
285
			beginDateLong = beginDate.getTime();
286
		}
287
		if (endDate != null) {
288
			endDateLong = endDate.getTime();
289
		}
290
291
		return endDateLong - beginDateLong;
292
	}
293
294
	/**
295
	 * 计算两个时间差,返回毫秒数(endDate-beginDate)
296
	 * @param beginDateStr
297
	 * @param endDateStr
298
	 * @return 
299
	 * @throws Exception 
300
	 */
301
	public static long getDifferenceMillisecond(String beginDateStr, String endDateStr) throws Exception {
302
		Date beginDate = convertDate(beginDateStr);
303
		Date endDate = convertDate(endDateStr);
304
		return getDifferenceMillisecond(beginDate, endDate);
305
	}
306
307
	/**
308
	 * 计算两个时间差,返回分钟数(endDate-beginDate)
309
	 * @param beginDate
310
	 * @param endDate
311
	 * @return
312
	 * @throws Exception 
313
	 */
314
	public static int getDifferenceMinute(String beginDateStr, String endDateStr) throws Exception {
315
		long diffMillisecond = getDifferenceMillisecond(beginDateStr, endDateStr);
316
		if (diffMillisecond > 0) {
317
			BigDecimal diffMillisecondBigDecimal = new BigDecimal(diffMillisecond);
318
			// 单位为分,四舍五入不保留小数
319
			BigDecimal diffMinuteBigDecimal = diffMillisecondBigDecimal.divide(new BigDecimal("60000"), 0,
320
					BigDecimal.ROUND_HALF_UP);
321
			return diffMinuteBigDecimal.intValue();
322
		} else {
323
			return 0;
324
		}
325
326
	}
327
328
	/**
329
	 * 计算两个时间差,返回字符串
330
	 * @param dateStr1
331
	 * @param dateStr2
332
	 * @return
333
	 * @throws Exception 
334
	 */
335
	public static String getDifferenceString(String dateStr1, String dateStr2) throws Exception {
336
		long diffMillisecond = Math.abs(getDifferenceMillisecond(dateStr1, dateStr2));
337
		return getDifferenceString(diffMillisecond);
338
	}
339
340
	/**
341
	 * 计算两个时间差,返回字符串
342
	 * @param dateLong1
343
	 * @param dateLong2
344
	 * @return
345
	 * @throws Exception 
346
	 */
347
	public static String getDifferenceString(long dateLong1, long dateLong2) throws Exception {
348
		long diffMillisecond = Math.abs(dateLong1 - dateLong2);
349
		return getDifferenceString(diffMillisecond);
350
	}
351
352
	/**
353
	 * 根据时间差,返回字符串(endDate-beginDate)
354
	 * @param diffMillisecond  时间差(毫秒)
355
	 * @return
356
	 * @throws Exception 
357
	 */
358
	public static String getDifferenceString(long diffMillisecond) throws Exception {
359
		if (diffMillisecond <= 60000) {
360
			return "0分钟";
361
		}
362
363
		BigDecimal diffMillisecondBigDecimal = new BigDecimal(diffMillisecond);
364
		BigDecimal diffMinuteBigDecimal = diffMillisecondBigDecimal.divide(new BigDecimal("60000"), 0,
365
				BigDecimal.ROUND_DOWN);
366
		BigDecimal diffHourBigDecimal = diffMinuteBigDecimal.divide(new BigDecimal("60"), 0, BigDecimal.ROUND_DOWN);
367
		BigDecimal diffdayBigDecimal = diffHourBigDecimal.divide(new BigDecimal("24"), 0, BigDecimal.ROUND_DOWN);
368
369
		int diffMinute = diffMinuteBigDecimal.subtract(diffHourBigDecimal.multiply(new BigDecimal("60"))).intValue();
370
		int diffHour = diffHourBigDecimal.subtract(diffdayBigDecimal.multiply(new BigDecimal("24"))).intValue();
371
		int diffDay = diffdayBigDecimal.intValue();
372
373
		StringBuilder diffStr = new StringBuilder();
374
		if (diffDay > 0) {
375
			diffStr.append(diffDay).append("天");
376
		}
377
		if (diffHour > 0) {
378
			diffStr.append(diffHour).append("小时");
379
		}
380
		if (diffMinute > 0) {
381
			diffStr.append(diffMinute).append("分钟");
382
		}
383
384
		return diffStr.toString();
385
	}
386
387
	/**
388
	 * 获取系统时间
389
	 * @param pattern 时间格式
390
	 * @return
391
	 * @throws Exception
392
	 */
393
	public static String getSysDate(String pattern) throws Exception {
394
		return DateFormatUtils.format(System.currentTimeMillis(), pattern);
395
	}
396
397
	/**
398
	 * 获取系统日期
399
	 * @return yyyy-MM-dd
400
	 * @throws Exception
401
	 */
402
	public static String getSysDate() throws Exception {
403
		return getSysDate(NORM_DATE_PATTERN);
404
	}
405
406
	/**
407
	 * 获取系统日期时间
408
	 * @return yyyy-MM-dd HH:mm:ss
409
	 * @throws Exception
410
	 */
411
	public static final String getSysDateTime() throws Exception {
412
		return getSysDate(NORM_DATETIME_PATTERN);
413
	}
414
415
	/**
416
	 * 根据字符串时间获取对应的时间格式
417
	 * @param value
418
	 * @return
419
	 * @throws Exception
420
	 */
421
	@SuppressWarnings("unused")
422
	public static final String getTimestampFormat(String value) throws Exception {
423
		String format = null;
424
		switch (value.length()) {
425
		case 4:
426
			format = "yyyy";
427
			break;
428
		case 6:
429
			format = "yyyyMM";
430
			break;
431
		case 7:
432
			format = "yyyy-MM";
433
			break;
434
		case 8:
435
			format = "yyyyMMdd";
436
			break;
437
		case 10:
438
			format = "yyyy-MM-dd";
439
			break;
440
		case 13:
441
			format = "yyyy-MM-dd HH";
442
			break;
443
		case 14:
444
			format = "yyyyMMddHHmmss";
445
			break;
446
		case 15:
447
			format = "yyyyMMddHHmmssS";
448
			break;
449
		case 16:
450
			format = "yyyy-MM-dd HH:mm";
451
			break;
452
		case 19:
453
			format = "yyyy-MM-dd HH:mm:ss";
454
			break;
455
		case 21:
456
			format = "yyyy-MM-dd HH:mm:ss.S";
457
			break;
458
		default:
459
			throw new NullPointerException();
460
		}
461
462
		if (format == null) {
463
			new Exception("无法解析正确的日期格式[" + value + "]");
464
		}
465
		return format;
466
	}
467
468
}

+ 153 - 0
ebc-sea-platform/src/main/java/com/ai/bss/location/rescue/util/EbcConstant.java

@ -0,0 +1,153 @@
1
package com.ai.bss.location.rescue.util;
2
3
/**
4
 * 业务常量
5
 * @author konghl@asiainfo.com
6
 * 2020-10-20
7
 */
8
public class EbcConstant {
9
	// 下拉列表最大查询条数
10
	public static final int COMBOBOX_MAXNUM = 30;
11
12
	// 每页默认查询条数
13
	public static final int DEFAULT_PAGE_SIZE = 20;
14
	
15
	// 轨迹回放单次查询条数
16
	public static final int TRACK_PLAYBACK_SIZE = 100;
17
18
	// 终端的名称前缀
19
	public static final String BEIDOUDEVICE_NAME = "康派北斗 - ";
20
21
	// 全部终端(已关联和未关联)
22
	public static final String BIND_DEVICE_ALL = "0";
23
24
	// 已关联终端
25
	public static final String BIND_DEVICE_OK = "1";
26
27
	// 未关联终端
28
	public static final String BIND_DEVICE_NO = "2";
29
30
	// 终端和人员绑定
31
	public static final String BIND_DEVICE_TYPE_USER = "1";
32
33
	// 终端和船舶绑定
34
	public static final String BIND_DEVICE_TYPE_SHIP = "2";
35
36
	//静态常量: 终端类型
37
	public static final String BUSINESS_SPEC_PRODUCT_TYPE="PRODUCT_TYPE";
38
	
39
	//静态常量: 职务类型
40
	public static final String BUSINESS_SPEC_EMPLOYEE_POSITION="mainJobPosition";
41
	
42
	//静态常量: 报警类型
43
	public static final String BUSINESS_SPEC_MAP_AREA_TYPE="ALARM_TYPE";
44
		
45
	//工具是否可绑定:不可绑定
46
	public static final String TOOL_BIND_REJECT="0";
47
48
	//工具是否可绑定:可绑定
49
	public static final String TOOL_BIND_ALLOW="1";
50
51
	// 轨迹的时间段:10分钟
52
	public static final String LOCUS_TIME_INTERVAL_TENMINUTE = "1";
53
	
54
	// 轨迹的时间段:1小时
55
	public static final String LOCUS_TIME_INTERVAL_ONEHOUR = "2";
56
	
57
	// 轨迹的时间段:1天
58
	public static final String LOCUS_TIME_INTERVAL_ONEDAY = "3";
59
	
60
	// 轨迹的时间段:自定义
61
	public static final String LOCUS_TIME_INTERVAL_CUSTOM = "4";
62
	
63
	// 是否已指派救援者:否
64
	public static final String IS_ASSIGN_RESCUER_FALSE = "0";
65
66
	// 是否已指派救援者:是
67
	public static final String IS_ASSIGN_RESCUER_TRUE = "1";
68
	
69
	
70
	
71
	
72
	
73
	
74
	
75
	
76
	// 围栏标记类型:考勤区域
77
	public static final String area_type_attendance = "1";
78
79
	// 围栏标记类型:作业区域
80
	public static final String area_type_job = "2";
81
82
	// 围栏标记类型:电子围栏
83
	public static final String area_type_exclusion = "3";
84
85
	// 围栏标记类型:定点
86
	public static final String area_type_temporariness = "4";
87
88
	// 人员定位状态:正常
89
	public static final String location_status_normal = "0";
90
91
	// 人员定位状态:离线
92
	public static final String location_status_offline = "1";
93
94
	// 人员定位状态:定点(超时)违规
95
	public static final String location_status_overtime = "2";
96
97
	// 人员定位状态:电子围栏(禁区)违规
98
	public static final String location_status_exclusion = "3";
99
100
	// 人员定位状态:SOS(自动)
101
	public static final String location_status_autosos = "4";
102
103
	// 人员定位状态:SOS(手动)
104
	public static final String location_status_jogsos = "5";
105
106
	// 人员定位状态:救援人员
107
	public static final String location_status_rescuer = "6";
108
109
	// 告警类型:SOS(自动)
110
	public static final int alarm_type_autosos_beidou = 1;
111
	
112
	// 告警类型:SOS(手动)
113
	public static final int alarm_type_jogsos_beidou = 2;
114
115
	// 告警类型:离线
116
	public static final int alarm_type_offline_beidou = 4;
117
118
	// 告警类型:SOS(自动)
119
	public static final String alarm_type_autosos_ZH = "落水告警";
120
121
	// 告警类型:SOS(手动)
122
	public static final String alarm_type_jogsos_ZH = "手动告警";
123
124
	// 告警类型:离线
125
	public static final String alarm_type_offline_ZH = "离线告警";
126
127
	//报警状态:新报警,未指派
128
	public static final String alarm_status_new = "1";
129
	
130
	//报警状态:未指派
131
	public static final String alarm_status_needassign = "1";
132
	
133
	//报警状态:已指派,未关闭
134
	public static final String alarm_status_needclose = "2";
135
	
136
	// 数据状态:有效(未关闭)
137
	public static final String data_status_valid = "1";
138
139
	// 数据状态:无效(关闭)
140
	public static final String data_status_close = "0";
141
142
	// 考勤查询:日
143
	public static final String AREA_IN_OUT_RECORD_DAY = "day";
144
145
	// 考勤查询:周
146
	public static final String AREA_IN_OUT_RECORD_WEEK = "week";
147
148
	// 考勤查询:月
149
	public static final String AREA_IN_OUT_RECORD_MONTH = "month";
150
151
	
152
	
153
}

+ 291 - 0
ebc-sea-platform/src/main/java/com/ai/bss/location/rescue/util/HttpServiceUtil.java

@ -0,0 +1,291 @@
1
package com.ai.bss.location.rescue.util;
2
3
import java.io.BufferedReader;
4
import java.io.IOException;
5
import java.io.InputStream;
6
import java.io.InputStreamReader;
7
import java.io.UnsupportedEncodingException;
8
import java.net.HttpURLConnection;
9
import java.net.URL;
10
import java.net.URLEncoder;
11
import java.nio.charset.Charset;
12
import java.util.Iterator;
13
import java.util.Map;
14
import java.util.Set;
15
16
import org.apache.http.HttpEntity;
17
import org.apache.http.HttpStatus;
18
import org.apache.http.client.ClientProtocolException;
19
import org.apache.http.client.HttpClient;
20
import org.apache.http.client.config.RequestConfig;
21
import org.apache.http.client.methods.CloseableHttpResponse;
22
import org.apache.http.client.methods.HttpGet;
23
import org.apache.http.client.methods.HttpPost;
24
import org.apache.http.client.methods.HttpPut;
25
import org.apache.http.entity.StringEntity;
26
import org.apache.http.entity.mime.MultipartEntityBuilder;
27
import org.apache.http.impl.client.CloseableHttpClient;
28
import org.apache.http.impl.client.HttpClients;
29
import org.apache.http.protocol.HTTP;
30
import org.apache.http.util.EntityUtils;
31
import org.slf4j.Logger;
32
import org.slf4j.LoggerFactory;
33
34
import com.alibaba.fastjson.JSONObject;
35
36
import lombok.extern.slf4j.Slf4j;
37
38
/**
39
 * http服务请求工具类
40
 *
41
 * @author chencai
42
 */
43
@Slf4j
44
public class HttpServiceUtil {
45
	static Logger log = LoggerFactory.getLogger(HttpServiceUtil.class);
46
47
	private static final String HTTP_CONTENT_TYPE_JSON = "application/json; charset=utf-8";
48
49
	public static String buildUrl(Map<String, String> paramMap, String serviceUrl) {
50
		String url = null;
51
		StringBuffer urlString = new StringBuffer();
52
		urlString.append(serviceUrl);
53
54
		if (!paramMap.isEmpty()) {
55
			// 参数列表不为空,地址尾部增加'?'
56
			urlString.append('?');
57
			// 拼接参数
58
			Set<Map.Entry<String, String>> entrySet = paramMap.entrySet();
59
			for (Map.Entry<String, String> entry : entrySet) {
60
				try {
61
					urlString.append(entry.getKey()).append('=').append(URLEncoder.encode(entry.getValue(), "UTF-8"))
62
							.append('&');
63
				} catch (UnsupportedEncodingException e) {
64
					log.error(" Exception: " + e);
65
				}
66
			}
67
			// 去掉最后一个字符“&”
68
			url = urlString.substring(0, urlString.length() - 1);
69
		}
70
		return url;
71
	}
72
73
	public static String sendRequest(String url) {
74
		InputStream inputStream = null;
75
		BufferedReader bufferedReader = null;
76
		HttpURLConnection httpURLConnection = null;
77
		try {
78
			log.error("It's not error. request url: " + url);
79
			URL requestURL = new URL(url);
80
			// 获取连接
81
			httpURLConnection = (HttpURLConnection) requestURL.openConnection();
82
			httpURLConnection.setConnectTimeout(10000); // 建立连接的超时时间,毫秒
83
			httpURLConnection.setReadTimeout(25000); // 获得返回的超时时间,毫秒
84
			httpURLConnection.setRequestMethod("GET");
85
			httpURLConnection.setRequestProperty("Content-type", "text/html;charset=UTF-8");
86
			httpURLConnection.setRequestProperty("Accept",
87
					"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
88
			// 通过输入流获取请求的内容
89
			inputStream = httpURLConnection.getInputStream();
90
			bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
91
			String temp = null;
92
			StringBuffer stringBuffer = new StringBuffer();
93
			// 循环读取返回的结果
94
			while ((temp = bufferedReader.readLine()) != null) {
95
				stringBuffer.append(temp);
96
			}
97
98
			return stringBuffer.toString();
99
		} catch (Exception e) {
100
			log.error("sendRequest Exception: " + e);
101
		} finally {
102
			// 断开连接
103
			if (httpURLConnection != null) {
104
				httpURLConnection.disconnect();
105
			}
106
			// 关闭流
107
			if (bufferedReader != null) {
108
				try {
109
					bufferedReader.close();
110
				} catch (IOException e) {
111
					log.error("bufferedReader Exception: " + e);
112
				}
113
			}
114
			if (inputStream != null) {
115
				try {
116
					inputStream.close();
117
				} catch (IOException e) {
118
					log.error("inputStream Exception: " + e);
119
				}
120
			}
121
		}
122
		return null;
123
	}
124
125
	public static String sendPostRequest(String url, Map<String, String> map, String encoding) {
126
		String retStr = "";
127
		try {
128
			retStr = sendPostRequest(url, map, encoding, 0, 0);
129
		} catch (Exception ex) {
130
			log.error("sendPostRequest error: " + ex);
131
		}
132
133
		return retStr;
134
	}
135
136
	public static String sendPostRequest(String url, Map<String, String> map, String encoding, int ebossConnectTimeout,
137
			int ebossServiceTimeout) {
138
		CloseableHttpClient httpClient = HttpClients.createDefault();
139
		HttpPost httpPost = new HttpPost(url);
140
		String body = "";
141
142
		try {
143
			MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
144
			if (map != null) {
145
				for (Map.Entry<String, String> entry : map.entrySet()) {
146
					multipartEntityBuilder.addTextBody(entry.getKey(), entry.getValue());
147
				}
148
			}
149
150
			log.debug("ebossConnectTimeout:" + ebossConnectTimeout);
151
			log.debug("ebossServiceTimeout:" + ebossServiceTimeout);
152
153
			httpPost.setEntity(multipartEntityBuilder.build());
154
			if (ebossConnectTimeout != 0 && ebossServiceTimeout != 0) {
155
				RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(ebossServiceTimeout)
156
						.setConnectTimeout(ebossConnectTimeout).build();// 设置请求和传输超时时间
157
				httpPost.setConfig(requestConfig);
158
			}
159
160
			CloseableHttpResponse response = httpClient.execute(httpPost);
161
162
			if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
163
				HttpEntity entity = response.getEntity();
164
				if (entity != null) {
165
					// 按指定编码转换结果实体为String类型
166
					body = EntityUtils.toString(entity, encoding);
167
				}
168
				EntityUtils.consume(entity);
169
			}
170
		} catch (ClientProtocolException e) {
171
			log.error("ClientProtocolException Exception: " + e);
172
		} catch (UnsupportedEncodingException e) {
173
			log.error("UnsupportedEncodingException Exception: " + e);
174
		} catch (IOException e) {
175
			log.error("IOException Exception: " + e);
176
			// throw new BaseException("10", "调用Eboss超时");
177
		} finally {
178
			// 关闭连接,释放资源
179
			try {
180
				httpClient.close();
181
			} catch (IOException e) {
182
				log.error("httpClient Exception: " + e);
183
			}
184
		}
185
186
		return body;
187
	}
188
189
	public static String sendGet(String url, Charset encoding,Map<String,String> headerMap) {
190
		HttpClient httpClient = HttpClients.createDefault();
191
		HttpGet httpGet = new HttpGet(url);
192
		httpGet.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
193
		CloseableHttpResponse response = null;
194
		try {
195
			response = (CloseableHttpResponse) httpClient.execute(httpGet);
196
		} catch (Exception e) {
197
			log.error("sendGet Exception: " + e.getMessage());
198
			return "{}";
199
		}
200
		return responseEx(httpClient, response, encoding);
201
	}
202
203
	public static String sendPost(String url, Map<String, Object> paramsMap, Charset encoding) {
204
		HttpClient httpClient = HttpClients.createDefault();
205
		HttpPost httpPost = new HttpPost(url);
206
		httpPost.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
207
		if (paramsMap != null && paramsMap.size() > 0) {
208
			StringEntity se = new StringEntity(JSONObject.toJSONString(paramsMap), encoding);
209
			httpPost.setEntity(se);
210
		}
211
		CloseableHttpResponse response = null;
212
		try {
213
			response = (CloseableHttpResponse) httpClient.execute(httpPost);
214
		} catch (Exception e) {
215
			log.error("sendPost Exception: " + e.getMessage());
216
			return "{}";
217
		}
218
		return responseEx(httpClient, response, encoding);
219
	}
220
221
	public static String sendPost(String url, Map<String, Object> paramsMap, Charset encoding,
222
			Map<String, String> headerMap) {
223
		HttpClient httpClient = HttpClients.createDefault();
224
		HttpPost httpPost = new HttpPost(url);
225
226
		Iterator<String> iter = headerMap.keySet().iterator();
227
		String key = "";
228
		String value = "";
229
		while (iter.hasNext()) {
230
			key = iter.next();
231
			value = headerMap.get(key);
232
			httpPost.setHeader(key, value);
233
		}
234
235
		httpPost.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
236
		if (paramsMap != null && paramsMap.size() > 0) {
237
			log.debug("调用北向接口:url= " + url + ",参数= " + JSONObject.toJSONString(paramsMap));
238
			StringEntity se = new StringEntity(JSONObject.toJSONString(paramsMap), encoding);
239
			httpPost.setEntity(se);
240
		}
241
		CloseableHttpResponse response = null;
242
		try {
243
			response = (CloseableHttpResponse) httpClient.execute(httpPost);
244
		} catch (Exception e) {
245
			log.error("sendPost Exception: " + e.getMessage());
246
			return "{}";
247
		}
248
		return responseEx(httpClient, response, encoding);
249
	}
250
251
	public static String sendPut(String url, Map<String, String> params, Charset encoding) {
252
		HttpClient httpClient = HttpClients.createDefault();
253
		String resp = "";
254
		HttpPut httpPut = new HttpPut(url);
255
		httpPut.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
256
		if (params != null && params.size() > 0) {
257
			StringEntity se = new StringEntity(JSONObject.toJSONString(params), encoding);
258
			httpPut.setEntity(se);
259
		}
260
		CloseableHttpResponse response = null;
261
		try {
262
			response = (CloseableHttpResponse) httpClient.execute(httpPut);
263
		} catch (Exception e) {
264
			log.error("sendPut Exception: " + e.getMessage());
265
			return "{}";
266
		}
267
268
		return responseEx(httpClient, response, encoding);
269
	}
270
271
	private static String responseEx(HttpClient httpClient, CloseableHttpResponse response, Charset encoding) {
272
		String resp = "";
273
		try {
274
			if (response != null && 200 == response.getStatusLine().getStatusCode()) {
275
				resp = EntityUtils.toString(response.getEntity(), encoding);
276
			}
277
		} catch (Exception e) {
278
			log.error("responseEx Exception: " + e.getMessage());
279
		} finally {
280
			if (response != null) {
281
				try {
282
					response.close();
283
				} catch (Exception e) {
284
					log.error("responseEx Exception: " + e.getMessage());
285
				}
286
			}
287
		}
288
		return resp;
289
	}
290
291
}

+ 58 - 0
ebc-sea-platform/src/main/java/com/ai/bss/location/rescue/util/IpUtil.java

@ -0,0 +1,58 @@
1
package com.ai.bss.location.rescue.util;
2
3
4
import java.net.Inet4Address;
5
import java.net.InetAddress;
6
import java.net.NetworkInterface;
7
import java.net.SocketException;
8
import java.util.ArrayList;
9
import java.util.Collections;
10
import java.util.Enumeration;
11
import java.util.List;
12
13
/**
14
 * 地址工具类
15
 * 
16
 * @author Administrator
17
 *
18
 */
19
public class IpUtil {
20
	private static String hostAddress = null;
21
	
22
	/**
23
	 * 获取本机ip地址<BR/>
24
	 * 不会将.1结尾的ip作为合法地址</BR>
25
	 * 如果有多块网卡,将返回地址最小的那个<BR/>
26
	 * 可以在程序启动入口参数中指定本机地址
27
	 * 
28
	 * @return
29
	 * @throws SocketException
30
	 */
31
	public static String getHostAddress() throws SocketException {
32
		if(hostAddress!=null){
33
			return hostAddress;
34
		}
35
		
36
		InetAddress ip = null;
37
		List<String> addressList = new ArrayList<String>();
38
		Enumeration<NetworkInterface> allNetInterfaces = NetworkInterface.getNetworkInterfaces();
39
		while (allNetInterfaces.hasMoreElements())
40
		{
41
			NetworkInterface netInterface = (NetworkInterface) allNetInterfaces.nextElement();
42
			Enumeration<InetAddress> addresses = netInterface.getInetAddresses();
43
			while (addresses.hasMoreElements())
44
			{
45
				ip = (InetAddress) addresses.nextElement();
46
				if (ip != null && ip instanceof Inet4Address)
47
				{
48
					if (!ip.getHostAddress().endsWith(".1"))
49
							addressList.add(ip.getHostAddress());
50
				} 
51
			}
52
		}
53
		Collections.sort(addressList);
54
		hostAddress = (String)addressList.get(0);
55
		return hostAddress;
56
	}
57
	
58
}

+ 33 - 0
ebc-sea-platform/src/main/java/com/ai/bss/location/rescue/util/NorthboundInterfaceConstant.java

@ -0,0 +1,33 @@
1
package com.ai.bss.location.rescue.util;
2
3
/**
4
 * 北向接口的常量
5
 * @author konghl@asiainfo.com
6
 * 2020-10-29
7
 */
8
public class NorthboundInterfaceConstant {
9
	// 分页查询终端
10
	public static final String queryPageDevice="findTerminal";
11
	
12
	// 添加终端
13
	public static final String addDevice="device";
14
	
15
	// 修改终端
16
	public static final String updateDevice="updateDevice";
17
	
18
	// 删除终端
19
	public static final String deleteDevice="deleteDevice?deviceId=";
20
	
21
	// 查询单个设备
22
	public static final String queryOneDevice="deviceSimpleDetail?deviceId=";
23
	
24
	// 查询多个设备解析后的事件
25
	public static final String queryMoreDeviceNewIncident="findTerminalEventDataParseInResourceIdsLastData";
26
27
	//按时间段查询单个设备的事件
28
	public static final String queryOneDeviceIncident="findTerminalEventDataParseES";
29
	
30
	// 调用成功标识
31
	public static final String resultCode_succeed = "0";
32
33
}

+ 253 - 0
ebc-sea-platform/src/main/java/com/ai/bss/location/rescue/util/NorthboundInterfaceUtil.java

@ -0,0 +1,253 @@
1
package com.ai.bss.location.rescue.util;
2
3
import java.nio.charset.Charset;
4
import java.util.HashMap;
5
import java.util.Map;
6
7
import org.slf4j.Logger;
8
import org.slf4j.LoggerFactory;
9
import org.springframework.beans.factory.annotation.Value;
10
import org.springframework.context.annotation.Configuration;
11
12
import com.alibaba.fastjson.JSON;
13
import com.alibaba.fastjson.JSONObject;
14
15
/**
16
 * 北向接口统一入口
17
 *
18
 * @date 2010/09/24 23:42
19
 */
20
@Configuration
21
public class NorthboundInterfaceUtil {
22
23
    private static final Logger logger = LoggerFactory.getLogger(NorthboundInterfaceUtil.class);
24
25
    @Value("${aap.iot.userCode:IOT_ADMIN}")
26
    private String userCode;
27
28
    @Value("${aap.iot.passWord:123456}")
29
    private String passWord;
30
31
    @Value("${url.iot.login:http://47.105.130.83:8083/sso/login}")
32
    private String iotLoginUrl;
33
34
    @Value("${url.iot.service:http://47.105.130.83:8083/dmp/terminalNorthApi/}")
35
    private String iotServiceUrl;
36
37
    /**
38
     * GET请求调用北向接口方法
39
     *
40
     * @param url
41
     * @return
42
     * @throws Exception
43
     */
44
    public Map<String, Object> iotGetCallUtil(String url) throws Exception {
45
        logger.debug("GET调用北向接口");
46
        Map<String, Object> resultMap = new HashMap<String, Object>();
47
        Map<String, String> signMap = new HashMap<String, String>();
48
49
        // 1.在缓存中获取sessionId与sign
50
        Object sign =CacheUtil.getCache("ebc_iot_north_sign");
51
        Object session_id = CacheUtil.getCache("ebc_iot_north_session_id");
52
53
        if (sign == null ) {
54
            // 2.如果没有调用登录接口从新获取
55
            signMap = iotLogin();
56
57
            if (signMap == null) {
58
                logger.debug("调用北向接口登录失败");
59
                return resultMap;
60
            }
61
62
        } else {
63
            signMap.put("ebc_iot_north_sign", String.valueOf(sign));
64
            signMap.put("ebc_iot_north_session_id", String.valueOf(session_id));
65
66
        }
67
68
        // 3.调用北向服务接口
69
        // (1)设置字符集
70
        Charset charset = Charset.forName("utf-8");
71
        try {
72
            // (2)调用接口
73
            String resultJson = HttpServiceUtil.sendGet(iotServiceUrl + url, charset, signMap);
74
            // (3)将参数转为Map<String,String>【将返回值统一为String】
75
            resultMap = JSON.parseObject(resultJson, Map.class);
76
        } catch (Exception e) {
77
            logger.error("调用北向接口失败: " + e.getMessage());
78
            return new HashMap<String, Object>();
79
        }
80
81
        if (resultMap == null) {
82
            logger.error("调用北向接口返回值为空");
83
            return new HashMap<String, Object>();
84
85
        } else if ("登录超时".equals(resultMap.get("resultMsg"))) {
86
            // 4.登录超时,需重新登录
87
            logger.info("调用北向接口失败,需重新登录");
88
            // (1)清除缓存
89
            CacheUtil.removeCache("ebc_iot_north_sign");
90
            CacheUtil.removeCache("ebc_iot_north_session_id");
91
            // (2)重新登录
92
            signMap = iotLogin();
93
94
            if (signMap == null) {
95
                logger.debug("再次调用北向接口登录失败");
96
                return resultMap;
97
            }
98
99
            try {
100
                // (3)再次调用接口
101
                String resultJson = HttpServiceUtil.sendGet(iotServiceUrl + url, charset, signMap);
102
                // (4)获取返回值
103
                resultMap = JSON.parseObject(resultJson, Map.class);
104
            } catch (Exception e) {
105
                logger.error("再次调用北向接口失败: " + e.getMessage());
106
                return new HashMap<String, Object>();
107
            }
108
109
            if (resultMap == null) {
110
                logger.error("再次调用北向接口返回值为空");
111
                return new HashMap<String, Object>();
112
            }
113
        }
114
115
        // 5.判断是否调用成功
116
        if (NorthboundInterfaceConstant.resultCode_succeed.equals(resultMap.get("resultCode"))) {
117
            logger.info("调用北向接口成功");
118
            return resultMap;
119
        } else {
120
            logger.info("调用北向接口失败");
121
            return new HashMap<String, Object>();
122
        }
123
    }
124
125
    /**
126
     * POST请求调用北向接口方法
127
     *
128
     * @param url
129
     * @param paramsMap
130
     * @return
131
     * @throws Exception
132
     */
133
    public Map<String, Object> iotPostCallUtil(String url, Map<String, Object> paramsMap) throws Exception {
134
        logger.debug("POSt调用北向接口");
135
        Map<String, Object> resultMap = new HashMap<String, Object>();
136
        Map<String, String> signMap = new HashMap<String, String>();
137
138
        // 1.在缓存中获取sessionId与sign
139
        Object sign =CacheUtil.getCache("ebc_iot_north_sign");
140
        Object session_id = CacheUtil.getCache("ebc_iot_north_session_id");
141
142
        if (sign == null ) {
143
            // 2.如果没有调用登录接口从新获取
144
            signMap = iotLogin();
145
146
            if (signMap == null) {
147
                logger.debug("调用北向接口登录失败");
148
                return resultMap;
149
            }
150
151
        } else {
152
            signMap.put("ebc_iot_north_sign", String.valueOf(sign));
153
            signMap.put("ebc_iot_north_session_id", String.valueOf(session_id));
154
155
        }
156
157
        // 3.调用北向服务接口
158
        // (1)设置字符集
159
        Charset charset = Charset.forName("utf-8");
160
        try {
161
            // (2)调用接口
162
            String resultJson = HttpServiceUtil.sendPost(iotServiceUrl + url, paramsMap, charset, signMap);
163
            // (3)将参数转为Map<String,String>【将返回值统一为String】
164
            resultMap = JSON.parseObject(resultJson, Map.class);
165
        } catch (Exception e) {
166
            logger.error("调用北向接口失败: " + e.getMessage());
167
            return new HashMap<String, Object>();
168
        }
169
170
        if (resultMap == null) {
171
            logger.error("调用北向接口返回值为空");
172
            return new HashMap<String, Object>();
173
        } else if ("登录超时".equals(resultMap.get("resultMsg"))) {
174
            // 4.登录超时,需重新登录
175
            logger.info("调用北向接口登录超时,需重新登录");
176
            // (1)清除缓存
177
            CacheUtil.removeCache("ebc_iot_north_sign");
178
            CacheUtil.removeCache("ebc_iot_north_session_id");
179
            // (2)重新登录
180
            signMap = iotLogin();
181
182
            if (signMap == null) {
183
                logger.debug("再次调用北向接口登录失败");
184
                return resultMap;
185
            }
186
187
            try {
188
                // (3)再次调用接口
189
                String resultJson = HttpServiceUtil.sendPost(iotServiceUrl + url, paramsMap, charset, signMap);
190
                // (4)获取返回值
191
                resultMap = JSON.parseObject(resultJson, Map.class);
192
            } catch (Exception e) {
193
                logger.error("再次调用北向接口失败: " + e.getMessage());
194
                return new HashMap<String, Object>();
195
            }
196
197
            if (resultMap == null) {
198
                logger.error("再次调用北向接口返回值为空");
199
                return new HashMap<String, Object>();
200
            }
201
        }
202
203
        // 5.判断是否调用成功
204
        if (NorthboundInterfaceConstant.resultCode_succeed.equals(resultMap.get("resultCode"))) {
205
            logger.info("调用北向接口成功");
206
            return resultMap;
207
        } else {
208
            logger.info("调用北向接口失败");
209
            return new HashMap<String, Object>();
210
        }
211
    }
212
213
    /**
214
     * 调用登录接口获取sessionId与sign
215
     *
216
     * @return
217
     */
218
    private Map<String, String> iotLogin() throws Exception {
219
        logger.debug("登录北向接口");
220
        HashMap<String, Object> loginParamMap = new HashMap<>();
221
222
        // 调用登录接口获取sessionId与sign
223
        loginParamMap.put("userCode", userCode);
224
        loginParamMap.put("passWord", passWord);
225
226
        // 设置字符集
227
        Charset charset = Charset.forName("utf-8");
228
229
        //Map<String, String> loginResultMap =new HashMap<String,String>();
230
        JSONObject loginResultJsonObject = null;
231
        try {
232
            // 调用登录接口
233
            String loginResult = HttpServiceUtil.sendPost(iotLoginUrl, loginParamMap, charset);
234
            loginResultJsonObject = JSON.parseObject(loginResult);
235
        } catch (Exception e) {
236
            logger.error("登录北向接口失败: " + e.getMessage());
237
            return null;
238
        }
239
240
        if (loginResultJsonObject != null && NorthboundInterfaceConstant.resultCode_succeed.equals(String.valueOf(loginResultJsonObject.get("resultCode")))) {
241
            logger.info("登录北向接口成功");
242
243
            Map<String, String> resultMap = (Map<String, String>) loginResultJsonObject.get("result");
244
            // 将数据存到缓存中
245
            CacheUtil.setCache("ebc_iot_north_sign", resultMap.get("sign"));
246
            CacheUtil.setCache("ebc_iot_north_session_id", resultMap.get("session_id"));
247
            return resultMap;
248
        } else {
249
            logger.info("登录北向接口失败");
250
            return null;
251
        }
252
    }
253
}

+ 48 - 0
ebc-sea-platform/src/main/java/com/ai/bss/location/rescue/util/SpringUtil.java

@ -0,0 +1,48 @@
1
package com.ai.bss.location.rescue.util;
2
3
import org.slf4j.Logger;
4
import org.slf4j.LoggerFactory;
5
import org.springframework.beans.BeansException;
6
import org.springframework.context.ApplicationContext;
7
import org.springframework.context.ApplicationContextAware;
8
import org.springframework.stereotype.Component;
9
10
@Component
11
public class SpringUtil implements ApplicationContextAware {
12
	private static final Logger logger = LoggerFactory.getLogger(SpringUtil.class);
13
	private static ApplicationContext applicationContext;
14
15
	private static void setApplicationcontext(ApplicationContext applicationContext) {
16
		if(SpringUtil.applicationContext == null) {
17
			SpringUtil.applicationContext = applicationContext;
18
        }
19
	}
20
	
21
    @Override
22
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
23
    	setApplicationcontext(applicationContext);
24
        logger.debug("---------------------------------------------------------------------");
25
        logger.debug("========ApplicationContext配置成功,在普通类可以通过调用SpringUtils.getAppContext()获取applicationContext对象,applicationContext="+SpringUtil.applicationContext+"========");
26
        logger.debug("---------------------------------------------------------------------");
27
    }
28
29
    //获取applicationContext
30
    public static ApplicationContext getApplicationContext() {
31
        return applicationContext;
32
    }
33
34
    //通过name获取 Bean.
35
    public static Object getBean(String name){
36
        return getApplicationContext().getBean(name);
37
    }
38
39
    //通过class获取Bean.
40
    public static <T> T getBean(Class<T> clazz){
41
        return getApplicationContext().getBean(clazz);
42
    }
43
44
    //通过name,以及Clazz返回指定的Bean
45
    public static <T> T getBean(String name,Class<T> clazz){
46
        return getApplicationContext().getBean(name, clazz);
47
    }
48
}

+ 15 - 0
ebc-sea-platform/src/main/resources/pro/application-gis.properties

@ -0,0 +1,15 @@
1
#gis\u767b\u5f55\u8d26\u53f7\u548c\u5bc6\u7801
2
aap.gis.userName=EBC_PPRS
3
aap.gis.passwd=ITBS93wMYHosT
4
5
#gis\u7684token\u5730\u5740
6
url.gis.token=http://192.168.74.189:9999/gisIntf/account/gettoken
7
8
#\u6d77\u56fe\u4e2d\u5fc3\u5750\u6807
9
seaMap.centre.longitude=123.396036
10
seaMap.centre.latitude=31.560302
11
12
#\u6d77\u56fe\u663e\u793a\u6bd4\u4f8b\u5c3a
13
# 5-->300km,6-->200km,7-->100km,8-->50km,9-->20km,10-->10km,11-->5km
14
# 12-->2km,13-->1km,14-->500m,15-->300m,16-->200m,17-->100m,18-->50m
15
seaMap.scale=8

+ 14 - 0
ebc-sea-platform/src/main/resources/pro/application-iot.properties

@ -0,0 +1,14 @@
1
#\u5317\u5411\u767b\u5f55\u8d26\u53f7\u548c\u5bc6\u7801
2
aap.iot.userCode=IOT_ADMIN
3
aap.iot.passWord=123456
4
5
#iot\u7684\u5317\u5411\u63a5\u53e3\u6ce8\u518c\u5730\u5740
6
#url.iot.login=http://60.205.219.67:8300/sso/login
7
url.iot.login=http://47.105.130.83:8083/sso/login
8
9
#iot\u7684\u5317\u5411\u63a5\u53e3\u7edf\u4e00\u5730\u5740
10
#url.iot.service=http://60.205.219.67:8300/dmp/terminalNorthApi/
11
url.iot.service=http://47.105.130.83:8083/dmp/terminalNorthApi/
12
13
#\u7ec8\u7aef\u8d85\u65f6\u79bb\u7ebf\u65f6\u95f4(\u5206\u949f)
14
device.overtime.offline=20

+ 54 - 0
ebc-sea-platform/src/main/resources/pro/application.properties

@ -0,0 +1,54 @@
1
spring.application.name=WorkTaskSpec
2
server.port=8011
3
4
server.servlet.context-path=/ipu
5
6
# DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
7
#spring.datasource.url=jdbc:mysql://localhost:3306/cmp
8
spring.datasource.url=jdbc:mysql://10.19.90.34:3307/energy?serverTimezone=Asia/Shanghai&characterEncoding=utf-8&verifyServerCertificate=false&useSSL=false&requireSSL=false
9
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
10
spring.datasource.username=ebc
11
spring.datasource.password=ebc@123
12
13
# JPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration)
14
#spring.jpa.database=default
15
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
16
spring.jpa.hibernate.ddl-auto=none
17
spring.jpa.show-sql=true
18
spring.jpa.properties.hibernate.format_sql=true
19
spring.jpa.properties.hibernate.generate_statistics=false
20
spring.main.allow-bean-definition-overriding=true
21
22
#kafka
23
kafka.bootstrap-servers=47.105.160.21:9090
24
#kafka.bootstrap-servers=10.19.90.34:2182
25
#kafka.topic.deviceLocation=Topic_IoT_DeviceLocation
26
#kafka.topic.alarm=Topic_IoT_IndividualAlarm
27
kafka.topic.deviceLocation=DeviceLocationA
28
kafka.topic.alarm=IndividualAlarmA
29
kafka.producer.batch-size=16785
30
kafka.producer.retries=1
31
kafka.producer.buffer-memory=33554432
32
kafka.producer.linger=1
33
kafka.consumer.auto-offset-reset=latest
34
kafka.consumer.max-poll-records=3100
35
kafka.consumer.enable-auto-commit=false
36
kafka.consumer.auto-commit-interval=1000
37
kafka.consumer.session-timeout=20000
38
kafka.consumer.max-poll-interval=15000
39
kafka.consumer.max-partition-fetch-bytes=15728640
40
kafka.listener.batch-listener=false
41
kafka.listener.concurrencys=3,6
42
kafka.listener.poll-timeout=1500
43
44
45
# CACHE
46
#spring.cache.type=ehcache
47
#spring.cache.ehcache.config=ehcache.xml
48
49
# LOGGING
50
logging.level.com.ai=debug
51
logging.level.org.springframework.data=debug
52
53
# \u5f15\u5165gis\u548ciot\u7684\u914d\u7f6e\u6587\u4ef6
54
spring.profiles.active=iot,gis

+ 114 - 0
ebc-sea-platform/src/main/resources/pro/ipu-cache.xml

@ -0,0 +1,114 @@
1
<?xml version = '1.0' encoding = 'UTF-8'?>
2
<caches>
3
	<cache name="ssn" type="redis">
4
		<servers>
5
	        <!-- 如果不是cluster,则只使用第一个redis -->
6
	        <server ip="121.42.183.206" port="7101" />
7
	        <server ip="121.42.183.206" port="7102" />
8
	        <server ip="121.42.183.206" port="7103" />
9
	        <server ip="121.42.183.206" port="7104" />
10
	        <server ip="121.42.183.206" port="7105" />
11
	        <server ip="121.42.183.206" port="7106" />
12
	    </servers>
13
		<!-- 客户端类型:Jedis,JedisCluster -->
14
	    <config name="clientType" value="JedisCluster"/>
15
	    <!-- 访问redis的密码,可以为空 -->
16
	    <config name="auth" value="Ipu@321!"/>
17
	    <!-- redis池的可用连接实例的最大数目,缺省为8 -->
18
	    <config name="poolSize" value="10"/>
19
	    <!-- redis池最多有多少个状态为idle(空闲的)的jedis实例,缺省为8,空闲连接大于这个数会进行回收 -->
20
	    <config name="maxIdle"/>
21
	    <!-- 最小空闲数,空闲连接小于这个数会建立新的连接,缺省为0 -->
22
	    <config name="minIdle"/>
23
	    <!-- 等待Response超时时间,默认2000ms -->
24
	    <config name="soTimeout"/>
25
	    <!-- 连接Redis Server超时时间,默认2000ms -->
26
	    <config name="connTimeout"/>
27
	    <!-- 出现异常最大重试次数 -->
28
	    <config name="maxAttempts"/>
29
	</cache>
30
	
31
	<cache name="SSN_CACHE" type="redis">
32
		<servers>
33
	        <!-- 如果不是cluster,则只使用第一个redis -->
34
	        <server ip="121.42.183.206" port="7101" />
35
	        <server ip="121.42.183.206" port="7102" />
36
	        <server ip="121.42.183.206" port="7103" />
37
	        <server ip="121.42.183.206" port="7104" />
38
	        <server ip="121.42.183.206" port="7105" />
39
	        <server ip="121.42.183.206" port="7106" />
40
	    </servers>
41
		<!-- 客户端类型:Jedis,JedisCluster -->
42
	    <config name="clientType" value="JedisCluster"/>
43
	    <!-- 访问redis的密码,可以为空 -->
44
	    <config name="auth" value="Ipu@321!"/>
45
	    <!-- redis池的可用连接实例的最大数目,缺省为8 -->
46
	    <config name="poolSize" value="10"/>
47
	    <!-- redis池最多有多少个状态为idle(空闲的)的jedis实例,缺省为8,空闲连接大于这个数会进行回收 -->
48
	    <config name="maxIdle"/>
49
	    <!-- 最小空闲数,空闲连接小于这个数会建立新的连接,缺省为0 -->
50
	    <config name="minIdle"/>
51
	    <!-- 等待Response超时时间,默认2000ms -->
52
	    <config name="soTimeout"/>
53
	    <!-- 连接Redis Server超时时间,默认2000ms -->
54
	    <config name="connTimeout"/>
55
	    <!-- 出现异常最大重试次数 -->
56
	    <config name="maxAttempts"/>
57
	</cache>
58
	
59
	<cache name="client_route" type="redis">
60
		<servers>
61
	        <!-- 如果不是cluster,则只使用第一个redis -->
62
	        <server ip="121.42.183.206" port="7101" />
63
	        <server ip="121.42.183.206" port="7102" />
64
	        <server ip="121.42.183.206" port="7103" />
65
	        <server ip="121.42.183.206" port="7104" />
66
	        <server ip="121.42.183.206" port="7105" />
67
	        <server ip="121.42.183.206" port="7106" />
68
	    </servers>
69
		<!-- 客户端类型:Jedis,JedisCluster -->
70
	    <config name="clientType" value="JedisCluster"/>
71
	    <!-- 访问redis的密码,可以为空 -->
72
	    <config name="auth" value="Ipu@321!"/>
73
	    <!-- redis池的可用连接实例的最大数目,缺省为8 -->
74
	    <config name="poolSize" value="10"/>
75
	    <!-- redis池最多有多少个状态为idle(空闲的)的jedis实例,缺省为8,空闲连接大于这个数会进行回收 -->
76
	    <config name="maxIdle"/>
77
	    <!-- 最小空闲数,空闲连接小于这个数会建立新的连接,缺省为0 -->
78
	    <config name="minIdle"/>
79
	    <!-- 等待Response超时时间,默认2000ms -->
80
	    <config name="soTimeout"/>
81
	    <!-- 连接Redis Server超时时间,默认2000ms -->
82
	    <config name="connTimeout"/>
83
	    <!-- 出现异常最大重试次数 -->
84
	    <config name="maxAttempts"/>
85
	</cache>
86
	
87
	<cache name="pushServer_route" type="redis">
88
		<servers>
89
	        <!-- 如果不是cluster,则只使用第一个redis -->
90
	        <server ip="121.42.183.206" port="7101" />
91
	        <server ip="121.42.183.206" port="7102" />
92
	        <server ip="121.42.183.206" port="7103" />
93
	        <server ip="121.42.183.206" port="7104" />
94
	        <server ip="121.42.183.206" port="7105" />
95
	        <server ip="121.42.183.206" port="7106" />
96
	    </servers>
97
		<!-- 客户端类型:Jedis,JedisCluster -->
98
	    <config name="clientType" value="JedisCluster"/>
99
	    <!-- 访问redis的密码,可以为空 -->
100
	    <config name="auth" value="Ipu@321!"/>
101
	    <!-- redis池的可用连接实例的最大数目,缺省为8 -->
102
	    <config name="poolSize" value="10"/>
103
	    <!-- redis池最多有多少个状态为idle(空闲的)的jedis实例,缺省为8,空闲连接大于这个数会进行回收 -->
104
	    <config name="maxIdle"/>
105
	    <!-- 最小空闲数,空闲连接小于这个数会建立新的连接,缺省为0 -->
106
	    <config name="minIdle"/>
107
	    <!-- 等待Response超时时间,默认2000ms -->
108
	    <config name="soTimeout"/>
109
	    <!-- 连接Redis Server超时时间,默认2000ms -->
110
	    <config name="connTimeout"/>
111
	    <!-- 出现异常最大重试次数 -->
112
	    <config name="maxAttempts"/>
113
	</cache>
114
</caches>

+ 77 - 0
ebc-sea-platform/src/main/resources/pro/sso.properties

@ -0,0 +1,77 @@
1
#\u7CFB\u7EDF\u57DF
2
SYSTEM_DOMAIN=LOGIN_CACHE_ROUTE
3
4
#------------------------------cookie\u914D\u7F6E-------------#
5
##COOKIE\u7684\u6709\u6548\u57DF,\u4E0D\u8BBE\u7F6E\uFF0C\u5219\u81EA\u52A8\u8BBE\u7F6E
6
#COOKIE_DOMAIN=crm.chinapost.yw.com
7
8
COOKIE_PATH=/
9
10
##Session \u8D85\u65F6\u65F6\u95F4(\u79D2)
11
SESSION_TIMEOUT=3600
12
COOKIE_MAXAGE=-1
13
14
15
TENANT_REGISTER_CLASS=com.ai.customermanager.services.impl.CustRegisterVercodeImpl
16
17
18
##\u8FDC\u7A0B\u7F13\u5B58\u8C03\u7528\u7C7B\uFF0C\u8FD9\u4E2A\u7C7B\u5FC5\u987B\u6709\u4E09\u4E2A\u51FD\u6570 
19
##    public boolean set(String key,String value)
20
##    public String get(String key)
21
##    public boolean del(String key);
22
COOKIE_CACHE_CLASS=com.ai.sso.util.SessionRedisCache
23
24
LOGGING_INTERFACE_CLASS=com.wframe.baseinfo.util.BaseInfoUtil
25
26
##COOKIE_IS_CACHE \u662F\u5426\u7F13\u5B58\u5230\u8FDC\u7AEF\u3002
27
COOKIE_IS_CACHE=1
28
29
30
##IS_CHECK_LOGIN \u662F\u5426\u68C0\u67E5\u767B\u9646\u3002
31
IS_CHECK_LOGIN=1
32
33
34
LOGIN_SERVICE=uspa_IOrgmodelClientCSV_loginIn
35
LOGINNOPASS_SERVICE=uspa_IOrgmodelClientCSV_loginWithNoPassword
36
37
38
Access-Control-Allow-origin=http://crm.chinapost.yw.com:18080/
39
40
##\u68C0\u67E5SesisonId,sign \u662F\u5426\u6B63\u786E
41
SESSION_CHECK_SIGN=com.ai.sso.util.SessionCheckSign
42
SESSION_CHECK_LOGIN=com.ai.sso.util.SessionCheckLogin
43
#redis
44
45
##MAIN_PAGE
46
#MAIN_PAGE=http://crm.chinapost.com:18880/
47
##RETURN TAG \u8FD4\u56DE\u5B57\u7B26\u4E32
48
49
RETURN_TAG={"MESSAGE":"NOLOGIN","CODE":999999,"FLAG":"FAIL","RESULT":{"URL":"http://crm.chinapost.yw.com:18080/"}}
50
#RETURN_TAG=<html><script language="javascript"> function init(){ if(window.parent!=null) { window.parent.location.href ="http://crm.chinapost.com:18880"; } else window.location.href ="http://crm.chinapost.com:18880"; } </script><body onload="init()"></body></html>
51
52
53
54
redis.single=10.11.20.117:6379
55
redis.pool.maxTotal=1000
56
redis.pool.minIdle=5
57
redis.pool.maxIdle=100
58
redis.pool.testOnBorrow=false
59
redis.pool.maxWait=5000
60
redis.pool.testOnReturn=true
61
redis.pool.testWhileIdle=true
62
redis.pool.timeBetweenEvictionRunsMillis=10000
63
redis.password=luMZulgbotmo71aa
64
65
SESSION_DEFAULT_VERCODE=Hiz#8uAqkjhoPmXu8%aaa
66
67
#\u662F\u5426\u8FDB\u884C\u63A5\u53E3\u6743\u9650\u63A7\u5236 1 \u8FDB\u884C\u63A5\u53E3\u6743\u9650\u63A7\u5236 
68
is_check_interface=0
69
70
71
#BJYM\u4F7F\u7528
72
#USER_LOGIN_AUTH_CLASS=com.wframe.msgmanager.services.impl.UserLoginAuth4TestImpl
73
##\u5C0F\u7A0B\u5E8F\u4F7F\u7528
74
USER_LOGIN_AUTH_CLASS=com.wframe.usermanager.services.impl.UserLoginAuthImpl
75
#USER_LOGIN_AUTH_CLASS=com.wframe.msgmanager.services.impl.UserLoginByTokenImpl
76
#USER_LOGIN_AUTH_CLASS=com.wframe.msgmanager.services.impl.UserLoginByToken4XblImpl
77
SIGN_KEY_CODE=TENANT_CODE

ipu/android-share - Nuosi Git Service

23 Commitit (master)

Tekijä SHA1 Viesti Päivämäärä
  huangbo 9753ad45b9 重置工程配置文件 6 vuotta sitten
  huangbo 95a6402476 增加<config name="res_host" value="http://10.0.2.2:8080/res"/> 6 vuotta sitten
  huangbo 48a347e84c 工程优化 9 vuotta sitten
  huangbo f022744dad 工程优化 9 vuotta sitten
  huangbo 33c3afbba1 添加 9 vuotta sitten
  huangbo ded8f2f946 删除.classpath和project.properties配置文件 9 vuotta sitten
  huangbo 02e94b88f2 1 9 vuotta sitten
  huangbo c9d2f005b4 Merge branch 'master' of 9 vuotta sitten
  huangbo d60c4b21db 1 9 vuotta sitten
  huangbo d55f8d779a 1 9 vuotta sitten
  yangbiao 74d502002d 资源文件合并 9 vuotta sitten
  yangbiao 5746281d06 更新 9 vuotta sitten
  yangbiao 3d8a4da7cf 删除classpath和project.properties 9 vuotta sitten
  yangbiao ac402c674b 修改路径 9 vuotta sitten
  huangbo 84a3348d7b Merge branch 'master' of http://114.215.100.48:3000/ipu/android-share 9 vuotta sitten
  yangbiao eafaf219ff dd 9 vuotta sitten
  yangbiao 911b1a31eb a 9 vuotta sitten
  huangbo f51b609c11 1 9 vuotta sitten
  huangbo 5ff196fb48 1 9 vuotta sitten
  yangbiao 0afd1f8d54 a 9 vuotta sitten
  huangbo 497a6c8cd5 1 9 vuotta sitten
  wangxl 94e369733a remove oEvent 9 vuotta sitten
  yangbiao 62badf2f3b aa 10 vuotta sitten