|
|
@@ -2,6 +2,7 @@ package com.fs.company.service.impl;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.fs.common.enums.DimensionEnum;
|
|
|
+import com.fs.common.utils.bean.BeanUtils;
|
|
|
import com.fs.company.domain.CompanyDeptUserInfo;
|
|
|
import com.fs.company.domain.ComprehensiveDailyStats;
|
|
|
import com.fs.company.dto.CompanyDeptUserInfoDTO;
|
|
|
@@ -11,13 +12,12 @@ import com.fs.company.service.IStatisticManageService;
|
|
|
import com.fs.statis.param.ComprehensiveStatisticsParam;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.collections4.CollectionUtils;
|
|
|
import com.google.common.collect.Lists;
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.Assert;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -94,27 +94,12 @@ public class StatisticManageServiceImpl implements IStatisticManageService {
|
|
|
public void executeTask() {
|
|
|
List<CompanyDeptUserInfo> companyDeptdUserList = statisticManageMapper.getCompanyAndDeptAndDeptUserList(null);
|
|
|
companyDeptdUserList.forEach(companyDeptUserInfo -> {
|
|
|
- ComprehensiveDailyStats comprehensiveDailyStats = new ComprehensiveDailyStats();
|
|
|
- comprehensiveDailyStats.setCompanyId(companyDeptUserInfo.getCompanyId());
|
|
|
- comprehensiveDailyStats.setCompanyName(companyDeptUserInfo.getCompanyName());
|
|
|
- comprehensiveDailyStats.setDeptId(companyDeptUserInfo.getDeptId());
|
|
|
- comprehensiveDailyStats.setDeptName(companyDeptUserInfo.getDeptName());
|
|
|
- comprehensiveDailyStats.setStatisticsTime(new Date());
|
|
|
- comprehensiveDailyStats.setCreateTime(new Date());
|
|
|
- comprehensiveDailyStats.setUpdateTime(new Date());
|
|
|
+ CompanyDeptUserInfoDTO statisticNum = new CompanyDeptUserInfoDTO();
|
|
|
if(null != companyDeptUserInfo.getUserId()){
|
|
|
- comprehensiveDailyStats.setUserId(companyDeptUserInfo.getUserId());
|
|
|
- comprehensiveDailyStats.setUserName(companyDeptUserInfo.getUserName());
|
|
|
- comprehensiveDailyStats.setNickName(companyDeptUserInfo.getNickName());
|
|
|
- CompanyDeptUserInfoDTO statisticNum = statisticManageMapper.getStatisticNum(companyDeptUserInfo.getUserId());
|
|
|
- comprehensiveDailyStats.setAnswerNum(statisticNum.getAnswerNum());
|
|
|
- comprehensiveDailyStats.setCompleteNum(statisticNum.getCompleteNum());
|
|
|
- comprehensiveDailyStats.setLineNum(statisticNum.getLineNum());
|
|
|
- comprehensiveDailyStats.setActiveNum(statisticNum.getActiveNum());
|
|
|
- comprehensiveDailyStats.setRedPacketNum(statisticNum.getRedPacketNum());
|
|
|
+ statisticNum = statisticManageMapper.getStatisticNum(companyDeptUserInfo.getUserId());
|
|
|
}
|
|
|
+ ComprehensiveDailyStats comprehensiveDailyStats = component(companyDeptUserInfo, statisticNum);
|
|
|
statisticManageMapper.insert(comprehensiveDailyStats);
|
|
|
-
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -130,6 +115,36 @@ public class StatisticManageServiceImpl implements IStatisticManageService {
|
|
|
return statisticManageMapper.getStatisticNumByPersonal(dimension, startTime, endTime, userIds);
|
|
|
}
|
|
|
|
|
|
+ private ComprehensiveDailyStats component(CompanyDeptUserInfo source, CompanyDeptUserInfoDTO statisticNum){
|
|
|
+ ComprehensiveDailyStats target = new ComprehensiveDailyStats();
|
|
|
+ target.setCompanyId(source.getCompanyId());
|
|
|
+ target.setCompanyName(source.getCompanyName());
|
|
|
+ target.setDeptId(source.getDeptId());
|
|
|
+ target.setDeptName(source.getDeptName());
|
|
|
+ target.setStatisticsTime(new Date());
|
|
|
+ target.setCreateTime(new Date());
|
|
|
+ target.setUpdateTime(new Date());
|
|
|
+ if(null != source.getUserId()){
|
|
|
+ target.setUserId(source.getUserId());
|
|
|
+ target.setUserName(source.getUserName());
|
|
|
+ target.setNickName(source.getNickName());
|
|
|
+ target.setAnswerNum(statisticNum.getAnswerNum());
|
|
|
+ target.setCompleteNum(statisticNum.getCompleteNum());
|
|
|
+ target.setLineNum(statisticNum.getLineNum());
|
|
|
+ target.setActiveNum(statisticNum.getActiveNum());
|
|
|
+ target.setRedPacketNum(statisticNum.getRedPacketNum());
|
|
|
+ target.setRedPacketAmount(new BigDecimal(0.00));
|
|
|
+ }else{
|
|
|
+ target.setAnswerNum(0);
|
|
|
+ target.setCompleteNum(0);
|
|
|
+ target.setLineNum(0);
|
|
|
+ target.setActiveNum(0);
|
|
|
+ target.setRedPacketNum(0);
|
|
|
+ target.setRedPacketAmount(new BigDecimal(0.00));
|
|
|
+ }
|
|
|
+ return target;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|