👽 修复了一些放我犯强迫症的地方:)

pull/1/head
RYAN0UP_ 2018-03-26 17:52:50 +08:00
parent f57d8254e0
commit a6d72991ff
45 changed files with 70 additions and 63 deletions

View File

@ -11,8 +11,8 @@ import org.springframework.web.servlet.config.annotation.*;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2018/1/2
* @version : 1.0
* description:
*/
@Slf4j
@ -22,8 +22,6 @@ import org.springframework.web.servlet.config.annotation.*;
@PropertySource(value = "classpath:application.yaml",ignoreResourceNotFound = true,encoding = "UTF-8")
public class MvcConfiguration implements WebMvcConfigurer {
@Autowired
private LoginInterceptor loginInterceptor;

View File

@ -11,8 +11,8 @@ import java.util.Date;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2018/2/26
* @version : 1.0
* description :
*/

View File

@ -7,8 +7,8 @@ import java.util.List;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2018/1/20
* @version : 1.0
* description :
*/
@Data

View File

@ -15,6 +15,7 @@ import java.util.Map;
* description:
*/
public class HaloConst {
/**
* key,value
*/

View File

@ -2,9 +2,9 @@ package cc.ryanc.halo.model.dto;
/**
* @author : RYAN0UP
* @date : 2018/1/19
* @version : 1.0
* description :
* @date : 2018/1/19
*/
public interface LogsRecord {

View File

@ -6,8 +6,8 @@ import java.io.Serializable;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2018/1/3
* @version : 1.0
* description :
*/
@Data

View File

@ -7,9 +7,9 @@ import org.springframework.data.jpa.repository.JpaRepository;
/**
* @author : RYAN0UP
* @date : 2018/1/10
* @version : 1.0
* description :
* @date : 2018/1/10
*/
public interface AttachmentRepository extends JpaRepository<Attachment,Long>{

View File

@ -11,9 +11,9 @@ import java.util.List;
/**
* @author : RYAN0UP
* @date : 2018/1/22
* @version : 1.0
* description :
* @date : 2018/1/22
*/
public interface CommentRepository extends JpaRepository<Comment,Long> {

View File

@ -5,8 +5,8 @@ import org.springframework.data.jpa.repository.JpaRepository;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2018/2/26
* @version : 1.0
* description :
*/
public interface GalleryRepository extends JpaRepository<Gallery,Long> {

View File

@ -4,9 +4,9 @@ import cc.ryanc.halo.model.domain.Link;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* className: LinkRepository
* @author : RYAN0UP
* @date : 2017/11/14
* @version : 1.0
* description:
*/
public interface LinkRepository extends JpaRepository<Link,Long>{

View File

@ -8,8 +8,8 @@ import java.util.List;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2018/1/19
* @version : 1.0
* description :
*/
public interface LogsRepository extends JpaRepository<Logs,Long> {

View File

@ -8,8 +8,8 @@ import java.util.List;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2018/1/24
* @version : 1.0
* description :
*/
public interface MenuRepository extends JpaRepository<Menu,Long> {

View File

@ -13,8 +13,8 @@ import java.util.List;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2017/11/14
* @version : 1.0
* description :
*/
public interface PostRepository extends JpaRepository<Post,Long>{

View File

@ -5,9 +5,9 @@ import org.springframework.data.jpa.repository.JpaRepository;
/**
* @author : RYAN0UP
* @date : 2018/1/12
* @version : 1.0
* description :
* @date : 2018/1/12
*/
public interface TagRepository extends JpaRepository<Tag,Long>{

View File

@ -9,11 +9,12 @@ import java.util.Optional;
/**
* @author : RYAN0UP
* @date : 2018/1/10
* @version : 1.0
* description :
* @date : 2018/1/10
*/
public interface AttachmentService {
/**
*
*

View File

@ -12,6 +12,7 @@ import java.util.Optional;
* description :
*/
public interface CategoryService {
/**
*
*

View File

@ -10,8 +10,8 @@ import java.util.Optional;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2018/1/22
* @version : 1.0
* description :
*/
public interface CommentService {

View File

@ -9,8 +9,8 @@ import java.util.Optional;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2018/2/26
* @version : 1.0
* description :
*/
public interface GalleryService {

View File

@ -12,6 +12,7 @@ import java.util.Optional;
* description:
*/
public interface LinkService {
/**
*
*

View File

@ -9,9 +9,9 @@ import java.util.Optional;
/**
* @author : RYAN0UP
* @date : 2018/1/19
* @version : 1.0
* description :
* @date : 2018/1/19
*/
public interface LogsService {

View File

@ -4,9 +4,9 @@ import java.util.Map;
/**
* @author : RYAN0UP
* @date : 2018/1/23
* @version : 1.0
* description :
* @date : 2018/1/23
*/
public interface MailService {

View File

@ -7,9 +7,9 @@ import java.util.Optional;
/**
* @author : RYAN0UP
* @date : 2018/1/24
* @version : 1.0
* description :
* @date : 2018/1/24
*/
public interface MenuService {

View File

@ -12,7 +12,6 @@ import java.util.Map;
*/
public interface OptionsService {
/**
*
*

View File

@ -17,6 +17,7 @@ import java.util.Optional;
* description :
*/
public interface PostService {
/**
*
*

View File

@ -7,8 +7,8 @@ import java.util.Optional;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2018/1/12
* @version : 1.0
* description :
*/
public interface TagService {

View File

@ -7,11 +7,12 @@ import java.util.List;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2017/11/14
* @version : 1.0
* description:
*/
public interface UserService {
/**
*
*
@ -41,7 +42,7 @@ public interface UserService {
*
* @return list
*/
List<User> findAllUser();
User findUser();
/**
*

View File

@ -13,9 +13,9 @@ import java.util.Optional;
/**
* @author : RYAN0UP
* @date : 2018/1/10
* @version : 1.0
* description :
* @date : 2018/1/10
*/
@Service
public class AttachmentServiceImpl implements AttachmentService{

View File

@ -15,9 +15,9 @@ import java.util.Optional;
/**
* @author : RYAN0UP
* @date : 2018/1/22
* @version : 1.0
* description :
* @date : 2018/1/22
*/
@Service
public class CommentServiceImpl implements CommentService {

View File

@ -13,8 +13,8 @@ import java.util.Optional;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2018/2/26
* @version : 1.0
* description :
*/
@Service

View File

@ -13,9 +13,9 @@ import java.util.Optional;
/**
* @author : RYAN0UP
* @date : 2018/1/19
* @version : 1.0
* description :
* @date : 2018/1/19
*/
@Service
public class LogsServiceImpl implements LogsService {

View File

@ -14,9 +14,9 @@ import java.util.Map;
/**
* @author : RYAN0UP
* @date : 2018/1/23
* @version : 1.0
* description :
* @date : 2018/1/23
*/
@Service
public class MailServiceImpl implements MailService{

View File

@ -11,9 +11,9 @@ import java.util.Optional;
/**
* @author : RYAN0UP
* @date : 2018/1/24
* @version : 1.0
* description :
* @date : 2018/1/24
*/
@Service
public class MenuServiceImpl implements MenuService{

View File

@ -15,8 +15,8 @@ import java.util.Map;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2017/11/14
* @version : 1.0
* description:
*/
@Service

View File

@ -11,8 +11,8 @@ import java.util.Optional;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2018/1/12
* @version : 1.0
* description :
*/
@Service

View File

@ -11,8 +11,8 @@ import java.util.List;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2017/11/14
* @version : 1.0
* description:
*/
@Service
@ -61,8 +61,8 @@ public class UserServiceImpl implements UserService {
* @return list
*/
@Override
public List<User> findAllUser() {
return userRepository.findAll();
public User findUser() {
return userRepository.findAll().get(0);
}
/**
@ -84,7 +84,7 @@ public class UserServiceImpl implements UserService {
*/
@Override
public void updateUserLoginEnable(String enable) {
User user = this.findAllUser().get(0);
User user = this.findUser();
user.setLoginEnable(enable);
userRepository.save(user);
}
@ -96,7 +96,7 @@ public class UserServiceImpl implements UserService {
*/
@Override
public User updateUserLoginLast(Date lastDate) {
User user = this.findAllUser().get(0);
User user = this.findUser();
user.setLoginLast(lastDate);
userRepository.save(user);
return user;
@ -109,7 +109,7 @@ public class UserServiceImpl implements UserService {
*/
@Override
public Integer updateUserLoginError() {
User user = this.findAllUser().get(0);
User user = this.findUser();
user.setLoginError(user.getLoginError()+1);
userRepository.save(user);
return user.getLoginError();
@ -120,7 +120,7 @@ public class UserServiceImpl implements UserService {
*/
@Override
public User updateUserNormal() {
User user = this.findAllUser().get(0);
User user = this.findUser();
user.setLoginEnable("true");
user.setLoginError(0);
user.setLoginLast(new Date());

View File

@ -100,8 +100,8 @@ public class IndexController extends BaseController{
model.addAttribute("is_home",true);
//用户信息
List<User> users = userService.findAllUser();
model.addAttribute("user",users.get(0));
User user = userService.findUser();
model.addAttribute("user",user);
//所有分类目录
List<Category> categories = categoryService.findAllCategories();
@ -177,8 +177,8 @@ public class IndexController extends BaseController{
model.addAttribute("postsCount",postService.findAllPosts().size());
//用户信息
List<User> users = userService.findAllUser();
model.addAttribute("user",users.get(0));
User user = userService.findUser();
model.addAttribute("user",user);
//所有分类目录
List<Category> categories = categoryService.findAllCategories();
@ -267,8 +267,8 @@ public class IndexController extends BaseController{
model.addAttribute("links",links);
//用户信息
List<User> users = userService.findAllUser();
model.addAttribute("user",users.get(0));
User user = userService.findUser();
model.addAttribute("user",user);
model.addAttribute("is_links",true);
@ -308,8 +308,8 @@ public class IndexController extends BaseController{
List<Category> categories = categoryService.findAllCategories();
model.addAttribute("categories",categories);
List<User> users = userService.findAllUser();
model.addAttribute("user",users.get(0));
User user = userService.findUser();
model.addAttribute("user",user);
//文章总数
model.addAttribute("postsCount",postService.findAllPosts().size());
@ -380,8 +380,8 @@ public class IndexController extends BaseController{
model.addAttribute("archives",archives);
//用户信息
List<User> users = userService.findAllUser();
model.addAttribute("user",users.get(0));
User user = userService.findUser();
model.addAttribute("user",user);
//菜单列表
List<Menu> menus = menuService.findAllMenus();
@ -424,8 +424,8 @@ public class IndexController extends BaseController{
model.addAttribute("postsCount",postService.findAllPosts().size());
//用户信息
List<User> users = userService.findAllUser();
model.addAttribute("user",users.get(0));
User user = userService.findUser();
model.addAttribute("user",user);
//分类目录
List<Category> categories = categoryService.findAllCategories();
@ -505,12 +505,12 @@ public class IndexController extends BaseController{
try {
//发送邮件到博主
Map<String,Object> map = new HashMap<>();
map.put("author",userService.findAllUser().get(0).getUserDisplayName());
map.put("author",userService.findUser().getUserDisplayName());
map.put("pageName",postService.findByPostId(post.getPostId()).get().getPostTitle());
map.put("siteUrl",HaloConst.OPTIONS.get("site_url"));
map.put("visitor",comment.getCommentAuthor());
map.put("commentContent",comment.getCommentContent());
mailService.sendTemplateMail(userService.findAllUser().get(0).getUserEmail(),"有新的评论",map,"common/mail/mail_admin.ftl");
mailService.sendTemplateMail(userService.findUser().getUserEmail(),"有新的评论",map,"common/mail/mail_admin.ftl");
}catch (Exception e){
log.error("邮件服务器未配置:"+e.getMessage());
}

View File

@ -21,8 +21,8 @@ import java.util.List;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2018/1/28
* @version : 1.0
* description :
*/
@Slf4j

View File

@ -120,7 +120,7 @@ public class AdminController extends BaseController{
HttpSession session){
String status = "false";
try {
User aUser = userService.findAllUser().get(0);
User aUser = userService.findUser();
User user = null;
if("false".equals(aUser.getLoginEnable())){
status = "disable";

View File

@ -29,7 +29,6 @@ public class BackupController {
@Autowired
private PostService postService;
/**
*
*

View File

@ -125,7 +125,7 @@ public class CommentController extends BaseController{
map.put("commentContent", comment.getCommentContent());
map.put("siteUrl", HaloConst.OPTIONS.get("site_url"));
map.put("siteTitle", HaloConst.OPTIONS.get("site_title"));
map.put("author", userService.findAllUser().get(0).getUserDisplayName());
map.put("author", userService.findUser().getUserDisplayName());
mailService.sendTemplateMail(
comment.getCommentAuthorEmail(),
"您在" + HaloConst.OPTIONS.get("site_title") + "的评论已审核通过!", map, "common/mail/mail_passed.ftl");
@ -184,6 +184,10 @@ public class CommentController extends BaseController{
//被回复的评论
Comment lastComment = commentService.findCommentById(commentId).get();
//修改被回复的评论的状态
lastComment.setCommentStatus(0);
commentService.saveByComment(lastComment);
//保存评论
Comment comment = new Comment();
comment.setPost(post);
@ -191,7 +195,7 @@ public class CommentController extends BaseController{
comment.setCommentAuthorEmail(user.getUserEmail());
comment.setCommentAuthorUrl(HaloConst.OPTIONS.get("site_url"));
comment.setCommentAuthorIp(HaloUtil.getIpAddr(request));
comment.setCommentAuthorAvatarMd5(HaloUtil.getMD5(userService.findAllUser().get(0).getUserEmail()));
comment.setCommentAuthorAvatarMd5(HaloUtil.getMD5(userService.findUser().getUserEmail()));
comment.setCommentDate(new Date());
String lastContent = " //<a href='#'>@"+lastComment.getCommentAuthor()+"</a>:"+lastComment.getCommentContent();
comment.setCommentContent(commentContent+lastContent);

View File

@ -9,8 +9,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2018/2/26
* @version : 1.0
* description :
*/
@Slf4j

View File

@ -16,9 +16,9 @@ import java.util.List;
/**
* @author : RYAN0UP
* @date : 2018/1/30
* @version : 1.0
* description :
* @date : 2018/1/30
*/
@Slf4j
@Controller

View File

@ -33,7 +33,7 @@ public class UserController {
*/
@GetMapping
public String profile(Model model){
model.addAttribute("user",userService.findAllUser().get(0));
model.addAttribute("user",userService.findUser());
//设置选项
model.addAttribute("options",HaloConst.OPTIONS);
return "admin/admin_profile";

View File

@ -11,8 +11,8 @@ import java.io.File;
/**
* @author : RYAN0UP
* @version : 1.0
* @date : 2018/1/28
* @version : 1.0
* description :
*/
@Component

View File

@ -61,6 +61,7 @@
<#break >
<#case 1>
<a class="btn btn-info btn-sm btn-flat" href="/admin/comments/revert?commentId=${comment.commentId}&status=1">通过</a>
<a class="btn btn-primary btn-sm btn-flat" onclick="replyShow('${comment.commentId}','${comment.post.postId}')">通过并回复</a>
<button class="btn btn-danger btn-sm btn-flat" onclick="modelShow('/admin/comments/throw?commentId=${comment.commentId}','确定移动到回收站?')">丢弃</button>
<#break >
<#case 2>