"src/main/git@gitlab.ruzhoukj.com:wujipeng/relation.git" did not exist on "961e9c9ad89685b0fbbc5f7b1c53dfade614d6c8"
Commit ce478de4 authored by 王蔡翾's avatar 王蔡翾
Browse files

更新

parent c7f2ac89
...@@ -26,5 +26,6 @@ public interface TbOperationRecordService extends IService<TbOperationRecordEnti ...@@ -26,5 +26,6 @@ public interface TbOperationRecordService extends IService<TbOperationRecordEnti
* @return List<OperationRecordVO> * @return List<OperationRecordVO>
*/ */
List<OperationRecordVO> queryRunLogRecordList(OperationRecordDTO operationRecordDTO); List<OperationRecordVO> queryRunLogRecordList(OperationRecordDTO operationRecordDTO);
List<OperationRecordVO> queryRunLogRecordListAndWarnMessage(OperationRecordDTO operationRecordDTO);
} }
...@@ -24,7 +24,7 @@ public interface WorkerService extends IService<WorkerEntity> { ...@@ -24,7 +24,7 @@ public interface WorkerService extends IService<WorkerEntity> {
* @param * @param
* @return WorkerEntity * @return WorkerEntity
*/ */
WorkerVO queryById(Integer id); WorkerVO queryMyMessage(String username);
/* /*
* 登录验证 * 登录验证
* @param WorkerDTO WorkerDTO * @param WorkerDTO WorkerDTO
......
...@@ -7,6 +7,7 @@ import com.example.operation_platform.mapper.OperationDoMapper; ...@@ -7,6 +7,7 @@ import com.example.operation_platform.mapper.OperationDoMapper;
import com.example.operation_platform.model.dto.OperationDoDTO; import com.example.operation_platform.model.dto.OperationDoDTO;
import com.example.operation_platform.model.entity.OperationDoEntity; import com.example.operation_platform.model.entity.OperationDoEntity;
import com.example.operation_platform.model.entity.OperationItem; import com.example.operation_platform.model.entity.OperationItem;
import com.example.operation_platform.model.vo.AllCountVO;
import com.example.operation_platform.model.vo.OperationDoVO; import com.example.operation_platform.model.vo.OperationDoVO;
import com.example.operation_platform.service.OperationDoService; import com.example.operation_platform.service.OperationDoService;
import com.example.operation_platform.service.OperationItemService; import com.example.operation_platform.service.OperationItemService;
...@@ -65,4 +66,16 @@ public class OperationDoServiceImpl extends ServiceImpl<OperationDoMapper, Opera ...@@ -65,4 +66,16 @@ public class OperationDoServiceImpl extends ServiceImpl<OperationDoMapper, Opera
public void stopDo(OperationDoDTO operationDoDTO) { public void stopDo(OperationDoDTO operationDoDTO) {
this.baseMapper.stopDo(operationDoDTO); this.baseMapper.stopDo(operationDoDTO);
} }
@Override
public List<OperationDoVO> queryDoRunLog(OperationDoDTO operationDoDTO) {
return this.baseMapper.queryDoRunLog(operationDoDTO);
}
@Override
public List<Integer> queryRunLogIdList() {
return this.baseMapper.queryRunLogIdList();
}
@Override
public AllCountVO querycount() {
return this.baseMapper.querycount();
}
} }
\ No newline at end of file
...@@ -42,4 +42,13 @@ public class OperationJobServiceImpl extends ServiceImpl<OperationJobMapper, Ope ...@@ -42,4 +42,13 @@ public class OperationJobServiceImpl extends ServiceImpl<OperationJobMapper, Ope
OperationJobVO operationJobVO = baseMapper.queryLastTime(); OperationJobVO operationJobVO = baseMapper.queryLastTime();
return operationJobVO; return operationJobVO;
} }
@Override
public void updateRunLogStatus(Integer id) {
baseMapper.updateRunLogStatus(id);
}
@Override
public OperationJobVO queryWarn() {
OperationJobVO operationJobVO = baseMapper.queryWarn();
return operationJobVO;
}
} }
...@@ -7,6 +7,7 @@ import com.example.operation_platform.model.entity.RunLogEntity; ...@@ -7,6 +7,7 @@ import com.example.operation_platform.model.entity.RunLogEntity;
import com.example.operation_platform.model.entity.UavOperateLogEntity; import com.example.operation_platform.model.entity.UavOperateLogEntity;
import com.example.operation_platform.model.vo.RunLogVO; import com.example.operation_platform.model.vo.RunLogVO;
import com.example.operation_platform.service.OperateLogService; import com.example.operation_platform.service.OperateLogService;
import com.example.operation_platform.service.OperationDoService;
import com.example.operation_platform.service.RunLogService; import com.example.operation_platform.service.RunLogService;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.platform.utils.ExcelUtil; import com.platform.utils.ExcelUtil;
...@@ -15,9 +16,11 @@ import org.springframework.stereotype.Service; ...@@ -15,9 +16,11 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -32,7 +35,8 @@ public class RunLogServiceImpl extends ServiceImpl<RunLogMapper, RunLogEntity> i ...@@ -32,7 +35,8 @@ public class RunLogServiceImpl extends ServiceImpl<RunLogMapper, RunLogEntity> i
public List<RunLogVO> queryLogList(RunLogDTO runLogDTO) { public List<RunLogVO> queryLogList(RunLogDTO runLogDTO) {
return baseMapper.queryLogList(runLogDTO); return baseMapper.queryLogList(runLogDTO);
} }
@Resource
private OperationDoService operationDoService;
@Override @Override
public List<UavOperateLogEntity> getInfoById(String id) { public List<UavOperateLogEntity> getInfoById(String id) {
RunLogEntity runLogEntity = getById(id); RunLogEntity runLogEntity = getById(id);
...@@ -83,4 +87,31 @@ public class RunLogServiceImpl extends ServiceImpl<RunLogMapper, RunLogEntity> i ...@@ -83,4 +87,31 @@ public class RunLogServiceImpl extends ServiceImpl<RunLogMapper, RunLogEntity> i
"机器人运行日志.xlsx", "机器人运行日志.xlsx",
ServletUtils.getResponse()); ServletUtils.getResponse());
} }
@Override
public List<Map<String, Object>> getAlertAndFailureLogs() {
List<Map<String, Object>> result = new ArrayList<>();
List<Integer> runLogIds = operationDoService.queryRunLogIdList();
for (Integer runLogId : runLogIds) {
List<UavOperateLogEntity> logs = getInfoById(runLogId.toString());
for (UavOperateLogEntity log : logs) {
if (log.getContent().contains("告警") || log.getContent().contains("失败")) {
Map<String, Object> entry = new HashMap<>();
entry.put("content", log.getContent());
entry.put("dateTime", log.getDataTime());
result.add(entry);
}
}
}
return result;
}
@Override
public String getMergedContentForRunLogId(String id) {
List<UavOperateLogEntity> logs = getInfoById(id);
return logs.stream()
.limit(5)
.map(UavOperateLogEntity::getContent)
.collect(Collectors.joining(", "));
}
} }
...@@ -7,12 +7,18 @@ import com.example.operation_platform.model.entity.TbOperationRecordEntity; ...@@ -7,12 +7,18 @@ import com.example.operation_platform.model.entity.TbOperationRecordEntity;
import com.example.operation_platform.model.vo.OperationRecordVO; import com.example.operation_platform.model.vo.OperationRecordVO;
import com.example.operation_platform.service.TbOperationRecordService; import com.example.operation_platform.service.TbOperationRecordService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
public class TbOperationRecordServiceImpl extends ServiceImpl<TbOperationRecordMapper, TbOperationRecordEntity> implements TbOperationRecordService { public class TbOperationRecordServiceImpl extends ServiceImpl<TbOperationRecordMapper, TbOperationRecordEntity> implements TbOperationRecordService {
@Resource
private RunLogServiceImpl runLogService;
@Override @Override
public List<OperationRecordVO> queryrecordList(OperationRecordDTO operationRecordDTO) { public List<OperationRecordVO> queryrecordList(OperationRecordDTO operationRecordDTO) {
...@@ -26,4 +32,30 @@ public class TbOperationRecordServiceImpl extends ServiceImpl<TbOperationRecordM ...@@ -26,4 +32,30 @@ public class TbOperationRecordServiceImpl extends ServiceImpl<TbOperationRecordM
public List<OperationRecordVO> queryRunLogRecordList(OperationRecordDTO operationRecordDTO) { public List<OperationRecordVO> queryRunLogRecordList(OperationRecordDTO operationRecordDTO) {
return baseMapper.queryRunLogRecordList(operationRecordDTO); return baseMapper.queryRunLogRecordList(operationRecordDTO);
} }
@Override
public List<OperationRecordVO> queryRunLogRecordListAndWarnMessage(OperationRecordDTO operationRecordDTO) {
List<OperationRecordVO> operationRecordVOList = baseMapper.queryRunLogRecordList(operationRecordDTO);
List<Map<String, Object>> alertAndFailureLogs = runLogService.getAlertAndFailureLogs();
// 由于getAlertAndFailureLogs()返回的Map中没有runLogId,我们需要调整匹配逻辑
// 这里假设OperationRecordVO中的tb_run_log_id对应的是日志的ID
for (OperationRecordVO operationRecordVO : operationRecordVOList) {
StringBuilder warnMessage = new StringBuilder();
// 遍历所有告警和失败日志
for (Map<String, Object> log : alertAndFailureLogs) {
String content = (String) log.get("content");
if (content != null && !content.isEmpty()) {
if (warnMessage.length() > 0) {
warnMessage.append("\n");
}
warnMessage.append(content);
}
}
operationRecordVO.setWarnMessage(warnMessage.toString());
}
return operationRecordVOList;
}
} }
...@@ -4,14 +4,10 @@ import com.example.operation_platform.model.entity.UavOperateLogEntity; ...@@ -4,14 +4,10 @@ import com.example.operation_platform.model.entity.UavOperateLogEntity;
import com.example.operation_platform.service.OperateLogService; import com.example.operation_platform.service.OperateLogService;
import com.platform.service.MongoService; import com.platform.service.MongoService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
public class UavOperateLogServiceImpl implements OperateLogService { public class UavOperateLogServiceImpl implements OperateLogService {
...@@ -29,44 +25,6 @@ public class UavOperateLogServiceImpl implements OperateLogService { ...@@ -29,44 +25,6 @@ public class UavOperateLogServiceImpl implements OperateLogService {
return mongoService.findByMap(keys, return mongoService.findByMap(keys,
values, values,
UavOperateLogEntity.class); UavOperateLogEntity.class);
} }
// @Override
// public void updateRunLogIdByDate(String originalRunLogId) {
// // 1. 查询原始数据
// List<UavOperateLogEntity> originalList = mongoService.findByMap(
// new String[]{"run_log_id"},
// new Object[]{originalRunLogId},
// UavOperateLogEntity.class
// );
//
// // 2. 按日期分组,并分配新编号(1, 2, 3...)
// Map<LocalDate, Integer> dateToNewIdMap = new HashMap<>();
// List<UavOperateLogEntity> updatedEntities = new ArrayList<>();
//
// for (UavOperateLogEntity entity : originalList) {
// LocalDate date = entity.getDataTime().toInstant()
// .atZone(ZoneId.systemDefault())
// .toLocalDate();
//
// // 如果该日期未分配编号,则分配新编号(从1开始)
// if (!dateToNewIdMap.containsKey(date)) {
// int newId = dateToNewIdMap.size() + 1; // 1, 2, 3...
// dateToNewIdMap.put(date, newId);
// }
//
// // 更新 run_log_id(直接使用 Integer)
// entity.setRunLogId(dateToNewIdMap.get(date));
// updatedEntities.add(entity);
// }
//
// // 3. 批量更新数据库(使用 updateById)
// for (UavOperateLogEntity entity : updatedEntities) {
// mongoService.updateById(
// new String[]{"run_log_id"}, // 要更新的字段
// new Object[]{entity.getRunLogId()}, // 新值(Integer)
// entity.getId(), // 主键ID
// UavOperateLogEntity.class
// );
// }
// }
} }
...@@ -20,8 +20,8 @@ public class WorkerServiceImpl extends ServiceImpl<WorkerMapper, WorkerEntity> i ...@@ -20,8 +20,8 @@ public class WorkerServiceImpl extends ServiceImpl<WorkerMapper, WorkerEntity> i
return this.baseMapper.queryList(workerDTO); return this.baseMapper.queryList(workerDTO);
} }
@Override @Override
public WorkerVO queryById(Integer id) { public WorkerVO queryMyMessage(String username) {
return this.baseMapper.queryById(id); return this.baseMapper.queryMyMessage(username);
} }
@Override @Override
public WorkerVO queryByUsername(WorkerDTO WorkerDTO) { public WorkerVO queryByUsername(WorkerDTO WorkerDTO) {
......
...@@ -268,7 +268,7 @@ public class OperationDoTask { ...@@ -268,7 +268,7 @@ public class OperationDoTask {
jsonObject.put("device", messageNeedDataVo.getRobotName()); jsonObject.put("device", messageNeedDataVo.getRobotName());
jsonObject.put("alert", messageNeedDataVo.getOperationType()); jsonObject.put("alert", messageNeedDataVo.getOperationType());
jsonObject.put("time", messageNeedDataVo.getStartTime()); jsonObject.put("time", messageNeedDataVo.getStartTime());
aliSmsUtil.sendSms(phone, jsonObject, "SMS_481685150"); aliSmsUtil.sendSms(phone, jsonObject, "SMS_481630372");
} }
......
package com.example.operation_platform.task; package com.example.operation_platform.task;
public class RunLogTask { public class RunLogTask {
// public static void main(String[] args) {
// while (true) {
// try {
// checkStatusAndSendSMS();
// Thread.sleep(60000); // 每分钟检查一次
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
// }
} }
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
<select id="queryPeople" resultType="com.example.operation_platform.model.vo.PeopleMessageVO"> <select id="queryPeople" resultType="com.example.operation_platform.model.vo.PeopleMessageVO">
SELECT SELECT
tm.id id, tm.id id,
tor.name stationName,
COALESCE(br.name, dr.name) robotName,
tor.contact_phone phoneNumber, tor.contact_phone phoneNumber,
tp.worker_name softwareWorker, tp.worker_name softwareWorker,
ta.worker_name hardwareWorker, ta.worker_name hardwareWorker,
...@@ -60,6 +62,9 @@ ...@@ -60,6 +62,9 @@
LEFT JOIN tb_worker tp ON tm.software_worker = tp.id LEFT JOIN tb_worker tp ON tm.software_worker = tp.id
LEFT JOIN tb_worker ta ON tm.hardware_worker = ta.id LEFT JOIN tb_worker ta ON tm.hardware_worker = ta.id
LEFT JOIN tb_worker tq ON tm.operation_worker = tq.id LEFT JOIN tb_worker tq ON tm.operation_worker = tq.id
LEFT JOIN uav_drone dr ON tm.drone_id = dr.id
LEFT JOIN bs_robot br ON tm.robot_id = br.id
<where> <where>
<if test="stationId != null and stationId != ''"> <if test="stationId != null and stationId != ''">
tm.station_id = #{stationId} tm.station_id = #{stationId}
...@@ -76,34 +81,30 @@ ...@@ -76,34 +81,30 @@
SELECT SELECT
tm.id id, tm.id id,
tor.name stationName, tor.name stationName,
tw.worker_name peopleName, COALESCE(br.name, dr.name) robotName,
tor.contact_phone phoneNumber,
tp.worker_name softwareWorker, tp.worker_name softwareWorker,
ta.worker_name hardwareWorker, ta.worker_name hardwareWorker,
tq.worker_name operationWorker, tq.worker_name operationWorker,
tw.phone_number peopleNumber, tor.contact peopleName,
tp.phone_number softwareNumber, tp.phone_number softwareNumber,
ta.phone_number hardwareNumber, ta.phone_number hardwareNumber,
tq.phone_number operationNumber tq.phone_number operationNumber
FROM FROM
tb_message tm tb_message tm
LEFT JOIN bs_station tor ON tm.station_id = tor.id
LEFT JOIN tb_worker tp ON tm.software_worker = tp.id LEFT JOIN tb_worker tp ON tm.software_worker = tp.id
LEFT JOIN tb_worker ta ON tm.hardware_worker = ta.id LEFT JOIN tb_worker ta ON tm.hardware_worker = ta.id
LEFT JOIN tb_worker tq ON tm.operation_worker = tq.id LEFT JOIN tb_worker tq ON tm.operation_worker = tq.id
LEFT JOIN bs_station tor ON tm.station_id = tor.id LEFT JOIN uav_drone dr ON tm.drone_id = dr.id
LEFT JOIN bs_robot br ON tm.robot_id = br.id
<where>
<if test="username != null and username != ''">
tq.username = #{username}
</if>
</where>
</select> </select>
<!-- <select id="queryByworkerid" resultType="com.example.operation_platform.model.vo.PeopleMessageVO">-->
<!-- SELECT-->
<!-- o.id id,-->
<!-- FROM tb_operation o-->
<!-- LEFT JOIN tb_message m-->
<!-- ON m.station_id = o.station_id-->
<!-- AND m.robot_id = o.robot_id-->
<!-- WHERE m.people_id = #{worker_id}-->
<!-- OR m.software_worker = #{worker_id}-->
<!-- OR m.hardware_worker = #{worker_id}-->
<!-- OR m.operation_worker = #{worker_id};-->
<!-- </select>-->
<select id="querypeopleId" resultType="com.example.operation_platform.model.vo.MessageVO"> <select id="querypeopleId" resultType="com.example.operation_platform.model.vo.MessageVO">
SELECT SELECT
tm.id, tm.id,
...@@ -174,8 +175,7 @@ ...@@ -174,8 +175,7 @@
tm.station_id = #{stationId} tm.station_id = #{stationId}
</select> </select>
<select id="querystationByworker" resultType="com.example.operation_platform.model.vo.MessageVO"> <select id="querystationByworker" resultType="com.example.operation_platform.model.vo.MessageVO">
select select DISTINCT
tm.id,
tm.station_id stationId, tm.station_id stationId,
bs.name stationName bs.name stationName
from from
......
...@@ -63,6 +63,9 @@ ...@@ -63,6 +63,9 @@
<if test="id != null and id != ''"> <if test="id != null and id != ''">
AND top.id = #{id} AND top.id = #{id}
</if> </if>
<if test="username != null and username != ''">
and bw.username = #{username}
</if>
</where> </where>
ORDER BY top.start_time DESC ORDER BY top.start_time DESC
</select> </select>
...@@ -87,5 +90,86 @@ ...@@ -87,5 +90,86 @@
and top.runlog_or_operation = 0 and top.runlog_or_operation = 0
and tb.start_time > CURRENT_TIMESTAMP and tb.start_time > CURRENT_TIMESTAMP
</select> </select>
<select id="queryDoRunLog" resultType="com.example.operation_platform.model.vo.OperationDoVO">
SELECT
top.id AS id,
top.operation_cycle AS operationCycle,
top.start_time AS startTime,
COALESCE(br.name, dr.name) AS robotName,
bs.name AS stationName,
bw.worker_name AS workerName,
top.operation_type AS operationType,
top.status AS status,
top.robot_id AS robotId,
top.station_id AS stationId,
top.item_id AS itemId,
top.finish_time AS finishTime,
top.drone_id AS droneId,
latest_rd.operation_date AS lastTime,
(
SELECT GROUP_CONCAT(DISTINCT bti.operation_item SEPARATOR ', ')
FROM tb_operation_item bti
WHERE FIND_IN_SET(bti.id, top.item_id) > 0
) AS operationItems
FROM tb_operation top
LEFT JOIN bs_robot br ON top.robot_id = br.id
LEFT JOIN bs_station bs ON top.station_id = bs.id
LEFT JOIN tb_message tb ON top.station_id = tb.station_id
AND (top.robot_id = tb.robot_id OR (top.robot_id IS NULL AND top.drone_id = tb.drone_id))
LEFT JOIN tb_worker bw ON tb.operation_worker = bw.id
LEFT JOIN uav_drone dr ON top.drone_id = dr.id
LEFT JOIN (
SELECT rd1.*
FROM tb_operation_record rd1
INNER JOIN (
SELECT operation_id, MAX(operation_date) AS max_date
FROM tb_operation_record
GROUP BY operation_id
) rd2 ON rd1.operation_id = rd2.operation_id AND rd1.operation_date = rd2.max_date
) latest_rd ON top.id = latest_rd.operation_id
<where>
top.runlog_or_operation = 1
<if test="robotName != null and robotName != ''">
and br.name LIKE CONCAT('%', #{robotName}, '%')
or dr.name LIKE CONCAT('%', #{robotName}, '%')
</if>
<if test="stationName != null and stationName != ''">
AND bs.name LIKE CONCAT('%', #{stationName}, '%')
</if>
<if test="workerName != null and workerName != ''">
AND bw.worker_name LIKE CONCAT('%', #{workerName}, '%')
</if>
<if test="status != null and status != ''">
AND top.status = #{status}
</if>
<if test="startTime != null">
AND top.start_time &gt;= #{startTime}
</if>
<if test="endTime != null">
AND top.start_time &lt;= #{endTime} <!-- 注意字段名是finish_time还是end_time -->
</if>
<if test="id != null and id != ''">
AND top.id = #{id}
</if>
<if test="username != null and username != ''">
and bw.username = #{username}
</if>
</where>
ORDER BY top.start_time DESC
</select>
<select id="queryRunLogIdList" resultType="java.lang.Integer">
select
top.tb_run_log_id AS runLogId
from tb_operation top
where
top.runlog_or_operation = 1
</select>
<select id="querycount" resultType="com.example.operation_platform.model.vo.AllCountVO">
select
(select count(*) from tb_operation top where top.runlog_or_operation = 0) as operationDoCount,
(select count(*) from tb_operation_job tp where tp.runlog_or_operation = 0) as JobCount,
(select count(*) from tb_operation top where top.runlog_or_operation = 1) as warnCount
</select>
</mapper> </mapper>
...@@ -60,6 +60,9 @@ ...@@ -60,6 +60,9 @@
<if test="stationId != null and stationId != ''"> <if test="stationId != null and stationId != ''">
and top.station_id = #{stationId} and top.station_id = #{stationId}
</if> </if>
<if test="username != null and username != ''">
and bw.username = #{username}
</if>
</where> </where>
ORDER BY top.start_time DESC ORDER BY top.start_time DESC
</select> </select>
...@@ -68,7 +71,7 @@ ...@@ -68,7 +71,7 @@
SELECT SELECT
top.id, top.id,
tp.operation_type AS operationType, tp.operation_type AS operationType,
tp.operation_id AS operationId, top.operation_id AS operationId,
bs.name AS stationName, bs.name AS stationName,
-- 合并 robot 和 drone 的 name 到 robotName(优先取 robot) -- 合并 robot 和 drone 的 name 到 robotName(优先取 robot)
COALESCE( COALESCE(
...@@ -98,6 +101,7 @@ ...@@ -98,6 +101,7 @@
LEFT JOIN tb_worker bw ON tm.operation_worker = bw.id LEFT JOIN tb_worker bw ON tm.operation_worker = bw.id
<where> <where>
top.runlog_or_operation = 0 top.runlog_or_operation = 0
AND top.finish_status NOT IN (2, 4)
<if test="date != null"> <if test="date != null">
AND #{date} BETWEEN top.start_time AND top.end_time AND #{date} BETWEEN top.start_time AND top.end_time
</if> </if>
...@@ -109,6 +113,9 @@ ...@@ -109,6 +113,9 @@
<if test="username != null and username != ''"> <if test="username != null and username != ''">
and bw.username = #{username} and bw.username = #{username}
</if> </if>
<if test="finishStatus != null and finishStatus != ''">
and top.finish_status = #{finishStatus}
</if>
</where> </where>
ORDER BY top.start_time DESC ORDER BY top.start_time DESC
</select> </select>
...@@ -238,6 +245,25 @@ ...@@ -238,6 +245,25 @@
ORDER BY start_time ASC ORDER BY start_time ASC
LIMIT 1; LIMIT 1;
</select> </select>
<update id="updateRunLogStatus" parameterType="com.example.operation_platform.model.vo.OperationJobVO">
UPDATE tb_operation_job
SET finish_status = 4
WHERE id = #{id};
</update>
<!-- 首页轮播展示-->
<select id="queryWarn" resultType="com.example.operation_platform.model.vo.OperationJobVO">
select
COALESCE(br.name, dr.name) AS robotName,
bs.name AS stationName,
tp.operation_type AS operationType
from tb_operation_job top
LEFT JOIN tb_operation tp ON top.operation_id = tp.id
LEFT JOIN bs_station bs ON tp.station_id = bs.id
LEFT JOIN bs_robot br ON tp.robot_id = br.id
LEFT JOIN uav_drone dr ON tp.drone_id = dr.id
where
top.runlog_or_operation = 1
and top.finish_status = 1
</select>
</mapper> </mapper>
...@@ -115,6 +115,42 @@ ...@@ -115,6 +115,42 @@
<if test="stationId != null and stationId != ''"> <if test="stationId != null and stationId != ''">
and top.station_id= #{stationId} and top.station_id= #{stationId}
</if> </if>
<if test="stationName != null and stationName != ''">
and bs.name LIKE CONCAT('%', #{stationName}, '%')
</if>
order by tor.operation_date desc
</select>
<!-- 异常维保记录包含告警信息,可以根据泵站名或id查询-->
<select id="queryRunLogRecordListAndWarnMessage" resultType="com.example.operation_platform.model.vo.OperationRecordVO">
SELECT
tor.id id,
tor.content content,
tor.img img,
tor.operation_date operationDate,
tor.note note,
top.tb_run_log_id tb_run_log_id
FROM
tb_operation_record tor
LEFT JOIN
tb_operation top ON tor.operation_id = top.id
LEFT JOIN
tb_message tm ON top.station_id = tm.station_id
LEFT JOIN
bs_station bs ON tm.station_id = bs.id
LEFT JOIN
tb_worker tw ON tm.operation_worker=tw.id
<where>
top.runlog_or_operation = 1
<if test="username != null and username != ''">
and bw.username = #{username}
</if>
<if test="stationId != null and stationId != ''">
and top.station_id= #{stationId}
</if>
<if test="stationName != null and stationName != ''">
and bs.name LIKE CONCAT('%', #{stationName}, '%')
</if>
</where>
order by tor.operation_date desc order by tor.operation_date desc
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -19,18 +19,24 @@ ...@@ -19,18 +19,24 @@
on on
tw.type = typ.id tw.type = typ.id
</select> </select>
<select id="queryById" resultType="com.example.operation_platform.model.vo.WorkerVO"> <select id="queryMyMessage" resultType="com.example.operation_platform.model.vo.WorkerVO">
select select
tw.id id, tw.id id,
tw.worker_name workerName, tw.worker_name workerName,
tw.img img, tw.img img,
tw.phone_number phoneNumber, tw.phone_number phoneNumber,
tw.company company, tw.company company,
tw.password password tw.password password,
typ.worker_type type,
tw.type typeId
from from
tb_worker tw tb_worker tw
left join
tb_workertype typ
on
tw.type = typ.id
where where
tw.id = #{id} tw.username = #{username}
</select> </select>
<select id="queryByUsername" resultType="com.example.operation_platform.model.vo.WorkerVO"> <select id="queryByUsername" resultType="com.example.operation_platform.model.vo.WorkerVO">
select select
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment