|
@@ -29,12 +29,14 @@ import com.xy.device.EnumQualityMercSets;
|
|
import com.xy.dto.*;
|
|
import com.xy.dto.*;
|
|
import com.xy.dto.api.biz.ContainerAddDTO;
|
|
import com.xy.dto.api.biz.ContainerAddDTO;
|
|
import com.xy.dto.be.MercDto;
|
|
import com.xy.dto.be.MercDto;
|
|
|
|
+import com.xy.dto.common.MercRegionDto;
|
|
import com.xy.entity.*;
|
|
import com.xy.entity.*;
|
|
import com.xy.enums.FileExportType;
|
|
import com.xy.enums.FileExportType;
|
|
import com.xy.error.CommRuntimeException;
|
|
import com.xy.error.CommRuntimeException;
|
|
import com.xy.mapper.DeviceInfoMapper;
|
|
import com.xy.mapper.DeviceInfoMapper;
|
|
import com.xy.mapper.entity.DeviceInfoQueryPage;
|
|
import com.xy.mapper.entity.DeviceInfoQueryPage;
|
|
import com.xy.service.be.MercFeignService;
|
|
import com.xy.service.be.MercFeignService;
|
|
|
|
+import com.xy.service.common.MercRegionService;
|
|
import com.xy.sys.EnumDataClearSize;
|
|
import com.xy.sys.EnumDataClearSize;
|
|
import com.xy.util.ExcelUtils;
|
|
import com.xy.util.ExcelUtils;
|
|
import com.xy.utils.*;
|
|
import com.xy.utils.*;
|
|
@@ -78,12 +80,12 @@ import static com.xy.utils.PlusBeans.*;
|
|
@Api(tags = "设备-信息")
|
|
@Api(tags = "设备-信息")
|
|
public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceInfo> implements DeviceInfoService {
|
|
public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceInfo> implements DeviceInfoService {
|
|
|
|
|
|
- private final CloudWalkApiService cloudWalkApiService;
|
|
|
|
- private final AlgorithmService algorithmService;
|
|
|
|
/**
|
|
/**
|
|
* 质检商户code
|
|
* 质检商户code
|
|
*/
|
|
*/
|
|
public static final String QA_MERC_CODE = "10001";
|
|
public static final String QA_MERC_CODE = "10001";
|
|
|
|
+ private final CloudWalkApiService cloudWalkApiService;
|
|
|
|
+ private final AlgorithmService algorithmService;
|
|
private final MercFeignService mercFeignService;
|
|
private final MercFeignService mercFeignService;
|
|
private final DeviceSysinfoServiceImpl deviceSysinfoService;
|
|
private final DeviceSysinfoServiceImpl deviceSysinfoService;
|
|
private final DeviceStatusServiceImpl deviceStatusService;
|
|
private final DeviceStatusServiceImpl deviceStatusService;
|
|
@@ -100,6 +102,8 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
private final AlipayDeviceService alipayDeviceService;
|
|
private final AlipayDeviceService alipayDeviceService;
|
|
private final String keyPrefix = "device:history:";
|
|
private final String keyPrefix = "device:history:";
|
|
|
|
|
|
|
|
+ private final MercRegionService mercRegionService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@ApiOperation("设备在线数查询")
|
|
@ApiOperation("设备在线数查询")
|
|
public R<Map<Long, DeviceInfoDto.NetStateCountVo>> netStateCount(DeviceInfoDto.NetStateCountDto dto) {
|
|
public R<Map<Long, DeviceInfoDto.NetStateCountVo>> netStateCount(DeviceInfoDto.NetStateCountDto dto) {
|
|
@@ -767,8 +771,11 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
lqw.in(CollUtil.isNotEmpty(deviceIdList), DeviceInfo::getDeviceId, deviceIdList);
|
|
lqw.in(CollUtil.isNotEmpty(deviceIdList), DeviceInfo::getDeviceId, deviceIdList);
|
|
lqw.like(StrUtil.isNotEmpty(deviceName), DeviceInfo::getDeviceName, deviceName).orderByAsc(true, DeviceInfo::getDeviceName, DeviceInfo::getDeviceId);
|
|
lqw.like(StrUtil.isNotEmpty(deviceName), DeviceInfo::getDeviceName, deviceName).orderByAsc(true, DeviceInfo::getDeviceName, DeviceInfo::getDeviceId);
|
|
List<DeviceInfo> deviceInfoList = this.list(lqw);
|
|
List<DeviceInfo> deviceInfoList = this.list(lqw);
|
|
- //未分配线路的设置默认值
|
|
|
|
- deviceInfoList.stream().filter(s -> s.getPlaceLineId() == null).forEach(s -> s.setPlaceLineId(-1L));
|
|
|
|
|
|
+ //未分区域的设置默认值
|
|
|
|
+ deviceInfoList.stream().filter(s -> s.getDistrictId() == null).forEach(s -> s.setDistrictId(-1L));
|
|
|
|
+ Map<Long, String> districtMap = new HashMap<>();
|
|
|
|
+ List<Long> districtIdList = list.stream().map(DeviceInfoDto.MercHomeCountVO::getDistrictId).filter(i -> i != -1).collect(Collectors.toList());
|
|
|
|
+ districtMap = mercRegionService.getNameList(new MercRegionDto.GetNameListDto().setIds(districtIdList)).getData();
|
|
//根据区域id分组
|
|
//根据区域id分组
|
|
Map<Long, List<DeviceInfo>> deviceMap = deviceInfoList.stream().collect(Collectors.groupingBy(DeviceInfo::getDistrictId));
|
|
Map<Long, List<DeviceInfo>> deviceMap = deviceInfoList.stream().collect(Collectors.groupingBy(DeviceInfo::getDistrictId));
|
|
for (DeviceInfoDto.MercHomeCountVO v : list) {
|
|
for (DeviceInfoDto.MercHomeCountVO v : list) {
|
|
@@ -776,6 +783,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
Long districtId = v.getDistrictId();
|
|
Long districtId = v.getDistrictId();
|
|
vo.setDeviceNum(v.getDeviceNum());
|
|
vo.setDeviceNum(v.getDeviceNum());
|
|
vo.setDistrictId(v.getDistrictId());
|
|
vo.setDistrictId(v.getDistrictId());
|
|
|
|
+ vo.setDistrictName(Emptys.check(districtMap.get(v.getDistrictId()))?districtMap.get(v.getDistrictId()):"");
|
|
//区域下的设备列表
|
|
//区域下的设备列表
|
|
List<DeviceInfoDto.MercHomeDeviceVo> deviceInfos = BeanUtil.copyToList(deviceMap.get(districtId), DeviceInfoDto.MercHomeDeviceVo.class);
|
|
List<DeviceInfoDto.MercHomeDeviceVo> deviceInfos = BeanUtil.copyToList(deviceMap.get(districtId), DeviceInfoDto.MercHomeDeviceVo.class);
|
|
if (CollUtil.isEmpty(deviceInfos)) {
|
|
if (CollUtil.isEmpty(deviceInfos)) {
|