| | |
| | | package com.ycl.platform.service.impl; |
| | | |
| | | import annotation.DataScope; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.platform.domain.entity.TMonitor; |
| | | import com.ycl.platform.domain.query.HomeQuery; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.service.ITMonitorService; |
| | | import com.ycl.system.service.ISysConfigService; |
| | | import com.ycl.utils.StringUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 设备资产Service业务层处理 |
| | |
| | | { |
| | | @Autowired |
| | | private TMonitorMapper tMonitorMapper; |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | /** |
| | | * 查询设备资产 |
| | |
| | | * @return 设备资产 |
| | | */ |
| | | @Override |
| | | @DataScope(deptAlias = "d",userAlias = "u") |
| | | public List<TMonitorVO> selectTMonitorList(TMonitor tMonitor) |
| | | { |
| | | return tMonitorMapper.selectTMonitorList(tMonitor); |
| | | List<TMonitorVO> monitors = tMonitorMapper.selectTMonitorList(tMonitor); |
| | | if (Objects.equals(tMonitor.getRecovery(), 1)) { |
| | | String time = configService.selectConfigByKey("abnormal.equipment.continuous.attention.time"); |
| | | if (StringUtils.isBlank(time)) { |
| | | throw new RuntimeException("请配置异常设备连续关注时间"); |
| | | } |
| | | List<TMonitorVO> recoveryMonitors = tMonitorMapper.selectRecoveryMonitor(time); |
| | | monitors.addAll(recoveryMonitors); |
| | | } |
| | | return monitors; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, String> getVideoCount(String cameraFunType) { |
| | | return tMonitorMapper.getVideoCount(cameraFunType); |
| | | @DataScope(deptAlias = "d",userAlias = "u") |
| | | public Map<String, String> getVideoCount(TMonitor tMonitor) { |
| | | return tMonitorMapper.getVideoCount(tMonitor); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, String> recoveryException() { |
| | | return tMonitorMapper.recoveryException(); |
| | | String time = configService.selectConfigByKey("abnormal.equipment.continuous.attention.time"); |
| | | return tMonitorMapper.recoveryException(time); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> home(HomeQuery monitorQuery) { |
| | | Map<String, Object> dataMap = new HashMap<>(); |
| | | Map<String, Object> monthMap1 = new HashMap<>(); |
| | | Map<String, Object> monthMap2 = new HashMap<>(); |
| | | List<Map<String, Object>> home = baseMapper.home(monitorQuery); |
| | | if (ObjectUtils.isNotEmpty(home)) { |
| | | for (Map<String, Object> map : home) { |
| | | monthMap1.put(map.get("months").toString(), map.get("num1")); |
| | | monthMap2.put(map.get("months").toString(), map.get("num2")); |
| | | } |
| | | dataMap.put("name", home.get(0).get("name")); |
| | | dataMap.put("state", monthMap1); |
| | | dataMap.put("state2", monthMap2); |
| | | } |
| | | return dataMap; |
| | | } |
| | | } |