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