张延森 vor 3 Jahren
Ursprung
Commit
e37799056e
44 geänderte Dateien mit 1225 neuen und 111 gelöschten Zeilen
  1. 26
    0
      src/main/java/com/yunzhi/shigongli/common/OSSUtils.java
  2. 17
    0
      src/main/java/com/yunzhi/shigongli/controller/CommController.java
  3. 31
    8
      src/main/java/com/yunzhi/shigongli/controller/TaNoteController.java
  4. 21
    0
      src/main/java/com/yunzhi/shigongli/controller/TaResourceController.java
  5. 3
    7
      src/main/java/com/yunzhi/shigongli/controller/TaShopPackageController.java
  6. 362
    84
      src/main/java/com/yunzhi/shigongli/controller/TaTravelController.java
  7. 114
    0
      src/main/java/com/yunzhi/shigongli/controller/TaTravelItemController.java
  8. 29
    0
      src/main/java/com/yunzhi/shigongli/controller/TaskController.java
  9. 1
    1
      src/main/java/com/yunzhi/shigongli/event/SendMessageTask.java
  10. 4
    0
      src/main/java/com/yunzhi/shigongli/event/listener/OpenShareEventListener.java
  11. 1
    1
      src/main/java/com/yunzhi/shigongli/mapper/TaNoteMapper.java
  12. 6
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaNoteResourceMapper.java
  13. 2
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaResourceMapper.java
  14. 2
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaShopPackageMapper.java
  15. 7
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaTravelItemMapper.java
  16. 13
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaTravelMapper.java
  17. 3
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaTravelPersonMapper.java
  18. 4
    0
      src/main/java/com/yunzhi/shigongli/service/ITaNoteResourceService.java
  19. 1
    1
      src/main/java/com/yunzhi/shigongli/service/ITaNoteService.java
  20. 2
    0
      src/main/java/com/yunzhi/shigongli/service/ITaResourceService.java
  21. 1
    1
      src/main/java/com/yunzhi/shigongli/service/ITaShopPackageService.java
  22. 8
    0
      src/main/java/com/yunzhi/shigongli/service/ITaTravelItemService.java
  23. 5
    0
      src/main/java/com/yunzhi/shigongli/service/ITaTravelPersonService.java
  24. 13
    0
      src/main/java/com/yunzhi/shigongli/service/ITaTravelService.java
  25. 7
    1
      src/main/java/com/yunzhi/shigongli/service/impl/TaNoteResourceServiceImpl.java
  26. 2
    2
      src/main/java/com/yunzhi/shigongli/service/impl/TaNoteServiceImpl.java
  27. 13
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaResourceServiceImpl.java
  28. 3
    3
      src/main/java/com/yunzhi/shigongli/service/impl/TaShopPackageServiceImpl.java
  29. 55
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaTravelItemServiceImpl.java
  30. 16
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaTravelPersonServiceImpl.java
  31. 49
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaTravelServiceImpl.java
  32. 4
    0
      src/main/java/com/yunzhi/shigongli/vo/NoteVO.java
  33. 12
    0
      src/main/java/com/yunzhi/shigongli/vo/ResourceListVO.java
  34. 48
    0
      src/main/java/com/yunzhi/shigongli/vo/TravelDataVO.java
  35. 69
    0
      src/main/java/com/yunzhi/shigongli/vo/TravelItemDataVO.java
  36. 26
    0
      src/main/java/com/yunzhi/shigongli/vo/TravelListVO.java
  37. 1
    0
      src/main/resources/application.yml
  38. 5
    0
      src/main/resources/mapper/TaNoteMapper.xml
  39. 40
    0
      src/main/resources/mapper/TaNoteResourceMapper.xml
  40. 45
    0
      src/main/resources/mapper/TaResourceMapper.xml
  41. 4
    1
      src/main/resources/mapper/TaShopPackageMapper.xml
  42. 42
    1
      src/main/resources/mapper/TaTravelItemMapper.xml
  43. 95
    0
      src/main/resources/mapper/TaTravelMapper.xml
  44. 13
    0
      src/main/resources/mapper/TaTravelPersonMapper.xml

+ 26
- 0
src/main/java/com/yunzhi/shigongli/common/OSSUtils.java Datei anzeigen

@@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
17 17
 import java.io.*;
18 18
 import java.time.LocalDateTime;
19 19
 import java.time.format.DateTimeFormatter;
20
+import java.util.Base64;
20 21
 import java.util.HashMap;
21 22
 import java.util.Map;
22 23
 
@@ -42,6 +43,31 @@ public class OSSUtils {
42 43
         return path + getMonth() + "/";
43 44
     }
44 45
 
46
+    /**
47
+     * 上传 base64
48
+     * @param base64Str
49
+     * @param toDirs
50
+     * @return
51
+     * @throws IOException
52
+     */
53
+    public String putObject(String base64Str, String ...toDirs) throws IOException {
54
+        int index = base64Str.indexOf("base64,");
55
+
56
+        if (index > -1) {
57
+            index += 7;
58
+        } else {
59
+            index = 0;
60
+        }
61
+
62
+        String dataStr = base64Str.substring(index);
63
+        byte[] data = Base64.getDecoder().decode(dataStr);
64
+        ByteArrayInputStream inputStream = new ByteArrayInputStream(data);
65
+        String toDir = getUploadPath(toDirs);
66
+        String nwFName = toDir + System.currentTimeMillis() + ".png";
67
+        nwFName = StringUtils.trim(nwFName,"/");
68
+        return putFile(nwFName, inputStream);
69
+    }
70
+
45 71
     /**
46 72
      * 上传文件
47 73
      * @param mf 上传的文件

+ 17
- 0
src/main/java/com/yunzhi/shigongli/controller/CommController.java Datei anzeigen

@@ -48,6 +48,23 @@ public class CommController extends BaseController {
48 48
         }
49 49
     }
50 50
 
51
+    /**
52
+     * base64 图片上传
53
+     * @param data
54
+     * @return
55
+     */
56
+    @ApiOperation(value = "base64 图片上传", notes = "base64 图片上传")
57
+    @PostMapping("/{plat}/image/base64")
58
+    public ResponseBean uploadBase64Image(@RequestBody Map<String, String> data) {
59
+        try {
60
+            String base64Str = data.get("base64");
61
+            String img = ossUtils.putObject(base64Str);
62
+            return ResponseBean.success(img);
63
+        } catch (IOException e) {
64
+            return ResponseBean.error("上传图片失败: " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
65
+        }
66
+    }
67
+
51 68
     /**
52 69
      * 获取文件上传凭证
53 70
      * @return

+ 31
- 8
src/main/java/com/yunzhi/shigongli/controller/TaNoteController.java Datei anzeigen

@@ -59,11 +59,12 @@ public class TaNoteController extends BaseController {
59 59
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = TaNote.class)
60 60
     public ResponseBean getWxList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
61 61
                                   @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
62
-                                  @ApiParam("定位地点") @RequestParam(value ="location", required = false) String location) throws Exception{
62
+                                  @ApiParam("定位地点") @RequestParam(value ="location", required = false) String location,
63
+                                  @ApiParam("查询内容") @RequestParam(value ="q", required = false) String q) throws Exception{
63 64
 
64 65
         IPage<TaNote> pg = new Page<>(pageNum, pageSize);
65 66
 
66
-        IPage<TaNote> result = iTaNoteService.getWxPageBy(pg, getCurrentPerson(), location);
67
+        IPage<TaNote> result = iTaNoteService.getWxPageBy(pg, getCurrentPerson(), location, q);
67 68
         return ResponseBean.success(result);
68 69
     }
69 70
 
@@ -75,7 +76,7 @@ public class TaNoteController extends BaseController {
75 76
      */
76 77
     @RequestMapping(value="/admin/note",method= RequestMethod.GET)
77 78
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = TaNote.class)
78
-    public ResponseBean taPvList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
79
+    public ResponseBean noteList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
79 80
                                  @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
80 81
                                  @ApiParam("笔记类型") @RequestParam(value ="noteType", required = false) String noteType,
81 82
                                  @ApiParam("简介") @RequestParam(value ="summary", required = false) String summary) throws Exception{
@@ -93,7 +94,7 @@ public class TaNoteController extends BaseController {
93 94
      */
94 95
     @RequestMapping(value="/admin/note",method= RequestMethod.POST)
95 96
     @ApiOperation(value="保存笔记", notes = "保存笔记", httpMethod = "POST", response = TaNote.class)
96
-    public ResponseBean taPvAdd(@ApiParam("保存内容") @RequestBody NoteVO noteVO) throws Exception{
97
+    public ResponseBean saveNote(@ApiParam("保存内容") @RequestBody NoteVO noteVO) throws Exception{
97 98
         if (null == noteVO) {
98 99
             return ResponseBean.error("没有找到保存内容", ResponseBean.ERROR_ILLEGAL_PARAMS);
99 100
         }
@@ -152,7 +153,7 @@ public class TaNoteController extends BaseController {
152 153
      */
153 154
     @RequestMapping(value="/admin/note/{id}", method= RequestMethod.DELETE)
154 155
     @ApiOperation(value="删除笔记", notes = "删除笔记", httpMethod = "DELETE", response = ResponseBean.class)
155
-    public ResponseBean taPvDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
156
+    public ResponseBean deleteNote(@ApiParam("对象ID") @PathVariable String id) throws Exception{
156 157
         if(iTaNoteService.removeLogicById(id)){
157 158
             return ResponseBean.success("success");
158 159
         }else {
@@ -166,9 +167,9 @@ public class TaNoteController extends BaseController {
166 167
      * @param noteVO 实体对象
167 168
      * @return
168 169
      */
169
-    @RequestMapping(value="/taPv/{id}",method= RequestMethod.PUT)
170
+    @RequestMapping(value="/admin/note/{id}",method= RequestMethod.PUT)
170 171
     @ApiOperation(value="更新笔记", notes = "更新笔记", httpMethod = "PUT", response = ResponseBean.class)
171
-    public ResponseBean taPvUpdate(@ApiParam("对象ID") @PathVariable String id,
172
+    public ResponseBean updateNote(@ApiParam("对象ID") @PathVariable String id,
172 173
                                    @ApiParam("更新内容") @RequestBody NoteVO noteVO) throws Exception {
173 174
 
174 175
         TaNote taNote = iTaNoteService.getById(id);
@@ -225,7 +226,7 @@ public class TaNoteController extends BaseController {
225 226
      */
226 227
     @RequestMapping(value="/admin/note/{id}",method= RequestMethod.GET)
227 228
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
228
-    public ResponseBean taPvGet(@ApiParam("对象ID") @PathVariable String id) throws Exception {
229
+    public ResponseBean getAdminDetail(@ApiParam("对象ID") @PathVariable String id) throws Exception {
229 230
         TaNote taNote = iTaNoteService.getById(id);
230 231
         if (null == taNote || Constants.STATUS_DELETED == taNote.getStatus()) {
231 232
             return ResponseBean.error("没有找到更新内容", ResponseBean.ERROR_UNAVAILABLE);
@@ -242,6 +243,28 @@ public class TaNoteController extends BaseController {
242 243
     }
243 244
 
244 245
 
246
+    /**
247
+     * 根据id查询对象
248
+     * @param id  实体ID
249
+     */
250
+    @RequestMapping(value="/wx/note/{id}",method= RequestMethod.GET)
251
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
252
+    public ResponseBean getWxDetail(@ApiParam("对象ID") @PathVariable String id) throws Exception {
253
+        TaNote taNote = iTaNoteService.getById(id);
254
+        if (null == taNote || Constants.STATUS_DELETED == taNote.getStatus()) {
255
+            return ResponseBean.error("没有找到更新内容", ResponseBean.ERROR_UNAVAILABLE);
256
+        }
257
+
258
+        NoteVO noteVO = new NoteVO();
259
+        BeanUtils.copyProperties(taNote, noteVO);
260
+
261
+
262
+        noteVO.setImageList(iTaImageService.getListBy(Constants.TARGET_NOTE, id));
263
+        noteVO.setWxResourceList(iTaNoteResourceService.getResourceListBy(id, getCurrentPerson().getPersonId()));
264
+
265
+        return ResponseBean.success(noteVO);
266
+    }
267
+
245 268
     /**
246 269
      * 根据id查询对象
247 270
      * @param id  实体ID

+ 21
- 0
src/main/java/com/yunzhi/shigongli/controller/TaResourceController.java Datei anzeigen

@@ -98,4 +98,25 @@ public class TaResourceController extends BaseController {
98 98
 
99 99
         return ResponseBean.success(iTaResourceService.page(pg, queryWrapper));
100 100
     }
101
+
102
+
103
+    /**
104
+     * 资源推荐
105
+     * @param pageNum
106
+     * @param pageSize
107
+     * @param location
108
+     * @return
109
+     * @throws Exception
110
+     */
111
+    @GetMapping("/wx/resource/recommend")
112
+    @ApiOperation(value="资源推荐", notes = "资源推荐", httpMethod = "GET", response = ResponseBean.class)
113
+    public ResponseBean getRecommend(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
114
+                                     @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
115
+                                     @ApiParam("定位") @RequestParam(value = "location") String location) throws Exception {
116
+        IPage<ResourceListVO> pg = new Page<>(pageNum, pageSize);
117
+
118
+        IPage<ResourceListVO> result = iTaResourceService.getWxRecommend(pg, getCurrentPerson().getPersonId(), location);
119
+
120
+        return ResponseBean.success(result);
121
+    }
101 122
 }

+ 3
- 7
src/main/java/com/yunzhi/shigongli/controller/TaShopPackageController.java Datei anzeigen

@@ -1,14 +1,10 @@
1 1
 package com.yunzhi.shigongli.controller;
2 2
 
3
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 5
 import com.yunzhi.shigongli.common.BaseController;
7
-import com.yunzhi.shigongli.common.Constants;
8 6
 import com.yunzhi.shigongli.common.ExcelUtils;
9 7
 import com.yunzhi.shigongli.common.ResponseBean;
10
-import com.yunzhi.shigongli.entity.TaExtendContent;
11
-import com.yunzhi.shigongli.entity.TaShopPackageSetting;
12 8
 import com.yunzhi.shigongli.vo.ShopPackageRecommend;
13 9
 import com.yunzhi.shigongli.vo.ShopPackageVO;
14 10
 import io.swagger.annotations.Api;
@@ -16,7 +12,6 @@ import io.swagger.annotations.ApiOperation;
16 12
 import io.swagger.annotations.ApiParam;
17 13
 import org.slf4j.Logger;
18 14
 import org.slf4j.LoggerFactory;
19
-import org.springframework.beans.BeanUtils;
20 15
 import org.springframework.beans.factory.annotation.Autowired;
21 16
 import org.springframework.web.bind.annotation.PathVariable;
22 17
 import org.springframework.web.bind.annotation.RequestBody;
@@ -61,10 +56,11 @@ public class TaShopPackageController extends BaseController {
61 56
     public ResponseBean taShopPackageList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
62 57
                                           @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
63 58
                                           @ApiParam("商铺") @RequestParam(value ="shopId", required = false) String shopId,
59
+                                          @ApiParam("套餐类型") @RequestParam(value ="packageCategory", required = false) String packageCategory,
64 60
                                           @ApiParam("套餐名称") @RequestParam(value = "description", required = false) String description) throws Exception{
65 61
 
66 62
         IPage<TaShopPackage> pg = new Page<>(pageNum, pageSize);
67
-        IPage<ShopPackageVO> result = iTaShopPackageService.getProfilePage(pg, shopId, description);
63
+        IPage<ShopPackageVO> result = iTaShopPackageService.getProfilePage(pg, shopId, packageCategory, description);
68 64
         return ResponseBean.success(result);
69 65
     }
70 66
 
@@ -78,7 +74,7 @@ public class TaShopPackageController extends BaseController {
78 74
                                               @ApiParam("套餐名称") @RequestParam(value = "description", required = false) String description,
79 75
                                               HttpServletResponse response) throws Exception{
80 76
 
81
-        IPage<ShopPackageVO> result = iTaShopPackageService.getProfilePage(null, shopId, description);
77
+        IPage<ShopPackageVO> result = iTaShopPackageService.getProfilePage(null, shopId, shopId, description);
82 78
 
83 79
         ExcelUtils.flush(response, ShopPackageVO.class, result.getRecords(), "商铺套餐列表");
84 80
     }

+ 362
- 84
src/main/java/com/yunzhi/shigongli/controller/TaTravelController.java Datei anzeigen

@@ -1,19 +1,32 @@
1 1
 package com.yunzhi.shigongli.controller;
2 2
 
3
-import com.yunzhi.shigongli.common.BaseController;
4
-import com.yunzhi.shigongli.common.ResponseBean;
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
+import com.yunzhi.shigongli.common.*;
5 6
 import com.yunzhi.shigongli.entity.TaPerson;
6 7
 import com.yunzhi.shigongli.entity.TaTravel;
8
+import com.yunzhi.shigongli.entity.TaTravelItem;
9
+import com.yunzhi.shigongli.entity.TaTravelPerson;
7 10
 import com.yunzhi.shigongli.service.ITaPvService;
8 11
 import com.yunzhi.shigongli.service.ITaTravelItemService;
9 12
 import com.yunzhi.shigongli.service.ITaTravelPersonService;
10 13
 import com.yunzhi.shigongli.service.ITaTravelService;
14
+import com.yunzhi.shigongli.vo.TravelDataVO;
15
+import com.yunzhi.shigongli.vo.TravelItemDataVO;
16
+import com.yunzhi.shigongli.vo.TravelListVO;
11 17
 import io.swagger.annotations.Api;
18
+import io.swagger.annotations.ApiOperation;
19
+import io.swagger.annotations.ApiParam;
20
+import org.apache.ibatis.annotations.Delete;
12 21
 import org.slf4j.Logger;
13 22
 import org.slf4j.LoggerFactory;
23
+import org.springframework.beans.BeanUtils;
14 24
 import org.springframework.beans.factory.annotation.Autowired;
15
-import org.springframework.web.bind.annotation.RequestMapping;
16
-import org.springframework.web.bind.annotation.RestController;
25
+import org.springframework.web.bind.annotation.*;
26
+
27
+import java.time.LocalDateTime;
28
+import java.util.ArrayList;
29
+import java.util.List;
17 30
 
18 31
 /**
19 32
  * <p>
@@ -40,91 +53,356 @@ public class TaTravelController extends BaseController {
40 53
     @Autowired
41 54
     public ITaTravelPersonService iTaTravelPersonService;
42 55
 
56
+
57
+    /**
58
+     * 获取行程列表
59
+     * @return
60
+     * @throws Exception
61
+     */
62
+    @GetMapping("/admin/travel")
63
+    @ApiOperation(value="获取行程列表", notes = "获取行程列表", httpMethod = "GET", response = TravelDataVO.class)
64
+    public ResponseBean getAdminTravel(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
65
+                                       @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
66
+                                       @ApiParam("手机号") @RequestParam(value ="phone", required = false) String phone,
67
+                                       @ApiParam(value = "起始时间", example = "2021-10-01") @RequestParam(value ="start", required = false) String start,
68
+                                       @ApiParam(value = "结束时间", example = "2021-10-31") @RequestParam(value ="end", required = false) String end) throws Exception {
69
+        LocalDateTime startDate = null;
70
+        LocalDateTime endDate = null;
71
+        if (!StringUtils.isEmpty(start)) {
72
+            startDate = DateUtils.from(start + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
73
+        }
74
+
75
+        if (!StringUtils.isEmpty(end)) {
76
+            endDate = DateUtils.from(end + " 23:59:59", "yyyy-MM-dd HH:mm:ss");
77
+        }
78
+
79
+        IPage<TravelListVO> pg = new Page<>(pageNum, pageSize);
80
+
81
+        IPage<TravelListVO> result = iTaTravelService.getAdminList(pg, phone, startDate, endDate);
82
+
83
+        return ResponseBean.success(result);
84
+    }
85
+
86
+    /**
87
+     * 命定行程列表
88
+     * @return
89
+     * @throws Exception
90
+     */
91
+    @GetMapping("/admin/travel/destiny")
92
+    @ApiOperation(value="ADMIN命定行程列表", notes = "ADMIN命定行程列表", httpMethod = "GET", response = TravelDataVO.class)
93
+    public ResponseBean getAdminDestinyTravel(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
94
+                                              @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
95
+                                              @ApiParam("行程描述") @RequestParam(value ="title", required = false) String title,
96
+                                              @ApiParam("状态") @RequestParam(value ="status", required = false) Integer status) throws Exception {
97
+        IPage<TaTravel> pg = new Page<>(pageNum, pageSize);
98
+
99
+        IPage<TaTravel> travelList = iTaTravelService.getAdminDestinyList(pg, title, status);
100
+
101
+        return ResponseBean.success(travelList);
102
+    }
103
+
104
+
105
+    /**
106
+     * 行程详情
107
+     * @return
108
+     * @throws Exception
109
+     */
110
+    @GetMapping("/admin/travel/{id}")
111
+    @ApiOperation(value="行程详情", notes = "行程详情", httpMethod = "GET", response = TravelDataVO.class)
112
+    public ResponseBean getTravelDetail(@ApiParam("行程ID") @PathVariable String id) throws Exception {
113
+        TaTravel taTravel = iTaTravelService.getById(id);
114
+        if (null == taTravel || taTravel.getStatus() == Constants.STATUS_DELETED) {
115
+            return ResponseBean.error("没有找到行程信息", ResponseBean.ERROR_ILLEGAL_PARAMS);
116
+        }
117
+
118
+        TravelDataVO travelDataVO = new TravelDataVO();
119
+        BeanUtils.copyProperties(taTravel, travelDataVO);
120
+
121
+        List<TravelItemDataVO> travelItemDetails = iTaTravelItemService.getTravelItemDetails(id);
122
+        travelDataVO.setTravelItemList(travelItemDetails);
123
+
124
+        return ResponseBean.success(travelDataVO);
125
+    }
126
+
127
+    /**
128
+     * 获取命定行程
129
+     * @return
130
+     * @throws Exception
131
+     */
132
+    @GetMapping("/wx/travel/destiny")
133
+    @ApiOperation(value="获取命定行程", notes = "获取命定行程", httpMethod = "GET", response = TravelDataVO.class)
43 134
     public ResponseBean getDestinyTravel() throws Exception {
44 135
         TaPerson taPerson = getCurrentPerson();
45 136
 
46
-        TaTravel andCopyDestinyTravel = iTaTravelPersonService.getAndCopyDestinyTravel(taPerson.getPersonId());
137
+        TravelDataVO travelData = iTaTravelPersonService.getDestinyTravel(taPerson.getPersonId());
138
+        if (null == travelData) {
139
+            return ResponseBean.success(null);
140
+        }
141
+
142
+        List<TravelItemDataVO> itemDataVOList = iTaTravelItemService.getTravelItemDetails(travelData.getTravelId());
143
+
144
+        travelData.setTravelItemList(itemDataVOList);
145
+
146
+        return ResponseBean.success(travelData);
147
+    }
148
+
149
+    /**
150
+     * 保存命定行程
151
+     * @return
152
+     * @throws Exception
153
+     */
154
+    @PostMapping("/wx/travel/destiny")
155
+    @ApiOperation(value="保存命定行程", notes = "保存命定行程", httpMethod = "POST", response = TravelDataVO.class)
156
+    public ResponseBean saveDestinyTravel() throws Exception {
157
+        TaPerson taPerson = getCurrentPerson();
158
+
159
+        TaTravel travel = iTaTravelPersonService.getAndCopyDestinyTravel(taPerson.getPersonId());
160
+        TravelDataVO travelDataVO = new TravelDataVO();
161
+        BeanUtils.copyProperties(travel, travelDataVO);
162
+
163
+        List<TravelItemDataVO> itemDataVOList = iTaTravelItemService.getTravelItemDetails(travel.getTravelId());
164
+
165
+        travelDataVO.setTravelItemList(itemDataVOList);
166
+
167
+        return ResponseBean.success(travel);
168
+    }
169
+
170
+
171
+    /**
172
+     * 保存命定行程
173
+     * @return
174
+     * @throws Exception
175
+     */
176
+    @PostMapping("/admin/travel/destiny")
177
+    @ApiOperation(value="保存命定行程", notes = "保存命定行程", httpMethod = "POST", response = TravelDataVO.class)
178
+    public ResponseBean saveDestinyTravel(@ApiParam("保存内容") @RequestBody TravelDataVO travelDataVO) throws Exception {
179
+        if (null == travelDataVO) {
180
+            return ResponseBean.error("没有找到保存内容", ResponseBean.ERROR_ILLEGAL_PARAMS);
181
+        }
182
+
183
+        if (StringUtils.isEmpty(travelDataVO.getTitle())) {
184
+            return ResponseBean.error("请填写命定行程描述", ResponseBean.ERROR_ILLEGAL_PARAMS);
185
+        }
186
+
187
+        List<TravelItemDataVO> travelItemList = travelDataVO.getTravelItemList();
188
+        if (null == travelItemList || travelItemList.size() < 1) {
189
+            return ResponseBean.error("请维护相关地点", ResponseBean.ERROR_ILLEGAL_PARAMS);
190
+        }
191
+
192
+        TaTravel taTravel = new TaTravel();
193
+        BeanUtils.copyProperties(travelDataVO, taTravel);
194
+        taTravel.setDayNum(1);
195
+        taTravel.setIsDestiny(true);
196
+        taTravel.setIsSystem(true);
197
+
198
+        if (taTravel.getStatus() == null) {
199
+            taTravel.setStatus(Constants.STATUS_READY);
200
+        }
201
+        if (taTravel.getWeight() == null) {
202
+            taTravel.setWeight(0);
203
+        }
204
+
205
+        // 保存行程主记录
206
+        if (iTaTravelService.save(taTravel)) {
207
+            // 获取最新的记录
208
+            travelDataVO.setTravelItemList(iTaTravelItemService.updateTravelItems(taTravel.getTravelId(), travelItemList));
209
+            travelDataVO.setTravelId(taTravel.getTravelId());
210
+
211
+            return ResponseBean.success(travelDataVO);
212
+        } else {
213
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
214
+        }
215
+    }
216
+
217
+    /**
218
+     * 更新行程
219
+     * @return
220
+     * @throws Exception
221
+     */
222
+    @PutMapping("/admin/travel/{id}")
223
+    @ApiOperation(value="更新行程", notes = "更新行程", httpMethod = "PUT", response = TravelDataVO.class)
224
+    public ResponseBean updateDestinyTravel(@ApiParam("行程ID") @PathVariable String id,
225
+                                            @ApiParam("更新内容") @RequestBody TravelDataVO travelDataVO) throws Exception {
226
+        if (null == travelDataVO) {
227
+            return ResponseBean.error("没有找到更新内容", ResponseBean.ERROR_ILLEGAL_PARAMS);
228
+        }
229
+
230
+        TaTravel origin = iTaTravelService.getById(id);
231
+        if (null == origin || origin.getStatus() == Constants.STATUS_DELETED) {
232
+            return ResponseBean.error("没有找到行程信息", ResponseBean.ERROR_ILLEGAL_PARAMS);
233
+        }
234
+
235
+        travelDataVO.setTravelId(id);
236
+
237
+        if (StringUtils.isEmpty(travelDataVO.getTitle())) {
238
+            return ResponseBean.error("请填写行程描述", ResponseBean.ERROR_ILLEGAL_PARAMS);
239
+        }
240
+
241
+        List<TravelItemDataVO> travelItemList = travelDataVO.getTravelItemList();
242
+        if (null == travelItemList || travelItemList.size() < 1) {
243
+            return ResponseBean.error("请维护相关地点", ResponseBean.ERROR_ILLEGAL_PARAMS);
244
+        }
245
+
246
+        TaTravel taTravel = new TaTravel();
247
+        BeanUtils.copyProperties(travelDataVO, taTravel);
248
+//        taTravel.setDayNum(1);
249
+//        taTravel.setIsDestiny(true);
250
+//        taTravel.setIsSystem(true);
251
+
252
+        if (taTravel.getStatus() == null) {
253
+            taTravel.setStatus(Constants.STATUS_READY);
254
+        }
255
+        if (taTravel.getWeight() == null) {
256
+            taTravel.setWeight(0);
257
+        }
258
+
259
+        // 保存行程主记录
260
+        if (iTaTravelService.updateById(taTravel)) {
261
+            // 获取最新的记录
262
+            travelDataVO.setTravelItemList(iTaTravelItemService.updateTravelItems(taTravel.getTravelId(), travelItemList));
263
+            travelDataVO.setTravelId(taTravel.getTravelId());
264
+
265
+            return ResponseBean.success(travelDataVO);
266
+        } else {
267
+            return ResponseBean.error("更新失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
268
+        }
269
+    }
270
+
271
+
272
+    /**
273
+     * 获取我的行程
274
+     * @return
275
+     * @throws Exception
276
+     */
277
+    @GetMapping("/wx/travel/mine")
278
+    @ApiOperation(value="获取我的行程", notes = "获取我的行程", httpMethod = "GET", response = TravelDataVO.class)
279
+    public ResponseBean getMineTravel(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
280
+                                      @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
281
+                                      @ApiParam("简易列表") @RequestParam(value ="simple",defaultValue = "false") Boolean simple) throws Exception {
282
+        TaPerson taPerson = getCurrentPerson();
283
+
284
+        IPage<TravelDataVO> pg = new Page<>(pageNum, pageSize);
285
+
286
+        IPage<TravelDataVO> result = iTaTravelService.getPersonAllList(pg, taPerson.getPersonId(), simple);
287
+
288
+        return ResponseBean.success(result);
289
+    }
290
+
291
+
292
+    /**
293
+     * 保存我的行程
294
+     * @param taTravel
295
+     * @return
296
+     * @throws Exception
297
+     */
298
+    @PostMapping("/wx/travel")
299
+    @ApiOperation(value="保存我的行程", notes = "保存我的行程", httpMethod = "POST", response = TaTravel.class)
300
+    public ResponseBean saveTravel(@ApiParam("保存内容") @RequestBody TaTravel taTravel) throws Exception {
301
+        taTravel.setCreateDate(LocalDateTime.now());
302
+        taTravel.setStatus(Constants.STATUS_NORMAL);
303
+        taTravel.setIsSystem(false);
304
+        taTravel.setIsDestiny(false);
305
+        if (null == taTravel.getDayNum() || taTravel.getDayNum() < 1) {
306
+            taTravel.setDayNum(1);
307
+        }
308
+
309
+        if (iTaTravelService.save(taTravel)) {
310
+            TaTravelPerson taTravelPerson = new TaTravelPerson();
311
+            taTravelPerson.setTravelId(taTravel.getTravelId());
312
+            taTravelPerson.setPersonId(getCurrentPerson().getPersonId());
313
+            taTravelPerson.setIsHidden(false);
314
+
315
+            if (iTaTravelPersonService.save(taTravelPerson)) {
316
+                return ResponseBean.success(taTravel);
317
+            } else {
318
+                return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
319
+            }
320
+
321
+        } else {
322
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
323
+        }
324
+    }
325
+
326
+    /**
327
+     * 更新我的行程
328
+     * @param id
329
+     * @return
330
+     * @throws Exception
331
+     */
332
+    @PutMapping("/wx/travel/{id}")
333
+    @ApiOperation(value="更新我的行程", notes = "更新我的行程", httpMethod = "PUT", response = TaTravel.class)
334
+    public ResponseBean updateTravel(@ApiParam("行程ID") @PathVariable String id,
335
+                                     @ApiParam("保存内容") @RequestBody TaTravel taTravel) throws Exception {
336
+        TaTravelPerson taTravelPerson = iTaTravelPersonService.getByPerson(getCurrentPerson().getPersonId(), id);
337
+        if (null == taTravelPerson) {
338
+            return ResponseBean.error("未找到更新内容", ResponseBean.ERROR_UNAVAILABLE);
339
+        }
340
+
341
+        TaTravel origin = iTaTravelService.getById(id);
342
+
343
+        // 只允许修改名称 - 天数
344
+        origin.setTitle(taTravel.getTitle());
345
+        origin.setDayNum(taTravel.getDayNum());
346
+
347
+        if (iTaTravelService.updateById(origin)) {
348
+            return ResponseBean.success(origin);
349
+        } else {
350
+            return ResponseBean.error("更新失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
351
+        }
352
+    }
353
+
354
+    /**
355
+     * 删除我的行程
356
+     * @param id
357
+     * @return
358
+     * @throws Exception
359
+     */
360
+    @DeleteMapping("/wx/travel/{id}")
361
+    @ApiOperation(value="删除我的行程", notes = "删除我的行程", httpMethod = "DELETE", response = TaTravel.class)
362
+    public ResponseBean deleteTravel(@ApiParam("行程ID") @PathVariable String id) throws Exception {
363
+        TaTravelPerson taTravelPerson = iTaTravelPersonService.getByPerson(getCurrentPerson().getPersonId(), id);
364
+        if (null == taTravelPerson) {
365
+            return ResponseBean.error("未找到删除内容", ResponseBean.ERROR_UNAVAILABLE);
366
+        }
367
+
368
+        if (iTaTravelPersonService.removeById(taTravelPerson.getSerialNo())) {
369
+            TaTravel taTravel = iTaTravelService.getById(id);
370
+            if (null != taTravel) {
371
+                iTaTravelService.removeLogicById(taTravel);
372
+            }
373
+
374
+            return ResponseBean.success(null);
375
+        } else {
376
+            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
377
+        }
378
+    }
379
+
380
+    /**
381
+     * 查看我的行程
382
+     * @param id
383
+     * @return
384
+     * @throws Exception
385
+     */
386
+    @GetMapping("/wx/travel/{id}")
387
+    @ApiOperation(value="我的行程详情", notes = "我的行程详情", httpMethod = "GET", response = TaTravel.class)
388
+    public ResponseBean getMineTravel(@ApiParam("行程ID") @PathVariable String id) throws Exception {
389
+        TaTravelPerson taTravelPerson = iTaTravelPersonService.getByPerson(getCurrentPerson().getPersonId(), id);
390
+        if (null == taTravelPerson) {
391
+            return ResponseBean.error("未找到行程内容", ResponseBean.ERROR_UNAVAILABLE);
392
+        }
393
+
394
+        TaTravel origin = iTaTravelService.getById(id);
395
+        if (null == origin || origin.getStatus() == Constants.STATUS_DELETED) {
396
+            return ResponseBean.error("没有找到行程信息", ResponseBean.ERROR_ILLEGAL_PARAMS);
397
+        }
398
+
399
+        TravelDataVO travelDataVO = new TravelDataVO();
400
+        BeanUtils.copyProperties(origin, travelDataVO);
47 401
 
48
-        // 返回所有数据
402
+        List<TravelItemDataVO> travelItemDetails = iTaTravelItemService.getTravelItemDetails(id);
403
+        travelDataVO.setTravelItemList(travelItemDetails);
49 404
 
50
-        return ResponseBean.success(null);
405
+        return ResponseBean.success(travelDataVO);
51 406
     }
52 407
 
53
-//
54
-//    /**
55
-//     * 分页查询列表
56
-//     * @param pageNum
57
-//     * @param pageSize
58
-//     * @return
59
-//     */
60
-//    @RequestMapping(value="/taPv",method= RequestMethod.GET)
61
-//    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
62
-//    public ResponseBean taPvList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
63
-//									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
64
-//
65
-//		    IPage<TaPv> pg = new Page<>(pageNum, pageSize);
66
-//            QueryWrapper<TaPv> queryWrapper = new QueryWrapper<>();
67
-//            queryWrapper.orderByDesc("create_date");
68
-//
69
-//            IPage<TaPv> result = iTaPvService.page(pg, queryWrapper);
70
-//            return ResponseBean.success(result);
71
-//    }
72
-//
73
-//    /**
74
-//     * 保存对象
75
-//     * @param taPv 实体对象
76
-//     * @return
77
-//     */
78
-//    @RequestMapping(value="/taPv",method= RequestMethod.POST)
79
-//    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
80
-//    public ResponseBean taPvAdd(@ApiParam("保存内容") @RequestBody TaPv taPv) throws Exception{
81
-//
82
-//        if (iTaPvService.save(taPv)){
83
-//            return ResponseBean.success(taPv);
84
-//        }else {
85
-//            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
86
-//        }
87
-//    }
88
-//
89
-//    /**
90
-//     * 根据id删除对象
91
-//     * @param id  实体ID
92
-//     */
93
-//    @RequestMapping(value="/taPv/{id}", method= RequestMethod.DELETE)
94
-//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
95
-//    public ResponseBean taPvDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
96
-//        if(iTaPvService.removeLogicById(id)){
97
-//            return ResponseBean.success("success");
98
-//        }else {
99
-//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
100
-//        }
101
-//    }
102
-//
103
-//    /**
104
-//     * 修改对象
105
-//     * @param id  实体ID
106
-//     * @param taPv 实体对象
107
-//     * @return
108
-//     */
109
-//    @RequestMapping(value="/taPv/{id}",method= RequestMethod.PUT)
110
-//    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
111
-//    public ResponseBean taPvUpdate(@ApiParam("对象ID") @PathVariable Integer id,
112
-//                                        @ApiParam("更新内容") @RequestBody TaPv taPv) throws Exception{
113
-//
114
-//        if (iTaPvService.updateById(taPv)){
115
-//            return ResponseBean.success(iTaPvService.getById(id));
116
-//        }else {
117
-//            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
118
-//        }
119
-//    }
120
-//
121
-//    /**
122
-//     * 根据id查询对象
123
-//     * @param id  实体ID
124
-//     */
125
-//    @RequestMapping(value="/taPv/{id}",method= RequestMethod.GET)
126
-//    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
127
-//    public ResponseBean taPvGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
128
-//        return ResponseBean.success(iTaPvService.getById(id));
129
-//    }
130 408
 }

+ 114
- 0
src/main/java/com/yunzhi/shigongli/controller/TaTravelItemController.java Datei anzeigen

@@ -0,0 +1,114 @@
1
+package com.yunzhi.shigongli.controller;
2
+
3
+import com.yunzhi.shigongli.common.BaseController;
4
+import com.yunzhi.shigongli.common.Constants;
5
+import com.yunzhi.shigongli.common.ResponseBean;
6
+import com.yunzhi.shigongli.common.StringUtils;
7
+import com.yunzhi.shigongli.entity.TaTravel;
8
+import com.yunzhi.shigongli.entity.TaTravelItem;
9
+import com.yunzhi.shigongli.entity.TaTravelPerson;
10
+import com.yunzhi.shigongli.entity.TaUv;
11
+import com.yunzhi.shigongli.service.ITaTravelItemService;
12
+import com.yunzhi.shigongli.service.ITaTravelPersonService;
13
+import com.yunzhi.shigongli.service.ITaTravelService;
14
+import com.yunzhi.shigongli.service.ITaUvService;
15
+import io.swagger.annotations.Api;
16
+import io.swagger.annotations.ApiOperation;
17
+import io.swagger.annotations.ApiParam;
18
+import io.swagger.models.auth.In;
19
+import org.slf4j.Logger;
20
+import org.slf4j.LoggerFactory;
21
+import org.springframework.beans.factory.annotation.Autowired;
22
+import org.springframework.web.bind.annotation.*;
23
+
24
+import java.time.LocalDateTime;
25
+
26
+/**
27
+ * <p>
28
+    * 行程地点 前端控制器
29
+    * </p>
30
+ *
31
+ * @author yansen
32
+ * @since 2021-08-17
33
+ */
34
+
35
+@Api(tags = "行程地点")
36
+@RestController
37
+@RequestMapping("/")
38
+public class TaTravelItemController extends BaseController {
39
+
40
+    private final Logger logger = LoggerFactory.getLogger(TaTravelItemController.class);
41
+
42
+    @Autowired
43
+    public ITaTravelService iTaTravelService;
44
+
45
+    @Autowired
46
+    public ITaTravelItemService iTaTravelItemService;
47
+
48
+    @Autowired
49
+    public ITaTravelPersonService iTaTravelPersonService;
50
+
51
+
52
+    /**
53
+     * 保存我的行程地点
54
+     * @param id
55
+     * @param taTravelItem
56
+     * @return
57
+     * @throws Exception
58
+     */
59
+    @PostMapping("/wx/travel/{id}/travel-item")
60
+    @ApiOperation(value="保存我的行程地点", notes = "保存我的行程地点", httpMethod = "GET", response = TaTravel.class)
61
+    public ResponseBean saveTravelItem(@ApiParam("行程ID") @PathVariable String id,
62
+                                       @ApiParam("保存内容") @RequestBody TaTravelItem taTravelItem) throws Exception {
63
+        TaTravelPerson taTravelPerson = iTaTravelPersonService.getByPerson(getCurrentPerson().getPersonId(), id);
64
+        if (null == taTravelPerson) {
65
+            return ResponseBean.error("未找到更新内容", ResponseBean.ERROR_UNAVAILABLE);
66
+        }
67
+
68
+        if (StringUtils.isEmpty(taTravelItem.getTargetType()) || StringUtils.isEmpty(taTravelItem.getTargetId())) {
69
+            return ResponseBean.error("没有正确设置关联地点", ResponseBean.ERROR_UNAVAILABLE);
70
+        }
71
+
72
+        if (null == taTravelItem.getDayOrder() || taTravelItem.getDayOrder() < 1) {
73
+            taTravelItem.setDayOrder(1);
74
+        }
75
+
76
+        // 获取最大序号
77
+        Integer maxNo = iTaTravelItemService.getMaxNoOf(id, taTravelItem.getDayOrder());
78
+        if (maxNo == null) {
79
+            maxNo = 0;
80
+        }
81
+
82
+        taTravelItem.setTravelId(id);
83
+        taTravelItem.setSortNo(maxNo + 1);
84
+
85
+        if (iTaTravelItemService.save(taTravelItem)) {
86
+            return ResponseBean.success(taTravelItem);
87
+        } else {
88
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
+        }
90
+    }
91
+
92
+    /**
93
+     * 删除我的行程地点
94
+     * @param id
95
+     * @param no
96
+     * @return
97
+     * @throws Exception
98
+     */
99
+    @DeleteMapping("/wx/travel/{id}/travel-item/{no}")
100
+    @ApiOperation(value="删除我的行程地点", notes = "删除我的行程地点", httpMethod = "DELETE", response = TaTravel.class)
101
+    public ResponseBean saveTravelItem(@ApiParam("行程ID") @PathVariable String id,
102
+                                       @ApiParam("行程地点ID") @PathVariable String no) throws Exception {
103
+        TaTravelPerson taTravelPerson = iTaTravelPersonService.getByPerson(getCurrentPerson().getPersonId(), id);
104
+        if (null == taTravelPerson) {
105
+            return ResponseBean.error("未找到更新内容", ResponseBean.ERROR_UNAVAILABLE);
106
+        }
107
+
108
+        if (iTaTravelItemService.removeById(no)) {
109
+            return ResponseBean.success(null);
110
+        } else {
111
+            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
112
+        }
113
+    }
114
+}

+ 29
- 0
src/main/java/com/yunzhi/shigongli/controller/TaskController.java Datei anzeigen

@@ -0,0 +1,29 @@
1
+package com.yunzhi.shigongli.controller;
2
+
3
+import com.yunzhi.shigongli.event.SendMessageTask;
4
+import org.springframework.beans.factory.annotation.Autowired;
5
+import org.springframework.web.bind.annotation.GetMapping;
6
+import org.springframework.web.bind.annotation.RequestMapping;
7
+import org.springframework.web.bind.annotation.RestController;
8
+
9
+@RestController
10
+@RequestMapping("/task")
11
+public class TaskController {
12
+
13
+    @Autowired
14
+    SendMessageTask sendMessageTask;
15
+
16
+    @GetMapping("/hello")
17
+    public String hello() {
18
+        return "Hello !";
19
+    }
20
+
21
+    @GetMapping("/hotel/check-out")
22
+    public void hotelCheckOut() {
23
+        try {
24
+            sendMessageTask.hotelCheckOut();
25
+        } catch (Exception e) {
26
+            e.printStackTrace();
27
+        }
28
+    }
29
+}

+ 1
- 1
src/main/java/com/yunzhi/shigongli/event/SendMessageTask.java Datei anzeigen

@@ -37,7 +37,7 @@ public class SendMessageTask {
37 37
     /**
38 38
      * 离店消息
39 39
      */
40
-    @Scheduled(cron = "0 0 11 * * ?")
40
+//    @Scheduled(cron = "0 0 11 * * ?")
41 41
     public void hotelCheckOut() {
42 42
         String today = DateUtils.toString(LocalDateTime.now(), "yyyy-MM-dd");
43 43
 

+ 4
- 0
src/main/java/com/yunzhi/shigongli/event/listener/OpenShareEventListener.java Datei anzeigen

@@ -2,10 +2,14 @@ package com.yunzhi.shigongli.event.listener;
2 2
 
3 3
 import com.yunzhi.shigongli.event.OpenShareEvent;
4 4
 import com.yunzhi.shigongli.service.ITaShareOpenService;
5
+import org.springframework.beans.factory.annotation.Autowired;
5 6
 import org.springframework.context.ApplicationListener;
7
+import org.springframework.stereotype.Component;
6 8
 
9
+@Component
7 10
 public class OpenShareEventListener implements ApplicationListener<OpenShareEvent> {
8 11
 
12
+    @Autowired
9 13
     ITaShareOpenService iTaShareOpenService;
10 14
 
11 15
     @Override

+ 1
- 1
src/main/java/com/yunzhi/shigongli/mapper/TaNoteMapper.java Datei anzeigen

@@ -19,5 +19,5 @@ public interface TaNoteMapper extends BaseMapper<TaNote> {
19 19
 
20 20
     IPage<TaNote> getPageBy(IPage<TaNote> pg, @Param("noteType") String noteType, @Param("summary") String summary);
21 21
 
22
-    IPage<TaNote> getWxPageBy(IPage<TaNote> pg, @Param("personId") String personId, @Param("location") String location);
22
+    IPage<TaNote> getWxPageBy(IPage<TaNote> pg, @Param("personId") String personId, @Param("location") String location, @Param("summary") String summary);
23 23
 }

+ 6
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaNoteResourceMapper.java Datei anzeigen

@@ -2,7 +2,12 @@ package com.yunzhi.shigongli.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.yunzhi.shigongli.entity.TaNoteResource;
5
+import com.yunzhi.shigongli.entity.TaResource;
6
+import com.yunzhi.shigongli.vo.ResourceListVO;
5 7
 import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
9
+
10
+import java.util.List;
6 11
 
7 12
 /**
8 13
  * <p>
@@ -15,4 +20,5 @@ import org.apache.ibatis.annotations.Mapper;
15 20
 @Mapper
16 21
 public interface TaNoteResourceMapper extends BaseMapper<TaNoteResource> {
17 22
 
23
+    List<ResourceListVO> getResourceListBy(@Param("noteId") String noteId, @Param("personId") String personId);
18 24
 }

+ 2
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaResourceMapper.java Datei anzeigen

@@ -34,4 +34,6 @@ public interface TaResourceMapper extends BaseMapper<TaResource> {
34 34
                                         @Param("targetType") String targetType);
35 35
 
36 36
     ResourceListVO getDetailByTarget(@Param("targetType") String targetType, @Param("targetId")  String targetId, @Param("location") String location);
37
+
38
+    IPage<ResourceListVO> getWxRecommend(IPage<ResourceListVO> pg, @Param("personId")  String personId, @Param("location") String location);
37 39
 }

+ 2
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaShopPackageMapper.java Datei anzeigen

@@ -23,6 +23,7 @@ public interface TaShopPackageMapper extends BaseMapper<TaShopPackage> {
23 23
 
24 24
     IPage<ShopPackageVO> getProfilePage(IPage<TaShopPackage> pg,
25 25
                                         @Param("shopId") String shopId,
26
+                                        @Param("packageCategory") String packageCategory,
26 27
                                         @Param("description") String description);
27 28
 
28 29
     IPage<TaShopPackage> getWxPackageList(IPage<TaShopPackage> pg,
@@ -38,5 +39,6 @@ public interface TaShopPackageMapper extends BaseMapper<TaShopPackage> {
38 39
     int removeByShop(@Param("shopId") String shopId);
39 40
 
40 41
     List<ShopPackageVO> getProfileList(@Param("shopId") String shopId,
42
+                                       @Param("packageCategory") String packageCategory,
41 43
                                        @Param("description") String description);
42 44
 }

+ 7
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaTravelItemMapper.java Datei anzeigen

@@ -2,9 +2,12 @@ package com.yunzhi.shigongli.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.yunzhi.shigongli.entity.TaTravelItem;
5
+import com.yunzhi.shigongli.vo.TravelItemDataVO;
5 6
 import org.apache.ibatis.annotations.Mapper;
6 7
 import org.apache.ibatis.annotations.Param;
7 8
 
9
+import java.util.List;
10
+
8 11
 /**
9 12
  * <p>
10 13
  * 行程地点表 Mapper 接口
@@ -17,4 +20,8 @@ import org.apache.ibatis.annotations.Param;
17 20
 public interface TaTravelItemMapper extends BaseMapper<TaTravelItem> {
18 21
 
19 22
     int copyTravelItems(@Param("srcId") String srcId, @Param("targId") String targId);
23
+
24
+    List<TravelItemDataVO> getTravelItemDetails(@Param("travelId") String travelId);
25
+
26
+    Integer getMaxNoOf(@Param("travelId") String travelId, @Param("dayOrder") Integer dayOrder);
20 27
 }

+ 13
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaTravelMapper.java Datei anzeigen

@@ -1,9 +1,14 @@
1 1
 package com.yunzhi.shigongli.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.yunzhi.shigongli.entity.TaTravel;
6
+import com.yunzhi.shigongli.vo.TravelDataVO;
7
+import com.yunzhi.shigongli.vo.TravelListVO;
5 8
 import org.apache.ibatis.annotations.Mapper;
9
+import org.apache.ibatis.annotations.Param;
6 10
 
11
+import java.time.LocalDateTime;
7 12
 import java.util.List;
8 13
 
9 14
 /**
@@ -18,4 +23,12 @@ import java.util.List;
18 23
 public interface TaTravelMapper extends BaseMapper<TaTravel> {
19 24
 
20 25
     List<TaTravel> getAllDestinyTemplate();
26
+
27
+    List<TravelDataVO> getPersonTravel(@Param("personId") String personId, @Param("travelId") String travelId);
28
+
29
+    IPage<TravelDataVO> getPersonTravelPaged(IPage<TravelDataVO> pg, @Param("personId") String personId, @Param("travelId") String travelId);
30
+
31
+    IPage<TravelListVO> getAdminListPaged(IPage<TravelListVO> pg, @Param("phone") String phone, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);
32
+
33
+    IPage<TaTravel> getAdminDestinyList(IPage<TaTravel> pg, @Param("title") String title, @Param("status") Integer status);
21 34
 }

+ 3
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaTravelPersonMapper.java Datei anzeigen

@@ -3,7 +3,9 @@ package com.yunzhi.shigongli.mapper;
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.yunzhi.shigongli.entity.TaTravel;
5 5
 import com.yunzhi.shigongli.entity.TaTravelPerson;
6
+import com.yunzhi.shigongli.vo.TravelDataVO;
6 7
 import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
7 9
 
8 10
 /**
9 11
  * <p>
@@ -16,4 +18,5 @@ import org.apache.ibatis.annotations.Mapper;
16 18
 @Mapper
17 19
 public interface TaTravelPersonMapper extends BaseMapper<TaTravelPerson> {
18 20
 
21
+    TravelDataVO getDestinyTravel(@Param("personId") String personId);
19 22
 }

+ 4
- 0
src/main/java/com/yunzhi/shigongli/service/ITaNoteResourceService.java Datei anzeigen

@@ -1,6 +1,8 @@
1 1
 package com.yunzhi.shigongli.service;
2 2
 
3 3
 import com.yunzhi.shigongli.entity.TaNoteResource;
4
+import com.yunzhi.shigongli.entity.TaResource;
5
+import com.yunzhi.shigongli.vo.ResourceListVO;
4 6
 
5 7
 import java.util.List;
6 8
 
@@ -17,4 +19,6 @@ public interface ITaNoteResourceService extends IBaseService<TaNoteResource> {
17 19
     boolean updateResource(String noteId, List<TaNoteResource> resourceList) throws Exception;
18 20
 
19 21
     List<TaNoteResource> getListBy(String noteId);
22
+
23
+    List<ResourceListVO> getResourceListBy(String noteId, String personId);
20 24
 }

+ 1
- 1
src/main/java/com/yunzhi/shigongli/service/ITaNoteService.java Datei anzeigen

@@ -16,5 +16,5 @@ import com.yunzhi.shigongli.entity.TaPerson;
16 16
 public interface ITaNoteService extends IBaseService<TaNote> {
17 17
     IPage<TaNote> getPageBy(IPage<TaNote> pg, String noteType, String summary);
18 18
 
19
-    IPage<TaNote> getWxPageBy(IPage<TaNote> pg, TaPerson taPerson, String location);
19
+    IPage<TaNote> getWxPageBy(IPage<TaNote> pg, TaPerson taPerson, String location, String summary);
20 20
 }

+ 2
- 0
src/main/java/com/yunzhi/shigongli/service/ITaResourceService.java Datei anzeigen

@@ -33,4 +33,6 @@ public interface ITaResourceService extends IBaseService<TaResource> {
33 33
     IPage<ResourceListVO> searchList(IPage<ResourceListVO> pg, TaPerson currentPerson, String location, String q, String targetType);
34 34
 
35 35
     ResourceListVO getDetailByTarget(String targetType, String targetId, String location);
36
+
37
+    IPage<ResourceListVO> getWxRecommend(IPage<ResourceListVO> pg, String personId, String location);
36 38
 }

+ 1
- 1
src/main/java/com/yunzhi/shigongli/service/ITaShopPackageService.java Datei anzeigen

@@ -25,7 +25,7 @@ public interface ITaShopPackageService extends IBaseService<TaShopPackage> {
25 25
 
26 26
     ShopPackageVO getProfileById(String id);
27 27
 
28
-    IPage<ShopPackageVO> getProfilePage(IPage<TaShopPackage> pg, String shopId, String description);
28
+    IPage<ShopPackageVO> getProfilePage(IPage<TaShopPackage> pg, String shopId, String packageCategory, String description);
29 29
 
30 30
     IPage<TaShopPackage> getWxPackageList(IPage<TaShopPackage> page, String shopId, TaPerson currentPerson);
31 31
 

+ 8
- 0
src/main/java/com/yunzhi/shigongli/service/ITaTravelItemService.java Datei anzeigen

@@ -1,6 +1,9 @@
1 1
 package com.yunzhi.shigongli.service;
2 2
 
3 3
 import com.yunzhi.shigongli.entity.TaTravelItem;
4
+import com.yunzhi.shigongli.vo.TravelItemDataVO;
5
+
6
+import java.util.List;
4 7
 
5 8
 
6 9
 /**
@@ -13,4 +16,9 @@ import com.yunzhi.shigongli.entity.TaTravelItem;
13 16
  */
14 17
 public interface ITaTravelItemService extends IBaseService<TaTravelItem> {
15 18
 
19
+    Integer getMaxNoOf(String travelId, Integer dayOrder);
20
+
21
+    List<TravelItemDataVO> getTravelItemDetails(String travelId);
22
+
23
+    List<TravelItemDataVO> updateTravelItems(String travelId, List<TravelItemDataVO> travelItemList) throws Exception;
16 24
 }

+ 5
- 0
src/main/java/com/yunzhi/shigongli/service/ITaTravelPersonService.java Datei anzeigen

@@ -2,6 +2,7 @@ package com.yunzhi.shigongli.service;
2 2
 
3 3
 import com.yunzhi.shigongli.entity.TaTravel;
4 4
 import com.yunzhi.shigongli.entity.TaTravelPerson;
5
+import com.yunzhi.shigongli.vo.TravelDataVO;
5 6
 
6 7
 
7 8
 /**
@@ -15,4 +16,8 @@ import com.yunzhi.shigongli.entity.TaTravelPerson;
15 16
 public interface ITaTravelPersonService extends IBaseService<TaTravelPerson> {
16 17
 
17 18
     TaTravel getAndCopyDestinyTravel(String personId) throws Exception;
19
+
20
+    TaTravelPerson getByPerson(String personId, String travelId);
21
+
22
+    TravelDataVO getDestinyTravel(String personId);
18 23
 }

+ 13
- 0
src/main/java/com/yunzhi/shigongli/service/ITaTravelService.java Datei anzeigen

@@ -1,6 +1,12 @@
1 1
 package com.yunzhi.shigongli.service;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.yunzhi.shigongli.entity.TaTravel;
5
+import com.yunzhi.shigongli.vo.TravelDataVO;
6
+import com.yunzhi.shigongli.vo.TravelListVO;
7
+
8
+import java.time.LocalDateTime;
9
+import java.util.List;
4 10
 
5 11
 
6 12
 /**
@@ -13,4 +19,11 @@ import com.yunzhi.shigongli.entity.TaTravel;
13 19
  */
14 20
 public interface ITaTravelService extends IBaseService<TaTravel> {
15 21
 
22
+    TravelDataVO getPersonSingleTravel(String personId, String travelId);
23
+
24
+    IPage<TravelDataVO> getPersonAllList(IPage<TravelDataVO> pg, String personId, Boolean simple);
25
+
26
+    IPage<TravelListVO> getAdminList(IPage<TravelListVO> pg, String phone, LocalDateTime startDate, LocalDateTime endDate);
27
+
28
+    IPage<TaTravel> getAdminDestinyList(IPage<TaTravel> pg, String title, Integer status);
16 29
 }

+ 7
- 1
src/main/java/com/yunzhi/shigongli/service/impl/TaNoteResourceServiceImpl.java Datei anzeigen

@@ -1,10 +1,11 @@
1 1
 package com.yunzhi.shigongli.service.impl;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
-import com.yunzhi.shigongli.entity.TaNote;
5 4
 import com.yunzhi.shigongli.entity.TaNoteResource;
5
+import com.yunzhi.shigongli.entity.TaResource;
6 6
 import com.yunzhi.shigongli.mapper.TaNoteResourceMapper;
7 7
 import com.yunzhi.shigongli.service.ITaNoteResourceService;
8
+import com.yunzhi.shigongli.vo.ResourceListVO;
8 9
 import org.springframework.stereotype.Service;
9 10
 
10 11
 import java.util.List;
@@ -43,4 +44,9 @@ public class TaNoteResourceServiceImpl extends BaseServiceImpl<TaNoteResourceMap
43 44
 
44 45
         return list(queryWrapper);
45 46
     }
47
+
48
+    @Override
49
+    public List<ResourceListVO> getResourceListBy(String noteId, String personId) {
50
+        return baseMapper.getResourceListBy(noteId, personId);
51
+    }
46 52
 }

+ 2
- 2
src/main/java/com/yunzhi/shigongli/service/impl/TaNoteServiceImpl.java Datei anzeigen

@@ -24,7 +24,7 @@ public class TaNoteServiceImpl extends BaseServiceImpl<TaNoteMapper, TaNote> imp
24 24
     }
25 25
 
26 26
     @Override
27
-    public IPage<TaNote> getWxPageBy(IPage<TaNote> pg, TaPerson taPerson, String location) {
28
-        return baseMapper.getWxPageBy(pg, taPerson.getPersonId(), location);
27
+    public IPage<TaNote> getWxPageBy(IPage<TaNote> pg, TaPerson taPerson, String location, String summary) {
28
+        return baseMapper.getWxPageBy(pg, taPerson.getPersonId(), location, summary);
29 29
     }
30 30
 }

+ 13
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaResourceServiceImpl.java Datei anzeigen

@@ -142,6 +142,19 @@ public class TaResourceServiceImpl extends BaseServiceImpl<TaResourceMapper, TaR
142 142
         return baseMapper.getDetailByTarget(targetType, targetId, location);
143 143
     }
144 144
 
145
+    /**
146
+     * 微信推荐
147
+     * 推荐位展示逻辑:1.种草的优先展示,2.种草的地点相关的标签的次之,3.距离远近最后;
148
+     * @param pg
149
+     * @param personId
150
+     * @param location
151
+     * @return
152
+     */
153
+    @Override
154
+    public IPage<ResourceListVO> getWxRecommend(IPage<ResourceListVO> pg, String personId, String location) {
155
+        return baseMapper.getWxRecommend(pg, personId, location);
156
+    }
157
+
145 158
     private TaSearch createSearchLog(String word, String personId) {
146 159
         TaSearch taSearch = new TaSearch();
147 160
         taSearch.setPersonId(personId);

+ 3
- 3
src/main/java/com/yunzhi/shigongli/service/impl/TaShopPackageServiceImpl.java Datei anzeigen

@@ -143,12 +143,12 @@ public class TaShopPackageServiceImpl extends BaseServiceImpl<TaShopPackageMappe
143 143
     }
144 144
 
145 145
     @Override
146
-    public IPage<ShopPackageVO> getProfilePage(IPage<TaShopPackage> pg, String shopId, String description) {
146
+    public IPage<ShopPackageVO> getProfilePage(IPage<TaShopPackage> pg, String shopId, String packageCategory, String description) {
147 147
         if (null != pg) {
148
-            return baseMapper.getProfilePage(pg, shopId, description);
148
+            return baseMapper.getProfilePage(pg, shopId, packageCategory, description);
149 149
         } else {
150 150
             IPage<ShopPackageVO> result = new Page<>();
151
-            List <ShopPackageVO> list = baseMapper.getProfileList(shopId, description);
151
+            List <ShopPackageVO> list = baseMapper.getProfileList(shopId, packageCategory, description);
152 152
             result.setRecords(list);
153 153
             return result;
154 154
         }

+ 55
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaTravelItemServiceImpl.java Datei anzeigen

@@ -1,10 +1,18 @@
1 1
 package com.yunzhi.shigongli.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.yunzhi.shigongli.entity.TaTravel;
3 5
 import com.yunzhi.shigongli.entity.TaTravelItem;
4 6
 import com.yunzhi.shigongli.mapper.TaTravelItemMapper;
7
+import com.yunzhi.shigongli.mapper.TaTravelMapper;
5 8
 import com.yunzhi.shigongli.service.ITaTravelItemService;
9
+import com.yunzhi.shigongli.vo.TravelItemDataVO;
10
+import org.springframework.beans.factory.annotation.Autowired;
6 11
 import org.springframework.stereotype.Service;
7 12
 
13
+import java.util.ArrayList;
14
+import java.util.List;
15
+
8 16
 /**
9 17
  * <p>
10 18
  * 行程地点 服务实现类
@@ -16,4 +24,51 @@ import org.springframework.stereotype.Service;
16 24
 @Service
17 25
 public class TaTravelItemServiceImpl extends BaseServiceImpl<TaTravelItemMapper, TaTravelItem> implements ITaTravelItemService {
18 26
 
27
+    @Autowired
28
+    TaTravelMapper taTravelMapper;
29
+
30
+    @Override
31
+    public Integer getMaxNoOf(String travelId, Integer dayOrder) {
32
+        return baseMapper.getMaxNoOf(travelId, dayOrder);
33
+    }
34
+
35
+    @Override
36
+    public List<TravelItemDataVO> getTravelItemDetails(String travelId) {
37
+        return baseMapper.getTravelItemDetails(travelId);
38
+    }
39
+
40
+    /**
41
+     * 保存 行程明细
42
+     * @param travelId
43
+     * @param travelItemList
44
+     * @return
45
+     * @throws Exception
46
+     */
47
+    @Override
48
+    public List<TravelItemDataVO> updateTravelItems(String travelId, List<TravelItemDataVO> travelItemList) throws Exception {
49
+
50
+        // 先删除所有
51
+        QueryWrapper<TaTravelItem> queryWrapper = new QueryWrapper<>();
52
+        queryWrapper.eq("travel_id", travelId);
53
+        remove(queryWrapper);
54
+
55
+        // 再插入所有
56
+
57
+        List<TaTravelItem> travelItems = new ArrayList<>();
58
+        int cursor = 0;
59
+        for (TravelItemDataVO item : travelItemList) {
60
+            TaTravelItem travelItem = new TaTravelItem();
61
+            travelItem.setTravelId(travelId);
62
+            travelItem.setTargetType(item.getTargetType());
63
+            travelItem.setTargetId(item.getTargetId());
64
+            travelItem.setDayOrder(1);
65
+            travelItem.setSortNo(cursor++);
66
+            travelItems.add(travelItem);
67
+        }
68
+
69
+        // 保存明细
70
+        saveBatch(travelItems);
71
+
72
+        return getTravelItemDetails(travelId);
73
+    }
19 74
 }

+ 16
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaTravelPersonServiceImpl.java Datei anzeigen

@@ -1,5 +1,6 @@
1 1
 package com.yunzhi.shigongli.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3 4
 import com.yunzhi.shigongli.common.MathUtils;
4 5
 import com.yunzhi.shigongli.entity.TaTravel;
5 6
 import com.yunzhi.shigongli.entity.TaTravelPerson;
@@ -7,6 +8,7 @@ import com.yunzhi.shigongli.mapper.TaTravelItemMapper;
7 8
 import com.yunzhi.shigongli.mapper.TaTravelMapper;
8 9
 import com.yunzhi.shigongli.mapper.TaTravelPersonMapper;
9 10
 import com.yunzhi.shigongli.service.ITaTravelPersonService;
11
+import com.yunzhi.shigongli.vo.TravelDataVO;
10 12
 import org.springframework.beans.BeanUtils;
11 13
 import org.springframework.beans.factory.annotation.Autowired;
12 14
 import org.springframework.stereotype.Service;
@@ -65,4 +67,18 @@ public class TaTravelPersonServiceImpl extends BaseServiceImpl<TaTravelPersonMap
65 67
 
66 68
         return copyTravel;
67 69
     }
70
+
71
+    @Override
72
+    public TaTravelPerson getByPerson(String personId, String travelId) {
73
+        QueryWrapper<TaTravelPerson> queryWrapper = new QueryWrapper<>();
74
+        queryWrapper.eq("person_id", personId);
75
+        queryWrapper.eq("travel_id", travelId);
76
+
77
+        return getOne(queryWrapper);
78
+    }
79
+
80
+    @Override
81
+    public TravelDataVO getDestinyTravel(String personId) {
82
+        return baseMapper.getDestinyTravel(personId);
83
+    }
68 84
 }

+ 49
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaTravelServiceImpl.java Datei anzeigen

@@ -1,10 +1,19 @@
1 1
 package com.yunzhi.shigongli.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.yunzhi.shigongli.entity.TaTravel;
5
+import com.yunzhi.shigongli.mapper.TaTravelItemMapper;
4 6
 import com.yunzhi.shigongli.mapper.TaTravelMapper;
5 7
 import com.yunzhi.shigongli.service.ITaTravelService;
8
+import com.yunzhi.shigongli.vo.TravelDataVO;
9
+import com.yunzhi.shigongli.vo.TravelItemDataVO;
10
+import com.yunzhi.shigongli.vo.TravelListVO;
11
+import org.springframework.beans.factory.annotation.Autowired;
6 12
 import org.springframework.stereotype.Service;
7 13
 
14
+import java.time.LocalDateTime;
15
+import java.util.List;
16
+
8 17
 /**
9 18
  * <p>
10 19
  * 分享表 服务实现类
@@ -16,4 +25,44 @@ import org.springframework.stereotype.Service;
16 25
 @Service
17 26
 public class TaTravelServiceImpl extends BaseServiceImpl<TaTravelMapper, TaTravel> implements ITaTravelService {
18 27
 
28
+    @Autowired
29
+    TaTravelItemMapper taTravelItemMapper;
30
+
31
+    @Override
32
+    public TravelDataVO getPersonSingleTravel(String personId, String travelId) {
33
+        List<TravelDataVO> travelDataVOList = baseMapper.getPersonTravel(personId, travelId);
34
+
35
+        if (null == travelDataVOList || travelDataVOList.size() < 1) {
36
+            return null;
37
+        }
38
+
39
+        TravelDataVO travelDataVO = travelDataVOList.get(0);
40
+        List<TravelItemDataVO> itemDataVOList = taTravelItemMapper.getTravelItemDetails(travelId);
41
+        travelDataVO.setTravelItemList(itemDataVOList);
42
+
43
+        return travelDataVO;
44
+    }
45
+
46
+    @Override
47
+    public IPage<TravelDataVO> getPersonAllList(IPage<TravelDataVO> pg, String personId, Boolean simple) {
48
+        IPage<TravelDataVO> travelDataVOPage = baseMapper.getPersonTravelPaged(pg, personId, null);
49
+        if (simple || null == travelDataVOPage || null == travelDataVOPage.getRecords()) return travelDataVOPage;
50
+
51
+        for (TravelDataVO travelDataVO : travelDataVOPage.getRecords()) {
52
+            List<TravelItemDataVO> itemDataVOList = taTravelItemMapper.getTravelItemDetails(travelDataVO.getTravelId());
53
+            travelDataVO.setTravelItemList(itemDataVOList);
54
+        }
55
+
56
+        return travelDataVOPage;
57
+    }
58
+
59
+    @Override
60
+    public IPage<TravelListVO> getAdminList(IPage<TravelListVO> pg, String phone, LocalDateTime startDate, LocalDateTime endDate) {
61
+        return baseMapper.getAdminListPaged(pg, phone, startDate, endDate);
62
+    }
63
+
64
+    @Override
65
+    public IPage<TaTravel> getAdminDestinyList(IPage<TaTravel> pg, String title, Integer status) {
66
+        return baseMapper.getAdminDestinyList(pg, title, status);
67
+    }
19 68
 }

+ 4
- 0
src/main/java/com/yunzhi/shigongli/vo/NoteVO.java Datei anzeigen

@@ -2,6 +2,7 @@ package com.yunzhi.shigongli.vo;
2 2
 
3 3
 import com.yunzhi.shigongli.entity.TaImage;
4 4
 import com.yunzhi.shigongli.entity.TaNoteResource;
5
+import com.yunzhi.shigongli.entity.TaResource;
5 6
 import io.swagger.annotations.ApiModel;
6 7
 import io.swagger.annotations.ApiModelProperty;
7 8
 import lombok.Data;
@@ -51,4 +52,7 @@ public class NoteVO {
51 52
 
52 53
     @ApiModelProperty(value = "笔记资源")
53 54
     private List<TaNoteResource> resourceList;
55
+
56
+    @ApiModelProperty(value = "笔记资源-微信端")
57
+    private List<ResourceListVO> wxResourceList;
54 58
 }

+ 12
- 0
src/main/java/com/yunzhi/shigongli/vo/ResourceListVO.java Datei anzeigen

@@ -15,4 +15,16 @@ public class ResourceListVO extends TaResource {
15 15
 
16 16
     @ApiModelProperty(value = "距离")
17 17
     Float distance;
18
+
19
+    @ApiModelProperty(value = "是否种草")
20
+    Integer isVisited;
21
+
22
+    @ApiModelProperty(value = "区位ID")
23
+    private String areaId;
24
+
25
+    @ApiModelProperty(value = "区位名称")
26
+    private String areaName;
27
+
28
+    @ApiModelProperty(value = "区位父级名称")
29
+    private String areaPName;
18 30
 }

+ 48
- 0
src/main/java/com/yunzhi/shigongli/vo/TravelDataVO.java Datei anzeigen

@@ -0,0 +1,48 @@
1
+package com.yunzhi.shigongli.vo;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import java.time.LocalDateTime;
8
+import java.util.List;
9
+
10
+@ApiModel(value="TravelDataVO", description="行程数据")
11
+@Data
12
+public class TravelDataVO {
13
+    @ApiModelProperty(value = "行程ID")
14
+    private String travelId;
15
+
16
+    @ApiModelProperty(value = "标题")
17
+    private String title;
18
+
19
+    @ApiModelProperty(value = "天数")
20
+    private Integer dayNum;
21
+
22
+    @ApiModelProperty(value = "是否命定行程")
23
+    private Boolean isDestiny;
24
+
25
+    @ApiModelProperty(value = "是否系统内定")
26
+    private Boolean isSystem;
27
+
28
+    @ApiModelProperty(value = "权重")
29
+    private Integer weight;
30
+
31
+    @ApiModelProperty(value = "状态")
32
+    private Integer status;
33
+
34
+    @ApiModelProperty(value = "创建时间")
35
+    private LocalDateTime createDate;
36
+
37
+    @ApiModelProperty(value = "序号")
38
+    private String serialNo;
39
+
40
+    @ApiModelProperty(value = "人员ID")
41
+    private String personId;
42
+
43
+    @ApiModelProperty(value = "是否隐藏")
44
+    private Boolean isHidden;
45
+
46
+    @ApiModelProperty(value = "行程地点")
47
+    List<TravelItemDataVO> travelItemList;
48
+}

+ 69
- 0
src/main/java/com/yunzhi/shigongli/vo/TravelItemDataVO.java Datei anzeigen

@@ -0,0 +1,69 @@
1
+package com.yunzhi.shigongli.vo;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+@ApiModel(value="TravelItemDataVO", description="行程地点")
8
+@Data
9
+public class TravelItemDataVO {
10
+    @ApiModelProperty(value = "项目地点ID")
11
+    private String itemId;
12
+
13
+    @ApiModelProperty(value = "第几天")
14
+    private Integer dayOrder;
15
+
16
+    @ApiModelProperty(value = "对象类型")
17
+    private String targetType;
18
+
19
+    @ApiModelProperty(value = "对象ID")
20
+    private String targetId;
21
+
22
+    @ApiModelProperty(value = "权重")
23
+    private Integer sortNo;
24
+
25
+    @ApiModelProperty(value = "resourceNo")
26
+    private Integer resourceNo;
27
+
28
+    @ApiModelProperty(value = "访问对象ID")
29
+    private String targetName;
30
+
31
+    @ApiModelProperty(value = "点赞数")
32
+    private Integer likeNum;
33
+
34
+    @ApiModelProperty(value = "浏览量")
35
+    private Integer pvNum;
36
+
37
+    @ApiModelProperty(value = "用户数")
38
+    private Integer uvNum;
39
+
40
+    @ApiModelProperty(value = "主图")
41
+    private String poster;
42
+
43
+    @ApiModelProperty(value = "文案")
44
+    private String title;
45
+
46
+    @ApiModelProperty(value = "经度")
47
+    private String lng;
48
+
49
+    @ApiModelProperty(value = "纬度")
50
+    private String lat;
51
+
52
+    @ApiModelProperty(value = "均价")
53
+    private Integer averagePrice;
54
+
55
+    @ApiModelProperty(value = "权重")
56
+    private Integer weight;
57
+
58
+    @ApiModelProperty(value = "所属区")
59
+    private String cityId;
60
+
61
+    @ApiModelProperty(value = "区位ID")
62
+    private String areaId;
63
+
64
+    @ApiModelProperty(value = "区位名称")
65
+    private String areaName;
66
+
67
+    @ApiModelProperty(value = "区位父级名称")
68
+    private String areaPName;
69
+}

+ 26
- 0
src/main/java/com/yunzhi/shigongli/vo/TravelListVO.java Datei anzeigen

@@ -0,0 +1,26 @@
1
+package com.yunzhi.shigongli.vo;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import java.time.LocalDateTime;
8
+
9
+@ApiModel(description = "行程列表")
10
+@Data
11
+public class TravelListVO {
12
+    @ApiModelProperty("行程ID")
13
+    String travelId;
14
+
15
+    @ApiModelProperty("创建人昵称")
16
+    String nickName;
17
+
18
+    @ApiModelProperty("创建人手机")
19
+    String phone;
20
+
21
+    @ApiModelProperty("创建时间")
22
+    LocalDateTime createDate;
23
+
24
+    @ApiModelProperty("行程内容")
25
+    String travelContent;
26
+}

+ 1
- 0
src/main/resources/application.yml Datei anzeigen

@@ -16,6 +16,7 @@ interceptor:
16 16
       - /wx/login
17 17
       - /wxpay/notify/order
18 18
       - /mp/portal/**
19
+      - /task/**
19 20
       - /swagger-ui/**
20 21
       - /swagger-resources/**
21 22
       - /v2/**

+ 5
- 0
src/main/resources/mapper/TaNoteMapper.xml Datei anzeigen

@@ -44,6 +44,11 @@
44 44
                     d.distance DESC
45 45
                     LIMIT 1
46 46
             ) s ON s.note_id = t.note_id
47
+        WHERE
48
+            t.`status` > - 1
49
+        <if test="summary != null and summary != ''">
50
+            AND t.summary LIKE CONCAT( '%', #{summary}, '%' )
51
+        </if>
47 52
         ORDER BY
48 53
             IF
49 54
                 ( s.note_id IS NULL, 0, 1 ) DESC,

+ 40
- 0
src/main/resources/mapper/TaNoteResourceMapper.xml Datei anzeigen

@@ -2,4 +2,44 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.yunzhi.shigongli.mapper.TaNoteResourceMapper">
4 4
 
5
+    <select id="getResourceListBy" resultType="com.yunzhi.shigongli.vo.ResourceListVO">
6
+        SELECT
7
+            s.*,
8
+            <if test="personId != null and personId != ''">
9
+                IFNULL(m.visited_num, 0) as is_visited,
10
+            </if>
11
+            <if test="personId == null or personId == ''">
12
+                0 as is_visited,
13
+            </if>
14
+            c.area_name,
15
+            d.area_id,
16
+            d.area_name AS area_p_name
17
+        FROM
18
+            ta_note_resource t
19
+                INNER JOIN ta_resource s ON s.resource_no = t.resource_no
20
+                <if test="personId != null and personId != ''">
21
+                LEFT JOIN (
22
+                    SELECT
23
+                        b.target_type,
24
+                        b.target_id,
25
+                        count( 1 ) AS visited_num
26
+                    FROM
27
+                        ta_travel_person a
28
+                            INNER JOIN ta_travel_item b ON a.travel_id = b.travel_id
29
+                    WHERE
30
+                        a.person_id = #{personId}
31
+                    GROUP BY
32
+                        b.target_type,
33
+                        b.target_id
34
+                ) m ON m.target_type = s.target_type
35
+                    AND m.target_id = s.target_id
36
+                </if>
37
+                LEFT JOIN td_city c ON c.area_id = s.city_id
38
+                LEFT JOIN td_city d ON d.area_id = c.area_p_id
39
+        WHERE
40
+            t.note_id = #{noteId}
41
+          AND s.`status` > - 1
42
+        ORDER BY
43
+            t.serial_no ASC
44
+    </select>
5 45
 </mapper>

src/main/resources/mapper/TaTargetQuotaMapper.xml → src/main/resources/mapper/TaResourceMapper.xml Datei anzeigen

@@ -92,4 +92,49 @@
92 92
             AND t.target_id = #{targetId}
93 93
             AND t.`status` &gt; -1
94 94
     </select>
95
+    <select id="getWxRecommend" resultType="com.yunzhi.shigongli.vo.ResourceListVO">
96
+        SELECT
97
+            t.*,
98
+            fn_distance ( #{location}, CONCAT( t.lng, ',', t.lat ) ) AS distance,
99
+            IF(s.cnt is null, 0, s.cnt) as is_visited,
100
+            c.area_name,
101
+            d.area_id,
102
+            d.area_name AS area_p_name
103
+        FROM
104
+            ta_resource t
105
+                LEFT JOIN (
106
+                SELECT
107
+                    b.target_type,
108
+                    b.target_id,
109
+                    count( * ) AS cnt
110
+                FROM
111
+                    ta_travel_person a
112
+                        INNER JOIN ta_travel_item b ON b.travel_id = a.travel_id
113
+                WHERE
114
+                    a.person_id = #{personId}
115
+                GROUP BY
116
+                    b.target_type,
117
+                    b.target_id
118
+            ) s ON s.target_type = t.target_type
119
+                AND s.target_id = t.target_id
120
+                LEFT JOIN (
121
+                SELECT
122
+                    b.target_type,
123
+                    b.target_id,
124
+                    count( * ) AS cnt
125
+                FROM
126
+                    ta_target_type b
127
+                GROUP BY
128
+                    b.target_type,
129
+                    b.target_id
130
+            ) m ON m.target_type = s.target_type
131
+                AND m.target_id = s.target_id
132
+                LEFT JOIN td_city c ON c.area_id = t.city_id
133
+                LEFT JOIN td_city d ON d.area_id = c.area_p_id
134
+        ORDER BY
135
+            IF( s.cnt IS NULL, 0, 1000000 + s.cnt ) DESC,
136
+            IF( m.cnt IS NULL, 0, 10000 + m.cnt ) DESC,
137
+            fn_distance ( #{location}, CONCAT( t.lng, ',', t.lat ) ) DESC,
138
+            t.weight DESC
139
+    </select>
95 140
 </mapper>

+ 4
- 1
src/main/resources/mapper/TaShopPackageMapper.xml Datei anzeigen

@@ -18,10 +18,13 @@
18 18
             s.strategy_level
19 19
         FROM
20 20
             ta_shop_package t
21
-            INNER JOIN ta_shop_package_setting s ON t.package_id = s.package_id
21
+            LEFT JOIN ta_shop_package_setting s ON t.package_id = s.package_id
22 22
             INNER JOIN ta_shop m on m.shop_id = t.shop_id
23 23
         WHERE
24 24
             t.`status` &gt; - 1
25
+            <if test="packageCategory != null and packageCategory != ''">
26
+                AND t.package_category = #{packageCategory}
27
+            </if>
25 28
             <if test="shopId != null and shopId != ''">
26 29
                 AND t.shop_id = #{shopId}
27 30
             </if>

+ 42
- 1
src/main/resources/mapper/TaTravelItemMapper.xml Datei anzeigen

@@ -5,7 +5,7 @@
5 5
     <insert id="copyTravelItems">
6 6
         INSERT INTO ta_travel_item ( item_id, travel_id, day_order, target_type, target_id, sort_no )
7 7
         SELECT
8
-            REPLACE(UUID(), '-', ''),
8
+            UUID_SHORT(),
9 9
             #{targId},
10 10
             day_order,
11 11
             target_type,
@@ -16,4 +16,45 @@
16 16
         WHERE
17 17
             t.travel_id = #{srcId}
18 18
     </insert>
19
+    <select id="getTravelItemDetails" resultType="com.yunzhi.shigongli.vo.TravelItemDataVO">
20
+        SELECT
21
+            t.*,
22
+            s.resource_no,
23
+            s.like_num,
24
+            s.pv_num,
25
+            s.uv_num,
26
+            s.poster,
27
+            s.title,
28
+            s.lng,
29
+            s.lat,
30
+            s.average_price,
31
+            s.weight,
32
+            s.city_id,
33
+            s.save_num,
34
+            s.target_name,
35
+            c.area_name,
36
+            d.area_id,
37
+            d.area_name AS area_p_name
38
+        FROM
39
+            ta_travel_item t
40
+                INNER JOIN ta_resource s ON s.target_type = t.target_type
41
+                    AND s.target_id = t.target_id
42
+                LEFT JOIN td_city c ON c.area_id = s.city_id
43
+                LEFT JOIN td_city d ON d.area_id = c.area_p_id
44
+        WHERE
45
+            t.travel_id = #{travelId}
46
+          AND s.`status` &gt; -1
47
+        ORDER BY
48
+            t.day_order ASC,
49
+            t.sort_no ASC
50
+    </select>
51
+    <select id="getMaxNoOf" resultType="java.lang.Integer">
52
+        SELECT
53
+            max( t.sort_no )
54
+        FROM
55
+            ta_travel_item t
56
+        WHERE
57
+            t.travel_id = #{travelId}
58
+          AND t.day_order = #{dayOrder}
59
+    </select>
19 60
 </mapper>

+ 95
- 0
src/main/resources/mapper/TaTravelMapper.xml Datei anzeigen

@@ -12,4 +12,99 @@
12 12
           AND t.is_destiny = 1
13 13
           AND t.`status` = 1
14 14
     </select>
15
+
16
+    <sql id="queryPersonTravel">
17
+        SELECT
18
+            t.*,
19
+            s.serial_no,
20
+            s.person_id,
21
+            s.is_hidden
22
+        FROM
23
+            ta_travel t
24
+            INNER JOIN ta_travel_person s ON s.travel_id = t.travel_id
25
+        WHERE
26
+            s.person_id = #{personId}
27
+            AND t.`status` > - 1
28
+            <if test="travelId != null and travelId != ''">
29
+                AND t.travel_id = #{travelId}
30
+            </if>
31
+        ORDER BY
32
+            t.weight DESC,
33
+            t.create_date DESC
34
+    </sql>
35
+
36
+    <select id="getPersonTravel" resultType="com.yunzhi.shigongli.vo.TravelDataVO">
37
+        <include refid="queryPersonTravel"></include>
38
+    </select>
39
+    <select id="getPersonTravelPaged" resultType="com.yunzhi.shigongli.vo.TravelDataVO">
40
+        <include refid="queryPersonTravel"></include>
41
+    </select>
42
+
43
+    <sql id="queryTravelList">
44
+        SELECT
45
+            p.nick_name,
46
+            p.phone,
47
+            m.travel_content,
48
+            t.create_date
49
+        FROM
50
+            ta_travel t
51
+            INNER JOIN ta_travel_person s ON s.travel_id = t.travel_id
52
+            INNER JOIN ta_person p ON p.person_id = s.person_id
53
+            INNER JOIN (
54
+                SELECT
55
+                    a.travel_id,
56
+                    a.target_type,
57
+                    a.target_id,
58
+                    GROUP_CONCAT( b.target_name ) AS travel_content
59
+                FROM
60
+                    ta_travel_item a
61
+                    INNER JOIN ta_resource b ON b.target_type = a.target_type
62
+                        AND b.target_id = a.target_id
63
+                GROUP BY
64
+                    a.travel_id,
65
+                    a.target_type,
66
+                    a.target_id
67
+            ) m ON m.travel_id = t.travel_id
68
+        WHERE
69
+            t.`status` &gt; - 1
70
+          <if test="phone != null and phone != ''">
71
+              AND p.phone LIKE CONCAT( '%', #{phone}, '%' )
72
+          </if>
73
+          <if test="startDate != null">
74
+            AND t.create_date &gt;= #{startDate}
75
+          </if>
76
+          <if test="endDate != null">
77
+            AND t.create_date &lt;= #{endDate}
78
+          </if>
79
+        GROUP BY
80
+            t.create_date DESC
81
+    </sql>
82
+
83
+    <select id="getAdminListPaged" resultType="com.yunzhi.shigongli.vo.TravelListVO">
84
+        <include refid="queryTravelList"></include>
85
+    </select>
86
+
87
+    <sql id="queryDestinyList">
88
+        SELECT
89
+            *
90
+        FROM
91
+            ta_travel t
92
+        WHERE
93
+            t.is_destiny = 1
94
+          AND t.is_system = 1
95
+          <if test="title != null and title != ''">
96
+              AND t.title LIKE CONCAT( '%', #{title}, '%' )
97
+          </if>
98
+          AND t.`status` &gt; - 1
99
+        <if test="status != null">
100
+            AND t.`status` = #{status}
101
+        </if>
102
+        ORDER BY
103
+            t.weight DESC,
104
+            t.create_date DESC
105
+    </sql>
106
+
107
+    <select id="getAdminDestinyList" resultType="com.yunzhi.shigongli.entity.TaTravel">
108
+        <include refid="queryDestinyList"></include>
109
+    </select>
15 110
 </mapper>

+ 13
- 0
src/main/resources/mapper/TaTravelPersonMapper.xml Datei anzeigen

@@ -2,4 +2,17 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.yunzhi.shigongli.mapper.TaTravelPersonMapper">
4 4
 
5
+    <select id="getDestinyTravel" resultType="com.yunzhi.shigongli.vo.TravelDataVO">
6
+        SELECT
7
+            t.*,
8
+            s.serial_no,
9
+            s.is_hidden,
10
+            s.person_id
11
+        FROM
12
+            ta_travel t
13
+                INNER JOIN ta_travel_person s ON s.travel_id = t.travel_id
14
+        WHERE
15
+            s.person_id = #{personId}
16
+          AND t.is_destiny = 1
17
+    </select>
5 18
 </mapper>