Commit e9d625d6 authored by chenying's avatar chenying

4.23修改网关时,可以同时修改网关使用的模板

parent 62b27d3a
...@@ -9,6 +9,16 @@ public class UpdateGatewayVo { ...@@ -9,6 +9,16 @@ public class UpdateGatewayVo {
private Long updateTime; private Long updateTime;
private String modelName;
public String getModelName() {
return modelName;
}
public void setModelName(String modelName) {
this.modelName = modelName;
}
public String getSN() { public String getSN() {
return SN; return SN;
} }
......
...@@ -135,7 +135,8 @@ public class GatewayController { ...@@ -135,7 +135,8 @@ public class GatewayController {
@ApiOperation(value = "修改网关信息",notes = "修改网关信息,updateTime不用传,要传的参数:" + @ApiOperation(value = "修改网关信息",notes = "修改网关信息,updateTime不用传,要传的参数:" +
" name:网关名字," + " name:网关名字," +
" SN:需要修改的网关序列号," + " SN:需要修改的网关序列号," +
" type:需要修改的网关类型") " type:需要修改的网关类型," +
" modelName:需要就传,不需要就不传。")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
...@@ -167,15 +168,33 @@ public class GatewayController { ...@@ -167,15 +168,33 @@ public class GatewayController {
// fb.setMessage("修改的设备已存在"); // fb.setMessage("修改的设备已存在");
// return gson.toJson(fb); // return gson.toJson(fb);
// } // }
updateGatewayVo.setUpdateTime(System.currentTimeMillis()); if (StringUtils.isEmpty(updateGatewayVo.getModelName())){
int a=gatewayService.updateGateway(updateGatewayVo); updateGatewayVo.setUpdateTime(System.currentTimeMillis());
if (a>0){ int a=gatewayService.updateGateway(updateGatewayVo);
fb.setCode(1); if (a>0){
fb.setMessage("修改网关成功"); fb.setCode(1);
}else{ fb.setMessage("修改网关成功");
fb.setCode(0); }else{
fb.setMessage("修改网关失败"); fb.setCode(0);
fb.setMessage("修改网关失败");
}
}else {
Map<Object,Object> map=new HashMap<>();
map.put("SN",updateGatewayVo.getSN());
map.put("type",updateGatewayVo.getType());
map.put("modelName",updateGatewayVo.getModelName());
gatewayService.deployGateway(map);
Map<Object,Object> msg=new HashMap<>();
msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("通过模板修改设备成功")){
fb.setCode(1);
fb.setMessage("通过模板修改设备成功");
}else{
fb.setCode(0);
fb.setMessage(msg.get("msg").toString());
}
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
......
spring.datasource.url=jdbc:mysql://192.168.1.16:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=37774020 spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.driver-class-name=com.mysql.jdbc.Driver
threadpool.corepoolsize = 30 threadpool.corepoolsize = 30
...@@ -15,7 +15,7 @@ mybatis.config-location=classpath:mybatis-config.xml ...@@ -15,7 +15,7 @@ mybatis.config-location=classpath:mybatis-config.xml
# Redis服务器地址 # Redis服务器地址
tdl.redis.host=192.168.1.16 tdl.redis.host=127.0.0.1
# Redis数据库索引(默认为0) # Redis数据库索引(默认为0)
tdl.redis.index=0 tdl.redis.index=0
# Redis服务器连接端口 # Redis服务器连接端口
......
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