|
@@ -237,6 +237,41 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
return capacity.get();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<Long, BigDecimal> queryCapacities(List<Long> deptIds) {
|
|
|
+ Map<Long, BigDecimal> capacityPair = new HashMap<>();
|
|
|
+ // 找到当前小队下的 电驱增压机 分类下设备的产能 计算 运行时效
|
|
|
+ DictTypeDO dictType = dictTypeService.getDictType("rq_iot_charger_device_category");
|
|
|
+ AtomicReference<BigDecimal> capacity = new AtomicReference<>(BigDecimal.ZERO);
|
|
|
+ if (ObjUtil.isNotEmpty(dictType)) {
|
|
|
+ if (StrUtil.isNotBlank(dictType.getRemark())) {
|
|
|
+ IotDevicePageReqVO capacityReqVO = new IotDevicePageReqVO();
|
|
|
+ capacityReqVO.setDeptIds(deptIds);
|
|
|
+ capacityReqVO.setAssetClass(Long.valueOf(dictType.getRemark()));
|
|
|
+ List<IotDeviceDO> capacityDevices = iotDeviceMapper.selectList(capacityReqVO);
|
|
|
+ if (CollUtil.isNotEmpty(capacityDevices)) {
|
|
|
+ // 解析每个设备的 扩展属性 找出 已经设置 了产能的设备并提取值
|
|
|
+ capacityDevices.forEach(device -> {
|
|
|
+ if (StrUtil.isNotBlank(device.getTemplateJson())) {
|
|
|
+ Gson gson = new Gson();
|
|
|
+ Type listType = new TypeToken<List<IotDeviceProperty>>(){}.getType();
|
|
|
+ List<IotDeviceProperty> deviceProperties = gson.fromJson(device.getTemplateJson(), listType);
|
|
|
+ if (CollUtil.isNotEmpty(deviceProperties)) {
|
|
|
+ deviceProperties.forEach(property -> {
|
|
|
+ if ("产能".equals(property.getName()) && StrUtil.isNotBlank(property.getValue())) {
|
|
|
+ // 当前扩展属性已经维护了 产能 值
|
|
|
+ capacity.set(new BigDecimal(property.getValue()));
|
|
|
+ }
|
|
|
+ capacityPair.put(device.getDeptId(), capacity.get());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return capacityPair;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
@Override
|