dingxin 5 anni fa
parent
commit
38b443c990
18 ha cambiato i file con 100 aggiunte e 36 eliminazioni
  1. 2
    2
      src/main/java/com/huiju/estateagents/job/CustomerStatisticTimeJob.java
  2. 13
    1
      src/main/java/com/huiju/estateagents/statistic/controller/TsCustomerGenderStatisticController.java
  3. 12
    2
      src/main/java/com/huiju/estateagents/statistic/controller/TsCustomerStatisticDailyController.java
  4. 13
    3
      src/main/java/com/huiju/estateagents/statistic/controller/TsCustomerStatisticMonthlyController.java
  5. 2
    0
      src/main/java/com/huiju/estateagents/statistic/entity/GenderStatistic.java
  6. 5
    0
      src/main/java/com/huiju/estateagents/statistic/entity/TsCustomerGenderStatistic.java
  7. 5
    2
      src/main/java/com/huiju/estateagents/statistic/entity/TsCustomerStatisticDaily.java
  8. 5
    2
      src/main/java/com/huiju/estateagents/statistic/entity/TsCustomerStatisticMonthly.java
  9. 2
    1
      src/main/java/com/huiju/estateagents/statistic/mapper/TsCustomerStatisticDailyMapper.java
  10. 2
    1
      src/main/java/com/huiju/estateagents/statistic/mapper/TsCustomerStatisticMonthlyMapper.java
  11. 2
    1
      src/main/java/com/huiju/estateagents/statistic/service/ITsCustomerStatisticDailyService.java
  12. 2
    1
      src/main/java/com/huiju/estateagents/statistic/service/ITsCustomerStatisticMonthlyService.java
  13. 3
    0
      src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerGenderStatisticServiceImpl.java
  14. 3
    2
      src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerStatisticDailyServiceImpl.java
  15. 3
    2
      src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerStatisticMonthlyServiceImpl.java
  16. 6
    4
      src/main/resources/mapper/statistic/TsCustomerGenderStatisticMapper.xml
  17. 10
    6
      src/main/resources/mapper/statistic/TsCustomerStatisticDailyMapper.xml
  18. 10
    6
      src/main/resources/mapper/statistic/TsCustomerStatisticMonthlyMapper.xml

+ 2
- 2
src/main/java/com/huiju/estateagents/job/CustomerStatisticTimeJob.java Vedi File

@@ -42,8 +42,8 @@ public class CustomerStatisticTimeJob extends BaseController {
42 42
      *
43 43
      * 开启定时任务,每天23:50执行
44 44
      */
45
-    @Scheduled(cron = "00 50 23 * * ?")
46
-    //@Scheduled(cron = "* 0/5 * * * ?")
45
+    //@Scheduled(cron = "00 50 23 * * ?")
46
+    @Scheduled(cron = "* 0/5 * * * ?")
47 47
     private void configureTasks() {
48 48
         LocalDateTime nowDate = LocalDateTime.now();
49 49
     

+ 13
- 1
src/main/java/com/huiju/estateagents/statistic/controller/TsCustomerGenderStatisticController.java Vedi File

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.BaseController;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.entity.TaPerson;
9
+import com.huiju.estateagents.service.ITaPersonService;
8 10
 import com.huiju.estateagents.statistic.entity.TsCustomerGenderStatistic;
9 11
 import com.huiju.estateagents.statistic.service.ITsCustomerGenderStatisticService;
10 12
 import org.slf4j.Logger;
@@ -37,6 +39,9 @@ public class TsCustomerGenderStatisticController extends BaseController {
37 39
 
38 40
     @Autowired
39 41
     public ITsCustomerGenderStatisticService iTaCustomerGenderStatisticService;
42
+    
43
+    @Autowired
44
+    private ITaPersonService taPersonService;
40 45
 
41 46
 
42 47
     /**
@@ -158,10 +163,17 @@ public class TsCustomerGenderStatisticController extends BaseController {
158 163
     public ResponseBean wxCustomerGenderStatisticList(@PathVariable(value = "customerType") String customerType, HttpServletRequest request){
159 164
         ResponseBean responseBean = new ResponseBean();
160 165
         try {
161
-            //查询当前小程序的男女比统计
166
+            String openid = getOpenId(request);
167
+            List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
168
+            if (null == taPersons || taPersons.size() != 1) {
169
+                return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
170
+            }
171
+            TaPerson person = taPersons.get(0);
172
+            //查询当前小程序的当前置业顾问男女比统计
162 173
             QueryWrapper<TsCustomerGenderStatistic> queryWrapper = new QueryWrapper<>();
163 174
             queryWrapper.eq("org_id",getOrgId(request));
164 175
             queryWrapper.eq("customer_type",customerType);
176
+            queryWrapper.eq("realty_consultant",person.getPersonId());
165 177
             queryWrapper.orderByDesc("create_date");
166 178
      
167 179
             List<TsCustomerGenderStatistic> result = iTaCustomerGenderStatisticService.list(queryWrapper);

+ 12
- 2
src/main/java/com/huiju/estateagents/statistic/controller/TsCustomerStatisticDailyController.java Vedi File

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.BaseController;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.entity.TaPerson;
9
+import com.huiju.estateagents.service.ITaPersonService;
8 10
 import com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily;
9 11
 import com.huiju.estateagents.statistic.service.ITsCustomerStatisticDailyService;
10 12
 import org.slf4j.Logger;
@@ -37,7 +39,9 @@ public class TsCustomerStatisticDailyController extends BaseController {
37 39
 
38 40
     @Autowired
39 41
     public ITsCustomerStatisticDailyService iTaCustomerStatisticDailyService;
40
-
42
+    
43
+    @Autowired
44
+    private ITaPersonService taPersonService;
41 45
 
42 46
     /**
43 47
      * 分页查询列表
@@ -159,8 +163,14 @@ public class TsCustomerStatisticDailyController extends BaseController {
159 163
     public ResponseBean wxCustomerStatisticDailyList(@PathVariable(value = "customerType") String customerType,
160 164
                                                      HttpServletRequest request){
161 165
         ResponseBean responseBean = new ResponseBean();
166
+        String openid = getOpenId(request);
167
+        List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
168
+        if (null == taPersons || taPersons.size() != 1) {
169
+            return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
170
+        }
171
+        TaPerson person = taPersons.get(0);
162 172
         try {
163
-            List<TsCustomerStatisticDaily> list = iTaCustomerStatisticDailyService.getDailyList(customerType,getOrgId(request));
173
+            List<TsCustomerStatisticDaily> list = iTaCustomerStatisticDailyService.getDailyList(customerType,getOrgId(request),person.getPersonId());
164 174
             responseBean.addSuccess(list);
165 175
         }catch (Exception e){
166 176
             e.printStackTrace();

+ 13
- 3
src/main/java/com/huiju/estateagents/statistic/controller/TsCustomerStatisticMonthlyController.java Vedi File

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.BaseController;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.entity.TaPerson;
9
+import com.huiju.estateagents.service.ITaPersonService;
8 10
 import com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly;
9 11
 import com.huiju.estateagents.statistic.service.ITsCustomerStatisticMonthlyService;
10 12
 import org.slf4j.Logger;
@@ -37,8 +39,10 @@ public class TsCustomerStatisticMonthlyController extends BaseController {
37 39
 
38 40
     @Autowired
39 41
     public ITsCustomerStatisticMonthlyService iTaCustomerStatisticMonthlyService;
40
-
41
-
42
+    
43
+    @Autowired
44
+    private ITaPersonService taPersonService;
45
+    
42 46
     /**
43 47
      * 分页查询列表
44 48
      * @param pageNum
@@ -159,9 +163,15 @@ public class TsCustomerStatisticMonthlyController extends BaseController {
159 163
     public ResponseBean taCustomerStatisticMonthlyList(@PathVariable(value = "customerType") String customerType,
160 164
                                                        HttpServletRequest request){
161 165
         ResponseBean responseBean = new ResponseBean();
166
+        String openid = getOpenId(request);
167
+        List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
168
+        if (null == taPersons || taPersons.size() != 1) {
169
+            return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
170
+        }
171
+        TaPerson person = taPersons.get(0);
162 172
         try {
163 173
             //查询月客户分析数据
164
-            List<TsCustomerStatisticMonthly> result = iTaCustomerStatisticMonthlyService.getCustomerMonthlyList(customerType, getOrgId(request));
174
+            List<TsCustomerStatisticMonthly> result = iTaCustomerStatisticMonthlyService.getCustomerMonthlyList(customerType, getOrgId(request),person.getPersonId());
165 175
             responseBean.addSuccess(result);
166 176
         }catch (Exception e){
167 177
             e.printStackTrace();

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

@@ -24,4 +24,6 @@ public class GenderStatistic {
24 24
 	private Integer unknownSum;
25 25
 	
26 26
 	private BigDecimal unknownPct;
27
+	
28
+	private String realtyConsultant;
27 29
 }

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

@@ -65,4 +65,9 @@ public class TsCustomerGenderStatistic implements Serializable {
65 65
      * 客户类型 visite 到访客户, new 新增客户 ,follow跟进客户
66 66
      */
67 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 Vedi File

@@ -56,6 +56,9 @@ public class TsCustomerStatisticDaily implements Serializable {
56 56
      * 日期 格式yyyymmdd例20191111
57 57
      */
58 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 Vedi File

@@ -61,6 +61,9 @@ public class TsCustomerStatisticMonthly implements Serializable {
61 61
      * 更新时间
62 62
      */
63 63
     private LocalDateTime updateDate;
64
-
65
-
64
+    
65
+    /**
66
+     * 置业顾问ID
67
+     */
68
+    private String realtyConsultant;
66 69
 }

+ 2
- 1
src/main/java/com/huiju/estateagents/statistic/mapper/TsCustomerStatisticDailyMapper.java Vedi File

@@ -48,9 +48,10 @@ public interface TsCustomerStatisticDailyMapper extends BaseMapper<TsCustomerSta
48 48
 	 * @param orgId
49 49
 	 * @param nowDate
50 50
 	 * @param beforeDate
51
+	 * @param personId
51 52
 	 * @return
52 53
 	 */
53
-	List<TsCustomerStatisticDaily> getDailyList(@Param("customerType") String customerType, @Param("orgId")  Integer orgId, @Param("nowDate")  LocalDateTime nowDate, @Param("beforeDate")  LocalDateTime beforeDate);
54
+	List<TsCustomerStatisticDaily> getDailyList(@Param("customerType") String customerType, @Param("orgId") Integer orgId, @Param("nowDate") LocalDateTime nowDate, @Param("beforeDate") LocalDateTime beforeDate,@Param("personId") String personId);
54 55
 	
55 56
 	int deleteNowDate(@Param("nowDate") LocalDateTime nowDate,@Param("customerType") String customerType);
56 57
 }

+ 2
- 1
src/main/java/com/huiju/estateagents/statistic/mapper/TsCustomerStatisticMonthlyMapper.java Vedi File

@@ -48,7 +48,8 @@ public interface TsCustomerStatisticMonthlyMapper extends BaseMapper<TsCustomerS
48 48
 	 * @param orgId
49 49
 	 * @param nowDate
50 50
 	 * @param beforeDate
51
+	 * @param personId
51 52
 	 * @return
52 53
 	 */
53
-	List<TsCustomerStatisticMonthly> getMonthlyList(@Param("customerType") String customerType, @Param("orgId") Integer orgId, @Param("nowDate") LocalDateTime nowDate, @Param("beforeDate") LocalDateTime beforeDate);
54
+	List<TsCustomerStatisticMonthly> getMonthlyList(@Param("customerType") String customerType, @Param("orgId") Integer orgId, @Param("nowDate") LocalDateTime nowDate, @Param("beforeDate") LocalDateTime beforeDate,@Param("personId") String personId);
54 55
 }

+ 2
- 1
src/main/java/com/huiju/estateagents/statistic/service/ITsCustomerStatisticDailyService.java Vedi File

@@ -38,7 +38,8 @@ public interface ITsCustomerStatisticDailyService extends IService<TsCustomerSta
38 38
 	 * 获取日统计数据
39 39
 	 * @param customerType
40 40
 	 * @param orgId
41
+	 * @param personId
41 42
 	 * @return
42 43
 	 */
43
-	List<TsCustomerStatisticDaily> getDailyList(String customerType, Integer orgId);
44
+	List<TsCustomerStatisticDaily> getDailyList(String customerType, Integer orgId, String personId);
44 45
 }

+ 2
- 1
src/main/java/com/huiju/estateagents/statistic/service/ITsCustomerStatisticMonthlyService.java Vedi File

@@ -38,7 +38,8 @@ public interface ITsCustomerStatisticMonthlyService extends IService<TsCustomerS
38 38
 	 * 查询12个月的客户统计分析数据
39 39
 	 * @param customerType
40 40
 	 * @param orgId
41
+	 * @param personId
41 42
 	 * @return
42 43
 	 */
43
-	List<TsCustomerStatisticMonthly> getCustomerMonthlyList(String customerType, Integer orgId);
44
+	List<TsCustomerStatisticMonthly> getCustomerMonthlyList(String customerType, Integer orgId, String personId);
44 45
 }

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

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

+ 3
- 2
src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerStatisticDailyServiceImpl.java Vedi File

@@ -77,17 +77,18 @@ public class TsCustomerStatisticDailyServiceImpl extends ServiceImpl<TsCustomerS
77 77
 	 *
78 78
 	 * @param customerType
79 79
 	 * @param orgId
80
+	 * @param personId
80 81
 	 * @return
81 82
 	 */
82 83
 	@Override
83
-	public List<TsCustomerStatisticDaily> getDailyList(String customerType, Integer orgId) {
84
+	public List<TsCustomerStatisticDaily> getDailyList(String customerType, Integer orgId, String personId) {
84 85
 		//当前日期
85 86
 		LocalDateTime nowDate = LocalDateTime.now();
86 87
 		//31天前的日期
87 88
 		LocalDateTime beforeDate = nowDate.plusDays(-31);
88 89
 		//获取31天的日期数据
89 90
 
90
-		List<TsCustomerStatisticDaily> list = customerStatisticDailyMapper.getDailyList(customerType,orgId,nowDate,beforeDate);
91
+		List<TsCustomerStatisticDaily> list = customerStatisticDailyMapper.getDailyList(customerType,orgId,nowDate,beforeDate,personId);
91 92
 		return list;
92 93
 	}
93 94
 	

+ 3
- 2
src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerStatisticMonthlyServiceImpl.java Vedi File

@@ -76,16 +76,17 @@ public class TsCustomerStatisticMonthlyServiceImpl extends ServiceImpl<TsCustome
76 76
 	 *
77 77
 	 * @param customerType
78 78
 	 * @param orgId
79
+	 * @param personId
79 80
 	 * @return
80 81
 	 */
81 82
 	@Override
82
-	public List<TsCustomerStatisticMonthly> getCustomerMonthlyList(String customerType, Integer orgId) {
83
+	public List<TsCustomerStatisticMonthly> getCustomerMonthlyList(String customerType, Integer orgId, String personId) {
83 84
 		//当前日期
84 85
 		LocalDateTime nowDate = LocalDateTime.now();
85 86
 		//12个月前的日期
86 87
 		LocalDateTime beforeDate = nowDate.plusMonths(-12);
87 88
 		//获取31天的日期数据
88
-		List<TsCustomerStatisticMonthly> list = customerStatisticMonthlyMapper.getMonthlyList(customerType,orgId,nowDate,beforeDate);
89
+		List<TsCustomerStatisticMonthly> list = customerStatisticMonthlyMapper.getMonthlyList(customerType,orgId,nowDate,beforeDate,personId);
89 90
 		return list;
90 91
 	}
91 92
 	

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

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

+ 10
- 6
src/main/resources/mapper/statistic/TsCustomerStatisticDailyMapper.xml Vedi File

@@ -11,31 +11,34 @@
11 11
     <select id="getFollowUpData" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">
12 12
         SELECT
13 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 16
         FROM
16 17
             ta_customer_follow_up_record
17 18
         WHERE
18 19
             date_format( create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
19 20
         GROUP BY
20
-            org_id
21
+            org_id,follower_id
21 22
     </select>
22 23
 
23 24
     <select id="getNewCustomerData" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">
24 25
         SELECT
25 26
             org_id,
26
-            count( customer_id ) as customer_num
27
+            count( customer_id ) as customer_num,
28
+			realty_consultant
27 29
         FROM
28 30
             ta_recommend_customer
29 31
         WHERE
30 32
             `STATUS` = #{status}
31 33
             AND date_format( create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
32 34
         GROUP BY
33
-            org_id
35
+            org_id,realty_consultant
34 36
     </select>
35 37
     <select id="getVisiteCustomerData" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">
36 38
         SELECT
37 39
             count( DISTINCT ( c.customer_id ) ) as customer_num,
38
-            c.org_id
40
+            c.org_id,
41
+			c.realty_consultant
39 42
         FROM
40 43
             ta_activity_dynamic_enlist t
41 44
             LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
@@ -45,7 +48,7 @@
45 48
             t.is_checkin = #{checkin}
46 49
             AND date_format( t.create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
47 50
         GROUP BY
48
-            c.org_id
51
+            c.org_id,c.realty_consultant
49 52
     </select>
50 53
 
51 54
     <select id="getDailyList" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">
@@ -56,6 +59,7 @@
56 59
         WHERE
57 60
           org_id = #{orgId}
58 61
         AND customer_type = #{customerType}
62
+        AND realty_consultant = #{personId}
59 63
         AND date_format( create_date, '%Y-%m-%d' ) >= date_format( #{beforeDate}, '%Y-%m-%d' )
60 64
         AND date_format( create_date, '%Y-%m-%d' ) &lt;= date_format( #{nowDate}, '%Y-%m-%d' )
61 65
         order by `day`

+ 10
- 6
src/main/resources/mapper/statistic/TsCustomerStatisticMonthlyMapper.xml Vedi File

@@ -6,33 +6,36 @@
6 6
             resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
7 7
         SELECT
8 8
             org_id,
9
-            count( customer_id ) as customer_num
9
+            count( customer_id ) as customer_num,
10
+            realty_consultant
10 11
         FROM
11 12
             ta_recommend_customer
12 13
         WHERE
13 14
             `STATUS` = #{status}
14 15
             AND date_format( create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
15 16
         GROUP BY
16
-            org_id
17
+            org_id,realty_consultant
17 18
     </select>
18 19
 
19 20
     <select id="getFollowUpStatisticMonthly"
20 21
             resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
21 22
         SELECT
22 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 26
         FROM
25 27
             ta_customer_follow_up_record
26 28
         WHERE
27 29
             date_format( create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
28 30
         GROUP BY
29
-            org_id
31
+            org_id,follower_id
30 32
     </select>
31 33
     <select id="getVisiteStatisticMonthly"
32 34
             resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
33 35
         SELECT
34 36
             count( DISTINCT ( c.customer_id ) ) as customer_num,
35
-            c.org_id
37
+            c.org_id,
38
+            c.realty_consultant
36 39
         FROM
37 40
             ta_activity_dynamic_enlist t
38 41
             LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
@@ -42,7 +45,7 @@
42 45
             t.is_checkin = #{checkin}
43 46
             AND date_format( t.create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
44 47
         GROUP BY
45
-            c.org_id
48
+            c.org_id,c.realty_consultant
46 49
     </select>
47 50
     <select id="getMonthlyList" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
48 51
         SELECT
@@ -52,6 +55,7 @@
52 55
         WHERE
53 56
           org_id = #{orgId}
54 57
         AND customer_type = #{customerType}
58
+        AND realty_consultant = #{personId}
55 59
         AND date_format( create_date, '%Y-%m-%d' ) >= date_format( #{beforeDate}, '%Y-%m-%d' )
56 60
         AND date_format( create_date, '%Y-%m-%d' ) &lt;= date_format( #{nowDate}, '%Y-%m-%d' )
57 61
          order by `month`