diff --git a/cloud-central-control/src/main/java/com/cm/central/control/controller/apis/clientexception/ClientExceptionController.java b/cloud-central-control/src/main/java/com/cm/central/control/controller/apis/clientexception/ClientExceptionController.java index 078bdd7..812eeb0 100644 --- a/cloud-central-control/src/main/java/com/cm/central/control/controller/apis/clientexception/ClientExceptionController.java +++ b/cloud-central-control/src/main/java/com/cm/central/control/controller/apis/clientexception/ClientExceptionController.java @@ -40,14 +40,6 @@ public class ClientExceptionController extends AbstractController { @Autowired 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列表)接口") @ApiImplicitParams({ @ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3") diff --git a/cloud-central-control/src/main/java/com/cm/central/control/controller/app/apis/clientexception/ClientExceptionAppController.java b/cloud-central-control/src/main/java/com/cm/central/control/controller/app/apis/clientexception/ClientExceptionAppController.java index 3fe191d..bb59e81 100644 --- a/cloud-central-control/src/main/java/com/cm/central/control/controller/app/apis/clientexception/ClientExceptionAppController.java +++ b/cloud-central-control/src/main/java/com/cm/central/control/controller/app/apis/clientexception/ClientExceptionAppController.java @@ -36,17 +36,6 @@ public class ClientExceptionAppController extends AbstractController { @Autowired 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列表)接口") @ApiImplicitParams({ @ApiImplicitParam(name = "token", value = "token", paramType = "header"), diff --git a/cloud-central-control/src/main/java/com/cm/central/control/controller/resources/clientexception/ClientExceptionResourceController.java b/cloud-central-control/src/main/java/com/cm/central/control/controller/resources/clientexception/ClientExceptionResourceController.java index a054303..a08cf0d 100644 --- a/cloud-central-control/src/main/java/com/cm/central/control/controller/resources/clientexception/ClientExceptionResourceController.java +++ b/cloud-central-control/src/main/java/com/cm/central/control/controller/resources/clientexception/ClientExceptionResourceController.java @@ -35,18 +35,7 @@ public class ClientExceptionResourceController extends AbstractController { @Autowired 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列表)接口") @ApiImplicitParams({ @ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"), diff --git a/cloud-central-control/src/main/java/com/cm/central/control/pojo/vos/clientexception/ClientExceptionVO.java b/cloud-central-control/src/main/java/com/cm/central/control/pojo/vos/clientexception/ClientExceptionVO.java index 792d914..ba2e9dc 100644 --- a/cloud-central-control/src/main/java/com/cm/central/control/pojo/vos/clientexception/ClientExceptionVO.java +++ b/cloud-central-control/src/main/java/com/cm/central/control/pojo/vos/clientexception/ClientExceptionVO.java @@ -3,6 +3,7 @@ package com.cm.central.control.pojo.vos.clientexception; import com.cm.common.annotation.CheckNumberAnnotation; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import org.apache.commons.lang3.StringEscapeUtils; /** * diff --git a/cloud-central-control/src/main/java/com/cm/central/control/service/clientexception/IClientExceptionService.java b/cloud-central-control/src/main/java/com/cm/central/control/service/clientexception/IClientExceptionService.java index 1641b15..d01748e 100644 --- a/cloud-central-control/src/main/java/com/cm/central/control/service/clientexception/IClientExceptionService.java +++ b/cloud-central-control/src/main/java/com/cm/central/control/service/clientexception/IClientExceptionService.java @@ -22,25 +22,6 @@ import java.util.Map; **/ 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; - /** - * 新增客户端异常(APP) - * - * @param token - * @param clientExceptionVO - * @return clientExceptionId - * @throws Exception - */ - String saveClientExceptionByTokenReturnId(String token, ClientExceptionVO clientExceptionVO) throws Exception; - /** * 删除客户端异常 * diff --git a/cloud-central-control/src/main/java/com/cm/central/control/service/clientexception/impl/ClientExceptionServiceImpl.java b/cloud-central-control/src/main/java/com/cm/central/control/service/clientexception/impl/ClientExceptionServiceImpl.java index b3189a6..2898622 100644 --- a/cloud-central-control/src/main/java/com/cm/central/control/service/clientexception/impl/ClientExceptionServiceImpl.java +++ b/cloud-central-control/src/main/java/com/cm/central/control/service/clientexception/impl/ClientExceptionServiceImpl.java @@ -34,56 +34,12 @@ public class ClientExceptionServiceImpl extends AbstractService implements IClie @Autowired 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 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(); Map params = HashMapUtil.beanToMap(clientExceptionVO); params.put("clientExceptionId", clientExceptionId); - if (token != null) { - setSaveInfo(token, params); - } else { - setSaveInfo(params); - } + setSaveInfoByUserId(params, "1"); clientExceptionDao.saveClientException(params); return clientExceptionId; } diff --git a/cloud-central-control/src/main/java/com/cm/central/control/service/socket/exception/SocketExceptionServiceImpl.java b/cloud-central-control/src/main/java/com/cm/central/control/service/socket/exception/SocketExceptionServiceImpl.java index 75fe058..a489736 100644 --- a/cloud-central-control/src/main/java/com/cm/central/control/service/socket/exception/SocketExceptionServiceImpl.java +++ b/cloud-central-control/src/main/java/com/cm/central/control/service/socket/exception/SocketExceptionServiceImpl.java @@ -1,8 +1,16 @@ 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.socket.consts.ISocketConst; import com.cm.socket.pojo.Message; +import com.cm.socket.pojo.SocketResult; import io.netty.channel.ChannelHandlerContext; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** @@ -18,9 +26,26 @@ import org.springframework.stereotype.Service; @Service("socketExceptionServiceImpl") public class SocketExceptionServiceImpl extends BaseSocketService { + @Autowired + private IClientExceptionService clientExceptionService; + @Override protected void readMessageService(ChannelHandlerContext channelHandlerContext, Message readMessage) { - + SocketResult 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 diff --git a/cloud-central-control/src/main/java/com/cm/central/control/socket/SocketServerRunnable.java b/cloud-central-control/src/main/java/com/cm/central/control/socket/SocketServerRunnable.java index 4588d11..1f7ed3f 100644 --- a/cloud-central-control/src/main/java/com/cm/central/control/socket/SocketServerRunnable.java +++ b/cloud-central-control/src/main/java/com/cm/central/control/socket/SocketServerRunnable.java @@ -53,6 +53,8 @@ public class SocketServerRunnable implements Runnable { serverBootstrap.option(ChannelOption.SO_KEEPALIVE, 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); // 启动服务