💬 添加代码注释和方法名变更
This commit is contained in:
parent
659c1b7166
commit
6b67f4c6b0
@ -8,28 +8,35 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ronger
|
||||||
|
*/
|
||||||
public interface CommentMapper extends Mapper<Comment> {
|
public interface CommentMapper extends Mapper<Comment> {
|
||||||
/**
|
/**
|
||||||
|
* 获取文章评论列表
|
||||||
* @param idArticle
|
* @param idArticle
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<CommentDTO> selectArticleComments(@Param("idArticle") Integer idArticle);
|
List<CommentDTO> selectArticleComments(@Param("idArticle") Integer idArticle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 查询评论作者
|
||||||
* @param commentAuthorId
|
* @param commentAuthorId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Author selectAuthor(@Param("commentAuthorId") Integer commentAuthorId);
|
Author selectAuthor(@Param("commentAuthorId") Integer commentAuthorId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 查询父评论作者
|
||||||
* @param commentOriginalCommentId
|
* @param commentOriginalCommentId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Author selectCommentOriginalAuthor(@Param("commentOriginalCommentId") Integer commentOriginalCommentId);
|
Author selectCommentOriginalAuthor(@Param("commentOriginalCommentId") Integer commentOriginalCommentId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 更新文章评论分享链接
|
||||||
* @param idComment
|
* @param idComment
|
||||||
* @param toString
|
* @param commentSharpUrl
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Integer updateCommentSharpUrl(@Param("idComment") Integer idComment, @Param("commentSharpUrl") String commentSharpUrl);
|
Integer updateCommentSharpUrl(@Param("idComment") Integer idComment, @Param("commentSharpUrl") String commentSharpUrl);
|
||||||
|
@ -7,20 +7,64 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ronger
|
||||||
|
*/
|
||||||
public interface TagMapper extends Mapper<Tag> {
|
public interface TagMapper extends Mapper<Tag> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入标签文章表(vertical_tag_article)相关信息
|
||||||
|
* @param idTag
|
||||||
|
* @param idArticle
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Integer insertTagArticle(@Param("idTag") Integer idTag, @Param("idArticle") Integer idArticle);
|
Integer insertTagArticle(@Param("idTag") Integer idTag, @Param("idArticle") Integer idArticle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计标签使用数(文章)
|
||||||
|
* @param idTag
|
||||||
|
* @param idArticle
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Integer selectCountTagArticleById(@Param("idTag") Integer idTag, @Param("idArticle") Integer idArticle);
|
Integer selectCountTagArticleById(@Param("idTag") Integer idTag, @Param("idArticle") Integer idArticle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户标签数
|
||||||
|
* @param idUser
|
||||||
|
* @param idTag
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Integer selectCountUserTagById(@Param("idUser") Integer idUser, @Param("idTag") Integer idTag);
|
Integer selectCountUserTagById(@Param("idUser") Integer idUser, @Param("idTag") Integer idTag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入用户标签信息
|
||||||
|
* @param idTag
|
||||||
|
* @param idUser
|
||||||
|
* @param type
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Integer insertUserTag(@Param("idTag") Integer idTag, @Param("idUser") Integer idUser, @Param("type") Integer type);
|
Integer insertUserTag(@Param("idTag") Integer idTag, @Param("idUser") Integer idUser, @Param("type") Integer type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除未使用标签
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Integer deleteUnusedTag();
|
Integer deleteUnusedTag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新标签信息
|
||||||
|
* @param idTag
|
||||||
|
* @param tagUri
|
||||||
|
* @param tagIconPath
|
||||||
|
* @param tagStatus
|
||||||
|
* @param tagDescription
|
||||||
|
* @param tagReservation
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Integer update(@Param("idTag") Integer idTag, @Param("tagUri") String tagUri, @Param("tagIconPath") String tagIconPath, @Param("tagStatus") String tagStatus, @Param("tagDescription") String tagDescription, @Param("tagReservation") String tagReservation);
|
Integer update(@Param("idTag") Integer idTag, @Param("tagUri") String tagUri, @Param("tagIconPath") String tagIconPath, @Param("tagStatus") String tagStatus, @Param("tagDescription") String tagDescription, @Param("tagReservation") String tagReservation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 查询标签列表
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<LabelModel> selectTagLabels();
|
List<LabelModel> selectTagLabels();
|
||||||
|
@ -100,7 +100,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = { UnsupportedEncodingException.class,BaseApiException.class })
|
@Transactional(rollbackFor = { UnsupportedEncodingException.class, BaseApiException.class })
|
||||||
public Map postArticle(ArticleDTO article, HttpServletRequest request) throws UnsupportedEncodingException, BaseApiException {
|
public Map postArticle(ArticleDTO article, HttpServletRequest request) throws UnsupportedEncodingException, BaseApiException {
|
||||||
Map map = new HashMap(1);
|
Map map = new HashMap(1);
|
||||||
if(StringUtils.isBlank(article.getArticleTitle())){
|
if(StringUtils.isBlank(article.getArticleTitle())){
|
||||||
@ -161,7 +161,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
|||||||
newArticle.setUpdatedTime(new Date());
|
newArticle.setUpdatedTime(new Date());
|
||||||
articleMapper.updateArticleContent(newArticle.getIdArticle(),articleContent,articleContentHtml);
|
articleMapper.updateArticleContent(newArticle.getIdArticle(),articleContent,articleContentHtml);
|
||||||
if (!ProjectConstant.ENV.equals(env) && defaultStatus.equals(newArticle.getArticleStatus())) {
|
if (!ProjectConstant.ENV.equals(env) && defaultStatus.equals(newArticle.getArticleStatus())) {
|
||||||
BaiDuUtils.updateSEOData(newArticle.getArticlePermalink());
|
BaiDuUtils.sendUpdateSEOData(newArticle.getArticlePermalink());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArticleDTO genArticle(ArticleDTO article,Integer type) {
|
private ArticleDTO genArticle(ArticleDTO article, Integer type) {
|
||||||
Author author = articleMapper.selectAuthor(article.getArticleAuthorId());
|
Author author = articleMapper.selectAuthor(article.getArticleAuthorId());
|
||||||
article.setArticleAuthor(author);
|
article.setArticleAuthor(author);
|
||||||
article.setTimeAgo(Utils.getTimeAgo(article.getUpdatedTime()));
|
article.setTimeAgo(Utils.getTimeAgo(article.getUpdatedTime()));
|
||||||
|
@ -48,7 +48,8 @@ public class JavaMailServiceImpl implements JavaMailService {
|
|||||||
private String USERNAME;
|
private String USERNAME;
|
||||||
@Value("${spring.mail.password}")
|
@Value("${spring.mail.password}")
|
||||||
private String PASSWORD;
|
private String PASSWORD;
|
||||||
private final static String BASE_URL = "https://rymcu.com";
|
@Value("${resource.domain}")
|
||||||
|
private String BASE_URL;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer sendEmailCode(String email) throws MessagingException {
|
public Integer sendEmailCode(String email) throws MessagingException {
|
||||||
|
@ -7,9 +7,12 @@ import org.springframework.beans.factory.annotation.Value;
|
|||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ronger
|
||||||
|
*/
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class BaiduCronTask {
|
public class BaiDuCronTask {
|
||||||
|
|
||||||
@Value("${resource.domain}")
|
@Value("${resource.domain}")
|
||||||
private String domain;
|
private String domain;
|
||||||
@ -22,7 +25,7 @@ public class BaiduCronTask {
|
|||||||
@Scheduled(cron = "0 0 10,14,18 * * ?")
|
@Scheduled(cron = "0 0 10,14,18 * * ?")
|
||||||
public void pushHome() {
|
public void pushHome() {
|
||||||
if (!ProjectConstant.ENV.equals(env)) {
|
if (!ProjectConstant.ENV.equals(env)) {
|
||||||
BaiDuUtils.updateSEOData(domain);
|
BaiDuUtils.sendUpdateSEOData(domain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -11,8 +11,9 @@ import java.util.concurrent.*;
|
|||||||
*/
|
*/
|
||||||
public class BaiDuUtils {
|
public class BaiDuUtils {
|
||||||
|
|
||||||
private static String token = "9cdKR6bVCJzxDEJS";
|
private final static String token = "9cdKR6bVCJzxDEJS";
|
||||||
private static String site = "https://rymcu.com";
|
|
||||||
|
private final static String site = "https://rymcu.com";
|
||||||
|
|
||||||
public static void sendSEOData(String permalink) {
|
public static void sendSEOData(String permalink) {
|
||||||
if (StringUtils.isBlank(permalink) || StringUtils.isBlank(token)) {
|
if (StringUtils.isBlank(permalink) || StringUtils.isBlank(token)) {
|
||||||
@ -55,28 +56,6 @@ public class BaiDuUtils {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
},executor);
|
},executor);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void updateSEOData(String permalink) {
|
|
||||||
if (StringUtils.isBlank(permalink) || StringUtils.isBlank(token)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ExecutorService executor= new ThreadPoolExecutor(1,1,0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
|
|
||||||
CompletableFuture.supplyAsync(()-> {
|
|
||||||
try {
|
|
||||||
HttpResponse response = HttpRequest.post("http://data.zz.baidu.com/update?site=" + site + "&token=" + token).
|
|
||||||
header("User-Agent", "curl/7.12.1").
|
|
||||||
header("Host", "data.zz.baidu.com").
|
|
||||||
header("Content-Type", "text/plain").
|
|
||||||
header("Connection", "close").body(permalink.getBytes(), "text/plain").timeout(30000).send();
|
|
||||||
response.charset("UTF-8");
|
|
||||||
System.out.println(response.bodyText());
|
|
||||||
} catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
},executor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void deleteSEOData(String permalink) {
|
public static void deleteSEOData(String permalink) {
|
||||||
|
@ -6,7 +6,6 @@ import com.rymcu.vertical.core.result.GlobalResult;
|
|||||||
import com.rymcu.vertical.core.result.GlobalResultGenerator;
|
import com.rymcu.vertical.core.result.GlobalResultGenerator;
|
||||||
import com.rymcu.vertical.dto.ArticleDTO;
|
import com.rymcu.vertical.dto.ArticleDTO;
|
||||||
import com.rymcu.vertical.dto.LabelModel;
|
import com.rymcu.vertical.dto.LabelModel;
|
||||||
import com.rymcu.vertical.entity.Tag;
|
|
||||||
import com.rymcu.vertical.service.ArticleService;
|
import com.rymcu.vertical.service.ArticleService;
|
||||||
import com.rymcu.vertical.service.TagService;
|
import com.rymcu.vertical.service.TagService;
|
||||||
import com.rymcu.vertical.util.Utils;
|
import com.rymcu.vertical.util.Utils;
|
||||||
|
Loading…
Reference in New Issue
Block a user