Bläddra i källkod

游记列表接口增加两个字段(地区,国家)

chenchen 5 månader sedan
förälder
incheckning
8191cec843

+ 17 - 4
application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/WebsiteTourismProjectTravelNotesController.java

@@ -63,7 +63,7 @@ public class WebsiteTourismProjectTravelNotesController {
      */
     @OperationLog(type = SysOperationLogType.LIST)
     @GetMapping("/travelNotesDetail")
-    public ResponseResult<TourTourismProjectTravelNotesVo> travelNotesDetail(@RequestParam String id) {
+    public ResponseResult<TourTourismProjectTravelNotesVo> travelNotesDetail(@RequestParam Long id) {
 
         return ResponseResult.success(basicToWebServicel.travelNotesDetail(id));
     }
@@ -74,9 +74,9 @@ public class WebsiteTourismProjectTravelNotesController {
      * param type 0取消点赞 1点赞
      * @return 应答结果对象,包含查询结果集。
      */
-    @OperationLog(type = SysOperationLogType.ADD)
+    @OperationLog(type = SysOperationLogType.UPDATE)
     @GetMapping("/userLikeTravelNotesUpdate")
-    public ResponseResult<Void> userLikeTravelNotesUpdate(@RequestParam String travelNotesId,Integer type) {
+    public ResponseResult<Void> userLikeTravelNotesUpdate(@RequestParam Long travelNotesId,Integer type) {
 
         basicToWebServicel.userLikeTravelNotesUpdate(travelNotesId,type);
         return ResponseResult.success();
@@ -89,7 +89,20 @@ public class WebsiteTourismProjectTravelNotesController {
      */
     @OperationLog(type = SysOperationLogType.ADD)
     @GetMapping("/isLikeTravelNotes")
-    public ResponseResult<Boolean> isLikeTravelNotes(@RequestParam String travelNotesId) {
+    public ResponseResult<Boolean> isLikeTravelNotes(@RequestParam Long travelNotesId) {
         return ResponseResult.success(basicToWebServicel.isLikeTravelNotes(travelNotesId));
     }
+
+
+    /**
+     * 用户游记增加浏览量
+     * param travelNotesId 游记id
+     * @return 应答结果对象,包含查询结果集。
+     */
+    @OperationLog(type = SysOperationLogType.ADD)
+    @GetMapping("/travelNotesViewCountAdd")
+    public ResponseResult<Void> travelNotesViewCountAdd(@RequestParam Long travelNotesId) {
+        basicToWebServicel.travelNotesViewCountAdd(travelNotesId);
+        return ResponseResult.success();
+    }
 }

+ 12 - 3
application-webadmin/src/main/java/com/tourism/webadmin/app/website/dto/TourismProjectTravelNotesToWebDto.java

@@ -17,16 +17,25 @@ import java.util.List;
 @Data
 public class TourismProjectTravelNotesToWebDto {
 
-
     /**
      * 所属分类。
-     * 当belongTab为1时,则表明为查看全部地区的
      */
     @Schema(description = "所属分类。")
-    @NotNull(message = "所属分类必传")
     private String belongTab;
 
     /**
+     * 地区id。
+     */
+    @Schema(description = "地区id。")
+    private String areaId;
+
+    /**
+     * 国家id。
+     */
+    @Schema(description = "国家id。")
+    private String countryId;
+
+    /**
      * 是否为热点项目。
      */
     @Schema(description = "是否热点,0非热点,1热点。")

+ 5 - 3
application-webadmin/src/main/java/com/tourism/webadmin/app/website/service/BasicToWebService.java

@@ -24,10 +24,12 @@ public interface BasicToWebService
 
     MyPageData<TourTourismProjectTravelNotesVo> getTravelNotesPageList(TourismProjectTravelNotesToWebDto tourismProjectTravelNotesToWebDto);
 
-    TourTourismProjectTravelNotesVo travelNotesDetail(String id);
+    TourTourismProjectTravelNotesVo travelNotesDetail(Long id);
 
-    void userLikeTravelNotesUpdate(String travelNotesId,Integer type);
+    void userLikeTravelNotesUpdate(Long travelNotesId,Integer type);
 
-    Boolean isLikeTravelNotes(String travelNotesId);
+    Boolean isLikeTravelNotes(Long travelNotesId);
+
+    void travelNotesViewCountAdd(Long travelNotesId);
 
 }

+ 31 - 25
application-webadmin/src/main/java/com/tourism/webadmin/app/website/service/impl/BasicToWebServiceImpl.java

@@ -185,27 +185,26 @@ public class BasicToWebServiceImpl implements BasicToWebService
 
         TourTourismProjectTravelNotes tourTourismProjectTravelNotes = new TourTourismProjectTravelNotes();
         Long belongTabLong = Long.parseLong(tourismProjectTravelNotesToWebDto.getBelongTab());
-        //如果查询的是全部的游记的话
-        if(belongTabLong == 1L){
+
+        if(tourismProjectTravelNotesToWebDto.getAreaId() == null && tourismProjectTravelNotesToWebDto.getCountryId() == null){
+            //判断是否为全部的地区
             tourTourismProjectTravelNotes.setEnable(1);
             tourTourismProjectTravelNotes.setBelongTab(null);
-        }else if(belongTabLong > 1000){
-            //如果>1000则表明是查询的国家
+        }else if(tourismProjectTravelNotesToWebDto.getAreaId() != null && tourismProjectTravelNotesToWebDto.getCountryId() == null){
+            //判断是否为该地区的所有国家
+            DirectoryInfo directoryInfo = new DirectoryInfo();
+            directoryInfo.setParentId(belongTabLong);
+            directoryInfo.setEnable(1);
+            List<DirectoryInfo> directoryInfoList =
+                    directoryInfoService.getDirectoryInfoList(directoryInfo, "");
+            List<Long> directoryIdList =
+                    directoryInfoList.stream().map(DirectoryInfo::getId).collect(Collectors.toList());
+            tourTourismProjectTravelNotes.setBelongTab(null);
+            tourTourismProjectTravelNotes.setDirectoryInfoIds(directoryIdList);
+        }else {
+            //如果查询的是某个国家的游记的话
             tourTourismProjectTravelNotes.setBelongTab(belongTabLong);
-
-        }else if(belongTabLong < 1000 && belongTabLong > 10){
-            //判断查询的是类似于亚洲游这种二级菜单还是下一级菜单
-                //如果<1000则表明是查询的亚洲这一级的菜单
-                DirectoryInfo directoryInfo = new DirectoryInfo();
-                directoryInfo.setParentId(belongTabLong);
-                directoryInfo.setEnable(1);
-                List<DirectoryInfo> directoryInfoList =
-                        directoryInfoService.getDirectoryInfoList(directoryInfo, "");
-                List<Long> directoryIdList =
-                        directoryInfoList.stream().map(DirectoryInfo::getId).collect(Collectors.toList());
-                tourTourismProjectTravelNotes.setBelongTab(null);
-                tourTourismProjectTravelNotes.setDirectoryInfoIds(directoryIdList);
-            }
+        }
 
         if(tourismProjectTravelNotesToWebDto.getPageNum() != null && tourismProjectTravelNotesToWebDto.getPageSize() != null) {
             PageMethod.startPage(tourismProjectTravelNotesToWebDto.getPageNum(), tourismProjectTravelNotesToWebDto.getPageSize(), true);
@@ -239,9 +238,9 @@ public class BasicToWebServiceImpl implements BasicToWebService
     }
 
     @Override
-    public TourTourismProjectTravelNotesVo travelNotesDetail(String id){
+    public TourTourismProjectTravelNotesVo travelNotesDetail(Long id){
         TourTourismProjectTravelNotes tourTourismProjectTravelNotes =
-                tourTourismProjectTravelNotesService.getByIdWithRelation(Long.parseLong(id), MyRelationParam.full());
+                tourTourismProjectTravelNotesService.getByIdWithRelation(id, MyRelationParam.full());
 
         TourTourismProjectTravelNotesVo tourTourismProjectTravelNotesVo =
                 MyModelUtil.copyTo(tourTourismProjectTravelNotes, TourTourismProjectTravelNotesVo.class);
@@ -292,13 +291,12 @@ public class BasicToWebServiceImpl implements BasicToWebService
     }
 
     @Override
-    public void userLikeTravelNotesUpdate(String travelNotesId,Integer type){
+    public void userLikeTravelNotesUpdate(Long travelNotesId,Integer type){
 
         TourUserLikeTravelNotes tourUserLikeTravelNotes =
                 new TourUserLikeTravelNotes();
-        Long travelNotesIdLong = Long.parseLong(travelNotesId);
 
-        tourUserLikeTravelNotes.setTravelNotesId(travelNotesIdLong);
+        tourUserLikeTravelNotes.setTravelNotesId(travelNotesId);
         tourUserLikeTravelNotes.setUserId(TokenData.takeFromRequest().getUserId());
 
         if(type == 0){
@@ -309,15 +307,23 @@ public class BasicToWebServiceImpl implements BasicToWebService
     }
 
     @Override
-    public Boolean isLikeTravelNotes(String travelNotesId){
+    public Boolean isLikeTravelNotes(Long travelNotesId){
 
         TourUserLikeTravelNotes tourUserLikeTravelNotes = new TourUserLikeTravelNotes();
 
-        tourUserLikeTravelNotes.setTravelNotesId(Long.parseLong(travelNotesId));
+        tourUserLikeTravelNotes.setTravelNotesId(travelNotesId);
         tourUserLikeTravelNotes.setUserId(TokenData.takeFromRequest().getUserId());
         return tourUserLikeTravelNotesService.existByFilter(tourUserLikeTravelNotes);
 
     }
 
+    @Override
+    public void travelNotesViewCountAdd(Long travelNotesId){
+
+        TourTourismProjectTravelNotes tourTourismProjectTravelNotes = tourTourismProjectTravelNotesService.getById(travelNotesId);
+        tourTourismProjectTravelNotes.setPageViewCount(tourTourismProjectTravelNotes.getPageViewCount()+1);
+
+    }
+
 }