diff --git a/pom.xml b/pom.xml index b6d5e180..aa7d318d 100644 --- a/pom.xml +++ b/pom.xml @@ -89,12 +89,12 @@ prod prod - 53.176.146.99:8848 + 53.238.79.33:8848 DEFAULT_GROUP DEFAULT_GROUP nacos - nacos - 53.176.146.99:4560 + Ycgis!2509 + 53.238.79.33:4560 diff --git a/stwzhj-auth/src/main/resources/logback-plus.xml b/stwzhj-auth/src/main/resources/logback-plus.xml index ce76b73b..d97d7560 100644 --- a/stwzhj-auth/src/main/resources/logback-plus.xml +++ b/stwzhj-auth/src/main/resources/logback-plus.xml @@ -1,87 +1,49 @@ - - + + + + - - - - - - - - - - - - - - + + + ${log.path}/info.${log.file}.log - - ERROR - - DENY - - ACCEPT + INFO + ACCEPT + DENY - - ${log.path}${log.file} - - UTF-8 - %date [%level] [%thread] %logger{60} [%file : %line] %msg%n - - ${log.path}info/${log.file}.%d{yyyy-MM-dd}.%i.gz - 50MB - 20 + ${log.path}/info/info.${log.file}.%d{yyyy-MM-dd}.%i.log.gz + ${MAX_FILE_SIZE} + ${MAX_HISTORY} + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + - - - + + + ${log.path}/error.${log.file}.log - Error + ERROR - - ${log.path}error.${log.file} - - - ${log.path}error/${log.file}.%d{yyyy-MM-dd}.%i.gz - - 50MB - 180 - - + ${log.path}/error/error.${log.file}.%d{yyyy-MM-dd}.%i.log.gz + ${MAX_FILE_SIZE} + ${MAX_HISTORY} - - UTF-8 - %date [%level] [%thread] %logger{60} [%file : %line] %msg%n + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - + - - - + + + diff --git a/stwzhj-common/stwzhj-common-dubbo/src/main/resources/common-dubbo.yml b/stwzhj-common/stwzhj-common-dubbo/src/main/resources/common-dubbo.yml index 70227a0a..fae8884d 100644 --- a/stwzhj-common/stwzhj-common-dubbo/src/main/resources/common-dubbo.yml +++ b/stwzhj-common/stwzhj-common-dubbo/src/main/resources/common-dubbo.yml @@ -30,7 +30,7 @@ dubbo: namespace: ${spring.profiles.active} database: ${spring.data.redis.database} timeout: ${spring.data.redis.timeout} - backup: 53.176.146.98:26380,53.176.146.99:26380,53.176.146.100:26380 + backup: 53.238.79.33:26380,53.238.79.34:26380,53.238.79.35:26380 # metadata-report: # address: redis://${spring.data.redis.host}:${spring.data.redis.port} # group: DUBBO_GROUP diff --git a/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/config/KafkaConfig.java b/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/config/KafkaConfig.java index 00563135..464531b0 100644 --- a/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/config/KafkaConfig.java +++ b/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/config/KafkaConfig.java @@ -27,7 +27,7 @@ public class KafkaConfig { // private String kafkaServers = "140.168.2.31:21007,140.168.2.32:21007,140.168.2.33:21007"; // private String kafkaServers = "53.208.61.105:6667,53.208.61.106:6667,53.208.61.107:6667";//六安GA网 // private String kafkaServers = "34.72.62.93:9092";//六安视频网 - private String kafkaServers = "53.176.146.99:9092,53.176.146.100:9092,53.176.146.101:9092";//本地 + private String kafkaServers = "53.238.79.33:9092,53.238.79.34:9092,53.238.79.35:9092";//本地 // private String kafkaServers = "53.238.79.4:9092,53.238.79.5:9092,53.238.79.6:9092";//省厅 马伟提供 private String groupId = "ruansiProducer"; diff --git a/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/config/RuansiConfiguration.java b/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/config/RuansiConfiguration.java new file mode 100644 index 00000000..0e4b9afb --- /dev/null +++ b/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/config/RuansiConfiguration.java @@ -0,0 +1,21 @@ +package org.dromara.data2es.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.cloud.context.config.annotation.RefreshScope; +import org.springframework.context.annotation.Configuration; + + +@Data +@Configuration +@RefreshScope +@ConfigurationProperties(prefix = "ruansi") +public class RuansiConfiguration { + + private boolean sendToThirdEnabled; + + private String startUpdateTime; + + private String dsPreurl; + +} diff --git a/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/handler/DataInsertBatchHandler.java b/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/handler/DataInsertBatchHandler.java index 04448c4d..1e328c0e 100644 --- a/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/handler/DataInsertBatchHandler.java +++ b/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/handler/DataInsertBatchHandler.java @@ -49,7 +49,7 @@ public class DataInsertBatchHandler implements CommandLineRunner { log.info("batch size={}", list.size()); if(CollectionUtil.isNotEmpty(list)) { gpsService.saveDataBatch(list); -// storeDataService.saveDataByPersonTypeBatch(list); + storeDataService.saveDataByPersonTypeBatch(list); } } catch (Exception e) { log.error("缓存队列批量消费异常:{}", e.getMessage()); diff --git a/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/schedule/BaseDataSchedule.java b/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/schedule/BaseDataSchedule.java index b98c0a9c..13ee0fd5 100644 --- a/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/schedule/BaseDataSchedule.java +++ b/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/schedule/BaseDataSchedule.java @@ -3,14 +3,17 @@ package org.dromara.data2es.schedule; import cn.hutool.core.date.DateUtil; import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONUtil; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; +import org.dromara.data2es.config.RuansiConfiguration; import org.dromara.data2es.domain.DSQinwuEntity; import org.dromara.data2es.domain.vo.DSResponse; import org.dromara.data2es.service.DSQinwuService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.util.CollectionUtils; import java.util.*; @@ -23,28 +26,23 @@ import java.util.*; */ @Configuration @Slf4j +@RequiredArgsConstructor public class BaseDataSchedule { private String lastUpdateTime; - private String preUrl = "http://53.238.84.10:28080/ds-portal-web"; +// private String preUrl = "http://53.238.84.10:28080/ds-portal-web"; @Autowired DSQinwuService dsQinwuService; - @Value("${ruansi.ruansi-kafka.send-to-third-enabled}") - private boolean sendToThirdEnabled; + private final RuansiConfiguration ruansiConfiguration; - @Value("${ruansi.ruansi-kafka.start-update-time}") - private String startUpdateTime; - - @Value("${ruansi.ruansi-kafka.ds-preurl}") - private String dsPreurl; /** * 娱特单位抽取 */ -// @Scheduled(cron = "0/30 * * * * ?") + @Scheduled(cron = "0/30 * * * * ?") public void updateDsQw(){ if(StringUtils.isBlank(lastUpdateTime)){ DSQinwuEntity qinwu = dsQinwuService.lastOne(); @@ -152,7 +150,7 @@ public class BaseDataSchedule { private DSResponse requestList(String updateTime, String suffixUrl) { Map map = new HashMap<>(); map.put("updateTime",updateTime); - String content = HttpUtil.get(dsPreurl + suffixUrl, map); + String content = HttpUtil.get(ruansiConfiguration.getDsPreurl() + suffixUrl, map); DSResponse dsResponse = JSONUtil.toBean(content, DSResponse.class); return dsResponse; } diff --git a/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/service/impl/DSQinwuServiceImpl.java b/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/service/impl/DSQinwuServiceImpl.java index a5b1aa10..f907b5a7 100644 --- a/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/service/impl/DSQinwuServiceImpl.java +++ b/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/service/impl/DSQinwuServiceImpl.java @@ -30,7 +30,7 @@ public class DSQinwuServiceImpl implements DSQinwuService { public DSQinwuEntity checkExist(DSQinwuEntity dsQinwuEntity) { LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); lqw.eq(DSQinwuEntity::getImei, dsQinwuEntity.getImei()); - lqw.eq(DSQinwuEntity::getType, dsQinwuEntity.getType()); +// lqw.eq(DSQinwuEntity::getType, dsQinwuEntity.getType()); DSQinwuEntity entity = dsQinwuMapper.selectOne(lqw); return entity; } diff --git a/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/service/impl/GpsServiceImpl.java b/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/service/impl/GpsServiceImpl.java index 55993988..ad52e33b 100644 --- a/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/service/impl/GpsServiceImpl.java +++ b/stwzhj-modules/wzhj-data2es/src/main/java/org/dromara/data2es/service/impl/GpsServiceImpl.java @@ -4,9 +4,8 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; +import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import org.apache.commons.lang.StringUtils; import org.apache.dubbo.config.annotation.DubboReference; @@ -176,14 +175,12 @@ public class GpsServiceImpl implements IGpsService { String deviceCode = originEsGpsInfo.getDeviceCode(); String deviceType = originEsGpsInfo.getDeviceType(); // DeviceEntityV2 de = deviceService.checkDeviceExists(info); - Object o = RedisUtils.getBucket(RedisConstants.ONLINE_USERS + deviceType+":" + deviceCode); + JSONObject o = RedisUtils.getBucket(RedisConstants.ONLINE_USERS + deviceType+":" + deviceCode); if (Objects.isNull(o)) { logger.error("redis中的Object=null,deviceType={},deviceCode={}",deviceType,deviceCode); continue; } - JSONObject o1 = (JSONObject) o; - String json = o1.toJSONString(); - EsGpsInfoVO2 esGpsInfoVO2 = JSON.parseObject(json, EsGpsInfoVO2.class); + EsGpsInfoVO2 esGpsInfoVO2 = JSONUtil.toBean(o, EsGpsInfoVO2.class); //更新在线状态和时间,经纬度不变 esGpsInfoVO2.setOnline(originEsGpsInfo.getOnline()); @@ -222,14 +219,13 @@ public class GpsServiceImpl implements IGpsService { String deviceCode = gpsInfoVO2.getDeviceCode(); String deviceType = gpsInfoVO2.getDeviceType(); // DeviceEntityV2 de = deviceService.checkDeviceExists(info); - Object o = RedisUtils.getBucket(RedisConstants.ONLINE_USERS + deviceType + ":" + deviceCode); + JSONObject o = RedisUtils.getBucket(RedisConstants.ONLINE_USERS + deviceType + ":" + deviceCode); if (Objects.isNull(o)) { logger.error("redis中的Object=null,deviceType={},deviceCode={}", deviceType, deviceCode); return null; } - JSONObject o1 = (JSONObject) o; - String json = o1.toJSONString(); - EsGpsInfoVO2 esGpsInfoVO2 = JSON.parseObject(json, EsGpsInfoVO2.class); + + EsGpsInfoVO2 esGpsInfoVO2 = JSONUtil.toBean(o, EsGpsInfoVO2.class); //更新在线状态和时间,经纬度不变 esGpsInfoVO2.setOnline(gpsInfoVO2.getOnline()); @@ -415,7 +411,19 @@ public class GpsServiceImpl implements IGpsService { }*/ deviceEntityV2.setDeviceCode(deviceCode); deviceEntityV2.setDeviceType(deviceType); - RemoteDeviceVo deviceEntityV21 = BeanUtil.toBean(RedisUtils.getBucket("deviceInfo:" + deviceType+":"+deviceCode), RemoteDeviceVo.class) ; + RemoteDeviceVo deviceEntityV21 = new RemoteDeviceVo(); + if ("5".equals(deviceType)){ + deviceEntityV21 = BeanUtil.toBean(RedisUtils.getBucket("deviceInfo:" + deviceType+":"+deviceCode), RemoteDeviceVo.class) ; + if (null == deviceEntityV21){ + deviceEntityV21 = BeanUtil.toBean(RedisUtils.getBucket("deviceInfo:8" +":"+deviceCode), RemoteDeviceVo.class) ; + if (null == deviceEntityV21){ + deviceEntityV21 = BeanUtil.toBean(RedisUtils.getBucket("deviceInfo:7" +":"+deviceCode), RemoteDeviceVo.class) ; + + } + } + }else { + deviceEntityV21 = BeanUtil.toBean(RedisUtils.getBucket("deviceInfo:" + deviceType+":"+deviceCode), RemoteDeviceVo.class) ; + } if(Objects.isNull(deviceEntityV21)){ logger.error("库里没有这个数据,deviceCode={}",deviceCode); return null; @@ -438,11 +446,10 @@ public class GpsServiceImpl implements IGpsService { //如果定位是0的话 ,则上传最后一次有定位的坐标,如果最后一次是0的话,那就上传0 boolean nonLatLng = isNonLatLng(lat, lng); if(nonLatLng){ - Object o = RedisUtils.getBucket(RedisConstants.ONLINE_USERS + deviceType + ":" + deviceCode); + JSONObject o = RedisUtils.getBucket(RedisConstants.ONLINE_USERS + deviceType + ":" + deviceCode); if(!Objects.isNull(o)) { - com.alibaba.fastjson.JSONObject o1 = (JSONObject) o; - String json = o1.toJSONString(); - EsGpsInfoVO2 esGpsInfoVO3 = JSON.parseObject(json, EsGpsInfoVO2.class); + + EsGpsInfoVO2 esGpsInfoVO3 = JSONUtil.toBean(o, EsGpsInfoVO2.class); String lat1 = esGpsInfoVO3.getLat(); String lng1 = esGpsInfoVO3.getLng(); esGpsInfoVO2.setLat(lat1); diff --git a/stwzhj-modules/wzhj-extract/src/main/java/org/dromara/extract/controller/DeviceGPSController.java b/stwzhj-modules/wzhj-extract/src/main/java/org/dromara/extract/controller/DeviceGPSController.java index a75c75b2..d247dc29 100644 --- a/stwzhj-modules/wzhj-extract/src/main/java/org/dromara/extract/controller/DeviceGPSController.java +++ b/stwzhj-modules/wzhj-extract/src/main/java/org/dromara/extract/controller/DeviceGPSController.java @@ -39,10 +39,6 @@ public class DeviceGPSController { @DubboReference RemoteDataToEsService dataToEsService; - @Value("${ruansi.start_update_time}") - private String startUpdateTime; - - private String jlyUpdateTime; @Value("${ruansi.last_update_time}") private String lastUpdateTime; @@ -60,22 +56,17 @@ public class DeviceGPSController { return DateUtil.formatDateTime(info.getGpsTime()); } - @Scheduled(cron = "0/10 * * * * ?") - @Async + @Scheduled(cron = "0/30 * * * * ?") public void bdgcGps(){ - if(StringUtils.isBlank(lastUpdateTime)){ - try { - lastUpdateTime = getLastUpdateTimeFromProperties(); - }catch (Exception e){ - logger.info("lastUpdateTime={},lastUpdateTimeError={}",lastUpdateTime,e.getMessage()); - } - } + // Date date = DateUtil.parseDateTime(lastUpdateTime); EsGpsInfo gpsInfo = new EsGpsInfo(); gpsInfo.setGpsTime(DateUtil.parseDateTime(lastUpdateTime)); Instant start = Instant.now(); // some code + logger.info("进入公车定时任务"); List list = deviceGpsService.selectBDGCGPS(gpsInfo); + logger.info("查询结束"); Instant finish = Instant.now(); long timeElapsed = Duration.between(start, finish).toMillis(); logger.info("公车查询耗时:"+timeElapsed); @@ -106,59 +97,6 @@ public class DeviceGPSController { } - @Scheduled(cron = "0/8 * * * * ?") - @Async - public void jlyGps(){ - if(StringUtils.isBlank(jlyUpdateTime)){ - jlyUpdateTime = startUpdateTime; - } - EsGpsInfo gpsInfo = new EsGpsInfo(); - gpsInfo.setGpsTime(DateUtil.parse(jlyUpdateTime)); - logger.info("更新时间:"+jlyUpdateTime); - Instant start = Instant.now(); - List list = deviceGpsService.selectJlyGPS(gpsInfo); - Instant finish = Instant.now(); - long timeElapsed = Duration.between(start, finish).toMillis(); - logger.info("查询耗时:"+timeElapsed); - logger.info("数据大小size"+list.size()); - for (int i = 0; i < list.size(); i++) { - EsGpsInfo info = list.get(i); - if(i == 0){ - jlyUpdateTime = DateUtil.format(info.getGpsTime(),"yyyy-MM-dd HH:mm:ss") ; - } - if (DateUtil.between(new Date(),info.getGpsTime(),DateUnit.MINUTE) > 5){ - info.setOnline("0"); - }else { - info.setOnline("1"); - } - } - ArrayList collect = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> - new TreeSet<>(Comparator.comparing(EsGpsInfo::getDeviceCode))), ArrayList::new)); - dataToEsService.saveDataBatch(BeanUtil.copyToList(collect,RemoteGpsInfo.class)); - Instant end = Instant.now(); - long timeEnd = Duration.between(finish, end).toMillis(); - logger.info("方法执行逻辑耗时:"+timeEnd); - - } - - @Scheduled(cron = "0/30 * * * * ?") - public void jlyGpsStatus(){ - if(StringUtils.isBlank(jlyUpdateTime)){ - jlyUpdateTime = startUpdateTime; - } - EsGpsInfo gpsInfo = new EsGpsInfo(); - gpsInfo.setGpsTime(DateUtil.parse(jlyUpdateTime)); - List list = deviceGpsService.selectJlyStatus(gpsInfo); - for (int i = 0; i < list.size(); i++) { - EsGpsInfo info = list.get(i); - if(i == 0){ - jlyUpdateTime = DateUtil.format(info.getGpsTime(),"yyyy-MM-dd HH:mm:ss") ; - } - info.setGpsTime(null); - } - dataToEsService.updateOnlineStatusBatch(BeanUtil.copyToList(list,RemoteGpsInfo.class)); - - } private void resetUpdateTime(String lastUpdateTime) { diff --git a/stwzhj-modules/wzhj-extract/src/main/java/org/dromara/extract/schedule/JJDeviceSchedule.java b/stwzhj-modules/wzhj-extract/src/main/java/org/dromara/extract/schedule/JJDeviceSchedule.java deleted file mode 100644 index 08913859..00000000 --- a/stwzhj-modules/wzhj-extract/src/main/java/org/dromara/extract/schedule/JJDeviceSchedule.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.dromara.extract.schedule; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.date.DateUtil; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; -import org.apache.dubbo.config.annotation.DubboReference; -import org.dromara.extract.domain.Device; -import org.dromara.extract.service.IDeviceService; -import org.dromara.system.api.RemoteDeviceService; -import org.dromara.system.api.domain.bo.RemoteDeviceBo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.annotation.Scheduled; - -import java.util.List; - -@Configuration -@Slf4j -/* -* 交警记录仪基础信息定时抽取 -* */ -public class JJDeviceSchedule { - - @Autowired - IDeviceService deviceService; - - @DubboReference - RemoteDeviceService remoteDeviceService; - - @Value("${ruansi.start_jlyupdate_time}") - private String startUpdateTime; - - private String lastUpdateTime = ""; - - - @Scheduled(cron = "0 0/10 * * * ?") - public void saveORUpdateJly(){ - if(StringUtils.isBlank(lastUpdateTime)){ - lastUpdateTime = startUpdateTime; - } - Device device = new Device(); - device.setUpdateTime(DateUtil.parse(lastUpdateTime)); - List list = deviceService.selectJly(device); - remoteDeviceService.batchSaveDevice(BeanUtil.copyToList(list, RemoteDeviceBo.class)); - if (list.size() != 0){ - lastUpdateTime = DateUtil.format(list.get(0).getUpdateTime(),"yyyy-MM-dd HH:mm:ss") ; - } - } - -} diff --git a/stwzhj-modules/wzhj-extract/src/main/resources/mapper/DeviceGpsMapper.xml b/stwzhj-modules/wzhj-extract/src/main/resources/mapper/DeviceGpsMapper.xml index f65ecaa5..62b83555 100644 --- a/stwzhj-modules/wzhj-extract/src/main/resources/mapper/DeviceGpsMapper.xml +++ b/stwzhj-modules/wzhj-extract/src/main/resources/mapper/DeviceGpsMapper.xml @@ -36,11 +36,13 @@