优化系统逻辑

This commit is contained in:
weitang 2025-05-22 17:22:24 +08:00
parent 998725b108
commit d8e90a9bd8
9 changed files with 23 additions and 180 deletions

View File

@ -44,40 +44,4 @@ public class WeatherLogController {
return ResponseResult.successData(weatherDevice);
}
@GetMapping("/getWeatherLogPage")
@ApiOperation("分页查询环境信息")
public ResponseResult getWeatherLogPage(Page<Map<String, Object>> page, String stationId, String patroldeviceName
, String startDate, String endDate) {
if (StrUtil.isBlank(stationId)) {
return ResponseResult.error("未传变电站信息");
}
String startFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseStart = DateUtil.parse(startDate);
//一天的开始
Date beginOfDay = DateUtil.beginOfDay(parseStart);
startFormat = DateUtil.format(beginOfDay, "yyyy-MM-dd HH:mm:ss");
}
String endFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseEnd = DateUtil.parse(endDate);
//一天的结束
Date endOfDay = DateUtil.endOfDay(parseEnd);
endFormat = DateUtil.format(endOfDay, "yyyy-MM-dd HH:mm:ss");
}
LambdaQueryWrapper<WeatherLog> queryWrapper = new LambdaQueryWrapper<>();
if (StrUtil.isNotBlank(stationId)) {
queryWrapper.eq(WeatherLog::getStationId, stationId);
}
if (StrUtil.isNotBlank(patroldeviceName)) {
queryWrapper.like(WeatherLog::getPatroldeviceName, patroldeviceName);
}
if (StrUtil.isNotBlank(startFormat) && StrUtil.isNotBlank(endFormat)) {
queryWrapper.le(WeatherLog::getTime, endFormat);
queryWrapper.ge(WeatherLog::getTime, startFormat);
}
Page<Map<String, Object>> mapPage = weatherLogService.pageMaps(page, queryWrapper);
return ResponseResult.successData(mapPage);
}
}

View File

@ -183,22 +183,8 @@ public class AlarmLogController {
@ApiOperation("根据设备编号查询告警列表")
public ResponseResult getAlarmListPage(Page<Map<String, Object>> page, String patrolDeviceCode,
String monitorType, String startDate, String endDate) {
String startFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseStart = DateUtil.parse(startDate);
//一天的开始
Date beginOfDay = DateUtil.beginOfDay(parseStart);
startFormat = DateUtil.format(beginOfDay, "yyyy-MM-dd HH:mm:ss");
}
String endFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseEnd = DateUtil.parse(endDate);
//一天的结束
Date endOfDay = DateUtil.endOfDay(parseEnd);
endFormat = DateUtil.format(endOfDay, "yyyy-MM-dd HH:mm:ss");
}
Page<Map<String, Object>> alarmList = alarmLogService.getAlarmListPage(page, patrolDeviceCode, monitorType,
startFormat, endFormat);
startDate, endDate);
return ResponseResult.successData(alarmList);
}

View File

@ -494,21 +494,8 @@ public class TaskTodoController {
public ResponseResult getTaskToDoStatList(String stationCode, String currentDate, String startDate,
String endDate, String taskName) {
String startFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseStart = DateUtil.parse(startDate);
//一天的开始
Date beginOfDay = DateUtil.beginOfDay(parseStart);
startFormat = DateUtil.format(beginOfDay, "yyyy-MM-dd HH:mm:ss");
}
String endFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseEnd = DateUtil.parse(endDate);
//一天的结束
Date endOfDay = DateUtil.endOfDay(parseEnd);
endFormat = DateUtil.format(endOfDay, "yyyy-MM-dd HH:mm:ss");
}
List<Map<String, Object>> taskToDoStatList = taskTodoService.getTaskToDoStatList(stationCode, currentDate, startFormat, endFormat, null);
List<Map<String, Object>> taskToDoStatList = taskTodoService.getTaskToDoStatList(stationCode, currentDate, startDate, endDate, null);
Map<String, Object> map = new HashMap<>();
map.put("allCount", taskToDoStatList.size());
@ -540,28 +527,8 @@ public class TaskTodoController {
@ApiOperation("分页查询巡视报告")
public ResponseResult getTaskReportList(Page<Map<String, Object>> page, String stationCode, String areaId, String taskName,
String type, String startDate, String endDate, String bayId, String patrolType, String mainDeviceId) {
String startFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseStart = DateUtil.parse(startDate);
//一天的开始
Date beginOfDay = DateUtil.beginOfDay(parseStart);
startFormat = DateUtil.format(beginOfDay, "yyyy-MM-dd HH:mm:ss");
}
String endFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseEnd = DateUtil.parse(endDate);
//一天的结束
Date endOfDay = DateUtil.endOfDay(parseEnd);
endFormat = DateUtil.format(endOfDay, "yyyy-MM-dd HH:mm:ss");
}
Page<Map<String, Object>> mapPage = taskTodoService.getTaskReportList(page, stationCode, areaId, taskName,
type, startFormat, endFormat, bayId, patrolType);
// List<Map<String, Object>> records = mapPage.getRecords();
// records.forEach(r -> {
// String taskTodoId = r.get("taskTodoId").toString();
// Map<String, Object> map = taskTodoService.getTaskTodoById(taskTodoId,areaId,bayId,mainDeviceId);
// r.put("result", map);
// });
type, startDate, endDate, bayId, patrolType);
return ResponseResult.successData(mapPage);
}
@ -1185,23 +1152,9 @@ public class TaskTodoController {
String deviceName, String patroldeviceName,
String componentName, String recognitionType, String status,
String startDate, String endDate, HttpServletResponse response) throws IOException {
String startFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseStart = DateUtil.parse(startDate);
//一天的开始
Date beginOfDay = DateUtil.beginOfDay(parseStart);
startFormat = DateUtil.format(beginOfDay, "yyyy-MM-dd HH:mm:ss");
}
String endFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseEnd = DateUtil.parse(endDate);
//一天的结束
Date endOfDay = DateUtil.endOfDay(parseEnd);
endFormat = DateUtil.format(endOfDay, "yyyy-MM-dd HH:mm:ss");
}
// 获取任务执行id
List<Map<String, Object>> records = taskTodoService.getAbnormalDevice(stationCode, taskName, deviceName,
patroldeviceName, componentName, recognitionType, status, startFormat, endFormat);
patroldeviceName, componentName, recognitionType, status, startDate, endDate);
taskTodoService.exportAbnormalDevice(records, response);
}
@ -1242,22 +1195,8 @@ public class TaskTodoController {
if (StrUtil.isBlank(mainDeviceId)) {
return ResponseResult.error("参数为空");
}
String startFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseStart = DateUtil.parse(startDate);
//一天的开始
Date beginOfDay = DateUtil.beginOfDay(parseStart);
startFormat = DateUtil.format(beginOfDay, "yyyy-MM-dd HH:mm:ss");
}
String endFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseEnd = DateUtil.parse(endDate);
//一天的结束
Date endOfDay = DateUtil.endOfDay(parseEnd);
endFormat = DateUtil.format(endOfDay, "yyyy-MM-dd HH:mm:ss");
}
List<Map<String, Object>> maps = taskTodoService.getDeviceByMainDevice(mainDeviceId, meterType, recognitionType,
startFormat, endFormat);
startDate, endDate);
return ResponseResult.successData(maps);
}
@ -1391,23 +1330,9 @@ public class TaskTodoController {
if (StrUtil.isBlank(stationCode)) {
return ResponseResult.error("参数为空");
}
String startFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseStart = DateUtil.parse(startDate);
//一天的开始
Date beginOfDay = DateUtil.beginOfDay(parseStart);
startFormat = DateUtil.format(beginOfDay, "yyyy-MM-dd HH:mm:ss");
}
String endFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseEnd = DateUtil.parse(endDate);
//一天的结束
Date endOfDay = DateUtil.endOfDay(parseEnd);
endFormat = DateUtil.format(endOfDay, "yyyy-MM-dd HH:mm:ss");
}
Page<Map<String, Object>> mapPage = taskTodoService.getLinkTaskTodoList(page, stationCode, linkageDeviceName,
taskName, linkageType, linkageDeviceType, startFormat, endFormat);
taskName, linkageType, linkageDeviceType, startDate, endDate);
return ResponseResult.successData(mapPage);
}
@ -1668,23 +1593,9 @@ public class TaskTodoController {
public ResponseResult getResultByPatroldevice(Page<Map<String, Object>> page, String patroldeviceId,
String mainDeviceId, String taskName, String recognitionType,
String valid, String isReport, String startDate, String endDate) {
// SubstationPatroldevice substationPatroldevice = substationPatroldeviceService.getById(patroldeviceId);
String startFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseStart = DateUtil.parse(startDate);
//一天的开始
Date beginOfDay = DateUtil.beginOfDay(parseStart);
startFormat = DateUtil.format(beginOfDay, "yyyy-MM-dd HH:mm:ss");
}
String endFormat = "";
if (StrUtil.isNotBlank(startDate)) {
Date parseEnd = DateUtil.parse(endDate);
//一天的结束
Date endOfDay = DateUtil.endOfDay(parseEnd);
endFormat = DateUtil.format(endOfDay, "yyyy-MM-dd HH:mm:ss");
}
Page<Map<String, Object>> mapPage = taskTodoService.getResultByPatroldevice(page, null, mainDeviceId,
taskName, recognitionType, valid, isReport, startFormat, endFormat);
taskName, recognitionType, valid, isReport, startDate, endDate);
List<Map<String, Object>> records = mapPage.getRecords();
records.forEach(m -> {
String flag = m.get("flag").toString();

View File

@ -58,27 +58,9 @@ public class DefectDeviceServiceImpl extends ServiceImpl<DefectDeviceMapper, Def
String bayId, String taskName, String deviceName,
String patroldeviceName, String componentName, String recognitionType,
String isDefectFlag, String startDate, String endDate) {
String startFormat = "";
String endFormat = "";
if (StrUtil.isNotBlank(startDate) && StrUtil.isNotBlank(endDate)) {
if (StrUtil.isNotBlank(startDate)) {
Date parseStart = DateUtil.parse(startDate);
//一天的开始
Date beginOfDay = DateUtil.beginOfDay(parseStart);
startFormat = DateUtil.format(beginOfDay, "yyyy-MM-dd HH:mm:ss");
}
if (StrUtil.isNotBlank(startDate)) {
Date parseEnd = DateUtil.parse(endDate);
//一天的结束
Date endOfDay = DateUtil.endOfDay(parseEnd);
endFormat = DateUtil.format(endOfDay, "yyyy-MM-dd HH:mm:ss");
}
}
Page<Map<String, Object>> mapPage = defectDeviceMapper.getDefectDeviceList(page, stationCode, areaId, bayId,
taskName, deviceName, patroldeviceName, componentName, recognitionType, isDefectFlag, startFormat,
endFormat);
taskName, deviceName, patroldeviceName, componentName, recognitionType, isDefectFlag, startDate,
endDate);
List<Map<String, Object>> records = mapPage.getRecords();
records.forEach(m -> {
String flag = m.get("flag").toString();

View File

@ -54,7 +54,7 @@
and str_to_date(alarm_date, '%Y-%m-%d %H:%i:%s') &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and str_to_date(alarm_date, '%Y-%m-%d %H:%i:%s') &lt;= #{endDate}
and alarm_date &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
ORDER By alarm_date DESC
</select>

View File

@ -46,7 +46,7 @@
and str_to_date(time, '%Y-%m-%d %H:%i:%s') &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and str_to_date(time, '%Y-%m-%d %H:%i:%s') &lt;= #{endDate}
and time &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
ORDER BY d.patroldevice_date
</select>

View File

@ -9,7 +9,7 @@
and str_to_date(t.fixed_start_time, '%Y-%m-%d') &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and str_to_date(t.fixed_start_time, '%Y-%m-%d') &lt;= #{endDate}
and t.fixed_start_time &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
<if test="enable != null and enable != ''">
and t.isenable = #{enable}

View File

@ -241,7 +241,7 @@ ORDER BY
and str_to_date(time, '%Y-%m-%d %H:%i:%s') &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and str_to_date(time, '%Y-%m-%d %H:%i:%s') &lt;= #{endDate}
and time &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
ORDER BY t.patroldevice_date
</select>
@ -720,7 +720,7 @@ ORDER BY
AND tt.start_time &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
AND tt.end_time &lt;= #{endDate}
AND tt.end_time &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
</select>
<!-- String recognitionType, String startFormat, String endFormat-->
@ -831,7 +831,7 @@ ORDER BY
AND t.patroldevice_date &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
AND t.patroldevice_date &lt;= #{endDate}
AND t.patroldevice_date &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
ORDER BY
t.order_num ASC
@ -905,10 +905,10 @@ ORDER BY
AND t.device_id = #{deviceId}
</if>
<if test="startDate != null and startDate != ''">
AND t.patroldevice_date &gt;= #{startDate}
AND t.time &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
AND t.patroldevice_date &lt;= #{endDate}
and t.time &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
ORDER BY t.time DESC
</select>

View File

@ -36,7 +36,7 @@
and str_to_date(tt.plan_start_time, '%Y-%m-%d %H:%i:%s') &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and str_to_date(tt.plan_start_time, '%Y-%m-%d %H:%i:%s') &lt;= #{endDate}
and tt.plan_start_time &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
ORDER BY tt.plan_start_time ASC,tt.priority DESC,tt.task_todo_id ASC
</select>
@ -66,7 +66,7 @@
and str_to_date(tt.examine_date, '%Y-%m-%d %H:%i:%s') &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and str_to_date(tt.examine_date, '%Y-%m-%d %H:%i:%s') &lt;= #{endDate}
and tt.examine_date &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
ORDER BY tt.examine_date,tt.task_todo_id
</select>
@ -99,7 +99,7 @@
and str_to_date(ts.time, '%Y-%m-%d %H:%i:%s') &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and str_to_date(ts.time, '%Y-%m-%d %H:%i:%s') &lt;= #{endDate}
and ts.time &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
</select>
<select id="getLinkTaskTodoList" resultType="java.util.Map">
@ -129,7 +129,7 @@
and str_to_date(tt.start_time, '%Y-%m-%d %H:%i:%s') &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and str_to_date(tt.start_time, '%Y-%m-%d %H:%i:%s') &lt;= #{endDate}
and tt.start_time &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
</select>
<select id="selectTaskTodoList" resultType="com.yfd.platform.modules.patroltask.domain.TaskTodo">