1
0
mirror of https://github.com/chatopera/cosin.git synced 2025-08-01 16:38:02 +08:00
This commit is contained in:
Hai Liang Wang 2022-04-29 11:48:15 +08:00
parent 324defc2f3
commit 0d6a34de5f
3 changed files with 44 additions and 15 deletions

View File

@ -18,6 +18,7 @@ package com.chatopera.cc.controller.admin.channel;
import com.chatopera.cc.basic.MainContext;
import com.chatopera.cc.basic.MainUtils;
import com.chatopera.cc.cache.Cache;
import com.chatopera.cc.controller.Handler;
import com.chatopera.cc.model.*;
import com.chatopera.cc.persistence.repository.ConsultInviteRepository;
@ -65,6 +66,10 @@ public class SNSAccountIMController extends Handler {
@Autowired
private OrganRepository organRes;
@Autowired
private Cache cache;
@RequestMapping("/index")
@Menu(type = "admin", subtype = "im", access = false, admin = true)
public ModelAndView index(ModelMap map, HttpServletRequest request, @Valid String execute, @RequestParam(name = "status", required = false) String status) {
@ -139,11 +144,17 @@ public class SNSAccountIMController extends Handler {
if (execute = MainUtils.secConfirm(secRes, super.getOrgi(request), confirm)) {
SNSAccount snsAccount = snsAccountRes.findByIdAndOrgi(id, super.getOrgi(request));
if (snsAccountRes != null) {
// 删除网站渠道记录
snsAccountRes.delete(snsAccount);
/**
* 删除网站渠道客服配置
*/
CousultInvite coultInvite = invite.findBySnsaccountidAndOrgi(snsAccount.getSnsid(), super.getOrgi(request));
if (coultInvite != null) {
invite.delete(coultInvite);
}
// 删除缓存
cache.deleteConsultInviteBySnsidAndOrgi(snsAccount.getSnsid(), super.getOrgi(request));
}
}

View File

@ -442,7 +442,7 @@ public class IMController extends Handler {
@RequestMapping("/{id}/userlist")
@Menu(type = "im", subtype = "inlist", access = true)
public void inlist(HttpServletRequest request, HttpServletResponse response, @PathVariable String id,
@Valid String userid) throws IOException {
@Valid String userid) throws IOException {
response.setHeader("Content-Type", "text/html;charset=utf-8");
if (StringUtils.isNotBlank(userid)) {
BlackEntity black = cache.findOneSystemByIdAndOrgi(userid, Constants.SYSTEM_ORGI);
@ -642,8 +642,8 @@ public class IMController extends Handler {
if (StringUtils.isNotBlank(
appid)
&& ((!blackOpt.isPresent())
|| (blackOpt.get().getEndtime() != null && blackOpt.get().getEndtime().before(
new Date())))) {
|| (blackOpt.get().getEndtime() != null && blackOpt.get().getEndtime().before(
new Date())))) {
String randomUserId; // 随机生成OnlineUser的用户名使用了浏览器指纹做唯一性KEY
if (StringUtils.isNotBlank(userid)) {
@ -753,7 +753,7 @@ public class IMController extends Handler {
// 验证 OnlineUser 信息
if (contacts != null && StringUtils.isNotBlank(
contacts.getName())) { // contacts用于传递信息并不和 联系人表发生 关联contacts信息传递给 Socket.IO然后赋值给
// AgentUser最终赋值给 AgentService永久存储
// AgentUser最终赋值给 AgentService永久存储
consult = true;
// 存入 Cookies
if (invite.isConsult_info_cookies()) {
@ -777,7 +777,7 @@ public class IMController extends Handler {
if (StringUtils.isNotBlank(contacts.getSkypeid())) {
Cookie skypeid = new Cookie(
"skypeid", MainUtils.encryption(
URLEncoder.encode(contacts.getSkypeid(), "UTF-8")));
URLEncoder.encode(contacts.getSkypeid(), "UTF-8")));
skypeid.setMaxAge(3600);
response.addCookie(skypeid);
}
@ -960,15 +960,33 @@ public class IMController extends Handler {
}
view.addObject("commentList", Dict.getInstance().getDic(Constants.CSKEFU_SYSTEM_COMMENT_DIC));
view.addObject("commentItemList", Dict.getInstance().getDic(Constants.CSKEFU_SYSTEM_COMMENT_ITEM_DIC));
view.addObject("welcomeAd",
MainUtils.getPointAdv(MainContext.AdPosEnum.WELCOME.toString(), skill, orgi));
view.addObject("figureAds",
MainUtils.getPointAdvs(MainContext.AdPosEnum.IMAGE.toString(), skill, orgi));
/**
* 绑定广告位信息确定对应的组织机构广告是在该组织机构下管理的客服设置
* 1查找对应的网站渠道如果找到对应的网站渠道则设置为该网站渠道所属的组织机构
* 2该渠道不属于网站渠道那么是来自于其他渠道查看其是否绑定技能组如果绑定技能组则使用绑定技能组的 ID
*/
String adsAttachedOrgan = null;
if (StringUtils.isNotEmpty(invite.getSnsaccountid())) {
SNSAccount snsAccount = snsAccountRes.findBySnsidAndOrgi(invite.getSnsaccountid(), orgi);
if (snsAccount != null) {
adsAttachedOrgan = snsAccount.getOrgan();
}
} else if (StringUtils.isNotEmpty(skill)) {
adsAttachedOrgan = skill;
}
if (StringUtils.isNotEmpty(adsAttachedOrgan)) {
view.addObject("welcomeAd",
MainUtils.getPointAdv(MainContext.AdPosEnum.WELCOME.toString(), adsAttachedOrgan, orgi));
view.addObject("figureAds",
MainUtils.getPointAdvs(MainContext.AdPosEnum.IMAGE.toString(), adsAttachedOrgan, orgi));
}
// 确定"接受邀请"被处理后通知浏览器关闭弹出窗口
OnlineUserProxy.sendWebIMClients(userid, "accept");
// 更新InviteRecord
// 更新 InviteRecord
logger.info("[index] update inviteRecord for user {}", userid);
final Date threshold = new Date(System.currentTimeMillis() - Constants.WEBIM_AGENT_INVITE_TIMEOUT);
Page<InviteRecord> inviteRecords = inviteRecordRes.findByUseridAndOrgiAndResultAndCreatetimeGreaterThan(
@ -1194,9 +1212,9 @@ public class IMController extends Handler {
@RequestMapping("/leavemsg/save")
@Menu(type = "admin", subtype = "user")
public ModelAndView leavemsgsave(HttpServletRequest request,
@Valid String appid,
@Valid LeaveMsg msg,
@Valid String skillId) {
@Valid String appid,
@Valid LeaveMsg msg,
@Valid String skillId) {
if (StringUtils.isNotBlank(appid)) {
snsAccountRepository.findBySnsid(appid).ifPresent(p -> {
CousultInvite invite = inviteRepository.findBySnsaccountidAndOrgi(appid, Constants.SYSTEM_ORGI);
@ -1219,7 +1237,7 @@ public class IMController extends Handler {
@RequestMapping("/refuse")
@Menu(type = "im", subtype = "refuse", access = true)
public void refuse(HttpServletRequest request, HttpServletResponse response, @Valid String orgi,
@Valid String appid, @Valid String userid, @Valid String sessionid, @Valid String client) throws Exception {
@Valid String appid, @Valid String userid, @Valid String sessionid, @Valid String client) throws Exception {
OnlineUserProxy.refuseInvite(userid, orgi);
final Date threshold = new Date(System.currentTimeMillis() - Constants.WEBIM_AGENT_INVITE_TIMEOUT);
Page<InviteRecord> inviteRecords = inviteRecordRes.findByUseridAndOrgiAndResultAndCreatetimeGreaterThan(

View File

@ -29,7 +29,7 @@ block content
.box-header: h3.box-title 对话设置
.box-body.ukefu-im-theme
.row: .col-lg-8
.ukefu-webim-prop 人工坐席接入欢迎消息非WEBIM渠道适用
.ukefu-webim-prop 人工坐席接入欢迎消息
.ukefu-webim-tl(style="clear:both;")
.box-item: .row: .col-lg-12
textarea(name="sessionmsg" id="sessionmsg" autocomplete="off" class="layui-input" resize="false" style="height:90px;line-height:22px;resize: none;")= sessionConfig.sessionmsg ? sessionConfig.sessionmsg : "欢迎您来咨询!欢迎使用春松客服!如需帮助请联系 info@chatopera.com"