修改获取设备实时数据定时任务逻辑
This commit is contained in:
@ -60,6 +60,7 @@ public class AlertLogController extends BaseController
|
||||
List<AlertLog> list = alertLogService.selectAlertLogList(alertLog);
|
||||
// 获取排序类型
|
||||
String sort = alertLog.getSort();
|
||||
System.err.println("排序:"+sort);
|
||||
if(sort != null){
|
||||
//对列表进行排序
|
||||
//升序
|
||||
|
@ -18,15 +18,13 @@ import com.fastbee.iot.mapper.DeviceMapper;
|
||||
import com.fastbee.iot.model.DeviceShortOutput;
|
||||
import com.fastbee.iot.service.IDeviceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.jws.Oneway;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 设备告警
|
||||
@ -41,6 +39,7 @@ public class DeviceAlarmController extends BaseController {
|
||||
@Autowired
|
||||
private AlertLogMapper alertLogMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private DeviceInformationManager deviceInformationManager;
|
||||
|
||||
@ -378,6 +377,30 @@ public class DeviceAlarmController extends BaseController {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询告警列表
|
||||
*/
|
||||
@GetMapping("/alarmList")
|
||||
public AjaxResult getAlarmList(@Param("sort")Integer sort ){
|
||||
List<AlertLog> list = new LambdaQueryChainWrapper<>(alertLogMapper)
|
||||
.select(AlertLog::getAlertLogId,AlertLog::getCreateTime,AlertLog::getAlertName,AlertLog::getSerialNumber)
|
||||
.list();
|
||||
if(sort != null){
|
||||
//对列表进行排序
|
||||
//升序
|
||||
if(sort==1){
|
||||
list.sort(Comparator.comparing(AlertLog::getCreateTime));
|
||||
}
|
||||
//降序
|
||||
else if(sort==2){
|
||||
list.sort(Comparator.comparing(AlertLog::getCreateTime).reversed());
|
||||
}
|
||||
}
|
||||
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 研判等级评级策略方法
|
||||
* A级,3个以下报警;B级,3-10个报警;C级;10个以上报警
|
||||
|
Reference in New Issue
Block a user