Pārlūkot izejas kodu

外呼系统开发

anderx 1 gadu atpakaļ
vecāks
revīzija
177d6ae493

+ 73 - 6
src/main/java/com/goafanti/common/dao/UserMidMapper.java

@@ -2,22 +2,86 @@ package com.goafanti.common.dao;
 
 import com.goafanti.common.model.UserMid;
 import org.apache.ibatis.annotations.Param;
+import org.springframework.data.domain.Pageable;
 
 import java.util.List;
 
+/**
+ * 用户中间表(UserMid)表数据库访问层
+ *
+ * @author makejava
+ * @since 2024-11-20 15:30:19
+ */
 public interface UserMidMapper {
-    int deleteByPrimaryKey(Integer id);
 
-    int insert(UserMid record);
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    UserMid queryById(Integer id);
 
-    int insertSelective(UserMid record);
 
-    UserMid selectByPrimaryKey(Integer id);
+    /**
+     * 查询指定行数据
+     *
+     * @param userMid  查询条件
+     * @param pageable 分页对象
+     * @return 对象列表
+     */
+    List<UserMid> findUserMidList(UserMid userMid, @Param("pageable") Pageable pageable);
 
-    int updateByPrimaryKeySelective(UserMid record);
+    /**
+     * 统计总行数
+     *
+     * @param userMid 查询条件
+     * @return 总行数
+     */
+    int findUserMidCount(UserMid userMid);
 
-    int updateByPrimaryKey(UserMid record);
+    /**
+     * 新增数据
+     *
+     * @param userMid 实例对象
+     * @return 影响行数
+     */
+    int insert(UserMid userMid);
 
+    /**
+     * 批量新增数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<UserMid> 实例对象列表
+     * @return 影响行数
+     */
+    int insertBatch(@Param("entities") List<UserMid> entities);
+
+    /**
+     * 批量新增或按主键更新数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<UserMid> 实例对象列表
+     * @return 影响行数
+     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
+     */
+    int insertOrUpdateBatch(@Param("entities") List<UserMid> entities);
+
+    /**
+     * 修改数据
+     *
+     * @param userMid 实例对象
+     * @return 影响行数
+     */
+    int update(UserMid userMid);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 影响行数
+     */
+    int deleteById(Integer id);
+
+    int insertSelective(UserMid userMid);
     int updateByUid(UserMid um);
 
     void updateListByUid(@Param("aid") String aid,@Param("updateFollow") Integer updateFollow, @Param("list")List<String> list);
@@ -25,4 +89,7 @@ public interface UserMidMapper {
     String getUserTaskNames(String uid) ;
 
     UserMid getUserDtails(String buyerId);
+
+    UserMid selectByUid(String uid);
 }
+

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1156 - 902
src/main/java/com/goafanti/common/mapper/UserMidMapper.xml


+ 33 - 29
src/main/java/com/goafanti/common/model/UserMid.java

@@ -4,137 +4,123 @@ import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.Date;
 
+
 /**
- * user_mid
- * @author 
+ * 用户中间表(UserMid)实体类
+ *
+ * @author makejava
+ * @since 2024-11-20 15:30:19
  */
 public class UserMid implements Serializable {
+    private static final long serialVersionUID = -18221698825175971L;
     /**
      * 任务编号
      */
     private Integer id;
-
     /**
      * 用户ID
      */
     private String uid;
-
     /**
      * 管理员ID
      */
     private String aid;
-
     /**
      * 最后跟进时间
      */
     private Date lastFollowTime;
-
     /**
      * 最后锁定时间
      */
     private Date lastSignTime;
-
     /**
      * 添加时间
      */
     private Date createTime;
-
     /**
      * 大客户 0否 1是
      */
     private Integer bigCustomer;
-
     /**
      * 修改人编号
      */
     private String updateAid;
-
     /**
      * 修改人名称
      */
     private String updateName;
-
     /**
      * 用户资料修改时间
      */
     private Date dateUpdateTime;
-
     /**
      * 渠道类别 1=其他,2=民主党派3=园区,4=民间组织,5=战略合作单位
      */
     private Integer channelType;
-
     /**
      * 退单标识
      */
     private Integer chargeback;
-
     /**
      * 会员标识
      */
     private Integer member;
-
     /**
      * 最后销售类型
      */
     private Integer lastSalesType;
-
     /**
      * 最后跟进方式
      */
     private Integer lastFollowType;
-
     /**
      * 跟进次数
      */
     private Integer followNumber;
-
     /**
      * 已签项目
      */
     private String taskNames;
-
     /**
      * 签单次数
      */
     private Integer signNumber;
-
     /**
      * 签单金额
      */
     private BigDecimal signAmount;
-
     /**
      * 最新签单时间
      */
     private Date lastSigningTime;
-
     /**
      * 第一次签单时间
      */
     private Date firstSigningTime;
-
     /**
      * 跟进部门
      */
     private String followDep;
-
     /**
      * 跟进说明
      */
     private String followExplain;
-
     /**
      * 跟进人
      */
     private String followAname;
-
     /**
      * 跟进人编号
      */
     private String followAid;
-
-    private static final long serialVersionUID = 1L;
+    /**
+     * 呼叫次数
+     */
+    private Integer callCount;
+    /**
+     * 呼叫时间
+     */
+    private Integer callDuration;
 
     public UserMid(String uid, Integer channelType) {
         this.uid = uid;
@@ -343,4 +329,22 @@ public class UserMid implements Serializable {
     public void setFollowAid(String followAid) {
         this.followAid = followAid;
     }
-}
+
+    public Integer getCallCount() {
+        return callCount;
+    }
+
+    public void setCallCount(Integer callCount) {
+        this.callCount = callCount;
+    }
+
+    public Integer getCallDuration() {
+        return callDuration;
+    }
+
+    public void setCallDuration(Integer callDuration) {
+        this.callDuration = callDuration;
+    }
+
+}
+

+ 28 - 9
src/main/java/com/goafanti/customer/service/impl/UserOutboundServiceImpl.java

@@ -5,19 +5,14 @@ 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.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;
-import com.goafanti.common.model.User;
+import com.goafanti.common.dao.*;
+import com.goafanti.common.model.*;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.HttpUtils;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.websocket.SystemWebSocketHandler;
 import com.goafanti.customer.bo.InputCallNumber;
 import com.goafanti.customer.bo.InputUserCallList;
@@ -46,6 +41,8 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<CallLogMapper> imple
     @Resource
     private UserMapper userMapper;
     @Resource
+    private UserMidMapper userMidMapper;
+    @Resource
     private AdminMapper adminMapper;
     @Resource
     private OrganizationContactBookMapper organizationContactBookMapper;
@@ -203,6 +200,11 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<CallLogMapper> imple
             count++;
             duration+=log.getDuration();
         }
+        UserMid mid=new UserMid();
+        mid.setUid(uid);
+        mid.setCallCount(count);
+        mid.setCallDuration(duration);
+        userMidMapper.updateByUid(mid);
 
     }
 
@@ -220,6 +222,23 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<CallLogMapper> imple
     public Object userCallList(InputUserCallList in) {
         CallLog select=new CallLog();
         select.setUid(in.getUid());
-        return findPage("findCallLogList","findCallLogCount",select,in.getPageNo(),in.getPageSize());
+        Pagination<?> page = findPage("findCallLogList", "findCallLogCount", select, in.getPageNo(), in.getPageSize());
+        UserMid userMid = userMidMapper.selectByUid(in.getUid());
+        Map<String,Object> sumMap = new HashMap();
+        int count=0;
+        int duration=0;
+        if (userMid!=null){
+            User user = userMapper.queryById(in.getUid());
+            count=userMid.getCallCount();
+            duration=userMid.getCallDuration();
+            sumMap.put("callCount",count);
+            sumMap.put("callDuration",duration);
+            sumMap.put("name",user.getNickname());
+        }
+        Map<String,Object> res = new HashMap();
+        res.put("page",page);
+        res.put("sum",sumMap);
+
+        return res;
     }
 }