优化部分之前代码逻辑
This commit is contained in:
parent
a4be773f45
commit
ffb629c51a
@ -54,6 +54,8 @@ public class AlarmThresholdController {
|
||||
Map<String, Object> m = new HashMap<>(BeanUtil.beanToMap(alarmThreshold));
|
||||
Map<String, String> thresholdInterval = alarmThresholdService.getThresholdInterval(id);
|
||||
m.putAll(thresholdInterval);
|
||||
|
||||
// Map<String, String> thresholdInterval1=alarmThresholdService.getAlgorithmModelById(id);
|
||||
return ResponseResult.successData(m);
|
||||
}
|
||||
|
||||
|
@ -99,33 +99,17 @@ public class LinkageSignalController {
|
||||
@ApiOperation("根据联动信号Id查询绑定的巡视信息")
|
||||
public ResponseResult getSubstationDeviceListById(String id) {
|
||||
LinkageSignal linkageSignal = linkageSignalService.getById(id);
|
||||
String deviceIdList = linkageSignal.getDeviceIdList();
|
||||
//String videoPos = linkageSignal.getVideoPos();
|
||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||
if (StrUtil.isNotBlank(deviceIdList)) {
|
||||
String[] split = deviceIdList.split(",");
|
||||
for (String s : split) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
SubstationDevice substationDevice = substationDeviceService.getById(s);
|
||||
if (substationDevice == null) {
|
||||
continue;
|
||||
}
|
||||
map.put("deviceId", substationDevice.getDeviceId());
|
||||
map.put("deviceName", substationDevice.getDeviceName());
|
||||
map.put("stationName", substationDevice.getStationName());
|
||||
map.put("stationCode", substationDevice.getStationCode());
|
||||
map.put("areaName", substationDevice.getAreaName());
|
||||
map.put("bayName", substationDevice.getBayName());
|
||||
map.put("areaId", substationDevice.getAreaId());
|
||||
map.put("bayId", substationDevice.getBayId());
|
||||
mapList.add(map);
|
||||
}
|
||||
} /*else if (StrUtil.isNotBlank(videoPos)) {
|
||||
List<Map> list = JSONUtil.toList(videoPos, Map.class);
|
||||
for (Map map : list) {
|
||||
mapList.add(map);
|
||||
}
|
||||
}*/
|
||||
String deviceIdListStr = linkageSignal.getDeviceIdList();
|
||||
List<String> deviceIdList = StrUtil.split(deviceIdListStr, ",");
|
||||
if (deviceIdList.size() <= 0) {
|
||||
return ResponseResult.successData(new ArrayList<>());
|
||||
}
|
||||
LambdaQueryWrapper<SubstationDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(SubstationDevice::getDeviceId, deviceIdList).select(SubstationDevice::getDeviceId,
|
||||
SubstationDevice::getDeviceName, SubstationDevice::getStationName, SubstationDevice::getStationCode,
|
||||
SubstationDevice::getAreaName, SubstationDevice::getAreaId, SubstationDevice::getBayId,
|
||||
SubstationDevice::getBayName);
|
||||
List<Map<String, Object>> mapList = substationDeviceService.listMaps(queryWrapper);
|
||||
return ResponseResult.successData(mapList);
|
||||
}
|
||||
|
||||
|
@ -16,4 +16,6 @@ import java.util.Map;
|
||||
public interface AlarmThresholdMapper extends BaseMapper<AlarmThreshold> {
|
||||
|
||||
Map<String, String> getThresholdInterval(String deviceId);
|
||||
|
||||
Map<String, String> getAlgorithmModelById(String id);
|
||||
}
|
||||
|
@ -16,4 +16,6 @@ import java.util.Map;
|
||||
public interface IAlarmThresholdService extends IService<AlarmThreshold> {
|
||||
|
||||
Map<String, String> getThresholdInterval(String deviceId);
|
||||
|
||||
Map<String, String> getAlgorithmModelById(String id);
|
||||
}
|
||||
|
@ -26,4 +26,9 @@ public class AlarmThresholdServiceImpl extends ServiceImpl<AlarmThresholdMapper,
|
||||
public Map<String, String> getThresholdInterval(String deviceId) {
|
||||
return alarmThresholdMapper.getThresholdInterval(deviceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAlgorithmModelById(String id) {
|
||||
return alarmThresholdMapper.getAlgorithmModelById(id);
|
||||
}
|
||||
}
|
||||
|
@ -16,4 +16,17 @@
|
||||
iis_alarm_threshold
|
||||
WHERE device_id = #{deviceId}
|
||||
</select>
|
||||
<select id="getAlgorithmModelById" resultType="java.util.Map">
|
||||
SELECT
|
||||
device_id deviceId,
|
||||
MAX(CASE WHEN (alarm_level = '1' AND decide_rule ='6') THEN base_line_value ELSE NULL END) AS commonLower,
|
||||
MAX(CASE WHEN (alarm_level = '1' AND decide_rule ='7') THEN base_line_value ELSE NULL END) AS commonUpper,
|
||||
MAX(CASE WHEN (alarm_level = '2' AND decide_rule ='6') THEN base_line_value ELSE NULL END) AS seriousLower,
|
||||
MAX(CASE WHEN (alarm_level = '2' AND decide_rule ='7') THEN base_line_value ELSE NULL END) AS seriousUpper,
|
||||
MAX(CASE WHEN (alarm_level = '3' AND decide_rule ='6') THEN base_line_value ELSE NULL END) AS dangerLower,
|
||||
MAX(CASE WHEN (alarm_level = '3' AND decide_rule ='7') THEN base_line_value ELSE NULL END) AS dangerUpper
|
||||
FROM
|
||||
iis_alarm_threshold
|
||||
WHERE device_id = #{deviceId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user