diff --git a/ParamDownload/src/main/java/com/nm/gsgl/common/timetask/TaskThreadPoolConfig.java b/ParamDownload/src/main/java/com/nm/gsgl/common/timetask/TaskThreadPoolConfig.java index eae30709..ea91c86c 100644 --- a/ParamDownload/src/main/java/com/nm/gsgl/common/timetask/TaskThreadPoolConfig.java +++ b/ParamDownload/src/main/java/com/nm/gsgl/common/timetask/TaskThreadPoolConfig.java @@ -90,11 +90,29 @@ public class TaskThreadPoolConfig { return executor; } - @Bean("threadPoolBlackCard") // bean的名称,默认为首字母小写的方法名 + @Bean("threadPoolHRBlackCard") // bean的名称,默认为首字母小写的方法名 + public Executor threadPoolHRBlackCard() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + //线程前缀名 + executor.setThreadNamePrefix("timeTaskHRBlackCard-thread-"); + //最大线程数 + executor.setMaxPoolSize(1); + //核心线程数 + executor.setCorePoolSize(1); + //任务队列的大小 + executor.setQueueCapacity(5); + //executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy()); + //线程初始化 + executor.initialize(); + + return executor; + } + @Bean("threadPoolMDBlackCard") // bean的名称,默认为首字母小写的方法名 public Executor threadPoolBlackCard() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); //线程前缀名 - executor.setThreadNamePrefix("timeTaskBlackCard-thread-"); + executor.setThreadNamePrefix("timeTaskMDBlackCard-thread-"); //最大线程数 executor.setMaxPoolSize(1); //核心线程数 diff --git a/ParamDownload/src/main/java/com/nm/gsgl/common/timetask/TimeTaskInfo.java b/ParamDownload/src/main/java/com/nm/gsgl/common/timetask/TimeTaskInfo.java index 097785c0..ac0b0b80 100644 --- a/ParamDownload/src/main/java/com/nm/gsgl/common/timetask/TimeTaskInfo.java +++ b/ParamDownload/src/main/java/com/nm/gsgl/common/timetask/TimeTaskInfo.java @@ -48,20 +48,36 @@ public class TimeTaskInfo { public static Logger insertDBLog = LoggerFactory.getLogger("InsertDB"); /** - * 根据配置时间定时执行ETC参数下载及处理服务 + * 根据配置时间定时执行华软中介库ETC参数下载及处理服务 * * @author shuguang * @date 2023-02-19 0:02 */ - @Async("threadPoolBlackCard") + @Async("threadPoolHRBlackCard") @Scheduled(cron = "${time.corn2}") - public void timeTaskBlackCard() { + public void timeTaskHRBlackCard() { String uuid = UuidUtil.getUuid(); - blackCardLog.info("[uuid:{}]定时执行ETC参数下载及处理服务,当前时间={}", uuid, LocalDateTime.now()); + blackCardLog.info("[uuid:{}]定时执行华软中介库ETC参数下载及处理服务,当前时间={}", uuid, LocalDateTime.now()); long start = System.currentTimeMillis(); ectService.paramDownload(uuid); long end = System.currentTimeMillis(); - blackCardLog.info("[uuid:{}]定时ETC参数下载及处理服务执行完成,耗时:{}毫秒", uuid, end - start); + blackCardLog.info("[uuid:{}]定时华软中介库ETC参数下载及处理服务执行完成,耗时:{}毫秒", uuid, end - start); + } + /** + * 根据配置时间定时执行迈道中介库ETC参数下载及处理服务 + * + * @author shuguang + * @date 2023-02-19 0:02 + */ + @Async("threadPoolHRBlackCard") + @Scheduled(cron = "${time.corn6}") + public void timeTaskMDBlackCard() { + String uuid = UuidUtil.getUuid(); + blackCardLog.info("[uuid:{}]定时执行迈道中介库ETC参数下载及处理服务,当前时间={}", uuid, LocalDateTime.now()); + long start = System.currentTimeMillis(); + ectService.paramMDDownload(uuid); + long end = System.currentTimeMillis(); + blackCardLog.info("[uuid:{}]定时迈道中介库ETC参数下载及处理服务执行完成,耗时:{}毫秒", uuid, end - start); } diff --git a/ParamDownload/src/main/java/com/nm/gsgl/service/EctService.java b/ParamDownload/src/main/java/com/nm/gsgl/service/EctService.java index 041b3acd..d44befb3 100644 --- a/ParamDownload/src/main/java/com/nm/gsgl/service/EctService.java +++ b/ParamDownload/src/main/java/com/nm/gsgl/service/EctService.java @@ -7,11 +7,19 @@ package com.nm.gsgl.service; */ public interface EctService { /** - * 参数下载服务 + * 华软参数下载服务 * * @param uuid uuid * @author shuguang * @date 2023-02-18 20:14 */ void paramDownload(String uuid); + /** + * 迈道参数下载服务 + * + * @param uuid uuid + * @author shuguang + * @date 2023-02-18 20:14 + */ + void paramMDDownload(String uuid); } diff --git a/ParamDownload/src/main/java/com/nm/gsgl/service/ZipToSqbService.java b/ParamDownload/src/main/java/com/nm/gsgl/service/ZipToSqbService.java index f3fec45f..c6e84606 100644 --- a/ParamDownload/src/main/java/com/nm/gsgl/service/ZipToSqbService.java +++ b/ParamDownload/src/main/java/com/nm/gsgl/service/ZipToSqbService.java @@ -14,4 +14,10 @@ public interface ZipToSqbService { * @date 2023-02-06 14:41 */ void createSqbByDll(String uuid, BusinessTasks businessTasks); + /** + *通过动态库生成迈道SQB + * @author shuguang + * @date 2023-02-06 14:41 + */ + void createMDSqbByDll(String uuid, BusinessTasks businessTasks); } diff --git a/ParamDownload/src/main/java/com/nm/gsgl/service/impl/CreateSqbByDllServiceImpl.java b/ParamDownload/src/main/java/com/nm/gsgl/service/impl/CreateSqbByDllServiceImpl.java index 5488812c..be642699 100644 --- a/ParamDownload/src/main/java/com/nm/gsgl/service/impl/CreateSqbByDllServiceImpl.java +++ b/ParamDownload/src/main/java/com/nm/gsgl/service/impl/CreateSqbByDllServiceImpl.java @@ -94,14 +94,14 @@ public class CreateSqbByDllServiceImpl implements CreateSqbByDllService { log.info("[uuid:{}]查询的NAME_TABLE中GBSTATIONID={}的数据为{}", uuid, exId, nameTable); if (nameTable != null) { String subComNO; - if (Constant.WU_XIN_STAID.contains(exId)) { - //归属与兴安盟(中和 蘑菇其 扎兰屯主线) - subComNO = "87"; - } else if (Constant.BY_STA_ID.contains(exId)) { - subComNO = "41"; - } else if (Constant.XLHT_STA_ID.contains(exId)) { - subComNO = "53"; - } else { + //if (Constant.WU_XIN_STAID.contains(exId)) { + // //归属与兴安盟(中和 蘑菇其 扎兰屯主线) + // subComNO = "87"; + //} else if (Constant.BY_STA_ID.contains(exId)) { + // subComNO = "41"; + //} else if (Constant.XLHT_STA_ID.contains(exId)) { + // subComNO = "53"; + //} else { subComNO = String.valueOf(nameTable.getSubComNo()); switch (subComNO) { case "38"://十大 @@ -113,11 +113,12 @@ public class CreateSqbByDllServiceImpl implements CreateSqbByDllService { case "29"://东察 subComNO = "35"; break; + case "48": case "50": case "59": subComNO = "53"; break; - } + //} } Integer staNo = nameTable.getStaNo(); log.info("[uuid:{}]获取分公司编号为{}", uuid, subComNO); diff --git a/ParamDownload/src/main/java/com/nm/gsgl/service/impl/EctServiceImpl.java b/ParamDownload/src/main/java/com/nm/gsgl/service/impl/EctServiceImpl.java index 4cd941fb..9b34e43e 100644 --- a/ParamDownload/src/main/java/com/nm/gsgl/service/impl/EctServiceImpl.java +++ b/ParamDownload/src/main/java/com/nm/gsgl/service/impl/EctServiceImpl.java @@ -8,13 +8,11 @@ import com.nm.gsgl.common.utils.PathUtil; import com.nm.gsgl.entity.sqlite.BusinessTasks; import com.nm.gsgl.service.CreateDbService; import com.nm.gsgl.service.CreateDbfByDllService; -import com.nm.gsgl.service.CreateSqbByDllService; import com.nm.gsgl.service.DualMachineService; import com.nm.gsgl.service.EctService; import com.nm.gsgl.service.FtpDownloadService; import com.nm.gsgl.service.SqliteBackupsService; import com.nm.gsgl.service.ZipToSqbService; -import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -140,6 +138,22 @@ public class EctServiceImpl implements EctService { } } } + + } + + /** + * 迈道参数下载服务 + * + * @param uuid uuid + * @author shuguang + * @date 2023-02-18 20:14 + */ + @Override + public void paramMDDownload(String uuid) { + //双机方案 + //获取本机的机器ID,本机的机器ID 1-主机,2-备用机 + int mId = Integer.parseInt(machineId); + log.info("[uuid:{}]获取当前机器的id为{}", uuid, mId); //验证迈道 boolean validateMD; if (mId == 1) { @@ -151,7 +165,7 @@ public class EctServiceImpl implements EctService { if (validateMD) { //开始下载扫描迈道下载任务 ftpDownloadService.getMdMdTask(uuid); - //开始查询sqlite任务表中华软未处理数据任务 + //开始查询sqlite任务表中迈道未处理数据任务 List businessTasks = DatabaseUtil.selectBusines(sqliteDriverName, sqliteUrl, Constant.SELECT_BUSINESS_HANDLER_MD); if (businessTasks.size() > 0) { for (BusinessTasks businessTask : businessTasks) { @@ -163,7 +177,7 @@ public class EctServiceImpl implements EctService { boolean isFinished = false; //调用动态库生成sqb文件 if (Constant.DLL_SQB_LIST.contains(protocolType)) { - zipToSqbService.createSqbByDll(uuid, businessTask); + zipToSqbService.createMDSqbByDll(uuid, businessTask); isFinished = true; } if (isFinished) { diff --git a/ParamDownload/src/main/java/com/nm/gsgl/service/impl/ZipToSqbServiceImpl.java b/ParamDownload/src/main/java/com/nm/gsgl/service/impl/ZipToSqbServiceImpl.java index 115ffc7c..35c9ec03 100644 --- a/ParamDownload/src/main/java/com/nm/gsgl/service/impl/ZipToSqbServiceImpl.java +++ b/ParamDownload/src/main/java/com/nm/gsgl/service/impl/ZipToSqbServiceImpl.java @@ -153,26 +153,6 @@ public class ZipToSqbServiceImpl implements ZipToSqbService { qlSqbName = "SQB_GREENALL"; bfSqbName = "SQB_GREENINC"; break; - //追缴名单-全量 - case Constant.STR_3501: - //case "35"://追缴名单-全量 - dbName = "SNBLACKLISTALL.DBF"; - type = 3; - etcType = 7; - dbfDir = "SNVEHICLE"; - qlSqbName = "SQB_SNBLACKALL"; - bfSqbName = "SQB_SNBLACKALL"; - break; - //追缴名单-增量 - case Constant.STR_3601: - //case "36"://追缴名单-增量 - dbName = "SNBLACKLISTINC.DBF"; - type = 4; - etcType = 7; - dbfDir = "SNVEHICLE"; - qlSqbName = "SQB_SNBLACKALL"; - bfSqbName = "SQB_SNBLACKINC"; - break; case Constant.STR_919://追缴名单-全量 dbName = "EMERCARALL.DBF"; @@ -383,23 +363,275 @@ public class ZipToSqbServiceImpl implements ZipToSqbService { //更新自动下发分中心相应状态 nameTableAutoMapper.update(null, updateWrapper); break; - case Constant.STR_3501: - updateWrapper.set("BLACKFLAG", Integer.parseInt(protocolType)); + case Constant.STR_919: + updateWrapper.set("EMERCARFLAG", Integer.parseInt(protocolType)); //更新自动下发分中心相应状态 nameTableAutoMapper.update(null, updateWrapper); break; - case Constant.STR_3601: - updateWrapper.set("BLACKINCFLAG", Integer.parseInt(protocolType)); + case Constant.STR_920: + updateWrapper.set("EMERCARINCFLAG", Integer.parseInt(protocolType)); //更新自动下发分中心相应状态 nameTableAutoMapper.update(null, updateWrapper); break; - case Constant.STR_919: - updateWrapper.set("EMERCARFLAG", Integer.parseInt(protocolType)); + default: + log.error("[uuid:{}]-未找到相应的更新自动下发分中心相应状态方法", uuid); + throw new PPException(MessageEnum.未找到相应的处理程序.getCode(), MessageEnum.未找到相应的处理程序.getMessage()); + } + + //入库新文件的信息表 + intoNewFileInfo(protocolType, zlibFileNameMd5Sqb, dbfDir, version, basicType, dayBackPath, fileName); + String nowString = DateTimeUtil.getFormateString(new Date(), Constant.YYYY_MM_DD_HH_MM_SS); + String sqlParam = Constant.UPDATE_BUSINESS_HANDLER + nowString + Constant.PUBLISH_TIME + nowString + Constant.WHERE_ID + businessTask.getId(); + if (DatabaseUtil.insertSqlite(sqliteDriverName, sqliteUrl, sqlParam) > 0) { + log.info("[uuid:{}]更新business_tasks_info调用动态库任务列表成功,id为:{}", uuid, businessTask.getId()); + } + log.info("[uuid:{}]调用动态库生成SQB任务,下载协议类型:{},zip文件名为:{}执行成功", uuid, protocolType, fileName); + } else { + //更新sqlite任务表的任务状态为2-报错(等待下次轮询) + DatabaseUtil.insertSqlite(sqliteDriverName, sqliteUrl, Constant.ERROR_UPDATE_BUSINESS_HANDLER + businessTask.getId()); + throw new PPException(MessageEnum.调用动态库生成SQB操作失败.getCode(), MessageEnum.调用动态库生成SQB操作失败.getMessage() + + ",SQB动态库返回值为" + countSqb); + } + } else { + log.info("[uuid:{}]该时间点{}已下发/或者该点不下发", uuid, protocolType); + //更新sqlite任务表的任务状态为3-不下发 + DatabaseUtil.insertSqlite(sqliteDriverName, sqliteUrl, + Constant.NOT_DIS_UPDATE_BUSINESS_HANDLER + DateTimeUtil.getFormateString(new Date(), Constant.YYYY_MM_DD_HH_MM_SS) + Constant.WHERE_ID + businessTask.getId()); + log.info("[uuid:{}]更新business_tasks_info任务表的下发状态为3-不下发,id为:{}", uuid, businessTask.getId()); + } + + } catch (Exception e) { + log.error("[uuid:{}]调用动态库生成SQB失败{}", uuid, e.getMessage(), e); + //更新sqlite任务表的任务状态为2-报错 + DatabaseUtil.insertSqlite(sqliteDriverName, sqliteUrl, Constant.ERROR_UPDATE_BUSINESS_HANDLER + businessTask.getId()); + throw new PPException(MessageEnum.调用动态库生成SQB操作失败.getCode(), MessageEnum.调用动态库生成SQB操作失败.getMessage() + + ",SQB动态库返回值为" + countSqb); + } + + } + + /** + * 通过动态库生成迈道SQB + * + * @author shuguang + * @date 2023-02-06 14:41 + */ + @Override + public void createMDSqbByDll(String uuid, BusinessTasks businessTask) { + String localPath = NFSFilePath + PathUtil.downFile; + String sqbPath = NFSFilePath + PathUtil.sqbPath; + //1-全量DBF,2-增量DBF,3-全量SQB,4-增量SQB + int type; + //各类黑名单存放目录 + String dbfDir; + //SQB全量文件名称 + String qlSqbName; + //SQB备份文件名所需关键字 + String bfSqbName; + int etcType; + int countSqb = 0; + byte[] bytMd5 = new byte[256]; + String protocolType = businessTask.getProtocolType(); + String fileName = businessTask.getFileName(); + String version = businessTask.getNewVersion(); + + //压缩文件存放-会被删除 + if (!FileUtil.fileExists(localPath + fileName)) { + log.info("[uuid:{}]下载的zip文件{}不存在", uuid, localPath + fileName); + throw new PPException(MessageEnum.下载的zip文件不存在.getCode(), MessageEnum.下载的zip文件不存在.getMessage()); + } + //调用动态库生成DBF文件 + try { + //dbf文件名称 + String dbName; + switch (protocolType) { + //追缴名单-全量 + case Constant.STR_3501: + //case "35"://追缴名单-全量 + dbName = "SNBLACKLISTALL.DBF"; + type = 3; + etcType = 7; + dbfDir = "SNVEHICLE"; + qlSqbName = "SQB_SNBLACKALL"; + bfSqbName = "SQB_SNBLACKALL"; + break; + //追缴名单-增量 + case Constant.STR_3601: + //case "36"://追缴名单-增量 + dbName = "SNBLACKLISTINC.DBF"; + type = 4; + etcType = 7; + dbfDir = "SNVEHICLE"; + qlSqbName = "SQB_SNBLACKALL"; + bfSqbName = "SQB_SNBLACKINC"; + break; + default: + log.error("[uuid:{}]-未找到相应的参数处理方法", uuid); + throw new PPException(MessageEnum.未找到相应的处理程序.getCode(), MessageEnum.未找到相应的处理程序.getMessage()); + } + FileUtil.fileCreat(sqbPath + dbfDir); + Date date = new Date(); + String formateString = DateTimeUtil.getFormateString(date, Constant.YYYYMMDDHHMMSS); + String format = DateTimeUtil.getFormateString(date, Constant.YYYY_MM_DD_HH_MM_SS); + String zlibSqbName = bfSqbName + Constant.STR_ + formateString + Constant.STR_ + version + Constant.STR_ZLIB; + String dateTime = fileName.substring(fileName.lastIndexOf(Constant.STR_) + 1).replace(Constant.STR_ZIP, Constant.NULL_STRING).substring(0, 8); + //生成SQB文件名 + String sqbPathName = sqbPath + dbfDir + File.separator + formateString + Constant.STR_ + dbName.replace(Constant.STR_DBF, Constant.STR_SQB); + String sqbZlibPathName = sqbPath + dbfDir + File.separator + zlibSqbName; + String dayBackPath; + if (type == 3) { + zlibSqbName = bfSqbName + Constant.STR_ + formateString + Constant.STR_ + version + Constant.STR_ZLIB; + dayBackPath = NFSFilePath + PathUtil.downFileBackup + dbfDir + File.separator; + FileUtil.fileCreat(dayBackPath); + FileUtil.copyFile(localPath + fileName, dayBackPath + fileName); + log.info("[uuid:{}]调用动态库生成全量SQB文件中,协议类型为:{},zip文件名为:{}", uuid, protocolType, fileName); + countSqb = CMinFeeCreator.INSTANCE.MakeBlackAllSQB(etcType, version, format, + (localPath + fileName).replace("\\", "/"), sqbPathName.replace("\\", "/"), + sqbZlibPathName.replace("\\", "/"), bytMd5); + + log.info("[uuid:{}]调用动态库生成全量SQB文件完成,返回值为:{}", uuid, countSqb); + + } else { + log.info("[uuid:{}]调用动态库生成增量SQB文件中,协议类型为:{},zip文件名为:{}", uuid, protocolType, fileName); + //每天生成一个备份zip文件夹存放增量下载的zip文件 + dayBackPath = NFSFilePath + PathUtil.downFileBackup + dbfDir + File.separator + dateTime + File.separator; + FileUtil.fileCreat(dayBackPath); + FileUtil.copyFile(localPath + fileName, dayBackPath + fileName); + //将下载的增量文件复制到入库文件夹下 + String insertDbPath = NFSFilePath + File.separator + "ParamInsertDb" + File.separator + "zipFilePath" + File.separator; + FileUtil.fileCreat(insertDbPath); + FileUtil.copyFile(localPath + fileName, insertDbPath + fileName); + //当前时段是否生成新版本增量 + boolean isGenerate = false; + //根据主键protocolType查询DIS_NEWFILEINFO_JAVA表中上次的生成时间 + NewFileInfo newFileInfo = newFileInfoMapper.selectById(protocolType); + if(newFileInfo != null ){ + Date updateTime = newFileInfo.getUpdateTime(); + log.info("[uuid:{}]根据主键protocolType={}查询DIS_NEWFILEINFO_JAVA表中上次的生成时间为:{}", uuid, protocolType, updateTime); + int hours = DateTimeUtil.getHour(date); + if (updateTime != null) { + if (hours != DateTimeUtil.getHour(updateTime)) { + isGenerate = true; + } + } else { + isGenerate = true; + } + } else { + isGenerate = true; + } + + + + if (isGenerate) { + //如果是增量先查询上一版本的版本号 + if (Constant.ONE_HOUR_ISSUED.contains(protocolType)) { + version = getVersion(protocolType, date, uuid); + log.info("[uuid:{}]最终增量本次版本号为{}", uuid, version); + } + //增量目录名称 + StringBuilder incDirLst = new StringBuilder(); + boolean fDir = false; + for (int i = 0; i < Integer.parseInt(incDays); i++) { + if (fDir) { + incDirLst.append("|"); + } + incDirLst.append(NFSFilePath).append(PathUtil.downFileBackup).append(dbfDir).append(File.separator).append(DateTimeUtil.getFormateString(DateTimeUtil.addDateDays(date, -i), Constant.YYYYMMDD)); + fDir = true; + } + + zlibSqbName = bfSqbName + Constant.STR_ + formateString + Constant.STR_ + version + Constant.STR_ZLIB; + sqbZlibPathName = sqbPath + dbfDir + File.separator + zlibSqbName; + + log.info("[uuid:{}]调用动态库生成增量SQB文件中,协议类型为:{},zip文件名为:{}", uuid, protocolType, fileName); + + //获取最新的全量sqb文件全路径 + //全量文件 + String sqbQlFileDir = NFSFilePath + PathUtil.sqbBackPath + dbfDir; + String pblackAllFileName = ""; + List fileInfos2 = new ArrayList<>(); + File[] files2 = new File(sqbQlFileDir).listFiles(); + if (null != files2 && files2.length > 0) { + for (File file : files2) { + if (file.isFile() && file.getName().endsWith(Constant.STR_SQB) && file.getName().contains(qlSqbName)) { + FileInfo fileInfo = new FileInfo(); + fileInfo.setFileName(file.getName()); + fileInfo.setLastModified(new Date(file.lastModified())); + fileInfo.setFilePath(file.getPath()); + fileInfos2.add(fileInfo); + } + } + //获取当前时间加载增量时间之前的全量文件名 + Date tenDaysAgo = DateTimeUtil.addDateDays(new Date(), -(Integer.parseInt(incDays))); + String tenDaysVersion = DateTimeUtil.getFormateString(tenDaysAgo, Constant.YYMMDD) + "103"; + log.info("[uuid:{}]获取{}天前全量SQB,修改时间为{}", uuid, incDays,tenDaysAgo); + if (fileInfos2.size() > 0) { + log.info("[uuid:{}]获取全量SQB为{}", uuid, fileInfos2); + //对文件的最后修改时间进行排序 + fileInfos2.sort(Comparator.comparing(FileInfo::getLastModified).reversed()); + for (FileInfo fileInfo2 : fileInfos2) { + if(DateUtils.isSameDay(tenDaysAgo, fileInfo2.getLastModified()) || fileInfo2.getFileName().contains(tenDaysVersion)){ + pblackAllFileName = fileInfo2.getFileName(); + //log.info("[uuid:{}]==================={}", uuid, pblackAllFileName); + } + } + if(StringUtils.isBlank(pblackAllFileName)){ + pblackAllFileName = fileInfos2.get(0).getFileName(); + } + } else { + log.error("[uuid:{}]获取获取{}天前全量SQB文件失败", uuid,incDays); + //更新sqlite任务表的任务状态为2-报错 + DatabaseUtil.insertSqlite(sqliteDriverName, sqliteUrl, Constant.ERROR_UPDATE_BUSINESS_HANDLER + businessTask.getId()); + throw new PPException(MessageEnum.获取加载增量天数之前全量文件失败.getCode(), MessageEnum.获取加载增量天数之前全量文件失败.getMessage()); + } + log.info("[uuid:{}]获取获取{}天前全量SQB名称:{}", uuid, incDays, pblackAllFileName); + } + //如果没有最新的全量SQB文件时,不生成增量文件 + if (StringUtils.isNotBlank(pblackAllFileName)) { + log.info("[uuid:{}]调用动态库生成增量入参,全量SQB文件全路径:{}", uuid, (sqbQlFileDir + File.separator + pblackAllFileName).replace("\\", "/")); + log.info("[uuid:{}]调用动态库生成增量入参, 生成SQB文件全路径:{}", uuid, sqbPathName.replace("\\", "/")); + log.info("[uuid:{}]调用动态库生成增量入参, 生成SQBZLIB文件全路径:{}", uuid, sqbZlibPathName.replace("\\", "/")); + countSqb = CMinFeeCreator.INSTANCE.MakeBlackIncSQB(etcType, version, format, incDirLst.toString(), + (sqbQlFileDir + File.separator + pblackAllFileName).replace("\\", "/"), + sqbPathName.replace("\\", "/"), sqbZlibPathName.replace("\\", "/"), bytMd5); + log.info("[uuid:{}]调用动态库生成增量SQB文件完成,返回值为:{}", uuid, countSqb); + } + + } else { + log.info("[uuid:{}]该时间点{}已下发/或者该点不下发", uuid, protocolType); + //更新sqlite任务表的任务状态为3-不下发 + DatabaseUtil.insertSqlite(sqliteDriverName, sqliteUrl, + Constant.NOT_DIS_UPDATE_BUSINESS_HANDLER + DateTimeUtil.getFormateString(new Date(), Constant.YYYY_MM_DD_HH_MM_SS) + Constant.WHERE_ID + businessTask.getId()); + log.info("[uuid:{}]更新business_tasks_info任务表的下发状态为3-不下发,id为:{}", uuid, businessTask.getId()); + } + } + log.info("[uuid:{}]调用动态库生成SQB返回值count为{}", uuid, countSqb); + if (countSqb != 0) { + if (countSqb > 0) { + String formateStr = DateTimeUtil.getFormateString(date, Constant.YYYYMMDDHHMMSS); + log.info("[uuid:{}]开始生成SQB备份文件", uuid); + //sqb备份目录 + FileUtil.fileCreat(NFSFilePath + PathUtil.sqbBackPath + dbfDir); + String newSqbBackUpName = formateStr + Constant.STR_ + bfSqbName + Constant.STR_ + formateString + Constant.STR_ + version + Constant.STR_SQB; + //sqb源文件复制到备份文件夹,再重命名 + FileUtil.copyFile(sqbPathName, NFSFilePath + PathUtil.sqbBackPath + dbfDir + File.separator + newSqbBackUpName); + + //获取生成SQB的zlib的文件名 + String zlibFileNameMd5Sqb = FileUtil.zlibFileName(NFSFilePath + PathUtil.sqbPath + dbfDir, zlibSqbName.replace(Constant.STR_ZLIB, Constant.NULL_STRING)); + log.info("[uuid:{}]获取zlib的文件名称为:{}", uuid, zlibFileNameMd5Sqb); + + //更新CMS_NAME_TABLE_AUTO_JAVA表中的下发类型 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + //ISHIGHWAY=1,高速 + updateWrapper.eq("ISHIGHWAY", 1); + String basicType = ""; + switch (protocolType) { + case Constant.STR_3501: + updateWrapper.set("BLACKFLAG", Integer.parseInt(protocolType)); //更新自动下发分中心相应状态 nameTableAutoMapper.update(null, updateWrapper); break; - case Constant.STR_920: - updateWrapper.set("EMERCARINCFLAG", Integer.parseInt(protocolType)); + case Constant.STR_3601: + updateWrapper.set("BLACKINCFLAG", Integer.parseInt(protocolType)); //更新自动下发分中心相应状态 nameTableAutoMapper.update(null, updateWrapper); break; diff --git a/ParamDownload/src/main/resources/static/timeTask.properties b/ParamDownload/src/main/resources/static/timeTask.properties index 1240591b..fd95a78e 100644 --- a/ParamDownload/src/main/resources/static/timeTask.properties +++ b/ParamDownload/src/main/resources/static/timeTask.properties @@ -11,4 +11,5 @@ time.corn3 = 0 0 3 * * ? time.corn4 = 0 0/5 * * * ? #每1分钟执行一次 time.corn5 = 0 0/1 * * * ? - +#每5分钟执行一次 +time.corn6= 0 0/5 * * * ?