优化代码

This commit is contained in:
weitang 2025-05-26 09:16:30 +08:00
parent ffb629c51a
commit 548a337a76
3 changed files with 47 additions and 5 deletions

View File

@ -27,6 +27,7 @@ import javax.annotation.Resource;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
/**
* <p>
@ -48,8 +49,6 @@ public class VoicePatrolLogController {
@Resource
private ISubstationPatroldeviceService substationPatroldeviceService;
@Resource
private HttpRESTfulUtils httpRESTfulUtils;
@Resource
private VoiceServerService voiceServerService;
@GetMapping("/getVoicePatrolPage")
@ -105,7 +104,7 @@ public class VoicePatrolLogController {
if (aBoolean != null && aBoolean) {
throw new RuntimeException("当前设备正在录制");
}
redisTemplate.opsForValue().set(id, "1", 5 * 60);
redisTemplate.opsForValue().set(id, "1", 5 * 60, TimeUnit.SECONDS);
// 生成日志对象基础信息同步执行
VoicePatrolLog log = buildBaseLog(substationPatroldevice, duration);
// 提交异步任务

View File

@ -193,14 +193,13 @@ public class AlarmLogController {
public ResponseResult getAlarmLogPage(Page<Map<String, Object>> page, String stationCode, String taskAlarmType,
String alarmLevel, String checkFlag,String alarmSourceType, String startDate, String endDate) {
if (StrUtil.isBlank(stationCode)) {
return ResponseResult.error("未传变电站信息");
return ResponseResult.successData(page);
}
Page<Map<String, Object>> alarmList = alarmLogService.getAlarmLogPage(page, stationCode, taskAlarmType,
alarmLevel, checkFlag,alarmSourceType, startDate, endDate);
List<Map<String, Object>> records = alarmList.getRecords();
records.forEach(r -> {
String patroldeviceCode = r.get("patroldeviceCode").toString();
LambdaQueryWrapper<DeviceChannel> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(DeviceChannel::getDeviceid, patroldeviceCode).select(DeviceChannel::getDeviceid,

View File

@ -176,6 +176,50 @@
AND task_alarm_type != '4'
AND station_id = #{stationId}
</select>
<!-- <select id="getAlarmLogPage" resultType="java.util.Map">-->
<!-- SELECT-->
<!-- al.*,-->
<!-- sd.device_class,-->
<!-- JSON_ARRAYAGG(-->
<!-- JSON_OBJECT(-->
<!-- 'deviceId', tr.patroldevice_code,-->
<!-- 'channelId', tr.patroldevice_channelcode-->
<!-- )-->
<!-- ) AS channelList-->
<!-- FROM-->
<!-- iis_alarm_log al-->
<!-- LEFT JOIN iis_substation_device sd ON al.device_id = sd.device_id-->
<!-- LEFT JOIN iis_task_result tr ON tr.result_id = al.task_result_id-->
<!-- WHERE 1=1-->
<!-- <if test="stationCode != null and stationCode != ''">-->
<!-- AND al.station_code = #{stationCode}-->
<!-- </if>-->
<!-- <if test="taskAlarmType != null and taskAlarmType != ''">-->
<!-- AND al.task_alarm_type = #{taskAlarmType}-->
<!-- </if>-->
<!-- <if test="alarmLevel != null and alarmLevel != ''">-->
<!-- AND al.alarm_level = #{alarmLevel}-->
<!-- </if>-->
<!-- <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 &gt;= #{startDate}-->
<!-- </if>-->
<!-- <if test="endDate != null and endDate != ''">-->
<!-- and al.alarm_date &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)-->
<!-- </if>-->
<!-- GROUP BY al.id-->
<!-- ORDER BY al.alarm_date DESC-->
<!-- </select>-->
<select id="getAlarmLogPage" resultType="java.util.Map">
SELECT
al.*,