Commit 32d7a444 authored by 赵啸非's avatar 赵啸非

添加批量激活设备

parent 26f53d78
......@@ -75,3 +75,13 @@ INSERT INTO `mortals_xhx_param` VALUES (null, '设备资源部署细致', NULL,
INSERT INTO `mortals_xhx_param` VALUES (null, '应用发布编码', 'appPublish', NULL ,'information-publish','信息发布屏', 1, 4, 0, 'appPublish', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '告警类型', 'AlarmConfig', 'alarmType', '0', '离线', 1, 4, 0, 'alarmType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '告警级别,', 'AlarmConfig', 'alarmLevel', '0', '危险', 1, 4, 0, 'alarmLevel', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '告警级别,', 'AlarmConfig', 'alarmLevel', '1', '次要', 1, 4, 0, 'alarmLevel', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '告警级别,', 'AlarmConfig', 'alarmLevel', '2', '一般', 1, 4, 0, 'alarmLevel', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '推送方式,', 'AlarmConfig', 'alarmPusW1ay', '0', '不推送', 1, 4, 0, 'alarmPusW1ay', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '推送方式,', 'AlarmConfig', 'alarmPusW1ay', '1', '短信', 1, 4, 0, 'alarmPusW1ay', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '是否启用', 'AlarmConfig', 'enabled', '0', '不启用', 1, 4, 0, 'enabled', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '是否启用', 'AlarmConfig', 'enabled', '1', '启用', 1, 4, 0, 'enabled', NULL, NULL, NULL);
\ No newline at end of file
package com.mortals.xhx.module.device.web;
import cn.hutool.core.lang.Validator;
import cn.hutool.core.net.URLDecoder;
import cn.hutool.core.net.url.UrlBuilder;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.ImageReEnum;
......@@ -21,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.nio.charset.Charset;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -85,15 +89,27 @@ public class DeviceModuleDistributeController extends BaseCRUDJsonBodyMappingCon
@Override
protected int viewAfter(Long id, Map<String, Object> model, DeviceModuleDistributeEntity entity, Context context) throws AppException {
String serverName = request.getHeader("server-name");
Integer serverPort = DataUtil.converStr2Int(request.getHeader("server-port"),0);
String homeUrl="";
ProductEntity productEntity = productService.get(entity.getProductId(), context);
if(!ObjectUtils.isEmpty(productEntity.getHomeUrl())){
homeUrl= productEntity.getHomeUrl();
}
String domain = GlobalSysInfo.getParamValue(PARAM_SERVER_HTTP_URL, "http://192.168.0.98:11078");
if(!ObjectUtils.isEmpty(serverName)&& Validator.isIpv4(serverName)){
String str = UrlBuilder.ofHttp(serverName).setPort(serverPort>0?serverPort:11078).addPath(homeUrl).build();
String decodeStr = URLDecoder.decode(str, Charset.defaultCharset());
entity.setFilePath(decodeStr);
}else{
String str = UrlBuilder.of(domain.trim()).addPath(homeUrl).build();
String decodeStr = URLDecoder.decode(str, Charset.defaultCharset());
entity.setFilePath(decodeStr);
}
//String temp=domain+"/"+homeUrl;
entity.setFilePath(UrlBuilder.of(domain).addPath(homeUrl).build());
//entity.setFilePath(UrlBuilder.of(domain).addPath(homeUrl).build());
// entity.setFilePath(temp);
return super.viewAfter(id, model, entity, context);
}
......
......@@ -40,6 +40,7 @@
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log.%d{yyyyMMdd}</fileNamePattern>
<!--日志文件保留天数-->
<cleanHistoryOnStart>true</cleanHistoryOnStart>
<MaxHistory>15</MaxHistory>
</rollingPolicy>
</appender>
......
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