Browse Source

[fix]
1、修改首页游记推荐列表
2、修改游记列表
3、修改游记详情接口
4、清洗原游记到新游记接口

limeng 4 months ago
parent
commit
696851c955

+ 6 - 0
application-webadmin/pom.xml

@@ -126,6 +126,12 @@
             <version>1.15</version> <!-- 请根据实际情况调整版本号 -->
         </dependency>
 
+        <dependency>
+            <groupId>org.jsoup</groupId>
+            <artifactId>jsoup</artifactId>
+            <version>1.14.3</version>
+        </dependency>
+
         <!--        <dependency>-->
 <!--            <groupId>com.anji-plus</groupId>-->
 <!--            <artifactId>spring-boot-starter-captcha</artifactId>-->

+ 103 - 35
application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/CleanDataController.java

@@ -1,37 +1,35 @@
-//package com.tourism.webadmin.app.website.controller;
-//
-//import cn.dev33.satoken.annotation.SaIgnore;
-//import com.tourism.common.core.util.MyDateUtil;
-//import com.tourism.webadmin.back.model.TourismDatePrice;
-//import com.tourism.webadmin.back.model.TourismProject;
-//import com.tourism.webadmin.back.service.TourismDatePriceService;
-//import com.tourism.webadmin.back.service.TourismProjectService;
-//import io.swagger.v3.oas.annotations.tags.Tag;
-//import lombok.extern.slf4j.Slf4j;
-//import org.apache.commons.lang3.time.DateUtils;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.web.bind.annotation.GetMapping;
-//import org.springframework.web.bind.annotation.PostMapping;
-//import org.springframework.web.bind.annotation.RequestMapping;
-//import org.springframework.web.bind.annotation.RestController;
-//import com.tourism.webadmin.app.website.service.CleanDataService;
-//
-//import java.util.ArrayList;
-//import java.util.Date;
-//import java.util.List;
-//
-///**
-// * 数据清洗接口。
-// *
-// * @author 吃饭睡觉
-// * @date 2024-09-06
-// */
-//@Tag(name = "数据清洗接口")
-//@Slf4j
-//@RestController
-//@RequestMapping("/cleanData")
-//public class CleanDataController {
-//
+package com.tourism.webadmin.app.website.controller;
+
+import cn.dev33.satoken.annotation.SaIgnore;
+import com.tourism.common.core.util.MyDateUtil;
+import com.tourism.webadmin.back.model.*;
+import com.tourism.webadmin.back.service.*;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.time.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.tourism.webadmin.app.website.service.CleanDataService;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 数据清洗接口。
+ *
+ * @author 吃饭睡觉
+ * @date 2024-09-06
+ */
+@Tag(name = "数据清洗接口")
+@Slf4j
+@RestController
+@RequestMapping("/cleanData")
+public class CleanDataController {
+
 //    @Autowired
 //    private CleanDataService cleanDataService;
 //    @Autowired
@@ -76,4 +74,74 @@
 //        });
 //
 //    }
-//}
+
+
+    @Autowired
+    private TourTourismProjectTravelNotesService tourTourismProjectTravelNotesService;
+
+    @Autowired
+    private TourTourismTravelNotesContentService tourTourismTravelNotesContentService;
+
+    @Autowired
+    private TourismProjectTravelNotesWriteService tourismProjectTravelNotesWriteService;
+
+    @Autowired
+    private TourismProjectTravelNotesWriteService writeService;
+
+    @Autowired
+    private TourismTravelNotesContentWriteService contentWriteService;
+
+    @SaIgnore
+    @GetMapping("/test")
+    public void moveData(){
+        // 查询原游记信息
+        List<TourTourismProjectTravelNotes> originNoteList = tourTourismProjectTravelNotesService.getTourTourismProjectTravelNotesList(new TourTourismProjectTravelNotes(), "");
+        // 游记主表数据写入write表
+        List<TourismProjectTravelNotesWrite> writeList = new ArrayList<>();
+        List<TourismTravelNotesContentWrite> contentList = new ArrayList<>();
+        originNoteList.forEach(e->{
+            TourismProjectTravelNotesWrite write = new TourismProjectTravelNotesWrite();
+            write.setProjectTitle(e.getProjectTitle());
+            write.setRemarks(e.getRemarks());
+            //热点
+            write.setIsHotspot(e.getIsHotspot());
+            //标签
+            write.setNoteLabel(e.getProjectLabel());
+            //目的地
+            write.setEndPlace(e.getBelongTab());
+            write.setCountTimes(e.getCountTimes());
+            write.setTourismUrl(e.getTourismUrl());
+            write.setCreateTime(e.getCreateTime());
+            write.setCreateUserId(e.getCreateUserId());
+            write.setUpdateTime(e.getUpdateTime());
+            write.setUpdateUserId(e.getUpdateUserId());
+            write.setDataState(e.getDataState());
+            write.setTravelNotesBanner(e.getTravelNotesBanner());
+            write.setLikeCount(e.getLikeCount());
+            write.setPageViewCount(e.getPageViewCount());
+            write.setRole(e.getRole());
+            write.setDepartureTime(e.getDepartureTime());
+            write.setAverageCost(e.getAverageCost());
+            write.setRecommendationRate(e.getRecommendationRate());
+            write.setHotValue(e.getHotValue());
+            write.setIsOriginal(e.getIsOriginal());
+            write.setState(2);
+            write.setUnmountState(1);
+            writeList.add(write);
+        });
+
+        List<TourTourismTravelNotesContent> originContentList = tourTourismTravelNotesContentService.getTourTourismTravelNotesContentList(new TourTourismTravelNotesContent(), "");
+        // 游记富文本数据写入write_content表
+        originContentList.forEach(e->{
+            List<TourismTravelNotesContentWrite> content = tourismProjectTravelNotesWriteService.parseHTML(e);
+            contentList.addAll(content);
+        });
+
+        log.info("清洗完了~~~");
+
+//        writeService.saveNewBatch(writeList);
+//
+//        contentWriteService.saveNewBatch(contentList);
+        // 结束
+    }
+}

+ 13 - 15
application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/WebsiteTourismProjectTravelNotesController.java

@@ -18,6 +18,7 @@ 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.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;
@@ -25,6 +26,7 @@ import com.tourism.webadmin.back.model.*;
 import com.tourism.webadmin.back.model.constant.UnmountState;
 import com.tourism.webadmin.back.service.*;
 import com.tourism.webadmin.back.vo.TourTourismProjectTravelNotesVo;
+import com.tourism.webadmin.back.vo.TourismProjectTravelNotesWriteVo;
 import com.tourism.webadmin.back.vo.TourismProjectVo;
 import com.tourism.common.additional.config.ApplicationConfig;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -72,8 +74,8 @@ public class WebsiteTourismProjectTravelNotesController {
     @OperationLog(type = SysOperationLogType.LIST)
     @GetMapping("/homeList")
     @SaIgnore
-    public ResponseResult<MyPageData<TourTourismProjectTravelNotesVo>> tourTourismTravelNotesList(TourismProjectTravelNotesToWebDto tourismProjectTravelNotesToWebDto) {
-        MyPageData<TourTourismProjectTravelNotesVo> tourTourismProjectTravelNotesList = basicToWebServicel.getTourTourismProjectTravelNotesList(tourismProjectTravelNotesToWebDto);
+    public ResponseResult<MyPageData<TourismProjectTravelNotesWriteVo>> tourTourismTravelNotesList(TourismTravelNotesWriteDto tourismTravelNotesWriteDto) {
+        MyPageData<TourismProjectTravelNotesWriteVo> tourTourismProjectTravelNotesList = basicToWebServicel.getTourTourismProjectTravelNotesList(tourismTravelNotesWriteDto);
 
         return ResponseResult.success(tourTourismProjectTravelNotesList);
     }
@@ -84,8 +86,9 @@ public class WebsiteTourismProjectTravelNotesController {
      */
     @OperationLog(type = SysOperationLogType.LIST)
     @GetMapping("/travelNotesPageList")
-    public ResponseResult<MyPageData<TourTourismProjectTravelNotesVo>> travelNotesPageList(TourismProjectTravelNotesToWebDto tourismProjectTravelNotesToWebDto) {
-        MyPageData<TourTourismProjectTravelNotesVo> tourTourismProjectTravelNotesList = basicToWebServicel.getTravelNotesPageList(tourismProjectTravelNotesToWebDto);
+    @SaIgnore
+    public ResponseResult<MyPageData<TourismProjectTravelNotesWriteVo>> travelNotesPageList(TourismTravelNotesWriteDto tourismTravelNotesWriteDto) {
+        MyPageData<TourismProjectTravelNotesWriteVo> tourTourismProjectTravelNotesList = basicToWebServicel.getTravelNotesPageList(tourismTravelNotesWriteDto);
 
         return ResponseResult.success(tourTourismProjectTravelNotesList);
     }
@@ -97,19 +100,14 @@ public class WebsiteTourismProjectTravelNotesController {
     @OperationLog(type = SysOperationLogType.LIST)
     @GetMapping("/travelNotesDetail")
     @SaIgnore
-    public ResponseResult<TourTourismProjectTravelNotesVo> travelNotesDetail(@RequestParam String id) {
+    public ResponseResult<TourismProjectTravelNotesWriteVo> travelNotesDetail(@RequestParam String id) {
 
-        TourTourismProjectTravelNotesVo tourTourismProjectTravelNotesVo = basicToWebServicel.travelNotesDetail(id);
-//        tourTourismProjectTravelNotesVo.setContactCode("[{\"name\":\"微信图片_20241021154757.png\",\"downloadUri\":\"/admin/app/tourTourismProjectTravelNotes/download\",\"filename\":\"6b92b75edcc04da1bd6e4af056911730.png\",\"uploadPath\":\"image/TourTourismProjectTravelNotes/contactCode\"}]");
-//        List<String> urlConvertList = UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), tourTourismProjectTravelNotesVo.getContactCode());
-//        if(CollectionUtils.isNotEmpty(urlConvertList)) {
-//            tourTourismProjectTravelNotesVo.setContactCodeConvert(urlConvertList.get(0));
-//        }
-//
-        if(tourTourismProjectTravelNotesVo != null) {
-            tourTourismProjectTravelNotesVo.setContactCodeConvert("https://v.xiaoyaotravel.com/image/ContactQRCode/tourism.png");
+        TourismProjectTravelNotesWriteVo vo = basicToWebServicel.travelNotesDetail(id);
+
+        if(vo != null) {
+            vo.setContactCodeConvert("https://v.xiaoyaotravel.com/image/ContactQRCode/tourism.png");
         }
-        return ResponseResult.success(tourTourismProjectTravelNotesVo);
+        return ResponseResult.success(vo);
     }
 
     /**

+ 79 - 0
application-webadmin/src/main/java/com/tourism/webadmin/app/website/dto/TourismTravelNotesWriteDto.java

@@ -0,0 +1,79 @@
+package com.tourism.webadmin.app.website.dto;
+
+import com.tourism.common.core.object.MyOrderParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 门户预定管理Dto对象。
+ *
+ * @author 吃饭睡觉
+ * @date 2024-09-06
+ */
+@Schema(description = "TourismTravelNotesWriteDto对象")
+@Data
+public class TourismTravelNotesWriteDto {
+
+    /**
+     * 所属分类。
+     */
+    @Schema(description = "所属分类。")
+    private Long belongTab;
+
+    /**
+     * 地区id。
+     */
+    @Schema(description = "地区id。")
+    private String areaId;
+
+    /**
+     * 国家id。
+     */
+    @Schema(description = "国家id。")
+    private String countryId;
+
+    /**
+     * 是否为热点项目。
+     */
+    @Schema(description = "是否热点,0非热点,1热点。")
+    private Integer isHotspot;
+
+    /**
+     * 分页号码,从1开始计数。
+     */
+    @Schema(description = "分页号码。")
+    private Integer pageNum;
+
+    /**
+     * 每页大小。
+     */
+    @Schema(description = "每页大小。")
+    private Integer pageSize;
+
+    /**
+     * 是否统计totalCount。
+     */
+    @Schema(description = "是否统计totalCount。")
+    private Boolean count;
+
+    /**
+     * 排序。
+     */
+    @Schema(description = "排序。")
+    private MyOrderParam orderParamList;
+
+    /**
+     * 菜单id。
+     */
+    private List<Long> directoryInfoIds;
+
+    /**
+     * banner_name LIKE搜索字符串。
+     * NOTE: 可支持LIKE操作符的列表数据过滤。
+     */
+    @Schema(description = "LIKE模糊搜索字符串")
+    private String searchString;
+
+}

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

@@ -3,10 +3,12 @@ package com.tourism.webadmin.app.website.service;
 import com.tourism.common.core.object.MyPageData;
 import com.tourism.common.core.object.ResponseResult;
 import com.tourism.webadmin.app.website.dto.TourismProjectTravelNotesToWebDto;
+import com.tourism.webadmin.app.website.dto.TourismTravelNotesWriteDto;
 import com.tourism.webadmin.back.model.TourTourismProjectTravelNotes;
 import com.tourism.webadmin.back.vo.BannerInfoVo;
 import com.tourism.webadmin.back.vo.DirectoryInfoVo;
 import com.tourism.webadmin.back.vo.TourTourismProjectTravelNotesVo;
+import com.tourism.webadmin.back.vo.TourismProjectTravelNotesWriteVo;
 import org.springframework.web.bind.annotation.RequestParam;
 
 /**
@@ -20,11 +22,11 @@ public interface BasicToWebService
 
     MyPageData<DirectoryInfoVo> getDirectoryInfoList(Long parentId, Integer isHotspot, Integer isAll);
 
-    MyPageData<TourTourismProjectTravelNotesVo> getTourTourismProjectTravelNotesList(TourismProjectTravelNotesToWebDto tourismProjectTravelNotesToWebDto);
+    MyPageData<TourismProjectTravelNotesWriteVo> getTourTourismProjectTravelNotesList(TourismTravelNotesWriteDto tourismTravelNotesWriteDto);
 
-    MyPageData<TourTourismProjectTravelNotesVo> getTravelNotesPageList(TourismProjectTravelNotesToWebDto tourismProjectTravelNotesToWebDto);
+    MyPageData<TourismProjectTravelNotesWriteVo> getTravelNotesPageList(TourismTravelNotesWriteDto tourismTravelNotesWriteDto);
 
-    TourTourismProjectTravelNotesVo travelNotesDetail(String id);
+    TourismProjectTravelNotesWriteVo travelNotesDetail(String id);
 
     void userLikeTravelNotesUpdate(Long travelNotesId,Integer type);
 

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

@@ -10,19 +10,15 @@ import com.tourism.common.core.object.TokenData;
 import com.tourism.common.core.util.MyModelUtil;
 import com.tourism.common.core.util.MyPageUtil;
 import com.tourism.webadmin.app.website.dto.TourismProjectTravelNotesToWebDto;
+import com.tourism.webadmin.app.website.dto.TourismTravelNotesWriteDto;
 import com.tourism.webadmin.app.website.service.BasicToWebService;
-import com.tourism.webadmin.back.model.BannerInfo;
-import com.tourism.webadmin.back.model.DirectoryInfo;
-import com.tourism.webadmin.back.model.TourTourismProjectTravelNotes;
-import com.tourism.webadmin.back.model.TourUserLikeTravelNotes;
-import com.tourism.webadmin.back.service.BannerInfoService;
-import com.tourism.webadmin.back.service.DirectoryInfoService;
-import com.tourism.webadmin.back.service.TourTourismProjectTravelNotesService;
-import com.tourism.webadmin.back.service.TourUserLikeTravelNotesService;
+import com.tourism.webadmin.back.model.*;
+import com.tourism.webadmin.back.service.*;
 import com.tourism.webadmin.back.vo.BannerInfoVo;
 import com.tourism.webadmin.back.vo.DirectoryInfoVo;
 import com.tourism.webadmin.back.vo.TourTourismProjectTravelNotesVo;
 import com.tourism.common.additional.config.ApplicationConfig;
+import com.tourism.webadmin.back.vo.TourismProjectTravelNotesWriteVo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -53,6 +49,9 @@ public class BasicToWebServiceImpl implements BasicToWebService
     @Autowired
     private TourUserLikeTravelNotesService tourUserLikeTravelNotesService;
 
+    @Autowired
+    private TourismProjectTravelNotesWriteService tourismProjectTravelNotesWriteService;
+
     @Override
     public MyPageData<BannerInfoVo> getBannerInfoList(Long belongTab) {
         BannerInfo bannerInfoFilter = new BannerInfo();
@@ -127,32 +126,36 @@ public class BasicToWebServiceImpl implements BasicToWebService
     }
 
     @Override
-    public MyPageData<TourTourismProjectTravelNotesVo> getTourTourismProjectTravelNotesList(TourismProjectTravelNotesToWebDto tourismProjectTravelNotesToWebDto){
-
-        TourTourismProjectTravelNotes tourTourismProjectTravelNotesFilter = new TourTourismProjectTravelNotes();
-        tourTourismProjectTravelNotesFilter.setEnable(1);
-        tourTourismProjectTravelNotesFilter.setIsHotspot(1);
-        if(tourismProjectTravelNotesToWebDto.getPageNum() != null && tourismProjectTravelNotesToWebDto.getPageSize() != null) {
-            PageMethod.startPage(tourismProjectTravelNotesToWebDto.getPageNum(), tourismProjectTravelNotesToWebDto.getPageSize(), true);
+    public MyPageData<TourismProjectTravelNotesWriteVo> getTourTourismProjectTravelNotesList(TourismTravelNotesWriteDto tourismTravelNotesWriteDto){
+
+        TourismProjectTravelNotesWrite tourismProjectTravelNotesWriteFilter = new TourismProjectTravelNotesWrite();
+        tourismProjectTravelNotesWriteFilter.setUnmountState(1);
+        tourismProjectTravelNotesWriteFilter.setIsHotspot(1);
+//        TourTourismProjectTravelNotes tourTourismProjectTravelNotesFilter = new TourTourismProjectTravelNotes();
+//        tourTourismProjectTravelNotesFilter.setEnable(1);
+//        tourTourismProjectTravelNotesFilter.setIsHotspot(1);
+        if(tourismTravelNotesWriteDto.getPageNum() != null && tourismTravelNotesWriteDto.getPageSize() != null) {
+            PageMethod.startPage(tourismTravelNotesWriteDto.getPageNum(), tourismTravelNotesWriteDto.getPageSize(), true);
         }
         MyOrderParam myOrderParam = new MyOrderParam();
         myOrderParam.add(new MyOrderParam.OrderInfo("showOrder",true,null));
         myOrderParam.add(new MyOrderParam.OrderInfo("updateTime",false,null));
         String orderBy = MyOrderParam.buildOrderBy(myOrderParam, TourTourismProjectTravelNotes.class);
-        List<TourTourismProjectTravelNotes> tourTourismProjectTravelNotesList = tourTourismProjectTravelNotesService.getTourTourismProjectTravelNotesList(tourTourismProjectTravelNotesFilter, orderBy);
-        MyPageData<TourTourismProjectTravelNotesVo> tourTourismProjectTravelNotesVoMyPageData = MyPageUtil.makeResponseData(tourTourismProjectTravelNotesList, TourTourismProjectTravelNotesVo.class);
-        List<TourTourismProjectTravelNotesVo> dataList = tourTourismProjectTravelNotesVoMyPageData.getDataList();
+        List<TourismProjectTravelNotesWrite> writeList = tourismProjectTravelNotesWriteService.getTourismProjectTravelNotesWriteList(tourismProjectTravelNotesWriteFilter, orderBy);
+//        List<TourTourismProjectTravelNotes> tourTourismProjectTravelNotesList = tourTourismProjectTravelNotesService.getTourTourismProjectTravelNotesList(tourismProjectTravelNotesWriteFilter, orderBy);
+        MyPageData<TourismProjectTravelNotesWriteVo> pageData = MyPageUtil.makeResponseData(writeList, TourismProjectTravelNotesWriteVo.class);
+        List<TourismProjectTravelNotesWriteVo> dataList = pageData.getDataList();
         dataList.stream().forEach(item->{
-            if (StringUtils.isNotEmpty(item.getHomeHotPicture())) {
-                item.setHomeHotPicturesAfterConvert(UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), item.getHomeHotPicture()));
+            if (StringUtils.isNotEmpty(item.getTourismUrl())) {
+                item.setHomeHotPicturesAfterConvert(UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), item.getTourismUrl()));
             }
         });
 
-        return tourTourismProjectTravelNotesVoMyPageData;
+        return pageData;
     }
 
     @Override
-    public MyPageData<TourTourismProjectTravelNotesVo> getTravelNotesPageList(TourismProjectTravelNotesToWebDto tourismProjectTravelNotesToWebDto){
+    public MyPageData<TourismProjectTravelNotesWriteVo> getTravelNotesPageList(TourismTravelNotesWriteDto dto){
         //当belongTab为1的时候,则表明查询全部的游记
         MyOrderParam myOrderParam = new MyOrderParam();
         myOrderParam.add(new MyOrderParam.OrderInfo("isHotspot",false,null));
@@ -160,41 +163,44 @@ public class BasicToWebServiceImpl implements BasicToWebService
         myOrderParam.add(new MyOrderParam.OrderInfo("updateTime",false,null));
         String orderBy = MyOrderParam.buildOrderBy(myOrderParam, TourTourismProjectTravelNotes.class);
 
-        TourTourismProjectTravelNotes tourTourismProjectTravelNotes = new TourTourismProjectTravelNotes();
+        TourismProjectTravelNotesWrite tourismProjectTravelNotesWriteFilter = new TourismProjectTravelNotesWrite();
+//        TourTourismProjectTravelNotes tourTourismProjectTravelNotes = new TourTourismProjectTravelNotes();
 
-        if(StringUtils.isEmpty(tourismProjectTravelNotesToWebDto.getAreaId()) && StringUtils.isEmpty(tourismProjectTravelNotesToWebDto.getCountryId())){
+        if(StringUtils.isEmpty(dto.getAreaId()) && StringUtils.isEmpty(dto.getCountryId())){
             //判断是否为全部的地区
-            tourTourismProjectTravelNotes.setEnable(1);
-            tourTourismProjectTravelNotes.setBelongTab(null);
-        }else if(StringUtils.isNotEmpty(tourismProjectTravelNotesToWebDto.getAreaId()) && StringUtils.isEmpty(tourismProjectTravelNotesToWebDto.getCountryId())){
+            tourismProjectTravelNotesWriteFilter.setUnmountState(1);
+            tourismProjectTravelNotesWriteFilter.setEndPlace(null);
+        }else if(StringUtils.isNotEmpty(dto.getAreaId()) && StringUtils.isEmpty(dto.getCountryId())){
             //判断是否为该地区的所有国家
             DirectoryInfo directoryInfo = new DirectoryInfo();
-            directoryInfo.setParentId(Long.parseLong(tourismProjectTravelNotesToWebDto.getAreaId()));
+            directoryInfo.setParentId(Long.parseLong(dto.getAreaId()));
             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);
+            tourismProjectTravelNotesWriteFilter.setEndPlace(null);
+            tourismProjectTravelNotesWriteFilter.setDirectoryInfoIds(directoryIdList);
         }else {
             //如果查询的是某个国家的游记的话
-            if(StringUtils.isNotEmpty(tourismProjectTravelNotesToWebDto.getCountryId())) {
-                tourTourismProjectTravelNotes.setBelongTab(Long.parseLong(tourismProjectTravelNotesToWebDto.getCountryId()));
+            if(StringUtils.isNotEmpty(dto.getCountryId())) {
+                tourismProjectTravelNotesWriteFilter.setEndPlace(Long.parseLong(dto.getCountryId()));
             }
         }
 
-        if(tourismProjectTravelNotesToWebDto.getPageNum() != null && tourismProjectTravelNotesToWebDto.getPageSize() != null) {
-            PageMethod.startPage(tourismProjectTravelNotesToWebDto.getPageNum(), tourismProjectTravelNotesToWebDto.getPageSize(), true);
+        if(dto.getPageNum() != null && dto.getPageSize() != null) {
+            PageMethod.startPage(dto.getPageNum(), dto.getPageSize(), true);
         }
 
-        List<TourTourismProjectTravelNotes> tourTourismProjectTravelNotesList =
-                tourTourismProjectTravelNotesService.getTourTourismProjectTravelNotesList(tourTourismProjectTravelNotes, orderBy);
+//        List<TourTourismProjectTravelNotes> tourTourismProjectTravelNotesList =
+//                tourTourismProjectTravelNotesService.getTourTourismProjectTravelNotesList(tourismProjectTravelNotesWriteFilter, orderBy);
+        List<TourismProjectTravelNotesWrite> writeList =
+                tourismProjectTravelNotesWriteService.getTourismProjectTravelNotesWriteList(tourismProjectTravelNotesWriteFilter, orderBy);
 
-        MyPageData<TourTourismProjectTravelNotesVo> tourTourismProjectTravelNotesVoMyPageData =
-                MyPageUtil.makeResponseData(tourTourismProjectTravelNotesList, TourTourismProjectTravelNotesVo.class);
+        MyPageData<TourismProjectTravelNotesWriteVo> pageData =
+                MyPageUtil.makeResponseData(writeList, TourismProjectTravelNotesWriteVo.class);
 
-        List<TourTourismProjectTravelNotesVo> dataList = tourTourismProjectTravelNotesVoMyPageData.getDataList();
+        List<TourismProjectTravelNotesWriteVo> dataList = pageData.getDataList();
 
         dataList.stream().forEach(item->{
             if(StringUtils.isNotEmpty(item.getTourismUrl())){
@@ -202,31 +208,30 @@ public class BasicToWebServiceImpl implements BasicToWebService
             }
         });
 
-        return tourTourismProjectTravelNotesVoMyPageData;
+        return pageData;
     }
 
     @Override
-    public TourTourismProjectTravelNotesVo travelNotesDetail(String id){
-        TourTourismProjectTravelNotes tourTourismProjectTravelNotes =
-                tourTourismProjectTravelNotesService.getByIdWithRelation(id, MyRelationParam.full());
+    public TourismProjectTravelNotesWriteVo travelNotesDetail(String id){
+        TourismProjectTravelNotesWrite writeDto = tourismProjectTravelNotesWriteService.getByIdWithRelation(Long.parseLong(id), MyRelationParam.full());
 
-        TourTourismProjectTravelNotesVo tourTourismProjectTravelNotesVo =
-                MyModelUtil.copyTo(tourTourismProjectTravelNotes, TourTourismProjectTravelNotesVo.class);
+        TourismProjectTravelNotesWriteVo writeVo =
+                MyModelUtil.copyTo(writeDto, TourismProjectTravelNotesWriteVo.class);
 
-        if(tourTourismProjectTravelNotesVo != null) {
-            if (StringUtils.isNotEmpty(tourTourismProjectTravelNotesVo.getTourismUrl())) {
-                tourTourismProjectTravelNotesVo.setTourismUrlsAfterConvert(UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), tourTourismProjectTravelNotesVo.getTourismUrl()));
+        if(writeVo != null) {
+            if (StringUtils.isNotEmpty(writeVo.getTourismUrl())) {
+                writeVo.setTourismUrlsAfterConvert(UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), writeVo.getTourismUrl()));
             }
 
-            if (StringUtils.isNotEmpty(tourTourismProjectTravelNotesVo.getHomeHotPicture())) {
-                tourTourismProjectTravelNotesVo.setHomeHotPicturesAfterConvert(UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), tourTourismProjectTravelNotesVo.getHomeHotPicture()));
+            if (StringUtils.isNotEmpty(writeVo.getTourismUrl())) {
+                writeVo.setHomeHotPicturesAfterConvert(UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), writeVo.getTourismUrl()));
             }
 
-            if (StringUtils.isNotEmpty(tourTourismProjectTravelNotesVo.getTravelNotesBanner())) {
-                tourTourismProjectTravelNotesVo.setTravelNotesBannerAfterConvert(UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), tourTourismProjectTravelNotesVo.getTravelNotesBanner()));
+            if (StringUtils.isNotEmpty(writeVo.getTravelNotesBanner())) {
+                writeVo.setTravelNotesBannerAfterConvert(UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), writeVo.getTravelNotesBanner()));
             }
         }
-        return tourTourismProjectTravelNotesVo;
+        return writeVo;
     }
 
     @Override

+ 13 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/dao/mapper/TourismProjectTravelNotesWriteMapper.xml

@@ -153,6 +153,19 @@
                 <bind name = "safeTourismProjectTravelNotesWriteSearchString" value = "'%' + tourismProjectTravelNotesWriteFilter.searchString + '%'" />
                 AND CONCAT(IFNULL(tour_tourism_project_travel_notes_writer.project_title,''), IFNULL(tour_tourism_project_travel_notes_writer.count_times,''), IFNULL(tour_tourism_project_travel_notes_writer.role,''), IFNULL(tour_tourism_project_travel_notes_writer.average_cost,''), IFNULL(tour_tourism_project_travel_notes_writer.reason,'')) LIKE #{safeTourismProjectTravelNotesWriteSearchString}
             </if>
+
+            <if test="tourismProjectTravelNotesWriteFilter.unmountState != null and tourismProjectTravelNotesWriteFilter.unmountState != ''">
+                AND tour_tourism_project_travel_notes_writer.unmount_state = #{tourismProjectTravelNotesWriteFilter.unmountState}
+            </if>
+            <if test="tourismProjectTravelNotesWriteFilter.directoryInfoIds != null and tourismProjectTravelNotesWriteFilter.directoryInfoIds.size() > 0">
+                AND tour_tourism_project_travel_notes_writer.end_place IN
+                <foreach item="id" index="index" collection="tourismProjectTravelNotesWriteFilter.directoryInfoIds" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="tourismProjectTravelNotesWriteFilter.createUserId != null">
+                AND tour_tourism_project_travel_notes.create_user_id = #{tourismProjectTravelNotesWriteFilter.createUserId}
+            </if>
         </if>
     </sql>
 

+ 5 - 3
application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourismProjectTravelNotesWrite.java

@@ -9,8 +9,7 @@ import com.tourism.common.core.base.model.BaseModel;
 import com.tourism.webadmin.back.model.constant.Hotspot;
 import com.tourism.webadmin.back.model.constant.IsOriginal;
 import com.tourism.webadmin.back.model.constant.UnmountState;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
+import lombok.*;
 
 import java.util.Date;
 import java.util.List;
@@ -31,7 +30,7 @@ public class TourismProjectTravelNotesWrite extends BaseModel {
      * 主键id。
      */
     @TableId(value = "id")
-    private Long id;
+    private String id;
 
     /**
      * 项目标题。
@@ -235,4 +234,7 @@ public class TourismProjectTravelNotesWrite extends BaseModel {
             constantDictClass = IsOriginal.class)
     @TableField(exist = false)
     private Map<String, Object> isOriginalDictMap;
+
+    @TableField(exist = false)
+    private List<Long> directoryInfoIds;
 }

+ 3 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/service/TourismProjectTravelNotesWriteService.java

@@ -1,6 +1,7 @@
 package com.tourism.webadmin.back.service;
 
 import com.alibaba.fastjson.JSONObject;
+import com.tourism.webadmin.app.website.vo.TravelNotesWriteDTO;
 import com.tourism.webadmin.back.model.*;
 import com.tourism.common.core.base.service.IBaseService;
 
@@ -85,4 +86,6 @@ public interface TourismProjectTravelNotesWriteService extends IBaseService<Tour
      * @return 查询结果集。
      */
     List<TourismProjectTravelNotesWrite> getTourismProjectTravelNotesWriteListWithRelation(TourismProjectTravelNotesWrite filter, String orderBy);
+
+    List<TourismTravelNotesContentWrite> parseHTML(TourTourismTravelNotesContent entity);
 }

+ 71 - 3
application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/TourismProjectTravelNotesWriteServiceImpl.java

@@ -3,6 +3,7 @@ package com.tourism.webadmin.back.service.impl;
 import cn.hutool.core.collection.CollUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.tourism.webadmin.app.website.vo.TravelNotesWriteDTO;
 import com.tourism.webadmin.back.model.constant.AuditState;
 import com.tourism.webadmin.back.service.*;
 import com.tourism.webadmin.back.dao.*;
@@ -17,6 +18,10 @@ import com.tourism.common.core.util.MyModelUtil;
 import com.tourism.common.sequence.wrapper.IdGeneratorWrapper;
 import com.github.pagehelper.Page;
 import lombok.extern.slf4j.Slf4j;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -79,7 +84,7 @@ public class TourismProjectTravelNotesWriteServiceImpl extends BaseService<Touri
     public boolean update(TourismProjectTravelNotesWrite tourismProjectTravelNotesWrite, TourismProjectTravelNotesWrite originalTourismProjectTravelNotesWrite) {
         MyModelUtil.fillCommonsForUpdate(tourismProjectTravelNotesWrite, originalTourismProjectTravelNotesWrite);
         // 这里重点提示,在执行主表数据更新之前,如果有哪些字段不支持修改操作,请用原有数据对象字段替换当前数据字段。
-        UpdateWrapper<TourismProjectTravelNotesWrite> uw = this.createUpdateQueryForNullValue(tourismProjectTravelNotesWrite, tourismProjectTravelNotesWrite.getId());
+        UpdateWrapper<TourismProjectTravelNotesWrite> uw = this.createUpdateQueryForNullValue(tourismProjectTravelNotesWrite, Long.parseLong(tourismProjectTravelNotesWrite.getId()));
         return tourismProjectTravelNotesWriteMapper.update(tourismProjectTravelNotesWrite, uw) == 1;
     }
 
@@ -99,7 +104,7 @@ public class TourismProjectTravelNotesWriteServiceImpl extends BaseService<Touri
         // 对于一对一新增或更新,如果主键值为空就新增,否则就更新,同时更新updateTime和updateUserId。
         TourismTravelNotesContentWrite tourismTravelNotesContentWrite = relationData.getObject("tourismTravelNotesContentWrite", TourismTravelNotesContentWrite.class);
         if (tourismTravelNotesContentWrite != null) {
-            tourismTravelNotesContentWrite.setAssociationId(tourismProjectTravelNotesWrite.getId());
+            tourismTravelNotesContentWrite.setAssociationId(Long.parseLong(tourismProjectTravelNotesWrite.getId()));
             tourismTravelNotesContentWriteService.saveNewOrUpdate(tourismTravelNotesContentWrite,
                     tourismTravelNotesContentWriteService::saveNew, tourismTravelNotesContentWriteService::update);
         }
@@ -130,9 +135,72 @@ public class TourismProjectTravelNotesWriteServiceImpl extends BaseService<Touri
         return resultList;
     }
 
+    @Override
+    public List<TourismTravelNotesContentWrite> parseHTML(TourTourismTravelNotesContent entity) {
+        List<TourismTravelNotesContentWrite> notes = new ArrayList<>();
+        Document doc = Jsoup.parse(entity.getContent());
+
+        // 获取所有的<p>标签
+        Elements paragraphs = doc.select("p");
+
+        for (Element p : paragraphs) {
+            TourismTravelNotesContentWrite content = new TourismTravelNotesContentWrite();
+
+            content.setAssociationId(Long.parseLong(entity.getAssociationId()));
+            content.setCreateUserId(entity.getCreateUserId());
+            content.setCreateTime(entity.getCreateTime());
+            content.setUpdateTime(entity.getUpdateTime());
+            content.setUpdateUserId(entity.getUpdateUserId());
+            content.setDataState(entity.getDataState());
+
+            // 提取文本内容
+            String textContent = p.text();
+            if (!textContent.trim().isEmpty()) {
+                content.setType("sectionContent");
+                content.setContent(textContent);
+            }
+
+            // 提取图片URL
+            Element img = p.selectFirst("img");
+            if (img != null) {
+                content.setType("image");
+                String imageUrl = img.attr("src");
+                content.setContent(imageUrl);
+            }
+            notes.add(content);
+        }
+
+        return notes;
+
+        // 获取所有的段落元素
+//        Elements paragraphs = doc.select("p:not(:has(img))");
+//        for (Element p : paragraphs) {
+//            TravelNotesWriteDTO note = new TravelNotesWriteDTO();
+//            note.setSectionContent(p.text());
+//            notes.add(note);
+//        }
+//
+//        // 获取所有的图片元素
+//        Elements images = doc.select("p:has(img) img");
+//        for (Element img : images) {
+//            if (!notes.isEmpty()) {
+//                // 假设每张图片都紧随其前一段文字之后
+//                TravelNotesWriteDTO lastNote = notes.get(notes.size() - 1);
+//                lastNote.setImage(img.attr("src"));
+//            } else {
+//                // 如果没有前一段文字,则创建一个新的笔记对象
+//                TravelNotesWriteDTO note = new TravelNotesWriteDTO();
+//                note.setImage(img.attr("src"));
+//                notes.add(note);
+//            }
+//        }
+
+//        return notes;
+    }
+
     private TourismProjectTravelNotesWrite buildDefaultValue(TourismProjectTravelNotesWrite tourismProjectTravelNotesWrite) {
         if (tourismProjectTravelNotesWrite.getId() == null) {
-            tourismProjectTravelNotesWrite.setId(idGenerator.nextLongId());
+            tourismProjectTravelNotesWrite.setId(String.valueOf(idGenerator.nextLongId()));
         }
         MyModelUtil.fillCommonsForInsert(tourismProjectTravelNotesWrite);
         tourismProjectTravelNotesWrite.setDataState(GlobalDeletedFlag.NORMAL);

+ 12 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourismProjectTravelNotesWriteVo.java

@@ -176,4 +176,16 @@ public class TourismProjectTravelNotesWriteVo extends BaseVo {
      */
     @Schema(description = "isOriginal 常量字典关联数据")
     private Map<String, Object> isOriginalDictMap;
+
+    @Schema(description = "热门图url转换")
+    private List<String> homeHotPicturesAfterConvert;
+
+    @Schema(description = "游记列表图url转换")
+    private List<String> tourismUrlsAfterConvert;
+
+    @Schema(description = "联系人图片")
+    private String contactCodeConvert;
+
+    @Schema(description = "联系人图片")
+    private List<String> travelNotesBannerAfterConvert;
 }