Parcourir la source

Merge branch 'master' of http://git.ycjcjy.com/zhiyuxing/estateagents

weichaochao il y a 5 ans
Parent
révision
be1fe984c3

+ 14
- 14
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java Voir le fichier

@@ -791,15 +791,15 @@ public class TaRecommendCustomerController extends BaseController {
791 791
             // 设置 sheet, 同一个sheet只需要设置一次
792 792
             WriteSheet writeSheet = EasyExcel.writerSheet("客户列表-公客").build();
793 793
 
794
-            Integer count = taRecommendCustomerMapper.getPublicCustomerExportListCount(name, tel,  entryType, verifyStatus, sex, orgId,consultTel);
795
-            pageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1;
796
-            List<PublicCustomerExport> publicList = null;
797
-            do {
798
-                publicList = taRecommendCustomerMapper.getPublicCustomerExportList(pageCode * pageSize, pageSize, name, tel,  entryType, verifyStatus, sex, orgId,consultTel);
794
+//            Integer count = taRecommendCustomerMapper.getPublicCustomerExportListCount(name, tel,  entryType, verifyStatus, sex, orgId,consultTel);
795
+//            pageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1;
796
+//            List<PublicCustomerExport> publicList = null;
797
+//            do {
798
+                List<PublicCustomerExport> publicList = taRecommendCustomerMapper.getPublicCustomerExportList(pageCode * pageSize, pageSize, name, tel,  entryType, verifyStatus, sex, orgId,consultTel);
799 799
                 excelWriter.write(publicList, writeSheet);
800 800
 
801
-                pageCode ++;
802
-            } while (pageCode <= pageCount);
801
+//                pageCode ++;
802
+//            } while (pageCode <= pageCount);
803 803
 
804 804
             // finish 会帮忙关闭流
805 805
             excelWriter.finish();
@@ -813,15 +813,15 @@ public class TaRecommendCustomerController extends BaseController {
813 813
             // 设置 sheet, 同一个sheet只需要设置一次
814 814
             WriteSheet writeSheet = EasyExcel.writerSheet("客户列表-私客").build();
815 815
 
816
-            Integer count = taRecommendCustomerMapper.getCustomerExportListCount(buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId,status,getTaPersonBuildingListByUserId(request));
817
-            pageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1;
818
-            List<PrivateCustomerExport> privateList = null;
819
-            do {
820
-                privateList = taRecommendCustomerMapper.getCustomerExportList(pageCode *  pageSize, pageSize, buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId,status,getTaPersonBuildingListByUserId(request));
816
+//            Integer count = taRecommendCustomerMapper.getCustomerExportListCount(buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId,status,getTaPersonBuildingListByUserId(request));
817
+//            pageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1;
818
+//            List<PrivateCustomerExport> privateList = null;
819
+//            do {
820
+                List<PrivateCustomerExport> privateList = taRecommendCustomerMapper.getCustomerExportList(pageCode *  pageSize, pageSize, buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId,status,getTaPersonBuildingListByUserId(request));
821 821
                 excelWriter.write(privateList, writeSheet);
822 822
 
823
-                pageCode ++;
824
-            } while (pageCode <= pageCount);
823
+//                pageCode ++;
824
+//            } while (pageCode <= pageCount);
825 825
             // finish 会帮忙关闭流
826 826
             excelWriter.finish();
827 827
 

+ 2
- 1
src/main/resources/mapper/TaActivityDynamicEnlistMapper.xml Voir le fichier

@@ -29,7 +29,7 @@
29 29
                         and tade.phone like CONCAT('%',#{phone}, '%')
30 30
                     </if>
31 31
                 </where>
32
-
32
+            group by tade.person_id
33 33
 
34 34
         </select>
35 35
 
@@ -63,6 +63,7 @@
63 63
                 and tade.phone like CONCAT('%',#{phone}, '%')
64 64
             </if>
65 65
         </where>
66
+        group by tade.person_id
66 67
         limit #{pageCode}, #{pageSize}
67 68
     </select>
68 69
 </mapper>

+ 1
- 1
src/main/resources/mapper/TaPersonMapper.xml Voir le fichier

@@ -257,7 +257,7 @@ FROM
257 257
             FROM
258 258
                ta_person tp
259 259
              LEFT JOIN
260
-            ( SELECT *, MAX(visit_time) as max_visit_time FROM ta_person_visit_record GROUP BY  person_id  ) as tpvr
260
+                ( SELECT *, MAX(visit_time) as max_visit_time FROM ta_person_visit_record where org_id = #{org} GROUP BY  person_id  ) as tpvr
261 261
             ON tp.person_id = tpvr.person_id
262 262
              where tp.org_id = #{org} AND tp.person_type IN ('customer','drift','estate agent')
263 263
              GROUP BY DATE_FORMAT( tpvr.max_visit_time , '%Y-%m-%d' )

+ 9
- 8
src/main/resources/mapper/TaRecommendCustomerMapper.xml Voir le fichier

@@ -111,12 +111,13 @@ FROM
111 111
         SELECT
112 112
         a.*,
113 113
         a.customer_id AS customerId,
114
-        b.NAME AS consultantName,
115
-        b.tel AS consultTel,
114
+        if(b.NAME  = null, d.name, b.name) as consultantName,
115
+        if(b.tel  = null, d.tel, b.tel) AS consultTel,
116 116
         c.building_name as intentionName
117 117
         FROM
118 118
         ta_recommend_customer a
119
-        LEFT JOIN ta_person b ON (a.realty_consultant = b.person_id or a.realty_consultant = b.user_id)
119
+        LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
120
+        LEFT JOIN ta_person d on a.realty_consultant = d.user_id
120 121
         LEFT JOIN ta_building c ON a.building_id = c.building_id
121 122
         <where>
122 123
             a.status > 0
@@ -266,7 +267,7 @@ FROM
266 267
             <if test="consultTel != null and consultTel !=''">
267 268
                 and b.tel like CONCAT('%',#{consultTel}, '%')
268 269
             </if>
269
-            and NOT EXISTS ( select * from ta_recommend_customer a where a.recommend_person = b.person_id)
270
+            and NOT EXISTS ( select * from ta_recommend_customer a where a.org_id = #{orgId} and a.recommend_person = b.person_id)
270 271
         </where>
271 272
         order by b.create_date desc
272 273
     </select>
@@ -514,7 +515,7 @@ FROM
514 515
             <if test="consultTel != null and consultTel !=''">
515 516
                 and b.tel like CONCAT('%',#{consultTel}, '%')
516 517
             </if>
517
-            and NOT EXISTS ( select * from ta_recommend_customer a where a.recommend_person = b.person_id)
518
+            and NOT EXISTS ( select * from ta_recommend_customer a where a.org_id = #{orgId} and a.recommend_person = b.person_id)
518 519
         </where>
519 520
         order by b.create_date desc
520 521
     </select>
@@ -547,12 +548,12 @@ FROM
547 548
             <if test="consultTel != null and consultTel !=''">
548 549
                 and b.tel like CONCAT('%',#{consultTel}, '%')
549 550
             </if>
550
-            and NOT EXISTS ( select * from ta_recommend_customer a where a.recommend_person = b.person_id)
551
+            and NOT EXISTS ( select * from ta_recommend_customer a where a.org_id = #{orgId} and a.recommend_person = b.person_id)
551 552
             AND b.person_id not IN ( SELECT c.person_id FROM ta_recommend_customer c WHERE c.org_id = #{orgId} AND person_id is not null AND person_id != ''  )
552 553
         </where>
553 554
         order by b.create_date desc
554
-        limit #{pageCode}, #{pageSize}
555 555
     </select>
556
+    <!--        limit #{pageCode}, #{pageSize}-->
556 557
 
557 558
     <select id="getCustomerExportListCount" resultType="Integer" >
558 559
         SELECT
@@ -671,8 +672,8 @@ FROM
671 672
         </where>
672 673
         group by a.customer_id,a.building_id
673 674
         order by a.create_date desc
674
-        limit #{pageCode}, #{pageSize}
675 675
     </select>
676
+    <!--        limit #{pageCode}, #{pageSize}-->
676 677
 
677 678
     <select id="getMyCustStatistics" resultType="java.util.Map">
678 679
         SELECT

+ 2
- 1
src/main/resources/mapper/TaShareCountMapper.xml Voir le fichier

@@ -81,7 +81,8 @@
81 81
                 left join ta_building e on t.target_id = e.building_id and t.target_type = 'building_share'
82 82
                 LEFT JOIN ta_news f on t.target_id = f.news_id and t.target_type = 'news_share'
83 83
 
84
-        LEFT JOIN ta_person a ON t.share_person = a.person_id or t.share_person = a.user_id
84
+        LEFT JOIN ta_person a ON t.share_person = a.person_id
85
+        LEFT JOIN ta_person y on t.share_person = y.user_id
85 86
         LEFT JOIN ta_person z ON t.person_id = z.person_id
86 87
         WHERE
87 88
             (t.share_person = (select user_id from ta_person where person_id = #{personId}) or t.share_person = #{personId})

+ 6
- 5
src/main/resources/mapper/TaSharePersonFromMapper.xml Voir le fichier

@@ -3,13 +3,14 @@
3 3
 <mapper namespace="com.huiju.estateagents.mapper.TaSharePersonFromMapper">
4 4
 
5 5
     <select id="countViewNum" resultType="java.lang.Integer">
6
-      select count(*) from (
6
+        select count(*) from (
7 7
         select count(1) from ta_share_person_from t
8
-        left join ta_person a on t.share_person = a.person_id or t.share_person = a.user_id
8
+        left join ta_person a on t.share_person = a.person_id
9
+        left join ta_person b on t.share_person = b.user_id
9 10
         where
10
-        (t.share_person = #{userId}
11
+        t.share_person in (#{userId}
11 12
         <if test="personId != null and personId != ''">
12
-            or t.share_person = #{personId}
13
+            ,#{personId}
13 14
         </if>
14 15
         )
15 16
         and t.org_id = #{orgId} and t.status = 1 and t.person_id != #{personId}
@@ -20,6 +21,6 @@
20 21
             and  date_format(t.create_date,'%Y-%m-%d') &lt;= date_format(#{endCreateDate},'%Y-%m-%d')
21 22
         </if>
22 23
         GROUP BY t.person_id
23
-      ) t
24
+        ) t
24 25
     </select>
25 26
 </mapper>