|
|
@@ -1904,16 +1904,49 @@ public class IotStaticController {
|
|
|
DeptListReqVO deptReqVO = new DeptListReqVO();
|
|
|
deptReqVO.setDeptId(reqVO.getDeptId());
|
|
|
List<DeptDO> projectTeams = deptService.getDeptListByParentId(deptReqVO);
|
|
|
+
|
|
|
// 指定项目部下的 队伍id集合
|
|
|
Set<Long> projectTeamIds = new HashSet<>();
|
|
|
if (CollUtil.isNotEmpty(projectTeams)) {
|
|
|
projectTeams.forEach(team -> {
|
|
|
projectTeamIds.add(team.getId());
|
|
|
});
|
|
|
+ // 如果是吐哈 将克拉玛依的队伍合并过来
|
|
|
+ if (160 == reqVO.getDeptId()) {
|
|
|
+ deptReqVO.setDeptId(166l);
|
|
|
+ List<DeptDO> klmyTeams = deptService.getDeptListByParentId(deptReqVO);
|
|
|
+ if (CollUtil.isNotEmpty(klmyTeams)) {
|
|
|
+ klmyTeams.forEach(team -> {
|
|
|
+ projectTeamIds.add(team.getId());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询 项目部下 包含 施工 状态设备的队伍
|
|
|
+ IotDevicePageReqVO deviceReqVO = new IotDevicePageReqVO();
|
|
|
+ deviceReqVO.setDeptIds(new ArrayList<>(projectTeamIds));
|
|
|
+ List<IotDeviceDO> allRhDevices = iotDeviceMapper.selectListAlone(deviceReqVO);
|
|
|
+ Set<Long> haveDeviceDeptIds = new HashSet<>();
|
|
|
+ if (CollUtil.isNotEmpty(allRhDevices)) {
|
|
|
+ // 筛选出包含设备的队伍部门集合
|
|
|
+ allRhDevices.forEach(device -> {
|
|
|
+ haveDeviceDeptIds.add(device.getDeptId());
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
Map<Long, DeptDO> allDeptPair = deptService.getDeptMap(projectTeamIds);
|
|
|
|
|
|
+ // 求 projectTeamIds 与 haveDeviceDeptIds 的交集
|
|
|
+ Set<Long> intersectionTeamIds = new HashSet<>();
|
|
|
+ if (CollUtil.isNotEmpty(projectTeamIds)) {
|
|
|
+ projectTeamIds.forEach(teamId -> {
|
|
|
+ if (haveDeviceDeptIds.contains(teamId)) {
|
|
|
+ intersectionTeamIds.add(teamId);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
Set<String> projectDeptNames = new HashSet<>();
|
|
|
Set<Long> projectDeptIds = new HashSet<>();
|
|
|
// key项目部id value项目部名称
|
|
|
@@ -1926,7 +1959,7 @@ public class IotStaticController {
|
|
|
Map<Long, Long> teamReportCountPair = new HashMap<>();
|
|
|
if (CollUtil.isNotEmpty(allDeptPair)) {
|
|
|
allDeptPair.forEach((deptId, dept) -> {
|
|
|
- if (dept.getName().contains("项目部") ) {
|
|
|
+ if ("2".equals(dept.getType())) {
|
|
|
projectDeptIds.add(deptId);
|
|
|
projectDeptNames.add(dept.getName());
|
|
|
projectPair.put(deptId, dept.getName());
|
|
|
@@ -1954,9 +1987,9 @@ public class IotStaticController {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- if (CollUtil.isNotEmpty(projectTeamIds)) {
|
|
|
+ if (CollUtil.isNotEmpty(intersectionTeamIds)) {
|
|
|
// 查询出指定时间区间内 指定队伍id集合 已经填写的日报数量
|
|
|
- reqVO.setDeptIds(projectTeamIds);
|
|
|
+ reqVO.setDeptIds(intersectionTeamIds);
|
|
|
// reqVO.setStatisticFlag("Y");
|
|
|
List<IotRhDailyReportDO> dailyReports = iotRhDailyReportMapper.dailyReports(reqVO);
|
|
|
// 筛选出每个队伍的日报
|
|
|
@@ -1989,8 +2022,8 @@ public class IotStaticController {
|
|
|
daysCount = 0L;
|
|
|
}
|
|
|
// 计算每个队伍的设备利用率
|
|
|
- if (CollUtil.isNotEmpty(projectTeamIds)) {
|
|
|
- projectTeamIds.forEach(teamId -> {
|
|
|
+ if (CollUtil.isNotEmpty(intersectionTeamIds)) {
|
|
|
+ intersectionTeamIds.forEach(teamId -> {
|
|
|
TeamUtilizationRateVo rateVo = new TeamUtilizationRateVo();
|
|
|
rateVo.setProjectDeptId(reqVO.getDeptId());
|
|
|
rateVo.setTeamId(teamId);
|