傅行帆 5 years ago
parent
commit
e512aa6707

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

42
      *
42
      *
43
      * 开启定时任务,每天23:50执行
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
     private void configureTasks() {
47
     private void configureTasks() {
48
         LocalDateTime nowDate = LocalDateTime.now();
48
         LocalDateTime nowDate = LocalDateTime.now();
49
     
49
     

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

5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.huiju.estateagents.base.BaseController;
6
 import com.huiju.estateagents.base.BaseController;
7
 import com.huiju.estateagents.base.ResponseBean;
7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.entity.TaPerson;
9
+import com.huiju.estateagents.service.ITaPersonService;
8
 import com.huiju.estateagents.statistic.entity.TsCustomerGenderStatistic;
10
 import com.huiju.estateagents.statistic.entity.TsCustomerGenderStatistic;
9
 import com.huiju.estateagents.statistic.service.ITsCustomerGenderStatisticService;
11
 import com.huiju.estateagents.statistic.service.ITsCustomerGenderStatisticService;
10
 import org.slf4j.Logger;
12
 import org.slf4j.Logger;
37
 
39
 
38
     @Autowired
40
     @Autowired
39
     public ITsCustomerGenderStatisticService iTaCustomerGenderStatisticService;
41
     public ITsCustomerGenderStatisticService iTaCustomerGenderStatisticService;
42
+    
43
+    @Autowired
44
+    private ITaPersonService taPersonService;
40
 
45
 
41
 
46
 
42
     /**
47
     /**
158
     public ResponseBean wxCustomerGenderStatisticList(@PathVariable(value = "customerType") String customerType, HttpServletRequest request){
163
     public ResponseBean wxCustomerGenderStatisticList(@PathVariable(value = "customerType") String customerType, HttpServletRequest request){
159
         ResponseBean responseBean = new ResponseBean();
164
         ResponseBean responseBean = new ResponseBean();
160
         try {
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
             QueryWrapper<TsCustomerGenderStatistic> queryWrapper = new QueryWrapper<>();
173
             QueryWrapper<TsCustomerGenderStatistic> queryWrapper = new QueryWrapper<>();
163
             queryWrapper.eq("org_id",getOrgId(request));
174
             queryWrapper.eq("org_id",getOrgId(request));
164
             queryWrapper.eq("customer_type",customerType);
175
             queryWrapper.eq("customer_type",customerType);
176
+            queryWrapper.eq("realty_consultant",person.getPersonId());
165
             queryWrapper.orderByDesc("create_date");
177
             queryWrapper.orderByDesc("create_date");
166
      
178
      
167
             List<TsCustomerGenderStatistic> result = iTaCustomerGenderStatisticService.list(queryWrapper);
179
             List<TsCustomerGenderStatistic> result = iTaCustomerGenderStatisticService.list(queryWrapper);

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

5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.huiju.estateagents.base.BaseController;
6
 import com.huiju.estateagents.base.BaseController;
7
 import com.huiju.estateagents.base.ResponseBean;
7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.entity.TaPerson;
9
+import com.huiju.estateagents.service.ITaPersonService;
8
 import com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily;
10
 import com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily;
9
 import com.huiju.estateagents.statistic.service.ITsCustomerStatisticDailyService;
11
 import com.huiju.estateagents.statistic.service.ITsCustomerStatisticDailyService;
10
 import org.slf4j.Logger;
12
 import org.slf4j.Logger;
37
 
39
 
38
     @Autowired
40
     @Autowired
39
     public ITsCustomerStatisticDailyService iTaCustomerStatisticDailyService;
41
     public ITsCustomerStatisticDailyService iTaCustomerStatisticDailyService;
40
-
42
+    
43
+    @Autowired
44
+    private ITaPersonService taPersonService;
41
 
45
 
42
     /**
46
     /**
43
      * 分页查询列表
47
      * 分页查询列表
159
     public ResponseBean wxCustomerStatisticDailyList(@PathVariable(value = "customerType") String customerType,
163
     public ResponseBean wxCustomerStatisticDailyList(@PathVariable(value = "customerType") String customerType,
160
                                                      HttpServletRequest request){
164
                                                      HttpServletRequest request){
161
         ResponseBean responseBean = new ResponseBean();
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
         try {
172
         try {
163
-            List<TsCustomerStatisticDaily> list = iTaCustomerStatisticDailyService.getDailyList(customerType,getOrgId(request));
173
+            List<TsCustomerStatisticDaily> list = iTaCustomerStatisticDailyService.getDailyList(customerType,getOrgId(request),person.getPersonId());
164
             responseBean.addSuccess(list);
174
             responseBean.addSuccess(list);
165
         }catch (Exception e){
175
         }catch (Exception e){
166
             e.printStackTrace();
176
             e.printStackTrace();

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

5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.huiju.estateagents.base.BaseController;
6
 import com.huiju.estateagents.base.BaseController;
7
 import com.huiju.estateagents.base.ResponseBean;
7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.entity.TaPerson;
9
+import com.huiju.estateagents.service.ITaPersonService;
8
 import com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly;
10
 import com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly;
9
 import com.huiju.estateagents.statistic.service.ITsCustomerStatisticMonthlyService;
11
 import com.huiju.estateagents.statistic.service.ITsCustomerStatisticMonthlyService;
10
 import org.slf4j.Logger;
12
 import org.slf4j.Logger;
37
 
39
 
38
     @Autowired
40
     @Autowired
39
     public ITsCustomerStatisticMonthlyService iTaCustomerStatisticMonthlyService;
41
     public ITsCustomerStatisticMonthlyService iTaCustomerStatisticMonthlyService;
40
-
41
-
42
+    
43
+    @Autowired
44
+    private ITaPersonService taPersonService;
45
+    
42
     /**
46
     /**
43
      * 分页查询列表
47
      * 分页查询列表
44
      * @param pageNum
48
      * @param pageNum
159
     public ResponseBean taCustomerStatisticMonthlyList(@PathVariable(value = "customerType") String customerType,
163
     public ResponseBean taCustomerStatisticMonthlyList(@PathVariable(value = "customerType") String customerType,
160
                                                        HttpServletRequest request){
164
                                                        HttpServletRequest request){
161
         ResponseBean responseBean = new ResponseBean();
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
         try {
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
             responseBean.addSuccess(result);
175
             responseBean.addSuccess(result);
166
         }catch (Exception e){
176
         }catch (Exception e){
167
             e.printStackTrace();
177
             e.printStackTrace();

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

48
 	 * @param orgId
48
 	 * @param orgId
49
 	 * @param nowDate
49
 	 * @param nowDate
50
 	 * @param beforeDate
50
 	 * @param beforeDate
51
+	 * @param personId
51
 	 * @return
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
 	int deleteNowDate(@Param("nowDate") LocalDateTime nowDate,@Param("customerType") String customerType);
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 View File

48
 	 * @param orgId
48
 	 * @param orgId
49
 	 * @param nowDate
49
 	 * @param nowDate
50
 	 * @param beforeDate
50
 	 * @param beforeDate
51
+	 * @param personId
51
 	 * @return
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 View File

38
 	 * 获取日统计数据
38
 	 * 获取日统计数据
39
 	 * @param customerType
39
 	 * @param customerType
40
 	 * @param orgId
40
 	 * @param orgId
41
+	 * @param personId
41
 	 * @return
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 View File

38
 	 * 查询12个月的客户统计分析数据
38
 	 * 查询12个月的客户统计分析数据
39
 	 * @param customerType
39
 	 * @param customerType
40
 	 * @param orgId
40
 	 * @param orgId
41
+	 * @param personId
41
 	 * @return
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
- 2
src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerStatisticDailyServiceImpl.java View File

77
 	 *
77
 	 *
78
 	 * @param customerType
78
 	 * @param customerType
79
 	 * @param orgId
79
 	 * @param orgId
80
+	 * @param personId
80
 	 * @return
81
 	 * @return
81
 	 */
82
 	 */
82
 	@Override
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
 		LocalDateTime nowDate = LocalDateTime.now();
86
 		LocalDateTime nowDate = LocalDateTime.now();
86
 		//31天前的日期
87
 		//31天前的日期
87
 		LocalDateTime beforeDate = nowDate.plusDays(-31);
88
 		LocalDateTime beforeDate = nowDate.plusDays(-31);
88
 		//获取31天的日期数据
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
 		return list;
92
 		return list;
92
 	}
93
 	}
93
 	
94
 	

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

76
 	 *
76
 	 *
77
 	 * @param customerType
77
 	 * @param customerType
78
 	 * @param orgId
78
 	 * @param orgId
79
+	 * @param personId
79
 	 * @return
80
 	 * @return
80
 	 */
81
 	 */
81
 	@Override
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
 		LocalDateTime nowDate = LocalDateTime.now();
85
 		LocalDateTime nowDate = LocalDateTime.now();
85
 		//12个月前的日期
86
 		//12个月前的日期
86
 		LocalDateTime beforeDate = nowDate.plusMonths(-12);
87
 		LocalDateTime beforeDate = nowDate.plusMonths(-12);
87
 		//获取31天的日期数据
88
 		//获取31天的日期数据
88
-		List<TsCustomerStatisticMonthly> list = customerStatisticMonthlyMapper.getMonthlyList(customerType,orgId,nowDate,beforeDate);
89
+		List<TsCustomerStatisticMonthly> list = customerStatisticMonthlyMapper.getMonthlyList(customerType,orgId,nowDate,beforeDate,personId);
89
 		return list;
90
 		return list;
90
 	}
91
 	}
91
 	
92
 	

+ 1
- 0
src/main/resources/mapper/statistic/TsCustomerStatisticDailyMapper.xml View File

59
         WHERE
59
         WHERE
60
           org_id = #{orgId}
60
           org_id = #{orgId}
61
         AND customer_type = #{customerType}
61
         AND customer_type = #{customerType}
62
+        AND realty_consultant = #{personId}
62
         AND date_format( create_date, '%Y-%m-%d' ) >= date_format( #{beforeDate}, '%Y-%m-%d' )
63
         AND date_format( create_date, '%Y-%m-%d' ) >= date_format( #{beforeDate}, '%Y-%m-%d' )
63
         AND date_format( create_date, '%Y-%m-%d' ) &lt;= date_format( #{nowDate}, '%Y-%m-%d' )
64
         AND date_format( create_date, '%Y-%m-%d' ) &lt;= date_format( #{nowDate}, '%Y-%m-%d' )
64
         order by `day`
65
         order by `day`

+ 1
- 0
src/main/resources/mapper/statistic/TsCustomerStatisticMonthlyMapper.xml View File

55
         WHERE
55
         WHERE
56
           org_id = #{orgId}
56
           org_id = #{orgId}
57
         AND customer_type = #{customerType}
57
         AND customer_type = #{customerType}
58
+        AND realty_consultant = #{personId}
58
         AND date_format( create_date, '%Y-%m-%d' ) >= date_format( #{beforeDate}, '%Y-%m-%d' )
59
         AND date_format( create_date, '%Y-%m-%d' ) >= date_format( #{beforeDate}, '%Y-%m-%d' )
59
         AND date_format( create_date, '%Y-%m-%d' ) &lt;= date_format( #{nowDate}, '%Y-%m-%d' )
60
         AND date_format( create_date, '%Y-%m-%d' ) &lt;= date_format( #{nowDate}, '%Y-%m-%d' )
60
          order by `month`
61
          order by `month`