Parcourir la source

统计每个销售的数据

xdd il y a 1 semaine
Parent
commit
88aae3bd84
29 fichiers modifiés avec 880 ajouts et 94 suppressions
  1. 6 6
      fs-admin/src/main/java/com/fs/store/controller/FsIndexController.java
  2. 4 4
      fs-company/src/main/java/com/fs/common/controller/IndexController.java
  3. 47 9
      fs-company/src/main/java/com/fs/company/controller/IndexStatisticsController.java
  4. 2 0
      fs-service-system/src/main/java/com/fs/company/mapper/CompanyUserMapper.java
  5. 2 0
      fs-service-system/src/main/java/com/fs/company/service/ICompanyUserService.java
  6. 5 0
      fs-service-system/src/main/java/com/fs/company/service/impl/CompanyUserServiceImpl.java
  7. 3 3
      fs-service-system/src/main/java/com/fs/course/mapper/FsCourseTrafficLogMapper.java
  8. 6 1
      fs-service-system/src/main/java/com/fs/qw/service/impl/CustomerTransferApprovalServiceImpl.java
  9. 4 0
      fs-service-system/src/main/java/com/fs/statis/dto/AnalysisPreviewQueryDTO.java
  10. 1 1
      fs-service-system/src/main/java/com/fs/statis/mapper/ConsumptionBalanceMapper.java
  11. 17 0
      fs-service-system/src/main/java/com/fs/statis/service/IStatisticsCompanyService.java
  12. 656 10
      fs-service-system/src/main/java/com/fs/statis/service/impl/StatisticsCompanyServiceImpl.java
  13. 5 5
      fs-service-system/src/main/java/com/fs/statis/service/impl/StatisticsServiceImpl.java
  14. 2 11
      fs-service-system/src/main/java/com/fs/store/mapper/FsStoreOrderMapper.java
  15. 2 11
      fs-service-system/src/main/java/com/fs/store/mapper/FsStorePaymentMapper.java
  16. 1 10
      fs-service-system/src/main/java/com/fs/store/mapper/FsStoreProductMapper.java
  17. 2 11
      fs-service-system/src/main/java/com/fs/store/mapper/FsUserMapper.java
  18. 1 1
      fs-service-system/src/main/java/com/fs/store/service/IFsStoreOrderService.java
  19. 1 1
      fs-service-system/src/main/java/com/fs/store/service/IFsStorePaymentService.java
  20. 1 1
      fs-service-system/src/main/java/com/fs/store/service/IFsUserService.java
  21. 2 2
      fs-service-system/src/main/java/com/fs/store/service/impl/FsStoreOrderServiceImpl.java
  22. 2 2
      fs-service-system/src/main/java/com/fs/store/service/impl/FsStorePaymentServiceImpl.java
  23. 2 2
      fs-service-system/src/main/java/com/fs/store/service/impl/FsUserServiceImpl.java
  24. 9 0
      fs-service-system/src/main/resources/mapper/course/FsCourseTrafficLogMapper.xml
  25. 44 3
      fs-service-system/src/main/resources/mapper/statis/ConsumptionBalanceMapper.xml
  26. 13 0
      fs-service-system/src/main/resources/mapper/store/FsStoreOrderMapper.xml
  27. 13 0
      fs-service-system/src/main/resources/mapper/store/FsStorePaymentMapper.xml
  28. 14 0
      fs-service-system/src/main/resources/mapper/store/FsStoreProductMapper.xml
  29. 13 0
      fs-service-system/src/main/resources/mapper/store/FsUserMapper.xml

+ 6 - 6
fs-admin/src/main/java/com/fs/store/controller/FsIndexController.java

@@ -38,16 +38,16 @@ public class FsIndexController
     public R getIndexData()
     {
         Map<String,Object> data=new HashMap<>();
-        Long userCount=userService.selectFsUserCount(0,null);
-        Long dayUserCount=userService.selectFsUserCount(1,null);
+        Long userCount=userService.selectFsUserCount(0,null,null);
+        Long dayUserCount=userService.selectFsUserCount(1,null,null);
         data.put("userCount",userCount);
         data.put("dayUserCount",dayUserCount);
-        Long storeOrderCount=storeOrderService.selectFsStoreOrderTotalCount(0,null);
-        Long dayStoreOrderCount=storeOrderService.selectFsStoreOrderTotalCount(1,null);
+        Long storeOrderCount=storeOrderService.selectFsStoreOrderTotalCount(0,null,null);
+        Long dayStoreOrderCount=storeOrderService.selectFsStoreOrderTotalCount(1,null,null);
         data.put("storeOrderCount",storeOrderCount);
         data.put("dayStoreOrderCount",dayStoreOrderCount);
-        Long paymentCount=paymentService.selectFsStorePaymentCount(0,null);
-        Long dayPaymentCount=paymentService.selectFsStorePaymentCount(1,null);
+        Long paymentCount=paymentService.selectFsStorePaymentCount(0,null,null);
+        Long dayPaymentCount=paymentService.selectFsStorePaymentCount(1,null,null);
         data.put("paymentCount",paymentCount);
         data.put("dayPaymentCount",dayPaymentCount);
         Long productCount=productService.selectFsStoreProductCount(0);

+ 4 - 4
fs-company/src/main/java/com/fs/common/controller/IndexController.java

@@ -50,12 +50,12 @@ public class IndexController
         Long dayCustomerCount=crmCustomerService.selectCrmCustomerCount(1,loginUser.getCompany().getCompanyId());
         data.put("customerCount",customerCount);
         data.put("dayCustomerCount",dayCustomerCount);
-        Long storeOrderCount=storeOrderService.selectFsStoreOrderTotalCount(0,loginUser.getCompany().getCompanyId());
-        Long dayStoreOrderCount=storeOrderService.selectFsStoreOrderTotalCount(1,loginUser.getCompany().getCompanyId());
+        Long storeOrderCount=storeOrderService.selectFsStoreOrderTotalCount(0,loginUser.getCompany().getCompanyId(),null);
+        Long dayStoreOrderCount=storeOrderService.selectFsStoreOrderTotalCount(1,loginUser.getCompany().getCompanyId(),null);
         data.put("storeOrderCount",storeOrderCount);
         data.put("dayStoreOrderCount",dayStoreOrderCount);
-        Long paymentCount=paymentService.selectFsStorePaymentCount(0,loginUser.getCompany().getCompanyId());
-        Long dayPaymentCount=paymentService.selectFsStorePaymentCount(1,loginUser.getCompany().getCompanyId());
+        Long paymentCount=paymentService.selectFsStorePaymentCount(0,loginUser.getCompany().getCompanyId(),null);
+        Long dayPaymentCount=paymentService.selectFsStorePaymentCount(1,loginUser.getCompany().getCompanyId(),null);
         data.put("paymentCount",paymentCount);
         data.put("dayPaymentCount",dayPaymentCount);
 

+ 47 - 9
fs-company/src/main/java/com/fs/company/controller/IndexStatisticsController.java

@@ -45,8 +45,14 @@ public class IndexStatisticsController {
             userType = 0;
         }
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        Long companyUserId = loginUser.getUser().getUserId();
+
         param.setCompanyId(loginUser.getCompany().getCompanyId());
-        analysisPreviewDTO = redisCache.getCacheObject(String.format("%s:%d:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType,param.getCompanyId()));
+        if(loginUser.getUser().isAdmin()) {
+            analysisPreviewDTO = redisCache.getCacheObject(String.format("%s:%d:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType,param.getCompanyId()));
+        } else {
+            analysisPreviewDTO = redisCache.getCacheObject(String.format("%s:%d:%d:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType,param.getCompanyId(),companyUserId));
+        }
 
         return R.ok().put("data",analysisPreviewDTO);
     }
@@ -71,8 +77,14 @@ public class IndexStatisticsController {
     @GetMapping("/trafficLog")
     public R getTrafficLog(){
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        Long companyUserId = loginUser.getUser().getUserId();
         Long companyId = loginUser.getCompany().getCompanyId();
-        TrafficLogDTO trafficLogDTO = redisCache.getCacheObject(String.format("%s:%d",DATA_OVERVIEW_TRAFFIC_LOG,companyId));
+        TrafficLogDTO trafficLogDTO;
+        if(loginUser.getUser().isAdmin()) {
+            trafficLogDTO = redisCache.getCacheObject(String.format("%s:%d",DATA_OVERVIEW_TRAFFIC_LOG,companyId));
+        } else {
+            trafficLogDTO = redisCache.getCacheObject(String.format("%s:%d:%d",DATA_OVERVIEW_TRAFFIC_LOG,companyId,companyUserId));
+        }
         return R.ok().put("data",trafficLogDTO);
     }
 
@@ -91,11 +103,20 @@ public class IndexStatisticsController {
             userType = 0;
         }
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        Long companyUserId = loginUser.getUser().getUserId();
         Long companyId = loginUser.getCompany().getCompanyId();
+
         param.setCompanyId(companyId);
 
-        String key = String.format("%s:%d:%d:%d", DATA_OVERVIEW_DEALER_CHARTS, type,userType,param.getCompanyId());
-        List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = redisCache.getCacheObject(key);
+        List<DeaMemberTopTenDTO> deaMemberTopTenDTOS;
+        if(loginUser.getUser().isAdmin()) {
+            String key = String.format("%s:%d:%d:%d", DATA_OVERVIEW_DEALER_CHARTS, type,userType,companyId);
+            deaMemberTopTenDTOS = redisCache.getCacheObject(key);
+        } else {
+            String key = String.format("%s:%d:%d:%d:%d", DATA_OVERVIEW_DEALER_CHARTS, type,userType,companyId,companyUserId);
+            deaMemberTopTenDTOS = redisCache.getCacheObject(key);
+        }
+
         return R.ok().put("data", deaMemberTopTenDTOS);
     }
 
@@ -117,11 +138,21 @@ public class IndexStatisticsController {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         Long companyId = loginUser.getCompany().getCompanyId();
         param.setCompanyId(companyId);
-
-        List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = redisCache.getCacheObject(String.format("%s:%d:%d:%d:%d", CHARTS_MEMBER_TOP_TEN_WATCH, type, statisticalType,userType,param.getCompanyId()));
-        if(deaMemberTopTenDTOS == null){
-            deaMemberTopTenDTOS = new ArrayList<>();
+        Long companyUserId = loginUser.getUser().getUserId();
+
+        List<DeaMemberTopTenDTO> deaMemberTopTenDTOS;
+        if(loginUser.getUser().isAdmin()) {
+            deaMemberTopTenDTOS = redisCache.getCacheObject(String.format("%s:%d:%d:%d:%d", CHARTS_MEMBER_TOP_TEN_WATCH, type, statisticalType,userType,param.getCompanyId()));
+            if(deaMemberTopTenDTOS == null){
+                deaMemberTopTenDTOS = new ArrayList<>();
+            }
+        } else {
+            deaMemberTopTenDTOS = redisCache.getCacheObject(String.format("%s:%d:%d:%d:%d:%d", CHARTS_MEMBER_TOP_TEN_WATCH, type, statisticalType,userType,param.getCompanyId(),companyUserId));
+            if(deaMemberTopTenDTOS == null){
+                deaMemberTopTenDTOS = new ArrayList<>();
+            }
         }
+
         return R.ok().put("data", deaMemberTopTenDTOS);
     }
 
@@ -135,9 +166,16 @@ public class IndexStatisticsController {
         Integer userType = param.getUserType();
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         Long companyId = loginUser.getCompany().getCompanyId();
+        Long companyUserId = loginUser.getUser().getUserId();
+
         param.setCompanyId(companyId);
+        List<RewardMoneyTopTenDTO> rewardMoneyTopTenDTOS;
+        if(loginUser.getUser().isAdmin()) {
+            rewardMoneyTopTenDTOS = redisCache.getCacheObject( String.format("%s:%d:%d:%d:%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType,userType,param.getCompanyId()));
+        } else {
+            rewardMoneyTopTenDTOS = redisCache.getCacheObject( String.format("%s:%d:%d:%d:%d:%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType,userType,param.getCompanyId(),companyUserId));
+        }
 
-        List<RewardMoneyTopTenDTO> rewardMoneyTopTenDTOS = redisCache.getCacheObject( String.format("%s:%d:%d:%d:%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType,userType,param.getCompanyId()));
         return R.ok().put("data", rewardMoneyTopTenDTOS);
     }
 

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

@@ -298,4 +298,6 @@ public interface CompanyUserMapper
 
     int updateAllowedAllRegister(@Param("status") boolean status, @Param("userIds")List<Long> userIds);
 
+    @Select("select user_id,company_id from company_user")
+    List<CompanyUser> selectAllCompanyUser();
 }

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

@@ -214,4 +214,6 @@ public interface ICompanyUserService {
      */
     Boolean isAllowedAllRegister(boolean status,  List<Long> userIds);
 
+    List<CompanyUser> getAllCompanyUser();
+
 }

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

@@ -537,6 +537,11 @@ public class CompanyUserServiceImpl implements ICompanyUserService
         return true;
     }
 
+    @Override
+    public List<CompanyUser> getAllCompanyUser() {
+        return companyUserMapper.selectAllCompanyUserList();
+    }
+
     /**
      * 批量审核用户
      * @param userIds 用户ID集合

+ 3 - 3
fs-service-system/src/main/java/com/fs/course/mapper/FsCourseTrafficLogMapper.java

@@ -80,20 +80,20 @@ public interface FsCourseTrafficLogMapper
      * @return Long
      */
     Long getTodayTrafficLog();
-    Long getTodayTrafficLogCompanyId(@Param("companyId") Long companyId);
+    Long getTodayTrafficLogCompanyId(@Param("companyId") Long companyId,@Param("companyUserId") Long companyUserId);
 
     /**
      * 获取当月统计流量
      * @return Long
      */
     Long getMonthTrafficLog();
-    Long getMonthTrafficLogCompanyId(@Param("companyId") Long companyId);
+    Long getMonthTrafficLogCompanyId(@Param("companyId") Long companyId,@Param("companyUserId") Long companyUserId);
 
     /**
      * 昨天
      * @return Long
      */
     Long getYesterdayTrafficLog();
-    Long getYesterdayTrafficLogCompanyId(@Param("companyId") Long companyId);
+    Long getYesterdayTrafficLogCompanyId(@Param("companyId") Long companyId,@Param("companyUserId") Long companyUserId);
 
 }

+ 6 - 1
fs-service-system/src/main/java/com/fs/qw/service/impl/CustomerTransferApprovalServiceImpl.java

@@ -146,17 +146,22 @@ public class CustomerTransferApprovalServiceImpl implements ICustomerTransferApp
             FsUser fsUser = fsUserCacheService.selectFsUserById(customerId);
             if(ObjectUtils.isNotNull(fsUser)){
                 String companyUserName = "无";
+                String afterCompanyUserName = "无";
                 if(ObjectUtils.isNotNull(fsUser.getCompanyUserId())){
                     CompanyUser companyUser = companyUserCacheService.selectCompanyUserById(fsUser.getCompanyUserId());
                     companyUserName = String.format("%s_%d", companyUser.getUserName(), companyUser.getUserId());
                 }
+                if(ObjectUtils.isNotNull(item.getTargetUserId())) {
+                    CompanyUser companyUser = companyUserCacheService.selectCompanyUserById(item.getTargetUserId());
+                    afterCompanyUserName = String.format("%s_%d", companyUser.getUserName(), companyUser.getUserId());
+                }
 
                 customerList.add(TransferCustomDTO.builder()
                         .userName(String.format("%s_%d", fsUser.getNickname(), fsUser.getUserId()))
                         .userId(fsUser.getUserId())
                         .beforeCompanyUserName(companyUserName)
                         .beforeCompanyUserId(fsUser.getCompanyUserId())
-                        .afterCompanyUserName(item.getTargetUserName())
+                        .afterCompanyUserName(afterCompanyUserName)
                         .afterCompanyUserId(item.getTargetUserId())
                         .build());
             }

+ 4 - 0
fs-service-system/src/main/java/com/fs/statis/dto/AnalysisPreviewQueryDTO.java

@@ -47,4 +47,8 @@ public class AnalysisPreviewQueryDTO implements Serializable {
      */
     private Long companyId;
 
+    /**
+     * 销售id
+     */
+    private Long companyUserId;
 }

+ 1 - 1
fs-service-system/src/main/java/com/fs/statis/mapper/ConsumptionBalanceMapper.java

@@ -18,7 +18,7 @@ public interface ConsumptionBalanceMapper {
     ConsumptionBalanceDataDTO rechargeConsumption();
 
     DealerAggregatedDTO dealerAggregated();
-    DealerAggregatedDTO dealerAggregatedCompanyId(@Param("companyId") Long companyId);
+    DealerAggregatedDTO dealerAggregatedCompanyId(@Param("companyId") Long companyId,@Param("companyUserId") Long companyUserId);
 
     /**
      * 观看人数

+ 17 - 0
fs-service-system/src/main/java/com/fs/statis/service/IStatisticsCompanyService.java

@@ -13,38 +13,54 @@ public interface IStatisticsCompanyService {
      * 数据概览定时任务
      */
     void dataOverviewTask();
+    void dataOverviewTaskCompanyUser();
 
     /**
      * 分析概览定时任务
      */
     void analysisPreviewTask(Integer type,Integer userType,Long companyId);
+    /**
+     * 分析概览定时任务-销售
+     */
+    void analysisPreviewTask(Integer type,Integer userType,Long companyId,Long companyUserId);
 
 
     /**
      * 会员观看、完播人数趋势图
      */
     void watchEndPlayTrendTask(Integer type,Integer userType,Long companyId);
+    /**
+     * 会员观看、完播人数趋势图-销售
+     */
+    void watchEndPlayTrendTask(Integer type,Integer userType,Long companyId,Long companyUserId);
 
 
     /**
      * 经销商会员观看TOP10
      */
     void companyWatchCourseTopTenTask(Integer type,Integer statisticalType,Integer userType,Long companyId);
+    void companyWatchCourseTopTenTask(Integer type,Integer statisticalType,Integer userType,Long companyId,Long companyUserId);
 
     /**
      * 课程观看TOP10
      */
     void watchCourseTopTenTask(Integer type,Integer statisticalType,Integer userType,String sort,Long companyId);
+    void watchCourseTopTenTask(Integer type,Integer statisticalType,Integer userType,String sort,Long companyId,Long companyUserId);
 
     /**
      * 答题红包金额TOP10
      */
     void rewardMoneyTopTenTask(Integer type,Integer dataType,Integer userType,Long companyId);
+    void rewardMoneyTopTenTask(Integer type,Integer dataType,Integer userType,Long companyId,Long companyUserId);
+
+
     void rewardMoneyTradeTask(Integer type,Integer userType,Long companyId);
+    void rewardMoneyTradeTask(Integer type,Integer userType,Long companyId,Long companyUserId);
 
 
 
     DealerAggregatedDTO dealerAggregated(Long companyId);
+    DealerAggregatedDTO dealerAggregated(Long companyId,Long companyUserId);
 
     /**
      * 消费余额
@@ -95,6 +111,7 @@ public interface IStatisticsCompanyService {
      * @return TrafficLogDTO
      */
     TrafficLogDTO getTrafficLog(Long companyId);
+    TrafficLogDTO getTrafficLog(Long companyId,Long companyUserId);
 
     /**
      * 本月订单数

+ 656 - 10
fs-service-system/src/main/java/com/fs/statis/service/impl/StatisticsCompanyServiceImpl.java

@@ -5,7 +5,12 @@ import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
 import com.fs.common.utils.TimeUtils;
 import com.fs.company.cache.ICompanyCacheService;
+import com.fs.company.domain.Company;
+import com.fs.company.domain.CompanyUser;
+import com.fs.company.mapper.CompanyUserMapper;
 import com.fs.company.service.ICompanyService;
+import com.fs.company.service.ICompanyUserService;
+import com.fs.company.service.impl.CompanyUserServiceImpl;
 import com.fs.course.mapper.FsCourseTrafficLogMapper;
 import com.fs.his.vo.OptionsVO;
 import com.fs.statis.StatisticsRedisConstant;
@@ -75,6 +80,10 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
 
     @Autowired
     private ICompanyService companyService;
+
+    @Autowired
+    private CompanyUserMapper companyUserMapper;
+
     @Override
     public void dataOverviewTask() {
         List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
@@ -87,6 +96,14 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
         }
     }
 
+    @Override
+    public void dataOverviewTaskCompanyUser() {
+        List<CompanyUser> companyUsers = companyUserMapper.selectAllCompanyUser();
+        for (CompanyUser companyUser : companyUsers) {
+            dataOverviewTaskCompany(companyUser.getCompanyId(),companyUser.getUserId());
+        }
+    }
+
     private void dataOverviewTaskCompany(Long companyId){
         DealerAggregatedDTO dealerAggregatedDTO = this.dealerAggregated(companyId);
         ConsumptionBalanceDataDTO consumptionBalanceDataDTO = this.rechargeConsumption(companyId);
@@ -100,6 +117,21 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
         redisCache.setCacheObject(String.format(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_SMS_BALANCE+":%d",companyId), smsBalance);
         redisCache.setCacheObject(String.format(StatisticsRedisConstant.DATA_OVERVIEW_TRAFFIC_LOG+":%d",companyId),trafficLog);
     }
+
+    private void dataOverviewTaskCompany(Long companyId,Long companyUserId){
+        DealerAggregatedDTO dealerAggregatedDTO = this.dealerAggregated(companyId,companyUserId);
+        ConsumptionBalanceDataDTO consumptionBalanceDataDTO = this.rechargeConsumption(companyId);
+        AuthorizationInfoDTO authorizationInfoDTO = authorizationInfo();
+        Long smsBalance = this.smsBalance(companyId);
+        TrafficLogDTO trafficLog = this.getTrafficLog(companyId,companyUserId);
+
+        redisCache.setCacheObject(String.format(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_AGGREGATED+":%d:%d",companyId,companyUserId), dealerAggregatedDTO);
+        redisCache.setCacheObject(String.format(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_BALANCE+":%d:%d",companyId,companyUserId), consumptionBalanceDataDTO);
+        redisCache.setCacheObject(String.format(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_AUTHORIZATION_INFO+":%d:%d",companyId,companyUserId), authorizationInfoDTO);
+        redisCache.setCacheObject(String.format(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_SMS_BALANCE+":%d:%d",companyId,companyUserId), smsBalance);
+        redisCache.setCacheObject(String.format(StatisticsRedisConstant.DATA_OVERVIEW_TRAFFIC_LOG+":%d:%d",companyId,companyUserId),trafficLog);
+    }
+
     public void analysisPreviewTask0(){
         List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
         for (OptionsVO optionsVO : optionsVOS) {
@@ -134,6 +166,41 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
             analysisPreviewTask(4,2,companyId);
         }
     }
+    public void analysisPreviewTask0CompanyUser(){
+        List<CompanyUser> companyUsers = companyUserMapper.selectAllCompanyUser();
+        for (CompanyUser companyUser : companyUsers) {
+            Long companyId = companyUser.getCompanyId();
+            if (companyId == null) {
+                continue;
+            }
+            analysisPreviewTask(0,1,companyId,companyUser.getUserId());
+            analysisPreviewTask(0,2,companyId,companyUser.getUserId());
+        }
+    }
+
+    public void analysisPreviewTask1CompanyUser(){
+        List<CompanyUser> companyUsers = companyUserMapper.selectAllCompanyUser();
+        for (CompanyUser companyUser : companyUsers) {
+            Long companyId = companyUser.getCompanyId();
+            if (companyId == null) {
+                continue;
+            }
+            analysisPreviewTask(0,1,companyId,companyUser.getUserId());
+            analysisPreviewTask(1,1,companyId,companyUser.getUserId());
+            analysisPreviewTask(2,1,companyId,companyUser.getUserId());
+            analysisPreviewTask(3,1,companyId,companyUser.getUserId());
+            analysisPreviewTask(4,1,companyId,companyUser.getUserId());
+
+            analysisPreviewTask(0,2,companyId,companyUser.getUserId());
+            analysisPreviewTask(1,2,companyId,companyUser.getUserId());
+            analysisPreviewTask(2,2,companyId,companyUser.getUserId());
+            analysisPreviewTask(3,2,companyId,companyUser.getUserId());
+            analysisPreviewTask(4,2,companyId,companyUser.getUserId());
+        }
+    }
+
+
+
     @Override
     public void analysisPreviewTask(Integer type, Integer userType,Long companyId) {
         // 根据type计算出时间范围
@@ -192,6 +259,64 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
         redisCache.setCacheObject(String.format("%s:%d:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType,companyId), analysisPreviewDTO);
     }
 
+    @Override
+    public void analysisPreviewTask(Integer type, Integer userType, Long companyId, Long companyUserId) {
+        // 根据type计算出时间范围
+        String startDate = "";
+        String endDate = "";
+
+        LocalDateTime now = LocalDateTime.now();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+        LocalTime startOfDayTime = LocalTime.MIN;
+        LocalTime endOfDayTime = LocalTime.of(23, 59, 59);
+
+        if(0 == type){
+            LocalDateTime startOfDay = now.with(startOfDayTime);
+            LocalDateTime endOfDay = now.with(endOfDayTime);
+            startDate = startOfDay.format(formatter);
+            endDate = endOfDay.format(formatter);
+        } else if(1 == type){
+            LocalDateTime yesterday = now.minusDays(1);
+            LocalDateTime startOfYesterday = yesterday.with(startOfDayTime);
+            LocalDateTime endOfYesterday = yesterday.with(endOfDayTime);
+            startDate = startOfYesterday.format(formatter);
+            endDate = endOfYesterday.format(formatter);
+        } else if(2 == type) {
+            LocalDateTime startOfWeek = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
+            LocalDateTime startOfStartOfWeek = startOfWeek.with(startOfDayTime);
+            LocalDateTime endOfToday = now.with(endOfDayTime);
+            startDate = startOfStartOfWeek.format(formatter);
+            endDate = endOfToday.format(formatter);
+        } else if(3 == type) {
+            LocalDateTime startOfMonth = now.withDayOfMonth(1);
+            LocalDateTime startOfStartOfMonth = startOfMonth.with(startOfDayTime);
+            LocalDateTime endOfToday = now.with(endOfDayTime);
+            startDate = startOfStartOfMonth.format(formatter);
+            endDate = endOfToday.format(formatter);
+        } else if(4 == type) {
+            LocalDateTime firstDayOfPreviousMonth = now.minusMonths(1).withDayOfMonth(1);
+            LocalDateTime lastDayOfPreviousMonth = now.withDayOfMonth(1).minusDays(1);
+
+            LocalDateTime startOfPrevMonthStart = firstDayOfPreviousMonth.with(startOfDayTime);
+            LocalDateTime endOfPrevMonthEnd = lastDayOfPreviousMonth.with(endOfDayTime);
+
+            startDate = startOfPrevMonthStart.format(formatter);
+            endDate = endOfPrevMonthEnd.format(formatter);
+        }
+
+        AnalysisPreviewQueryDTO param = new AnalysisPreviewQueryDTO();
+        param.setStartTime(startDate);
+        param.setEndTime(endDate);
+        param.setType(type);
+        param.setUserType(userType);
+        param.setCompanyId(companyId);
+
+        AnalysisPreviewDTO analysisPreviewDTO = this.analysisPreview(param);
+
+        redisCache.setCacheObject(String.format("%s:%d:%d:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType,companyId,companyUserId), analysisPreviewDTO);
+    }
+
 
     public void watchEndPlayTrendTask0(){
         List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
@@ -204,6 +329,18 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
             this.watchEndPlayTrendTask(0,2,companyId);
         }
 
+    }
+    public void watchEndPlayTrendTask0CompanyUser(){
+        List<CompanyUser> companyUsers = companyUserMapper.selectAllCompanyUser();
+        for (CompanyUser companyUser : companyUsers) {
+            Long companyId = companyUser.getCompanyId();
+            if(companyId == null){
+                continue;
+            }
+            this.watchEndPlayTrendTask(0,1,companyId,companyUser.getUserId());
+            this.watchEndPlayTrendTask(0,2,companyId,companyUser.getUserId());
+        }
+
     }
 
     public void watchEndPlayTrendTask1(){
@@ -224,6 +361,27 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
             this.watchEndPlayTrendTask(4,2,companyId);
         }
 
+    }
+
+    public void watchEndPlayTrendTask1CompanyUser(){
+        List<CompanyUser> companyUsers = companyUserMapper.selectAllCompanyUser();
+
+        for (CompanyUser companyUser : companyUsers) {
+            Long companyId = companyUser.getCompanyId();
+            if(companyId == null){
+                continue;
+            }
+            this.watchEndPlayTrendTask(1,1,companyId,companyUser.getUserId());
+            this.watchEndPlayTrendTask(2,1,companyId,companyUser.getUserId());
+            this.watchEndPlayTrendTask(3,1,companyId,companyUser.getUserId());
+            this.watchEndPlayTrendTask(4,1,companyId,companyUser.getUserId());
+
+            this.watchEndPlayTrendTask(1,2,companyId,companyUser.getUserId());
+            this.watchEndPlayTrendTask(2,2,companyId,companyUser.getUserId());
+            this.watchEndPlayTrendTask(3,2,companyId,companyUser.getUserId());
+            this.watchEndPlayTrendTask(4,2,companyId,companyUser.getUserId());
+        }
+
     }
     @Override
     public void watchEndPlayTrendTask(Integer type, Integer userType,Long companyId) {
@@ -283,6 +441,65 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
         redisCache.setCacheObject(String.format("%s:%d:%d",DATA_OVERVIEW_DEALER_CHARTS,type,userType),watchEndPlayTrendDTOS);
     }
 
+    @Override
+    public void watchEndPlayTrendTask(Integer type, Integer userType, Long companyId, Long companyUserId) {
+        // 根据type计算出时间范围
+        String startDate = "";
+        String endDate = "";
+
+        LocalDateTime now = LocalDateTime.now();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+        LocalTime startOfDayTime = LocalTime.MIN;
+        LocalTime endOfDayTime = LocalTime.of(23, 59, 59);
+
+        if(0 == type){
+            LocalDateTime startOfDay = now.with(startOfDayTime);
+            LocalDateTime endOfDay = now.with(endOfDayTime);
+            startDate = startOfDay.format(formatter);
+            endDate = endOfDay.format(formatter);
+        } else if(1 == type){
+            LocalDateTime yesterday = now.minusDays(1);
+            LocalDateTime startOfYesterday = yesterday.with(startOfDayTime);
+            LocalDateTime endOfYesterday = yesterday.with(endOfDayTime);
+            startDate = startOfYesterday.format(formatter);
+            endDate = endOfYesterday.format(formatter);
+        } else if(2 == type) {
+            LocalDateTime startOfWeek = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
+            LocalDateTime startOfStartOfWeek = startOfWeek.with(startOfDayTime);
+            LocalDateTime endOfToday = now.with(endOfDayTime);
+            startDate = startOfStartOfWeek.format(formatter);
+            endDate = endOfToday.format(formatter);
+        } else if(3 == type) {
+            LocalDateTime startOfMonth = now.withDayOfMonth(1);
+            LocalDateTime startOfStartOfMonth = startOfMonth.with(startOfDayTime);
+            LocalDateTime endOfToday = now.with(endOfDayTime);
+            startDate = startOfStartOfMonth.format(formatter);
+            endDate = endOfToday.format(formatter);
+        } else if(4 == type) {
+            LocalDateTime firstDayOfPreviousMonth = now.minusMonths(1).withDayOfMonth(1);
+            LocalDateTime lastDayOfPreviousMonth = now.withDayOfMonth(1).minusDays(1);
+
+            LocalDateTime startOfPrevMonthStart = firstDayOfPreviousMonth.with(startOfDayTime);
+            LocalDateTime endOfPrevMonthEnd = lastDayOfPreviousMonth.with(endOfDayTime);
+
+            startDate = startOfPrevMonthStart.format(formatter);
+            endDate = endOfPrevMonthEnd.format(formatter);
+        }
+
+        AnalysisPreviewQueryDTO param = new AnalysisPreviewQueryDTO();
+        param.setStartTime(startDate);
+        param.setEndTime(endDate);
+        param.setType(type);
+        param.setCompanyId(companyId);
+
+        param.setUserType(userType);
+        param.setCompanyUserId(companyUserId);
+        List<WatchEndPlayTrendDTO> watchEndPlayTrendDTOS = this.watchEndPlayTrend(param);
+
+        redisCache.setCacheObject(String.format("%s:%d:%d:%d",DATA_OVERVIEW_DEALER_CHARTS,type,userType,companyUserId),watchEndPlayTrendDTOS);
+    }
+
     @Override
     public void companyWatchCourseTopTenTask(Integer type, Integer statisticalType, Integer userType,Long companyId) {
 
@@ -342,6 +559,65 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
         redisCache.setCacheObject(String.format("%s:%d:%d:%d:%d", CHARTS_MEMBER_TOP_TEN_WATCH, type,statisticalType,userType,companyId), deaMemberTopTenDTOS);
     }
 
+    @Override
+    public void companyWatchCourseTopTenTask(Integer type, Integer statisticalType, Integer userType, Long companyId, Long companyUserId) {
+        AnalysisPreviewQueryDTO dto = new AnalysisPreviewQueryDTO();
+        dto.setType(type);
+        dto.setStatisticalType(statisticalType);
+
+        String startDate = "";
+        String endDate = "";
+
+        LocalDateTime now = LocalDateTime.now();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+        LocalTime startOfDayTime = LocalTime.MIN;
+        LocalTime endOfDayTime = LocalTime.of(23, 59, 59);
+
+        if(0 == type){
+            LocalDateTime startOfDay = now.with(startOfDayTime);
+            LocalDateTime endOfDay = now.with(endOfDayTime);
+            startDate = startOfDay.format(formatter);
+            endDate = endOfDay.format(formatter);
+        } else if(1 == type){
+            LocalDateTime yesterday = now.minusDays(1);
+            LocalDateTime startOfYesterday = yesterday.with(startOfDayTime);
+            LocalDateTime endOfYesterday = yesterday.with(endOfDayTime);
+            startDate = startOfYesterday.format(formatter);
+            endDate = endOfYesterday.format(formatter);
+        } else if(2 == type) {
+            LocalDateTime startOfWeek = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
+            LocalDateTime startOfStartOfWeek = startOfWeek.with(startOfDayTime);
+            LocalDateTime endOfToday = now.with(endOfDayTime);
+            startDate = startOfStartOfWeek.format(formatter);
+            endDate = endOfToday.format(formatter);
+        } else if(3 == type) {
+            LocalDateTime startOfMonth = now.withDayOfMonth(1);
+            LocalDateTime startOfStartOfMonth = startOfMonth.with(startOfDayTime);
+            LocalDateTime endOfToday = now.with(endOfDayTime);
+            startDate = startOfStartOfMonth.format(formatter);
+            endDate = endOfToday.format(formatter);
+        } else if(4 == type) {
+            LocalDateTime firstDayOfPreviousMonth = now.minusMonths(1).withDayOfMonth(1);
+            LocalDateTime lastDayOfPreviousMonth = now.withDayOfMonth(1).minusDays(1);
+
+            LocalDateTime startOfPrevMonthStart = firstDayOfPreviousMonth.with(startOfDayTime);
+            LocalDateTime endOfPrevMonthEnd = lastDayOfPreviousMonth.with(endOfDayTime);
+
+            startDate = startOfPrevMonthStart.format(formatter);
+            endDate = endOfPrevMonthEnd.format(formatter);
+        }
+
+        dto.setStartTime(startDate);
+        dto.setEndTime(endDate);
+        dto.setUserType(userType);
+        dto.setCompanyId(companyId);
+        dto.setCompanyUserId(companyUserId);
+
+        List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = deaMemberTopTen(dto);
+        redisCache.setCacheObject(String.format("%s:%d:%d:%d:%d:%d", CHARTS_MEMBER_TOP_TEN_WATCH, type,statisticalType,userType,companyId,companyUserId), deaMemberTopTenDTOS);
+    }
+
     public void companyWatchCourseTopTenTask0(){
         List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
         for (OptionsVO optionsVO : optionsVOS) {
@@ -387,6 +663,56 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
 
 
 
+    }
+
+
+    public void companyWatchCourseTopTenTask0CompanyUser(){
+        List<CompanyUser> companyUsers = companyUserMapper.selectAllCompanyUser();
+        for (CompanyUser companyUser : companyUsers) {
+            Long companyId = companyUser.getCompanyId();
+            if (companyId == null) {
+                continue;
+            }
+            companyWatchCourseTopTenTask(0,0,1,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(0,1,1,companyId,companyUser.getUserId());
+
+
+            companyWatchCourseTopTenTask(0,0,2,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(0,1,2,companyId,companyUser.getUserId());
+        }
+
+
+    }
+
+    public void companyWatchCourseTopTenTask1CompanyUser(){
+        List<CompanyUser> companyUsers = companyUserMapper.selectAllCompanyUser();
+        for (CompanyUser companyUser : companyUsers) {
+            Long companyId = companyUser.getCompanyId();
+            if (companyId == null) {
+                continue;
+            }
+            companyWatchCourseTopTenTask(1,0,1,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(1,1,1,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(2,0,1,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(2,1,1,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(3,0,1,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(3,1,1,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(4,0,1,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(4,1,1,companyId,companyUser.getUserId());
+
+            companyWatchCourseTopTenTask(1,0,2,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(1,1,2,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(2,0,2,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(2,1,2,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(3,0,2,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(3,1,2,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(4,0,2,companyId,companyUser.getUserId());
+            companyWatchCourseTopTenTask(4,1,2,companyId,companyUser.getUserId());
+
+        }
+
+
+
     }
 
     @Override
@@ -448,6 +774,66 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
 
     }
 
+    @Override
+    public void watchCourseTopTenTask(Integer type, Integer statisticalType, Integer userType, String sort, Long companyId, Long companyUserId) {
+        AnalysisPreviewQueryDTO dto = new AnalysisPreviewQueryDTO();
+        dto.setType(type);
+        dto.setStatisticalType(statisticalType);
+        dto.setSort(sort);
+
+        String startDate = "";
+        String endDate = "";
+
+        LocalDateTime now = LocalDateTime.now();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+        LocalTime startOfDayTime = LocalTime.MIN;
+        LocalTime endOfDayTime = LocalTime.of(23, 59, 59);
+
+        if(0 == type){
+            LocalDateTime startOfDay = now.with(startOfDayTime);
+            LocalDateTime endOfDay = now.with(endOfDayTime);
+            startDate = startOfDay.format(formatter);
+            endDate = endOfDay.format(formatter);
+        } else if(1 == type){
+            LocalDateTime yesterday = now.minusDays(1);
+            LocalDateTime startOfYesterday = yesterday.with(startOfDayTime);
+            LocalDateTime endOfYesterday = yesterday.with(endOfDayTime);
+            startDate = startOfYesterday.format(formatter);
+            endDate = endOfYesterday.format(formatter);
+        } else if(2 == type) {
+            LocalDateTime startOfWeek = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
+            LocalDateTime startOfStartOfWeek = startOfWeek.with(startOfDayTime);
+            LocalDateTime endOfToday = now.with(endOfDayTime);
+            startDate = startOfStartOfWeek.format(formatter);
+            endDate = endOfToday.format(formatter);
+        } else if(3 == type) {
+            LocalDateTime startOfMonth = now.withDayOfMonth(1);
+            LocalDateTime startOfStartOfMonth = startOfMonth.with(startOfDayTime);
+            LocalDateTime endOfToday = now.with(endOfDayTime);
+            startDate = startOfStartOfMonth.format(formatter);
+            endDate = endOfToday.format(formatter);
+        } else if(4 == type) {
+            LocalDateTime firstDayOfPreviousMonth = now.minusMonths(1).withDayOfMonth(1);
+            LocalDateTime lastDayOfPreviousMonth = now.withDayOfMonth(1).minusDays(1);
+
+            LocalDateTime startOfPrevMonthStart = firstDayOfPreviousMonth.with(startOfDayTime);
+            LocalDateTime endOfPrevMonthEnd = lastDayOfPreviousMonth.with(endOfDayTime);
+
+            startDate = startOfPrevMonthStart.format(formatter);
+            endDate = endOfPrevMonthEnd.format(formatter);
+        }
+        dto.setStartTime(startDate);
+        dto.setEndTime(endDate);
+        dto.setUserType(userType);
+        dto.setCompanyId(companyId);
+        dto.setCompanyUserId(companyUserId);
+        List<CourseStatsDTO> courseStatsDTOS = watchCourseTopTen(dto);
+
+        redisCache.setCacheObject( String.format("%s:%d:%d:%d:%s:%d:%d", CHARTS_WATCH_TOP_TEN, type,statisticalType,userType,sort,companyId,companyUserId), courseStatsDTOS);
+
+    }
+
 
     public void watchCourseTopTenTask0(){
         List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
@@ -585,6 +971,117 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
 
     }
 
+    public void watchCourseTopTenTask0CompanyUser(){
+        List<CompanyUser> companyUsers = companyUserMapper.selectAllCompanyUser();
+        for (CompanyUser companyUser : companyUsers) {
+            Long companyId = companyUser.getCompanyId();
+            Long userId = companyUser.getUserId();
+
+            if (companyId == null) {
+                continue;
+            }
+
+            watchCourseTopTenTask(0,0,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(0,0,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(0,1,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(0,1,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(0,2,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(0,2,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(0,3,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(0,3,1,"ASC",companyId,userId);
+
+            watchCourseTopTenTask(0,0,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(0,0,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(0,1,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(0,1,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(0,2,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(0,2,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(0,3,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(0,3,1,"ASC",companyId,userId);
+        }
+
+    }
+
+    public void watchCourseTopTenTask1CompanyUser(){
+        List<CompanyUser> companyUsers = companyUserMapper.selectAllCompanyUser();
+
+        for (CompanyUser companyUser : companyUsers) {
+            Long companyId = companyUser.getCompanyId();
+            Long userId = companyUser.getUserId();
+            if (companyId == null) {
+                continue;
+            }
+
+            watchCourseTopTenTask(1,0,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(1,0,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(1,0,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(1,0,2,"ASC",companyId,userId);
+
+            watchCourseTopTenTask(1,1,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(1,1,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(1,1,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(1,1,2,"ASC",companyId,userId);
+            watchCourseTopTenTask(1,2,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(1,2,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(1,2,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(1,2,2,"ASC",companyId,userId);
+
+            watchCourseTopTenTask(1,3,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(1,3,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(1,3,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(1,3,2,"ASC",companyId,userId);
+            watchCourseTopTenTask(2,0,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(2,0,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(2,0,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(2,0,2,"ASC",companyId,userId);
+            watchCourseTopTenTask(2,1,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(2,1,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(2,1,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(2,1,2,"ASC",companyId,userId);
+            watchCourseTopTenTask(2,2,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(2,2,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(2,2,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(2,2,2,"ASC",companyId,userId);
+
+            watchCourseTopTenTask(2,3,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(2,3,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(2,3,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(2,3,2,"ASC",companyId,userId);
+            watchCourseTopTenTask(3,0,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(3,0,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(3,0,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(3,0,2,"ASC",companyId,userId);
+            watchCourseTopTenTask(3,1,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(3,1,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(3,1,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(3,1,2,"ASC",companyId,userId);
+            watchCourseTopTenTask(3,2,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(3,2,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(3,2,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(3,2,2,"ASC",companyId,userId);
+            watchCourseTopTenTask(3,3,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(3,3,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(3,3,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(3,3,2,"ASC",companyId,userId);
+            watchCourseTopTenTask(4,0,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(4,0,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(4,0,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(4,0,2,"ASC",companyId,userId);
+            watchCourseTopTenTask(4,1,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(4,1,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(4,2,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(4,2,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(4,3,1,"DESC",companyId,userId);
+            watchCourseTopTenTask(4,3,1,"ASC",companyId,userId);
+            watchCourseTopTenTask(4,1,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(4,1,2,"ASC",companyId,userId);
+            watchCourseTopTenTask(4,2,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(4,2,2,"ASC",companyId,userId);
+            watchCourseTopTenTask(4,3,2,"DESC",companyId,userId);
+            watchCourseTopTenTask(4,3,2,"ASC",companyId,userId);
+        }
+
+    }
 
     @Override
     public void rewardMoneyTopTenTask(Integer type, Integer dataType, Integer userType,Long companyId) {
@@ -646,6 +1143,66 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
 
     }
 
+    @Override
+    public void rewardMoneyTopTenTask(Integer type, Integer dataType, Integer userType, Long companyId, Long companyUserId) {
+        AnalysisPreviewQueryDTO dto = new AnalysisPreviewQueryDTO();
+        dto.setType(type);
+        dto.setDataType(dataType);
+
+        String startDate = "";
+        String endDate = "";
+
+        LocalDateTime now = LocalDateTime.now();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+        LocalTime startOfDayTime = LocalTime.MIN;
+        LocalTime endOfDayTime = LocalTime.of(23, 59, 59);
+
+        if(0 == type){
+            LocalDateTime startOfDay = now.with(startOfDayTime);
+            LocalDateTime endOfDay = now.with(endOfDayTime);
+            startDate = startOfDay.format(formatter);
+            endDate = endOfDay.format(formatter);
+        } else if(1 == type){
+            LocalDateTime yesterday = now.minusDays(1);
+            LocalDateTime startOfYesterday = yesterday.with(startOfDayTime);
+            LocalDateTime endOfYesterday = yesterday.with(endOfDayTime);
+            startDate = startOfYesterday.format(formatter);
+            endDate = endOfYesterday.format(formatter);
+        } else if(2 == type) {
+            LocalDateTime startOfWeek = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
+            LocalDateTime startOfStartOfWeek = startOfWeek.with(startOfDayTime);
+            LocalDateTime endOfToday = now.with(endOfDayTime);
+            startDate = startOfStartOfWeek.format(formatter);
+            endDate = endOfToday.format(formatter);
+        } else if(3 == type) {
+            LocalDateTime startOfMonth = now.withDayOfMonth(1);
+            LocalDateTime startOfStartOfMonth = startOfMonth.with(startOfDayTime);
+            LocalDateTime endOfToday = now.with(endOfDayTime);
+            startDate = startOfStartOfMonth.format(formatter);
+            endDate = endOfToday.format(formatter);
+        } else if(4 == type) {
+            LocalDateTime firstDayOfPreviousMonth = now.minusMonths(1).withDayOfMonth(1);
+            LocalDateTime lastDayOfPreviousMonth = now.withDayOfMonth(1).minusDays(1);
+
+            LocalDateTime startOfPrevMonthStart = firstDayOfPreviousMonth.with(startOfDayTime);
+            LocalDateTime endOfPrevMonthEnd = lastDayOfPreviousMonth.with(endOfDayTime);
+
+            startDate = startOfPrevMonthStart.format(formatter);
+            endDate = endOfPrevMonthEnd.format(formatter);
+        }
+
+        dto.setStartTime(startDate);
+        dto.setEndTime(endDate);
+        dto.setUserType(userType);
+        dto.setCompanyId(companyId);
+        dto.setCompanyUserId(companyUserId);
+        List<RewardMoneyTopTenDTO> rewardMoneyTopTenDTOS = rewardMoneyTopTen(dto);
+
+        redisCache.setCacheObject( String.format("%s:%d:%d:%d:%d:%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType,userType,companyId,companyUserId), rewardMoneyTopTenDTOS);
+
+    }
+
     @Override
     public void rewardMoneyTradeTask(Integer type, Integer userType,Long companyId) {
         AnalysisPreviewQueryDTO dto = new AnalysisPreviewQueryDTO();
@@ -699,7 +1256,64 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
         dto.setUserType(userType);
         dto.setCompanyId(companyId);
         List<RewardMoneyTrendDTO> rewardMoneyTrendDTOS = rewardMoneyTrendDTO(dto);
-        redisCache.setCacheObject( String.format("%s:%d:%d", CHARTS_REWARD_MONEY_TREND, type,userType), rewardMoneyTrendDTOS);
+        redisCache.setCacheObject( String.format("%s:%d:%d:%d", CHARTS_REWARD_MONEY_TREND, type,userType,companyId), rewardMoneyTrendDTOS);
+
+    }
+
+    @Override
+    public void rewardMoneyTradeTask(Integer type, Integer userType, Long companyId, Long companyUserId) {
+        AnalysisPreviewQueryDTO dto = new AnalysisPreviewQueryDTO();
+        dto.setType(type);
+
+        String startDate = "";
+        String endDate = "";
+
+        LocalDateTime now = LocalDateTime.now();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+        LocalTime startOfDayTime = LocalTime.MIN;
+        LocalTime endOfDayTime = LocalTime.of(23, 59, 59);
+
+        if(0 == type){
+            LocalDateTime startOfDay = now.with(startOfDayTime);
+            LocalDateTime endOfDay = now.with(endOfDayTime);
+            startDate = startOfDay.format(formatter);
+            endDate = endOfDay.format(formatter);
+        } else if(1 == type){
+            LocalDateTime yesterday = now.minusDays(1);
+            LocalDateTime startOfYesterday = yesterday.with(startOfDayTime);
+            LocalDateTime endOfYesterday = yesterday.with(endOfDayTime);
+            startDate = startOfYesterday.format(formatter);
+            endDate = endOfYesterday.format(formatter);
+        } else if(2 == type) {
+            LocalDateTime startOfWeek = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
+            LocalDateTime startOfStartOfWeek = startOfWeek.with(startOfDayTime);
+            LocalDateTime endOfToday = now.with(endOfDayTime);
+            startDate = startOfStartOfWeek.format(formatter);
+            endDate = endOfToday.format(formatter);
+        } else if(3 == type) {
+            LocalDateTime startOfMonth = now.withDayOfMonth(1);
+            LocalDateTime startOfStartOfMonth = startOfMonth.with(startOfDayTime);
+            LocalDateTime endOfToday = now.with(endOfDayTime);
+            startDate = startOfStartOfMonth.format(formatter);
+            endDate = endOfToday.format(formatter);
+        } else if(4 == type) {
+            LocalDateTime firstDayOfPreviousMonth = now.minusMonths(1).withDayOfMonth(1);
+            LocalDateTime lastDayOfPreviousMonth = now.withDayOfMonth(1).minusDays(1);
+
+            LocalDateTime startOfPrevMonthStart = firstDayOfPreviousMonth.with(startOfDayTime);
+            LocalDateTime endOfPrevMonthEnd = lastDayOfPreviousMonth.with(endOfDayTime);
+
+            startDate = startOfPrevMonthStart.format(formatter);
+            endDate = endOfPrevMonthEnd.format(formatter);
+        }
+
+        dto.setStartTime(startDate);
+        dto.setEndTime(endDate);
+        dto.setUserType(userType);
+        dto.setCompanyId(companyId);
+        List<RewardMoneyTrendDTO> rewardMoneyTrendDTOS = rewardMoneyTrendDTO(dto);
+        redisCache.setCacheObject( String.format("%s:%d:%d:%d", CHARTS_REWARD_MONEY_TREND, type,userType,companyId), rewardMoneyTrendDTOS);
 
     }
 
@@ -772,14 +1386,34 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
 
     @Override
     public DealerAggregatedDTO dealerAggregated(Long companyId) {
-        Long dayUserCount=userService.selectFsUserCount(1,companyId);
-        Long storeOrderCount=storeOrderService.selectFsStoreOrderTotalCount(0,companyId);
-        Long dayStoreOrderCount=storeOrderService.selectFsStoreOrderTotalCount(1,companyId);
-        Long paymentCount=paymentService.selectFsStorePaymentCount(0,companyId);
-        Long dayPaymentCount=paymentService.selectFsStorePaymentCount(1,companyId);
+        Long dayUserCount=userService.selectFsUserCount(1,companyId,null);
+        Long storeOrderCount=storeOrderService.selectFsStoreOrderTotalCount(0,companyId,null);
+        Long dayStoreOrderCount=storeOrderService.selectFsStoreOrderTotalCount(1,companyId,null);
+        Long paymentCount=paymentService.selectFsStorePaymentCount(0,companyId,null);
+        Long dayPaymentCount=paymentService.selectFsStorePaymentCount(1,companyId,null);
         Long productCount=productService.selectFsStoreProductCount(0,companyId);
         Long dayProductCount=productService.selectFsStoreProductCount(1,companyId);
-        DealerAggregatedDTO dealerAggregatedDTO = consumptionBalanceMapper.dealerAggregatedCompanyId(companyId);
+        DealerAggregatedDTO dealerAggregatedDTO = consumptionBalanceMapper.dealerAggregatedCompanyId(companyId,null);
+        dealerAggregatedDTO.setTodayIncreaseUserNum(dayUserCount);
+        dealerAggregatedDTO.setOrderTotalNum(storeOrderCount);
+        dealerAggregatedDTO.setTodayOrderNum(dayStoreOrderCount);
+        dealerAggregatedDTO.setRecvTodayNum(paymentCount);
+        dealerAggregatedDTO.setRecvTodayNum(dayPaymentCount);
+        dealerAggregatedDTO.setGoodsTotalNum(productCount);
+        dealerAggregatedDTO.setTodayGoodsNum(dayProductCount);
+        return dealerAggregatedDTO;
+    }
+
+    @Override
+    public DealerAggregatedDTO dealerAggregated(Long companyId, Long companyUserId) {
+        Long dayUserCount=userService.selectFsUserCount(1,companyId,companyUserId);
+        Long storeOrderCount=storeOrderService.selectFsStoreOrderTotalCount(0,companyId,companyUserId);
+        Long dayStoreOrderCount=storeOrderService.selectFsStoreOrderTotalCount(1,companyId,companyUserId);
+        Long paymentCount=paymentService.selectFsStorePaymentCount(0,companyId,companyUserId);
+        Long dayPaymentCount=paymentService.selectFsStorePaymentCount(1,companyId,companyUserId);
+        Long productCount=productService.selectFsStoreProductCount(0,companyId);
+        Long dayProductCount=productService.selectFsStoreProductCount(1,companyId);
+        DealerAggregatedDTO dealerAggregatedDTO = consumptionBalanceMapper.dealerAggregatedCompanyId(companyId,companyUserId);
         dealerAggregatedDTO.setTodayIncreaseUserNum(dayUserCount);
         dealerAggregatedDTO.setOrderTotalNum(storeOrderCount);
         dealerAggregatedDTO.setTodayOrderNum(dayStoreOrderCount);
@@ -1017,9 +1651,21 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
     @Override
     public TrafficLogDTO getTrafficLog(Long companyId) {
         TrafficLogDTO trafficLogDTO = new TrafficLogDTO();
-        Long todayTrafficLog = fsCourseTrafficLogMapper.getTodayTrafficLogCompanyId(companyId);
-        Long yesterdayTrafficLog = fsCourseTrafficLogMapper.getYesterdayTrafficLogCompanyId(companyId);
-        Long monthTrafficLog = fsCourseTrafficLogMapper.getMonthTrafficLogCompanyId(companyId);
+        Long todayTrafficLog = fsCourseTrafficLogMapper.getTodayTrafficLogCompanyId(companyId,null);
+        Long yesterdayTrafficLog = fsCourseTrafficLogMapper.getYesterdayTrafficLogCompanyId(companyId,null);
+        Long monthTrafficLog = fsCourseTrafficLogMapper.getMonthTrafficLogCompanyId(companyId,null);
+        trafficLogDTO.setToday(todayTrafficLog);
+        trafficLogDTO.setThisMonth(monthTrafficLog);
+        trafficLogDTO.setYesterday(yesterdayTrafficLog);
+        return trafficLogDTO;
+    }
+
+    @Override
+    public TrafficLogDTO getTrafficLog(Long companyId, Long companyUserId) {
+        TrafficLogDTO trafficLogDTO = new TrafficLogDTO();
+        Long todayTrafficLog = fsCourseTrafficLogMapper.getTodayTrafficLogCompanyId(companyId,companyUserId);
+        Long yesterdayTrafficLog = fsCourseTrafficLogMapper.getYesterdayTrafficLogCompanyId(companyId,companyUserId);
+        Long monthTrafficLog = fsCourseTrafficLogMapper.getMonthTrafficLogCompanyId(companyId,companyUserId);
         trafficLogDTO.setToday(todayTrafficLog);
         trafficLogDTO.setThisMonth(monthTrafficLog);
         trafficLogDTO.setYesterday(yesterdayTrafficLog);

+ 5 - 5
fs-service-system/src/main/java/com/fs/statis/service/impl/StatisticsServiceImpl.java

@@ -675,11 +675,11 @@ public class StatisticsServiceImpl implements IStatisticsService {
 
     @Override
     public DealerAggregatedDTO dealerAggregated() {
-        Long dayUserCount=userService.selectFsUserCount(1,null);
-        Long storeOrderCount=storeOrderService.selectFsStoreOrderTotalCount(0,null);
-        Long dayStoreOrderCount=storeOrderService.selectFsStoreOrderTotalCount(1,null);
-        Long paymentCount=paymentService.selectFsStorePaymentCount(0,null);
-        Long dayPaymentCount=paymentService.selectFsStorePaymentCount(1,null);
+        Long dayUserCount=userService.selectFsUserCount(1,null,null);
+        Long storeOrderCount=storeOrderService.selectFsStoreOrderTotalCount(0,null,null);
+        Long dayStoreOrderCount=storeOrderService.selectFsStoreOrderTotalCount(1,null,null);
+        Long paymentCount=paymentService.selectFsStorePaymentCount(0,null,null);
+        Long dayPaymentCount=paymentService.selectFsStorePaymentCount(1,null,null);
         Long productCount=productService.selectFsStoreProductCount(0);
         Long dayProductCount=productService.selectFsStoreProductCount(1);
         DealerAggregatedDTO dealerAggregatedDTO = consumptionBalanceMapper.dealerAggregated();

+ 2 - 11
fs-service-system/src/main/java/com/fs/store/mapper/FsStoreOrderMapper.java

@@ -538,17 +538,8 @@ public interface FsStoreOrderMapper
             "</if>" +
             "</script>"})
     FsStoreOrderVO selectFsStoreOrderVOByOrderCode(@Param("orderCode") String orderCode);
-    @Select({"<script> " +
-            "select count(1) from fs_store_order  " +
-            "where 1=1 " +
-            "<if test = 'type != null and  type ==1  '> " +
-            "and  DATE_FORMAT(create_time, '%Y-%m-%d')  = DATE_FORMAT(NOW(), '%Y-%m-%d') " +
-            "</if>" +
-            "<if test = 'companyId != null  '> " +
-            "and  company_id=#{companyId} " +
-            "</if>" +
-            "</script>"})
-    Long selectFsStoreOrderTotalCount(@Param("type")int type,@Param("companyId")Long companyId);
+
+    Long selectFsStoreOrderTotalCount(@Param("type")int type,@Param("companyId")Long companyId,@Param("companyUserId")Long companyUserId);
     @Select({"<script> " +
             "select o.id as orderid ,o.order_code as order_code,o.create_time as orderdate,o.total_price as amount,o.real_name as customername,o.user_phone as tel,o.user_address as address,o.delivery_name as express,o.delivery_id as packageno   from fs_store_order o  " +
             "where o.is_del=0 and o.is_sys_del=0 " +

+ 2 - 11
fs-service-system/src/main/java/com/fs/store/mapper/FsStorePaymentMapper.java

@@ -275,17 +275,8 @@ public interface FsStorePaymentMapper
     @Select("select * from fs_store_payment where business_type=2 and order_id=#{orderId} and status=1   ")
     List<FsStorePayment> selectFsStorePaymentByOrderId(Long orderId);
 
-    @Select({"<script> " +
-            "select count(1) from fs_store_payment  " +
-            "where business_type=1 and status=1 " +
-            "<if test = 'type != null and  type ==1  '> " +
-            "and  DATE_FORMAT(create_time, '%Y-%m-%d')  = DATE_FORMAT(NOW(), '%Y-%m-%d') " +
-            "</if>" +
-            "<if test = 'companyId != null  '> " +
-            "and  company_id=#{companyId} " +
-            "</if>" +
-            "</script>"})
-    Long selectFsStorePaymentCount(@Param("type") int type,@Param("companyId") Long companyId);
+
+    Long selectFsStorePaymentCount(@Param("type") int type,@Param("companyId") Long companyId,@Param("companyUserId") Long companyUserId);
 
     List<JSONObject> selectFsStorePaymentCounts(Map<String, Object> toMap);
 

+ 1 - 10
fs-service-system/src/main/java/com/fs/store/mapper/FsStoreProductMapper.java

@@ -182,16 +182,7 @@ public interface FsStoreProductMapper
             "</if>" +
             "</script>"})
     Long selectFsStoreProductCount(@Param("type") int type );
-    @Select({"<script> " +
-            "select count(1) from fs_store_product  " +
-            "where 1=1 " +
-            "<if test = 'type != null and  type ==1  '> " +
-            "and  DATE_FORMAT(create_time, '%Y-%m-%d')  = DATE_FORMAT(NOW(), '%Y-%m-%d') " +
-            "</if>" +
-            "<if test = 'companyIds != null and companyIds != \"\" '> " +
-            "and find_in_set(#{companyIds}, company_ids) " +
-            "</if>" +
-            "</script>"})
+
     Long selectFsStoreProductCompanyCount(@Param("type") int type,@Param("companyIds") Long companyIds);
 
     @Select({"<script> " +

+ 2 - 11
fs-service-system/src/main/java/com/fs/store/mapper/FsUserMapper.java

@@ -162,17 +162,8 @@ public interface FsUserMapper
             "order by tui_money desc " +
             "</script>"})
     List<FsUserTuiVO> selectFsUserTuiList(String userId);
-    @Select({"<script> " +
-            "select count(1) from fs_user  " +
-            "where 1=1 " +
-            "<if test = 'type != null and  type ==1  '> " +
-            "and  DATE_FORMAT(create_time, '%Y-%m-%d')  = DATE_FORMAT(NOW(), '%Y-%m-%d') " +
-            "</if>" +
-            "<if test = 'companyId != null  '> " +
-            "and  company_id=#{companyId} " +
-            "</if>" +
-            "</script>"})
-    Long selectFsUserCount(@Param("type") int type,@Param("companyId") Long companyId);
+
+    Long selectFsUserCount(@Param("type") int type,@Param("companyId") Long companyId,@Param("companyUserId") Long companyUserId);
 
     @Select("select * from fs_user where ma_open_id=#{openid}")
     FsUser selectFsUserByMaOpenId(String openid);

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

@@ -144,7 +144,7 @@ public interface IFsStoreOrderService
 
     FsStoreOrderVO selectFsStoreOrderVOByOrderCode(String orderCode);
 
-    Long selectFsStoreOrderTotalCount(int type,Long companyId);
+    Long selectFsStoreOrderTotalCount(int type,Long companyId,Long companyUserId);
 
     R editTuiMoney(FsStoreOrderEditTuiMoneyParam param);
 

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

@@ -87,7 +87,7 @@ public interface IFsStorePaymentService
 
     List<FsStorePayment> selectFsStorePaymentByOrderId(Long orderId);
 
-    Long selectFsStorePaymentCount(int type,Long companyId);
+    Long selectFsStorePaymentCount(int type,Long companyId,Long companyUserId);
 
     String payConfirm(String payCode,String tradeNo,String bankTransactionId,String bankSerialNo);
 

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

@@ -110,7 +110,7 @@ public interface IFsUserService
 
     List<FsUserTuiVO> selectFsUserTuiList(String userId);
 
-    Long selectFsUserCount(int type,Long companyId);
+    Long selectFsUserCount(int type,Long companyI,Long companyUserId);
 
     void addTuiMoney(FsStoreOrder order, List<FsStoreOrderItem> items);
 

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

@@ -1654,8 +1654,8 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
     }
 
     @Override
-    public Long selectFsStoreOrderTotalCount(int type,Long companyId) {
-        return fsStoreOrderMapper.selectFsStoreOrderTotalCount(type,companyId);
+    public Long selectFsStoreOrderTotalCount(int type,Long companyId,Long companyUserId) {
+        return fsStoreOrderMapper.selectFsStoreOrderTotalCount(type,companyId,companyUserId);
     }
 
     @Override

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

@@ -298,8 +298,8 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService
     }
 
     @Override
-    public Long selectFsStorePaymentCount(int type,Long companyId) {
-        return fsStorePaymentMapper.selectFsStorePaymentCount(type,companyId);
+    public Long selectFsStorePaymentCount(int type,Long companyId,Long companyUserId) {
+        return fsStorePaymentMapper.selectFsStorePaymentCount(type,companyId,companyUserId);
     }
 
     @Override

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

@@ -282,8 +282,8 @@ public class FsUserServiceImpl implements IFsUserService
     }
 
     @Override
-    public Long selectFsUserCount(int type,Long companyId) {
-        return fsUserMapper.selectFsUserCount(type,companyId);
+    public Long selectFsUserCount(int type,Long companyId,Long companyUserId) {
+        return fsUserMapper.selectFsUserCount(type,companyId,companyUserId);
     }
 
     @Override

+ 9 - 0
fs-service-system/src/main/resources/mapper/course/FsCourseTrafficLogMapper.xml

@@ -111,6 +111,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="companyId != null">
                 AND company_id = ${companyId}
             </if>
+            <if test="companyUserId != null">
+                AND company_user_id = #{companyUserId}
+            </if>
         </where>
 
     </select>
@@ -125,6 +128,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="companyId != null">
                 AND company_id = ${companyId}
             </if>
+            <if test="companyUserId != null">
+                AND company_user_id = #{companyUserId}
+            </if>
         </where>
     </select>
     <select id="getYesterdayTrafficLogCompanyId" resultType="java.lang.Long">
@@ -137,6 +143,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="companyId != null">
                 AND company_id = ${companyId}
             </if>
+            <if test="companyUserId != null">
+                AND company_user_id = #{companyUserId}
+            </if>
         </where>
 
     </select>

+ 44 - 3
fs-service-system/src/main/resources/mapper/statis/ConsumptionBalanceMapper.xml

@@ -50,6 +50,9 @@
             <if test="companyId != null">
                 and company_id = #{companyId}
             </if>
+            <if test="companyUserId != null">
+                and company_user_id = #{companyUserId}
+            </if>
         </where>
     </select>
     <select id="queryCompletedUserCount" resultType="java.lang.Long">
@@ -65,6 +68,9 @@
             <if test="companyId != null">
                 and company_id = #{companyId}
             </if>
+            <if test="companyUserId != null">
+                and company_user_id = #{companyUserId}
+            </if>
         </where>
     </select>
     <select id="queryWatchUserCount" resultType="java.lang.Long">
@@ -79,7 +85,9 @@
             <if test="companyId != null">
                 and company_id = #{companyId}
             </if>
-
+            <if test="companyUseId != null">
+                and company_user_id = #{companyUserId}
+            </if>
         </where>
     </select>
     <select id="queryCompletedCount" resultType="java.lang.Long">
@@ -95,6 +103,9 @@
              <if test="companyId != null">
                  and company_id = #{companyId}
              </if>
+             <if test="companyUserId != null">
+                 and company_user_id = #{companyUserId}
+             </if>
          </where>
     </select>
     <select id="queryAnswerMemberCount" resultType="java.lang.Long">
@@ -106,6 +117,9 @@
            <if test="companyId != null">
                and company_id = #{companyId}
            </if>
+           <if test="companyUserId != null">
+               and company_user_id = #{companyUserId}
+           </if>
        </where>
     </select>
     <select id="queryCorrectUserCount" resultType="java.lang.Long">
@@ -118,6 +132,9 @@
             <if test="companyId != null">
                 and company_id = #{companyId}
             </if>
+            <if test="companyUserId != null">
+                and company_user_id = #{companyUserId}
+            </if>
         </where>
     </select>
     <select id="queryRewardCount" resultType="java.lang.Long">
@@ -134,6 +151,9 @@
             <if test="companyId != null">
                 and log.company_id = #{companyId}
             </if>
+            <if test="companyUserId != null">
+                and log.company_user_id = #{companyUserId}
+            </if>
         </where>
     </select>
     <select id="queryRewardMoney" resultType="java.math.BigDecimal">
@@ -150,6 +170,9 @@
             <if test="companyId != null">
                 and log.company_id = #{companyId}
             </if>
+            <if test="companyUserId != null">
+                and log.company_user_id = #{companyUserId}
+            </if>
         </where>
     </select>
     <select id="smsBalance" resultType="java.lang.Long">
@@ -243,11 +266,14 @@
                 AND w.create_time <![CDATA[<]]> #{endTime}
             </if>
             <if test="userType != null">
-                AND send_type = ${userType}
+                AND w.send_type = ${userType}
             </if>
             <if test="companyId != null">
                 AND w.company_id = ${companyId}
             </if>
+            <if test="companyUserId != null">
+                AND w.company_user_id= #{companyUserId}
+            </if>
         </where>
         GROUP BY
         w.course_id
@@ -349,12 +375,18 @@
                                      <if test="companyId != null">
                                          company_id = #{companyId}
                                      </if>
+                                     <if test="companyUserId != null">
+                                         AND user_id = #{companyUserId}
+                                     </if>
                                  </where>
                                  ) AS group_mgr_count,
                 (SELECT COUNT(*) FROM FS_USER
                                 <where>
                                     <if test="companyId != null">
-                                        company_id = #{companyId}
+                                        AND company_id = #{companyId}
+                                    </if>
+                                    <if test="companyUserId != null">
+                                        AND company_user_id = #{companyUserId}
                                     </if>
                                 </where>
                                 ) AS member_count,
@@ -364,6 +396,9 @@
                                     <if test="companyId != null">
                                         AND company_id = #{companyId}
                                     </if>
+                                    <if test="companyUserId != null">
+                                        AND company_user_id = #{companyUserId}
+                                    </if>
                                 </where>
                                 ) AS normal_num,
                 (SELECT COUNT(*) FROM FS_USER
@@ -372,6 +407,9 @@
                                     <if test="companyId != null">
                                         AND company_id = #{companyId}
                                     </if>
+                                    <if test="companyUserId != null">
+                                        AND company_user_id = #{companyUserId}
+                                    </if>
                                 </where>
                 ) AS black_num,
                 (select COUNT(*) FROM qw_user
@@ -379,6 +417,9 @@
                     <if test="companyId != null">
                        AND company_id = ${companyId}
                     </if>
+                    <if test="companyUserId != null">
+                        AND company_user_id = #{companyUserId}
+                    </if>
                 </where>
         ) AS qw_member_num
     </select>

+ 13 - 0
fs-service-system/src/main/resources/mapper/store/FsStoreOrderMapper.xml

@@ -530,4 +530,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
 
     </select>
+    <select id="selectFsStoreOrderTotalCount" resultType="java.lang.Long">
+        select count(1) from fs_store_order
+        where 1=1
+        <if test = "type != null and  type ==1  ">
+            and  DATE_FORMAT(create_time, '%Y-%m-%d')  = DATE_FORMAT(NOW(), '%Y-%m-%d')
+        </if>
+        <if test = "companyId != null">
+            and  company_id = #{companyId}
+        </if>
+        <if test="companyUserId != null">
+            and company_user_id = #{companyUserId}
+        </if>
+    </select>
 </mapper>

+ 13 - 0
fs-service-system/src/main/resources/mapper/store/FsStorePaymentMapper.xml

@@ -178,6 +178,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ) t
         GROUP BY t.type
     </select>
+    <select id="selectFsStorePaymentCount" resultType="java.lang.Long">
+        select count(1) from fs_store_payment
+        where business_type=1 and status=1
+        <if test = "type != null and  type ==1">
+            and DATE_FORMAT(create_time, '%Y-%m-%d')  = DATE_FORMAT(NOW(), '%Y-%m-%d')
+        </if>
+        <if test = "companyId != null">
+            and company_id = #{companyId}
+        </if>
+        <if test="companyUserId != null">
+            and company_user_id = #{companyUserId}
+        </if>
+    </select>
 
 
 </mapper>

+ 14 - 0
fs-service-system/src/main/resources/mapper/store/FsStoreProductMapper.xml

@@ -105,6 +105,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectFsStoreProductVo"/>
         where product_id = #{productId}
     </select>
+    <select id="selectFsStoreProductCompanyCount" resultType="java.lang.Long">
+        select count(1) from fs_store_product
+        <where>
+            <if test = 'type != null and  type ==1  '>
+                and  DATE_FORMAT(create_time, '%Y-%m-%d')  = DATE_FORMAT(NOW(), '%Y-%m-%d')
+            </if>
+            <if test = 'companyIds != null and companyIds != "" '>
+                and find_in_set(#{companyIds}, company_ids)
+            </if>
+            <if test="companyUserId != null">
+                and
+            </if>
+        </where>
+    </select>
 
     <insert id="insertFsStoreProduct" parameterType="FsStoreProduct" useGeneratedKeys="true" keyProperty="productId">
         insert into fs_store_product

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

@@ -1748,6 +1748,19 @@
         </where>
         order by user_id desc
     </select>
+    <select id="selectFsUserCount" resultType="java.lang.Long">
+        select count(1) from fs_user
+        where 1=1
+        <if test = "type != null and  type ==1">
+            and DATE_FORMAT(create_time, '%Y-%m-%d')  = DATE_FORMAT(NOW(), '%Y-%m-%d')
+        </if>
+        <if test = "companyId != null">
+            and company_id=#{companyId}
+        </if>
+        <if test="companyUserId != null">
+            and company_user_id = #{companyUserId}
+        </if>
+    </select>
     <select id="countUserCourse2" resultType="java.util.Map">
         SELECT
         (