|
|
|
|
@ -99,6 +99,7 @@ import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author: shuguang
|
|
|
|
|
@ -356,9 +357,9 @@ public class ManualIssueServiceImpl implements ManualIssueService {
|
|
|
|
|
//String ip = "8.142.95.188";
|
|
|
|
|
log.info("[uuid:{}]-下发程序ip:{},端口号:{}", uuid, ip, tomcatPort);
|
|
|
|
|
//ALLROADMINFEE#站编码.SQB,0.28,0.29需要,普通的车道应该还是不带站编码
|
|
|
|
|
//if (Constant.ZHY_IP_LIST.contains(ip)) {
|
|
|
|
|
// paraName = paraName.replace(Constant.STR_SQB, "#" + staNo + Constant.STR_SQB);
|
|
|
|
|
//}
|
|
|
|
|
if (Constant.ZHY_IP_LIST.contains(ip)) {
|
|
|
|
|
paraName = paraName.replace(Constant.STR_SQB, "#" + staNo + Constant.STR_SQB);
|
|
|
|
|
}
|
|
|
|
|
if (paraName.contains("#")) {
|
|
|
|
|
paraName = paraName.split("#")[0] + "#" + roadNo + "#" + staNo + Constant.STR_SQB;
|
|
|
|
|
} else {
|
|
|
|
|
@ -561,6 +562,8 @@ public class ManualIssueServiceImpl implements ManualIssueService {
|
|
|
|
|
sqlStr = cmsParameter.getOraStr();
|
|
|
|
|
}
|
|
|
|
|
String newName = fileName.replace(Constant.STR_DBF, Constant.STR_) + version + Constant.STR_ZLIB;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(sqlStr) && paraId != 2) {
|
|
|
|
|
List<Map<String, Object>> mapList = sysMapper.selectList(sqlStr);
|
|
|
|
|
CreateDbfUtil.createDbfFile(uuid, paraId, fileName, mapList, DownloadPath);
|
|
|
|
|
@ -582,82 +585,128 @@ public class ManualIssueServiceImpl implements ManualIssueService {
|
|
|
|
|
+ Constant.WEBSERVICE_BACK;
|
|
|
|
|
}
|
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
|
for (SetUpTable setUpTable : list) {
|
|
|
|
|
if (StringUtils.isNotBlank(setUpTable.getPORTIP())) {
|
|
|
|
|
//路段号
|
|
|
|
|
Integer roadNo = setUpTable.getROADNO();
|
|
|
|
|
// 站编码
|
|
|
|
|
Integer staNo = setUpTable.getSTANO();
|
|
|
|
|
//paraId=2需要路段号和站编号(下发时根据路段号和站编号做替换)
|
|
|
|
|
if (paraId == 2) {
|
|
|
|
|
if (Constant.STR_ONE.equals(DBType)) {
|
|
|
|
|
sqlStr = cmsParameter.getSqlStr();
|
|
|
|
|
} else if (Constant.STR_TWO.equals(DBType)) {
|
|
|
|
|
sqlStr = cmsParameter.getOraStr();
|
|
|
|
|
} else if (Constant.STR_FOUR.equals(DBType)) {
|
|
|
|
|
sqlStr = cmsParameter.getOraStr();
|
|
|
|
|
String isNmgGs = PropertiesUtil.getValue("isNmgGs");
|
|
|
|
|
//判断是否是高路公司管辖指定的站系统
|
|
|
|
|
if(Constant.STR_ONE.equals(isNmgGs)){
|
|
|
|
|
// 获取所有唯一的 stano 值并拼接成字符串
|
|
|
|
|
String stanoString = list.stream()
|
|
|
|
|
.map(SetUpTable::getSTANO)
|
|
|
|
|
.distinct() // 去除重复
|
|
|
|
|
.map(Object::toString) // 转换为字符串
|
|
|
|
|
.collect(Collectors.joining(","));
|
|
|
|
|
if (paraId == 2) {
|
|
|
|
|
sqlStr = sqlStr.replace("%STANO%", stanoString);
|
|
|
|
|
}
|
|
|
|
|
List<Map<String, Object>> mapList = sysMapper.selectList(sqlStr);
|
|
|
|
|
CreateDbfUtil.createDbfFile(uuid, paraId, fileName, mapList, DownloadPath);
|
|
|
|
|
ZLibUtils.compressFile(DownloadPath + File.separator + fileName, DownloadPath + File.separator + newName, uuid);
|
|
|
|
|
//MD5
|
|
|
|
|
md5 = MD5Util.getMd5ByFilePath(DownloadPath + File.separator + newName);
|
|
|
|
|
String zlibName = newName.replace(Constant.STR_ZLIB, Constant.STR_ + md5 + Constant.STR_ZLIB);
|
|
|
|
|
String oldPath = DownloadPath + File.separator + newName;
|
|
|
|
|
String newPath = DownloadPath + File.separator + zlibName;
|
|
|
|
|
FileUtil.copyFile(oldPath, newPath);
|
|
|
|
|
//下载文件地址
|
|
|
|
|
downUrl = Constant.HTTP + ip + Constant.STR_COLON + tomcatPort + Constant.STR_SLASH + PathUtil.webName
|
|
|
|
|
+ Constant.INTERFACE_DOWN + EncryptionInfo.decodeLock(zlibName);
|
|
|
|
|
//回调地址
|
|
|
|
|
backUrl = Constant.HTTP + ip + Constant.STR_COLON + tomcatPort + Constant.STR_SLASH + PathUtil.webName
|
|
|
|
|
+ Constant.WEBSERVICE_BACK;
|
|
|
|
|
for (SetUpTable setUpTable : list) {
|
|
|
|
|
if (StringUtils.isNotBlank(setUpTable.getPORTIP())) {
|
|
|
|
|
//路段号
|
|
|
|
|
Integer roadNo = setUpTable.getROADNO();
|
|
|
|
|
// 站编码
|
|
|
|
|
Integer staNo = setUpTable.getSTANO();
|
|
|
|
|
//查询站的IP和程序的端口号
|
|
|
|
|
QueryWrapper<NameTableDcom> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.eq("ROADNO", roadNo)
|
|
|
|
|
.eq("STANO", staNo);
|
|
|
|
|
NameTableDcom nameTableDcom = nameTableDcomMapper.selectOne(queryWrapper);
|
|
|
|
|
unifiedMethod(uuid, nameTableDcom, setUpTable, lastNum, protocolType, man, decryptManNo,
|
|
|
|
|
fileName, paraName, isZlib, ip, downUrl, backUrl, md5, version, isDate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
for (SetUpTable setUpTable : list) {
|
|
|
|
|
if (StringUtils.isNotBlank(setUpTable.getPORTIP())) {
|
|
|
|
|
//路段号
|
|
|
|
|
Integer roadNo = setUpTable.getROADNO();
|
|
|
|
|
// 站编码
|
|
|
|
|
Integer staNo = setUpTable.getSTANO();
|
|
|
|
|
//paraId=2需要路段号和站编号(下发时根据路段号和站编号做替换)
|
|
|
|
|
if (paraId == 2) {
|
|
|
|
|
if (Constant.STR_ONE.equals(DBType)) {
|
|
|
|
|
sqlStr = cmsParameter.getSqlStr();
|
|
|
|
|
} else if (Constant.STR_TWO.equals(DBType)) {
|
|
|
|
|
sqlStr = cmsParameter.getOraStr();
|
|
|
|
|
} else if (Constant.STR_FOUR.equals(DBType)) {
|
|
|
|
|
sqlStr = cmsParameter.getOraStr();
|
|
|
|
|
}
|
|
|
|
|
Date now2 = new Date();
|
|
|
|
|
//FileUtil.delFile(new File(DownloadPath + File.separator + fileName));
|
|
|
|
|
version = DateTimeUtil.getFormateString(now2, Constant.MMDDHHMMSSSSS);
|
|
|
|
|
//version = staNo + DateTimeUtil.getFormateString(now2, Constant.YYMMDD);
|
|
|
|
|
newName = fileName.replace(Constant.STR_DBF, Constant.STR_) + version + Constant.STR_ZLIB;
|
|
|
|
|
String newFileName = fileName.replace(Constant.STR_DBF, Constant.STR_) + version + Constant.STR_DBF;
|
|
|
|
|
sqlStr = sqlStr.replace("%ROADNO%", String.valueOf(roadNo)).replace("%STANO%", String.valueOf(staNo));
|
|
|
|
|
List<Map<String, Object>> mapList = sysMapper.selectList(sqlStr);
|
|
|
|
|
CreateDbfUtil.createDbfFile(uuid, paraId, fileName, mapList, DownloadPath);
|
|
|
|
|
ZLibUtils.compressFile(DownloadPath + File.separator + fileName, DownloadPath + File.separator + newName, uuid);
|
|
|
|
|
//MD5
|
|
|
|
|
md5 = MD5Util.getMd5ByFilePath(DownloadPath + File.separator + newName);
|
|
|
|
|
String zlibName = newName.replace(Constant.STR_ZLIB, Constant.STR_ + md5 + Constant.STR_ZLIB);
|
|
|
|
|
String oldPath = DownloadPath + File.separator + newName;
|
|
|
|
|
String newPath = DownloadPath + File.separator + zlibName;
|
|
|
|
|
FileUtil.copyFile(oldPath, newPath);
|
|
|
|
|
//if (new File(oldPath).renameTo(new File(newPath))) {
|
|
|
|
|
//
|
|
|
|
|
//}
|
|
|
|
|
//下载文件地址
|
|
|
|
|
downUrl = Constant.HTTP + ip + Constant.STR_COLON + tomcatPort + Constant.STR_SLASH + PathUtil.webName
|
|
|
|
|
+ Constant.INTERFACE_DOWN + EncryptionInfo.decodeLock(zlibName);
|
|
|
|
|
//回调地址
|
|
|
|
|
backUrl = Constant.HTTP + ip + Constant.STR_COLON + tomcatPort + Constant.STR_SLASH + PathUtil.webName
|
|
|
|
|
+ Constant.WEBSERVICE_BACK;
|
|
|
|
|
//线程等待1秒
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(1000);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Date now2 = new Date();
|
|
|
|
|
//FileUtil.delFile(new File(DownloadPath + File.separator + fileName));
|
|
|
|
|
version = DateTimeUtil.getFormateString(now2, Constant.MMDDHHMMSSSSS);
|
|
|
|
|
//version = staNo + DateTimeUtil.getFormateString(now2, Constant.YYMMDD);
|
|
|
|
|
newName = fileName.replace(Constant.STR_DBF, Constant.STR_) + version + Constant.STR_ZLIB;
|
|
|
|
|
String newFileName = fileName.replace(Constant.STR_DBF, Constant.STR_) + version + Constant.STR_DBF;
|
|
|
|
|
sqlStr = sqlStr.replace("%ROADNO%", String.valueOf(roadNo)).replace("%STANO%", String.valueOf(staNo));
|
|
|
|
|
List<Map<String, Object>> mapList = sysMapper.selectList(sqlStr);
|
|
|
|
|
CreateDbfUtil.createDbfFile(uuid, paraId, fileName, mapList, DownloadPath);
|
|
|
|
|
ZLibUtils.compressFile(DownloadPath + File.separator + fileName, DownloadPath + File.separator + newName, uuid);
|
|
|
|
|
//MD5
|
|
|
|
|
md5 = MD5Util.getMd5ByFilePath(DownloadPath + File.separator + newName);
|
|
|
|
|
String zlibName = newName.replace(Constant.STR_ZLIB, Constant.STR_ + md5 + Constant.STR_ZLIB);
|
|
|
|
|
String oldPath = DownloadPath + File.separator + newName;
|
|
|
|
|
String newPath = DownloadPath + File.separator + zlibName;
|
|
|
|
|
FileUtil.copyFile(oldPath, newPath);
|
|
|
|
|
//if (new File(oldPath).renameTo(new File(newPath))) {
|
|
|
|
|
//
|
|
|
|
|
//序列号
|
|
|
|
|
//int lastNum = 1;
|
|
|
|
|
////先查询CMS_DOWNLOG_JAVA中下发的批次号
|
|
|
|
|
////判断当前是否是Oracle
|
|
|
|
|
//List<CmsDownLog> cmsDownLogs;
|
|
|
|
|
//if (Constant.STR_TWO.equals(DBType)) {
|
|
|
|
|
// cmsDownLogs = cmsDownLogMapper.selectListOracle(protocolType, isDate);
|
|
|
|
|
//} else {
|
|
|
|
|
// QueryWrapper<CmsDownLog> downLogQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
// downLogQueryWrapper.select("NUM").eq("PARAID", protocolType)
|
|
|
|
|
// .eq("DT", isDate)
|
|
|
|
|
// .lt("NUM", 10000);
|
|
|
|
|
// cmsDownLogs = cmsDownLogMapper.selectList(downLogQueryWrapper);
|
|
|
|
|
//}
|
|
|
|
|
//下载文件地址
|
|
|
|
|
downUrl = Constant.HTTP + ip + Constant.STR_COLON + tomcatPort + Constant.STR_SLASH + PathUtil.webName
|
|
|
|
|
+ Constant.INTERFACE_DOWN + EncryptionInfo.decodeLock(zlibName);
|
|
|
|
|
//回调地址
|
|
|
|
|
backUrl = Constant.HTTP + ip + Constant.STR_COLON + tomcatPort + Constant.STR_SLASH + PathUtil.webName
|
|
|
|
|
+ Constant.WEBSERVICE_BACK;
|
|
|
|
|
//线程等待1秒
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(1000);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//序列号
|
|
|
|
|
//int lastNum = 1;
|
|
|
|
|
////先查询CMS_DOWNLOG_JAVA中下发的批次号
|
|
|
|
|
////判断当前是否是Oracle
|
|
|
|
|
//List<CmsDownLog> cmsDownLogs;
|
|
|
|
|
//if (Constant.STR_TWO.equals(DBType)) {
|
|
|
|
|
// cmsDownLogs = cmsDownLogMapper.selectListOracle(protocolType, isDate);
|
|
|
|
|
//} else {
|
|
|
|
|
// QueryWrapper<CmsDownLog> downLogQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
// downLogQueryWrapper.select("NUM").eq("PARAID", protocolType)
|
|
|
|
|
// .eq("DT", isDate)
|
|
|
|
|
// .lt("NUM", 10000);
|
|
|
|
|
// cmsDownLogs = cmsDownLogMapper.selectList(downLogQueryWrapper);
|
|
|
|
|
//}
|
|
|
|
|
//if (cmsDownLogs != null && cmsDownLogs.size() > 0) {
|
|
|
|
|
// cmsDownLogs.sort(Comparator.comparing(CmsDownLog::getNum).reversed());
|
|
|
|
|
// lastNum = cmsDownLogs.get(0).getNum() + 1;
|
|
|
|
|
//}
|
|
|
|
|
//查询站的IP和程序的端口号
|
|
|
|
|
QueryWrapper<NameTableDcom> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.eq("ROADNO", roadNo)
|
|
|
|
|
.eq("STANO", staNo);
|
|
|
|
|
NameTableDcom nameTableDcom = nameTableDcomMapper.selectOne(queryWrapper);
|
|
|
|
|
unifiedMethod(uuid, nameTableDcom, setUpTable, lastNum, protocolType, man, decryptManNo,
|
|
|
|
|
fileName, paraName, isZlib, ip, downUrl, backUrl, md5, version, isDate);
|
|
|
|
|
//if (cmsDownLogs != null && cmsDownLogs.size() > 0) {
|
|
|
|
|
// cmsDownLogs.sort(Comparator.comparing(CmsDownLog::getNum).reversed());
|
|
|
|
|
// lastNum = cmsDownLogs.get(0).getNum() + 1;
|
|
|
|
|
//}
|
|
|
|
|
//查询站的IP和程序的端口号
|
|
|
|
|
QueryWrapper<NameTableDcom> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.eq("ROADNO", roadNo)
|
|
|
|
|
.eq("STANO", staNo);
|
|
|
|
|
NameTableDcom nameTableDcom = nameTableDcomMapper.selectOne(queryWrapper);
|
|
|
|
|
unifiedMethod(uuid, nameTableDcom, setUpTable, lastNum, protocolType, man, decryptManNo,
|
|
|
|
|
fileName, paraName, isZlib, ip, downUrl, backUrl, md5, version, isDate);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|