| | |
| | | |
| | | import org.sxkj.fw.cockpit.vo.AlarmStatisticsVO; |
| | | import org.sxkj.fw.cockpit.vo.DeviceStatisticsVO; |
| | | import org.sxkj.fw.common.GenericConverter; |
| | | import org.sxkj.fw.device.dto.FwDeviceDTO; |
| | | import org.sxkj.fw.device.entity.FwDeviceEntity; |
| | | import org.sxkj.fw.device.param.FwDevicePageParam; |
| | | import org.sxkj.fw.device.vo.CockpitFwDeviceVO; |
| | | import org.sxkj.fw.device.vo.DeviceTypeStatisticsVO; |
| | | import org.sxkj.fw.device.vo.FwDeviceVO; |
| | |
| | | import org.sxkj.fw.device.mapper.FwDeviceMapper; |
| | | import org.sxkj.fw.device.service.IFwDeviceService; |
| | | import org.sxkj.fw.area.service.IFwAreaDivideService; |
| | | import org.sxkj.fw.device.wrapper.FwDeviceWrapper; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<FwDeviceVO> selectFwDevicePageVo(FwDevicePageParam fwDevice, Query query) { |
| | | IPage<FwDeviceEntity> pages = selectFwDevicePage(Condition.getPage(query), GenericConverter.convert(fwDevice, FwDeviceDTO.class)); |
| | | IPage<FwDeviceVO> result = FwDeviceWrapper.build().pageVO(pages); |
| | | List<FwDeviceVO> records = result.getRecords(); |
| | | if (records != null && !records.isEmpty()) { |
| | | List<Long> deviceIds = records.stream() |
| | | .map(FwDeviceVO::getId) |
| | | .filter(id -> id != null) |
| | | .collect(Collectors.toList()); |
| | | Map<Long, String> sceneNameMap = selectSceneNameByDeviceIds(deviceIds); |
| | | for (FwDeviceVO record : records) { |
| | | String sceneName = sceneNameMap.get(record.getId()); |
| | | record.setSceneName(StringUtil.isBlank(sceneName) ? "/" : sceneName); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<FwDeviceEntity> selectFwDeviceList(Integer isAreaSelect, Long areaId, Integer status) { |
| | | return baseMapper.selectFwDeviceList(isAreaSelect, areaId, status); |
| | | } |