From dcf9829a1df7955dc1a8937d7ce658c20aabc8ed Mon Sep 17 00:00:00 2001 From: hanrenchun Date: Wed, 21 Feb 2024 10:38:44 +0800 Subject: [PATCH] =?UTF-8?q?task=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/DevopsVideoInfoController.java | 20 ++++++ .../domain/MetaImpUserModelInfo.java | 2 +- .../domain/TransitImpUserRecord.java | 2 +- .../domain/vo/DevopsVideoInfoVo.java | 3 +- .../service/DevopsVideoInfoService0.java | 1 + .../impl/DevopsVideoInfoServiceImpl.java | 63 +++++++++++++++++++ .../task/DevopeDeviceTask.java | 10 ++- .../task/DevopsVideoInfoTask.java | 63 ++++++++++++++++++- .../ssf/mysqloracletest/task/JcjCjxxTask.java | 26 ++++---- .../ssf/mysqloracletest/task/JcjJjxxTask.java | 24 +++---- .../task/MetaHandleAlarmTask.java | 16 ++--- .../task/MetaImpUserModelInfoTask.java | 17 ++--- .../task/SlryYjxxOracleTask.java | 11 ++-- .../task/TMotorvehicleTask.java | 5 +- .../task/TStrhEntityInfoKsTask.java | 9 ++- .../mysqloracletest/task/VLgryGjxxTask.java | 4 +- .../mysqloracletest/task/VSwryGjxxTask.java | 4 +- .../mysqloracletest/utils/ConfigParam.java | 8 +++ 18 files changed, 227 insertions(+), 61 deletions(-) diff --git a/src/main/java/com/ssf/mysqloracletest/Controller/DevopsVideoInfoController.java b/src/main/java/com/ssf/mysqloracletest/Controller/DevopsVideoInfoController.java index d7b8a93..986c6ab 100644 --- a/src/main/java/com/ssf/mysqloracletest/Controller/DevopsVideoInfoController.java +++ b/src/main/java/com/ssf/mysqloracletest/Controller/DevopsVideoInfoController.java @@ -77,4 +77,24 @@ public class DevopsVideoInfoController { } } + @Scheduled(initialDelay = 100, fixedDelay = 3000) + public void drjc(){ + + if (!"true".equals(ConfigParam.JCVideoInfoSwitch)) { + return; + } + DevopsVideoInfoDto villageDeviceInfo = new DevopsVideoInfoDto(); + String res = "error"; + try { + res = devopsVideoInfoService.drjc(villageDeviceInfo); + if (res.contains("success")) { + logger.info("导入成功"); + } else { + logger.info("导入失败"); + } + } catch (Exception e) { + logger.error(StringKit.getTrace(e) + "导入出现错误"); + } + } + } diff --git a/src/main/java/com/ssf/mysqloracletest/domain/MetaImpUserModelInfo.java b/src/main/java/com/ssf/mysqloracletest/domain/MetaImpUserModelInfo.java index 164f01a..b229446 100644 --- a/src/main/java/com/ssf/mysqloracletest/domain/MetaImpUserModelInfo.java +++ b/src/main/java/com/ssf/mysqloracletest/domain/MetaImpUserModelInfo.java @@ -27,7 +27,7 @@ public class MetaImpUserModelInfo implements Serializable { /** * ??̬??Ϣ??? */ - private Integer dataType; + private String dataType; /** * ?ص???С? diff --git a/src/main/java/com/ssf/mysqloracletest/domain/TransitImpUserRecord.java b/src/main/java/com/ssf/mysqloracletest/domain/TransitImpUserRecord.java index 6e01b22..b537ece 100644 --- a/src/main/java/com/ssf/mysqloracletest/domain/TransitImpUserRecord.java +++ b/src/main/java/com/ssf/mysqloracletest/domain/TransitImpUserRecord.java @@ -55,7 +55,7 @@ public class TransitImpUserRecord implements Serializable { /** * 人脸图 */ - private String userPic; + private String personPic; /** * 相似度 diff --git a/src/main/java/com/ssf/mysqloracletest/domain/vo/DevopsVideoInfoVo.java b/src/main/java/com/ssf/mysqloracletest/domain/vo/DevopsVideoInfoVo.java index 8686395..a541e28 100644 --- a/src/main/java/com/ssf/mysqloracletest/domain/vo/DevopsVideoInfoVo.java +++ b/src/main/java/com/ssf/mysqloracletest/domain/vo/DevopsVideoInfoVo.java @@ -1,7 +1,8 @@ package com.ssf.mysqloracletest.domain.vo; -import com.ssf.mysqloracletest.core.model.BaseEntity; + +import com.ssf.mysqloracletest.domain.BaseEntity; import lombok.Data; /** diff --git a/src/main/java/com/ssf/mysqloracletest/service/DevopsVideoInfoService0.java b/src/main/java/com/ssf/mysqloracletest/service/DevopsVideoInfoService0.java index 8e4aac0..f62b438 100644 --- a/src/main/java/com/ssf/mysqloracletest/service/DevopsVideoInfoService0.java +++ b/src/main/java/com/ssf/mysqloracletest/service/DevopsVideoInfoService0.java @@ -38,4 +38,5 @@ public interface DevopsVideoInfoService0 extends IService { public List listPoliceVehicle(DevopsVideoInfo0 bean); public String drzfjly(DevopsVideoInfoDto bean); + public String drjc(DevopsVideoInfoDto bean); } diff --git a/src/main/java/com/ssf/mysqloracletest/service/impl/DevopsVideoInfoServiceImpl.java b/src/main/java/com/ssf/mysqloracletest/service/impl/DevopsVideoInfoServiceImpl.java index aa86556..98aa43e 100644 --- a/src/main/java/com/ssf/mysqloracletest/service/impl/DevopsVideoInfoServiceImpl.java +++ b/src/main/java/com/ssf/mysqloracletest/service/impl/DevopsVideoInfoServiceImpl.java @@ -315,4 +315,67 @@ public class DevopsVideoInfoServiceImpl extends ServiceImpl list = videoStatusService.lambdaQuery().like(DevopsVideoStatus::getDeviceName, "苏J").list(); + logger.info("警车:"+list.size()); + for (DevopsVideoStatus devopsVideoStatus : list){ + String channellistUrl = "http://" + gbsip + ":" + gbsport + "/api/v1/stream/start?token=" + urlToken + "&serial=32092400002005063063&code="+devopsVideoStatus.getGbsChannelNo(); + logger.info("channellistUrl:"+ channellistUrl); + String channellistRes = JsoupUtils.getJsoupDocGet(channellistUrl); + if ("".equals(StringKit.toString(channellistRes)) || (StringKit.toString(channellistRes)).contains("error")) { + logger.info("视频流读取失败"); + devopsVideoStatus.setIsOnline(2); + QueryWrapper devopsVideoStatusQueryWrapper = new QueryWrapper<>(); + devopsVideoStatusQueryWrapper.eq("gbs_channel_no",StringKit.toString(devopsVideoStatus.getGbsChannelNo())); + videoStatusService.update(devopsVideoStatus,devopsVideoStatusQueryWrapper); + logger.info("修改成功:" + devopsVideoStatus.getGbsChannelNo()); + continue; + } + logger.info("视频流读取成功" + devopsVideoStatus.getGbsChannelNo()); + if (channellistRes != null && channellistRes.contains("ChannelName")) { + String channelUrl = "http://" + gbsip + ":" + gbsport + "/api/v1/stream/stop?token=" + urlToken + "&serial=32092400002005063063&code="+devopsVideoStatus.getGbsChannelNo(); + logger.info("channelUrl:"+ channelUrl); + String channelRes = JsoupUtils.getJsoupDocGet(channellistUrl); + if ("OK".equals(channelRes)){ + logger.info("视频流关闭"); + } + devopsVideoStatus.setIsOnline(1); + QueryWrapper devopsVideoStatusQueryWrapper = new QueryWrapper<>(); + devopsVideoStatusQueryWrapper.eq("gbs_channel_no",StringKit.toString(devopsVideoStatus.getGbsChannelNo())); + videoStatusService.update(devopsVideoStatus,devopsVideoStatusQueryWrapper); + logger.info("修改成功:" + devopsVideoStatus.getGbsChannelNo()); + } else { + return "结果集为空,请检查gbs是否配置。"; + } + } + return "success-" + count; + } else { + return "error-类型不正确"; + } + } } diff --git a/src/main/java/com/ssf/mysqloracletest/task/DevopeDeviceTask.java b/src/main/java/com/ssf/mysqloracletest/task/DevopeDeviceTask.java index 2975db0..ab5b606 100644 --- a/src/main/java/com/ssf/mysqloracletest/task/DevopeDeviceTask.java +++ b/src/main/java/com/ssf/mysqloracletest/task/DevopeDeviceTask.java @@ -25,7 +25,7 @@ import java.util.concurrent.Executors; @Component public class DevopeDeviceTask { - private static final Logger logger = LoggerFactory.getLogger(RentalHousingTask.class); + private static final Logger logger = LoggerFactory.getLogger(DevopeDeviceTask.class); @Resource private TJksbglMysqlService jksbglMysqlService; @Resource @@ -102,8 +102,12 @@ public class DevopeDeviceTask { } deviceStatus.setHeartbeatTime(System.currentTimeMillis()/1000); deviceInfo.setDeviceAddress(jksbglMysqlCp.getAzdz()); - boolean a = devopsDeviceInfoService.save(deviceInfo); - boolean b = deviceStatusService.save(deviceStatus); + boolean a = devopsDeviceInfoService.lambdaUpdate() + .eq(DevopsDeviceInfo::getGbsChannelNo, deviceInfo.getGbsChannelNo()) + .update(deviceInfo); + boolean b = deviceStatusService.lambdaUpdate() + .eq(DevopsDeviceStatus::getGbsChannelNo, deviceInfo.getGbsChannelNo()) + .update(deviceStatus); if (a && b) { jksbglMysqlCp.setStatus("1"); diff --git a/src/main/java/com/ssf/mysqloracletest/task/DevopsVideoInfoTask.java b/src/main/java/com/ssf/mysqloracletest/task/DevopsVideoInfoTask.java index be9192e..38c347e 100644 --- a/src/main/java/com/ssf/mysqloracletest/task/DevopsVideoInfoTask.java +++ b/src/main/java/com/ssf/mysqloracletest/task/DevopsVideoInfoTask.java @@ -1,6 +1,8 @@ package com.ssf.mysqloracletest.task; +import com.ssf.mysqloracletest.domain.DevopsDeviceInfo; import com.ssf.mysqloracletest.domain.DevopsVideoInfo0; +import com.ssf.mysqloracletest.service.DevopsDeviceInfoService; import com.ssf.mysqloracletest.service.DevopsVideoInfoService0; import com.ssf.mysqloracletest.utils.ConfigParam; import lombok.RequiredArgsConstructor; @@ -9,6 +11,7 @@ import org.slf4j.LoggerFactory; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; +import java.math.BigDecimal; import java.util.List; @Component @@ -17,12 +20,13 @@ public class DevopsVideoInfoTask { private static final Logger logger = LoggerFactory.getLogger(DevopsVideoInfoTask.class); private final DevopsVideoInfoService0 videoInfoService0; + private final DevopsDeviceInfoService devopsDeviceInfoService; //偏移量 Double offset = 0.0001; //查找用偏移量 - Double offset1 = 0.00005; + Double offset1 = 0.00002; //视频设备经纬度偏移 @Scheduled(initialDelay = 100, fixedDelay = 3000) @@ -66,4 +70,61 @@ public class DevopsVideoInfoTask { } } } + + @Scheduled(initialDelay = 100, fixedDelay = 3000) + public void devicePosition(){ + + if (!"true".equals(ConfigParam.devicePositionSwitch)) { + return; + } + + //找出经纬度正常的设备 + List list = devopsDeviceInfoService.lambdaQuery() + .ne(DevopsDeviceInfo::getLongitude,0.000000) + .ne(DevopsDeviceInfo::getLatitude,0.000000) + .list(); + for (DevopsDeviceInfo devopsDeviceInfo : list){ + Double latitude = devopsDeviceInfo.getLatitude().doubleValue(); + Double longitude = devopsDeviceInfo.getLongitude().doubleValue(); + //根据一个设备的经纬度,找出该设备偏移范围内的所有设备 + List devopsDeviceInfos = devopsDeviceInfoService.lambdaQuery() + .ne(DevopsDeviceInfo::getGbsChannelNo,devopsDeviceInfo.getGbsChannelNo()) + .between(DevopsDeviceInfo::getLatitude, latitude - offset1, latitude + offset1) + .between(DevopsDeviceInfo::getLongitude, longitude - offset1, longitude + offset1) + .list(); + if (!devopsDeviceInfos.isEmpty()) { + double angleOffset = 360.0 / devopsDeviceInfos.size(); + if (devopsDeviceInfos.size() == 1){ + for (DevopsDeviceInfo deviceInfo:devopsDeviceInfos){ + double newLatitude = deviceInfo.getLatitude().doubleValue() + offset; + double newLongitude = deviceInfo.getLongitude().doubleValue() + offset; + deviceInfo.setLatitude(BigDecimal.valueOf(newLatitude)); + deviceInfo.setLongitude(BigDecimal.valueOf(newLongitude)); + boolean update = devopsDeviceInfoService.lambdaUpdate() + .eq(DevopsDeviceInfo::getGbsChannelNo, deviceInfo.getGbsChannelNo()) + .update(deviceInfo); + if (update){ + logger.info("修改成功"); + } + } + continue; + } + for (int i = 0; i < devopsDeviceInfos.size(); i++) { + double angle = i * angleOffset; + DevopsDeviceInfo deviceInfo = devopsDeviceInfos.get(i); + // 将极坐标转换为直角坐标 + double newLatitude = deviceInfo.getLatitude().doubleValue() + (offset * Math.cos(Math.toRadians(angle))); + double newLongitude = deviceInfo.getLongitude().doubleValue() + (offset * Math.sin(Math.toRadians(angle))); + deviceInfo.setLatitude(BigDecimal.valueOf(newLatitude)); + deviceInfo.setLongitude(BigDecimal.valueOf(newLongitude)); + boolean update = devopsDeviceInfoService.lambdaUpdate() + .eq(DevopsDeviceInfo::getGbsChannelNo, deviceInfo.getGbsChannelNo()) + .update(deviceInfo); + if (update){ + logger.info("修改成功"); + } + } + } + } + } } diff --git a/src/main/java/com/ssf/mysqloracletest/task/JcjCjxxTask.java b/src/main/java/com/ssf/mysqloracletest/task/JcjCjxxTask.java index 53c06de..189f76a 100644 --- a/src/main/java/com/ssf/mysqloracletest/task/JcjCjxxTask.java +++ b/src/main/java/com/ssf/mysqloracletest/task/JcjCjxxTask.java @@ -67,14 +67,14 @@ public class JcjCjxxTask { cjxxTag = true; int count = countcjxx / oncesCounts; - CountDownLatch latch = new CountDownLatch(count); - ExecutorService cjxxPool = Executors.newFixedThreadPool(50); +// CountDownLatch latch = new CountDownLatch(count); +// ExecutorService cjxxPool = Executors.newFixedThreadPool(50); for (int i = 0; i <= count; i++) { Map cjxxMap = new HashMap(); cjxxMap.put("rowStart", i * oncesCounts); cjxxMap.put("rowEnd", (i + 1) * oncesCounts); - cjxxPool.submit(() -> { +// cjxxPool.submit(() -> { try { List cjxxs = cjxxOracleService.getCjxxList(cjxxMap); for (JcjCjxxViewOracle cjxx : cjxxs) { @@ -110,19 +110,19 @@ public class JcjCjxxTask { } catch (Exception e) { logger.info("cjxxs:" + e.getMessage()); } - latch.countDown(); - }); +// latch.countDown(); +// }); logger.info("cjxxMap数据总量:" + countcjxx + "," + "当前处理下标:" + cjxxMap.get("rowStart") + "/" + cjxxMap.get("rowEnd")); } - - try { - // Wait for all threads to complete - latch.await(); - } catch (InterruptedException e) { - e.printStackTrace(); - } +// +// try { +// // Wait for all threads to complete +// latch.await(); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } // 关闭线程池 - cjxxPool.shutdown(); +// cjxxPool.shutdown(); } } catch (Exception e) { diff --git a/src/main/java/com/ssf/mysqloracletest/task/JcjJjxxTask.java b/src/main/java/com/ssf/mysqloracletest/task/JcjJjxxTask.java index 52a5061..909c1e9 100644 --- a/src/main/java/com/ssf/mysqloracletest/task/JcjJjxxTask.java +++ b/src/main/java/com/ssf/mysqloracletest/task/JcjJjxxTask.java @@ -64,14 +64,14 @@ public class JcjJjxxTask { JjxxTag = true; int count = countJjxx / oncesCounts; - CountDownLatch latch = new CountDownLatch(count); - ExecutorService JjxxPool = Executors.newFixedThreadPool(50); +// CountDownLatch latch = new CountDownLatch(count); +// ExecutorService JjxxPool = Executors.newFixedThreadPool(50); for (int i = 0; i <= count; i++) { Map JjxxMap = new HashMap(); JjxxMap.put("rowStart", i * oncesCounts); JjxxMap.put("rowEnd", (i + 1) * oncesCounts); - JjxxPool.submit(() -> { +// JjxxPool.submit(() -> { try { List Jjxxs = jcjJjxxViewOracleService.getJjxxList(JjxxMap); for (JcjJjxxViewOracle Jjxx : Jjxxs) { @@ -90,19 +90,19 @@ public class JcjJjxxTask { } catch (Exception e) { logger.info("Jjxxs:" + StringKit.getTrace(e)); } - latch.countDown(); - }); +// latch.countDown(); +// }); logger.info("JjxxMap数据总量:" + countJjxx + "," + "当前处理下标:" + JjxxMap.get("rowStart") + "/" + JjxxMap.get("rowEnd")); } - try { - // Wait for all threads to complete - latch.await(); - } catch (InterruptedException e) { - e.printStackTrace(); - } +// try { +// // Wait for all threads to complete +// latch.await(); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } // 关闭线程池 - JjxxPool.shutdown(); +// JjxxPool.shutdown(); } } catch (Exception e) { diff --git a/src/main/java/com/ssf/mysqloracletest/task/MetaHandleAlarmTask.java b/src/main/java/com/ssf/mysqloracletest/task/MetaHandleAlarmTask.java index 850f8ec..ea5d19a 100644 --- a/src/main/java/com/ssf/mysqloracletest/task/MetaHandleAlarmTask.java +++ b/src/main/java/com/ssf/mysqloracletest/task/MetaHandleAlarmTask.java @@ -48,23 +48,23 @@ public class MetaHandleAlarmTask { queryWrapper.isNull("status"); Page page = new Page<>(1, 1000); List resultList = jcjCjxxViewMysqlService.page(page, queryWrapper).getRecords(); - CountDownLatch latch = new CountDownLatch(resultList.size()); +// CountDownLatch latch = new CountDownLatch(resultList.size()); // ExecutorService cjxxPool = Executors.newFixedThreadPool(5); for (JcjCjxxViewMysql bean : resultList) { // cjxxPool.submit(() -> { cleanCjxx(bean); - latch.countDown(); +// latch.countDown(); // }); } - try { - // Wait for all threads to complete - latch.await(); - } catch (InterruptedException e) { - e.printStackTrace(); - } +// try { +// // Wait for all threads to complete +// latch.await(); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } // 关闭线程池 // cjxxPool.shutdown(); diff --git a/src/main/java/com/ssf/mysqloracletest/task/MetaImpUserModelInfoTask.java b/src/main/java/com/ssf/mysqloracletest/task/MetaImpUserModelInfoTask.java index 0a79525..49c4d4c 100644 --- a/src/main/java/com/ssf/mysqloracletest/task/MetaImpUserModelInfoTask.java +++ b/src/main/java/com/ssf/mysqloracletest/task/MetaImpUserModelInfoTask.java @@ -36,13 +36,12 @@ public class MetaImpUserModelInfoTask { // final int oncesCounts = NumKit.checkInt(ConfigParam.oncesCounts) == 0 ? 1000 : NumKit.checkInt(ConfigParam.oncesCounts); - @Scheduled(initialDelay = 100, fixedDelay = 3000) public void transswzdry() { if (!"true".equals(ConfigParam.SwzdrySwitch)) { return; } - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); LocalDateTime now = LocalDateTime.now(); String format = now.format(formatter); @@ -51,18 +50,22 @@ public class MetaImpUserModelInfoTask { try { QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.between("HDFSSJ", format1, format); + wrapper.between("YJFBSJ", format1, format); List list = swzdryViewService.list(wrapper); for (SwzdryView Info : list) { MetaImpUserModelInfo modelInfo = new MetaImpUserModelInfo(); modelInfo.setWarning_id(Info.getZDRYYJXXID()); - modelInfo.setDataType(Integer.parseInt(Info.getDTXXLB())); + modelInfo.setDataType(Info.getDTXXLB()); modelInfo.setImpUserSubType(Info.getZDRYXL()); modelInfo.setImpUserName(Info.getZDRYXM()); modelInfo.setImpUserIdCard(Info.getZDRYSFZH()); modelInfo.setLongitude(Info.getHDFSDJDZB()); modelInfo.setLatitude(Info.getHDFSDWDZB()); - modelInfo.setActivityTime(Info.getHDFSSJ()); + String hdfssj = Info.getHDFSSJ(); + String yjfbsjString = Info.getYJFBSJ(); + LocalDateTime hdfssjTime = LocalDateTime.parse(hdfssj, formatter); + LocalDateTime yjfbsjTime = LocalDateTime.parse(yjfbsjString, formatter); + modelInfo.setActivityTime(hdfssjTime.format(outputFormatter)); modelInfo.setActivityDeviceAddress(Info.getHDFSCSDM()); modelInfo.setActivityDeviceCode(Info.getHDFSCSDM()); modelInfo.setActivityPoliceStationCode(Info.getHDFSDSSGAJGDM()); @@ -74,9 +77,7 @@ public class MetaImpUserModelInfoTask { modelInfo.setDisposalStatus(Integer.parseInt(Info.getFKZT()));// 反馈状态 0:未反馈 1:已反馈 modelInfo.setSignPoliceStation(Info.getYJJSDWMC()); modelInfo.setSignPoliceCode(Info.getYJJSDW()); - String yjfbsjString = Info.getYJFBSJ(); - Date yjfbsjDate = dateFormat.parse(yjfbsjString); - modelInfo.setWarningTime(StringKit.toString(yjfbsjDate)); + modelInfo.setWarningTime(yjfbsjTime.format(outputFormatter)); modelInfo.setIsImpAddress(Info.getSFZDDW()); modelInfo.setKey1(Info.getKEY1()); modelInfo.setKey2(Info.getKEY2()); diff --git a/src/main/java/com/ssf/mysqloracletest/task/SlryYjxxOracleTask.java b/src/main/java/com/ssf/mysqloracletest/task/SlryYjxxOracleTask.java index 77d8a25..c949ec0 100644 --- a/src/main/java/com/ssf/mysqloracletest/task/SlryYjxxOracleTask.java +++ b/src/main/java/com/ssf/mysqloracletest/task/SlryYjxxOracleTask.java @@ -48,10 +48,10 @@ public class SlryYjxxOracleTask { return; } - + int countSlry = tSlryRyjbxxYjxxOracleService.countSlry(); Map slryMap = new HashMap(); slryMap.put("rowStart", 1); - slryMap.put("rowEnd", 100); + slryMap.put("rowEnd", countSlry); try { List slryList = tSlryRyjbxxYjxxOracleService.getSlryList(slryMap); for (TSlryRyjbxxYjxx slry : slryList) { @@ -74,7 +74,7 @@ public class SlryYjxxOracleTask { transitHuntersUserModelRecord.setFirstPassTime(String.valueOf(dateFormat.parse(slry.getVALUE1()).getTime()/1000)); transitHuntersUserModelRecord.setFirstDeviceCode(slry.getVALUE3()); transitHuntersUserModelRecord.setFirstDeviceAddress(slry.getVALUE2()); - DevopsDeviceInfo one = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getGbsChannelNo, slry.getVALUE3()).one(); + DevopsDeviceInfo one = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getGbsChannelNo, slry.getVALUE3()).list().get(0); transitHuntersUserModelRecord.setFirstLongitude(one.getLongitude()); transitHuntersUserModelRecord.setFirstLatitude(one.getLatitude()); transitHuntersUserModelRecord.setEndGlobalPic(slry.getVALUE10()); @@ -82,7 +82,7 @@ public class SlryYjxxOracleTask { transitHuntersUserModelRecord.setEndPassTime(String.valueOf(dateFormat.parse(slry.getVALUE6()).getTime()/1000)); transitHuntersUserModelRecord.setEndDeviceCode(slry.getVALUE8()); transitHuntersUserModelRecord.setEndDeviceAddress(slry.getVALUE7()); - DevopsDeviceInfo one1 = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getGbsChannelNo, slry.getVALUE8()).one(); + DevopsDeviceInfo one1 = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getGbsChannelNo, slry.getVALUE8()).list().get(0); transitHuntersUserModelRecord.setEndLatitude(one1.getLatitude()); transitHuntersUserModelRecord.setEndLongitude(one1.getLongitude()); transitHuntersUserModelRecord.setCaptureFrequency(NumKit.checkInt(slry.getVALUE11())); @@ -91,7 +91,8 @@ public class SlryYjxxOracleTask { transitHuntersUserModelRecord.setHabitationPoliceStationCode(slry.getXZDZRQDM()); transitHuntersUserModelRecord.setHabitationPoliceStationName(slry.getXZDZRQ()); transitHuntersUserModelRecord.setPartitionField(dateFormat.parse(slry.getYJSJ())); - TransitHuntersUserModelRecord modelRecord = transitHuntersUserModelRecordService.lambdaQuery().eq(TransitHuntersUserModelRecord::getFirstGlobalPic, slry.getVALUE5()).one(); + TransitHuntersUserModelRecord modelRecord = transitHuntersUserModelRecordService.lambdaQuery().eq(TransitHuntersUserModelRecord::getFirstGlobalPic, slry.getVALUE5()) + .eq(TransitHuntersUserModelRecord::getPartitionField,dateFormat.parse(slry.getYJSJ())).one(); //确定一个数据是否唯一 if (modelRecord == null) { boolean save = transitHuntersUserModelRecordService.save(transitHuntersUserModelRecord); diff --git a/src/main/java/com/ssf/mysqloracletest/task/TMotorvehicleTask.java b/src/main/java/com/ssf/mysqloracletest/task/TMotorvehicleTask.java index 4fba1be..ad4a7e8 100644 --- a/src/main/java/com/ssf/mysqloracletest/task/TMotorvehicleTask.java +++ b/src/main/java/com/ssf/mysqloracletest/task/TMotorvehicleTask.java @@ -121,7 +121,6 @@ public class TMotorvehicleTask { } try { - dateFormat.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai")); LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); queryWrapper.orderByDesc(TransitVehicleRecord::getPartitionField); queryWrapper.last("LIMIT 1"); @@ -133,14 +132,14 @@ public class TMotorvehicleTask { //计算2天前的日期 Calendar calendar = Calendar.getInstance(); calendar.setTime(maxDate); - calendar.add(Calendar.DAY_OF_MONTH, -2); + calendar.add(Calendar.DAY_OF_MONTH, -7); Date twoDaysAgo = calendar.getTime(); //构造删除条件 LambdaQueryWrapper deleteWrapper = Wrappers.lambdaQuery(); deleteWrapper.le(TransitVehicleRecord::getPartitionField, twoDaysAgo); //int countTM = vehicleRecordervice.count(deleteWrapper); - boolean result = vehicleRecordService.remove(deleteWrapper.last("LIMIT 10000")); + boolean result = vehicleRecordService.remove(deleteWrapper.last("LIMIT 1000")); if (result) { System.out.println("删除成功! "); diff --git a/src/main/java/com/ssf/mysqloracletest/task/TStrhEntityInfoKsTask.java b/src/main/java/com/ssf/mysqloracletest/task/TStrhEntityInfoKsTask.java index c0da937..b7bcaa7 100644 --- a/src/main/java/com/ssf/mysqloracletest/task/TStrhEntityInfoKsTask.java +++ b/src/main/java/com/ssf/mysqloracletest/task/TStrhEntityInfoKsTask.java @@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ssf.mysqloracletest.domain.DevopsDeviceInfo; import com.ssf.mysqloracletest.domain.TStrhEntityInfoKs; import com.ssf.mysqloracletest.domain.TransitUserRecord; +import com.ssf.mysqloracletest.service.DevopsDeviceInfoService; import com.ssf.mysqloracletest.service.TStrhEntityInfoKsService; import com.ssf.mysqloracletest.service.TransitUserRecordService; import com.ssf.mysqloracletest.utils.ConfigParam; @@ -36,6 +38,9 @@ public class TStrhEntityInfoKsTask { @Resource private TransitUserRecordService transitUserRecordService; + @Resource + private DevopsDeviceInfoService devopsDeviceInfoService; + String maxTime = "2023-12-09 00:00:00"; SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -79,6 +84,8 @@ public class TStrhEntityInfoKsTask { List resultList = tStrhEntityInfoKsService.list(Wrapper); for (TStrhEntityInfoKs entityInfoKs : resultList) { TransitUserRecord transitUserRecord = new TransitUserRecord(); + DevopsDeviceInfo one2 = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getGbsChannelNo, entityInfoKs.getCameraidx()).list().get(0); + transitUserRecord.setDeviceName(one2.getDeviceName()); transitUserRecord.setDeviceCode(entityInfoKs.getCameraidx()); transitUserRecord.setPassTime(dateFormat.parse(entityInfoKs.getCapturetime()).getTime() / 1000); transitUserRecord.setPartitionField(dateFormat.parse(entityInfoKs.getCapturetime())); @@ -143,7 +150,7 @@ public class TStrhEntityInfoKsTask { deleteWrapper.le(TransitUserRecord::getPartitionField, sevenDaysAgo); // 执行删除操作 - boolean result = transitUserRecordService.remove(deleteWrapper); + boolean result = transitUserRecordService.remove(deleteWrapper.last("LIMIT 1000")); if (result) { System.out.println("删除成功!"); diff --git a/src/main/java/com/ssf/mysqloracletest/task/VLgryGjxxTask.java b/src/main/java/com/ssf/mysqloracletest/task/VLgryGjxxTask.java index 6d6eb3c..989d98c 100644 --- a/src/main/java/com/ssf/mysqloracletest/task/VLgryGjxxTask.java +++ b/src/main/java/com/ssf/mysqloracletest/task/VLgryGjxxTask.java @@ -49,7 +49,7 @@ public class VLgryGjxxTask { * 连云港 对接海康平台获取人员基础数据 * // */ - @Scheduled(initialDelay = 100, fixedDelay = 3000) + @Scheduled(initialDelay = 100, fixedDelay = 1800000) public void translgry() { if (!"true".equals(ConfigParam.LgrySwitch)) { @@ -129,7 +129,7 @@ public class VLgryGjxxTask { transitImpUserRecord.setLatitude(NumKit.checkBigDecimal(lgry.getYJWDZB())); transitImpUserRecord.setDeviceAddress(lgry.getHDFSDD()); transitImpUserRecord.setGlobalPic(lgry.getZPDT()); - transitImpUserRecord.setUserPic(lgry.getZPXT()); + transitImpUserRecord.setPersonPic(lgry.getZPXT()); transitImpUserRecord.setSimilarity(lgry.getVALUE2()); transitImpUserRecord.setOwnerName(lgry.getYJDXMC()); transitImpUserRecord.setIdCard(lgry.getYJDXHM()); diff --git a/src/main/java/com/ssf/mysqloracletest/task/VSwryGjxxTask.java b/src/main/java/com/ssf/mysqloracletest/task/VSwryGjxxTask.java index f2ea2d0..e113ae8 100644 --- a/src/main/java/com/ssf/mysqloracletest/task/VSwryGjxxTask.java +++ b/src/main/java/com/ssf/mysqloracletest/task/VSwryGjxxTask.java @@ -50,7 +50,7 @@ public class VSwryGjxxTask { * 连云港 对接海康平台获取人员基础数据 * // */ - @Scheduled(initialDelay = 100, fixedDelay = 3000) + @Scheduled(initialDelay = 100, fixedDelay = 1800000) public void transSwry() { if (!"true".equals(ConfigParam.SwrySwitch)) { @@ -125,7 +125,7 @@ public class VSwryGjxxTask { transitImpUserRecord.setLatitude(NumKit.checkBigDecimal(swry.getWDZB())); transitImpUserRecord.setDeviceAddress(swry.getVALUE1()); transitImpUserRecord.setGlobalPic(swry.getVALUE4()); - transitImpUserRecord.setUserPic(swry.getVALUE3()); + transitImpUserRecord.setPersonPic(swry.getVALUE3()); transitImpUserRecord.setSimilarity(swry.getVALUE2()); transitImpUserRecord.setOwnerName(swry.getZDRYXM()); transitImpUserRecord.setIdCard(swry.getZDRYSFZH()); diff --git a/src/main/java/com/ssf/mysqloracletest/utils/ConfigParam.java b/src/main/java/com/ssf/mysqloracletest/utils/ConfigParam.java index 09da75d..a0ab5b8 100644 --- a/src/main/java/com/ssf/mysqloracletest/utils/ConfigParam.java +++ b/src/main/java/com/ssf/mysqloracletest/utils/ConfigParam.java @@ -65,5 +65,13 @@ public class ConfigParam { public static String DeleteOldVehicleSwtich = StringKit.toString(PropertiesUtil.queryPropertiesByKey("DeleteOldVehicleSwtich")); public static String DevopeVideoInfoSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("DevopeVideoInfoSwitch")); public static String vehicleFlowSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("vehicleFlowSwitch")); + public static String PeopleFlowSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("PeopleFlowSwitch")); + public static String vehicleHourSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("vehicleHourSwitch")); + public static String peopleHourSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("peopleHourSwitch")); + public static String videoPositionSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("videoPositionSwitch")); + public static String ZfjlyVideoInfoSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("ZfjlyVideoInfoSwitch")); + public static String devicePositionSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("devicePositionSwitch")); + public static String SwzdrySwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("SwzdrySwitch")); + public static String JCVideoInfoSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("JCVideoInfoSwitch")); }