Преглед изворни кода

Merge remote-tracking branch 'origin/dev' into dev

顾绍勇 пре 5 година
родитељ
комит
9bd99293f2

+ 41
- 0
src/main/java/com/huiju/estateagents/excel/IntentionUser.java Прегледај датотеку

@@ -35,4 +35,45 @@ public class IntentionUser {
35 35
     @ExcelProperty(value = "意向值", index = 3)
36 36
     private Integer intention;
37 37
 
38
+    /**
39
+     * 归属地
40
+     */
41
+    @ColumnWidth(15)
42
+    @ExcelProperty(value = "归属地", index = 4)
43
+    private String province;
44
+
45
+    /**
46
+     * 置业顾问
47
+     */
48
+    @ColumnWidth(15)
49
+    @ExcelProperty(value = "置业顾问", index = 5)
50
+    private String realtyConsultant;
51
+
52
+    /**
53
+     * 置业顾问电话
54
+     */
55
+    @ColumnWidth(15)
56
+    @ExcelProperty(value = "置业顾问电话", index = 6)
57
+    private String realtyConsultantPhone;
58
+
59
+    /**
60
+     * 分享者
61
+     */
62
+    @ColumnWidth(15)
63
+    @ExcelProperty(value = "分享者", index = 7)
64
+    private String sharePersonName;
65
+
66
+    /**
67
+     * 分享者电话
68
+     */
69
+    @ColumnWidth(15)
70
+    @ExcelProperty(value = "分享者电话", index = 8)
71
+    private String sharePersonPhone;
72
+
73
+    /**
74
+     * 性别
75
+     */
76
+    @ColumnWidth(15)
77
+    @ExcelProperty(value = "性别", index = 9)
78
+    private String gender;
38 79
 }

+ 22
- 16
src/main/resources/mapper/TaBuildingMapper.xml Прегледај датотеку

@@ -451,8 +451,10 @@
451 451
                 u.be_uv AS building_id
452 452
             FROM
453 453
                 ta_uv u
454
-            WHERE
454
+            LEFT JOIN ta_person p ON u.person_id = p.person_id
455
+        WHERE
455 456
                 u.tagert_type = 'project'
457
+                AND p.org_id = #{orgId}
456 458
             <if test="startDate != null">
457 459
                 and  TO_DAYS(u.create_date) >= TO_DAYS(#{startDate})
458 460
             </if>
@@ -631,21 +633,23 @@
631 633
         LEFT JOIN (
632 634
             SELECT
633 635
                 count( * ) AS uv_num,
634
-                be_uv AS building_id,
635
-                DATE_FORMAT( create_date, '%Y-%m-%d' ) AS create_date
636
+                u.be_uv AS building_id,
637
+                DATE_FORMAT( u.create_date, '%Y-%m-%d' ) AS create_date
636 638
             FROM
637
-                ta_uv
639
+                ta_uv u
640
+                LEFT JOIN ta_person p ON u.person_id = p.person_id
638 641
             WHERE
639 642
                 tagert_type = 'project'
640
-                AND be_uv = #{buildingId}
643
+                AND p.org_id = #{orgId}
644
+                AND u.be_uv = #{buildingId}
641 645
                 <if test="startDate != null">
642
-                    and  TO_DAYS(create_date) >= TO_DAYS(#{startDate})
646
+                    and  TO_DAYS(u.create_date) >= TO_DAYS(#{startDate})
643 647
                 </if>
644 648
                 <if test="endDate != null">
645
-                    and  TO_DAYS(create_date) &lt;= TO_DAYS(#{endDate})
649
+                    and  TO_DAYS(u.create_date) &lt;= TO_DAYS(#{endDate})
646 650
                 </if>
647 651
             GROUP BY
648
-                DATE_FORMAT( create_date, '%Y-%m-%d' )
652
+                DATE_FORMAT( u.create_date, '%Y-%m-%d' )
649 653
         ) u ON t.date = u.create_date
650 654
         ORDER BY create_date
651 655
     </select>
@@ -714,21 +718,23 @@
714 718
         LEFT JOIN (
715 719
         SELECT
716 720
         count( * ) AS uv_num,
717
-        be_uv AS building_id,
718
-        DATE_FORMAT( create_date, '%Y-%m-%d' ) AS create_date
721
+        u.be_uv AS building_id,
722
+        DATE_FORMAT( u.create_date, '%Y-%m-%d' ) AS create_date
719 723
         FROM
720
-        ta_uv
724
+        ta_uv u
725
+        LEFT JOIN ta_person p ON u.person_id = p.person_id
721 726
         WHERE
722
-        tagert_type = 'project'
723
-        AND be_uv = #{buildingId}
727
+        u.tagert_type = 'project'
728
+        AND p.org_id = #{orgId}
729
+        AND u.be_uv = #{buildingId}
724 730
         <if test="startDate != null">
725
-            and  TO_DAYS(create_date) >= TO_DAYS(#{startDate})
731
+            and  TO_DAYS(u.create_date) >= TO_DAYS(#{startDate})
726 732
         </if>
727 733
         <if test="endDate != null">
728
-            and  TO_DAYS(create_date) &lt;= TO_DAYS(#{endDate})
734
+            and  TO_DAYS(u.create_date) &lt;= TO_DAYS(#{endDate})
729 735
         </if>
730 736
         GROUP BY
731
-        DATE_FORMAT( create_date, '%Y-%m-%d' )
737
+        DATE_FORMAT( u.create_date, '%Y-%m-%d' )
732 738
         ) u ON t.date = u.create_date
733 739
         ORDER BY
734 740
         <if test="sortField != null and sortField != ''">

+ 60
- 12
src/main/resources/mapper/TaPersonIntentionRecordMapper.xml Прегледај датотеку

@@ -43,31 +43,79 @@
43 43
         ORDER BY SUM(tpir.intention) DESC
44 44
     </select>
45 45
     <select id="selectExportIntentionUser" resultType="com.huiju.estateagents.excel.IntentionUser">
46
+        select t.*, IFNULL(b.nickname, c.user_name) as sharePersonName, ifnull(b.phone, c.phone) as sharePersonPhone From (
47
+
46 48
         SELECT
47
-        tpir.person_name as  person_name,
49
+        tpir.person_name as person_name,
50
+        if(tp.gender = '1' , '男', if(tp.gender = '2', '女', '未知')) as gender,
48 51
         tp.phone as phone,
49
-        tpir.building_name as building_name,
52
+        tp.province,
53
+        tpir.person_id,
54
+        tpir.building_name,
55
+        tpir.building_id,
56
+        d.user_name as realtyConsultant,
57
+        d.phone as realtyConsultantPhone,
50 58
         SUM(tpir.intention) as intention
51
-        FROM
52
-        ta_person_intention_record tpir
53
-        LEFT JOIN ta_person tp on tpir.person_id = tp.person_id
59
+
60
+        FROM ta_person_intention_record tpir
61
+        LEFT JOIN ta_person tp ON tpir.person_id = tp.person_id
62
+        left join ta_recommend_customer c on c.person_id = tpir.person_id
63
+        left join ta_user d on c.realty_consultant = d.user_id
54 64
         <trim prefix="where" prefixOverrides="and | or">
55
-            <if test="buildingId != null and buildingId != ''">
56
-                tpir.building_id = #{buildingId}
57
-            </if>
58 65
             <if test="orgId != null">
59 66
                 AND tpir.org_id = #{orgId}
60 67
                 AND tp.org_id = #{orgId}
61 68
             </if>
69
+        </trim>
70
+        GROUP BY tpir.person_id, tpir.building_id
71
+
72
+        ) as t
73
+        left join ta_share_person_from a on t.person_id = a.person_id
74
+        left join ta_user c on a.share_person = c.user_id
75
+        left join ta_person b on a.share_person = b.person_id
76
+
77
+        <trim prefix="where" prefixOverrides="and | or">
78
+            <if test="buildingId != null and buildingId != ''">
79
+                t.building_id = #{buildingId}
80
+            </if>
62 81
             <if test="personBuildingList != null and personBuildingList.size > 0">
63
-                AND tpir.building_id in
82
+                AND t.building_id in
64 83
                 <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
65 84
                     #{personBuilding.buildingId}
66 85
                 </foreach>
67 86
             </if>
68 87
         </trim>
69
-        GROUP BY
70
-        tpir.person_id, tpir.building_id
71
-        ORDER BY SUM(tpir.intention) DESC
88
+
89
+        group by t.person_id, t.building_id
90
+        order by t.intention desc
91
+
92
+
93
+
94
+<!--        SELECT-->
95
+<!--        tpir.person_name as  person_name,-->
96
+<!--        tp.phone as phone,-->
97
+<!--        tpir.building_name as building_name,-->
98
+<!--        SUM(tpir.intention) as intention-->
99
+<!--        FROM-->
100
+<!--        ta_person_intention_record tpir-->
101
+<!--        LEFT JOIN ta_person tp on tpir.person_id = tp.person_id-->
102
+<!--        <trim prefix="where" prefixOverrides="and | or">-->
103
+<!--            <if test="buildingId != null and buildingId != ''">-->
104
+<!--                tpir.building_id = #{buildingId}-->
105
+<!--            </if>-->
106
+<!--            <if test="orgId != null">-->
107
+<!--                AND tpir.org_id = #{orgId}-->
108
+<!--                AND tp.org_id = #{orgId}-->
109
+<!--            </if>-->
110
+<!--            <if test="personBuildingList != null and personBuildingList.size > 0">-->
111
+<!--                AND tpir.building_id in-->
112
+<!--                <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">-->
113
+<!--                    #{personBuilding.buildingId}-->
114
+<!--                </foreach>-->
115
+<!--            </if>-->
116
+<!--        </trim>-->
117
+<!--        GROUP BY-->
118
+<!--        tpir.person_id, tpir.building_id-->
119
+<!--        ORDER BY SUM(tpir.intention) DESC-->
72 120
     </select>
73 121
 </mapper>

+ 13
- 15
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml Прегледај датотеку

@@ -1197,7 +1197,7 @@
1197 1197
         and a.status = 1
1198 1198
         and a.is_first_time = 1
1199 1199
         <if test="targetType != null and targetType != '' and targetType != 'h5'">
1200
-            and a.target_type = #{targetType}
1200
+            and a.target_type = concat(REPLACE(#{targetType}, 'activity', 'dynamic'), '_share')
1201 1201
         </if>
1202 1202
         <if test="startDate != null ">
1203 1203
             and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
@@ -1210,8 +1210,7 @@
1210 1210
         </if>
1211 1211
         group by a.person_id, a.target_type ,a.target_id
1212 1212
         ) as addRegistNum group by addRegistNum.target_type, addRegistNum.target_id
1213
-        ) as addRegistNum on addRegistNum.target_id = activity.activityId and substring_index(addRegistNum.target_type,
1214
-        '_share', 1) = activity.activityType
1213
+        ) as addRegistNum on addRegistNum.target_id = activity.activityId and REPLACE(addRegistNum.target_type, 'dynamic_share', 'activity') = activity.activityType
1215 1214
         <if test="targetType != null and targetType != ''">
1216 1215
             where activity.activityType = #{targetType}
1217 1216
         </if>
@@ -1410,7 +1409,7 @@
1410 1409
         and a.status = 1
1411 1410
         and a.is_first_time = 1
1412 1411
         <if test="targetType != null and targetType != '' and targetType != 'h5'">
1413
-            and a.target_type = #{targetType}
1412
+            and a.target_type = concat(REPLACE(#{targetType}, 'activity', 'dynamic'), '_share')
1414 1413
         </if>
1415 1414
         <if test="startDate != null ">
1416 1415
             and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
@@ -1423,8 +1422,7 @@
1423 1422
         </if>
1424 1423
         group by a.person_id, a.target_type ,a.target_id
1425 1424
         ) as addRegistNum group by addRegistNum.target_type, addRegistNum.target_id
1426
-        ) as addRegistNum on addRegistNum.target_id = activity.activityId and substring_index(addRegistNum.target_type,
1427
-        '_share', 1) = activity.activityType
1425
+        ) as addRegistNum on addRegistNum.target_id = activity.activityId and REPLACE(addRegistNum.target_type, 'dynamic_share', 'activity') = activity.activityType
1428 1426
         <if test="targetType != null and targetType != ''">
1429 1427
             where activity.activityType = #{targetType}
1430 1428
         </if>
@@ -1972,18 +1970,18 @@
1972 1970
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1973 1971
         a.province,
1974 1972
         b1.scene_alias as personFrom,
1975
-        GROUP_CONCAT(c.name) as realtyConsultant,
1976
-        ifnull(d.phone, d.tel) as realtyConsultantPhone,
1977
-        ifnull(e.nickname, f.user_name) as sharePersonName,
1978
-        ifnull(e.phone, e.tel) as sharePersonPhone
1973
+        GROUP_CONCAT(d.user_name) as realtyConsultant,
1974
+        d.phone as realtyConsultantPhone,
1975
+        ifnull(e.nickname, f.name) as sharePersonName,
1976
+        ifnull(e.phone, f.phone) as sharePersonPhone
1979 1977
         FROM ta_share_person_from t
1980 1978
         left join ta_person a on t.person_id = a.person_id
1981 1979
         left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId} and b.is_first_time =1
1982 1980
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
1983 1981
         left join ta_recommend_customer c on c.person_id = t.person_id
1984
-        left join ta_person d on c.recommend_person = d.person_id
1985
-        left join ta_person e on t.share_person = e.person_id
1986
-        left join ta_user f on t.share_person = f.user_id
1982
+        LEFT JOIN ta_user d ON c.realty_consultant = d.user_id
1983
+        LEFT JOIN ta_person e ON t.share_person = e.person_id
1984
+        LEFT JOIN ta_person f ON t.share_person = f.user_id
1987 1985
         WHERE t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id =
1988 1986
         #{orgId} and t.status = 1
1989 1987
         and t.is_first_time = 1
@@ -1993,7 +1991,7 @@
1993 1991
             and t.target_id = #{activityId}
1994 1992
         </if>
1995 1993
         <if test="activityType != null and activityType != ''">
1996
-            and t.target_type = concat(#{activityType}, '_share')
1994
+            and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
1997 1995
         </if>
1998 1996
         <if test="province != null and province != ''">
1999 1997
             and a.province like concat('%', #{province}, '%')
@@ -2035,7 +2033,7 @@
2035 2033
             and t.target_id = #{activityId}
2036 2034
         </if>
2037 2035
         <if test="activityType != null and activityType != ''">
2038
-            and t.target_type = concat(#{activityType}, '_share')
2036
+            and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
2039 2037
         </if>
2040 2038
         <if test="province != null and province != ''">
2041 2039
             and a.province like concat('%', #{province}, '%')