非空验证代码:

public class StringUtils {

  1. public class StringUtils {
  2. /**
  3. * 对字符串进行非空校验*/
  4. public static boolean isNotEmpty(String... strs){
  5. boolean r=true;
  6. for(String s:strs){
  7. if(s==null || s.length()==0){
  8. r=false;
  9. break;
  10. }
  11. }
  12. return r;
  13. }
  14. }

随机生成指定位数的数字:

  1. public class NumUtils {
  2. /**
  3. * 随机生成指定位数的数字*/
  4. public static int createNum(int len){
  5. Random random=new Random();
  6. return random.nextInt((int)(Math.pow(10,len)-Math.pow(10,len-1)))
  7. +(int)Math.pow(10,len-1);
  8. }
  9. }

JWT算法生成令牌:

  1. public class JwtUtils {
  2. /**
  3. * 生成令牌
  4. * @param msg 内容,令牌携带的数据*/
  5. public static String createToken(String msg){
  6. return Jwts.builder().
  7. signWith(SignatureAlgorithm.HS256,"studyquestion_"+System.currentTimeMillis()).
  8. setSubject(msg).compact();
  9. }
  10. public static void main(String[] args) {
  11. System.err.println(createToken("测试"));
  12. }
  13. }

文件名的重命名:保证唯一

  1. public class FileUtils {
  2. /**
  3. * 实现文件名的重命名,保证唯一性*/
  4. public static String reName(String name){
  5. if(name.length()> SystemConfig.FILE_LENGTH){
  6. name=name.substring(name.length()-SystemConfig.FILE_LENGTH);
  7. }
  8. return UUID.randomUUID().toString().replaceAll("-","")+"_"+name;
  9. }
  10. }

密钥模板:实现常用加解密(SHA,AES,RSA,Base64)

  1. public class EncryptUtil {
  2. public static final String SHA1 = "SHA-1";
  3. public static final String SHA256 = "SHA-256";
  4. public static final String SHA384 = "SHA-384";
  5. public static final String SHA512 = "SHA-512";
  6. public static final String PUBKEY = "public_key";
  7. public static final String PRIKEY = "private_key";
  8. //1、编码格式
  9. //base64 编码
  10. public static String base64enc(String msg) {
  11. return Base64.getEncoder ().encodeToString (msg.getBytes ());
  12. }
  13. private static String base64encByte(byte[] msg) {
  14. return Base64.getEncoder ().encodeToString (msg);
  15. }
  16. private static byte[] base64decByte(String msg) {
  17. return Base64.getDecoder ().decode (msg);
  18. }
  19. //
  20. // base64 解码
  21. public static String base64dec(String msg) {
  22. return new String (Base64.getDecoder ().decode (msg));
  23. }
  24. //MD5 摘要
  25. public static String md5(String msg) {
  26. try {
  27. //创建摘要算法对象
  28. MessageDigest messageDigest = MessageDigest.getInstance ("MD5");
  29. messageDigest.update (msg.getBytes ());
  30. return base64encByte (messageDigest.digest ());
  31. } catch (NoSuchAlgorithmException e) {
  32. e.printStackTrace ();
  33. }
  34. return null;
  35. }
  36. //SHA 摘要 SHA-1 SHA-256 SHA-384 SHA-512
  37. public static String sha(String type, String msg) {
  38. try {
  39. //创建摘要算法对象
  40. MessageDigest messageDigest = MessageDigest.getInstance (type);
  41. messageDigest.update (msg.getBytes ());
  42. return base64encByte (messageDigest.digest ());
  43. } catch (NoSuchAlgorithmException e) {
  44. e.printStackTrace ();
  45. }
  46. return null;
  47. }
  48. //创建 对称加密---密钥
  49. public static String createAESKey() {
  50. try {
  51. //1、创建随机key
  52. KeyGenerator generator = KeyGenerator.getInstance ("AES");
  53. generator.init (128);
  54. SecretKey key = generator.generateKey ();
  55. return base64encByte (key.getEncoded ());
  56. } catch (NoSuchAlgorithmException e) {
  57. e.printStackTrace ();
  58. }
  59. return null;
  60. }
  61. //AES 加密 返回的是base64格式
  62. public static String aesenc(String key, String msg) {
  63. SecretKeySpec secretKeySpec = new SecretKeySpec (base64decByte (key), "AES");
  64. try {
  65. Cipher cipher = Cipher.getInstance ("AES");
  66. cipher.init (Cipher.ENCRYPT_MODE, secretKeySpec);
  67. return base64encByte (cipher.doFinal (msg.getBytes ()));
  68. } catch (Exception e) {
  69. e.printStackTrace ();
  70. }
  71. return null;
  72. }
  73. //AES 解密 返回的是base64格式
  74. public static String aesdec(String key, String msg) {
  75. SecretKeySpec secretKeySpec = new SecretKeySpec (base64decByte (key), "AES");
  76. try {
  77. Cipher cipher = Cipher.getInstance ("AES");
  78. cipher.init (Cipher.DECRYPT_MODE, secretKeySpec);
  79. return new String (cipher.doFinal (base64decByte (msg)));
  80. } catch (Exception e) {
  81. e.printStackTrace ();
  82. }
  83. return null;
  84. }
  85. //创建-RSA 密钥 一对儿 公私钥
  86. public static HashMap<String, String> createRSAKey() {
  87. try {
  88. KeyPairGenerator generator = KeyPairGenerator.getInstance ("RSA");
  89. KeyPair keyPair = generator.generateKeyPair ();
  90. //创建使用私钥
  91. RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate ();
  92. //创建使用公钥
  93. RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic ();
  94. HashMap<String, String> keys = new HashMap<> ();
  95. keys.put (PUBKEY, base64encByte (publicKey.getEncoded ()));
  96. keys.put (PRIKEY, base64encByte (privateKey.getEncoded ()));
  97. return keys;
  98. } catch (NoSuchAlgorithmException e) {
  99. e.printStackTrace ();
  100. }
  101. return null;
  102. }
  103. /**
  104. * rsa 公钥-加密*/
  105. public static String rsaEncPub(String key,String msg){
  106. X509EncodedKeySpec keySpec = new X509EncodedKeySpec(base64decByte(key));
  107. try {
  108. KeyFactory keyFactory = KeyFactory.getInstance ("RSA");
  109. PublicKey publicKey = keyFactory.generatePublic (keySpec);
  110. Cipher cipher = Cipher.getInstance ("RSA");
  111. cipher.init (Cipher.ENCRYPT_MODE, publicKey);
  112. return base64encByte(cipher.doFinal(msg.getBytes()));
  113. } catch (Exception e) {
  114. e.printStackTrace();
  115. }
  116. return null;
  117. }
  118. //RSA 私钥-加密
  119. public static String rsaEnc(String key, String msg) {
  120. try {
  121. //转换私钥
  122. PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec (base64decByte (key));
  123. KeyFactory keyFactory = KeyFactory.getInstance ("RSA");
  124. PrivateKey privateKey = keyFactory.generatePrivate (keySpec);
  125. Cipher cipher = Cipher.getInstance ("RSA");
  126. cipher.init (Cipher.ENCRYPT_MODE, privateKey);
  127. return base64encByte(cipher.doFinal(msg.getBytes()));
  128. } catch (Exception e) {
  129. e.printStackTrace ();
  130. }
  131. return null;
  132. }
  133. //RSA 公钥-解密
  134. public static String rsaDec(String key, String msg) {
  135. try {
  136. //转换公钥
  137. X509EncodedKeySpec keySpec = new X509EncodedKeySpec (base64decByte (key));
  138. KeyFactory keyFactory = KeyFactory.getInstance ("RSA");
  139. PublicKey publicKey = keyFactory.generatePublic (keySpec);
  140. Cipher cipher = Cipher.getInstance ("RSA");
  141. cipher.init (Cipher.DECRYPT_MODE, publicKey);
  142. return new String (cipher.doFinal (base64decByte (msg)), "UTF-8");
  143. } catch (Exception e) {
  144. e.printStackTrace ();
  145. }
  146. return null;
  147. }
  148. /**
  149. * RSA 私钥-解密
  150. */
  151. public static String rsaDecPri(String key, String msg) {
  152. try {
  153. //转换私钥
  154. PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec (base64decByte (key));
  155. KeyFactory keyFactory = KeyFactory.getInstance ("RSA");
  156. PrivateKey privateKey = keyFactory.generatePrivate (keySpec);
  157. Cipher cipher = Cipher.getInstance ("RSA");
  158. cipher.init (Cipher.DECRYPT_MODE, privateKey);
  159. return new String(cipher.doFinal(base64decByte(msg)),"UTF-8");
  160. } catch (Exception e) {
  161. e.printStackTrace ();
  162. }
  163. return null;
  164. }
  165. }

时间比较类:

(获取指定年的日期,比较日期是否相同,获取指定日的日期)

  1. public class DateUtils {
  2. /**
  3. * 获取指定年的日期*/
  4. public static Date getYear(int year){
  5. Calendar calendar=Calendar.getInstance();
  6. calendar.add(Calendar.YEAR,year);
  7. return calendar.getTime();
  8. }
  9. /**
  10. * 比如日期是否相同*/
  11. public static boolean dateEq(Date sdate,Date edate){
  12. SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  13. return sdf.format(sdate).equals(sdf.format(edate));
  14. }
  15. /**
  16. * 获取指定日的日期*/
  17. public static Date getDateByDay(int day){
  18. Calendar calendar=Calendar.getInstance();
  19. calendar.add(Calendar.DAY_OF_MONTH,day);
  20. return calendar.getTime();
  21. }
  22. }

基于反射来创建对象:

  1. public class BeanUtils {
  2. /**
  3. * 基于反射实现对象的创建*/
  4. public static <T> T copyBean(Class<T> clz, Object obj, Field[] fields){
  5. T t= null;
  6. try {
  7. //实例化对象
  8. t = clz.newInstance();
  9. //遍历属性
  10. for(Field f:fields){
  11. //获取属性对象
  12. Field field=clz.getDeclaredField(f.getName());
  13. if(field!=null){
  14. //设置忽略访问修饰符的校验
  15. field.setAccessible(true);
  16. f.setAccessible(true);
  17. //为属性赋值
  18. field.set(t,f.get(obj));
  19. }
  20. }
  21. } catch (Exception e) {
  22. e.printStackTrace();
  23. }
  24. return t;
  25. }
  26. }

百度审核模板:

  1. public class BaiduContentUtils {
  2. //内容审核对象
  3. public static final AipContentCensor censor=new AipContentCensor(SystemConfig.BAIDU_APPID,
  4. SystemConfig.BAIDU_KEY,SystemConfig.BAIDU_SEC);
  5. /**
  6. * 图片审核*/
  7. public static boolean imgCensor(byte[] data){
  8. //进行图片审核
  9. JSONObject response = censor.imageCensorUserDefined(data,null);
  10. System.err.println(response);
  11. //返回审核结果
  12. return response.getInt("conclusionType")==1;
  13. }
  14. /**
  15. * 文本审核*/
  16. public static boolean textCensor(String txt){
  17. //文本审核
  18. JSONObject response =censor.textCensorUserDefined(txt);
  19. //返回审核结果
  20. return response.getInt("conclusionType")==1;
  21. }
  22. }

调用短信验证码:

  1. public class AliSmsUtils {
  2. private static Client client;
  3. //完成初始化
  4. static {
  5. Config config = new Config()
  6. // 您的AccessKey ID
  7. .setAccessKeyId(SystemConfig.ALI_KEY)
  8. // 您的AccessKey Secret
  9. .setAccessKeySecret(SystemConfig.ALI_SEC);
  10. // 访问的域名
  11. config.endpoint = "dysmsapi.aliyuncs.com";
  12. try {
  13. client=new Client(config);
  14. } catch (Exception e) {
  15. e.printStackTrace();
  16. }
  17. }
  18. /**
  19. * 发送验证码
  20. * @param code 验证码
  21. * @param phone 手机号
  22. * @param temcode 模板code*/
  23. public static boolean sendCode(String temcode,String phone,int code){
  24. //1.准备请求参数
  25. SendSmsRequest sendSmsRequest = new SendSmsRequest()
  26. .setPhoneNumbers(phone)
  27. .setSignName("来自邢朋辉的短信")
  28. .setTemplateCode(temcode)
  29. .setTemplateParam("{\"code\":"+code+"}");
  30. try {
  31. //2.发送短信,获取响应结果
  32. SendSmsResponse response=client.sendSms(sendSmsRequest);
  33. //3.返回结果
  34. return response.getBody().code.equals("OK");
  35. } catch (Exception e) {
  36. e.printStackTrace();
  37. }
  38. return false;
  39. }
  40. }

云存储模板(阿里云OSS):

  1. public class AliOssUtils {
  2. // yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
  3. static String endpoint = "oss-cn-beijing.aliyuncs.com";
  4. public static final String bucket="data2112";
  5. // 创建OSSClient实例。
  6. public static OSS ossClient ;
  7. static {
  8. ossClient= new OSSClientBuilder().build(endpoint, SystemConfig.ALI_KEY, SystemConfig.ALI_SEC);
  9. }
  10. /**
  11. * 实现资源上传,并获取访问路径*/
  12. public static String upload(String obj, byte[] data, Date date){
  13. //1.实现资源上传
  14. ossClient.putObject(bucket,obj,new ByteArrayInputStream(data));
  15. //2.生成访问路径
  16. return ossClient.generatePresignedUrl(bucket,obj,date).toString();
  17. }
  18. /**
  19. * 实现资源的删除*/
  20. public static boolean delete(String obj){
  21. try{
  22. ossClient.deleteObject(bucket,obj);
  23. return true;
  24. }catch (Exception e){
  25. return false;
  26. }
  27. }
  28. /**
  29. * 验证资源是否存在*/
  30. public static boolean exists(String obj){
  31. return ossClient.doesObjectExist(bucket,obj);
  32. }
  33. /**
  34. * 创建对象的访问链接*/
  35. public static String createUrl(String obj,Date date){
  36. return ossClient.generatePresignedUrl(bucket,obj,date).toString();
  37. }
  38. }

线程池单例化:

创建一个单线程的线程池。这个线程池只有一个核心线程在工作,也就是相当于单线程串行执行所有任务。如果这个唯一的线程因为异常结束,那么会有一个新的线程来替代它。此线程池保证所有任务的执行顺序按照任务的提交顺序执行。

  1. //保证类是唯一实例,用单例模式
  2. public class ThreadPoolSingle {
  3. public ThreadPoolExecutor poolExecutor;//原生的线程池对象
  4. //私有构造器 这是核心
  5. private ThreadPoolSingle(){
  6. poolExecutor=new ThreadPoolExecutor(4,10,
  7. 3, TimeUnit.SECONDS,
  8. new ArrayBlockingQueue<>(20),
  9. Executors.defaultThreadFactory(),
  10. new ThreadPoolExecutor.AbortPolicy());
  11. }
  12. //静态内部类 里面有一个静态的属性 属性类的对象一定是一个外部类的对象
  13. static class ThreadPoolSingleFactory{
  14. public static ThreadPoolSingle single=new ThreadPoolSingle();
  15. }
  16. //公有静态方法 (作用:获取本来对象)
  17. public static ThreadPoolSingle getInstance(){
  18. return ThreadPoolSingleFactory.single;
  19. }
  20. //新增任务
  21. public void addTask(Runnable runnable){
  22. poolExecutor.submit(runnable);
  23. }
  24. }

去魔法值配置类:

  1. public class SystemConfig {
  2. //阿里云账号的key和密钥
  3. public static final String ALI_KEY="LTAI5tKz7sP4xaaRsTuxoTjx";
  4. public static final String ALI_SEC="mFCyf0QxVmB6kGAacAxdtMqmQwcRIx";
  5. //阿里云短信模板
  6. public static final String ALI_SMS_RCODE="SMS_114390520";//注册
  7. public static final String ALI_SMS_LCODE="SMS_115250125";//登录
  8. public static final String ALI_SMS_FCODE="SMS_181545700";//密码找回
  9. //验证码的长度
  10. public static final int CODE_LEN=6;
  11. //接口统一结果码
  12. public static final int R_OK=200;
  13. public static final int R_FAIL=400;
  14. //正则表达式
  15. public static final String REG_PHONE="1[3-9]{1}[0-9]{9}";
  16. //密码的密钥
  17. public static final String PASS_KEY="RAHW4pSvPJKOpuGGdbU+pw==";
  18. //标记位 1有效 2无效
  19. public static final int FLAG_OK=1;
  20. public static final int FLAG_ERROR=2;
  21. //自定义请求消息头
  22. public static final String REQ_HEADER_TOKEN="sqtoken";//传输令牌
  23. //文件名的长度
  24. public static final int FILE_LENGTH=50;
  25. //Oss 访问地址默认3年
  26. public static final int OSS_URL_TIME=3;
  27. //百度秘钥
  28. public static final String BAIDU_APPID="17214730";
  29. public static final String BAIDU_KEY="WnrcZnQNbveI7UG7sDroOm1K";
  30. public static final String BAIDU_SEC="FUui3jN440l9eLN8B335C3VS62HvtafU";
  31. //积分奖励
  32. public static final int SIGN_SCORE_F=20;//首次签到
  33. public static final int SIGN_SCORE_W=5;//连续1星期
  34. public static final int SIGN_SCORE_M=20;//连续1个月
  35. public static final int SIGN_SCORE_Y=100;//连续1年
  36. public static final int SCORE_R=50;//注册好礼,赠送50积分
  37. public static final int SCORE_L=1;//登陆,赠送1积分
  38. public static final int SIGN_DAY_3=3;//
  39. public static final int SIGN_DAY_7=7;//
  40. public static final int SIGN_DAY_30=30;//
  41. public static final int SIGN_DAY_365=365;//
  42. }

SwaggerConfig配置类:

  1. @Configuration //标记这是配置类,beans
  2. @EnableSwagger2 //启用Swagger
  3. public class SwaggerConfig {
  4. /**
  5. * 构建文档的基本信息
  6. */
  7. public ApiInfo createApi(){
  8. return new ApiInfoBuilder().description("StudyQuestion项目的接口在线文档,可以对接口进行测试等操作")
  9. .title("StudyQuestion的在线接口文档").contact(new Contact("Java2112","http://www.qfedu.com","xingfei_work@163.com"))
  10. .version("1.0.0").build();
  11. }
  12. /**
  13. * 就是ioc创建实例 修饰方法 方法必须返回对象
  14. */
  15. @Bean
  16. public Docket createDocket(){
  17. return new Docket(DocumentationType.SWAGGER_2).apiInfo(createApi())
  18. .select().apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
  19. .build();
  20. }
  21. }

RedisKeyConfig(redis配置类)

  1. public class RedisKeyConfig {
  2. //验证码
  3. //String类型 有效期 value 存储验证码
  4. public static final String SMS_RCODE="sq:sms:rcode:";//追加手机号
  5. public static final int SMS_RCODE_TIME=600;//对应的有效期
  6. public static final String SMS_LCODE="sq:sms:lcode:";//追加手机号
  7. public static final String SMS_FCODE="sq:sms:fcode:";//追加手机号
  8. //登陆 存储 String 类型 存储什么内容
  9. //用于通过令牌获取在线的用户信息的
  10. public static final String USER_TOKEN="sq:auth:token:";//追加令牌,值存储对应的用户id
  11. //用于校验手机号是不是唯一登陆的
  12. public static final String USER_PHONE="sq:auth:phone:";//追加手机号,值存储对应的令牌
  13. public static final int USER_TOKEN_TIME=1800;//对应的有效期
  14. //Hash类型,记录uid对应的手机号,永久有效
  15. public static final String USER_UIDS="sq:user:ids";
  16. }

SpringBoot项目(用于扫描Dao层配置类)

  1. @Configuration
  2. @MapperScan(basePackages = "com.feri.sq.dao")
  3. public class MybatisConfig {
  4. @Bean
  5. public MybatisPlusInterceptor mybatisPlusInterceptor() {
  6. MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
  7. interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
  8. return interceptor;
  9. }
  10. }

过滤器(:令牌续命)

  1. @Component
  2. @WebFilter("*.do")
  3. public class TokenTimeFilter implements Filter {
  4. @Override
  5. public void init(FilterConfig filterConfig) throws ServletException {
  6. Filter.super.init(filterConfig);
  7. }
  8. @Override
  9. public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
  10. //实现令牌的自动延期,如果当前请求携带的有令牌,那么就自动续命30分钟
  11. HttpServletRequest request=(HttpServletRequest) servletRequest;
  12. //获取令牌
  13. String token=request.getHeader(SystemConfig.REQ_HEADER_TOKEN);
  14. //校验是否传递令牌
  15. if(StringUtils.isNotEmpty(token)){
  16. //验证令牌是否存在
  17. if(JedisUtils.exists(RedisKeyConfig.USER_TOKEN+token)){
  18. //存在令牌,则续命
  19. JedisUtils.expire(RedisKeyConfig.USER_TOKEN+token,RedisKeyConfig.USER_TOKEN_TIME);
  20. //原则上查询数据库,直接使用Redis
  21. String phone=JedisUtils.getHash(RedisKeyConfig.USER_UIDS,
  22. JedisUtils.getString(RedisKeyConfig.USER_TOKEN+token));
  23. //手机号那个key也需要续命
  24. JedisUtils.expire(RedisKeyConfig.USER_PHONE+phone,RedisKeyConfig.USER_TOKEN_TIME);
  25. //对应的uid,新增到请求消息头中
  26. request.newPushBuilder().addHeader("uid",JedisUtils.getString(RedisKeyConfig.USER_TOKEN+token));
  27. }
  28. }
  29. //放行
  30. filterChain.doFilter(request, servletResponse);
  31. }
  32. @Override
  33. public void destroy() {
  34. Filter.super.destroy();
  35. }
  36. }


POM.XML

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <modelVersion>4.0.0</modelVersion>
  6. <groupId>com.feri.sq</groupId>
  7. <artifactId>StudyQuestion</artifactId>
  8. <version>1.0.0</version>
  9. <!-- SpringBoot项目的标识-->
  10. <parent>
  11. <groupId>org.springframework.boot</groupId>
  12. <artifactId>spring-boot-starter-parent</artifactId>
  13. <version>2.5.8</version>
  14. <relativePath/> <!-- lookup parent from repository -->
  15. </parent>
  16. <properties>
  17. <maven.compiler.source>8</maven.compiler.source>
  18. <maven.compiler.target>8</maven.compiler.target>
  19. </properties>
  20. <dependencies>
  21. <!-- springmvc-->
  22. <dependency>
  23. <groupId>org.springframework.boot</groupId>
  24. <artifactId>spring-boot-starter-web</artifactId>
  25. </dependency>
  26. <!-- Mysql数据库驱动-->
  27. <dependency>
  28. <groupId>mysql</groupId>
  29. <artifactId>mysql-connector-java</artifactId>
  30. <scope>runtime</scope>
  31. </dependency>
  32. <!-- 数据库连接池:Druid-->
  33. <dependency>
  34. <groupId>com.alibaba</groupId>
  35. <artifactId>druid-spring-boot-starter</artifactId>
  36. <version>1.2.6</version>
  37. </dependency>
  38. <!-- Mybatis-Plus简化JDBC,实现数据库操作-->
  39. <dependency>
  40. <groupId>com.baomidou</groupId>
  41. <artifactId>mybatis-plus-boot-starter</artifactId>
  42. <version>3.4.3.4</version>
  43. </dependency>
  44. <!-- 简化实体类,通过注解实现getter和setter等方法-->
  45. <dependency>
  46. <groupId>org.projectlombok</groupId>
  47. <artifactId>lombok</artifactId>
  48. <optional>true</optional>
  49. </dependency>
  50. <!-- 接口在线文档-->
  51. <!-- https://mvnrepository.com/artifact/com.github.xiaoymin/knife4j-spring-boot-starter -->
  52. <dependency>
  53. <groupId>com.github.xiaoymin</groupId>
  54. <artifactId>knife4j-spring-boot-starter</artifactId>
  55. <version>3.0.3</version>
  56. </dependency>
  57. <!-- Jedis 操作Redis的框架-->
  58. <dependency>
  59. <groupId>redis.clients</groupId>
  60. <artifactId>jedis</artifactId>
  61. </dependency>
  62. <!-- 阿里云对象存储-OSS -->
  63. <dependency>
  64. <groupId>com.aliyun.oss</groupId>
  65. <artifactId>aliyun-sdk-oss</artifactId>
  66. <version>3.10.2</version>
  67. </dependency>
  68. <!-- 阿里云-短信服务SMS -->
  69. <dependency>
  70. <groupId>com.aliyun</groupId>
  71. <artifactId>dysmsapi20170525</artifactId>
  72. <version>2.0.8</version>
  73. </dependency>
  74. <!-- Jwt-->
  75. <dependency>
  76. <groupId>io.jsonwebtoken</groupId>
  77. <artifactId>jjwt</artifactId>
  78. <version>0.9.1</version>
  79. </dependency>
  80. <dependency>
  81. <groupId>com.baomidou</groupId>
  82. <artifactId>mybatis-plus-generator</artifactId>
  83. <version>3.5.1</version>
  84. </dependency>
  85. <dependency>
  86. <groupId>org.freemarker</groupId>
  87. <artifactId>freemarker</artifactId>
  88. </dependency>
  89. <!-- 百度内容审核-人工智能 -->
  90. <dependency>
  91. <groupId>com.baidu.aip</groupId>
  92. <artifactId>java-sdk</artifactId>
  93. <version>4.16.5</version>
  94. </dependency>
  95. <!-- 单元测试-->
  96. <dependency>
  97. <groupId>org.springframework.boot</groupId>
  98. <artifactId>spring-boot-starter-test</artifactId>
  99. <scope>test</scope>
  100. </dependency>
  101. </dependencies>
  102. <build>
  103. <plugins>
  104. <plugin>
  105. <groupId>org.springframework.boot</groupId>
  106. <artifactId>spring-boot-maven-plugin</artifactId>
  107. <configuration>
  108. <excludes>
  109. <exclude>
  110. <groupId>org.projectlombok</groupId>
  111. <artifactId>lombok</artifactId>
  112. </exclude>
  113. </excludes>
  114. </configuration>
  115. </plugin>
  116. </plugins>
  117. </build>
  118. </project>