mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 20:06:51 +08:00
Merge branch 'master' of codeup.aliyun.com:6265f483e4166464dc2f9c14/boeu/baseservers
# Conflicts: # servers/boe-server-case/src/main/resources/application-pre.properties # servers/boe-server-case/src/main/resources/application-pro.properties
This commit is contained in:
@@ -23,11 +23,6 @@
|
|||||||
<artifactId>xboe-core</artifactId>
|
<artifactId>xboe-core</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.xboe</groupId>
|
|
||||||
<artifactId>xboe-module-event</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.boe</groupId>
|
<groupId>com.boe</groupId>
|
||||||
<artifactId>httpsdk</artifactId>
|
<artifactId>httpsdk</artifactId>
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package com.xboe.stat;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.xboe.core.SysConstant;
|
||||||
|
import com.xboe.core.api.TokenProxy;
|
||||||
|
import com.xboe.core.event.IEventDataSender;
|
||||||
|
import com.xboe.core.utils.OkHttpUtil;
|
||||||
|
import com.xboe.standard.BaseConstant;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件数据发送实现,如果是云环境,只需要修改此类的实现就可以了
|
||||||
|
* @author seastar
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class EventDataSender implements IEventDataSender{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OkHttpUtil okHttpUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HttpServletRequest request;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void send(String title, String eventKey, String content, String objId, String objType, String objInfo,
|
||||||
|
String aid, String aname,String author) {
|
||||||
|
String statBaseUrl=SysConstant.getConfigValue("xboe.stat.base.url");
|
||||||
|
if(StringUtils.isBlank(statBaseUrl)) {
|
||||||
|
log.error("发送事件失败:未配置【xboe.stat.base.url】的值");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String urlPre="/xboe/m/stat/event/send";
|
||||||
|
//案例同步不需要token
|
||||||
|
if(eventKey.equals("SyncCase")) {
|
||||||
|
urlPre ="/inner/stat/event/send";
|
||||||
|
}
|
||||||
|
|
||||||
|
final String url = statBaseUrl + urlPre;
|
||||||
|
Map<String, String> params = new HashMap<>();
|
||||||
|
params.put("title", title);
|
||||||
|
params.put("source", "all");
|
||||||
|
params.put("content", content);
|
||||||
|
params.put("objId", objId);
|
||||||
|
params.put("key", eventKey);
|
||||||
|
params.put("objType", objType);
|
||||||
|
params.put("objInfo", objInfo);
|
||||||
|
params.put("aid", aid);
|
||||||
|
params.put("aname", aname);
|
||||||
|
params.put("parameters","");
|
||||||
|
String token = TokenProxy.getToken(request);
|
||||||
|
//最后采用异常发送,不影响当前进程
|
||||||
|
|
||||||
|
new Thread(()->{
|
||||||
|
try {
|
||||||
|
ObjectMapper mapper=new ObjectMapper();
|
||||||
|
String json =mapper.writeValueAsString(params);
|
||||||
|
//String[] headers=new String[] {"token",token};
|
||||||
|
String[] headers=new String[] {BaseConstant.HTTP_ACCESS_TOKEN,token};
|
||||||
|
|
||||||
|
String responseStr = okHttpUtil.doPostJson(url, json,headers);
|
||||||
|
if(responseStr.indexOf("\"status\":200")==-1) {
|
||||||
|
log.error("发送事件失败:"+responseStr);
|
||||||
|
log.info("【发送的token】"+headers[0]+": "+headers[1]);
|
||||||
|
}
|
||||||
|
}catch(Exception e) {
|
||||||
|
log.error("发送事件错误",e);
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,6 +13,9 @@ logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
|||||||
## xboe config
|
## xboe config
|
||||||
xboe.api.cross_filter=true
|
xboe.api.cross_filter=true
|
||||||
|
|
||||||
|
## 案例同步发事件的接口
|
||||||
|
xboe.stat.base.url=http://127.0.0.1:9090
|
||||||
|
|
||||||
|
|
||||||
## 案例接口配置,init 是否需要初始化
|
## 案例接口配置,init 是否需要初始化
|
||||||
xboe.case.sync.init=true
|
xboe.case.sync.init=true
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ spring.redis.database=3
|
|||||||
spring.redis.host=10.251.129.122
|
spring.redis.host=10.251.129.122
|
||||||
spring.redis.password=qwert!W588
|
spring.redis.password=qwert!W588
|
||||||
spring.redis.port=6379
|
spring.redis.port=6379
|
||||||
|
|
||||||
## datasource config
|
## datasource config
|
||||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||||
@@ -29,6 +28,9 @@ xboe.upload.file.http_path=https://u.boe.com/upload
|
|||||||
xboe.externalinterface.url.system=http://127.0.0.1:9091
|
xboe.externalinterface.url.system=http://127.0.0.1:9091
|
||||||
xboe.old.base.url=https://u.boe.com
|
xboe.old.base.url=https://u.boe.com
|
||||||
|
|
||||||
|
## 案例同步发事件的接口
|
||||||
|
xboe.stat.base.url=https://u.boe.com/statApi
|
||||||
|
|
||||||
## 案例接口配置
|
## 案例接口配置
|
||||||
## 案例接口配置,init 是否需要初始化
|
## 案例接口配置,init 是否需要初始化
|
||||||
xboe.case.sync.init=false
|
xboe.case.sync.init=false
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ spring.redis.database=3
|
|||||||
spring.redis.host=10.251.129.122
|
spring.redis.host=10.251.129.122
|
||||||
spring.redis.password=qwert!W588
|
spring.redis.password=qwert!W588
|
||||||
spring.redis.port=6379
|
spring.redis.port=6379
|
||||||
|
|
||||||
## datasource config
|
## datasource config
|
||||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||||
@@ -29,6 +28,9 @@ xboe.upload.file.http_path=https://u.boe.com/upload
|
|||||||
xboe.externalinterface.url.system=http://127.0.0.1:9091
|
xboe.externalinterface.url.system=http://127.0.0.1:9091
|
||||||
xboe.old.base.url=https://u.boe.com
|
xboe.old.base.url=https://u.boe.com
|
||||||
|
|
||||||
|
## 案例同步发事件的接口
|
||||||
|
xboe.stat.base.url=https://u.boe.com/statApi
|
||||||
|
|
||||||
## 案例接口配置
|
## 案例接口配置
|
||||||
## 案例接口配置,init 是否需要初始化
|
## 案例接口配置,init 是否需要初始化
|
||||||
xboe.case.sync.init=false
|
xboe.case.sync.init=false
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ spring.datasource.password=ENC(MaC28GJw2JcbH8Lil0CrqSDTYxX49FJ0rxcmHH2pX0k=)
|
|||||||
## xboe config
|
## xboe config
|
||||||
xboe.api.cross_filter=true
|
xboe.api.cross_filter=true
|
||||||
|
|
||||||
|
## 案例同步发事件的接口
|
||||||
|
xboe.stat.base.url=https://u-pre.boe.com/statApi
|
||||||
|
|
||||||
|
|
||||||
## 案例接口配置
|
## 案例接口配置
|
||||||
## 案例接口配置,init 是否需要初始化
|
## 案例接口配置,init 是否需要初始化
|
||||||
|
|||||||
Reference in New Issue
Block a user