Jelajahi Sumber

[fix]
完善写游记页面相关的逻辑

chenchen 1 bulan lalu
induk
melakukan
ce8924ecaa

+ 24 - 6
application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/WebSiteTourismTravelNotesPublishController.java

@@ -11,7 +11,6 @@ import com.tourism.common.core.util.MyCommonUtil;
 import com.tourism.common.core.util.MyModelUtil;
 import com.tourism.common.core.util.MyPageUtil;
 import com.tourism.common.core.validator.UpdateGroup;
-import com.tourism.common.huaweicloud.moderation.service.HuaweiCloudModerationService;
 import com.tourism.common.huaweicloud.obs.util.MergeAvatarsFlexUtils;
 import com.tourism.common.log.annotation.OperationLog;
 import com.tourism.common.log.model.constant.SysOperationLogType;
@@ -27,6 +26,7 @@ import com.tourism.webadmin.back.model.*;
 import com.tourism.webadmin.back.model.constant.AuditState;
 import com.tourism.webadmin.back.model.constant.UnmountState;
 import com.tourism.webadmin.back.service.*;
+import com.tourism.webadmin.back.vo.TourTravelNotesMentionUserVo;
 import com.tourism.webadmin.back.vo.TourismProjectTravelNotesWriteVo;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
@@ -50,16 +50,12 @@ public class WebSiteTourismTravelNotesPublishController {
     @Autowired
     private TourismProjectTravelNotesWriteService tourismProjectTravelNotesWriteService;
     @Autowired
-    private TourismTravelNotesContentWriteService tourismTravelNotesContentWriteService;
-    @Autowired
     private TourTourismProjectTravelNotesService tourTourismProjectTravelNotesService;
     @Autowired
     private TourUserService tourUserService;
     @Autowired
     private DirectoryInfoService directoryInfoService;
     @Autowired
-    private HuaweiCloudModerationService huaweiCloudModerationService;
-    @Autowired
     private ApplicationConfig applicationConfig;
     @Autowired
     private TourFansService tourFansService;
@@ -73,6 +69,12 @@ public class WebSiteTourismTravelNotesPublishController {
     private MergeAvatarsFlexUtils mergeAvatarsFlexUtils;
     @Autowired
     private TourTravelNotesPublishService tourTravelNotesPublishService;
+    @Autowired
+    private TourTravelNotesImgService tourTravelNotesImgService;
+    @Autowired
+    private TourTravelNotesTopicRelationService tourTravelNotesTopicRelationService;
+    @Autowired
+    private TourTravelNotesMentionUserService tourTravelNotesMentionUserService;
 
     /**
      * 获取草稿id
@@ -163,8 +165,24 @@ public class WebSiteTourismTravelNotesPublishController {
         TourismProjectTravelNotesWriteVo tourismProjectTravelNotesWriteVo = MyModelUtil.copyTo(tourismProjectTravelNotesWrite, TourismProjectTravelNotesWriteVo.class);
 
         //填充图片
-
+        TourTravelNotesImg tourTravelNotesImg = new TourTravelNotesImg();
+        tourTravelNotesImg.setTravelNotesId(tourismProjectTravelNotesWrite.getId());
+        List<TourTravelNotesImg> tourTravelNotesImgList = tourTravelNotesImgService.getTourTravelNotesImgList(tourTravelNotesImg, "");
+        List<String> imgUrlList = tourTravelNotesImgList.stream().map(TourTravelNotesImg::getImgUrl).collect(Collectors.toList());
+        tourismProjectTravelNotesWriteVo.setImgUrls(imgUrlList);
         //填充关联话题
+        TourTravelNotesTopicRelation tourTravelNotesTopicRelation = new TourTravelNotesTopicRelation();
+        tourTravelNotesTopicRelation.setTravelNotesId(tourismProjectTravelNotesWrite.getId());
+        List<TourTravelNotesTopicRelation> tourTravelNotesTopicRelationList =
+                tourTravelNotesTopicRelationService.getTourTravelNotesTopicRelationList(tourTravelNotesTopicRelation, "");
+        List<String> topicNameList = tourTravelNotesTopicRelationList.stream().map(TourTravelNotesTopicRelation::getTopicName).collect(Collectors.toList());
+        tourismProjectTravelNotesWriteVo.setTopics(topicNameList);
+        //填充提及的用户
+        TourTravelNotesMentionUser tourTravelNotesMentionUser = new TourTravelNotesMentionUser();
+        tourTravelNotesMentionUser.setTravelNotesId(tourismProjectTravelNotesWrite.getId());
+        List<TourTravelNotesMentionUser> tourTravelNotesMentionUserList = tourTravelNotesMentionUserService.getTourTravelNotesMentionUserList(tourTravelNotesMentionUser, "");
+        List<TourTravelNotesMentionUserVo> tourTravelNotesMentionUserVo = MyModelUtil.copyCollectionTo(tourTravelNotesMentionUserList, TourTravelNotesMentionUserVo.class);
+        tourismProjectTravelNotesWriteVo.setMentions(tourTravelNotesMentionUserVo);
         //填充关联用户
         return ResponseResult.success(tourismProjectTravelNotesWriteVo);
     }

+ 2 - 2
application-webadmin/src/main/java/com/tourism/webadmin/app/website/dto/TourismProjectTravelNotesWriteToWebDto.java

@@ -246,9 +246,9 @@ public class TourismProjectTravelNotesWriteToWebDto {
     private List<TourTravelNotesMentionUserDto> mentions;
 
     /**
-     * 游记内容提及的用户信息
+     * 游记内容提及的话题名称
      */
-    @Schema(description = "游记内容提及的用户信息。")
+    @Schema(description = "游记内容提及的话题名称。")
     private List<String> topics;
 
     /**

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

@@ -167,6 +167,10 @@ public class TourTravelNotesPublishServiceImpl implements TourTravelNotesPublish
         TourTravelNotesTopicRelation tourTravelNotesTopicRelation = new TourTravelNotesTopicRelation();
         tourTravelNotesTopicRelation.setTravelNotesId(Long.valueOf(writeId));
         tourTravelNotesTopicRelationService.removeBy(tourTravelNotesTopicRelation);
+        //删除游记中的图片信息
+        TourTravelNotesImg tourTravelNotesImg = new TourTravelNotesImg();
+        tourTravelNotesImg.setTravelNotesId(Long.valueOf(writeId));
+        tourTravelNotesImgService.removeBy(tourTravelNotesImg);
     }
 
     @Override

+ 1 - 1
application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourTravelNotesMentionUserVo.java

@@ -35,5 +35,5 @@ public class TourTravelNotesMentionUserVo {
      * 写游记提到的用户id。
      */
     @Schema(description = "写游记提到的用户id")
-    private Long userId;
+    private String userId;
 }

+ 14 - 1
application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourismProjectTravelNotesWriteVo.java

@@ -1,6 +1,7 @@
 package com.tourism.webadmin.back.vo;
 
 import com.tourism.common.core.base.vo.BaseVo;
+import com.tourism.webadmin.back.dto.TourTravelNotesMentionUserDto;
 import com.tourism.webadmin.back.model.TourImGroup;
 import com.tourism.webadmin.back.model.TourTravelNotesTopicRelation;
 import com.tourism.webadmin.back.model.TourismTravelNotesContentWrite;
@@ -262,5 +263,17 @@ public class TourismProjectTravelNotesWriteVo extends BaseVo {
      * 多张图片路径。
      */
     @Schema(description = "多张图片路径")
-    private List<String> tourTravelNotesImg;
+    private List<String> imgUrls;
+
+    /**
+     * 游记内容提及的话题名称。
+     */
+    @Schema(description = "游记内容提及的话题名称。")
+    private List<String> topics;
+
+    /**
+     * 游记内容提及的用户信息。
+     */
+    @Schema(description = "游记内容提及的用户信息。")
+    private List<TourTravelNotesMentionUserVo> mentions;
 }