Skip to content

Commit

Permalink
feat: add tencent cos
Browse files Browse the repository at this point in the history
  • Loading branch information
lichong-a committed Aug 6, 2024
1 parent 2cf93fe commit ab41a27
Show file tree
Hide file tree
Showing 59 changed files with 219 additions and 84 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ FROM eclipse-temurin:21-jre
WORKDIR application
ARG JAR_FILE=starter/build/libs/portal-server*.jar
COPY ${JAR_FILE} application.jar
COPY starter/src/main/resources/application.yml application.yml
COPY starter/src/main/resources/docker/.env .env

ENV JVM_OPTS="-Xmx512m -Xms2048m" \
TZ=Asia/Shanghai

EXPOSE 8080

ENTRYPOINT [ "sh", "-c", "java $JVM_OPTS -jar application.jar" ]
ENTRYPOINT [ "java", "$JVM_OPTS", "-jar", "application.jar", "--spring.config.import=optional:file:.env[.properties]" ]
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ buildscript {
set('springCloudVersion', '2023.0.1')
set('springCloudAlibabaVersion', '2023.0.1.2')
set('redissonVersion', '3.31.0')
set('cosVersion', '5.6.225')
set('knife4jVersion', '4.4.0')
set('springDocVersion', '2.5.0')
set('jjwtVersion', '0.12.5')
Expand Down
8 changes: 2 additions & 6 deletions common/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ java {
}

dependencies {
api project(':common:domain')
api 'com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery'
api "com.github.penggle:kaptcha:${kaptchaVersion}"
api "com.github.xiaoymin:knife4j-openapi3-jakarta-spring-boot-starter:${knife4jVersion}"
api "com.qcloud:cos_api:${cosVersion}"
api "io.jsonwebtoken:jjwt-api:${jjwtVersion}"
api "io.jsonwebtoken:jjwt-impl:${jjwtVersion}"
api "io.jsonwebtoken:jjwt-jackson:${jjwtVersion}"
Expand All @@ -33,9 +35,3 @@ dependencies {
runtimeOnly 'org.postgresql:postgresql'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

hibernate {
enhancement {
enableAssociationManagement = true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package org.funcode.portal.server.common.core.base.repository;

import org.funcode.portal.server.common.core.base.entity.BaseEntity;
import org.funcode.portal.server.common.domain.base.BaseEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.NoRepositoryBean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
package org.funcode.portal.server.common.core.base.service.impl;


import org.funcode.portal.server.common.core.base.entity.BaseEntity;
import lombok.extern.slf4j.Slf4j;
import org.funcode.portal.server.common.core.base.repository.IBaseRepository;
import org.funcode.portal.server.common.core.base.service.IBaseService;
import lombok.extern.slf4j.Slf4j;
import org.funcode.portal.server.common.domain.base.BaseEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.funcode.portal.server.common.core.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

Expand All @@ -16,7 +15,6 @@
*/
@Data
@ConfigurationProperties(prefix = "application")
@AllArgsConstructor
public class ApplicationConfig {

private final Security security;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright 2024 李冲. All rights reserved.
*
*/

package org.funcode.portal.server.common.core.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
* @author 李冲
* @see <a href="https://lichong.work">李冲博客</a>
* @since 0.0.1
*/
@Data
@ConfigurationProperties(prefix = "application.cos")
@Configuration
public class CosConfig {

/**
* 腾讯云控制台项目配置secretId
*/
private String secretId;

/**
* 腾讯云控制台项目配置secretKey
*/
private String secretKey;
/**
* 存储桶地域
*/
private String region;
/**
* 存储桶名称
*/
private String bucketName = "ielts-online-1312690188";
/**
* 业务项目名称
*/
private String projectName = "ielts-online";
/**
* 公共目录
*/
private String common = "common";
/**
* 图片大小
*/
private String imageSize = "2";
/**
* CDN加速域名
*/
private String prefixDomain = "";
/**
* 过期时间
*/
private Long expiration = 60L;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import org.funcode.portal.server.common.core.config.ApplicationConfig;
import org.funcode.portal.server.common.core.constant.RedisKeyConstant;
import org.funcode.portal.server.common.core.constant.SecurityConstant;
import org.funcode.portal.server.common.core.security.domain.dto.User;
import org.funcode.portal.server.common.core.security.service.IJwtService;
import org.funcode.portal.server.common.domain.security.User;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package org.funcode.portal.server.common.core.security.repository;

import org.funcode.portal.server.common.core.base.repository.IBaseRepository;
import org.funcode.portal.server.common.core.security.domain.dto.BasicAuthority;
import org.funcode.portal.server.common.domain.security.BasicAuthority;
import org.springframework.stereotype.Repository;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package org.funcode.portal.server.common.core.security.repository;

import org.funcode.portal.server.common.core.base.repository.IBaseRepository;
import org.funcode.portal.server.common.core.security.domain.dto.Role;
import org.funcode.portal.server.common.domain.security.Role;
import org.springframework.stereotype.Repository;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package org.funcode.portal.server.common.core.security.repository;

import org.funcode.portal.server.common.core.base.repository.IBaseRepository;
import org.funcode.portal.server.common.core.security.domain.dto.User;
import org.funcode.portal.server.common.domain.security.User;
import org.springframework.stereotype.Repository;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import org.apache.commons.lang3.StringUtils;
import org.funcode.portal.server.common.core.base.http.response.ResponseResult;
import org.funcode.portal.server.common.core.base.http.response.ResponseStatusEnum;
import org.funcode.portal.server.common.core.security.domain.dto.User;
import org.funcode.portal.server.common.core.security.domain.vo.request.SignUpRequest;
import org.funcode.portal.server.common.core.security.repository.IUserRepository;
import org.funcode.portal.server.common.core.security.service.IAuthenticationService;
import org.funcode.portal.server.common.core.security.service.IJwtService;
import org.funcode.portal.server.common.domain.security.User;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import org.funcode.portal.server.common.core.config.ApplicationConfig;
import org.funcode.portal.server.common.core.constant.RedisKeyConstant;
import org.funcode.portal.server.common.core.constant.SecurityConstant;
import org.funcode.portal.server.common.core.security.domain.dto.User;
import org.funcode.portal.server.common.core.security.service.IJwtService;
import org.funcode.portal.server.common.domain.security.User;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.lang.NonNull;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.funcode.portal.server.common.core.security.domain.dto.User;
import org.funcode.portal.server.common.core.security.repository.IUserRepository;
import org.funcode.portal.server.common.domain.security.User;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
/*
* Copyright 2024 李冲. All rights reserved.
*
*/

package org.funcode.portal.server.common.core.util;

import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

/**
* @author 李冲
* @see <a href="https://lichong.work">李冲博客</a>
* @since 0.0.1
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class CookieUtils {

/**
* 获取指定Cookie的值
*
* @param request HttpServletRequest
* @param cookieName cookie name
* @param request HttpServletRequest
* @param cookieName cookie name
* @return cookie value
*/
public static String getCookieValue(HttpServletRequest request, String cookieName) {
Expand Down
16 changes: 16 additions & 0 deletions common/domain/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
id 'org.hibernate.orm' version "${hibernatePluginVersion}"
id 'org.graalvm.buildtools.native' version "${graalvmNativePluginVersion}"
}

dependencies {
api "com.github.xiaoymin:knife4j-openapi3-jakarta-spring-boot-starter:${knife4jVersion}"
api "org.springdoc:springdoc-openapi-starter-webmvc-ui:${springDocVersion}"
api 'org.springframework.boot:spring-boot-starter-data-jpa'
api 'org.springframework.boot:spring-boot-starter-security'
api 'org.springframework.boot:spring-boot-starter-validation'
api 'org.springframework.boot:spring-boot-starter-web'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
*/

package org.funcode.portal.server.common.core.base.entity;
package org.funcode.portal.server.common.domain.base;

import jakarta.persistence.*;
import lombok.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
*
*/

package org.funcode.portal.server.common.core.module.ielts.domain;
package org.funcode.portal.server.common.domain.ielts;


import jakarta.persistence.*;
import lombok.*;
import org.funcode.portal.server.common.core.base.entity.BaseEntity;
import org.funcode.portal.server.common.domain.base.BaseEntity;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.DynamicUpdate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
*
*/

package org.funcode.portal.server.common.core.module.ielts.domain;
package org.funcode.portal.server.common.domain.ielts;


import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.*;
import org.funcode.portal.server.common.core.base.entity.BaseEntity;
import org.funcode.portal.server.common.core.security.domain.dto.User;
import org.funcode.portal.server.common.domain.base.BaseEntity;
import org.funcode.portal.server.common.domain.security.User;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.DynamicUpdate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
*
*/

package org.funcode.portal.server.common.core.module.ielts.domain;
package org.funcode.portal.server.common.domain.ielts;


import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.*;
import org.funcode.portal.server.common.core.base.entity.BaseEntity;
import org.funcode.portal.server.common.core.security.domain.dto.User;
import org.funcode.portal.server.common.domain.base.BaseEntity;
import org.funcode.portal.server.common.domain.security.User;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.DynamicUpdate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
*
*/

package org.funcode.portal.server.common.core.module.ielts.domain;
package org.funcode.portal.server.common.domain.ielts;


import jakarta.persistence.*;
import lombok.*;
import org.funcode.portal.server.common.core.base.entity.BaseEntity;
import org.funcode.portal.server.common.core.security.domain.dto.User;
import org.funcode.portal.server.common.domain.base.BaseEntity;
import org.funcode.portal.server.common.domain.security.User;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.DynamicUpdate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
*
*/

package org.funcode.portal.server.common.core.module.ielts.domain;
package org.funcode.portal.server.common.domain.ielts;


import jakarta.persistence.*;
import lombok.*;
import org.funcode.portal.server.common.core.base.entity.BaseEntity;
import org.funcode.portal.server.common.core.security.domain.dto.User;
import org.funcode.portal.server.common.domain.base.BaseEntity;
import org.funcode.portal.server.common.domain.security.User;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.DynamicUpdate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
*
*/

package org.funcode.portal.server.common.core.module.ielts.domain;
package org.funcode.portal.server.common.domain.ielts;


import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.*;
import org.funcode.portal.server.common.core.base.entity.BaseEntity;
import org.funcode.portal.server.common.domain.base.BaseEntity;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.DynamicUpdate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
*
*/

package org.funcode.portal.server.common.core.security.domain.dto;
package org.funcode.portal.server.common.domain.security;

import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.*;
import org.funcode.portal.server.common.core.base.entity.BaseEntity;
import org.funcode.portal.server.common.domain.base.BaseEntity;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.security.core.GrantedAuthority;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
*
*/

package org.funcode.portal.server.common.core.security.domain.dto;
package org.funcode.portal.server.common.domain.security;

import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.*;
import org.funcode.portal.server.common.core.base.entity.BaseEntity;
import org.funcode.portal.server.common.domain.base.BaseEntity;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.security.core.GrantedAuthority;
Expand Down
Loading

0 comments on commit ab41a27

Please sign in to comment.