Browse Source

feat:调整销售app的首页统计和详情统计(部分)

caoliqin 1 week ago
parent
commit
56aac0d4e7

+ 4 - 3
fs-service-system/src/main/java/com/fs/store/service/impl/FsUserServiceImpl.java

@@ -761,7 +761,8 @@ public class FsUserServiceImpl implements IFsUserService
             param.setCompanyId(companyUser.getCompanyId());
         }
         // 获取课程统计
-        Map<String, Long> couserMap = fsUserMapper.countUserCourse(param);
+//        Map<String, Long> couserMap = fsUserMapper.countUserCourse(param);
+        Map<String, Long> couserMap = fsUserMapper.countUserCourse2(param);
         if (couserMap != null) {
             fsUserStatisticsVO.setCourseWatchNum(couserMap.get("courseWatchNum").intValue()).setCourseCompleteNum(couserMap.get("courseCompleteNum").intValue());
 
@@ -799,8 +800,8 @@ public class FsUserServiceImpl implements IFsUserService
 
     @Override
     public FsUserStatisticsVO userStatisticsDetails(UserStatisticsCommonParam param) {
-//        FsUserStatisticsVO userStatisticsVO = getUserStatistics(param);
-        FsUserStatisticsVO userStatisticsVO = getUserStatistics2(param);
+        FsUserStatisticsVO userStatisticsVO = getUserStatistics(param);
+//        FsUserStatisticsVO userStatisticsVO = getUserStatistics2(param);
 
         // 判断是否是管理员
         CompanyUser companyUser = companyUserMapper.selectCompanyUserById(param.getUserId());

+ 17 - 4
fs-service-system/src/main/resources/mapper/store/FsUserMapper.xml

@@ -1769,7 +1769,7 @@
         SELECT
         (
         SELECT
-        count(1)
+        count(DISTINCT l.user_id)
         FROM
         fs_course_watch_log l
         LEFT JOIN company_user ON l.company_user_id = company_user.user_id
@@ -1787,13 +1787,20 @@
             <if test="videoId != null and videoId != ''">
                 AND l.video_id = #{videoId}
             </if>
+            <if test="startTime != null and startTime !='' ">
+                and l.create_time &gt;= #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and l.create_time &lt;= #{endTime}
+            </if>
+            -- 单独通过销售id查询
             <if test="companyUserId != null and companyUserId != ''">
-                AND l.user_id = #{companyUserId}
+                AND l.company_user_id = #{companyUserId}
             </if>
         ) as courseWatchNum,
         (
         SELECT
-        count(1)
+        count(DISTINCT l.user_id)
         FROM
         fs_course_watch_log l
         LEFT JOIN company_user ON l.company_user_id = company_user.user_id
@@ -1811,9 +1818,15 @@
         <if test="videoId != null and videoId != ''">
             AND l.video_id = #{videoId}
         </if>
+        <if test="startTime != null and startTime !='' ">
+            and l.create_time &gt;= #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and l.create_time &lt;= #{endTime}
+        </if>
         -- 单独通过销售id查询
         <if test="companyUserId != null and companyUserId != ''">
-            AND l.user_id = #{companyUserId}
+            AND l.company_user_id = #{companyUserId}
         </if>
         ) as courseCompleteNum
     </select>