|  | @@ -20,6 +20,7 @@ import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDeviceRespVO;
 | 
	
		
			
				|  |  |  import cn.iocoder.yudao.module.pms.dal.dataobject.iotdailyreportattrs.IotDailyReportAttrsDO;
 | 
	
		
			
				|  |  |  import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojectinfo.IotProjectInfoDO;
 | 
	
		
			
				|  |  |  import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttask.IotProjectTaskDO;
 | 
	
		
			
				|  |  | +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.service.IotDeviceService;
 | 
	
		
			
				|  |  |  import cn.iocoder.yudao.module.pms.service.iotdailyreportattrs.IotDailyReportAttrsService;
 | 
	
	
		
			
				|  | @@ -42,6 +43,7 @@ import javax.annotation.Resource;
 | 
	
		
			
				|  |  |  import javax.servlet.http.HttpServletResponse;
 | 
	
		
			
				|  |  |  import javax.validation.Valid;
 | 
	
		
			
				|  |  |  import java.io.IOException;
 | 
	
		
			
				|  |  | +import java.math.BigDecimal;
 | 
	
		
			
				|  |  |  import java.util.*;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -203,6 +205,8 @@ public class IotRdDailyReportController {
 | 
	
		
			
				|  |  |          Map<Long, String> taskResponsiblePair = new HashMap<>();
 | 
	
		
			
				|  |  |          //  key任务id     value任务关联的填报人名称
 | 
	
		
			
				|  |  |          Map<Long, String> taskSubmitterPair = new HashMap<>();
 | 
	
		
			
				|  |  | +        //  key任务id     value工作量数据集合
 | 
	
		
			
				|  |  | +        Map<Long, List<IotTaskAttrModelProperty>> taskWorkloadPair = new HashMap<>();
 | 
	
		
			
				|  |  |          Set<Long> userIds = new HashSet<>();
 | 
	
		
			
				|  |  |          DataPermissionUtils.executeIgnore(() -> {
 | 
	
		
			
				|  |  |              // 查询日报关联的项目信息
 | 
	
	
		
			
				|  | @@ -225,6 +229,9 @@ public class IotRdDailyReportController {
 | 
	
		
			
				|  |  |                      taskPair.put(task.getId(), task.getWellName());
 | 
	
		
			
				|  |  |                      userIds.addAll(Optional.ofNullable(personIds).orElse(Collections.emptySet()));
 | 
	
		
			
				|  |  |                      userIds.addAll(Optional.ofNullable(submitterIds).orElse(Collections.emptySet()));
 | 
	
		
			
				|  |  | +                    // 获取所有任务的工作量数据
 | 
	
		
			
				|  |  | +                    List<IotTaskAttrModelProperty> extProperties = task.getExtProperty();
 | 
	
		
			
				|  |  | +                    taskWorkloadPair.put(task.getId(), extProperties);
 | 
	
		
			
				|  |  |                  });
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              // 查询所有 带班干部 填报人 的姓名
 | 
	
	
		
			
				|  | @@ -268,6 +275,83 @@ public class IotRdDailyReportController {
 | 
	
		
			
				|  |  |                      taskSubmitterPair.put(task.getId(), submitterNames);
 | 
	
		
			
				|  |  |                  });
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            // 查询所有任务的工作量数据 单位相同的工作量属性值合并处理
 | 
	
		
			
				|  |  | +            for (IotRdDailyReportDO report : reports) {
 | 
	
		
			
				|  |  | +                // 设置每个任务的工作量数据  单位相同的工作量值作合并处理
 | 
	
		
			
				|  |  | +                List<IotTaskAttrModelProperty> taskAttrs = report.getExtProperty();
 | 
	
		
			
				|  |  | +                // 这里暂时使用枚举 统计每个单位下的 工作量
 | 
	
		
			
				|  |  | +                // 桥塞(个数)      钻可溶桥塞  钻复合桥塞           bridge_plug
 | 
	
		
			
				|  |  | +                // 趟数           通刮洗 冲砂                    run_count
 | 
	
		
			
				|  |  | +                // 井数           累计施工-井                    cumulative_working_well
 | 
	
		
			
				|  |  | +                // 小时H                                       hour_count
 | 
	
		
			
				|  |  | +                // 天数D
 | 
	
		
			
				|  |  | +                // 水方量(方)                                   water_volume
 | 
	
		
			
				|  |  | +                // 台次           当日泵车台次 当日仪表/混砂        daily_tools_sand   daily_pump_trips
 | 
	
		
			
				|  |  | +                // 段数           累计施工-层                    cumulative_working_layers
 | 
	
		
			
				|  |  | +                // 暂存不同单位的工作量属性值
 | 
	
		
			
				|  |  | +                BigDecimal tempTotalBridgePlug = BigDecimal.ZERO;
 | 
	
		
			
				|  |  | +                BigDecimal tempTotalRunCount = BigDecimal.ZERO;
 | 
	
		
			
				|  |  | +                BigDecimal tempTotalCumulativeWorkingWell = BigDecimal.ZERO;
 | 
	
		
			
				|  |  | +                BigDecimal tempTotalHourCount = BigDecimal.ZERO;
 | 
	
		
			
				|  |  | +                BigDecimal tempTotalWaterVolume = BigDecimal.ZERO;
 | 
	
		
			
				|  |  | +                BigDecimal tempTotalPumpTrips = BigDecimal.ZERO;
 | 
	
		
			
				|  |  | +                BigDecimal tempTotalCumulativeWorkingLayers = BigDecimal.ZERO;
 | 
	
		
			
				|  |  | +                BigDecimal tempTotalMixSand = BigDecimal.ZERO;
 | 
	
		
			
				|  |  | +                if (CollUtil.isNotEmpty(taskAttrs)) {
 | 
	
		
			
				|  |  | +                    for (IotTaskAttrModelProperty attr : taskAttrs) {
 | 
	
		
			
				|  |  | +                        String unit = attr.getUnit();   // 工作量单位
 | 
	
		
			
				|  |  | +                        String actualValueStr = attr.getActualValue();  // 工作量属性的实际值
 | 
	
		
			
				|  |  | +                        // 处理实际值:避免null或非数字字符串导致的异常
 | 
	
		
			
				|  |  | +                        BigDecimal actualValue = BigDecimal.ZERO;
 | 
	
		
			
				|  |  | +                        if (StrUtil.isNotBlank(actualValueStr)) {  // 假设使用Hutool的StrUtil,或自行判断null/空
 | 
	
		
			
				|  |  | +                            try {
 | 
	
		
			
				|  |  | +                                actualValue = new BigDecimal(actualValueStr);
 | 
	
		
			
				|  |  | +                            } catch (NumberFormatException e) {
 | 
	
		
			
				|  |  | +                                // 若字符串格式错误,默认按0处理(可根据业务调整)
 | 
	
		
			
				|  |  | +                                actualValue = BigDecimal.ZERO;
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        if ("个数".equals(unit)) {
 | 
	
		
			
				|  |  | +                            // 钻可溶桥塞  钻复合桥塞
 | 
	
		
			
				|  |  | +                            tempTotalBridgePlug = tempTotalBridgePlug.add(actualValue);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        if ("趟数".equals(unit)) {
 | 
	
		
			
				|  |  | +                            tempTotalRunCount = tempTotalRunCount.add(actualValue);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        if ("小时".equals(unit)) {
 | 
	
		
			
				|  |  | +                            tempTotalHourCount = tempTotalHourCount.add(actualValue);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        if ("天数".equals(unit)) {
 | 
	
		
			
				|  |  | +                            // 将 actualValue 换算成 H
 | 
	
		
			
				|  |  | +                            BigDecimal hours = actualValue.multiply(new BigDecimal("24"));
 | 
	
		
			
				|  |  | +                            tempTotalHourCount = tempTotalHourCount.add(hours);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        if ("方".equals(unit)) {
 | 
	
		
			
				|  |  | +                            tempTotalWaterVolume = tempTotalWaterVolume.add(actualValue);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        if ("井数".equals(unit)) {
 | 
	
		
			
				|  |  | +                            tempTotalCumulativeWorkingWell = tempTotalCumulativeWorkingWell.add(actualValue);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        if ("段数".equals(unit)) {
 | 
	
		
			
				|  |  | +                            tempTotalCumulativeWorkingLayers = tempTotalCumulativeWorkingLayers.add(actualValue);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        if ("台次".equals(unit) && "当日泵车台次".equals(attr.getName())) {
 | 
	
		
			
				|  |  | +                            tempTotalPumpTrips = tempTotalPumpTrips.add(actualValue);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        if ("台次".equals(unit) && ("当日仪表".equals(attr.getName()) || "当日混砂".equals(attr.getName()))) {
 | 
	
		
			
				|  |  | +                            tempTotalMixSand = tempTotalMixSand.add(actualValue);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    report.setCumulativeWorkingWell(tempTotalCumulativeWorkingWell);
 | 
	
		
			
				|  |  | +                    report.setCumulativeWorkingLayers(tempTotalCumulativeWorkingLayers);
 | 
	
		
			
				|  |  | +                    report.setDailyPumpTrips(tempTotalPumpTrips);
 | 
	
		
			
				|  |  | +                    report.setDailyToolsSand(tempTotalMixSand);
 | 
	
		
			
				|  |  | +                    report.setRunCount(tempTotalRunCount);
 | 
	
		
			
				|  |  | +                    report.setBridgePlug(tempTotalBridgePlug);
 | 
	
		
			
				|  |  | +                    report.setWaterVolume(tempTotalWaterVolume);
 | 
	
		
			
				|  |  | +                    report.setHourCount(tempTotalHourCount);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |          return BeanUtils.toBean(reports, IotRdDailyReportRespVO.class, (reportVO) -> {
 | 
	
		
			
				|  |  |              // 部门信息
 |