Merge branch 'feature_master_xh_standard' into 'master'
估值供数新增MD5加密文件 See merge request !298
This commit is contained in:
+6
@@ -57,6 +57,12 @@ class CcbFtpUtils {
|
|||||||
ftpUpload(dataCodeFileName)//上传加密码文件到FTP
|
ftpUpload(dataCodeFileName)//上传加密码文件到FTP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static def listFileNames(month){
|
||||||
|
//上传到ftp
|
||||||
|
sftpChannel = reConnect();
|
||||||
|
Vector files = sftp.listFiles(ftpPath+ month+"/", sftpChannel);
|
||||||
|
return files
|
||||||
|
}
|
||||||
|
|
||||||
static main(args) {
|
static main(args) {
|
||||||
|
|
||||||
|
|||||||
+23
@@ -3,8 +3,10 @@ package com.fangjia.script.ccbevaluation
|
|||||||
import com.fangjia.script.commData.CommonDatautils
|
import com.fangjia.script.commData.CommonDatautils
|
||||||
import com.fangjia.script.gj.ccb.FileUtils
|
import com.fangjia.script.gj.ccb.FileUtils
|
||||||
import com.fangjia.script.util.DateUtils
|
import com.fangjia.script.util.DateUtils
|
||||||
|
import com.jcraft.jsch.ChannelSftp
|
||||||
import groovy.sql.Sql
|
import groovy.sql.Sql
|
||||||
import com.fangjia.script.ccbevaluation.ronghe.SSHHelper
|
import com.fangjia.script.ccbevaluation.ronghe.SSHHelper
|
||||||
|
import org.apache.commons.codec.digest.DigestUtils
|
||||||
|
|
||||||
class ExportOracleEvaluationData {
|
class ExportOracleEvaluationData {
|
||||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||||
@@ -33,6 +35,8 @@ class ExportOracleEvaluationData {
|
|||||||
exportCommCaseDetailGj(curMonth)
|
exportCommCaseDetailGj(curMonth)
|
||||||
|
|
||||||
def curDate = curMonth.toString()+"28"
|
def curDate = curMonth.toString()+"28"
|
||||||
|
// 生成MD5文件
|
||||||
|
exportMd5()
|
||||||
SSHHelper jschCommand = new SSHHelper();
|
SSHHelper jschCommand = new SSHHelper();
|
||||||
System.out.println(jschCommand.executeCommand("sh /home/ccb/output/gz_package.sh ${curDate}"));
|
System.out.println(jschCommand.executeCommand("sh /home/ccb/output/gz_package.sh ${curDate}"));
|
||||||
// ok文件
|
// ok文件
|
||||||
@@ -413,4 +417,23 @@ class ExportOracleEvaluationData {
|
|||||||
CcbFtpUtils.ftpUpload(null, dataCodeFileName, curDate)
|
CcbFtpUtils.ftpUpload(null, dataCodeFileName, curDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def exportMd5(){
|
||||||
|
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
|
||||||
|
Vector files = CcbFtpUtils.listFileNames(curDate)
|
||||||
|
Iterator fileVec = files.iterator()
|
||||||
|
def fileRows = []
|
||||||
|
while(fileVec.hasNext()){
|
||||||
|
ChannelSftp.LsEntry file = fileVec.next()
|
||||||
|
if(org.apache.commons.lang.StringUtils.isNotBlank(file.getFilename()) && file.getFilename().endsWith(".dat")){
|
||||||
|
fileRows << file.getFilename() +":"+ DigestUtils.md5Hex(file.getFilename())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def fileName = "/ccb/md5.txt"
|
||||||
|
if(CommonDatautils.isWindow()){
|
||||||
|
fileName = "D:\\房价网\\md5.txt"
|
||||||
|
}
|
||||||
|
FileUtils.createTxtFile(fileRows, fileName, "utf-8", false);
|
||||||
|
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||||
|
println "md5.txt 上传Ftp完成......"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,4 +50,32 @@ class FileUtils {
|
|||||||
}
|
}
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static def createTxtFile(ret, fileName, charset, isAppend){
|
||||||
|
File file = new File(fileName);
|
||||||
|
if (!file.getParentFile().exists()) {
|
||||||
|
boolean result = file.getParentFile().mkdirs();
|
||||||
|
if (!result) {
|
||||||
|
System.out.println("´´½¨Ä¿Â¼Ê§°Ü");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputStream out = new FileOutputStream(fileName, isAppend);
|
||||||
|
def sb = new StringBuffer();
|
||||||
|
out.write(sb.toString().getBytes(charset));
|
||||||
|
sb.setLength(0)
|
||||||
|
def index = 0
|
||||||
|
for(def row : ret){
|
||||||
|
if(row){
|
||||||
|
index++
|
||||||
|
sb.append(row)
|
||||||
|
sb.append("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(sb.length()>0){
|
||||||
|
out.write(sb.toString().getBytes(charset));
|
||||||
|
sb.setLength(0)
|
||||||
|
}
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user