Browse Source

最近一个月的top7业务统计逻辑调整

王苗苗 3 tuần trước cách đây
mục cha
commit
e1e3bfa55c

+ 2 - 0
slibra-system/src/main/java/com/slibra/business/mapper/TCallRecordMapper.java

@@ -119,4 +119,6 @@ public interface TCallRecordMapper
     List<Top7Res> getTop7ResListByMonthAndSize(@Param("nowMonth") String nowMonth, @Param("size") Integer size);
 
     long getCallTimesEqualsDay(@Param("date") String date, @Param("type") Integer type);
+
+    int getCallInEqualsMonthNew(String month);
 }

+ 4 - 1
slibra-system/src/main/java/com/slibra/business/service/impl/TCallRecordServiceImpl.java

@@ -632,11 +632,14 @@ public class TCallRecordServiceImpl implements ITCallRecordService
         //获取当前的月份
         String nowMonth = DateUtils.parseDateToStr(DateUtils.YYYY_MM, nowDate);
         //本月业务类型 top7 处理
+        //2025年02月20日17:11:17 这里的查询意图不再走通话记录,走创哥的表
         List<Top7Res> top7ResList = this.tCallRecordMapper.getTop7ResListByMonthAndSize(nowMonth, DEFAULT_DAYS_QUERY_COUNT+1);
         //处理展示数据
         if(!CollectionUtils.isEmpty(top7ResList)) {
             //获取本月的所有的数据
-            int nowMonthSize = this.tCallRecordMapper.getCallInEqualsMonth(nowMonth);
+            //2025年02月20日17:11:17 这里的所有的数据不再走通话记录,走创哥的表
+//            int nowMonthSize = this.tCallRecordMapper.getCallInEqualsMonth(nowMonth);
+            int nowMonthSize = this.tCallRecordMapper.getCallInEqualsMonthNew(nowMonth);
             for (int i = 0; i < top7ResList.size(); i++) {
                 Top7Res top7Res = top7ResList.get(i);
                 top7Res.setIndex(i+1);

+ 37 - 3
slibra-system/src/main/resources/mapper/business/TCallRecordMapper.xml

@@ -537,11 +537,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         WHERE
             del_flag = 0
           AND category = 0
-          AND DATE_FORMAT(time_begin, '%Y-%m' ) = #{date}
+          AND DATE_FORMAT(time_begin, '%Y-%m' ) = #{month}
     </select>
 
-    <select id="getTop7ResListByMonthAndSize" resultType="com.slibra.business.res.Top7Res">
+
+    <select id="getCallInEqualsMonthNew" resultType="int">
         SELECT
+            COUNT(*)
+        FROM
+            botrecords
+        WHERE
+            DATE_FORMAT( req_time, '%Y-%m' ) = #{month}
+    </select>
+
+    <select id="getTop7ResListByMonthAndSize" resultType="com.slibra.business.res.Top7Res">
+        <!-- SELECT
             COUNT(*) total,
             bussiness_type name
         FROM
@@ -552,7 +562,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         GROUP BY
             bussiness_type
         ORDER BY total DESC
-            LIMIT #{size}
+            LIMIT #{size}  -->
+        SELECT
+        COUNT(*) total,
+        intent NAME
+        FROM
+        (
+        SELECT
+        CASE
+        WHEN
+        intent = '报修' THEN
+        '漏水报修' ELSE intent
+        END AS intent
+        FROM
+        botrecords
+        WHERE
+        1 = 1
+        AND intent IS NOT NULL
+        AND intent != ''
+        AND DATE_FORMAT( req_time, '%Y-%m' ) = #{nowMonth}
+        ) temp
+        GROUP BY
+        intent
+        ORDER BY
+        total DESC
+        LIMIT #{size}
     </select>