-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: 1. 去除jwt存储password关键信息;token创建逻辑同node,jwt信息实现node和java互通 2. 新增hash256方法,用户注册password加密逻辑同node,实现java端注册的账号登录和node版本互通 * add Workspace,WorkspaceMember,ConvertorConfig * 删除获取获取jwt信息中的魔法值;处理空指针问题 * add error code * 常量命名调整 * 1.新增mongodb事件拦截器 MongoEntityInterceptor 2.新增对象转换器 GeneralConvertor 3.新增空间Workspace接口 4.新增空间成员WorkspaceMember接口 * init application-dev.properties * 删除Status的get set方法 * pom依赖管理
- Loading branch information
Showing
31 changed files
with
1,240 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
lombok.accessors.chain=true | ||
lombok.equalsAndHashCode.doNotUseGetters=true | ||
lombok.toString.doNotUseGetters=true | ||
lombok.equalsAndHashCode.callSuper=SKIP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
survey-common/src/main/java/com/xiaojusurvey/engine/common/entity/InitBaseEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.xiaojusurvey.engine.common.entity; | ||
|
||
import lombok.Data; | ||
|
||
/** | ||
* @description: InitBaseEntity | ||
* @author: wangchenglong | ||
* @time: 2024/7/31 17:12 | ||
*/ | ||
@Data | ||
public class InitBaseEntity extends BaseEntity { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
survey-common/src/main/java/com/xiaojusurvey/engine/common/entity/workspace/Workspace.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.xiaojusurvey.engine.common.entity.workspace; | ||
|
||
import com.xiaojusurvey.engine.common.entity.BaseEntity; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
import org.springframework.data.mongodb.core.mapping.Document; | ||
|
||
/** | ||
* @description: 空间 | ||
* @author: wangchenglong | ||
* @time: 2024/7/24 10:50 | ||
*/ | ||
@Document("workspace") | ||
@EqualsAndHashCode(callSuper = true) | ||
@ToString(callSuper = true) | ||
@Data | ||
public class Workspace extends BaseEntity { | ||
private String ownerId; | ||
private String name; | ||
private String description; | ||
} |
24 changes: 24 additions & 0 deletions
24
...common/src/main/java/com/xiaojusurvey/engine/common/entity/workspace/WorkspaceMember.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.xiaojusurvey.engine.common.entity.workspace; | ||
|
||
import com.xiaojusurvey.engine.common.entity.BaseEntity; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
import org.springframework.data.mongodb.core.mapping.Document; | ||
|
||
/** | ||
* @description: 空间成员 | ||
* @author: wangchenglong | ||
* @time: 2024/7/24 10:51 | ||
*/ | ||
@Document("workspaceMember") | ||
@EqualsAndHashCode(callSuper = true) | ||
@ToString(callSuper = true) | ||
@Data | ||
public class WorkspaceMember extends BaseEntity { | ||
private String userId; | ||
|
||
private String workspaceId; | ||
|
||
private String role; | ||
} |
38 changes: 38 additions & 0 deletions
38
survey-common/src/main/java/com/xiaojusurvey/engine/common/enums/RecordStatusEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.xiaojusurvey.engine.common.enums; | ||
|
||
/** | ||
* @description: 状态类型 | ||
* @author: wangchenglong | ||
* @time: 2024/7/30 16:08 | ||
*/ | ||
public enum RecordStatusEnum { | ||
|
||
// 新建 | ||
NEW("new"), | ||
|
||
// 编辑 | ||
EDITING("editing"), | ||
|
||
// 暂停 | ||
PAUSING("pausing"), | ||
|
||
// 发布 | ||
PUBLISHED("published"), | ||
|
||
// 删除 | ||
REMOVED("removed"), | ||
|
||
// 从回收站删除 | ||
FORCE_REMOVED("forceRemoved"); | ||
|
||
private final String statusType; | ||
|
||
RecordStatusEnum(String statusType) { | ||
this.statusType = statusType; | ||
} | ||
|
||
public String getStatusType() { | ||
return this.statusType; | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
survey-common/src/main/java/com/xiaojusurvey/engine/common/enums/RoleEmum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.xiaojusurvey.engine.common.enums; | ||
|
||
/** | ||
* @description: 用户角色枚举 | ||
* @author: wangchenglong | ||
* @time: 2024/7/24 14:47 | ||
*/ | ||
public enum RoleEmum { | ||
|
||
USER(0, "user"), | ||
|
||
ADMIN(1, "admin"); | ||
|
||
private final Integer state; | ||
|
||
private final String value; | ||
|
||
RoleEmum(Integer state, String value) { | ||
this.state = state; | ||
this.value = value; | ||
} | ||
|
||
public Integer getState() { | ||
return this.state; | ||
} | ||
|
||
public String getValue() { | ||
return this.value; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
survey-core/src/main/java/com/xiaojusurvey/engine/bean/ConvertorConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.xiaojusurvey.engine.bean; | ||
|
||
import org.dozer.DozerBeanMapper; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* @description: net.sf.dozer | ||
* @author: wangchenglong | ||
* @time: 2024/7/24 22:25 | ||
*/ | ||
@Configuration | ||
public class ConvertorConfig { | ||
@Bean | ||
public DozerBeanMapper dozerBeanMapper() { | ||
return new DozerBeanMapper(); | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
survey-core/src/main/java/com/xiaojusurvey/engine/bean/GeneralConvertor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package com.xiaojusurvey.engine.bean; | ||
|
||
|
||
import org.dozer.Mapper; | ||
import org.springframework.stereotype.Component; | ||
|
||
import javax.annotation.Resource; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.TreeSet; | ||
|
||
/** | ||
* @description: 对象转换 | ||
* @author: wangchenglong | ||
* @time: 2024/7/24 14:23 | ||
*/ | ||
@Component | ||
public class GeneralConvertor { | ||
|
||
@Resource | ||
private Mapper mapper; | ||
|
||
/** | ||
* List 实体类 转换器 | ||
* | ||
* @param source 原数据 | ||
* @param clz 转换类型 | ||
* @param <T> | ||
* @param <S> | ||
* @return | ||
*/ | ||
public <T, S> List<T> convertor(List<S> source, Class<T> clz) { | ||
if (source == null) { | ||
return null; | ||
} | ||
List<T> map = new ArrayList<>(); | ||
for (S s : source) { | ||
map.add(mapper.map(s, clz)); | ||
} | ||
return map; | ||
} | ||
|
||
|
||
/** | ||
* Set 实体类 深度转换器 | ||
* | ||
* @param source 原数据 | ||
* @param clz 目标对象 | ||
* @param <T> | ||
* @param <S> | ||
* @return | ||
*/ | ||
public <T, S> Set<T> convertor(Set<S> source, Class<T> clz) { | ||
if (source == null) { | ||
return null; | ||
} | ||
Set<T> set = new TreeSet<>(); | ||
for (S s : source) { | ||
set.add(mapper.map(s, clz)); | ||
} | ||
return set; | ||
} | ||
|
||
/** | ||
* 实体类 深度转换器 | ||
* | ||
* @param source | ||
* @param clz | ||
* @param <T> | ||
* @param <S> | ||
* @return | ||
*/ | ||
public <T, S> T convertor(S source, Class<T> clz) { | ||
if (source == null) { | ||
return null; | ||
} | ||
return mapper.map(source, clz); | ||
} | ||
|
||
public void convertor(Object source, Object object) { | ||
mapper.map(source, object); | ||
} | ||
|
||
public <T> void copyConvertor(T source, Object object) { | ||
mapper.map(source, object); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
survey-core/src/main/java/com/xiaojusurvey/engine/core/workspace/WorkspaceMemberService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.xiaojusurvey.engine.core.workspace; | ||
|
||
import com.xiaojusurvey.engine.common.entity.workspace.WorkspaceMember; | ||
import com.xiaojusurvey.engine.core.workspace.param.CreateWorkspaceMemberParam; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @description: | ||
* @author: wangchenglong | ||
* @time: 2024/7/24 14:23 | ||
*/ | ||
public interface WorkspaceMemberService { | ||
|
||
List<WorkspaceMember> getWorkspaceMembers(String workspaceId, List<String> userId); | ||
|
||
List<WorkspaceMember> getWorkspaceMembers(String userId, Integer pageSize, Integer curPage); | ||
|
||
List<WorkspaceMember> getWorkspaceMembers(String workspaceId); | ||
|
||
WorkspaceMember getWorkspaceMember(String workspaceId, String userId); | ||
|
||
String create(CreateWorkspaceMemberParam createWorkspaceMemberParam); | ||
|
||
void delete(CreateWorkspaceMemberParam workspaceMemberParam); | ||
|
||
void updateRole(@RequestBody CreateWorkspaceMemberParam createWorkspaceMemberParam); | ||
} |
29 changes: 29 additions & 0 deletions
29
survey-core/src/main/java/com/xiaojusurvey/engine/core/workspace/WorkspaceService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.xiaojusurvey.engine.core.workspace; | ||
|
||
import com.xiaojusurvey.engine.core.workspace.param.WorkspaceParam; | ||
import com.xiaojusurvey.engine.core.workspace.vo.WorkspaceListVO; | ||
import com.xiaojusurvey.engine.core.workspace.vo.WorkspaceMemberVO; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import java.util.List; | ||
|
||
/** | ||
* @description: | ||
* @author: wangchenglong | ||
* @time: 2024/7/24 14:23 | ||
*/ | ||
public interface WorkspaceService { | ||
|
||
String createWorkspace(HttpServletRequest request, @RequestBody WorkspaceParam workspaceParam); | ||
|
||
WorkspaceListVO findAll(HttpServletRequest request, Integer pageSize, Integer curPage, String name); | ||
|
||
WorkspaceMemberVO getWorkspaceInfo(HttpServletRequest request, String workspaceId); | ||
|
||
void update(HttpServletRequest request, @RequestBody WorkspaceParam workspaceParam, String workspaceId); | ||
|
||
void delete(HttpServletRequest request, String workspaceId); | ||
|
||
List<WorkspaceMemberVO> findAllByUserId(HttpServletRequest request); | ||
} |
Oops, something went wrong.