Browse Source

修改北向接口

konghl 4 years ago
parent
commit
429b4dbfa9

+ 117 - 60
ebc-sea-platform/src/main/java/com/ai/ipu/server/controller/DeviceManageController.java

@ -1,9 +1,8 @@
1 1
package com.ai.ipu.server.controller;
2 2
3
import com.ai.ipu.data.JMap;
4
import com.ai.ipu.data.impl.JsonMap;
5
import com.ai.ipu.server.service.interfaces.DeviceManageService;
6
import com.github.pagehelper.PageInfo;
3
import java.util.List;
4
import java.util.Map;
5
7 6
import org.slf4j.Logger;
8 7
import org.slf4j.LoggerFactory;
9 8
import org.springframework.beans.factory.annotation.Autowired;
@ -11,8 +10,11 @@ import org.springframework.stereotype.Controller;
11 10
import org.springframework.web.bind.annotation.RequestMapping;
12 11
import org.springframework.web.bind.annotation.ResponseBody;
13 12
14
import java.util.List;
15
import java.util.Map;
13
import com.ai.ipu.data.JMap;
14
import com.ai.ipu.data.impl.JsonMap;
15
import com.ai.ipu.server.service.interfaces.DeviceManageService;
16
import com.ai.ipu.server.util.EbcConstant;
17
import com.ai.ipu.server.util.NorthboundInterfaceUtil;
16 18
17 19
/**
18 20
 * 终端管理
@ -29,92 +31,147 @@ public class DeviceManageController {
29 31
	 * 分页查询终端信息
30 32
	 */
31 33
	@ResponseBody
32
	@RequestMapping("/queryDeviceInfo")
33
	public JMap queryDeviceInfo(JMap params) throws Exception {
34
		Map<String,String> params1 = (Map<String, String>) params.get("params"); // 参
35
		PageInfo deviceList = deviceManageService.queryDeviceInfo(params);
34
	@RequestMapping("/queryPageDeviceInfo")
35
	public JMap queryPageDeviceInfo(JMap params) throws Exception {
36
		// 当前页
37
		int pageNum = params.getInt("pageNum") < 1 ? 1 : params.getInt("pageNum");
38
		// 每页条数
39
		int pageSize = params.getInt("pageSize") < 1 ? 10 : params.getInt("pageSize");
40
41
		JMap result = deviceManageService.queryPageDeviceInfo(params, pageNum, pageSize);
42
		return result;
43
	}
44
45
	/**
46
	 * 获取下拉列表的终端信息
47
	 * 
48
	 * @param params
49
	 * @return
50
	 * @throws Exception
51
	 */
52
	@ResponseBody
53
	@RequestMapping("/queryListDeviceInfo")
54
	public JMap queryListDeviceInfo(JMap params) throws Exception {
36 55
		JMap result = new JsonMap();
37
		result.put("result", deviceList);
56
57
		// 当前页数
58
		int pageNum = 1;
59
		// 每页条数
60
		int pageSize = EbcConstant.comboBox_maxNum;
61
62
		List<Map<String, Object>> resultList = deviceManageService.queryListDeviceInfo(params, pageNum, pageSize);
63
		result.put("dataList", resultList);
38 64
		return result;
39 65
	}
40 66
41 67
	/**
42
	 * 添加终端信息
68
	 * 查询单个终端信息
69
	 * 
70
	 * @param params
71
	 * @return
72
	 * @throws Exception
73
	 */
74
	@ResponseBody
75
	@RequestMapping("/queryOneDeviceInfo")
76
	public JMap queryOneDeviceInfo(JMap params) throws Exception {
77
		JMap result = new JsonMap();
78
79
		if (params == null || params.get("deviceId") == null) {
80
			result.put("result", false);
81
			result.put("errMsg", "操作失败");
82
			return result;
83
		}
84
85
		JMap resultMap = deviceManageService.queryOneDeviceInfo(params);
86
		result.put("resultData", resultMap);
87
		return result;
88
	}
89
90
	/**
91
	 * 添加单个终端信息
92
	 * 
93
	 * @param params
94
	 * @return
95
	 * @throws Exception
43 96
	 */
44 97
	@ResponseBody
45 98
	@RequestMapping("/addDeviceInfo")
46 99
	public JMap addDeviceInfo(JMap params) throws Exception {
47
		JMap params1 = params.getJMap("params"); // 参数
48
		JMap result = new JsonMap(); // 返回值
49
		try {
50
			Map<String, String> resultMap = deviceManageService.addDeviceInfo(params1);
51
			if ("0".equals(resultMap.get("resultCode"))) {
52
				result.put("result", true);
53
			} else {
54
				result.put("result", false);
55
				result.put("errMsg", "添加失败:" + resultMap.get("resultMsg"));
56
			}
57
		} catch (Exception e) {
58
			logger.error("添加失败,原因为:" + e.getMessage());
100
		JMap result = new JsonMap();
101
102
		if (params == null || params.get("deviceNo") == null) {
59 103
			result.put("result", false);
60 104
			result.put("errMsg", "添加失败");
105
			return result;
106
		}
107
108
		Map<String, String> resultMap = deviceManageService.addDeviceInfo(params);
109
110
		if (NorthboundInterfaceUtil.resultCode_succeed.equals(resultMap.get("resultCode"))) {
111
			result.put("result", true);
112
		} else {
113
			result.put("result", false);
114
			result.put("errMsg", "添加失败:" + resultMap.get("resultMsg"));
61 115
		}
62 116
63 117
		return result;
64 118
	}
65 119
66 120
	/**
67
	 * 修改终端信息
121
	 * 修改单个终端信息
122
	 * 
123
	 * @param params
124
	 * @return
125
	 * @throws Exception
68 126
	 */
69 127
	@ResponseBody
70 128
	@RequestMapping("/modifyDeviceInfo")
71 129
	public JMap modifyDeviceInfo(JMap params) throws Exception {
72
		JMap params1 = params.getJMap("params"); // 参数
73
		JMap result = new JsonMap(); // 返回值
74
		try {
75
			Map<String, String> resultMap = deviceManageService.modifyDeviceInfo(params1);
76
			if ("0".equals(resultMap.get("resultCode"))) {
77
				result.put("result", true);
78
			} else {
79
				result.put("result", false);
80
				result.put("errMsg", "修改失败:" + resultMap.get("resultMsg"));
81
			}
82
		} catch (Exception e) {
83
			logger.error("异常,原因为:" + e.getMessage());
130
		JMap result = new JsonMap();
131
132
		if (params == null || params.get("deviceId") == null) {
84 133
			result.put("result", false);
85 134
			result.put("errMsg", "修改失败");
135
			return result;
136
		}
137
138
		Map<String, String> resultMap = deviceManageService.modifyDeviceInfo(params);
139
140
		if (NorthboundInterfaceUtil.resultCode_succeed.equals(resultMap.get("resultCode"))) {
141
			result.put("result", true);
142
		} else {
143
			result.put("result", false);
144
			result.put("errMsg", "修改失败:" + resultMap.get("resultMsg"));
86 145
		}
87 146
88 147
		return result;
89 148
	}
90 149
91 150
	/**
92
	 * 删除终端信息
151
	 * 删除单个终端信息
152
	 * 
153
	 * @param params
154
	 * @return
155
	 * @throws Exception
93 156
	 */
94 157
	@ResponseBody
95 158
	@RequestMapping("/deleteDeviceInfo")
96 159
	public JMap deleteDeviceInfo(JMap params) throws Exception {
97
		JMap params1 = params.getJMap("params"); // 参数
98
		JMap result = new JsonMap(); // 返回值
99
		try {
100
			if (params1.get("deviceId") != null && !"".equals(params1.get("deviceId"))) {
101
				Map<String, String> resultMap = deviceManageService.deleteDeviceInfo(params1);
102
103
				if ("0".equals(resultMap.get("resultCode"))) {
104
					result.put("result", true);
105
				} else {
106
					result.put("result", false);
107
					result.put("errMsg", resultMap.get("resultMsg"));
108
				}
109
			} else {
110
				result.put("result", false);
111
				result.put("errMsg", "删除失败:终端为空");
112
			}
113
114
		} catch (Exception e) {
115
			logger.error("异常,原因为:" + e.getMessage());
160
		JMap result = new JsonMap();
161
162
		if (params == null || params.get("deviceId") == null) {
116 163
			result.put("result", false);
117 164
			result.put("errMsg", "删除失败");
165
			return result;
166
		}
167
168
		Map<String, String> resultMap = deviceManageService.deleteDeviceInfo(params);
169
170
		if (NorthboundInterfaceUtil.resultCode_succeed.equals(resultMap.get("resultCode"))) {
171
			result.put("result", true);
172
		} else {
173
			result.put("result", false);
174
			result.put("errMsg", "删除失败:" + resultMap.get("resultMsg"));
118 175
		}
119 176
120 177
		return result;
@ -165,7 +222,7 @@ public class DeviceManageController {
165 222
	@ResponseBody
166 223
	@RequestMapping("/queryAssociatInfo")
167 224
	public JMap queryAssociatInfo(JMap params) throws Exception {
168
		List<Map<String, Object>> userList=  deviceManageService.queryAssociatInfo(params);
225
		List<Map<String, Object>> userList = deviceManageService.queryAssociatInfo(params);
169 226
		JMap result = new JsonMap();
170 227
		result.put("result", userList);
171 228
		return result;
@ -176,8 +233,8 @@ public class DeviceManageController {
176 233
	 */
177 234
	@ResponseBody
178 235
	@RequestMapping("/verifyUserOrBoatAssociatInfo")
179
	public JMap  verifyUserOrBoatAssociatInfo(JMap params) throws Exception {
180
		Map<String, Object> associatMap=  deviceManageService.verifyUserOrBoatAssociatInfo(params);
236
	public JMap verifyUserOrBoatAssociatInfo(JMap params) throws Exception {
237
		Map<String, Object> associatMap = deviceManageService.verifyUserOrBoatAssociatInfo(params);
181 238
		JMap result = new JsonMap();
182 239
		result.put("result", associatMap);
183 240
		return result;

+ 2 - 2
ebc-sea-platform/src/main/java/com/ai/ipu/server/controller/MapTagManageController.java

@ -38,12 +38,12 @@ public class MapTagManageController {
38 38
	public JMap queryPageMapTagInfo(JMap params) throws Exception {
39 39
40 40
		// 当前页数
41
		int pageNum = params.getInt("pageNum") < 0 ? 0 : params.getInt("pageNum");
41
		int pageNum = params.getInt("pageNum") < 1 ? 1 : params.getInt("pageNum");
42 42
		// 每页条数
43 43
		int pageSize = params.getInt("pageSize") < 1 ? 10 : params.getInt("pageSize");
44 44
45 45
		JMap result = mapTagManageService.queryPageMapTagInfo(params, pageNum, pageSize);
46
		
46
47 47
		result.put("pageNum", pageNum);
48 48
		result.put("pageSize", pageSize);
49 49
		return result;

+ 106 - 41
ebc-sea-platform/src/main/java/com/ai/ipu/server/dao/impl/DeviceManageDaoImpl.java

@ -1,6 +1,7 @@
1 1
package com.ai.ipu.server.dao.impl;
2 2
3 3
import java.io.IOException;
4
import java.util.ArrayList;
4 5
import java.util.HashMap;
5 6
import java.util.List;
6 7
import java.util.Map;
@ -8,12 +9,15 @@ import java.util.Map;
8 9
import org.springframework.stereotype.Component;
9 10
10 11
import com.ai.ipu.data.JMap;
12
import com.ai.ipu.data.impl.JsonMap;
11 13
import com.ai.ipu.database.dao.IpuDaoManager;
12 14
import com.ai.ipu.database.dao.impl.AbstractBizDao;
13 15
import com.ai.ipu.server.dao.interfaces.DeviceManageDao;
14 16
import com.ai.ipu.server.model.IotUrlEnum;
15 17
import com.ai.ipu.server.util.EbcConstant;
16 18
import com.ai.ipu.server.util.NorthboundInterfaceUtil;
19
import com.ai.ipu.server.util.ProductEnum;
20
import com.alibaba.fastjson.JSONObject;
17 21
18 22
@Component
19 23
public class DeviceManageDaoImpl extends AbstractBizDao implements DeviceManageDao {
@ -21,74 +25,134 @@ public class DeviceManageDaoImpl extends AbstractBizDao implements DeviceManageD
21 25
	public DeviceManageDaoImpl() throws IOException {
22 26
		super("ebc");
23 27
	}
24
    private String connName = "ebc";
25
    private String userAndDevicetableName = "LR_PARTY_TERMINAL"; //人员和终端关联表
26
    private String equipmentTableName = "LR_FACILITY"; //设施
28
29
	private String connName = "ebc";
30
	private String userAndDevicetableName = "LR_PARTY_TERMINAL"; // 人员和终端关联
31
	private String equipmentTableName = "LR_FACILITY"; // 设施表
27 32
28 33
	@Override
29
	public Map<String, String> queryDeviceInfo(JMap params) throws Exception {
34
	public Map<String, String> queryPageDeviceInfo(JMap params, int pageNum, int pageSize) throws Exception {
35
		Map<String, Object> paramsMap = new HashMap<String, Object>();
36
37
		paramsMap.put("pageNumber", String.valueOf(pageNum));
38
		paramsMap.put("pageSize", String.valueOf(pageSize));
39
		paramsMap.put("businessParams", params.get("businessParams"));
40
30 41
		// 拼接接口地址
31 42
		String url = IotUrlEnum.queryPageDevice.getUrl();
32
		// Map map = HttpURLConnectionUtil.iotCallMothod(url,params);
33
		return null;
43
		Map<String, String> map = NorthboundInterfaceUtil.iotPostCallUtil(url, paramsMap);
44
		return map;
34 45
	}
35
    @Override
36
    public List<Map<String, Object>> queryAssociatBoatInfo(JMap params) throws Exception {
37
        HashMap<String, Object> paramMap = new HashMap<>();
38
        paramMap.put("FACILITY_TYPE","3");
39
        CommonTableDao dao = IpuDaoManager.takeDao(CommonTableDao.class, connName);
40
        List<Map<String, Object>> boatList = dao.selectByCond(equipmentTableName, paramMap);
41
        return boatList;
42
    }
43 46
44 47
	@Override
45
	public Map<String, String> addDeviceInfo(Map<String, String> paramsMap) throws Exception {
48
	public List<Map<String, Object>> getBindDeviceList() throws Exception {
49
		StringBuilder sql = new StringBuilder();
50
51
		sql.append(" SELECT FACILITY_NAME NAME,DEVICE_ID FROM LR_FACILITY ");
52
		sql.append(" WHERE 1=1 ");
53
		sql.append(" AND FACILITY_TYPE ='").append(ProductEnum.ship.getProductId()).append("' ");
54
		sql.append(" AND DEVICE_ID IS NOT NULL ");
55
56
		sql.append(" UNION ALL ");
57
58
		sql.append(" SELECT PARTY_NAME NAME,DEVICE_ID FROM LR_PARTY_TERMINAL ");
59
		sql.append(" WHERE 1=1 ");
60
		sql.append(" AND DEVICE_ID IS NOT NULL ");
61
62
		List<Map<String, Object>> list = dao.executeSelect(sql.toString());
63
64
		return list == null ? new ArrayList<Map<String, Object>>() : list;
65
	}
66
67
	@Override
68
	public JMap queryOneDeviceInfo(JMap params) throws Exception {
69
		// 拼接接口地址
70
		String url = IotUrlEnum.queryOneDevice.getUrl() + params.getString("deviceId");
71
		Map<String, String> map = NorthboundInterfaceUtil.iotGetCallUtil(url);
72
73
		JMap deviceInfoMap = new JsonMap(JSONObject.toJSONString(map.get("result")));
74
		String remarks = deviceInfoMap.getString("remarks") == null ? "" : deviceInfoMap.getString("remarks");
75
		deviceInfoMap.put("remarks", remarks);
76
77
		return deviceInfoMap;
78
	}
79
80
	@Override
81
	public Map<String, String> addDeviceInfo(JMap params) throws Exception {
82
		Map<String, Object> paramsMap = new HashMap<String, Object>();
83
		String deviceNo = params.getString("deviceNo");
84
85
		paramsMap.put("deviceId", deviceNo);// 终端id
86
		paramsMap.put("terminalSN", deviceNo); // 终端编号
87
		paramsMap.put("productId", EbcConstant.beidouDevice_product_id); // 所属产品
88
		paramsMap.put("deviceName", EbcConstant.beidouDevice_name + deviceNo); // 设备名称
89
		paramsMap.put("remarks", params.getString("remarks")); // 备注
90
46 91
		// 拼接接口地址
47 92
		String url = IotUrlEnum.addDevice.getUrl();
48
		Map map = NorthboundInterfaceUtil.iotCallMothod(url, paramsMap);
93
		Map<String, String> map = NorthboundInterfaceUtil.iotPostCallUtil(url, paramsMap);
49 94
		return map;
50 95
	}
51
    @Override
52
    public Map<String, Object> queryAssociatUser (JMap params) throws Exception  {
53
        CommonTableDao dao = IpuDaoManager.takeDao(CommonTableDao.class, connName);
54
		List<Map<String, Object>> userAndDeviceList = dao.selectByCond(userAndDevicetableName, params);
55
		if(userAndDeviceList.isEmpty()){
56
			return null;
57
		}else {
58
			return userAndDeviceList.get(0);
59
		}
60
    }
61 96
62 97
	@Override
63
	public Map<String, String> modifyDeviceInfo(Map<String, String> paramsMap) throws Exception {
98
	public Map<String, String> modifyDeviceInfo(JMap params) throws Exception {
99
		Map<String, Object> paramsMap = new HashMap<String, Object>();
100
		String deviceId = params.getString("deviceId");
101
102
		paramsMap.put("deviceId", deviceId);// 终端id
103
		paramsMap.put("terminalSN", deviceId); // 终端编号
104
		paramsMap.put("productId", EbcConstant.beidouDevice_product_id); // 所属产品
105
		paramsMap.put("deviceName", EbcConstant.beidouDevice_name + deviceId); // 设备名称
106
		paramsMap.put("remarks", params.getString("remarks")); // 备注
107
64 108
		// 拼接接口地址
65 109
		String url = IotUrlEnum.updateDevice.getUrl();
66
		Map map = NorthboundInterfaceUtil.iotCallMothod(url, paramsMap);
110
		Map<String, String> map = NorthboundInterfaceUtil.iotPostCallUtil(url, paramsMap);
67 111
		return map;
68 112
	}
69 113
70 114
	@Override
71
	public Map<String, String> deleteDeviceInfo(Map<String, String> paramsMap) throws Exception {
115
	public Map<String, String> deleteDeviceInfo(JMap params) throws Exception {
72 116
		// 拼接接口地址
73
		String url = IotUrlEnum.deleteDevice.getUrl();
74
		Map map = NorthboundInterfaceUtil.iotCallMothod(url, paramsMap);
117
		String url = IotUrlEnum.deleteDevice.getUrl() + params.getString("deviceId");
118
		Map<String, String> map = NorthboundInterfaceUtil.iotGetCallUtil(url);
75 119
		return map;
76 120
	}
77 121
78 122
	@Override
123
	public List<Map<String, Object>> queryAssociatBoatInfo(JMap params) throws Exception {
124
		HashMap<String, Object> paramMap = new HashMap<>();
125
		paramMap.put("FACILITY_TYPE", "3");
126
		CommonTableDao dao = IpuDaoManager.takeDao(CommonTableDao.class, connName);
127
		List<Map<String, Object>> boatList = dao.selectByCond(equipmentTableName, paramMap);
128
		return boatList;
129
	}
130
131
	@Override
132
	public Map<String, Object> queryAssociatUser(JMap params) throws Exception {
133
		CommonTableDao dao = IpuDaoManager.takeDao(CommonTableDao.class, connName);
134
		List<Map<String, Object>> userAndDeviceList = dao.selectByCond(userAndDevicetableName, params);
135
		if (userAndDeviceList.isEmpty()) {
136
			return null;
137
		} else {
138
			return userAndDeviceList.get(0);
139
		}
140
	}
141
142
	@Override
79 143
	public int bindDevice(Map params, String type) throws Exception {
80 144
		HashMap<String, Object> paramsHashMap = new HashMap<>();
81 145
		if (EbcConstant.bind_device_type_user.equals(type)) {
82
			if(params.get("PARTY_TERMINAL_ID")!=null){
83
				//将之前终端与用户关联数据删除
84
				paramsHashMap.put("PARTY_TERMINAL_ID",params.get("PARTY_TERMINAL_ID"));
146
			if (params.get("PARTY_TERMINAL_ID") != null) {
147
				// 将之前终端与用户关联数据删除
148
				paramsHashMap.put("PARTY_TERMINAL_ID", params.get("PARTY_TERMINAL_ID"));
85 149
				dao.delete(userAndDevicetableName, paramsHashMap);
86 150
			}
87
			//插入一条新的关联数据
151
			// 插入一条新的关联数据
88 152
			return dao.insert(userAndDevicetableName, params);
89 153
		} else if (EbcConstant.bind_device_type_ship.equals(type)) {
90
			paramsHashMap.put("FACILITY_ID",params.get("FACILITY_ID"));
91
			paramsHashMap.put("DEVICE_ID",params.get("DEVICE_ID"));
154
			paramsHashMap.put("FACILITY_ID", params.get("FACILITY_ID"));
155
			paramsHashMap.put("DEVICE_ID", params.get("DEVICE_ID"));
92 156
			return dao.update(equipmentTableName, paramsHashMap);
93 157
		}
94 158
		return 0;
@ -98,13 +162,14 @@ public class DeviceManageDaoImpl extends AbstractBizDao implements DeviceManageD
98 162
	public int unbindDevice(Map params, String type) throws Exception {
99 163
		HashMap<String, Object> paramsHashMap = new HashMap<>();
100 164
		if (EbcConstant.bind_device_type_user.equals(type)) {
101
			paramsHashMap.put("DEVICE_ID",params.get("DEVICE_ID"));
102
			return dao.delete(userAndDevicetableName, paramsHashMap,false);
165
			paramsHashMap.put("DEVICE_ID", params.get("DEVICE_ID"));
166
			return dao.delete(userAndDevicetableName, paramsHashMap, false);
103 167
		} else if (EbcConstant.bind_device_type_ship.equals(type)) {
104
			paramsHashMap.put("FACILITY_ID",params.get("FACILITY_ID"));
105
			paramsHashMap.put("DEVICE_ID",null);
168
			paramsHashMap.put("FACILITY_ID", params.get("FACILITY_ID"));
169
			paramsHashMap.put("DEVICE_ID", null);
106 170
			return dao.update(equipmentTableName, paramsHashMap);
107 171
		}
108 172
		return 0;
109 173
	}
174
110 175
}

+ 52 - 11
ebc-sea-platform/src/main/java/com/ai/ipu/server/dao/interfaces/DeviceManageDao.java

@ -1,26 +1,67 @@
1 1
package com.ai.ipu.server.dao.interfaces;
2 2
3
import com.ai.ipu.data.JMap;
4
import com.github.pagehelper.PageInfo;
5
6 3
import java.util.List;
7 4
import java.util.Map;
8 5
6
import com.ai.ipu.data.JMap;
7
9 8
public interface DeviceManageDao {
10 9
11
	Map<String, String> queryDeviceInfo(JMap params) throws Exception;
10
	/**
11
	 * 分页查询终端信息
12
	 * 
13
	 * @param params
14
	 * @param pageNum 当前页数
15
	 * @param pageSize 每页条数
16
	 * @return
17
	 * @throws Exception
18
	 */
19
	Map<String, String> queryPageDeviceInfo(JMap params, int pageNum, int pageSize) throws Exception;
20
21
	/**
22
	 * 查询已和人员(船舶)绑定的终端信息
23
	 * @return
24
	 * @throws Exception
25
	 */
26
	List<Map<String, Object>> getBindDeviceList() throws Exception;
27
28
	/**
29
	 * 获取单个终端信息
30
	 * @param params
31
	 * @return
32
	 * @throws Exception
33
	 */
34
	JMap queryOneDeviceInfo(JMap params) throws Exception;
12 35
13
	Map<String, String> addDeviceInfo(Map<String, String> paramsMap) throws Exception;
36
	/**
37
	 * 新增终端信息
38
	 * @param params
39
	 * @return
40
	 * @throws Exception
41
	 */
42
	Map<String, String> addDeviceInfo(JMap params) throws Exception;
14 43
15
    List<Map<String, Object>> queryAssociatBoatInfo(JMap params) throws Exception;
44
	/**
45
	 * 修改终端信息
46
	 * @param params
47
	 * @return
48
	 * @throws Exception
49
	 */
50
	Map<String, String> modifyDeviceInfo(JMap params) throws Exception;
16 51
17
	Map<String, String> modifyDeviceInfo(Map<String, String> paramsMap) throws Exception;
52
	/**
53
	 * 删除终端信息
54
	 * @param params
55
	 * @return
56
	 * @throws Exception
57
	 */
58
	Map<String, String> deleteDeviceInfo(JMap params) throws Exception;
18 59
19
    Map<String, Object> queryAssociatUser(JMap params ) throws Exception ;
60
	List<Map<String, Object>> queryAssociatBoatInfo(JMap params) throws Exception;
20 61
21
	Map<String, String> deleteDeviceInfo(Map<String, String> paramsMap) throws Exception;
62
	Map<String, Object> queryAssociatUser(JMap params) throws Exception;
22 63
23
	int bindDevice(Map params,String type) throws Exception;
64
	int bindDevice(Map params, String type) throws Exception;
24 65
25
	int unbindDevice(Map params,String type) throws Exception;
66
	int unbindDevice(Map params, String type) throws Exception;
26 67
}

+ 8 - 10
ebc-sea-platform/src/main/java/com/ai/ipu/server/model/IotUrlEnum.java

@ -7,18 +7,16 @@ package com.ai.ipu.server.model;
7 7
 * 2020-10-20
8 8
 */
9 9
public enum IotUrlEnum {
10
	// 注册设备
10
	// 分页查询终端
11
	queryPageDevice("findTerminal"),
12
	// 添加终端
11 13
	addDevice("device"),
12
	// 删除设备
13
	deleteDevice("deleteDevice"),
14
	// 修改设备
14
	// 修改终端
15 15
	updateDevice("updateDevice"),
16
	// 查询指定设备
17
	queryDevice("device-detail"),
18
	// 分页查询设备
19
	queryPageDevice("findTerminal"),
20
	// 按产品id查询设备
21
	queryProductDevice("product/device-status");
16
	// 删除终端
17
	deleteDevice("deleteDevice?deviceId="),
18
	// 查询单个设备
19
	queryOneDevice("deviceSimpleDetail?deviceId=");
22 20
23 21
	private String url;
24 22

+ 108 - 44
ebc-sea-platform/src/main/java/com/ai/ipu/server/service/impl/DeviceManageServiceImpl.java

@ -1,11 +1,8 @@
1 1
package com.ai.ipu.server.service.impl;
2 2
3
import com.ai.ipu.data.JMap;
4
import com.ai.ipu.server.dao.interfaces.DeviceManageDao;
5
import com.ai.ipu.server.model.UserEnums;
6
import com.ai.ipu.server.service.interfaces.DeviceManageService;
7
import com.github.pagehelper.PageInfo;
3
import java.util.ArrayList;
8 4
import java.util.HashMap;
5
import java.util.List;
9 6
import java.util.Map;
10 7
11 8
import org.slf4j.Logger;
@ -13,9 +10,13 @@ import org.slf4j.LoggerFactory;
13 10
import org.springframework.beans.factory.annotation.Autowired;
14 11
import org.springframework.stereotype.Service;
15 12
16
import java.util.List;
13
import com.ai.ipu.data.JMap;
14
import com.ai.ipu.data.impl.JsonMap;
15
import com.ai.ipu.server.dao.interfaces.DeviceManageDao;
16
import com.ai.ipu.server.model.UserEnums;
17
import com.ai.ipu.server.service.interfaces.DeviceManageService;
17 18
import com.ai.ipu.server.util.EbcConstant;
18
19
import com.alibaba.fastjson.JSON;
19 20
20 21
@Service
21 22
public class DeviceManageServiceImpl implements DeviceManageService {
@ -25,49 +26,121 @@ public class DeviceManageServiceImpl implements DeviceManageService {
25 26
	DeviceManageDao deviceManageDao;
26 27
27 28
	@Override
28
	public PageInfo queryDeviceInfo(JMap params) throws Exception {
29
		PageInfo pageInfo = new PageInfo();
30
		Map map = deviceManageDao.queryDeviceInfo(params);
29
	public JMap queryPageDeviceInfo(JMap params, int pageNum, int pageSize) throws Exception {
30
		String isBindDevice = params.getString("IsBindDevice");// 是否绑定设备
31
		boolean bindDeviceBoolean = EbcConstant.bind_device_ok.equals(isBindDevice);
32
		boolean unBindDeviceBoolean = EbcConstant.bind_device_no.equals(isBindDevice);
33
34
		// 获取已绑定的设备列表
35
		List<Map<String, Object>> bindDeviceList = deviceManageDao.getBindDeviceList();
36
37
		// 查询条件
38
		Map<String, String> businessParams = new HashMap<String, String>();
39
		businessParams.put("specId", EbcConstant.beidouDevice_product_id); // 所属产品
40
		businessParams.put("terminalSN", params.getString("deviceNo")); // 设备序列号
41
42
		if (bindDeviceBoolean || unBindDeviceBoolean) {
43
			// 获取已绑定的设备ids(用逗号隔开)
44
			StringBuilder deviceIds = new StringBuilder();
45
			for (int i = 0; i < bindDeviceList.size(); i++) {
46
				deviceIds.append(bindDeviceList.get(i).get("DEVICE_ID"));
47
				if (i < bindDeviceList.size() - 1) {
48
					deviceIds.append(",");
49
				}
50
			}
51
52
			if (unBindDeviceBoolean) {
53
				businessParams.put("resourceIdList", deviceIds.toString());
54
			} else if (unBindDeviceBoolean) {
55
				businessParams.put("notIn", deviceIds.toString());
56
			}
57
		}
31 58
32
		return pageInfo;
59
		// 查询终端信息列表
60
		params.put("businessParams", businessParams);
61
		Map<String, String> deviceInfoMap = deviceManageDao.queryPageDeviceInfo(params, pageNum, pageSize);
62
		List<Map> deviceInfoList = JSON.parseArray(JSON.toJSONString(deviceInfoMap.get("result")), Map.class);
63
64
		// 整理返回数据信息
65
		List<Map> dataList = new ArrayList<Map>();
66
		if (deviceInfoList != null && deviceInfoList.size() > 0) {
67
			for (Map map : deviceInfoList) {
68
				Map dataMap = new HashMap();
69
70
				// 终端编号
71
				String deviceId = String.valueOf(map.get("resourceId"));
72
				dataMap.put("deviceNo", deviceId);
73
74
				// 备注
75
				String remarks = String.valueOf(map.get("remarks"));
76
				remarks = (remarks == null || "".equals(remarks) || "null".equals(remarks)) ? "无" : remarks;
77
				dataMap.put("remarks", remarks);
78
79
				// 绑定信息
80
				dataMap.put("BIND_NAME", "--");
81
				if (!unBindDeviceBoolean) {
82
					for (Map bindDeviceMap : bindDeviceList) {
83
						if (deviceId.equals(String.valueOf(bindDeviceMap.get("DEVICE_ID")))) {
84
							dataMap.put("BIND_NAME", bindDeviceMap.get("NAME"));
85
							break;
86
						}
87
					}
88
				}
89
90
				dataList.add(dataMap);
91
			}
92
		}
93
94
		// 返回数据
95
		JMap result = new JsonMap();
96
		result.put("dataNum", deviceInfoMap.get("totalResultNumber"));
97
		result.put("dataList", dataList);
98
		return result;
33 99
	}
34 100
35 101
	@Override
36
	public Map<String, String> addDeviceInfo(JMap params) throws Exception {
37
		Map<String, String> paramsMap = new HashMap<String, String>();
38
		String deviceId = params.getString("deviceId");
102
	public List<Map<String, Object>> queryListDeviceInfo(JMap params, int pageNum, int pageSize) throws Exception {
103
		// 查询条件
104
		Map<String, String> businessParams = new HashMap<String, String>();
105
		businessParams.put("specId", EbcConstant.beidouDevice_product_id); // 所属产品
106
		businessParams.put("terminalSN", params.getString("deviceNo")); // 设备序列号
107
		params.put("businessParams", businessParams);
39 108
40
		paramsMap.put("deviceId", deviceId);// 终端id
41
		paramsMap.put("terminalSN", deviceId); // 终端编号
42
		paramsMap.put("productId", EbcConstant.beidouDevice_product_id); // 所属产品
43
		paramsMap.put("deviceName", EbcConstant.beidouDevice_name + deviceId); // 设备名称
44
		paramsMap.put("remarks", params.getString("remarks")); // 备注
109
		Map<String, String> deviceInfoMap = deviceManageDao.queryPageDeviceInfo(params, pageNum, pageSize);
110
		List<Map> deviceInfoList = JSON.parseArray(deviceInfoMap.get("result"), Map.class);
45 111
46
		Map map = deviceManageDao.addDeviceInfo(paramsMap);
47
		return map;
112
		return queryListDeviceInfo(params, pageNum, pageSize);
48 113
	}
49 114
50 115
	@Override
51
	public Map<String, String> modifyDeviceInfo(JMap params) throws Exception {
52
		Map<String, String> paramsMap = new HashMap<String, String>();
53
		String deviceId = params.getString("deviceId");
116
	public JMap queryOneDeviceInfo(JMap params) throws Exception {
117
		return deviceManageDao.queryOneDeviceInfo(params);
118
	}
119
120
	@Override
121
	public Map<String, String> addDeviceInfo(JMap params) throws Exception {
122
		return deviceManageDao.addDeviceInfo(params);
123
	}
54 124
55
		paramsMap.put("deviceId", params.getString("deviceId"));// 终端id
56
		paramsMap.put("remarks", params.getString("remarks")); // 备注
125
	@Override
126
	public Map<String, String> modifyDeviceInfo(JMap params) throws Exception {
127
		return deviceManageDao.modifyDeviceInfo(params);
128
	}
57 129
58
		Map map = deviceManageDao.modifyDeviceInfo(paramsMap);
59
		return map;
130
	@Override
131
	public Map<String, String> deleteDeviceInfo(JMap params) throws Exception {
132
		return deviceManageDao.deleteDeviceInfo(params);
60 133
	}
61 134
62 135
	@Override
63 136
	public List<Map<String, Object>> queryAssociatInfo(JMap params) throws Exception {
64 137
		if (EbcConstant.bind_device_type_user.equals(params.get("type"))) {
65
			//类型是用户,查询用户列表
66
			//调用uspa接口获取人员信息 暂时用枚举
138
			// 类型是用户,查询用户列表
139
			// 调用uspa接口获取人员信息 暂时用枚举
67 140
			List<Map<String, Object>> userList = UserEnums.getUserList();
68 141
			return userList;
69
		} else if (EbcConstant.bind_device_type_ship.equals(params.get("type"))){
70
			//类型是船舶,查询船舶列表
142
		} else if (EbcConstant.bind_device_type_ship.equals(params.get("type"))) {
143
			// 类型是船舶,查询船舶列表
71 144
			return deviceManageDao.queryAssociatBoatInfo(params);
72 145
		}
73 146
		return null;
@ -75,22 +148,12 @@ public class DeviceManageServiceImpl implements DeviceManageService {
75 148
76 149
	@Override
77 150
	public Map<String, Object> verifyUserOrBoatAssociatInfo(JMap params) throws Exception {
78
		//查询用户与终端关联表,如果有数据返回,无数据返回空
79
		Map<String, Object> userAndDeviceMap=  deviceManageDao.queryAssociatUser(params);
151
		// 查询用户与终端关联表,如果有数据返回,无数据返回空
152
		Map<String, Object> userAndDeviceMap = deviceManageDao.queryAssociatUser(params);
80 153
		return userAndDeviceMap;
81 154
	}
82 155
83 156
	@Override
84
	public Map<String, String> deleteDeviceInfo(JMap params) throws Exception {
85
		Map<String, String> paramsMap = new HashMap<String, String>();
86
		paramsMap.put("deviceId", params.getString("deviceId"));// 终端id (支持删多个,用逗号分隔)
87
		paramsMap.put("productId", EbcConstant.beidouDevice_product_id); // 所属产品
88
89
		Map map = deviceManageDao.deleteDeviceInfo(paramsMap);
90
		return map;
91
	}
92
93
	@Override
94 157
	public boolean bindDevice(JMap params) throws Exception {
95 158
		int num = deviceManageDao.bindDevice(params, params.getString("type"));
96 159
		return num > 0;
@ -101,4 +164,5 @@ public class DeviceManageServiceImpl implements DeviceManageService {
101 164
		int num = deviceManageDao.unbindDevice(params, params.getString("type"));
102 165
		return num > 0;
103 166
	}
167
104 168
}

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

@ -26,7 +26,7 @@ public class GisTokenServiceImpl implements GisTokenService {
26 26
27 27
	@Override
28 28
	public Map<String, Object> queryGisToken() {
29
		Map<String, String> mapParams = new HashMap<>();
29
		Map<String, Object> mapParams = new HashMap<>();
30 30
		mapParams.put("userName", gisUserName);
31 31
		mapParams.put("passwd", gisPasswd);
32 32

+ 46 - 4
ebc-sea-platform/src/main/java/com/ai/ipu/server/service/interfaces/DeviceManageService.java

@ -1,20 +1,62 @@
1 1
package com.ai.ipu.server.service.interfaces;
2 2
3
import java.util.List;
3 4
import java.util.Map;
4 5
5 6
import com.ai.ipu.data.JMap;
6
import com.github.pagehelper.PageInfo;
7
8
import java.util.List;
9 7
10 8
public interface DeviceManageService {
11 9
12
	PageInfo queryDeviceInfo(JMap params) throws Exception;
10
	/**
11
	 * 分页查询终端信息
12
	 * @param params
13
	 * @param pageNum 当前页数
14
	 * @param pageSize 每页条数
15
	 * @return
16
	 * @throws Exception
17
	 */
18
	JMap queryPageDeviceInfo(JMap params, int pageNum, int pageSize) throws Exception;
19
20
	/**
21
	 * 获取下拉列表的终端信息
22
	 * @param params
23
	 * @param pageNum 当前页数
24
	 * @param pageSize 每页条数
25
	 * @return
26
	 * @throws Exception
27
	 */
28
	List<Map<String, Object>> queryListDeviceInfo(JMap params, int pageNum, int pageSize) throws Exception;
29
30
	/**
31
	 * 获取单个终端信息
32
	 * @param params
33
	 * @return
34
	 * @throws Exception
35
	 */
36
	JMap queryOneDeviceInfo(JMap params) throws Exception;
13 37
38
	/**
39
	 * 新增终端信息
40
	 * @param params
41
	 * @return
42
	 * @throws Exception
43
	 */
14 44
	Map<String, String> addDeviceInfo(JMap params) throws Exception;
15 45
46
	/**
47
	 * 修改终端信息
48
	 * @param params
49
	 * @return
50
	 * @throws Exception
51
	 */
16 52
	Map<String, String> modifyDeviceInfo(JMap params) throws Exception;
17 53
54
	/**
55
	 * 删除终端信息
56
	 * @param params
57
	 * @return
58
	 * @throws Exception
59
	 */
18 60
	Map<String, String> deleteDeviceInfo(JMap params) throws Exception;
19 61
20 62
	boolean bindDevice(JMap params) throws Exception;

+ 2 - 0
ebc-sea-platform/src/main/java/com/ai/ipu/server/service/interfaces/MapTagManageService.java

@ -10,6 +10,8 @@ public interface MapTagManageService {
10 10
	/**
11 11
	 * 分页查询围栏信息
12 12
	 * @param params
13
	 * @param pageNum 当前页数
14
	 * @param pageSize 每页条数
13 15
	 * @return
14 16
	 * @throws Exception
15 17
	 */

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

@ -6,37 +6,40 @@ package com.ai.ipu.server.util;
6 6
 * 2020-10-20
7 7
 */
8 8
public class EbcConstant {
9
	// 下拉列表最大查询条数
10
	public static final int comboBox_maxNum = 20;
11
9 12
	// 终端的产品id
10 13
	public static final String beidouDevice_product_id = "57700004344";
11
	
14
12 15
	// 终端的名称前缀
13 16
	public static final String beidouDevice_name = "康派北斗定位器";
14 17
15
	//全部终端(已关联和未关联)
18
	// 全部终端(已关联和未关联)
16 19
	public static final String bind_device_all = "0";
17
	
18
	//已关联终端
20
21
	// 已关联终端
19 22
	public static final String bind_device_ok = "1";
20
	
21
	//未关联终端
23
24
	// 未关联终端
22 25
	public static final String bind_device_no = "2";
23
	
26
24 27
	// 终端和人员绑定
25 28
	public static final String bind_device_type_user = "1";
26 29
27 30
	// 终端和船舶绑定
28 31
	public static final String bind_device_type_ship = "2";
29
	
30
	//围栏标记类型:考勤区域
32
33
	// 围栏标记类型:考勤区域
31 34
	public static final String area_type_attendance = "1";
32
	
33
	//围栏标记类型:作业区域
35
36
	// 围栏标记类型:作业区域
34 37
	public static final String area_type_job = "2";
35
	
36
	//围栏标记类型:电子围栏
38
39
	// 围栏标记类型:电子围栏
37 40
	public static final String area_type_exclusion = "3";
38
	
39
	//围栏标记类型:定点
41
42
	// 围栏标记类型:定点
40 43
	public static final String area_type_temporariness = "4";
41
	
44
42 45
}

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

@ -201,7 +201,7 @@ public class HttpServiceUtil {
201 201
		return responseEx(httpClient, response, encoding);
202 202
	}
203 203
204
	public static String sendPost(String url, Map<String, String> params, Charset encoding) {
204
	public static String sendPost(String url, Map<String, Object> params, Charset encoding) {
205 205
		HttpClient httpClient = HttpClients.createDefault();
206 206
		String resp = "";
207 207
		HttpPost httpPost = new HttpPost(url);
@ -219,7 +219,7 @@ public class HttpServiceUtil {
219 219
		return responseEx(httpClient, response, encoding);
220 220
	}
221 221
222
	public static String sendPost(String url, Map<String, String> params, Charset encoding,
222
	public static String sendPost(String url, Map<String, Object> params, Charset encoding,
223 223
			Map<String, String> headerMap) {
224 224
		HttpClient httpClient = HttpClients.createDefault();
225 225
		String resp = "";

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

@ -27,6 +27,9 @@ public class NorthboundInterfaceUtil {
27 27
	private static String userCode;
28 28
	private static String passWord;
29 29
30
	// 调用成功标识
31
	public static final String resultCode_succeed = "0";
32
30 33
	@Value("${aap.iot.userCode}")
31 34
	public void setUserCode(String userCode) {
32 35
		NorthboundInterfaceUtil.userCode = userCode;
@ -62,45 +65,67 @@ public class NorthboundInterfaceUtil {
62 65
	}
63 66
64 67
	/**
65
	 * 调用登录接口获取sessionId与sign
68
	 * GET请求调用北向接口方法
66 69
	 * 
70
	 * @param url
71
	 * @param params
67 72
	 * @return
73
	 * @throws Exception
68 74
	 */
69
	public static Map<String, String> iotLogin() {
70
		logger.debug("登录北向接口");
75
	public static Map<String, String> iotGetCallUtil(String url) throws Exception {
76
		// 调用北向服务的接口
77
		logger.debug("GET调用北向接口");
71 78
72
		// 调用登录接口获取sessionId与sign
73
		HashMap<String, String> loginParamMap = new HashMap<>();
74
		loginParamMap.put("userCode", userCode);
75
		loginParamMap.put("passWord", passWord);
79
		// 1.在缓存中获取sessionId与sign
80
		Map<String, String> mapCache = NorthboundInterfaceUtil.getMapCache();
81
		if (mapCache.isEmpty() || mapCache.get("sign") == null || mapCache.get("sessionId") == null) {
82
			// 2.如果没有调用登录接口从新获取
83
			NorthboundInterfaceUtil.iotLogin();
84
		}
76 85
77
		// 设置字符集
86
		// 3.调用北向服务接口
87
		// (1)设置字符集
78 88
		Charset charset = Charset.forName("utf-8");
89
		// (2)调用接口
90
		String resultJson = HttpServiceUtil.sendGet(url, charset);
91
		// (3)将参数转为Map<String,String>【将返回值统一为String】
92
		Map<String, String> resultMap = JSON.parseObject(resultJson, Map.class);
79 93
80
		// 调用登录接口
81
		String loginResult = HttpServiceUtil.sendPost(UrlAddress.IOT_LOGIN, loginParamMap, charset);
82
83
		Map mapType = JSON.parseObject(loginResult, Map.class);
84
		Map result = (Map) mapType.get("result");
94
		// 4.登录超时,需重新登录
95
		if ("登录超时".equals(resultMap.get("resultMsg"))) {
96
			logger.info("调用北向接口失败,需重新登录");
97
			// 4.调用不成功可能是登录过期
98
			// (1)清除缓存
99
			NorthboundInterfaceUtil.clear();
100
			// (2)重新登录
101
			NorthboundInterfaceUtil.iotLogin();
102
			// (3)再次调用接口
103
			String fianlresultJson = HttpServiceUtil.sendGet(url, charset);
104
			// (4)获取返回值
105
			resultMap = JSON.parseObject(fianlresultJson, Map.class);
106
		}
85 107
86
		if ("0".equals(String.valueOf(mapType.get("resultCode")))) {
87
			logger.info("登录北向接口成功");
88
			// 将数据存到缓存中
89
			NorthboundInterfaceUtil.setMapCache(result);
108
		// 5.判断是否调用成功
109
		if ("0".equals(resultMap.get("resultCode"))) {
110
			logger.info("调用北向接口成功");
90 111
		} else {
91
			logger.info("登录北向接口失败");
112
			logger.info("调用北向接口失败");
92 113
		}
93
		return cacheMap;
114
115
		return resultMap;
94 116
	}
95 117
96 118
	/**
97
	 * 调用北向接口方法
119
	 * POST请求调用北向接口方法
98 120
	 * 
121
	 * @param url
122
	 * @param params
99 123
	 * @return
124
	 * @throws Exception
100 125
	 */
101
	public static Map<String, String> iotCallMothod(String url, Map<String, String> params) throws Exception {
126
	public static Map<String, String> iotPostCallUtil(String url, Map<String, Object> params) throws Exception {
102 127
		// 调用北向服务的接口
103
		logger.debug("调用北向接口");
128
		logger.debug("POSt调用北向接口");
104 129
105 130
		// 1.在缓存中获取sessionId与sign
106 131
		Map<String, String> mapCache = NorthboundInterfaceUtil.getMapCache();
@ -110,14 +135,14 @@ public class NorthboundInterfaceUtil {
110 135
		}
111 136
112 137
		// 3.调用北向服务接口
113
		// 设置字符集
138
		// (1)设置字符集
114 139
		Charset charset = Charset.forName("utf-8");
115
		// (1)调用接口
116
		String resultJson = HttpServiceUtil.sendPost(url, params, charset);
117
		// (2)将参数转为Map<String,String>【将返回值统一为String】
140
		// (2)调用接口
141
		String resultJson = HttpServiceUtil.sendPost(url, params, charset, getMapCache());
142
		// (3)将参数转为Map<String,String>【将返回值统一为String】
118 143
		Map<String, String> resultMap = JSON.parseObject(resultJson, Map.class);
119 144
120
		// 登录超时,需重新登录
145
		// 4.登录超时,需重新登录
121 146
		if ("登录超时".equals(resultMap.get("resultMsg"))) {
122 147
			logger.info("调用北向接口失败,需重新登录");
123 148
			// 4.调用不成功可能是登录过期
@ -126,12 +151,12 @@ public class NorthboundInterfaceUtil {
126 151
			// (2)重新登录
127 152
			NorthboundInterfaceUtil.iotLogin();
128 153
			// (3)再次调用接口
129
			String fianlresultJson = HttpServiceUtil.sendPost(url, params, charset);
154
			String fianlresultJson = HttpServiceUtil.sendPost(url, params, charset, getMapCache());
130 155
			// (4)获取返回值
131 156
			resultMap = JSON.parseObject(fianlresultJson, Map.class);
132 157
		}
133 158
134
		// 判断是否调用成功
159
		// 5.判断是否调用成功
135 160
		if ("0".equals(resultMap.get("resultCode"))) {
136 161
			logger.info("调用北向接口成功");
137 162
		} else {
@ -141,4 +166,36 @@ public class NorthboundInterfaceUtil {
141 166
		return resultMap;
142 167
	}
143 168
169
	/**
170
	 * 调用登录接口获取sessionId与sign
171
	 * 
172
	 * @return
173
	 */
174
	private static Map<String, String> iotLogin() {
175
		logger.debug("登录北向接口");
176
177
		// 调用登录接口获取sessionId与sign
178
		HashMap<String, Object> loginParamMap = new HashMap<>();
179
		loginParamMap.put("userCode", userCode);
180
		loginParamMap.put("passWord", passWord);
181
182
		// 设置字符集
183
		Charset charset = Charset.forName("utf-8");
184
185
		// 调用登录接口
186
		String loginResult = HttpServiceUtil.sendPost(UrlAddress.IOT_LOGIN, loginParamMap, charset);
187
188
		Map mapType = JSON.parseObject(loginResult, Map.class);
189
		Map result = (Map) mapType.get("result");
190
191
		if ("0".equals(String.valueOf(mapType.get("resultCode")))) {
192
			logger.info("登录北向接口成功");
193
			// 将数据存到缓存中
194
			NorthboundInterfaceUtil.setMapCache(result);
195
		} else {
196
			logger.info("登录北向接口失败");
197
		}
198
		return cacheMap;
199
	}
200
144 201
}

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

@ -32,13 +32,13 @@
32 32
		<update id="updateMapTagInfo" parameterType="ai.ipu.data.JMap">
33 33
		UPDATE LR_MAP_TAG
34 34
			<set>
35
				<if test="mapTagName != null">
35
				<if test="mapTagName != null and mapTagName != ''">
36 36
					MAP_TAG_NAME = #{mapTagName},
37 37
				</if>
38
				<if test="mapTagType != null">
38
				<if test="mapTagType != null and mapTagType != ''">
39 39
					MAP_TAG_TYPE = #{mapTagType},
40 40
				</if>
41
				<if test="mapTagShape != null">
41
				<if test="mapTagShape != null and mapTagShape != ''">
42 42
					MAP_TAG_SHAPE = POLYGONFROMTEXT(#{mapTagShape}),
43 43
				</if>
44 44
				<if test="mapTagContent != null">