Browse Source

优化设备在线率tab页导出以及查询

develop
zhaoxianglong 8 months ago
parent
commit
b9bae54071
  1. 18
      zc-business/src/main/java/com/zc/business/controller/DcDeviceOnlineController.java

18
zc-business/src/main/java/com/zc/business/controller/DcDeviceOnlineController.java

@ -71,7 +71,10 @@ public class DcDeviceOnlineController extends BaseController {
params.setOrderByField("online_rate");
}
params.setStakeMark(params.getStakeMark().replace(" ","+"));
String stakeMark = params.getStakeMark();
if (stakeMark!=null) {
params.setStakeMark(stakeMark.replace(UniversalEnum.BLANK_SPACE.getValue(), UniversalEnum.PLUS_SIGN.getValue()));
}
List<OnlineSum> sums = onlineSumService.queryByDeviceTypesOfToday(params);
Map<String, List<OnlineSum>> sumsMap = sums.stream().collect(Collectors.groupingBy(OnlineSum::getDeviceType));
@ -99,7 +102,10 @@ public class DcDeviceOnlineController extends BaseController {
params.setOrderByField("online_rate");
}
startPage();
params.setStakeMark(params.getStakeMark().replace(" ","+"));
String stakeMark = params.getStakeMark();
if (stakeMark != null) {
params.setStakeMark(stakeMark.replace(UniversalEnum.BLANK_SPACE.getValue(), UniversalEnum.PLUS_SIGN.getValue()));
}
List<OnlineSum> sums = onlineSumService.queryByDeviceTypesOfToday(params);
/*Map<String,OnlineSum> onlineSumMap = redisCache.getCacheMap(RedisKeyConstants.DEVICE_ONLINE);
String date = LocalDate.now().toString();*/
@ -115,6 +121,7 @@ public class DcDeviceOnlineController extends BaseController {
}*/
return getDataTable(sums);
}
//按时间划分设备柱状图
@ApiOperation("设备状态柱状图按时间和类型")
@GetMapping("/list")
@ -143,6 +150,7 @@ public class DcDeviceOnlineController extends BaseController {
/**
* 查询设备在线率
*
* @param deviceId
* @return
*/
@ -164,6 +172,7 @@ public class DcDeviceOnlineController extends BaseController {
/**
* 缓存类型卡片排序规则
*
* @param rule 排序规则
* @return AjaxResult
*/
@ -269,6 +278,7 @@ public class DcDeviceOnlineController extends BaseController {
List<OnlineLog> onlineLogs = onlineLogService.queryByDateAndDevice(start, end, deviceId);
return getDataTable(onlineLogs);
}
@ApiOperation("查询设备网络日志")
@GetMapping("/networkLogEcharts")
public AjaxResult networkLogEcharts(
@ -294,6 +304,7 @@ public class DcDeviceOnlineController extends BaseController {
returnMap.put(MONITOR_TIME, xAxis);
return AjaxResult.success(new TreeMap<>(returnMap));
}
enum DeviceType {
GUN_CAMERA("1-1", "高清网络枪型固定摄像机"),
SPHERICAL_CAMERA("1-2", "高清网络球形摄像机"),
@ -336,6 +347,7 @@ public class DcDeviceOnlineController extends BaseController {
/**
* map转换{value,description}
*
* @return 转换后的map
*/
static Map<String, String> toMap() {
@ -348,6 +360,7 @@ public class DcDeviceOnlineController extends BaseController {
/**
* 默认排序规则
*
* @return 排序规则
*/
static String defaultSortRule() {
@ -359,6 +372,7 @@ public class DcDeviceOnlineController extends BaseController {
}
return stringBuilder.toString();
}
static String getDescriptionByValue(String value) {
for (DeviceType type : DeviceType.values()) {
if (type.value.equals(value)) {

Loading…
Cancel
Save