张延森 5 年之前
父節點
當前提交
bbd621626c

+ 0
- 3
src/main/java/com/huiju/estateagents/service/impl/TsConsultantKpiServiceImpl.java 查看文件

106
 
106
 
107
     @Override
107
     @Override
108
     public IPage<TaPerson> getConsultantShareCustomers(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate) {
108
     public IPage<TaPerson> getConsultantShareCustomers(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate) {
109
-        // buildingId 在表里不一定有数据, 实际执行 SQL 中没有这个条件
110
         return tsConsultantKpiMapper.getConsultantShareCustomers(page, orgId, userId, buildingId, startDate, endDate);
109
         return tsConsultantKpiMapper.getConsultantShareCustomers(page, orgId, userId, buildingId, startDate, endDate);
111
     }
110
     }
112
 
111
 
139
 
138
 
140
     @Override
139
     @Override
141
     public IPage<TaPerson> getConsultantSharePersons(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate) {
140
     public IPage<TaPerson> getConsultantSharePersons(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate) {
142
-        // buildingId 在表里不一定有数据, 实际执行 SQL 中没有这个条件
143
         return tsConsultantKpiMapper.getConsultantSharePersons(page, orgId, userId, buildingId, startDate, endDate);
141
         return tsConsultantKpiMapper.getConsultantSharePersons(page, orgId, userId, buildingId, startDate, endDate);
144
     }
142
     }
145
 
143
 
146
     @Override
144
     @Override
147
     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) {
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
         return tsConsultantKpiMapper.getConsultantShareTimes(page, orgId, userId, buildingId, startDate, endDate, targetType, targetName, userName, personId);
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 查看文件

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

+ 16
- 16
src/main/resources/mapper/TsConsultantKpiMapper.xml 查看文件

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