|
@@ -63,6 +63,7 @@ public class BigScreenDetailServiceImpl implements BigScreenDetailService {
|
|
|
List<Object> createDateList = items1.stream()
|
|
|
.map(map -> map.get("createDate")) // 获取 device_rate 字段
|
|
|
.collect(Collectors.toList());
|
|
|
+ //主轴利用率
|
|
|
json.put("dateList",createDateList);
|
|
|
json.put("deviceRates",deviceRates);
|
|
|
|
|
@@ -70,6 +71,7 @@ public class BigScreenDetailServiceImpl implements BigScreenDetailService {
|
|
|
|
|
|
Optional<Map<String, Object>> createDate = items1.stream().filter(vo -> vo.get("createDate").equals(currentDateAsString)).findFirst();
|
|
|
if(createDate.isPresent()){
|
|
|
+ //当天设备实时数据
|
|
|
json.put("detailInfo", JSONArray.parseArray(createDate.get().get("detailInfo").toString()));
|
|
|
json.put("deviceRate",createDate.get().get("deviceRate"));
|
|
|
json.put("todayPowerOnTime",createDate.get().get("todayPowerOnTime"));
|
|
@@ -84,11 +86,16 @@ public class BigScreenDetailServiceImpl implements BigScreenDetailService {
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 本月设备主轴利用率
|
|
|
+ * @param ip
|
|
|
+ * @param jsonObject
|
|
|
+ * @param pageParam
|
|
|
+ */
|
|
|
public void getleftBox(String ip,JSONObject jsonObject,PageParam pageParam){
|
|
|
- StringBuffer str=new StringBuffer("SELECT ROUND(AVG(device_rate),2) as avg_device_rate,ROUND(100 - AVG(device_rate), 2) AS dif_avg_device_rate\n" +
|
|
|
+ StringBuffer str=new StringBuffer("SELECT ROUND((sum(today_power_on_time)/60)/(16 * count(*)),2) as avg_device_rate, ROUND(100-(sum(today_power_on_time)/60)/(16 * count(*)),2) as dif_avg_device_rate\n" +
|
|
|
"FROM device_collection_detail\n" +
|
|
|
- "WHERE MONTH(create_date) = ? and device_ip= ? ");
|
|
|
+ "WHERE DATE_FORMAT(create_date, '%Y-%m') = ? and device_ip= ? ");
|
|
|
List<Object> detailArgs = new ArrayList<>();
|
|
|
detailArgs.add(StrUtil.format("{}",DateUtils.getCurrentMonth()));
|
|
|
detailArgs.add(StrUtil.format("{}",ip));
|
|
@@ -97,10 +104,14 @@ public class BigScreenDetailServiceImpl implements BigScreenDetailService {
|
|
|
if(!CollectionUtil.isEmpty(items)){
|
|
|
jsonObject.putAll(items.get(0));
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 近一年主轴利用率
|
|
|
+ * @param ip
|
|
|
+ * @param jsonObject
|
|
|
+ * @param pageParam
|
|
|
+ */
|
|
|
public void getEchart3(String ip,JSONObject jsonObject,PageParam pageParam){
|
|
|
|
|
|
List<String> pastDaysDates = DateUtils.getLastYearMonths();
|
|
@@ -108,7 +119,7 @@ public class BigScreenDetailServiceImpl implements BigScreenDetailService {
|
|
|
.map(date -> "'" + date + "'")
|
|
|
.collect(Collectors.joining(", "));
|
|
|
StringBuffer str=new StringBuffer("SELECT CONCAT(YEAR(create_date), '-', LPAD(MONTH(create_date), 2, '0')) AS year_month_str,\n" +
|
|
|
- " ROUND(AVG(device_rate),2) AS average_value\n" +
|
|
|
+ " ROUND((sum(today_power_on_time)/60)/(16 * count(*)),2) AS average_value\n" +
|
|
|
"FROM device_collection_detail\n" +
|
|
|
"where DATE_FORMAT(create_date, '%Y-%m') in ("+collect+") and device_ip = ? " +
|
|
|
"GROUP BY CONCAT(YEAR(create_date), '-', LPAD(MONTH(create_date), 2, '0')) order by CONCAT(YEAR(create_date), '-', LPAD(MONTH(create_date), 2, '0')) asc ");
|
|
@@ -121,8 +132,6 @@ public class BigScreenDetailServiceImpl implements BigScreenDetailService {
|
|
|
List<BigDecimal> avgYearMonth = items.stream().map(vo -> new BigDecimal(vo.get("averageValue").toString())).collect(Collectors.toList());
|
|
|
jsonObject.put("yearMonthList",yearMonthStr);
|
|
|
jsonObject.put("avgYearMonth",avgYearMonth);
|
|
|
- }else{
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|