33 changed files with 1078 additions and 0 deletions
@ -0,0 +1,27 @@ |
|||
<?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>com.esua.epdc</groupId> |
|||
<artifactId>epdc-demo</artifactId> |
|||
<version>1.0.0</version> |
|||
</parent> |
|||
|
|||
<artifactId>epdc-content-security-client</artifactId> |
|||
<packaging>jar</packaging> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>com.esua.epdc</groupId> |
|||
<artifactId>epdc-commons-tools</artifactId> |
|||
<version>1.0.0</version> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
<build> |
|||
<finalName>${project.artifactId}</finalName> |
|||
</build> |
|||
|
|||
</project> |
@ -0,0 +1,37 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 用户 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
*/ |
|||
@Data |
|||
public class DemoDto implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -8056876497668990939L; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private Long id; |
|||
/** |
|||
* 用户名 |
|||
*/ |
|||
private String name; |
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private int age; |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.elink.esua.epdc.feign; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.DemoDto; |
|||
import com.elink.esua.epdc.feign.fallback.DemoFeignClientFallback; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author yujintao |
|||
* @email yujintao@elink-cn.com |
|||
* @date 2019/8/23 9:59 |
|||
*/ |
|||
@FeignClient(name = ServiceConstant.EPDC_DEMO_SERVER, fallback = DemoFeignClientFallback.class, contextId = "DemoFeignClient") |
|||
public interface DemoFeignClient { |
|||
|
|||
/** |
|||
* 查询全部 |
|||
* |
|||
* @param |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.DemoDto>> |
|||
* @author yujintao |
|||
* @date 2019/8/23 10:07 |
|||
*/ |
|||
@GetMapping("demo/demo/list") |
|||
Result<List<DemoDto>> listDemo(); |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.elink.esua.epdc.feign.fallback; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.DemoDto; |
|||
import com.elink.esua.epdc.feign.DemoFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* |
|||
* @author yujintao |
|||
* @email yujintao@elink-cn.com |
|||
* @date 2019/5/23 10:00 |
|||
*/ |
|||
@Component |
|||
public class DemoFeignClientFallback implements DemoFeignClient { |
|||
|
|||
@Override |
|||
public Result<List<DemoDto>> listDemo() { |
|||
return new Result().error("fail"); |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
# 基础镜像 |
|||
FROM openjdk:8u242-jdk-buster |
|||
# 作者 |
|||
MAINTAINER rongchao@elink-cn.com |
|||
# 对应pom.xml文件中的dockerfile-maven-plugin插件JAR_FILE的值 |
|||
ARG JAR_FILE |
|||
# 对应pom.xml文件中的dockerfile-maven-plugin插件JAR_NAME的值 |
|||
ARG JAR_NAME |
|||
# 对应pom.xml文件中的dockerfile-maven-plugin插件SERVER_PORT的值 |
|||
ARG SERVER_PORT |
|||
# 复制打包完成后的jar文件到/opt目录下 |
|||
ENV JAR_PATH /mnt/epdc/${JAR_NAME}.jar |
|||
ADD ${JAR_FILE} $JAR_PATH |
|||
# /data设为环境变量 |
|||
ENV DATAPATH /data |
|||
# 挂载/data目录到主机 |
|||
VOLUME $DATAPATH |
|||
# 启动容器时执行 |
|||
ENTRYPOINT java -jar $JAR_CONFIG $JAR_PATH |
|||
EXPOSE ${SERVER_PORT} |
@ -0,0 +1,266 @@ |
|||
<?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>epdc-content-security</artifactId> |
|||
<groupId>com.esua.epdc</groupId> |
|||
<version>1.0.0</version> |
|||
</parent> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<artifactId>epdc-content-security-server</artifactId> |
|||
<packaging>jar</packaging> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>com.esua.epdc</groupId> |
|||
<artifactId>epdc-content-security-client</artifactId> |
|||
<version>1.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.esua.epdc</groupId> |
|||
<artifactId>epdc-commons-tools</artifactId> |
|||
<version>1.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.esua.epdc</groupId> |
|||
<artifactId>epdc-commons-mybatis</artifactId> |
|||
<version>1.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>com.alibaba.cloud</groupId> |
|||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>de.codecentric</groupId> |
|||
<artifactId>spring-boot-admin-starter-client</artifactId> |
|||
<version>${spring.boot.admin.version}</version> |
|||
</dependency> |
|||
<!-- 替换Feign原生httpclient --> |
|||
<dependency> |
|||
<groupId>io.github.openfeign</groupId> |
|||
<artifactId>feign-httpclient</artifactId> |
|||
<version>10.3.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.esua.epdc</groupId> |
|||
<artifactId>epdc-commons-tools-wx-ma</artifactId> |
|||
<version>${project.version}</version> |
|||
</dependency> |
|||
<!--<dependency> |
|||
<groupId>com.alibaba.cloud</groupId> |
|||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> |
|||
</dependency>--> |
|||
<!--版本控制--> |
|||
<dependency> |
|||
<groupId>com.esua.epdc</groupId> |
|||
<artifactId>epdc-commons-api-version-control</artifactId> |
|||
<version>${project.version}</version> |
|||
</dependency> |
|||
<!--RocketMQ--> |
|||
<dependency> |
|||
<groupId>org.apache.rocketmq</groupId> |
|||
<artifactId>rocketmq-spring-boot-starter</artifactId> |
|||
<version>2.0.3</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> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-deploy-plugin</artifactId> |
|||
<configuration> |
|||
<skip>true</skip> |
|||
</configuration> |
|||
</plugin> |
|||
<plugin> |
|||
<groupId>com.spotify</groupId> |
|||
<artifactId>dockerfile-maven-plugin</artifactId> |
|||
</plugin> |
|||
</plugins> |
|||
|
|||
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory> |
|||
|
|||
<resources> |
|||
<resource> |
|||
<filtering>true</filtering> |
|||
<directory>${basedir}/src/main/resources</directory> |
|||
<includes> |
|||
<include>**/application*.yml</include> |
|||
<include>**/*.properties</include> |
|||
<include>logback-spring.xml</include> |
|||
<include>registry.conf</include> |
|||
</includes> |
|||
</resource> |
|||
<resource> |
|||
<directory>${basedir}/src/main/resources</directory> |
|||
<excludes> |
|||
<exclude>**/application*.yml</exclude> |
|||
<exclude>**/*.properties</exclude> |
|||
<exclude>logback-spring.xml</exclude> |
|||
<exclude>registry.conf</exclude> |
|||
</excludes> |
|||
</resource> |
|||
</resources> |
|||
</build> |
|||
|
|||
|
|||
<profiles> |
|||
<profile> |
|||
<id>dev</id> |
|||
<activation> |
|||
<activeByDefault>true</activeByDefault> |
|||
</activation> |
|||
<properties> |
|||
<spring.profiles.active>dev</spring.profiles.active> |
|||
<docker.tag>dev</docker.tag> |
|||
|
|||
<server.port>9088</server.port> |
|||
|
|||
<spring.redis.index>2</spring.redis.index> |
|||
<spring.redis.host>47.104.224.45</spring.redis.host> |
|||
<spring.redis.port>6379</spring.redis.port> |
|||
<spring.redis.password>elink@888</spring.redis.password> |
|||
|
|||
<spring.datasource.druid.url> |
|||
<![CDATA[jdbc:mysql://118.190.232.100:3308/esua_epdc_events?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
|||
</spring.datasource.druid.url> |
|||
<spring.datasource.druid.username>epdc</spring.datasource.druid.username> |
|||
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password> |
|||
|
|||
<nacos.register-enabled>false</nacos.register-enabled> |
|||
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr> |
|||
<nacos.ip></nacos.ip> |
|||
<nacos.namespace>6a3577b4-7b79-43f6-aebb-9c3f31263f6a</nacos.namespace> |
|||
|
|||
<!--小程序配置--> |
|||
<wx.ma.appId>wxdd8530c5f4926766</wx.ma.appId> |
|||
<wx.ma.secret>5bf4fb813145431b3493a10aa7e041e9</wx.ma.secret> |
|||
<!--工作端小程序--> |
|||
<work.wx.ma.appId>wx29b074840ef4bfd9</work.wx.ma.appId> |
|||
<work.wx.ma.secret>4adb1afccc69f205cdf5b521d74e2aca</work.wx.ma.secret> |
|||
<!--数据分析端小程序--> |
|||
<analysis.wx.ma.appId>wx9b6102a8ee5add65</analysis.wx.ma.appId> |
|||
<analysis.wx.ma.secret>394f47d4e08fc0fd629231d3f68a34dc</analysis.wx.ma.secret> |
|||
<!--RocketMQ--> |
|||
<rocketmq.name.server>47.104.85.99:9876;114.215.125.123:9876</rocketmq.name.server> |
|||
<rocketmq.consumer.group>organizationGroup</rocketmq.consumer.group> |
|||
<rocketmq.producer.category.group>categoryGroup</rocketmq.producer.category.group> |
|||
<rocketmq.consumer.category.group>categoryGroup</rocketmq.consumer.category.group> |
|||
</properties> |
|||
</profile> |
|||
|
|||
<profile> |
|||
<id>test</id> |
|||
<properties> |
|||
<spring.profiles.active>test</spring.profiles.active> |
|||
<docker.tag>test</docker.tag> |
|||
|
|||
<server.port>9088</server.port> |
|||
|
|||
<spring.redis.index>2</spring.redis.index> |
|||
<spring.redis.host>118.190.232.100</spring.redis.host> |
|||
<spring.redis.port>9603</spring.redis.port> |
|||
<spring.redis.password>epdc!redis@master1405</spring.redis.password> |
|||
|
|||
<spring.datasource.druid.url> |
|||
<![CDATA[jdbc:mysql://118.190.232.100:3308/esua_epdc_events?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
|||
</spring.datasource.druid.url> |
|||
<spring.datasource.druid.username>epdc</spring.datasource.druid.username> |
|||
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password> |
|||
|
|||
<nacos.register-enabled>true</nacos.register-enabled> |
|||
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr> |
|||
<nacos.ip>118.190.232.100</nacos.ip> |
|||
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace> |
|||
|
|||
<!--亿联小程序配置--> |
|||
<!-- <wx.ma.appId>wxdd8530c5f4926766</wx.ma.appId>--> |
|||
<!-- <wx.ma.secret>5bf4fb813145431b3493a10aa7e041e9</wx.ma.secret>--> |
|||
|
|||
<!--先锋市北小程序配置--> |
|||
<wx.ma.appId>wx5d3e97461d248397</wx.ma.appId> |
|||
<wx.ma.secret>bfed51b731e53db9affb9e6131e7ae12</wx.ma.secret> |
|||
<!--工作端小程序--> |
|||
<work.wx.ma.appId>wx9f20a46906ab2c3e</work.wx.ma.appId> |
|||
<work.wx.ma.secret>dc13065f79429979d9f687d249eb5c4e</work.wx.ma.secret> |
|||
<!--数据分析端小程序--> |
|||
<analysis.wx.ma.appId>wx9b6102a8ee5add65</analysis.wx.ma.appId> |
|||
<analysis.wx.ma.secret>394f47d4e08fc0fd629231d3f68a34dc</analysis.wx.ma.secret> |
|||
<!--RocketMQ--> |
|||
<rocketmq.name.server>47.104.85.99:9876;114.215.125.123:9876</rocketmq.name.server> |
|||
<rocketmq.consumer.group>organizationGroup</rocketmq.consumer.group> |
|||
<rocketmq.producer.category.group>categoryGroup</rocketmq.producer.category.group> |
|||
<rocketmq.consumer.category.group>categoryGroup</rocketmq.consumer.category.group> |
|||
</properties> |
|||
</profile> |
|||
|
|||
<profile> |
|||
<id>prod</id> |
|||
<properties> |
|||
<spring.profiles.active>prod</spring.profiles.active> |
|||
<docker.tag>prod</docker.tag> |
|||
|
|||
<server.port>9088</server.port> |
|||
|
|||
<!-- redis配置 --> |
|||
<spring.redis.index>0</spring.redis.index> |
|||
<spring.redis.host>172.16.0.54</spring.redis.host> |
|||
<spring.redis.port>6379</spring.redis.port> |
|||
<spring.redis.password>Elink833066</spring.redis.password> |
|||
|
|||
<spring.datasource.druid.url> |
|||
<![CDATA[jdbc:mysql://rm-m5e8z9h4z06z60n8h5o.mysql.rds.aliyuncs.com:3306/esua_epdc_events?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
|||
</spring.datasource.druid.url> |
|||
<spring.datasource.druid.username>epdc</spring.datasource.druid.username> |
|||
<spring.datasource.druid.password>Elink@833066</spring.datasource.druid.password> |
|||
<!-- nacos --> |
|||
<nacos.register-enabled>true</nacos.register-enabled> |
|||
<nacos.server-addr>172.16.0.52:8848</nacos.server-addr> |
|||
<nacos.ip></nacos.ip> |
|||
<nacos.namespace></nacos.namespace> |
|||
|
|||
<!--党群e家小程序配置--> |
|||
<wx.ma.appId>wxdd8530c5f4926766</wx.ma.appId> |
|||
<wx.ma.secret>5bf4fb813145431b3493a10aa7e041e9</wx.ma.secret> |
|||
<!--先锋市北小程序配置--> |
|||
<!-- <wx.ma.appId>wx5d3e97461d248397</wx.ma.appId>--> |
|||
<!-- <wx.ma.secret>bfed51b731e53db9affb9e6131e7ae12</wx.ma.secret>--> |
|||
<!--工作端小程序--> |
|||
<work.wx.ma.appId>wx9f20a46906ab2c3e</work.wx.ma.appId> |
|||
<work.wx.ma.secret>dc13065f79429979d9f687d249eb5c4e</work.wx.ma.secret> |
|||
<!--数据分析端小程序--> |
|||
<analysis.wx.ma.appId>wx9b6102a8ee5add65</analysis.wx.ma.appId> |
|||
<analysis.wx.ma.secret>394f47d4e08fc0fd629231d3f68a34dc</analysis.wx.ma.secret> |
|||
<!--RocketMQ--> |
|||
<rocketmq.name.server>172.16.0.52:9876;172.16.0.54:9876</rocketmq.name.server> |
|||
<rocketmq.consumer.group>organizationGroup</rocketmq.consumer.group> |
|||
<rocketmq.producer.category.group>categoryGroup</rocketmq.producer.category.group> |
|||
<rocketmq.consumer.category.group>categoryGroup</rocketmq.consumer.category.group> |
|||
</properties> |
|||
</profile> |
|||
</profiles> |
|||
|
|||
</project> |
@ -0,0 +1,31 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.elink.esua.epdc; |
|||
|
|||
import org.springframework.boot.SpringApplication; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
|||
import org.springframework.cloud.openfeign.EnableFeignClients; |
|||
|
|||
/** |
|||
* 模块 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@SpringBootApplication |
|||
@EnableDiscoveryClient |
|||
@EnableFeignClients |
|||
public class ContentSecurityApplication { |
|||
|
|||
public static void main(String[] args) { |
|||
SpringApplication.run(ContentSecurityApplication.class, args); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.config; |
|||
|
|||
import com.elink.esua.epdc.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 "demo"; |
|||
} |
|||
} |
@ -0,0 +1,48 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.DemoDto; |
|||
import com.elink.esua.epdc.service.DemoService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 测试接口 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("demo") |
|||
public class DemoController { |
|||
|
|||
@Autowired |
|||
private DemoService demoService; |
|||
|
|||
/** |
|||
* 忽略Token验证测试 |
|||
* |
|||
* @return |
|||
*/ |
|||
@GetMapping("seata") |
|||
public Result<String> seata(String name, int age) { |
|||
return demoService.createDemo(name, age); |
|||
} |
|||
|
|||
@GetMapping("list") |
|||
public Result<List<DemoDto>> listDemo(){ |
|||
return demoService.demoService(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.entity.DemoEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 用户 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
*/ |
|||
@Mapper |
|||
public interface DemoDao extends BaseDao<DemoEntity> { |
|||
} |
@ -0,0 +1,40 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 用户 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
*/ |
|||
@Data |
|||
@TableName("demo") |
|||
public class DemoEntity implements Serializable { |
|||
private static final long serialVersionUID = 8109944892257584088L; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
@TableId |
|||
private String id; |
|||
/** |
|||
* 用户名 |
|||
*/ |
|||
private String name; |
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private int age; |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.elink.esua.epdc.entity; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* |
|||
* @author yujintao |
|||
* @email yujintao@elink-cn.com |
|||
* @date 2019/9/2 13:54 |
|||
*/ |
|||
@Data |
|||
public class TransforDemoEntity { |
|||
|
|||
private Long demoId; |
|||
|
|||
private String demoName; |
|||
|
|||
private int demoAge; |
|||
} |
@ -0,0 +1,24 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.exception; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.exception.ErrorCode; |
|||
|
|||
/** |
|||
* 模块错误编码,由9位数字组成,前6位为模块编码,后3位为业务编码 |
|||
* <p> |
|||
* 如:100001001(100001代表模块,001代表业务代码) |
|||
* </p> |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
public interface ModuleErrorCode extends ErrorCode { |
|||
|
|||
} |
@ -0,0 +1,36 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.service; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.DemoDto; |
|||
import com.elink.esua.epdc.entity.DemoEntity; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 用户 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
*/ |
|||
public interface DemoService extends BaseService<DemoEntity> { |
|||
|
|||
Result<String> createDemo(String name, int age); |
|||
|
|||
/** |
|||
* 查询全部 |
|||
* |
|||
* @param |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.DemoDto>> |
|||
* @author yujintao |
|||
* @date 2019/8/23 10:05 |
|||
*/ |
|||
Result<List<DemoDto>> demoService(); |
|||
} |
@ -0,0 +1,43 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dao.DemoDao; |
|||
import com.elink.esua.epdc.dto.DemoDto; |
|||
import com.elink.esua.epdc.entity.DemoEntity; |
|||
import com.elink.esua.epdc.service.DemoService; |
|||
import io.seata.spring.annotation.GlobalTransactional; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class DemoServiceImpl extends BaseServiceImpl<DemoDao, DemoEntity> implements DemoService { |
|||
|
|||
@Override |
|||
public Result<String> createDemo(String name, int age) { |
|||
DemoEntity entity = new DemoEntity(); |
|||
entity.setName(name); |
|||
entity.setAge(age); |
|||
baseDao.insert(entity); |
|||
return new Result<String>().ok("demo执行完毕"); |
|||
} |
|||
|
|||
@Override |
|||
public Result<List<DemoDto>> demoService() { |
|||
QueryWrapper<DemoEntity> demoEntityWrapper = new QueryWrapper<>(); |
|||
List<DemoEntity> entityList = baseDao.selectList(demoEntityWrapper); |
|||
return new Result().ok(ConvertUtils.sourceToTarget(entityList, DemoDto.class)); |
|||
} |
|||
} |
@ -0,0 +1,21 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.utils; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.Constant; |
|||
|
|||
/** |
|||
* 模块常量 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.1.0 |
|||
*/ |
|||
public interface ModuleConstant extends Constant { |
|||
|
|||
} |
@ -0,0 +1,143 @@ |
|||
#server: |
|||
# port: @server.port@ |
|||
# servlet: |
|||
# context-path: /events |
|||
# |
|||
#nacos: |
|||
# config: |
|||
# server-addr: @nacos.server-addr@ |
|||
# type: YAML |
|||
# namespace: @nacos.config.namespace@ |
|||
# group: @nacos.config.group@ |
|||
# dataId: epdc-events-server |
|||
# bootstrap: |
|||
# enable: true |
|||
# log: |
|||
# enable: @nacos.config.bootstrap.log.enable@ |
|||
# |
|||
#spring: |
|||
# application: |
|||
# name: epdc-events-server |
|||
server: |
|||
port: @server.port@ |
|||
servlet: |
|||
context-path: /contentSecurity |
|||
|
|||
spring: |
|||
main: |
|||
allow-bean-definition-overriding: true |
|||
application: |
|||
name: epdc-content-security-server |
|||
# 环境 dev|test|prod |
|||
profiles: |
|||
active: @spring.profiles.active@ |
|||
messages: |
|||
encoding: UTF-8 |
|||
basename: i18n/messages,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@ |
|||
timeout: 30s |
|||
port: @spring.redis.port@ |
|||
password: @spring.redis.password@ |
|||
cloud: |
|||
nacos: |
|||
discovery: |
|||
server-addr: @nacos.server-addr@ |
|||
register-enabled: @nacos.register-enabled@ |
|||
ip: @nacos.ip@ |
|||
namespace: @nacos.namespace@ |
|||
alibaba: |
|||
seata: |
|||
tx-service-group: epdc-content-security-server-fescar-service-group |
|||
datasource: |
|||
druid: |
|||
driver-class-name: com.mysql.cj.jdbc.Driver |
|||
url: @spring.datasource.druid.url@ |
|||
username: @spring.datasource.druid.username@ |
|||
password: @spring.datasource.druid.password@ |
|||
|
|||
feign: |
|||
hystrix: |
|||
enabled: true |
|||
httpclient: |
|||
enabled: true |
|||
|
|||
hystrix: |
|||
command: |
|||
default: |
|||
execution: |
|||
isolation: |
|||
thread: |
|||
timeoutInMilliseconds: 60000 #缺省为1000 |
|||
|
|||
ribbon: |
|||
ReadTimeout: 300000 |
|||
ConnectTimeout: 300000 |
|||
|
|||
management: |
|||
endpoints: |
|||
web: |
|||
exposure: |
|||
include: "*" |
|||
endpoint: |
|||
health: |
|||
show-details: ALWAYS |
|||
|
|||
mybatis-plus: |
|||
mapper-locations: classpath:/mapper/**/*.xml |
|||
#实体扫描,多个package用逗号或者分号分隔 |
|||
typeAliasesPackage: com.elink.esua.epdc.modules.*.entity |
|||
global-config: |
|||
#数据库相关配置 |
|||
db-config: |
|||
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; |
|||
id-type: UUID |
|||
#字段策略 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' |
|||
|
|||
wx: |
|||
ma: |
|||
configs: |
|||
- appid: @wx.ma.appId@ |
|||
secret: @wx.ma.secret@ |
|||
token: #微信小程序消息服务器配置的token |
|||
aesKey: #微信小程序消息服务器配置的EncodingAESKey |
|||
msgDataFormat: JSON |
|||
- appid: @work.wx.ma.appId@ |
|||
secret: @work.wx.ma.secret@ |
|||
token: #微信小程序消息服务器配置的token |
|||
aesKey: #微信小程序消息服务器配置的EncodingAESKey |
|||
msgDataFormat: JSON |
|||
- appid: @analysis.wx.ma.appId@ |
|||
secret: @analysis.wx.ma.secret@ |
|||
token: #微信小程序消息服务器配置的token |
|||
aesKey: #微信小程序消息服务器配置的EncodingAESKey |
|||
msgDataFormat: JSON |
|||
appId: |
|||
# 普通居民端的appId |
|||
normal: @wx.ma.appId@ |
|||
# 工作端的appId |
|||
work: @work.wx.ma.appId@ |
|||
# 数据分析端的appId |
|||
analysis: @analysis.wx.ma.appId@ |
|||
|
|||
rocketmq: |
|||
name-server: @rocketmq.name.server@ |
|||
producer: |
|||
group: @rocketmq.producer.category.group@ |
|||
consumer: |
|||
group: @rocketmq.consumer.group@ |
|||
category-group: @rocketmq.consumer.category.group@ |
@ -0,0 +1,12 @@ |
|||
CREATE TABLE person ( |
|||
id int(11) NOT NULL AUTO_INCREMENT, |
|||
first varchar(100) NOT NULL, |
|||
last varchar(100) NOT NULL, |
|||
dateofbirth DATE DEFAULT null, |
|||
placeofbirth varchar(100) not null, |
|||
PRIMARY KEY (id) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|||
|
|||
insert into person (first,last,dateofbirth,placeofbirth) values('Dursun','KOC', STR_TO_DATE('02/10/1982', '%m/%d/%Y'),'Erzincan'); |
|||
|
|||
insert into person (first,last,dateofbirth,placeofbirth) values('Durseeun','KeeOC', STR_TO_DATE('05/10/1982', '%m/%d/%Y'),'Erzeeincan'); |
@ -0,0 +1 @@ |
|||
#Default |
@ -0,0 +1 @@ |
|||
#English |
@ -0,0 +1 @@ |
|||
#\u7B80\u4F53\u4E2D\u6587 |
@ -0,0 +1 @@ |
|||
#\u7E41\u4F53\u4E2D\u6587 |
@ -0,0 +1 @@ |
|||
#Default |
@ -0,0 +1 @@ |
|||
#English |
@ -0,0 +1 @@ |
|||
#\u7B80\u4F53\u4E2D\u6587 |
@ -0,0 +1 @@ |
|||
#\u7E41\u4F53\u4E2D\u6587 |
@ -0,0 +1,161 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<configuration> |
|||
<include resource="org/springframework/boot/logging/logback/base.xml"/> |
|||
|
|||
<property name="log.path" value="logs/contentSecurity"/> |
|||
|
|||
<!-- 彩色日志格式 --> |
|||
<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} [%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} [%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} [%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} [%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="ch.qos.logback.classic.filter.LevelFilter"> |
|||
<level>ERROR</level> |
|||
<onMatch>ACCEPT</onMatch> |
|||
<onMismatch>DENY</onMismatch> |
|||
</filter> |
|||
</appender> |
|||
|
|||
<!-- 开发、测试环境 --> |
|||
<springProfile name="dev,test"> |
|||
<logger name="org.springframework.web" level="INFO"/> |
|||
<logger name="org.springboot.sample" level="INFO"/> |
|||
<logger name="com.elink.esua.epdc" level="INFO"/> |
|||
<logger name="com.elink.esua.epdc.modules.*.dao" level="DEBUG"/> |
|||
<!--<logger name="com.elink.esua.epdc.modules.issue.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="ERROR"/> |
|||
<logger name="org.springboot.sample" level="ERROR"/> |
|||
<logger name="com.elink.esua.epdc" level="ERROR"/> |
|||
<root level="ERROR"> |
|||
<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> |
@ -0,0 +1,21 @@ |
|||
registry { |
|||
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa |
|||
type = "nacos" |
|||
|
|||
nacos { |
|||
serverAddr = "@nacos.server-addr@" |
|||
namespace = "@nacos.namespace@" |
|||
cluster = "default" |
|||
} |
|||
} |
|||
|
|||
config { |
|||
# file、nacos 、apollo、zk、consul、etcd3 |
|||
type = "nacos" |
|||
|
|||
nacos { |
|||
serverAddr = "@nacos.server-addr@" |
|||
namespace = "@nacos.namespace@" |
|||
cluster = "default" |
|||
} |
|||
} |
@ -0,0 +1,21 @@ |
|||
<?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>com.esua.epdc</groupId> |
|||
<artifactId>epdc-module</artifactId> |
|||
<version>1.0.0</version> |
|||
</parent> |
|||
|
|||
<groupId>com.esua.epdc</groupId> |
|||
<artifactId>epdc-content-security</artifactId> |
|||
<packaging>pom</packaging> |
|||
|
|||
<modules> |
|||
<module>epdc-content-security-client</module> |
|||
<module>epdc-content-security-server</module> |
|||
</modules> |
|||
|
|||
</project> |
Loading…
Reference in new issue