09-15-netty优化,土地流转修复
This commit is contained in:
@ -158,8 +158,12 @@ public class BusLandTransferLedgerController extends BaseController {
|
||||
for (BusLandTransferLedgerSon ledgerSon : sonList) {
|
||||
//1已流转,2是不流转
|
||||
if (ledgerSon.getTransferStatus().equals("1")){
|
||||
transferAreaSum = transferAreaSum.add(ledgerSon.getAreaValue());
|
||||
if (ledgerSon.getAreaValue()!=null) {
|
||||
transferAreaSum = transferAreaSum.add(ledgerSon.getAreaValue());
|
||||
}
|
||||
if (ledgerSon.getLandRent()!=null){
|
||||
rentSum = rentSum.add(ledgerSon.getLandRent());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,43 +2,34 @@ package org.dromara.websocket;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import io.netty.channel.group.ChannelGroup;
|
||||
import io.netty.channel.group.DefaultChannelGroup;
|
||||
import io.netty.handler.codec.http.HttpHeaders;
|
||||
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
|
||||
import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
|
||||
import io.netty.util.concurrent.GlobalEventExecutor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.domain.dto.UserDTO;
|
||||
import org.dromara.common.core.domain.model.LoginUser;
|
||||
import org.dromara.common.json.utils.JsonUtils;
|
||||
import org.dromara.common.redis.utils.RedisUtils;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.system.domain.bo.SysUserBo;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.dromara.system.service.impl.SysOssServiceImpl;
|
||||
import org.dromara.system.service.impl.SysUserServiceImpl;
|
||||
import org.dromara.websocket.domain.ChatGroup;
|
||||
import org.dromara.websocket.domain.ChatHistory;
|
||||
import org.dromara.websocket.service.Impl.ChatGroupServiceImpl;
|
||||
import org.dromara.websocket.service.Impl.ChatHistoryServiceImpl;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@ -228,6 +219,7 @@ public class ChatServerHandler extends SimpleChannelInboundHandler<TextWebSocket
|
||||
// chatHistoryService.save(chatHistory);
|
||||
|
||||
}
|
||||
log.info("{} 上线了", ctx.channel().remoteAddress());
|
||||
super.userEventTriggered(ctx, evt);
|
||||
}
|
||||
|
||||
@ -273,19 +265,19 @@ public class ChatServerHandler extends SimpleChannelInboundHandler<TextWebSocket
|
||||
channelUserMap.remove(ctx);
|
||||
|
||||
}
|
||||
|
||||
log.info(ctx.channel().remoteAddress() + " 下线了");
|
||||
}
|
||||
|
||||
// 当通道就绪时调用
|
||||
@Override
|
||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||
log.info("{} 上线了", ctx.channel().remoteAddress());
|
||||
|
||||
}
|
||||
|
||||
// 当通道不可用时调用
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
log.info(ctx.channel().remoteAddress() + " 下线了");
|
||||
|
||||
}
|
||||
|
||||
// 读取客户端发送的消息
|
||||
@ -343,7 +335,7 @@ public class ChatServerHandler extends SimpleChannelInboundHandler<TextWebSocket
|
||||
//如果满足则说明用户在线
|
||||
if (channelHandlerContexts != null && !channelHandlerContexts.isEmpty()) {
|
||||
//构建所有房间的未读消息数
|
||||
setValue(id, jsonObject);
|
||||
setUnReadCount(id, jsonObject);
|
||||
//给每个通道发送对应消息
|
||||
for (ChannelHandlerContext handlerContext : channelHandlerContexts) {
|
||||
sendMessage(handlerContext, jsonObject.toString());
|
||||
@ -569,7 +561,7 @@ public class ChatServerHandler extends SimpleChannelInboundHandler<TextWebSocket
|
||||
//给每个通道发送对应消息
|
||||
for (ChannelHandlerContext handlerContext : channelHandlerContexts) {
|
||||
//同时发送所有未读消息给前端进行渲染
|
||||
setValue(userId, jsonObject);
|
||||
setUnReadCount(userId, jsonObject);
|
||||
sendMessage(handlerContext, jsonObject.toString());
|
||||
}
|
||||
}
|
||||
@ -577,7 +569,7 @@ public class ChatServerHandler extends SimpleChannelInboundHandler<TextWebSocket
|
||||
}
|
||||
|
||||
//设置未读消息数
|
||||
private void setValue(Long userId, JSONObject jsonObject) {
|
||||
private void setUnReadCount(Long userId, JSONObject jsonObject) {
|
||||
HashMap<String,Object> temp = new HashMap<>();
|
||||
userRoomCountMap.forEachKey(0, (value) -> {
|
||||
if (value.contains(userId.toString())){
|
||||
|
||||
Reference in New Issue
Block a user