commit ff87d548e3a3adaa223014c8810e7aabc8e9f950 Author: wyb <1977763549@qq.com> Date: Wed Mar 27 13:57:13 2024 +0800 init:佛山三院数据采集项目初始化 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6a8a1e4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +docus-services/docus-services-system1/ + +### IntelliJ IDEA ### +*.log +.idea +*.iws +*.iml +*.ipr +mvnw* +*.cmd +*.mvn +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ +logs* \ No newline at end of file diff --git a/assembly.xml b/assembly.xml new file mode 100644 index 0000000..b6fb827 --- /dev/null +++ b/assembly.xml @@ -0,0 +1,73 @@ + + + exe + + dir + + false + + + + + /lib + ${basedir}/target/lib + + + + /config + ${basedir}/target/resources + 0755 + + *.xml + *.yml + *.properties + + + + + /dataConfig + ${basedir}/target/dataConfig + 0755 + + *.json + + + + + / + ${basedir}/target/resources/bin + 0755 + + *.bat + + + + + / + ${basedir}/target/resources/bin + 0755 + + *.xml + + + + + / + ${basedir} + 0755 + + *.exe + + + + + ${basedir}/target + / + 0755 + + ${project.build.finalName}.jar + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..fe6277f --- /dev/null +++ b/pom.xml @@ -0,0 +1,350 @@ + + + + com.docus + docus-bom + 1.0-SNAPSHOT + + 4.0.0 + + docus-collect-fssy + + + + com.docus + docus-knife4j-starter + + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + checker-qual + org.checkerframework + + + error_prone_annotations + com.google.errorprone + + + + + org.springframework.boot + spring-boot-starter-web + + + + com.baomidou + mybatis-plus-boot-starter + 3.4.0 + + + com.baomidou + dynamic-datasource-spring-boot-starter + 3.4.0 + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + HdrHistogram + org.hdrhistogram + + + jsr305 + com.google.code.findbugs + + + + + mysql + mysql-connector-java + 8.0.28 + + + org.projectlombok + lombok + 1.18.16 + compile + + + org.projectlombok + lombok + 1.18.16 + compile + + + org.bgee.log4jdbc-log4j2 + log4jdbc-log4j2-jdbc4.1 + + + com.alibaba + druid + 1.2.4 + compile + + + com.baomidou + mybatis-plus-generator + 3.4.1 + compile + + + org.apache.velocity + velocity-engine-core + 2.0 + + + com.xuxueli + xxl-job-core + + + com.docus + docus-base-starter + + + knife4j-spring-boot-autoconfigure + com.github.xiaoymin + + + + + + com.docus + docus-tool-starter + + + + com.docus + docus-shiro-starter + + + + com.docus + docus-base-starter + + + springfox-core + io.springfox + + + springfox-schema + io.springfox + + + springfox-spi + io.springfox + + + knife4j-spring-boot-autoconfigure + com.github.xiaoymin + + + + + + + org.springframework.cloud + spring-cloud-starter-netflix-hystrix + + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + junit + junit + test + + + + + com.microsoft.sqlserver + sqljdbc4 + 4.0 + + + + + com.oracle + ojdbc6 + 11.2.0.4.0 + + + + + + + src/main/resources + true + + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.4.4 + + ZIP + + + non-exists + non-exists + + + + + + + repackage + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + package + + copy-dependencies + + + + target/lib + false + false + runtime + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.2.0 + + + copy-resources + package + + copy-resources + + + + + src/main/resources + + **/*.* + + + + ${project.build.directory}/resources + + + + copy-bin + package + + copy-resources + + + + + src/main/resources + true + + bin/*.xml + *.yml + bin/*.bat + + + + ${project.build.directory}/resources + + + + copy-data-config + package + + copy-resources + + + + + ../../dataConfig + true + + + ${project.build.directory}/dataConfig + + + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + **/*.yml + + + + + + maven-assembly-plugin + + + + ${project.artifactId} + false + + assembly.xml + + + make-assembly + package + + single + + + + + + + + + + + dev + + prod + + + true + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/docus/server/AppRunBootstrap.java b/src/main/java/com/docus/server/AppRunBootstrap.java new file mode 100644 index 0000000..14565b5 --- /dev/null +++ b/src/main/java/com/docus/server/AppRunBootstrap.java @@ -0,0 +1,22 @@ +package com.docus.server; + + +import lombok.extern.slf4j.Slf4j; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.openfeign.EnableFeignClients; + + +/** + * @author wyb + */ +@Slf4j +@SpringBootApplication(scanBasePackages ={"com.docus"}) +@MapperScan("com.docus.server.**.mapper") +@EnableFeignClients(basePackages = {"com.docus"}) +public class AppRunBootstrap { + public static void main(String[] args) { + SpringApplication.run(AppRunBootstrap.class, args); + } +} diff --git a/src/main/java/com/docus/server/XxlJobConfig.java b/src/main/java/com/docus/server/XxlJobConfig.java new file mode 100644 index 0000000..d9edbfa --- /dev/null +++ b/src/main/java/com/docus/server/XxlJobConfig.java @@ -0,0 +1,87 @@ +package com.docus.server; +import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @ProjectName: + * @Description: + * @Param 传输参数 + * @Return + * @Author: 曾文和 + * @CreateDate: 2021/5/7 16:23 + * @UpdateUser: 曾文和 + * @UpdateDate: 2021/5/7 16:23 + * @UpdateRemark: 更新说明 + * @Version: 1.0 + */ + + + +@Configuration +public class XxlJobConfig { + private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class); + + @Value("${xxl.job.admin.addresses}") + private String adminAddresses; + + @Value("${xxl.job.accessToken}") + private String accessToken; + + @Value("${xxl.job.executor.appname}") + private String appname; + + @Value("${xxl.job.executor.address}") + private String address; + + @Value("${xxl.job.executor.ip}") + private String ip; + + @Value("${xxl.job.executor.port}") + private int port; + + @Value("${xxl.job.executor.logpath}") + private String logPath; + + @Value("${xxl.job.executor.logretentiondays}") + private int logRetentionDays; + + + @Bean + public XxlJobSpringExecutor xxlJobExecutor() { + logger.info(">>>>>>>>>>> xxl-job config init."); + XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); + xxlJobSpringExecutor.setAdminAddresses(adminAddresses); + xxlJobSpringExecutor.setAppname(appname); + xxlJobSpringExecutor.setAddress(address); + xxlJobSpringExecutor.setIp(ip); + xxlJobSpringExecutor.setPort(port); + xxlJobSpringExecutor.setAccessToken(accessToken); + xxlJobSpringExecutor.setLogPath(logPath); + xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); + + return xxlJobSpringExecutor; + } + + /** + * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP; + * + * 1、引入依赖: + * + * org.springframework.cloud + * spring-cloud-commons + * ${version} + * + * + * 2、配置文件,或者容器启动变量 + * spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.' + * + * 3、获取IP + * String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); + *//* + +*/ +} diff --git a/src/main/resources/bin/install.bat b/src/main/resources/bin/install.bat new file mode 100644 index 0000000..7a651bc --- /dev/null +++ b/src/main/resources/bin/install.bat @@ -0,0 +1,33 @@ +@echo off + +for /f "delims=" %%t in ('winsw.exe status') do set str=%%t +echo %str% + + + +if %str%==Started ( +echo "restart....." +winsw stop +PING 127.0.0.1 -n 10 -w 30000 >NUL +winsw start +) + + + +if %str%==Stopped ( +echo "start....." +winsw start +) + + +if %str%==NonExistent ( +echo "deploy and start....." +winsw install +winsw start +echo c +) + + + + + diff --git a/src/main/resources/bin/start.bat b/src/main/resources/bin/start.bat new file mode 100644 index 0000000..58c25cb --- /dev/null +++ b/src/main/resources/bin/start.bat @@ -0,0 +1,21 @@ +set java_opts=-Xms512m -Xmx512m +set key="java_opts" + + +rem 文件不存在,就跳过 +if not exist java-ops.ini goto end + +for /f "tokens=1,2 delims==" %%i in (java-ops.ini) do ( + if "%%i"==%key% set java_opts=%%j) +echo java_opts is : %java_opts% + +:end + +rem 启动java + +java %java_opts% -Dfile.encoding=utf-8 -jar -Dspring.profiles.active=@profile.name@ -Dloader.path=config,lib @project.build.finalName@.jar + + + + + diff --git a/src/main/resources/bin/stop.bat b/src/main/resources/bin/stop.bat new file mode 100644 index 0000000..98468a0 --- /dev/null +++ b/src/main/resources/bin/stop.bat @@ -0,0 +1,13 @@ +@echo off + +for /f "delims=" %%t in ('winsw.exe status') do set str=%%t +echo %str% + + + +if %str%==Started ( +winsw stop +@echo wait program stop ..... +PING 127.0.0.1 -n 30 -w 10000 >NUL +) + diff --git a/src/main/resources/bin/update.bat b/src/main/resources/bin/update.bat new file mode 100644 index 0000000..346e25d --- /dev/null +++ b/src/main/resources/bin/update.bat @@ -0,0 +1,19 @@ +@echo off + +set deployDir=%1\docus-collect-mmry +if %deployDir%=="" set deployDir=d:\webroot\docus-collect-fssy + +set curr_file=%cd% +cd /d %deployDir% +call stop.bat +cd %curr_file% +sc query docus-backup-sys |Find "RUNNING" && ping 127.0.0.1 -n 10 >nul +rd/s/q %deployDir%\lib +rd/s/q %deployDir%\dataConfig +rd/s/q %deployDir%\config +del /s/q %deployDir%\*.jar +xcopy /Y/E/I * %deployDir% + +cd /d %deployDir% +call install.bat + diff --git a/src/main/resources/bin/winsw.xml b/src/main/resources/bin/winsw.xml new file mode 100644 index 0000000..c5a6094 --- /dev/null +++ b/src/main/resources/bin/winsw.xml @@ -0,0 +1,8 @@ + + docus-collect-fssy + 生产-嘉时-佛山三院采集服务 + 生产-嘉时-佛山三院采集服务 + Automatic + %BASE%\start.bat + + \ No newline at end of file diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..4323945 --- /dev/null +++ b/src/main/resources/bootstrap.yml @@ -0,0 +1,107 @@ +server: + port: 9314 + +spring: + application: + name: @artifactId@ + profiles: + active: test + datasource: + dynamic: + primary: master #设置默认的数据源,默认值为master + strict: false #是否用严格模式,如果启用在味匹配到指定数据源时抛出异常 + datasource: + master: + url: jdbc:log4jdbc:mysql://db.docus.cn:3306/docus_medicalrecord?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai + username: docus + password: docus702 + driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + type: com.alibaba.druid.pool.DruidDataSource + # 初始化配置 + initial-size: 3 + # 最小连接数 + min-idle: 3 + # 最大连接数 + max-active: 15 + # 获取连接超 时时间 + max-wait: 5000 + # 连接有效性检测时间 + time-between-eviction-runs-millis: 90000 + # 最大空闲时间 + min-evictable-idle-time-millis: 1800000 + test-while-idle: true + test-on-borrow: false + test-on-return: false + validation-query: select 1 + trusthis: + url: jdbc:sqlserver://200.100.104.22:1433;DatabaseName=hq_framework + username: WZH + password: 123.WZH + driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver + type: com.alibaba.druid.pool.DruidDataSource + # 初始化配置 + initial-size: 3 + # 最小连接数 + min-idle: 3 + # 最大连接数 + max-active: 15 + # 获取连接超 时时间 + max-wait: 5000 + # 连接有效性检测时间 + time-between-eviction-runs-millis: 90000 + # 最大空闲时间 + min-evictable-idle-time-millis: 1800000 + test-while-idle: true + test-on-borrow: false + test-on-return: false + validation-query: select 1 + redis: + host: redis.docus.cn + password: JSdocus@702 + cloud: + nacos: + discovery: + server-addr: nacos.docus.cn + namespace: 34acdf7a-9fc6-4bbd-8aea-9a47c8007ad5 + config: + server-addr: ${spring.cloud.nacos.discovery.server-addr} + namespace: 34acdf7a-9fc6-4bbd-8aea-9a47c8007ad5 + file-extension: yml + shared-configs: + - comm.${spring.cloud.nacos.config.file-extension} + + +docus: + url: + # 采集任务补偿地址 + compensate-task-url: http://localhost:9295/ + # 下载地址 + down-url: http://localhost:9291/api/downplatform/report + medicalrecord: http://192.168.16.85:9102 + + + dbtype: mysql + +mybatis-plus: + configuration: + map-underscore-to-camel-case: true + call-setters-on-nulls: true + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + global-config: + db-config: + field-strategy: NOT_EMPTY + db-type: MYSQL +xxl: + job: + accessToken: + admin: + addresses: http://job.docus.cn:8180/xxl-job-admin + executor: + appname: docus-collect-fssy + address: + ip: + port: 19314 + logretentiondays: 30 + logpath: D:/xxl-job/docus-collect-fssy + + diff --git a/src/main/resources/log4jdbc.log4j2.properties b/src/main/resources/log4jdbc.log4j2.properties new file mode 100644 index 0000000..5cb6f99 --- /dev/null +++ b/src/main/resources/log4jdbc.log4j2.properties @@ -0,0 +1,2 @@ +# If you use SLF4J. First, you need to tell log4jdbc-log4j2 that you want to use the SLF4J logger +log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator \ No newline at end of file diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml new file mode 100644 index 0000000..796ad4b --- /dev/null +++ b/src/main/resources/logback.xml @@ -0,0 +1,77 @@ + + + docus-collect-fssy + + + + + [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%contextName] [%thread] [%X{traceId}] %-5level %logger{36} - %msg%n + + + + + + + [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%C] [%t] [%X{traceId}] [%L] [%-5p] %m%n + utf-8 + + + + + ${log.path}%d.%i.log + + 500MB + + 30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/winsw.exe b/winsw.exe new file mode 100644 index 0000000..ba27e3f Binary files /dev/null and b/winsw.exe differ