|
@@ -1,6 +1,7 @@
|
|
package com.fs.store.service.impl;
|
|
package com.fs.store.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.math.RoundingMode;
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -20,8 +21,6 @@ import com.fs.company.service.ICompanyUserService;
|
|
import com.fs.company.vo.CompanyQueryVo;
|
|
import com.fs.company.vo.CompanyQueryVo;
|
|
import com.fs.qw.param.QwFsUserParam;
|
|
import com.fs.qw.param.QwFsUserParam;
|
|
import com.fs.qw.vo.QwFsUserVO;
|
|
import com.fs.qw.vo.QwFsUserVO;
|
|
-import com.fs.qw.vo.newvo.ExternalContactNumVO;
|
|
|
|
-import com.fs.qw.vo.newvo.ExternalContactPageVO;
|
|
|
|
import com.fs.store.domain.FsStoreOrder;
|
|
import com.fs.store.domain.FsStoreOrder;
|
|
import com.fs.store.domain.FsStoreOrderItem;
|
|
import com.fs.store.domain.FsStoreOrderItem;
|
|
import com.fs.store.domain.FsUserBill;
|
|
import com.fs.store.domain.FsUserBill;
|
|
@@ -42,6 +41,7 @@ import com.fs.store.vo.h5.FsUserPageListVO;
|
|
import com.fs.store.vo.h5.UserDetailsVO;
|
|
import com.fs.store.vo.h5.UserDetailsVO;
|
|
import com.fs.store.vo.h5.UserListCountVO;
|
|
import com.fs.store.vo.h5.UserListCountVO;
|
|
import com.fs.store.vo.h5.UserListPageVO;
|
|
import com.fs.store.vo.h5.UserListPageVO;
|
|
|
|
+import com.fs.store.vo.h5.*;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -401,7 +401,6 @@ public class FsUserServiceImpl implements IFsUserService
|
|
return R.error("清除vip失败");
|
|
return R.error("清除vip失败");
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public FsUser selectFsUserByUnionid(String unionId) {
|
|
public FsUser selectFsUserByUnionid(String unionId) {
|
|
return fsUserMapper.selectFsUserByUnionid(unionId);
|
|
return fsUserMapper.selectFsUserByUnionid(unionId);
|
|
@@ -420,10 +419,11 @@ public class FsUserServiceImpl implements IFsUserService
|
|
@Override
|
|
@Override
|
|
public UserListPageVO getUserNumber(Long userId) {
|
|
public UserListPageVO getUserNumber(Long userId) {
|
|
List<UserListCountVO> list = fsUserMapper.getUserNumber(userId);
|
|
List<UserListCountVO> list = fsUserMapper.getUserNumber(userId);
|
|
- Map<String, Integer> map = list.stream().collect(Collectors.toMap(UserListCountVO::getStatus, UserListCountVO::getNum, (v1, v2) -> v1));
|
|
|
|
|
|
+ Map<String, Integer> map = list.stream()
|
|
|
|
+ .collect(Collectors.toMap(UserListCountVO::getStatus, UserListCountVO::getNum, (v1, v2) -> v1));
|
|
UserListPageVO pageVO = new UserListPageVO();
|
|
UserListPageVO pageVO = new UserListPageVO();
|
|
- pageVO.setNumber(map.getOrDefault("1",0));
|
|
|
|
- pageVO.setBlackNum(map.getOrDefault("0",0));
|
|
|
|
|
|
+ pageVO.setNumber(map.getOrDefault("1", 0));
|
|
|
|
+ pageVO.setBlackNum(map.getOrDefault("0", 0));
|
|
return pageVO;
|
|
return pageVO;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -445,11 +445,11 @@ public class FsUserServiceImpl implements IFsUserService
|
|
@Override
|
|
@Override
|
|
public Boolean disabledUser(String[] ids, boolean status) {
|
|
public Boolean disabledUser(String[] ids, boolean status) {
|
|
boolean result;
|
|
boolean result;
|
|
- if(status){
|
|
|
|
- //启用
|
|
|
|
|
|
+ if (status) {
|
|
|
|
+ // 启用
|
|
result = fsUserMapper.batchUpdateFsUserByIds(ids, 1) > 0;
|
|
result = fsUserMapper.batchUpdateFsUserByIds(ids, 1) > 0;
|
|
} else {
|
|
} else {
|
|
- //禁用
|
|
|
|
|
|
+ // 禁用
|
|
result = fsUserMapper.batchUpdateFsUserByIds(ids, 0) > 0;
|
|
result = fsUserMapper.batchUpdateFsUserByIds(ids, 0) > 0;
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
@@ -473,4 +473,71 @@ public class FsUserServiceImpl implements IFsUserService
|
|
public Map<String, Long> getUserVipCountByCompanyUserId(Long companyUserId) {
|
|
public Map<String, Long> getUserVipCountByCompanyUserId(Long companyUserId) {
|
|
return fsUserMapper.getUserVipCountByCompanyUserId(companyUserId);
|
|
return fsUserMapper.getUserVipCountByCompanyUserId(companyUserId);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public FsUserSummaryCountVO userSummaryCount(Long userId) {
|
|
|
|
+ FsUserSummaryCountVO fsUserSummaryCountVO = fsUserMapper.countUserSummary(userId);
|
|
|
|
+ List<FsUserSummaryCountTagVO> countTagList = fsUserMapper.countTag(userId);
|
|
|
|
+ fsUserSummaryCountVO.setTagList(countTagList);
|
|
|
|
+ return fsUserSummaryCountVO;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public FsUserStatisticsVO userStatistics(Long userId, String startTime, String endTime, String courseId, String videoId) {
|
|
|
|
+ return getUserStatistics(userId, startTime, endTime, courseId, videoId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private FsUserStatisticsVO getUserStatistics(Long userId, String startTime, String endTime, String courseId, String videoId) {
|
|
|
|
+ FsUserStatisticsVO fsUserStatisticsVO = new FsUserStatisticsVO();
|
|
|
|
+
|
|
|
|
+ // 获取课程统计
|
|
|
|
+ Map<String, Long> couserMap = fsUserMapper.countUserCourse(userId, startTime, endTime, courseId, videoId);
|
|
|
|
+ if (couserMap != null) {
|
|
|
|
+ fsUserStatisticsVO.setCourseWatchNum(couserMap.get("courseWatchNum").intValue()).setCourseCompleteNum(couserMap.get("courseCompleteNum").intValue());
|
|
|
|
+
|
|
|
|
+ if (couserMap.get("courseCompleteNum") != null && couserMap.get("courseWatchNum") > 0) {
|
|
|
|
+ int courseCompleteRate = BigDecimal.valueOf(couserMap.get("courseCompleteNum"))
|
|
|
|
+ .divide(BigDecimal.valueOf(couserMap.get("courseWatchNum")), 2, RoundingMode.HALF_UP)
|
|
|
|
+ .multiply(BigDecimal.valueOf(100))
|
|
|
|
+ .intValue();
|
|
|
|
+ fsUserStatisticsVO.setCourseCompleteRate(courseCompleteRate);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 获取答题统计
|
|
|
|
+ Map<String, Long> answerMap = fsUserMapper.countUserAnswer(userId, startTime, endTime, courseId, videoId);
|
|
|
|
+ if (answerMap != null) {
|
|
|
|
+ fsUserStatisticsVO.setAnswerNum(answerMap.get("answerNum").intValue()).setAnswerRightNum(answerMap.get("answerRightNum").intValue());
|
|
|
|
+
|
|
|
|
+ if (answerMap.get("answerRightNum") != null && answerMap.get("answerNum") > 0) {
|
|
|
|
+ int answerCompleteRate = BigDecimal.valueOf(answerMap.get("answerRightNum"))
|
|
|
|
+ .divide(BigDecimal.valueOf(answerMap.get("answerNum")), 2, RoundingMode.HALF_UP)
|
|
|
|
+ .multiply(BigDecimal.valueOf(100))
|
|
|
|
+ .intValue();
|
|
|
|
+ fsUserStatisticsVO.setAnswerRightRate(answerCompleteRate);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 获取红包统计
|
|
|
|
+ Map<String, Object> redPacketMap = fsUserMapper.countUserRedPacket(userId, startTime, endTime, courseId, videoId);
|
|
|
|
+ if(redPacketMap != null && redPacketMap.get("redPacketNum") != null && redPacketMap.get("redPacketAmount") != null) {
|
|
|
|
+ fsUserStatisticsVO.setRedPacketNum(Integer.parseInt(redPacketMap.get("redPacketNum").toString()))
|
|
|
|
+ .setRedPacketAmount(new BigDecimal(redPacketMap.get("redPacketAmount").toString()));
|
|
|
|
+ }
|
|
|
|
+ return fsUserStatisticsVO;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public FsUserStatisticsVO userStatisticsDetails(Long userId, String courseId, String videoId) {
|
|
|
|
+ FsUserStatisticsVO userStatisticsVO = getUserStatistics(userId, null, null, courseId, videoId);
|
|
|
|
+
|
|
|
|
+ //统计课程数据详情,在查询统计详情的时候需要显示
|
|
|
|
+ Map<String, Long> courseDetailsMap = fsUserMapper.countCourseDetails(userId, courseId, videoId);
|
|
|
|
+ if(courseDetailsMap != null && courseDetailsMap.get("courseNum") != null && courseDetailsMap.get("videoNum") != null && courseDetailsMap.get("courseUserNum") != null){
|
|
|
|
+ userStatisticsVO.setCourseNum(Integer.parseInt(courseDetailsMap.get("courseNum").toString()))
|
|
|
|
+ .setVideoNum(Integer.parseInt(courseDetailsMap.get("videoNum").toString()))
|
|
|
|
+ .setCourseUserNum(Integer.parseInt(courseDetailsMap.get("courseUserNum").toString()));
|
|
|
|
+ }
|
|
|
|
+ return userStatisticsVO;
|
|
|
|
+ }
|
|
}
|
|
}
|