傅行帆 5 年 前
コミット
e512aa6707

+ 2
- 2
src/main/java/com/huiju/estateagents/job/CustomerStatisticTimeJob.java ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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
- 1
src/main/java/com/huiju/estateagents/statistic/mapper/TsCustomerStatisticDailyMapper.java ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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
- 2
src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerStatisticDailyServiceImpl.java ファイルの表示

@@ -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 ファイルの表示

@@ -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
 	

+ 1
- 0
src/main/resources/mapper/statistic/TsCustomerStatisticDailyMapper.xml ファイルの表示

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

+ 1
- 0
src/main/resources/mapper/statistic/TsCustomerStatisticMonthlyMapper.xml ファイルの表示

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