From d0ab570ccf4731ef1b63c412f869e11d8717a78e Mon Sep 17 00:00:00 2001 From: wu Date: Thu, 29 May 2025 10:00:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=88=B0110=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yingji/entity/AcceptEvents.java | 141 +++++++++ .../src/main/java/com/yingji/entity/Amb.java | 75 +++++ .../main/java/com/yingji/entity/Event.java | 187 ++++++++++++ .../java/com/yingji/entity/EventClass.java | 42 +++ .../src/main/java/com/yingji/entity/Fire.java | 162 ++++++++++ .../src/main/java/com/yingji/entity/Task.java | 172 +++++++++++ .../entity/dto/response/EventPageRequest.java | 100 +++++++ .../dto/response/EventsFindResponse.java | 144 +++++++++ .../entity/dto/response/EventsResponse.java | 154 ++++++++++ .../yingji/entity/dto/response/TaskInfos.java | 24 ++ .../java/com/yingji/mapper/AcceptMapper.java | 15 + .../java/com/yingji/mapper/AmbMapper.java | 15 + .../com/yingji/mapper/EventClassMapper.java | 15 + .../java/com/yingji/mapper/EventMapper.java | 15 + .../java/com/yingji/mapper/FireMapper.java | 32 ++ .../java/com/yingji/mapper/TaskMapper.java | 15 + .../com/yingji/quartz/AccidentQuartz.java | 84 ++++++ .../java/com/yingji/quartz/FireQuartz.java | 123 ++++++++ .../com/yingji/service/AcceptService.java | 15 + .../com/yingji/service/AccidentService.java | 37 +++ .../java/com/yingji/service/AmbService.java | 15 + .../com/yingji/service/EventClassService.java | 23 ++ .../java/com/yingji/service/EventService.java | 44 +++ .../java/com/yingji/service/FireService.java | 48 +++ .../java/com/yingji/service/TaskService.java | 15 + .../service/impl/AcceptServiceImpl.java | 19 ++ .../service/impl/AccidentServiceImpl.java | 282 ++++++++++++++++++ .../yingji/service/impl/AlarmServiceImpl.java | 8 +- .../yingji/service/impl/AmbServiceImpl.java | 19 ++ .../service/impl/EventClassServiceImpl.java | 32 ++ .../yingji/service/impl/EventServiceImpl.java | 122 ++++++++ .../yingji/service/impl/FireServiceImpl.java | 152 ++++++++++ .../yingji/service/impl/TaskServiceImpl.java | 19 ++ alarm/src/main/resources/application-dev.yml | 29 +- .../resources/mapper/yingji/FireMapper.xml | 28 ++ .../yingji/controller/EventController.java | 9 + .../yingji/service/impl/EventServiceImpl.java | 9 + 37 files changed, 2432 insertions(+), 8 deletions(-) create mode 100644 alarm/src/main/java/com/yingji/entity/AcceptEvents.java create mode 100644 alarm/src/main/java/com/yingji/entity/Amb.java create mode 100644 alarm/src/main/java/com/yingji/entity/Event.java create mode 100644 alarm/src/main/java/com/yingji/entity/EventClass.java create mode 100644 alarm/src/main/java/com/yingji/entity/Fire.java create mode 100644 alarm/src/main/java/com/yingji/entity/Task.java create mode 100644 alarm/src/main/java/com/yingji/entity/dto/response/EventPageRequest.java create mode 100644 alarm/src/main/java/com/yingji/entity/dto/response/EventsFindResponse.java create mode 100644 alarm/src/main/java/com/yingji/entity/dto/response/EventsResponse.java create mode 100644 alarm/src/main/java/com/yingji/entity/dto/response/TaskInfos.java create mode 100644 alarm/src/main/java/com/yingji/mapper/AcceptMapper.java create mode 100644 alarm/src/main/java/com/yingji/mapper/AmbMapper.java create mode 100644 alarm/src/main/java/com/yingji/mapper/EventClassMapper.java create mode 100644 alarm/src/main/java/com/yingji/mapper/EventMapper.java create mode 100644 alarm/src/main/java/com/yingji/mapper/FireMapper.java create mode 100644 alarm/src/main/java/com/yingji/mapper/TaskMapper.java create mode 100644 alarm/src/main/java/com/yingji/quartz/AccidentQuartz.java create mode 100644 alarm/src/main/java/com/yingji/quartz/FireQuartz.java create mode 100644 alarm/src/main/java/com/yingji/service/AcceptService.java create mode 100644 alarm/src/main/java/com/yingji/service/AccidentService.java create mode 100644 alarm/src/main/java/com/yingji/service/AmbService.java create mode 100644 alarm/src/main/java/com/yingji/service/EventClassService.java create mode 100644 alarm/src/main/java/com/yingji/service/EventService.java create mode 100644 alarm/src/main/java/com/yingji/service/FireService.java create mode 100644 alarm/src/main/java/com/yingji/service/TaskService.java create mode 100644 alarm/src/main/java/com/yingji/service/impl/AcceptServiceImpl.java create mode 100644 alarm/src/main/java/com/yingji/service/impl/AccidentServiceImpl.java create mode 100644 alarm/src/main/java/com/yingji/service/impl/AmbServiceImpl.java create mode 100644 alarm/src/main/java/com/yingji/service/impl/EventClassServiceImpl.java create mode 100644 alarm/src/main/java/com/yingji/service/impl/EventServiceImpl.java create mode 100644 alarm/src/main/java/com/yingji/service/impl/FireServiceImpl.java create mode 100644 alarm/src/main/java/com/yingji/service/impl/TaskServiceImpl.java create mode 100644 alarm/src/main/resources/mapper/yingji/FireMapper.xml diff --git a/alarm/src/main/java/com/yingji/entity/AcceptEvents.java b/alarm/src/main/java/com/yingji/entity/AcceptEvents.java new file mode 100644 index 0000000..ec8041b --- /dev/null +++ b/alarm/src/main/java/com/yingji/entity/AcceptEvents.java @@ -0,0 +1,141 @@ +package com.yingji.entity; + +import cn.hutool.core.annotation.Alias; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; + + +/** + * 受理调度信息(Accept)表实体类 + * + * @author wu + * @since 2024-05-10 17:10:32 + */ +@Data +@ApiModel("受理调度信息实体类") +@TableName(value = "accept") +public class AcceptEvents implements Serializable { + + private static final long serialVersionUID = 817570017991202657L; + /** + * 受理编码 主键 + */ + @ApiModelProperty(value = "受理编码 主键") + @Alias("AcceptId") + @TableId + private String acceptId; + /** + * 呼救电话 + */ + @ApiModelProperty(value = "呼救电话") + @Alias("AlarmTelephone") + private String alarmTelephone; + /** + * 病种判断 + */ + @ApiModelProperty(value = "病种判断") + @Alias("DiseaseJudge") + private String diseaseJudge; + /** + * 患者姓名 + */ + @ApiModelProperty(value = "患者姓名") + @Alias("PatientName") + private String patientName; + /** + * 患者性别 + */ + @ApiModelProperty(value = "患者性别") + @Alias("PatientSex") + private String patientSex; + /** + * 患者年龄 + */ + @ApiModelProperty(value = "患者年龄") + @Alias("PatientAge") + private String patientAge; + /** + * 受理类型 + */ + @ApiModelProperty(value = "受理类型") + @Alias("AcceptType") + private String acceptType; + /** + * 责任受理人 + */ + @ApiModelProperty(value = "责任受理人") + @Alias("ResponsibleRecipient") + private String responsibleRecipient; + /** + * 现场地址 + */ + @ApiModelProperty(value = "现场地址") + @Alias("EventAddress") + private String eventAddress; + /** + * 等车地点 + */ + @ApiModelProperty(value = "等车地点") + @Alias("WaitAddress") + private String waitAddress; + /** + * 送往地点 + */ + @ApiModelProperty(value = "送往地点") + @Alias("SendAddress") + private String sendAddress; + /** + * 电话振铃时刻 + */ + @ApiModelProperty(value = "电话振铃时刻") + @Alias("RingDateTime") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime ringDateTime; + /** + * 开始受理时刻 + */ + @ApiModelProperty(value = "开始受理时刻") + @Alias("StartAcceptDateTime") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime startAcceptDateTime; + /** + * 结束受理时刻 + */ + @ApiModelProperty(value = "结束受理时刻") + @Alias("EndAcceptDateTime") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime endAcceptDateTime; + /** + * 发送指令时刻 + */ + @ApiModelProperty(value = "发送指令时刻") + @Alias("SendOrderDateTime") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime sendOrderDateTime; + /** + * 事件编码 + */ + @ApiModelProperty(value = "事件编码") + @Alias("EventId") + private String eventId; + /** + * 受理序号 + */ + @ApiModelProperty(value = "受理序号") + @Alias("AcceptOrder") + private String acceptOrder; + +} + diff --git a/alarm/src/main/java/com/yingji/entity/Amb.java b/alarm/src/main/java/com/yingji/entity/Amb.java new file mode 100644 index 0000000..8889f00 --- /dev/null +++ b/alarm/src/main/java/com/yingji/entity/Amb.java @@ -0,0 +1,75 @@ +package com.yingji.entity; + + +import cn.hutool.core.annotation.Alias; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +/** + * 任务车辆(Amb)表实体类 + * + * @author wu + * @since 2024-05-10 17:10:32 + */ +@Data +@ApiModel("任务车辆实体类") +@TableName(value = "amb") +public class Amb implements Serializable { + + private static final long serialVersionUID = -69012811106234254L; + /** + * 主键id + */ + @ApiModelProperty(value = "主键id") + @TableId(type = IdType.AUTO) + private Long id; + /** + * 任务id + */ + @ApiModelProperty(value = "任务id") + private String taskId; + /** + * 车牌号码 + */ + @ApiModelProperty(value = "车牌号码") + @Alias("PlateNumber") + private String plateNumber; + /** + * 实际标识 + */ + @ApiModelProperty(value = "实际标识") + @Alias("RealSign") + private String realSign; + /** + * 车辆编码 + */ + @ApiModelProperty(value = "车辆编码") + @Alias("AmbCode") + private String ambCode; + /** + * 分站 + */ + @ApiModelProperty(value = "分站") + @Alias("StationName") + private String stationName; + /** + * 车辆类型 + */ + @ApiModelProperty(value = "车辆类型") + @Alias("AmbType") + private String ambType; + /** + * 随车电话 + */ + @ApiModelProperty(value = "随车电话") + @Alias("AmbPhone") + private String ambPhone; +} + diff --git a/alarm/src/main/java/com/yingji/entity/Event.java b/alarm/src/main/java/com/yingji/entity/Event.java new file mode 100644 index 0000000..3e9ec1a --- /dev/null +++ b/alarm/src/main/java/com/yingji/entity/Event.java @@ -0,0 +1,187 @@ +package com.yingji.entity; + +import cn.hutool.core.annotation.Alias; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; + + +/** + * 事故(Event)表实体类 + * + * @author wu + * @since 2024-05-10 17:10:32 + */ +@Data +@ApiModel("事故实体类") +@TableName(value = "event") +public class Event implements Serializable { + + private static final long serialVersionUID = -50765468921159766L; + /** + * 事件编码主键 + */ + @ApiModelProperty(value = "事件编码主键") + @Alias("EventId") + @TableId + private String eventId; + /** + * 事件标题 + */ + @ApiModelProperty(value = "事件标题") + @Alias("EventName") + private String eventName; + /** + * 事件类型 + */ + @ApiModelProperty(value = "事件类型") + @Alias("EventType") + private String eventType; + /** + * 事件等级 + */ + @ApiModelProperty(value = "事件等级") + @Alias("EventLevel") + private String eventLevel; + /** + * 事发时间 + */ + @ApiModelProperty(value = "事发时间") + @Alias("EventDateTime") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime eventDateTime; + /** + * 事发地区(行政区划) + */ + @ApiModelProperty(value = "事发地区(行政区划)") + @Alias("EventArea") + private String eventArea; + /** + * 详细位置 + */ + @ApiModelProperty(value = "详细位置") + @Alias("EventAddress") + private String eventAddress; + /** + * 经度 + */ + @ApiModelProperty(value = "经度") + @Alias("EventLongitude") + private String eventLongitude; + /** + * 维度 + */ + @ApiModelProperty(value = "维度") + @Alias("EventLatitude") + private String eventLatitude; + /** + * 出动次数(出动救护车次/辆数量) + */ + @ApiModelProperty(value = "出动次数(出动救护车次/辆数量)") + @Alias("SendAmbCount") + private Integer sendAmbCount; + /** + * 事件描述 + */ + @ApiModelProperty(value = "事件描述") + @Alias("EventDescribe") + private String eventDescribe; + /** + * 报送单位 + */ + @ApiModelProperty(value = "报送单位") + @Alias("AlarmUnit") + private String alarmUnit; + /** + * 报送单位联系人 + */ + @ApiModelProperty(value = "报送单位联系人") + @Alias("AlarmUnitContactor") + private String alarmUnitContactor; + /** + * 报送单位联系电话 + */ + @ApiModelProperty(value = "报送单位联系电话") + @Alias("AlarmUnitTelephone") + private String alarmUnitTelephone; + /** + * 附件资料 + */ + @ApiModelProperty(value = "附件资料") + @Alias("AttachmentInfo") + private String attachmentInfo; + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + @Alias("Remark") + private String remark; + + /** + * 事故类型 + */ + @ApiModelProperty(value = "事故类型编码") + @Alias("AccidentType") + private String accidentType; + + + /** + * 事故类型 + */ + @ApiModelProperty(value = "事故类型") + private String aiClass; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + /** + * 最后更新时间 + */ + @ApiModelProperty(value = "最后更新时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + /** + * 110的event_id + */ + @ApiModelProperty(value = "110的event_id") + @TableField(value = "ai_110_id") + private String ai110Id; + + /** + * 110的紧急系数 + */ + @ApiModelProperty(value = "110的紧急系数") + @TableField(value = "ai_110_num") + private Double ai110Num; + + /** + * 119的event_id + */ + @ApiModelProperty(value = "119的event_id") + @TableField(value = "ai_119_id") + private String ai119Id; + + /** + * 119的紧急系数 + */ + @ApiModelProperty(value = "119的紧急系数") + @TableField(value = "ai_119_num") + private Double ai119Num; +} + diff --git a/alarm/src/main/java/com/yingji/entity/EventClass.java b/alarm/src/main/java/com/yingji/entity/EventClass.java new file mode 100644 index 0000000..25594cb --- /dev/null +++ b/alarm/src/main/java/com/yingji/entity/EventClass.java @@ -0,0 +1,42 @@ +package com.yingji.entity; + + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +/** + * (AcceptClass)表实体类 + * + * @author wu + * @since 2024-06-14 14:32:49 + */ +@Data +@ApiModel("实体类") +@TableName(value = "event_class") +public class EventClass implements Serializable { + + private static final long serialVersionUID = -34185186253758694L; + /** + * 主键id + */ + @ApiModelProperty(value = "主键id") + private Long id; + + /** + * 编码AcceptType + */ + @ApiModelProperty(value = "事件类型编码") + private String acceptType; + + /** + * 事件类型ai_class + */ + @ApiModelProperty(value = "事件类型") + private String aiClass; +} + diff --git a/alarm/src/main/java/com/yingji/entity/Fire.java b/alarm/src/main/java/com/yingji/entity/Fire.java new file mode 100644 index 0000000..bbdcf02 --- /dev/null +++ b/alarm/src/main/java/com/yingji/entity/Fire.java @@ -0,0 +1,162 @@ +package com.yingji.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @author wu + * @since 2024/6/4 下午4:26 + */ +@Data +@ApiModel("实体类") +@TableName(value = "Fire") +public class Fire implements Serializable { + + private static final long serialVersionUID = 9084065880894382754L; + + /** + * 主键id + */ + private String id; + + /** + * 行政区划 + */ + private String xzqh; + + /** + * 案件编号 + */ + private String ajbh; + + /** + * 案件描述 + */ + private String ajms; + + /** + * 归队时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime gdsj; + + private String jjyxm; + + /** + * 时间戳 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime sjc; + + /** + * 纬度 + */ + private String wd; + + /** + * 经度 + */ + private String jd; + + /** + * 备注信息 + */ + private String bcxx; + + /** + * 结束时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime jssj; + + /** + * 案发地址 + */ + private String afdz; + + /** + * 出动时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime cdsj; + + /** + * 立案方式代码 + */ + private String lafsdm; + + /** + * topic + */ + private String topic; + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime xdsj; + + /** + * 立案时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime lasj; + + /** + * 行政区划名称 + */ + private String xzqhmc; + + /** + * 到达现场时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime ddxcsj; + + /** + * 创建时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + /** + * 120的event_id + */ + @ApiModelProperty(value = "120的event_id") + @TableField(value = "ai_120_id") + private String ai120Id; + + /** + * 120的紧急系数 + */ + @ApiModelProperty(value = "120的紧急系数") + @TableField(value = "ai_120_num") + private Double ai120Num; + + /** + * 110的event_id + */ + @ApiModelProperty(value = "110的event_id") + @TableField(value = "ai_110_id") + private String ai110Id; + + /** + * 110的紧急系数 + */ + @ApiModelProperty(value = "110的紧急系数") + @TableField(value = "ai_110_num") + private Double ai110Num; +} diff --git a/alarm/src/main/java/com/yingji/entity/Task.java b/alarm/src/main/java/com/yingji/entity/Task.java new file mode 100644 index 0000000..7d0d711 --- /dev/null +++ b/alarm/src/main/java/com/yingji/entity/Task.java @@ -0,0 +1,172 @@ +package com.yingji.entity; + +import cn.hutool.core.annotation.Alias; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; + + +/** + * 任务信息(Task)表实体类 + * + * @author wu + * @since 2024-05-10 17:10:33 + */ +@Data +@ApiModel("任务信息实体类") +@TableName(value = "task") +public class Task implements Serializable { + + private static final long serialVersionUID = 148870996673219596L; + /** + * 主键id + */ + @ApiModelProperty(value = "主键id") + @Alias("TaskId") + @TableId + private String taskId; + /** + * 是否结束 + */ + @ApiModelProperty(value = "是否结束") + @Alias("IsOver") + private Boolean isOver; + /** + * 送往地点 + */ + @ApiModelProperty(value = "送往地点") + @Alias("RealSendAddress") + private String realSendAddress; + /** + * 生成任务时刻 + */ + @ApiModelProperty(value = "生成任务时刻") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Alias("TaskCreatedDateTime") + private LocalDateTime taskCreatedDateTime; + /** + * 接受命令时刻 + */ + @ApiModelProperty(value = "接受命令时刻") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Alias("AcceptOrderDateTime") + private LocalDateTime acceptOrderDateTime; + /** + * 出车时间 + */ + @ApiModelProperty(value = "出车时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Alias("OutAmbDateTime") + private LocalDateTime outAmbDateTime; + /** + * 到达现场时刻 + */ + @ApiModelProperty(value = "到达现场时刻") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Alias("ArriveSceneDateTime") + private LocalDateTime arriveSceneDateTime; + /** + * 离开现场时刻 + */ + @ApiModelProperty(value = "离开现场时刻") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Alias("LeaveSceneDateTime") + private LocalDateTime leaveSceneDateTime; + /** + * 到达医院时刻 + */ + @ApiModelProperty(value = "到达医院时刻") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Alias("ArriveHospitalDateTime") + private LocalDateTime arriveHospitalDateTime; + /** + * 完成任务时刻 + */ + @ApiModelProperty(value = "完成任务时刻") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Alias("ComplatedDateTime") + private LocalDateTime complatedDateTime; + /** + * 返回站中时刻 + */ + @ApiModelProperty(value = "返回站中时刻") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Alias("ReturnStationDateTime") + private LocalDateTime returnStationDateTime; + /** + * 是否正常结束 + */ + @ApiModelProperty(value = "是否正常结束") + @Alias("IsNormalOver") + private Boolean isNormalOver; + /** + * 异常原因 + */ + @ApiModelProperty(value = "异常原因") + @Alias("AbnormalReason") + private String abnormalReason; + /** + * 司机 + */ + @ApiModelProperty(value = "司机") + @Alias("Driver") + private String driver; + /** + * 医生 + */ + @ApiModelProperty(value = "医生") + @Alias("Doctor") + private String doctor; + /** + * 担架工 + */ + @ApiModelProperty(value = "担架工") + @Alias("Stretcher") + private String stretcher; + /** + * 担架工 + */ + @ApiModelProperty(value = "担架工") + @Alias("Nurse") + private String nurse; + /** + * 出车分站 + */ + @ApiModelProperty(value = "出车分站") + @Alias("StationName") + private String stationName; + /** + * 受理序号 + */ + @ApiModelProperty(value = "受理序号") + @Alias("AcceptOrder") + private String acceptOrder; + /** + * 受理编码 + */ + @ApiModelProperty(value = "受理编码") + @Alias("AcceptId") + private String acceptId; + /** + * 事件编码 + */ + @ApiModelProperty(value = "事件编码") + @Alias("EventId") + private String eventId; +} + diff --git a/alarm/src/main/java/com/yingji/entity/dto/response/EventPageRequest.java b/alarm/src/main/java/com/yingji/entity/dto/response/EventPageRequest.java new file mode 100644 index 0000000..80864d9 --- /dev/null +++ b/alarm/src/main/java/com/yingji/entity/dto/response/EventPageRequest.java @@ -0,0 +1,100 @@ +package com.yingji.entity.dto.response; + +import cn.hutool.core.annotation.Alias; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; + + +/** + * 事故(Event)表实体类 + * + * @author wu + * @since 2024-05-10 17:10:32 + */ +@Data +@ApiModel("事故分页查询请求类") +public class EventPageRequest implements Serializable { + + + private static final long serialVersionUID = -5290914853773569936L; + + /** + * 事件标题 + */ + @ApiModelProperty(value = "事件标题") + private String eventName; + /** + * 事件类型 + */ + @ApiModelProperty(value = "事件类型") + private String eventType; + /** + * 事件等级 + */ + @ApiModelProperty(value = "事件等级") + private String eventLevel; + + /** + * 事发开始时间 + */ + @ApiModelProperty(value = "事发开始时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime startTime; + + /** + * 事发结束时间 + */ + @ApiModelProperty(value = "事发开始时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime endTime; + /** + * 事发地区(行政区划) + */ + @ApiModelProperty(value = "事发地区(行政区划)") + private String eventArea; + /** + * 详细位置 + */ + @ApiModelProperty(value = "详细位置") + private String eventAddress; + /** + * 出动次数(出动救护车次/辆数量) + */ + @ApiModelProperty(value = "出动次数(出动救护车次/辆数量)") + @Alias("SendAmbCount") + private Integer sendAmbCount; + /** + * 事件描述 + */ + @ApiModelProperty(value = "事件描述") + @Alias("EventDescribe") + private String eventDescribe; + /** + * 报送单位 + */ + @ApiModelProperty(value = "报送单位") + @Alias("AlarmUnit") + private String alarmUnit; + /** + * 报送单位联系人 + */ + @ApiModelProperty(value = "报送单位联系人") + @Alias("AlarmUnitContactor") + private String alarmUnitContactor; + /** + * 报送单位联系电话 + */ + @ApiModelProperty(value = "报送单位联系电话") + @Alias("AlarmUnitTelephone") + private String alarmUnitTelephone; + +} + diff --git a/alarm/src/main/java/com/yingji/entity/dto/response/EventsFindResponse.java b/alarm/src/main/java/com/yingji/entity/dto/response/EventsFindResponse.java new file mode 100644 index 0000000..7a3882a --- /dev/null +++ b/alarm/src/main/java/com/yingji/entity/dto/response/EventsFindResponse.java @@ -0,0 +1,144 @@ +package com.yingji.entity.dto.response; + +import cn.hutool.core.annotation.Alias; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.yingji.entity.AcceptEvents; +import com.yingji.entity.Amb; +import com.yingji.entity.Task; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author wu + * @since 2024/4/30 下午4:24 + */ +@Data +@ApiModel(value = "响应类") +public class EventsFindResponse implements Serializable { + + private static final long serialVersionUID = -3894493286879970663L; + + /** + * 受理调度信息 + */ + @ApiModelProperty(value = "受理调度信息") + private List acceptEvents; + + /** + * 任务车辆 + */ + @ApiModelProperty(value = "任务车辆") + private List ambs; + + /** + * 任务信息 + */ + @ApiModelProperty(value = "任务信息") + private List tasks; + + /** + * 事件编码主键 + */ + @ApiModelProperty(value = "事件编码主键") + @Alias("EventId") + private String eventId; + /** + * 事件标题 + */ + @ApiModelProperty(value = "事件标题") + @Alias("EventName") + private String eventName; + /** + * 事件类型 + */ + @ApiModelProperty(value = "事件类型") + @Alias("EventType") + private String eventType; + /** + * 事件等级 + */ + @ApiModelProperty(value = "事件等级") + @Alias("EventLevel") + private String eventLevel; + /** + * 事发时间 + */ + @ApiModelProperty(value = "事发时间") + @Alias("EventDateTime") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime eventDateTime; + /** + * 事发地区(行政区划) + */ + @ApiModelProperty(value = "事发地区(行政区划)") + @Alias("EventArea") + private String eventArea; + /** + * 详细位置 + */ + @ApiModelProperty(value = "详细位置") + @Alias("EventAddress") + private String eventAddress; + /** + * 经度 + */ + @ApiModelProperty(value = "经度") + @Alias("EventLongitude") + private String eventLongitude; + /** + * 维度 + */ + @ApiModelProperty(value = "维度") + @Alias("EventLatitude") + private String eventLatitude; + /** + * 出动次数(出动救护车次/辆数量) + */ + @ApiModelProperty(value = "出动次数(出动救护车次/辆数量)") + @Alias("SendAmbCount") + private Integer sendAmbCount; + /** + * 事件描述 + */ + @ApiModelProperty(value = "事件描述") + @Alias("EventDescribe") + private String eventDescribe; + /** + * 报送单位 + */ + @ApiModelProperty(value = "报送单位") + @Alias("AlarmUnit") + private String alarmUnit; + /** + * 报送单位联系人 + */ + @ApiModelProperty(value = "报送单位联系人") + @Alias("AlarmUnitContactor") + private String alarmUnitContactor; + /** + * 报送单位联系电话 + */ + @ApiModelProperty(value = "报送单位联系电话") + @Alias("AlarmUnitTelephone") + private String alarmUnitTelephone; + /** + * 附件资料 + */ + @ApiModelProperty(value = "附件资料") + @Alias("AttachmentInfo") + private String attachmentInfo; + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + @Alias("Remark") + private String remark; + +} diff --git a/alarm/src/main/java/com/yingji/entity/dto/response/EventsResponse.java b/alarm/src/main/java/com/yingji/entity/dto/response/EventsResponse.java new file mode 100644 index 0000000..d933d68 --- /dev/null +++ b/alarm/src/main/java/com/yingji/entity/dto/response/EventsResponse.java @@ -0,0 +1,154 @@ +package com.yingji.entity.dto.response; + +import cn.hutool.core.annotation.Alias; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.yingji.entity.AcceptEvents; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author wu + * @since 2024/4/30 下午4:24 + */ +@Data +public class EventsResponse implements Serializable { + + private static final long serialVersionUID = -3894493286879970663L; + + /** + * 受理调度信息 + */ + @Alias("AcceptEvents") + @ApiModelProperty(value = "受理调度信息") + private List acceptEvents; + + @Alias("TaskInfos") + private List taskInfos; + + /** + * 事件标题 + */ + @Alias("EventName") + @ApiModelProperty(value = "事件标题") + private String eventName; + + /** + * 事件类型 + */ + @Alias("EventType") + @ApiModelProperty(value = "事件类型") + private String eventType; + + /** + * 事件等级 + */ + @Alias("EventLevel") + @ApiModelProperty(value = "事件等级") + private String eventLevel; + + /** + * 事发时间 + */ + @Alias("EventDateTime") + @ApiModelProperty(value = "事发时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime eventDateTime; + + /** + * 事件描述 + */ + @Alias("EventDescribe") + @ApiModelProperty(value = "事件描述") + private String eventDescribe; + + /** + * 事发地区(行政区划) + */ + @Alias("EventArea") + @ApiModelProperty(value = "事发地区(行政区划)") + private String eventArea; + + /** + * 详细位置 + */ + @Alias("EventAddress") + @ApiModelProperty(value = "详细位置") + private String eventAddress; + + /** + * 经度 + */ + @Alias("EventLongitude") + @ApiModelProperty(value = "经度") + private String eventLongitude; + + /** + * 维度 + */ + @Alias("EventLatitude") + @ApiModelProperty(value = "维度") + private Double eventLatitude; + + /** + * 报送单位 + */ + @Alias("AlarmUnit") + @ApiModelProperty(value = "报送单位") + private String alarmUnit; + + /** + * 报送单位联系人 + */ + @Alias("AlarmUnitContactor") + @ApiModelProperty(value = "报送单位联系人") + private String alarmUnitContactor; + + /** + * 报送单位联系电话 + */ + @Alias("AlarmUnitTelephone") + @ApiModelProperty(value = "报送单位联系电话") + private String alarmUnitTelephone; + + /** + * 出动次数(出动救护车次/辆数量) + */ + @Alias("SendAmbCount") + @ApiModelProperty(value = "出动次数(出动救护车次/辆数量)") + private Integer sendAmbCount; + + /** + * 附件资料 + */ + @Alias("AttachmentInfo") + @ApiModelProperty(value = "附件资料") + private String attachmentInfo; + + /** + * 备注 + */ + @Alias("Remark") + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 事件编码 主键 + */ + @Alias("EventId") + @ApiModelProperty(value = "事件编码 主键") + private String eventId; + + /** + * 事故类型 + */ + @ApiModelProperty(value = "事故类型编码") + @Alias("AccidentType") + private String accidentType; + +} diff --git a/alarm/src/main/java/com/yingji/entity/dto/response/TaskInfos.java b/alarm/src/main/java/com/yingji/entity/dto/response/TaskInfos.java new file mode 100644 index 0000000..1301062 --- /dev/null +++ b/alarm/src/main/java/com/yingji/entity/dto/response/TaskInfos.java @@ -0,0 +1,24 @@ +package com.yingji.entity.dto.response; + +import cn.hutool.core.annotation.Alias; +import com.yingji.entity.Amb; +import com.yingji.entity.Task; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author wu + * @since 2024/4/30 下午4:19 + */ +@Data +public class TaskInfos implements Serializable { + + private static final long serialVersionUID = 4118581272605160572L; + + @Alias("Amb") + private Amb amb; + + @Alias("Task") + private Task task; +} diff --git a/alarm/src/main/java/com/yingji/mapper/AcceptMapper.java b/alarm/src/main/java/com/yingji/mapper/AcceptMapper.java new file mode 100644 index 0000000..75575c9 --- /dev/null +++ b/alarm/src/main/java/com/yingji/mapper/AcceptMapper.java @@ -0,0 +1,15 @@ +package com.yingji.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.yingji.entity.AcceptEvents; + +/** + * 受理调度信息(Accept)表数据库访问层 + * + * @author wu + * @since 2024-05-10 17:10:32 + */ +public interface AcceptMapper extends BaseMapper { + +} + diff --git a/alarm/src/main/java/com/yingji/mapper/AmbMapper.java b/alarm/src/main/java/com/yingji/mapper/AmbMapper.java new file mode 100644 index 0000000..cc5761c --- /dev/null +++ b/alarm/src/main/java/com/yingji/mapper/AmbMapper.java @@ -0,0 +1,15 @@ +package com.yingji.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.yingji.entity.Amb; + +/** + * 任务车辆(Amb)表数据库访问层 + * + * @author wu + * @since 2024-05-10 17:10:32 + */ +public interface AmbMapper extends BaseMapper { + +} + diff --git a/alarm/src/main/java/com/yingji/mapper/EventClassMapper.java b/alarm/src/main/java/com/yingji/mapper/EventClassMapper.java new file mode 100644 index 0000000..bd7b6e0 --- /dev/null +++ b/alarm/src/main/java/com/yingji/mapper/EventClassMapper.java @@ -0,0 +1,15 @@ +package com.yingji.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.yingji.entity.EventClass; + +/** + * (AcceptClass)表数据库访问层 + * + * @author wu + * @since 2024-06-14 14:32:49 + */ +public interface EventClassMapper extends BaseMapper { + +} + diff --git a/alarm/src/main/java/com/yingji/mapper/EventMapper.java b/alarm/src/main/java/com/yingji/mapper/EventMapper.java new file mode 100644 index 0000000..975d953 --- /dev/null +++ b/alarm/src/main/java/com/yingji/mapper/EventMapper.java @@ -0,0 +1,15 @@ +package com.yingji.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.yingji.entity.Event; + +/** + * 事故(Event)表数据库访问层 + * + * @author wu + * @since 2024-05-10 17:10:32 + */ +public interface EventMapper extends BaseMapper { + +} + diff --git a/alarm/src/main/java/com/yingji/mapper/FireMapper.java b/alarm/src/main/java/com/yingji/mapper/FireMapper.java new file mode 100644 index 0000000..8970e59 --- /dev/null +++ b/alarm/src/main/java/com/yingji/mapper/FireMapper.java @@ -0,0 +1,32 @@ +package com.yingji.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.yingji.entity.Fire; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * 119数据库访问层 + * + * @author wu + * @since 2024-05-06 09:15:01 + */ +public interface FireMapper extends BaseMapper { + + + /** + * 批量插入数据 + * + * @param list 数据 + */ + void saveAll(List list); + + /** + * 获取最新一条数据的时间 + * + * @return 最新一条数据的时间 + */ + LocalDateTime findNewTime(); +} + diff --git a/alarm/src/main/java/com/yingji/mapper/TaskMapper.java b/alarm/src/main/java/com/yingji/mapper/TaskMapper.java new file mode 100644 index 0000000..663f503 --- /dev/null +++ b/alarm/src/main/java/com/yingji/mapper/TaskMapper.java @@ -0,0 +1,15 @@ +package com.yingji.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.yingji.entity.Task; + +/** + * 任务信息(Task)表数据库访问层 + * + * @author wu + * @since 2024-05-10 17:10:33 + */ +public interface TaskMapper extends BaseMapper { + +} + diff --git a/alarm/src/main/java/com/yingji/quartz/AccidentQuartz.java b/alarm/src/main/java/com/yingji/quartz/AccidentQuartz.java new file mode 100644 index 0000000..4a310c4 --- /dev/null +++ b/alarm/src/main/java/com/yingji/quartz/AccidentQuartz.java @@ -0,0 +1,84 @@ +package com.yingji.quartz; + +import cn.hutool.core.util.StrUtil; +import com.yingji.entity.QuartzLog; +import com.yingji.service.AccidentService; +import com.yingji.service.QuartzLogService; +import com.yingji.utils.SmsUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.Async; +import org.springframework.scheduling.annotation.Scheduled; + +import javax.annotation.Resource; +import java.time.Duration; +import java.time.LocalDateTime; + +/** + * 120定时任务保存数据 + * + * @author wu + * @since 2024/5/10 上午10:05 + */ +@Configuration +public class AccidentQuartz { + + public static final Logger log = LoggerFactory.getLogger(AccidentQuartz.class); + + @Resource + private AccidentService accidentService; + + @Resource + private QuartzLogService quartzLogService; + + @Resource + private SmsUtil smsUtil; + + /** + * 每天早上9点判断数据 + */ + @Async + @Scheduled(cron = "0 0 9 * * ? ") + public void sendMes() { + // 获取数据库中最新的创建时间 + LocalDateTime newTime = accidentService.findNewTime(); + // 获取当前时间 + LocalDateTime currentTime = LocalDateTime.now(); + // 计算两者之间的持续时间 + Duration duration = Duration.between(newTime, currentTime); + // 判断时间差是否大于24小时 + if (duration.toHours() > 24) { + // 调用短信接口 + smsUtil.sendSms("120原始接口超过24小时无数据", null, null); + } + } + + @Async + @Scheduled(cron = "0 */1 * * * ? ") + public void savaData() { + QuartzLog quartzLog = new QuartzLog(); + quartzLog.setInterfaceName(3); + quartzLog.setCreateTime(LocalDateTime.now()); + try { + String accessToken = accidentService.getAuthorizeToken(); + if (StrUtil.isNotEmpty(accessToken)) { + accidentService.getAccidentUrl(accessToken); + quartzLog.setStatus(1); + log.info("=================120定时任务结束==============="); + } else { + quartzLog.setStatus(2); + // 调用短信接口 + smsUtil.sendSms("120原始接口获取token失败", null, "120ErrorMes"); + log.info("=================120定时任务获取token失败==============="); + } + } catch (Exception e) { + // 调用短信接口 + smsUtil.sendSms("120原始接口调用失败", null, "120ErrorMes"); + e.printStackTrace(); + quartzLog.setStatus(2); + } finally { + quartzLogService.save(quartzLog); + } + } +} diff --git a/alarm/src/main/java/com/yingji/quartz/FireQuartz.java b/alarm/src/main/java/com/yingji/quartz/FireQuartz.java new file mode 100644 index 0000000..dfcc37b --- /dev/null +++ b/alarm/src/main/java/com/yingji/quartz/FireQuartz.java @@ -0,0 +1,123 @@ +package com.yingji.quartz; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.json.JSONUtil; +import com.yingji.entity.Fire; +import com.yingji.entity.QuartzLog; +import com.yingji.service.FireService; +import com.yingji.service.QuartzLogService; +import com.yingji.utils.SmsUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.Async; +import org.springframework.scheduling.annotation.Scheduled; + +import javax.annotation.Resource; +import java.time.Duration; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 119数据保存定时任务 + * + * @author wu + * @since 2024/05/06 10:18 + */ +@Configuration +public class FireQuartz { + + public static final Logger log = LoggerFactory.getLogger(FireQuartz.class); + + @Resource + private FireService fireService; + + + @Resource + private QuartzLogService quartzLogService; + + @Resource + private SmsUtil smsUtil; + + /** + * 每天早上9点判断数据 + */ + @Async + @Scheduled(cron = "0 0 9 * * ? ") + public void sendMes() { + // 获取数据库中最新的创建时间 + LocalDateTime newTime = fireService.findNewTime(); + // 获取当前时间 + LocalDateTime currentTime = LocalDateTime.now(); + // 计算两者之间的持续时间 + Duration duration = Duration.between(newTime, currentTime); + // 判断时间差是否大于12小时 + if (duration.toHours() > 12) { + // 调用短信接口 + smsUtil.sendSms("119原始接口超过12小时无数据", null,null); + } + } + + /** + * 保存所有数据 + */ + @Async + @Scheduled(cron = "0 */5 * * * ? ") + public void savaData() { + log.info("119接口开始" + LocalDateTime.now()); + QuartzLog quartzLog = new QuartzLog(); + quartzLog.setInterfaceName(2); + quartzLog.setCreateTime(LocalDateTime.now()); + try { + // 获取token + String token = fireService.getToken(); + if (StrUtil.isNotEmpty(token)) { + // 根据id查询数据保存 + List list = fireService.findDataList(token); + // 110算法接口 + if (CollectionUtil.isNotEmpty(list)) { + fireService.saveAll(list); + try { + for (Fire fire : list) { + link119Algorithm(fire.getId()); + } + } catch (Exception e) { + // 调用短信接口 + smsUtil.sendSms("119算法事件接口异常", null,"119sfError"); + } + } + quartzLog.setStatus(1); + log.info("119接口结束" + LocalDateTime.now()); + } else { + quartzLog.setStatus(2); + // 调用短信接口 + smsUtil.sendSms("119原始接口获取token失败", null,null); + log.error("============119算法接口获取token失败119接口结束============="); + } + } catch (Exception e) { + quartzLog.setStatus(2); + // 调用短信接口 +// smsUtil.sendSms("119原始接口调用失败", null,"119ErrorMes"); + smsUtil.sendSms("119原始接口调用失败", null,null); + } finally { + quartzLogService.save(quartzLog); + } + } + + /** + * 120算法接口 + */ + public void link119Algorithm(String id) { + log.info("============119和110对比算法接口开始" + LocalDateTime.now() + "============="); + Map map = new HashMap<>(); + map.put("id", id); + String body = JSONUtil.toJsonStr(map); + String response = HttpRequest.post("http://localhost:9002/link119_algorithm").body(body).execute().body(); + log.info("++++++119和110对比算法响应数据++++++" + response); + log.info("============119和110对比算法接口结束" + LocalDateTime.now() + "============="); + } +} diff --git a/alarm/src/main/java/com/yingji/service/AcceptService.java b/alarm/src/main/java/com/yingji/service/AcceptService.java new file mode 100644 index 0000000..8527c4c --- /dev/null +++ b/alarm/src/main/java/com/yingji/service/AcceptService.java @@ -0,0 +1,15 @@ +package com.yingji.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.yingji.entity.AcceptEvents; + +/** + * 受理调度信息(Accept)表服务接口 + * + * @author wu + * @since 2024-05-10 17:10:32 + */ +public interface AcceptService extends IService { + +} + diff --git a/alarm/src/main/java/com/yingji/service/AccidentService.java b/alarm/src/main/java/com/yingji/service/AccidentService.java new file mode 100644 index 0000000..87f515d --- /dev/null +++ b/alarm/src/main/java/com/yingji/service/AccidentService.java @@ -0,0 +1,37 @@ +package com.yingji.service; + +import java.time.LocalDateTime; + +/** + * 120获取数据 + * + * @author wu + * @since 2024/5/10 上午10:38 + */ +public interface AccidentService { + + /** + * 获取token校验 + */ + String getAuthorizeValidate(); + + /** + * 获取token + */ + String getAuthorizeToken(); + + /** + * 保存数据 + * + * @param accessToken token + */ + void getAccidentUrl(String accessToken); + + + /** + * 获取数据库最新创建时间 + * + * @return 数据库最新创建时间 + */ + LocalDateTime findNewTime(); +} diff --git a/alarm/src/main/java/com/yingji/service/AmbService.java b/alarm/src/main/java/com/yingji/service/AmbService.java new file mode 100644 index 0000000..f3b42d0 --- /dev/null +++ b/alarm/src/main/java/com/yingji/service/AmbService.java @@ -0,0 +1,15 @@ +package com.yingji.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.yingji.entity.Amb; + +/** + * 任务车辆(Amb)表服务接口 + * + * @author wu + * @since 2024-05-10 17:10:32 + */ +public interface AmbService extends IService { + +} + diff --git a/alarm/src/main/java/com/yingji/service/EventClassService.java b/alarm/src/main/java/com/yingji/service/EventClassService.java new file mode 100644 index 0000000..ec3ccee --- /dev/null +++ b/alarm/src/main/java/com/yingji/service/EventClassService.java @@ -0,0 +1,23 @@ +package com.yingji.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.yingji.entity.EventClass; + +/** + * (AcceptClass)表服务接口 + * + * @author wu + * @since 2024-06-14 14:32:49 + */ +public interface EventClassService extends IService { + + /** + * 根据事件类型编码查询事件类型 + * + * @param accidentType 编码 + * @return 事件类型 + */ + + EventClass findByAccidentType(String accidentType); +} + diff --git a/alarm/src/main/java/com/yingji/service/EventService.java b/alarm/src/main/java/com/yingji/service/EventService.java new file mode 100644 index 0000000..4822538 --- /dev/null +++ b/alarm/src/main/java/com/yingji/service/EventService.java @@ -0,0 +1,44 @@ +package com.yingji.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.yingji.entity.Event; +import com.yingji.entity.dto.response.EventPageRequest; +import com.yingji.entity.dto.response.EventsFindResponse; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 事故(Event)表服务接口 + * + * @author wu + * @since 2024-05-10 17:10:33 + */ +public interface EventService extends IService { + + /** + * 分页条件查询数据 + * + * @param page 分页条件 + * @param event 查询条件 + * @return 数据 + */ + Page page(Page page, EventPageRequest event); + + /** + * 根据id查询数据 + * + * @param id id + * @return 数据 + */ + EventsFindResponse findById(Serializable id); + + /** + * 获取数据库最新创建时间 + * + * @return 数据库最新创建时间 + */ + LocalDateTime findNewTime(); +} + diff --git a/alarm/src/main/java/com/yingji/service/FireService.java b/alarm/src/main/java/com/yingji/service/FireService.java new file mode 100644 index 0000000..49ba189 --- /dev/null +++ b/alarm/src/main/java/com/yingji/service/FireService.java @@ -0,0 +1,48 @@ +package com.yingji.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.yingji.entity.Fire; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * 119表服务接口 + * + * @author wu + * @since 2024-05-06 09:15:01 + */ +public interface FireService extends IService { + + + /** + * 查询数据 + * + * @param token token + * @return 数据List + */ + List findDataList(String token); + + /** + * 获取110token + * + * @return token + */ + String getToken(); + + + /** + * 批量插入数据 + * + * @param list 数据 + */ + void saveAll(List list); + + /** + * 获取最新一条数据的时间 + * + * @return 最新一条数据的时间 + */ + LocalDateTime findNewTime(); +} + diff --git a/alarm/src/main/java/com/yingji/service/TaskService.java b/alarm/src/main/java/com/yingji/service/TaskService.java new file mode 100644 index 0000000..f5b7ac8 --- /dev/null +++ b/alarm/src/main/java/com/yingji/service/TaskService.java @@ -0,0 +1,15 @@ +package com.yingji.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.yingji.entity.Task; + +/** + * 任务信息(Task)表服务接口 + * + * @author wu + * @since 2024-05-10 17:10:33 + */ +public interface TaskService extends IService { + +} + diff --git a/alarm/src/main/java/com/yingji/service/impl/AcceptServiceImpl.java b/alarm/src/main/java/com/yingji/service/impl/AcceptServiceImpl.java new file mode 100644 index 0000000..7f587d9 --- /dev/null +++ b/alarm/src/main/java/com/yingji/service/impl/AcceptServiceImpl.java @@ -0,0 +1,19 @@ +package com.yingji.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yingji.entity.AcceptEvents; +import com.yingji.mapper.AcceptMapper; +import com.yingji.service.AcceptService; +import org.springframework.stereotype.Service; + +/** + * 受理调度信息(Accept)表服务实现类 + * + * @author wu + * @since 2024-05-10 17:10:32 + */ +@Service("acceptService") +public class AcceptServiceImpl extends ServiceImpl implements AcceptService { + +} + diff --git a/alarm/src/main/java/com/yingji/service/impl/AccidentServiceImpl.java b/alarm/src/main/java/com/yingji/service/impl/AccidentServiceImpl.java new file mode 100644 index 0000000..ae7f346 --- /dev/null +++ b/alarm/src/main/java/com/yingji/service/impl/AccidentServiceImpl.java @@ -0,0 +1,282 @@ +package com.yingji.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpException; +import cn.hutool.http.HttpRequest; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.yingji.entity.AcceptEvents; +import com.yingji.entity.Amb; +import com.yingji.entity.Event; +import com.yingji.entity.EventClass; +import com.yingji.entity.Task; +import com.yingji.entity.dto.response.EventsResponse; +import com.yingji.entity.dto.response.TaskInfos; +import com.yingji.redis.RedisCache; +import com.yingji.service.AcceptService; +import com.yingji.service.AccidentService; +import com.yingji.service.AmbService; +import com.yingji.service.EventClassService; +import com.yingji.service.EventService; +import com.yingji.service.TaskService; +import com.yingji.utils.SmsUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * @author wu + * @since 2024/5/10 上午10:39 + */ +@Service("accidentService") +public class AccidentServiceImpl implements AccidentService { + + public static final Logger log = LoggerFactory.getLogger(AccidentServiceImpl.class); + + @Value("${getAuthorizeValidateUrl}") + private String getAuthorizeValidateUrl; + + @Value("${getAuthorizeTokenUrl}") + private String getAuthorizeTokenUrl; + + @Value("${getAccidentUrl}") + private String getAccidentUrl; + + @Resource + private RedisCache redisCache; + + @Resource + private EventService eventService; + + @Resource + private TaskService taskService; + + @Resource + private AmbService ambService; + + @Resource + private AcceptService acceptService; + + @Resource + private EventClassService eventClassService; + + @Resource + private SmsUtil smsUtil; +// public static void main(String[] args) { +// +// JSONObject json = JSONObject.parse(s); +// Object data = json.get("data"); +// String recordsStr = JSONUtil.toJsonStr(data); +// List list = JSONUtil.toList(recordsStr, EventsResponse.class); +// System.out.println(list); +// } + + /** + * 获取token校验 + */ + @Override + public String getAuthorizeValidate() { + String validate = redisCache.getCacheObject("validate"); + if (StrUtil.isEmpty(validate)) { + // 获取当前的时间 + LocalDateTime localDateTime = LocalDateTime.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); + String accessDateTime = localDateTime.format(formatter); + Map map = new HashMap<>(); + map.put("AKey", "admin"); + map.put("ASecret", "anchor120."); + map.put("AccessDateTime", accessDateTime); + String parse = JSONUtil.toJsonStr(map); + String body = HttpRequest.post(getAuthorizeValidateUrl).body(parse).execute().body(); + JSONObject json = JSONObject.parse(body); + validate = (String) json.get("data"); + if (StrUtil.isNotEmpty(validate)) { + redisCache.setCacheObject("validate", validate, 40, TimeUnit.MINUTES); + } + } + log.info("======================================="); + log.info("120token校验为:" + validate); + return validate; + } + + /** + * 获取token + */ + @Override + public String getAuthorizeToken() { + String accessToken; + accessToken = redisCache.getCacheObject("accessToken"); + if (StrUtil.isEmpty(accessToken)) { + // 获取授权码 + String validate = getAuthorizeValidate(); + Map map = new HashMap<>(); + map.put("Data", validate); + String parse = JSONUtil.toJsonStr(map); + String body = HttpRequest.post(getAuthorizeTokenUrl).body(parse).execute().body(); + JSONObject json = JSONObject.parse(body); + Object data = json.get("data"); + if (BeanUtil.isNotEmpty(data)) { + String recordsStr = JSONUtil.toJsonStr(data); + JSONObject res = JSONObject.parse(recordsStr); + accessToken = (String) res.get("token"); + if (StrUtil.isNotEmpty(accessToken)) { + redisCache.setCacheObject("accessToken", accessToken, 40, TimeUnit.MINUTES); + } + } + log.info("======================================="); + log.info("120token为:" + accessToken); + } + return accessToken; + } + + /** + * 保存数据 + * + * @param accessToken token + */ + @Override + public void getAccidentUrl(String accessToken) { + // 获取今天的日期 + LocalDate today = LocalDate.now(); + // 获取明天的日期 + LocalDate tomorrow = today.plusDays(1); + // 定义日期格式化对象 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + // 格式化日期为字符串 + String todayStr = today.format(formatter) + " 00:00:00"; + String tomorrowStr = tomorrow.format(formatter) + " 00:00:00"; + Map map = new HashMap<>(); + map.put("StartDateTime", todayStr); + map.put("EndDateTime", tomorrowStr); + String parse = JSONUtil.toJsonStr(map); + String body = HttpRequest.post(getAccidentUrl).header("Authorization", "Bearer " + accessToken).body(parse).execute().body(); + log.error("120接收到的数据为=======================" + body); + if (body.contains("Time-out")) { + return ; + } + JSONObject json = JSONObject.parse(body); + Object data = json.get("data"); + if (BeanUtil.isNotEmpty(data)) { + saveResponseData(data); + } else { + redisCache.deleteObject("validate"); + redisCache.deleteObject("accessToken"); + } + } + + /** + * 保存响应数据 + * + * @param data 响应数据 + */ + private void saveResponseData(Object data) { + List list; + String recordsStr = JSONUtil.toJsonStr(data); + if (StrUtil.isNotEmpty(recordsStr)) { + // json数据转换成实体类 + list = JSONUtil.toList(recordsStr, EventsResponse.class); + if (CollectionUtil.isNotEmpty(list)) { + // 获取事故数据保存 + List events = BeanUtil.copyToList(list, Event.class); + for (Event event : events) { + // 新增或编辑事故(Event) 表 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("event_id", event.getEventId()); + Event one = eventService.getOne(wrapper); + if (BeanUtil.isEmpty(one)) { + event.setCreateTime(LocalDateTime.now()); + event.setUpdateTime(LocalDateTime.now()); + if (StrUtil.isNotEmpty(event.getAccidentType())) { + EventClass eventClass = eventClassService.findByAccidentType(event.getAccidentType()); + if (BeanUtil.isNotEmpty(eventClass)) { + event.setAiClass(eventClass.getAiClass()); + } + } + eventService.save(event); + // 调用120和110事件对比接口 + linkAlgorithm(event.getEventId()); + log.info("======调用120和110事件对比接口======"); + } else { + event.setUpdateTime(LocalDateTime.now()); + eventService.updateById(event); + } + } + for (EventsResponse res : list) { + List acceptEvents = res.getAcceptEvents(); + // 保存或编辑受理调度信息 + for (AcceptEvents acceptEvent : acceptEvents) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("accept_id", acceptEvent.getAcceptId()); + AcceptEvents one = acceptService.getOne(wrapper); + if (BeanUtil.isEmpty(one)) { + acceptService.save(acceptEvent); + } else { + acceptService.updateById(acceptEvent); + } + } + List taskInfos = res.getTaskInfos(); + for (TaskInfos taskInfo : taskInfos) { + // 保存或编辑任务信息(Task) 表实体类 + Task task = taskInfo.getTask(); + if (BeanUtil.isNotEmpty(task)) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("task_id", task.getTaskId()); + Task one = taskService.getOne(wrapper); + if (BeanUtil.isEmpty(one)) { + taskService.save(task); + Amb amb = taskInfo.getAmb(); + if (BeanUtil.isNotEmpty(amb)) { + amb.setTaskId(task.getTaskId()); + ambService.save(amb); + } + } else { + taskService.updateById(task); + } + } + } + } + } + } + } + + /** + * 120算法接口 + */ + public void linkAlgorithm(String eventId) { + try { + log.info("============120和110对比算法接口开始" + LocalDateTime.now() + "============="); + Map map = new HashMap<>(); + map.put("event_id", eventId); + String body = JSONUtil.toJsonStr(map); + String response = HttpRequest.post("http://localhost:9002/link_algorithm").body(body).execute().body(); + log.info("++++++120和110对比算法响应数据++++++" + response); + log.info("============120和110对比算法接口结束" + LocalDateTime.now() + "============="); + } catch (HttpException e) { + // 调用短信接口 + smsUtil.sendSms("120算法事件接口异常", null, "120sfError"); + } + } + + /** + * 获取数据库最新创建时间 + * + * @return 数据库最新创建时间 + */ + @Override + public LocalDateTime findNewTime() { + return eventService.findNewTime(); + } +} \ No newline at end of file diff --git a/alarm/src/main/java/com/yingji/service/impl/AlarmServiceImpl.java b/alarm/src/main/java/com/yingji/service/impl/AlarmServiceImpl.java index b5fe5d0..1519407 100644 --- a/alarm/src/main/java/com/yingji/service/impl/AlarmServiceImpl.java +++ b/alarm/src/main/java/com/yingji/service/impl/AlarmServiceImpl.java @@ -32,16 +32,16 @@ import java.util.List; public class AlarmServiceImpl extends ServiceImpl implements AlarmService { public static final Logger log = LoggerFactory.getLogger(AlarmServiceImpl.class); - @Value("${clientId}") + @Value("${110clientId}") private String clientId; - @Value("${clientSecret}") + @Value("${110clientSecret}") private String clientSecret; - @Value("${getToken}") + @Value("${110getToken}") private String getToken; - @Value("${specificWarn}") + @Value("${110specificWarn}") private String specificWarn; /** diff --git a/alarm/src/main/java/com/yingji/service/impl/AmbServiceImpl.java b/alarm/src/main/java/com/yingji/service/impl/AmbServiceImpl.java new file mode 100644 index 0000000..b66043a --- /dev/null +++ b/alarm/src/main/java/com/yingji/service/impl/AmbServiceImpl.java @@ -0,0 +1,19 @@ +package com.yingji.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yingji.entity.Amb; +import com.yingji.mapper.AmbMapper; +import com.yingji.service.AmbService; +import org.springframework.stereotype.Service; + +/** + * 任务车辆(Amb)表服务实现类 + * + * @author wu + * @since 2024-05-10 17:10:32 + */ +@Service("ambService") +public class AmbServiceImpl extends ServiceImpl implements AmbService { + +} + diff --git a/alarm/src/main/java/com/yingji/service/impl/EventClassServiceImpl.java b/alarm/src/main/java/com/yingji/service/impl/EventClassServiceImpl.java new file mode 100644 index 0000000..82bbf3a --- /dev/null +++ b/alarm/src/main/java/com/yingji/service/impl/EventClassServiceImpl.java @@ -0,0 +1,32 @@ +package com.yingji.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yingji.entity.EventClass; +import com.yingji.mapper.EventClassMapper; +import com.yingji.service.EventClassService; +import org.springframework.stereotype.Service; + +/** + * (AcceptClass)表服务实现类 + * + * @author wu + * @since 2024-06-14 14:32:49 + */ +@Service("acceptClassService") +public class EventClassServiceImpl extends ServiceImpl implements EventClassService { + + /** + * 根据事件类型编码查询事件类型 + * + * @param accidentType 编码 + * @return 事件类型 + */ + @Override + public EventClass findByAccidentType(String accidentType) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("accept_type", accidentType); + return baseMapper.selectOne(wrapper); + } +} + diff --git a/alarm/src/main/java/com/yingji/service/impl/EventServiceImpl.java b/alarm/src/main/java/com/yingji/service/impl/EventServiceImpl.java new file mode 100644 index 0000000..5ef867d --- /dev/null +++ b/alarm/src/main/java/com/yingji/service/impl/EventServiceImpl.java @@ -0,0 +1,122 @@ +package com.yingji.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yingji.entity.AcceptEvents; +import com.yingji.entity.Amb; +import com.yingji.entity.Event; +import com.yingji.entity.Task; +import com.yingji.entity.dto.response.EventPageRequest; +import com.yingji.entity.dto.response.EventsFindResponse; +import com.yingji.exception.ServiceException; +import com.yingji.mapper.EventMapper; +import com.yingji.service.AcceptService; +import com.yingji.service.AmbService; +import com.yingji.service.EventService; +import com.yingji.service.TaskService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 事故(Event)表服务实现类 + * + * @author wu + * @since 2024-05-10 17:10:33 + */ +@Service("eventService") +public class EventServiceImpl extends ServiceImpl implements EventService { + + @Resource + private TaskService taskService; + + @Resource + private AmbService ambService; + + @Resource + private AcceptService acceptService; + + /** + * 分页条件查询数据 + * + * @param page 分页条件 + * @param event 查询条件 + * @return 数据 + */ + @Override + public Page page(Page page, EventPageRequest event) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.like(StrUtil.isNotEmpty(event.getEventName()), "event_name", event.getEventName()) + .eq(StrUtil.isNotEmpty(event.getEventType()), "event_type", event.getEventType()) + .eq(StrUtil.isNotEmpty(event.getEventLevel()), "event_level", event.getEventLevel()) + .ge(event.getStartTime() != null, "event_date_time", event.getStartTime()) + .le(event.getEndTime() != null, "event_date_time", event.getEndTime()) + .like(StrUtil.isNotEmpty(event.getEventArea()), "event_area", event.getEventArea()) + .like(StrUtil.isNotEmpty(event.getEventAddress()), "event_address", event.getEventAddress()) + .eq(event.getSendAmbCount() != null, "send_amb_count", event.getSendAmbCount()) + .like(StrUtil.isNotEmpty(event.getEventDescribe()), "event_describe", event.getEventDescribe()) + .like(StrUtil.isNotEmpty(event.getAlarmUnit()), "alarm_unit", event.getAlarmUnit()) + .like(StrUtil.isNotEmpty(event.getAlarmUnitContactor()), "alarm_unit_contactor", event.getAlarmUnitContactor()) + .like(StrUtil.isNotEmpty(event.getAlarmUnitTelephone()), "alarm_unit_telephone", event.getAlarmUnitTelephone()); + return this.page(page, wrapper); + } + + /** + * 根据id查询数据 + * + * @param id id + * @return 数据 + */ + @Override + public EventsFindResponse findById(Serializable id) { + Event event = this.getById(id); + if (BeanUtil.isEmpty(event)) { + throw new ServiceException("所选数据不存在"); + } + EventsFindResponse res = BeanUtil.copyProperties(event, EventsFindResponse.class); + // 查询任务信息 + QueryWrapper taskWrapper = new QueryWrapper<>(); + taskWrapper.eq("event_id", res.getEventId()); + List taskList = taskService.list(taskWrapper); + // 受理调度信息 + QueryWrapper acceptWrapper = new QueryWrapper<>(); + acceptWrapper.eq("event_id", res.getEventId()); + List acceptList = acceptService.list(acceptWrapper); + // 任务车辆 + List taskIdList = taskList.stream().map(Task::getTaskId).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(taskIdList)) { + QueryWrapper ambWrapper = new QueryWrapper<>(); + ambWrapper.in("task_id", taskIdList); + List ambList = ambService.list(ambWrapper); + res.setAmbs(ambList); + } + res.setAcceptEvents(acceptList); + res.setTasks(taskList); + return res; + } + + /** + * 获取数据库最新创建时间 + * + * @return 数据库最新创建时间 + */ + @Override + public LocalDateTime findNewTime() { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.orderByDesc("create_time") + .last("LIMIT 1"); + Event event = this.getOne(wrapper); + return event.getCreateTime(); + } + + +} + diff --git a/alarm/src/main/java/com/yingji/service/impl/FireServiceImpl.java b/alarm/src/main/java/com/yingji/service/impl/FireServiceImpl.java new file mode 100644 index 0000000..abd6511 --- /dev/null +++ b/alarm/src/main/java/com/yingji/service/impl/FireServiceImpl.java @@ -0,0 +1,152 @@ +package com.yingji.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.codec.Base64; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpException; +import cn.hutool.http.HttpRequest; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yingji.entity.Fire; +import com.yingji.mapper.FireMapper; +import com.yingji.service.FireService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + + +/** + * 119服务实现类 + * + * @author wu + * @since 2024-05-06 09:15:01 + */ +@Service("fireService") +public class FireServiceImpl extends ServiceImpl implements FireService { + + public static final Logger log = LoggerFactory.getLogger(FireServiceImpl.class); + @Value("${119clientId}") + private String clientId; + + @Value("${119clientSecret}") + private String clientSecret; + + @Value("${119getToken}") + private String getToken; + + @Value("${119specificWarn}") + private String specificWarn; + + /** + * base64加密密钥 + * + * @return base64加密后的密钥 + */ + public String findBase() { + String str = clientId + ":" + clientSecret; + return Base64.encode(str); + } + + + /** + * 查询数据 + * + * @param token token + * @return 数据List + */ + @Override + public List findDataList(String token) { + List records = null; + // 获取id + String body = HttpRequest.post(specificWarn) + .header("Authorization", "Basic " + token) + .header("Content-Type", "application/json") + .execute().body(); + log.info("==============================="); + log.info("119body数据为:" + body); + if (body.contains("Time-out")) { + return null; + } + try { + JSONObject json = JSONObject.parse(body); + Object response = json.get("response"); + if (BeanUtil.isNotEmpty(response)) { + String recordsStr = JSONUtil.toJsonStr(response); + if (StrUtil.isEmpty(recordsStr)) { + return null; + } + records = JSONUtil.toList(recordsStr, Fire.class); + if (records == null) { + return null; + } + return records.stream() + .filter(district -> "苏州市".equals(district.getXzqhmc())) + .peek(district -> district.setCreateTime(LocalDateTime.now())) // 使用peek设置时间戳 + .collect(Collectors.toList()); + } + } catch (Exception e) { + log.info("json解析错误"); + } + return records; + } + + /** + * 获取119token + * + * @return token + */ + @Override + public String getToken() { + String accessToken = null; + String body = null; + try { + body = HttpRequest.get(getToken) + .header("Authorization", "Basic QkZTaFQzL1d3UGhaSlFkTDhlNEZkblExMWgwUU9lS3FCZG4reGVzQ1NKR2xESEtQazVmeG5tbkxrMW9ua20zWXpkZmpFMGdMR0VaN0g3dmZMczIxc0dNPTpHdGJnUmZOSW1Yam1CcVcwbnB4VWlHaS9zMG1iNVpkdlhBTnFVQ2dtSW00PQ==") + .header("Content-Type", "application/json") + .form("grant_type", "client_credentials").execute().body(); + } catch (HttpException e) { + log.error("获取token接口响应超时"); + } + JSONObject json = JSONObject.parse(body); + if (json == null) { + return accessToken; + } + Object response = json.get("response"); + if (BeanUtil.isNotEmpty(response)) { + String recordsStr = JSONUtil.toJsonStr(response); + JSONObject res = JSONObject.parse(recordsStr); + accessToken = (String) res.get("access_token"); + } + log.info("======================================="); + log.info("119token为:" + accessToken); + return accessToken; + } + + + /** + * 批量插入数据 + * + * @param list 数据 + */ + @Override + public void saveAll(List list) { + baseMapper.saveAll(list); + } + + /** + * 获取最新一条数据的时间 + * + * @return 最新一条数据的时间 + */ + @Override + public LocalDateTime findNewTime() { + return baseMapper.findNewTime(); + } +} + diff --git a/alarm/src/main/java/com/yingji/service/impl/TaskServiceImpl.java b/alarm/src/main/java/com/yingji/service/impl/TaskServiceImpl.java new file mode 100644 index 0000000..7836bfa --- /dev/null +++ b/alarm/src/main/java/com/yingji/service/impl/TaskServiceImpl.java @@ -0,0 +1,19 @@ +package com.yingji.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yingji.entity.Task; +import com.yingji.mapper.TaskMapper; +import com.yingji.service.TaskService; +import org.springframework.stereotype.Service; + +/** + * 任务信息(Task)表服务实现类 + * + * @author wu + * @since 2024-05-10 17:10:33 + */ +@Service("taskService") +public class TaskServiceImpl extends ServiceImpl implements TaskService { + +} + diff --git a/alarm/src/main/resources/application-dev.yml b/alarm/src/main/resources/application-dev.yml index aaa5063..c3cc66b 100644 --- a/alarm/src/main/resources/application-dev.yml +++ b/alarm/src/main/resources/application-dev.yml @@ -34,14 +34,35 @@ knife4j: # group-name: 应急算法 # 110获取token -getToken: http://2.46.4.198:8008/token +110getToken: http://2.46.4.198:8008/token # 110获取数据 -specificWarn: http://2.46.4.198:8008/rs/k4r3h/ApiShareService/sz/share/specificWarn +110specificWarn: http://2.46.4.198:8008/rs/k4r3h/ApiShareService/sz/share/specificWarn # 110clientId -clientId: BNjP9S8p2EJZyt1UF+D6kCsK6ZVapyKqiGzarEdsZ3QmIWoVdB7YkrX2GBAmCDO16tQ/ak86pZgP5ZS3s4EGdco= +110clientId: BNjP9S8p2EJZyt1UF+D6kCsK6ZVapyKqiGzarEdsZ3QmIWoVdB7YkrX2GBAmCDO16tQ/ak86pZgP5ZS3s4EGdco= # 110clientSecret -clientSecret: AM4oMOsJj0ULAUOOXlz5xHjIF4kp9W63ajZrXxTGLHEn +110clientSecret: AM4oMOsJj0ULAUOOXlz5xHjIF4kp9W63ajZrXxTGLHEn + +# 120获取token授权码 +getAuthorizeValidateUrl: http://192.180.22.214:7015/api/Authorize/validate/v1 + +# 120获取token +getAuthorizeTokenUrl: http://192.180.22.214:7015/api/Authorize/token/get/v1 + +# 120获取数据 +getAccidentUrl: http://192.180.22.214:7015/api/Event/accident/list/get/v2 + +# 119获取token +119getToken: http://2.46.4.198:8008/token + +# 119获取数据 +119specificWarn: http://2.46.4.198:8008/rs/8uu6d/DataAnalysisService/st/data/fire_alarm + +# 119clientId +119clientId: BFShT3/WwPhZJQdL8e4FdnQ11h0QOeKqBdn+xesCSJGlDHKPk5fxnmnLk1onkm3YzdfjE0gLGEZ7H7vfLs21sGM= + +# 119clientSecret +119clientSecret: GtbgRfNImXjmBqW0npxUiGi/s0mb5ZdvXANqUCgmIm4= diff --git a/alarm/src/main/resources/mapper/yingji/FireMapper.xml b/alarm/src/main/resources/mapper/yingji/FireMapper.xml new file mode 100644 index 0000000..141629f --- /dev/null +++ b/alarm/src/main/resources/mapper/yingji/FireMapper.xml @@ -0,0 +1,28 @@ + + + + + + + INSERT IGNORE INTO `fire`( + id, xzqh, ajbh, ajms, gdsj, jjyxm, sjc, wd, jd, bcxx, jssj, afdz, cdsj, lafsdm, topic, xdsj, lasj, xzqhmc, + ddxcsj, create_time + ) VALUES + + (#{item.id}, #{item.xzqh}, #{item.ajbh}, #{item.ajms}, #{item.gdsj}, #{item.jjyxm}, #{item.sjc}, #{item.wd}, + #{item.jd}, #{item.bcxx}, #{item.jssj}, #{item.afdz}, + #{item.cdsj}, #{item.lafsdm}, #{item.topic}, #{item.xdsj}, #{item.lasj}, #{item.xzqhmc}, #{item.ddxcsj}, + #{item.createTime}) + + + + + + \ No newline at end of file diff --git a/page/src/main/java/com/yingji/controller/EventController.java b/page/src/main/java/com/yingji/controller/EventController.java index aa561e9..edc3dc8 100644 --- a/page/src/main/java/com/yingji/controller/EventController.java +++ b/page/src/main/java/com/yingji/controller/EventController.java @@ -2,6 +2,7 @@ package com.yingji.controller; import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.yingji.base.controller.BaseController; import com.yingji.base.domain.AjaxResult; @@ -11,6 +12,7 @@ import com.yingji.entity.dto.response.EventsFindResponse; import com.yingji.service.EventService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -36,6 +38,7 @@ import java.util.List; @RequestMapping("algorithms/event") @Api(tags = "事故") @Transactional(rollbackFor = Exception.class) +@Slf4j public class EventController extends BaseController { /** @@ -54,10 +57,16 @@ public class EventController extends BaseController { @GetMapping @ApiOperation(value = "分页条件查询事故", response = Event.class) public AjaxResult page(Page page, EventPageRequest event) { + log.error("==================120入参开始====================="); + log.error("==================120每页显示条数: " + page.getSize() + "页数: " + page.getCurrent() + "====================="); + log.error(JSONUtil.toJsonStr(event)); + log.error("==================120入参结束====================="); StpUtil.checkLogin(); if (page.getSize() > 1000) { page.setSize(1000); } + log.error("==================120响应开始====================="); + log.error("==================120响应结束====================="); return success(eventService.page(page, event)); } diff --git a/page/src/main/java/com/yingji/service/impl/EventServiceImpl.java b/page/src/main/java/com/yingji/service/impl/EventServiceImpl.java index 0cc327c..113c098 100644 --- a/page/src/main/java/com/yingji/service/impl/EventServiceImpl.java +++ b/page/src/main/java/com/yingji/service/impl/EventServiceImpl.java @@ -3,6 +3,7 @@ package com.yingji.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -18,6 +19,7 @@ import com.yingji.service.AcceptService; import com.yingji.service.AmbService; import com.yingji.service.EventService; import com.yingji.service.TaskService; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -32,6 +34,7 @@ import java.util.stream.Collectors; * @since 2024-05-10 17:10:33 */ @Service("eventService") +@Slf4j public class EventServiceImpl extends ServiceImpl implements EventService { @Resource @@ -52,6 +55,10 @@ public class EventServiceImpl extends ServiceImpl implements */ @Override public Page page(Page page, EventPageRequest event) { + log.error("==================119入参开始====================="); + log.error("==================119每页显示条数: " + page.getSize() + "页数: " + page.getCurrent() + "====================="); + log.error(JSONUtil.toJsonStr(event)); + log.error("==================119入参结束====================="); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.ne("event_type", "转院") .like(StrUtil.isNotEmpty(event.getEventName()), "event_name", event.getEventName()) @@ -66,6 +73,8 @@ public class EventServiceImpl extends ServiceImpl implements .like(StrUtil.isNotEmpty(event.getAlarmUnit()), "alarm_unit", event.getAlarmUnit()) .like(StrUtil.isNotEmpty(event.getAlarmUnitContactor()), "alarm_unit_contactor", event.getAlarmUnitContactor()) .like(StrUtil.isNotEmpty(event.getAlarmUnitTelephone()), "alarm_unit_telephone", event.getAlarmUnitTelephone()); + log.error("==================119响应开始====================="); + log.error("==================119响应结束====================="); return this.page(page, wrapper); }