fix:优化逻辑
优化辅控系统信号相关逻辑
This commit is contained in:
parent
c045ddc7bd
commit
094ee4012b
@ -101,9 +101,12 @@ public class IEC61850Service {
|
||||
* type 类型(yk、yt)
|
||||
* value
|
||||
*/
|
||||
public boolean sendCommand(String systemcode, String signalid, String type, String value) throws IOException,
|
||||
public boolean sendCommand(String systemcode, String signalid, String type, String deviceType, String value) throws IOException,
|
||||
ServiceError {
|
||||
|
||||
// value = getControlValue(deviceType, value);
|
||||
// if (StrUtil.isBlank(value)) {
|
||||
// return false;
|
||||
// }
|
||||
DeviceSignal deviceSignal = deviceSignalService.getById(signalid);
|
||||
//辅控系统下属网关机状态监控
|
||||
if (StrUtil.isNotEmpty(systemcode) && "10".equals(systemcode)) {
|
||||
@ -180,5 +183,26 @@ public class IEC61850Service {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取控制值
|
||||
*
|
||||
* @param type 类型
|
||||
* @param value 值
|
||||
* @return
|
||||
*/
|
||||
public String getControlValue(String type, String value) {
|
||||
|
||||
if ("7".equals(type)) {
|
||||
return value.equals("1") ? "false" : "true";
|
||||
}
|
||||
if ("14".equals(type)) {
|
||||
return value.equals("1") ? "false" : "true";
|
||||
}
|
||||
if ("20".equals(type)) {
|
||||
return value.equals("1") ? "false" : "true";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -61,17 +61,14 @@ public class IECController {
|
||||
***********************************/
|
||||
@GetMapping("/sendCommand")
|
||||
@ApiOperation("发送遥控遥调命令")
|
||||
public ResponseResult sendCommand(String systemcode, String signalid, String type, String value) throws Exception {
|
||||
if (StrUtil.isBlank(signalid)) {
|
||||
public ResponseResult sendCommand(String systemcode, String signalId, String type,String deviceType, String value) throws Exception {
|
||||
if (StrUtil.isBlank(signalId)) {
|
||||
return ResponseResult.error("信号ID不能为空!");
|
||||
}
|
||||
DeviceSignal deviceSignal = deviceSignalService.getById(signalid);
|
||||
DeviceSignal deviceSignal = deviceSignalService.getById(signalId);
|
||||
if (ObjUtil.isNotEmpty(deviceSignal)) {
|
||||
LambdaQueryWrapper<MeterDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||
//型号对应的监控设备id
|
||||
queryWrapper.eq(MeterDevice::getDeviceId, deviceSignal.getMeterDeviceId());
|
||||
//查找信号对应监控设备
|
||||
MeterDevice meterDevice = meterDeviceService.getOne(queryWrapper);
|
||||
MeterDevice meterDevice = meterDeviceService.getById(deviceSignal.getMeterDeviceId());
|
||||
LambdaQueryWrapper<GatewayDevice> queryWrapper2 = new LambdaQueryWrapper<>();
|
||||
//IP地址
|
||||
queryWrapper2.eq(GatewayDevice::getIpAddr, meterDevice.getNetdeviceIp());
|
||||
@ -81,9 +78,9 @@ public class IECController {
|
||||
return ResponseResult.error("组件未关联信号!");
|
||||
}
|
||||
if ("IEC104".equals(netDevice.getProtocol())) {
|
||||
iec104Service.sendCommand(systemcode, signalid, type, value);
|
||||
iec104Service.sendCommand(systemcode, signalId, type, value);
|
||||
} else if ("IEC61850".equals(netDevice.getProtocol())) {
|
||||
iec61850Service.sendCommand(systemcode, signalid, type, value);
|
||||
iec61850Service.sendCommand(systemcode, signalId, type,deviceType, value);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
} else {
|
||||
|
@ -130,7 +130,9 @@
|
||||
</select>
|
||||
<select id="queryYxData" resultType="java.util.Map">
|
||||
SELECT
|
||||
md.systemcode,
|
||||
md.device_type,
|
||||
ds.signal_id,
|
||||
ds.signal_name,
|
||||
ds.signal_code,
|
||||
ds.yx_addr,
|
||||
@ -142,13 +144,15 @@
|
||||
WHERE
|
||||
ds.yx_addr IS NOT NULL
|
||||
AND ds.yx_addr != ''
|
||||
AND md.status != '00'
|
||||
AND md.device_type IN ('07','14','20')
|
||||
<if test="stationId != null and stationId != ''">
|
||||
AND md.station_id = #{stationId}
|
||||
</if>
|
||||
<if test="areaId != null and areaId != ''">
|
||||
AND md.region = #{areaId}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
<if test="type != null and type != '' and type !='all'">
|
||||
AND md.device_type = #{type}
|
||||
</if>
|
||||
ORDER BY
|
||||
@ -156,6 +160,7 @@
|
||||
ds.signal_code
|
||||
</select>
|
||||
|
||||
|
||||
<select id="countDeviceTypeStatus" resultType="java.util.Map">
|
||||
SELECT
|
||||
IFNULL(md.device_type, 'all') AS device_type,
|
||||
@ -167,13 +172,15 @@
|
||||
WHERE
|
||||
ds.yx_addr IS NOT NULL
|
||||
AND ds.yx_addr != ''
|
||||
AND md.status != '00'
|
||||
AND md.device_type IN ('07','14','20')
|
||||
<if test="stationId != null and stationId != ''">
|
||||
AND md.station_id = #{stationId}
|
||||
</if>
|
||||
<if test="areaId != null and areaId != ''">
|
||||
AND md.region = #{areaId}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
<if test="type != null and type != '' and type !='all'">
|
||||
AND md.device_type = #{type}
|
||||
</if>
|
||||
GROUP BY
|
||||
@ -181,4 +188,36 @@
|
||||
ORDER BY
|
||||
md.device_type;
|
||||
</select>
|
||||
<!-- <select id="countDeviceTypeStatus" resultType="java.util.Map">-->
|
||||
<!-- SELECT-->
|
||||
<!-- IFNULL( dict.itemcode, 'all' ) AS device_type,-->
|
||||
<!-- COUNT( md.device_id ) AS total,-->
|
||||
<!-- SUM( CASE WHEN md.STATUS = '01' THEN 1 ELSE 0 END ) AS online_count-->
|
||||
<!-- FROM-->
|
||||
<!-- sys_dictionary_items dict-->
|
||||
<!-- LEFT JOIN (-->
|
||||
<!-- fk_device_signal ds-->
|
||||
<!-- INNER JOIN fk_meter_device md ON ds.meter_device_id = md.device_id-->
|
||||
<!-- AND md.STATUS != '00' -->
|
||||
<!-- AND ds.yx_addr IS NOT NULL-->
|
||||
<!-- <if test="stationId != null and stationId != ''">-->
|
||||
<!-- AND md.station_id = #{stationId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="areaId != null and areaId != ''">-->
|
||||
<!-- AND md.region = #{areaId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="type != null and type != '' and type !='all'">-->
|
||||
<!-- AND md.device_type = #{type}-->
|
||||
<!-- </if>-->
|
||||
<!-- AND ds.yx_addr != ''-->
|
||||
<!-- ) ON dict.itemcode = md.device_type-->
|
||||
<!-- WHERE-->
|
||||
<!-- dict.dictid = '8f9b538c754fe32c2d000c773a3198ae'-->
|
||||
<!-- AND dict.itemcode IN ( '07', '14', '20' )-->
|
||||
<!-- GROUP BY-->
|
||||
<!-- dict.itemcode WITH ROLLUP-->
|
||||
<!-- ORDER BY-->
|
||||
<!-- dict.itemcode;-->
|
||||
<!-- </select>-->
|
||||
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user