feat: add service config templates and extraction script

Former-commit-id: 1de24b7eb79676d1aba9d799a58c5a753290cf52
This commit is contained in:
反编译工作区
2026-05-01 19:38:01 +08:00
parent 3175b7074b
commit 8b15445328
2433 changed files with 8322164 additions and 1604 deletions
@@ -0,0 +1,54 @@
# 电梯应用 v2.0.10 — 服务发现修复 + org_id 策略验证
## 本版变更
| 变更项 | 说明 |
|--------|------|
| 移除 @RibbonClients | ElevatorApplication 不再绑定任何 RibbonClient,三个上游服务统一走 Dubbo/ZooKeeper 发现 |
| 删除 RibbonConfiguration | NincaCrkStdRibbonConfiguration / OrgService / CommonService 全部删除 |
| 测试数据更新 | 人员/zone 替换为生产 DB 核验后的真实数据 |
## 部署
```bash
tar xzf cw-elevator-application-v2.0.10-*.tar.gz
cd cw-elevator-application-v2.0.10-*
# 1. DBA 写入测试策略
mysql -h <host> -u <user> -p cw-elevator-application < sql/01-test-policy-data.sql
# 2. 替换 JAR
cp cw-elevator-application-v2.0.10.jar /path/to/deploy/
./stop.sh && ./start.sh
# 3. 验证 (DBA 先准备策略数据,无需 DB 直连)
python3 scripts/verify_org_policy_fix.py --elevator-base-url http://127.0.0.1:18081 --skip-db
# 4. 清理
mysql -h <host> -u <user> -p cw-elevator-application < sql/02-test-data-cleanup.sql
```
## 测试人员 (均来自生产 DB,有 device → org → floorList 完整数据)
| 用例 | person_id | 姓名 | 组织 | devices |
|------|-----------|------|------|---------|
| T1/T3/T4/T5/T6 | 1060601250460012544 | 丘文明 | 1403艾斯 | 122 |
| T2 | 1090914042800263168 | 陈美全 | 1405一博环保 | 116 |
| T7 | 964454497399468032 | 蒙海文 | 广发基金 | 279 |
## 文件清单
```
├── cw-elevator-application-v2.0.10.jar
├── README.md
├── sql/
│ ├── 01-test-policy-data.sql # 准备测试策略
│ ├── 02-test-data-cleanup.sql # 清理
│ └── 03-t3-manual-ops.sql # T3 skip-db 手动操作
├── scripts/
│ ├── verify_org_policy_fix.py # 7用例验证
│ ├── stub_org_service.py # 本地测试桩
│ └── diag_person_floors.sh # 楼层诊断
└── config/
└── v2-local-config.properties # 本地测试配置
```
@@ -0,0 +1,7 @@
spring.cloud.consul.host=192.168.3.12
spring.cloud.consul.port=8500
spring.cloud.consul.enabled=true
spring.cloud.consul.discovery.enabled=true
spring.cloud.consul.discovery.register=false
spring.cloud.consul.discovery.prefer-ip-address=true
spring.cloud.consul.discovery.instance-id=elevator-app-test:18081
@@ -0,0 +1,70 @@
server.port=18081
logging.path=/tmp/elevator-logs
logging.file=cw-elevator
spring.cloud.consul.host=192.168.3.12
spring.cloud.consul.port=8500
spring.cloud.consul.enabled=true
spring.redis.host=127.0.0.1
spring.redis.port=6380
spring.redis.database=5
spring.redis.timeout=3000
spring.redis.pool.max-active=10
spring.redis.pool.max-idle=1
spring.redis.pool.max-wait=10
spring.redis.pool.min-idle=0
spring.shardingsphere.datasource.names=ds0
spring.shardingsphere.datasource.ds0.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.ds0.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.ds0.jdbc-url=jdbc:mysql://192.168.3.12:3307/cw-elevator-application?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true
spring.shardingsphere.datasource.ds0.username=root
spring.shardingsphere.datasource.ds0.password=123456
spring.shardingsphere.datasource.ds0.connection-timeout=60000
spring.shardingsphere.datasource.ds0.maximum-pool-size=20
spring.shardingsphere.datasource.ds0.minimum-idle=5
spring.shardingsphere.datasource.ds0.max-lifetime=1765000
spring.shardingsphere.datasource.ds0.auto-commit=true
spring.shardingsphere.datasource.ds0.pool-name=ds0-pool
spring.shardingsphere.props.sql.show=false
spring.shardingsphere.sharding.default-data-source-name=ds0
cloudwalk.event.bootstrap-servers=127.0.0.1:9092
cloudwalk.event.group-id=cw-elevator-local
feign.device.name=cwos-portal
feign.resource.name=cwos-portal
feign.cwos-portal.name=cwos-portal
feign.davinci-portal.name=cwos-portal
feign.ninca-crk-std.name=ninca-crk-std
feign.component-organization.name=ninca-common-component-organization
feign.ninca-common.name=ninca-common
feign.mqtt.name=cloudwalk-device-thirdparty
feign.hystrix.enable=true
feign.okhttp.enable=true
ribbon.okhttp.enabled=true
ribbon.ReadTimeout=10000
ribbon.ConnectTimeout=10000
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=10000
spring.mvc.throw-exception-if-no-handler-found=true
spring.messages.basename=access-control
mybatis.mapper-locations=classpath*:cn/cloudwalk/elevator/**/*.xml
mybatis.config-location=classpath:mapper/mybatis-config.xml
cloudwalk.serial.enable=true
cloudwalk.serial.serial-type=redis
cloudwalk.serial.serial-redis-key=CLOUDWALK-ACS-SERIAL-KEY
management.health.redis.enabled=false
management.health.db.enabled=false
cloudwalk.datafield.enable=true
cloudwalk.datafield.securityKey=d4b2aabc97394a12a27fc3cca6cd9ba1
intelligent.lock.enable=true
intelligent.lock.config.default-wait-time=10000
lockWatchdogTimeout=21000
person.name.space=recordEvent
elevator.application.key=xinghewan
elevator.application.time=600
elevator.application.keyA=5B7DEF88FF04
ninca-crk-std.ip=127.0.0.1:16106
sendRecord.boolean=false
floor.building.id=605560539791228928
spring.redis.password=1qaz!QAZ
ninca-common-component-organization.ribbon.listOfServers=127.0.0.1:18082
ninca-common-component-organization.ribbon.ServerListRefreshInterval=5000
ninca-common.ribbon.listOfServers=127.0.0.1:18082
ninca-common.ribbon.ServerListRefreshInterval=5000
@@ -0,0 +1,222 @@
# server
spring.application.name=ninca-common-component-organization
server.port=17016
# 集群服务节点ID
server.instance-id=component-organization-02
#spring配置
spring.jackson.time-zone=GMT+8
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
spring.datasource.username=cloudwalk
spring.datasource.password=1qaz!QAZ
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://mysql_01.mysql_ip:3306/component-organization?useSSL=false&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
# consul
eureka.client.enabled=false
spring.cloud.consul.host=44700995ee904679a7ad5afddcf93bb5
spring.cloud.consul.port=8505
spring.cloud.consul.discovery.prefer-ip-address=true
spring.cloud.consul.discovery.ip-address=44700995ee904679a7ad5afddcf93bb5
spring.cloud.consul.discovery.instance-id=${spring.application.name}:44700995ee904679a7ad5afddcf93bb5:${server.port}
#redis
spring.redis.host=redis_01.redis_ip
spring.redis.port=6379
spring.redis.password=1qaz!QAZ
spring.redis.database=6
spring.redis.timeout=5000
spring.redis.pool.max-wait=-1
spring.redis.pool.max-active=200
spring.redis.pool.min-idle=0
spring.redis.pool.max-idle=8
#mybatis
mybatis.mapper-locations=classpath*:mybatis/mysql/*/*.xml,classpath*:mybatis/*.xml,classpath*:cn/cloudwalk/task/data/mapper/mysql/*.xml, classpath*:cn/cloudwalk/data/authentication/mapper/plat/*.xml,classpath*:cn/cloudwalk/data/device/devices/mapper/mysql/*.xml,classpath*:cn/cloudwalk/data/resource/mapper/mysql/**/*.xml,classpath*:cn/cloudwalk/imgstore/mapper/mybatis/*.xml,classpath*:cn/cloudwalk/data/davinci/biology/mapper/mysql/*.xml,classpath*:cn/cloudwalk/data/imgstore/mapper/mysql/*.xml,classpath*:feature/*.xml,classpath*:cn/cloudwalk/data/aks/mapper/mysql/*/*.xml,classpath*:worker/*.xml, classpath*:mybatis/hardware/monitor/mapper/mysql/*.xml,classpath*:mybatis/mysql/account/*.xml,classpath*:mybatis/mysql/InvokeLogMapper.xml,classpath*:mybatis/mysql/ClusterInvokeLogMapper.xml, classpath*:mybatis/mysql/*.xml, classpath*:cn/cloudwalk/data/aggregate/mapper/mysql/*/*.xml,classpath*:cn/cloudwalk/data/device/mgn/atomic/mysql/*.xml,classpath*:cn/cloudwalk/data/cache/mapper/mysql/*.xml,classpath*:cn/cloudwalk/data/organization/mapper/mysql/*.xml,classpath*:cn/cloudwalk/storage/oss/data/mapper/mysql/*.xml
#log
logging.config=classpath:recognition-logback.xml
logging.level.root=INFO
logging.level.cn.cloudwalk.web.organization.controller.PersonController=info
logging.path=/data/cwos/ninca-common-component-organization-V2.9.2_20210730/logs
logging.file.info.max-index=10
logging.file.error.max-index=20
#resource
spring.messages.basename=messages_zh_CN,component-account/messages_zh_CN,component-resource/messages_zh_CN,core-aggregate/messages_zh_CN,core-device/messages_zh_CN,devicesdk/messages_zh_CN,component-org/messages_zh_CN
# formdata\u4F20\u8F93\u6587\u4EF6\u9650\u5236
cloudwalk.multipart.maxFileSize=50MB
cloudwalk.multipart.maxRequestSize=50MB
# quartz\u914D\u7F6E
quartz.driver=${spring.datasource.driver-class-name}
quartz.url=${spring.datasource.url}
quartz.user=${spring.datasource.username}
quartz.password=${spring.datasource.password}
quartz.maxConnections=20
quartz.schedulerName=${spring.application.name}
quartz.clustered=true
quartz.strategy=local
quartz.lazyStart=120
quartz.pool-type=druid
# \u4EBA\u5458\u4FE1\u606F\u6CE8\u518C\u7167\u6807\u51C6\u8D28\u91CF\u5206\uFF1A
imageQualityScore=0.65
# \u6587\u4EF6\u8DEF\u5F84\u524D\u7F00\u914D\u7F6E
cloudwalk.component.file.urlPrefix=http://10.0.22.102:80/ninca-common-component-organization/file/imgByPath?path=
# cwos\u6587\u4EF6\u7BA1\u7406\u670D\u52A1\u540D
feign.davinci-portal.name=cwos-portal
feign.resource.name=cwos-portal
feign.portal.name=cwos-portal
# task
cloudwalk.imageStore.person.cron=0 */2 * * * ?
cloudwalk.imageStore.imageSync.cron=0 */2 * * * ?
# download file
cloudwalk.common-app.download.downDir=/data/cwos/ninca-common-component-organization-V2.9.2_20210730/download
cloudwalk.common-app.download.excelMaxRows=10000
cloudwalk.common-app.download.exportAllCount=100000
cloudwalk.common-app.download.shardingSize=31457280
cloudwalk.common-app.download.compressionType=.zip
# component-organization's service code on kafka and component-organization's group id
cloudwalk.component-organization.kafka.service-code=imgstoreApp
cloudwalk.component-organization.kafka.producer.groupId=component-organization
cloudwalk.component-organization.kafka.producer.bootstrapServers=44700995ee904679a7ad5afddcf93bb5:9092,0837a70b5fab47569391828f5feb2561:9092,371bfca4972c43d2aefcf302d0a4a277:9092
cloudwalk.component-organization.kafka.consumer.groupId=component-organization
cloudwalk.component-organization.kafka.consumer.bootstrapServers=44700995ee904679a7ad5afddcf93bb5:9092,0837a70b5fab47569391828f5feb2561:9092,371bfca4972c43d2aefcf302d0a4a277:9092
# PERSON_NAME_SPACE
person.name.space=componentOrg
# \u4e8c\u7ef4\u7801url
qr.code.url=http://10.0.22.102:80/general-person-h5/#/register?businessId=
# 监控使用单独的端口与服务端口隔离,提高安全性
# Nginx限制此端口的外网访问权限
management.port=17116
# springboot2的健康检查接口是/actuator/health
# springboot1的健康检查接口是/health
# 此配置可以把上述两个版本的健康检查接口统一设置为/actuator/health
# Nginx禁止外网访问以/actuator开头的url
management.context-path=/actuator
# springboot1开启管理接口的访问权限
management.security.enabled=false
# 关闭所有management接口
endpoints.enabled=false
# 开启/actuator/info
endpoints.info.enabled=true
# 开启/actuator/health
endpoints.health.enabled=true
# 开启/actuator/prometheus
endpoints.prometheus.enabled=true
# 注册consul时设置统一的健康检查地址
spring.cloud.consul.discovery.health-check-path=${management.context-path}/health
# 多实例注册management服务避免覆盖,这是springboot1.x存在的bug
spring.cloud.consul.discovery.management-suffix=44700995ee904679a7ad5afddcf93bb5-management
#图库同步配置
group-person.syn.config.task_is_all.threshold=100
group-person.syn.config.lock-handle-syn-task-second=150
#图库同步线程池配置
ninca.group.person.syn.pool.corePoolSize=40
ninca.group.person.syn.pool.maxPoolSize=80
ninca.group.person.syn.pool.queueCapacity=1000
ninca.group.person.syn.pool.keepAliveSeconds=150
ninca.group.person.syn.pool.allowCoreThreadTimeOut=true
#图库人员删除保留天数
group-person.delete.keep.days=7
#设备上报注册结果线程池配置
device.report.thread.corePoolSize=20
device.report.thread.maxPoolSize=40
device.report.thread.queueCapacity=500
device.report.thread.keepAliveSeconds=150
device.report.thread.allowCoreThreadTimeOut=true
#设备图库解绑线程池配置
device.group.change.thread.corePoolSize=20
device.group.change.thread.maxPoolSize=40
device.group.change.thread.queueCapacity=500
device.group.change.thread.keepAliveSeconds=150
device.group.change.thread.allowCoreThreadTimeOut=true
#处理人脸线程池配置
handle.image.thread.corePoolSize=40
handle.image.thread.maxPoolSize=160
handle.image.thread.queueCapacity=2000
handle.image.thread.keepAliveSeconds=150
handle.image.thread.allowCoreThreadTimeOut=true
#修图线程池配置
ninca.picture.revision.pool.corePoolSize=5
ninca.picture.revision.pool.maxPoolSize=5
ninca.picture.revision.pool.queueCapacity=100000
ninca.picture.revision.pool.keepAliveSeconds=150
ninca.picture.revision.pool.allowCoreThreadTimeOut=true
#设备上报时间与上次更新时间接近的时间差
device.report.approach.time.diff.milliseconds=1000
#设备-人员同步时间差N
device.person.sync.time.diff.minutes=60
#开关控制调用cwos同步日志
cwos.image.store.sync.log=false
feign.device.name=cwos-portal
ribbon.ReadTimeout=10000
ribbon.ConnectTimeout=10000
#设备图库结束拉取时间差
device.group.pull.time.diff.minutes=10
# 注册照内存要求(字节)
image.size.min=10240
image.size.max=3145728
# 注册照像素要求
image.width.min=30
image.width.max=400
image.height.min=30
image.height.max=400
新增配置
# 人脸像素要求
face.width.min=100
face.width.max=400
face.height.min=100
face.height.max=400
# 菠萝引擎consul服务名
feign.pineapple.name=cloudwalk-pineapple-manager
#修图引擎端口
revision.engine.port=20010
# 延迟添加有效期开关(默认关闭)
group-person.syn.config.delay-add-validate-data=false
# 延迟添加有效期周期(小时)
group-person.syn.config.delay-add-validate-hour=48
# 延迟添加人员有效期定时任务cron表达式
group-person.syn.config.delay-handle-validate.cron=1 0 0 /1 * ? *
# 处理人脸异常定时任务
group-person.syn.config.handle-group-face-exception.cron=0 /5 * * * ?
# 星河湾集团总部id
xhwId=21474e012cd14e26bc62771873b22562
# 星河湾集团总部默认楼层id
xhwDefaultFloorId=605560547135455232
# 其他机构默认楼层
xhwSixFloorId=605560541473144832
support.muti.group.device.type=CW-IS1330,-8,MTD8
@@ -0,0 +1,14 @@
# 启用feign熔断
feign.hystrix.enabled=true
# 限流配置
#hystrix.command.default.circuitBreaker.requestVolumeThreshold=1
hystrix.command.default.circuitBreaker.errorThresholdPercentage=50
hystrix.command.default.circuitBreaker.enabled=true
hystrix.command.default.execution.isolation.strategy=THREAD
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=120000
# hystrix线程池配置
hystrix.threadpool.default.coreSize=100
hystrix.threadpool.default.maximumSize=1000
hystrix.threadpool.default.allowMaximumSizeToDivergeFromCoreSize=true
hystrix.threadpool.default.maxQueueSize=-1
hystrix.threadpool.default.execution.isolation.thread.timeoutInMilliseconds=60000
@@ -0,0 +1,7 @@
#!/bin/bash
# shellcheck disable=SC2045
proPath=$1
cd $proPath/download/
name=$2
echo $name
zip -q -r $name.zip $name
@@ -0,0 +1,22 @@
[Unit]
Description=The ninca-common-component-organization-V2.9.2_20210730 server
After=network.target remote-fs.target nss-lookup.target
[Service]
Environment="LD_LIBRARY_PATH=/data/cwos/ninca-common-component-organization-V2.9.2_20210730/opencvlib/:$LD_LIBRARY_PATH"
PIDFile=/run/ninca-common-component-organization-V2.9.2_20210730.pid
ExecStartPre=/bin/rm -f /run/ninca-common-component-organization-V2.9.2_20210730.pid
ExecStart=/bin/bash /data/cwos/ninca-common-component-organization-V2.9.2_20210730/start.sh
ExecStop=/bin/bash /data/cwos/ninca-common-component-organization-V2.9.2_20210730/stop.sh
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true
Restart=always
RestartSec=10
StandardOutput=null
StandardError=null
[Install]
WantedBy=multi-user.target

Some files were not shown because too many files have changed in this diff Show More