|
@@ -1,13 +1,21 @@
|
|
|
package com.tourism.webadmin.app.website.controller;
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaIgnore;
|
|
|
+import com.github.pagehelper.page.PageMethod;
|
|
|
+import com.tourism.common.additional.utils.StringUtils;
|
|
|
import com.tourism.common.additional.utils.UrlConvertUtils;
|
|
|
+import com.tourism.common.core.constant.ErrorCodeEnum;
|
|
|
import com.tourism.common.core.object.MyOrderParam;
|
|
|
import com.tourism.common.core.object.MyPageData;
|
|
|
import com.tourism.common.core.object.ResponseResult;
|
|
|
+import com.tourism.common.core.object.TokenData;
|
|
|
+import com.tourism.common.core.util.MyCommonUtil;
|
|
|
import com.tourism.common.core.util.MyModelUtil;
|
|
|
+import com.tourism.common.core.validator.UpdateGroup;
|
|
|
import com.tourism.common.log.annotation.OperationLog;
|
|
|
import com.tourism.common.log.model.constant.SysOperationLogType;
|
|
|
+import com.tourism.webadmin.app.website.dto.PageDto;
|
|
|
+import com.tourism.webadmin.app.website.dto.TourismCollectDto;
|
|
|
import com.tourism.webadmin.app.website.dto.TourismProjectTravelNotesToWebDto;
|
|
|
import com.tourism.webadmin.app.website.service.BasicToWebService;
|
|
|
import com.tourism.webadmin.app.website.vo.TourTravelNotesDirectoryCountryVo;
|
|
@@ -22,14 +30,12 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Tag(name = "门户网站旅游游记接口")
|
|
@@ -51,6 +57,8 @@ public class WebsiteTourismProjectTravelNotesController {
|
|
|
private TourTourismProjectTravelNotesService tourTourismProjectTravelNotesService;
|
|
|
@Autowired
|
|
|
private ApplicationConfig applicationConfig;
|
|
|
+ @Autowired
|
|
|
+ private TourUserLikeTravelNotesService tourUserLikeTravelNotesService;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -108,10 +116,13 @@ public class WebsiteTourismProjectTravelNotesController {
|
|
|
*/
|
|
|
@SaIgnore
|
|
|
@OperationLog(type = SysOperationLogType.UPDATE)
|
|
|
- @GetMapping("/userCollectTravelNotesUpdate")
|
|
|
- public ResponseResult<Void> userCollectTravelNotesUpdate(@RequestParam Long travelNotesId,Integer type) {
|
|
|
-
|
|
|
- basicToWebServicel.userLikeTravelNotesUpdate(travelNotesId,type);
|
|
|
+ @PostMapping("/userCollectTravelNotesUpdate")
|
|
|
+ public ResponseResult<Void> userCollectTravelNotesUpdate(@RequestBody TourismCollectDto tourismCollectDto) {
|
|
|
+ String errorMessage = MyCommonUtil.getModelValidationError(tourismCollectDto, UpdateGroup.class);
|
|
|
+ if (errorMessage != null) {
|
|
|
+ return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED);
|
|
|
+ }
|
|
|
+ basicToWebServicel.userLikeTravelNotesUpdate(Long.valueOf(tourismCollectDto.getTravelNotesId()),tourismCollectDto.getType());
|
|
|
return ResponseResult.success();
|
|
|
}
|
|
|
|
|
@@ -122,8 +133,39 @@ public class WebsiteTourismProjectTravelNotesController {
|
|
|
*/
|
|
|
@OperationLog(type = SysOperationLogType.LIST)
|
|
|
@GetMapping("/isCollectTravelNotes")
|
|
|
- public ResponseResult<Boolean> isCollectTravelNotes(@RequestParam Long travelNotesId) {
|
|
|
- return ResponseResult.success(basicToWebServicel.isLikeTravelNotes(travelNotesId));
|
|
|
+ public ResponseResult<Boolean> isCollectTravelNotes(@RequestParam String travelNotesId) {
|
|
|
+ return ResponseResult.success(basicToWebServicel.isLikeTravelNotes(Long.valueOf(travelNotesId)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户的收藏列表
|
|
|
+ *
|
|
|
+ * @return 应答结果对象,包含查询结果集。
|
|
|
+ */
|
|
|
+ @OperationLog(type = SysOperationLogType.LIST)
|
|
|
+ @GetMapping("/userCollectTravelNotesList")
|
|
|
+ public ResponseResult<List<TourTourismProjectTravelNotes>> userCollectTravelNotesList(PageDto pageDto) {
|
|
|
+
|
|
|
+ MyOrderParam myOrderParam = new MyOrderParam();
|
|
|
+ myOrderParam.add(new MyOrderParam.OrderInfo("updateTime",false,null));
|
|
|
+ String orderBy = MyOrderParam.buildOrderBy(myOrderParam, TourUserLikeTravelNotes.class);
|
|
|
+ Long userId = TokenData.takeFromRequest().getUserId();
|
|
|
+ TourUserLikeTravelNotes filter = new TourUserLikeTravelNotes();
|
|
|
+ filter.setUserId(userId);
|
|
|
+ if(pageDto.getPageSize() != null && pageDto.getPageNum() != null){
|
|
|
+ PageMethod.startPage(pageDto.getPageNum(), pageDto.getPageSize(), true);
|
|
|
+ }
|
|
|
+ List<TourUserLikeTravelNotes> tourUserLikeTravelNotesList = tourUserLikeTravelNotesService.getTourUserLikeTravelNotesList(filter, orderBy);
|
|
|
+ List<TourTourismProjectTravelNotes> tourTourismProjectTravelNotesList = new ArrayList<>();
|
|
|
+ if(CollectionUtils.isNotEmpty(tourUserLikeTravelNotesList)) {
|
|
|
+ for(TourUserLikeTravelNotes item:tourUserLikeTravelNotesList){
|
|
|
+ TourTourismProjectTravelNotes tourTourismProjectTravelNotes = tourTourismProjectTravelNotesService.getById(item.getId());
|
|
|
+ if(tourTourismProjectTravelNotes != null){
|
|
|
+ tourTourismProjectTravelNotesList.add(tourTourismProjectTravelNotes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResponseResult.success(tourTourismProjectTravelNotesList);
|
|
|
}
|
|
|
|
|
|
|