新增建行86测试
This commit is contained in:
+1171
File diff suppressed because it is too large
Load Diff
+61
@@ -6,6 +6,7 @@ import com.fangjia.script.gj.ccb.FileUtils
|
||||
import com.fangjia.script.gj.district.FangjiaClientUtils
|
||||
import com.fangjia.script.lixue.util.DBUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
@@ -21,6 +22,66 @@ class AddressCut extends BaseBatch{
|
||||
|
||||
@Override
|
||||
public void process(Object args) {
|
||||
sameAddr()
|
||||
}
|
||||
|
||||
def sameAddr() {
|
||||
def citys = CommonDatautils.findAllCity()
|
||||
def dataMap = [:]
|
||||
def index = 0
|
||||
for (def c : citys) {
|
||||
index++
|
||||
def dists = CommonDatautils.findAllDistrictByCity(c, "district", ["city", "region", "name", "address"])
|
||||
|
||||
def addrMap = [:]
|
||||
for (def dist : dists) {
|
||||
if (dist.address) {
|
||||
def rets = addrMap.get(dist.address)
|
||||
if (!rets) {
|
||||
rets = []
|
||||
}
|
||||
rets << dist
|
||||
addrMap.put(dist.address, rets)
|
||||
}
|
||||
}
|
||||
dataMap.put(c, addrMap)
|
||||
println index +" "+c
|
||||
}
|
||||
|
||||
|
||||
def sameAddrList = []
|
||||
for(def c : citys) {
|
||||
def cityMap = dataMap.get(c)
|
||||
if(cityMap){
|
||||
cityMap.each{addr,rets->
|
||||
if(rets && rets.size()>1){
|
||||
def keys = new HashSet()
|
||||
for(def d : rets){
|
||||
if(d.name){
|
||||
def name = d.name.replace("一期","").replace("二期","").replace("三期","").replace("四期","").replace("五期","").replace("六期","").replace("七期","").replace("八期","").replace("九期","").replace("十期","").replace("一区","").replace("二区","").replace("三区","").replace("四区","").replace("五区","").replace("六区","").replace("七区","").replace("八区","").replace("九区","").replace("十区","").replace("A区","").replace("B区","").replace("C区","").replace("D区","")
|
||||
.replace("十一街区","").replace("十二街区","").replace("十三街区","").replace("十四街区","").replace("十五街区","").replace("十六街区","").replace("十七街区","").replace("十八街区","").replace("十九街区","").replace("一街区","").replace("二街区","").replace("三街区","").replace("四街区","").replace("五街区","").replace("六街区","").replace("七街区","").replace("八街区","").replace("九街区","").replace("十街区","")
|
||||
.replace("公寓","").replace("别墅","").replace("商住楼","").replace("花园","").replace("南区","").replace("北区","").replace("东区","").replace("西区","")
|
||||
keys << d.region +"##"+ name
|
||||
}
|
||||
}
|
||||
if(keys && keys.size()>1){
|
||||
for(def d : rets) {
|
||||
if (d.name) {
|
||||
sameAddrList << [d.city, d.region, d.name, d.address]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//ExcelUtils.write("D:\\数据\\小区\\同地址小区.xlsx", sameAddrList, "相同地址小区")
|
||||
FileUtils.batchCreateFile(sameAddrList, "D:\\数据\\小区\\同地址小区.txt", null, "utf-8", false);
|
||||
println "完成"
|
||||
}
|
||||
|
||||
|
||||
def addrCut(){
|
||||
def citys = CommonDatautils.findAllCity()
|
||||
def index = 0
|
||||
|
||||
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package com.fangjia.script.ccbevaluation.ronghe
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import com.jcraft.jsch.ChannelExec;
|
||||
import com.jcraft.jsch.JSch;
|
||||
import com.jcraft.jsch.Session
|
||||
|
||||
import com.jcraft.jsch.*;
|
||||
|
||||
|
||||
class SSHHelperTest {
|
||||
|
||||
private Session session = null;
|
||||
private Channel channel = null;
|
||||
|
||||
private String sftpHost = "192.168.0.86";
|
||||
private int sftpPort = 17495;
|
||||
private String sftpUserName = "ccb";
|
||||
private String sftpPassword = "ccb!@#";
|
||||
private int timeout = 30000;
|
||||
/**
|
||||
* 获取连接
|
||||
* @return
|
||||
*/
|
||||
private ChannelExec getChannelExec() {
|
||||
try {
|
||||
if (channel != null && channel.isConnected()) {
|
||||
return (ChannelExec) channel;
|
||||
}
|
||||
JSch jSch = new JSch();
|
||||
if (session == null || !session.isConnected()) {
|
||||
session = jSch.getSession(sftpUserName, sftpHost, sftpPort);
|
||||
session.setPassword(sftpPassword);
|
||||
Properties config = new Properties();
|
||||
config.put("StrictHostKeyChecking", "no");
|
||||
session.setConfig(config);
|
||||
session.setTimeout(timeout);
|
||||
session.connect();
|
||||
}
|
||||
channel = session.openChannel("exec");
|
||||
} catch (Exception e) {
|
||||
if (session != null) {
|
||||
session.disconnect();
|
||||
session = null;
|
||||
}
|
||||
channel = null;
|
||||
}
|
||||
return channel == null ? null : (ChannelExec) channel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭连接
|
||||
*/
|
||||
private void closeChannel() {
|
||||
try {
|
||||
if (channel != null) {
|
||||
channel.disconnect();
|
||||
channel = null;
|
||||
}
|
||||
if (session != null) {
|
||||
session.disconnect();
|
||||
session = null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行服务器端命令
|
||||
*/
|
||||
public boolean executeCommand(String command) {
|
||||
boolean flag = false;
|
||||
ChannelExec channelExec = getChannelExec();
|
||||
if (channelExec == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
channelExec.setInputStream(null);
|
||||
channelExec.setErrStream(System.err);
|
||||
channelExec.setCommand(command);
|
||||
|
||||
InputStream ins = channelExec.getInputStream();
|
||||
channelExec.connect();
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(ins, "utf-8"));
|
||||
String line = null;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
System.out.println(line);
|
||||
}
|
||||
|
||||
reader.close();
|
||||
closeChannel();
|
||||
|
||||
flag = true;
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
flag = false;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SSHHelperTest jschCommand = new SSHHelperTest();
|
||||
System.out.println(jschCommand.executeCommand("sh /home/ccb_rh/output/package.sh 20220110"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user