|
@@ -0,0 +1,61 @@
|
|
1
|
+package com.shigongli.controller;
|
|
2
|
+
|
|
3
|
+import com.shigongli.common.BaseController;
|
|
4
|
+import com.shigongli.common.ResponseBean;
|
|
5
|
+import com.shigongli.common.StringUtils;
|
|
6
|
+import com.shigongli.entity.TaHouse;
|
|
7
|
+import com.shigongli.entity.TaPerson;
|
|
8
|
+import com.shigongli.entity.TaSurroundTrack;
|
|
9
|
+import com.shigongli.service.ITaHouseService;
|
|
10
|
+import com.shigongli.service.ITaSurroundTrackService;
|
|
11
|
+import io.swagger.annotations.Api;
|
|
12
|
+import io.swagger.annotations.ApiOperation;
|
|
13
|
+import io.swagger.annotations.ApiParam;
|
|
14
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
15
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
16
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
17
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
18
|
+import org.springframework.web.bind.annotation.RestController;
|
|
19
|
+
|
|
20
|
+import javax.servlet.http.HttpServletRequest;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+@Api(tags = "周边埋点")
|
|
24
|
+@RestController
|
|
25
|
+@RequestMapping("/")
|
|
26
|
+public class TaSurroundTrackController extends BaseController {
|
|
27
|
+
|
|
28
|
+ @Autowired
|
|
29
|
+ ITaSurroundTrackService iTaSurroundTrackService;
|
|
30
|
+
|
|
31
|
+ @Autowired
|
|
32
|
+ ITaHouseService iTaHouseService;
|
|
33
|
+
|
|
34
|
+ @PostMapping("/ma/surround-track")
|
|
35
|
+ @ApiOperation(value="埋点", notes = "埋点", httpMethod = "POST", response = ResponseBean.class)
|
|
36
|
+ public ResponseBean save(@ApiParam("埋点内容") @RequestBody TaSurroundTrack taSurroundTrack,
|
|
37
|
+ HttpServletRequest request) throws Exception {
|
|
38
|
+ TaPerson person = getPerson(request);
|
|
39
|
+ if (null == person) {
|
|
40
|
+ throw new Exception("人员验证出错, 请重新登录");
|
|
41
|
+ }
|
|
42
|
+
|
|
43
|
+ if (StringUtils.isEmpty(taSurroundTrack.getHouseId())) {
|
|
44
|
+ throw new Exception("房源ID不能为空");
|
|
45
|
+ }
|
|
46
|
+
|
|
47
|
+ TaHouse taHouse = iTaHouseService.getById(taSurroundTrack.getHouseId());
|
|
48
|
+ if (null == taHouse) {
|
|
49
|
+ throw new Exception("房源信息错误, 请重试");
|
|
50
|
+ }
|
|
51
|
+
|
|
52
|
+ taSurroundTrack.setShopId(taHouse.getShopId());
|
|
53
|
+ taSurroundTrack.setPersonId(person.getPersonId());
|
|
54
|
+
|
|
55
|
+ if (iTaSurroundTrackService.save(taSurroundTrack)) {
|
|
56
|
+ return ResponseBean.success(taSurroundTrack);
|
|
57
|
+ } else {
|
|
58
|
+ return ResponseBean.error("埋点失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
|
59
|
+ }
|
|
60
|
+ }
|
|
61
|
+}
|