傅行帆 5 years ago
parent
commit
379879a47b

+ 2
- 0
src/main/java/com/huiju/estateagents/statistic/entity/GenderStatistic.java View File

24
 	private Integer unknownSum;
24
 	private Integer unknownSum;
25
 	
25
 	
26
 	private BigDecimal unknownPct;
26
 	private BigDecimal unknownPct;
27
+	
28
+	private String realtyConsultant;
27
 }
29
 }

+ 5
- 0
src/main/java/com/huiju/estateagents/statistic/entity/TsCustomerGenderStatistic.java View File

65
      * 客户类型 visite 到访客户, new 新增客户 ,follow跟进客户
65
      * 客户类型 visite 到访客户, new 新增客户 ,follow跟进客户
66
      */
66
      */
67
     private String customerType;
67
     private String customerType;
68
+    
69
+    /**
70
+     * 置业顾问ID
71
+     */
72
+    private String realtyConsultant;
68
 }
73
 }

+ 5
- 2
src/main/java/com/huiju/estateagents/statistic/entity/TsCustomerStatisticDaily.java View File

56
      * 日期 格式yyyymmdd例20191111
56
      * 日期 格式yyyymmdd例20191111
57
      */
57
      */
58
     private String day;
58
     private String day;
59
-
60
-
59
+    
60
+    /**
61
+     * 置业顾问ID
62
+     */
63
+    private String realtyConsultant;
61
 }
64
 }

+ 5
- 2
src/main/java/com/huiju/estateagents/statistic/entity/TsCustomerStatisticMonthly.java View File

61
      * 更新时间
61
      * 更新时间
62
      */
62
      */
63
     private LocalDateTime updateDate;
63
     private LocalDateTime updateDate;
64
-
65
-
64
+    
65
+    /**
66
+     * 置业顾问ID
67
+     */
68
+    private String realtyConsultant;
66
 }
69
 }

+ 3
- 0
src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerGenderStatisticServiceImpl.java View File

94
 			maleCustomer.setCustomerNum(e.getManSum());
94
 			maleCustomer.setCustomerNum(e.getManSum());
95
 			maleCustomer.setPercentage(e.getManPct());
95
 			maleCustomer.setPercentage(e.getManPct());
96
 			maleCustomer.setOrgId(e.getOrgId());
96
 			maleCustomer.setOrgId(e.getOrgId());
97
+			maleCustomer.setRealtyConsultant(e.getRealtyConsultant());
97
 			list.add(maleCustomer);
98
 			list.add(maleCustomer);
98
 			
99
 			
99
 			TsCustomerGenderStatistic femaleCustomer = new TsCustomerGenderStatistic();
100
 			TsCustomerGenderStatistic femaleCustomer = new TsCustomerGenderStatistic();
103
 			femaleCustomer.setCustomerNum(e.getWomanSum());
104
 			femaleCustomer.setCustomerNum(e.getWomanSum());
104
 			femaleCustomer.setPercentage(e.getWomanPct());
105
 			femaleCustomer.setPercentage(e.getWomanPct());
105
 			femaleCustomer.setOrgId(e.getOrgId());
106
 			femaleCustomer.setOrgId(e.getOrgId());
107
+			femaleCustomer.setRealtyConsultant(e.getRealtyConsultant());
106
 			list.add(femaleCustomer);
108
 			list.add(femaleCustomer);
107
 			
109
 			
108
 			TsCustomerGenderStatistic unknownCustomer = new TsCustomerGenderStatistic();
110
 			TsCustomerGenderStatistic unknownCustomer = new TsCustomerGenderStatistic();
112
 			unknownCustomer.setCustomerNum(e.getUnknownSum());
114
 			unknownCustomer.setCustomerNum(e.getUnknownSum());
113
 			unknownCustomer.setPercentage(e.getUnknownPct());
115
 			unknownCustomer.setPercentage(e.getUnknownPct());
114
 			unknownCustomer.setOrgId(e.getOrgId());
116
 			unknownCustomer.setOrgId(e.getOrgId());
117
+			unknownCustomer.setRealtyConsultant(e.getRealtyConsultant());
115
 			list.add(unknownCustomer);
118
 			list.add(unknownCustomer);
116
 		});
119
 		});
117
 		//批量插入
120
 		//批量插入

+ 6
- 4
src/main/resources/mapper/statistic/TsCustomerGenderStatisticMapper.xml View File

4
 
4
 
5
     <select id="getNewCustomerSexCount" resultType="com.huiju.estateagents.statistic.entity.GenderStatistic">
5
     <select id="getNewCustomerSexCount" resultType="com.huiju.estateagents.statistic.entity.GenderStatistic">
6
         SELECT
6
         SELECT
7
-            org_id,
7
+            org_id,realty_consultant,
8
             sum(if(sex = 1,1,0)) as man_sum,
8
             sum(if(sex = 1,1,0)) as man_sum,
9
             sum(if(sex = 1,1,0))/count(*) as man_pct,
9
             sum(if(sex = 1,1,0))/count(*) as man_pct,
10
             sum(if(sex = 2,1,0)) as woman_sum,
10
             sum(if(sex = 2,1,0)) as woman_sum,
15
             ta_recommend_customer
15
             ta_recommend_customer
16
         WHERE
16
         WHERE
17
             `STATUS` = 1
17
             `STATUS` = 1
18
-            GROUP BY org_id
18
+            GROUP BY org_id,realty_consultant
19
     </select>
19
     </select>
20
     <select id="getFollowUpSexCount" resultType="com.huiju.estateagents.statistic.entity.GenderStatistic">
20
     <select id="getFollowUpSexCount" resultType="com.huiju.estateagents.statistic.entity.GenderStatistic">
21
         SELECT
21
         SELECT
22
             t.org_id,
22
             t.org_id,
23
+            t.follower_id as realty_consultant,
23
             sum( IF ( t.customer_sex = 1, 1, 0 ) ) AS manSum,
24
             sum( IF ( t.customer_sex = 1, 1, 0 ) ) AS manSum,
24
             sum( IF ( t.customer_sex = 1, 1, 0 ) ) / count( * ) AS manPct,
25
             sum( IF ( t.customer_sex = 1, 1, 0 ) ) / count( * ) AS manPct,
25
             sum( IF ( t.customer_sex = 2, 1, 0 ) ) AS womanSum,
26
             sum( IF ( t.customer_sex = 2, 1, 0 ) ) AS womanSum,
29
         FROM
30
         FROM
30
             ( SELECT * FROM ta_customer_follow_up_record GROUP BY customer_id ) t
31
             ( SELECT * FROM ta_customer_follow_up_record GROUP BY customer_id ) t
31
         GROUP BY
32
         GROUP BY
32
-            t.org_id
33
+            t.org_id,t.follower_id
33
     </select>
34
     </select>
34
     <select id="getVisiteSexCount" resultType="com.huiju.estateagents.statistic.entity.GenderStatistic">
35
     <select id="getVisiteSexCount" resultType="com.huiju.estateagents.statistic.entity.GenderStatistic">
35
         SELECT
36
         SELECT
36
             d.org_id,
37
             d.org_id,
38
+            d.realty_consultant,
37
             sum( IF ( d.sex = 1, 1, 0 ) ) AS manSum,
39
             sum( IF ( d.sex = 1, 1, 0 ) ) AS manSum,
38
             sum( IF ( d.sex = 1, 1, 0 ) ) / count( * ) AS manPct,
40
             sum( IF ( d.sex = 1, 1, 0 ) ) / count( * ) AS manPct,
39
             sum( IF ( d.sex = 2, 1, 0 ) ) AS womanSum,
41
             sum( IF ( d.sex = 2, 1, 0 ) ) AS womanSum,
56
                     c.customer_id
58
                     c.customer_id
57
             ) d
59
             ) d
58
         GROUP BY
60
         GROUP BY
59
-            d.org_id
61
+            d.org_id,d.realty_consultant
60
     </select>
62
     </select>
61
 </mapper>
63
 </mapper>

+ 9
- 6
src/main/resources/mapper/statistic/TsCustomerStatisticDailyMapper.xml View File

11
     <select id="getFollowUpData" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">
11
     <select id="getFollowUpData" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">
12
         SELECT
12
         SELECT
13
             org_id,
13
             org_id,
14
-            count( DISTINCT ( customer_id ) ) as customer_num
14
+            count( DISTINCT ( customer_id ) ) as customer_num,
15
+            follower_id AS realty_consultant
15
         FROM
16
         FROM
16
             ta_customer_follow_up_record
17
             ta_customer_follow_up_record
17
         WHERE
18
         WHERE
18
             date_format( create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
19
             date_format( create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
19
         GROUP BY
20
         GROUP BY
20
-            org_id
21
+            org_id,follower_id
21
     </select>
22
     </select>
22
 
23
 
23
     <select id="getNewCustomerData" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">
24
     <select id="getNewCustomerData" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">
24
         SELECT
25
         SELECT
25
             org_id,
26
             org_id,
26
-            count( customer_id ) as customer_num
27
+            count( customer_id ) as customer_num,
28
+			realty_consultant
27
         FROM
29
         FROM
28
             ta_recommend_customer
30
             ta_recommend_customer
29
         WHERE
31
         WHERE
30
             `STATUS` = #{status}
32
             `STATUS` = #{status}
31
             AND date_format( create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
33
             AND date_format( create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
32
         GROUP BY
34
         GROUP BY
33
-            org_id
35
+            org_id,realty_consultant
34
     </select>
36
     </select>
35
     <select id="getVisiteCustomerData" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">
37
     <select id="getVisiteCustomerData" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">
36
         SELECT
38
         SELECT
37
             count( DISTINCT ( c.customer_id ) ) as customer_num,
39
             count( DISTINCT ( c.customer_id ) ) as customer_num,
38
-            c.org_id
40
+            c.org_id,
41
+			c.realty_consultant
39
         FROM
42
         FROM
40
             ta_activity_dynamic_enlist t
43
             ta_activity_dynamic_enlist t
41
             LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
44
             LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
45
             t.is_checkin = #{checkin}
48
             t.is_checkin = #{checkin}
46
             AND date_format( t.create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
49
             AND date_format( t.create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
47
         GROUP BY
50
         GROUP BY
48
-            c.org_id
51
+            c.org_id,c.realty_consultant
49
     </select>
52
     </select>
50
 
53
 
51
     <select id="getDailyList" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">
54
     <select id="getDailyList" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">

+ 9
- 6
src/main/resources/mapper/statistic/TsCustomerStatisticMonthlyMapper.xml View File

6
             resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
6
             resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
7
         SELECT
7
         SELECT
8
             org_id,
8
             org_id,
9
-            count( customer_id ) as customer_num
9
+            count( customer_id ) as customer_num,
10
+            realty_consultant
10
         FROM
11
         FROM
11
             ta_recommend_customer
12
             ta_recommend_customer
12
         WHERE
13
         WHERE
13
             `STATUS` = #{status}
14
             `STATUS` = #{status}
14
             AND date_format( create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
15
             AND date_format( create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
15
         GROUP BY
16
         GROUP BY
16
-            org_id
17
+            org_id,realty_consultant
17
     </select>
18
     </select>
18
 
19
 
19
     <select id="getFollowUpStatisticMonthly"
20
     <select id="getFollowUpStatisticMonthly"
20
             resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
21
             resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
21
         SELECT
22
         SELECT
22
             org_id,
23
             org_id,
23
-            count( DISTINCT ( customer_id ) ) as customer_num
24
+            count( DISTINCT ( customer_id ) ) as customer_num,
25
+            follower_id AS realty_consultant
24
         FROM
26
         FROM
25
             ta_customer_follow_up_record
27
             ta_customer_follow_up_record
26
         WHERE
28
         WHERE
27
             date_format( create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
29
             date_format( create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
28
         GROUP BY
30
         GROUP BY
29
-            org_id
31
+            org_id,follower_id
30
     </select>
32
     </select>
31
     <select id="getVisiteStatisticMonthly"
33
     <select id="getVisiteStatisticMonthly"
32
             resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
34
             resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
33
         SELECT
35
         SELECT
34
             count( DISTINCT ( c.customer_id ) ) as customer_num,
36
             count( DISTINCT ( c.customer_id ) ) as customer_num,
35
-            c.org_id
37
+            c.org_id,
38
+            c.realty_consultant
36
         FROM
39
         FROM
37
             ta_activity_dynamic_enlist t
40
             ta_activity_dynamic_enlist t
38
             LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
41
             LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
42
             t.is_checkin = #{checkin}
45
             t.is_checkin = #{checkin}
43
             AND date_format( t.create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
46
             AND date_format( t.create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
44
         GROUP BY
47
         GROUP BY
45
-            c.org_id
48
+            c.org_id,c.realty_consultant
46
     </select>
49
     </select>
47
     <select id="getMonthlyList" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
50
     <select id="getMonthlyList" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
48
         SELECT
51
         SELECT