Jelajahi Sumber

companyApp:会员统计

ct 1 hari lalu
induk
melakukan
6e402dd243

+ 19 - 0
fs-company-app/src/main/java/com/fs/app/controller/FsUserCourseVideoController.java

@@ -4,7 +4,11 @@ import com.fs.app.annotation.Login;
 import com.fs.app.config.ImageStorageConfig;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.domain.ResponseResult;
+import com.fs.common.enums.BizResponseEnum;
 import com.fs.common.utils.StringUtils;
+import com.fs.company.domain.CompanyUser;
+import com.fs.company.service.ICompanyUserService;
+import com.fs.company.service.impl.CompanyServiceImpl;
 import com.fs.course.domain.FsUserCoursePeriod;
 import com.fs.course.param.FsCourseLinkCreateParam;
 import com.fs.course.param.FsWatchCourseTimeParam;
@@ -58,6 +62,8 @@ public class FsUserCourseVideoController extends AppBaseController {
 
     @Autowired
     private IFsUserCoursePeriodService fsUserCoursePeriodService;
+    @Autowired
+    private ICompanyUserService companyService;
 
     @Login
     @GetMapping("/pageList")
@@ -109,11 +115,24 @@ public class FsUserCourseVideoController extends AppBaseController {
                                                       @RequestParam(required = false, defaultValue = "1") Integer pageNum,
                                                       @RequestParam(required = false, defaultValue = "10") Integer pageSize) {
         log.debug("参与记录 keyword: {}, pageNum: {}, pageSize: {}", keyword, pageNum, pageSize);
+        String userId = getUserId();
         Map<String, Object> params = new HashMap<>();
+        //判断是否管理员 管理员查所有
+        CompanyUser companyUser = companyService.selectCompanyUserById(Long.valueOf(userId));
+        if (companyUser != null) {
+            if (companyUser.isAdmin()) {
+                params.put("companyId", companyUser.getCompanyId());
+            } else {
+                params.put("companyUserId", userId);
+            }
+        } else {
+            return ResponseResult.fail(BizResponseEnum.PARAM_ERROR);
+        }
         params.put("videoId", videoId);
         params.put("type", type);
         params.put("keyword", keyword);
 
+
         PageHelper.startPage(pageNum, pageSize);
         List<FsUserCourseParticipationRecordVO> record = fsUserCourseService.getParticipationRecordByMap(params);
         return ResponseResult.ok(new PageInfo<>(record));

+ 6 - 0
fs-service/src/main/resources/mapper/course/FsUserCourseMapper.xml

@@ -114,6 +114,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             or fu.phone = #{params.keyword}
             )
         </if>
+        <if test="params.companyUserId != null">
+            and fcwl.company_user_id = #{params.companyUserId}
+        </if>
+        <if test="params.companyId != null">
+            and fcwl.company_id = #{params.companyId}
+        </if>
         <choose>
             <when test="params.type == 0">
                 and (