From 7b1220c68cce08cd495c087b122187905c1c0335 Mon Sep 17 00:00:00 2001 From: Hai Liang Wang Date: Sun, 8 Aug 2021 20:11:55 +0800 Subject: [PATCH] https://github.com/chatopera/cskefu/issues/457 enhance organ, role info display --- .../cc/controller/admin/OrganController.java | 24 ++++++++ .../java/com/chatopera/cc/model/User.java | 35 ++++++++++-- .../com/chatopera/cc/util/json/GsonTools.java | 8 +++ .../src/main/resources/application.properties | 2 +- .../app/src/main/resources/banner.txt | 4 ++ .../main/resources/static/im/css/ukefu.css | 2 +- .../resources/templates/admin/organ/index.pug | 57 ++++++++++++++++++- .../resources/templates/admin/role/index.pug | 14 ++++- .../templates/apps/im/chatbot/index.pug | 17 +++--- .../resources/templates/apps/im/index.pug | 19 +++---- .../main/resources/templates/apps/index.pug | 4 +- .../src/main/resources/templates/login.pug | 3 + 12 files changed, 155 insertions(+), 34 deletions(-) diff --git a/contact-center/app/src/main/java/com/chatopera/cc/controller/admin/OrganController.java b/contact-center/app/src/main/java/com/chatopera/cc/controller/admin/OrganController.java index ca64fd1..86bdeab 100644 --- a/contact-center/app/src/main/java/com/chatopera/cc/controller/admin/OrganController.java +++ b/contact-center/app/src/main/java/com/chatopera/cc/controller/admin/OrganController.java @@ -16,6 +16,7 @@ */ package com.chatopera.cc.controller.admin; +import com.alibaba.fastjson.JSONArray; import com.chatopera.cc.basic.Constants; import com.chatopera.cc.cache.Cache; import com.chatopera.cc.controller.Handler; @@ -24,6 +25,7 @@ import com.chatopera.cc.persistence.repository.*; import com.chatopera.cc.proxy.OrganProxy; import com.chatopera.cc.proxy.UserProxy; import com.chatopera.cc.util.Menu; +import com.chatopera.cc.util.json.GsonTools; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -106,6 +108,28 @@ public class OrganController extends Handler { organData.getId(), super.getOrgi(), false)); + + // 处理附属组织 + final Map affiliates = organProxy.findAllOrganByParentAndOrgi(organData, super.getOrgi()); + List affiliateUsers = new ArrayList<>(); + + for (final Map.Entry o : affiliates.entrySet()) { + if (StringUtils.equals(o.getKey(), organData.getId())) continue; + List ousers = userProxy.findByOrganAndOrgiAndDatastatus( + o.getKey(), + super.getOrgi(), + false); + if (ousers != null && ousers.size() > 0) { + for (User u : ousers) { + u.setCurrOrganId(o.getKey()); + u.setCurrOrganName(o.getValue().getName()); + // copy an object to avoid modify multi times + affiliateUsers.add(GsonTools.copyObject(u)); + } + } + } + map.addAttribute("affiliateUsers", affiliateUsers); + } } map.addAttribute("areaList", areaRepository.findByOrgi(super.getOrgi())); diff --git a/contact-center/app/src/main/java/com/chatopera/cc/model/User.java b/contact-center/app/src/main/java/com/chatopera/cc/model/User.java index 94fe5c6..ce77db4 100644 --- a/contact-center/app/src/main/java/com/chatopera/cc/model/User.java +++ b/contact-center/app/src/main/java/com/chatopera/cc/model/User.java @@ -32,6 +32,13 @@ import java.util.*; public class User implements java.io.Serializable { private static final long serialVersionUID = 1L; + public User() { + } + + public User(String id) { + this.id = id; + } + @Id private String id; @@ -110,13 +117,11 @@ public class User implements java.io.Serializable { // 角色的权限 private Map roleAuthMap = new HashMap(); - public User() { - } - - public User(String id) { - this.id = id; - } + @Transient + private String currOrganId; // 短时使用:浏览到该用户时,打开到组织 ID + @Transient + private String currOrganName; // 短时使用:浏览到该用户时,打开到组织名 /** * @return the id @@ -556,4 +561,22 @@ public class User implements java.io.Serializable { public void setExtension(Extension extension) { this.extension = extension; } + + @Transient + public String getCurrOrganId() { + return currOrganId; + } + + public void setCurrOrganId(String currOrganId) { + this.currOrganId = currOrganId; + } + + @Transient + public String getCurrOrganName() { + return currOrganName; + } + + public void setCurrOrganName(String currOrganName) { + this.currOrganName = currOrganName; + } } diff --git a/contact-center/app/src/main/java/com/chatopera/cc/util/json/GsonTools.java b/contact-center/app/src/main/java/com/chatopera/cc/util/json/GsonTools.java index 61089ec..55801ac 100644 --- a/contact-center/app/src/main/java/com/chatopera/cc/util/json/GsonTools.java +++ b/contact-center/app/src/main/java/com/chatopera/cc/util/json/GsonTools.java @@ -17,6 +17,7 @@ package com.chatopera.cc.util.json; import com.google.gson.*; +import java.lang.reflect.Type; import java.util.List; import java.util.Map; @@ -27,6 +28,13 @@ public class GsonTools { THROW_EXCEPTION, PREFER_FIRST_OBJ, PREFER_SECOND_OBJ, PREFER_NON_NULL; } + + public static T copyObject(Object object){ + Gson gson = new Gson(); + JsonObject jsonObject = gson.toJsonTree(object).getAsJsonObject(); + return gson.fromJson(jsonObject,(Type) object.getClass()); + } + /** * 将Java POJO 转化为 JSON * diff --git a/contact-center/app/src/main/resources/application.properties b/contact-center/app/src/main/resources/application.properties index 3e2e9e8..4ea5b96 100644 --- a/contact-center/app/src/main/resources/application.properties +++ b/contact-center/app/src/main/resources/application.properties @@ -228,4 +228,4 @@ channel.skype.crm= # Miscs ############################################## # 登陆页面公告 -notice.login.banner=商务洽谈、售后技术支持和云服务发票等 https://dwz.chatopera.com/A51h6m *本提示仅出现于演环境 \ No newline at end of file +notice.login.banner=商务洽谈、技术支持等联系方式查看 https://dwz.chatopera.com/A51h6m *本提示仅出现于演示环境 \ No newline at end of file diff --git a/contact-center/app/src/main/resources/banner.txt b/contact-center/app/src/main/resources/banner.txt index 72a3858..f3272da 100644 --- a/contact-center/app/src/main/resources/banner.txt +++ b/contact-center/app/src/main/resources/banner.txt @@ -8,6 +8,7 @@ 春松客服: 越是重视客户服务,越是好的企业 v${git.build.version} build ${git.commit.id.abbrev} 版权所有 © 北京华夏春松科技有限公司️ https://www.chatopera.com/ 商业许可授权联系商务顾问 https://dwz.chatopera.com/A51h6m +春松客服博客专栏 https://blog.chatopera.com/ 第一次安装后,参考系统初始化文档,对系统进行初始化,再使用!!! https://docs.chatopera.com/products/cskefu/initialization.html @@ -20,4 +21,7 @@ https://docs.chatopera.com/products/cskefu/osc/training.html 开源社区反馈建议& 提交 BUG https://github.com/chatopera/cskefu/issues + +鼓励我们不断的优化春松客服,给春松客服点赞 +https://github.com/chatopera/cskefu/stargazers ---------------------------------------------------------------- \ No newline at end of file diff --git a/contact-center/app/src/main/resources/static/im/css/ukefu.css b/contact-center/app/src/main/resources/static/im/css/ukefu.css index 3b0d87f..af6a4e8 100644 --- a/contact-center/app/src/main/resources/static/im/css/ukefu.css +++ b/contact-center/app/src/main/resources/static/im/css/ukefu.css @@ -558,7 +558,7 @@ p.submitBtnWrap { vertical-align: top; } .chat-bottom .send-btn{ - width: 96px; + width: 120px; height: 34px; float: right; background-color: #e7e1d3; diff --git a/contact-center/app/src/main/resources/templates/admin/organ/index.pug b/contact-center/app/src/main/resources/templates/admin/organ/index.pug index 399fe6d..ec7b011 100644 --- a/contact-center/app/src/main/resources/templates/admin/organ/index.pug +++ b/contact-center/app/src/main/resources/templates/admin/organ/index.pug @@ -39,8 +39,11 @@ block content | 修改部门 button.layui-btn.layui-btn-danger.layui-btn-small(href="/admin/organ/delete.html?id=" + organData.id, data-toggle="tip", data-title="请确认是否删除该部门?") | 删除部门 + + // 展示部门根用户 .row(style='padding:5px;') .col-lg-12 + blockquote.layui-elem-quote 部门根用户 table.layui-table(lay-skin='line') colgroup col(width='30%') @@ -57,7 +60,7 @@ block content th 手机 th(style='white-space:nowrap;', nowrap) 操作 tbody(style='table-layout: fixed; word-break: break-all;') - if userList + if size(userList) > 0 for organUser in userList tr td(style="width:150px;") @@ -67,11 +70,61 @@ block content td= organUser.email td= organUser.mobile td(style="white-space: nowrap;") - a(href="/admin/organ/user/delete.html?id=" + organUser.id + "&organ=" + organData.id, data-toggle="tip", data-title="请确认是否从坐席组中移除坐席?") + a(href="/admin/organ/user/delete.html?id=" + organUser.id + "&organ=" + organData.id, data-toggle="tip", data-title="请确认是否从部门【#{organData.name}】中移除用户【#{organUser.username}】?") i.layui-icon(style="color:red;") ဆ | 移除 + else + td(colspan="5", style="height:170px;") + .ukefu-empty(style="background: none;") + i.layui-icon  + div(style="") 还没有部门根用户 .row(style='padding:5px;') .col-lg-12#page(style='text-align:center;') + + // 展示部门附属的用户 + hr + .row(style='padding:5px;') + .col-lg-12 + blockquote.layui-elem-quote 附属部门用户 + table.layui-table(lay-skin='line') + colgroup + col(width='15%') + col(width='15%') + col(width='15%') + col(width='20%') + col(width='20%') + col(width='1%') + col + thead + tr + th 部门 + th 用户 + th 姓名 + th 电子邮件 + th 手机 + th(style='white-space:nowrap;', nowrap) 操作 + tbody(style='table-layout: fixed; word-break: break-all;') + if size(affiliateUsers) > 0 + for organUser in affiliateUsers + tr + td(style="width:100px;")= organUser.currOrganName + td(style="width:100px;") + a(href="") + | #{organUser.username} + td(style="width: 100px")= organUser.uname + td= organUser.email + td= organUser.mobile + td(style="white-space: nowrap;") + a(href="/admin/organ/user/delete.html?id=" + organUser.id + "&organ=" + organUser.currOrganId, data-toggle="tip", data-title="请确认是否从部门【#{organUser.currOrganName}】中移除用户【#{organUser.username}】?") + i.layui-icon(style="color:red;") ဆ + | 移除 + else + td(colspan="5", style="height:170px;") + .ukefu-empty(style="background: none;") + i.layui-icon  + div(style="") 还没有附属部门用户 + + script(type='text/javascript'). var setting = { data: {simpleData: {enable: true}}, diff --git a/contact-center/app/src/main/resources/templates/admin/role/index.pug b/contact-center/app/src/main/resources/templates/admin/role/index.pug index f16c4dc..57560df 100644 --- a/contact-center/app/src/main/resources/templates/admin/role/index.pug +++ b/contact-center/app/src/main/resources/templates/admin/role/index.pug @@ -11,19 +11,23 @@ block content .row(style='padding:5px;') .col-lg-12 ul - if roleList + if size(roleList) > 0 for role in roleList li.uk_role(class={'this': roleData.id == role.id}) a(href="/admin/role/index.html?role=" + role.id, style="word-wrap: break-word;word-break: break-all;") i.kfont(style="margin-top: 3px;float: left")  | #{role.name} + else + .ukefu-empty(style="background: none;") + i.layui-icon  + div(style="") 还没有角色 .col-lg-9 h1.site-h1(style='background-color:#FFFFFF;') span(style='width:200px;display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-wrap: break-word;word-break: break-all;') if roleData | #{roleData.name} else - | 坐席组 + | 角色用户 if userList | (#{userList.size()}) span(style='float:right;') @@ -71,6 +75,12 @@ block content a(href="/admin/role/user/delete.html?id=" + userRole.id + "&role=" + userRole.role.id, data-toggle="tip", data-title="请确认是否移除?") i.layui-icon(style="color:red;") ဆ | 移除 + else + td(colspan="5", style="height: 400px;") + .ukefu-empty(style="background: none;") + i.layui-icon  + div(style="") 还没有系统用户 + .row(style='padding:5px;') .col-lg-12#page(style='text-align:center;') script. diff --git a/contact-center/app/src/main/resources/templates/apps/im/chatbot/index.pug b/contact-center/app/src/main/resources/templates/apps/im/chatbot/index.pug index 0c283ef..ad0e80e 100644 --- a/contact-center/app/src/main/resources/templates/apps/im/chatbot/index.pug +++ b/contact-center/app/src/main/resources/templates/apps/im/chatbot/index.pug @@ -45,22 +45,21 @@ html var count = this.count() var limitNum = #{ inviteData.maxwordsnum > 0 ? inviteData.maxwordsnum : 300}; //设定限制字数 - var pattern = '还可以输入' + limitNum + '字'; var strValue = this.html(); if (count > limitNum) { - pattern = ('字数超过限制,请适当删除部分内容'); - //超过字数限制自动截取 + // 超过字数限制自动截取 strValue = strValue.substring(0, limitNum); editor.html(strValue); + document.getElementById('sent').innerHTML = "发送(" + limitNum + "/" + limitNum + ")"; //输入显示 } else { - //计算剩余字数 + // 计算剩余字数 var result = limitNum - this.count(); - pattern = '还可以输入' + result + '字'; if (result < 20) { - document.getElementById('surplus').style.color = "red"; + document.getElementById('sent').style.color = "red"; } else { - document.getElementById('surplus').style.color = "#000000"; + document.getElementById('sent').style.color = "#fff"; } + document.getElementById('sent').innerHTML = "发送(" + count + "/" + limitNum + ")"; //输入显示 } if (this.count("text") == 0) { strValue = ""; @@ -78,7 +77,7 @@ html // } words = this.count("text"); - document.getElementById('surplus').innerHTML = count + "/" + limitNum + " , " + pattern; //输入显示 + }, afterCreate: function () { //设置编辑器创建后执行的回调函数 var self = this; @@ -365,7 +364,7 @@ html .chat-bottom#bottom textarea#message(name='content', style='visibility:hidden;') .btn-push.clearfix - #surplus(style='float:left;height:34px;line-height:34px;margin: 10px 20px 10px 5px;') 0/200 + #surplus(style='float:left;height:34px;line-height:34px;margin: 10px 20px 10px 5px;'): a(style="color: #C7C6C6;text-decoration: none;cursor: pointer;", href="https://www.cskefu.com", target="_blank") 春松客服提供客服软件支持 button.send-btn.active.special.clearfix#sent(type='button', onclick='sendMessage()') 发送 .content-rig diff --git a/contact-center/app/src/main/resources/templates/apps/im/index.pug b/contact-center/app/src/main/resources/templates/apps/im/index.pug index 7bce393..0938fa6 100644 --- a/contact-center/app/src/main/resources/templates/apps/im/index.pug +++ b/contact-center/app/src/main/resources/templates/apps/im/index.pug @@ -62,24 +62,21 @@ html var count = this.count() - imgnumber; var limitNum = #{ inviteData.maxwordsnum > 0 ? inviteData.maxwordsnum : 300}; //设定限制字数 - var pattern = '还可以输入' + (limitNum - imgnumber) + '字'; var strValue = this.html(); if (count > limitNum) { - // pattern = ('字数超过限制,请适当删除部分内容'); - pattern = '还可以输入' + (limitNum - count) + '字'; - console.log(count) - //超过字数限制自动截取 + // 超过字数限制自动截取 strValue = strValue.substring(0, limitNum + imgnumber); editor.html(strValue); + document.getElementById('sent').innerHTML = "发送(" + limitNum + "/" + limitNum + ")"; //输入显示 } else { - //计算剩余字数 + // 计算剩余字数 var result = limitNum - count; - pattern = '还可以输入' + result + '字'; if (result < 20) { - document.getElementById('surplus').style.color = "red"; + document.getElementById('sent').style.color = "red"; } else { - document.getElementById('surplus').style.color = "#000000"; + document.getElementById('sent').style.color = "#fff"; } + document.getElementById('sent').innerHTML = "发送(" + count + "/" + limitNum + ")"; //输入显示 } if (this.count("text") == 0) { strValue = ""; @@ -95,8 +92,6 @@ html }); } words = this.count("text"); - - document.getElementById('surplus').innerHTML = count + "/" + limitNum + " , " + pattern; //输入显示 }, afterCreate: function () { //设置编辑器创建后执行的回调函数 var self = this; @@ -411,7 +406,7 @@ html .chat-bottom#bottom textarea#message(name='content', style='visibility:hidden;') .btn-push.clearfix - #surplus(style='float:left;height:34px;line-height:34px;margin: 10px 20px 10px 5px;') 0/200 + #surplus(style='float:left;height:34px;line-height:34px;margin: 10px 20px 10px 5px;'): a(style="color: #C7C6C6;text-decoration: none;cursor: pointer;", href="https://www.cskefu.com", target="_blank") 春松客服提供客服软件支持 button.send-btn.active.special.clearfix#sent(type='button', onclick='sendMessage()') 发送 .content-rig diff --git a/contact-center/app/src/main/resources/templates/apps/index.pug b/contact-center/app/src/main/resources/templates/apps/index.pug index b02e05c..cf77ea0 100644 --- a/contact-center/app/src/main/resources/templates/apps/index.pug +++ b/contact-center/app/src/main/resources/templates/apps/index.pug @@ -336,7 +336,9 @@ html(xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xm } }); }); - console.log("新的转机和闪闪星斗/正在缀满没有遮拦的天空\\n春松客服,开源的智能客服系统 https://github.com/chatopera/cosin") + console.info("春松客服:越是重视客户服务,越是好的企业 https://www.cskefu.com/") + console.info(" * 鼓励我们不断的优化春松客服,给春松客服点赞 https://github.com/chatopera/cskefu/stargazers"); + console.info(" * 商务洽谈、技术支持等联系方式查看 https://dwz.chatopera.com/A51h6m"); if webrtc script. // 呼叫中心连接信息 diff --git a/contact-center/app/src/main/resources/templates/login.pug b/contact-center/app/src/main/resources/templates/login.pug index e821210..dee52f1 100644 --- a/contact-center/app/src/main/resources/templates/login.pug +++ b/contact-center/app/src/main/resources/templates/login.pug @@ -40,6 +40,9 @@ html if (uid) { document.getElementById("username").value = uid; } + console.info("春松客服:越是重视客户服务,越是好的企业 https://www.cskefu.com/") + console.info(" * 鼓励我们不断的优化春松客服,给春松客服点赞 https://github.com/chatopera/cskefu/stargazers"); + console.info(" * 商务洽谈、技术支持等联系方式查看 https://dwz.chatopera.com/A51h6m"); } if ('#{tongjiBaiduSiteKey}') { var _hmt = _hmt || []; -- GitLab