|
|
|
|
@ -1,10 +1,8 @@
|
|
|
|
|
package com.aucma.base.service.impl;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import com.aucma.common.utils.DateUtils;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
@ -20,7 +18,7 @@ import com.aucma.base.service.IBaseDeviceParamValService;
|
|
|
|
|
* @date 2025-10-15
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
public class BaseDeviceParamValServiceImpl implements IBaseDeviceParamValService
|
|
|
|
|
public class BaseDeviceParamValServiceImpl implements IBaseDeviceParamValService
|
|
|
|
|
{
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(BaseDeviceParamValServiceImpl.class);
|
|
|
|
|
|
|
|
|
|
@ -64,6 +62,13 @@ public class BaseDeviceParamValServiceImpl implements IBaseDeviceParamValService
|
|
|
|
|
if (baseDeviceParamVal == null) {
|
|
|
|
|
baseDeviceParamVal = new BaseDeviceParamVal();
|
|
|
|
|
}
|
|
|
|
|
// 防止全表扫描:若未指定时间范围,默认查询最近24小时
|
|
|
|
|
if (baseDeviceParamVal.getBeginTime() == null && baseDeviceParamVal.getEndTime() == null) {
|
|
|
|
|
Date end = new Date();
|
|
|
|
|
Date begin = DateUtils.addHours(end, -24);
|
|
|
|
|
baseDeviceParamVal.setBeginTime(begin);
|
|
|
|
|
baseDeviceParamVal.setEndTime(end);
|
|
|
|
|
}
|
|
|
|
|
List<BaseDeviceParamVal> list = baseDeviceParamValMapper.selectLatestBaseDeviceParamValList(baseDeviceParamVal);
|
|
|
|
|
return list != null ? list : Collections.emptyList();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
@ -132,11 +137,12 @@ public class BaseDeviceParamValServiceImpl implements IBaseDeviceParamValService
|
|
|
|
|
Map<String, Object> result = baseDeviceParamValMapper.selectDeviceStatusStatistics();
|
|
|
|
|
if (result == null) {
|
|
|
|
|
result = new HashMap<>();
|
|
|
|
|
result.put("totalCount", 0);
|
|
|
|
|
result.put("runningCount", 0);
|
|
|
|
|
result.put("stoppedCount", 0);
|
|
|
|
|
result.put("standbyCount", 0);
|
|
|
|
|
result.put("notStartedCount", 0);
|
|
|
|
|
result.put("totalCount", 0);//从base_deviceledger中获取is_flag = 1
|
|
|
|
|
result.put("runningCount", 0);//机台状态-三色灯机器运行
|
|
|
|
|
result.put("stoppedCount", 0);//三色灯机器暂停
|
|
|
|
|
result.put("standbyCount", 0);//三色灯机器待机
|
|
|
|
|
result.put("alarmCount", 0);//三色灯机器报警
|
|
|
|
|
result.put("notStartedCount", 0);//t.totalCount - s.runningCount - s.stoppedCount - s.standbyCount - s.alarmCount AS notStartedCount
|
|
|
|
|
result.put("runningRate", "0%");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|