|
@@ -25,6 +25,7 @@ import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttask.IotProjectTaskD
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttaskattrs.IotTaskAttrModelProperty;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttaskattrs.IotTaskAttrModelProperty;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotrddailyreport.IotRdDailyReportDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotrddailyreport.IotRdDailyReportDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotrhdailyreport.IotRhDailyReportDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotrhdailyreport.IotRhDailyReportDO;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.dal.mysql.iotrhdailyreport.IotRhDailyReportMapper;
|
|
|
import cn.iocoder.yudao.module.pms.service.iotdailyreportfuel.IotDailyReportFuelService;
|
|
import cn.iocoder.yudao.module.pms.service.iotdailyreportfuel.IotDailyReportFuelService;
|
|
|
import cn.iocoder.yudao.module.pms.service.iotprojectinfo.IotProjectInfoService;
|
|
import cn.iocoder.yudao.module.pms.service.iotprojectinfo.IotProjectInfoService;
|
|
|
import cn.iocoder.yudao.module.pms.service.iotprojecttask.IotProjectTaskService;
|
|
import cn.iocoder.yudao.module.pms.service.iotprojecttask.IotProjectTaskService;
|
|
@@ -49,6 +50,7 @@ import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
import java.text.DecimalFormat;
|
|
import java.text.DecimalFormat;
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
|
|
|
@@ -79,6 +81,8 @@ public class IotRhDailyReportController {
|
|
|
private IotDailyReportFuelService iotDailyReportFuelService;
|
|
private IotDailyReportFuelService iotDailyReportFuelService;
|
|
|
@Resource
|
|
@Resource
|
|
|
private DictDataService dictDataService;
|
|
private DictDataService dictDataService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private IotRhDailyReportMapper iotRhDailyReportMapper;
|
|
|
|
|
|
|
|
@PostMapping("/create")
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建瑞恒日报")
|
|
@Operation(summary = "创建瑞恒日报")
|
|
@@ -179,7 +183,7 @@ public class IotRhDailyReportController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
PageResult<IotRhDailyReportDO> pageResult = iotRhDailyReportService.getIotRhDailyReportPage(pageReqVO);
|
|
PageResult<IotRhDailyReportDO> pageResult = iotRhDailyReportService.getIotRhDailyReportPage(pageReqVO);
|
|
|
- return success(new PageResult<>(buildRhDailyReports(pageResult.getList()), pageResult.getTotal()));
|
|
|
|
|
|
|
+ return success(new PageResult<>(buildRhDailyReports(pageResult.getList(), pageReqVO), pageResult.getTotal()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/completeRate")
|
|
@GetMapping("/completeRate")
|
|
@@ -448,7 +452,7 @@ public class IotRhDailyReportController {
|
|
|
PageResult<IotRhDailyReportDO> pageResult = iotRhDailyReportService.dailyReportSummary(pageReqVO);
|
|
PageResult<IotRhDailyReportDO> pageResult = iotRhDailyReportService.dailyReportSummary(pageReqVO);
|
|
|
|
|
|
|
|
// List<IotRhDailyReportRespVO> rhDailyReports = IotRhDailyReportConvert.INSTANCE.convertList(pageResult.getList(), deptMap);
|
|
// List<IotRhDailyReportRespVO> rhDailyReports = IotRhDailyReportConvert.INSTANCE.convertList(pageResult.getList(), deptMap);
|
|
|
- return success(new PageResult<>(buildRhDailyReports(pageResult.getList()), pageResult.getTotal()));
|
|
|
|
|
|
|
+ return success(new PageResult<>(buildRhDailyReports(pageResult.getList(), pageReqVO), pageResult.getTotal()));
|
|
|
// return success(new PageResult<>(rhDailyReports, pageResult.getTotal()));
|
|
// return success(new PageResult<>(rhDailyReports, pageResult.getTotal()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -466,7 +470,7 @@ public class IotRhDailyReportController {
|
|
|
* @param reports
|
|
* @param reports
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- private List<IotRhDailyReportRespVO> buildRhDailyReports(List<IotRhDailyReportDO> reports) {
|
|
|
|
|
|
|
+ private List<IotRhDailyReportRespVO> buildRhDailyReports(List<IotRhDailyReportDO> reports, IotRhDailyReportPageReqVO pageReqVO) {
|
|
|
if (CollUtil.isEmpty(reports)) {
|
|
if (CollUtil.isEmpty(reports)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
@@ -484,6 +488,116 @@ public class IotRhDailyReportController {
|
|
|
Map<String, String> nptReasonPair = new HashMap<>();
|
|
Map<String, String> nptReasonPair = new HashMap<>();
|
|
|
// 搬迁安装天数
|
|
// 搬迁安装天数
|
|
|
Map<Long, BigDecimal> relocationDaysPair = new HashMap<>();
|
|
Map<Long, BigDecimal> relocationDaysPair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // key队伍id value 队伍当年累计注气量
|
|
|
|
|
+ Map<Long, BigDecimal> yearGasInjectionPair = new HashMap<>();
|
|
|
|
|
+ // key队伍id value 队伍当年累计注水量
|
|
|
|
|
+ Map<Long, BigDecimal> yearWaterInjectionPair = new HashMap<>();
|
|
|
|
|
+ // key队伍id value 队伍当年累计用电量
|
|
|
|
|
+ Map<Long, BigDecimal> yearPowerPair = new HashMap<>();
|
|
|
|
|
+ // key队伍id value 队伍当年累计油耗
|
|
|
|
|
+ Map<Long, BigDecimal> yearFuelPair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // key任务井id value 井累计注气量
|
|
|
|
|
+ Map<Long, BigDecimal> wellGasInjectionPair = new HashMap<>();
|
|
|
|
|
+ // key任务井id value 井累计注水量
|
|
|
|
|
+ Map<Long, BigDecimal> wellWaterInjectionPair = new HashMap<>();
|
|
|
|
|
+ // key任务井id value 井累计用电量
|
|
|
|
|
+ Map<Long, BigDecimal> wellPowerPair = new HashMap<>();
|
|
|
|
|
+ // key任务井id value 井累计油耗
|
|
|
|
|
+ Map<Long, BigDecimal> wellFuelPair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // 查询所有井日报数据
|
|
|
|
|
+ IotRhDailyReportPageReqVO currentTaskReqVO = new IotRhDailyReportPageReqVO();
|
|
|
|
|
+ currentTaskReqVO.setTaskIds(convertList(reports, IotRhDailyReportDO::getTaskId));
|
|
|
|
|
+ List<IotRhDailyReportDO> taskDailyReports = iotRhDailyReportMapper.dailyReports(currentTaskReqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(taskDailyReports)) {
|
|
|
|
|
+ taskDailyReports.forEach(report -> {
|
|
|
|
|
+ // 注气量
|
|
|
|
|
+ if (wellGasInjectionPair.containsKey(report.getTaskId())) {
|
|
|
|
|
+ BigDecimal tempGasInjection = wellGasInjectionPair.get(report.getTaskId());
|
|
|
|
|
+ BigDecimal tempResult = tempGasInjection.add(report.getDailyGasInjection());
|
|
|
|
|
+ wellGasInjectionPair.put(report.getTaskId(), tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wellGasInjectionPair.put(report.getTaskId(), report.getDailyGasInjection());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 注水量
|
|
|
|
|
+ if (wellWaterInjectionPair.containsKey(report.getTaskId())) {
|
|
|
|
|
+ BigDecimal tempWaterInjection = wellWaterInjectionPair.get(report.getTaskId());
|
|
|
|
|
+ BigDecimal tempResult = tempWaterInjection.add(report.getDailyWaterInjection());
|
|
|
|
|
+ wellWaterInjectionPair.put(report.getTaskId(), tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wellWaterInjectionPair.put(report.getTaskId(), report.getDailyWaterInjection());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 电量
|
|
|
|
|
+ if (wellPowerPair.containsKey(report.getTaskId())) {
|
|
|
|
|
+ BigDecimal tempPower = wellPowerPair.get(report.getTaskId());
|
|
|
|
|
+ BigDecimal tempResult = tempPower.add(report.getDailyPowerUsage());
|
|
|
|
|
+ wellPowerPair.put(report.getTaskId(), tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wellPowerPair.put(report.getTaskId(), report.getDailyPowerUsage());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 油耗
|
|
|
|
|
+ if (wellFuelPair.containsKey(report.getTaskId())) {
|
|
|
|
|
+ BigDecimal tempFuel = wellFuelPair.get(report.getTaskId());
|
|
|
|
|
+ BigDecimal tempResult = tempFuel.add(report.getDailyOilUsage());
|
|
|
|
|
+ wellFuelPair.put(report.getTaskId(), tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wellFuelPair.put(report.getTaskId(), report.getDailyOilUsage());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 根据传递的时间筛选获取要查询的 yyyy
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(pageReqVO.getCreateTime())) {
|
|
|
|
|
+ // 只有传递了 时间查询条件 才会查询 当年累计的工作量数据
|
|
|
|
|
+ LocalDateTime[] createTimeAttr = pageReqVO.getCreateTime();
|
|
|
|
|
+ if (createTimeAttr.length > 0) {
|
|
|
|
|
+ LocalDateTime startTime = createTimeAttr[0];
|
|
|
|
|
+ String year = String.valueOf(startTime.getYear());
|
|
|
|
|
+ IotRhDailyReportPageReqVO reqVO = new IotRhDailyReportPageReqVO();
|
|
|
|
|
+ reqVO.setYear(year);
|
|
|
|
|
+ reqVO.setDeptIds(convertList(reports, IotRhDailyReportDO::getDeptId));
|
|
|
|
|
+ List<IotRhDailyReportDO> dailyReports = iotRhDailyReportMapper.dailyReports(reqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(dailyReports)) {
|
|
|
|
|
+ dailyReports.forEach(report -> {
|
|
|
|
|
+ // 注气量
|
|
|
|
|
+ if (yearGasInjectionPair.containsKey(report.getDeptId())) {
|
|
|
|
|
+ BigDecimal tempGasInjection = yearGasInjectionPair.get(report.getDeptId());
|
|
|
|
|
+ BigDecimal tempResult = tempGasInjection.add(report.getDailyGasInjection());
|
|
|
|
|
+ yearGasInjectionPair.put(report.getDeptId(), tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ yearGasInjectionPair.put(report.getDeptId(), report.getDailyGasInjection());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 注水量
|
|
|
|
|
+ if (yearWaterInjectionPair.containsKey(report.getDeptId())) {
|
|
|
|
|
+ BigDecimal tempWaterInjection = yearWaterInjectionPair.get(report.getDeptId());
|
|
|
|
|
+ BigDecimal tempResult = tempWaterInjection.add(report.getDailyWaterInjection());
|
|
|
|
|
+ yearWaterInjectionPair.put(report.getDeptId(), tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ yearWaterInjectionPair.put(report.getDeptId(), report.getDailyWaterInjection());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 电量
|
|
|
|
|
+ if (yearPowerPair.containsKey(report.getDeptId())) {
|
|
|
|
|
+ BigDecimal tempPower = yearPowerPair.get(report.getDeptId());
|
|
|
|
|
+ BigDecimal tempResult = tempPower.add(report.getDailyPowerUsage());
|
|
|
|
|
+ yearPowerPair.put(report.getDeptId(), tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ yearPowerPair.put(report.getDeptId(), report.getDailyPowerUsage());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 油耗
|
|
|
|
|
+ if (yearFuelPair.containsKey(report.getDeptId())) {
|
|
|
|
|
+ BigDecimal tempFuel = yearFuelPair.get(report.getDeptId());
|
|
|
|
|
+ BigDecimal tempResult = tempFuel.add(report.getDailyOilUsage());
|
|
|
|
|
+ yearFuelPair.put(report.getDeptId(), tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ yearFuelPair.put(report.getDeptId(), report.getDailyOilUsage());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// key部门id value产能
|
|
// key部门id value产能
|
|
|
AtomicReference<Map<Long, BigDecimal>> capacityPair = new AtomicReference<>(new HashMap<>());
|
|
AtomicReference<Map<Long, BigDecimal>> capacityPair = new AtomicReference<>(new HashMap<>());
|
|
|
// 施工状态 字典数据
|
|
// 施工状态 字典数据
|
|
@@ -555,6 +669,22 @@ public class IotRhDailyReportController {
|
|
|
}
|
|
}
|
|
|
// 2.1 拼接部门信息
|
|
// 2.1 拼接部门信息
|
|
|
findAndThen(deptMap, reportVO.getDeptId(), dept -> reportVO.setDeptName(dept.getName()));
|
|
findAndThen(deptMap, reportVO.getDeptId(), dept -> reportVO.setDeptName(dept.getName()));
|
|
|
|
|
+ // 队伍当年累计注气量
|
|
|
|
|
+ findAndThen(yearGasInjectionPair, reportVO.getDeptId(), gasInjection -> reportVO.setYearTotalGasInjection(gasInjection));
|
|
|
|
|
+ // 队伍当年累计注水量
|
|
|
|
|
+ findAndThen(yearWaterInjectionPair, reportVO.getDeptId(), waterInjection -> reportVO.setYearTotalWaterInjection(waterInjection));
|
|
|
|
|
+ // 队伍当年累计用电量
|
|
|
|
|
+ findAndThen(yearPowerPair, reportVO.getDeptId(), power -> reportVO.setYearTotalPower(power));
|
|
|
|
|
+ // 队伍当年累计油耗
|
|
|
|
|
+ findAndThen(yearFuelPair, reportVO.getDeptId(), fuel -> reportVO.setYearTotalFuel(fuel));
|
|
|
|
|
+ // 井当年累计注气量
|
|
|
|
|
+ findAndThen(wellGasInjectionPair, reportVO.getTaskId(), gasInjection -> reportVO.setWellTotalGasInjection(gasInjection));
|
|
|
|
|
+ // 井当年累计注水量
|
|
|
|
|
+ findAndThen(wellWaterInjectionPair, reportVO.getTaskId(), waterInjection -> reportVO.setWellTotalWaterInjection(waterInjection));
|
|
|
|
|
+ // 井当年累计用电量
|
|
|
|
|
+ findAndThen(wellPowerPair, reportVO.getTaskId(), power -> reportVO.setWellTotalPower(power));
|
|
|
|
|
+ // 井当年累计油耗
|
|
|
|
|
+ findAndThen(wellFuelPair, reportVO.getTaskId(), fuel -> reportVO.setWellTotalFuel(fuel));
|
|
|
// 2.2 日报关联的项目信息
|
|
// 2.2 日报关联的项目信息
|
|
|
findAndThen(projectPair, reportVO.getProjectId(), contractName -> reportVO.setContractName(contractName));
|
|
findAndThen(projectPair, reportVO.getProjectId(), contractName -> reportVO.setContractName(contractName));
|
|
|
// 2.3 日报关联的任务信息
|
|
// 2.3 日报关联的任务信息
|
|
@@ -607,7 +737,7 @@ public class IotRhDailyReportController {
|
|
|
List<IotRhDailyReportDO> list = iotRhDailyReportService.getIotRhDailyReportPage(pageReqVO).getList();
|
|
List<IotRhDailyReportDO> list = iotRhDailyReportService.getIotRhDailyReportPage(pageReqVO).getList();
|
|
|
// 导出 Excel
|
|
// 导出 Excel
|
|
|
ExcelUtils.write(response, "瑞恒日报.xls", "数据", IotRhDailyReportRespVO.class,
|
|
ExcelUtils.write(response, "瑞恒日报.xls", "数据", IotRhDailyReportRespVO.class,
|
|
|
- buildRhDailyReports(list));
|
|
|
|
|
|
|
+ buildRhDailyReports(list, pageReqVO));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/exportStatistics")
|
|
@GetMapping("/exportStatistics")
|