375
		String beginTime = null;// 开始时间
376
		String endTime = null;// 结束时间
377
378
		// 时间段类型
361 379
		switch (params.getString("timeType")) {
362 380
		case EbcConstant.locus_time_interval_tenMinute:
363
			//10分钟
364
			endTime=TimeUtil.getSysTime();
365
			beginTime=DateUtil.dateAddMinute(endTime, -10);
381
			// 10分钟
382
			endTime = TimeUtil.getSysTime();
383
			beginTime = DateUtil.dateAddMinute(endTime, -10);
366 384
			break;
367 385
		case EbcConstant.locus_time_interval_oneHour:
368
			//1小时
369
			endTime=TimeUtil.getSysTime();
370
			beginTime=DateUtil.dateAddHour(endTime, -1);
386
			// 1小时
387
			endTime = TimeUtil.getSysTime();
388
			beginTime = DateUtil.dateAddHour(endTime, -1);
371 389
			break;
372 390
		case EbcConstant.locus_time_interval_oneDay:
373
			//1天
374
			endTime=TimeUtil.getSysTime();
375
			beginTime=DateUtil.dateAddDay(endTime, -1);
391
			// 1天
392
			endTime = TimeUtil.getSysTime();
393
			beginTime = DateUtil.dateAddDay(endTime, -1);
376 394
			break;
377 395
		case EbcConstant.locus_time_interval_custom:
378
			//自定义
379
			beginTime=params.getString("beginTime");
380
			endTime=params.getString("endTime");
381
			if (beginTime==null||"".equals(beginTime)||endTime==null||"".equals(endTime)) {
396
			// 自定义
397
			beginTime = params.getString("beginTime");
398
			endTime = params.getString("endTime");
399
			if (beginTime == null || "".equals(beginTime) || endTime == null || "".equals(endTime)) {
382 400
				resultJMap.put("result", false);
383 401
				resultJMap.put("errMsg", "日期不能为空");
384 402
				return resultJMap;
@ -389,13 +407,13 @@ public class DeviceManageServiceImpl implements DeviceManageService {
389 407
			resultJMap.put("errMsg", "时间段无效");
390 408
			return resultJMap;
391 409
		}
392
		
410
393 411
		Map<String, String> paramsMap = new HashMap<String, String>();
394
		paramsMap.put("resourceId", params.getString("deviceId"));//终端ID
412
		paramsMap.put("resourceId", params.getString("deviceId"));// 终端ID
395 413
		paramsMap.put("startTime", beginTime);
396 414
		paramsMap.put("endTime", endTime);
397
		
398
		resultJMap= deviceManageDao.queryOneDeviceLocationInfo(paramsMap, pageNum, pageSize);
415
416
		resultJMap = deviceManageDao.queryOneDeviceLocationInfo(paramsMap, pageNum, pageSize);
399 417
		return resultJMap;
400 418
	}
401 419

+ 98 - 60
ebc-sea-platform/src/main/java/com/ai/ipu/server/service/impl/RescueServiceImpl.java

@ -5,6 +5,10 @@ import java.util.HashMap;
5 5
import java.util.List;
6 6
import java.util.Map;
7 7
8
import javax.websocket.Session;
9
10
import org.slf4j.Logger;
11
import org.slf4j.LoggerFactory;
8 12
import org.springframework.beans.factory.annotation.Autowired;
9 13
import org.springframework.stereotype.Service;
10 14
@ -18,19 +22,19 @@ import com.ai.ipu.server.util.EbcConstant;
18 22
19 23
@Service
20 24
public class RescueServiceImpl implements RescueService {
25
	Logger logger = LoggerFactory.getLogger(RescueServiceImpl.class);
21 26
22 27
	@Autowired
23 28
	RescueDao rescueDao;
24
	
29
25 30
	@Autowired
26 31
	DeviceManageDao deviceManageDao;
27 32
28 33
	@Override
29 34
	public List<Map<String, Object>> queryListRescuerInfo(JMap params, int pageNum, int pageSize) throws Exception {
30
		// TODO 调用uspa接口获取人员信息 暂时用枚举(救援的部门为2)
31
		return UserEnums.getUserListByDepy(2);
35
		return rescueDao.queryListRescuerInfo(params, pageNum, pageSize);
32 36
	}
33
	
37
34 38
	@Override
35 39
	public boolean assignRescuer(JMap params) throws Exception {
36 40
		// 修改最后定位时间
@ -51,8 +55,7 @@ public class RescueServiceImpl implements RescueService {
51 55
52 56
	@Override
53 57
	public JMap queryPageRescueLog(JMap params, int pageNum, int pageSize) throws Exception {
54
		//TODO 计算求救时间、按时间查询
55
		
58
		// TODO 计算求救时间、按时间查询
56 59
		
57 60
		return rescueDao.queryPageRescueLog(params, pageNum, pageSize);
58 61
	}
@ -63,91 +66,126 @@ public class RescueServiceImpl implements RescueService {
63 66
	}
64 67
65 68
	@Override
66
	public List<Map<String, String>> queryCurrentRescueLocationInfo(JMap params) throws Exception {
69
	public List<Map<String, Map<String, String>>> queryCurrentRescueLocationInfo(JMap params) throws Exception {
67 70
		// 查询当前所有未关闭的求救信息
68 71
		List<Map<String, Object>> alarmMapList = rescueDao.queryNoCloseRescueLog(null);
69
		
72
73
		if (alarmMapList == null || alarmMapList.isEmpty()) {
74
			logger.info("未查询到未关闭的求救信息");
75
			return new ArrayList();
76
		}
77
70 78
		List<String> deviceIdsList = new ArrayList<String>();
71 79
		for (int i = 0; i < alarmMapList.size(); i++) {
72 80
			deviceIdsList.add(String.valueOf(alarmMapList.get(i).get("DEVICE_ID")));
73
			if (alarmMapList.get(i).get("RESCUER_DEVICE_ID")!=null) {
81
			if (alarmMapList.get(i).get("RESCUER_DEVICE_ID") != null) {
74 82
				deviceIdsList.add(String.valueOf(alarmMapList.get(i).get("RESCUER_DEVICE_ID")));
75 83
			}
76 84
		}
77
		
85
78 86
		// 获取终端当前位置信息
79
		List<Map<String, String>> list = deviceManageDao.queryCurrentDeviceLocationInfo(deviceIdsList);
87
		List<Map<String, String>> deviceList = deviceManageDao.queryCurrentDeviceLocationInfo(deviceIdsList);
88
89
		if (deviceList.isEmpty()) {
90
			logger.info("未查询到设备位置信息");
91
			return new ArrayList();
92
		}
80 93
81 94
		// 拼接返回数据
82
		for (Map<String, String> map : list) {
83
			String deviceId = map.get("deviceId");
84
			boolean flag=true; //是否为救援人员
85
			
86
			for (int i = 0; i < alarmMapList.size()&&flag; i++) {
87
				Map<String, Object> alarmMap = alarmMapList.get(i);
88
				if (deviceId.equals(String.valueOf(alarmMap.get("DEVICE_ID")))) {
89
					//拼接报警人员的信息
90
					//员工姓名
91
					map.put("userName", String.valueOf(alarmMap.get("PARTY_NAME")));
92
					
95
		List<Map<String, Map<String, String>>> resultList = new ArrayList<Map<String, Map<String, String>>>();
96
		for (Map<String, Object> alarmMap : alarmMapList) {
97
			Map<String, Map<String, String>> resultDataMap = new HashMap<String, Map<String, String>>();
98
99
			String alarmDeviceId = String.valueOf(alarmMap.get("DEVICE_ID"));// 求救者的设备ID
100
			String rescuerDeviceId = null;// 救援者的设备ID
101
102
			// 求救者的设备ID
103
			int countBreakLoop = 0; // 统计需跳出循环的数量
104
			int sumBreakLoop = 1; // 跳出循环的总数量
105
			if (alarmMap.get("RESCUERS_ID") != null) {
106
				// 有救援者
107
				rescuerDeviceId = String.valueOf(alarmMap.get("RESCUER_DEVICE_ID"));
108
				sumBreakLoop = 2;
109
			}
110
111
			for (Map<String, String> deviceMap : deviceList) {
112
				String deviceId = deviceMap.get("deviceId");
113
				if (deviceId.equals(alarmDeviceId)) {
114
					// 求救者
115
					// 员工姓名
116
					deviceMap.put("userName", String.valueOf(alarmMap.get("PARTY_NAME")));// 员工姓名
117
					deviceMap.put("userCode", String.valueOf(alarmMap.get("PARTY_CODE")));// 员工编号
118
93 119
					// 求救时间
94 120
					String alarmDate = String.valueOf(alarmMap.get("CALLER_DATE"));
95
					map.put("alarmDate", DateUtil.formatStrDate(alarmDate));
121
					deviceMap.put("alarmDate", DateUtil.formatStrDate(alarmDate));
96 122
97 123
					// 计算求救时长
98
					int alarmLong = DateUtil.getDifferenceMinute(alarmDate, map.get("newDate"));
99
					map.put("alarmLong", String.valueOf(alarmLong));
100
					
101
					if (alarmMap.get("RESCUERS_ID")==null) {
102
						//未指派救援人员
103
						map.put("isNewAlarm", EbcConstant.alarm_status_needassign);
104
					}else {
105
						//已指派救援人员
106
						map.put("isNewAlarm", EbcConstant.alarm_status_needclose);
107
						map.put("rescuerDeviceId", String.valueOf(alarmMap.get("RESCUER_DEVICE_ID")));
124
					int alarmLong = DateUtil.getDifferenceMinute(alarmDate, deviceMap.get("newDate"));
125
					deviceMap.put("alarmLong", String.valueOf(alarmLong));
126
127
					if (alarmMap.get("RESCUERS_ID") == null) {
128
						// 未指派救援人员
129
						deviceMap.put("isNewAlarm", EbcConstant.alarm_status_needassign);
130
					} else {
131
						// 已指派救援人员
132
						deviceMap.put("isNewAlarm", EbcConstant.alarm_status_needclose);
133
						deviceMap.put("rescuerDeviceId", String.valueOf(alarmMap.get("RESCUER_DEVICE_ID")));// 救援者的设备ID
108 134
					}
109
					
110
					//求救记录ID
111
					map.put("alarmLogId", String.valueOf(alarmMap.get("LOG_ID")));
112 135
113
					//定位状态
136
					// 求救记录ID
137
					deviceMap.put("alarmLogId", String.valueOf(alarmMap.get("LOG_ID")));
138
139
					// 定位状态
114 140
					switch (String.valueOf(alarmMap.get("ALARM_TYPE"))) {
115 141
					case EbcConstant.alarm_type_autosos_ZH:
116
						//自动报警
117
						map.put("locationStatus",EbcConstant.location_status_autosos);//定位状态
118
						map.put("alarmType",EbcConstant.alarm_type_autosos_ZH);
142
						// 自动报警
143
						deviceMap.put("locationStatus", EbcConstant.location_status_autosos);// 定位状态
144
						deviceMap.put("alarmType", EbcConstant.alarm_type_autosos_ZH);
119 145
						break;
120 146
					case EbcConstant.alarm_type_jogsos_ZH:
121
						//手动报警
122
						map.put("locationStatus",EbcConstant.location_status_jogsos);//定位状态
123
						map.put("alarmType",EbcConstant.alarm_type_jogsos_ZH);
147
						// 手动报警
148
						deviceMap.put("locationStatus", EbcConstant.location_status_jogsos);// 定位状态
149
						deviceMap.put("alarmType", EbcConstant.alarm_type_jogsos_ZH);
124 150
						break;
125 151
					default:
126 152
						break;
127 153
					}
128
					
129
					break;
130
					
131
				}else if (deviceId.equals(String.valueOf(alarmMap.get("RESCUER_DEVICE_ID")))) {
132
					//拼接救援人员的信息
133
					map.put("locationStatus",EbcConstant.location_status_rescuer);//定位状态
134
					map.put("userName", String.valueOf(alarmMap.get("RESCUER_NAME")));//员工姓名
135
					break;
136
					
154
155
					resultDataMap.put("alarm", deviceMap);
156
					countBreakLoop++;
157
					if (countBreakLoop == sumBreakLoop) {
158
						// 求救者和救援者的信息都已找到,结束设备位置的循环
159
						break;
160
					}
161
162
				} else if (rescuerDeviceId != null && deviceId.equals(rescuerDeviceId)) {
163
					// 救援者
164
					deviceMap.put("locationStatus", EbcConstant.location_status_rescuer);// 定位状态
165
					deviceMap.put("userName", String.valueOf(alarmMap.get("RESCUER_NAME")));// 员工姓名
166
					deviceMap.put("userCode", String.valueOf(alarmMap.get("RESCUER_CODE")));// 员工编号
167
					deviceMap.put("alarmLogId", String.valueOf(alarmMap.get("LOG_ID")));// 求救记录ID
168
					deviceMap.put("alarmDeviceId", String.valueOf(alarmMap.get("DEVICE_ID")));// 求救者的设备ID
169
170
					resultDataMap.put("rescuer", deviceMap);
171
					countBreakLoop++;
172
					if (countBreakLoop == sumBreakLoop) {
173
						// 求救者和救援者的信息都已找到,结束设备位置的循环
174
						break;
175
					}
137 176
				}
177
138 178
			}
179
			resultList.add(resultDataMap);
139 180
		}
140
		
141
		return list;
181
182
		return resultList;
142 183
	}
143
	
184
144 185
	@Override
145 186
	public JMap queryOneRescuePlayback(JMap params, int pageNum, int pageSize) {
146
		//TODO
147
		
148
		
149
		
150
		
187
		// TODO
188
151 189
		return null;
152 190
	}
153 191

+ 1 - 1
ebc-sea-platform/src/main/java/com/ai/ipu/server/service/interfaces/RescueService.java

@ -43,7 +43,7 @@ public interface RescueService {
43 43
	 * @param params
44 44
	 * @return
45 45
	 */
46
	List<Map<String, String>> queryCurrentRescueLocationInfo(JMap params) throws Exception;
46
	List<Map<String, Map<String, String>>> queryCurrentRescueLocationInfo(JMap params) throws Exception;
47 47
48 48
	/**
49 49
	 * 获取救援者的下拉列表

+ 42 - 12
ebc-sea-platform/src/main/java/com/ai/ipu/server/service/iotdata/ManageIotNoCloseAlarmData.java

@ -26,26 +26,55 @@ public class ManageIotNoCloseAlarmData {
26 26
27 27
	public boolean executeReceiveIotData(JMap params) throws Exception {
28 28
		// 查询是否为未被救援的人员
29
		List<String> deviceIdsList = new ArrayList<String>();
30
		deviceIdsList.add(params.getString("deviceId"));
31
		List<Map<String, Object>> alarmList = rescueDao.queryNoCloseRescueLog(deviceIdsList);
29
		List<Map<String, Object>> alarmList = rescueDao.queryNoCloseRescueLog(params.getString("deviceId"));
32 30
33 31
		if (alarmList == null || alarmList.isEmpty()) {
34 32
			return false;
35 33
		}
36 34
37
		logger.info("定位信息为已报警人员: " + params.get("userName"));
38
39
		// 推送镜屏
40
		sendMirrorData(params, alarmList.get(0));
41
42
		// 修改最后定位时间
43
		updateLastLocationRecord(params, alarmList.get(0));
35
		//判断是救援者还是求救者
36
		if (params.getString("userCode").equals(String.valueOf(alarmList.get(0).get("RESCUER_CODE")))) {
37
			//救援者
38
			logger.info("定位信息为救援人员: " + params.getString("userName"));
39
			
40
			// 推送镜屏
41
			sendRescuerMirrorData(params, alarmList.get(0));
42
			
43
		}else {
44
			//求救者
45
			logger.info("定位信息为已求救的人员: " + params.getString("userName"));
46
			
47
			// 推送镜屏
48
			sendAlarmMirrorData(params, alarmList.get(0));
49
50
			// 修改最后定位时间
51
			updateLastLocationRecord(params, alarmList.get(0));
52
		}
44 53
45 54
		return true;
46 55
	}
47 56
48
	private void sendMirrorData(JMap params, Map<String, Object> alarmMap) throws ParseException {
57
	/**
58
	 * 推送救援者的镜屏信息
59
	 * @param params
60
	 * @param alarmMap
61
	 * @throws ParseException
62
	 */
63
	private void sendRescuerMirrorData(JMap params, Map<String, Object> alarmMap) throws ParseException {
64
		params.put("locationStatus", EbcConstant.location_status_rescuer);// 定位状态
65
		params.put("alarmDeviceId", String.valueOf(alarmMap.get("DEVICE_ID"))); //求救者的设备ID
66
		
67
		// 推送镜屏
68
		MirrorSendDateUtil.sendData(MirrorSendDateUtil.topic_personnel, params);
69
	}
70
	
71
	/**
72
	 * 推送求救者的镜屏信息
73
	 * @param params
74
	 * @param alarmMap
75
	 * @throws ParseException
76
	 */
77
	private void sendAlarmMirrorData(JMap params, Map<String, Object> alarmMap) throws ParseException {
49 78
		// 求救时间
50 79
		String alarmDate = String.valueOf(alarmMap.get("CALLER_DATE"));
51 80
		params.put("alarmDate", DateUtil.formatStrDate(alarmDate));
@ -59,7 +88,7 @@ public class ManageIotNoCloseAlarmData {
59 88
		if (EbcConstant.alarm_type_jogsos_ZH.equals(alarmType)) {
60 89
			params.put("locationStatus", EbcConstant.location_status_jogsos);// 定位状态
61 90
		} else if (EbcConstant.alarm_type_autosos_ZH.equals(alarmType)) {
62
			params.put("locationStatus", EbcConstant.location_status_autosos);// 报警类型
91
			params.put("locationStatus", EbcConstant.location_status_autosos);// 定位状态
63 92
		}
64 93
65 94
		if (alarmMap.get("RESCUERS_ID")==null) {
@ -68,6 +97,7 @@ public class ManageIotNoCloseAlarmData {
68 97
		}else {
69 98
			//已指派救援人员
70 99
			params.put("isNewAlarm", EbcConstant.alarm_status_needclose);
100
			params.put("rescuerDeviceId", String.valueOf(alarmMap.get("RESCUER_DEVICE_ID"))); //救援者的设备ID
71 101
		}
72 102
		
73 103
		//求救记录ID

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

@ -37,58 +37,64 @@ public class DateUtil {
37 37
	 * @param dateStr
38 38
	 * @param amount
39 39
	 * @return yyyy-MM-dd HH:mm:ss
40
	 * @throws ParseException 
40 41
	 */
41
	public static String dateAddYear(String dateStr, int amount) {
42
	public static String dateAddYear(String dateStr, int amount) throws ParseException {
42 43
		return dateAdd(dateStr, Calendar.YEAR, amount, NORM_DATETIME_PATTERN);
43 44
	}
44
	
45
45 46
	/**
46 47
	 * 在原日期加月数
47 48
	 * @param dateStr
48 49
	 * @param amount
49 50
	 * @return yyyy-MM-dd HH:mm:ss
51
	 * @throws ParseException 
50 52
	 */
51
	public static String dateAddMonth(String dateStr, int amount) {
53
	public static String dateAddMonth(String dateStr, int amount) throws ParseException {
52 54
		return dateAdd(dateStr, Calendar.MONTH, amount, NORM_DATETIME_PATTERN);
53 55
	}
54
	
56
55 57
	/**
56 58
	 * 在原日期加天数
57 59
	 * @param dateStr
58 60
	 * @param amount
59 61
	 * @return yyyy-MM-dd HH:mm:ss
62
	 * @throws ParseException 
60 63
	 */
61
	public static String dateAddDay(String dateStr, int amount) {
64
	public static String dateAddDay(String dateStr, int amount) throws ParseException {
62 65
		return dateAdd(dateStr, Calendar.DATE, amount, NORM_DATETIME_PATTERN);
63 66
	}
64
	
67
65 68
	/**
66 69
	 * 在原日期加小时数
67 70
	 * @param dateStr
68 71
	 * @param amount
69 72
	 * @return yyyy-MM-dd HH:mm:ss
73
	 * @throws ParseException 
70 74
	 */
71
	public static String dateAddHour(String dateStr, int amount) {
75
	public static String dateAddHour(String dateStr, int amount) throws ParseException {
72 76
		return dateAdd(dateStr, Calendar.HOUR, amount, NORM_DATETIME_PATTERN);
73 77
	}
74
	
78
75 79
	/**
76 80
	 * 在原日期加分钟数
77 81
	 * @param dateStr
78 82
	 * @param amount
79 83
	 * @return yyyy-MM-dd HH:mm:ss
84
	 * @throws ParseException 
80 85
	 */
81
	public static String dateAddMinute(String dateStr, int amount) {
86
	public static String dateAddMinute(String dateStr, int amount) throws ParseException {
82 87
		return dateAdd(dateStr, Calendar.MINUTE, amount, NORM_DATETIME_PATTERN);
83 88
	}
84
	
89
85 90
	/**
86 91
	 * 在原日期加秒数
87 92
	 * @param dateStr
88 93
	 * @param amount
89 94
	 * @return yyyy-MM-dd HH:mm:ss
95
	 * @throws ParseException 
90 96
	 */
91
	public static String dateAddSecond(String dateStr, int amount) {
97
	public static String dateAddSecond(String dateStr, int amount) throws ParseException {
92 98
		return dateAdd(dateStr, Calendar.SECOND, amount, NORM_DATETIME_PATTERN);
93 99
	}
94 100
@ -99,8 +105,9 @@ public class DateUtil {
99 105
	 * @param amount 间隔长度
100 106
	 * @param pattern 返回日期格式
101 107
	 * @return
108
	 * @throws ParseException 
102 109
	 */
103
	public static String dateAdd(String dateStr, int field, int amount, String pattern) {
110
	public static String dateAdd(String dateStr, int field, int amount, String pattern) throws ParseException {
104 111
		Date date = convertDate(dateStr);
105 112
		Date newDate = dateAdd(date, field, amount);
106 113
		return formatDate(newDate, pattern);
@ -125,8 +132,9 @@ public class DateUtil {
125 132
	 * @param field Calendar中的时间类型
126 133
	 * @param amount 间隔长度
127 134
	 * @return
135
	 * @throws ParseException 
128 136
	 */
129
	public static Date dateAdd(String dateStr, int field, int amount) {
137
	public static Date dateAdd(String dateStr, int field, int amount) throws ParseException {
130 138
		Date date = convertDate(dateStr);
131 139
		return dateAdd(date, field, amount);
132 140
	}
@ -149,9 +157,22 @@ public class DateUtil {
149 157
	 * 比较日期大小
150 158
	 * @param dateStr0
151 159
	 * @param dateStr1
152
	 * @return
160
	 * @return dateStr0<dateStr1 ? -1 : (dateStr0==dateStr1 ? 0 : 1)
161
	 * @throws ParseException 
153 162
	 */
154
	public static int compareDate(String dateStr0, String dateStr1) {
163
	public static int compareDate(String dateStr0, String dateStr1) throws ParseException {
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
155 176
		Date date1 = convertDate(dateStr0);
156 177
		Date date2 = convertDate(dateStr1);
157 178
		int result = date1.compareTo(date2);
@ -162,8 +183,9 @@ public class DateUtil {
162 183
	 * 格式化字符串时间
163 184
	 * @param date
164 185
	 * @return yyyy-MM-dd HH:mm:ss
186
	 * @throws ParseException 
165 187
	 */
166
	public static String formatStrDate(String dateStr) {
188
	public static String formatStrDate(String dateStr) throws ParseException {
167 189
		Date date = convertDate(dateStr);
168 190
		return formatDate(date, DateUtil.NORM_DATETIME_PATTERN);
169 191
	}
@ -196,11 +218,13 @@ public class DateUtil {
196 218
	 * 字符串转时间
197 219
	 * @param dateStr
198 220
	 * @return
221
	 * @throws ParseException 
199 222
	 */
200
	public static Date convertDate(String dateStr) {
223
	public static Date convertDate(String dateStr) throws ParseException {
201 224
		if (dateStr == null || "".equals(dateStr)) {
202 225
			return null;
203 226
		}
227
204 228
		String pattern = TimeUtil.getTimestampFormat(dateStr);
205 229
		return convertDate(dateStr, pattern);
206 230
	}
@ -210,8 +234,9 @@ public class DateUtil {
210 234
	 * @param dateStr
211 235
	 * @param pattern
212 236
	 * @return
237
	 * @throws ParseException 
213 238
	 */
214
	public static Date convertDate(String dateStr, String pattern) {
239
	public static Date convertDate(String dateStr, String pattern) throws ParseException {
215 240
		if (dateStr == null || "".equals(dateStr)) {
216 241
			return null;
217 242
		}
@ -221,12 +246,7 @@ public class DateUtil {
221 246
		}
222 247
223 248
		SimpleDateFormat formatter = new SimpleDateFormat(pattern);
224
		Date date = null;
225
		try {
226
			date = formatter.parse(dateStr);
227
		} catch (ParseException e) {
228
			e.printStackTrace();
229
		}
249
		Date date = formatter.parse(dateStr);
230 250
		return date;
231 251
	}
232 252

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

@ -72,21 +72,21 @@ public class EbcConstant {
72 72
	// 人员定位状态:救援人员
73 73
	public static final String location_status_rescuer = "6";
74 74
75
	// 告警类型:SOS(手动)
76
	public static final int alarm_type_jogsos_beidou = 2;
77
78 75
	// 告警类型:SOS(自动)
79 76
	public static final int alarm_type_autosos_beidou = 1;
77
	
78
	// 告警类型:SOS(手动)
79
	public static final int alarm_type_jogsos_beidou = 2;
80 80
81 81
	// 告警类型:离线
82 82
	public static final int alarm_type_offline_beidou = 4;
83 83
84
	// 告警类型:SOS(手动)
85
	public static final String alarm_type_jogsos_ZH = "手动告警";
86
87 84
	// 告警类型:SOS(自动)
88 85
	public static final String alarm_type_autosos_ZH = "落水告警";
89 86
87
	// 告警类型:SOS(手动)
88
	public static final String alarm_type_jogsos_ZH = "手动告警";
89
90 90
	// 告警类型:离线
91 91
	public static final String alarm_type_offline_ZH = "离线告警";
92 92

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

@ -189,21 +189,20 @@ public class HttpServiceUtil {
189 189
190 190
	public static String sendGet(String url, Charset encoding) {
191 191
		HttpClient httpClient = HttpClients.createDefault();
192
		String resp = "";
193 192
		HttpGet httpGet = new HttpGet(url);
194 193
		httpGet.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
195 194
		CloseableHttpResponse response = null;
196 195
		try {
197 196
			response = (CloseableHttpResponse) httpClient.execute(httpGet);
198
		} catch (IOException e) {
199
			log.error("请求错误");
197
		} catch (Exception e) {
198
			log.error("sendGet Exception: " + e.getMessage());
199
			return "{}";
200 200
		}
201 201
		return responseEx(httpClient, response, encoding);
202 202
	}
203 203
204 204
	public static String sendPost(String url, Map<String, Object> paramsMap, Charset encoding) {
205 205
		HttpClient httpClient = HttpClients.createDefault();
206
		String resp = "";
207 206
		HttpPost httpPost = new HttpPost(url);
208 207
		httpPost.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
209 208
		if (paramsMap != null && paramsMap.size() > 0) {
@ -213,8 +212,9 @@ public class HttpServiceUtil {
213 212
		CloseableHttpResponse response = null;
214 213
		try {
215 214
			response = (CloseableHttpResponse) httpClient.execute(httpPost);
216
		} catch (IOException e) {
217
			log.error("sendPost Exception: ", e.getMessage());
215
		} catch (Exception e) {
216
			log.error("sendPost Exception: " + e.getMessage());
217
			return "{}";
218 218
		}
219 219
		return responseEx(httpClient, response, encoding);
220 220
	}
@ -222,7 +222,6 @@ public class HttpServiceUtil {
222 222
	public static String sendPost(String url, Map<String, Object> paramsMap, Charset encoding,
223 223
			Map<String, String> headerMap) {
224 224
		HttpClient httpClient = HttpClients.createDefault();
225
		String resp = "";
226 225
		HttpPost httpPost = new HttpPost(url);
227 226
228 227
		Iterator<String> iter = headerMap.keySet().iterator();
@ -236,15 +235,16 @@ public class HttpServiceUtil {
236 235
237 236
		httpPost.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
238 237
		if (paramsMap != null && paramsMap.size() > 0) {
239
			log.debug("调用北向接口:url= "+url+",参数= "+JSONObject.toJSONString(paramsMap));
238
			log.debug("调用北向接口:url= " + url + ",参数= " + JSONObject.toJSONString(paramsMap));
240 239
			StringEntity se = new StringEntity(JSONObject.toJSONString(paramsMap), encoding);
241 240
			httpPost.setEntity(se);
242 241
		}
243 242
		CloseableHttpResponse response = null;
244 243
		try {
245 244
			response = (CloseableHttpResponse) httpClient.execute(httpPost);
246
		} catch (IOException e) {
247
			log.error("sendPost Exception: ", e.getMessage());
245
		} catch (Exception e) {
246
			log.error("sendPost Exception: " + e.getMessage());
247
			return "{}";
248 248
		}
249 249
		return responseEx(httpClient, response, encoding);
250 250
	}
@ -261,8 +261,9 @@ public class HttpServiceUtil {
261 261
		CloseableHttpResponse response = null;
262 262
		try {
263 263
			response = (CloseableHttpResponse) httpClient.execute(httpPut);
264
		} catch (IOException e) {
265
			log.error("请求错误");
264
		} catch (Exception e) {
265
			log.error("sendPut Exception: " + e.getMessage());
266
			return "{}";
266 267
		}
267 268
268 269
		return responseEx(httpClient, response, encoding);
@ -275,13 +276,13 @@ public class HttpServiceUtil {
275 276
				resp = EntityUtils.toString(response.getEntity(), encoding);
276 277
			}
277 278
		} catch (Exception e) {
278
			log.error(e.getMessage(), e);
279
			log.error("responseEx Exception: " + e.getMessage());
279 280
		} finally {
280 281
			if (response != null) {
281 282
				try {
282 283
					response.close();
283
				} catch (IOException e) {
284
					log.error(e.getMessage(), e);
284
				} catch (Exception e) {
285
					log.error("responseEx Exception: " + e.getMessage());
285 286
				}
286 287
			}
287 288
		}

+ 82 - 38
ebc-sea-platform/src/main/java/com/ai/ipu/server/util/NorthboundInterfaceUtil.java

@ -25,16 +25,16 @@ public class NorthboundInterfaceUtil {
25 25
26 26
	@Value("${aap.iot.userCode}")
27 27
	private String userCode;
28
	
28
29 29
	@Value("${aap.iot.passWord}")
30 30
	private String passWord;
31
	
31
32 32
	@Value("${url.iot.login}")
33 33
	private String iotLoginUrl;
34
	
34
35 35
	@Value("${url.iot.service}")
36 36
	private String iotServiceUrl;
37
	
37
38 38
	// 定义静态存储map空间存放sign与sessionId
39 39
	private volatile static Map<String, String> cacheMap = new ConcurrentHashMap<String, String>();// 缓存map
40 40
@ -71,18 +71,25 @@ public class NorthboundInterfaceUtil {
71 71
		// 调用北向服务的接口
72 72
		logger.debug("GET调用北向接口");
73 73
74
		boolean loginFlag = true;
75
74 76
		// 1.在缓存中获取sessionId与sign
75 77
		Map<String, String> mapCache = getMapCache();
76 78
		if (mapCache.isEmpty() || mapCache.get("sign") == null || mapCache.get("session_id") == null) {
77 79
			// 2.如果没有调用登录接口从新获取
78
			iotLogin();
80
			loginFlag = iotLogin();
81
		}
82
83
		if (!loginFlag) {
84
			logger.debug("调用北向接口登录失败");
85
			return new HashMap<String, String>();
79 86
		}
80 87
81 88
		// 3.调用北向服务接口
82 89
		// (1)设置字符集
83 90
		Charset charset = Charset.forName("utf-8");
84 91
		// (2)调用接口
85
		String resultJson = HttpServiceUtil.sendGet(iotServiceUrl+url, charset);
92
		String resultJson = HttpServiceUtil.sendGet(iotServiceUrl + url, charset);
86 93
		// (3)将参数转为Map<String,String>【将返回值统一为String】
87 94
		Map<String, String> resultMap = JSON.parseObject(resultJson, Map.class);
88 95
@ -93,15 +100,31 @@ public class NorthboundInterfaceUtil {
93 100
			// (1)清除缓存
94 101
			clear();
95 102
			// (2)重新登录
96
			iotLogin();
97
			// (3)再次调用接口
98
			String fianlresultJson = HttpServiceUtil.sendGet(iotServiceUrl+url, charset);
99
			// (4)获取返回值
100
			resultMap = JSON.parseObject(fianlresultJson, Map.class);
103
			loginFlag = iotLogin();
104
105
			if (!loginFlag) {
106
				logger.debug("再次调用北向接口登录失败");
107
				return new HashMap<String, String>();
108
			}
109
110
			try {
111
				// (3)再次调用接口
112
				String fianlresultJson = HttpServiceUtil.sendGet(iotServiceUrl + url, charset);
113
				// (4)获取返回值
114
				resultMap = JSON.parseObject(fianlresultJson, Map.class);
115
			} catch (Exception e) {
116
				logger.error("再次调用北向接口失败: " + e.getMessage());
117
				return new HashMap<String, String>();
118
			}
119
120
			if (resultMap == null) {
121
				logger.error("再次调用北向接口返回值为空");
122
				return new HashMap<String, String>();
123
			}
101 124
		}
102 125
103 126
		// 5.判断是否调用成功
104
		if ("0".equals(resultMap.get("resultCode"))) {
127
		if (NorthboundInterfaceConstant.resultCode_succeed.equals(resultMap.get("resultCode"))) {
105 128
			logger.info("调用北向接口成功");
106 129
		} else {
107 130
			logger.info("调用北向接口失败");
@ -122,11 +145,18 @@ public class NorthboundInterfaceUtil {
122 145
		// 调用北向服务的接口
123 146
		logger.debug("POSt调用北向接口");
124 147
148
		boolean loginFlag = true;
149
125 150
		// 1.在缓存中获取sessionId与sign
126 151
		Map<String, String> mapCache = getMapCache();
127 152
		if (mapCache.isEmpty() || mapCache.get("sign") == null || mapCache.get("session_id") == null) {
128 153
			// 2.如果没有调用登录接口从新获取
129
			iotLogin();
154
			loginFlag = iotLogin();
155
		}
156
157
		if (!loginFlag) {
158
			logger.debug("调用北向接口登录失败");
159
			return new HashMap<String, String>();
130 160
		}
131 161
132 162
		// 3.调用北向服务接口
@ -136,34 +166,52 @@ public class NorthboundInterfaceUtil {
136 166
		Map<String, String> resultMap = null;
137 167
		try {
138 168
			// (2)调用接口
139
			String resultJson = HttpServiceUtil.sendPost(iotServiceUrl+url, paramsMap, charset, getMapCache());
169
			String resultJson = HttpServiceUtil.sendPost(iotServiceUrl + url, paramsMap, charset, getMapCache());
140 170
			// (3)将参数转为Map<String,String>【将返回值统一为String】
141 171
			resultMap = JSON.parseObject(resultJson, Map.class);
142 172
		} catch (Exception e) {
143 173
			logger.error("调用北向接口失败: " + e.getMessage());
174
			return new HashMap<String, String>();
144 175
		}
145 176
146 177
		if (resultMap == null) {
147
			logger.info("调用北向接口失败");
178
			logger.error("调用北向接口返回值为空");
148 179
			return new HashMap<String, String>();
149 180
		}
150 181
151 182
		// 4.登录超时,需重新登录
152 183
		if ("登录超时".equals(resultMap.get("resultMsg"))) {
153
			logger.info("调用北向接口失败,需重新登录");
184
			logger.info("调用北向接口登录超时,需重新登录");
154 185
			// 4.调用不成功可能是登录过期
155 186
			// (1)清除缓存
156 187
			clear();
157 188
			// (2)重新登录
158
			iotLogin();
159
			// (3)再次调用接口
160
			String fianlresultJson = HttpServiceUtil.sendPost(iotServiceUrl+url, paramsMap, charset, getMapCache());
161
			// (4)获取返回值
162
			resultMap = JSON.parseObject(fianlresultJson, Map.class);
189
			loginFlag = iotLogin();
190
191
			if (!loginFlag) {
192
				logger.debug("再次调用北向接口登录失败");
193
				return new HashMap<String, String>();
194
			}
195
196
			try {
197
				// (3)再次调用接口
198
				String fianlresultJson = HttpServiceUtil.sendPost(iotServiceUrl + url, paramsMap, charset,
199
						getMapCache());
200
				// (4)获取返回值
201
				resultMap = JSON.parseObject(fianlresultJson, Map.class);
202
			} catch (Exception e) {
203
				logger.error("再次调用北向接口失败: " + e.getMessage());
204
				return new HashMap<String, String>();
205
			}
206
207
			if (resultMap == null) {
208
				logger.error("再次调用北向接口返回值为空");
209
				return new HashMap<String, String>();
210
			}
163 211
		}
164 212
165 213
		// 5.判断是否调用成功
166
		if ("0".equals(resultMap.get("resultCode"))) {
214
		if (NorthboundInterfaceConstant.resultCode_succeed.equals(resultMap.get("resultCode"))) {
167 215
			logger.info("调用北向接口成功");
168 216
		} else {
169 217
			logger.info("调用北向接口失败");
@ -177,7 +225,7 @@ public class NorthboundInterfaceUtil {
177 225
	 * 
178 226
	 * @return
179 227
	 */
180
	private Map<String, String> iotLogin() {
228
	private boolean iotLogin() {
181 229
		logger.debug("登录北向接口");
182 230
183 231
		// 调用登录接口获取sessionId与sign
@ -188,30 +236,26 @@ public class NorthboundInterfaceUtil {
188 236
		// 设置字符集
189 237
		Charset charset = Charset.forName("utf-8");
190 238
191
		Map mapType = null;
239
		Map loginResultMap = null;
192 240
		try {
193 241
			// 调用登录接口
194 242
			String loginResult = HttpServiceUtil.sendPost(iotLoginUrl, loginParamMap, charset);
195
			mapType = JSON.parseObject(loginResult, Map.class);
243
			loginResultMap = JSON.parseObject(loginResult, Map.class);
196 244
		} catch (Exception e) {
197 245
			logger.error("登录北向接口失败: " + e.getMessage());
246
			return false;
198 247
		}
199 248
200
		if (mapType != null) {
201
			Map result = (Map) mapType.get("result");
202
203
			if ("0".equals(String.valueOf(mapType.get("resultCode")))) {
204
				logger.info("登录北向接口成功");
205
				// 将数据存到缓存中
206
				setMapCache(result);
207
			} else {
208
				logger.info("登录北向接口失败");
209
			}
249
		if (loginResultMap != null && NorthboundInterfaceConstant.resultCode_succeed
250
				.equals(String.valueOf(loginResultMap.get("resultCode")))) {
251
			logger.info("登录北向接口成功");
252
			Map result = (Map) loginResultMap.get("result");
253
			// 将数据存到缓存中
254
			setMapCache(result);
255
			return true;
210 256
		} else {
211 257
			logger.info("登录北向接口失败");
258
			return false;
212 259
		}
213
214
		return cacheMap;
215 260
	}
216
217 261
}

+ 3 - 0
ebc-sea-platform/src/main/resources/dev/application-gis.properties

@ -8,5 +8,8 @@ url.gis.token=http://192.168.74.189:9999/gisIntf/account/gettoken
8 8
#\u6d77\u56fe\u4e2d\u5fc3\u5750\u6807
9 9
seaMap.centre.longitude=123.396036
10 10
seaMap.centre.latitude=31.560302
11
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
12 15
seaMap.scale=11

+ 5 - 2
ebc-sea-platform/src/main/resources/dev/application-iot.properties

@ -3,6 +3,9 @@ aap.iot.userCode=IOT_ADMIN
3 3
aap.iot.passWord=123456
4 4
5 5
#iot\u7684\u5317\u5411\u63a5\u53e3\u6ce8\u518c\u5730\u5740
6
url.iot.login=http://60.205.219.67:8300/sso/login
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
7 9
#iot\u7684\u5317\u5411\u63a5\u53e3\u7edf\u4e00\u5730\u5740
8
url.iot.service=http://60.205.219.67:8300/dmp/terminalNorthApi/
10
#url.iot.service=http://60.205.219.67:8300/dmp/terminalNorthApi/
11
url.iot.service=http://47.105.130.83:8083/dmp/terminalNorthApi/

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

@ -8,5 +8,8 @@ url.gis.token=http://192.168.74.189:9999/gisIntf/account/gettoken
8 8
#\u6d77\u56fe\u4e2d\u5fc3\u5750\u6807
9 9
seaMap.centre.longitude=123.396036
10 10
seaMap.centre.latitude=31.560302
11
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
12 15
seaMap.scale=11

+ 3 - 8
ebc-sea-platform/src/main/resources/sql/ipu/RescueDao.xml

@ -17,14 +17,9 @@
17 17
	        AND l.ALARM_TYPE <> #{offlineType}
18 18
	        AND l.DATA_STATUS = #{alarmDataStatus}
19 19
	        
20
	        <if test="deviceIdsList != null">
21
		        AND l.DEVICE_ID IN (
22
				
23
	    		<foreach collection="deviceIdsList" item="item" separator=",">
24
	        		#{item}
25
	    		</foreach>
26
	    		
27
	    		)
20
	        <if test="deviceId != null">
21
		        AND ( l.DEVICE_ID = #{deviceId}
22
		        OR t.DEVICE_ID = #{deviceId} )
28 23
    		</if>
29 24
    		
30 25
	        </where>

+ 3 - 0
ebc-sea-platform/src/main/resources/test/application-gis.properties

@ -8,5 +8,8 @@ url.gis.token=http://192.168.74.189:9999/gisIntf/account/gettoken
8 8
#\u6d77\u56fe\u4e2d\u5fc3\u5750\u6807
9 9
seaMap.centre.longitude=123.396036
10 10
seaMap.centre.latitude=31.560302
11
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
12 15
seaMap.scale=11

android-share - Nuosi Git Service

ipu的trunk版的android工程和服务端工程。

liuyf23 bea91dae86 * @修复:添加“文件选择”的依赖 лет назад: 2
demo-openplatform 8b1bd636d6 merge лет назад: 8
display-client bd8dd01639 SONAR扫描问题 лет назад: 4
display-server bd8dd01639 SONAR扫描问题 лет назад: 4
general-web-server bd8dd01639 SONAR扫描问题 лет назад: 4
ipu-baidumap-lib 51dfd7c13c 地图lib更新 лет назад: 8
ipu-client 206657ea5e 解决sonar违规 лет назад: 4
ipu-count-test 24b25ecb85 修改部分sonar扫描严重 лет назад: 6
ipu-open-platform 24b25ecb85 修改部分sonar扫描严重 лет назад: 6
ipu-push-test 3b751fd7a7 迁出ipu-mobile-ui,ipu-plugin-basic工程;迁入keep-live,show-client,show-server,ipu-sdk-demo,ipu-push-test,super-client工程; лет назад: 3
ipu-scan-lib 8fc9d670aa 修改包名错误 лет назад: 6
ipu-sdk-demo 0230d1f6cb ipu-sdk-demo修改生产环境地址 лет назад: 3
ipu-server bd8dd01639 SONAR扫描问题 лет назад: 4
ipu-share 3f68df12b9 ipu-mobile-ui基于gradle编译 лет назад: 5
ipu-voice-lib ac7047435f 新增提交ipuvoice-libjar包 лет назад: 8
ipu-web-libs 058f4f86fb 更新获取状态栏高度插件 px转dp лет назад: 7
keep-alive 3b751fd7a7 迁出ipu-mobile-ui,ipu-plugin-basic工程;迁入keep-live,show-client,show-server,ipu-sdk-demo,ipu-push-test,super-client工程; лет назад: 3
push-manager-server bd8dd01639 SONAR扫描问题 лет назад: 4
push-server bd8dd01639 SONAR扫描问题 лет назад: 4
show-client bea91dae86 * @修复:添加“文件选择”的依赖 лет назад: 2
show-server fe8663f0b9 @laijj@首页标题修改 лет назад: 2
superapp-client efbfeabe37 @新增:mobile-action.xml中增加插件对应的权限,避免权限问题导致插件用不了(比如自定义相机等) лет назад: 2
.gitignore 2b44dae30e 更新.gitignore文件忽略.gradle和.idea目录 лет назад: 3
README.md eb54096ad8 1 лет назад: 9

README.md

android-share

ipu的trunk版的android工程和服务端工程。