👽 干掉部分bug

pull/18/head
ruibaby 2018-06-23 23:00:51 +08:00
parent a62b9f8df5
commit 3e262390ea
46 changed files with 233 additions and 180 deletions

2
.gitignore vendored
View File

@ -33,5 +33,3 @@ nbdist/
### VS Code ### ### VS Code ###
*.project *.project
*.factorypath *.factorypath
~/

View File

@ -19,7 +19,7 @@ public interface AttachmentRepository extends JpaRepository<Attachment, Long> {
* *
* *
* @param pageable pageable * @param pageable pageable
* @return page * @return Page
*/ */
@Override @Override
Page<Attachment> findAll(Pageable pageable); Page<Attachment> findAll(Pageable pageable);

View File

@ -17,7 +17,7 @@ public interface CategoryRepository extends JpaRepository<Category, Long> {
* *
* *
* @param cateUrl cateUrl url * @param cateUrl cateUrl url
* @return category * @return Category
*/ */
Category findCategoryByCateUrl(String cateUrl); Category findCategoryByCateUrl(String cateUrl);
} }

View File

@ -24,7 +24,7 @@ public interface CommentRepository extends JpaRepository<Comment, Long> {
* *
* @param status * @param status
* @param pageable * @param pageable
* @return page * @return Page
*/ */
Page<Comment> findCommentsByCommentStatus(Integer status, Pageable pageable); Page<Comment> findCommentsByCommentStatus(Integer status, Pageable pageable);
@ -32,7 +32,7 @@ public interface CommentRepository extends JpaRepository<Comment, Long> {
* *
* *
* @param status * @param status
* @return list * @return List
*/ */
List<Comment> findCommentsByCommentStatus(Integer status); List<Comment> findCommentsByCommentStatus(Integer status);
@ -41,7 +41,7 @@ public interface CommentRepository extends JpaRepository<Comment, Long> {
* *
* @param post post * @param post post
* @param pageable pageable * @param pageable pageable
* @return page * @return Page
*/ */
Page<Comment> findCommentsByPost(Post post, Pageable pageable); Page<Comment> findCommentsByPost(Post post, Pageable pageable);
@ -51,14 +51,14 @@ public interface CommentRepository extends JpaRepository<Comment, Long> {
* @param post post * @param post post
* @param pageable pageable * @param pageable pageable
* @param status status * @param status status
* @return page * @return Page
*/ */
Page<Comment> findCommentsByPostAndCommentStatus(Post post, Pageable pageable, Integer status); Page<Comment> findCommentsByPostAndCommentStatus(Post post, Pageable pageable, Integer status);
/** /**
* *
* *
* @return list * @return List
*/ */
@Query(value = "SELECT * FROM halo_comment ORDER BY comment_date DESC LIMIT 5", nativeQuery = true) @Query(value = "SELECT * FROM halo_comment ORDER BY comment_date DESC LIMIT 5", nativeQuery = true)
List<Comment> findTopFive(); List<Comment> findTopFive();

View File

@ -19,7 +19,7 @@ public interface LogsRepository extends JpaRepository<Logs, Long> {
/** /**
* *
* *
* @return list * @return List
*/ */
@Query(value = "SELECT * FROM halo_logs ORDER BY log_created DESC LIMIT 5", nativeQuery = true) @Query(value = "SELECT * FROM halo_logs ORDER BY log_created DESC LIMIT 5", nativeQuery = true)
List<Logs> findTopFive(); List<Logs> findTopFive();

View File

@ -17,7 +17,7 @@ public interface OptionsRepository extends JpaRepository<Options, Long> {
* keyoption * keyoption
* *
* @param key key * @param key key
* @return String * @return Options
*/ */
Options findOptionsByOptionName(String key); Options findOptionsByOptionName(String key);
} }

View File

@ -25,7 +25,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
/** /**
* *
* *
* @return list * @return List
*/ */
@Query(value = "SELECT * FROM halo_post where post_type='post' ORDER BY post_date DESC LIMIT 5", nativeQuery = true) @Query(value = "SELECT * FROM halo_post where post_type='post' ORDER BY post_date DESC LIMIT 5", nativeQuery = true)
List<Post> findTopFive(); List<Post> findTopFive();
@ -34,7 +34,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
* *
* *
* @param postType post or page * @param postType post or page
* @return List<Post></> * @return List
*/ */
List<Post> findPostsByPostType(String postType); List<Post> findPostsByPostType(String postType);
@ -43,7 +43,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
* *
* @param postType post or page * @param postType post or page
* @param pageable * @param pageable
* @return Page<Post></> * @return Page
*/ */
Page<Post> findPostsByPostType(String postType, Pageable pageable); Page<Post> findPostsByPostType(String postType, Pageable pageable);
@ -52,7 +52,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
* *
* @param keyWord keyword * @param keyWord keyword
* @param pageable pageable * @param pageable pageable
* @return list * @return List
*/ */
List<Post> findByPostTitleLike(String keyWord, Pageable pageable); List<Post> findByPostTitleLike(String keyWord, Pageable pageable);
@ -62,7 +62,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
* @param status 012 * @param status 012
* @param postType post or page * @param postType post or page
* @param pageable * @param pageable
* @return Page<Post></> * @return Page
*/ */
Page<Post> findPostsByPostStatusAndPostType(Integer status, String postType, Pageable pageable); Page<Post> findPostsByPostStatusAndPostType(Integer status, String postType, Pageable pageable);
@ -71,7 +71,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
* *
* @param status 0,1,2 * @param status 0,1,2
* @param postType post or page * @param postType post or page
* @return List<Post></> * @return List
*/ */
List<Post> findPostsByPostStatusAndPostType(Integer status, String postType); List<Post> findPostsByPostStatusAndPostType(Integer status, String postType);
@ -90,7 +90,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
* @param postDate * @param postDate
* @param postStatus 012 * @param postStatus 012
* @param postType post or page * @param postType post or page
* @return List<Post></> * @return List
*/ */
List<Post> findByPostDateAfterAndPostStatusAndPostTypeOrderByPostDateDesc(Date postDate, Integer postStatus, String postType); List<Post> findByPostDateAfterAndPostStatusAndPostTypeOrderByPostDateDesc(Date postDate, Integer postStatus, String postType);
@ -101,14 +101,14 @@ public interface PostRepository extends JpaRepository<Post, Long> {
* @param postDate * @param postDate
* @param postStatus 012 * @param postStatus 012
* @param postType post or page * @param postType post or page
* @return List<Post></> * @return List
*/ */
List<Post> findByPostDateBeforeAndPostStatusAndPostTypeOrderByPostDateAsc(Date postDate, Integer postStatus, String postType); List<Post> findByPostDateBeforeAndPostStatusAndPostTypeOrderByPostDateAsc(Date postDate, Integer postStatus, String postType);
/** /**
* *
* *
* @return List<Object [ ]></> * @return List
*/ */
@Query(value = "select year(post_date) as year,month(post_date) as month,count(*) as count from halo_post where post_status=0 and post_type='post' group by year(post_date),month(post_date) order by year desc,month desc", nativeQuery = true) @Query(value = "select year(post_date) as year,month(post_date) as month,count(*) as count from halo_post where post_status=0 and post_type='post' group by year(post_date),month(post_date) order by year desc,month desc", nativeQuery = true)
List<Object[]> findPostGroupByYearAndMonth(); List<Object[]> findPostGroupByYearAndMonth();
@ -116,7 +116,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
/** /**
* *
* *
* @return List<Object [ ]></> * @return List
*/ */
@Query(value = "select year(post_date) as year,count(*) as count from halo_post where post_status=0 and post_type='post' group by year(post_date) order by year desc", nativeQuery = true) @Query(value = "select year(post_date) as year,count(*) as count from halo_post where post_status=0 and post_type='post' group by year(post_date) order by year desc", nativeQuery = true)
List<Object[]> findPostGroupByYear(); List<Object[]> findPostGroupByYear();
@ -126,7 +126,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
* *
* @param year year * @param year year
* @param month month * @param month month
* @return List<Post></> * @return List
*/ */
@Query(value = "select *,year(post_date) as year,month(post_date) as month from halo_post where post_status=0 and post_type='post' and year(post_date)=:year and month(post_date)=:month order by post_date desc", nativeQuery = true) @Query(value = "select *,year(post_date) as year,month(post_date) as month from halo_post where post_status=0 and post_type='post' and year(post_date)=:year and month(post_date)=:month order by post_date desc", nativeQuery = true)
List<Post> findPostByYearAndMonth(@Param("year") String year, @Param("month") String month); List<Post> findPostByYearAndMonth(@Param("year") String year, @Param("month") String month);
@ -135,7 +135,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
* *
* *
* @param year year * @param year year
* @return List<Post></> * @return List
*/ */
@Query(value = "select *,year(post_date) as year from halo_post where post_status=0 and post_type='post' and year(post_date)=:year order by post_date desc", nativeQuery = true) @Query(value = "select *,year(post_date) as year from halo_post where post_status=0 and post_type='post' and year(post_date)=:year order by post_date desc", nativeQuery = true)
List<Post> findPostByYear(@Param("year") String year); List<Post> findPostByYear(@Param("year") String year);
@ -146,7 +146,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
* @param year year * @param year year
* @param month month * @param month month
* @param pageable pageable * @param pageable pageable
* @return Page<Post></> * @return Page
*/ */
@Query(value = "select * from halo_post where post_status=0 and post_type='post' and year(post_date)=:year and month(post_date)=:month order by post_date desc", countQuery = "select count(*) from halo_post where post_status=0 and year(post_date)=:year and month(post_date)=:month", nativeQuery = true) @Query(value = "select * from halo_post where post_status=0 and post_type='post' and year(post_date)=:year and month(post_date)=:month order by post_date desc", countQuery = "select count(*) from halo_post where post_status=0 and year(post_date)=:year and month(post_date)=:month", nativeQuery = true)
Page<Post> findPostByYearAndMonth(@Param("year") String year, @Param("month") String month, Pageable pageable); Page<Post> findPostByYearAndMonth(@Param("year") String year, @Param("month") String month, Pageable pageable);
@ -156,27 +156,33 @@ public interface PostRepository extends JpaRepository<Post, Long> {
* *
* @param category category * @param category category
* @param pageable pageable * @param pageable pageable
* @return Page<Post></> * @return Page
*/ */
Page<Post> findPostByCategories(Category category, Pageable pageable); Page<Post> findPostByCategories(Category category, Pageable pageable);
/**
*
*
* @param tag tag
* @param pageable pageable
* @return Page
*/
Page<Post> findPostsByTags(Tag tag, Pageable pageable);
/** /**
* *
* *
* @param tag tag * @param tag tag
* @param pageable pageable * @return List
* @return Page<Post></>
*/ */
Page<Post> findPostsByTags(Tag tag, Pageable pageable); List<Post> findPostsByTags(Tag tag);
/** /**
* *
* *
* @param postType post or page
* @param postStatus 012
* @param keyword * @param keyword
* @param pageable * @param pageable
* @return Page<Post></> * @return Page
*/ */
@Query(value = "select * from halo_post where post_status = 0 and post_type='post' and post_title like '%=:keyword%' or post_content like '%=:keyword%'", nativeQuery = true) @Query(value = "select * from halo_post where post_status = 0 and post_type='post' and post_title like '%=:keyword%' or post_content like '%=:keyword%'", nativeQuery = true)
Page<Post> findPostByPostTitleLikeOrPostContentLikeAndPostTypeAndPostStatus(String keyword, Pageable pageable); Page<Post> findPostByPostTitleLikeOrPostContentLikeAndPostTypeAndPostStatus(String keyword, Pageable pageable);

View File

@ -17,7 +17,7 @@ public interface TagRepository extends JpaRepository<Tag, Long> {
* *
* *
* @param tagUrl tagUrl * @param tagUrl tagUrl
* @return tag * @return Tag
*/ */
Tag findTagByTagUrl(String tagUrl); Tag findTagByTagUrl(String tagUrl);
@ -25,7 +25,7 @@ public interface TagRepository extends JpaRepository<Tag, Long> {
* *
* *
* @param tagName * @param tagName
* @return tag * @return Tag
*/ */
Tag findTagByTagName(String tagName); Tag findTagByTagName(String tagName);
} }

View File

@ -18,7 +18,7 @@ public interface UserRepository extends JpaRepository<User, Long> {
* *
* @param userName userName * @param userName userName
* @param userPass userPass * @param userPass userPass
* @return list * @return User
*/ */
User findByUserNameAndUserPass(String userName, String userPass); User findByUserNameAndUserPass(String userName, String userPass);
@ -27,7 +27,7 @@ public interface UserRepository extends JpaRepository<User, Long> {
* *
* @param userEmail userEmail * @param userEmail userEmail
* @param userPass userPass * @param userPass userPass
* @return list * @return User
*/ */
User findByUserEmailAndUserPass(String userEmail, String userPass); User findByUserEmailAndUserPass(String userEmail, String userPass);

View File

@ -24,7 +24,7 @@ public interface AttachmentService {
/** /**
* *
* *
* @return list * @return List
*/ */
List<Attachment> findAllAttachments(); List<Attachment> findAllAttachments();
@ -32,7 +32,7 @@ public interface AttachmentService {
* *
* *
* @param pageable pageable * @param pageable pageable
* @return page * @return Page
*/ */
Page<Attachment> findAllAttachments(Pageable pageable); Page<Attachment> findAllAttachments(Pageable pageable);

View File

@ -25,7 +25,7 @@ public interface CommentService {
* *
* *
* @param commentId commentId * @param commentId commentId
* @return comment * @return Optional
*/ */
Optional<Comment> removeByCommentId(Long commentId); Optional<Comment> removeByCommentId(Long commentId);
@ -34,7 +34,7 @@ public interface CommentService {
* *
* @param status status * @param status status
* @param pageable pageable * @param pageable pageable
* @return page * @return Page
*/ */
Page<Comment> findAllComments(Integer status, Pageable pageable); Page<Comment> findAllComments(Integer status, Pageable pageable);
@ -42,14 +42,14 @@ public interface CommentService {
* *
* *
* @param status * @param status
* @return list * @return List
*/ */
List<Comment> findAllComments(Integer status); List<Comment> findAllComments(Integer status);
/** /**
* *
* *
* @return list * @return List
*/ */
List<Comment> findAllComments(); List<Comment> findAllComments();
@ -58,7 +58,7 @@ public interface CommentService {
* *
* @param commentId commentId * @param commentId commentId
* @param status status * @param status status
* @return comment * @return Comment
*/ */
Comment updateCommentStatus(Long commentId, Integer status); Comment updateCommentStatus(Long commentId, Integer status);
@ -66,7 +66,7 @@ public interface CommentService {
* *
* *
* @param commentId commentId * @param commentId commentId
* @return comment * @return Optional
*/ */
Optional<Comment> findCommentById(Long commentId); Optional<Comment> findCommentById(Long commentId);
@ -75,7 +75,7 @@ public interface CommentService {
* *
* @param post post * @param post post
* @param pageable pageable * @param pageable pageable
* @return page * @return Page
*/ */
Page<Comment> findCommentsByPost(Post post, Pageable pageable); Page<Comment> findCommentsByPost(Post post, Pageable pageable);
@ -85,14 +85,14 @@ public interface CommentService {
* @param post post * @param post post
* @param pageable pageable * @param pageable pageable
* @param status status * @param status status
* @return page * @return Page
*/ */
Page<Comment> findCommentsByPostAndCommentStatus(Post post, Pageable pageable, Integer status); Page<Comment> findCommentsByPostAndCommentStatus(Post post, Pageable pageable, Integer status);
/** /**
* *
* *
* @return list * @return List
*/ */
List<Comment> findCommentsLatest(); List<Comment> findCommentsLatest();
} }

View File

@ -25,6 +25,7 @@ public interface GalleryService {
* *
* *
* @param galleryId galleryId * @param galleryId galleryId
* @return Gallery
*/ */
Gallery removeByGalleryId(Long galleryId); Gallery removeByGalleryId(Long galleryId);
@ -40,14 +41,14 @@ public interface GalleryService {
* *
* *
* @param pageable pageable * @param pageable pageable
* @return page * @return Page
*/ */
Page<Gallery> findAllGalleries(Pageable pageable); Page<Gallery> findAllGalleries(Pageable pageable);
/** /**
* *
* *
* @return list * @return List
*/ */
List<Gallery> findAllGalleries(); List<Gallery> findAllGalleries();
@ -55,7 +56,7 @@ public interface GalleryService {
* *
* *
* @param galleryId galleryId * @param galleryId galleryId
* @return gallery * @return Optional
*/ */
Optional<Gallery> findByGalleryId(Long galleryId); Optional<Gallery> findByGalleryId(Long galleryId);
} }

View File

@ -17,7 +17,7 @@ public interface LogsService {
* *
* *
* @param logs logs * @param logs logs
* @return logs * @return Logs
*/ */
Logs saveByLogs(Logs logs); Logs saveByLogs(Logs logs);
@ -37,14 +37,14 @@ public interface LogsService {
* *
* *
* @param pageable pageable * @param pageable pageable
* @return page * @return Page
*/ */
Page<Logs> findAllLogs(Pageable pageable); Page<Logs> findAllLogs(Pageable pageable);
/** /**
* *
* *
* @return list * @return List
*/ */
List<Logs> findLogsLatest(); List<Logs> findLogsLatest();
@ -52,7 +52,7 @@ public interface LogsService {
* *
* *
* @param logsId logsId * @param logsId logsId
* @return logs * @return Optional
*/ */
Optional<Logs> findLogsByLogsId(Long logsId); Optional<Logs> findLogsByLogsId(Long logsId);
} }

View File

@ -22,7 +22,7 @@ public interface MenuService {
/** /**
* *
* *
* @return list * @return List
*/ */
List<Menu> findAllMenus(); List<Menu> findAllMenus();
@ -30,7 +30,7 @@ public interface MenuService {
* *
* *
* @param menuId menuId * @param menuId menuId
* @return menu * @return Menu
*/ */
Menu removeByMenuId(Long menuId); Menu removeByMenuId(Long menuId);
@ -38,7 +38,7 @@ public interface MenuService {
* *
* *
* @param menuId menuId * @param menuId menuId
* @return Menu * @return Optional
*/ */
Optional<Menu> findByMenuId(Long menuId); Optional<Menu> findByMenuId(Long menuId);
} }

View File

@ -35,7 +35,7 @@ public interface OptionsService {
/** /**
* *
* *
* @return map * @return Map
*/ */
Map<String, String> findAllOptions(); Map<String, String> findAllOptions();

View File

@ -54,7 +54,7 @@ public interface PostService {
* *
* @param postType post or page * @param postType post or page
* @param pageable * @param pageable
* @return Page<Post></> * @return Page
*/ */
Page<Post> findAllPosts(String postType, Pageable pageable); Page<Post> findAllPosts(String postType, Pageable pageable);
@ -62,7 +62,7 @@ public interface PostService {
* *
* *
* @param postType post or page * @param postType post or page
* @return List<Post></> * @return List
*/ */
List<Post> findAllPosts(String postType); List<Post> findAllPosts(String postType);
@ -71,7 +71,7 @@ public interface PostService {
* *
* @param keyWord keyword * @param keyWord keyword
* @param pageable pageable * @param pageable pageable
* @return list * @return List
*/ */
List<Post> searchPosts(String keyWord, Pageable pageable); List<Post> searchPosts(String keyWord, Pageable pageable);
@ -81,7 +81,7 @@ public interface PostService {
* @param status 012 * @param status 012
* @param postType post or page * @param postType post or page
* @param pageable * @param pageable
* @return Page<Post></> * @return Page
*/ */
Page<Post> findPostByStatus(Integer status, String postType, Pageable pageable); Page<Post> findPostByStatus(Integer status, String postType, Pageable pageable);
@ -90,7 +90,7 @@ public interface PostService {
* *
* @param status 012 * @param status 012
* @param postType post or page * @param postType post or page
* @return List<Post></> * @return List
*/ */
List<Post> findPostByStatus(Integer status, String postType); List<Post> findPostByStatus(Integer status, String postType);
@ -122,7 +122,7 @@ public interface PostService {
* Id * Id
* *
* @param postDate postDate * @param postDate postDate
* @return post * @return List
*/ */
List<Post> findByPostDateAfter(Date postDate); List<Post> findByPostDateAfter(Date postDate);
@ -130,7 +130,7 @@ public interface PostService {
* Id * Id
* *
* @param postDate postDate * @param postDate postDate
* @return list * @return List
*/ */
List<Post> findByPostDateBefore(Date postDate); List<Post> findByPostDateBefore(Date postDate);
@ -144,7 +144,7 @@ public interface PostService {
/** /**
* *
* *
* @return list * @return List
*/ */
List<Archive> findPostGroupByYear(); List<Archive> findPostGroupByYear();
@ -153,7 +153,7 @@ public interface PostService {
* *
* @param year year * @param year year
* @param month month * @param month month
* @return list * @return List
*/ */
List<Post> findPostByYearAndMonth(String year, String month); List<Post> findPostByYearAndMonth(String year, String month);
@ -163,7 +163,7 @@ public interface PostService {
* @param year year * @param year year
* @param month month * @param month month
* @param pageable pageable * @param pageable pageable
* @return page * @return Page
*/ */
Page<Post> findPostByYearAndMonth(String year, String month, Pageable pageable); Page<Post> findPostByYearAndMonth(String year, String month, Pageable pageable);
@ -171,7 +171,7 @@ public interface PostService {
* *
* *
* @param year year * @param year year
* @return list * @return List
*/ */
List<Post> findPostByYear(String year); List<Post> findPostByYear(String year);
@ -180,7 +180,7 @@ public interface PostService {
* *
* @param category category * @param category category
* @param pageable pageable * @param pageable pageable
* @return Page<Post></> * @return Page
*/ */
Page<Post> findPostByCategories(Category category,Pageable pageable); Page<Post> findPostByCategories(Category category,Pageable pageable);
@ -189,7 +189,7 @@ public interface PostService {
* *
* @param tag tag * @param tag tag
* @param pageable pageable * @param pageable pageable
* @return page * @return Page
*/ */
Page<Post> findPostsByTags(Tag tag, Pageable pageable); Page<Post> findPostsByTags(Tag tag, Pageable pageable);
@ -198,22 +198,30 @@ public interface PostService {
* *
* @param keyword * @param keyword
* @param pageable * @param pageable
* @return Page<Post></> * @return Page
*/ */
Page<Post> searchByKeywords(String keyword,Pageable pageable); Page<Post> searchByKeywords(String keyword,Pageable pageable);
/** /**
* *
* *
* @return List<Post> * @return List
*/ */
List<Post> hotPosts(); List<Post> hotPosts();
/**
*
*
* @param post post
* @return List
*/
List<Post> relatedPosts(Post post);
/** /**
* rss * rss
* *
* @param posts posts * @param posts posts
* @return string * @return String
*/ */
String buildRss(List<Post> posts); String buildRss(List<Post> posts);
@ -221,7 +229,7 @@ public interface PostService {
* sitemap * sitemap
* *
* @param posts posts * @param posts posts
* @return string * @return String
*/ */
String buildSiteMap(List<Post> posts); String buildSiteMap(List<Post> posts);
} }

View File

@ -30,7 +30,7 @@ public interface TagService {
/** /**
* *
* *
* @return list * @return List
*/ */
List<Tag> findAllTags(); List<Tag> findAllTags();
@ -38,7 +38,7 @@ public interface TagService {
* *
* *
* @param tagId tagId * @param tagId tagId
* @return Link * @return Optional
*/ */
Optional<Tag> findByTagId(Long tagId); Optional<Tag> findByTagId(Long tagId);
@ -46,7 +46,7 @@ public interface TagService {
* *
* *
* @param tagUrl tagUrl * @param tagUrl tagUrl
* @return tag * @return Tag
*/ */
Tag findByTagUrl(String tagUrl); Tag findByTagUrl(String tagUrl);
@ -54,7 +54,7 @@ public interface TagService {
* *
* *
* @param tagName tagName * @param tagName tagName
* @return tag * @return Tag
*/ */
Tag findTagByTagName(String tagName); Tag findTagByTagName(String tagName);
@ -62,7 +62,7 @@ public interface TagService {
* *
* *
* @param tagList tagList * @param tagList tagList
* @return list * @return List
*/ */
List<Tag> strListToTagList(String tagList); List<Tag> strListToTagList(String tagList);
} }

View File

@ -31,14 +31,14 @@ public interface UserService {
* *
* @param userEmail userEmail * @param userEmail userEmail
* @param userPass userPass * @param userPass userPass
* @return list * @return User
*/ */
User userLoginByEmail(String userEmail, String userPass); User userLoginByEmail(String userEmail, String userPass);
/** /**
* *
* *
* @return list * @return User
*/ */
User findUser(); User findUser();
@ -47,7 +47,7 @@ public interface UserService {
* *
* @param userId userid * @param userId userid
* @param userPass userpass * @param userPass userpass
* @return user * @return User
*/ */
User findByUserIdAndUserPass(Long userId, String userPass); User findByUserIdAndUserPass(Long userId, String userPass);

View File

@ -35,7 +35,7 @@ public class AttachmentServiceImpl implements AttachmentService {
/** /**
* *
* *
* @return list * @return List
*/ */
@Override @Override
public List<Attachment> findAllAttachments() { public List<Attachment> findAllAttachments() {
@ -46,7 +46,7 @@ public class AttachmentServiceImpl implements AttachmentService {
* *
* *
* @param pageable pageable * @param pageable pageable
* @return page * @return Page
*/ */
@Override @Override
public Page<Attachment> findAllAttachments(Pageable pageable) { public Page<Attachment> findAllAttachments(Pageable pageable) {
@ -57,7 +57,7 @@ public class AttachmentServiceImpl implements AttachmentService {
* id * id
* *
* @param attachId attachId * @param attachId attachId
* @return attachment * @return Optional
*/ */
@Override @Override
public Optional<Attachment> findByAttachId(Long attachId) { public Optional<Attachment> findByAttachId(Long attachId) {
@ -68,7 +68,7 @@ public class AttachmentServiceImpl implements AttachmentService {
* *
* *
* @param attachId attachId * @param attachId attachId
* @return attachment * @return Attachment
*/ */
@Override @Override
public Attachment removeByAttachId(Long attachId) { public Attachment removeByAttachId(Long attachId) {

View File

@ -47,7 +47,7 @@ public class CategoryServiceImpl implements CategoryService {
/** /**
* *
* *
* @return list * @return List
*/ */
@Override @Override
public List<Category> findAllCategories() { public List<Category> findAllCategories() {
@ -69,14 +69,13 @@ public class CategoryServiceImpl implements CategoryService {
* *
* *
* @param cateUrl cateUrl * @param cateUrl cateUrl
* @return category * @return Category
*/ */
@Override @Override
public Category findByCateUrl(String cateUrl) { public Category findByCateUrl(String cateUrl) {
return categoryRepository.findCategoryByCateUrl(cateUrl); return categoryRepository.findCategoryByCateUrl(cateUrl);
} }
@Override @Override
public List<Category> strListToCateList(List<String> strings) { public List<Category> strListToCateList(List<String> strings) {
if (null == strings) { if (null == strings) {

View File

@ -35,7 +35,8 @@ public class CommentServiceImpl implements CommentService {
/** /**
* *
* *
* @param comment * @param commentId commentId
* @return Optional
*/ */
@Override @Override
public Optional<Comment> removeByCommentId(Long commentId) { public Optional<Comment> removeByCommentId(Long commentId) {
@ -48,7 +49,7 @@ public class CommentServiceImpl implements CommentService {
* *
* *
* @param pageable pageable * @param pageable pageable
* @return page * @return Page
*/ */
@Override @Override
public Page<Comment> findAllComments(Integer status, Pageable pageable) { public Page<Comment> findAllComments(Integer status, Pageable pageable) {
@ -59,7 +60,7 @@ public class CommentServiceImpl implements CommentService {
* *
* *
* @param status * @param status
* @return list * @return List
*/ */
@Override @Override
public List<Comment> findAllComments(Integer status) { public List<Comment> findAllComments(Integer status) {
@ -81,7 +82,7 @@ public class CommentServiceImpl implements CommentService {
* *
* @param commentId commentId * @param commentId commentId
* @param status status * @param status status
* @return comment * @return Comment
*/ */
@Override @Override
public Comment updateCommentStatus(Long commentId, Integer status) { public Comment updateCommentStatus(Long commentId, Integer status) {
@ -94,7 +95,7 @@ public class CommentServiceImpl implements CommentService {
* *
* *
* @param commentId commentId * @param commentId commentId
* @return comment * @return Optional
*/ */
@Override @Override
public Optional<Comment> findCommentById(Long commentId) { public Optional<Comment> findCommentById(Long commentId) {
@ -106,7 +107,7 @@ public class CommentServiceImpl implements CommentService {
* *
* @param post post * @param post post
* @param pageable pageable * @param pageable pageable
* @return page * @return Page
*/ */
@Override @Override
public Page<Comment> findCommentsByPost(Post post, Pageable pageable) { public Page<Comment> findCommentsByPost(Post post, Pageable pageable) {
@ -119,7 +120,7 @@ public class CommentServiceImpl implements CommentService {
* @param post post * @param post post
* @param pageable pageable * @param pageable pageable
* @param status status * @param status status
* @return page * @return Page
*/ */
@Override @Override
public Page<Comment> findCommentsByPostAndCommentStatus(Post post, Pageable pageable, Integer status) { public Page<Comment> findCommentsByPostAndCommentStatus(Post post, Pageable pageable, Integer status) {
@ -129,7 +130,7 @@ public class CommentServiceImpl implements CommentService {
/** /**
* *
* *
* @return list * @return List
*/ */
@Override @Override
public List<Comment> findCommentsLatest() { public List<Comment> findCommentsLatest() {

View File

@ -36,6 +36,7 @@ public class GalleryServiceImpl implements GalleryService {
* *
* *
* @param galleryId galleryId * @param galleryId galleryId
* @return Gallery
*/ */
@Override @Override
public Gallery removeByGalleryId(Long galleryId) { public Gallery removeByGalleryId(Long galleryId) {
@ -59,7 +60,7 @@ public class GalleryServiceImpl implements GalleryService {
* *
* *
* @param pageable pageable * @param pageable pageable
* @return page * @return Page
*/ */
@Override @Override
public Page<Gallery> findAllGalleries(Pageable pageable) { public Page<Gallery> findAllGalleries(Pageable pageable) {
@ -69,7 +70,7 @@ public class GalleryServiceImpl implements GalleryService {
/** /**
* *
* *
* @return list * @return List
*/ */
@Override @Override
public List<Gallery> findAllGalleries() { public List<Gallery> findAllGalleries() {
@ -80,7 +81,7 @@ public class GalleryServiceImpl implements GalleryService {
* *
* *
* @param galleryId galleryId * @param galleryId galleryId
* @return gallery * @return Optional
*/ */
@Override @Override
public Optional<Gallery> findByGalleryId(Long galleryId) { public Optional<Gallery> findByGalleryId(Long galleryId) {

View File

@ -34,7 +34,7 @@ public class LinkServiceImpl implements LinkService {
* *
* *
* @param linkId linkId * @param linkId linkId
* @return link * @return Link
*/ */
@Override @Override
public Link removeByLinkId(Long linkId) { public Link removeByLinkId(Long linkId) {
@ -46,7 +46,7 @@ public class LinkServiceImpl implements LinkService {
/** /**
* *
* *
* @return list * @return List
*/ */
@Override @Override
public List<Link> findAllLinks() { public List<Link> findAllLinks() {
@ -57,7 +57,7 @@ public class LinkServiceImpl implements LinkService {
* *
* *
* @param linkId linkId * @param linkId linkId
* @return Link * @return Optional
*/ */
@Override @Override
public Optional<Link> findByLinkId(Long linkId) { public Optional<Link> findByLinkId(Long linkId) {

View File

@ -25,7 +25,7 @@ public class LogsServiceImpl implements LogsService {
* *
* *
* @param logs logs * @param logs logs
* @return logs * @return Logs
*/ */
@Override @Override
public Logs saveByLogs(Logs logs) { public Logs saveByLogs(Logs logs) {
@ -55,7 +55,7 @@ public class LogsServiceImpl implements LogsService {
* *
* *
* @param pageable pageable * @param pageable pageable
* @return page * @return Page
*/ */
@Override @Override
public Page<Logs> findAllLogs(Pageable pageable) { public Page<Logs> findAllLogs(Pageable pageable) {
@ -65,7 +65,7 @@ public class LogsServiceImpl implements LogsService {
/** /**
* *
* *
* @return list * @return List
*/ */
@Override @Override
public List<Logs> findLogsLatest() { public List<Logs> findLogsLatest() {
@ -76,7 +76,7 @@ public class LogsServiceImpl implements LogsService {
* *
* *
* @param logsId logsId * @param logsId logsId
* @return logs * @return Optional
*/ */
@Override @Override
public Optional<Logs> findLogsByLogsId(Long logsId) { public Optional<Logs> findLogsByLogsId(Long logsId) {

View File

@ -22,7 +22,7 @@ public class MenuServiceImpl implements MenuService {
/** /**
* *
* *
* @return list * @return List
*/ */
@Override @Override
public List<Menu> findAllMenus() { public List<Menu> findAllMenus() {
@ -44,7 +44,7 @@ public class MenuServiceImpl implements MenuService {
* *
* *
* @param menuId menuId * @param menuId menuId
* @return menu * @return Menu
*/ */
@Override @Override
public Menu removeByMenuId(Long menuId) { public Menu removeByMenuId(Long menuId) {

View File

@ -76,7 +76,7 @@ public class OptionsServiceImpl implements OptionsService {
/** /**
* *
* *
* @return map * @return Map
*/ */
@Override @Override
public Map<String, String> findAllOptions() { public Map<String, String> findAllOptions() {

View File

@ -91,7 +91,7 @@ public class PostServiceImpl implements PostService {
* *
* @param postType post or page * @param postType post or page
* @param pageable * @param pageable
* @return Page<Post></> * @return Page
*/ */
@Override @Override
public Page<Post> findAllPosts(String postType, Pageable pageable) { public Page<Post> findAllPosts(String postType, Pageable pageable) {
@ -102,7 +102,7 @@ public class PostServiceImpl implements PostService {
* *
* *
* @param postType post or page * @param postType post or page
* @return List<Post></> * @return List
*/ */
@Override @Override
public List<Post> findAllPosts(String postType) { public List<Post> findAllPosts(String postType) {
@ -114,7 +114,7 @@ public class PostServiceImpl implements PostService {
* *
* @param keyWord keyword * @param keyWord keyword
* @param pageable pageable * @param pageable pageable
* @return list * @return List
*/ */
@Override @Override
public List<Post> searchPosts(String keyWord, Pageable pageable) { public List<Post> searchPosts(String keyWord, Pageable pageable) {
@ -127,7 +127,7 @@ public class PostServiceImpl implements PostService {
* @param status 012 * @param status 012
* @param postType post or page * @param postType post or page
* @param pageable * @param pageable
* @return Page<Post></> * @return Page
*/ */
@Override @Override
public Page<Post> findPostByStatus(Integer status, String postType, Pageable pageable) { public Page<Post> findPostByStatus(Integer status, String postType, Pageable pageable) {
@ -139,7 +139,7 @@ public class PostServiceImpl implements PostService {
* *
* @param status 012 * @param status 012
* @param postType post or page * @param postType post or page
* @return List<Post></> * @return List
*/ */
@Override @Override
public List<Post> findPostByStatus(Integer status, String postType) { public List<Post> findPostByStatus(Integer status, String postType) {
@ -150,7 +150,7 @@ public class PostServiceImpl implements PostService {
* *
* *
* @param postId postId * @param postId postId
* @return post * @return Optional
*/ */
@Override @Override
public Optional<Post> findByPostId(Long postId) { public Optional<Post> findByPostId(Long postId) {
@ -172,7 +172,7 @@ public class PostServiceImpl implements PostService {
/** /**
* 5 * 5
* *
* @return list * @return List
*/ */
@Override @Override
public List<Post> findPostLatest() { public List<Post> findPostLatest() {
@ -194,7 +194,7 @@ public class PostServiceImpl implements PostService {
* Id * Id
* *
* @param postDate * @param postDate
* @return list * @return List
*/ */
@Override @Override
public List<Post> findByPostDateBefore(Date postDate) { public List<Post> findByPostDateBefore(Date postDate) {
@ -226,7 +226,7 @@ public class PostServiceImpl implements PostService {
/** /**
* *
* *
* @return list * @return List
*/ */
@Override @Override
public List<Archive> findPostGroupByYear() { public List<Archive> findPostGroupByYear() {
@ -248,7 +248,7 @@ public class PostServiceImpl implements PostService {
* *
* @param year year * @param year year
* @param month month * @param month month
* @return list * @return List
*/ */
@Override @Override
public List<Post> findPostByYearAndMonth(String year, String month) { public List<Post> findPostByYearAndMonth(String year, String month) {
@ -259,7 +259,7 @@ public class PostServiceImpl implements PostService {
* *
* *
* @param year year * @param year year
* @return list * @return List
*/ */
@Override @Override
public List<Post> findPostByYear(String year) { public List<Post> findPostByYear(String year) {
@ -272,7 +272,7 @@ public class PostServiceImpl implements PostService {
* @param year year year * @param year year year
* @param month month month * @param month month month
* @param pageable pageable pageable * @param pageable pageable pageable
* @return page * @return Page
*/ */
@Override @Override
public Page<Post> findPostByYearAndMonth(String year, String month, Pageable pageable) { public Page<Post> findPostByYearAndMonth(String year, String month, Pageable pageable) {
@ -284,7 +284,7 @@ public class PostServiceImpl implements PostService {
* *
* @param category category * @param category category
* @param pageable pageable * @param pageable pageable
* @return Page<Post></> * @return Page
*/ */
@Override @Override
public Page<Post> findPostByCategories(Category category, Pageable pageable) { public Page<Post> findPostByCategories(Category category, Pageable pageable) {
@ -296,7 +296,7 @@ public class PostServiceImpl implements PostService {
* *
* @param tag tag * @param tag tag
* @param pageable pageable * @param pageable pageable
* @return page * @return Page
*/ */
@Override @Override
public Page<Post> findPostsByTags(Tag tag, Pageable pageable) { public Page<Post> findPostsByTags(Tag tag, Pageable pageable) {
@ -308,7 +308,7 @@ public class PostServiceImpl implements PostService {
* *
* @param keyword * @param keyword
* @param pageable * @param pageable
* @return List<Post></> * @return Page
*/ */
@Override @Override
public Page<Post> searchByKeywords(String keyword,Pageable pageable) { public Page<Post> searchByKeywords(String keyword,Pageable pageable) {
@ -318,18 +318,44 @@ public class PostServiceImpl implements PostService {
/** /**
* *
* *
* @return List<Post> * @return List
*/ */
@Override @Override
public List<Post> hotPosts() { public List<Post> hotPosts() {
return postRepository.findPostsByPostTypeOrderByPostViewsDesc(HaloConst.POST_TYPE_POST); return postRepository.findPostsByPostTypeOrderByPostViewsDesc(HaloConst.POST_TYPE_POST);
} }
/**
*
*
* @param post post
* @return List
*/
@Override
public List<Post> relatedPosts(Post post) {
//获取当前文章的所有标签
List<Tag> tags = post.getTags();
List<Post> tempPosts = new ArrayList<>();
for (Tag tag : tags) {
tempPosts.addAll(postRepository.findPostsByTags(tag));
}
//去掉当前的文章
tempPosts.remove(post);
//去掉重复的文章
List<Post> allPosts = new ArrayList<>();
for (int i = 0; i < tempPosts.size(); i++) {
if (!allPosts.contains(tempPosts.get(i))) {
allPosts.add(tempPosts.get(i));
}
}
return allPosts;
}
/** /**
* rss * rss
* *
* @param posts posts * @param posts posts
* @return string * @return String
*/ */
@Override @Override
public String buildRss(List<Post> posts) { public String buildRss(List<Post> posts) {
@ -346,7 +372,7 @@ public class PostServiceImpl implements PostService {
* sitemap * sitemap
* *
* @param posts posts * @param posts posts
* @return string * @return String
*/ */
@Override @Override
public String buildSiteMap(List<Post> posts) { public String buildSiteMap(List<Post> posts) {

View File

@ -47,7 +47,7 @@ public class TagServiceImpl implements TagService {
/** /**
* *
* *
* @return list * @return List
*/ */
@Override @Override
public List<Tag> findAllTags() { public List<Tag> findAllTags() {
@ -58,7 +58,7 @@ public class TagServiceImpl implements TagService {
* *
* *
* @param tagId tagId * @param tagId tagId
* @return Link * @return Optional
*/ */
@Override @Override
public Optional<Tag> findByTagId(Long tagId) { public Optional<Tag> findByTagId(Long tagId) {
@ -69,7 +69,7 @@ public class TagServiceImpl implements TagService {
* *
* *
* @param tagUrl tagUrl * @param tagUrl tagUrl
* @return tag * @return Tag
*/ */
@Override @Override
public Tag findByTagUrl(String tagUrl) { public Tag findByTagUrl(String tagUrl) {
@ -80,7 +80,7 @@ public class TagServiceImpl implements TagService {
* *
* *
* @param tagName tagName * @param tagName tagName
* @return tag * @return Tag
*/ */
@Override @Override
public Tag findTagByTagName(String tagName) { public Tag findTagByTagName(String tagName) {
@ -91,7 +91,7 @@ public class TagServiceImpl implements TagService {
* *
* *
* @param tagList tagList * @param tagList tagList
* @return list * @return List
*/ */
@Override @Override
public List<Tag> strListToTagList(String tagList) { public List<Tag> strListToTagList(String tagList) {

View File

@ -34,7 +34,7 @@ public class UserServiceImpl implements UserService {
* *
* @param userName userName * @param userName userName
* @param userPass userPass * @param userPass userPass
* @return user * @return User
*/ */
@Override @Override
public User userLoginByName(String userName, String userPass) { public User userLoginByName(String userName, String userPass) {
@ -46,7 +46,7 @@ public class UserServiceImpl implements UserService {
* *
* @param userEmail userEmail * @param userEmail userEmail
* @param userPass userPass * @param userPass userPass
* @return list * @return User
*/ */
@Override @Override
public User userLoginByEmail(String userEmail, String userPass) { public User userLoginByEmail(String userEmail, String userPass) {
@ -56,7 +56,7 @@ public class UserServiceImpl implements UserService {
/** /**
* *
* *
* @return list * @return User
*/ */
@Override @Override
public User findUser() { public User findUser() {

View File

@ -89,7 +89,7 @@ public class HaloUtils {
* *
* *
* @param filePath filePath * @param filePath filePath
* @return Map * @return ArrayList
*/ */
public static ArrayList<String> getFiles(String filePath) { public static ArrayList<String> getFiles(String filePath) {
try { try {
@ -117,7 +117,7 @@ public class HaloUtils {
* *
* *
* @param dir dir * @param dir dir
* @return List<BackupDto></> * @return List
*/ */
public static List<BackupDto> getBackUps(String dir) { public static List<BackupDto> getBackUps(String dir) {
String srcPathStr = System.getProperties().getProperty("user.home") + "/halo/backup/" + dir; String srcPathStr = System.getProperties().getProperty("user.home") + "/halo/backup/" + dir;
@ -149,7 +149,7 @@ public class HaloUtils {
* *
* *
* @param size size * @param size size
* @return string * @return String
*/ */
public static String parseSize(long size) { public static String parseSize(long size) {
if (size < 1024) { if (size < 1024) {
@ -196,7 +196,7 @@ public class HaloUtils {
/** /**
* *
* *
* @return list * @return List
*/ */
public static List<Theme> getThemes() { public static List<Theme> getThemes() {
List<Theme> themes = new ArrayList<>(); List<Theme> themes = new ArrayList<>();
@ -235,7 +235,7 @@ public class HaloUtils {
* *
* *
* @param theme theme * @param theme theme
* @return list * @return List
*/ */
public static List<String> getTplName(String theme) { public static List<String> getTplName(String theme) {
List<String> tpls = new ArrayList<>(); List<String> tpls = new ArrayList<>();
@ -271,7 +271,7 @@ public class HaloUtils {
* *
* *
* @param filePath filePath * @param filePath filePath
* @return string * @return String
*/ */
public static String getFileContent(String filePath) { public static String getFileContent(String filePath) {
File file = new File(filePath); File file = new File(filePath);
@ -384,7 +384,7 @@ public class HaloUtils {
* rss * rss
* *
* @param posts posts * @param posts posts
* @return string * @return String
* @throws FeedException * @throws FeedException
*/ */
public static String getRss(List<Post> posts) throws FeedException { public static String getRss(List<Post> posts) throws FeedException {
@ -435,7 +435,7 @@ public class HaloUtils {
* sitemap * sitemap
* *
* @param posts posts * @param posts posts
* @return string * @return String
*/ */
public static String getSiteMap(List<Post> posts) { public static String getSiteMap(List<Post> posts) {
String head = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">"; String head = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">";
@ -466,7 +466,7 @@ public class HaloUtils {
* 访json * 访json
* *
* @param enterUrl * @param enterUrl
* @return string * @return String
*/ */
public static String getHttpResponse(String enterUrl) { public static String getHttpResponse(String enterUrl) {
BufferedReader in = null; BufferedReader in = null;
@ -507,7 +507,7 @@ public class HaloUtils {
* @param blogUrl * @param blogUrl
* @param token token * @param token token
* @param urls * @param urls
* @return string * @return String
*/ */
public static String baiduPost(String blogUrl, String token, String urls) { public static String baiduPost(String blogUrl, String token, String urls) {
String url = "http://data.zz.baidu.com/urls?site=" + blogUrl + "&token=" + token; String url = "http://data.zz.baidu.com/urls?site=" + blogUrl + "&token=" + token;

View File

@ -11,7 +11,6 @@ import cc.ryanc.halo.service.CommentService;
import cc.ryanc.halo.service.LogsService; import cc.ryanc.halo.service.LogsService;
import cc.ryanc.halo.service.PostService; import cc.ryanc.halo.service.PostService;
import cc.ryanc.halo.service.UserService; import cc.ryanc.halo.service.UserService;
import cc.ryanc.halo.utils.HaloUtils;
import cc.ryanc.halo.web.controller.core.BaseController; import cc.ryanc.halo.web.controller.core.BaseController;
import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;

View File

@ -31,7 +31,10 @@ import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Random;
/** /**
* @author : RYAN0UP * @author : RYAN0UP
@ -101,7 +104,7 @@ public class AttachmentController {
* *
* @param file file * @param file file
* @param request request * @param request request
* @return Map<String , Object></> * @return Map
*/ */
@PostMapping(value = "/upload", produces = {"application/json;charset=UTF-8"}) @PostMapping(value = "/upload", produces = {"application/json;charset=UTF-8"})
@ResponseBody @ResponseBody
@ -115,7 +118,7 @@ public class AttachmentController {
* *
* @param file file * @param file file
* @param request request * @param request request
* @return Map<String , Object></> * @return Map
*/ */
@PostMapping(value = "/upload/editor", produces = {"application/json;charset=UTF-8"}) @PostMapping(value = "/upload/editor", produces = {"application/json;charset=UTF-8"})
@ResponseBody @ResponseBody
@ -130,7 +133,7 @@ public class AttachmentController {
* *
* @param file file * @param file file
* @param request request * @param request request
* @return Map<String , Object></> * @return Map
*/ */
private Map<String, Object> uploadAttachment(MultipartFile file, HttpServletRequest request) { private Map<String, Object> uploadAttachment(MultipartFile file, HttpServletRequest request) {
Map<String, Object> result = new HashMap<String, Object>(); Map<String, Object> result = new HashMap<String, Object>();

View File

@ -8,7 +8,6 @@ import cc.ryanc.halo.service.GalleryService;
import cc.ryanc.halo.service.LinkService; import cc.ryanc.halo.service.LinkService;
import cc.ryanc.halo.service.LogsService; import cc.ryanc.halo.service.LogsService;
import cc.ryanc.halo.service.PostService; import cc.ryanc.halo.service.PostService;
import cc.ryanc.halo.utils.HaloUtils;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.extra.servlet.ServletUtil; import cn.hutool.extra.servlet.ServletUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -25,7 +24,6 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import javax.websocket.server.PathParam; import javax.websocket.server.PathParam;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;

View File

@ -157,6 +157,10 @@ public class PostController extends BaseController {
public JsonResult pushPost(@ModelAttribute Post post, @RequestParam("cateList") List<String> cateList, @RequestParam("tagList") String tagList, HttpSession session) { public JsonResult pushPost(@ModelAttribute Post post, @RequestParam("cateList") List<String> cateList, @RequestParam("tagList") String tagList, HttpSession session) {
User user = (User) session.getAttribute(HaloConst.USER_SESSION_KEY); User user = (User) session.getAttribute(HaloConst.USER_SESSION_KEY);
String msg = "发表成功"; String msg = "发表成功";
//判断文章路径是否已经存在
if (null != postService.findByPostUrl(post.getPostUrl(), HaloConst.POST_TYPE_POST)) {
return new JsonResult(0, "该文章路径已存在!");
}
try { try {
//提取摘要 //提取摘要
int postSummary = 50; int postSummary = 50;

View File

@ -26,7 +26,6 @@ import javax.websocket.server.PathParam;
import java.io.File; import java.io.File;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -64,7 +63,7 @@ public class ThemeController extends BaseController {
* *
* @param siteTheme * @param siteTheme
* @param request request * @param request request
* @return truefalse * @return JsonResult
*/ */
@GetMapping(value = "/set") @GetMapping(value = "/set")
@ResponseBody @ResponseBody
@ -91,7 +90,7 @@ public class ThemeController extends BaseController {
* *
* *
* @param file * @param file
* @return boolean truefalse * @return JsonResult
*/ */
@RequestMapping(value = "/upload", method = RequestMethod.POST) @RequestMapping(value = "/upload", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ -193,7 +192,7 @@ public class ThemeController extends BaseController {
* *
* @param tplName * @param tplName
* @param tplContent * @param tplContent
* @return boolean truefalse * @return JsonResult
*/ */
@PostMapping(value = "/editor/save") @PostMapping(value = "/editor/save")
@ResponseBody @ResponseBody

View File

@ -42,7 +42,7 @@ public class UserController {
* *
* @param user user * @param user user
* @param session session * @param session session
* @return truefalse * @return JsonResult
*/ */
@PostMapping(value = "save") @PostMapping(value = "save")
@ResponseBody @ResponseBody
@ -69,7 +69,7 @@ public class UserController {
* @param newPass * @param newPass
* @param userId * @param userId
* @param session session * @param session session
* @return truefalse * @return JsonResult
*/ */
@PostMapping(value = "changePass") @PostMapping(value = "changePass")
@ResponseBody @ResponseBody

View File

@ -4,7 +4,10 @@ import cc.ryanc.halo.model.domain.Category;
import cc.ryanc.halo.model.dto.JsonResult; import cc.ryanc.halo.model.dto.JsonResult;
import cc.ryanc.halo.service.CategoryService; import cc.ryanc.halo.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;

View File

@ -23,7 +23,7 @@ public class CommonController implements ErrorController {
* 404500 * 404500
* *
* @param request request * @param request request
* @return string * @return String
*/ */
@GetMapping(value = ERROR_PATH) @GetMapping(value = ERROR_PATH)
public String handleError(HttpServletRequest request) { public String handleError(HttpServletRequest request) {
@ -39,7 +39,7 @@ public class CommonController implements ErrorController {
* 404 * 404
* *
* @param model model * @param model model
* @return string * @return String
*/ */
@GetMapping(value = "/404") @GetMapping(value = "/404")
public String fourZeroFour(Model model) { public String fourZeroFour(Model model) {
@ -52,7 +52,7 @@ public class CommonController implements ErrorController {
* 500 * 500
* *
* @param model model * @param model model
* @return string * @return String
*/ */
@GetMapping(value = "/500") @GetMapping(value = "/500")
public String fiveZeroZero(Model model) { public String fiveZeroZero(Model model) {

View File

@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**

View File

@ -17,7 +17,6 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;

View File

@ -34,6 +34,12 @@ public class FrontCategoryController extends BaseController {
@Autowired @Autowired
private PostService postService; private PostService postService;
/**
*
*
* @param model model
* @return String
*/
public String categories(Model model) { public String categories(Model model) {
List<Category> categories = categoryService.findAllCategories(); List<Category> categories = categoryService.findAllCategories();
model.addAttribute("categories", categories); model.addAttribute("categories", categories);
@ -59,7 +65,7 @@ public class FrontCategoryController extends BaseController {
* @param model model * @param model model
* @param cateUrl * @param cateUrl
* @param page * @param page
* @return string * @return String
*/ */
@GetMapping("{cateUrl}/page/{page}") @GetMapping("{cateUrl}/page/{page}")
public String categories(Model model, public String categories(Model model,

View File

@ -8,7 +8,6 @@ import cc.ryanc.halo.service.CommentService;
import cc.ryanc.halo.service.MailService; import cc.ryanc.halo.service.MailService;
import cc.ryanc.halo.service.PostService; import cc.ryanc.halo.service.PostService;
import cc.ryanc.halo.service.UserService; import cc.ryanc.halo.service.UserService;
import cc.ryanc.halo.utils.HaloUtils;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.URLUtil; import cn.hutool.core.util.URLUtil;
import cn.hutool.extra.servlet.ServletUtil; import cn.hutool.extra.servlet.ServletUtil;
@ -24,7 +23,10 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.*; import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -52,7 +54,7 @@ public class FrontCommentController {
* *
* *
* @param postId postId * @param postId postId
* @return List<Comment></> * @return List
*/ */
@GetMapping(value = "/getComment/{postId}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @GetMapping(value = "/getComment/{postId}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody @ResponseBody
@ -72,7 +74,7 @@ public class FrontCommentController {
* *
* @param page * @param page
* @param post * @param post
* @return List<Comment></> * @return List
*/ */
@GetMapping(value = "/loadComment") @GetMapping(value = "/loadComment")
@ResponseBody @ResponseBody
@ -90,7 +92,7 @@ public class FrontCommentController {
* @param comment comment * @param comment comment
* @param post post * @param post post
* @param request request * @param request request
* @return truefalse * @return JsonResult
*/ */
@PostMapping(value = "/newComment") @PostMapping(value = "/newComment")
@ResponseBody @ResponseBody

View File

@ -78,7 +78,7 @@ public class FrontIndexController extends BaseController {
* ajax * ajax
* *
* @param page page * @param page page
* @return List<Post></> * @return List
*/ */
@GetMapping(value = "next") @GetMapping(value = "next")
@ResponseBody @ResponseBody

View File

@ -47,7 +47,7 @@ public class FrontTagController extends BaseController {
* *
* @param tagUrl * @param tagUrl
* @param model model * @param model model
* @return string * @return String
*/ */
@GetMapping(value = "{tagUrl}") @GetMapping(value = "{tagUrl}")
public String tags(Model model, public String tags(Model model,
@ -61,7 +61,7 @@ public class FrontTagController extends BaseController {
* @param model model * @param model model
* @param tagUrl * @param tagUrl
* @param page * @param page
* @return string * @return String
*/ */
@GetMapping(value = "{tagUrl}/page/{page}") @GetMapping(value = "{tagUrl}/page/{page}")
public String tags(Model model, public String tags(Model model,

View File

@ -281,7 +281,8 @@
}); });
} }
$('#btn_input_postUrl').click(function () { $('#btn_input_postUrl').click(function () {
$('#postUrl').html("<input type='text' id='newPostUrl' onblur='urlOnBlurAuto()' value=''>"); var postUrl = $("#postUrl").html();
$('#postUrl').html("<input type='text' id='newPostUrl' onblur='urlOnBlurAuto()' value='"+postUrl+"'>");
$(this).hide(); $(this).hide();
$('#btn_change_postUrl').show(); $('#btn_change_postUrl').show();
}); });