优化代码
This commit is contained in:
parent
ffb629c51a
commit
548a337a76
@ -27,6 +27,7 @@ import javax.annotation.Resource;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -48,8 +49,6 @@ public class VoicePatrolLogController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ISubstationPatroldeviceService substationPatroldeviceService;
|
private ISubstationPatroldeviceService substationPatroldeviceService;
|
||||||
@Resource
|
@Resource
|
||||||
private HttpRESTfulUtils httpRESTfulUtils;
|
|
||||||
@Resource
|
|
||||||
private VoiceServerService voiceServerService;
|
private VoiceServerService voiceServerService;
|
||||||
|
|
||||||
@GetMapping("/getVoicePatrolPage")
|
@GetMapping("/getVoicePatrolPage")
|
||||||
@ -105,7 +104,7 @@ public class VoicePatrolLogController {
|
|||||||
if (aBoolean != null && aBoolean) {
|
if (aBoolean != null && aBoolean) {
|
||||||
throw new RuntimeException("当前设备正在录制");
|
throw new RuntimeException("当前设备正在录制");
|
||||||
}
|
}
|
||||||
redisTemplate.opsForValue().set(id, "1", 5 * 60);
|
redisTemplate.opsForValue().set(id, "1", 5 * 60, TimeUnit.SECONDS);
|
||||||
// 生成日志对象基础信息(同步执行)
|
// 生成日志对象基础信息(同步执行)
|
||||||
VoicePatrolLog log = buildBaseLog(substationPatroldevice, duration);
|
VoicePatrolLog log = buildBaseLog(substationPatroldevice, duration);
|
||||||
// 提交异步任务
|
// 提交异步任务
|
||||||
|
@ -193,14 +193,13 @@ public class AlarmLogController {
|
|||||||
public ResponseResult getAlarmLogPage(Page<Map<String, Object>> page, String stationCode, String taskAlarmType,
|
public ResponseResult getAlarmLogPage(Page<Map<String, Object>> page, String stationCode, String taskAlarmType,
|
||||||
String alarmLevel, String checkFlag,String alarmSourceType, String startDate, String endDate) {
|
String alarmLevel, String checkFlag,String alarmSourceType, String startDate, String endDate) {
|
||||||
if (StrUtil.isBlank(stationCode)) {
|
if (StrUtil.isBlank(stationCode)) {
|
||||||
return ResponseResult.error("未传变电站信息");
|
return ResponseResult.successData(page);
|
||||||
}
|
}
|
||||||
Page<Map<String, Object>> alarmList = alarmLogService.getAlarmLogPage(page, stationCode, taskAlarmType,
|
Page<Map<String, Object>> alarmList = alarmLogService.getAlarmLogPage(page, stationCode, taskAlarmType,
|
||||||
alarmLevel, checkFlag,alarmSourceType, startDate, endDate);
|
alarmLevel, checkFlag,alarmSourceType, startDate, endDate);
|
||||||
|
|
||||||
List<Map<String, Object>> records = alarmList.getRecords();
|
List<Map<String, Object>> records = alarmList.getRecords();
|
||||||
records.forEach(r -> {
|
records.forEach(r -> {
|
||||||
|
|
||||||
String patroldeviceCode = r.get("patroldeviceCode").toString();
|
String patroldeviceCode = r.get("patroldeviceCode").toString();
|
||||||
LambdaQueryWrapper<DeviceChannel> queryWrapper1 = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<DeviceChannel> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||||
queryWrapper1.eq(DeviceChannel::getDeviceid, patroldeviceCode).select(DeviceChannel::getDeviceid,
|
queryWrapper1.eq(DeviceChannel::getDeviceid, patroldeviceCode).select(DeviceChannel::getDeviceid,
|
||||||
|
@ -176,6 +176,50 @@
|
|||||||
AND task_alarm_type != '4'
|
AND task_alarm_type != '4'
|
||||||
AND station_id = #{stationId}
|
AND station_id = #{stationId}
|
||||||
</select>
|
</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 >= #{startDate}-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <if test="endDate != null and endDate != ''">-->
|
||||||
|
<!-- and al.alarm_date < 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 id="getAlarmLogPage" resultType="java.util.Map">
|
||||||
SELECT
|
SELECT
|
||||||
al.*,
|
al.*,
|
||||||
|
Loading…
Reference in New Issue
Block a user