|
|
|
@ -12,7 +12,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.ruoyi.pt.entity.CasesImport;
|
|
|
|
|
import com.ruoyi.pt.entity.Events;
|
|
|
|
|
import com.ruoyi.pt.entity.EventsCopy;
|
|
|
|
|
import com.ruoyi.pt.entity.dto.RemoteCallsDTO;
|
|
|
|
|
import com.ruoyi.pt.entity.response.PassEventRequest;
|
|
|
|
|
import com.ruoyi.pt.entity.response.RemoteCallsResponse;
|
|
|
|
@ -177,61 +176,6 @@ public class RemoteCallsServiceImpl implements RemoteCallsService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 临时推送
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void temporaryImports() {
|
|
|
|
|
log.info("==========临时推送开始=========");
|
|
|
|
|
String accessToken = this.getAccessToken();
|
|
|
|
|
// 初始化MyBatis-Plus的分页对象 查询第1页,每页100条
|
|
|
|
|
Page<EventsCopy> page = new Page<>(1, 100);
|
|
|
|
|
// 创建查询条件
|
|
|
|
|
QueryWrapper<EventsCopy> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.isNotNull("innerEventId").and(wrapper -> wrapper.ne("innerEventId", ""));
|
|
|
|
|
// 创建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);
|
|
|
|
|
log.info("==========推送数据条数=========> " + dtos.size());
|
|
|
|
|
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(firstWarnTime);
|
|
|
|
|
x.setLastWarnTime(eventTime);
|
|
|
|
|
// 获取relationNums转成数组
|
|
|
|
|
JSONArray jsonArray = JSONUtil.parseArray(x.getRelationNums());
|
|
|
|
|
List<String> list = jsonArray.toList(String.class);
|
|
|
|
|
QueryWrapper<CasesImport> wrapper = new QueryWrapper<>();
|
|
|
|
|
wrapper.eq("CASE_SERIAL", list.get(0));
|
|
|
|
|
CasesImport casesImport = casesImportService.getOne(wrapper);
|
|
|
|
|
if (BeanUtil.isNotEmpty(casesImport)) {
|
|
|
|
|
x.setEventCreator(casesImport.getCreatorName());
|
|
|
|
|
x.setEventCreatorTel(casesImport.getCreatorTel());
|
|
|
|
|
x.setEventPlaceName(casesImport.getCaseAddress());
|
|
|
|
|
x.setEventCoordinate(casesImport.getCaseLnglat());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
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表
|
|
|
|
|
*/
|
|
|
|
@ -317,6 +261,62 @@ public class RemoteCallsServiceImpl implements RemoteCallsService {
|
|
|
|
|
getTheData("getCompletionEventList", 2, lastHourStr, localDateStr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据事件id推送接口
|
|
|
|
|
*
|
|
|
|
|
* @param innerEventId 事件id
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void pushByInnerEventId(String innerEventId) {
|
|
|
|
|
String accessToken = this.getAccessToken();
|
|
|
|
|
// 创建查询条件
|
|
|
|
|
QueryWrapper<Events> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.eq("innerEventId", innerEventId);
|
|
|
|
|
// 创建SimpleDateFormat对象,指定日期格式为yyyy-MM-dd HH:mm:ss
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
Events event = eventsService.getOne(queryWrapper);
|
|
|
|
|
RemoteCallsDTO dtos = BeanUtil.copyProperties(event, RemoteCallsDTO.class);
|
|
|
|
|
dtos.setContent(dtos.getTitle());
|
|
|
|
|
// 使用SimpleDateFormat对象将Date对象格式化为字符串
|
|
|
|
|
String firstWarnTime = sdf.format(dtos.getFirstWarnTimeDate());
|
|
|
|
|
String eventTime = sdf.format(dtos.getEventTimeDate());
|
|
|
|
|
dtos.setFirstWarnTime(firstWarnTime);
|
|
|
|
|
dtos.setEventTime(firstWarnTime);
|
|
|
|
|
dtos.setLastWarnTime(eventTime);
|
|
|
|
|
// 获取relationNums转成数组
|
|
|
|
|
JSONArray jsonArray = JSONUtil.parseArray(dtos.getRelationNums());
|
|
|
|
|
List<String> list = jsonArray.toList(String.class);
|
|
|
|
|
QueryWrapper<CasesImport> wrapper = new QueryWrapper<>();
|
|
|
|
|
wrapper.eq("CASE_SERIAL", list.get(0));
|
|
|
|
|
CasesImport casesImport = casesImportService.getOne(wrapper);
|
|
|
|
|
if (BeanUtil.isNotEmpty(casesImport)) {
|
|
|
|
|
// 如果是紧急事件content使用原始工单的content
|
|
|
|
|
if ("3".equals(dtos.getScenceType())) {
|
|
|
|
|
dtos.setContent(casesImport.getCaseContent());
|
|
|
|
|
} else {
|
|
|
|
|
dtos.setContent(dtos.getTitle());
|
|
|
|
|
}
|
|
|
|
|
// 如果类型是同人事件,上报⼈姓名和电话不取原始工单,直接从预警因素字段取,顿号分隔。
|
|
|
|
|
if ("2".equals(dtos.getScenceType())) {
|
|
|
|
|
String warnFactor = dtos.getWarnFactor();
|
|
|
|
|
String[] split = warnFactor.split("、");
|
|
|
|
|
if (split.length == 2) {
|
|
|
|
|
dtos.setEventCreatorTel(split[0]);
|
|
|
|
|
dtos.setEventCreator(split[1]);
|
|
|
|
|
} else {
|
|
|
|
|
dtos.setEventCreatorTel(split[0]);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
dtos.setEventCreator(casesImport.getCreatorName());
|
|
|
|
|
dtos.setEventCreatorTel(casesImport.getCreatorTel());
|
|
|
|
|
}
|
|
|
|
|
dtos.setEventPlaceName(casesImport.getCaseAddress());
|
|
|
|
|
dtos.setEventCoordinate(casesImport.getCaseLnglat());
|
|
|
|
|
}
|
|
|
|
|
String jsonStr = JSONUtil.toJsonStr(dtos);
|
|
|
|
|
HttpRequest.post(url + "/gateway/event/event/eventData/imports").header("Authorization", "Bearer " + accessToken).body(jsonStr).execute().body();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取社会治理中心增量事件保存到events_import表
|
|
|
|
|
*
|
|
|
|
|