|
@@ -10,7 +10,9 @@ import com.imcs.admin.common.PageData;
|
|
|
import com.imcs.admin.common.PageParam;
|
|
|
import com.imcs.admin.common.Result;
|
|
|
import com.imcs.admin.db.service.JdbcDao;
|
|
|
+import com.imcs.admin.db.service.JdbcService;
|
|
|
import com.imcs.admin.util.DateUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -23,6 +25,9 @@ public class BigScreenDetailServiceImpl implements BigScreenDetailService {
|
|
|
@Resource
|
|
|
private JdbcDao jdbcDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private JdbcService jdbcService;
|
|
|
+
|
|
|
/*
|
|
|
{
|
|
|
"mainProg": "",//主程序号
|
|
@@ -73,15 +78,34 @@ public class BigScreenDetailServiceImpl implements BigScreenDetailService {
|
|
|
String currentDateAsString = DateUtils.getCurrentDateAsString();
|
|
|
|
|
|
Optional<Map<String, Object>> createDate = items1.stream().filter(vo -> vo.get("createDate").equals(currentDateAsString)).findFirst();
|
|
|
+
|
|
|
+ StringBuffer todayWorkTimeBuffer=new StringBuffer("SELECT\n" +
|
|
|
+ "\t\tDATE_FORMAT( dr.create_time, '%Y-%m-%d' ) AS create_time,\n" +
|
|
|
+ "\t\tdr.device_id,\n" +
|
|
|
+ "\t\tdr.device_state,\n" +
|
|
|
+ "\t\tROUND(SUM( IFNULL( TIMESTAMPDIFF( SECOND, dr.start_time, IFNULL( dr.end_time, CURRENT_TIMESTAMP )), 0 ) ) / 60.0, 1) AS keep_time\n" +
|
|
|
+ "\tFROM\n" +
|
|
|
+ "\t\tdevice_report dr where device_id = ? and dr.device_state='加工'\n" +
|
|
|
+ "\tGROUP BY\n" +
|
|
|
+ "\t\tdevice_id,\n" +
|
|
|
+ "\t\tDATE_FORMAT( dr.create_time, '%Y-%m-%d' ),\n" +
|
|
|
+ "\t\tdr.device_state ");
|
|
|
+
|
|
|
+ Map<String, Object> device = jdbcService.findOne(todayWorkTimeBuffer.toString(), pageParam.getStr("id"));
|
|
|
+ if(device == null){
|
|
|
+ json.put("todayPowerOnTime",0);
|
|
|
+ }else{
|
|
|
+ json.put("todayPowerOnTime",device.get("keepTime").toString());
|
|
|
+ }
|
|
|
+
|
|
|
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"));
|
|
|
+
|
|
|
}else{
|
|
|
json.put("detailInfo", new JSONArray());
|
|
|
json.put("deviceRate",0);
|
|
|
- json.put("todayPowerOnTime",0);
|
|
|
}
|
|
|
|
|
|
getleftBox(ip,json,pageParam);
|