张延森 4 years ago
parent
commit
84b09c5ae2

+ 1
- 1
pom.xml View File

@@ -10,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.shigongli</groupId>
12 12
 	<artifactId>shigongli</artifactId>
13
-	<version>1.0.10</version>
13
+	<version>1.0.12</version>
14 14
 	<name>shigongli</name>
15 15
 	<description>ShiGongli Service</description>
16 16
 

+ 61
- 0
src/main/java/com/shigongli/controller/TaSurroundTrackController.java View File

@@ -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
+}

+ 47
- 0
src/main/java/com/shigongli/entity/TaSurroundTrack.java View File

@@ -0,0 +1,47 @@
1
+package com.shigongli.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+import lombok.experimental.Accessors;
10
+
11
+import java.io.Serializable;
12
+import java.time.LocalDateTime;
13
+
14
+@Data
15
+@EqualsAndHashCode(callSuper = false)
16
+@Accessors(chain = true)
17
+@ApiModel(value="TaSurroundTrack", description="房源周边埋点")
18
+public class TaSurroundTrack implements Serializable {
19
+    private static final long serialVersionUID = 1L;
20
+
21
+
22
+    @ApiModelProperty(value = "店主ID")
23
+    @TableId(value = "serial_no", type = IdType.AUTO)
24
+    private Integer serialNo;
25
+
26
+    @ApiModelProperty(value = "人员ID")
27
+    private String personId;
28
+
29
+    @ApiModelProperty(value = "店铺ID")
30
+    private String shopId;
31
+
32
+    @ApiModelProperty(value = "房源ID")
33
+    private String houseId;
34
+
35
+    @ApiModelProperty(value = "周边ID")
36
+    private String surroundId;
37
+
38
+    @ApiModelProperty(value = "图片ID")
39
+    private String imageId;
40
+
41
+    @ApiModelProperty(value = "状态")
42
+    private Integer status;
43
+
44
+    @ApiModelProperty(value = "创建时间")
45
+    private LocalDateTime createDate;
46
+
47
+}

+ 18
- 0
src/main/java/com/shigongli/mapper/TaSurroundTrackMapper.java View File

@@ -0,0 +1,18 @@
1
+package com.shigongli.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.shigongli.entity.TaSurroundTrack;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 周边埋点 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2020-12-11
14
+ */
15
+@Mapper
16
+public interface TaSurroundTrackMapper extends BaseMapper<TaSurroundTrack> {
17
+
18
+}

+ 16
- 0
src/main/java/com/shigongli/service/ITaSurroundTrackService.java View File

@@ -0,0 +1,16 @@
1
+package com.shigongli.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.shigongli.entity.TaSurroundTrack;
5
+
6
+/**
7
+ * <p>
8
+ * 民宿店 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2020-12-11
13
+ */
14
+public interface ITaSurroundTrackService extends IService<TaSurroundTrack> {
15
+
16
+}

+ 20
- 0
src/main/java/com/shigongli/service/impl/TaSurroundTrackServiceImpl.java View File

@@ -0,0 +1,20 @@
1
+package com.shigongli.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.shigongli.entity.TaSurroundTrack;
5
+import com.shigongli.mapper.TaSurroundTrackMapper;
6
+import com.shigongli.service.ITaSurroundTrackService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 民宿店 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2020-12-11
16
+ */
17
+@Service
18
+public class TaSurroundTrackServiceImpl extends ServiceImpl<TaSurroundTrackMapper, TaSurroundTrack> implements ITaSurroundTrackService {
19
+
20
+}

+ 5
- 0
src/main/resources/mapper/TaSurroundTrackMapper.xml View File

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.shigongli.mapper.TaSurroundTrackMapper">
4
+
5
+</mapper>