Quellcode durchsuchen

[fix]
1、解决初步测试出现的报错问题-浏览量没有增加

chenchen vor 4 Monaten
Ursprung
Commit
a4696553a2

+ 11 - 0
application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/WebsiteTourismProjectTravelNotesController.java

@@ -21,6 +21,7 @@ import com.tourism.webadmin.app.website.dto.TourismTravelNotesWriteDto;
 import com.tourism.webadmin.app.website.service.BasicToWebService;
 import com.tourism.webadmin.app.website.vo.TourTravelNotesDirectoryCountryVo;
 import com.tourism.webadmin.app.website.vo.TourTravelNotesDirectoryVo;
+import com.tourism.webadmin.app.website.vo.TourismProjectTravelNotesWriteCovertVo;
 import com.tourism.webadmin.back.model.*;
 import com.tourism.webadmin.back.model.constant.UnmountState;
 import com.tourism.webadmin.back.service.*;
@@ -28,6 +29,7 @@ import com.tourism.webadmin.back.vo.TourismProjectTravelNotesWriteVo;
 import com.tourism.webadmin.back.vo.TourismProjectVo;
 import io.swagger.v3.oas.annotations.tags.Tag;
 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.*;
@@ -173,6 +175,14 @@ public class WebsiteTourismProjectTravelNotesController {
         }
         List<TourismProjectTravelNotesWrite> tourUserLikeTravelNotesList = tourUserLikeTravelNotesService.getTourUserLikeTravelNotesWithRelationWriteList(filter, UnmountState.LISTING, orderBy);
 
+        MyPageData<TourismProjectTravelNotesWriteVo> tourismProjectTravelNotesWriteVoMyPageData = MyPageUtil.makeResponseData(tourUserLikeTravelNotesList, TourismProjectTravelNotesWriteVo.class);
+        List<TourismProjectTravelNotesWriteVo> dataList = tourismProjectTravelNotesWriteVoMyPageData.getDataList();
+        if(CollectionUtils.isNotEmpty(dataList)){
+            dataList.stream().forEach(item->{
+                item.setTourismUrlsAfterConvert(UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), item.getTourismUrl()));
+            });
+        }
+
         return ResponseResult.success(MyPageUtil.makeResponseData(tourUserLikeTravelNotesList));
     }
 
@@ -182,6 +192,7 @@ public class WebsiteTourismProjectTravelNotesController {
      * param travelNotesId 游记id
      * @return 应答结果对象,包含查询结果集。
      */
+    @SaIgnore
     @OperationLog(type = SysOperationLogType.ADD)
     @GetMapping("/travelNotesViewCountAdd")
     public ResponseResult<Void> travelNotesViewCountAdd(@RequestParam Long travelNotesId) {

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

@@ -211,6 +211,18 @@ public class BasicToWebServiceImpl implements BasicToWebService
     @Override
     public TourismProjectTravelNotesWriteVo travelNotesDetail(String id){
         TourismProjectTravelNotesWrite writeDto = tourismProjectTravelNotesWriteService.getByIdWithRelation(Long.parseLong(id), MyRelationParam.full());
+        if(writeDto.getPageViewCount() != null) {
+            writeDto.setPageViewCount(writeDto.getPageViewCount() + 1);
+        }else {
+            writeDto.setPageViewCount(1);
+        }
+        //每有一人浏览,则增加50热度值
+        if(writeDto.getHotValue() != null) {
+            writeDto.setHotValue(writeDto.getHotValue() + 50);
+        }else {
+            writeDto.setHotValue(50);
+        }
+        tourismProjectTravelNotesWriteService.updateById(writeDto);
 
         TourismProjectTravelNotesWriteVo writeVo =
                 MyModelUtil.copyTo(writeDto, TourismProjectTravelNotesWriteVo.class);