From f595d6eeb97148d43ae59449a10ed6279c06f2dd Mon Sep 17 00:00:00 2001 From: lecjy <5655726966@qq.com> Date: Fri, 8 Dec 2023 18:25:37 +0800 Subject: [PATCH] fix #988 Signed-off-by: lecjy <5655726966@qq.com> --- .../apps/service/OnlineUserController.java | 36 ++++++++----------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/contact-center/app/src/main/java/com/cskefu/cc/controller/apps/service/OnlineUserController.java b/contact-center/app/src/main/java/com/cskefu/cc/controller/apps/service/OnlineUserController.java index a16e4978..6abd6b61 100644 --- a/contact-center/app/src/main/java/com/cskefu/cc/controller/apps/service/OnlineUserController.java +++ b/contact-center/app/src/main/java/com/cskefu/cc/controller/apps/service/OnlineUserController.java @@ -112,45 +112,37 @@ public class OnlineUserController extends Handler { MainContext.AgentUserStatusEnum.END.toString())); AgentService agentService = agentServiceList.get(0); - if (StringUtils.isNotBlank(agentservice)) { + if (StringUtils.isNotEmpty(agentservice)) { for (AgentService as : agentServiceList) { if (as.getId().equals(agentservice)) { agentService = as; break; } } + AgentService service = agentServiceRes.findById(agentservice).orElse(null); + if (service != null) { + map.addAttribute("tags", tagRes.findByTagtypeAndSkill(MainContext.ModelType.USER.toString(), service.getSkill())); + } } if (agentService != null) { - List summaries = serviceSummaryRes.findByAgentserviceid( - agentService.getId()); + List summaries = serviceSummaryRes.findByAgentserviceid(agentService.getId()); if (summaries.size() > 0) { map.put("summary", summaries.get(0)); } - } - agentUserContactsRes.findOneByUserid( - userid).ifPresent(p -> { - map.put("contacts", contactsRes.findById(p.getContactsid()).orElse(null)); + agentUserContactsRes.findOneByUserid(userid).ifPresent(p -> { + if (p.getContactsid() != null) { + map.put("contacts", contactsRes.findById(p.getContactsid()).orElse(null)); + } }); - AgentService service = agentServiceRes.findById(agentservice).orElse(null); - if (service != null) { - map.addAttribute( - "tags", tagRes.findByTagtypeAndSkill(MainContext.ModelType.USER.toString(), service.getSkill())); - } - map.put( - "summaryTags", - tagRes.findByTagtype(MainContext.ModelType.SUMMARY.toString())); + + map.put("summaryTags", tagRes.findByTagtype(MainContext.ModelType.SUMMARY.toString())); map.put("curAgentService", agentService); - - map.put( - "agentUserMessageList", - chatMessageRepository.findByAgentserviceid(agentService.getId(), - PageRequest.of( - 0, 50, Direction.DESC, - "updatetime"))); + map.put("agentUserMessageList", chatMessageRepository.findByAgentserviceid(agentService.getId(), + PageRequest.of(0, 50, Direction.DESC, "updatetime"))); } if (MainContext.ChannelType.WEIXIN.toString().equals(channel)) {