Commit eee8b1ae authored by zhuangzhuang's avatar zhuangzhuang

2.22-归整配置文件

parent 64520853
...@@ -336,6 +336,7 @@ public class GatewayController { ...@@ -336,6 +336,7 @@ public class GatewayController {
}) })
@RequestMapping(value="/setState",method = RequestMethod.POST) @RequestMapping(value="/setState",method = RequestMethod.POST)
public String setState(@RequestBody GatewayState device){ public String setState(@RequestBody GatewayState device){
logger.info("t1:" + System.currentTimeMillis());
if (device.getbConfig() == false) { if (device.getbConfig() == false) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("该网关未配置通道"); fb.setMessage("该网关未配置通道");
...@@ -343,6 +344,7 @@ public class GatewayController { ...@@ -343,6 +344,7 @@ public class GatewayController {
} }
//根据设备的SN,TYPE获取所有通道 //根据设备的SN,TYPE获取所有通道
List<ResultProbesVo> list = probesService.getProbesByGateway(device.getSN(),device.getType()); List<ResultProbesVo> list = probesService.getProbesByGateway(device.getSN(),device.getType());
logger.info("t2:" + System.currentTimeMillis());
if (list.size() == 0) { if (list.size() == 0) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("该网关未配置通道"); fb.setMessage("该网关未配置通道");
...@@ -351,6 +353,7 @@ public class GatewayController { ...@@ -351,6 +353,7 @@ public class GatewayController {
DeviceConfigVo deviceConfig = new DeviceConfigVo(); DeviceConfigVo deviceConfig = new DeviceConfigVo();
//获取网关创建时间 //获取网关创建时间
ResultGatewayVo resultGatewayVo = gatewayService.getBySNAndType(device.getSN(),device.getType()); ResultGatewayVo resultGatewayVo = gatewayService.getBySNAndType(device.getSN(),device.getType());
logger.info("t3:" + System.currentTimeMillis());
Integer New = 0; Integer New = 0;
if(resultGatewayVo.getCreateTime()>1535940000000l){ if(resultGatewayVo.getCreateTime()>1535940000000l){
deviceConfig.setType(1); deviceConfig.setType(1);
...@@ -367,6 +370,7 @@ public class GatewayController { ...@@ -367,6 +370,7 @@ public class GatewayController {
infoRedisService.hmSet("DeviceConfig", device.getType() + "_" + device.getSN(), deviceConfig.toString()); infoRedisService.hmSet("DeviceConfig", device.getType() + "_" + device.getSN(), deviceConfig.toString());
//查询该设备所有的主题类型0-发布,1-订阅,2-发布并订阅 //查询该设备所有的主题类型0-发布,1-订阅,2-发布并订阅
List<ResultTopicVo> topicList = topicService.getByGateway(new GatewaySNAndTypeVo(device.getSN(),device.getType())); List<ResultTopicVo> topicList = topicService.getByGateway(new GatewaySNAndTypeVo(device.getSN(),device.getType()));
logger.info("t4:" + System.currentTimeMillis());
//将数据放到redis中 //将数据放到redis中
List<String> pubList = new ArrayList<>(); List<String> pubList = new ArrayList<>();
List<String> subList = new ArrayList<>(); List<String> subList = new ArrayList<>();
...@@ -384,6 +388,7 @@ public class GatewayController { ...@@ -384,6 +388,7 @@ public class GatewayController {
//根据设备的主题名,获取所有的通道 //根据设备的主题名,获取所有的通道
List<ResultTopicConfigVo> devChannelList = topicConfigService.getProbes(topic.getTopicName(),device.getSN(),device.getType()); List<ResultTopicConfigVo> devChannelList = topicConfigService.getProbes(topic.getTopicName(),device.getSN(),device.getType());
List<ChannelConfigVo> channelConfigs = new ArrayList<>(); List<ChannelConfigVo> channelConfigs = new ArrayList<>();
for (ResultTopicConfigVo devChannel : devChannelList) { for (ResultTopicConfigVo devChannel : devChannelList) {
ChannelConfigVo channelConfig = new ChannelConfigVo(devChannel.getPort(),devChannel.getUnti(),devChannel.getDescription(),devChannel.getAlias()); ChannelConfigVo channelConfig = new ChannelConfigVo(devChannel.getPort(),devChannel.getUnti(),devChannel.getDescription(),devChannel.getAlias());
channelConfigs.add(channelConfig); channelConfigs.add(channelConfig);
...@@ -396,22 +401,29 @@ public class GatewayController { ...@@ -396,22 +401,29 @@ public class GatewayController {
infoRedisService.delHashKey("TopicConfig", topic.getTopicName()); infoRedisService.delHashKey("TopicConfig", topic.getTopicName());
} }
} }
logger.info("t5:" + System.currentTimeMillis());
infoRedisService.hmSet("SubTopic", device.getType() + "_" + device.getSN(), subList.toString()); infoRedisService.hmSet("SubTopic", device.getType() + "_" + device.getSN(), subList.toString());
infoRedisService.hmSet("PubTopic", device.getType() + "_" + device.getSN(), pubList.toString()); infoRedisService.hmSet("PubTopic", device.getType() + "_" + device.getSN(), pubList.toString());
if (device.getState() == 0) { if (device.getState() == 0) {
//挂载 //挂载
logger.info("t6:" + System.currentTimeMillis());
String sr = HttpRequester.sendPost(addmount, gson.toJson(new GatewaySNAndTypeVo(device.getSN(), device.getType(),New))); String sr = HttpRequester.sendPost(addmount, gson.toJson(new GatewaySNAndTypeVo(device.getSN(), device.getType(),New)));
logger.info("t7:" + System.currentTimeMillis());
device.setState(1); device.setState(1);
} else if (device.getState() == 1) { } else if (device.getState() == 1) {
//卸载 //卸载
logger.info("t6:" + System.currentTimeMillis());
String sr = HttpRequester.sendPost(delmount, gson.toJson(new GatewaySNAndTypeVo(device.getSN(), device.getType()))); String sr = HttpRequester.sendPost(delmount, gson.toJson(new GatewaySNAndTypeVo(device.getSN(), device.getType())));
logger.info("t7:" + System.currentTimeMillis());
device.setState(0); device.setState(0);
infoRedisService.delHashKey("DeviceConfig", device.getType() + "_" + device.getSN()); infoRedisService.delHashKey("DeviceConfig", device.getType() + "_" + device.getSN());
infoRedisService.delHashKey("SubTopic", device.getType() + "_" + device.getSN()); infoRedisService.delHashKey("SubTopic", device.getType() + "_" + device.getSN());
infoRedisService.delHashKey("PubTopic", device.getType() + "_" + device.getSN()); infoRedisService.delHashKey("PubTopic", device.getType() + "_" + device.getSN());
} }
try{ try{
logger.info("t8:" + System.currentTimeMillis());
Boolean boo = gatewayService.updateState(device); Boolean boo = gatewayService.updateState(device);
logger.info("t9:" + System.currentTimeMillis());
if (!boo) { if (!boo) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改失败"); fb.setMessage("修改失败");
...@@ -420,6 +432,7 @@ public class GatewayController { ...@@ -420,6 +432,7 @@ public class GatewayController {
fb.setMessage("修改成功"); fb.setMessage("修改成功");
} }
} catch (Exception e) { } catch (Exception e) {
logger.info("t10:" + System.currentTimeMillis());
e.printStackTrace(); e.printStackTrace();
logger.info(e.toString()); logger.info(e.toString());
} }
......
...@@ -153,7 +153,7 @@ public class RoleController { ...@@ -153,7 +153,7 @@ public class RoleController {
fb.setMessage(i18n.getMessage(request,"roleName")); fb.setMessage(i18n.getMessage(request,"roleName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (addRoleForPermissionVo.getRoleName().equals("管理员")){ if (addRoleForPermissionVo.getRoleName().equals("Administrator")){
fb.setCode(0); fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"adminInoperable")); fb.setMessage(i18n.getMessage(request,"adminInoperable"));
return gson.toJson(fb); return gson.toJson(fb);
...@@ -219,7 +219,7 @@ public class RoleController { ...@@ -219,7 +219,7 @@ public class RoleController {
fb.setMessage(i18n.getMessage(request,"repeatedRole")); fb.setMessage(i18n.getMessage(request,"repeatedRole"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (updateRoleVo.getRoleName().equals("管理员")){ if (updateRoleVo.getRoleName().equals("Administrator")){
fb.setCode(0); fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"adminInoperable")); fb.setMessage(i18n.getMessage(request,"adminInoperable"));
return gson.toJson(fb); return gson.toJson(fb);
...@@ -259,7 +259,7 @@ public class RoleController { ...@@ -259,7 +259,7 @@ public class RoleController {
fb.setMessage(i18n.getMessage(request,"roleName")); fb.setMessage(i18n.getMessage(request,"roleName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (roleName.equals("管理员")){ if (roleName.equals("Administrator")){
fb.setCode(0); fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"adminInoperable")); fb.setMessage(i18n.getMessage(request,"adminInoperable"));
return gson.toJson(fb); return gson.toJson(fb);
......
#abb\u6B63\u5F0F\u73AF\u5883 ##abb\u6B63\u5F0F\u73AF\u5883
spring.datasource.url=jdbc:mysql://witcloud-mariadb:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false spring.datasource.url=jdbc:mysql://witcloud-mariadb:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=37774020 spring.datasource.password=37774020
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.driver-class-name=com.mysql.jdbc.Driver
server.port=8092 tdl.redis.password=witium
tdl.core.add =http://abb-herocore:8079/witium/addMount
tdl.core.delete =http://abb-herocore:8079/witium/delMount
#\u6B63\u5F0F\u73AF\u5883\uFF08logs\uFF09 #\u6B63\u5F0F\u73AF\u5883\uFF08logs\uFF09
#spring.datasource.url=jdbc:mysql://witcloud-mysql:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false #spring.datasource.url=jdbc:mysql://witcloud-mysql:3306/tdlcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
#spring.datasource.username=root #spring.datasource.username=root
#spring.datasource.password=37774020 #spring.datasource.password=37774020
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver #spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#tdl.core.add =http://logisticscore-java:8079/witium/addMount
#tdl.core.delete =http://logisticscore-java:8079/witium/delMount
tdl.redis.host = witcloud-redis tdl.redis.host = witcloud-redis
tdl.redis.password=witium
server.port=8092
# InfluxDB # InfluxDB
spring.influxdb.url=http://witcloud-influxdb:8086 spring.influxdb.url=http://witcloud-influxdb:8086
...@@ -24,10 +32,5 @@ tdl.mqtt.port = 8883 ...@@ -24,10 +32,5 @@ tdl.mqtt.port = 8883
tdl.mqtt.username = logistics tdl.mqtt.username = logistics
tdl.mqtt.password = logistics37774020 tdl.mqtt.password = logistics37774020
#tdl.core.add =http://logisticscore-java:8079/witium/addMount
#tdl.core.delete =http://logisticscore-java:8079/witium/delMount
tdl.core.add =http://abb-herocore:8079/witium/addMount
tdl.core.delete =http://abb-herocore:8079/witium/delMount
mqtt.userName = wtlogistics mqtt.userName = wtlogistics
mqtt.password = wtlogistics mqtt.password = wtlogistics
\ No newline at end of file
#spring.datasource.url=jdbc:mysql://47.97.184.225:3306/tdlcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.url=jdbc:mysql://47.110.153.44:3306/tdlcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false spring.datasource.url=jdbc:mysql://47.110.153.44:3306/tdlcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
#spring.datasource.url=jdbc:mysql://192.168.1.24:3306/tdlcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=37774020 spring.datasource.password=37774020
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.driver-class-name=com.mysql.jdbc.Driver
...@@ -24,10 +24,10 @@ spring.messages.cache-seconds= 3600 ...@@ -24,10 +24,10 @@ spring.messages.cache-seconds= 3600
spring.messages.encoding=UTF-8 spring.messages.encoding=UTF-8
tdl.redis.host=47.110.153.44 tdl.redis.host=127.0.0.1
tdl.redis.index=0 tdl.redis.index=0
tdl.redis.port=6379 tdl.redis.port=6379
tdl.redis.password=witium tdl.redis.password=
tdl.redis.poolmaxactive=8 tdl.redis.poolmaxactive=8
tdl.redis.poolmaxwait=-1 tdl.redis.poolmaxwait=-1
tdl.redis.poolmaxidle=8 tdl.redis.poolmaxidle=8
...@@ -40,7 +40,7 @@ logging.config=classpath:logback.xml ...@@ -40,7 +40,7 @@ logging.config=classpath:logback.xml
# Mqtt # Mqtt
tdl.mqtt.url = ssl://192.168.1.11 tdl.mqtt.url = ssl://172.16.1.11
tdl.mqtt.port = 8883 tdl.mqtt.port = 8883
tdl.mqtt.username = ugen tdl.mqtt.username = ugen
tdl.mqtt.password = ugen tdl.mqtt.password = ugen
...@@ -65,8 +65,8 @@ spring.influxdb.write-timeout=10 ...@@ -65,8 +65,8 @@ spring.influxdb.write-timeout=10
spring.influxdb.gzip=true spring.influxdb.gzip=true
tdl.core.add =http://192.168.1.16:8079/witium/addMount tdl.core.add =http://172.16.1.16:8079/witium/addMount
tdl.core.delete =http://192.168.1.16:8079/witium/delMount tdl.core.delete =http://172.16.1.16:8079/witium/delMount
mqtt.userName = ugen mqtt.userName = ugen
mqtt.password = ugen mqtt.password = ugen
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment