limeng 4 сар өмнө
parent
commit
041eca09a9

+ 26 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/controller/TourismProjectTravelNotesWriteController.java

@@ -111,6 +111,32 @@ public class TourismProjectTravelNotesWriteController {
         return ResponseResult.success();
     }
 
+
+    @SaIgnore
+    @SaCheckPermission("tourismProjectTravelNotesWrite.update")
+    @OperationLog(type = SysOperationLogType.UPDATE)
+    @PostMapping("/audit")
+    public ResponseResult<Void> audit(@MyRequestBody TourismProjectTravelNotesWriteDto tourismProjectTravelNotesWriteDto) {
+        String errorMessage = MyCommonUtil.getModelValidationError(tourismProjectTravelNotesWriteDto, true);
+        if (errorMessage != null) {
+            return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
+        }
+        TourismProjectTravelNotesWrite tourismProjectTravelNotesWrite = MyModelUtil.copyTo(tourismProjectTravelNotesWriteDto, TourismProjectTravelNotesWrite.class);
+        TourismProjectTravelNotesWrite originalTourismProjectTravelNotesWrite = tourismProjectTravelNotesWriteService.getById(tourismProjectTravelNotesWrite.getId());
+        if (originalTourismProjectTravelNotesWrite == null) {
+            // NOTE: 修改下面方括号中的话述
+            errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
+            return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
+        }
+
+        tourismProjectTravelNotesWriteService.audit(tourismProjectTravelNotesWrite);
+//        if (!tourismProjectTravelNotesWriteService.update(tourismProjectTravelNotesWrite, originalTourismProjectTravelNotesWrite)) {
+//            return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
+//        }
+        return ResponseResult.success();
+    }
+
+
     /**
      * 删除发布游记数据。
      *

+ 2 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/dao/TourismProjectTravelNotesWriteMapper.java

@@ -30,4 +30,6 @@ public interface TourismProjectTravelNotesWriteMapper extends BaseDaoMapper<Tour
      */
     List<TourismProjectTravelNotesWrite> getTourismProjectTravelNotesWriteList(
             @Param("tourismProjectTravelNotesWriteFilter") TourismProjectTravelNotesWrite tourismProjectTravelNotesWriteFilter, @Param("orderBy") String orderBy);
+
+    Integer auditTravelNote(@Param("tourismProjectTravelNotesWriteFilter") TourismProjectTravelNotesWrite entity);
 }

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

@@ -175,4 +175,34 @@
             ORDER BY ${orderBy}
         </if>
     </select>
+
+    <sql id="updateRef">
+        <!-- 审核不通过,设置state为2、驳回原因 -->
+        <if test="tourismProjectTravelNotesWriteFilter.state == 2">
+            unmount_state = 0,
+            state = 2,
+            reason = #{tourismProjectTravelNotesWriteFilter.reason}
+        </if>
+        <!-- 审核通过,设置state为3 -->
+        <if test="tourismProjectTravelNotesWriteFilter.state == 3">
+            unmount_state = 1,
+            state = 3,
+            is_hotspot = #{tourismProjectTravelNotesWriteFilter.isHotspot},
+            note_label = #{tourismProjectTravelNotesWriteFilter.noteLabel},
+            like_count = #{tourismProjectTravelNotesWriteFilter.likeCount},
+            page_view_count = #{tourismProjectTravelNotesWriteFilter.pageViewCount},
+            hot_value = #{tourismProjectTravelNotesWriteFilter.hotValue},
+            is_original = #{tourismProjectTravelNotesWriteFilter.isOriginal}
+        </if>
+    </sql>
+
+    <update id="auditTravelNote" parameterType="com.tourism.webadmin.back.model.TourismProjectTravelNotesWrite">
+        update tour_tourism_project_travel_notes_writer
+        <set>
+            <include refid="updateRef"></include>
+        </set>
+        <where>
+            id = #{tourismProjectTravelNotesWriteFilter.id}
+        </where>
+    </update>
 </mapper>

+ 2 - 4
application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourismProjectTravelNotesWrite.java

@@ -196,11 +196,9 @@ public class TourismProjectTravelNotesWrite extends BaseModel {
         this.searchString = MyCommonUtil.replaceSqlWildcard(searchString);
     }
 
-    @RelationDict(
+    @RelationConstDict(
             masterIdField = "endPlace",
-            slaveModelClass = DirectoryInfo.class,
-            slaveIdField = "id",
-            slaveNameField = "menuName")
+            constantDictClass = DirectoryInfo.class)
     @TableField(exist = false)
     private Map<String, Object> endPlaceDictMap;
 

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

@@ -87,4 +87,6 @@ public interface TourismProjectTravelNotesWriteService extends IBaseService<Tour
     List<TourismProjectTravelNotesWrite> getTourismProjectTravelNotesWriteListWithRelation(TourismProjectTravelNotesWrite filter, String orderBy);
 
     List<TourismTravelNotesContentWrite> parseHTML(TourTourismTravelNotesContent entity);
+
+    Integer audit(TourismProjectTravelNotesWrite enrity);
 }

+ 5 - 25
application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/TourismProjectTravelNotesWriteServiceImpl.java

@@ -63,7 +63,7 @@ public class TourismProjectTravelNotesWriteServiceImpl extends BaseService<Touri
     @Override
     public void saveNewBatch(List<TourismProjectTravelNotesWrite> tourismProjectTravelNotesWriteList) {
         if (CollUtil.isNotEmpty(tourismProjectTravelNotesWriteList)) {
-            tourismProjectTravelNotesWriteList.forEach(this::buildDefaultValue);
+//            tourismProjectTravelNotesWriteList.forEach(this::buildDefaultValue);
             tourismProjectTravelNotesWriteMapper.insertList(tourismProjectTravelNotesWriteList);
         }
     }
@@ -168,31 +168,11 @@ public class TourismProjectTravelNotesWriteServiceImpl extends BaseService<Touri
         }
 
         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;
+    @Override
+    public Integer audit(TourismProjectTravelNotesWrite enrity) {
+        return tourismProjectTravelNotesWriteMapper.auditTravelNote(enrity);
     }
 
     private TourismProjectTravelNotesWrite buildDefaultValue(TourismProjectTravelNotesWrite tourismProjectTravelNotesWrite) {