|
@@ -1719,6 +1719,102 @@ public class IotStaticController {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Operation(summary = "瑞都 近6个月的维修 保养次数")
|
|
|
|
|
+ @PermitAll
|
|
|
|
|
+ @GetMapping("/recent/wbcs/{dept}")
|
|
|
|
|
+ public CommonResult<ImmutableMap> recentWbNum(@PathVariable("dept") String dept) {
|
|
|
|
|
+ Set<Long> ids = getDeptIds(dept);
|
|
|
|
|
+ // 获取近半年的月份
|
|
|
|
|
+ List<String> lastYearMonthRanges = getRecentSixMonthRanges().stream().map(MonthRange::getYearMonth).collect(Collectors.toList());
|
|
|
|
|
+ // 查询保养次数
|
|
|
|
|
+ IotMainWorkOrderPageReqVO workOrderReqVO = new IotMainWorkOrderPageReqVO();
|
|
|
|
|
+ workOrderReqVO.setDeptIds(ids);
|
|
|
|
|
+ List<IotMainWorkOrderDO> workOrders = iotMainWorkOrderService.workOrders(workOrderReqVO);
|
|
|
|
|
+ Map<String, Integer> workOrderPair = new HashMap<>();
|
|
|
|
|
+ // key年月 value维修工单数量
|
|
|
|
|
+ Map<String, Integer> mainOrderPair = new HashMap<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(workOrders)) {
|
|
|
|
|
+ workOrders.forEach(order -> {
|
|
|
|
|
+ LocalDateTime orderDate = order.getCreateTime();
|
|
|
|
|
+ String yearMonth = LocalDateTimeUtil.format(orderDate, DatePattern.NORM_MONTH_PATTERN);
|
|
|
|
|
+ if (workOrderPair.containsKey(yearMonth)) {
|
|
|
|
|
+ Integer tempNum = workOrderPair.get(yearMonth);
|
|
|
|
|
+ workOrderPair.put(yearMonth, ++tempNum);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ workOrderPair.put(yearMonth, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 查询维修工单数量
|
|
|
|
|
+ IotMaintainPageReqVO maintainReqVO = new IotMaintainPageReqVO();
|
|
|
|
|
+ maintainReqVO.setDeptId(163l);
|
|
|
|
|
+ maintainReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
+ PageResult<IotMaintainDO> pageMaintains = iotMaintainService.getIotMaintainPage(maintainReqVO);
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(pageMaintains)) {
|
|
|
|
|
+ List<IotMaintainDO> maintains = pageMaintains.getList();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(maintains)) {
|
|
|
|
|
+ maintains.forEach(maintain -> {
|
|
|
|
|
+ LocalDateTime orderDate = maintain.getCreateTime();
|
|
|
|
|
+ String yearMonth = LocalDateTimeUtil.format(orderDate, DatePattern.NORM_MONTH_PATTERN);
|
|
|
|
|
+ if (mainOrderPair.containsKey(yearMonth)) {
|
|
|
|
|
+ Integer tempNum = mainOrderPair.get(yearMonth);
|
|
|
|
|
+ mainOrderPair.put(yearMonth, ++tempNum);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ mainOrderPair.put(yearMonth, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 保养工单
|
|
|
|
|
+ List<OrderCount> orderCounts = new ArrayList<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(workOrderPair)) {
|
|
|
|
|
+ workOrderPair.forEach((yearMonth, num) -> {
|
|
|
|
|
+ OrderCount tempCount = new OrderCount();
|
|
|
|
|
+ tempCount.setMonth(yearMonth);
|
|
|
|
|
+ tempCount.setOrderNum(String.valueOf(num));
|
|
|
|
|
+ orderCounts.add(tempCount);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 维修工单
|
|
|
|
|
+ List<OrderCount> mainCounts = new ArrayList<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(mainOrderPair)) {
|
|
|
|
|
+ mainOrderPair.forEach((yearMonth, num) -> {
|
|
|
|
|
+ OrderCount tempCount = new OrderCount();
|
|
|
|
|
+ tempCount.setMonth(yearMonth);
|
|
|
|
|
+ tempCount.setOrderNum(String.valueOf(num));
|
|
|
|
|
+ mainCounts.add(tempCount);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // IotRhDailyReportPageReqVO iotRhDailyReportPageReqVO = new IotRhDailyReportPageReqVO();
|
|
|
|
|
+ // iotRhDailyReportPageReqVO.setDeptIds(new ArrayList<>(ids));
|
|
|
|
|
+ // iotRhDailyReportPageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
+ // List<YearTotalGas> yearTotalGases = iotRhDailyReportMapper.selectYearTotalGas(iotRhDailyReportPageReqVO);
|
|
|
|
|
+ LinkedList<String> result = new LinkedList<>();
|
|
|
|
|
+ // 维修工单
|
|
|
|
|
+ LinkedList<String> mainResult = new LinkedList<>();
|
|
|
|
|
+ lastYearMonthRanges.forEach(lastYearMonthRange -> {
|
|
|
|
|
+ // 保养工单
|
|
|
|
|
+ OrderCount orderCount = orderCounts.stream().filter(e -> e.getMonth().equals(lastYearMonthRange)).findAny().orElse(null);
|
|
|
|
|
+ if (Objects.isNull(orderCount)) {
|
|
|
|
|
+ result.add("0");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.add(NumberUtils.formatNumber(orderCount.getOrderNum()));
|
|
|
|
|
+ }
|
|
|
|
|
+ // 维修工单
|
|
|
|
|
+ OrderCount mainCount = mainCounts.stream().filter(e -> e.getMonth().equals(lastYearMonthRange)).findAny().orElse(null);
|
|
|
|
|
+ if (Objects.isNull(mainCount)) {
|
|
|
|
|
+ mainResult.add("0");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ mainResult.add(NumberUtils.formatNumber(mainCount.getOrderNum()));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ ImmutableMap<String, Serializable> fillResult = ImmutableMap.of("name", "保养次数~~en**maintenance count", "data", result);
|
|
|
|
|
+ ImmutableMap<String, Serializable> mainFillResult = ImmutableMap.of("name", "维修次数~~en**maintenance count", "data", mainResult);
|
|
|
|
|
+ return success(ImmutableMap.of("xAxis", lastYearMonthRanges, "series", ImmutableList.of(fillResult, mainFillResult)));
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@GetMapping("/number")
|
|
@GetMapping("/number")
|
|
|
@Operation(summary = "获取巡检计划数量")
|
|
@Operation(summary = "获取巡检计划数量")
|
|
|
@PermitAll
|
|
@PermitAll
|