Browse Source

项目配置

plf 4 years ago
parent
commit
ac0f6d1811

+ 177 - 0
pom.xml

@@ -0,0 +1,177 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.3.4.RELEASE</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>com.caimei365</groupId>
+    <artifactId>caimei-applets-visa-api</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <description>Demo project for Spring Boot</description>
+
+    <properties>
+        <java.version>1.8</java.version>
+        <!--maven.build.timestamp保存了maven编译时间戳-->
+        <timestamp>${maven.build.timestamp}</timestamp>
+        <!--指定时间格式-->
+        <maven.build.timestamp.format>yyyyMMdd-HHmmss</maven.build.timestamp.format>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-thymeleaf</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-webflux</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>2.1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-cache</artifactId>
+        </dependency>
+        <!-- redis依赖包 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>io.lettuce</groupId>
+                    <artifactId>lettuce-core</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>redis.clients</groupId>
+            <artifactId>jedis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+            <scope>runtime</scope>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.junit.vintage</groupId>
+                    <artifactId>junit-vintage-engine</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>io.projectreactor</groupId>
+            <artifactId>reactor-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>1.2.13</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.6</version>
+        </dependency>
+
+        <!--手机短信-->
+        <dependency>
+            <groupId>caimei</groupId>
+            <artifactId>smsClient</artifactId>
+            <version>1.0</version>
+        </dependency>
+
+    </dependencies>
+
+
+    <profiles>
+        <profile>
+            <id>dev</id>
+            <properties>
+                <!-- 环境标识,需要与配置文件的名称相对应 -->
+                <activatedProperties>dev</activatedProperties>
+            </properties>
+            <activation>
+                <!-- 默认环境 -->
+                <activeByDefault>true</activeByDefault>
+            </activation>
+        </profile>
+        <profile>
+            <id>beta</id>
+            <properties>
+                <activatedProperties>beta</activatedProperties>
+            </properties>
+        </profile>
+        <profile>
+            <id>prod</id>
+            <properties>
+                <activatedProperties>prod</activatedProperties>
+            </properties>
+        </profile>
+    </profiles>
+    <build>
+        <resources>
+            <!-- 配置文件路径  -->
+            <resource>
+                <!-- 这里对应项目存放配置文件的目录-->
+                <directory>src/main/resources</directory>
+                <!-- 开启filtering功能  -->
+                <filtering>true</filtering>
+            </resource>
+            <resource>
+                <directory>src/main/resources/config/${activatedProperties}</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <!-- springboot启动类目录 -->
+                    <mainClass>com.caimei365.Caimei365Application</mainClass>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <!-- 创建一个自动可执行的jar或war文件 -->
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 18 - 0
src/main/java/com/caimei365/Caimei365Application.java

@@ -0,0 +1,18 @@
+package com.caimei365;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2020/3/4
+ */
+@SpringBootApplication
+public class Caimei365Application {
+
+    public static void main(String[] args) {
+        SpringApplication.run(Caimei365Application.class, args);
+    }
+}

+ 81 - 0
src/main/java/com/caimei365/model/ResponseJson.java

@@ -0,0 +1,81 @@
+package com.caimei365.model;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 全局API返回值
+ *
+ * @author : Charles
+ * @date : 2021/3/4
+ */
+@Data
+public class ResponseJson<T> implements Serializable {
+    /** 状态码 */
+    private int code;
+    /** 提示信息 */
+    private String msg;
+    /** 返回的数据 */
+    private T data;
+
+    private ResponseJson() {}
+
+    private ResponseJson(int code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    private ResponseJson(int code, String msg, T data) {
+        this.code = code;
+        this.msg = msg;
+        this.data = data;
+    }
+
+    public static ResponseJson success() {
+        return new ResponseJson<>(0, "操作成功");
+    }
+
+    public static<T> ResponseJson<T> success(T data) {
+        return new ResponseJson<>(0, "操作成功", data);
+    }
+
+    public static<T> ResponseJson<T> success(String msg, T data) {
+        return new ResponseJson<>(0, msg, data);
+    }
+
+    public static<T> ResponseJson<T> success(int code, String msg, T data) {
+        return new ResponseJson<>(code, msg, data);
+    }
+
+    public static ResponseJson error() {
+        return new ResponseJson<>(-1, "操作失败");
+    }
+
+    public static ResponseJson error(String msg) {
+        return new ResponseJson<>(-1, msg);
+    }
+
+    public static ResponseJson error(int code, String msg) {
+        return new ResponseJson<>(code, msg);
+    }
+
+    public static<T> ResponseJson<T> error(T data) {
+        return new ResponseJson<>(-1, "操作失败", data);
+    }
+
+    public static<T> ResponseJson<T> error(String msg, T data) {
+        return new ResponseJson<>(-1, msg, data);
+    }
+
+    public static<T> ResponseJson<T> error(int code, String msg, T data) {
+        return new ResponseJson<>(code, msg, data);
+    }
+
+    @Override
+    public String toString() {
+        return "JsonModel{" + "code=" + code + ", msg='" + msg + '\'' + ", data=" + data + '}';
+    }
+
+    private static final long serialVersionUID = 1L;
+}

+ 127 - 0
src/main/java/com/caimei365/service/HomePageService.java

@@ -0,0 +1,127 @@
+/*
+package com.caimei365.service;
+
+import com.caimei.module.base.entity.bo.JsonModel;
+import com.caimei.module.base.entity.bo.PageVo;
+
+*/
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2020/3/20
+ *//*
+
+public interface HomePageService {
+    */
+/**
+     * 医美机构正品联盟
+     *//*
+
+    JsonModel getMember(PageVo pageVo);
+
+    */
+/**
+     * 售后无忧,购物须知
+     *//*
+
+    JsonModel afterSale();
+
+    */
+/**
+     * 获取模块数据
+     *//*
+
+    JsonModel getModules(Integer userId);
+
+    JsonModel productsClassify(Integer classifyId, Integer userId, PageVo page);
+
+    */
+/**
+     * 首页推荐专区
+     *//*
+
+    JsonModel getRecommendProducts(Integer identity);
+
+
+    */
+/**
+     * 新版首页数据
+     *//*
+
+    JsonModel getHomeData(Integer userId, Integer source);
+
+
+    */
+/**
+     * 首页直播/文章/活动置顶数据
+     *
+     * @param source
+     * @return
+     *//*
+
+    JsonModel getTopData(Integer source);
+
+
+    */
+/**
+     * 首页轮播图列表
+     *
+     * @return
+     *//*
+
+    JsonModel getHomeBanners();
+
+    */
+/**
+     * 楼层详情
+     *
+     * @param floorId 楼层id
+     * @param source  来源 : 1 网站 ; 2 小程序
+     * @return
+     *//*
+
+    JsonModel floorContentDetails(Integer floorId, Integer source, Integer userId);
+
+    */
+/**
+     * 产品,仪器数据
+     *
+     * @param pageId 页面信息id
+     * @param userId 用户id
+     * @param source 来源 : 1 网站 ; 2 小程序
+     * @return
+     *//*
+
+    JsonModel instrumentData(Integer pageId, Integer userId, Integer source);
+
+    */
+/**
+     * 页面信息商品楼层
+     *
+     * @param centreId 页面信息楼层id
+     * @param source   来源
+     * @param userId
+     * @return
+     *//*
+
+    JsonModel pageFloorDetails(Integer centreId, Integer source, Integer userId);
+
+    */
+/**
+     * 产品仪器热搜词
+     *
+     * @return
+     *//*
+
+    JsonModel hotSearchTerms();
+
+    */
+/**
+     * 直播宣传图
+     * @return
+     *//*
+
+    JsonModel getLiveAdvertisingImage();
+}
+*/

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

@@ -0,0 +1,14 @@
+server:
+  port: 8010
+spring:
+  application:
+    # 指定服务名
+    name: caimei365-visa
+  profiles:
+    active: @activatedProperties@
+
+#整合mybatis
+mybatis:
+  #加载Mybatis映射文件
+  mapper-locations:
+    - classpath:mapper/*.xml

+ 64 - 0
src/main/resources/config/beta/application-beta.yml

@@ -0,0 +1,64 @@
+spring:
+  #数据源连接--start
+  datasource:
+    url: jdbc:mysql://10.104.59.165:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+    username: developer
+    password: 05bZ/OxTB:X+yd%1
+    # Hikari will use the above plus the following to setup connection pooling
+    type: com.zaxxer.hikari.HikariDataSource
+    hikari:
+      minimum-idle: 5
+      maximum-pool-size: 15
+      auto-commit: true
+      idle-timeout: 30000
+      pool-name: DatebookHikariCP
+      max-lifetime: 1800000
+      connection-timeout: 30000
+      connection-test-query: SELECT 1
+  #数据源连接--end
+
+  redis:
+    host: 10.104.50.235
+    port: 6379
+    #password: 6#xsI%b4o@5c3RoE
+    #Redis数据库索引(默认为0)
+    database: 0
+    #连接池最大连接数(使用负值表示没有限制)
+    jedis:
+      pool:
+        max-active: 50
+        #连接池最大阻塞等待时间(使用负值表示没有限制)
+        max-wait: 3000
+        #连接池中的最大空闲连接
+        max-idle: 20
+        #连接池中的最小空闲连接
+        min-idle: 2
+    #连接超时时间(毫秒)
+    timeout: 5000
+
+#上传文件大小
+  servlet:
+    multipart:
+      max-file-size: 10MB
+      max-request-size: 100MB
+
+#日志配置
+logging:
+  file:
+    path: /mnt/newdatadrive/data/runtime/tomcat-instance/spi/logs
+  level:
+    root: info
+
+# swagger文档显示配置
+swagger:
+  enable: false
+
+#DFS配置
+fdfs:
+  so-timeout: 5000 #上传的超时时间
+  connect-timeout: 2000 #连接超时时间
+  thumb-image:             #缩略图生成参数
+    width: 150
+    height: 150
+  tracker-list:            #TrackerList参数,支持多个
+  - 10.104.50.235:22122

+ 66 - 0
src/main/resources/config/dev/application-dev.yml

@@ -0,0 +1,66 @@
+spring:
+  #数据源连接--start
+  datasource:
+    #driverClassName: com.mysql.jdbc.Driver
+    url: jdbc:mysql://192.168.2.100:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+    username: developer
+    password: 05bZ/OxTB:X+yd%1
+    type: com.zaxxer.hikari.HikariDataSource
+    hikari:
+      minimum-idle: 5
+      maximum-pool-size: 15
+      auto-commit: true
+      idle-timeout: 30000
+      pool-name: DatebookHikariCP
+      max-lifetime: 1800000
+      connection-timeout: 30000
+      connection-test-query: SELECT 1
+  #数据源连接--end
+
+
+  redis:
+    host: 119.29.0.46
+    port: 6380
+    password: 6#xsI%b4o@5c3RoE
+    #Redis数据库索引(默认为0)
+    database: 0
+    #连接池最大连接数(使用负值表示没有限制)
+    jedis:
+      pool:
+        max-active: 50
+        #连接池最大阻塞等待时间(使用负值表示没有限制)
+        max-wait: -1
+        #连接池中的最大空闲连接
+        max-idle: 20
+        #连接池中的最小空闲连接
+        min-idle: 2
+    #连接超时时间(毫秒)
+    timeout: 5000
+
+  #上传文件大小
+  servlet:
+    multipart:
+      max-file-size: 10MB
+      max-request-size: 100MB
+
+#日志配置
+logging:
+  level:
+    root: info
+    com.caimei.mapper: debug
+    com.caimei.module.product.dao: debug
+
+# swagger文档显示配置
+swagger:
+  enable: true
+
+
+#DFS配置
+fdfs:
+  so-timeout: 5000 #上传的超时时间
+  connect-timeout: 2000 #连接超时时间
+  thumb-image:             #缩略图生成参数
+    width: 150
+    height: 150
+  tracker-list:            #TrackerList参数,支持多个
+  - 119.29.0.46:22122

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

@@ -0,0 +1,65 @@
+spring:
+  #数据源连接--start
+  datasource:
+    url: jdbc:mysql://rm-wz928s8btl7kxil44.mysql.rds.aliyuncs.com:3306/caimei?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
+    username: coder
+    password: diKtPYZ%wToI&9#L
+    # Hikari will use the above plus the following to setup connection pooling
+    type: com.zaxxer.hikari.HikariDataSource
+    hikari:
+      minimum-idle: 5
+      maximum-pool-size: 15
+      auto-commit: true
+      idle-timeout: 30000
+      pool-name: DatebookHikariCP
+      max-lifetime: 1800000
+      connection-timeout: 30000
+      connection-test-query: SELECT 1
+  #数据源连接--end
+
+  redis:
+    host: 172.31.165.23
+    port: 6379
+    #password: 6#xsI%b4o@5c3RoE
+    #Redis数据库索引(默认为0)
+    database: 0
+    #连接池最大连接数(使用负值表示没有限制)
+    jedis:
+      pool:
+        max-active: 50
+        #连接池最大阻塞等待时间(使用负值表示没有限制)
+        max-wait: 3000
+        #连接池中的最大空闲连接
+        max-idle: 20
+        #连接池中的最小空闲连接
+        min-idle: 2
+    #连接超时时间(毫秒)
+    timeout: 5000
+
+  #上传文件大小
+  servlet:
+    multipart:
+      max-file-size: 10MB
+      max-request-size: 100MB
+
+#日志配置
+logging:
+  file:
+    path: /mnt/newdatadrive/data/runtime/jar-instance/spi/logs
+  level:
+    root: info
+
+# swagger文档显示配置
+swagger:
+  enable: false
+
+#DFS配置
+fdfs:
+  so-timeout: 5000 #上传的超时时间
+  connect-timeout: 2000 #连接超时时间
+  thumb-image:             #缩略图生成参数
+    width: 150
+    height: 150
+  tracker-list:            #TrackerList参数,支持多个
+  - 172.31.165.24:22122
+