|
@@ -86,9 +86,9 @@ public class BigScreenDetailServiceImpl implements BigScreenDetailService {
|
|
|
|
|
|
|
|
|
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) 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));
|
|
@@ -108,7 +108,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 ");
|