diff --git a/.idea/encodings.xml b/.idea/encodings.xml index 9a0c7f6..2255955 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -6,6 +6,8 @@ + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 6f5230a..42e3abe 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -7,7 +7,5 @@ - - - + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/bwie-common/src/main/java/com/bwie/common/config/Abc.java b/bwie-common/src/main/java/com/bwie/common/config/Abc.java deleted file mode 100644 index 1e317ea..0000000 --- a/bwie-common/src/main/java/com/bwie/common/config/Abc.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.bwie.common.config; - -public class Abc { -} diff --git a/bwie-modules/bwie-team/pom.xml b/bwie-modules/bwie-team/pom.xml new file mode 100644 index 0000000..6d402d8 --- /dev/null +++ b/bwie-modules/bwie-team/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + com.bwie + bwie-modules + 1.0.0 + + + bwie-team + + + 17 + 17 + UTF-8 + + + + + com.bwie + bwie-common + + + + org.springframework.boot + spring-boot-starter-web + + + + + com.alibaba + druid-spring-boot-starter + 1.2.8 + + + + mysql + mysql-connector-java + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.2.2 + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + 1.4.1 + + + + org.springframework.boot + spring-boot-starter-test + test + + + diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/controller/TeamController.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/controller/TeamController.java new file mode 100644 index 0000000..2e3eefb --- /dev/null +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/controller/TeamController.java @@ -0,0 +1,4 @@ +package com.bwie.team.controller; + +public class TeamController { +} diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/mapper/TeamMapper.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/mapper/TeamMapper.java new file mode 100644 index 0000000..a9b6ee7 --- /dev/null +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/mapper/TeamMapper.java @@ -0,0 +1,4 @@ +package com.bwie.team.mapper; + +public interface TeamMapper { +} diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamService.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamService.java new file mode 100644 index 0000000..d5a2f93 --- /dev/null +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamService.java @@ -0,0 +1,9 @@ +package com.bwie.team.service; + +public interface TeamService { +// 查询商品信息 + + + + +} diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamServiceImpl.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamServiceImpl.java new file mode 100644 index 0000000..69f1979 --- /dev/null +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamServiceImpl.java @@ -0,0 +1,4 @@ +package com.bwie.team.service; + +public class TeamServiceImpl { +} diff --git a/bwie-modules/bwie-team/src/main/resources/bootstrap.yml b/bwie-modules/bwie-team/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..12fa2a2 --- /dev/null +++ b/bwie-modules/bwie-team/src/main/resources/bootstrap.yml @@ -0,0 +1,30 @@ +# Tomcat +server: + port: 9004 +# Spring +spring: + main: + allow-circular-references: true + allow-bean-definition-overriding: true + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 + application: + # 应用名称 + name: bwie-team + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 124.221.177.197:8848 + config: + # 配置中心地址 + server-addr: 124.221.177.197:8848 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} diff --git a/bwie-modules/bwie-team/src/main/resources/mapper/TeamMapper.xml b/bwie-modules/bwie-team/src/main/resources/mapper/TeamMapper.xml new file mode 100644 index 0000000..187f42b --- /dev/null +++ b/bwie-modules/bwie-team/src/main/resources/mapper/TeamMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/bwie-modules/bwie-xxl/pom.xml b/bwie-modules/bwie-xxl/pom.xml new file mode 100644 index 0000000..7b1d590 --- /dev/null +++ b/bwie-modules/bwie-xxl/pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + + com.bwie + bwie-modules + 1.0.0 + + + bwie-xxl + + + 17 + 17 + UTF-8 + + + + + com.bwie + bwie-common + + + + org.springframework.boot + spring-boot-starter-web + + + + + com.alibaba + druid-spring-boot-starter + 1.2.8 + + + + mysql + mysql-connector-java + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.2.2 + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + 1.4.1 + + + + org.springframework.boot + spring-boot-starter-test + test + + + + com.xuxueli + xxl-job-core + 2.4.0 + + + diff --git a/bwie-modules/bwie-xxl/src/main/java/com/bwie/xxl/XxlApp.java b/bwie-modules/bwie-xxl/src/main/java/com/bwie/xxl/XxlApp.java new file mode 100644 index 0000000..f10a1e4 --- /dev/null +++ b/bwie-modules/bwie-xxl/src/main/java/com/bwie/xxl/XxlApp.java @@ -0,0 +1,15 @@ +package com.bwie.xxl; + +import org.mybatis.spring.annotation.MapperScan; +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 +public class XxlApp { + public static void main(String[] args) { + SpringApplication.run(XxlApp.class); + } +} diff --git a/bwie-modules/bwie-xxl/src/main/java/com/bwie/xxl/job/Test.java b/bwie-modules/bwie-xxl/src/main/java/com/bwie/xxl/job/Test.java new file mode 100644 index 0000000..e41337c --- /dev/null +++ b/bwie-modules/bwie-xxl/src/main/java/com/bwie/xxl/job/Test.java @@ -0,0 +1,28 @@ +package com.bwie.xxl.job; + +import com.xxl.job.core.context.XxlJobHelper; +import com.xxl.job.core.handler.annotation.XxlJob; +import org.springframework.stereotype.Component; + +@Component +public class Test { + + @XxlJob("aaa") + /** + * 2、分片广播任务 + */ + public void shardingJobHandler() throws Exception { + // 分片参数 + int shardIndex = XxlJobHelper.getShardIndex(); + int shardTotal = XxlJobHelper.getShardTotal(); + XxlJobHelper.log("分片参数:当前分片序号 = {}, 总分片数 = {}", shardIndex, shardTotal); + // 业务逻辑 + for (int i = 0; i < shardTotal; i++) { + if (i == shardIndex) { + XxlJobHelper.log("第 {} 片, 命中分片开始处理", i); + } else { + XxlJobHelper.log("第 {} 片, 忽略", i); + } + } + } +} diff --git a/bwie-modules/bwie-xxl/src/main/java/com/bwie/xxl/util/XxlJobConfig.java b/bwie-modules/bwie-xxl/src/main/java/com/bwie/xxl/util/XxlJobConfig.java new file mode 100644 index 0000000..d19aab3 --- /dev/null +++ b/bwie-modules/bwie-xxl/src/main/java/com/bwie/xxl/util/XxlJobConfig.java @@ -0,0 +1,79 @@ +package com.bwie.xxl.util; + +//import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; +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; + +/** + * xxl-job config + * + * @author xuxueli 2017-04-28 + */ +@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/bwie-modules/bwie-xxl/src/main/resources/bootstrap.yml b/bwie-modules/bwie-xxl/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..b00e223 --- /dev/null +++ b/bwie-modules/bwie-xxl/src/main/resources/bootstrap.yml @@ -0,0 +1,53 @@ +# Tomcat +server: + port: 9003 +# Spring +spring: + main: + allow-circular-references: true + allow-bean-definition-overriding: true + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 + application: + # 应用名称 + name: bwie-xxl + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 124.221.30.134:8848 + config: + # 配置中心地址 + server-addr: 124.221.30.134:8848 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + +#开发dev环境 +xxl: + job: + admin: + #xxlJob访问地址 + addresses: http://127.0.0.1:8081/xxl-job-admin + #xxlJob访问令牌(在xxlJob配置文件中自行设置的) + accessToken: jia + executor: + # 执行器注册 [选填]:优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。从而更灵活的支持容器类型执行器动态IP和动态映射端口问题。 + address: '' + # 执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册 + appname: ueana + # 执行器IP [选填]:默认为空表示自动获取IP,多网卡时可手动设置指定IP,该IP不会绑定Host仅作为通讯实用;地址信息用于 "执行器注册" 和 "调度中心请求并触发任务"; + ip: '' + # 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999,单机部署多个执行器时,注意要配置不同执行器端口; + port: 9999 + # 执行器运行日志文件存储磁盘路径 [选填] :需要对该路径拥有读写权限;为空则使用默认路径; + logpath: /data/applogs/xxl-job/jobhandler + # 执行器日志文件保存天数 [选填] : 过期日志自动清理, 限制值大于等于3时生效; 否则, 如-1, 关闭自动清理功能; + logretentiondays: 30 + diff --git a/bwie-modules/pom.xml b/bwie-modules/pom.xml index 85f7853..9a18ffa 100644 --- a/bwie-modules/pom.xml +++ b/bwie-modules/pom.xml @@ -13,7 +13,8 @@ pom bwie-system - bwie-kill + bwie-xxl + bwie-team