|
|
@@ -8,30 +8,37 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotcarzhbd.vo.IotCarZhbdPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplateattrs.vo.IotDeviceProperty;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotprojecttask.vo.IotProjectTaskPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotrhdailyreport.vo.*;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDevicePageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotcarzhbd.IotCarZhbdDO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotdailyreportfuel.IotDailyReportFuelDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttask.IotProjectTaskDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotrhdailyreport.IotRhDailyReportDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.IotDeviceMapper;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.mysql.iotcarzhbd.IotCarZhbdMapper;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.mysql.iotdailyreportfuel.IotDailyReportFuelMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotdevicerunlog.IotDeviceRunLogMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotprojecttask.IotProjectTaskMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotrhdailyreport.IotRhDailyReportMapper;
|
|
|
import cn.iocoder.yudao.module.pms.enums.common.FailureAuditStatusEnum;
|
|
|
+import cn.iocoder.yudao.module.pms.job.IotDeviceCarFuelVO;
|
|
|
+import cn.iocoder.yudao.module.pms.util.ZHBDUtil;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictTypeDO;
|
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
|
-import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
|
|
import cn.iocoder.yudao.module.system.service.dict.DictTypeService;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
+import lombok.extern.log4j.Log4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
@@ -43,6 +50,7 @@ import java.math.RoundingMode;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
+import java.time.format.DateTimeParseException;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
@@ -58,6 +66,7 @@ import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.*;
|
|
|
*/
|
|
|
@Service
|
|
|
@Validated
|
|
|
+@Log4j
|
|
|
public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
|
|
|
@Resource
|
|
|
@@ -67,7 +76,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
@Resource
|
|
|
private IotDeviceMapper iotDeviceMapper;
|
|
|
@Resource
|
|
|
- private DictDataService dictDataService;
|
|
|
+ private ZHBDUtil zhbdUtil;
|
|
|
@Resource
|
|
|
private DictTypeService dictTypeService;
|
|
|
@Resource
|
|
|
@@ -76,6 +85,11 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
private IotDeviceRunLogMapper iotDeviceRunLogMapper;
|
|
|
@Resource
|
|
|
private DeptService deptService;
|
|
|
+ @Resource
|
|
|
+ private IotCarZhbdMapper iotCarZhbdMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IotDailyReportFuelMapper iotDailyReportFuelMapper;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@@ -97,6 +111,12 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
reqVO.setDeptId(createReqVO.getDeptId());
|
|
|
// 查询包含当前日报施工队伍的任务
|
|
|
List<IotProjectTaskDO> tasks = iotProjectTaskMapper.selectList(reqVO);
|
|
|
+ // 日报对应的任务中的设备列表
|
|
|
+ Set<String> carDeviceCodes = new HashSet<>();
|
|
|
+ // 生成 carId 与 IotDeviceDO 的对应关系Map
|
|
|
+ Map<String, IotDeviceDO> carIdDevicePair = new HashMap<>();
|
|
|
+ // 中航北斗车辆id集合
|
|
|
+ Set<String> zhbdCarIds = new HashSet<>();
|
|
|
if (CollUtil.isNotEmpty(tasks)) {
|
|
|
IotProjectTaskDO task = tasks.get(0);
|
|
|
// 暂时只考虑1个施工队伍只属于1个任务
|
|
|
@@ -111,6 +131,52 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
}
|
|
|
// 查询任务的设备列表
|
|
|
deviceIds = task.getDeviceIds();
|
|
|
+ IotDevicePageReqVO deviceReqVO = new IotDevicePageReqVO();
|
|
|
+ deviceReqVO.setDeviceIds(new ArrayList<>(deviceIds));
|
|
|
+ List<IotDeviceDO> carDevices = iotDeviceMapper.selectListAlone(deviceReqVO);
|
|
|
+ // key设备编码 value设备对象
|
|
|
+ Map<String, IotDeviceDO> devicePair = new HashMap<>();
|
|
|
+ // key中航北斗carId value设备编码
|
|
|
+ Map<String, String> carIdDeviceCodePair = new HashMap<>();
|
|
|
+
|
|
|
+ if (CollUtil.isNotEmpty(carDevices)) {
|
|
|
+ carDevices.forEach(device -> {
|
|
|
+ carDeviceCodes.add(device.getDeviceCode());
|
|
|
+ if (ObjUtil.isNotEmpty(device.getCarId())) {
|
|
|
+ zhbdCarIds.add(String.valueOf(device.getCarId()));
|
|
|
+ carIdDeviceCodePair.put(String.valueOf(device.getCarId()), device.getDeviceCode());
|
|
|
+ }
|
|
|
+ devicePair.put(device.getDeviceCode(), device);
|
|
|
+ });
|
|
|
+ // 查询中航北斗表中的设备车辆
|
|
|
+ IotCarZhbdPageReqVO customDeviceReqVO = new IotCarZhbdPageReqVO();
|
|
|
+ // 设备表中存在的设备编码
|
|
|
+ customDeviceReqVO.setCustomDeviceCodes(carDeviceCodes);
|
|
|
+ List<IotCarZhbdDO> deviceCars = iotCarZhbdMapper.selectList(customDeviceReqVO);
|
|
|
+ if (CollUtil.isNotEmpty(deviceCars)) {
|
|
|
+ deviceCars.forEach(car -> {
|
|
|
+ zhbdCarIds.add(car.getCarId());
|
|
|
+ carIdDeviceCodePair.put(car.getCarId(), car.getDeviceCode());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 额外匹配的 RA 与 设备表对应的编码
|
|
|
+ customDeviceReqVO.setCustomDeviceCodes(null);
|
|
|
+ customDeviceReqVO.setDeviceCodes(carDeviceCodes);
|
|
|
+ List<IotCarZhbdDO> raCars = iotCarZhbdMapper.selectList(customDeviceReqVO);
|
|
|
+ if (CollUtil.isNotEmpty(raCars)) {
|
|
|
+ raCars.forEach(car -> {
|
|
|
+ zhbdCarIds.add(car.getCarId());
|
|
|
+ carIdDeviceCodePair.put(car.getCarId(), car.getUserName());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 生成 carId 与 IotDeviceDO 的对应关系Map
|
|
|
+ carIdDevicePair = carIdDeviceCodePair.entrySet().stream()
|
|
|
+ .filter(entry -> devicePair.containsKey(entry.getValue()))
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ Map.Entry::getKey,
|
|
|
+ entry -> devicePair.get(entry.getValue())
|
|
|
+ ));
|
|
|
+ }
|
|
|
} else {
|
|
|
// 当前队伍没有关联任务 不生成日报
|
|
|
// throw exception(IOT_PROJECT_TASK_NOT_RELATED);
|
|
|
@@ -147,66 +213,85 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
iotRhDailyReport.setTransitTime(createReqVO.getDailyGasInjection().divide(capacity, 4, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
|
|
|
- // 查询当前日报所属任务关联的设备 更新设备状态
|
|
|
- /* if (CollUtil.isNotEmpty(deviceIds)) {
|
|
|
- // 查询当前任务下关联的所有设备
|
|
|
- IotDevicePageReqVO deviceReqVO = new IotDevicePageReqVO();
|
|
|
- // deviceReqVO.setDeptId(createReqVO.getDeptId());
|
|
|
- deviceReqVO.setDeviceIds(new ArrayList<>(deviceIds));
|
|
|
- List<IotDeviceDO> devices = iotDeviceMapper.selectList(deviceReqVO);
|
|
|
- if (CollUtil.isNotEmpty(devices)) {
|
|
|
- AtomicReference<String> deviceNewStatus = new AtomicReference<>(StrUtil.EMPTY);
|
|
|
- // 日报状态 与 设备状态 对应关系
|
|
|
- // 动迁 施工 现场待命/驻地待命(待命) pms_device_status
|
|
|
- List<DictDataDO> dictDatas = dictDataService.getDictDataListByDictType("constructionStatus");
|
|
|
- AtomicReference<String> dailyDictLabel = new AtomicReference<>(StrUtil.EMPTY);
|
|
|
- List<DictDataDO> deviceDictDatas = dictDataService.getDictDataListByDictType("pms_device_status");
|
|
|
- if (CollUtil.isNotEmpty(dictDatas)) {
|
|
|
- dictDatas.forEach(data -> {
|
|
|
- if (createReqVO.getConstructionStatus().equals(Integer.valueOf(data.getValue()))) {
|
|
|
- dailyDictLabel.set(data.getLabel());
|
|
|
- }
|
|
|
- });
|
|
|
- if (CollUtil.isNotEmpty(deviceDictDatas)) {
|
|
|
- deviceDictDatas.forEach(data -> {
|
|
|
- if (dailyDictLabel.equals(data.getLabel())) {
|
|
|
- // 动迁 施工
|
|
|
- deviceNewStatus.set(data.getValue());
|
|
|
- }
|
|
|
- if (data.getLabel().contains(dailyDictLabel.get())) {
|
|
|
- // 现场待命/驻地待命(待命)
|
|
|
- deviceNewStatus.set(data.getValue());
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- // 批量更新设备状态
|
|
|
- devices.forEach(device -> {
|
|
|
- device.setDeviceStatus(deviceNewStatus.get());
|
|
|
- });
|
|
|
- iotDeviceMapper.updateBatch(devices);
|
|
|
- }
|
|
|
- } */
|
|
|
-
|
|
|
// 当天如果已经有此小队的记录 新增 当天如果没有此小队的日报记录 修改
|
|
|
// deptId - taskId - createTime(yyyy-MM-dd) 确定唯一一条记录 不能使用 LocalDateTime.now() 来查询,应该使用 运行记录工单的创建日期查询
|
|
|
IotRhDailyReportDO existReport = iotRhDailyReportMapper.selectExistReport(createReqVO.getDeptId(), null, reportDate);
|
|
|
+ // 查询日报相关的任务关联的设备油耗
|
|
|
+ // 获得昨天的日期
|
|
|
+ String yesterdayDateStr = StrUtil.EMPTY;
|
|
|
+ LocalDateTime yesterday = reportDate.minusDays(1);
|
|
|
+ yesterdayDateStr = LocalDateTimeUtil.format(yesterday, DatePattern.NORM_DATE_PATTERN);
|
|
|
if (ObjUtil.isEmpty(existReport)) {
|
|
|
// 今天下午4点
|
|
|
LocalDateTime today4pm = reportDate.withHour(16).withMinute(0).withSecond(0).withNano(0);
|
|
|
// 昨天下午4点
|
|
|
LocalDateTime yesterday4pm = today4pm.minusDays(1);
|
|
|
+
|
|
|
iotRhDailyReport.setConstructionStartDate(yesterday4pm);
|
|
|
iotRhDailyReport.setConstructionEndDate(today4pm);
|
|
|
iotRhDailyReport.setCreateTime(reportDate);
|
|
|
iotRhDailyReport.setUpdateTime(reportDate);
|
|
|
iotRhDailyReportMapper.insert(iotRhDailyReport);
|
|
|
+ BigDecimal totalOilUsage = BigDecimal.ZERO;
|
|
|
+ // 生成日报时 查询当前日报关联的任务中的车辆 查询中航北斗指定日报区间范围内的油耗数据 子表 主表
|
|
|
+ List<IotDailyReportFuelDO> reportFuels = new ArrayList<>();
|
|
|
+ if (CollUtil.isNotEmpty(zhbdCarIds)) {
|
|
|
+ if (StrUtil.isNotBlank(yesterdayDateStr)) {
|
|
|
+ try {
|
|
|
+ Map<Integer, IotDeviceCarFuelVO> carFuels = zhbdUtil.carFuels(StrUtil.join(",", zhbdCarIds),
|
|
|
+ StrUtil.join(" ", yesterdayDateStr, "00:00:00"), StrUtil.join(" ", yesterdayDateStr, "23:59:59"));
|
|
|
+ System.out.println("请求参数:" + zhbdCarIds.size() + " -开始时间: "
|
|
|
+ + StrUtil.join(" ", yesterdayDateStr, "00:00:00") + " -开始时间: "
|
|
|
+ + StrUtil.join(" ", yesterdayDateStr, "23:59:59"));
|
|
|
+ if (CollUtil.isNotEmpty(carFuels)) {
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+ Map<String, IotDeviceDO> finalCarIdDevicePair = carIdDevicePair;
|
|
|
+ for (Map.Entry<Integer, IotDeviceCarFuelVO> carFuelEntry : carFuels.entrySet()) {
|
|
|
+ Integer carId = carFuelEntry.getKey();
|
|
|
+ IotDeviceCarFuelVO carFuel = carFuelEntry.getValue();
|
|
|
+ // carId中航北斗车辆id value车辆油耗
|
|
|
+ IotDailyReportFuelDO reportFuel = new IotDailyReportFuelDO();
|
|
|
+ reportFuel.setType("RH");
|
|
|
+ reportFuel.setReportId(iotRhDailyReport.getId());
|
|
|
+ reportFuel.setCarId(String.valueOf(carId));
|
|
|
+ // 使用 carIdDeviceMap 获取对应的设备对象并设置deviceId
|
|
|
+ IotDeviceDO device = finalCarIdDevicePair.get(String.valueOf(carId));
|
|
|
+ reportFuel.setDeviceId(device.getId());
|
|
|
+ reportFuel.setDeviceCode(device.getDeviceCode());
|
|
|
+ reportFuel.setDeviceName(device.getDeviceName());
|
|
|
+ BigDecimal tempOil = new BigDecimal(carFuel.getOil());
|
|
|
+ totalOilUsage = totalOilUsage.add(tempOil);
|
|
|
+ reportFuel.setZhbdFuel(tempOil);
|
|
|
+ // 将字符串转换为LocalDateTime
|
|
|
+ try {
|
|
|
+ LocalDateTime queryDate = LocalDate.parse(carFuel.getCreatetime(), formatter).atStartOfDay();;
|
|
|
+ reportFuel.setQueryDate(queryDate);
|
|
|
+ } catch (DateTimeParseException e) {
|
|
|
+ log.error("瑞恒日报-中航北斗油耗-日期格式解析失败: {}", e);
|
|
|
+ // 根据业务需求设置默认值或抛出异常
|
|
|
+ reportFuel.setQueryDate(null);
|
|
|
+ }
|
|
|
+ reportFuels.add(reportFuel);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("获取油耗数据失败!");
|
|
|
+ }
|
|
|
+ if (CollUtil.isNotEmpty(reportFuels)) {
|
|
|
+ // 生成瑞恒日报时 同步新增日报关联的任务车辆油耗
|
|
|
+ iotDailyReportFuelMapper.insertBatch(reportFuels);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 先插入记录再更新 因为需要获取日报id
|
|
|
+ iotRhDailyReport.setDailyOilUsage(totalOilUsage);
|
|
|
+ // 根据日报关联任务车辆油耗 计算总油耗 后保存日报
|
|
|
+ iotRhDailyReportMapper.updateById(iotRhDailyReport);
|
|
|
} else {
|
|
|
// 修改现有记录
|
|
|
iotRhDailyReport.setId(existReport.getId());
|
|
|
iotRhDailyReportMapper.updateById(iotRhDailyReport);
|
|
|
}
|
|
|
- // 返回
|
|
|
return iotRhDailyReport.getId();
|
|
|
}
|
|
|
|
|
|
@@ -499,6 +584,8 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
Map<Long, BigDecimal> cumulativeWaterInjectionPair = new HashMap<>();
|
|
|
// key队伍id/项目部id value累计用电
|
|
|
Map<Long, BigDecimal> cumulativePowerConsumptionPair = new HashMap<>();
|
|
|
+ // key队伍id/项目部id value累计油耗
|
|
|
+ Map<Long, BigDecimal> cumulativeOilConsumptionPair = new HashMap<>();
|
|
|
// key队伍id/项目部id value对应项目部的总产能
|
|
|
Map<Long, BigDecimal> cumulativeCapacityPair = new HashMap<>();
|
|
|
// key队伍id/项目部id value累计运行时效 累计注气量/累计产能
|
|
|
@@ -537,6 +624,8 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
cumulativeWaterInjectionPair.merge(projectDeptId, report.getDailyWaterInjection(), BigDecimal::add);
|
|
|
// 累计用电量
|
|
|
cumulativePowerConsumptionPair.merge(projectDeptId, report.getDailyPowerUsage(), BigDecimal::add);
|
|
|
+ // 累计油耗
|
|
|
+ cumulativeOilConsumptionPair.merge(projectDeptId, report.getDailyOilUsage(), BigDecimal::add);
|
|
|
if (teamCapacityPair.containsKey(report.getDeptId())) {
|
|
|
BigDecimal tempCapacity = teamCapacityPair.get(report.getDeptId());
|
|
|
cumulativeCapacityPair.merge(projectDeptId, tempCapacity, BigDecimal::add);
|
|
|
@@ -571,6 +660,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
statistics.setCumulativeGasInjection(cumulativeGasInjectionPair.get(deptId));
|
|
|
statistics.setCumulativeWaterInjection(cumulativeWaterInjectionPair.get(deptId));
|
|
|
statistics.setCumulativePowerConsumption(cumulativePowerConsumptionPair.get(deptId));
|
|
|
+ statistics.setCumulativeFuelConsumption(cumulativeOilConsumptionPair.get(deptId));
|
|
|
statistics.setTransitTime(cumulativeTransitTimePair.get(deptId));
|
|
|
result.add(statistics);
|
|
|
});
|
|
|
@@ -641,7 +731,8 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
dateWaterInjectionPair.merge(reportDateStr, report.getDailyWaterInjection(), BigDecimal::add);
|
|
|
// 累计用电量
|
|
|
datePowerConsumptionPair.merge(reportDateStr, report.getDailyPowerUsage(), BigDecimal::add);
|
|
|
- // todo 累计油耗
|
|
|
+ // 累计油耗
|
|
|
+ dateFuelConsumptionPair.merge(reportDateStr, report.getDailyOilUsage(), BigDecimal::add);
|
|
|
// 累计产能
|
|
|
if (teamCapacityPair.containsKey(report.getDeptId())) {
|
|
|
BigDecimal tempCapacity = teamCapacityPair.get(report.getDeptId());
|
|
|
@@ -686,6 +777,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
statistics.setCumulativeGasInjection(dateGasInjectionPair.get(date));
|
|
|
statistics.setCumulativeWaterInjection(dateWaterInjectionPair.get(date));
|
|
|
statistics.setCumulativePowerConsumption(datePowerConsumptionPair.get(date));
|
|
|
+ statistics.setCumulativeFuelConsumption(dateFuelConsumptionPair.get(date));
|
|
|
statistics.setTransitTime(dateTransitTimePair.get(date));
|
|
|
result.add(statistics);
|
|
|
});
|
|
|
@@ -716,6 +808,8 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
Map<Long, BigDecimal> cumulativeWaterInjectionPair = new HashMap<>();
|
|
|
// key队伍id value累计用电
|
|
|
Map<Long, BigDecimal> cumulativePowerConsumptionPair = new HashMap<>();
|
|
|
+ // key队伍id value累计油耗
|
|
|
+ Map<Long, BigDecimal> cumulativeOilConsumptionPair = new HashMap<>();
|
|
|
// key队伍id/项目部id value对应项目部的总产能
|
|
|
Map<Long, BigDecimal> cumulativeCapacityPair = new HashMap<>();
|
|
|
// key队伍id/项目部id value累计运行时效 累计注气量/累计产能
|
|
|
@@ -753,6 +847,8 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
cumulativeWaterInjectionPair.merge(report.getDeptId(), report.getDailyWaterInjection(), BigDecimal::add);
|
|
|
// 累计用电量
|
|
|
cumulativePowerConsumptionPair.merge(report.getDeptId(), report.getDailyPowerUsage(), BigDecimal::add);
|
|
|
+ // 累计油耗
|
|
|
+ cumulativeOilConsumptionPair.merge(report.getDeptId(), report.getDailyOilUsage(), BigDecimal::add);
|
|
|
if (teamCapacityPair.containsKey(report.getDeptId())) {
|
|
|
BigDecimal tempCapacity = teamCapacityPair.get(report.getDeptId());
|
|
|
cumulativeCapacityPair.merge(report.getDeptId(), tempCapacity, BigDecimal::add);
|
|
|
@@ -784,6 +880,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
statistics.setCumulativeGasInjection(cumulativeGasInjectionPair.get(teamDeptId));
|
|
|
statistics.setCumulativeWaterInjection(cumulativeWaterInjectionPair.get(teamDeptId));
|
|
|
statistics.setCumulativePowerConsumption(cumulativePowerConsumptionPair.get(teamDeptId));
|
|
|
+ statistics.setCumulativeFuelConsumption(cumulativeOilConsumptionPair.get(teamDeptId));
|
|
|
statistics.setTransitTime(cumulativeTransitTimePair.get(teamDeptId));
|
|
|
result.add(statistics);
|
|
|
});
|
|
|
@@ -808,17 +905,6 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
// key部门id value部门parentId
|
|
|
Map<Long, Long> teamProjectIdPair = new HashMap<>();
|
|
|
|
|
|
- // key队伍id value累计注气量
|
|
|
- Map<Long, BigDecimal> cumulativeGasInjectionPair = new HashMap<>();
|
|
|
- // key队伍id value累计注水量
|
|
|
- Map<Long, BigDecimal> cumulativeWaterInjectionPair = new HashMap<>();
|
|
|
- // key队伍id value累计用电
|
|
|
- Map<Long, BigDecimal> cumulativePowerConsumptionPair = new HashMap<>();
|
|
|
- // key队伍id/项目部id value对应项目部的总产能
|
|
|
- Map<Long, BigDecimal> cumulativeCapacityPair = new HashMap<>();
|
|
|
- // key队伍id/项目部id value累计运行时效 累计注气量/累计产能
|
|
|
- Map<Long, BigDecimal> cumulativeTransitTimePair = new HashMap<>();
|
|
|
-
|
|
|
// 按照日期维度统计各工作量数据
|
|
|
// key日期yyyy-MM-dd value累计注气量
|
|
|
Map<String, BigDecimal> dateGasInjectionPair = new HashMap<>();
|
|
|
@@ -868,25 +954,13 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
dateWaterInjectionPair.merge(reportDateStr, report.getDailyWaterInjection(), BigDecimal::add);
|
|
|
// 累计用电量
|
|
|
datePowerConsumptionPair.merge(reportDateStr, report.getDailyPowerUsage(), BigDecimal::add);
|
|
|
- // todo 累计油耗
|
|
|
+ // 累计油耗
|
|
|
+ dateFuelConsumptionPair.merge(reportDateStr, report.getDailyOilUsage(), BigDecimal::add);
|
|
|
// 累计产能
|
|
|
if (teamCapacityPair.containsKey(report.getDeptId())) {
|
|
|
BigDecimal tempCapacity = teamCapacityPair.get(report.getDeptId());
|
|
|
dateCapacityPair.merge(reportDateStr, tempCapacity, BigDecimal::add);
|
|
|
}
|
|
|
-
|
|
|
- if (ObjUtil.isNotEmpty(report.getDeptId())) {
|
|
|
- // 累计注气量
|
|
|
- cumulativeGasInjectionPair.merge(report.getDeptId(), report.getDailyGasInjection(), BigDecimal::add);
|
|
|
- // 累计注水量
|
|
|
- cumulativeWaterInjectionPair.merge(report.getDeptId(), report.getDailyWaterInjection(), BigDecimal::add);
|
|
|
- // 累计用电量
|
|
|
- cumulativePowerConsumptionPair.merge(report.getDeptId(), report.getDailyPowerUsage(), BigDecimal::add);
|
|
|
- if (teamCapacityPair.containsKey(report.getDeptId())) {
|
|
|
- BigDecimal tempCapacity = teamCapacityPair.get(report.getDeptId());
|
|
|
- cumulativeCapacityPair.merge(report.getDeptId(), tempCapacity, BigDecimal::add);
|
|
|
- }
|
|
|
- }
|
|
|
});
|
|
|
// 根据 累计注气量 累计产能 计算指定队伍下的平均产能
|
|
|
if (CollUtil.isNotEmpty(dateGasInjectionPair) && CollUtil.isNotEmpty(dateCapacityPair)) {
|
|
|
@@ -923,6 +997,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
statistics.setCumulativeGasInjection(dateGasInjectionPair.get(date));
|
|
|
statistics.setCumulativeWaterInjection(dateWaterInjectionPair.get(date));
|
|
|
statistics.setCumulativePowerConsumption(datePowerConsumptionPair.get(date));
|
|
|
+ statistics.setCumulativeFuelConsumption(dateFuelConsumptionPair.get(date));
|
|
|
statistics.setTransitTime(dateTransitTimePair.get(date));
|
|
|
result.add(statistics);
|
|
|
});
|