|
|
@@ -9,7 +9,6 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.Pms;
|
|
|
-import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|
|
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.depttype.vo.IotDeptTypePageReqVO;
|
|
|
@@ -176,14 +175,14 @@ public class IotStaticController {
|
|
|
|
|
|
@GetMapping("/main/day")
|
|
|
public CommonResult<Map<String, Object>> getMaintainDay() {
|
|
|
- ImmutableMap<String, LocalDateTime> beginEndDay = DateUtils.getBeginEndDay(1);
|
|
|
+ ImmutableMap<String, LocalDateTime> beginEndDay = getBeginEndDay(1);
|
|
|
IotFailureReportPageReqVO iotFailureReportPageReqVO = new IotFailureReportPageReqVO();
|
|
|
iotFailureReportPageReqVO.setCreateTime(new LocalDateTime[]{beginEndDay.get("start"), beginEndDay.get("end")});
|
|
|
Long failure = iotFailureReportMapper.selectCountByTimeAndStatus(iotFailureReportPageReqVO);
|
|
|
IotMaintainPageReqVO iotMaintainPageReqVO = new IotMaintainPageReqVO();
|
|
|
iotMaintainPageReqVO.setCreateTime(new LocalDateTime[]{beginEndDay.get("start"), beginEndDay.get("end")});
|
|
|
Long maintain = iotMaintainMapper.selectCountByTimeAndStatus(iotMaintainPageReqVO);
|
|
|
- return CommonResult.success(ImmutableMap.of("failureDay", failure, "maintainDay", maintain));
|
|
|
+ return success(ImmutableMap.of("failureDay", failure, "maintainDay", maintain));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/notice")
|
|
|
@@ -198,33 +197,33 @@ public class IotStaticController {
|
|
|
|
|
|
@GetMapping("/main/week")
|
|
|
public CommonResult<Map<String, Object>> getMaintainWeek() {
|
|
|
- ImmutableMap<String, LocalDateTime> beginEndWeek = DateUtils.getBeginEndWeek();
|
|
|
+ ImmutableMap<String, LocalDateTime> beginEndWeek = getBeginEndWeek();
|
|
|
IotFailureReportPageReqVO iotFailureReportPageReqVO = new IotFailureReportPageReqVO();
|
|
|
iotFailureReportPageReqVO.setCreateTime(new LocalDateTime[]{beginEndWeek.get("start"), beginEndWeek.get("end")});
|
|
|
Long failure = iotFailureReportMapper.selectCountByTimeAndStatus(iotFailureReportPageReqVO);
|
|
|
IotMaintainPageReqVO iotMaintainPageReqVO = new IotMaintainPageReqVO();
|
|
|
iotMaintainPageReqVO.setCreateTime(new LocalDateTime[]{beginEndWeek.get("start"), beginEndWeek.get("end")});
|
|
|
Long maintain = iotMaintainMapper.selectCountByTimeAndStatus(iotMaintainPageReqVO);
|
|
|
- return CommonResult.success(ImmutableMap.of("failureWeek", failure, "maintainWeek", maintain));
|
|
|
+ return success(ImmutableMap.of("failureWeek", failure, "maintainWeek", maintain));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/main/month")
|
|
|
public CommonResult<Map<String, Object>> getMaintainMonth() {
|
|
|
- ImmutableMap<String, LocalDateTime> beginEndMonth = DateUtils.getBeginEndMonth();
|
|
|
+ ImmutableMap<String, LocalDateTime> beginEndMonth = getBeginEndMonth();
|
|
|
IotFailureReportPageReqVO iotFailureReportPageReqVO = new IotFailureReportPageReqVO();
|
|
|
iotFailureReportPageReqVO.setCreateTime(new LocalDateTime[]{beginEndMonth.get("start"), beginEndMonth.get("end")});
|
|
|
Long failure = iotFailureReportMapper.selectCountByTimeAndStatus(iotFailureReportPageReqVO);
|
|
|
IotMaintainPageReqVO iotMaintainPageReqVO = new IotMaintainPageReqVO();
|
|
|
iotMaintainPageReqVO.setCreateTime(new LocalDateTime[]{beginEndMonth.get("start"), beginEndMonth.get("end")});
|
|
|
Long maintain = iotMaintainMapper.selectCountByTimeAndStatus(iotMaintainPageReqVO);
|
|
|
- return CommonResult.success(ImmutableMap.of("failureMonth", failure, "maintainMonth", maintain));
|
|
|
+ return success(ImmutableMap.of("failureMonth", failure, "maintainMonth", maintain));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/main/total")
|
|
|
public CommonResult<Map<String, Object>> getMaintainTotal() {
|
|
|
Long failure = iotFailureReportMapper.selectCount();
|
|
|
Long maintain = iotMaintainMapper.selectCount();
|
|
|
- return CommonResult.success(ImmutableMap.of("failureTotal", failure, "maintainTotal", maintain));
|
|
|
+ return success(ImmutableMap.of("failureTotal", failure, "maintainTotal", maintain));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/main/status")
|
|
|
@@ -233,13 +232,13 @@ public class IotStaticController {
|
|
|
Map<String, Long> failure = iotFailureReportDOS.stream().collect(Collectors.groupingBy(IotFailureReportDO::getStatus, Collectors.counting()));
|
|
|
List<IotMaintainDO> iotMaintainDOS = iotMaintainMapper.selectList();
|
|
|
Map<String, Long> maintain = iotMaintainDOS.stream().collect(Collectors.groupingBy(IotMaintainDO::getStatus, Collectors.counting()));
|
|
|
- return CommonResult.success(ImmutableMap.of("failureStatus", failure, "maintainStatus", maintain));
|
|
|
+ return success(ImmutableMap.of("failureStatus", failure, "maintainStatus", maintain));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/main/year")
|
|
|
- public CommonResult<List<DateUtils.MonthRange>> getMaintainYear() {
|
|
|
- List<DateUtils.MonthRange> lastYearMonths = getLastYearMonthRanges();
|
|
|
- List<DateUtils.MonthRange> collect = lastYearMonths.stream().map(e -> {
|
|
|
+ public CommonResult<List<MonthRange>> getMaintainYear() {
|
|
|
+ List<MonthRange> lastYearMonths = getLastYearMonthRanges();
|
|
|
+ List<MonthRange> collect = lastYearMonths.stream().map(e -> {
|
|
|
IotFailureReportPageReqVO iotFailureReportPageReqVO = new IotFailureReportPageReqVO();
|
|
|
iotFailureReportPageReqVO.setCreateTime(new LocalDateTime[]{e.getStart(), e.getEnd()});
|
|
|
Long l = iotFailureReportMapper.selectCountByTimeAndStatus(iotFailureReportPageReqVO);
|
|
|
@@ -247,43 +246,43 @@ public class IotStaticController {
|
|
|
return e;
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
- return CommonResult.success(collect);
|
|
|
+ return success(collect);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/inspect/day")
|
|
|
public CommonResult<Map<String, Object>> getInspectDay() {
|
|
|
- ImmutableMap<String, LocalDateTime> beginEndDay = DateUtils.getBeginEndDay(1);
|
|
|
+ ImmutableMap<String, LocalDateTime> beginEndDay = getBeginEndDay(1);
|
|
|
IotInspectOrderPageReqVO iotInspectOrderPageReqVO = new IotInspectOrderPageReqVO();
|
|
|
iotInspectOrderPageReqVO.setCreateTime(new LocalDateTime[]{beginEndDay.get("start"), beginEndDay.get("end")});
|
|
|
Long inspectDayTotal = iotInspectOrderMapper.selectCountByTimeAndStatus(iotInspectOrderPageReqVO);
|
|
|
iotInspectOrderPageReqVO.setStatus("todo");
|
|
|
Long inspectDayTodo = iotInspectOrderMapper.selectCountByTimeAndStatus(iotInspectOrderPageReqVO);
|
|
|
|
|
|
- return CommonResult.success(ImmutableMap.of("total", inspectDayTotal,"todo", inspectDayTodo));
|
|
|
+ return success(ImmutableMap.of("total", inspectDayTotal,"todo", inspectDayTodo));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/inspect/week")
|
|
|
public CommonResult<Map<String, Object>> getInspectWeek() {
|
|
|
IotInspectOrderPageReqVO iotInspectOrderPageReqVO = new IotInspectOrderPageReqVO();
|
|
|
- ImmutableMap<String, LocalDateTime> beginEndWeek = DateUtils.getBeginEndWeek();
|
|
|
+ ImmutableMap<String, LocalDateTime> beginEndWeek = getBeginEndWeek();
|
|
|
iotInspectOrderPageReqVO.setCreateTime(new LocalDateTime[]{beginEndWeek.get("start"), beginEndWeek.get("end")});
|
|
|
Long inspectWeekTotal = iotInspectOrderMapper.selectCountByTimeAndStatus(iotInspectOrderPageReqVO);
|
|
|
iotInspectOrderPageReqVO.setStatus("todo");
|
|
|
Long inspectWeekTodo = iotInspectOrderMapper.selectCountByTimeAndStatus(iotInspectOrderPageReqVO);
|
|
|
|
|
|
- return CommonResult.success(ImmutableMap.of("total", inspectWeekTotal,"todo", inspectWeekTodo));
|
|
|
+ return success(ImmutableMap.of("total", inspectWeekTotal,"todo", inspectWeekTodo));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/inspect/month")
|
|
|
public CommonResult<Map<String, Object>> getInspectMonth() {
|
|
|
IotInspectOrderPageReqVO iotInspectOrderPageReqVO = new IotInspectOrderPageReqVO();
|
|
|
- ImmutableMap<String, LocalDateTime> beginEndMonth = DateUtils.getBeginEndMonth();
|
|
|
+ ImmutableMap<String, LocalDateTime> beginEndMonth = getBeginEndMonth();
|
|
|
iotInspectOrderPageReqVO.setCreateTime(new LocalDateTime[]{beginEndMonth.get("start"), beginEndMonth.get("end")});
|
|
|
Long inspectWeekTotal = iotInspectOrderMapper.selectCountByTimeAndStatus(iotInspectOrderPageReqVO);
|
|
|
iotInspectOrderPageReqVO.setStatus("todo");
|
|
|
Long inspectWeekTodo = iotInspectOrderMapper.selectCountByTimeAndStatus(iotInspectOrderPageReqVO);
|
|
|
|
|
|
- return CommonResult.success(ImmutableMap.of("total", inspectWeekTotal,"todo", inspectWeekTodo));
|
|
|
+ return success(ImmutableMap.of("total", inspectWeekTotal,"todo", inspectWeekTodo));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/inspect/total")
|
|
|
@@ -291,7 +290,7 @@ public class IotStaticController {
|
|
|
Long total = iotInspectOrderMapper.selectCount();
|
|
|
Long todo = iotInspectOrderMapper.selectCount("status", "todo");
|
|
|
|
|
|
- return CommonResult.success(ImmutableMap.of("total", total,"todo", todo));
|
|
|
+ return success(ImmutableMap.of("total", total,"todo", todo));
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -304,7 +303,7 @@ public class IotStaticController {
|
|
|
}
|
|
|
List<IotInspectOrderDO> iotInspectOrderDOS = iotInspectOrderMapper.selectListStat(vo, ids);
|
|
|
Map<String, Long> order = iotInspectOrderDOS.stream().collect(Collectors.groupingBy(IotInspectOrderDO::getStatus, Collectors.counting()));
|
|
|
- return CommonResult.success(order);
|
|
|
+ return success(order);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/report/inspect/status")
|
|
|
@@ -322,7 +321,7 @@ public class IotStaticController {
|
|
|
Long finished = iotInspectOrderMapper.selectCount(vo, ids,"finished");
|
|
|
Long ignore = iotInspectOrderMapper.selectCount(vo, ids,"ignore");
|
|
|
// Map<String, Long> order = iotInspectOrderDOS.stream().collect(Collectors.groupingBy(IotInspectOrderDO::getStatus, Collectors.counting()));
|
|
|
- return CommonResult.success(ImmutableMap.of("todo",todo,"finished",finished,"ignore",ignore));
|
|
|
+ return success(ImmutableMap.of("todo",todo,"finished",finished,"ignore",ignore));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/inspect/statuss/{dept}")
|
|
|
@@ -331,23 +330,23 @@ public class IotStaticController {
|
|
|
IotCountDataDO vo = new IotCountDataDO();
|
|
|
List<IotInspectOrderDO> iotInspectOrderDOS = iotInspectOrderMapper.selectListStat(vo, ids);
|
|
|
Map<String, Long> order = iotInspectOrderDOS.stream().collect(Collectors.groupingBy(IotInspectOrderDO::getStatus, Collectors.counting()));
|
|
|
- return CommonResult.success(order);
|
|
|
+ return success(order);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/inspect/today/status")
|
|
|
public CommonResult<Map<String, Long>> getInspectTodayStatusInfo() {
|
|
|
- ImmutableMap<String, LocalDateTime> beginEndDay = DateUtils.getBeginEndDay(0);
|
|
|
+ ImmutableMap<String, LocalDateTime> beginEndDay = getBeginEndDay(0);
|
|
|
IotInspectOrderPageReqVO iotInspectOrderPageReqVO = new IotInspectOrderPageReqVO();
|
|
|
iotInspectOrderPageReqVO.setCreateTime(new LocalDateTime[]{beginEndDay.get("start"), beginEndDay.get("end")});
|
|
|
List<IotInspectOrderDO> iotInspectOrderDOS = iotInspectOrderMapper.selectListByCreateTime(iotInspectOrderPageReqVO, new HashSet<>());
|
|
|
Map<String, Long> order = iotInspectOrderDOS.stream().collect(Collectors.groupingBy(IotInspectOrderDO::getStatus, Collectors.counting()));
|
|
|
- return CommonResult.success(order);
|
|
|
+ return success(order);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/inspect/year")
|
|
|
- public CommonResult<List<DateUtils.MonthRange>> getInspectYear() {
|
|
|
- List<DateUtils.MonthRange> lastYearMonths = getLastYearMonthRanges();
|
|
|
- List<DateUtils.MonthRange> collect = lastYearMonths.stream().map(e -> {
|
|
|
+ public CommonResult<List<MonthRange>> getInspectYear() {
|
|
|
+ List<MonthRange> lastYearMonths = getLastYearMonthRanges();
|
|
|
+ List<MonthRange> collect = lastYearMonths.stream().map(e -> {
|
|
|
IotInspectOrderPageReqVO iotInspectOrderPageReqVO = new IotInspectOrderPageReqVO();
|
|
|
iotInspectOrderPageReqVO.setCreateTime(new LocalDateTime[]{e.getStart(), e.getEnd()});
|
|
|
Long l = iotInspectOrderMapper.selectCountByTimeAndStatus(iotInspectOrderPageReqVO);
|
|
|
@@ -355,44 +354,44 @@ public class IotStaticController {
|
|
|
return e;
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
- return CommonResult.success(collect);
|
|
|
+ return success(collect);
|
|
|
}
|
|
|
|
|
|
|
|
|
@GetMapping("/maintenance/day")
|
|
|
public CommonResult<Map<String, Object>> getMaintenanceDay() {
|
|
|
- ImmutableMap<String, LocalDateTime> beginEndDay = DateUtils.getBeginEndDay(1);
|
|
|
+ ImmutableMap<String, LocalDateTime> beginEndDay = getBeginEndDay(1);
|
|
|
IotMainWorkOrderPageReqVO iotMainWorkOrderPageReqVO = new IotMainWorkOrderPageReqVO();
|
|
|
iotMainWorkOrderPageReqVO.setCreateTime(new LocalDateTime[]{beginEndDay.get("start"), beginEndDay.get("end")});
|
|
|
Long inspectDayTotal = iotMainWorkOrderMapper.selectCountByTimeAndStatus(iotMainWorkOrderPageReqVO);
|
|
|
iotMainWorkOrderPageReqVO.setResult(1);
|
|
|
Long inspectDayTodo = iotMainWorkOrderMapper.selectCountByTimeAndStatus(iotMainWorkOrderPageReqVO);
|
|
|
|
|
|
- return CommonResult.success(ImmutableMap.of("total", inspectDayTotal,"todo", inspectDayTodo));
|
|
|
+ return success(ImmutableMap.of("total", inspectDayTotal,"todo", inspectDayTodo));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/maintenance/week")
|
|
|
public CommonResult<Map<String, Object>> getMaintenanceWeek() {
|
|
|
IotMainWorkOrderPageReqVO iotMainWorkOrderPageReqVO = new IotMainWorkOrderPageReqVO();
|
|
|
- ImmutableMap<String, LocalDateTime> beginEndWeek = DateUtils.getBeginEndWeek();
|
|
|
+ ImmutableMap<String, LocalDateTime> beginEndWeek = getBeginEndWeek();
|
|
|
iotMainWorkOrderPageReqVO.setCreateTime(new LocalDateTime[]{beginEndWeek.get("start"), beginEndWeek.get("end")});
|
|
|
Long inspectWeekTotal = iotMainWorkOrderMapper.selectCountByTimeAndStatus(iotMainWorkOrderPageReqVO);
|
|
|
iotMainWorkOrderPageReqVO.setResult(1);
|
|
|
Long inspectWeekTodo = iotMainWorkOrderMapper.selectCountByTimeAndStatus(iotMainWorkOrderPageReqVO);
|
|
|
|
|
|
- return CommonResult.success(ImmutableMap.of("total", inspectWeekTotal,"todo", inspectWeekTodo));
|
|
|
+ return success(ImmutableMap.of("total", inspectWeekTotal,"todo", inspectWeekTodo));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/maintenance/month")
|
|
|
public CommonResult<Map<String, Object>> getMaintenanceMonth() {
|
|
|
IotMainWorkOrderPageReqVO iotMainWorkOrderPageReqVO = new IotMainWorkOrderPageReqVO();
|
|
|
- ImmutableMap<String, LocalDateTime> beginEndMonth = DateUtils.getBeginEndMonth();
|
|
|
+ ImmutableMap<String, LocalDateTime> beginEndMonth = getBeginEndMonth();
|
|
|
iotMainWorkOrderPageReqVO.setCreateTime(new LocalDateTime[]{beginEndMonth.get("start"), beginEndMonth.get("end")});
|
|
|
Long inspectWeekTotal = iotMainWorkOrderMapper.selectCountByTimeAndStatus(iotMainWorkOrderPageReqVO);
|
|
|
iotMainWorkOrderPageReqVO.setResult(1);
|
|
|
Long inspectWeekTodo = iotMainWorkOrderMapper.selectCountByTimeAndStatus(iotMainWorkOrderPageReqVO);
|
|
|
|
|
|
- return CommonResult.success(ImmutableMap.of("total", inspectWeekTotal,"todo", inspectWeekTodo));
|
|
|
+ return success(ImmutableMap.of("total", inspectWeekTotal,"todo", inspectWeekTodo));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/maintenance/total")
|
|
|
@@ -400,7 +399,7 @@ public class IotStaticController {
|
|
|
Long total = iotMainWorkOrderMapper.selectCount();
|
|
|
Long todo = iotMainWorkOrderMapper.selectCount("result", 1);
|
|
|
|
|
|
- return CommonResult.success(ImmutableMap.of("total", total,"todo", todo));
|
|
|
+ return success(ImmutableMap.of("total", total,"todo", todo));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/maintenance/status/{dept}")
|
|
|
@@ -418,12 +417,12 @@ public class IotStaticController {
|
|
|
resultMap.put("finished", v);
|
|
|
}
|
|
|
});
|
|
|
- return CommonResult.success(resultMap);
|
|
|
+ return success(resultMap);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/maintenance/today/status")
|
|
|
public CommonResult<Map<String, Long>> getMaintenanceTodayStatusInfo() {
|
|
|
- ImmutableMap<String, LocalDateTime> beginEndDay = DateUtils.getBeginEndDay(0);
|
|
|
+ ImmutableMap<String, LocalDateTime> beginEndDay = getBeginEndDay(0);
|
|
|
IotMainWorkOrderPageReqVO iotMainWorkOrderPageReqVO = new IotMainWorkOrderPageReqVO();
|
|
|
iotMainWorkOrderPageReqVO.setCreateTime(new LocalDateTime[]{beginEndDay.get("start"), beginEndDay.get("end")});
|
|
|
List<IotMainWorkOrderDO> iotInspectOrderDOS = iotMainWorkOrderMapper.selectListByCreateTime(iotMainWorkOrderPageReqVO, new HashSet<>());
|
|
|
@@ -436,7 +435,7 @@ public class IotStaticController {
|
|
|
resultMap.put("finished", v);
|
|
|
}
|
|
|
});
|
|
|
- return CommonResult.success(resultMap);
|
|
|
+ return success(resultMap);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/maintenance/type")
|
|
|
@@ -451,7 +450,7 @@ public class IotStaticController {
|
|
|
resultMap.put("临时新建", v);
|
|
|
}
|
|
|
});
|
|
|
- return CommonResult.success(resultMap);
|
|
|
+ return success(resultMap);
|
|
|
}
|
|
|
|
|
|
@Resource
|
|
|
@@ -470,10 +469,10 @@ public class IotStaticController {
|
|
|
deviceVO.setTimestamp(deviceVO.getTs().getTime());
|
|
|
deviceVO.setValue(Objects.nonNull(deviceVO.getLogValue())?Double.valueOf(deviceVO.getLogValue()):null);
|
|
|
});
|
|
|
- return CommonResult.success(deviceVOS.stream().sorted(Comparator.comparing(DeviceVO::getTimestamp).reversed()).collect(Collectors.toList()));
|
|
|
+ return success(deviceVOS.stream().sorted(Comparator.comparing(DeviceVO::getTimestamp).reversed()).collect(Collectors.toList()));
|
|
|
} else {
|
|
|
List<DeviceVO> deviceVOS = new ArrayList<>();
|
|
|
- return CommonResult.success(deviceVOS);
|
|
|
+ return success(deviceVOS);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -507,11 +506,11 @@ public class IotStaticController {
|
|
|
public CommonResult<ImmutableMap<Object, Object>> getHomeDeviceCountStat(@PathVariable("dept") String dept) {
|
|
|
Set<Long> ids = getDeptIds(dept);
|
|
|
Long deviceCount = iotDeviceMapper.selectByDept(ids);
|
|
|
- ImmutableMap<String, LocalDateTime> beginEndDay = DateUtils.getBeginEndDay(0);
|
|
|
+ ImmutableMap<String, LocalDateTime> beginEndDay = getBeginEndDay(0);
|
|
|
IotDevicePageReqVO iotDevicePageReqVO = new IotDevicePageReqVO();
|
|
|
iotDevicePageReqVO.setCreateTime(new LocalDateTime[]{beginEndDay.get("start"), beginEndDay.get("end")});
|
|
|
Long deviceToday = iotDeviceMapper.selectCountByTimeAndStatus(iotDevicePageReqVO);
|
|
|
- return CommonResult.success(ImmutableMap.of("total", deviceCount,"today", deviceToday));
|
|
|
+ return success(ImmutableMap.of("total", deviceCount,"today", deviceToday));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -546,39 +545,39 @@ public class IotStaticController {
|
|
|
// 累加求和(空集合时sum()返回0,无需手动判空)
|
|
|
.sum();
|
|
|
|
|
|
- return CommonResult.success(ImmutableMap.of("zj", totalFootage,"xj", completeWellCount));
|
|
|
+ return success(ImmutableMap.of("zj", totalFootage,"xj", completeWellCount));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/home/maintain/count/{dept}")
|
|
|
public CommonResult<ImmutableMap<Object, Object>> getHomeMaintainCountStat(@PathVariable("dept") String dept) {
|
|
|
- ImmutableMap<String, LocalDateTime> beginEndDay = DateUtils.getBeginEndDay(0);
|
|
|
+ ImmutableMap<String, LocalDateTime> beginEndDay = getBeginEndDay(0);
|
|
|
Set<Long> ids = getDeptIds(dept);
|
|
|
|
|
|
Long maintainCount = iotMaintainMapper.selectByDept(ids);
|
|
|
IotMaintainPageReqVO iotMaintainPageReqVO = new IotMaintainPageReqVO();
|
|
|
iotMaintainPageReqVO.setCreateTime(new LocalDateTime[]{beginEndDay.get("start"), beginEndDay.get("end")});
|
|
|
Long maintainToday = iotMaintainMapper.selectCountByTimeAndStatus(iotMaintainPageReqVO);
|
|
|
- return CommonResult.success(ImmutableMap.of("total", maintainCount, "today", maintainToday));
|
|
|
+ return success(ImmutableMap.of("total", maintainCount, "today", maintainToday));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/home/work/count")
|
|
|
public CommonResult<ImmutableMap<Object, Object>> getHomeWorkCountStat() {
|
|
|
- ImmutableMap<String, LocalDateTime> beginEndDay = DateUtils.getBeginEndDay(0);
|
|
|
+ ImmutableMap<String, LocalDateTime> beginEndDay = getBeginEndDay(0);
|
|
|
Long workCount = iotMainWorkOrderMapper.selectCount();
|
|
|
IotMainWorkOrderPageReqVO iotMainWorkOrderPageReqVO = new IotMainWorkOrderPageReqVO();
|
|
|
iotMainWorkOrderPageReqVO.setCreateTime(new LocalDateTime[]{beginEndDay.get("start"), beginEndDay.get("end")});
|
|
|
Long workToday = iotMainWorkOrderMapper.selectCountByTimeAndStatus(iotMainWorkOrderPageReqVO);
|
|
|
- return CommonResult.success(ImmutableMap.of("total", workCount, "today", workToday));
|
|
|
+ return success(ImmutableMap.of("total", workCount, "today", workToday));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/home/inspect/count")
|
|
|
public CommonResult<ImmutableMap<Object, Object>> getHomeInspectCountStat() {
|
|
|
- ImmutableMap<String, LocalDateTime> beginEndDay = DateUtils.getBeginEndDay(0);
|
|
|
+ ImmutableMap<String, LocalDateTime> beginEndDay = getBeginEndDay(0);
|
|
|
Long inspectCount = iotInspectOrderMapper.selectCount();
|
|
|
IotInspectOrderPageReqVO iotInspectOrderPageReqVO = new IotInspectOrderPageReqVO();
|
|
|
iotInspectOrderPageReqVO.setCreateTime(new LocalDateTime[]{beginEndDay.get("start"), beginEndDay.get("end")});
|
|
|
Long inspectToday = iotInspectOrderMapper.selectCountByTimeAndStatus(iotInspectOrderPageReqVO);
|
|
|
- return CommonResult.success(ImmutableMap.of("total", inspectCount, "today", inspectToday));
|
|
|
+ return success(ImmutableMap.of("total", inspectCount, "today", inspectToday));
|
|
|
}
|
|
|
|
|
|
@Resource
|
|
|
@@ -600,7 +599,7 @@ public class IotStaticController {
|
|
|
results.add(resultMap);
|
|
|
});
|
|
|
});
|
|
|
- return CommonResult.success(results);
|
|
|
+ return success(results);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/home/device/type/{dept}")
|
|
|
@@ -635,7 +634,7 @@ public class IotStaticController {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- return CommonResult.success(results);
|
|
|
+ return success(results);
|
|
|
}
|
|
|
|
|
|
@Data
|
|
|
@@ -648,7 +647,7 @@ public class IotStaticController {
|
|
|
@GetMapping("/home/dept")
|
|
|
public CommonResult<List<Pms.deptStat>> getActiveDeptStat() {
|
|
|
List<Pms.deptStat> userCountByDeptId = adminUserApi.getUserCountByDeptId(null);
|
|
|
- return CommonResult.success(userCountByDeptId);
|
|
|
+ return success(userCountByDeptId);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/home/safe")
|
|
|
@@ -713,7 +712,7 @@ public class IotStaticController {
|
|
|
@PermitAll
|
|
|
public CommonResult<Map<String, Object>> getRhYwcbStat(@PathVariable("dept") String dept) {
|
|
|
Set<Long> ids = getDeptIds(dept);
|
|
|
- List<String> lastSevenDays = DateUtils.getLastSevenDays();
|
|
|
+ List<String> lastSevenDays = getLastSevenDays();
|
|
|
String first = lastSevenDays.get(0);
|
|
|
String last = lastSevenDays.get(lastSevenDays.size() - 1);
|
|
|
LocalDateTime startOfDay = getStartOfDay(last);
|
|
|
@@ -744,7 +743,7 @@ public class IotStaticController {
|
|
|
@PermitAll
|
|
|
public CommonResult<Map<String, Object>> getOrderNumberStat(@PathVariable("dept") String dept) {
|
|
|
Set<Long> ids = getDeptIds(dept);
|
|
|
- List<String> lastSevenDays = DateUtils.getLastSevenDays();
|
|
|
+ List<String> lastSevenDays = getLastSevenDays();
|
|
|
String first = lastSevenDays.get(0);
|
|
|
String last = lastSevenDays.get(lastSevenDays.size() - 1);
|
|
|
LocalDateTime startOfDay = getStartOfDay(last);
|
|
|
@@ -948,7 +947,7 @@ public class IotStaticController {
|
|
|
@PermitAll
|
|
|
public CommonResult<Map<String, Object>> rhOrder(@PathVariable("dept") String dept) {
|
|
|
Set<Long> ids = getDeptIds(dept);
|
|
|
- List<String> lastSevenDays = DateUtils.getLastSevenDays();
|
|
|
+ List<String> lastSevenDays = getLastSevenDays();
|
|
|
String first = lastSevenDays.get(0);
|
|
|
String last = lastSevenDays.get(lastSevenDays.size() - 1);
|
|
|
LocalDateTime startOfDay = getStartOfDay(last);
|
|
|
@@ -1006,7 +1005,7 @@ public class IotStaticController {
|
|
|
@PermitAll
|
|
|
public CommonResult<Map<String, Object>> rhOrderToday(@PathVariable("dept") String dept) {
|
|
|
Set<Long> ids = getDeptIds(dept);
|
|
|
- List<String> lastSevenDays = DateUtils.getLastSevenDays();
|
|
|
+ List<String> lastSevenDays = getLastSevenDays();
|
|
|
String first = lastSevenDays.get(0);
|
|
|
String last = lastSevenDays.get(lastSevenDays.size() - 1);
|
|
|
LocalDateTime startOfDay = getStartOfDay(last);
|
|
|
@@ -1062,7 +1061,7 @@ public class IotStaticController {
|
|
|
@PermitAll
|
|
|
public CommonResult<Map<String, Object>> rhOrderDaily(@PathVariable("dept") String dept) {
|
|
|
Set<Long> ids = getDeptIds(dept);
|
|
|
- List<String> lastSevenDays = DateUtils.getLastSevenDays();
|
|
|
+ List<String> lastSevenDays = getLastSevenDays();
|
|
|
String first = lastSevenDays.get(0);
|
|
|
String last = lastSevenDays.get(lastSevenDays.size() - 1);
|
|
|
LocalDateTime startOfDay = getStartOfDay(last);
|
|
|
@@ -2452,6 +2451,206 @@ public class IotStaticController {
|
|
|
return success(rates);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 瑞都 设备利用率 按 项目部 统计
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/rd/device/utilizationRates")
|
|
|
+ @PermitAll
|
|
|
+ public CommonResult<List<ProjectUtilizationRateVo>> rdUtilizationRates(IotRdDailyReportPageReqVO reqVO) {
|
|
|
+ if (ObjUtil.isEmpty(reqVO.getCreateTime())) {
|
|
|
+ throw exception(IOT_DAILY_REPORT_TIME_NOT_EXISTS);
|
|
|
+ }
|
|
|
+ if (reqVO.getCreateTime().length < 2) {
|
|
|
+ throw exception(IOT_DAILY_REPORT_TIME_NOT_EXISTS);
|
|
|
+ }
|
|
|
+ // 各项目部的设备利用率集合
|
|
|
+ List<ProjectUtilizationRateVo> rates = new ArrayList<>();
|
|
|
+ // 查询瑞都 163l 所有项目部
|
|
|
+ Set<Long> childDeptIds = deptService.getChildDeptIdListFromCache(163l);
|
|
|
+ Map<Long, DeptDO> allDeptPair = deptService.getDeptMap(childDeptIds);
|
|
|
+ Set<String> projectDeptNames = new HashSet<>();
|
|
|
+ Set<Long> projectDeptIds = new HashSet<>();
|
|
|
+ // key项目部id value项目部名称
|
|
|
+ Map<Long, String> projectPair = new HashMap<>();
|
|
|
+ // key队伍id value项目部id
|
|
|
+ Map<Long, Long> teamIdProjectIdPair = new HashMap<>();
|
|
|
+ // key项目部id value A+B类设备id集合
|
|
|
+ Map<Long, Set<Long>> projectABDeviceIdPair = new HashMap<>();
|
|
|
+ // key项目部id value 日报中A+B类设备id集合
|
|
|
+ Map<Long, Set<Long>> projectReportABDeviceIdPair = new HashMap<>();
|
|
|
+ // key项目部id value项目部包含的队伍id集合
|
|
|
+ Map<Long, Set<Long>> projectTeamPair = new HashMap<>();
|
|
|
+ // 设备ID到其所属部门ID的映射
|
|
|
+ Map<Long, Long> deviceIdToDeptIdMap = new HashMap<>();
|
|
|
+ // key项目部id value项目部下包含的队伍的 压裂 连油 设备数量
|
|
|
+ Map<Long, Integer> projectDevicePair = new HashMap<>();
|
|
|
+ // 瑞都 A B 类设备id 集合
|
|
|
+ Set<Long> abDeviceCategoryIds = new HashSet<>();
|
|
|
+ // 查询所有瑞都产品类别包含 A B 类
|
|
|
+ IotProductClassifyListReqVO deviceCategoryReqVO = new IotProductClassifyListReqVO();
|
|
|
+ List<IotProductClassifyDO> allDeviceCategories = iotProductClassifyMapper.selectList(deviceCategoryReqVO);
|
|
|
+ if (CollUtil.isNotEmpty(allDeviceCategories)) {
|
|
|
+ allDeviceCategories.forEach(category -> {
|
|
|
+ if ("A".equals(category.getRemark()) || "B".equals(category.getRemark())) {
|
|
|
+ abDeviceCategoryIds.add(category.getId());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 查询 瑞都 施工状态 字典数据 筛选出施工设备为 LY 的记录
|
|
|
+ Set<String> lyStatuses = new HashSet<>();
|
|
|
+ List<DictDataDO> rdStatuses = dictDataService.getDictDataListByDictType("rdStatus");
|
|
|
+ if (CollUtil.isNotEmpty(rdStatuses)) {
|
|
|
+ rdStatuses.forEach(tech -> {
|
|
|
+ if ("LY".equals(tech.getRemark())) {
|
|
|
+ lyStatuses.add(tech.getValue());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (CollUtil.isNotEmpty(allDeptPair)) {
|
|
|
+ allDeptPair.forEach((deptId, dept) -> {
|
|
|
+ if ("2".equals(dept.getType())) {
|
|
|
+ projectDeptIds.add(deptId);
|
|
|
+ projectDeptNames.add(dept.getName());
|
|
|
+ projectPair.put(deptId, dept.getName());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 遍历所有部门
|
|
|
+ allDeptPair.forEach((deptId, dept) -> {
|
|
|
+ // 找出每个项目部下的队伍
|
|
|
+ if (projectPair.containsKey(dept.getParentId())) {
|
|
|
+ // 获得当前部门的上级项目部
|
|
|
+ projectPair.forEach((projectDeptId, projectDept) -> {
|
|
|
+ if (projectDeptId.equals(dept.getParentId())) {
|
|
|
+ if (projectTeamPair.containsKey(projectDeptId)) {
|
|
|
+ Set<Long> teamIds = projectTeamPair.get(projectDeptId);
|
|
|
+ teamIds.add(deptId);
|
|
|
+ projectTeamPair.put(projectDeptId, teamIds);
|
|
|
+ } else {
|
|
|
+ Set<Long> teamIds = new HashSet<>();
|
|
|
+ teamIds.add(deptId);
|
|
|
+ projectTeamPair.put(projectDeptId, teamIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 设置每个队伍与上级项目部对应关系
|
|
|
+ teamIdProjectIdPair.put(dept.getId(), dept.getParentId());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 查询瑞都所有设备
|
|
|
+ IotDevicePageReqVO deviceReqVO = new IotDevicePageReqVO();
|
|
|
+ deviceReqVO.setDeptIds(new ArrayList<>(childDeptIds));
|
|
|
+ List<IotDeviceDO> rdDevices = iotDeviceMapper.selectListAlone(deviceReqVO);
|
|
|
+ // 筛选每个项目部 A B 类设备id集合
|
|
|
+ if (CollUtil.isNotEmpty(rdDevices)) {
|
|
|
+ rdDevices.forEach(device -> {
|
|
|
+ Long projectId = 0l;
|
|
|
+ if (teamIdProjectIdPair.containsKey(device.getDeptId())) {
|
|
|
+ projectId = teamIdProjectIdPair.get(device.getDeptId());
|
|
|
+ }
|
|
|
+ if (projectDeptIds.contains(device.getDeptId())) {
|
|
|
+ projectId = device.getDeptId();
|
|
|
+ }
|
|
|
+ if (abDeviceCategoryIds.contains(device.getAssetClass())) {
|
|
|
+ if (projectABDeviceIdPair.containsKey(projectId)) {
|
|
|
+ Set<Long> tempDeviceIds = projectABDeviceIdPair.get(projectId);
|
|
|
+ tempDeviceIds.add(device.getId());
|
|
|
+ projectABDeviceIdPair.put(projectId, tempDeviceIds);
|
|
|
+ } else {
|
|
|
+ Set<Long> tempDeviceIds = new HashSet<>();
|
|
|
+ tempDeviceIds.add(device.getId());
|
|
|
+ projectABDeviceIdPair.put(projectId, tempDeviceIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 查询出指定时间区间内 已经填写的日报 再根据设备id 进行筛选 通过设备id 建立项目部 与 日报数量之间的关联
|
|
|
+ // 判断日报中 device_ids 字段中每个设备 是否属于需要统计的 压裂 连油 设备
|
|
|
+ List<IotRdDailyReportDO> dailyReports = iotRdDailyReportMapper.dailyReports(reqVO);
|
|
|
+ // key项目部id value项目部包含的队伍指定时间区域内日报数量
|
|
|
+ Map<Long, Integer> projectReportPair = new HashMap<>();
|
|
|
+ if (CollUtil.isNotEmpty(dailyReports)) {
|
|
|
+ // 整理出每个项目部下的队伍填报的日报数量
|
|
|
+ dailyReports.forEach(report -> {
|
|
|
+ // 筛选出 可以统计 设备利用率的 日报状态 动迁 施工 施工准备
|
|
|
+ // 区分不同项目部的日报
|
|
|
+ if (lyStatuses.contains(report.getRdStatus())) {
|
|
|
+ Set<Long> reportDeviceIds = report.getDeviceIds();
|
|
|
+ // 获得当前日报施工队伍的上级项目部
|
|
|
+ if (teamIdProjectIdPair.containsKey(report.getDeptId())) {
|
|
|
+ Long projectId = teamIdProjectIdPair.get(report.getDeptId());
|
|
|
+ if (projectABDeviceIdPair.containsKey(projectId)) {
|
|
|
+ // 项目部下所有的AB类设备id集合
|
|
|
+ Set<Long> tempReportDeviceIds = projectABDeviceIdPair.get(projectId);
|
|
|
+ Set<Long> crossDeviceIds = CollUtil.isNotEmpty(reportDeviceIds)
|
|
|
+ && CollUtil.isNotEmpty(tempReportDeviceIds)
|
|
|
+ ? reportDeviceIds.stream() // 流式处理reportDeviceIds
|
|
|
+ .filter(tempReportDeviceIds::contains) // 筛选出在tempReportDeviceIds中存在的元素
|
|
|
+ .collect(Collectors.toSet()) // 收集为新的Set集合
|
|
|
+ : Collections.emptySet(); // 任意集合为空则返回空Set(避免返回null)
|
|
|
+ if (projectReportABDeviceIdPair.containsKey(projectId)) {
|
|
|
+ Set<Long> tempDeviceIds = projectReportABDeviceIdPair.get(projectId);
|
|
|
+ tempDeviceIds.addAll(crossDeviceIds);
|
|
|
+ projectReportABDeviceIdPair.put(projectId, tempDeviceIds);
|
|
|
+ } else {
|
|
|
+ Set<Long> tempDeviceIds = new HashSet<>();
|
|
|
+ tempDeviceIds.addAll(crossDeviceIds);
|
|
|
+ projectReportABDeviceIdPair.put(projectId, tempDeviceIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 计算每个项目部的设备利用率 施工的设备数量/设备总数量
|
|
|
+ if (CollUtil.isNotEmpty(projectABDeviceIdPair)) {
|
|
|
+
|
|
|
+ projectABDeviceIdPair.forEach((projectDeptId, deviceIds) -> {
|
|
|
+ // 项目部下所有AB类设备
|
|
|
+ Integer projectDeviceCount = deviceIds.size();
|
|
|
+ // 项目部日报中施工的AB类设备
|
|
|
+ Integer reportDeviceCount = 0;
|
|
|
+ if (projectReportABDeviceIdPair.containsKey(projectDeptId)) {
|
|
|
+ Set<Long> reportDeviceIds = projectReportABDeviceIdPair.get(projectDeptId);
|
|
|
+ reportDeviceCount = reportDeviceIds.size();
|
|
|
+ }
|
|
|
+ ProjectUtilizationRateVo rateVo = new ProjectUtilizationRateVo();
|
|
|
+ rateVo.setProjectDeptId(projectDeptId);
|
|
|
+ if (projectPair.containsKey(projectDeptId)) {
|
|
|
+ rateVo.setProjectDeptName(projectPair.get(projectDeptId));
|
|
|
+ }
|
|
|
+ double rate = 0.0;
|
|
|
+ // 计算设备利用率(处理除数为0的情况)
|
|
|
+ if (projectDeviceCount > 0 && reportDeviceCount > 0) {
|
|
|
+ rate = new BigDecimal((double) reportDeviceCount / (projectDeviceCount))
|
|
|
+ .setScale(4, RoundingMode.HALF_UP) // 保留4位小数,四舍五入
|
|
|
+ .doubleValue();;
|
|
|
+ } else {
|
|
|
+ rate = 0;
|
|
|
+ }
|
|
|
+ rateVo.setUtilizationRate(rate); // 存储计算结果
|
|
|
+ rates.add(rateVo);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 将返回列表中的 部门名称 去除多语言标识
|
|
|
+ // 处理projectDeptName,截取~~首次出现前的字符串
|
|
|
+ if (CollUtil.isNotEmpty(rates)) {
|
|
|
+ rates.forEach(rateVo -> {
|
|
|
+ String originalName = rateVo.getProjectDeptName();
|
|
|
+ if (StrUtil.isNotBlank(originalName) && originalName.contains("~~")) {
|
|
|
+ // 截取首次~~之前的部分
|
|
|
+ String processedName = originalName.substring(0, originalName.indexOf("~~"));
|
|
|
+ rateVo.setProjectDeptName(processedName);
|
|
|
+ }
|
|
|
+ // 空值或无~~标识时,保留原名称
|
|
|
+ });
|
|
|
+ }
|
|
|
+ rates.sort(Comparator.comparingDouble(ProjectUtilizationRateVo::getUtilizationRate).reversed());
|
|
|
+ return success(rates);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 瑞都 设备利用率 按 队伍 统计
|
|
|
* @return
|