mirror of
https://github.com/chatopera/cosin.git
synced 2025-08-01 16:38:02 +08:00
Fix PbxHostRepository related class
This commit is contained in:
parent
57b376f3aa
commit
75f7ce79d4
@ -21,8 +21,9 @@ import com.chatopera.cc.model.Acl;
|
||||
import com.chatopera.cc.persistence.repository.AclRepository;
|
||||
import com.chatopera.cc.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -33,16 +34,17 @@ import javax.validation.Valid;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
||||
@RequiredArgsConstructor
|
||||
public class CallCenterAclController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private PbxHostRepository pbxHostRes ;
|
||||
@NonNull
|
||||
private final PbxHostRepository pbxHostRes;
|
||||
|
||||
@Autowired
|
||||
private AclRepository aclRes ;
|
||||
@NonNull
|
||||
private final AclRepository aclRes;
|
||||
|
||||
@RequestMapping(value = "/acl")
|
||||
@Menu(type = "callcenter" , subtype = "callcenteracl" , access = false , admin = true)
|
||||
@Menu(type = "callcenter", subtype = "callcenteracl", admin = true)
|
||||
public ModelAndView acl(ModelMap map, HttpServletRequest request, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(hostid)) {
|
||||
map.addAttribute("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
@ -52,15 +54,15 @@ public class CallCenterAclController extends Handler {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/acl/add")
|
||||
@Menu(type = "callcenter" , subtype = "acl" , access = false , admin = true)
|
||||
@Menu(type = "callcenter", subtype = "acl", admin = true)
|
||||
public ModelAndView acladd(ModelMap map, HttpServletRequest request, @Valid String hostid) {
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/acl/add"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/acl/save")
|
||||
@Menu(type = "callcenter" , subtype = "acl" , access = false , admin = true)
|
||||
public ModelAndView aclsave(ModelMap map , HttpServletRequest request , @Valid Acl acl) {
|
||||
@Menu(type = "callcenter", subtype = "acl", admin = true)
|
||||
public ModelAndView aclsave(HttpServletRequest request, @Valid Acl acl) {
|
||||
if (!StringUtils.isBlank(acl.getName())) {
|
||||
int count = aclRes.countByNameAndOrgi(acl.getName(), super.getOrgi(request));
|
||||
if (count == 0) {
|
||||
@ -73,7 +75,7 @@ public class CallCenterAclController extends Handler {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/acl/edit")
|
||||
@Menu(type = "callcenter" , subtype = "acl" , access = false , admin = true)
|
||||
@Menu(type = "callcenter", subtype = "acl", admin = true)
|
||||
public ModelAndView acledit(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String hostid) {
|
||||
map.addAttribute("acl", aclRes.findByIdAndOrgi(id, super.getOrgi(request)));
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
@ -81,8 +83,8 @@ public class CallCenterAclController extends Handler {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/acl/update")
|
||||
@Menu(type = "callcenter" , subtype = "acl" , access = false , admin = true)
|
||||
public ModelAndView pbxhostupdate(ModelMap map , HttpServletRequest request , @Valid Acl acl) {
|
||||
@Menu(type = "callcenter", subtype = "acl", admin = true)
|
||||
public ModelAndView pbxhostupdate(HttpServletRequest request, @Valid Acl acl) {
|
||||
if (!StringUtils.isBlank(acl.getId())) {
|
||||
Acl oldAcl = aclRes.findByIdAndOrgi(acl.getId(), super.getOrgi(request));
|
||||
if (oldAcl != null) {
|
||||
@ -96,10 +98,10 @@ public class CallCenterAclController extends Handler {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/acl/delete")
|
||||
@Menu(type = "callcenter" , subtype = "acl" , access = false , admin = true)
|
||||
public ModelAndView acldelete(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String hostid) {
|
||||
@Menu(type = "callcenter", subtype = "acl", admin = true)
|
||||
public ModelAndView acldelete(@Valid String id, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(id)) {
|
||||
aclRes.delete(id);
|
||||
aclRes.deleteById(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/acl.html?hostid=" + hostid));
|
||||
}
|
||||
|
@ -23,8 +23,9 @@ import com.chatopera.cc.model.PbxHost;
|
||||
import com.chatopera.cc.persistence.interfaces.CallCenterInterface;
|
||||
import com.chatopera.cc.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -36,19 +37,21 @@ import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
||||
@RequiredArgsConstructor
|
||||
public class CallCenterController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private PbxHostRepository pbxHostRes;
|
||||
@NonNull
|
||||
private final PbxHostRepository pbxHostRes;
|
||||
|
||||
@RequestMapping(value = "/index")
|
||||
@Menu(type = "callcenter", subtype = "callcenter", access = false, admin = true)
|
||||
public ModelAndView index(ModelMap map, HttpServletRequest request, @Valid String msg) {
|
||||
@Menu(type = "callcenter", subtype = "callcenter", admin = true)
|
||||
public ModelAndView index(ModelMap map, HttpServletRequest request) {
|
||||
List<PbxHost> pbxHostList = pbxHostRes.findByOrgi(super.getOrgi(request));
|
||||
if (MainContext.hasModule(Constants.CSKEFU_MODULE_CALLCENTER)) {
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) MainContext.getContext().getBean("callcenter");
|
||||
|
||||
for (PbxHost pbxHost : pbxHostList) {
|
||||
//noinspection ConstantConditions
|
||||
if (callCenterImpl != null) {
|
||||
pbxHost.setConnected(callCenterImpl.connected(pbxHost.getId()));
|
||||
}
|
||||
@ -59,13 +62,14 @@ public class CallCenterController extends Handler {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/pbxhost")
|
||||
@Menu(type = "callcenter", subtype = "pbxhost", access = false, admin = true)
|
||||
@Menu(type = "callcenter", subtype = "pbxhost", admin = true)
|
||||
public ModelAndView pbxhost(ModelMap map, HttpServletRequest request) {
|
||||
List<PbxHost> pbxHostList = pbxHostRes.findByOrgi(super.getOrgi(request));
|
||||
if (MainContext.hasModule(Constants.CSKEFU_MODULE_CALLCENTER)) {
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) MainContext.getContext().getBean("callcenter");
|
||||
|
||||
for (PbxHost pbxHost : pbxHostList) {
|
||||
//noinspection ConstantConditions
|
||||
if (callCenterImpl != null) {
|
||||
pbxHost.setConnected(callCenterImpl.connected(pbxHost.getId()));
|
||||
}
|
||||
@ -76,14 +80,14 @@ public class CallCenterController extends Handler {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/pbxhost/add")
|
||||
@Menu(type = "callcenter", subtype = "pbxhost", access = false, admin = true)
|
||||
public ModelAndView pbxhostadd(ModelMap map, HttpServletRequest request) {
|
||||
@Menu(type = "callcenter", subtype = "pbxhost", admin = true)
|
||||
public ModelAndView pbxhostadd() {
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/pbxhost/add"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/pbxhost/save")
|
||||
@Menu(type = "callcenter", subtype = "pbxhost", access = false, admin = true)
|
||||
public ModelAndView pbxhostsave(ModelMap map, HttpServletRequest request, @Valid PbxHost pbxHost) {
|
||||
@Menu(type = "callcenter", subtype = "pbxhost", admin = true)
|
||||
public ModelAndView pbxhostsave(HttpServletRequest request, @Valid PbxHost pbxHost) {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/pbxhost.html"));
|
||||
String msg = null;
|
||||
if (!StringUtils.isBlank(pbxHost.getName())) {
|
||||
@ -95,6 +99,7 @@ public class CallCenterController extends Handler {
|
||||
if (MainContext.hasModule(Constants.CSKEFU_MODULE_CALLCENTER)) {
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) MainContext.getContext().getBean(
|
||||
"callcenter");
|
||||
//noinspection ConstantConditions
|
||||
if (callCenterImpl != null) {
|
||||
try {
|
||||
callCenterImpl.init(pbxHost);
|
||||
@ -114,15 +119,15 @@ public class CallCenterController extends Handler {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/pbxhost/edit")
|
||||
@Menu(type = "callcenter", subtype = "pbxhost", access = false, admin = true)
|
||||
@Menu(type = "callcenter", subtype = "pbxhost", admin = true)
|
||||
public ModelAndView pbxhostedit(ModelMap map, HttpServletRequest request, @Valid String id) {
|
||||
map.addAttribute("pbxHost", pbxHostRes.findByIdAndOrgi(id, super.getOrgi(request)));
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/pbxhost/edit"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/pbxhost/update")
|
||||
@Menu(type = "callcenter", subtype = "pbxhost", access = false, admin = true)
|
||||
public ModelAndView pbxhostupdate(ModelMap map, HttpServletRequest request, @Valid PbxHost pbxHost) {
|
||||
@Menu(type = "callcenter", subtype = "pbxhost", admin = true)
|
||||
public ModelAndView pbxhostupdate(HttpServletRequest request, @Valid PbxHost pbxHost) {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/pbxhost.html"));
|
||||
String msg = null;
|
||||
if (!StringUtils.isBlank(pbxHost.getId())) {
|
||||
@ -138,6 +143,7 @@ public class CallCenterController extends Handler {
|
||||
if (MainContext.hasModule(Constants.CSKEFU_MODULE_CALLCENTER)) {
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) MainContext.getContext().getBean(
|
||||
"callcenter");
|
||||
//noinspection ConstantConditions
|
||||
if (callCenterImpl != null) {
|
||||
try {
|
||||
callCenterImpl.init(destHost);
|
||||
@ -156,13 +162,14 @@ public class CallCenterController extends Handler {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/pbxhost/delete")
|
||||
@Menu(type = "callcenter", subtype = "pbxhost", access = false, admin = true)
|
||||
public ModelAndView mediadelete(ModelMap map, HttpServletRequest request, @Valid String id) {
|
||||
@Menu(type = "callcenter", subtype = "pbxhost", admin = true)
|
||||
public ModelAndView mediadelete(@Valid String id) {
|
||||
if (!StringUtils.isBlank(id)) {
|
||||
pbxHostRes.delete(id);
|
||||
pbxHostRes.deleteById(id);
|
||||
if (MainContext.hasModule(Constants.CSKEFU_MODULE_CALLCENTER)) {
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) MainContext.getContext().getBean(
|
||||
"callcenter");
|
||||
//noinspection ConstantConditions
|
||||
if (callCenterImpl != null) {
|
||||
callCenterImpl.remove(id);
|
||||
}
|
||||
|
@ -25,8 +25,9 @@ import com.chatopera.cc.persistence.repository.*;
|
||||
import com.chatopera.cc.proxy.CallcenterOutboundProxy;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.freeswitch.model.CallCenterAgent;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -39,39 +40,40 @@ import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
||||
@RequiredArgsConstructor
|
||||
public class CallCenterExtentionController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private PbxHostRepository pbxHostRes;
|
||||
@NonNull
|
||||
private final PbxHostRepository pbxHostRes;
|
||||
|
||||
@Autowired
|
||||
private ExtentionRepository extentionRes;
|
||||
@NonNull
|
||||
private final ExtentionRepository extentionRes;
|
||||
|
||||
@Autowired
|
||||
private SipTrunkRepository sipTrunkRes;
|
||||
@NonNull
|
||||
private final SipTrunkRepository sipTrunkRes;
|
||||
|
||||
@Autowired
|
||||
private MediaRepository mediaRes;
|
||||
@NonNull
|
||||
private final MediaRepository mediaRes;
|
||||
|
||||
@Autowired
|
||||
private ServiceAiRepository serviceAiRes;
|
||||
@NonNull
|
||||
private final ServiceAiRepository serviceAiRes;
|
||||
|
||||
@Autowired
|
||||
private ProductRepository productRes;
|
||||
@NonNull
|
||||
private final ProductRepository productRes;
|
||||
|
||||
@Autowired
|
||||
private QueSurveyProcessRepository queSurveyProcessRes;
|
||||
@NonNull
|
||||
private final QueSurveyProcessRepository queSurveyProcessRes;
|
||||
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
@NonNull
|
||||
private final Cache cache;
|
||||
|
||||
|
||||
@RequestMapping(value = "/extention")
|
||||
@Menu(type = "callcenter", subtype = "callcenterresource", access = false, admin = true)
|
||||
@Menu(type = "callcenter", subtype = "callcenterresource", admin = true)
|
||||
public ModelAndView extention(ModelMap map, HttpServletRequest request, @Valid String hostid) {
|
||||
List<PbxHost> pbxHostList = pbxHostRes.findByOrgi(super.getOrgi(request));
|
||||
map.addAttribute("pbxHostList", pbxHostList);
|
||||
PbxHost pbxHost = null;
|
||||
PbxHost pbxHost;
|
||||
if (pbxHostList.size() > 0) {
|
||||
map.addAttribute("pbxHost", pbxHost = getPbxHost(pbxHostList, hostid));
|
||||
map.addAttribute("extentionList", extentionRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
@ -93,7 +95,7 @@ public class CallCenterExtentionController extends Handler {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/extention/add")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
@Menu(type = "callcenter", subtype = "extention", admin = true)
|
||||
public ModelAndView extentionadd(ModelMap map, HttpServletRequest request, @Valid String hostid) {
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
|
||||
@ -104,11 +106,10 @@ public class CallCenterExtentionController extends Handler {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/extention/save")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView extentionsave(ModelMap map, HttpServletRequest request, @Valid Extention extention) {
|
||||
@Menu(type = "callcenter", subtype = "extention", admin = true)
|
||||
public ModelAndView extentionsave(HttpServletRequest request, @Valid Extention extention) {
|
||||
if (StringUtils.isNotBlank(extention.getExtention()) && StringUtils.isNotBlank(extention.getPassword())) {
|
||||
String[] extstr = extention.getExtention().split("[,, ]");
|
||||
int extnum = 0;
|
||||
for (String ext : extstr) {
|
||||
if (ext.matches("[\\d]{3,8}")) { //分机号码最少3位数字
|
||||
createNewExtention(ext, super.getUser(request), extention.getHostid(), extention.getPassword(), super.getOrgi(request), extention);
|
||||
@ -118,7 +119,7 @@ public class CallCenterExtentionController extends Handler {
|
||||
int start = Integer.parseInt(ph[0]);
|
||||
int end = Integer.parseInt(ph[1]);
|
||||
|
||||
for (int i = start; i <= end && extnum < 100; i++) { //最大一次批量生产的 分机号不超过100个
|
||||
for (int i = start; i <= end; i++) { //最大一次批量生产的 分机号不超过100个
|
||||
createNewExtention(String.valueOf(i), super.getUser(request), extention.getHostid(), extention.getPassword(), super.getOrgi(request), extention);
|
||||
}
|
||||
}
|
||||
@ -128,7 +129,7 @@ public class CallCenterExtentionController extends Handler {
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/extention.html?hostid=" + extention.getHostid()));
|
||||
}
|
||||
|
||||
private Extention createNewExtention(String num, User user, String hostid, String password, String orgi, Extention src) {
|
||||
private void createNewExtention(String num, User user, String hostid, String password, String orgi, Extention src) {
|
||||
Extention extno = new Extention();
|
||||
extno.setExtention(num);
|
||||
extno.setOrgi(orgi);
|
||||
@ -148,11 +149,10 @@ public class CallCenterExtentionController extends Handler {
|
||||
if (count == 0) {
|
||||
extentionRes.save(extno);
|
||||
}
|
||||
return extno;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/extention/edit")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
@Menu(type = "callcenter", subtype = "extention", admin = true)
|
||||
public ModelAndView extentionedit(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String hostid) {
|
||||
map.addAttribute("extention", extentionRes.findByIdAndOrgi(id, super.getOrgi(request)));
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
@ -163,8 +163,8 @@ public class CallCenterExtentionController extends Handler {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/extention/update")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView extentionupdate(ModelMap map, HttpServletRequest request, @Valid Extention extention) {
|
||||
@Menu(type = "callcenter", subtype = "extention", admin = true)
|
||||
public ModelAndView extentionupdate(HttpServletRequest request, @Valid Extention extention) {
|
||||
if (StringUtils.isNotBlank(extention.getId())) {
|
||||
Extention ext = extentionRes.findByIdAndOrgi(extention.getId(), super.getOrgi(request));
|
||||
if (ext != null) {
|
||||
@ -198,7 +198,7 @@ public class CallCenterExtentionController extends Handler {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/extention/ivr")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
@Menu(type = "callcenter", subtype = "extention", admin = true)
|
||||
public ModelAndView ivr(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String hostid) {
|
||||
map.addAttribute("extention", extentionRes.findByIdAndOrgi(id, super.getOrgi(request)));
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
@ -213,8 +213,8 @@ public class CallCenterExtentionController extends Handler {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/extention/ivr/update")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView ivrupdate(ModelMap map, HttpServletRequest request, @Valid Extention extention) {
|
||||
@Menu(type = "callcenter", subtype = "extention", admin = true)
|
||||
public ModelAndView ivrupdate(HttpServletRequest request, @Valid Extention extention) {
|
||||
if (StringUtils.isNotBlank(extention.getId())) {
|
||||
Extention ext = extentionRes.findByIdAndOrgi(extention.getId(), super.getOrgi(request));
|
||||
if (ext != null) {
|
||||
@ -238,10 +238,10 @@ public class CallCenterExtentionController extends Handler {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/extention/delete")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView extentiondelete(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String hostid) {
|
||||
@Menu(type = "callcenter", subtype = "extention", admin = true)
|
||||
public ModelAndView extentiondelete(@Valid String id, @Valid String hostid) {
|
||||
if (StringUtils.isNotBlank(id)) {
|
||||
extentionRes.delete(id);
|
||||
extentionRes.deleteById(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/extention.html?hostid=" + hostid));
|
||||
}
|
||||
|
@ -22,8 +22,9 @@ import com.chatopera.cc.persistence.repository.ExtentionRepository;
|
||||
import com.chatopera.cc.persistence.repository.IvrMenuRepository;
|
||||
import com.chatopera.cc.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -34,19 +35,20 @@ import javax.validation.Valid;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
||||
@RequiredArgsConstructor
|
||||
public class CallCenterIvrController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private PbxHostRepository pbxHostRes ;
|
||||
@NonNull
|
||||
private final PbxHostRepository pbxHostRes;
|
||||
|
||||
@Autowired
|
||||
private ExtentionRepository extentionRes ;
|
||||
@NonNull
|
||||
private final ExtentionRepository extentionRes;
|
||||
|
||||
@Autowired
|
||||
private IvrMenuRepository ivrMenuRes;
|
||||
@NonNull
|
||||
private final IvrMenuRepository ivrMenuRes;
|
||||
|
||||
@RequestMapping(value = "/ivr")
|
||||
@Menu(type = "callcenter" , subtype = "callcenterivr" , access = false , admin = true)
|
||||
@Menu(type = "callcenter", subtype = "callcenterivr", admin = true)
|
||||
public ModelAndView ivr(ModelMap map, HttpServletRequest request, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(hostid)) {
|
||||
map.addAttribute("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
@ -56,7 +58,7 @@ public class CallCenterIvrController extends Handler{
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/ivr/edit")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false , admin = true)
|
||||
@Menu(type = "callcenter", subtype = "extention", admin = true)
|
||||
public ModelAndView extentionedit(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String hostid) {
|
||||
map.addAttribute("extention", extentionRes.findByIdAndOrgi(id, super.getOrgi(request)));
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
@ -64,8 +66,8 @@ public class CallCenterIvrController extends Handler{
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/ivr/update")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false , admin = true)
|
||||
public ModelAndView extentionupdate(ModelMap map , HttpServletRequest request , @Valid Extention extention) {
|
||||
@Menu(type = "callcenter", subtype = "extention", admin = true)
|
||||
public ModelAndView extentionupdate(HttpServletRequest request, @Valid Extention extention) {
|
||||
if (!StringUtils.isBlank(extention.getId())) {
|
||||
Extention ext = extentionRes.findByIdAndOrgi(extention.getId(), super.getOrgi(request));
|
||||
ext.setExtention(extention.getExtention());
|
||||
@ -78,15 +80,15 @@ public class CallCenterIvrController extends Handler{
|
||||
|
||||
@RequestMapping(value = "/ivr/delete")
|
||||
@Menu(type = "callcenter", subtype = "ivr", access = false, admin = true)
|
||||
public ModelAndView extentiondelete(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String hostid) {
|
||||
public ModelAndView extentiondelete(@Valid String id, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(id)) {
|
||||
extentionRes.delete(id);
|
||||
extentionRes.deleteById(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/ivr.html?hostid=" + hostid));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/ivr/design")
|
||||
@Menu(type = "callcenter" , subtype = "callcenterivr" , access = false , admin = true)
|
||||
@Menu(type = "callcenter", subtype = "callcenterivr", admin = true)
|
||||
public ModelAndView design(ModelMap map, HttpServletRequest request, @Valid String hostid, @Valid String id) {
|
||||
if (!StringUtils.isBlank(hostid)) {
|
||||
map.addAttribute("extention", extentionRes.findByIdAndOrgi(id, super.getOrgi(request)));
|
||||
@ -97,8 +99,8 @@ public class CallCenterIvrController extends Handler{
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/ivr/menu/add")
|
||||
@Menu(type = "callcenter" , subtype = "callcenterivr" , access = false , admin = true)
|
||||
public ModelAndView ivrmenuadd(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String hostid , @Valid String parentid) {
|
||||
@Menu(type = "callcenter", subtype = "callcenterivr", admin = true)
|
||||
public ModelAndView ivrmenuadd(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String hostid) {
|
||||
map.addAttribute("extention", extentionRes.findByIdAndOrgi(id, super.getOrgi(request)));
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/ivr/menuadd"));
|
||||
|
@ -22,9 +22,10 @@ import com.chatopera.cc.model.Media;
|
||||
import com.chatopera.cc.persistence.repository.MediaRepository;
|
||||
import com.chatopera.cc.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
@ -37,16 +38,18 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
||||
@RequiredArgsConstructor
|
||||
public class CallCenterMediaController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private PbxHostRepository pbxHostRes ;
|
||||
@NonNull
|
||||
private final PbxHostRepository pbxHostRes;
|
||||
|
||||
@Autowired
|
||||
private MediaRepository mediaRes ;
|
||||
@NonNull
|
||||
private final MediaRepository mediaRes;
|
||||
|
||||
@Value("${web.upload-path}")
|
||||
private String path;
|
||||
@ -70,14 +73,15 @@ public class CallCenterMediaController extends Handler{
|
||||
|
||||
@RequestMapping(value = "/media/save")
|
||||
@Menu(type = "callcenter", subtype = "media", access = false, admin = true)
|
||||
public ModelAndView mediasave(ModelMap map , HttpServletRequest request , @RequestParam(value = "mediafile", required = false) MultipartFile mediafile) throws IOException {
|
||||
public ModelAndView mediasave(HttpServletRequest request, @RequestParam(value = "mediafile", required = false) MultipartFile mediafile) throws IOException {
|
||||
Media media = new Media();
|
||||
media.setName(request.getParameter("name"));
|
||||
media.setHostid(request.getParameter("hostid"));
|
||||
if (!StringUtils.isBlank(media.getName())) {
|
||||
int count = mediaRes.countByNameAndOrgi(media.getName(), super.getOrgi(request));
|
||||
if (count == 0) {
|
||||
String fileName = "media/"+ MainUtils.getUUID()+mediafile.getOriginalFilename().substring(mediafile.getOriginalFilename().lastIndexOf(".")) ;
|
||||
String fileName = "media/" + MainUtils.getUUID() + Objects.requireNonNull(mediafile.getOriginalFilename())
|
||||
.substring(mediafile.getOriginalFilename().lastIndexOf("."));
|
||||
|
||||
media.setOrgi(super.getOrgi(request));
|
||||
media.setCreater(super.getUser(request).getId());
|
||||
@ -85,9 +89,10 @@ public class CallCenterMediaController extends Handler{
|
||||
media.setContent(mediafile.getContentType());
|
||||
media.setFilename(fileName);
|
||||
|
||||
if(mediafile!=null && mediafile.getOriginalFilename().lastIndexOf(".") > 0){
|
||||
if (mediafile.getOriginalFilename().lastIndexOf(".") > 0) {
|
||||
File logoDir = new File(path, "media");
|
||||
if (!logoDir.exists()) {
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
logoDir.mkdirs();
|
||||
}
|
||||
FileCopyUtils.copy(mediafile.getBytes(), new File(path, fileName));
|
||||
@ -109,7 +114,7 @@ public class CallCenterMediaController extends Handler{
|
||||
|
||||
@RequestMapping(value = "/media/update")
|
||||
@Menu(type = "callcenter", subtype = "media", access = false, admin = true)
|
||||
public ModelAndView pbxhostupdate(ModelMap map , HttpServletRequest request , @RequestParam(value = "mediafile", required = false) MultipartFile mediafile) throws IOException {
|
||||
public ModelAndView pbxhostupdate(HttpServletRequest request, @RequestParam(value = "mediafile", required = false) MultipartFile mediafile) throws IOException {
|
||||
Media media = new Media();
|
||||
media.setName(request.getParameter("name"));
|
||||
media.setHostid(request.getParameter("hostid"));
|
||||
@ -123,12 +128,14 @@ public class CallCenterMediaController extends Handler{
|
||||
wavFile.deleteOnExit();
|
||||
}
|
||||
|
||||
String fileName = "media/"+ MainUtils.getUUID()+mediafile.getOriginalFilename().substring(mediafile.getOriginalFilename().lastIndexOf(".")) ;
|
||||
String fileName = "media/" + MainUtils.getUUID() + Objects.requireNonNull(mediafile.getOriginalFilename())
|
||||
.substring(mediafile.getOriginalFilename().lastIndexOf("."));
|
||||
oldMedia.setFilename(fileName);
|
||||
|
||||
if(mediafile!=null && mediafile.getOriginalFilename().lastIndexOf(".") > 0){
|
||||
if (mediafile.getOriginalFilename().lastIndexOf(".") > 0) {
|
||||
File mediaDir = new File(path, "media");
|
||||
if (!mediaDir.exists()) {
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
mediaDir.mkdirs();
|
||||
}
|
||||
FileCopyUtils.copy(mediafile.getBytes(), new File(path, fileName));
|
||||
@ -143,15 +150,16 @@ public class CallCenterMediaController extends Handler{
|
||||
|
||||
@RequestMapping(value = "/media/delete")
|
||||
@Menu(type = "callcenter", subtype = "media", access = false, admin = true)
|
||||
public ModelAndView mediadelete(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String hostid) {
|
||||
public ModelAndView mediadelete(@Valid String id, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(id)) {
|
||||
mediaRes.delete(id);
|
||||
mediaRes.deleteById(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/media.html?hostid=" + hostid));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/play")
|
||||
@Menu(type = "callcenter", subtype = "play", access = false)
|
||||
public ModelAndView play(ModelMap map , HttpServletRequest request ,@Valid final String id ,@Valid final String hostid) {
|
||||
public ModelAndView play(ModelMap map, HttpServletRequest request, @Valid final String id) {
|
||||
map.addAttribute("media", mediaRes.findByIdAndOrgi(id, super.getOrgi(request)));
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/media/play"));
|
||||
}
|
||||
|
@ -25,8 +25,9 @@ import com.chatopera.cc.persistence.repository.ExtentionRepository;
|
||||
import com.chatopera.cc.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.persistence.repository.ServiceAiRepository;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -38,16 +39,17 @@ import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
||||
@RequiredArgsConstructor
|
||||
public class CallCenterResourceController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private PbxHostRepository pbxHostRes;
|
||||
@NonNull
|
||||
private final PbxHostRepository pbxHostRes;
|
||||
|
||||
@Autowired
|
||||
private ExtentionRepository extentionRes;
|
||||
@NonNull
|
||||
private final ExtentionRepository extentionRes;
|
||||
|
||||
@Autowired
|
||||
private ServiceAiRepository serviceAiRes;
|
||||
@NonNull
|
||||
private final ServiceAiRepository serviceAiRes;
|
||||
|
||||
@RequestMapping(value = "/resource")
|
||||
@Menu(type = "callcenter", subtype = "callcenter", access = false, admin = true)
|
||||
@ -57,7 +59,7 @@ public class CallCenterResourceController extends Handler {
|
||||
|
||||
map.put("serviceAiList", serviceAiRes.findByOrgi(super.getOrgi(request)));
|
||||
|
||||
PbxHost pbxHost = null;
|
||||
PbxHost pbxHost;
|
||||
if (pbxHostList.size() > 0) {
|
||||
map.addAttribute("pbxHost", pbxHost = getPbxHost(pbxHostList, hostid));
|
||||
map.addAttribute("extentionList",
|
||||
@ -71,7 +73,7 @@ public class CallCenterResourceController extends Handler {
|
||||
public ModelAndView config(ModelMap map, HttpServletRequest request, @Valid String hostid) {
|
||||
List<PbxHost> pbxHostList = pbxHostRes.findByOrgi(super.getOrgi(request));
|
||||
map.addAttribute("pbxHostList", pbxHostList);
|
||||
PbxHost pbxHost = null;
|
||||
PbxHost pbxHost;
|
||||
if (pbxHostList.size() > 0) {
|
||||
map.addAttribute("pbxHost", pbxHost = getPbxHost(pbxHostList, hostid));
|
||||
map.addAttribute("extentionList",
|
||||
@ -82,7 +84,7 @@ public class CallCenterResourceController extends Handler {
|
||||
|
||||
@RequestMapping(value = "/resource/save")
|
||||
@Menu(type = "callcenter", subtype = "callcenter", access = false, admin = true)
|
||||
public ModelAndView save(ModelMap map, HttpServletRequest request, @Valid PbxHost pbxHost) throws Exception {
|
||||
public ModelAndView save(HttpServletRequest request, @Valid PbxHost pbxHost) throws Exception {
|
||||
PbxHost tempPbxHost = pbxHostRes.findByIdAndOrgi(pbxHost.getId(), super.getOrgi(request));
|
||||
if (tempPbxHost != null) {
|
||||
pbxHost.setCreater(tempPbxHost.getCreater());
|
||||
@ -108,7 +110,7 @@ public class CallCenterResourceController extends Handler {
|
||||
public ModelAndView resourcepbx(ModelMap map, HttpServletRequest request, @Valid String hostid) {
|
||||
List<PbxHost> pbxHostList = pbxHostRes.findByOrgi(super.getOrgi(request));
|
||||
map.addAttribute("pbxHostList", pbxHostList);
|
||||
PbxHost pbxHost = null;
|
||||
PbxHost pbxHost;
|
||||
if (pbxHostList.size() > 0) {
|
||||
map.addAttribute("pbxHost", pbxHost = getPbxHost(pbxHostList, hostid));
|
||||
map.addAttribute("extentionList",
|
||||
|
@ -22,8 +22,9 @@ import com.chatopera.cc.model.RouterRules;
|
||||
import com.chatopera.cc.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.persistence.repository.RouterRulesRepository;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -35,14 +36,14 @@ import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
||||
@RequiredArgsConstructor
|
||||
public class CallCenterRouterController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private PbxHostRepository pbxHostRes ;
|
||||
@NonNull
|
||||
private final PbxHostRepository pbxHostRes;
|
||||
|
||||
|
||||
@Autowired
|
||||
private RouterRulesRepository routerRulesRes ;
|
||||
@NonNull
|
||||
private final RouterRulesRepository routerRulesRes;
|
||||
|
||||
|
||||
@RequestMapping(value = "/router")
|
||||
@ -66,7 +67,7 @@ public class CallCenterRouterController extends Handler{
|
||||
|
||||
@RequestMapping(value = "/router/save")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView extentionsave(ModelMap map , HttpServletRequest request , @Valid RouterRules router) {
|
||||
public ModelAndView extentionsave(HttpServletRequest request, @Valid RouterRules router) {
|
||||
if (!StringUtils.isBlank(router.getName())) {
|
||||
int count = routerRulesRes.countByNameAndOrgi(router.getName(), super.getOrgi(request));
|
||||
if (count == 0) {
|
||||
@ -88,7 +89,7 @@ public class CallCenterRouterController extends Handler{
|
||||
|
||||
@RequestMapping(value = "/router/update")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView pbxhostupdate(ModelMap map , HttpServletRequest request , @Valid RouterRules router) {
|
||||
public ModelAndView pbxhostupdate(HttpServletRequest request, @Valid RouterRules router) {
|
||||
if (!StringUtils.isBlank(router.getId())) {
|
||||
RouterRules oldRouter = routerRulesRes.findByIdAndOrgi(router.getId(), super.getOrgi(request));
|
||||
if (oldRouter != null) {
|
||||
@ -113,7 +114,7 @@ public class CallCenterRouterController extends Handler{
|
||||
|
||||
@RequestMapping(value = "/router/code/update")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView routercodeupdate(ModelMap map , HttpServletRequest request , @Valid RouterRules router) {
|
||||
public ModelAndView routercodeupdate(HttpServletRequest request, @Valid RouterRules router) {
|
||||
if (!StringUtils.isBlank(router.getId())) {
|
||||
RouterRules oldRouter = routerRulesRes.findByIdAndOrgi(router.getId(), super.getOrgi(request));
|
||||
if (!StringUtils.isBlank(router.getRoutercontent())) {
|
||||
@ -126,9 +127,9 @@ public class CallCenterRouterController extends Handler{
|
||||
|
||||
@RequestMapping(value = "/router/delete")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView extentiondelete(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String hostid) {
|
||||
public ModelAndView extentiondelete(@Valid String id, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(id)) {
|
||||
routerRulesRes.delete(id);
|
||||
routerRulesRes.deleteById(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/peer.html?hostid=" + hostid));
|
||||
}
|
||||
|
@ -22,8 +22,9 @@ import com.chatopera.cc.model.SipTrunk;
|
||||
import com.chatopera.cc.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.persistence.repository.SipTrunkRepository;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -34,16 +35,17 @@ import javax.validation.Valid;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
||||
@RequiredArgsConstructor
|
||||
public class CallCenterSipTrunkController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private PbxHostRepository pbxHostRes;
|
||||
@NonNull
|
||||
private final PbxHostRepository pbxHostRes;
|
||||
|
||||
@Autowired
|
||||
private SipTrunkRepository sipTrunkRes;
|
||||
@NonNull
|
||||
private final SipTrunkRepository sipTrunkRes;
|
||||
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
@NonNull
|
||||
private final Cache cache;
|
||||
|
||||
@RequestMapping(value = "/siptrunk")
|
||||
@Menu(type = "callcenter", subtype = "callcenterresource", access = false, admin = true)
|
||||
@ -64,7 +66,7 @@ public class CallCenterSipTrunkController extends Handler {
|
||||
|
||||
@RequestMapping(value = "/siptrunk/save")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView extentionsave(ModelMap map, HttpServletRequest request, @Valid SipTrunk siptrunk) {
|
||||
public ModelAndView extentionsave(HttpServletRequest request, @Valid SipTrunk siptrunk) {
|
||||
if (!StringUtils.isBlank(siptrunk.getName())) {
|
||||
int count = sipTrunkRes.countByNameAndOrgi(siptrunk.getName(), super.getOrgi(request));
|
||||
if (count == 0) {
|
||||
@ -88,7 +90,7 @@ public class CallCenterSipTrunkController extends Handler {
|
||||
|
||||
@RequestMapping(value = "/siptrunk/update")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView pbxhostupdate(ModelMap map, HttpServletRequest request, @Valid SipTrunk siptrunk) {
|
||||
public ModelAndView pbxhostupdate(HttpServletRequest request, @Valid SipTrunk siptrunk) {
|
||||
if (!StringUtils.isBlank(siptrunk.getId())) {
|
||||
SipTrunk oldSipTrunk = sipTrunkRes.findByIdAndOrgi(siptrunk.getId(), super.getOrgi(request));
|
||||
if (oldSipTrunk != null) {
|
||||
@ -129,7 +131,7 @@ public class CallCenterSipTrunkController extends Handler {
|
||||
|
||||
@RequestMapping(value = "/siptrunk/code/update")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView siptrunkcodeupdate(ModelMap map, HttpServletRequest request, @Valid SipTrunk siptrunk) {
|
||||
public ModelAndView siptrunkcodeupdate(HttpServletRequest request, @Valid SipTrunk siptrunk) {
|
||||
if (!StringUtils.isBlank(siptrunk.getId())) {
|
||||
SipTrunk oldSipTrunk = sipTrunkRes.findByIdAndOrgi(siptrunk.getId(), super.getOrgi(request));
|
||||
if (!StringUtils.isBlank(siptrunk.getSipcontent())) {
|
||||
@ -143,9 +145,9 @@ public class CallCenterSipTrunkController extends Handler {
|
||||
|
||||
@RequestMapping(value = "/siptrunk/delete")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView extentiondelete(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String hostid) {
|
||||
public ModelAndView extentiondelete(@Valid String id, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(id)) {
|
||||
sipTrunkRes.delete(id);
|
||||
sipTrunkRes.deleteById(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/siptrunk.html?hostid=" + hostid));
|
||||
}
|
||||
|
@ -26,8 +26,8 @@ import com.chatopera.cc.persistence.repository.ExtentionRepository;
|
||||
import com.chatopera.cc.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.persistence.repository.SkillExtentionRepository;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -40,26 +40,27 @@ import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
||||
@RequiredArgsConstructor
|
||||
public class CallCenterSkillController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private PbxHostRepository pbxHostRes ;
|
||||
@org.springframework.lang.NonNull
|
||||
private final PbxHostRepository pbxHostRes;
|
||||
|
||||
@Autowired
|
||||
private ExtentionRepository extentionRes;
|
||||
@org.springframework.lang.NonNull
|
||||
private final ExtentionRepository extentionRes;
|
||||
|
||||
@Autowired
|
||||
private CallCenterSkillRepository skillRes ;
|
||||
@org.springframework.lang.NonNull
|
||||
private final CallCenterSkillRepository skillRes;
|
||||
|
||||
@Autowired
|
||||
private SkillExtentionRepository skillExtentionRes;
|
||||
@org.springframework.lang.NonNull
|
||||
private final SkillExtentionRepository skillExtentionRes;
|
||||
|
||||
@RequestMapping(value = "/skill")
|
||||
@Menu(type = "callcenter", subtype = "callcenterresource", access = false, admin = true)
|
||||
public ModelAndView skill(ModelMap map, HttpServletRequest request, @Valid String hostid) {
|
||||
List<PbxHost> pbxHostList = pbxHostRes.findByOrgi(super.getOrgi(request));
|
||||
map.addAttribute("pbxHostList", pbxHostList);
|
||||
PbxHost pbxHost = null ;
|
||||
PbxHost pbxHost;
|
||||
if (pbxHostList.size() > 0) {
|
||||
map.addAttribute("pbxHost", pbxHost = getPbxHost(pbxHostList, hostid));
|
||||
map.addAttribute("skillGroups", skillRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
@ -73,7 +74,8 @@ public class CallCenterSkillController extends Handler {
|
||||
if (!StringUtils.isBlank(hostid)) {
|
||||
for (PbxHost pbx : pbxHostList) {
|
||||
if (pbx.getId().equals(hostid)) {
|
||||
pbxHost = pbx; break ;
|
||||
pbxHost = pbx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -89,7 +91,7 @@ public class CallCenterSkillController extends Handler {
|
||||
|
||||
@RequestMapping(value = "/skill/save")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView extentionsave(ModelMap map , HttpServletRequest request , @Valid CallCenterSkill skill) {
|
||||
public ModelAndView extentionsave(HttpServletRequest request, @Valid CallCenterSkill skill) {
|
||||
if (!StringUtils.isBlank(skill.getSkill())) {
|
||||
int count = skillRes.countBySkillAndOrgi(skill.getSkill(), super.getOrgi(request));
|
||||
if (count == 0) {
|
||||
@ -111,7 +113,7 @@ public class CallCenterSkillController extends Handler {
|
||||
|
||||
@RequestMapping(value = "/skill/update")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView pbxhostupdate(ModelMap map , HttpServletRequest request , @Valid Extention extention) {
|
||||
public ModelAndView pbxhostupdate(HttpServletRequest request, @Valid Extention extention) {
|
||||
if (!StringUtils.isBlank(extention.getId())) {
|
||||
Extention ext = extentionRes.findByIdAndOrgi(extention.getId(), super.getOrgi(request));
|
||||
if (ext != null && !StringUtils.isBlank(ext.getExtention()) && ext.getExtention().matches("[\\d]{3,8}")) {
|
||||
@ -128,9 +130,9 @@ public class CallCenterSkillController extends Handler {
|
||||
|
||||
@RequestMapping(value = "/skill/delete")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView extentiondelete(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String hostid) {
|
||||
public ModelAndView extentiondelete(@Valid String id, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(id)) {
|
||||
extentionRes.delete(id);
|
||||
extentionRes.deleteById(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/skill.html?hostid=" + hostid));
|
||||
}
|
||||
@ -148,16 +150,16 @@ public class CallCenterSkillController extends Handler {
|
||||
|
||||
@RequestMapping(value = "/skill/extention/delete")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView skillextentiondelete(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String hostid) {
|
||||
public ModelAndView skillextentiondelete(@Valid String id, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(id)) {
|
||||
skillExtentionRes.delete(id);
|
||||
skillExtentionRes.deleteById(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/skill.html?hostid=" + hostid));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/skill/extention/save")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView skillextentionsave(ModelMap map , HttpServletRequest request , @Valid SkillExtention skillExtention, @Valid String hostid , @Valid String[] exts) {
|
||||
public ModelAndView skillextentionsave(HttpServletRequest request, @Valid SkillExtention skillExtention, @Valid String hostid, @Valid String[] exts) {
|
||||
if (exts != null && exts.length > 0) {
|
||||
List<SkillExtention> skillExtentionList = skillExtentionRes.findByHostidAndOrgi(hostid, super.getOrgi(request));
|
||||
for (String ext : exts) {
|
||||
@ -173,9 +175,10 @@ public class CallCenterSkillController extends Handler {
|
||||
for (SkillExtention temp : skillExtentionList) {
|
||||
if (temp.getSkillid().equals(skillExt.getSkillid()) && temp.getExtention().equals(skillExt.getExtention())) {
|
||||
ingroup = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(ingroup == false){
|
||||
if (!ingroup) {
|
||||
skillExtentionRes.save(skillExt);
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,9 @@ import com.chatopera.cc.model.SystemConfig;
|
||||
import com.chatopera.cc.model.Template;
|
||||
import com.chatopera.cc.persistence.repository.*;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -40,35 +41,36 @@ import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/apps/callcenter")
|
||||
@RequiredArgsConstructor
|
||||
public class ExtentionController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private PbxHostRepository pbxHostRes ;
|
||||
@NonNull
|
||||
private final PbxHostRepository pbxHostRes;
|
||||
|
||||
@Autowired
|
||||
private ExtentionRepository extentionRes;
|
||||
@NonNull
|
||||
private final ExtentionRepository extentionRes;
|
||||
|
||||
@Autowired
|
||||
private AclRepository aclRes;
|
||||
@NonNull
|
||||
private final AclRepository aclRes;
|
||||
|
||||
@Autowired
|
||||
private RouterRulesRepository routerRes;
|
||||
@NonNull
|
||||
private final RouterRulesRepository routerRes;
|
||||
|
||||
@Autowired
|
||||
private SkillExtentionRepository skillExtentionRes ;
|
||||
@NonNull
|
||||
private final SkillExtentionRepository skillExtentionRes;
|
||||
|
||||
@Autowired
|
||||
private CallCenterSkillRepository skillRes ;
|
||||
@NonNull
|
||||
private final CallCenterSkillRepository skillRes;
|
||||
|
||||
@Autowired
|
||||
private SipTrunkRepository sipTrunkRes ;
|
||||
@NonNull
|
||||
private final SipTrunkRepository sipTrunkRes;
|
||||
|
||||
@RequestMapping(value = "/extention")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = true)
|
||||
public ModelAndView index(ModelMap map , HttpServletRequest request , @Valid String hostname , @Valid String key_value) {
|
||||
public ModelAndView index(ModelMap map, HttpServletRequest request, @Valid String hostname) {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/extention/index"));
|
||||
List<PbxHost> pbxHostList = pbxHostRes.findByHostnameOrIpaddr(hostname, hostname);
|
||||
PbxHost pbxHost = null ;
|
||||
PbxHost pbxHost;
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig();
|
||||
if (pbxHostList != null && pbxHostList.size() > 0) {
|
||||
pbxHost = pbxHostList.get(0);
|
||||
@ -90,10 +92,10 @@ public class ExtentionController extends Handler{
|
||||
|
||||
@RequestMapping(value = "/configuration")
|
||||
@Menu(type = "callcenter", subtype = "configuration", access = true)
|
||||
public ModelAndView configuration(ModelMap map , HttpServletRequest request , @Valid String hostname , @Valid String key_value , @Valid String profile) {
|
||||
public ModelAndView configuration(ModelMap map, HttpServletRequest request, @Valid String hostname, @Valid String key_value) {
|
||||
|
||||
List<PbxHost> pbxHostList = pbxHostRes.findByHostnameOrIpaddr(hostname, hostname);
|
||||
PbxHost pbxHost = null ;
|
||||
PbxHost pbxHost;
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig();
|
||||
if (pbxHostList != null && pbxHostList.size() > 0) {
|
||||
pbxHost = pbxHostList.get(0);
|
||||
@ -137,10 +139,10 @@ public class ExtentionController extends Handler{
|
||||
|
||||
@RequestMapping(value = "/dialplan")
|
||||
@Menu(type = "callcenter", subtype = "dialplan", access = true)
|
||||
public ModelAndView dialplan(ModelMap map , HttpServletRequest request , @Valid String hostname , @Valid String key_value) {
|
||||
public ModelAndView dialplan(ModelMap map, HttpServletRequest request, @Valid String hostname) {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/dialplan/index"));
|
||||
List<PbxHost> pbxHostList = pbxHostRes.findByHostnameOrIpaddr(hostname, hostname);
|
||||
PbxHost pbxHost = null ;
|
||||
PbxHost pbxHost;
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig();
|
||||
Template template = null;
|
||||
if (pbxHostList != null && pbxHostList.size() > 0) {
|
||||
@ -162,16 +164,13 @@ public class ExtentionController extends Handler{
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/extention/detail")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false)
|
||||
@Menu(type = "callcenter", subtype = "extention")
|
||||
public ModelAndView detail(ModelMap map, HttpServletRequest request, HttpServletResponse response, @Valid String extno) {
|
||||
List<Extention> extentionList = extentionRes.findByExtentionAndOrgi(extno, super.getOrgi(request));
|
||||
if (extentionList != null && extentionList.size() == 1) {
|
||||
Extention extention = extentionList.get(0);
|
||||
if (!StringUtils.isBlank(extention.getHostid())) {
|
||||
PbxHost pbxHost = pbxHostRes.findById(extention.getHostid()) ;
|
||||
if(pbxHost!=null) {
|
||||
map.addAttribute("pbxhost" , pbxHost);
|
||||
}
|
||||
pbxHostRes.findById(extention.getHostid()).ifPresent(it -> map.addAttribute("pbxhost", it));
|
||||
}
|
||||
map.addAttribute("extention", extention);
|
||||
}
|
||||
@ -180,8 +179,8 @@ public class ExtentionController extends Handler{
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/ivr")
|
||||
@Menu(type = "callcenter" , subtype = "ivr" , access = false)
|
||||
public ModelAndView ivr(ModelMap map , HttpServletRequest request , HttpServletResponse response ,@Valid String hostid) {
|
||||
@Menu(type = "callcenter", subtype = "ivr")
|
||||
public ModelAndView ivr(ModelMap map, HttpServletRequest request, @Valid String hostid) {
|
||||
map.addAttribute("ivrList", extentionRes.findByHostidAndExtypeAndOrgi(hostid, MainContext.ExtentionType.BUSINESS.toString(), super.getOrgi(request)));
|
||||
return request(super.createRequestPageTempletResponse("/apps/business/callcenter/extention/ivr"));
|
||||
}
|
||||
|
@ -24,8 +24,11 @@ import java.util.List;
|
||||
public interface PbxHostRepository extends JpaRepository<PbxHost, String> {
|
||||
|
||||
PbxHost findByIdAndOrgi(String id, String orgi);
|
||||
PbxHost findById(String id);
|
||||
|
||||
// PbxHost findById(String id);
|
||||
|
||||
List<PbxHost> findByOrgi(String orgi);
|
||||
|
||||
List<PbxHost> findByHostnameOrIpaddr(String hostname, String ip);
|
||||
|
||||
int countByHostnameAndOrgi(String hostname, String orgi);
|
||||
|
Loading…
x
Reference in New Issue
Block a user