main
吴顺杰 4 months ago
parent 28172d88a0
commit a090092251

@ -3,6 +3,8 @@ package com.yingji;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* @author wu
@ -11,6 +13,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan("com.yingji.mapper")
@EnableAsync
@EnableScheduling
public class YingjiAlgorithmsApplication {
public static void main(String[] args) {
SpringApplication.run(YingjiAlgorithmsApplication.class, args);

@ -7,6 +7,7 @@ import com.yingji.base.controller.BaseController;
import com.yingji.base.domain.AjaxResult;
import com.yingji.entity.Alarm;
import com.yingji.entity.dto.request.AlarmFindRequest;
import com.yingji.service.AccidentService;
import com.yingji.service.AlarmService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -40,6 +41,9 @@ public class AlarmController extends BaseController {
@Resource
private AlarmService alarmService;
@Resource
private AccidentService accidentService;
/**
*
*
@ -123,15 +127,15 @@ public class AlarmController extends BaseController {
/**
*
*
* @param startTime
* @param size
* @param startTime
* @param entTime
* @return
*/
@GetMapping("/synchronous")
@ApiOperation(value = "同步数据")
public AjaxResult synchronous(String startTime, Integer size) {
public AjaxResult synchronous(String startTime, String entTime) {
StpUtil.checkLogin();
alarmService.synchronous(startTime, size);
alarmService.synchronous(startTime, entTime);
return success();
}
@ -141,7 +145,7 @@ public class AlarmController extends BaseController {
// 此处仅作模拟示例,真实项目需要从数据库中查询数据进行比对
if ("9219a5c1612c398c".equals(clientId) && "88aba31a35e3a713".equals(clientSecret)) {
StpUtil.login(10001);
return success((Object)StpUtil.getTokenValue());
return success((Object) StpUtil.getTokenValue());
}
return error("错误的授权码");
}
@ -152,6 +156,13 @@ public class AlarmController extends BaseController {
return "当前会话是否登录:" + StpUtil.isLogin();
}
@ApiOperation(value = "test")
@GetMapping("test")
public AjaxResult test() {
accidentService.text();
return success();
}
// public static void main(String[] args) {
// String encode = Base64.encode("123QWQAVA1314543");
// System.err.println(encode);

@ -1,35 +1,140 @@
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.util.Date;
import java.time.LocalDateTime;
/**
* (Accept)
*
* @author wu
* @since 2024/4/30 4:17
* @since 2024-05-10 17:10:32
*/
@Data
@ApiModel("受理调度信息实体类")
@TableName(value = "accept")
public class AcceptEvents implements Serializable {
private static final long serialVersionUID = 2498572602663676559L;
private String AlarmTelephone;
private String DiseaseJudge;
private String PatientName;
private String PatientSex;
private String PatientAge;
private String AcceptType;
private String ResponsibleRecipient;
private String WaitAddress;
private String SendAddress;
private String RingDateTime;
private Date StartAcceptDateTime;
private Date EndAcceptDateTime;
private Date SendOrderDateTime;
private String EventAddress;
private String AcceptId;
private String EventId;
private String AcceptOrder;
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;
}

@ -33,12 +33,26 @@ public class Alarm implements Serializable {
@ApiModelProperty(value = "主键id")
@TableId(type = IdType.AUTO)
private Long emergencyEventId;
private Integer emergencyEventSource;
private Integer emergencyEventStatus;
private Integer warnResponseStatus;
private Integer emergencyResponseStatus;
private String emergencyEventTitle;
private Integer emergencyEventType;
private Integer emergencyEventLevel;
/**
@ -62,15 +76,35 @@ public class Alarm implements Serializable {
@Alias("sfdd")
@ApiModelProperty(value = "报警地址")
private String emergencyEventAddress;
private String emergencyEventArea;
private Double emergencyEventLon;
private Double emergencyEventLat;
private String submitUnit;
private String submitUnitContact;
private String submitUnitTelephone;
private String reportPerson;
private String reportPersonTelephone;
private String remark;
private String fileUrls;
/**
@ -106,8 +140,14 @@ public class Alarm implements Serializable {
@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;
private String sendOutTimes;
private Long groupId;
private Integer isRehearsal;
/**
@ -122,23 +162,31 @@ public class Alarm implements Serializable {
*/
@ApiModelProperty(value = "源id")
private String sourceId;
private Integer isJudged;
private String eventDetail;
/**
*
*/
@ApiModelProperty(value = "预警大类")
private String aiCategories;
/**
*
*/
@ApiModelProperty(value = "预警小类")
private String aiSubCategories;
/**
*
*/
@ApiModelProperty(value = "紧急程度")
private String aiLevel;
/**
*
*/

@ -1,22 +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/4/30 4:18
* @since 2024-05-10 17:10:32
*/
@Data
@ApiModel("任务车辆实体类")
@TableName(value = "amb")
public class Amb implements Serializable {
private static final long serialVersionUID = -9140135874884043915L;
private String PlateNumber;
private String RealSign;
private String AmbCode;
private String StationName;
private String AmbType;
private String AmbPhone;
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,128 @@
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;
/**
* (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;
}

@ -1,37 +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.util.Date;
import java.time.LocalDateTime;
/**
* (Task)
*
* @author wu
* @since 2024/4/30 4:23
* @since 2024-05-10 17:10:33
*/
@Data
@ApiModel("任务信息实体类")
@TableName(value = "task")
public class Task implements Serializable {
private static final long serialVersionUID = 4118581272605160572L;
private Boolean IsOver;
private String RealSendAddress;
private Date TaskCreatedDateTime;
private Date AcceptOrderDateTime;
private Date OutAmbDateTime;
private Date ArriveSceneDateTime;
private Date LeaveSceneDateTime;
private Date ArriveHospitalDateTime;
private Date ComplatedDateTime;
private Date ReturnStationDateTime;
private Boolean IsNormalOver;
private String AbnormalReason;
private String Driver;
private String Doctor;
private String Stretcher;
private String Nurse;
private String StationName;
private String TaskId;
private String AcceptOrder;
private String AcceptId;
private String EventId;
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;
}

@ -1,7 +1,5 @@
package com.yingji.entity.dto.request;
import cn.hutool.core.annotation.Alias;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -10,7 +8,6 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* Alarm

@ -1,11 +1,14 @@
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.TaskInfos;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.time.LocalDateTime;
import java.util.List;
/**
@ -17,23 +20,128 @@ public class EventsResponse implements Serializable {
private static final long serialVersionUID = -3894493286879970663L;
private List<AcceptEvents> AcceptEvents;
private List<TaskInfos> TaskInfos;
private String EventName;
private String EventType;
private String EventLevel;
private Date EventDateTime;
private String EventDescribe;
private String EventArea;
private String EventAddress;
private Double EventLongitude;
private Double EventLatitude;
private String AlarmUnit;
private String AlarmUnitContactor;
private String AlarmUnitTelephone;
private Integer SendAmbCount;
private String AttachmentInfo;
private String Remark;
private String EventId;
/**
*
*/
@Alias("AcceptEvents")
@ApiModelProperty(value = "受理调度信息")
private List<AcceptEvents> acceptEvents;
@Alias("TaskInfos")
private List<TaskInfos> 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;
}

@ -1,5 +1,8 @@
package com.yingji.entity;
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;
@ -13,7 +16,9 @@ public class TaskInfos implements Serializable {
private static final long serialVersionUID = 4118581272605160572L;
private Amb Amb;
@Alias("Amb")
private Amb amb;
private Task Task;
@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.Event;
/**
* (Event)访
*
* @author wu
* @since 2024-05-10 17:10:32
*/
public interface EventMapper extends BaseMapper<Event> {
}

@ -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,32 @@
package com.yingji.quartz;
import com.yingji.service.AccidentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
/**
* 120
*
* @author wu
* @since 2024/5/10 10:05
*/
//@Configuration
//@Transactional(rollbackFor = Exception.class)
public class AccidentQuartz {
public static final Logger log = LoggerFactory.getLogger(AccidentQuartz.class);
@Resource
private AccidentService accidentService;
// @Async
// @Scheduled(cron = "*/10 * * * * ? ")
public void savaData() {
accidentService.getAuthorizeValidate();
String accessToken = accidentService.getAuthorizeToken();
accidentService.getAccidentUrl(accessToken);
log.info("=================120定时任务结束===============");
}
}

@ -8,7 +8,7 @@ import com.yingji.service.SourceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
@ -23,7 +23,6 @@ import java.util.List;
* @since 2024/05/06 10:18
*/
@Configuration
@EnableScheduling
public class AlarmQuartz {
public static final Logger log = LoggerFactory.getLogger(AlarmQuartz.class);
@ -40,8 +39,9 @@ public class AlarmQuartz {
/**
* id
*/
@Async
@Scheduled(cron = "0 */5 * * * ? ")
private void savaData() {
public void savaData() {
// 获取token
String token = alarmService.getToken();
if (StrUtil.isEmpty(token)) {
@ -49,7 +49,7 @@ public class AlarmQuartz {
}
String yesterdayStr;
String effectiveTimeStr = redisCache.getCacheObject("effectiveTimeStr");
log.info("redis的缓存时间是==========================" + effectiveTimeStr );
log.info("redis的缓存时间是==========================" + effectiveTimeStr);
if (StrUtil.isNotEmpty(effectiveTimeStr)) {
yesterdayStr = effectiveTimeStr;
} else {

@ -1,5 +1,6 @@
package com.yingji.quartz;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.yingji.entity.Alarm;
import com.yingji.entity.dto.request.AlarmRequest;
@ -8,7 +9,7 @@ import com.yingji.service.SourceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Transactional;
@ -23,7 +24,6 @@ import java.util.List;
* @since 2024/05/06 10:18
*/
@Configuration
@EnableScheduling
@Transactional(rollbackFor = Exception.class)
public class SaveAlarmQuartz {
@ -35,8 +35,9 @@ public class SaveAlarmQuartz {
@Resource
private SourceService sourceService;
@Async
@Scheduled(cron = "0 */1 * * * ? ")
private void savaData() {
public void savaData() {
// 查询所有id
List<String> data = sourceService.findSourceAll();
// 查询数据条件
@ -65,15 +66,17 @@ public class SaveAlarmQuartz {
list.add(alarm);
sourceService.delBySourceId(x);
successNum++;
Thread.sleep(1000);
Thread.sleep(200);
} else {
return;
}
} catch (Exception e) {
log.info("==========================睡眠异常");
log.info("==========================" + e.getMessage());
}
}
alarmService.saveBatch(list);
if (CollectionUtil.isNotEmpty(list)) {
alarmService.saveBatch(list);
}
log.info("成功更新=========================" + successNum + "条数据");
}

@ -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,30 @@
package com.yingji.service;
/**
* 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);
void text();
}

@ -19,10 +19,10 @@ public interface AlarmService extends IService<Alarm> {
/**
*
*
* @param startTime
* @param size
* @param startTime
* @param entTime
*/
void synchronous(String startTime, Integer size);
void synchronous(String startTime, String entTime);
/**

@ -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,15 @@
package com.yingji.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yingji.entity.Event;
/**
* (Event)
*
* @author wu
* @since 2024-05-10 17:10:33
*/
public interface EventService extends IService<Event> {
}

@ -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 {
}

@ -60,11 +60,11 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements
/**
*
*
* @param startTime
* @param size
* @param startTime
* @param entTime
*/
@Override
public void synchronous(String startTime, Integer size) {
public void synchronous(String startTime, String entTime) {
// 获取token
String token = getToken();
if (StrUtil.isEmpty(token)) {
@ -73,7 +73,7 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements
// 定义起始页
int pageIndex = 1;
// 定义每页显示条数
int pageSize = 10;
int pageSize = 500;
// 保存获取的条数
int total = 0;
// 定义type
@ -98,22 +98,25 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements
log.info("=======================================");
log.info("数据的条数为:" + data.size());
List<Alarm> list = new ArrayList<>();
data.forEach(x -> {
for (String x : data) {
alarmRequest.setValue(x);
Alarm alarm = findDataList(alarmRequest, token);
alarm.setSourceId(x);
// 获取结束时间
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss").withZone(ZoneId.systemDefault());
LocalDateTime emergencyEventTime = LocalDateTime.parse(entTime, formatter);
if (emergencyEventTime.isBefore(alarm.getEmergencyEventTime())) {
saveBatch(list);
return;
}
list.add(alarm);
try {
Thread.sleep(1000);
Thread.sleep(300);
} catch (InterruptedException e) {
log.info("睡眠1秒失败");
log.info("睡眠200毫秒失败");
}
});
saveBatch(list);
// 总条数
if (total >= size) {
return;
}
saveBatch(list);
if (data.size() == pageSize) {
req.setPageIndex(pageIndex++);
log.info("第" + pageIndex + "页==========================" + list.size() + "条数据");
@ -123,6 +126,21 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements
}
}
public static void main(String[] args) {
LocalDateTime dateTime1 = LocalDateTime.of(2022, 1, 1, 12, 0, 0);
LocalDateTime dateTime2 = LocalDateTime.of(2022, 1, 1, 14, 0, 0);
int comparisonResult = dateTime1.compareTo(dateTime2);
if (comparisonResult < 0) {
System.out.println("dateTime1 在 dateTime2 之前");
} else if (comparisonResult > 0) {
System.out.println("dateTime1 在 dateTime2 之后");
} else {
System.out.println("dateTime1 和 dateTime2 相等");
}
}
/**
* Id
*
@ -194,7 +212,10 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements
@Override
public String getToken() {
String accessToken = null;
String body = HttpRequest.get(getToken).header("Authorization", "Basic QkZTaFQzL1d3UGhaSlFkTDhlNEZkblExMWgwUU9lS3FCZG4reGVzQ1NKR2xESEtQazVmeG5tbkxrMW9ua20zWXpkZmpFMGdMR0VaN0g3dmZMczIxc0dNPTpHdGJnUmZOSW1Yam1CcVcwbnB4VWlHaS9zMG1iNVpkdlhBTnFVQ2dtSW00PQ==").header("Content-Type", "application/json").form("grant_type", "client_credentials").execute().body();
String body = HttpRequest.get(getToken)
.header("Authorization", "Basic Qk5qUDlTOHAyRUpaeXQxVUYrRDZrQ3NLNlpWYXB5S3FpR3phckVkc1ozUW1JV29WZEI3WWtyWDJHQkFtQ0RPMTZ0US9hazg2cFpnUDVaUzNzNEVHZGNvPTpBTTRvTU9zSmowVUxBVU9PWGx6NXhIaklGNGtwOVc2M2FqWnJYeFRHTEhFbg==")
.header("Content-Type", "application/json")
.form("grant_type", "client_credentials").execute().body();
JSONObject json = JSONObject.parse(body);
Object response = json.get("response");
if (BeanUtil.isNotEmpty(response)) {

@ -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,19 @@
package com.yingji.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yingji.entity.Event;
import com.yingji.mapper.EventMapper;
import com.yingji.service.EventService;
import org.springframework.stereotype.Service;
/**
* (Event)
*
* @author wu
* @since 2024-05-10 17:10:33
*/
@Service("eventService")
public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements EventService {
}

@ -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 {
}

@ -34,9 +34,17 @@ getToken: http://2.46.4.198:8008/token
# 110获取数据
specificWarn: http://2.46.4.198:8008/rs/k4r3h/DataAnalysisService/sz/share/specificWarn
#110
clientId: BFShT3/WwPhZJQdL8e4FdnQ11h0QOeKqBdn+xesCSJGlDHKPk5fxnmnLk1onkm3YzdfjE0gLGEZ7H7vfLs21sGM=
# 110clientId
clientId: BNjP9S8p2EJZyt1UF+D6kCsK6ZVapyKqiGzarEdsZ3QmIWoVdB7YkrX2GBAmCDO16tQ/ak86pZgP5ZS3s4EGdco=
#110
clientSecret: GtbgRfNImXjmBqW0npxUiGi/s0mb5ZdvXANqUCgmIm4=
# 110clientSecret
clientSecret: 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

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/home/ruoyi/logs" />
<property name="log.path" value="/home/ruoyi/logs/towLog" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />

@ -15,6 +15,6 @@
<select id="findSourceAll" resultType="java.lang.String">
select source_id
from source
from source limit 50
</select>
</mapper>
Loading…
Cancel
Save