|
@@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.Pms;
|
|
import cn.iocoder.yudao.framework.common.pojo.Pms;
|
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|
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.framework.security.core.util.SecurityFrameworkUtils;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.failure.vo.IotFailureReportPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.failure.vo.IotFailureReportPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.inspect.order.vo.IotInspectOrderPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.inspect.order.vo.IotInspectOrderPageReqVO;
|
|
@@ -18,6 +19,7 @@ import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeati
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotoutbound.vo.IotOutboundPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotoutbound.vo.IotOutboundPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.maintain.vo.IotMaintainPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.maintain.vo.IotMaintainPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.OrderVo;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.OrderVo;
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.YearTotalGas;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.DeviceVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.DeviceVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDevicePageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDevicePageReqVO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
|
|
@@ -732,10 +734,12 @@ public class IotStaticController {
|
|
if (totalObj instanceof Number) {
|
|
if (totalObj instanceof Number) {
|
|
return ((Number) totalObj).longValue();
|
|
return ((Number) totalObj).longValue();
|
|
} else if (totalObj instanceof String) {
|
|
} else if (totalObj instanceof String) {
|
|
- return Long.parseLong((String) totalObj);
|
|
|
|
|
|
+ String value = String.valueOf(totalObj).replace(".00","");
|
|
|
|
+ return Long.parseLong(value);
|
|
} else {
|
|
} else {
|
|
- System.err.println("total字段格式错误: " + totalObj);
|
|
|
|
- return 0L;
|
|
|
|
|
|
+// System.err.println("total字段格式错误: " + totalObj);
|
|
|
|
+ String value = String.valueOf(totalObj).replaceAll(".00","");
|
|
|
|
+ return Long.parseLong(value);
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
System.err.println("处理total字段出错: " + e.getMessage());
|
|
System.err.println("处理total字段出错: " + e.getMessage());
|
|
@@ -916,26 +920,26 @@ public class IotStaticController {
|
|
fillData.add(v);
|
|
fillData.add(v);
|
|
});
|
|
});
|
|
|
|
|
|
- iotDeviceRunLogPageReqVO.setPointName("当日注水量");
|
|
|
|
- List<Map<String, Object>> waters = iotDeviceRunLogMapper.selectListByCreateTimeAndDeptList(iotDeviceRunLogPageReqVO).stream().map(e -> {
|
|
|
|
- Map<String, Object> abc = new HashMap<>();
|
|
|
|
- abc.put("id", e.getId());
|
|
|
|
- abc.put("createTime", e.getCreateTime());
|
|
|
|
- abc.put("total", e.getTotalRunTime());
|
|
|
|
- abc.put("today", e.getFillContent());
|
|
|
|
- return abc;
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
- LinkedHashMap<String, Long> waterMap = sumTotalByDate(waters, 7,"today");
|
|
|
|
- LinkedList<Object> waterxAxis = new LinkedList<>();
|
|
|
|
- LinkedList<Object> waterData = new LinkedList<>();
|
|
|
|
- waterMap.forEach( (k,v)->{
|
|
|
|
- waterxAxis.add(k);
|
|
|
|
- waterData.add(v);
|
|
|
|
- });
|
|
|
|
|
|
+// iotDeviceRunLogPageReqVO.setPointName("当日注水量");
|
|
|
|
+// List<Map<String, Object>> waters = iotDeviceRunLogMapper.selectListByCreateTimeAndDeptList(iotDeviceRunLogPageReqVO).stream().map(e -> {
|
|
|
|
+// Map<String, Object> abc = new HashMap<>();
|
|
|
|
+// abc.put("id", e.getId());
|
|
|
|
+// abc.put("createTime", e.getCreateTime());
|
|
|
|
+// abc.put("total", e.getTotalRunTime());
|
|
|
|
+// abc.put("today", e.getFillContent());
|
|
|
|
+// return abc;
|
|
|
|
+// }).collect(Collectors.toList());
|
|
|
|
+// LinkedHashMap<String, Long> waterMap = sumTotalByDate(waters, 7,"today");
|
|
|
|
+// LinkedList<Object> waterxAxis = new LinkedList<>();
|
|
|
|
+// LinkedList<Object> waterData = new LinkedList<>();
|
|
|
|
+// waterMap.forEach( (k,v)->{
|
|
|
|
+// waterxAxis.add(k);
|
|
|
|
+// waterData.add(v);
|
|
|
|
+// });
|
|
|
|
|
|
ImmutableMap<String, Serializable> fillResult = ImmutableMap.of("name", "当日注气量~~en**daily gas injection", "data", fillData);
|
|
ImmutableMap<String, Serializable> fillResult = ImmutableMap.of("name", "当日注气量~~en**daily gas injection", "data", fillData);
|
|
- ImmutableMap<String, Serializable> waterResult = ImmutableMap.of("name", "当日注水量~~en**daily water injection", "data", waterData);
|
|
|
|
- return success(ImmutableMap.of("xAxis", xAxis, "series", ImmutableList.of(fillResult, waterResult)));
|
|
|
|
|
|
+// ImmutableMap<String, Serializable> waterResult = ImmutableMap.of("name", "当日注水量~~en**daily water injection", "data", waterData);
|
|
|
|
+ return success(ImmutableMap.of("xAxis", xAxis, "series", ImmutableList.of(fillResult)));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -989,5 +993,31 @@ public class IotStaticController {
|
|
return success(formattedResult);
|
|
return success(formattedResult);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @PermitAll
|
|
|
|
+ @GetMapping("/year/total/gas/{dept}")
|
|
|
|
+ public CommonResult<ImmutableMap> getYearTotalGas(@PathVariable("dept") String dept) {
|
|
|
|
+ Set<Long> ids = getDeptIds(dept);
|
|
|
|
+ //获取近一年的月份
|
|
|
|
+ List<String> lastYearMonthRanges = getLastYearMonthRanges().stream().map(MonthRange::getYearMonth).collect(Collectors.toList());
|
|
|
|
+ IotDeviceRunLogPageReqVO iotDeviceRunLogPageReqVO = new IotDeviceRunLogPageReqVO();
|
|
|
|
+ iotDeviceRunLogPageReqVO.setDeptIds(new ArrayList<>(ids));
|
|
|
|
+ iotDeviceRunLogPageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
+ iotDeviceRunLogPageReqVO.setPointName("当日注气量");
|
|
|
|
+ List<YearTotalGas> yearTotalGases = iotDeviceRunLogMapper.selectYearTotalGas(iotDeviceRunLogPageReqVO);
|
|
|
|
+ LinkedList<String> result = new LinkedList<>();
|
|
|
|
+ lastYearMonthRanges.forEach(lastYearMonthRange -> {
|
|
|
|
+ YearTotalGas yearTotalGas = yearTotalGases.stream().filter(e -> e.getMonth().equals(lastYearMonthRange)).findAny().orElse(null);
|
|
|
|
+ if (Objects.isNull(yearTotalGas)) {
|
|
|
|
+ result.add("0");
|
|
|
|
+ } else {
|
|
|
|
+ result.add(NumberUtils.formatNumber(yearTotalGas.getTotalGas()));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ ImmutableMap<String, Serializable> fillResult = ImmutableMap.of("name", "累计注气量~~en**cumulative gas injection", "data", result);
|
|
|
|
+ return success(ImmutableMap.of("xAxis", lastYearMonthRanges, "series", ImmutableList.of(fillResult)));
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|