|
|
@ -9,10 +9,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.ruoyi.pt.entity.CasesImport;
|
|
|
|
import com.ruoyi.pt.entity.CasesImport;
|
|
|
|
import com.ruoyi.pt.entity.Events;
|
|
|
|
import com.ruoyi.pt.entity.Events;
|
|
|
|
|
|
|
|
import com.ruoyi.pt.entity.EventsCopy;
|
|
|
|
import com.ruoyi.pt.entity.dto.RemoteCallsDTO;
|
|
|
|
import com.ruoyi.pt.entity.dto.RemoteCallsDTO;
|
|
|
|
import com.ruoyi.pt.entity.response.RemoteCallsResponse;
|
|
|
|
import com.ruoyi.pt.entity.response.RemoteCallsResponse;
|
|
|
|
import com.ruoyi.pt.entity.response.RemoteEventResponse;
|
|
|
|
import com.ruoyi.pt.entity.response.RemoteEventResponse;
|
|
|
|
import com.ruoyi.pt.service.CasesImportService;
|
|
|
|
import com.ruoyi.pt.service.CasesImportService;
|
|
|
|
|
|
|
|
import com.ruoyi.pt.service.EventsCopyService;
|
|
|
|
import com.ruoyi.pt.service.EventsService;
|
|
|
|
import com.ruoyi.pt.service.EventsService;
|
|
|
|
import com.ruoyi.pt.service.RemoteCallsService;
|
|
|
|
import com.ruoyi.pt.service.RemoteCallsService;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
@ -52,6 +54,9 @@ public class RemoteCallsServiceImpl implements RemoteCallsService {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private EventsService eventsService;
|
|
|
|
private EventsService eventsService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private EventsCopyService eventsCopyService;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private CasesImportService casesImportService;
|
|
|
|
private CasesImportService casesImportService;
|
|
|
|
|
|
|
|
|
|
|
@ -84,22 +89,27 @@ public class RemoteCallsServiceImpl implements RemoteCallsService {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 事件进度推送接口
|
|
|
|
* 事件进度推送接口
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param allPush 是否全推送 1为推送所有 null为推送当天
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void imports() {
|
|
|
|
public void imports(Integer allPush) {
|
|
|
|
String accessToken = this.getAccessToken();
|
|
|
|
String accessToken = this.getAccessToken();
|
|
|
|
// 初始化MyBatis-Plus的分页对象 查询第1页,每页100条
|
|
|
|
// 初始化MyBatis-Plus的分页对象 查询第1页,每页100条
|
|
|
|
Page<Events> page = new Page<>(1, 100);
|
|
|
|
Page<Events> page = new Page<>(1, 100);
|
|
|
|
// 创建查询条件
|
|
|
|
// 创建查询条件
|
|
|
|
QueryWrapper<Events> queryWrapper = new QueryWrapper<>();
|
|
|
|
QueryWrapper<Events> queryWrapper = new QueryWrapper<>();
|
|
|
|
// 获取昨天的日期
|
|
|
|
if (allPush != null && allPush == 1) {
|
|
|
|
LocalDate localDate = LocalDate.now();
|
|
|
|
// 获取昨天的日期
|
|
|
|
LocalDate yesterday = localDate.minusDays(1);
|
|
|
|
LocalDate localDate = LocalDate.now();
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
LocalDate yesterday = localDate.minusDays(1);
|
|
|
|
String yesterdayStr = yesterday.format(formatter);
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
|
|
|
|
String yesterdayStr = yesterday.format(formatter);
|
|
|
|
|
|
|
|
queryWrapper.and(wrapper -> wrapper.gt("eventTime", yesterdayStr));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
queryWrapper.isNotNull("innerEventId")
|
|
|
|
queryWrapper.isNotNull("innerEventId")
|
|
|
|
.and(wrapper -> wrapper.ne("innerEventId", ""))
|
|
|
|
.and(wrapper -> wrapper.ne("innerEventId", ""))
|
|
|
|
.and(wrapper -> wrapper.gt("eventTime", yesterdayStr))
|
|
|
|
|
|
|
|
.and(wrapper -> wrapper
|
|
|
|
.and(wrapper -> wrapper
|
|
|
|
.nested(i -> i.eq("scenceType", "3").gt("urgentPercent", 0.994))
|
|
|
|
.nested(i -> i.eq("scenceType", "3").gt("urgentPercent", 0.994))
|
|
|
|
.or()
|
|
|
|
.or()
|
|
|
@ -135,13 +145,61 @@ public class RemoteCallsServiceImpl implements RemoteCallsService {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 临时推送
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void temporaryImports() {
|
|
|
|
|
|
|
|
log.info("==========推送开始=========");
|
|
|
|
|
|
|
|
String accessToken = this.getAccessToken();
|
|
|
|
|
|
|
|
log.info("==========获取token=========> " + accessToken);
|
|
|
|
|
|
|
|
// 初始化MyBatis-Plus的分页对象 查询第1页,每页100条
|
|
|
|
|
|
|
|
Page<EventsCopy> page = new Page<>(1, 100);
|
|
|
|
|
|
|
|
// 创建查询条件
|
|
|
|
|
|
|
|
QueryWrapper<EventsCopy> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
queryWrapper.isNotNull("innerEventId")
|
|
|
|
|
|
|
|
.and(wrapper -> wrapper.ne("innerEventId", ""))
|
|
|
|
|
|
|
|
.and(wrapper -> wrapper
|
|
|
|
|
|
|
|
.nested(i -> i.eq("scenceType", "3").gt("urgentPercent", 0.994))
|
|
|
|
|
|
|
|
.or()
|
|
|
|
|
|
|
|
.ne("scenceType", "3")
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
// 创建SimpleDateFormat对象,指定日期格式为yyyy-MM-dd HH:mm:ss
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
|
|
// 循环获取所有数据
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
|
|
|
|
IPage<EventsCopy> dataPage = eventsCopyService.page(page, queryWrapper);
|
|
|
|
|
|
|
|
List<EventsCopy> data = dataPage.getRecords();
|
|
|
|
|
|
|
|
List<RemoteCallsDTO> dtos = BeanUtil.copyToList(data, RemoteCallsDTO.class);
|
|
|
|
|
|
|
|
dtos.forEach(x -> {
|
|
|
|
|
|
|
|
x.setContent(x.getTitle());
|
|
|
|
|
|
|
|
// 使用SimpleDateFormat对象将Date对象格式化为字符串
|
|
|
|
|
|
|
|
String firstWarnTime = sdf.format(x.getFirstWarnTimeDate());
|
|
|
|
|
|
|
|
String eventTime = sdf.format(x.getEventTimeDate());
|
|
|
|
|
|
|
|
x.setContent(x.getTitle());
|
|
|
|
|
|
|
|
x.setFirstWarnTime(firstWarnTime);
|
|
|
|
|
|
|
|
x.setEventTime(eventTime);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
String jsonStr = JSONUtil.toJsonStr(dtos);
|
|
|
|
|
|
|
|
HttpRequest.post(url + "/gateway/event/event/eventData/imports").header("Authorization", "Bearer " + accessToken).body(jsonStr).execute().body();
|
|
|
|
|
|
|
|
// 判断是否还有下一页
|
|
|
|
|
|
|
|
if (dataPage.getPages() > dataPage.getCurrent()) {
|
|
|
|
|
|
|
|
// 设置下一页的页码
|
|
|
|
|
|
|
|
page.setCurrent(page.getCurrent() + 1);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
log.info("==========推送完成=========");
|
|
|
|
|
|
|
|
return; // 已经获取完所有数据,结束循环
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取社会治理中心增量事件保存到events_import表
|
|
|
|
* 获取社会治理中心增量事件保存到events_import表
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void getEventDate() {
|
|
|
|
public void getEventDate() {
|
|
|
|
Long id = casesImportService.findIdDesc();
|
|
|
|
Long id = casesImportService.findIdDesc();
|
|
|
|
log.info("最新id是=============:"+id);
|
|
|
|
log.info("最新id是=============:" + id);
|
|
|
|
if (id == null) {
|
|
|
|
if (id == null) {
|
|
|
|
id = 0L;
|
|
|
|
id = 0L;
|
|
|
|
}
|
|
|
|
}
|
|
|
|