调整数据库字段,优化部分接口 #1
@@ -7,9 +7,9 @@ import cn.celess.blog.entity.request.LinkReq;
|
||||
import cn.celess.blog.exception.MyException;
|
||||
import cn.celess.blog.service.MailService;
|
||||
import cn.celess.blog.service.PartnerSiteService;
|
||||
import cn.celess.blog.util.DateFormatUtil;
|
||||
import cn.celess.blog.util.RedisUtil;
|
||||
import cn.celess.blog.util.RegexUtil;
|
||||
import cn.celess.blog.util.DateFormatUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.mail.SimpleMailMessage;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -15,14 +15,18 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
package cn.celess.blog.enmu;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author: 小海
|
||||
* @Date: 2019/06/29 00:00
|
||||
* @Description: 文章数据模型转换的级别(响应参数的选择)
|
||||
*/
|
||||
@Getter
|
||||
public enum LevelEnum {
|
||||
//低级
|
||||
LOW(0),
|
||||
//中级
|
||||
MIDDLE(1),
|
||||
//另一个级别的转化
|
||||
BETWEEN_M_AND_H(2),
|
||||
//高级
|
||||
HEIGHT(3);
|
||||
|
||||
private int levelCode;
|
||||
|
||||
LevelEnum(int levelCode) {
|
||||
this.levelCode = levelCode;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -70,8 +70,8 @@ public enum ResponseEnum {
|
||||
PARAMETERS_QQ_ERROR(8540, "QQ格式错误"),
|
||||
PARAMETERS_PWD_ERROR(8550, "密码格式错误"),
|
||||
VERIFY_OUT(8400, "已经验证过了");
|
||||
private int code;
|
||||
private String msg;
|
||||
private final int code;
|
||||
private final String msg;
|
||||
|
||||
|
||||
ResponseEnum(int code, String msg) {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package cn.celess.blog.enmu;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: 小海
|
||||
* @Date: 2020-05-22 21:32
|
||||
@@ -26,7 +24,7 @@ public enum UserAccountStatusEnum {
|
||||
private final int code;
|
||||
private final String desc;
|
||||
|
||||
private UserAccountStatusEnum(int code, String desc) {
|
||||
UserAccountStatusEnum(int code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import cn.celess.blog.entity.Tag;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package cn.celess.blog.entity.model;
|
||||
|
||||
import cn.celess.blog.entity.Article;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package cn.celess.blog.entity.model;
|
||||
|
||||
import cn.celess.blog.entity.User;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cn.celess.blog.mapper;
|
||||
|
||||
import cn.celess.blog.entity.Article;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -34,7 +34,7 @@ public interface CommentMapper {
|
||||
|
||||
List<Comment> findAllByPagePath(String pagePath);
|
||||
|
||||
List<Comment> findAllByPagePathAndFromUser(String pagePath,long userId);
|
||||
List<Comment> findAllByPagePathAndFromUser(String pagePath, long userId);
|
||||
|
||||
List<Comment> findAllByPagePathAndPid(String pagePath, long pid);
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import cn.celess.blog.entity.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,6 @@ import cn.celess.blog.entity.WebUpdate;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package cn.celess.blog.service;
|
||||
|
||||
import cn.celess.blog.entity.Category;
|
||||
import cn.celess.blog.entity.model.CategoryModel;
|
||||
import cn.celess.blog.entity.model.PageData;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : xiaohai
|
||||
* @date : 2019/03/28 22:42
|
||||
|
||||
@@ -3,7 +3,6 @@ package cn.celess.blog.service;
|
||||
import cn.celess.blog.entity.model.CommentModel;
|
||||
import cn.celess.blog.entity.model.PageData;
|
||||
import cn.celess.blog.entity.request.CommentReq;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package cn.celess.blog.service;
|
||||
|
||||
import cn.celess.blog.entity.Tag;
|
||||
import cn.celess.blog.entity.model.PageData;
|
||||
import cn.celess.blog.entity.model.TagModel;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
package cn.celess.blog.service;
|
||||
|
||||
import cn.celess.blog.entity.User;
|
||||
import cn.celess.blog.entity.model.PageData;
|
||||
import cn.celess.blog.entity.model.UserModel;
|
||||
import cn.celess.blog.entity.request.LoginReq;
|
||||
import cn.celess.blog.entity.request.UserReq;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : xiaohai
|
||||
@@ -154,8 +149,9 @@ public interface UserService {
|
||||
|
||||
/**
|
||||
* 设置密码
|
||||
* @param pwd pwd
|
||||
* @param newPwd newPwd
|
||||
*
|
||||
* @param pwd pwd
|
||||
* @param newPwd newPwd
|
||||
* @param confirmPwd confirmPwd
|
||||
* @return UserModel
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,6 @@ package cn.celess.blog.service;
|
||||
|
||||
import cn.celess.blog.entity.model.PageData;
|
||||
import cn.celess.blog.entity.model.VisitorModel;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -2,7 +2,6 @@ package cn.celess.blog.service;
|
||||
|
||||
import cn.celess.blog.entity.model.PageData;
|
||||
import cn.celess.blog.entity.model.WebUpdateModel;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@@ -10,7 +10,10 @@ import cn.celess.blog.exception.MyException;
|
||||
import cn.celess.blog.mapper.*;
|
||||
import cn.celess.blog.service.ArticleService;
|
||||
import cn.celess.blog.service.UserService;
|
||||
import cn.celess.blog.util.*;
|
||||
import cn.celess.blog.util.ModalTrans;
|
||||
import cn.celess.blog.util.RedisUserUtil;
|
||||
import cn.celess.blog.util.RegexUtil;
|
||||
import cn.celess.blog.util.StringFromHtmlUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.youbenzi.mdtool.tool.MDTool;
|
||||
@@ -22,7 +25,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@ import cn.celess.blog.mapper.ArticleMapper;
|
||||
import cn.celess.blog.mapper.CommentMapper;
|
||||
import cn.celess.blog.mapper.UserMapper;
|
||||
import cn.celess.blog.service.CommentService;
|
||||
import cn.celess.blog.service.UserService;
|
||||
import cn.celess.blog.util.DateFormatUtil;
|
||||
import cn.celess.blog.util.ModalTrans;
|
||||
import cn.celess.blog.util.RedisUserUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
@@ -23,7 +21,6 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -76,10 +73,10 @@ public class CommentServiceImpl implements CommentService {
|
||||
@Override
|
||||
public boolean delete(long id) {
|
||||
Comment b = commentMapper.findCommentById(id);
|
||||
if (b == null ) {
|
||||
if (b == null) {
|
||||
throw new MyException(ResponseEnum.COMMENT_NOT_EXIST);
|
||||
}
|
||||
if(b.isDelete()){
|
||||
if (b.isDelete()) {
|
||||
throw new MyException(ResponseEnum.DATA_IS_DELETED);
|
||||
}
|
||||
commentMapper.delete(id);
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.io.InputStream;
|
||||
*/
|
||||
@Service
|
||||
public class QiniuServiceImpl implements QiniuService {
|
||||
private static Configuration cfg = new Configuration(Zone.zone2());
|
||||
private static final Configuration cfg = new Configuration(Zone.zone2());
|
||||
private static UploadManager uploadManager;
|
||||
private static BucketManager bucketManager;
|
||||
private static Auth auth;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package cn.celess.blog.service.serviceimpl;
|
||||
|
||||
import cn.celess.blog.enmu.ResponseEnum;
|
||||
import cn.celess.blog.entity.Article;
|
||||
import cn.celess.blog.entity.ArticleTag;
|
||||
import cn.celess.blog.entity.Tag;
|
||||
import cn.celess.blog.entity.TagCategory;
|
||||
import cn.celess.blog.entity.model.ArticleModel;
|
||||
import cn.celess.blog.entity.model.PageData;
|
||||
import cn.celess.blog.entity.model.TagModel;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class HttpUtil {
|
||||
try (
|
||||
InputStream inputStream = urlConnection.getInputStream();
|
||||
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
|
||||
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
|
||||
BufferedReader bufferedReader = new BufferedReader(inputStreamReader)
|
||||
) {
|
||||
//将bufferReader的值给放到buffer里
|
||||
String str = null;
|
||||
|
||||
@@ -21,17 +21,15 @@ import java.util.Map;
|
||||
@Component
|
||||
@Log4j2
|
||||
public class JwtUtil {
|
||||
private static final String CLAIM_KEY_USERNAME = "sub";
|
||||
|
||||
/**
|
||||
* 5天(毫秒)
|
||||
*/
|
||||
public static final long EXPIRATION_LONG_TIME = 432000000;
|
||||
|
||||
/**
|
||||
* 两小时(毫秒)
|
||||
*/
|
||||
public static final long EXPIRATION_SHORT_TIME = 7200000;
|
||||
private static final String CLAIM_KEY_USERNAME = "sub";
|
||||
/**
|
||||
* JWT 秘钥需自行设置不可泄露
|
||||
*/
|
||||
|
||||
@@ -20,8 +20,8 @@ import java.util.concurrent.TimeUnit;
|
||||
* Redis工具类
|
||||
*
|
||||
* @author WangFan
|
||||
* @date 2018-02-24 下午03:09:50
|
||||
* @version 1.1 (GitHub文档: https://github.com/whvcse/RedisUtil )
|
||||
* @date 2018-02-24 下午03:09:50
|
||||
*/
|
||||
|
||||
@Component
|
||||
@@ -29,14 +29,14 @@ public class RedisUtil {
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
public void setRedisTemplate(StringRedisTemplate redisTemplate) {
|
||||
this.redisTemplate = redisTemplate;
|
||||
}
|
||||
|
||||
public StringRedisTemplate getRedisTemplate() {
|
||||
return this.redisTemplate;
|
||||
}
|
||||
|
||||
public void setRedisTemplate(StringRedisTemplate redisTemplate) {
|
||||
this.redisTemplate = redisTemplate;
|
||||
}
|
||||
|
||||
/** -------------------key相关操作--------------------- */
|
||||
|
||||
/**
|
||||
@@ -196,6 +196,7 @@ public class RedisUtil {
|
||||
|
||||
/**
|
||||
* 设置指定 key 的值
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@@ -205,15 +206,17 @@ public class RedisUtil {
|
||||
|
||||
/**
|
||||
* 获取指定 key 的值
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public String get(String key) {
|
||||
return redisTemplate.opsForValue().get(key);
|
||||
return redisTemplate.opsForValue().get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回 key 中字符串值的子字符
|
||||
*
|
||||
* @param key
|
||||
* @param start
|
||||
* @param end
|
||||
@@ -259,10 +262,8 @@ public class RedisUtil {
|
||||
* 设置ASCII码, 字符串'a'的ASCII码是97, 转为二进制是'01100001', 此方法是将二进制第offset位值变为value
|
||||
*
|
||||
* @param key
|
||||
* @param postion
|
||||
* 位置
|
||||
* @param value
|
||||
* 值,true为1, false为0
|
||||
* @param offset 位置
|
||||
* @param value 值,true为1, false为0
|
||||
* @return
|
||||
*/
|
||||
public boolean setBit(String key, long offset, boolean value) {
|
||||
@@ -274,11 +275,9 @@ public class RedisUtil {
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @param timeout
|
||||
* 过期时间
|
||||
* @param unit
|
||||
* 时间单位, 天:TimeUnit.DAYS 小时:TimeUnit.HOURS 分钟:TimeUnit.MINUTES
|
||||
* 秒:TimeUnit.SECONDS 毫秒:TimeUnit.MILLISECONDS
|
||||
* @param timeout 过期时间
|
||||
* @param unit 时间单位, 天:TimeUnit.DAYS 小时:TimeUnit.HOURS 分钟:TimeUnit.MINUTES
|
||||
* 秒:TimeUnit.SECONDS 毫秒:TimeUnit.MILLISECONDS
|
||||
*/
|
||||
public void setEx(String key, String value, long timeout, TimeUnit unit) {
|
||||
redisTemplate.opsForValue().set(key, value, timeout, unit);
|
||||
@@ -289,7 +288,7 @@ public class RedisUtil {
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @return 之前已经存在返回false,不存在返回true
|
||||
* @return 之前已经存在返回false, 不存在返回true
|
||||
*/
|
||||
public boolean setIfAbsent(String key, String value) {
|
||||
return redisTemplate.opsForValue().setIfAbsent(key, value);
|
||||
@@ -300,8 +299,7 @@ public class RedisUtil {
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @param offset
|
||||
* 从指定位置开始覆写
|
||||
* @param offset 从指定位置开始覆写
|
||||
*/
|
||||
public void setRange(String key, String value, long offset) {
|
||||
redisTemplate.opsForValue().set(key, value, offset);
|
||||
@@ -330,7 +328,7 @@ public class RedisUtil {
|
||||
* 同时设置一个或多个 key-value 对,当且仅当所有给定 key 都不存在
|
||||
*
|
||||
* @param maps
|
||||
* @return 之前已经存在返回false,不存在返回true
|
||||
* @return 之前已经存在返回false, 不存在返回true
|
||||
*/
|
||||
public boolean multiSetIfAbsent(Map<String, String> maps) {
|
||||
return redisTemplate.opsForValue().multiSetIfAbsent(maps);
|
||||
@@ -340,7 +338,7 @@ public class RedisUtil {
|
||||
* 增加(自增长), 负数则为自减
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @param increment
|
||||
* @return
|
||||
*/
|
||||
public Long incrBy(String key, long increment) {
|
||||
@@ -348,9 +346,8 @@ public class RedisUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @param increment
|
||||
* @return
|
||||
*/
|
||||
public Double incrByFloat(String key, double increment) {
|
||||
@@ -526,10 +523,8 @@ public class RedisUtil {
|
||||
* 获取列表指定范围内的元素
|
||||
*
|
||||
* @param key
|
||||
* @param start
|
||||
* 开始位置, 0是开始位置
|
||||
* @param end
|
||||
* 结束位置, -1返回所有
|
||||
* @param start 开始位置, 0是开始位置
|
||||
* @param end 结束位置, -1返回所有
|
||||
* @return
|
||||
*/
|
||||
public List<String> lRange(String key, long start, long end) {
|
||||
@@ -548,7 +543,6 @@ public class RedisUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @return
|
||||
@@ -558,7 +552,6 @@ public class RedisUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @return
|
||||
@@ -591,7 +584,6 @@ public class RedisUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @return
|
||||
@@ -601,7 +593,6 @@ public class RedisUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @return
|
||||
@@ -611,7 +602,6 @@ public class RedisUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @return
|
||||
@@ -647,8 +637,7 @@ public class RedisUtil {
|
||||
* 通过索引设置列表元素的值
|
||||
*
|
||||
* @param key
|
||||
* @param index
|
||||
* 位置
|
||||
* @param index 位置
|
||||
* @param value
|
||||
*/
|
||||
public void lSet(String key, long index, String value) {
|
||||
@@ -669,10 +658,8 @@ public class RedisUtil {
|
||||
* 移出并获取列表的第一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止
|
||||
*
|
||||
* @param key
|
||||
* @param timeout
|
||||
* 等待时间
|
||||
* @param unit
|
||||
* 时间单位
|
||||
* @param timeout 等待时间
|
||||
* @param unit 时间单位
|
||||
* @return
|
||||
*/
|
||||
public String lBLeftPop(String key, long timeout, TimeUnit unit) {
|
||||
@@ -693,10 +680,8 @@ public class RedisUtil {
|
||||
* 移出并获取列表的最后一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止
|
||||
*
|
||||
* @param key
|
||||
* @param timeout
|
||||
* 等待时间
|
||||
* @param unit
|
||||
* 时间单位
|
||||
* @param timeout 等待时间
|
||||
* @param unit 时间单位
|
||||
* @return
|
||||
*/
|
||||
public String lBRightPop(String key, long timeout, TimeUnit unit) {
|
||||
@@ -734,9 +719,8 @@ public class RedisUtil {
|
||||
* 删除集合中值等于value得元素
|
||||
*
|
||||
* @param key
|
||||
* @param index
|
||||
* index=0, 删除所有值等于value的元素; index>0, 从头部开始删除第一个值等于value的元素;
|
||||
* index<0, 从尾部开始删除第一个值等于value的元素;
|
||||
* @param index index=0, 删除所有值等于value的元素; index>0, 从头部开始删除第一个值等于value的元素;
|
||||
* index<0, 从尾部开始删除第一个值等于value的元素;
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
@@ -981,8 +965,6 @@ public class RedisUtil {
|
||||
* 获取集合所有元素
|
||||
*
|
||||
* @param key
|
||||
* @param otherKeys
|
||||
* @param destKey
|
||||
* @return
|
||||
*/
|
||||
public Set<String> setMembers(String key) {
|
||||
@@ -1022,7 +1004,6 @@ public class RedisUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param options
|
||||
* @return
|
||||
@@ -1046,7 +1027,6 @@ public class RedisUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param values
|
||||
* @return
|
||||
@@ -1056,7 +1036,6 @@ public class RedisUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param values
|
||||
* @return
|
||||
@@ -1103,10 +1082,8 @@ public class RedisUtil {
|
||||
* 获取集合的元素, 从小到大排序
|
||||
*
|
||||
* @param key
|
||||
* @param start
|
||||
* 开始位置
|
||||
* @param end
|
||||
* 结束位置, -1查询所有
|
||||
* @param start 开始位置
|
||||
* @param end 结束位置, -1查询所有
|
||||
* @return
|
||||
*/
|
||||
public Set<String> zRange(String key, long start, long end) {
|
||||
@@ -1130,10 +1107,8 @@ public class RedisUtil {
|
||||
* 根据Score值查询集合元素
|
||||
*
|
||||
* @param key
|
||||
* @param min
|
||||
* 最小值
|
||||
* @param max
|
||||
* 最大值
|
||||
* @param min 最小值
|
||||
* @param max 最大值
|
||||
* @return
|
||||
*/
|
||||
public Set<String> zRangeByScore(String key, double min, double max) {
|
||||
@@ -1144,10 +1119,8 @@ public class RedisUtil {
|
||||
* 根据Score值查询集合元素, 从小到大排序
|
||||
*
|
||||
* @param key
|
||||
* @param min
|
||||
* 最小值
|
||||
* @param max
|
||||
* 最大值
|
||||
* @param min 最小值
|
||||
* @param max 最大值
|
||||
* @return
|
||||
*/
|
||||
public Set<TypedTuple<String>> zRangeByScoreWithScores(String key,
|
||||
@@ -1156,7 +1129,6 @@ public class RedisUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param min
|
||||
* @param max
|
||||
@@ -1224,7 +1196,6 @@ public class RedisUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param min
|
||||
* @param max
|
||||
@@ -1318,7 +1289,6 @@ public class RedisUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param otherKeys
|
||||
* @param destKey
|
||||
@@ -1359,7 +1329,6 @@ public class RedisUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param options
|
||||
* @return
|
||||
@@ -1370,6 +1339,7 @@ public class RedisUtil {
|
||||
|
||||
/**
|
||||
* 获取Redis List 序列化
|
||||
*
|
||||
* @param key
|
||||
* @param targetClass
|
||||
* @param <T>
|
||||
|
||||
@@ -33,18 +33,28 @@ import java.util.Map;
|
||||
@Component
|
||||
public class SitemapGenerateUtil {
|
||||
|
||||
@Autowired
|
||||
ArticleMapper articleMapper;
|
||||
@Value("${sitemap.path}")
|
||||
private String path;
|
||||
private Map<String, String> urlList;
|
||||
|
||||
@Autowired
|
||||
ArticleMapper articleMapper;
|
||||
private static DocumentBuilder getDocumentBuilder() {
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder db = null;
|
||||
try {
|
||||
db = dbf.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return db;
|
||||
}
|
||||
|
||||
@Async
|
||||
public void createSitemap() {
|
||||
initList();
|
||||
if ("".equals(path) || "classpath".equals(path)) {
|
||||
path = System.getProperty("user.dir")+"/sitemap.xml";
|
||||
path = System.getProperty("user.dir") + "/sitemap.xml";
|
||||
}
|
||||
File file = new File(path);
|
||||
try {
|
||||
@@ -96,17 +106,5 @@ public class SitemapGenerateUtil {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private static DocumentBuilder getDocumentBuilder() {
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder db = null;
|
||||
try {
|
||||
db = dbf.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return db;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user