Browse Source

新增adv广告服务

master
wxz 5 years ago
parent
commit
244da82c19
  1. 16
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-client/pom.xml
  2. 11
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/Dockerfile
  3. 18
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-dev.yml
  4. 18
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-prod.yml
  5. 18
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-test.yml
  6. 224
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/pom.xml
  7. 15
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/AdvApplication.java
  8. 40
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/aspect/RequestLogAspect.java
  9. 26
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/config/ModuleConfigImpl.java
  10. 28
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/controller/AdvVedioController.java
  11. 33
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/dao/AdvVedioDao.java
  12. 56
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/entity/AdvVedioEntity.java
  13. 7
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/AdvVedioService.java
  14. 18
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/impl/AdvVedioServiceImpl.java
  15. 147
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/bootstrap.yml
  16. 18
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/db/migration/V0.0.1__createAdvVedio.sql
  17. 169
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/logback-spring.xml
  18. 35
      epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/mapper/AdvVedioDao.xml
  19. 15
      epmet-openapi/epmet-openapi-adv/pom.xml
  20. 3
      epmet-openapi/pom.xml

16
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-client/pom.xml

@ -0,0 +1,16 @@
<?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">
<parent>
<artifactId>epmet-openapi</artifactId>
<groupId>com.epmet</groupId>
<version>2.0.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>epmet-openapi-adv-client</artifactId>
</project>

11
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/Dockerfile

@ -0,0 +1,11 @@
FROM java:8
RUN export LANG="zh_CN.UTF-8"
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' > /etc/timezone
COPY ./target/*.jar ./epmet-openapi-adv.jar
EXPOSE 8115
ENTRYPOINT ["sh", "-c", "exec $RUN_INSTRUCT"]

18
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-dev.yml

@ -0,0 +1,18 @@
version: "3.7"
services:
epmet-openapi-adv-server:
container_name: epmet-openapi-adv-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-adv-server:version_placeholder
ports:
- "8015:8015"
network_mode: host # 不会创建新的网络
volumes:
- "/opt/epmet-cloud-logs/dev:/logs"
environment:
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./epmet-openapi-adv.jar"
restart: "unless-stopped"
deploy:
resources:
limits:
cpus: '0.1'
memory: 300M

18
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-prod.yml

@ -0,0 +1,18 @@
version: "3.7"
services:
epmet-openapi-adv-server:
container_name: epmet-openapi-adv-server-prod
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-adv-server:0.3.1
ports:
- "8015:8015"
network_mode: host # 不会创建新的网络
volumes:
- "/opt/epmet-cloud-logs/prod:/logs"
environment:
RUN_INSTRUCT: "java -Xms256m -Xmx512m -jar ./epmet-openapi-adv.jar"
restart: "unless-stopped"
deploy:
resources:
limits:
cpus: '0.1'
memory: 600M

18
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-test.yml

@ -0,0 +1,18 @@
version: "3.7"
services:
epmet-openapi-adv-server:
container_name: epmet-openapi-adv-server-test
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-adv-server:version_placeholder
ports:
- "8015:8015"
network_mode: host # 不会创建新的网络
volumes:
- "/opt/epmet-cloud-logs/test:/logs"
environment:
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./epmet-openapi-adv.jar"
restart: "unless-stopped"
deploy:
resources:
limits:
cpus: '0.1'
memory: 300M

224
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/pom.xml

@ -0,0 +1,224 @@
<?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">
<parent>
<artifactId>epmet-openapi</artifactId>
<groupId>com.epmet</groupId>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>epmet-openapi-adv-server</artifactId>
<dependencies>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-mybatis</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- 替换Feign原生httpclient -->
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
<version>10.3.0</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
</build>
<profiles>
<profile>
<id>dev</id>
<properties>
<server.port>8115</server.port>
<spring.profiles.active>dev</spring.profiles.active>
<!-- 数据库配置-->
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://192.168.1.130:3306/epmet_adv?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epmet_adv_user</spring.datasource.druid.username>
<spring.datasource.druid.password>EpmEt-db-UsEr</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>192.168.1.130</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>192.168.1.130:8848</nacos.server-addr>
<nacos.discovery.namespace>6ceab336-d004-4acf-89c6-e121d06f4988</nacos.discovery.namespace>
<nacos.config.namespace></nacos.config.namespace>
<nacos.config.group></nacos.config.group>
<nacos.config-enabled>false</nacos.config-enabled>
<nacos.ip/>
<spring.flyway.enabled>false</spring.flyway.enabled>
<!--钉钉 机器人地址-->
<dingTalk.robot.webHook>
https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19
</dingTalk.robot.secret>
</properties>
</profile>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<server.port>8115</server.port>
<spring.profiles.active>local</spring.profiles.active>
<!-- 数据库配置-->
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://118.190.150.119:47306/epmet_adv?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epmet_adv_user</spring.datasource.druid.username>
<spring.datasource.druid.password>EpmEt-db-UsEr</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>118.190.150.119</spring.redis.host>
<spring.redis.port>47379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>false</nacos.register-enabled>
<nacos.server-addr>192.168.1.130:8848</nacos.server-addr>
<nacos.discovery.namespace>6ceab336-d004-4acf-89c6-e121d06f4988</nacos.discovery.namespace>
<nacos.config.namespace></nacos.config.namespace>
<nacos.config.group></nacos.config.group>
<nacos.config-enabled>false</nacos.config-enabled>
<nacos.ip/>
<spring.flyway.enabled>false</spring.flyway.enabled>
<!--钉钉 机器人地址-->
<dingTalk.robot.webHook>
https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19
</dingTalk.robot.secret>
<openapi.scan.server.url>https://epmet-dev.elinkservice.cn/api/epmetscan/api</openapi.scan.server.url>
</properties>
</profile>
<profile>
<id>test</id>
<!-- <activation>
<activeByDefault>true</activeByDefault>
</activation>-->
<properties>
<server.port>8115</server.port>
<spring.profiles.active>test</spring.profiles.active>
<!-- 数据库配置-->
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_adv?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epmet</spring.datasource.druid.username>
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>EpmEtrEdIs!q@w</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>192.168.10.150:8848</nacos.server-addr>
<nacos.discovery.namespace>67e3c350-533e-4d7c-9f8f-faf1b4aa82ae</nacos.discovery.namespace>
<nacos.config.namespace></nacos.config.namespace>
<nacos.config.group></nacos.config.group>
<nacos.config-enabled>false</nacos.config-enabled>
<nacos.ip/>
<spring.flyway.enabled>true</spring.flyway.enabled>
<!--测试钉钉 机器人地址-->
<dingTalk.robot.webHook>
https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19
</dingTalk.robot.secret>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<server.port>8115</server.port>
<spring.profiles.active>prod</spring.profiles.active>
<!-- 数据库配置-->
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://rm-m5e3vzs2637224wj9.mysql.rds.aliyuncs.com:3306/epmet_adv?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epmet_adv_user</spring.datasource.druid.username>
<spring.datasource.druid.password>EpmEt-db-UsEr</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>EpmEtclOUdrEdIs!Q2w</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>192.168.11.180:8848</nacos.server-addr>
<nacos.discovery.namespace>bd205d23-e696-47be-b995-916313f86e99</nacos.discovery.namespace>
<nacos.config.namespace></nacos.config.namespace>
<nacos.config.group></nacos.config.group>
<nacos.config-enabled>false</nacos.config-enabled>
<nacos.ip/>
<spring.flyway.enabled>true</spring.flyway.enabled>
<!--生产钉钉 机器人地址-->
<dingTalk.robot.webHook>
https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1
</dingTalk.robot.secret>
</properties>
</profile>
</profiles>
</project>

15
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/AdvApplication.java

@ -0,0 +1,15 @@
package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class AdvApplication {
public static void main(String[] args) {
SpringApplication.run(AdvApplication.class, args);
}
}

40
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/aspect/RequestLogAspect.java

@ -0,0 +1,40 @@
package com.epmet.adv.aspect;
import com.epmet.commons.tools.aspect.BaseRequestLogAspect;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
* 日志/异常处理切面实现调用父类方法完成日志记录和异常处理
*/
@Aspect
@Component
@Order(0)
public class RequestLogAspect extends BaseRequestLogAspect {
@Override
@Around(value = "execution(* com.epmet.adv.controller.*Controller*.*(..)) ")
public Object proceed(ProceedingJoinPoint point) throws Throwable {
return super.proceed(point, getRequest());
}
/**
* 获取Request对象
*
* @return
*/
private HttpServletRequest getRequest() {
RequestAttributes ra = RequestContextHolder.getRequestAttributes();
ServletRequestAttributes sra = (ServletRequestAttributes) ra;
return sra.getRequest();
}
}

26
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/config/ModuleConfigImpl.java

@ -0,0 +1,26 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.adv.config;
import com.epmet.commons.tools.config.ModuleConfig;
import org.springframework.stereotype.Service;
/**
* 模块配置信息
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Service
public class ModuleConfigImpl implements ModuleConfig {
@Override
public String getName() {
return "adv";
}
}

28
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/controller/AdvVedioController.java

@ -0,0 +1,28 @@
package com.epmet.adv.controller;
import com.epmet.adv.entity.AdvVedioEntity;
import com.epmet.adv.service.AdvVedioService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
@Controller
@RequestMapping("vedio")
public class AdvVedioController {
@Autowired
private AdvVedioService advVedioService;
@GetMapping("company-adv")
public String toVedio() throws IOException {
AdvVedioEntity enableAdvVedioEntity = advVedioService.getEnableAdvVedioEntity();
String redirectUrl = enableAdvVedioEntity != null ? enableAdvVedioEntity.getPath() : "404";
return String.format("redirect:%s", redirectUrl);
//response.sendRedirect("www.baidu.com");
}
}

33
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/dao/AdvVedioDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.adv.dao;
import com.epmet.adv.entity.AdvVedioEntity;
import com.epmet.commons.mybatis.dao.BaseDao;
import org.apache.ibatis.annotations.Mapper;
/**
* 宣传视频
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-12-30
*/
@Mapper
public interface AdvVedioDao extends BaseDao<AdvVedioEntity> {
AdvVedioEntity getEnableAdvVedioEntity();
}

56
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/entity/AdvVedioEntity.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.adv.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 宣传视频
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-12-30
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("adv_vedio")
public class AdvVedioEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 存储路径
*/
private String path;
/**
* 存储类型aliyun_oss,local
*/
private String storeType;
/**
* 是否启用
*/
private Integer enable;
}

7
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/AdvVedioService.java

@ -0,0 +1,7 @@
package com.epmet.adv.service;
import com.epmet.adv.entity.AdvVedioEntity;
public interface AdvVedioService {
AdvVedioEntity getEnableAdvVedioEntity();
}

18
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/impl/AdvVedioServiceImpl.java

@ -0,0 +1,18 @@
package com.epmet.adv.service.impl;
import com.epmet.adv.dao.AdvVedioDao;
import com.epmet.adv.entity.AdvVedioEntity;
import com.epmet.adv.service.AdvVedioService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AdvVedioServiceImpl implements AdvVedioService {
@Autowired
private AdvVedioDao advVedioDao;
public AdvVedioEntity getEnableAdvVedioEntity() {
return advVedioDao.getEnableAdvVedioEntity();
}
}

147
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/bootstrap.yml

@ -0,0 +1,147 @@
server:
port: @server.port@
servlet:
context-path: /adv
spring:
main:
allow-bean-definition-overriding: true
application:
name: epmet-openapi-adv-server
#环境 dev|test|prod
profiles:
active: @spring.profiles.active@
messages:
encoding: UTF-8
basename: i18n/messages_common
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
redis:
database: @spring.redis.index@
host: @spring.redis.host@
port: @spring.redis.port@
password: @spring.redis.password@
timeout: 30s
datasource:
druid:
#MySQL
driver-class-name: com.mysql.cj.jdbc.Driver
url: @spring.datasource.druid.url@
username: @spring.datasource.druid.username@
password: @spring.datasource.druid.password@
initial-size: 10
max-active: 100
min-idle: 10
max-wait: 60000
pool-prepared-statements: true
max-pool-prepared-statement-per-connection-size: 20
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
#Oracle需要打开注释
#validation-query: SELECT 1 FROM DUAL
test-while-idle: true
test-on-borrow: false
test-on-return: false
filter:
stat:
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: false
wall:
config:
multi-statement-allow: true
# 数据迁移工具flyway
flyway:
enabled: @spring.flyway.enabled@
locations: classpath:db/migration
url: @spring.datasource.druid.url@
user: @spring.datasource.druid.username@
password: @spring.datasource.druid.password@
baseline-on-migrate: true
baseline-version: 0
cloud:
nacos:
discovery:
server-addr: @nacos.server-addr@
#nacos的命名空间ID,默认是public
namespace: @nacos.discovery.namespace@
#不把自己注册到注册中心的地址
register-enabled: @nacos.register-enabled@
ip: @nacos.ip@
config:
enabled: @nacos.config-enabled@
server-addr: @nacos.server-addr@
namespace: @nacos.config.namespace@
group: @nacos.config.group@
file-extension: yaml
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
mybatis-plus:
mapper-locations: classpath:/mapper/**/*.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.epmet.entity
global-config:
#数据库相关配置
db-config:
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
id-type: ID_WORKER
#字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断"
field-strategy: NOT_NULL
#驼峰下划线转换
column-underline: true
banner: false
#原生配置
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
feign:
hystrix:
enabled: true
client:
config:
default:
loggerLevel: BASIC
httpclient:
enabled: true
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 60000 #缺省为1000
ribbon:
ReadTimeout: 300000
ConnectTimeout: 300000
#pageHelper分页插件
pagehelper:
helper-dialect: mysql
reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1
openapi:
scan:
server:
url: @openapi.scan.server.url@
method:
imgSyncScan: /imgSyncScan
textSyncScan: /textSyncScan
dingTalk:
robot:
webHook: @dingTalk.robot.webHook@
secret: @dingTalk.robot.secret@

18
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/db/migration/V0.0.1__createAdvVedio.sql

@ -0,0 +1,18 @@
-- create database epmet_adv default character set utf8mb4;
-- CREATE USER epmet_adv_user@'%' IDENTIFIED BY 'EpmEt-db-UsEr';
-- GRANT ALL ON `epmet_adv%`.* TO 'epmet_adv_user'@'%';
-- flush privileges;
CREATE TABLE `adv_vedio` (
`ID` varchar(64) NOT NULL COMMENT 'id' primary key ,
`PATH` varchar(255) NOT NULL COMMENT '存储路径',
`STORE_TYPE` varchar(30) NOT NULL COMMENT '存储类型。aliyun_oss,local',
`ENABLE` tinyint(1) NOT NULL COMMENT '是否启用',
`REVISION` int(11) DEFAULT NULL COMMENT '乐观锁',
`DEL_FLAG` int(11) unsigned DEFAULT NULL COMMENT '删除标识 0:未删除 1:删除',
`CREATED_BY` varchar(32) DEFAULT NULL COMMENT '创建者',
`CREATED_TIME` datetime DEFAULT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新者',
`UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宣传视频'

169
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/logback-spring.xml

@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<property name="log.path" value="logs/adv"/>
<springProperty scope="context" name="appname" source="spring.application.name"/>
<springProperty scope="context" name="webHook" source="dingTalk.robot.webHook"/>
<springProperty scope="context" name="secret" source="dingTalk.robot.secret"/>
<!-- 日志上下文名称 -->
<contextName>${appname}</contextName>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!--1. 输出到控制台-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>debug</level>
</filter>
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<!-- 设置字符集 -->
<charset>UTF-8</charset>
</encoder>
</appender>
<!--2. 输出到文档-->
<!-- 2.1 level为 DEBUG 日志,时间滚动输出 -->
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/debug.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志归档 -->
<fileNamePattern>${log.path}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 2.2 level为 INFO 日志,时间滚动输出 -->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/info.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 每天日志归档路径以及格式 -->
<fileNamePattern>${log.path}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 2.3 level为 WARN 日志,时间滚动输出 -->
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/warn.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录warn级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 2.4 level为 ERROR 日志,时间滚动输出 -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/error.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录ERROR级别的 发送钉钉短信 -->
<filter class="com.epmet.commons.tools.filter.LogMsgSendFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
<webHook>${webHook}</webHook>
<secret>${secret}</secret>
<appName>${appname}</appName>
</filter>
</appender>
<!-- 开发、测试环境 -->
<springProfile name="dev,test">
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/>
<logger name="com.epmet.dao" level="DEBUG"/>
<root level="INFO">
<appender-ref ref="DEBUG_FILE"/>
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</root>
</springProfile>
<!-- 生产环境 -->
<springProfile name="prod">
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="DEBUG_FILE"/>
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</root>
</springProfile>
</configuration>

35
epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/mapper/AdvVedioDao.xml

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.adv.dao.AdvVedioDao">
<resultMap type="com.epmet.adv.entity.AdvVedioEntity" id="entityMap">
<result property="id" column="ID"/>
<result property="path" column="PATH"/>
<result property="storeType" column="STORE_TYPE"/>
<result property="enable" column="ENABLE"/>
<result property="revision" column="REVISION"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="getEnableAdvVedioEntity" resultMap="entityMap">
select id,
path,
store_type,
enable,
revision,
del_flag,
created_by,
created_time,
updated_by,
updated_time
from adv_vedio
where ENABLE = 1
limit 1;
</select>
</mapper>

15
epmet-openapi/epmet-openapi-adv/pom.xml

@ -0,0 +1,15 @@
<?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">
<parent>
<artifactId>epmet-openapi</artifactId>
<groupId>com.epmet</groupId>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>epmet-openapi-adv</artifactId>
</project>

3
epmet-openapi/pom.xml

@ -13,6 +13,9 @@
<artifactId>epmet-openapi</artifactId>
<modules>
<module>epmet-openapi-scan</module>
<module>epmet-openapi-adv</module>
<module>epmet-openapi-adv/epmet-openapi-adv-client</module>
<module>epmet-openapi-adv/epmet-openapi-adv-server</module>
</modules>
</project>
Loading…
Cancel
Save