工厂大屏数据bug

This commit is contained in:
aikai 2024-10-25 12:02:48 +08:00
parent e0e1e64520
commit f7a333bb5a

View File

@ -286,8 +286,8 @@ public class ScreenDataServiceImpl implements ScreenDataService {
// List<ScreenFactoryExtraDO> extras = screenFactoryExtraService.list();
// List<FactoryDataOverviewDO> list = factoryDataOverviewService.list();
//获取工厂列表
List<FactoryInfoDO> factoryList = factoryInfoService.getFactoryList(Collections.singletonList(factoryId));
List<Long> factoryIds = factoryId == null ? Collections.emptyList() : Collections.singletonList(factoryId);
List<FactoryInfoDO> factoryList = factoryInfoService.getFactoryList(factoryIds);
Map<Long, FactoryInfoDO> factoryMap = factoryList.stream().collect(Collectors.toMap(FactoryInfoDO::getId, v -> v));
// ---------------------------------- 用户 ----------------------------------
// -- 通过工厂id获取部门列表 -> 再通过部门列表获取用户列表
@ -327,7 +327,7 @@ public class ScreenDataServiceImpl implements ScreenDataService {
}
vo.setFactoryKilnList(factoryKilnList);
// ---------------------------------- 打包线 ----------------------------------
List<FactoryPackingLineDO> factoryPackingLineDOS = factoryPackingLineService.getFactoryPackingLineByFactoryId(Collections.singletonList(factoryId));
List<FactoryPackingLineDO> factoryPackingLineDOS = factoryPackingLineService.getFactoryPackingLineByFactoryId(factoryIds);
Map<Long, List<FactoryPackingLineDO>> factoryPackingLineMap = factoryPackingLineDOS.stream().collect(Collectors.groupingBy(FactoryPackingLineDO::getFactoryId));
vo.setDbxNum(factoryPackingLineDOS.size());
List<FactoryPackingLineVO> FactoryPackingLineList = new ArrayList<>();
@ -344,8 +344,8 @@ public class ScreenDataServiceImpl implements ScreenDataService {
List<ForkliftVO> forkliftList = new ArrayList<>();
List<Long> forkliftOilTypeIds = assetsTypeApi.getAssetsTypeIdsByCode(AssetsTypeCodeEnum.FORKLIFT_OIL).getData();
List<Long> forkliftElectricityTypeIds = assetsTypeApi.getAssetsTypeIdsByCode(AssetsTypeCodeEnum.FORKLIFT_ELECTRICITY).getData();
List<FactoryForkliftRespVO> factoryForkliftOil = factoryForkliftMapper.getFactoryForkliftByFactoryIdAndTypeIds(Collections.singletonList(factoryId), forkliftOilTypeIds);
List<FactoryForkliftRespVO> forkliftElectricity = factoryForkliftMapper.getFactoryForkliftByFactoryIdAndTypeIds(Collections.singletonList(factoryId), forkliftElectricityTypeIds);
List<FactoryForkliftRespVO> factoryForkliftOil = factoryForkliftMapper.getFactoryForkliftByFactoryIdAndTypeIds(factoryIds, forkliftOilTypeIds);
List<FactoryForkliftRespVO> forkliftElectricity = factoryForkliftMapper.getFactoryForkliftByFactoryIdAndTypeIds(factoryIds, forkliftElectricityTypeIds);
vo.setForkliftTotal(factoryForkliftOil.size() + forkliftElectricity.size());
// -- 插入未分配数量
@ -390,14 +390,14 @@ public class ScreenDataServiceImpl implements ScreenDataService {
// ---------------------------------- 托盘 ----------------------------------
List<Long> trayAssetsTypeIds = assetsTypeApi.getAssetsTypeIdsByCode(AssetsTypeCodeEnum.TRAY).getData();
List<AssetsStockVO> trayList = screenDataMapper.getAssetsNumByFactoryIdAndTypeIds(Collections.singletonList(factoryId), trayAssetsTypeIds);
List<AssetsStockVO> trayList = screenDataMapper.getAssetsNumByFactoryIdAndTypeIds(factoryIds, trayAssetsTypeIds);
vo.setTpNum(trayList.stream().mapToInt(AssetsStockVO::getStock).sum());
vo.setTrayList(trayList);
// ---------------------------------- 绑带 ----------------------------------
List<Long> strapsAssetsTypeIds = assetsTypeApi.getAssetsTypeIdsByCode(AssetsTypeCodeEnum.STRAPS).getData();
List<AssetsStockVO> strapsList = screenDataMapper.getAssetsNumByFactoryIdAndTypeIds(Collections.singletonList(factoryId), strapsAssetsTypeIds);
List<AssetsStockVO> strapsList = screenDataMapper.getAssetsNumByFactoryIdAndTypeIds(factoryIds, strapsAssetsTypeIds);
vo.setBdNum(strapsList.stream().mapToInt(AssetsStockVO::getStock).sum());
vo.setStrapsList(strapsList);