dingxin 5 년 전
부모
커밋
6c4ecd751d

+ 1
- 0
src/main/java/com/huiju/estateagents/controller/TaBuildingDynamicController.java 파일 보기

@@ -416,6 +416,7 @@ public class TaBuildingDynamicController extends BaseController {
416 416
         dynamic.setStatus(1);
417 417
         //活动状态,如果不需要报名则直接置为进行中
418 418
         dynamic.setActivityStatus(1);
419
+        dynamic.setIsEnlist(1);
419 420
         //3.5.1版本去除是否需要报名
420 421
 //        if (dynamic.getIsEnlist() == 0){
421 422
 //            dynamic.setActivityStatus(0);

+ 1
- 0
src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java 파일 보기

@@ -447,6 +447,7 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
447 447
             QueryWrapper<TaUser> userQueryWrapper = new QueryWrapper<>();
448 448
             userQueryWrapper.in("user_id",idLists);
449 449
             userQueryWrapper.eq("is_consultant", true);
450
+            userQueryWrapper.eq("status",CommConstant.STATUS_NORMAL);
450 451
             data = taUserService.page(page,userQueryWrapper);
451 452
         }
452 453
 

+ 1
- 1
src/main/java/com/huiju/estateagents/statistic/controller/TsCustomerStatisticDailyController.java 파일 보기

@@ -170,7 +170,7 @@ public class TsCustomerStatisticDailyController extends BaseController {
170 170
         }
171 171
         TaPerson person = taPersons.get(0);
172 172
         try {
173
-            List<TsCustomerStatisticDaily> list = iTaCustomerStatisticDailyService.getDailyList(customerType,getOrgId(request),person.getPersonId());
173
+            List<TsCustomerStatisticDaily> list = iTaCustomerStatisticDailyService.getDailyList(customerType,getOrgId(request),person.getPersonId(),person.getUserId());
174 174
             responseBean.addSuccess(list);
175 175
         }catch (Exception e){
176 176
             e.printStackTrace();

+ 1
- 1
src/main/java/com/huiju/estateagents/statistic/controller/TsCustomerStatisticMonthlyController.java 파일 보기

@@ -171,7 +171,7 @@ public class TsCustomerStatisticMonthlyController extends BaseController {
171 171
         TaPerson person = taPersons.get(0);
172 172
         try {
173 173
             //查询月客户分析数据
174
-            List<TsCustomerStatisticMonthly> result = iTaCustomerStatisticMonthlyService.getCustomerMonthlyList(customerType, getOrgId(request),person.getPersonId());
174
+            List<TsCustomerStatisticMonthly> result = iTaCustomerStatisticMonthlyService.getCustomerMonthlyList(customerType, getOrgId(request),person.getPersonId(),person.getUserId());
175 175
             responseBean.addSuccess(result);
176 176
         }catch (Exception e){
177 177
             e.printStackTrace();

+ 2
- 1
src/main/java/com/huiju/estateagents/statistic/mapper/TsCustomerStatisticDailyMapper.java 파일 보기

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

+ 2
- 1
src/main/java/com/huiju/estateagents/statistic/mapper/TsCustomerStatisticMonthlyMapper.java 파일 보기

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

+ 2
- 1
src/main/java/com/huiju/estateagents/statistic/service/ITsCustomerStatisticDailyService.java 파일 보기

@@ -39,7 +39,8 @@ public interface ITsCustomerStatisticDailyService extends IService<TsCustomerSta
39 39
 	 * @param customerType
40 40
 	 * @param orgId
41 41
 	 * @param personId
42
+	 * @param userId
42 43
 	 * @return
43 44
 	 */
44
-	List<TsCustomerStatisticDaily> getDailyList(String customerType, Integer orgId, String personId);
45
+	List<TsCustomerStatisticDaily> getDailyList(String customerType, Integer orgId, String personId, Integer userId);
45 46
 }

+ 2
- 1
src/main/java/com/huiju/estateagents/statistic/service/ITsCustomerStatisticMonthlyService.java 파일 보기

@@ -39,7 +39,8 @@ public interface ITsCustomerStatisticMonthlyService extends IService<TsCustomerS
39 39
 	 * @param customerType
40 40
 	 * @param orgId
41 41
 	 * @param personId
42
+	 * @param userId
42 43
 	 * @return
43 44
 	 */
44
-	List<TsCustomerStatisticMonthly> getCustomerMonthlyList(String customerType, Integer orgId, String personId);
45
+	List<TsCustomerStatisticMonthly> getCustomerMonthlyList(String customerType, Integer orgId, String personId, Integer userId);
45 46
 }

+ 24
- 4
src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerStatisticDailyServiceImpl.java 파일 보기

@@ -78,18 +78,38 @@ public class TsCustomerStatisticDailyServiceImpl extends ServiceImpl<TsCustomerS
78 78
 	 * @param customerType
79 79
 	 * @param orgId
80 80
 	 * @param personId
81
+	 * @param userId
81 82
 	 * @return
82 83
 	 */
83 84
 	@Override
84
-	public List<TsCustomerStatisticDaily> getDailyList(String customerType, Integer orgId, String personId) {
85
+	public List<TsCustomerStatisticDaily> getDailyList(String customerType, Integer orgId, String personId, Integer userId) {
85 86
 		//当前日期
86 87
 		LocalDateTime nowDate = LocalDateTime.now();
87 88
 		//31天前的日期
88 89
 		LocalDateTime beforeDate = nowDate.plusDays(-31);
89 90
 		//获取31天的日期数据
90
-
91
-		List<TsCustomerStatisticDaily> list = customerStatisticDailyMapper.getDailyList(customerType,orgId,nowDate,beforeDate,personId);
92
-		return list;
91
+		List<TsCustomerStatisticDaily> list = customerStatisticDailyMapper.getDailyList(customerType,orgId,nowDate,beforeDate,personId,userId);
92
+		//构造31天的数据
93
+		List<TsCustomerStatisticDaily> newList = new ArrayList<>();
94
+		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
95
+		for (int i = 0; i < 31;i++){
96
+			String newDate = nowDate.plusDays(-i).format(formatter);
97
+			TsCustomerStatisticDaily tsCustomerStatisticDaily = new TsCustomerStatisticDaily();
98
+			tsCustomerStatisticDaily.setOrgId(orgId);
99
+			tsCustomerStatisticDaily.setCustomerNum(0);
100
+			tsCustomerStatisticDaily.setDay(newDate);
101
+			tsCustomerStatisticDaily.setCustomerType(customerType);
102
+			tsCustomerStatisticDaily.setRealtyConsultant(personId);
103
+			newList.add(tsCustomerStatisticDaily);
104
+			//合并数据
105
+			list.forEach(l -> {
106
+				if (newDate.equals(l.getDay())){
107
+					tsCustomerStatisticDaily.setCustomerNum(l.getCustomerNum());
108
+				}
109
+			});
110
+		}
111
+		
112
+		return newList;
93 113
 	}
94 114
 	
95 115
 	/**

+ 24
- 4
src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerStatisticMonthlyServiceImpl.java 파일 보기

@@ -77,17 +77,37 @@ public class TsCustomerStatisticMonthlyServiceImpl extends ServiceImpl<TsCustome
77 77
 	 * @param customerType
78 78
 	 * @param orgId
79 79
 	 * @param personId
80
+	 * @param userId
80 81
 	 * @return
81 82
 	 */
82 83
 	@Override
83
-	public List<TsCustomerStatisticMonthly> getCustomerMonthlyList(String customerType, Integer orgId, String personId) {
84
+	public List<TsCustomerStatisticMonthly> getCustomerMonthlyList(String customerType, Integer orgId, String personId, Integer userId) {
84 85
 		//当前日期
85 86
 		LocalDateTime nowDate = LocalDateTime.now();
86 87
 		//12个月前的日期
87 88
 		LocalDateTime beforeDate = nowDate.plusMonths(-12);
88
-		//获取31天的日期数据
89
-		List<TsCustomerStatisticMonthly> list = customerStatisticMonthlyMapper.getMonthlyList(customerType,orgId,nowDate,beforeDate,personId);
90
-		return list;
89
+		//获取12个月数据
90
+		List<TsCustomerStatisticMonthly> list = customerStatisticMonthlyMapper.getMonthlyList(customerType,orgId,nowDate,beforeDate,personId,userId);
91
+		//构造12个月的数据
92
+		List<TsCustomerStatisticMonthly> newList = new ArrayList<>();
93
+		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
94
+		for (int i = 0; i < 12;i++){
95
+			String newDate = nowDate.plusDays(-i).format(formatter);
96
+			TsCustomerStatisticMonthly tsCustomerStatisticMonthly = new TsCustomerStatisticMonthly();
97
+			tsCustomerStatisticMonthly.setCustomerType(customerType);
98
+			tsCustomerStatisticMonthly.setMonth(newDate);
99
+			tsCustomerStatisticMonthly.setCustomerNum(0);
100
+			tsCustomerStatisticMonthly.setOrgId(orgId);
101
+			tsCustomerStatisticMonthly.setRealtyConsultant(personId);
102
+			newList.add(tsCustomerStatisticMonthly);
103
+			list.forEach(l -> {
104
+				if (newDate.equals(l.getMonth())){
105
+					tsCustomerStatisticMonthly.setCustomerNum(l.getCustomerNum());
106
+				}
107
+			});
108
+		}
109
+		
110
+		return newList;
91 111
 	}
92 112
 	
93 113
 	/**

+ 8
- 7
src/main/resources/mapper/TaRecommendCustomerMapper.xml 파일 보기

@@ -607,7 +607,7 @@ FROM
607 607
 
608 608
     <select id="getMyCustStatistics" resultType="java.util.Map">
609 609
         SELECT
610
-            sum( IF ( STATUS = 4, 1, 0 ) ) AS clinchSum,
610
+            sum( IF ( STATUS = 4 AND verify_status = 1, 1, 0 ) ) AS clinchSum,
611 611
             sum( IF ( STATUS != 4 AND verify_status = 1, 1, 0 ) ) AS followSum
612 612
         FROM
613 613
             ta_recommend_customer
@@ -668,15 +668,16 @@ FROM
668 668
 
669 669
     <select id="getCustomerIntentions" resultType="com.huiju.estateagents.entity.PersonIntention">
670 670
         SELECT
671
-            SUM( intention ) AS intention,
672
-            building_id,
673
-            building_name
671
+            SUM( a.intention ) AS intention,
672
+            a.building_id,
673
+            b.building_name
674 674
         FROM
675
-            `ta_person_intention_record`
675
+            ta_person_intention_record a
676
+            left join ta_building b on a.building_id = b.building_id
676 677
         WHERE
677
-            person_id = #{personId}
678
+           a.person_id = #{personId}
678 679
         GROUP BY
679
-            building_id
680
+            a.building_id
680 681
         ORDER BY
681 682
             intention DESC
682 683
     </select>

+ 2
- 1
src/main/resources/mapper/statistic/TsCustomerGenderStatisticMapper.xml 파일 보기

@@ -14,7 +14,7 @@
14 14
         FROM
15 15
             ta_recommend_customer
16 16
         WHERE
17
-            date_format( create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
17
+            verify_status = 1
18 18
             GROUP BY org_id,realty_consultant
19 19
     </select>
20 20
     <select id="getFollowUpSexCount" resultType="com.huiju.estateagents.statistic.entity.GenderStatistic">
@@ -52,6 +52,7 @@
52 52
                     LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
53 53
                     AND t.building_id = c.building_id
54 54
                     AND t.org_id = c.org_id
55
+                    AND c.verify_status = 1
55 56
                 WHERE
56 57
                     t.is_checkin = 1
57 58
                 GROUP BY

+ 3
- 1
src/main/resources/mapper/statistic/TsCustomerStatisticDailyMapper.xml 파일 보기

@@ -30,6 +30,7 @@
30 30
             ta_recommend_customer
31 31
         WHERE
32 32
              date_format( create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
33
+             AND verify_status = 1
33 34
         GROUP BY
34 35
             org_id,realty_consultant
35 36
     </select>
@@ -43,6 +44,7 @@
43 44
             LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
44 45
             AND t.building_id = c.building_id
45 46
             AND t.org_id = c.org_id
47
+            AND c.verify_status = 1
46 48
         WHERE
47 49
             t.is_checkin = #{checkin}
48 50
             AND date_format( t.create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
@@ -58,7 +60,7 @@
58 60
         WHERE
59 61
           org_id = #{orgId}
60 62
         AND customer_type = #{customerType}
61
-        AND realty_consultant = #{personId}
63
+        AND (realty_consultant = #{personId} or realty_consultant = #{userId})
62 64
         AND date_format( create_date, '%Y-%m-%d' ) >= date_format( #{beforeDate}, '%Y-%m-%d' )
63 65
         AND date_format( create_date, '%Y-%m-%d' ) &lt;= date_format( #{nowDate}, '%Y-%m-%d' )
64 66
         order by `day`

+ 3
- 1
src/main/resources/mapper/statistic/TsCustomerStatisticMonthlyMapper.xml 파일 보기

@@ -12,6 +12,7 @@
12 12
             ta_recommend_customer
13 13
         WHERE
14 14
             date_format( create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
15
+            AND verify_status = 1
15 16
         GROUP BY
16 17
             org_id,realty_consultant
17 18
     </select>
@@ -40,6 +41,7 @@
40 41
             LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
41 42
             AND t.building_id = c.building_id
42 43
             AND t.org_id = c.org_id
44
+            AND c.verify_status = 1
43 45
         WHERE
44 46
             t.is_checkin = #{checkin}
45 47
             AND date_format( t.create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
@@ -54,7 +56,7 @@
54 56
         WHERE
55 57
           org_id = #{orgId}
56 58
         AND customer_type = #{customerType}
57
-        AND realty_consultant = #{personId}
59
+        AND (realty_consultant = #{personId} or realty_consultant = #{userId})
58 60
         AND date_format( create_date, '%Y-%m-%d' ) >= date_format( #{beforeDate}, '%Y-%m-%d' )
59 61
         AND date_format( create_date, '%Y-%m-%d' ) &lt;= date_format( #{nowDate}, '%Y-%m-%d' )
60 62
          order by `month`