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,74 +34,75 @@ 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)
|
||||
public ModelAndView acl(ModelMap map , HttpServletRequest request , @Valid String hostid) {
|
||||
if(!StringUtils.isBlank(hostid)){
|
||||
map.addAttribute("pbxHost" , pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
map.addAttribute("aclList" , aclRes.findByHostidAndOrgi(hostid, super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/acl/index"));
|
||||
@RequestMapping(value = "/acl")
|
||||
@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)));
|
||||
map.addAttribute("aclList", aclRes.findByHostidAndOrgi(hostid, super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/acl/index"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/acl/add")
|
||||
@Menu(type = "callcenter" , subtype = "acl" , access = false , 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/add")
|
||||
@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) {
|
||||
if(!StringUtils.isBlank(acl.getName())){
|
||||
int count = aclRes.countByNameAndOrgi(acl.getName(), super.getOrgi(request)) ;
|
||||
if(count == 0){
|
||||
acl.setOrgi(super.getOrgi(request));
|
||||
acl.setCreater(super.getUser(request).getId());
|
||||
aclRes.save(acl) ;
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/acl.html?hostid="+acl.getHostid()));
|
||||
@RequestMapping(value = "/acl/save")
|
||||
@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) {
|
||||
acl.setOrgi(super.getOrgi(request));
|
||||
acl.setCreater(super.getUser(request).getId());
|
||||
aclRes.save(acl);
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/acl.html?hostid=" + acl.getHostid()));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/acl/edit")
|
||||
@Menu(type = "callcenter" , subtype = "acl" , access = false , 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))) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/acl/edit"));
|
||||
@RequestMapping(value = "/acl/edit")
|
||||
@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)));
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/acl/edit"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/acl/update")
|
||||
@Menu(type = "callcenter" , subtype = "acl" , access = false , admin = true)
|
||||
public ModelAndView pbxhostupdate(ModelMap map , HttpServletRequest request , @Valid Acl acl) {
|
||||
if(!StringUtils.isBlank(acl.getId())){
|
||||
Acl oldAcl = aclRes.findByIdAndOrgi(acl.getId(), super.getOrgi(request)) ;
|
||||
if(oldAcl!=null){
|
||||
oldAcl.setName(acl.getName());
|
||||
oldAcl.setDefaultvalue(acl.getDefaultvalue());
|
||||
oldAcl.setStrategy(acl.getStrategy());
|
||||
aclRes.save(oldAcl);
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/acl.html?hostid="+acl.getHostid()));
|
||||
@RequestMapping(value = "/acl/update")
|
||||
@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) {
|
||||
oldAcl.setName(acl.getName());
|
||||
oldAcl.setDefaultvalue(acl.getDefaultvalue());
|
||||
oldAcl.setStrategy(acl.getStrategy());
|
||||
aclRes.save(oldAcl);
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/acl.html?hostid=" + acl.getHostid()));
|
||||
}
|
||||
|
||||
@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) {
|
||||
if(!StringUtils.isBlank(id)){
|
||||
aclRes.delete(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/acl.html?hostid="+hostid));
|
||||
@RequestMapping(value = "/acl/delete")
|
||||
@Menu(type = "callcenter", subtype = "acl", admin = true)
|
||||
public ModelAndView acldelete(@Valid String id, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(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,73 +35,74 @@ import javax.validation.Valid;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
||||
public class CallCenterIvrController extends Handler{
|
||||
@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)
|
||||
public ModelAndView ivr(ModelMap map , HttpServletRequest request , @Valid String hostid) {
|
||||
if(!StringUtils.isBlank(hostid)){
|
||||
map.addAttribute("pbxHost" , pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
map.addAttribute("ivrList" , extentionRes.findByExtypeAndOrgi("ivr", super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/ivr/index"));
|
||||
@RequestMapping(value = "/ivr")
|
||||
@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)));
|
||||
map.addAttribute("ivrList", extentionRes.findByExtypeAndOrgi("ivr", super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/ivr/index"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/ivr/edit")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false , 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))) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/ivr/edit"));
|
||||
@RequestMapping(value = "/ivr/edit")
|
||||
@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)));
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/ivr/edit"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/ivr/update")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false , admin = true)
|
||||
public ModelAndView extentionupdate(ModelMap map , HttpServletRequest request , @Valid Extention extention) {
|
||||
if(!StringUtils.isBlank(extention.getId())){
|
||||
Extention ext = extentionRes.findByIdAndOrgi(extention.getId(), super.getOrgi(request)) ;
|
||||
ext.setExtention(extention.getExtention());
|
||||
ext.setDescription(extention.getDescription());
|
||||
extentionRes.save(ext) ;
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/ivr.html?hostid="+extention.getHostid()));
|
||||
@RequestMapping(value = "/ivr/update")
|
||||
@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());
|
||||
ext.setDescription(extention.getDescription());
|
||||
extentionRes.save(ext);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/ivr.html?hostid=" + extention.getHostid()));
|
||||
}
|
||||
|
||||
|
||||
@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) {
|
||||
if(!StringUtils.isBlank(id)){
|
||||
extentionRes.delete(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/ivr.html?hostid="+hostid));
|
||||
@RequestMapping(value = "/ivr/delete")
|
||||
@Menu(type = "callcenter", subtype = "ivr", access = false, admin = true)
|
||||
public ModelAndView extentiondelete(@Valid String id, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(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)
|
||||
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)));
|
||||
map.addAttribute("ivrMenuList" , ivrMenuRes.findByExtentionidAndHostidAndOrgi(id, hostid, super.getOrgi(request)));
|
||||
map.addAttribute("pbxHost" , pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/ivr/design"));
|
||||
@RequestMapping(value = "/ivr/design")
|
||||
@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)));
|
||||
map.addAttribute("ivrMenuList", ivrMenuRes.findByExtentionidAndHostidAndOrgi(id, hostid, super.getOrgi(request)));
|
||||
map.addAttribute("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/ivr/design"));
|
||||
}
|
||||
|
||||
@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) {
|
||||
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"));
|
||||
@RequestMapping(value = "/ivr/menu/add")
|
||||
@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,122 +38,129 @@ 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")
|
||||
public class CallCenterMediaController extends Handler{
|
||||
@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}")
|
||||
@Value("${web.upload-path}")
|
||||
private String path;
|
||||
|
||||
@RequestMapping(value = "/media")
|
||||
@Menu(type = "callcenter" , subtype = "callcentermedia" , access = false , admin = true)
|
||||
public ModelAndView media(ModelMap map , HttpServletRequest request , @Valid String hostid) {
|
||||
if(!StringUtils.isBlank(hostid)){
|
||||
map.addAttribute("pbxHost" , pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
map.addAttribute("mediaList" , mediaRes.findByHostidAndOrgi(hostid, super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/media/index"));
|
||||
@RequestMapping(value = "/media")
|
||||
@Menu(type = "callcenter", subtype = "callcentermedia", access = false, admin = true)
|
||||
public ModelAndView media(ModelMap map, HttpServletRequest request, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(hostid)) {
|
||||
map.addAttribute("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
map.addAttribute("mediaList", mediaRes.findByHostidAndOrgi(hostid, super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/media/index"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/media/add")
|
||||
@Menu(type = "callcenter" , subtype = "media" , access = false , admin = true)
|
||||
public ModelAndView mediaadd(ModelMap map , HttpServletRequest request , @Valid String hostid) {
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request))) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/media/add"));
|
||||
@RequestMapping(value = "/media/add")
|
||||
@Menu(type = "callcenter", subtype = "media", access = false, admin = true)
|
||||
public ModelAndView mediaadd(ModelMap map, HttpServletRequest request, @Valid String hostid) {
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/media/add"));
|
||||
}
|
||||
|
||||
@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 {
|
||||
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(".")) ;
|
||||
@RequestMapping(value = "/media/save")
|
||||
@Menu(type = "callcenter", subtype = "media", access = false, admin = true)
|
||||
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() + Objects.requireNonNull(mediafile.getOriginalFilename())
|
||||
.substring(mediafile.getOriginalFilename().lastIndexOf("."));
|
||||
|
||||
media.setOrgi(super.getOrgi(request));
|
||||
media.setCreater(super.getUser(request).getId());
|
||||
media.setFilelength((int) mediafile.getSize());
|
||||
media.setContent(mediafile.getContentType());
|
||||
media.setFilename(fileName);
|
||||
media.setOrgi(super.getOrgi(request));
|
||||
media.setCreater(super.getUser(request).getId());
|
||||
media.setFilelength((int) mediafile.getSize());
|
||||
media.setContent(mediafile.getContentType());
|
||||
media.setFilename(fileName);
|
||||
|
||||
if(mediafile!=null && mediafile.getOriginalFilename().lastIndexOf(".") > 0){
|
||||
File logoDir = new File(path , "media");
|
||||
if(!logoDir.exists()){
|
||||
logoDir.mkdirs() ;
|
||||
}
|
||||
FileCopyUtils.copy(mediafile.getBytes(), new File(path , fileName));
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
mediaRes.save(media) ;
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/media.html?hostid="+media.getHostid()));
|
||||
mediaRes.save(media);
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/media.html?hostid=" + media.getHostid()));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/media/edit")
|
||||
@Menu(type = "callcenter" , subtype = "media" , access = false , admin = true)
|
||||
public ModelAndView mediaedit(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String hostid) {
|
||||
map.addAttribute("media" , mediaRes.findByIdAndOrgi(id, super.getOrgi(request)));
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request))) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/media/edit"));
|
||||
@RequestMapping(value = "/media/edit")
|
||||
@Menu(type = "callcenter", subtype = "media", access = false, admin = true)
|
||||
public ModelAndView mediaedit(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String hostid) {
|
||||
map.addAttribute("media", mediaRes.findByIdAndOrgi(id, super.getOrgi(request)));
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/media/edit"));
|
||||
}
|
||||
|
||||
@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 {
|
||||
Media media = new Media();
|
||||
media.setName(request.getParameter("name"));
|
||||
media.setHostid(request.getParameter("hostid"));
|
||||
media.setId(request.getParameter("id"));
|
||||
if(!StringUtils.isBlank(media.getId())){
|
||||
Media oldMedia = mediaRes.findByIdAndOrgi(media.getId(), super.getOrgi(request)) ;
|
||||
if(oldMedia!=null){
|
||||
if(mediafile!=null && mediafile.getSize() > 0){
|
||||
File wavFile = new File(path , oldMedia.getFilename());
|
||||
if(!wavFile.exists()){
|
||||
wavFile.deleteOnExit();
|
||||
}
|
||||
@RequestMapping(value = "/media/update")
|
||||
@Menu(type = "callcenter", subtype = "media", access = false, admin = true)
|
||||
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"));
|
||||
media.setId(request.getParameter("id"));
|
||||
if (!StringUtils.isBlank(media.getId())) {
|
||||
Media oldMedia = mediaRes.findByIdAndOrgi(media.getId(), super.getOrgi(request));
|
||||
if (oldMedia != null) {
|
||||
if (mediafile != null && mediafile.getSize() > 0) {
|
||||
File wavFile = new File(path, oldMedia.getFilename());
|
||||
if (!wavFile.exists()) {
|
||||
wavFile.deleteOnExit();
|
||||
}
|
||||
|
||||
String fileName = "media/"+ MainUtils.getUUID()+mediafile.getOriginalFilename().substring(mediafile.getOriginalFilename().lastIndexOf(".")) ;
|
||||
oldMedia.setFilename(fileName);
|
||||
String fileName = "media/" + MainUtils.getUUID() + Objects.requireNonNull(mediafile.getOriginalFilename())
|
||||
.substring(mediafile.getOriginalFilename().lastIndexOf("."));
|
||||
oldMedia.setFilename(fileName);
|
||||
|
||||
if(mediafile!=null && mediafile.getOriginalFilename().lastIndexOf(".") > 0){
|
||||
File mediaDir = new File(path , "media");
|
||||
if(!mediaDir.exists()){
|
||||
mediaDir.mkdirs() ;
|
||||
}
|
||||
FileCopyUtils.copy(mediafile.getBytes(), new File(path , fileName));
|
||||
}
|
||||
}
|
||||
oldMedia.setName(media.getName());
|
||||
mediaRes.save(oldMedia);
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/media.html?hostid="+media.getHostid()));
|
||||
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));
|
||||
}
|
||||
}
|
||||
oldMedia.setName(media.getName());
|
||||
mediaRes.save(oldMedia);
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/media.html?hostid=" + media.getHostid()));
|
||||
}
|
||||
|
||||
@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) {
|
||||
if(!StringUtils.isBlank(id)){
|
||||
mediaRes.delete(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/media.html?hostid="+hostid));
|
||||
@RequestMapping(value = "/media/delete")
|
||||
@Menu(type = "callcenter", subtype = "media", access = false, admin = true)
|
||||
public ModelAndView mediadelete(@Valid String id, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(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) {
|
||||
map.addAttribute("media", mediaRes.findByIdAndOrgi(id, super.getOrgi(request))) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/media/play"));
|
||||
|
||||
@RequestMapping(value = "/play")
|
||||
@Menu(type = "callcenter", subtype = "play", access = false)
|
||||
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,11 +59,11 @@ 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",
|
||||
extentionRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
extentionRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createAdminTempletResponse("/admin/callcenter/resource/index"));
|
||||
}
|
||||
@ -71,18 +73,18 @@ 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",
|
||||
extentionRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
extentionRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/resource/config"));
|
||||
}
|
||||
|
||||
@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,11 +110,11 @@ 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",
|
||||
extentionRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
extentionRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createAdminTempletResponse("/admin/callcenter/resource/pbxhost"));
|
||||
}
|
||||
|
@ -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,101 +36,101 @@ import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
||||
public class CallCenterRouterController extends Handler{
|
||||
@RequiredArgsConstructor
|
||||
public class CallCenterRouterController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private PbxHostRepository pbxHostRes ;
|
||||
@NonNull
|
||||
private final PbxHostRepository pbxHostRes;
|
||||
|
||||
@NonNull
|
||||
private final RouterRulesRepository routerRulesRes;
|
||||
|
||||
|
||||
@Autowired
|
||||
private RouterRulesRepository routerRulesRes ;
|
||||
|
||||
|
||||
@RequestMapping(value = "/router")
|
||||
@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);
|
||||
if(pbxHostList.size() > 0){
|
||||
map.addAttribute("pbxHost" , pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
map.addAttribute("routerRulesList" , routerRulesRes.findByHostidAndOrgi(hostid, super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/peer/index"));
|
||||
@RequestMapping(value = "/router")
|
||||
@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);
|
||||
if (pbxHostList.size() > 0) {
|
||||
map.addAttribute("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
map.addAttribute("routerRulesList", routerRulesRes.findByHostidAndOrgi(hostid, super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/peer/index"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/router/add")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false , admin = true)
|
||||
public ModelAndView extentionadd(ModelMap map , HttpServletRequest request , @Valid String hostid) {
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request))) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/peer/add"));
|
||||
@RequestMapping(value = "/router/add")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView extentionadd(ModelMap map, HttpServletRequest request, @Valid String hostid) {
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/peer/add"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/router/save")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false , admin = true)
|
||||
public ModelAndView extentionsave(ModelMap map , HttpServletRequest request , @Valid RouterRules router) {
|
||||
if(!StringUtils.isBlank(router.getName())){
|
||||
int count = routerRulesRes.countByNameAndOrgi(router.getName(), super.getOrgi(request)) ;
|
||||
if(count == 0){
|
||||
router.setOrgi(super.getOrgi(request));
|
||||
router.setCreater(super.getUser(request).getId());
|
||||
routerRulesRes.save(router) ;
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/peer.html?hostid="+router.getHostid()));
|
||||
@RequestMapping(value = "/router/save")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
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) {
|
||||
router.setOrgi(super.getOrgi(request));
|
||||
router.setCreater(super.getUser(request).getId());
|
||||
routerRulesRes.save(router);
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/peer.html?hostid=" + router.getHostid()));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/router/edit")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false , admin = true)
|
||||
public ModelAndView routeredit(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String hostid) {
|
||||
map.addAttribute("routerRules" , routerRulesRes.findByIdAndOrgi(id, super.getOrgi(request)));
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request))) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/peer/edit"));
|
||||
@RequestMapping(value = "/router/edit")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView routeredit(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String hostid) {
|
||||
map.addAttribute("routerRules", routerRulesRes.findByIdAndOrgi(id, super.getOrgi(request)));
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/peer/edit"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/router/update")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false , admin = true)
|
||||
public ModelAndView pbxhostupdate(ModelMap map , HttpServletRequest request , @Valid RouterRules router) {
|
||||
if(!StringUtils.isBlank(router.getId())){
|
||||
RouterRules oldRouter = routerRulesRes.findByIdAndOrgi(router.getId(), super.getOrgi(request)) ;
|
||||
if(oldRouter!=null){
|
||||
oldRouter.setName(router.getName());
|
||||
oldRouter.setField(router.getField());
|
||||
oldRouter.setRegex(router.getRegex());
|
||||
oldRouter.setRouterinx(router.getRouterinx());
|
||||
oldRouter.setFalsebreak(router.isFalsebreak());
|
||||
routerRulesRes.save(oldRouter);
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/peer.html?hostid="+router.getHostid()));
|
||||
@RequestMapping(value = "/router/update")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
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) {
|
||||
oldRouter.setName(router.getName());
|
||||
oldRouter.setField(router.getField());
|
||||
oldRouter.setRegex(router.getRegex());
|
||||
oldRouter.setRouterinx(router.getRouterinx());
|
||||
oldRouter.setFalsebreak(router.isFalsebreak());
|
||||
routerRulesRes.save(oldRouter);
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/peer.html?hostid=" + router.getHostid()));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/router/code")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false , admin = true)
|
||||
public ModelAndView routercode(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String hostid) {
|
||||
map.addAttribute("routerRules" , routerRulesRes.findByIdAndOrgi(id, super.getOrgi(request)));
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request))) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/peer/code"));
|
||||
@RequestMapping(value = "/router/code")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView routercode(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String hostid) {
|
||||
map.addAttribute("routerRules", routerRulesRes.findByIdAndOrgi(id, super.getOrgi(request)));
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/peer/code"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/router/code/update")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false , admin = true)
|
||||
public ModelAndView routercodeupdate(ModelMap map , HttpServletRequest request , @Valid RouterRules router) {
|
||||
if(!StringUtils.isBlank(router.getId())){
|
||||
RouterRules oldRouter = routerRulesRes.findByIdAndOrgi(router.getId(), super.getOrgi(request)) ;
|
||||
if(!StringUtils.isBlank(router.getRoutercontent())){
|
||||
oldRouter.setRoutercontent(router.getRoutercontent());
|
||||
routerRulesRes.save(oldRouter);
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/peer.html?hostid="+router.getHostid()));
|
||||
@RequestMapping(value = "/router/code/update")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
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())) {
|
||||
oldRouter.setRoutercontent(router.getRoutercontent());
|
||||
routerRulesRes.save(oldRouter);
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/peer.html?hostid=" + router.getHostid()));
|
||||
}
|
||||
|
||||
@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) {
|
||||
if(!StringUtils.isBlank(id)){
|
||||
routerRulesRes.delete(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/peer.html?hostid="+hostid));
|
||||
@RequestMapping(value = "/router/delete")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView extentiondelete(@Valid String id, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(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,147 +40,150 @@ 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 ;
|
||||
if(pbxHostList.size() > 0){
|
||||
map.addAttribute("pbxHost" , pbxHost = getPbxHost(pbxHostList, hostid));
|
||||
map.addAttribute("skillGroups" , skillRes.findByHostidAndOrgi(pbxHost.getId() , super.getOrgi(request)));
|
||||
map.addAttribute("skillExtentionList" , skillExtentionRes.findByHostidAndOrgi(hostid, super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/skill/index"));
|
||||
@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;
|
||||
if (pbxHostList.size() > 0) {
|
||||
map.addAttribute("pbxHost", pbxHost = getPbxHost(pbxHostList, hostid));
|
||||
map.addAttribute("skillGroups", skillRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
map.addAttribute("skillExtentionList", skillExtentionRes.findByHostidAndOrgi(hostid, super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/skill/index"));
|
||||
}
|
||||
|
||||
private PbxHost getPbxHost(List<PbxHost> pbxHostList ,String hostid){
|
||||
PbxHost pbxHost = pbxHostList.get(0) ;
|
||||
if(!StringUtils.isBlank(hostid)){
|
||||
for(PbxHost pbx : pbxHostList){
|
||||
if(pbx.getId().equals(hostid)){
|
||||
pbxHost = pbx; break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return pbxHost ;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/skill/add")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false , admin = true)
|
||||
public ModelAndView extentionadd(ModelMap map , HttpServletRequest request , @Valid String hostid) {
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request))) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/skill/add"));
|
||||
private PbxHost getPbxHost(List<PbxHost> pbxHostList, String hostid) {
|
||||
PbxHost pbxHost = pbxHostList.get(0);
|
||||
if (!StringUtils.isBlank(hostid)) {
|
||||
for (PbxHost pbx : pbxHostList) {
|
||||
if (pbx.getId().equals(hostid)) {
|
||||
pbxHost = pbx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return pbxHost;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/skill/save")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false , admin = true)
|
||||
public ModelAndView extentionsave(ModelMap map , HttpServletRequest request , @Valid CallCenterSkill skill) {
|
||||
if(!StringUtils.isBlank(skill.getSkill())){
|
||||
int count = skillRes.countBySkillAndOrgi(skill.getSkill(), super.getOrgi(request)) ;
|
||||
if(count == 0){
|
||||
skill.setOrgi(super.getOrgi(request));
|
||||
skill.setCreater(super.getUser(request).getId());
|
||||
skillRes.save(skill) ;
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/skill.html?hostid="+skill.getHostid()));
|
||||
@RequestMapping(value = "/skill/add")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView extentionadd(ModelMap map, HttpServletRequest request, @Valid String hostid) {
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/skill/add"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/skill/edit")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false , 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))) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/skill/edit"));
|
||||
@RequestMapping(value = "/skill/save")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
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) {
|
||||
skill.setOrgi(super.getOrgi(request));
|
||||
skill.setCreater(super.getUser(request).getId());
|
||||
skillRes.save(skill);
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/skill.html?hostid=" + skill.getHostid()));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/skill/update")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false , admin = true)
|
||||
public ModelAndView pbxhostupdate(ModelMap map , 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}")){
|
||||
ext.setExtention(extention.getExtention());
|
||||
if(!StringUtils.isBlank(extention.getPassword())){
|
||||
ext.setPassword(extention.getPassword());
|
||||
}
|
||||
ext.setUpdatetime(new Date());
|
||||
extentionRes.save(ext) ;
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/skill.html?hostid="+extention.getHostid()));
|
||||
@RequestMapping(value = "/skill/edit")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, 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)));
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/skill/edit"));
|
||||
}
|
||||
|
||||
@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) {
|
||||
if(!StringUtils.isBlank(id)){
|
||||
extentionRes.delete(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/skill.html?hostid="+hostid));
|
||||
@RequestMapping(value = "/skill/update")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
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}")) {
|
||||
ext.setExtention(extention.getExtention());
|
||||
if (!StringUtils.isBlank(extention.getPassword())) {
|
||||
ext.setPassword(extention.getPassword());
|
||||
}
|
||||
ext.setUpdatetime(new Date());
|
||||
extentionRes.save(ext);
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/skill.html?hostid=" + extention.getHostid()));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/skill/imp")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false , admin = true)
|
||||
public ModelAndView skillimp(ModelMap map , HttpServletRequest request , @Valid String hostid) {
|
||||
if(!StringUtils.isBlank(hostid)){
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request))) ;
|
||||
map.put("extentionList", extentionRes.findByHostidAndOrgi(hostid, super.getOrgi(request))) ;
|
||||
map.addAttribute("skillGroups" , skillRes.findByHostidAndOrgi(hostid , super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/skill/imp"));
|
||||
@RequestMapping(value = "/skill/delete")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView extentiondelete(@Valid String id, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(id)) {
|
||||
extentionRes.deleteById(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/skill.html?hostid=" + hostid));
|
||||
}
|
||||
|
||||
@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) {
|
||||
if(!StringUtils.isBlank(id)){
|
||||
skillExtentionRes.delete(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/skill.html?hostid="+hostid));
|
||||
@RequestMapping(value = "/skill/imp")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView skillimp(ModelMap map, HttpServletRequest request, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(hostid)) {
|
||||
map.put("pbxHost", pbxHostRes.findByIdAndOrgi(hostid, super.getOrgi(request)));
|
||||
map.put("extentionList", extentionRes.findByHostidAndOrgi(hostid, super.getOrgi(request)));
|
||||
map.addAttribute("skillGroups", skillRes.findByHostidAndOrgi(hostid, super.getOrgi(request)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/callcenter/skill/imp"));
|
||||
}
|
||||
|
||||
@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) {
|
||||
if(exts!=null && exts.length > 0){
|
||||
List<SkillExtention> skillExtentionList = skillExtentionRes.findByHostidAndOrgi(hostid, super.getOrgi(request)) ;
|
||||
for(String ext :exts){
|
||||
SkillExtention skillExt = new SkillExtention() ;
|
||||
skillExt.setOrgi(super.getOrgi(request));
|
||||
skillExt.setCreater(super.getUser(request).getId());
|
||||
skillExt.setCreatetime(new Date());
|
||||
skillExt.setExtention(ext);
|
||||
skillExt.setHostid(hostid);
|
||||
skillExt.setSkillid(skillExtention.getSkillid());
|
||||
skillExt.setUpdatetime(new Date());
|
||||
boolean ingroup = false;
|
||||
for(SkillExtention temp : skillExtentionList){
|
||||
if(temp.getSkillid().equals(skillExt.getSkillid()) && temp.getExtention().equals(skillExt.getExtention())){
|
||||
ingroup = true ;
|
||||
}
|
||||
}
|
||||
if(ingroup == false){
|
||||
skillExtentionRes.save(skillExt) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/skill.html?hostid="+hostid));
|
||||
@RequestMapping(value = "/skill/extention/delete")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = false, admin = true)
|
||||
public ModelAndView skillextentiondelete(@Valid String id, @Valid String hostid) {
|
||||
if (!StringUtils.isBlank(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(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) {
|
||||
SkillExtention skillExt = new SkillExtention();
|
||||
skillExt.setOrgi(super.getOrgi(request));
|
||||
skillExt.setCreater(super.getUser(request).getId());
|
||||
skillExt.setCreatetime(new Date());
|
||||
skillExt.setExtention(ext);
|
||||
skillExt.setHostid(hostid);
|
||||
skillExt.setSkillid(skillExtention.getSkillid());
|
||||
skillExt.setUpdatetime(new Date());
|
||||
boolean ingroup = false;
|
||||
for (SkillExtention temp : skillExtentionList) {
|
||||
if (temp.getSkillid().equals(skillExt.getSkillid()) && temp.getExtention().equals(skillExt.getExtention())) {
|
||||
ingroup = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!ingroup) {
|
||||
skillExtentionRes.save(skillExt);
|
||||
}
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/skill.html?hostid=" + hostid));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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,150 +41,148 @@ import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/apps/callcenter")
|
||||
public class ExtentionController extends Handler{
|
||||
@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) {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/extention/index")) ;
|
||||
List<PbxHost> pbxHostList = pbxHostRes.findByHostnameOrIpaddr(hostname, hostname) ;
|
||||
PbxHost pbxHost = null ;
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig() ;
|
||||
if(pbxHostList!=null && pbxHostList.size() > 0){
|
||||
pbxHost = pbxHostList.get(0) ;
|
||||
map.addAttribute("pbxHost" , pbxHost);
|
||||
map.addAttribute("skillGroups" , skillRes.findByHostidAndOrgi(pbxHost.getId() , super.getOrgi(request)));
|
||||
map.addAttribute("extentionList" , extentionRes.findByHostidAndOrgi(pbxHost.getId() , super.getOrgi(request)));
|
||||
}
|
||||
if(systemConfig!=null && systemConfig.isCallcenter()){
|
||||
if(!StringUtils.isBlank(systemConfig.getCc_extention())){
|
||||
Template template = MainUtils.getTemplate(systemConfig.getCc_extention()) ;
|
||||
if(template!=null){
|
||||
map.addAttribute("template" , template);
|
||||
view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/template")) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return view ;
|
||||
@RequestMapping(value = "/extention")
|
||||
@Menu(type = "callcenter", subtype = "extention", access = true)
|
||||
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;
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig();
|
||||
if (pbxHostList != null && pbxHostList.size() > 0) {
|
||||
pbxHost = pbxHostList.get(0);
|
||||
map.addAttribute("pbxHost", pbxHost);
|
||||
map.addAttribute("skillGroups", skillRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
map.addAttribute("extentionList", extentionRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
}
|
||||
if (systemConfig != null && systemConfig.isCallcenter()) {
|
||||
if (!StringUtils.isBlank(systemConfig.getCc_extention())) {
|
||||
Template template = MainUtils.getTemplate(systemConfig.getCc_extention());
|
||||
if (template != null) {
|
||||
map.addAttribute("template", template);
|
||||
view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/template"));
|
||||
}
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
@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) {
|
||||
@RequestMapping(value = "/configuration")
|
||||
@Menu(type = "callcenter", subtype = "configuration", access = true)
|
||||
public ModelAndView configuration(ModelMap map, HttpServletRequest request, @Valid String hostname, @Valid String key_value) {
|
||||
|
||||
List<PbxHost> pbxHostList = pbxHostRes.findByHostnameOrIpaddr(hostname, hostname) ;
|
||||
PbxHost pbxHost = null ;
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig() ;
|
||||
if(pbxHostList!=null && pbxHostList.size() > 0){
|
||||
pbxHost = pbxHostList.get(0) ;
|
||||
map.addAttribute("pbxHost" , pbxHost);
|
||||
map.addAttribute("skillGroups" , skillRes.findByHostidAndOrgi(pbxHost.getId() , super.getOrgi(request)));
|
||||
map.addAttribute("skillExtentionList" , skillExtentionRes.findByHostidAndOrgi(pbxHost.getId() , super.getOrgi(request)));
|
||||
map.addAttribute("extentionList" , extentionRes.findByHostidAndOrgi(pbxHost.getId() , super.getOrgi(request)));
|
||||
map.addAttribute("aclList" , aclRes.findByHostidAndOrgi(pbxHost.getId() , super.getOrgi(request)));
|
||||
map.addAttribute("sipTrunkList" , sipTrunkRes.findByHostidAndOrgi(pbxHost.getId() , super.getOrgi(request)));
|
||||
}
|
||||
Template template = null ;
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/notfound"));
|
||||
if(key_value!=null && key_value.equals("callcenter.conf")){
|
||||
view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/configure/callcenter"));
|
||||
if(systemConfig!=null && systemConfig.isCallcenter()){
|
||||
if(!StringUtils.isBlank(systemConfig.getCc_quene())){
|
||||
template = MainUtils.getTemplate(systemConfig.getCc_quene()) ;
|
||||
}
|
||||
}
|
||||
}else if(key_value!=null && key_value.equals("acl.conf")){
|
||||
view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/configure/acl"));
|
||||
if(systemConfig!=null && systemConfig.isCallcenter()){
|
||||
if(!StringUtils.isBlank(systemConfig.getCc_acl())){
|
||||
template = MainUtils.getTemplate(systemConfig.getCc_acl()) ;
|
||||
}
|
||||
}
|
||||
}else if(key_value!=null && key_value.equals("ivr.conf")){
|
||||
view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/configure/ivr"));
|
||||
if(systemConfig!=null && systemConfig.isCallcenter()){
|
||||
if(!StringUtils.isBlank(systemConfig.getCc_ivr())){
|
||||
template = MainUtils.getTemplate(systemConfig.getCc_ivr()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(template!=null){
|
||||
map.addAttribute("template" , template);
|
||||
view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/template")) ;
|
||||
}
|
||||
return view;
|
||||
List<PbxHost> pbxHostList = pbxHostRes.findByHostnameOrIpaddr(hostname, hostname);
|
||||
PbxHost pbxHost;
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig();
|
||||
if (pbxHostList != null && pbxHostList.size() > 0) {
|
||||
pbxHost = pbxHostList.get(0);
|
||||
map.addAttribute("pbxHost", pbxHost);
|
||||
map.addAttribute("skillGroups", skillRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
map.addAttribute("skillExtentionList", skillExtentionRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
map.addAttribute("extentionList", extentionRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
map.addAttribute("aclList", aclRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
map.addAttribute("sipTrunkList", sipTrunkRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
}
|
||||
Template template = null;
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/notfound"));
|
||||
if (key_value != null && key_value.equals("callcenter.conf")) {
|
||||
view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/configure/callcenter"));
|
||||
if (systemConfig != null && systemConfig.isCallcenter()) {
|
||||
if (!StringUtils.isBlank(systemConfig.getCc_quene())) {
|
||||
template = MainUtils.getTemplate(systemConfig.getCc_quene());
|
||||
}
|
||||
}
|
||||
} else if (key_value != null && key_value.equals("acl.conf")) {
|
||||
view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/configure/acl"));
|
||||
if (systemConfig != null && systemConfig.isCallcenter()) {
|
||||
if (!StringUtils.isBlank(systemConfig.getCc_acl())) {
|
||||
template = MainUtils.getTemplate(systemConfig.getCc_acl());
|
||||
}
|
||||
}
|
||||
} else if (key_value != null && key_value.equals("ivr.conf")) {
|
||||
view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/configure/ivr"));
|
||||
if (systemConfig != null && systemConfig.isCallcenter()) {
|
||||
if (!StringUtils.isBlank(systemConfig.getCc_ivr())) {
|
||||
template = MainUtils.getTemplate(systemConfig.getCc_ivr());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (template != null) {
|
||||
map.addAttribute("template", template);
|
||||
view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/template"));
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/dialplan")
|
||||
@Menu(type = "callcenter" , subtype = "dialplan" , access = true)
|
||||
public ModelAndView dialplan(ModelMap map , HttpServletRequest request , @Valid String hostname , @Valid String key_value) {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/dialplan/index"));
|
||||
List<PbxHost> pbxHostList = pbxHostRes.findByHostnameOrIpaddr(hostname, hostname) ;
|
||||
PbxHost pbxHost = null ;
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig() ;
|
||||
Template template = null ;
|
||||
if(pbxHostList!=null && pbxHostList.size() > 0){
|
||||
pbxHost = pbxHostList.get(0) ;
|
||||
map.addAttribute("pbxHost" , pbxHost);
|
||||
map.addAttribute("routerList" , routerRes.findByHostidAndOrgi(pbxHost.getId() , super.getOrgi(request)));
|
||||
}
|
||||
if(systemConfig!=null && systemConfig.isCallcenter()){
|
||||
if(!StringUtils.isBlank(systemConfig.getCc_siptrunk())){
|
||||
template = MainUtils.getTemplate(systemConfig.getCc_router()) ;
|
||||
}
|
||||
if(template!=null){
|
||||
map.addAttribute("template" , template);
|
||||
view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/template")) ;
|
||||
}
|
||||
}
|
||||
@RequestMapping(value = "/dialplan")
|
||||
@Menu(type = "callcenter", subtype = "dialplan", access = true)
|
||||
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;
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig();
|
||||
Template template = null;
|
||||
if (pbxHostList != null && pbxHostList.size() > 0) {
|
||||
pbxHost = pbxHostList.get(0);
|
||||
map.addAttribute("pbxHost", pbxHost);
|
||||
map.addAttribute("routerList", routerRes.findByHostidAndOrgi(pbxHost.getId(), super.getOrgi(request)));
|
||||
}
|
||||
if (systemConfig != null && systemConfig.isCallcenter()) {
|
||||
if (!StringUtils.isBlank(systemConfig.getCc_siptrunk())) {
|
||||
template = MainUtils.getTemplate(systemConfig.getCc_router());
|
||||
}
|
||||
if (template != null) {
|
||||
map.addAttribute("template", template);
|
||||
view = request(super.createRequestPageTempletResponse("/apps/business/callcenter/template"));
|
||||
}
|
||||
}
|
||||
|
||||
return view;
|
||||
return view;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/extention/detail")
|
||||
@Menu(type = "callcenter" , subtype = "extention" , access = false)
|
||||
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);
|
||||
}
|
||||
}
|
||||
map.addAttribute("extention" , extention);
|
||||
}
|
||||
response.setContentType("Content-type: text/json; charset=utf-8");
|
||||
return request(super.createRequestPageTempletResponse("/apps/business/callcenter/extention/detail"));
|
||||
@RequestMapping(value = "/extention/detail")
|
||||
@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())) {
|
||||
pbxHostRes.findById(extention.getHostid()).ifPresent(it -> map.addAttribute("pbxhost", it));
|
||||
}
|
||||
map.addAttribute("extention", extention);
|
||||
}
|
||||
response.setContentType("Content-type: text/json; charset=utf-8");
|
||||
return request(super.createRequestPageTempletResponse("/apps/business/callcenter/extention/detail"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/ivr")
|
||||
@Menu(type = "callcenter" , subtype = "ivr" , access = false)
|
||||
public ModelAndView ivr(ModelMap map , HttpServletRequest request , HttpServletResponse response ,@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"));
|
||||
@RequestMapping(value = "/ivr")
|
||||
@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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,11 +23,14 @@ import java.util.List;
|
||||
|
||||
public interface PbxHostRepository extends JpaRepository<PbxHost, String> {
|
||||
|
||||
PbxHost findByIdAndOrgi(String id, String orgi);
|
||||
PbxHost findById(String id);
|
||||
List<PbxHost> findByOrgi(String orgi);
|
||||
List<PbxHost> findByHostnameOrIpaddr(String hostname, String ip);
|
||||
PbxHost findByIdAndOrgi(String id, String orgi);
|
||||
|
||||
int countByHostnameAndOrgi(String hostname, String orgi) ;
|
||||
// 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