Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] 实现C端接口 提交问卷 #476

Open
wants to merge 2 commits into
base: feature/server-java
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public enum RespErrorCode {
RESPONSE_CURRENT_TIME_NOT_ALLOW(9002, "当前时间不允许提交"),
RESPONSE_OVER_LIMIT(9003, "超出限制"),
RESPONSE_SCHEMA_REMOVED(9004, "问卷已删除"),
RESPONSE_DATA_DECRYPT_ERROR(9005, "问卷已删除"),
UPLOAD_FILE_ERROR(5001, "上传文件错误");

RESPONSE_DATA_DECRYPT_ERROR(9005, "数据解密失败"),
UPLOAD_FILE_ERROR(5001, "上传文件错误"),
WHITELIST_ERROR(4002, "白名单校验错误");

private final int code;
private final String message;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.xiaojusurvey.engine.common.entity.survey;

import com.xiaojusurvey.engine.common.entity.BaseEntity;
import com.xiaojusurvey.engine.common.enums.EncryptType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.data.mongodb.core.mapping.Document;

@Document("clientEncrypt")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Data
public class ClientEncrypt extends BaseEntity {


private ClientEncryptData data;


private EncryptType type;


@Data
public static class ClientEncryptData {
private String secretKey; // aes加密的密钥
private String publicKey; // rsa加密的公钥
private String privateKey; // rsa加密的私钥
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.xiaojusurvey.engine.common.entity.survey;


import com.xiaojusurvey.engine.common.entity.BaseEntity;
import lombok.*;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Map;

@Document("counter")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Counter extends BaseEntity {

private String key;

private String surveyPath;

private String type;

private Map<String, Long> data;


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.xiaojusurvey.engine.common.entity.survey;

import com.xiaojusurvey.engine.common.entity.BaseEntity;
import lombok.*;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.List;
import java.util.Map;

/**
* 问卷回收数据表
*/
@Document("surveySubmit")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SurveySubmit extends BaseEntity {

private String pageId;

private String surveyPath;

private Long diffTime;

private Long clientTime;

private Map<String, Object> data;

private Map<String, List<String[]>> optionTextAndId;

private List<String> secretKeys;


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.xiaojusurvey.engine.common.enums;

import lombok.Getter;

@Getter
public enum EncryptType {

AES("aes"),
RSA("rsa");

private String type;

EncryptType(String type) {
this.type = type;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.xiaojusurvey.engine.common.enums;

import lombok.Getter;

@Getter
public enum MemberTypeEnum {

MOBILE("MOBILE"),
EMAIL("EMAIL");

private String type;

MemberTypeEnum(String type) {
this.type = type;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.xiaojusurvey.engine.common.enums;

import lombok.Getter;

@Getter
public enum OptionQuestionTypeEnum {
RADIO("radio"),
CHECKBOX("checkbox"),
BINARY_CHOICE("binary-choice"),
VOTE("vote");

private String type;

OptionQuestionTypeEnum(String type) {
this.type = type;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.xiaojusurvey.engine.common.enums;

import lombok.Getter;

@Getter
public enum WhitelistTypeEnum {
ALL("ALL"),
MEMBER("MEMBER"),
CUSTOM("CUSTOM");
private String type;

WhitelistTypeEnum(String type) {
this.type = type;
}
}
9 changes: 9 additions & 0 deletions survey-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@
<version>4.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.69</version>
</dependency>
</dependencies>


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.xiaojusurvey.engine.core.survey;

import com.xiaojusurvey.engine.common.entity.survey.ClientEncrypt;

public interface ClientEncryptService {
ClientEncrypt getEncryptInfoById(String sessionId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.xiaojusurvey.engine.core.survey;

import com.xiaojusurvey.engine.common.entity.survey.Counter;

public interface CounterService {
Counter queryCounter(String key, String surveyPath, String type);

void saveCounter(Counter counter);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.xiaojusurvey.engine.core.survey;

import com.xiaojusurvey.engine.common.rpc.RpcResult;
import com.xiaojusurvey.engine.core.survey.param.ResponseParam;
import com.xiaojusurvey.engine.core.survey.vo.SurveyResponseSchemaOutVO;

import java.util.Map;

/**
* 问卷提交服务
*
* @author zsh
* @date: 2025/1/21
*/
public interface SurveyResponseService {


SurveyResponseSchemaOutVO getResponseSchema(String surveyPath);

RpcResult<?> createResponse(ResponseParam responseParam);

String getSignByData(Map<String, Object> sourceData, String timeStamp);
}
Loading