Ver código fonte

修改统计置业顾问userId,personId问题

张延森 3 anos atrás
pai
commit
9f2e048833

+ 5
- 1
src/main/java/com/yunzhi/marketing/controller/ExtendContentController.java Ver arquivo

@@ -243,7 +243,11 @@ public class ExtendContentController extends BaseController {
243 243
             responseBean.addError("未找到更新内容");
244 244
             return responseBean;
245 245
         }
246
-        extendContent.setStatus(origin.getStatus());
246
+
247
+        if (null == extendContent.getStatus()) {
248
+            extendContent.setStatus(origin.getStatus());
249
+        }
250
+
247 251
         extendContent.setContentId(id);
248 252
         try {
249 253
             if (extendContent.getCityId() == null){

+ 10
- 2
src/main/java/com/yunzhi/marketing/controller/TaPolicyController.java Ver arquivo

@@ -221,10 +221,18 @@ public class TaPolicyController extends BaseController {
221 221
     public ResponseBean taPolicyUpdate(@PathVariable Integer id,
222 222
                                         @RequestBody TaPolicy taPolicy,
223 223
                                        HttpServletRequest request){
224
-        ResponseBean responseBean = new ResponseBean();
225
-        try {
226 224
 
225
+        TaPolicy origin = iTaPolicyService.getById(id);
226
+        if (null == origin || !id.equals(taPolicy.getPolicyId())) {
227
+            return ResponseBean.error("未找到编辑内容", ResponseBean.ERROR_ILLEGAL_PARAMS);
228
+        }
227 229
 
230
+        if (null == taPolicy.getPublishStatus()) {
231
+            taPolicy.setPublishStatus(origin.getPublishStatus());
232
+        }
233
+
234
+        ResponseBean responseBean = new ResponseBean();
235
+        try {
228 236
             if(taPolicy.getPublishStatus().equals(CommConstant.IS_PUBLISH)){
229 237
                 taPolicy.setPublishDate(LocalDateTime.now());
230 238
                 String personId = getPersonId(request);

+ 24
- 16
src/main/resources/mapper/statistic/TsCustomerGenderStatisticMapper.xml Ver arquivo

@@ -4,18 +4,23 @@
4 4
 
5 5
     <select id="getNewCustomerSexCount" resultType="com.yunzhi.marketing.statistic.entity.GenderStatistic">
6 6
         SELECT
7
-            org_id,realty_consultant,
8
-            sum(if(sex = 1,1,0)) as man_sum,
9
-            sum(if(sex = 1,1,0))/count(*) as man_pct,
10
-            sum(if(sex = 2,1,0)) as woman_sum,
11
-            sum(if(sex = 2,1,0))/count(*) as woman_pct,
12
-            sum(if(sex != 1 and sex != 2,1,0)) as unknown_sum,
13
-            sum(if(sex != 1 and sex != 2,1,0))/count(*) as unknown_pct
7
+            t.org_id,
8
+            s.person_id AS realty_consultant,
9
+            sum( IF ( t.sex = 1, 1, 0 ) ) AS man_sum,
10
+            sum( IF ( t.sex = 1, 1, 0 ) ) / count( * ) AS man_pct,
11
+            sum( IF ( t.sex = 2, 1, 0 ) ) AS woman_sum,
12
+            sum( IF ( t.sex = 2, 1, 0 ) ) / count( * ) AS woman_pct,
13
+            sum( IF ( t.sex != 1 AND t.sex != 2, 1, 0 ) ) AS unknown_sum,
14
+            sum( IF ( t.sex != 1 AND t.sex != 2, 1, 0 ) ) / count( * ) AS unknown_pct
14 15
         FROM
15
-            ta_recommend_customer
16
+            ta_recommend_customer t
17
+                LEFT JOIN ta_person s ON s.person_id = t.realty_consultant
18
+                    OR s.user_id = t.realty_consultant
16 19
         WHERE
17
-            verify_status = 1
18
-            GROUP BY org_id,realty_consultant
20
+            t.verify_status = 1
21
+        GROUP BY
22
+            t.org_id,
23
+            s.person_id
19 24
     </select>
20 25
     <select id="getFollowUpSexCount" resultType="com.yunzhi.marketing.statistic.entity.GenderStatistic">
21 26
         SELECT
@@ -35,7 +40,7 @@
35 40
     <select id="getVisiteSexCount" resultType="com.yunzhi.marketing.statistic.entity.GenderStatistic">
36 41
         SELECT
37 42
             d.org_id,
38
-            d.realty_consultant,
43
+            d.realty_consultant_person as realty_consultant,
39 44
             sum( IF ( d.sex = 1, 1, 0 ) ) AS manSum,
40 45
             sum( IF ( d.sex = 1, 1, 0 ) ) / count( * ) AS manPct,
41 46
             sum( IF ( d.sex = 2, 1, 0 ) ) AS womanSum,
@@ -46,19 +51,22 @@
46 51
             (
47 52
                 SELECT
48 53
                     t.enlist_id,
49
-                    c.*
54
+                    c.*,
55
+                    s.person_id as realty_consultant_person
50 56
                 FROM
51 57
                     ta_activity_dynamic_enlist t
52 58
                     LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
53
-                    AND t.building_id = c.building_id
54
-                    AND t.org_id = c.org_id
55
-                    AND c.verify_status = 1
59
+                        AND t.building_id = c.building_id
60
+                        AND t.org_id = c.org_id
61
+                        AND c.verify_status = 1
62
+                    LEFT JOIN ta_person s ON s.person_id = c.realty_consultant
63
+                        OR s.user_id = c.realty_consultant
56 64
                 WHERE
57 65
                     t.is_checkin = 1
58 66
                 GROUP BY
59 67
                     c.customer_id
60 68
             ) d
61 69
         GROUP BY
62
-            d.org_id,d.realty_consultant
70
+            d.org_id,d.realty_consultant_person
63 71
     </select>
64 72
 </mapper>

+ 17
- 12
src/main/resources/mapper/statistic/TsCustomerStatisticDailyMapper.xml Ver arquivo

@@ -23,33 +23,38 @@
23 23
 
24 24
     <select id="getNewCustomerData" resultType="com.yunzhi.marketing.statistic.entity.TsCustomerStatisticDaily">
25 25
         SELECT
26
-            org_id,
27
-            count( customer_id ) as customer_num,
28
-			realty_consultant
26
+            t.org_id,
27
+            count( DISTINCT ( t.customer_id ) ) AS customer_num,
28
+            s.person_id AS realty_consultant
29 29
         FROM
30
-            ta_recommend_customer
30
+            ta_recommend_customer t
31
+                LEFT JOIN ta_person s ON s.person_id = t.realty_consultant
32
+                OR s.user_id = t.realty_consultant
31 33
         WHERE
32
-             date_format( create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
33
-             AND verify_status = 1
34
+                date_format( t.create_date, '%Y-%m-%d' ) = date_format(#{nowDate}, '%Y-%m-%d' )
35
+          AND t.verify_status = 1
34 36
         GROUP BY
35
-            org_id,realty_consultant
37
+            t.org_id,
38
+            s.person_id
36 39
     </select>
37 40
     <select id="getVisiteCustomerData" resultType="com.yunzhi.marketing.statistic.entity.TsCustomerStatisticDaily">
38 41
         SELECT
39 42
             count( DISTINCT ( c.customer_id ) ) as customer_num,
40 43
             c.org_id,
41
-			c.realty_consultant
44
+            s.person_id as realty_consultant
42 45
         FROM
43 46
             ta_activity_dynamic_enlist t
44 47
             LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
45
-            AND t.building_id = c.building_id
46
-            AND t.org_id = c.org_id
47
-            AND c.verify_status = 1
48
+                AND t.building_id = c.building_id
49
+                AND t.org_id = c.org_id
50
+                AND c.verify_status = 1
51
+            LEFT JOIN ta_person s ON s.person_id = c.realty_consultant
52
+                OR s.user_id = c.realty_consultant
48 53
         WHERE
49 54
             t.is_checkin = #{checkin}
50 55
             AND date_format( t.create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
51 56
         GROUP BY
52
-            c.org_id,c.realty_consultant
57
+            c.org_id, s.person_id
53 58
     </select>
54 59
     <select id="getDailyList" resultType="com.yunzhi.marketing.statistic.entity.TsCustomerStatisticDaily">
55 60
         SELECT