Jelajahi Sumber

Merge remote-tracking branch 'origin/master'

ct 1 bulan lalu
induk
melakukan
295381d213

+ 13 - 0
fs-admin/src/main/java/com/fs/store/controller/FsUserController.java

@@ -1,6 +1,7 @@
 package com.fs.store.controller;
 
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
@@ -11,6 +12,8 @@ import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.ParseUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.company.dto.UserProjectDTO;
+import com.fs.course.domain.FsCourseWatchLog;
+import com.fs.course.service.IFsCourseWatchLogService;
 import com.fs.store.domain.FsUser;
 import com.fs.store.param.h5.FsUserPageListParam;
 import com.fs.store.service.IFsUserCompanyUserService;
@@ -41,6 +44,9 @@ public class FsUserController extends BaseController
 {
     @Autowired
     private IFsUserService fsUserService;
+
+    @Autowired
+    private IFsCourseWatchLogService fsCourseWatchLogService;
     @Autowired
     private IFsUserCompanyUserService userCompanyUserService;
 
@@ -67,6 +73,10 @@ public class FsUserController extends BaseController
         List<FSUserVO> list = fsUserService.selectFsUserVOListByProject(fsUser);
         for (FSUserVO vo : list){
             vo.setPhone(ParseUtils.parsePhone(vo.getPhone()));
+            Long watchCourseCount = fsCourseWatchLogService.selectFsCourseWatchLogCount(vo.getUserId(),vo.getProjectId());
+            if (ObjectUtils.isNotEmpty(watchCourseCount)){
+                vo.setWatchCourseCount(watchCourseCount);
+            }
         }
         return getDataTable(list);
     }
@@ -165,6 +175,9 @@ public class FsUserController extends BaseController
     @DeleteMapping("/delete/{id}")
     public AjaxResult delete(@PathVariable Long id)
     {
+        if (ObjectUtils.isEmpty(id)){
+            return AjaxResult.error("没有关联项目,请直接去会员管理进行处理!");
+        }
         return toAjax(userCompanyUserService.deleteFsUserCompanyUserById(id));
     }
 

+ 8 - 0
fs-service-system/src/main/java/com/fs/course/service/IFsCourseWatchLogService.java

@@ -132,4 +132,12 @@ public interface IFsCourseWatchLogService extends IService<FsCourseWatchLog> {
 
     void checkFsUserWatchStatus();
 
+    /**
+     * 根据用户id查询看课记录数量
+     *
+     * @param userId
+     * @param projectId
+     * @return
+     */
+    Long selectFsCourseWatchLogCount(Long userId, Long projectId);
 }

+ 5 - 1
fs-service-system/src/main/java/com/fs/course/service/impl/FsCourseWatchLogServiceImpl.java

@@ -52,7 +52,6 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -1029,6 +1028,11 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
 
     }
 
+    @Override
+    public Long selectFsCourseWatchLogCount(Long userId, Long projectId) {
+        return baseMapper.selectByWatchLjDay(userId,projectId);
+    }
+
     private void processDelCourseLogs(List<Long> logIds) {
 
     }

+ 2 - 3
fs-service-system/src/main/resources/mapper/store/FsUserMapper.xml

@@ -325,7 +325,7 @@
         SELECT distinct
         b.total_amount,b.last_buy_time,p.pay_money as number,p.payment_id,p.pay_time,
         u.*,
-        count(l.log_id) as watch_course_count, fcc.part_course_count, company_user.nick_name AS companyUserNickName, fcc.last_watch_date
+         fcc.part_course_count, company_user.nick_name AS companyUserNickName, fcc.last_watch_date
         ,company.company_name,
         ucu.project_id,
         ucu.id as companyUserId
@@ -356,9 +356,8 @@
         left join fs_user_company_user ucu on ucu.user_id = u.user_id
         LEFT JOIN company_user ON company_user.user_id = ucu.company_user_id
         LEFT JOIN company on company.company_id = company_user.company_id
-        LEFT JOIN fs_course_watch_log l on u.user_id = l.user_id
         <where>
-        1 = 1 and u.nickname is not null
+        1 = 1 and u.nickname is not null and ucu.id is not null
         <if test = "maps.nickname != null and  maps.nickname !='' " >
             AND u.nickname LIKE CONCAT("%",#{maps.nickname},"%")
         </if >