|
|
@ -64,42 +64,48 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
@Log(title = "【设备状态导出】", businessType = BusinessType.EXPORT) |
|
|
|
@PostMapping("/export") |
|
|
|
public void export(HttpServletResponse response, OnlineQueryParams params) { |
|
|
|
if(ObjectUtils.isEmpty(params.getType())) { |
|
|
|
if (ObjectUtils.isEmpty(params.getType())) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if(StringUtil.isEmpty(params.getOrderByField()) ||"time".equals(params.getOrderByField())) { |
|
|
|
if (StringUtil.isEmpty(params.getOrderByField()) || "time".equals(params.getOrderByField())) { |
|
|
|
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)); |
|
|
|
LinkedHashMap<String,Object> map = new LinkedHashMap<>(); |
|
|
|
for(String deviceType:params.getType()){ |
|
|
|
List<OnlineSum> list = sumsMap.getOrDefault(deviceType,new ArrayList<>()); |
|
|
|
Map<String, List<OnlineSum>> sumsMap = sums.stream().collect(Collectors.groupingBy(OnlineSum::getDeviceType)); |
|
|
|
LinkedHashMap<String, Object> map = new LinkedHashMap<>(); |
|
|
|
for (String deviceType : params.getType()) { |
|
|
|
List<OnlineSum> list = sumsMap.getOrDefault(deviceType, new ArrayList<>()); |
|
|
|
String typeName = DeviceType.getDescriptionByValue(deviceType); |
|
|
|
if(StringUtil.isNotEmpty(typeName)) { |
|
|
|
map.put(DeviceType.getDescriptionByValue(deviceType),list); |
|
|
|
if (StringUtil.isNotEmpty(typeName)) { |
|
|
|
map.put(DeviceType.getDescriptionByValue(deviceType), list); |
|
|
|
} |
|
|
|
} |
|
|
|
ExcelMultipleSheetsUtil multipleSheetsUtil = new ExcelMultipleSheetsUtil(); |
|
|
|
multipleSheetsUtil.excelMultipleSheets(map,UniversalEnum.DEVICE_STATUS_LIST.getValue()+ DateUtil.format(new Date(), "yyyyMMddHHmmss"), |
|
|
|
"xlsx", response); |
|
|
|
multipleSheetsUtil.excelMultipleSheets(map, UniversalEnum.DEVICE_STATUS_LIST.getValue() + DateUtil.format(new Date(), "yyyyMMddHHmmss"), |
|
|
|
"xlsx", response); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("设备状态列表按时间和类型") |
|
|
|
@GetMapping("/tablist") |
|
|
|
public TableDataInfo getTabList(OnlineQueryParams params) { |
|
|
|
|
|
|
|
if(ObjectUtils.isEmpty(params.getType())) { |
|
|
|
if (ObjectUtils.isEmpty(params.getType())) { |
|
|
|
return getDataTable(new ArrayList<>()); |
|
|
|
} |
|
|
|
if(StringUtil.isEmpty(params.getOrderByField()) ||"time".equals(params.getOrderByField())) { |
|
|
|
if (StringUtil.isEmpty(params.getOrderByField()) || "time".equals(params.getOrderByField())) { |
|
|
|
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,26 +121,27 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
}*/ |
|
|
|
return getDataTable(sums); |
|
|
|
} |
|
|
|
|
|
|
|
//按时间划分设备柱状图
|
|
|
|
@ApiOperation("设备状态柱状图按时间和类型") |
|
|
|
@GetMapping("/list") |
|
|
|
public AjaxResult getStatusList( |
|
|
|
@RequestParam("startTime") String startTime, |
|
|
|
@RequestParam("time") String endTime, |
|
|
|
@RequestParam("time") String endTime, |
|
|
|
@RequestParam("type") String[] types, |
|
|
|
@RequestParam(value = "direction",required = false) String direction) { |
|
|
|
@RequestParam(value = "direction", required = false) String direction) { |
|
|
|
Map<String, Map<String, String>> maps = new HashMap<>(); |
|
|
|
LocalDateTime start = LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
|
|
|
LocalDateTime end = LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
|
|
|
List<OnlineSum> onlineSums = onlineSumService.queryByDeviceTypeAndDate(types, start.toLocalDate(), end.toLocalDate(),direction); |
|
|
|
Map<String,List<OnlineSum>> stringListMap = onlineSums.stream().collect(Collectors.groupingBy(OnlineSum::getDeviceType)); |
|
|
|
List<OnlineSum> onlineSums = onlineSumService.queryByDeviceTypeAndDate(types, start.toLocalDate(), end.toLocalDate(), direction); |
|
|
|
Map<String, List<OnlineSum>> stringListMap = onlineSums.stream().collect(Collectors.groupingBy(OnlineSum::getDeviceType)); |
|
|
|
for (String type : types) { |
|
|
|
Map<String, String> map = new HashMap<>(); |
|
|
|
List<OnlineSum> listOfType = stringListMap.getOrDefault(type, new ArrayList<>()); |
|
|
|
Map<LocalDate,List<OnlineSum>> localDateListMap = listOfType.stream().collect(Collectors.groupingBy(OnlineSum::getStatisticalDate)); |
|
|
|
for (LocalDate date = start.toLocalDate(); date.isBefore(end.toLocalDate().plusDays(1)); date=date.plusDays(1)) { |
|
|
|
Map<LocalDate, List<OnlineSum>> localDateListMap = listOfType.stream().collect(Collectors.groupingBy(OnlineSum::getStatisticalDate)); |
|
|
|
for (LocalDate date = start.toLocalDate(); date.isBefore(end.toLocalDate().plusDays(1)); date = date.plusDays(1)) { |
|
|
|
List<OnlineSum> dayList = localDateListMap.getOrDefault(date, new ArrayList<>()); |
|
|
|
map.put(date.toString(), MathUtil.doubleTwoDecimalStr(dayList.stream().mapToDouble(OnlineSum::getOnlineRate).average().orElse(0.0))+"%"); |
|
|
|
map.put(date.toString(), MathUtil.doubleTwoDecimalStr(dayList.stream().mapToDouble(OnlineSum::getOnlineRate).average().orElse(0.0)) + "%"); |
|
|
|
} |
|
|
|
maps.put(type, new TreeMap<>(map)); |
|
|
|
} |
|
|
@ -143,6 +150,7 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询设备在线率 |
|
|
|
* |
|
|
|
* @param deviceId |
|
|
|
* @return |
|
|
|
*/ |
|
|
@ -152,7 +160,7 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
LocalDate startDate = LocalDate.now().minusDays(30); |
|
|
|
LocalDate endDate = LocalDate.now(); |
|
|
|
List<OnlineSum> onlineSums = onlineSumService.queryByDateRangeOfDevice(deviceId, startDate, endDate); |
|
|
|
if(onlineSums.isEmpty()) { |
|
|
|
if (onlineSums.isEmpty()) { |
|
|
|
return AjaxResult.success(UniversalEnum.NO_DATA_AVAILABLE.getValue()); |
|
|
|
} |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
@ -164,6 +172,7 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 缓存类型卡片排序规则 |
|
|
|
* |
|
|
|
* @param rule 排序规则 |
|
|
|
* @return AjaxResult |
|
|
|
*/ |
|
|
@ -175,7 +184,7 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 设备分类当日在线率 |
|
|
|
* 设备分类当日在线率 |
|
|
|
*/ |
|
|
|
@ApiOperation("设备分类当日在线率") |
|
|
|
@GetMapping("/type") |
|
|
@ -191,31 +200,31 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
Map<String, Object> returnMap = new HashMap<>(); |
|
|
|
List<OnlineSum> onlineSums = onlineSumService.queryByDateOfDeviceType(LocalDate.now()); |
|
|
|
List<DcDevice> dcDeviceList = dcDeviceService.list(); |
|
|
|
List<DcDevice> useDeviceList = dcDeviceList.stream().filter(device ->device.getUseState()!=null && device.getUseState()==1).collect(Collectors.toList()); |
|
|
|
List<DcDevice> useDeviceList = dcDeviceList.stream().filter(device -> device.getUseState() != null && device.getUseState() == 1).collect(Collectors.toList()); |
|
|
|
//分类总数
|
|
|
|
Map<String, Long> totalCounts = dcDeviceList.stream() |
|
|
|
.collect(Collectors.groupingBy(DcDevice::getRealType, Collectors.counting())); |
|
|
|
//分类在用数
|
|
|
|
Map<String,Long> useCounts = useDeviceList.stream() |
|
|
|
Map<String, Long> useCounts = useDeviceList.stream() |
|
|
|
.collect(Collectors.groupingBy(DcDevice::getRealType, Collectors.counting())); |
|
|
|
Map<String,List<OnlineSum>> typeSumGroup = onlineSums.stream().collect(Collectors.groupingBy(OnlineSum::getDeviceType)); |
|
|
|
Map<String, List<OnlineSum>> typeSumGroup = onlineSums.stream().collect(Collectors.groupingBy(OnlineSum::getDeviceType)); |
|
|
|
DeviceType.toMap().forEach((k, v) -> { |
|
|
|
Map<String,Object> itemMap = new HashMap<>(); |
|
|
|
itemMap.put(SUM,totalCounts.getOrDefault(k,0L).toString());//总数
|
|
|
|
itemMap.put(SUM_USE_STATE,useCounts.getOrDefault(k,0L).toString());//在用数
|
|
|
|
List<OnlineSum> onlineSumsOfType = typeSumGroup.getOrDefault(k,new ArrayList<>()); |
|
|
|
itemMap.put(LOST_RATE, MathUtil.doubleTwoDecimalStr(onlineSumsOfType.stream().mapToDouble(OnlineSum::getLossRate).average().orElse(0.0))+"%"); |
|
|
|
itemMap.put(SUCESS_RATE,MathUtil.doubleTwoDecimalStr(onlineSumsOfType.stream().mapToDouble(OnlineSum::getOnlineRate).average().orElse(0.0))+"%"); |
|
|
|
itemMap.put(FAIL_RATE,MathUtil.doubleTwoDecimalStr(onlineSumsOfType.stream().mapToDouble(OnlineSum::getOfflineRate).average().orElse(0.0))+"%"); |
|
|
|
returnMap.put(v,itemMap); |
|
|
|
Map<String, Object> itemMap = new HashMap<>(); |
|
|
|
itemMap.put(SUM, totalCounts.getOrDefault(k, 0L).toString());//总数
|
|
|
|
itemMap.put(SUM_USE_STATE, useCounts.getOrDefault(k, 0L).toString());//在用数
|
|
|
|
List<OnlineSum> onlineSumsOfType = typeSumGroup.getOrDefault(k, new ArrayList<>()); |
|
|
|
itemMap.put(LOST_RATE, MathUtil.doubleTwoDecimalStr(onlineSumsOfType.stream().mapToDouble(OnlineSum::getLossRate).average().orElse(0.0)) + "%"); |
|
|
|
itemMap.put(SUCESS_RATE, MathUtil.doubleTwoDecimalStr(onlineSumsOfType.stream().mapToDouble(OnlineSum::getOnlineRate).average().orElse(0.0)) + "%"); |
|
|
|
itemMap.put(FAIL_RATE, MathUtil.doubleTwoDecimalStr(onlineSumsOfType.stream().mapToDouble(OnlineSum::getOfflineRate).average().orElse(0.0)) + "%"); |
|
|
|
returnMap.put(v, itemMap); |
|
|
|
}); |
|
|
|
Map<String, Object> allMap = new HashMap<>(); |
|
|
|
allMap.put(SUM,dcDeviceList.size()+"");//总数
|
|
|
|
allMap.put(SUM_USE_STATE,useDeviceList.size()+"");//在用数
|
|
|
|
allMap.put(LOST_RATE,MathUtil.doubleTwoDecimalStr(onlineSums.stream().mapToDouble(OnlineSum::getLossRate).average().orElse(0.0))+"%"); |
|
|
|
allMap.put(SUCESS_RATE,MathUtil.doubleTwoDecimalStr(onlineSums.stream().mapToDouble(OnlineSum::getOnlineRate).average().orElse(0.0))+"%"); |
|
|
|
allMap.put(FAIL_RATE,MathUtil.doubleTwoDecimalStr(onlineSums.stream().mapToDouble(OnlineSum::getOfflineRate).average().orElse(0.0))+"%"); |
|
|
|
returnMap.put(All_TYPE,allMap); |
|
|
|
allMap.put(SUM, dcDeviceList.size() + "");//总数
|
|
|
|
allMap.put(SUM_USE_STATE, useDeviceList.size() + "");//在用数
|
|
|
|
allMap.put(LOST_RATE, MathUtil.doubleTwoDecimalStr(onlineSums.stream().mapToDouble(OnlineSum::getLossRate).average().orElse(0.0)) + "%"); |
|
|
|
allMap.put(SUCESS_RATE, MathUtil.doubleTwoDecimalStr(onlineSums.stream().mapToDouble(OnlineSum::getOnlineRate).average().orElse(0.0)) + "%"); |
|
|
|
allMap.put(FAIL_RATE, MathUtil.doubleTwoDecimalStr(onlineSums.stream().mapToDouble(OnlineSum::getOfflineRate).average().orElse(0.0)) + "%"); |
|
|
|
returnMap.put(All_TYPE, allMap); |
|
|
|
Map<String, Object> sortMap = new TreeMap<>(); |
|
|
|
String orderRule = redisCache.getCacheObject(ORDERRULE); |
|
|
|
if (StringUtil.isNotEmpty(orderRule)) { |
|
|
@ -230,7 +239,7 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
//按路段统计设备在线率
|
|
|
|
@ApiOperation("设备状态列表按路段") |
|
|
|
@GetMapping("/section") |
|
|
|
public AjaxResult getSectionList() { |
|
|
|
public AjaxResult getSectionList() { |
|
|
|
String LOST_RATE = "lostRate";//丢包率
|
|
|
|
String SUCESS_RATE = "sucessRate";//在线率
|
|
|
|
String FAIL_RATE = "failRate";//离线率
|
|
|
@ -240,20 +249,20 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
List<Map<String, Object>> deviceOfRoad = dcDeviceService.selectDeviceOfRoad(); |
|
|
|
List<DcRoadSection> dcRoadSections = dcRoadSectionService.selectDcRoadSectionList(new DcRoadSection()); |
|
|
|
List<OnlineSum> onlineSums = onlineSumService.queryByDateOfRoad(LocalDate.now()); |
|
|
|
Map<String,Long> totalRoadCounts = deviceOfRoad.stream() |
|
|
|
.collect(Collectors.groupingBy(m -> m.get("roadId").toString(),Collectors.counting())); |
|
|
|
Map<String,Long> useRoadCounts = deviceOfRoad.stream().filter(dr -> dr.get("useStata")!=null && dr.get("useStata").toString().equals("1")) |
|
|
|
.collect(Collectors.groupingBy(m -> m.get("roadId").toString(),Collectors.counting())); |
|
|
|
Map<Long,List<OnlineSum>> onLineSumMap = onlineSums.stream().filter(onlineSum -> onlineSum.getRoadId() != null).collect(Collectors.groupingBy(OnlineSum::getRoadId)); |
|
|
|
for(DcRoadSection dcRoadSection : dcRoadSections) { |
|
|
|
Map<String,Object> itemMap = new HashMap<>(); |
|
|
|
itemMap.put(SUM,totalRoadCounts.getOrDefault(dcRoadSection.getId().toString(),0L).toString());//总数
|
|
|
|
itemMap.put(SUM_USE_STATE,useRoadCounts.getOrDefault(dcRoadSection.getId().toString(),0L).toString());//在用数
|
|
|
|
List<OnlineSum> onlineSumsByRoad = onLineSumMap.getOrDefault(dcRoadSection.getId(),new ArrayList<>()); |
|
|
|
itemMap.put(LOST_RATE, MathUtil.doubleTwoDecimalStr(onlineSumsByRoad.stream().mapToDouble(OnlineSum::getLossRate).average().orElse(0.0))+"%"); |
|
|
|
itemMap.put(SUCESS_RATE,MathUtil.doubleTwoDecimalStr(onlineSumsByRoad.stream().mapToDouble(OnlineSum::getOnlineRate).average().orElse(0.0))+"%"); |
|
|
|
itemMap.put(FAIL_RATE,MathUtil.doubleTwoDecimalStr(onlineSumsByRoad.stream().mapToDouble(OnlineSum::getOfflineRate).average().orElse(0.0))+"%"); |
|
|
|
returnMap.put(dcRoadSection.getSectionName(),itemMap); |
|
|
|
Map<String, Long> totalRoadCounts = deviceOfRoad.stream() |
|
|
|
.collect(Collectors.groupingBy(m -> m.get("roadId").toString(), Collectors.counting())); |
|
|
|
Map<String, Long> useRoadCounts = deviceOfRoad.stream().filter(dr -> dr.get("useStata") != null && dr.get("useStata").toString().equals("1")) |
|
|
|
.collect(Collectors.groupingBy(m -> m.get("roadId").toString(), Collectors.counting())); |
|
|
|
Map<Long, List<OnlineSum>> onLineSumMap = onlineSums.stream().filter(onlineSum -> onlineSum.getRoadId() != null).collect(Collectors.groupingBy(OnlineSum::getRoadId)); |
|
|
|
for (DcRoadSection dcRoadSection : dcRoadSections) { |
|
|
|
Map<String, Object> itemMap = new HashMap<>(); |
|
|
|
itemMap.put(SUM, totalRoadCounts.getOrDefault(dcRoadSection.getId().toString(), 0L).toString());//总数
|
|
|
|
itemMap.put(SUM_USE_STATE, useRoadCounts.getOrDefault(dcRoadSection.getId().toString(), 0L).toString());//在用数
|
|
|
|
List<OnlineSum> onlineSumsByRoad = onLineSumMap.getOrDefault(dcRoadSection.getId(), new ArrayList<>()); |
|
|
|
itemMap.put(LOST_RATE, MathUtil.doubleTwoDecimalStr(onlineSumsByRoad.stream().mapToDouble(OnlineSum::getLossRate).average().orElse(0.0)) + "%"); |
|
|
|
itemMap.put(SUCESS_RATE, MathUtil.doubleTwoDecimalStr(onlineSumsByRoad.stream().mapToDouble(OnlineSum::getOnlineRate).average().orElse(0.0)) + "%"); |
|
|
|
itemMap.put(FAIL_RATE, MathUtil.doubleTwoDecimalStr(onlineSumsByRoad.stream().mapToDouble(OnlineSum::getOfflineRate).average().orElse(0.0)) + "%"); |
|
|
|
returnMap.put(dcRoadSection.getSectionName(), itemMap); |
|
|
|
} |
|
|
|
return AjaxResult.success(returnMap); |
|
|
|
} |
|
|
@ -262,25 +271,26 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
@GetMapping("/networkLogTable") |
|
|
|
public TableDataInfo networkLogTable( |
|
|
|
@RequestParam("deviceId") Long deviceId, |
|
|
|
@RequestParam("queryDate")String queryDate) { |
|
|
|
@RequestParam("queryDate") String queryDate) { |
|
|
|
LocalDateTime start = LocalDateTime.parse(queryDate + " 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
|
|
|
LocalDateTime end = LocalDateTime.parse(queryDate + " 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
|
|
|
//startPage();
|
|
|
|
List<OnlineLog> onlineLogs = onlineLogService.queryByDateAndDevice(start,end,deviceId); |
|
|
|
List<OnlineLog> onlineLogs = onlineLogService.queryByDateAndDevice(start, end, deviceId); |
|
|
|
return getDataTable(onlineLogs); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("查询设备网络日志") |
|
|
|
@GetMapping("/networkLogEcharts") |
|
|
|
public AjaxResult networkLogEcharts( |
|
|
|
@RequestParam("deviceId") Long deviceId, |
|
|
|
@RequestParam("queryDate")String queryDate) { |
|
|
|
@RequestParam("queryDate") String queryDate) { |
|
|
|
String LOST_RATE = "lostRate";//丢包率
|
|
|
|
String RTT_AVG = "rttAvg";//平均往返时延
|
|
|
|
String MONITOR_TIME = "time";//监控时间
|
|
|
|
LocalDateTime start = LocalDateTime.parse(queryDate + " 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
|
|
|
LocalDateTime end = LocalDateTime.parse(queryDate + " 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
|
|
|
List<OnlineLog> onlineLogs = onlineLogService.queryByDateAndDevice(start,end,deviceId); |
|
|
|
Map<String,Object> returnMap = new HashMap<>(); |
|
|
|
List<OnlineLog> onlineLogs = onlineLogService.queryByDateAndDevice(start, end, deviceId); |
|
|
|
Map<String, Object> returnMap = new HashMap<>(); |
|
|
|
List<String> xAxis = new ArrayList<>(); |
|
|
|
List<Double> lossRate = new ArrayList<>(); |
|
|
|
List<Double> rttAvg = new ArrayList<>(); |
|
|
@ -289,13 +299,14 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
lossRate.add(onlineLog.getLossRate()); |
|
|
|
rttAvg.add(onlineLog.getRttAvg()); |
|
|
|
}); |
|
|
|
returnMap.put(LOST_RATE,lossRate); |
|
|
|
returnMap.put(RTT_AVG,rttAvg); |
|
|
|
returnMap.put(MONITOR_TIME,xAxis); |
|
|
|
returnMap.put(LOST_RATE, lossRate); |
|
|
|
returnMap.put(RTT_AVG, rttAvg); |
|
|
|
returnMap.put(MONITOR_TIME, xAxis); |
|
|
|
return AjaxResult.success(new TreeMap<>(returnMap)); |
|
|
|
} |
|
|
|
|
|
|
|
enum DeviceType { |
|
|
|
GUN_CAMERA("1-1","高清网络枪型固定摄像机"), |
|
|
|
GUN_CAMERA("1-1", "高清网络枪型固定摄像机"), |
|
|
|
SPHERICAL_CAMERA("1-2", "高清网络球形摄像机"), |
|
|
|
SPHERICAL_CAMERA_BRIDGE("1-3", "桥下高清网络球形摄像机"), |
|
|
|
PANORAMIC_CAMERA_360("1-4", "360°全景摄像机"), |
|
|
@ -336,9 +347,10 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
|
|
|
|
/** |
|
|
|
* map转换{value,description} |
|
|
|
* |
|
|
|
* @return 转换后的map |
|
|
|
*/ |
|
|
|
static Map<String,String> toMap(){ |
|
|
|
static Map<String, String> toMap() { |
|
|
|
Map<String, String> map = new HashMap<>(); |
|
|
|
for (DeviceType deviceType : DeviceType.values()) { |
|
|
|
map.put(deviceType.getValue(), deviceType.getDescription()); |
|
|
@ -348,9 +360,10 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 默认排序规则 |
|
|
|
* |
|
|
|
* @return 排序规则 |
|
|
|
*/ |
|
|
|
static String defaultSortRule(){ |
|
|
|
static String defaultSortRule() { |
|
|
|
StringBuilder stringBuilder = new StringBuilder(); |
|
|
|
String ALL_TYPE = "全部设备"; |
|
|
|
stringBuilder.append(ALL_TYPE); |
|
|
@ -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)) { |
|
|
|