定时同步预警任务修改
parent
68f09fe882
commit
7af9886e42
|
|
@ -13,8 +13,10 @@ import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.compress.utils.Lists;
|
import org.apache.commons.compress.utils.Lists;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.http.HttpStatus;
|
import org.apache.http.HttpStatus;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
@ -34,6 +36,8 @@ import java.util.stream.Collectors;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class MyPostConstruct {
|
public class MyPostConstruct {
|
||||||
|
|
||||||
|
@Value("${getGroupWarning}")
|
||||||
|
public String getGroupWarning;
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void initCache() {
|
public void initCache() {
|
||||||
log.debug("加载缓存");
|
log.debug("加载缓存");
|
||||||
|
|
@ -48,11 +52,22 @@ public class MyPostConstruct {
|
||||||
@GetMapping("/syncData")
|
@GetMapping("/syncData")
|
||||||
@Scheduled(cron ="0 0/1 * * * ?")
|
@Scheduled(cron ="0 0/1 * * * ?")
|
||||||
public void syncData() {
|
public void syncData() {
|
||||||
|
sync(null,null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sync(String stm,String etm) {
|
||||||
log.info("预警数据同步开始!!!");
|
log.info("预警数据同步开始!!!");
|
||||||
ApiDto apiDto = new ApiDto();
|
ApiDto apiDto = new ApiDto();
|
||||||
|
if (StringUtils.isNotBlank(stm)){
|
||||||
|
apiDto.setStartTime(stm);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(etm)){
|
||||||
|
apiDto.setEndTime(etm);
|
||||||
|
}
|
||||||
|
|
||||||
apiDto.setFilter(Lists.newArrayList());
|
apiDto.setFilter(Lists.newArrayList());
|
||||||
|
|
||||||
String str = HttpUtil.sendPost("http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
String str = HttpUtil.sendPost(getGroupWarning, JSON.toJSONString(apiDto));
|
||||||
// String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
// String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
||||||
JSONObject json = JSON.parseObject(str);
|
JSONObject json = JSON.parseObject(str);
|
||||||
if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import org.apache.commons.compress.utils.Lists;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.http.HttpStatus;
|
import org.apache.http.HttpStatus;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
@ -52,6 +53,9 @@ public class QXWarnController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IQXWarningService service;
|
private IQXWarningService service;
|
||||||
|
|
||||||
|
@Value("${getGroupWarning}")
|
||||||
|
public String getGroupWarning;
|
||||||
|
|
||||||
@ApiOperation(value = "新增")
|
@ApiOperation(value = "新增")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public ResultJson<String> insert(@RequestBody @Validated QXWarning dto) {
|
public ResultJson<String> insert(@RequestBody @Validated QXWarning dto) {
|
||||||
|
|
@ -71,14 +75,20 @@ public class QXWarnController {
|
||||||
|
|
||||||
// @Async
|
// @Async
|
||||||
@ApiOperation(value = "预警数据同步接口", notes = "预警数据同步接口")
|
@ApiOperation(value = "预警数据同步接口", notes = "预警数据同步接口")
|
||||||
@GetMapping("/syncData")
|
@PostMapping("/syncData")
|
||||||
// @Scheduled(cron ="0 0/5 * * * ?")
|
// @Scheduled(cron ="0 0/5 * * * ?")
|
||||||
public void syncData() {
|
public void syncData( @RequestBody GroupWarningDto dto) {
|
||||||
log.info("预警数据同步开始!!!");
|
log.info("预警数据同步开始!!!");
|
||||||
ApiDto apiDto = new ApiDto();
|
ApiDto apiDto = new ApiDto();
|
||||||
|
if (StringUtils.isNotBlank(dto.getStartTime())){
|
||||||
|
apiDto.setStartTime(dto.getStartTime());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(dto.getEndTime())){
|
||||||
|
apiDto.setEndTime(dto.getEndTime());
|
||||||
|
}
|
||||||
apiDto.setFilter(Lists.newArrayList());
|
apiDto.setFilter(Lists.newArrayList());
|
||||||
|
|
||||||
String str = HttpUtil.sendPost("http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
String str = HttpUtil.sendPost(getGroupWarning, JSON.toJSONString(apiDto));
|
||||||
// String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
// String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
||||||
JSONObject json = JSON.parseObject(str);
|
JSONObject json = JSON.parseObject(str);
|
||||||
if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
||||||
|
|
@ -161,7 +171,7 @@ public class QXWarnController {
|
||||||
// String warnSignalType = dto.getWarnSignalType();
|
// String warnSignalType = dto.getWarnSignalType();
|
||||||
// apiDto.setFilter(filter);
|
// apiDto.setFilter(filter);
|
||||||
// System.out.println(apiDto);
|
// System.out.println(apiDto);
|
||||||
// String str = HttpUtil.sendPost("http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
// String str = HttpUtil.sendPost(getGroupWarning, JSON.toJSONString(apiDto));
|
||||||
//// String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
//// String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
||||||
// JSONObject json = JSON.parseObject(str);
|
// JSONObject json = JSON.parseObject(str);
|
||||||
// if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
// if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
||||||
|
|
@ -292,7 +302,7 @@ public class QXWarnController {
|
||||||
String warnSignalLevel = dto.getWarnSignalLevel();
|
String warnSignalLevel = dto.getWarnSignalLevel();
|
||||||
String warnSignalType = dto.getWarnSignalType();
|
String warnSignalType = dto.getWarnSignalType();
|
||||||
dayDto.setFilter(filter);
|
dayDto.setFilter(filter);
|
||||||
String daystr = HttpUtil.sendPost("http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(dayDto));
|
String daystr = HttpUtil.sendPost(getGroupWarning, JSON.toJSONString(dayDto));
|
||||||
// String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
// String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
||||||
JSONObject dayjson = JSON.parseObject(daystr);
|
JSONObject dayjson = JSON.parseObject(daystr);
|
||||||
if (dayjson != null && dayjson.getInteger("code") == HttpStatus.SC_OK) {
|
if (dayjson != null && dayjson.getInteger("code") == HttpStatus.SC_OK) {
|
||||||
|
|
@ -319,7 +329,7 @@ public class QXWarnController {
|
||||||
weekDto.setPageNumber(dto.getPageNumber());
|
weekDto.setPageNumber(dto.getPageNumber());
|
||||||
weekDto.setPageSize(99999);
|
weekDto.setPageSize(99999);
|
||||||
weekDto.setFilter(filter);
|
weekDto.setFilter(filter);
|
||||||
String weekstr = HttpUtil.sendPost("http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(weekDto));
|
String weekstr = HttpUtil.sendPost(getGroupWarning, JSON.toJSONString(weekDto));
|
||||||
JSONObject weekjson = JSON.parseObject(weekstr);
|
JSONObject weekjson = JSON.parseObject(weekstr);
|
||||||
System.out.println("weekstr:" + weekjson);
|
System.out.println("weekstr:" + weekjson);
|
||||||
if (weekjson != null && weekjson.getInteger("code") == HttpStatus.SC_OK) {
|
if (weekjson != null && weekjson.getInteger("code") == HttpStatus.SC_OK) {
|
||||||
|
|
@ -346,7 +356,7 @@ public class QXWarnController {
|
||||||
monthDto.setPageNumber(dto.getPageNumber());
|
monthDto.setPageNumber(dto.getPageNumber());
|
||||||
monthDto.setPageSize(99999);
|
monthDto.setPageSize(99999);
|
||||||
monthDto.setFilter(filter);
|
monthDto.setFilter(filter);
|
||||||
String monthstr = HttpUtil.sendPost("http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(monthDto));
|
String monthstr = HttpUtil.sendPost(getGroupWarning, JSON.toJSONString(monthDto));
|
||||||
JSONObject monthjson = JSON.parseObject(monthstr);
|
JSONObject monthjson = JSON.parseObject(monthstr);
|
||||||
System.out.println("monthstr:" + monthjson);
|
System.out.println("monthstr:" + monthjson);
|
||||||
if (monthjson != null && monthjson.getInteger("code") == HttpStatus.SC_OK) {
|
if (monthjson != null && monthjson.getInteger("code") == HttpStatus.SC_OK) {
|
||||||
|
|
@ -373,7 +383,7 @@ public class QXWarnController {
|
||||||
yearDto.setPageNumber(dto.getPageNumber());
|
yearDto.setPageNumber(dto.getPageNumber());
|
||||||
yearDto.setPageSize(99999);
|
yearDto.setPageSize(99999);
|
||||||
yearDto.setFilter(filter);
|
yearDto.setFilter(filter);
|
||||||
String yearstr = HttpUtil.sendPost("http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(yearDto));
|
String yearstr = HttpUtil.sendPost(getGroupWarning, JSON.toJSONString(yearDto));
|
||||||
JSONObject yearjson = JSON.parseObject(yearstr);
|
JSONObject yearjson = JSON.parseObject(yearstr);
|
||||||
System.out.println("yearstr:" + yearjson);
|
System.out.println("yearstr:" + yearjson);
|
||||||
if (yearjson != null && yearjson.getInteger("code") == HttpStatus.SC_OK) {
|
if (yearjson != null && yearjson.getInteger("code") == HttpStatus.SC_OK) {
|
||||||
|
|
@ -427,7 +437,7 @@ public class QXWarnController {
|
||||||
// String warnSignalLevel = dto.getWarnSignalLevel();
|
// String warnSignalLevel = dto.getWarnSignalLevel();
|
||||||
// String warnSignalType = dto.getWarnSignalType();
|
// String warnSignalType = dto.getWarnSignalType();
|
||||||
// apiDto.setFilter(filter);
|
// apiDto.setFilter(filter);
|
||||||
// String str = HttpUtil.sendPost("http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
// String str = HttpUtil.sendPost(getGroupWarning, JSON.toJSONString(apiDto));
|
||||||
//// String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
//// String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
||||||
// JSONObject json = JSON.parseObject(str);
|
// JSONObject json = JSON.parseObject(str);
|
||||||
// if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
// if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
||||||
|
|
@ -500,7 +510,7 @@ public class QXWarnController {
|
||||||
weekDto.setPageNumber(dto.getPageNumber());
|
weekDto.setPageNumber(dto.getPageNumber());
|
||||||
weekDto.setPageSize(99999);
|
weekDto.setPageSize(99999);
|
||||||
weekDto.setFilter(filter);
|
weekDto.setFilter(filter);
|
||||||
String weekstr = HttpUtil.sendPost("http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(weekDto));
|
String weekstr = HttpUtil.sendPost(getGroupWarning, JSON.toJSONString(weekDto));
|
||||||
JSONObject weekjson = JSON.parseObject(weekstr);
|
JSONObject weekjson = JSON.parseObject(weekstr);
|
||||||
System.out.println("weekstr:" + weekjson);
|
System.out.println("weekstr:" + weekjson);
|
||||||
if (weekjson != null && weekjson.getInteger("code") == HttpStatus.SC_OK) {
|
if (weekjson != null && weekjson.getInteger("code") == HttpStatus.SC_OK) {
|
||||||
|
|
@ -525,7 +535,7 @@ public class QXWarnController {
|
||||||
searchDto.setPageNumber(dto.getPageNumber());
|
searchDto.setPageNumber(dto.getPageNumber());
|
||||||
searchDto.setPageSize(99999);
|
searchDto.setPageSize(99999);
|
||||||
searchDto.setFilter(filter);
|
searchDto.setFilter(filter);
|
||||||
String searchstr = HttpUtil.sendPost("http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(searchDto));
|
String searchstr = HttpUtil.sendPost(getGroupWarning, JSON.toJSONString(searchDto));
|
||||||
JSONObject searchjson = JSON.parseObject(searchstr);
|
JSONObject searchjson = JSON.parseObject(searchstr);
|
||||||
System.out.println("searchjson:" + searchjson);
|
System.out.println("searchjson:" + searchjson);
|
||||||
FBStatsVO fbStatsVO = null;
|
FBStatsVO fbStatsVO = null;
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import org.apache.commons.compress.utils.Lists;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.http.HttpStatus;
|
import org.apache.http.HttpStatus;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
@ -50,6 +51,9 @@ public class WarningController {
|
||||||
public static final String THIS_REDIS_KEY = REDIS_KEY + "warning";
|
public static final String THIS_REDIS_KEY = REDIS_KEY + "warning";
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${getGroupWarning}")
|
||||||
|
public String getGroupWarning;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IAddressBookService addressBookService;
|
private IAddressBookService addressBookService;
|
||||||
|
|
||||||
|
|
@ -122,7 +126,7 @@ public class WarningController {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
apiDto.setFilter(filter);
|
apiDto.setFilter(filter);
|
||||||
// String str = HttpUtil.sendPost("http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
// String str = HttpUtil.sendPost(getGroupWarning, JSON.toJSONString(apiDto));
|
||||||
String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
||||||
JSONObject json = JSON.parseObject(str);
|
JSONObject json = JSON.parseObject(str);
|
||||||
if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
||||||
|
|
@ -200,7 +204,7 @@ public class WarningController {
|
||||||
|
|
||||||
|
|
||||||
apiDto.setFilter(filter);
|
apiDto.setFilter(filter);
|
||||||
String str = HttpUtil.sendPost("http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
String str = HttpUtil.sendPost(getGroupWarning, JSON.toJSONString(apiDto));
|
||||||
// String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
// String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
||||||
JSONObject json = JSON.parseObject(str);
|
JSONObject json = JSON.parseObject(str);
|
||||||
if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,12 @@ spring:
|
||||||
datasource:
|
datasource:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driver-class-name: dm.jdbc.driver.DmDriver
|
driver-class-name: dm.jdbc.driver.DmDriver
|
||||||
url: jdbc:dm://local.gunshiiot.com:5236?schema=FXKH_TXL
|
# url: jdbc:dm://local.gunshiiot.com:5236?schema=FXKH_TXL
|
||||||
username: SYSDBA
|
# username: SYSDBA
|
||||||
password: SYSDBA001
|
# password: SYSDBA001
|
||||||
# url: jdbc:dm://10.42.6.247:5236?schema=FXKH_TXL
|
url: jdbc:dm://10.42.6.247:5236?schema=FXKH_TXL
|
||||||
# username: SHZH
|
username: SHZH
|
||||||
# password: Shzh_890
|
password: Shzh_890
|
||||||
druid:
|
druid:
|
||||||
initialSize: 5
|
initialSize: 5
|
||||||
minIdle: 5
|
minIdle: 5
|
||||||
|
|
@ -81,3 +81,6 @@ wx:
|
||||||
configs:
|
configs:
|
||||||
appid: wxb9b07668d1ba20fe
|
appid: wxb9b07668d1ba20fe
|
||||||
secret: 99a1b89ac30e28bcc9bba8be973027f4
|
secret: 99a1b89ac30e28bcc9bba8be973027f4
|
||||||
|
|
||||||
|
getGroupWarning: http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning
|
||||||
|
#getGroupWarning: http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning
|
||||||
Loading…
Reference in New Issue