feat(auxcontrol):新增智能控制逻辑
新增了智能控制设备数量统计和智能设备查询
This commit is contained in:
parent
11f67db5e4
commit
659d162c11
@ -78,11 +78,18 @@ public class DeviceSignalController {
|
||||
***********************************/
|
||||
@GetMapping("/queryYxData")
|
||||
@ApiOperation("查询遥信数据")
|
||||
public ResponseResult queryYxData(Page<Map<String, Object>> page, String areaId, String type) {
|
||||
Page<Map<String, Object>> mapPage = deviceSignalService.queryYxData(page, areaId, type);
|
||||
public ResponseResult queryYxData(Page<Map<String, Object>> page, String areaId, String type,String stationId) {
|
||||
Page<Map<String, Object>> mapPage = deviceSignalService.queryYxData(page, areaId, type,stationId);
|
||||
return ResponseResult.successData(mapPage);
|
||||
}
|
||||
|
||||
@GetMapping("/countDeviceTypeStatus")
|
||||
@ApiOperation("查询遥信数据统计")
|
||||
public ResponseResult countDeviceTypeStatus(String areaId, String type,String stationId) {
|
||||
List<Map<String, Object>> mapList = deviceSignalService.countDeviceTypeStatus(areaId, type,stationId);
|
||||
return ResponseResult.successData(mapList);
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 查询信号信息
|
||||
* 参数说明
|
||||
|
@ -19,16 +19,24 @@ import java.util.Map;
|
||||
public interface DeviceSignalMapper extends BaseMapper<DeviceSignal> {
|
||||
|
||||
DeviceSignal selectOneDeviceSignal(String slaveIp, String type, String address);
|
||||
Map<String,Object> selectDeviceSignalMap(String slaveIp, String type, String address);
|
||||
|
||||
Map<String, Object> selectDeviceSignalMap(String slaveIp, String type, String address);
|
||||
|
||||
List<Map<String, Object>> getDeviceSignalMaps(String stationCode, String signalName);
|
||||
|
||||
List<DeviceSignal> selectDeviceSignalByIp(String ip);
|
||||
@Update("UPDATE fk_device_signal SET yc_value = #{value}, lastmodifydate = #{datetime} WHERE yc_addr = #{node_addr}")
|
||||
boolean updateDeviceSignalValue_yc(String node_addr,String value,String datetime);
|
||||
@Update("UPDATE fk_device_signal SET yx_value = #{value}, lastmodifydate = #{datetime} WHERE yx_addr = #{node_addr}")
|
||||
boolean updateDeviceSignalValue_yx(String node_addr,String value,String datetime);
|
||||
|
||||
@Update("UPDATE fk_device_signal SET yc_value = #{value}, lastmodifydate = #{datetime} WHERE yc_addr = " +
|
||||
"#{node_addr}")
|
||||
boolean updateDeviceSignalValue_yc(String node_addr, String value, String datetime);
|
||||
|
||||
@Update("UPDATE fk_device_signal SET yx_value = #{value}, lastmodifydate = #{datetime} WHERE yx_addr = " +
|
||||
"#{node_addr}")
|
||||
boolean updateDeviceSignalValue_yx(String node_addr, String value, String datetime);
|
||||
|
||||
Map<String, Object> querySignalDataById(String signalId);
|
||||
|
||||
Page<Map<String, Object>> queryYxData(Page<Map<String, Object>> page, String areaId, String type);
|
||||
Page<Map<String, Object>> queryYxData(Page<Map<String, Object>> page, String areaId, String type, String stationId);
|
||||
|
||||
List<Map<String, Object>> countDeviceTypeStatus(String areaId, String type, String stationId);
|
||||
}
|
||||
|
@ -69,5 +69,8 @@ public interface IDeviceSignalService extends IService<DeviceSignal> {
|
||||
***********************************/
|
||||
Map<String, Object> querySignalDataById(String signalId);
|
||||
|
||||
Page<Map<String, Object>> queryYxData(Page<Map<String, Object>> page, String areaId, String type);
|
||||
Page<Map<String, Object>> queryYxData(Page<Map<String, Object>> page, String areaId, String type,String stationId);
|
||||
|
||||
List<Map<String, Object>> countDeviceTypeStatus(String areaId, String type, String stationId);
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import javax.annotation.Resource;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -58,7 +59,7 @@ public class DeviceSignalServiceImpl extends ServiceImpl<DeviceSignalMapper, Dev
|
||||
} else {
|
||||
// 遥测
|
||||
deviceSignal.setYcValue(value);
|
||||
// deviceSignal.setYcValue(Convert.toBigDecimal(value));
|
||||
// deviceSignal.setYcValue(Convert.toBigDecimal(value));
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// 处理转换异常,例如返回false或抛出更具体的异常
|
||||
@ -161,7 +162,8 @@ public class DeviceSignalServiceImpl extends ServiceImpl<DeviceSignalMapper, Dev
|
||||
* .DeviceSignal>
|
||||
***********************************/
|
||||
@Override
|
||||
public Page<DeviceSignal> getDeviceSignalPage(String systemcode,String meterDeviceId,String mainDeviceId, String componentId, String signalName,
|
||||
public Page<DeviceSignal> getDeviceSignalPage(String systemcode, String meterDeviceId, String mainDeviceId,
|
||||
String componentId, String signalName,
|
||||
Page<DeviceSignal> page) {
|
||||
LambdaQueryWrapper<DeviceSignal> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StrUtil.isNotBlank(systemcode)) {
|
||||
@ -210,7 +212,13 @@ public class DeviceSignalServiceImpl extends ServiceImpl<DeviceSignalMapper, Dev
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Map<String, Object>> queryYxData(Page<Map<String, Object>> page, String areaId, String type) {
|
||||
return deviceSignalMapper.queryYxData(page, areaId, type);
|
||||
public Page<Map<String, Object>> queryYxData(Page<Map<String, Object>> page, String areaId, String type,
|
||||
String stationId) {
|
||||
return deviceSignalMapper.queryYxData(page, areaId, type, stationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> countDeviceTypeStatus(String areaId, String type, String stationId) {
|
||||
return deviceSignalMapper.countDeviceTypeStatus(areaId, type, stationId);
|
||||
}
|
||||
}
|
||||
|
@ -115,9 +115,11 @@ public class SubstationMaindeviceController {
|
||||
}
|
||||
LambdaQueryWrapper<SubstationMaindevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StrUtil.isNotBlank(stationCode), SubstationMaindevice::getStationCode, stationCode);
|
||||
queryWrapper.in(StrUtil.isNotBlank(deviceTypeList), SubstationMaindevice::getDeviceType, StrUtil.split(deviceTypeList
|
||||
, ","));
|
||||
queryWrapper.select(SubstationMaindevice::getMainDeviceId,SubstationMaindevice::getAreaId,SubstationMaindevice::getAreaName, SubstationMaindevice::getMainDeviceName,
|
||||
queryWrapper.in(StrUtil.isNotBlank(deviceTypeList), SubstationMaindevice::getDeviceType,
|
||||
StrUtil.split(deviceTypeList
|
||||
, ","));
|
||||
queryWrapper.select(SubstationMaindevice::getMainDeviceId, SubstationMaindevice::getAreaId,
|
||||
SubstationMaindevice::getAreaName, SubstationMaindevice::getMainDeviceName,
|
||||
SubstationMaindevice::getDeviceType, SubstationMaindevice::getFileUrl);
|
||||
queryWrapper.eq(SubstationMaindevice::getDatastatus, "1");
|
||||
List<Map<String, Object>> maps = substationMaindeviceService.listMaps(queryWrapper);
|
||||
@ -321,11 +323,15 @@ public class SubstationMaindeviceController {
|
||||
if (count > 0) {
|
||||
return ResponseResult.error("当前间隔下已经存在该主设备");
|
||||
}
|
||||
int count2 =
|
||||
substationDeviceService.count(new LambdaQueryWrapper<SubstationDevice>().eq(SubstationDevice::getMainDeviceId, mainDeviceId));
|
||||
if (count2 > 0) {
|
||||
return ResponseResult.error("当前主设备有点位关联不能修改");
|
||||
if (StrUtil.isNotBlank(mainDeviceId) && StrUtil.isNotBlank(mainDeviceName)) {
|
||||
int count2 =
|
||||
substationDeviceService.count(new LambdaQueryWrapper<SubstationDevice>().eq
|
||||
(SubstationDevice::getMainDeviceId, mainDeviceId).ne(SubstationDevice::getMainDeviceName,mainDeviceName));
|
||||
if (count2 > 0 && file == null) {
|
||||
return ResponseResult.error("当前主设备有点位关联不能修改名称");
|
||||
}
|
||||
}
|
||||
|
||||
substationMaindevice.setLastmodifier(SecurityUtils.getCurrentUsername());
|
||||
substationMaindevice.setLastmodifydate(LocalDateTime.now());
|
||||
// 文件上传逻辑
|
||||
|
@ -22,7 +22,14 @@
|
||||
</select>
|
||||
<select id="getMainDeviceInfo" resultType="java.util.Map">
|
||||
SELECT
|
||||
sm.*
|
||||
sm.main_device_id,
|
||||
sm.device_type,
|
||||
sm.main_device_name,
|
||||
sm.area_name,
|
||||
sm.patroldevice_json,
|
||||
sm.file_url,
|
||||
sm.factory_lifespan,
|
||||
sm.run_time
|
||||
FROM
|
||||
`iis_substation_component` sc
|
||||
INNER JOIN iis_substation_maindevice sm ON sc.main_device_id = sm.main_device_id
|
||||
|
@ -134,14 +134,20 @@
|
||||
ds.signal_name,
|
||||
ds.signal_code,
|
||||
ds.yx_addr,
|
||||
ds.yx_value
|
||||
ds.yx_value,
|
||||
md.`status`
|
||||
FROM
|
||||
fk_device_signal ds
|
||||
INNER JOIN fk_meter_device md ON ds.meter_device_id = md.device_id
|
||||
WHERE
|
||||
ds.yx_addr IS NOT NULL
|
||||
AND ds.yx_addr != ''
|
||||
AND md.region = #{areaId}
|
||||
<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 md.device_type = #{type}
|
||||
</if>
|
||||
@ -150,4 +156,29 @@
|
||||
ds.signal_code
|
||||
</select>
|
||||
|
||||
<select id="countDeviceTypeStatus" resultType="java.util.Map">
|
||||
SELECT
|
||||
md.device_type,
|
||||
COUNT(*) AS total,
|
||||
SUM(CASE WHEN md.`status` = '01' THEN 1 ELSE 0 END) AS online_count
|
||||
FROM
|
||||
fk_device_signal ds
|
||||
INNER JOIN fk_meter_device md ON ds.meter_device_id = md.device_id
|
||||
WHERE
|
||||
ds.yx_addr IS NOT NULL
|
||||
AND ds.yx_addr != ''
|
||||
<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 md.device_type = #{type}
|
||||
</if>
|
||||
GROUP BY
|
||||
md.device_type
|
||||
ORDER BY
|
||||
md.device_type
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user