Browse Source

Merge branch 'master' into jdk-21

# Conflicts:
#	fs-admin/src/main/resources/application.yml
#	fs-qw-task/src/main/resources/application.yml
#	fs-qwhook-sop/src/main/resources/application.yml
#	fs-redis/src/main/resources/application.yml
#	fs-service/src/main/resources/application-config-druid-hdt.yml
#	fs-service/src/main/resources/application-config-druid-sxjz.yml
#	fs-service/src/main/resources/application-config-druid-xfk.yml
#	fs-service/src/main/resources/application-config-myhk.yml
#	fs-service/src/main/resources/config/drk/application-database.yml
#	fs-service/src/main/resources/config/fcky/application-database.yml
#	fs-user-app/src/main/resources/application.yml
#	fs-user-course/pom.xml
#	fs-user-course/src/main/java/com/fs/framework/config/MyBatisConfig.java
吴树波 1 week ago
parent
commit
3627fdd8fb
100 changed files with 2570 additions and 368 deletions
  1. 2 2
      .gitignore
  2. 3 2
      fs-admin/src/main/java/com/fs/company/controller/CompanyUserController.java
  3. 10 0
      fs-admin/src/main/java/com/fs/course/controller/FsUserCourseComplaintRecordController.java
  4. 2 0
      fs-admin/src/main/java/com/fs/course/controller/FsUserCoursePeriodController.java
  5. 12 0
      fs-admin/src/main/java/com/fs/course/controller/FsUserCourseVideoController.java
  6. 6 0
      fs-admin/src/main/java/com/fs/course/controller/FsUserTalentController.java
  7. 12 0
      fs-admin/src/main/java/com/fs/course/controller/FsUserVideoController.java
  8. 38 0
      fs-admin/src/main/java/com/fs/course/controller/FsVideoResourceController.java
  9. 1 1
      fs-admin/src/main/java/com/fs/his/controller/FsInquiryOrderController.java
  10. 12 1
      fs-admin/src/main/java/com/fs/his/controller/FsIntegralOrderController.java
  11. 114 0
      fs-admin/src/main/java/com/fs/his/controller/FsPhysicalReportTemplateController.java
  12. 140 0
      fs-admin/src/main/java/com/fs/his/controller/FsPhysicalReportTemplateFieldController.java
  13. 80 7
      fs-admin/src/main/java/com/fs/his/controller/FsStoreOrderController.java
  14. 65 11
      fs-admin/src/main/java/com/fs/his/controller/FsUserController.java
  15. 7 0
      fs-admin/src/main/java/com/fs/his/controller/FsUserOperationLogController.java
  16. 45 12
      fs-admin/src/main/java/com/fs/his/controller/HzOMSErpApiController.java
  17. 22 1
      fs-admin/src/main/java/com/fs/his/task/Task.java
  18. 103 0
      fs-admin/src/main/java/com/fs/qw/controller/QwIpadServerController.java
  19. 118 0
      fs-admin/src/main/java/com/fs/qw/controller/QwIpadServerLogController.java
  20. 118 0
      fs-admin/src/main/java/com/fs/qw/controller/QwIpadServerUserController.java
  21. 11 0
      fs-admin/src/main/java/com/fs/qw/qwTask/qwTask.java
  22. 1 0
      fs-common/src/main/java/com/fs/common/constant/FsConstants.java
  23. 6 0
      fs-company-app/src/main/java/com/fs/app/controller/AppBaseController.java
  24. 29 12
      fs-company-app/src/main/java/com/fs/app/controller/CompanyTagController.java
  25. 100 17
      fs-company-app/src/main/java/com/fs/app/controller/CompanyUserController.java
  26. 53 17
      fs-company-app/src/main/java/com/fs/app/controller/FsUserController.java
  27. 67 0
      fs-company-app/src/main/java/com/fs/app/controller/FsUserCoursePeriodController.java
  28. 3 20
      fs-company-app/src/main/java/com/fs/app/controller/FsUserCourseVideoController.java
  29. 153 124
      fs-company-app/src/main/java/com/fs/app/controller/WxCompanyUserController.java
  30. 46 0
      fs-company-app/src/main/java/com/fs/app/controller/qw/QwFsCourseWatchLogController.java
  31. 14 1
      fs-company-app/src/main/java/com/fs/app/param/CompanyUserChangeApplyParam.java
  32. 5 3
      fs-company-app/src/main/java/com/fs/app/param/CompanyUserParam.java
  33. 17 0
      fs-company-app/src/main/java/com/fs/app/param/FsUserProjectUpdateParam.java
  34. 3 3
      fs-company-app/src/main/java/com/fs/app/param/FsUserTagUpdateParam.java
  35. 22 0
      fs-company-app/src/main/java/com/fs/app/param/LoginMaWxParam.java
  36. 23 0
      fs-company-app/src/main/java/com/fs/app/param/TagProjectParam.java
  37. 76 0
      fs-company/src/main/java/com/fs/company/controller/company/CompanyUserChangeApplyController.java
  38. 11 0
      fs-company/src/main/java/com/fs/company/controller/company/CompanyUserController.java
  39. 8 0
      fs-company/src/main/java/com/fs/company/controller/course/FsUserOperationLogController.java
  40. 0 1
      fs-company/src/main/java/com/fs/company/controller/fastGpt/FastGptRoleController.java
  41. 23 0
      fs-company/src/main/java/com/fs/company/controller/param/CompanyUserChangeApplyAuditParam.java
  42. 2 0
      fs-company/src/main/java/com/fs/company/controller/qw/QwMaterialController.java
  43. 1 1
      fs-company/src/main/java/com/fs/company/controller/qw/QwUserVoiceLogController.java
  44. 23 20
      fs-company/src/main/java/com/fs/company/controller/qw/SopUserLogsInfoController.java
  45. 30 4
      fs-company/src/main/java/com/fs/company/controller/store/FsInquiryOrderController.java
  46. 7 0
      fs-company/src/main/java/com/fs/company/controller/store/FsStoreOrderController.java
  47. 14 5
      fs-company/src/main/java/com/fs/company/controller/store/FsUserController.java
  48. 8 5
      fs-doctor-app/src/main/java/com/fs/app/controller/InquiryOrderController.java
  49. 7 3
      fs-ipad-task/src/main/java/com/fs/app/service/IpadSendServer.java
  50. 37 48
      fs-ipad-task/src/main/java/com/fs/app/task/SendMsg.java
  51. 1 0
      fs-ipad-task/src/main/java/com/fs/framework/config/DataSourceConfig.java
  52. 18 13
      fs-qw-task/src/main/java/com/fs/app/controller/CommonController.java
  53. 73 0
      fs-qwhook-sop/src/main/java/com/fs/app/controller/ApisQwMaterialBySidebar.java
  54. 18 0
      fs-qwhook-sop/src/main/java/com/fs/app/controller/ApisQwUserController.java
  55. 72 0
      fs-qwhook-sop/src/main/java/com/fs/app/controller/QwMaterialBySidebar.java
  56. 18 0
      fs-qwhook-sop/src/main/java/com/fs/app/controller/QwUserController.java
  57. 81 0
      fs-qwhook/src/main/java/com/fs/app/controller/ApisQwMaterialBySidebar.java
  58. 20 0
      fs-qwhook/src/main/java/com/fs/app/controller/ApisQwUserController.java
  59. 73 0
      fs-qwhook/src/main/java/com/fs/app/controller/QwMaterialBySidebar.java
  60. 16 0
      fs-qwhook/src/main/java/com/fs/app/controller/QwUserController.java
  61. 18 0
      fs-redis/src/main/java/com/fs/app/redis/RedisKeyExpirationListener.java
  62. 0 0
      fs-redis/src/main/resources/application.yml
  63. 1 1
      fs-service/src/main/java/com/fs/common/param/LoginMaWxParam.java
  64. 2 0
      fs-service/src/main/java/com/fs/common/param/LoginParam.java
  65. 21 0
      fs-service/src/main/java/com/fs/company/domain/CompanyUser.java
  66. 4 0
      fs-service/src/main/java/com/fs/company/domain/CompanyUserChangeApplyUser.java
  67. 1 1
      fs-service/src/main/java/com/fs/company/mapper/CompanyMapper.java
  68. 2 0
      fs-service/src/main/java/com/fs/company/mapper/CompanyTagMapper.java
  69. 2 0
      fs-service/src/main/java/com/fs/company/mapper/CompanyTagUserMapper.java
  70. 2 0
      fs-service/src/main/java/com/fs/company/mapper/CompanyUserMapper.java
  71. 2 0
      fs-service/src/main/java/com/fs/company/service/ICompanyTagService.java
  72. 5 0
      fs-service/src/main/java/com/fs/company/service/ICompanyTagUserService.java
  73. 2 1
      fs-service/src/main/java/com/fs/company/service/ICompanyUserChangeApplyService.java
  74. 4 2
      fs-service/src/main/java/com/fs/company/service/ICompanyUserService.java
  75. 4 1
      fs-service/src/main/java/com/fs/company/service/impl/CompanyServiceImpl.java
  76. 11 0
      fs-service/src/main/java/com/fs/company/service/impl/CompanyTagServiceImpl.java
  77. 23 0
      fs-service/src/main/java/com/fs/company/service/impl/CompanyTagUserServiceImpl.java
  78. 14 9
      fs-service/src/main/java/com/fs/company/service/impl/CompanyUserChangeApplyServiceImpl.java
  79. 26 1
      fs-service/src/main/java/com/fs/company/service/impl/CompanyUserChangeApplyUserServiceImpl.java
  80. 14 2
      fs-service/src/main/java/com/fs/company/service/impl/CompanyUserServiceImpl.java
  81. 4 0
      fs-service/src/main/java/com/fs/company/vo/CompanyTagUserVO.java
  82. 9 0
      fs-service/src/main/java/com/fs/company/vo/CompanyUserChangeApplyUserVO.java
  83. 3 0
      fs-service/src/main/java/com/fs/company/vo/CompanyUserQwListVO.java
  84. 4 1
      fs-service/src/main/java/com/fs/config/ai/AiHostProper.java
  85. 15 0
      fs-service/src/main/java/com/fs/core/config/WxOpenProperties.java
  86. 11 0
      fs-service/src/main/java/com/fs/course/config/CourseConfig.java
  87. 18 4
      fs-service/src/main/java/com/fs/course/domain/FsUserCompanyUser.java
  88. 6 0
      fs-service/src/main/java/com/fs/course/domain/FsUserCourseVideo.java
  89. 74 0
      fs-service/src/main/java/com/fs/course/domain/FsVideoBarrage.java
  90. 18 1
      fs-service/src/main/java/com/fs/course/mapper/FsCourseSopAppLinkMapper.java
  91. 1 1
      fs-service/src/main/java/com/fs/course/mapper/FsCourseWatchLogMapper.java
  92. 14 0
      fs-service/src/main/java/com/fs/course/mapper/FsUserCompanyUserMapper.java
  93. 14 6
      fs-service/src/main/java/com/fs/course/mapper/FsUserCourseCommentMapper.java
  94. 6 1
      fs-service/src/main/java/com/fs/course/mapper/FsUserCourseMapper.java
  95. 19 1
      fs-service/src/main/java/com/fs/course/mapper/FsUserCourseVideoMapper.java
  96. 4 0
      fs-service/src/main/java/com/fs/course/mapper/FsUserCourseVideoRedPackageMapper.java
  97. 1 1
      fs-service/src/main/java/com/fs/course/mapper/FsUserTalentMapper.java
  98. 85 0
      fs-service/src/main/java/com/fs/course/mapper/FsVideoBarrageMapper.java
  99. 3 0
      fs-service/src/main/java/com/fs/course/mapper/FsVideoResourceMapper.java
  100. 3 0
      fs-service/src/main/java/com/fs/course/param/BatchVideoSvae.java

+ 2 - 2
.gitignore

@@ -6,8 +6,8 @@ target/
 !**/src/main/**/target/
 !**/src/test/**/target/
 #logback.xml
-application-druid-rt.yml
-application-druid-yjf.yml
+application.yml
+
 
 ### STS ###
 .apt_generated

+ 3 - 2
fs-admin/src/main/java/com/fs/company/controller/CompanyUserController.java

@@ -11,6 +11,7 @@ import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.service.ICompanyUserService;
+import com.fs.qw.dto.UserProjectDTO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -145,9 +146,9 @@ public class CompanyUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('company:companyUser:change')")
     @Log(title = "更换会员归属", businessType = BusinessType.OTHER)
     @PostMapping("/changeCompanyUser")
-    public AjaxResult changeCompanyUser(@RequestBody List<Long> userIds, @RequestParam Long companyUserId, @RequestParam Long companyId)
+    public AjaxResult changeCompanyUser(@RequestBody List<UserProjectDTO> users, @RequestParam Long companyUserId, @RequestParam Long companyId)
     {
-        return toAjax(companyUserService.changeCompanyUser(userIds, companyUserId, companyId));
+        return toAjax(companyUserService.changeCompanyUser(users, companyUserId, companyId));
     }
     /**
      * 根据登录的用户公司获取所有的销售

+ 10 - 0
fs-admin/src/main/java/com/fs/course/controller/FsUserCourseComplaintRecordController.java

@@ -75,6 +75,16 @@ public class FsUserCourseComplaintRecordController extends BaseController
         return AjaxResult.success(fsUserCourseComplaintRecordService.selectFsUserCourseComplaintRecordByRecordId(recordId));
     }
 
+    /**
+    * 获取 看课投诉记录详细信息-客户所属关系
+    */
+    @PreAuthorize("@ss.hasPermi('course:userCourseComplaintRecord:queryQw')")
+    @GetMapping(value = "/getInfoByUserId/{userId}")
+    public AjaxResult getInfoByUserId(@PathVariable("userId") Long userId)
+    {
+        return AjaxResult.success(fsUserCourseComplaintRecordService.selectFsUserCourseComplaintRecordByUserId(userId));
+    }
+
     /**
      * 新增看课投诉记录
      */

+ 2 - 0
fs-admin/src/main/java/com/fs/course/controller/FsUserCoursePeriodController.java

@@ -189,6 +189,7 @@ public class FsUserCoursePeriodController extends BaseController {
         return R.ok().put("data", periodRedPacketList);
     }
 
+    @Log(title = "按课程批量保存设置红包金额", businessType = BusinessType.UPDATE)
     @PreAuthorize("@ss.hasPermi('course:period:setCourseRedPacket')")
     @ApiOperation("按课程批量保存设置红包金额")
     @PostMapping("/batchRedPacket")
@@ -202,6 +203,7 @@ public class FsUserCoursePeriodController extends BaseController {
         return R.ok();
     }
 
+    @Log(title = "按营期批量保存设置红包金额", businessType = BusinessType.UPDATE)
     @PreAuthorize("@ss.hasPermi('course:period:setRedPacket')")
     @ApiOperation("按营期批量保存设置红包金额")
     @PostMapping("/batchRedPacket/byPeriod")

+ 12 - 0
fs-admin/src/main/java/com/fs/course/controller/FsUserCourseVideoController.java

@@ -7,11 +7,13 @@ import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.course.domain.FsUserCourse;
 import com.fs.course.domain.FsUserCourseVideo;
 import com.fs.course.mapper.FsUserCourseVideoMapper;
 import com.fs.course.param.BatchRedUpdate;
 import com.fs.course.param.BatchVideoSvae;
 import com.fs.course.param.CourseVideoUpdates;
+import com.fs.course.service.IFsUserCourseService;
 import com.fs.course.service.IFsUserCourseVideoService;
 import com.fs.his.vo.OptionsVO;
 import com.github.pagehelper.PageHelper;
@@ -39,6 +41,8 @@ public class FsUserCourseVideoController extends BaseController
 
     @Autowired
     private FsUserCourseVideoMapper fsUserCourseVideoMapper;
+    @Autowired
+    private IFsUserCourseService fsUserCourseService;
 
     /**
      * 查询课堂视频列表
@@ -87,6 +91,10 @@ public class FsUserCourseVideoController extends BaseController
         if (count>0){
             return AjaxResult.error("课程排序重复");
         }
+
+        // 设置项目ID
+        FsUserCourse fsUserCourse = fsUserCourseService.selectFsUserCourseByCourseId(fsUserCourseVideo.getCourseId());
+        fsUserCourseVideo.setProjectId(fsUserCourse.getProject());
         return toAjax(fsUserCourseVideoService.insertFsUserCourseVideo(fsUserCourseVideo));
     }
 
@@ -134,6 +142,10 @@ public class FsUserCourseVideoController extends BaseController
     }
     @PostMapping("/batchSaveVideo")
     public R batchSaveVideo(@RequestBody BatchVideoSvae vo){
+        // 设置项目ID
+        FsUserCourse fsUserCourse = fsUserCourseService.selectFsUserCourseByCourseId(vo.getCourseId());
+        vo.setProjectId(fsUserCourse.getProject());
+
         fsUserCourseVideoService.batchSaveVideo(vo);
         return R.ok();
     }

+ 6 - 0
fs-admin/src/main/java/com/fs/course/controller/FsUserTalentController.java

@@ -2,9 +2,12 @@ package com.fs.course.controller;
 
 import java.math.BigDecimal;
 import java.util.List;
+import java.util.Objects;
 
 import com.fs.common.core.domain.R;
 import com.fs.common.utils.DateUtils;
+import com.fs.common.utils.StringUtils;
+import com.fs.his.utils.PhoneUtil;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -121,6 +124,9 @@ public class FsUserTalentController extends BaseController
     @GetMapping("/listBySearch")
     public R listBySearCh(FsUserTalent fsUserTalent)
     {
+        if (Objects.nonNull(fsUserTalent) && StringUtils.isNotBlank(fsUserTalent.getPhone())){
+            fsUserTalent.setPhone(PhoneUtil.encryptPhone(fsUserTalent.getPhone()));
+        }
         List<FsUserTalent> list = fsUserTalentService.selectFsUserTalentList(fsUserTalent);
         return R.ok().put("data",list);
     }

+ 12 - 0
fs-admin/src/main/java/com/fs/course/controller/FsUserVideoController.java

@@ -9,9 +9,11 @@ import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.course.domain.FsUserCourseVideo;
 import com.fs.course.domain.FsUserVideo;
 import com.fs.course.domain.FsVideoResource;
 import com.fs.course.param.*;
+import com.fs.course.service.IFsUserCourseVideoService;
 import com.fs.course.service.IFsUserVideoService;
 import com.fs.course.service.IFsVideoResourceService;
 import com.fs.course.service.impl.TencentCloudCosService;
@@ -55,6 +57,9 @@ public class FsUserVideoController extends BaseController
     @Autowired
     private IFsVideoResourceService iFsVideoResourceService;
 
+    @Autowired
+    private IFsUserCourseVideoService fsUserCourseVideoService;
+
     /**
      * 查询课堂视频列表
      */
@@ -354,6 +359,13 @@ public class FsUserVideoController extends BaseController
             iFsVideoResourceService.updateById(videoMap);
             log.info("成功更新视频转码状态,视频ID: {}", video.getId());
 
+
+            FsUserCourseVideo fsUserCourseVideo = fsUserCourseVideoService.selectByFileKey(video.getFileKey());
+            fsUserCourseVideo.setLineOne(video.getLine1().replace(inputPath,transcodeFileKey));
+            fsUserCourseVideo.setTranscodeFileKey(transcodeFileKey);
+            fsUserCourseVideo.setIsTranscode(1);
+            fsUserCourseVideoService.updateFsUserCourseVideo(fsUserCourseVideo);
+
             return R.ok();
         } catch (Exception e) {
             log.error("处理视频转码请求时发生异常", e);

+ 38 - 0
fs-admin/src/main/java/com/fs/course/controller/FsVideoResourceController.java

@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.time.LocalDateTime;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 资源库管理
@@ -102,6 +103,43 @@ public class FsVideoResourceController extends BaseController {
         return AjaxResult.success();
     }
 
+    /**
+     * 批量修改视频分类
+     * @param typeId
+     * @param typeSubId
+     * @param ids
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('course:videoResource:batchUpdateClass')")
+    @Log(title = "视频素材库", businessType = BusinessType.UPDATE)
+    @PostMapping("/batchUpdateClass")
+    public AjaxResult batchUpdateClass(@RequestParam("typeId") Long typeId,
+                                       @RequestParam("typeSubId") Long typeSubId,
+                                       @RequestParam("ids") String ids) {
+        if(typeId == null || typeId <= 0){
+            return AjaxResult.error("请选择分类");
+        }
+        if(typeSubId == null || typeSubId <= 0){
+            return AjaxResult.error("请选择子分类");
+        }
+        if(ids == null || ids.isEmpty()){
+            return AjaxResult.error("请选择要修改的分类");
+        }
+
+        // 将ids字符串分割为ID列表
+        List<String> idList = Arrays.asList(ids.split(","));
+
+        // 创建更新条件
+        Wrapper<FsVideoResource> updateWrapper = Wrappers.<FsVideoResource>lambdaUpdate()
+                .set(FsVideoResource::getTypeId, typeId)
+                .set(FsVideoResource::getTypeSubId, typeSubId)
+                .in(FsVideoResource::getId, idList.stream().map(Long::valueOf).collect(Collectors.toList()));
+
+        // 执行批量更新
+        fsVideoResourceService.update(updateWrapper);
+        return AjaxResult.success();
+    }
+
     @PreAuthorize("@ss.hasPermi('course:videoResource:batchAdd')")
     @Log(title = "视频素材库", businessType = BusinessType.INSERT)
     @PostMapping("/batchAddVideoResource")

+ 1 - 1
fs-admin/src/main/java/com/fs/his/controller/FsInquiryOrderController.java

@@ -157,7 +157,7 @@ public class FsInquiryOrderController extends BaseController
     @GetMapping(value = "/sendMsg/{orderId}")
     public AjaxResult sendMsg(@PathVariable("orderId") Long orderId)
     {
-        ;
+
         return AjaxResult.success(fsInquiryOrderService.sendStartMsg(orderId));
     }
     /**

+ 12 - 1
fs-admin/src/main/java/com/fs/his/controller/FsIntegralOrderController.java

@@ -1,6 +1,7 @@
 package com.fs.his.controller;
 
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
@@ -16,6 +17,7 @@ import com.fs.his.enums.ShipperCodeEnum;
 import com.fs.his.param.FsIntegralOrderParam;
 import com.fs.his.service.IFsExpressService;
 import com.fs.his.service.IFsIntegralOrderService;
+import com.fs.his.utils.PhoneUtil;
 import com.fs.his.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -66,8 +68,17 @@ public class FsIntegralOrderController extends BaseController
     {
         List<FsIntegralOrder> list = fsIntegralOrderService.selectFsIntegralOrderList(fsIntegralOrder);
         for (FsIntegralOrder vo : list) {
+            //商品名称以及原价赋值
+            String itemJson = vo.getItemJson();
+            if(StringUtils.isNotBlank(itemJson)){
+                JSONObject jsonObject = JSONObject.parseObject(itemJson);
+                vo.setGoodsName(jsonObject.getString("goodsName"));
+                vo.setOtPrice(jsonObject.getBigDecimal("otPrice"));
+            }
             if (vo.getUserPhone()!=null&&!vo.getUserPhone().equals("")){
-                vo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+                if(vo.getUserPhone().chars().allMatch(Character::isDigit)){continue;}
+//                vo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+                vo.setUserPhone(PhoneUtil.decryptPhone(vo.getUserPhone()));
             }
         }
         ExcelUtil<FsIntegralOrder> util = new ExcelUtil<FsIntegralOrder>(FsIntegralOrder.class);

+ 114 - 0
fs-admin/src/main/java/com/fs/his/controller/FsPhysicalReportTemplateController.java

@@ -0,0 +1,114 @@
+package com.fs.his.controller;
+
+import java.util.List;
+
+import com.fs.common.core.domain.model.LoginUser;
+import com.fs.common.utils.ServletUtils;
+import com.fs.framework.web.service.TokenService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.his.domain.FsPhysicalReportTemplate;
+import com.fs.his.service.IFsPhysicalReportTemplateService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 体检报告模板Controller
+ * 
+ * @author fs
+ * @date 2025-07-23
+ */
+@RestController
+@RequestMapping("/his/physicalReportTemplate")
+public class FsPhysicalReportTemplateController extends BaseController
+{
+    @Autowired
+    private IFsPhysicalReportTemplateService fsPhysicalReportTemplateService;
+
+    @Autowired
+    private TokenService tokenService;
+
+    /**
+     * 查询体检报告模板列表
+     */
+    @PreAuthorize("@ss.hasPermi('his:physicalReportTemplate:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FsPhysicalReportTemplate fsPhysicalReportTemplate)
+    {
+        startPage();
+        List<FsPhysicalReportTemplate> list = fsPhysicalReportTemplateService.selectFsPhysicalReportTemplateList(fsPhysicalReportTemplate);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出体检报告模板列表
+     */
+    @PreAuthorize("@ss.hasPermi('his:physicalReportTemplate:export')")
+    @Log(title = "体检报告模板", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FsPhysicalReportTemplate fsPhysicalReportTemplate)
+    {
+        List<FsPhysicalReportTemplate> list = fsPhysicalReportTemplateService.selectFsPhysicalReportTemplateList(fsPhysicalReportTemplate);
+        ExcelUtil<FsPhysicalReportTemplate> util = new ExcelUtil<FsPhysicalReportTemplate>(FsPhysicalReportTemplate.class);
+        return util.exportExcel(list, "体检报告模板数据");
+    }
+
+    /**
+     * 获取体检报告模板详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('his:physicalReportTemplate:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") String id)
+    {
+        return AjaxResult.success(fsPhysicalReportTemplateService.selectFsPhysicalReportTemplateById(id));
+    }
+
+    /**
+     * 新增体检报告模板
+     */
+    @PreAuthorize("@ss.hasPermi('his:physicalReportTemplate:add')")
+    @Log(title = "体检报告模板", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FsPhysicalReportTemplate fsPhysicalReportTemplate)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        fsPhysicalReportTemplate.setCreateBy(String.valueOf(loginUser.getUserId()));
+        return toAjax(fsPhysicalReportTemplateService.insertFsPhysicalReportTemplate(fsPhysicalReportTemplate));
+    }
+
+    /**
+     * 修改体检报告模板
+     */
+    @PreAuthorize("@ss.hasPermi('his:physicalReportTemplate:edit')")
+    @Log(title = "体检报告模板", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsPhysicalReportTemplate fsPhysicalReportTemplate)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        fsPhysicalReportTemplate.setUpdateBy(String.valueOf(loginUser.getUserId()));
+        return toAjax(fsPhysicalReportTemplateService.updateFsPhysicalReportTemplate(fsPhysicalReportTemplate));
+    }
+
+    /**
+     * 删除体检报告模板
+     */
+    @PreAuthorize("@ss.hasPermi('his:physicalReportTemplate:remove')")
+    @Log(title = "体检报告模板", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable String[] ids)
+    {
+        return toAjax(fsPhysicalReportTemplateService.deleteFsPhysicalReportTemplateByIds(ids));
+    }
+}

+ 140 - 0
fs-admin/src/main/java/com/fs/his/controller/FsPhysicalReportTemplateFieldController.java

@@ -0,0 +1,140 @@
+package com.fs.his.controller;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fs.common.core.domain.model.LoginUser;
+import com.fs.common.exception.ServiceException;
+import com.fs.common.utils.ServletUtils;
+import com.fs.common.utils.StringUtils;
+import com.fs.framework.web.service.TokenService;
+import com.fs.his.dto.FsPhysicalReportTemplateFieldDTO;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.his.domain.FsPhysicalReportTemplateField;
+import com.fs.his.service.IFsPhysicalReportTemplateFieldService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 体检报告模板字段Controller
+ *
+ * @author fs
+ * @date 2025-07-24
+ */
+@RestController
+@RequestMapping("/his/physicalReportTemplateField")
+public class FsPhysicalReportTemplateFieldController extends BaseController {
+    @Autowired
+    private IFsPhysicalReportTemplateFieldService fsPhysicalReportTemplateFieldService;
+
+    @Autowired
+    private TokenService tokenService;
+
+    /**
+     * 查询体检报告模板字段列表
+     */
+    @PreAuthorize("@ss.hasPermi('his:physicalReportTemplateField:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FsPhysicalReportTemplateField fsPhysicalReportTemplateField) {
+        startPage();
+        List<FsPhysicalReportTemplateField> list = fsPhysicalReportTemplateFieldService.selectFsPhysicalReportTemplateFieldList(fsPhysicalReportTemplateField);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出体检报告模板字段列表
+     */
+    @PreAuthorize("@ss.hasPermi('his:physicalReportTemplateField:export')")
+    @Log(title = "体检报告模板字段", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FsPhysicalReportTemplateField fsPhysicalReportTemplateField) {
+        List<FsPhysicalReportTemplateField> list = fsPhysicalReportTemplateFieldService.selectFsPhysicalReportTemplateFieldList(fsPhysicalReportTemplateField);
+        ExcelUtil<FsPhysicalReportTemplateField> util = new ExcelUtil<FsPhysicalReportTemplateField>(FsPhysicalReportTemplateField.class);
+        return util.exportExcel(list, "体检报告模板字段数据");
+    }
+
+    /**
+     * 获取体检报告模板字段详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('his:physicalReportTemplateField:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") String id) {
+        return AjaxResult.success(fsPhysicalReportTemplateFieldService.selectFsPhysicalReportTemplateFieldById(id));
+    }
+
+    /**
+     * 新增体检报告模板字段
+     */
+    @PreAuthorize("@ss.hasPermi('his:physicalReportTemplateField:add')")
+    @Log(title = "体检报告模板字段", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FsPhysicalReportTemplateField fsPhysicalReportTemplateField) {
+        return toAjax(fsPhysicalReportTemplateFieldService.insertFsPhysicalReportTemplateField(fsPhysicalReportTemplateField));
+    }
+
+    /**
+     * 修改体检报告模板字段
+     */
+    @PreAuthorize("@ss.hasPermi('his:physicalReportTemplateField:edit')")
+    @Log(title = "体检报告模板字段", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsPhysicalReportTemplateField fsPhysicalReportTemplateField) {
+        return toAjax(fsPhysicalReportTemplateFieldService.updateFsPhysicalReportTemplateField(fsPhysicalReportTemplateField));
+    }
+
+    /**
+     * 删除体检报告模板字段
+     */
+    @PreAuthorize("@ss.hasPermi('his:physicalReportTemplateField:remove')")
+    @Log(title = "体检报告模板字段", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable String[] ids) {
+        return toAjax(fsPhysicalReportTemplateFieldService.deleteFsPhysicalReportTemplateFieldByIds(ids));
+    }
+
+    /**
+     * 获取模板自定义字段
+     *
+     * @param templateId 模板ID
+     * @return R
+     **/
+    @PostMapping("/getTemplateField/{templateId}")
+    public R getTemplateField(@PathVariable String templateId) {
+        if (StringUtils.isNull(templateId)) {
+            return R.failed("操作失败,模板ID不能为空!");
+        }
+        return fsPhysicalReportTemplateFieldService.getTemplateField(templateId);
+    }
+
+    /**
+     * 新增模板
+     *
+     * @param fieldDTO
+     * @return AjaxResult
+     **/
+    @Log(title = "体检报告模板字段", businessType = BusinessType.INSERT)
+    @PostMapping("/saveTemplate")
+    public AjaxResult saveTemplate(@RequestBody FsPhysicalReportTemplateFieldDTO fieldDTO) {
+        if (StringUtils.isNull(fieldDTO.getTemplateId())) {
+            throw new ServiceException("操作失败,模板ID不能为空!");
+        } else if (fieldDTO.getTemplateFieldList().isEmpty()) {
+            throw new ServiceException("操作失败,字段列表不能为空!");
+        }
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        fieldDTO.setCreateBy(String.valueOf(loginUser.getUserId()));
+        return toAjax(fsPhysicalReportTemplateFieldService.saveFsPhysicalReportTemplateField(fieldDTO));
+    }
+}

+ 80 - 7
fs-admin/src/main/java/com/fs/his/controller/FsStoreOrderController.java

@@ -17,6 +17,7 @@ import com.fs.common.utils.StringUtils;
 import com.fs.company.param.CompanyStoreOrderMoneyLogsListParam;
 import com.fs.company.service.ICompanyMoneyLogsService;
 import com.fs.company.vo.CompanyStoreOrderMoneyLogsVO;
+import com.fs.config.cloud.CloudHostProper;
 import com.fs.erp.domain.ErpDeliverys;
 import com.fs.erp.domain.ErpOrderQuery;
 import com.fs.erp.dto.ErpDeliverysRequest;
@@ -42,6 +43,7 @@ import com.fs.his.utils.ConfigUtil;
 import com.fs.his.vo.*;
 import com.fs.system.domain.SysConfig;
 import com.fs.system.mapper.SysConfigMapper;
+import com.github.pagehelper.PageHelper;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -100,23 +102,50 @@ public class FsStoreOrderController extends BaseController
     @Qualifier("dfOrderServiceImpl")
     private IErpOrderService dfOrderService;
 
+    @Autowired
+    @Qualifier("JSTErpOrderServiceImpl")
+    private IErpOrderService jSTOrderService;
+
     @Autowired
     SysConfigMapper sysConfigMapper;
 
     @Autowired
     private IFsStoreOrderDfService fsStoreOrderDfService;
+
+    @Autowired
+    private CloudHostProper cloudHostProper;
     /**
      * 查询订单列表
      */
-    @GetMapping("/list")
-    public TableDataInfo list(FsStoreOrderParam fsStoreOrder)
+    @PostMapping("/list")
+    public TableDataInfo list(@RequestBody FsStoreOrderParam fsStoreOrder)
     {
-        startPage();
-        if (fsStoreOrder.getUserPhoneMk()!=null&&fsStoreOrder.getUserPhoneMk()!=""){
+        PageHelper.startPage(fsStoreOrder);
+        if (fsStoreOrder.getUserPhoneMk()!=null&& !fsStoreOrder.getUserPhoneMk().isEmpty()){
             fsStoreOrder.setUserPhone(encryptPhone(fsStoreOrder.getUserPhoneMk()));
         }
-        List<FsStoreOrderListVO> list = fsStoreOrderService.selectFsStoreOrderListVO(fsStoreOrder);
-        return getDataTable(list);
+        List<FsStoreOrderListVO> list;
+        if (StringUtils.isNotBlank(fsStoreOrder.getErpAccount())){
+            //金牛erp查询
+            list = fsStoreOrderService.selectFsStoreOrderListVOByErpAccount(fsStoreOrder);
+        } else {
+            list = fsStoreOrderService.selectFsStoreOrderListVO(fsStoreOrder);
+        }
+        //金牛需求 区别其他项目 status = 6 (金牛代服管家) ,其他项目请避免使用订单状态status = 6
+        TableDataInfo dataTable = getDataTable(list);
+        if ("金牛明医".equals(cloudHostProper.getCompanyName())){
+            if (fsStoreOrder.getStatus() !=null && fsStoreOrder.getStatus() != 1){
+                list.forEach(vo->{
+                    //查询顺丰代服账号
+                    FsStoreOrderDf df = fsStoreOrderDfService.selectFsStoreOrderDfByOrderId(vo.getOrderId());
+                    if (df != null){
+                        vo.setErpAccount(df.getLoginAccount());
+                    }
+                });
+            }
+            dataTable.setMsg("jnmy");
+        }
+        return dataTable;
     }
 
     /**
@@ -388,6 +417,8 @@ public class FsStoreOrderController extends BaseController
                 } else if (erpType == 4){
                     //代服
                     erpOrderService =  dfOrderService;
+                }else if(erpType == 5){
+                    erpOrderService=jSTOrderService;
                 }
                 return erpOrderService;
 
@@ -526,7 +557,10 @@ public class FsStoreOrderController extends BaseController
         orderIds.forEach(orderId->{
             try {
                 df.setOrderId(orderId);
-                fsStoreOrderDfService.insertFsStoreOrderDf(df);
+                FsStoreOrderDf temp = fsStoreOrderDfService.selectFsStoreOrderDfByOrderId(df.getOrderId());
+                if (temp == null){
+                    fsStoreOrderDfService.insertFsStoreOrderDf(df);
+                }
                 fsStoreOrderService.createOmsOrder(orderId);
             } catch (ParseException e) {
                 throw new RuntimeException(e);
@@ -536,6 +570,44 @@ public class FsStoreOrderController extends BaseController
         return R.ok();
     }
 
+
+    @ApiOperation("批量设置订单账户")
+    @PreAuthorize("@ss.hasPermi('his:storeOrder:createErpOrder')")
+    @PostMapping(value = "/batchSetErpOrder")
+    public R batchSetErpOrder(@RequestBody FsStoreOrderSetErpPhoneParam param)
+    {
+        String loginAccount = param.getLoginAccount();
+        if (StringUtils.isBlank(loginAccount)){
+            return R.error("未选择erp账户");
+        }
+        FsStoreOrderDf df = getDFInfo(loginAccount);
+        if (df.getLoginAccount() == null){
+            return R.error("未查询到所选erp账户");
+        }
+        List<Long> orderIds = param.getOrderIds();
+        if (orderIds  == null || orderIds.isEmpty()) {
+            if (param.getUserPhoneMk() != null && !param.getUserPhoneMk().isEmpty()) {
+                param.setUserPhone(encryptPhone(param.getUserPhoneMk()));
+            }
+            List<FsStoreOrderListVO> list = fsStoreOrderService.selectFsStoreOrderListVO(param);
+            orderIds = list.stream().map(FsStoreOrderListVO::getOrderId).collect(Collectors.toList());
+        }
+        if (orderIds.isEmpty()){
+            return R.ok();
+        }
+        orderIds.forEach(orderId->{
+            df.setOrderId(orderId);
+            FsStoreOrderDf temp = fsStoreOrderDfService.selectFsStoreOrderDfByOrderId(df.getOrderId());
+            if (temp != null){
+                df.setUpdateTime(new Date());
+                fsStoreOrderDfService.updateFsStoreOrderDf(df);
+            } else {
+                fsStoreOrderDfService.insertFsStoreOrderDf(df);
+            }
+        });
+        return R.ok();
+    }
+
     private FsStoreOrderDf getDFInfo(String loginAccount) {
         //查询订单账户 判断是否存在该订单账户
         List<DFConfigVo> erpAccounts = fsStoreOrderService.getErpAccount();
@@ -547,6 +619,7 @@ public class FsStoreOrderController extends BaseController
                 df.setAppSecret(erpAccount.getDfAppsecret());
                 df.setLoginAccount(loginAccount);
                 df.setMonthlyCard(erpAccount.getMonthlyCard());
+                df.setExpressProductCode(erpAccount.getExpressProductCode());
                 df.setStatus(0);
                 break;
             }

+ 65 - 11
fs-admin/src/main/java/com/fs/his/controller/FsUserController.java

@@ -3,25 +3,37 @@ package com.fs.his.controller;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.domain.ResponseResult;
+import com.fs.common.exception.CustomException;
 import com.fs.common.utils.ParseUtils;
 import com.fs.common.utils.SecurityUtils;
+import com.fs.common.utils.StringUtils;
+import com.fs.course.service.IFsUserCompanyUserService;
 import com.fs.his.domain.FsUserAddress;
+import com.fs.his.enums.FsUserIntegralLogTypeEnum;
+import com.fs.his.param.FsUserAddIntegralTemplateParam;
+import com.fs.his.param.FsUserAddPointsParam;
 import com.fs.his.param.FsUserParam;
+import com.fs.his.service.IFsUserIntegralLogsService;
 import com.fs.his.utils.PhoneUtil;
 import com.fs.his.vo.FsUserExportListVO;
 import com.fs.his.vo.FsUserVO;
 import com.fs.his.vo.UserVo;
+import com.fs.qw.dto.UserProjectDTO;
 import com.fs.store.param.h5.FsUserPageListParam;
 import com.fs.store.vo.h5.FsUserPageListVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
@@ -47,12 +59,17 @@ import static com.fs.his.utils.PhoneUtil.*;
  * @author fs
  * @date 2023-06-07
  */
+@Slf4j
 @RestController
 @RequestMapping("/his/user")
 public class FsUserController extends BaseController
 {
     @Autowired
     private IFsUserService fsUserService;
+    @Autowired
+    private IFsUserIntegralLogsService userIntegralLogsService;
+    @Autowired
+    private IFsUserCompanyUserService userCompanyUserService;
 
     /**
      * 查询用户列表
@@ -80,6 +97,18 @@ public class FsUserController extends BaseController
         return getDataTable(list);
     }
 
+    @PreAuthorize("@ss.hasPermi('his:user:list')")
+    @GetMapping("/listProject")
+    public TableDataInfo listProject(FsUser fsUser)
+    {
+        startPage();
+        List<FsUserVO> list = fsUserService.selectFsUserVOListByProject(fsUser);
+        for (FsUserVO vo : list){
+            vo.setPhone(ParseUtils.parsePhone(vo.getPhone()));
+        }
+        return getDataTable(list);
+    }
+
     /**
      * 导出用户列表
      */
@@ -171,6 +200,17 @@ public class FsUserController extends BaseController
         return toAjax(fsUserService.deleteFsUserByUserIds(userIds));
     }
 
+    /**
+     * 删除微信用户和销售关系信息
+     */
+    @PreAuthorize("@ss.hasPermi('his:userCompanyUser:remove')")
+    @Log(title = "微信用户和销售关系", businessType = BusinessType.DELETE)
+    @DeleteMapping("/delete/{id}")
+    public AjaxResult delete(@PathVariable Long id)
+    {
+        return toAjax(userCompanyUserService.deleteFsUserCompanyUserById(id));
+    }
+
     /**
      * 查询用户
      */
@@ -188,6 +228,9 @@ public class FsUserController extends BaseController
     @GetMapping("/listBySearch")
     public R listBySearch(FsUser user)
     {
+        if (Objects.nonNull(user) && StringUtils.isNotBlank(user.getPhone())){
+            user.setPhone(PhoneUtil.encryptPhone(user.getPhone()));
+        }
         List<FsUser> list = fsUserService.selectFsUserList(user);
         return R.ok().put("data",list);
     }
@@ -199,24 +242,35 @@ public class FsUserController extends BaseController
 //        startPage();
 //        PageHelper.startPage(param.getPageNum(), param.getPageSize());
         PageInfo<FsUserPageListVO> fsUserPageListVOPageInfo = fsUserService.selectFsUserPageList(param);
-        if(ObjectUtils.isNotNull(fsUserPageListVOPageInfo)){
-            for (FsUserPageListVO fsUserPageListVO : fsUserPageListVOPageInfo.getList()) {
-                fsUserPageListVO.setPhone(ParseUtils.parsePhone(fsUserPageListVO.getPhone()));
-            }
-            Map<String, Object> map = new HashMap<String, Object>();
-            map.put("rows", fsUserPageListVOPageInfo.getList());
-            map.put("total", fsUserPageListVOPageInfo.getList().size());
-            return R.ok(map);
+        for (FsUserPageListVO fsUserPageListVO : fsUserPageListVOPageInfo.getList()) {
+            fsUserPageListVO.setPhone(ParseUtils.parsePhone(fsUserPageListVO.getPhone()));
         }
-        return R.ok();
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("rows", fsUserPageListVOPageInfo.getList());
+        map.put("total", fsUserPageListVOPageInfo.getTotal());
+        return R.ok(map);
     }
 
     @PreAuthorize("@ss.hasPermi('his:user:enabledUsers')")
     @PostMapping("/enabledUsers")
     @ApiOperation("批量启用会员")
-    public ResponseResult<Boolean> enabledUsers(@RequestBody String[] ids) {
-        Boolean r = fsUserService.disabledUser(ids, true);
+    public ResponseResult<Boolean> enabledUsers(@RequestBody List<UserProjectDTO> ids) {
+        log.debug("批量启用会员 ids: {}", JSON.toJSONString(ids));
+        Boolean r = userCompanyUserService.batchUpdateUserProjectStatus(ids, 1);
         return ResponseResult.ok(r);
     }
 
+    @PreAuthorize("@ss.hasPermi('his:user:addPoints')")
+    @PostMapping("/addPoints")
+    @ApiOperation("添加积分")
+    public R addPoints(@RequestBody @Validated FsUserAddPointsParam param) {
+        FsUserAddIntegralTemplateParam integralTemplateParam = new FsUserAddIntegralTemplateParam();
+        integralTemplateParam.setUserId(param.getUserId());
+        integralTemplateParam.setLogType(FsUserIntegralLogTypeEnum.TYPE_23.getValue());
+        integralTemplateParam.setBusinessId(SecurityUtils.getUserId().toString());
+        integralTemplateParam.setPoints(param.getPoint());
+        integralTemplateParam.setRemark(param.getRemark());
+        return userIntegralLogsService.addIntegralTemplate(integralTemplateParam);
+    }
+
 }

+ 7 - 0
fs-admin/src/main/java/com/fs/his/controller/FsUserOperationLogController.java

@@ -1,6 +1,7 @@
 package com.fs.his.controller;
 
 import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.his.domain.FsUserOperationLog;
 import com.fs.his.service.IFsUserOperationLogService;
@@ -36,4 +37,10 @@ public class FsUserOperationLogController extends BaseController {
 
         return getDataTable(list);
     }
+
+    @GetMapping("/getOperationType")
+    public R getOperationType()
+    {
+        return R.ok().put("data",fsUserOperationLogService.getOperationType());
+    }
 }

+ 45 - 12
fs-admin/src/main/java/com/fs/his/controller/HzOMSErpApiController.java

@@ -2,26 +2,23 @@ package com.fs.his.controller;
 
 
 import com.fs.common.core.domain.R;
-import com.fs.erp.domain.ErpOrder;
-import com.fs.erp.dto.ErpOrderResponse;
-import com.fs.erp.dto.df.BspOrderResponse;
-import com.fs.erp.dto.sdk.HzOMS.utils.HzOMSUtils;
+import com.fs.common.utils.StringUtils;
 import com.fs.erp.service.IErpOrderService;
-import com.fs.his.domain.FsStoreOrder;
-import com.fs.his.domain.FsVessel;
 import com.fs.his.param.HzOMSErpApiParam;
 import com.fs.his.service.ErpApiService;
 import com.fs.his.service.IFsStoreOrderService;
-import com.fs.his.service.impl.FsStoreOrderServiceImpl;
 import com.fs.his.vo.HzOMSErpResponseVO;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.IOUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 
 /**
  * 瀚智OMS Erp系统推送平数据接口
@@ -29,6 +26,7 @@ import java.util.List;
 
 @RestController
 @RequestMapping("/erp/call")
+@Slf4j
 public class HzOMSErpApiController {
 
     @Autowired
@@ -132,8 +130,43 @@ public class HzOMSErpApiController {
      * 代服管家订单回调
      */
     @PostMapping("/dfNotifyUrl")
-    public R dfOrderResult(@RequestBody BspOrderResponse param)
-    {
-        return fsStoreOrderService.dfOrderResult(param);
+    public R dfOrderResult(HttpServletRequest request){
+        String body = null;
+        try {
+            // 1. 先设置编码
+            request.setCharacterEncoding("UTF-8");
+            // 3. 按 UTF-8 解码
+            body = IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8);
+        } catch (IOException e) {
+            log.error("读取 body 失败", e);
+            return null;
+        }
+        log.info("Body UTF-8: {}", body);
+
+        return StringUtils.isNotBlank(body)
+                ? fsStoreOrderService.dfOrderResult(body)
+                : R.ok();
+    }
+
+    /**
+     * 代服管家订单状态回调
+     */
+    @PostMapping("/receiveWaybillPush")
+    public R receiveWaybillPush(HttpServletRequest request) {
+        String body = null;
+        try {
+            // 1. 先设置编码
+            request.setCharacterEncoding("UTF-8");
+            // 3. 按 UTF-8 解码
+            body = IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8);
+        } catch (IOException e) {
+            log.error("读取 body 失败", e);
+            return null;
+        }
+        log.info("Body UTF-8: {}", body);
+
+        return StringUtils.isNotBlank(body)
+                ? fsStoreOrderService.receiveWaybillPush(body)
+                : R.ok();
     }
 }

+ 22 - 1
fs-admin/src/main/java/com/fs/his/task/Task.java

@@ -266,7 +266,7 @@ public class Task {
         List<FsStoreOrder> orders = null;
         if (erpOrderService == gyOrderService){
             orders = fsStoreOrderMapper.selectOmsOrderdeliveryOp();
-        } else if (erpOrderService == wdtOrderService || erpOrderService == dfOrderService){
+        } else if (erpOrderService == wdtOrderService || erpOrderService == dfOrderService || erpOrderService == jSTOrderService){
             orders = fsStoreOrderMapper.selectWdtOmsOrderdeliveryOp();
         }
 
@@ -302,6 +302,21 @@ public class Task {
 
     }
 
+
+    public void getOrderDeliveryStatus()
+    {
+        IErpOrderService erpOrderService = getErpService();
+        List<FsStoreOrder> orders = null;
+        if (erpOrderService !=null && erpOrderService == dfOrderService){
+            orders = fsStoreOrderMapper.selectShippedOrder();
+            if(orders!=null&& !orders.isEmpty()){
+                for(FsStoreOrder order:orders){
+                    erpOrderService.getOrderDeliveryStatus(order);
+                }
+            }
+        }
+    }
+
     public void CreateOmsAndHis()
     {
         List<Long> omsList = fsStoreOrderMapper.selectFsStoreOrderNoCreateOms();
@@ -1015,6 +1030,10 @@ public class Task {
     @Qualifier("dfOrderServiceImpl")
     private IErpOrderService dfOrderService;
 
+    @Autowired
+    @Qualifier("JSTErpOrderServiceImpl")
+    private IErpOrderService jSTOrderService;
+
     private IErpOrderService getErpService() {
         FsSysConfig sysConfig = configUtil.getSysConfig();
         Integer erpOpen = sysConfig.getErpOpen();
@@ -1035,6 +1054,8 @@ public class Task {
                 } else if (erpType == 4){
                     //代服
                     erpOrderService =  dfOrderService;
+                }else if(erpType == 5){
+                    erpOrderService=jSTOrderService;
                 }
                 return erpOrderService;
 

+ 103 - 0
fs-admin/src/main/java/com/fs/qw/controller/QwIpadServerController.java

@@ -0,0 +1,103 @@
+package com.fs.qw.controller;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.qw.domain.QwIpadServer;
+import com.fs.qw.service.IQwIpadServerService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * ipad服务器Controller
+ *
+ * @author fs
+ * @date 2025-07-23
+ */
+@RestController
+@RequestMapping("/qw/qwIpadServer")
+public class QwIpadServerController extends BaseController
+{
+    @Autowired
+    private IQwIpadServerService qwIpadServerService;
+
+    /**
+     * 查询ipad服务器列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServer:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(QwIpadServer qwIpadServer)
+    {
+        startPage();
+        List<QwIpadServer> list = qwIpadServerService.selectQwIpadServerList(qwIpadServer);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出ipad服务器列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServer:export')")
+    @Log(title = "ipad服务器", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(QwIpadServer qwIpadServer)
+    {
+        List<QwIpadServer> list = qwIpadServerService.selectQwIpadServerList(qwIpadServer);
+        ExcelUtil<QwIpadServer> util = new ExcelUtil<QwIpadServer>(QwIpadServer.class);
+        return util.exportExcel(list, "ipad服务器数据");
+    }
+
+    /**
+     * 获取ipad服务器详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServer:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(qwIpadServerService.selectQwIpadServerById(id));
+    }
+
+    /**
+     * 新增ipad服务器
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServer:add')")
+    @Log(title = "ipad服务器", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody QwIpadServer qwIpadServer)
+    {
+        return toAjax(qwIpadServerService.insertQwIpadServer(qwIpadServer));
+    }
+
+    /**
+     * 修改ipad服务器
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServer:edit')")
+    @Log(title = "ipad服务器", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody QwIpadServer qwIpadServer)
+    {
+        return toAjax(qwIpadServerService.updateQwIpadServer(qwIpadServer));
+    }
+
+    /**
+     * 删除ipad服务器
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServer:remove')")
+    @Log(title = "ipad服务器", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(qwIpadServerService.deleteQwIpadServerByIds(ids));
+    }
+}

+ 118 - 0
fs-admin/src/main/java/com/fs/qw/controller/QwIpadServerLogController.java

@@ -0,0 +1,118 @@
+package com.fs.qw.controller;
+
+import java.util.List;
+
+import com.fs.qw.param.IPadServerLogParam;
+import com.fs.qw.vo.QwIPadServerLogVO;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.qw.domain.QwIpadServerLog;
+import com.fs.qw.service.IQwIpadServerLogService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * ipad服务器日志Controller
+ *
+ * @author fs
+ * @date 2025-07-23
+ */
+@RestController
+@RequestMapping("/qw/qwIpadServerLog")
+public class QwIpadServerLogController extends BaseController
+{
+    @Autowired
+    private IQwIpadServerLogService qwIpadServerLogService;
+
+    /**
+     * 查询ipad服务器日志列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServerLog:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(QwIpadServerLog qwIpadServerLog)
+    {
+        startPage();
+        List<QwIpadServerLog> list = qwIpadServerLogService.selectQwIpadServerLogList(qwIpadServerLog);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询ipad服务器日志列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServerLog:list')")
+    @GetMapping("/ipadServerLogList")
+    public TableDataInfo ipadServerLogList(IPadServerLogParam iPadServerLogParam)
+    {
+        startPage();
+        List<QwIPadServerLogVO> list = qwIpadServerLogService.selectIpadServerLogList(iPadServerLogParam);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出ipad服务器日志列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServerLog:export')")
+    @Log(title = "ipad服务器日志", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(IPadServerLogParam qwIpadServerLog)
+    {
+        List<QwIPadServerLogVO> list = qwIpadServerLogService.selectIpadServerLogList(qwIpadServerLog);
+        ExcelUtil<QwIPadServerLogVO> util = new ExcelUtil<QwIPadServerLogVO>(QwIPadServerLogVO.class);
+        return util.exportExcel(list, "ipad服务器日志数据");
+    }
+
+    /**
+     * 获取ipad服务器日志详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServerLog:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(qwIpadServerLogService.selectQwIpadServerLogById(id));
+    }
+
+    /**
+     * 新增ipad服务器日志
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServerLog:add')")
+    @Log(title = "ipad服务器日志", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody QwIpadServerLog qwIpadServerLog)
+    {
+        return toAjax(qwIpadServerLogService.insertQwIpadServerLog(qwIpadServerLog));
+    }
+
+    /**
+     * 修改ipad服务器日志
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServerLog:edit')")
+    @Log(title = "ipad服务器日志", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody QwIpadServerLog qwIpadServerLog)
+    {
+        return toAjax(qwIpadServerLogService.updateQwIpadServerLog(qwIpadServerLog));
+    }
+
+    /**
+     * 删除ipad服务器日志
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServerLog:remove')")
+    @Log(title = "ipad服务器日志", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(qwIpadServerLogService.deleteQwIpadServerLogByIds(ids));
+    }
+}

+ 118 - 0
fs-admin/src/main/java/com/fs/qw/controller/QwIpadServerUserController.java

@@ -0,0 +1,118 @@
+package com.fs.qw.controller;
+
+import java.util.List;
+
+import com.fs.qw.param.IPadServerUserParam;
+import com.fs.qw.vo.QwIPadServerUserVO;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.qw.domain.QwIpadServerUser;
+import com.fs.qw.service.IQwIpadServerUserService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * ipad用户Controller
+ *
+ * @author fs
+ * @date 2025-07-23
+ */
+@RestController
+@RequestMapping("/qw/qwIpadServerUser")
+public class QwIpadServerUserController extends BaseController
+{
+    @Autowired
+    private IQwIpadServerUserService qwIpadServerUserService;
+
+    /**
+     * 查询ipad用户列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServerUser:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(QwIpadServerUser qwIpadServerUser)
+    {
+        startPage();
+        List<QwIpadServerUser> list = qwIpadServerUserService.selectQwIpadServerUserList(qwIpadServerUser);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询ipad用户列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServerUser:list')")
+    @GetMapping("/ipadServerUserList")
+    public TableDataInfo list(IPadServerUserParam iPadServerUserParam)
+    {
+        startPage();
+        List<QwIPadServerUserVO> list = qwIpadServerUserService.selectIpadServerUserList(iPadServerUserParam);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出ipad用户列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServerUser:export')")
+    @Log(title = "ipad用户", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(IPadServerUserParam iPadServerUserParam)
+    {
+        List<QwIPadServerUserVO> list = qwIpadServerUserService.selectIpadServerUserList(iPadServerUserParam);
+        ExcelUtil<QwIPadServerUserVO> util = new ExcelUtil<QwIPadServerUserVO>(QwIPadServerUserVO.class);
+        return util.exportExcel(list, "ipad用户数据");
+    }
+
+    /**
+     * 获取ipad用户详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServerUser:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(qwIpadServerUserService.selectQwIpadServerUserById(id));
+    }
+
+    /**
+     * 新增ipad用户
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServerUser:add')")
+    @Log(title = "ipad用户", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody QwIpadServerUser qwIpadServerUser)
+    {
+        return toAjax(qwIpadServerUserService.insertQwIpadServerUser(qwIpadServerUser));
+    }
+
+    /**
+     * 修改ipad用户
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServerUser:edit')")
+    @Log(title = "ipad用户", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody QwIpadServerUser qwIpadServerUser)
+    {
+        return toAjax(qwIpadServerUserService.updateQwIpadServerUser(qwIpadServerUser));
+    }
+
+    /**
+     * 删除ipad用户
+     */
+    @PreAuthorize("@ss.hasPermi('qw:qwIpadServerUser:remove')")
+    @Log(title = "ipad用户", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(qwIpadServerUserService.deleteQwIpadServerUserByIds(ids));
+    }
+}

+ 11 - 0
fs-admin/src/main/java/com/fs/qw/qwTask/qwTask.java

@@ -3,6 +3,7 @@ package com.fs.qw.qwTask;
 import com.fs.course.service.IFsUserCourseService;
 import com.fs.qw.service.IQwExternalContactService;
 import com.fs.qw.service.IQwGroupMsgService;
+import com.fs.qw.service.IQwMaterialService;
 import com.fs.qw.service.IQwUserService;
 import com.fs.sop.service.impl.QwSopLogsServiceImpl;
 import com.fs.sop.service.impl.QwSopServiceImpl;
@@ -46,6 +47,10 @@ public class qwTask {
     @Autowired
     private IFsStatisQwWatchService fsStatisQwWatchService;
 
+    @Autowired
+    private IQwMaterialService iQwMaterialService;
+
+
     //正在使用
     public void qwExternalContact()
     {
@@ -188,4 +193,10 @@ public class qwTask {
         fsStatisQwWatchService.writeData(today.toString());
     }
 
+    /**
+    * 每俩天 更新一次 素材库
+    */
+    public void updateMaterialByTwoDays(){
+        iQwMaterialService.updateQwMaterialByQw();
+    }
 }

+ 1 - 0
fs-common/src/main/java/com/fs/common/constant/FsConstants.java

@@ -10,4 +10,5 @@ public interface FsConstants {
     String REDIS_QW_appKey_Active = "qwActive:";
 
     String FRIEND_WELCOME_VIDEO_KEY = "friend:welcome:";
+    String REDIS_INTEGRAL_ORDER_UNPAY = "integral:order:unpay:";
 }

+ 6 - 0
fs-company-app/src/main/java/com/fs/app/controller/AppBaseController.java

@@ -37,6 +37,12 @@ public class AppBaseController {
 		String userId = claims.getSubject().toString();
 		return userId;
 	}
+	public Long getCompanyUserId() {
+		String headValue =  ServletUtils.getRequest().getHeader("APPToken");
+		Claims claims=jwtUtils.getClaimByToken(headValue);
+		String userId = claims.getSubject();
+		return Long.parseLong(userId);
+	}
 	//获取商城手机号
 	public Long getUserId(Long companyUserId)
 	{

+ 29 - 12
fs-company-app/src/main/java/com/fs/app/controller/CompanyTagController.java

@@ -1,7 +1,9 @@
 package com.fs.app.controller;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
 import com.fs.app.annotation.Login;
+import com.fs.app.param.TagProjectParam;
 import com.fs.common.core.domain.R;
 import com.fs.common.exception.CustomException;
 import com.fs.common.utils.StringUtils;
@@ -17,6 +19,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.HashMap;
@@ -41,8 +44,9 @@ public class CompanyTagController extends AppBaseController {
     @ApiOperation("查询公司标签列表")
     public R list(@RequestParam(required = false) String keyword,
                   @RequestParam(required = false, defaultValue = "1") Integer pageNum,
-                  @RequestParam(required = false, defaultValue = "10") Integer pageSize) {
-        log.debug("查询公司标签列表 keyword: {}, pageNum: {}, pageSize: {}", keyword, pageNum, pageSize);
+                  @RequestParam(required = false, defaultValue = "10") Integer pageSize,
+                  @RequestParam(required = false) Long companyUserId) {
+        log.debug("查询公司标签列表 keyword: {}, pageNum: {}, pageSize: {}", keyword, pageNum, pageSize, companyUserId);
 
         Map<String, Object> params = new HashMap<>();
         params.put("companyId", getCompanyId());
@@ -51,13 +55,19 @@ public class CompanyTagController extends AppBaseController {
         }
 
         PageHelper.startPage(pageNum, pageSize);
-        List<CompanyTag> list = companyTagService.selectCompanyTagListByMap(params);
-        return R.ok().put("data", new PageInfo<>(list));
+        if (ObjectUtil.isNotEmpty(companyUserId)) {
+            params.put("companyUserId", companyUserId);
+            List<CompanyTag> list = companyTagService.selectCompanyTagByList(params);
+            return R.ok().put("data", new PageInfo<>(list));
+        } else {
+            List<CompanyTag> list = companyTagService.selectCompanyTagListByMap(params);
+            return R.ok().put("data", new PageInfo<>(list));
+        }
     }
 
-    /**
-     * 新增公司标签
-     */
+        /**
+         * 新增公司标签
+         */
     @Login
     @PostMapping("/add")
     @ApiOperation("新增公司标签")
@@ -81,13 +91,20 @@ public class CompanyTagController extends AppBaseController {
     }
 
     @Login
-    @GetMapping("/tagSubUsers")
+    @PostMapping("/tagSubUsers")
     @ApiOperation("标签下会员列表")
-    public R tagSubUsers(@RequestParam List<Long> tagId) {
+    public R tagSubUsers(@RequestBody TagProjectParam tagProjectParam) {
         Map<String, Object> params = new HashMap<>();
-        params.put("tagIds", tagId);
-        params.put("companyId", getCompanyId());
-        return R.ok().put("data", companyTagUserService.selectUserListByMap(params));
+        params.put("tagIds", tagProjectParam.getTagIds());
+        if (CollectionUtils.isNotEmpty(tagProjectParam.getProjectIds())){
+            params.put("projectIds", tagProjectParam.getProjectIds());
+        }
+        if (ObjectUtil.isEmpty(tagProjectParam.getCompanyUserId())){
+            params.put("companyUserId", getCompanyUserId());
+        }else {
+            params.put("companyUserId", tagProjectParam.getCompanyUserId());
+        }
+        return R.ok().put("data", companyTagUserService.selectUserByMap(params));
     }
 
     @Login

+ 100 - 17
fs-company-app/src/main/java/com/fs/app/controller/CompanyUserController.java

@@ -1,13 +1,11 @@
 package com.fs.app.controller;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.app.annotation.Login;
-import com.fs.app.param.ChangeUserDeptAndPostParam;
-import com.fs.app.param.CompanyUserChangeApplyParam;
-import com.fs.app.param.CompanyUserParam;
-import com.fs.app.param.CompanyUserUpdateParam;
+import com.fs.app.param.*;
 import com.fs.app.service.IAppService;
 import com.fs.app.vo.CompanySubUserVO;
 import com.fs.common.annotation.RepeatSubmit;
@@ -18,14 +16,16 @@ import com.fs.common.utils.PatternUtils;
 import com.fs.common.utils.bean.BeanUtils;
 import com.fs.company.domain.*;
 import com.fs.company.mapper.CompanyRoleMapper;
-import com.fs.company.service.ICompanyDeptService;
-import com.fs.company.service.ICompanyService;
-import com.fs.company.service.ICompanyUserChangeApplyService;
-import com.fs.company.service.ICompanyUserService;
+import com.fs.company.service.*;
+import com.fs.company.vo.CompanyTagUserVO;
 import com.fs.company.vo.CompanyUserChangeApplyVO;
 import com.fs.core.security.SecurityUtils;
 import com.fs.course.service.IFsCourseRedPacketLogService;
 import com.fs.course.service.IFsCourseWatchLogService;
+import com.fs.course.service.IFsUserCompanyUserService;
+import com.fs.qw.dto.UserProjectDTO;
+import com.fs.system.service.ISysDictDataService;
+import com.fs.system.vo.DictVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -33,6 +33,8 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
@@ -57,6 +59,12 @@ public class CompanyUserController extends AppBaseController {
     private final ICompanyUserChangeApplyService companyUserChangeApplyService;
     private final CompanyRoleMapper companyRoleMapper;
     private final IAppService appService;
+    @Autowired
+    private ISysDictDataService dictDataService;
+    @Autowired
+    private IFsUserCompanyUserService fsUserCompanyUserService;
+    @Autowired
+    private ICompanyTagUserService companyTagUserService;
 
     @Login
     @ApiOperation("查询用户列表")
@@ -165,13 +173,18 @@ public class CompanyUserController extends AppBaseController {
     @ApiOperation("注册")
     @PostMapping("/resisterCompanyUser")
     public R resisterCompanyUser(@Valid @RequestBody CompanyUserParam param) {
-        Company company = companyService.selectCompanyById(param.getCompanyId());
+        CompanyUser upCompanyUser = companyUserService.selectCompanyUserById(param.getCompanyUserId());
+        if (Objects.isNull(upCompanyUser)) {
+            return R.error("邀请销售不存在");
+        }
+
+        Company company = companyService.selectCompanyById(upCompanyUser.getCompanyId());
         if (Objects.isNull(company)) {
             return R.error("公司不存在");
         }
 
         // 判断用户数量是否已达到上线
-        Integer count = companyUserService.selectCompanyUserCountByCompanyId(param.getCompanyId());
+        Integer count = companyUserService.selectCompanyUserCountByCompanyId(upCompanyUser.getCompanyId());
         if(count > company.getLimitUserCount()) {
             return R.error("用户数量已达到上限");
         }
@@ -195,9 +208,10 @@ public class CompanyUserController extends AppBaseController {
         companyUser.setPassword(SecurityUtils.encryptPassword(companyUser.getPassword()));
         companyUser.setCreateTime(new Date());
         companyUser.setIsAudit(0);
+        companyUser.setParentId(upCompanyUser.getUserId());
 
         // 部门
-        CompanyDept dept = companyDeptService.getDefaultCompanyDeptByCompanyId(param.getCompanyId());
+        CompanyDept dept = companyDeptService.getDefaultCompanyDeptByCompanyId(upCompanyUser.getCompanyId());
         if (Objects.nonNull(dept)) {
             companyUser.setDeptId(dept.getDeptId());
         }
@@ -221,7 +235,7 @@ public class CompanyUserController extends AppBaseController {
     @RepeatSubmit
     @ApiOperation("更换会员归属申请")
     @PostMapping("/changeUserParentApply")
-    public R changeVipUser(@Valid @RequestBody CompanyUserChangeApplyParam param) {
+    public R changeVipUser(@RequestBody CompanyUserChangeApplyParam param) {
         // 参数校验
         CompanyUser fromUser = companyUserService.selectCompanyUserById(param.getFrom());
         if (Objects.isNull(fromUser)) {
@@ -233,12 +247,18 @@ public class CompanyUserController extends AppBaseController {
             throw new ServiceException("申请更换归属销售不存在");
         }
 
+        if (Objects.equals(fromUser.getUserId(), toUser.getUserId())) {
+            throw new ServiceException("申请更换归属销售不能与原归属销售相同");
+        }
+
         if (param.getType() != 0 && param.getType() != 1) {
             throw new ServiceException("类型不正确");
         }
 
-        if (param.getType() == 1 && (Objects.isNull(param.getIds()) || param.getIds().isEmpty())) {
-            throw new ServiceException("请先选择会员");
+        if (param.getType() == 1 && (CollectionUtils.isEmpty(param.getIds()))
+                &&(CollectionUtils.isEmpty(param.getProject()))
+                &&(CollectionUtils.isEmpty(param.getTagList()))) {
+            throw new ServiceException("请先选择会员!");
         }
 
         // 存在待审核的申请不能再次申请
@@ -248,14 +268,58 @@ public class CompanyUserController extends AppBaseController {
         if (companyUserChangeApplyService.count(applyWrapper) > 0) {
             throw new ServiceException("存在待审核申请");
         }
-
         CompanyUser companyUser = companyUserService.selectCompanyUserById(Long.parseLong(getUserId()));
-
+        List<UserProjectDTO> list = param.getIds();
+        if(CollectionUtils.isEmpty(list)){
+            List<UserProjectDTO> userProjectDTOS = addUserId(param.getProject(),param.getTagList(),param.getFrom());
+            if (CollectionUtils.isNotEmpty(userProjectDTOS)){
+                list.addAll(userProjectDTOS);
+            }
+        }
         // 添加申请
-        companyUserChangeApplyService.apply(param.getFrom(), param.getTo(), param.getType(), param.getIds(), companyUser.getCompanyId(), companyUser.getUserName());
+        companyUserChangeApplyService.apply(param.getFrom(), param.getTo(), param.getType(),list, companyUser.getCompanyId(), companyUser.getUserName());
         return R.ok();
     }
 
+    /**
+     * 查询标签和项目中的会员添加
+     * @param tagList
+     * @param companyUserId
+     * @return
+     */
+    private List<UserProjectDTO> addUserId(List<Long> projects, List<Long> tagList, Long companyUserId) {
+        // Prepare parameters map
+        Map<String, Object> params = new HashMap<>();
+
+        if (CollectionUtils.isNotEmpty(projects)) {
+            params.put("projectIds", projects);
+        } else {
+            params.put("tagIds", tagList);
+        }
+
+        // Set company user ID
+        Long effectiveCompanyUserId = ObjectUtil.isNotEmpty(companyUserId)
+                ? companyUserId
+                : getCompanyUserId();
+        params.put("companyUserId", effectiveCompanyUserId);
+
+        // Get data from service
+        List<CompanyTagUserVO> voList = companyTagUserService.selectUserByMap(params);
+        if (CollectionUtils.isEmpty(voList)) {
+            return Collections.emptyList();
+        }
+
+        // Transform data
+        return voList.stream()
+                .map(vo -> {
+                    UserProjectDTO dto = new UserProjectDTO();
+                    dto.setUserId(vo.getUserId());
+                    dto.setProjectId(vo.getProjectId());
+                    return dto;
+                })
+                .collect(Collectors.toList());
+    }
+
     @Login
     @ApiOperation("申请列表")
     @GetMapping("/applyList")
@@ -309,4 +373,23 @@ public class CompanyUserController extends AppBaseController {
         appService.changeUserDeptAndPost(param);
         return R.ok();
     }
+
+    @ApiOperation("查询指定公司中存在会员的项目")
+    @PostMapping("/getDictByKeyByProject")
+    public R getDictByKey(
+            @RequestBody TagProjectParam tagProjectParam){
+        List<DictVO> dictVOS=dictDataService.selectDictDataListByType("sys_course_project");
+        Map<String,Object> param = new HashMap<>();
+        param.put("tagIds",tagProjectParam.getTagIds());
+        param.put("companyUserId",tagProjectParam.getCompanyUserId());
+        List<Long> projectIds =fsUserCompanyUserService.selectFsUserCompanyUserList(param);
+        if (CollectionUtils.isEmpty(projectIds)){
+            return R.ok().put("data",new ArrayList<DictVO>());
+        }
+
+        List<DictVO> filteredDictVOS = dictVOS.stream()
+                .filter(dictVO -> projectIds.contains(Long.parseLong(dictVO.getDictValue())))
+                .collect(Collectors.toList());
+        return R.ok().put("data",filteredDictVOS);
+    }
 }

+ 53 - 17
fs-company-app/src/main/java/com/fs/app/controller/FsUserController.java

@@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.fs.app.annotation.Login;
 import com.fs.app.config.ImageStorageConfig;
-
+import com.fs.app.param.FsUserProjectUpdateParam;
 import com.fs.app.param.FsUserTagUpdateParam;
 import com.fs.app.param.FsUserUpdateParam;
 import com.fs.common.core.domain.R;
@@ -15,12 +15,15 @@ import com.fs.common.utils.StringUtils;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.service.ICompanyTagUserService;
 import com.fs.company.service.ICompanyUserService;
+import com.fs.course.domain.FsUserCompanyUser;
 import com.fs.course.param.CourseAnalysisParam;
 import com.fs.course.param.newfs.FsUserCourseBeMemberImageParam;
 import com.fs.course.param.newfs.FsUserCourseBeMemberParam;
+import com.fs.course.service.IFsUserCompanyUserService;
 import com.fs.course.service.IFsUserCourseService;
 import com.fs.course.vo.newfs.FsCourseAnalysisVO;
 import com.fs.his.domain.FsUser;
+import com.fs.his.service.IFsUserProjectTagService;
 import com.fs.his.service.IFsUserService;
 import com.fs.store.param.h5.FsUserPageListParam;
 import com.fs.store.param.h5.TagListParam;
@@ -42,7 +45,10 @@ import java.io.InputStream;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
-import java.util.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 
 @Slf4j
 @Api(tags = "用户会员相关接口")
@@ -70,14 +76,20 @@ public class FsUserController extends AppBaseController {
 
     @Autowired
     private ISysConfigService configService;
+    @Autowired
+    private IFsUserCompanyUserService userCompanyUserService;
+    @Autowired
+    private IFsUserProjectTagService userProjectTagService;
 
     @Login
     @PostMapping("/pageList")
     @ApiOperation("用户会员分页列表")
     public ResponseResult<PageInfo<FsUserPageListVO>> pageList(@RequestBody FsUserPageListParam param) {
+        log.debug("用户会员分页列表 param: {}", JSON.toJSONString(param));
         param.setUserId(Long.parseLong(getUserId()));
 //        PageHelper.startPage(param.getPageNum(), param.getPageSize());
         PageInfo<FsUserPageListVO> fsUserPageListVOPageInfo = fsUserService.selectFsUserPageList(param);
+//        PageInfo<FsUserPageListVO> pageInfo = new PageInfo<>(list);
         return ResponseResult.ok(fsUserPageListVOPageInfo);
     }
 
@@ -101,8 +113,9 @@ public class FsUserController extends AppBaseController {
     @GetMapping("/details")
     @ApiOperation("用户会员详情")
     public ResponseResult<UserDetailsVO> getUserDetails(@ApiParam(value = "用户id", required = true) @RequestParam Long userId,
+                                                        @ApiParam(value = "用户项目关联id", required = true) @RequestParam Long userCompanyId,
                                                         @ApiParam(value = "时间tab,不传表示查询全部,分别是:今天、昨天、前天、近七天", required = true) @RequestParam(required = false) String dateTag) {
-        UserDetailsVO userDetails = fsUserService.getUserDetails(Long.parseLong(getUserId()), userId, dateTag);
+        UserDetailsVO userDetails = fsUserService.getUserDetails(Long.parseLong(getUserId()), userId, dateTag,userCompanyId);
         return ResponseResult.ok(userDetails);
     }
 
@@ -110,9 +123,14 @@ public class FsUserController extends AppBaseController {
     @GetMapping("/tagList")
     @ApiOperation("用户会员标签列表")
     public ResponseResult<PageInfo<CompanyUserTagListVO>> getTagList(TagListParam param) {
+        log.debug("用户会员标签列表 param: {}", JSON.toJSONString(param));
         param.setUserId(Long.parseLong(getUserId()));
         PageHelper.startPage(param.getPageNum(), param.getPageSize());
-        List<CompanyUserTagListVO> tagList = companyTagUserService.getTagList(param);
+        List<CompanyUserTagListVO> tagList = userProjectTagService.getTagList(param);
+        CompanyUserTagListVO noTag = new CompanyUserTagListVO();
+        noTag.setTagId(0L);
+        noTag.setTagName("无标签");
+        tagList.add(0, noTag);
         PageInfo<CompanyUserTagListVO> pageInfo = new PageInfo<>(tagList);
         return ResponseResult.ok(pageInfo);
     }
@@ -120,22 +138,18 @@ public class FsUserController extends AppBaseController {
     @Login
     @PostMapping("/disabled")
     @ApiOperation("批量禁用会员")
-    public ResponseResult<Boolean> disabledUser(@ApiParam(value = "联系人id集合", required = true) @RequestBody String[] ids) {
-        Boolean r = fsUserService.disabledUser(ids, false);
+    public ResponseResult<Boolean> disabledUser(@ApiParam(value = "联系人id集合", required = true) @RequestBody List<Long> userCompanyUserIds) {
+        log.debug("批量禁用会员 ids: {}", JSON.toJSONString(userCompanyUserIds));
+        Boolean r = userCompanyUserService.batchUpdateStatus(userCompanyUserIds, 2);
         return ResponseResult.ok(r);
     }
 
     @Login
     @PostMapping("/enabled")
     @ApiOperation("批量启用会员")
-    public ResponseResult<Boolean> enabledUser(@ApiParam(value = "联系人id集合", required = true) @RequestBody String[] ids) {
-        // 如果存在重粉的数据,则禁止启用,需要提示
-        long companyUserId = Long.parseLong(getUserId());
-        Integer count = fsUserService.selectFsUserByUserIds(ids, companyUserId);
-        if(count > 0){
-            return ResponseResult.fail(400, "重粉会员不能移除小黑屋");
-        }
-        Boolean r = fsUserService.disabledUser(ids, true);
+    public ResponseResult<Boolean> enabledUser(@ApiParam(value = "联系人id集合", required = true) @RequestBody List<Long> userCompanyUserIds) {
+        log.debug("批量启用会员 ids: {}", JSON.toJSONString(userCompanyUserIds));
+        Boolean r = userCompanyUserService.batchUpdateStatus(userCompanyUserIds, 1);
         return ResponseResult.ok(r);
     }
 
@@ -257,11 +271,27 @@ public class FsUserController extends AppBaseController {
         return ResponseResult.ok();
     }
 
+    @Login
+    @ApiOperation("修改用户项目备注")
+    @PostMapping("/changeUserRemark")
+    public ResponseResult<Object> changeUserProjectRemark(@Valid @RequestBody FsUserProjectUpdateParam param) {
+        log.debug("修改用户备注 param:{}", JSON.toJSONString(param));
+        FsUserCompanyUser userCompanyUser = userCompanyUserService.selectFsUserCompanyUserById(param.getUserCompanyUserId());
+        if (Objects.isNull(userCompanyUser)) {
+            throw new ServiceException("用户不存在");
+        }
+
+        userCompanyUser.setRemark(param.getRemark());
+        userCompanyUserService.updateFsUserCompanyUser(userCompanyUser);
+        return ResponseResult.ok();
+    }
+
     @Login
     @ApiOperation("修改用户标签")
     @PostMapping("/changeUserTags")
     public ResponseResult<Object> changeUserTags(@Valid @RequestBody FsUserTagUpdateParam param) {
-        companyTagUserService.changeUserTags(param.getFsUserIds(), param.getTagIds());
+        log.debug("修改用户标签 param:{}", JSON.toJSONString(param));
+        userProjectTagService.addUserProjectTag(param.getUserCompanyUserIds(), param.getTagIds());
         return ResponseResult.ok();
     }
 
@@ -299,10 +329,10 @@ public class FsUserController extends AppBaseController {
         return ResponseResult.ok(fsUserService.companyUserSummaryCount(userId, companyUserId));
     }
 
-    @Login
     @ApiOperation("会员关联绑定销售")
     @PostMapping("/beMember")
     public ResponseResult<Boolean> becomeMember(@Valid @RequestBody FsUserCourseBeMemberParam param) {
+        log.debug("会员关联绑定销售 param:{}", JSON.toJSONString(param));
         return fsUserService.becomeMember(param);
     }
 
@@ -326,7 +356,7 @@ public class FsUserController extends AppBaseController {
             String userPosterImage = jsonObject.getString("userPosterImage");
             String backgroundImagePath;
             if(StringUtils.isEmpty(userPosterImage)){
-                backgroundImagePath = "https://drk-1363981074.cos.ap-chongqing.myqcloud.com/fs/logo/30d7a0d1ec31e5ac16c6e96d5ca76ad.png";
+                backgroundImagePath = "https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/fs/20250430/1745980979886.png";
             } else {
                 backgroundImagePath = userPosterImage;
             }
@@ -341,4 +371,10 @@ public class FsUserController extends AppBaseController {
         }
     }
 
+    @PostMapping("/test")
+    @ApiOperation("测试定时任务")
+    public void userCourseCountTask() {
+        userCourseCountService.insertFsUserCourseCountTask();
+    }
+
 }

+ 67 - 0
fs-company-app/src/main/java/com/fs/app/controller/FsUserCoursePeriodController.java

@@ -0,0 +1,67 @@
+package com.fs.app.controller;
+
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.course.domain.FsUserCoursePeriod;
+import com.fs.course.domain.FsUserCoursePeriodDays;
+import com.fs.course.domain.FsUserCourseVideoRedPackage;
+import com.fs.course.param.CompanyRedPacketParam;
+import com.fs.course.param.FsBatchPeriodRedPackageParam;
+import com.fs.course.param.PeriodCountParam;
+import com.fs.course.param.PeriodStatisticCountParam;
+import com.fs.course.service.IFsUserCoursePeriodDaysService;
+import com.fs.course.service.IFsUserCoursePeriodService;
+import com.fs.course.service.IFsUserCourseVideoRedPackageService;
+import com.fs.course.vo.FsPeriodCountVO;
+import com.fs.course.vo.FsUserCoursePeriodVO;
+import com.fs.course.vo.PeriodRedPacketVO;
+import com.fs.course.vo.UpdateCourseTimeVo;
+import com.fs.his.vo.OptionsVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 会员营期Controller
+ *
+ * @author fs
+ * @date 2025-04-11
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/course/period")
+@Slf4j
+public class FsUserCoursePeriodController extends BaseController {
+
+    private final IFsUserCoursePeriodService fsUserCoursePeriodService;
+
+    @PostMapping("/periodCourseStatisticCount")
+    @ApiOperation("会员详情训练营数据总览")
+    public R periodCourseStatisticCount(@RequestBody PeriodStatisticCountParam param) {
+        if (param == null) {
+            return R.error("请求参数不能为空!");
+        }
+        return R.ok().put("data", fsUserCoursePeriodService.periodCourseStatisticCount(param));
+    }
+
+    @PostMapping("/periodlist")
+    public R periodList(@RequestBody PeriodStatisticCountParam param)
+    {
+        List<FsUserCoursePeriod> list = fsUserCoursePeriodService.selectFsPeriodlist(param);
+        return R.ok().put("data", list);
+    }
+}

+ 3 - 20
fs-company-app/src/main/java/com/fs/app/controller/FsUserCourseVideoController.java

@@ -1,7 +1,5 @@
 package com.fs.app.controller;
 
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.json.JSONUtil;
 import com.fs.app.annotation.Login;
 import com.fs.app.config.ImageStorageConfig;
 import com.fs.common.core.domain.R;
@@ -9,7 +7,6 @@ import com.fs.common.core.domain.ResponseResult;
 import com.fs.common.utils.StringUtils;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.service.ICompanyUserService;
-import com.fs.course.config.CourseConfig;
 import com.fs.course.domain.FsUserCoursePeriod;
 import com.fs.course.param.FsCourseLinkCreateParam;
 import com.fs.course.param.FsWatchCourseTimeParam;
@@ -20,13 +17,11 @@ import com.fs.course.service.IFsCourseLinkService;
 import com.fs.course.service.IFsUserCoursePeriodService;
 import com.fs.course.service.IFsUserCourseService;
 import com.fs.course.service.IFsUserCourseVideoService;
-import com.fs.course.service.impl.FsUserCourseServiceImpl;
 import com.fs.course.vo.FsUserCourseParticipationRecordVO;
 import com.fs.course.vo.newfs.FsUserCourseListVO;
 import com.fs.course.vo.newfs.FsUserCourseVideoDetailsVO;
 import com.fs.course.vo.newfs.FsUserCourseVideoPageListVO;
 import com.fs.course.vo.newfs.FsUserVideoListVO;
-import com.fs.system.service.ISysConfigService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -37,7 +32,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.io.InputStream;
-import java.time.LocalDate;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -56,8 +50,6 @@ public class FsUserCourseVideoController extends AppBaseController {
 
     @Autowired
     private IFsUserCourseService fsUserCourseService;
-    @Autowired
-    private ISysConfigService configService;
 
     @Autowired
     private IFsCourseLinkService courseLinkService;
@@ -165,15 +157,8 @@ public class FsUserCourseVideoController extends AppBaseController {
 
         R courseSortLink = fsUserCourseService.createCourseSortLink(fsCourseLinkCreateParam);
         String link = courseSortLink.get("link").toString();
-//        R r = courseLinkService.getRealLink(link);
-//        String realLink = r.get("realLink").toString();
-        String json = configService.selectConfigByKey("course.config");
-        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
-        //验证是否有分配二级域名
-        CompanyUser companyUser=companyUserService.selectCompanyUserById(param.getCompanyUserId());
-        String realLink = (ObjectUtil.isNotNull(companyUser) && ObjectUtil.isNotNull(companyUser.getDomain())?companyUser.getDomain():config.getRealLinkDomainName()) + FsUserCourseServiceImpl.shortLink + link;
-
-        log.info("二维码生成地址:{}", realLink);
+        R r = courseLinkService.getRealLink(link);
+        String realLink = r.get("realLink").toString();
         try {
             String path = imageConfig.getServerPath();
             log.info("获取的logo图片路径,fileUrl:{}", path);
@@ -229,7 +214,7 @@ public class FsUserCourseVideoController extends AppBaseController {
 
         Map<String, Object> params = new HashMap<>();
         params.put("companyId", companyId);
-        params.put("dayDate", LocalDate.now());
+//        params.put("dayDate", LocalDate.now());
         params.put("companyUserId", Long.parseLong(getUserId()));
 
         PageHelper.startPage(pageNum, pageSize);
@@ -251,8 +236,6 @@ public class FsUserCourseVideoController extends AppBaseController {
 
     /**
      * 获取跳转微信小程序的链接地址
-     * @param linkStr
-     * @return
      */
     @Login
     @GetMapping("/getGotoWxAppLink")

+ 153 - 124
fs-company-app/src/main/java/com/fs/app/controller/WxCompanyUserController.java

@@ -11,14 +11,21 @@ import com.fs.app.param.LoginMaWxParam;
 import com.fs.app.utils.JwtUtils;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
+import com.fs.common.utils.IpUtil;
 import com.fs.common.utils.ServletUtils;
+import com.fs.company.domain.Company;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.service.ICompanyDeptService;
+import com.fs.company.service.ICompanyService;
 import com.fs.company.service.ICompanyUserService;
 import com.fs.core.config.WxMaConfiguration;
 import com.fs.course.config.CourseMaConfig;
+import com.fs.course.domain.FsUserCompanyUser;
+import com.fs.course.service.IFsUserCompanyUserService;
 import com.fs.his.domain.FsUser;
+import com.fs.his.domain.FsUserWx;
 import com.fs.his.service.IFsUserService;
+import com.fs.his.service.IFsUserWxService;
 import com.fs.system.domain.SysConfig;
 import com.fs.system.mapper.SysConfigMapper;
 import com.fs.wx.miniapp.config.WxMaProperties;
@@ -35,6 +42,9 @@ import org.springframework.web.bind.annotation.*;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Objects;
+
+import static com.fs.his.utils.PhoneUtil.encryptPhone;
 
 @Api("微信小程序相关接口(暂废弃,后面再删除)")
 @RestController
@@ -43,164 +53,183 @@ import java.util.List;
 public class WxCompanyUserController extends AppBaseController {
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
-    @Autowired
-    private WxMaProperties maProperties;
-
     @Autowired
     JwtUtils jwtUtils;
-
-    @Autowired
-    RedisCache redisCache;
-
     @Autowired
     private ICompanyUserService companyUserService;
-
-    @Autowired
-    private ICompanyDeptService companyDeptService;
-
     @Autowired
     private IFsUserService userService;
-
     @Autowired
-    private SysConfigMapper sysConfigMapper;
+    private ICompanyService companyService;
+    @Autowired
+    private IFsUserCompanyUserService userCompanyUserService;
+    @Autowired
+    private IFsUserWxService fsUserWxService;
 
     @ApiOperation("小程序-授权登录")
     @PostMapping("/loginByMa")
     public R login(@RequestBody LoginMaWxParam param) {
+        log.info("=====================进入小程序授权登录, 入参: {}", param);
         if (StringUtils.isBlank(param.getCode())) {
             return R.error("code不存在");
         }
-        SysConfig sysConfig3 = sysConfigMapper.selectConfigByConfigKey("courseMa.config");
-        List<CourseMaConfig> courseMaConfigs = JSON.parseArray(sysConfig3.getConfigValue(), CourseMaConfig.class);
-        if (courseMaConfigs.isEmpty()){
-            return R.error("小程序配置为空");
+
+        // 特殊(需求设计:需要根据公司是否开启黑名单来设置会员初始化的状态)
+        Company company = companyService.selectCompanyById(param.getCompanyId());
+        if (company==null || company.getStatus()==0){
+            return R.error("注册失败团队已停用,或不存在!");
+        }
+
+        // 根据销售后台设置的  是否需要单独注册会员 来判断是否需要设置销售的值
+        CompanyUser companyUser = companyUserService.selectCompanyUserById(param.getCompanyUserId());;
+        if(companyUser == null || companyUser.getStatus().equals("1")){
+            return R.error("注册失败客服已停用,或不存在!");
         }
-        CourseMaConfig courseMaConfig = courseMaConfigs.get(0);
-        //获取第二个小程序配置,序号从0开始
-        final WxMaService wxService = WxMaConfiguration.getMaService(courseMaConfig.getAppid());
+//        if (company.getCourseMiniAppId() == null) {
+//            return R.error("小程序参数错误!");
+//        }
+//        if (!param.getAppId().equals(company.getCourseMiniAppId())){
+//            return R.error("无权限,");
+//        }
+
+        final WxMaService wxService = WxMaConfiguration.getMaService(param.getAppId());
         try {
             WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(param.getCode());
             this.logger.info(session.getSessionKey());
             this.logger.info(session.getOpenid());
-            // 解密
-            WxMaPhoneNumberInfo phoneNoInfo = wxService.getUserService().getPhoneNoInfo(session.getSessionKey(), param.getEncryptedData(), param.getIv());
-            WxMaUserInfo userInfo = wxService.getUserService().getUserInfo(session.getSessionKey(), param.getEncryptedData(), param.getIv());
-
-            //以下暂时注释,不需要往销售表添加数据
-//            CompanyUser companyUser = companyUserService.getCompanyUserByOpenId(session.getOpenid());
-//            String ip = IpUtil.getRequestIp();
-//
-////            // 如果公司id为空(表示可能是该公司的第一位销售管理员),则需要根据电话号码判断是否存在销售,如果不存在则提示
-////            if (param.getCompanyId() == null) {
-////                if (checkPhone == null) {
-////                    throw new CustomException("由于不是管理员,不能直接登录", 401);
-////                }
-////            }
-//            if (companyUser == null) {
-//                CompanyUser checkPhone = companyUserService.getCompanyUserByPhone(phoneNoInfo.getPhoneNumber());
-//                if (checkPhone != null) {
-//                    if (checkPhone.getMaOpenId() == null) {
-//                        companyUser = checkPhone;
-//                        companyUser.setMaOpenId(session.getOpenid());
-//                        companyUser.setUserId(companyUser.getUserId());
-//                        companyUser.setUpdateTime(new DateTime());
-//                        companyUser.setLoginIp(ip);
-//                        companyUserService.updateUserProfile(companyUser);
-//                    } else {
-//                        throw new CustomException("此手机号用户已存在");
-//                    }
-//                } else {
-//                    //新增
-//                    companyUser = new CompanyUser();
-//                    companyUser.setUserName(phoneNoInfo.getPhoneNumber());
-//                    companyUser.setNickName(userInfo.getNickName() == null ? "微信用户" : userInfo.getNickName());
-//                    companyUser.setPhonenumber(phoneNoInfo.getPhoneNumber());
-//                    companyUser.setSex(userInfo.getGender());
-//                    //密码初始化为123456
-//                    String pw = "123456";
-//                    companyUser.setPassword(SecurityUtils.encryptPassword(param.getPassword() == null ? pw : param.getPassword()));
-//                    companyUser.setCreateTime(new Date());
-//                    companyUser.setCompanyId(param.getCompanyId());
-//                    companyUser.setParentId(param.getParentCompanyUseId());
-//                    companyUser.setMaOpenId(session.getOpenid());
-//
-//                    //部门信息
-//                    CompanyDept dept = companyDeptService.getDefaultCompanyDeptByCompanyId(param.getCompanyId());
-//                    if (Objects.nonNull(dept)) {
-//                        companyUser.setDeptId(dept.getDeptId());
-//                    }
-//                    companyUserService.insertUser(companyUser);
-//                }
-//            } else {
-//                CompanyUser companyUserMp = new CompanyUser();
-//                companyUserMp.setPhonenumber(phoneNoInfo.getPhoneNumber());
-//                companyUserMp.setUserId(companyUser.getUserId());
-//                companyUserMp.setUpdateTime(new DateTime());
-//                companyUserMp.setLoginIp(ip);
-//                companyUserService.updateUserProfile(companyUser);
-//            }
-
-            // 添加会员表数据
-            FsUser user = userService.selectFsUserByMpOpenId(session.getOpenid());
-            if (user != null) {
-                //修改
-                FsUser userMap = new FsUser();
-                userMap.setUserId(user.getUserId());
-                userMap.setMpOpenId(session.getOpenid());
-                userMap.setUnionId(session.getUnionid());
-                userMap.setUpdateTime(new DateTime());
-                userMap.setNickName(userInfo.getNickName() != null ? userInfo.getNickName() : "微信用户");
-                userMap.setAvatar(userInfo.getAvatarUrl() != null ? userInfo.getAvatarUrl() : null);
-                userMap.setPhone(phoneNoInfo.getPhoneNumber());
-                userService.updateFsUser(userMap);
-            } else {
-                //新增
-                user = new FsUser();
-                user.setNickName(userInfo.getNickName() != null ? userInfo.getNickName() : "微信用户");
-                user.setAvatar(userInfo.getAvatarUrl() != null ? userInfo.getAvatarUrl() : null);
-                user.setStatus(1);
-                user.setMpOpenId(session.getOpenid());
-                user.setUnionId(session.getUnionid());
-                user.setCreateTime(new Date());
-                user.setPhone(phoneNoInfo.getPhoneNumber());
-                userService.insertFsUser(user);
+            this.logger.info(session.getUnionid());
+            if (StringUtils.isEmpty(session.getOpenid())){
+                return R.error("登陆失败,openid未授权,请稍后再试!");
+            }
+
+            if (param.getAuthType() == 2 && StringUtils.isEmpty(session.getUnionid())){
+                return R.error("未绑定开发平台,请联系管理员!");
+            }
+
+            // 手机号信息
+            WxMaPhoneNumberInfo phoneNoInfo = new WxMaPhoneNumberInfo();;
+            if (param.getAuthType()==1){
+                phoneNoInfo = wxService.getUserService().getPhoneNoInfo(session.getSessionKey(), param.getEncryptedData(), param.getIv());
+                if (StringUtils.isEmpty(phoneNoInfo.getPhoneNumber())){
+                    return R.error("授权失败,请联系客服!");
+                }
+            }
+
+            FsUser user = getUserByAuthType(param, wxService, session, phoneNoInfo);
+
+            // 3. 处理用户注册或更新
+            String ip = IpUtil.getRequestIp();
+            user = handleUserRegisterOrUpdate(user, param, session, phoneNoInfo, company, companyUser, ip);
+
+            FsUserCompanyUser userCompanyUser = userCompanyUserService.selectByUserIdAndProjectId(user.getUserId(), param.getProjectId());
+            if (Objects.nonNull(userCompanyUser) && !param.getCompanyUserId().equals(userCompanyUser.getCompanyUserId())){
+                return R.error(500, "该用户("+user.getUserId() + ")已成为其他销售会员");
             }
-            log.info("保存成功的用户信息user: {}, 用户id: {}", user, user.getUserId());
+
+            // 4. 处理用户与小程序的绑定
+            handleFsUserWx(user, param, session);
+
+            log.info("保存成功的用户信息user: {}, 用户id: {},小程序AppId:{}", user, user.getUserId(), param.getAppId());
             String token = jwtUtils.generateToken(user.getUserId());
-            // 返回一个写死的数据到前端
-            return R.ok("登录成功").put("token", token).put("phoneNumber", phoneNoInfo.getPhoneNumber()).put("nickName", "微信用户").put("user", user);
+            // 返回TOKEN和user
+            return R.ok("登录成功").put("token", token).put("user", user);
         } catch (WxErrorException e) {
             this.logger.error(e.getMessage(), e);
             return R.error("授权失败," + e.getMessage());
         }
     }
 
-    @Login(isMiniLogin = true)
-    @ApiOperation("获取销售通过小程序登录后的用户信息")
-    @GetMapping("/getMaUser")
-    public R getUserInfo() {
-        try {
-            CompanyUser companyUser = companyUserService.selectCompanyUserById(Long.parseLong(getUserId()));
-            if (companyUser == null) {
-                return R.error(401, "用户信息不存在");
+    /**
+     * 根据authType获取用户信息
+     */
+    private FsUser getUserByAuthType(LoginMaWxParam param, WxMaService wxService, WxMaJscode2SessionResult session, WxMaPhoneNumberInfo phoneNoInfo) throws WxErrorException {
+        FsUser user = null;
+        if (param.getAuthType() == 1) {
+            user = userService.selectFsUserByPhone(encryptPhone(phoneNoInfo.getPhoneNumber()));
+        } else {
+            // unionid判定唯一
+            if (StringUtils.isNotEmpty(session.getUnionid())) {
+                user = userService.selectFsUserByUnionId(session.getUnionid());
             }
-            return R.ok().put("user", companyUser);
-        } catch (Exception e) {
-            return R.error("操作异常");
         }
+        return user;
     }
 
     /**
-     * 特殊要求:销售小程序临时登录,登录后页面中还有一个之前常用的登录,所以为了区分,token名称不能跟之前的一样
-     *
-     * @return 用户id
+     * 处理用户注册或更新
      */
-    public String getUserId() {
-        String headValue = ServletUtils.getRequest().getHeader("UserToken");
-        Claims claims = jwtUtils.getClaimByToken(headValue);
-        String userId = claims.getSubject().toString();
-        return userId;
+    private FsUser handleUserRegisterOrUpdate(FsUser user, LoginMaWxParam param, WxMaJscode2SessionResult session, WxMaPhoneNumberInfo phoneNoInfo, Company company, CompanyUser companyUser, String ip) {
+        if (user == null) {
+            return createUser(param, session, phoneNoInfo, company, companyUser);
+        } else {
+            return updateUser(user, param, session, phoneNoInfo, company, companyUser);
+        }
+    }
+
+    /**
+     * 新增用户
+     */
+    private FsUser createUser(LoginMaWxParam param, WxMaJscode2SessionResult session, WxMaPhoneNumberInfo phoneNoInfo, Company company, CompanyUser companyUser) {
+        FsUser user = new FsUser();
+        user.setStatus((company != null ? company.getFsUserIsDefaultBlack() : 0) == 1 ? 0 : 1);
+        user.setUnionId(session.getUnionid() == null ? "" : session.getUnionid());
+        user.setCreateTime(new Date());
+        if (param.getAuthType() == 1 && phoneNoInfo != null) {
+            user.setPhone(phoneNoInfo.getPhoneNumber());
+        }
+        userService.insertFsUser(user);
+
+        if((companyUser.getIsAllowedAllRegister() == null || companyUser.getIsAllowedAllRegister() == 1)
+                && companyUser.getIsNeedRegisterMember() != null && companyUser.getIsNeedRegisterMember() != 1){
+            int defaultStatus = (company != null ? company.getFsUserIsDefaultBlack() : 0) == 1 ? 0 : 1;
+            userCompanyUserService.bindRelationship(user.getUserId(), param.getProjectId(), companyUser.getCompanyId(), companyUser.getUserId(), defaultStatus);
+        }
+        return user;
     }
 
+    /**
+     * 修改用户
+     */
+    private FsUser updateUser(FsUser user, LoginMaWxParam param, WxMaJscode2SessionResult session, WxMaPhoneNumberInfo phoneNoInfo, Company company, CompanyUser companyUser) {
+        FsUser userMap = new FsUser();
+        userMap.setUserId(user.getUserId());
+        userMap.setUnionId(session.getUnionid() == null ? "" : session.getUnionid());
+        userMap.setUpdateTime(new DateTime());
+        if (param.getAuthType() == 1 && phoneNoInfo != null) {
+            userMap.setPhone(phoneNoInfo.getPhoneNumber());
+        }
 
+        userService.updateFsUser(userMap);
+        return userMap;
+    }
+
+    /**
+     * 处理用户与小程序的绑定
+     */
+    private void handleFsUserWx(FsUser user, LoginMaWxParam param, WxMaJscode2SessionResult session) {
+        if (user == null) return;
+        // 尝试更新
+        boolean updated = fsUserWxService.lambdaUpdate()
+                .eq(FsUserWx::getFsUserId, user.getUserId())
+                .eq(FsUserWx::getAppId, param.getAppId())
+                .eq(FsUserWx::getOpenId, session.getOpenid())
+                .set(FsUserWx::getCompanyId, param.getCompanyId())
+                .set(FsUserWx::getUnionId, session.getUnionid() == null ? "" : session.getUnionid())
+                .set(FsUserWx::getUpdateTime, new Date())
+                .update();
+
+        // 如果更新失败(记录不存在),则插入
+        if (!updated) {
+            FsUserWx fsUserWx = new FsUserWx();
+            fsUserWx.setType(1);
+            fsUserWx.setFsUserId(user.getUserId());
+            fsUserWx.setCompanyId(param.getCompanyId());
+            fsUserWx.setAppId(param.getAppId());
+            fsUserWx.setOpenId(session.getOpenid());
+            fsUserWx.setUnionId(session.getUnionid() == null ? "" : session.getUnionid());
+            fsUserWx.setCreateTime(new Date());
+            fsUserWx.setUpdateTime(new Date());
+            fsUserWxService.save(fsUserWx);
+        }
+    }
 }

+ 46 - 0
fs-company-app/src/main/java/com/fs/app/controller/qw/QwFsCourseWatchLogController.java

@@ -0,0 +1,46 @@
+package com.fs.app.controller.qw;
+
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.exception.CustomException;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.course.domain.FsCourseWatchLog;
+import com.fs.course.param.FsCourseWatchLogListParam;
+import com.fs.course.param.FsCourseWatchLogStatisticsListParam;
+import com.fs.course.param.PeriodStatisticCountParam;
+import com.fs.course.service.IFsCourseWatchLogService;
+import com.fs.course.vo.FsCourseWatchLogListVO;
+import com.fs.course.vo.FsCourseWatchLogStatisticsListVO;
+import com.fs.qw.param.QwWatchLogStatisticsListParam;
+import com.fs.qw.service.IQwWatchLogService;
+import com.fs.qw.vo.QwWatchLogAllStatisticsListVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 短链课程看课记录Controller
+ *
+ * @author fs
+ * @date 2024-10-24
+ */
+@RestController
+@RequestMapping("/qw/course/courseWatchLog")
+public class QwFsCourseWatchLogController extends BaseController {
+    @Autowired
+    private IFsCourseWatchLogService fsCourseWatchLogService;
+
+    //    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:list')")
+    @GetMapping("/listBytrainingCampId")
+    public TableDataInfo listBytrainingCampId(PeriodStatisticCountParam param) {
+        startPage();
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectListBytrainingCampId(param);
+        return getDataTable(list);
+    }
+}

+ 14 - 1
fs-company-app/src/main/java/com/fs/app/param/CompanyUserChangeApplyParam.java

@@ -1,5 +1,6 @@
 package com.fs.app.param;
 
+import com.fs.qw.dto.UserProjectDTO;
 import lombok.Data;
 
 import javax.validation.constraints.NotNull;
@@ -22,8 +23,20 @@ public class CompanyUserChangeApplyParam {
      */
     @NotNull(message = "类型不能为空")
     private Integer type;
+
+    /**
+     * 项目id
+     */
+    private List<Long> project;
+
+
+    /**
+     * 标签id
+     */
+    private List<Long> tagList;
+
     /**
      * 需更换归属会员id集合
      */
-    private List<Long> ids;
+    private List<UserProjectDTO> ids;
 }

+ 5 - 3
fs-company-app/src/main/java/com/fs/app/param/CompanyUserParam.java

@@ -1,5 +1,6 @@
 package com.fs.app.param;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import javax.validation.constraints.NotBlank;
@@ -9,10 +10,11 @@ import javax.validation.constraints.NotNull;
 public class CompanyUserParam {
 
     /**
-     * 公司ID
+     * 上级销售
      */
-    @NotNull(message = "公司ID不能为空")
-    private Long companyId;
+    @NotNull(message = "上级销售不能为空")
+    @ApiModelProperty("上级销售不能为空")
+    private Long companyUserId;
     /**
      * 手机号码
      */

+ 17 - 0
fs-company-app/src/main/java/com/fs/app/param/FsUserProjectUpdateParam.java

@@ -0,0 +1,17 @@
+package com.fs.app.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+@Data
+public class FsUserProjectUpdateParam {
+
+    @ApiModelProperty("用户项目ID")
+    @NotNull(message = "用户项目ID不能为空")
+    private Long userCompanyUserId;
+
+    @ApiModelProperty("备注")
+    private String remark;
+}

+ 3 - 3
fs-company-app/src/main/java/com/fs/app/param/FsUserTagUpdateParam.java

@@ -11,9 +11,9 @@ public class FsUserTagUpdateParam {
     /**
      * 用户ID
      */
-    @ApiModelProperty("用户ID集合")
-    @NotEmpty(message = "用户ID不能为空")
-    private List<Long> fsUserIds;
+    @ApiModelProperty("用户项目ID集合")
+    @NotEmpty(message = "用户项目ID不能为空")
+    private List<Long> userCompanyUserIds;
     /**
      * 标签ID
      */

+ 22 - 0
fs-company-app/src/main/java/com/fs/app/param/LoginMaWxParam.java

@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 
 @Data
@@ -19,6 +20,18 @@ public class LoginMaWxParam implements Serializable {
     @ApiModelProperty(value = "小程序加密算法的初始向量")
     private String iv;
 
+    @NotNull(message = "公司id不能为空")
+    @ApiModelProperty(value = "公司id")
+    private Long companyId;
+
+    @NotNull(message = "销售id不能为空")
+    @ApiModelProperty(value = "销售id")
+    private Long companyUserId;
+
+    @NotNull(message = "项目id不能为空")
+    @ApiModelProperty(value = "课程归属项目id")
+    private Long projectId;
+
 //    @ApiModelProperty(value = "公司id,如果不是第一位销售,都需要传")
 //    private Long companyId;
 
@@ -31,4 +44,13 @@ public class LoginMaWxParam implements Serializable {
 //    @ApiModelProperty(value = "用户密码")
 //    private String password;
 
+    /**
+     * 0:静默授权  1:手机号授权
+     */
+    @NotNull(message = "授权类型缺失")
+    @ApiModelProperty(value = "小程序授权类型")
+    private Integer authType;
+
+    private String appId;
+
 }

+ 23 - 0
fs-company-app/src/main/java/com/fs/app/param/TagProjectParam.java

@@ -0,0 +1,23 @@
+package com.fs.app.param;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class TagProjectParam {
+    /**
+     * 销售id
+     */
+    private Long companyUserId;
+
+    /**
+     * 标签id
+     */
+    private List<Long> tagIds;
+
+    /**
+     * 项目id
+     */
+    private List<Long> projectIds;
+}

+ 76 - 0
fs-company/src/main/java/com/fs/company/controller/company/CompanyUserChangeApplyController.java

@@ -0,0 +1,76 @@
+package com.fs.company.controller.company;
+
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.exception.ServiceException;
+import com.fs.common.utils.StringUtils;
+import com.fs.company.controller.param.CompanyUserChangeApplyAuditParam;
+import com.fs.company.service.ICompanyUserChangeApplyService;
+import com.fs.company.vo.CompanyUserChangeApplyVO;
+import com.fs.framework.security.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 更换会员归属申请Controller
+ */
+@RestController
+@RequestMapping("/company/apply")
+public class CompanyUserChangeApplyController extends BaseController
+{
+    @Autowired
+    private ICompanyUserChangeApplyService companyUserChangeApplyService;
+
+    /**
+     * 查询更换会员归属申请列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:apply:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(@RequestParam(required = false) Integer status)
+    {
+        Map<String, Object> map = new HashMap<>();
+        map.put("status", status);
+        map.put("companyId", SecurityUtils.getLoginUser().getCompany().getCompanyId());
+
+        startPage();
+        List<CompanyUserChangeApplyVO> list = companyUserChangeApplyService.selectApplyListByMap(map);
+        return getDataTable(list);
+    }
+
+    /**
+     * 获取更换会员归属申请详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:apply:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(companyUserChangeApplyService.selectApplyDetailById(id));
+    }
+
+    /**
+     * 获取更换会员归属申请详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:apply:audit')")
+    @PostMapping(value = "/audit")
+    public AjaxResult audit(@Valid @RequestBody CompanyUserChangeApplyAuditParam param)
+    {
+        if (param.getStatus() != 1 && param.getStatus() != 2) {
+            throw new ServiceException("审核类型不正确");
+        }
+
+        if (param.getStatus() == 2 && StringUtils.isBlank(param.getReason())) {
+            throw new ServiceException("拒绝理由不能为空");
+        }
+
+        companyUserChangeApplyService.audit(param.getId(), param.getStatus(), param.getReason(), SecurityUtils.getUsername());
+        return AjaxResult.success();
+    }
+
+}

+ 11 - 0
fs-company/src/main/java/com/fs/company/controller/company/CompanyUserController.java

@@ -405,4 +405,15 @@ public class CompanyUserController extends BaseController
         String subDomain = "http://" + DomainUtil.generateSubDomain(config.getCourseDomainName(), 6, String.valueOf(SecurityUtils.getLoginUser().getUser().getUserId()));
         return  R.ok().put("data",subDomain);
     }
+
+    @Log(title = "设置是否需要单独注册会员", businessType = BusinessType.UPDATE)
+    @PutMapping("/setRegister")
+    public AjaxResult setIsRegisterMember(@RequestParam Boolean status, @RequestBody List<Long> userIds) {
+        Boolean r = companyUserService.setIsRegisterMember(status, userIds);
+        if (r) {
+            return AjaxResult.success();
+        } else {
+            return AjaxResult.error("操作失败");
+        }
+    }
 }

+ 8 - 0
fs-company/src/main/java/com/fs/company/controller/course/FsUserOperationLogController.java

@@ -1,6 +1,7 @@
 package com.fs.company.controller.course;
 
 import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.his.domain.FsUserOperationLog;
 import com.fs.his.service.IFsUserOperationLogService;
@@ -9,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
@@ -32,4 +34,10 @@ public class FsUserOperationLogController extends BaseController {
 
         return getDataTable(list);
     }
+
+    @GetMapping("/getOperationType")
+    public R getOperationType()
+    {
+        return R.ok().put("data",fsUserOperationLogService.getOperationType());
+    }
 }

+ 0 - 1
fs-company/src/main/java/com/fs/company/controller/fastGpt/FastGptRoleController.java

@@ -61,7 +61,6 @@ public class FastGptRoleController extends BaseController
     @GetMapping("/getAllRoleType")
     public R list()
     {
-
         List<OptionsVO> list = fastGptRoleService.selectFastGptRoleType();
         return R.ok().put("data",list);
     }

+ 23 - 0
fs-company/src/main/java/com/fs/company/controller/param/CompanyUserChangeApplyAuditParam.java

@@ -0,0 +1,23 @@
+package com.fs.company.controller.param;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+@Data
+public class CompanyUserChangeApplyAuditParam {
+    /**
+     * 申请记录ID
+     */
+    @NotNull(message = "申请记录ID不能为空")
+    private Long id;
+    /**
+     * 状态 0通过 1拒绝
+     */
+    @NotNull(message = "审核状态不能为空")
+    private Integer status;
+    /**
+     * 原因
+     */
+    private String reason;
+}

+ 2 - 0
fs-company/src/main/java/com/fs/company/controller/qw/QwMaterialController.java

@@ -1,6 +1,7 @@
 package com.fs.company.controller.qw;
 
 import com.fs.common.annotation.Log;
+import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
@@ -101,6 +102,7 @@ public class QwMaterialController extends BaseController
     @PreAuthorize("@ss.hasPermi('qw:material:add')")
     @Log(title = "素材库", businessType = BusinessType.INSERT)
     @PostMapping
+    @RepeatSubmit
     public R add(@RequestBody QwMaterial qwMaterial) throws Exception {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         qwMaterial.setCreateUserId(loginUser.getUser().getUserId());

+ 1 - 1
fs-company/src/main/java/com/fs/company/controller/qw/QwUserVoiceLogController.java

@@ -107,7 +107,7 @@ public class QwUserVoiceLogController extends BaseController
         return getDataTable(list);
     }
 
-    @PreAuthorize("@ss.hasPermi('qw:qwUserVoiceLog:sellTotalList')")
+
     @GetMapping("/sellTotalList")
     public TableDataInfo sellTotalList(QwUserVoiceLogTotalVo qwUserVoiceLog)
     {

+ 23 - 20
fs-company/src/main/java/com/fs/company/controller/qw/SopUserLogsInfoController.java

@@ -26,14 +26,12 @@ import com.fs.sop.params.SendUserLogsInfoMsgParam;
 import com.fs.sop.service.ISopUserLogsInfoService;
 import com.fs.voice.utils.StringUtil;
 import com.google.gson.Gson;
-import com.google.gson.JsonSyntaxException;
 import com.google.gson.reflect.TypeToken;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
-import java.io.IOException;
-import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.function.Predicate;
@@ -97,8 +95,10 @@ public class SopUserLogsInfoController extends BaseController
                     Map<String, QwTag> tagMap = PubFun.listToMapByGroupObject(tagList, QwTag::getTagId);
                     qwExternalContactVOTimes.forEach(e -> {
                         List<String> tagId = JSON.parseArray(e.getTagIds(), String.class);
-                        List<String> tagNameList = tagId.stream().filter(tagMap::containsKey).map(t -> tagMap.get(t).getName()).filter(StringUtils::isNotEmpty).collect(Collectors.toList());
-                        e.setTagIdsName(tagNameList);
+                        if(StringUtils.isNotEmpty(tagId)){
+                            List<String> tagNameList = tagId.stream().filter(tagMap::containsKey).map(t -> tagMap.get(t).getName()).filter(StringUtils::isNotEmpty).collect(Collectors.toList());
+                            e.setTagIdsName(tagNameList);
+                        }
                     });
                 }
                 // 设置联系信息
@@ -114,12 +114,6 @@ public class SopUserLogsInfoController extends BaseController
                 });
             }
 
-
-//            Predicate<SopUserLogsInfo> tagFilter = item ->
-//                    sopUserLogsInfo.getTagIds() == null ||
-//                            sopUserLogsInfo.getTagIds().isEmpty() ||
-//                            item.getTagIds().contains(sopUserLogsInfo.getTagIds());
-
             Predicate<SopUserLogsInfo> tagFilter = item -> {
                 String queryTagIds = sopUserLogsInfo.getTagIds();
                 String itemTagIds = item.getTagIds();
@@ -148,25 +142,34 @@ public class SopUserLogsInfoController extends BaseController
 
 
             Predicate<SopUserLogsInfo> timeFilter = item -> {
-                if (StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getEntryTime())) {
+
+                if (StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getInComingSTime())
+                        && StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getInComingETime()) ) {
                     return true;
                 }
                 try {
-                    LocalDate entryDate = LocalDate.parse(
-                            sopUserLogsInfo.getEntryTime(),
-                            DateTimeFormatter.ofPattern("yyyy-MM-dd")
+                    LocalDateTime entryDate = LocalDateTime.parse(item.getInComTime(),
+                            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
+                    );
+                    LocalDateTime inComingSTime = LocalDateTime.parse(sopUserLogsInfo.getInComingSTime(),
+                            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
                     );
-                    LocalDate createDate = LocalDate.parse(
-                            item.getInComTime().substring(0, 10),
-                            DateTimeFormatter.ofPattern("yyyy-MM-dd")
+
+                    LocalDateTime inComingETime = LocalDateTime.parse(sopUserLogsInfo.getInComingETime(),
+                            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
                     );
-                    return entryDate.equals(createDate);
+
+                    return !entryDate.isBefore(inComingSTime) && !entryDate.isAfter(inComingETime);
                 } catch (Exception e) {
                     return false;
                 }
             };
 
-            if (sopUserLogsInfo.getTagIds() != null || !isRemarkEmpty || !StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getEntryTime()) ||!isLevelEmpty) {
+
+            boolean hasTimeFilter = !StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getInComingSTime())
+                    && !StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getInComingETime());
+
+            if (sopUserLogsInfo.getTagIds() != null || !isRemarkEmpty || hasTimeFilter ||!isLevelEmpty) {
                 list = list.stream()
                         .filter(tagFilter.and(remarkFilter).and(timeFilter).and(levelFilter))
                         .collect(Collectors.toList());

+ 30 - 4
fs-company/src/main/java/com/fs/company/controller/store/FsInquiryOrderController.java

@@ -1,5 +1,6 @@
 package com.fs.company.controller.store;
 
+import cn.hutool.core.util.IdUtil;
 import com.alibaba.fastjson.JSON;
 import com.fs.common.annotation.Log;
 import com.fs.common.annotation.RepeatSubmit;
@@ -7,6 +8,7 @@ import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.core.redis.RedisCache;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.StringUtils;
 import com.fs.framework.security.LoginUser;
@@ -16,6 +18,7 @@ import com.fs.his.domain.FsInquiryOrder;
 import com.fs.his.domain.FsInquiryOrderMsg;
 import com.fs.his.domain.FsStoreOrderLogs;
 import com.fs.his.param.FsInquiryOrderCancelParam;
+import com.fs.his.param.FsInquiryOrderCreateParam;
 import com.fs.his.param.FsInquiryOrderParam;
 import com.fs.his.param.FsInquiryOrderRefundParam;
 import com.fs.his.service.IFsDoctorService;
@@ -32,9 +35,11 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Base64;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 /**
  * 问诊订单Controller
@@ -59,7 +64,7 @@ public class FsInquiryOrderController extends BaseController
     /**
      * 查询问诊订单列表
      */
-    @PreAuthorize("@ss.hasPermi('store:inquiryOrder:list')")
+//    @PreAuthorize("@ss.hasPermi('store:inquiryOrder:list')")
     @GetMapping("/list")
    public TableDataInfo list(FsInquiryOrderParam fsInquiryOrder)
     {
@@ -247,16 +252,24 @@ public class FsInquiryOrderController extends BaseController
         }
         return AjaxResult.success(fsInquiryOrderVO);
     }
-
+    @Autowired
+    RedisCache redisCache;
     /**
      * 新增问诊订单
      */
     @PreAuthorize("@ss.hasPermi('store:inquiryOrder:add')")
     @Log(title = "问诊订单", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody FsInquiryOrder fsInquiryOrder)
+    public R add(@RequestBody FsInquiryOrderCreateParam param)
     {
-        return toAjax(fsInquiryOrderService.insertFsInquiryOrder(fsInquiryOrder));
+        String uuid = IdUtil.randomUUID();
+        redisCache.setCacheObject("orderKey:"+uuid,uuid,200, TimeUnit.MINUTES);
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        param.setOrderKey(uuid);
+        param.setCompanyId(loginUser.getCompany().getCompanyId());
+        param.setCompanyUserId(loginUser.getUser().getUserId());
+        param.setIsVisit("就诊过");
+        return fsInquiryOrderService.createOrder(param);
     }
 
     /**
@@ -350,4 +363,17 @@ public class FsInquiryOrderController extends BaseController
     }
 
 
+    /**
+    * 生成订单二维码
+    */
+    @PreAuthorize("@ss.hasPermi('store:inquiryOrder:wxaCodeInquiryOrder')")
+    @GetMapping("/getWxaCodeInquiryOrderUnLimit/{orderId}")
+    public AjaxResult getWxaCodeInquiryOrderUnLimit(@PathVariable("orderId") Long orderId)
+    {
+
+        byte[] bytes = fsInquiryOrderService.getWxaCodeInquiryOrderUnLimit(orderId);
+        String base64 = Base64.getEncoder().encodeToString(bytes);
+        return AjaxResult.success("成功",base64);
+
+    }
 }

+ 7 - 0
fs-company/src/main/java/com/fs/company/controller/store/FsStoreOrderController.java

@@ -527,6 +527,11 @@ public class FsStoreOrderController extends BaseController
     @Autowired
     @Qualifier("wdtErpOrderServiceImpl")
     private IErpOrderService wdtOrderService;
+
+    @Autowired
+    @Qualifier("JSTErpOrderServiceImpl")
+    private IErpOrderService jSTOrderService;
+
     private IErpOrderService getErpService() {
         FsSysConfig sysConfig = configUtil.getSysConfig();
         Integer erpOpen = sysConfig.getErpOpen();
@@ -541,6 +546,8 @@ public class FsStoreOrderController extends BaseController
                 } else if (erpType == 2){
                     //旺店通
                     erpOrderService =  wdtOrderService;
+                }else if(erpType == 5){
+                    erpOrderService = jSTOrderService;
                 }
                 return erpOrderService;
 

+ 14 - 5
fs-company/src/main/java/com/fs/company/controller/store/FsUserController.java

@@ -1,5 +1,6 @@
 package com.fs.company.controller.store;
 
+import com.alibaba.fastjson.JSON;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
@@ -9,6 +10,7 @@ import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.course.service.IFsUserCompanyUserService;
 import com.fs.framework.security.LoginUser;
 import com.fs.framework.security.SecurityUtils;
 import com.fs.framework.service.TokenService;
@@ -19,11 +21,13 @@ import com.fs.his.service.IFsUserService;
 import com.fs.his.vo.FsUserExportListVO;
 import com.fs.his.vo.FsUserVO;
 import com.fs.his.vo.UserVo;
+import com.fs.qw.dto.UserProjectDTO;
 import com.fs.store.param.h5.FsUserPageListParam;
 import com.fs.store.vo.h5.FsUserPageListVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -41,6 +45,7 @@ import static com.fs.his.utils.PhoneUtil.encryptPhone;
  * @author fs
  * @date 2023-06-07
  */
+@Slf4j
 @RestController
 @RequestMapping("/store/user")
 public class FsUserController extends BaseController
@@ -49,6 +54,8 @@ public class FsUserController extends BaseController
     private IFsUserService fsUserService;
     @Autowired
     private TokenService tokenService;
+    @Autowired
+    private IFsUserCompanyUserService userCompanyUserService;
 
     /**
      * 查询用户列表
@@ -76,9 +83,10 @@ public class FsUserController extends BaseController
     public TableDataInfo userList(FsUserParam fsUser)
     {
         startPage();
-        if(fsUser.getPhoneMk()!=null&&fsUser.getPhone()!=""){
-            fsUser.setPhone(encryptPhone(fsUser.getPhoneMk()));
-        }
+
+
+        fsUser.setPhone(encryptPhone(fsUser.getPhone()));
+
         List<FsUserVO> list = fsUserService.selectFsUserListVOByComponent(fsUser);
         for (FsUserVO fsUserVO : list) {
             fsUserVO.setPhone(decryptAutoPhoneMk(fsUserVO.getPhone()));
@@ -246,8 +254,9 @@ public class FsUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('users:user:enabledUsers')")
     @PostMapping("/enabledUsers")
     @ApiOperation("批量启用会员")
-    public ResponseResult<Boolean> enabledUsers(@RequestBody String[] ids) {
-        Boolean r = fsUserService.disabledUser(ids, true);
+    public ResponseResult<Boolean> enabledUsers(@RequestBody List<UserProjectDTO> ids) {
+        log.debug("批量启用会员 ids: {}", JSON.toJSONString(ids));
+        Boolean r = userCompanyUserService.batchUpdateUserProjectStatus(ids, 1);
         return ResponseResult.ok(r);
     }
 

+ 8 - 5
fs-doctor-app/src/main/java/com/fs/app/controller/InquiryOrderController.java

@@ -48,10 +48,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 import static com.fs.his.utils.PhoneUtil.decryptPhone;
 
@@ -94,7 +91,13 @@ public class InquiryOrderController extends  AppBaseController {
     {
         FsDoctor doctor=doctorService.selectFsDoctorByDoctorId(Long.parseLong(getDoctorId()));
         PageHelper.startPage(param.getPageNum(), param.getPageSize());
-        param.setDoctorId(Long.parseLong(getDoctorId()));
+
+        if (Objects.nonNull(param.getUserId())) {
+            param.setDoctorId(null);
+        } else if (Objects.nonNull(param.getDoctorId())) {
+            param.setDoctorId(Long.parseLong(getDoctorId()));
+        }
+
         param.setIsAccept(doctor.getIsAccept());
         param.setIsSelf(doctor.getIsSelf());
         List<FsInquiryOrderListPDVO> list = inquiryOrderService.selectFsInquiryOrderListPDVO(param);

+ 7 - 3
fs-ipad-task/src/main/java/com/fs/app/service/IpadSendServer.java

@@ -141,10 +141,10 @@ public class IpadSendServer {
         }
     }
 
-    public boolean isSend(QwUser qwUser) {
+    public boolean isSend(QwUser qwUser, BaseVo parentVo) {
         // 判断企微发送方式是否是ipad
         if (qwUser.getSendMsgType() == 0) {
-            log.debug("企微用户:ID:{} 名称:{} 发送方式:{}", qwUser.getId(), qwUser.getQwUserName(), qwUser.getSendMsgType().toString());
+            log.debug("发送方式是侧边栏企微用户:ID:{} 名称:{}", qwUser.getId(), qwUser.getQwUserName());
             return false;
         }
         // 判断是否信息准确
@@ -188,6 +188,7 @@ public class IpadSendServer {
                 qwUserMapper.updateById(updateQwUser);
                 return false;
             }
+            parentVo.setCorpId(login.getUser_info().getObject().getCorp_id());
             log.debug("QwUserID:{}, AI主机信息:{}", qwUser.getId(), login);
         } catch (Exception e) {
             updateQwUser.setId(qwUser.getId());
@@ -196,6 +197,7 @@ public class IpadSendServer {
             qwUserMapper.updateById(updateQwUser);
             return false;
         }
+
         return true;
     }
 
@@ -277,13 +279,15 @@ public class IpadSendServer {
         return true;
     }
 
-    public void send(QwSopCourseFinishTempSetting.Setting content, QwUser qwUser, QwSopLogs qwSopLogs, Map<String, CourseMaConfig> miniMap) {
+    public void send(QwSopCourseFinishTempSetting.Setting content, QwUser qwUser, QwSopLogs qwSopLogs, Map<String, CourseMaConfig> miniMap, BaseVo parentVo) {
         BaseVo vo = new BaseVo();
         vo.setId(Long.parseLong(qwSopLogs.getId()));
         vo.setRoom(qwSopLogs.getSendType() == 12);
         vo.setUuid(qwUser.getUid());
         vo.setExId(qwSopLogs.getExternalUserId());
         vo.setServerId(qwUser.getServerId());
+        vo.setCorpCode(parentVo.getCorpCode());
+        vo.setCorpId(parentVo.getCorpId());
         try {
             content.setSendStatus(1);
             switch (content.getContentType()) {

+ 37 - 48
fs-ipad-task/src/main/java/com/fs/app/task/SendMsg.java

@@ -15,7 +15,6 @@ import com.fs.qw.mapper.QwIpadServerMapper;
 import com.fs.qw.mapper.QwUserMapper;
 import com.fs.qw.service.impl.AsyncSopTestService;
 import com.fs.qw.vo.QwSopCourseFinishTempSetting;
-import com.fs.qw.vo.QwSopTempSetting;
 import com.fs.sop.domain.QwSopLogs;
 import com.fs.sop.mapper.QwSopLogsMapper;
 import com.fs.sop.service.IQwSopLogsService;
@@ -37,7 +36,6 @@ import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
 
 @Component
 @Slf4j
@@ -56,7 +54,6 @@ public class SendMsg {
     private String groupNo;
     private final List<QwUser> qwUserList = Collections.synchronizedList(new ArrayList<>());
     private final Map<Long, Long> qwMap = new ConcurrentHashMap<>();
-    private final Map<Long, Long> removeQwMap = new ConcurrentHashMap<>();
 
     @Autowired
     @Qualifier("customThreadPool")
@@ -75,7 +72,7 @@ public class SendMsg {
     private List<QwUser> getQwUserList() {
         if (qwUserList.isEmpty()) {
             List<QwIpadServer> serverList = qwIpadServerMapper.selectList(new QueryWrapper<QwIpadServer>().eq("group_no", groupNo));
-            if(serverList.isEmpty()){
+            if (serverList.isEmpty()) {
                 return new ArrayList<>();
             }
             List<Long> serverIds = PubFun.listToNewList(serverList, QwIpadServer::getId);
@@ -117,45 +114,36 @@ public class SendMsg {
             delayEnd = config.getDelayEnd();
         }
         Map<String, CourseMaConfig> miniMap = getMiniMap();
-        // 清空需要删除的
-        List<Long> keyList = new ArrayList<>(removeQwMap.keySet());
-        keyList.forEach(key -> {
-            removeQwMap.remove(key);
-            qwMap.remove(key);
-        });
-        log.info("删除id:{}", JSON.toJSONString(keyList));
         getQwUserList().forEach(e -> {
-            synchronized (e.getId()){
-                if (qwMap.containsKey(e.getId())) {
-                    log.error("用户:{}已在处理中,跳过重复执行", e.getQwUserName());
-                    return;
-                }
-                qwMap.computeIfAbsent(e.getId(), k -> {
-                    CompletableFuture.runAsync(() -> {
-                        try {
-                            processUser(e, delayStart, delayEnd, miniMap);
-                        } catch (Exception exception){
-                            log.error("发送错误:", exception);
-                        }finally {
-                            removeQwMap.putIfAbsent(e.getId(), System.currentTimeMillis());
-                        }
-                    }, customThreadPool);
-                    return System.currentTimeMillis(); // 占位值
-                });
-            }
+            qwMap.computeIfAbsent(e.getId(), k -> {
+                CompletableFuture.runAsync(() -> {
+                    try {
+                        log.info("开始任务:{}", e.getQwUserName());
+                        processUser(e, delayStart, delayEnd, miniMap);
+                    } catch (Exception exception) {
+                        log.error("发送错误:", exception);
+                    } finally {
+                        log.info("删除任务:{}", e.getQwUserName());
+                        qwMap.remove(e.getId());
+//                        removeQwMap.putIfAbsent(e.getId(), System.currentTimeMillis());
+                    }
+                }, customThreadPool);
+                return System.currentTimeMillis(); // 占位值
+            });
         });
     }
 
     private void processUser(QwUser qwUser, int delayStart, int delayEnd, Map<String, CourseMaConfig> miniMap) {
         long start1 = System.currentTimeMillis();
         List<QwSopLogs> qwSopLogList = qwSopLogsMapper.selectByQwUserId(qwUser.getId());
-        if(qwSopLogList.isEmpty()){
+        if (qwSopLogList.isEmpty()) {
             return;
         }
         QwUser user = qwUserMapper.selectById(qwUser.getId());
         BaseVo parentVo = new BaseVo();
+        parentVo.setCorpCode(qwUser.getCorpId());
         long end1 = System.currentTimeMillis();
-        if (!sendServer.isSend(user)) {
+        if (!sendServer.isSend(user, parentVo)) {
             return;
         }
         log.info("销售:{}, 消息:{}, 耗时: {}, 时间:{}", user.getQwUserName(), qwSopLogList.size(), end1 - start1, qwMap.get(qwUser.getId()));
@@ -171,24 +159,27 @@ public class SendMsg {
             log.info("进入发送消息状态:{}", qwSopLogs.getId());
             String key = "qw:logs:pad:send:id:" + qwSopLogs.getId();
             Long time = redisCache.getCacheObject(key);
-            if(redisCache.getCacheObject(key) != null){
+            if (redisCache.getCacheObject(key) != null) {
                 log.error("{}已有发送:{}, :{}", qwUser.getQwUserName(), qwSopLogs.getId(), time);
-                return;
+                continue;
             }
             redisCache.setCacheObject(key, System.currentTimeMillis(), 10, TimeUnit.MINUTES);
             for (QwSopCourseFinishTempSetting.Setting content : setting.getSetting()) {
-                sendServer.send(content, user, qwSopLogs, miniMap);
-//                if(content.getSendStatus() == 2 && "请求失败:消息发送过于频繁,请稍后再试".equals(content.getSendRemarks())){
-//                    QwUser update = new QwUser();
-//                    update.setRemark("请求频率异常,暂停发送,三小时后恢复继续发送");
-//                    update.setUpdateTime(new Date());
-//                    qwUserMapper.update(update, new QueryWrapper<QwUser>().eq("id", user.getId()));
-//                    redisCache.setCacheObject("qw:user:id:" + user.getId(), user.getId(), 3, TimeUnit.HOURS);
-//                    return;
-//                }
+                long start4 = System.currentTimeMillis();
+                sendServer.send(content, user, qwSopLogs, miniMap, parentVo);
+                long end4 = System.currentTimeMillis();
+                log.info("请求pad发送完成:{}, {}, 时长4:{}", user.getQwUserName(), qwSopLogs.getId(), end4 - start4);
+                if(content.getSendStatus() == 2 && "请求失败:消息发送过于频繁,请稍后再试".equals(content.getSendRemarks())){
+                    QwUser update = new QwUser();
+                    update.setRemark("请求频率异常,暂停发送,三小时后恢复继续发送");
+                    update.setUpdateTime(new Date());
+                    qwUserMapper.update(update, new QueryWrapper<QwUser>().eq("id", user.getId()));
+                    redisCache.setCacheObject("qw:user:id:" + user.getId(), user.getId(), 3, TimeUnit.HOURS);
+                    return;
+                }
                 try {
                     int delay = ThreadLocalRandom.current().nextInt(300, 1000);
-                    log.debug("等待:{}ms", delay);
+                    log.debug("pad发送消息等待:{}ms", delay);
                     Thread.sleep(delay);
                 } catch (InterruptedException e) {
                     log.error("线程等待错误!");
@@ -214,15 +205,13 @@ public class SendMsg {
                 updateQwSop.setRemark("全部发送成功");
                 updateQwSop.setRealSendTime(sdf.format(new Date()));
             }
-//            updateQwSop.setReceivingStatus(1L);
-//            updateQwSop.setSendStatus(1L);
-//            updateQwSop.setRealSendTime(sdf.format(new Date()));
+            updateQwSop.setContentJson(JSON.toJSONString(setting));
             long end2 = System.currentTimeMillis();
             int i = qwSopLogsService.updateQwSopLogsSendType(updateQwSop);
-            log.info("销售:{}, 修改条数{}, 发送方消息完成:{}, 耗时: {}", user.getQwUserName(), i, qwSopLogs.getId(),end2 - start2);
+            log.info("销售:{}, 修改条数{}, 发送方消息完成:{}, 耗时: {}", user.getQwUserName(), i, qwSopLogs.getId(), end2 - start2);
             try {
                 int delay = ThreadLocalRandom.current().nextInt(delayStart, delayEnd);
-                log.debug("等待:{}ms", delay);
+                log.debug("企微发送消息等待:{}ms", delay);
                 Thread.sleep(delay);
             } catch (InterruptedException e) {
                 log.error("线程等待错误!");

+ 1 - 0
fs-ipad-task/src/main/java/com/fs/framework/config/DataSourceConfig.java

@@ -66,6 +66,7 @@ public class DataSourceConfig {
 
         targetDataSources.put(DataSourceType.SLAVE.name(), slaveDataSource);
         targetDataSources.put(DataSourceType.SOP.name(), sopDataSource);
+        targetDataSources.put(DataSourceType.SopREAD.name(), sopReadDataSource);
         targetDataSources.put(DataSourceType.CLICKHOUSE.name(), clickhouseDataSource); // Ensure matching key
         return new DynamicDataSource(masterDataSource, targetDataSources);
     }

+ 18 - 13
fs-qw-task/src/main/java/com/fs/app/controller/CommonController.java

@@ -12,13 +12,17 @@ import com.fs.course.service.IFsCourseLinkService;
 import com.fs.course.service.IFsCourseWatchLogService;
 import com.fs.course.service.IFsUserVideoService;
 import com.fs.course.service.IHuaweiObsService;
+import com.fs.his.service.IFsInquiryOrderService;
+import com.fs.his.service.IFsPackageOrderService;
 import com.fs.qw.mapper.QwExternalContactMapper;
 import com.fs.qw.service.IQwExternalContactService;
+import com.fs.qw.service.IQwMaterialService;
 import com.fs.qwApi.service.QwApiService;
 import com.fs.sop.mapper.QwSopLogsMapper;
 import com.fs.sop.mapper.QwSopMapper;
 import com.fs.sop.mapper.SopUserLogsMapper;
 import com.fs.sop.service.*;
+import com.fs.sop.vo.ExtCourseSopWatchLogVO;
 import com.fs.sop.vo.QwSopLogsDoSendListTVO;
 import com.fs.store.service.IFsUserCourseCountService;
 import io.swagger.annotations.Api;
@@ -33,6 +37,7 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.Arrays;
+import java.util.Base64;
 import java.util.List;
 import java.util.Optional;
 
@@ -90,6 +95,18 @@ public class CommonController {
     @Autowired
     private IFsUserCourseCountService userCourseCountService;
 
+    @Autowired
+    private ISopUserLogsInfoService iSopUserLogsInfoService;
+
+    @Autowired
+    private IFsInquiryOrderService inquiryOrderService;
+
+    @Autowired
+    private IQwMaterialService iQwMaterialService;
+
+
+    @Autowired
+    private IFsCourseLinkService iFsCourseLinkService;
 
     /**
     * 发官方通连
@@ -130,19 +147,7 @@ public class CommonController {
     @GetMapping("/testSop")
     public R testSop() throws Exception {
 
-//        iSopUserLogsService.repairSopUserLogsTimer();
-//        List<QwSopLogsDoSendListTVO> expireded = iQwSopLogsService.expiredMessagesByQwSopLogs();
-//        if (!expireded.isEmpty()) {
-//            processAndInsertQwSopLogs(expireded);
-//        }
-//
-//        // 将标签字符串解析为 List    //客户总标签
-//        List<String> tagIdsList = new ArrayList<>();
-//        tagIdsList.add("etW3ylWQAAcHQ4wJdAOMMZRfQnn3Sp2w");
-//        tagIdsList.add("etW3ylWQAAdRYbwUx0P1kkL7695Vxn3g");
-//        tagIdsList.add("etW3ylWQAAZyu1C9XwtKNaCLJDE8PlBQ");
-
-        return R.ok();
+        return iFsCourseLinkService.getWxaCodeGenerateScheme("/pages_course/video.html?course={\"companyId\":100,\"companyUserId\":2020,\"corpId\":\"wweb0666cc79d79da5\",\"courseId\":61,\"link\":\"1950497651577323520\",\"linkType\":3,\"qwExternalId\":2356946,\"qwUserId\":\"1682\",\"uNo\":\"b8b010e1-ee0f-42ec-8ad8-06681d1b449a\",\"videoId\":366}","wx34bba1ae94d34986");
     }
 
     @GetMapping("/testRatingSop")

+ 73 - 0
fs-qwhook-sop/src/main/java/com/fs/app/controller/ApisQwMaterialBySidebar.java

@@ -0,0 +1,73 @@
+package com.fs.app.controller;
+
+import com.fs.common.core.domain.R;
+import com.fs.qw.domain.QwUser;
+import com.fs.qw.param.QwMaterialParam;
+import com.fs.qw.param.QwMaterialParamBySidebar;
+import com.fs.qw.service.IQwExternalContactService;
+import com.fs.qw.service.IQwMaterialService;
+import com.fs.qw.vo.QwMaterialVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Api("素材库库相关接口")
+@RestController
+@RequestMapping("/apis/app/qw/material")
+@Slf4j
+public class ApisQwMaterialBySidebar {
+
+
+
+    @Autowired
+    private IQwExternalContactService qwExternalContactService;
+
+    @Autowired
+    private IQwMaterialService qwMaterialService;
+
+    /**
+     * 查询素材库列表
+     */
+    @PostMapping("/MaterialList")
+    public R list(@RequestBody QwMaterialParamBySidebar param)
+    {
+
+        QwUser qwUser = qwExternalContactService.getQwUserByRedis(param.getCorpId().trim(),param.getQwUserId().trim());
+
+        if (qwUser == null || qwUser.getCompanyId() == null) {
+            return R.error("员工未绑定 销售公司 或 未获取到员工信息,请重试!");
+        }
+
+
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+
+        QwMaterialParam materialParam=new QwMaterialParam();
+        materialParam.setCompanyId(qwUser.getCompanyId());
+        materialParam.setTitle(param.getKeyword());
+        List<QwMaterialVO> list = qwMaterialService.selectQwMaterialList(materialParam);
+
+
+        PageInfo<QwMaterialVO> result = new PageInfo<>(list);
+        return R.ok().put("data", result);
+
+
+    }
+
+    @GetMapping("/updateMaterialTime/{materialId}")
+    public R updateMaterialTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTime(materialId));
+    }
+
+    @GetMapping("/getMaterialByTime/{materialId}")
+    public R getMaterialByTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTimeTwo(materialId));
+    }
+
+}

+ 18 - 0
fs-qwhook-sop/src/main/java/com/fs/app/controller/ApisQwUserController.java

@@ -7,10 +7,13 @@ import com.fs.course.param.FsCourseListBySidebarParam;
 import com.fs.qw.domain.QwExternalContactInfo;
 import com.fs.qw.domain.QwUser;
 import com.fs.qw.param.ExternalContactDetailsParam;
+import com.fs.qw.param.QwExtCourseSopWatchLog;
 import com.fs.qw.service.IQwExternalContactInfoService;
 import com.fs.qw.service.IQwExternalContactService;
 import com.fs.qw.vo.ExternalContactDetailsVO;
 import com.fs.qw.vo.QwExternalListByHeavyVO;
+import com.fs.sop.service.ISopUserLogsInfoService;
+import com.fs.sop.vo.ExtCourseSopWatchLogVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -36,6 +39,9 @@ public class ApisQwUserController extends BaseController {
     @Autowired
     private IQwExternalContactInfoService qwExternalContactInfoService;
 
+    @Autowired
+    private ISopUserLogsInfoService iSopUserLogsInfoService;
+
     @GetMapping("/details")
     @ApiOperation("会员看课详情")
     public R getUserDetails(@ApiParam(value = "外部联系人id", required = true) @RequestParam Long contactId,
@@ -98,4 +104,16 @@ public class ApisQwUserController extends BaseController {
         PageInfo<QwExternalListByHeavyVO> result = new PageInfo<>(qwExternalListByHeavy);
         return R.ok().put("data", result);
     }
+
+    @PostMapping("/extCourseSopWatchLog")
+    @ApiOperation("获取外部联系人按照 营期天数 获取到的今天该看的课")
+    public R getExtCourseSopWatchLog(@RequestBody QwExtCourseSopWatchLog param) {
+
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+        List<ExtCourseSopWatchLogVO> list = iSopUserLogsInfoService.getExtCourseSopWatchLog(param);
+        PageInfo<ExtCourseSopWatchLogVO> result = new PageInfo<>(list);
+
+        return R.ok().put("data", result);
+    }
+
 }

+ 72 - 0
fs-qwhook-sop/src/main/java/com/fs/app/controller/QwMaterialBySidebar.java

@@ -0,0 +1,72 @@
+package com.fs.app.controller;
+
+import com.fs.common.core.domain.R;
+import com.fs.qw.domain.QwUser;
+import com.fs.qw.param.QwMaterialParam;
+import com.fs.qw.param.QwMaterialParamBySidebar;
+import com.fs.qw.service.IQwExternalContactService;
+import com.fs.qw.service.IQwMaterialService;
+import com.fs.qw.vo.QwMaterialVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Api("素材库库相关接口")
+@RestController
+@RequestMapping("/app/qw/material")
+@Slf4j
+public class QwMaterialBySidebar {
+
+
+
+    @Autowired
+    private IQwExternalContactService qwExternalContactService;
+
+    @Autowired
+    private IQwMaterialService qwMaterialService;
+
+    /**
+     * 查询素材库列表
+     */
+    @PostMapping("/MaterialList")
+    public R list(@RequestBody QwMaterialParamBySidebar param)
+    {
+
+        QwUser qwUser = qwExternalContactService.getQwUserByRedis(param.getCorpId().trim(),param.getQwUserId().trim());
+
+        if (qwUser == null || qwUser.getCompanyId() == null) {
+            return R.error("员工未绑定 销售公司 或 未获取到员工信息,请重试!");
+        }
+
+
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+
+        QwMaterialParam materialParam=new QwMaterialParam();
+        materialParam.setCompanyId(qwUser.getCompanyId());
+        materialParam.setTitle(param.getKeyword());
+        List<QwMaterialVO> list = qwMaterialService.selectQwMaterialList(materialParam);
+
+
+        PageInfo<QwMaterialVO> result = new PageInfo<>(list);
+        return R.ok().put("data", result);
+
+    }
+
+    @GetMapping("/updateMaterialTime/{materialId}")
+    public R updateMaterialTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTime(materialId));
+    }
+
+    @GetMapping("/getMaterialByTime/{materialId}")
+    public R getMaterialByTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTimeTwo(materialId));
+    }
+
+}

+ 18 - 0
fs-qwhook-sop/src/main/java/com/fs/app/controller/QwUserController.java

@@ -7,6 +7,7 @@ import com.fs.common.exception.CustomException;
 import com.fs.qw.domain.QwExternalContactInfo;
 import com.fs.qw.domain.QwTagGroup;
 import com.fs.qw.param.ExternalContactDetailsParam;
+import com.fs.qw.param.QwExtCourseSopWatchLog;
 import com.fs.qw.param.sidebar.ExternalContactInfoParam;
 import com.fs.qw.param.sidebar.TagGroupListParam;
 import com.fs.qw.param.sidebar.TagGroupUpdateParam;
@@ -17,6 +18,8 @@ import com.fs.qw.vo.ExternalContactDetailsVO;
 import com.fs.qw.vo.QwTagGroupListVO;
 import com.fs.qw.vo.sidebar.ExternalContactInfoVO;
 import com.fs.qw.vo.sidebar.ExternalContactTagVO;
+import com.fs.sop.service.ISopUserLogsInfoService;
+import com.fs.sop.vo.ExtCourseSopWatchLogVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -45,6 +48,9 @@ public class QwUserController extends BaseController {
     @Autowired
     private IQwTagGroupService qwTagGroupService;
 
+    @Autowired
+    private ISopUserLogsInfoService iSopUserLogsInfoService;
+
     @GetMapping("/details")
     @ApiOperation("会员看课详情")
     public R getUserDetails(@ApiParam(value = "外部联系人id", required = true) @RequestParam Long contactId,
@@ -81,6 +87,18 @@ public class QwUserController extends BaseController {
         return R.ok();
     }
 
+    @PostMapping("/extCourseSopWatchLog")
+    @ApiOperation("获取外部联系人按照 营期天数 获取到的今天该看的课")
+    public R getExtCourseSopWatchLog(@RequestBody QwExtCourseSopWatchLog param) {
+
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+        List<ExtCourseSopWatchLogVO> list = iSopUserLogsInfoService.getExtCourseSopWatchLog(param);
+        PageInfo<ExtCourseSopWatchLogVO> result = new PageInfo<>(list);
+
+        return R.ok().put("data", result);
+    }
+
+
     @GetMapping("/externalContact")
     @ApiOperation("获取侧边栏外部联系人信息")
     public R getExternalContactInfo(@RequestParam(value = "qwExternalContactId") Long qwExternalContactId) {

+ 81 - 0
fs-qwhook/src/main/java/com/fs/app/controller/ApisQwMaterialBySidebar.java

@@ -0,0 +1,81 @@
+package com.fs.app.controller;
+
+import com.fs.common.core.domain.R;
+import com.fs.qw.domain.QwMaterial;
+import com.fs.qw.domain.QwUser;
+import com.fs.qw.param.QwMaterialParam;
+import com.fs.qw.param.QwMaterialParamBySidebar;
+import com.fs.qw.service.IQwExternalContactService;
+import com.fs.qw.service.IQwMaterialService;
+import com.fs.qw.vo.QwMaterialVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Api("素材库库相关接口")
+@RestController
+@RequestMapping("/apis/app/qw/material")
+@Slf4j
+public class ApisQwMaterialBySidebar {
+
+
+
+    @Autowired
+    private IQwExternalContactService qwExternalContactService;
+
+    @Autowired
+    private IQwMaterialService qwMaterialService;
+
+    /**
+     * 查询素材库列表
+     */
+    @PostMapping("/MaterialList")
+    public R list(@RequestBody QwMaterialParamBySidebar param)
+    {
+
+        QwUser qwUser = qwExternalContactService.getQwUserByRedis(param.getCorpId().trim(),param.getQwUserId().trim());
+
+        if (qwUser == null || qwUser.getCompanyId() == null) {
+            return R.error("员工未绑定 销售公司 或 未获取到员工信息,请重试!");
+        }
+
+
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+
+        QwMaterialParam materialParam=new QwMaterialParam();
+        materialParam.setCompanyId(qwUser.getCompanyId());
+        materialParam.setTitle(param.getKeyword());
+        List<QwMaterialVO> list = qwMaterialService.selectQwMaterialList(materialParam);
+
+
+        PageInfo<QwMaterialVO> result = new PageInfo<>(list);
+        return R.ok().put("data", result);
+
+
+    }
+
+    /**
+    * 更新 素材库的某个素材的 media_id
+    */
+    @GetMapping("/updateMaterialTime/{materialId}")
+    public R updateMaterialTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTime(materialId));
+    }
+
+    /**
+    * 获取某个素材id
+    */
+    @GetMapping("/getMaterialByTime/{materialId}")
+    public R getMaterialByTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTimeTwo(materialId));
+    }
+
+
+}

+ 20 - 0
fs-qwhook/src/main/java/com/fs/app/controller/ApisQwUserController.java

@@ -3,12 +3,14 @@ package com.fs.app.controller;
 import com.fs.common.BeanCopyUtils;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.exception.CustomException;
 import com.fs.course.param.FsCourseListBySidebarParam;
 import com.fs.qw.domain.QwExternalContactInfo;
 import com.fs.qw.domain.QwTagGroup;
 import com.fs.qw.domain.QwUser;
 import com.fs.qw.param.ExternalContactDetailsParam;
+import com.fs.qw.param.QwExtCourseSopWatchLog;
 import com.fs.qw.param.sidebar.ExternalContactInfoParam;
 import com.fs.qw.param.sidebar.TagGroupListParam;
 import com.fs.qw.param.sidebar.TagGroupUpdateParam;
@@ -21,6 +23,8 @@ import com.fs.qw.vo.QwExternalListByHeavyVO;
 import com.fs.qw.vo.QwTagGroupListVO;
 import com.fs.qw.vo.sidebar.ExternalContactInfoVO;
 import com.fs.qw.vo.sidebar.ExternalContactTagVO;
+import com.fs.sop.service.ISopUserLogsInfoService;
+import com.fs.sop.vo.ExtCourseSopWatchLogVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -49,6 +53,10 @@ public class ApisQwUserController extends BaseController {
     @Autowired
     private IQwTagGroupService qwTagGroupService;
 
+    @Autowired
+    private ISopUserLogsInfoService iSopUserLogsInfoService;
+
+
     @GetMapping("/details")
     @ApiOperation("会员看课详情")
     public R getUserDetails(@ApiParam(value = "外部联系人id", required = true) @RequestParam Long contactId,
@@ -112,6 +120,18 @@ public class ApisQwUserController extends BaseController {
         return R.ok().put("data", result);
     }
 
+
+    @PostMapping("/extCourseSopWatchLog")
+    @ApiOperation("获取外部联系人按照 营期天数 获取到的今天该看的课")
+    public R getExtCourseSopWatchLog(@RequestBody QwExtCourseSopWatchLog param) {
+
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+        List<ExtCourseSopWatchLogVO> list = iSopUserLogsInfoService.getExtCourseSopWatchLog(param);
+        PageInfo<ExtCourseSopWatchLogVO> result = new PageInfo<>(list);
+
+        return R.ok().put("data", result);
+    }
+
     @GetMapping("/externalContact")
     @ApiOperation("获取侧边栏外部联系人信息")
     public R getExternalContactInfo(@RequestParam(value = "qwExternalContactId") Long qwExternalContactId) {

+ 73 - 0
fs-qwhook/src/main/java/com/fs/app/controller/QwMaterialBySidebar.java

@@ -0,0 +1,73 @@
+package com.fs.app.controller;
+
+import com.fs.common.core.domain.R;
+import com.fs.qw.domain.QwUser;
+import com.fs.qw.param.QwMaterialParam;
+import com.fs.qw.param.QwMaterialParamBySidebar;
+import com.fs.qw.service.IQwExternalContactService;
+import com.fs.qw.service.IQwMaterialService;
+import com.fs.qw.vo.QwMaterialVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Api("素材库库相关接口")
+@RestController
+@RequestMapping("/app/qw/material")
+@Slf4j
+public class QwMaterialBySidebar {
+
+
+
+    @Autowired
+    private IQwExternalContactService qwExternalContactService;
+
+    @Autowired
+    private IQwMaterialService qwMaterialService;
+
+    /**
+     * 查询素材库列表
+     */
+    @PostMapping("/MaterialList")
+    public R list(@RequestBody QwMaterialParamBySidebar param)
+    {
+
+        QwUser qwUser = qwExternalContactService.getQwUserByRedis(param.getCorpId().trim(),param.getQwUserId().trim());
+
+        if (qwUser == null || qwUser.getCompanyId() == null) {
+            return R.error("员工未绑定 销售公司 或 未获取到员工信息,请重试!");
+        }
+
+
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+
+        QwMaterialParam materialParam=new QwMaterialParam();
+        materialParam.setCompanyId(qwUser.getCompanyId());
+        materialParam.setTitle(param.getKeyword());
+        List<QwMaterialVO> list = qwMaterialService.selectQwMaterialList(materialParam);
+
+
+        PageInfo<QwMaterialVO> result = new PageInfo<>(list);
+        return R.ok().put("data", result);
+
+
+    }
+
+    @GetMapping("/updateMaterialTime/{materialId}")
+    public R updateMaterialTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTime(materialId));
+    }
+
+    @GetMapping("/getMaterialByTime/{materialId}")
+    public R getMaterialByTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTimeTwo(materialId));
+    }
+
+}

+ 16 - 0
fs-qwhook/src/main/java/com/fs/app/controller/QwUserController.java

@@ -7,6 +7,7 @@ import com.fs.common.exception.CustomException;
 import com.fs.qw.domain.QwExternalContactInfo;
 import com.fs.qw.domain.QwTagGroup;
 import com.fs.qw.param.ExternalContactDetailsParam;
+import com.fs.qw.param.QwExtCourseSopWatchLog;
 import com.fs.qw.param.sidebar.ExternalContactInfoParam;
 import com.fs.qw.param.sidebar.TagGroupListParam;
 import com.fs.qw.param.sidebar.TagGroupUpdateParam;
@@ -17,6 +18,8 @@ import com.fs.qw.vo.ExternalContactDetailsVO;
 import com.fs.qw.vo.QwTagGroupListVO;
 import com.fs.qw.vo.sidebar.ExternalContactInfoVO;
 import com.fs.qw.vo.sidebar.ExternalContactTagVO;
+import com.fs.sop.service.ISopUserLogsInfoService;
+import com.fs.sop.vo.ExtCourseSopWatchLogVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -45,6 +48,9 @@ public class QwUserController extends BaseController {
     @Autowired
     private IQwTagGroupService qwTagGroupService;
 
+    @Autowired
+    private ISopUserLogsInfoService iSopUserLogsInfoService;
+
     @GetMapping("/details")
     @ApiOperation("会员看课详情")
     public R getUserDetails(@ApiParam(value = "外部联系人id", required = true) @RequestParam Long contactId,
@@ -81,6 +87,16 @@ public class QwUserController extends BaseController {
         return R.ok();
     }
 
+    @PostMapping("/extCourseSopWatchLog")
+    @ApiOperation("获取外部联系人按照 营期天数 获取到的今天该看的课")
+    public R getExtCourseSopWatchLog(@RequestBody QwExtCourseSopWatchLog param) {
+
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+        List<ExtCourseSopWatchLogVO> list = iSopUserLogsInfoService.getExtCourseSopWatchLog(param);
+        PageInfo<ExtCourseSopWatchLogVO> result = new PageInfo<>(list);
+
+        return R.ok().put("data", result);
+    }
 
     @GetMapping("/externalContact")
     @ApiOperation("获取侧边栏外部联系人信息")

+ 18 - 0
fs-redis/src/main/java/com/fs/app/redis/RedisKeyExpirationListener.java

@@ -6,10 +6,12 @@ import com.fs.event.TemplateBean;
 import com.fs.event.TemplateEvent;
 import com.fs.event.TemplateListenEnum;
 import com.fs.his.domain.FsInquiryOrder;
+import com.fs.his.domain.FsIntegralOrder;
 import com.fs.his.domain.FsPackageOrder;
 import com.fs.his.param.FsInquiryOrderCancelParam;
 import com.fs.his.service.IFsInquiryOrderLogsService;
 import com.fs.his.service.IFsInquiryOrderService;
+import com.fs.his.service.IFsIntegralOrderService;
 import com.fs.his.service.IFsPackageOrderService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -97,5 +99,21 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
             }
 
         }
+        // 积分订单
+        else if (key.contains(FsConstants.REDIS_INTEGRAL_ORDER_UNPAY)) {
+            key = key.replace(FsConstants.REDIS_INTEGRAL_ORDER_UNPAY, "");
+            log.info("body:{}",key);
+
+            Long orderId = Long.parseLong(key);
+            IFsIntegralOrderService orderService = SpringUtils.getBean(IFsIntegralOrderService.class);
+            FsIntegralOrder order = orderService.selectFsIntegralOrderByOrderId(orderId);
+            if (!order.getStatus().equals(4)){
+                return;
+            }
+
+            // 取消订单
+            orderService.cannelOrder(orderId);
+            log.info("积分订单id:{},超时未支付取消成功",orderId);
+        }
     }
 }

+ 0 - 0
fs-user-course/src/main/resources/application.yml → fs-redis/src/main/resources/application.yml


+ 1 - 1
fs-service/src/main/java/com/fs/common/param/LoginMaWxParam.java

@@ -34,7 +34,7 @@ public class LoginMaWxParam implements Serializable {
     @ApiModelProperty(value = "用户头像")
     private String avatar;
 
-//    @NotNull(message = "项目id不能为空")
+    @NotNull(message = "项目id不能为空")
     @ApiModelProperty(value = "课程归属项目id")
     private Long projectId;
 

+ 2 - 0
fs-service/src/main/java/com/fs/common/param/LoginParam.java

@@ -13,4 +13,6 @@ public class LoginParam implements Serializable {
     private String iv;
     private String rawData;
     private String signature;
+    private String appId;
+    private Integer authType;
 }

+ 21 - 0
fs-service/src/main/java/com/fs/company/domain/CompanyUser.java

@@ -151,9 +151,30 @@ public class CompanyUser extends BaseEntity
     /** 用户上级id */
     private Long parentId;
 
+    /** 微信小程序OPENID(如果有小程序授权) */
+    private String  maOpenId;
+
     /** 是否需要单独注册会员,1-是,0-否(用于个微销售分享看课) */
     private Integer isNeedRegisterMember;
 
+    /** 是否允许所有方式注册会员,1-是,0-否,默认1(用于个微注册会员) */
+    private Integer isAllowedAllRegister;
+
+    public String getMaOpenId() {
+        return maOpenId;
+    }
+
+    public void setMaOpenId(String maOpenId) {
+        this.maOpenId = maOpenId;
+    }
+
+    public Integer getIsAllowedAllRegister() {
+        return isAllowedAllRegister;
+    }
+
+    public void setIsAllowedAllRegister(Integer isAllowedAllRegister) {
+        this.isAllowedAllRegister = isAllowedAllRegister;
+    }
 
     public Long getParentId() {
         return parentId;

+ 4 - 0
fs-service/src/main/java/com/fs/company/domain/CompanyUserChangeApplyUser.java

@@ -21,4 +21,8 @@ public class CompanyUserChangeApplyUser {
      * 用户ID
      */
     private Long userId;
+    /**
+     * 项目ID
+     */
+    private Long projectId;
 }

+ 1 - 1
fs-service/src/main/java/com/fs/company/mapper/CompanyMapper.java

@@ -165,7 +165,7 @@ public interface CompanyMapper
             "</script>"})
     List<CompanyVO> selectCompanyListVO(Company param);
 
-    @Select("select company_id dictValue,company_name dictLabel from company")
+    @Select("select company_id dictValue,company_name dictLabel from company where is_del= 0")
     List<OptionsVO> selectAllCompanyList();
 
     @Select("select company_id from company")

+ 2 - 0
fs-service/src/main/java/com/fs/company/mapper/CompanyTagMapper.java

@@ -80,4 +80,6 @@ public interface CompanyTagMapper
     String findUserTagByUserId(@Param("userId") Long userId,@Param("companyUserId") Long companyUserId);
     @MapKey("tagId")
     Map<Long,CompanyTag> queryAllTagMap();
+
+    List<CompanyTag> selectCompanyTagByList(@Param("params") Map<String, Object> params);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/company/mapper/CompanyTagUserMapper.java

@@ -81,4 +81,6 @@ public interface CompanyTagUserMapper
     void deleteCompanyTagUserByMap(@Param("params") Map<String, Object> params);
 
     List<CompanyUserTagListVO> getTagByUser(@Param("params")CompanyTagUser param);
+
+    List<CompanyTagUserVO> selectUserByMap(@Param("params") Map<String, Object> params);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/company/mapper/CompanyUserMapper.java

@@ -301,4 +301,6 @@ public interface CompanyUserMapper
      * @param companyUserList 用户信息
      * **/
     void batchUpdateUserDept(@Param("companyUserList") List<CompanyUser> companyUserList);
+
+    String selectCompanyUserNameByIds(@Param("companyUserIds")String companyUserIds);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/company/service/ICompanyTagService.java

@@ -77,4 +77,6 @@ public interface ICompanyTagService
     Map<Long,CompanyTag> queryAllTagMap();
 
     String findUserTagByUserId(Long userId,Long companyUserId);
+
+    List<CompanyTag> selectCompanyTagByList(Map<String, Object> params);
 }

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

@@ -91,4 +91,9 @@ public interface ICompanyTagUserService
      * @return
      */
     List<CompanyUserTagListVO> getTagByUser(CompanyTagUser param);
+
+    /**
+     * 根据条件查询标签下用户
+     */
+    List<CompanyTagUserVO> selectUserByMap(Map<String, Object> params);
 }

+ 2 - 1
fs-service/src/main/java/com/fs/company/service/ICompanyUserChangeApplyService.java

@@ -3,6 +3,7 @@ package com.fs.company.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fs.company.domain.CompanyUserChangeApply;
 import com.fs.company.vo.CompanyUserChangeApplyVO;
+import com.fs.qw.dto.UserProjectDTO;
 
 import java.util.List;
 import java.util.Map;
@@ -19,7 +20,7 @@ public interface ICompanyUserChangeApplyService extends IService<CompanyUserChan
      * @param companyId 公司ID
      * @param userName  操作用户
      */
-    void apply(Long from, Long to, Integer type, List<Long> ids, Long companyId, String userName);
+    void apply(Long from, Long to, Integer type, List<UserProjectDTO> ids, Long companyId, String userName);
 
     /**
      * 查询申请列表

+ 4 - 2
fs-service/src/main/java/com/fs/company/service/ICompanyUserService.java

@@ -10,6 +10,7 @@ import com.fs.company.vo.CompanyUserVO;
 import com.fs.company.vo.DocCompanyUserVO;
 import com.fs.his.vo.CitysAreaVO;
 import com.fs.his.vo.OptionsVO;
+import com.fs.qw.dto.UserProjectDTO;
 import com.fs.qw.vo.CompanyUserQwVO;
 import com.fs.qw.vo.QwOptionsVO;
 import com.fs.qw.vo.QwUserVO;
@@ -174,10 +175,10 @@ public interface ICompanyUserService {
 
     /**
      * 更改会员归属
-     * @param userIds
+     * @param users 需更换归属会员
      * @return
      */
-    int changeCompanyUser(List<Long> userIds, Long companyUserId, Long companyId);
+    int changeCompanyUser(List<UserProjectDTO> users, Long companyUserId, Long companyId);
 
     /**
      * 查询销售选项列表
@@ -210,4 +211,5 @@ public interface ICompanyUserService {
 
     List<QwOptionsVO> selectQwUserListLikeName(Map<String, Object> params);
 
+    String selectCompanyUserByStrIds(String companyUserIds);
 }

+ 4 - 1
fs-service/src/main/java/com/fs/company/service/impl/CompanyServiceImpl.java

@@ -510,7 +510,10 @@ public class CompanyServiceImpl implements ICompanyService
                 SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.store");
                 StoreConfig fsPayConfig = new Gson().fromJson(sysConfig.getConfigValue(), StoreConfig.class);
                 Integer DeductMoneyRate = fsPayConfig.getDeductMoneyRate();
-                BigDecimal money = order.getPrescribePrice().multiply(new BigDecimal(DeductMoneyRate).multiply(new BigDecimal("0.01")));
+                BigDecimal money = BigDecimal.ZERO;
+                if (DeductMoneyRate != null && DeductMoneyRate > 0) {
+                    money = order.getPrescribePrice().multiply(new BigDecimal(DeductMoneyRate).multiply(new BigDecimal("0.01")));
+                }
                 logger.info("扣除成本:"+order.getOrderCode()+":"+money);
                 company.setMoney(company.getMoney().subtract(money));
                 companyMapper.updateCompany(company);

+ 11 - 0
fs-service/src/main/java/com/fs/company/service/impl/CompanyTagServiceImpl.java

@@ -7,6 +7,7 @@ import com.fs.company.service.ICompanyTagService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
@@ -126,4 +127,14 @@ public class CompanyTagServiceImpl implements ICompanyTagService
     public String findUserTagByUserId(Long key,Long companyUserId) {
         return companyTagMapper.findUserTagByUserId(key,companyUserId);
     }
+
+    /**
+     * 查询标签列表
+     * @param params 条件
+     * @return list
+     */
+    @Override
+    public List<CompanyTag> selectCompanyTagByList(Map<String, Object> params) {
+        return companyTagMapper.selectCompanyTagByList(params);
+    }
 }

+ 23 - 0
fs-service/src/main/java/com/fs/company/service/impl/CompanyTagUserServiceImpl.java

@@ -1,5 +1,6 @@
 package com.fs.company.service.impl;
 
+import com.fs.common.core.domain.entity.SysDictData;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.StringUtils;
 import com.fs.company.domain.CompanyTagUser;
@@ -12,6 +13,7 @@ import com.fs.his.domain.FsUser;
 import com.fs.his.mapper.FsUserMapper;
 import com.fs.store.param.h5.TagListParam;
 import com.fs.store.vo.h5.CompanyUserTagListVO;
+import com.fs.system.mapper.SysDictDataMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -35,6 +37,8 @@ public class CompanyTagUserServiceImpl implements ICompanyTagUserService
     private CompanyUserMapper  companyUserMapper;
     @Autowired
     private FsUserMapper fsUserMapper;
+    @Autowired
+    private SysDictDataMapper dictDataMapper;
 
     /**
      * 查询company
@@ -187,4 +191,23 @@ public class CompanyTagUserServiceImpl implements ICompanyTagUserService
 
         return companyTagUserMapper.getTagByUser(param);
     }
+
+    /**
+     * 根据条件查询标签下用户
+     * @param params    条件
+     * @return  list
+     */
+    @Override
+    public List<CompanyTagUserVO> selectUserByMap(Map<String, Object> params) {
+        List<CompanyTagUserVO> companyTagUserVOS = companyTagUserMapper.selectUserByMap(params);
+
+        // 项目
+        List<SysDictData> courseProject = dictDataMapper.selectDictDataByType("sys_course_project");
+        companyTagUserVOS.forEach(vo -> courseProject.stream()
+                .filter(c -> c.getDictValue().equals(vo.getProjectId().toString()))
+                .findFirst()
+                .ifPresent(c -> vo.setUserName(vo.getUserName() + "-" + (c.getDictLabel()))));
+
+        return companyTagUserVOS;
+    }
 }

+ 14 - 9
fs-service/src/main/java/com/fs/company/service/impl/CompanyUserChangeApplyServiceImpl.java

@@ -8,8 +8,11 @@ import com.fs.company.mapper.CompanyUserChangeApplyMapper;
 import com.fs.company.service.ICompanyUserChangeApplyService;
 import com.fs.company.service.ICompanyUserChangeApplyUserService;
 import com.fs.company.vo.CompanyUserChangeApplyVO;
+import com.fs.course.domain.FsUserCompanyUser;
+import com.fs.course.service.IFsUserCompanyUserService;
 import com.fs.his.domain.FsUser;
 import com.fs.his.mapper.FsUserMapper;
+import com.fs.qw.dto.UserProjectDTO;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -25,7 +28,7 @@ import java.util.Objects;
 public class CompanyUserChangeApplyServiceImpl extends ServiceImpl<CompanyUserChangeApplyMapper, CompanyUserChangeApply> implements ICompanyUserChangeApplyService {
 
     private final ICompanyUserChangeApplyUserService companyUserChangeApplyUserService;
-    private final FsUserMapper userMapper;
+    private final IFsUserCompanyUserService userCompanyUserService;
 
     /**
      * 申请更换会员归属
@@ -39,30 +42,32 @@ public class CompanyUserChangeApplyServiceImpl extends ServiceImpl<CompanyUserCh
      */
     @Transactional(rollbackFor = Exception.class)
     @Override
-    public void apply(Long from, Long to, Integer type, List<Long> ids, Long companyId, String userName) {
+    public void apply(Long from, Long to, Integer type, List<UserProjectDTO> ids, Long companyId, String userName) {
         List<CompanyUserChangeApplyUser> users = new ArrayList<>();
 
         // 全部
         if (type == 0) {
-            FsUser param = new FsUser();
-            param.setCompanyUserId(from);
-            List<FsUser> userList = userMapper.selectFsUserList(param);
-            for (FsUser user : userList) {
+            FsUserCompanyUser params = new FsUserCompanyUser();
+            params.setCompanyUserId(from);
+            List<FsUserCompanyUser> userList = userCompanyUserService.selectFsUserCompanyUserList(params);
+            for (FsUserCompanyUser user : userList) {
                 CompanyUserChangeApplyUser uu = new CompanyUserChangeApplyUser();
                 uu.setUserId(user.getUserId());
+                uu.setProjectId(user.getProjectId());
                 users.add(uu);
             }
         }
         // 部分
         else {
-            for (Long id : ids) {
-                FsUser user = userMapper.selectFsUserById(id);
+            for (UserProjectDTO id : ids) {
+                FsUserCompanyUser user = userCompanyUserService.selectByUserIdAndProjectId(id.getUserId(), id.getProjectId());
                 if (Objects.isNull(user)) {
-                    throw new ServiceException("会员不存在");
+                    throw new ServiceException("会员关系不存在");
                 }
 
                 CompanyUserChangeApplyUser uu = new CompanyUserChangeApplyUser();
                 uu.setUserId(user.getUserId());
+                uu.setProjectId(user.getProjectId());
                 users.add(uu);
             }
         }

+ 26 - 1
fs-service/src/main/java/com/fs/company/service/impl/CompanyUserChangeApplyUserServiceImpl.java

@@ -5,13 +5,21 @@ import com.fs.company.domain.CompanyUserChangeApplyUser;
 import com.fs.company.mapper.CompanyUserChangeApplyUserMapper;
 import com.fs.company.service.ICompanyUserChangeApplyUserService;
 import com.fs.company.vo.CompanyUserChangeApplyUserVO;
+import com.fs.system.mapper.SysDictDataMapper;
+import com.fs.system.vo.DictVO;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 public class CompanyUserChangeApplyUserServiceImpl extends ServiceImpl<CompanyUserChangeApplyUserMapper, CompanyUserChangeApplyUser> implements ICompanyUserChangeApplyUserService {
 
+    @Autowired
+    private SysDictDataMapper sysDictDataMapper;
+
     /**
      * 查询申请记录关联用户
      * @param applyId   申请记录ID
@@ -19,7 +27,24 @@ public class CompanyUserChangeApplyUserServiceImpl extends ServiceImpl<CompanyUs
      */
     @Override
     public List<CompanyUserChangeApplyUserVO> getApplyUsers(Long applyId) {
-        return baseMapper.getApplyUsers(applyId);
+        List<CompanyUserChangeApplyUserVO> list = baseMapper.getApplyUsers(applyId);
+        List<DictVO> dictVOS = sysDictDataMapper.selectDictDataListByType("sys_course_project");
+
+        // Create a map for faster lookup (dictValue -> dictVO)
+        Map<String, String> projectMap = dictVOS.stream()
+                .collect(Collectors.toMap(DictVO::getDictValue, DictVO::getDictLabel));
+
+        // Iterate through the list and set projectName where projectId matches dictValue
+        for (CompanyUserChangeApplyUserVO vo : list) {
+            if (vo.getProjectId() != null) {
+                String projectName = projectMap.get(vo.getProjectId().toString());
+                if (projectName != null) {
+                    vo.setProjectName(projectName);
+                }
+            }
+        }
+
+        return list;
     }
 
     /**

+ 14 - 2
fs-service/src/main/java/com/fs/company/service/impl/CompanyUserServiceImpl.java

@@ -17,10 +17,12 @@ import com.fs.company.vo.CompanyQwUserByIdsVo;
 import com.fs.company.vo.CompanyUserQwListVO;
 import com.fs.company.vo.CompanyUserVO;
 import com.fs.company.vo.DocCompanyUserVO;
+import com.fs.course.service.IFsUserCompanyUserService;
 import com.fs.his.mapper.FsUserMapper;
 import com.fs.his.service.IFsCityService;
 import com.fs.his.vo.CitysAreaVO;
 import com.fs.his.vo.OptionsVO;
+import com.fs.qw.dto.UserProjectDTO;
 import com.fs.qw.mapper.QwUserMapper;
 import com.fs.qw.vo.CompanyUserQwVO;
 import com.fs.qw.vo.QwOptionsVO;
@@ -75,6 +77,8 @@ public class CompanyUserServiceImpl implements ICompanyUserService
 
     @Autowired
     private FsUserMapper fsUserMapper;
+    @Autowired
+    private IFsUserCompanyUserService userCompanyUserService;
 
     /**
      * 查询物业公司管理员信息
@@ -491,13 +495,16 @@ public class CompanyUserServiceImpl implements ICompanyUserService
     }
 
     @Override
-    public int changeCompanyUser(List<Long> userIds, Long companyUserId, Long companyId) {
+    public int changeCompanyUser(List<UserProjectDTO> users, Long companyUserId, Long companyId) {
 
         CompanyUser toUser = companyUserMapper.selectCompanyUserById(companyUserId);
         if (Objects.isNull(toUser)) {
             throw new ServiceException("需要更换归属的销售不存在");
         }
-        return fsUserMapper.batchUpdateUserCompanyUser(userIds, companyUserId, companyId);
+        for (UserProjectDTO u : users) {
+            userCompanyUserService.changeRelationship(u.getUserId(), u.getProjectId(), toUser.getCompanyId(), toUser.getUserId());
+        }
+        return 1;
     }
 
     /**
@@ -601,4 +608,9 @@ public class CompanyUserServiceImpl implements ICompanyUserService
     public List<QwOptionsVO> selectQwUserListLikeName(Map<String, Object> params) {
         return companyUserMapper.selectQwUserListLikeName(params);
     }
+
+    @Override
+    public String selectCompanyUserByStrIds(String companyUserIds) {
+        return companyUserMapper.selectCompanyUserNameByIds(companyUserIds);
+    }
 }

+ 4 - 0
fs-service/src/main/java/com/fs/company/vo/CompanyTagUserVO.java

@@ -12,4 +12,8 @@ public class CompanyTagUserVO {
      * 用户昵称
      */
     private String userName;
+    /**
+     * 项目ID
+     */
+    private Long projectId;
 }

+ 9 - 0
fs-service/src/main/java/com/fs/company/vo/CompanyUserChangeApplyUserVO.java

@@ -8,6 +8,15 @@ public class CompanyUserChangeApplyUserVO {
      * 用户ID
      */
     private Long userId;
+    /**
+     * 项目ID
+     */
+    private Long projectId;
+
+    /**
+     * 项目名称
+     */
+    private String projectName;
     /**
      * 用户名称
      */

+ 3 - 0
fs-service/src/main/java/com/fs/company/vo/CompanyUserQwListVO.java

@@ -121,4 +121,7 @@ public class CompanyUserQwListVO extends BaseEntity {
      * 发送延时时间
      */
     private Long sendDelayTime;
+
+    /** 是否需要单独注册会员,1-是,0-否*/
+    private Integer isNeedRegisterMember;
 }

+ 4 - 1
fs-service/src/main/java/com/fs/config/ai/AiHostProper.java

@@ -9,5 +9,8 @@ import org.springframework.stereotype.Component;
 public class AiHostProper {
     @Value("${ipad.ipadUrl}")
     private String ipadUrl;
-    
+
+    @Value("${ipad.aiApi}")
+    private String aiApi;
+
 }

+ 15 - 0
fs-service/src/main/java/com/fs/core/config/WxOpenProperties.java

@@ -0,0 +1,15 @@
+package com.fs.core.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+@Data
+@Configuration
+@ConfigurationProperties("wx.open")
+public class WxOpenProperties {
+
+    private String appId = "wx703c4bd07bbd1695";
+
+    private String secret = "034f5cc8d9b5151f9d25da9628541e35";
+}

+ 11 - 0
fs-service/src/main/java/com/fs/course/config/CourseConfig.java

@@ -40,6 +40,17 @@ public class CourseConfig implements Serializable {
     private Integer delayStart;
     private Integer delayEnd;
 
+    /**
+     * 小程序授权头像昵称方式(目前仅会员看课有效)
+     * 1:小程序原生授权 2:跳转H5服务号授权
+     */
+    private Integer miniAppAuthType;
+    /**
+     * 会员看课
+     * 小程序授权头像昵称,跳转H5服务号授权域名
+     */
+    private String userCourseAuthDomain;
+
 
     @Data
     public static class DisabledTimeVo{

+ 18 - 4
fs-service/src/main/java/com/fs/course/domain/FsUserCompanyUser.java

@@ -1,11 +1,13 @@
 package com.fs.course.domain;
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.fs.common.annotation.Excel;
-import com.fs.common.core.domain.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import lombok.EqualsAndHashCode;
+
+import java.time.LocalDateTime;
 
 /**
  * 微信用户和销售关系对象 fs_user_company_user
@@ -14,10 +16,10 @@ import lombok.EqualsAndHashCode;
  * @date 2025-05-09
  */
 @Data
-@EqualsAndHashCode(callSuper = true)
-public class FsUserCompanyUser extends BaseEntity{
+public class FsUserCompanyUser {
 
     /** id */
+    @TableId(type = IdType.AUTO)
     private Long id;
 
     /** 用户id(关联fs_user表user_id) */
@@ -56,6 +58,18 @@ public class FsUserCompanyUser extends BaseEntity{
      * 企微主体ID
      */
     private Long qwCompanyId;
+    /**
+     * 状态 0小黑屋 1正常 2拉黑
+     */
+    private Integer status;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
 
 
 }

+ 6 - 0
fs-service/src/main/java/com/fs/course/domain/FsUserCourseVideo.java

@@ -98,4 +98,10 @@ public class FsUserCourseVideo extends BaseEntity
     @JsonFormat(pattern = "HH:mm:ss")
     private LocalTime lastJoinTime;
 
+    private Long userId;
+
+    /**
+     * 项目ID
+     */
+    private Long projectId;
 }

+ 74 - 0
fs-service/src/main/java/com/fs/course/domain/FsVideoBarrage.java

@@ -0,0 +1,74 @@
+package com.fs.course.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 视频弹幕对象 fs_video_barrage
+ *
+ * @author fs
+ * @date 2025-04-07
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class FsVideoBarrage extends BaseEntity{
+    private String cmd;
+    /** 弹幕ID */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /** 视频ID */
+    @Excel(name = "视频ID")
+    private Long videoId;
+
+    /** 弹幕内容 */
+    @Excel(name = "弹幕内容")
+    private String content;
+
+    /** 弹幕对应视频时间点(毫秒) */
+    @Excel(name = "弹幕对应视频时间点", readConverterExp = "秒")
+    private Long timePoint;
+
+    /** 用户ID */
+    @Excel(name = "用户ID")
+    private Long userId;
+
+    /** 用户名 */
+    @Excel(name = "用户名")
+    private String username;
+
+    /** 发送平台(app / mini_app) */
+    @Excel(name = "发送平台", readConverterExp = "app,mini_app")
+    private String platform;
+
+    /** 状态:1-正常 0-隐藏 */
+    @Excel(name = "状态:1-正常 0-隐藏")
+    private String status;
+
+    /** 弹幕持续时间 */
+    @Excel(name = "弹幕持续时间")
+    private Long duration;
+
+    /** 是否优先显示1是0否,默认为0 */
+    @Excel(name = "是否优先显示1是0否,默认为0")
+    private String isPrior;
+
+    /** 是否彩色弹幕1是0否,默认为0 */
+    @Excel(name = "是否彩色弹幕1是0否,默认为0")
+    private String isColor;
+    // 例:'top',显示模式,top顶部居中,bottom底部居中,scroll滚动,默认为scroll
+    private String mode;
+    //颜色
+    private String color;
+    //字号
+    private String fontSize;
+
+
+
+}

+ 18 - 1
fs-service/src/main/java/com/fs/course/mapper/FsCourseSopAppLinkMapper.java

@@ -6,6 +6,7 @@ import com.fs.course.domain.FsCourseSopAppLink;
 import com.fs.course.vo.FsSopMyCourseLinkVO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 
 import java.util.List;
 
@@ -68,6 +69,7 @@ public interface FsCourseSopAppLinkMapper extends BaseMapper<FsCourseSopAppLink>
 
     @Select("SELECT\n" +
             "al.id," +
+            "al.link," +
             "\tal.create_time," +
             "\tal.update_time,\n" +
             "\tal.qw_user_name,\n" +
@@ -81,6 +83,21 @@ public interface FsCourseSopAppLinkMapper extends BaseMapper<FsCourseSopAppLink>
             "\tLEFT JOIN qw_external_contact ec ON al.qw_external_id = ec.id \n" +
             "WHERE\n" +
             "\tec.fs_user_id = #{userId} \n" +
-            "\tAND al.update_time >= NOW() ")
+            "\tAND al.update_time >= NOW() " +
+            "ORDER BY al.is_read asc,al.create_time desc ")
     List<FsSopMyCourseLinkVO> getSopCourseStudyList(@Param("userId") Long userId);
+
+    @Select("SELECT\n" +
+            "\tcount(1) as isNotRead\n" +
+            "FROM\n" +
+            "\tfs_course_sop_app_link al\n" +
+            "\tLEFT JOIN qw_external_contact ec ON al.qw_external_id = ec.id \n" +
+            "WHERE\n" +
+            "\tec.fs_user_id = #{userId} \n" +
+            "\tAND al.is_read = 0 \n" +
+            "\tAND al.update_time >= NOW() ")
+    Integer selectSopCountIsNotRead(@Param("userId") Long userId);
+
+    @Update("update fs_course_sop_app_link set is_read = 1 where link = #{id}")
+    int updateFsCourseSopAppLinkByLink(@Param("id") String id);
 }

+ 1 - 1
fs-service/src/main/java/com/fs/course/mapper/FsCourseWatchLogMapper.java

@@ -398,7 +398,7 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
 
     void batchUpdateFsUserWatchLog(@Param("list") List<FsCourseWatchLog> list);
 
-    @Select("select * from fs_course_watch_log where user_id = #{userId} and video_id = #{videoId} and send_type = 1")
+    @Select("select * from fs_course_watch_log where user_id = #{userId} and video_id = #{videoId} and send_type = 1 order by log_id desc limit 1")
     FsCourseWatchLog getCourseWatchLogByUser(@Param("userId") Long userId, @Param("videoId") Long videoId);
 
     /**

+ 14 - 0
fs-service/src/main/java/com/fs/course/mapper/FsUserCompanyUserMapper.java

@@ -3,10 +3,12 @@ package com.fs.course.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.course.domain.FsUserCompanyUser;
 import com.fs.qw.dto.FsUserTransferParamDTO;
+import com.fs.qw.dto.UserProjectDTO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 微信用户和销售关系Mapper接口
@@ -79,4 +81,16 @@ public interface FsUserCompanyUserMapper extends BaseMapper<FsUserCompanyUser>{
     List<FsUserCompanyUser> selectRepeatCompanyUserName(@Param("userIds") List<Long> userIds);
 
     void transfer(@Param("param") FsUserTransferParamDTO transferParam);
+
+    /**
+     * 批量修改用户-项目状态
+     * @param ids       参数
+     * @param status    状态
+     * @return  count
+     */
+    int changeUserProjectStatus(@Param("ids") List<UserProjectDTO> ids, @Param("status") int status);
+
+    int batchUpdateStatus(@Param("ids") List<Long> ids, @Param("status") int status);
+
+    List<Long> selectFsUserCompanyUserListByMap(@Param("param") Map<String, Object> param);
 }

+ 14 - 6
fs-service/src/main/java/com/fs/course/mapper/FsUserCourseCommentMapper.java

@@ -8,6 +8,7 @@ import com.fs.course.vo.FsUserCourseCommentListUVO;
 import com.fs.course.vo.FsUserCourseCommentListVO;
 import com.fs.course.vo.FsUserCourseCommentReplyListUVO;
 import com.fs.course.vo.FsUserCourseCommentVO;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 
@@ -118,13 +119,20 @@ public interface FsUserCourseCommentMapper
     List<FsUserCourseCommentListUVO> selectFsUserCourseCommentListVOByCourseId(Long courseId);
 
     @Select({"<script> " +
-            "select c.*,u.nick_name,u.avatar,tu.nick_name to_nick_name  from fs_user_course_comment c " +
-            " LEFT JOIN fs_user u ON c.user_id=u.user_id " +
-            " LEFT  JOIN fs_user tu ON tu.user_id =c.to_user_id " +
-            " where c.is_del = 0 and c.type = 2 and c.parent_id = #{commentId} " +
-            " order by c.comment_id desc "+
+            "SELECT c.*, u.nick_name, u.avatar, tu.nick_name to_nick_name, " +
+            "<if test='userId != null and userId != \"\"'>" +
+            "   IFNULL(l.id, 0) AS is_like " +
+            "</if>" +
+            "FROM fs_user_course_comment c " +
+            "LEFT JOIN fs_user u ON c.user_id = u.user_id " +
+            "LEFT JOIN fs_user tu ON tu.user_id = c.to_user_id " +
+            "<if test='userId != null and userId != \"\"'>" +
+            "   LEFT JOIN fs_user_course_comment_like l ON c.comment_id = l.comment_id AND #{userId} = l.user_id " +
+            "</if>" +
+            "WHERE c.is_del = 0 AND c.type = 2 AND c.parent_id = #{commentId} " +
+            "ORDER BY c.comment_id DESC" +
             "</script>"})
-    List<FsUserCourseCommentReplyListUVO> selectFsUserCourseCommentReplyListUVO(Long commentId);
+    List<FsUserCourseCommentReplyListUVO> selectFsUserCourseCommentReplyListUVO(@Param("commentId") Long commentId, @Param("userId") String userId);
 
     @Select({"<script> " +
             "select c.*,u.nick_name,u.avatar,tu.nick_name to_nick_name from fs_user_course_comment c " +

+ 6 - 1
fs-service/src/main/java/com/fs/course/mapper/FsUserCourseMapper.java

@@ -246,7 +246,7 @@ public interface FsUserCourseMapper
             "        LEFT JOIN fs_user_course_period_days fcpd ON fcpd.period_id = fcp.period_id\n" +
             "        LEFT JOIN fs_user_course c ON c.course_id = fcpd.course_id\n" +
             "        WHERE\n" +
-            "        c.is_del = 0\n" +
+            "        c.is_del = 0 and fcp.del_flag = '0'\n" +
             "        AND FIND_IN_SET(#{companyId}, fcp.company_id)\n" +
             "        <if test=\"keyword != null and keyword !='' \">\n" +
             "            AND fcp.period_name LIKE concat('%',#{keyword},'%'\n" +
@@ -271,4 +271,9 @@ public interface FsUserCourseMapper
     List<FsCourseListBySidebarVO> getFsCourseListBySidebar(@Param("data") FsCourseListBySidebarParam param);
 
     List<FsUserCourseParticipationRecordVO> getParticipationRecordByMap(@Param("params") Map<String, Object> params);
+
+    /**
+     * 查询当天用户-项目看课记录条数
+     */
+    Integer selectTodayCourseWatchLogCountByUserIdAndProjectId(@Param("userId") Long userId, @Param("projectId") Long projectId);
 }

+ 19 - 1
fs-service/src/main/java/com/fs/course/mapper/FsUserCourseVideoMapper.java

@@ -14,6 +14,7 @@ import com.fs.course.vo.newfs.FsUserCourseVideoPageListVO;
 import com.fs.his.vo.OptionsVO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -140,7 +141,8 @@ public interface FsUserCourseVideoMapper
     List<OptionsVO> selectFsUserCourseVodeAllList(Long id);
 
     @Select({"<script> " +
-            "select v.*,p.red_packet_money company_red_packet_money from fs_user_course_video v LEFT JOIN fs_user_course_video_red_package p on p.video_id= v.video_id and p.company_id =#{maps.companyId} " +
+            "select v.*,p.red_packet_money company_red_packet_money from fs_user_course_video v " +
+            "LEFT JOIN fs_user_course_video_red_package p on p.video_id= v.video_id and p.company_id =#{maps.companyId} and p.data_type = 1 " +
             "where v.is_del = 0 and  v.course_id = #{maps.courseId}   " +
             "<if test = ' maps.title!=null and maps.title != \"\" '> " +
             "and v.title = #{maps.title} " +
@@ -198,4 +200,20 @@ public interface FsUserCourseVideoMapper
     List<FsCourseVideoListBySidebarVO> getFsCourseVideoListBySidebar(@Param("data") FsCourseListBySidebarParam param);
 
     List<FsUserCourseVideoPageListVO> selectFsUserCourseVideoListByMap(@Param("params") Map<String, Object> params);
+
+    FsUserCourseVideo selectByFileKey(@Param("params")String fileKey);
+
+    @Select("select * from fs_user_course_video where file_key = #{fileKey} ")
+    List<FsUserCourseVideo> selectVideoByFileKey(@Param("fileKey") String fileKey);
+
+    @Update("UPDATE fs_user_course_video " +
+            "SET line_one = #{lineOne}, " +
+            "    transcode_file_key = #{transcodeFileKey}, " +
+            "    is_transcode = 1, " +
+            "    update_time = NOW() " +  // 添加更新时间
+            "WHERE file_key = #{fileKey}")
+    void updateFsUserCourseVideoByFileKey(FsUserCourseVideo courseVideo);
+
+    @Select("select title from fs_user_course_video WHERE video_id=#{videoId}")
+    String selectFsUserCourseVideoByVideoForTitle(@Param("videoId") Long videoId);
 }

+ 4 - 0
fs-service/src/main/java/com/fs/course/mapper/FsUserCourseVideoRedPackageMapper.java

@@ -9,6 +9,8 @@ import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 
+import javax.validation.constraints.NotNull;
+
 /**
  * 课程公司红包Mapper接口
  *
@@ -98,4 +100,6 @@ public interface FsUserCourseVideoRedPackageMapper
             "</foreach>" +
             "</script>")
     int updateBatchDelFlag(@Param("ids") Long [] ids, @Param("delFlag") Integer delFlag);
+
+    Integer selectRedPacketByCompanyCount(@Param("videoId") Long videoId,@Param("companyId") Long companyId, @Param("periodId") Long periodId);
 }

+ 1 - 1
fs-service/src/main/java/com/fs/course/mapper/FsUserTalentMapper.java

@@ -60,7 +60,7 @@ public interface FsUserTalentMapper
      */
     public int deleteFsUserTalentByTalentIds(Long[] talentIds);
 
-    @Update("update fs_user_talent set fans=fans+1 where talent_id=#{talentId}")
+    @Update("update fs_user_talent set fans=ifnull(fans,0)+1 where talent_id=#{talentId}")
     int addFans(Long talentId);
 
 

+ 85 - 0
fs-service/src/main/java/com/fs/course/mapper/FsVideoBarrageMapper.java

@@ -0,0 +1,85 @@
+package com.fs.course.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.common.annotation.DataSource;
+import com.fs.common.enums.DataSourceType;
+import com.fs.course.domain.FsVideoBarrage;
+import com.fs.course.param.FsVideoBarrageQueryParam;
+import com.fs.course.vo.FsVideoBarrageVO;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 视频弹幕Mapper接口
+ *
+ * @author fs
+ * @date 2025-04-07
+ */
+@Repository
+public interface FsVideoBarrageMapper extends BaseMapper<FsVideoBarrage>{
+    /**
+     * 查询视频弹幕
+     *
+     * @param id 视频弹幕主键
+     * @return 视频弹幕
+     */
+    FsVideoBarrage selectFsVideoBarrageById(String id);
+
+    /**
+     * 查询视频弹幕列表
+     *
+     * @param fsVideoBarrage 视频弹幕
+     * @return 视频弹幕集合
+     */
+    @DataSource(DataSourceType.SLAVE)
+    List<FsVideoBarrageVO> selectFsVideoBarrageList(FsVideoBarrageQueryParam fsVideoBarrage);
+
+    /**
+     * 新增视频弹幕
+     *
+     * @param fsVideoBarrage 视频弹幕
+     * @return 结果
+     */
+    int insertFsVideoBarrage(FsVideoBarrage fsVideoBarrage);
+
+    /**
+     * 修改视频弹幕
+     *
+     * @param fsVideoBarrage 视频弹幕
+     * @return 结果
+     */
+    int updateFsVideoBarrage(FsVideoBarrage fsVideoBarrage);
+
+    /**
+     * 删除视频弹幕
+     *
+     * @param id 视频弹幕主键
+     * @return 结果
+     */
+    int deleteFsVideoBarrageById(String id);
+
+    /**
+     * 批量删除视频弹幕
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteFsVideoBarrageByIds(String[] ids);
+
+
+    int insertBarrage(FsVideoBarrage barrage);
+
+
+    List<FsVideoBarrage> selectByVideoId(@Param("videoId") Long videoId);
+
+
+    List<FsVideoBarrage> selectBySegment(@Param("videoId") Long videoId, @Param("start") int start, @Param("end") int end);
+
+    int updateStatus(@Param("id") Long id, @Param("status") String status);
+
+    int batchUpdateStatus(@Param("ids") ArrayList ids, @Param("status")String status);
+
+}

+ 3 - 0
fs-service/src/main/java/com/fs/course/mapper/FsVideoResourceMapper.java

@@ -24,4 +24,7 @@ public interface FsVideoResourceMapper extends BaseMapper<FsVideoResource> {
 
     @Select("select * from fs_video_resource where is_transcode = 1 and is_del = 0 and transcode_file_key is null")
     List<FsVideoResource> selectVideoIsTranscode();
+
+    @Select("select * from fs_video_resource where file_key = #{fileKey} limit 1")
+    FsVideoResource selectByFileKey(String fileKey);
 }

+ 3 - 0
fs-service/src/main/java/com/fs/course/param/BatchVideoSvae.java

@@ -8,4 +8,7 @@ import java.util.List;
 public class BatchVideoSvae {
     private Long courseId;
     private List<Long> ids;
+
+    // 项目ID
+    private Long projectId;
 }

Some files were not shown because too many files changed in this diff