mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-09 08:20:31 +08:00
Initial commit: reorganized source tree
- backend/: 13 Maven modules (cw-elevator-application, cloudwalk-cloud, intelligent-cwoscomponent, ninca-crk, etc.) - frontend/: 4 Vue projects (elevator-front, cwos-portal, alarm-front, front_acs) + decompiled + scripts - scripts/: build, test-env, tools (Docker Compose, service templates, API parity) - docs/: AGENTS.md, superpowers specs, architecture docs - .gitignore: standard Java/Maven exclusions Moved from legacy maven-*/ root layout to backend/ organized structure.
This commit is contained in:
+179
@@ -0,0 +1,179 @@
|
||||
# =============================================================================
|
||||
# 组织组件本地/测试启动覆盖配置
|
||||
# 加载顺序(后者覆盖前者):classpath → file:部署包/…/BOOT-INF/classes/
|
||||
# → 本目录(见 run-verify.sh 中 spring.config.location)
|
||||
# 部署包参考:
|
||||
# ../部署包/ninca_common_component_organization_01-ninca_common_component_organization/application.properties
|
||||
# ../部署包/…/ninca-common-component-organization-V2.9.2_20210730/BOOT-INF/classes/application.properties
|
||||
# =============================================================================
|
||||
|
||||
# --- 本地/测试强制覆盖 ---
|
||||
spring.application.name=ninca-common-component-organization
|
||||
server.port=17026
|
||||
server.instance-id=component-organization-verify-local
|
||||
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=123456
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://192.168.3.12:3307/component-organization?useSSL=false&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
|
||||
eureka.client.enabled=false
|
||||
spring.cloud.consul.enabled=false
|
||||
spring.cloud.consul.discovery.enabled=false
|
||||
|
||||
spring.redis.host=127.0.0.1
|
||||
spring.redis.port=6380
|
||||
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
|
||||
|
||||
logging.path=/tmp/ninca-component-org-verify-logs
|
||||
logging.level.root=INFO
|
||||
|
||||
# 日志实现由 run-verify.sh 传入 --logging.config=file:…/recognition-logback.xml(勿在此处写 classpath:recognition-logback.xml,以免覆盖失效)
|
||||
|
||||
# --- Spring 通用(与部署包一致)---
|
||||
spring.jackson.time-zone=GMT+8
|
||||
spring.http.encoding.charset=UTF-8
|
||||
spring.http.encoding.enabled=true
|
||||
spring.http.encoding.force=true
|
||||
|
||||
# --- i18n(BOOT-INF 同名)---
|
||||
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
|
||||
|
||||
# --- 上传限制 ---
|
||||
cloudwalk.multipart.maxFileSize=50MB
|
||||
cloudwalk.multipart.maxRequestSize=50MB
|
||||
|
||||
# --- Quartz(占位符引用当前数据源)---
|
||||
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
|
||||
|
||||
# --- 注册照质量分 ---
|
||||
imageQualityScore=0.65
|
||||
|
||||
# --- 本机验证路径(替代部署包 /data/cwos/…)---
|
||||
cloudwalk.common-app.download.downDir=/tmp/ninca-component-org-verify/download
|
||||
cloudwalk.component.file.urlPrefix=http://127.0.0.1:${server.port}/ninca-common-component-organization/file/imgByPath?path=
|
||||
qr.code.url=http://127.0.0.1:${server.port}/general-person-h5/#/register?businessId=
|
||||
|
||||
# --- Feign 服务名(与部署包一致;上游需注册或可改 ribbon list)---
|
||||
feign.davinci-portal.name=cwos-portal
|
||||
feign.resource.name=cwos-portal
|
||||
feign.portal.name=cwos-portal
|
||||
feign.device.name=cwos-portal
|
||||
feign.pineapple.name=cloudwalk-pineapple-manager
|
||||
|
||||
# --- 定时任务 cron ---
|
||||
cloudwalk.imageStore.person.cron=0 */2 * * * ?
|
||||
cloudwalk.imageStore.imageSync.cron=0 */2 * * * ?
|
||||
|
||||
# --- 导出限制(部署包数值)---
|
||||
cloudwalk.common-app.download.excelMaxRows=10000
|
||||
cloudwalk.common-app.download.exportAllCount=100000
|
||||
cloudwalk.common-app.download.shardingSize=31457280
|
||||
cloudwalk.common-app.download.compressionType=.zip
|
||||
|
||||
# --- Kafka(测试环境:未起 Kafka 时可改为本机或注释依赖;此处保留部署包结构便于对齐)---
|
||||
cloudwalk.component-organization.kafka.service-code=imgstoreApp
|
||||
cloudwalk.component-organization.kafka.producer.groupId=component-organization
|
||||
cloudwalk.component-organization.kafka.consumer.groupId=component-organization
|
||||
# 覆盖 BOOT-INF 内网地址:可按 env.sh / Docker 修改
|
||||
cloudwalk.component-organization.kafka.producer.bootstrapServers=127.0.0.1:9092
|
||||
cloudwalk.component-organization.kafka.consumer.bootstrapServers=127.0.0.1:9092
|
||||
|
||||
person.name.space=componentOrg
|
||||
|
||||
# --- Management(与部署包规律:业务端口 +100)---
|
||||
management.port=17126
|
||||
management.context-path=/actuator
|
||||
management.security.enabled=false
|
||||
endpoints.enabled=false
|
||||
endpoints.info.enabled=true
|
||||
endpoints.health.enabled=true
|
||||
endpoints.prometheus.enabled=true
|
||||
|
||||
# --- 图库同步(线程池取部署包「根目录」application.properties 较大规格,便于压测对齐)---
|
||||
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
|
||||
device.person.sync.time.diff.minutes=60
|
||||
cwos.image.store.sync.log=false
|
||||
device.group.pull.time.diff.minutes=10
|
||||
|
||||
ribbon.ReadTimeout=10000
|
||||
ribbon.ConnectTimeout=10000
|
||||
|
||||
# --- 图片 / 人脸像素限制 ---
|
||||
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
|
||||
|
||||
revision.engine.port=20010
|
||||
group-person.syn.config.delay-add-validate-data=false
|
||||
group-person.syn.config.delay-add-validate-hour=48
|
||||
group-person.syn.config.delay-handle-validate.cron=1 0 0 /1 * ? *
|
||||
group-person.syn.config.handle-group-face-exception.cron=0 */5 * * * ?
|
||||
|
||||
# --- 星河湾业务常量(与部署包根目录 application.properties 一致)---
|
||||
xhwId=21474e012cd14e26bc62771873b22562
|
||||
xhwDefaultFloorId=605560547135455232
|
||||
xhwSixFloorId=605560541473144832
|
||||
support.muti.group.device.type=CW-IS1330,-8,MTD8
|
||||
|
||||
# --- cloudwalk-common-serial(UUIDSerial / Snowflake;与电梯应用一致)---
|
||||
cloudwalk.serial.enabled=true
|
||||
cloudwalk.serial.serial-length=8
|
||||
cloudwalk.serial.serial-type=redis
|
||||
cloudwalk.serial.serial-redis-key=CLOUDWALK-ACS-SERIAL-KEY
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
# 与部署包一致:Feign + Hystrix(来源:部署包/bootstrap.properties = BOOT-INF/classes/bootstrap.properties)
|
||||
feign.hystrix.enabled=true
|
||||
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.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
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--debug 实时查看logback运行状态,默认值为false-->
|
||||
<!--scan 配置文件将每分钟扫描一次更改,配置文件如果发生改变,将会被重新加载,默认值为true-->
|
||||
<!--scanPeriod 配置文件扫描周期,当不设置单位时默认为毫秒级。-->
|
||||
<!--packagingData 可以在日志后看到依赖jar包名和版本,很费性能,不建议开启 -->
|
||||
<configuration debug="true" scan="true" scanPeriod="30 seconds" packagingData="false">
|
||||
|
||||
<property name="application-name" value="component-organization"/>
|
||||
|
||||
<contextName>${application-name}</contextName>
|
||||
<!--读取spring的配置文件,日志路径-->
|
||||
<springProperty scope="context" name="file_path" source="logging.path" defaultValue="./logs"/>
|
||||
<!--读取spring的配置文件,info级别日志总大小-->
|
||||
<springProperty scope="context" name="info_file_index_max" source="logging.file.info.max-index"
|
||||
defaultValue="20"/>
|
||||
<!--读取spring的配置文件,error级别日志总大小-->
|
||||
<springProperty scope="context" name="error_file_index_max" source="logging.file.error.max-index"
|
||||
defaultValue="20"/>
|
||||
|
||||
<property name="file_name_prefix" value="${file_path}/${application-name}"/>
|
||||
|
||||
<!--控制台打印格式-->
|
||||
<property name="log_pattern"
|
||||
value="[%d{yyyy-MM-dd HH:mm:ss.SSSZ}] [%X{X-B3-TraceId}] [%thread] [%level] [%logger{36}] [%line] %msg%n"/>
|
||||
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log_pattern}</pattern>
|
||||
<charset>utf8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--info-->
|
||||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${file_path}/${application-name}.info.log</file>
|
||||
<encoder>
|
||||
<pattern>${log_pattern}</pattern>
|
||||
</encoder>
|
||||
<!--FixedWindowRollingPolicy 翻转策略, -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
||||
<fileNamePattern>${file_name_prefix}.info.%i.log</fileNamePattern>
|
||||
<!--最小索引 例如:fareid-app.error.1.log-->
|
||||
<minIndex>1</minIndex>
|
||||
<!--最大索引 例如:fareid-app.error.20.log-->
|
||||
<maxIndex>${info_file_index_max}</maxIndex>
|
||||
</rollingPolicy>
|
||||
|
||||
<!--如果超过指定大小会告知 RollingFileAppender 触发当前活动文件滚动-->
|
||||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<!--每个文件最大保存大小-->
|
||||
<maxFileSize>30MB</maxFileSize>
|
||||
</triggeringPolicy>
|
||||
</appender>
|
||||
|
||||
|
||||
<!--error-->
|
||||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${file_path}/${application-name}.error.log</file>
|
||||
<encoder>
|
||||
<pattern>${log_pattern}</pattern>
|
||||
</encoder>
|
||||
<!--FixedWindowRollingPolicy 翻转策略, -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
||||
<fileNamePattern>${file_name_prefix}.error.%i.log</fileNamePattern>
|
||||
<!--最小索引 例如:fareid-app.error.1.log-->
|
||||
<minIndex>1</minIndex>
|
||||
<!--最大索引 例如:fareid-app.error.20.log-->
|
||||
<maxIndex>${error_file_index_max}</maxIndex>
|
||||
</rollingPolicy>
|
||||
|
||||
<!--如果超过指定大小会告知 RollingFileAppender 触发当前活动文件滚动-->
|
||||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<!--每个文件最大保存大小-->
|
||||
<maxFileSize>30MB</maxFileSize>
|
||||
</triggeringPolicy>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>ERROR</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="INFO_FILE"/>
|
||||
<appender-ref ref="ERROR_FILE"/>
|
||||
</root>
|
||||
|
||||
|
||||
</configuration>
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# 配置顺序:classpath(fat jar 内)→ 部署包解压的 BOOT-INF/classes(完整业务占位符)
|
||||
# → 本目录 application.properties(测试 MySQL/Redis、关 Consul)。
|
||||
set -euo pipefail
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/../../../../" && pwd)"
|
||||
source "$REPO_ROOT/scripts/test-env/config/env.sh" 2>/dev/null || true
|
||||
|
||||
JAR="$SCRIPT_DIR/../../target/ninca-common-component-organization-2.9.2-xinghewan.jar"
|
||||
JAVA_BIN="${JAVA_HOME:-/usr/lib/jvm/java-8-openjdk-amd64}/bin/java"
|
||||
|
||||
DEPLOY_CLASSES="$REPO_ROOT/../部署包/ninca_common_component_organization_01-ninca_common_component_organization/ninca-common-component-organization-V2.9.2_20210730/BOOT-INF/classes"
|
||||
if [[ ! -d "$DEPLOY_CLASSES" ]]; then
|
||||
echo "Missing deployment sample classes dir: $DEPLOY_CLASSES" >&2
|
||||
echo "Adjust DEPLOY_CLASSES in this script or unpack the deployment package." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "$JAR" ]]; then
|
||||
echo "Missing $JAR — run: mvn -pl cwos-component-organization-starter -am package -DskipTests" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec "$JAVA_BIN" -jar "$JAR" \
|
||||
--spring.config.location="classpath:/,classpath:/config/,file:${DEPLOY_CLASSES}/,file:${SCRIPT_DIR}/" \
|
||||
--spring.cloud.bootstrap.location="file:${SCRIPT_DIR}/bootstrap.properties" \
|
||||
--logging.config="file:${SCRIPT_DIR}/recognition-logback.xml" \
|
||||
--spring.main.banner-mode=off \
|
||||
"$@"
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>cn.cloudwalk.ninca</groupId>
|
||||
<artifactId>ninca-common-component-organization-reactor</artifactId>
|
||||
<version>2.9.2-xinghewan</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>cwos-component-organization-starter</artifactId>
|
||||
<name>cwos-component-organization-starter</name>
|
||||
<description>可执行聚合层:Spring Boot repackage,与现场 MANIFEST Start-Class / PropertiesLauncher(layout=ZIP)对齐</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 与现场嵌入式 pom 一致:starter 依赖 web,由 service 经 all-lib 提供运行时栈 -->
|
||||
<dependency>
|
||||
<groupId>cn.cloudwalk.ninca</groupId>
|
||||
<artifactId>cwos-component-organization-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>ninca-common-component-organization-${project.version}</finalName>
|
||||
<plugins>
|
||||
<!-- 使用 2.7.x 插件以支持 includeSystemScope,将大量 system/all-lib 打入 fat jar -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.7.18</version>
|
||||
<configuration>
|
||||
<mainClass>cn.cloudwalk.starter.organization.OrganizationServer</mainClass>
|
||||
<layout>ZIP</layout>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package cn.cloudwalk.starter.organization;
|
||||
|
||||
import cn.cloudwalk.starter.organization.config.VMSHttpEntityEnclosingRequestBase;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import io.micrometer.spring.autoconfigure.MeterRegistryCustomizer;
|
||||
import java.net.URI;
|
||||
import org.apache.http.client.methods.HttpUriRequest;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.support.SpringBootServletInitializer;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.netflix.feign.EnableFeignClients;
|
||||
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.springframework.web.WebApplicationInitializer;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@EnableDiscoveryClient
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement
|
||||
@EnableCaching
|
||||
@EnableScheduling
|
||||
@EnableFeignClients(basePackages={"cn.cloudwalk"})
|
||||
@MapperScan(basePackages={"cn.cloudwalk.**.mapper"})
|
||||
@ComponentScan(basePackages={"cn.cloudwalk.task.**", "cn.cloudwalk.**"})
|
||||
@EnableAsync
|
||||
@EnableHystrix
|
||||
@EnableAspectJAutoProxy(proxyTargetClass=true, exposeProxy=true)
|
||||
public class OrganizationServer
|
||||
extends SpringBootServletInitializer
|
||||
implements WebApplicationInitializer {
|
||||
private static Logger log = LoggerFactory.getLogger(OrganizationServer.class);
|
||||
@Autowired
|
||||
StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
public static void main(String[] args) {
|
||||
log.info("===OrganizationServer start begin===");
|
||||
SpringApplication.run(OrganizationServer.class, (String[])args);
|
||||
log.info("===OrganizationServer start successed===");
|
||||
}
|
||||
|
||||
@Bean
|
||||
RestTemplate restTemplate() {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
restTemplate.setRequestFactory((ClientHttpRequestFactory)new HttpComponentsClientHttpRequestFactory(){
|
||||
|
||||
protected HttpUriRequest createHttpUriRequest(HttpMethod httpMethod, URI uri) {
|
||||
if (HttpMethod.DELETE == httpMethod) {
|
||||
return new VMSHttpEntityEnclosingRequestBase(uri);
|
||||
}
|
||||
return super.createHttpUriRequest(httpMethod, uri);
|
||||
}
|
||||
});
|
||||
return restTemplate;
|
||||
}
|
||||
|
||||
@Bean(value={"web-client"})
|
||||
public RestTemplate getWebClient() {
|
||||
HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory();
|
||||
httpRequestFactory.setConnectionRequestTimeout(90000);
|
||||
httpRequestFactory.setConnectTimeout(6000);
|
||||
httpRequestFactory.setReadTimeout(60000);
|
||||
return new RestTemplate((ClientHttpRequestFactory)httpRequestFactory);
|
||||
}
|
||||
|
||||
@Bean
|
||||
MeterRegistryCustomizer<MeterRegistry> configurer(final @Value(value="${spring.application.name}") String applicationName) {
|
||||
return new MeterRegistryCustomizer<MeterRegistry>(){
|
||||
|
||||
public void customize(MeterRegistry meterRegistry) {
|
||||
meterRegistry.config().commonTags(new String[]{"application", applicationName});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
||||
return builder.sources(new Class[]{OrganizationServer.class});
|
||||
}
|
||||
}
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package cn.cloudwalk.starter.organization.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix="device.group.change.thread")
|
||||
public class DeviceGroupChangePoolProperties {
|
||||
private int corePoolSize;
|
||||
private int maxPoolSize;
|
||||
private int keepAliveSeconds;
|
||||
private int queueCapacity;
|
||||
private boolean allowCoreThreadTimeOut;
|
||||
|
||||
public int getCorePoolSize() {
|
||||
return this.corePoolSize;
|
||||
}
|
||||
|
||||
public void setCorePoolSize(int corePoolSize) {
|
||||
this.corePoolSize = corePoolSize;
|
||||
}
|
||||
|
||||
public int getMaxPoolSize() {
|
||||
return this.maxPoolSize;
|
||||
}
|
||||
|
||||
public void setMaxPoolSize(int maxPoolSize) {
|
||||
this.maxPoolSize = maxPoolSize;
|
||||
}
|
||||
|
||||
public int getKeepAliveSeconds() {
|
||||
return this.keepAliveSeconds;
|
||||
}
|
||||
|
||||
public void setKeepAliveSeconds(int keepAliveSeconds) {
|
||||
this.keepAliveSeconds = keepAliveSeconds;
|
||||
}
|
||||
|
||||
public int getQueueCapacity() {
|
||||
return this.queueCapacity;
|
||||
}
|
||||
|
||||
public void setQueueCapacity(int queueCapacity) {
|
||||
this.queueCapacity = queueCapacity;
|
||||
}
|
||||
|
||||
public boolean isAllowCoreThreadTimeOut() {
|
||||
return this.allowCoreThreadTimeOut;
|
||||
}
|
||||
|
||||
public void setAllowCoreThreadTimeOut(boolean allowCoreThreadTimeOut) {
|
||||
this.allowCoreThreadTimeOut = allowCoreThreadTimeOut;
|
||||
}
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package cn.cloudwalk.starter.organization.config;
|
||||
|
||||
import cn.cloudwalk.starter.organization.config.DeviceGroupChangePoolProperties;
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
@Configuration
|
||||
public class DeviceGroupChangeTasksExecutor {
|
||||
@Resource
|
||||
private DeviceGroupChangePoolProperties deviceGroupChangePoolProperties;
|
||||
|
||||
@Bean(value={"deviceGroupChangeTaskExecutor"})
|
||||
public ThreadPoolTaskExecutor deviceGroupChangeTaskExecutor() {
|
||||
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
|
||||
threadPoolTaskExecutor.setCorePoolSize(this.deviceGroupChangePoolProperties.getCorePoolSize());
|
||||
threadPoolTaskExecutor.setAllowCoreThreadTimeOut(this.deviceGroupChangePoolProperties.isAllowCoreThreadTimeOut());
|
||||
threadPoolTaskExecutor.setMaxPoolSize(this.deviceGroupChangePoolProperties.getMaxPoolSize());
|
||||
threadPoolTaskExecutor.setQueueCapacity(this.deviceGroupChangePoolProperties.getQueueCapacity());
|
||||
threadPoolTaskExecutor.setThreadNamePrefix("device-group-change-pool-");
|
||||
threadPoolTaskExecutor.setRejectedExecutionHandler((RejectedExecutionHandler)new ThreadPoolExecutor.AbortPolicy());
|
||||
threadPoolTaskExecutor.initialize();
|
||||
return threadPoolTaskExecutor;
|
||||
}
|
||||
}
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package cn.cloudwalk.starter.organization.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix="device.report.thread")
|
||||
public class DeviceReportPoolProperties {
|
||||
private int corePoolSize;
|
||||
private int maxPoolSize;
|
||||
private int keepAliveSeconds;
|
||||
private int queueCapacity;
|
||||
private boolean allowCoreThreadTimeOut;
|
||||
|
||||
public int getCorePoolSize() {
|
||||
return this.corePoolSize;
|
||||
}
|
||||
|
||||
public void setCorePoolSize(int corePoolSize) {
|
||||
this.corePoolSize = corePoolSize;
|
||||
}
|
||||
|
||||
public int getMaxPoolSize() {
|
||||
return this.maxPoolSize;
|
||||
}
|
||||
|
||||
public void setMaxPoolSize(int maxPoolSize) {
|
||||
this.maxPoolSize = maxPoolSize;
|
||||
}
|
||||
|
||||
public int getKeepAliveSeconds() {
|
||||
return this.keepAliveSeconds;
|
||||
}
|
||||
|
||||
public void setKeepAliveSeconds(int keepAliveSeconds) {
|
||||
this.keepAliveSeconds = keepAliveSeconds;
|
||||
}
|
||||
|
||||
public int getQueueCapacity() {
|
||||
return this.queueCapacity;
|
||||
}
|
||||
|
||||
public void setQueueCapacity(int queueCapacity) {
|
||||
this.queueCapacity = queueCapacity;
|
||||
}
|
||||
|
||||
public boolean isAllowCoreThreadTimeOut() {
|
||||
return this.allowCoreThreadTimeOut;
|
||||
}
|
||||
|
||||
public void setAllowCoreThreadTimeOut(boolean allowCoreThreadTimeOut) {
|
||||
this.allowCoreThreadTimeOut = allowCoreThreadTimeOut;
|
||||
}
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package cn.cloudwalk.starter.organization.config;
|
||||
|
||||
import cn.cloudwalk.starter.organization.config.DeviceReportPoolProperties;
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
@Configuration
|
||||
public class DeviceReportTasksExecutor {
|
||||
@Resource
|
||||
private DeviceReportPoolProperties deviceReportPoolProperties;
|
||||
|
||||
@Bean(value={"deviceReportTaskExecutor"})
|
||||
public ThreadPoolTaskExecutor deviceReportTaskExecutor() {
|
||||
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
|
||||
threadPoolTaskExecutor.setCorePoolSize(this.deviceReportPoolProperties.getCorePoolSize());
|
||||
threadPoolTaskExecutor.setAllowCoreThreadTimeOut(this.deviceReportPoolProperties.isAllowCoreThreadTimeOut());
|
||||
threadPoolTaskExecutor.setMaxPoolSize(this.deviceReportPoolProperties.getMaxPoolSize());
|
||||
threadPoolTaskExecutor.setQueueCapacity(this.deviceReportPoolProperties.getQueueCapacity());
|
||||
threadPoolTaskExecutor.setThreadNamePrefix("device-report-pool-");
|
||||
threadPoolTaskExecutor.setRejectedExecutionHandler((RejectedExecutionHandler)new ThreadPoolExecutor.AbortPolicy());
|
||||
threadPoolTaskExecutor.initialize();
|
||||
return threadPoolTaskExecutor;
|
||||
}
|
||||
}
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package cn.cloudwalk.starter.organization.config;
|
||||
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
import java.util.Enumeration;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
@Configuration
|
||||
public class FeignHeadersInterceptor
|
||||
implements RequestInterceptor {
|
||||
public void apply(RequestTemplate template) {
|
||||
HttpServletRequest request = this.getHttpServletRequest();
|
||||
if (Objects.isNull(request)) {
|
||||
return;
|
||||
}
|
||||
Map<String, String> headers = this.getHeaders(request);
|
||||
if (headers.size() > 0) {
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
template.header(entry.getKey(), new String[]{entry.getValue()});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private HttpServletRequest getHttpServletRequest() {
|
||||
try {
|
||||
return ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
|
||||
}
|
||||
catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, String> getHeaders(HttpServletRequest request) {
|
||||
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
|
||||
Enumeration enums = request.getHeaderNames();
|
||||
while (enums.hasMoreElements()) {
|
||||
String key = (String)enums.nextElement();
|
||||
String value = request.getHeader(key);
|
||||
map.put(key, value);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package cn.cloudwalk.starter.organization.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix="ninca.group.person.syn.pool")
|
||||
public class GroupPersonSynPoolProperties {
|
||||
private int corePoolSize = 3;
|
||||
private int maxPoolSize = 5;
|
||||
private int keepAliveSeconds = 150;
|
||||
private int queueCapacity = 100;
|
||||
private boolean allowCoreThreadTimeOut = true;
|
||||
|
||||
public int getCorePoolSize() {
|
||||
return this.corePoolSize;
|
||||
}
|
||||
|
||||
public void setCorePoolSize(int corePoolSize) {
|
||||
this.corePoolSize = corePoolSize;
|
||||
}
|
||||
|
||||
public int getMaxPoolSize() {
|
||||
return this.maxPoolSize;
|
||||
}
|
||||
|
||||
public void setMaxPoolSize(int maxPoolSize) {
|
||||
this.maxPoolSize = maxPoolSize;
|
||||
}
|
||||
|
||||
public int getKeepAliveSeconds() {
|
||||
return this.keepAliveSeconds;
|
||||
}
|
||||
|
||||
public void setKeepAliveSeconds(int keepAliveSeconds) {
|
||||
this.keepAliveSeconds = keepAliveSeconds;
|
||||
}
|
||||
|
||||
public int getQueueCapacity() {
|
||||
return this.queueCapacity;
|
||||
}
|
||||
|
||||
public void setQueueCapacity(int queueCapacity) {
|
||||
this.queueCapacity = queueCapacity;
|
||||
}
|
||||
|
||||
public boolean isAllowCoreThreadTimeOut() {
|
||||
return this.allowCoreThreadTimeOut;
|
||||
}
|
||||
|
||||
public void setAllowCoreThreadTimeOut(boolean allowCoreThreadTimeOut) {
|
||||
this.allowCoreThreadTimeOut = allowCoreThreadTimeOut;
|
||||
}
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package cn.cloudwalk.starter.organization.config;
|
||||
|
||||
import cn.cloudwalk.starter.organization.config.GroupPersonSynPoolProperties;
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
@Configuration
|
||||
public class GroupPersonSynTaskExecutor {
|
||||
@Autowired
|
||||
private GroupPersonSynPoolProperties groupPersonSynPoolProperties;
|
||||
|
||||
@Bean(name={"groupPersonSynExecutor"})
|
||||
public ThreadPoolTaskExecutor groupPersonSynExecutor() {
|
||||
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
|
||||
threadPoolTaskExecutor.setCorePoolSize(this.groupPersonSynPoolProperties.getCorePoolSize());
|
||||
threadPoolTaskExecutor.setAllowCoreThreadTimeOut(this.groupPersonSynPoolProperties.isAllowCoreThreadTimeOut());
|
||||
threadPoolTaskExecutor.setMaxPoolSize(this.groupPersonSynPoolProperties.getMaxPoolSize());
|
||||
threadPoolTaskExecutor.setQueueCapacity(this.groupPersonSynPoolProperties.getQueueCapacity());
|
||||
threadPoolTaskExecutor.setThreadNamePrefix("group-person-syn-pool-");
|
||||
threadPoolTaskExecutor.setRejectedExecutionHandler((RejectedExecutionHandler)new ThreadPoolExecutor.AbortPolicy());
|
||||
threadPoolTaskExecutor.initialize();
|
||||
return threadPoolTaskExecutor;
|
||||
}
|
||||
}
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package cn.cloudwalk.starter.organization.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix="handle.image.thread")
|
||||
public class HandleImagePoolProperties {
|
||||
private int corePoolSize;
|
||||
private int maxPoolSize;
|
||||
private int keepAliveSeconds;
|
||||
private int queueCapacity;
|
||||
private boolean allowCoreThreadTimeOut;
|
||||
|
||||
public int getCorePoolSize() {
|
||||
return this.corePoolSize;
|
||||
}
|
||||
|
||||
public void setCorePoolSize(int corePoolSize) {
|
||||
this.corePoolSize = corePoolSize;
|
||||
}
|
||||
|
||||
public int getMaxPoolSize() {
|
||||
return this.maxPoolSize;
|
||||
}
|
||||
|
||||
public void setMaxPoolSize(int maxPoolSize) {
|
||||
this.maxPoolSize = maxPoolSize;
|
||||
}
|
||||
|
||||
public int getKeepAliveSeconds() {
|
||||
return this.keepAliveSeconds;
|
||||
}
|
||||
|
||||
public void setKeepAliveSeconds(int keepAliveSeconds) {
|
||||
this.keepAliveSeconds = keepAliveSeconds;
|
||||
}
|
||||
|
||||
public int getQueueCapacity() {
|
||||
return this.queueCapacity;
|
||||
}
|
||||
|
||||
public void setQueueCapacity(int queueCapacity) {
|
||||
this.queueCapacity = queueCapacity;
|
||||
}
|
||||
|
||||
public boolean isAllowCoreThreadTimeOut() {
|
||||
return this.allowCoreThreadTimeOut;
|
||||
}
|
||||
|
||||
public void setAllowCoreThreadTimeOut(boolean allowCoreThreadTimeOut) {
|
||||
this.allowCoreThreadTimeOut = allowCoreThreadTimeOut;
|
||||
}
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package cn.cloudwalk.starter.organization.config;
|
||||
|
||||
import cn.cloudwalk.starter.organization.config.HandleImagePoolProperties;
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
@Configuration
|
||||
public class HandleImageTasksExecutor {
|
||||
@Resource
|
||||
private HandleImagePoolProperties handleImagePoolProperties;
|
||||
|
||||
@Bean(value={"handleImageTaskExecutor"})
|
||||
public ThreadPoolTaskExecutor handleImageTaskExecutor() {
|
||||
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
|
||||
threadPoolTaskExecutor.setCorePoolSize(this.handleImagePoolProperties.getCorePoolSize());
|
||||
threadPoolTaskExecutor.setAllowCoreThreadTimeOut(this.handleImagePoolProperties.isAllowCoreThreadTimeOut());
|
||||
threadPoolTaskExecutor.setMaxPoolSize(this.handleImagePoolProperties.getMaxPoolSize());
|
||||
threadPoolTaskExecutor.setQueueCapacity(this.handleImagePoolProperties.getQueueCapacity());
|
||||
threadPoolTaskExecutor.setThreadNamePrefix("handle-image-pool-");
|
||||
threadPoolTaskExecutor.setRejectedExecutionHandler((RejectedExecutionHandler)new ThreadPoolExecutor.AbortPolicy());
|
||||
threadPoolTaskExecutor.initialize();
|
||||
return threadPoolTaskExecutor;
|
||||
}
|
||||
}
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package cn.cloudwalk.starter.organization.config;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import okhttp3.ConnectionPool;
|
||||
import okhttp3.OkHttpClient;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class OkHttpConfig {
|
||||
@Value(value="${okhttp.readTimeout:60}")
|
||||
private Long readTimeout;
|
||||
@Value(value="${okhttp.connectTimeout:60}")
|
||||
private Long connectTimeout;
|
||||
@Value(value="${okhttp.writeTimeout:120}")
|
||||
private Long writeTimeout;
|
||||
@Value(value="${okhttp.connectionPool.maxIdleConnections:200}")
|
||||
private Integer maxIdleConnections;
|
||||
@Value(value="${okhttp.connectionPool.keepAliveDuration:60}")
|
||||
private Long keepAliveDuration;
|
||||
|
||||
@Bean
|
||||
public OkHttpClient okHttpClient() {
|
||||
return new OkHttpClient.Builder().readTimeout(this.readTimeout.longValue(), TimeUnit.SECONDS).connectTimeout(this.connectTimeout.longValue(), TimeUnit.SECONDS).writeTimeout(this.writeTimeout.longValue(), TimeUnit.SECONDS).connectionPool(new ConnectionPool(this.maxIdleConnections.intValue(), this.keepAliveDuration.longValue(), TimeUnit.SECONDS)).build();
|
||||
}
|
||||
}
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package cn.cloudwalk.starter.organization.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix="ninca.person.registry.pool")
|
||||
public class PersonRegistryPoolProperties {
|
||||
private int corePoolSize = 3;
|
||||
private int maxPoolSize = 5;
|
||||
private int keepAliveSeconds = 150;
|
||||
private int queueCapacity = 100;
|
||||
private boolean allowCoreThreadTimeOut = true;
|
||||
|
||||
public int getCorePoolSize() {
|
||||
return this.corePoolSize;
|
||||
}
|
||||
|
||||
public void setCorePoolSize(int corePoolSize) {
|
||||
this.corePoolSize = corePoolSize;
|
||||
}
|
||||
|
||||
public int getMaxPoolSize() {
|
||||
return this.maxPoolSize;
|
||||
}
|
||||
|
||||
public void setMaxPoolSize(int maxPoolSize) {
|
||||
this.maxPoolSize = maxPoolSize;
|
||||
}
|
||||
|
||||
public int getKeepAliveSeconds() {
|
||||
return this.keepAliveSeconds;
|
||||
}
|
||||
|
||||
public void setKeepAliveSeconds(int keepAliveSeconds) {
|
||||
this.keepAliveSeconds = keepAliveSeconds;
|
||||
}
|
||||
|
||||
public int getQueueCapacity() {
|
||||
return this.queueCapacity;
|
||||
}
|
||||
|
||||
public void setQueueCapacity(int queueCapacity) {
|
||||
this.queueCapacity = queueCapacity;
|
||||
}
|
||||
|
||||
public boolean isAllowCoreThreadTimeOut() {
|
||||
return this.allowCoreThreadTimeOut;
|
||||
}
|
||||
|
||||
public void setAllowCoreThreadTimeOut(boolean allowCoreThreadTimeOut) {
|
||||
this.allowCoreThreadTimeOut = allowCoreThreadTimeOut;
|
||||
}
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package cn.cloudwalk.starter.organization.config;
|
||||
|
||||
import cn.cloudwalk.starter.organization.config.PersonRegistryPoolProperties;
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
@Configuration
|
||||
public class PersonRegistryTaskExecutor {
|
||||
@Autowired
|
||||
private PersonRegistryPoolProperties personRegistryPoolProperties;
|
||||
|
||||
@Bean(name={"personRegistryExecutor"})
|
||||
public ThreadPoolTaskExecutor personRegistryExecutor() {
|
||||
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
|
||||
threadPoolTaskExecutor.setCorePoolSize(this.personRegistryPoolProperties.getCorePoolSize());
|
||||
threadPoolTaskExecutor.setAllowCoreThreadTimeOut(this.personRegistryPoolProperties.isAllowCoreThreadTimeOut());
|
||||
threadPoolTaskExecutor.setMaxPoolSize(this.personRegistryPoolProperties.getMaxPoolSize());
|
||||
threadPoolTaskExecutor.setQueueCapacity(this.personRegistryPoolProperties.getQueueCapacity());
|
||||
threadPoolTaskExecutor.setThreadNamePrefix("person-registry-pool-");
|
||||
threadPoolTaskExecutor.setRejectedExecutionHandler((RejectedExecutionHandler)new ThreadPoolExecutor.AbortPolicy());
|
||||
threadPoolTaskExecutor.initialize();
|
||||
return threadPoolTaskExecutor;
|
||||
}
|
||||
}
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package cn.cloudwalk.starter.organization.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.data.redis.core.script.DefaultRedisScript;
|
||||
import org.springframework.scripting.ScriptSource;
|
||||
import org.springframework.scripting.support.ResourceScriptSource;
|
||||
|
||||
@Configuration
|
||||
public class RedisConfig {
|
||||
@Bean(name={"addWaitSynTaskRedisScript"})
|
||||
public DefaultRedisScript<String> addWaitSynTaskRedisScript() {
|
||||
DefaultRedisScript defaultRedisScript = new DefaultRedisScript();
|
||||
defaultRedisScript.setResultType(String.class);
|
||||
defaultRedisScript.setScriptSource((ScriptSource)new ResourceScriptSource((Resource)new ClassPathResource("lua/addWaitSynTaskRedisScript.lua")));
|
||||
return defaultRedisScript;
|
||||
}
|
||||
|
||||
@Bean(name={"lockHandleSynTaskRedisScript"})
|
||||
public DefaultRedisScript<String> lockHandleSynTaskRedisScript() {
|
||||
DefaultRedisScript defaultRedisScript = new DefaultRedisScript();
|
||||
defaultRedisScript.setResultType(String.class);
|
||||
defaultRedisScript.setScriptSource((ScriptSource)new ResourceScriptSource((Resource)new ClassPathResource("lua/lockHandleSynTaskRedisScript.lua")));
|
||||
return defaultRedisScript;
|
||||
}
|
||||
|
||||
@Bean(name={"refreshHandleSynTaskRedisScript"})
|
||||
public DefaultRedisScript<String> refreshHandleSynTaskRedisScript() {
|
||||
DefaultRedisScript defaultRedisScript = new DefaultRedisScript();
|
||||
defaultRedisScript.setResultType(String.class);
|
||||
defaultRedisScript.setScriptSource((ScriptSource)new ResourceScriptSource((Resource)new ClassPathResource("lua/refreshHandleSynTaskRedisScript.lua")));
|
||||
return defaultRedisScript;
|
||||
}
|
||||
|
||||
@Bean(name={"lockHeadSynTaskRedisScript"})
|
||||
public DefaultRedisScript<String> lockHeadSynTaskRedisScript() {
|
||||
DefaultRedisScript defaultRedisScript = new DefaultRedisScript();
|
||||
defaultRedisScript.setResultType(String.class);
|
||||
defaultRedisScript.setScriptSource((ScriptSource)new ResourceScriptSource((Resource)new ClassPathResource("lua/lockHeadSynTaskRedisScript.lua")));
|
||||
return defaultRedisScript;
|
||||
}
|
||||
|
||||
@Bean(name={"handleSuccessSynTaskRedisScript"})
|
||||
public DefaultRedisScript<String> handleSuccessSynTaskRedisScript() {
|
||||
DefaultRedisScript defaultRedisScript = new DefaultRedisScript();
|
||||
defaultRedisScript.setResultType(String.class);
|
||||
defaultRedisScript.setScriptSource((ScriptSource)new ResourceScriptSource((Resource)new ClassPathResource("lua/handleSuccessSynTaskRedisScript.lua")));
|
||||
return defaultRedisScript;
|
||||
}
|
||||
|
||||
@Bean(name={"handleFailSynTaskRedisScript"})
|
||||
public DefaultRedisScript<String> handleFailSynTaskRedisScript() {
|
||||
DefaultRedisScript defaultRedisScript = new DefaultRedisScript();
|
||||
defaultRedisScript.setResultType(String.class);
|
||||
defaultRedisScript.setScriptSource((ScriptSource)new ResourceScriptSource((Resource)new ClassPathResource("lua/handleFailSynTaskRedisScript.lua")));
|
||||
return defaultRedisScript;
|
||||
}
|
||||
|
||||
@Bean(name={"lockValidateJobRedisScript"})
|
||||
public DefaultRedisScript<String> lockValidateJobRedisScript() {
|
||||
DefaultRedisScript defaultRedisScript = new DefaultRedisScript();
|
||||
defaultRedisScript.setResultType(String.class);
|
||||
defaultRedisScript.setScriptSource((ScriptSource)new ResourceScriptSource((Resource)new ClassPathResource("lua/lockValidateJobRedisScript.lua")));
|
||||
return defaultRedisScript;
|
||||
}
|
||||
|
||||
@Bean(name={"unlockValidateJobRedisScript"})
|
||||
public DefaultRedisScript<String> unlockValidateJobRedisScript() {
|
||||
DefaultRedisScript defaultRedisScript = new DefaultRedisScript();
|
||||
defaultRedisScript.setResultType(String.class);
|
||||
defaultRedisScript.setScriptSource((ScriptSource)new ResourceScriptSource((Resource)new ClassPathResource("lua/unlockValidateJobRedisScript.lua")));
|
||||
return defaultRedisScript;
|
||||
}
|
||||
}
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package cn.cloudwalk.starter.organization.config;
|
||||
|
||||
import cn.cloudwalk.cloud.context.CloudwalkSessionContextHolder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class SessionContextConfig {
|
||||
@Bean
|
||||
public CloudwalkSessionContextHolder cloudwalkSessionContextHolder() {
|
||||
return new CloudwalkSessionContextHolder();
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package cn.cloudwalk.starter.organization.config;
|
||||
|
||||
import java.net.URI;
|
||||
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
|
||||
|
||||
public class VMSHttpEntityEnclosingRequestBase
|
||||
extends HttpEntityEnclosingRequestBase {
|
||||
public VMSHttpEntityEnclosingRequestBase(URI uri) {
|
||||
this.setURI(uri);
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return "DELETE";
|
||||
}
|
||||
}
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package cn.cloudwalk.starter.organization.config.idGenerator;
|
||||
|
||||
import cn.cloudwalk.starter.organization.config.idGenerator.properties.SnowflakeProperties;
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean(value={SnowflakeProperties.class})
|
||||
public class SnowflakeConfig {
|
||||
@Bean
|
||||
Snowflake snowflake(@Autowired SnowflakeProperties properties) {
|
||||
return new Snowflake(properties.getWorkerId(), properties.getDatacenterId());
|
||||
}
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package cn.cloudwalk.starter.organization.config.idGenerator.properties;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix="cloudwalk.snowflake")
|
||||
public class SnowflakeProperties {
|
||||
public static final String PREFIX_PROPERTIES = "cloudwalk.snowflake";
|
||||
private long workerId;
|
||||
private long datacenterId;
|
||||
|
||||
public long getWorkerId() {
|
||||
return this.workerId;
|
||||
}
|
||||
|
||||
public void setWorkerId(long workerId) {
|
||||
this.workerId = workerId;
|
||||
}
|
||||
|
||||
public long getDatacenterId() {
|
||||
return this.datacenterId;
|
||||
}
|
||||
|
||||
public void setDatacenterId(long datacenterId) {
|
||||
this.datacenterId = datacenterId;
|
||||
}
|
||||
}
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package cn.cloudwalk.starter.organization.kafka;
|
||||
|
||||
import cn.cloudwalk.cwos.client.event.EventClient;
|
||||
import cn.cloudwalk.cwos.client.event.event.EventType;
|
||||
import cn.cloudwalk.service.organization.common.ComponentInnerKafkaConfig;
|
||||
import cn.cloudwalk.service.organization.listener.ComponentOrganizationEventListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component(value="snapAppKafkaConfigInit")
|
||||
public class ComponentKafkaInitialize
|
||||
implements ApplicationRunner {
|
||||
private EventClient eventClient;
|
||||
@Autowired
|
||||
private ComponentInnerKafkaConfig componentInnerKafkaConfig;
|
||||
|
||||
public EventClient getEventClient() {
|
||||
return this.eventClient;
|
||||
}
|
||||
|
||||
public void run(ApplicationArguments applicationArguments) throws Exception {
|
||||
EventClient kafkaClient = EventClient.getInstance((String)this.componentInnerKafkaConfig.getConsumer().getBootstrapServers(), (String)this.componentInnerKafkaConfig.getConsumer().getGroupId());
|
||||
kafkaClient.init();
|
||||
kafkaClient.setListenerClass(ComponentOrganizationEventListener.class);
|
||||
kafkaClient.subEvent(EventType.ENTERPRISE_CHANGE, this.componentInnerKafkaConfig.getServiceCode());
|
||||
kafkaClient.subEvent(EventType.PERSON_CARD_COMPARE, this.componentInnerKafkaConfig.getServiceCode());
|
||||
kafkaClient.subEvent(EventType.PICTURE_RESULT, "all");
|
||||
kafkaClient.subEvent(EventType.DEVICE_GROUP_CHANGE, "all");
|
||||
this.eventClient = kafkaClient;
|
||||
}
|
||||
}
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package cn.cloudwalk.starter.organization.multipart;
|
||||
|
||||
import cn.cloudwalk.starter.organization.multipart.properties.MultipartProperties;
|
||||
import javax.servlet.MultipartConfigElement;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.web.servlet.MultipartConfigFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean(value={MultipartProperties.class})
|
||||
public class MultipartConfig {
|
||||
@Bean
|
||||
public MultipartConfigElement multipartConfigElement(@Autowired MultipartProperties properties) {
|
||||
MultipartConfigFactory factory = new MultipartConfigFactory();
|
||||
factory.setMaxFileSize(properties.getMaxFileSize());
|
||||
factory.setMaxRequestSize(properties.getMaxRequestSize());
|
||||
return factory.createMultipartConfig();
|
||||
}
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package cn.cloudwalk.starter.organization.multipart.properties;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix="cloudwalk.multipart")
|
||||
public class MultipartProperties {
|
||||
public static final String PREFIX_PROPERTIES = "cloudwalk.multipart";
|
||||
private String maxFileSize;
|
||||
private String maxRequestSize;
|
||||
|
||||
public String getMaxFileSize() {
|
||||
return this.maxFileSize;
|
||||
}
|
||||
|
||||
public void setMaxFileSize(String maxFileSize) {
|
||||
this.maxFileSize = maxFileSize;
|
||||
}
|
||||
|
||||
public String getMaxRequestSize() {
|
||||
return this.maxRequestSize;
|
||||
}
|
||||
|
||||
public void setMaxRequestSize(String maxRequestSize) {
|
||||
this.maxRequestSize = maxRequestSize;
|
||||
}
|
||||
}
|
||||
|
||||
+198
@@ -0,0 +1,198 @@
|
||||
package cn.cloudwalk.starter.organization.mybatis;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URL;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import org.mybatis.generator.api.MyBatisGenerator;
|
||||
import org.mybatis.generator.api.ProgressCallback;
|
||||
import org.mybatis.generator.api.ShellCallback;
|
||||
import org.mybatis.generator.config.ColumnOverride;
|
||||
import org.mybatis.generator.config.Configuration;
|
||||
import org.mybatis.generator.config.Context;
|
||||
import org.mybatis.generator.config.JDBCConnectionConfiguration;
|
||||
import org.mybatis.generator.config.JavaClientGeneratorConfiguration;
|
||||
import org.mybatis.generator.config.JavaModelGeneratorConfiguration;
|
||||
import org.mybatis.generator.config.JavaTypeResolverConfiguration;
|
||||
import org.mybatis.generator.config.ModelType;
|
||||
import org.mybatis.generator.config.SqlMapGeneratorConfiguration;
|
||||
import org.mybatis.generator.config.TableConfiguration;
|
||||
import org.mybatis.generator.exception.InvalidConfigurationException;
|
||||
import org.mybatis.generator.internal.DefaultShellCallback;
|
||||
|
||||
public class MbGenerator {
|
||||
public static void main(String[] args) throws SQLException, IOException, InterruptedException, InvalidConfigurationException {
|
||||
String baseDir;
|
||||
Scanner sc = new Scanner(System.in);
|
||||
URL resource = MbGenerator.class.getResource("/");
|
||||
if (resource != null) {
|
||||
System.out.println("\u5f53\u524d\u7c7b\u76ee\u5f55\uff1a" + resource.getPath());
|
||||
}
|
||||
if (resource == null || !resource.getPath().contains("target/classes")) {
|
||||
System.out.println("\u8bf7\u624b\u52a8\u8bbe\u7f6ebaseDir: ");
|
||||
baseDir = sc.nextLine();
|
||||
} else {
|
||||
baseDir = resource.getPath().split("target/class")[0];
|
||||
}
|
||||
System.out.println("\u5de5\u4f5c\u76ee\u5f55\uff1a" + baseDir);
|
||||
Configuration config = new Configuration();
|
||||
List<String> warnings = new ArrayList<String>();
|
||||
Context context = new Context(ModelType.CONDITIONAL);
|
||||
context.setId("mbg");
|
||||
context.setTargetRuntime("MyBatis3");
|
||||
config.addContext(context);
|
||||
JDBCConnectionConfiguration jdbcConnectionConfiguration = new JDBCConnectionConfiguration();
|
||||
jdbcConnectionConfiguration.setConnectionURL("jdbc:mysql://10.136.144.15:3306/component-organization?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false");
|
||||
jdbcConnectionConfiguration.setDriverClass("com.mysql.jdbc.Driver");
|
||||
jdbcConnectionConfiguration.setUserId("cloudwalk");
|
||||
jdbcConnectionConfiguration.setPassword("1qaz!QAZ");
|
||||
context.setJdbcConnectionConfiguration(jdbcConnectionConfiguration);
|
||||
JavaTypeResolverConfiguration javaTypeResolverConfiguration = new JavaTypeResolverConfiguration();
|
||||
javaTypeResolverConfiguration.addProperty("forceBigDecimals", "false");
|
||||
context.setJavaTypeResolverConfiguration(javaTypeResolverConfiguration);
|
||||
JavaModelGeneratorConfiguration javaModelGeneratorConfiguration = new JavaModelGeneratorConfiguration();
|
||||
javaModelGeneratorConfiguration.setTargetPackage("cn.cloudwalk.data.organization.dto");
|
||||
javaModelGeneratorConfiguration.setTargetProject(baseDir + "src&main&java".replace("&", File.separator));
|
||||
javaModelGeneratorConfiguration.addProperty("enableSubPackages", "true");
|
||||
javaModelGeneratorConfiguration.addProperty("trimStrings", "true");
|
||||
context.setJavaModelGeneratorConfiguration(javaModelGeneratorConfiguration);
|
||||
SqlMapGeneratorConfiguration sqlMapGeneratorConfiguration = new SqlMapGeneratorConfiguration();
|
||||
sqlMapGeneratorConfiguration.setTargetPackage("mapper");
|
||||
sqlMapGeneratorConfiguration.setTargetProject(baseDir + "src&main&resources".replace("&", File.separator));
|
||||
sqlMapGeneratorConfiguration.addProperty("enableSubPackages", "true");
|
||||
context.setSqlMapGeneratorConfiguration(sqlMapGeneratorConfiguration);
|
||||
JavaClientGeneratorConfiguration javaClientGeneratorConfiguration = new JavaClientGeneratorConfiguration();
|
||||
javaClientGeneratorConfiguration.setConfigurationType("XMLMAPPER");
|
||||
javaClientGeneratorConfiguration.setTargetPackage("cn.cloudwalk.data.organization.mapper");
|
||||
javaClientGeneratorConfiguration.setTargetProject(baseDir + "src&main&java".replace("&", File.separator));
|
||||
javaClientGeneratorConfiguration.addProperty("enableSubPackages", "true");
|
||||
context.setJavaClientGeneratorConfiguration(javaClientGeneratorConfiguration);
|
||||
ArrayList<TableContent> TABLE_LIST = new ArrayList<TableContent>();
|
||||
TableContent tableContent1 = new TableContent("cw_is_organization_extend", "OrganizationExtend");
|
||||
tableContent1.addColumn(MbGenerator.columnOverride("PAYMENT_STATE", "paymentState", Integer.class.getTypeName()));
|
||||
tableContent1.addColumn(MbGenerator.columnOverride("EMPLOYEE_NUMBER", "employeeNumber", Integer.class.getTypeName()));
|
||||
tableContent1.addColumn(MbGenerator.columnOverride("ORG_CAR_NUMBER", "orgCarNumber", Integer.class.getTypeName()));
|
||||
tableContent1.addColumn(MbGenerator.columnOverride("EMPLOYEE_CAR_NUMBER", "employeeCarNumber", Integer.class.getTypeName()));
|
||||
tableContent1.addColumn(MbGenerator.columnOverride("CARPORT_NUM", "carportNum", Integer.class.getTypeName()));
|
||||
TABLE_LIST.add(tableContent1);
|
||||
TableContent tableContent2 = new TableContent("cw_is_organization_extend_detail", "OrganizationExtendDetail");
|
||||
tableContent2.addColumn(MbGenerator.columnOverride("UNIT_RENT", "unitRent", BigDecimal.class.getTypeName()));
|
||||
MbGenerator.fillTableConfiguration(context, TABLE_LIST);
|
||||
context.validate(warnings);
|
||||
for (String warning : warnings) {
|
||||
System.out.println(warning);
|
||||
}
|
||||
warnings = new ArrayList<String>();
|
||||
DefaultShellCallback callback = new DefaultShellCallback(true);
|
||||
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, (ShellCallback)callback, warnings);
|
||||
myBatisGenerator.generate(new ProgressCallback(){
|
||||
|
||||
public void introspectionStarted(int totalTasks) {
|
||||
System.out.println("introspectionStarted");
|
||||
}
|
||||
|
||||
public void generationStarted(int totalTasks) {
|
||||
System.out.println("generationStarted");
|
||||
}
|
||||
|
||||
public void saveStarted(int totalTasks) {
|
||||
System.out.println("saveStarted:" + totalTasks);
|
||||
}
|
||||
|
||||
public void startTask(String taskName) {
|
||||
System.out.println("startTask: " + taskName);
|
||||
}
|
||||
|
||||
public void done() {
|
||||
System.out.println("done");
|
||||
}
|
||||
|
||||
public void checkCancel() throws InterruptedException {
|
||||
System.out.println("checkCancel");
|
||||
}
|
||||
});
|
||||
for (String warning : warnings) {
|
||||
System.out.println(warning);
|
||||
}
|
||||
}
|
||||
|
||||
private static void fillTableConfiguration(Context context, List<TableContent> tableList) {
|
||||
for (TableContent tableContent : tableList) {
|
||||
TableConfiguration tableConfiguration = new TableConfiguration(context);
|
||||
tableConfiguration.setTableName(tableContent.getTableName());
|
||||
tableConfiguration.setDomainObjectName(tableContent.getDomainObjectName());
|
||||
for (ColumnOverride columnOverride : tableContent.getColumnList()) {
|
||||
tableConfiguration.addColumnOverride(columnOverride);
|
||||
}
|
||||
tableConfiguration.setCountByExampleStatementEnabled(false);
|
||||
tableConfiguration.setUpdateByExampleStatementEnabled(false);
|
||||
tableConfiguration.setDeleteByExampleStatementEnabled(false);
|
||||
tableConfiguration.setSelectByExampleStatementEnabled(false);
|
||||
context.addTableConfiguration(tableConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
private static ColumnOverride columnOverride(String columnName, String javaProperty, String javaTypeName) {
|
||||
ColumnOverride columnOverride = new ColumnOverride(columnName);
|
||||
columnOverride.setJavaProperty(javaProperty);
|
||||
columnOverride.setJavaType(javaTypeName);
|
||||
return columnOverride;
|
||||
}
|
||||
|
||||
public static class ColumnContent {
|
||||
private final String columnName;
|
||||
private final String javaProperty;
|
||||
private final String javaTypeName;
|
||||
|
||||
public ColumnContent(String columnName, String javaProperty, String javaTypeName) {
|
||||
this.columnName = columnName;
|
||||
this.javaProperty = javaProperty;
|
||||
this.javaTypeName = javaTypeName;
|
||||
}
|
||||
|
||||
public String getColumnName() {
|
||||
return this.columnName;
|
||||
}
|
||||
|
||||
public String getJavaProperty() {
|
||||
return this.javaProperty;
|
||||
}
|
||||
|
||||
public String getJavaTypeName() {
|
||||
return this.javaTypeName;
|
||||
}
|
||||
}
|
||||
|
||||
public static class TableContent {
|
||||
private final String tableName;
|
||||
private final String domainObjectName;
|
||||
private List<ColumnOverride> columnList = new ArrayList<ColumnOverride>();
|
||||
|
||||
public TableContent(String tableName, String domainObjectName) {
|
||||
this.tableName = tableName;
|
||||
this.domainObjectName = domainObjectName;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return this.tableName;
|
||||
}
|
||||
|
||||
public String getDomainObjectName() {
|
||||
return this.domainObjectName;
|
||||
}
|
||||
|
||||
public List<ColumnOverride> getColumnList() {
|
||||
return this.columnList;
|
||||
}
|
||||
|
||||
public TableContent addColumn(ColumnOverride columnContent) {
|
||||
this.columnList.add(columnContent);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
package cn.cloudwalk.starter.organization.task;
|
||||
|
||||
import cn.cloudwalk.service.organization.task.CpImageStoreImageSyncTask;
|
||||
import cn.cloudwalk.service.organization.task.DeleteDevicePersonTask;
|
||||
import cn.cloudwalk.service.organization.task.DeviceNotificationTask;
|
||||
import cn.cloudwalk.service.organization.task.DevicePersonSyncExceptionTask;
|
||||
import cn.cloudwalk.service.organization.task.HandleGroupFaceExceptionTask;
|
||||
import cn.cloudwalk.service.organization.task.UnbindDeviceImageStoreTask;
|
||||
import cn.cloudwalk.task.data.dto.param.TaskModifyParam;
|
||||
import cn.cloudwalk.task.service.TaskService;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ComponentTaskInitialize
|
||||
implements CommandLineRunner {
|
||||
@Value(value="${cloudwalk.imageStore.imageSync.cron:0 */5 * * * ?}")
|
||||
private String imageStoreImageSyncCron;
|
||||
@Value(value="${group-person.syn.config.device-person-resync.cron:0 */2 * * * ?}")
|
||||
private String devicePersonSyncCron;
|
||||
@Value(value="${group-person.syn.config.delete-device-person.cron:0 0 1 /1 * ? *}")
|
||||
private String deleteDevicePersonCron;
|
||||
@Value(value="${group-person.syn.config.notify-device.cron:0 */1 * * * ?}")
|
||||
private String notifyDeviceCron;
|
||||
@Value(value="${group-person.syn.config.unbind-device-imagestore.cron:0 */3 * * * ?}")
|
||||
private String unbindDeviceImageStoreCron;
|
||||
@Value(value="${group-person.syn.config.handle-group-face-exception.cron:0 /5 * * * ?}")
|
||||
private String handleGroupFaceExceptionCron;
|
||||
@Value(value="${server.instance-id:null}")
|
||||
private String serverInstanceId;
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
public void run(String ... strings) throws Exception {
|
||||
Set<String> lockKeys = this.redisTemplate.keys("*:" + this.serverInstanceId);
|
||||
if (lockKeys != null) {
|
||||
lockKeys.forEach(k -> this.redisTemplate.delete(k));
|
||||
}
|
||||
this.initCpImageStoreImageSyncTask();
|
||||
this.initDevicePersonSyncExceptionTask();
|
||||
this.initDeleteDevicePersonTask();
|
||||
this.initDeviceNotificationTask();
|
||||
this.initUnbindDeviceImageStoreTask();
|
||||
this.initHandleGroupFaceExceptionTask();
|
||||
}
|
||||
|
||||
private void initCpImageStoreImageSyncTask() {
|
||||
TaskModifyParam taskModifyParam = new TaskModifyParam();
|
||||
taskModifyParam.setJobDescription("\u7ec4\u4ef6\u5c42\u56fe\u5e93\u4eba\u5458\u8bc6\u522b\u7167\u5efa\u6a21\u6570\u636e\u540c\u6b65\u4efb\u52a1");
|
||||
taskModifyParam.setJobName("\u7ec4\u4ef6\u5c42\u56fe\u5e93\u4eba\u5458\u8bc6\u522b\u7167\u5efa\u6a21\u6570\u636e\u540c\u6b65\u4efb\u52a1");
|
||||
taskModifyParam.setJobGroup("CP_IMAGE_STORE_IMAGE_SYNC_GROUP");
|
||||
taskModifyParam.setClazz(CpImageStoreImageSyncTask.class);
|
||||
taskModifyParam.setRetry(Boolean.valueOf(false));
|
||||
taskModifyParam.setPriority(Integer.valueOf(1));
|
||||
taskModifyParam.setStartTime(Long.valueOf(System.currentTimeMillis()));
|
||||
taskModifyParam.setExpression(this.imageStoreImageSyncCron);
|
||||
taskModifyParam.setNeedListener(Boolean.valueOf(true));
|
||||
this.taskService.addCronJob(taskModifyParam);
|
||||
}
|
||||
|
||||
private void initDevicePersonSyncExceptionTask() {
|
||||
TaskModifyParam taskModifyParam = new TaskModifyParam();
|
||||
taskModifyParam.setJobDescription("\u8bbe\u5907\u4eba\u5458\u540c\u6b65\u5f02\u5e38\u540c\u6b65\u4efb\u52a1");
|
||||
taskModifyParam.setJobName("\u8bbe\u5907\u4eba\u5458\u540c\u6b65\u5f02\u5e38\u540c\u6b65\u4efb\u52a1");
|
||||
taskModifyParam.setJobGroup("CP_IMAGE_STORE_IMAGE_SYNC_GROUP");
|
||||
taskModifyParam.setClazz(DevicePersonSyncExceptionTask.class);
|
||||
taskModifyParam.setRetry(Boolean.valueOf(false));
|
||||
taskModifyParam.setPriority(Integer.valueOf(1));
|
||||
taskModifyParam.setStartTime(Long.valueOf(System.currentTimeMillis()));
|
||||
taskModifyParam.setExpression(this.devicePersonSyncCron);
|
||||
taskModifyParam.setNeedListener(Boolean.valueOf(true));
|
||||
this.taskService.addCronJob(taskModifyParam);
|
||||
}
|
||||
|
||||
private void initDeleteDevicePersonTask() {
|
||||
TaskModifyParam taskModifyParam = new TaskModifyParam();
|
||||
taskModifyParam.setJobDescription("\u5220\u9664\u8bbe\u5907\u4eba\u5458\u540c\u6b65\u8bb0\u5f55\u4efb\u52a1");
|
||||
taskModifyParam.setJobName("\u5220\u9664\u8bbe\u5907\u4eba\u5458\u540c\u6b65\u8bb0\u5f55\u4efb\u52a1");
|
||||
taskModifyParam.setJobGroup("CP_DELETE_DEVICE_PERSON");
|
||||
taskModifyParam.setClazz(DeleteDevicePersonTask.class);
|
||||
taskModifyParam.setRetry(Boolean.valueOf(false));
|
||||
taskModifyParam.setPriority(Integer.valueOf(1));
|
||||
taskModifyParam.setStartTime(Long.valueOf(System.currentTimeMillis()));
|
||||
taskModifyParam.setExpression(this.deleteDevicePersonCron);
|
||||
taskModifyParam.setNeedListener(Boolean.valueOf(true));
|
||||
this.taskService.addCronJob(taskModifyParam);
|
||||
}
|
||||
|
||||
private void initDeviceNotificationTask() {
|
||||
TaskModifyParam taskModifyParam = new TaskModifyParam();
|
||||
taskModifyParam.setJobDescription("\u901a\u77e5\u8bbe\u5907\u62c9\u53d6\u4efb\u52a1");
|
||||
taskModifyParam.setJobName("\u901a\u77e5\u8bbe\u5907\u62c9\u53d6\u4efb\u52a1");
|
||||
taskModifyParam.setJobGroup("CP_NOTIFY_DEVICE");
|
||||
taskModifyParam.setClazz(DeviceNotificationTask.class);
|
||||
taskModifyParam.setRetry(Boolean.valueOf(false));
|
||||
taskModifyParam.setPriority(Integer.valueOf(1));
|
||||
taskModifyParam.setStartTime(Long.valueOf(System.currentTimeMillis()));
|
||||
taskModifyParam.setExpression(this.notifyDeviceCron);
|
||||
taskModifyParam.setNeedListener(Boolean.valueOf(true));
|
||||
this.taskService.addCronJob(taskModifyParam);
|
||||
}
|
||||
|
||||
private void initUnbindDeviceImageStoreTask() {
|
||||
TaskModifyParam taskModifyParam = new TaskModifyParam();
|
||||
taskModifyParam.setJobDescription("\u8bbe\u5907\u56fe\u5e93\u89e3\u7ed1\u4efb\u52a1");
|
||||
taskModifyParam.setJobName("\u8bbe\u5907\u56fe\u5e93\u89e3\u7ed1\u4efb\u52a1");
|
||||
taskModifyParam.setJobGroup("CP_UNBIND_DEVICE_IMAGE_STORE");
|
||||
taskModifyParam.setClazz(UnbindDeviceImageStoreTask.class);
|
||||
taskModifyParam.setRetry(Boolean.valueOf(false));
|
||||
taskModifyParam.setPriority(Integer.valueOf(1));
|
||||
taskModifyParam.setStartTime(Long.valueOf(System.currentTimeMillis()));
|
||||
taskModifyParam.setExpression(this.unbindDeviceImageStoreCron);
|
||||
taskModifyParam.setNeedListener(Boolean.valueOf(true));
|
||||
this.taskService.addCronJob(taskModifyParam);
|
||||
}
|
||||
|
||||
private void initHandleGroupFaceExceptionTask() {
|
||||
TaskModifyParam taskModifyParam = new TaskModifyParam();
|
||||
taskModifyParam.setJobDescription("\u5904\u7406\u56fe\u5e93\u4eba\u8138\u5f02\u5e38\u4efb\u52a1");
|
||||
taskModifyParam.setJobName("\u5904\u7406\u56fe\u5e93\u4eba\u8138\u5f02\u5e38\u4efb\u52a1");
|
||||
taskModifyParam.setJobGroup("CP_HANDLE_GROUP_FACE_EXCEPTION_TASK");
|
||||
taskModifyParam.setClazz(HandleGroupFaceExceptionTask.class);
|
||||
taskModifyParam.setRetry(Boolean.valueOf(false));
|
||||
taskModifyParam.setPriority(Integer.valueOf(1));
|
||||
taskModifyParam.setStartTime(Long.valueOf(System.currentTimeMillis()));
|
||||
taskModifyParam.setExpression(this.handleGroupFaceExceptionCron);
|
||||
taskModifyParam.setNeedListener(Boolean.valueOf(true));
|
||||
this.taskService.addCronJob(taskModifyParam);
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
# component-account i18n stub (UTF-8). Extend with account module keys if needed.
|
||||
+1
@@ -0,0 +1 @@
|
||||
# 账户组件文案占位(UTF-8),消除 ResourceBundle 缺失告警;可按业务补充键值。
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
# Default (typically English) — optional fallback; zh_CN uses messages_zh_CN.properties.
|
||||
# Keys mirror messages_zh_CN.properties; override per deployment if needed.
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
# 组织组件(component-org)中文文案 — 键为接口错误码,供 MessageSource 解析。
|
||||
# 编码 UTF-8(需配合 spring.messages.encoding=UTF-8)。
|
||||
|
||||
# --- 设备套件 CpOrgDeviceKit ---
|
||||
52003005=设备套件参数校验失败
|
||||
52003006=设备套件查询失败
|
||||
52003007=设备套件绑定失败
|
||||
52003008=设备套件解绑失败
|
||||
|
||||
# --- 组织 / 区域类型 ---
|
||||
53003300=组织业务处理失败
|
||||
53003800=组织类型列表查询失败
|
||||
53003801=组织类型新增失败
|
||||
53003802=组织类型修改失败
|
||||
53003804=组织类型删除失败
|
||||
|
||||
53004800=区域类型列表查询失败
|
||||
53004801=区域类型新增失败
|
||||
53004802=区域类型修改失败
|
||||
53004804=区域类型删除失败
|
||||
|
||||
# --- 人员扩展属性 ---
|
||||
53004112=人员扩展属性查询失败
|
||||
53004113=人员扩展属性保存失败
|
||||
53004123=人员扩展属性删除失败
|
||||
53004125=人员扩展属性校验失败
|
||||
53004126=人员扩展属性更新失败
|
||||
|
||||
# --- 图库 / 同步 ---
|
||||
53013502=图库不存在或数据为空
|
||||
53013508=创建图库失败
|
||||
53013509=修改图库失败
|
||||
53013510=删除图库失败
|
||||
53013511=图库查询失败
|
||||
53013512=图库正在同步中,请稍后重试
|
||||
53013513=包含的组织不存在或不属于当前企业
|
||||
53013514=包含的标签不存在或不属于当前企业
|
||||
53013515=包含的人员不存在或不属于当前企业
|
||||
53013516=排除的标签不存在或不属于当前企业
|
||||
53013517=排除的人员不存在或不属于当前企业
|
||||
53013522=组织图库列表查询失败
|
||||
53013523=组织图库新增失败
|
||||
53013524=组织图库删除失败
|
||||
53013525=应用图库新增失败
|
||||
53013526=应用图库修改失败
|
||||
53013527=应用图库删除失败
|
||||
53013528=应用图库查询失败
|
||||
53013529=图库同步任务提交失败
|
||||
53013532=图库人员新增失败
|
||||
53013533=图库人员删除失败
|
||||
53013534=图库人员查询失败
|
||||
53013535=企业信息查询失败
|
||||
53013541=图库人员变更失败
|
||||
53013544=图库人员同步失败
|
||||
53013545=图库仍关联应用,无法删除
|
||||
53013547=来源应用信息查询失败
|
||||
53013549=图库同步接口调用失败
|
||||
53013550=设备人员同步参数错误
|
||||
53013552=设备人员同步查询失败
|
||||
53013553=设备人员同步任务失败
|
||||
53013554=设备人员同步处理失败
|
||||
53013558=图库人员批量操作失败
|
||||
|
||||
# --- 人员 CRUD / 导入 ---
|
||||
53014008=人员新增失败
|
||||
53014009=人员修改失败
|
||||
53014010=人员删除失败
|
||||
53014011=人员查询失败
|
||||
53014025=设备人员同步限制或冲突
|
||||
53014032=人员批量导入模板或数据校验失败
|
||||
53014033=人员批量导入执行失败
|
||||
53014034=人员批量导入结果查询失败
|
||||
|
||||
# --- 注册 / H5 ---
|
||||
53014515=人员注册参数错误
|
||||
53014520=人员注册失败
|
||||
53014521=人员注册状态查询失败
|
||||
53014523=人员注册记录查询失败
|
||||
|
||||
53014600=行政区划查询失败
|
||||
53014700=设备查询失败
|
||||
53014900=二维码生成失败
|
||||
|
||||
53015201=操作日志查询失败
|
||||
|
||||
# --- 文件 / 工具 / 审核 ---
|
||||
53060428=文件访问受限
|
||||
53060431=图库工具接口调用失败
|
||||
53060441=图库工具查询失败
|
||||
53060442=图库工具操作失败
|
||||
53060544=文件上传处理失败
|
||||
53060548=人员审核操作失败
|
||||
80014013=文件存储或格式校验失败
|
||||
+1
@@ -0,0 +1 @@
|
||||
# component-resource i18n stub (UTF-8).
|
||||
+1
@@ -0,0 +1 @@
|
||||
# 资源组件文案占位(UTF-8)。
|
||||
+1
@@ -0,0 +1 @@
|
||||
# core-aggregate i18n stub (UTF-8).
|
||||
+1
@@ -0,0 +1 @@
|
||||
# 聚合核心文案占位(UTF-8)。
|
||||
+1
@@ -0,0 +1 @@
|
||||
# core-device i18n stub (UTF-8).
|
||||
+1
@@ -0,0 +1 @@
|
||||
# 设备核心文案占位(UTF-8)。
|
||||
+1
@@ -0,0 +1 @@
|
||||
# devicesdk i18n stub (UTF-8).
|
||||
+1
@@ -0,0 +1 @@
|
||||
# 设备 SDK 文案占位(UTF-8)。
|
||||
+1
@@ -0,0 +1 @@
|
||||
# Root message bundle placeholder (UTF-8). Add shared keys here if needed.
|
||||
+1
@@ -0,0 +1 @@
|
||||
# 根级文案占位(UTF-8)。组织组件专用键请维护于 component-org/messages_zh_CN.properties。
|
||||
Reference in New Issue
Block a user