|
@@ -1254,6 +1254,82 @@ public class ApiController extends BaseController {
|
|
|
{
|
|
{
|
|
|
return AjaxResult.success(ccExtNumService.selectUnBindCcExtNumList());
|
|
return AjaxResult.success(ccExtNumService.selectUnBindCcExtNumList());
|
|
|
}
|
|
}
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询未绑定的分机管理列表分页
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/extnum/selectUnBindCcExtNumListPage")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public TableDataInfo selectUnBindCcExtNumListPage(@RequestBody CcExtNum ccExtNum)
|
|
|
|
|
+ {
|
|
|
|
|
+ Integer pageNum = ccExtNum.getPageNum() != null ? ccExtNum.getPageNum().intValue() : 1;
|
|
|
|
|
+ Integer pageSize = ccExtNum.getPageSize() != null ? ccExtNum.getPageSize().intValue() : 10;
|
|
|
|
|
+ startPage(pageNum, pageSize);
|
|
|
|
|
+ List<CcExtNum> list = ccExtNumService.selectUnBindCcExtNumListPage(ccExtNum);
|
|
|
|
|
+ return getDataTable(list);
|
|
|
|
|
+ }
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通用查询分机列表分页
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/extnumPage")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public TableDataInfo extnumPage(@RequestBody CcExtNum ccExtNum)
|
|
|
|
|
+ {
|
|
|
|
|
+ Integer pageNum = ccExtNum.getPageNum() != null ? ccExtNum.getPageNum().intValue() : 1;
|
|
|
|
|
+ Integer pageSize = ccExtNum.getPageSize() != null ? ccExtNum.getPageSize().intValue() : 10;
|
|
|
|
|
+ startPage(pageNum, pageSize);
|
|
|
|
|
+ List<CcExtNum> list = ccExtNumService.selectCcExtNumList(ccExtNum);
|
|
|
|
|
+ if(!CollectionUtils.isEmpty(list)){
|
|
|
|
|
+ list.forEach(extNum -> {
|
|
|
|
|
+ if(StringUtils.isNotBlank(extNum.getUserCode()) && extNum.getUserCode().startsWith("Runtian_")){
|
|
|
|
|
+ extNum.setUserCode("");
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ return getDataTable(list);
|
|
|
|
|
+ }
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 新增企业绑定未使用的分机(实际只是公司占位,需销售来绑定)
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/companyBindExtNum")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ public AjaxResult companyBindExtNum(@RequestBody Map<String,String> param)
|
|
|
|
|
+ {
|
|
|
|
|
+ String companyName = param.get("companyName");
|
|
|
|
|
+ String sipExtNumIds = param.get("sipExtNumIds");
|
|
|
|
|
+ if(StringUtils.isBlank(companyName) || StringUtils.isBlank(sipExtNumIds)){
|
|
|
|
|
+ return AjaxResult.error("参数companyName或sipExtNumIds缺失");
|
|
|
|
|
+ }
|
|
|
|
|
+ //公司绑定分机
|
|
|
|
|
+ List<Long> extNumList = Arrays.stream(sipExtNumIds.split(","))
|
|
|
|
|
+ .map(String::trim)
|
|
|
|
|
+ .filter(StringUtils::isNotBlank)
|
|
|
|
|
+ .map(Long::parseLong)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ CcExtNum extNum = new CcExtNum();
|
|
|
|
|
+ extNum.setUserCode(companyName);
|
|
|
|
|
+ extNum.setSipExtNumList(extNumList);
|
|
|
|
|
+ return toAjax(ccExtNumService.updateCompanyBindExtNum(extNum));
|
|
|
|
|
+ }
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 删除企业绑定的分机(销售已绑无法清除)
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/companyUnbindExtNum")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public AjaxResult companyUnbindExtNum(@RequestBody Map<String,String> param)
|
|
|
|
|
+ {
|
|
|
|
|
+ String userCodes = param.get("userCodes");
|
|
|
|
|
+ if(StringUtils.isBlank(userCodes)){
|
|
|
|
|
+ return AjaxResult.error("参数userCodes缺失");
|
|
|
|
|
+ }
|
|
|
|
|
+ List<String> userCodeList = Arrays.stream(userCodes.split(","))
|
|
|
|
|
+ .map(String::trim)
|
|
|
|
|
+ .filter(StringUtils::isNotBlank)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ return toAjax(ccExtNumService.companyUnbindExtNum(userCodeList));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 新增用户且绑定未使用的分机返回用户
|
|
* 新增用户且绑定未使用的分机返回用户
|
|
|
*/
|
|
*/
|
|
@@ -1262,30 +1338,50 @@ public class ApiController extends BaseController {
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public AjaxResult addUserOrBindExtNumReturnUser(@RequestBody SysUser user)
|
|
public AjaxResult addUserOrBindExtNumReturnUser(@RequestBody SysUser user)
|
|
|
{
|
|
{
|
|
|
|
|
+ log.info("新增用户请求 - 用户名:{}, 密码:{}, 分机号:{}", user.getLoginName(), user.getPassword(), user.getExtNum());
|
|
|
|
|
+ if(StringUtils.isBlank(user.getPassword())){
|
|
|
|
|
+ throw new RuntimeException("密码不能为空");
|
|
|
|
|
+ }
|
|
|
if (!userService.checkLoginNameUnique(user))
|
|
if (!userService.checkLoginNameUnique(user))
|
|
|
{
|
|
{
|
|
|
- throw new RuntimeException("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
|
|
|
|
|
|
+ throw new RuntimeException("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
|
|
}
|
|
}
|
|
|
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
|
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
|
|
{
|
|
{
|
|
|
- throw new RuntimeException("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
|
|
|
|
|
|
+ throw new RuntimeException("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 校验分机号是否为空
|
|
|
|
|
+ if (null == user.getExtNum()) {
|
|
|
|
|
+ throw new RuntimeException("新增用户失败,分机号不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 校验分机号是否存在
|
|
|
|
|
+ CcExtNum extNum = ccExtNumService.selectCcExtNumByExtNum(user.getExtNum());
|
|
|
|
|
+ if (null == extNum) {
|
|
|
|
|
+ throw new RuntimeException("新增用户失败,分机号" + user.getExtNum() + "不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 校验分机号是否已被绑定
|
|
|
|
|
+ if (StringUtils.isNotEmpty(extNum.getUserCode())) {
|
|
|
|
|
+ throw new RuntimeException("新增用户失败,分机号" + user.getExtNum() + "已被用户" + extNum.getUserCode() + "绑定");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
user.setSalt(ShiroUtils.randomSalt());
|
|
user.setSalt(ShiroUtils.randomSalt());
|
|
|
|
|
+ String plainPassword = user.getPassword();
|
|
|
|
|
+
|
|
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
|
|
|
|
+
|
|
|
user.setPwdUpdateDate(DateUtils.getNowDate());
|
|
user.setPwdUpdateDate(DateUtils.getNowDate());
|
|
|
user.setCreateBy("ylrz");
|
|
user.setCreateBy("ylrz");
|
|
|
int i = userService.insertUser(user);
|
|
int i = userService.insertUser(user);
|
|
|
if(i>0){
|
|
if(i>0){
|
|
|
//绑定分机
|
|
//绑定分机
|
|
|
- if (StringUtils.isNotEmpty(user.getLoginName())) {
|
|
|
|
|
- CcExtNum extNum = ccExtNumService.selectCcExtNumByExtNum(user.getExtNum());
|
|
|
|
|
- if (null != extNum) {
|
|
|
|
|
- extNum.setUserCode(user.getLoginName());
|
|
|
|
|
- int num = ccExtNumService.updateCcExtNum(extNum);
|
|
|
|
|
- if(num>0){
|
|
|
|
|
- return AjaxResult.success(user);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ extNum.setUserCode(user.getLoginName());
|
|
|
|
|
+ int num = ccExtNumService.updateCcExtNum(extNum);
|
|
|
|
|
+ if(num>0){
|
|
|
|
|
+ user.setExtPass(extNum.getExtPass());
|
|
|
|
|
+ log.info("新增用户成功,用户名:{},分机号:{}", user.getLoginName(), user.getExtNum());
|
|
|
|
|
+ return AjaxResult.success(user);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new RuntimeException("新增用户成功,但分机号绑定失败");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
throw new RuntimeException("新增用户失败");
|
|
throw new RuntimeException("新增用户失败");
|
|
@@ -1620,7 +1716,17 @@ public class ApiController extends BaseController {
|
|
|
if(callPhoneIds==null){
|
|
if(callPhoneIds==null){
|
|
|
return AjaxResult.error(AjaxResult.Type.INVALID_PARAM, "callPhoneIds不能为空!", "");
|
|
return AjaxResult.error(AjaxResult.Type.INVALID_PARAM, "callPhoneIds不能为空!", "");
|
|
|
}
|
|
}
|
|
|
- return AjaxResult.success(ccCallPhoneService.selectCcCallPhoneListByIds(callPhoneIds));
|
|
|
|
|
|
|
+ List<CcCallPhone> list = ccCallPhoneService.selectCcCallPhoneListByIds(callPhoneIds);
|
|
|
|
|
+ if(!CollectionUtils.isEmpty(list)){
|
|
|
|
|
+ //处理下大字段不要传输
|
|
|
|
|
+ list.forEach(callPhoneRecord -> {
|
|
|
|
|
+ callPhoneRecord.setDialogue(null);
|
|
|
|
|
+ callPhoneRecord.setBizJson(null);
|
|
|
|
|
+ callPhoneRecord.setRecordServerUrl(null);
|
|
|
|
|
+ callPhoneRecord.setIvrDtmfDigits( null);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ return AjaxResult.success(list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1646,4 +1752,26 @@ public class ApiController extends BaseController {
|
|
|
return toAjax(ccCallTaskService.updateCcCallTask(ccCallTask));
|
|
return toAjax(ccCallTaskService.updateCcCallTask(ccCallTask));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取音色分页列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/voicecodePage")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public TableDataInfo voicecodePage(@RequestBody CcTtsAliyun queryParams)
|
|
|
|
|
+ {
|
|
|
|
|
+ if(queryParams==null){
|
|
|
|
|
+ queryParams = new CcTtsAliyun();
|
|
|
|
|
+ }
|
|
|
|
|
+ if(queryParams.getPageNum()==null){
|
|
|
|
|
+ queryParams.setPageNum(1);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(queryParams.getPageSize()== null){
|
|
|
|
|
+ queryParams.setPageSize(10);
|
|
|
|
|
+ }
|
|
|
|
|
+ startPage(queryParams.getPageNum(), queryParams.getPageSize());
|
|
|
|
|
+ // 获取音色列表
|
|
|
|
|
+ List<CcTtsAliyun> list = ccTtsAliyunService.selectCcTtsAliyunList(queryParams);
|
|
|
|
|
+
|
|
|
|
|
+ return getDataTable(list);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|