wangchao преди 4 години
родител
ревизия
d40c613702

+ 0 - 13
ebc-sea-platform/pom.xml

@ -53,19 +53,6 @@
53 53
				<updatePolicy>always</updatePolicy>
54 54
			</snapshots>
55 55
		</repository>
56
		<!-- Uspa仓库 -->
57
		<repository>
58
			<id>maven-public</id>
59
			<name>maven-public</name>
60
			<url>http://10.1.252.197:8081/repository/maven-public/</url>
61
			<releases>
62
				<enabled>true</enabled>
63
			</releases>
64
			<snapshots>
65
				<enabled>true</enabled>
66
				<updatePolicy>always</updatePolicy>
67
			</snapshots>
68
		</repository>
69 56
	</repositories>
70 57

71 58
	<dependencies>

+ 4 - 3
ebc-sea-platform/src/main/java/com/ai/ipu/server/EbcSeaPlatformStart.java

@ -1,13 +1,14 @@
1 1
package com.ai.ipu.server;
2 2

3
import com.ai.ipu.server.connect.ConnectServerStart;
4
import com.ai.ipu.server.connect.util.ConnectServerManager;
5
import com.ai.ipu.server.stomp.WebSocketStompServer;
3 6
import org.slf4j.Logger;
4 7
import org.slf4j.LoggerFactory;
5 8
import com.ai.ipu.basic.reflect.ReflectUtil;
6 9
import com.ai.ipu.basic.util.IpuBaseException;
7 10
import com.ai.ipu.restful.boot.IpuRestApplication;
8
import com.ai.ipu.server.connect.ConnectServerStart;
9
import com.ai.ipu.server.connect.util.ConnectServerManager;
10
import com.ai.ipu.server.stomp.WebSocketStompServer;
11

11 12

12 13
/**
13 14
 * @author huangbo@asiainfo.com

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

@ -20,81 +20,126 @@ import java.util.Map;
20 20
@Controller
21 21
@RequestMapping("/device")
22 22
public class DeviceManageController {
23
	Logger logger = LoggerFactory.getLogger(DeviceManageController.class);
23 24
24
    @Autowired
25
    DeviceManageService deviceManageService;
25
	@Autowired
26
	DeviceManageService deviceManageService;
26 27
27
    Logger logger = LoggerFactory.getLogger(DeviceManageController.class);
28
    /**
29
     * 查询终端信息
30
     */
31
    @ResponseBody
32
    @RequestMapping("/queryDeviceInfo")
33
    public JMap queryDeviceInfo(JMap params) throws Exception {
28
	/**
29
	 * 分页查询终端信息
30
	 */
31
	@ResponseBody
32
	@RequestMapping("/queryDeviceInfo")
33
	public JMap queryDeviceInfo(JMap params) throws Exception {
34
		Map<String,String> params1 = (Map<String, String>) params.get("params"); // 参数
34 35
35
        PageInfo deviceList=  deviceManageService.queryDeviceInfo(params);
36
        JMap result = new JsonMap();
37
        result.put("result", deviceList);
38
        return result;
39
    }
36
		PageInfo deviceList = deviceManageService.queryDeviceInfo(params);
37
		JMap result = new JsonMap();
38
		result.put("result", deviceList);
39
		return result;
40
	}
40 41
42
	/**
43
	 * 添加终端信息
44
	 */
45
	@ResponseBody
46
	@RequestMapping("/addDeviceInfo")
47
	public JMap addDeviceInfo(JMap params) throws Exception {
48
		JMap params1 = params.getJMap("params"); // 参数
49
		JMap result = new JsonMap(); // 返回值
50
		try {
51
			Map<String, String> resultMap = deviceManageService.addDeviceInfo(params1);
52
			if ("0".equals(resultMap.get("resultCode"))) {
53
				result.put("result", true);
54
			} else {
55
				result.put("result", false);
56
				result.put("errMsg", "添加失败:" + resultMap.get("resultMsg"));
57
			}
58
		} catch (Exception e) {
59
			logger.error("添加失败,原因为:" + e.getMessage());
60
			result.put("result", false);
61
			result.put("errMsg", "添加失败");
62
		}
41 63
42
    /**
43
     * 编辑终端信息、增加终端信息
44
     */
45
    @ResponseBody
46
    @RequestMapping("/modifyDeviceInfo")
47
    public JMap modifyDeviceInfo(JMap params) throws Exception {
48
        int num=0;
49
        //取值判断如果有当前id则为修改,否则为新增
50
        JMap params1 = params.getJMap("params");
51
        try{
52
            if(params1.getInt("MAP_TAG_ID")!=0){
53
                num= deviceManageService.modifyDeviceInfo(params1);
54
            }else{
55
                num= deviceManageService.addDeviceInfo(params1);
56
            }
57
        }catch(Exception e){
58
            logger.error("异常,原因为:" + e.getMessage());
59
        }
60
        JMap result = new JsonMap();
61
        if(num>0){
62
            result.put("result", true);
63
        }else{
64
            result.put("result", false);
65
        }
66
        return result;
67
    }
64
		return result;
65
	}
68 66
69
    /**
70
     * 刪除终端管理
71
     *
72
     */
73
    @ResponseBody
74
    @RequestMapping("/deleteDeviceInfo")
75
    public JMap deleteDeviceInfo(JMap params) throws Exception {
76
        boolean flag=false;
77
        if(params.getInt("MAP_TAG_ID")!=0){
78
            flag=  deviceManageService.deleteDeviceXyInfo(params);
79
        }
80
        JMap result = new JsonMap();
81
        result.put("result", flag);
82
        return result;
83
    }
84
    /**
85
     * 导入终端信息
86
     */
87
    @ResponseBody
88
    @RequestMapping("/importDeviceInfo")
89
    public JMap importDeviceInfo(JMap params) throws Exception {
90
        boolean flag=false;
91
        if(params.getInt("MAP_TAG_ID")!=0){
92
            //flag=  userManageService.importUserInfo(params);
93
        }
94
        JMap result = new JsonMap();
95
        result.put("result", flag);
96
        return result;
97
    }
67
	/**
68
	 * 修改终端信息
69
	 */
70
	@ResponseBody
71
	@RequestMapping("/modifyDeviceInfo")
72
	public JMap modifyDeviceInfo(JMap params) throws Exception {
73
		JMap params1 = params.getJMap("params"); // 参数
74
		JMap result = new JsonMap(); // 返回值
75
		try {
76
			Map<String, String> resultMap = deviceManageService.modifyDeviceInfo(params1);
77
			if ("0".equals(resultMap.get("resultCode"))) {
78
				result.put("result", true);
79
			} else {
80
				result.put("result", false);
81
				result.put("errMsg", "修改失败:" + resultMap.get("resultMsg"));
82
			}
83
		} catch (Exception e) {
84
			logger.error("异常,原因为:" + e.getMessage());
85
			result.put("result", false);
86
			result.put("errMsg", "修改失败");
87
		}
88
89
		return result;
90
	}
91
92
	/**
93
	 * 删除终端信息
94
	 */
95
	@ResponseBody
96
	@RequestMapping("/deleteDeviceInfo")
97
	public JMap deleteDeviceInfo(JMap params) throws Exception {
98
		JMap params1 = params.getJMap("params"); // 参数
99
		JMap result = new JsonMap(); // 返回值
100
		try {
101
			if (params1.get("deviceId") != null && !"".equals(params1.get("deviceId"))) {
102
				Map<String, String> resultMap = deviceManageService.deleteDeviceInfo(params1);
103
104
				if ("0".equals(resultMap.get("resultCode"))) {
105
					result.put("result", true);
106
				} else {
107
					result.put("result", false);
108
					result.put("errMsg", resultMap.get("resultMsg"));
109
				}
110
			} else {
111
				result.put("result", false);
112
				result.put("errMsg", "删除失败:终端为空");
113
			}
114
115
		} catch (Exception e) {
116
			logger.error("异常,原因为:" + e.getMessage());
117
			result.put("result", false);
118
			result.put("errMsg", "删除失败");
119
		}
120
121
		return result;
122
	}
123
124
	/**
125
	 * 关联终端
126
	 */
127
	@ResponseBody
128
	@RequestMapping("/bindDevice")
129
	public JMap bindDevice(JMap params) throws Exception {
130
		JMap result = new JsonMap(); // 返回值
131
		if (params.get("deviceId") != null && "".equals(params.get("deviceId"))) {
132
			boolean flag = false;
133
			flag = deviceManageService.bindDevice(params);
134
			result.put("result", flag);
135
		} else {
136
			logger.error("关联终端失败:设备id为空");
137
			result.put("result", false);
138
			result.put("errMsg", "关联终端失败");
139
		}
140
		return result;
141
142
	}
98 143
99 144
	/**
100 145
	 * 解绑终端
@ -114,6 +159,19 @@ public class DeviceManageController {
114 159
		result.put("result", flag);
115 160
		return result;
116 161
	}
162
163
	/**
164
	 * 关联列表信息查询
165
	 */
166
	@ResponseBody
167
	@RequestMapping("/queryAssociatInfo")
168
	public JMap queryAssociatInfo(JMap params) throws Exception {
169
		List<Map<String, Object>> userList=  deviceManageService.queryAssociatInfo(params);
170
		JMap result = new JsonMap();
171
		result.put("result", userList);
172
		return result;
173
	}
174
117 175
    /**
118 176
     * 关联用户的用户列表信息查询
119 177
     */

+ 3 - 3
ebc-sea-platform/src/main/java/com/ai/ipu/server/controller/EquipmentManageController.java

@ -107,10 +107,10 @@ public class EquipmentManageController {
107 107
     */
108 108
    @ResponseBody
109 109
    @RequestMapping("/importEquipmentsInfo")
110
    public JMap importEquipmentsInfo(JMap params) throws Exception{
110
    public JMap importEquipmentsInfo(List<Map<String,Object>> paramsList) throws Exception{
111 111
        boolean flag=false;
112
        if(params.getInt("MAP_TAG_ID")!=0){
113
            flag=  equipmentManageService.importEquipmentInfo(params);
112
        if(!paramsList.isEmpty()){
113
            flag=  equipmentManageService.importEquipmentInfo(paramsList);
114 114
        }
115 115
        JMap result = new JsonMap();
116 116
        result.put("result", flag);

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

@ -1,6 +1,8 @@
1 1
package com.ai.ipu.server.dao.impl;
2 2
3 3
import java.io.IOException;
4
import java.util.HashMap;
5
import java.util.List;
4 6
import java.util.Map;
5 7
6 8
import org.springframework.stereotype.Component;

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

@ -15,13 +15,8 @@ import org.springframework.stereotype.Service;
15 15
16 16
import java.util.Iterator;
17 17
import java.util.List;
18
import java.util.Map;
19
20
import com.ai.ipu.data.JMap;
21
import com.ai.ipu.server.dao.interfaces.DeviceManageDao;
22
import com.ai.ipu.server.service.interfaces.DeviceManageService;
23 18
import com.ai.ipu.server.util.EbcConstant;
24
import com.github.pagehelper.PageInfo;
19
25 20
26 21
@Service
27 22
public class DeviceManageServiceImpl implements DeviceManageService {
@ -37,16 +32,7 @@ public class DeviceManageServiceImpl implements DeviceManageService {
37 32
38 33
		return pageInfo;
39 34
	}
40
    @Override
41
    public PageInfo queryDeviceInfo(JMap params) throws Exception {
42
        return null;
43
    }
44 35
45
    @Override
46
    public int modifyDeviceInfo(JMap params) throws Exception{
47
        //將原來数据删除,然后在从新插入
48
        return 0;
49
    }
50 36
	@Override
51 37
	public Map<String, String> addDeviceInfo(JMap params) throws Exception {
52 38
		Map<String, String> paramsMap = new HashMap<String, String>();
@ -62,10 +48,6 @@ public class DeviceManageServiceImpl implements DeviceManageService {
62 48
		return map;
63 49
	}
64 50
65
    @Override
66
    public int addDeviceInfo(JMap params) throws Exception{
67
        return 0;
68
    }
69 51
	@Override
70 52
	public Map<String, String> modifyDeviceInfo(JMap params) throws Exception {
71 53
		Map<String, String> paramsMap = new HashMap<String, String>();
@ -78,10 +60,10 @@ public class DeviceManageServiceImpl implements DeviceManageService {
78 60
		return map;
79 61
	}
80 62
81
    @Override
82
    public boolean deleteDeviceXyInfo(JMap params) throws Exception{
83
        return true;
84
    }
63
	@Override
64
	public List<Map<String, Object>> queryAssociatInfo(JMap params) throws Exception {
65
		return null;
66
	}
85 67
86 68
    @Override
87 69
    public List<Map<String, Object>> queryAssociatUserInfo(JMap params) throws Exception{
@ -118,6 +100,9 @@ public class DeviceManageServiceImpl implements DeviceManageService {
118 100
    public int associatBoatSave(JMap params) throws Exception {
119 101
        return deviceManageDao.associatBoatSave(params);
120 102
    }
103
104
105
121 106
	@Override
122 107
	public Map<String, String> deleteDeviceInfo(JMap params) throws Exception {
123 108
		Map<String, String> paramsMap = new HashMap<String, String>();
@ -139,5 +124,4 @@ public class DeviceManageServiceImpl implements DeviceManageService {
139 124
		int num = deviceManageDao.bindDevice(params, params.getString("type"));
140 125
		return num > 0;
141 126
	}
142
143 127
}

+ 0 - 5
ebc-sea-platform/src/main/java/com/ai/ipu/server/service/impl/EquipmentManageServiceImpl.java

@ -29,11 +29,6 @@ public class EquipmentManageServiceImpl implements EquipmentManageService {
29 29
30 30
    @Override
31 31
    public PageInfo queryEquipmentInfo(JMap params) throws Exception {
32
        PageInfo pageInfo = new PageInfo();
33
        //拼接接口地址
34
        //String IOT_URL=UrlAddress.IOT_URL+"device";
35
        //Map map = HttpURLConnectionUtil.iotCallMothod(params, IOT_URL);
36
        return pageInfo;
37 32
        return equipmentManageDao.queryEquipmentInfo(params);
38 33
    }
39 34

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

@ -27,9 +27,8 @@ public class GisTokenServiceImpl implements GisTokenService {
27 27
	@Override
28 28
	public Map<String, Object> queryGisToken() {
29 29
		Map<String, String> mapParams = new HashMap<>();
30
		HashMap<Object, Object> requestParams = new HashMap<>();
31
		requestParams.put("userName", gisUserName);
32
		requestParams.put("passwd", gisPasswd);
30
		mapParams.put("userName", gisUserName);
31
		mapParams.put("passwd", gisPasswd);
33 32
34 33
		Charset charset = Charset.forName("utf-8");
35 34
		String resultJson = HttpServiceUtil.sendPost(UrlAddress.GIS_TOKEN, mapParams, charset);

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

@ -6,7 +6,6 @@ import com.ai.ipu.data.JMap;
6 6
import com.github.pagehelper.PageInfo;
7 7
8 8
import java.util.List;
9
import java.util.Map;
10 9
11 10
public interface DeviceManageService {
12 11
@ -21,7 +20,6 @@ public interface DeviceManageService {
21 20
	boolean bindDevice(JMap params) throws Exception;
22 21
23 22
	boolean unbindDevice(JMap params) throws Exception;
24
    boolean deleteDeviceXyInfo(JMap params) throws Exception;
25 23
26 24
    List<Map<String, Object>> queryAssociatUserInfo(JMap params) throws Exception;
27 25
@ -30,4 +28,6 @@ public interface DeviceManageService {
30 28
    int associatUserSave(JMap params) throws Exception;
31 29
32 30
    int associatBoatSave(JMap params) throws Exception;
31
32
	List<Map<String, Object>> queryAssociatInfo(JMap params) throws Exception;
33 33
}

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

@ -13,9 +13,9 @@ public class EbcConstant {
13 13
	public static final String beidouDevice_name = "康派北斗定位器";
14 14
15 15
	// 终端和人员绑定
16
	public static final String bind_device_type_user = "1";
16
	public static final String bind_device_type_user = "1";  //代表用户
17 17
18 18
	// 终端和船舶绑定
19
	public static final String bind_device_type_ship = "2";
19
	public static final String bind_device_type_ship = "2";  //代表船舶
20 20
21 21
}

+ 1 - 1
ebc-sea-platform/src/main/resources/test/ipu-mybatis-config.xml

@ -16,7 +16,7 @@
16 16
		<environment id="ebc">
17 17
			<transactionManager type="JDBC" />
18 18
			<dataSource type="com.ai.ipu.database.datasource.DruidDataSourceFactory">
19
				<property name="jdbcUrl" value="jdbc:mysql://10.21.20.135:3307/ebc" />
19
				<property name="jdbcUrl" value="jdbc:mysql://10.19.90.34:3307/ebc" />
20 20
				<property name="username" value="ebc" />
21 21
				<property name="password" value="ebc@123" />
22 22
			</dataSource>