Commit 8dbbed01 authored by baixj's avatar baixj

add dubbo

parent e97190f5
......@@ -20,6 +20,10 @@
<poi.version>3.17</poi.version>
<jwt.version>0.9.0</jwt.version>
<mybatis.version>1.3.2</mybatis.version>
<dubbo.version>2.5.6</dubbo.version>
<zookeeper.version>3.4.7</zookeeper.version>
<zkclient.version>0.1</zkclient.version>
</properties>
<dependencies>
......@@ -162,6 +166,37 @@
<version>4.1.2</version>
</dependency>
<dependency>
<artifactId>cms-api</artifactId>
<groupId>com.lwby</groupId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.netty</groupId>
<artifactId>netty</artifactId>
</exclusion>
</exclusions>
<version>${dubbo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>${zookeeper.version}</version>
</dependency>
<dependency>
<groupId>com.github.sgroschupf</groupId>
<artifactId>zkclient</artifactId>
<version>${zkclient.version}</version>
</dependency>
</dependencies>
......
......@@ -2,6 +2,7 @@ package com.boot.security.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ImportResource;
/**
* 启动类
......@@ -10,6 +11,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
*
*/
@SpringBootApplication
@ImportResource({"classpath:/spring/applicationContext.xml", })
public class SecurityApplication {
public static void main(String[] args) {
......
package com.boot.security.server.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.boot.security.server.dao.AdvertDao;
import com.boot.security.server.model.AdvertiserData;
import com.boot.security.server.page.table.PageTableHandler;
import com.boot.security.server.page.table.PageTableRequest;
import com.boot.security.server.service.AdvertiserService;
import com.boot.security.server.service.impl.AdvertiserServiceImpl;
import com.boot.security.server.utils.UserUtil;
import com.lwby.api.facade.ITestFacade;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Iterator;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/advertiserController")
public class AdvertiserController {
@Resource
ITestFacade testFacade;
@Autowired
private AdvertiserService advertiserService;
@Autowired
......@@ -35,6 +36,7 @@ public class AdvertiserController {
JSONObject advertiserManagerData = advertiserService.getAdvertiserManagerData(request);
return advertiserManagerData.toJSONString();
}
//返回根据日期返回所有广告汇总数据
@PreAuthorize("hasAuthority('advert:data:count')")
@PostMapping("/advertCount")
......@@ -42,9 +44,9 @@ public class AdvertiserController {
@ResponseBody
public String getAdvertiserDataCount(@RequestBody PageTableRequest request) {
Long id = UserUtil.getLoginUser().getId();
List<AdvertiserData> advertDataList = advertDao.getAdvertData(request.getStartTime(), request.getEndTime(),id);
Integer count = advertDao.getAdvertDataCount(request.getStartTime(), request.getEndTime(),id);
return PageTableHandler.getJSONObject(advertDataList,count);
List<AdvertiserData> advertDataList = advertDao.getAdvertData(request.getStartTime(), request.getEndTime(), id);
Integer count = advertDao.getAdvertDataCount(request.getStartTime(), request.getEndTime(), id);
return PageTableHandler.getJSONObject(advertDataList, count);
}
//返回根据日期返回所有广告主数据
......@@ -70,6 +72,7 @@ public class AdvertiserController {
@ApiOperation(value = "同步cms广告主数据")
@ResponseBody
public void syncAdvertiserData() {
testFacade.test(1);
advertiserService.syncAdvertiserAndAdvert();
}
}
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://rm-2zeyw42052h06f905.mysql.rds.aliyuncs.com:3306/lwby_ad_data?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
username: readbi
password: OxmQkfpS2019
druid:
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1
testWhileIdle: true
testOnBorrow: true
testOnReturn: false
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
filters: stat,wall
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
stat-view-servlet:
allow: 127.0.0.1
jackson:
date-format: yyyy-MM-dd HH:mm:ss
joda-date-time-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
mvc:
servlet:
load-on-startup: 1
redis:
host: 172.17.255.212
port: 6379
timeout: 10s
lettuce:
pool:
min-idle: 0
max-idle: 8
max-active: 8
max-wait: -1ms
mail:
default-encoding: UTF-8
host: smtp.163.com
username:
password:
protocol: smtp
test-connection: false
# properties:
# mail.smtp.auth: true
mybatis:
type-aliases-package: com.boot.security.server.model
mapper-locations: classpath:/mybatis-mappers/*
configuration:
mapUnderscoreToCamelCase: true
files:
path: ${file-path:d:/files}
logging:
config: classpath:logback-admin.xml
log:
level:
root: info
my: debug
file: logs/admin-server.log
maxsize: 30MB
token:
expire:
seconds: 7200
jwtSecret: (XIAO:)_$^11244^%$_(WEI:)_@@++--(LAO:)_++++_.sds_(SHI:)
server:
port: 8089
dubbo:
protocol:
zookeeper: zookeeper://172.17.255.136:2181
\ No newline at end of file
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://rm-2zeyw42052h06f905.mysql.rds.aliyuncs.com:3306/lwby_ad_data?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
username: readbi
password: OxmQkfpS2019
druid:
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1
testWhileIdle: true
testOnBorrow: true
testOnReturn: false
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
filters: stat,wall
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
stat-view-servlet:
allow: 127.0.0.1
jackson:
date-format: yyyy-MM-dd HH:mm:ss
joda-date-time-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
mvc:
servlet:
load-on-startup: 1
redis:
host: 172.17.255.212
port: 6379
timeout: 10s
lettuce:
pool:
min-idle: 0
max-idle: 8
max-active: 8
max-wait: -1ms
mail:
default-encoding: UTF-8
host: smtp.163.com
username:
password:
protocol: smtp
test-connection: false
# properties:
# mail.smtp.auth: true
mybatis:
type-aliases-package: com.boot.security.server.model
mapper-locations: classpath:/mybatis-mappers/*
configuration:
mapUnderscoreToCamelCase: true
files:
path: ${file-path:d:/files}
logging:
config: classpath:logback-admin.xml
log:
level:
root: info
my: debug
file: logs/admin-server.log
maxsize: 30MB
token:
expire:
seconds: 7200
jwtSecret: (XIAO:)_$^11244^%$_(WEI:)_@@++--(LAO:)_++++_.sds_(SHI:)
server:
port: 8089
dubbo:
protocol:
zookeeper: zookeeper://172.17.173.226:2181?backup=172.17.173.225:2181,172.17.173.224:2181
\ No newline at end of file
-Dspring.profiles.active=prod
spring:
profiles:
active: dev
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://rm-2zeyw42052h06f905.mysql.rds.aliyuncs.com:3306/lwby_ad_data?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
......@@ -72,3 +76,9 @@ token:
jwtSecret: (XIAO:)_$^11244^%$_(WEI:)_@@++--(LAO:)_++++_.sds_(SHI:)
server:
port: 8089
dubbo:
protocol:
zookeeper: zookeeper://172.17.173.226:2181?backup=172.17.173.225:2181,172.17.173.224:2181
registry:
register: true
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
default-lazy-init="false"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<description><![CDATA[
This file imports all the application context resources you need.
For your own application you may not want to have all these features enabled.
You can either
* remove the unneeded components
* create a new file with the right components and configure this new file in
. web.xml
. main.java
. BaseTest.java
]]></description>
<!-- ensure that the above transactional advice runs for any execution
of an operation defined by the FooService interface -->
<!--<import resource="classpath:spring/applicationContext-config.xml"/>-->
<import resource="classpath:/cms-api-consumer.xml"/>
<import resource="classpath:/spring/dubbo-application.xml"/>
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- - Copyright 1999-2011 Alibaba Group. - - Licensed under the Apache License,
Version 2.0 (the "License"); - you may not use this file except in compliance
with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0
- - Unless required by applicable law or agreed to in writing, software -
distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the
License for the specific language governing permissions and - limitations
under the License. -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<!--消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
<dubbo:application name="${dubbo.application.name:lwby-ad-data}"/>
<dubbo:protocol name="dubbo" port="${dubbo.application.port:20879}" host="${dubbo.provider.host:}" />
<dubbo:provider group="${dubbo.registry.group:}" timeout="3000" />
<dubbo:registry protocol="zookeeper" register="${dubbo.registry.register:true}" address="${dubbo.protocol.zookeeper}" timeout="1200000"/>
<dubbo:consumer timeout="10000"/>
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- - Copyright 1999-2011 Alibaba Group. - - Licensed under the Apache License,
Version 2.0 (the "License"); - you may not use this file except in compliance
with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0
- - Unless required by applicable law or agreed to in writing, software -
distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the
License for the specific language governing permissions and - limitations
under the License. -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<!--<dubbo:service interface="com.lwby.api.facade.ITestFacade" version="1.0" ref="testFacade" />-->
</beans>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment