|
@@ -669,8 +669,8 @@ public class TaskStatisticsServiceImpl implements TaskStatisticsService {
|
|
|
**/
|
|
**/
|
|
|
@Override
|
|
@Override
|
|
|
public IPage<BusinessAgentData> getBusinessAgentData(TaskStatisticsVo taskStatisticsVo) {
|
|
public IPage<BusinessAgentData> getBusinessAgentData(TaskStatisticsVo taskStatisticsVo) {
|
|
|
- if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) || "3".equals(taskStatisticsVo.getManagementSource())){
|
|
|
|
|
- if((StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "2".equals(taskStatisticsVo.getTreeType())) ||"3".equals(taskStatisticsVo.getManagementSource()) ){
|
|
|
|
|
|
|
+ if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) ){
|
|
|
|
|
+ if((StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "2".equals(taskStatisticsVo.getTreeType()))){
|
|
|
List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
|
|
List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
|
|
|
if(!userIds.isEmpty() && userIds.get(0)!=null){
|
|
if(!userIds.isEmpty() && userIds.get(0)!=null){
|
|
|
taskStatisticsVo.setUserIds(userIds);
|
|
taskStatisticsVo.setUserIds(userIds);
|
|
@@ -851,7 +851,7 @@ public class TaskStatisticsServiceImpl implements TaskStatisticsService {
|
|
|
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) || "3".equals(taskStatisticsVo.getManagementSource())){
|
|
if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) || "3".equals(taskStatisticsVo.getManagementSource())){
|
|
|
- if((StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "2".equals(taskStatisticsVo.getTreeType())) ||"3".equals(taskStatisticsVo.getManagementSource()) ){
|
|
|
|
|
|
|
+ if((StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "2".equals(taskStatisticsVo.getTreeType()))){
|
|
|
List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
|
|
List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
|
|
|
if(!userIds.isEmpty() && userIds.get(0)!=null){
|
|
if(!userIds.isEmpty() && userIds.get(0)!=null){
|
|
|
taskStatisticsVo.setUserIds(userIds);
|
|
taskStatisticsVo.setUserIds(userIds);
|
|
@@ -1135,6 +1135,91 @@ public class TaskStatisticsServiceImpl implements TaskStatisticsService {
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 任控制台-业务数据-渠道"
|
|
|
|
|
+ * @param taskStatisticsVo
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public IPage<BusinessAgentData> getBusinessElectricData(TaskStatisticsVo taskStatisticsVo) {
|
|
|
|
|
+ PageVo<TaskStatisticsVo> pageVo = new PageVo<>();
|
|
|
|
|
+ Page page = new Page(taskStatisticsVo.getPageNum(), taskStatisticsVo.getPageSize());
|
|
|
|
|
+ page.setSearchCount(false).setOptimizeCountSql(false);//关闭count查询
|
|
|
|
|
+ pageVo.setPageNum(taskStatisticsVo.getPageNum());
|
|
|
|
|
+ pageVo.setPageSize(taskStatisticsVo.getPageSize());
|
|
|
|
|
+ if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId())){
|
|
|
|
|
+ List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
|
|
|
|
|
+ taskStatisticsVo.setUserIds(userIds);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) && (StringUtils.isEmpty(taskStatisticsVo.getTreeUserId()) && StringUtils.isEmpty(taskStatisticsVo.getDeptId()) ) ){
|
|
|
|
|
+ return new Page<>(taskStatisticsVo.getPageNum(), taskStatisticsVo.getPageNum());
|
|
|
|
|
+ }
|
|
|
|
|
+ HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());
|
|
|
|
|
+ taskStatisticsVo.setCreatetimeStart(dateMapByType.get("startDate"));
|
|
|
|
|
+ taskStatisticsVo.setCreatetimeEnd(dateMapByType.get("endDate"));
|
|
|
|
|
+ getDateByType(taskStatisticsVo.getDateType(), taskStatisticsVo);
|
|
|
|
|
+
|
|
|
|
|
+ IPage<BusinessAgentData> list = this.taskStatisticsMapper.getBusinessAgentData(page,taskStatisticsVo);
|
|
|
|
|
+ List<BusinessAgentData> records = list.getRecords();
|
|
|
|
|
+ for (BusinessAgentData record : records) {
|
|
|
|
|
+ this.appendName(record);
|
|
|
|
|
+ if (record.getDistributionAmountRate() == null) {
|
|
|
|
|
+ record.setDistributionAmountRate(new BigDecimal("0.0000"));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ Long total = this.taskStatisticsMapper.getBusinessAgentDataTotal(taskStatisticsVo);
|
|
|
|
|
+ list.setTotal(total);
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 任控制台-业务数据-电销-合计
|
|
|
|
|
+ * @param taskStatisticsVo
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public BusinessAgentData getBusinessElectricDataTotal(TaskStatisticsVo taskStatisticsVo) {
|
|
|
|
|
+
|
|
|
|
|
+ if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId())){
|
|
|
|
|
+ List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
|
|
|
|
|
+ taskStatisticsVo.setUserIds(userIds);
|
|
|
|
|
+ }
|
|
|
|
|
+ HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());
|
|
|
|
|
+ taskStatisticsVo.setCreatetimeStart(dateMapByType.get("startDate"));
|
|
|
|
|
+ taskStatisticsVo.setCreatetimeEnd(dateMapByType.get("endDate"));
|
|
|
|
|
+ getDateByType(taskStatisticsVo.getDateType(), taskStatisticsVo);
|
|
|
|
|
+ if (StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) && (StringUtils.isEmpty(taskStatisticsVo.getTreeUserId()) && StringUtils.isEmpty(taskStatisticsVo.getDeptId()))) {
|
|
|
|
|
+ return new BusinessAgentData();
|
|
|
|
|
+ }
|
|
|
|
|
+ String deptId = BaseController.getDeptId();
|
|
|
|
|
+ BusinessAgentData result = this.taskStatisticsMapper.getBusinessAgentDataTotalAdd(taskStatisticsVo);
|
|
|
|
|
+ Long total = this.taskStatisticsMapper.getBusinessAgentDataTotal(taskStatisticsVo);
|
|
|
|
|
+ result.setTotalNumber(total.toString());
|
|
|
|
|
+ BigDecimal sumPremium = result.getSumPremium();
|
|
|
|
|
+ BusinessAgentData allsumPremium = this.taskStatisticsMapper.getAllsumPremium(taskStatisticsVo);
|
|
|
|
|
+ if(ObjectUtils.isNotEmpty(sumPremium)){
|
|
|
|
|
+ BigDecimal sumPremium1 = allsumPremium.getSumPremium();
|
|
|
|
|
+ if(sumPremium.compareTo(BigDecimal.ZERO) ==1){
|
|
|
|
|
+ BigDecimal multiply = sumPremium.divide(sumPremium1, 4, BigDecimal.ROUND_DOWN);
|
|
|
|
|
+ result.setSumPremiumProportion(multiply);
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ result.setSumPremiumProportion(BigDecimal.ZERO);
|
|
|
|
|
+ }
|
|
|
|
|
+ BigDecimal entranceAllFee = result.getEntranceAllFee() != null ? result.getEntranceAllFee() : BigDecimal.ZERO;
|
|
|
|
|
+ BigDecimal exportAllFee = result.getExportAllFee() != null ? result.getExportAllFee() : BigDecimal.ZERO;
|
|
|
|
|
+ BigDecimal subtract = entranceAllFee.subtract(exportAllFee);
|
|
|
|
|
+ result.setDistributionAmount(subtract); //毛利润
|
|
|
|
|
+ if(subtract.compareTo(BigDecimal.ZERO)>0){
|
|
|
|
|
+ BigDecimal resultDivided = subtract.divide(sumPremium, 4, RoundingMode.HALF_UP); //人均产能
|
|
|
|
|
+ result.setDistributionAmountRate(resultDivided);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ result.setDistributionAmountRate(BigDecimal.ZERO);
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @version
|
|
* @version
|
|
|
* @author: hh
|
|
* @author: hh
|