Преглед изворни кода

Merge remote-tracking branch 'origin/master'

yh пре 2 дана
родитељ
комит
2ce7ce0f42

+ 19 - 0
fs-ai-call-task/src/main/resources/application.yml

@@ -0,0 +1,19 @@
+# 开发环境配置
+server:
+  # 服务器的HTTP端口,默认为8080
+  port: 7005
+logging:
+  level:
+    org: INFO
+    com: DEBUG
+# Spring配置
+spring:
+  profiles:
+    active: dev
+#    active: druid-hcl
+#    active: druid-sxjz
+#    active: druid-hdt
+#    active: druid-myhk-test
+cid-group-no: 3
+# 配置了服务标记后,请在tenant_service_config 中配置服务应用租户ids信息
+tenant-service-marker: aiCall00

+ 20 - 0
fs-cid-workflow/src/main/resources/application.yml

@@ -0,0 +1,20 @@
+# 开发环境配置
+server:
+  # 服务器的HTTP端口,默认为8080
+  port: 7201
+logging:
+  level:
+    org: INFO
+    com: DEBUG
+# Spring配置
+spring:
+  profiles:
+    active: dev
+#    active: druid-hcl
+#    active: druid-sxjz
+#    active: druid-hdt
+#    active: druid-myhk-test
+cid-group-no: 3
+tenant-id: 11
+# 配置了服务标记后,请在tenant_service_config 中配置服务应用租户ids信息
+tenant-service-marker: cidWorkflow00

+ 4 - 1
fs-qw-api/src/main/java/com/fs/app/service/impl/OpenQwApiServiceImpl.java

@@ -262,6 +262,7 @@ public class OpenQwApiServiceImpl implements OpenQwApiService {
         qwUser.setIsDel(0);
         qwUser.setOpenid(openid);
         qwUser.setQwOpenUserId(apiUser.getUserid());
+        qwUser.setQwUserId(apiUser.getUserid());
 
         // 设置部门(取第一个部门)
         List<Integer> depts = apiUser.getDepartment();
@@ -290,7 +291,9 @@ public class OpenQwApiServiceImpl implements OpenQwApiService {
 
         int insertSuccess = 0, updateSuccess = 0;
         if (!toInsert.isEmpty()) {
-            insertSuccess = qwUserMapper.batchUpdateQwUser(toInsert);
+            // 新增必须走 batchInsertQwUser(INSERT 不含 id),否则 batchUpdateQwUser 会写入显式 id,
+            // MyBatis-Plus 易对空主键填充雪花 id,导致与期望的自增主键不一致。
+            insertSuccess = qwUserMapper.batchInsertQwUser(toInsert);
         }
         if (!toUpdate.isEmpty()) {
             updateSuccess = qwUserMapper.batchUpdateQwUser(toUpdate);

+ 6 - 0
fs-service/src/main/java/com/fs/company/domain/CrmCustomerCallLog.java

@@ -150,4 +150,10 @@ public class CrmCustomerCallLog extends BaseEntity {
      */
     @Excel(name = "外呼类型")
     private Integer callType;
+
+    /**
+     * 查询条件:最小通话时长(秒),仅过滤 call_time &gt; minCallTime 的记录;传 0 即可筛选“已接通”
+     * 非持久化字段,insert SQL 使用显式字段列表,不受影响
+     */
+    private Long minCallTime;
 }

+ 9 - 1
fs-service/src/main/java/com/fs/crm/mapper/CrmCustomerMapper.java

@@ -287,7 +287,9 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer> {
 
 
     @Select({"<script> " +
-            "select cu.*,c.create_time as customer_create_time,c.visit_status,c.remark,c.register_desc,c.register_submit_time,c.customer_code,c.customer_name,c.mobile,c.sex,c.weixin,c.address,c.is_receive,c.customer_type,c.source,c.tags,c.receive_time from crm_customer_user cu inner join crm_customer c on c.customer_user_id=cu.customer_user_id " +
+            "select cu.*,c.create_time as customer_create_time,c.visit_status,c.remark,c.register_desc,c.register_submit_time,c.customer_code,c.customer_name,c.mobile,c.sex,c.weixin,c.address,c.is_receive,c.customer_type,c.source,c.tags,c.receive_time," +
+            "(select ifnull(count(1),0) from crm_customer_call_log ccl where ccl.customer_id=c.customer_id and ccl.call_time &gt; 0) as manual_call_count " +
+            "from crm_customer_user cu inner join crm_customer c on c.customer_user_id=cu.customer_user_id " +
             "where cu.is_pool=0 " +
             "<if test = 'maps.companyId != null     '> " +
             "and cu.company_id =#{maps.companyId} " +
@@ -317,6 +319,12 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer> {
             "<if test = 'maps.isHisOrder != null and maps.isHisOrder==0      '> " +
             "and (select ifnull(count(1),0) from crm_customer_his_order h where h.customer_id=c.customer_id )  = 0 " +
             "</if>" +
+            "<if test = 'maps.isManualCall != null and maps.isManualCall==1      '> " +
+            "and (select ifnull(count(1),0) from crm_customer_call_log ccl where ccl.customer_id=c.customer_id and ccl.call_time &gt; 0)  &gt; 0 " +
+            "</if>" +
+            "<if test = 'maps.isManualCall != null and maps.isManualCall==0      '> " +
+            "and (select ifnull(count(1),0) from crm_customer_call_log ccl where ccl.customer_id=c.customer_id and ccl.call_time &gt; 0)  = 0 " +
+            "</if>" +
             "<if test = 'maps.customerType != null      '> " +
             "and c.customer_type IN " +
             "<foreach collection=\"maps.customerType.split(',')\"  item='item' index='index'  open='(' separator=',' close=')'> #{item} </foreach>"+

+ 3 - 0
fs-service/src/main/java/com/fs/crm/param/CrmMyCustomerListQueryParam.java

@@ -92,6 +92,9 @@ public class CrmMyCustomerListQueryParam extends BaseQueryParam
 
     private Integer isHisOrder;
 
+    /** 是否已手动外呼,1-已外呼,0-未外呼 */
+    private Integer isManualCall;
+
     private String corpId;
     /** 客户级别 */
     private Long customerLevel;

+ 3 - 0
fs-service/src/main/java/com/fs/crm/vo/CrmMyCustomerListQueryVO.java

@@ -138,4 +138,7 @@ public class CrmMyCustomerListQueryVO implements Serializable
 
     @Excel(name = "最新跟进内容")
     private String visitContent;
+
+    /** 手动外呼次数 */
+    private Integer manualCallCount;
 }

+ 4 - 1
fs-service/src/main/java/com/fs/qw/domain/QwUser.java

@@ -1,7 +1,9 @@
 package com.fs.qw.domain;
 
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.fs.common.annotation.Excel;
 import com.fs.common.core.domain.BaseEntity;
 import lombok.Data;
@@ -17,7 +19,8 @@ public class QwUser extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
 
-    /** id */
+    /** id(数据库自增;勿依赖应用侧雪花填充) */
+    @TableId(type = IdType.AUTO)
     private Long id;
 
     /** 企微用户id */

+ 1 - 1
fs-service/src/main/java/com/fs/qwApi/service/impl/QwApiServiceImpl.java

@@ -927,7 +927,7 @@ public class QwApiServiceImpl implements QwApiService {
 
     @Override
     public String getOpenUserid(String accessToken,String userId,String corpId) {
-        String openUserIdRedisKey = "corpId:" + userId;
+        String openUserIdRedisKey = "corpId:" + corpId + userId;
         String  redisResult= redisCache.getCacheObject(openUserIdRedisKey);
         if(StringUtils.isNotBlank(redisResult)){
             return redisResult;

+ 1 - 0
fs-service/src/main/resources/db/tenant-initTable.sql

@@ -3060,6 +3060,7 @@ CREATE TABLE `crm_customer`
     `next_time`             datetime NULL DEFAULT NULL COMMENT '下次跟进时间',
     `is_pool_rule`          tinyint NULL DEFAULT 1 COMMENT '是否采用入公海规则 0:否 1:是',
     `sys_visit_time`        datetime NULL DEFAULT NULL COMMENT '系统自建跟进时间',
+    `historical_communication` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '历史沟通内容',
     PRIMARY KEY (`customer_id`) USING BTREE,
     UNIQUE INDEX `customer_code`(`customer_code`) USING BTREE,
     INDEX                   `create_user_id`(`create_user_id`) USING BTREE,

+ 1 - 0
fs-service/src/main/resources/mapper/company/CrmCustomerCallLogMapper.xml

@@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="companyId != null">AND company_id = #{companyId}</if>
             <if test="companyUserId != null">AND company_user_id = #{companyUserId}</if>
             <if test="status != null">AND status = #{status}</if>
+            <if test="minCallTime != null">AND call_time &gt; #{minCallTime}</if>
         </where>
         order by create_time desc
     </select>

+ 1 - 1
fs-service/src/main/resources/mapper/qw/QwUserMapper.xml

@@ -343,7 +343,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </select>
 
-    <!-- 批量插入 - 补充完整字段 -->
+    <!-- 批量插入 - 不含主键 id,走数据库 AUTO_INCREMENT(勿与 batchUpdateQwUser 混用) -->
     <insert id="batchInsertQwUser">
         INSERT INTO qw_user (
         department, qw_user_name, corp_id, openid, qw_open_user_id,

+ 19 - 0
fs-wx-task/src/main/resources/application.yml

@@ -0,0 +1,19 @@
+# 开发环境配置
+server:
+  # 服务器的HTTP端口,默认为8080
+  port: 7007
+logging:
+  level:
+    org: INFO
+    com: DEBUG
+# Spring配置
+spring:
+  profiles:
+    active: dev
+#    active: druid-hcl
+#    active: druid-sxjz
+#    active: druid-hdt
+#    active: druid-myhk-test
+cid-group-no: 3
+# 配置了服务标记后,请在tenant_service_config 中配置服务应用租户ids信息
+tenant-service-marker: wxTask00