Browse Source

外呼系统开发

anderx 1 year ago
parent
commit
11ee67d0f6

+ 1 - 3
src/main/java/com/goafanti/common/dao/CallLogMapper.java

@@ -2,7 +2,6 @@ package com.goafanti.common.dao;
 
 import com.goafanti.common.model.CallLog;
 import org.apache.ibatis.annotations.Param;
-import org.springframework.data.domain.Pageable;
 
 import java.util.List;
 
@@ -27,10 +26,9 @@ public interface CallLogMapper {
      * 查询指定行数据
      *
      * @param callLog  查询条件
-     * @param pageable 分页对象
      * @return 对象列表
      */
-    List<CallLog> findCallLogList(CallLog callLog, @Param("pageable") Pageable pageable);
+    List<CallLog> findCallLogList(CallLog callLog);
 
     /**
      * 统计总行数

+ 3 - 0
src/main/java/com/goafanti/common/model/CallLog.java

@@ -1,5 +1,7 @@
 package com.goafanti.common.model;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -126,6 +128,7 @@ public class CallLog implements Serializable {
         this.remarks = remarks;
     }
 
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
     public Date getCreateTime() {
         return createTime;
     }

+ 34 - 0
src/main/java/com/goafanti/customer/bo/InputUserCallList.java

@@ -0,0 +1,34 @@
+package com.goafanti.customer.bo;
+
+public class InputUserCallList {
+
+    private String uid;
+
+    private Integer pageNo;
+
+    private Integer pageSize;
+
+    public String getUid() {
+        return uid;
+    }
+
+    public void setUid(String uid) {
+        this.uid = uid;
+    }
+
+    public Integer getPageNo() {
+        return pageNo;
+    }
+
+    public void setPageNo(Integer pageNo) {
+        this.pageNo = pageNo;
+    }
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+}

+ 11 - 0
src/main/java/com/goafanti/customer/controller/UserOutboundApiController.java

@@ -6,6 +6,7 @@ import com.goafanti.common.controller.BaseApiController;
 import com.goafanti.common.model.Admin;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.customer.bo.InputCallNumber;
+import com.goafanti.customer.bo.InputUserCallList;
 import com.goafanti.customer.service.UserOutboundService;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -97,4 +98,14 @@ public class UserOutboundApiController  extends BaseApiController {
     public Result getDefaultMobile(String uid) {
         return new Result<>().data(this.userOutboundService.getDefaultMobile(uid));
     }
+
+
+    /**
+     * 通话记录
+     *
+     */
+    @GetMapping("/userCallList")
+    public Result userCallList(InputUserCallList in) {
+        return new Result<>().data(this.userOutboundService.userCallList(in));
+    }
 }

+ 2 - 0
src/main/java/com/goafanti/customer/service/UserOutboundService.java

@@ -3,6 +3,7 @@ package com.goafanti.customer.service;
 import com.goafanti.common.bo.InputCallCompleter;
 import com.goafanti.common.bo.Result;
 import com.goafanti.customer.bo.InputCallNumber;
+import com.goafanti.customer.bo.InputUserCallList;
 
 public interface UserOutboundService {
     Object checkUser(Integer type);
@@ -17,4 +18,5 @@ public interface UserOutboundService {
 
     Object getDefaultMobile(String uid);
 
+    Object userCallList(InputUserCallList in);
 }

+ 31 - 2
src/main/java/com/goafanti/customer/service/impl/UserOutboundServiceImpl.java

@@ -5,7 +5,10 @@ import com.alibaba.fastjson.JSONObject;
 import com.goafanti.common.bo.Error;
 import com.goafanti.common.bo.InputCallCompleter;
 import com.goafanti.common.bo.Result;
-import com.goafanti.common.dao.*;
+import com.goafanti.common.dao.AdminMapper;
+import com.goafanti.common.dao.CallLogMapper;
+import com.goafanti.common.dao.OrganizationContactBookMapper;
+import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.CallLog;
 import com.goafanti.common.model.OrganizationContactBook;
@@ -17,6 +20,7 @@ import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.websocket.SystemWebSocketHandler;
 import com.goafanti.customer.bo.InputCallNumber;
+import com.goafanti.customer.bo.InputUserCallList;
 import com.goafanti.customer.service.UserOutboundService;
 import org.apache.shiro.crypto.hash.SimpleHash;
 import org.springframework.stereotype.Service;
@@ -28,7 +32,7 @@ import java.util.List;
 import java.util.Map;
 
 @Service("userOutboundService")
-public class UserOutboundServiceImpl extends BaseMybatisDao<UserArchivesMapper> implements UserOutboundService {
+public class UserOutboundServiceImpl extends BaseMybatisDao<CallLogMapper> implements UserOutboundService {
     static final String customer="C322";
     static final String seq="20241101";
     static final String pwd="084332D02CCF7B42461F34155AC8754F";
@@ -175,6 +179,7 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<UserArchivesMapper>
         callLog.setStatus(0);
         callLog.setRemarks(callResultMsg);
         callLogMapper.insert(callLog);
+        pushCountUser(uid);
         //需要关闭客户呼叫中
         try {
             systemWebSocketHandler.sendMessageToUser(admin.getId(), new TextMessage("callCompleted"));
@@ -184,6 +189,23 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<UserArchivesMapper>
         return 1;
     }
 
+    /**
+     * 客户通话时长统计
+     * @param uid
+     */
+    private void pushCountUser(String uid) {
+        CallLog callLog=new CallLog();
+        callLog.setUid(uid);
+        List<CallLog> callLogList = callLogMapper.findCallLogList(callLog);
+        int count=0;
+        int duration=0;
+        for (CallLog log : callLogList) {
+            count++;
+            duration+=log.getDuration();
+        }
+
+    }
+
     @Override
     public Object agentList() {
         return adminMapper.agentList();
@@ -193,4 +215,11 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<UserArchivesMapper>
     public Object getDefaultMobile(String uid) {
         return organizationContactBookMapper.getMajor(uid,null);
     }
+
+    @Override
+    public Object userCallList(InputUserCallList in) {
+        CallLog select=new CallLog();
+        select.setUid(in.getUid());
+        return findPage("findCallLogList","findCallLogCount",select,in.getPageNo(),in.getPageSize());
+    }
 }