Browse Source

需求表处理

wangxy 3 days ago
parent
commit
b1f1ddf9c3
20 changed files with 231 additions and 50 deletions
  1. 8 0
      fs-admin/src/main/java/com/fs/course/controller/FsUserCourseController.java
  2. 10 0
      fs-company-app/src/main/java/com/fs/app/controller/FsUserController.java
  3. 6 0
      fs-company-app/src/main/resources/logback.xml
  4. 4 1
      fs-company/src/main/java/com/fs/user/FsUserAdminController.java
  5. 5 0
      fs-service/src/main/java/com/fs/company/mapper/CompanyUserUserMapper.java
  6. 11 0
      fs-service/src/main/java/com/fs/course/mapper/FsUserCourseMapper.java
  7. 5 0
      fs-service/src/main/java/com/fs/course/param/FsCourseWatchCommentPageParam.java
  8. 5 0
      fs-service/src/main/java/com/fs/course/service/IFsUserCourseService.java
  9. 6 0
      fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseServiceImpl.java
  10. 3 0
      fs-service/src/main/java/com/fs/his/domain/FsPackage.java
  11. 4 0
      fs-service/src/main/java/com/fs/his/mapper/FsPackageMapper.java
  12. 5 0
      fs-service/src/main/java/com/fs/his/service/IFsUserService.java
  13. 60 37
      fs-service/src/main/java/com/fs/his/service/impl/FsPackageServiceImpl.java
  14. 48 4
      fs-service/src/main/java/com/fs/his/service/impl/FsUserServiceImpl.java
  15. 4 0
      fs-service/src/main/java/com/fs/his/vo/FsPackageListVO.java
  16. 10 0
      fs-service/src/main/java/com/fs/store/param/h5/FsUserPageListParam.java
  17. 3 0
      fs-service/src/main/resources/mapper/company/CompanyUserUserMapper.xml
  18. 11 0
      fs-service/src/main/resources/mapper/course/FsCourseWatchCommentMapper.xml
  19. 3 0
      fs-service/src/main/resources/mapper/his/FsPackageMapper.xml
  20. 20 8
      fs-service/src/main/resources/mapper/his/FsUserMapper.xml

+ 8 - 0
fs-admin/src/main/java/com/fs/course/controller/FsUserCourseController.java

@@ -357,4 +357,12 @@ public class FsUserCourseController extends BaseController
         redisCacheUtil.delRedisKey("cache:video");
         return R.ok();
     }
+     /**
+     * 查询项目下的课程名称
+     */
+    @GetMapping("/getCourseByProject/{projectId}")
+    public R getCourseByProject(@PathVariable Long projectId){
+        List<FsUserCourse> courseNames = fsUserCourseService.selectCourseNameByProjectId(projectId);
+        return R.ok().put("data", courseNames);
+    }
 }

+ 10 - 0
fs-company-app/src/main/java/com/fs/app/controller/FsUserController.java

@@ -4,6 +4,7 @@ package com.fs.app.controller;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.fs.app.annotation.Login;
+import com.fs.app.annotation.LoginUser;
 import com.fs.app.config.ImageStorageConfig;
 import com.fs.app.param.FsUserProjectUpdateParam;
 import com.fs.app.param.FsUserTagUpdateParam;
@@ -83,6 +84,7 @@ public class FsUserController extends AppBaseController {
     @Autowired
     private IFsUserProjectTagService userProjectTagService;
 
+
     @Login
     @PostMapping("/pageList")
     @ApiOperation("用户会员分页列表")
@@ -204,6 +206,14 @@ public class FsUserController extends AppBaseController {
         return ResponseResult.ok(fsUserStatisticsVO);
     }
 
+    @Login
+    @PostMapping("/syncCompanyUser")
+    public  R syncCompanyUser(){
+        long userId = Long.parseLong(getUserId());
+        long companyId = getCompanyId();
+        return R.ok(fsUserService.syncCompanyUser(userId, companyId));
+    }
+
     @Login
     @GetMapping("/firstPage/userRanking")
     @ApiOperation("首页数据/详情-销售排行榜统计")

+ 6 - 0
fs-company-app/src/main/resources/logback.xml

@@ -80,6 +80,12 @@
 		<appender-ref ref="console" />
 	</root>
 
+    <Logger name="com.fs.his.mapper" level="debug"/>
+    <Logger name="com.fs.course.mapper" level="debug"/>
+    <Logger name="com.fs.company.mapper" level="debug"/>
+    <Logger name="com.fs.hisStore.mapper" level="debug"/>
+    <Logger name="org.apache.ibatis" level="debug"/>
+
 	<!--系统操作日志-->
     <root level="info">
         <appender-ref ref="file_info" />

+ 4 - 1
fs-company/src/main/java/com/fs/user/FsUserAdminController.java

@@ -68,7 +68,7 @@ public class FsUserAdminController extends BaseController {
     @PostMapping("/list")
     @ApiOperation("会员列表(与移动端使用的相同查询)")
     public TableDataInfo pageList(@RequestBody FsUserPageListParam param) {
-        //startPage();
+        startPage();
 
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
        /* if (param.getIsMyFsUser()){
@@ -78,6 +78,9 @@ public class FsUserAdminController extends BaseController {
             param.setCompanyId(loginUser.getCompany().getCompanyId());
         }*/
         param.setCompanyId(loginUser.getCompany().getCompanyId());
+        param.setSaleUserId(String.valueOf(loginUser.getUser().getUserId()));
+        param.setIsAdmin(loginUser.getUser().isAdmin());
+        param.setDeptId(loginUser.getUser().getDeptId());
         if(param.getPhone()!=null && !"".equals(param.getPhone())){
             param.setPhone(PhoneUtil.encryptPhone(param.getPhone()));
         }

+ 5 - 0
fs-service/src/main/java/com/fs/company/mapper/CompanyUserUserMapper.java

@@ -65,4 +65,9 @@ public interface CompanyUserUserMapper
      * 查询销售关联会员
      */
     List<MyMemberVO> selectFsUserByCompanyUserId(@Param("companyUserId") Long companyUserId, @Param("keyword") String keyword);
+
+    /**
+     * 销售是否存在会员
+     */
+    int countFsUserByCompanyUserId(@Param("companyUserId") Long companyUserId);
 }

+ 11 - 0
fs-service/src/main/java/com/fs/course/mapper/FsUserCourseMapper.java

@@ -335,4 +335,15 @@ public interface FsUserCourseMapper
      */
     @Update("update fs_user_course set config_json = #{configJson} where course_id = #{id}")
     void editConfig(@Param("id") Long id, @Param("configJson") String configJson);
+
+    /**
+     * 查询项目下的课程名称
+     */
+    @Select("select course_id,course_name from fs_user_course where project = #{projectId} and is_del = 0")
+    List<FsUserCourse> selectCourseNameByProjectId(@Param("projectId") Long projectId);
+    /**
+     * 查询所有课程
+     */
+    @Select("select * from fs_user_course where is_del = 0")
+    List<FsUserCourse> selectAllCourse();
 }

+ 5 - 0
fs-service/src/main/java/com/fs/course/param/FsCourseWatchCommentPageParam.java

@@ -39,4 +39,9 @@ public class FsCourseWatchCommentPageParam extends BaseEntity{
     @Excel(name = "视频id")
     private Long videoId;
 
+    /**
+     * 类型 0 课程 1 视频
+     */
+    private Long type;
+
 }

+ 5 - 0
fs-service/src/main/java/com/fs/course/service/IFsUserCourseService.java

@@ -140,4 +140,9 @@ public interface IFsUserCourseService
      * 修改课堂配置
      */
     void editConfig(Long id, String configJson);
+
+    /**
+     * 查询项目下的课程名称
+     */
+    List<FsUserCourse> selectCourseNameByProjectId(Long projectId);
 }

+ 6 - 0
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseServiceImpl.java

@@ -770,6 +770,12 @@ public class FsUserCourseServiceImpl implements IFsUserCourseService
         fsUserCourseMapper.editConfig(id, configJson);
     }
 
+    @Override
+    public List<FsUserCourse> selectCourseNameByProjectId(Long projectId) {
+        List<FsUserCourse> courseNames = fsUserCourseMapper.selectCourseNameByProjectId(projectId);
+        return courseNames != null ? courseNames : Collections.emptyList();
+    }
+
 
     private Graphics2D initializeGraphics(BufferedImage combined) {
         Graphics2D graphics = combined.createGraphics();

+ 3 - 0
fs-service/src/main/java/com/fs/his/domain/FsPackage.java

@@ -104,4 +104,7 @@ public class FsPackage extends BaseEntity
     /** 节气 */
     private Long solarTerm;
     private String appIds;
+
+    /** 课程id */
+    private  Long  courseId;
 }

+ 4 - 0
fs-service/src/main/java/com/fs/his/mapper/FsPackageMapper.java

@@ -44,6 +44,10 @@ public interface FsPackageMapper
      */
     public int insertFsPackage(FsPackage fsPackage);
 
+    //检查课程是否已被绑定
+    @Select("SELECT COUNT(*) FROM fs_package WHERE course_id = #{courseId}")
+    boolean existsByCourseId(@Param("courseId") Long courseId);
+
     /**
      * 修改套餐包
      *

+ 5 - 0
fs-service/src/main/java/com/fs/his/service/IFsUserService.java

@@ -214,6 +214,11 @@ public interface IFsUserService
      */
     R updateStatus(Long userId);
 
+    /**
+     * 同步销售下的会员
+     */
+    R syncCompanyUser(Long companyUserId,Long companyId);
+
     List<FsCompanyUserListQueryVO> selectFsCompanyUserListQuery(FsUser fsUser);
 
     List<FsUser> getUserListLimit(FsUser fsUser);

+ 60 - 37
fs-service/src/main/java/com/fs/his/service/impl/FsPackageServiceImpl.java

@@ -5,11 +5,10 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.net.URL;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
+import java.util.stream.Collectors;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
@@ -17,6 +16,8 @@ import com.fs.common.core.domain.CustomMultipartFile;
 import com.fs.common.exception.ServiceException;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.StringUtils;
+import com.fs.course.domain.FsUserCourse;
+import com.fs.course.mapper.FsUserCourseMapper;
 import com.fs.his.dto.FsPackagePruductDTO;
 import com.fs.his.param.FsPackageListUParam;
 import com.fs.his.param.FsPackageParam;
@@ -50,6 +51,9 @@ public class FsPackageServiceImpl implements IFsPackageService {
     @Autowired
     private ISysConfigService sysConfigService;
 
+    @Autowired
+    private FsUserCourseMapper fsUserCourseMapper;
+
     /**
      * 查询套餐包
      *
@@ -79,27 +83,31 @@ public class FsPackageServiceImpl implements IFsPackageService {
      * @return 结果
      */
     @Override
-    @CacheEvict(value = "getPackageList",allEntries = true)
+    @CacheEvict(value = "getPackageList", allEntries = true)
     public int insertFsPackage(FsPackage fsPackage) {
 
         fsPackage.setCreateTime(DateUtils.getNowDate());
 //        if (fsPackage.getPackageSubType() != 1) {
-            if (fsPackage.getProductJson() != null) {
-                JSONArray objects = JSONUtil.parseArray(fsPackage.getProductJson());
-                List<FsPackagePruductDTO> products = JSONUtil.toList(objects, FsPackagePruductDTO.class);
-                BigDecimal toal = new BigDecimal(0);
-                for (FsPackagePruductDTO product : products) {
-                    toal = toal.add(product.getCostPrice().multiply(new BigDecimal(product.getCount())));
-                }
-                fsPackage.setProductCostPrice(toal);
-                SysConfig sysConfig = sysConfigService.selectConfigByConfigKey("his.store");
-                Map<String, Object> config = (Map<String, Object>) JSON.parse(sysConfig.getConfigValue());
-                Integer followRate = (Integer) config.get("followRate");
-                BigDecimal in = new BigDecimal((fsPackage.getCycle() / followRate) * 300);
-                fsPackage.setInquiryCostPrice(in);
-                fsPackage.setTotalCostPrice(toal.add(in));
+        if (fsPackage.getProductJson() != null) {
+            JSONArray objects = JSONUtil.parseArray(fsPackage.getProductJson());
+            List<FsPackagePruductDTO> products = JSONUtil.toList(objects, FsPackagePruductDTO.class);
+            BigDecimal toal = new BigDecimal(0);
+            for (FsPackagePruductDTO product : products) {
+                toal = toal.add(product.getCostPrice().multiply(new BigDecimal(product.getCount())));
             }
+            fsPackage.setProductCostPrice(toal);
+            SysConfig sysConfig = sysConfigService.selectConfigByConfigKey("his.store");
+            Map<String, Object> config = (Map<String, Object>) JSON.parse(sysConfig.getConfigValue());
+            Integer followRate = (Integer) config.get("followRate");
+            BigDecimal in = new BigDecimal((fsPackage.getCycle() / followRate) * 300);
+            fsPackage.setInquiryCostPrice(in);
+            fsPackage.setTotalCostPrice(toal.add(in));
+        }
 //        }
+        //检查课程是否已被绑定
+        if (fsPackageMapper.existsByCourseId(fsPackage.getCourseId())) {
+            throw new ServiceException("该课程已被绑定到其他套餐包");
+        }
         return fsPackageMapper.insertFsPackage(fsPackage);
     }
 
@@ -111,22 +119,22 @@ public class FsPackageServiceImpl implements IFsPackageService {
      */
     @Transactional(rollbackFor = Exception.class)
     @Override
-    @CacheEvict(value = "getPackageList",allEntries = true)
+    @CacheEvict(value = "getPackageList", allEntries = true)
     public int updateFsPackage(FsPackage fsPackage) {
         fsPackage.setUpdateTime(DateUtils.getNowDate());
 //        if (fsPackage.getPackageSubType() != null && fsPackage.getPackageSubType() != 1) {
-            if (fsPackage.getProductJson() != null) {
-                JSONArray objects = JSONUtil.parseArray(fsPackage.getProductJson());
-                List<FsPackagePruductDTO> products = JSONUtil.toList(objects, FsPackagePruductDTO.class);
-                BigDecimal toal = new BigDecimal(0);
-                for (FsPackagePruductDTO product : products) {
-                    toal = toal.add(product.getCostPrice().multiply(new BigDecimal(product.getCount())));
-                }
-                fsPackage.setProductCostPrice(toal);
-                BigDecimal in = new BigDecimal((fsPackage.getCycle() / 6) * 300);
-                fsPackage.setInquiryCostPrice(in);
-                fsPackage.setTotalCostPrice(toal.add(in));
+        if (fsPackage.getProductJson() != null) {
+            JSONArray objects = JSONUtil.parseArray(fsPackage.getProductJson());
+            List<FsPackagePruductDTO> products = JSONUtil.toList(objects, FsPackagePruductDTO.class);
+            BigDecimal toal = new BigDecimal(0);
+            for (FsPackagePruductDTO product : products) {
+                toal = toal.add(product.getCostPrice().multiply(new BigDecimal(product.getCount())));
             }
+            fsPackage.setProductCostPrice(toal);
+            BigDecimal in = new BigDecimal((fsPackage.getCycle() / 6) * 300);
+            fsPackage.setInquiryCostPrice(in);
+            fsPackage.setTotalCostPrice(toal.add(in));
+        }
 //        }
         //如果公域改私域 需要去掉disease_type值
         Integer isShow = fsPackage.getIsShow();
@@ -148,7 +156,7 @@ public class FsPackageServiceImpl implements IFsPackageService {
      * @return 结果
      */
     @Override
-    @CacheEvict(value = "getPackageList",allEntries = true)
+    @CacheEvict(value = "getPackageList", allEntries = true)
     public int deleteFsPackageByPackageIds(Long[] packageIds) {
 
         return fsPackageMapper.deleteFsPackageByPackageIds(packageIds);
@@ -176,7 +184,22 @@ public class FsPackageServiceImpl implements IFsPackageService {
         if (privateType != null) {
             fsPackage.setIsShow(0);
         }
-        return fsPackageMapper.selectFsPackageListVO(fsPackage);
+        //课程信息
+        List<FsUserCourse> fsUserCourses = fsUserCourseMapper.selectAllCourse();
+        Map<Long, FsUserCourse> map = CollectionUtil.isEmpty(fsUserCourses)
+                ? Collections.emptyMap()  // 返回不可变的空Map,更高效
+                : fsUserCourses.stream()
+                .collect(Collectors.toMap(FsUserCourse::getCourseId, a -> a));
+        List<FsPackageListVO> fsPackageListVOS = fsPackageMapper.selectFsPackageListVO(fsPackage);
+        if (!CollectionUtil.isEmpty(fsPackageListVOS)) {
+            for (FsPackageListVO fsPackageListVO : fsPackageListVOS) {
+                FsUserCourse fsUserCourse = map.getOrDefault(fsPackageListVO.getCourseId(), null);
+                if (fsUserCourse != null) {
+                    fsPackageListVO.setCourseName(fsUserCourse.getCourseName());
+                }
+            }
+        }
+        return fsPackageListVOS;
     }
 
     @Override
@@ -261,13 +284,13 @@ public class FsPackageServiceImpl implements IFsPackageService {
     }
 
     @Override
-    @CacheEvict(value = "getPackageList",allEntries = true)
+    @CacheEvict(value = "getPackageList", allEntries = true)
     public int updatePackagesStatus(Long[] packageIds, Long status) {
         return fsPackageMapper.updatePackagesStatus(packageIds, status);
     }
 
     @Override
-    public String convertImageToJpg(String imgUrl,Long packageId) {
+    public String convertImageToJpg(String imgUrl, Long packageId) {
         if (StringUtils.isBlank(imgUrl)) {
             throw new IllegalArgumentException("图片 URL 不能为空");
         }
@@ -308,7 +331,7 @@ public class FsPackageServiceImpl implements IFsPackageService {
             throw new RuntimeException(e);
         }
 
-        if (!imgUrl.equals(url) && packageId !=null) {
+        if (!imgUrl.equals(url) && packageId != null) {
             //更新数据库
             FsPackage temp = new FsPackage();
             temp.setPackageId(packageId);
@@ -333,7 +356,7 @@ public class FsPackageServiceImpl implements IFsPackageService {
     @Transactional
     public int bulkCopyFsPackageByPackage(Long[] packageIds) {
         List<FsPackage> list = fsPackageMapper.selectFsPackageListByIds(packageIds);
-        if(list != null && !list.isEmpty()){
+        if (list != null && !list.isEmpty()) {
             try {
                 for (FsPackage fsPackage : list) {
                     fsPackageMapper.insertFsPackage(fsPackage);

+ 48 - 4
fs-service/src/main/java/com/fs/his/service/impl/FsUserServiceImpl.java

@@ -26,6 +26,7 @@ import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.core.redis.RedisCache;
 import com.fs.common.enums.ImTypeEnum;
 import com.fs.common.exception.CustomException;
+import com.fs.common.exception.base.BaseException;
 import com.fs.common.param.LoginMaWxParam;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.DictUtils;
@@ -38,6 +39,7 @@ import com.fs.company.mapper.*;
 import com.fs.company.service.ICompanyTagService;
 import com.fs.course.domain.FsUserCompanyUser;
 import com.fs.course.mapper.FsCourseWatchLogMapper;
+import com.fs.course.mapper.FsUserCompanyUserMapper;
 import com.fs.course.mapper.FsUserCourseVideoMapper;
 import com.fs.course.param.CourseAnalysisParam;
 import com.fs.course.param.newfs.FsUserCourseBeMemberParam;
@@ -196,6 +198,12 @@ public class FsUserServiceImpl implements IFsUserService {
     @Autowired
     private FsCourseWatchLogMapper courseWatchLogMapper;
 
+    @Autowired
+    private FsUserCompanyUserMapper fsUserCompanyUserMapper;
+
+    @Autowired
+    private CompanyUserUserMapper companyUserUserMapper;
+
 
     /**
      * 查询用户
@@ -694,11 +702,18 @@ public class FsUserServiceImpl implements IFsUserService {
     @Override
     public TableDataInfo selectFsUserPageListNew(FsUserPageListParam param) {
         // 找出下级销售
-        String companyUserId = param.getCompanyUserId();
+        String companyUserId = param.getSaleUserId();
         if (StringUtils.isNotBlank(companyUserId)) {
             Long companyUser = Long.parseLong(companyUserId);
             Set<Long> userIds = companyUserCacheService.selectUserAllCompanyUserId(companyUser);
             if (userIds != null || userIds.size() <= 1) {
+                List<Integer> roles = fsUserCompanyUserMapper.selectCountByUserId(companyUser);
+                if (param.getDeptId() != null) {
+                    if (roles.contains(1)) {
+                        //部门经理需要查询对应部门下的销售
+                        userIds = (Set<Long>) fsUserCompanyUserMapper.selectUserIdByDeptId(param.getDeptId());
+                    }
+                }
                 if (param.getIsAdmin() != null && param.getIsAdmin()) {
                     List<CompanyUser> companyUsers = companyUserMapper.selectCompanyUserByCompanyId(param.getCompanyId());
                     userIds = companyUsers.stream().map(CompanyUser::getUserId).collect(Collectors.toSet());
@@ -706,7 +721,10 @@ public class FsUserServiceImpl implements IFsUserService {
             }
             param.setCompanyUserIds(userIds);
         }
-
+        // 如果有单个销售ID,就不传ID列表
+        if (param.getCompanyUserId() != null && !param.getCompanyUserId().isEmpty()) {
+            param.setCompanyUserIds(null); // 清空列表参数
+        }
         List<FsUserPageListVO> fsUserPageListVOS = fsUserMapper.selectFsUserPageListNew(param);
         Map<Long, CompanyTag> tagMap = companyTagCacheService.queryAllTagMap();
         //获取会员的最新的看课状态和最后看课时间
@@ -721,7 +739,7 @@ public class FsUserServiceImpl implements IFsUserService {
                 .map(user -> new UserProjectPair(user.getUserId(), user.getProjectId()))
                 .collect(Collectors.toList());
         Map<Object, Date> watchTimeMap = new HashMap<>();
-        if(CollectionUtils.isNotEmpty(pairs)){
+        if (CollectionUtils.isNotEmpty(pairs)) {
             List<Map<String, Object>> mapList = fsUserMapper.selectLastWatchTimeByUserAndProject(pairs);
             if (!CollectionUtils.isEmpty(mapList)) {
                 watchTimeMap = mapList.stream()
@@ -762,7 +780,7 @@ public class FsUserServiceImpl implements IFsUserService {
 //                    item.setCourseCountStatus(byUserId.getStatus());
                     item.setStopWatchDays(byUserId.getStopWatchDays());
                     item.setCompleteWatchDate(byUserId.getCompleteWatchDate());
-                    item.setLastWatchDate(watchTimeMap.getOrDefault(item.getUserId() + "_" + item.getProjectId(),null));
+                    item.setLastWatchDate(watchTimeMap.getOrDefault(item.getUserId() + "_" + item.getProjectId(), null));
                 }
                 FsUserLastCount fsUserCourseCount = countMap.get(item.getUserId());
                 if (fsUserCourseCount != null) {
@@ -1264,6 +1282,32 @@ public class FsUserServiceImpl implements IFsUserService {
         return R.ok();
     }
 
+    @Override
+    public R syncCompanyUser(Long companyUserId, Long companyId) {
+        int i = companyUserUserMapper.countFsUserByCompanyUserId(companyUserId);
+        FsUserCompanyUser fsUserCompanyUser = new FsUserCompanyUser();
+        fsUserCompanyUser.setCompanyUserId(companyUserId);
+        fsUserCompanyUser.setCompanyId(companyId);
+        List<FsUserCompanyUser> list = fsUserCompanyUserMapper.selectFsUserCompanyUserList(fsUserCompanyUser);
+        if (!CollectionUtils.isEmpty(list)) {
+            List<Long> uniqueUserIds = list.stream()
+                    .map(FsUserCompanyUser::getUserId)
+                    .distinct()
+                    .collect(Collectors.toList());
+            uniqueUserIds.forEach(u -> {
+                if (i < 1) {
+                    CompanyUserUser companyUserUser = new CompanyUserUser();
+                    companyUserUser.setCompanyId(companyId);
+                    companyUserUser.setCompanyUserId(companyUserId);
+                    companyUserUser.setUserId(u);
+                    companyUserUser.setCreateTime(new Date());
+                    companyUserUserMapper.insertCompanyUserUser(companyUserUser);
+                }
+            });
+        }
+        return R.ok();
+    }
+
     @Override
     public List<FsUserVO> selectFsUserVOListByProject(FsUser fsUser) {
         return fsUserMapper.selectFsUserVOListByProject(fsUser);

+ 4 - 0
fs-service/src/main/java/com/fs/his/vo/FsPackageListVO.java

@@ -67,4 +67,8 @@ public class FsPackageListVO extends BaseEntity {
     private BigDecimal totalPrice;
 
     private Long solarTerm;
+
+    private Long courseId;
+
+    private  String courseName;
 }

+ 10 - 0
fs-service/src/main/java/com/fs/store/param/h5/FsUserPageListParam.java

@@ -89,6 +89,16 @@ public class FsUserPageListParam implements Serializable {
      */
     private Boolean isHidePhoneMiddle = Boolean.TRUE;
 
+     /**
+     * 部门id
+     */
+    private Long deptId;
+
+    /**
+     * 当前销售id
+     */
+    private  String  saleUserId;
+
 
 }
 

+ 3 - 0
fs-service/src/main/resources/mapper/company/CompanyUserUserMapper.xml

@@ -48,6 +48,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             and fu.nick_name like concat('%', #{keyword}, '%')
         </if>
     </select>
+    <select id="countFsUserByCompanyUserId" resultType="java.lang.Integer">
+            select count(id) from company_user_user where company_user_id=#{companyUserId}
+    </select>
 
     <insert id="insertCompanyUserUser" parameterType="CompanyUserUser">
         insert into company_user_user

+ 11 - 0
fs-service/src/main/resources/mapper/course/FsCourseWatchCommentMapper.xml

@@ -65,7 +65,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 or  fs_user_course_video.title LIKE concat('%',#{keywords},'%')
                 )
             </if>
+            <if test="type != null and type == 0">
+                and fs_course_watch_comment.course_id is not null
+            </if>
+            <if test="type != null and type == 1">
+                and fs_course_watch_comment.video_id is not null
+            </if>
         </where>
+        ORDER BY
+        CASE
+        WHEN fs_course_watch_comment.update_time IS NOT NULL THEN fs_course_watch_comment.update_time
+        ELSE fs_course_watch_comment.create_time
+        END DESC
     </select>
 
     <select id="selectFsCourseWatchCommentByCommentId" parameterType="Long" resultMap="FsCourseWatchCommentResult">

+ 3 - 0
fs-service/src/main/resources/mapper/his/FsPackageMapper.xml

@@ -179,6 +179,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="description != null">description,</if>
             <if test="solarTerm != null">solar_term,</if>
             <if test="appIds != null">app_ids,</if>
+            <if test="courseId != null">course_id,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="packageName != null">#{packageName},</if>
@@ -224,6 +225,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="description != null">#{description},</if>
             <if test="solarTerm != null">#{solarTerm},</if>
             <if test="appIds != null">#{appIds},</if>
+            <if test="courseId != null">#{courseId},</if>
         </trim>
     </insert>
 
@@ -273,6 +275,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="description != null">description = #{description},</if>
             <if test="solarTerm != null">solar_term = #{solarTerm},</if>
             <if test="appIds != null ">app_ids = #{appIds},</if>
+            <if test="courseId != null">course_id = #{courseId},</if>
         </trim>
         where package_id = #{packageId}
     </update>

+ 20 - 8
fs-service/src/main/resources/mapper/his/FsUserMapper.xml

@@ -363,12 +363,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userId != null">
                 AND fs_user.user_id = #{userId}
             </if>
+
             <if test="companyId != null">
                 AND ucu.company_id = #{companyId}
             </if>
-            <if test="companyUserId != null and companyUserId != '' ">
+        <choose>
+            <when test="companyUserIds != null and companyUserIds.size > 0">
+                AND ucu.company_user_id in
+                <foreach collection="companyUserIds" item="item" index="index" open="(" separator="," close=")">
+                    ${item}
+                </foreach>
+            </when>
+            <when test="companyUserId != null and companyUserId != '' ">
                 AND ucu.company_user_id = #{companyUserId}
-            </if>
+            </when>
+        </choose>
+<!--            <if test="companyUserId != null and companyUserId != '' ">-->
+<!--                AND ucu.company_user_id = #{companyUserId}-->
+<!--            </if>-->
             <if test="registerStartTime != null and registerStartTime !='' ">
                 AND ucu.update_time &gt;= #{registerStartTime}
             </if>
@@ -377,12 +389,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 AND ucu.update_time < date_add(#{registerEndTime}, interval 1 day)
             ]]>
             </if>
-            <if test="companyUserIds != null and companyUserIds.size > 0">
-                AND ucu.company_user_id in
-                <foreach collection="companyUserIds" item="item" index="index" open="(" separator="," close=")">
-                    ${item}
-                </foreach>
-            </if>
+<!--            <if test="companyUserIds != null and companyUserIds.size > 0">-->
+<!--                AND ucu.company_user_id in-->
+<!--                <foreach collection="companyUserIds" item="item" index="index" open="(" separator="," close=")">-->
+<!--                    ${item}-->
+<!--                </foreach>-->
+<!--            </if>-->
             <if test="nickname != null and nickname != ''">
                 AND fs_user.nick_name like concat('%', #{nickname},'%')
             </if>