Compare commits

..

75 Commits

Author SHA1 Message Date
王文艳 9dd8e2e9c4 Use numeric build number for asset version 2026-10-27 21:07:13 +08:00
王文艳 721277a84b Use build version for static assets 2026-10-27 21:00:13 +08:00
王文艳 b6166e2e79 Fix duplicate Elasticsearch JDBC driver 2026-10-27 18:26:53 +08:00
王文艳 9e729f5366 fix(deploy): use projects/fangjia-script/target/fangjia-script.jar for scp 2026-09-30 21:19:31 +08:00
王文艳 e6eb4d5c03 fix(deploy): fix docker compose directory and jar package path in Jenkinsfile for fangjia-script 2026-09-30 21:14:47 +08:00
王文艳 f9967af738 修复厦门数据跑批脚本 2026-09-30 21:05:56 +08:00
王文艳 40b7c67b34 修复厦门数据跑批脚本 2026-09-30 20:58:04 +08:00
王文艳 22effa754b 修复厦门数据跑批脚本 2026-09-30 20:50:33 +08:00
王文艳 0691235b69 修复厦门数据跑批脚本 2026-09-30 20:48:53 +08:00
王文艳 77d2ec0527 添加AI支持 2026-09-20 13:56:27 +08:00
王文艳 c3d0a39eff 添加AI支持 2026-09-11 09:10:55 +08:00
王文艳 f6cd5acbc3 修改月度均价定时任务 2026-09-07 18:09:19 +08:00
王文艳 90618f96b0 feat: 对公涉农接口支持AI配置与透传,API后台支持配置对公涉农启用AI 2026-09-04 10:37:51 +08:00
王文艳 cfb3e4aa74 地址不全接口添加地址有效性判定 2026-09-03 11:26:25 +08:00
王文艳 d33bb1c75c POI缓存key升版v2,作废坐标未截断的旧缓存
Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-16 21:08:35 +08:00
王文艳 7665e2f3ce 小区周边配套(facilities)切换高德POI数据源并优化性能
- searchNearbyPoi改查ES高德POI(didata_map_poi_2024),按secondary_type中类过滤
- POI类型映射兼容高德分类:small_type精确匹配+secondary_type中类兜底
- 新增排除集合AROUND_EXCLUDE_TYPES:过滤ATM/培训机构/诊所/泛中餐厅/快餐厅等噪音类型
- 高德GCJ-02坐标转百度BD-09输出,经纬度保留6位小数
- 性能优化:批量12小区ES查询并行化、ES结果加缓存(MIDDLE)、ES客户端连接池单例复用、geo_distance只放filter
- BaiduPlacePoi实现Serializable支持缓存序列化

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-16 20:51:11 +08:00
王文艳 548671668f 优化 Jenkinsfile SSH 部署方式
- 统一使用 sshagent + 密钥认证替代 sshpass + 密码认证
- 所有项目使用统一的 SSH 凭证 deploy-server-ssh
- 修复 SSH 命令引号闭合问题,改用单行命令格式
- 移除 PROJECT_CONFIG 中的 sshCredId 字段,新增 deployUser 字段

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-14 16:33:30 +08:00
王文艳 9287511308 统一管理 - 所有项目使用同一个 SSH 密钥凭证 deploy-server-ssh 2026-08-14 16:29:22 +08:00
王文艳 f3e7f977c2 优化第三方均价 2026-08-14 15:24:10 +08:00
王文艳 0141feb67e 修改写字楼估值逻辑-无样本也估值 2026-08-07 16:14:47 +08:00
王文艳 8da41233f5 修复fangjia-coresite依赖配置和SLF4J版本冲突
- 为sothis-core依赖添加compile scope,确保运行时可用
- 强制统一SLF4J版本为1.7.25,解决版本冲突
- 解决CXF 2.2.3引入旧版slf4j-api与nacos-client的jcl-over-slf4j 1.7.x冲突
- 确保应用启动时不再出现SLF4J版本不兼容错误

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-07 10:47:14 +08:00
王文艳 edfcc031fc 修复sothis-core依赖配置,解决运行时类找不到问题
- 将sothis-core版本从0.2.0改为0.1.0-SNAPSHOT,与sothis-web保持版本一致
- 移除provided scope,确保sothis-core被包含在WAR包中
- 解决运行时Closure.class等类找不到的FileNotFoundException
- 确保与正常工作的fangjia-open项目使用相同的依赖版本

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-07 10:22:28 +08:00
王文艳 29d91a6e05 修复sothis-core依赖版本冲突
- 将sothis-core版本从0.1.0-SNAPSHOT升级到0.2.0
- 添加provided scope,避免与fangjia-service传递依赖冲突
- 解决SLF4J版本不兼容问题
- 修复应用启动时的依赖冲突错误

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-07 10:13:10 +08:00
王文艳 d9d7a1d115 优化Jenkins流水线配置
- 修改agent配置为any,提高流水线灵活性
- 添加构建历史清理策略,保留最近3次或30天内的构建记录
- 优化磁盘空间使用,避免构建记录无限增长

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-07 10:00:23 +08:00
王文艳 46ec261e7b 修复Jenkins部署流水线SSH连接问题
- 在所有SSH/SCP命令中添加HostKeyAlgorithms和PubkeyAcceptedAlgorithms参数
- 解决"Unable to negotiate with server: no matching host key type found"错误
- 支持连接仅支持ssh-rsa算法的旧版SSH服务器
- 确保Jenkins自动化部署流程正常工作

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-07 09:39:29 +08:00
王文艳 34a18bf416 修复fangjia-coresite编译错误,添加sothis-core依赖
- 在fangjia-coresite的pom.xml中添加sothis-core依赖
- 解决编译时org.sothis.core.util包找不到的问题
- 该依赖包含Closure、CollectionUtils、Pager等工具类

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-07 09:28:24 +08:00
王文艳 d76a88bc3e 修改平米租金计算任务 2026-08-05 15:56:38 +08:00
王文艳 b0b24eec0a 添加月度均价定时任务 2026-08-05 08:22:31 +08:00
王文艳 5bf3fb3911 添加月度均价定时任务 2026-07-01 17:38:01 +08:00
王文艳 78680222d6 添加月度均价定时任务 2026-07-01 09:17:05 +08:00
王文艳 a3b14dfe56 添加月度均价定时任务 2026-06-29 18:03:05 +08:00
王文艳 a6a6a57385 添加月度均价定时任务 2026-06-23 15:10:30 +08:00
王文艳 5dfa6d8432 添加月度均价定时任务 2026-06-18 19:56:36 +08:00
王文艳 4e3fb46c62 添加月度均价定时任务 2026-06-18 19:55:47 +08:00
王文艳 3c10c22dc3 添加月度均价定时任务 2026-06-18 15:30:19 +08:00
王文艳 23d26b75f8 添加月度均价定时任务 2026-06-18 15:28:10 +08:00
王文艳 7eb3b10b56 添加月度均价定时任务 2026-06-18 08:59:00 +08:00
王文艳 746d39660a 修改接口bug 2026-06-12 21:05:06 +08:00
王文艳 743dc638e9 修改接口bug 2026-06-12 20:51:27 +08:00
王文艳 527dc0f6af 优化写字楼接口 2026-06-02 19:13:22 +08:00
王文艳 8a34a355ae 优化写字楼接口 2026-06-02 11:41:28 +08:00
王文艳 1b9373bb0c 优化写字楼接口 2026-06-02 10:40:07 +08:00
王文艳 6f08f9ad76 移除厦门银行定时任务 2026-06-01 15:36:22 +08:00
王文艳 3d944d5f67 fix bug 2026-06-01 15:16:18 +08:00
王文艳 d5ac4baa1d 修改字符编码 2026-06-01 14:47:42 +08:00
王文艳 9b84cd2da4 修改字符编码 2026-06-01 14:35:23 +08:00
王文艳 03aa02f02e 修改字符编码 2026-06-01 14:34:17 +08:00
王文艳 bb1abadb11 修改字符编码 2026-05-24 10:36:14 +08:00
王文艳 f17775995d 更新jenkinsfile 2026-05-24 09:35:17 +08:00
王文艳 7c7f38ef7c 更新jenkinsfile 2026-05-24 09:13:41 +08:00
王文艳 5f3d10043b 更新jenkinsfile 2026-05-24 09:02:02 +08:00
王文艳 cb3e20c057 更新jenkinsfile 2026-05-24 08:55:43 +08:00
王文艳 eee5f00c3f 更新jenkinsfile 2026-05-24 07:20:42 +08:00
王文艳 5a5ffe8aac 优化代码 2026-05-23 23:04:36 +08:00
王文艳 70a8c8a843 优化代码 2026-05-23 22:56:17 +08:00
王文艳 e96a763731 优化脚本 2026-05-23 22:45:30 +08:00
王文艳 c2ecde7d4c 优化Jenkins 2026-05-23 22:34:05 +08:00
王文艳 2d79b6cb98 优化Script 2026-05-23 22:31:51 +08:00
王文艳 8c947dbd51 修改定时任务 2026-05-23 22:07:44 +08:00
王文艳 5f6011a29a 修改Dockerfile 2026-05-23 21:54:38 +08:00
王文艳 749125d3b7 更新Dockerfile 2026-05-23 20:51:29 +08:00
王文艳 f9a6ddef0d 更新jenkinsfile 2026-05-23 20:39:44 +08:00
王文艳 156b22c73b 更新jenkinsfile 2026-05-23 20:30:13 +08:00
王文艳 9f6e471127 更新jenkinsfile 2026-05-23 20:14:20 +08:00
王文艳 df1f1db03f 优化jenkins 2026-05-20 10:50:36 +08:00
王文艳 225e4e808d 优化jenkins 2026-05-20 10:42:29 +08:00
王文艳 fbd9ddf3a4 添加FangJiaScript 2026-05-20 10:09:30 +08:00
王文艳 66a9819b8c 更新公司图片 2026-05-20 08:16:04 +08:00
王文艳 5f26f3df88 更新jenkins 2026-05-19 22:00:42 +08:00
王文艳 e7a3010727 更新jenkins 2026-05-19 21:52:57 +08:00
王文艳 5059543d31 更新ssh 2026-05-19 21:31:58 +08:00
王文艳 82ff6006af 优化房价构建文件 2026-05-19 21:18:02 +08:00
王文艳 ab3a49639a 更新jenkinsfile 2026-05-19 20:50:58 +08:00
王文艳 34ceea53f9 更新jenkinsfuke 2026-05-19 20:45:55 +08:00
王文艳 81503d0c62 修改配置文件 2026-05-19 18:43:08 +08:00
51 changed files with 1307 additions and 294 deletions
+29 -1
View File
@@ -7,7 +7,35 @@
"Bash(npm install:*)", "Bash(npm install:*)",
"Bash(node generate_doc.js:*)", "Bash(node generate_doc.js:*)",
"Bash(xargs grep:*)", "Bash(xargs grep:*)",
"Bash(node:*)" "Bash(node:*)",
"Bash(find \"C:\\\\Users\\\\wenyan\\\\IdeaProjects\\\\main\\\\projects\\\\fangjia-script\\\\src\\\\main\\\\groovy\\\\com\\\\fangjia\\\\script\" -type f -name \"*.groovy\")",
"Read(//tmp/**)",
"Bash(cat)",
"Bash(chmod +x /tmp/search_scripts.sh)",
"Bash(/tmp/search_scripts.sh)",
"Bash(chmod +x /tmp/search_by_content.sh)",
"Bash(/tmp/search_by_content.sh)",
"Bash(chmod +x /tmp/search_all.sh)",
"Bash(/tmp/search_all.sh)",
"Bash(chmod +x /tmp/extract_classes.sh)",
"Bash(/tmp/extract_classes.sh)",
"Bash(curl -s -m 10 -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search\" -H \"Content-Type: application/json\" -d '{\"size\":0,\"aggs\":{\"types\":{\"terms\":{\"field\":\"small_type\",\"size\":200}}}}')",
"Bash(curl -s -m 15 -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search\" -H \"Content-Type: application/json\" -d '{\"size\":0,\"aggs\":{\"types\":{\"terms\":{\"field\":\"small_type\",\"size\":300}}}}' -o /tmp/es_types.json)",
"Bash(echo \"exit=$?\")",
"Bash(curl -s -m 15 -v -u elastic:elasticsearch \"http://192.168.0.89:9200/\")",
"Bash(curl -s -m 15 --noproxy '*' -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search\" -H \"Content-Type: application/json\" -d '{\"size\":0,\"aggs\":{\"types\":{\"terms\":{\"field\":\"small_type\",\"size\":300}}}}' -o /tmp/es_types.json)",
"Bash(python -c ' *)",
"Bash(curl -s -m 30 --noproxy '*' -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search\" -H \"Content-Type: application/json\" -d '{\"size\":0,\"aggs\":{\"types\":{\"terms\":{\"field\":\"small_type\",\"size\":3000}}}}' -o /tmp/es_types_all.json)",
"Bash(curl -s -m 60 --noproxy '*' -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search\" -H \"Content-Type: application/json\" -d '{\"size\":0,\"aggs\":{\"types\":{\"terms\":{\"field\":\"small_type\",\"size\":3000}}}}' -o es_types_all.json)",
"Bash(curl -s -m 15 --noproxy '*' -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search?size=1\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"small_type\":\"小学\"}}}')",
"Bash(curl -s -m 15 --noproxy '*' -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search?size=1\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"small_type\":\"小学\"}}}' -o /tmp/es_doc.json)",
"Bash(curl -s -m 15 --noproxy '*' -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search?size=2\" -o /tmp/es_doc.json)",
"Bash(python -X utf8 -c ' *)",
"Bash(curl -s -m 15 --noproxy '*' -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search?size=2\" -o es_doc.json)",
"Bash(python -X utf8 -)",
"Bash(awk 'NR>=351 && NR<=630' \"projects\\\\fangjia-open\\\\src\\\\main\\\\java\\\\com\\\\fangjia\\\\open\\\\controllers\\\\PropertyController.java\")",
"Bash(awk 'NR>=351 && NR<=560 && / };/{print NR\": \"$0; exit}' \"projects\\\\fangjia-open\\\\src\\\\main\\\\java\\\\com\\\\fangjia\\\\open\\\\controllers\\\\PropertyController.java\")",
"Bash(mvn compile *)"
] ]
} }
} }
Vendored
+167 -34
View File
@@ -1,70 +1,195 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
// 每个项目的完整部署配置字典,新增项目只需在此添加一条记录
// buildDir: Maven 构建目录名(deliverables/<buildDir>),默认与 key 同名,不同时显式指定
// deployUser: SSH 登录用户(默认为 docker),使用 sshagent 密钥认证
def PROJECT_CONFIG = [
'fangjiabkoff' : [
imageName : 'fangjia-bkoff',
composeDir : 'fangjia-bkoff',
serviceName : 'fangjia-bkoff',
deployHost : '192.168.0.80',
deployBase : '/home/docker',
deployUser : 'docker',
],
'chafangtong' : [
imageName : 'chafangtong',
composeDir : 'chafangtong',
serviceName : 'chafangtong',
deployHost : '192.168.0.80',
deployBase : '/home/docker',
deployUser : 'docker',
],
'fangjia' : [
imageName : 'fangjia-coresite',
composeDir : 'fangjia-coresite',
serviceName : 'fangjia-coresite',
deployHost : '192.168.0.80',
deployBase : '/home/docker',
deployUser : 'docker',
],
'fangjiapds' : [
imageName : 'fangjia-pds',
composeDir : 'fangjia-pds',
serviceName : 'fangjia-pds',
deployHost : '192.168.0.80',
deployBase : '/home/docker',
deployUser : 'docker',
],
'fangjiastatic' : [
imageName : 'fangjia-static',
composeDir : 'fangjia-coresite',
serviceName : 'fangjia-static',
deployHost : '192.168.0.80',
deployBase : '/home/docker',
deployUser : 'docker',
],
'geluke' : [
imageName : 'geluke',
composeDir : 'geluke',
serviceName : 'geluke',
deployHost : '192.168.0.80',
deployBase : '/home/docker',
deployUser : 'docker',
],
'fangjiaopen' : [
imageName : 'fangjia-open',
composeDir : 'fangjia-open',
serviceName : 'fangjia-open',
deployHost : ['192.168.0.36', '192.168.0.18'],
deployBase : '/home/docker',
deployUser : 'docker',
],
'fangjia-script' : [
buildDir : 'script', // deliverables/script
imageName : 'fangjia-script',
composeDir : 'fangjia-script',
serviceName : 'fangjia-script',
deployHost : '192.168.0.36',
deployBase : '/home/docker',
deployUser : 'docker',
],
]
pipeline { pipeline {
agent any agent any
options {
// 自动保留最近 3 次构建记录,或者保留最近 30 天的记录
buildDiscarder(logRotator(numToKeepStr: '3', daysToKeepStr: '30'))
}
parameters { parameters {
choice(name: 'PROJECT_NAME', choices: ['chafangtong', 'fangjia', 'fangjiapds', 'fangjiastatic', 'geluke', 'fangjiaopen'], description: '请选择发布的项目') choice(name: 'PROJECT_NAME', choices: ['chafangtong', 'fangjia', 'fangjiapds', 'fangjiastatic', 'geluke', 'fangjiaopen', 'fangjia-script'], description: '请选择发布的项目')
} }
tools { tools {
jdk 'JDK8' jdk 'JDK8'
} }
environment {
REGISTRY = "192.168.0.19:9011"
}
stages { stages {
stage("Git Checkout") { stage("Git Checkout") {
steps { steps {
git changelog: false, credentialsId: 'gitlabsecret', poll: false, url: 'http://gitlab.fangjia.com/dev0/main.git' git changelog: false, credentialsId: 'Gitea_Admin_Token', poll: false, url: 'https://gitea.fangjia.com/dev0/main.git'
} }
} }
stage('Maven Build') { stage('Maven Build') {
steps { steps {
script { script {
def projects = ['fangjiabkoff', 'chafangtong', 'fangjia', 'fangjiapds', 'fangjiastatic', 'geluke', 'fangjiaopen'] def cfg = PROJECT_CONFIG[params.PROJECT_NAME]
for (def project : projects) { def buildDir = cfg.buildDir ?: params.PROJECT_NAME
if (params.PROJECT_NAME == project) { dir("deliverables/${buildDir}") {
dir("deliverables/${project}") { withMaven(globalMavenSettingsConfig: '426b9a25-aa0d-47d3-a24c-8abdfc4421ff', jdk: "JDK8") {
withMaven(globalMavenSettingsConfig: '426b9a25-aa0d-47d3-a24c-8abdfc4421ff') { sh 'mvn clean package -Dmaven.test.skip=true -Dasset.version="$BUILD_NUMBER"'
sh 'mvn clean package -Dmaven.test.skip=true'
} }
} }
} }
} }
} }
}
} stage('Docker Build & Push') {
stage('Docker Build') {
steps { steps {
script { script {
def projects = ['fangjiabkoff', 'chafangtong', 'fangjia', 'fangjiapds', 'fangjiastatic', 'geluke', 'fangjiaopen'] def cfg = PROJECT_CONFIG[params.PROJECT_NAME]
def imagesName = ['fangjiabkoff': 'fangjia-bkoff', 'chafangtong': 'chafangtong', 'fangjia': 'fangjia-coresite', 'fangjiapds': 'fangjia-pds', 'fangjiastatic': 'fangjia-static', 'geluke':"geluke", 'fangjiaopen': 'fangjia-open'] def imageTag = env.BUILD_TAG.toLowerCase()
for (def project : projects) { dir("projects/${cfg.imageName}") {
if (params.PROJECT_NAME == project) { withDockerRegistry(credentialsId: 'DockerNexus', url: "http://${REGISTRY}") {
dir("projects/${imagesName[project]}") { sh "docker build -t ${REGISTRY}/${cfg.imageName}:${imageTag} ."
withDockerRegistry(credentialsId: 'DockerNexus', url: 'http://192.168.0.19:9012') { sh "docker tag ${REGISTRY}/${cfg.imageName}:${imageTag} ${REGISTRY}/${cfg.imageName}:latest"
sh "docker build -t 192.168.0.19:9011/${imagesName[project]}:${env.BUILD_TAG.toLowerCase()} ." sh "docker push ${REGISTRY}/${cfg.imageName}:latest"
withDockerRegistry(credentialsId: 'DockerNexus', url: 'http://192.168.0.19:9011') {
sh "docker push 192.168.0.19:9011/${imagesName[project]}:${env.BUILD_TAG.toLowerCase()}"
} }
} }
} }
} }
} }
}
} stage('Docker Compose Deploy') {
}
stage('K8S Deploy') {
steps { steps {
script { script {
def projects = ['fangjiabkoff', 'chafangtong', 'fangjia', 'fangjiapds', 'fangjiastatic', 'geluke', 'fangjiaopen'] def cfg = PROJECT_CONFIG[params.PROJECT_NAME]
def k8s_config_map = ['fangjiabkoff': 'fangjia-bkoff', 'chafangtong': 'chafangtong', 'fangjia': 'fangjia-coresite', 'fangjiapds': 'fangjia-pds', 'fangjiastatic': 'fangjia-static', 'geluke':"geluke", 'fangjiaopen': 'fangjia-open'] def deployUser = cfg.deployUser ?: 'docker'
for (def project : projects) { sshagent(credentials: ['deploy-server-ssh']) {
if (params.PROJECT_NAME == project) { if (params.PROJECT_NAME == "fangjia-script") {
dir("deliverables/k8s") { def buildDir = cfg.buildDir ?: params.PROJECT_NAME
withKubeConfig([credentialsId: 'K8SSecret', serverUrl: 'https://k8s.fangjia.com:6443']) { sh """
def orgVersion = "${k8s_config_map[project]}:latest" # 确保目录存在
def nowVersion = "${k8s_config_map[project]}:${env.BUILD_TAG.toLowerCase()}" ssh -o StrictHostKeyChecking=no \
sh "sed -i 's/${orgVersion}/${nowVersion}/g' ${k8s_config_map[project]}.yaml" -o HostKeyAlgorithms=+ssh-rsa \
sh "kubectl apply -f ${k8s_config_map[project]}.yaml" -o PubkeyAcceptedKeyTypes=+ssh-rsa \
${deployUser}@${cfg.deployHost} \
'mkdir -p /home/docker/fangjia-script/scripts/fangjia && mkdir -p /home/docker/fangjia-script/logs'
# 上传 fat jar
scp -o StrictHostKeyChecking=no \
-o HostKeyAlgorithms=+ssh-rsa \
-o PubkeyAcceptedKeyTypes=+ssh-rsa \
projects/fangjia-script/target/fangjia-script.jar \
${deployUser}@${cfg.deployHost}:/home/docker/fangjia-script/fangjia-script.jar
# 上传 groovy 脚本目录
scp -o StrictHostKeyChecking=no \
-o HostKeyAlgorithms=+ssh-rsa \
-o PubkeyAcceptedKeyTypes=+ssh-rsa \
-r projects/fangjia-script/src/main/groovy/* \
${deployUser}@${cfg.deployHost}:/home/docker/fangjia-script/scripts/
# 上传 crontab
scp -o StrictHostKeyChecking=no \
-o HostKeyAlgorithms=+ssh-rsa \
-o PubkeyAcceptedKeyTypes=+ssh-rsa \
projects/fangjia-script/crontab.txt \
${deployUser}@${cfg.deployHost}:/home/docker/fangjia-script/crontab.txt
# 重启容器
ssh -o StrictHostKeyChecking=no \
-o HostKeyAlgorithms=+ssh-rsa \
-o PubkeyAcceptedKeyTypes=+ssh-rsa \
${deployUser}@${cfg.deployHost} \
'cd ${cfg.deployBase}/${cfg.composeDir} && docker compose down && docker compose pull && docker compose up -d'
"""
} else {
if(cfg.deployHost instanceof String){
sh """
ssh -o StrictHostKeyChecking=no \
-o HostKeyAlgorithms=+ssh-rsa \
-o PubkeyAcceptedKeyTypes=+ssh-rsa \
${deployUser}@${cfg.deployHost} \
'cd ${cfg.deployBase}/${cfg.composeDir} && docker compose up -d --no-deps --force-recreate ${cfg.serviceName}'
"""
}else{
for(def host in cfg.deployHost){
sh """
ssh -o StrictHostKeyChecking=no \
-o HostKeyAlgorithms=+ssh-rsa \
-o PubkeyAcceptedKeyTypes=+ssh-rsa \
${deployUser}@${host} \
'cd ${cfg.deployBase}/${cfg.composeDir} && docker compose up -d --no-deps --force-recreate ${cfg.serviceName}'
"""
} }
} }
} }
} }
} }
@@ -72,4 +197,12 @@ pipeline {
} }
} }
post {
success {
echo "✅ ${params.PROJECT_NAME} 部署成功,镜像版本:${env.BUILD_TAG.toLowerCase()}"
}
failure {
echo "❌ ${params.PROJECT_NAME} 部署失败,请检查日志"
}
}
} }
-2
View File
@@ -25,7 +25,5 @@
<module>../../projects/fangjia-service</module> <module>../../projects/fangjia-service</module>
<module>../../projects/fangjia-coresite</module> <module>../../projects/fangjia-coresite</module>
<module>../../projects/chafangtong-dal</module> <module>../../projects/chafangtong-dal</module>
<module>../../projects/fangjia-static</module>
<module>../../projects/fangjia-script</module>
</modules> </modules>
</project> </project>
@@ -285,6 +285,11 @@ public class ApiUserController {
bo.setPriceType(apiUserCfg_pt.getCfgValue().toString()); bo.setPriceType(apiUserCfg_pt.getCfgValue().toString());
} }
ApiUserCfg apiUserCfg_ai = apiUserCfgService.findByUserId(apiUser.getId(), ApiUserCfg.ApiUserCfgKey.ENTERPRISE_VILLAGE_AI);
if (apiUserCfg_ai != null && apiUserCfg_ai.getCfgValue() != null) {
bo.setEnterpriseVillageAi(apiUserCfg_ai.getCfgValue().toString());
}
model.setApiUserBo(bo); model.setApiUserBo(bo);
if (StringUtils.isNotBlank(model.getMsg()) && model.getMsg().equals("success")) { if (StringUtils.isNotBlank(model.getMsg()) && model.getMsg().equals("success")) {
model.setMsg("更新成功!"); model.setMsg("更新成功!");
@@ -343,6 +348,7 @@ public class ApiUserController {
//ApiUserCfg.ApiUserCfgKey.EVALUATE_RATE //ApiUserCfg.ApiUserCfgKey.EVALUATE_RATE
modifyUserCfg(userId, ApiUserCfg.ApiUserCfgKey.EVALUATE_RATE, model.getEvaluateRate()); modifyUserCfg(userId, ApiUserCfg.ApiUserCfgKey.EVALUATE_RATE, model.getEvaluateRate());
modifyUserCfg(userId, ApiUserCfg.ApiUserCfgKey.PRICE_TYPE, model.getPriceType()); modifyUserCfg(userId, ApiUserCfg.ApiUserCfgKey.PRICE_TYPE, model.getPriceType());
modifyUserCfg(userId, ApiUserCfg.ApiUserCfgKey.ENTERPRISE_VILLAGE_AI, model.getEnterpriseVillageAi());
model.setViewType("redirect"); model.setViewType("redirect");
//model.setViewParam("location", "/apiUser/edit?msg=sucess&userId=" + model.getUserId()); //model.setViewParam("location", "/apiUser/edit?msg=sucess&userId=" + model.getUserId());
@@ -37,6 +37,7 @@ public class ApiUserModel extends BaseModel {
private String totalCountMap; private String totalCountMap;
private Integer creditLevelStatus; private Integer creditLevelStatus;
private String priceType; private String priceType;
private String enterpriseVillageAi;
private Map<String,Double> priceRatingMap; private Map<String,Double> priceRatingMap;
private Integer isMonitor; private Integer isMonitor;
@@ -50,6 +51,14 @@ public class ApiUserModel extends BaseModel {
private Integer isWarnExpired; private Integer isWarnExpired;
public String getEnterpriseVillageAi() {
return enterpriseVillageAi;
}
public void setEnterpriseVillageAi(String enterpriseVillageAi) {
this.enterpriseVillageAi = enterpriseVillageAi;
}
public String getPriceType() { public String getPriceType() {
return priceType; return priceType;
} }
@@ -155,6 +155,15 @@
</select> </select>
</td> </td>
</tr> </tr>
<tr>
<td>对公涉农是否启用AI</td>
<td>
<select id="slt_enterpriseVillageAi" name="enterpriseVillageAi" style="width: 100px">
<option value="0" <#if !(apiUserBo.enterpriseVillageAi??) || apiUserBo.enterpriseVillageAi == "0">selected</#if>>否</option>
<option value="1" <#if apiUserBo.enterpriseVillageAi?? && apiUserBo.enterpriseVillageAi == "1">selected</#if>>是</option>
</select>
</td>
</tr>
<tr> <tr>
<td>siteName</td> <td>siteName</td>
<td><input name="siteName" value="${apiUserBo.siteName!}"/></td> <td><input name="siteName" value="${apiUserBo.siteName!}"/></td>
+7 -2
View File
@@ -33,12 +33,12 @@
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>1.6.1</version> <version>1.7.25</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId> <artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version> <version>1.7.25</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.testng</groupId> <groupId>org.testng</groupId>
@@ -176,5 +176,10 @@
<version>1.18.20</version> <version>1.18.20</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.1</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
+30
View File
@@ -8,9 +8,22 @@
<name>fangjia-coresite</name> <name>fangjia-coresite</name>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
<asset.version>${maven.build.timestamp}</asset.version>
</properties> </properties>
<build> <build>
<finalName>fangjia-coresite</finalName> <finalName>fangjia-coresite</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes><exclude>asset-version.properties</exclude></excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes><include>asset-version.properties</include></includes>
</resource>
</resources>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@@ -40,6 +53,12 @@
<artifactId>sothis-web</artifactId> <artifactId>sothis-web</artifactId>
<version>0.1.0-SNAPSHOT</version> <version>0.1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>org.sothis</groupId>
<artifactId>sothis-core</artifactId>
<version>0.1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId> <artifactId>spring-web</artifactId>
@@ -242,5 +261,16 @@
<version>1.0.0</version> <version>1.0.0</version>
<classifier>jdk18</classifier> <classifier>jdk18</classifier>
</dependency> </dependency>
<!-- 强制统一 SLF4J 版本,避免 CXF 2.2.3 引入旧版 slf4j-api 与 nacos-client 的 jcl-over-slf4j 1.7.x 冲突 -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.25</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
@@ -0,0 +1,14 @@
package com.fangjia.coresite.controllers;
import com.fangjia.coresite.model.JsonModel;
import java.util.Collections;
public class HealthController {
public Object checkAction() {
JsonModel ret = new JsonModel();
ret.setJsonModel(Collections.singletonMap("status", "ok"));
return ret;
}
}
@@ -1,6 +1,8 @@
package com.fangjia.coresite.model; package com.fangjia.coresite.model;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.io.InputStream;
import java.io.IOException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Calendar; import java.util.Calendar;
@@ -9,6 +11,7 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.sothis.core.util.Pager; import org.sothis.core.util.Pager;
@@ -37,6 +40,25 @@ public class BaseModel extends ModelAndViewSupport {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String debugFtl; private String debugFtl;
private final static FangjiaConfig CONFIG = FangjiaConfig.getConfig(); private final static FangjiaConfig CONFIG = FangjiaConfig.getConfig();
private static final String ASSET_VERSION = loadAssetVersion();
private static String loadAssetVersion() {
InputStream input = BaseModel.class.getResourceAsStream("/asset-version.properties");
if (input != null) {
try {
Properties properties = new Properties();
properties.load(input);
String version = properties.getProperty("asset.version");
if (version != null && version.length() > 0 && !version.startsWith("${")) {
return version;
}
} catch (IOException ignored) {
} finally {
try { input.close(); } catch (IOException ignored) { }
}
}
return String.valueOf(System.currentTimeMillis());
}
private final static String STATIC_URL = "http://" + CONFIG.getStaticDomainName() private final static String STATIC_URL = "http://" + CONFIG.getStaticDomainName()
+ (CONFIG.isDevelopmentEnvironment() ? "/fangjia-static" : "/stc"); + (CONFIG.isDevelopmentEnvironment() ? "/fangjia-static" : "/stc");
@@ -216,7 +238,7 @@ public class BaseModel extends ModelAndViewSupport {
} }
public final String getVersion() { public final String getVersion() {
return String.valueOf(System.currentTimeMillis()); return ASSET_VERSION;
} }
public final String getHisCityUrl() { public final String getHisCityUrl() {
@@ -0,0 +1 @@
asset.version=${asset.version}
@@ -183,7 +183,7 @@
<div class="index-box-03 mobile01"> <div class="index-box-03 mobile01">
<div class="index-box-left"> <div class="index-box-left">
<div class="icon_bg"><div class="icon08"></div><label>服务与合作</label></div> <div class="icon_bg"><div class="icon08"></div><label>服务与合作</label></div>
<div class="text">地址:上海市长宁区金钟路658弄10号201-202室</div> <div class="text">地址:上海市长宁区金钟路658弄10号楼206-027室</div>
<div class="text">邮箱:support@fangjia.com</div> <div class="text">邮箱:support@fangjia.com</div>
<div class="text">邮编:200003</div> <div class="text">邮编:200003</div>
</div> </div>
@@ -68,6 +68,7 @@ public class ApiUserCfg implements MongoEntity {
public enum ApiUserCfgKey{ public enum ApiUserCfgKey{
EVALUATE_RATE, EVALUATE_RATE,
PRICE_TYPE; PRICE_TYPE,
ENTERPRISE_VILLAGE_AI;
} }
} }
@@ -1,5 +1,6 @@
package com.fangjia.dal.mongo.model; package com.fangjia.dal.mongo.model;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.persistence.Column; import javax.persistence.Column;
@@ -12,7 +13,7 @@ import com.fangjia.dal.MongoEntity;
@Entity @Entity
@Table(name = "fangjia_base.baidu_place_poi") @Table(name = "fangjia_base.baidu_place_poi")
public class BaiduPlacePoi implements MongoEntity { public class BaiduPlacePoi implements MongoEntity, Serializable {
private static final long serialVersionUID = 1840436549012703563L; private static final long serialVersionUID = 1840436549012703563L;
private String id; private String id;
private String city;//城市 private String city;//城市
+11
View File
@@ -170,5 +170,16 @@
<version>0.1.0-SNAPSHOT</version> <version>0.1.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- 强制统一 SLF4J 版本,避免 CXF 2.2.3 引入旧版 slf4j-api 与 nacos-client 的 jcl-over-slf4j 1.7.x 冲突 -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.25</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
@@ -1,6 +1,7 @@
package com.fangjia.open.controllers; package com.fangjia.open.controllers;
import com.fangjia.core.util.HttpRequest; import com.fangjia.core.util.HttpRequest;
import com.fangjia.dal.mongo.model.ApiUserCfg;
import com.fangjia.dal.mongo.model.Township; import com.fangjia.dal.mongo.model.Township;
import com.fangjia.dal.mongo.model.VillageIdentify; import com.fangjia.dal.mongo.model.VillageIdentify;
import com.fangjia.dal.seaweed.model.District; import com.fangjia.dal.seaweed.model.District;
@@ -10,6 +11,7 @@ import com.fangjia.open.dto.addressGovernance.DistrictDto;
import com.fangjia.open.dto.addressGovernance.DistrictIdentifyDto; import com.fangjia.open.dto.addressGovernance.DistrictIdentifyDto;
import com.fangjia.open.dto.addressGovernance.MatchedBuildingDto; import com.fangjia.open.dto.addressGovernance.MatchedBuildingDto;
import com.fangjia.open.dto.addressGovernance.StructureAndCompleteDto; import com.fangjia.open.dto.addressGovernance.StructureAndCompleteDto;
import com.fangjia.open.interceptors.AuthenticationBean;
import com.fangjia.open.interceptors.Authority; import com.fangjia.open.interceptors.Authority;
import com.fangjia.open.interceptors.Role; import com.fangjia.open.interceptors.Role;
import com.fangjia.open.model.AddesssMatchModel; import com.fangjia.open.model.AddesssMatchModel;
@@ -22,6 +24,7 @@ import com.fangjia.service.datastore.DistrictService;
import com.fangjia.service.district.DistrictStatService; import com.fangjia.service.district.DistrictStatService;
import com.fangjia.service.mongo.fangjia.TownshipService; import com.fangjia.service.mongo.fangjia.TownshipService;
import com.fangjia.service.mongo.fangjia.VillageIdentifyService; import com.fangjia.service.mongo.fangjia.VillageIdentifyService;
import com.fangjia.service.api.ApiUserCfgService;
import com.fangjia.service.open.DistrictAnalyDataService; import com.fangjia.service.open.DistrictAnalyDataService;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
@@ -42,8 +45,10 @@ import org.apache.http.impl.conn.DefaultProxyRoutePlanner;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.sothis.core.util.CollectionUtils; import org.sothis.core.util.CollectionUtils;
import org.sothis.core.util.Pager; import org.sothis.core.util.Pager;
import org.sothis.web.mvc.ActionContext;
import sun.misc.BASE64Encoder; import sun.misc.BASE64Encoder;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.net.Authenticator; import java.net.Authenticator;
import java.net.PasswordAuthentication; import java.net.PasswordAuthentication;
@@ -64,6 +69,7 @@ public class AddrSvcController {
private VillageIdentifyService villageIdentifyService; private VillageIdentifyService villageIdentifyService;
private DistrictAnalyDataService districtAnalyDataService; private DistrictAnalyDataService districtAnalyDataService;
private TownshipService townshipService; private TownshipService townshipService;
private ApiUserCfgService apiUserCfgService;
/** /**
* 地址结构化 * 地址结构化
@@ -186,6 +192,13 @@ public class AddrSvcController {
BasicModel basicModel = new BasicModel(code, msg); BasicModel basicModel = new BasicModel(code, msg);
if (json.containsKey("result")) { if (json.containsKey("result")) {
StructureAndCompleteDto structureAndCompleteDto = CommonDtoUtils.transformV(StructureAndCompleteDto.class, json.get("result")); StructureAndCompleteDto structureAndCompleteDto = CommonDtoUtils.transformV(StructureAndCompleteDto.class, json.get("result"));
JSONObject result = json.getJSONObject("result");
if(result.containsKey("addressAssessment")){
JSONObject addressAssessment = result.getJSONObject("addressAssessment");
if(addressAssessment.containsKey("msg")){
structureAndCompleteDto.setAddrVerify(addressAssessment.getString("msg"));
}
}
if("1".equals(model.getShowCode())){ if("1".equals(model.getShowCode())){
if(StringUtils.isNotBlank(structureAndCompleteDto.getProvinceCode())){ if(StringUtils.isNotBlank(structureAndCompleteDto.getProvinceCode())){
structureAndCompleteDto.setProvinceCode(structureAndCompleteDto.getProvinceCode().substring(0, 6)); structureAndCompleteDto.setProvinceCode(structureAndCompleteDto.getProvinceCode().substring(0, 6));
@@ -559,6 +572,23 @@ public class AddrSvcController {
params.put("address", address); params.put("address", address);
String type = StringUtils.isNotBlank(model.getType()) ? model.getType() : null; String type = StringUtils.isNotBlank(model.getType()) ? model.getType() : null;
params.put("type", type); params.put("type", type);
if (model.getAi() != null && model.getAi() == 1) {
params.put("ai", "1");
} else {
HttpServletRequest req = ActionContext.getContext().getRequest();
if (req != null && apiUserCfgService != null) {
AuthenticationBean authenticationBean = (AuthenticationBean) req.getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN);
if (authenticationBean != null && authenticationBean.apiUser != null) {
ApiUserCfg apiUserCfg = apiUserCfgService.findByUserId(authenticationBean.apiUser.getId(), ApiUserCfg.ApiUserCfgKey.ENTERPRISE_VILLAGE_AI);
if (apiUserCfg != null && apiUserCfg.getCfgValue() != null) {
String aiVal = apiUserCfg.getCfgValue().toString();
if ("1".equals(aiVal) || "true".equalsIgnoreCase(aiVal)) {
params.put("ai", "1");
}
}
}
}
}
try { try {
json = request.getJsonContent("http://192.168.0.80:32080/FangJiaAddressService/v6/villageIdentify", params, "UTF-8"); json = request.getJsonContent("http://192.168.0.80:32080/FangJiaAddressService/v6/villageIdentify", params, "UTF-8");
} catch (Exception e) { } catch (Exception e) {
@@ -1114,6 +1144,23 @@ public class AddrSvcController {
} else { } else {
Integer radius = model.getRadius(); Integer radius = model.getRadius();
params.put("radius", (radius != null && radius != 0) ? radius.toString() : null); params.put("radius", (radius != null && radius != 0) ? radius.toString() : null);
if(model.getAi() != null && model.getAi() == 1){
params.put("ai", "1");
}else{
HttpServletRequest req = ActionContext.getContext().getRequest();
if (req != null && apiUserCfgService != null) {
AuthenticationBean authenticationBean = (AuthenticationBean) req.getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN);
if (authenticationBean != null && authenticationBean.apiUser != null) {
ApiUserCfg apiUserCfg = apiUserCfgService.findByUserId(authenticationBean.apiUser.getId(), ApiUserCfg.ApiUserCfgKey.ENTERPRISE_VILLAGE_AI);
if (apiUserCfg != null && apiUserCfg.getCfgValue() != null) {
String aiVal = apiUserCfg.getCfgValue().toString();
if ("1".equals(aiVal) || "true".equalsIgnoreCase(aiVal)) {
params.put("ai", "1");
}
}
}
}
}
try { try {
json = request.getJsonContent("http://192.168.0.80:32080/FangJiaAddressService/enterpriseVillageIdentify", params, "UTF-8"); json = request.getJsonContent("http://192.168.0.80:32080/FangJiaAddressService/enterpriseVillageIdentify", params, "UTF-8");
} catch (Exception e) { } catch (Exception e) {
@@ -1738,4 +1785,8 @@ public class AddrSvcController {
public void setTownshipService(TownshipService townshipService) { public void setTownshipService(TownshipService townshipService) {
this.townshipService = townshipService; this.townshipService = townshipService;
} }
public void setApiUserCfgService(ApiUserCfgService apiUserCfgService) {
this.apiUserCfgService = apiUserCfgService;
}
} }
@@ -3448,7 +3448,7 @@ public class AddressController {
headers.put("Content-Type", "application/json"); headers.put("Content-Type", "application/json");
headers.put("Authorization", "Basic " + authenticationEncoding + ""); headers.put("Authorization", "Basic " + authenticationEncoding + "");
try { try {
String response = request.postWithBody("http://192.168.0.45:9200/association/_search", reqBody, headers, "UTF-8"); String response = request.postWithBody("http://192.168.0.206:9200/association/_search", reqBody, headers, "UTF-8");
JSONObject json = JSONObject.fromObject(response); JSONObject json = JSONObject.fromObject(response);
if (!json.containsKey("hits") || !json.getJSONObject("hits").containsKey("hits")) { if (!json.containsKey("hits") || !json.getJSONObject("hits").containsKey("hits")) {
return Collections.emptyList(); return Collections.emptyList();
@@ -1,14 +1,19 @@
package com.fangjia.open.controllers; package com.fangjia.open.controllers;
import com.fangjia.core.util.HttpRequest; import com.fangjia.core.util.HttpRequest;
import com.fangjia.dal.mongo.model.ApiUserCfg;
import com.fangjia.open.interceptors.AuthenticationBean;
import com.fangjia.open.interceptors.Authority; import com.fangjia.open.interceptors.Authority;
import com.fangjia.open.interceptors.Role; import com.fangjia.open.interceptors.Role;
import com.fangjia.open.model.AddressModel; import com.fangjia.open.model.AddressModel;
import com.fangjia.open.model.BasicModel; import com.fangjia.open.model.BasicModel;
import com.fangjia.open.model.RestfulModelAndView; import com.fangjia.open.model.RestfulModelAndView;
import com.fangjia.service.api.ApiUserCfgService;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.sothis.web.mvc.ActionContext;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -18,6 +23,8 @@ import java.util.Map;
@Authority(role = Role.USER) @Authority(role = Role.USER)
public class GdBankController { public class GdBankController {
private ApiUserCfgService apiUserCfgService;
private static final Map<String, String> areaMap = new HashMap<String, String>() { private static final Map<String, String> areaMap = new HashMap<String, String>() {
{ {
// 添加键值对到 Map 中 // 添加键值对到 Map 中
@@ -88,6 +95,24 @@ public class GdBankController {
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : null); params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : null);
params.put("address", model.getAddress()); params.put("address", model.getAddress());
if(model.getAi() != null && model.getAi() == 1){
params.put("ai", "1");
}else{
HttpServletRequest req = ActionContext.getContext().getRequest();
if (req != null && apiUserCfgService != null) {
AuthenticationBean authenticationBean = (AuthenticationBean) req.getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN);
if (authenticationBean != null && authenticationBean.apiUser != null) {
ApiUserCfg apiUserCfg = apiUserCfgService.findByUserId(authenticationBean.apiUser.getId(), ApiUserCfg.ApiUserCfgKey.ENTERPRISE_VILLAGE_AI);
if (apiUserCfg != null && apiUserCfg.getCfgValue() != null) {
String aiVal = apiUserCfg.getCfgValue().toString();
if ("1".equals(aiVal) || "true".equalsIgnoreCase(aiVal)) {
params.put("ai", "1");
}
}
}
}
}
try { try {
json = request.getJsonContent("http://192.168.0.80:32080/FangJiaAddressService/cebEnterpriseVillageIdentify", params, "UTF-8"); json = request.getJsonContent("http://192.168.0.80:32080/FangJiaAddressService/cebEnterpriseVillageIdentify", params, "UTF-8");
} catch (Exception e) { } catch (Exception e) {
@@ -115,4 +140,8 @@ public class GdBankController {
return mav; return mav;
} }
public void setApiUserCfgService(ApiUserCfgService apiUserCfgService) {
this.apiUserCfgService = apiUserCfgService;
}
} }
@@ -0,0 +1,13 @@
package com.fangjia.open.controllers;
import com.fangjia.open.model.BasicModel;
import com.fangjia.open.model.RestfulModelAndView;
public class HealthController {
public Object checkAction() {
RestfulModelAndView mav = new RestfulModelAndView();
mav.setModel(BasicModel.buildOKModel().setResult("ok"));
return mav;
}
}
@@ -531,8 +531,9 @@ public class OfficeController {
} }
} }
model.setRegion(district.getRegion()); model.setRegion(district.getRegion());
model.setDistrict(district.getRegion());
model.setDistrictName(district.getName()); model.setDistrictName(district.getName());
model.setCity(district.getCity());
OfficeEvaluationDto evaluation = officeService.evaluateRent(district, buildEvaluation(model, request)); OfficeEvaluationDto evaluation = officeService.evaluateRent(district, buildEvaluation(model, request));
if (evaluation.getUnitPrice() != null && evaluation.getUnitPrice() != 0) { if (evaluation.getUnitPrice() != null && evaluation.getUnitPrice() != 0) {
@@ -782,8 +783,9 @@ public class OfficeController {
} }
model.setRegion(district.getRegion()); model.setRegion(district.getRegion());
model.setDistrict(district.getRegion());
model.setDistrictName(district.getName()); model.setDistrictName(district.getName());
model.setCity(district.getCity());
OfficeEvaluationDto evaluation = officeService.evaluateRent(district, buildEvaluation(model, request)); OfficeEvaluationDto evaluation = officeService.evaluateRent(district, buildEvaluation(model, request));
if (evaluation.getUnitPrice() != null && evaluation.getUnitPrice() != 0) { if (evaluation.getUnitPrice() != null && evaluation.getUnitPrice() != 0) {
@@ -862,10 +864,10 @@ public class OfficeController {
return mav; return mav;
} }
} }
model.setRegion(district.getRegion()); model.setRegion(district.getRegion());
model.setDistrict(district.getRegion());
model.setDistrictName(district.getName()); model.setDistrictName(district.getName());
model.setCity(district.getCity());
OfficeEvaluationDto evaluation = officeService.evaluateRent(district, buildEvaluation(model, request)); OfficeEvaluationDto evaluation = officeService.evaluateRent(district, buildEvaluation(model, request));
Double minPrice = null; Double minPrice = null;
Double maxPrice = null; Double maxPrice = null;
@@ -312,8 +312,9 @@ public class OfficeSellController {
} }
} }
model.setRegion(district.getRegion()); model.setRegion(district.getRegion());
model.setDistrict(district.getRegion());
model.setDistrictName(district.getName()); model.setDistrictName(district.getName());
model.setCity(district.getCity());
OfficeEvaluationDto evaluation = officeService.evaluateSell(district, buildEvaluation(model, request)); OfficeEvaluationDto evaluation = officeService.evaluateSell(district, buildEvaluation(model, request));
if (evaluation.getUnitPrice() != null && evaluation.getUnitPrice() != 0) { if (evaluation.getUnitPrice() != null && evaluation.getUnitPrice() != 0) {
@@ -507,8 +508,9 @@ public class OfficeSellController {
return mav; return mav;
} }
} }
model.setCity(district.getCity());
model.setRegion(district.getRegion()); model.setRegion(district.getRegion());
model.setDistrict(district.getRegion());
model.setDistrictName(district.getName()); model.setDistrictName(district.getName());
OfficeEvaluationDto evaluation = officeService.evaluateSell(district, buildEvaluation(model, request)); OfficeEvaluationDto evaluation = officeService.evaluateSell(district, buildEvaluation(model, request));
if (evaluation.getUnitPrice() != null && evaluation.getUnitPrice() != 0) { if (evaluation.getUnitPrice() != null && evaluation.getUnitPrice() != 0) {
@@ -602,7 +604,9 @@ public class OfficeSellController {
} }
model.setRegion(district.getRegion()); model.setRegion(district.getRegion());
model.setDistrict(district.getRegion());
model.setDistrictName(district.getName()); model.setDistrictName(district.getName());
model.setCity(district.getCity());
OfficeEvaluationDto evaluation = officeService.evaluateSell(district, buildEvaluation(model, request)); OfficeEvaluationDto evaluation = officeService.evaluateSell(district, buildEvaluation(model, request));
if (evaluation.getUnitPrice() != null && evaluation.getUnitPrice() != 0) { if (evaluation.getUnitPrice() != null && evaluation.getUnitPrice() != 0) {
@@ -13,6 +13,11 @@ import java.nio.charset.Charset;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@@ -348,13 +353,166 @@ public class PropertyController {
} }
}; };
/**
* 不适合做配套展示的POI类型(优先级高于AROUND_KEYWORD_FACTOR_NEW匹配,小类/中类命中任一即排除)
*/
private static final Set<String> AROUND_EXCLUDE_TYPES = new HashSet<String>() {
{
// 学校类:高等院校/职校/成人教育/培训机构/学校内部设施
add("高等院校");
add("职业技术学校");
add("成人教育");
add("培训机构");
add("学校内部设施");
// 医疗类:诊所/卫生院/疗养院/口腔医院/整形美容
add("诊所");
add("卫生院");
add("疗养院");
add("口腔医院");
add("整形美容");
// 银行类:ATM及自助银行(仅展示银行网点)
add("自动提款机");
add("银行相关");
// 交通类:机场出发/到达口及直升机场(仅展示飞机场),公交车站(公交数据来自busStationService),货运设施
add("机场出发/到达");
add("直升机场");
add("公交车站相关");
add("货运火车站");
add("货运港口码头");
// 餐饮类:茶艺馆/冷饮店/糕饼店/甜品店/餐饮相关(泛称,POI名多为店名无意义)
add("茶艺馆");
add("冷饮店");
add("糕饼店");
add("甜品店");
add("餐饮相关场所");
add("餐饮相关");
// 餐饮类:泛中餐厅/快餐厅/休闲餐饮场所(高德把无法细分的小餐馆全归此类,噪音主力),老字号
add("中餐厅");
add("快餐厅");
add("休闲餐饮场所");
add("老字号");
// 酒店类:经济型连锁酒店/旅馆招待所/青年旅舍/住宿服务相关(低质POI多)
add("经济型连锁酒店");
add("旅馆招待所");
add("青年旅舍");
add("住宿服务相关");
// 健身类:游泳馆/运动场所/户外健身场所(仅保留健身中心/综合体育馆)
add("游泳馆");
add("运动场所");
add("户外健身场所");
// 购物类:小商品市场及菜市场经济类(农副/蔬菜/果品/水产/花鸟等,超市分类仅展示现代商超)
add("小商品市场");
add("农副产品市场");
add("蔬菜市场");
add("果品市场");
add("水产海鲜市场");
add("花鸟鱼虫市场");
add("花卉市场");
add("宠物市场");
add("旧货市场");
}
};
/**
* POI类型 -> 配套分类(英文key)映射。
* 通用类型兼容百度POI keyword; 高德POI优先按small_type精确匹配,未命中再按secondary_type中类匹配。
*/
private static final Map<String, String> AROUND_KEYWORD_FACTOR_NEW = new HashMap<String, String>() { private static final Map<String, String> AROUND_KEYWORD_FACTOR_NEW = new HashMap<String, String>() {
{ {
// ===== 高德POI secondary_type(中类) =====
// 学校(中小学及幼儿园,高等院校/职业技术学校/成人教育/培训机构等见排除表)
put("学校", "school"); put("学校", "school");
put("医院", "hospital"); // 医疗(综合医院/三级甲等医院及眼科/骨科等专科,诊所/卫生院/口腔/整形等见排除表)
put("综合医院", "hospital");
put("专科医院", "hospital");
// 银行(仅银行网点中类,ATM/银行相关见排除表)
put("银行", "bank"); put("银行", "bank");
put("超市", "supermarket"); // 超市/商场
put("超级市场", "supermarket");
put("商场", "market"); put("商场", "market");
put("便民商店/便利店", "supermarket");
put("综合市场", "market");
// 美容美发
put("美容美发店", "beautySalon");
// 健身/运动
put("运动场馆", "gym");
// 公园
put("公园广场", "park");
// 交通
put("机场相关", "airport");
put("火车站", "trainStation");
put("长途汽车站", "trainStation");
put("港口码头", "dock");
// 餐饮(仅保留有品类辨识度的:外国餐厅中类/咖啡厅中类;泛称类中餐厅/快餐厅/休闲餐饮场所等见排除表)
put("外国餐厅", "restaurant");
put("咖啡厅", "restaurant");
// 酒店(旅馆招待所/住宿服务相关/经济型连锁酒店等见排除表)
put("宾馆酒店", "hotel");
// ===== 高德POI small_type(小类)精确补充 =====
// 学校
put("小学", "school");
put("中学", "school");
put("幼儿园", "school");
// 医疗(不含药房/医药保健销售/宠物医疗/口腔/整形)
put("三级甲等医院", "hospital");
// 超市/商场(超市小类由超级市场中类覆盖,小商品市场等见排除表)
put("购物中心", "supermarket");
put("普通商场", "market");
// 健身/运动(游泳馆/运动场所/户外健身场所等见排除表)
put("健身中心", "gym");
put("综合体育馆", "gym");
// 公园
put("公园", "park");
put("公园广场", "park");
put("城市广场", "park");
// 交通(货运火车站/货运港口码头见排除表)
put("地铁站", "metro");
put("火车站", "trainStation");
put("长途汽车站", "trainStation");
put("港口码头", "dock");
put("客运港", "dock");
put("飞机场", "airport");
// 餐饮(仅保留有品类辨识度的小类:菜系/火锅/酒楼/料理等)
put("综合酒楼", "restaurant");
put("火锅店", "restaurant");
put("特色/地方风味餐厅", "restaurant");
put("四川菜(川菜)", "restaurant");
put("湖南菜(湘菜)", "restaurant");
put("广东菜(粤菜)", "restaurant");
put("东北菜", "restaurant");
put("安徽菜(徽菜)", "restaurant");
put("福建菜", "restaurant");
put("浙江菜", "restaurant");
put("江苏菜", "restaurant");
put("上海菜", "restaurant");
put("北京菜", "restaurant");
put("湖北菜(鄂菜)", "restaurant");
put("云贵菜", "restaurant");
put("西北菜", "restaurant");
put("台湾菜", "restaurant");
put("潮州菜", "restaurant");
put("山东菜(鲁菜)", "restaurant");
put("清真菜馆", "restaurant");
put("海鲜酒楼", "restaurant");
put("中式素菜馆", "restaurant");
put("日本料理", "restaurant");
put("韩国料理", "restaurant");
put("外国餐厅", "restaurant");
put("西餐厅(综合风味)", "restaurant");
put("茶餐厅", "restaurant");
put("咖啡厅", "restaurant");
put("星巴克咖啡", "restaurant");
put("上岛咖啡", "restaurant");
// 酒店(经济型连锁酒店/旅馆招待所/青年旅舍等见排除表)
put("宾馆酒店", "hotel");
put("三星级宾馆", "hotel");
put("四星级宾馆", "hotel");
put("五星级宾馆", "hotel");
put("奢华酒店", "hotel");
// ===== 百度POI keyword(兼容旧数据) =====
put("医院", "hospital");
put("美容院", "beautySalon"); put("美容院", "beautySalon");
put("健身中心", "gym"); put("健身中心", "gym");
put("公园/绿地", "park"); put("公园/绿地", "park");
@@ -362,12 +520,12 @@ public class PropertyController {
put("公交", "bus"); put("公交", "bus");
put("码头", "dock"); put("码头", "dock");
put("机场", "airport"); put("机场", "airport");
put("火车站", "trainStation");
put("餐馆", "restaurant"); put("餐馆", "restaurant");
put("酒店", "hotel"); put("酒店", "hotel");
} }
}; };
Map<String, String> listKeyMap = new HashMap<String, String>() { Map<String, String> listKeyMap = new HashMap<String, String>() {
{ {
put("school", "schools"); put("school", "schools");
@@ -2564,8 +2722,13 @@ public class PropertyController {
mav.setModel(BasicModel.buildBadRequestModel("参数缺失:city(城市),district(区域),name(小区名)是必须参数")); mav.setModel(BasicModel.buildBadRequestModel("参数缺失:city(城市),district(区域),name(小区名)是必须参数"));
return mav; return mav;
} }
District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(), District district = null;
"district"); if(StringUtils.isNotBlank(model.getId())){
district = districtService.findById(model.getId());
}
if(district == null){
district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),"district");
}
if (null == district) { if (null == district) {
mav.setModel(BasicModel.buildBadRequestModel("该小区不存在")); mav.setModel(BasicModel.buildBadRequestModel("该小区不存在"));
return mav; return mav;
@@ -2619,8 +2782,8 @@ public class PropertyController {
result.add(item); result.add(item);
} }
} else { } else {
List<DistrictSellStat> monthsData = districtSellStatService.getAllWithMonths(model.getCity(), List<DistrictSellStat> monthsData = districtSellStatService.getAllWithMonths(district.getCity(),
model.getDistrict(), model.getName(), model.getPeriodCount()); district.getRegion(), district.getName(), model.getPeriodCount());
if (monthsData != null && monthsData.size() > 0) { if (monthsData != null && monthsData.size() > 0) {
for (DistrictSellStat districtStat : monthsData) { for (DistrictSellStat districtStat : monthsData) {
Map<String, Object> item = new LinkedHashMap<String, Object>(); Map<String, Object> item = new LinkedHashMap<String, Object>();
@@ -3397,6 +3560,7 @@ public class PropertyController {
mav.setModel(BasicModel.buildBadRequestModel("查询半径(radius)非法")); mav.setModel(BasicModel.buildBadRequestModel("查询半径(radius)非法"));
return mav; return mav;
} }
final double radiusFinal = radius;
Integer maxNum = getNum(jo); Integer maxNum = getNum(jo);
if (maxNum == null) { if (maxNum == null) {
mav.setModel(BasicModel.buildBadRequestModel("最大记录数(num)非法")); mav.setModel(BasicModel.buildBadRequestModel("最大记录数(num)非法"));
@@ -3410,6 +3574,9 @@ public class PropertyController {
JSONArray jsonArray = new JSONArray();// 结果集 JSONArray jsonArray = new JSONArray();// 结果集
boolean hasData = false; boolean hasData = false;
// 先解析参数并定位小区,再并行查询周边数据(ES查询是主要耗时点)
List<District> districts = new ArrayList<District>(ja.size());
final List<JSONObject> subJos = new ArrayList<JSONObject>(ja.size());
for (Object o : ja) { for (Object o : ja) {
JSONObject subJo = (JSONObject) o; JSONObject subJo = (JSONObject) o;
String id = subJo.containsKey("id") ? subJo.getString("id") : null; String id = subJo.containsKey("id") ? subJo.getString("id") : null;
@@ -3427,6 +3594,43 @@ public class PropertyController {
} }
district = districtService.findByNameAndAlias(city, region, name, "district"); district = districtService.findByNameAndAlias(city, region, name, "district");
} }
subJos.add(subJo);
districts.add(district);
}
// 并行查ES周边POI(每个小区一个任务)
Map<District, List<BaiduPlacePoi>> poiMap = new HashMap<District, List<BaiduPlacePoi>>(districts.size());
ExecutorService executor = Executors.newFixedThreadPool(Math.min(districts.size(), 6));
try {
List<Future<List<BaiduPlacePoi>>> futures = new ArrayList<Future<List<BaiduPlacePoi>>>(districts.size());
for (final District district : districts) {
futures.add(executor.submit(new Callable<List<BaiduPlacePoi>>() {
@Override
public List<BaiduPlacePoi> call() {
if (null == district || district.getLat2() == null || district.getLat2() == 0) {
return null;
}
try {
return baiduApiService.searchNearbyLocalDatabase(district, radiusFinal);
} catch (Exception e) {
return null;
}
}
}));
}
for (int i = 0; i < futures.size(); i++) {
try {
poiMap.put(districts.get(i), futures.get(i).get(60, TimeUnit.SECONDS));
} catch (Exception e) {
poiMap.put(districts.get(i), null);
}
}
} finally {
executor.shutdown();
}
for (int idx = 0; idx < districts.size(); idx++) {
District district = districts.get(idx);
JSONObject aroundJo = new JSONObject(); JSONObject aroundJo = new JSONObject();
if (null == district || district.getLat2() == null || district.getLat2() == 0) { if (null == district || district.getLat2() == null || district.getLat2() == 0) {
jsonArray.add(aroundJo); jsonArray.add(aroundJo);
@@ -3441,21 +3645,29 @@ public class PropertyController {
double lat = district.getLat2() / 10000000000d; double lat = district.getLat2() / 10000000000d;
double lng = district.getLng2() / 10000000000d; double lng = district.getLng2() / 10000000000d;
// 查询小区周边(所有类型) // 查询小区周边(所有类型,已在上面并行预取)
List<BaiduPlacePoi> arrs = baiduApiService.searchNearbyLocalDatabase(district, radius); List<BaiduPlacePoi> arrs = poiMap.get(district);
Map<String, List<AroundDto>> districtAroundMap = Maps.newHashMap(); Map<String, List<AroundDto>> districtAroundMap = Maps.newHashMap();
Map<String, Integer> districtAroundCountMap = Maps.newHashMap(); Map<String, Integer> districtAroundCountMap = Maps.newHashMap();
for (String key : AROUND_KEYWORD_FACTOR_NEW.keySet()) { for (String key : AROUND_KEYWORD_FACTOR_NEW.keySet()) {
districtAroundMap.put(AROUND_KEYWORD_FACTOR_NEW.get(key), new ArrayList<AroundDto>());// 把key的英文put到map并把value设置为一个List<AroundDto>引用 districtAroundMap.put(AROUND_KEYWORD_FACTOR_NEW.get(key), new ArrayList<AroundDto>());// 把key的英文put到map并把value设置为一个List<AroundDto>引用
} }
if (arrs != null) {
for (int i = 0; i < arrs.size(); i++) { for (int i = 0; i < arrs.size(); i++) {
BaiduPlacePoi poiObj = arrs.get(i); BaiduPlacePoi poiObj = arrs.get(i);
String _name = poiObj.getName(); String _name = poiObj.getName();
String keyword = poiObj.getKeyword(); String keyword = poiObj.getKeyword();
double latjs = poiObj.getLat(); double latjs = poiObj.getLat();
double lngjs = poiObj.getLng(); double lngjs = poiObj.getLng();
// 高德POI: keyword存small_type(小类),streetId存secondary_type(中类)兜底
if (AROUND_EXCLUDE_TYPES.contains(keyword) || AROUND_EXCLUDE_TYPES.contains(poiObj.getStreetId())) {
continue;
}
String key = AROUND_KEYWORD_FACTOR_NEW.get(keyword); String key = AROUND_KEYWORD_FACTOR_NEW.get(keyword);
if (StringUtils.isBlank(key) && StringUtils.isNotBlank(poiObj.getStreetId())) {
key = AROUND_KEYWORD_FACTOR_NEW.get(poiObj.getStreetId());
}
if (StringUtils.isBlank(key)) { if (StringUtils.isBlank(key)) {
continue; continue;
} }
@@ -3469,6 +3681,7 @@ public class PropertyController {
districtAroundMap.get(key).add(dto);// 按key值取出list add 周边名称已经经纬度 districtAroundMap.get(key).add(dto);// 按key值取出list add 周边名称已经经纬度
} }
} }
}
// 周边公交、地铁 // 周边公交、地铁
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(district.getCity(), lat, lng, Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(district.getCity(), lat, lng,
@@ -5143,7 +5356,7 @@ public class PropertyController {
private Map<String, Object> getLastEvaluationPrice(District district, Evaluation evaluation, double dCredit) private Map<String, Object> getLastEvaluationPrice(District district, Evaluation evaluation, double dCredit)
throws NumberFormatException, IllegalAccessException { throws NumberFormatException, IllegalAccessException {
Date startDate = DateUtil.parseDate(DateUtil.addMonth(new Date(), -6), "yyyy-MM-dd"); Date startDate = DateUtil.parseDate(DateUtil.addMonth(new Date(), -12), "yyyy-MM-dd");
// 第三方价格 // 第三方价格
Map<String, Object> otherPriceRets = averageStatisticsService.findFirstAverageStatictics(district.getCity(), Map<String, Object> otherPriceRets = averageStatisticsService.findFirstAverageStatictics(district.getCity(),
district.getRegion(), district.getName(), district.getCategory(), startDate); district.getRegion(), district.getName(), district.getCategory(), startDate);
@@ -6819,11 +7032,10 @@ public class PropertyController {
if(district != null){ if(district != null){
if(model.getMinPrice() == null){ if(model.getMinPrice() == null){
DistrictStatBo statBo = districtStatService.findCurrentDistrictStat(new DistrictKey(district.getCity(), district.getRegion(), district.getName())); DistrictStatBo statBo = districtStatService.findCurrentDistrictStat(new DistrictKey(district.getCity(), district.getRegion(), district.getName()));
if(statBo != null) { if(statBo != null && (("别墅".equals(district.getEstateType2()) && statBo.getVillaDistrictStat() !=null) || statBo.getDistrictStat() != null)) {
if("别墅".equals(district.getEstateType2())){
if(StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().equals("别墅")){
avgPrice = Double.valueOf(statBo.getVillaDistrictStat().getAvg_price_2b()); avgPrice = Double.valueOf(statBo.getVillaDistrictStat().getAvg_price_2b());
}else{ }else if(statBo.getDistrictStat() !=null){
avgPrice = Double.valueOf(statBo.getDistrictStat().getAvg_price_2b()); avgPrice = Double.valueOf(statBo.getDistrictStat().getAvg_price_2b());
} }
if(ratio != null){ if(ratio != null){
@@ -22,7 +22,7 @@ public class FangjiaOpenExceptionHandler implements ExceptionHandler {
LOGGER.error("请求地址:{}", context.getRequest().getRequestURL().toString(), e); LOGGER.error("请求地址:{}", context.getRequest().getRequestURL().toString(), e);
} }
String ip = getLocalHostIP(); String ip = getLocalHostIP();
String token = "ae14f50045e9375c354940a2afb86f14e453bd1f08f78da0ba6e788d35bccec4"; String token = "b11e4456aa0a15f62fe239a61bc15ce4aefcba7be14b3bff504ebbbfc76f5333";
try { try {
DingDingMessageUtil.sendTextMessage(token, "[OpenApi] "+ip+"服务器内部错误,请及时关注!"); DingDingMessageUtil.sendTextMessage(token, "[OpenApi] "+ip+"服务器内部错误,请及时关注!");
} catch (Exception e1) { } catch (Exception e1) {
@@ -109,7 +109,7 @@ public class AuthenticationInterceptor implements Interceptor {
} }
} catch (Exception e) { } catch (Exception e) {
String ip = getLocalHostIP(); String ip = getLocalHostIP();
String token = "ae14f50045e9375c354940a2afb86f14e453bd1f08f78da0ba6e788d35bccec4"; String token = "b11e4456aa0a15f62fe239a61bc15ce4aefcba7be14b3bff504ebbbfc76f5333";
try { try {
DingDingMessageUtil.sendTextMessage(token, "[OpenApi] "+ip+"Authentication 错误!"); DingDingMessageUtil.sendTextMessage(token, "[OpenApi] "+ip+"Authentication 错误!");
} catch (Exception e1) { } catch (Exception e1) {
@@ -6,6 +6,7 @@ public class AddressModel extends FangjiaApiModel {
private String city; private String city;
private String address; private String address;
private Integer ai;
private String suggestDistrict; private String suggestDistrict;
private Integer businessMatch; private Integer businessMatch;
private Double area; private Double area;
@@ -334,4 +335,12 @@ public class AddressModel extends FangjiaApiModel {
public void setPage(Integer page) { public void setPage(Integer page) {
this.page = page; this.page = page;
} }
public Integer getAi() {
return ai;
}
public void setAi(Integer ai) {
this.ai = ai;
}
} }
@@ -28,6 +28,7 @@ public class AvgPriceQueryModel {
String periodType; String periodType;
Integer houseType; Integer houseType;
String cat; String cat;
String id;
public String getCat() { public String getCat() {
return cat; return cat;
@@ -68,4 +69,12 @@ public class AvgPriceQueryModel {
public void setHouseType(Integer houseType) { public void setHouseType(Integer houseType) {
this.houseType = houseType; this.houseType = houseType;
} }
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
} }
+19
View File
@@ -0,0 +1,19 @@
FROM 192.168.0.19:9010/eclipse-temurin:8-jre
ENV TZ=Asia/Shanghai
# supercronic 本地 COPY,不依赖外网
COPY supercronic /usr/local/bin/supercronic
RUN chmod +x /usr/local/bin/supercronic
WORKDIR /home/goojia/webapps/fangjia-script
COPY target/classes/ .
COPY run.sh .
RUN chmod +x run.sh
RUN mkdir -p /home/goojia/logs
COPY crontab.txt /app/crontab
CMD ["supercronic", "/app/crontab"]
+204
View File
@@ -0,0 +1,204 @@
# 楼盘索引重建
0 6 1 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/gj/level/DistrictIndexBatch > /home/goojia/logs/DistrictIndexBatch.log 2>&1
# API超时分析
*/5 * * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/gj/apiLog/ApiTimeOutAnalyBatch > /home/goojia/logs/ApiTimeOutAnalyBatch.log 2>&1
# API用户访问量统计
1 10 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/gj/apiLog/ApiUserCountAnalyBatch > /home/goojia/logs/ApiUserCountAnalyBatch.log 2>&1
# 楼盘价格数据导出(福州)
#5 5 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fuzhou/DistrictPriceExportBatch > /home/goojia/logs/DistrictPriceExportBatch.log 2>&1
# 搜索自动补全索引更新
1 1 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/index/AutocompleteDataUpdaterBatch > /home/goojia/logs/AutocompleteDataUpdaterBatch.log 2>&1
# 楼盘评级(招商银行)
#30 1 * * 1 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/zsbank/DistrictLevelBatch > /home/goojia/logs/DistrictLevelBatch.log 2>&1
# 成交数据导出(福州)
#20 16 1 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fuzhou/TradeExportBatch > /home/goojia/logs/TradeExportBatch.log 2>&1
# 第三方价格数据导出(福州)
#20 7 1 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fuzhou/ThirdPriceExportBatch > /home/goojia/logs/ThirdPriceExportBatch.log 2>&1
# 房源数据导出(福州,每月10/15日)
#10 4 10 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fuzhou/HouseExportBatch > /home/goojia/logs/HouseExportBatch.log 2>&1
#10 4 15 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fuzhou/HouseExportBatch > /home/goojia/logs/HouseExportBatch.log 2>&1
# 楼盘基本信息导出(福州)
#30 3 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fuzhou/DistrictInfoExportBatch > /home/goojia/logs/DistrictInfoExportBatch.log 2>&1
# 江南空白日更新楼盘刷新
*/10 * * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/jiangnanblank/DayUpdateDistRefreshBatch > /home/goojia/logs/DayUpdateDistRefreshBatch.log 2>&1
# 楼盘在售统计(福州,月底补跑+工作时段高频)
40 7 1 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fuzhou/DistrictSellStatBatch -Dmodel=monthly > /home/goojia/logs/DistrictSellStatBatch.log 2>&1
*/10 8-23 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fuzhou/DistrictSellStatBatch -Dmodel=daily > /home/goojia/logs/DistrictSellStatBatch.log 2>&1
# 开放API使用量监控
15 * * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/api/OpenApiUseStatMonitorBatch > /home/goojia/logs/OpenApiUseStatMonitorBatch.log 2>&1
# 台物网数据批处理
#30 21 1 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/dealPrice/TaiWuWebBatch > /home/goojia/logs/TaiWuWebBatch.log 2>&1
# 均价监控告警
#0 9 * * 0 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/xh/MonitorAvgPrice > /home/goojia/logs/MonitorAvgPrice.log 2>&1
# 插入住宅估价计算指令
10 23 * * 6 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/averager/InsertMonitorCalcCommandBatch > /home/goojia/logs/InsertMonitorCalcCommandBatch.log 2>&1
# 插入商铺/写字楼租金估价计算指令
37 0 1 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/averager/InsertMonitorSquareRentCalcCommandBatch > /home/goojia/logs/InsertMonitorSquareRentCalcCommandBatch.log 2>&1
# ES房价统计
10 2 2 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/gj/EsHousePriceStat > /home/goojia/logs/EsHousePriceStat.log 2>&1
# 楼盘房源面积统计
0 2 1 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/district/DistrictHouseAreaStatBatch > /home/goojia/logs/DistrictHouseAreaStatBatch.log 2>&1
# 成交价格月度统计
0 1 1 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/dealPrice/DealPriceStatBatch > /home/goojia/logs/DealPriceStatBatch.log 2>&1
# 楼盘成交房源统计
30 0 * * 6 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/dealPrice/DistrictTradeHouseStatBatch > /home/goojia/logs/DistrictTradeHouseStatBatch.log 2>&1
# API用户失活监控
0 9 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/api/ApiUserDeadTimeMonitorBatch > /home/goojia/logs/ApiUserDeadTimeMonitorBatch.log 2>&1
# 江南空白基础信息数据同步
0 2 * * 1 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/jiangnanblank/JiangNanBlankBaseInfoDataBatch > /home/goojia/logs/JiangNanBlankBaseInfoDataBatch.log 2>&1
# 高德地图API数据处理
#0 2 1 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/yinjihaun/GaoDeMapApiDataProcess > /home/goojia/logs/GaoDeMapApiDataProcess.log 2>&1
# 开放API产品字段使用统计
0 10 * * 0 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/yinjihaun/batch/ApiProductFieldStatBatch > /home/goojia/logs/ApiProductFieldStatBatch.log 2>&1
# 数据库状态监控
0 1 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/ana/DatabaseStatWatcherBatch > /home/goojia/logs/DatabaseStatWatcherBatch.log 2>&1
# Seaweed数据增量更新
1 19 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/district/SeaweedUpdateTask > /home/goojia/logs/SeaweedUpdateTask.log 2>&1
# 楼盘周边数据分析
23 20 * * 6 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/ana/DistrictAroundDataAnaly > /home/goojia/logs/DistrictAroundDataAnaly.log 2>&1
# 样本质量周报
40 5 * * 1 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/averager/SampleQualityReportBatch > /home/goojia/logs/SampleQualityReportBatch.log 2>&1
# 快照数据监控
05 10 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/temp/shenjian/SnapshotMonitor > /home/goojia/logs/SnapshotMonitor.log 2>&1
# 房价通评估结果自动转抵押基础信息
#0 1 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/hubingliang/FJTevaluationAutoToMortgageInfoBase > /home/goojia/logs/FJTevaluationAutoToMortgageInfoBase.log 2>&1
# 房价通钉钉统计播报
#0 8 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/hubingliang/business/FjtStatisticDDBatch > /home/goojia/logs/FjtStatisticDDBatch.log 2>&1
# 均价质量周报
10 5 * * 1 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/averager/AveragerQualityReportBatch > /home/goojia/logs/AveragerQualityReportBatch.log 2>&1
# 清理Seawater过期数据
1 1 10 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fangrui/DeleteSeawater > /home/goojia/logs/DeleteSeawater.log 2>&1
# 开放URI日志分析同步
13 4 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/sync/AnalysisOpenUriLogSyncBatch > /home/goojia/logs/AnalysisOpenUriLogSyncBatch.log 2>&1
# API访问日志处理
0 4 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fangrui/ApiLog > /home/goojia/logs/ApiLog.log 2>&1
# 清理ES 8.6旧索引
0 1 28 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/temp/shenjian/batch/RemoveOldIndexOfEs86Batch > /home/goojia/logs/RemoveOldIndexOfEs86Batch.log 2>&1
# 楼盘最新价格同步(FSH)
#0 3 * * 6 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fsh/DistrictNewPriceSyncBatch > /home/goojia/logs/DistrictNewPriceSyncBatch.log 2>&1
# 下架房源清理
0 3 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/index/HouseRemoveBatch > /home/goojia/logs/HouseRemoveBatch.log 2>&1
# 楼盘在售房源月度统计
10 0 1 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/house/DistrictSellHouseStatBatch > /home/goojia/logs/DistrictSellHouseStatBatch.log 2>&1
# 城市和区域信息分析
10 1 * * 1 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/dataAna/CityInfoAnaBatch > /home/goojia/logs/CityInfoAnaBatch.log 2>&1 && cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/dataAna/RegionInfoAnaBatch > /home/goojia/logs/RegionInfoAnaBatch.log 2>&1
# 楼盘成交/在售/租赁排名及均价城市排名
10 0 * * 1 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/district/DistrictDealSellRentRankBatch > /home/goojia/logs/DistrictDealSellRentRankBatch.log 2>&1 && cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/ana/DistrictStatRankBatch > /home/goojia/logs/DistrictStatRankBatch.log 2>&1 && cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/ana/DistrictAvgPriceCityRankBatch > /home/goojia/logs/DistrictAvgPriceCityRankBatch.log 2>&1
# 房源覆盖率统计
0 22 3 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/statistic/HouseCoverageRateStatisticBatch > /home/goojia/logs/HouseCoverageRateStatisticBatch.log 2>&1
# CZ全量数据批处理(周日)
20 3 * * 0 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/jiangnanblank/CZDataBatch all > /home/goojia/logs/CZDataBatch.log 2>&1
# CZ当日增量数据批处理
*/20 * * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/jiangnanblank/CZDataBatch > /home/goojia/logs/CZDataBatch_day.log 2>&1
# 写字楼均价统计
10 8 2 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/avgprice/WebOfficeAvgPriceStatistics > /home/goojia/logs/WebOfficeAvgPriceStatistics.log 2>&1
# 链家数据分析
#30 1 * * 2 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/dataAna/LianjiaAnalyBatch > /home/goojia/logs/LianjiaAnalyBatch.log 2>&1
# 个性化评估与登记时间统计
0 1 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/hubingliang/IndividuateEvaAndRegisterTimeStatistical > /home/goojia/logs/IndividuateEvaAndRegisterTimeStatistical.log 2>&1
# 楼盘房源批量更新
0 18 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/district/DistrictHouseBatch > /home/goojia/logs/DistrictHouseBatch.log 2>&1
# Seawater数据监控
0 10 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/temp/shenjian/SeawaterMonitor > /home/goojia/logs/SeawaterMonitor.log 2>&1
# Marsoft数据导出
0 1 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/marsoftdata/MarsoftExporter out.dir=/home/goojia/marsoft > /home/goojia/logs/MarsoftExporter.log 2>&1
# Seaweed地理坐标系转换
22 1 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/district/SeaweedGeoSysConvertBatch > /home/goojia/logs/SeaweedGeoSysConvertBatch.log 2>&1
# 楼盘租赁FPK数据批处理
0 8 1 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/rent/DistrictRentFPKBatch > /home/goojia/logs/DistrictRentFPKBatch.log 2>&1
# 城市房源数量统计(FSH)
0 3 1 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fsh/CityHouseCountStatBatch > /home/goojia/logs/CityHouseCountStatBatch.log 2>&1
# 贷款线索同步CRM
*/10 * * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/loanLeadToCRM/LoanLeadSync > /home/goojia/logs/LoanLeadSync.log 2>&1
# 用户UA分析
56 14 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/ana/UserAgentAnalysisBatch > /home/goojia/logs/UserAgentAnalysisBatch.log 2>&1
# 开放API日志分析
0 8 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/openApi/OpenApiLogAnalyBatch > /home/goojia/logs/OpenApiLogAnalyBatch.log 2>&1
# 楼盘出租房源统计
2 0 * * 0 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/house/DistrictRentHouseStatBatch > /home/goojia/logs/DistrictRentHouseStatBatch.log 2>&1
# 查找在建楼盘
1 1 * * 5 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/ana/FindStageDistrictBatch > /home/goojia/logs/FindStageDistrictBatch.log 2>&1
# 读取后台退场日志
0 5 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/log/ReadBackoffLogBatch > /home/goojia/logs/ReadBackoffLogBatch.log 2>&1
# 读取动态访问日志
15 2 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/log/ReadAnalyDynamicLog > /home/goojia/logs/ReadAnalyDynamicLog.log 2>&1
# 楼盘在售房源统计(周日补跑)
0 10 * * 0 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/house/DistrictSellHouseStatBatch > /home/goojia/logs/DistrictSellHouseStatBatch.log 2>&1
# 中原成交价格爬虫
1 7 15 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/dealPrice/CentanetDealPriceCrawler > /home/goojia/logs/CentanetDealPriceCrawler.log 2>&1
# 更新楼盘行政区划编码
0 3 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/yinjihaun/batch/UpdateDistrictCodeBatch > /home/goojia/logs/UpdateDistrictCodeBatch.log 2>&1
# 房价通用户点击日志分析
0 3 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fangjiatong/FjtUserClickLogAnalyBatch > /home/goojia/logs/FjtUserClickLogAnalyBatch.log 2>&1
# 第三方数据汇总
0 3 15 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/thirdPriceCrawl/ThirdDataToGatherBatch > /home/goojia/logs/ThirdDataToGatherBatch.log 2>&1
# 成交价格单位统一
1 7 * * 6 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/dealPrice/parse/DealPriceUnitUniteBatch > /home/goojia/logs/DealPriceUnitUniteBatch.log 2>&1
# 导入索引统计数据
0 1 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/trade/ImportIndexStats > /home/goojia/logs/ImportIndexStats.log 2>&1
# Seaweed索引重建
25 1 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/index/SeaweedReIndexBatch > /home/goojia/logs/SeaweedReIndexBatch.log 2>&1
# 楼盘信息分析(FPK)
0 2 4 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fpk/DistrictInfoAnaly > /home/goojia/logs/DistrictInfoAnaly.log 2>&1
# 每日房源统计
0 2 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fsh/DayHouseStatBatch > /home/goojia/logs/DayHouseStatBatch.log 2>&1
# 楼盘关注日志计算
25 21 5 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/log/DistrictAttentionLogCaculateBatch > /home/goojia/logs/DistrictAttentionLogCaculateBatch.log 2>&1
# 自动发现新楼盘
#4 3 * * 6 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/auto/DistrictAutoFindBatch > /home/goojia/logs/DistrictAutoFindBatch.log 2>&1
# 第三方价格数据标准化
0 2 13 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/thirdPriceCrawl/DataStandardBatch > /home/goojia/logs/DataStandardBatch.log 2>&1
# 生成爬虫抓取指令
0 1 * * 5 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/crawl/CrawlCommandGeneratorBatch > /home/goojia/logs/CrawlCommandGeneratorBatch.log 2>&1
# 外部房地产网站数据同步
0 10 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/zongzhimin/WSFangDiChan > /home/goojia/logs/WSFangDiChan.log 2>&1
# 楼盘经纪人报告
30 21 12 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/report/DistrictAgentBatch > /home/goojia/logs/DistrictAgentBatch.log 2>&1
# 勤智月度消费评级统计
30 1 1 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/grade/ConsumptionRatingBatch > /home/goojia/logs/QinZhiMonthStatisticBatch.log 2>&1
# 城市价格指数
0 4 * * 1 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fsh/CityPriceIndexBatch > /home/goojia/logs/CityPriceIndexBatch.log 2>&1
# 住宅成交价格爬虫(中原)
43 14 * * 2 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/dealPrice/ResDealPriceCrawlerBatch > /home/goojia/logs/ResDealPriceCrawlerBatch.log 2>&1
# 复制开放URI日志
30 3 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/sync/CopyOpenUriLog > /home/goojia/logs/CopyOpenUriLog.log 2>&1
# 楼盘价格对比
35 4 * * 1 cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/price/DistrictPriceCompareBatch > /home/goojia/logs/DistrictPriceCompareBatch.log 2>&1
# 成交价格覆盖率统计
0 23 3 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/statistic/DealPriceCoverageRateStatisticBatch > /home/goojia/logs/DealPriceCoverageRateStatisticBatch.log 2>&1
# 第三方价格页面分析
0 1 5 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/thirdPriceCrawl/AnalysisPageBatch > /home/goojia/logs/AnalysisPageBatch.log 2>&1
# 成交价格数据导入
25 23 14 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/dealPrice/TransactionPriceImportBatch > /home/goojia/logs/TransactionPriceImportBatch.log 2>&1
# 成交楼盘统计
10 22 1 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/trade/TradeDistrictStatBatch > /home/goojia/logs/TradeDistrictStatBatch.log 2>&1
# 同步楼盘价格至第三方
0 17 11 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/thirdPriceCrawl/SynchDistrictPrice > /home/goojia/logs/SynchDistrictPrice.log 2>&1
# 楼盘字段补录
0 1 21 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/gj/district/DistrictFieldAddBatch > /home/goojia/logs/DistrictFieldAddBatch.log 2>&1
# 法拍网大数据-社区基础数据
0 14 18 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommunityBatch > /home/goojia/logs/FjwBigdataCommunityBatch.log 2>&1
# 法拍网大数据-楼栋类型数据
0 16 18 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommbuildtypeBatch > /home/goojia/logs/FjwBigdataCommbuildtypeBatch.log 2>&1
# 法拍网大数据-在售数据
0 12 20 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch > /home/goojia/logs/FjwBigdataForsaleBatch.log 2>&1
# 法拍网-第三方参考价
3 5 19 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/gj/fjwPriceBaseData/FjwThirdPartyPriceBatch > /home/goojia/logs/FjwThirdPartyPriceBatch.log 2>&1
# 法拍网大数据-成交数据
3 22 20 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataDealBatch > /home/goojia/logs/FjwBigdataDealBatch.log 2>&1
# 法拍网-规定价格
0 16 20 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/gj/fjwPriceBaseData/FjwGuiDingPriceBatch > /home/goojia/logs/FjwGuiDingPriceBatch.log 2>&1
# 第三方数据分析处理
0 3 20 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/gj/data_handle/ThardParthAnalyBatch > /home/goojia/logs/ThardParthAnalyBatch.log 2>&1
# 台湾相关楼盘数据关联
30 12 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/gj/xiamen/RelatedTaiWanBatch > /home/goojia/logs/RelatedTaiWanBatch.log 2>&1
# 成交价格同步到ES
30 23 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/dealPrice/SynchDealPriceToEs > /home/goojia/logs/SynchDealPriceToEs.log 2>&1
# 同步开发环境数据
0 6 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/gj/data_handle/SynchDevDataBatch > /home/goojia/logs/SynchDevDataBatch.log 2>&1
# 厦门村庄数据批处理(月初高频)
#*/10 * 1-30 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/gj/xiamen/XiaMenVillageBatch > /home/goojia/logs/XiaMenVillageBatch.log 2>&1
# API调用次数统计
0 9 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/hubingliang/ApiInvokeStatistics > /home/goojia/logs/ApiInvokeStatistics.log 2>&1
# Seawater到Seabird数据同步
1 2 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/sync/Seawater2SeabirdSyncBatch > /home/goojia/logs/Seawater2SeabirdSyncBatch.log 2>&1
@@ -0,0 +1,8 @@
services:
fangjia-script:
image: 192.168.0.19:9011/fangjia-script:latest
restart: unless-stopped
volumes:
- /home/goojia/logs:/home/goojia/logs
environment:
- TZ=Asia/Shanghai
+45 -22
View File
@@ -22,6 +22,8 @@
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>
<!-- 保留:把依赖 jar 复制到 classes/lib -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
@@ -29,9 +31,7 @@
<execution> <execution>
<id>copy-dependencies</id> <id>copy-dependencies</id>
<phase>prepare-package</phase> <phase>prepare-package</phase>
<goals> <goals><goal>copy-dependencies</goal></goals>
<goal>copy-dependencies</goal>
</goals>
<configuration> <configuration>
<outputDirectory>${project.build.directory}/classes/lib</outputDirectory> <outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases> <overWriteReleases>false</overWriteReleases>
@@ -41,8 +41,43 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- 新增:打 fat jar,classes + lib + groovy 全部打入 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<executions>
<execution>
<phase>package</phase>
<goals><goal>shade</goal></goals>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<artifactSet>
<excludes>
<!-- The driver is loaded from lib; shading it too triggers its duplicate-version check. -->
<exclude>org.elasticsearch.plugin:x-pack-sql-jdbc</exclude>
</excludes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<!-- 排除签名文件,避免 jar 校验失败 -->
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
<resources> <resources>
<!-- 保留:Groovy 源文件和脚本打入 classes -->
<resource> <resource>
<filtering>false</filtering> <filtering>false</filtering>
<directory>${basedir}/src/main/groovy</directory> <directory>${basedir}/src/main/groovy</directory>
@@ -60,10 +95,10 @@
</includes> </includes>
</resource> </resource>
</resources> </resources>
<!-- 保留:m2e Eclipse 配置 -->
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin> <plugin>
<groupId>org.eclipse.m2e</groupId> <groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId> <artifactId>lifecycle-mapping</artifactId>
@@ -73,24 +108,12 @@
<pluginExecutions> <pluginExecutions>
<pluginExecution> <pluginExecution>
<pluginExecutionFilter> <pluginExecutionFilter>
<groupId> <groupId>org.apache.maven.plugins</groupId>
org.apache.maven.plugins <artifactId>maven-dependency-plugin</artifactId>
</groupId> <versionRange>[2.1,)</versionRange>
<artifactId> <goals><goal>copy-dependencies</goal></goals>
maven-dependency-plugin
</artifactId>
<versionRange>
[2.1,)
</versionRange>
<goals>
<goal>
copy-dependencies
</goal>
</goals>
</pluginExecutionFilter> </pluginExecutionFilter>
<action> <action><ignore></ignore></action>
<ignore></ignore>
</action>
</pluginExecution> </pluginExecution>
</pluginExecutions> </pluginExecutions>
</lifecycleMappingMetadata> </lifecycleMappingMetadata>
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
CLASSPATH="./:./lib/*:fangjia-script.jar"
JVM_OPTS=()
GROOVY_ARGS=()
for arg in "$@"; do
case "$arg" in
-D*) JVM_OPTS+=("$arg") ;;
*) GROOVY_ARGS+=("$arg") ;;
esac
done
exec java "${JVM_OPTS[@]}" -cp "$CLASSPATH" groovy.ui.GroovyMain "${GROOVY_ARGS[@]}"
@@ -112,7 +112,7 @@ abstract class BaseBatch {
} }
def phoneNum = getBatchPhones(batch) def phoneNum = getBatchPhones(batch)
if(SystemUtils.IS_OS_LINUX){ if(SystemUtils.IS_OS_LINUX){
sendDingDingMsg("ae14f50045e9375c354940a2afb86f14e453bd1f08f78da0ba6e788d35bccec4",msg, phoneNum) sendDingDingMsg("b11e4456aa0a15f62fe239a61bc15ce4aefcba7be14b3bff504ebbbfc76f5333",msg, phoneNum)
// try { // try {
// Map<String, String> params = new HashMap<String, String>(); // Map<String, String> params = new HashMap<String, String>();
@@ -1,23 +1,18 @@
package com.fangjia.script.averager package com.fangjia.script.averager
import com.fangjia.core.util.DataUtil import com.fangjia.core.Constants
import com.fangjia.core.util.DateUtil import com.fangjia.core.util.DateUtil
import com.fangjia.datastore.driver.DSCollection
import com.fangjia.datastore.driver.DSCursor
import com.fangjia.datastore.driver.DataStore
import com.fangjia.script.BaseBatch import com.fangjia.script.BaseBatch
import com.fangjia.script.BatchOwner import com.fangjia.script.BatchOwner
import com.fangjia.script.Watcher import com.fangjia.script.Watcher
import com.fangjia.script.cover.EmailTemplate
import com.fangjia.script.jms.QueueRedirectConsumer
import com.fangjia.script.util.Jms import com.fangjia.script.util.Jms
import com.fangjia.script.util.MongoUtils import com.fangjia.script.util.MongoUtils
import com.fangjia.script.util.ServerAreaMap import com.fangjia.script.util.ServerAreaMap
import com.google.common.collect.MapDifference import com.mongodb.BasicDBObject
import com.google.common.collect.Maps import com.mongodb.DBCollection
import com.mongodb.* import com.mongodb.DBCursor
import com.mongodb.DBObject
import org.apache.commons.lang.StringUtils import org.apache.commons.lang.StringUtils
import org.bson.types.ObjectId
/** /**
* 通知计算二手房均价 * 通知计算二手房均价
@@ -31,7 +26,7 @@ class InsertMonitorSquareRentCalcCommandBatch extends BaseBatch {
// public static final DSCollection SEAWEED_COLL = new DataStore("seaweed.db.fangjia.com", 27007).getCollection("fangjia.seaweed") // public static final DSCollection SEAWEED_COLL = new DataStore("seaweed.db.fangjia.com", 27007).getCollection("fangjia.seaweed")
public static final DBCollection SEAWEED_COLL = MongoUtils.getCollectionByName("fangjia", "seaweed", "mongo.db.fangjia.com") public static final DBCollection SEAWEED_COLL = MongoUtils.getCollectionByName("fangjia", "seaweed", "mongo.db.fangjia.com")
public final static DBCollection COMMAND_COLL = new MongoClient("log.mongo.db.fangjia.com", 52002).getDB('fangjia_log').getCollection('calc_command') public final static DBCollection COMMAND_COLL = com.fangjia.core.util.MongoUtils.getDbCollection(Constants.SEAWATER_MONGO_URI, 'fangjia_log', 'calc_command')
public final static DBCollection SQMETRE_RENT_COLL = MongoUtils.getCollectionByName("fangjia", "sqmetre_rent", "mongo.db.fangjia.com") public final static DBCollection SQMETRE_RENT_COLL = MongoUtils.getCollectionByName("fangjia", "sqmetre_rent", "mongo.db.fangjia.com")
public final static DBCollection REGION_COLL = MongoUtils.getCollectionByName("fangjia", "region_block", "mongo.db.fangjia.com") public final static DBCollection REGION_COLL = MongoUtils.getCollectionByName("fangjia", "region_block", "mongo.db.fangjia.com")
@@ -4995,8 +4995,7 @@ class CommonDatautils {
q.put("city", city) q.put("city", city)
q.put("region", region) q.put("region", region)
q.put("name", name) q.put("name", name)
q.put("s_date", new BasicDBObject('$gte', startDate).append('$lte',endDate)) q.put("s_date", new BasicDBObject('$gte', startDate).append('$lte', endDate))
def dbcursor = thirdpartColl.find(q).sort(new BasicDBObject("s_date", -1)) def dbcursor = thirdpartColl.find(q).sort(new BasicDBObject("s_date", -1))
def map = [:] def map = [:]
for(def db : dbcursor){ for(def db : dbcursor){
@@ -1,5 +1,6 @@
package com.fangjia.script.fuzhou package com.fangjia.script.fuzhou
import com.fangjia.core.Constants
import com.fangjia.core.util.DataUtil import com.fangjia.core.util.DataUtil
import com.fangjia.script.BaseBatch import com.fangjia.script.BaseBatch
import com.fangjia.script.BatchOwner import com.fangjia.script.BatchOwner
@@ -28,7 +29,7 @@ class DistrictSellStatBatch extends BaseBatch {
static DBCollection DISTRICT_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_sell_stat", "mongo.db.fangjia.com") static DBCollection DISTRICT_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_sell_stat", "mongo.db.fangjia.com")
static final DBCollection FZ_DIST_COLL = MongoUtils.getCollectionByName("business", "fz_district", "mongo.db.fangjia.com") static final DBCollection FZ_DIST_COLL = MongoUtils.getCollectionByName("business", "fz_district", "mongo.db.fangjia.com")
public static final DBCollection COMMAND_COLL = MongoUtils.getCollectionByName("fangjia_log", "calc_command", "log.mongo.db.fangjia.com",52002) public final static DBCollection COMMAND_COLL = com.fangjia.core.util.MongoUtils.getDbCollection(Constants.SEAWATER_MONGO_URI, 'fangjia_log', 'calc_command')
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20) public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20)
@@ -41,18 +42,15 @@ class DistrictSellStatBatch extends BaseBatch {
@Override @Override
void process(Object args) { void process(Object args) {
// def months = DateUtils.getMonthList(202510) // def months = DateUtils.getMonthList(202606)
// months = months[0..(months.size()-1)] // months = months[0..(months.size()-1)]
// println months // println months
// for(def month : months){ // for(def month : months){
// def curDate = DateUtils.parseFromTightByPattern(month.toString()+"01", "yyyyMMdd") // def curDate = DateUtils.parseFromTightByPattern(month.toString()+"01", "yyyyMMdd")
// calcMonthlyPrice(curDate) // calcMonthlyPrice(curDate)
// } // }
String model = System.getProperty("model", "daily");
def date = new Date() if(model == "monthly"){
def day = date.getDate()
def hours = date.getHours()
if(day == 2 && hours<7){
calcMonthlyPrice() //正常算一期 calcMonthlyPrice() //正常算一期
}else{ }else{
//根据calc_type算历史 //根据calc_type算历史
@@ -5,6 +5,7 @@ import com.fangjia.core.util.HttpRequest
import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.gj.EsUtils import com.fangjia.script.gj.EsUtils
import com.fangjia.script.util.CommonUtils import com.fangjia.script.util.CommonUtils
import com.fangjia.script.util.DbUtils
import com.fangjia.script.util.ElasticUtils import com.fangjia.script.util.ElasticUtils
import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils import com.fangjia.script.util.MongoUtils
@@ -14,30 +15,55 @@ import com.mongodb.DBCollection
import java.util.concurrent.atomic.AtomicInteger import java.util.concurrent.atomic.AtomicInteger
class GongShu { class GongShu {
static DBCollection DISTRICT_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_sell_stat", "mongo.db.fangjia.com")
static main(args) { static main(args) {
def task = new GongShu(); def task = new GongShu();
task.run(); task.run();
} }
def run() { def run() {
String path1 = "D:\\数据\\福州\\福州200个小区抽样价格核验202603.xlsx"; def data = [["ID","区域","小区名称","供数价格","贝壳成交价","安居客价格(挂牌价*0.9)","麦田价格(挂牌价*0.9)","房天下价格(挂牌价*0.9)","城市房产价格(挂牌价*0.9)","供数价格与贝壳成交价差异"]]
// String path1 = "D:\\数据\\福州\\价格比对_20240915.xlsx"; DbUtils.seaweed.find(DbUtils.buildSeaweedQuery("福州"), new BasicDBObject("region", 1).append("name", 1)).each {
String path2 = "E:\\goojia\\file\\excel文件\\福州\\福州202410小区价格.xlsx"; data << [it._id.toString(), it.region, it.name]
// String path2 = "E:\\goojia\\file\\excel文件\\福州\\福州202410小区价格.xlsx"; }
String path3 = "E:\\goojia\\file\\excel文件\\福州\\福州贝壳小区.xlsx"; for(def yearMonth in [202604,202605,202606, 202607]){
// String path2 = "E:\\goojia\\file\\excel文件\\福州\\1.xlsx"; // ExcelUtils.write("D:\\数据\\福州\\福州200个小区抽样价格核验${yearMonth}.xlsx", data, "sheet1")
// String path1 = "E:\\goojia\\file\\excel文件\\福州\\福州全部小区.xlsx"; // def query = new BasicDBObject()
// findID(path2) // query.append("city", "福州")
// findDelDistrict(path2) // query.append("date", yearMonth)
// findDistrictByAlias(path2) // def stat = [:]
// match19UseMAP(path2) // DISTRICT_SELL_STAT.find(query, new BasicDBObject("region", 1).append("district_name", 1).append("avg_price", 1)).each {
// addFjwPrice(path2) // stat.put("${it.region}_${it.district_name}".toString(), it.avg_price)
// }
// ExcelUtils.multiThreadingModify("D:\\数据\\福州\\福州200个小区抽样价格核验${yearMonth}.xlsx",{List item->
// item["D"] = stat.get("${item['B']}_${item['C']}".toString(), null)
// })
priceAvg("D:\\数据\\福州\\福州200个小区抽样价格核验${yearMonth}.xlsx")
}
// match(path2, path1)
// match2(path3, path1)
// houseCase(path2)
thirdPrice(path1)
priceAvg(path1) // String path1 = "D:\\福州200个小区抽样价格核验202604.xlsx";
//// String path1 = "D:\\数据\\福州\\价格比对_20240915.xlsx";
// String path2 = "E:\\goojia\\file\\excel文件\\福州\\福州202410小区价格.xlsx";
//// String path2 = "E:\\goojia\\file\\excel文件\\福州\\福州202410小区价格.xlsx";
// String path3 = "E:\\goojia\\file\\excel文件\\福州\\福州贝壳小区.xlsx";
//// String path2 = "E:\\goojia\\file\\excel文件\\福州\\1.xlsx";
//// String path1 = "E:\\goojia\\file\\excel文件\\福州\\福州全部小区.xlsx";
//// findID(path2)
//// findDelDistrict(path2)
//// findDistrictByAlias(path2)
//// match19UseMAP(path2)
//// addFjwPrice(path2)
//
//// match(path2, path1)
//// match2(path3, path1)
//// houseCase(path2)
// thirdPrice(path1)
// priceAvg(path1)
// futurePrice(path2) // futurePrice(path2)
// rePrice(path2) // rePrice(path2)
} }
@@ -319,7 +345,7 @@ class GongShu {
}) })
} }
//查找三方价格 //查找三方价格
def thirdPrice(path1) { def thirdPrice(path1 ,yearMonth) {
def count = 0 def count = 0
ExcelUtils.multiThreadingModify( path1, { List d -> ExcelUtils.multiThreadingModify( path1, { List d ->
count++ count++
@@ -329,7 +355,7 @@ class GongShu {
def city = "福州" def city = "福州"
def region = d['B'] def region = d['B']
def name = d['C'] def name = d['C']
def valusMap = CommonDatautils.findThirdPartyPrice(city, region, name, 202512, 202603) def valusMap = CommonDatautils.findThirdPartyPrice(city, region, name, 202601, yearMonth)
if (valusMap) { if (valusMap) {
def dataMap = valusMap.get(city + "##" + region + "##" + name) def dataMap = valusMap.get(city + "##" + region + "##" + name)
if (dataMap.get("anjuke_esf_price")) { if (dataMap.get("anjuke_esf_price")) {
@@ -794,7 +794,7 @@ class OpenApiUtils {
static def addrVerifyXiameng(city, address, type){ static def addrVerifyXiameng(city, address, type){
address = URLEncoder.encode(address, "utf-8"); address = URLEncoder.encode(address, "utf-8");
def url = "http://192.168.0.80:32080/FangJiaAddressService/v7/villageIdentify?address=${address}&type=${type}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" def url = "http://192.168.0.80:32080/FangJiaAddressService/v7/villageIdentify?address=${address}&ai=1&type=${type}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB"
// def url = "http://localhost:8080/fangjia-open/addrSvc/njcbVillageIdentify?address=${address}&type=${type}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" // def url = "http://localhost:8080/fangjia-open/addrSvc/njcbVillageIdentify?address=${address}&type=${type}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB"
if(city){ if(city){
url = url + "&city=${city}" url = url + "&city=${city}"
@@ -9,6 +9,7 @@ import com.fangjia.script.util.DateUtil
import com.fangjia.script.util.DateUtils import com.fangjia.script.util.DateUtils
import com.fangjia.script.util.DbUtils import com.fangjia.script.util.DbUtils
import com.fangjia.script.util.ElasticUtils import com.fangjia.script.util.ElasticUtils
import com.fangjia.script.util.ExcelRow
import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils import com.fangjia.script.util.MongoUtils
import com.fangjia.script.wenyan.taobao.BidRecordsParseBatch import com.fangjia.script.wenyan.taobao.BidRecordsParseBatch
@@ -26,6 +27,7 @@ class HongXingMonthBatch extends BaseBatch{
static DBCollection OFFICE_RENT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "office_rent_stat", "mongo.db.fangjia.com") static DBCollection OFFICE_RENT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "office_rent_stat", "mongo.db.fangjia.com")
static DBCollection OFFICE_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "office_sell_stat", "mongo.db.fangjia.com") static DBCollection OFFICE_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "office_sell_stat", "mongo.db.fangjia.com")
static DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com") static DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com")
static String matchIdLabel = "AM"
static main(args) { static main(args) {
runBatch(new HongXingMonthBatch(), args); runBatch(new HongXingMonthBatch(), args);
} }
@@ -36,10 +38,11 @@ class HongXingMonthBatch extends BaseBatch{
// createTestFile(); // createTestFile();
// mergeFile() // mergeFile()
// mergeMatchId() // mergeMatchId()
def fileName = "C:\\Users\\wenyan\\Desktop\\宏信交付数据\\宏信楼盘5月监测20260520交付.xlsx" def fileName = "C:\\Users\\wenyan\\Desktop\\宏信交付数据\\宏信楼盘9月监测20260920交付.xlsx"
def removeAddrFile = "C:\\Users\\wenyan\\Desktop\\宏信交付数据\\20260520宏信.xlsx" def removeAddrFile = "C:\\Users\\wenyan\\Desktop\\宏信交付数据\\20260920宏信.xlsx"
def addAddrData = ExcelUtils.read(removeAddrFile, 2, 1)
def removeAddrs = [] def removeAddrs = []
ExcelUtils.read(removeAddrFile, 0).each {List item-> ExcelUtils.read(removeAddrFile, 1).each {List item->
removeAddrs << item["C"] removeAddrs << item["C"]
} }
ExcelUtils.modify(fileName,{List item-> ExcelUtils.modify(fileName,{List item->
@@ -49,7 +52,7 @@ class HongXingMonthBatch extends BaseBatch{
} }
}) })
def fixPriceAddrs = [:] def fixPriceAddrs = [:]
ExcelUtils.read(removeAddrFile, 1).each {List item-> ExcelUtils.read(removeAddrFile, 0).each {List item->
if(item["A"] && item["B"]){ if(item["A"] && item["B"]){
fixPriceAddrs.put(item["A"],item["B"].toString().toDouble().toInteger()) fixPriceAddrs.put(item["A"],item["B"].toString().toDouble().toInteger())
} }
@@ -57,7 +60,7 @@ class HongXingMonthBatch extends BaseBatch{
} }
def stat = [:] def stat = [:]
//获取上个月的交付价格 //获取上个月的交付价格
def lastMonthPriceRowId = "P" //上个月均价所在列号 def lastMonthPriceRowId = "R" //上个月均价所在列号
ExcelUtils.read(fileName).each{List item-> ExcelUtils.read(fileName).each{List item->
if(item[lastMonthPriceRowId]){ if(item[lastMonthPriceRowId]){
stat.put(item["C"], item[lastMonthPriceRowId]) stat.put(item["C"], item[lastMonthPriceRowId])
@@ -68,6 +71,20 @@ class HongXingMonthBatch extends BaseBatch{
def count = findCurMonthPrice(lastMonthStr) def count = findCurMonthPrice(lastMonthStr)
if(count > 0){ if(count > 0){
def datas = ExcelUtils.read(fileName) def datas = ExcelUtils.read(fileName)
for(def item in addAddrData){
def buffer = new ExcelRow()
buffer['C'] = item["A"]
buffer['I'] = item["B"]
buffer[matchIdLabel] = item["D"]
buffer["F"] = item["E"]
buffer["G"] = item["F"]
buffer['A'] = item["G"]
buffer["B"] = item["H"]
datas.add(buffer)
if(item["A"] && item["C"]){
fixPriceAddrs.put(item["A"],item["C"].toString().toDouble().toInteger())
}
}
def newDatas = createDatas(datas, lastMonthStr, fixPriceAddrs) def newDatas = createDatas(datas, lastMonthStr, fixPriceAddrs)
def curDateStr = DateUtils.formatDateByPattern(new Date(),"yyyyMMdd") def curDateStr = DateUtils.formatDateByPattern(new Date(),"yyyyMMdd")
ExcelUtils.write(fileName, newDatas,"结果${curDateStr}") ExcelUtils.write(fileName, newDatas,"结果${curDateStr}")
@@ -123,8 +140,8 @@ class HongXingMonthBatch extends BaseBatch{
def createDatas(datas, lastMonthStr, Map fixPriceAddrs){ def createDatas(datas, lastMonthStr, Map fixPriceAddrs){
def rows = [] def rows = []
rows << ["物业类型","名称","地址","期房/现房","处置状态","省份","城市","城市排名","面积","1月评估单价(元)","1月评估总价(元)","2月评估单价(元)","2月评估总价(元)","3月评估单价", "3月评估总价(元)","4月评估单价", "4月评估总价(元)","5月评估单价", "5月评估总价(元)" rows << ["物业类型","名称","地址","期房/现房","处置状态","省份","城市","城市排名","面积","1月评估单价(元)","1月评估总价(元)","2月评估单价(元)","2月评估总价(元)","3月评估单价", "3月评估总价(元)","4月评估单价", "4月评估总价(元)","5月评估单价","5月评估总价(元)","6月评估单价", "6月评估总价(元)","7月评估单价", "7月评估总价(元)","8月评估单价", "8月评估总价(元)","9月评估单价", "9月评估总价(元)"
,"环比涨跌幅(%)","计算方式","定基涨跌幅(相比首月波动)","5月区域均价","5月区域均价涨跌幅(%)","4月楼盘所在区域价格的排名(仅针对住宅)","5月楼盘所在区域价格的排名(仅针对住宅)","楼盘所在区域排名变化(仅针对住宅)","近3个月内成交量","近6个月成交量","3个月挂牌量","匹配ID-新","备注","情况说明"] ,"环比涨跌幅(%)","计算方式","定基涨跌幅(相比首月波动)","9月区域均价","9月区域均价涨跌幅(%)","8月楼盘所在区域价格的排名(仅针对住宅)","9月楼盘所在区域价格的排名(仅针对住宅)","楼盘所在区域排名变化(仅针对住宅)","近3个月内成交量","近6个月成交量","3个月挂牌量","匹配ID-新","备注","情况说明"]
def index = 1 def index = 1
for(def d : datas){ for(def d : datas){
println d['B'] println d['B']
@@ -147,13 +164,21 @@ class HongXingMonthBatch extends BaseBatch{
row << d['O'] row << d['O']
row << d['P'] row << d['P']
row << d['Q'] row << d['Q']
row << d['R']
row << d['S']
row << d['T']
row << d['U']
row << d['V']
row << d['W']
row << d['X']
row << d['Y']
if(d['E'] == "已处置"){ if(d['E'] == "已处置"){
rows << row rows << row
continue continue
} }
def currMonthUnitPriceLabel = "R" def currMonthUnitPriceLabel = "Z"
def preMonthUnitPriceLabel = "P" def preMonthUnitPriceLabel = "X"
def matchIdLabel = "AE" def matchIdLabel = "AM"
if(!["商铺","办公楼"].contains(d['A'])){ if(!["商铺","办公楼"].contains(d['A'])){
def dist = CommonDatautils.findDistrictById(d[matchIdLabel]) def dist = CommonDatautils.findDistrictById(d[matchIdLabel])
if(dist){ if(dist){
@@ -209,7 +234,6 @@ class HongXingMonthBatch extends BaseBatch{
row << "" row << ""
row << "" row << ""
row << "" row << ""
} }
def regionPriceObj = findRegionPrice(dist.city, dist.region, lastMonthStr) def regionPriceObj = findRegionPrice(dist.city, dist.region, lastMonthStr)
@@ -243,7 +267,7 @@ class HongXingMonthBatch extends BaseBatch{
row << findHouse(dist) row << findHouse(dist)
}else{ }else{
println d[matchIdLabel] +" 未找到该id的楼盘" println d[matchIdLabel] +" 未找到该id的楼盘:${d}"
} }
}else{ }else{
def dist = CommonDatautils.findDistrictById(d[matchIdLabel]) def dist = CommonDatautils.findDistrictById(d[matchIdLabel])
@@ -253,6 +277,13 @@ class HongXingMonthBatch extends BaseBatch{
if(d['A'] == "办公楼"){ if(d['A'] == "办公楼"){
cityMarkupObj = findRentOfficeMarkup(dist.city, null, lastMonthStr, "city") cityMarkupObj = findRentOfficeMarkup(dist.city, null, lastMonthStr, "city")
regionMarkupObj = findSellOfficeMarkup(dist.city, dist.region, lastMonthStr, "district") regionMarkupObj = findSellOfficeMarkup(dist.city, dist.region, lastMonthStr, "district")
println(dist.city)
if(cityMarkupObj.mom == null){
def lastMonthPreStr = com.fangjia.core.util.DateUtil.add(com.fangjia.core.util.DateUtil.parseDate(lastMonthStr, "yyyyMM"), Calendar.MONTH, -1).format("yyyyMM")
def cityMarkupObjPre = findRentOfficeMarkup(dist.city, null, lastMonthPreStr, "city")
cityMarkupObj.mom = DataUtil.getRound(2, (cityMarkupObj.avg_price - cityMarkupObjPre.avg_price)*100/cityMarkupObjPre.avg_price)
println(cityMarkupObj)
}
if(cityMarkupObj){ if(cityMarkupObj){
println cityMarkupObj println cityMarkupObj
cityMarkupObj.mom = cityMarkupObj.mom / 100 cityMarkupObj.mom = cityMarkupObj.mom / 100
@@ -267,6 +298,9 @@ class HongXingMonthBatch extends BaseBatch{
regionMarkupObj = findSellShopMarkup(dist.city, dist.region, lastMonthStr, "district") regionMarkupObj = findSellShopMarkup(dist.city, dist.region, lastMonthStr, "district")
} }
if(cityMarkupObj){ if(cityMarkupObj){
if(fixPriceAddrs.containsKey(d['C'])){
d[currMonthUnitPriceLabel] = fixPriceAddrs[d['c']]
}
if(d[currMonthUnitPriceLabel]){ if(d[currMonthUnitPriceLabel]){
def newAvgPrice = d[currMonthUnitPriceLabel] def newAvgPrice = d[currMonthUnitPriceLabel]
row << DataUtil.getRound(newAvgPrice) row << DataUtil.getRound(newAvgPrice)
@@ -347,8 +381,8 @@ class HongXingMonthBatch extends BaseBatch{
} }
} }
row << d[matchIdLabel] row << d[matchIdLabel]
row << d['AF'] row << d['AN']
row << d['AG'] row << d['AO']
rows << row rows << row
} }
@@ -48,7 +48,6 @@ class XiaMenVillageBatch extends BaseBatch{
rows << row rows << row
} }
} }
ExcelUtils.write("C:\\Users\\wenyan\\IdeaProjects\\main\\projects\\fangjia-script\\src\\main\\groovy\\com\\fangjia\\script\\gj\\xiamen\\xmbank_2026-05_result.xlsx", rows, "结果")
uploadExcel(rows, outFileName) uploadExcel(rows, outFileName)
println "新增文件,上传已完成 "+DateUtil.formatByPattern(new Date(), "yyyy-MM-dd HH:mm:ss") println "新增文件,上传已完成 "+DateUtil.formatByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")
println "*******************************************************************************************" println "*******************************************************************************************"
@@ -25,10 +25,10 @@ class HouseRemoveBatch extends BaseBatch {
"sell" : 180, "sell" : 180,
"rent" : 30, "rent" : 30,
"shop_sell" : 30, "shop_sell" : 360,
"office_sell": 30, "office_sell": 360,
"shop_rent" : 30, "shop_rent" : 360,
"office_rent": 30 "office_rent": 360
] ]
@@ -1,5 +1,6 @@
package com.fangjia.script.jms package com.fangjia.script.jms
import com.fangjia.core.Constants
import com.fangjia.script.BaseBatch import com.fangjia.script.BaseBatch
import com.fangjia.script.BatchOwner import com.fangjia.script.BatchOwner
import com.fangjia.script.Watcher import com.fangjia.script.Watcher
@@ -24,10 +25,8 @@ public class EmailConsumer extends BaseBatch {
static def lastSendTime = 0; static def lastSendTime = 0;
static def email_pattern = ~/^[-\w\.]+@(?:\w+[\.-]?)*\w+$/; static def email_pattern = ~/^[-\w\.]+@(?:\w+[\.-]?)*\w+$/;
//static final String EMAIL_SERVER = "222.73.196.139"
static final String EMAIL_SERVER = "smtp.exmail.qq.com" static final String EMAIL_SERVER = "smtp.exmail.qq.com"
public static final DBCollection EMAIL_SEND_LOG = MongoUtils.getCollectionByName("goojia_common", "email_send_log", "log.mongo.db.fangjia.com", 52002); public final static DBCollection EMAIL_SEND_LOG = com.fangjia.core.util.MongoUtils.getDbCollection(Constants.SEAWATER_MONGO_URI, 'goojia_common', 'email_send_log')
public static void main(String[] args) { public static void main(String[] args) {
runBatch(new EmailConsumer(), args) runBatch(new EmailConsumer(), args)
@@ -26,7 +26,7 @@ class Seawater2SeabirdSyncBatch extends BaseBatch {
CommonUtils.findAllCity().each { city -> CommonUtils.findAllCity().each { city ->
def endDate = DateUtil.truncateDay(new Date()).format("yyyy-MM-dd") def endDate = DateUtil.truncateDay(new Date()).format("yyyy-MM-dd")
def startDate = DateUtil.add(DateUtil.truncateDay(new Date()), -1).format("yyyy-MM-dd") def startDate = DateUtil.add(DateUtil.truncateDay(new Date()), -1).format("yyyy-MM-dd")
String sql = "select * from latest_seawater where city = '${city}' and cat = 'sell' and m_date >= '${startDate}' and m_date < '${endDate}'".toString() String sql = "select * from latest_seawater where city = '${city}' and m_date >= '${startDate}' and m_date < '${endDate}'".toString()
ElasticUtils.executeSqlQuery(sql,{Map house-> ElasticUtils.executeSqlQuery(sql,{Map house->
def seabird = new BasicDBObject() def seabird = new BasicDBObject()
seabird.put("city", city) seabird.put("city", city)
@@ -1,62 +1,32 @@
import com.fangjia.datastore.driver.DSObject
import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.util.CommonUtils
import com.fangjia.script.util.DbUtils
import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.GeoHelper
import com.fangjia.script.util.MongoUtils
import com.fangjia.script.util.OpenApiClient import com.fangjia.script.util.OpenApiClient
import com.mongodb.BasicDBObject
import com.mongodb.DBCollection
import com.mongodb.DBCursor
import com.mongodb.DBObject
import com.mongodb.QueryOperators
import net.sf.json.JSONObject import net.sf.json.JSONObject
//ExcelUtils.multiThreadingModify("D:\\业务数据\\四川锦程\\四川锦程测试数据.xlsx",{List item-> ExcelUtils.multiThreadingModify("C:\\Users\\wenyan\\Desktop\\地址分区域-20260522.xls",{List item->
// if(item["K"] == null){ if(item["C"]){
// JSONObject json = OpenApiClient.addressMatch(item["B"], item["G"], "district", false, item["C"] ) JSONObject json = OpenApiClient.addressStandard("", item["C"])
// if(json.getDouble("credit") > 0){ if(json){
// item["I"] = json.city if(json.province){
// item["J"] = json.district item["D"]=json.province
// item["K"] = json.name
// println(item)
// }
// }
//})
//ExcelUtils.multiThreadingModify("D:\\业务数据\\四川锦程\\四川锦程测试数据.xlsx",{List item->
// if(item["K"] == null){
// JSONObject json = OpenApiClient.addressMatch(item["B"], item["G"], "district", false, item["C"] )
// if(json.getDouble("credit") > 0){
// item["I"] = json.city
// item["J"] = json.district
// item["K"] = json.name
// println(item)
// }
// }
//})
ExcelUtils.multiThreadingModify("D:\\业务数据\\四川锦程\\四川锦程测试数据(人工介入).xlsx",{List item->
def city = item["I"]
def region = item["J"]
def name = item["K"]
if(name){
BasicDBObject seaweed = DbUtils.seaweed.findOne(DbUtils.buildSeaweedQuery(city, region, name))
if(seaweed){
def propertyType = 0
if(seaweed.estate_type2.toString().contains("别墅")){
propertyType = 1
} }
JSONObject res = OpenApiClient.evaluateDistrictPrice(city, region, name, item["H"], propertyType) if(json.city){
if(res.getDouble("credit") > 0){ item["E"] =json.city
item["L"] = res.avgPrice
item["M"] = res.totalPrice
}else {
CommonUtils.recalculationAverage(city, region, name, seaweed.estate_type2, new Date(), false)
} }
item["N"] = CommonUtils.getDistrictBuildYear(seaweed) if(json.district){
}else{ item["F"]= json.district
println("################" + item)
} }
if(json.provinceCode){
item["G"]= json.provinceCode.toString().substring(0, 6)
}
if(json.cityCode){
item["H"] =json.cityCode.toString().substring(0, 6)
}
if(json.districtCode){
item["I"] =json.districtCode.toString().substring(0, 6)
}
println(json)
}
} }
println(item) println(item)
@@ -479,7 +479,7 @@ public class OpenApiClient {
public static JSONObject addressStandard(String city, String address) { public static JSONObject addressStandard(String city, String address) {
if (StringUtils.isBlank(city) || StringUtils.isBlank(address)) { if (StringUtils.isBlank(address)) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
@@ -488,7 +488,7 @@ public class OpenApiClient {
params.put("city", city); params.put("city", city);
params.put("address", address); params.put("address", address);
params.put("token", TOKEN); params.put("token", TOKEN);
String content = new HttpRequest().get("http://open.fangjia.com/address/standard", params, "utf-8") String content = new HttpRequest().get("http://open.fangjia.com/addrSvc/structure", params, "utf-8")
JSONObject result = JSONObject.fromObject(content) JSONObject result = JSONObject.fromObject(content)
if (result.getInt("code") == 200) { if (result.getInt("code") == 200) {
return result.getJSONObject("result"); return result.getJSONObject("result");
@@ -1,43 +1,12 @@
package com.fangjia.script.wenyan.temp package com.fangjia.script.wenyan.temp
import com.fangjia.core.Constants import com.fangjia.script.util.ElasticUtils
import com.fangjia.core.util.DataUtil
import com.fangjia.core.util.MongoUtils
import com.fangjia.script.util.DbUtils
import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.OpenApiClient
import com.mongodb.BasicDBObject
import net.sf.json.JSONObject
import java.util.regex.Matcher ExcelUtils.multiThreadingModify("C:\\Users\\wenyan\\Desktop\\估家基础数据统计.xlsx",{List item->
import java.util.regex.Pattern ElasticUtils.executeSqlQuery("select count(*) as cnt FROM didata_map_poi_single_new_45 where city like '${item['B']}%' and small_type='商务写字楼'",{Map doc->
item["D"] = doc['cnt']
def school = MongoUtils.getDbCollection(Constants.FANGJIA_CRAWL_MONGO_URI, "fangjia_craw", "school2") item['E'] = Math.max(item["D"], item["C"])
new File("D:\\数据\\学校数据").eachFile {File file-> println(doc)
ExcelUtils.read(file.getAbsolutePath(), 0).each {List item-> })
BasicDBObject dbo = new BasicDBObject() })
dbo.city = item["A"]
dbo.region = item["B"]
dbo.name = item["C"]
dbo.address = item["E"]
dbo.attribute = item["G"]
dbo.property = item["H"]
dbo.category = "小学"
dbo.location = [DataUtil.roundDouble(item["I"], 6), DataUtil.roundDouble(item["J"], 6)]
school.insert(dbo)
println(dbo)
}
ExcelUtils.read(file.getAbsolutePath(), 1).each {List item->
BasicDBObject dbo = new BasicDBObject()
dbo.city = item["A"]
dbo.region = item["B"]
dbo.name = item["C"]
dbo.address = item["E"]
dbo.attribute = item["G"]
dbo.property = item["H"]
dbo.category = "中学"
dbo.location = [item["I"], item["J"]]
school.save(dbo)
println(item)
}
}
Binary file not shown.
@@ -1,12 +1,17 @@
package com.fangjia.service.api; package com.fangjia.service.api;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import com.fangjia.core.ProvinceData;
import com.fangjia.core.RegionData;
import com.fangjia.core.util.*; import com.fangjia.core.util.*;
import com.fangjia.dal.QueryParam; import com.fangjia.dal.QueryParam;
import com.fangjia.dal.mongo.dao.BaiDuSearchCacheDao; import com.fangjia.dal.mongo.dao.BaiDuSearchCacheDao;
@@ -19,6 +24,7 @@ import net.sf.json.JSONArray;
import net.sf.json.JSONException; import net.sf.json.JSONException;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
@@ -91,14 +97,149 @@ public class BaiduApiServiceImpl extends AbstractHttpApiService implements Baidu
@Override @Override
public List<BaiduPlacePoi> searchNearbyLocalDatabase(District district, public List<BaiduPlacePoi> searchNearbyLocalDatabase(District district,
double radius) { double radius) {
if(district.getCity() == null ||district.getLat2() == null || district.getLng2() == null){ if(district.getCity() == null || district.getLat() == null || district.getLng() == null){
return null; return null;
} }
double lat = district.getLat2()/10000000000d; return searchNearbyPoi(district.getCity(), district.getLat()/10000000000d, district.getLng()/10000000000d, radius);
double lng = district.getLng2()/10000000000d;
return searchNearbyLocalDatabase(district.getCity(), lat,lng,radius);
} }
/** ES查询客户端单例,复用连接池 */
private static volatile HttpRequest esHttpRequest;
private static HttpRequest getEsHttpRequest() {
if (esHttpRequest == null) {
synchronized (BaiduApiServiceImpl.class) {
if (esHttpRequest == null) {
esHttpRequest = new HttpRequest();
}
}
}
return esHttpRequest;
}
@SuppressWarnings("unchecked")
public List<BaiduPlacePoi> searchNearbyPoi(final String city ,final double lat,final double lng, final double radius) {
// v2: 坐标保留6位小数后升版,作废旧缓存
String cacheKey = "v2_" + city + "_" + lat + "_" + lng + "_" + radius;
Object cached = CacheUtils.getValue(this.getClass(), cacheKey);
if (cached != null) {
return (List<BaiduPlacePoi>) cached;
}
Map<String,String> header = new HashMap<String, String>();
try {
String auth = "Basic " + Base64.encodeBase64String("elastic:elasticsearch".getBytes("UTF-8"));
header.put("Authorization", auth);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
String seawaterUrl = "http://192.168.0.89:9200/didata_map_poi_2024/_search";
JSONObject root = new JSONObject();
// _source 过滤
JSONArray includes = new JSONArray();
includes.add("small_type");
includes.add("secondary_type");
includes.add("address");
includes.add("data_id");
includes.add("name");
includes.add("location");
JSONObject sourceFilter = new JSONObject();
sourceFilter.put("includes", includes);
root.put("_source", sourceFilter);
// bool 查询
JSONObject bool = new JSONObject();
JSONArray mustArray = new JSONArray();
// term status
JSONObject termStatus = new JSONObject();
termStatus.put("status", "0");
JSONObject termWrapper = new JSONObject();
termWrapper.put("term", termStatus);
mustArray.add(termWrapper);
// city status
JSONObject termCity = new JSONObject();
termCity.put("city", city + "市");
JSONObject cityTermWrapper = new JSONObject();
cityTermWrapper.put("term", termCity);
mustArray.add(cityTermWrapper);
// 按高德POI中类(secondary_type)过滤,覆盖菜系等细分小类
JSONObject termType = new JSONObject();
termType.put("secondary_type", Arrays.asList(
"学校", "综合医院", "专科医院",// 学校/医疗
"银行",// 银行(仅网点,ATM/银行相关不展示)
"超级市场", "商场", "便民商店/便利店", "综合市场",// 超市/商场
"美容美发店",// 美容美发
"运动场馆",// 健身/运动
"公园广场",// 公园
"机场相关", "火车站", "长途汽车站", "港口码头",// 交通
"外国餐厅", "咖啡厅",// 餐饮(仅品类辨识度高的中类,泛中餐厅/快餐厅等小类噪音多由小类精确映射过滤)
"宾馆酒店"));// 酒店(仅宾馆酒店中类)
JSONObject typeTermWrapper = new JSONObject();
typeTermWrapper.put("terms", termType);
mustArray.add(typeTermWrapper);
bool.put("must", mustArray);
// geo_distance 只放在filter(不评分,走filter cache,勿重复放must)
JSONObject point = new JSONObject();
point.put("lat", lat);
point.put("lon", lng);
JSONObject geoDistance = new JSONObject();
geoDistance.put("distance", radius + "m");
geoDistance.put("location", point); // 直接放入对象
JSONObject geoWrapper = new JSONObject();
geoWrapper.put("geo_distance", geoDistance);
JSONArray filterArray = new JSONArray();
filterArray.add(geoWrapper);
bool.put("filter", filterArray);
JSONObject query = new JSONObject();
query.put("bool", bool);
root.put("query", query);
root.put("size", "300");
// ---------- 按距离排序 ----------
JSONArray sortArray = new JSONArray();
JSONObject geoDistanceSort = new JSONObject();
// 指定坐标点(对象格式)
geoDistanceSort.put("location", point);
// 排序参数(与 location 平级)
geoDistanceSort.put("order", "asc");
geoDistanceSort.put("unit", "m"); // 单位:米
JSONObject sortWrapper = new JSONObject();
sortWrapper.put("_geo_distance", geoDistanceSort);
sortArray.add(sortWrapper);
root.put("sort", sortArray);
try {
String res = getEsHttpRequest().postWithBody(seawaterUrl, root, header, "UTF-8");
JSONObject json = JSONObject.fromObject(res);
ArrayList<BaiduPlacePoi> lists = new ArrayList<BaiduPlacePoi>();
if(json.has("hits") && json.getJSONObject("hits").has("hits")){
JSONArray hits = json.getJSONObject("hits").getJSONArray("hits");
for(int i = 0; i < hits.size(); i++){
JSONObject hit = hits.getJSONObject(i);
JSONObject source = hit.getJSONObject("_source");
JSONObject location = source.getJSONObject("location");
BaiduPlacePoi poi = new BaiduPlacePoi();
poi.setId(source.getString("data_id"));
poi.setName(source.getString("name"));
poi.setAddress(source.optString("address"));
poi.setKeyword(source.optString("small_type"));
// 中类存入streetId,供上层做类型兜底匹配
poi.setStreetId(source.optString("secondary_type"));
poi.setCity(city);
// 高德坐标(GCJ-02)转百度坐标(BD-09),经纬度保留6位小数
Map<String, Double> bdLocation = GeoUtils.gcj02ToBd09(location.getDouble("lat"), location.getDouble("lon"));
poi.setLat(DataUtil.roundDouble(bdLocation.get(GeoUtils.LAT), 6));
poi.setLng(DataUtil.roundDouble(bdLocation.get(GeoUtils.LNG), 6));
poi.setStatus(0);
lists.add(poi);
}
}
CacheUtils.putValueCompress(CachePolicyEnum.MIDDLE, this.getClass(), cacheKey, lists);
return lists;
} catch (HttpRequestException e) {
throw new RuntimeException(e);
}
}
public Map<String, JSONObject> searchNearBy(List<String> keywords, double lat, double lng, double radius, String ak){ public Map<String, JSONObject> searchNearBy(List<String> keywords, double lat, double lng, double radius, String ak){
List<QueryParam> paramList = new ArrayList<QueryParam>(); List<QueryParam> paramList = new ArrayList<QueryParam>();
paramList.add(new QueryParam("lat",lat)); paramList.add(new QueryParam("lat",lat));
@@ -157,7 +157,7 @@ public class OfficeServiceImpl implements OfficeService {
Integer startDate = Integer.valueOf(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd")); Integer startDate = Integer.valueOf(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd"));
query.setStartDate(startDate); query.setStartDate(startDate);
query.setEndDate(endDate); query.setEndDate(endDate);
query.setCityDisplay(RegionData.formatCity(evaluation.getCity()));
query.setCityDisplay(evaluation.getCity()); query.setCityDisplay(evaluation.getCity());
Pager pager = new Pager(); Pager pager = new Pager();
pager.setStartRow(0); pager.setStartRow(0);
@@ -255,8 +255,7 @@ public class OfficeServiceImpl implements OfficeService {
Integer startDate = Integer.valueOf(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd")); Integer startDate = Integer.valueOf(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd"));
query.setStartDate(startDate); query.setStartDate(startDate);
query.setEndDate(endDate); query.setEndDate(endDate);
query.setCityDisplay(RegionData.formatCity(evaluation.getCity()));
query.setCityDisplay(evaluation.getCity());
Pager pager = new Pager(); Pager pager = new Pager();
pager.setStartRow(0); pager.setStartRow(0);
pager.setPageSize(100); pager.setPageSize(100);
@@ -366,8 +365,16 @@ public class OfficeServiceImpl implements OfficeService {
pager.setPageSize(5); pager.setPageSize(5);
query.setPager(pager); query.setPager(pager);
query.setTable("latest_seawater"); query.setTable("latest_seawater");
List<Seawater> seawaters = seawaterService.findSeawatersByQuery(query); List<Seawater> seawaters = seawaterService.findSeawatersByQuery(query);
if(seawaters.isEmpty()){
OfficeEvaluationDto officeEvaluationDto = new OfficeEvaluationDto();
officeEvaluationDto.setUnitPrice(avgPrice);
officeEvaluationDto.setSeawater(Collections.<SeawaterDto>emptyList());
officeEvaluationDto.setCity(evaluation.getCity());
officeEvaluationDto.setDistrict(evaluation.getRegion());
officeEvaluationDto.setName(evaluation.getDistrictName());
return officeEvaluationDto;
}
return getOfficeEvaluationDto(seawaters, evaluation, cat); return getOfficeEvaluationDto(seawaters, evaluation, cat);
} }
@@ -355,7 +355,7 @@ public class DistrictStatServiceImpl implements DistrictStatService {
} }
public DistrictStatBo findCurrentDistrictStat(DistrictKey districtKey){ public DistrictStatBo findCurrentDistrictStat(DistrictKey districtKey){
return findDistrictStat(Arrays.asList(districtKey), false).get(districtKey); return findDistrictStat(Arrays.asList(districtKey), true).get(districtKey);
} }
public DistrictStatBo findDistrictStat(DistrictKey districtKey, Date date) { public DistrictStatBo findDistrictStat(DistrictKey districtKey, Date date) {
@@ -26,8 +26,12 @@ public class ApiUserBo implements Serializable {
private Date deadTime; private Date deadTime;
private String manager; private String manager;
private String priceType; private String priceType;
private String enterpriseVillageAi;
private Integer isMonitor; private Integer isMonitor;
private Date creationDate;
private String contact; //联系人 private String contact; //联系人
private String phone; //联系人手机号 private String phone; //联系人手机号
@@ -38,6 +42,14 @@ public class ApiUserBo implements Serializable {
private Integer isWarnExpired; private Integer isWarnExpired;
public String getEnterpriseVillageAi() {
return enterpriseVillageAi;
}
public void setEnterpriseVillageAi(String enterpriseVillageAi) {
this.enterpriseVillageAi = enterpriseVillageAi;
}
public String getPriceType() { public String getPriceType() {
return priceType; return priceType;
} }
Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 61 KiB