parent
eaff3d4b1b
commit
d0ab570ccf
@ -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;
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
@ -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<AcceptEvents> {
|
||||
|
||||
}
|
||||
|
@ -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<Amb> {
|
||||
|
||||
}
|
||||
|
@ -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<EventClass> {
|
||||
|
||||
}
|
||||
|
@ -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<Event> {
|
||||
|
||||
}
|
||||
|
@ -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<Fire> {
|
||||
|
||||
|
||||
/**
|
||||
* 批量插入数据
|
||||
*
|
||||
* @param list 数据
|
||||
*/
|
||||
void saveAll(List<Fire> list);
|
||||
|
||||
/**
|
||||
* 获取最新一条数据的时间
|
||||
*
|
||||
* @return 最新一条数据的时间
|
||||
*/
|
||||
LocalDateTime findNewTime();
|
||||
}
|
||||
|
@ -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<Task> {
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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<Fire> 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<String, String> 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() + "=============");
|
||||
}
|
||||
}
|
@ -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<AcceptEvents> {
|
||||
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
@ -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<Amb> {
|
||||
|
||||
}
|
||||
|
@ -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<EventClass> {
|
||||
|
||||
/**
|
||||
* 根据事件类型编码查询事件类型
|
||||
*
|
||||
* @param accidentType 编码
|
||||
* @return 事件类型
|
||||
*/
|
||||
|
||||
EventClass findByAccidentType(String accidentType);
|
||||
}
|
||||
|
@ -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<Event> {
|
||||
|
||||
/**
|
||||
* 分页条件查询数据
|
||||
*
|
||||
* @param page 分页条件
|
||||
* @param event 查询条件
|
||||
* @return 数据
|
||||
*/
|
||||
Page<Event> page(Page<Event> page, EventPageRequest event);
|
||||
|
||||
/**
|
||||
* 根据id查询数据
|
||||
*
|
||||
* @param id id
|
||||
* @return 数据
|
||||
*/
|
||||
EventsFindResponse findById(Serializable id);
|
||||
|
||||
/**
|
||||
* 获取数据库最新创建时间
|
||||
*
|
||||
* @return 数据库最新创建时间
|
||||
*/
|
||||
LocalDateTime findNewTime();
|
||||
}
|
||||
|
@ -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<Fire> {
|
||||
|
||||
|
||||
/**
|
||||
* 查询数据
|
||||
*
|
||||
* @param token token
|
||||
* @return 数据List
|
||||
*/
|
||||
List<Fire> findDataList(String token);
|
||||
|
||||
/**
|
||||
* 获取110token
|
||||
*
|
||||
* @return token
|
||||
*/
|
||||
String getToken();
|
||||
|
||||
|
||||
/**
|
||||
* 批量插入数据
|
||||
*
|
||||
* @param list 数据
|
||||
*/
|
||||
void saveAll(List<Fire> list);
|
||||
|
||||
/**
|
||||
* 获取最新一条数据的时间
|
||||
*
|
||||
* @return 最新一条数据的时间
|
||||
*/
|
||||
LocalDateTime findNewTime();
|
||||
}
|
||||
|
@ -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<Task> {
|
||||
|
||||
}
|
||||
|
@ -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<AcceptMapper, AcceptEvents> implements AcceptService {
|
||||
|
||||
}
|
||||
|
@ -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<EventsResponse> 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<String, Object> 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<String, Object> 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<String, Object> 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<EventsResponse> list;
|
||||
String recordsStr = JSONUtil.toJsonStr(data);
|
||||
if (StrUtil.isNotEmpty(recordsStr)) {
|
||||
// json数据转换成实体类
|
||||
list = JSONUtil.toList(recordsStr, EventsResponse.class);
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
// 获取事故数据保存
|
||||
List<Event> events = BeanUtil.copyToList(list, Event.class);
|
||||
for (Event event : events) {
|
||||
// 新增或编辑事故(Event) 表
|
||||
QueryWrapper<Event> 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> acceptEvents = res.getAcceptEvents();
|
||||
// 保存或编辑受理调度信息
|
||||
for (AcceptEvents acceptEvent : acceptEvents) {
|
||||
QueryWrapper<AcceptEvents> 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> taskInfos = res.getTaskInfos();
|
||||
for (TaskInfos taskInfo : taskInfos) {
|
||||
// 保存或编辑任务信息(Task) 表实体类
|
||||
Task task = taskInfo.getTask();
|
||||
if (BeanUtil.isNotEmpty(task)) {
|
||||
QueryWrapper<Task> 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<String, String> 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();
|
||||
}
|
||||
}
|
@ -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<AmbMapper, Amb> implements AmbService {
|
||||
|
||||
}
|
||||
|
@ -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<EventClassMapper, EventClass> implements EventClassService {
|
||||
|
||||
/**
|
||||
* 根据事件类型编码查询事件类型
|
||||
*
|
||||
* @param accidentType 编码
|
||||
* @return 事件类型
|
||||
*/
|
||||
@Override
|
||||
public EventClass findByAccidentType(String accidentType) {
|
||||
QueryWrapper<EventClass> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("accept_type", accidentType);
|
||||
return baseMapper.selectOne(wrapper);
|
||||
}
|
||||
}
|
||||
|
@ -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<EventMapper, Event> implements EventService {
|
||||
|
||||
@Resource
|
||||
private TaskService taskService;
|
||||
|
||||
@Resource
|
||||
private AmbService ambService;
|
||||
|
||||
@Resource
|
||||
private AcceptService acceptService;
|
||||
|
||||
/**
|
||||
* 分页条件查询数据
|
||||
*
|
||||
* @param page 分页条件
|
||||
* @param event 查询条件
|
||||
* @return 数据
|
||||
*/
|
||||
@Override
|
||||
public Page<Event> page(Page<Event> page, EventPageRequest event) {
|
||||
QueryWrapper<Event> 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<Task> taskWrapper = new QueryWrapper<>();
|
||||
taskWrapper.eq("event_id", res.getEventId());
|
||||
List<Task> taskList = taskService.list(taskWrapper);
|
||||
// 受理调度信息
|
||||
QueryWrapper<AcceptEvents> acceptWrapper = new QueryWrapper<>();
|
||||
acceptWrapper.eq("event_id", res.getEventId());
|
||||
List<AcceptEvents> acceptList = acceptService.list(acceptWrapper);
|
||||
// 任务车辆
|
||||
List<String> taskIdList = taskList.stream().map(Task::getTaskId).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(taskIdList)) {
|
||||
QueryWrapper<Amb> ambWrapper = new QueryWrapper<>();
|
||||
ambWrapper.in("task_id", taskIdList);
|
||||
List<Amb> ambList = ambService.list(ambWrapper);
|
||||
res.setAmbs(ambList);
|
||||
}
|
||||
res.setAcceptEvents(acceptList);
|
||||
res.setTasks(taskList);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据库最新创建时间
|
||||
*
|
||||
* @return 数据库最新创建时间
|
||||
*/
|
||||
@Override
|
||||
public LocalDateTime findNewTime() {
|
||||
QueryWrapper<Event> wrapper = new QueryWrapper<>();
|
||||
wrapper.orderByDesc("create_time")
|
||||
.last("LIMIT 1");
|
||||
Event event = this.getOne(wrapper);
|
||||
return event.getCreateTime();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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<FireMapper, Fire> 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<Fire> findDataList(String token) {
|
||||
List<Fire> 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<Fire> list) {
|
||||
baseMapper.saveAll(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最新一条数据的时间
|
||||
*
|
||||
* @return 最新一条数据的时间
|
||||
*/
|
||||
@Override
|
||||
public LocalDateTime findNewTime() {
|
||||
return baseMapper.findNewTime();
|
||||
}
|
||||
}
|
||||
|
@ -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<TaskMapper, Task> implements TaskService {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yingji.mapper.FireMapper">
|
||||
|
||||
|
||||
<insert id="saveAll">
|
||||
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
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
(#{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})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="findNewTime" resultType="java.time.LocalDateTime">
|
||||
select create_time
|
||||
from fire
|
||||
order by create_time desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in new issue