浏览代码

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

weichaochao 5 年前
父节点
当前提交
be1fe984c3

+ 14
- 14
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java 查看文件

791
             // 设置 sheet, 同一个sheet只需要设置一次
791
             // 设置 sheet, 同一个sheet只需要设置一次
792
             WriteSheet writeSheet = EasyExcel.writerSheet("客户列表-公客").build();
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
                 excelWriter.write(publicList, writeSheet);
799
                 excelWriter.write(publicList, writeSheet);
800
 
800
 
801
-                pageCode ++;
802
-            } while (pageCode <= pageCount);
801
+//                pageCode ++;
802
+//            } while (pageCode <= pageCount);
803
 
803
 
804
             // finish 会帮忙关闭流
804
             // finish 会帮忙关闭流
805
             excelWriter.finish();
805
             excelWriter.finish();
813
             // 设置 sheet, 同一个sheet只需要设置一次
813
             // 设置 sheet, 同一个sheet只需要设置一次
814
             WriteSheet writeSheet = EasyExcel.writerSheet("客户列表-私客").build();
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
                 excelWriter.write(privateList, writeSheet);
821
                 excelWriter.write(privateList, writeSheet);
822
 
822
 
823
-                pageCode ++;
824
-            } while (pageCode <= pageCount);
823
+//                pageCode ++;
824
+//            } while (pageCode <= pageCount);
825
             // finish 会帮忙关闭流
825
             // finish 会帮忙关闭流
826
             excelWriter.finish();
826
             excelWriter.finish();
827
 
827
 

+ 2
- 1
src/main/resources/mapper/TaActivityDynamicEnlistMapper.xml 查看文件

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

+ 1
- 1
src/main/resources/mapper/TaPersonMapper.xml 查看文件

257
             FROM
257
             FROM
258
                ta_person tp
258
                ta_person tp
259
              LEFT JOIN
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
             ON tp.person_id = tpvr.person_id
261
             ON tp.person_id = tpvr.person_id
262
              where tp.org_id = #{org} AND tp.person_type IN ('customer','drift','estate agent')
262
              where tp.org_id = #{org} AND tp.person_type IN ('customer','drift','estate agent')
263
              GROUP BY DATE_FORMAT( tpvr.max_visit_time , '%Y-%m-%d' )
263
              GROUP BY DATE_FORMAT( tpvr.max_visit_time , '%Y-%m-%d' )

+ 9
- 8
src/main/resources/mapper/TaRecommendCustomerMapper.xml 查看文件

111
         SELECT
111
         SELECT
112
         a.*,
112
         a.*,
113
         a.customer_id AS customerId,
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
         c.building_name as intentionName
116
         c.building_name as intentionName
117
         FROM
117
         FROM
118
         ta_recommend_customer a
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
         LEFT JOIN ta_building c ON a.building_id = c.building_id
121
         LEFT JOIN ta_building c ON a.building_id = c.building_id
121
         <where>
122
         <where>
122
             a.status > 0
123
             a.status > 0
266
             <if test="consultTel != null and consultTel !=''">
267
             <if test="consultTel != null and consultTel !=''">
267
                 and b.tel like CONCAT('%',#{consultTel}, '%')
268
                 and b.tel like CONCAT('%',#{consultTel}, '%')
268
             </if>
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
         </where>
271
         </where>
271
         order by b.create_date desc
272
         order by b.create_date desc
272
     </select>
273
     </select>
514
             <if test="consultTel != null and consultTel !=''">
515
             <if test="consultTel != null and consultTel !=''">
515
                 and b.tel like CONCAT('%',#{consultTel}, '%')
516
                 and b.tel like CONCAT('%',#{consultTel}, '%')
516
             </if>
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
         </where>
519
         </where>
519
         order by b.create_date desc
520
         order by b.create_date desc
520
     </select>
521
     </select>
547
             <if test="consultTel != null and consultTel !=''">
548
             <if test="consultTel != null and consultTel !=''">
548
                 and b.tel like CONCAT('%',#{consultTel}, '%')
549
                 and b.tel like CONCAT('%',#{consultTel}, '%')
549
             </if>
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
             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
             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
         </where>
553
         </where>
553
         order by b.create_date desc
554
         order by b.create_date desc
554
-        limit #{pageCode}, #{pageSize}
555
     </select>
555
     </select>
556
+    <!--        limit #{pageCode}, #{pageSize}-->
556
 
557
 
557
     <select id="getCustomerExportListCount" resultType="Integer" >
558
     <select id="getCustomerExportListCount" resultType="Integer" >
558
         SELECT
559
         SELECT
671
         </where>
672
         </where>
672
         group by a.customer_id,a.building_id
673
         group by a.customer_id,a.building_id
673
         order by a.create_date desc
674
         order by a.create_date desc
674
-        limit #{pageCode}, #{pageSize}
675
     </select>
675
     </select>
676
+    <!--        limit #{pageCode}, #{pageSize}-->
676
 
677
 
677
     <select id="getMyCustStatistics" resultType="java.util.Map">
678
     <select id="getMyCustStatistics" resultType="java.util.Map">
678
         SELECT
679
         SELECT

+ 2
- 1
src/main/resources/mapper/TaShareCountMapper.xml 查看文件

81
                 left join ta_building e on t.target_id = e.building_id and t.target_type = 'building_share'
81
                 left join ta_building e on t.target_id = e.building_id and t.target_type = 'building_share'
82
                 LEFT JOIN ta_news f on t.target_id = f.news_id and t.target_type = 'news_share'
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
         LEFT JOIN ta_person z ON t.person_id = z.person_id
86
         LEFT JOIN ta_person z ON t.person_id = z.person_id
86
         WHERE
87
         WHERE
87
             (t.share_person = (select user_id from ta_person where person_id = #{personId}) or t.share_person = #{personId})
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 查看文件

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