fix report
parent
cf8066ae5c
commit
24c49c8cfe
|
@ -17,6 +17,7 @@ import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
import com.ljsd.jieling.thread.task.DataReportTask;
|
||||||
import com.ljsd.jieling.thrift.idl.InvalidOperException;
|
import com.ljsd.jieling.thrift.idl.InvalidOperException;
|
||||||
import com.ljsd.jieling.thrift.idl.RPCRequestGMIFace;
|
import com.ljsd.jieling.thrift.idl.RPCRequestGMIFace;
|
||||||
import com.ljsd.jieling.thrift.idl.Result;
|
import com.ljsd.jieling.thrift.idl.Result;
|
||||||
|
@ -24,11 +25,13 @@ import com.ljsd.jieling.util.*;
|
||||||
import org.apache.thrift.TException;
|
import org.apache.thrift.TException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.data.redis.core.ZSetOperations;
|
import org.springframework.data.redis.core.ZSetOperations;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -44,6 +47,16 @@ public class GmService implements RPCRequestGMIFace.Iface {
|
||||||
GmInterface obj;
|
GmInterface obj;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
if(cmd.contains("restartthread")){
|
||||||
|
Field configurableApplicationContextField = GameApplication.class.getDeclaredField("configurableApplicationContext");
|
||||||
|
configurableApplicationContextField.setAccessible(true);
|
||||||
|
ConfigurableApplicationContext configurableApplicationContext =(ConfigurableApplicationContext) configurableApplicationContextField.get(GameApplication.class);
|
||||||
|
DataReportTask bean = configurableApplicationContext.getBean(DataReportTask.class);
|
||||||
|
bean.start();
|
||||||
|
result.setResultCode(1);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if(cmd.contains("hotfix")){
|
if(cmd.contains("hotfix")){
|
||||||
List<User> usersInDB = MongoUtil.getLjsdMongoTemplate().findAll("user", User.class);
|
List<User> usersInDB = MongoUtil.getLjsdMongoTemplate().findAll("user", User.class);
|
||||||
List<Integer> sendIds = new ArrayList<>(usersInDB.size());
|
List<Integer> sendIds = new ArrayList<>(usersInDB.size());
|
||||||
|
@ -70,6 +83,7 @@ public class GmService implements RPCRequestGMIFace.Iface {
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
result.setResultMsg("Cmd Illegal");
|
result.setResultMsg("Cmd Illegal");
|
||||||
|
ex.printStackTrace();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package com.ljsd.jieling.config.reportData;
|
package com.ljsd.jieling.config.reportData;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.google.gson.FieldAttributes;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
import com.ljsd.GameApplication;
|
import com.ljsd.GameApplication;
|
||||||
import com.ljsd.common.mogodb.util.BlockingUniqueQueue;
|
import com.ljsd.common.mogodb.util.BlockingUniqueQueue;
|
||||||
import com.ljsd.jieling.config.json.SDK37Constans;
|
import com.ljsd.jieling.config.json.SDK37Constans;
|
||||||
|
@ -40,46 +42,65 @@ public class DataMessageUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void manageData() {
|
public static void manageData() {
|
||||||
List<Object> sendDataList = new ArrayList<>(10);
|
try {
|
||||||
logQueue.drainTo(sendDataList, 10);
|
List<Object> sendDataList = new ArrayList<>(10);
|
||||||
|
logQueue.drainTo(sendDataList, 10);
|
||||||
|
|
||||||
List<Object> sendData37List = new ArrayList<>(10);
|
List<Object> sendData37List = new ArrayList<>(10);
|
||||||
logQueue_37.drainTo(sendData37List, 10);
|
logQueue_37.drainTo(sendData37List, 10);
|
||||||
|
|
||||||
if (!sendDataList.isEmpty()) {
|
if (!sendDataList.isEmpty()) {
|
||||||
KTSendBody sendBody = new KTSendBody(sendDataList);
|
class ExclusionStrategy implements com.google.gson.ExclusionStrategy{
|
||||||
HttpPool.sendPost(sendUrl, gson.toJson(sendBody));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sendData37List.isEmpty() && GameApplication.serverProperties.isSendlog37()) {
|
@Override
|
||||||
for (Object object : sendData37List) {
|
public boolean shouldSkipField(FieldAttributes fieldAttributes) {
|
||||||
String sendToUrl;
|
return "device_id_s".equals(fieldAttributes.getName()) && "ParamEnvironmentBean".equals(fieldAttributes.getDeclaringClass().getSimpleName());
|
||||||
List<BasicNameValuePair> sendForm = new ArrayList<>();
|
}
|
||||||
if (object instanceof Report37TaskBean) {
|
|
||||||
sendToUrl = sendTaskUrl37;
|
@Override
|
||||||
sendForm = ((Report37TaskBean) object).getPairList();
|
public boolean shouldSkipClass(Class<?> aClass) {
|
||||||
} else if (object instanceof Report37RoleLeveBean) {
|
return false;
|
||||||
sendToUrl = sendRoleUrl37;
|
}
|
||||||
sendForm = ((Report37RoleLeveBean) object).getPairList();
|
|
||||||
} else {
|
|
||||||
sendToUrl = "";
|
|
||||||
}
|
}
|
||||||
|
Gson gson = new GsonBuilder()
|
||||||
|
.setExclusionStrategies(new ExclusionStrategy()) // <---
|
||||||
|
.create();
|
||||||
|
KTSendBody sendBody = new KTSendBody(sendDataList);
|
||||||
|
HttpPool.sendPost(sendUrl, gson.toJson(sendBody));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sendData37List.isEmpty() && GameApplication.serverProperties.isSendlog37()) {
|
||||||
|
for (Object object : sendData37List) {
|
||||||
|
String sendToUrl;
|
||||||
|
List<BasicNameValuePair> sendForm = new ArrayList<>();
|
||||||
|
if (object instanceof Report37TaskBean) {
|
||||||
|
sendToUrl = sendTaskUrl37;
|
||||||
|
sendForm = ((Report37TaskBean) object).getPairList();
|
||||||
|
} else if (object instanceof Report37RoleLeveBean) {
|
||||||
|
sendToUrl = sendRoleUrl37;
|
||||||
|
sendForm = ((Report37RoleLeveBean) object).getPairList();
|
||||||
|
} else {
|
||||||
|
sendToUrl = "";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
HttpPool.sendPostForm(sendToUrl, new UrlEncodedFormEntity(sendForm, "utf-8"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sendDataList.isEmpty() && sendData37List.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
HttpPool.sendPostForm(sendToUrl, new UrlEncodedFormEntity(sendForm, "utf-8"));
|
Thread.sleep(10);
|
||||||
} catch (Exception e) {
|
return;
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sendDataList.isEmpty() && sendData37List.isEmpty()) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(10);
|
|
||||||
return;
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue