Merge branch 'master' of http://gitlab.fangjia.com/dev0/main into script_gj
This commit is contained in:
+6
@@ -57,6 +57,12 @@ class CcbFtpUtils {
|
||||
ftpUpload(dataCodeFileName)//上传加密码文件到FTP
|
||||
}
|
||||
|
||||
static def listFileNames(month){
|
||||
//上传到ftp
|
||||
sftpChannel = reConnect();
|
||||
Vector files = sftp.listFiles(ftpPath+ month+"/", sftpChannel);
|
||||
return files
|
||||
}
|
||||
|
||||
static main(args) {
|
||||
|
||||
|
||||
+23
@@ -3,8 +3,10 @@ package com.fangjia.script.ccbevaluation
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.ccb.FileUtils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.jcraft.jsch.ChannelSftp
|
||||
import groovy.sql.Sql
|
||||
import com.fangjia.script.ccbevaluation.ronghe.SSHHelper
|
||||
import org.apache.commons.codec.digest.DigestUtils
|
||||
|
||||
class ExportOracleEvaluationData {
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
@@ -33,6 +35,8 @@ class ExportOracleEvaluationData {
|
||||
exportCommCaseDetailGj(curMonth)
|
||||
|
||||
def curDate = curMonth.toString()+"28"
|
||||
// 生成MD5文件
|
||||
exportMd5()
|
||||
SSHHelper jschCommand = new SSHHelper();
|
||||
System.out.println(jschCommand.executeCommand("sh /home/ccb/output/gz_package.sh ${curDate}"));
|
||||
// ok文件
|
||||
@@ -413,4 +417,23 @@ class ExportOracleEvaluationData {
|
||||
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完成......"
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -199,18 +199,18 @@ class CcbCodeUtils {
|
||||
static def getBuildStructureCode(def buildStructure){
|
||||
if(buildStructure){
|
||||
if(buildStructure.contains("钢结构")){
|
||||
return "001";
|
||||
return "3";
|
||||
}else if(buildStructure.contains("钢、钢筋混凝土结构")){
|
||||
return "002";
|
||||
return "1";
|
||||
}else if(buildStructure.contains("钢筋混凝土结构")){
|
||||
return "003";
|
||||
return "1";
|
||||
}else if(buildStructure.contains("砖木结构")){
|
||||
return "004";
|
||||
return "10";
|
||||
}else if(buildStructure.contains("混合结构")){
|
||||
return "005";
|
||||
return "2";
|
||||
}
|
||||
}
|
||||
return "006";
|
||||
return "11";
|
||||
}
|
||||
|
||||
static def getDistHouseTypeCode(def estateType){
|
||||
|
||||
@@ -50,4 +50,32 @@ class FileUtils {
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,11 +92,6 @@ public class DbUtils{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void executeQueryOnSeawater(BasicDBObject query,Closure c, BasicDBObject fields = null){
|
||||
seawater.find(query,fields).batchSize(10000).each(c)
|
||||
}
|
||||
|
||||
public static void executeQueryOnSeaweed(BasicDBObject query,Closure c, BasicDBObject fields = null){
|
||||
SEAWEED_SLAVE.find(query,fields).batchSize(1000).each(c)
|
||||
}
|
||||
@@ -171,10 +166,6 @@ public class DbUtils{
|
||||
return SEAWEED_SLAVE.findOne(query,fields);
|
||||
}
|
||||
|
||||
public static int executeCountOnSeawater(BasicDBObject query){
|
||||
return seawater.count(query);
|
||||
}
|
||||
|
||||
public static BasicDBObject buildSeaweedQuery(def city = null, def region = null, def name = null, def cat = "district", def visible = 0){
|
||||
BasicDBObject query = new BasicDBObject()
|
||||
if(city){
|
||||
@@ -387,31 +378,6 @@ public class DbUtils{
|
||||
return district.lat && district.lng && district.lng > 0 && district.lat > 0
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录修改小区库的操作日志
|
||||
* @param city
|
||||
* @param region
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
def static saveDeleteLog(String city, String region,String name,String category,int status){
|
||||
if(status!=1){
|
||||
return
|
||||
}
|
||||
DBObject obj = new BasicDBObject()
|
||||
obj.put("city", city);
|
||||
obj.put("region", region);
|
||||
obj.put("district_name", name);
|
||||
obj.put("category" , category)
|
||||
obj.put("origin" , "脚本")
|
||||
if(status==1){
|
||||
obj.put("type" , "remove")
|
||||
}
|
||||
obj.put("c_date" , new Date())
|
||||
obj.put("m_date" , new Date())
|
||||
OPERATION_LOG.save(obj)
|
||||
}
|
||||
|
||||
public static DBCollection getCollection(String host, int port, String dbName ,String collName){
|
||||
def collection = COLL_CACHE["${host}#${port}#${dbName}#${collName}"]
|
||||
if(!collection){
|
||||
|
||||
Reference in New Issue
Block a user