Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
cheng521521 authored Dec 11, 2023
2 parents ea12614 + 32f58fe commit d51ffb0
Show file tree
Hide file tree
Showing 54 changed files with 983 additions and 222 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-webflux'
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-graphql
//implementation 'org.springframework.boot:spring-boot-starter-graphql:2.7.17'
implementation 'io.springfox:springfox-boot-starter:3.0.0'


//graphql
Expand Down
152 changes: 152 additions & 0 deletions interface/share.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
[
{
"url": "http://43.135.22.107:8080/share/usershare/create?address=0xabc",
"method": "POST",
"body": {
"theme": "主题",
"date": "分享日期,如2023-01-01",
"time": "分享时间,如8:00",
"language": "分享语言,0-中文,1英文",
"presenter": "分享人昵称",
"org": "所属组织",
"twitter": "分享人推特",
"sharingDoc": "分享链接",
"label": "标签类别"
},
"response":
{
"code": "200",
"msg": "success",
"data": 111
}
},
{
"url": "http:/43.135.22.107:8080/share/usershare/update?address=0xabc",
"method": "POST",
"body": {
"id":"分享id,如111",
"theme": "主题",
"date": "分享日期,如2023-01-01",
"time": "分享时间,如8:00",
"language": "分享语言,0-中文,1英文",
"presenter": "分享人昵称",
"org": "所属组织",
"twitter": "分享人推特",
"sharingDoc": "分享链接",
"label": "标签类别"
},
"response":
{
"code": "200",
"msg": "success",
"data": null
}
},
{
"url": "http://43.135.22.107:8080/share/usershare/delete?shareId=111&address=0xabc",
"method": "POST",
"response":
{
"code": "200",
"msg": "success",
"data": null
}
},
{
"url": "http://43.135.22.107:8080/share/usershare/all?pageNo=1&pageSize=10",
"method": "GET",
"response":
{
"code": "200",
"msg": "success",
"data": {
"data": [
{
"id": "分享id",
"theme": "主题",
"date": "分享日期,如2023-01-01",
"time": "分享时间,如8:00",
"language": "分享语言,0-中文,1英文",
"presenter": "分享人昵称",
"org": "所属组织",
"twitter": "分享人推特",
"sharingDoc": "分享链接",
"label": "标签类别",
"locked": "锁定状态",
"meetingType": "会议类别",
"meetingId": "会议编号",
"meetingLink": "会议链接"
}
],
"pagination": {
"totalCount": 0,
"totalPages": 0,
"currentPage": 1,
"currentPageSize": 0,
"hasNext": false
}
}
}
},
{
"url": "http://43.135.22.107:8080/share/usershare/byUser?memberId=1?pageNo=1&pageSize=10",
"method": "GET",
"response":
{
"code": "200",
"msg": "success",
"data": {
"data": [
{
"id": "分享id",
"theme": "主题",
"date": "分享日期,如2023-01-01",
"time": "分享时间,如8:00",
"language": "分享语言,0-中文,1英文",
"presenter": "分享人昵称",
"org": "所属组织",
"twitter": "分享人推特",
"sharingDoc": "分享链接",
"label": "标签类别",
"locked": "锁定状态",
"meetingType": "会议类别",
"meetingId": "会议编号",
"meetingLink": "会议链接"
}
],
"pagination": {
"totalCount": 0,
"totalPages": 0,
"currentPage": 1,
"currentPageSize": 0,
"hasNext": false
}
}
}
},
{
"url": "http://43.135.22.107:8080/share/usershare/queryByShareId?shareId=111",
"method": "GET",
"response":
{
"code": "200",
"msg": "success",
"data": {
"id": "分享id",
"theme": "主题",
"date": "分享日期,如2023-01-01",
"time": "分享时间,如8:00",
"language": "分享语言,0-中文,1英文",
"presenter": "分享人昵称",
"org": "所属组织",
"twitter": "分享人推特",
"sharingDoc": "分享链接",
"label": "标签类别",
"locked": "锁定状态",
"meetingType": "会议类别",
"meetingId": "会议编号",
"meetingLink": "会议链接"
}
}
}
]
29 changes: 29 additions & 0 deletions src/main/java/com/dl/officialsite/common/base/Pagination.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,36 @@
package com.dl.officialsite.common.base;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Pagination {

/**
* 总数据条目
*/
private int totalCount;

/**
* 总共页数
*/
private int totalPages;

/**
* 当前页码
*/
private int currentPage;

/**
* 当前页面包含条目数
*/
private int currentPageSize;

/**
* 是否还有下一页
*/
private boolean hasNext;
}
7 changes: 7 additions & 0 deletions src/main/java/com/dl/officialsite/common/enums/CodeEnums.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ public enum CodeEnums {

NOT_FOUND_JD("1008", "not found jd"),
NOT_FOUND_MEMBER("1008", "not found user");
//Sharing
SHARING_NOT_FOUND("5001", "Sharing not found"),
SHARING_NOT_OWNER("5002", "You are no sharing user"),

SHARING_LOCKED("5003", "Sharing locked, please contact admin to unlock");



private String code;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.dl.officialsite.common.exception;

import com.dl.officialsite.common.enums.CodeEnums;
import lombok.Data;
import lombok.EqualsAndHashCode;

Expand All @@ -17,6 +18,12 @@ public class BizException extends RuntimeException{

private String msg;

public BizException(CodeEnums codeEnums){
super(codeEnums.getMsg());
this.code = codeEnums.getCode();
this.msg = codeEnums.getMsg();
}

public BizException(String code, String msg) {
super(msg);
this.code = code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public static SessionUserInfo getMember(HttpSession session){
return (SessionUserInfo)sessionObj;
}


public static void requireLogin(HttpSession session) {
SessionUserInfo sessionUserInfo = getMember(session);
if (!isUserLogin(session)) {
Expand All @@ -56,4 +57,6 @@ public static void clearLogin(HttpSession session) {

session.removeAttribute(MEMBER_ATTRIBUTE_KEY);
}


}
7 changes: 7 additions & 0 deletions src/main/java/com/dl/officialsite/config/CorsConfig.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
package com.dl.officialsite.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Override
Expand All @@ -22,4 +28,5 @@ public void addCorsMappings(CorsRegistry registry) {
//暴露哪些原始请求头部信息
.exposedHeaders("*");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,20 @@ public class LoginFilter extends OncePerRequestFilter {
add("/login/check");
add("/login/check-session");
add("/login/logout");
add("/share/usershare/all");
add("/share/usershare/queryByShareId");
add("/share/usershare/byUser");
add("/share/usershare/create");
add("/share/usershare/update");
add("/share/usershare/delete");
}} ;

@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
log.info("Login filter session id {}, request {}", request.getSession().getId(), request.getRequestURI());
try{
if (noLoginApis.contains(request.getRequestURI())) {
String uri = request.getRequestURI();
if (noLoginApis.contains(uri) || uri.contains("swagger")) {
filterChain.doFilter(request, response);
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.dl.officialsite.sharing.constant;

import lombok.Getter;

@Getter
public enum SharingLanguageEnum {

CHINESE(0),

ENGLISH(1),

FRENCH(2),

JAPANESE(3);

private int code;

SharingLanguageEnum(int code){
this.code = code;
}

public static SharingLanguageEnum codeOf(int languageCode) {
for(SharingLanguageEnum language: SharingLanguageEnum.values()){
if(language.code == languageCode){
return language;
}
}
throw new IllegalArgumentException("languageCode "+languageCode);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.dl.officialsite.sharing.constant;

import lombok.Getter;

@Getter
public enum SharingLockStatus {

UNLOCKED(0),

LOCKED(1);

private int code;

SharingLockStatus(int code){
this.code = code;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.dl.officialsite.sharing.constant;

import lombok.Getter;

@Getter
public enum SharingMeetingType {

TENCENT(0),

GOOGLE(1),

ZOOM(2),

TELEGRAM(3),

DC(4);

private int code;

SharingMeetingType(int code){
this.code = code;
}

public static SharingMeetingType codeOf(int meetingType) {
for(SharingMeetingType m: SharingMeetingType.values()){
if(m.code == meetingType){
return m;
}
}
throw new IllegalArgumentException("meetingType "+meetingType);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.dl.officialsite.sharing.constant;

public enum SharingPostType {

CLASSIC(0);

private int code;

SharingPostType(int code){
this.code = code;
}

public static SharingPostType codeOf(int code){
for(SharingPostType postType: SharingPostType.values()){
if(postType.code == code){
return postType;
}
}
throw new IllegalArgumentException("SharingPostType "+code);
}
}
Loading

0 comments on commit d51ffb0

Please sign in to comment.