Explorar el Código

update:外呼

ct hace 1 semana
padre
commit
405691ce34
Se han modificado 21 ficheros con 273 adiciones y 164 borrados
  1. 1 1
      fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceCallerController.java
  2. 3 1
      fs-admin/src/main/java/com/fs/store/controller/FsStoreOrderController.java
  3. 5 4
      fs-company-app/src/main/java/com/fs/app/controller/VoiceApiController.java
  4. 4 4
      fs-company-app/src/main/resources/application.yml
  5. 6 2
      fs-company/src/main/java/com/fs/company/controller/CompanyProfileController.java
  6. 63 77
      fs-company/src/main/java/com/fs/company/controller/CompanyUserController.java
  7. 27 4
      fs-company/src/main/java/com/fs/company/controller/CompanyVoiceApiController.java
  8. 23 8
      fs-company/src/main/java/com/fs/company/controller/CompanyVoiceCallerController.java
  9. 1 1
      fs-company/src/main/java/com/fs/crm/controller/CrmCustomerController.java
  10. 3 3
      fs-service-system/src/main/java/com/fs/company/domain/CompanyUser.java
  11. 14 1
      fs-service-system/src/main/java/com/fs/company/domain/CompanyVoiceCaller.java
  12. 8 28
      fs-service-system/src/main/java/com/fs/company/mapper/CompanyVoiceCallerMapper.java
  13. 3 0
      fs-service-system/src/main/java/com/fs/company/param/CompanyVoiceCallerImportParam.java
  14. 1 1
      fs-service-system/src/main/java/com/fs/company/param/CompanyVoiceCallerParam.java
  15. 2 2
      fs-service-system/src/main/java/com/fs/company/service/ICompanyVoiceCallerService.java
  16. 26 9
      fs-service-system/src/main/java/com/fs/company/service/impl/CompanyVoiceCallerServiceImpl.java
  17. 2 0
      fs-service-system/src/main/java/com/fs/company/vo/CompanyVoiceCallerListVO.java
  18. 4 4
      fs-service-system/src/main/java/com/fs/voice/service/IVoiceService.java
  19. 26 13
      fs-service-system/src/main/java/com/fs/voice/service/impl/VoiceServiceImpl.java
  20. 2 0
      fs-service-system/src/main/resources/application-common.yml
  21. 49 1
      fs-service-system/src/main/resources/mapper/company/CompanyVoiceCallerMapper.xml

+ 1 - 1
fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceCallerController.java

@@ -119,7 +119,7 @@ public class CompanyVoiceCallerController extends BaseController
     }
 
 
-    @Log(title = "导入线索客户", businessType = BusinessType.IMPORT)
+    @Log(title = "导入分机号", businessType = BusinessType.IMPORT)
     @PreAuthorize("@ss.hasPermi('company:companyVoiceCaller:import')")
     @PostMapping("/importData")
     public AjaxResult importLineData(MultipartFile file) throws Exception

+ 3 - 1
fs-admin/src/main/java/com/fs/store/controller/FsStoreOrderController.java

@@ -338,7 +338,9 @@ public class FsStoreOrderController extends BaseController {
         order.setUserPhone(ParseUtils.parsePhone(order.getUserPhone()));
         order.setUserAddress(ParseUtils.parseAddress(order.getUserAddress()));
         FsUser user = userService.selectFsUserById(order.getUserId());
-        user.setPhone(ParseUtils.parsePhone(user.getPhone()));
+        if (user != null) {
+            user.setPhone(ParseUtils.parsePhone(user.getPhone()));
+        }
         FsStoreOrderItem itemMap = new FsStoreOrderItem();
         itemMap.setOrderId(order.getId());
         List<FsStoreOrderItem> items = orderItemService.selectFsStoreOrderItemList(itemMap);

+ 5 - 4
fs-company-app/src/main/java/com/fs/app/controller/VoiceApiController.java

@@ -80,14 +80,15 @@ public class VoiceApiController extends AppBaseController {
     @RepeatSubmit
     public R callMobile(HttpServletRequest request,
                         @ApiParam(required = false, name = "mobile", value = "被叫号") @RequestParam(value = "mobile", required = false) String mobile,
-                        @ApiParam(required = false, name = "customerId", value = "客户ID") @RequestParam(value = "customerId", required = false) Long customerId
+                        @ApiParam(required = false, name = "customerId", value = "客户ID") @RequestParam(value = "customerId", required = false) Long customerId,
+                        @ApiParam(required = false, name = "callerId", value = "线路接口id") @RequestParam(value = "callerId", required = false) Long callerId
     ) throws Exception
     {
         String headValue = request.getHeader("APPToken");
         Claims claims = jwtUtils.getClaimByToken(headValue);
         Long userId =Long.parseLong( claims.getSubject().toString());
         CompanyUser user=companyUserService.selectCompanyUserById(userId);
-        return voiceService.voiceAppCall(user.getCompanyId(),customerId,user.getUserId(), mobile);
+        return voiceService.voiceAppCall(user.getCompanyId(),customerId,user.getUserId(), mobile,callerId);
     }
 
     @ApiOperation("外呼挂断")
@@ -163,11 +164,11 @@ public class VoiceApiController extends AppBaseController {
     @Login
     @ApiOperation("获取SIP")
     @GetMapping(value="/getSipAccount")
-    public R getSipAccount() throws Exception
+    public R getSipAccount(@RequestParam(value = "callerId",required = false) Long callerId) throws Exception
     {
 
         String userId=getUserId();
-        return voiceService.getSipAccount(Long.parseLong(userId));
+        return voiceService.getSipAccount(Long.parseLong(userId),callerId);
     }
 
 

+ 4 - 4
fs-company-app/src/main/resources/application.yml

@@ -4,7 +4,7 @@ server:
 
 spring:
   profiles:
-#    active: dev
-#    include: common,config-dev
-    active: druid-fby
-    include: common,config-fby
+    active: dev
+    include: common,config-dev
+#    active: druid-fby
+#    include: common,config-fby

+ 6 - 2
fs-company/src/main/java/com/fs/company/controller/CompanyProfileController.java

@@ -22,6 +22,8 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 个人信息
@@ -48,9 +50,11 @@ public class CompanyProfileController extends BaseController
     {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         CompanyUser user = loginUser.getUser();
-        CompanyVoiceCaller companyVoiceCaller = callerService.selectCompanyVoiceCallerByUserId(user.getCompanyId(), user.getUserId());
+        List<CompanyVoiceCaller> companyVoiceCaller = callerService.selectCompanyVoiceCallerByUserId(user.getCompanyId(), user.getUserId(),null);
         if (companyVoiceCaller != null) {
-            user.setCallerNo(companyVoiceCaller.getCallerNo());
+            ArrayList<String> list = new ArrayList<>();
+            companyVoiceCaller.forEach(caller -> list.add(caller.getCallerNo()));
+            user.setCallerNo(list);
         }
         AjaxResult ajax = AjaxResult.success(user);
         ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));

+ 63 - 77
fs-company/src/main/java/com/fs/company/controller/CompanyUserController.java

@@ -31,6 +31,7 @@ import com.fs.system.oss.OSSFactory;
 import com.fs.system.service.ISysConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -47,8 +48,7 @@ import java.util.stream.Collectors;
  */
 @RestController
 @RequestMapping("/company/user")
-public class CompanyUserController extends BaseController
-{
+public class CompanyUserController extends BaseController {
 
     @Autowired
     private ICompanyRoleService roleService;
@@ -73,8 +73,7 @@ public class CompanyUserController extends BaseController
      * 获取用户列表
      */
     @GetMapping("/list")
-    public TableDataInfo list(CompanyUser user)
-    {
+    public TableDataInfo list(CompanyUser user) {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         user.setCompanyId(loginUser.getCompany().getCompanyId());
         startPage();
@@ -83,8 +82,7 @@ public class CompanyUserController extends BaseController
     }
 
     @GetMapping("/qwList")
-    public TableDataInfo qwList(CompanyUserQwParam user)
-    {
+    public TableDataInfo qwList(CompanyUserQwParam user) {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         user.setCompanyId(loginUser.getCompany().getCompanyId());
         startPage();
@@ -94,50 +92,48 @@ public class CompanyUserController extends BaseController
 
     @PostMapping("/common/uploadOSS")
     public R uploadOSS(@RequestParam("file") MultipartFile file,
-                       @RequestParam("userId") String userId) throws Exception
-    {
+                       @RequestParam("userId") String userId) throws Exception {
         String url = companyUserService.uploadQrCode(file, userId);
-        return R.ok().put("url",url);
+        return R.ok().put("url", url);
     }
+
     @GetMapping("/getUserList")
-    public R getUserList()
-    {
+    public R getUserList() {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
-        CompanyUser map=new CompanyUser();
+        CompanyUser map = new CompanyUser();
         map.setCompanyId(loginUser.getCompany().getCompanyId());
         List<CompanyUser> list = companyUserService.selectCompanyUserList(map);
-        return  R.ok().put("data",list);
+        return R.ok().put("data", list);
     }
 
     @GetMapping("/getQwUserList")
-    public R getQwUserList()
-    {
+    public R getQwUserList() {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         List<CompanyUser> list = companyUserService.selectCompanyNoQwUserList(loginUser.getCompany().getCompanyId());
-        return  R.ok().put("data",list);
+        return R.ok().put("data", list);
     }
+
     @GetMapping("/getQwAllUserList/{id}")
-    public R getQwAllUserList(@PathVariable("id") String corpId)
-    {
+    public R getQwAllUserList(@PathVariable("id") String corpId) {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
 
-        List<QwUserVO> list = companyUserService.selectCompanyQwUserList(corpId,loginUser.getCompany().getCompanyId());
-        return  R.ok().put("data",list);
+        List<QwUserVO> list = companyUserService.selectCompanyQwUserList(corpId, loginUser.getCompany().getCompanyId());
+        return R.ok().put("data", list);
     }
+
     @GetMapping("/getList")
-    public TableDataInfo getList(CompanyUser user)
-    {
+    public TableDataInfo getList(CompanyUser user) {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         user.setCompanyId(loginUser.getCompany().getCompanyId());
         startPage();
         List<CompanyUser> list = companyUserService.selectCompanyUserList(user);
         return getDataTable(list);
     }
+
     @Log(title = "用户管理", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('company:user:export')")
     @GetMapping("/export")
-    public AjaxResult export(CompanyUser user)
-    {
+    public AjaxResult export(CompanyUser user) {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         user.setCompanyId(loginUser.getCompany().getCompanyId());
         List<CompanyUser> list = companyUserService.selectCompanyUserList(user);
@@ -146,28 +142,25 @@ public class CompanyUserController extends BaseController
     }
 
 
-
     /**
      * 根据用户编号获取详细信息
      */
     @PreAuthorize("@ss.hasPermi('company:user:query')")
-    @GetMapping(value = { "/", "/{userId}" })
-    public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
-    {
+    @GetMapping(value = {"/", "/{userId}"})
+    public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) {
         AjaxResult ajax = AjaxResult.success();
-        CompanyRole companyRoleMap=new CompanyRole();
+        CompanyRole companyRoleMap = new CompanyRole();
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         companyRoleMap.setCompanyId(loginUser.getCompany().getCompanyId());
         List<CompanyRole> roles = roleService.selectCompanyRoleList(companyRoleMap);
 
-        ajax.put("roles", CompanyUser.isAdmin(loginUser.getUser().getUserType()) ? roles : roles.stream().filter(r -> r.getRoleKey()!="admin").collect(Collectors.toList()));
+        ajax.put("roles", CompanyUser.isAdmin(loginUser.getUser().getUserType()) ? roles : roles.stream().filter(r -> r.getRoleKey() != "admin").collect(Collectors.toList()));
 
-        CompanyPost postMap=new CompanyPost();
+        CompanyPost postMap = new CompanyPost();
         postMap.setCompanyId(loginUser.getCompany().getCompanyId());
         ajax.put("posts", postService.selectCompanyPostList(postMap));
-        if (StringUtils.isNotNull(userId))
-        {
-            CompanyUser companyUser=companyUserService.selectCompanyUserById(userId);
+        if (StringUtils.isNotNull(userId)) {
+            CompanyUser companyUser = companyUserService.selectCompanyUserById(userId);
             ajax.put(AjaxResult.DATA_TAG, companyUser);
             ajax.put("postIds", postService.selectPostListByUserId(userId));
             ajax.put("roleIds", roleService.selectRoleListByUserId(userId));
@@ -183,22 +176,20 @@ public class CompanyUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('company:user:add')")
     @Log(title = "用户管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody CompanyUser user)
-    {
+    public AjaxResult add(@Validated @RequestBody CompanyUser user) {
         if (!PatternUtils.checkPassword(user.getPassword())) {
             return AjaxResult.error("密码格式不正确,需包含字母、数字和特殊字符,长度为 8-20 位");
         }
 
         //判断用户数量是否已达到上线
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
-        Integer count=companyUserService.selectCompanyUserCountByCompanyId(loginUser.getCompany().getCompanyId());
-        Company company=companyService.selectCompanyById(loginUser.getCompany().getCompanyId());
-        if(count>company.getLimitUserCount()){
+        Integer count = companyUserService.selectCompanyUserCountByCompanyId(loginUser.getCompany().getCompanyId());
+        Company company = companyService.selectCompanyById(loginUser.getCompany().getCompanyId());
+        if (count > company.getLimitUserCount()) {
             return AjaxResult.error("用户数量已达到上限");
         }
         user.setCompanyId(loginUser.getCompany().getCompanyId());
-        if (UserConstants.NOT_UNIQUE.equals(String.valueOf(companyUserService.checkUserName(user.getUserName()))))
-        {
+        if (UserConstants.NOT_UNIQUE.equals(String.valueOf(companyUserService.checkUserName(user.getUserName())))) {
             return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
         }
         user.setCreateBy(SecurityUtils.getUsername());
@@ -214,8 +205,7 @@ public class CompanyUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('company:user:edit')")
     @Log(title = "用户管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody CompanyUser user)
-    {
+    public AjaxResult edit(@Validated @RequestBody CompanyUser user) {
         user.setUpdateBy(SecurityUtils.getUsername());
         return toAjax(companyUserService.updateUser(user));
     }
@@ -228,7 +218,7 @@ public class CompanyUserController extends BaseController
         CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
 
         // 生成二级域名
-        String subDomain =  "http://"+DomainUtil.generateSubDomain(config.getCourseDomainName(), 6, String.valueOf(SecurityUtils.getLoginUser().getUser().getUserId()));
+        String subDomain = "http://" + DomainUtil.generateSubDomain(config.getCourseDomainName(), 6, String.valueOf(SecurityUtils.getLoginUser().getUser().getUserId()));
 
         AjaxResult result = AjaxResult.success();
         result.put("data", subDomain);
@@ -241,8 +231,7 @@ public class CompanyUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('company:user:remove')")
     @Log(title = "用户管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{userIds}")
-    public AjaxResult remove(@PathVariable Long[] userIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] userIds) {
         return toAjax(companyUserService.deleteCompanyUserByIds(userIds));
     }
 
@@ -252,8 +241,7 @@ public class CompanyUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('company:user:edit')")
     @Log(title = "用户管理", businessType = BusinessType.UPDATE)
     @PutMapping("/resetPwd")
-    public AjaxResult resetPwd(@RequestBody CompanyUser user)
-    {
+    public AjaxResult resetPwd(@RequestBody CompanyUser user) {
         if (!PatternUtils.checkPassword(user.getPassword())) {
             return AjaxResult.error("密码格式不正确,需包含字母、数字和特殊字符,长度为 8-20 位");
         }
@@ -266,22 +254,25 @@ public class CompanyUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('company:user:edit')")
     @Log(title = "用户管理", businessType = BusinessType.UPDATE)
     @PutMapping("/changeStatus")
-    public AjaxResult changeStatus(@RequestBody CompanyUser user)
-    {
+    @Transactional
+    public AjaxResult changeStatus(@RequestBody CompanyUser user) {
         //管理员的状态不能修改
-        CompanyUser companyUser=companyUserService.selectCompanyUserById(user.getUserId());
-        if(companyUser.isAdmin()){
+        CompanyUser companyUser = companyUserService.selectCompanyUserById(user.getUserId());
+        if (companyUser.isAdmin()) {
             return AjaxResult.error("不能修改管理员状态");
         }
-        if ("1".equals(user.getStatus())){
-            CompanyVoiceCaller caller = callerService.selectCompanyVoiceCallerByUserId(companyUser.getCompanyId(),companyUser.getUserId());
-            if(caller != null){
-                caller.setCompanyId(0l);
-                caller.setCompanyUserId(0l);
-                caller.setMobile("");
-                caller.setStatus(1);
-                callerService.updateCompanyVoiceCaller(caller);
+        if ("1".equals(user.getStatus())) {
+            List<CompanyVoiceCaller> callers = callerService.selectCompanyVoiceCallerByUserId(companyUser.getCompanyId(), companyUser.getUserId(), null);
+            if (callers != null && !callers.isEmpty()) {
+                callers.forEach(caller -> {
+                    caller.setCompanyId(0L);
+                    caller.setCompanyUserId(0L);
+                    caller.setMobile("");
+                    caller.setStatus(1);
+                    callerService.updateCompanyVoiceCaller(caller);
+                });
             }
+
         }
         user.setUpdateBy(SecurityUtils.getUsername());
         return toAjax(companyUserService.updateCompanyUser(user));
@@ -290,12 +281,12 @@ public class CompanyUserController extends BaseController
 
     /**
      * 获取通讯录
+     *
      * @param user
      * @return
      */
     @GetMapping("/getAddressBookList")
-    public TableDataInfo getAddressBookList(CompanyUser user)
-    {
+    public TableDataInfo getAddressBookList(CompanyUser user) {
         startPage();
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         user.setCompanyId(loginUser.getCompany().getCompanyId());
@@ -315,18 +306,16 @@ public class CompanyUserController extends BaseController
 //    }
 
     @GetMapping("/getUserListByDeptId")
-    public R getUserListByDeptId(CompanyUser user)
-    {
+    public R getUserListByDeptId(CompanyUser user) {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         user.setCompanyId(loginUser.getCompany().getCompanyId());
 
         List<CompanyUser> list = companyUserService.getUserListByDeptId(user);
-        return R.ok().put("data",list);
+        return R.ok().put("data", list);
     }
 
     @GetMapping("/getSelectUserList")
-    public TableDataInfo getSelectUserList(CompanyUser map)
-    {
+    public TableDataInfo getSelectUserList(CompanyUser map) {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         map.setCompanyId(loginUser.getCompany().getCompanyId());
         startPage();
@@ -336,36 +325,33 @@ public class CompanyUserController extends BaseController
 
 
     @GetMapping("/getSalesman")
-    public R getSalesman()
-    {
+    public R getSalesman() {
         //查询所有业务员
         List<OptionsVO> list = companyUserService.selectCompanyUserBySalesman();
-        return R.ok().put("data",list);
+        return R.ok().put("data", list);
     }
 
     /**
      * 获取区域
      */
     @GetMapping("/getCitysAreaList")
-    public R getCitysAreaList(){
-        return R.ok().put("data",companyUserService.getCitysAreaList());
+    public R getCitysAreaList() {
+        return R.ok().put("data", companyUserService.getCitysAreaList());
     }
 
     /**
      * 批量修改 销售的所属区域(临时的)
      */
     @PostMapping("/updateCompanyUserAreaList")
-    public R updateCompanyUserAreaList(@RequestBody CompanyUserAreaParam param)
-    {
+    public R updateCompanyUserAreaList(@RequestBody CompanyUserAreaParam param) {
         return companyUserService.updateCompanyUserAreaList(param);
     }
 
     @Log(title = "设置是否需要单独注册会员", businessType = BusinessType.UPDATE)
     @PutMapping("/setRegister")
-    public AjaxResult setIsRegisterMember(@RequestParam Boolean status, @RequestBody List<Long> userIds)
-    {
+    public AjaxResult setIsRegisterMember(@RequestParam Boolean status, @RequestBody List<Long> userIds) {
         Boolean r = companyUserService.setIsRegisterMember(status, userIds);
-        if(r){
+        if (r) {
             return AjaxResult.success();
         } else {
             return AjaxResult.error("操作失败");

+ 27 - 4
fs-company/src/main/java/com/fs/company/controller/CompanyVoiceApiController.java

@@ -3,10 +3,16 @@ package com.fs.company.controller;
 import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.utils.ParseUtils;
 import com.fs.common.utils.ServletUtils;
 import com.fs.company.domain.CompanyUser;
+import com.fs.company.domain.CompanyVoiceApi;
 import com.fs.company.domain.CompanyVoiceMobile;
+import com.fs.company.param.CompanyVoiceCallerParam;
+import com.fs.company.service.ICompanyVoiceApiService;
 import com.fs.company.service.ICompanyVoiceMobileService;
+import com.fs.company.vo.CompanyVoiceCallerListVO;
 import com.fs.core.security.LoginUser;
 import com.fs.core.web.service.TokenService;
 import com.fs.voice.service.IVoiceService;
@@ -14,12 +20,14 @@ import io.jsonwebtoken.Claims;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.List;
 
 @RestController
 @RequestMapping("/company/voiceApi")
@@ -31,6 +39,9 @@ public class CompanyVoiceApiController extends BaseController {
     @Autowired
     private TokenService tokenService;
 
+    @Autowired
+    private ICompanyVoiceApiService companyVoiceApiService;
+
 //    @GetMapping("/callMobile")
 //    @RepeatSubmit
 //    public R callMobile(
@@ -44,6 +55,17 @@ public class CompanyVoiceApiController extends BaseController {
 //    }
 
 
+    /**
+     * 查询呼叫接口列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceApi:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyVoiceApi companyVoiceApi) {
+        startPage();
+        List<CompanyVoiceApi> list = companyVoiceApiService.selectCompanyVoiceApiList(companyVoiceApi);
+        return getDataTable(list);
+    }
+
 
     @ApiOperation("呼叫")
     @GetMapping("/callMobile")
@@ -51,11 +73,12 @@ public class CompanyVoiceApiController extends BaseController {
     public R callMobile(HttpServletRequest request,
                         @ApiParam(required = false, name = "contactsId", value = "联系人ID") @RequestParam(value = "contactsId", required = false) Long contactsId,
                         @ApiParam(required = false, name = "customerId", value = "客户ID") @RequestParam(value = "customerId", required = false) Long customerId,
-                        @ApiParam(required = false, name = "orderId", value = "订单ID") @RequestParam(value = "orderId", required = false) Long orderId
+                        @ApiParam(required = false, name = "orderId", value = "订单ID") @RequestParam(value = "orderId", required = false) Long orderId,
+                        @ApiParam(required = false, name = "callerId", value = "线路接口id") @RequestParam(value = "callerId", required = false) Long callerId
     ) throws Exception
     {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
-        return voiceService.voiceCall(loginUser.getCompany().getCompanyId(),customerId,contactsId,loginUser.getUser().getUserId(),orderId);
+        return voiceService.voiceCall(loginUser.getCompany().getCompanyId(),customerId,contactsId,loginUser.getUser().getUserId(),orderId,callerId);
     }
 
 
@@ -68,10 +91,10 @@ public class CompanyVoiceApiController extends BaseController {
 
     @ApiOperation("获取SIP")
     @GetMapping(value="/getSipAccount")
-    public R getSipAccount() throws Exception
+    public R getSipAccount(@RequestParam(value = "callerId",required = false) Long callerId) throws Exception
     {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
-        return voiceService.getSipAccount(loginUser.getUser().getUserId());
+        return voiceService.getSipAccount(loginUser.getUser().getUserId(),callerId);
     }
 
 }

+ 23 - 8
fs-company/src/main/java/com/fs/company/controller/CompanyVoiceCallerController.java

@@ -25,7 +25,7 @@ import java.util.List;
 
 /**
  * 企业用户坐席Controller
- * 
+ *
  * @author fs
  * @date 2021-10-11
  */
@@ -55,6 +55,21 @@ public class CompanyVoiceCallerController extends BaseController
         return getDataTable(list);
     }
 
+    /**
+     * 查询我的企业用户坐席列表
+     */
+//    @PreAuthorize("@ss.hasPermi('company:companyVoiceCaller:list')")
+    @GetMapping("/myList")
+    public TableDataInfo myList(CompanyVoiceCallerParam param)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        param.setCompanyId(loginUser.getCompany().getCompanyId());
+        param.setCompanyUserId(loginUser.getUser().getUserId());
+        List<CompanyVoiceCallerListVO> list = companyVoiceCallerService.selectCompanyVoiceCallerListVO(param);
+        return getDataTable(list);
+    }
+
     /**
      * 导出企业用户坐席列表
      */
@@ -103,11 +118,11 @@ public class CompanyVoiceCallerController extends BaseController
         if(checkCaller.getStatus()==0){
             return R.error("此坐席号已绑定");
         }
-        //处理 是否已添加
-        CompanyVoiceCaller check=companyVoiceCallerService.selectCompanyVoiceCallerByUserId(loginUser.getCompany().getCompanyId(),caller.getCompanyUserId());
-        if(check!=null){
-            return R.error("此员工已绑定为坐席");
-        }
+        //处理 是否已添加 2025.05.30 一个员工多个线路
+//        CompanyVoiceCaller check=companyVoiceCallerService.selectCompanyVoiceCallerByUserId(loginUser.getCompany().getCompanyId(),caller.getCompanyUserId());
+//        if(check!=null){
+//            return R.error("此员工已绑定为坐席");
+//        }
         caller.setCallerNo(caller.getCallerNo());
         caller.setCompanyId(loginUser.getCompany().getCompanyId());
         caller.setCompanyUserId(caller.getCompanyUserId());
@@ -144,9 +159,9 @@ public class CompanyVoiceCallerController extends BaseController
 
 
     @GetMapping("/getCallerList")
-    public R getCallerList()
+    public R getCallerList(@RequestParam(value = "callerLine",required = false) Long callerLine)
     {
-        List<CompanyVoiceCaller> list= companyVoiceCallerService.selectCompanyVoiceCallerByEnable();
+        List<CompanyVoiceCaller> list= companyVoiceCallerService.selectCompanyVoiceCallerByEnable(callerLine);
         return R.ok().put("data",list);
     }
 

+ 1 - 1
fs-company/src/main/java/com/fs/crm/controller/CrmCustomerController.java

@@ -236,7 +236,7 @@ public class CrmCustomerController extends BaseController
     }
 
     //添加协作人
-    @PreAuthorize("@ss.hasPermi('crm:customer:assistToUser')")
+//    @PreAuthorize("@ss.hasPermi('crm:customer:assistToUser')")
     @PostMapping("/assistToUser")
     public R assistToUser(@RequestBody CrmCustomeAssignParam param)
     {

+ 3 - 3
fs-service-system/src/main/java/com/fs/company/domain/CompanyUser.java

@@ -120,7 +120,7 @@ public class CompanyUser extends BaseEntity
 
     private String jpushId;
 
-    private String callerNo;
+    private List<String> callerNo;
 
     private String qwUserId;
 
@@ -184,11 +184,11 @@ public class CompanyUser extends BaseEntity
     public void setQwUserId(String qwUserId) {
         this.qwUserId = qwUserId;
     }
-    public String getCallerNo() {
+    public List<String> getCallerNo() {
         return callerNo;
     }
 
-    public void setCallerNo(String callerNo) {
+    public void setCallerNo(List<String> callerNo) {
         this.callerNo = callerNo;
     }
 

+ 14 - 1
fs-service-system/src/main/java/com/fs/company/domain/CompanyVoiceCaller.java

@@ -7,7 +7,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 
 /**
  * 企业用户坐席对象 company_voice_caller
- * 
+ *
  * @author fs
  * @date 2023-02-23
  */
@@ -18,6 +18,11 @@ public class CompanyVoiceCaller extends BaseEntity
     /** ID */
     private Long callerId;
 
+
+    /** ID */
+    @Excel(name = "接口ID")
+    private Long callerLine;
+
     /** 企业ID */
     @Excel(name = "企业ID")
     private Long companyId;
@@ -89,4 +94,12 @@ public class CompanyVoiceCaller extends BaseEntity
     public void setStatus(Integer status) {
         this.status = status;
     }
+
+    public Long getCallerLine() {
+        return callerLine;
+    }
+
+    public void setCallerLine(Long callerLine) {
+        this.callerLine = callerLine;
+    }
 }

+ 8 - 28
fs-service-system/src/main/java/com/fs/company/mapper/CompanyVoiceCallerMapper.java

@@ -63,38 +63,18 @@ public interface CompanyVoiceCallerMapper
      * @return 结果
      */
     public int deleteCompanyVoiceCallerByIds(Long[] callingIds);
-    @Select({"<script> " +
-            "select vc.*,u.nick_name as company_user_nick_name,c.company_name " +
-            "from company_voice_caller vc left join company c on c.company_id=vc.company_id left join  company_user u on u.user_id=vc.company_user_id " +
-            "where 1=1 " +
-            "<if test = 'maps.companyId != null  '> " +
-            "and vc.company_id = #{maps.companyId}" +
-            "</if>" +
-            "<if test = 'maps.companyUserId != null  '> " +
-            "and vc.company_user_id = #{maps.companyUserId}" +
-            "</if>" +
-            "<if test = 'maps.callerNo != null and maps.callerNo != \"\" '> " +
-            "and vc.caller_no like '%${maps.callerNo}%' " +
-            "</if>" +
-            "<if test = 'maps.mobile != null and maps.mobile != \"\" '> " +
-            "and vc.mobile like '%${maps.mobile}%' " +
-            "</if>" +
-            "<if test = 'maps.companyUserNickName != null and maps.companyUserNickName != \"\" '> " +
-            "and u.nick_name like '%${maps.companyUserNickName}%' " +
-            "</if>" +
-            "<if test = 'maps.status != null '> " +
-            "and vc.status = #{maps.status}" +
-            "</if>" +
-            "order by vc.caller_id desc " +
-            "</script>"})
+
     List<CompanyVoiceCallerListVO> selectCompanyVoiceCallerListVO(@Param("maps")CompanyVoiceCallerParam param);
-    @Select("select * from company_voice_caller where company_id=#{companyId} and company_user_id=#{companyUserId}")
-    CompanyVoiceCaller selectCompanyVoiceCallerByUserId(@Param("companyId") Long companyId,@Param("companyUserId") Long companyUserId);
+
+    List<CompanyVoiceCaller> selectCompanyVoiceCallerByUserId(@Param("companyId") Long companyId,
+                                                        @Param("companyUserId") Long companyUserId,
+                                                        @Param("callerId") Long callerId
+    );
 
     @Select("select * from company_voice_caller where caller_no=#{callerNo}  ")
     CompanyVoiceCaller selectCompanyVoiceCallerByCallerNo(String callerNo);
-    @Select("select * from company_voice_caller where  status=1  ")
-    List<CompanyVoiceCaller> selectCompanyVoiceCallerByEnable();
+//    @Select("select * from company_voice_caller where  status=1  ")
+    List<CompanyVoiceCaller> selectCompanyVoiceCallerByEnable(@Param("callerLine") Long callerLine);
     @Select("select ifnull(count(1),0) from company_voice_caller where company_id=#{companyId}  ")
     Integer selectCompanyVoiceCallerCountsByCompanyId(Long companyId);
 }

+ 3 - 0
fs-service-system/src/main/java/com/fs/company/param/CompanyVoiceCallerImportParam.java

@@ -15,4 +15,7 @@ public class CompanyVoiceCallerImportParam implements Serializable
     @Excel(name = "分机号")
     private String callerNo;
 
+    @Excel(name = "接口id")
+    private Long callerLine;
+
 }

+ 1 - 1
fs-service-system/src/main/java/com/fs/company/param/CompanyVoiceCallerParam.java

@@ -11,7 +11,7 @@ import com.fs.common.core.domain.BaseEntity;
 public class CompanyVoiceCallerParam extends BaseEntity
 {
 
-
+    private Long callerLine;
     /** 公司名 */
     private Long companyId;
 

+ 2 - 2
fs-service-system/src/main/java/com/fs/company/service/ICompanyVoiceCallerService.java

@@ -66,11 +66,11 @@ public interface ICompanyVoiceCallerService
 
     List<CompanyVoiceCallerListVO> selectCompanyVoiceCallerListVO(CompanyVoiceCallerParam param);
 
-    CompanyVoiceCaller selectCompanyVoiceCallerByUserId(Long companyId, Long companyUserId);
+    List<CompanyVoiceCaller> selectCompanyVoiceCallerByUserId(Long companyId, Long companyUserId,Long callerId);
 
     String importCompanyVoiceCaller(List<CompanyVoiceCallerImportParam> list);
 
-    List<CompanyVoiceCaller> selectCompanyVoiceCallerByEnable();
+    List<CompanyVoiceCaller> selectCompanyVoiceCallerByEnable(Long callerLine);
 
     Integer selectCompanyVoiceCallerCountsByCompanyId(Long companyId);
 }

+ 26 - 9
fs-service-system/src/main/java/com/fs/company/service/impl/CompanyVoiceCallerServiceImpl.java

@@ -6,6 +6,8 @@ import java.util.List;
 import com.fs.common.core.domain.entity.SysUser;
 import com.fs.common.exception.CustomException;
 import com.fs.common.utils.StringUtils;
+import com.fs.company.domain.CompanyVoiceApi;
+import com.fs.company.mapper.CompanyVoiceApiMapper;
 import com.fs.company.param.CompanyVoiceCallerImportParam;
 import com.fs.company.param.CompanyVoiceCallerParam;
 import com.fs.company.vo.CompanyVoiceCallerListVO;
@@ -29,6 +31,8 @@ public class CompanyVoiceCallerServiceImpl implements ICompanyVoiceCallerService
 {
     @Autowired
     private CompanyVoiceCallerMapper companyVoiceCallerMapper;
+    @Autowired
+    private CompanyVoiceApiMapper companyVoiceApiMapper;
 
     /**
      * 查询企业用户坐席
@@ -109,8 +113,8 @@ public class CompanyVoiceCallerServiceImpl implements ICompanyVoiceCallerService
     }
 
     @Override
-    public CompanyVoiceCaller selectCompanyVoiceCallerByUserId(Long companyId, Long companyUserId) {
-        return companyVoiceCallerMapper.selectCompanyVoiceCallerByUserId(companyId,companyUserId);
+    public List<CompanyVoiceCaller> selectCompanyVoiceCallerByUserId(Long companyId, Long companyUserId,Long callerId) {
+        return companyVoiceCallerMapper.selectCompanyVoiceCallerByUserId(companyId,companyUserId,callerId);
     }
 
     @Override
@@ -128,22 +132,35 @@ public class CompanyVoiceCallerServiceImpl implements ICompanyVoiceCallerService
 
             try
             {
+                Long callerLine = item.getCallerLine();
+                if (callerLine == null || StringUtils.isBlank(item.getCallerNo())){
+                    failureNum++;
+                    failureMsg.append("<br/>" + failureNum + "、分机号/接口id不能为空");
+                    continue;
+                }
                 CompanyVoiceCaller caller = companyVoiceCallerMapper.selectCompanyVoiceCallerByCallerNo(item.getCallerNo());
                 if (caller == null) {
                     caller=new CompanyVoiceCaller();
                     caller.setStatus(1);
                     caller.setCallerNo(item.getCallerNo());
-                    companyVoiceCallerMapper.insertCompanyVoiceCaller(caller);
-                    successNum++;
-                    successMsg.append("<br/>" + successNum + "、号码 " + item.getCallerNo() + " 导入成功");
                 }
                 else
                 {
                     failureNum++;
                     failureMsg.append("<br/>" + failureNum + "、号码 " + item.getCallerNo() + " 已存在");
+                    continue;
                 }
-
-
+                //接口id
+                CompanyVoiceApi api = companyVoiceApiMapper.selectCompanyVoiceApiById(callerLine);
+                if (api == null) {
+                    failureNum++;
+                    failureMsg.append("<br/>" + failureNum + "、号码 " + item.getCallerNo() + "的接口id不已存在");
+                    continue;
+                }
+                caller.setCallerLine(callerLine);
+                companyVoiceCallerMapper.insertCompanyVoiceCaller(caller);
+                successNum++;
+                successMsg.append("<br/>" + successNum + "、号码 " + item.getCallerNo() + " 导入成功");
             }
             catch (Exception e)
             {
@@ -165,8 +182,8 @@ public class CompanyVoiceCallerServiceImpl implements ICompanyVoiceCallerService
     }
 
     @Override
-    public List<CompanyVoiceCaller> selectCompanyVoiceCallerByEnable() {
-        return companyVoiceCallerMapper.selectCompanyVoiceCallerByEnable();
+    public List<CompanyVoiceCaller> selectCompanyVoiceCallerByEnable(Long callerLine) {
+        return companyVoiceCallerMapper.selectCompanyVoiceCallerByEnable(callerLine);
     }
 
     @Override

+ 2 - 0
fs-service-system/src/main/java/com/fs/company/vo/CompanyVoiceCallerListVO.java

@@ -16,6 +16,8 @@ public class CompanyVoiceCallerListVO implements Serializable
     /** ID */
     private Long callerId;
 
+    private String callerLine;
+
     @Excel(name = "公司")
     private String companyName;
 

+ 4 - 4
fs-service-system/src/main/java/com/fs/voice/service/IVoiceService.java

@@ -9,15 +9,15 @@ import com.fs.common.core.domain.R;
  */
 public interface IVoiceService
 {
-    R voiceCall(Long companyId,Long customerId,Long userId, String calleeNbr);
+    R voiceCall(Long companyId,Long customerId,Long userId, String calleeNbr,Long callerId);
 
     R voiceCallOff(Long voiceId);
 
-    R getSipAccount(Long userId);
+    R getSipAccount(Long userId, Long id);
 
-    R voiceCall(Long companyId, Long customerId, Long contactsId, Long userId,Long orderId);
+    R voiceCall(Long companyId, Long customerId, Long contactsId, Long userId,Long orderId,Long callerId);
 
-    R voiceAppCall(Long companyId, Long customerId, Long userId, String mobile);
+    R voiceAppCall(Long companyId, Long customerId, Long userId, String mobile,Long callerId);
 
     R voiceAppCallOff(Long voiceId);
 }

+ 26 - 13
fs-service-system/src/main/java/com/fs/voice/service/impl/VoiceServiceImpl.java

@@ -27,6 +27,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Date;
+import java.util.List;
+import java.util.Objects;
 
 @Service
 public class VoiceServiceImpl implements IVoiceService
@@ -66,7 +68,7 @@ public class VoiceServiceImpl implements IVoiceService
     @Override
     @Transactional
     @Synchronized
-    public R voiceCall(Long companyId,Long customerId,Long userId, String calleeNbr) {
+    public R voiceCall(Long companyId,Long customerId,Long userId, String calleeNbr,Long callerId) {
         //查询主叫号是不是坐席 查询主叫号是否已过期
         Company company=companyService.selectCompanyById(companyId);
         if(company.getStatus()==0){
@@ -83,7 +85,8 @@ public class VoiceServiceImpl implements IVoiceService
             return R.error("外呼接口已禁用");
         }
         CompanyUser user=userService.selectCompanyUserById(userId);
-        CompanyVoiceCaller caller=callerService.selectCompanyVoiceCallerByUserId(companyId,userId);
+//        CompanyVoiceCaller caller=callerService.selectCompanyVoiceCallerByUserId(companyId,userId);
+        CompanyVoiceCaller caller=callerService.selectCompanyVoiceCallerById(callerId);
         CompanyVoice companyVoice=companyVoiceService.selectCompanyVoiceByCompanyId(user.getCompanyId());
         if(caller==null){
 //            return R.error("未绑定坐席");
@@ -246,15 +249,17 @@ public class VoiceServiceImpl implements IVoiceService
     }
 
     @Override
-    public R getSipAccount(Long userId) {
+    public R getSipAccount(Long userId, Long callerId) {
         CompanyUser user= userService.selectCompanyUserById(userId);
         Company company=companyService.selectCompanyById(user.getCompanyId());
-        CompanyVoiceCaller caller=callerService.selectCompanyVoiceCallerByUserId(company.getCompanyId(),userId);
-        if(caller==null){
+//        CompanyVoiceCaller caller=callerService.selectCompanyVoiceCallerByUserId(company.getCompanyId(),userId);
+        CompanyVoiceCaller caller=callerService.selectCompanyVoiceCallerById(callerId);
+        if(caller==null || !Objects.equals(caller.getCompanyId(), company.getCompanyId()) || !Objects.equals(caller.getCompanyUserId(), userId)){
 //            return R.error("未绑定坐席");
             return R.ok();
         }
-        CompanyVoiceApi api=companyVoiceApiService.selectCompanyVoiceApiById(company.getVoiceApiId());
+//        CompanyVoiceApi api=companyVoiceApiService.selectCompanyVoiceApiById(company.getVoiceApiId());
+        CompanyVoiceApi api=companyVoiceApiService.selectCompanyVoiceApiById(caller.getCallerLine());
         CallApiConfig apiConfig=JSONUtil.toBean(api.getApiJson(), CallApiConfig.class);
         Long time=new Date().getTime();
         String seq=time.toString();
@@ -280,7 +285,7 @@ public class VoiceServiceImpl implements IVoiceService
     }
 
     @Override
-    public R voiceCall(Long companyId, Long customerId, Long contactsId, Long userId,Long orderId) {
+    public R voiceCall(Long companyId, Long customerId, Long contactsId, Long userId,Long orderId,Long callerId) {
         String calleeNbr="";
         if(contactsId!=null&&contactsId>0){
             CrmCustomerContacts contacts=crmCustomerContactsService.selectCrmCustomerContactsById(contactsId);
@@ -299,9 +304,9 @@ public class VoiceServiceImpl implements IVoiceService
         if(company.getStatus()==0){
             return R.error("公司已停用");
         }
-        if(company.getVoiceApiId()==null){
-            return R.error("未配置外呼接口");
-        }
+//        if(company.getVoiceApiId()==null){
+//            return R.error("未配置外呼接口");
+//        }
         CompanyVoiceApi api=companyVoiceApiService.selectCompanyVoiceApiById(company.getVoiceApiId());
         if(api==null){
             return R.error("外呼接口不存在");
@@ -310,7 +315,11 @@ public class VoiceServiceImpl implements IVoiceService
             return R.error("外呼接口已禁用");
         }
         CompanyUser user=userService.selectCompanyUserById(userId);
-        CompanyVoiceCaller caller=callerService.selectCompanyVoiceCallerByUserId(companyId,userId);
+        CompanyVoiceCaller caller = null;
+        List<CompanyVoiceCaller> callers=callerService.selectCompanyVoiceCallerByUserId(companyId,userId,callerId);
+        if (callers != null && !callers.isEmpty()) {
+            caller = callers.get(0);
+        }
         CompanyVoice companyVoice=companyVoiceService.selectCompanyVoiceByCompanyId(user.getCompanyId());
         if(caller==null){
             return R.error("未绑定坐席");
@@ -413,7 +422,7 @@ public class VoiceServiceImpl implements IVoiceService
     }
 
     @Override
-    public R voiceAppCall(Long companyId, Long customerId, Long userId, String calleeNbr) {
+    public R voiceAppCall(Long companyId, Long customerId, Long userId, String calleeNbr,Long callerId) {
         //查询主叫号是不是坐席 查询主叫号是否已过期
         Company company=companyService.selectCompanyById(companyId);
         if(company.getStatus()==0){
@@ -430,7 +439,11 @@ public class VoiceServiceImpl implements IVoiceService
             return R.error("外呼接口已禁用");
         }
         CompanyUser user=userService.selectCompanyUserById(userId);
-        CompanyVoiceCaller caller=callerService.selectCompanyVoiceCallerByUserId(companyId,userId);
+        CompanyVoiceCaller caller = null;
+        List<CompanyVoiceCaller> callers=callerService.selectCompanyVoiceCallerByUserId(companyId,userId,callerId);
+        if(callers!=null && !callers.isEmpty()){
+            caller=callers.get(0);
+        }
         CompanyVoice companyVoice=companyVoiceService.selectCompanyVoiceByCompanyId(user.getCompanyId());
         if(caller==null){
             return R.error("未绑定坐席");

+ 2 - 0
fs-service-system/src/main/resources/application-common.yml

@@ -45,6 +45,8 @@ logging:
     org.springframework: warn
 # Spring配置
 spring:
+  cache:
+    type: redis
   mvc:
     async:
       request-timeout: 30000

+ 49 - 1
fs-service-system/src/main/resources/mapper/company/CompanyVoiceCallerMapper.xml

@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <resultMap type="CompanyVoiceCaller" id="CompanyVoiceCallerResult">
         <result property="callerId"    column="caller_id"    />
+        <result property="callerLine"    column="caller_line"    />
         <result property="companyId"    column="company_id"    />
         <result property="companyUserId"    column="company_user_id"    />
         <result property="callerNo"    column="caller_no"    />
@@ -15,12 +16,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectCompanyVoiceCallerVo">
-        select caller_id, company_id, company_user_id, caller_no, mobile, status, remark from company_voice_caller
+        select caller_id,caller_line, company_id, company_user_id, caller_no, mobile, status, remark from company_voice_caller
     </sql>
 
     <select id="selectCompanyVoiceCallerList" parameterType="CompanyVoiceCaller" resultMap="CompanyVoiceCallerResult">
         <include refid="selectCompanyVoiceCallerVo"/>
         <where>
+            <if test="callerLine != null "> and caller_line = #{callerLine}</if>
             <if test="companyId != null "> and company_id = #{companyId}</if>
             <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
             <if test="callerNo != null  and callerNo != ''"> and caller_no = #{callerNo}</if>
@@ -33,10 +35,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectCompanyVoiceCallerVo"/>
         where caller_id = #{callerId}
     </select>
+    <select id="selectCompanyVoiceCallerByUserId" resultType="com.fs.company.domain.CompanyVoiceCaller">
+        select * from company_voice_caller where company_id=#{companyId} and company_user_id=#{companyUserId}
+        <if test = "callerId != null ">
+            and caller_id = #{callerId}
+        </if>
+    </select>
+    <select id="selectCompanyVoiceCallerListVO" resultType="com.fs.company.vo.CompanyVoiceCallerListVO">
+        select va.api_name as caller_line,vc.*,u.nick_name as company_user_nick_name,c.company_name
+        from company_voice_caller vc
+        left join company_voice_api va on vc.caller_line = va.api_id
+        left join company c on c.company_id=vc.company_id
+        left join  company_user u on u.user_id=vc.company_user_id
+       <where>
+           <if test="maps.callerLine != null">
+               and vc.caller_line = #{maps.callerLine}
+           </if>
+           <if test="maps.companyId != null">
+               and vc.company_id = #{maps.companyId}
+           </if>
+           <if test="maps.companyUserId != null">
+               and vc.company_user_id = #{maps.companyUserId}
+           </if>
+           <if test="maps.callerNo != null and maps.callerNo != ''">
+               and vc.caller_no like '%${maps.callerNo}%'
+           </if>
+           <if test="maps.mobile != null and maps.mobile != ''">
+               and vc.mobile like '%${maps.mobile}%'
+           </if>
+           <if test="maps.companyUserNickName != null and maps.companyUserNickName != ''">
+               and u.nick_name like '%${maps.companyUserNickName}%'
+           </if>
+           <if test="maps.status != null">
+               and vc.status = #{maps.status}
+           </if>
+       </where>
+        order by vc.caller_id desc
+    </select>
+    <select id="selectCompanyVoiceCallerByEnable" resultType="com.fs.company.domain.CompanyVoiceCaller">
+        select * from company_voice_caller where  status=1
+        <if test="callerLine != null">
+            and caller_line = #{callerLine}
+        </if>
+    </select>
 
     <insert id="insertCompanyVoiceCaller" parameterType="CompanyVoiceCaller" useGeneratedKeys="true" keyProperty="callerId">
         insert into company_voice_caller
         <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="callerLine != null">caller_line,</if>
             <if test="companyId != null">company_id,</if>
             <if test="companyUserId != null">company_user_id,</if>
             <if test="callerNo != null">caller_no,</if>
@@ -45,6 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="remark != null">remark,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="callerLine != null">#{callerLine},</if>
             <if test="companyId != null">#{companyId},</if>
             <if test="companyUserId != null">#{companyUserId},</if>
             <if test="callerNo != null">#{callerNo},</if>
@@ -57,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="updateCompanyVoiceCaller" parameterType="CompanyVoiceCaller">
         update company_voice_caller
         <trim prefix="SET" suffixOverrides=",">
+            <if test="callerLine != null">caller_line = #{callerLine},</if>
             <if test="companyId != null">company_id = #{companyId},</if>
             <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
             <if test="callerNo != null">caller_no = #{callerNo},</if>