re> map2.put("deviceNo", "981489");// 终端编号 211
		map2.put("longitude", "125.4221927");// 经度
212
		map2.put("latitude", "32.0453331");// 纬度
213
		map2.put("newDate", "2020-10-26 11:22:33");// 最新定位时间
214
		list.add(map2);
215
216
		Map<String, String> map3 = new HashMap<String, String>();
217
		map3.put("userName", "王五");// 人员姓名
218
		map3.put("locationStatus", EbcConstant.location_status_normal);// 状态: 0定位
219
		map3.put("deviceId", "981453");// 终端ID
220
		map3.put("deviceNo", "981453");// 终端编号
221
		map3.put("longitude", "122.0221926");// 经度
222
		map3.put("latitude", "33.5453331");// 纬度
223
		map3.put("newDate", "2020-10-27 12:31:45");// 最新定位时间
224
		list.add(map3);
225
226
		Map<String, String> map4 = new HashMap<String, String>();
227
		map4.put("userName", "赵六");// 人员姓名
228
		map4.put("locationStatus", EbcConstant.location_status_normal);// 状态: 0定位
229
		map4.put("deviceId", "23125");// 终端ID
230
		map4.put("deviceNo", "23125");// 终端编号
231
		map4.put("longitude", "125.3221927");// 经度
232
		map4.put("latitude", "33.3453331");// 纬度
233
		map4.put("newDate", "2020-10-27 13:40:40");// 最新定位时间
234
		list.add(map4);
235
236
		Map<String, String> map5 = new HashMap<String, String>();
237
		map5.put("userName", "田七");// 人员姓名
238
		map5.put("locationStatus", EbcConstant.location_status_normal);// 状态: 0定位
239
		map5.put("deviceId", "23126");// 终端ID
240
		map5.put("deviceNo", "23126");// 终端编号
241
		map5.put("longitude", "125.4221927");// 经度
242
		map5.put("latitude", "32.9453331");// 纬度
243
		map5.put("newDate", "2020-10-27 18:20:30");// 最新定位时间
244
		list.add(map5);
245
246
		Map<String, String> map6 = new HashMap<String, String>();
247
		map6.put("userName", "周八");// 人员姓名
248
		map6.put("locationStatus", EbcConstant.location_status_exclusion);// 状态:3违规(禁区)
249
		map6.put("deviceId", "23128");// 终端ID
250
		map6.put("deviceNo", "23128");// 终端编号
251
		map6.put("longitude", "124.5309335");// 经度
252
		map6.put("latitude", "33.7753425");// 纬度
253
		map6.put("newDate", "2020-10-27 14:28:38");// 最新定位时间
254
		list.add(map6);
255
256
		Map<String, String> map7 = new HashMap<String, String>();
257
		map7.put("userName", "吴九");// 人员姓名
258
		map7.put("locationStatus", EbcConstant.location_status_offline);// 状态:1离线
259
		map7.put("deviceId", "23129");// 终端ID
260
		map7.put("deviceNo", "23129");// 终端编号
261
		map7.put("longitude", "122.4221927");// 经度
262
		map7.put("latitude", "32.6453331");// 纬度
263
		map7.put("newDate", "2020-10-27 14:15:22");// 最新定位时间
264
		list.add(map7);
265
266
		return list;
267
	}
268
	
269 193
	@Override
270 194
	public List<Map<String, String>> queryCurrentDeviceLocationInfo(JMap params) throws Exception {
271 195
		// 获取已绑定的设备列表
@ -300,34 +224,58 @@ public class DeviceManageServiceImpl implements DeviceManageService {
300 224
			map.put("locationStatus", EbcConstant.location_status_normal);// 定位状态
301 225
			
302 226
			boolean flag = true;
303
			// 设备绑定的信息
227
			
228
			// 人员名称
304 229
			for (Map<String, Object> bindDeviceMap : bindUserDeviceList) {
305 230
				if (deviceId.equals(String.valueOf(bindDeviceMap.get("DEVICE_ID")))) {
306 231
					map.put("userName", String.valueOf(bindDeviceMap.get("NAME")));
307 232
					break;
308 233
				}
309 234
			}
310
235
			
236
			//离线信息
237
			if (map.get("alarmType")!=null&&EbcConstant.alarm_type_offline_beidou==Integer.parseInt(String.valueOf(map.get("alarmType")))) {
238
				map.put("locationStatus",EbcConstant.location_status_offline);//定位状态
239
				map.put("alarmType",EbcConstant.alarm_type_offline_ZH);//报警类型
240
				flag = false;
241
			}
242
			
243
			// 求救信息
311 244
			if (alarmMapList != null && flag) {
312
				// 求救信息
313 245
				for (int i = 0; i < alarmMapList.size() && flag; i++) {
314 246
					Map<String, Object> alarmMap = alarmMapList.get(i);
315 247
					if (deviceId.equals(String.valueOf(alarmMap.get("DEVICE_ID")))) {
316 248
						// 求救时间
317 249
						String alarmDate = String.valueOf(alarmMap.get("CALLER_DATE"));
318
						map.put("alarmDate", alarmDate);
250
						map.put("alarmDate", DateUtil.formatStrDate(alarmDate));
319 251
320 252
						// 计算求救时长
321
						int alarmLong = JingPingSendDateUtil.getBetweenMinuteValue(alarmDate, map.get("newDate"));
253
						int alarmLong = DateUtil.getDifferenceMinute(alarmDate, map.get("newDate"));
322 254
						map.put("alarmLong", String.valueOf(alarmLong));
323
255
						
256
						//定位状态
257
						switch (String.valueOf(alarmMap.get("ALARM_TYPE"))) {
258
						case EbcConstant.alarm_type_autosos_ZH:
259
							//自动报警
260
							map.put("locationStatus",EbcConstant.location_status_autosos);
261
							map.put("alarmType",EbcConstant.alarm_type_autosos_ZH);
262
							break;
263
						case EbcConstant.alarm_type_jogsos_ZH:
264
							//手动报警
265
							map.put("locationStatus",EbcConstant.location_status_jogsos);
266
							map.put("alarmType",EbcConstant.alarm_type_jogsos_ZH);
267
							break;
268
						default:
269
							break;
270
						}
271
						
324 272
						flag = false;
325 273
					}
326 274
				}
327 275
			}
328 276
277
			// 违规信息
329 278
			if (areaViolationMapList != null && flag) {
330
				// 违规信息
331 279
				int maxMapTagGrade = 0; // 围栏优先级(电子围栏5>定点3>考勤1、作业1)
332 280
				long minInAreaLong = System.currentTimeMillis();// 进入围栏最早的时间戳
333 281
				Map<String, Object> areaInfoMap = null;// 用于计算时间的围栏信息
@ -365,15 +313,13 @@ public class DeviceManageServiceImpl implements DeviceManageService {
365 313
366 314
				// 判断是否在违规
367 315
				if (maxMapTagGrade == 5) {
368
					logger.info("镜屏推送进入电子围栏的信息");
369 316
					// 进入电子围栏(禁区),需显示进入时间
370 317
					map.put("inDate", simpleDateFormat.format(areaInfoMap.get("IN_DATE"))); // 进入时间
371 318
					map.put("locationStatus", EbcConstant.location_status_exclusion); // 定位状态
372 319
373 320
				} else if (maxMapTagGrade == 3) {
374 321
					// 进入定点(限时),需计算是否超时
375
					int fixedLong = JingPingSendDateUtil
376
							.getBetweenMinuteValue(String.valueOf(areaInfoMap.get("IN_DATE")), map.get("newDate"));
322
					int fixedLong = DateUtil.getDifferenceMinute(String.valueOf(areaInfoMap.get("IN_DATE")), map.get("newDate"));
377 323
378 324
					if (fixedLong > 0) {
379 325
						// 围栏要求定点时间

+ 19 - 6
ebc-sea-platform/src/main/java/com/ai/ipu/server/service/impl/ReceiveSubscribeServiceImpl.java

@ -22,6 +22,7 @@ import com.ai.ipu.server.dao.interfaces.DeviceManageDao;
22 22
import com.ai.ipu.server.dao.interfaces.MapTagManageDao;
23 23
import com.ai.ipu.server.dao.interfaces.RescueDao;
24 24
import com.ai.ipu.server.service.interfaces.ReceiveSubscribeService;
25
import com.ai.ipu.server.util.DateUtil;
25 26
import com.ai.ipu.server.util.EbcConstant;
26 27
import com.ai.ipu.server.util.JingPingSendDateUtil;
27 28
import com.alibaba.fastjson.JSON;
@ -51,6 +52,7 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
51 52
			public void run() {
52 53
				try {
53 54
					logger.debug("启动定位信息新线程:" + Thread.currentThread().getName());
55
					// 处理定位数据
54 56
					executeReceiveIotLocationData(dataMap);
55 57
56 58
					logger.debug("数据库连接全量提交");
@ -75,6 +77,7 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
75 77
			public void run() {
76 78
				try {
77 79
					logger.debug("启动报警信息新线程:" + Thread.currentThread().getName());
80
					// 处理报警数据
78 81
					executeReceiveIotAlarmData(dataMap);
79 82
80 83
					logger.debug("数据库连接全量提交");
@ -103,6 +106,7 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
103 106
		Map<String, Object> bindInfoMap = deviceManageDao.queryOneBindUser(params.getString("deviceId"), null);
104 107
105 108
		if (bindInfoMap != null) {
109
			// 设备与人员绑定
106 110
			logger.debug("定位信息的对象为人员: " + bindInfoMap.get("NAME"));
107 111
			params.put("userName", bindInfoMap.get("NAME"));
108 112
			params.put("userCode", bindInfoMap.get("CODE"));
@ -110,6 +114,7 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
110 114
		} else {
111 115
			bindInfoMap = deviceManageDao.queryOneBindShip(params.getString("deviceId"), null);
112 116
			if (bindInfoMap != null) {
117
				// 设备与船舶绑定
113 118
				logger.info("定位信息的对象为船舶: " + bindInfoMap.get("NAME"));
114 119
				params.put("shipName", bindInfoMap.get("NAME"));
115 120
				params.put("shipCode", bindInfoMap.get("CODE"));
@ -119,6 +124,7 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
119 124
				logger.debug("推送镜屏数据:" + jingpingData);
120 125
				JingPingSendDateUtil.sendData(JingPingSendDateUtil.topic_ship, jingpingData);
121 126
			} else {
127
				// 设备未绑定
122 128
				logger.error("定位设备未绑定");
123 129
			}
124 130
			return;
@ -168,10 +174,10 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
168 174
169 175
		// 求救时间
170 176
		String alarmDate = String.valueOf(alarmList.get(0).get("CALLER_DATE"));
171
		params.put("alarmDate", alarmDate);
177
		params.put("alarmDate", DateUtil.formatStrDate(alarmDate));
172 178
173 179
		// 计算求救时长
174
		params.put("alarmLong", JingPingSendDateUtil.getBetweenMinuteValue(alarmDate, params.getString("newDate")));
180
		params.put("alarmLong", DateUtil.getDifferenceMinute(alarmDate, params.getString("newDate")));
175 181
176 182
		params.put("isNewAlarm", "0");
177 183
@ -180,6 +186,12 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
180 186
		logger.debug("推送镜屏数据:" + jingpingData);
181 187
		JingPingSendDateUtil.sendData(JingPingSendDateUtil.topic_personnel, jingpingData);
182 188
189
		// 修改最后定位时间
190
		Map<String, Object> dataMap = new HashMap<String, Object>();
191
		dataMap.put("LOG_ID", alarmList.get(0).get("LOG_ID")); // 日志ID
192
		dataMap.put("LAST_LOCATION_DATE", params.get("newDate")); // 最后定位时间
193
		rescueDao.modifyRescueLog(dataMap);
194
183 195
		return true;
184 196
	}
185 197
@ -265,7 +277,7 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
265 277
		if (!beforeAreaMapList.isEmpty()) {
266 278
			List<String> outAreaIdList = new ArrayList<String>();
267 279
			for (Map<String, Object> beforeAreaMap : beforeAreaMapList) {
268
				outAreaIdList.add(String.valueOf(beforeAreaMap.get("MAP_TAG_ID")));
280
				outAreaIdList.add(String.valueOf(beforeAreaMap.get("RECORD_ID")));
269 281
			}
270 282
271 283
			areaInOutRecordDao.updateSameOutTimeAreaOutRecord(params.getString("newDate"), outAreaIdList);
@ -333,12 +345,12 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
333 345
		if (maxMapTagGrade == 5) {
334 346
			logger.info("镜屏推送进入电子围栏的信息");
335 347
			// 进入电子围栏(禁区),需显示进入时间
336
			params.put("inDate", simpleDateFormat.format(sendDataAreaInfo.get("inAreaDate"))); // 进入时间
348
			params.put("inDate", sendDataAreaInfo.get("inAreaDate")); // 进入时间
337 349
			params.put("locationStatus", EbcConstant.location_status_exclusion); // 定位状态
338 350
339 351
		} else if (maxMapTagGrade == 3) {
340 352
			// 进入定点(限时),需计算是否超时
341
			int fixedLong = JingPingSendDateUtil.getBetweenMinuteValue(
353
			int fixedLong = DateUtil.getDifferenceMinute(
342 354
					String.valueOf(sendDataAreaInfo.get("inAreaDate")), params.getString("newDate"));
343 355
344 356
			if (fixedLong > 0) {
@ -417,7 +429,8 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
417 429
		dataMap.put("ALARM_TYPE", params.get("alarmType")); // 告警类型
418 430
		dataMap.put("LONGITUDE", params.get("longitude")); // 报警经度
419 431
		dataMap.put("LATITUDE", params.get("latitude")); // 报警纬度
420
		dataMap.put("CALLER_DATE", params.get("msgDate")); // 报警时间
432
		dataMap.put("CALLER_DATE", params.get("newDate")); // 报警时间
433
		dataMap.put("LAST_LOCATION_DATE", params.get("newDate")); // 最后定位时间
421 434
422 435
		// 报警位置
423 436
		if (currentAreaInfoJMap.getInt("mapTagNum") > 0) {

+ 193 - 0
ebc-sea-platform/src/main/java/com/ai/ipu/server/util/DateUtil.java

@ -0,0 +1,193 @@
1
package com.ai.ipu.server.util;
2
3
import java.math.BigDecimal;
4
import java.text.ParseException;
5
import java.text.SimpleDateFormat;
6
import java.util.Date;
7
8
import com.ai.ipu.common.date.TimeUtil;
9
10
/**
11
 * 时间工具类
12
 * @author konghl@asiainfo.com
13
 * 2020-11-2
14
 */
15
public class DateUtil {
16
17
	/**
18
	 * 比较日期大小
19
	 * @param dateStr0
20
	 * @param dateStr1
21
	 * @return
22
	 */
23
	public static int compareDate(String dateStr0, String dateStr1) {
24
		Date date1 = convertDate(dateStr0);
25
		Date date2 = convertDate(dateStr1);
26
		int result = date1.compareTo(date2);
27
		return result;
28
	}
29
30
	/**
31
	 * 格式化字符串时间
32
	 * @param date
33
	 * @return yyyy-MM-dd HH:mm:ss
34
	 */
35
	public static String formatStrDate(String dateStr) {
36
		Date date = convertDate(dateStr);
37
		return formatDate(date, "yyyy-MM-dd HH:mm:ss");
38
	}
39
40
	/**
41
	 * 时间转字符串 
42
	 * @param date
43
	 * @return yyyy-MM-dd HH:mm:ss
44
	 */
45
	public static String formatDate(Date date) {
46
		return formatDate(date, "yyyy-MM-dd HH:mm:ss");
47
	}
48
49
	/**
50
	 * 时间转字符串
51
	 * @param date
52
	 * @param pattern 时间格式
53
	 * @return
54
	 */
55
	public static String formatDate(Date date, String pattern) {
56
		if (date == null) {
57
			return "";
58
		}
59
60
		SimpleDateFormat formatter = new SimpleDateFormat(pattern);
61
		return formatter.format(date);
62
	}
63
64
	/**
65
	 * 字符串转时间
66
	 * @param dateStr
67
	 * @return
68
	 */
69
	public static Date convertDate(String dateStr) {
70
		if (dateStr == null || "".equals(dateStr)) {
71
			return null;
72
		}
73
		String pattern = TimeUtil.getTimestampFormat(dateStr);
74
		return convertDate(dateStr, pattern);
75
	}
76
77
	/**
78
	 * 字符串转时间
79
	 * @param dateStr
80
	 * @param pattern
81
	 * @return
82
	 */
83
	public static Date convertDate(String dateStr, String pattern) {
84
		if (dateStr == null || "".equals(dateStr)) {
85
			return null;
86
		}
87
88
		if (pattern == null || "".equals(pattern)) {
89
			pattern = TimeUtil.getTimestampFormat(dateStr);
90
		}
91
92
		SimpleDateFormat formatter = new SimpleDateFormat(pattern);
93
		Date date = null;
94
		try {
95
			date = formatter.parse(dateStr);
96
		} catch (ParseException e) {
97
			e.printStackTrace();
98
		}
99
		return date;
100
	}
101
102
	/**
103
	 * 计算两个时间差,返回毫秒数(endDate-beginDate)
104
	 * @param beginDate
105
	 * @param endDate
106
	 * @return 
107
	 * @throws ParseException
108
	 */
109
	public static long getDifferenceMillisecond(Date beginDate, Date endDate) throws ParseException {
110
		long beginDateLong = 0L;
111
		long endDateLong = 0L;
112
		if (beginDate != null) {
113
			beginDateLong = beginDate.getTime();
114
		}
115
		if (endDate != null) {
116
			endDateLong = endDate.getTime();
117
		}
118
119
		return endDateLong - beginDateLong;
120
	}
121
122
	/**
123
	 * 计算两个时间差,返回毫秒数(endDate-beginDate)
124
	 * @param beginDateStr
125
	 * @param endDateStr
126
	 * @return 
127
	 * @throws ParseException
128
	 */
129
	public static long getDifferenceMillisecond(String beginDateStr, String endDateStr) throws ParseException {
130
		Date beginDate = convertDate(beginDateStr);
131
		Date endDate = convertDate(endDateStr);
132
		return getDifferenceMillisecond(beginDate, endDate);
133
	}
134
135
	/**
136
	 * 计算两个时间差,返回分钟数(endDate-beginDate)
137
	 * @param beginDate
138
	 * @param endDate
139
	 * @return
140
	 * @throws ParseException 
141
	 */
142
	public static int getDifferenceMinute(String beginDateStr, String endDateStr) throws ParseException {
143
		long diffMillisecond = getDifferenceMillisecond(beginDateStr, endDateStr);
144
		if (diffMillisecond > 0) {
145
			BigDecimal diffMillisecondBigDecimal = new BigDecimal(diffMillisecond);
146
			// 单位为分,四舍五入不保留小数
147
			BigDecimal diffMinuteBigDecimal = diffMillisecondBigDecimal.divide(new BigDecimal("60000"), 0,
148
					BigDecimal.ROUND_HALF_UP);
149
			return diffMinuteBigDecimal.intValue();
150
		} else {
151
			return 0;
152
		}
153
154
	}
155
156
	/**
157
	 * 计算两个时间差,返回字符串(endDate-beginDate)
158
	 * @param beginDateStr
159
	 * @param endDateStr
160
	 * @return
161
	 * @throws ParseException
162
	 */
163
	public static String getDifferenceString(String beginDateStr, String endDateStr) throws ParseException {
164
		long diffMillisecond = getDifferenceMillisecond(beginDateStr, endDateStr);
165
166
		if (diffMillisecond <= 60000) {
167
			return "0分钟";
168
		}
169
170
		BigDecimal diffMillisecondBigDecimal = new BigDecimal(diffMillisecond);
171
		BigDecimal diffMinuteBigDecimal = diffMillisecondBigDecimal.divide(new BigDecimal("60000"), 0,
172
				BigDecimal.ROUND_DOWN);
173
		BigDecimal diffHourBigDecimal = diffMinuteBigDecimal.divide(new BigDecimal("60"), 0, BigDecimal.ROUND_DOWN);
174
		BigDecimal diffdayBigDecimal = diffHourBigDecimal.divide(new BigDecimal("24"), 0, BigDecimal.ROUND_DOWN);
175
176
		int diffMinute = diffMinuteBigDecimal.subtract(diffHourBigDecimal.multiply(new BigDecimal("60"))).intValue();
177
		int diffHour = diffHourBigDecimal.subtract(diffdayBigDecimal.multiply(new BigDecimal("24"))).intValue();
178
		int diffDay = diffHourBigDecimal.subtract(diffdayBigDecimal.multiply(new BigDecimal("24"))).intValue();
179
180
		StringBuilder diffStr = new StringBuilder();
181
		if (diffDay > 0) {
182
			diffStr.append(diffDay).append("天");
183
		}
184
		if (diffHour > 0) {
185
			diffStr.append(diffHour).append("小时");
186
		}
187
		if (diffMinute > 0) {
188
			diffStr.append(diffMinute).append("分钟");
189
		}
190
191
		return diffStr.toString();
192
	}
193
}

+ 20 - 16
ebc-sea-platform/src/main/java/com/ai/ipu/server/util/EbcConstant.java

@ -42,39 +42,45 @@ public class EbcConstant {
42 42
	// 围栏标记类型:定点
43 43
	public static final String area_type_temporariness = "4";
44 44
45
	//定位状态:正常
45
	//人员定位状态:正常
46 46
	public static final String location_status_normal="0";
47 47
	
48
	//定位状态:离线
48
	//人员定位状态:离线
49 49
	public static final String location_status_offline="1";
50 50
	
51
	//定位状态:定点(超时)违规
51
	//人员定位状态:定点(超时)违规
52 52
	public static final String location_status_overtime="2";
53 53
	
54
	//定位状态:电子围栏(禁区)违规
54
	//人员定位状态:电子围栏(禁区)违规
55 55
	public static final String location_status_exclusion ="3";
56 56
	
57
	//人员状态:SOS(自动)
57
	//人员定位状态:SOS(自动)
58 58
	public static final String location_status_autosos="4";
59 59
	
60
	//人员状态:SOS(手动)
60
	//人员定位状态:SOS(手动)
61 61
	public static final String location_status_jogsos="5";
62 62
	
63
	//人员状态:救援人员
63
	//人员定位状态:救援人员
64 64
	public static final String location_status_rescuers="6";
65 65
	
66
	//告警类型:SOS(手动)
67
	public static final int alarm_type_jogsos_beidou=2;
68
	
69
	//告警类型:SOS(自动)
70
	public static final int alarm_type_autosos_beidou=1;
71
	
66 72
	//告警类型:离线
67
	public static final String alarm_type_offline="离线告警";
73
	public static final int alarm_type_offline_beidou=4;
68 74
	
69 75
	//告警类型:SOS(手动)
70
	public static final String alarm_type_jogsos="手动告警";
71
	
72
	//人员状态:SOS(手动)
73
	public static final String location_status_jogsos_ZH="手动告警";
76
	public static final String alarm_type_jogsos_ZH="手动告警";
74 77
	
75
	//人员状态:SOS(自动)
76
	public static final String location_status_autosos_ZH="落水告警";
78
	//告警类型:SOS(动)
79
	public static final String alarm_type_autosos_ZH="落水告警";
77 80
81
	//告警类型:离线
82
	public static final String alarm_type_offline_ZH="离线告警";
83
	
78 84
	//考勤查询日
79 85
	public static final String  AREA_IN_OUT_RECORD_DAY="day";
80 86
@ -83,7 +89,5 @@ public class EbcConstant {
83 89
84 90
	//考勤查询月
85 91
	public static final String AREA_IN_OUT_RECORD_MONTH="month";
86
	//告警类型:SOS(自动)
87
	public static final String alarm_type_autosos="落水告警";
88 92
89 93
}

+ 0 - 28
ebc-sea-platform/src/main/java/com/ai/ipu/server/util/JingPingSendDateUtil.java

@ -1,9 +1,5 @@
1 1
package com.ai.ipu.server.util;
2 2
3
import java.math.BigDecimal;
4
import java.text.ParseException;
5
import java.text.SimpleDateFormat;
6
7 3
import com.ai.ipu.server.connect.ps.EventChannelTool;
8 4
import com.ai.ipu.server.connect.ps.EventChannelTool.PublisherEvent;
9 5
import com.ai.ipu.server.connect.ps.ISubscriber;
@ -38,28 +34,4 @@ public class JingPingSendDateUtil {
38 34
		};
39 35
		publisher.publish(topic, publisherEvent);
40 36
	}
41
42
	/**
43
	 * 计算两个时间相隔的分钟数(endDate-beginDate)
44
	 * @param beginDate
45
	 * @param endDate
46
	 * @return
47
	 * @throws ParseException 
48
	 */
49
	public static int getBetweenMinuteValue(String beginDate, String endDate) throws ParseException {
50
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
51
		long endDateLong = simpleDateFormat.parse(endDate).getTime();
52
		long beginDateLong = simpleDateFormat.parse(beginDate).getTime();
53
		long alarmLong = endDateLong - beginDateLong;
54
		if (alarmLong>0) {
55
			BigDecimal alarmLongBigDecimal = new BigDecimal(alarmLong);
56
			// 单位为分,四舍五入不保留小数
57
			alarmLongBigDecimal = alarmLongBigDecimal.divide(new BigDecimal("60000"), 0, BigDecimal.ROUND_HALF_UP);
58
			return alarmLongBigDecimal.intValue();
59
		}else {
60
			return 0;
61
		}
62
		
63
	}
64
65 37
}

common-ui - Nuosi Git Service

AIoT前端公共UI

liuyang ae7c7c9fa5 update: 修改配置信息 2 anni fa
..
bread 8a1c11d7f5 update: 优化common-ui的文档内容 2 anni fa
card f04c75f677 update: 更新UI说明文档 2 anni fa
complex-form f04c75f677 update: 更新UI说明文档 2 anni fa
dialog f04c75f677 update: 更新UI说明文档 2 anni fa
drawer f04c75f677 update: 更新UI说明文档 2 anni fa
form 8a1c11d7f5 update: 优化common-ui的文档内容 2 anni fa
icon f04c75f677 update: 更新UI说明文档 2 anni fa
info f04c75f677 update: 更新UI说明文档 2 anni fa
layer f04c75f677 update: 更新UI说明文档 2 anni fa
page-panel f04c75f677 update: 更新UI说明文档 2 anni fa
panel f04c75f677 update: 更新UI说明文档 2 anni fa
search f04c75f677 update: 更新UI说明文档 2 anni fa
select 8a1c11d7f5 update: 优化common-ui的文档内容 2 anni fa
table f04c75f677 update: 更新UI说明文档 2 anni fa
tree f04c75f677 update: 更新UI说明文档 2 anni fa
index.md ae7c7c9fa5 update: 修改配置信息 2 anni fa