|
|
@@ -40,10 +40,7 @@ import org.springframework.stereotype.Service;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.net.URLEncoder;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -73,9 +70,9 @@ public class IotCommonSensorServiceImpl extends ServiceImpl<IotCommonSensorMappe
|
|
|
@Override
|
|
|
public TableDataInfo<SensorPageVo> selectSensorDataPage(SensorPageDto request) {
|
|
|
dealPageParam(request);
|
|
|
- if (ObjectUtil.isEmpty(request.getDeviceTypeList())){
|
|
|
+ if (ObjectUtil.isEmpty(request.getDeviceTypeList())) {
|
|
|
List<String> list = Lists.newArrayList(
|
|
|
- BaseDeviceTypeEnum.FSU.getCode(),
|
|
|
+ // BaseDeviceTypeEnum.FSU.getCode(),
|
|
|
BaseDeviceTypeEnum.FSU_Smoke.getCode(),
|
|
|
BaseDeviceTypeEnum.FSU_Infrared.getCode(),
|
|
|
BaseDeviceTypeEnum.FSU_TemperatureAndHumidity.getCode(),
|
|
|
@@ -101,9 +98,9 @@ public class IotCommonSensorServiceImpl extends ServiceImpl<IotCommonSensorMappe
|
|
|
final String info = record.getInfo();
|
|
|
final List<Long> collect = Arrays.stream(record.getOrgPath().split("-")).map(Long::parseLong).collect(Collectors.toList());
|
|
|
//地区名称
|
|
|
- cacheList.stream().filter(org->collect.contains(org.getId())&&OrgTypeEnum.DIQU_HANG_SHE.getCode().equals(org.getType())).findFirst().ifPresent(org->record.setFirstOrgName(org.getShortName()));
|
|
|
+ cacheList.stream().filter(org -> collect.contains(org.getId()) && OrgTypeEnum.DIQU_HANG_SHE.getCode().equals(org.getType())).findFirst().ifPresent(org -> record.setFirstOrgName(org.getShortName()));
|
|
|
//行社名称
|
|
|
- cacheList.stream().filter(org->collect.contains(org.getId())&&OrgTypeEnum.HANG_SHE.getCode().equals(org.getType())).findFirst().ifPresent(org->record.setSecondOrgName(org.getShortName()));
|
|
|
+ cacheList.stream().filter(org -> collect.contains(org.getId()) && OrgTypeEnum.HANG_SHE.getCode().equals(org.getType())).findFirst().ifPresent(org -> record.setSecondOrgName(org.getShortName()));
|
|
|
record.setInfo(dealInfoData(info));
|
|
|
record.setDeviceType(BaseDeviceTypeEnum.getDescByCode(record.getDeviceType()));
|
|
|
record.setStateText(DictUtils.getDictLabel(DictConstants.SENSOR_ALARM_STATUS, record.getState()));
|
|
|
@@ -176,8 +173,8 @@ public class IotCommonSensorServiceImpl extends ServiceImpl<IotCommonSensorMappe
|
|
|
record.setInfo(dealInfoData(info));
|
|
|
record.setDeviceType(DictUtils.getDictLabel(DictConstants.APP_SENSOR_DEVICE_TYPE, Integer.parseInt(record.getDeviceType())));
|
|
|
record.setStateText(DictUtils.getDictLabel(DictConstants.SENSOR_ALARM_STATUS, record.getState()));
|
|
|
- if (SecurityUtils.isApp()){
|
|
|
- record.setOrgName(orgService.concatOrgName(record.getOrgId(),SecurityConstants.INNER));
|
|
|
+ if (SecurityUtils.isApp()) {
|
|
|
+ record.setOrgName(orgService.concatOrgName(record.getOrgId(), SecurityConstants.INNER));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -194,8 +191,8 @@ public class IotCommonSensorServiceImpl extends ServiceImpl<IotCommonSensorMappe
|
|
|
|
|
|
@Override
|
|
|
public SensorAppVo appDetail(Long id) {
|
|
|
- IotDeviceInfo deviceInfo = deviceInfoMapper.selectById(id);
|
|
|
- if (deviceInfo==null){
|
|
|
+ IotDeviceInfo deviceInfo = deviceInfoMapper.selectById(id);
|
|
|
+ if (deviceInfo == null) {
|
|
|
throw new ServiceException("不存在该设备");
|
|
|
}
|
|
|
IotDeviceStatus deviceStatus = deviceStatusMapper.selectByDeviceId(deviceInfo.getId());
|
|
|
@@ -211,7 +208,7 @@ public class IotCommonSensorServiceImpl extends ServiceImpl<IotCommonSensorMappe
|
|
|
vo.setInfos(deviceStatus.getInfo());
|
|
|
vo.setDeviceTypeText(DictUtils.getDictLabel(DictConstants.APP_SENSOR_DEVICE_TYPE, Integer.parseInt(vo.getDeviceType())));
|
|
|
vo.setStateText(DictUtils.getDictLabel(DictConstants.SENSOR_ALARM_STATUS, vo.getState()));
|
|
|
- vo.setOrgName(orgService.concatOrgName(deviceInfo.getOrgId(),SecurityConstants.INNER));
|
|
|
+ vo.setOrgName(orgService.concatOrgName(deviceInfo.getOrgId(), SecurityConstants.INNER));
|
|
|
return vo;
|
|
|
}
|
|
|
|
|
|
@@ -267,4 +264,54 @@ public class IotCommonSensorServiceImpl extends ServiceImpl<IotCommonSensorMappe
|
|
|
return String.join(";", dataList);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<Map<String, String>> getDeviceTypeList(String type) {
|
|
|
+ List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
|
|
+ if (ObjectUtil.isEmpty(type)) {
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if ("FSU".equals(type)) {
|
|
|
+ for (BaseDeviceTypeEnum value : BaseDeviceTypeEnum.values()) {
|
|
|
+ if (value.name().contains(type) && !value.name().equals(type)) {
|
|
|
+ Map<String, String> map = new HashMap<String, String>();
|
|
|
+ map.put("code", value.getCode());
|
|
|
+ map.put("name", value.getDesc());
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ("DVS".equals(type)) {
|
|
|
+ /*Map<String, String> map1 = new HashMap<String, String>();
|
|
|
+ map1.put("code", BaseDeviceTypeEnum.Dvs.getCode());
|
|
|
+ map1.put("desc", BaseDeviceTypeEnum.Dvs.getDesc());
|
|
|
+ list.add(map1);*/
|
|
|
+ Map<String, String> map2 = new HashMap<String, String>();
|
|
|
+ map2.put("code", BaseDeviceTypeEnum.monitor_camera.getCode());
|
|
|
+ map2.put("name", BaseDeviceTypeEnum.monitor_camera.getDesc());
|
|
|
+ list.add(map2);
|
|
|
+ Map<String, String> map3 = new HashMap<String, String>();
|
|
|
+ map3.put("code", BaseDeviceTypeEnum.number_camera.getCode());
|
|
|
+ map3.put("name", BaseDeviceTypeEnum.number_camera.getDesc());
|
|
|
+ list.add(map3);
|
|
|
+ }
|
|
|
+ if ("AlarmHost".equals(type)) {
|
|
|
+ /*Map<String, String> map1 = new HashMap<String, String>();
|
|
|
+ map1.put("code", BaseDeviceTypeEnum.Dvs.getCode());
|
|
|
+ map1.put("desc", BaseDeviceTypeEnum.Dvs.getDesc());
|
|
|
+ list.add(map1);*/
|
|
|
+ Map<String, String> map2 = new HashMap<String, String>();
|
|
|
+ map2.put("code", BaseDeviceTypeEnum.subsystem.getCode());
|
|
|
+ map2.put("name", BaseDeviceTypeEnum.subsystem.getDesc());
|
|
|
+ list.add(map2);
|
|
|
+ Map<String, String> map3 = new HashMap<String, String>();
|
|
|
+ map3.put("code", BaseDeviceTypeEnum.number_camera.getCode());
|
|
|
+ map3.put("name", BaseDeviceTypeEnum.number_camera.getDesc());
|
|
|
+ list.add(map3);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
}
|