diff --git a/projects/fangjia-script/pom.xml b/projects/fangjia-script/pom.xml
index 17e32cbde..036189765 100644
--- a/projects/fangjia-script/pom.xml
+++ b/projects/fangjia-script/pom.xml
@@ -597,11 +597,11 @@
-
- mysql
- mysql-connector-java
- 8.0.33
-
+
+
+
+
+
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/NanjiangVillage.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/NanjiangVillage.groovy
index 76b670d6b..cc128d0cc 100644
--- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/NanjiangVillage.groovy
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/NanjiangVillage.groovy
@@ -11,7 +11,7 @@ class NanjiangVillage {
}
def run(){
- ExcelUtils.multiThreadingModify("D:\\数据\\南京银行\\县城清洗-结果.xlsx",{d->
+ ExcelUtils.multiThreadingModify("D:\\数据\\南京银行\\新地址核实(县城).xlsx",{d->
if(!d['F']){
def dto = OpenApiUtils.addrVerifyNanjing(null, d['A'], 2)
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy
index 4337e871e..a6240e4bd 100644
--- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy
@@ -10,10 +10,10 @@ class XiamenVillage {
}
def run(){
- ExcelUtils.multiThreadingModify("D:\\数据\\厦门\\涉农组织类型判定(to估家,2025-10-31)-以此为准.xlsx",{ d->
+ ExcelUtils.multiThreadingModify("D:\\数据\\厦门\\工业园区与涉农组织类型矛盾.xlsx",{ d->
if(!d['R']){
- def dto = OpenApiUtils.addrVerifyXiameng(null, d['B'], 2)
+ def dto = OpenApiUtils.addrVerifyXiameng(null, d['A'], 2)
if(dto){
// def dto = jsonObj.result
d['F'] = dto.province
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/RelatedTaiWanBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/RelatedTaiWanBatch.groovy
index 5cf2d132a..d04835c28 100644
--- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/RelatedTaiWanBatch.groovy
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/RelatedTaiWanBatch.groovy
@@ -18,7 +18,7 @@ import com.mongodb.DBCollection
*/
-//@BatchOwner(Watcher.GaoJuan)
+@BatchOwner(Watcher.GaoJuan)
class RelatedTaiWanBatch extends BaseBatch{
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy
new file mode 100644
index 000000000..ed8e73738
--- /dev/null
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy
@@ -0,0 +1,86 @@
+package com.fangjia.script.gj.xiamen
+
+import com.fangjia.script.BaseBatch
+import com.fangjia.script.gj.OpenApiUtils
+import com.fangjia.script.util.DateUtil
+import com.fangjia.script.util.ExcelUtils
+
+/**
+ * 厦门每月月初自动跑涉农数据
+ */
+class XiaMenVillageBatch extends BaseBatch{
+
+
+ static main(args) {
+ runBatch(new XiaMenVillageBatch(), args);
+ }
+
+ @Override
+ void process(Object args) {
+ def monthStr = DateUtil.formatByPattern(new Date(), "yyyy-MM");
+ def outFileName = "xmbank_"+monthStr+"_result.xlsx"
+ def inFileName = "xmbank_"+monthStr+".xlsx"
+ def exists = checkFileExists(outFileName)
+ if(!exists){
+ def rows = []
+ rows << ["序号","地址","判定后涉农组织类型(城市企业[不含县城企业]、农村企业、县城企业)","所属工业园区或经济开发区"]
+ def rets = XmBankVillageFtpUtils.readExcelFile(inFileName)
+ if(rets){
+ for(def row : rets){
+ if(row[1]){
+ def dto = OpenApiUtils.addrVerifyXiameng(null, row[1], 2)
+ if(dto){
+ row[2] = dto.addrArea //所属区域 农村区域 城市区域 县城城区(对公)
+ if(dto.devDistrictName){
+ row[3] = dto.devDistrictName//开发区
+ }else{
+ row[3] = ""
+ }
+
+ }
+ }
+ rows << row
+ }
+ }
+ uploadExcel(rows, outFileName)
+
+ }else{
+ println "已存在 "+ DateUtil.formatByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")
+ }
+
+ }
+
+ static boolean uploadExcel(def data, String fileName, String sheetName = "Sheet1") {
+ if (data == null || data.isEmpty()) {
+ println "数据为空,无法生成Excel"
+ return false
+ }
+
+ try {
+ // 1. 生成Excel内容
+ byte[] excelBytes = ExcelUtils.createExcelBytes(data, sheetName)
+
+ // 2. 上传到服务器
+ return XmBankVillageFtpUtils.uploadExcelBytes(excelBytes, fileName)
+
+ } catch (Exception e) {
+ println "生成并上传Excel失败: ${e.message}"
+ e.printStackTrace()
+ return false
+ }
+ }
+
+ def checkFileExists(def fileName){
+ def files = XmBankVillageFtpUtils.listOutFileNames()
+ def existsFlag = false
+ if(files){
+ for(def file : files){
+ if(file.filename == fileName){
+ existsFlag = true
+ break
+ }
+ }
+ }
+ return existsFlag
+ }
+}
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XmBankVillageFtpUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XmBankVillageFtpUtils.groovy
new file mode 100644
index 000000000..3f43e236e
--- /dev/null
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XmBankVillageFtpUtils.groovy
@@ -0,0 +1,127 @@
+package com.fangjia.script.gj.xiamen
+
+import com.fangjia.script.jiangnanblank.SFTP
+import com.fangjia.script.util.ExcelUtils
+import com.jcraft.jsch.ChannelSftp
+import org.apache.poi.ss.usermodel.Cell
+import org.apache.poi.ss.usermodel.Row
+import org.apache.poi.ss.usermodel.Sheet
+import org.apache.poi.ss.usermodel.Workbook
+import org.apache.poi.ss.usermodel.WorkbookFactory
+
+import java.nio.charset.Charset
+
+class XmBankVillageFtpUtils {
+ static def ftpServer = "192.168.0.86"
+ static def ftpPort = 17495
+ static def ftpUser = "xmbank"
+ static def ftpPassword = "Xmbank123!@#"
+ static def ftpPath = "/output/village_data"
+ static def ftpInPath = "/input/village"
+
+
+
+ static SFTP sftp = new SFTP();
+ static ChannelSftp sftpChannel = sftp.connect(ftpServer, ftpPort, ftpUser, ftpPassword);
+
+
+ static def ftpUpload(outputPath_dist, month){
+ //上传到ftp
+ sftpChannel = reConnect();
+ sftp.upload(ftpPath, outputPath_dist, sftpChannel);
+
+
+ }
+
+ static def reConnect(){
+ if(sftpChannel == null){
+ println "sftpChannel 为空,需重连....."
+ if(sftp == null){
+ sftp = new SFTP();
+ }
+ sftpChannel = sftp.connect(ftpServer, ftpPort, ftpUser, ftpPassword);
+ }else{
+ println "sftpChannel 正常....."
+ }
+ return sftpChannel;
+ }
+
+
+
+ static def listOutFileNames(){
+ //上传到ftp
+ sftpChannel = reConnect();
+ Vector files = sftp.listFiles(ftpPath+"/", sftpChannel);
+ return files
+ }
+
+ static def listInFileNames(){
+ //上传到ftp
+ sftpChannel = reConnect();
+ Vector files = sftp.listFiles(ftpInPath+"/", sftpChannel);
+ return files
+ }
+
+ static def getFileLength(String path, String month){
+ sftpChannel = reConnect();
+ def size = sftp.getFileSize(ftpPath+ month+"/"+path, sftpChannel)
+ return size
+ }
+
+ static def readExcelFile(String fileName) {
+ sftpChannel = reConnect()
+ try {
+ // 构建完整的远程路径
+ String fullRemotePath = ftpInPath + "/"+fileName
+ println "开始读取Excel文件: ${fullRemotePath}"
+ // 从SFTP服务器获取文件流
+ InputStream inputStream = sftpChannel.get(fullRemotePath)
+ def excelData = ExcelUtils.readFromStream(inputStream, 0, 1)
+ println "Excel共有 ${excelData.size()} 行数据"
+ inputStream.close()
+ return excelData
+ } catch (Exception e) {
+ println "读取Excel文件失败: ${e.message}"
+ e.printStackTrace()
+ return null
+ }
+ }
+
+
+ /**
+ * 上传Excel字节数组到服务器
+ * @param excelBytes Excel字节数组
+ * @param fileName 文件名
+ * @return 上传是否成功
+ */
+ private static boolean uploadExcelBytes(byte[] excelBytes, String fileName) {
+ sftpChannel = reConnect()
+
+ try {
+ // 构建完整的远程路径
+ String remoteFilePath = "${ftpPath}/${fileName}"
+
+ println "开始上传Excel文件到: ${remoteFilePath}"
+ println "文件大小: ${excelBytes.length} 字节"
+
+ // 将字节数组转换为输入流
+ InputStream inputStream = new ByteArrayInputStream(excelBytes)
+
+ // 上传文件
+ sftpChannel.put(inputStream, remoteFilePath)
+
+ // 关闭流
+ inputStream.close()
+
+ println "Excel文件上传成功: ${remoteFilePath}"
+
+ return true
+
+ } catch (Exception e) {
+ println "上传Excel文件失败: ${e.message}"
+ e.printStackTrace()
+ return false
+ }
+ }
+
+}
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/TestEvaluation.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/TestEvaluation.groovy
index aafc471e4..c92f34b28 100644
--- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/TestEvaluation.groovy
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/TestEvaluation.groovy
@@ -39,13 +39,13 @@ class TestEvaluation {
// task.newAndOldMatch()
// task.addFjwToBprice("D:\\数据\\宏信息\\宏信房源台账-价格.xlsx")
-// task.addAreaFactor()
+ task.addAreaFactor()
// task.addOptName()
// task.addDistId()
// task.addEvaluationToDB()
- task.addEvaluationDetail()
+// task.addEvaluationDetail()
}
def houseSimilar(){
@@ -298,7 +298,7 @@ class TestEvaluation {
def addAreaFactor(){
- ExcelUtils.multiThreadingModify("D:\\数据\\宏信息\\宏信房源台账-基准价(含ID).xlsx",{d->
+ ExcelUtils.multiThreadingModify("D:\\数据\\宏信息\\(红色)宏信估值详情-最新0106.xlsx",{d->
if(d['I'] && d['J'] && d['K']){
def dist = CommonDatautils.findDistrictById(d['I'])
if(dist){
@@ -314,6 +314,11 @@ class TestEvaluation {
// }
// d['L']=(int)(d['J']*d['K'])
// d['N'] = (int)(d['L'] + d['L']*d['M'])
+ def obj = CommonDatautils.queryDistrictPriceData(dist.city, dist.region, dist.name)
+ if(obj && obj.avg_price_2b){
+ d['M'] = obj.avg_price_2b
+ d['L'] = (int)(obj.avg_price_2b * d['K'])
+ }
}
}
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy
index 50882747b..43265e606 100644
--- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy
@@ -11,6 +11,7 @@ import org.apache.poi.ss.usermodel.*
import org.apache.poi.ss.util.CellRangeAddress
import org.apache.poi.ss.util.RegionUtil
import org.apache.poi.xssf.streaming.SXSSFWorkbook
+import org.apache.poi.xssf.usermodel.XSSFWorkbook
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
@@ -103,6 +104,50 @@ public class ExcelUtils{
}
+ public static List> readFromStream(def inp,int sheetIndex = 0,int skipRow = 1){
+ List> ret = new ArrayList>();
+ try {
+ Workbook workbook = WorkbookFactory.create(inp)
+ workbook.setForceFormulaRecalculation(true)
+ Sheet sheet = workbook.getSheetAt(sheetIndex);
+ //行号
+ int rowIndex = 0;
+ for(Row row : sheet){
+ rowIndex ++
+ if(rowIndex <= skipRow){
+ continue;
+ }
+ short minColIx = 0;
+ short maxColIx = row.getLastCellNum();
+ List