|
@@ -1,6 +1,7 @@
|
|
|
package com.fs.app.service.impl;
|
|
package com.fs.app.service.impl;
|
|
|
|
|
|
|
|
import com.fs.app.service.IMemberReportService;
|
|
import com.fs.app.service.IMemberReportService;
|
|
|
|
|
+import com.fs.app.vo.SalesMemberReportVO;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -9,6 +10,7 @@ import com.fs.app.params.MemberReportQuery;
|
|
|
import com.fs.app.vo.MemberReportVO;
|
|
import com.fs.app.vo.MemberReportVO;
|
|
|
import com.fs.app.mapper.MemberReportMapper;
|
|
import com.fs.app.mapper.MemberReportMapper;
|
|
|
|
|
|
|
|
|
|
+import java.util.Collections;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
@@ -76,4 +78,45 @@ public class MemberReportServiceImpl implements IMemberReportService
|
|
|
|
|
|
|
|
return memberReportVOList;
|
|
return memberReportVOList;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<SalesMemberReportVO> selectMemberReportBySalesList(MemberReportQuery query) {
|
|
|
|
|
+ String memberReportKey="memberReport:company:"+query.getCompanyId();
|
|
|
|
|
+ List<SalesMemberReportVO> memberReportVOList =redisCache.getCacheObject(memberReportKey);
|
|
|
|
|
+ if(memberReportVOList==null || memberReportVOList.isEmpty()){
|
|
|
|
|
+ memberReportVOList=memberReportMapper.selectSalesMemberReportListNoTime(query);
|
|
|
|
|
+ redisCache.setCacheObject(memberReportKey,memberReportVOList,10,TimeUnit.MINUTES);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 时间为空不查询新增app用户数
|
|
|
|
|
+ if(StringUtils.isBlank(query.getSTime())||StringUtils.isBlank(query.getETime())){
|
|
|
|
|
+ return memberReportVOList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<SalesMemberReportVO> memberReportAddCountList =memberReportMapper.selectSalesMemberReportAddCountList(query);
|
|
|
|
|
+ if (memberReportAddCountList != null && !memberReportAddCountList.isEmpty()) {
|
|
|
|
|
+ Map<Long, SalesMemberReportVO> reportMap = memberReportVOList.stream()
|
|
|
|
|
+ .filter(report -> report.getCompanyUserId() != null)
|
|
|
|
|
+ .collect(Collectors.toMap(
|
|
|
|
|
+ SalesMemberReportVO::getCompanyUserId,
|
|
|
|
|
+ report -> report,
|
|
|
|
|
+ (existing, replacement) -> existing
|
|
|
|
|
+ ));
|
|
|
|
|
+
|
|
|
|
|
+ for (SalesMemberReportVO addCountReport : memberReportAddCountList) {
|
|
|
|
|
+ if (addCountReport.getCompanyUserId() != null) {
|
|
|
|
|
+ SalesMemberReportVO existingReport = reportMap.get(addCountReport.getCompanyUserId());
|
|
|
|
|
+
|
|
|
|
|
+ if (existingReport != null) {
|
|
|
|
|
+ existingReport.setNewMemberCount(
|
|
|
|
|
+ addCountReport.getNewMemberCount() != null ?
|
|
|
|
|
+ addCountReport.getNewMemberCount() : 0L
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return memberReportVOList;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|