Ver código fonte

feat:
1. 增加生产环境配置
2. 修改目录结构
3. 修改pom配置,多环境配置

Jing.Li 4 anos atrás
pai
commit
db0004d9e6

+ 21 - 0
pom.xml

@@ -157,6 +157,27 @@
                 </executions>
             </plugin>
         </plugins>
+
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <!-- 资源根目录排除各环境的配置,使用单独的资源目录来指定 -->
+                <excludes>
+                    <exclude>application-dev.yml</exclude>
+                    <exclude>application-test.yml</exclude>
+                    <exclude>application-prod.yml</exclude>
+                    <exclude>application.yml</exclude>
+                </excludes>
+            </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>application.yml</include>
+                    <include>application-${env}.yml</include>
+                </includes>
+            </resource>
+        </resources>
     </build>
 
     <profiles>

+ 30 - 0
sql/db.sql

@@ -0,0 +1,30 @@
+CREATE TABLE `c_schedule_task` (
+    `id` varchar(36) NOT NULL COMMENT '主键ID',
+    `task_name` varchar(255) DEFAULT NULL COMMENT '任务名称',
+    `cron` varchar(255) DEFAULT NULL COMMENT '任务参数',
+    `class_name` varchar(255) DEFAULT NULL COMMENT '完整类名',
+    `method_name` varchar(255) DEFAULT NULL COMMENT '方法名',
+    `remark` varchar(255) DEFAULT NULL COMMENT '备注',
+    PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='yideb-audit-statistic,定时任务动态配置表';
+
+CREATE TABLE `c_statistic_config` (
+    `id` varchar(36) NOT NULL COMMENT '主键ID',
+    `business_type` int(5) DEFAULT NULL COMMENT '业务类型Code',
+    `value` int(5) DEFAULT NULL COMMENT '业务数据配置',
+    `status` int(1) DEFAULT NULL COMMENT '是否生效',
+    `remark` varchar(255) DEFAULT NULL COMMENT '备注',
+    PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='yideb-audit-statistic,业务配置表';
+
+INSERT INTO `c_statistic_config`(`id`, `business_type`, `value`, `status`, `remark`) VALUES ('1', 1001, 5, 1, '药店注册');
+INSERT INTO `c_statistic_config`(`id`, `business_type`, `value`, `status`, `remark`) VALUES ('10', 1010, 30, 1, '药店处方量Top数据量');
+INSERT INTO `c_statistic_config`(`id`, `business_type`, `value`, `status`, `remark`) VALUES ('11', 1011, 5, 1, '地图');
+INSERT INTO `c_statistic_config`(`id`, `business_type`, `value`, `status`, `remark`) VALUES ('2', 1002, 5, 1, '处方总量');
+INSERT INTO `c_statistic_config`(`id`, `business_type`, `value`, `status`, `remark`) VALUES ('3', 1003, 5, 1, '发生业务医生');
+INSERT INTO `c_statistic_config`(`id`, `business_type`, `value`, `status`, `remark`) VALUES ('4', 1004, 5, 1, '发生业务药师');
+INSERT INTO `c_statistic_config`(`id`, `business_type`, `value`, `status`, `remark`) VALUES ('5', 1005, 5, 1, '日新增药店趋势');
+INSERT INTO `c_statistic_config`(`id`, `business_type`, `value`, `status`, `remark`) VALUES ('6', 1006, 5, 1, '日处方趋势统计');
+INSERT INTO `c_statistic_config`(`id`, `business_type`, `value`, `status`, `remark`) VALUES ('7', 1007, 1, 1, '处方药销量Top');
+INSERT INTO `c_statistic_config`(`id`, `business_type`, `value`, `status`, `remark`) VALUES ('8', 1008, 5, 1, '药店处方量Top');
+INSERT INTO `c_statistic_config`(`id`, `business_type`, `value`, `status`, `remark`) VALUES ('9', 1009, 30, 1, '处方药销量Top数据量');

src/main/resources/config/application-dev.yml → src/main/resources/application-dev.yml


+ 20 - 0
src/main/resources/application-pre.yml

@@ -0,0 +1,20 @@
+spring:
+  datasource:
+    dynamic:
+      primary: mysql
+      datasource:
+        mysql:
+          driverClassName: com.mysql.cj.jdbc.Driver
+          url: jdbc:mysql://rm-2ze21c75m76csc3j3rw.mysql.rds.aliyuncs.com:3306/yideb2-ins?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowMultiQueries=true
+          username: yideb2pre
+          password: ZjevDZLSQ60Qz+wA8VrZRlhEy9/fnLf9+V0g2MM1scQZfKvqIXLZectSx1PZkUGAtAhEHDku1kkeAuP5/kQjTQ==
+          druid:
+            publicKey: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAK0WBrSv2hLSxcuAWwm1t/qoBxS6WzxRh243mHX1aehfPg6fbBMeuQW5xUPGGJCMT+SI6l73TcbpgtAM8KcQ56sCAwEAAQ==
+            filters: config,stat
+            connectProperties: config.decrypt=true;config.decrypt.key=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAK0WBrSv2hLSxcuAWwm1t/qoBxS6WzxRh243mHX1aehfPg6fbBMeuQW5xUPGGJCMT+SI6l73TcbpgtAM8KcQ56sCAwEAAQ==
+            validationQuery: "SELECT 1"
+        postgresql:
+          driverClassName: org.postgresql.Driver
+          url: jdbc:postgresql://140.207.240.244:54532/datahub?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowMultiQueries=true
+          username: datahubrole
+          password: "!myzh123"

+ 20 - 0
src/main/resources/application-prod.yml

@@ -0,0 +1,20 @@
+spring:
+  datasource:
+    dynamic:
+      primary: mysql
+      datasource:
+        mysql:
+          driverClassName: com.mysql.cj.jdbc.Driver
+          url: jdbc:mysql://rm-2ze59h2696m13a312rw.mysql.rds.aliyuncs.com:3306/yideb2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowMultiQueries=true
+          username: yideb_audit
+          password: LfvDUtaS9pZAu5aKHMbBGcGIkxfBbOtHhT10w0A38Cx5GOzM8Dwu46GGyvu/b51FcxpKtSFI7wMUftXxnCDfdw==
+          druid:
+            publicKey: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKHZaCjI1UjmA+LMETvl1eQW03TjG546C6tGWUGc59LwyYlx0f7zQBi5p18t3rM8G86kYaEr6/zjSTtuBVw4lmUCAwEAAQ==
+            filters: config,stat
+            connectProperties: config.decrypt=true;config.decrypt.key=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKHZaCjI1UjmA+LMETvl1eQW03TjG546C6tGWUGc59LwyYlx0f7zQBi5p18t3rM8G86kYaEr6/zjSTtuBVw4lmUCAwEAAQ==
+            validationQuery: "SELECT 1"
+        postgresql:
+          driverClassName: org.postgresql.Driver
+          url: jdbc:postgresql://10.66.206.63:54532/datahub?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowMultiQueries=true
+          username: datahubrole
+          password: "!myzh123"

+ 2 - 2
src/main/resources/config/application.yml

@@ -2,7 +2,7 @@ spring:
   application:
     name: audit-statistic
   profiles:
-    active: dev
+    active: @env@
 
 server:
   port: 3001
@@ -11,4 +11,4 @@ mybatis-plus:
   mapper-locations: classpath:mapper/*/*Mapper.xml
 
 logging:
-  config: classpath:config/logback.xml
+  config: classpath:logback.xml

+ 0 - 0
src/main/resources/config/application-pre.yml


+ 0 - 0
src/main/resources/config/application-prod.yml


src/main/resources/config/logback.xml → src/main/resources/logback.xml