|
@@ -1,5 +1,6 @@
|
1
|
1
|
package com.huiju.estateagents.statistic.service.impl;
|
2
|
2
|
|
|
3
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
3
|
4
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
4
|
5
|
import com.huiju.estateagents.common.CommConstant;
|
5
|
6
|
import com.huiju.estateagents.statistic.entity.GenderStatistic;
|
|
@@ -37,7 +38,7 @@ public class TaCustomerGenderStatisticServiceImpl extends ServiceImpl<TaCustomer
|
37
|
38
|
//获取新增客户的男女性别比和性别数
|
38
|
39
|
List<GenderStatistic> newCustomerSexList = customerGenderStatisticMapper.getNewCustomerSexCount();
|
39
|
40
|
//批量保存
|
40
|
|
- saveBatchCustomerSexData(newCustomerSexList,nowDate);
|
|
41
|
+ saveBatchCustomerSexData(newCustomerSexList,nowDate,CommConstant.CUSTOMER_TYPE_NEW);
|
41
|
42
|
}
|
42
|
43
|
|
43
|
44
|
/**
|
|
@@ -50,7 +51,7 @@ public class TaCustomerGenderStatisticServiceImpl extends ServiceImpl<TaCustomer
|
50
|
51
|
//获取跟进客户的男女性别比和性别数
|
51
|
52
|
List<GenderStatistic> followUpSexList = customerGenderStatisticMapper.getFollowUpSexCount();
|
52
|
53
|
//批量保存
|
53
|
|
- saveBatchCustomerSexData(followUpSexList,nowDate);
|
|
54
|
+ saveBatchCustomerSexData(followUpSexList,nowDate,CommConstant.CUSTOMER_TYPE_FOLLOW);
|
54
|
55
|
}
|
55
|
56
|
|
56
|
57
|
/**
|
|
@@ -69,7 +70,7 @@ public class TaCustomerGenderStatisticServiceImpl extends ServiceImpl<TaCustomer
|
69
|
70
|
}
|
70
|
71
|
});
|
71
|
72
|
//批量保存
|
72
|
|
- saveBatchCustomerSexData(newVisiteSexList,nowDate);
|
|
73
|
+ saveBatchCustomerSexData(newVisiteSexList,nowDate,CommConstant.CUSTOMER_TYPE_VISITE);
|
73
|
74
|
}
|
74
|
75
|
|
75
|
76
|
/**
|
|
@@ -77,14 +78,19 @@ public class TaCustomerGenderStatisticServiceImpl extends ServiceImpl<TaCustomer
|
77
|
78
|
* @param customerSexList
|
78
|
79
|
* @param nowDate
|
79
|
80
|
*/
|
80
|
|
- private void saveBatchCustomerSexData(List<GenderStatistic> customerSexList, LocalDateTime nowDate) {
|
|
81
|
+ private void saveBatchCustomerSexData(List<GenderStatistic> customerSexList, LocalDateTime nowDate,String customerType) {
|
|
82
|
+ //先删除在添加
|
|
83
|
+ QueryWrapper<TaCustomerGenderStatistic> queryWrapper = new QueryWrapper<>();
|
|
84
|
+ queryWrapper.eq("customer_type",customerType);
|
|
85
|
+ customerGenderStatisticMapper.delete(queryWrapper);
|
|
86
|
+
|
81
|
87
|
List<TaCustomerGenderStatistic> list = new ArrayList<>();
|
82
|
88
|
//划分男女未知三条数据
|
83
|
89
|
customerSexList.forEach(e -> {
|
84
|
90
|
TaCustomerGenderStatistic maleCustomer = new TaCustomerGenderStatistic();
|
85
|
91
|
maleCustomer.setCreateDate(nowDate);
|
86
|
92
|
maleCustomer.setGenderType(CommConstant.SEX_MALE);
|
87
|
|
- maleCustomer.setCustomerType(CommConstant.CUSTOMER_TYPE_NEW);
|
|
93
|
+ maleCustomer.setCustomerType(customerType);
|
88
|
94
|
maleCustomer.setCustomerNum(e.getManSum());
|
89
|
95
|
maleCustomer.setPercentage(e.getManPct());
|
90
|
96
|
maleCustomer.setOrgId(e.getOrgId());
|
|
@@ -93,7 +99,7 @@ public class TaCustomerGenderStatisticServiceImpl extends ServiceImpl<TaCustomer
|
93
|
99
|
TaCustomerGenderStatistic femaleCustomer = new TaCustomerGenderStatistic();
|
94
|
100
|
femaleCustomer.setCreateDate(nowDate);
|
95
|
101
|
femaleCustomer.setGenderType(CommConstant.SEX_FEMALE);
|
96
|
|
- femaleCustomer.setCustomerType(CommConstant.CUSTOMER_TYPE_NEW);
|
|
102
|
+ femaleCustomer.setCustomerType(customerType);
|
97
|
103
|
femaleCustomer.setCustomerNum(e.getWomanSum());
|
98
|
104
|
femaleCustomer.setPercentage(e.getWomanPct());
|
99
|
105
|
femaleCustomer.setOrgId(e.getOrgId());
|
|
@@ -102,7 +108,7 @@ public class TaCustomerGenderStatisticServiceImpl extends ServiceImpl<TaCustomer
|
102
|
108
|
TaCustomerGenderStatistic unknownCustomer = new TaCustomerGenderStatistic();
|
103
|
109
|
unknownCustomer.setCreateDate(nowDate);
|
104
|
110
|
unknownCustomer.setGenderType(CommConstant.SEX_UNKNOWN);
|
105
|
|
- unknownCustomer.setCustomerType(CommConstant.CUSTOMER_TYPE_NEW);
|
|
111
|
+ unknownCustomer.setCustomerType(customerType);
|
106
|
112
|
unknownCustomer.setCustomerNum(e.getUnknownSum());
|
107
|
113
|
unknownCustomer.setPercentage(e.getUnknownPct());
|
108
|
114
|
unknownCustomer.setOrgId(e.getOrgId());
|