mirror of
https://github.com/chatopera/cosin.git
synced 2025-08-01 16:38:02 +08:00
Fix AgentController
This commit is contained in:
parent
386e1fdfd3
commit
9b5667d602
@ -42,15 +42,18 @@
|
|||||||
import com.chatopera.cc.util.PinYinTools;
|
import com.chatopera.cc.util.PinYinTools;
|
||||||
import com.chatopera.cc.util.PropertiesEventUtil;
|
import com.chatopera.cc.util.PropertiesEventUtil;
|
||||||
import freemarker.template.TemplateException;
|
import freemarker.template.TemplateException;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.domain.Sort.Direction;
|
import org.springframework.data.domain.Sort.Direction;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.lang.NonNull;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.util.FileCopyUtils;
|
import org.springframework.util.FileCopyUtils;
|
||||||
@ -58,6 +61,7 @@
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -70,125 +74,113 @@
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
|
@RequiredArgsConstructor
|
||||||
@RequestMapping("/agent")
|
@RequestMapping("/agent")
|
||||||
public class AgentController extends Handler {
|
public class AgentController extends Handler {
|
||||||
|
|
||||||
static final Logger logger = LoggerFactory.getLogger(AgentController.class);
|
static final Logger logger = LoggerFactory.getLogger(AgentController.class);
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ACDWorkMonitor acdWorkMonitor;
|
private final ACDWorkMonitor acdWorkMonitor;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ACDPolicyService acdPolicyService;
|
private final ACDPolicyService acdPolicyService;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ACDAgentService acdAgentService;
|
private final ACDAgentService acdAgentService;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ContactsRepository contactsRes;
|
private final ContactsRepository contactsRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private PropertiesEventRepository propertiesEventRes;
|
private final PropertiesEventRepository propertiesEventRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private AgentUserRepository agentUserRes;
|
private final AgentUserRepository agentUserRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private AgentStatusRepository agentStatusRes;
|
private final AgentStatusRepository agentStatusRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private AgentServiceRepository agentServiceRes;
|
private final AgentServiceRepository agentServiceRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private OnlineUserRepository onlineUserRes;
|
private final OnlineUserRepository onlineUserRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private WeiXinUserRepository weiXinUserRes;
|
private final WeiXinUserRepository weiXinUserRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ServiceSummaryRepository serviceSummaryRes;
|
private final ServiceSummaryRepository serviceSummaryRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ChatMessageRepository chatMessageRes;
|
private final ChatMessageRepository chatMessageRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ChatMessageEsRepository chatMessageEsRes;
|
private final ChatMessageEsRepository chatMessageEsRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private AgentProxy agentProxy;
|
private final AgentProxy agentProxy;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private TagRepository tagRes;
|
private final TagRepository tagRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private TagRelationRepository tagRelationRes;
|
private final TagRelationRepository tagRelationRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private QuickReplyRepository quickReplyRes;
|
private final QuickReplyRepository quickReplyRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private QuickTypeRepository quickTypeRes;
|
private final QuickTypeRepository quickTypeRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private AgentUserTaskRepository agentUserTaskRes;
|
private final AgentUserTaskRepository agentUserTaskRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private UserRepository userRes;
|
private final UserRepository userRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private StatusEventRepository statusEventRes;
|
private final StatusEventRepository statusEventRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private AgentUserProxy agentUserProxy;
|
private final AgentUserProxy agentUserProxy;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private PbxHostRepository pbxHostRes;
|
private final PbxHostRepository pbxHostRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private AgentUserContactsRepository agentUserContactsRes;
|
private final AgentUserContactsRepository agentUserContactsRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private StreamingFileRepository streamingFileRes;
|
private final StreamingFileRepository streamingFileRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private JpaBlobHelper jpaBlobHelper;
|
private final JpaBlobHelper jpaBlobHelper;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private BlackEntityProxy blackEntityProxy;
|
private final BlackEntityProxy blackEntityProxy;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private Cache cache;
|
private final Cache cache;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private AgentServiceProxy agentServiceProxy;
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private final AgentServiceProxy agentServiceProxy;
|
||||||
|
@NonNull
|
||||||
|
private final PeerSyncIM peerSyncIM;
|
||||||
|
@NonNull
|
||||||
|
private final BrokerPublisher brokerPublisher;
|
||||||
|
@NonNull
|
||||||
|
private final AgentStatusProxy agentStatusProxy;
|
||||||
|
@NonNull
|
||||||
|
private final UserProxy userProxy;
|
||||||
@Value("${web.upload-path}")
|
@Value("${web.upload-path}")
|
||||||
private String webUploadPath;
|
private String webUploadPath;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PeerSyncIM peerSyncIM;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private BrokerPublisher brokerPublisher;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private AgentStatusProxy agentStatusProxy;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserProxy userProxy;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 坐席从联系人列表进入坐席工作台和该联系人聊天
|
* 坐席从联系人列表进入坐席工作台和该联系人聊天
|
||||||
*
|
*
|
||||||
* @param map
|
|
||||||
* @param request
|
|
||||||
* @param response
|
|
||||||
* @param sort
|
|
||||||
* @param channels 可立即触达的渠道
|
* @param channels 可立即触达的渠道
|
||||||
* @param contactid
|
|
||||||
* @return
|
|
||||||
* @throws IOException
|
|
||||||
* @throws TemplateException
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/proactive")
|
@RequestMapping("/proactive")
|
||||||
@Menu(type = "apps", subtype = "agent")
|
@Menu(type = "apps", subtype = "agent")
|
||||||
@ -233,14 +225,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 打开坐席工作台
|
* 打开坐席工作台
|
||||||
*
|
|
||||||
* @param map
|
|
||||||
* @param request
|
|
||||||
* @param response
|
|
||||||
* @param sort
|
|
||||||
* @return
|
|
||||||
* @throws IOException
|
|
||||||
* @throws TemplateException
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/index")
|
@RequestMapping("/index")
|
||||||
@Menu(type = "apps", subtype = "agent")
|
@Menu(type = "apps", subtype = "agent")
|
||||||
@ -274,11 +258,9 @@
|
|||||||
@RequestMapping("/agentuserpage")
|
@RequestMapping("/agentuserpage")
|
||||||
@Menu(type = "apps", subtype = "agent")
|
@Menu(type = "apps", subtype = "agent")
|
||||||
public ModelAndView agentuserpage(
|
public ModelAndView agentuserpage(
|
||||||
ModelMap map,
|
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
String id,
|
String id,
|
||||||
Integer page,
|
Integer current) {
|
||||||
Integer current) throws IOException, TemplateException {
|
|
||||||
String mainagentuserconter = "/apps/agent/mainagentuserconter";
|
String mainagentuserconter = "/apps/agent/mainagentuserconter";
|
||||||
ModelAndView view = request(super.createRequestPageTempletResponse(mainagentuserconter));
|
ModelAndView view = request(super.createRequestPageTempletResponse(mainagentuserconter));
|
||||||
AgentUser agentUser = agentUserRes.findByIdAndOrgi(id, super.getOrgi(request));
|
AgentUser agentUser = agentUserRes.findByIdAndOrgi(id, super.getOrgi(request));
|
||||||
@ -292,15 +274,12 @@
|
|||||||
|
|
||||||
@RequestMapping("/agentuserLabel")
|
@RequestMapping("/agentuserLabel")
|
||||||
@Menu(type = "apps", subtype = "agent")
|
@Menu(type = "apps", subtype = "agent")
|
||||||
public ModelAndView agentuserLabel(
|
public ModelAndView agentuserLabel(String iconid) {
|
||||||
ModelMap map,
|
|
||||||
HttpServletRequest request,
|
|
||||||
String iconid) throws IOException, TemplateException {
|
|
||||||
String mainagentuserconter = "/apps/agent/mainagentuserconter";
|
String mainagentuserconter = "/apps/agent/mainagentuserconter";
|
||||||
ModelAndView view = request(super.createRequestPageTempletResponse(mainagentuserconter));
|
ModelAndView view = request(super.createRequestPageTempletResponse(mainagentuserconter));
|
||||||
ChatMessage labelid = this.chatMessageRes.findById(iconid);
|
ChatMessage labelid = this.chatMessageRes.findById(iconid);
|
||||||
if (labelid != null) {
|
if (labelid != null) {
|
||||||
labelid.setIslabel(labelid.isIslabel() == false);
|
labelid.setIslabel(!labelid.isIslabel());
|
||||||
chatMessageRes.save(labelid);
|
chatMessageRes.save(labelid);
|
||||||
}
|
}
|
||||||
return view;
|
return view;
|
||||||
@ -309,18 +288,17 @@
|
|||||||
@RequestMapping("/agentusersearch")
|
@RequestMapping("/agentusersearch")
|
||||||
@Menu(type = "apps", subtype = "agent")
|
@Menu(type = "apps", subtype = "agent")
|
||||||
public ModelAndView agentusersearch(
|
public ModelAndView agentusersearch(
|
||||||
ModelMap map,
|
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
String id,
|
String id,
|
||||||
String search,
|
String search,
|
||||||
String condition
|
String condition
|
||||||
) throws IOException, TemplateException {
|
) {
|
||||||
String mainagentuserconter = "/apps/agent/mainagentusersearch";
|
String mainagentuserconter = "/apps/agent/mainagentusersearch";
|
||||||
ModelAndView view = request(super.createRequestPageTempletResponse(mainagentuserconter));
|
ModelAndView view = request(super.createRequestPageTempletResponse(mainagentuserconter));
|
||||||
AgentUser agentUser = agentUserRes.findByIdAndOrgi(id, super.getOrgi(request));
|
AgentUser agentUser = agentUserRes.findByIdAndOrgi(id, super.getOrgi(request));
|
||||||
|
|
||||||
if (agentUser != null) {
|
if (agentUser != null) {
|
||||||
Page<ChatMessage> agentUserMessageList = null;
|
Page<ChatMessage> agentUserMessageList;
|
||||||
if (condition.equals("label")) {
|
if (condition.equals("label")) {
|
||||||
agentUserMessageList = this.chatMessageRes.findByislabel(
|
agentUserMessageList = this.chatMessageRes.findByislabel(
|
||||||
agentUser.getUserid(), search, new PageRequest(0, 9999, Direction.DESC, "updatetime"));
|
agentUser.getUserid(), search, new PageRequest(0, 9999, Direction.DESC, "updatetime"));
|
||||||
@ -337,11 +315,10 @@
|
|||||||
@RequestMapping("/agentusersearchdetails")
|
@RequestMapping("/agentusersearchdetails")
|
||||||
@Menu(type = "apps", subtype = "agent")
|
@Menu(type = "apps", subtype = "agent")
|
||||||
public ModelAndView agentusersearchdetails(
|
public ModelAndView agentusersearchdetails(
|
||||||
ModelMap map,
|
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
String id,
|
String id,
|
||||||
String createtime,
|
String createtime,
|
||||||
String thisid) throws IOException, TemplateException, ParseException {
|
String thisid) throws ParseException {
|
||||||
String mainagentuserconter = "/apps/agent/mainagentuserconter";
|
String mainagentuserconter = "/apps/agent/mainagentuserconter";
|
||||||
ModelAndView view = request(super.createRequestPageTempletResponse(mainagentuserconter));
|
ModelAndView view = request(super.createRequestPageTempletResponse(mainagentuserconter));
|
||||||
AgentUser agentUser = agentUserRes.findByIdAndOrgi(id, super.getOrgi(request));
|
AgentUser agentUser = agentUserRes.findByIdAndOrgi(id, super.getOrgi(request));
|
||||||
@ -411,14 +388,16 @@
|
|||||||
"updatetime")));
|
"updatetime")));
|
||||||
AgentService agentService = null;
|
AgentService agentService = null;
|
||||||
if (StringUtils.isNotBlank(agentUser.getAgentserviceid())) {
|
if (StringUtils.isNotBlank(agentUser.getAgentserviceid())) {
|
||||||
agentService = this.agentServiceRes.findOne(agentUser.getAgentserviceid());
|
Optional<AgentService> optional = this.agentServiceRes.findById(agentUser.getAgentserviceid());
|
||||||
view.addObject("curAgentService", agentService);
|
/*
|
||||||
if (agentService != null) {
|
|
||||||
/**
|
|
||||||
* 获取关联数据
|
* 获取关联数据
|
||||||
*/
|
*/
|
||||||
|
if (optional.isPresent()) {
|
||||||
|
agentService = optional.get();
|
||||||
agentServiceProxy.processRelaData(logined.getId(), orgi, agentService, map);
|
agentServiceProxy.processRelaData(logined.getId(), orgi, agentService, map);
|
||||||
}
|
}
|
||||||
|
//noinspection OptionalGetWithoutIsPresent
|
||||||
|
view.addObject("curAgentService", optional.get());
|
||||||
}
|
}
|
||||||
if (MainContext.ChannelType.WEIXIN.toString().equals(agentUser.getChannel())) {
|
if (MainContext.ChannelType.WEIXIN.toString().equals(agentUser.getChannel())) {
|
||||||
List<WeiXinUser> weiXinUserList = weiXinUserRes.findByOpenidAndOrgi(agentUser.getUserid(), orgi);
|
List<WeiXinUser> weiXinUserList = weiXinUserRes.findByOpenidAndOrgi(agentUser.getUserid(), orgi);
|
||||||
@ -427,8 +406,8 @@
|
|||||||
view.addObject("weiXinUser", weiXinUser);
|
view.addObject("weiXinUser", weiXinUser);
|
||||||
}
|
}
|
||||||
} else if (MainContext.ChannelType.WEBIM.toString().equals(agentUser.getChannel())) {
|
} else if (MainContext.ChannelType.WEBIM.toString().equals(agentUser.getChannel())) {
|
||||||
OnlineUser onlineUser = onlineUserRes.findOne(agentUser.getUserid());
|
onlineUserRes.findById(agentUser.getUserid())
|
||||||
if (onlineUser != null) {
|
.ifPresent(onlineUser -> {
|
||||||
if (onlineUser.getLogintime() != null) {
|
if (onlineUser.getLogintime() != null) {
|
||||||
if (MainContext.OnlineUserStatusEnum.OFFLINE.toString().equals(onlineUser.getStatus())) {
|
if (MainContext.OnlineUserStatusEnum.OFFLINE.toString().equals(onlineUser.getStatus())) {
|
||||||
onlineUser.setBetweentime(
|
onlineUser.setBetweentime(
|
||||||
@ -439,7 +418,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
view.addObject("onlineUser", onlineUser);
|
view.addObject("onlineUser", onlineUser);
|
||||||
}
|
});
|
||||||
} else if (MainContext.ChannelType.PHONE.toString().equals(agentUser.getChannel())) {
|
} else if (MainContext.ChannelType.PHONE.toString().equals(agentUser.getChannel())) {
|
||||||
if (agentService != null && StringUtils.isNotBlank(agentService.getOwner())) {
|
if (agentService != null && StringUtils.isNotBlank(agentService.getOwner())) {
|
||||||
StatusEvent statusEvent = this.statusEventRes.findById(agentService.getOwner());
|
StatusEvent statusEvent = this.statusEventRes.findById(agentService.getOwner());
|
||||||
@ -454,12 +433,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
view.addObject("serviceCount", Integer
|
view.addObject("serviceCount", this.agentServiceRes
|
||||||
.valueOf(this.agentServiceRes
|
.countByUseridAndOrgiAndStatus(agentUser.getUserid(), orgi, MainContext.AgentUserStatusEnum.END.toString()));
|
||||||
.countByUseridAndOrgiAndStatus(agentUser
|
|
||||||
.getUserid(), orgi,
|
|
||||||
MainContext.AgentUserStatusEnum.END
|
|
||||||
.toString())));
|
|
||||||
view.addObject("tagRelationList", tagRelationRes.findByUserid(agentUser.getUserid()));
|
view.addObject("tagRelationList", tagRelationRes.findByUserid(agentUser.getUserid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,6 +492,7 @@
|
|||||||
if (MainContext.hasModule(Constants.CSKEFU_MODULE_WORKORDERS) && StringUtils.isNotBlank(contactsid)) {
|
if (MainContext.hasModule(Constants.CSKEFU_MODULE_WORKORDERS) && StringUtils.isNotBlank(contactsid)) {
|
||||||
DataExchangeInterface dataExchange = (DataExchangeInterface) MainContext.getContext().getBean(
|
DataExchangeInterface dataExchange = (DataExchangeInterface) MainContext.getContext().getBean(
|
||||||
"workorders");
|
"workorders");
|
||||||
|
//noinspection ConstantConditions
|
||||||
if (dataExchange != null) {
|
if (dataExchange != null) {
|
||||||
map.addAttribute(
|
map.addAttribute(
|
||||||
"workOrdersList",
|
"workOrdersList",
|
||||||
@ -530,9 +506,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置为就绪,置闲
|
* 设置为就绪,置闲
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/ready")
|
@RequestMapping(value = "/ready")
|
||||||
@Menu(type = "apps", subtype = "agent")
|
@Menu(type = "apps", subtype = "agent")
|
||||||
@ -563,9 +536,6 @@
|
|||||||
/**
|
/**
|
||||||
* 将一个已经就绪的坐席设置为未就绪的状态
|
* 将一个已经就绪的坐席设置为未就绪的状态
|
||||||
* 这个接口并不会重新分配坐席的现在的服务中的访客给其它坐席
|
* 这个接口并不会重新分配坐席的现在的服务中的访客给其它坐席
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/notready")
|
@RequestMapping(value = "/notready")
|
||||||
@Menu(type = "apps", subtype = "agent")
|
@Menu(type = "apps", subtype = "agent")
|
||||||
@ -600,9 +570,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置状态:就绪,置忙
|
* 设置状态:就绪,置忙
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/busy")
|
@RequestMapping(value = "/busy")
|
||||||
@Menu(type = "apps", subtype = "agent")
|
@Menu(type = "apps", subtype = "agent")
|
||||||
@ -635,9 +602,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置状态:就绪,置闲
|
* 设置状态:就绪,置闲
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/notbusy")
|
@RequestMapping(value = "/notbusy")
|
||||||
@Menu(type = "apps", subtype = "agent")
|
@Menu(type = "apps", subtype = "agent")
|
||||||
@ -678,13 +642,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/clean")
|
@RequestMapping(value = "/clean")
|
||||||
@Menu(type = "apps", subtype = "clean", access = false)
|
@Menu(type = "apps", subtype = "clean")
|
||||||
public ModelAndView clean(HttpServletRequest request) throws Exception {
|
public ModelAndView clean(HttpServletRequest request) throws Exception {
|
||||||
final String orgi = super.getOrgi(request);
|
final String orgi = super.getOrgi(request);
|
||||||
List<AgentUser> agentUserList = agentUserRes.findByAgentnoAndStatusAndOrgi(
|
List<AgentUser> agentUserList = agentUserRes.findByAgentnoAndStatusAndOrgi(
|
||||||
super.getUser(request).getId(), MainContext.AgentUserStatusEnum.END.toString(),
|
super.getUser(request).getId(), MainContext.AgentUserStatusEnum.END.toString(),
|
||||||
super.getOrgi(request));
|
super.getOrgi(request));
|
||||||
List<AgentService> agentServiceList = new ArrayList<AgentService>();
|
List<AgentService> agentServiceList = new ArrayList<>();
|
||||||
for (AgentUser agentUser : agentUserList) {
|
for (AgentUser agentUser : agentUserList) {
|
||||||
if (agentUser != null && super.getUser(request).getId().equals(agentUser.getAgentno())) {
|
if (agentUser != null && super.getUser(request).getId().equals(agentUser.getAgentno())) {
|
||||||
acdAgentService.finishAgentUser(agentUser, orgi);
|
acdAgentService.finishAgentUser(agentUser, orgi);
|
||||||
@ -695,7 +659,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
agentServiceRes.save(agentServiceList);
|
agentServiceRes.saveAll(agentServiceList);
|
||||||
return request(super
|
return request(super
|
||||||
.createRequestPageTempletResponse("redirect:/agent/index.html"));
|
.createRequestPageTempletResponse("redirect:/agent/index.html"));
|
||||||
}
|
}
|
||||||
@ -704,11 +668,6 @@
|
|||||||
/**
|
/**
|
||||||
* 结束对话
|
* 结束对话
|
||||||
* 如果当前对话属于登录用户或登录用户为超级用户,则可以结束这个对话
|
* 如果当前对话属于登录用户或登录用户为超级用户,则可以结束这个对话
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping({"/end"})
|
@RequestMapping({"/end"})
|
||||||
@Menu(type = "apps", subtype = "agent")
|
@Menu(type = "apps", subtype = "agent")
|
||||||
@ -752,8 +711,7 @@
|
|||||||
|
|
||||||
@RequestMapping({"/blacklist/add"})
|
@RequestMapping({"/blacklist/add"})
|
||||||
@Menu(type = "apps", subtype = "blacklist")
|
@Menu(type = "apps", subtype = "blacklist")
|
||||||
public ModelAndView blacklistadd(ModelMap map, HttpServletRequest request, @Valid String agentuserid, @Valid String agentserviceid, @Valid String userid)
|
public ModelAndView blacklistadd(ModelMap map, HttpServletRequest request, @Valid String agentuserid, @Valid String agentserviceid, @Valid String userid) {
|
||||||
throws Exception {
|
|
||||||
map.addAttribute("agentuserid", agentuserid);
|
map.addAttribute("agentuserid", agentuserid);
|
||||||
map.addAttribute("agentserviceid", agentserviceid);
|
map.addAttribute("agentserviceid", agentserviceid);
|
||||||
map.addAttribute("userid", userid);
|
map.addAttribute("userid", userid);
|
||||||
@ -777,7 +735,7 @@
|
|||||||
if (StringUtils.isBlank(userid)) {
|
if (StringUtils.isBlank(userid)) {
|
||||||
throw new CSKefuException("Invalid userid");
|
throw new CSKefuException("Invalid userid");
|
||||||
}
|
}
|
||||||
/**
|
/*
|
||||||
* 添加黑名单
|
* 添加黑名单
|
||||||
* 一定时间后触发函数
|
* 一定时间后触发函数
|
||||||
*/
|
*/
|
||||||
@ -800,7 +758,7 @@
|
|||||||
|
|
||||||
@RequestMapping("/tagrelation")
|
@RequestMapping("/tagrelation")
|
||||||
@Menu(type = "apps", subtype = "tagrelation")
|
@Menu(type = "apps", subtype = "tagrelation")
|
||||||
public ModelAndView tagrelation(ModelMap map, HttpServletRequest request, @Valid String userid, @Valid String tagid, @Valid String dataid) {
|
public ModelAndView tagrelation(@Valid String userid, @Valid String tagid, @Valid String dataid) {
|
||||||
TagRelation tagRelation = tagRelationRes.findByUseridAndTagid(userid, tagid);
|
TagRelation tagRelation = tagRelationRes.findByUseridAndTagid(userid, tagid);
|
||||||
if (tagRelation == null) {
|
if (tagRelation == null) {
|
||||||
tagRelation = new TagRelation();
|
tagRelation = new TagRelation();
|
||||||
@ -817,16 +775,10 @@
|
|||||||
/**
|
/**
|
||||||
* 坐席聊天时发送图片和文件
|
* 坐席聊天时发送图片和文件
|
||||||
*
|
*
|
||||||
* @param map
|
|
||||||
* @param request
|
|
||||||
* @param multipart
|
|
||||||
* @param id
|
|
||||||
* @param paste 是否是粘贴到chatbox的图片事件,此时发送者还没有执行发送
|
* @param paste 是否是粘贴到chatbox的图片事件,此时发送者还没有执行发送
|
||||||
* @return
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/image/upload")
|
@RequestMapping("/image/upload")
|
||||||
@Menu(type = "im", subtype = "image", access = false)
|
@Menu(type = "im", subtype = "image")
|
||||||
public ModelAndView upload(
|
public ModelAndView upload(
|
||||||
ModelMap map,
|
ModelMap map,
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
@ -840,7 +792,8 @@
|
|||||||
UploadStatus notify;
|
UploadStatus notify;
|
||||||
final AgentUser agentUser = agentUserRes.findByIdAndOrgi(id, orgi);
|
final AgentUser agentUser = agentUserRes.findByIdAndOrgi(id, orgi);
|
||||||
|
|
||||||
if (multipart != null && multipart.getOriginalFilename().lastIndexOf(".") > 0) {
|
if (multipart != null && multipart.getOriginalFilename() != null &&
|
||||||
|
multipart.getOriginalFilename().lastIndexOf(".") > 0) {
|
||||||
try {
|
try {
|
||||||
StreamingFile sf = agentProxy.saveFileIntoMySQLBlob(logined, multipart);
|
StreamingFile sf = agentProxy.saveFileIntoMySQLBlob(logined, multipart);
|
||||||
// 发送通知
|
// 发送通知
|
||||||
@ -860,22 +813,17 @@
|
|||||||
|
|
||||||
@RequestMapping("/message/image")
|
@RequestMapping("/message/image")
|
||||||
@Menu(type = "resouce", subtype = "image", access = true)
|
@Menu(type = "resouce", subtype = "image", access = true)
|
||||||
public ModelAndView messageimage(HttpServletResponse response, ModelMap map, @Valid String id, @Valid String t) throws IOException {
|
public ModelAndView messageimage(ModelMap map, @Valid String id) {
|
||||||
ChatMessage message = chatMessageRes.findById(id);
|
ChatMessage message = chatMessageRes.findById(id);
|
||||||
map.addAttribute("chatMessage", message);
|
map.addAttribute("chatMessage", message);
|
||||||
map.addAttribute("agentUser", cache.findOneAgentUserByUserIdAndOrgi(message.getUserid(), message.getOrgi()));
|
map.addAttribute("agentUser", cache.findOneAgentUserByUserIdAndOrgi(message.getUserid(), message.getOrgi()));
|
||||||
/*if(StringUtils.isNotBlank(t)){
|
|
||||||
map.addAttribute("t", t) ;
|
|
||||||
}*/
|
|
||||||
map.addAttribute("t", true);
|
map.addAttribute("t", true);
|
||||||
return request(super.createRequestPageTempletResponse("/apps/agent/media/messageimage"));
|
return request(super.createRequestPageTempletResponse("/apps/agent/media/messageimage"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/message/image/upload")
|
@RequestMapping("/message/image/upload")
|
||||||
@Menu(type = "im", subtype = "image", access = false)
|
@Menu(type = "im", subtype = "image")
|
||||||
public ModelAndView messageimage(
|
public ModelAndView messageimage(
|
||||||
ModelMap map,
|
|
||||||
HttpServletRequest request,
|
|
||||||
@RequestParam(value = "image", required = false) MultipartFile image,
|
@RequestParam(value = "image", required = false) MultipartFile image,
|
||||||
@Valid String id,
|
@Valid String id,
|
||||||
@Valid String userid,
|
@Valid String userid,
|
||||||
@ -886,6 +834,7 @@
|
|||||||
try {
|
try {
|
||||||
// 创建临时图片文件
|
// 创建临时图片文件
|
||||||
if (!tempFile.getParentFile().exists()) {
|
if (!tempFile.getParentFile().exists()) {
|
||||||
|
//noinspection ResultOfMethodCallIgnored
|
||||||
tempFile.getParentFile().mkdirs();
|
tempFile.getParentFile().mkdirs();
|
||||||
}
|
}
|
||||||
// 写入临时文件
|
// 写入临时文件
|
||||||
@ -900,8 +849,9 @@
|
|||||||
MainUtils.scaleImage(imageFile, tempFile, 0.1F);
|
MainUtils.scaleImage(imageFile, tempFile, 0.1F);
|
||||||
|
|
||||||
// 保存到数据库
|
// 保存到数据库
|
||||||
StreamingFile sf = streamingFileRes.findOne(fileid);
|
Optional<StreamingFile> optional = streamingFileRes.findById(fileid);
|
||||||
if (sf != null) {
|
if (optional.isPresent()) {
|
||||||
|
StreamingFile sf = optional.get();
|
||||||
sf.setCooperation(jpaBlobHelper.createBlobWithFile(imageFile));
|
sf.setCooperation(jpaBlobHelper.createBlobWithFile(imageFile));
|
||||||
streamingFileRes.save(sf);
|
streamingFileRes.save(sf);
|
||||||
}
|
}
|
||||||
@ -929,6 +879,7 @@
|
|||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
if (tempFile.exists()) {
|
if (tempFile.exists()) {
|
||||||
|
//noinspection ResultOfMethodCallIgnored
|
||||||
tempFile.delete();
|
tempFile.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -940,13 +891,10 @@
|
|||||||
/**
|
/**
|
||||||
* 坐席会话关联联系人
|
* 坐席会话关联联系人
|
||||||
*
|
*
|
||||||
* @param map
|
|
||||||
* @param request
|
|
||||||
* @param contactsid 联系人ID
|
* @param contactsid 联系人ID
|
||||||
* @param userid 访客ID
|
* @param userid 访客ID
|
||||||
* @param agentserviceid 坐席服务ID
|
* @param agentserviceid 坐席服务ID
|
||||||
* @param agentuserid 坐席ID
|
* @param agentuserid 坐席ID
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/contacts")
|
@RequestMapping(value = "/contacts")
|
||||||
@Menu(type = "apps", subtype = "contacts")
|
@Menu(type = "apps", subtype = "contacts")
|
||||||
@ -956,7 +904,7 @@
|
|||||||
@Valid String contactsid,
|
@Valid String contactsid,
|
||||||
@Valid String userid,
|
@Valid String userid,
|
||||||
@Valid String agentserviceid,
|
@Valid String agentserviceid,
|
||||||
@Valid String agentuserid) throws CSKefuException {
|
@Valid String agentuserid) {
|
||||||
logger.info(
|
logger.info(
|
||||||
"[contacts] contactsid {}, userid {}, agentserviceid {}, agentuserid {}", contactsid, userid,
|
"[contacts] contactsid {}, userid {}, agentserviceid {}, agentuserid {}", contactsid, userid,
|
||||||
agentserviceid, agentuserid);
|
agentserviceid, agentuserid);
|
||||||
@ -966,15 +914,14 @@
|
|||||||
|
|
||||||
if (StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(contactsid)) {
|
if (StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(contactsid)) {
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 获得联系人
|
* 获得联系人
|
||||||
*/
|
*/
|
||||||
Contacts contacts = contactsRes.findOne(contactsid);
|
Contacts contacts = contactsRes.findById(contactsid)
|
||||||
if (contacts != null) {
|
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Contacts %s not found", contactsid)));
|
||||||
map.addAttribute("contacts", contacts);
|
map.addAttribute("contacts", contacts);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 在关联联系人后,更新AgentUser的显示的名字
|
* 在关联联系人后,更新AgentUser的显示的名字
|
||||||
*/
|
*/
|
||||||
AgentUser agentUser = agentUserRes.findByIdAndOrgi(agentuserid, orgi);
|
AgentUser agentUser = agentUserRes.findByIdAndOrgi(agentuserid, orgi);
|
||||||
@ -984,17 +931,17 @@
|
|||||||
agentUserRes.save(agentUser);
|
agentUserRes.save(agentUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 更新OnlineUser
|
* 更新OnlineUser
|
||||||
*/
|
*/
|
||||||
OnlineUser onlineUser = onlineUserRes.findOneByUseridAndOrgi(userid, agentUser.getOrgi());
|
OnlineUser onlineUser = onlineUserRes.findOneByUseridAndOrgi(userid, orgi);
|
||||||
onlineUser.setContactsid(contactsid);
|
onlineUser.setContactsid(contactsid);
|
||||||
onlineUser.setUsername(contacts.getName());
|
onlineUser.setUsername(contacts.getName());
|
||||||
onlineUser.setUpdateuser(logined.getUname());
|
onlineUser.setUpdateuser(logined.getUname());
|
||||||
onlineUserRes.save(onlineUser);
|
onlineUserRes.save(onlineUser);
|
||||||
|
|
||||||
AgentService agentService = agentServiceRes.findOne(agentserviceid);
|
agentServiceRes.findById(agentserviceid)
|
||||||
if (agentService != null) {
|
.ifPresent(agentService -> {
|
||||||
agentService.setContactsid(contactsid);
|
agentService.setContactsid(contactsid);
|
||||||
agentService.setUsername(contacts.getName());
|
agentService.setUsername(contacts.getName());
|
||||||
agentServiceRes.save(agentService);
|
agentServiceRes.save(agentService);
|
||||||
@ -1015,7 +962,7 @@
|
|||||||
agentUserContacts.setChannel(agentService.getChannel());
|
agentUserContacts.setChannel(agentService.getChannel());
|
||||||
|
|
||||||
agentUserContactsRes.save(agentUserContacts);
|
agentUserContactsRes.save(agentUserContacts);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
return request(super.createRequestPageTempletResponse("/apps/agent/contacts"));
|
return request(super.createRequestPageTempletResponse("/apps/agent/contacts"));
|
||||||
}
|
}
|
||||||
@ -1023,16 +970,11 @@
|
|||||||
|
|
||||||
@RequestMapping(value = "/clean/associated")
|
@RequestMapping(value = "/clean/associated")
|
||||||
@Menu(type = "apps", subtype = "cleanassociated")
|
@Menu(type = "apps", subtype = "cleanassociated")
|
||||||
public ModelAndView cleanAssociated(ModelMap map, HttpServletRequest request, final @RequestParam String currentAgentUserContactsId) {
|
public ModelAndView cleanAssociated(final @RequestParam String currentAgentUserContactsId) {
|
||||||
String contactsid = null;
|
|
||||||
final String orgi = super.getOrgi(request);
|
|
||||||
if (StringUtils.isNotEmpty(currentAgentUserContactsId)) {
|
if (StringUtils.isNotEmpty(currentAgentUserContactsId)) {
|
||||||
AgentUserContacts agentUserContacts = agentUserContactsRes.getOne(currentAgentUserContactsId);
|
agentUserContactsRes.findById(currentAgentUserContactsId)
|
||||||
if (agentUserContacts != null) {
|
.ifPresent(agentUserContactsRes::delete);
|
||||||
agentUserContactsRes.delete(agentUserContacts);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return request(super.createRequestPageTempletResponse("/apps/agent/contacts"));
|
return request(super.createRequestPageTempletResponse("/apps/agent/contacts"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1092,7 +1034,6 @@
|
|||||||
@RequestMapping(value = "/summary/save")
|
@RequestMapping(value = "/summary/save")
|
||||||
@Menu(type = "apps", subtype = "summarysave")
|
@Menu(type = "apps", subtype = "summarysave")
|
||||||
public ModelAndView summarysave(
|
public ModelAndView summarysave(
|
||||||
ModelMap map,
|
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
@Valid AgentServiceSummary summary,
|
@Valid AgentServiceSummary summary,
|
||||||
@Valid String contactsid,
|
@Valid String contactsid,
|
||||||
@ -1125,13 +1066,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 坐席转接窗口
|
* 坐席转接窗口
|
||||||
*
|
|
||||||
* @param map
|
|
||||||
* @param request
|
|
||||||
* @param userid
|
|
||||||
* @param agentserviceid
|
|
||||||
* @param agentuserid
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/transfer")
|
@RequestMapping(value = "/transfer")
|
||||||
@Menu(type = "apps", subtype = "transfer")
|
@Menu(type = "apps", subtype = "transfer")
|
||||||
@ -1149,7 +1083,7 @@
|
|||||||
final List<Organ> skillGroups = OnlineUserProxy.organ(orgi, true);
|
final List<Organ> skillGroups = OnlineUserProxy.organ(orgi, true);
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (final Organ organ : skillGroups) {
|
for (final Organ organ : skillGroups) {
|
||||||
sb.append(organ.getId());
|
sb.append(organ.getId());
|
||||||
sb.append(":");
|
sb.append(":");
|
||||||
@ -1161,7 +1095,7 @@
|
|||||||
|
|
||||||
// 选择当前用户的默认技能组
|
// 选择当前用户的默认技能组
|
||||||
Set<String> organs = logined.getOrgans().keySet();
|
Set<String> organs = logined.getOrgans().keySet();
|
||||||
String currentOrgan = organs.size() > 0 ? (new ArrayList<String>(organs)).get(0) : null;
|
String currentOrgan = organs.size() > 0 ? (new ArrayList<>(organs)).get(0) : null;
|
||||||
|
|
||||||
if (StringUtils.isBlank(currentOrgan)) {
|
if (StringUtils.isBlank(currentOrgan)) {
|
||||||
if (!skillGroups.isEmpty()) {
|
if (!skillGroups.isEmpty()) {
|
||||||
@ -1185,7 +1119,7 @@
|
|||||||
|
|
||||||
logger.info("[transfer] get all userids except mine, {}", StringUtils.join(userids, "\t"));
|
logger.info("[transfer] get all userids except mine, {}", StringUtils.join(userids, "\t"));
|
||||||
|
|
||||||
final List<User> userList = userRes.findAll(userids);
|
final List<User> userList = userRes.findAllById(userids);
|
||||||
for (final User o : userList) {
|
for (final User o : userList) {
|
||||||
o.setAgentStatus(agentStatusMap.get(o.getId()));
|
o.setAgentStatus(agentStatusMap.get(o.getId()));
|
||||||
// find user's skills
|
// find user's skills
|
||||||
@ -1206,11 +1140,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找一个组织机构中的在线坐席
|
* 查找一个组织机构中的在线坐席
|
||||||
*
|
|
||||||
* @param map
|
|
||||||
* @param request
|
|
||||||
* @param organ
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/transfer/agent")
|
@RequestMapping(value = "/transfer/agent")
|
||||||
@Menu(type = "apps", subtype = "transferagent")
|
@Menu(type = "apps", subtype = "transferagent")
|
||||||
@ -1221,7 +1150,7 @@
|
|||||||
final User logined = super.getUser(request);
|
final User logined = super.getUser(request);
|
||||||
final String orgi = super.getOrgi(request);
|
final String orgi = super.getOrgi(request);
|
||||||
if (StringUtils.isNotBlank(organ)) {
|
if (StringUtils.isNotBlank(organ)) {
|
||||||
List<String> usersids = new ArrayList<String>();
|
List<String> usersids = new ArrayList<>();
|
||||||
final List<AgentStatus> agentStatusList = cache.getAgentStatusBySkillAndOrgi(organ, orgi);
|
final List<AgentStatus> agentStatusList = cache.getAgentStatusBySkillAndOrgi(organ, orgi);
|
||||||
if (agentStatusList.size() > 0) {
|
if (agentStatusList.size() > 0) {
|
||||||
for (AgentStatus agentStatus : agentStatusList) {
|
for (AgentStatus agentStatus : agentStatusList) {
|
||||||
@ -1230,7 +1159,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<User> userList = userRes.findAll(usersids);
|
List<User> userList = userRes.findAllById(usersids);
|
||||||
for (User user : userList) {
|
for (User user : userList) {
|
||||||
userProxy.attachOrgansPropertiesForUser(user);
|
userProxy.attachOrgansPropertiesForUser(user);
|
||||||
for (final AgentStatus as : agentStatusList) {
|
for (final AgentStatus as : agentStatusList) {
|
||||||
@ -1283,7 +1212,7 @@
|
|||||||
|
|
||||||
@RequestMapping("/quickreply/save")
|
@RequestMapping("/quickreply/save")
|
||||||
@Menu(type = "setting", subtype = "quickreply", admin = true)
|
@Menu(type = "setting", subtype = "quickreply", admin = true)
|
||||||
public ModelAndView quickreplysave(ModelMap map, HttpServletRequest request, @Valid QuickReply quickReply) {
|
public ModelAndView quickreplysave(HttpServletRequest request, @Valid QuickReply quickReply) {
|
||||||
if (StringUtils.isNotBlank(quickReply.getTitle()) && StringUtils.isNotBlank(quickReply.getContent())) {
|
if (StringUtils.isNotBlank(quickReply.getTitle()) && StringUtils.isNotBlank(quickReply.getContent())) {
|
||||||
quickReply.setOrgi(super.getOrgi(request));
|
quickReply.setOrgi(super.getOrgi(request));
|
||||||
quickReply.setCreater(super.getUser(request).getId());
|
quickReply.setCreater(super.getUser(request).getId());
|
||||||
@ -1296,19 +1225,31 @@
|
|||||||
|
|
||||||
@RequestMapping("/quickreply/delete")
|
@RequestMapping("/quickreply/delete")
|
||||||
@Menu(type = "setting", subtype = "quickreply", admin = true)
|
@Menu(type = "setting", subtype = "quickreply", admin = true)
|
||||||
public ModelAndView quickreplydelete(ModelMap map, HttpServletRequest request, @Valid String id) {
|
public ModelAndView quickreplydelete(@Valid String id) {
|
||||||
QuickReply quickReply = quickReplyRes.findOne(id);
|
QuickReply quickReply = requireQuickReply(id);
|
||||||
if (quickReply != null) {
|
|
||||||
quickReplyRes.delete(quickReply);
|
quickReplyRes.delete(quickReply);
|
||||||
}
|
|
||||||
return request(super.createRequestPageTempletResponse(
|
return request(super.createRequestPageTempletResponse(
|
||||||
"redirect:/agent/quicklist.html?typeid=" + quickReply.getCate()));
|
"redirect:/agent/quicklist.html?typeid=" + quickReply.getCate()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private QuickReply requireQuickReply(@Valid String id) {
|
||||||
|
return quickReplyRes.findById(id)
|
||||||
|
.orElseThrow(() -> {
|
||||||
|
String reason = String.format("Quick reply %s not found", id);
|
||||||
|
return new ResponseStatusException(HttpStatus.NOT_FOUND, reason);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private QuickReply optionalQuickReply(@Valid String id) {
|
||||||
|
return quickReplyRes.findById(id).orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping("/quickreply/edit")
|
@RequestMapping("/quickreply/edit")
|
||||||
@Menu(type = "setting", subtype = "quickreply", admin = true)
|
@Menu(type = "setting", subtype = "quickreply", admin = true)
|
||||||
public ModelAndView quickreplyedit(ModelMap map, HttpServletRequest request, @Valid String id) {
|
public ModelAndView quickreplyedit(ModelMap map, HttpServletRequest request, @Valid String id) {
|
||||||
QuickReply quickReply = quickReplyRes.findOne(id);
|
QuickReply quickReply = optionalQuickReply(id);
|
||||||
map.put("quickReply", quickReply);
|
map.put("quickReply", quickReply);
|
||||||
if (quickReply != null) {
|
if (quickReply != null) {
|
||||||
map.put("quickType", quickTypeRes.findByIdAndOrgi(quickReply.getCate(), super.getOrgi(request)));
|
map.put("quickType", quickTypeRes.findByIdAndOrgi(quickReply.getCate(), super.getOrgi(request)));
|
||||||
@ -1322,9 +1263,9 @@
|
|||||||
|
|
||||||
@RequestMapping("/quickreply/update")
|
@RequestMapping("/quickreply/update")
|
||||||
@Menu(type = "setting", subtype = "quickreply", admin = true)
|
@Menu(type = "setting", subtype = "quickreply", admin = true)
|
||||||
public ModelAndView quickreplyupdate(ModelMap map, HttpServletRequest request, @Valid QuickReply quickReply) {
|
public ModelAndView quickreplyupdate(HttpServletRequest request, @Valid QuickReply quickReply) {
|
||||||
if (StringUtils.isNotBlank(quickReply.getId())) {
|
if (StringUtils.isNotBlank(quickReply.getId())) {
|
||||||
QuickReply temp = quickReplyRes.findOne(quickReply.getId());
|
QuickReply temp = optionalQuickReply(quickReply.getId());
|
||||||
quickReply.setOrgi(super.getOrgi(request));
|
quickReply.setOrgi(super.getOrgi(request));
|
||||||
quickReply.setCreater(super.getUser(request).getId());
|
quickReply.setCreater(super.getUser(request).getId());
|
||||||
if (temp != null) {
|
if (temp != null) {
|
||||||
@ -1396,7 +1337,7 @@
|
|||||||
|
|
||||||
@RequestMapping({"/quickreply/deletetype"})
|
@RequestMapping({"/quickreply/deletetype"})
|
||||||
@Menu(type = "apps", subtype = "kbs")
|
@Menu(type = "apps", subtype = "kbs")
|
||||||
public ModelAndView deletetype(ModelMap map, HttpServletRequest request, @Valid String id) {
|
public ModelAndView deletetype(HttpServletRequest request, @Valid String id) {
|
||||||
QuickType tempQuickType = quickTypeRes.findByIdAndOrgi(id, super.getOrgi(request));
|
QuickType tempQuickType = quickTypeRes.findByIdAndOrgi(id, super.getOrgi(request));
|
||||||
if (tempQuickType != null) {
|
if (tempQuickType != null) {
|
||||||
quickTypeRes.delete(tempQuickType);
|
quickTypeRes.delete(tempQuickType);
|
||||||
@ -1404,7 +1345,7 @@
|
|||||||
Page<QuickReply> quickReplyList = quickReplyRes.getByOrgiAndCate(
|
Page<QuickReply> quickReplyList = quickReplyRes.getByOrgiAndCate(
|
||||||
super.getOrgi(request), id, null, new PageRequest(0, 10000));
|
super.getOrgi(request), id, null, new PageRequest(0, 10000));
|
||||||
|
|
||||||
quickReplyRes.delete(quickReplyList.getContent());
|
quickReplyRes.deleteAll(quickReplyList.getContent());
|
||||||
}
|
}
|
||||||
return request(super.createRequestPageTempletResponse(
|
return request(super.createRequestPageTempletResponse(
|
||||||
"redirect:/agent/quicklist.html" + (tempQuickType != null ? "?typeid=" + tempQuickType.getParentid() : "")));
|
"redirect:/agent/quicklist.html" + (tempQuickType != null ? "?typeid=" + tempQuickType.getParentid() : "")));
|
||||||
@ -1412,8 +1353,8 @@
|
|||||||
|
|
||||||
@RequestMapping({"/quickreply/content"})
|
@RequestMapping({"/quickreply/content"})
|
||||||
@Menu(type = "apps", subtype = "quickreply")
|
@Menu(type = "apps", subtype = "quickreply")
|
||||||
public ModelAndView quickreplycontent(ModelMap map, HttpServletRequest request, @Valid String id) {
|
public ModelAndView quickreplycontent(ModelMap map, @Valid String id) {
|
||||||
QuickReply quickReply = quickReplyRes.findOne(id);
|
QuickReply quickReply = optionalQuickReply(id);
|
||||||
if (quickReply != null) {
|
if (quickReply != null) {
|
||||||
map.addAttribute("quickReply", quickReply);
|
map.addAttribute("quickReply", quickReply);
|
||||||
}
|
}
|
||||||
@ -1422,7 +1363,7 @@
|
|||||||
|
|
||||||
@RequestMapping("/calloutcontact/add")
|
@RequestMapping("/calloutcontact/add")
|
||||||
@Menu(type = "apps", subtype = "calloutcontact", admin = true)
|
@Menu(type = "apps", subtype = "calloutcontact", admin = true)
|
||||||
public ModelAndView add(ModelMap map, HttpServletRequest request, @Valid String ckind) {
|
public ModelAndView add(ModelMap map, @Valid String ckind) {
|
||||||
map.addAttribute("ckind", ckind);
|
map.addAttribute("ckind", ckind);
|
||||||
return request(super.createRequestPageTempletResponse("/apps/agent/calloutcontact/add"));
|
return request(super.createRequestPageTempletResponse("/apps/agent/calloutcontact/add"));
|
||||||
}
|
}
|
||||||
@ -1430,15 +1371,12 @@
|
|||||||
@RequestMapping(value = "/calloutcontact/save")
|
@RequestMapping(value = "/calloutcontact/save")
|
||||||
@Menu(type = "apps", subtype = "calloutcontact")
|
@Menu(type = "apps", subtype = "calloutcontact")
|
||||||
public ModelAndView calloutcontactsave(
|
public ModelAndView calloutcontactsave(
|
||||||
ModelMap map,
|
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
@RequestParam(value = "agentuser", required = true) String agentuser,
|
@RequestParam(value = "agentuser") String agentuser,
|
||||||
@Valid Contacts contacts) throws CSKefuException {
|
@Valid Contacts contacts) throws CSKefuException {
|
||||||
logger.info("[agent ctrl] calloutcontactsave agentuser [{}]", agentuser);
|
logger.info("[agent ctrl] calloutcontactsave agentuser [{}]", agentuser);
|
||||||
AgentUser au = agentUserRes.findOne(agentuser);
|
AgentUser au = agentUserRes.findById(agentuser)
|
||||||
if (au == null) {
|
.orElseThrow(() -> new CSKefuException("不存在该服务记录"));
|
||||||
throw new CSKefuException("不存在该服务记录");
|
|
||||||
}
|
|
||||||
|
|
||||||
User logined = super.getUser(request);
|
User logined = super.getUser(request);
|
||||||
contacts.setId(MainUtils.getUUID());
|
contacts.setId(MainUtils.getUUID());
|
||||||
@ -1467,8 +1405,8 @@
|
|||||||
@RequestMapping("/calloutcontact/update")
|
@RequestMapping("/calloutcontact/update")
|
||||||
@Menu(type = "apps", subtype = "calloutcontact")
|
@Menu(type = "apps", subtype = "calloutcontact")
|
||||||
public ModelAndView update(HttpServletRequest request, @Valid Contacts contacts) {
|
public ModelAndView update(HttpServletRequest request, @Valid Contacts contacts) {
|
||||||
Contacts data = contactsRes.findOne(contacts.getId());
|
contactsRes.findById(contacts.getId())
|
||||||
if (data != null) {
|
.ifPresent(data -> {
|
||||||
List<PropertiesEvent> events = PropertiesEventUtil.processPropertiesModify(
|
List<PropertiesEvent> events = PropertiesEventUtil.processPropertiesModify(
|
||||||
request, contacts, data, "id", "orgi", "creater", "createtime", "updatetime"); //记录 数据变更 历史
|
request, contacts, data, "id", "orgi", "creater", "createtime", "updatetime"); //记录 数据变更 历史
|
||||||
if (events.size() > 0) {
|
if (events.size() > 0) {
|
||||||
@ -1494,8 +1432,7 @@
|
|||||||
contacts.setCusbirthday(null);
|
contacts.setCusbirthday(null);
|
||||||
}
|
}
|
||||||
contactsRes.save(contacts);
|
contactsRes.save(contacts);
|
||||||
}
|
});
|
||||||
|
|
||||||
return request(super.createRequestPageTempletResponse("redirect:/agent/index.html"));
|
return request(super.createRequestPageTempletResponse("redirect:/agent/index.html"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user