异常收集
This commit is contained in:
parent
9a452bea6b
commit
bb4ff95a3e
@ -40,14 +40,6 @@ public class ClientExceptionController extends AbstractController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SecurityComponent securityComponent;
|
private SecurityComponent securityComponent;
|
||||||
|
|
||||||
@ApiOperation(value = "新增客户端异常", notes = "新增客户端异常接口")
|
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
|
||||||
@PostMapping("saveclientexception")
|
|
||||||
@CheckRequestBodyAnnotation
|
|
||||||
public SuccessResult saveClientException(@RequestBody ClientExceptionVO clientExceptionVO) throws Exception {
|
|
||||||
return clientExceptionService.saveClientException(clientExceptionVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "删除客户端异常(id列表)", notes = "删除客户端异常(id列表)接口")
|
@ApiOperation(value = "删除客户端异常(id列表)", notes = "删除客户端异常(id列表)接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
@ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||||
|
@ -36,17 +36,6 @@ public class ClientExceptionAppController extends AbstractController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IClientExceptionService clientExceptionService;
|
private IClientExceptionService clientExceptionService;
|
||||||
|
|
||||||
@ApiOperation(value = "新增客户端异常", notes = "新增客户端异常接口")
|
|
||||||
@ApiImplicitParams({
|
|
||||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
|
||||||
})
|
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
|
||||||
@PostMapping("saveclientexception")
|
|
||||||
@CheckRequestBodyAnnotation
|
|
||||||
public SuccessResult saveClientException(@RequestHeader("token") String token, @RequestBody ClientExceptionVO clientExceptionVO) throws Exception {
|
|
||||||
return clientExceptionService.saveClientExceptionByToken(token, clientExceptionVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "删除客户端异常(id列表)", notes = "删除客户端异常(id列表)接口")
|
@ApiOperation(value = "删除客户端异常(id列表)", notes = "删除客户端异常(id列表)接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
@ -35,18 +35,7 @@ public class ClientExceptionResourceController extends AbstractController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IClientExceptionService clientExceptionService;
|
private IClientExceptionService clientExceptionService;
|
||||||
|
|
||||||
@ApiOperation(value = "新增客户端异常", notes = "新增客户端异常接口")
|
|
||||||
@ApiImplicitParams({
|
|
||||||
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query")
|
|
||||||
})
|
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
|
||||||
@PostMapping("saveclientexception")
|
|
||||||
@CheckRequestBodyAnnotation
|
|
||||||
public SuccessResult saveClientException(@RequestBody ClientExceptionVO clientExceptionVO) throws Exception {
|
|
||||||
return clientExceptionService.saveClientException(clientExceptionVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "删除客户端异常(id列表)", notes = "删除客户端异常(id列表)接口")
|
@ApiOperation(value = "删除客户端异常(id列表)", notes = "删除客户端异常(id列表)接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
|
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
|
||||||
|
@ -3,6 +3,7 @@ package com.cm.central.control.pojo.vos.clientexception;
|
|||||||
import com.cm.common.annotation.CheckNumberAnnotation;
|
import com.cm.common.annotation.CheckNumberAnnotation;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -22,25 +22,6 @@ import java.util.Map;
|
|||||||
**/
|
**/
|
||||||
public interface IClientExceptionService {
|
public interface IClientExceptionService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增客户端异常
|
|
||||||
*
|
|
||||||
* @param clientExceptionVO
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
SuccessResult saveClientException(ClientExceptionVO clientExceptionVO) throws Exception;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增客户端异常(APP)
|
|
||||||
*
|
|
||||||
* @param token
|
|
||||||
* @param clientExceptionVO
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
SuccessResult saveClientExceptionByToken(String token, ClientExceptionVO clientExceptionVO) throws Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增客户端异常
|
* 新增客户端异常
|
||||||
*
|
*
|
||||||
@ -50,16 +31,6 @@ public interface IClientExceptionService {
|
|||||||
*/
|
*/
|
||||||
String saveClientExceptionReturnId(ClientExceptionVO clientExceptionVO) throws Exception;
|
String saveClientExceptionReturnId(ClientExceptionVO clientExceptionVO) throws Exception;
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增客户端异常(APP)
|
|
||||||
*
|
|
||||||
* @param token
|
|
||||||
* @param clientExceptionVO
|
|
||||||
* @return clientExceptionId
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
String saveClientExceptionByTokenReturnId(String token, ClientExceptionVO clientExceptionVO) throws Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除客户端异常
|
* 删除客户端异常
|
||||||
*
|
*
|
||||||
|
@ -34,56 +34,12 @@ public class ClientExceptionServiceImpl extends AbstractService implements IClie
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IClientExceptionDao clientExceptionDao;
|
private IClientExceptionDao clientExceptionDao;
|
||||||
|
|
||||||
@Override
|
|
||||||
public SuccessResult saveClientException(ClientExceptionVO clientExceptionVO) throws Exception {
|
|
||||||
saveClientExceptionInfo(null, clientExceptionVO);
|
|
||||||
return new SuccessResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SuccessResult saveClientExceptionByToken(String token, ClientExceptionVO clientExceptionVO) throws Exception {
|
|
||||||
saveClientExceptionInfo(token, clientExceptionVO);
|
|
||||||
return new SuccessResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String saveClientExceptionReturnId(ClientExceptionVO clientExceptionVO) throws Exception {
|
public String saveClientExceptionReturnId(ClientExceptionVO clientExceptionVO) throws Exception {
|
||||||
return saveClientExceptionInfoReturnId(null, clientExceptionVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String saveClientExceptionByTokenReturnId(String token, ClientExceptionVO clientExceptionVO) throws Exception {
|
|
||||||
return saveClientExceptionInfoReturnId(token, clientExceptionVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增客户端异常
|
|
||||||
*
|
|
||||||
* @param token
|
|
||||||
* @param clientExceptionVO
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private void saveClientExceptionInfo(String token, ClientExceptionVO clientExceptionVO) throws Exception {
|
|
||||||
saveClientExceptionInfoReturnId(token, clientExceptionVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增客户端异常
|
|
||||||
*
|
|
||||||
* @param token
|
|
||||||
* @param clientExceptionVO
|
|
||||||
* @return clientExceptionId
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private String saveClientExceptionInfoReturnId(String token, ClientExceptionVO clientExceptionVO) throws Exception {
|
|
||||||
String clientExceptionId = UUIDUtil.getUUID();
|
String clientExceptionId = UUIDUtil.getUUID();
|
||||||
Map<String, Object> params = HashMapUtil.beanToMap(clientExceptionVO);
|
Map<String, Object> params = HashMapUtil.beanToMap(clientExceptionVO);
|
||||||
params.put("clientExceptionId", clientExceptionId);
|
params.put("clientExceptionId", clientExceptionId);
|
||||||
if (token != null) {
|
setSaveInfoByUserId(params, "1");
|
||||||
setSaveInfo(token, params);
|
|
||||||
} else {
|
|
||||||
setSaveInfo(params);
|
|
||||||
}
|
|
||||||
clientExceptionDao.saveClientException(params);
|
clientExceptionDao.saveClientException(params);
|
||||||
return clientExceptionId;
|
return clientExceptionId;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
package com.cm.central.control.service.socket.exception;
|
package com.cm.central.control.service.socket.exception;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.cm.central.control.manager.SocketServerManager;
|
||||||
|
import com.cm.central.control.pojo.bos.SocketClientBO;
|
||||||
|
import com.cm.central.control.pojo.vos.clientexception.ClientExceptionVO;
|
||||||
|
import com.cm.central.control.service.clientexception.IClientExceptionService;
|
||||||
import com.cm.central.control.service.socket.BaseSocketService;
|
import com.cm.central.control.service.socket.BaseSocketService;
|
||||||
|
import com.cm.socket.consts.ISocketConst;
|
||||||
import com.cm.socket.pojo.Message;
|
import com.cm.socket.pojo.Message;
|
||||||
|
import com.cm.socket.pojo.SocketResult;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,9 +26,26 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service("socketExceptionServiceImpl")
|
@Service("socketExceptionServiceImpl")
|
||||||
public class SocketExceptionServiceImpl extends BaseSocketService {
|
public class SocketExceptionServiceImpl extends BaseSocketService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IClientExceptionService clientExceptionService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void readMessageService(ChannelHandlerContext channelHandlerContext, Message readMessage) {
|
protected void readMessageService(ChannelHandlerContext channelHandlerContext, Message readMessage) {
|
||||||
|
SocketResult<JSONObject> socketResult = JSONObject.parseObject(readMessage.getContent(), SocketResult.class);
|
||||||
|
SocketServerManager socketServerManager = SocketServerManager.getInstance();
|
||||||
|
SocketClientBO onlineClientByToken = socketServerManager.getOnlineClientByToken(channelHandlerContext.channel().id().asShortText());
|
||||||
|
ClientExceptionVO clientExceptionVO = new ClientExceptionVO();
|
||||||
|
clientExceptionVO.setClientId(onlineClientByToken.getClientId());
|
||||||
|
clientExceptionVO.setExceptionName(socketResult.getData().getString(ISocketConst.EXCEPTION_MESSAGE));
|
||||||
|
clientExceptionVO.setExceptionSummary(socketResult.getData().getString(ISocketConst.EXCEPTION_CONTENT));
|
||||||
|
clientExceptionVO.setExceptionType(socketResult.getData().getString(ISocketConst.EXCEPTION_CLASS));
|
||||||
|
clientExceptionVO.setIsHandle(0);
|
||||||
|
clientExceptionVO.setIsNoticeProjectLeader(0);
|
||||||
|
try {
|
||||||
|
clientExceptionService.saveClientExceptionReturnId(clientExceptionVO);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -53,6 +53,8 @@ public class SocketServerRunnable implements Runnable {
|
|||||||
serverBootstrap.option(ChannelOption.SO_KEEPALIVE, true);
|
serverBootstrap.option(ChannelOption.SO_KEEPALIVE, true);
|
||||||
// 有数据就立即发送
|
// 有数据就立即发送
|
||||||
serverBootstrap.option(ChannelOption.TCP_NODELAY, true);
|
serverBootstrap.option(ChannelOption.TCP_NODELAY, true);
|
||||||
|
serverBootstrap.option(ChannelOption.SO_SNDBUF, 1024 * 1024 * 1024);
|
||||||
|
serverBootstrap.option(ChannelOption.SO_RCVBUF, 1024 * 1024 * 1024);
|
||||||
serverBootstrap.childHandler(socketServerChannelInitializer);
|
serverBootstrap.childHandler(socketServerChannelInitializer);
|
||||||
|
|
||||||
// 启动服务
|
// 启动服务
|
||||||
|
Loading…
Reference in New Issue
Block a user