chenchen 5 сар өмнө
parent
commit
21a08bda4c

+ 21 - 2
application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/WebsiteTourismProjectTravelNotesController.java

@@ -1,9 +1,12 @@
 package com.tourism.webadmin.app.website.controller;
 
 import cn.dev33.satoken.annotation.SaIgnore;
+import com.tourism.common.additional.utils.UrlConvertUtils;
 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.util.MyModelUtil;
+import com.tourism.common.core.util.MyPageUtil;
 import com.tourism.common.log.annotation.OperationLog;
 import com.tourism.common.log.model.constant.SysOperationLogType;
 import com.tourism.webadmin.app.website.dto.TourismProjectTravelNotesToWebDto;
@@ -13,6 +16,8 @@ import com.tourism.webadmin.app.website.vo.TourTravelNotesDirectoryVo;
 import com.tourism.webadmin.back.model.*;
 import com.tourism.webadmin.back.service.*;
 import com.tourism.webadmin.back.vo.TourTourismProjectTravelNotesVo;
+import com.tourism.webadmin.back.vo.TourismProjectVo;
+import com.tourism.webadmin.config.ApplicationConfig;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -45,6 +50,8 @@ public class WebsiteTourismProjectTravelNotesController {
     private TourismProjectService tourismProjectService;
     @Autowired
     private TourTourismProjectTravelNotesService tourTourismProjectTravelNotesService;
+    @Autowired
+    private ApplicationConfig applicationConfig;
 
 
     /**
@@ -175,7 +182,7 @@ public class WebsiteTourismProjectTravelNotesController {
      */
     @OperationLog(type = SysOperationLogType.LIST)
     @GetMapping("/relateProjectList")
-    public ResponseResult<List<TourismProject>> relateProjectList(@RequestParam(required = true) Long travelNotesId) {
+    public ResponseResult<List<TourismProjectVo>> relateProjectList(@RequestParam(required = true) Long travelNotesId) {
 
         TourTravelNotesProjectRelation tourTravelNotesProjectRelation = new TourTravelNotesProjectRelation();
         tourTravelNotesProjectRelation.setTravelNotesId(travelNotesId);
@@ -187,7 +194,19 @@ public class WebsiteTourismProjectTravelNotesController {
         if(relateProjectList.size() == 0) {
             return ResponseResult.success(new ArrayList<>());
         }else {
-            return ResponseResult.success(tourismProjectService.getInList(new HashSet<>(relateProjectList)));
+            List<TourismProject> tourismProjectList = tourismProjectService.getInList(new HashSet<>(relateProjectList));
+            List<TourismProjectVo> tourismProjectVoList = MyModelUtil.copyCollectionTo(tourismProjectList, TourismProjectVo.class);
+            //先把imgUrl由jaon转换为List<FileUrlObject>
+            tourismProjectVoList.stream().forEach(item ->
+            {
+                List<String> urlList = UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), item.getId(), item.getHomeHotPicture(), "homeHotPicture");
+                item.setHomeHotPicturesAfterConvert(urlList);
+                List<String> arrayList = UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), item.getId(), item.getTourismUrl(), "tourismUrl");
+                item.setTourismUrlsAfterConvert(arrayList);
+                List<String> arrayList1 = UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), item.getId(), item.getTravelNotesBanner(), "travelNotesBanner");
+                item.setTravelNotesBannerAfterConvert(arrayList1);
+            });
+            return ResponseResult.success(tourismProjectVoList);
         }
     }