mirror of
https://github.com/chatopera/cosin.git
synced 2025-07-20 04:23:01 +08:00
refactor user type and entim
This commit is contained in:
parent
e1356fb091
commit
3267f2dba2
3
contact-center/app/.gitignore
vendored
3
contact-center/app/.gitignore
vendored
@ -1,3 +1,6 @@
|
||||
# dev profile
|
||||
src/main/resources/application-dev.properties
|
||||
|
||||
# ignore plugins source code
|
||||
src/main/java/com/chatopera/cc/plugins/
|
||||
|
||||
|
@ -40,38 +40,38 @@ public class DelegateRequestMatchingFilter implements Filter {
|
||||
}
|
||||
|
||||
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
boolean matchAnyRoles = false ;
|
||||
for(RequestMatcher anyRequest : ignoredRequests ){
|
||||
if(anyRequest.matches(request)){
|
||||
matchAnyRoles = true ;
|
||||
}
|
||||
}
|
||||
User user = (User) request.getSession().getAttribute(Constants.USER_SESSION_NAME) ;
|
||||
if(matchAnyRoles){
|
||||
if(user !=null && "0".equals(user.getUsertype())){
|
||||
chain.doFilter(req,resp);
|
||||
}else{
|
||||
//重定向到 无权限执行操作的页面
|
||||
HttpServletResponse response = (HttpServletResponse) resp ;
|
||||
response.sendRedirect("/?msg=security");
|
||||
}
|
||||
}else{
|
||||
try{
|
||||
chain.doFilter(req,resp);
|
||||
}catch(ClientAbortException ex){
|
||||
//Tomcat异常,不做处理
|
||||
}
|
||||
}
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
boolean matchAnyRoles = false;
|
||||
for (RequestMatcher anyRequest : ignoredRequests) {
|
||||
if (anyRequest.matches(request)) {
|
||||
matchAnyRoles = true;
|
||||
}
|
||||
}
|
||||
User user = (User) request.getSession().getAttribute(Constants.USER_SESSION_NAME);
|
||||
if (matchAnyRoles) {
|
||||
if (user != null && (user.isAdmin())) {
|
||||
chain.doFilter(req, resp);
|
||||
} else {
|
||||
// 重定向到 无权限执行操作的页面
|
||||
HttpServletResponse response = (HttpServletResponse) resp;
|
||||
response.sendRedirect("/?msg=security");
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
chain.doFilter(req, resp);
|
||||
} catch (ClientAbortException ex) {
|
||||
//Tomcat异常,不做处理
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig arg0) throws ServletException {
|
||||
@Override
|
||||
public void init(FilterConfig arg0) throws ServletException {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -51,8 +51,10 @@ public class ApplicationController extends Handler {
|
||||
view.addObject("timeDifference", timezone.getRawOffset());
|
||||
|
||||
if (super.isEnabletneant()) {
|
||||
//多租户启用 非超级管理员 一定要选择租户才能进入界面
|
||||
if (!logined.isSuperuser() && StringUtils.isNotBlank(logined.getOrgid()) && super.isTenantconsole() && MainContext.SYSTEM_ORGI.equals(logined.getOrgi())) {
|
||||
// 多租户启用 非管理员 一定要选择租户才能进入界面
|
||||
if (!logined.isAdmin() && StringUtils.isNotBlank(
|
||||
logined.getOrgid()) && super.isTenantconsole() && MainContext.SYSTEM_ORGI.equals(
|
||||
logined.getOrgi())) {
|
||||
view = request(super.createRequestPageTempletResponse("redirect:/apps/tenant/index"));
|
||||
}
|
||||
if (StringUtils.isBlank(logined.getOrgid())) {
|
||||
|
@ -120,8 +120,8 @@ public class Handler {
|
||||
User u = getUser(request);
|
||||
if (u == null) {
|
||||
throw new CSKefuException("[esOrganFilter] 未能获取到登录用户。");
|
||||
} else if (u.isSuperuser()) {
|
||||
// 超级管理员, 查看任何数据
|
||||
} else if (u.isAdmin()) {
|
||||
// 管理员, 查看任何数据
|
||||
return true;
|
||||
} else {
|
||||
// 用户在部门中,通过部门过滤数据
|
||||
@ -145,7 +145,8 @@ public class Handler {
|
||||
String q = request.getParameter("q");
|
||||
q = q.replaceAll("(OR|AND|NOT|:|\\(|\\))", "");
|
||||
if (StringUtils.isNotBlank(q)) {
|
||||
queryBuilder.must(QueryBuilders.boolQuery().must(new QueryStringQueryBuilder(q).defaultOperator(Operator.AND)));
|
||||
queryBuilder.must(
|
||||
QueryBuilders.boolQuery().must(new QueryStringQueryBuilder(q).defaultOperator(Operator.AND)));
|
||||
map.put("q", q);
|
||||
}
|
||||
}
|
||||
@ -188,12 +189,14 @@ public class Handler {
|
||||
|
||||
RangeQueryBuilder rangeQuery = null;
|
||||
// 拨打时间区间查询
|
||||
if (StringUtils.isNotBlank(request.getParameter("callbegin")) || StringUtils.isNotBlank(request.getParameter("callend"))) {
|
||||
if (StringUtils.isNotBlank(request.getParameter("callbegin")) || StringUtils.isNotBlank(
|
||||
request.getParameter("callend"))) {
|
||||
|
||||
if (StringUtils.isNotBlank(request.getParameter("callbegin"))) {
|
||||
try {
|
||||
|
||||
rangeQuery = QueryBuilders.rangeQuery("calltime").from(MainUtils.dateFormate.parse(request.getParameter("callbegin")).getTime());
|
||||
rangeQuery = QueryBuilders.rangeQuery("calltime").from(
|
||||
MainUtils.dateFormate.parse(request.getParameter("callbegin")).getTime());
|
||||
} catch (ParseException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
@ -204,7 +207,8 @@ public class Handler {
|
||||
try {
|
||||
|
||||
if (rangeQuery == null) {
|
||||
rangeQuery = QueryBuilders.rangeQuery("calltime").to(MainUtils.dateFormate.parse(request.getParameter("callend")).getTime());
|
||||
rangeQuery = QueryBuilders.rangeQuery("calltime").to(
|
||||
MainUtils.dateFormate.parse(request.getParameter("callend")).getTime());
|
||||
} else {
|
||||
rangeQuery.to(MainUtils.dateFormate.parse(request.getParameter("callend")).getTime());
|
||||
}
|
||||
@ -218,12 +222,14 @@ public class Handler {
|
||||
map.put("callend", request.getParameter("callend"));
|
||||
}
|
||||
// 预约时间区间查询
|
||||
if (StringUtils.isNotBlank(request.getParameter("apbegin")) || StringUtils.isNotBlank(request.getParameter("apend"))) {
|
||||
if (StringUtils.isNotBlank(request.getParameter("apbegin")) || StringUtils.isNotBlank(
|
||||
request.getParameter("apend"))) {
|
||||
|
||||
if (StringUtils.isNotBlank(request.getParameter("apbegin"))) {
|
||||
try {
|
||||
|
||||
rangeQuery = QueryBuilders.rangeQuery("aptime").from(MainUtils.dateFormate.parse(request.getParameter("apbegin")).getTime());
|
||||
rangeQuery = QueryBuilders.rangeQuery("aptime").from(
|
||||
MainUtils.dateFormate.parse(request.getParameter("apbegin")).getTime());
|
||||
} catch (ParseException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
@ -234,7 +240,8 @@ public class Handler {
|
||||
try {
|
||||
|
||||
if (rangeQuery == null) {
|
||||
rangeQuery = QueryBuilders.rangeQuery("aptime").to(MainUtils.dateFormate.parse(request.getParameter("apend")).getTime());
|
||||
rangeQuery = QueryBuilders.rangeQuery("aptime").to(
|
||||
MainUtils.dateFormate.parse(request.getParameter("apend")).getTime());
|
||||
} else {
|
||||
rangeQuery.to(MainUtils.dateFormate.parse(request.getParameter("apend")).getTime());
|
||||
}
|
||||
@ -281,6 +288,7 @@ public class Handler {
|
||||
* 创建或从HTTP会话中查找到访客的User对象,该对象不在数据库中,属于临时会话。
|
||||
* 这个User很可能是打开一个WebIM访客聊天控件,随机生成用户名,之后和Contact关联
|
||||
* 这个用户可能关联一个OnlineUser,如果开始给TA分配坐席
|
||||
*
|
||||
* @param request
|
||||
* @param userid
|
||||
* @param nickname
|
||||
@ -298,7 +306,8 @@ public class Handler {
|
||||
if (StringUtils.isNotBlank(nickname)) {
|
||||
user.setUsername(nickname);
|
||||
} else {
|
||||
Map<String, String> sessionMessage = cache.findOneSystemMapByIdAndOrgi(request.getSession().getId(), MainContext.SYSTEM_ORGI);
|
||||
Map<String, String> sessionMessage = cache.findOneSystemMapByIdAndOrgi(
|
||||
request.getSession().getId(), MainContext.SYSTEM_ORGI);
|
||||
if (sessionMessage != null) {
|
||||
String struname = sessionMessage.get("username");
|
||||
String strcname = sessionMessage.get("company_name");
|
||||
@ -327,7 +336,8 @@ public class Handler {
|
||||
if (StringUtils.isNotBlank(nickname)) {
|
||||
user.setUsername(nickname);
|
||||
} else {
|
||||
Map<String, String> sessionMessage = cache.findOneSystemMapByIdAndOrgi(sessionid, MainContext.SYSTEM_ORGI);
|
||||
Map<String, String> sessionMessage = cache.findOneSystemMapByIdAndOrgi(
|
||||
sessionid, MainContext.SYSTEM_ORGI);
|
||||
if (sessionMessage != null) {
|
||||
String struname = sessionMessage.get("username");
|
||||
String strcname = sessionMessage.get("company_name");
|
||||
|
@ -88,6 +88,9 @@ public class LoginController extends Handler {
|
||||
@Autowired
|
||||
private AgentSessionProxy agentSessionProxy;
|
||||
|
||||
@Autowired
|
||||
private UserProxy userProxy;
|
||||
|
||||
/**
|
||||
* 登录页面
|
||||
*
|
||||
@ -196,7 +199,7 @@ public class LoginController extends Handler {
|
||||
if ((loginUser.isAgent() &&
|
||||
loginUser.getRoleAuthMap().containsKey("A01") &&
|
||||
((boolean) loginUser.getRoleAuthMap().get("A01") == true))
|
||||
|| loginUser.isSuperuser()) {
|
||||
|| loginUser.isAdmin()) {
|
||||
try {
|
||||
/****************************************
|
||||
* 登录成功,设置该坐席为就绪状态(默认)
|
||||
@ -215,7 +218,7 @@ public class LoginController extends Handler {
|
||||
AutomaticServiceDist.recordAgentStatus(agentStatus.getAgentno(),
|
||||
agentStatus.getUsername(),
|
||||
agentStatus.getAgentno(),
|
||||
user.isSuperuser(), // 0代表admin
|
||||
user.isAdmin(), // 0代表admin
|
||||
agentStatus.getAgentno(),
|
||||
MainContext.AgentStatusEnum.OFFLINE.toString(),
|
||||
MainContext.AgentStatusEnum.READY.toString(),
|
||||
@ -273,7 +276,7 @@ public class LoginController extends Handler {
|
||||
|
||||
// 登录成功 判断是否进入多租户页面
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig();
|
||||
if (systemConfig != null && systemConfig.isEnabletneant() && systemConfig.isTenantconsole() && !loginUser.isSuperuser()) {
|
||||
if (systemConfig != null && systemConfig.isEnabletneant() && systemConfig.isTenantconsole() && !loginUser.isAdmin()) {
|
||||
view = new ModelAndView("redirect:/apps/tenant/index");
|
||||
}
|
||||
List<UserRole> userRoleList = userRoleRes.findByOrgiAndUser(loginUser.getOrgi(), loginUser);
|
||||
@ -284,7 +287,7 @@ public class LoginController extends Handler {
|
||||
}
|
||||
|
||||
// 获取用户部门以及下级部门
|
||||
UserProxy.attachOrgansPropertiesForUser(loginUser);
|
||||
userProxy.attachOrgansPropertiesForUser(loginUser);
|
||||
|
||||
// 获取用户的角色权限,进行授权
|
||||
List<RoleAuth> roleAuthList = roleAuthRes.findAll(new Specification<RoleAuth>() {
|
||||
@ -381,7 +384,7 @@ public class LoginController extends Handler {
|
||||
return request(super.createRequestPageTempletResponse("redirect:/register.html?msg=" + msg));
|
||||
} else {
|
||||
user.setUname(user.getUsername());
|
||||
user.setUsertype("0");
|
||||
user.setAdmin(true);
|
||||
if (StringUtils.isNotBlank(user.getPassword())) {
|
||||
user.setPassword(MainUtils.md5(user.getPassword()));
|
||||
}
|
||||
|
@ -80,10 +80,14 @@ public class OrganController extends Handler {
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
|
||||
@Autowired
|
||||
private UserProxy userProxy;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "admin", subtype = "organ")
|
||||
public ModelAndView index(ModelMap map, HttpServletRequest request, @Valid String organ, @Valid String msg) {
|
||||
List<Organ> organList = organRepository.findByOrgiAndOrgid(super.getOrgiByTenantshare(request), super.getOrgid(request));
|
||||
List<Organ> organList = organRepository.findByOrgiAndOrgid(
|
||||
super.getOrgiByTenantshare(request), super.getOrgid(request));
|
||||
map.addAttribute("organList", organList);
|
||||
if (organList.size() > 0) {
|
||||
Organ organData = null;
|
||||
@ -98,11 +102,16 @@ public class OrganController extends Handler {
|
||||
map.addAttribute("organData", organData = organList.get(0));
|
||||
}
|
||||
if (organData != null) {
|
||||
map.addAttribute("userList", UserProxy.findByOrganAndOrgiAndDatastatus(organData.getId(), super.getOrgiByTenantshare(request), false));
|
||||
map.addAttribute(
|
||||
"userList", userProxy.findByOrganAndOrgiAndDatastatus(organData.getId(),
|
||||
super.getOrgiByTenantshare(request),
|
||||
false));
|
||||
}
|
||||
}
|
||||
map.addAttribute("areaList", areaRepository.findByOrgi(super.getOrgiByTenantshare(request)));
|
||||
map.addAttribute("roleList", roleRepository.findByOrgiAndOrgid(super.getOrgiByTenantshare(request), super.getOrgid(request)));
|
||||
map.addAttribute(
|
||||
"roleList", roleRepository.findByOrgiAndOrgid(super.getOrgiByTenantshare(request),
|
||||
super.getOrgid(request)));
|
||||
map.put("msg", msg);
|
||||
return request(super.createAdminTempletResponse("/admin/organ/index"));
|
||||
}
|
||||
@ -118,7 +127,9 @@ public class OrganController extends Handler {
|
||||
map.addAttribute("area", areaRepository.findByIdAndOrgi(area, super.getOrgiByTenantshare(request)));
|
||||
}
|
||||
|
||||
map.addAttribute("organList", organRepository.findByOrgiAndOrgid(super.getOrgiByTenantshare(request), super.getOrgid(request)));
|
||||
map.addAttribute(
|
||||
"organList", organRepository.findByOrgiAndOrgid(super.getOrgiByTenantshare(request),
|
||||
super.getOrgid(request)));
|
||||
|
||||
return request(super.createRequestPageTempletResponse("/admin/organ/add"));
|
||||
}
|
||||
@ -126,7 +137,8 @@ public class OrganController extends Handler {
|
||||
@RequestMapping("/save")
|
||||
@Menu(type = "admin", subtype = "organ")
|
||||
public ModelAndView save(HttpServletRequest request, @Valid Organ organ) {
|
||||
Organ tempOrgan = organRepository.findByNameAndOrgiAndOrgid(organ.getName(), super.getOrgiByTenantshare(request), super.getOrgid(request));
|
||||
Organ tempOrgan = organRepository.findByNameAndOrgiAndOrgid(
|
||||
organ.getName(), super.getOrgiByTenantshare(request), super.getOrgid(request));
|
||||
String msg = "admin_organ_new_success";
|
||||
String firstId = null;
|
||||
if (tempOrgan != null) {
|
||||
@ -145,7 +157,8 @@ public class OrganController extends Handler {
|
||||
|
||||
OnlineUserProxy.clean(super.getOrgi(request));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/organ/index.html?msg=" + msg + "&organ=" + firstId));
|
||||
return request(super.createRequestPageTempletResponse(
|
||||
"redirect:/admin/organ/index.html?msg=" + msg + "&organ=" + firstId));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,9 +172,12 @@ public class OrganController extends Handler {
|
||||
@RequestMapping("/seluser")
|
||||
@Menu(type = "admin", subtype = "seluser", admin = true)
|
||||
public ModelAndView seluser(ModelMap map, HttpServletRequest request, @Valid String organ) {
|
||||
map.addAttribute("userList", userRepository.findByOrgiAndDatastatusAndOrgid(super.getOrgiByTenantshare(request), false, super.getOrgid(request)));
|
||||
map.addAttribute(
|
||||
"userList", userRepository.findByOrgiAndDatastatusAndOrgid(super.getOrgiByTenantshare(request), false,
|
||||
super.getOrgid(request)));
|
||||
Organ organData = organRepository.findByIdAndOrgi(organ, super.getOrgiByTenantshare(request));
|
||||
map.addAttribute("userOrganList", UserProxy.findByOrganAndOrgiAndDatastatus(organ, super.getOrgiByTenantshare(request), false));
|
||||
map.addAttribute("userOrganList", userProxy
|
||||
.findByOrganAndOrgiAndDatastatus(organ, super.getOrgiByTenantshare(request), false));
|
||||
map.addAttribute("organ", organData);
|
||||
return request(super.createRequestPageTempletResponse("/admin/organ/seluser"));
|
||||
}
|
||||
@ -181,7 +197,7 @@ public class OrganController extends Handler {
|
||||
HttpServletRequest request,
|
||||
final @Valid String[] users,
|
||||
final @Valid String organ
|
||||
) {
|
||||
) {
|
||||
logger.info("[saveuser] save users {} into organ {}", StringUtils.join(users, ","), organ);
|
||||
final User loginUser = super.getUser(request);
|
||||
|
||||
@ -205,12 +221,13 @@ public class OrganController extends Handler {
|
||||
/**
|
||||
* 以下更新技能组状态
|
||||
*/
|
||||
AgentStatus agentStatus = cache.findOneAgentStatusByAgentnoAndOrig(user.getId(), super.getOrgiByTenantshare(request));
|
||||
AgentStatus agentStatus = cache.findOneAgentStatusByAgentnoAndOrig(
|
||||
user.getId(), super.getOrgiByTenantshare(request));
|
||||
|
||||
// TODO 因为一个用户可以包含在多个技能组中,所以,skill应该对应
|
||||
// 一个List列表,此处需要重构Skill为列表
|
||||
if (agentStatus != null) {
|
||||
UserProxy.attachOrgansPropertiesForUser(user);
|
||||
userProxy.attachOrgansPropertiesForUser(user);
|
||||
agentStatus.setSkills(user.getSkills());
|
||||
cache.putAgentStatusByOrgi(agentStatus, super.getOrgiByTenantshare(request));
|
||||
}
|
||||
@ -228,7 +245,7 @@ public class OrganController extends Handler {
|
||||
final HttpServletRequest request,
|
||||
final @Valid String id,
|
||||
final @Valid String organ
|
||||
) {
|
||||
) {
|
||||
logger.info("[userroledelete] user id {}, organ {}", id, organ);
|
||||
if (id != null) {
|
||||
organUserRes.deleteOrganUserByUseridAndOrgan(id, organ);
|
||||
@ -244,7 +261,9 @@ public class OrganController extends Handler {
|
||||
map.addAttribute("areaList", areaRepository.findByOrgi(super.getOrgiByTenantshare(request)));
|
||||
view.addObject("organData", organRepository.findByIdAndOrgi(id, super.getOrgiByTenantshare(request)));
|
||||
|
||||
map.addAttribute("organList", organRepository.findByOrgiAndOrgid(super.getOrgiByTenantshare(request), super.getOrgid(request)));
|
||||
map.addAttribute(
|
||||
"organList", organRepository.findByOrgiAndOrgid(super.getOrgiByTenantshare(request),
|
||||
super.getOrgid(request)));
|
||||
return view;
|
||||
}
|
||||
|
||||
@ -252,7 +271,8 @@ public class OrganController extends Handler {
|
||||
@Menu(type = "admin", subtype = "organ")
|
||||
public ModelAndView update(HttpServletRequest request, @Valid Organ organ) {
|
||||
String msg = organProxy.updateOrgan(organ, super.getOrgi(request), super.getUser(request));
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/organ/index.html?msg=" + msg + "&organ=" + organ.getId()));
|
||||
return request(super.createRequestPageTempletResponse(
|
||||
"redirect:/admin/organ/index.html?msg=" + msg + "&organ=" + organ.getId()));
|
||||
}
|
||||
|
||||
@RequestMapping("/area")
|
||||
@ -283,7 +303,8 @@ public class OrganController extends Handler {
|
||||
} else {
|
||||
msg = "admin_organ_update_not_exist";
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/organ/index.html?msg=" + msg + "&organ=" + organ.getId()));
|
||||
return request(super.createRequestPageTempletResponse(
|
||||
"redirect:/admin/organ/index.html?msg=" + msg + "&organ=" + organ.getId()));
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
@ -328,6 +349,7 @@ public class OrganController extends Handler {
|
||||
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/organ/index.html?organ=" + organData.getId()));
|
||||
return request(
|
||||
super.createRequestPageTempletResponse("redirect:/admin/organ/index.html?organ=" + organData.getId()));
|
||||
}
|
||||
}
|
@ -27,6 +27,7 @@ import com.chatopera.cc.model.UserRole;
|
||||
import com.chatopera.cc.persistence.repository.UserRepository;
|
||||
import com.chatopera.cc.persistence.repository.UserRoleRepository;
|
||||
import com.chatopera.cc.proxy.OnlineUserProxy;
|
||||
import com.chatopera.cc.proxy.UserProxy;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
@ -64,22 +65,26 @@ public class UsersController extends Handler {
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
|
||||
@Autowired
|
||||
private UserProxy userProxy;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "admin", subtype = "user")
|
||||
public ModelAndView index(ModelMap map, HttpServletRequest request) throws IOException {
|
||||
map.addAttribute(
|
||||
"userList",
|
||||
userRepository.findByDatastatusAndOrgiAndOrgid(
|
||||
userRepository.findByDatastatusAndOrgiAndOrgidAndSuperadminNot(
|
||||
false,
|
||||
super.getOrgiByTenantshare(request),
|
||||
super.getOrgid(request),
|
||||
true,
|
||||
new PageRequest(
|
||||
super.getP(request),
|
||||
super.getPs(request),
|
||||
Sort.Direction.ASC,
|
||||
"createtime"
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
return request(super.createAdminTempletResponse("/admin/user/index"));
|
||||
}
|
||||
@ -93,76 +98,11 @@ public class UsersController extends Handler {
|
||||
@RequestMapping("/save")
|
||||
@Menu(type = "admin", subtype = "user")
|
||||
public ModelAndView save(HttpServletRequest request, @Valid User user) {
|
||||
String msg = "";
|
||||
msg = validUser(user);
|
||||
if (!StringUtils.isBlank(msg) && !msg.equals("new_user_success")) {
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/user/index.html?msg=" + msg));
|
||||
} else {
|
||||
// if (request.getParameter("admin") != null) {
|
||||
// user.setUsertype("0");
|
||||
// } else {
|
||||
// user.setUsertype(null);
|
||||
// }
|
||||
if (user.isSuperuser()) {
|
||||
user.setSuperuser(true);
|
||||
user.setUsertype("0");
|
||||
} else {
|
||||
user.setSuperuser(false);
|
||||
user.setUsertype("");
|
||||
}
|
||||
if (!StringUtils.isBlank(user.getPassword())) {
|
||||
user.setPassword(MainUtils.md5(user.getPassword()));
|
||||
}
|
||||
|
||||
user.setOrgi(super.getOrgiByTenantshare(request));
|
||||
if (!StringUtils.isBlank(super.getUser(request).getOrgid())) {
|
||||
user.setOrgid(super.getUser(request).getOrgid());
|
||||
} else {
|
||||
user.setOrgid(MainContext.SYSTEM_ORGI);
|
||||
}
|
||||
userRepository.save(user);
|
||||
OnlineUserProxy.clean(super.getOrgi(request));
|
||||
}
|
||||
String msg = userProxy.createNewUser(
|
||||
user, super.getOrgi(request), super.getUser(request).getOrgid(), super.getOrgiByTenantshare(request));
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/user/index.html?msg=" + msg));
|
||||
}
|
||||
|
||||
private String validUser(User user) {
|
||||
String msg = "";
|
||||
User tempUser = userRepository.findByUsernameAndDatastatus(user.getUsername(), false);
|
||||
if (tempUser != null) {
|
||||
msg = "username_exist";
|
||||
return msg;
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(user.getEmail())) {
|
||||
tempUser = userRepository.findByEmailAndDatastatus(user.getEmail(), false);
|
||||
if (tempUser != null) {
|
||||
msg = "email_exist";
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(user.getMobile())) {
|
||||
tempUser = userRepository.findByMobileAndDatastatus(user.getMobile(), false);
|
||||
if (tempUser != null) {
|
||||
msg = "mobile_exist";
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
if (!validUserCallcenterParams(user)) {
|
||||
msg = "sip_account_exist";
|
||||
return msg;
|
||||
}
|
||||
|
||||
if (tempUser == null && validUserCallcenterParams(user)) {
|
||||
msg = "new_user_success";
|
||||
return msg;
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
@Menu(type = "admin", subtype = "user")
|
||||
public ModelAndView edit(ModelMap map, HttpServletRequest request, @Valid String id) {
|
||||
@ -177,16 +117,9 @@ public class UsersController extends Handler {
|
||||
User tempUser = userRepository.getOne(user.getId());
|
||||
String msg = validUserUpdate(user, tempUser);
|
||||
if (tempUser != null) {
|
||||
if (!StringUtils.isBlank(msg) && !msg.equals("edit_user_success")) {
|
||||
if (StringUtils.isNotBlank(msg) && !msg.equals("edit_user_success")) {
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/user/index.html?msg=" + msg));
|
||||
}
|
||||
if (user.isSuperuser()) {
|
||||
tempUser.setSuperuser(true);
|
||||
tempUser.setUsertype("0");
|
||||
} else {
|
||||
tempUser.setSuperuser(false);
|
||||
tempUser.setUsertype("");
|
||||
}
|
||||
tempUser.setUname(user.getUname());
|
||||
tempUser.setUsername(user.getUsername());
|
||||
tempUser.setEmail(user.getEmail());
|
||||
@ -205,23 +138,17 @@ public class UsersController extends Handler {
|
||||
|
||||
tempUser.setOrgi(super.getOrgiByTenantshare(request));
|
||||
|
||||
if (!StringUtils.isBlank(super.getUser(request).getOrgid())) {
|
||||
if (StringUtils.isNotBlank(super.getUser(request).getOrgid())) {
|
||||
tempUser.setOrgid(super.getUser(request).getOrgid());
|
||||
} else {
|
||||
tempUser.setOrgid(MainContext.SYSTEM_ORGI);
|
||||
}
|
||||
|
||||
tempUser.setCallcenter(user.isCallcenter());
|
||||
if (!StringUtils.isBlank(user.getPassword())) {
|
||||
if (StringUtils.isNotBlank(user.getPassword())) {
|
||||
tempUser.setPassword(MainUtils.md5(user.getPassword()));
|
||||
}
|
||||
|
||||
// if (request.getParameter("admin") != null) {
|
||||
// tempUser.setUsertype("0");
|
||||
// } else {
|
||||
// tempUser.setUsertype(null);
|
||||
// }
|
||||
|
||||
if (tempUser.getCreatetime() == null) {
|
||||
tempUser.setCreatetime(new Date());
|
||||
}
|
||||
@ -256,20 +183,18 @@ public class UsersController extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
if (!validUserCallcenterParams(user)) {
|
||||
if (!userProxy.validUserCallcenterParams(user)) {
|
||||
msg = "sip_account_exist";
|
||||
return msg;
|
||||
}
|
||||
|
||||
if (user.getUsername().equals(oldUser.getUsername()) && user.getEmail().equals(
|
||||
oldUser.getEmail()) && user.getMobile().equals(oldUser.getMobile()) && validUserCallcenterParams(
|
||||
oldUser.getEmail()) && user.getMobile().equals(
|
||||
oldUser.getMobile()) && userProxy.validUserCallcenterParams(
|
||||
user)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
// if ()
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
@ -290,18 +215,4 @@ public class UsersController extends Handler {
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/user/index.html?msg=" + msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据是否开启呼叫中心模块检测账号
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
private boolean validUserCallcenterParams(final User user) {
|
||||
if (user.isCallcenter() && MainContext.hasModule(Constants.CSKEFU_MODULE_CALLOUT)) {
|
||||
List<User> tempUserList = userRepository.findBySipaccountAndDatastatus(user.getSipaccount(), false);
|
||||
return tempUserList.size() == 0 || user.getSipaccount() == "";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -73,6 +73,9 @@ public class WebIMController extends Handler {
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
|
||||
@Autowired
|
||||
private UserProxy userProxy;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "app", subtype = "app", admin = true)
|
||||
public ModelAndView index(ModelMap map, HttpServletRequest request, @Valid String snsid) {
|
||||
@ -323,7 +326,7 @@ public class WebIMController extends Handler {
|
||||
organIdList.add(rel.getSkillid());
|
||||
}
|
||||
}
|
||||
userList = UserProxy.findByOrganInAndAgentAndDatastatus(organIdList, true, false);
|
||||
userList = userProxy.findByOrganInAndAgentAndDatastatus(organIdList, true, false);
|
||||
} else {
|
||||
userList = userRes.findByOrgiAndAgentAndDatastatus(super.getOrgi(request), true, false);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ public class SystemConfigController extends Handler {
|
||||
@RequestMapping("/startentim")
|
||||
@Menu(type = "admin", subtype = "startentim", access = false, admin = true)
|
||||
public ModelAndView startentim(ModelMap map, HttpServletRequest request) throws SQLException {
|
||||
MainContext.hasModule(Constants.CSKEFU_MODULE_ENTIM);
|
||||
MainContext.enableModule(Constants.CSKEFU_MODULE_ENTIM);
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/config/index.html"));
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ public class ApiAgentUserController extends Handler {
|
||||
final String userId = agentUser.getUserid();
|
||||
|
||||
// 检查权限
|
||||
if ((!logined.isSuperuser()) && (!StringUtils.equals(
|
||||
if ((!logined.isAdmin()) && (!StringUtils.equals(
|
||||
agentUser.getAgentno(),
|
||||
logined.getId())) && (!isTransPermissionAllowed(
|
||||
agentAudits, logined))) {
|
||||
@ -286,7 +286,7 @@ public class ApiAgentUserController extends Handler {
|
||||
final AgentUser agentUser = agentUserRes.findByIdAndOrgi(payload.get("id").getAsString(), orgi);
|
||||
if (agentUser != null) {
|
||||
if ((StringUtils.equals(
|
||||
logined.getId(), agentUser.getAgentno()) || logined.isSuperuser())) {
|
||||
logined.getId(), agentUser.getAgentno()) || logined.isAdmin())) {
|
||||
// 删除访客-坐席关联关系,包括缓存
|
||||
try {
|
||||
AutomaticServiceDist.deleteAgentUser(agentUser, orgi);
|
||||
|
@ -74,7 +74,9 @@ public class ApiServiceQueneController extends Handler {
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@Menu(type = "apps", subtype = "user", access = true)
|
||||
public ResponseEntity<RestResult> list(HttpServletRequest request) {
|
||||
return new ResponseEntity<>(new RestResult(RestResultType.OK, AutomaticServiceDist.getAgentReport(super.getOrgi(request))), HttpStatus.OK);
|
||||
return new ResponseEntity<>(
|
||||
new RestResult(RestResultType.OK, AutomaticServiceDist.getAgentReport(super.getOrgi(request))),
|
||||
HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -85,12 +87,14 @@ public class ApiServiceQueneController extends Handler {
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT)
|
||||
@Menu(type = "apps", subtype = "user", access = true)
|
||||
public ResponseEntity<RestResult> agentStatus(HttpServletRequest request,
|
||||
@Valid String status) throws CharacterCodingException {
|
||||
public ResponseEntity<RestResult> agentStatus(
|
||||
HttpServletRequest request,
|
||||
@Valid String status) throws CharacterCodingException {
|
||||
User logined = super.getUser(request);
|
||||
AgentStatus agentStatus = null;
|
||||
if (StringUtils.isNotBlank(status) && status.equals(MainContext.AgentStatusEnum.READY.toString())) {
|
||||
List<AgentStatus> agentStatusList = agentStatusRepository.findByAgentnoAndOrgi(logined.getId(), super.getOrgi(request));
|
||||
List<AgentStatus> agentStatusList = agentStatusRepository.findByAgentnoAndOrgi(
|
||||
logined.getId(), super.getOrgi(request));
|
||||
if (agentStatusList.size() > 0) {
|
||||
agentStatus = agentStatusList.get(0);
|
||||
agentStatus.setSkills(logined.getSkills());
|
||||
@ -104,7 +108,10 @@ public class ApiServiceQueneController extends Handler {
|
||||
|
||||
SessionConfig sessionConfig = AutomaticServiceDist.initSessionConfig(super.getOrgi(request));
|
||||
|
||||
agentStatus.setUsers(agentUserRepository.countByAgentnoAndStatusAndOrgi(logined.getId(), MainContext.AgentUserStatusEnum.INSERVICE.toString(), super.getOrgi(request)));
|
||||
agentStatus.setUsers(agentUserRepository.countByAgentnoAndStatusAndOrgi(
|
||||
logined.getId(),
|
||||
MainContext.AgentUserStatusEnum.INSERVICE.toString(),
|
||||
super.getOrgi(request)));
|
||||
|
||||
agentStatus.setUpdatetime(new Date());
|
||||
|
||||
@ -117,38 +124,64 @@ public class ApiServiceQueneController extends Handler {
|
||||
/**
|
||||
* 更新当前用户状态
|
||||
*/
|
||||
agentStatus.setUsers(cache.getInservAgentUsersSizeByAgentnoAndOrgi(agentStatus.getAgentno(), super.getOrgi(request)));
|
||||
agentStatus.setUsers(cache.getInservAgentUsersSizeByAgentnoAndOrgi(
|
||||
agentStatus.getAgentno(),
|
||||
super.getOrgi(request)));
|
||||
agentStatus.setStatus(MainContext.AgentStatusEnum.READY.toString());
|
||||
cache.putAgentStatusByOrgi(agentStatus, super.getOrgi(request));
|
||||
|
||||
AutomaticServiceDist.recordAgentStatus(agentStatus.getAgentno(), agentStatus.getUsername(), agentStatus.getAgentno(), logined.isSuperuser(), agentStatus.getAgentno(), MainContext.AgentStatusEnum.OFFLINE.toString(), MainContext.AgentStatusEnum.READY.toString(), MainContext.AgentWorkType.MEIDIACHAT.toString(), agentStatus.getOrgi(), null);
|
||||
AutomaticServiceDist.recordAgentStatus(
|
||||
agentStatus.getAgentno(), agentStatus.getUsername(), agentStatus.getAgentno(),
|
||||
logined.isAdmin(), agentStatus.getAgentno(),
|
||||
MainContext.AgentStatusEnum.OFFLINE.toString(), MainContext.AgentStatusEnum.READY.toString(),
|
||||
MainContext.AgentWorkType.MEIDIACHAT.toString(), agentStatus.getOrgi(), null);
|
||||
AutomaticServiceDist.allotAgent(agentStatus.getAgentno(), super.getOrgi(request));
|
||||
}
|
||||
} else if (StringUtils.isNotBlank(status)) {
|
||||
if (status.equals(MainContext.AgentStatusEnum.NOTREADY.toString())) {
|
||||
List<AgentStatus> agentStatusList = agentStatusRepository.findByAgentnoAndOrgi(logined.getId(), super.getOrgi(request));
|
||||
List<AgentStatus> agentStatusList = agentStatusRepository.findByAgentnoAndOrgi(
|
||||
logined.getId(), super.getOrgi(request));
|
||||
for (AgentStatus temp : agentStatusList) {
|
||||
AutomaticServiceDist.recordAgentStatus(temp.getAgentno(), temp.getUsername(), temp.getAgentno(), logined.isSuperuser(), temp.getAgentno(), temp.isBusy() ? MainContext.AgentStatusEnum.BUSY.toString() : MainContext.AgentStatusEnum.READY.toString(), MainContext.AgentStatusEnum.NOTREADY.toString(), MainContext.AgentWorkType.MEIDIACHAT.toString(), temp.getOrgi(), temp.getUpdatetime());
|
||||
AutomaticServiceDist.recordAgentStatus(
|
||||
temp.getAgentno(), temp.getUsername(), temp.getAgentno(),
|
||||
logined.isAdmin(),
|
||||
temp.getAgentno(),
|
||||
temp.isBusy() ? MainContext.AgentStatusEnum.BUSY.toString() : MainContext.AgentStatusEnum.READY.toString(),
|
||||
MainContext.AgentStatusEnum.NOTREADY.toString(),
|
||||
MainContext.AgentWorkType.MEIDIACHAT.toString(), temp.getOrgi(), temp.getUpdatetime());
|
||||
agentStatusRepository.delete(temp);
|
||||
}
|
||||
cache.deleteAgentStatusByAgentnoAndOrgi(super.getUser(request).getId(), super.getOrgi(request));
|
||||
} else if (StringUtils.isNotBlank(status) && status.equals(MainContext.AgentStatusEnum.BUSY.toString())) {
|
||||
List<AgentStatus> agentStatusList = agentStatusRepository.findByAgentnoAndOrgi(logined.getId(), super.getOrgi(request));
|
||||
List<AgentStatus> agentStatusList = agentStatusRepository.findByAgentnoAndOrgi(
|
||||
logined.getId(), super.getOrgi(request));
|
||||
if (agentStatusList.size() > 0) {
|
||||
agentStatus = agentStatusList.get(0);
|
||||
agentStatus.setBusy(true);
|
||||
AutomaticServiceDist.recordAgentStatus(agentStatus.getAgentno(), agentStatus.getUsername(), agentStatus.getAgentno(), logined.isSuperuser(), agentStatus.getAgentno(), MainContext.AgentStatusEnum.READY.toString(), MainContext.AgentStatusEnum.BUSY.toString(), MainContext.AgentWorkType.MEIDIACHAT.toString(), agentStatus.getOrgi(), agentStatus.getUpdatetime());
|
||||
AutomaticServiceDist.recordAgentStatus(
|
||||
agentStatus.getAgentno(), agentStatus.getUsername(), agentStatus.getAgentno(),
|
||||
logined.isAdmin(), agentStatus.getAgentno(),
|
||||
MainContext.AgentStatusEnum.READY.toString(), MainContext.AgentStatusEnum.BUSY.toString(),
|
||||
MainContext.AgentWorkType.MEIDIACHAT.toString(), agentStatus.getOrgi(),
|
||||
agentStatus.getUpdatetime());
|
||||
agentStatus.setUpdatetime(new Date());
|
||||
|
||||
agentStatusRepository.save(agentStatus);
|
||||
cache.putAgentStatusByOrgi(agentStatus, super.getOrgi(request));
|
||||
}
|
||||
} else if (StringUtils.isNotBlank(status) && status.equals(MainContext.AgentStatusEnum.NOTBUSY.toString())) {
|
||||
List<AgentStatus> agentStatusList = agentStatusRepository.findByAgentnoAndOrgi(logined.getId(), super.getOrgi(request));
|
||||
} else if (StringUtils.isNotBlank(status) && status.equals(
|
||||
MainContext.AgentStatusEnum.NOTBUSY.toString())) {
|
||||
List<AgentStatus> agentStatusList = agentStatusRepository.findByAgentnoAndOrgi(
|
||||
logined.getId(), super.getOrgi(request));
|
||||
if (agentStatusList.size() > 0) {
|
||||
agentStatus = agentStatusList.get(0);
|
||||
agentStatus.setBusy(false);
|
||||
AutomaticServiceDist.recordAgentStatus(agentStatus.getAgentno(), agentStatus.getUsername(), agentStatus.getAgentno(), logined.isSuperuser(), agentStatus.getAgentno(), MainContext.AgentStatusEnum.BUSY.toString(), MainContext.AgentStatusEnum.READY.toString(), MainContext.AgentWorkType.MEIDIACHAT.toString(), agentStatus.getOrgi(), agentStatus.getUpdatetime());
|
||||
AutomaticServiceDist.recordAgentStatus(
|
||||
agentStatus.getAgentno(), agentStatus.getUsername(), agentStatus.getAgentno(),
|
||||
logined.isAdmin(), agentStatus.getAgentno(),
|
||||
MainContext.AgentStatusEnum.BUSY.toString(), MainContext.AgentStatusEnum.READY.toString(),
|
||||
MainContext.AgentWorkType.MEIDIACHAT.toString(), agentStatus.getOrgi(),
|
||||
agentStatus.getUpdatetime());
|
||||
|
||||
agentStatus.setUpdatetime(new Date());
|
||||
agentStatusRepository.save(agentStatus);
|
||||
@ -156,7 +189,8 @@ public class ApiServiceQueneController extends Handler {
|
||||
}
|
||||
AutomaticServiceDist.allotAgent(agentStatus.getAgentno(), super.getOrgi(request));
|
||||
}
|
||||
AutomaticServiceDist.broadcastAgentsStatus(super.getOrgi(request), "agent", "api", super.getUser(request).getId());
|
||||
AutomaticServiceDist.broadcastAgentsStatus(
|
||||
super.getOrgi(request), "agent", "api", super.getUser(request).getId());
|
||||
}
|
||||
return new ResponseEntity<>(new RestResult(RestResultType.OK, agentStatus), HttpStatus.OK);
|
||||
}
|
||||
|
@ -16,98 +16,195 @@
|
||||
*/
|
||||
package com.chatopera.cc.handler.api;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chatopera.cc.basic.MainUtils;
|
||||
import com.chatopera.cc.handler.Handler;
|
||||
import com.chatopera.cc.handler.api.request.RestUtils;
|
||||
import com.chatopera.cc.model.OrganUser;
|
||||
import com.chatopera.cc.model.User;
|
||||
import com.chatopera.cc.persistence.repository.OrganUserRepository;
|
||||
import com.chatopera.cc.persistence.repository.UserRepository;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.RestResult;
|
||||
import com.chatopera.cc.handler.Handler;
|
||||
import com.chatopera.cc.model.User;
|
||||
import com.chatopera.cc.util.RestResultType;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.chatopera.cc.basic.MainUtils;
|
||||
import com.chatopera.cc.persistence.repository.UserRepository;
|
||||
import com.chatopera.cc.util.RestResultType;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/user")
|
||||
public class ApiUserController extends Handler {
|
||||
private final static Logger logger = LoggerFactory.getLogger(ApiUserController.class);
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
/**
|
||||
* 返回用户列表,支持分页,分页参数为 p=1&ps=50,默认分页尺寸为 20条每页
|
||||
* @param request
|
||||
* @param username 搜索用户名,精确搜索
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping( method = RequestMethod.GET)
|
||||
@Menu(type = "apps" , subtype = "user" , access = true)
|
||||
public ResponseEntity<RestResult> list(HttpServletRequest request , @Valid String id , @Valid String username) {
|
||||
Page<User> userList = null ;
|
||||
if(!StringUtils.isBlank(id)){
|
||||
userList = userRepository.findByIdAndOrgi(id, super.getOrgi(request), new PageRequest(super.getP(request), super.getPs(request))) ;
|
||||
}else{
|
||||
if(!StringUtils.isBlank(username)){
|
||||
userList = userRepository.findByDatastatusAndOrgiAndUsernameLike(false, super.getOrgi(request), username , new PageRequest(super.getP(request), super.getPs(request))) ;
|
||||
}else{
|
||||
userList = userRepository.findByDatastatusAndOrgi(false, super.getOrgi(request), new PageRequest(super.getP(request), super.getPs(request))) ;
|
||||
}
|
||||
}
|
||||
@Autowired
|
||||
private OrganUserRepository organUserRepository;
|
||||
|
||||
/**
|
||||
* 返回用户列表,支持分页,分页参数为 p=1&ps=50,默认分页尺寸为 20条每页
|
||||
*
|
||||
* @param request
|
||||
* @param username 搜索用户名,精确搜索
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@Menu(type = "apps", subtype = "user", access = true)
|
||||
public ResponseEntity<RestResult> list(HttpServletRequest request, @Valid String id, @Valid String username) {
|
||||
Page<User> userList = null;
|
||||
if (!StringUtils.isBlank(id)) {
|
||||
userList = userRepository.findByIdAndOrgi(
|
||||
id, super.getOrgi(request), new PageRequest(super.getP(request), super.getPs(request)));
|
||||
} else {
|
||||
if (!StringUtils.isBlank(username)) {
|
||||
userList = userRepository.findByDatastatusAndOrgiAndUsernameLike(
|
||||
false, super.getOrgi(request), username, new PageRequest(
|
||||
super.getP(request),
|
||||
super.getPs(request)));
|
||||
} else {
|
||||
userList = userRepository.findByDatastatusAndOrgi(
|
||||
false, super.getOrgi(request), new PageRequest(super.getP(request), super.getPs(request)));
|
||||
}
|
||||
}
|
||||
return new ResponseEntity<>(new RestResult(RestResultType.OK, userList), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改用户用户 ,在修改用户信息的时候,如果用户 密码未改变,请设置为 NULL
|
||||
* @param request
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT)
|
||||
@Menu(type = "apps" , subtype = "user" , access = true)
|
||||
public ResponseEntity<RestResult> put(HttpServletRequest request , @Valid User user) {
|
||||
if(user != null && !StringUtils.isBlank(user.getUsername())){
|
||||
if(!StringUtils.isBlank(user.getPassword())){
|
||||
user.setPassword(MainUtils.md5(user.getPassword()));
|
||||
userRepository.save(user) ;
|
||||
}else if(!StringUtils.isBlank(user.getId())){
|
||||
User old = userRepository.findByIdAndOrgi(user.getId(), super.getOrgi(request)) ;
|
||||
user.setPassword(old.getPassword());
|
||||
userRepository.save(user) ;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 新增或修改用户用户 ,在修改用户信息的时候,如果用户 密码未改变,请设置为 NULL
|
||||
*
|
||||
* @param request
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT)
|
||||
@Menu(type = "apps", subtype = "user", access = true)
|
||||
public ResponseEntity<RestResult> put(HttpServletRequest request, @Valid User user) {
|
||||
if (user != null && !StringUtils.isBlank(user.getUsername())) {
|
||||
if (!StringUtils.isBlank(user.getPassword())) {
|
||||
user.setPassword(MainUtils.md5(user.getPassword()));
|
||||
userRepository.save(user);
|
||||
} else if (!StringUtils.isBlank(user.getId())) {
|
||||
User old = userRepository.findByIdAndOrgi(user.getId(), super.getOrgi(request));
|
||||
user.setPassword(old.getPassword());
|
||||
userRepository.save(user);
|
||||
}
|
||||
}
|
||||
return new ResponseEntity<>(new RestResult(RestResultType.OK), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户,只提供 按照用户ID删除 , 并且,不能删除系统管理员
|
||||
* @param request
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE)
|
||||
@Menu(type = "apps" , subtype = "user" , access = true)
|
||||
public ResponseEntity<RestResult> delete(HttpServletRequest request , @Valid String id) {
|
||||
RestResult result = new RestResult(RestResultType.OK) ;
|
||||
User user = null ;
|
||||
if(!StringUtils.isBlank(id)){
|
||||
user = userRepository.findByIdAndOrgi(id, super.getOrgi(request)) ;
|
||||
if(!user.getUsertype().equals("0")){ //系统管理员, 不允许 使用 接口删除
|
||||
userRepository.delete(user);
|
||||
}else{
|
||||
result.setStatus(RestResultType.USER_DELETE);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 删除用户,只提供 按照用户ID删除 , 并且,不能删除系统管理员
|
||||
*
|
||||
* @param request
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE)
|
||||
@Menu(type = "apps", subtype = "user", access = true)
|
||||
public ResponseEntity<RestResult> delete(HttpServletRequest request, @Valid String id) {
|
||||
RestResult result = new RestResult(RestResultType.OK);
|
||||
User user = null;
|
||||
if (!StringUtils.isBlank(id)) {
|
||||
user = userRepository.findByIdAndOrgi(id, super.getOrgi(request));
|
||||
if (!user.isSuperadmin()) { //系统管理员, 不允许 使用 接口删除
|
||||
userRepository.delete(user);
|
||||
} else {
|
||||
result.setStatus(RestResultType.USER_DELETE);
|
||||
}
|
||||
}
|
||||
return new ResponseEntity<>(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/findByOrgan", method = RequestMethod.POST)
|
||||
@Menu(type = "apps", subtype = "user", access = true)
|
||||
public ResponseEntity<RestResult> findByOrgan(HttpServletRequest request, @Valid String organ) {
|
||||
List<OrganUser> organUsers = organUserRepository.findByOrgan(organ);
|
||||
List<String> userids = organUsers.stream().map(p -> p.getUserid()).collect(Collectors.toList());
|
||||
List<User> users = userRepository.findAll(userids);
|
||||
JSONArray json = new JSONArray();
|
||||
users.stream().forEach(u -> {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("id", u.getId());
|
||||
obj.put("uname", u.getUname());
|
||||
json.add(obj);
|
||||
});
|
||||
|
||||
return new ResponseEntity<>(new RestResult(RestResultType.OK, json), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户管理
|
||||
*
|
||||
* @param request
|
||||
* @param body
|
||||
* @param q
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST)
|
||||
@Menu(type = "apps", subtype = "user", access = true)
|
||||
public ResponseEntity<String> operations(HttpServletRequest request, @RequestBody final String body, @Valid String q) {
|
||||
logger.info("[operations] body {}, q {}", body, q);
|
||||
final JsonObject j = StringUtils.isBlank(body) ? (new JsonObject()) : (new JsonParser()).parse(
|
||||
body).getAsJsonObject();
|
||||
JsonObject json = new JsonObject();
|
||||
HttpHeaders headers = RestUtils.header();
|
||||
|
||||
if (!j.has("ops")) {
|
||||
json.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_FAIL_1);
|
||||
json.addProperty(RestUtils.RESP_KEY_ERROR, "不合法的请求参数。");
|
||||
} else {
|
||||
switch (StringUtils.lowerCase(j.get("ops").getAsString())) {
|
||||
case "create":
|
||||
json = create(request, j);
|
||||
break;
|
||||
default:
|
||||
json.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_FAIL_2);
|
||||
json.addProperty(RestUtils.RESP_KEY_ERROR, "不合法的操作。");
|
||||
}
|
||||
}
|
||||
|
||||
return new ResponseEntity<String>(json.toString(), headers, HttpStatus.OK);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建新用户
|
||||
*
|
||||
* @param request
|
||||
* @param payload
|
||||
* @return
|
||||
*/
|
||||
private JsonObject create(final HttpServletRequest request, final JsonObject payload) {
|
||||
JsonObject resp = new JsonObject();
|
||||
|
||||
// 从payload中创建User
|
||||
|
||||
|
||||
// if (payload) {
|
||||
// return resp;
|
||||
// }
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
}
|
@ -85,7 +85,7 @@ public class AgentAuditController extends Handler {
|
||||
private ServiceSummaryRepository serviceSummaryRes;
|
||||
|
||||
@Autowired
|
||||
private StatusEventRepository statusEventRes;
|
||||
private UserProxy userProxy;
|
||||
|
||||
@Autowired
|
||||
private OnlineUserRepository onlineUserRes;
|
||||
@ -121,7 +121,8 @@ public class AgentAuditController extends Handler {
|
||||
HttpServletRequest request,
|
||||
@Valid final String skill,
|
||||
@Valid final String agentno,
|
||||
@Valid String sort) {
|
||||
@Valid String sort
|
||||
) {
|
||||
final String orgi = super.getOrgi(request);
|
||||
final User logined = super.getUser(request);
|
||||
logger.info("[index] skill {}, agentno {}, logined {}", skill, agentno, logined.getId());
|
||||
@ -192,6 +193,38 @@ public class AgentAuditController extends Handler {
|
||||
return view;
|
||||
}
|
||||
|
||||
@RequestMapping("/query")
|
||||
@Menu(type = "apps", subtype = "cca")
|
||||
public ModelAndView query(HttpServletRequest request, String skill, String agentno) {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("/apps/cca/chatusers"));
|
||||
|
||||
final String orgi = super.getOrgi(request);
|
||||
final User logined = super.getUser(request);
|
||||
|
||||
Sort defaultSort = new Sort(Sort.Direction.DESC, "status");
|
||||
|
||||
// 坐席对话列表
|
||||
List<AgentUser> agentUsers;
|
||||
|
||||
if (StringUtils.isBlank(skill) && StringUtils.isBlank(agentno)) {
|
||||
agentUsers = agentUserRes.findByOrgiAndStatusAndAgentnoIsNot(
|
||||
orgi, MainContext.AgentUserStatusEnum.INSERVICE.toString(), logined.getId(), defaultSort);
|
||||
} else if (StringUtils.isNotBlank(skill) && StringUtils.isNotBlank(agentno)) {
|
||||
agentUsers = agentUserRes.findByOrgiAndStatusAndSkillAndAgentno(
|
||||
orgi, MainContext.AgentUserStatusEnum.INSERVICE.toString(), skill, agentno, defaultSort);
|
||||
} else if (StringUtils.isNotBlank(skill)) {
|
||||
agentUsers = agentUserRes.findByOrgiAndStatusAndSkillAndAgentnoIsNot(
|
||||
orgi, MainContext.AgentUserStatusEnum.INSERVICE.toString(), skill, agentno, defaultSort);
|
||||
} else {
|
||||
// agent is not Blank
|
||||
agentUsers = agentUserRes.findByOrgiAndStatusAndAgentno(
|
||||
orgi, MainContext.AgentUserStatusEnum.INSERVICE.toString(), agentno, defaultSort);
|
||||
}
|
||||
|
||||
view.addObject("agentUserList", agentUsers);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@RequestMapping("/agentusers")
|
||||
@Menu(type = "apps", subtype = "cca")
|
||||
@ -216,7 +249,8 @@ public class AgentAuditController extends Handler {
|
||||
ModelMap map,
|
||||
HttpServletRequest request,
|
||||
String id,
|
||||
String channel) throws IOException, TemplateException {
|
||||
String channel
|
||||
) throws IOException, TemplateException {
|
||||
String mainagentuser = "/apps/cca/mainagentuser";
|
||||
if (channel.equals("phone")) {
|
||||
mainagentuser = "/apps/cca/mainagentuser_callout";
|
||||
@ -247,8 +281,11 @@ public class AgentAuditController extends Handler {
|
||||
view.addObject(
|
||||
"agentUserMessageList",
|
||||
this.chatMessageRepository.findByUsessionAndOrgi(agentUser.getUserid(), orgi,
|
||||
new PageRequest(0, 20, Sort.Direction.DESC,
|
||||
"updatetime")));
|
||||
new PageRequest(0, 20, Sort.Direction.DESC,
|
||||
"updatetime"
|
||||
)
|
||||
)
|
||||
);
|
||||
AgentService agentService = null;
|
||||
if (StringUtils.isNotBlank(agentUser.getAgentserviceid())) {
|
||||
agentService = this.agentServiceRes.findOne(agentUser.getAgentserviceid());
|
||||
@ -277,10 +314,11 @@ public class AgentAuditController extends Handler {
|
||||
|
||||
view.addObject("serviceCount", Integer
|
||||
.valueOf(this.agentServiceRes
|
||||
.countByUseridAndOrgiAndStatus(agentUser
|
||||
.getUserid(), orgi,
|
||||
MainContext.AgentUserStatusEnum.END
|
||||
.toString())));
|
||||
.countByUseridAndOrgiAndStatus(agentUser
|
||||
.getUserid(), orgi,
|
||||
MainContext.AgentUserStatusEnum.END
|
||||
.toString()
|
||||
)));
|
||||
}
|
||||
|
||||
SessionConfig sessionConfig = AutomaticServiceDist.initSessionConfig(super.getOrgi(request));
|
||||
@ -314,7 +352,8 @@ public class AgentAuditController extends Handler {
|
||||
final @Valid String userid,
|
||||
final @Valid String agentserviceid,
|
||||
final @Valid String agentnoid,
|
||||
final @Valid String agentuserid) {
|
||||
final @Valid String agentuserid
|
||||
) {
|
||||
logger.info("[transfer] userId {}, agentUser {}", userid, agentuserid);
|
||||
final String orgi = super.getOrgi(request);
|
||||
final User logined = super.getUser(request);
|
||||
@ -347,7 +386,7 @@ public class AgentAuditController extends Handler {
|
||||
for (final User o : userList) {
|
||||
o.setAgentStatus(agentStatusMap.get(o.getId()));
|
||||
// find user's skills
|
||||
UserProxy.attachOrgansPropertiesForUser(o);
|
||||
userProxy.attachOrgansPropertiesForUser(o);
|
||||
}
|
||||
|
||||
map.addAttribute("userList", userList);
|
||||
@ -378,7 +417,8 @@ public class AgentAuditController extends Handler {
|
||||
ModelMap map,
|
||||
HttpServletRequest request,
|
||||
@Valid String agentnoid,
|
||||
@Valid String organ) {
|
||||
@Valid String organ
|
||||
) {
|
||||
final String orgi = super.getOrgi(request);
|
||||
if (StringUtils.isNotBlank(organ)) {
|
||||
List<String> usersids = new ArrayList<String>();
|
||||
@ -392,7 +432,7 @@ public class AgentAuditController extends Handler {
|
||||
}
|
||||
List<User> userList = userRes.findAll(usersids);
|
||||
for (User user : userList) {
|
||||
UserProxy.attachOrgansPropertiesForUser(user);
|
||||
userProxy.attachOrgansPropertiesForUser(user);
|
||||
for (final AgentStatus as : agentStatusList) {
|
||||
if (StringUtils.equals(as.getAgentno(), user.getId())) {
|
||||
user.setAgentStatus(as);
|
||||
@ -428,7 +468,8 @@ public class AgentAuditController extends Handler {
|
||||
@Valid final String agentuserid, // 坐席访客ID
|
||||
@Valid final String currentAgentnoid,
|
||||
@Valid final String agentno, // 会话转接给下一个坐席
|
||||
@Valid final String memo) throws CSKefuException {
|
||||
@Valid final String memo
|
||||
) throws CSKefuException {
|
||||
final String currentAgentno = currentAgentnoid; // 当前会话坐席的agentno
|
||||
|
||||
final String orgi = super.getOrgi(request);
|
||||
@ -488,7 +529,8 @@ public class AgentAuditController extends Handler {
|
||||
MainContext.MessageType.STATUS,
|
||||
agentUser.getUserid(),
|
||||
outMessage,
|
||||
true);
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// 通知转接消息给新坐席
|
||||
@ -497,7 +539,8 @@ public class AgentAuditController extends Handler {
|
||||
peerSyncIM.send(
|
||||
MainContext.ReceiverType.AGENT, MainContext.ChannelType.WEBIM,
|
||||
agentUser.getAppid(), MainContext.MessageType.NEW, agentService.getAgentno(),
|
||||
outMessage, true);
|
||||
outMessage, true
|
||||
);
|
||||
|
||||
} catch (Exception ex) {
|
||||
logger.error("[transfersave]", ex);
|
||||
|
@ -160,6 +160,9 @@
|
||||
private BrokerPublisher brokerPublisher;
|
||||
|
||||
|
||||
@Autowired
|
||||
private UserProxy userProxy;
|
||||
|
||||
/**
|
||||
* 坐席从联系人列表进入坐席工作台和该联系人聊天
|
||||
*
|
||||
@ -521,7 +524,8 @@
|
||||
public ModelAndView ready(HttpServletRequest request) {
|
||||
final User logined = super.getUser(request);
|
||||
final String orgi = super.getOrgi(request);
|
||||
final AgentStatus agentStatus = agentProxy.resolveAgentStatusByAgentnoAndOrgi(logined.getId(), orgi, logined.getSkills());
|
||||
final AgentStatus agentStatus = agentProxy.resolveAgentStatusByAgentnoAndOrgi(
|
||||
logined.getId(), orgi, logined.getSkills());
|
||||
|
||||
// 缓存就绪状态
|
||||
agentProxy.ready(logined, agentStatus);
|
||||
@ -538,7 +542,7 @@
|
||||
AutomaticServiceDist.recordAgentStatus(agentStatus.getAgentno(),
|
||||
agentStatus.getUsername(),
|
||||
agentStatus.getAgentno(),
|
||||
StringUtils.equals(logined.getUsertype(), "0"), // 0代表admin
|
||||
logined.isAdmin(), // 0代表admin
|
||||
agentStatus.getAgentno(),
|
||||
MainContext.AgentStatusEnum.NOTREADY.toString(),
|
||||
MainContext.AgentStatusEnum.READY.toString(),
|
||||
@ -574,7 +578,7 @@
|
||||
AutomaticServiceDist.recordAgentStatus(agentStatus.getAgentno(),
|
||||
agentStatus.getUsername(),
|
||||
agentStatus.getAgentno(),
|
||||
logined.isSuperuser(), // 0代表admin
|
||||
logined.isAdmin(), // 0代表admin
|
||||
agentStatus.getAgentno(),
|
||||
MainContext.AgentStatusEnum.READY.toString(),
|
||||
MainContext.AgentStatusEnum.NOTREADY.toString(),
|
||||
@ -603,7 +607,7 @@
|
||||
agentStatus.getAgentno(),
|
||||
agentStatus.getUsername(),
|
||||
agentStatus.getAgentno(),
|
||||
"0".equals(super.getUser(request).getUsertype()),
|
||||
super.getUser(request).isAdmin(),
|
||||
agentStatus.getAgentno(),
|
||||
MainContext.AgentStatusEnum.NOTBUSY.toString(),
|
||||
MainContext.AgentStatusEnum.BUSY.toString(),
|
||||
@ -644,7 +648,7 @@
|
||||
agentStatus.getAgentno(),
|
||||
agentStatus.getUsername(),
|
||||
agentStatus.getAgentno(),
|
||||
"0".equals(super.getUser(request).getUsertype()),
|
||||
super.getUser(request).isAdmin(),
|
||||
agentStatus.getAgentno(),
|
||||
MainContext.AgentStatusEnum.BUSY.toString(),
|
||||
MainContext.AgentStatusEnum.NOTBUSY.toString(),
|
||||
@ -705,7 +709,7 @@
|
||||
|
||||
if (agentUser != null) {
|
||||
if ((StringUtils.equals(
|
||||
logined.getId(), agentUser.getAgentno()) || logined.isSuperuser())) {
|
||||
logined.getId(), agentUser.getAgentno()) || logined.isAdmin())) {
|
||||
// 删除访客-坐席关联关系,包括缓存
|
||||
try {
|
||||
AutomaticServiceDist.deleteAgentUser(agentUser, orgi);
|
||||
@ -1151,7 +1155,7 @@
|
||||
for (final User o : userList) {
|
||||
o.setAgentStatus(agentStatusMap.get(o.getId()));
|
||||
// find user's skills
|
||||
UserProxy.attachOrgansPropertiesForUser(o);
|
||||
userProxy.attachOrgansPropertiesForUser(o);
|
||||
}
|
||||
|
||||
map.addAttribute("userList", userList);
|
||||
@ -1194,7 +1198,7 @@
|
||||
}
|
||||
List<User> userList = userRes.findAll(usersids);
|
||||
for (User user : userList) {
|
||||
UserProxy.attachOrgansPropertiesForUser(user);
|
||||
userProxy.attachOrgansPropertiesForUser(user);
|
||||
for (final AgentStatus as : agentStatusList) {
|
||||
if (StringUtils.equals(as.getAgentno(), user.getId())) {
|
||||
user.setAgentStatus(as);
|
||||
|
@ -70,6 +70,9 @@ public class AppsController extends Handler {
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
|
||||
@Autowired
|
||||
private UserProxy userProxy;
|
||||
|
||||
@RequestMapping({"/apps/content"})
|
||||
@Menu(type = "apps", subtype = "content")
|
||||
public ModelAndView content(ModelMap map, HttpServletRequest request, @Valid String msg) {
|
||||
@ -90,7 +93,7 @@ public class AppsController extends Handler {
|
||||
Sort.Direction.DESC,
|
||||
"createtime"
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
final long msec = System.currentTimeMillis();
|
||||
final List<String> contactIds = new ArrayList<String>();
|
||||
@ -136,27 +139,59 @@ public class AppsController extends Handler {
|
||||
|
||||
private void aggValues(ModelMap map, HttpServletRequest request) {
|
||||
map.put("agentReport", AutomaticServiceDist.getAgentReport(super.getOrgi(request)));
|
||||
map.put("webIMReport", MainUtils.getWebIMReport(userEventRes.findByOrgiAndCreatetimeRange(super.getOrgi(request), MainUtils.getStartTime(), MainUtils.getEndTime())));
|
||||
map.put(
|
||||
"webIMReport", MainUtils.getWebIMReport(
|
||||
userEventRes.findByOrgiAndCreatetimeRange(super.getOrgi(request), MainUtils.getStartTime(),
|
||||
MainUtils.getEndTime())));
|
||||
|
||||
// TODO 此处为什么不用agentReport中的agents?
|
||||
map.put("agents", getUsers(request).size());
|
||||
|
||||
map.put("webIMInvite", MainUtils.getWebIMInviteStatus(onlineUserRes.findByOrgiAndStatus(super.getOrgi(request), MainContext.OnlineUserStatusEnum.ONLINE.toString())));
|
||||
map.put(
|
||||
"webIMInvite", MainUtils.getWebIMInviteStatus(onlineUserRes.findByOrgiAndStatus(
|
||||
super.getOrgi(request),
|
||||
MainContext.OnlineUserStatusEnum.ONLINE.toString())));
|
||||
|
||||
map.put("inviteResult", MainUtils.getWebIMInviteResult(onlineUserRes.findByOrgiAndAgentnoAndCreatetimeRange(super.getOrgi(request), super.getUser(request).getId(), MainUtils.getStartTime(), MainUtils.getEndTime())));
|
||||
map.put(
|
||||
"inviteResult", MainUtils.getWebIMInviteResult(
|
||||
onlineUserRes.findByOrgiAndAgentnoAndCreatetimeRange(
|
||||
super.getOrgi(request),
|
||||
super.getUser(request).getId(),
|
||||
MainUtils.getStartTime(),
|
||||
MainUtils.getEndTime())));
|
||||
|
||||
map.put("agentUserCount", onlineUserRes.countByAgentForAgentUser(super.getOrgi(request), MainContext.AgentUserStatusEnum.INSERVICE.toString(), super.getUser(request).getId(), MainUtils.getStartTime(), MainUtils.getEndTime()));
|
||||
map.put(
|
||||
"agentUserCount", onlineUserRes.countByAgentForAgentUser(
|
||||
super.getOrgi(request),
|
||||
MainContext.AgentUserStatusEnum.INSERVICE.toString(),
|
||||
super.getUser(request).getId(),
|
||||
MainUtils.getStartTime(),
|
||||
MainUtils.getEndTime()));
|
||||
|
||||
map.put("agentServicesCount", onlineUserRes.countByAgentForAgentUser(super.getOrgi(request), MainContext.AgentUserStatusEnum.END.toString(), super.getUser(request).getId(), MainUtils.getStartTime(), MainUtils.getEndTime()));
|
||||
map.put(
|
||||
"agentServicesCount", onlineUserRes.countByAgentForAgentUser(
|
||||
super.getOrgi(request),
|
||||
MainContext.AgentUserStatusEnum.END.toString(),
|
||||
super.getUser(request).getId(),
|
||||
MainUtils.getStartTime(),
|
||||
MainUtils.getEndTime()));
|
||||
|
||||
map.put("agentServicesAvg", onlineUserRes.countByAgentForAvagTime(super.getOrgi(request), MainContext.AgentUserStatusEnum.END.toString(), super.getUser(request).getId(), MainUtils.getStartTime(), MainUtils.getEndTime()));
|
||||
map.put(
|
||||
"agentServicesAvg", onlineUserRes.countByAgentForAvagTime(
|
||||
super.getOrgi(request),
|
||||
MainContext.AgentUserStatusEnum.END.toString(),
|
||||
super.getUser(request).getId(),
|
||||
MainUtils.getStartTime(),
|
||||
MainUtils.getEndTime()));
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping({"/apps/onlineuser"})
|
||||
@Menu(type = "apps", subtype = "onlineuser")
|
||||
public ModelAndView onlineuser(ModelMap map, HttpServletRequest request) {
|
||||
Page<OnlineUser> onlineUserList = this.onlineUserRes.findByOrgiAndStatus(super.getOrgi(request), MainContext.OnlineUserStatusEnum.ONLINE.toString(), new PageRequest(super.getP(request), super.getPs(request), Sort.Direction.DESC, "createtime"));
|
||||
Page<OnlineUser> onlineUserList = this.onlineUserRes.findByOrgiAndStatus(
|
||||
super.getOrgi(request), MainContext.OnlineUserStatusEnum.ONLINE.toString(),
|
||||
new PageRequest(super.getP(request), super.getPs(request), Sort.Direction.DESC, "createtime"));
|
||||
List<String> ids = new ArrayList<String>();
|
||||
for (OnlineUser onlineUser : onlineUserList.getContent()) {
|
||||
onlineUser.setBetweentime((int) (System.currentTimeMillis() - onlineUser.getLogintime().getTime()));
|
||||
@ -194,6 +229,8 @@ public class AppsController extends Handler {
|
||||
@Menu(type = "apps", subtype = "content")
|
||||
public ModelAndView profile(ModelMap map, HttpServletRequest request, @Valid User user, @Valid String index) {
|
||||
User tempUser = userRes.getOne(user.getId());
|
||||
final User logined = super.getUser(request);
|
||||
|
||||
if (tempUser != null) {
|
||||
String msg = validUserUpdate(user, tempUser);
|
||||
if (StringUtils.isNotBlank(msg)) {
|
||||
@ -206,8 +243,8 @@ public class AppsController extends Handler {
|
||||
tempUser.setEmail(user.getEmail());
|
||||
tempUser.setMobile(user.getMobile());
|
||||
|
||||
if (super.getUser(request).isSuperuser()) {
|
||||
// 作为超级管理员,强制设置为坐席
|
||||
if (logined.isAdmin()) {
|
||||
// 作为管理员,强制设置为坐席
|
||||
tempUser.setAgent(true);
|
||||
} else {
|
||||
tempUser.setAgent(user.isAgent());
|
||||
@ -231,9 +268,11 @@ public class AppsController extends Handler {
|
||||
super.setUser(request, u);
|
||||
//切换成非坐席 判断是否坐席 以及 是否有对话
|
||||
if (!user.isAgent()) {
|
||||
AgentStatus agentStatus = cache.findOneAgentStatusByAgentnoAndOrig((super.getUser(request)).getId(), super.getOrgi(request));
|
||||
AgentStatus agentStatus = cache.findOneAgentStatusByAgentnoAndOrig(
|
||||
(super.getUser(request)).getId(), super.getOrgi(request));
|
||||
|
||||
if (!(agentStatus == null && cache.getInservAgentUsersSizeByAgentnoAndOrgi(super.getUser(request).getId(), super.getOrgi(request)) == 0)) {
|
||||
if (!(agentStatus == null && cache.getInservAgentUsersSizeByAgentnoAndOrgi(
|
||||
super.getUser(request).getId(), super.getOrgi(request)) == 0)) {
|
||||
if (StringUtils.isBlank(index)) {
|
||||
return request(super.createRequestPageTempletResponse("redirect:/apps/content.html?msg=t1"));
|
||||
}
|
||||
@ -291,7 +330,7 @@ public class AppsController extends Handler {
|
||||
organIdList.add(rel.getSkillid());
|
||||
}
|
||||
}
|
||||
userList = UserProxy.findByOrganInAndAgentAndDatastatus(organIdList, true, false);
|
||||
userList = userProxy.findByOrganInAndAgentAndDatastatus(organIdList, true, false);
|
||||
} else {
|
||||
userList = userRes.findByOrgiAndAgentAndDatastatus(super.getOrgi(request), true, false);
|
||||
}
|
||||
|
@ -19,10 +19,7 @@ package com.chatopera.cc.handler.apps;
|
||||
|
||||
import com.chatopera.cc.basic.MainUtils;
|
||||
import com.chatopera.cc.handler.Handler;
|
||||
import com.chatopera.cc.model.IMGroup;
|
||||
import com.chatopera.cc.model.IMGroupUser;
|
||||
import com.chatopera.cc.model.RecentUser;
|
||||
import com.chatopera.cc.model.User;
|
||||
import com.chatopera.cc.model.*;
|
||||
import com.chatopera.cc.persistence.repository.*;
|
||||
import com.chatopera.cc.proxy.UserProxy;
|
||||
import com.chatopera.cc.socketio.client.NettyClients;
|
||||
@ -65,6 +62,9 @@ public class EntIMController extends Handler {
|
||||
@Autowired
|
||||
private RecentUserRepository recentUserRes;
|
||||
|
||||
@Autowired
|
||||
private UserProxy userProxy;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "im", subtype = "entim", access = false)
|
||||
public ModelAndView index(HttpServletRequest request, HttpServletResponse response) {
|
||||
@ -74,7 +74,7 @@ public class EntIMController extends Handler {
|
||||
|
||||
// TODO: 优化性能
|
||||
for (User u : users) {
|
||||
UserProxy.attachOrgansPropertiesForUser(u);
|
||||
userProxy.attachOrgansPropertiesForUser(u);
|
||||
}
|
||||
|
||||
view.addObject("userList", users);
|
||||
@ -108,7 +108,14 @@ public class EntIMController extends Handler {
|
||||
@Menu(type = "im", subtype = "entim", access = false)
|
||||
public ModelAndView chat(HttpServletRequest request, HttpServletResponse response, @Valid String userid) {
|
||||
ModelAndView view = request(super.createEntIMTempletResponse("/apps/entim/chat"));
|
||||
view.addObject("entimuser", userRes.findByIdAndOrgi(userid, super.getOrgi(request)));
|
||||
User entImUser = userRes.findByIdAndOrgi(userid, super.getOrgi(request));
|
||||
|
||||
if (entImUser != null) {
|
||||
userProxy.attachOrgansPropertiesForUser(entImUser);
|
||||
view.addObject("organs", entImUser.getOrgans().values());
|
||||
}
|
||||
|
||||
view.addObject("entimuser", entImUser);
|
||||
view.addObject("contextid", MainUtils.genNewID(super.getUser(request).getId(), userid));
|
||||
view.addObject("online", NettyClients.getInstance().getEntIMClientsNum(userid) > 0);
|
||||
|
||||
@ -179,13 +186,13 @@ public class EntIMController extends Handler {
|
||||
public ModelAndView user(HttpServletRequest request, HttpServletResponse response, @Valid String id) {
|
||||
ModelAndView view = request(super.createEntIMTempletResponse("/apps/entim/group/user"));
|
||||
User logined = super.getUser(request);
|
||||
UserProxy.attachOrgansPropertiesForUser(logined);
|
||||
userProxy.attachOrgansPropertiesForUser(logined);
|
||||
|
||||
// TODO: 优化性能
|
||||
List<String> organIds = UserProxy.findOrgansByUserid(logined.getId());
|
||||
List<User> users = UserProxy.findByOrganInAndDatastatus(organIds, false);
|
||||
List<String> organIds = userProxy.findOrgansByUserid(logined.getId());
|
||||
List<User> users = userProxy.findByOrganInAndDatastatus(organIds, false);
|
||||
for (User u : users) {
|
||||
UserProxy.attachOrgansPropertiesForUser(u);
|
||||
userProxy.attachOrgansPropertiesForUser(u);
|
||||
}
|
||||
|
||||
IMGroup imGroup = imGroupRes.findById(id);
|
||||
|
@ -73,16 +73,18 @@ public class TenantController extends Handler {
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "apps", subtype = "tenant")
|
||||
public ModelAndView index(ModelMap map, final HttpServletRequest request,
|
||||
final @Valid String msg,
|
||||
final @Valid String currentorgi,
|
||||
final @Valid String currentname) throws IOException {
|
||||
public ModelAndView index(
|
||||
ModelMap map, final HttpServletRequest request,
|
||||
final @Valid String msg,
|
||||
final @Valid String currentorgi,
|
||||
final @Valid String currentname) throws IOException {
|
||||
if (super.isEnabletneant()) {
|
||||
// "0"代表超级用户
|
||||
if ("0".equals(super.getUser(request).getUsertype())) {
|
||||
// 超级管理员开启多租户访问
|
||||
if (super.getUser(request).isAdmin()) {
|
||||
map.addAttribute("tenantList", tenantRes.findByOrgid(super.getOrgid(request)));
|
||||
} else {
|
||||
List<OrgiSkillRel> orgiSkillRelList = orgiSkillRelRes.findBySkillidIn(new ArrayList<>((super.getUser(request)).getAffiliates()));
|
||||
List<OrgiSkillRel> orgiSkillRelList = orgiSkillRelRes.findBySkillidIn(
|
||||
new ArrayList<>((super.getUser(request)).getAffiliates()));
|
||||
List<Tenant> tenantList = null;
|
||||
if (!orgiSkillRelList.isEmpty()) {
|
||||
tenantList = new ArrayList<Tenant>();
|
||||
@ -112,7 +114,8 @@ public class TenantController extends Handler {
|
||||
public ModelAndView add(ModelMap map, HttpServletRequest request) {
|
||||
if (super.isTenantshare()) {
|
||||
map.addAttribute("isShowSkillGroups", true);
|
||||
List<Organ> organList = organRes.findByOrgiAndOrgid(super.getOrgiByTenantshare(request), super.getOrgid(request));
|
||||
List<Organ> organList = organRes.findByOrgiAndOrgid(
|
||||
super.getOrgiByTenantshare(request), super.getOrgid(request));
|
||||
map.addAttribute("skillGroups", organList);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/apps/tenant/add"));
|
||||
@ -131,7 +134,8 @@ public class TenantController extends Handler {
|
||||
if (!logoDir.exists()) {
|
||||
logoDir.mkdirs();
|
||||
}
|
||||
String fileName = "tenantpic/" + tenant.getId() + tenantpic.getOriginalFilename().substring(tenantpic.getOriginalFilename().lastIndexOf("."));
|
||||
String fileName = "tenantpic/" + tenant.getId() + tenantpic.getOriginalFilename().substring(
|
||||
tenantpic.getOriginalFilename().lastIndexOf("."));
|
||||
FileCopyUtils.copy(tenantpic.getBytes(), new File(path, fileName));
|
||||
tenant.setTenantlogo(fileName);
|
||||
}
|
||||
@ -164,7 +168,8 @@ public class TenantController extends Handler {
|
||||
public ModelAndView edit(ModelMap map, HttpServletRequest request, @Valid String id) {
|
||||
if (super.isTenantshare()) {
|
||||
map.addAttribute("isShowSkillGroups", true);
|
||||
List<Organ> organList = organRes.findByOrgiAndOrgid(super.getOrgiByTenantshare(request), super.getOrgid(request));
|
||||
List<Organ> organList = organRes.findByOrgiAndOrgid(
|
||||
super.getOrgiByTenantshare(request), super.getOrgid(request));
|
||||
map.addAttribute("skillGroups", organList);
|
||||
List<OrgiSkillRel> orgiSkillRelList = orgiSkillRelRes.findByOrgi(id);
|
||||
map.addAttribute("orgiSkillRelList", orgiSkillRelList);
|
||||
@ -188,7 +193,8 @@ public class TenantController extends Handler {
|
||||
if (!logoDir.exists()) {
|
||||
logoDir.mkdirs();
|
||||
}
|
||||
String fileName = "tenantpic/" + tenant.getId() + tenantpic.getOriginalFilename().substring(tenantpic.getOriginalFilename().lastIndexOf("."));
|
||||
String fileName = "tenantpic/" + tenant.getId() + tenantpic.getOriginalFilename().substring(
|
||||
tenantpic.getOriginalFilename().lastIndexOf("."));
|
||||
FileCopyUtils.copy(tenantpic.getBytes(), new File(path, fileName));
|
||||
tenant.setTenantlogo(fileName);
|
||||
} else {
|
||||
@ -232,8 +238,10 @@ public class TenantController extends Handler {
|
||||
@Menu(type = "apps", subtype = "tenant")
|
||||
public ModelAndView canswitch(HttpServletRequest request, @Valid Tenant tenant) throws UnsupportedEncodingException {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("redirect:/"));
|
||||
AgentStatus agentStatus = cache.findOneAgentStatusByAgentnoAndOrig((super.getUser(request)).getId(), super.getOrgi(request));
|
||||
if (agentStatus == null && cache.getInservAgentUsersSizeByAgentnoAndOrgi(super.getUser(request).getId(), super.getOrgi(request)) == 0) {
|
||||
AgentStatus agentStatus = cache.findOneAgentStatusByAgentnoAndOrig(
|
||||
(super.getUser(request)).getId(), super.getOrgi(request));
|
||||
if (agentStatus == null && cache.getInservAgentUsersSizeByAgentnoAndOrgi(
|
||||
super.getUser(request).getId(), super.getOrgi(request)) == 0) {
|
||||
Tenant temp = tenantRes.findById(tenant.getId());
|
||||
if (temp != null) {
|
||||
super.getUser(request).setOrgi(temp.getId());
|
||||
@ -249,10 +257,14 @@ public class TenantController extends Handler {
|
||||
return view;
|
||||
} else {
|
||||
Tenant temp = tenantRes.findById(agentStatus.getOrgi());
|
||||
return request(super.createRequestPageTempletResponse("redirect:/apps/tenant/index.html?msg=t0" + "¤torgi=" + agentStatus.getOrgi() + "¤tname=" + URLEncoder.encode(temp != null ? temp.getTenantname() : "", "UTF-8")));
|
||||
return request(super.createRequestPageTempletResponse(
|
||||
"redirect:/apps/tenant/index.html?msg=t0" + "¤torgi=" + agentStatus.getOrgi() + "¤tname=" + URLEncoder.encode(
|
||||
temp != null ? temp.getTenantname() : "", "UTF-8")));
|
||||
}
|
||||
}
|
||||
AgentUser agentUser = agentUserRepository.findOneByAgentnoAndStatusAndOrgi(super.getUser(request).getId(), MainContext.AgentUserStatusEnum.INSERVICE.toString(), super.getOrgi(request));
|
||||
AgentUser agentUser = agentUserRepository.findOneByAgentnoAndStatusAndOrgi(
|
||||
super.getUser(request).getId(), MainContext.AgentUserStatusEnum.INSERVICE.toString(),
|
||||
super.getOrgi(request));
|
||||
if (agentUser != null) {
|
||||
if (tenant.getId().equals(agentUser.getOrgi())) {
|
||||
Tenant temp = tenantRes.findById(tenant.getId());
|
||||
@ -262,7 +274,9 @@ public class TenantController extends Handler {
|
||||
return view;
|
||||
} else {
|
||||
Tenant temp = tenantRes.findById(agentUser.getOrgi());
|
||||
return request(super.createRequestPageTempletResponse("redirect:/apps/tenant/index.html?msg=t0" + "¤torgi=" + agentUser.getOrgi() + "¤tname=" + URLEncoder.encode(temp != null ? temp.getTenantname() : "", "UTF-8")));
|
||||
return request(super.createRequestPageTempletResponse(
|
||||
"redirect:/apps/tenant/index.html?msg=t0" + "¤torgi=" + agentUser.getOrgi() + "¤tname=" + URLEncoder.encode(
|
||||
temp != null ? temp.getTenantname() : "", "UTF-8")));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class ChatServiceController extends Handler {
|
||||
private OrgiSkillRelRepository orgiSkillRelService;
|
||||
|
||||
@Autowired
|
||||
private AgentAuditProxy agentAuditProxy;
|
||||
private UserProxy userProxy;
|
||||
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
@ -191,7 +191,7 @@ public class ChatServiceController extends Handler {
|
||||
List<User> userList = userRes.findAll(usersids);
|
||||
for (User user : userList) {
|
||||
user.setAgentStatus(cache.findOneAgentStatusByAgentnoAndOrig(user.getId(), super.getOrgi(request)));
|
||||
UserProxy.attachOrgansPropertiesForUser(user);
|
||||
userProxy.attachOrgansPropertiesForUser(user);
|
||||
}
|
||||
map.addAttribute("userList", userList);
|
||||
map.addAttribute("userid", agentService.getUserid());
|
||||
@ -463,7 +463,7 @@ public class ChatServiceController extends Handler {
|
||||
organIdList.add(rel.getSkillid());
|
||||
}
|
||||
}
|
||||
userList = UserProxy.findByOrganInAndAgentAndDatastatus(
|
||||
userList = userProxy.findByOrganInAndAgentAndDatastatus(
|
||||
organIdList, true, false, new PageRequest(super.getP(request), super.getPs(request), Direction.DESC,
|
||||
"createtime"));
|
||||
} else {
|
||||
|
@ -50,6 +50,9 @@ public class UsersResourceController extends Handler {
|
||||
@Autowired
|
||||
private OrganRepository organRes;
|
||||
|
||||
@Autowired
|
||||
private UserProxy userProxy;
|
||||
|
||||
@RequestMapping("/users")
|
||||
@Menu(type = "res", subtype = "users")
|
||||
public ModelAndView add(ModelMap map, HttpServletRequest request, @Valid String q, @Valid String id) {
|
||||
@ -89,7 +92,7 @@ public class UsersResourceController extends Handler {
|
||||
organIdList.add(rel.getSkillid());
|
||||
}
|
||||
}
|
||||
list = UserProxy.findByOrganInAndDatastatus(organIdList, false);
|
||||
list = userProxy.findByOrganInAndDatastatus(organIdList, false);
|
||||
} else {
|
||||
list = userRes.findByOrgiAndDatastatus(super.getOrgi(request), false);
|
||||
}
|
||||
@ -116,7 +119,7 @@ public class UsersResourceController extends Handler {
|
||||
organIdList.add(rel.getSkillid());
|
||||
}
|
||||
}
|
||||
list = UserProxy.findByOrganInAndDatastatusAndUsernameLike(organIdList, false, "%" + q + "%", new PageRequest(0, 10));
|
||||
list = userProxy.findByOrganInAndDatastatusAndUsernameLike(organIdList, false, "%" + q + "%", new PageRequest(0, 10));
|
||||
} else {
|
||||
list = userRes.findByDatastatusAndOrgiAndOrgidAndUsernameLike(false, super.getOrgi(request), super.getOrgid(request), "%" + q + "%", new PageRequest(0, 10));
|
||||
}
|
||||
|
@ -51,9 +51,8 @@ public class User implements java.io.Serializable {
|
||||
private String birthday;
|
||||
private String nickname;
|
||||
private String secureconf = "5";
|
||||
private String usertype; // 0 Admin User : !0 Other User
|
||||
|
||||
private boolean superuser = false; //是否是超级管理员
|
||||
private boolean admin; // 是否是管理员
|
||||
private boolean superadmin = false; // 是否是超级管理员
|
||||
|
||||
private String orgi;
|
||||
private String orgid;
|
||||
@ -265,16 +264,6 @@ public class User implements java.io.Serializable {
|
||||
}
|
||||
|
||||
|
||||
public String getUsertype() {
|
||||
return usertype;
|
||||
}
|
||||
|
||||
|
||||
public void setUsertype(String usertype) {
|
||||
this.usertype = usertype;
|
||||
}
|
||||
|
||||
|
||||
public String getOrgi() {
|
||||
return orgi;
|
||||
}
|
||||
@ -470,8 +459,20 @@ public class User implements java.io.Serializable {
|
||||
this.callcenter = callcenter;
|
||||
}
|
||||
|
||||
public boolean isSuperuser() {
|
||||
return superuser;
|
||||
public boolean isAdmin() {
|
||||
return admin;
|
||||
}
|
||||
|
||||
public void setAdmin(boolean admin) {
|
||||
this.admin = admin;
|
||||
}
|
||||
|
||||
public boolean isSuperadmin() {
|
||||
return superadmin;
|
||||
}
|
||||
|
||||
public void setSuperadmin(boolean superadmin) {
|
||||
this.superadmin = superadmin;
|
||||
}
|
||||
|
||||
@Transient
|
||||
@ -483,10 +484,6 @@ public class User implements java.io.Serializable {
|
||||
this.roleAuthMap = roleAuthMap;
|
||||
}
|
||||
|
||||
public void setSuperuser(boolean superuser) {
|
||||
this.superuser = superuser;
|
||||
}
|
||||
|
||||
public String getOrgid() {
|
||||
return orgid;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
package com.chatopera.cc.persistence.repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.chatopera.cc.model.User;
|
||||
import org.springframework.data.domain.Page;
|
||||
@ -28,14 +29,12 @@ import org.springframework.data.repository.query.Param;
|
||||
|
||||
public interface UserRepository extends JpaRepository<User, String> {
|
||||
User findByIdAndOrgi(String paramString, String orgi);
|
||||
|
||||
User findById(String id);
|
||||
|
||||
User findByEmailAndDatastatus(String email, boolean datastatus);
|
||||
|
||||
User findByMobileAndDatastatus(String mobile, boolean datastatus);
|
||||
|
||||
List<User> findBySipaccountAndDatastatus(String sipaccount, boolean datastatus);
|
||||
@Query(value = "SELECT * FROM cs_user WHERE sipaccount = ?1 AND DATASTATUS = ?2 LIMIT 1", nativeQuery = true)
|
||||
Optional<User> findOneBySipaccountAndDatastatus(String sipaccount, boolean datastatus);
|
||||
|
||||
@Query(value = "SELECT u FROM User u WHERE sipaccount <> '' AND datastatus = 0")
|
||||
List<User> findBySipaccountIsNotNullAndDatastatusIsFalse();
|
||||
@ -46,31 +45,25 @@ public interface UserRepository extends JpaRepository<User, String> {
|
||||
List<User> findAllByCallcenterIsTrueAndDatastatusIsFalseAndIdIn(@Param("users") List<String> users);
|
||||
|
||||
User findByUsernameAndDatastatus(String username, boolean datastatus);
|
||||
|
||||
User findByUsernameAndPasswordAndDatastatus(String username, String password, boolean datastatus);
|
||||
|
||||
User findByMobileAndPasswordAndDatastatus(String mobile, String password, boolean datastatus);
|
||||
|
||||
User findByUsernameAndOrgi(String paramString, String orgi);
|
||||
|
||||
User findByUsernameAndPassword(String username, String password);
|
||||
|
||||
Page<User> findByOrgi(String orgi, Pageable paramPageable);
|
||||
|
||||
// // 查询超级管理员
|
||||
// List<User> findBySuperadminAndOrgi(boolean isSuperadmin, final String orgi);
|
||||
|
||||
// 查询所有管理员
|
||||
List<User> findBySuperuserAndOrgi(boolean isSuperuser, final String orgi);
|
||||
|
||||
List<User> findByAdminAndOrgi(boolean admin, final String orgi);
|
||||
List<User> findByOrgi(String orgi);
|
||||
|
||||
Page<User> findByDatastatusAndOrgi(boolean datastatus, String orgi, Pageable paramPageable);
|
||||
|
||||
Page<User> findByDatastatusAndOrgiAndUsernameLike(boolean datastatus, String orgi, String username, Pageable paramPageable);
|
||||
|
||||
Page<User> findByIdAndOrgi(String id, String orgi, Pageable paramPageable);
|
||||
|
||||
List<User> findByOrgiAndDatastatusAndIdIn(String orgi,
|
||||
boolean datastatus,
|
||||
List<String> users);
|
||||
List<User> findByOrgiAndDatastatusAndIdIn(
|
||||
String orgi,
|
||||
boolean datastatus,
|
||||
List<String> users);
|
||||
|
||||
@Query(value = "SELECT s.sipaccount from User s " +
|
||||
"WHERE " +
|
||||
@ -78,9 +71,10 @@ public interface UserRepository extends JpaRepository<User, String> {
|
||||
"s.datastatus = :datastatus AND " +
|
||||
"s.id IN :users AND " +
|
||||
"s.orgi = :orgi")
|
||||
List<String> findSipsByDatastatusAndOrgiAndIdIn(@Param("datastatus") boolean datastatus,
|
||||
@Param("orgi") String orgi,
|
||||
@Param("users") List<String> users);
|
||||
List<String> findSipsByDatastatusAndOrgiAndIdIn(
|
||||
@Param("datastatus") boolean datastatus,
|
||||
@Param("orgi") String orgi,
|
||||
@Param("users") List<String> users);
|
||||
|
||||
List<User> findByOrgiAndDatastatus(final String orgi, final boolean datastatus);
|
||||
|
||||
@ -88,31 +82,40 @@ public interface UserRepository extends JpaRepository<User, String> {
|
||||
|
||||
List<User> findByOrgiAndAgentAndDatastatus(final String orgi, final boolean agent, final boolean status);
|
||||
|
||||
long countByAgentAndDatastatusAndIdIn(final boolean agent,
|
||||
final boolean datastatus,
|
||||
final List<String> users);
|
||||
long countByAgentAndDatastatusAndIdIn(
|
||||
final boolean agent,
|
||||
final boolean datastatus,
|
||||
final List<String> users);
|
||||
|
||||
List<User> findAll(Specification<User> spec);
|
||||
|
||||
|
||||
Page<User> findByDatastatusAndOrgiAndOrgid(boolean b, String orgi, String orgid,
|
||||
Pageable pageRequest);
|
||||
Page<User> findByDatastatusAndOrgiAndOrgid(
|
||||
boolean b, String orgi, String orgid,
|
||||
Pageable pageRequest);
|
||||
|
||||
Page<User> findByDatastatusAndOrgiAndOrgidAndSuperadminNot(
|
||||
boolean datastatus, String orgi, String orgid, boolean superadmin,
|
||||
Pageable pageRequest);
|
||||
|
||||
|
||||
|
||||
List<User> findByOrgiAndDatastatusAndOrgid(String orgi, boolean b, String orgid);
|
||||
|
||||
|
||||
Page<User> findByDatastatusAndOrgiAndOrgidAndUsernameLike(boolean Datastatus,
|
||||
final String orgi,
|
||||
final String orgid,
|
||||
final String username,
|
||||
Pageable pageRequest);
|
||||
Page<User> findByDatastatusAndOrgiAndOrgidAndUsernameLike(
|
||||
boolean Datastatus,
|
||||
final String orgi,
|
||||
final String orgid,
|
||||
final String username,
|
||||
Pageable pageRequest);
|
||||
|
||||
|
||||
Page<User> findByAgentAndDatastatusAndIdIn(boolean agent,
|
||||
boolean datastatus,
|
||||
final List<String> users,
|
||||
Pageable pageRequest);
|
||||
Page<User> findByAgentAndDatastatusAndIdIn(
|
||||
boolean agent,
|
||||
boolean datastatus,
|
||||
final List<String> users,
|
||||
Pageable pageRequest);
|
||||
|
||||
List<User> findByAgentAndDatastatusAndIdIn(boolean agent, boolean datastatus, final List<String> users);
|
||||
|
||||
@ -120,9 +123,10 @@ public interface UserRepository extends JpaRepository<User, String> {
|
||||
List<User> findByDatastatusAndIdIn(boolean datastatus, List<String> users);
|
||||
|
||||
|
||||
Page<User> findByDatastatusAndUsernameLikeAndIdIn(boolean datastatus,
|
||||
final String username,
|
||||
final List<String> users, Pageable pageRequest);
|
||||
Page<User> findByDatastatusAndUsernameLikeAndIdIn(
|
||||
boolean datastatus,
|
||||
final String username,
|
||||
final List<String> users, Pageable pageRequest);
|
||||
|
||||
List<User> findByOrgidAndAgentAndDatastatus(String orgid, boolean agent, boolean datastatus);
|
||||
|
||||
|
@ -276,8 +276,8 @@ public class AgentUserProxy {
|
||||
bypass.add(agentUser.getAgentno());
|
||||
}
|
||||
|
||||
// 首先查看超级用户
|
||||
List<User> admins = userRes.findBySuperuserAndOrgi(true, orgi);
|
||||
// 首先查看管理员
|
||||
List<User> admins = userRes.findByAdminAndOrgi(true, orgi);
|
||||
|
||||
for (final User user : admins) {
|
||||
if (bypass.contains(user.getId())) continue;
|
||||
|
@ -69,6 +69,7 @@ public class OnlineUserProxy {
|
||||
private static AgentUserProxy agentUserProxy;
|
||||
private static AgentUserContactsRepository agentUserContactsRes;
|
||||
private static ContactsRepository contactsRes;
|
||||
private static UserProxy userProxy;
|
||||
|
||||
// Compare two onlineUser by createtime
|
||||
public final static Comparator<OnlineUser> compareByCreateTime = (OnlineUser o1, OnlineUser o2) -> o1.getCreatetime().compareTo(
|
||||
@ -362,7 +363,7 @@ public class OnlineUserProxy {
|
||||
for (User user : agentList) {
|
||||
// TODO 此处的查询处理比较多,应使用缓存
|
||||
// 一个用户可隶属于多个组织
|
||||
UserProxy.attachOrgansPropertiesForUser(user);
|
||||
getUserProxy().attachOrgansPropertiesForUser(user);
|
||||
for (OrgiSkillRel rel : orgiSkillRelList) {
|
||||
if (user.getOrgans().size() > 0 && user.inAffiliates(rel.getSkillid())) {
|
||||
agentTempList.add(user);
|
||||
@ -1557,4 +1558,11 @@ public class OnlineUserProxy {
|
||||
}
|
||||
return orgiSkillRelRes;
|
||||
}
|
||||
|
||||
public static UserProxy getUserProxy() {
|
||||
if (userProxy == null) {
|
||||
userProxy = MainContext.getContext().getBean(UserProxy.class);
|
||||
}
|
||||
return userProxy;
|
||||
}
|
||||
}
|
||||
|
@ -11,38 +11,84 @@
|
||||
|
||||
package com.chatopera.cc.proxy;
|
||||
|
||||
import com.chatopera.cc.basic.Constants;
|
||||
import com.chatopera.cc.basic.MainContext;
|
||||
import com.chatopera.cc.basic.MainUtils;
|
||||
import com.chatopera.cc.model.Organ;
|
||||
import com.chatopera.cc.model.OrganUser;
|
||||
import com.chatopera.cc.model.User;
|
||||
import com.chatopera.cc.persistence.repository.OrganRepository;
|
||||
import com.chatopera.cc.persistence.repository.OrganUserRepository;
|
||||
import com.chatopera.cc.persistence.repository.UserRepository;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 用户/坐席 常用方法
|
||||
*/
|
||||
@Component
|
||||
public class UserProxy {
|
||||
private final static Logger logger = LoggerFactory.getLogger(UserProxy.class);
|
||||
|
||||
private static OrganUserRepository organUserRes;
|
||||
private static OrganRepository organRes;
|
||||
private static UserRepository userRes;
|
||||
@Autowired
|
||||
private OrganUserRepository organUserRes;
|
||||
|
||||
@Autowired
|
||||
private OrganRepository organRes;
|
||||
|
||||
public static User findOne(final String id) {
|
||||
return getUserRes().findOne(id);
|
||||
@Autowired
|
||||
private UserRepository userRes;
|
||||
|
||||
/**
|
||||
* 创建新用户
|
||||
* 支持多租户
|
||||
*
|
||||
* @param user
|
||||
* @param orgi
|
||||
* @param orgid
|
||||
* @param orgiByTenantshare
|
||||
* @return
|
||||
*/
|
||||
public String createNewUser(final User user, final String orgi, final String orgid, final String orgiByTenantshare) {
|
||||
String msg = "";
|
||||
msg = validUser(user);
|
||||
if (StringUtils.isNotBlank(msg) && !msg.equals("new_user_success")) {
|
||||
return msg;
|
||||
} else {
|
||||
// 此时 msg 是 new_user_success
|
||||
user.setSuperadmin(false); // 不支持创建第二个超级管理员
|
||||
|
||||
if (StringUtils.isNotBlank(user.getPassword())) {
|
||||
user.setPassword(MainUtils.md5(user.getPassword()));
|
||||
}
|
||||
|
||||
user.setOrgi(orgiByTenantshare);
|
||||
if (StringUtils.isNotBlank(orgid)) {
|
||||
user.setOrgid(orgid);
|
||||
} else {
|
||||
user.setOrgid(MainContext.SYSTEM_ORGI);
|
||||
}
|
||||
userRes.save(user);
|
||||
OnlineUserProxy.clean(orgi);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
public static List<String> findUserIdsInOrgan(final String organ) {
|
||||
List<OrganUser> x = getOrganUserRes().findByOrgan(organ);
|
||||
public User findOne(final String id) {
|
||||
return userRes.findOne(id);
|
||||
}
|
||||
|
||||
public List<String> findUserIdsInOrgan(final String organ) {
|
||||
List<OrganUser> x = organUserRes.findByOrgan(organ);
|
||||
|
||||
if (x.size() == 0) {
|
||||
return null;
|
||||
@ -55,9 +101,9 @@ public class UserProxy {
|
||||
return z;
|
||||
}
|
||||
|
||||
public static List<String> findUserIdsInOrgans(final List<String> organs) {
|
||||
public List<String> findUserIdsInOrgans(final List<String> organs) {
|
||||
|
||||
List<OrganUser> x = getOrganUserRes().findByOrganIn(organs);
|
||||
List<OrganUser> x = organUserRes.findByOrganIn(organs);
|
||||
|
||||
if (x.size() == 0) return null;
|
||||
|
||||
@ -78,9 +124,9 @@ public class UserProxy {
|
||||
* @param agentno
|
||||
* @return
|
||||
*/
|
||||
public static HashMap<String, String> getSkillsMapByAgentno(final String agentno) {
|
||||
public HashMap<String, String> getSkillsMapByAgentno(final String agentno) {
|
||||
|
||||
final User user = getUserRes().findOne(agentno);
|
||||
final User user = userRes.findOne(agentno);
|
||||
if (user == null) return new HashMap<>();
|
||||
|
||||
attachOrgansPropertiesForUser(user);
|
||||
@ -93,8 +139,8 @@ public class UserProxy {
|
||||
* @param userid
|
||||
* @return
|
||||
*/
|
||||
public static List<String> findOrgansByUserid(final String userid) {
|
||||
List<OrganUser> x = getOrganUserRes().findByUserid(userid);
|
||||
public List<String> findOrgansByUserid(final String userid) {
|
||||
List<OrganUser> x = organUserRes.findByUserid(userid);
|
||||
|
||||
if (x.size() == 0) return null;
|
||||
|
||||
@ -108,7 +154,7 @@ public class UserProxy {
|
||||
}
|
||||
|
||||
|
||||
public static Page<User> findByOrganInAndAgentAndDatastatus(
|
||||
public Page<User> findByOrganInAndAgentAndDatastatus(
|
||||
final List<String> organs,
|
||||
boolean agent,
|
||||
boolean datastatus,
|
||||
@ -117,11 +163,11 @@ public class UserProxy {
|
||||
|
||||
if (users == null) return null;
|
||||
|
||||
return getUserRes().findByAgentAndDatastatusAndIdIn(agent, datastatus, users, pageRequest);
|
||||
return userRes.findByAgentAndDatastatusAndIdIn(agent, datastatus, users, pageRequest);
|
||||
|
||||
}
|
||||
|
||||
public static List<User> findByOrganInAndAgentAndDatastatus(
|
||||
public List<User> findByOrganInAndAgentAndDatastatus(
|
||||
final List<String> organs,
|
||||
boolean agent,
|
||||
boolean datastatus) {
|
||||
@ -129,51 +175,146 @@ public class UserProxy {
|
||||
|
||||
if (users == null) return null;
|
||||
|
||||
return getUserRes().findByAgentAndDatastatusAndIdIn(agent, datastatus, users);
|
||||
return userRes.findByAgentAndDatastatusAndIdIn(agent, datastatus, users);
|
||||
}
|
||||
|
||||
|
||||
public static List<User> findByOrganInAndDatastatus(
|
||||
public List<User> findByOrganInAndDatastatus(
|
||||
final List<String> organs,
|
||||
boolean datastatus) {
|
||||
List<String> users = findUserIdsInOrgans(organs);
|
||||
|
||||
if (users == null) return null;
|
||||
|
||||
return getUserRes().findByDatastatusAndIdIn(datastatus, users);
|
||||
return userRes.findByDatastatusAndIdIn(datastatus, users);
|
||||
}
|
||||
|
||||
|
||||
public static Page<User> findByOrganInAndDatastatusAndUsernameLike(
|
||||
public Page<User> findByOrganInAndDatastatusAndUsernameLike(
|
||||
final List<String> organs,
|
||||
final boolean datastatus,
|
||||
final String username,
|
||||
Pageable pageRequest) {
|
||||
List<String> users = findUserIdsInOrgans(organs);
|
||||
|
||||
if (users == null) return null;
|
||||
|
||||
return getUserRes().findByDatastatusAndUsernameLikeAndIdIn(datastatus, username, users, pageRequest);
|
||||
|
||||
return userRes.findByDatastatusAndUsernameLikeAndIdIn(datastatus, username, users, pageRequest);
|
||||
}
|
||||
|
||||
public static List<User> findByOrganAndOrgiAndDatastatus(final String organ, final String orgi, final boolean datastatus) {
|
||||
public List<User> findByOrganAndOrgiAndDatastatus(final String organ, final String orgi, final boolean datastatus) {
|
||||
List<String> users = findUserIdsInOrgan(organ);
|
||||
|
||||
if (users == null) return null;
|
||||
|
||||
return getUserRes().findByOrgiAndDatastatusAndIdIn(orgi, datastatus, users);
|
||||
return userRes.findByOrgiAndDatastatusAndIdIn(orgi, datastatus, users);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据是否开启呼叫中心模块检测账号
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public boolean validUserCallcenterParams(final User user) {
|
||||
if (user.isCallcenter() && MainContext.hasModule(Constants.CSKEFU_MODULE_CALLOUT)) {
|
||||
return (!userRes.findOneBySipaccountAndDatastatus(
|
||||
user.getSipaccount(), false).isPresent()) || user.getSipaccount() == "";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static List<User> findAllByCallcenterIsTrueAndDatastatusIsFalseAndOrgan(final String organ) {
|
||||
/**
|
||||
* 从Json中创建User
|
||||
*
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
private User exetractUserFromJson(final JsonObject json) {
|
||||
User tempUser = new User();
|
||||
|
||||
if (json.has("username")) {
|
||||
String val = json.get("username").getAsString();
|
||||
if (StringUtils.isNotBlank(val)) {
|
||||
tempUser.setUsername(val);
|
||||
}
|
||||
}
|
||||
|
||||
if (json.has("uname")) {
|
||||
String val = json.get("uname").getAsString();
|
||||
if (StringUtils.isNotBlank(val)) {
|
||||
tempUser.setUname(val);
|
||||
}
|
||||
}
|
||||
|
||||
if (json.has("email")) {
|
||||
String val = json.get("email").getAsString();
|
||||
if (StringUtils.isNotBlank(val)) {
|
||||
tempUser.setEmail(val);
|
||||
}
|
||||
}
|
||||
|
||||
if (json.has("mobile")) {
|
||||
String val = json.get("mobile").getAsString();
|
||||
if (StringUtils.isNotBlank(val)) {
|
||||
tempUser.setMobile(val);
|
||||
}
|
||||
}
|
||||
|
||||
// 密码
|
||||
|
||||
|
||||
return tempUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证用户数据合法性
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public String validUser(final User user) {
|
||||
String msg = "";
|
||||
User tempUser = userRes.findByUsernameAndDatastatus(user.getUsername(), false);
|
||||
if (tempUser != null) {
|
||||
msg = "username_exist";
|
||||
return msg;
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(user.getEmail())) {
|
||||
tempUser = userRes.findByEmailAndDatastatus(user.getEmail(), false);
|
||||
if (tempUser != null) {
|
||||
msg = "email_exist";
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(user.getMobile())) {
|
||||
tempUser = userRes.findByMobileAndDatastatus(user.getMobile(), false);
|
||||
if (tempUser != null) {
|
||||
msg = "mobile_exist";
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
if (!validUserCallcenterParams(user)) {
|
||||
msg = "sip_account_exist";
|
||||
return msg;
|
||||
}
|
||||
|
||||
if (tempUser == null && validUserCallcenterParams(user)) {
|
||||
msg = "new_user_success";
|
||||
return msg;
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
public List<User> findAllByCallcenterIsTrueAndDatastatusIsFalseAndOrgan(final String organ) {
|
||||
|
||||
final List<String> users = findUserIdsInOrgan(organ);
|
||||
|
||||
if (users == null) return null;
|
||||
|
||||
return getUserRes().findAllByCallcenterIsTrueAndDatastatusIsFalseAndIdIn(users);
|
||||
return userRes.findAllByCallcenterIsTrueAndDatastatusIsFalseAndIdIn(users);
|
||||
|
||||
}
|
||||
|
||||
@ -185,12 +326,12 @@ public class UserProxy {
|
||||
* @param orgi
|
||||
* @return
|
||||
*/
|
||||
public static List<String> findSipsByOrganAndDatastatusAndOrgi(final String organ, final boolean datastatus, final String orgi) {
|
||||
public List<String> findSipsByOrganAndDatastatusAndOrgi(final String organ, final boolean datastatus, final String orgi) {
|
||||
List<String> users = findUserIdsInOrgan(organ);
|
||||
|
||||
if (users == null) return null;
|
||||
|
||||
return getUserRes().findSipsByDatastatusAndOrgiAndIdIn(datastatus, orgi, users);
|
||||
return userRes.findSipsByDatastatusAndOrgiAndIdIn(datastatus, orgi, users);
|
||||
}
|
||||
|
||||
|
||||
@ -203,7 +344,7 @@ public class UserProxy {
|
||||
* @param organ
|
||||
* @return
|
||||
*/
|
||||
public static long countByOrgiAndAgentAndDatastatusAndOrgan(
|
||||
public long countByOrgiAndAgentAndDatastatusAndOrgan(
|
||||
final String orgi,
|
||||
final boolean agent,
|
||||
final boolean datastatus,
|
||||
@ -213,7 +354,7 @@ public class UserProxy {
|
||||
|
||||
if (users == null) return 0;
|
||||
|
||||
return getUserRes().countByAgentAndDatastatusAndIdIn(agent, datastatus, users);
|
||||
return userRes.countByAgentAndDatastatusAndIdIn(agent, datastatus, users);
|
||||
|
||||
}
|
||||
|
||||
@ -222,7 +363,7 @@ public class UserProxy {
|
||||
*
|
||||
* @param user
|
||||
*/
|
||||
public static void processAffiliates(final User user, final Map<String, String> skills, final Organ organ) {
|
||||
public void processAffiliates(final User user, final Map<String, String> skills, final Organ organ) {
|
||||
if (organ == null) {
|
||||
return;
|
||||
}
|
||||
@ -236,7 +377,7 @@ public class UserProxy {
|
||||
if (organ.isSkill()) skills.put(organ.getId(), organ.getName());
|
||||
|
||||
// 获得子部门
|
||||
List<Organ> y = getOrganRes().findByOrgiAndParent(user.getOrgi(), organ.getId());
|
||||
List<Organ> y = organRes.findByOrgiAndParent(user.getOrgi(), organ.getId());
|
||||
|
||||
for (Organ x : y) {
|
||||
try {
|
||||
@ -253,14 +394,14 @@ public class UserProxy {
|
||||
*
|
||||
* @param user
|
||||
*/
|
||||
public static void attachOrgansPropertiesForUser(final User user) {
|
||||
List<OrganUser> organs = getOrganUserRes().findByUserid(user.getId());
|
||||
public void attachOrgansPropertiesForUser(final User user) {
|
||||
List<OrganUser> organs = organUserRes.findByUserid(user.getId());
|
||||
user.setOrgans(new HashMap<>());
|
||||
final HashMap<String, String> skills = new HashMap<>();
|
||||
|
||||
for (final OrganUser organ : organs) {
|
||||
// 添加直属部门到organs
|
||||
final Organ o = getOrganRes().findOne(organ.getOrgan());
|
||||
final Organ o = organRes.findOne(organ.getOrgan());
|
||||
user.getOrgans().put(organ.getOrgan(), o);
|
||||
|
||||
// 添加部门及附属部门
|
||||
@ -269,26 +410,4 @@ public class UserProxy {
|
||||
|
||||
user.setSkills(skills);
|
||||
}
|
||||
|
||||
|
||||
private static OrganRepository getOrganRes() {
|
||||
if (organRes == null) {
|
||||
organRes = MainContext.getContext().getBean(OrganRepository.class);
|
||||
}
|
||||
return organRes;
|
||||
}
|
||||
|
||||
private static OrganUserRepository getOrganUserRes() {
|
||||
if (organUserRes == null) {
|
||||
organUserRes = MainContext.getContext().getBean(OrganUserRepository.class);
|
||||
}
|
||||
return organUserRes;
|
||||
}
|
||||
|
||||
private static UserRepository getUserRes() {
|
||||
if (userRes == null) {
|
||||
userRes = MainContext.getContext().getBean(UserRepository.class);
|
||||
}
|
||||
return userRes;
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,7 @@ public class AgentEventHandler {
|
||||
private static AgentUserProxy agentUserProxy;
|
||||
private static AgentProxy agentProxy;
|
||||
private static AgentSessionProxy agentSessionProxy;
|
||||
private static UserProxy userProxy;
|
||||
|
||||
@OnConnect
|
||||
public void onConnect(SocketIOClient client) {
|
||||
@ -93,7 +94,7 @@ public class AgentEventHandler {
|
||||
agentStatus.setConnected(true);
|
||||
|
||||
// 设置agentSkills
|
||||
agentStatus.setSkills(UserProxy.getSkillsMapByAgentno(userid));
|
||||
agentStatus.setSkills(getUserProxy().getSkillsMapByAgentno(userid));
|
||||
|
||||
getAgentStatusRes().save(agentStatus);
|
||||
MainContext.getCache().putAgentStatusByOrgi(agentStatus, orgi);
|
||||
@ -199,7 +200,7 @@ public class AgentEventHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
final User supervisor = UserProxy.findOne(received.getSupervisorid());
|
||||
final User supervisor = getUserProxy().findOne(received.getSupervisorid());
|
||||
final Date now = new Date();
|
||||
|
||||
// 创建消息
|
||||
@ -355,4 +356,10 @@ public class AgentEventHandler {
|
||||
return agentSessionProxy;
|
||||
}
|
||||
|
||||
public static UserProxy getUserProxy() {
|
||||
if (userProxy == null) {
|
||||
userProxy = MainContext.getContext().getBean(UserProxy.class);
|
||||
}
|
||||
return userProxy;
|
||||
}
|
||||
}
|
@ -43,6 +43,9 @@ import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||
|
||||
public class CallCenterUtils {
|
||||
|
||||
|
||||
private static UserProxy userProxy;
|
||||
|
||||
/**
|
||||
* @param extno
|
||||
* @param sipTrunkRes
|
||||
@ -108,7 +111,8 @@ public class CallCenterUtils {
|
||||
ArrayList<String> organList = new ArrayList<String>();
|
||||
if (userRole.size() > 0) {
|
||||
for (UserRole userTemp : userRole) {
|
||||
UKefuCallOutRole roleOrgan = callOutRoleRes.findByOrgiAndRoleid(user.getOrgi(),
|
||||
UKefuCallOutRole roleOrgan = callOutRoleRes.findByOrgiAndRoleid(
|
||||
user.getOrgi(),
|
||||
userTemp.getRole().getId());
|
||||
if (roleOrgan != null) {
|
||||
if (StringUtils.isNotBlank(roleOrgan.getOrganid())) {
|
||||
@ -122,7 +126,7 @@ public class CallCenterUtils {
|
||||
}
|
||||
}
|
||||
|
||||
UserProxy.attachOrgansPropertiesForUser(user);
|
||||
getUserProxy().attachOrgansPropertiesForUser(user);
|
||||
if (user.getAffiliates().size() > 0) {
|
||||
for (final String organ : user.getAffiliates()) {
|
||||
organList.add(organ);
|
||||
@ -149,8 +153,9 @@ public class CallCenterUtils {
|
||||
|
||||
List<JobDetail> batchList = batchRes.findAll(new Specification<JobDetail>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<JobDetail> root, CriteriaQuery<?> query,
|
||||
CriteriaBuilder cb) {
|
||||
public Predicate toPredicate(
|
||||
Root<JobDetail> root, CriteriaQuery<?> query,
|
||||
CriteriaBuilder cb) {
|
||||
List<Predicate> list = new ArrayList<Predicate>();
|
||||
In<Object> in = cb.in(root.get("organ"));
|
||||
|
||||
@ -192,8 +197,9 @@ public class CallCenterUtils {
|
||||
|
||||
List<FormFilter> formFilterList = filterRes.findAll(new Specification<FormFilter>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<FormFilter> root, CriteriaQuery<?> query,
|
||||
CriteriaBuilder cb) {
|
||||
public Predicate toPredicate(
|
||||
Root<FormFilter> root, CriteriaQuery<?> query,
|
||||
CriteriaBuilder cb) {
|
||||
List<Predicate> list = new ArrayList<Predicate>();
|
||||
In<Object> in = cb.in(root.get("organ"));
|
||||
|
||||
@ -234,8 +240,9 @@ public class CallCenterUtils {
|
||||
|
||||
List<JobDetail> activityList = batchRes.findAll(new Specification<JobDetail>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<JobDetail> root, CriteriaQuery<?> query,
|
||||
CriteriaBuilder cb) {
|
||||
public Predicate toPredicate(
|
||||
Root<JobDetail> root, CriteriaQuery<?> query,
|
||||
CriteriaBuilder cb) {
|
||||
List<Predicate> list = new ArrayList<Predicate>();
|
||||
In<Object> in = cb.in(root.get("organ"));
|
||||
|
||||
@ -278,7 +285,8 @@ public class CallCenterUtils {
|
||||
List<JobDetail> activityList = CallCenterUtils.getActivityList(batchRes, userRoleRes, callOutRoleRes, user);
|
||||
List<SaleStatus> salestatusList = new ArrayList<>();
|
||||
for (JobDetail act : activityList) {
|
||||
List<SaleStatus> salestastus = MainContext.getContext().getBean(SaleStatusRepository.class).findByOrgiAndActivityid(user.getOrgi(), act.getDicid());
|
||||
List<SaleStatus> salestastus = MainContext.getContext().getBean(
|
||||
SaleStatusRepository.class).findByOrgiAndActivityid(user.getOrgi(), act.getDicid());
|
||||
salestatusList.addAll(salestastus);
|
||||
|
||||
}
|
||||
@ -292,14 +300,24 @@ public class CallCenterUtils {
|
||||
map.put("formFilterList", CallCenterUtils.getFormFilterList(filterRes, userRoleRes, callOutRoleRes, user));
|
||||
if (StringUtils.isBlank(ownerdept)) {
|
||||
|
||||
map.addAttribute("owneruserList", UserProxy.findByOrganAndOrgiAndDatastatus(Constants.CSKEFU_SYSTEM_NO_DAT, user.getOrgi(), false));
|
||||
map.addAttribute(
|
||||
"owneruserList",
|
||||
getUserProxy().findByOrganAndOrgiAndDatastatus(
|
||||
Constants.CSKEFU_SYSTEM_NO_DAT, user.getOrgi(), false));
|
||||
} else {
|
||||
map.addAttribute("owneruserList", UserProxy.findByOrganAndOrgiAndDatastatus(ownerdept, user.getOrgi(), false));
|
||||
map.addAttribute(
|
||||
"owneruserList", getUserProxy().findByOrganAndOrgiAndDatastatus(ownerdept, user.getOrgi(), false));
|
||||
|
||||
}
|
||||
map.addAttribute("skillGroups", organRes.findAll(CallCenterUtils.getAuthOrgan(userRoleRes, callOutRoleRes, user)));
|
||||
map.put("taskList", MainContext.getContext().getBean(UKefuCallOutTaskRepository.class).findByActidAndOrgi(actid, user.getOrgi()));
|
||||
map.put("allUserList", MainContext.getContext().getBean(UserRepository.class).findByOrgiAndDatastatus(user.getOrgi(), false));
|
||||
map.addAttribute(
|
||||
"skillGroups", organRes.findAll(CallCenterUtils.getAuthOrgan(userRoleRes, callOutRoleRes, user)));
|
||||
map.put(
|
||||
"taskList", MainContext.getContext().getBean(UKefuCallOutTaskRepository.class).findByActidAndOrgi(
|
||||
actid,
|
||||
user.getOrgi()));
|
||||
map.put(
|
||||
"allUserList",
|
||||
MainContext.getContext().getBean(UserRepository.class).findByOrgiAndDatastatus(user.getOrgi(), false));
|
||||
//JobDetail act = batchRes.findByIdAndOrgi(actid, user.getOrgi());
|
||||
//if(act != null){
|
||||
// map.put("salestatusList",MainContext.getContext().getBean(SaleStatusRepository.class).findByOrgiAndActivityid(user.getOrgi(), act.getDicid()));
|
||||
@ -370,7 +388,8 @@ public class CallCenterUtils {
|
||||
|
||||
UKefuCallOutTaskRepository callOutTaskRes = MainContext.getContext().getBean(UKefuCallOutTaskRepository.class);
|
||||
JobDetailRepository batchRes = MainContext.getContext().getBean(JobDetailRepository.class);
|
||||
UKefuCallOutFilterRepository callOutFilterRes = MainContext.getContext().getBean(UKefuCallOutFilterRepository.class);
|
||||
UKefuCallOutFilterRepository callOutFilterRes = MainContext.getContext().getBean(
|
||||
UKefuCallOutFilterRepository.class);
|
||||
|
||||
//修改,拨打任务
|
||||
if (task != null) {
|
||||
@ -405,7 +424,8 @@ public class CallCenterUtils {
|
||||
public static void getAgentReorgannum(UKefuCallOutTask task, UKefuCallOutFilter ukefuCallOutFilter) {
|
||||
|
||||
UKefuCallOutTaskRepository callOutTaskRes = MainContext.getContext().getBean(UKefuCallOutTaskRepository.class);
|
||||
UKefuCallOutFilterRepository callOutFilterRes = MainContext.getContext().getBean(UKefuCallOutFilterRepository.class);
|
||||
UKefuCallOutFilterRepository callOutFilterRes = MainContext.getContext().getBean(
|
||||
UKefuCallOutFilterRepository.class);
|
||||
|
||||
//修改,拨打任务
|
||||
if (task != null) {
|
||||
@ -435,7 +455,8 @@ public class CallCenterUtils {
|
||||
|
||||
UKefuCallOutTaskRepository callOutTaskRes = MainContext.getContext().getBean(UKefuCallOutTaskRepository.class);
|
||||
JobDetailRepository batchRes = MainContext.getContext().getBean(JobDetailRepository.class);
|
||||
UKefuCallOutFilterRepository callOutFilterRes = MainContext.getContext().getBean(UKefuCallOutFilterRepository.class);
|
||||
UKefuCallOutFilterRepository callOutFilterRes = MainContext.getContext().getBean(
|
||||
UKefuCallOutFilterRepository.class);
|
||||
|
||||
//修改,拨打任务
|
||||
if (task != null) {
|
||||
@ -476,5 +497,10 @@ public class CallCenterUtils {
|
||||
return dataList.getContent().size();
|
||||
}
|
||||
|
||||
|
||||
public static UserProxy getUserProxy() {
|
||||
if (userProxy == null) {
|
||||
userProxy = MainContext.getContext().getBean(UserProxy.class);
|
||||
}
|
||||
return userProxy;
|
||||
}
|
||||
}
|
||||
|
@ -18,9 +18,6 @@
|
||||
# 在集群状态下,每个Node都有自己唯一的ID
|
||||
application.node.id=localhost
|
||||
|
||||
# 运行环境,production|development
|
||||
application.env=production
|
||||
|
||||
##############################################
|
||||
# 安全设置
|
||||
##############################################
|
||||
|
@ -39,7 +39,7 @@
|
||||
<i class="layui-icon"></i>
|
||||
编辑
|
||||
</a>
|
||||
<#if !(snsAccount.usertype?? && snsAccount.usertype == "0") && snsAccount.datastatus != true >
|
||||
<#if !(snsAccount.admin) && snsAccount.datastatus != true >
|
||||
<a href="/admin/im/delete.html?id=${snsAccount.id!''}" style="margin-left:10px;" data-toggle="tip" <#if secret?? && secret.enable == true>data-confirm="请输入二次安全验证密码"</#if> title="删除网站需要进行二次密码验证,请确认是否删除?" >
|
||||
<i class="layui-icon" style="color:red;">ဆ</i>
|
||||
删除
|
||||
@ -75,9 +75,9 @@
|
||||
var layer = layui.layer;
|
||||
console.log(window.location.href)
|
||||
<#if status?? && status == 'new_webim_success'>
|
||||
layer.msg('网站添加成功',{icon: 1, offset: 'rb', time: 1000})
|
||||
layer.msg('网站添加成功',{icon: 1, time: 1000})
|
||||
<#elseif status?? && status == 'new_webim_fail'>
|
||||
layer.msg('网站添加失败',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('网站添加失败',{icon: 2, time: 3000})
|
||||
</#if>
|
||||
});
|
||||
|
||||
|
@ -107,16 +107,16 @@ word-break: break-all;"><#if roleData??>${roleData.name!''}<#else>坐席组</#if
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer
|
||||
<#if msg?? && msg == 'admin_role_save_success'>
|
||||
layer.msg('添加成功',{icon: 1, offset: 'rb', time: 1000})
|
||||
layer.msg('添加成功',{icon: 1, time: 1000})
|
||||
</#if>
|
||||
<#if msg?? && msg == 'admin_role_save_exist'>
|
||||
layer.msg('角色添加失败,角色已存在',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('角色添加失败,角色已存在',{icon: 2, time: 3000})
|
||||
</#if>
|
||||
<#if msg?? && msg == 'admin_role_update_success'>
|
||||
layer.msg('角色修改成功',{icon: 1, offset: 'rb', time: 1000})
|
||||
layer.msg('角色修改成功',{icon: 1, time: 1000})
|
||||
</#if>
|
||||
<#if msg?? && msg == 'admin_role_update_not_exist'>
|
||||
layer.msg('角色修改失败',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('角色修改失败',{icon: 2, time: 3000})
|
||||
</#if>
|
||||
});
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">管理员:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="checkbox" name="superuser" lay-skin="switch" lay-filter="admincheckbox" value="1" lay-text="是|否">
|
||||
<input type="checkbox" name="admin" lay-skin="switch" lay-filter="admincheckbox" value="1" lay-text="是|否">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" id="agentDiv">
|
||||
@ -60,15 +60,16 @@
|
||||
</#if>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
<button class="layui-btn" lay-submit lay-filter="sys-user-create">提交</button>
|
||||
<!-- <button class="layui-btn" lay-submit lay-filter="sys-user-create-follow">提交并创建下一个</button>-->
|
||||
<button type="reset" class="layui-btn layui-btn-warm">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
@ -121,5 +122,18 @@ layui.use('form', function(){
|
||||
$('#sipAccountDiv').hide();
|
||||
}
|
||||
});
|
||||
|
||||
form.on('submit(sys-user-create)', function (data) {
|
||||
// TODO use RestAPI
|
||||
// console.log(data.field)
|
||||
return true;
|
||||
})
|
||||
|
||||
// // 保存成功后,继续留在当前页面,重制并创建下一个
|
||||
// form.on('submit(sys-user-create-follow)', function (data) {
|
||||
// // TODO use RestAPI
|
||||
// console.log(data.field)
|
||||
// return false;
|
||||
// })
|
||||
});
|
||||
</script>
|
||||
|
@ -39,7 +39,7 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">管理员:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="checkbox" name="superuser" lay-skin="switch" value="1" lay-filter="admincheckbox" lay-text="是|否" <#if userData.usertype == "0">checked="checked"</#if>>
|
||||
<input type="checkbox" name="admin" lay-skin="switch" value="1" lay-filter="admincheckbox" lay-text="是|否" <#if userData.admin>checked="checked"</#if>>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" id="agentDiv">
|
||||
|
@ -70,7 +70,7 @@
|
||||
</td>
|
||||
</#if>
|
||||
<td>
|
||||
<#if user.usertype?? && user.usertype =="0">
|
||||
<#if user.admin>
|
||||
<i class="layui-icon" style="color:#19a55d;"></i>
|
||||
</#if>
|
||||
</td>
|
||||
@ -79,7 +79,7 @@
|
||||
<i class="layui-icon"></i>
|
||||
编辑
|
||||
</a>
|
||||
<#if !(user.usertype?? && user.usertype == "0") && user.datastatus != true >
|
||||
<#if !(user.admin) && user.datastatus != true >
|
||||
<a href="/admin/user/delete.html?id=${user.id!''}" style="margin-left:10px;" data-toggle="tip" data-title="请确认是否删除记录?">
|
||||
<i class="layui-icon" style="color:red;">ဆ</i>
|
||||
删除
|
||||
@ -102,19 +102,19 @@
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
<#if msg?? && msg == 'username_exist'>
|
||||
layer.msg('用户名存在,请重新填写',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('用户名存在,请重新填写',{icon: 2, time: 3000})
|
||||
<#elseif msg?? && msg == 'email_exist'>
|
||||
layer.msg('邮件存在,请重新填写',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('邮件存在,请重新填写',{icon: 2, time: 3000})
|
||||
<#elseif msg?? && msg == 'mobile_exist'>
|
||||
layer.msg('手机存在,请重新填写',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('手机存在,请重新填写',{icon: 2, time: 3000})
|
||||
<#elseif msg?? && msg == 'sip_account_exist'>
|
||||
layer.msg('SIP地址已经存在,请重新填写',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('SIP地址已经存在,请重新填写',{icon: 2, time: 3000})
|
||||
<#elseif msg?? && msg == 't1'>
|
||||
layer.msg('当前用户坐席就绪或对话未结束,不能切换为非坐席',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('当前用户坐席就绪或对话未结束,不能切换为非坐席',{icon: 2, time: 3000})
|
||||
<#elseif msg?? && msg == 'new_user_success'>
|
||||
layer.msg('新用户创建成功',{icon: 1, offset: 'rb', time: 1000})
|
||||
layer.msg('新用户创建成功',{icon: 1, time: 1000})
|
||||
<#elseif msg?? && msg == 'edit_user_success'>
|
||||
layer.msg('用户编辑成功',{icon: 1, offset: 'rb', time: 1000})
|
||||
layer.msg('用户编辑成功',{icon: 1, time: 1000})
|
||||
</#if>
|
||||
});
|
||||
layui.use(['laypage', 'layer'], function(){
|
||||
|
@ -187,18 +187,18 @@
|
||||
parent.$('#agentdesktop').click();
|
||||
}
|
||||
} else if(result.rc === 1){
|
||||
top.layer.msg('不合法的请求参数!',{icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('不合法的请求参数!',{icon: 2, time: 3000})
|
||||
} else if(result.rc === 2){
|
||||
top.layer.msg('不合法的操作!',{icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('不合法的操作!',{icon: 2, time: 3000})
|
||||
} else if(result.rc ===3){
|
||||
top.layer.msg('没有权限执行该操作',{icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('没有权限执行该操作',{icon: 2, time: 3000})
|
||||
} else if(result.rc ===4){
|
||||
top.layer.msg('未找到该访客会话',{icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('未找到该访客会话',{icon: 2, time: 3000})
|
||||
}
|
||||
}, function(error){
|
||||
console.log("error", error);
|
||||
// 服务器异常
|
||||
top.layer.msg('服务器抽风,请稍后再试!',{icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('服务器抽风,请稍后再试!',{icon: 2, time: 3000})
|
||||
})
|
||||
},
|
||||
function(index, layro){
|
||||
|
@ -28,9 +28,9 @@ word-break: break-all;"><#if curagentuser??>${curagentuser.username!''}<#if cura
|
||||
</span>
|
||||
<span class="user">
|
||||
<#if chatmessage?? && chatmessage.calltype?? && chatmessage.calltype == '呼出'>
|
||||
${chatmessage.intervented?string(chatmessage.supervisorname,curagentuser.agentname)}
|
||||
${chatmessage.intervented?string(chatmessage.supervisorname,chatmessage.username)}
|
||||
<#else>
|
||||
${curagentuser.username!''}
|
||||
${chatmessage.username!''}
|
||||
</#if>
|
||||
</span>
|
||||
<span class="time">${chatmessage.createtime?string('yyyy-MM-dd HH:mm:ss')}</span>
|
||||
|
@ -99,7 +99,6 @@
|
||||
* @param memo
|
||||
*/
|
||||
function submitTransAgentUserOut(agentUserId, targetAgentno, agentUserServiceId, memo) {
|
||||
console.log("[submitTransAgentUser] ", agentUserId, targetAgentno, agentUserServiceId, memo);
|
||||
restApiRequest({
|
||||
silent: true,
|
||||
path: 'agentuser',
|
||||
@ -125,20 +124,20 @@
|
||||
$('#agentdesktop').click();
|
||||
}
|
||||
} else if(result.rc === 1){
|
||||
top.layer.msg('不合法的请求参数',{icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('不合法的请求参数',{icon: 2, time: 3000})
|
||||
} else if(result.rc === 2){
|
||||
top.layer.msg('不合法的操作',{icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('不合法的操作',{icon: 2, time: 3000})
|
||||
} else if(result.rc === 3){
|
||||
top.layer.msg('您没有权限执行该操作',{icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('您没有权限执行该操作',{icon: 2, time: 3000})
|
||||
} else if(result.rc === 4){
|
||||
top.layer.msg('该访客会话不存在',{icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('该访客会话不存在',{icon: 2, time: 3000})
|
||||
} else if(result.rc === 5){
|
||||
top.layer.msg('参数不合法',{icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('参数不合法',{icon: 2, time: 3000})
|
||||
}
|
||||
}, function(error){
|
||||
console.log("error", error);
|
||||
// 服务器异常
|
||||
top.layer.msg('服务器抽风,请稍后再试!', {icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('服务器抽风,请稍后再试!', {icon: 2, time: 3000})
|
||||
})
|
||||
}
|
||||
|
||||
@ -154,7 +153,7 @@
|
||||
if(params["userid"] && params["agentuserid"] && params["agentserviceid"] && params["agentno"]){
|
||||
submitTransAgentUserOut(params["agentuserid"], params["agentno"], params["agentserviceid"], params["memo"]);
|
||||
} else {
|
||||
top.layer.msg('未选择合理的转接信息!',{icon: 2, offset: 'b', time: 3000});
|
||||
top.layer.msg('未选择合理的转接信息!',{icon: 2, time: 3000});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -1,15 +1,15 @@
|
||||
<ul class="layui-nav layui-nav-tree" lay-filter="setting">
|
||||
<li class="layui-nav-item layui-nav-itemed">
|
||||
<#if user?? && (user.roleAuthMap["A02_A01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A02_A01"]?? || user.admin) >
|
||||
<a class="layui-nav-title" href="javascript:;">联系人</a>
|
||||
</#if>
|
||||
<dl class="layui-nav-child">
|
||||
<#if user?? && (user.roleAuthMap["A02_A01_A01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A02_A01_A01"]?? || user.admin) >
|
||||
<dd <#if !(ckind??)>class="layui-this"</#if>>
|
||||
<a href="/apps/contacts/index.html">全部联系人</a>
|
||||
</dd>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A02_A01_A02"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A02_A01_A02"]?? || user.admin) >
|
||||
<#if uKeFuDic['com.dic.contacts.ckind']??>
|
||||
<#list uKeFuDic['com.dic.contacts.ckind'] as dic>
|
||||
<dd <#if ckind?? && ckind == dic.id>class="layui-this"</#if>>
|
||||
|
@ -31,26 +31,26 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<#if user?? && (user.roleAuthMap[ "A02_A01_A02_B05"]?? || user.usertype=="0" )>
|
||||
<#if user?? && (user.roleAuthMap[ "A02_A01_A02_B05"]?? || user.admin)>
|
||||
<div class="layui-btn-group">
|
||||
<a href="/apps/contacts/add.html<#if ckind??>?ckind=${ckind}</#if>" title="新建联系人" data-toggle="ajax" data-width="950" data-height="600" class="layui-btn layui-btn-small"><i class="layui-icon"></i>新建联系人</a>
|
||||
</div>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap[ "A02_A01_A02_B08"]?? || user.usertype=="0" )>
|
||||
<#if user?? && (user.roleAuthMap[ "A02_A01_A02_B08"]?? || user.admin)>
|
||||
<div class="layui-btn-group ukefu-btn-group">
|
||||
<button class="layui-btn layui-btn-small" id="mass" title="群发" data-toggle="ajax" data-width="700" data-height="495">
|
||||
<i class="kfont"></i> 群发
|
||||
</button>
|
||||
</div>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap[ "A02_A01_A02_B08"]?? || user.usertype=="0" )>
|
||||
<#if user?? && (user.roleAuthMap[ "A02_A01_A02_B08"]?? || user.admin)>
|
||||
<div class="layui-btn-group ukefu-btn-group">
|
||||
<button class="layui-btn layui-btn-small" href="/apps/contacts/imp.html<#if ckind??>?ckind=${ckind}</#if>" title="导入联系人" data-toggle="ajax" data-width="950" data-height="600">
|
||||
<i class="kfont"></i> 导入
|
||||
</button>
|
||||
</div>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap[ "A02_A01_A02_B09"]?? || user.usertype=="0" )>
|
||||
<#if user?? && (user.roleAuthMap[ "A02_A01_A02_B09"]?? || user.admin)>
|
||||
<div class="layui-btn-group ukefu-btn-group">
|
||||
<button class="layui-btn layui-btn-small dropdown-menu">
|
||||
<i class="kfont"></i> 导出
|
||||
@ -151,12 +151,12 @@
|
||||
<a href="/apps/contacts/detail.html?id=${contacts.id!''}" style="margin-left:10px;">
|
||||
<i class="layui-icon"></i> 详情
|
||||
</a>
|
||||
<#if user?? && (user.roleAuthMap[ "A02_A01_A02_B06"]?? || user.usertype=="0" )>
|
||||
<#if user?? && (user.roleAuthMap[ "A02_A01_A02_B06"]?? || user.admin)>
|
||||
<a href="/apps/contacts/edit.html?id=${contacts.id!''}" data-toggle="ajax" data-width="950" data-height="600" data-title="编辑联系人信息">
|
||||
<i class="layui-icon"></i> 编辑
|
||||
</a>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap[ "A02_A01_A02_B07"]?? || user.usertype=="0" )>
|
||||
<#if user?? && (user.roleAuthMap[ "A02_A01_A02_B07"]?? || user.admin)>
|
||||
<a href="/apps/contacts/delete.html?id=${contacts.id!''}" style="margin-left:10px;" data-toggle="tip" data-title="请确认是否删除联系人?">
|
||||
<i class="layui-icon" style="color:red;">ဆ</i> 删除
|
||||
</a>
|
||||
@ -283,7 +283,7 @@
|
||||
});
|
||||
|
||||
function unreachableDialogWinByContactid(id){
|
||||
layer.msg('该联系人正在被其它客服服务或没有可触达的联系方式!',{icon: 2, offset: 'b', time: 3000})
|
||||
layer.msg('该联系人正在被其它客服服务或没有可触达的联系方式!',{icon: 2, time: 3000})
|
||||
}
|
||||
|
||||
function openDialogWinByContactid(id){
|
||||
|
@ -1,14 +1,14 @@
|
||||
<ul class="tab-title">
|
||||
<#if user?? && (user.roleAuthMap["A02_A01_A02_B01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A02_A01_A02_B01"]?? || user.admin) >
|
||||
<li <#if subtype == 'index'>class="layui-this"</#if>><a href="/apps/contacts/index.html<#if ckind??>?ckind=${ckind}</#if>">全部联系人<#if subtype == 'index'>(<#if contactsList??>${contactsList.totalElements}<#else>0</#if>)</#if></a></li>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A02_A01_A02_B02"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A02_A01_A02_B02"]?? || user.admin) >
|
||||
<li <#if subtype == 'today'>class="layui-this"</#if>><a href="/apps/contacts/today.html<#if ckind??>?ckind=${ckind}</#if>">今日新增<#if subtype == 'today'>(<#if contactsList??>${contactsList.totalElements}<#else>0</#if>)</#if></a></li>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A02_A01_A02_B03"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A02_A01_A02_B03"]?? || user.admin) >
|
||||
<li <#if subtype == 'week'>class="layui-this"</#if>><a href="/apps/contacts/week.html<#if ckind??>?ckind=${ckind}</#if>">本周新增<#if subtype == 'week'>(<#if contactsList??>${contactsList.totalElements}<#else>0</#if>)</#if></a></li>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A02_A01_A02_B04"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A02_A01_A02_B04"]?? || user.admin) >
|
||||
<li <#if subtype == 'creater'>class="layui-this"</#if>><a href="/apps/contacts/creater.html<#if ckind??>?ckind=${ckind}</#if>">我的联系人<#if subtype == 'creater'>(<#if contactsList??>${contactsList.totalElements}<#else>0</#if>)</#if></a></li>
|
||||
</#if>
|
||||
</ul>
|
@ -1,15 +1,15 @@
|
||||
<ul class="layui-nav layui-nav-tree" lay-filter="setting">
|
||||
<li class="layui-nav-item layui-nav-itemed">
|
||||
<#if user?? && (user.roleAuthMap["A03_A01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A03_A01"]?? || user.admin) >
|
||||
<a class="layui-nav-title" href="javascript:;">全部客户</a>
|
||||
</#if>
|
||||
<dl class="layui-nav-child">
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A01"]?? || user.admin) >
|
||||
<dd <#if !(ekind??)>class="layui-this"</#if>>
|
||||
<a href="/apps/customer/index.html">全部客户</a>
|
||||
</dd>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02"]?? || user.admin) >
|
||||
<#if uKeFuDic['com.dic.contacts.entype']??>
|
||||
<#list uKeFuDic['com.dic.contacts.entype'] as dic>
|
||||
<dd <#if ekind?? && ekind == dic.id>class="layui-this"</#if>>
|
||||
|
@ -36,7 +36,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B06"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B06"]?? || user.admin) >
|
||||
<div class="layui-btn-group ukefu-btn-group">
|
||||
<a href="/apps/customer/add.html<#if ekind??>?ekind=${ekind}</#if>" title="新建客户"
|
||||
data-toggle="ajax" data-width="950" data-height="600" class="layui-btn layui-btn-small">
|
||||
@ -45,7 +45,7 @@
|
||||
</a>
|
||||
</div>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B09"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B09"]?? || user.admin) >
|
||||
<div class="layui-btn-group ukefu-btn-group">
|
||||
<button class="layui-btn layui-btn-small"
|
||||
href="/apps/customer/imp.html<#if ekind??>?ekind=${ekind}</#if>" title="导入客户"
|
||||
@ -56,7 +56,7 @@
|
||||
</#if>
|
||||
|
||||
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B010"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B010"]?? || user.admin) >
|
||||
<div class="layui-btn-group ukefu-btn-group">
|
||||
<button class="layui-btn layui-btn-small dropdown-menu">
|
||||
<i class="kfont"></i> 导出
|
||||
@ -144,14 +144,14 @@
|
||||
</#if>
|
||||
</td>
|
||||
<td style="white-space:nowrap;width:1%;" nowrap="nowrap">
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B07"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B07"]?? || user.admin) >
|
||||
<a href="/apps/customer/edit.html?id=${entCustomer.id!''}" data-toggle="ajax" data-width="950"
|
||||
data-height="600" data-title="编辑用户信息">
|
||||
<i class="layui-icon"></i>
|
||||
编辑
|
||||
</a>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B08"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B08"]?? || user.admin) >
|
||||
<a href="/apps/customer/delete.html?id=${entCustomer.id!''}" style="margin-left:10px;" data-toggle="tip"
|
||||
data-title="请确认是否删除记录?">
|
||||
<i class="layui-icon" style="color:red;">ဆ</i>
|
||||
@ -187,13 +187,13 @@
|
||||
var layer = layui.layer;
|
||||
|
||||
<#if msg?? && msg == 'new_entcustomer_success'>
|
||||
layer.msg('客户新建成功',{icon: 1, offset: 'rb', time: 1000})
|
||||
layer.msg('客户新建成功',{icon: 1, time: 1000})
|
||||
<#elseif msg?? && msg == 'edit_entcustomer_success'>
|
||||
layer.msg('客户编辑成功',{icon: 1, offset: 'rb', time: 1000})
|
||||
layer.msg('客户编辑成功',{icon: 1, time: 1000})
|
||||
<#elseif msg?? && msg == 'mobile_exist'>
|
||||
layer.msg('手机存在,请重新填写',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('手机存在,请重新填写',{icon: 2, time: 3000})
|
||||
<#elseif msg?? && msg == 'sip_account_exist'>
|
||||
layer.msg('SIP账号已经存在,请重新填写',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('SIP账号已经存在,请重新填写',{icon: 2, time: 3000})
|
||||
</#if>
|
||||
});
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
<ul class="tab-title">
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B01"]?? || user.admin) >
|
||||
<li <#if subtype == 'index'>class="layui-this"</#if>><a href="/apps/customer/index.html<#if ekind??>?ekind=${ekind}</#if>">全部客户<#if subtype == 'index'>(<#if entCustomerList??>${entCustomerList.totalElements}<#else>0</#if>)</#if></a></li>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B02"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B02"]?? || user.admin) >
|
||||
<li <#if subtype == 'today'>class="layui-this"</#if>><a href="/apps/customer/today.html<#if ekind??>?ekind=${ekind}</#if>">今日新增<#if subtype == 'today'>(<#if entCustomerList??>${entCustomerList.totalElements}<#else>0</#if>)</#if></a></li>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B03"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B03"]?? || user.admin) >
|
||||
<li <#if subtype == 'week'>class="layui-this"</#if>><a href="/apps/customer/week.html<#if ekind??>?ekind=${ekind}</#if>">本周新增<#if subtype == 'week'>(<#if entCustomerList??>${entCustomerList.totalElements}<#else>0</#if>)</#if></a></li>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B04"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B04"]?? || user.admin) >
|
||||
<li <#if subtype == 'enterprise'>class="layui-this"</#if>><a href="/apps/customer/enterprise.html<#if ekind??>?ekind=${ekind}</#if>">企业客户<#if subtype == 'enterprise'>(<#if entCustomerList??>${entCustomerList.totalElements}<#else>0</#if>)</#if></a></li>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B05"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A03_A01_A02_B05"]?? || user.admin) >
|
||||
<li <#if subtype == 'personal'>class="layui-this"</#if>><a href="/apps/customer/personal.html<#if ekind??>?ekind=${ekind}</#if>">个人客户<#if subtype == 'personal'>(<#if entCustomerList??>${entCustomerList.totalElements}<#else>0</#if>)</#if></a></li>
|
||||
</#if>
|
||||
<li <#if subtype == 'creater'>class="layui-this"</#if>><a href="/apps/customer/creater.html<#if ekind??>?ekind=${ekind}</#if>">我的客户<#if subtype == 'creater'>(<#if entCustomerList??>${entCustomerList.totalElements}<#else>0</#if>)</#if></a></li>
|
||||
|
@ -2,26 +2,34 @@
|
||||
<div class="col-lg-12">
|
||||
<h1 class="site-h1">
|
||||
对话列表
|
||||
<div style="clefloat:right;">
|
||||
<div class="layui-btn-group">
|
||||
<a href="/apps/cca/index.html?sort=lastmessage<#if skill??>&&skill=${skill}</#if><#if agentno??>&&agentno=${agentno}</#if>" style="<#if sort?? && sort == "lastmessage">color:#ffffff !important;</#if>">
|
||||
<button class="layui-btn layui-btn-primary layui-btn-small" style="<#if sort?? && sort == "lastmessage">color:#ffffff !important;<#else>background-color:#ffffff !important;color:#32c24d !important;</#if>">
|
||||
消息
|
||||
</button>
|
||||
</a>
|
||||
<a href="/apps/cca/index.html?sort=logintime<#if skill??>&&skill=${skill}</#if><#if agentno??>&&agentno=${agentno}</#if>" style="<#if sort?? && sort == "logintime">color:#ffffff !important;</#if>">
|
||||
<button class="layui-btn layui-btn-primary layui-btn-small" style="<#if sort?? && sort == "logintime">color:#ffffff !important;<#else>background-color:#ffffff !important;color:#32c24d !important;</#if>">
|
||||
接入
|
||||
</button>
|
||||
</a>
|
||||
<a href="/apps/cca/index.html?sort=default<#if skill??>&&skill=${skill}</#if><#if agentno??>&&agentno=${agentno}</#if>" style="<#if !sort?? || sort == "default">color:#ffffff !important;</#if>">
|
||||
<button class="layui-btn layui-btn-primary layui-btn-small" style="<#if !sort?? || sort == "default">color:#ffffff !important;<#else>background-color:#ffffff !important;color:#32c24d !important;</#if>">
|
||||
默认
|
||||
</button>
|
||||
</a>
|
||||
<form class="layui-form" name="search" method="post" id="searchConversation">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline" style="margin-right:0px;width: 100%">
|
||||
<select name="skill" class="ukefu-input" lay-ignore style="width: 90px" onchange="findAgentByOrgan(this.value)" >
|
||||
<option value="">所有技能组</option>
|
||||
<#if skillGroups??>
|
||||
<#list skillGroups as tpskill>
|
||||
<option value="${tpskill.id}" <#if skill?? && skill == tpskill.id>selected="selected"</#if>>${tpskill.name!''}</option>
|
||||
</#list>
|
||||
</#if>
|
||||
</select>
|
||||
<label>~</label>
|
||||
<select id="agent" name="agentno" class="ukefu-input" lay-ignore style="width: 90px">
|
||||
<option value="">所有坐席</option>
|
||||
<#if agentList??>
|
||||
<#list agentList as useragent>
|
||||
<option value="${useragent.id}" <#if agentno?? && agentno == useragent.id>selected="selected"</#if>>${useragent.uname!''}</option>
|
||||
</#list>
|
||||
</#if>
|
||||
</select>
|
||||
<div class="layui-input-inline" style="float: right;width: auto">
|
||||
<button class="layui-btn layui-btn-small layui-btn-primary" style="color:#ffffff;">
|
||||
<i class="layui-icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</h1>
|
||||
<ul class="dialog-list" id="chat_users">
|
||||
<#if agentUserList??>
|
||||
@ -29,7 +37,8 @@
|
||||
<li class="clearfix chat-list-item <#if curagentuser?? && curagentuser.id?? && agentuser.id?? && curagentuser.id == agentuser.id>active</#if>"
|
||||
id="agentuser_${agentuser.userid!''}" remove-id="${agentuser.id!''}" data-id="${agentuser.userid!''}">
|
||||
<a href="/apps/cca/agentuser.html?id=${agentuser.id!''}&channel=${agentuser.channel!''}" data-toggle="load" data-target="#ukefu-chat-agent" onclick="$('.chat-list-item.active').removeClass('active');$(this).closest('li.chat-list-item').addClass('active');Proxy.cleanTopMsgTip(1) ;$('#last_msg_${agentuser.userid!''}').text(0).hide();">
|
||||
<img src="<#if agentuser.headimgurl?? && agentuser.headimgurl != ''>${agentuser.headimgurl}<#else>/images/im/user.png</#if>" style="width:45px;height:45px;"> <#if agentuser.status?? && agentuser.status == 'end'>
|
||||
<img src="<#if agentuser.headimgurl?? && agentuser.headimgurl != ''>${agentuser.headimgurl}<#else>/images/im/user.png</#if>" style="width:45px;height:45px;">
|
||||
<#if agentuser.status?? && agentuser.status == 'end'>
|
||||
<#if agentuser.channel?? && agentuser.channel == "weixin">
|
||||
<i class="kfont ukefu-channel-icon-end" id="tip_icon_wenxin_${agentuser.userid!''}"></i>
|
||||
<#elseif agentuser.channel?? && agentuser.channel == "webim">
|
||||
@ -39,7 +48,7 @@
|
||||
<#elseif agentuser.channel?? && agentuser.channel == "phone">
|
||||
<img class="ukefu-channel-image" src="/images/cde-ico-gray.png" id="tip_icon_phone_${agentuser.userid!''}">
|
||||
</#if>
|
||||
<#else>
|
||||
<#else>
|
||||
<#if agentuser.channel?? && agentuser.channel == "weixin">
|
||||
<i class="kfont ukefu-channel-icon" id="tip_icon_wenxin_${agentuser.userid!''}"></i>
|
||||
<#elseif agentuser.channel?? && agentuser.channel == "webim">
|
||||
@ -75,3 +84,58 @@ word-break: break-all;">${agentuser.username!''}</span>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/js/CSKeFu_Rest_Request.v1.js"></script>
|
||||
<script>
|
||||
function findAgentByOrgan(data){
|
||||
restApiRequest({
|
||||
silent: true,
|
||||
path: 'user/findByOrgan?organ='+data,
|
||||
}).then(function(result){
|
||||
if(result.status !== 'OK'){
|
||||
// Token过期
|
||||
handleRestApiFail(result.status);
|
||||
} else{
|
||||
$("#agent").html('<option value="">所有坐席</option>');
|
||||
for (var i=0 ; i<result.data.length ; i++) {
|
||||
$("#agent").prepend('<option value="' + result.data[i].id + '" <#if agentno?? && agentno == result.data[i].id>selected="selected"</#if>>' + result.data[i].uname + '</option>')
|
||||
};
|
||||
}
|
||||
}, function(error){
|
||||
// 服务器异常
|
||||
top.layer.msg('服务器抽风,请稍后再试!', {icon: 2, offset: 'b', time: 3000})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
$(function(){
|
||||
$('#searchConversation').on('submit', function(e){
|
||||
e.preventDefault(); //prevent form from submitting
|
||||
var data = $("#searchConversation :input").serializeArray();
|
||||
console.log(data)
|
||||
var params = {};
|
||||
for(var index = 0; index < data.length; index++){
|
||||
params[data[index]['name']] = data[index]["value"];
|
||||
}
|
||||
$.ajax({
|
||||
url:'/apps/cca/query',
|
||||
data:{skill:params["skill"],agentno:params["agentno"]},
|
||||
type:"post",
|
||||
success:function(data){
|
||||
$("#chat_users").html(data);
|
||||
if($("#chat_users li").length > 0){
|
||||
if($("#chat_users li:first-child").attr('id').substring(10) !== cursession){
|
||||
$("#chat_users li:first-child a").click();
|
||||
}else{
|
||||
$("#chat_users li:first-child").addClass("active")
|
||||
}
|
||||
}else {
|
||||
cursession = "";
|
||||
$("#ukefu-chat-agent").html(" <div style=\"height: 100%;background: #fff;padding-top: 100px\" class=\"box-body ukefu-im-theme\"><div class=\"ukefu-empty\"><i class=\"layui-icon\"></i><div style=\"\">没有搜索结果</div>\</div>\</div>");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -0,0 +1,48 @@
|
||||
<#if agentUserList??>
|
||||
<#list agentUserList as agentuser>
|
||||
<li class="clearfix chat-list-item <#if curagentuser?? && curagentuser.id?? && agentuser.id?? && curagentuser.id == agentuser.id>active</#if>"
|
||||
id="agentuser_${agentuser.userid!''}" remove-id="${agentuser.id!''}" data-id="${agentuser.userid!''}">
|
||||
<a href="/apps/cca/agentuser.html?id=${agentuser.id!''}&channel=${agentuser.channel!''}" data-toggle="load" data-target="#ukefu-chat-agent" onclick="$('.chat-list-item.active').removeClass('active');$(this).closest('li.chat-list-item').addClass('active');Proxy.cleanTopMsgTip(1) ;$('#last_msg_${agentuser.userid!''}').text(0).hide();">
|
||||
<img src="<#if agentuser.headimgurl?? && agentuser.headimgurl != ''>${agentuser.headimgurl}<#else>/images/im/user.png</#if>" style="width:45px;height:45px;"> <#if agentuser.status?? && agentuser.status == 'end'>
|
||||
<#if agentuser.channel?? && agentuser.channel == "weixin">
|
||||
<i class="kfont ukefu-channel-icon-end" id="tip_icon_wenxin_${agentuser.userid!''}"></i>
|
||||
<#elseif agentuser.channel?? && agentuser.channel == "webim">
|
||||
<i class="kfont ukefu-channel-icon-end" id="tip_icon_webim_${agentuser.userid!''}"></i>
|
||||
<#elseif agentuser.channel?? && agentuser.channel == "skype">
|
||||
<i class="csfont ukefu-channel-icon-end" id="tip_icon_skype_${agentuser.userid!''}"></i>
|
||||
<#elseif agentuser.channel?? && agentuser.channel == "phone">
|
||||
<img class="ukefu-channel-image" src="/images/cde-ico-gray.png" id="tip_icon_phone_${agentuser.userid!''}">
|
||||
</#if>
|
||||
<#else>
|
||||
<#if agentuser.channel?? && agentuser.channel == "weixin">
|
||||
<i class="kfont ukefu-channel-icon" id="tip_icon_wenxin_${agentuser.userid!''}"></i>
|
||||
<#elseif agentuser.channel?? && agentuser.channel == "webim">
|
||||
<i class="kfont ukefu-channel-icon" id="tip_icon_webim_${agentuser.userid!''}"></i>
|
||||
<#elseif agentuser.channel?? && agentuser.channel == "skype">
|
||||
<i class="csfont ukefu-channel-icon" id="tip_icon_skype_${agentuser.userid!''}"></i>
|
||||
<#elseif agentuser.channel?? && agentuser.channel == "phone">
|
||||
<img class="ukefu-channel-image" src="/images/phone-ico.png" id="tip_icon_phone_${agentuser.userid!''}">
|
||||
</#if>
|
||||
</#if>
|
||||
<div class="dialog-info">
|
||||
<div class="address">
|
||||
<span style="width:90px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-wrap: break-word;
|
||||
word-break: break-all;">${agentuser.username!''}</span>
|
||||
</div>
|
||||
<div class="news">
|
||||
<#if agentUser.servicetime??>${agentuser.servicetime?string('yyyy-MM-dd HH:mm:ss')}<#else>${agentuser.servicetime?string('yyyy-MM-dd HH:mm:ss')}</#if>
|
||||
<#if agentuser.status?? && agentuser.status == 'end'>
|
||||
<small class="label bg-gray pull-right" id="tip_message_${agentuser.userid!''}">离开</small>
|
||||
<#else>
|
||||
<small class="label bg-green pull-right" id="tip_message_${agentuser.userid!''}">在线</small>
|
||||
</#if>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="last-msg">
|
||||
<small class="ukefu-badge bg-red" id="last_msg_${agentuser.userid!''}" style="<#if agentuser.tokenum == 0 || (curagentuser?? && curagentuser.id == agentuser.id)>display:none;</#if>">${agentuser.tokenum!0}</small>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</#list>
|
||||
</#if>
|
@ -90,28 +90,22 @@
|
||||
</script>
|
||||
|
||||
<#if agentUserList?? && agentUserList?size gt 0>
|
||||
|
||||
<#include "/apps/cca/searchbox.html">
|
||||
|
||||
<div class="layui-side layui-bg-black layui-left-black cskefu-cca-leftside" style="height:calc(100% - 60px)">
|
||||
<div class="layui-side layui-bg-black layui-left-black cskefu-cca-leftside" style="height:100%">
|
||||
<div class="layui-side-scroll" id="agentuserscca">
|
||||
<#include "/apps/cca/agentusers.html"/>
|
||||
</div>
|
||||
</div>
|
||||
<#if curagentuser?? && curagentuser.channel == "phone">
|
||||
<div class="layui-body ukefu-chat-agent cskefu-cca-content" id="ukefu-chat-agent" style="height:calc(100% - 60px)">
|
||||
<div class="layui-body ukefu-chat-agent cskefu-cca-content" id="ukefu-chat-agent" style="height:100%">
|
||||
<#include "/apps/cca/mainagentuser_callout.html">
|
||||
</div>
|
||||
<#else>
|
||||
<div class="layui-body ukefu-chat-agent cskefu-cca-content" id="ukefu-chat-agent" style="height:calc(100% - 60px)">
|
||||
<div class="layui-body ukefu-chat-agent cskefu-cca-content" id="ukefu-chat-agent" style="height:100%">
|
||||
<#include "/apps/cca/mainagentuser.html">
|
||||
</div>
|
||||
</#if>
|
||||
<#else>
|
||||
<div class="layui-layout layui-layout-content" style="height: 100%;">
|
||||
|
||||
<#include "/apps/cca/searchbox.html">
|
||||
|
||||
<div class="box default-box" style="height: 100%;">
|
||||
<div class="box-body ukefu-im-theme">
|
||||
<div class="ukefu-empty" style="background: none">
|
||||
|
@ -26,9 +26,9 @@ word-break: break-all;"><#if curagentuser??>${curagentuser.username!''}<#if cura
|
||||
</span>
|
||||
<span class="user">
|
||||
<#if chatmessage?? && chatmessage.calltype?? && chatmessage.calltype == '呼出'>
|
||||
${chatmessage.intervented?string(chatmessage.supervisorname,curagentuser.agentname)}
|
||||
${chatmessage.intervented?string(chatmessage.supervisorname,chatmessage.username)}
|
||||
<#else>
|
||||
${curagentuser.username!''}
|
||||
${chatmessage.username!''}
|
||||
</#if></span>
|
||||
<span class="time">${chatmessage.createtime?string('yyyy-MM-dd HH:mm:ss')}</span>
|
||||
<span class="<#if (chatmessage.calltype?? && chatmessage.calltype == '呼出')>rateleft<#else>rateright</#if>" style="cursor: pointer; font-size: 30px">
|
||||
|
@ -113,20 +113,20 @@
|
||||
customerChatAudit.$("li[remove-id="+agentUserId+"] a").click();
|
||||
top.layer.msg('转接已完成',{icon: 1, time: 1000})
|
||||
} else if(result.rc === 1){
|
||||
top.layer.msg('不合法的请求参数',{icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('不合法的请求参数',{icon: 2, time: 3000})
|
||||
} else if(result.rc === 2){
|
||||
top.layer.msg('不合法的操作',{icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('不合法的操作',{icon: 2, time: 3000})
|
||||
} else if(result.rc === 3){
|
||||
top.layer.msg('您没有权限执行该操作',{icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('您没有权限执行该操作',{icon: 2, time: 3000})
|
||||
} else if(result.rc === 4){
|
||||
top.layer.msg('该访客会话不存在',{icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('该访客会话不存在',{icon: 2, time: 3000})
|
||||
} else if(result.rc === 5){
|
||||
top.layer.msg('参数不合法',{icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('参数不合法',{icon: 2, time: 3000})
|
||||
}
|
||||
}, function(error){
|
||||
console.log("error", error);
|
||||
// 服务器异常
|
||||
top.layer.msg('服务器抽风,请稍后再试!', {icon: 2, offset: 'b', time: 3000})
|
||||
top.layer.msg('服务器抽风,请稍后再试!', {icon: 2, time: 3000})
|
||||
})
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@
|
||||
if(params["userid"] && params["agentuserid"] && params["agentserviceid"] && params["agentno"]){
|
||||
submitTransAgentUserOut(params["agentuserid"], params["agentno"], params["agentserviceid"], params["memo"]);
|
||||
} else {
|
||||
top.layer.msg('未选择合理的转接信息!',{icon: 2, offset: 'b', time: 3000});
|
||||
top.layer.msg('未选择合理的转接信息!',{icon: 2, time: 3000});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -166,11 +166,11 @@
|
||||
}
|
||||
});
|
||||
<#if msg?? && msg == 'username_exist'>
|
||||
layer.msg('用户名存在,请重新填写',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('用户名存在,请重新填写',{icon: 2, time: 3000})
|
||||
<#elseif msg?? && msg == 'email_exist'>
|
||||
layer.msg('邮件存在,请重新填写',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('邮件存在,请重新填写',{icon: 2, time: 3000})
|
||||
<#elseif msg?? && msg == 'mobile_exist'>
|
||||
layer.msg('手机存在,请重新填写',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('手机存在,请重新填写',{icon: 2, time: 3000})
|
||||
</#if>
|
||||
});
|
||||
</script>
|
||||
|
@ -36,14 +36,15 @@
|
||||
<input type="mobile" name="mobile" value="${userData.mobile!''}" placeholder="请输入手机号码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<#if userData?? && userData.usertype != '0'>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">启用坐席功能:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="agent" lay-skin="switch" value="1" <#if userData?? && userData.agent == true>checked</#if>>
|
||||
</div>
|
||||
</div>
|
||||
</#if>
|
||||
<!-- admin用户强制作为坐席使用 -->
|
||||
<!-- <#if userData?? && userData.admin>-->
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label">启用坐席功能:</label>-->
|
||||
<!-- <div class="layui-input-block">-->
|
||||
<!-- <input type="checkbox" name="agent" lay-skin="switch" value="1" <#if userData?? && userData.agent == true>checked</#if>>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </#if>-->
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="profile">立即提交</button>
|
||||
|
@ -74,6 +74,15 @@
|
||||
<li>
|
||||
<p>电话:${entimuser.mobile!''}</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>部门:
|
||||
<#if organs?? >
|
||||
<#list organs as organ>
|
||||
${organ.name!''} 
|
||||
</#list>
|
||||
</#if>
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="content-bottom">
|
||||
|
@ -156,7 +156,7 @@
|
||||
</#if>
|
||||
<span class="layui-anim layer-anim-05 animated" id="msgbox" data-newmsg="${newmsg}" style="<#if newmsg == 0>display:none;</#if>">${newmsg}</span>
|
||||
</li>
|
||||
<#if user?? && (user.roleAuthMap[ "A14_A01"]?? || user.usertype=="0" )>
|
||||
<#if user?? && (user.roleAuthMap[ "A14_A01"]?? || user.admin )>
|
||||
<li class="layui-icon " title="新建" onclick="layer.prompt({title: '新建一个群', offset: 'b', formType: 0}, function(text, index){layer.close(index);loadURL('/ent/im/group/save.html?name='+encodeURIComponent(text),'#imgroup')});"></li>
|
||||
</#if>
|
||||
<li class="layui-icon" title="更换背景" onclick="skin()"></li>
|
||||
|
@ -62,17 +62,17 @@
|
||||
|
||||
<script type="text/javascript" src="/js/jquery.darktooltip.js"></script>
|
||||
<script language="javascript">
|
||||
var hostname = "${hostname!''}" , adminuser = "<#if user.usertype?? && user.usertype == '0'>true<#else>false</#if>" , schema = "${schema!'http'}", port = "${webimport!''}" , userid = "${user.id!''}" , session = "${sessionid!''}" , orgi = "${orgi!''}";
|
||||
var hostname = "${hostname!''}" , adminuser = "<#if user.admin?? && user.admin>true<#else>false</#if>" , schema = "${schema!'http'}", port = "${webimport!''}" , userid = "${user.id!''}" , session = "${sessionid!''}" , orgi = "${orgi!''}";
|
||||
var layinx , layerhelper ;
|
||||
$(document).ready(function(){
|
||||
layui.use('layer', function(){
|
||||
layerhelper = layer ;
|
||||
<#if Request["msg"]?? && Request["msg"] == "security">
|
||||
layer.msg('您访问的资源需要安全验证,请确认您有系统管理员权限!',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('您访问的资源需要安全验证,请确认您有系统管理员权限!',{icon: 2, time: 3000})
|
||||
<#elseif msg?? && msg == 't0'>
|
||||
layer.msg('当前坐席就绪或对话未结束,不能切换${systemConfig.namealias!''}',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('当前坐席就绪或对话未结束,不能切换${systemConfig.namealias!''}',{icon: 2, time: 3000})
|
||||
<#elseif msg?? && msg == 't1'>
|
||||
layer.msg('当前用户坐席就绪或对话未结束,不能切换为非坐席',{icon: 2, offset: 'rb', time: 3000})
|
||||
layer.msg('当前用户坐席就绪或对话未结束,不能切换为非坐席',{icon: 2, time: 3000})
|
||||
</#if>
|
||||
<#if models?seq_contains("entim")>
|
||||
var imDialogHelper = {
|
||||
@ -147,8 +147,8 @@
|
||||
</a>
|
||||
</li>
|
||||
</#if>
|
||||
<#if user?? && user.agent == true>
|
||||
<#if (user?? && user.roleAuthMap["A01"]?? || user.usertype == "0")>
|
||||
<#if (user?? && user.agent == true) || user.admin>
|
||||
<#if (user?? && user.roleAuthMap["A01"]??) || user.admin>
|
||||
<li class="layui-nav-item " style="position: relative;">
|
||||
<div class="ukefu-last-msg" data-num="0" id="ukefu-last-msg">
|
||||
<small class="ukefu-msg-tip bg-red" id="msgnum">0</small>
|
||||
@ -160,7 +160,7 @@
|
||||
</li>
|
||||
</#if>
|
||||
</#if>
|
||||
<#if (user?? && user.roleAuthMap["B02"]?? || user.usertype == "0")>
|
||||
<#if (user?? && user.roleAuthMap["B02"]??) || user.admin>
|
||||
<li class="layui-nav-item ">
|
||||
<a href="javascript:void(0)" onclick="return false;" data-title="系统管理" data-href="/admin/content.html" class="iframe_btn" data-id="admin" data-type="tabAdd">
|
||||
<i class="layui-icon" style="position: relative;"></i>
|
||||
@ -194,7 +194,7 @@
|
||||
</a>
|
||||
</dd>
|
||||
<#if user?? && user.agent == true>
|
||||
<#if user?? && (user.roleAuthMap["A01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A01"]?? || user.admin) >
|
||||
<dd class="ukefu-left-menu" data-tooltip="坐席工作台" >
|
||||
<a href="javascript:void(0)" href="javascript:void(0)" id="agentdeskleft" onclick="return false;" data-title="坐席对话" data-href="/agent/index.html" class="iframe_btn" data-id="multiMediaDialogWin" data-type="tabAdd"> <i class="layui-icon"
|
||||
style="top: 3px;"></i>
|
||||
@ -204,14 +204,14 @@
|
||||
</#if>
|
||||
|
||||
<#if models?seq_contains("contacts")>
|
||||
<#if user?? && (user.roleAuthMap["A02"]?? || user.usertype == "0")>
|
||||
<#if user?? && (user.roleAuthMap["A02"]?? || user.admin)>
|
||||
<dd class="ukefu-left-menu" data-tooltip="全部联系人">
|
||||
<a href="javascript:void(0)" data-title="全部联系人" onclick="return false;" data-href="/apps/contacts/index.html" class="iframe_btn" data-id="contactsMainContentWin" data-type="tabAdd">
|
||||
<i class="layui-icon" style="position: relative;"></i>
|
||||
</a>
|
||||
</dd>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A03"]?? || user.usertype == "0")>
|
||||
<#if user?? && (user.roleAuthMap["A03"]?? || user.admin)>
|
||||
<dd class="ukefu-left-menu" data-tooltip="全部客户">
|
||||
<a href="javascript:void(0)" data-title="全部客户" onclick="return false;" data-href="/apps/customer/index.html" class="iframe_btn" data-id="customersMainContentWin" data-type="tabAdd">
|
||||
<i class="kfont" style="position: relative;"></i>
|
||||
@ -221,14 +221,14 @@
|
||||
</#if>
|
||||
|
||||
<#if models?seq_contains("workorders")>
|
||||
<#if user?? && (user.roleAuthMap["A04"]?? || user.usertype == "0")>
|
||||
<#if user?? && (user.roleAuthMap["A04"]?? || user.admin)>
|
||||
<dd class="ukefu-left-menu" data-tooltip="工单管理">
|
||||
<a href="javascript:void(0)" data-title="工单管理" data-href="<#if systemConfig?? && systemConfig.workorders>/apps/workordersthree/index.html<#else>/apps/workorders/index.html</#if>" class="iframe_btn" data-id="maincontent" data-type="tabChange">
|
||||
<i class="kfont" style="position: relative;"></i>
|
||||
</a>
|
||||
</dd>
|
||||
</#if>
|
||||
<!-- <#if user?? && (user.roleAuthMap["A05"]?? || user.usertype == "0") >
|
||||
<!-- <#if user?? && (user.roleAuthMap["A05"]?? || user.admin) >
|
||||
<dd class="ukefu-left-menu" data-tooltip="业务流程">
|
||||
<a href="javascript:void(0)" data-title="业务流程" data-href="/apps/bpm/index.html" class="iframe_btn" data-id="maincontent" data-type="tabChange">
|
||||
<i class="kfont" style="position: relative;"></i>
|
||||
@ -239,7 +239,7 @@
|
||||
|
||||
<!-- 会话监控 Customer Chats Audit -->
|
||||
<#if models?seq_contains("cca")>
|
||||
<#if user?? && (user.roleAuthMap["A13_A01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A13_A01"]?? || user.admin) >
|
||||
<dd class="ukefu-left-menu" data-tooltip="会话监控">
|
||||
<a href="javascript:void(0)" href="javascript:void(0)" id="customerchatsaudit" onclick="return false;" data-title="会话监控" data-href="/apps/cca/index.html" class="iframe_btn" data-id="customerChatAudit" data-type="tabAdd">
|
||||
<i class="csfont" style="position: relative;"></i>
|
||||
@ -249,7 +249,7 @@
|
||||
</#if>
|
||||
|
||||
<!--
|
||||
<#if user?? && (user.roleAuthMap["A09_A02_A01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A09_A02_A01"]?? || user.admin) >
|
||||
|
||||
<dd class="ukefu-left-menu" data-tooltip="知识库">
|
||||
<a href="javascript:void(0)" data-title="知识库" data-href="/apps/kbs/index.html" class="iframe_btn" data-id="maincontent" data-type="tabChange">
|
||||
@ -259,20 +259,20 @@
|
||||
</#if>
|
||||
-->
|
||||
<#if models?seq_contains("xiaoe")>
|
||||
<#if user?? && (user.roleAuthMap["A09_A02_A01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A09_A02_A01"]?? || user.admin) >
|
||||
<a href="javascript:void(0)" data-title="知识库" data-href="/apps/topic.html" class="iframe_btn" data-id="maincontent" data-type="tabChange">
|
||||
<i class="kfont" style="position: relative;"></i>
|
||||
</a>
|
||||
</#if>
|
||||
</#if>
|
||||
<#if user?? &&( user.roleAuthMap["A06"]?? || user.usertype == "0")>
|
||||
<#if user?? &&( user.roleAuthMap["A06"]?? || user.admin)>
|
||||
<dd class="ukefu-left-menu" data-tooltip="客服设置">
|
||||
<a href="javascript:void(0)" data-title="客服设置" data-href="/setting/agent/index.html" class="iframe_btn" data-id="maincontent" data-type="tabChange"> <i class="layui-icon"
|
||||
style="position: relative;"></i>
|
||||
</a>
|
||||
</dd>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A07"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A07"]?? || user.admin) >
|
||||
<dd class="ukefu-left-menu" data-tooltip="快捷回复">
|
||||
<a href="javascript:void(0)" data-title="快捷回复" data-href="/setting/quickreply/index.html" class="iframe_btn" data-id="maincontent" data-type="tabChange">
|
||||
<i class="layui-icon"
|
||||
@ -280,7 +280,7 @@
|
||||
</a>
|
||||
</dd>
|
||||
</#if>
|
||||
<#if user?? &&( user.roleAuthMap["A08"]?? || user.usertype == "0") >
|
||||
<#if user?? &&( user.roleAuthMap["A08"]?? || user.admin) >
|
||||
<dd class="ukefu-left-menu" data-tooltip="会话历史">
|
||||
<a href="javascript:void(0)" data-title="会话历史" data-href="/service/history/index.html" class="iframe_btn" data-id="maincontent" data-type="tabChange"> <i class="kfont"
|
||||
style="position: relative;"></i>
|
||||
@ -297,7 +297,7 @@
|
||||
-->
|
||||
|
||||
<!--<#if models?seq_contains("xiaoe")>-->
|
||||
<!--<#if user?? &&( user.roleAuthMap["A09"]?? || user.usertype == "0") >-->
|
||||
<!--<#if user?? &&( user.roleAuthMap["A09"]?? || user.admin) >-->
|
||||
<!--<dd class="ukefu-left-menu" data-tooltip="智能机器人">-->
|
||||
<!--<a href="javascript:void(0)" data-title="智能机器人" data-href="/apps/xiaoe/index.html" class="iframe_btn" data-id="maincontent" data-type="tabChange">-->
|
||||
<!--<i class="kfont" style="position: relative;"></i>-->
|
||||
@ -306,7 +306,7 @@
|
||||
<!--</#if>-->
|
||||
<!--</#if>-->
|
||||
<#if models?seq_contains("callout")>
|
||||
<#if user?? &&( user.roleAuthMap["A11"]?? || user.usertype == "0") >
|
||||
<#if user?? &&( user.roleAuthMap["A11"]?? || user.admin) >
|
||||
<dd class="ukefu-left-menu" data-tooltip="外呼系统">
|
||||
<a href="javascript:void(0)" data-title="外呼系统" data-href="/apps/callout/index.html" class="iframe_btn" data-id="maincontent" data-type="tabChange">
|
||||
<i class="kfont" style="position: relative;"></i>
|
||||
@ -315,7 +315,7 @@
|
||||
</#if>
|
||||
</#if>
|
||||
<#if models?seq_contains("chatbot")>
|
||||
<#if user?? &&( user.roleAuthMap["A09"]?? || user.usertype == "0") >
|
||||
<#if user?? &&( user.roleAuthMap["A09"]?? || user.admin) >
|
||||
<dd class="ukefu-left-menu" data-tooltip="智能机器人">
|
||||
<a href="javascript:void(0)" data-title="智能机器人" onclick="return false;" data-href="/apps/chatbot/index.html" class="iframe_btn" data-id="chatbotIntegrationWin" data-type="tabAdd">
|
||||
<i class="csfont" style="position: relative;"></i>
|
||||
@ -324,14 +324,14 @@
|
||||
</#if>
|
||||
</#if>
|
||||
<#if models?seq_contains("callcenter")>
|
||||
<#if user?? && (user.roleAuthMap["A10"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A10"]?? || user.admin) >
|
||||
<dd class="ukefu-left-menu" data-tooltip="语音渠道">
|
||||
<a href="javascript:void(0)" data-title="语音渠道" data-href="/apps/callcenter/service/index.html" class="iframe_btn" data-id="maincontent" data-type="tabChange">
|
||||
<i class="kfont" style="position: relative;"></i>
|
||||
</a>
|
||||
</dd>
|
||||
<!--
|
||||
<#if user?? &&( user.roleAuthMap["A12"]?? || user.usertype == "0") >
|
||||
<#if user?? &&( user.roleAuthMap["A12"]?? || user.admin) >
|
||||
<dd class="ukefu-left-menu" data-tooltip="坐席监控">
|
||||
<a href="javascript:void(0)" data-title="坐席监控" data-href="/apps/callcenter/service/monitor/allcall.html" class="iframe_btn" data-id="maincontent" data-type="tabChange">
|
||||
<i class="layui-icon" style="position: relative;"></i>
|
||||
@ -342,7 +342,7 @@
|
||||
</#if>
|
||||
</#if>
|
||||
<!--暂时隐藏https://github.com/chatopera/cosin/issues/52-->
|
||||
<!--<#if user?? && (user.roleAuthMap["A13"]?? || user.usertype == "0") >-->
|
||||
<!--<#if user?? && (user.roleAuthMap["A13"]?? || user.admin) >-->
|
||||
<!--<dd class="ukefu-left-menu" data-tooltip="数据报表">-->
|
||||
<!--<a href="javascript:void(0)" data-title="数据报表" data-href="/apps/view/index.html" class="iframe_btn" data-id="maincontent" data-type="tabChange">-->
|
||||
<!--<i class="kfont" style="position: relative;"></i>-->
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
<td><#if agentStatus.logindate??>${agentStatus.logindate?string('yyyy-MM-dd HH:mm:ss')}</#if></td>
|
||||
<td>
|
||||
<#if agentStatus.agentno != user.id && user.usertype == '0'>
|
||||
<#if agentStatus.agentno != user.id && user.admin>
|
||||
<a href="/service/agent/offline.html?id=${agentStatus.id!''}" data-toggle="tip" title="强制使登陆坐席离线,离线后,坐席不再分配访客,请确认是否操作?">
|
||||
<i class="layui-icon">ဆ</i>强制离线
|
||||
</a>
|
||||
|
@ -1,24 +1,24 @@
|
||||
<ul class="layui-nav layui-nav-tree" lay-filter="setting">
|
||||
<#if user?? && (user.roleAuthMap["A08_A01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A01"]?? || user.admin) >
|
||||
<li class="layui-nav-item layui-nav-itemed">
|
||||
<a class="layui-nav-title" href="javascript:;">会话信息</a>
|
||||
<dl class="layui-nav-child">
|
||||
<#if user?? && (user.roleAuthMap["A08_A01_A01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A01_A01"]?? || user.admin) >
|
||||
<dd <#if subtype?? && subtype == 'history'>class="layui-this"</#if>>
|
||||
<a href="/service/history/index.html">历史会话</a>
|
||||
</dd>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A08_A01_A02"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A01_A02"]?? || user.admin) >
|
||||
<dd <#if subtype?? && subtype == 'current'>class="layui-this"</#if>>
|
||||
<a href="/service/current/index.html">当前会话</a>
|
||||
</dd>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A08_A01_A03"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A01_A03"]?? || user.admin) >
|
||||
<dd <#if subtype?? && subtype == 'filter'>class="layui-this"</#if>>
|
||||
<a href="/service/quene/index.html">排队队列</a>
|
||||
</dd>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A08_A01_A04"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A01_A04"]?? || user.admin) >
|
||||
<dd <#if subtype?? && subtype == 'leavemsg'>class="layui-this"</#if>>
|
||||
<a href="/service/leavemsg/index.html">访客留言</a>
|
||||
</dd>
|
||||
@ -27,16 +27,16 @@
|
||||
|
||||
</li>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A08_A02"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A02"]?? || user.admin) >
|
||||
<li class="layui-nav-item layui-nav-itemed">
|
||||
<a class="layui-nav-title" href="javascript:;">统计功能</a>
|
||||
<dl class="layui-nav-child">
|
||||
<#if user?? && (user.roleAuthMap["A08_A02_A01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A02_A01"]?? || user.admin) >
|
||||
<dd <#if subtype?? && subtype == 'statcoment'>class="layui-this"</#if>>
|
||||
<a href="/service/stats/coment.html">满意度统计</a>
|
||||
</dd>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A08_A02_A02"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A02_A02"]?? || user.admin) >
|
||||
<dd <#if subtype?? && subtype == 'statagent'>class="layui-this"</#if>>
|
||||
<a href="/service/stats/agent.html">客服坐席</a>
|
||||
</dd>
|
||||
@ -44,21 +44,21 @@
|
||||
</dl>
|
||||
</li>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A08_A03"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A03"]?? || user.admin) >
|
||||
<li class="layui-nav-item layui-nav-itemed">
|
||||
<a class="layui-nav-title" href="javascript:;">服务小结</a>
|
||||
<dl class="layui-nav-child">
|
||||
<#if user?? && (user.roleAuthMap["A08_A03_A01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A03_A01"]?? || user.admin) >
|
||||
<dd <#if subtype?? && subtype == 'agentsummary'>class="layui-this"</#if>>
|
||||
<a href="/apps/agent/summary/index.html">多媒体客服</a>
|
||||
</dd>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A08_A03_A02"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A03_A02"]?? || user.admin) >
|
||||
<dd <#if subtype?? && subtype == 'processed'>class="layui-this"</#if>>
|
||||
<a href="/apps/agent/processed/index.html">已处理多媒体客服</a>
|
||||
</dd>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A08_A03_A03"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A03_A03"]?? || user.admin) >
|
||||
<#if models?seq_contains("callcenter")>
|
||||
<dd <#if subtype?? && subtype == 'summary'>class="layui-this"</#if>>
|
||||
<a href="/apps/callcenter/summary/index.html">呼叫中心</a>
|
||||
@ -67,7 +67,7 @@
|
||||
|
||||
</#if>
|
||||
<#if models?seq_contains("callcenter")>
|
||||
<#if user?? && (user.roleAuthMap["A08_A03_A04"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A03_A04"]?? || user.admin) >
|
||||
<dd <#if subtype?? && subtype == 'callcenterprocessed'>class="layui-this"</#if>>
|
||||
<a href="/apps/callcenter/processed/index.html">已处理呼叫中心</a>
|
||||
</dd>
|
||||
@ -77,7 +77,7 @@
|
||||
</dl>
|
||||
</li>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A08_A01_A05"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A01_A05"]?? || user.admin) >
|
||||
<li class="layui-nav-item layui-nav-itemed">
|
||||
<a class="layui-nav-title" href="javascript:;">满意度评价</a>
|
||||
<dl class="layui-nav-child">
|
||||
@ -92,17 +92,17 @@
|
||||
</dl>
|
||||
</li>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A08_A04"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A04"]?? || user.admin) >
|
||||
<li class="layui-nav-item layui-nav-itemed">
|
||||
<a class="layui-nav-title" href="javascript:;">坐席信息</a>
|
||||
<dl class="layui-nav-child">
|
||||
<#if user?? && (user.roleAuthMap["A08_A04_A01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A04_A01"]?? || user.admin) >
|
||||
<dd <#if subtype?? && subtype == 'onlineagent'>class="layui-this"</#if>>
|
||||
|
||||
<a href="/service/agent/index.html">在线坐席</a>
|
||||
</dd>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A08_A04_A02"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A08_A04_A02"]?? || user.admin) >
|
||||
<dd <#if subtype?? && subtype == 'userlist'>class="layui-this"</#if>>
|
||||
<a href="/service/user/index.html">全部坐席</a>
|
||||
</dd>
|
||||
|
@ -1,15 +1,15 @@
|
||||
<ul class="layui-nav layui-nav-tree" lay-filter="setting">
|
||||
<#if user?? && (user.roleAuthMap["A06_A01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A06_A01"]?? || user.admin) >
|
||||
<li class="layui-nav-item layui-nav-itemed">
|
||||
<a class="layui-nav-title" href="javascript:;">客服设置</a>
|
||||
<dl class="layui-nav-child">
|
||||
<#if user?? && (user.roleAuthMap["A06_A01_A01"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A06_A01_A01"]?? || user.admin) >
|
||||
<dd <#if subtype?? && subtype == 'sessionconfig'>class="layui-this"</#if>>
|
||||
|
||||
<a href="/setting/agent/index.html">对话设置</a>
|
||||
</dd>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A06_A01_A02"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A06_A01_A02"]?? || user.admin) >
|
||||
<dd <#if subtype?? && subtype == 'blacklist'>class="layui-this"</#if>>
|
||||
<a href="/setting/blacklist.html">黑名单</a>
|
||||
</dd>
|
||||
@ -22,7 +22,7 @@
|
||||
</dl>
|
||||
</li>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A06_A02"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A06_A02"]?? || user.admin) >
|
||||
<li class="layui-nav-item layui-nav-itemed">
|
||||
<a class="layui-nav-title" href="javascript:;">广告位管理</a>
|
||||
<dl class="layui-nav-child">
|
||||
@ -36,7 +36,7 @@
|
||||
</dl>
|
||||
</li>
|
||||
</#if>
|
||||
<#if user?? && (user.roleAuthMap["A06_A03"]?? || user.usertype == "0") >
|
||||
<#if user?? && (user.roleAuthMap["A06_A03"]?? || user.admin) >
|
||||
<li class="layui-nav-item layui-nav-itemed">
|
||||
<a class="layui-nav-title" href="javascript:;">标签管理</a>
|
||||
<dl class="layui-nav-child">
|
||||
|
@ -57,7 +57,7 @@
|
||||
首页
|
||||
</a>
|
||||
</li>
|
||||
<#if (user?? && user.roleAuthMap["B02"]?? || user.usertype == "0")>
|
||||
<#if (user?? && user.roleAuthMap["B02"]?? || user.admin)>
|
||||
<li class="layui-nav-item ">
|
||||
<a href="javascript:void(0)" onclick="return false;" data-title="系统管理" data-href="/admin/content.html" class="iframe_btn" data-id="admin" data-type="tabAdd">
|
||||
<i class="layui-icon" style="position: relative;"></i>
|
||||
@ -81,7 +81,7 @@
|
||||
<div class="content">
|
||||
<div class="organization-div">
|
||||
<#if organization??>
|
||||
<#if user?? && user.usertype == "0">
|
||||
<#if user?? && user.admin>
|
||||
<span id="company-name">${organization.name!''}</span>
|
||||
<a href="/apps/organization/edit.html?id=${organization.id!''}" data-toggle="ajax" data-width="450" data-height="350" data-title="编辑" ><i class="layui-icon"
|
||||
style="font-size: 24px;float:left;margin-left:5px;color:#2bd99e"></i>
|
||||
@ -97,7 +97,7 @@
|
||||
<img class="product-img" src="<#if tenant?? && tenant.tenantlogo??>/res/image.html?id=${tenant.tenantlogo?url}</#if>" onerror="javascript:this.src='/images/error.jpg';">
|
||||
<div class="ukefu-tenant-item-div2"
|
||||
style="font-weight: 400; position: absolute;">${tenant.tenantname!''}
|
||||
<#if user?? && user.usertype == "0">
|
||||
<#if user?? && user.admin>
|
||||
<i class="layui-icon ukefu-bt-text-title" href="/apps/tenant/delete.html?id=${tenant.id!''}" data-toggle="tip" data-title="删除"
|
||||
style="font-size: 24px;float:right;"></i>
|
||||
<i class="layui-icon ukefu-bt-text-title" href="/apps/tenant/edit.html?id=<#if tenant?? && tenant.id??>${tenant.id!''}</#if>" data-toggle="ajax" data-width="550" data-height="400" data-title="${systemConfig.namealias!''}编辑"
|
||||
@ -107,7 +107,7 @@
|
||||
</a>
|
||||
</div>
|
||||
</#list> </#if>
|
||||
<#if user?? && user.usertype == "0">
|
||||
<#if user?? && user.admin>
|
||||
<a href="/apps/tenant/add.html" data-toggle="ajax"
|
||||
data-width="550" data-height="300"
|
||||
data-title="${systemConfig.namealias!''}创建" class="ukefu-bt">
|
||||
|
@ -21,9 +21,9 @@
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
<#if msg?? && msg == '0'>
|
||||
layer.msg('用户名或密码错误,请重新填写',{icon: 2, offset: 'b', time: 3000})
|
||||
layer.msg('用户名或密码错误,请重新填写',{icon: 2, time: 3000})
|
||||
<#elseif msg?? && msg == '1'>
|
||||
layer.msg('用户注册成功,请通过用户名和密码登陆',{icon: 2, offset: 'b', time: 3000})
|
||||
layer.msg('用户注册成功,请通过用户名和密码登陆',{icon: 2, time: 3000})
|
||||
<#elseif msg?? && msg == '2'>
|
||||
layer.msg('您的账号已经在其它浏览器登录,请确认是您本人的操作,保证安全。',{icon: 2, offset: 't', time: 0})
|
||||
</#if>
|
||||
|
@ -2907,7 +2907,7 @@ select{
|
||||
left: 150px;
|
||||
background-color: rgba(0,0,0,.15);
|
||||
border-radius: 50px;
|
||||
<#if user?? && user.usertype?? && user.usertype == "0">
|
||||
<#if user?? && user.admin>
|
||||
width: 740px;
|
||||
<#else>
|
||||
width: 690px;
|
||||
@ -3980,11 +3980,3 @@ background:#FFFFFF;
|
||||
.cskefu-cca-header {
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
.cskefu-cca-leftside {
|
||||
top: 40px !important;
|
||||
}
|
||||
|
||||
.cskefu-cca-content {
|
||||
top: 40px !important;
|
||||
}
|
@ -8145,31 +8145,30 @@ CREATE TABLE `cs_user` (
|
||||
`USERNAME` varchar(50) DEFAULT NULL COMMENT '用户名',
|
||||
`PASSWORD` varchar(255) DEFAULT NULL COMMENT '密码',
|
||||
`SECURECONF` varchar(255) DEFAULT NULL COMMENT '安全级别',
|
||||
`EMAIL` varchar(255) DEFAULT NULL COMMENT '邮件',
|
||||
`email` varchar(255) DEFAULT NULL COMMENT '邮件',
|
||||
`FIRSTNAME` varchar(255) DEFAULT NULL COMMENT '姓',
|
||||
`MIDNAME` varchar(255) DEFAULT NULL COMMENT '名',
|
||||
`LASTNAME` varchar(255) DEFAULT NULL COMMENT '名',
|
||||
`JOBTITLE` varchar(255) DEFAULT NULL COMMENT '职位',
|
||||
`GENDER` varchar(255) DEFAULT NULL COMMENT '性别',
|
||||
`BIRTHDAY` varchar(255) DEFAULT NULL COMMENT '生日',
|
||||
`NICKNAME` varchar(255) DEFAULT NULL COMMENT '昵称',
|
||||
`USERTYPE` varchar(255) DEFAULT NULL COMMENT '用户类型',
|
||||
`RULENAME` varchar(255) DEFAULT NULL COMMENT '角色',
|
||||
`nickname` varchar(255) DEFAULT NULL COMMENT '昵称',
|
||||
`rulename` varchar(255) DEFAULT NULL COMMENT '角色',
|
||||
`SEARCHPROJECTID` varchar(255) DEFAULT NULL COMMENT '备用',
|
||||
`ORGI` varchar(32) DEFAULT NULL COMMENT '租户ID',
|
||||
`ORGID` varchar(32) DEFAULT NULL COMMENT '企业ID',
|
||||
`CREATER` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`CREATETIME` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`MEMO` varchar(255) DEFAULT NULL COMMENT '备注',
|
||||
`UPDATETIME` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`ORGAN` varchar(32) DEFAULT NULL COMMENT '部门',
|
||||
`MOBILE` varchar(32) DEFAULT NULL COMMENT '手机号',
|
||||
`orgi` varchar(32) DEFAULT NULL COMMENT '租户ID',
|
||||
`orgid` varchar(32) DEFAULT NULL COMMENT '企业ID',
|
||||
`creater` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createtime` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`memo` varchar(255) DEFAULT NULL COMMENT '备注',
|
||||
`updatetime` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`organ` varchar(32) DEFAULT NULL COMMENT '部门',
|
||||
`mobile` varchar(32) DEFAULT NULL COMMENT '手机号',
|
||||
`passupdatetime` datetime DEFAULT NULL COMMENT '最后 一次密码修改时间',
|
||||
`sign` text COMMENT '签名',
|
||||
`del` tinyint(4) DEFAULT '0' COMMENT '是否已删除',
|
||||
`uname` varchar(100) DEFAULT NULL COMMENT '姓名',
|
||||
`musteditpassword` tinyint(4) DEFAULT NULL COMMENT '登录修改密码',
|
||||
`AGENT` tinyint(4) DEFAULT NULL COMMENT '工号',
|
||||
`agent` tinyint(4) DEFAULT NULL COMMENT '工号',
|
||||
`province` varchar(50) DEFAULT NULL COMMENT '省份',
|
||||
`city` varchar(50) DEFAULT NULL COMMENT '城市',
|
||||
`fans` int(11) DEFAULT NULL COMMENT '关注人数',
|
||||
@ -8179,10 +8178,11 @@ CREATE TABLE `cs_user` (
|
||||
`status` varchar(10) DEFAULT NULL COMMENT '状态',
|
||||
`deactivetime` datetime DEFAULT NULL COMMENT '离线时间',
|
||||
`title` varchar(50) DEFAULT NULL COMMENT '标题',
|
||||
`DATASTATUS` tinyint(4) DEFAULT NULL COMMENT '数据状态',
|
||||
`datastatus` tinyint(4) DEFAULT NULL COMMENT '数据状态',
|
||||
`callcenter` tinyint(4) DEFAULT NULL COMMENT '启用呼叫中心坐席',
|
||||
`sipaccount` varchar(50) DEFAULT NULL COMMENT 'sip地址',
|
||||
`SUPERUSER` tinyint(4) DEFAULT NULL COMMENT '是否超级管理员',
|
||||
`superadmin` tinyint(4) DEFAULT NULL COMMENT '超级管理员',
|
||||
`admin` tinyint(4) DEFAULT NULL COMMENT '管理员',
|
||||
`maxuser` int(11) DEFAULT '0' COMMENT '最大接入访客数量',
|
||||
`ordertype` varchar(20) DEFAULT NULL COMMENT '默认排序方式',
|
||||
PRIMARY KEY (`ID`) USING BTREE
|
||||
@ -8192,7 +8192,7 @@ CREATE TABLE `cs_user` (
|
||||
-- Records of cs_user
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `cs_user` VALUES ('4028cac3614cd2f901614cf8be1f0324', NULL, 'admin', '5d80253b1cd5e5d4ca5ed539f4d72052', '5', 'admin@cc.com', NULL, NULL, NULL, NULL, '0', NULL, NULL, '0', NULL, NULL, 'cskefu', 'cskefu', NULL, '2017-03-16 13:56:34', '北京', '2018-07-31 08:24:13', '4028811b63b028dc0163b032c3ed0590', '18888888888', NULL, NULL, 0, '系统管理员', 0, 1, '北京', '北京', 2, 1, 0, '2018-08-10 04:38:17', NULL, NULL, NULL, 0, 0, NULL, 1, 0, NULL);
|
||||
INSERT INTO `cs_user` VALUES ('4028cac3614cd2f901614cf8be1f0324', NULL, 'admin', '5d80253b1cd5e5d4ca5ed539f4d72052', '5', 'admin@cc.com', NULL, NULL, NULL, NULL, NULL, NULL, '0', NULL, NULL, 'cskefu', 'cskefu', NULL, '2017-03-16 13:56:34', '北京', '2018-07-31 08:24:13', '4028811b63b028dc0163b032c3ed0590', '18888888888', NULL, NULL, 0, '超级管理员', 0, 1, '北京', '北京', 2, 1, 0, '2018-08-10 04:38:17', NULL, NULL, NULL, 0, 0, NULL, 1, 1, 0, NULL);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user