Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
1f613126cf
@ -610,7 +610,7 @@ public class TDEngineService {
|
||||
return result;
|
||||
}
|
||||
|
||||
public PageDataInfo<DeviceEventInfo> queryEvent(Integer eventLevel, Long startTime, Long endTime, List<String> deviceCodeList, Integer limit, Integer offset) {
|
||||
public PageDataInfo<DeviceEventInfo> queryEvent(Integer eventLevel, Long startTime, Long endTime, List<String> deviceCodeList, Integer pageSize, Integer offset, Integer limit) {
|
||||
List<DeviceEventInfo> result = new ArrayList<>();
|
||||
StringBuffer sb = new StringBuffer(2048);
|
||||
Integer total = 0;
|
||||
@ -630,8 +630,17 @@ public class TDEngineService {
|
||||
}
|
||||
}
|
||||
sb.append(" order by t.event_time");
|
||||
if (limit != null){
|
||||
sb.append(" limit ").append(offset).append(",").append(limit);
|
||||
if (pageSize == null){
|
||||
if (limit == null){
|
||||
sb.append(" desc limit 100");
|
||||
total = 100;
|
||||
}else {
|
||||
sb.append(" desc limit ").append(limit);
|
||||
total = limit;
|
||||
}
|
||||
}
|
||||
if (pageSize != null){
|
||||
sb.append(" limit ").append(offset).append(",").append(pageSize);
|
||||
total = getEventCount(eventLevel,startTime,endTime,deviceCodeList);
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,11 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class SysEquipmentDto {
|
||||
public class SysEquipmentDto implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -19,7 +20,7 @@ import java.util.List;
|
||||
* @author chenhaojie
|
||||
*/
|
||||
@Data
|
||||
public class SysEquipmentVo{
|
||||
public class SysEquipmentVo implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -31,6 +31,11 @@ public class EventQueryParam
|
||||
*/
|
||||
private List<String> deviceCode;
|
||||
|
||||
/**
|
||||
* 不分页限制
|
||||
*/
|
||||
private Integer limit;
|
||||
|
||||
/**
|
||||
* pageNum;
|
||||
*/
|
||||
|
@ -27,11 +27,14 @@ public class EventServiceImpl implements EventService {
|
||||
if (param.getStartTime() == null || param.getEndTime() == null) {
|
||||
throw new ServiceException("查询时间不能为空");
|
||||
}
|
||||
if (param.getPageSize() != null && param.getLimit() != null){
|
||||
throw new ServiceException("分页与limit不能同时存在");
|
||||
}
|
||||
Integer offset = null;
|
||||
if (param.getPageNum() != null) {
|
||||
offset = (param.getPageNum() - 1) * param.getPageSize();
|
||||
}
|
||||
PageDataInfo<DeviceEventInfo> deviceEventInfos = tdEngineService.queryEvent(param.getEventLevel(), param.getStartTime(), param.getEndTime(), param.getDeviceCode(), param.getPageSize(), offset);
|
||||
PageDataInfo<DeviceEventInfo> deviceEventInfos = tdEngineService.queryEvent(param.getEventLevel(), param.getStartTime(), param.getEndTime(), param.getDeviceCode(), param.getPageSize(), offset, param.getLimit());
|
||||
return deviceEventInfos;
|
||||
}
|
||||
|
||||
|
@ -46,4 +46,10 @@ public interface SysImpTabMappingMapper extends BaseMapperPlus<SysTabMapping, Sy
|
||||
*/
|
||||
void deleteMappingByLinkId(@Param("linkId") Long linkId);
|
||||
|
||||
/**
|
||||
* 根据设备id获取温度测点映射表
|
||||
* @param deviceId 设备id
|
||||
* @return SysTabMappingVo
|
||||
*/
|
||||
List<SysTabMapping> getTemperatureMappingListByDeviceId(@Param("deviceId") Long deviceId);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import java.util.Map;
|
||||
* 首页相关Controller
|
||||
*/
|
||||
@Slf4j
|
||||
@RequestMapping("/api/home")
|
||||
@RequestMapping("/api/page/home")
|
||||
@RestController
|
||||
public class HomeController {
|
||||
|
||||
|
@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* 报表相关Controller
|
||||
*/
|
||||
@Slf4j
|
||||
@RequestMapping("/api/report/template")
|
||||
@RequestMapping("/api/page/report/template")
|
||||
@RestController
|
||||
public class ReportTemplateController {
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
package com.das.modules.page.controller;
|
||||
|
||||
import com.das.common.result.R;
|
||||
import com.das.modules.equipment.domain.dto.SysEquipmentDto;
|
||||
import com.das.modules.page.domian.vo.TemperatureLimitVo;
|
||||
import com.das.modules.page.service.TemperatureDashboardService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RequestMapping("/api/page/temperature")
|
||||
@RestController
|
||||
public class TemperatureDashboardController {
|
||||
@Autowired
|
||||
private TemperatureDashboardService service;
|
||||
|
||||
/**
|
||||
* 根据设备id获取温度限制设置
|
||||
* @param device 设备{id:XXX} 只用到id即可
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getTemperatureLimitByDeviceId")
|
||||
public R<List<TemperatureLimitVo>> getTemperatureLimitByDeviceId(@RequestBody SysEquipmentDto device){
|
||||
List<TemperatureLimitVo> windTurbinesPageVos = service.getTemperatureLimitByDeviceId(device.getId());
|
||||
return R.success(windTurbinesPageVos);
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.das.modules.page.domian.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 温度限制设置参数
|
||||
*/
|
||||
@Data
|
||||
public class TemperatureLimitVo {
|
||||
/**
|
||||
* 测点编号
|
||||
*/
|
||||
private String measPointCode;
|
||||
/**
|
||||
* 测点名称
|
||||
*/
|
||||
private String measPointName;
|
||||
|
||||
/**
|
||||
* 限制1 是否启用
|
||||
* 如果启用 则 limit1Low 表示下限 ;limit1High 表示上限
|
||||
*/
|
||||
private Boolean limit1Enable = false;
|
||||
/**
|
||||
* 限制2 是否启用
|
||||
* 如果启用 则 limit2Low 表示下下限 ;limit2High 表示上上限
|
||||
*/
|
||||
private Boolean limit2Enable = false;
|
||||
|
||||
private Double limit1High = 0.0;
|
||||
|
||||
private Double limit1Low= 0.0;
|
||||
|
||||
private Double limit2High= 0.0;
|
||||
|
||||
private Double limit2Low= 0.0;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.das.modules.page.service;
|
||||
|
||||
import com.das.modules.page.domian.vo.TemperatureLimitVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 温度管理页面
|
||||
*/
|
||||
public interface TemperatureDashboardService {
|
||||
/**
|
||||
* 根据设备id获取该设备对应的温度相关测点的限制配置信息
|
||||
* @param deviceId 设备id
|
||||
* @return 限制配置列表(如果限制未设置 则不返回对应测点信息)
|
||||
*/
|
||||
List<TemperatureLimitVo> getTemperatureLimitByDeviceId(Long deviceId);
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.das.modules.page.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.das.modules.node.entity.SysTabMapping;
|
||||
import com.das.modules.node.mapper.SysImpTabMappingMapper;
|
||||
import com.das.modules.page.domian.vo.TemperatureLimitVo;
|
||||
import com.das.modules.page.service.TemperatureDashboardService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class TemperatureDashboardServiceImpl implements TemperatureDashboardService {
|
||||
|
||||
@Autowired
|
||||
SysImpTabMappingMapper impTabMappingMapper;
|
||||
|
||||
@Override
|
||||
public List<TemperatureLimitVo> getTemperatureLimitByDeviceId(Long deviceId) {
|
||||
Map<String,TemperatureLimitVo> map = new HashMap<>();
|
||||
|
||||
List<SysTabMapping> mappings = impTabMappingMapper.getTemperatureMappingListByDeviceId(deviceId);
|
||||
if (mappings != null && !mappings.isEmpty()) {
|
||||
mappings.forEach(mapping -> {
|
||||
String params = mapping.getParams();
|
||||
if (params != null && !params.isEmpty()) {
|
||||
JSONObject json = JSONObject.parseObject(params);
|
||||
String code = json.getString("code");
|
||||
String name = json.getString("name");
|
||||
Double limit1High=0.0;
|
||||
Double limit1Low=0.0;
|
||||
Double limit2High=0.0;
|
||||
Double limit2Low=0.0;
|
||||
|
||||
int limit1Enable = json.getIntValue("limit1Enable");
|
||||
int limit2Enable = json.getIntValue("limit2Enable");
|
||||
if(limit1Enable==1){
|
||||
limit1High = json.getDouble("limit1High");
|
||||
limit1Low = json.getDouble("limit1Low");
|
||||
}
|
||||
if(limit2Enable==1){
|
||||
limit2High = json.getDouble("limit2High");
|
||||
limit2Low = json.getDouble("limit2Low");
|
||||
}
|
||||
TemperatureLimitVo vo = new TemperatureLimitVo();
|
||||
vo.setMeasPointCode(code);
|
||||
vo.setMeasPointName(name);
|
||||
vo.setLimit1Enable(limit1Enable==1);
|
||||
vo.setLimit2Enable(limit2Enable==1);
|
||||
vo.setLimit1High(limit1High);
|
||||
vo.setLimit1Low(limit1Low);
|
||||
vo.setLimit2High(limit2High);
|
||||
vo.setLimit2Low(limit2Low);
|
||||
if(vo.getLimit1Enable()||vo.getLimit2Enable()){
|
||||
map.put(code,vo);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return new ArrayList<>(map.values());
|
||||
}
|
||||
}
|
@ -113,4 +113,21 @@
|
||||
<delete id="deleteMappingByLinkId">
|
||||
delete from sys_imptabmapping where link_id = #{linkId}
|
||||
</delete>
|
||||
|
||||
<select id="getTemperatureMappingListByDeviceId" resultType="com.das.modules.node.entity.SysTabMapping">
|
||||
select
|
||||
t1.*
|
||||
from
|
||||
sys_imptabmapping t1,
|
||||
sys_equipment t2,
|
||||
sys_iot_model t3,
|
||||
sys_iot_model_field t4
|
||||
where
|
||||
t1.equipment_id = t2.id
|
||||
and t2.iot_model_id = t3.id
|
||||
and t3.id = t4.iot_model_id
|
||||
and t1.meas_point_code = t4.attribute_code
|
||||
and t4.attribute_type = 138 and t4.attribute_name like '%温度%'
|
||||
and t2.id = #{deviceId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -33,12 +33,13 @@ POST 请求接口
|
||||
|
||||
| 参数名 | 参数类型 | 必填 | 描述 |
|
||||
| ------------ |---------|-----|--------|
|
||||
| startTime | Long | True | 开始时间 |
|
||||
| endTime | Long | True | 结束时间 |
|
||||
| eventLevel | int | False | 事件等级0:告警,1:故障 |
|
||||
| deviceCode | List | True | 设备编码数组 |
|
||||
| pageNum | Integer | NO | 当前页 |
|
||||
| pageSize | Integer | NO | 每页显示大小 |
|
||||
| startTime | Long | true | 开始时间 |
|
||||
| endTime | Long | true | 结束时间 |
|
||||
| eventLevel | int | false | 事件等级0:告警,1:故障 |
|
||||
| deviceCode | List | true | 设备编码数组 |
|
||||
| limit | int | false | 非分页显示最近数据条数,与pageSize,pageNum不共存 |
|
||||
| pageNum | Integer | false | 当前页 |
|
||||
| pageSize | Integer | false | 每页显示大小 |
|
||||
|
||||
返回报文
|
||||
|
||||
@ -115,4 +116,3 @@ POST 请求接口
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import createAxios from '/@/utils/axios'
|
||||
import {addDataType, getDataReturnType, getDataType, getTreeDataReturnType} from "/@/views/backend/auth/org/type";
|
||||
import {RequestReturnType} from "/@/views/backend/auth/model/type";
|
||||
import {AlarmsTableType, GetAlarmsTableParam, RequestReturnRowType} from "/@/views/backend/alarms/type";
|
||||
|
||||
export const url = '/admin/Dashboard/'
|
||||
|
||||
@ -21,21 +22,38 @@ export const getInstitutionalListReq = (data: getDataType) => {
|
||||
|
||||
export function getWindFarmRealData(params: object = {}) {
|
||||
return createAxios({
|
||||
url: '/api/home/getWindFarmRealData',
|
||||
url: '/api/page/home/getWindFarmRealData',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
export function getWindTurbineMatrixData(params: object = {}) {
|
||||
return createAxios({
|
||||
url: '/api/home/getWindTurbineMatrixData',
|
||||
url: '/api/page/home/getWindTurbineMatrixData',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
export const getHistoryData = (data: { startTime: number, endTime: number, devices: { deviceId: string, attributes?: string[] }[],interval?:string }) => {
|
||||
return createAxios<never, RequestReturnType<any>>({
|
||||
url: '/api/home/getHistoryData',
|
||||
url: '/api/page/home/getHistoryData',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 告警列表
|
||||
export const getAlarmList = (params: object = {}) => {
|
||||
return createAxios({
|
||||
url: 'api/event/query',
|
||||
method: 'post',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
export const alertComfirm = (data: any) => {
|
||||
return createAxios({
|
||||
url: '/api/event/confirm',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user