Переглянути джерело

Merge remote-tracking branch 'origin/master'

zyp 3 тижнів тому
батько
коміт
c3b0ae3609
90 змінених файлів з 2662 додано та 437 видалено
  1. 4 0
      fs-admin/pom.xml
  2. 2 1
      fs-admin/src/main/java/com/fs/FSAdminApplication.java
  3. 65 0
      fs-admin/src/main/java/com/fs/task/FsCourseTask.java
  4. 31 35
      fs-admin/src/main/java/com/fs/task/StoreTask.java
  5. 20 0
      fs-admin/src/test/java/com/fs/task/StoreTaskTest.java
  6. 16 2
      fs-company-app/src/main/java/com/fs/app/controller/QwCompanyUserController.java
  7. 5 5
      fs-company/src/main/java/com/fs/course/controller/FsCourseAnswerLogsController.java
  8. 7 7
      fs-company/src/main/java/com/fs/course/controller/FsCourseWatchLogController.java
  9. 121 0
      fs-company/src/main/java/com/fs/qw/QwWorkTaskController.java
  10. 2 1
      fs-company/src/main/java/com/fs/qw/vo/QwFriendWelcomeVO.java
  11. 17 22
      fs-company/src/main/java/com/fs/qw/vo/QwWatchLogStatisticsListVO.java
  12. 24 3
      fs-company/src/main/java/com/fs/qw/vo/QwWorkTaskListVO.java
  13. 3 0
      fs-company/src/main/java/com/fs/store/controller/FsStoreProductController.java
  14. 12 3
      fs-company/src/main/java/com/fs/users/controller/FsUserController.java
  15. 3 4
      fs-company/src/main/resources/application-dev.yml
  16. 1 1
      fs-service-system/src/main/java/com/fs/company/cache/impl/CompanyUserCacheServiceImpl.java
  17. 13 0
      fs-service-system/src/main/java/com/fs/company/domain/CompanyUser.java
  18. 0 45
      fs-service-system/src/main/java/com/fs/company/mapper/CompanyTcmReportMapper.java
  19. 56 49
      fs-service-system/src/main/java/com/fs/company/mapper/CompanyUserMapper.java
  20. 2 0
      fs-service-system/src/main/java/com/fs/company/service/ICompanyUserService.java
  21. 5 0
      fs-service-system/src/main/java/com/fs/company/service/impl/CompanyUserServiceImpl.java
  22. 2 0
      fs-service-system/src/main/java/com/fs/course/mapper/FsCourseAnswerLogsMapper.java
  23. 37 0
      fs-service-system/src/main/java/com/fs/course/mapper/FsCourseWatchLogMapper.java
  24. 37 5
      fs-service-system/src/main/java/com/fs/course/param/FsCourseAnswerLogsParam.java
  25. 2 0
      fs-service-system/src/main/java/com/fs/course/param/FsCourseOverParam.java
  26. 4 0
      fs-service-system/src/main/java/com/fs/course/param/FsCourseWatchLogStatisticsListParam.java
  27. 1 0
      fs-service-system/src/main/java/com/fs/course/service/IFsCourseAnswerLogsService.java
  28. 4 1
      fs-service-system/src/main/java/com/fs/course/service/IFsCourseWatchLogService.java
  29. 7 0
      fs-service-system/src/main/java/com/fs/course/service/cache/IFsUserCourseVideoCacheService.java
  30. 31 0
      fs-service-system/src/main/java/com/fs/course/service/cache/impl/FsUserCourseVideoCacheServiceImpl.java
  31. 79 2
      fs-service-system/src/main/java/com/fs/course/service/impl/FsCourseAnswerLogsServiceImpl.java
  32. 235 55
      fs-service-system/src/main/java/com/fs/course/service/impl/FsCourseWatchLogServiceImpl.java
  33. 17 4
      fs-service-system/src/main/java/com/fs/course/vo/FsCourseAnswerLogsListVO.java
  34. 6 4
      fs-service-system/src/main/java/com/fs/course/vo/FsCourseOverVO.java
  35. 13 1
      fs-service-system/src/main/java/com/fs/course/vo/FsCourseWatchLogListVO.java
  36. 16 2
      fs-service-system/src/main/java/com/fs/course/vo/FsCourseWatchLogStatisticsListVO.java
  37. 95 0
      fs-service-system/src/main/java/com/fs/qw/domain/QwExternalContactBlackLog.java
  38. 7 0
      fs-service-system/src/main/java/com/fs/qw/domain/QwFriendWelcome.java
  39. 6 0
      fs-service-system/src/main/java/com/fs/qw/domain/QwWatchLog.java
  40. 76 0
      fs-service-system/src/main/java/com/fs/qw/mapper/QwExternalContactBlackLogMapper.java
  41. 2 0
      fs-service-system/src/main/java/com/fs/qw/mapper/QwExternalContactMapper.java
  42. 1 0
      fs-service-system/src/main/java/com/fs/qw/mapper/QwFriendWelcomeMapper.java
  43. 1 1
      fs-service-system/src/main/java/com/fs/qw/mapper/QwTagMapper.java
  44. 20 0
      fs-service-system/src/main/java/com/fs/qw/mapper/QwWatchLogMapper.java
  45. 18 0
      fs-service-system/src/main/java/com/fs/qw/mapper/QwWorkTaskMapper.java
  46. 5 0
      fs-service-system/src/main/java/com/fs/qw/param/QwFriendWelcomeParam.java
  47. 3 0
      fs-service-system/src/main/java/com/fs/qw/param/QwWatchLogStatisticsListParam.java
  48. 3 0
      fs-service-system/src/main/java/com/fs/qw/param/newparam/ContactTagListParam.java
  49. 61 0
      fs-service-system/src/main/java/com/fs/qw/service/IQwExternalContactBlackLogService.java
  50. 1 1
      fs-service-system/src/main/java/com/fs/qw/service/IQwExternalContactService.java
  51. 2 0
      fs-service-system/src/main/java/com/fs/qw/service/IQwWatchLogService.java
  52. 25 3
      fs-service-system/src/main/java/com/fs/qw/service/IQwWorkTaskService.java
  53. 95 0
      fs-service-system/src/main/java/com/fs/qw/service/impl/QwExternalContactBlackLogServiceImpl.java
  54. 25 2
      fs-service-system/src/main/java/com/fs/qw/service/impl/QwExternalContactServiceImpl.java
  55. 16 1
      fs-service-system/src/main/java/com/fs/qw/service/impl/QwFriendWelcomeServiceImpl.java
  56. 8 1
      fs-service-system/src/main/java/com/fs/qw/service/impl/QwTagServiceImpl.java
  57. 95 12
      fs-service-system/src/main/java/com/fs/qw/service/impl/QwWatchLogServiceImpl.java
  58. 65 5
      fs-service-system/src/main/java/com/fs/qw/service/impl/QwWorkTaskServiceImpl.java
  59. 9 2
      fs-service-system/src/main/java/com/fs/qw/vo/QwFriendWelcomeVO.java
  60. 16 0
      fs-service-system/src/main/java/com/fs/qw/vo/QwWatchLogAllStatisticsListVO.java
  61. 35 22
      fs-service-system/src/main/java/com/fs/qw/vo/QwWatchLogStatisticsListVO.java
  62. 9 3
      fs-service-system/src/main/java/com/fs/qw/vo/QwWorkTaskListVO.java
  63. 3 0
      fs-service-system/src/main/java/com/fs/store/domain/FsStoreProduct.java
  64. 6 0
      fs-service-system/src/main/java/com/fs/store/mapper/FsStoreProductMapper.java
  65. 3 0
      fs-service-system/src/main/java/com/fs/store/mapper/FsUserMapper.java
  66. 2 2
      fs-service-system/src/main/java/com/fs/store/param/FsStoreProductAddEditParam.java
  67. 4 0
      fs-service-system/src/main/java/com/fs/store/param/FsStoreProductQueryParam.java
  68. 0 1
      fs-service-system/src/main/java/com/fs/store/service/IFsStoreProductService.java
  69. 2 0
      fs-service-system/src/main/java/com/fs/store/service/IFsUserService.java
  70. 13 0
      fs-service-system/src/main/java/com/fs/store/service/cache/IFsUserCacheService.java
  71. 13 0
      fs-service-system/src/main/java/com/fs/store/service/cache/IFsUserCourseCacheService.java
  72. 28 0
      fs-service-system/src/main/java/com/fs/store/service/cache/impl/FsUserCourseCacheServiceImpl.java
  73. 30 0
      fs-service-system/src/main/java/com/fs/store/service/cache/impl/IFsUserCacheServiceImpl.java
  74. 2 0
      fs-service-system/src/main/java/com/fs/store/service/impl/FsStoreProductServiceImpl.java
  75. 5 0
      fs-service-system/src/main/java/com/fs/store/service/impl/FsUserServiceImpl.java
  76. 2 0
      fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductQueryVO.java
  77. 230 115
      fs-service-system/src/main/resources/mapper/company/CompanyTcmReportMapper.xml
  78. 5 1
      fs-service-system/src/main/resources/mapper/company/CompanyUserMapper.xml
  79. 24 0
      fs-service-system/src/main/resources/mapper/course/FsCourseAnswerLogsMapper.xml
  80. 114 1
      fs-service-system/src/main/resources/mapper/course/FsCourseWatchLogMapper.xml
  81. 105 0
      fs-service-system/src/main/resources/mapper/qw/QwExternalContactBlackLogMapper.xml
  82. 25 3
      fs-service-system/src/main/resources/mapper/qw/QwExternalContactMapper.xml
  83. 5 1
      fs-service-system/src/main/resources/mapper/qw/QwFriendWelcomeMapper.xml
  84. 7 1
      fs-service-system/src/main/resources/mapper/qw/QwTagMapper.xml
  85. 216 0
      fs-service-system/src/main/resources/mapper/qw/QwWatchLogMapper.xml
  86. 154 0
      fs-service-system/src/main/resources/mapper/qw/QwWorkTaskMapper.xml
  87. 5 1
      fs-service-system/src/main/resources/mapper/store/FsStoreProductMapper.xml
  88. 41 0
      fs-service-system/src/main/resources/mapper/store/FsUserMapper.xml
  89. 9 0
      fs-service-system/src/test/java/com/fs/course/service/impl/FsCourseWatchLogServiceImplTest.java
  90. 10 6
      fs-user-app/src/main/java/com/fs/app/controller/CompanyOrderController.java

+ 4 - 0
fs-admin/pom.xml

@@ -139,6 +139,10 @@
             <scope>provided</scope>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+        </dependency>
 
 
     </dependencies>

+ 2 - 1
fs-admin/src/main/java/com/fs/FSAdminApplication.java

@@ -1,5 +1,6 @@
 package com.fs;
 
+import com.fs.core.security.SecurityUtils;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@@ -28,6 +29,6 @@ public class FSAdminApplication
     {
         // System.setProperty("spring.devtools.restart.enabled", "false");
         SpringApplication.run(FSAdminApplication.class, args);
-        System.out.println("Admin启动成功 \n" );
+        System.out.println("Admin启动成功 \n" + SecurityUtils.encryptPassword("123456"));
     }
 }

+ 65 - 0
fs-admin/src/main/java/com/fs/task/FsCourseTask.java

@@ -0,0 +1,65 @@
+package com.fs.task;
+
+import com.fs.course.service.IFsCourseWatchLogService;
+import com.fs.qw.service.IQwWorkTaskService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 后台统计相关 定时任务
+ */
+@Slf4j
+@Service("fsCourseTask")
+public class FsCourseTask {
+    @Autowired
+    private IFsCourseWatchLogService fsCourseWatchLogService;
+    @Autowired
+    private IQwWorkTaskService qwWorkTaskService;
+
+    /**
+     * 添加企微观看日志
+     * @throws Exception
+     */
+    public void addQwWatchLog() throws Exception
+    {
+        fsCourseWatchLogService.addCourseWatchLogDayNew();
+    }
+
+
+    /**
+     * 看课面板定时任务-1
+     * @throws Exception
+     */
+    public void qwWorkTask1() throws Exception
+    {
+        qwWorkTaskService.addQwWorkByCourse4();
+        qwWorkTaskService.addQwWorkByCourseLastTime();
+    }
+    /**
+     * 看课面板定时任务-2
+     * @throws Exception
+     */
+    public void qwWorkTask2() throws Exception
+    {
+        qwWorkTaskService.addQwWorkByCourse();
+        qwWorkTaskService.addQwWorkByFirstCourse();
+    }
+    /**
+     * 看课面板定时任务-3
+     * @throws Exception
+     */
+    public void qwWorkTask3() throws Exception
+    {
+        qwWorkTaskService.addQwWorkByConversionDay();
+    }
+    /**
+     * 看课面板定时任务-4
+     * @throws Exception
+     */
+    public void qwWorkTask4() throws Exception
+    {
+        qwWorkTaskService.delQwWorkTaskByOver();
+    }
+
+}

+ 31 - 35
fs-admin/src/main/java/com/fs/task/StoreTask.java

@@ -3,12 +3,9 @@ package com.fs.task;
 
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
-import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
-import com.fs.company.domain.CompanyUser;
 import com.fs.company.service.ICompanyService;
-import com.fs.core.security.SecurityUtils;
-import com.fs.crm.mapper.CrmCustomerMapper;
+import com.fs.course.service.IFsCourseWatchLogService;
 import com.fs.erp.domain.ErpDeliverys;
 import com.fs.erp.domain.ErpGoods;
 import com.fs.erp.domain.ErpOrderQuery;
@@ -21,11 +18,10 @@ import com.fs.erp.service.IErpOrderService;
 import com.fs.pay.pay.domain.OrderResult;
 import com.fs.pay.pay.dto.OrderQueryDTO;
 import com.fs.pay.pay.service.PayService;
-import com.fs.pay.pay.service.impl.PayApiServiceImpl;
+import com.fs.qw.service.IQwWorkTaskService;
 import com.fs.store.config.StoreConfig;
 import com.fs.store.domain.*;
 import com.fs.store.dto.ExpressInfoDTO;
-import com.fs.store.dto.FsStoreCartDTO;
 import com.fs.store.enums.ShipperCodeEnum;
 import com.fs.store.mapper.FsStoreOrderItemMapper;
 import com.fs.store.mapper.FsStoreOrderMapper;
@@ -33,13 +29,8 @@ import com.fs.store.mapper.FsStorePaymentMapper;
 import com.fs.store.mapper.FsStoreProductAttrValueMapper;
 import com.fs.store.param.*;
 import com.fs.store.service.*;
-import com.fs.store.vo.FsStoreOrderItemVO;
-import com.fs.store.vo.FsStoreOrderTuiVO;
-import com.fs.store.vo.FsStoreOrderVO;
 import com.fs.system.service.ISysConfigService;
-import com.sun.media.sound.SF2GlobalRegion;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Component;
@@ -65,19 +56,19 @@ public class StoreTask
     @Autowired
     private RedisCache redisCache;
     @Autowired
-    IFsStoreOrderService orderService;
+    private IFsStoreOrderService orderService;
     @Autowired
     private IFsStoreCouponUserService couponUserService;
     @Autowired
-    IFsStoreAfterSalesService afterSalesService;
+    private IFsStoreAfterSalesService afterSalesService;
     @Autowired
-    IFsUserService userService;
+    private IFsUserService userService;
 
     @Autowired
-    IErpOrderService erpOrderService;
+    private IErpOrderService erpOrderService;
 
     @Autowired
-    PayService ybPayService;
+    private PayService ybPayService;
     @Autowired
     private FsStoreOrderMapper fsStoreOrderMapper;
 
@@ -90,8 +81,29 @@ public class StoreTask
     @Autowired
     private FsStorePaymentMapper fsStorePaymentMapper;
 
+
+    @Autowired
+    private IErpGoodsService erpGoodsService;
+    @Autowired
+    private ISysConfigService configService;
+    @Autowired
+    private FsStoreProductAttrValueMapper fsStoreProductAttrValueMapper;
+    @Autowired
+    private FsStorePaymentMapper paymentMapper;
+    @Autowired
+    private IFsStorePaymentService fsStorePaymentService;
+    @Autowired
+    private ICompanyService companyService;
+
+
+    @Autowired
+    private IFsExpressService expressService;
+
+    @Autowired
+    private FsStoreOrderItemMapper itemMapper;
+
     @Autowired
-    private CrmCustomerMapper crmCustomerMapper;
+    private IFsStoreAfterSalesService fsStoreAfterSalesService;
 
     //每5分钟执行一次
     public void deliveryOp()
@@ -122,12 +134,6 @@ public class StoreTask
     }
 
 
-    @Autowired
-    IErpGoodsService erpGoodsService;
-    @Autowired
-    ISysConfigService configService;
-    @Autowired
-    private FsStoreProductAttrValueMapper fsStoreProductAttrValueMapper;
     public void storeProdUpdateCostPrice()
     {
         String json=configService.selectConfigByKey("store.config");
@@ -239,8 +245,6 @@ public class StoreTask
         }
 
     }
-    @Autowired
-    private IFsExpressService expressService;
 
     public void changeStatus(){
         List<Long> list  = fsStoreOrderMapper.selectOrderId();
@@ -262,12 +266,7 @@ public class StoreTask
         }
     }
 
-    @Autowired
-    private FsStorePaymentMapper paymentMapper;
-    @Autowired
-    private IFsStorePaymentService fsStorePaymentService;
-    @Autowired
-    private ICompanyService companyService;
+
 
     public void subCompanyMoney(){
         List<Long> list = paymentMapper.selectPaymentIds();
@@ -279,8 +278,6 @@ public class StoreTask
         }
     }
 
-    @Autowired
-    private FsStoreOrderItemMapper itemMapper;
 
     public void updateOrderItem() throws ParseException {
         List <Long> ids = itemMapper.selectOrderIdByNoErp();
@@ -340,8 +337,6 @@ public class StoreTask
 
     }
 
-    @Autowired
-    private IFsStoreAfterSalesService fsStoreAfterSalesService;
 
     public void selectPayMoneyLessOne(){
         List<FsStoreOrder> list = fsStoreOrderMapper.selectPayMoneyLessOne();
@@ -370,4 +365,5 @@ public class StoreTask
 
 
 
+
 }

+ 20 - 0
fs-admin/src/test/java/com/fs/task/StoreTaskTest.java

@@ -0,0 +1,20 @@
+package com.fs.task;
+
+
+import com.fs.FSAdminApplication;
+import com.fs.course.service.IFsCourseWatchLogService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@RunWith(value = org.springframework.test.context.junit4.SpringRunner.class)
+@SpringBootTest(classes = FSAdminApplication.class)
+public class StoreTaskTest {
+    @Autowired
+    private IFsCourseWatchLogService fsCourseWatchLogService;
+    @Test
+    public void addQwWatchLog() {
+        fsCourseWatchLogService.addCourseWatchLogDayNew();
+    }
+}

+ 16 - 2
fs-company-app/src/main/java/com/fs/app/controller/QwCompanyUserController.java

@@ -1,6 +1,7 @@
 package com.fs.app.controller;
 
 
+import com.fs.app.annotation.Login;
 import com.fs.common.core.domain.ResponseResult;
 import com.fs.qw.param.newparam.ContactTagListParam;
 import com.fs.qw.param.newparam.ExternalContactPageListParam;
@@ -32,6 +33,7 @@ public class QwCompanyUserController extends AppBaseController {
     @Autowired
     private IQwTagService tagService;
 
+    @Login
     @GetMapping("/pageList")
     @ApiOperation("会员分页列表")
     public ResponseResult<PageInfo<ExternalContactListVO>> pageList(ExternalContactPageListParam param) {
@@ -42,6 +44,7 @@ public class QwCompanyUserController extends AppBaseController {
         return ResponseResult.ok(pageInfo);
     }
 
+    @Login
     @GetMapping("/totalNumber")
     @ApiOperation("会员数量统计")
     public ResponseResult<ExternalContactPageVO> getTotalNumber() {
@@ -49,6 +52,7 @@ public class QwCompanyUserController extends AppBaseController {
         return ResponseResult.ok(contactNumber);
     }
 
+    @Login
     @GetMapping("/details")
     @ApiOperation("会员详情")
     public ResponseResult<ExternalContactDetailsVO> getUserDetails(@ApiParam(value = "外部联系人id", required = true) @RequestParam Long contactId,
@@ -56,6 +60,7 @@ public class QwCompanyUserController extends AppBaseController {
         return ResponseResult.ok(qwExternalContactService.getUserDetails(Long.parseLong(getUserId()), contactId, dateTag));
     }
 
+    @Login
     @GetMapping("/tagList")
     @ApiOperation("会员标签列表")
     public ResponseResult<PageInfo<QwTagVO>> getTagList(ContactTagListParam param) {
@@ -66,10 +71,19 @@ public class QwCompanyUserController extends AppBaseController {
         return ResponseResult.ok(pageInfo);
     }
 
-    @PutMapping("/disabled")
+    @Login
+    @PostMapping("/disabled")
     @ApiOperation("批量禁用会员")
     public ResponseResult<Boolean> disabledUser(@ApiParam(value = "联系人id集合", required = true) @RequestBody String[] ids) {
-        Boolean r = qwExternalContactService.disabledUser(ids);
+        Boolean r = qwExternalContactService.disabledUser(ids, false);
+        return ResponseResult.ok(r);
+    }
+
+    @Login
+    @PostMapping("/enabled")
+    @ApiOperation("批量启用会员")
+    public ResponseResult<Boolean> enabledUser(@ApiParam(value = "联系人id集合", required = true) @RequestBody String[] ids) {
+        Boolean r = qwExternalContactService.disabledUser(ids, true);
         return ResponseResult.ok(r);
     }
 

+ 5 - 5
fs-company/src/main/java/com/fs/course/controller/FsCourseAnswerLogsController.java

@@ -48,7 +48,7 @@ public class FsCourseAnswerLogsController extends BaseController
         if (param.getPhoneMk() != null && param.getPhoneMk() != "") {
             param.setPhone(param.getPhoneMk());
         }
-        List<FsCourseAnswerLogsListVO> list = fsCourseAnswerLogsService.selectFsCourseAnswerLogsListVO(param);
+        List<FsCourseAnswerLogsListVO> list = fsCourseAnswerLogsService.selectFsCourseAnswerLogsListVONew(param);
         return getDataTable(list);
     }
 
@@ -63,12 +63,12 @@ public class FsCourseAnswerLogsController extends BaseController
 
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         param.setCompanyId( loginUser.getCompany().getCompanyId());
-
+        param.setCompanyUserId(loginUser.getUser().getUserId());
         if (param.getPhoneMk() != null && param.getPhoneMk() != "") {
             param.setPhone(param.getPhoneMk());
         }
 
-        List<FsCourseAnswerLogsListVO> list = fsCourseAnswerLogsService.selectFsCourseAnswerLogsListVO(param);
+        List<FsCourseAnswerLogsListVO> list = fsCourseAnswerLogsService.selectFsCourseAnswerLogsListVONew(param);
         return getDataTable(list);
     }
     /**
@@ -83,7 +83,7 @@ public class FsCourseAnswerLogsController extends BaseController
         if (param.getPhoneMk() != null && param.getPhoneMk() != "") {
             param.setPhone(param.getPhoneMk());
         }
-        List<FsCourseAnswerLogsListVO> list = fsCourseAnswerLogsService.selectFsCourseAnswerLogsListVO(param);
+        List<FsCourseAnswerLogsListVO> list = fsCourseAnswerLogsService.selectFsCourseAnswerLogsListVONew(param);
         ExcelUtil<FsCourseAnswerLogsListVO> util = new ExcelUtil<FsCourseAnswerLogsListVO>(FsCourseAnswerLogsListVO.class);
         return util.exportExcel(list, "答题日志数据");
     }
@@ -102,7 +102,7 @@ public class FsCourseAnswerLogsController extends BaseController
         if (param.getPhoneMk() != null && param.getPhoneMk() != "") {
             param.setPhone(param.getPhoneMk());
         }
-        List<FsCourseAnswerLogsListVO> list = fsCourseAnswerLogsService.selectFsCourseAnswerLogsListVO(param);
+        List<FsCourseAnswerLogsListVO> list = fsCourseAnswerLogsService.selectFsCourseAnswerLogsListVONew(param);
         ExcelUtil<FsCourseAnswerLogsListVO> util = new ExcelUtil<FsCourseAnswerLogsListVO>(FsCourseAnswerLogsListVO.class);
         return util.exportExcel(list, "答题日志数据");
     }

+ 7 - 7
fs-company/src/main/java/com/fs/course/controller/FsCourseWatchLogController.java

@@ -75,7 +75,7 @@ public class FsCourseWatchLogController extends BaseController
         if (param.getSTime()==null||param.getETime()==null){
             return getDataTable(new ArrayList<>());
         }
-        List<FsCourseWatchLogStatisticsListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogStatisticsListVO(param);
+        List<FsCourseWatchLogStatisticsListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogStatisticsListVONew(param);
         return getDataTable(list);
     }
 
@@ -88,7 +88,7 @@ public class FsCourseWatchLogController extends BaseController
         if (param.getSTime()==null||param.getETime()==null){
             return getDataTable(new ArrayList<>());
         }
-        List<QwWatchLogStatisticsListVO> list = qwWatchLogService.selectQwWatchLogStatisticsListVO(param);
+        List<QwWatchLogStatisticsListVO> list = qwWatchLogService.selectQwWatchLogStatisticsListVONew(param);
         return getDataTable(list);
     }
     @GetMapping("/myQwWatchLogStatisticsList")
@@ -101,7 +101,7 @@ public class FsCourseWatchLogController extends BaseController
         if (param.getSTime()==null||param.getETime()==null){
             return getDataTable(new ArrayList<>());
         }
-        List<QwWatchLogStatisticsListVO> list = qwWatchLogService.selectQwWatchLogStatisticsListVO(param);
+        List<QwWatchLogStatisticsListVO> list = qwWatchLogService.selectQwWatchLogStatisticsListVONew(param);
         return getDataTable(list);
     }
 
@@ -115,7 +115,7 @@ public class FsCourseWatchLogController extends BaseController
         if (param.getSTime()==null||param.getETime()==null){
             return getDataTable(new ArrayList<>());
         }
-        List<QwWatchLogAllStatisticsListVO> list = qwWatchLogService.selectQwWatchLogAllStatisticsListVO(param);
+        List<QwWatchLogAllStatisticsListVO> list = qwWatchLogService.selectQwWatchLogAllStatisticsListVONew(param);
         return getDataTable(list);
     }
     @GetMapping("/myQwWatchLogAllStatisticsList")
@@ -128,7 +128,7 @@ public class FsCourseWatchLogController extends BaseController
         if (param.getSTime()==null||param.getETime()==null){
             return getDataTable(new ArrayList<>());
         }
-        List<QwWatchLogAllStatisticsListVO> list = qwWatchLogService.selectQwWatchLogAllStatisticsListVO(param);
+        List<QwWatchLogAllStatisticsListVO> list = qwWatchLogService.selectQwWatchLogAllStatisticsListVONew(param);
         return getDataTable(list);
     }
     @GetMapping("/watchLogStatistics")
@@ -195,7 +195,7 @@ public class FsCourseWatchLogController extends BaseController
     @GetMapping("/export")
     public AjaxResult export(FsCourseWatchLogListParam param)
     {
-        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVOExport(param);
         ExcelUtil<FsCourseWatchLogListVO> util = new ExcelUtil<FsCourseWatchLogListVO>(FsCourseWatchLogListVO.class);
         return util.exportExcel(list, "短链课程看课记录数据");
     }
@@ -210,7 +210,7 @@ public class FsCourseWatchLogController extends BaseController
     {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         param.setCompanyId( loginUser.getCompany().getCompanyId());
-        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVOExport(param);
         ExcelUtil<FsCourseWatchLogListVO> util = new ExcelUtil<FsCourseWatchLogListVO>(FsCourseWatchLogListVO.class);
         return util.exportExcel(list, "短链课程看课记录数据");
     }

+ 121 - 0
fs-company/src/main/java/com/fs/qw/QwWorkTaskController.java

@@ -0,0 +1,121 @@
+package com.fs.qw;
+
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+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.core.security.LoginUser;
+import com.fs.core.web.service.TokenService;
+import com.fs.course.mapper.FsCourseWatchLogMapper;
+import com.fs.qw.domain.QwWorkTask;
+import com.fs.qw.param.QwWorkTaskListParam;
+import com.fs.qw.service.IQwWorkTaskService;
+import com.fs.qw.vo.QwWorkTaskListVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 企微任务看板Controller
+ *
+ * @author fs
+ * @date 2025-03-25
+ */
+@RestController
+@RequestMapping("/qw/QwWorkTask")
+public class QwWorkTaskController extends BaseController
+{
+    @Autowired
+    private IQwWorkTaskService qwWorkTaskService;
+    @Autowired
+    private TokenService tokenService;
+    @Autowired
+    private FsCourseWatchLogMapper fsCourseWatchLogMapper;
+    /**
+     * 查询企微任务看板列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:QwWorkTask:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(QwWorkTaskListParam qwWorkTask)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        qwWorkTask.setCompanyId(loginUser.getCompany().getCompanyId());
+        if(ObjectUtils.isNull(qwWorkTask.getCompanyUserId())) {
+            qwWorkTask.setCompanyUserId(loginUser.getUser().getUserId());
+        }
+        List<QwWorkTaskListVO> list = qwWorkTaskService.selectQwWorkTaskListVONew(qwWorkTask);
+        for (QwWorkTaskListVO qwWorkTaskListVO : list) {
+            qwWorkTaskListVO.setLogs(fsCourseWatchLogMapper.selectFsCourseWatchLog7DayByExtId(qwWorkTaskListVO.getExtId()));
+        }
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出企微任务看板列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:QwWorkTask:export')")
+    @Log(title = "企微任务看板", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(QwWorkTask qwWorkTask)
+    {
+        List<QwWorkTask> list = qwWorkTaskService.selectQwWorkTaskList(qwWorkTask);
+        ExcelUtil<QwWorkTask> util = new ExcelUtil<QwWorkTask>(QwWorkTask.class);
+        return util.exportExcel(list, "企微任务看板数据");
+    }
+
+    /**
+     * 获取企微任务看板详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('qw:QwWorkTask:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(qwWorkTaskService.selectQwWorkTaskById(id));
+    }
+
+    /**
+     * 新增企微任务看板
+     */
+    @PreAuthorize("@ss.hasPermi('qw:QwWorkTask:add')")
+    @Log(title = "企微任务看板", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody QwWorkTask qwWorkTask)
+    {
+        return toAjax(qwWorkTaskService.insertQwWorkTask(qwWorkTask));
+    }
+
+    /**
+     * 修改企微任务看板
+     */
+    @PreAuthorize("@ss.hasPermi('qw:QwWorkTask:edit')")
+    @Log(title = "企微任务看板处理", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody QwWorkTask qwWorkTask)
+    {
+        QwWorkTask task = new QwWorkTask();
+        task.setId(qwWorkTask.getId());
+        task.setRemark(qwWorkTask.getRemark());
+        task.setStatus(1);
+        task.setUpdateTime(new Date());
+        return toAjax(qwWorkTaskService.updateQwWorkTask(task));
+    }
+
+    /**
+     * 删除企微任务看板
+     */
+    @PreAuthorize("@ss.hasPermi('qw:QwWorkTask:remove')")
+    @Log(title = "企微任务看板", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(qwWorkTaskService.deleteQwWorkTaskByIds(ids));
+    }
+}

+ 2 - 1
fs-company/src/main/java/com/fs/qw/vo/QwFriendWelcomeVO.java

@@ -10,7 +10,7 @@ import java.util.List;
 
 /**
  * 好友欢迎语对象 qw_friend_welcome
- * 
+ *
  * @author fs
  * @date 2024-07-20
  */
@@ -62,4 +62,5 @@ public class QwFriendWelcomeVO extends BaseEntity
 
     public List<QwUserVO> userSelectList;
 
+    private Integer project;
 }

+ 17 - 22
fs-company/src/main/java/com/fs/qw/vo/QwWatchLogStatisticsListVO.java

@@ -7,27 +7,22 @@ import java.util.Date;
 
 @Data
 public class QwWatchLogStatisticsListVO {
-    Long id;
-    String qwUserName;
+    private Long id;
+    private String qwUserName;
+    private String companyUserName;
     @JsonFormat(pattern = "yyyy-MM-dd")
-    Date createTime;
-
-    Long line;//进线数
-
-    Long firstOnline;//先导课上线
-
-    Long firstOver;//先导课完课
-
-    Long d1Online;//首日上线
-
-    Long d1Over;//首日完课
-
-    Long sign;//综合报名数
-    Long interact;//互动数
-    Long a;
-    Long b;
-    Long c;
-    Long d;
-    Long los;//流失数
-    Long del;//删除数
+    private Date createTime;
+    private Long line;//进线数
+    private Long firstOnline;//先导课上线
+    private Long firstOver;//先导课完课
+    private Long d1Online;//首日上线
+    private Long d1Over;//首日完课
+    private Long sign;//综合报名数
+    private Long interact;//互动数
+    private Long a;
+    private Long b;
+    private Long c;
+    private Long d;
+    private Long los;//流失数
+    private Long del;//删除数
 }

+ 24 - 3
fs-company/src/main/java/com/fs/qw/vo/QwWorkTaskListVO.java

@@ -1,8 +1,14 @@
 package com.fs.qw.vo;
 
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
 import lombok.Data;
 
+import java.util.Date;
+import java.util.List;
+
 @Data
 public class QwWorkTaskListVO {
     private Long id;
@@ -21,10 +27,12 @@ public class QwWorkTaskListVO {
     /** 类别 1先导 2 课程 3 大小转 4 转人工 */
     @Excel(name = "类别 1先导 2 课程 3 大小转 4 转人工")
     private Integer type;
+    private String typeText;
 
     /** 状态 0 待处理 1 已处理 3 过期 */
     @Excel(name = "状态 0 待处理 1 已处理 3 过期")
     private Integer status;
+    private String statusText;
 
     /** 分值 */
     @Excel(name = "分值")
@@ -35,12 +43,25 @@ public class QwWorkTaskListVO {
     private String sopId;
 
     /** 公司id */
-    @Excel(name = "公司id")
     private Long companyId;
+    @Excel(name = "公司名称")
+    private String companyName;
 
     /** 用户id */
-    @Excel(name = "用户id")
     private Long companyUserId;
-
+    /**
+     * 销售名称
+     */
+    @Excel(name = "销售名称")
+    private String companyUserName;
     private String title;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    /** 更新时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    List<Integer> logs;
 }

+ 3 - 0
fs-company/src/main/java/com/fs/store/controller/FsStoreProductController.java

@@ -3,6 +3,7 @@ package com.fs.store.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.core.security.SecurityUtils;
 import com.fs.store.domain.*;
 import com.fs.store.param.FsProductAttrValueParam;
 import com.fs.store.service.IFsStoreProductAttrValueService;
@@ -41,6 +42,8 @@ public class FsStoreProductController extends BaseController
     {
         startPage();
         fsStoreProduct.setIsDel(0);
+        // 只能展示属于本公司的产品
+        fsStoreProduct.setCompanyIds(String.valueOf(SecurityUtils.getLoginUser().getCompany().getCompanyId()));
         List<FsStoreProductListVO> list = fsStoreProductService.selectFsStoreProductListVO(fsStoreProduct);
         return getDataTable(list);
     }

+ 12 - 3
fs-company/src/main/java/com/fs/users/controller/FsUserController.java

@@ -75,9 +75,18 @@ public class FsUserController extends BaseController
         return R.ok().put("data", list);
     }
 
-
-
-
+    /**
+     * 查询企业内的用户,每次只返回5条
+     * @param fsUser 查询参数
+     * @return R
+     */
+    @GetMapping("/getUserListLimit")
+    public R getUserListLimit( FsUser fsUser)
+    {
+        fsUser.setIsDel(0);
+        List<FsUser> list=fsUserService.getUserListLimit(fsUser);
+        return R.ok().put("data", list);
+    }
 
     /**
      * 新增用户

+ 3 - 4
fs-company/src/main/resources/application-dev.yml

@@ -33,10 +33,9 @@ spring:
                 # 从库数据源
                 slave:
                     # 从数据源开关/默认关闭
-                    enabled: false
-                    url:
-                    username:
-                    password:
+                    url: jdbc:mysql://139.186.77.83:3306/ylrz_scrm?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                    username: Rtroot
+                    password: Rtroot
                 # 初始连接数
                 initialSize: 5
                 # 最小连接池数量

+ 1 - 1
fs-service-system/src/main/java/com/fs/company/cache/impl/CompanyUserCacheServiceImpl.java

@@ -27,6 +27,6 @@ public class CompanyUserCacheServiceImpl implements ICompanyUserCacheService {
             .build();
     @Override
     public CompanyUser selectCompanyUserById(Long userId) {
-        return USER_CACHE.get(userId,e-> companyUserService.selectCompanyUserById(userId));
+        return USER_CACHE.get(userId,e-> companyUserService.selectCompanyUserByUserId(userId));
     }
 }

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

@@ -6,6 +6,7 @@ import com.fs.common.core.domain.BaseEntity;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
+import javax.validation.constraints.Pattern;
 import java.util.Date;
 import java.util.List;
 
@@ -127,6 +128,18 @@ public class CompanyUser extends BaseEntity
 
     private Integer qwStatus;
 
+    /** 域名 */
+    private String domain;
+
+    @Pattern(regexp = "^(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,})|(?:\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}))$", message = "域名格式不正确")
+    public String getDomain() {
+        return domain;
+    }
+
+    public void setDomain(String domain) {
+        this.domain = domain;
+    }
+
     public Integer getQwStatus() {
         return qwStatus;
     }

+ 0 - 45
fs-service-system/src/main/java/com/fs/company/mapper/CompanyTcmReportMapper.java

@@ -145,52 +145,7 @@ public interface CompanyTcmReportMapper
 
 
 
-    @Select({"<script> " +
-            " SELECT r.company_id,c.company_name, r.schedule_id,s.name as schedule_name,ANY_VALUE(cu.cu_count) as cu_count,ANY_VALUE(cu.money) as money,min(r.create_time) as create_time,max(r.update_time) as update_time,count( DISTINCT r.company_user_id) AS connection_num, " +
-            " SUM(total_num) as total_num,SUM(register_num) as register_num,SUM(online_num) as online_num, SUM(finish_num) as finish_num,SUM(total_money) as total_money,SUM(target_money) as target_money,SUM(total_order) as total_order, " +
-            " SUM(round1_money) as round1_money,SUM(round1_order) as round1_order,SUM(round2_money) as round2_money,SUM(round2_order) as round2_order,SUM(round3_money) as round3_money,SUM(round3_order) as round3_order,"+
-            " SUM(round4_money) as round4_money,SUM(round4_order) as round4_order,SUM(round5_money) as round5_money,SUM(round5_order) as round5_order,SUM(round6_money) as round6_money,SUM(round6_order) as round6_order,"+
-            " SUM(round7_money) as round7_money,SUM(round7_order) as round7_order,SUM(round8_money) as round8_money,SUM(round8_order) as round8_order,SUM(round9_money) as round9_money,SUM(round9_order) as round9_order "+
-            " from company_tcm_report r LEFT JOIN company_tcm_schedule s on r.schedule_id=s.id  LEFT JOIN company c on r.company_id=c.company_id   "+
-            " left join company_tcm_consume cu on r.company_id=cu.company_id and r.schedule_id=cu.schedule_id " +
-            " left join company_user comu on r.company_user_id=comu.user_id "+
-            //" left join ( SELECT count(*) as cu_count,company_id from company_user  GROUP BY company_id) cu on r.company_id=cu.company_id "+
-            " where 1=1 "+
-//            "<if test = 'maps.companyId != null  '> " +
-//            " and r.company_id = #{maps.companyId} " +
-//            "</if>" +
-            "<if test = 'maps.companyId != null  and maps.companyId != \"\"    '> " +
-            "and r.company_id IN " +
-            "<foreach collection=\"maps.companyId.split(',')\"  item='item' index='index'  open='(' separator=',' close=')'> #{item} </foreach>"+
-            "</if>" +
-            "<if test = 'maps.companyUserId != null '> " +
-            " and r.company_user_id = #{maps.companyUserId}" +
-            "</if>" +
-
-            "<if test = 'maps.userNickName != null and maps.userNickName != \"\" '> " +
-            "and comu.nick_name like '%${maps.userNickName}%'" +
-            "</if>" +
 
-            "<if test = 'maps.scheduleId != null   and maps.scheduleId != \"\"     '> " +
-            " and r.schedule_id IN " +
-            "<foreach collection=\"maps.scheduleId.split(',')\"  item='item' index='index'  open='(' separator=',' close=')'> #{item} </foreach>"+
-            "</if>" +
-            "<if test = 'maps.beginTime != null and maps.beginTime != \"\" '> " +
-            "and date_format(r.create_time,'%y%m%d') &gt;= date_format(#{maps.beginTime},'%y%m%d') " +
-            "</if>" +
-            "<if test = 'maps.endTime != null and maps.endTime != \"\" '> " +
-            "and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{maps.endTime},'%y%m%d') " +
-            "</if>" +
-            "<if test = 'maps.deptIdStr != null and  maps.deptIdStr !=\"\"    '> " +
-            " AND " +
-            "<foreach collection=\"maps.deptIdStr.split(',')\" item=\"deptId\"   open=\"(\" close=\")\" separator=\"OR\">" +
-            " comu.dept_id = #{deptId} OR comu.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{deptId}, ancestors) )  " +
-            "</foreach> " +
-            "</if>" +
-            "${maps.params.dataScope}"+
-            " GROUP BY r.schedule_id,r.company_id "+
-            " order by r.company_id desc " +
-            "</script>"})
     List<CompanyTcmReportListVO> selectCompanyTcmReportStatisticsVOList(@Param("maps") CompanyTcmReportListQueryParam param);
 
 

+ 56 - 49
fs-service-system/src/main/java/com/fs/company/mapper/CompanyUserMapper.java

@@ -89,29 +89,29 @@ public interface CompanyUserMapper
     int resetUserPwdByUserId( @Param("userId")Long userId, @Param("password") String encryptPassword);
 
     List<CompanyUser> selectAllUsersList(CompanyUser user);
-    @Select({"<script> " +
-            "select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.open_id,u.id_card, d.dept_name, d.leader from company_user u\n" +
-            "        left join company_dept d on u.dept_id = d.dept_id\n" +
-            "        where u.del_flag = '0' and u.status=0\n" +
-            "        <if test=\"companyId != null  \">\n" +
-            "            AND u.company_id = #{companyId}\n" +
-            "        </if>\n" +
-            "        <if test=\"nickName != null and nickName != ''\">\n" +
-            "            AND u.nick_name like concat(#{nickName}, '%')\n" +
-            "        </if>\n" +
-            "        <if test=\"phonenumber != null and phonenumber != ''\">\n" +
-            "            AND u.phonenumber like concat('%', #{phonenumber}, '%')\n" +
-            "        </if>\n" +
-            "        <if test=\"beginTime != null and beginTime != ''\"><!-- 开始时间检索 -->\n" +
-            "            AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')\n" +
-            "        </if>\n" +
-            "        <if test=\"endTime != null and endTime != ''\"><!-- 结束时间检索 -->\n" +
-            "            AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')\n" +
-            "        </if>\n" +
-            "        <if test=\"deptId != null and deptId != 0\">\n" +
-            "            AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{deptId}, ancestors) ))\n" +
-            "        </if>"+
-            "</script>"})
+//    @Select({"<script> " +
+//            "select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.open_id,u.id_card, d.dept_name, d.leader from company_user u\n" +
+//            "        left join company_dept d on u.dept_id = d.dept_id\n" +
+//            "        where u.del_flag = '0' and u.status=0\n" +
+//            "        <if test=\"companyId != null  \">\n" +
+//            "            AND u.company_id = #{companyId}\n" +
+//            "        </if>\n" +
+//            "        <if test=\"nickName != null and nickName != ''\">\n" +
+//            "            AND u.nick_name like concat(#{nickName}, '%')\n" +
+//            "        </if>\n" +
+//            "        <if test=\"phonenumber != null and phonenumber != ''\">\n" +
+//            "            AND u.phonenumber like concat('%', #{phonenumber}, '%')\n" +
+//            "        </if>\n" +
+//            "        <if test=\"beginTime != null and beginTime != ''\"><!-- 开始时间检索 -->\n" +
+//            "            AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')\n" +
+//            "        </if>\n" +
+//            "        <if test=\"endTime != null and endTime != ''\"><!-- 结束时间检索 -->\n" +
+//            "            AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')\n" +
+//            "        </if>\n" +
+//            "        <if test=\"deptId != null and deptId != 0\">\n" +
+//            "            AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{deptId}, ancestors) ))\n" +
+//            "        </if>"+
+//            "</script>"})
     List<CompanyUserVO> selectMyUserList(CompanyUser user);
 
     @Select("select u.* from company_user u where u.dept_id in ( SELECT dept_id FROM company_dept WHERE dept_id = #{maps.deptId} or find_in_set( #{maps.deptId} , ancestors ) ) ${maps.params.dataScope}")
@@ -132,32 +132,32 @@ public interface CompanyUserMapper
     @Select("select u.* from company_user u   where u.company_id=#{companyId} and u.nick_name=#{nickName} limit 1 ")
     CompanyUser selectCompanyUserByCompanyIdAndNickName(@Param("companyId")long companyId,@Param("nickName") String nickName);
 
-    @Select({"<script> " +
-            "select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.open_id,u.id_card, d.dept_name, d.leader ,\n" +
-            "        (select count(1) from crm_customer cc where u.user_id= cc.receive_user_id and date_format(cc.receive_time,'%y%m%d') = date_format(now(),'%y%m%d')  ) as now_day_customer_count\n" +
-            "        from company_user u\n" +
-            "        left join company_dept d on u.dept_id = d.dept_id\n" +
-            "\n" +
-            "        where u.del_flag = '0' and u.status=0\n" +
-            "        <if test=\"companyId != null  \">\n" +
-            "            AND u.company_id = #{companyId}\n" +
-            "        </if>\n" +
-            "        <if test=\"nickName != null and nickName != ''\">\n" +
-            "            AND u.nick_name like concat( #{nickName}, '%')\n" +
-            "        </if>\n" +
-            "        <if test=\"phonenumber != null and phonenumber != ''\">\n" +
-            "            AND u.phonenumber like concat('%', #{phonenumber}, '%')\n" +
-            "        </if>\n" +
-            "        <if test=\"beginTime != null and beginTime != ''\"><!-- 开始时间检索 -->\n" +
-            "            AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')\n" +
-            "        </if>\n" +
-            "        <if test=\"endTime != null and endTime != ''\"><!-- 结束时间检索 -->\n" +
-            "            AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')\n" +
-            "        </if>\n" +
-            "        <if test=\"deptId != null and deptId != 0\">\n" +
-            "            AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{deptId}, ancestors) ))\n" +
-            "        </if>"+
-            "</script>"})
+//    @Select({"<script> " +
+//            "select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.open_id,u.id_card, d.dept_name, d.leader ,\n" +
+//            "        (select count(1) from crm_customer cc where u.user_id= cc.receive_user_id and date_format(cc.receive_time,'%y%m%d') = date_format(now(),'%y%m%d')  ) as now_day_customer_count\n" +
+//            "        from company_user u\n" +
+//            "        left join company_dept d on u.dept_id = d.dept_id\n" +
+//            "\n" +
+//            "        where u.del_flag = '0' and u.status=0\n" +
+//            "        <if test=\"companyId != null  \">\n" +
+//            "            AND u.company_id = #{companyId}\n" +
+//            "        </if>\n" +
+//            "        <if test=\"nickName != null and nickName != ''\">\n" +
+//            "            AND u.nick_name like concat( #{nickName}, '%')\n" +
+//            "        </if>\n" +
+//            "        <if test=\"phonenumber != null and phonenumber != ''\">\n" +
+//            "            AND u.phonenumber like concat('%', #{phonenumber}, '%')\n" +
+//            "        </if>\n" +
+//            "        <if test=\"beginTime != null and beginTime != ''\"><!-- 开始时间检索 -->\n" +
+//            "            AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')\n" +
+//            "        </if>\n" +
+//            "        <if test=\"endTime != null and endTime != ''\"><!-- 结束时间检索 -->\n" +
+//            "            AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')\n" +
+//            "        </if>\n" +
+//            "        <if test=\"deptId != null and deptId != 0\">\n" +
+//            "            AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{deptId}, ancestors) ))\n" +
+//            "        </if>"+
+//            "</script>"})
     List<CompanyUserVO> selecCompanyAllUsersList(CompanyUser map);
 
     @Select("select user_id from company_user where company_id=#{companyId} and user_type = '00'")
@@ -240,4 +240,11 @@ public interface CompanyUserMapper
     String selectQwUserIdsByCompany(Long companyUserId);
 
     List<String> selectCompanyUserNameByIds(@Param("companyUserIds")String companyUserIds);
+
+    @Select("select * from company_user where user_id=#{userId}")
+    CompanyUser selectCompanyUserByUserId(Long userId);
+
+
+    @Select("select * from company_user where company_id=#{companyId} and del_flag=0")
+    List<CompanyUser> selectCompanyUserByCompanyId(Long companyId);
 }

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

@@ -124,4 +124,6 @@ public interface ICompanyUserService {
     List<OptionsVO> selectCompanyUserBySalesman();
 
     List<CompanyQwUserByIdsVo> selectCompanyQwUserByIds(List<Long> qwUserIdList);
+
+    CompanyUser selectCompanyUserByUserId(Long userId);
 }

+ 5 - 0
fs-service-system/src/main/java/com/fs/company/service/impl/CompanyUserServiceImpl.java

@@ -381,4 +381,9 @@ public class CompanyUserServiceImpl implements ICompanyUserService
         return companyUserMapper.selectCompanyQwUserByIds(ids);
     }
 
+    @Override
+    public CompanyUser selectCompanyUserByUserId(Long userId) {
+        return companyUserMapper.selectCompanyUserByUserId(userId);
+    }
+
 }

+ 2 - 0
fs-service-system/src/main/java/com/fs/course/mapper/FsCourseAnswerLogsMapper.java

@@ -119,4 +119,6 @@ public interface FsCourseAnswerLogsMapper
             "</if>" +
             "</script>"})
     int selectErrorCountByCourseVideo(@Param("videoId") Long videoId,@Param("userId") Long userId,@Param("qwUserId") String qwUserId);
+
+    List<FsCourseAnswerLogsListVO> selectFsCourseAnswerLogsListVONew(FsCourseAnswerLogsParam param);
 }

+ 37 - 0
fs-service-system/src/main/java/com/fs/course/mapper/FsCourseWatchLogMapper.java

@@ -10,7 +10,9 @@ import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 
+import java.time.LocalDateTime;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -122,6 +124,7 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
                                                  @Param("externalId") Long externalId);
 
     List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVO(@Param("maps") FsCourseWatchLogListParam param);
+    List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVONew(@Param("maps") FsCourseWatchLogListParam param);
 
     List<FsCourseWatchLogListVO> selectFsCourseWatchLogListByParam(FsCourseWatchLogListParam param);
 
@@ -261,4 +264,38 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
     @Select("SELECT qw_external_contact_id FROM fs_course_watch_log  WHERE log_type=2 and DATE(create_time) = CURDATE() ")
     List<Long> selectFsCourseWatchLogByFinish();
 
+    @Select("WITH date_series AS (\n" +
+            "  SELECT DATE_SUB(CURRENT_DATE(), INTERVAL 6-n DAY) AS report_date\n" +
+            "  FROM (\n" +
+            "    SELECT 0 AS n UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 \n" +
+            "    UNION SELECT 4 UNION SELECT 5 UNION SELECT 6\n" +
+            "  ) days\n" +
+            "  ORDER BY n\n" +
+            "),\n" +
+            "daily_data AS (\n" +
+            "  SELECT \n" +
+            "    DATE(create_time) AS log_date,\n" +
+            "    log_type,\n" +
+            "    ROW_NUMBER() OVER (PARTITION BY DATE(create_time) ORDER BY create_time DESC) AS rn\n" +
+            "  FROM fs_course_watch_log\n" +
+            "  WHERE qw_external_contact_id = #{extId}\n" +
+            "    AND create_time >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)\n" +
+            ")\n" +
+            "SELECT \n" +
+            "  IFNULL(dd.log_type, 0) AS log_type\n" +
+            "FROM date_series ds\n" +
+            "LEFT JOIN (\n" +
+            "  SELECT log_date, log_type FROM daily_data WHERE rn = 1\n" +
+            ") dd ON ds.report_date = dd.log_date\n" +
+            "ORDER BY ds.report_date ASC  ")
+    List<Integer> selectFsCourseWatchLog7DayByExtId(Long extId);
+
+    List<FsCourseWatchLogStatisticsListVO> selectFsCourseWatchLogStatisticsListVONew(FsCourseWatchLogStatisticsListParam param);
+
+    @Select("SELECT min(create_time) FROM fs_course_watch_log WHERE user_id=#{userId} limit 1")
+    Date queryFirstWatchDateLogByVideoId(@Param("userId") Long userId);
+
+    @Select("SELECT l.qw_external_contact_id,l.log_type,l.qw_user_id,l.create_time lineTime,l.company_user_id as company_user_id,l.user_id as user_id,l.company_id as company_id FROM fs_course_watch_log l" +
+            " WHERE DATE(l.create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) and l.video_id =#{videoId}")
+    List<FsQwCourseWatchLogVO> selectFsCourseBeforeMonthWatchLogByVideoId(Long videoId);
 }

+ 37 - 5
fs-service-system/src/main/java/com/fs/course/param/FsCourseAnswerLogsParam.java

@@ -3,27 +3,59 @@ package com.fs.course.param;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.core.domain.BaseEntity;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 import java.util.Date;
 
+@EqualsAndHashCode(callSuper = true)
 @Data
 public class FsCourseAnswerLogsParam  extends BaseEntity  {
     private String phone;
     private String phoneMk;
-    private String courseId;
+
+    /**
+     * 课程id
+     */
+    private Long courseId;
+
+    /**
+     * 视频id
+     */
     private String videoId;
+
+    /**
+     * 课程名称
+     */
+    private String courseName;
+    /**
+     * 销售名称
+     */
     private String companyUserName;
+
+    /**
+     * 销售id
+     */
+    private Long companyUserId;
+
+    /**
+     * 公司
+     */
     private Long companyId;
+    /**
+     * 是否全部正确
+     */
     private Long isRight;
+
     private Long watchLogId;
 
     private Long qwUserId;
     private Long userId;
     private String nickName;
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date eTime;
 
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date sTime;
+    private String project;
+
+    private String eTime;
+
+    private String sTime;
 
 }

+ 2 - 0
fs-service-system/src/main/java/com/fs/course/param/FsCourseOverParam.java

@@ -14,4 +14,6 @@ public class FsCourseOverParam {
     private Date eTime;
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date sTime;
+
+    private Long companyUserId;
 }

+ 4 - 0
fs-service-system/src/main/java/com/fs/course/param/FsCourseWatchLogStatisticsListParam.java

@@ -9,6 +9,8 @@ import java.util.Date;
 public class FsCourseWatchLogStatisticsListParam {
 
     private Long companyId;
+    private Long companyUserId;
+    private Long userId;
 
     private String nickName;
 
@@ -20,4 +22,6 @@ public class FsCourseWatchLogStatisticsListParam {
     private Date eTime;
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date sTime;
+
+    private Long project;
 }

+ 1 - 0
fs-service-system/src/main/java/com/fs/course/service/IFsCourseAnswerLogsService.java

@@ -30,6 +30,7 @@ public interface IFsCourseAnswerLogsService
      */
     public List<FsCourseAnswerLogs> selectFsCourseAnswerLogsList(FsCourseAnswerLogs fsCourseAnswerLogs);
     public List<FsCourseAnswerLogsListVO> selectFsCourseAnswerLogsListVO(FsCourseAnswerLogsParam param);
+    public List<FsCourseAnswerLogsListVO> selectFsCourseAnswerLogsListVONew(FsCourseAnswerLogsParam param);
 
     /**
      * 新增答题日志

+ 4 - 1
fs-service-system/src/main/java/com/fs/course/service/IFsCourseWatchLogService.java

@@ -81,12 +81,14 @@ public interface IFsCourseWatchLogService extends IService<FsCourseWatchLog> {
 
 
     List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVO(FsCourseWatchLogListParam param);
+    List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVOExport(FsCourseWatchLogListParam param);
 
     List<FsCourseWatchLogListVO> selectFsCourseWatchLogListByParam(FsCourseWatchLogListParam param);
 
     void testFinishMsg();
 
     List<FsCourseWatchLogStatisticsListVO> selectFsCourseWatchLogStatisticsListVO(FsCourseWatchLogStatisticsListParam param);
+    List<FsCourseWatchLogStatisticsListVO> selectFsCourseWatchLogStatisticsListVONew(FsCourseWatchLogStatisticsListParam param);
 
     void scheduleBatchUpdateToDatabase();
 
@@ -96,9 +98,10 @@ public interface IFsCourseWatchLogService extends IService<FsCourseWatchLog> {
 
     List<FsCourseOverVO> selectFsCourseWatchLogOverStatisticsListVO(FsCourseOverParam param);
 
+    void addCourseWatchLogDayNew();
+
     void addCourseWatchLogDay();
 
-    void addCourseWatchLogDay2();
 
     FsCourseWatchLog getWatchCourseVideoH5(Long videoId,String qwUserId,Long externalId);
 }

+ 7 - 0
fs-service-system/src/main/java/com/fs/course/service/cache/IFsUserCourseVideoCacheService.java

@@ -0,0 +1,7 @@
+package com.fs.course.service.cache;
+
+import com.fs.course.domain.FsUserCourseVideo;
+
+public interface IFsUserCourseVideoCacheService {
+    public FsUserCourseVideo selectFsUserCourseVideoByVideoId(Long videoId);
+}

+ 31 - 0
fs-service-system/src/main/java/com/fs/course/service/cache/impl/FsUserCourseVideoCacheServiceImpl.java

@@ -0,0 +1,31 @@
+package com.fs.course.service.cache.impl;
+
+import com.fs.company.domain.CompanyUser;
+import com.fs.course.domain.FsUserCourseVideo;
+import com.fs.course.service.IFsCourseAnswerLogsService;
+import com.fs.course.service.IFsUserCourseVideoService;
+import com.fs.course.service.cache.IFsUserCourseVideoCacheService;
+import com.github.benmanes.caffeine.cache.Cache;
+import com.github.benmanes.caffeine.cache.Caffeine;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.concurrent.TimeUnit;
+
+@AllArgsConstructor
+@Service
+@Slf4j
+public class FsUserCourseVideoCacheServiceImpl implements IFsUserCourseVideoCacheService {
+
+    private final IFsUserCourseVideoService fsUserCourseVideoService;
+    private static final Cache<Long, FsUserCourseVideo> VIDEO_CACHE = Caffeine.newBuilder()
+            .maximumSize(1000)
+            .expireAfterWrite(10, TimeUnit.MINUTES)
+            .build();
+
+    @Override
+    public FsUserCourseVideo selectFsUserCourseVideoByVideoId(Long videoId) {
+        return VIDEO_CACHE.get(videoId,e-> fsUserCourseVideoService.selectFsUserCourseVideoByVideoId(videoId));
+    }
+}

+ 79 - 2
fs-service-system/src/main/java/com/fs/course/service/impl/FsCourseAnswerLogsServiceImpl.java

@@ -1,14 +1,32 @@
 package com.fs.course.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.fs.common.utils.DateUtils;
+import com.fs.common.utils.DictUtils;
+import com.fs.company.cache.ICompanyCacheService;
+import com.fs.company.cache.ICompanyUserCacheService;
+import com.fs.company.domain.Company;
+import com.fs.company.domain.CompanyUser;
 import com.fs.course.domain.FsCourseAnswerLogs;
+import com.fs.course.domain.FsUserCourse;
+import com.fs.course.domain.FsUserCourseVideo;
 import com.fs.course.mapper.FsCourseAnswerLogsMapper;
 import com.fs.course.param.FsCourseAnswerLogsParam;
 import com.fs.course.service.IFsCourseAnswerLogsService;
+import com.fs.course.service.IFsUserCourseService;
+import com.fs.course.service.IFsUserCourseVideoService;
+import com.fs.course.service.cache.IFsUserCourseVideoCacheService;
 import com.fs.course.vo.FsCourseAnswerLogsListVO;
+import com.fs.store.domain.FsUser;
+import com.fs.store.service.IFsUserService;
+import com.fs.store.service.cache.IFsUserCacheService;
+import com.fs.store.service.cache.IFsUserCourseCacheService;
+import com.hc.openapi.tool.util.StringUtils;
+import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -18,11 +36,20 @@ import java.util.List;
  * @date 2024-10-26
  */
 @Service
+@RequiredArgsConstructor
 public class FsCourseAnswerLogsServiceImpl implements IFsCourseAnswerLogsService
 {
-    @Autowired
-    private FsCourseAnswerLogsMapper fsCourseAnswerLogsMapper;
+    private final FsCourseAnswerLogsMapper fsCourseAnswerLogsMapper;
 
+    private final IFsUserCourseVideoCacheService fsUserCourseVideoCacheService;
+
+    private final IFsUserCacheService  fsUserCacheService;
+
+    private final IFsUserCourseCacheService fsUserCourseCacheService;
+
+    private final ICompanyCacheService companyCacheService;
+
+    private final ICompanyUserCacheService companyUserCacheService;
     /**
      * 查询答题日志
      *
@@ -52,6 +79,56 @@ public class FsCourseAnswerLogsServiceImpl implements IFsCourseAnswerLogsService
         return fsCourseAnswerLogsMapper.selectFsCourseAnswerLogsListVO(param);
     }
 
+    @Override
+    public List<FsCourseAnswerLogsListVO> selectFsCourseAnswerLogsListVONew(FsCourseAnswerLogsParam param) {
+        List<FsCourseAnswerLogsListVO> data = fsCourseAnswerLogsMapper.selectFsCourseAnswerLogsListVONew(param);
+        for (FsCourseAnswerLogsListVO datum : data) {
+            FsUserCourseVideo fsUserCourseVideo = fsUserCourseVideoCacheService.selectFsUserCourseVideoByVideoId(datum.getVideoId());
+            if (fsUserCourseVideo != null) {
+                datum.setVideoName(fsUserCourseVideo.getTitle());
+                datum.setCourseId(fsUserCourseVideo.getCourseId());
+            }
+            // 用户
+            FsUser fsUser = fsUserCacheService.selectFsUserById(datum.getUserId());
+            if(fsUser != null) {
+                datum.setUserName(String.format("%s_%d",fsUser.getNickname(),fsUser.getUserId()));
+                datum.setFsAvatar(fsUser.getAvatar());
+            }
+
+            // 公司名称
+            if(datum.getCompanyId() != null) {
+                Company company = companyCacheService.selectCompanyById(datum.getCompanyId());
+                if(company != null) {
+                    datum.setCompanyName(String.format("%s_%d", company.getCompanyName(), company.getCompanyId()));
+                }
+            }
+            // 销售
+            if(datum.getCompanyUserId() != null) {
+                CompanyUser companyUser = companyUserCacheService.selectCompanyUserById(datum.getCompanyUserId());
+                if(companyUser != null) {
+                    datum.setCompanyUserName(String.format("%s_%d",companyUser.getUserName(),companyUser.getUserId()));
+                }
+            }
+            // 项目名
+            if(datum.getProject() != null) {
+                String sysCourseProject = DictUtils.getDictLabel("sys_course_project", datum.getProject());
+                if(StringUtils.isNotBlank(sysCourseProject)){
+                    datum.setProjectName(sysCourseProject);
+                }
+            }
+
+            // 是否全部正确
+            if(ObjectUtil.isNotNull(datum.getIsRight())){
+                String sysCompanyOr = DictUtils.getDictLabel("sys_company_or", String.valueOf(datum.getIsRight()));
+                if(StringUtils.isNotBlank(sysCompanyOr)){
+                    datum.setIsRightText(sysCompanyOr);
+                }
+            }
+        }
+
+        return data;
+    }
+
     /**
      * 新增答题日志
      *

+ 235 - 55
fs-service-system/src/main/java/com/fs/course/service/impl/FsCourseWatchLogServiceImpl.java

@@ -5,9 +5,16 @@ import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.common.core.redis.RedisCache;
 import com.fs.common.utils.DateUtils;
+import com.fs.common.utils.DictUtils;
+import com.fs.company.cache.ICompanyCacheService;
+import com.fs.company.cache.ICompanyUserCacheService;
+import com.fs.company.domain.Company;
+import com.fs.company.domain.CompanyUser;
 import com.fs.course.config.CourseConfig;
 import com.fs.course.domain.FsCourseFinishTemp;
 import com.fs.course.domain.FsCourseWatchLog;
@@ -19,6 +26,7 @@ import com.fs.course.mapper.FsUserCourseMapper;
 import com.fs.course.mapper.FsUserCourseVideoMapper;
 import com.fs.course.param.*;
 import com.fs.course.service.IFsCourseWatchLogService;
+import com.fs.course.service.cache.IFsUserCourseVideoCacheService;
 import com.fs.course.vo.*;
 import com.fs.his.config.FsSysConfig;
 import com.fs.his.utils.ConfigUtil;
@@ -34,11 +42,18 @@ import com.fs.qw.vo.QwSopCourseFinishTempSetting;
 import com.fs.qw.vo.QwSopTempSetting;
 import com.fs.sop.domain.QwSopLogs;
 import com.fs.sop.mapper.SopUserLogsMapper;
+import com.fs.store.domain.FsUser;
+import com.fs.store.service.IFsUserService;
+import com.fs.store.service.cache.IFsUserCacheService;
+import com.fs.store.service.cache.IFsUserCourseCacheService;
 import com.fs.system.service.ISysConfigService;
+import com.hc.openapi.tool.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.time.Duration;
 import java.time.LocalDate;
@@ -46,10 +61,7 @@ import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoUnit;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 /**
  * 短链课程看课记录Service业务层处理
@@ -83,6 +95,26 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
     @Autowired
     private ConfigUtil configUtil;
 
+    @Autowired
+    private ICompanyUserCacheService companyUserCacheService;
+
+    @Autowired
+    private IFsUserService fsUserService;
+
+    @Autowired
+    private IFsUserCourseCacheService fsUserCourseCacheService;
+
+    @Autowired
+    private IFsUserCourseVideoCacheService fsUserCourseVideoCacheService;
+
+    @Autowired
+    private IFsUserCacheService fsUserCacheService;
+
+    @Autowired
+    private ICompanyCacheService companyCacheService;
+
+
+
     /**
      * 查询短链课程看课记录
      *
@@ -187,6 +219,61 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
 
     @Override
     public List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVO(FsCourseWatchLogListParam param) {
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogMapper.selectFsCourseWatchLogListVONew(param);
+        for (FsCourseWatchLogListVO item : list) {
+            // 项目
+            if(ObjectUtils.isNotNull(item.getProject())) {
+                String sysCourseProject = DictUtils.getDictLabel("sys_course_project", String.valueOf(item.getProject()));
+                if(StringUtils.isNotBlank(sysCourseProject)){
+                    item.setProjectName(sysCourseProject);
+                }
+            }
+            // 用户名
+            if(ObjectUtils.isNotNull(item.getUserId())) {
+                FsUser fsUser = fsUserCacheService.selectFsUserById(item.getUserId());
+                if(ObjectUtils.isNotNull(fsUser)){
+                    item.setUserName(String.format("%s_%d",fsUser.getNickname(),fsUser.getUserId()));
+                    item.setFsNickName(fsUser.getNickname());
+                    item.setFsAvatar(fsUser.getAvatar());
+                }
+            }
+            // 公司名
+            if(ObjectUtils.isNotNull(item.getCompanyId())){
+                Company company = companyCacheService.selectCompanyById(Long.valueOf(item.getCompanyId()));
+                if(ObjectUtils.isNotNull(company)){
+                    item.setCompanyName(String.format("%s_%d", company.getCompanyName(), company.getCompanyId()));
+                }
+            }
+
+            // 销售名
+            if(ObjectUtils.isNotNull(item.getCompanyUserId())){
+                CompanyUser companyUser = companyUserCacheService.selectCompanyUserById(item.getCompanyUserId());
+                if(ObjectUtils.isNotNull(companyUser)){
+                    item.setCompanyUserName(String.format("%s_%d", companyUser.getNickName(), companyUser.getUserId()));
+                }
+            }
+
+            // 课程
+            if(ObjectUtils.isNotNull(item.getCourseId())){
+                FsUserCourse course = fsUserCourseCacheService.selectFsUserCourseByCourseId(item.getCourseId());
+                if(ObjectUtils.isNotNull(course)){
+                    item.setCourseName(course.getCourseName());
+                }
+            }
+            // 小节
+            if(ObjectUtils.isNotNull(item.getVideoId())){
+                FsUserCourseVideo fsUserCourseVideo = fsUserCourseVideoCacheService.selectFsUserCourseVideoByVideoId(item.getVideoId());
+                if(ObjectUtils.isNotNull(fsUserCourseVideo)){
+                    item.setVideoName(fsUserCourseVideo.getTitle());
+                }
+            }
+
+        }
+        return list;
+    }
+
+    @Override
+    public List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVOExport(FsCourseWatchLogListParam param) {
         return fsCourseWatchLogMapper.selectFsCourseWatchLogListVO(param);
     }
 
@@ -269,6 +356,49 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
         return fsCourseWatchLogMapper.selectFsCourseWatchLogStatisticsListVO(param);
     }
 
+    @Override
+    public List<FsCourseWatchLogStatisticsListVO> selectFsCourseWatchLogStatisticsListVONew(FsCourseWatchLogStatisticsListParam param) {
+        List<FsCourseWatchLogStatisticsListVO> list = fsCourseWatchLogMapper.selectFsCourseWatchLogStatisticsListVONew(param);
+        for (FsCourseWatchLogStatisticsListVO item : list) {
+            // 项目名
+            if(ObjectUtils.isNotNull(item.getProject())){
+                String sysCourseProject = DictUtils.getDictLabel("sys_course_project", String.valueOf(item.getProject()));
+                if(StringUtils.isNotBlank(sysCourseProject)){
+                    item.setProjectName(sysCourseProject);
+                }
+            }
+            // 课程名
+            if(ObjectUtils.isNotNull(item.getCourseId())) {
+                FsUserCourse course = fsUserCourseCacheService.selectFsUserCourseByCourseId(item.getCourseId());
+                if(ObjectUtils.isNotNull(course)){
+                    item.setCourseName(course.getCourseName());
+                }
+            }
+            // 小节名
+            if(ObjectUtils.isNotNull(item.getVideoId())) {
+                FsUserCourseVideo fsUserCourseVideo = fsUserCourseVideoCacheService.selectFsUserCourseVideoByVideoId(item.getVideoId());
+                if(ObjectUtils.isNotNull(fsUserCourseVideo)){
+                    item.setVideoName(fsUserCourseVideo.getTitle());
+                }
+            }
+            // 用户名
+            if(ObjectUtils.isNotNull(item.getUserId())) {
+                FsUser fsUser = fsUserCacheService.selectFsUserById(item.getUserId());
+                if(ObjectUtils.isNotNull(fsUser)){
+                    item.setUserName(String.format("%s_%d",fsUser.getNickname(),fsUser.getUserId()));
+                }
+            }
+            // 销售名
+            if(ObjectUtils.isNotNull(item.getCompanyUserId())) {
+                CompanyUser companyUser = companyUserCacheService.selectCompanyUserById(item.getCompanyUserId());
+                if(ObjectUtils.isNotNull(companyUser)){
+                    item.setCompanyUserName(String.format("%s_%d", companyUser.getUserName(), companyUser.getUserId()));
+                }
+            }
+        }
+        return list;
+    }
+
 
     public void sendSocket(String cmd,String message,String appKey){
         MsgBean msgBean=new MsgBean();
@@ -382,11 +512,39 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
 
     @Override
     public List<FsCourseOverVO> selectFsCourseWatchLogOverStatisticsListVO(FsCourseOverParam param) {
-        return fsCourseWatchLogMapper.selectFsCourseWatchLogOverStatisticsListVO(param);
+        QueryWrapper<FsCourseWatchLog> queryWrapper = new QueryWrapper<>();
+        queryWrapper.select("MIN(create_time) as createTime","company_user_id as companyUserId");
+        if(param.getCompanyId() != null) {
+            queryWrapper.eq("company_id", param.getCompanyId());
+        }
+        if(param.getSTime() != null) {
+            queryWrapper.apply("DATE(create_time) >= DATE({0})", param.getSTime());
+        }
+        if (param.getETime() != null) {
+            queryWrapper.apply("DATE(create_time) <= DATE({0})", param.getETime());
+        }
+        queryWrapper.groupBy("company_user_id");
+        List<FsCourseWatchLog> fsCourseWatchLogs = fsCourseWatchLogMapper.selectList(queryWrapper);
+        List<FsCourseOverVO> fsCourseOverVOS = new ArrayList<>();
+        for (FsCourseWatchLog fsCourseWatchLog : fsCourseWatchLogs) {
+            FsCourseOverVO overVO = new FsCourseOverVO();
+            overVO.setCreateTime(fsCourseWatchLog.getCreateTime());
+            if(fsCourseWatchLog.getCompanyUserId() != null) {
+                CompanyUser companyUser = companyUserCacheService.selectCompanyUserById(fsCourseWatchLog.getCompanyUserId());
+                if (companyUser != null) {
+                    overVO.setUserName(companyUser.getUserName());
+                    overVO.setUserCreateTime(companyUser.getCreateTime());
+                }
+            }
+            fsCourseOverVOS.add(overVO);
+        }
+        return fsCourseOverVOS;
     }
 
+
     @Override
-    public void addCourseWatchLogDay() {
+    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
+    public void addCourseWatchLogDayNew() {
 
         List<FsUserCourse> courses = fsUserCourseMapper.selectFsUserCourseAllCourse();
         for (FsUserCourse course : courses) {
@@ -395,8 +553,21 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
             for (FsUserCourseVideo fsUserCourseVideo : fsUserCourseVideos) {
                 try {
                     ArrayList<QwWatchLog> QwWatchLogs = new ArrayList<>();
-                    List<FsQwCourseWatchLogVO> watchLogs = fsCourseWatchLogMapper.selectFsCourseWatchLogByNoDayAndVoidId(fsUserCourseVideo.getVideoId());
+                    List<FsQwCourseWatchLogVO> watchLogs = fsCourseWatchLogMapper.selectFsCourseBeforeMonthWatchLogByVideoId(fsUserCourseVideo.getVideoId());
+
                     for (FsQwCourseWatchLogVO fsCourseWatchLog : watchLogs) {
+
+                        // 获取进线时间
+                        FsUser fsUser = fsUserService.selectFsUserById(fsCourseWatchLog.getUserId());
+                        if (fsUser!=null){
+                            fsCourseWatchLog.setFirstTime(fsUser.getCreateTime());
+                        }
+                        // 查询首次观看时间
+                        Date date = fsCourseWatchLogMapper.queryFirstWatchDateLogByVideoId(fsCourseWatchLog.getUserId());
+                        if (date!=null){
+                            fsCourseWatchLog.setFirstTime(date);
+                        }
+
                         Date firstTime = fsCourseWatchLog.getFirstTime();
                         Long day=1L;
                         if (fsCourseWatchLog.getLineTime()==null){
@@ -410,18 +581,13 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
                         }else {
                             //是先导课
                             if (fsUserCourseVideo.getIsFirst()!=null&&fsUserCourseVideo.getIsFirst()==1){
-                                int count = qwWatchLogMapper.selectQwWatchLogIsFirst(fsCourseWatchLog.getQwExternalContactId());
+                                // 如果存在第一次记录就跳过
+                                int count = qwWatchLogMapper.selectQwWatchLogIsFirstByUserId(fsCourseWatchLog.getUserId());
                                 if (count>0){
                                     continue;
                                 }
                                 day=0L;
                                 //不是先导课
-                            }else {
-                                day=1L;
-                                QwExternalContact qwExternalContact = new QwExternalContact();
-                                qwExternalContact.setId(fsCourseWatchLog.getQwExternalContactId());
-                                qwExternalContact.setFirstTime(fsCourseWatchLog.getCreateTime());
-                                qwExternalContactMapper.updateQwExternalContact(qwExternalContact);
                             }
                         }
                         QwWatchLog qwWatchLog = new QwWatchLog();
@@ -432,6 +598,11 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
                         qwWatchLog.setStatus(fsCourseWatchLog.getLogType()==3?0:fsCourseWatchLog.getLogType()==2?2:1);
                         qwWatchLog.setProject(project);
                         qwWatchLog.setCreateTime(fsCourseWatchLog.getCreateTime());
+                        qwWatchLog.setCompanyId(fsCourseWatchLog.getCompanyId());
+                        qwWatchLog.setCompanyUserId(fsCourseWatchLog.getCompanyUserId());
+                        qwWatchLog.setFsUserId(fsCourseWatchLog.getUserId());
+                        qwWatchLog.setCourseId(fsCourseWatchLog.getCourseId());
+                        qwWatchLog.setVideoId(fsCourseWatchLog.getVideoId());
                         QwWatchLogs.add(qwWatchLog);
                     }
                     if (!QwWatchLogs.isEmpty()){
@@ -439,6 +610,7 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
                     }
                 }catch (Exception e){
                     log.error("看课记录add异常:{}",course.getCourseId(),e);
+                    throw new RuntimeException(e);
                 }
 
 
@@ -447,59 +619,67 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
 
 
     }
+
     @Override
-    public void addCourseWatchLogDay2() {
+    public void addCourseWatchLogDay() {
 
         List<FsUserCourse> courses = fsUserCourseMapper.selectFsUserCourseAllCourse();
         for (FsUserCourse course : courses) {
             Long project = course.getProject();
             List<FsUserCourseVideo> fsUserCourseVideos = fsUserCourseVideoMapper.selectVideoByCourseId(course.getCourseId());
             for (FsUserCourseVideo fsUserCourseVideo : fsUserCourseVideos) {
-                ArrayList<QwWatchLog> QwWatchLogs = new ArrayList<>();
-                List<FsQwCourseWatchLogVO> watchLogs = fsCourseWatchLogMapper.selectFsCourseWatchLogByNoDayAndVoidId2(fsUserCourseVideo.getVideoId());
-                for (FsQwCourseWatchLogVO fsCourseWatchLog : watchLogs) {
-                    Date firstTime = fsCourseWatchLog.getFirstTime();
-                    Long day=1L;
-                    if (fsCourseWatchLog.getLineTime()==null){
-                        continue;
-                    }
-                    //不是第一次 看课程
-                    if (firstTime!=null){
-                        LocalDate firstLocalDate = firstTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
-                        LocalDate currentDate = LocalDate.now();
-                        day = ChronoUnit.DAYS.between(firstLocalDate, currentDate);
-                        day=day-1;
-                    }else {
-                        //是先导课
-                        if (fsUserCourseVideo.getIsFirst()!=null&&fsUserCourseVideo.getIsFirst()==1){
-                            int count = qwWatchLogMapper.selectQwWatchLogIsFirst(fsCourseWatchLog.getQwExternalContactId());
-                            if (count>0){
-                                continue;
-                            }
-                            day=0L;
-                            //不是先导课
+                try {
+                    ArrayList<QwWatchLog> QwWatchLogs = new ArrayList<>();
+                    List<FsQwCourseWatchLogVO> watchLogs = fsCourseWatchLogMapper.selectFsCourseWatchLogByNoDayAndVoidId(fsUserCourseVideo.getVideoId());
+                    for (FsQwCourseWatchLogVO fsCourseWatchLog : watchLogs) {
+                        Date firstTime = fsCourseWatchLog.getFirstTime();
+                        Long day=1L;
+                        if (fsCourseWatchLog.getLineTime()==null){
+                            continue;
+                        }
+                        //不是第一次 看课程
+                        if (firstTime!=null){
+                            LocalDate firstLocalDate = firstTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
+                            LocalDate currentDate = LocalDate.now();
+                            day = ChronoUnit.DAYS.between(firstLocalDate, currentDate);
                         }else {
-                            day=1L;
-                            QwExternalContact qwExternalContact = new QwExternalContact();
-                            qwExternalContact.setId(fsCourseWatchLog.getQwExternalContactId());
-                            qwExternalContact.setFirstTime(fsCourseWatchLog.getCreateTime());
-                            qwExternalContactMapper.updateQwExternalContact(qwExternalContact);
+                            //是先导课
+                            if (fsUserCourseVideo.getIsFirst()!=null&&fsUserCourseVideo.getIsFirst()==1){
+                                int count = qwWatchLogMapper.selectQwWatchLogIsFirst(fsCourseWatchLog.getQwExternalContactId());
+                                if (count>0){
+                                    continue;
+                                }
+                                day=0L;
+                                //不是先导课
+                            }else {
+                                day=1L;
+                                QwExternalContact qwExternalContact = new QwExternalContact();
+                                qwExternalContact.setId(fsCourseWatchLog.getQwExternalContactId());
+                                qwExternalContact.setFirstTime(fsCourseWatchLog.getCreateTime());
+                                qwExternalContactMapper.updateQwExternalContact(qwExternalContact);
+                            }
                         }
+                        QwWatchLog qwWatchLog = new QwWatchLog();
+                        qwWatchLog.setExtId(fsCourseWatchLog.getQwExternalContactId());
+                        qwWatchLog.setLineTime(fsCourseWatchLog.getLineTime());
+                        qwWatchLog.setQwUserId(Long.parseLong(fsCourseWatchLog.getQwUserId()));
+                        qwWatchLog.setDay(day);
+                        qwWatchLog.setStatus(fsCourseWatchLog.getLogType()==3?0:fsCourseWatchLog.getLogType()==2?2:1);
+                        qwWatchLog.setProject(project);
+                        qwWatchLog.setCreateTime(fsCourseWatchLog.getCreateTime());
+                        qwWatchLog.setCompanyId(fsCourseWatchLog.getCompanyId());
+                        qwWatchLog.setCompanyUserId(fsCourseWatchLog.getCompanyUserId());
+                        qwWatchLog.setFsUserId(fsCourseWatchLog.getUserId());
+                        QwWatchLogs.add(qwWatchLog);
                     }
-                    QwWatchLog qwWatchLog = new QwWatchLog();
-                    qwWatchLog.setExtId(fsCourseWatchLog.getQwExternalContactId());
-                    qwWatchLog.setLineTime(fsCourseWatchLog.getLineTime());
-                    qwWatchLog.setQwUserId(Long.parseLong(fsCourseWatchLog.getQwUserId()));
-                    qwWatchLog.setDay(day);
-                    qwWatchLog.setStatus(fsCourseWatchLog.getLogType()==3?0:fsCourseWatchLog.getLogType()==2?2:1);
-                    qwWatchLog.setProject(project);
-                    qwWatchLog.setCreateTime(fsCourseWatchLog.getCreateTime());
-                    QwWatchLogs.add(qwWatchLog);
-                }
-                if (!QwWatchLogs.isEmpty()){
-                    qwWatchLogMapper.insertQwWatchLogBatch(QwWatchLogs);
+                    if (!QwWatchLogs.isEmpty()){
+                        qwWatchLogMapper.insertQwWatchLogBatch(QwWatchLogs);
+                    }
+                }catch (Exception e){
+                    log.error("看课记录add异常:{}",course.getCourseId(),e);
                 }
 
+
             }
         }
 

+ 17 - 4
fs-service-system/src/main/java/com/fs/course/vo/FsCourseAnswerLogsListVO.java

@@ -3,6 +3,8 @@ package com.fs.course.vo;
 import com.fs.common.annotation.Excel;
 import lombok.Data;
 
+import java.util.Date;
+
 @Data
 public class FsCourseAnswerLogsListVO {
 
@@ -16,7 +18,7 @@ public class FsCourseAnswerLogsListVO {
     /**
     * 小程序用户名
     */
-    @Excel(name = "小程序用户")
+    @Excel(name = "用户")
     private String userName;
     private String fsAvatar;
     /**
@@ -35,13 +37,14 @@ public class FsCourseAnswerLogsListVO {
     /**
     * 视频名称
     */
-    @Excel(name = "视频名称")
+    @Excel(name = "视频名称",width = 70)
     private String videoName;
     /**
     * 是否全部正确 0否 1是
     */
-    @Excel(name = "是否全部正确 0否 1是")
     private Integer isRight;
+    @Excel(name = "是否全部正确")
+    private String isRightText;
     /**
     * 创建时间
     */
@@ -72,9 +75,19 @@ public class FsCourseAnswerLogsListVO {
     /**
     * 企业微信员工名称
     */
-    @Excel(name = "企业微信员工名称")
     private String qwUserName;
     private String answer;
     private String questionTitle;
     private String questionJson;
+    /**
+     * 项目
+     */
+    private String project;
+    /**
+     * 项目名称
+     */
+    private String projectName;
+
+    private Date sTime;
+    private Date eTime;
 }

+ 6 - 4
fs-service-system/src/main/java/com/fs/course/vo/FsCourseOverVO.java

@@ -10,10 +10,12 @@ import java.util.Date;
 public class FsCourseOverVO {
 
 
-    @Excel(name = "企微客户")
-    private String qwUserName;
-    @Excel(name = "企业微信员工名称")
-    private String externalUserName;
+//    @Excel(name = "企微客户")
+//    private String qwUserName;
+//    @Excel(name = "企业微信员工名称")
+//    private String externalUserName;
+    @Excel(name = "用户名")
+    private String userName;
 
     @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     @JsonFormat(pattern = "yyyy-MM-dd")

+ 13 - 1
fs-service-system/src/main/java/com/fs/course/vo/FsCourseWatchLogListVO.java

@@ -21,14 +21,22 @@ public class FsCourseWatchLogListVO extends BaseEntity
     @Excel(name = "记录编号")
     private Long logId;
 
-    @Excel(name = "会员id")
     private Long userId;
 
+    @Excel(name = "会员名称")
+    private String userName;
+
     @Excel(name = "小程序昵称")
     private String fsNickName;
 
     @Excel(name = "小程序头像")
     private String fsAvatar;
+    /**
+     * 项目
+     */
+    private Integer project;
+    @Excel(name = "项目名称")
+    private String projectName;
 
     @Excel(name = "课程名称")
     private String courseName;
@@ -93,4 +101,8 @@ public class FsCourseWatchLogListVO extends BaseEntity
     @Excel(name = "外部联系人名称")
     private String externalUserName; //外部联系人名称
 
+    private Long companyUserId;
+    private Long courseId;
+    private Long videoId;
+
 }

+ 16 - 2
fs-service-system/src/main/java/com/fs/course/vo/FsCourseWatchLogStatisticsListVO.java

@@ -10,9 +10,15 @@ import java.util.Date;
 public class FsCourseWatchLogStatisticsListVO {
 
 
+    private Integer project;
+    @Excel(name = "项目名称")
+    private String projectName;
+
+    private Long courseId;
     @Excel(name = "课程名称")
     private String courseName;
 
+    private Long videoId;
     @Excel(name = "小节名称")
     private String videoName;
 
@@ -24,10 +30,18 @@ public class FsCourseWatchLogStatisticsListVO {
     private String type3;
     @Excel(name = "看课中断")
     private String type4;
-    @Excel(name = "企业微信员工名称")
-    private String qwUserName;
+//    @Excel(name = "企业微信员工名称")
+//    private String qwUserName;
+
+    private Long userId;
+    @Excel(name = "员工名称")
+    private String userName;
 
     @Excel(name = "创建时间")
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date createTime;
+
+    private Long companyUserId;
+    @Excel(name = "销售名称")
+    private String companyUserName;
 }

+ 95 - 0
fs-service-system/src/main/java/com/fs/qw/domain/QwExternalContactBlackLog.java

@@ -0,0 +1,95 @@
+package com.fs.qw.domain;
+
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 企业微信客户拉黑操作记录对象 qw_external_contact_black_log
+ *
+ * @author fs.qw
+ * @date 2025-03-31
+ */
+public class QwExternalContactBlackLog extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    @Excel(name = "id")
+    private Long id;
+
+    /** 外部联系人id */
+    @Excel(name = "外部联系人id")
+    private String externalUserId;
+
+    /** 员工id */
+    @Excel(name = "员工id")
+    private Long companyUserId;
+
+    /** 拉黑时的状态 */
+    @Excel(name = "拉黑时的状态")
+    private Integer status;
+
+    /** 拉黑后的状态 */
+    @Excel(name = "拉黑后的状态")
+    private Integer blackStatus;
+
+    public void setId(Long id)
+    {
+        this.id = id;
+    }
+
+    public Long getId()
+    {
+        return id;
+    }
+    public void setExternalUserId(String externalUserId)
+    {
+        this.externalUserId = externalUserId;
+    }
+
+    public String getExternalUserId()
+    {
+        return externalUserId;
+    }
+    public void setCompanyUserId(Long companyUserId)
+    {
+        this.companyUserId = companyUserId;
+    }
+
+    public Long getCompanyUserId()
+    {
+        return companyUserId;
+    }
+    public void setStatus(Integer status)
+    {
+        this.status = status;
+    }
+
+    public Integer getStatus()
+    {
+        return status;
+    }
+    public void setBlackStatus(Integer blackStatus)
+    {
+        this.blackStatus = blackStatus;
+    }
+
+    public Integer getBlackStatus()
+    {
+        return blackStatus;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("externalUserId", getExternalUserId())
+            .append("companyUserId", getCompanyUserId())
+            .append("createTime", getCreateTime())
+            .append("status", getStatus())
+            .append("blackStatus", getBlackStatus())
+            .toString();
+    }
+}

+ 7 - 0
fs-service-system/src/main/java/com/fs/qw/domain/QwFriendWelcome.java

@@ -57,4 +57,11 @@ public class QwFriendWelcome extends BaseEntity
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updateTime;
 
+    /**
+     * 项目
+     */
+    private Integer project;
+    @Excel(name = "项目")
+    private String projectName;
+
 }

+ 6 - 0
fs-service-system/src/main/java/com/fs/qw/domain/QwWatchLog.java

@@ -44,4 +44,10 @@ public class QwWatchLog extends BaseEntity{
     private Date createTime;
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date lineTime;
+    private Long fsUserId;
+    private Long companyId;
+    private Long companyUserId;
+
+    private Long courseId;
+    private Long videoId;
 }

+ 76 - 0
fs-service-system/src/main/java/com/fs/qw/mapper/QwExternalContactBlackLogMapper.java

@@ -0,0 +1,76 @@
+package com.fs.qw.mapper;
+
+import java.util.List;
+import com.fs.qw.domain.QwExternalContactBlackLog;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 企业微信客户拉黑操作记录Mapper接口
+ *
+ * @author fs.qw
+ * @date 2025-03-31
+ */
+public interface QwExternalContactBlackLogMapper
+{
+    /**
+     * 查询企业微信客户拉黑操作记录
+     *
+     * @param id 企业微信客户拉黑操作记录ID
+     * @return 企业微信客户拉黑操作记录
+     */
+    public QwExternalContactBlackLog selectQwExternalContactBlackLogById(Long id);
+
+    /**
+     * 查询企业微信客户拉黑操作记录列表
+     *
+     * @param qwExternalContactBlackLog 企业微信客户拉黑操作记录
+     * @return 企业微信客户拉黑操作记录集合
+     */
+    public List<QwExternalContactBlackLog> selectQwExternalContactBlackLogList(QwExternalContactBlackLog qwExternalContactBlackLog);
+
+    /**
+     * 新增企业微信客户拉黑操作记录
+     *
+     * @param qwExternalContactBlackLog 企业微信客户拉黑操作记录
+     * @return 结果
+     */
+    public int insertQwExternalContactBlackLog(QwExternalContactBlackLog qwExternalContactBlackLog);
+
+    /**
+     * 修改企业微信客户拉黑操作记录
+     *
+     * @param qwExternalContactBlackLog 企业微信客户拉黑操作记录
+     * @return 结果
+     */
+    public int updateQwExternalContactBlackLog(QwExternalContactBlackLog qwExternalContactBlackLog);
+
+    /**
+     * 删除企业微信客户拉黑操作记录
+     *
+     * @param id 企业微信客户拉黑操作记录ID
+     * @return 结果
+     */
+    public int deleteQwExternalContactBlackLogById(Long id);
+
+    /**
+     * 批量删除企业微信客户拉黑操作记录
+     *
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteQwExternalContactBlackLogByIds(Long[] ids);
+
+    /**
+     * 新增拉黑操作通过查询到的外部联系人信息
+     * @param ids 外部联系人ids
+     * @return
+     */
+    int insertLogBySelectExternalContact(@Param("ids") List<String> ids);
+
+    /**
+     * 批量查询拉黑操作
+     * @param ids
+     * @return
+     */
+    List<QwExternalContactBlackLog> selectContactLogByIds(@Param("ids") List<String> ids);
+}

+ 2 - 0
fs-service-system/src/main/java/com/fs/qw/mapper/QwExternalContactMapper.java

@@ -370,4 +370,6 @@ public interface QwExternalContactMapper extends BaseMapper<QwExternalContact> {
     List<QwExternalContact> selectContactByIds(@Param("ids") List<String> ids);
 
     int updateContactByIds(@Param("ids") List<String> ids,@Param("status") Integer status);
+
+    int batchUpdateContactByIds(@Param("list") List<Map<Long, Integer>> list);
 }

+ 1 - 0
fs-service-system/src/main/java/com/fs/qw/mapper/QwFriendWelcomeMapper.java

@@ -67,6 +67,7 @@ public interface QwFriendWelcomeMapper
             "            <if test=\"createTime != null \"> and qfw.create_time = #{createTime}</if>\n" +
             "            <if test=\"updateTime != null \"> and qfw.update_time = #{updateTime}</if>\n" +
             "            <if test=\"companyUserId != null \"> and qu.company_user_id = #{companyUserId}</if>\n" +
+            " <if test=\"project != null \"> and project = #{project}</if> "+
             "        </where>" +
             "</script>")
     public List<QwFriendWelcome> selectQwFriendWelcomeListMyVO(QwFriendWelcomeParam qwFriendWelcomeParam);

+ 1 - 1
fs-service-system/src/main/java/com/fs/qw/mapper/QwTagMapper.java

@@ -82,5 +82,5 @@ public interface QwTagMapper
     @Select("select * from qw_tag where name=#{trimTag} and corp_id=#{corpId} limit 1" )
     QwTagVO selectQwTagByName(@Param("trimTag") String trimTag, @Param("corpId")String corpId );
 
-    List<QwTagVO> selectTagListByUserId(ContactTagListParam param);
+    List<QwTagVO> selectTagListByUserId(@Param("param") ContactTagListParam param,  @Param("keywords") String[] keywords);
 }

+ 20 - 0
fs-service-system/src/main/java/com/fs/qw/mapper/QwWatchLogMapper.java

@@ -104,8 +104,22 @@ public interface QwWatchLogMapper extends BaseMapper<QwWatchLog>{
             "COUNT(CASE WHEN day = 1 and status=2 THEN 1 END) AS d1Over\n" +
             " from qw_watch_log where qw_user_id=#{id} and DATE(line_time) = DATE(#{createTime})")
     QwWatchLogStatisticsListVO selectQwWatchLogByQwUserId(@Param("id")Long id,@Param("createTime") Date createTime);
+
+    List<QwWatchLogStatisticsListVO> selectQwWatchLogByCompanyUserId(@Param("companyUserId") Long companyUserId,
+                                                                     @Param("sTime") Date sTime,
+                                                                     @Param("dTime") Date dTime,
+                                                                     @Param("project") Long project,
+                                                                     @Param("courseId") Long courseId,
+                                                                     @Param("videoId") Long videoId
+    );
+
+
     @Select("SELECT count(1) from qw_watch_log where ext_id=#{id} and `day`=0 ")
     int selectQwWatchLogIsFirst(Long id);
+
+    @Select("SELECT count(1) from qw_watch_log where fs_user_id=#{userId} and `day`=0")
+    int selectQwWatchLogIsFirstByUserId(Long userId);
+
     @Select("select \n" +
             "COUNT(CASE WHEN day = 0 and status in (1,2) THEN 1 END) AS firstOnline,\n" +
             "COUNT(CASE WHEN day = 0 and status=2 THEN 1 END) AS firstOver,\n" +
@@ -171,6 +185,12 @@ public interface QwWatchLogMapper extends BaseMapper<QwWatchLog>{
             "COUNT(CASE WHEN day = 30 and status=2 THEN 1 END) AS d30Over" +
             " from qw_watch_log where qw_user_id=#{id} and DATE(line_time) = DATE(#{createTime})")
     QwWatchLogAllStatisticsListVO selectQwWatchLogAllStatisticsListVO(@Param("id")Long id,@Param("createTime") Date createTime);
+
+
+    List<QwWatchLogAllStatisticsListVO> selectQwWatchLogAllStatisticsListVONew(@Param("companyUserId")Long companyUserId, @Param("sDate") Date sDate, @Param("eDate") Date eDate,
+                                                                               @Param("project") Long project,
+                                                                               @Param("courseId") Long courseId,
+                                                                               @Param("videoId") Long videoId);
     @Select({"<script> " +
             "SELECT\n" +
             "    qec.qw_user_id id,\n" +

+ 18 - 0
fs-service-system/src/main/java/com/fs/qw/mapper/QwWorkTaskMapper.java

@@ -1,5 +1,7 @@
 package com.fs.qw.mapper;
 
+import java.util.ArrayList;
+import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.qw.domain.QwWorkTask;
 import com.fs.qw.param.QwWorkTaskListParam;
@@ -82,6 +84,8 @@ public interface QwWorkTaskMapper extends BaseMapper<QwWorkTask>{
             "order by t.score desc,t.id desc "+
             "</script>"})
     List<QwWorkTaskListVO> selectQwWorkTaskListVO(QwWorkTaskListParam qwWorkTask);
+    List<QwWorkTaskListVO> selectQwWorkTaskListVONew(QwWorkTaskListParam qwWorkTask);
+
     @Select("select ext_id from qw_work_task where type=2 and DATE(create_time) = CURDATE() ")
     List<Long> selectQwWorkTaskByType();
 
@@ -98,4 +102,18 @@ public interface QwWorkTaskMapper extends BaseMapper<QwWorkTask>{
             "</script>"
     })
     void updateQwWorkTaskStatus(@Param("overIds")List<Long> overIds);
+
+    @Select("select id,ext_id from qw_work_task where type=2 and status=1 and DATE(create_time) = CURDATE() ")
+    List<QwWorkTask> selectQwWorkTaskByTypeStatus1();
+    @Update({
+            "<script>",
+            "UPDATE qw_work_task",
+            "SET status = 3",
+            "WHERE id IN",
+            "<foreach item='id' collection='overIds' open='(' separator=',' close=')'>",
+            "   #{id}",
+            "</foreach>",
+            "</script>"
+    })
+    void updateQwWorkTaskStatus1(List<Long> overIds1);
 }

+ 5 - 0
fs-service-system/src/main/java/com/fs/qw/param/QwFriendWelcomeParam.java

@@ -54,4 +54,9 @@ public class QwFriendWelcomeParam extends BaseEntity {
     @Excel(name = "公司员工id")
     private Long companyUserId;
 
+    /**
+     * 项目
+     */
+    private Integer project;
+
 }

+ 3 - 0
fs-service-system/src/main/java/com/fs/qw/param/QwWatchLogStatisticsListParam.java

@@ -17,4 +17,7 @@ public class QwWatchLogStatisticsListParam {
     private Long companyUserId;
     private Long id;
     private String ids;
+    private Long project;
+    private Long courseId;
+    private Long videoId;
 }

+ 3 - 0
fs-service-system/src/main/java/com/fs/qw/param/newparam/ContactTagListParam.java

@@ -19,5 +19,8 @@ public class ContactTagListParam implements Serializable {
     @ApiModelProperty(value = "用户id,不用传")
     private Long userId;
 
+    @ApiModelProperty(value = "模糊搜索名称,多个用逗号隔开")
+    private String keyword;
+
 }
 

+ 61 - 0
fs-service-system/src/main/java/com/fs/qw/service/IQwExternalContactBlackLogService.java

@@ -0,0 +1,61 @@
+package com.fs.qw.service;
+
+import java.util.List;
+import com.fs.qw.domain.QwExternalContactBlackLog;
+
+/**
+ * 企业微信客户拉黑操作记录Service接口
+ * 
+ * @author fs.qw
+ * @date 2025-03-31
+ */
+public interface IQwExternalContactBlackLogService 
+{
+    /**
+     * 查询企业微信客户拉黑操作记录
+     * 
+     * @param id 企业微信客户拉黑操作记录ID
+     * @return 企业微信客户拉黑操作记录
+     */
+    public QwExternalContactBlackLog selectQwExternalContactBlackLogById(Long id);
+
+    /**
+     * 查询企业微信客户拉黑操作记录列表
+     * 
+     * @param qwExternalContactBlackLog 企业微信客户拉黑操作记录
+     * @return 企业微信客户拉黑操作记录集合
+     */
+    public List<QwExternalContactBlackLog> selectQwExternalContactBlackLogList(QwExternalContactBlackLog qwExternalContactBlackLog);
+
+    /**
+     * 新增企业微信客户拉黑操作记录
+     * 
+     * @param qwExternalContactBlackLog 企业微信客户拉黑操作记录
+     * @return 结果
+     */
+    public int insertQwExternalContactBlackLog(QwExternalContactBlackLog qwExternalContactBlackLog);
+
+    /**
+     * 修改企业微信客户拉黑操作记录
+     * 
+     * @param qwExternalContactBlackLog 企业微信客户拉黑操作记录
+     * @return 结果
+     */
+    public int updateQwExternalContactBlackLog(QwExternalContactBlackLog qwExternalContactBlackLog);
+
+    /**
+     * 批量删除企业微信客户拉黑操作记录
+     * 
+     * @param ids 需要删除的企业微信客户拉黑操作记录ID
+     * @return 结果
+     */
+    public int deleteQwExternalContactBlackLogByIds(Long[] ids);
+
+    /**
+     * 删除企业微信客户拉黑操作记录信息
+     * 
+     * @param id 企业微信客户拉黑操作记录ID
+     * @return 结果
+     */
+    public int deleteQwExternalContactBlackLogById(Long id);
+}

+ 1 - 1
fs-service-system/src/main/java/com/fs/qw/service/IQwExternalContactService.java

@@ -195,6 +195,6 @@ public interface IQwExternalContactService extends IService<QwExternalContact> {
      * @param ids id数组
      * @return 是否成功
      */
-    Boolean disabledUser(String[] ids);
+    Boolean disabledUser(String[] ids, boolean status);
 
 }

+ 2 - 0
fs-service-system/src/main/java/com/fs/qw/service/IQwWatchLogService.java

@@ -64,6 +64,8 @@ public interface IQwWatchLogService extends IService<QwWatchLog>{
     int deleteQwWatchLogById(Long id);
 
     List<QwWatchLogStatisticsListVO> selectQwWatchLogStatisticsListVO(QwWatchLogStatisticsListParam param);
+    List<QwWatchLogStatisticsListVO> selectQwWatchLogStatisticsListVONew(QwWatchLogStatisticsListParam param);
 
     List<QwWatchLogAllStatisticsListVO> selectQwWatchLogAllStatisticsListVO(QwWatchLogStatisticsListParam param);
+    List<QwWatchLogAllStatisticsListVO> selectQwWatchLogAllStatisticsListVONew(QwWatchLogStatisticsListParam param);
 }

+ 25 - 3
fs-service-system/src/main/java/com/fs/qw/service/IQwWorkTaskService.java

@@ -61,20 +61,42 @@ public interface IQwWorkTaskService extends IService<QwWorkTask>{
      * @return 结果
      */
     int deleteQwWorkTaskById(Long id);
-
+    /**
+     * 根据用户首次上课情况,添加相应的企微任务。
+     * 用于处理首次课程触发的任务创建逻辑。
+     */
     void addQwWorkByFirstCourse();
 
-
+    /**
+     * 根据用户上课情况(通用逻辑),添加相应的企微任务。
+     * 用于处理一般课程事件触发的任务创建逻辑。
+     */
     void addQwWorkByCourse();
 
+    /**
+     * 根据转化日(或特定业务日期节点)情况,添加相应的企微任务。
+     * 用于处理基于特定日期或转化阶段的任务创建逻辑。
+     */
     void addQwWorkByConversionDay();
 
     List<QwWorkTaskListVO> selectQwWorkTaskListVO(QwWorkTaskListParam qwWorkTask);
+    List<QwWorkTaskListVO> selectQwWorkTaskListVONew(QwWorkTaskListParam qwWorkTask);
 
+    /**
+     * 根据特定课程逻辑(可能与课程编号4或第四阶段相关)添加企微任务。
+     * 用于处理与特定课程标识(如'4')相关的任务创建逻辑。
+     */
     void addQwWorkByCourse4();
 
+    /**
+     * 删除已完成、过期或不再需要的企微任务。
+     * 用于定期清理或处理生命周期结束的任务。
+     */
     void delQwWorkTaskByOver();
-
+    /**
+     * 根据用户最后一次上课时间或课程结束时间情况,添加相应的企微任务。
+     * 用于处理基于课程结束或最后活动时间的任务创建逻辑。
+     */
     void addQwWorkByCourseLastTime();
 
 }

+ 95 - 0
fs-service-system/src/main/java/com/fs/qw/service/impl/QwExternalContactBlackLogServiceImpl.java

@@ -0,0 +1,95 @@
+package com.fs.qw.service.impl;
+
+import java.util.List;
+import com.fs.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.fs.qw.mapper.QwExternalContactBlackLogMapper;
+import com.fs.qw.domain.QwExternalContactBlackLog;
+import com.fs.qw.service.IQwExternalContactBlackLogService;
+
+/**
+ * 企业微信客户拉黑操作记录Service业务层处理
+ * 
+ * @author fs.qw
+ * @date 2025-03-31
+ */
+@Service
+public class QwExternalContactBlackLogServiceImpl implements IQwExternalContactBlackLogService 
+{
+    @Autowired
+    private QwExternalContactBlackLogMapper qwExternalContactBlackLogMapper;
+
+    /**
+     * 查询企业微信客户拉黑操作记录
+     * 
+     * @param id 企业微信客户拉黑操作记录ID
+     * @return 企业微信客户拉黑操作记录
+     */
+    @Override
+    public QwExternalContactBlackLog selectQwExternalContactBlackLogById(Long id)
+    {
+        return qwExternalContactBlackLogMapper.selectQwExternalContactBlackLogById(id);
+    }
+
+    /**
+     * 查询企业微信客户拉黑操作记录列表
+     * 
+     * @param qwExternalContactBlackLog 企业微信客户拉黑操作记录
+     * @return 企业微信客户拉黑操作记录
+     */
+    @Override
+    public List<QwExternalContactBlackLog> selectQwExternalContactBlackLogList(QwExternalContactBlackLog qwExternalContactBlackLog)
+    {
+        return qwExternalContactBlackLogMapper.selectQwExternalContactBlackLogList(qwExternalContactBlackLog);
+    }
+
+    /**
+     * 新增企业微信客户拉黑操作记录
+     * 
+     * @param qwExternalContactBlackLog 企业微信客户拉黑操作记录
+     * @return 结果
+     */
+    @Override
+    public int insertQwExternalContactBlackLog(QwExternalContactBlackLog qwExternalContactBlackLog)
+    {
+        qwExternalContactBlackLog.setCreateTime(DateUtils.getNowDate());
+        return qwExternalContactBlackLogMapper.insertQwExternalContactBlackLog(qwExternalContactBlackLog);
+    }
+
+    /**
+     * 修改企业微信客户拉黑操作记录
+     * 
+     * @param qwExternalContactBlackLog 企业微信客户拉黑操作记录
+     * @return 结果
+     */
+    @Override
+    public int updateQwExternalContactBlackLog(QwExternalContactBlackLog qwExternalContactBlackLog)
+    {
+        return qwExternalContactBlackLogMapper.updateQwExternalContactBlackLog(qwExternalContactBlackLog);
+    }
+
+    /**
+     * 批量删除企业微信客户拉黑操作记录
+     * 
+     * @param ids 需要删除的企业微信客户拉黑操作记录ID
+     * @return 结果
+     */
+    @Override
+    public int deleteQwExternalContactBlackLogByIds(Long[] ids)
+    {
+        return qwExternalContactBlackLogMapper.deleteQwExternalContactBlackLogByIds(ids);
+    }
+
+    /**
+     * 删除企业微信客户拉黑操作记录信息
+     * 
+     * @param id 企业微信客户拉黑操作记录ID
+     * @return 结果
+     */
+    @Override
+    public int deleteQwExternalContactBlackLogById(Long id)
+    {
+        return qwExternalContactBlackLogMapper.deleteQwExternalContactBlackLogById(id);
+    }
+}

+ 25 - 2
fs-service-system/src/main/java/com/fs/qw/service/impl/QwExternalContactServiceImpl.java

@@ -92,6 +92,10 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
     @Autowired
     private QwExternalContactMapper qwExternalContactMapper;
     @Autowired
+    private QwExternalContactBlackLogMapper qwExternalContactBlackLogMapper;
+    @Autowired
+    private IQwExternalContactBlackLogService qwExternalContactBlackLogService;
+    @Autowired
     private IQwTagService iQwTagService;
     @Autowired
     ICompanyConfigService companyConfigService;
@@ -4397,9 +4401,28 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
 
     @Override
     @Transactional(rollbackFor = {Exception.class})
-    public Boolean disabledUser(String[] ids) {
+    public Boolean disabledUser(String[] ids, boolean status) {
         // 不能使用自带的方法,只能写sql,额。。。。
-        int result = qwExternalContactMapper.updateContactByIds(Arrays.asList(ids), 7);
+        int result = 0;
+        if(status){
+            //取消禁用操作
+            //查询禁用前的状态
+            List<QwExternalContactBlackLog> qwExternalContactBlackLogs = qwExternalContactBlackLogMapper.selectContactLogByIds(Arrays.asList(ids));
+            if(qwExternalContactBlackLogs != null && !qwExternalContactBlackLogs.isEmpty()){
+                List<Map<Long,Integer>> list = new ArrayList<>();
+                qwExternalContactBlackLogs.forEach(i -> {
+                    Map<Long,Integer> map = new HashMap<>();
+                    map.put( i.getId(), i.getStatus());
+                    list.add(map);
+                });
+                result = qwExternalContactMapper.batchUpdateContactByIds(list);
+            }
+        }else {
+            //禁用
+            //将禁用时的状态写入到记录表中
+            qwExternalContactBlackLogMapper.insertLogBySelectExternalContact(Arrays.asList(ids));
+            result = qwExternalContactMapper.updateContactByIds(Arrays.asList(ids), 7);
+        }
         return result > 0;
     }
 

+ 16 - 1
fs-service-system/src/main/java/com/fs/qw/service/impl/QwFriendWelcomeServiceImpl.java

@@ -1,7 +1,9 @@
 package com.fs.qw.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.fs.common.core.domain.R;
+import com.fs.common.utils.DictUtils;
 import com.fs.qw.domain.QwFriendWelcome;
 import com.fs.qw.mapper.QwFriendWelcomeItemMapper;
 import com.fs.qw.mapper.QwFriendWelcomeMapper;
@@ -15,6 +17,8 @@ import com.fs.qwApi.Result.QwUploadImgResult;
 import com.fs.qwApi.param.SendWelcomeMsgParam;
 import com.fs.qwApi.service.QwApiService;
 import com.fs.voice.utils.StringUtil;
+import com.hc.openapi.tool.util.StringUtils;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
@@ -35,6 +39,7 @@ import java.util.List;
  * @date 2024-07-20
  */
 @Service
+@Slf4j
 public class QwFriendWelcomeServiceImpl implements IQwFriendWelcomeService
 {
     @Autowired
@@ -59,6 +64,7 @@ public class QwFriendWelcomeServiceImpl implements IQwFriendWelcomeService
     public QwFriendWelcomeVO selectQwFriendWelcomeById(Long id)
     {
         QwFriendWelcomeVO qwFriendWelcomeVO = qwFriendWelcomeMapper.selectQwFriendWelcomeByIdVO(id);
+        log.info("qwFriendWelcomeVO:{}",qwFriendWelcomeVO);
 
         // 假设 qwFriendWelcomeVO 是已经初始化的对象
         String qwUserIds = qwFriendWelcomeVO.getQwUserIds();
@@ -84,7 +90,16 @@ public class QwFriendWelcomeServiceImpl implements IQwFriendWelcomeService
     @Override
     public List<QwFriendWelcome> selectQwFriendWelcomeListVO(QwFriendWelcomeParam qwFriendWelcomeParam)
     {
-        return qwFriendWelcomeMapper.selectQwFriendWelcomeListVO(qwFriendWelcomeParam);
+        List<QwFriendWelcome> qwFriendWelcomes = qwFriendWelcomeMapper.selectQwFriendWelcomeListVO(qwFriendWelcomeParam);
+        for (QwFriendWelcome qwFriendWelcome : qwFriendWelcomes) {
+            if(ObjectUtils.isNotNull(qwFriendWelcome.getProject())){
+                String sysCourseProject = DictUtils.getDictLabel("sys_course_project", String.valueOf(qwFriendWelcome.getProject()));
+                if(StringUtils.isNotBlank(sysCourseProject)){
+                    qwFriendWelcome.setProjectName(sysCourseProject);
+                }
+            }
+        }
+        return qwFriendWelcomes;
     }
 
     @Override

+ 8 - 1
fs-service-system/src/main/java/com/fs/qw/service/impl/QwTagServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fs.qw.service.impl;
 
 import com.fs.common.utils.DateUtils;
+import com.fs.common.utils.StringUtils;
 import com.fs.qw.domain.QwExternalContact;
 import com.fs.qw.domain.QwTag;
 import com.fs.qw.domain.QwUser;
@@ -195,6 +196,12 @@ public class QwTagServiceImpl implements IQwTagService
 
     @Override
     public List<QwTagVO> getTagListByUserId(ContactTagListParam param) {
-        return qwTagMapper.selectTagListByUserId(param);
+        String[] keywords = new String[0];
+        if(param != null){
+            if(StringUtils.isNotEmpty(param.getKeyword())){
+               keywords = param.getKeyword().split(",");
+            }
+        }
+        return qwTagMapper.selectTagListByUserId(param, keywords);
     }
 }

+ 95 - 12
fs-service-system/src/main/java/com/fs/qw/service/impl/QwWatchLogServiceImpl.java

@@ -1,8 +1,14 @@
 package com.fs.qw.service.impl;
 
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.common.utils.DateUtils;
+import com.fs.common.utils.DictUtils;
+import com.fs.company.domain.CompanyUser;
 import com.fs.company.mapper.CompanyUserMapper;
+import com.fs.course.domain.FsUserCourse;
+import com.fs.course.domain.FsUserCourseVideo;
+import com.fs.course.service.cache.IFsUserCourseVideoCacheService;
 import com.fs.qw.domain.QwWatchLog;
 import com.fs.qw.mapper.QwExternalContactMapper;
 import com.fs.qw.mapper.QwUserMapper;
@@ -11,13 +17,12 @@ import com.fs.qw.param.QwWatchLogStatisticsListParam;
 import com.fs.qw.service.IQwWatchLogService;
 import com.fs.qw.vo.QwWatchLogAllStatisticsListVO;
 import com.fs.qw.vo.QwWatchLogStatisticsListVO;
+import com.fs.store.service.cache.IFsUserCourseCacheService;
+import com.hc.openapi.tool.util.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 /**
  * 企微看课Service业务层处理
@@ -27,21 +32,25 @@ import java.util.List;
  */
 @Service
 public class QwWatchLogServiceImpl extends ServiceImpl<QwWatchLogMapper, QwWatchLog> implements IQwWatchLogService {
-    @Autowired
-    private QwUserMapper qwUserMapper;
+
     @Autowired
     private QwWatchLogMapper qwWatchLogMapper;
-    @Autowired
-    private QwExternalContactMapper qwExternalContactMapper;
+
     @Autowired
     private CompanyUserMapper companyUserMapper;
+
+    @Autowired
+    private IFsUserCourseCacheService fsUserCourseCacheService;
+
+    @Autowired
+    private IFsUserCourseVideoCacheService fsUserCourseVideoCacheService;
     /**
      * 查询企微看课
      *
      * @param id 企微看课主键
      * @return 企微看课
      */
-    @Override
+     @Override
     public QwWatchLog selectQwWatchLogById(Long id)
     {
         return baseMapper.selectQwWatchLogById(id);
@@ -131,11 +140,46 @@ public class QwWatchLogServiceImpl extends ServiceImpl<QwWatchLogMapper, QwWatch
             vo.setFirstOver(stat.getFirstOver());
         }
 
+        return vos;
+    }
 
+    @Override
+    public List<QwWatchLogStatisticsListVO> selectQwWatchLogStatisticsListVONew(QwWatchLogStatisticsListParam param) {
+        // 获取当前公司下的所有销售
+        List<CompanyUser> companyUsers = companyUserMapper.selectCompanyUserByCompanyId(param.getCompanyId());
 
-
-
-        return vos;
+        List<QwWatchLogStatisticsListVO> list = new ArrayList<>();
+        for (CompanyUser companyUser : companyUsers) {
+            // 统计销售下面的所有记录
+            List<QwWatchLogStatisticsListVO> vos = qwWatchLogMapper.selectQwWatchLogByCompanyUserId(companyUser.getCompanyId(),
+                    param.getSTime(),param.getETime(),param.getProject(),param.getCourseId(),param.getVideoId());
+            for (QwWatchLogStatisticsListVO item : vos) {
+                item.setCompanyUserName(String.format("%s_%d",companyUser.getUserName(),companyUser.getUserId()));
+                item.setCreateTime(companyUser.getCreateTime());
+                if(ObjectUtils.isNotNull(item.getProject())){
+                    String sysCourseProject = DictUtils.getDictLabel("sys_course_project", String.valueOf(item.getProject()));
+                    if(StringUtils.isNotBlank(sysCourseProject)){
+                        item.setProjectName(sysCourseProject);
+                    }
+                }
+                // 课程名
+                if(ObjectUtils.isNotNull(item.getCourseId())) {
+                    FsUserCourse course = fsUserCourseCacheService.selectFsUserCourseByCourseId(item.getCourseId());
+                    if(ObjectUtils.isNotNull(course)){
+                        item.setCourseName(course.getCourseName());
+                    }
+                }
+                // 小节名
+                if(ObjectUtils.isNotNull(item.getVideoId())) {
+                    FsUserCourseVideo fsUserCourseVideo = fsUserCourseVideoCacheService.selectFsUserCourseVideoByVideoId(item.getVideoId());
+                    if(ObjectUtils.isNotNull(fsUserCourseVideo)){
+                        item.setVideoName(fsUserCourseVideo.getTitle());
+                    }
+                }
+                list.add(item);
+            }
+        }
+        return list;
     }
 
     @Override
@@ -161,9 +205,48 @@ public class QwWatchLogServiceImpl extends ServiceImpl<QwWatchLogMapper, QwWatch
             list.add(stat);
         }
 
+        return list;
+    }
 
+    @Override
+    public List<QwWatchLogAllStatisticsListVO> selectQwWatchLogAllStatisticsListVONew(QwWatchLogStatisticsListParam param) {
+        // 获取当前公司下的所有销售
+        List<CompanyUser> companyUsers = companyUserMapper.selectCompanyUserByCompanyId(param.getCompanyId());
 
+        List<QwWatchLogAllStatisticsListVO> list = new ArrayList<>();
 
+        for (CompanyUser companyUser : companyUsers) {
+            List<QwWatchLogAllStatisticsListVO> vos = qwWatchLogMapper
+                    .selectQwWatchLogAllStatisticsListVONew(companyUser.getCompanyId(), param.getSTime(), param.getETime(),
+                            param.getProject(),param.getCourseId(),param.getVideoId()
+                            );
+            for (QwWatchLogAllStatisticsListVO item : vos) {
+                if(ObjectUtils.isNotNull(item.getProject())){
+                    String sysCourseProject = DictUtils.getDictLabel("sys_course_project", String.valueOf(item.getProject()));
+                    if(StringUtils.isNotBlank(sysCourseProject)){
+                        item.setProjectName(sysCourseProject);
+                    }
+                }
+                // 课程名
+                if(ObjectUtils.isNotNull(item.getCourseId())) {
+                    FsUserCourse course = fsUserCourseCacheService.selectFsUserCourseByCourseId(item.getCourseId());
+                    if(ObjectUtils.isNotNull(course)){
+                        item.setCourseName(course.getCourseName());
+                    }
+                }
+                // 小节名
+                if(ObjectUtils.isNotNull(item.getVideoId())) {
+                    FsUserCourseVideo fsUserCourseVideo = fsUserCourseVideoCacheService.selectFsUserCourseVideoByVideoId(item.getVideoId());
+                    if(ObjectUtils.isNotNull(fsUserCourseVideo)){
+                        item.setVideoName(fsUserCourseVideo.getTitle());
+                    }
+                }
+                item.setQwUserName(companyUser.getUserName());
+                item.setCreateTime(companyUser.getCreateTime());
+                list.add(item);
+            }
+
+        }
         return list;
     }
 

+ 65 - 5
fs-service-system/src/main/java/com/fs/qw/service/impl/QwWorkTaskServiceImpl.java

@@ -1,7 +1,13 @@
 package com.fs.qw.service.impl;
 
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.common.utils.DateUtils;
+import com.fs.common.utils.DictUtils;
+import com.fs.company.cache.ICompanyCacheService;
+import com.fs.company.cache.ICompanyUserCacheService;
+import com.fs.company.domain.Company;
+import com.fs.company.domain.CompanyUser;
 import com.fs.course.mapper.FsCourseWatchLogMapper;
 import com.fs.course.mapper.FsUserCourseVideoMapper;
 import com.fs.course.vo.FsCourseWatchLogTaskVO;
@@ -17,6 +23,7 @@ import com.fs.sop.domain.QwSop;
 import com.fs.sop.domain.SopUserLogsInfo;
 import com.fs.sop.mapper.QwSopMapper;
 import com.fs.sop.mapper.SopUserLogsInfoMapper;
+import com.hc.openapi.tool.util.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -37,17 +44,18 @@ import java.util.stream.Collectors;
 public class QwWorkTaskServiceImpl extends ServiceImpl<QwWorkTaskMapper, QwWorkTask> implements IQwWorkTaskService {
     @Autowired
     private QwWorkTaskMapper qwWorkTaskMapper;
-    @Autowired
-    private FsUserCourseVideoMapper fsUserCourseVideoMapper;
-
     @Autowired
     private FsCourseWatchLogMapper fsCourseWatchLogMapper;
     @Autowired
     private QwSopMapper qwSopMapper;
     @Autowired
-    SopUserLogsInfoMapper sopUserLogsInfoMapper;
+    private SopUserLogsInfoMapper sopUserLogsInfoMapper;
+    @Autowired
+    private QwExternalContactMapper qwExternalContactMapper;
     @Autowired
-    QwExternalContactMapper qwExternalContactMapper;
+    private ICompanyCacheService companyCacheService;
+    @Autowired
+    private ICompanyUserCacheService companyUserCacheService;
     /**
      * 查询企微任务看板
      *
@@ -254,6 +262,38 @@ public class QwWorkTaskServiceImpl extends ServiceImpl<QwWorkTaskMapper, QwWorkT
         return qwWorkTaskMapper.selectQwWorkTaskListVO(qwWorkTask);
     }
 
+    @Override
+    public List<QwWorkTaskListVO> selectQwWorkTaskListVONew(QwWorkTaskListParam qwWorkTask) {
+        List<QwWorkTaskListVO> list = qwWorkTaskMapper.selectQwWorkTaskListVONew(qwWorkTask);
+        for (QwWorkTaskListVO item : list) {
+            if(ObjectUtils.isNotNull(item.getCompanyId())){
+                Company company = companyCacheService.selectCompanyById(item.getCompanyId());
+                if(ObjectUtils.isNotNull(company)){
+                    item.setCompanyName(String.format("%s_%d",company.getCompanyName(),company.getCompanyId()));
+                }
+            }
+            if(ObjectUtils.isNotNull(item.getCompanyUserId())){
+                CompanyUser companyUser = companyUserCacheService.selectCompanyUserById(item.getCompanyUserId());
+                if(ObjectUtils.isNotNull(companyUser)){
+                    item.setCompanyUserName(String.format("%s_%d", companyUser.getUserName(), companyUser.getUserId()));
+                }
+            }
+            if(ObjectUtils.isNotNull(item.getType())){
+                String kbBusinessType = DictUtils.getDictLabel("sys_qw_work_task_type", String.valueOf(item.getType()));
+                if(StringUtils.isNotBlank(kbBusinessType)){
+                    item.setTypeText(kbBusinessType);
+                }
+            }
+            if(ObjectUtils.isNotNull(item.getStatus())){
+                String kbProcessingStatus = DictUtils.getDictLabel("sys_qw_work_task_status", String.valueOf(item.getStatus()));
+                if(StringUtils.isNotBlank(kbProcessingStatus)){
+                    item.setStatusText(kbProcessingStatus);
+                }
+            }
+        }
+        return list;
+    }
+
     @Override
     public void addQwWorkByCourse4() {
         List<QwSop> qwSops = qwSopMapper.selectQwSopByIsRating();
@@ -401,6 +441,26 @@ public class QwWorkTaskServiceImpl extends ServiceImpl<QwWorkTaskMapper, QwWorkT
         }
     }
 
+    /**
+     * 根据SOP执行日志和特定条件,为符合要求的外部联系人添加企业微信工作任务。
+     * <p>
+     * 此方法仅在传入的 `day` 参数大于7时执行。
+     * 它会查询指定 `QwSop` 在过去 `day` 天内的用户执行日志 (`SopUserLogsInfo`)。
+     * 遍历日志,获取关联的外部联系人 (`QwExternalContact`)。
+     * 对联系人进行筛选:必须存在,且其级别 (`level`) 不能为 null、0 或 4。
+     * 对于通过筛选的联系人,调用内部的 `insertQwWorkTask` 方法来创建任务。
+     * </p>
+     *
+     * @param today   当前日期,用于计算查询日志的起始日期。
+     * @param day     回溯的天数。只有当 `day` 大于 7 时,才会执行添加任务的逻辑。
+     * @param qwSop   企业微信SOP(标准操作流程)对象,包含需要查询日志的SOP ID。
+     * @param title   要创建的企业微信工作任务的标题。
+     * @param map     一个映射表,键可能是外部联系人的级别 (`level`),值可能是传递给 `insertQwWorkTask` 的参数(例如优先级或特定配置)。
+     *                如果联系人级别在map中不存在,则使用默认值0。
+     * @author xdd
+     * @version 1.0
+     * @since yyyy-MM-dd // 建议替换为实际的编写或修改日期
+     */
     private void addQwWorkTask(LocalDate today, Integer day, QwSop qwSop, String title,Map<Integer, Integer> map) {
         if (day>7){
             DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");

+ 9 - 2
fs-service-system/src/main/java/com/fs/qw/vo/QwFriendWelcomeVO.java

@@ -4,16 +4,18 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
 import com.fs.common.core.domain.BaseEntity;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 import java.util.Date;
 import java.util.List;
 
 /**
  * 好友欢迎语对象 qw_friend_welcome
- * 
+ *
  * @author fs
  * @date 2024-07-20
  */
+@EqualsAndHashCode(callSuper = true)
 @Data
 public class QwFriendWelcomeVO extends BaseEntity
 {
@@ -60,6 +62,11 @@ public class QwFriendWelcomeVO extends BaseEntity
     /** 分时段欢迎语 */
     private String daypartingItemlist;
 
-    public List<QwUserVO> userSelectList;
+    private List<QwUserVO> userSelectList;
+
+    /**
+     * 项目
+     */
+    private Integer project;
 
 }

+ 16 - 0
fs-service-system/src/main/java/com/fs/qw/vo/QwWatchLogAllStatisticsListVO.java

@@ -78,5 +78,21 @@ public class QwWatchLogAllStatisticsListVO {
     Long d29Over;
     Long d30Online;
     Long d30Over;
+    /**
+     * 项目
+     */
+    private Long project;
+    private String projectName;
 
+    /**
+     * 课程
+     */
+    private Long courseId;
+    private String courseName;
+
+    /**
+     * 小节
+     */
+    private Long videoId;
+    private String videoName;
 }

+ 35 - 22
fs-service-system/src/main/java/com/fs/qw/vo/QwWatchLogStatisticsListVO.java

@@ -7,27 +7,40 @@ import java.util.Date;
 
 @Data
 public class QwWatchLogStatisticsListVO {
-    Long id;
-    String qwUserName;
+    private Long id;
+    private String qwUserName;
+    private String companyUserName;
     @JsonFormat(pattern = "yyyy-MM-dd")
-    Date createTime;
-
-    Long line;//进线数
-
-    Long firstOnline;//先导课上线
-
-    Long firstOver;//先导课完课
-
-    Long d1Online;//首日上线
-
-    Long d1Over;//首日完课
-
-    Long sign;//综合报名数
-    Long interact;//互动数
-    Long a;
-    Long b;
-    Long c;
-    Long d;
-    Long los;//流失数
-    Long del;//删除数
+    private Date createTime;
+    /**
+     * 项目
+     */
+    private Long project;
+    private String projectName;
+
+    /**
+     * 课程
+     */
+    private Long courseId;
+    private String courseName;
+
+    /**
+     * 小节
+     */
+    private Long videoId;
+    private String videoName;
+
+    private Long line;//进线数
+    private Long firstOnline;//先导课上线
+    private Long firstOver;//先导课完课
+    private Long d1Online;//首日上线
+    private Long d1Over;//首日完课
+    private Long sign;//综合报名数
+    private Long interact;//互动数
+    private Long a;
+    private Long b;
+    private Long c;
+    private Long d;
+    private Long los;//流失数
+    private Long del;//删除数
 }

+ 9 - 3
fs-service-system/src/main/java/com/fs/qw/vo/QwWorkTaskListVO.java

@@ -3,8 +3,10 @@ package com.fs.qw.vo;
 import com.fs.common.annotation.Excel;
 import lombok.Data;
 
+import java.io.Serializable;
+
 @Data
-public class QwWorkTaskListVO {
+public class QwWorkTaskListVO implements Serializable {
     private Long id;
 
     /** 外部联系人id */
@@ -21,10 +23,12 @@ public class QwWorkTaskListVO {
     /** 类别 1先导 2 课程 3 大小转 4 转人工 */
     @Excel(name = "类别 1先导 2 课程 3 大小转 4 转人工")
     private Integer type;
+    private String typeText;
 
     /** 状态 0 待处理 1 已处理 3 过期 */
     @Excel(name = "状态 0 待处理 1 已处理 3 过期")
     private Integer status;
+    private String statusText;
 
     /** 分值 */
     @Excel(name = "分值")
@@ -35,12 +39,14 @@ public class QwWorkTaskListVO {
     private String sopId;
 
     /** 公司id */
-    @Excel(name = "公司id")
     private Long companyId;
+    @Excel(name = "公司")
+    private String companyName;
 
     /** 用户id */
-    @Excel(name = "用户id")
     private Long companyUserId;
+    @Excel(name = "销售id")
+    private String companyUserName;
 
     private String title;
 }

+ 3 - 0
fs-service-system/src/main/java/com/fs/store/domain/FsStoreProduct.java

@@ -174,4 +174,7 @@ public class FsStoreProduct extends BaseEntity
 
     private Integer tuiCateId;
 
+    /** 指定企业 */
+    private String companyIds;
+
 }

+ 6 - 0
fs-service-system/src/main/java/com/fs/store/mapper/FsStoreProductMapper.java

@@ -78,6 +78,9 @@ public interface FsStoreProductMapper
             "<if test = 'maps.isShow != null    '> " +
             "and p.is_show =#{maps.isShow} " +
             "</if>" +
+            "<if test = 'maps.companyIds != null and maps.companyIds != \"\" '> " +
+            "and find_in_set(#{maps.companyIds}, p.company_ids) " +
+            "</if>" +
             " order by p.product_id desc "+
             "</script>"})
     List<FsStoreProductListVO> selectFsStoreProductListVO(@Param("maps")FsStoreProduct fsStoreProduct);
@@ -122,6 +125,9 @@ public interface FsStoreProductMapper
             "<if test = 'maps.isDisplay != null and maps.isDisplay == 1   '> " +
             "and p.is_display =#{maps.isDisplay}  " +
             "</if>" +
+            "<if test = 'maps.companyId != null'> " +
+            "and find_in_set(#{maps.companyId}, p.company_ids) " +
+            "</if>" +
             "<if test = 'maps.cateId != null    '> " +
             "and p.cate_id =#{maps.cateId}  " +
             "</if>" +

+ 3 - 0
fs-service-system/src/main/java/com/fs/store/mapper/FsUserMapper.java

@@ -200,4 +200,7 @@ public interface FsUserMapper
 
     @Select("select * from fs_user where union_id=#{unionid} limit 1")
     FsUser selectFsUserByUnionid(String unionId);
+
+
+    List<FsUser> selectFsUserListLimit(FsUser fsUser);
 }

+ 2 - 2
fs-service-system/src/main/java/com/fs/store/param/FsStoreProductAddEditParam.java

@@ -142,7 +142,7 @@ public class FsStoreProductAddEditParam implements Serializable
     private List<ProductArrtDTO> items;
     //sku结果集
     private List<FsStoreProductAttrValue> values;
-
-
+    // 指定企业
+    private String companyIds;
 
 }

+ 4 - 0
fs-service-system/src/main/java/com/fs/store/param/FsStoreProductQueryParam.java

@@ -24,4 +24,8 @@ public class FsStoreProductQueryParam extends BaseQueryParam implements Serializ
     @ApiModelProperty(value = "1 只显示商城展示的商品 0展示所有")
     private Integer isDisplay=1;
 
+    // token 需用户端传入
+    private String token;
+    // 用户企业ID
+    private Long companyId;
 }

+ 0 - 1
fs-service-system/src/main/java/com/fs/store/service/IFsStoreProductService.java

@@ -8,7 +8,6 @@ import com.fs.store.domain.FsStoreProduct;
 import com.fs.store.param.FsStoreProductAddEditParam;
 import com.fs.store.param.FsStoreProductQueryParam;
 import com.fs.store.vo.*;
-import org.apache.ibatis.annotations.Param;
 
 /**
  * 商品Service接口

+ 2 - 0
fs-service-system/src/main/java/com/fs/store/service/IFsUserService.java

@@ -121,4 +121,6 @@ public interface IFsUserService
     R clearUserVip(Long l);
 
     FsUser selectFsUserByUnionid(String unionId);
+
+    List<FsUser> getUserListLimit(FsUser fsUser);
 }

+ 13 - 0
fs-service-system/src/main/java/com/fs/store/service/cache/IFsUserCacheService.java

@@ -0,0 +1,13 @@
+package com.fs.store.service.cache;
+
+import com.fs.store.domain.FsUser;
+
+public interface IFsUserCacheService {
+    /**
+     * 查询用户
+     *
+     * @param userId 用户ID
+     * @return 用户
+     */
+    public FsUser selectFsUserById(Long userId);
+}

+ 13 - 0
fs-service-system/src/main/java/com/fs/store/service/cache/IFsUserCourseCacheService.java

@@ -0,0 +1,13 @@
+package com.fs.store.service.cache;
+
+import com.fs.course.domain.FsUserCourse;
+
+public interface IFsUserCourseCacheService {
+    /**
+     * 查询课程
+     *
+     * @param courseId 课程主键
+     * @return 课程
+     */
+    public FsUserCourse selectFsUserCourseByCourseId(Long courseId);
+}

+ 28 - 0
fs-service-system/src/main/java/com/fs/store/service/cache/impl/FsUserCourseCacheServiceImpl.java

@@ -0,0 +1,28 @@
+package com.fs.store.service.cache.impl;
+
+import com.fs.course.domain.FsUserCourse;
+import com.fs.course.service.IFsUserCourseService;
+import com.fs.store.domain.FsUser;
+import com.fs.store.service.cache.IFsUserCourseCacheService;
+import com.github.benmanes.caffeine.cache.Cache;
+import com.github.benmanes.caffeine.cache.Caffeine;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.concurrent.TimeUnit;
+
+@Service
+@RequiredArgsConstructor
+@Slf4j
+public class FsUserCourseCacheServiceImpl implements IFsUserCourseCacheService {
+    private final IFsUserCourseService fsUserCourseService;
+    private static final Cache<Long, FsUserCourse> FS_USER_COURSE_CACHE = Caffeine.newBuilder()
+            .maximumSize(1000)
+            .expireAfterWrite(3, TimeUnit.MINUTES)
+            .build();
+    @Override
+    public FsUserCourse selectFsUserCourseByCourseId(Long courseId) {
+        return FS_USER_COURSE_CACHE.get(courseId,e-> fsUserCourseService.selectFsUserCourseByCourseId(courseId));
+    }
+}

+ 30 - 0
fs-service-system/src/main/java/com/fs/store/service/cache/impl/IFsUserCacheServiceImpl.java

@@ -0,0 +1,30 @@
+package com.fs.store.service.cache.impl;
+
+import com.fs.course.domain.FsUserCourseVideo;
+import com.fs.store.domain.FsUser;
+import com.fs.store.service.IFsUserService;
+import com.fs.store.service.cache.IFsUserCacheService;
+import com.github.benmanes.caffeine.cache.Cache;
+import com.github.benmanes.caffeine.cache.Caffeine;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.concurrent.TimeUnit;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class IFsUserCacheServiceImpl implements IFsUserCacheService {
+    private final IFsUserService fsUserService;
+
+    private static final Cache<Long, FsUser> FS_USER_CACHE = Caffeine.newBuilder()
+            .maximumSize(1000)
+            .expireAfterWrite(3, TimeUnit.MINUTES)
+            .build();
+
+    @Override
+    public FsUser selectFsUserById(Long userId) {
+        return FS_USER_CACHE.get(userId,e-> fsUserService.selectFsUserById(userId));
+    }
+}

+ 2 - 0
fs-service-system/src/main/java/com/fs/store/service/impl/FsStoreProductServiceImpl.java

@@ -250,6 +250,7 @@ public class FsStoreProductServiceImpl implements IFsStoreProductService
             product.setCost(countDto.getMinCost());
             product.setIntegral(Long.parseLong(countDto.getMinIntegral().toString()));
             product.setStock(Long.parseLong(countDto.getStock().toString()));
+            product.setCompanyIds(param.getCompanyIds());
             fsStoreProductMapper.updateFsStoreProduct(product);
             if (param.getSpecType().equals(0)) {
                 ProductArrtDTO fromatDetailDto = ProductArrtDTO.builder()
@@ -272,6 +273,7 @@ public class FsStoreProductServiceImpl implements IFsStoreProductService
             product.setCost(countDto.getMinCost());
             product.setIntegral(Long.parseLong(countDto.getMinIntegral().toString()));
             product.setStock(Long.parseLong(countDto.getStock().toString()));
+            product.setCompanyIds(param.getCompanyIds());
             fsStoreProductMapper.insertFsStoreProduct(product);
             if (param.getSpecType().equals(0)) {
                 ProductArrtDTO fromatDetailDto = ProductArrtDTO.builder()

+ 5 - 0
fs-service-system/src/main/java/com/fs/store/service/impl/FsUserServiceImpl.java

@@ -347,4 +347,9 @@ public class FsUserServiceImpl implements IFsUserService
     public FsUser selectFsUserByUnionid(String unionId) {
         return fsUserMapper.selectFsUserByUnionid(unionId);
     }
+
+    @Override
+    public List<FsUser> getUserListLimit(FsUser fsUser) {
+        return fsUserMapper.selectFsUserListLimit(fsUser);
+    }
 }

+ 2 - 0
fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductQueryVO.java

@@ -116,5 +116,7 @@ public class FsStoreProductQueryVO implements Serializable
     /** 处方名 */
     private String prescribeName;
 
+    /** 所属企业 */
+    private String companyIds;
 
 }

+ 230 - 115
fs-service-system/src/main/resources/mapper/company/CompanyTcmReportMapper.xml

@@ -1,129 +1,184 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fs.company.mapper.CompanyTcmReportMapper">
 
     <resultMap type="CompanyTcmReport" id="CompanyTcmReportResult">
-        <result property="id"    column="id"    />
-        <result property="scheduleId"    column="schedule_id"    />
-        <result property="companyUserId"    column="company_user_id"    />
-        <result property="companyId"    column="company_id"    />
-        <result property="totalNum"    column="total_num"    />
-        <result property="registerNum"    column="register_num"    />
-        <result property="onlineNum"    column="online_num"    />
-        <result property="finishNum"    column="finish_num"    />
-        <result property="registerRate"    column="register_rate"    />
-        <result property="onlineRate"    column="online_rate"    />
-        <result property="finishRate"    column="finish_rate"    />
-        <result property="totalMoney"    column="total_money"    />
-        <result property="totalOrder"    column="total_order"    />
-        <result property="targetMoney"    column="target_money"    />
-        <result property="targetRate"    column="target_rate"    />
-        <result property="round1Money"    column="round1_money"    />
-        <result property="round1Order"    column="round1_order"    />
-        <result property="round1Rate"    column="round1_rate"    />
-        <result property="round1Unit"    column="round1_unit"    />
-        <result property="round2Money"    column="round2_money"    />
-        <result property="round2Order"    column="round2_order"    />
-        <result property="round2Rate"    column="round2_rate"    />
-        <result property="round2Unit"    column="round2_unit"    />
-        <result property="round3Money"    column="round3_money"    />
-        <result property="round3Order"    column="round3_order"    />
-        <result property="round3Rate"    column="round3_rate"    />
-        <result property="round3Unit"    column="round3_unit"    />
-        <result property="round4Money"    column="round4_money"    />
-        <result property="round4Order"    column="round4_order"    />
-        <result property="round4Rate"    column="round4_rate"    />
-        <result property="round4Unit"    column="round4_unit"    />
-        <result property="round5Money"    column="round5_money"    />
-        <result property="round5Order"    column="round5_order"    />
-        <result property="round5Rate"    column="round5_rate"    />
-        <result property="round5Unit"    column="round5_unit"    />
-        <result property="round6Money"    column="round6_money"    />
-        <result property="round6Order"    column="round6_order"    />
-        <result property="round6Rate"    column="round6_rate"    />
-        <result property="round6Unit"    column="round6_unit"    />
-        <result property="round7Money"    column="round7_money"    />
-        <result property="round7Order"    column="round7_order"    />
-        <result property="round7Rate"    column="round7_rate"    />
-        <result property="round7Unit"    column="round7_unit"    />
-        <result property="round8Money"    column="round8_money"    />
-        <result property="round8Order"    column="round8_order"    />
-        <result property="round8Rate"    column="round8_rate"    />
-        <result property="round8Unit"    column="round8_unit"    />
-        <result property="round9Money"    column="round9_money"    />
-        <result property="round9Order"    column="round9_order"    />
-        <result property="round9Rate"    column="round9_rate"    />
-        <result property="round9Unit"    column="round9_unit"    />
+        <result property="id" column="id"/>
+        <result property="scheduleId" column="schedule_id"/>
+        <result property="companyUserId" column="company_user_id"/>
+        <result property="companyId" column="company_id"/>
+        <result property="totalNum" column="total_num"/>
+        <result property="registerNum" column="register_num"/>
+        <result property="onlineNum" column="online_num"/>
+        <result property="finishNum" column="finish_num"/>
+        <result property="registerRate" column="register_rate"/>
+        <result property="onlineRate" column="online_rate"/>
+        <result property="finishRate" column="finish_rate"/>
+        <result property="totalMoney" column="total_money"/>
+        <result property="totalOrder" column="total_order"/>
+        <result property="targetMoney" column="target_money"/>
+        <result property="targetRate" column="target_rate"/>
+        <result property="round1Money" column="round1_money"/>
+        <result property="round1Order" column="round1_order"/>
+        <result property="round1Rate" column="round1_rate"/>
+        <result property="round1Unit" column="round1_unit"/>
+        <result property="round2Money" column="round2_money"/>
+        <result property="round2Order" column="round2_order"/>
+        <result property="round2Rate" column="round2_rate"/>
+        <result property="round2Unit" column="round2_unit"/>
+        <result property="round3Money" column="round3_money"/>
+        <result property="round3Order" column="round3_order"/>
+        <result property="round3Rate" column="round3_rate"/>
+        <result property="round3Unit" column="round3_unit"/>
+        <result property="round4Money" column="round4_money"/>
+        <result property="round4Order" column="round4_order"/>
+        <result property="round4Rate" column="round4_rate"/>
+        <result property="round4Unit" column="round4_unit"/>
+        <result property="round5Money" column="round5_money"/>
+        <result property="round5Order" column="round5_order"/>
+        <result property="round5Rate" column="round5_rate"/>
+        <result property="round5Unit" column="round5_unit"/>
+        <result property="round6Money" column="round6_money"/>
+        <result property="round6Order" column="round6_order"/>
+        <result property="round6Rate" column="round6_rate"/>
+        <result property="round6Unit" column="round6_unit"/>
+        <result property="round7Money" column="round7_money"/>
+        <result property="round7Order" column="round7_order"/>
+        <result property="round7Rate" column="round7_rate"/>
+        <result property="round7Unit" column="round7_unit"/>
+        <result property="round8Money" column="round8_money"/>
+        <result property="round8Order" column="round8_order"/>
+        <result property="round8Rate" column="round8_rate"/>
+        <result property="round8Unit" column="round8_unit"/>
+        <result property="round9Money" column="round9_money"/>
+        <result property="round9Order" column="round9_order"/>
+        <result property="round9Rate" column="round9_rate"/>
+        <result property="round9Unit" column="round9_unit"/>
 
-        <result property="createTime"    column="create_time"    />
-        <result property="createUserId"    column="create_user_id"    />
-        <result property="updateTime"    column="update_time"    />
-        <result property="updateUserId"    column="update_user_id"    />
+        <result property="createTime" column="create_time"/>
+        <result property="createUserId" column="create_user_id"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="updateUserId" column="update_user_id"/>
     </resultMap>
 
     <sql id="selectCompanyTcmReportVo">
-        select id, schedule_id, company_user_id, company_id, total_num, register_num, online_num, finish_num, register_rate, online_rate, finish_rate, total_money, total_order, target_money, target_rate, round1_money, round1_order, round1_rate, round1_unit, round2_money, round2_order, round2_rate, round2_unit, round3_money, round3_order, round3_rate, round3_unit, round4_money, round4_order, round4_rate, round4_unit, round5_money, round5_order, round5_rate, round5_unit, round6_money, round6_order, round6_rate, round6_unit, round7_money, round7_order, round7_rate, round7_unit, round8_money, round8_order, round8_rate, round8_unit, round9_money, round9_order, round9_rate, round9_unit,create_time,create_user_id,update_time,update_user_id from company_tcm_report
+        select id,
+               schedule_id,
+               company_user_id,
+               company_id,
+               total_num,
+               register_num,
+               online_num,
+               finish_num,
+               register_rate,
+               online_rate,
+               finish_rate,
+               total_money,
+               total_order,
+               target_money,
+               target_rate,
+               round1_money,
+               round1_order,
+               round1_rate,
+               round1_unit,
+               round2_money,
+               round2_order,
+               round2_rate,
+               round2_unit,
+               round3_money,
+               round3_order,
+               round3_rate,
+               round3_unit,
+               round4_money,
+               round4_order,
+               round4_rate,
+               round4_unit,
+               round5_money,
+               round5_order,
+               round5_rate,
+               round5_unit,
+               round6_money,
+               round6_order,
+               round6_rate,
+               round6_unit,
+               round7_money,
+               round7_order,
+               round7_rate,
+               round7_unit,
+               round8_money,
+               round8_order,
+               round8_rate,
+               round8_unit,
+               round9_money,
+               round9_order,
+               round9_rate,
+               round9_unit,
+               create_time,
+               create_user_id,
+               update_time,
+               update_user_id
+        from company_tcm_report
     </sql>
 
     <select id="selectCompanyTcmReportList" parameterType="CompanyTcmReport" resultMap="CompanyTcmReportResult">
         <include refid="selectCompanyTcmReportVo"/>
         <where>
-            <if test="scheduleId != null "> and schedule_id = #{scheduleId}</if>
-            <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
-            <if test="companyId != null "> and company_id = #{companyId}</if>
-            <if test="totalNum != null "> and total_num = #{totalNum}</if>
-            <if test="registerNum != null "> and register_num = #{registerNum}</if>
-            <if test="onlineNum != null "> and online_num = #{onlineNum}</if>
-            <if test="finishNum != null "> and finish_num = #{finishNum}</if>
-            <if test="registerRate != null "> and register_rate = #{registerRate}</if>
-            <if test="onlineRate != null "> and online_rate = #{onlineRate}</if>
-            <if test="finishRate != null "> and finish_rate = #{finishRate}</if>
-            <if test="totalMoney != null "> and total_money = #{totalMoney}</if>
-            <if test="totalOrder != null "> and total_order = #{totalOrder}</if>
-            <if test="targetMoney != null "> and target_money = #{targetMoney}</if>
-            <if test="targetRate != null "> and target_rate = #{targetRate}</if>
-            <if test="round1Money != null "> and round1_money = #{round1Money}</if>
-            <if test="round1Order != null "> and round1_order = #{round1Order}</if>
-            <if test="round1Rate != null "> and round1_rate = #{round1Rate}</if>
-            <if test="round1Unit != null "> and round1_unit = #{round1Unit}</if>
-            <if test="round2Money != null "> and round2_money = #{round2Money}</if>
-            <if test="round2Order != null "> and round2_order = #{round2Order}</if>
-            <if test="round2Rate != null "> and round2_rate = #{round2Rate}</if>
-            <if test="round2Unit != null "> and round2_unit = #{round2Unit}</if>
-            <if test="round3Money != null "> and round3_money = #{round3Money}</if>
-            <if test="round3Order != null "> and round3_order = #{round3Order}</if>
-            <if test="round3Rate != null "> and round3_rate = #{round3Rate}</if>
-            <if test="round3Unit != null "> and round3_unit = #{round3Unit}</if>
-            <if test="round4Money != null "> and round4_money = #{round4Money}</if>
-            <if test="round4Order != null "> and round4_order = #{round4Order}</if>
-            <if test="round4Rate != null "> and round4_rate = #{round4Rate}</if>
-            <if test="round4Unit != null "> and round4_unit = #{round4Unit}</if>
-            <if test="round5Money != null "> and round5_money = #{round5Money}</if>
-            <if test="round5Order != null "> and round5_order = #{round5Order}</if>
-            <if test="round5Rate != null "> and round5_rate = #{round5Rate}</if>
-            <if test="round5Unit != null "> and round5_unit = #{round5Unit}</if>
-            <if test="round6Money != null "> and round6_money = #{round6Money}</if>
-            <if test="round6Order != null "> and round6_order = #{round6Order}</if>
-            <if test="round6Rate != null "> and round6_rate = #{round6Rate}</if>
-            <if test="round6Unit != null "> and round6_unit = #{round6Unit}</if>
-            <if test="round7Money != null "> and round7_money = #{round7Money}</if>
-            <if test="round7Order != null "> and round7_order = #{round7Order}</if>
-            <if test="round7Rate != null "> and round7_rate = #{round7Rate}</if>
-            <if test="round7Unit != null "> and round7_unit = #{round7Unit}</if>
-            <if test="round8Money != null "> and round8_money = #{round8Money}</if>
-            <if test="round8Order != null "> and round8_order = #{round8Order}</if>
-            <if test="round8Rate != null "> and round8_rate = #{round8Rate}</if>
-            <if test="round8Unit != null "> and round8_unit = #{round8Unit}</if>
-            <if test="round9Money != null "> and round9_money = #{round9Money}</if>
-            <if test="round9Order != null "> and round9_order = #{round9Order}</if>
-            <if test="round9Rate != null "> and round9_rate = #{round9Rate}</if>
-            <if test="round9Unit != null "> and round9_unit = #{round9Unit}</if>
-            <if test="createTime != null "> and create_time = #{createTime}</if>
-            <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
-            <if test="updateTime != null "> and update_time = #{updateTime}</if>
-            <if test="updateUserId != null "> and update_user_id = #{updateUserId}</if>
+            <if test="scheduleId != null ">and schedule_id = #{scheduleId}</if>
+            <if test="companyUserId != null ">and company_user_id = #{companyUserId}</if>
+            <if test="companyId != null ">and company_id = #{companyId}</if>
+            <if test="totalNum != null ">and total_num = #{totalNum}</if>
+            <if test="registerNum != null ">and register_num = #{registerNum}</if>
+            <if test="onlineNum != null ">and online_num = #{onlineNum}</if>
+            <if test="finishNum != null ">and finish_num = #{finishNum}</if>
+            <if test="registerRate != null ">and register_rate = #{registerRate}</if>
+            <if test="onlineRate != null ">and online_rate = #{onlineRate}</if>
+            <if test="finishRate != null ">and finish_rate = #{finishRate}</if>
+            <if test="totalMoney != null ">and total_money = #{totalMoney}</if>
+            <if test="totalOrder != null ">and total_order = #{totalOrder}</if>
+            <if test="targetMoney != null ">and target_money = #{targetMoney}</if>
+            <if test="targetRate != null ">and target_rate = #{targetRate}</if>
+            <if test="round1Money != null ">and round1_money = #{round1Money}</if>
+            <if test="round1Order != null ">and round1_order = #{round1Order}</if>
+            <if test="round1Rate != null ">and round1_rate = #{round1Rate}</if>
+            <if test="round1Unit != null ">and round1_unit = #{round1Unit}</if>
+            <if test="round2Money != null ">and round2_money = #{round2Money}</if>
+            <if test="round2Order != null ">and round2_order = #{round2Order}</if>
+            <if test="round2Rate != null ">and round2_rate = #{round2Rate}</if>
+            <if test="round2Unit != null ">and round2_unit = #{round2Unit}</if>
+            <if test="round3Money != null ">and round3_money = #{round3Money}</if>
+            <if test="round3Order != null ">and round3_order = #{round3Order}</if>
+            <if test="round3Rate != null ">and round3_rate = #{round3Rate}</if>
+            <if test="round3Unit != null ">and round3_unit = #{round3Unit}</if>
+            <if test="round4Money != null ">and round4_money = #{round4Money}</if>
+            <if test="round4Order != null ">and round4_order = #{round4Order}</if>
+            <if test="round4Rate != null ">and round4_rate = #{round4Rate}</if>
+            <if test="round4Unit != null ">and round4_unit = #{round4Unit}</if>
+            <if test="round5Money != null ">and round5_money = #{round5Money}</if>
+            <if test="round5Order != null ">and round5_order = #{round5Order}</if>
+            <if test="round5Rate != null ">and round5_rate = #{round5Rate}</if>
+            <if test="round5Unit != null ">and round5_unit = #{round5Unit}</if>
+            <if test="round6Money != null ">and round6_money = #{round6Money}</if>
+            <if test="round6Order != null ">and round6_order = #{round6Order}</if>
+            <if test="round6Rate != null ">and round6_rate = #{round6Rate}</if>
+            <if test="round6Unit != null ">and round6_unit = #{round6Unit}</if>
+            <if test="round7Money != null ">and round7_money = #{round7Money}</if>
+            <if test="round7Order != null ">and round7_order = #{round7Order}</if>
+            <if test="round7Rate != null ">and round7_rate = #{round7Rate}</if>
+            <if test="round7Unit != null ">and round7_unit = #{round7Unit}</if>
+            <if test="round8Money != null ">and round8_money = #{round8Money}</if>
+            <if test="round8Order != null ">and round8_order = #{round8Order}</if>
+            <if test="round8Rate != null ">and round8_rate = #{round8Rate}</if>
+            <if test="round8Unit != null ">and round8_unit = #{round8Unit}</if>
+            <if test="round9Money != null ">and round9_money = #{round9Money}</if>
+            <if test="round9Order != null ">and round9_order = #{round9Order}</if>
+            <if test="round9Rate != null ">and round9_rate = #{round9Rate}</if>
+            <if test="round9Unit != null ">and round9_unit = #{round9Unit}</if>
+            <if test="createTime != null ">and create_time = #{createTime}</if>
+            <if test="createUserId != null ">and create_user_id = #{createUserId}</if>
+            <if test="updateTime != null ">and update_time = #{updateTime}</if>
+            <if test="updateUserId != null ">and update_user_id = #{updateUserId}</if>
         </where>
     </select>
 
@@ -131,6 +186,64 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectCompanyTcmReportVo"/>
         where id = #{id}
     </select>
+    <select id="selectCompanyTcmReportStatisticsVOList" resultType="com.fs.company.vo.CompanyTcmReportListVO">
+        SELECT r.company_id,c.company_name, r.schedule_id,s.name as schedule_name,ANY_VALUE(cu.cu_count) as
+        cu_count,ANY_VALUE(cu.money) as money,min(r.create_time) as create_time,max(r.update_time) as update_time,count(
+        DISTINCT r.company_user_id) AS connection_num,
+        SUM(total_num) as total_num,SUM(register_num) as register_num,SUM(online_num) as online_num, SUM(finish_num) as
+        finish_num,SUM(total_money) as total_money,SUM(target_money) as target_money,SUM(total_order) as total_order,
+        SUM(round1_money) as round1_money,SUM(round1_order) as round1_order,SUM(round2_money) as
+        round2_money,SUM(round2_order) as round2_order,SUM(round3_money) as round3_money,SUM(round3_order) as
+        round3_order,
+        SUM(round4_money) as round4_money,SUM(round4_order) as round4_order,SUM(round5_money) as
+        round5_money,SUM(round5_order) as round5_order,SUM(round6_money) as round6_money,SUM(round6_order) as
+        round6_order,
+        SUM(round7_money) as round7_money,SUM(round7_order) as round7_order,SUM(round8_money) as
+        round8_money,SUM(round8_order) as round8_order,SUM(round9_money) as round9_money,SUM(round9_order) as
+        round9_order
+        from company_tcm_report r LEFT JOIN company_tcm_schedule s on r.schedule_id=s.id LEFT JOIN company c on
+        r.company_id=c.company_id
+        left join company_tcm_consume cu on r.company_id=cu.company_id and r.schedule_id=cu.schedule_id
+        left join company_user comu on r.company_user_id=comu.user_id
+        r.company_id=cu.company_id
+        where 1=1
+        <if test='maps.companyId != null  and maps.companyId != ""'>
+            and r.company_id IN
+            <foreach collection="maps.companyId.split(',')" item='item' index='index' open='(' separator=',' close=')'>
+                #{item}
+            </foreach>
+        </if>
+        <if test='maps.companyUserId != null '>
+            and r.company_user_id = #{maps.companyUserId}
+        </if>
+
+        <if test='maps.userNickName != null and maps.userNickName != "" '>
+            and comu.nick_name like '%${maps.userNickName}%'
+        </if>
+
+        <if test='maps.scheduleId != null   and maps.scheduleId != ""     '>
+            and r.schedule_id IN
+            <foreach collection="maps.scheduleId.split(',')" item='item' index='index' open='(' separator=',' close=')'>#{item}
+            </foreach>
+        </if>
+        <if test='maps.beginTime != null and maps.beginTime != "" '>
+            and date_format(r.create_time,'%y%m%d') &gt;= date_format(#{maps.beginTime},'%y%m%d')
+        </if>
+        <if test='maps.endTime != null and maps.endTime != "" '>
+            and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{maps.endTime},'%y%m%d')
+        </if>
+        <if test='maps.deptIdStr != null and  maps.deptIdStr !=""    '>
+            AND
+            <foreach collection="maps.deptIdStr.split(',')" item="deptId" open="(" close=")" separator="OR">
+                comu.dept_id = #{deptId} OR comu.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE
+                find_in_set(#{deptId}, ancestors) )
+            </foreach>
+        </if>
+        ${maps.params.dataScope}
+        GROUP BY r.schedule_id,r.company_id
+        order by r.company_id desc
+
+    </select>
 
     <insert id="insertCompanyTcmReport" parameterType="CompanyTcmReport" useGeneratedKeys="true" keyProperty="id">
         insert into company_tcm_report
@@ -189,7 +302,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createUserId != null">create_user_id,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="updateUserId != null">update_user_id,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="scheduleId != null">#{scheduleId},</if>
             <if test="companyUserId != null">#{companyUserId},</if>
@@ -245,7 +358,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createUserId != null">#{createUserId},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="updateUserId != null">#{updateUserId},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateCompanyTcmReport" parameterType="CompanyTcmReport">
@@ -310,7 +423,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteCompanyTcmReportById" parameterType="Long">
-        delete from company_tcm_report where id = #{id}
+        delete
+        from company_tcm_report
+        where id = #{id}
     </delete>
 
     <delete id="deleteCompanyTcmReportByIds" parameterType="String">

+ 5 - 1
fs-service-system/src/main/resources/mapper/company/CompanyUserMapper.xml

@@ -36,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="deptName"    column="dept_name"    />
         <result property="qwUserId"    column="qw_user_id"    />
         <result property="qwStatus"    column="qw_status"    />
+        <result property="domain"    column="domain"    />
         <association property="dept"    column="dept_id" javaType="CompanyDept" resultMap="deptResult" />
         <collection  property="roles"   javaType="java.util.List"        resultMap="RoleResult" />
 
@@ -131,6 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="jpushId != null">jpush_id,</if>
             <if test="qwUserId != null">qw_user_id,</if>
             <if test="qwStatus != null">qw_status,</if>
+            <if test="domain != null">`domain`,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="companyId != null">#{companyId},</if>
@@ -160,6 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="jpushId != null">#{jpushId},</if>
             <if test="qwUserId != null">#{qwUserId},</if>
             <if test="qwStatus != null">#{qwStatus},</if>
+            <if test="domain != null">#{domain},</if>
          </trim>
     </insert>
 
@@ -192,6 +195,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="jpushId != null">jpush_id = #{jpushId},</if>
             <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
             <if test="qwStatus != null">qw_status = #{qwStatus},</if>
+            <if test="domain != null">`domain` = #{domain},</if>
         </trim>
         where user_id = #{userId}
     </update>
@@ -254,7 +258,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where u.user_name = #{userName}
     </select>
     <sql id="selectUserVo">
-        select u.user_id,u.company_id,u.qw_user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time,u.id_card, u.remark,u.user_type,u.open_id,u.qr_code_weixin,u.qr_code_wecom,u.jpush_id,
+        select u.user_id,u.company_id,u.qw_user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time,u.id_card, u.remark,u.user_type,u.open_id,u.qr_code_weixin,u.qr_code_wecom,u.jpush_id,u.domain,
         d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,
         r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
         from company_user u

+ 24 - 0
fs-service-system/src/main/resources/mapper/course/FsCourseAnswerLogsMapper.xml

@@ -40,6 +40,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectFsCourseAnswerLogsVo"/>
         where log_id = #{logId}
     </select>
+    <select id="selectFsCourseAnswerLogsListVONew" resultType="com.fs.course.vo.FsCourseAnswerLogsListVO">
+        select cal.*,uc.course_name as course_name,uc.project as project from fs_course_answer_logs cal
+        left join fs_user_course uc on cal.course_id=uc.course_id
+        <where>
+            <if test="courseId != null">
+                cal.course_id = #{courseId}
+            </if>
+            <if test="companyUserId != null">
+                AND cal.company_user_id = #{companyUserId}
+            </if>
+            <if test="companyId != null">
+                AND cal.company_id = #{companyId}
+            </if>
+            <if test="isRight != null">
+                AND is_right = #{isRight}
+            </if>
+            <if test="project != null">
+                AND uc.project = #{project}
+            </if>
+            <if test="sTime != null and eTime != null">
+                AND cal.create_time BETWEEN #{sTime} AND #{eTime}
+            </if>
+        </where>
+    </select>
 
     <insert id="insertFsCourseAnswerLogs" parameterType="FsCourseAnswerLogs" useGeneratedKeys="true" keyProperty="logId">
         insert into fs_course_answer_logs

+ 114 - 1
fs-service-system/src/main/resources/mapper/course/FsCourseWatchLogMapper.xml

@@ -52,7 +52,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where log_id = #{logId}
     </select>
     <select id="selectFsCourseWatchLogListVO" resultType="com.fs.course.vo.FsCourseWatchLogListVO">
-        select l.log_id,l.user_id,uc.course_name,v.title as video_name,u.nick_name as fsNickName, u.avatar as fsAvatar,
+        select l.log_id,
+               l.project as project,
+               l.user_id,uc.course_name,v.title as video_name,u.nick_name as fsNickName, u.avatar as fsAvatar,
         l.log_type,SEC_TO_TIME(l.duration) as duration,c.company_name,l.camp_period_time,l.finish_time,
         cu.nick_name as company_user_name ,l.send_type,l.create_time,l.update_time,l.last_heartbeat_time,
         qu.qw_user_name,qec.name as external_user_name,c.company_id
@@ -444,4 +446,115 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{item.logId}
         </foreach>
     </update>
+    <select id="selectFsCourseWatchLogStatisticsListVONew"
+            resultType="com.fs.course.vo.FsCourseWatchLogStatisticsListVO">
+        SELECT
+        o.company_user_id,o.user_id,DATE(o.create_time) create_time,
+        SUM(CASE WHEN o.log_type = '1' THEN 1 ELSE 0 END) AS type1,
+        SUM(CASE WHEN o.log_type = '2' THEN 1 ELSE 0 END) AS type2,
+        SUM(CASE WHEN o.log_type = '3' THEN 1 ELSE 0 END) AS type3,
+        SUM(CASE WHEN o.log_type = '4' THEN 1 ELSE 0 END) AS type4,
+        o.project as project,
+        o.course_id as course_id,
+        o.video_id as video_id
+        FROM fs_course_watch_log o
+        <where>
+            <if test="companyId != null">
+                o.company_id=#{companyId}
+            </if>
+            <if test= 'sTime != null '>
+                and DATE(o.create_time) &gt;= DATE(#{sTime})
+            </if>
+            <if test='eTime != null '>
+                and DATE(o.create_time) &lt;= DATE(#{eTime})
+            </if>
+            <if test ='courseId !=null'>
+                and o.course_id = #{courseId}
+            </if>
+            <if test ='videoId !=null'>
+                and o.video_id = #{videoId}
+            </if>
+            <if test="companyUserId != null">
+                and o.company_user_id = #{companyUserId}
+            </if>
+            <if test="project != null">
+                and o.project = #{project}
+            </if>
+            <if test="userId != null">
+                and o.user_id = #{userId}
+            </if>
+        </where>
+
+        GROUP BY o.video_id,o.user_id,DATE(o.create_time)
+        ORDER BY o.video_id ,DATE(o.create_time)
+    </select>
+    <select id="selectFsCourseWatchLogListVONew" resultType="com.fs.course.vo.FsCourseWatchLogListVO">
+        select l.log_id,
+        l.project as project,
+        l.user_id,
+        l.log_type,
+        SEC_TO_TIME(l.duration) as duration,
+        l.camp_period_time,
+        l.finish_time,
+        l.send_type,
+        l.create_time,
+        l.update_time,
+        l.last_heartbeat_time,
+        l.company_id,
+        l.company_user_id,
+        l.course_id,
+        l.video_id
+        from fs_course_watch_log l
+        <where>
+            <if test ='maps.userId !=null'>
+                and l.user_id = #{maps.userId}
+            </if>
+            <if test ='maps.qwExternalContactId !=null'>
+                and l.qw_external_contact_id = #{maps.qwExternalContactId}
+            </if>
+            <if test ='maps.qwUserId !=null'>
+                and l.qw_user_id = #{maps.qwUserId}
+            </if>
+            <if test ='maps.courseId !=null'>
+                and l.course_id = #{maps.courseId}
+            </if>
+            <if test ='maps.videoId !=null'>
+                and l.video_id = #{maps.videoId}
+            </if>
+            <if test ='maps.logType !=null'>
+                and l.log_type = #{maps.logType}
+            </if>
+            <if test ='maps.companyId !=null'>
+                and l.company_id = #{maps.companyId}
+            </if>
+            <if test ='maps.companyUserId !=null'>
+                and l.company_user_id = #{maps.companyUserId}
+            </if>
+            <if test= 'maps.sTime != null '>
+                and DATE(l.create_time) &gt;= DATE(#{maps.sTime})
+            </if>
+            <if test='maps.eTime != null '>
+                and DATE(l.create_time) &lt;= DATE(#{maps.eTime})
+            </if>
+            <if test= 'maps.scheduleStartTime != null '>
+                and DATE(l.camp_period_time) &gt;= DATE(#{maps.scheduleStartTime})
+            </if>
+            <if test='maps.scheduleEndTime != null '>
+                and DATE(l.camp_period_time) &lt;= DATE(#{maps.scheduleEndTime})
+            </if>
+            <if test= 'maps.upSTime != null '>
+                and DATE(l.update_time) &gt;= DATE(#{maps.upSTime})
+            </if>
+            <if test='maps.upETime != null '>
+                and DATE(l.update_time) &lt;= DATE(#{maps.upETime})
+            </if>
+            <if test="maps.sopIds != null and maps.sopIds.size() > 0">
+                and l.sop_id in
+                <foreach item="sopId" index="index" collection="maps.sopIds" open="(" separator="," close=")">
+                    #{sopId}
+                </foreach>
+            </if>
+        </where>
+        order by l.log_id desc
+    </select>
 </mapper>

+ 105 - 0
fs-service-system/src/main/resources/mapper/qw/QwExternalContactBlackLogMapper.xml

@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fs.qw.mapper.QwExternalContactBlackLogMapper">
+
+    <resultMap type="QwExternalContactBlackLog" id="QwExternalContactBlackLogResult">
+        <result property="id"    column="id"    />
+        <result property="externalUserId"    column="external_user_id"    />
+        <result property="companyUserId"    column="company_user_id"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="status"    column="status"    />
+        <result property="blackStatus"    column="black_status"    />
+    </resultMap>
+
+    <sql id="selectQwExternalContactBlackLogVo">
+        select id, external_user_id, company_user_id, create_time, status, black_status from qw_external_contact_black_log
+    </sql>
+
+    <select id="selectQwExternalContactBlackLogList" parameterType="QwExternalContactBlackLog" resultMap="QwExternalContactBlackLogResult">
+        <include refid="selectQwExternalContactBlackLogVo"/>
+        <where>
+            <if test="id != null "> and id = #{id}</if>
+            <if test="externalUserId != null  and externalUserId != ''"> and external_user_id = #{externalUserId}</if>
+            <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
+            <if test="createTime != null "> and create_time = #{createTime}</if>
+            <if test="status != null "> and status = #{status}</if>
+            <if test="blackStatus != null "> and black_status = #{blackStatus}</if>
+        </where>
+    </select>
+
+    <select id="selectQwExternalContactBlackLogById" parameterType="Long" resultMap="QwExternalContactBlackLogResult">
+        <include refid="selectQwExternalContactBlackLogVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertQwExternalContactBlackLog" parameterType="QwExternalContactBlackLog" useGeneratedKeys="true" keyProperty="id">
+        insert into qw_external_contact_black_log
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="externalUserId != null">external_user_id,</if>
+            <if test="companyUserId != null">company_user_id,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="status != null">status,</if>
+            <if test="blackStatus != null">black_status,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="externalUserId != null">#{externalUserId},</if>
+            <if test="companyUserId != null">#{companyUserId},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="status != null">#{status},</if>
+            <if test="blackStatus != null">#{blackStatus},</if>
+         </trim>
+    </insert>
+
+    <update id="updateQwExternalContactBlackLog" parameterType="QwExternalContactBlackLog">
+        update qw_external_contact_black_log
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="externalUserId != null">external_user_id = #{externalUserId},</if>
+            <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="blackStatus != null">black_status = #{blackStatus},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteQwExternalContactBlackLogById" parameterType="Long">
+        delete from qw_external_contact_black_log where id = #{id}
+    </delete>
+
+    <delete id="deleteQwExternalContactBlackLogByIds" parameterType="String">
+        delete from qw_external_contact_black_log where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+
+    <insert id="insertLogBySelectExternalContact" parameterType="QwExternalContactBlackLog" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO qw_external_contact_black_log ( external_user_id, company_user_id, create_time, STATUS, black_status )
+        SELECT
+            id,company_user_id,
+            NOW(),
+            STATUS,
+            7
+        FROM
+            qw_external_contact
+        WHERE qw_external_contact.id in
+        <foreach collection="ids" item="id" index="index" open="(" separator="," close=")">
+             #{id}
+        </foreach>
+    </insert>
+
+    <select id="selectContactLogByIds" resultType="QwExternalContact">
+        SELECT
+        qw_external_contact.id,
+        qw_external_contact.STATUS
+        from qw_external_contact_black_log
+        where external_user_id in
+        <foreach collection="ids" item="id" index="index" open="(" separator="," close=")">
+            (#{id})
+        </foreach>
+    </select>
+
+</mapper>

+ 25 - 3
fs-service-system/src/main/resources/mapper/qw/QwExternalContactMapper.xml

@@ -276,7 +276,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectExternalContactPageList" resultType="ExternalContactListVO">
         SELECT
-        qw_external_contact.id,
+        DISTINCT qw_external_contact.id,
         qw_external_contact.qw_user_id,
         qw_external_contact.user_id,
         qw_external_contact.external_user_id,
@@ -295,6 +295,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         qw_external_contact
         LEFT JOIN qw_user ON qw_external_contact.user_id = qw_user.qw_user_id
         LEFT JOIN company_user ON qw_user.company_user_id = company_user.user_id
+        LEFT JOIN qw_tag on qw_tag.corp_id = qw_external_contact.corp_id
         WHERE  company_user.user_id = #{userId}
         <choose>
             <when test = "isBlack">
@@ -305,8 +306,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </otherwise>
         </choose>
         <if test="keyword != null and keyword !='' ">
-            AND (qw_external_contact.NAME LIKE concat('%',#{keyword},'%') or  qw_external_contact.remark_mobiles LIKE concat('%',#{keyword},'%'))
---             AND concat(qw_external_contact.NAME, qw_external_contact.remark_mobiles) LIKE concat('%',#{keyword},'%')
+            AND (qw_external_contact.NAME LIKE concat('%',#{keyword},'%')
+                or  qw_external_contact.remark_mobiles LIKE concat('%',#{keyword},'%')
+                or  qw_tag.`name` LIKE concat('%',#{keyword},'%')
+                )
         </if>
         <if test="registerStartTime != null and registerStartTime !='' ">
         AND qw_external_contact.create_time &gt;= #{registerStartTime}
@@ -490,4 +493,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </update>
+
+    <update id="batchUpdateContactByIds" parameterType="map">
+        update qw_external_contact
+        <trim prefix="set" suffixOverrides=",">
+                     <trim prefix="status = case" suffix="end">
+                         <foreach collection="list" item="item" index="index">
+                             <if test="item.status != null">
+                                 when id= #{item.id}
+                                  then #{item.status}
+                             </if>
+                         </foreach>
+                     </trim>
+        </trim>
+        where contact_id in
+        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+            #{item.id}
+        </foreach>
+    </update>
+
 </mapper>

+ 5 - 1
fs-service-system/src/main/resources/mapper/qw/QwFriendWelcomeMapper.xml

@@ -19,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectQwFriendWelcomeVo">
-        select id, qw_user_ids,corp_id, is_send_msg, welcome_text, attachments, is_dayparting, dayparting_ItemList, company_id, create_time, update_time from qw_friend_welcome
+        select id, qw_user_ids,corp_id, is_send_msg, welcome_text, attachments, is_dayparting, dayparting_ItemList, company_id, create_time, update_time,project from qw_friend_welcome
     </sql>
 
     <select id="selectQwFriendWelcomeListVO" parameterType="QwFriendWelcome" resultMap="QwFriendWelcomeResult">
@@ -33,6 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null "> and create_time = #{createTime}</if>
             <if test="corpId != null "> and corp_id = #{corpId}</if>
             <if test="updateTime != null "> and update_time = #{updateTime}</if>
+            <if test="project != null "> and project = #{project}</if>
         </where>
     </select>
 
@@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="corpId != null">corp_id,</if>
+            <if test="project != null">project,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="qwUserIds != null">#{qwUserIds},</if>
@@ -66,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">#{createTime},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="corpId != null">#{corpId},</if>
+            <if test="project != null">#{project},</if>
          </trim>
     </insert>
 
@@ -82,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="corpId != null">corp_id = #{corpId},</if>
+            <if test="project != null">project = #{project},</if>
         </trim>
         where id = #{id}
     </update>

+ 7 - 1
fs-service-system/src/main/resources/mapper/qw/QwTagMapper.xml

@@ -110,6 +110,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 LEFT JOIN qw_user ON qw_user.qw_user_id = qec.user_id
                 LEFT JOIN company_user cu ON qw_user.company_user_id = cu.user_id
         WHERE
-            cu.user_id = #{userId}
+            cu.user_id = #{param.userId}
+        <if test="keywords != null and keywords.length > 0 ">
+            and
+            <foreach item="item" collection="keywords" open="(" separator="or" close=")">
+                qw_tag.`name` like concat('%',#{item},'%')
+            </foreach>
+        </if>
     </select>
 </mapper>

+ 216 - 0
fs-service-system/src/main/resources/mapper/qw/QwWatchLogMapper.xml

@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fs.qw.mapper.QwWatchLogMapper">
+
+    <resultMap type="QwWatchLog" id="QwWatchLogResult">
+        <result property="id"    column="id"    />
+        <result property="extId"    column="ext_id"    />
+        <result property="qwUserId"    column="qw_user_id"    />
+        <result property="status"    column="status"    />
+        <result property="day"    column="day"    />
+        <result property="project"    column="project"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="lineTime"    column="line_time"    />
+    </resultMap>
+
+    <sql id="selectQwWatchLogVo">
+        select id, ext_id, qw_user_id,line_time, status, day, project, create_time from qw_watch_log
+    </sql>
+
+    <select id="selectQwWatchLogList" parameterType="QwWatchLog" resultMap="QwWatchLogResult">
+        <include refid="selectQwWatchLogVo"/>
+        <where>
+            <if test="extId != null "> and ext_id = #{extId}</if>
+            <if test="qwUserId != null "> and qw_user_id = #{qwUserId}</if>
+            <if test="status != null "> and status = #{status}</if>
+            <if test="day != null "> and day = #{day}</if>
+            <if test="project != null "> and project = #{project}</if>
+        </where>
+    </select>
+
+    <select id="selectQwWatchLogById" parameterType="Long" resultMap="QwWatchLogResult">
+        <include refid="selectQwWatchLogVo"/>
+        where id = #{id}
+    </select>
+    <select id="selectQwWatchLogByCompanyUserId" resultType="com.fs.qw.vo.QwWatchLogStatisticsListVO">
+            select
+            COUNT(CASE WHEN day = 0 and status in (1,2) THEN 1 END) AS firstOnline,
+            COUNT(CASE WHEN day = 0 and status=2 THEN 1 END) AS firstOver,
+            COUNT(CASE WHEN day = 1 and status in (1,2) THEN 1 END) AS d1Online,
+            COUNT(CASE WHEN day = 1 and status=2 THEN 1 END) AS d1Over,
+            COUNT(1) AS line,project,course_id,video_id
+             from qw_watch_log where
+           company_user_id=#{companyUserId}
+            <if test="project != null">
+                and project=#{project}
+            </if>
+            <if test="courseId != null">
+                and course_id=#{courseId}
+            </if>
+            <if test="videoId != null">
+                and video_id=#{videoId}
+            </if>
+           and DATE(line_time) between #{sTime} and #{dTime}
+            group by project,course_id,video_id
+    </select>
+    <select id="selectQwWatchLogAllStatisticsListVONew"
+            resultType="com.fs.qw.vo.QwWatchLogAllStatisticsListVO">
+            select
+            COUNT(CASE WHEN day = 0 and status in (1,2) THEN 1 END) AS firstOnline,
+            COUNT(CASE WHEN day = 0 and status=2 THEN 1 END) AS firstOver,
+            COUNT(CASE WHEN day = 1 and status in (1,2) THEN 1 END) AS d1Online,
+            COUNT(CASE WHEN day = 1 and status=2 THEN 1 END) AS d1Over,
+            COUNT(CASE WHEN day = 2 and status in (1,2) THEN 1 END) AS d2Online,
+            COUNT(CASE WHEN day = 2 and status=2 THEN 1 END) AS d2Over,
+            COUNT(CASE WHEN day = 3 and status in (1,2) THEN 1 END) AS d3Online,
+            COUNT(CASE WHEN day = 3 and status=2 THEN 1 END) AS d3Over,
+            COUNT(CASE WHEN day = 4 and status in (1,2) THEN 1 END) AS d4Online,
+            COUNT(CASE WHEN day = 4 and status=2 THEN 1 END) AS d4Over,
+            COUNT(CASE WHEN day = 5 and status in (1,2) THEN 1 END) AS d5Online,
+            COUNT(CASE WHEN day = 5 and status=2 THEN 1 END) AS d5Over,
+            COUNT(CASE WHEN day = 6 and status in (1,2) THEN 1 END) AS d6Online,
+            COUNT(CASE WHEN day = 6 and status=2 THEN 1 END) AS d6Over,
+            COUNT(CASE WHEN day = 7 and status in (1,2) THEN 1 END) AS d7Online,
+            COUNT(CASE WHEN day = 7 and status=2 THEN 1 END) AS d7Over,
+            COUNT(CASE WHEN day = 8 and status in (1,2) THEN 1 END) AS d8Online,
+            COUNT(CASE WHEN day = 8 and status=2 THEN 1 END) AS d8Over,
+            COUNT(CASE WHEN day = 9 and status in (1,2) THEN 1 END) AS d9Online,
+            COUNT(CASE WHEN day = 9 and status=2 THEN 1 END) AS d9Over,
+            COUNT(CASE WHEN day = 10 and status in (1,2) THEN 1 END) AS d10Online,
+            COUNT(CASE WHEN day = 10 and status=2 THEN 1 END) AS d10Over,
+            COUNT(CASE WHEN day = 11 and status in (1,2) THEN 1 END) AS d11Online,
+            COUNT(CASE WHEN day = 11 and status=2 THEN 1 END) AS d11Over,
+            COUNT(CASE WHEN day = 12 and status in (1,2) THEN 1 END) AS d12Online,
+            COUNT(CASE WHEN day = 12 and status=2 THEN 1 END) AS d12Over,
+            COUNT(CASE WHEN day = 13 and status in (1,2) THEN 1 END) AS d13Online,
+            COUNT(CASE WHEN day = 13 and status=2 THEN 1 END) AS d13Over,
+            COUNT(CASE WHEN day = 14 and status in (1,2) THEN 1 END) AS d14Online,
+            COUNT(CASE WHEN day = 14 and status=2 THEN 1 END) AS d14Over,
+            COUNT(CASE WHEN day = 15 and status in (1,2) THEN 1 END) AS d15Online,
+            COUNT(CASE WHEN day = 15 and status=2 THEN 1 END) AS d15Over,
+            COUNT(CASE WHEN day = 16 and status in (1,2) THEN 1 END) AS d16Online,
+            COUNT(CASE WHEN day = 16 and status=2 THEN 1 END) AS d16Over,
+            COUNT(CASE WHEN day = 17 and status in (1,2) THEN 1 END) AS d17Online,
+            COUNT(CASE WHEN day = 17 and status=2 THEN 1 END) AS d17Over,
+            COUNT(CASE WHEN day = 18 and status in (1,2) THEN 1 END) AS d18Online,
+            COUNT(CASE WHEN day = 18 and status=2 THEN 1 END) AS d18Over,
+            COUNT(CASE WHEN day = 19 and status in (1,2) THEN 1 END) AS d19Online,
+            COUNT(CASE WHEN day = 19 and status=2 THEN 1 END) AS d19Over,
+            COUNT(CASE WHEN day = 20 and status in (1,2) THEN 1 END) AS d20Online,
+            COUNT(CASE WHEN day = 20 and status=2 THEN 1 END) AS d20Over,
+            COUNT(CASE WHEN day = 21 and status in (1,2) THEN 1 END) AS d21Online,
+            COUNT(CASE WHEN day = 21 and status=2 THEN 1 END) AS d21Over,
+            COUNT(CASE WHEN day = 22 and status in (1,2) THEN 1 END) AS d22Online,
+            COUNT(CASE WHEN day = 22 and status=2 THEN 1 END) AS d22Over,
+            COUNT(CASE WHEN day = 23 and status in (1,2) THEN 1 END) AS d23Online,
+            COUNT(CASE WHEN day = 23 and status=2 THEN 1 END) AS d23Over,
+            COUNT(CASE WHEN day = 24 and status in (1,2) THEN 1 END) AS d24Online,
+            COUNT(CASE WHEN day = 24 and status=2 THEN 1 END) AS d24Over,
+            COUNT(CASE WHEN day = 25 and status in (1,2) THEN 1 END) AS d25Online,
+            COUNT(CASE WHEN day = 25 and status=2 THEN 1 END) AS d25Over,
+            COUNT(CASE WHEN day = 26 and status in (1,2) THEN 1 END) AS d26Online,
+            COUNT(CASE WHEN day = 26 and status=2 THEN 1 END) AS d26Over,
+            COUNT(CASE WHEN day = 27 and status in (1,2) THEN 1 END) AS d27Online,
+            COUNT(CASE WHEN day = 27 and status=2 THEN 1 END) AS d27Over,
+            COUNT(CASE WHEN day = 28 and status in (1,2) THEN 1 END) AS d28Online,
+            COUNT(CASE WHEN day = 28 and status=2 THEN 1 END) AS d28Over,
+            COUNT(CASE WHEN day = 29 and status in (1,2) THEN 1 END) AS d29Online,
+            COUNT(CASE WHEN day = 29 and status=2 THEN 1 END) AS d29Over,
+            COUNT(CASE WHEN day = 30 and status in (1,2) THEN 1 END) AS d30Online,
+            COUNT(CASE WHEN day = 30 and status=2 THEN 1 END) AS d30Over,
+            COUNT(1) AS line,project,course_id,video_id
+             from qw_watch_log
+            <where>
+                company_user_id=#{companyUserId}
+                <if test="project != null">
+                    and project = #{project}
+                </if>
+                <if test="courseId != null">
+                    and course_id = #{project}
+                </if>
+                <if test="videoId != null">
+                    and video_id =#{videoId}
+                </if>
+                and DATE(line_time) between #{sDate} AND #{eDate} group by project,course_id,video_id
+            </where>
+    </select>
+
+    <insert id="insertQwWatchLog" parameterType="QwWatchLog" useGeneratedKeys="true" keyProperty="id">
+        insert into qw_watch_log
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="extId != null">ext_id,</if>
+            <if test="qwUserId != null">qw_user_id,</if>
+            <if test="status != null">status,</if>
+            <if test="day != null">day,</if>
+            <if test="project != null">project,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="lineTime != null">line_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="extId != null">#{extId},</if>
+            <if test="qwUserId != null">#{qwUserId},</if>
+            <if test="status != null">#{status},</if>
+            <if test="day != null">#{day},</if>
+            <if test="project != null">#{project},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="lineTime != null">#{lineTime},</if>
+         </trim>
+    </insert>
+
+    <insert id="insertQwWatchLogBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO qw_watch_log (
+        ext_id,
+        qw_user_id,
+        status,
+        day,
+        project,
+        create_time,
+        line_time,
+        fs_user_id,
+        company_id,
+        company_user_id
+        )
+        VALUES
+    <foreach collection="watchLogs" item="log" separator=",">
+            (
+            #{log.extId},
+            #{log.qwUserId},
+            #{log.status},
+            #{log.day},
+            #{log.project},
+            #{log.createTime},
+            #{log.lineTime},
+             #{log.fsUserId},
+             #{log.companyId},
+             #{log.companyUserId}
+            )
+    </foreach>
+    </insert>
+
+    <update id="updateQwWatchLog" parameterType="QwWatchLog">
+        update qw_watch_log
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="extId != null">ext_id = #{extId},</if>
+            <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="day != null">day = #{day},</if>
+            <if test="project != null">project = #{project},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="lineTime != null">line_time = #{lineTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteQwWatchLogById" parameterType="Long">
+        delete from qw_watch_log where id = #{id}
+    </delete>
+
+    <delete id="deleteQwWatchLogByIds" parameterType="String">
+        delete from qw_watch_log where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 154 - 0
fs-service-system/src/main/resources/mapper/qw/QwWorkTaskMapper.xml

@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fs.qw.mapper.QwWorkTaskMapper">
+
+    <resultMap type="QwWorkTask" id="QwWorkTaskResult">
+        <result property="id"    column="id"    />
+        <result property="extId"    column="ext_id"    />
+        <result property="qwUserId"    column="qw_user_id"    />
+        <result property="type"    column="type"    />
+        <result property="status"    column="status"    />
+        <result property="remark"    column="remark"    />
+        <result property="score"    column="score"    />
+        <result property="sopId"    column="sop_id"    />
+        <result property="companyId"    column="company_id"    />
+        <result property="companyUserId"    column="company_user_id"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="title"    column="title"    />
+    </resultMap>
+
+    <sql id="selectQwWorkTaskVo">
+        select id, ext_id, qw_user_id, type,title, status, remark, score, sop_id, company_id, company_user_id, create_time, update_time from qw_work_task
+    </sql>
+
+    <select id="selectQwWorkTaskList" parameterType="QwWorkTask" resultMap="QwWorkTaskResult">
+        <include refid="selectQwWorkTaskVo"/>
+        <where>
+            <if test="extId != null "> and ext_id = #{extId}</if>
+            <if test="qwUserId != null "> and qw_user_id = #{qwUserId}</if>
+            <if test="type != null "> and type = #{type}</if>
+            <if test="status != null "> and status = #{status}</if>
+            <if test="score != null "> and score = #{score}</if>
+            <if test="sopId != null  and sopId != ''"> and sop_id = #{sopId}</if>
+            <if test="companyId != null "> and company_id = #{companyId}</if>
+            <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
+        </where>
+    </select>
+
+    <select id="selectQwWorkTaskById" parameterType="Long" resultMap="QwWorkTaskResult">
+        <include refid="selectQwWorkTaskVo"/>
+        where id = #{id}
+    </select>
+    <select id="selectQwWorkTaskListVONew" resultType="com.fs.qw.vo.QwWorkTaskListVO">
+        select t.* from qw_work_task t
+        <where>
+            DATE(t.create_time) = CURDATE()
+            <if test="extId != null "> and t.ext_id = #{extId}</if>
+            <if test="qwUserId != null "> and t.qw_user_id = #{qwUserId}</if>
+            <if test="type != null "> and t.type = #{type}</if>
+            <if test="status != null "> and t.status = #{status}</if>
+            <if test="score != null "> and t.score = #{score}</if>
+            <if test="sopId != null  and sopId != ''"> and t.sop_id = #{sopId}</if>
+            <if test="companyId != null "> and t.company_id = #{companyId}</if>
+            <if test="companyUserId != null "> and t.company_user_id = #{companyUserId}</if>
+        </where>
+        order by t.score desc,t.id desc
+    </select>
+
+    <insert id="insertQwWorkTask" parameterType="QwWorkTask" useGeneratedKeys="true" keyProperty="id">
+        insert into qw_work_task
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="extId != null">ext_id,</if>
+            <if test="qwUserId != null">qw_user_id,</if>
+            <if test="type != null">type,</if>
+            <if test="status != null">status,</if>
+            <if test="remark != null">remark,</if>
+            <if test="score != null">score,</if>
+            <if test="sopId != null">sop_id,</if>
+            <if test="companyId != null">company_id,</if>
+            <if test="companyUserId != null">company_user_id,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="title != null">title,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="extId != null">#{extId},</if>
+            <if test="qwUserId != null">#{qwUserId},</if>
+            <if test="type != null">#{type},</if>
+            <if test="status != null">#{status},</if>
+            <if test="remark != null">#{remark},</if>
+            <if test="score != null">#{score},</if>
+            <if test="sopId != null">#{sopId},</if>
+            <if test="companyId != null">#{companyId},</if>
+            <if test="companyUserId != null">#{companyUserId},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="title != null">#{title},</if>
+         </trim>
+    </insert>
+
+    <update id="updateQwWorkTask" parameterType="QwWorkTask">
+        update qw_work_task
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="extId != null">ext_id = #{extId},</if>
+            <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
+            <if test="type != null">type = #{type},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="score != null">score = #{score},</if>
+            <if test="sopId != null">sop_id = #{sopId},</if>
+            <if test="companyId != null">company_id = #{companyId},</if>
+            <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="title != null">title = #{title},</if>
+        </trim>
+        where id = #{id}
+    </update>
+    <insert id="insertQwWorkTaskBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO qw_work_task (
+        ext_id,
+        qw_user_id,
+        status,
+        type,
+        title,
+        remark,
+        score,
+        sop_id,
+        company_id,
+        company_user_id,
+        create_time,
+        update_time
+        )
+        VALUES
+        <foreach collection="qwWorkTasks" item="log" separator=",">
+            (
+            #{log.extId},
+            #{log.qwUserId},
+            #{log.status},
+            #{log.type},
+            #{log.title},
+            #{log.remark},
+            #{log.score},
+            #{log.sopId},
+            #{log.companyId},
+            #{log.companyUserId},
+            #{log.createTime},
+            #{log.updateTime}
+            )
+        </foreach>
+    </insert>
+    <delete id="deleteQwWorkTaskById" parameterType="Long">
+        delete from qw_work_task where id = #{id}
+    </delete>
+
+    <delete id="deleteQwWorkTaskByIds" parameterType="String">
+        delete from qw_work_task where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 5 - 1
fs-service-system/src/main/resources/mapper/store/FsStoreProductMapper.xml

@@ -48,10 +48,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="prescribeName"    column="prescribe_name"    />
         <result property="isDisplay"    column="is_display"    />
         <result property="tuiCateId"    column="tui_cate_id"    />
+        <result property="companyIds"    column="company_ids"    />
     </resultMap>
 
     <sql id="selectFsStoreProductVo">
-        select product_id, image,video, slider_image, product_name, product_info, keyword, bar_code, cate_id, price, vip_price, ot_price, postage, unit_name, sort, sales, stock, is_show, is_hot, is_benefit, is_best, is_new, description, create_time, update_time, is_postage, is_del, give_integral, cost, is_good, browse, code_path, temp_id, spec_type, is_integral, integral, product_type, prescribe_code, prescribe_spec, prescribe_factory, prescribe_name,is_display,tui_cate_id from fs_store_product
+        select product_id, image,video, slider_image, product_name, product_info, keyword, bar_code, cate_id, price, vip_price, ot_price, postage, unit_name, sort, sales, stock, is_show, is_hot, is_benefit, is_best, is_new, description, create_time, update_time, is_postage, is_del, give_integral, cost, is_good, browse, code_path, temp_id, spec_type, is_integral, integral, product_type, prescribe_code, prescribe_spec, prescribe_factory, prescribe_name,is_display,tui_cate_id,company_ids from fs_store_product
     </sql>
 
     <select id="selectFsStoreProductList" parameterType="FsStoreProduct" resultMap="FsStoreProductResult">
@@ -150,6 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="prescribeName != null">prescribe_name,</if>
             <if test="isDisplay != null">is_display,</if>
             <if test="tuiCateId != null">tui_cate_id,</if>
+            <if test="companyIds != null and companyIds != ''">company_ids,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="image != null and image != ''">#{image},</if>
@@ -194,6 +196,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="prescribeName != null">#{prescribeName},</if>
             <if test="isDisplay != null">#{isDisplay},</if>
             <if test="tuiCateId != null">#{tuiCateId},</if>
+            <if test="companyIds != null and companyIds != ''">#{company_ids},</if>
          </trim>
     </insert>
 
@@ -242,6 +245,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="prescribeName != null">prescribe_name = #{prescribeName},</if>
             <if test="isDisplay != null">is_display = #{isDisplay},</if>
             <if test="tuiCateId != null">tui_cate_id = #{tuiCateId},</if>
+            <if test="companyIds != null and companyIds != ''">company_ids = #{companyIds},</if>
         </trim>
         where product_id = #{productId}
     </update>

+ 41 - 0
fs-service-system/src/main/resources/mapper/store/FsUserMapper.xml

@@ -89,6 +89,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectFsUserVo"/>
         where user_id = #{userId}
     </select>
+    <select id="selectFsUserListLimit" resultType="com.fs.store.domain.FsUser">
+        <include refid="selectFsUserVo"/>
+        <where>
+            <if test="password != null  and password != ''"> and password = #{password}</if>
+            <if test="realName != null  and realName != ''"> and real_name like concat('%', #{realName}, '%')</if>
+            <if test="birthday != null "> and birthday = #{birthday}</if>
+            <if test="idCard != null  and idCard != ''"> and id_card = #{idCard}</if>
+            <if test="remark != null  and remark != ''"> and remark = #{remark}</if>
+            <if test="avatar != null  and avatar != ''"> and avatar = #{avatar}</if>
+            <if test="lastIp != null  and lastIp != ''"> and last_ip = #{lastIp}</if>
+            <if test="nowMoney != null "> and now_money = #{nowMoney}</if>
+            <if test="brokeragePrice != null "> and brokerage_price = #{brokeragePrice}</if>
+            <if test="integral != null "> and integral = #{integral}</if>
+            <if test="signNum != null "> and sign_num = #{signNum}</if>
+            <if test="status != null "> and status = #{status}</if>
+            <if test="level != null "> and level = #{level}</if>
+            <if test="spreadUserId != null "> and spread_user_id = #{spreadUserId}</if>
+            <if test="spreadTime != null "> and spread_time = #{spreadTime}</if>
+            <if test="userType != null  and userType != ''"> and user_type = #{userType}</if>
+            <if test="isPromoter != null "> and is_promoter = #{isPromoter}</if>
+            <if test="payCount != null "> and pay_count = #{payCount}</if>
+            <if test="spreadCount != null "> and spread_count = #{spreadCount}</if>
+            <if test="addres != null  and addres != ''"> and addres = #{addres}</if>
+            <if test="isDel != null "> and is_del = #{isDel}</if>
+            <if test="companyId != null "> and company_id = #{companyId}</if>
+            <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
+            <if test="registerDate != null "> and DATE_FORMAT(register_date,'%Y-%m-%d') = DATE_FORMAT(#{registerDate},'%Y-%m-%d')</if>
+            <if test="registerCode != null   and registerCode != '' "> and register_code = #{registerCode}</if>
+            <if test="source != null  and source != '' "> and source = #{source}</if>
+            <if test="isShow != null  "> and is_show = #{isShow}</if>
+             <if test="(username != null  and username != '') or (nickname != null  and nickname != '') or (phone != null  and phone != '')">
+                 and (
+                 <if test="username != null  and username != ''"> username like concat('%', #{username}, '%')</if>
+                 <if test="nickname != null  and nickname != ''"> or nickname like concat('%', #{nickname}, '%')</if>
+                 <if test="phone != null  and phone != ''"> or phone like concat('%',#{phone},'%')</if>
+                 )
+             </if>
+        </where>
+        order by user_id desc
+        limit 10
+    </select>
 
     <insert id="insertFsUser" parameterType="FsUser" useGeneratedKeys="true" keyProperty="userId">
         insert into fs_user

+ 9 - 0
fs-service-system/src/test/java/com/fs/course/service/impl/FsCourseWatchLogServiceImplTest.java

@@ -0,0 +1,9 @@
+package com.fs.course.service.impl;
+
+
+public class FsCourseWatchLogServiceImplTest {
+
+
+    void addCourseWatchLogDay() {
+    }
+}

+ 10 - 6
fs-user-app/src/main/java/com/fs/app/controller/CompanyOrderController.java

@@ -1,13 +1,10 @@
 package com.fs.app.controller;
 
 
-import cn.hutool.json.JSONUtil;
 import com.fs.app.annotation.Login;
 import com.fs.common.core.domain.R;
-import com.fs.common.core.redis.RedisCache;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.service.ICompanyUserService;
-import com.fs.store.config.StoreConfig;
 import com.fs.store.domain.FsStoreOrder;
 import com.fs.store.enums.OrderLogEnum;
 import com.fs.store.param.FsStoreProductQueryParam;
@@ -15,7 +12,6 @@ import com.fs.store.service.IFsStoreOrderService;
 import com.fs.store.service.IFsStoreOrderStatusService;
 import com.fs.store.service.IFsStoreProductService;
 import com.fs.store.vo.FsStoreProductListQueryVO;
-import com.fs.system.service.ISysConfigService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -26,7 +22,9 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
 
 @Api("销售订单")
@@ -41,12 +39,18 @@ public class CompanyOrderController extends  AppBaseController {
     private IFsStoreProductService productService;
     @Autowired
     private IFsStoreOrderStatusService orderStatusService;
-    @Autowired
-    private ISysConfigService configService;
 
     @ApiOperation("获取商品列表")
     @GetMapping("/getSalesProducts")
     public R getSalesProducts(FsStoreProductQueryParam param, HttpServletRequest request){
+        // 所属企业过滤
+        Long userId = redisCache.getCacheObject("company-user-token:"+param.getToken());
+        CompanyUser companyUser = companyUserService.selectCompanyUserById(userId);
+        if (Objects.isNull(companyUser)){
+            return R.ok().put("data", new ArrayList<>());
+        }
+        param.setCompanyId(companyUser.getCompanyId());
+
         PageHelper.startPage(param.getPage(), param.getPageSize());
         param.setIsDisplay(0);
         List<FsStoreProductListQueryVO> productList=productService.selectFsStoreProductListQuery(param);