优化算法和故障诊断逻辑(曲线和算法绑定)
This commit is contained in:
parent
d4cbebaaf4
commit
9fabff6be9
@ -54,8 +54,8 @@ public class AlgorithmDeviceController {
|
|||||||
@PostMapping("/getAlgorithmDeviceCurve")
|
@PostMapping("/getAlgorithmDeviceCurve")
|
||||||
@ApiOperation("查询算法部件的参数曲线")
|
@ApiOperation("查询算法部件的参数曲线")
|
||||||
public ResponseResult getAlgorithmDeviceCurve(String algorithmId, String componentId) {
|
public ResponseResult getAlgorithmDeviceCurve(String algorithmId, String componentId) {
|
||||||
Map<String, Object> algorithmDeviceCurve = algorithmDeviceService.getAlgorithmDeviceCurve(algorithmId,
|
List<Map<String, Object>> algorithmDeviceCurveList = algorithmDeviceService.getAlgorithmDeviceCurve(algorithmId,
|
||||||
componentId);
|
componentId);
|
||||||
return ResponseResult.successData(algorithmDeviceCurve);
|
return ResponseResult.successData(algorithmDeviceCurveList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,16 @@ public class AlgorithmParamsController {
|
|||||||
|
|
||||||
@GetMapping("/getAlgorithmParamsList")
|
@GetMapping("/getAlgorithmParamsList")
|
||||||
@ApiOperation("查询算法参数")
|
@ApiOperation("查询算法参数")
|
||||||
public ResponseResult getAlgorithmParamsList(String algorithmId) {
|
public ResponseResult getAlgorithmParamsList(String algorithmId,String componentId) {
|
||||||
List<Map<String, Object>> algorithmClassList = algorithmParamsService.getAlgorithmParamsList(algorithmId);
|
List<Map<String, Object>> algorithmClassList = algorithmParamsService.getAlgorithmParamsList(algorithmId,componentId);
|
||||||
|
return ResponseResult.successData(algorithmClassList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getAlgorithmParamsNameList")
|
||||||
|
@ApiOperation("根据算法id过去参数名称")
|
||||||
|
public ResponseResult getAlgorithmParamsNameList(String algorithmId) {
|
||||||
|
List<Map<String, Object>> algorithmClassList = algorithmParamsService.getAlgorithmParamsNameList(algorithmId);
|
||||||
return ResponseResult.successData(algorithmClassList);
|
return ResponseResult.successData(algorithmClassList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,4 +17,6 @@ import java.util.Map;
|
|||||||
public interface AlgorithmDeviceMapper extends BaseMapper<AlgorithmDevice> {
|
public interface AlgorithmDeviceMapper extends BaseMapper<AlgorithmDevice> {
|
||||||
|
|
||||||
List<Map<String, Object>> getAlgorithmDeviceParams(String algorithmId, String componentId);
|
List<Map<String, Object>> getAlgorithmDeviceParams(String algorithmId, String componentId);
|
||||||
|
|
||||||
|
List<Map<String, Object>> getAlgorithmDeviceType(String algorithmId, String componentId);
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public interface AlgorithmParamsMapper extends BaseMapper<AlgorithmParams> {
|
public interface AlgorithmParamsMapper extends BaseMapper<AlgorithmParams> {
|
||||||
|
|
||||||
List<Map<String, Object>> getAlgorithmParamsList(String algorithmId);
|
List<Map<String, Object>> getAlgorithmParamsList(String algorithmId,String componentId);
|
||||||
|
|
||||||
|
List<Map<String, Object>> getAlgorithmParamsNameList(String algorithmId);
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,6 @@ public interface IAlgorithmDeviceService extends IService<AlgorithmDevice> {
|
|||||||
|
|
||||||
List<Map<String, Object>> getAlgorithmDeviceParams(String algorithmId, String componentId);
|
List<Map<String, Object>> getAlgorithmDeviceParams(String algorithmId, String componentId);
|
||||||
|
|
||||||
Map<String, Object> getAlgorithmDeviceCurve(String algorithmId, String componentId);
|
List<Map<String, Object>> getAlgorithmDeviceCurve(String algorithmId, String componentId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public interface IAlgorithmParamsService extends IService<AlgorithmParams> {
|
public interface IAlgorithmParamsService extends IService<AlgorithmParams> {
|
||||||
|
|
||||||
List<Map<String, Object>> getAlgorithmParamsList(String algorithmId);
|
List<Map<String, Object>> getAlgorithmParamsList(String algorithmId,String componentId);
|
||||||
|
|
||||||
boolean addAlgorithmParams(AlgorithmParams algorithmParams);
|
boolean addAlgorithmParams(AlgorithmParams algorithmParams);
|
||||||
|
|
||||||
@ -26,4 +26,6 @@ public interface IAlgorithmParamsService extends IService<AlgorithmParams> {
|
|||||||
boolean batchUpdateAlgorithmParams(List<AlgorithmParams> algorithmParamsList);
|
boolean batchUpdateAlgorithmParams(List<AlgorithmParams> algorithmParamsList);
|
||||||
|
|
||||||
boolean deleteAlgorithmParams(String id);
|
boolean deleteAlgorithmParams(String id);
|
||||||
|
|
||||||
|
List<Map<String, Object>> getAlgorithmParamsNameList(String algorithmId);
|
||||||
}
|
}
|
||||||
|
@ -5,23 +5,20 @@ import cn.hutool.core.util.ObjUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmClass;
|
import com.yfd.platform.modules.algorithm.domain.*;
|
||||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmParams;
|
|
||||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmParamsRequest;
|
|
||||||
import com.yfd.platform.modules.algorithm.domain.TreeNode;
|
|
||||||
import com.yfd.platform.modules.algorithm.mapper.AlgorithmClassComponentMapper;
|
import com.yfd.platform.modules.algorithm.mapper.AlgorithmClassComponentMapper;
|
||||||
import com.yfd.platform.modules.algorithm.mapper.AlgorithmClassMapper;
|
import com.yfd.platform.modules.algorithm.mapper.AlgorithmClassMapper;
|
||||||
import com.yfd.platform.modules.algorithm.service.IAlgorithmClassService;
|
import com.yfd.platform.modules.algorithm.service.IAlgorithmClassService;
|
||||||
|
import com.yfd.platform.modules.algorithm.service.IAlgorithmDeviceService;
|
||||||
import com.yfd.platform.modules.algorithm.service.IAlgorithmParamsService;
|
import com.yfd.platform.modules.algorithm.service.IAlgorithmParamsService;
|
||||||
|
import com.yfd.platform.utils.SecurityUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
import java.util.stream.Collectors;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -37,7 +34,8 @@ public class AlgorithmClassServiceImpl extends ServiceImpl<AlgorithmClassMapper,
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IAlgorithmParamsService algorithmParamsService;
|
private IAlgorithmParamsService algorithmParamsService;
|
||||||
|
@Resource
|
||||||
|
private IAlgorithmDeviceService algorithmDeviceService;
|
||||||
@Resource
|
@Resource
|
||||||
private AlgorithmClassComponentMapper algorithmClassComponentMapper;
|
private AlgorithmClassComponentMapper algorithmClassComponentMapper;
|
||||||
|
|
||||||
@ -95,17 +93,39 @@ public class AlgorithmClassServiceImpl extends ServiceImpl<AlgorithmClassMapper,
|
|||||||
String uuid = IdUtil.fastSimpleUUID();
|
String uuid = IdUtil.fastSimpleUUID();
|
||||||
algorithmClass.setId(uuid);
|
algorithmClass.setId(uuid);
|
||||||
}
|
}
|
||||||
// String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
String currentUsername = "admin";
|
|
||||||
this.saveOrUpdate(algorithmClass);
|
this.saveOrUpdate(algorithmClass);
|
||||||
List<AlgorithmParams> algorithmParamsList = algorithmParamsRequest.getAlgorithmParamsList();
|
List<AlgorithmParams> algorithmParamsList = algorithmParamsRequest.getAlgorithmParamsList();
|
||||||
|
// 获取修改的参数id
|
||||||
|
Set<String> paramIdList =
|
||||||
|
algorithmParamsList.stream().filter(a -> StrUtil.isNotBlank(a.getId())).map(AlgorithmParams::getId).collect(Collectors.toSet());
|
||||||
|
|
||||||
|
// 排除修改的算法参数,删除掉其他算法参数和点位信息
|
||||||
|
|
||||||
|
LambdaQueryWrapper<AlgorithmDevice> deviceQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
deviceQueryWrapper.eq(AlgorithmDevice::getAlgorithmId, algorithmClass.getId());
|
||||||
|
if (paramIdList.size() > 0) {
|
||||||
|
deviceQueryWrapper.notIn(AlgorithmDevice::getParamId, paramIdList);
|
||||||
|
}
|
||||||
|
algorithmDeviceService.remove(deviceQueryWrapper);
|
||||||
|
|
||||||
|
LambdaQueryWrapper<AlgorithmParams> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(AlgorithmParams::getAlgorithmId, algorithmClass.getId());
|
||||||
|
if (paramIdList.size() > 0) {
|
||||||
|
queryWrapper.notIn(AlgorithmParams::getId, paramIdList);
|
||||||
|
}
|
||||||
|
algorithmParamsService.remove(queryWrapper);
|
||||||
|
|
||||||
algorithmParamsList.forEach(r -> {
|
algorithmParamsList.forEach(r -> {
|
||||||
r.setAlgorithmId(algorithmClass.getId());
|
r.setAlgorithmId(algorithmClass.getId());
|
||||||
r.setLastmodifier(currentUsername);
|
r.setLastmodifier(currentUsername);
|
||||||
r.setLastmodifydate(LocalDateTime.now());
|
r.setLastmodifydate(LocalDateTime.now());
|
||||||
});
|
});
|
||||||
|
if (algorithmParamsList.size() > 0) {
|
||||||
return algorithmParamsService.saveOrUpdateBatch(algorithmParamsList);
|
return algorithmParamsService.saveOrUpdateBatch(algorithmParamsList);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************
|
/***********************************
|
||||||
* 用途说明: 获取算法分类树
|
* 用途说明: 获取算法分类树
|
||||||
|
@ -1,18 +1,28 @@
|
|||||||
package com.yfd.platform.modules.algorithm.service.impl;
|
package com.yfd.platform.modules.algorithm.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmDevice;
|
import com.yfd.platform.modules.algorithm.domain.AlgorithmDevice;
|
||||||
import com.yfd.platform.modules.algorithm.mapper.AlgorithmDeviceMapper;
|
import com.yfd.platform.modules.algorithm.mapper.AlgorithmDeviceMapper;
|
||||||
import com.yfd.platform.modules.algorithm.service.IAlgorithmDeviceService;
|
import com.yfd.platform.modules.algorithm.service.IAlgorithmDeviceService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.yfd.platform.modules.auxcontrol.domain.DeviceSignal;
|
||||||
|
import com.yfd.platform.modules.auxcontrol.domain.DeviceWorkData;
|
||||||
|
import com.yfd.platform.modules.auxcontrol.mapper.DeviceSignalMapper;
|
||||||
|
import com.yfd.platform.modules.auxcontrol.service.IDeviceWorkDataService;
|
||||||
import com.yfd.platform.utils.SecurityUtils;
|
import com.yfd.platform.utils.SecurityUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -27,6 +37,10 @@ public class AlgorithmDeviceServiceImpl extends ServiceImpl<AlgorithmDeviceMappe
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AlgorithmDeviceMapper algorithmDeviceMapper;
|
private AlgorithmDeviceMapper algorithmDeviceMapper;
|
||||||
|
@Resource
|
||||||
|
private DeviceSignalMapper deviceSignalMapper;
|
||||||
|
@Resource
|
||||||
|
private IDeviceWorkDataService deviceWorkDataService;
|
||||||
|
|
||||||
/**********************************
|
/**********************************
|
||||||
* 用途说明: 批量新增算法分类部件点位关联数据
|
* 用途说明: 批量新增算法分类部件点位关联数据
|
||||||
@ -45,11 +59,98 @@ public class AlgorithmDeviceServiceImpl extends ServiceImpl<AlgorithmDeviceMappe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getAlgorithmDeviceParams(String algorithmId, String componentId) {
|
public List<Map<String, Object>> getAlgorithmDeviceParams(String algorithmId, String componentId) {
|
||||||
return algorithmDeviceMapper.getAlgorithmDeviceParams(algorithmId,componentId);
|
return algorithmDeviceMapper.getAlgorithmDeviceParams(algorithmId, componentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getAlgorithmDeviceCurve(String algorithmId, String componentId) {
|
public List<Map<String, Object>> getAlgorithmDeviceCurve(String algorithmId, String componentId) {
|
||||||
return null;
|
List<Map<String, Object>> list = algorithmDeviceMapper.getAlgorithmDeviceType(algorithmId, componentId);
|
||||||
|
Map<String, List<String>> groupedDevices = list.stream()
|
||||||
|
.filter(map -> map.containsKey("sourceType") && map.get("sourceType") != null)
|
||||||
|
.filter(map -> map.containsKey("deviceId") && map.get("deviceId") != null)
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
map -> ((String) map.get("sourceType")).trim(), // 去除前后空格
|
||||||
|
Collectors.mapping(
|
||||||
|
map -> ((String) map.get("deviceId")).trim(),
|
||||||
|
Collectors.toList() // 或 Collectors.toSet() 去重
|
||||||
|
)
|
||||||
|
));
|
||||||
|
List<Map<String, Object>> deviceDataList = new ArrayList<>();
|
||||||
|
List<String> deviceIdList = groupedDevices.get("1");
|
||||||
|
List<String> signalIdList = groupedDevices.get("2");
|
||||||
|
if (deviceIdList != null && deviceIdList.size() > 0) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (signalIdList != null && signalIdList.size() > 0) {
|
||||||
|
List<DeviceWorkData> deviceWorkDataList = deviceWorkDataService.getHistoricalCurveList(signalIdList);
|
||||||
|
Map<String, List<DeviceWorkData>> collect =
|
||||||
|
deviceWorkDataList.stream().collect(Collectors.groupingBy(DeviceWorkData::getSignalId));
|
||||||
|
for (String signalId : collect.keySet()) {
|
||||||
|
List<DeviceWorkData> deviceWorkDataGroup = collect.get(signalId);
|
||||||
|
Map<String, Object> map = processDeviceData(deviceWorkDataGroup, signalId);
|
||||||
|
deviceDataList.add(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return deviceDataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> processDeviceData(List<DeviceWorkData> deviceWorkDataList, String signalId) {
|
||||||
|
// 生成过去60分钟的分钟时间槽
|
||||||
|
LocalDateTime now = LocalDateTime.now().truncatedTo(ChronoUnit.MINUTES);
|
||||||
|
LocalDateTime startTime = now.minusMinutes(59);
|
||||||
|
List<LocalDateTime> minuteSlots = new ArrayList<>();
|
||||||
|
for (int i = 0; i < 60; i++) {
|
||||||
|
minuteSlots.add(startTime.plusMinutes(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按分钟分组数据
|
||||||
|
Map<LocalDateTime, String> minuteDataMap = new HashMap<>();
|
||||||
|
for (DeviceWorkData data : deviceWorkDataList) {
|
||||||
|
LocalDateTime minuteKey = data.getStartTime().truncatedTo(ChronoUnit.MINUTES);
|
||||||
|
minuteDataMap.put(minuteKey, data.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建xAxis和series数据
|
||||||
|
List<String> xAxisData = new ArrayList<>();
|
||||||
|
List<Double> seriesData = new ArrayList<>();
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH时mm分");
|
||||||
|
for (LocalDateTime slot : minuteSlots) {
|
||||||
|
xAxisData.add(slot.format(formatter));
|
||||||
|
String value = minuteDataMap.getOrDefault(slot, "0");
|
||||||
|
if (!NumberUtil.isDouble(value)) {
|
||||||
|
value = "0";
|
||||||
|
}
|
||||||
|
seriesData.add(NumberUtil.parseDouble(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建ECharts数据结构
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
|
||||||
|
Map<String, Object> xAxis = new HashMap<>();
|
||||||
|
xAxis.put("type", "category");
|
||||||
|
xAxis.put("data", xAxisData);
|
||||||
|
result.put("xAxis", xAxis);
|
||||||
|
|
||||||
|
Map<String, Object> yAxis = new HashMap<>();
|
||||||
|
yAxis.put("type", "value");
|
||||||
|
result.put("yAxis", yAxis);
|
||||||
|
DeviceSignal deviceSignal = deviceSignalMapper.selectById(signalId);
|
||||||
|
String name = deviceSignal == null ? "" : deviceSignal.getSignalName();
|
||||||
|
List<Map<String, Object>> seriesList = new ArrayList<>();
|
||||||
|
Map<String, Object> series = new HashMap<>();
|
||||||
|
series.put("name", name);
|
||||||
|
series.put("type", "line");
|
||||||
|
series.put("data", seriesData);
|
||||||
|
seriesList.add(series);
|
||||||
|
|
||||||
|
// 如果需要多个系列,可以继续添加
|
||||||
|
// 例如复制series并修改name和step
|
||||||
|
|
||||||
|
result.put("series", seriesList);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,8 @@ public class AlgorithmParamsServiceImpl extends ServiceImpl<AlgorithmParamsMappe
|
|||||||
private AlgorithmParamsMapper algorithmParamsMapper;
|
private AlgorithmParamsMapper algorithmParamsMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getAlgorithmParamsList(String algorithmId) {
|
public List<Map<String, Object>> getAlgorithmParamsList(String algorithmId,String componentId) {
|
||||||
return algorithmParamsMapper.getAlgorithmParamsList(algorithmId);
|
return algorithmParamsMapper.getAlgorithmParamsList(algorithmId,componentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -48,4 +48,9 @@ public class AlgorithmParamsServiceImpl extends ServiceImpl<AlgorithmParamsMappe
|
|||||||
public boolean deleteAlgorithmParams(String id) {
|
public boolean deleteAlgorithmParams(String id) {
|
||||||
return this.removeById(id);
|
return this.removeById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getAlgorithmParamsNameList(String algorithmId) {
|
||||||
|
return algorithmParamsMapper.getAlgorithmParamsNameList(algorithmId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,5 +36,9 @@ public interface DeviceWorkDataMapper extends BaseMapper<DeviceWorkData> {
|
|||||||
***********************************/
|
***********************************/
|
||||||
List<DeviceWorkData> getHistoricalCurve(String signalId);
|
List<DeviceWorkData> getHistoricalCurve(String signalId);
|
||||||
|
|
||||||
|
|
||||||
List<Map<String, Object>> getDeviceWorkData(String stationId);
|
List<Map<String, Object>> getDeviceWorkData(String stationId);
|
||||||
|
|
||||||
|
List<DeviceWorkData> getHistoricalCurveList(List<String> signalIdList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,13 @@ public interface IDeviceWorkDataService extends IService<DeviceWorkData> {
|
|||||||
***********************************/
|
***********************************/
|
||||||
List<DeviceWorkData> getHistoricalCurve(String signalId);
|
List<DeviceWorkData> getHistoricalCurve(String signalId);
|
||||||
|
|
||||||
|
/**********************************
|
||||||
|
* 用途说明: 查询历史曲线
|
||||||
|
* 参数说明 signalList 信号id集合
|
||||||
|
* 返回值说明: java.util.List<com.yfd.platform.modules.auxcontrol.domain.DeviceWorkData>
|
||||||
|
***********************************/
|
||||||
|
List<DeviceWorkData> getHistoricalCurveList(List<String> signalIdList);
|
||||||
|
|
||||||
List<Map<String, Object>> getDeviceWorkData(String stationId);
|
List<Map<String, Object>> getDeviceWorkData(String stationId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -94,6 +94,11 @@ public class DeviceWorkDataServiceImpl extends ServiceImpl<DeviceWorkDataMapper,
|
|||||||
return deviceWorkDataMapper.getHistoricalCurve(signalId);
|
return deviceWorkDataMapper.getHistoricalCurve(signalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceWorkData> getHistoricalCurveList(List<String> signalIdList) {
|
||||||
|
return deviceWorkDataMapper.getHistoricalCurveList(signalIdList);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getDeviceWorkData(String stationId) {
|
public List<Map<String, Object>> getDeviceWorkData(String stationId) {
|
||||||
return deviceWorkDataMapper.getDeviceWorkData(stationId);
|
return deviceWorkDataMapper.getDeviceWorkData(stationId);
|
||||||
|
@ -20,4 +20,20 @@
|
|||||||
AND ad.component_id LIKE CONCAT('%',#{componentId},'%')
|
AND ad.component_id LIKE CONCAT('%',#{componentId},'%')
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getAlgorithmDeviceType" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
ad.device_id,
|
||||||
|
ad.source_type
|
||||||
|
FROM
|
||||||
|
iis_algorithm_params ap
|
||||||
|
INNER JOIN iis_algorithm_device ad ON ap.id = ad.param_id
|
||||||
|
WHERE
|
||||||
|
ap.param_fixed = '0'
|
||||||
|
<if test="algorithmId != null and algorithmId != ''">
|
||||||
|
AND ad.algorithm_id LIKE CONCAT('%',#{algorithmId},'%')
|
||||||
|
</if>
|
||||||
|
<if test="componentId != null and componentId != ''">
|
||||||
|
AND ad.component_id LIKE CONCAT('%',#{componentId},'%')
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -21,11 +21,28 @@
|
|||||||
ap.id
|
ap.id
|
||||||
FROM
|
FROM
|
||||||
iis_algorithm_params ap
|
iis_algorithm_params ap
|
||||||
LEFT JOIN iis_algorithm_device ad ON ap.id = ad.param_id
|
LEFT JOIN iis_algorithm_device ad
|
||||||
|
ON ap.id = ad.param_id
|
||||||
|
<!-- 动态添加 component_id 匹配条件 -->
|
||||||
|
<if test="componentId != null and componentId != ''">
|
||||||
|
AND ad.component_id = #{componentId}
|
||||||
|
</if>
|
||||||
WHERE 1=1
|
WHERE 1=1
|
||||||
<if test="algorithmId != null and algorithmId != ''">
|
<if test="algorithmId != null and algorithmId != ''">
|
||||||
AND ap.algorithm_id = #{algorithmId}
|
AND ap.algorithm_id = #{algorithmId}
|
||||||
</if>
|
</if>
|
||||||
|
</select>
|
||||||
|
<select id="getAlgorithmParamsNameList" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
param_name,
|
||||||
|
param_type,
|
||||||
|
param_unit
|
||||||
|
FROM
|
||||||
|
iis_algorithm_params
|
||||||
|
WHERE 1=1
|
||||||
|
<if test="algorithmId != null and algorithmId != ''">
|
||||||
|
AND algorithm_id = #{algorithmId}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -56,4 +56,22 @@
|
|||||||
sc.component_name = '微气象设备部件'
|
sc.component_name = '微气象设备部件'
|
||||||
ORDER BY orderno
|
ORDER BY orderno
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getHistoricalCurveList" resultType="com.yfd.platform.modules.auxcontrol.domain.DeviceWorkData">
|
||||||
|
SELECT
|
||||||
|
start_time,
|
||||||
|
`value`,
|
||||||
|
unit,
|
||||||
|
signal_id
|
||||||
|
FROM
|
||||||
|
fk_device_work_data
|
||||||
|
WHERE
|
||||||
|
1=1 and signal_id IN
|
||||||
|
<foreach collection="signalIdList" item="signalId" open="(" separator=","
|
||||||
|
close=")">
|
||||||
|
#{signalId}
|
||||||
|
</foreach>
|
||||||
|
AND start_time >= NOW() - INTERVAL 1 HOUR
|
||||||
|
ORDER BY
|
||||||
|
start_time DESC
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
Reference in New Issue
Block a user