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 ac6fd254..0b4a1e90 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 @@ -70,11 +70,11 @@ public class CreateSqbByDllServiceImpl implements CreateSqbByDllService { //压缩文件存放-会被删除 if (!FileUtil.fileExists(localPath + fileName)) { //log.info("[uuid:{}]下载的zip文件{}不存在", uuid, localPath + fileName); - LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-下载的zip文件不存在" +localPath + fileName, "CreateSqbByDllServiceImpl"); + LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-下载的zip文件不存在" + localPath + fileName, "CreateSqbByDllServiceImpl"); //更新sqlite任务表的任务状态为2-报错 DatabaseUtil.insertSqlite(sqliteDriverName, sqliteUrl, Constant.ERROR_UPDATE_BUSINESS_HANDLER + businessTask.getId()); //throw new PPException(MessageEnum.下载的zip文件不存在.getCode(), MessageEnum.下载的zip文件不存在.getMessage()); - }else { + } else { //解压之前先清空解压目标目录 FileUtil.removeFiles(new File(unZip)); List stringList = UnzipUtil.decompress(localPath + fileName, unZip); @@ -88,10 +88,10 @@ public class CreateSqbByDllServiceImpl implements CreateSqbByDllService { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("GBSTATIONID", exId); //log.info("[uuid:{}]查询的NAME_TABLE中GBSTATIONID={}的数据", uuid, exId); - LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-查询的NAME_TABLE中GBSTATIONID=" +exId, "CreateSqbByDllServiceImpl"); + LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-查询的NAME_TABLE中GBSTATIONID=" + exId, "CreateSqbByDllServiceImpl"); NameTable nameTable = nameTableMapper.selectOne(queryWrapper); //log.info("[uuid:{}]查询的NAME_TABLE中GBSTATIONID={}的数据为{}", uuid, exId, nameTable); - LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-查询的NAME_TABLE中GBSTATIONID=" +exId+"的数据为"+nameTable, "CreateSqbByDllServiceImpl"); + LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-查询的NAME_TABLE中GBSTATIONID=" + exId + "的数据为" + nameTable, "CreateSqbByDllServiceImpl"); if (nameTable != null) { String subComNO; //if (Constant.WU_XIN_STAID.contains(exId)) { @@ -122,7 +122,7 @@ public class CreateSqbByDllServiceImpl implements CreateSqbByDllService { } Integer staNo = nameTable.getStaNo(); //log.info("[uuid:{}]获取分公司编号为{}", uuid, subComNO); - LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-获取分公司编号为=" +subComNO, "CreateSqbByDllServiceImpl"); + LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-获取分公司编号为=" + subComNO, "CreateSqbByDllServiceImpl"); //String zlibName = "ALLROADMINFEE_" + fileDt + Constant.STR_ + exId + Constant.STR_ + subComNO + Constant.STR_ + staNo; String zlibName = "ALLROADMINFEE_" + fileDt + Constant.STR_ + staNo; @@ -142,7 +142,7 @@ public class CreateSqbByDllServiceImpl implements CreateSqbByDllService { //上一版本路径 List longs = FileUtil.folderNames(sqlLiteDir + File.separator + "SQLLITE" + File.separator); //log.info("[uuid:{}]获取SQB下的文件夹个数为{}", uuid, longs.size()); - LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-获取SQB下的文件夹个数为=" +longs.size(), "CreateSqbByDllServiceImpl"); + LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-获取SQB下的文件夹个数为=" + longs.size(), "CreateSqbByDllServiceImpl"); //排序 longs.sort(Comparator.naturalOrder()); String sqlLiteName = "ALLROADMINFEE_" + staInfo + Constant.STR_SQB; @@ -155,30 +155,30 @@ public class CreateSqbByDllServiceImpl implements CreateSqbByDllService { String preSqlLitePath = pre_sqlLitePath + File.separator + pre_sqlLiteName; //log.info("[uuid:{}]获取SQB上一个版本号是{},sqb文件全路径是:{}", uuid, pre_Version, preSqlLitePath); - LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-获取SQB上一个版本号是" +pre_Version+"sqb文件全路径是"+preSqlLitePath, "CreateSqbByDllServiceImpl"); + LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-获取SQB上一个版本号是" + pre_Version + "sqb文件全路径是" + preSqlLitePath, "CreateSqbByDllServiceImpl"); //System.out.println(pre_sqlLitePath + File.separator + pre_sqlLiteName); //前一版本拷贝新版本-并重新命名 if (StringUtils.isNotBlank(pre_sqlLiteName) && FileUtil.fileExists(pre_sqlLitePath + File.separator + pre_sqlLiteName)) { FileUtil.fileCopyReName(pre_sqlLitePath + File.separator + pre_sqlLiteName, sqbFileDll); } else { //log.info("[uuid:{}]获取上一版本SQB文件不存在,新创建文件:{}", uuid, sqbFileDll); - LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-获取上一版本SQB文件不存在,新创建文件" +sqbFileDll, "CreateSqbByDllServiceImpl"); + LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-获取上一版本SQB文件不存在,新创建文件" + sqbFileDll, "CreateSqbByDllServiceImpl"); FileUtil.newFileCreat(sqbFileDll); } } else { //log.info("[uuid:{}]获取上一版本SQB文件不存在,新创建文件:{}", uuid, sqbFileDll); - LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-获取上一版本SQB文件不存在,新创建文件" +sqbFileDll, "CreateSqbByDllServiceImpl"); + LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-获取上一版本SQB文件不存在,新创建文件" + sqbFileDll, "CreateSqbByDllServiceImpl"); FileUtil.newFileCreat(sqbFileDll); } String zlibFileDll = sqlLitePathDll + zlibName + Constant.STR_ZLIB; //log.info("[uuid:{}]调用动态库生成最小费额SQB文件中,协议类型为:{},zip文件名为:{}", uuid, protocolType, fileName); - LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-调用动态库生成最小费额SQB文件中,协议类型为" +protocolType+"zip文件名为"+fileName, "CreateSqbByDllServiceImpl"); + LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-调用动态库生成最小费额SQB文件中,协议类型为" + protocolType + "zip文件名为" + fileName, "CreateSqbByDllServiceImpl"); String zipFilePath = (localPath + fileName).replace("\\", "/"); String sqbFileDllPath = sqbFileDll.replace("\\", "/"); String zlibFileDllPath = zlibFileDll.replace("\\", "/"); int count = CMinFeeCreator.INSTANCE.MakeMinFee(zipFilePath, sqbFileDllPath, zlibFileDllPath, bytMd5); //log.info("[uuid:{}]调用动态库生成最小费额SQB文件返回count为:{}", uuid, count); - LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-调用动态库生成最小费额SQB文件返回count为" +count, "CreateSqbByDllServiceImpl"); + LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-调用动态库生成最小费额SQB文件返回count为" + count, "CreateSqbByDllServiceImpl"); if (count >= 0) { String sqbInsertPath = NFSFilePath + File.separator + "ParamInsertDb" + File.separator + "MinFeeInToDataBase" + File.separator; FileUtil.fileCreat(sqbInsertPath); @@ -190,7 +190,7 @@ public class CreateSqbByDllServiceImpl implements CreateSqbByDllService { //获取生成的zlib的文件名 String zlibFileNameMd5 = FileUtil.zlibFileName(sqlLitePathDll, zlibName.replace(Constant.STR_ZLIB, Constant.NULL_STRING) + Constant.STR_); //log.info("[uuid:{}]获取zlib的文件名称为:{}", uuid, zlibFileNameMd5); - LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-获取zlib的文件名称为" +zlibFileNameMd5, "CreateSqbByDllServiceImpl"); + LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-获取zlib的文件名称为" + zlibFileNameMd5, "CreateSqbByDllServiceImpl"); //获取高路分中心需要下发的收费站编码,如果是多个站,站编码用,间隔 String glMinFeeFZXs = PropertiesUtil.getValue("GLMinFeeFZXs"); String glMinFeeStaNos = PropertiesUtil.getValue("GLMinFeeStaNos"); @@ -199,7 +199,7 @@ public class CreateSqbByDllServiceImpl implements CreateSqbByDllService { String[] split2 = glMinFeeStaNos.split(Constant.FIELD_SEPARATE); for (String subcomno : split1) { for (String stano : split2) { - if (zlibFileNameMd5.contains(Constant.STR_ + stano)) { + if (zlibFileNameMd5.contains(Constant.STR_ + stano + Constant.STR_)) { //按照分中心的编码存入数据库表联网中心最小费额下发分中心表 QueryWrapper query = new QueryWrapper<>(); query.eq("SUBCOMNO", subcomno).eq("STANO", stano); @@ -255,11 +255,11 @@ public class CreateSqbByDllServiceImpl implements CreateSqbByDllService { 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()); - LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-更新business_tasks_info调用动态库任务列表成功,id为" +businessTask.getId(), "CreateSqbByDllServiceImpl"); + LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-更新business_tasks_info调用动态库任务列表成功,id为" + businessTask.getId(), "CreateSqbByDllServiceImpl"); } } else { //log.error("[uuid:{}]调用动态库生成SQB操作失败,返回值count为{}", uuid, count); - LogUtil.WriteLog_Error("[uuid:" + uuid + "]-调用动态库生成最小费额SQB操作失败,返回值count为" +count, "CreateSqbByDllServiceImpl"); + LogUtil.WriteLog_Error("[uuid:" + uuid + "]-调用动态库生成最小费额SQB操作失败,返回值count为" + count, "CreateSqbByDllServiceImpl"); //更新sqlite任务表的任务状态为2-报错 DatabaseUtil.insertSqlite(sqliteDriverName, sqliteUrl, Constant.ERROR_UPDATE_BUSINESS_HANDLER + businessTask.getId()); //throw new PPException(MessageEnum.调用动态库生成SQB操作失败.getCode(), MessageEnum.调用动态库生成SQB操作失败.getMessage()); @@ -267,12 +267,12 @@ public class CreateSqbByDllServiceImpl implements CreateSqbByDllService { } else { //log.info("[uuid:{}]查询的NAME_TABLE中GBSTATIONID={}的数据为null,跳过本次处理", uuid, exId); - LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-查询的NAME_TABLE中GBSTATIONID=" +exId+"的数据为null,跳过本次处理", "CreateSqbByDllServiceImpl"); + LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-查询的NAME_TABLE中GBSTATIONID=" + exId + "的数据为null,跳过本次处理", "CreateSqbByDllServiceImpl"); 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()); - LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-更新business_tasks_info调用动态库任务列表成功,id为" +businessTask.getId(), "CreateSqbByDllServiceImpl"); + LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-更新business_tasks_info调用动态库任务列表成功,id为" + businessTask.getId(), "CreateSqbByDllServiceImpl"); } } } diff --git a/ParamDownload/src/main/java/com/nm/gsgl/service/impl/MinDualMachineServiceImpl.java b/ParamDownload/src/main/java/com/nm/gsgl/service/impl/MinDualMachineServiceImpl.java index 88c6e3c8..25afd126 100644 --- a/ParamDownload/src/main/java/com/nm/gsgl/service/impl/MinDualMachineServiceImpl.java +++ b/ParamDownload/src/main/java/com/nm/gsgl/service/impl/MinDualMachineServiceImpl.java @@ -1,6 +1,8 @@ package com.nm.gsgl.service.impl; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.nm.gsgl.common.Constant; +import com.nm.gsgl.common.utils.DateTimeUtil; import com.nm.gsgl.common.utils.LogUtil; import com.nm.gsgl.entity.intermediary.AppAliveStatus; import com.nm.gsgl.mapper.AppAliveStatusMapper; @@ -116,4 +118,21 @@ public class MinDualMachineServiceImpl implements MinDualMachineService { LogUtil.WriteLog_MinFee("[uuid:" + uuid + "]-当前活跃的机器为" +appAliveStatus.getALiveId()+"不是ALIVEID=2的程序,更新主程序存活时间,程序休眠,等待下次轮询", "MinDualMachineServiceImpl"); return false; } + + public static void main(String[] args) { + Date date = new Date(); + Date mTime = DateTimeUtil.getFormatDate("2024-10-10 10:25:00", Constant.YYYY_MM_DD_HH_MM_SS); + long time = date.getTime(); + long time1 = mTime.getTime(); + int deadCount =5; + int deadTime = 300; + System.out.println( time1); + System.out.println(((long) deadTime * deadCount * 1000)); + System.out.println( time1+((long) deadTime * deadCount * 1000)); + System.out.println( time); + System.out.println((time1 + ((long) deadTime * deadCount * 1000) - time)); + System.out.println((time1 + ((long) deadTime * deadCount * 1000) < time)); + + + } }