From cc8efaa7d6929a2ee6e421db8aafeb172a04c550 Mon Sep 17 00:00:00 2001 From: bynt <13586541001@163.com> Date: Mon, 15 Apr 2024 18:21:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/LoginEquipmentServiceImpl.java | 17 +++++++++++------ .../service/impl/WeChatServiceImpl.java | 19 ++++++++++--------- .../distribute/vo/WeChatAccountVO.java | 4 ++++ admin/src/main/resources/application-prod.yml | 2 +- .../resources/mapper/LoginEquipmentMapper.xml | 1 + 5 files changed, 27 insertions(+), 16 deletions(-) diff --git a/admin/src/main/java/com/baiye/modules/distribute/service/impl/LoginEquipmentServiceImpl.java b/admin/src/main/java/com/baiye/modules/distribute/service/impl/LoginEquipmentServiceImpl.java index 4b73167..d8ed376 100644 --- a/admin/src/main/java/com/baiye/modules/distribute/service/impl/LoginEquipmentServiceImpl.java +++ b/admin/src/main/java/com/baiye/modules/distribute/service/impl/LoginEquipmentServiceImpl.java @@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.http.HttpStatus; import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONUtil; +import com.baiye.constant.DefaultNumberConstants; import com.baiye.constant.WeChatRequestConstants; import com.baiye.domain.PageParam; import com.baiye.domain.PageResult; @@ -45,16 +46,20 @@ public class LoginEquipmentServiceImpl extends ExtendServiceImpl queryPage = baseMapper.queryPage(pageParam, qo); queryPage.getRecords().forEach(accountVO -> { + // 默认离线状态 + accountVO.setStatus(DefaultNumberConstants.ZERO_NUMBER); map.put("robotId", accountVO.getRobotId()); String robotResult = HttpUtil.get (weChatProperties.getGatewayHost().concat(WeChatRequestConstants.GET_ROBOT_TYPE) .concat(weChatProperties.getAppKey()), map); - WeChatResponse weChatResponse = JSONUtil.toBean(robotResult, WeChatResponse.class); - if (weChatResponse.getStatus() == HttpStatus.HTTP_OK) { - WeChatAccountDTO dto = BeanUtil.toBean(weChatResponse.getData(), WeChatAccountDTO.class); - if (ObjectUtil.isNotNull(dto)) { - accountVO.setCityInfo(dto.getProvince()); - accountVO.setStatus(dto.getStatus()); + if (JSONUtil.isTypeJSON(robotResult)) { + WeChatResponse weChatResponse = JSONUtil.toBean(robotResult, WeChatResponse.class); + if (weChatResponse.getStatus() == HttpStatus.HTTP_OK) { + WeChatAccountDTO dto = BeanUtil.toBean(weChatResponse.getData(), WeChatAccountDTO.class); + if (ObjectUtil.isNotNull(dto) && dto.getPit().equals(accountVO.getPit())) { + accountVO.setCityInfo(dto.getProvince()); + accountVO.setStatus(dto.getStatus()); + } } } }); diff --git a/admin/src/main/java/com/baiye/modules/distribute/service/impl/WeChatServiceImpl.java b/admin/src/main/java/com/baiye/modules/distribute/service/impl/WeChatServiceImpl.java index 048dd01..ee91bc7 100644 --- a/admin/src/main/java/com/baiye/modules/distribute/service/impl/WeChatServiceImpl.java +++ b/admin/src/main/java/com/baiye/modules/distribute/service/impl/WeChatServiceImpl.java @@ -285,7 +285,6 @@ public class WeChatServiceImpl extends ExtendServiceImpl onlineList = Lists.newArrayList(); AccountStatisticsVO vo = new AccountStatisticsVO(); List weChatAccounts = loginEquipmentService.queryByUserId(currentUserId); - Long friendNum = wechatFriendService.queryByUserId(currentUserId); Integer abnormalNum = DefaultNumberConstants.ZERO_NUMBER; int onlineNum = DefaultNumberConstants.ZERO_NUMBER; @@ -295,14 +294,16 @@ public class WeChatServiceImpl extends ExtendServiceImpl