|
@@ -3,6 +3,7 @@ package com.huiju.estateagents.service.impl;
|
3
|
3
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
4
|
4
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
5
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
6
|
+import com.huiju.estateagents.base.ResponseBean;
|
6
|
7
|
import com.huiju.estateagents.center.taUser.entity.TaUser;
|
7
|
8
|
import com.huiju.estateagents.center.taUser.mapper.TaUserMapper;
|
8
|
9
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -11,6 +12,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
11
|
12
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
12
|
13
|
import com.huiju.estateagents.common.CommConstant;
|
13
|
14
|
import com.huiju.estateagents.common.StringUtils;
|
|
15
|
+import com.huiju.estateagents.controller.TaMiniFormidsController;
|
14
|
16
|
import com.huiju.estateagents.drainage.entity.TaDrainage;
|
15
|
17
|
import com.huiju.estateagents.drainage.mapper.TaDrainageMapper;
|
16
|
18
|
import com.huiju.estateagents.entity.*;
|
|
@@ -21,10 +23,12 @@ import com.huiju.estateagents.mapper.TaPersonMapper;
|
21
|
23
|
import com.huiju.estateagents.mapper.TaPersonVisitRecordMapper;
|
22
|
24
|
import com.huiju.estateagents.mapper.TaRecommendCustomerMapper;
|
23
|
25
|
import com.huiju.estateagents.mapper.TaShareActivityMapper;
|
24
|
|
-import com.huiju.estateagents.service.ITaPersonVisitRecordService;
|
|
26
|
+import com.huiju.estateagents.service.*;
|
|
27
|
+import com.sun.corba.se.spi.resolver.Resolver;
|
25
|
28
|
import org.springframework.beans.factory.annotation.Autowired;
|
26
|
29
|
import org.springframework.stereotype.Service;
|
27
|
30
|
|
|
31
|
+import java.time.LocalDateTime;
|
28
|
32
|
import java.util.Collections;
|
29
|
33
|
import java.util.List;
|
30
|
34
|
|
|
@@ -66,6 +70,21 @@ public class TaPersonVisitRecordServiceImpl extends ServiceImpl<TaPersonVisitRec
|
66
|
70
|
@Autowired
|
67
|
71
|
private TaDrainageMapper taDrainageMapper;
|
68
|
72
|
|
|
73
|
+ @Autowired
|
|
74
|
+ private ITaEventPropertiesService taEventPropertiesService;
|
|
75
|
+
|
|
76
|
+ @Autowired
|
|
77
|
+ private ITaBuildingIntentionService buildingIntentionService;
|
|
78
|
+
|
|
79
|
+ @Autowired
|
|
80
|
+ private ITaBuildingService buildingService;
|
|
81
|
+
|
|
82
|
+ @Autowired
|
|
83
|
+ private ITaPersonIntentionRecordService personIntentionRecordService;
|
|
84
|
+
|
|
85
|
+ @Autowired
|
|
86
|
+ private ITaPersonFromRecordService iTaPersonFromRecordService;
|
|
87
|
+
|
69
|
88
|
/**
|
70
|
89
|
* 分页获取客户访问记录
|
71
|
90
|
*
|
|
@@ -179,6 +198,70 @@ public class TaPersonVisitRecordServiceImpl extends ServiceImpl<TaPersonVisitRec
|
179
|
198
|
return personVisitRecordMapper.countShareNumByEventType(orgId, targetId, userId, personId, eventType);
|
180
|
199
|
}
|
181
|
200
|
|
|
201
|
+ @Override
|
|
202
|
+ public ResponseBean newRecord(TaPersonVisitRecord taPersonVisitRecord, TaPerson person) {
|
|
203
|
+ Integer orgId = person.getOrgId();
|
|
204
|
+
|
|
205
|
+ Integer eventProperties = taEventPropertiesService.isEventExist(taPersonVisitRecord.getTargetId(), taPersonVisitRecord.getEventType(), taPersonVisitRecord.getActivity(), orgId);
|
|
206
|
+ if (eventProperties <= 0) {
|
|
207
|
+ TaEventProperties taEventProperty = new TaEventProperties();
|
|
208
|
+ taEventProperty.setBuildingId(taPersonVisitRecord.getTargetId());
|
|
209
|
+ taEventProperty.setCreateDate(LocalDateTime.now());
|
|
210
|
+ taEventProperty.setPropertyCode(taPersonVisitRecord.getPropertyName());
|
|
211
|
+ taEventProperty.setPropertyName(taPersonVisitRecord.getPropertyName());
|
|
212
|
+ taEventProperty.setStatus(CommConstant.STATUS_NORMAL);
|
|
213
|
+ taEventProperty.setBuildingId(taPersonVisitRecord.getBuildingId());
|
|
214
|
+ taEventProperty.setEventType(taPersonVisitRecord.getEventType());
|
|
215
|
+ taEventProperty.setOrgId(orgId);
|
|
216
|
+ if (!taEventPropertiesService.save(taEventProperty)) {
|
|
217
|
+ return ResponseBean.error("新增失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
218
|
+ }
|
|
219
|
+ }
|
|
220
|
+
|
|
221
|
+ taPersonVisitRecord.setVisitTime(LocalDateTime.now());
|
|
222
|
+ if (!StringUtils.isEmpty(taPersonVisitRecord.getBuildingId())) {
|
|
223
|
+ QueryWrapper<TaBuildingIntention> intentionQueryWrapper = new QueryWrapper<>();
|
|
224
|
+ intentionQueryWrapper.eq("building_id", taPersonVisitRecord.getBuildingId());
|
|
225
|
+ intentionQueryWrapper.eq("org_id", taPersonVisitRecord.getOrgId());
|
|
226
|
+ intentionQueryWrapper.eq("event_code", taPersonVisitRecord.getEvent());
|
|
227
|
+ List<TaBuildingIntention> list = buildingIntentionService.list(intentionQueryWrapper);
|
|
228
|
+ if (list.size() > 0) {
|
|
229
|
+ TaBuildingIntention buildingIntention = list.get(0);
|
|
230
|
+ TaPersonIntentionRecord intentionRecord = new TaPersonIntentionRecord();
|
|
231
|
+ TaBuilding building = buildingService.getById(buildingIntention.getBuildingId());
|
|
232
|
+ intentionRecord.setBuildingId(buildingIntention.getBuildingId());
|
|
233
|
+ intentionRecord.setBuildingName(building.getBuildingName());
|
|
234
|
+ intentionRecord.setCreateDate(LocalDateTime.now());
|
|
235
|
+ intentionRecord.setEventCode(buildingIntention.getEventCode());
|
|
236
|
+ intentionRecord.setEventId(buildingIntention.getEventId());
|
|
237
|
+ intentionRecord.setEventName(buildingIntention.getEventName());
|
|
238
|
+ intentionRecord.setIntention(buildingIntention.getIntention());
|
|
239
|
+ intentionRecord.setOrgId(orgId);
|
|
240
|
+ intentionRecord.setPersonId(person.getPersonId());
|
|
241
|
+ intentionRecord.setPersonName(person.getNickname());
|
|
242
|
+ intentionRecord.setStatus(CommConstant.STATUS_NORMAL);
|
|
243
|
+ if (!personIntentionRecordService.save(intentionRecord)) {
|
|
244
|
+ return ResponseBean.error("新增失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
245
|
+ }
|
|
246
|
+ }
|
|
247
|
+ }
|
|
248
|
+ try {
|
|
249
|
+ if (this.save(taPersonVisitRecord)) {
|
|
250
|
+ //清洗埋點數據到新增用戶表--只有进入小程序的时候 start才记录
|
|
251
|
+ if (taPersonVisitRecord.getEvent().equals(CommConstant.BIZ_EVENT_START)) {
|
|
252
|
+ iTaPersonFromRecordService.addNewPersonRecordRecord(taPersonVisitRecord);
|
|
253
|
+ }
|
|
254
|
+
|
|
255
|
+ return ResponseBean.success(taPersonVisitRecord);
|
|
256
|
+ } else {
|
|
257
|
+ return ResponseBean.error("保存失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
258
|
+ }
|
|
259
|
+ } catch (Exception e) {
|
|
260
|
+// logger.error("taPersonVisitRecordAdd -=- {}", e.toString());
|
|
261
|
+ return ResponseBean.error("系统异常" + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
|
|
262
|
+ }
|
|
263
|
+ }
|
|
264
|
+
|
182
|
265
|
/**
|
183
|
266
|
* 分页获取个人中心访客记录
|
184
|
267
|
*
|