Browse Source

[fix]
1、游记表增加是否原创的字段,用来区分游记是否为原创

chenchen 5 months ago
parent
commit
5416f49daa

+ 28 - 5
application-webadmin/src/main/java/com/tourism/webadmin/back/controller/ExtraController.java

@@ -1,27 +1,26 @@
 package com.tourism.webadmin.back.controller;
 
-import ch.qos.logback.core.joran.sanity.Pair;
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import com.tourism.common.core.annotation.MyRequestBody;
 import com.tourism.common.core.constant.ErrorCodeEnum;
 import com.tourism.common.core.object.MyOrderParam;
-import com.tourism.common.core.object.MyRelationParam;
 import com.tourism.common.core.object.ResponseResult;
 import com.tourism.common.core.util.MyDateUtil;
 import com.tourism.common.core.util.MyModelUtil;
 import com.tourism.webadmin.app.website.dto.DatePriceSaveDto;
 import com.tourism.webadmin.app.website.vo.DateRangePriceVo;
 import com.tourism.webadmin.app.website.vo.DateRangesPriceVo;
+import com.tourism.webadmin.back.dto.TourTourismProjectTravelNotesDto;
 import com.tourism.webadmin.back.dto.TourismProjectDto;
+import com.tourism.webadmin.back.model.TourTourismProjectTravelNotes;
 import com.tourism.webadmin.back.model.TourismDatePrice;
 import com.tourism.webadmin.back.model.TourismProject;
+import com.tourism.webadmin.back.service.TourTourismProjectTravelNotesService;
 import com.tourism.webadmin.back.service.TourismDatePriceService;
 import com.tourism.webadmin.back.service.TourismProjectService;
-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.apache.commons.lang3.time.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
@@ -30,7 +29,6 @@ import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.ZoneId;
 import java.util.ArrayList;
-import java.util.Comparator;
 import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -51,6 +49,8 @@ public class ExtraController {
     private TourismDatePriceService tourismDatePriceService;
     @Autowired
     private TourismProjectService tourismProjectService;
+    @Autowired
+    private TourTourismProjectTravelNotesService tourTourismProjectTravelNotesService;
     /**
      * 查看指定旅游项目的日历价格。
      *
@@ -267,4 +267,27 @@ public class ExtraController {
         return ResponseResult.success();
     }
 
+    /**
+     * 更新游记是否原创的字段(1.原创;0.非原创。)
+     *
+     * @param tourTourismProjectTravelNotesDto 旅游项目游记管理Dto对象。
+     * @return void。
+     */
+    @Transactional
+    @SaCheckPermission("tourTourismProjectTravelNotes.update")
+    @PostMapping("/updateIsOriginalChange")
+    public ResponseResult<Void> updateIsOriginalChange(@MyRequestBody TourTourismProjectTravelNotesDto tourTourismProjectTravelNotesDto) {
+
+        TourTourismProjectTravelNotes tourTourismProjectTravelNote =
+                tourTourismProjectTravelNotesService.getById(tourTourismProjectTravelNotesDto.getId());
+        if(tourTourismProjectTravelNote == null){
+            return ResponseResult.error(ErrorCodeEnum.PROJECT_NOT_EXIST);
+        }
+        TourTourismProjectTravelNotes tourTourismProjectTravelNotes =
+                MyModelUtil.copyTo(tourTourismProjectTravelNote, TourTourismProjectTravelNotes.class);
+        tourTourismProjectTravelNotes.setIsOriginal(tourTourismProjectTravelNotesDto.getIsOriginal());
+        tourTourismProjectTravelNotesService.update(tourTourismProjectTravelNotes,tourTourismProjectTravelNote);
+        return ResponseResult.success();
+    }
+
 }

+ 5 - 2
application-webadmin/src/main/java/com/tourism/webadmin/back/dao/mapper/TourTourismProjectTravelNotesMapper.xml

@@ -36,6 +36,7 @@
         <result column="average_cost" jdbcType="VARCHAR" property="averageCost"/>
         <result column="recommendation_rate" jdbcType="TINYINT" property="recommendationRate"/>
         <result column="hot_value" jdbcType="INTEGER" property="hotValue"/>
+        <result column="is_original" jdbcType="INTEGER" property="isOriginal"/>
     </resultMap>
 
     <insert id="insertList">
@@ -73,7 +74,8 @@
             departure_time,
             average_cost,
             recommendation_rate,
-            hot_value)
+            hot_value,
+            is_original)
         VALUES
         <foreach collection="list" index="index" item="item" separator="," >
             (#{item.id},
@@ -109,7 +111,8 @@
             #{item.departureTime},
             #{item.averageCost},
             #{item.recommendationRate},
-            #{item.hotValue})
+            #{item.hotValue},
+            #{item.isOriginal})
         </foreach>
     </insert>
 

+ 6 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/dto/TourTourismProjectTravelNotesDto.java

@@ -212,6 +212,12 @@ public class TourTourismProjectTravelNotesDto {
     private Integer hotValue;
 
     /**
+     * 是否原创。
+     */
+    @Schema(description = "是否原创。")
+    private Integer isOriginal;
+
+    /**
      * remarks / project_label / start_place / end_place / short_title / short_description / contact_description LIKE搜索字符串。
      * NOTE: 可支持LIKE操作符的列表数据过滤。
      */

+ 6 - 1
application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourTourismProjectTravelNotes.java

@@ -1,7 +1,6 @@
 package com.tourism.webadmin.back.model;
 
 import com.baomidou.mybatisplus.annotation.*;
-import com.fasterxml.jackson.annotation.JsonFormat;
 import com.tourism.webadmin.back.model.constant.Hotspot;
 import com.tourism.webadmin.back.model.constant.Enable;
 import com.tourism.common.core.util.MyCommonUtil;
@@ -212,6 +211,12 @@ public class TourTourismProjectTravelNotes extends BaseModel {
     private Integer hotValue;
 
     /**
+     * 是否原创。
+     */
+    @TableField(value = "is_original")
+    private Integer isOriginal;
+
+    /**
      * remarks / project_label / start_place / end_place / short_title / short_description / contact_description LIKE搜索字符串。
      */
     @TableField(exist = false)

+ 7 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourTourismProjectTravelNotesVo.java

@@ -1,5 +1,6 @@
 package com.tourism.webadmin.back.vo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.tourism.common.core.base.vo.BaseVo;
 import io.swagger.v3.oas.annotations.media.Schema;
@@ -206,6 +207,12 @@ public class TourTourismProjectTravelNotesVo extends BaseVo {
     private String contactCode;
 
     /**
+     * 是否原创。
+     */
+    @Schema(description = "是否原创")
+    private Integer isOriginal;
+
+    /**
      * id 的一对一关联数据对象,数据对应类型为TourTourismTravelNotesFileVo。
      */
     @Schema(description = "id 的一对一关联数据对象,数据对应类型为TourTourismTravelNotesFileVo")