新增算法分类逻辑
This commit is contained in:
parent
da9a675589
commit
fd2f72c3cd
@ -1,6 +1,13 @@
|
||||
package com.yfd.platform.modules.algorithm.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmClassComponent;
|
||||
import com.yfd.platform.modules.algorithm.service.IAlgorithmClassComponentService;
|
||||
import com.yfd.platform.modules.auxcontrol.domain.DeviceSignal;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@ -21,4 +28,23 @@ public class AlgorithmClassComponentController {
|
||||
|
||||
@Resource
|
||||
private IAlgorithmClassComponentService algorithmClassComponentService;
|
||||
|
||||
@GetMapping("/getAlgorithmClassComponentPage")
|
||||
@ApiOperation("算法关联主设备部件")
|
||||
public ResponseResult getAlgorithmClassComponentPage(String algorithmId, Page<AlgorithmClassComponent> page) {
|
||||
Page<AlgorithmClassComponent> algorithmClassComponentPage =
|
||||
algorithmClassComponentService.getAlgorithmClassComponentPage(algorithmId, page);
|
||||
return ResponseResult.successData(algorithmClassComponentPage);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteAlgorithmClassComponent")
|
||||
@ApiOperation("删除算法关联主设备部件")
|
||||
public ResponseResult deleteAlgorithmClassComponent(String id) {
|
||||
boolean isOK = algorithmClassComponentService.deleteAlgorithmClassComponent(id);
|
||||
if (isOK) {
|
||||
return ResponseResult.success();
|
||||
} else {
|
||||
return ResponseResult.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,9 @@ package com.yfd.platform.modules.algorithm.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmClass;
|
||||
import com.yfd.platform.modules.algorithm.service.IAlgorithmClassService;
|
||||
import com.yfd.platform.modules.auxcontrol.domain.DeviceSignal;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -31,9 +29,11 @@ public class AlgorithmClassController {
|
||||
|
||||
@GetMapping("/getAlgorithmClassList")
|
||||
@ApiOperation("查询算法分类")
|
||||
public ResponseResult getAlgorithmClassList() {
|
||||
List<AlgorithmClass> list =
|
||||
algorithmClassService.list(new LambdaQueryWrapper<AlgorithmClass>().orderByAsc(AlgorithmClass::getAlgorithmClassCode));
|
||||
public ResponseResult getAlgorithmClassList(String algorithmClassName) {
|
||||
LambdaQueryWrapper<AlgorithmClass> queryWrapper = new LambdaQueryWrapper<AlgorithmClass>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(algorithmClassName), AlgorithmClass::getAlgorithmClassName,
|
||||
algorithmClassName).orderByAsc(AlgorithmClass::getAlgorithmClassCode);
|
||||
List<AlgorithmClass> list = algorithmClassService.list(queryWrapper);
|
||||
return ResponseResult.successData(list);
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ public class AlgorithmClassController {
|
||||
}
|
||||
|
||||
@PostMapping("/updateAlgorithmClass")
|
||||
@ApiOperation("新增算法分类")
|
||||
@ApiOperation("修改算法分类")
|
||||
public ResponseResult updateAlgorithmClass(@RequestBody AlgorithmClass algorithmClass) {
|
||||
boolean isOK = algorithmClassService.updateAlgorithmClass(algorithmClass);
|
||||
if (isOK) {
|
||||
@ -60,7 +60,7 @@ public class AlgorithmClassController {
|
||||
}
|
||||
|
||||
@PostMapping("/deleteAlgorithmClass")
|
||||
@ApiOperation("新增算法分类")
|
||||
@ApiOperation("删除算法分类")
|
||||
public ResponseResult deleteAlgorithmClass(String id) {
|
||||
boolean isOK = algorithmClassService.deleteAlgorithmClass(id);
|
||||
if (isOK) {
|
||||
|
@ -1,10 +1,17 @@
|
||||
package com.yfd.platform.modules.algorithm.controller;
|
||||
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmClass;
|
||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmDevice;
|
||||
import com.yfd.platform.modules.algorithm.service.IAlgorithmDeviceService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -21,4 +28,15 @@ public class AlgorithmDeviceController {
|
||||
|
||||
@Resource
|
||||
private IAlgorithmDeviceService algorithmDeviceService;
|
||||
|
||||
@PostMapping("/batchAddAlgorithmDevice")
|
||||
@ApiOperation("批量新增算法分类部件点位关联数据")
|
||||
public ResponseResult batchAddAlgorithmDevice(@RequestBody List<AlgorithmDevice> algorithmDeviceList) {
|
||||
boolean isOK = algorithmDeviceService.batchAddAlgorithmDevice(algorithmDeviceList);
|
||||
if (isOK) {
|
||||
return ResponseResult.success();
|
||||
} else {
|
||||
return ResponseResult.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -27,10 +29,11 @@ public class AlgorithmParamsController {
|
||||
@Resource
|
||||
private IAlgorithmParamsService algorithmParamsService;
|
||||
|
||||
@GetMapping("/getAlgorithmClassPage")
|
||||
@GetMapping("/getAlgorithmParamsList")
|
||||
@ApiOperation("查询算法分类")
|
||||
public ResponseResult getAlgorithmClassPage(String algorithmId, Page<AlgorithmParams> page) {
|
||||
Page<AlgorithmParams> algorithmClassPage = algorithmParamsService.getAlgorithmClassPage(algorithmId, page);
|
||||
return ResponseResult.successData(algorithmClassPage);
|
||||
public ResponseResult getAlgorithmParamsList(String algorithmId) {
|
||||
List<Map<String, Object>> algorithmClassList = algorithmParamsService.getAlgorithmParamsList(algorithmId);
|
||||
return ResponseResult.successData(algorithmClassList);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,9 @@ package com.yfd.platform.modules.algorithm.mapper;
|
||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmParams;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
@ -13,4 +16,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface AlgorithmParamsMapper extends BaseMapper<AlgorithmParams> {
|
||||
|
||||
List<Map<String, Object>> getAlgorithmParamsList(String algorithmId);
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.yfd.platform.modules.algorithm.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmClassComponent;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@ -13,4 +14,18 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IAlgorithmClassComponentService extends IService<AlgorithmClassComponent> {
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 算法关联主设备部件
|
||||
* 参数说明 algorithmId 算法分类id
|
||||
* 参数说明 page 分页参数
|
||||
* 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.yfd.platform.modules.algorithm.domain.AlgorithmClassComponent>
|
||||
***********************************/
|
||||
Page<AlgorithmClassComponent> getAlgorithmClassComponentPage(String algorithmId, Page<AlgorithmClassComponent> page);
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 删除算法关联主设备部件
|
||||
* 参数说明 id 算法部件id
|
||||
* 返回值说明: boolean
|
||||
***********************************/
|
||||
boolean deleteAlgorithmClassComponent(String id);
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package com.yfd.platform.modules.algorithm.service;
|
||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmDevice;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
@ -13,4 +15,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IAlgorithmDeviceService extends IService<AlgorithmDevice> {
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 批量新增算法分类部件点位关联数据
|
||||
* 参数说明 algorithmDeviceList
|
||||
* 返回值说明: boolean
|
||||
***********************************/
|
||||
boolean batchAddAlgorithmDevice(List<AlgorithmDevice> algorithmDeviceList);
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmParams;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
@ -14,5 +17,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IAlgorithmParamsService extends IService<AlgorithmParams> {
|
||||
|
||||
Page<AlgorithmParams> getAlgorithmClassPage(String algorithmId, Page<AlgorithmParams> page);
|
||||
List<Map<String, Object>> getAlgorithmParamsList(String algorithmId);
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
package com.yfd.platform.modules.algorithm.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmClassComponent;
|
||||
import com.yfd.platform.modules.algorithm.mapper.AlgorithmClassComponentMapper;
|
||||
import com.yfd.platform.modules.algorithm.service.IAlgorithmClassComponentService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.bcel.generic.LADD;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@ -15,6 +18,31 @@ import org.springframework.stereotype.Service;
|
||||
* @since 2025-05-13
|
||||
*/
|
||||
@Service
|
||||
public class AlgorithmClassComponentServiceImpl extends ServiceImpl<AlgorithmClassComponentMapper, AlgorithmClassComponent> implements IAlgorithmClassComponentService {
|
||||
public class AlgorithmClassComponentServiceImpl extends ServiceImpl<AlgorithmClassComponentMapper,
|
||||
AlgorithmClassComponent> implements IAlgorithmClassComponentService {
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 算法关联主设备部件
|
||||
* 参数说明 algorithmId 算法分类id
|
||||
* 参数说明 page 分页参数
|
||||
* 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.yfd.platform.modules.algorithm.domain
|
||||
* .AlgorithmClassComponent>
|
||||
***********************************/
|
||||
@Override
|
||||
public Page<AlgorithmClassComponent> getAlgorithmClassComponentPage(String algorithmId,
|
||||
Page<AlgorithmClassComponent> page) {
|
||||
LambdaQueryWrapper<AlgorithmClassComponent> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AlgorithmClassComponent::getAlgorithmId, algorithmId);
|
||||
return this.page(page, queryWrapper);
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 删除算法关联主设备部件
|
||||
* 参数说明 id 算法部件id
|
||||
* 返回值说明: boolean
|
||||
***********************************/
|
||||
@Override
|
||||
public boolean deleteAlgorithmClassComponent(String id) {
|
||||
return this.removeById(id);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import com.yfd.platform.modules.algorithm.service.IAlgorithmDeviceService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
@ -17,4 +19,13 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class AlgorithmDeviceServiceImpl extends ServiceImpl<AlgorithmDeviceMapper, AlgorithmDevice> implements IAlgorithmDeviceService {
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 批量新增算法分类部件点位关联数据
|
||||
* 参数说明 algorithmDeviceList
|
||||
* 返回值说明: boolean
|
||||
***********************************/
|
||||
@Override
|
||||
public boolean batchAddAlgorithmDevice(List<AlgorithmDevice> algorithmDeviceList) {
|
||||
return this.saveOrUpdateBatch(algorithmDeviceList);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,15 @@
|
||||
package com.yfd.platform.modules.algorithm.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmParams;
|
||||
import com.yfd.platform.modules.algorithm.mapper.AlgorithmParamsMapper;
|
||||
import com.yfd.platform.modules.algorithm.service.IAlgorithmParamsService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
@ -18,9 +21,11 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class AlgorithmParamsServiceImpl extends ServiceImpl<AlgorithmParamsMapper, AlgorithmParams> implements IAlgorithmParamsService {
|
||||
|
||||
@Override
|
||||
public Page<AlgorithmParams> getAlgorithmClassPage(String algorithmId, Page<AlgorithmParams> page) {
|
||||
@Resource
|
||||
private AlgorithmParamsMapper algorithmParamsMapper;
|
||||
|
||||
return null;
|
||||
@Override
|
||||
public List<Map<String, Object>> getAlgorithmParamsList(String algorithmId) {
|
||||
return algorithmParamsMapper.getAlgorithmParamsList(algorithmId);
|
||||
}
|
||||
}
|
||||
|
@ -187,12 +187,12 @@ public class AlarmLogController {
|
||||
@GetMapping("/getAlarmLogPage")
|
||||
@ApiOperation("告警信息确认分页")
|
||||
public ResponseResult getAlarmLogPage(Page<Map<String, Object>> page, String stationCode, String taskAlarmType,
|
||||
String alarmLevel, String checkFlag, String startDate, String endDate) {
|
||||
String alarmLevel, String checkFlag,String alarmSourceType, String startDate, String endDate) {
|
||||
if (StrUtil.isBlank(stationCode)) {
|
||||
return ResponseResult.error("未传变电站信息");
|
||||
}
|
||||
Page<Map<String, Object>> alarmList = alarmLogService.getAlarmLogPage(page, stationCode, taskAlarmType,
|
||||
alarmLevel, checkFlag, startDate, endDate);
|
||||
alarmLevel, checkFlag,alarmSourceType, startDate, endDate);
|
||||
|
||||
List<Map<String, Object>> records = alarmList.getRecords();
|
||||
records.forEach(r -> {
|
||||
|
@ -59,6 +59,6 @@ public interface AlarmLogMapper extends BaseMapper<AlarmLog> {
|
||||
|
||||
List<AlarmLog> getNotCheckAlarmCount(String stationId);
|
||||
|
||||
Page<Map<String, Object>> getAlarmLogPage(Page<Map<String, Object>> page, String stationCode, String taskAlarmType, String alarmLevel, String checkFlag, String startDate, String endDate);
|
||||
Page<Map<String, Object>> getAlarmLogPage(Page<Map<String, Object>> page, String stationCode, String taskAlarmType, String alarmLevel, String checkFlag, String alarmSourceType, String startDate, String endDate);
|
||||
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public interface IAlarmLogService extends IService<AlarmLog> {
|
||||
Page<Map<String, Object>> getAlarmListPage(Page<Map<String, Object>> page, String patrolDeviceCode, String monitorType, String startDate, String endDate);
|
||||
|
||||
Page<Map<String, Object>> getAlarmLogPage(Page<Map<String, Object>> page, String stationCode, String taskAlarmType,
|
||||
String alarmLevel, String checkFlag, String startDate, String endDate);
|
||||
String alarmLevel, String checkFlag, String alarmSourceType,String startDate, String endDate);
|
||||
|
||||
boolean setAlarmLogStatus(AlarmLog alarmLog);
|
||||
|
||||
|
@ -1090,10 +1090,10 @@ public class AlarmLogServiceImpl extends ServiceImpl<AlarmLogMapper, AlarmLog> i
|
||||
|
||||
@Override
|
||||
public Page<Map<String, Object>> getAlarmLogPage(Page<Map<String, Object>> page, String stationCode,
|
||||
String taskAlarmType, String alarmLevel, String checkFlag,
|
||||
String taskAlarmType, String alarmLevel, String checkFlag, String alarmSourceType,
|
||||
String startDate, String endDate) {
|
||||
return alarmLogMapper.getAlarmLogPage(page, stationCode, taskAlarmType,
|
||||
alarmLevel, checkFlag, startDate, endDate);
|
||||
alarmLevel, checkFlag,alarmSourceType, startDate, endDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2256,7 +2256,7 @@ public class AlarmLogServiceImpl extends ServiceImpl<AlarmLogMapper, AlarmLog> i
|
||||
// alarmLog.setLastmodifier(SecurityUtils.getCurrentUsername());
|
||||
alarmLog.setLastmodifier("admin");
|
||||
alarmLog.setLastmodifydate(new Timestamp(System.currentTimeMillis()));
|
||||
alarmLog.setAlarmSourceType("2");
|
||||
alarmLog.setTaskAlarmType("4");
|
||||
alarmLog.setId(IdUtil.fastSimpleUUID());
|
||||
// 创建 SimpleDateFormat 对象,指定日期格式
|
||||
if ("yx".equals(type)) {
|
||||
|
@ -403,6 +403,7 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob {
|
||||
try {
|
||||
String patroldeviceCode = map.get("patroldeviceCode").toString();
|
||||
voiceServerService.sendVoiceServerControl(patroldeviceCode, "ON", fullfilename);
|
||||
FileUtil.copy("", config.getSnapFilePath() + fullfilename, true);
|
||||
Thread.sleep(duration * 1000);
|
||||
voiceServerService.sendVoiceServerControl(patroldeviceCode, "OFF", fullfilename);
|
||||
} catch (Exception e) {
|
||||
|
@ -2,4 +2,30 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yfd.platform.modules.algorithm.mapper.AlgorithmParamsMapper">
|
||||
|
||||
<select id="getAlgorithmParamsList" resultType="java.util.Map">
|
||||
SELECT
|
||||
ap.algorithm_id,
|
||||
ap.param_type,
|
||||
ap.param_unit,
|
||||
ap.param_range,
|
||||
ap.param_name,
|
||||
ap.param_desc,
|
||||
ap.param_fixed,
|
||||
ap.default_values,
|
||||
ap.description,
|
||||
ad.param_value,
|
||||
ad.component_id,
|
||||
ad.source_type,
|
||||
ad.device_id,
|
||||
ad.device_name,
|
||||
ad.id
|
||||
FROM
|
||||
iis_algorithm_params ap
|
||||
LEFT JOIN iis_algorithm_device ad ON ap.id = ad.param_id
|
||||
WHERE 1=1
|
||||
<if test="algorithmId != null and algorithmId != ''">
|
||||
AND ap.algorithm_id = #{algorithmId}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -133,7 +133,9 @@
|
||||
<if test="checkFlag != null and checkFlag != ''">
|
||||
AND al.check_flag = #{checkFlag}
|
||||
</if>
|
||||
|
||||
<if test="alarmSourceType != null and alarmSourceType != ''">
|
||||
AND al.alarm_source_type = #{alarmSourceType}
|
||||
</if>
|
||||
<if test="startDate != null and startDate != ''">
|
||||
and al.alarm_date >= #{startDate}
|
||||
</if>
|
||||
|
Loading…
Reference in New Issue
Block a user