优化告警部件关联逻辑

This commit is contained in:
weitang 2025-05-15 09:02:37 +08:00
parent 2f51438a5b
commit 14f8c355eb
9 changed files with 100 additions and 9 deletions

View File

@ -3,16 +3,15 @@ package com.yfd.platform.modules.algorithm.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yfd.platform.config.ResponseResult; import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.modules.algorithm.domain.AlgorithmClassComponent; import com.yfd.platform.modules.algorithm.domain.AlgorithmClassComponent;
import com.yfd.platform.modules.algorithm.domain.AlgorithmDevice;
import com.yfd.platform.modules.algorithm.service.IAlgorithmClassComponentService; import com.yfd.platform.modules.algorithm.service.IAlgorithmClassComponentService;
import com.yfd.platform.modules.auxcontrol.domain.DeviceSignal; import com.yfd.platform.modules.auxcontrol.domain.DeviceSignal;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
/** /**
* <p> * <p>
@ -49,4 +48,15 @@ public class AlgorithmClassComponentController {
return ResponseResult.error(); return ResponseResult.error();
} }
} }
@PostMapping("/batchAddAlgorithmClassComponent")
@ApiOperation("批量新增算法关联主设备部件")
public ResponseResult batchAddAlgorithmClassComponent(@RequestBody List<AlgorithmClassComponent> algorithmClassComponentList) {
boolean isOK = algorithmClassComponentService.batchAddAlgorithmClassComponent(algorithmClassComponentList);
if (isOK) {
return ResponseResult.success();
} else {
return ResponseResult.error();
}
}
} }

View File

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yfd.platform.modules.algorithm.domain.AlgorithmClassComponent; import com.yfd.platform.modules.algorithm.domain.AlgorithmClassComponent;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/** /**
* <p> * <p>
* 服务类 * 服务类
@ -28,4 +30,7 @@ public interface IAlgorithmClassComponentService extends IService<AlgorithmClass
* 返回值说明: boolean * 返回值说明: boolean
***********************************/ ***********************************/
boolean deleteAlgorithmClassComponent(String id); boolean deleteAlgorithmClassComponent(String id);
boolean batchAddAlgorithmClassComponent(List<AlgorithmClassComponent> algorithmClassComponentList);
} }

View File

@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.bcel.generic.LADD; import org.apache.bcel.generic.LADD;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* <p> * <p>
* 服务实现类 * 服务实现类
@ -45,4 +47,9 @@ public class AlgorithmClassComponentServiceImpl extends ServiceImpl<AlgorithmCla
public boolean deleteAlgorithmClassComponent(String id) { public boolean deleteAlgorithmClassComponent(String id) {
return this.removeById(id); return this.removeById(id);
} }
@Override
public boolean batchAddAlgorithmClassComponent(List<AlgorithmClassComponent> algorithmClassComponentList) {
return this.saveOrUpdateBatch(algorithmClassComponentList);
}
} }

View File

@ -200,8 +200,8 @@ public class SubstationMaindeviceController {
@ApiOperation("根据条件获取部件(分页)") @ApiOperation("根据条件获取部件(分页)")
public ResponseResult getComponentByBayPage(@RequestBody String param) { public ResponseResult getComponentByBayPage(@RequestBody String param) {
// Page<Map<String, Object>> page, String stationCode, String areaId, // Page<Map<String, Object>> page, String stationCode, String areaId,
// String bayId, String componentName, String mainDeviceId, String ids // String bayId, String componentName, String mainDeviceId, String ids
JSONObject jsonObject = JSONUtil.parseObj(param); JSONObject jsonObject = JSONUtil.parseObj(param);
Page<Map<String, Object>> page = new Page<>(); Page<Map<String, Object>> page = new Page<>();
page.setCurrent(jsonObject.getInt("current")); page.setCurrent(jsonObject.getInt("current"));
@ -239,6 +239,17 @@ public class SubstationMaindeviceController {
return ResponseResult.successData(mapPage); return ResponseResult.successData(mapPage);
} }
@PostMapping("/getComponentPage")
@ApiOperation("获取没有绑定(分页)")
public ResponseResult getComponentByBayPage(Page<Map<String, Object>> page, String algorithmId,
String stationCode, String areaId,
String bayId, String mainDeviceId, String componentName) {
Page<Map<String, Object>> mapPage = substationComponentService.getComponentByBayPage(page, algorithmId,
stationCode, areaId, bayId, mainDeviceId,
componentName);
return ResponseResult.successData(mapPage);
}
@GetMapping("/getMainDeviceType") @GetMapping("/getMainDeviceType")
@ApiOperation("获取当前主设备类型") @ApiOperation("获取当前主设备类型")
public ResponseResult getMainDeviceType(String deviceType) { public ResponseResult getMainDeviceType(String deviceType) {

View File

@ -1,8 +1,11 @@
package com.yfd.platform.modules.basedata.mapper; package com.yfd.platform.modules.basedata.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yfd.platform.modules.basedata.domain.SubstationComponent; import com.yfd.platform.modules.basedata.domain.SubstationComponent;
import java.util.Map;
/** /**
* <p> * <p>
* 变电站_设备部件 Mapper 接口 * 变电站_设备部件 Mapper 接口
@ -13,4 +16,6 @@ import com.yfd.platform.modules.basedata.domain.SubstationComponent;
*/ */
public interface SubstationComponentMapper extends BaseMapper<SubstationComponent> { public interface SubstationComponentMapper extends BaseMapper<SubstationComponent> {
Page<Map<String, Object>> getComponentByBayPage(Page<Map<String, Object>> page, String algorithmId, String stationCode, String areaId, String bayId, String mainDeviceId, String componentName);
} }

View File

@ -1,8 +1,11 @@
package com.yfd.platform.modules.basedata.service; package com.yfd.platform.modules.basedata.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yfd.platform.modules.basedata.domain.SubstationComponent; import com.yfd.platform.modules.basedata.domain.SubstationComponent;
import java.util.Map;
/** /**
* <p> * <p>
* 变电站_设备部件 服务类 * 变电站_设备部件 服务类
@ -13,4 +16,6 @@ import com.yfd.platform.modules.basedata.domain.SubstationComponent;
*/ */
public interface ISubstationComponentService extends IService<SubstationComponent> { public interface ISubstationComponentService extends IService<SubstationComponent> {
Page<Map<String, Object>> getComponentByBayPage(Page<Map<String, Object>> page, String algorithmId, String stationCode, String areaId, String bayId, String mainDeviceId, String componentName);
} }

View File

@ -1,11 +1,15 @@
package com.yfd.platform.modules.basedata.service.impl; package com.yfd.platform.modules.basedata.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yfd.platform.modules.basedata.domain.SubstationComponent; import com.yfd.platform.modules.basedata.domain.SubstationComponent;
import com.yfd.platform.modules.basedata.mapper.SubstationComponentMapper; import com.yfd.platform.modules.basedata.mapper.SubstationComponentMapper;
import com.yfd.platform.modules.basedata.service.ISubstationComponentService; import com.yfd.platform.modules.basedata.service.ISubstationComponentService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Map;
/** /**
* <p> * <p>
* 变电站_设备部件 服务实现类 * 变电站_设备部件 服务实现类
@ -17,4 +21,14 @@ import org.springframework.stereotype.Service;
@Service @Service
public class SubstationComponentServiceImpl extends ServiceImpl<SubstationComponentMapper, SubstationComponent> implements ISubstationComponentService { public class SubstationComponentServiceImpl extends ServiceImpl<SubstationComponentMapper, SubstationComponent> implements ISubstationComponentService {
@Resource
private SubstationComponentMapper substationComponentMapper;
@Override
public Page<Map<String, Object>> getComponentByBayPage(Page<Map<String, Object>> page, String algorithmId,
String stationCode, String areaId, String bayId,
String mainDeviceId, String componentName) {
return substationComponentMapper.getComponentByBayPage(page, algorithmId,
stationCode, areaId, bayId, mainDeviceId,
componentName);
}
} }

View File

@ -534,7 +534,7 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob {
// ("patroldeviceEffectiveregion").toString()); // ("patroldeviceEffectiveregion").toString());
// } // }
log.info("==============================typelist=======================" + typelist.toString()); log.info("==============================typelist=======================" + typelist.toString());
if ("infrared".equals(typelist.get(0).toString())) { if ("infrared".equals(typelist.get(0).toString()) && !"3".equals(config.getFilefromtype())) {
//红外测温 //红外测温
log.info("进入红外测温方法"); log.info("进入红外测温方法");
String outsideAngle = ""; String outsideAngle = "";

View File

@ -1,5 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yfd.platform.modules.patroltask.basedata.mapper.SubstationComponentMapper"> <mapper namespace="com.yfd.platform.modules.basedata.mapper.SubstationComponentMapper">
<!--algorithmId,
stationCode, areaId, bayId, mainDeviceId,
componentName-->
<select id="getComponentByBayPage" resultType="java.util.Map">
SELECT
*
FROM
iis_substation_component
WHERE
1=1
<if test="stationCode != null and stationCode != ''">
AND t.station_code=#{stationCode}
</if>
<if test="areaId != null and areaId != ''">
AND t.area_id=#{areaId}
</if>
<if test="bayId != null and bayId != ''">
AND t.bay_id=#{bayId}
</if>
<if test="mainDeviceId != null and mainDeviceId != ''">
AND t.main_device_id=#{mainDeviceId}
</if>
<if test="componentName != null and componentName != ''">
AND t.component_name like concat('%',#{componentName},'%')
</if>
AND
component_id NOT IN (
SELECT
component_id
FROM
iis_algorithm_class_component
WHERE
algorithm_id = #{algorithmId})
</select>
</mapper> </mapper>