魏超 5 年之前
父節點
當前提交
1dfacf4238

+ 1
- 6
src/main/java/com/huiju/estateagents/controller/TaPersonVisitRecordController.java 查看文件

323
 
323
 
324
         List<TaConsultantInfo> taConsultantInfos = result.getRecords();
324
         List<TaConsultantInfo> taConsultantInfos = result.getRecords();
325
         taConsultantInfos.forEach(e ->{
325
         taConsultantInfos.forEach(e ->{
326
-            QueryWrapper<TaPerson> taPersonQueryWrapper = new QueryWrapper<>();
327
-            taPersonQueryWrapper.eq("user_id",userId);
328
-            taPersonQueryWrapper.eq("org_id",getOrgId(request));
329
-            TaPerson taPerson = taPersonService.getOne(taPersonQueryWrapper);
330
-
331
-            Integer shareNum = iTaPersonVisitRecordService.countShareNumByEventType(e.getTargetId(), getOrgId(request), userId, e.getEventType(), taPerson.getPersonId());
326
+            Integer shareNum = iTaPersonVisitRecordService.countShareNumByEventType(e.getTargetId(), getOrgId(request), userId, e.getEventType());
332
             switch (e.getEventType()){
327
             switch (e.getEventType()){
333
                 case CommConstant.POSTER_CONTENT_TYPE_ACTIVITY:
328
                 case CommConstant.POSTER_CONTENT_TYPE_ACTIVITY:
334
                     e.setActivityShareNum(shareNum);
329
                     e.setActivityShareNum(shareNum);

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaPersonVisitRecordMapper.java 查看文件

80
 
80
 
81
     IPage<TaConsultantInfo> getConsultantShareInfoList(IPage<TaConsultantInfo> pg, @Param("userId") Integer userId, @Param("orgId") Integer orgId);
81
     IPage<TaConsultantInfo> getConsultantShareInfoList(IPage<TaConsultantInfo> pg, @Param("userId") Integer userId, @Param("orgId") Integer orgId);
82
 
82
 
83
-    Integer countShareNumByEventType(@Param("targetId") String targetId, @Param("orgId")Integer orgId, @Param("userId")Integer userId, @Param("eventType")String eventType, @Param("personId")String personId);
83
+    Integer countShareNumByEventType(@Param("targetId") String targetId, @Param("orgId")Integer orgId, @Param("userId")Integer userId, @Param("eventType")String eventType);
84
 }
84
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaPersonVisitRecordService.java 查看文件

53
 
53
 
54
 	IPage<TaConsultantInfo> getConsultantShareInfoList(IPage<TaConsultantInfo> pg, Integer userId, Integer orgId);
54
 	IPage<TaConsultantInfo> getConsultantShareInfoList(IPage<TaConsultantInfo> pg, Integer userId, Integer orgId);
55
 
55
 
56
-	Integer countShareNumByEventType(String targetId, Integer orgId, Integer userId, String eventType, String personId);
56
+	Integer countShareNumByEventType(String targetId, Integer orgId, Integer userId, String eventType);
57
 }
57
 }

+ 2
- 2
src/main/java/com/huiju/estateagents/service/impl/TaPersonVisitRecordServiceImpl.java 查看文件

163
 	}
163
 	}
164
 
164
 
165
 	@Override
165
 	@Override
166
-	public Integer countShareNumByEventType(String targetId, Integer orgId, Integer userId, String eventType, String personId) {
167
-		return personVisitRecordMapper.countShareNumByEventType(targetId, orgId, userId, eventType, personId);
166
+	public Integer countShareNumByEventType(String targetId, Integer orgId, Integer userId, String eventType) {
167
+		return personVisitRecordMapper.countShareNumByEventType(targetId, orgId, userId, eventType);
168
 	}
168
 	}
169
 
169
 
170
 	/**
170
 	/**

+ 3
- 13
src/main/resources/mapper/TaPersonVisitRecordMapper.xml 查看文件

141
             left join ta_building_dynamic tbd on t.target_id = tbd.dynamic_id
141
             left join ta_building_dynamic tbd on t.target_id = tbd.dynamic_id
142
             left join ta_person c on t.share_person_id = c.person_id
142
             left join ta_person c on t.share_person_id = c.person_id
143
             where
143
             where
144
-            1=1
144
+            t.share_person_id is not null and t.share_person_id != ''
145
             <if test="orgId != null and orgId != ''">
145
             <if test="orgId != null and orgId != ''">
146
                 and t.org_id = #{orgId}
146
                 and t.org_id = #{orgId}
147
             </if>
147
             </if>
274
         where t.event_type = 'news'
273
         where t.event_type = 'news'
275
         and t.consultant_id = #{userId}
274
         and t.consultant_id = #{userId}
276
         and t.org_id = #{orgId}
275
         and t.org_id = #{orgId}
277
-        group by t.target_id
278
         and t.`event` = 'share'
276
         and t.`event` = 'share'
277
+        group by t.target_id
279
 
278
 
280
         union all
279
         union all
281
 
280
 
298
     </select>
297
     </select>
299
 
298
 
300
     <select id="countShareNumByEventType" resultType="java.lang.Integer">
299
     <select id="countShareNumByEventType" resultType="java.lang.Integer">
301
-		select count(1) from (
302
-				 SELECT
303
-            t.*
304
-        FROM
305
-            ( SELECT t.* FROM ta_person_visit_record t WHERE org_id = #{orgId} and target_id = #{targetId}  AND consultant_id = #{userId} and person_id != #{personId} and t.event_type = #{eventType} ORDER BY visit_time DESC LIMIT 999) t
306
-            left JOIN ta_person p on t.person_id = p.person_id
307
-        GROUP BY
308
-            t.person_id
309
-	        t.visit_time DESC ) t;
310
-        ORDER BY
311
-        select count(DISTINCT t.person_id) from ta_person_visit_record t
300
+        select count(DISTINCT t.person_id)  from ta_person_visit_record t
312
         where
301
         where
313
         t.consultant_id = #{userId}
302
         t.consultant_id = #{userId}
314
         and t.org_id = #{orgId}
303
         and t.org_id = #{orgId}