Browse Source

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

魏超 5 years ago
parent
commit
8b134bf353

+ 0
- 3
src/main/java/com/huiju/estateagents/service/impl/TsConsultantKpiServiceImpl.java View File

@@ -106,7 +106,6 @@ public class TsConsultantKpiServiceImpl extends ServiceImpl<TsConsultantKpiMappe
106 106
 
107 107
     @Override
108 108
     public IPage<TaPerson> getConsultantShareCustomers(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate) {
109
-        // buildingId 在表里不一定有数据, 实际执行 SQL 中没有这个条件
110 109
         return tsConsultantKpiMapper.getConsultantShareCustomers(page, orgId, userId, buildingId, startDate, endDate);
111 110
     }
112 111
 
@@ -139,13 +138,11 @@ public class TsConsultantKpiServiceImpl extends ServiceImpl<TsConsultantKpiMappe
139 138
 
140 139
     @Override
141 140
     public IPage<TaPerson> getConsultantSharePersons(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate) {
142
-        // buildingId 在表里不一定有数据, 实际执行 SQL 中没有这个条件
143 141
         return tsConsultantKpiMapper.getConsultantSharePersons(page, orgId, userId, buildingId, startDate, endDate);
144 142
     }
145 143
 
146 144
     @Override
147 145
     public IPage<TaPerson> getConsultantShareTimes(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate, String targetType, String targetName, String userName, String personId) {
148
-        // buildingId 在表里不一定有数据, 实际执行 SQL 中没有这个条件
149 146
         return tsConsultantKpiMapper.getConsultantShareTimes(page, orgId, userId, buildingId, startDate, endDate, targetType, targetName, userName, personId);
150 147
     }
151 148
 

+ 1
- 1
src/main/resources/mapper/TaUserMapper.xml View File

@@ -129,7 +129,7 @@
129 129
         select building_id from ta_person_building
130 130
         where user_id = #{userId}
131 131
         <if test="buildingId != null and buildingId != ''">
132
-            and building_id != #{buildingId}
132
+            and building_id = #{buildingId}
133 133
         </if>
134 134
     </select>
135 135
 

+ 16
- 16
src/main/resources/mapper/TsConsultantKpiMapper.xml View File

@@ -164,11 +164,9 @@
164 164
             or ( e.target_type = 'share' and e.target_id = 'index' )
165 165
         )
166 166
         AND e.create_date BETWEEN #{startDate} and #{endDate}
167
-        <!-- building_id 字段数据不全
168 167
         <if test="buildingId != null and buildingId !=''">
169 168
             AND e.building_id = #{buildingId}
170 169
         </if>
171
-        -->
172 170
         AND e.is_first_time = 1
173 171
 
174 172
         AND t.phone is not null
@@ -183,7 +181,7 @@
183 181
         SELECT
184 182
             t.*,
185 183
             count( * ) as visit_times,
186
-            f.visit_time as visit_time
184
+            max(f.visit_time) as visit_time
187 185
         FROM
188 186
             ta_person t
189 187
         INNER JOIN ta_person_visit_record f ON f.org_id = #{orgId} AND f.person_id = t.person_id
@@ -235,7 +233,7 @@
235 233
     <select id="getConsultantChatPersons" resultType="com.huiju.estateagents.entity.TaPerson">
236 234
         SELECT
237 235
             t.*,
238
-            h.create_date AS visit_time
236
+            max(h.create_date) AS visit_time
239 237
         FROM
240 238
             ta_person t
241 239
         INNER JOIN ta_chat h ON h.send_person = t.person_id
@@ -298,7 +296,10 @@
298 296
             OR t.tagert_type like 'live%'
299 297
             )
300 298
         </if>
301
-        <if test="targetType != null and targetType !=''">
299
+        <if test="targetType != null and targetType =='card_share'">
300
+            AND t.tagert_type = 'consultant'
301
+        </if>
302
+        <if test="targetType != null and targetType !='' and targetType != 'card_share'">
302 303
             AND t.tagert_type like concat(#{targetType}, '%')
303 304
         </if>
304 305
 
@@ -317,7 +318,7 @@
317 318
         SELECT
318 319
             t.*,
319 320
             count(*) as visit_times,
320
-            e.create_date as visit_time
321
+            max(e.create_date) as visit_time
321 322
         FROM ta_share_person_from e
322 323
         INNER JOIN ta_person t ON t.person_id = e.person_id
323 324
         WHERE e.org_id = #{orgId}
@@ -327,11 +328,11 @@
327 328
                 e.target_type IN ( 'card_share', 'building_share', 'dynamic_share', 'group_share', 'h5_share', 'help_share', 'house_share', 'live_share', 'news_share', 'poster' )
328 329
                 OR ( e.target_type = 'share' AND e.target_id = 'index' )
329 330
             )
330
-            <!-- building_id 字段数据不全
331
-            <if test="buildingId != null and buildingId !=''">
332
-                AND e.building_id = #{buildingId}
333
-            </if>
334
-            -->
331
+
332
+        <if test="buildingId != null and buildingId !=''">
333
+            AND e.building_id = #{buildingId}
334
+        </if>
335
+
335 336
 <!--            AND t.`status` = 1-->
336 337
         GROUP BY t.person_id, DATE_FORMAT(e.create_date, '%Y%m%d')
337 338
         ORDER BY e.create_date DESC
@@ -368,11 +369,10 @@
368 369
         </if>
369 370
 
370 371
             AND e.create_date BETWEEN #{startDate} and #{endDate}
371
-            <!-- building_id 字段数据不全
372
-            <if test="buildingId != null and buildingId !=''">
373
-                AND e.building_id = #{buildingId}
374
-            </if>
375
-            -->
372
+
373
+        <if test="buildingId != null and buildingId !=''">
374
+            AND e.building_id = #{buildingId}
375
+        </if>
376 376
 
377 377
         <if test="personId != null and personId !=''">
378 378
             AND t.person_id = #{personId}