Skip to content

Commit

Permalink
fix: fix statistic config
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardShan committed Sep 12, 2019
1 parent c2b1aae commit f5cbd49
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 76 deletions.
66 changes: 0 additions & 66 deletions bin/patch/beta.sql

This file was deleted.

6 changes: 3 additions & 3 deletions config/application.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ spring:
domainName: # domainName 指 企业邮箱后缀,如企业邮箱为:[email protected], 这里值为 '@example.com'

screenshot:
default_browser: PHANTOMJS #PHANTOMJS CHROME
default_browser: PHANTOMJS # PHANTOMJS or CHROME
timeout_second: 600
phantomjs_path: $your_phantomjs_path$
chromedriver_path: $your_chromedriver_path$
Expand All @@ -132,8 +132,8 @@ data-auth-center:
base-url:
auth-code:

buried_points:
statistic_open: true
statistic:
enable: true
# You can use external elasticsearch storage [127.0.0.1:9300], default davinci datasouce
elastic_urls:
elastic_index_prefix:
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public ResponseEntity login(@Valid @RequestBody UserLogin userLogin, @ApiIgnore
}

UserLoginResult userLoginResult = new UserLoginResult(user);
String statistic_open = environment.getProperty("buried_points.statistic_open");
String statistic_open = environment.getProperty("statistic.enable");
if("true".equalsIgnoreCase(statistic_open)){
userLoginResult.setStatisticOpen(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ public class ElasticConfigration {

@PostConstruct
public void initialize() throws Exception {
String statistic_open = environment.getProperty("buried_points.statistic_open");
String statistic_open = environment.getProperty("statistic.enable");
if(StringUtils.isBlank(statistic_open) || "false".equalsIgnoreCase(statistic_open)){
return;
}

String elastic_urls = environment.getProperty("buried_points.elastic_urls");
String elastic_urls = environment.getProperty("statistic.elastic_urls");
if(StringUtils.isBlank(elastic_urls)){
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ public class BuriedPointsServiceImpl implements BuriedPointsService {

boolean statisticOpen = false; //是否开启埋点统计

@Value("${buried_points.elastic_index_prefix:''}")
@Value("${statistic.elastic_index_prefix:''}")
private String elasticIndexPrefix;

@PostConstruct
public void init(){
String statistic_open = environment.getProperty("buried_points.statistic_open");
String statistic_open = environment.getProperty("statistic.enable");
if("true".equalsIgnoreCase(statistic_open)){
this.statisticOpen = true;
}
Expand All @@ -58,7 +58,7 @@ public void init(){
@Override
public <T> void insert(List<T> infoList, Class clz){
if(statisticOpen){
String elastic_urls = environment.getProperty("buried_points.elastic_urls");
String elastic_urls = environment.getProperty("statistic.elastic_urls");
if(StringUtils.isBlank(elastic_urls) && !durl.equals(this.sqlUtils.getJdbcUrl())){
this.sqlUtils = this.sqlUtils.init(durl, username, password, null, false);
}
Expand All @@ -68,7 +68,7 @@ public <T> void insert(List<T> infoList, Class clz){

String tableName = getTableName4Info(clz);

String elastic_urls = environment.getProperty("buried_points.elastic_urls");
String elastic_urls = environment.getProperty("statistic.elastic_urls");
if(StringUtils.isNotBlank(elastic_urls)){
String index = StringUtils.isBlank(elasticIndexPrefix) ? tableName : elasticIndexPrefix + "_" + tableName;
elasticOperationService.batchInsert(index, index, infoList);
Expand Down

0 comments on commit f5cbd49

Please sign in to comment.