mirror of
https://github.com/chatopera/cosin.git
synced 2025-08-01 16:38:02 +08:00
Closed #121 显示机器人坐席名称
This commit is contained in:
parent
41763967a9
commit
fc9ab87098
@ -72,7 +72,6 @@ public class AutomaticServiceDist {
|
||||
/**
|
||||
* 载入坐席 ACD策略配置
|
||||
*
|
||||
* @param orgi
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -530,7 +529,7 @@ public class AutomaticServiceDist {
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static AgentService processChatbotService(final AgentUser agentUser, final String orgi) {
|
||||
public static AgentService processChatbotService(final String botName, final AgentUser agentUser, final String orgi) {
|
||||
AgentService agentService = new AgentService(); //放入缓存的对象
|
||||
AgentServiceRepository agentServiceRes = MainContext.getContext().getBean(AgentServiceRepository.class);
|
||||
Date now = new Date();
|
||||
@ -550,6 +549,8 @@ public class AutomaticServiceDist {
|
||||
agentService.setRegion(agentUser.getRegion());
|
||||
agentService.setUsername(agentUser.getUsername());
|
||||
agentService.setChannel(agentUser.getChannel());
|
||||
if (botName != null)
|
||||
agentService.setAgentusername(botName);
|
||||
|
||||
if (StringUtils.isNotBlank(agentUser.getContextid())) {
|
||||
agentService.setContextid(agentUser.getContextid());
|
||||
|
@ -473,6 +473,12 @@ public class Handler {
|
||||
this.starttime = starttime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用Blob保存文件
|
||||
* @param multipart
|
||||
* @return id
|
||||
* @throws IOException
|
||||
*/
|
||||
public String saveImageFileWithMultipart(MultipartFile multipart) throws IOException {
|
||||
StreamingFile sf = new StreamingFile();
|
||||
final String fileid = MainUtils.getUUID();
|
||||
|
@ -16,20 +16,14 @@
|
||||
*/
|
||||
package com.chatopera.cc.app.handler.apps.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.*;
|
||||
import com.chatopera.cc.app.persistence.es.ContactsRepository;
|
||||
import com.chatopera.cc.app.persistence.impl.AgentUserService;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.AgentServiceSummary;
|
||||
import com.chatopera.cc.app.model.AgentUser;
|
||||
import com.chatopera.cc.app.model.AgentUserContacts;
|
||||
import com.chatopera.cc.app.model.OnlineUser;
|
||||
import com.chatopera.cc.app.persistence.repository.*;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
@ -39,19 +33,9 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.app.persistence.repository.AgentServiceRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.AgentUserContactsRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.ChatMessageRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.OnlineUserHisRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.OnlineUserRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.ServiceSummaryRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.TagRelationRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.TagRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.UserEventRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.WeiXinUserRepository;
|
||||
import com.chatopera.cc.app.model.AgentService;
|
||||
import com.chatopera.cc.app.model.WeiXinUser;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/service")
|
||||
@ -96,13 +80,13 @@ public class OnlineUserController extends Handler {
|
||||
@RequestMapping("/online/index")
|
||||
@Menu(type = "service", subtype = "online", admin = true)
|
||||
public ModelAndView index(ModelMap map, HttpServletRequest request, String userid, String agentservice, @Valid String channel) {
|
||||
if(!StringUtils.isBlank(userid)){
|
||||
if (StringUtils.isNotBlank(userid)) {
|
||||
map.put("inviteResult", MainUtils.getWebIMInviteResult(onlineUserRes.findByOrgiAndUserid(super.getOrgi(request), userid)));
|
||||
map.put("tagRelationList", tagRelationRes.findByUserid(userid));
|
||||
map.put("onlineUserHistList", onlineUserHisRes.findByUseridAndOrgi(userid, super.getOrgi(request)));
|
||||
map.put("agentServicesAvg", onlineUserRes.countByUserForAvagTime(super.getOrgi(request), MainContext.AgentUserStatusEnum.END.toString(), userid));
|
||||
|
||||
List<AgentService> agentServiceList = agentServiceRes.findByUseridAndOrgi(userid, super.getOrgi(request)) ;
|
||||
List<AgentService> agentServiceList = agentServiceRes.findByUseridAndOrgiOrderByLogindateDesc(userid, super.getOrgi(request));
|
||||
|
||||
map.put("agentServiceList", agentServiceList);
|
||||
if (agentServiceList.size() > 0) {
|
||||
@ -112,10 +96,11 @@ public class OnlineUserController extends Handler {
|
||||
MainContext.AgentUserStatusEnum.END.toString())));
|
||||
|
||||
AgentService agentService = agentServiceList.get(0);
|
||||
if(!StringUtils.isBlank(agentservice)){
|
||||
if (StringUtils.isNotBlank(agentservice)) {
|
||||
for (AgentService as : agentServiceList) {
|
||||
if (as.getId().equals(agentservice)) {
|
||||
agentService = as ; break ;
|
||||
agentService = as;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -166,7 +151,7 @@ public class OnlineUserController extends Handler {
|
||||
|
||||
map.put("curAgentService", agentService);
|
||||
map.put("curragentuser", curragentuser);
|
||||
if(!StringUtils.isBlank(title)){
|
||||
if (StringUtils.isNotBlank(title)) {
|
||||
map.put("title", title);
|
||||
}
|
||||
|
||||
@ -186,7 +171,7 @@ public class OnlineUserController extends Handler {
|
||||
@RequestMapping("/trace")
|
||||
@Menu(type = "service", subtype = "trace", admin = false)
|
||||
public ModelAndView trace(ModelMap map, HttpServletRequest request, @Valid String sessionid) {
|
||||
if(!StringUtils.isBlank(sessionid)){
|
||||
if (StringUtils.isNotBlank(sessionid)) {
|
||||
map.addAttribute("traceHisList", userEventRes.findBySessionidAndOrgi(sessionid, super.getOrgi(request), new PageRequest(0, 100)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/apps/service/online/trace"));
|
||||
|
@ -161,6 +161,7 @@ public class ChatbotEventHandler {
|
||||
agentUser.setCreatetime(now);
|
||||
agentUser.setUpdatetime(now);
|
||||
agentUser.setSessionid(session);
|
||||
agentUser.setRegion(onlineUser.getRegion());
|
||||
|
||||
// 聊天机器人处理的请求
|
||||
agentUser.setOpttype(MainContext.OptTypeEnum.CHATBOT.toString());
|
||||
@ -168,7 +169,7 @@ public class ChatbotEventHandler {
|
||||
agentUser.setCity(onlineUser.getCity());
|
||||
agentUser.setProvince(onlineUser.getProvince());
|
||||
agentUser.setCountry(onlineUser.getCountry());
|
||||
AgentService agentService = AutomaticServiceDist.processChatbotService(agentUser, orgi);
|
||||
AgentService agentService = AutomaticServiceDist.processChatbotService(invite != null ? invite.getAiname() : "机器人客服", agentUser, orgi);
|
||||
agentUser.setAgentserviceid(agentService.getId());
|
||||
|
||||
// 标记为机器人坐席
|
||||
@ -194,7 +195,7 @@ public class ChatbotEventHandler {
|
||||
AgentUser agentUser = (AgentUser) CacheHelper.getAgentUserCacheBean().getCacheObject(user, orgi);
|
||||
OnlineUser onlineUser = (OnlineUser) CacheHelper.getOnlineUserCacheBean().getCacheObject(user, orgi);
|
||||
if (agentUser != null) {
|
||||
AutomaticServiceDist.processChatbotService(agentUser, orgi);
|
||||
AutomaticServiceDist.processChatbotService(null, agentUser, orgi);
|
||||
CacheHelper.getAgentUserCacheBean().delete(user, MainContext.SYSTEM_ORGI);
|
||||
CacheHelper.getOnlineUserCacheBean().delete(user, orgi);
|
||||
agentUser.setStatus(MainContext.OnlineUserOperatorStatus.OFFLINE.toString());
|
||||
|
@ -167,7 +167,7 @@ public class IMEventHandler {
|
||||
}
|
||||
|
||||
AgentServiceRepository agentServiceRes = MainContext.getContext().getBean(AgentServiceRepository.class);
|
||||
List<AgentService> agentServiceList = agentServiceRes.findByUseridAndOrgi(user, orgi);
|
||||
List<AgentService> agentServiceList = agentServiceRes.findByUseridAndOrgiOrderByLogindateDesc(user, orgi);
|
||||
if (agentServiceList.size() > 0) {
|
||||
AgentService agentService = agentServiceList.get(0);
|
||||
agentService.setName(contacts.getName());
|
||||
|
@ -31,7 +31,7 @@ public abstract interface AgentServiceRepository
|
||||
{
|
||||
public abstract AgentService findByIdAndOrgi(String paramString , String orgi);
|
||||
|
||||
public abstract List<AgentService> findByUseridAndOrgi(String paramString, String orgi);
|
||||
public abstract List<AgentService> findByUseridAndOrgiOrderByLogindateDesc(String paramString, String orgi);
|
||||
|
||||
public abstract Page<AgentService> findByOrgi(String orgi, Pageable paramPageable);
|
||||
|
||||
|
@ -97,9 +97,8 @@
|
||||
<th>咨询时间</th>
|
||||
<th>服务时间</th>
|
||||
<th>等待时长</th>
|
||||
<th>服务时间</th>
|
||||
<th>服务时长</th>
|
||||
<th>地域</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
Loading…
x
Reference in New Issue
Block a user