初始化
This commit is contained in:
39
.gitignore
vendored
Normal file
39
.gitignore
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
/config/
|
||||
1
extLib/chinaumsdk/.gitignore
vendored
Normal file
1
extLib/chinaumsdk/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/target
|
||||
5
extLib/chinaumsdk/.idea/.gitignore
generated
vendored
Normal file
5
extLib/chinaumsdk/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Environment-dependent path to Maven home directory
|
||||
/mavenHomeManager.xml
|
||||
13
extLib/chinaumsdk/.idea/compiler.xml
generated
Normal file
13
extLib/chinaumsdk/.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="open-api-sdk" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
7
extLib/chinaumsdk/.idea/encodings.xml
generated
Normal file
7
extLib/chinaumsdk/.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
25
extLib/chinaumsdk/.idea/jarRepositories.xml
generated
Normal file
25
extLib/chinaumsdk/.idea/jarRepositories.xml
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://maven.aliyun.com/repository/public" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
12
extLib/chinaumsdk/.idea/misc.xml
generated
Normal file
12
extLib/chinaumsdk/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
BIN
extLib/chinaumsdk/chinaumsdk.jar
Normal file
BIN
extLib/chinaumsdk/chinaumsdk.jar
Normal file
Binary file not shown.
52
extLib/chinaumsdk/pom.xml
Normal file
52
extLib/chinaumsdk/pom.xml
Normal file
@@ -0,0 +1,52 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.chinaums.open</groupId>
|
||||
<artifactId>open-api-sdk</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>open-api-sdk</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<version>2.4</version>
|
||||
<classifier>jdk15</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>3.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>19.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.15</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.chinaums.open.api;
|
||||
|
||||
import com.chinaums.open.api.constants.ConfigBean;
|
||||
import com.chinaums.open.api.internal.util.OpenApiLogger;
|
||||
import com.chinaums.open.api.internal.util.http.HttpTransport;
|
||||
import com.chinaums.open.api.parser.json.ObjectJsonParser;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/2
|
||||
* Time: 14:22
|
||||
* 所属模块:
|
||||
* 功能说明:开放平台客户端
|
||||
*/
|
||||
public class DefaultOpenApiClient implements OpenApiClient {
|
||||
private static final String constant_classname=DefaultOpenApiClient.class.getSimpleName();
|
||||
/**
|
||||
* 开放平台URL
|
||||
*/
|
||||
private String serverUrl;
|
||||
/**
|
||||
* appId
|
||||
*/
|
||||
private String appId;
|
||||
/**
|
||||
* appKey
|
||||
*/
|
||||
private String appKey;
|
||||
/**
|
||||
* 字符集格式
|
||||
*/
|
||||
private String encodeCharSet;
|
||||
|
||||
public DefaultOpenApiClient(String serverUrl, String appId, String appKey) {
|
||||
this.serverUrl = serverUrl;
|
||||
this.appId = appId;
|
||||
this.appKey = appKey;
|
||||
}
|
||||
|
||||
public DefaultOpenApiClient(String serverUrl, String appId, String appKey, String encodeCharSet) {
|
||||
this.serverUrl = serverUrl;
|
||||
this.appId = appId;
|
||||
this.appKey = appKey;
|
||||
this.encodeCharSet = encodeCharSet;
|
||||
}
|
||||
|
||||
public <T extends OpenApiResponse> T execute(OpenApiRequest<T> openApiRequest) throws OpenApiException {
|
||||
return execute(openApiRequest,null,null);
|
||||
}
|
||||
|
||||
public <T extends OpenApiResponse> T execute(OpenApiRequest<T> openApiRequest, String token) throws OpenApiException {
|
||||
return execute(openApiRequest,token,null);
|
||||
}
|
||||
|
||||
public <T extends OpenApiResponse> T execute(OpenApiRequest<T> openApiRequest, String token,String encodeCharSet) throws OpenApiException {
|
||||
OpenApiParser<T> openApiParser = new ObjectJsonParser<T>(openApiRequest.responseClass());
|
||||
return execute_(openApiRequest,openApiParser,token,encodeCharSet);
|
||||
}
|
||||
|
||||
public <T extends OpenApiResponse> T execute_(OpenApiRequest<T> openApiRequest,OpenApiParser<T> openApiParser,String token,String encodeCharSet){
|
||||
ConfigBean configBean = new ConfigBean();
|
||||
OpenApiContext context = new OpenApiContext();
|
||||
T trsp = null;
|
||||
String response = "";
|
||||
try {
|
||||
if(StringUtils.isBlank(serverUrl)) throw new OpenApiException("通讯地址未设置");
|
||||
if(StringUtils.isBlank(appId)) throw new OpenApiException("开发者appId未设置");
|
||||
if(StringUtils.isBlank(appKey)) throw new OpenApiException("开发者appKey未设置");
|
||||
String request = openApiParser.validRequest(openApiRequest);
|
||||
context.setStartTime(System.currentTimeMillis());
|
||||
context.setRequestId(UUID.randomUUID().toString().replace("-",""));
|
||||
context.setOpenServUrl(serverUrl);
|
||||
String url = serverUrl.concat(openApiRequest.apiVersion()).concat(openApiRequest.serviceCode());
|
||||
context.setApiServiceUrl(url);
|
||||
context.setApiMethodName(openApiRequest.apiMethodName());
|
||||
context.setVersion(openApiRequest.apiVersion());
|
||||
context.setAppId(appId);
|
||||
context.setAppKey(appKey);
|
||||
context.setConfigBean(configBean);
|
||||
context.setServiceCode(openApiRequest.serviceCode());
|
||||
if(openApiRequest.needToken()){
|
||||
OpenApiCache.getCurrentToken(context);
|
||||
response = HttpTransport.getInstance().doPost(context,request);
|
||||
}else{
|
||||
response = HttpTransport.getInstance().doPost(configBean.isProd(),url,token,request);
|
||||
}
|
||||
if(StringUtils.isBlank(response)) throw new OpenApiException("服务提供方未返回");
|
||||
if(StringUtils.isNotBlank(encodeCharSet)){
|
||||
//encodeCharSet = configBean.getCharSet();
|
||||
trsp = openApiParser.parse(new String(response.getBytes(),encodeCharSet));
|
||||
}else{
|
||||
trsp = openApiParser.parse(response);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
OpenApiLogger.logError(constant_classname +" SDK异常:"+e.getStackTrace());
|
||||
e.printStackTrace();
|
||||
}
|
||||
context.setEndTime(System.currentTimeMillis());
|
||||
return trsp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.chinaums.open.api;
|
||||
|
||||
import com.chinaums.open.api.internal.util.OpenTokenUtil;
|
||||
import com.chinaums.open.api.response.TokenResponse;
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/6
|
||||
* Time: 11:01
|
||||
* 所属模块:
|
||||
* 功能说明:cache缓存
|
||||
*/
|
||||
public class OpenApiCache {
|
||||
|
||||
public final static int MAX_PROCESS_TIMEOUT = 3600;
|
||||
|
||||
public static Cache<String, Object> contextCache = CacheBuilder.newBuilder()
|
||||
.expireAfterWrite(MAX_PROCESS_TIMEOUT, TimeUnit.SECONDS).build();
|
||||
|
||||
/**
|
||||
* 获取当前有效的token
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static TokenResponse getCurrentToken(OpenApiContext context){
|
||||
String appId = context.getAppId();
|
||||
TokenResponse token = (TokenResponse)contextCache.getIfPresent(appId);
|
||||
if(token==null){
|
||||
token = OpenTokenUtil.getToken(context);
|
||||
contextCache.put(context.getAppId(), token);
|
||||
}
|
||||
context.setCurrentToken(token);
|
||||
return token;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.chinaums.open.api;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/2
|
||||
* Time: 14:18
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public abstract interface OpenApiClient {
|
||||
public abstract <T extends OpenApiResponse> T execute(OpenApiRequest<T> openApiRequest) throws OpenApiException;
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package com.chinaums.open.api;
|
||||
|
||||
import com.chinaums.open.api.constants.ConfigBean;
|
||||
import com.chinaums.open.api.response.TokenResponse;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/6
|
||||
* Time: 10:17
|
||||
* 所属模块:
|
||||
* 功能说明:api 处理报文上下文
|
||||
*/
|
||||
public class OpenApiContext {
|
||||
private String requestId;
|
||||
private TokenResponse currentToken;
|
||||
private long startTime;
|
||||
private long endTime;
|
||||
private String request;
|
||||
private String response;
|
||||
private Map<String,Object> params;
|
||||
private String apiMethodName;
|
||||
private String serviceCode;
|
||||
private String openServUrl;
|
||||
private String version;
|
||||
private String appId;
|
||||
private String appKey;
|
||||
private ConfigBean configBean;
|
||||
private String apiServiceUrl;
|
||||
public String getRequestId() {
|
||||
return requestId;
|
||||
}
|
||||
|
||||
public void setRequestId(String requestId) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
|
||||
public TokenResponse getCurrentToken() {
|
||||
return currentToken;
|
||||
}
|
||||
|
||||
public void setCurrentToken(TokenResponse currentToken) {
|
||||
this.currentToken = currentToken;
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(long startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public long getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(long endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getRequest() {
|
||||
return request;
|
||||
}
|
||||
|
||||
public void setRequest(String request) {
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
public String getResponse() {
|
||||
return response;
|
||||
}
|
||||
|
||||
public void setResponse(String response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public Map<String, Object> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Map<String, Object> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public String getServiceCode() {
|
||||
return serviceCode;
|
||||
}
|
||||
|
||||
public void setServiceCode(String serviceCode) {
|
||||
this.serviceCode = serviceCode;
|
||||
}
|
||||
|
||||
public String getApiMethodName() {
|
||||
return apiMethodName;
|
||||
}
|
||||
|
||||
public void setApiMethodName(String apiMethodName) {
|
||||
this.apiMethodName = apiMethodName;
|
||||
}
|
||||
|
||||
public String getOpenServUrl() {
|
||||
return openServUrl;
|
||||
}
|
||||
|
||||
public void setOpenServUrl(String openServUrl) {
|
||||
this.openServUrl = openServUrl;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getAppKey() {
|
||||
return appKey;
|
||||
}
|
||||
|
||||
public void setAppKey(String appKey) {
|
||||
this.appKey = appKey;
|
||||
}
|
||||
|
||||
public ConfigBean getConfigBean() {
|
||||
return configBean;
|
||||
}
|
||||
|
||||
public void setConfigBean(ConfigBean configBean) {
|
||||
this.configBean = configBean;
|
||||
}
|
||||
|
||||
public String getApiServiceUrl() {
|
||||
return apiServiceUrl;
|
||||
}
|
||||
|
||||
public void setApiServiceUrl(String apiServiceUrl) {
|
||||
this.apiServiceUrl = apiServiceUrl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.chinaums.open.api;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/2
|
||||
* Time: 10:11
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public class OpenApiException extends Exception implements Serializable{
|
||||
private String errCode;
|
||||
private String errInfo;
|
||||
public OpenApiException() {}
|
||||
|
||||
public OpenApiException(String message, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public OpenApiException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
public OpenApiException(Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public OpenApiException(String errCode, String errInfo)
|
||||
{
|
||||
super(errCode + ":" + errInfo);
|
||||
this.errCode = errCode;
|
||||
this.errInfo = errInfo;
|
||||
}
|
||||
|
||||
public String getErrCode()
|
||||
{
|
||||
return this.errCode;
|
||||
}
|
||||
|
||||
public String getErrMsg()
|
||||
{
|
||||
return this.errInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.chinaums.open.api;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/2
|
||||
* Time: 14:27
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public abstract interface OpenApiParser<T extends OpenApiResponse> {
|
||||
/**
|
||||
* 返回内容格式转换
|
||||
* @param paramString
|
||||
* @return
|
||||
* @throws OpenApiException
|
||||
*/
|
||||
public abstract T parse(String paramString) throws OpenApiException;
|
||||
|
||||
/**
|
||||
* 请求参数检查
|
||||
* @param openApiRequest
|
||||
* @return
|
||||
* @throws OpenApiException
|
||||
*/
|
||||
public abstract String validRequest(OpenApiRequest<T> openApiRequest) throws OpenApiException;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.chinaums.open.api;
|
||||
|
||||
/**
|
||||
* Created by ZHANGWEI on 2016/12/2.
|
||||
*/
|
||||
public abstract interface OpenApiRequest<T extends OpenApiResponse> {
|
||||
public abstract Class<T> responseClass();
|
||||
/*
|
||||
api版本号
|
||||
*/
|
||||
public abstract String apiVersion();
|
||||
/*
|
||||
api接口名称定义
|
||||
*/
|
||||
public abstract String apiMethodName();
|
||||
/*
|
||||
开放平台分配servicecode
|
||||
*/
|
||||
public abstract String serviceCode();
|
||||
|
||||
/*
|
||||
是否需要获取token
|
||||
*/
|
||||
public abstract boolean needToken();
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.chinaums.open.api;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by ZHANGWEI on 2016/12/2.
|
||||
*/
|
||||
public abstract class OpenApiResponse implements Serializable{
|
||||
private String errCode;
|
||||
private String errInfo;
|
||||
|
||||
public String getErrCode() {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
public void setErrCode(String errCode) {
|
||||
this.errCode = errCode;
|
||||
}
|
||||
|
||||
public String getErrInfo() {
|
||||
return errInfo;
|
||||
}
|
||||
|
||||
public void setErrInfo(String errInfo) {
|
||||
this.errInfo = errInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.chinaums.open.api.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Created by ZHANGWEI on 2016/12/2.
|
||||
*/
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ApiField {
|
||||
String key() default "";
|
||||
String name() default "";
|
||||
boolean required() default false;
|
||||
int length() default -1;
|
||||
int minLength() default -1;
|
||||
int maxLength() default -1;
|
||||
String index() default "0";
|
||||
String desc() default "";
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.chinaums.open.api.constants;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/4
|
||||
* Time: 21:22
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public class ConfigBean {
|
||||
/*
|
||||
字符集格式
|
||||
*/
|
||||
private String charSet = "UTF-8";
|
||||
/*
|
||||
是否是生产环境
|
||||
*/
|
||||
private boolean isProd = false;
|
||||
|
||||
private String version = "v2";
|
||||
/**
|
||||
* token申请失效后,重试次数
|
||||
*/
|
||||
private int tokenAcquireReties = 3;
|
||||
/**
|
||||
* token提前申请的时间
|
||||
*/
|
||||
private int tokenAcquireAheadInterval = 600;
|
||||
/*
|
||||
获取token servicecode
|
||||
*/
|
||||
private String tokenServiceCode="/token/access";
|
||||
|
||||
public String getCharSet() {
|
||||
return charSet;
|
||||
}
|
||||
|
||||
public void setCharSet(String charSet) {
|
||||
this.charSet = charSet;
|
||||
}
|
||||
|
||||
public boolean isProd() {
|
||||
return isProd;
|
||||
}
|
||||
|
||||
public void setProd(boolean prod) {
|
||||
isProd = prod;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public int getTokenAcquireReties() {
|
||||
return tokenAcquireReties;
|
||||
}
|
||||
|
||||
public void setTokenAcquireReties(int tokenAcquireReties) {
|
||||
this.tokenAcquireReties = tokenAcquireReties;
|
||||
}
|
||||
|
||||
public int getTokenAcquireAheadInterval() {
|
||||
return tokenAcquireAheadInterval;
|
||||
}
|
||||
|
||||
public void setTokenAcquireAheadInterval(int tokenAcquireAheadInterval) {
|
||||
this.tokenAcquireAheadInterval = tokenAcquireAheadInterval;
|
||||
}
|
||||
|
||||
public String getTokenServiceCode() {
|
||||
return tokenServiceCode;
|
||||
}
|
||||
|
||||
public void setTokenServiceCode(String tokenServiceCode) {
|
||||
this.tokenServiceCode = tokenServiceCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.chinaums.open.api.constants;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/5
|
||||
* Time: 18:46
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public class Constants {
|
||||
public static class ERR_CODE {
|
||||
public static final String NORMAL = "0000";
|
||||
public static final String ILLEGAL_CALL = "9000";
|
||||
public static final String ILLEGAL_PARAMETER = "9001";
|
||||
public static final String FATAL = "9999";
|
||||
}
|
||||
public static class ERR_INFO {
|
||||
public static final String NORMAL = "正常";
|
||||
public static final String ILLEGAL_CALL = "非法访问";
|
||||
public static final String ILLEGAL_PARAMETER = "请求参数校验失败";
|
||||
public static final String FATAL = "系统错误";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Project:TODO ADD PROJECT NAME
|
||||
* Modify Information:
|
||||
* ================================================================
|
||||
* Author Date Description
|
||||
* ------------ ---------- --------------------------------
|
||||
* wmshen 2022/10/20 TODO:
|
||||
* ================================================================
|
||||
* Copyright (c) 银联商务股份有限公司 www.chinaums.com
|
||||
*/
|
||||
package com.chinaums.open.api.internal.util;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Desc: TODO ADD DESC
|
||||
* <p>
|
||||
* Function:
|
||||
* <dl>
|
||||
* <dt>核心功能点1</dt>
|
||||
* <dd>核心功能点1说明</dd>
|
||||
* <dt>核心功能点2</dt>
|
||||
* <dd>核心功能点2说明</dd>
|
||||
* </dl>
|
||||
*
|
||||
* @app <服务名称英文缩写>
|
||||
* @layer <代码所在分层>
|
||||
* @refApp <依赖服务的英文缩写>
|
||||
* @author <a href="mailto:wmshen@chinaums.com">wmshen</a>
|
||||
* @since 2022/10/20
|
||||
* @version 2022/10/20
|
||||
*/
|
||||
public class DateUtils {
|
||||
public static String getFormatDate(){
|
||||
Date date = new Date();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
return sdf.format(date);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
package com.chinaums.open.api.internal.util;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/2
|
||||
* Time: 16:17
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public class FieldUtils {
|
||||
public static Object getFieldValueByTypeAndFormat(Field field, Object bean,
|
||||
String format) throws ParseException, IllegalArgumentException,
|
||||
IllegalAccessException {
|
||||
field.setAccessible(true);
|
||||
Object objValue = field.get(bean);
|
||||
Object ret = null;
|
||||
if (objValue == null)
|
||||
return ret;
|
||||
String type = field.getType().getName();
|
||||
if ("java.lang.String".equals(type)) {
|
||||
ret = field.get(bean).toString().trim();
|
||||
} else if ("java.lang.Integer".equals(type) || "int".equals(type)) {
|
||||
if (objValue instanceof Integer) {
|
||||
ret = ((Integer) objValue).toString();
|
||||
}
|
||||
} else if ("java.lang.Float".equals(type) || "float".equals(type)) {
|
||||
if (objValue instanceof Float) {
|
||||
ret = ((Float) objValue).toString();
|
||||
}
|
||||
} else if ("java.lang.Double".equals(type) || "double".equals(type)) {
|
||||
if (objValue instanceof Double) {
|
||||
ret = ((Double) objValue).toString();
|
||||
}
|
||||
} else if ("java.math.BigDecimal".equals(type)) {
|
||||
if (objValue instanceof BigDecimal) {
|
||||
ret = ((BigDecimal) objValue).toString();
|
||||
}
|
||||
} else if ("java.util.Date".equals(type)) {
|
||||
if (objValue instanceof Date) {
|
||||
Date dateValue = (Date) objValue;
|
||||
ret = new SimpleDateFormat(format).format(dateValue);
|
||||
}
|
||||
} else if ("java.lang.Boolean".equals(type)) {
|
||||
if (objValue instanceof Boolean) {
|
||||
ret = ((Boolean) objValue).toString();
|
||||
}
|
||||
} else if ("java.lang.Long".equals(type) || "long".equals(type)) {
|
||||
if (objValue instanceof Long) {
|
||||
ret = ((Long) objValue).toString();
|
||||
}
|
||||
} else {
|
||||
ret = objValue;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static void setFieldValueByType(Field field, Object bean,
|
||||
String value) throws IllegalArgumentException,
|
||||
IllegalAccessException, ParseException, ClassNotFoundException {
|
||||
setFieldValueByTypeAndFormat(field,bean,value,null);
|
||||
}
|
||||
|
||||
public static void setFieldValueByTypeAndFormat(Field field, Object bean,
|
||||
String value, String format) throws IllegalArgumentException,
|
||||
IllegalAccessException, ParseException, ClassNotFoundException {
|
||||
if (value == null)
|
||||
return;
|
||||
field.setAccessible(true);
|
||||
String type = field.getType().getName();
|
||||
if ("java.lang.String".equals(type)) {
|
||||
field.set(bean, value);
|
||||
} else if ("java.lang.Integer".equals(type)) {
|
||||
field.set(bean, Integer.valueOf(value));
|
||||
} else if ("int".equals(type)) {
|
||||
field.set(bean, Integer.valueOf(value).intValue());
|
||||
} else if ("java.lang.Float".equals(type)) {
|
||||
field.set(bean, Float.valueOf(value));
|
||||
} else if ("float".equals(type)) {
|
||||
field.set(bean, Float.valueOf(value).floatValue());
|
||||
} else if ("java.lang.Double".equals(type)) {
|
||||
field.set(bean, Double.valueOf(value));
|
||||
} else if ("double".equals(type)) {
|
||||
field.set(bean, Double.valueOf(value).doubleValue());
|
||||
} else if ("java.math.BigDecimal".equals(type)) {
|
||||
field.set(bean, new BigDecimal(value));
|
||||
} else if ("java.util.Date".equals(type)) {
|
||||
Date date = new SimpleDateFormat(format).parse(value.toString());
|
||||
field.set(bean, date);
|
||||
} else if ("java.lang.Boolean".equals(type)) {
|
||||
field.set(bean, Boolean.valueOf(value));
|
||||
} else if ("java.lang.Long".equals(type)) {
|
||||
field.set(bean, Long.valueOf(value));
|
||||
} else if ("java.lang.Object".equals(type)) {
|
||||
field.set(bean, value);
|
||||
} else if ("long".equals(type)) {
|
||||
field.set(bean, Long.valueOf(value).longValue());
|
||||
} else if ("java.util.Map".equals(type)) {
|
||||
JSONObject mapObj = JSONObject.fromObject(value);
|
||||
field.set(bean,mapObj);
|
||||
} else if ("java.util.List".equals(type)) {
|
||||
JSONArray arr = JSONArray.fromObject(value);
|
||||
ParameterizedType genericType = (ParameterizedType) field.getGenericType();
|
||||
Type listType = genericType.getActualTypeArguments()[0];
|
||||
if (listType instanceof ParameterizedType) {
|
||||
ParameterizedType paraType = (ParameterizedType) listType;
|
||||
if ("java.util.Map".equals(((Class<?>)paraType.getRawType()).getName())) {
|
||||
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
Map<String,String> classMap = new HashMap<String,String>();
|
||||
Map<String, String> map = (Map<String, String>) JSONObject
|
||||
.toBean(JSONObject.fromObject(arr.optString(i)),
|
||||
Map.class, classMap);
|
||||
list.add(map);
|
||||
}
|
||||
field.set(bean, list);
|
||||
}
|
||||
} else if(List.class.isAssignableFrom(field.getType())){
|
||||
String argCalssName = listType.toString().substring(listType.toString().lastIndexOf(" ") + 1);
|
||||
Class<?> clazz = Class.forName(argCalssName);
|
||||
List<Object> list = new ArrayList<Object>();
|
||||
for (int index = 0; index < arr.size(); index++) {
|
||||
Object element = arr.get(index);
|
||||
if (clazz == element.getClass()) {
|
||||
list.add(element);
|
||||
} else {
|
||||
Object obj = JSONObject.toBean(JSONObject.fromObject(arr.optString(index)), clazz);
|
||||
list.add(obj);
|
||||
}
|
||||
}
|
||||
field.set(bean, list);
|
||||
} else {
|
||||
field.set(bean, arr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Field getFieldByName(Object obj, String key) {
|
||||
if (obj == null || key == null)
|
||||
return null;
|
||||
for (Class clazz = obj.getClass(); !clazz.getName().equals(Object.class.getName()); clazz = clazz
|
||||
.getSuperclass()) {
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
for (Field f : fields) {
|
||||
if (f.getName().equals(key)) {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public static Field getFieldByNameIgnoreCase(Class<?> clazz, String key) {
|
||||
if (clazz == null || key == null)
|
||||
return null;
|
||||
for (; !clazz.getName().equals(Object.class.getName()); clazz = clazz
|
||||
.getSuperclass()) {
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
for (Field f : fields) {
|
||||
if (f.getName().equalsIgnoreCase(key)) {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public static Object getFieldValueByNameIgnoreCase(Object obj, String key) {
|
||||
if (obj == null || key == null)
|
||||
return null;
|
||||
Class<? extends Object> clazz = obj.getClass();
|
||||
for (; !clazz.getName().equals(Object.class.getName()); clazz = clazz
|
||||
.getSuperclass()) {
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
for (Field f : fields) {
|
||||
if (f.getName().equalsIgnoreCase(key)) {
|
||||
f.setAccessible(true);
|
||||
try {
|
||||
return f.get(obj);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.chinaums.open.api.internal.util;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/2
|
||||
* Time: 10:21
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public class OpenApiLogger {
|
||||
private static final Log blog = LogFactory.getLog("sdk.biz.err");
|
||||
private static final Log clog = LogFactory.getLog("sdk.biz.info");
|
||||
private static boolean needEnableLogger = true;
|
||||
|
||||
public static void logInfo(String rsp){
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
df.setTimeZone(TimeZone.getTimeZone("GMT+8"));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(df.format(new Date()));
|
||||
sb.append("#");
|
||||
sb.append(rsp);
|
||||
clog.info(sb.toString());
|
||||
}
|
||||
|
||||
public static void logError(String rsp)
|
||||
{
|
||||
if (!needEnableLogger) {
|
||||
return;
|
||||
}
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
df.setTimeZone(TimeZone.getTimeZone("GMT+8"));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(df.format(new Date()));
|
||||
sb.append("###");
|
||||
sb.append(rsp);
|
||||
blog.error(sb.toString());
|
||||
}
|
||||
|
||||
public static void logError(Throwable t)
|
||||
{
|
||||
if (!needEnableLogger) {
|
||||
return;
|
||||
}
|
||||
blog.error(t);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.chinaums.open.api.internal.util;
|
||||
|
||||
import com.chinaums.open.api.OpenApiContext;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User:
|
||||
* Date:
|
||||
* Time:
|
||||
* 所属模块:
|
||||
* 功能说明:Open body sig相关
|
||||
*/
|
||||
public class OpenBodySigUtil {
|
||||
|
||||
/**
|
||||
* open-body-sig算法
|
||||
* @param context
|
||||
* @param request
|
||||
* @param method
|
||||
* @return
|
||||
*/
|
||||
public static String generateSignature(OpenApiContext context, String request,String method) {
|
||||
|
||||
try {
|
||||
String appId=context.getAppId();
|
||||
String appKey=context.getAppKey();
|
||||
String timestamp = new SimpleDateFormat("yyyyMMddHHmmss")
|
||||
.format(new Date());
|
||||
String nonce = UUID.randomUUID().toString().replace("-", "");
|
||||
String testSH = DigestUtils.sha256Hex(request);
|
||||
|
||||
String s1 = appId+timestamp+nonce+testSH;
|
||||
|
||||
String algorithm = "HmacSHA256";
|
||||
Mac mac = Mac.getInstance(algorithm);
|
||||
mac.init(new SecretKeySpec(appKey.getBytes(), algorithm));
|
||||
byte[] localSignature =mac.doFinal(s1.getBytes("utf-8"));
|
||||
|
||||
String localSignatureStr = Base64.encodeBase64String(localSignature);
|
||||
OpenApiLogger.logInfo("SHA256(签名内容):"+testSH);
|
||||
OpenApiLogger.logInfo("s1"+s1);
|
||||
|
||||
if(method.equals("POST")){
|
||||
OpenApiLogger.logInfo( "OPEN-BODY-SIG AppId=" + "\"" + appId + "\"" + ", Timestamp=" + "\"" + timestamp + "\"" + ", Nonce=" + "\"" + nonce + "\"" + ", Signature=" + "\"" + localSignatureStr + "\"");
|
||||
return "OPEN-BODY-SIG AppId=" + "\"" + appId + "\"" + ", Timestamp=" + "\"" + timestamp + "\"" + ", Nonce=" + "\"" + nonce + "\"" + ", Signature=" + "\"" + localSignatureStr + "\"";
|
||||
}
|
||||
return "authorization=OPEN-FORM-PARAM" + "&appId=" + appId + "×tamp=" + timestamp + "&nonce=" + nonce + "&content=" + URLEncoder.encode(request.toString(), "UTF-8") + "&signature=" + URLEncoder.encode(localSignatureStr, "UTF-8");
|
||||
} catch (Exception e) {
|
||||
OpenApiLogger.logError(e.getCause());
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.chinaums.open.api.internal.util;
|
||||
|
||||
import com.chinaums.open.api.OpenApiContext;
|
||||
import com.chinaums.open.api.constants.ConfigBean;
|
||||
import com.chinaums.open.api.internal.util.converter.Converter;
|
||||
import com.chinaums.open.api.internal.util.converter.JsonConverter;
|
||||
import com.chinaums.open.api.internal.util.http.HttpTransport;
|
||||
import com.chinaums.open.api.request.TokenRequest;
|
||||
import com.chinaums.open.api.response.TokenResponse;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/5
|
||||
* Time: 15:41
|
||||
* 所属模块:
|
||||
* 功能说明:Open Token相关
|
||||
*/
|
||||
public class OpenTokenUtil {
|
||||
private static final String constant_classname=OpenTokenUtil.class.getSimpleName();
|
||||
|
||||
/**
|
||||
* token sha256签名算法
|
||||
* @param appId
|
||||
* @param timestamp
|
||||
* @param nonce
|
||||
* @param appKey
|
||||
* @return
|
||||
*/
|
||||
public static String generateSignature(String appId, String timestamp,
|
||||
String nonce, String appKey) {
|
||||
String plaintext = appId + timestamp + nonce + appKey;
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("SHA-256");
|
||||
digest.update(plaintext.getBytes());
|
||||
byte messageDigest[] = digest.digest();
|
||||
StringBuffer hexString = new StringBuffer();
|
||||
for (int i = 0; i < messageDigest.length; i++) {
|
||||
String shaHex = Integer.toHexString(messageDigest[i] & 0xFF);
|
||||
if (shaHex.length() < 2) {
|
||||
hexString.append(0);
|
||||
}
|
||||
hexString.append(shaHex);
|
||||
}
|
||||
return hexString.toString();
|
||||
|
||||
} catch (Exception e) {
|
||||
OpenApiLogger.logError(e.getCause());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取token
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static TokenResponse getToken(OpenApiContext context){
|
||||
int retry = 0;
|
||||
ConfigBean configBean = context.getConfigBean();
|
||||
TokenResponse acquiredToken = null;
|
||||
if (isTokenValid(context.getCurrentToken())
|
||||
&& !isTokenTimeout(context.getCurrentToken())) {
|
||||
return context.getCurrentToken();
|
||||
}
|
||||
while (retry++ < configBean.getTokenAcquireReties()) {
|
||||
acquiredToken = acquireAccessToken(context);
|
||||
if (null != acquiredToken) { //如果想根据请求token是否成功 用于重试 判断用if (null != acquiredToken.getAccessToken())
|
||||
break;
|
||||
} else if (retry < configBean.getTokenAcquireReties()) {
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
} catch (Exception e) {
|
||||
OpenApiLogger.logError(constant_classname +" 重试token申请出错:"+e.getCause());
|
||||
}
|
||||
} else {
|
||||
OpenApiLogger.logError(constant_classname +" 申请token超过重试次数 bye-bye");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return acquiredToken;
|
||||
}
|
||||
|
||||
private static TokenResponse acquireAccessToken(OpenApiContext context){
|
||||
String appId = context.getAppId();
|
||||
String appKey = context.getAppKey();
|
||||
ConfigBean configBean = context.getConfigBean();
|
||||
TokenRequest tokenRequest = new TokenRequest(appId,appKey);
|
||||
JSONObject jsonObj = JSONObject.fromObject(tokenRequest);
|
||||
TokenResponse tokenResponse;
|
||||
String url = context.getOpenServUrl().concat(configBean.getVersion()).concat(configBean.getTokenServiceCode());
|
||||
try {
|
||||
String response = HttpTransport.getInstance().doPost(configBean.isProd(),url,null,jsonObj.toString());
|
||||
if(StringUtils.isBlank(response)) throw new Exception(constant_classname+":服务提供方未返回");
|
||||
Converter converter = new JsonConverter();
|
||||
tokenResponse = converter.toResponse(response,TokenResponse.class);
|
||||
tokenResponse.setEffectTime(new Date());
|
||||
tokenResponse.setTimeout(tokenResponse.getExpiresIn());
|
||||
tokenResponse.setAheadInterval(configBean.getTokenAcquireAheadInterval());
|
||||
return tokenResponse;
|
||||
} catch (Exception e) {
|
||||
OpenApiLogger.logError(constant_classname +" exception:"+e.getCause());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean isTokenValid(TokenResponse tokenBean) {
|
||||
return (null != tokenBean
|
||||
&& org.apache.commons.lang.StringUtils.isNotBlank(tokenBean.getAccessToken())
|
||||
&& null != tokenBean.getEffectTime()
|
||||
&& tokenBean.getTimeout() > 0
|
||||
&& tokenBean.getAheadInterval() > 0 && tokenBean.getTimeout() > tokenBean
|
||||
.getAheadInterval());
|
||||
}
|
||||
|
||||
private static boolean isTokenTimeout(TokenResponse tokenBean) {
|
||||
int elapseInterval = (int) ((new Date().getTime() - tokenBean
|
||||
.getEffectTime().getTime()) / 1000);
|
||||
int maxEffectiveInterval = tokenBean.getTimeout()
|
||||
- tokenBean.getAheadInterval();
|
||||
boolean isTimeout = (elapseInterval > maxEffectiveInterval);
|
||||
if (isTimeout) {
|
||||
OpenApiLogger.logError(constant_classname +" exception:token过期了");
|
||||
}
|
||||
return isTimeout;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.chinaums.open.api.internal.util.converter;
|
||||
|
||||
import com.chinaums.open.api.OpenApiException;
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
import java.text.ParseException;
|
||||
|
||||
/**
|
||||
* Created by ZHANGWEI on 2016/12/2.
|
||||
*/
|
||||
public abstract interface Converter {
|
||||
public abstract <T extends OpenApiResponse> T toResponse(String paramString, Class<T> paramClass)
|
||||
throws OpenApiException, IllegalAccessException, InstantiationException, ParseException, ClassNotFoundException;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.chinaums.open.api.internal.util.converter;
|
||||
|
||||
import com.chinaums.open.api.OpenApiException;
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
import com.chinaums.open.api.internal.util.FieldUtils;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.ParseException;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/2
|
||||
* Time: 14:50
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public class JsonConverter implements Converter {
|
||||
public <T extends OpenApiResponse> T toResponse(String paramString, Class<T> paramClass) throws OpenApiException, IllegalAccessException, InstantiationException, ParseException, ClassNotFoundException {
|
||||
JSONObject jsonObj = JSONObject.fromObject(paramString);
|
||||
Object bean = paramClass.newInstance();
|
||||
for (Class clazz = bean.getClass(); !clazz.getName().equals(
|
||||
Object.class.getName()); clazz = clazz.getSuperclass()) {
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
String fieldName = field.getName();
|
||||
String name = fieldName;
|
||||
String key = fieldName;
|
||||
String value = jsonObj.get(key) == null ? null : jsonObj
|
||||
.get(key).toString().trim();
|
||||
FieldUtils.setFieldValueByTypeAndFormat(field, bean, value, null);
|
||||
}
|
||||
}
|
||||
return (T) bean;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package com.chinaums.open.api.internal.util.http;
|
||||
|
||||
import com.chinaums.open.api.OpenApiContext;
|
||||
import com.chinaums.open.api.constants.ConfigBean;
|
||||
import com.chinaums.open.api.internal.util.OpenApiLogger;
|
||||
import com.chinaums.open.api.response.TokenResponse;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import static com.chinaums.open.api.internal.util.OpenBodySigUtil.generateSignature;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/5
|
||||
* Time: 13:56
|
||||
* 所属模块:
|
||||
* 功能说明:http通用处理
|
||||
*/
|
||||
public class HttpTransport implements IHttpTransport {
|
||||
|
||||
private static OkHttpClient okHttpClient;
|
||||
private static HttpTransport httpUtils;
|
||||
public static final MediaType JSON=MediaType.parse("application/json; charset=utf-8");
|
||||
|
||||
private HttpTransport() {
|
||||
}
|
||||
|
||||
public static synchronized HttpTransport getInstance() {
|
||||
if (httpUtils == null) {
|
||||
httpUtils = new HttpTransport();
|
||||
initialize();
|
||||
}
|
||||
return httpUtils;
|
||||
}
|
||||
|
||||
private static void initialize() {
|
||||
okHttpClient = new OkHttpClient();
|
||||
}
|
||||
|
||||
/**
|
||||
* http post
|
||||
* @param isProd
|
||||
* @param url
|
||||
* @param token
|
||||
* @param requestString
|
||||
* @return
|
||||
*/
|
||||
public String doPost(boolean isProd,String url, String token, String requestString) throws Exception {
|
||||
Request request = null;
|
||||
RequestBody requestBody = RequestBody.create(JSON,requestString);
|
||||
Response response;
|
||||
String responseInfo = "";
|
||||
if(!isProd){
|
||||
OpenApiLogger.logInfo("url:"+url);
|
||||
OpenApiLogger.logInfo("requst params:"+requestString);
|
||||
}
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
request = new Request.Builder().url(url).addHeader("Authorization", "OPEN-ACCESS-TOKEN AccessToken=" + token).post(requestBody).build();
|
||||
}else{
|
||||
request = new Request.Builder().url(url).post(requestBody).build();
|
||||
}
|
||||
try {
|
||||
response = okHttpClient.newCall(request).execute();
|
||||
responseInfo = response.body().source().readUtf8();
|
||||
OpenApiLogger.logInfo("response :"+responseInfo);
|
||||
return responseInfo;
|
||||
} catch (Exception e) {
|
||||
OpenApiLogger.logError("通讯网络异常: "+e.getStackTrace());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* http post token方式
|
||||
* @param context
|
||||
* @param resquest_
|
||||
* @return
|
||||
* @throws Throwable
|
||||
*/
|
||||
public String doPost(OpenApiContext context, String resquest_) throws Exception {
|
||||
String url = context.getApiServiceUrl();
|
||||
String appId=context.getAppId();
|
||||
ConfigBean configBean = context.getConfigBean();
|
||||
context.setRequest(resquest_);
|
||||
Request request = null;
|
||||
RequestBody requestBody = RequestBody.create(JSON,resquest_);
|
||||
Response response;
|
||||
String responseInfo = "";
|
||||
if(!configBean.isProd()){
|
||||
OpenApiLogger.logInfo("url:"+url);
|
||||
OpenApiLogger.logInfo("requst params:"+resquest_);
|
||||
|
||||
}
|
||||
TokenResponse token = context.getCurrentToken();
|
||||
request = new Request.Builder().url(url).
|
||||
addHeader("Authorization","OPEN-ACCESS-TOKEN AccessToken=" + token.getAccessToken()+",AppId="+appId)
|
||||
// .addHeader("X-Access-Model","NEW")
|
||||
.post(requestBody).build();
|
||||
OpenApiLogger.logInfo("requst header:"+"OPEN-ACCESS-TOKEN AccessToken=" + token.getAccessToken()+",AppId="+appId);
|
||||
try {
|
||||
response = okHttpClient.newCall(request).execute();
|
||||
OpenApiLogger.logInfo("服务端返回code:"+response.code()+" message:"+response.message());
|
||||
responseInfo = response.body().source().readUtf8();
|
||||
context.setResponse(responseInfo);
|
||||
OpenApiLogger.logInfo("response :"+responseInfo);
|
||||
return responseInfo;
|
||||
} catch (Exception e) {
|
||||
OpenApiLogger.logError("通讯网络异常: "+e.getStackTrace());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* http post signature方式
|
||||
* @param context
|
||||
* @param resquest_
|
||||
* @return
|
||||
* @throws Throwable
|
||||
*/
|
||||
public String doPostSignature(OpenApiContext context, String resquest_) throws Exception {
|
||||
String url = context.getApiServiceUrl();
|
||||
ConfigBean configBean = context.getConfigBean();
|
||||
context.setRequest(resquest_);
|
||||
Request request = null;
|
||||
RequestBody requestBody = RequestBody.create(JSON,resquest_);
|
||||
Response response;
|
||||
String responseInfo = "";
|
||||
if(!configBean.isProd()){
|
||||
OpenApiLogger.logInfo("url:"+url);
|
||||
OpenApiLogger.logInfo("requst params:"+resquest_);
|
||||
|
||||
}
|
||||
String authoriztion=generateSignature(context,resquest_,"POST");
|
||||
request = new Request.Builder().url(url).
|
||||
addHeader("Authorization",authoriztion)
|
||||
.post(requestBody).build();
|
||||
OpenApiLogger.logInfo("requst header:"+authoriztion);
|
||||
try {
|
||||
response = okHttpClient.newCall(request).execute();
|
||||
OpenApiLogger.logInfo("服务端返回code:"+response.code()+" message:"+response.message());
|
||||
responseInfo = response.body().source().readUtf8();
|
||||
context.setResponse(responseInfo);
|
||||
OpenApiLogger.logInfo("response :"+responseInfo);
|
||||
return responseInfo;
|
||||
} catch (Exception e) {
|
||||
OpenApiLogger.logError("通讯网络异常: "+e.getStackTrace());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public String doGet(OpenApiContext context, String request) {
|
||||
String url = context.getApiServiceUrl();
|
||||
String authoriztion=generateSignature(context,request,"GET");
|
||||
OpenApiLogger.logInfo("拼接的url :"+url+"?"+authoriztion);
|
||||
return url+"?"+authoriztion;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.chinaums.open.api.internal.util.http;
|
||||
|
||||
import com.chinaums.open.api.OpenApiContext;
|
||||
|
||||
/**
|
||||
* Created by ZHANGWEI on 2016/12/4.
|
||||
*/
|
||||
public interface IHttpTransport {
|
||||
public abstract String doPost(boolean isDebug,String url, String token, String request) throws Throwable;
|
||||
public abstract String doPost(OpenApiContext context, String request) throws Throwable;
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.chinaums.open.api.parser.json;
|
||||
|
||||
import com.chinaums.open.api.OpenApiException;
|
||||
import com.chinaums.open.api.OpenApiParser;
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
import com.chinaums.open.api.internal.util.OpenApiLogger;
|
||||
import com.chinaums.open.api.internal.util.converter.Converter;
|
||||
import com.chinaums.open.api.internal.util.converter.JsonConverter;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.ParseException;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/2
|
||||
* Time: 14:37
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public class ObjectJsonParser<T extends OpenApiResponse> implements OpenApiParser<T> {
|
||||
|
||||
private Class<T> class_;
|
||||
|
||||
public ObjectJsonParser(Class<T> tClass) {
|
||||
this.class_ = tClass;
|
||||
}
|
||||
|
||||
public T parse(String paramString) throws OpenApiException {
|
||||
Converter converter = new JsonConverter();
|
||||
try {
|
||||
return converter.toResponse(paramString,this.class_);
|
||||
} catch (IllegalAccessException e) {
|
||||
OpenApiLogger.logError(e.getCause());
|
||||
} catch (InstantiationException e) {
|
||||
OpenApiLogger.logError(e.getCause());
|
||||
} catch (ParseException e) {
|
||||
OpenApiLogger.logError(e.getCause());
|
||||
} catch (ClassNotFoundException e) {
|
||||
OpenApiLogger.logError(e.getCause());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String validRequest(OpenApiRequest<T> openApiRequest) throws OpenApiException {
|
||||
JSONObject jsonObj = JSONObject.fromObject(openApiRequest);
|
||||
for (Class clazz = openApiRequest.getClass(); !clazz.getName().equals(
|
||||
Object.class.getName()); clazz = clazz.getSuperclass()) {
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
String fieldName = field.getName();
|
||||
String name = fieldName;
|
||||
String key = fieldName;
|
||||
boolean required = false;
|
||||
int length = -1;
|
||||
int minLength = -1;
|
||||
int maxLength = -1;
|
||||
if (field.isAnnotationPresent(ApiField.class)) {
|
||||
ApiField requestMark = field
|
||||
.getAnnotation(ApiField.class);
|
||||
String markKey = requestMark.key();
|
||||
if (markKey != null && !markKey.equals("")) {
|
||||
key = markKey;
|
||||
}
|
||||
name = requestMark.name();
|
||||
required = requestMark.required();
|
||||
length = requestMark.length();
|
||||
minLength = requestMark.minLength();
|
||||
maxLength = requestMark.maxLength();
|
||||
String value = jsonObj.get(key) == null ? null : jsonObj
|
||||
.get(key).toString().trim();
|
||||
if (StringUtils.isBlank(value) && required)
|
||||
throw new OpenApiException(name + "[" + key + "]不能为空");
|
||||
if (StringUtils.isNotBlank(value)) {
|
||||
if (length != -1) {
|
||||
if (value.length() != length)
|
||||
throw new OpenApiException(name + "[" + key
|
||||
+ "]长度必须为:" + length);
|
||||
}
|
||||
if (minLength != -1) {
|
||||
if (value.length() < minLength)
|
||||
throw new OpenApiException(name + "[" + key
|
||||
+ "]长度必须大于等于:" + minLength);
|
||||
}
|
||||
if (maxLength != -1) {
|
||||
if (value.length() > maxLength)
|
||||
throw new OpenApiException(name + "[" + key
|
||||
+ "]长度必须小于等于:" + maxLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return jsonObj.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.chinaums.open.api.request;
|
||||
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
import com.chinaums.open.api.response.AcpInstallmentResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/12/12
|
||||
* Time: 14:51
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class AcpInstallmentRequest implements OpenApiRequest<AcpInstallmentResponse> {
|
||||
@ApiField(key = "merchantCode",required = true,desc = "商户号")
|
||||
private String merchantCode;
|
||||
@ApiField(key = "terminalCode",required = true,desc = "终端号")
|
||||
private String terminalCode;
|
||||
@ApiField(key = "systemTraceNum",required = true,desc = "系统跟踪号")
|
||||
private String systemTraceNum;
|
||||
@ApiField(key = "transactionAmount",required = true,desc = "交易金额")
|
||||
private String transactionAmount;
|
||||
@ApiField(key = "transactionCurrencyCode",required = true,desc = "交易币种")
|
||||
private String transactionCurrencyCode;
|
||||
@ApiField(key = "encryptedData",required = true,desc = "加密数据")
|
||||
private String encryptedData;
|
||||
|
||||
public Class<AcpInstallmentResponse> responseClass() {
|
||||
return AcpInstallmentResponse.class;
|
||||
}
|
||||
|
||||
public String apiVersion() {
|
||||
return "v1";
|
||||
}
|
||||
|
||||
public String apiMethodName() {
|
||||
return "一次性分期";
|
||||
}
|
||||
|
||||
public String serviceCode() {
|
||||
return "/unionpay/acp/installment/request";
|
||||
}
|
||||
|
||||
public boolean needToken() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getMerchantCode() {
|
||||
return merchantCode;
|
||||
}
|
||||
|
||||
public void setMerchantCode(String merchantCode) {
|
||||
this.merchantCode = merchantCode;
|
||||
}
|
||||
|
||||
public String getTerminalCode() {
|
||||
return terminalCode;
|
||||
}
|
||||
|
||||
public void setTerminalCode(String terminalCode) {
|
||||
this.terminalCode = terminalCode;
|
||||
}
|
||||
|
||||
public String getSystemTraceNum() {
|
||||
return systemTraceNum;
|
||||
}
|
||||
|
||||
public void setSystemTraceNum(String systemTraceNum) {
|
||||
this.systemTraceNum = systemTraceNum;
|
||||
}
|
||||
|
||||
public String getTransactionAmount() {
|
||||
return transactionAmount;
|
||||
}
|
||||
|
||||
public void setTransactionAmount(String transactionAmount) {
|
||||
this.transactionAmount = transactionAmount;
|
||||
}
|
||||
|
||||
public String getTransactionCurrencyCode() {
|
||||
return transactionCurrencyCode;
|
||||
}
|
||||
|
||||
public void setTransactionCurrencyCode(String transactionCurrencyCode) {
|
||||
this.transactionCurrencyCode = transactionCurrencyCode;
|
||||
}
|
||||
|
||||
public String getEncryptedData() {
|
||||
return encryptedData;
|
||||
}
|
||||
|
||||
public void setEncryptedData(String encryptedData) {
|
||||
this.encryptedData = encryptedData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.chinaums.open.api.request;
|
||||
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.response.BankVerifyResponse;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/2
|
||||
* Time: 14:17
|
||||
* 所属模块:
|
||||
* 功能说明:银行卡验证
|
||||
*/
|
||||
public class BankVerifyRequest implements OpenApiRequest<BankVerifyResponse> {
|
||||
|
||||
@ApiField(key = "data",required = true,desc = "json格式字符")
|
||||
private Object data;
|
||||
|
||||
public Class<BankVerifyResponse> responseClass() {
|
||||
return BankVerifyResponse.class;
|
||||
}
|
||||
|
||||
public String apiVersion() {
|
||||
return "v1";
|
||||
}
|
||||
|
||||
public String apiMethodName() {
|
||||
return "银行卡实名认证";
|
||||
}
|
||||
|
||||
public String serviceCode() {
|
||||
return "/datacenter/smartverification/bankcard/verify";
|
||||
}
|
||||
|
||||
public boolean needToken() {
|
||||
return true;
|
||||
}
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.chinaums.open.api.request;
|
||||
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
import com.chinaums.open.api.response.CourtQueryResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/6/6
|
||||
* Time: 15:21
|
||||
* 所属模块:
|
||||
* 功能说明:法院信息查询
|
||||
*/
|
||||
public class CourtQueryRequest implements OpenApiRequest<CourtQueryResponse> {
|
||||
@ApiField(key = "data",required = true,desc = "json格式字符")
|
||||
private Object data;
|
||||
public Class<CourtQueryResponse> responseClass() {
|
||||
return CourtQueryResponse.class;
|
||||
}
|
||||
|
||||
public String apiVersion() {
|
||||
return "v1";
|
||||
}
|
||||
|
||||
public String apiMethodName() {
|
||||
return "法院信息查询";
|
||||
}
|
||||
|
||||
public String serviceCode() {
|
||||
return "/datacenter/smartverification/court/query";
|
||||
}
|
||||
|
||||
public boolean needToken() {
|
||||
return true;
|
||||
}
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.chinaums.open.api.request;
|
||||
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
import com.chinaums.open.api.response.EducationInfoVerifyResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/5/8
|
||||
* Time: 17:02
|
||||
* 所属模块:
|
||||
* 功能说明:学历信息验证
|
||||
*/
|
||||
public class EducationInfoVerifyRequest implements OpenApiRequest<EducationInfoVerifyResponse> {
|
||||
@ApiField(key = "data",required = true,desc = "json格式字符")
|
||||
private Object data;
|
||||
public Class<EducationInfoVerifyResponse> responseClass() {
|
||||
return EducationInfoVerifyResponse.class;
|
||||
}
|
||||
|
||||
public String apiVersion() {
|
||||
return "v1";
|
||||
}
|
||||
|
||||
public String apiMethodName() {
|
||||
return "学历信息验证查询";
|
||||
}
|
||||
|
||||
public String serviceCode() {
|
||||
return "/datacenter/smartverification/education/query";
|
||||
}
|
||||
|
||||
public boolean needToken() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.chinaums.open.api.request;
|
||||
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
import com.chinaums.open.api.response.FacerecognitionParamComposeResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/6/5
|
||||
* Time: 14:33
|
||||
* 所属模块:
|
||||
* 功能说明:人脸识别参数拼装
|
||||
*/
|
||||
public class FacerecognitionParamComposeRequest implements OpenApiRequest<FacerecognitionParamComposeResponse> {
|
||||
@ApiField(key = "data",required = true,desc = "json格式字符")
|
||||
private Object data;
|
||||
public Class<FacerecognitionParamComposeResponse> responseClass() {
|
||||
return FacerecognitionParamComposeResponse.class;
|
||||
}
|
||||
|
||||
public String apiVersion() {
|
||||
return "v1";
|
||||
}
|
||||
|
||||
public String apiMethodName() {
|
||||
return "人脸识别参数拼装";
|
||||
}
|
||||
|
||||
public String serviceCode() {
|
||||
return "/datacenter/smartverification/facerecognition/param/compose";
|
||||
}
|
||||
|
||||
public boolean needToken() {
|
||||
return true;
|
||||
}
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.chinaums.open.api.request;
|
||||
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
import com.chinaums.open.api.response.FacerecognitionParamResultQueryResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/6/5
|
||||
* Time: 14:34
|
||||
* 所属模块:
|
||||
* 功能说明:人脸识别结果查询
|
||||
*/
|
||||
public class FacerecognitionParamResultQueryRequest implements OpenApiRequest<FacerecognitionParamResultQueryResponse> {
|
||||
@ApiField(key = "data",required = true,desc = "json格式字符")
|
||||
private Object data;
|
||||
public Class<FacerecognitionParamResultQueryResponse> responseClass() {
|
||||
return FacerecognitionParamResultQueryResponse.class;
|
||||
}
|
||||
|
||||
public String apiVersion() {
|
||||
return "v1";
|
||||
}
|
||||
|
||||
public String apiMethodName() {
|
||||
return "人脸识别结果查询";
|
||||
}
|
||||
|
||||
public String serviceCode() {
|
||||
return "/datacenter/smartverification/facerecognition/result/query";
|
||||
}
|
||||
|
||||
public boolean needToken() {
|
||||
return true;
|
||||
}
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.chinaums.open.api.request;
|
||||
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
import com.chinaums.open.api.response.FacerecognitionParamResultSetResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/6/5
|
||||
* Time: 14:35
|
||||
* 所属模块:
|
||||
* 功能说明:人脸识别结果获取
|
||||
*/
|
||||
public class FacerecognitionParamResultSetRequest implements OpenApiRequest<FacerecognitionParamResultSetResponse> {
|
||||
@ApiField(key = "data",required = true,desc = "json格式字符")
|
||||
private Object data;
|
||||
public Class<FacerecognitionParamResultSetResponse> responseClass() {
|
||||
return FacerecognitionParamResultSetResponse.class;
|
||||
}
|
||||
|
||||
public String apiVersion() {
|
||||
return "v1";
|
||||
}
|
||||
|
||||
public String apiMethodName() {
|
||||
return "人脸识别结果获取";
|
||||
}
|
||||
|
||||
public String serviceCode() {
|
||||
return "/datacenter/smartverification/facerecognition/result/set";
|
||||
}
|
||||
|
||||
public boolean needToken() {
|
||||
return true;
|
||||
}
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.chinaums.open.api.request;
|
||||
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
import com.chinaums.open.api.response.GenericTagQueryResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/6/6
|
||||
* Time: 15:18
|
||||
* 所属模块:
|
||||
* 功能说明:实时标签查询
|
||||
*/
|
||||
public class GenericTagQueryRequest implements OpenApiRequest<GenericTagQueryResponse>{
|
||||
@ApiField(key = "data",required = true,desc = "json格式字符")
|
||||
private Object data;
|
||||
public Class<GenericTagQueryResponse> responseClass() {
|
||||
return GenericTagQueryResponse.class;
|
||||
}
|
||||
|
||||
public String apiVersion() {
|
||||
return "v1";
|
||||
}
|
||||
|
||||
public String apiMethodName() {
|
||||
return "实时标签查询";
|
||||
}
|
||||
|
||||
public String serviceCode() {
|
||||
return "/datacenter/smartverification/tag/generic/query";
|
||||
}
|
||||
|
||||
public boolean needToken() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.chinaums.open.api.request;
|
||||
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
import com.chinaums.open.api.response.IdCardVerifyResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/13
|
||||
* Time: 14:07
|
||||
* 所属模块:
|
||||
* 功能说明:身份证核查
|
||||
*/
|
||||
public class IdCardVerifyRequest implements OpenApiRequest<IdCardVerifyResponse>{
|
||||
|
||||
@ApiField(key = "data",required = true,desc = "json格式字符")
|
||||
private Object data;
|
||||
public Class<IdCardVerifyResponse> responseClass() {
|
||||
return IdCardVerifyResponse.class;
|
||||
}
|
||||
|
||||
public String apiVersion() {
|
||||
return "v1";
|
||||
}
|
||||
|
||||
public String apiMethodName() {
|
||||
return "身份证核查(政通实名认证)";
|
||||
}
|
||||
|
||||
public String serviceCode() {
|
||||
return "/datacenter/smartverification/idcard/verify";
|
||||
}
|
||||
|
||||
public boolean needToken() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.chinaums.open.api.request;
|
||||
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
import com.chinaums.open.api.response.IdCheckSimpleInfoResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/2/21
|
||||
* Time: 14:49
|
||||
* 所属模块:
|
||||
* 功能说明:简项公民身份证信息核查请求报文
|
||||
*/
|
||||
public class IdCheckSimpleInfoRequest implements OpenApiRequest<IdCheckSimpleInfoResponse> {
|
||||
|
||||
@ApiField(name = "certifId",required = true ,desc = "公民身份号码")
|
||||
private String certifId;
|
||||
@ApiField(name = "name",required = true ,desc = "姓名")
|
||||
private String name;
|
||||
public Class<IdCheckSimpleInfoResponse> responseClass() {
|
||||
return IdCheckSimpleInfoResponse.class;
|
||||
}
|
||||
|
||||
public String apiVersion() {
|
||||
return "v1";
|
||||
}
|
||||
|
||||
public String apiMethodName() {
|
||||
return "身份证验证";
|
||||
}
|
||||
|
||||
public String serviceCode() {
|
||||
return "/creditcheck/idcheck/simpleinfo";
|
||||
}
|
||||
|
||||
public boolean needToken() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getCertifId() {
|
||||
return certifId;
|
||||
}
|
||||
|
||||
public void setCertifId(String certifId) {
|
||||
this.certifId = certifId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.chinaums.open.api.request;
|
||||
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
import com.chinaums.open.api.response.Mobile3factorVerifyResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/13
|
||||
* Time: 14:11
|
||||
* 所属模块:
|
||||
* 功能说明:运营商三要素验证
|
||||
*/
|
||||
public class Mobile3factorVerifyRequest implements OpenApiRequest<Mobile3factorVerifyResponse>{
|
||||
|
||||
@ApiField(key = "data",required = true,desc = "json格式字符")
|
||||
private Object data;
|
||||
|
||||
public Class<Mobile3factorVerifyResponse> responseClass() {
|
||||
return Mobile3factorVerifyResponse.class;
|
||||
}
|
||||
|
||||
public String apiVersion() {
|
||||
return "v1";
|
||||
}
|
||||
|
||||
public String apiMethodName() {
|
||||
return "运营商三要素验证";
|
||||
}
|
||||
|
||||
public String serviceCode() {
|
||||
return "/datacenter/smartverification/mobile/3factor/verify";
|
||||
}
|
||||
|
||||
public boolean needToken() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.chinaums.open.api.request;
|
||||
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
import com.chinaums.open.api.response.NyBankCardTagResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/3/21
|
||||
* Time: 18:07
|
||||
* 所属模块:
|
||||
* 功能说明:楠云银行卡标签提取
|
||||
*/
|
||||
public class NyBankCardTagRequest implements OpenApiRequest<NyBankCardTagResponse> {
|
||||
@ApiField(key = "data",required = true,desc = "json格式字符")
|
||||
private Object data;
|
||||
|
||||
public Class<NyBankCardTagResponse> responseClass() {
|
||||
return NyBankCardTagResponse.class;
|
||||
}
|
||||
|
||||
public String apiVersion() {
|
||||
return "v1";
|
||||
}
|
||||
|
||||
public String apiMethodName() {
|
||||
return "楠云银行卡标签提取查询";
|
||||
}
|
||||
|
||||
public String serviceCode() {
|
||||
return "/datacenter/smartverification/bankcardtag/query";
|
||||
}
|
||||
|
||||
public boolean needToken() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.chinaums.open.api.request;
|
||||
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.response.RealNameVerifyResponse;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/6
|
||||
* Time: 15:23
|
||||
* 所属模块:
|
||||
* 功能说明:实名认证
|
||||
*/
|
||||
public class RealNameVerifyRequest implements OpenApiRequest<RealNameVerifyResponse> {
|
||||
@ApiField(key = "data",required = true,desc = "json格式字符")
|
||||
private Object data;
|
||||
|
||||
public Class<RealNameVerifyResponse> responseClass() {
|
||||
return RealNameVerifyResponse.class;
|
||||
}
|
||||
|
||||
public String apiVersion() {
|
||||
return "v1";
|
||||
}
|
||||
|
||||
public String apiMethodName() {
|
||||
return "实名认证";
|
||||
}
|
||||
|
||||
public String serviceCode() {
|
||||
return "/datacenter/smartverification/realname/verify";
|
||||
}
|
||||
|
||||
public boolean needToken() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.chinaums.open.api.request;
|
||||
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
import com.chinaums.open.api.internal.util.OpenTokenUtil;
|
||||
import com.chinaums.open.api.response.TokenResponse;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/5
|
||||
* Time: 15:42
|
||||
* 所属模块:
|
||||
* 功能说明:token
|
||||
*/
|
||||
public class TokenRequest implements OpenApiRequest<TokenResponse> {
|
||||
@ApiField(name = "appId",required = true ,desc = "开放平台开发者id")
|
||||
private String appId;
|
||||
@ApiField(name = "appKey",required = true,desc = "开放平台开发者key")
|
||||
private String appKey;
|
||||
@ApiField(name = "时间戳",required = true)
|
||||
private String timestamp;
|
||||
@ApiField(name = "随机数",required = true)
|
||||
private String nonce;
|
||||
@ApiField(name = "加密方法",required = true)
|
||||
private String signMethod;
|
||||
@ApiField(name = "SHA256签名字符",required = true)
|
||||
private String signature;
|
||||
|
||||
public Class<TokenResponse> responseClass() {
|
||||
return TokenResponse.class;
|
||||
}
|
||||
|
||||
public String apiVersion() {
|
||||
return "v2";
|
||||
} //新入驻商户需要使用v2方式
|
||||
|
||||
public String apiMethodName() {
|
||||
return "获取开放平台token";
|
||||
}
|
||||
|
||||
public String serviceCode() {
|
||||
return "/token/access";
|
||||
}
|
||||
|
||||
public boolean needToken() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public TokenRequest(String appId, String appKey) {
|
||||
this.appId = appId;
|
||||
this.appKey = appKey;
|
||||
this.timestamp = new SimpleDateFormat("yyyyMMddHHmmss")
|
||||
.format(new Date());
|
||||
this.nonce = UUID.randomUUID().toString();
|
||||
this.signMethod = "SHA256";
|
||||
this.signature = OpenTokenUtil.generateSignature(getAppId(),getTimestamp(),getNonce(),getAppKey());
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getAppKey() {
|
||||
return appKey;
|
||||
}
|
||||
|
||||
public void setAppKey(String appKey) {
|
||||
this.appKey = appKey;
|
||||
}
|
||||
|
||||
public String getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(String timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public String getNonce() {
|
||||
return nonce;
|
||||
}
|
||||
|
||||
public void setNonce(String nonce) {
|
||||
this.nonce = nonce;
|
||||
}
|
||||
|
||||
public String getSignMethod() {
|
||||
return signMethod;
|
||||
}
|
||||
|
||||
public void setSignMethod(String signMethod) {
|
||||
this.signMethod = signMethod;
|
||||
}
|
||||
|
||||
public String getSignature() {
|
||||
return signature;
|
||||
}
|
||||
|
||||
public void setSignature(String signature) {
|
||||
this.signature = signature;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.chinaums.open.api.request;
|
||||
|
||||
import com.chinaums.open.api.OpenApiRequest;
|
||||
import com.chinaums.open.api.annotation.ApiField;
|
||||
import com.chinaums.open.api.response.YsBankCardTagResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/5/3
|
||||
* Time: 18:21
|
||||
* 所属模块:
|
||||
* 功能说明:盐商科技用户标签查询
|
||||
*/
|
||||
public class YsBankCardTagRequest implements OpenApiRequest<YsBankCardTagResponse> {
|
||||
|
||||
@ApiField(key = "data",required = true,desc = "json格式字符")
|
||||
private Object data;
|
||||
|
||||
public Class<YsBankCardTagResponse> responseClass() {
|
||||
return YsBankCardTagResponse.class;
|
||||
}
|
||||
|
||||
public String apiVersion() {
|
||||
return "v1";
|
||||
}
|
||||
|
||||
public String apiMethodName() {
|
||||
return "盐商科技用户标签查询";
|
||||
}
|
||||
|
||||
public String serviceCode() {
|
||||
return "/datacenter/smartverification/ysbankcardtag/query";
|
||||
}
|
||||
|
||||
public boolean needToken() {
|
||||
return true;
|
||||
}
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.chinaums.open.api.response;
|
||||
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/12/12
|
||||
* Time: 14:51
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class AcpInstallmentResponse extends OpenApiResponse {
|
||||
/**
|
||||
* 错误代码
|
||||
*/
|
||||
private String errCode;
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
private String errInfo;
|
||||
/**
|
||||
* 交易时间 HHmmss
|
||||
*/
|
||||
private String transactionTime;
|
||||
/**
|
||||
* 交易日期 MMdd
|
||||
*/
|
||||
private String transactionDate;
|
||||
/**
|
||||
* 结算日期 MMdd
|
||||
*/
|
||||
private String settlementDate;
|
||||
/**
|
||||
* 检索参考号
|
||||
*/
|
||||
private String retrievalRefNum;
|
||||
|
||||
@Override
|
||||
public String getErrCode() {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrCode(String errCode) {
|
||||
this.errCode = errCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrInfo() {
|
||||
return errInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrInfo(String errInfo) {
|
||||
this.errInfo = errInfo;
|
||||
}
|
||||
|
||||
public String getTransactionTime() {
|
||||
return transactionTime;
|
||||
}
|
||||
|
||||
public void setTransactionTime(String transactionTime) {
|
||||
this.transactionTime = transactionTime;
|
||||
}
|
||||
|
||||
public String getTransactionDate() {
|
||||
return transactionDate;
|
||||
}
|
||||
|
||||
public void setTransactionDate(String transactionDate) {
|
||||
this.transactionDate = transactionDate;
|
||||
}
|
||||
|
||||
public String getSettlementDate() {
|
||||
return settlementDate;
|
||||
}
|
||||
|
||||
public void setSettlementDate(String settlementDate) {
|
||||
this.settlementDate = settlementDate;
|
||||
}
|
||||
|
||||
public String getRetrievalRefNum() {
|
||||
return retrievalRefNum;
|
||||
}
|
||||
|
||||
public void setRetrievalRefNum(String retrievalRefNum) {
|
||||
this.retrievalRefNum = retrievalRefNum;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.chinaums.open.api.response;
|
||||
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/2
|
||||
* Time: 14:14
|
||||
* 所属模块:
|
||||
* 功能说明:银行卡验证
|
||||
*/
|
||||
public class BankVerifyResponse extends OpenApiResponse {
|
||||
private String resultCode;
|
||||
private String resultInfo;
|
||||
private Object data;
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getResultCode() {
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
public void setResultCode(String resultCode) {
|
||||
this.resultCode = resultCode;
|
||||
}
|
||||
|
||||
public String getResultInfo() {
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
public void setResultInfo(String resultInfo) {
|
||||
this.resultInfo = resultInfo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.chinaums.open.api.response;
|
||||
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/6/6
|
||||
* Time: 15:21
|
||||
* 所属模块:
|
||||
* 功能说明:法院信息查询
|
||||
*/
|
||||
public class CourtQueryResponse extends OpenApiResponse {
|
||||
private String resultCode;
|
||||
private String resultInfo;
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
private Object data;
|
||||
|
||||
public String getResultCode() {
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
public void setResultCode(String resultCode) {
|
||||
this.resultCode = resultCode;
|
||||
}
|
||||
|
||||
public String getResultInfo() {
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
public void setResultInfo(String resultInfo) {
|
||||
this.resultInfo = resultInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.chinaums.open.api.response;
|
||||
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/5/8
|
||||
* Time: 17:03
|
||||
* 所属模块:
|
||||
* 功能说明:学历信息验证
|
||||
*/
|
||||
public class EducationInfoVerifyResponse extends OpenApiResponse {
|
||||
private String resultCode;
|
||||
private String resultInfo;
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
private Object data;
|
||||
|
||||
public String getResultCode() {
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
public void setResultCode(String resultCode) {
|
||||
this.resultCode = resultCode;
|
||||
}
|
||||
|
||||
public String getResultInfo() {
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
public void setResultInfo(String resultInfo) {
|
||||
this.resultInfo = resultInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.chinaums.open.api.response;
|
||||
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/6/5
|
||||
* Time: 14:34
|
||||
* 所属模块:
|
||||
* 功能说明:人脸识别参数拼装
|
||||
*/
|
||||
public class FacerecognitionParamComposeResponse extends OpenApiResponse {
|
||||
private String resultCode;
|
||||
private String resultInfo;
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
private Object data;
|
||||
|
||||
public String getResultCode() {
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
public void setResultCode(String resultCode) {
|
||||
this.resultCode = resultCode;
|
||||
}
|
||||
|
||||
public String getResultInfo() {
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
public void setResultInfo(String resultInfo) {
|
||||
this.resultInfo = resultInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.chinaums.open.api.response;
|
||||
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/6/5
|
||||
* Time: 14:34
|
||||
* 所属模块:
|
||||
* 功能说明:人脸识别结果查询
|
||||
*/
|
||||
public class FacerecognitionParamResultQueryResponse extends OpenApiResponse {
|
||||
private String resultCode;
|
||||
private String resultInfo;
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
private Object data;
|
||||
|
||||
public String getResultCode() {
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
public void setResultCode(String resultCode) {
|
||||
this.resultCode = resultCode;
|
||||
}
|
||||
|
||||
public String getResultInfo() {
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
public void setResultInfo(String resultInfo) {
|
||||
this.resultInfo = resultInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.chinaums.open.api.response;
|
||||
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/6/5
|
||||
* Time: 14:35
|
||||
* 所属模块:
|
||||
* 功能说明:人脸识别结果获取
|
||||
*/
|
||||
public class FacerecognitionParamResultSetResponse extends OpenApiResponse {
|
||||
private String resultCode;
|
||||
private String resultInfo;
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
private Object data;
|
||||
|
||||
public String getResultCode() {
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
public void setResultCode(String resultCode) {
|
||||
this.resultCode = resultCode;
|
||||
}
|
||||
|
||||
public String getResultInfo() {
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
public void setResultInfo(String resultInfo) {
|
||||
this.resultInfo = resultInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.chinaums.open.api.response;
|
||||
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/6/6
|
||||
* Time: 15:18
|
||||
* 所属模块:
|
||||
* 功能说明:实时标签查询
|
||||
*/
|
||||
public class GenericTagQueryResponse extends OpenApiResponse {
|
||||
private String resultCode;
|
||||
private String resultInfo;
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
private Object data;
|
||||
|
||||
public String getResultCode() {
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
public void setResultCode(String resultCode) {
|
||||
this.resultCode = resultCode;
|
||||
}
|
||||
|
||||
public String getResultInfo() {
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
public void setResultInfo(String resultInfo) {
|
||||
this.resultInfo = resultInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.chinaums.open.api.response;
|
||||
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/13
|
||||
* Time: 14:06
|
||||
* 所属模块:
|
||||
* 功能说明:身份证核查
|
||||
*/
|
||||
public class IdCardVerifyResponse extends OpenApiResponse {
|
||||
private String resultCode;
|
||||
private String resultInfo;
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
private Object data;
|
||||
|
||||
public String getResultCode() {
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
public void setResultCode(String resultCode) {
|
||||
this.resultCode = resultCode;
|
||||
}
|
||||
|
||||
public String getResultInfo() {
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
public void setResultInfo(String resultInfo) {
|
||||
this.resultInfo = resultInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.chinaums.open.api.response;
|
||||
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/2/21
|
||||
* Time: 14:49
|
||||
* 所属模块:
|
||||
* 功能说明:核查平台-身份证验证
|
||||
*/
|
||||
public class IdCheckSimpleInfoResponse extends OpenApiResponse {
|
||||
/**
|
||||
* 公民身份号码核查结果
|
||||
*/
|
||||
private String resultCertifId;
|
||||
|
||||
/**
|
||||
* 姓名核查结果
|
||||
*/
|
||||
private String resultName;
|
||||
|
||||
/**
|
||||
* base64编码的照片
|
||||
*/
|
||||
private String photo;
|
||||
|
||||
public String getResultCertifId() {
|
||||
return resultCertifId;
|
||||
}
|
||||
|
||||
public void setResultCertifId(String resultCertifId) {
|
||||
this.resultCertifId = resultCertifId;
|
||||
}
|
||||
|
||||
public String getResultName() {
|
||||
return resultName;
|
||||
}
|
||||
|
||||
public void setResultName(String resultName) {
|
||||
this.resultName = resultName;
|
||||
}
|
||||
|
||||
public String getPhoto() {
|
||||
return photo;
|
||||
}
|
||||
|
||||
public void setPhoto(String photo) {
|
||||
this.photo = photo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.chinaums.open.api.response;
|
||||
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/13
|
||||
* Time: 16:58
|
||||
* 所属模块:
|
||||
* 功能说明:运营商三要素验证
|
||||
*/
|
||||
public class Mobile3factorVerifyResponse extends OpenApiResponse {
|
||||
private String resultCode;
|
||||
private String resultInfo;
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
private Object data;
|
||||
|
||||
public String getResultCode() {
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
public void setResultCode(String resultCode) {
|
||||
this.resultCode = resultCode;
|
||||
}
|
||||
|
||||
public String getResultInfo() {
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
public void setResultInfo(String resultInfo) {
|
||||
this.resultInfo = resultInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.chinaums.open.api.response;
|
||||
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/3/21
|
||||
* Time: 18:07
|
||||
* 所属模块:
|
||||
* 功能说明:楠云银行卡标签提取
|
||||
*/
|
||||
public class NyBankCardTagResponse extends OpenApiResponse {
|
||||
private String resultCode;
|
||||
private String resultInfo;
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
private Object data;
|
||||
|
||||
public String getResultCode() {
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
public void setResultCode(String resultCode) {
|
||||
this.resultCode = resultCode;
|
||||
}
|
||||
|
||||
public String getResultInfo() {
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
public void setResultInfo(String resultInfo) {
|
||||
this.resultInfo = resultInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.chinaums.open.api.response;
|
||||
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/6
|
||||
* Time: 15:23
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public class RealNameVerifyResponse extends OpenApiResponse{
|
||||
private String resultCode;
|
||||
private String resultInfo;
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
private Object data;
|
||||
|
||||
public String getResultCode() {
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
public void setResultCode(String resultCode) {
|
||||
this.resultCode = resultCode;
|
||||
}
|
||||
|
||||
public String getResultInfo() {
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
public void setResultInfo(String resultInfo) {
|
||||
this.resultInfo = resultInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.chinaums.open.api.response;
|
||||
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/5
|
||||
* Time: 15:42
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public class TokenResponse extends OpenApiResponse{
|
||||
/**
|
||||
* 服务授权令牌
|
||||
*/
|
||||
private String accessToken;
|
||||
/**
|
||||
* 有效期
|
||||
*/
|
||||
private int expiresIn;
|
||||
/**
|
||||
* 令牌开始生效的时间,以收到时间为准
|
||||
*/
|
||||
private Date effectTime;
|
||||
|
||||
/**
|
||||
* 令牌的过期时间,单位为秒,由数据中心返回
|
||||
*/
|
||||
private int timeout;
|
||||
|
||||
/**
|
||||
* 在令牌过期前,要提前重新申请
|
||||
*/
|
||||
private int aheadInterval;
|
||||
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public int getExpiresIn() {
|
||||
return expiresIn;
|
||||
}
|
||||
|
||||
public void setExpiresIn(int expiresIn) {
|
||||
this.expiresIn = expiresIn;
|
||||
}
|
||||
|
||||
public Date getEffectTime() {
|
||||
return effectTime;
|
||||
}
|
||||
|
||||
public void setEffectTime(Date effectTime) {
|
||||
this.effectTime = effectTime;
|
||||
}
|
||||
|
||||
public int getTimeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
public void setTimeout(int timeout) {
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
||||
public int getAheadInterval() {
|
||||
return aheadInterval;
|
||||
}
|
||||
|
||||
public void setAheadInterval(int aheadInterval) {
|
||||
this.aheadInterval = aheadInterval;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.chinaums.open.api.response;
|
||||
|
||||
import com.chinaums.open.api.OpenApiResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/5/3
|
||||
* Time: 18:21
|
||||
* 所属模块:
|
||||
* 功能说明:盐商科技用户标签查询
|
||||
*/
|
||||
public class YsBankCardTagResponse extends OpenApiResponse {
|
||||
private String resultCode;
|
||||
private String resultInfo;
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
private Object data;
|
||||
|
||||
public String getResultCode() {
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
public void setResultCode(String resultCode) {
|
||||
this.resultCode = resultCode;
|
||||
}
|
||||
|
||||
public String getResultInfo() {
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
public void setResultInfo(String resultInfo) {
|
||||
this.resultInfo = resultInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.chinaums.open.api.internal.util.http;
|
||||
|
||||
import com.chinaums.open.api.OpenApiCache;
|
||||
import com.chinaums.open.api.OpenApiContext;
|
||||
import com.chinaums.open.api.constants.ConfigBean;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Project:TODO ADD PROJECT NAME
|
||||
* Modify Information:
|
||||
* ================================================================
|
||||
* Author Date Description
|
||||
* ------------ ---------- --------------------------------
|
||||
* wmshen 2022/10/20 TODO:
|
||||
* ================================================================
|
||||
* Copyright (c) 银联商务股份有限公司 www.chinaums.com
|
||||
*/
|
||||
public class HttpTransportTest {
|
||||
|
||||
@Test
|
||||
public void doGet() throws Exception {
|
||||
|
||||
String url = "https://test-api-open.chinaums.com/v1/netpay/trade/h5-pay";
|
||||
//开发者ID
|
||||
String appId = "10037e6f6a4e6da4016a670fd4530012";
|
||||
//开发者秘钥
|
||||
String appKey = "f7a74b6c02ae4e1e94aaba311c04acf2";
|
||||
//实例化客户端
|
||||
ConfigBean configBean = new ConfigBean();
|
||||
OpenApiContext context = new OpenApiContext();
|
||||
String request = "{\"tid\":\"88880001\",\"totalAmount\":\"1\",\"mid\":\"898310148160568\",\"merOrderId\":\"wf12421741298471284\"}";
|
||||
context.setStartTime(System.currentTimeMillis());
|
||||
context.setRequestId(UUID.randomUUID().toString().replace("-", ""));
|
||||
context.setOpenServUrl(url.split("/v")[0].concat("/"));
|
||||
context.setApiServiceUrl(url);
|
||||
context.setVersion(url.split("/")[3]);
|
||||
context.setAppId(appId);
|
||||
context.setAppKey(appKey);
|
||||
context.setConfigBean(configBean);
|
||||
context.setServiceCode(url.split("/v")[1].substring(1));
|
||||
OpenApiCache.getCurrentToken(context);
|
||||
System.out.println(HttpTransport.getInstance().doGet(context, request));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.chinaums.test;
|
||||
|
||||
import com.chinaums.open.api.DefaultOpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiException;
|
||||
import com.chinaums.open.api.request.NyBankCardTagRequest;
|
||||
import com.chinaums.open.api.request.YsBankCardTagRequest;
|
||||
import com.chinaums.open.api.response.NyBankCardTagResponse;
|
||||
import com.chinaums.open.api.response.YsBankCardTagResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/3/21
|
||||
* Time: 19:08
|
||||
* 所属模块:
|
||||
* 功能说明:标签查询相关testcase
|
||||
*/
|
||||
public class BankCardTagTestCase {
|
||||
@org.junit.Test
|
||||
public void testNyBankCardTag() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "";
|
||||
String appKey = "";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
NyBankCardTagRequest nyBankCardTagRequest = new NyBankCardTagRequest();
|
||||
nyBankCardTagRequest.setData("{\"userNo\":\"\",\"priAcctNo\":\"\",\"riskflag\":\"1\"}");
|
||||
NyBankCardTagResponse nyBankCardTagResponse;
|
||||
nyBankCardTagResponse = openApiClient.execute(nyBankCardTagRequest);
|
||||
System.out.println(nyBankCardTagResponse.getData());
|
||||
System.out.println(nyBankCardTagResponse.getResultCode());
|
||||
System.out.println(nyBankCardTagResponse.getResultInfo());
|
||||
}
|
||||
|
||||
@org.junit.Test
|
||||
public void testYsBankCardTag() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "";
|
||||
String appKey = "";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
YsBankCardTagRequest ysBankCardTagRequest = new YsBankCardTagRequest();
|
||||
ysBankCardTagRequest.setData("{\"phoneNo\":\"\",\"priAcctNo\":\"\"}");
|
||||
YsBankCardTagResponse ysBankCardTagResponse;
|
||||
ysBankCardTagResponse = openApiClient.execute(ysBankCardTagRequest);
|
||||
System.out.println(ysBankCardTagResponse.getData());
|
||||
System.out.println(ysBankCardTagResponse.getResultCode());
|
||||
System.out.println(ysBankCardTagResponse.getResultInfo());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.chinaums.test;
|
||||
|
||||
import com.chinaums.open.api.DefaultOpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiException;
|
||||
import com.chinaums.open.api.request.FacerecognitionParamComposeRequest;
|
||||
import com.chinaums.open.api.request.FacerecognitionParamResultQueryRequest;
|
||||
import com.chinaums.open.api.request.FacerecognitionParamResultSetRequest;
|
||||
import com.chinaums.open.api.response.FacerecognitionParamComposeResponse;
|
||||
import com.chinaums.open.api.response.FacerecognitionParamResultQueryResponse;
|
||||
import com.chinaums.open.api.response.FacerecognitionParamResultSetResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/6/5
|
||||
* Time: 14:41
|
||||
* 所属模块:
|
||||
* 功能说明:人脸识别相关测试案例
|
||||
*/
|
||||
public class FacerecognitionTest {
|
||||
@org.junit.Test
|
||||
public void testFacerecognitionParamCompose() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "";
|
||||
String appKey = "";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
FacerecognitionParamComposeRequest facerecognitionParamComposeRequest = new FacerecognitionParamComposeRequest();
|
||||
facerecognitionParamComposeRequest.setData("{\"certNo\" : \"\",\"idCardUserName\" : \"\",\"orderId\" : '',\"orderDate\" : '',\"deviceID\" : '',\"deviceOs\" : ''}");
|
||||
FacerecognitionParamComposeResponse response = openApiClient.execute(facerecognitionParamComposeRequest);
|
||||
System.out.println(response.getErrCode());
|
||||
}
|
||||
|
||||
@org.junit.Test
|
||||
public void testFacerecognitionParamResultQuery() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "";
|
||||
String appKey = "";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
FacerecognitionParamResultQueryRequest request = new FacerecognitionParamResultQueryRequest();
|
||||
request.setData("{\"orderId\":\"\",\"deviceID\":\"\",\"orderDate\":\"\"}");
|
||||
FacerecognitionParamResultQueryResponse response = openApiClient.execute(request);
|
||||
System.out.println(response.getErrCode());
|
||||
}
|
||||
|
||||
@org.junit.Test
|
||||
public void testFacerecognitionParamResultSet() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "";
|
||||
String appKey = "";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
FacerecognitionParamResultSetRequest request = new FacerecognitionParamResultSetRequest();
|
||||
request.setData("{\"signature\":\"\",\"merNo\":\"\",\"respData\":\"\"}");
|
||||
FacerecognitionParamResultSetResponse response = openApiClient.execute(request);
|
||||
System.out.println(response.getErrCode());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.chinaums.test;
|
||||
|
||||
import com.chinaums.open.api.DefaultOpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiException;
|
||||
import com.chinaums.open.api.request.EducationInfoVerifyRequest;
|
||||
import com.chinaums.open.api.request.IdCheckSimpleInfoRequest;
|
||||
import com.chinaums.open.api.response.EducationInfoVerifyResponse;
|
||||
import com.chinaums.open.api.response.IdCheckSimpleInfoResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/2/21
|
||||
* Time: 15:00
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public class IdCheckSimpleInfoTestCase {
|
||||
@org.junit.Test
|
||||
public void testIdCheck() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "";
|
||||
String appKey = "";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
IdCheckSimpleInfoRequest request = new IdCheckSimpleInfoRequest();
|
||||
request.setCertifId("");
|
||||
request.setName("");
|
||||
IdCheckSimpleInfoResponse response = openApiClient.execute(request);
|
||||
System.out.println(response.getErrCode());
|
||||
}
|
||||
|
||||
|
||||
@org.junit.Test
|
||||
public void testEducation() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "";
|
||||
String appKey = "";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
EducationInfoVerifyRequest ysBankCardTagRequest = new EducationInfoVerifyRequest();
|
||||
ysBankCardTagRequest.setData("{\"certNo\":\"\",\"name\":\"\"}");
|
||||
EducationInfoVerifyResponse ysBankCardTagResponse;
|
||||
ysBankCardTagResponse = openApiClient.execute(ysBankCardTagRequest);
|
||||
System.out.println(ysBankCardTagResponse.getData());
|
||||
System.out.println(ysBankCardTagResponse.getResultCode());
|
||||
System.out.println(ysBankCardTagResponse.getResultInfo());
|
||||
}
|
||||
|
||||
@org.junit.Test
|
||||
public void testface001() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "";
|
||||
String appKey = "";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
EducationInfoVerifyRequest ysBankCardTagRequest = new EducationInfoVerifyRequest();
|
||||
ysBankCardTagRequest.setData("{\"orderId\":\"\",\"deviceID\":\"\"}");
|
||||
EducationInfoVerifyResponse ysBankCardTagResponse;
|
||||
ysBankCardTagResponse = openApiClient.execute(ysBankCardTagRequest);
|
||||
System.out.println(ysBankCardTagResponse.getData());
|
||||
System.out.println(ysBankCardTagResponse.getResultCode());
|
||||
System.out.println(ysBankCardTagResponse.getResultInfo());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.chinaums.test;
|
||||
|
||||
import com.chinaums.open.api.DefaultOpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiException;
|
||||
import com.chinaums.open.api.request.AcpInstallmentRequest;
|
||||
import com.chinaums.open.api.response.AcpInstallmentResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/12/12
|
||||
* Time: 15:05
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class InstallmentTest {
|
||||
@org.junit.Test
|
||||
public void testVerifyBankCard() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "";
|
||||
String appKey = "";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url, appId, appKey);
|
||||
AcpInstallmentRequest acpInstallmentRequest = new AcpInstallmentRequest();
|
||||
acpInstallmentRequest.setMerchantCode("");
|
||||
acpInstallmentRequest.setTerminalCode("");
|
||||
acpInstallmentRequest.setSystemTraceNum("");
|
||||
acpInstallmentRequest.setTransactionCurrencyCode("156");
|
||||
acpInstallmentRequest.setTransactionAmount("");
|
||||
acpInstallmentRequest.setEncryptedData("");
|
||||
AcpInstallmentResponse acpInstallmentResponse = openApiClient.execute(acpInstallmentRequest);
|
||||
System.out.println(acpInstallmentResponse.getErrCode());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.chinaums.test;
|
||||
|
||||
import com.chinaums.open.api.DefaultOpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiException;
|
||||
import com.chinaums.open.api.request.TokenRequest;
|
||||
import com.chinaums.open.api.response.TokenResponse;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/8/2
|
||||
* Time: 11:06
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class PosLinkTestCase {
|
||||
@org.junit.Test
|
||||
public void testGetToken() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "";
|
||||
String appKey = "";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
TokenRequest tokenRequest = new TokenRequest(appId,appKey);
|
||||
TokenResponse response = openApiClient.execute(tokenRequest);
|
||||
System.out.print(response.getAccessToken());
|
||||
}
|
||||
@Test
|
||||
public void testCreateRadom(){
|
||||
Random random = new Random();
|
||||
System.out.println(System.currentTimeMillis()+random.nextInt());
|
||||
System.out.println((int)((Math.random()*9+1)*100000));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.chinaums.test;
|
||||
|
||||
import com.chinaums.open.api.DefaultOpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiException;
|
||||
import com.chinaums.open.api.request.BankVerifyRequest;
|
||||
import com.chinaums.open.api.request.IdCardVerifyRequest;
|
||||
import com.chinaums.open.api.request.Mobile3factorVerifyRequest;
|
||||
import com.chinaums.open.api.request.RealNameVerifyRequest;
|
||||
import com.chinaums.open.api.response.BankVerifyResponse;
|
||||
import com.chinaums.open.api.response.IdCardVerifyResponse;
|
||||
import com.chinaums.open.api.response.Mobile3factorVerifyResponse;
|
||||
import com.chinaums.open.api.response.RealNameVerifyResponse;
|
||||
import org.junit.Test;
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/13
|
||||
* Time: 17:10
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public class RealNameVerifyTestCase {
|
||||
@Test
|
||||
public void testVerifyBankCard() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "";
|
||||
String appKey = "";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
BankVerifyRequest bankVerifyRequest = new BankVerifyRequest();
|
||||
bankVerifyRequest.setData("{\"cardNo\":\"\",\"phoneNo\":\"\"}");
|
||||
BankVerifyResponse bankVerifyResponse;
|
||||
for(int i=0;i<5;i++){
|
||||
bankVerifyResponse = openApiClient.execute(bankVerifyRequest);
|
||||
System.out.println(bankVerifyResponse.getData());
|
||||
System.out.println(bankVerifyResponse.getResultCode());
|
||||
System.out.println(bankVerifyResponse.getResultInfo());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRealNameVerify() throws OpenApiException {
|
||||
String url = "http://116.228.21.162:29015/";
|
||||
String appId = "10037e6f57c304d2015824085de80058";
|
||||
String appKey = "4e921d76ffc045d98e14999a1f67d1ea";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
RealNameVerifyRequest realNameVerifyRequest = new RealNameVerifyRequest();
|
||||
realNameVerifyRequest.setData("{\"userNo\":\"370203\",\"acctNo\":\"6214852107267879\",\"acctName\":\"李铁柱\",\"certNo\":\"370203199809012323\",\"certType\":\"00\",\"phone\":\"18970718908\"}");
|
||||
RealNameVerifyResponse realNameVerifyResponse = openApiClient.execute(realNameVerifyRequest);
|
||||
}
|
||||
@Test
|
||||
public void carreopratorVerify() throws OpenApiException {
|
||||
String url = "http://116.228.21.162:29015/";
|
||||
String appId = "10037e6f57c304d2015824085de80058";
|
||||
String appKey = "4e921d76ffc045d98e14999a1f67d1ea";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
Mobile3factorVerifyRequest request = new Mobile3factorVerifyRequest();
|
||||
request.setData("{\"userNo\":\"370203\",\"userName\":\"李铁柱\",\"certCode\":\"370203199809012323\",\"certType\":\"01\",\"phoneNo\":\"18970718908\"}");
|
||||
Mobile3factorVerifyResponse response = openApiClient.execute(request);
|
||||
System.out.println(response.getData());
|
||||
System.out.println(response.getResultInfo());
|
||||
System.out.println(response.getResultInfo());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void idcardVerify() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "9ed4dfed9540423fa04842916c54e0d1";
|
||||
String appKey = "20f00a8b37aa4ddda56e7eed2ef6fe2b";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
IdCardVerifyRequest request = new IdCardVerifyRequest();
|
||||
request.setData("{\"userNo\":\"370203\",\"userName\":\"李铁柱\",\"certCode\":\"370203199809012323\"}");
|
||||
IdCardVerifyResponse response = openApiClient.execute(request);
|
||||
System.out.println(response.getData());
|
||||
System.out.println(response.getResultInfo());
|
||||
System.out.println(response.getResultInfo());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.chinaums.test;
|
||||
|
||||
import com.chinaums.open.api.DefaultOpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiException;
|
||||
import com.chinaums.open.api.request.*;
|
||||
import com.chinaums.open.api.response.*;
|
||||
import org.junit.*;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/6/5
|
||||
* Time: 16:18
|
||||
* 所属模块:
|
||||
* 功能说明:智慧验证相关接口验证测试
|
||||
*/
|
||||
public class SmartverificationTestCase {
|
||||
|
||||
/**
|
||||
* 银行卡验证
|
||||
* @throws OpenApiException
|
||||
*/
|
||||
@org.junit.Test
|
||||
public void testVerifyBankCard() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "";
|
||||
String appKey = "";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url, appId, appKey);
|
||||
BankVerifyRequest bankVerifyRequest = new BankVerifyRequest();
|
||||
bankVerifyRequest.setData("{\"userNo\":\"\",\"acctNo\":\"\",\"acctName\":\"\",\"certNo\":\"\",\"certType\":\"\",\"phone\":\"\"}");
|
||||
BankVerifyResponse bankVerifyResponse;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
bankVerifyResponse = openApiClient.execute(bankVerifyRequest);
|
||||
System.out.println(bankVerifyResponse.getData());
|
||||
System.out.println(bankVerifyResponse.getResultCode());
|
||||
System.out.println(bankVerifyResponse.getResultInfo());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 实名验证
|
||||
* @throws OpenApiException
|
||||
*/
|
||||
@org.junit.Test
|
||||
public void testRealNameVerify() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "9ed4dfed9540423fa04842916c54e0d1";
|
||||
String appKey = "20f00a8b37aa4ddda56e7eed2ef6fe2b";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url, appId, appKey);
|
||||
RealNameVerifyRequest request = new RealNameVerifyRequest();
|
||||
request.setData("{\"userNo\":\"370203\",\"acctNo\":\"6214852107267879\",\"acctName\":\"李铁柱\",\"certNo\":\"370203199809012323\",\"certType\":\"00\",\"phone\":\"18970718908\"}");
|
||||
RealNameVerifyResponse response;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
response = openApiClient.execute(request);
|
||||
System.out.println(response.getData());
|
||||
System.out.println(response.getResultCode());
|
||||
System.out.println(response.getResultInfo());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动3要素
|
||||
* @throws OpenApiException
|
||||
*/
|
||||
@Test
|
||||
public void carreopratorVerify() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "9ed4dfed9540423fa04842916c54e0d1";
|
||||
String appKey = "20f00a8b37aa4ddda56e7eed2ef6fe2b";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
Mobile3factorVerifyRequest request = new Mobile3factorVerifyRequest();
|
||||
request.setData("{\"userNo\":\"370203\",\"userName\":\"李铁柱\",\"certCode\":\"370203199809012323\",\"certType\":\"01\",\"phoneNo\":\"18970718908\"}");
|
||||
Mobile3factorVerifyResponse response = openApiClient.execute(request);
|
||||
System.out.println(response.getData());
|
||||
System.out.println(response.getResultInfo());
|
||||
System.out.println(response.getResultInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 身份证验证
|
||||
* @throws OpenApiException
|
||||
*/
|
||||
@Test
|
||||
public void idcardVerify() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "9ed4dfed9540423fa04842916c54e0d1";
|
||||
String appKey = "20f00a8b37aa4ddda56e7eed2ef6fe2b";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
IdCardVerifyRequest request = new IdCardVerifyRequest();
|
||||
request.setData("{\"userNo\":\"370203\",\"userName\":\"李铁柱\",\"certCode\":\"370203199809012323\"}");
|
||||
IdCardVerifyResponse response = openApiClient.execute(request);
|
||||
System.out.println(response.getData());
|
||||
System.out.println(response.getResultInfo());
|
||||
System.out.println(response.getResultInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 楠云标签查询
|
||||
* @throws OpenApiException
|
||||
*/
|
||||
@org.junit.Test
|
||||
public void testNyBankCardTag() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "9ed4dfed9540423fa04842916c54e0d1";
|
||||
String appKey = "20f00a8b37aa4ddda56e7eed2ef6fe2b";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
NyBankCardTagRequest nyBankCardTagRequest = new NyBankCardTagRequest();
|
||||
nyBankCardTagRequest.setData("{\"userNo\":\"000000003\",\"priAcctNo\":\"6228480028307505074\",\"riskflag\":\"1\"}");
|
||||
NyBankCardTagResponse nyBankCardTagResponse;
|
||||
nyBankCardTagResponse = openApiClient.execute(nyBankCardTagRequest);
|
||||
System.out.println(nyBankCardTagResponse.getData());
|
||||
System.out.println(nyBankCardTagResponse.getResultCode());
|
||||
System.out.println(nyBankCardTagResponse.getResultInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 盐商标签查询
|
||||
* @throws OpenApiException
|
||||
*/
|
||||
@org.junit.Test
|
||||
public void testYsBankCardTag() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "9ed4dfed9540423fa04842916c54e0d1";
|
||||
String appKey = "20f00a8b37aa4ddda56e7eed2ef6fe2b";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
YsBankCardTagRequest ysBankCardTagRequest = new YsBankCardTagRequest();
|
||||
ysBankCardTagRequest.setData("{\"phoneNo\":\"18771059056\",\"priAcctNo\":\"3568570112914437\"}");
|
||||
YsBankCardTagResponse ysBankCardTagResponse;
|
||||
ysBankCardTagResponse = openApiClient.execute(ysBankCardTagRequest);
|
||||
System.out.println(ysBankCardTagResponse.getData());
|
||||
System.out.println(ysBankCardTagResponse.getResultCode());
|
||||
System.out.println(ysBankCardTagResponse.getResultInfo());
|
||||
}
|
||||
|
||||
|
||||
@org.junit.Test
|
||||
public void testEducation() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "9ed4dfed9540423fa04842916c54e0d1";
|
||||
String appKey = "20f00a8b37aa4ddda56e7eed2ef6fe2b";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
EducationInfoVerifyRequest ysBankCardTagRequest = new EducationInfoVerifyRequest();
|
||||
ysBankCardTagRequest.setData("{\"certNo\":\"342529198702131248\",\"name\":\"徐紫燕\"}");
|
||||
EducationInfoVerifyResponse ysBankCardTagResponse;
|
||||
ysBankCardTagResponse = openApiClient.execute(ysBankCardTagRequest);
|
||||
System.out.println(ysBankCardTagResponse.getData());
|
||||
System.out.println(ysBankCardTagResponse.getResultCode());
|
||||
System.out.println(ysBankCardTagResponse.getResultInfo());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.chinaums.test;
|
||||
|
||||
import com.chinaums.open.api.DefaultOpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiException;
|
||||
import com.chinaums.open.api.response.TokenResponse;
|
||||
import com.chinaums.open.api.request.TokenRequest;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/5
|
||||
* Time: 17:05
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public class TokenTestCase {
|
||||
@Test
|
||||
public void getToken() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "";
|
||||
String appKey = "";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
TokenRequest tokenRequest = new TokenRequest(appId,appKey);
|
||||
TokenResponse response = openApiClient.execute(tokenRequest);
|
||||
System.out.print(response.getAccessToken());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.chinaums.test;
|
||||
|
||||
import com.chinaums.open.api.DefaultOpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiException;
|
||||
import com.chinaums.open.api.request.TokenRequest;
|
||||
import com.chinaums.open.api.response.TokenResponse;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2016/12/5
|
||||
* Time: 17:05
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public class TokenTestCaseDev {
|
||||
@Test
|
||||
public void getToken() throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "";
|
||||
String appKey = "";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
TokenRequest tokenRequest = new TokenRequest(appId,appKey);
|
||||
TokenResponse response = openApiClient.execute(tokenRequest);
|
||||
System.out.print(response.getAccessToken());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.chinaums.test;
|
||||
|
||||
import com.chinaums.open.api.DefaultOpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiClient;
|
||||
import com.chinaums.open.api.OpenApiException;
|
||||
import com.chinaums.open.api.request.BankVerifyRequest;
|
||||
import com.chinaums.open.api.response.BankVerifyResponse;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ZHANGWEI
|
||||
* Date: 2017/2/13
|
||||
* Time: 14:13
|
||||
* 所属模块:
|
||||
* 功能说明:
|
||||
*/
|
||||
public class UniqueTestCase {
|
||||
public static void main(String[]args) throws OpenApiException {
|
||||
String url = "https://api-mop.chinaums.com/";
|
||||
String appId = "";
|
||||
String appKey = "";
|
||||
OpenApiClient openApiClient = new DefaultOpenApiClient(url,appId,appKey);
|
||||
BankVerifyRequest bankVerifyRequest = new BankVerifyRequest();
|
||||
bankVerifyRequest.setData("{\"cardNo\":\"\",\"phoneNo\":\"\"}");
|
||||
BankVerifyResponse bankVerifyResponse;
|
||||
for(int i=0;i<5;i++){
|
||||
bankVerifyResponse = openApiClient.execute(bankVerifyRequest);
|
||||
System.out.println(bankVerifyResponse.getData());
|
||||
System.out.println(bankVerifyResponse.getResultCode());
|
||||
System.out.println(bankVerifyResponse.getResultInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
extLib/commons-codec-1.9.jar
Normal file
BIN
extLib/commons-codec-1.9.jar
Normal file
Binary file not shown.
241
pom.xml
Normal file
241
pom.xml
Normal file
@@ -0,0 +1,241 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.chenyon</groupId>
|
||||
<artifactId>qichenrent</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.rcy.framework</groupId>
|
||||
<artifactId>framework-dependencies</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.rcy.framework</groupId>
|
||||
<artifactId>framework-data</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.rcy.framework</groupId>-->
|
||||
<!-- <artifactId>framework-security</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.rcy.framework</groupId>
|
||||
<artifactId>framework-utils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.maxmind.geoip2</groupId>
|
||||
<artifactId>geoip2</artifactId>
|
||||
<version>2.12.0</version> <!-- 请检查最新版本 -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.lionsoul</groupId>
|
||||
<artifactId>ip2region</artifactId>
|
||||
<version>1.7.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.chinaums.open</groupId>
|
||||
<artifactId>open-api-sdk</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/extLib/chinaumsdk/chinaumsdk.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.9</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/extLib/commons-codec-1.9.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>qichenrent</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<!-- xml放在java目录下-->
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<!--指定资源的位置(xml放在resources下,可以不用指定)-->
|
||||
<!-- 添加 config 目录 -->
|
||||
<resource>
|
||||
<directory>config</directory>
|
||||
<targetPath>config</targetPath> <!-- 编译后在 target/classes/config/ 下 -->
|
||||
<includes>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.yml</include>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
<!-- 你原来的 resources / defaultGoal / pluginManagement 都保留 -->
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
|
||||
<execution>
|
||||
<id>copy-jar</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/qichenrent</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${project.build.directory}</directory>
|
||||
<includes>
|
||||
<include>${project.build.finalName}.jar</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
|
||||
<execution>
|
||||
<id>copy-scripts</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/qichenrent/bin</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/scripts</directory>
|
||||
<includes>
|
||||
<include>*.sh</include>
|
||||
<include>*.bat</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
<compilerArgs>
|
||||
<arg>-parameters</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.2</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<configuration>
|
||||
<minmemory>128m</minmemory>
|
||||
<maxmemory>512m</maxmemory>
|
||||
</configuration>
|
||||
<version>3.1.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.2.3</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-scm-plugin</artifactId>
|
||||
<version>1.9.5</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.8</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.2.5.RELEASE</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
||||
13
src/main/java/org/chenyon/WepApplication.java
Normal file
13
src/main/java/org/chenyon/WepApplication.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package org.chenyon;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class WepApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Current working dir: " + System.getProperty("user.dir"));
|
||||
SpringApplication.run(WepApplication.class,args);
|
||||
}
|
||||
}
|
||||
66
src/main/java/org/chenyon/assets/AssetsController.java
Normal file
66
src/main/java/org/chenyon/assets/AssetsController.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package org.chenyon.assets;
|
||||
|
||||
import org.chenyon.assets.vo.AssetsPageQueryCondition;
|
||||
import org.chenyon.assets.vo.AssetsVo;
|
||||
import org.chenyon.user.LoginCheck;
|
||||
import org.chenyon.user.UserContext;
|
||||
import org.rcy.framework.api.entity.PageResult;
|
||||
import org.rcy.framework.api.entity.ResultMessage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 资产查询
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/assets")
|
||||
public class AssetsController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(AssetsController.class);
|
||||
@Autowired
|
||||
private AssetsQueryService assetsQueryService;
|
||||
|
||||
@PostMapping("/queryPage")
|
||||
public ResultMessage pageQueryAssets(@RequestBody AssetsPageQueryCondition condition) {
|
||||
try {
|
||||
PageResult<AssetsVo> pageResult = assetsQueryService.pageQueryAssets(condition);
|
||||
return ResultMessage.success(pageResult);
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.success(new PageResult<>());
|
||||
}
|
||||
|
||||
@PostMapping("/getMyAssetsList")
|
||||
@LoginCheck
|
||||
public ResultMessage getMyAssetsList(@RequestBody AssetsPageQueryCondition condition){
|
||||
try {
|
||||
UserContext userContext = UserContext.get();
|
||||
if (userContext == null || userContext.getCusNo() == null) {
|
||||
return ResultMessage.success(new PageResult());
|
||||
}
|
||||
condition.setCusNo(userContext.getCusNo());
|
||||
PageResult<AssetsVo> pageResult = assetsQueryService.pageQueryAssets(condition);
|
||||
return ResultMessage.success(pageResult);
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.success(new PageResult());
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
public ResultMessage getDetail(@RequestParam("id") String id) {
|
||||
try {
|
||||
AssetsVo assetsVo = assetsQueryService.getAssetsById(id);
|
||||
return ResultMessage.success(assetsVo);
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.success(new AssetsVo());
|
||||
}
|
||||
|
||||
}
|
||||
88
src/main/java/org/chenyon/assets/AssetsQueryService.java
Normal file
88
src/main/java/org/chenyon/assets/AssetsQueryService.java
Normal file
@@ -0,0 +1,88 @@
|
||||
package org.chenyon.assets;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.chenyon.assets.vo.AssetsPageQueryCondition;
|
||||
import org.chenyon.assets.vo.AssetsVo;
|
||||
import org.chenyon.contract.RentFeeInfo;
|
||||
import org.chenyon.file.OaFileHandlerService;
|
||||
import org.chenyon.file.OaFileLocalRefVo;
|
||||
import org.chenyon.file.OaFileVo;
|
||||
import org.chenyon.oa.OaAssetService;
|
||||
import org.chenyon.oa.asset.OaAssetsVo;
|
||||
import org.rcy.framework.api.entity.PageResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class AssetsQueryService {
|
||||
|
||||
@Autowired
|
||||
private OaAssetService oaAssetService;
|
||||
@Autowired
|
||||
private OaFileHandlerService oaFileHandlerService;
|
||||
|
||||
public PageResult<AssetsVo> pageQueryAssets(AssetsPageQueryCondition condition) throws Exception {
|
||||
//调用OA接口查询
|
||||
PageResult<OaAssetsVo> pageResultOa = oaAssetService.pageQueryAssets(condition);
|
||||
PageResult<AssetsVo> pageResult = new PageResult<>();
|
||||
pageResult.setPageNo(pageResultOa.getPageNo());
|
||||
pageResult.setPageSize(pageResultOa.getPageSize());
|
||||
pageResult.setRecordTotal(pageResultOa.getRecordTotal());
|
||||
List<AssetsVo> assetsVoList = new ArrayList<>();
|
||||
for (OaAssetsVo oaAssetsVo : pageResultOa.getResult()) {
|
||||
AssetsVo assetsVo = new AssetsVo();
|
||||
assetsVo.setAssetsNo(oaAssetsVo.getAssetsNo());
|
||||
assetsVo.setAssetsType(oaAssetsVo.getAssetsType());
|
||||
RentFeeInfo rentFeeInfo = new RentFeeInfo();
|
||||
if(StringUtils.isNotBlank(oaAssetsVo.getRentFee())){
|
||||
rentFeeInfo.setRentFee(Double.parseDouble(oaAssetsVo.getRentFee()));
|
||||
}
|
||||
assetsVo.setFootPrint(oaAssetsVo.getFootPrint());
|
||||
assetsVo.setAssetsName(oaAssetsVo.getAssetsName());
|
||||
assetsVo.setDetailImgs(oaFileHandlerService.getUrls(true,oaAssetsVo.getAssetsNo(), oaAssetsVo.getFormId(),"AssetsDetailImg",oaAssetsVo.getDetailImg()));
|
||||
assetsVo.setVrImgs(oaFileHandlerService.getUrls(true,oaAssetsVo.getAssetsNo(), oaAssetsVo.getFormId(),"AssetsVrImg",oaAssetsVo.getVrImg()));
|
||||
if(assetsVo.getDetailImgs() != null && assetsVo.getDetailImgs().size() > 1) {
|
||||
assetsVo.setCoverImgUrl(assetsVo.getDetailImgs().get(0));
|
||||
}
|
||||
assetsVoList.add(assetsVo);
|
||||
}
|
||||
pageResult.setResult(assetsVoList);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
public AssetsVo getAssetsById(String id) throws Exception {
|
||||
OaAssetsVo oaAssetsVo = oaAssetService.queryAssetsDetail(id);
|
||||
AssetsVo assetsVo = new AssetsVo();
|
||||
assetsVo.setAssetsNo(oaAssetsVo.getAssetsNo());
|
||||
assetsVo.setAssetsType(oaAssetsVo.getAssetsType());
|
||||
RentFeeInfo rentFeeInfo = new RentFeeInfo();
|
||||
if(StringUtils.isNotBlank(oaAssetsVo.getRentFee())){
|
||||
rentFeeInfo.setRentFee(Double.parseDouble(oaAssetsVo.getRentFee()));
|
||||
}
|
||||
assetsVo.setFeeInfo(rentFeeInfo);
|
||||
assetsVo.setFootPrint(oaAssetsVo.getFootPrint());
|
||||
assetsVo.setAssetsName(oaAssetsVo.getAssetsName());
|
||||
assetsVo.setAssetsStatus(oaAssetsVo.getAssetsStatus());
|
||||
assetsVo.setAssetsAddress(oaAssetsVo.getAssetsAddress());
|
||||
assetsVo.setAssetsDesc(oaAssetsVo.getAssetsDesc());
|
||||
assetsVo.setFloorNo(oaAssetsVo.getFloorNo());
|
||||
assetsVo.setRoomNo(oaAssetsVo.getRoomNo());
|
||||
assetsVo.setHasLift(oaAssetsVo.getHasLift());
|
||||
assetsVo.setLatitude(oaAssetsVo.getLatitude());
|
||||
assetsVo.setLongitude(oaAssetsVo.getLongitude());
|
||||
assetsVo.setLayout(oaAssetsVo.getLayout());
|
||||
assetsVo.setUnitNo(oaAssetsVo.getUnitNo());
|
||||
assetsVo.setManagerName(oaAssetsVo.getManagerName());
|
||||
assetsVo.setManagerPhone(oaAssetsVo.getManagerPhone());
|
||||
assetsVo.setDetailImgs(oaFileHandlerService.getUrls(true,oaAssetsVo.getAssetsNo(), oaAssetsVo.getFormId(),"AssetsDetailImg",oaAssetsVo.getDetailImg()));
|
||||
assetsVo.setVrImgs(oaFileHandlerService.getUrls(true,oaAssetsVo.getAssetsNo(), oaAssetsVo.getFormId(),"AssetsVrImg",oaAssetsVo.getVrImg()));
|
||||
if(assetsVo.getDetailImgs() != null) {
|
||||
assetsVo.setCoverImgUrl(assetsVo.getDetailImgs().get(0));
|
||||
}
|
||||
return assetsVo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.chenyon.assets.vo;
|
||||
|
||||
import org.rcy.framework.api.entity.PageQueryRequest;
|
||||
|
||||
public class AssetsPageQueryCondition extends PageQueryRequest {
|
||||
|
||||
private String assetsNo;//资产编号
|
||||
private String assetsType;//资产类型
|
||||
private String city;//所属城市
|
||||
private String orderByColumn; //排序字段
|
||||
private String isAsc; //排序方式、
|
||||
private String assetsStatus;//资产状态
|
||||
private String assetsName;//资产名称
|
||||
private String cusNo; //客商编码
|
||||
private String keyWord; //关键字
|
||||
|
||||
public String getAssetsType() {
|
||||
return assetsType;
|
||||
}
|
||||
|
||||
public void setAssetsType(String assetsType) {
|
||||
this.assetsType = assetsType;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getOrderByColumn() {
|
||||
return orderByColumn;
|
||||
}
|
||||
|
||||
public void setOrderByColumn(String orderByColumn) {
|
||||
this.orderByColumn = orderByColumn;
|
||||
}
|
||||
|
||||
public String getIsAsc() {
|
||||
return isAsc;
|
||||
}
|
||||
|
||||
public void setIsAsc(String isAsc) {
|
||||
this.isAsc = isAsc;
|
||||
}
|
||||
|
||||
public String getAssetsStatus() {
|
||||
return assetsStatus;
|
||||
}
|
||||
|
||||
public void setAssetsStatus(String assetsStatus) {
|
||||
this.assetsStatus = assetsStatus;
|
||||
}
|
||||
|
||||
public String getAssetsName() {
|
||||
return assetsName;
|
||||
}
|
||||
|
||||
public void setAssetsName(String assetsName) {
|
||||
this.assetsName = assetsName;
|
||||
}
|
||||
|
||||
public String getCusNo() {
|
||||
return cusNo;
|
||||
}
|
||||
|
||||
public void setCusNo(String cusNo) {
|
||||
this.cusNo = cusNo;
|
||||
}
|
||||
|
||||
public String getAssetsNo() {
|
||||
return assetsNo;
|
||||
}
|
||||
|
||||
public void setAssetsNo(String assetsNo) {
|
||||
this.assetsNo = assetsNo;
|
||||
}
|
||||
|
||||
public String getKeyWord() {
|
||||
return keyWord;
|
||||
}
|
||||
|
||||
public void setKeyWord(String keyWord) {
|
||||
this.keyWord = keyWord;
|
||||
}
|
||||
}
|
||||
199
src/main/java/org/chenyon/assets/vo/AssetsVo.java
Normal file
199
src/main/java/org/chenyon/assets/vo/AssetsVo.java
Normal file
@@ -0,0 +1,199 @@
|
||||
package org.chenyon.assets.vo;
|
||||
|
||||
import org.chenyon.contract.RentFeeInfo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class AssetsVo implements Serializable {
|
||||
|
||||
private String assetsNo; // 资产编号
|
||||
private String assetsName; // 资产名称
|
||||
private String assetsType; //资产类型
|
||||
private String assetsStatus; //资产状态
|
||||
private String footPrint; //占地大小
|
||||
private String coverImgUrl; //封面图片
|
||||
private List<String> detailImgs; //详情图片
|
||||
private List<String> vrImgs; //vr图
|
||||
private String assetsDesc; //资产描述
|
||||
private RentFeeInfo feeInfo; //租赁费用信息
|
||||
private String latitude; //纬度
|
||||
private String longitude; //经度
|
||||
private String managerName; //管理员
|
||||
private String managerPhone; //管理员电话
|
||||
private String unitNo; //单元号
|
||||
private String floorNo; //楼层号
|
||||
private String roomNo; //房间号
|
||||
private Boolean hasLift;//有无电梯
|
||||
private String layout; //户型
|
||||
private String orientation; //朝向
|
||||
private String assetsAddress; //资产地址
|
||||
|
||||
public String getManagerName() {
|
||||
return managerName;
|
||||
}
|
||||
|
||||
public void setManagerName(String managerName) {
|
||||
this.managerName = managerName;
|
||||
}
|
||||
|
||||
public String getManagerPhone() {
|
||||
return managerPhone;
|
||||
}
|
||||
|
||||
public void setManagerPhone(String managerPhone) {
|
||||
this.managerPhone = managerPhone;
|
||||
}
|
||||
|
||||
public String getAssetsName() {
|
||||
return assetsName;
|
||||
}
|
||||
|
||||
public void setAssetsName(String assetsName) {
|
||||
this.assetsName = assetsName;
|
||||
}
|
||||
|
||||
public String getAssetsType() {
|
||||
return assetsType;
|
||||
}
|
||||
|
||||
public void setAssetsType(String assetsType) {
|
||||
this.assetsType = assetsType;
|
||||
}
|
||||
|
||||
public String getAssetsStatus() {
|
||||
return assetsStatus;
|
||||
}
|
||||
|
||||
public void setAssetsStatus(String assetsStatus) {
|
||||
this.assetsStatus = assetsStatus;
|
||||
}
|
||||
|
||||
public String getFootPrint() {
|
||||
return footPrint;
|
||||
}
|
||||
|
||||
public void setFootPrint(String footPrint) {
|
||||
this.footPrint = footPrint;
|
||||
}
|
||||
|
||||
public String getCoverImgUrl() {
|
||||
return coverImgUrl;
|
||||
}
|
||||
|
||||
public void setCoverImgUrl(String coverImgUrl) {
|
||||
this.coverImgUrl = coverImgUrl;
|
||||
}
|
||||
|
||||
public String getAssetsDesc() {
|
||||
return assetsDesc;
|
||||
}
|
||||
|
||||
public void setAssetsDesc(String assetsDesc) {
|
||||
this.assetsDesc = assetsDesc;
|
||||
}
|
||||
|
||||
public String getAssetsNo() {
|
||||
return assetsNo;
|
||||
}
|
||||
|
||||
public void setAssetsNo(String assetsNo) {
|
||||
this.assetsNo = assetsNo;
|
||||
}
|
||||
|
||||
public List<String> getDetailImgs() {
|
||||
return detailImgs;
|
||||
}
|
||||
|
||||
public void setDetailImgs(List<String> detailImgs) {
|
||||
this.detailImgs = detailImgs;
|
||||
}
|
||||
|
||||
public List<String> getVrImgs() {
|
||||
return vrImgs;
|
||||
}
|
||||
|
||||
public void setVrImgs(List<String> vrImgs) {
|
||||
this.vrImgs = vrImgs;
|
||||
}
|
||||
|
||||
public RentFeeInfo getFeeInfo() {
|
||||
return feeInfo;
|
||||
}
|
||||
|
||||
public void setFeeInfo(RentFeeInfo feeInfo) {
|
||||
this.feeInfo = feeInfo;
|
||||
}
|
||||
|
||||
public String getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(String latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public String getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(String longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public String getUnitNo() {
|
||||
return unitNo;
|
||||
}
|
||||
|
||||
public void setUnitNo(String unitNo) {
|
||||
this.unitNo = unitNo;
|
||||
}
|
||||
|
||||
public String getFloorNo() {
|
||||
return floorNo;
|
||||
}
|
||||
|
||||
public void setFloorNo(String floorNo) {
|
||||
this.floorNo = floorNo;
|
||||
}
|
||||
|
||||
public String getRoomNo() {
|
||||
return roomNo;
|
||||
}
|
||||
|
||||
public void setRoomNo(String roomNo) {
|
||||
this.roomNo = roomNo;
|
||||
}
|
||||
|
||||
public Boolean getHasLift() {
|
||||
return hasLift;
|
||||
}
|
||||
|
||||
public void setHasLift(Boolean hasLift) {
|
||||
this.hasLift = hasLift;
|
||||
}
|
||||
|
||||
public String getLayout() {
|
||||
return layout;
|
||||
}
|
||||
|
||||
public void setLayout(String layout) {
|
||||
this.layout = layout;
|
||||
}
|
||||
|
||||
public String getOrientation() {
|
||||
return orientation;
|
||||
}
|
||||
|
||||
public void setOrientation(String orientation) {
|
||||
this.orientation = orientation;
|
||||
}
|
||||
|
||||
public String getAssetsAddress() {
|
||||
return assetsAddress;
|
||||
}
|
||||
|
||||
public void setAssetsAddress(String assetsAddress) {
|
||||
this.assetsAddress = assetsAddress;
|
||||
}
|
||||
}
|
||||
51
src/main/java/org/chenyon/auth/AuthController.java
Normal file
51
src/main/java/org/chenyon/auth/AuthController.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package org.chenyon.auth;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.chenyon.file.OaFileHandlerService;
|
||||
import org.chenyon.user.UserService;
|
||||
import org.chenyon.user.UserVo;
|
||||
import org.chenyon.wx.WxUserSession;
|
||||
import org.chenyon.wx.WxUserSessionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/auth")
|
||||
public class AuthController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private WxUserSessionService wxUserSessionService;
|
||||
@Autowired
|
||||
private OaFileHandlerService oaFileHandlerService;
|
||||
|
||||
@GetMapping("/resourceCheck")
|
||||
public ResponseEntity<Void> resourceCheck(HttpServletRequest request) {
|
||||
String path = request.getHeader("X-Original-Path");
|
||||
String uri = request.getHeader("X-Original-URI");
|
||||
|
||||
if (uri.startsWith("/private")) {
|
||||
String token = request.getHeader("X-Token");
|
||||
String userType = request.getHeader("USERTYPE");
|
||||
if(StringUtils.isAnyBlank(token, userType)) {
|
||||
return ResponseEntity.status(403).build();
|
||||
}
|
||||
WxUserSession session = wxUserSessionService.getSessionInfoByThirdSession(token);
|
||||
if (session == null) {
|
||||
return ResponseEntity.status(403).build();
|
||||
}
|
||||
UserVo userVo = userService.findByOpenIdAndUserType(session.getOpenId(), userType);
|
||||
String owner = oaFileHandlerService.findOwnerByUrl(uri);
|
||||
if(owner == null || !owner.equals(userVo.getCusNo())) {
|
||||
return ResponseEntity.status(403).build();
|
||||
}
|
||||
}
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
}
|
||||
98
src/main/java/org/chenyon/bill/BillController.java
Normal file
98
src/main/java/org/chenyon/bill/BillController.java
Normal file
@@ -0,0 +1,98 @@
|
||||
package org.chenyon.bill;
|
||||
|
||||
import org.chenyon.user.LoginCheck;
|
||||
import org.chenyon.user.UserContext;
|
||||
import org.rcy.framework.api.entity.PageResult;
|
||||
import org.rcy.framework.api.entity.ResultMessage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/bill")
|
||||
public class BillController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BillController.class);
|
||||
|
||||
@Autowired
|
||||
private BillService billService;
|
||||
|
||||
@LoginCheck
|
||||
@PostMapping("/pageQueryContractBill")
|
||||
public ResultMessage pageQueryContractBill(@RequestBody BillQueryCondition condition) {
|
||||
try {
|
||||
UserContext userContext = UserContext.get();
|
||||
if(userContext == null || userContext.getCusNo() == null) {
|
||||
return ResultMessage.success(new PageResult());
|
||||
}
|
||||
condition.setCusNo(userContext.getCusNo());
|
||||
return ResultMessage.success(billService.pageQueryContractBill(condition));
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.success(new PageResult());
|
||||
}
|
||||
|
||||
@LoginCheck
|
||||
@PostMapping("/pageQueryWaeBill")
|
||||
public ResultMessage pageQueryWaeBill(@RequestBody BillQueryCondition condition){
|
||||
try {
|
||||
UserContext userContext = UserContext.get();
|
||||
if(userContext == null || userContext.getCusNo() == null) {
|
||||
return ResultMessage.success(new PageResult());
|
||||
}
|
||||
condition.setCusNo(userContext.getCusNo());
|
||||
return ResultMessage.success(billService.pageQueryWaeBill(condition));
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.success(new PageResult());
|
||||
}
|
||||
|
||||
@PostMapping("/pageQueryPayRecord")
|
||||
@LoginCheck
|
||||
public ResultMessage pageQueryWaePayRecord(@RequestBody PayRecordQueryConditon condition) {
|
||||
try {
|
||||
UserContext userContext = UserContext.get();
|
||||
if(userContext == null || userContext.getCusNo() == null) {
|
||||
return ResultMessage.success(new PageResult());
|
||||
}
|
||||
condition.setCusNo(userContext.getCusNo());
|
||||
return ResultMessage.success(billService.pageQueryContractPayRecord(condition));
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.success(new PageResult());
|
||||
}
|
||||
|
||||
@LoginCheck
|
||||
@GetMapping("/countUnpayRentBills")
|
||||
public ResultMessage countUnpayRentBills() {
|
||||
try {
|
||||
UserContext userContext = UserContext.get();
|
||||
if(userContext == null || userContext.getCusNo() == null) {
|
||||
return ResultMessage.success(0);
|
||||
}
|
||||
return ResultMessage.success(billService.countUnpayRentBills(userContext.getCusNo()));
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.success(0);
|
||||
}
|
||||
|
||||
@LoginCheck
|
||||
@GetMapping("/countUnpayWaeBills")
|
||||
public ResultMessage countUnpayWaeBills() {
|
||||
try {
|
||||
UserContext userContext = UserContext.get();
|
||||
if(userContext == null || userContext.getCusNo() == null) {
|
||||
return ResultMessage.success(0);
|
||||
}
|
||||
return ResultMessage.success(billService.countUnpayWaeBills(userContext.getCusNo()));
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.success(0);
|
||||
}
|
||||
}
|
||||
34
src/main/java/org/chenyon/bill/BillQueryCondition.java
Normal file
34
src/main/java/org/chenyon/bill/BillQueryCondition.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package org.chenyon.bill;
|
||||
|
||||
import org.rcy.framework.api.entity.PageQueryRequest;
|
||||
|
||||
public class BillQueryCondition extends PageQueryRequest {
|
||||
|
||||
private String cusNo; //客商编码
|
||||
private String year; //年份
|
||||
private String billStatus; //账单状态
|
||||
|
||||
public String getCusNo() {
|
||||
return cusNo;
|
||||
}
|
||||
|
||||
public void setCusNo(String cusNo) {
|
||||
this.cusNo = cusNo;
|
||||
}
|
||||
|
||||
public String getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(String year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public String getBillStatus() {
|
||||
return billStatus;
|
||||
}
|
||||
|
||||
public void setBillStatus(String billStatus) {
|
||||
this.billStatus = billStatus;
|
||||
}
|
||||
}
|
||||
42
src/main/java/org/chenyon/bill/BillService.java
Normal file
42
src/main/java/org/chenyon/bill/BillService.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package org.chenyon.bill;
|
||||
|
||||
import org.chenyon.oa.OaBillService;
|
||||
import org.chenyon.oa.bill.OaBillVo;
|
||||
import org.chenyon.oa.bill.OaPayRecordVo;
|
||||
import org.rcy.framework.api.entity.PageResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class BillService {
|
||||
|
||||
@Autowired
|
||||
private OaBillService oaBillService;
|
||||
|
||||
public PageResult<OaBillVo> pageQueryContractBill(BillQueryCondition condition) throws Exception {
|
||||
return oaBillService.pageQueryContractBill(condition);
|
||||
}
|
||||
|
||||
public PageResult<OaBillVo> pageQueryWaeBill(BillQueryCondition condition) throws Exception {
|
||||
return oaBillService.pageQueryWaeBill(condition);
|
||||
}
|
||||
public PageResult<OaPayRecordVo> pageQueryContractPayRecord(PayRecordQueryConditon condition) throws Exception {
|
||||
return oaBillService.pageQueryPayRecord(condition);
|
||||
}
|
||||
|
||||
public Integer countUnpayRentBills(String cusNo) throws Exception {
|
||||
Map<String,Object> params = new HashMap<>();
|
||||
params.put("cusNo",cusNo);
|
||||
return oaBillService.countUnpayRentBills(params);
|
||||
}
|
||||
|
||||
public Integer countUnpayWaeBills(String cusNo) throws Exception {
|
||||
Map<String,Object> params = new HashMap<>();
|
||||
params.put("cusNo",cusNo);
|
||||
return oaBillService.countUnpayWaeBills(params);
|
||||
}
|
||||
|
||||
}
|
||||
42
src/main/java/org/chenyon/bill/PayRecordQueryConditon.java
Normal file
42
src/main/java/org/chenyon/bill/PayRecordQueryConditon.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package org.chenyon.bill;
|
||||
|
||||
import org.rcy.framework.api.entity.PageQueryRequest;
|
||||
|
||||
public class PayRecordQueryConditon extends PageQueryRequest {
|
||||
private String cusNo;
|
||||
private String leType;
|
||||
private String year; //年份
|
||||
private String billType;
|
||||
|
||||
public String getCusNo() {
|
||||
return cusNo;
|
||||
}
|
||||
|
||||
public void setCusNo(String cusNo) {
|
||||
this.cusNo = cusNo;
|
||||
}
|
||||
|
||||
public String getLeType() {
|
||||
return leType;
|
||||
}
|
||||
|
||||
public void setLeType(String leType) {
|
||||
this.leType = leType;
|
||||
}
|
||||
|
||||
public String getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(String year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public String getBillType() {
|
||||
return billType;
|
||||
}
|
||||
|
||||
public void setBillType(String billType) {
|
||||
this.billType = billType;
|
||||
}
|
||||
}
|
||||
23
src/main/java/org/chenyon/cache/WxTokenCache.java
vendored
Normal file
23
src/main/java/org/chenyon/cache/WxTokenCache.java
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
package org.chenyon.cache;
|
||||
|
||||
public class WxTokenCache {
|
||||
|
||||
private String token;
|
||||
private long expireTime;
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public long getExpireTime() {
|
||||
return expireTime;
|
||||
}
|
||||
|
||||
public void setExpireTime(long expireTime) {
|
||||
this.expireTime = expireTime;
|
||||
}
|
||||
}
|
||||
64
src/main/java/org/chenyon/config/SpringMvcConfigurer.java
Normal file
64
src/main/java/org/chenyon/config/SpringMvcConfigurer.java
Normal file
@@ -0,0 +1,64 @@
|
||||
package org.chenyon.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.deser.std.DateDeserializers;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import org.chenyon.interceptor.LoginCheckInterceptor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* @author 吴康桥
|
||||
* @Description
|
||||
* @date 2022/10/10 14:29
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
public class SpringMvcConfigurer implements WebMvcConfigurer {
|
||||
|
||||
@Autowired
|
||||
private LoginCheckInterceptor loginCheckInterceptor;
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {
|
||||
ObjectMapper mapper = builder.createXmlMapper(false).timeZone(TimeZone.getTimeZone("Asia/Shanghai")).build();
|
||||
//忽略值为null的属性
|
||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
SimpleModule module = new SimpleModule();
|
||||
module.addSerializer(Long.class, new ToStringSerializer());
|
||||
module.addSerializer(Date.class, new DateSerializer(false, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")));
|
||||
module.addDeserializer(Date.class, new DateDeserializers.DateDeserializer(new DateDeserializers.DateDeserializer(), new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), "yyyy-MM-dd HH:mm:ss" ));
|
||||
mapper.registerModule(module);
|
||||
return mapper;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(loginCheckInterceptor)
|
||||
.addPathPatterns("/**");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
.allowedOrigins("*") // 允许所有域名访问,生产环境可以换成指定域名
|
||||
.allowedMethods("GET","POST","PUT","DELETE","OPTIONS")
|
||||
.allowCredentials(true)
|
||||
.maxAge(3600);
|
||||
}
|
||||
}
|
||||
116
src/main/java/org/chenyon/constants/OaApiUrl.java
Normal file
116
src/main/java/org/chenyon/constants/OaApiUrl.java
Normal file
@@ -0,0 +1,116 @@
|
||||
package org.chenyon.constants;
|
||||
|
||||
public final class OaApiUrl {
|
||||
/**
|
||||
* 匹配个人
|
||||
*/
|
||||
public static final String MATCH_PERSON = "/cus/matchPerson";
|
||||
/**
|
||||
* 匹配组织
|
||||
*/
|
||||
public static final String MATCH_ORG = "/cus/matchOrg";
|
||||
/**
|
||||
* 查询客商信息
|
||||
*/
|
||||
public static final String CUS_INFO = "/cus/getCusInfo";
|
||||
/**
|
||||
* 分页查询资产
|
||||
*/
|
||||
public static final String PAGE_QUERY_ASSETS = "/assets/queryPage";
|
||||
/**
|
||||
* 查询资产详情
|
||||
*/
|
||||
public static final String QUERY_ASSETS_DETAIL = "/assets/detail";
|
||||
/**
|
||||
* 分页查询合同
|
||||
*/
|
||||
public static final String PAGE_QUERY_CONTRACT = "/contract/queryPage";
|
||||
/**
|
||||
* 查询合同详情
|
||||
*/
|
||||
public static final String CONTRACT_DETAIL = "/contract/detail";
|
||||
/**
|
||||
* 查询合同详情
|
||||
*/
|
||||
public static final String CONTRACT_SIGN_LINK = "/contract/getSignLink";
|
||||
/**
|
||||
* 统计待签署合同份数
|
||||
*/
|
||||
public static final String CONTRACT_COUNT_UNSIGN = "/contract/countUnsign";
|
||||
/**
|
||||
* 查询客户所有已完成的合同信息
|
||||
*/
|
||||
public static final String CONTRACT_ALL = "/contract/queryAll";
|
||||
/**
|
||||
* 分页查询合同关联资产信息
|
||||
*/
|
||||
public static final String PAGE_QUERY_CONTRACT_ASSETS = "/pageQueryAssets";
|
||||
/**
|
||||
* 分页查询合同账单
|
||||
*/
|
||||
public static final String PAGE_QUERY_CONTRACT_BILL = "/bill/contractBill/queryPage";
|
||||
/**
|
||||
* 分页查询水电费账单
|
||||
*/
|
||||
public static final String PAGE_QUERY_WAE_BILL = "/bill/waeBill/queryPage";
|
||||
/**
|
||||
* 分页查询缴费记录
|
||||
*/
|
||||
public static final String PAGE_QUERY_PAY_RECORD = "/bill/payRecord/queryPage";
|
||||
/**
|
||||
* 统计未缴租金账单数
|
||||
*/
|
||||
public static final String COUNT_UNPAY_RENT_BILLS = "/bill/countUnpay/rent";
|
||||
/**
|
||||
* 统计未缴水电费账单数
|
||||
*/
|
||||
public static final String COUNT_UNPAY_WAE_BILLS = "/bill/countUnpay/wae";
|
||||
/**
|
||||
* 分页查询公告
|
||||
*/
|
||||
public static final String PAGE_QUERY_NOTICE = "/notice/queryPage";
|
||||
/**
|
||||
* 分页查询公告
|
||||
*/
|
||||
public static final String QUERY_NOTICE_DETAIL = "/notice/detail";
|
||||
/**
|
||||
* 分页查询留言
|
||||
*/
|
||||
public static final String PAGE_QUERY_FALLBACK = "/fallback/queryPage";
|
||||
/**
|
||||
* 查询留言详情
|
||||
*/
|
||||
public static final String FALLBACK_DETAIL = "/fallback/detail";
|
||||
/**
|
||||
* 提交留言
|
||||
*/
|
||||
public static final String FALLBACK_SUBMIT = "/fallback/submit";
|
||||
/**
|
||||
* 分页查询预约记录
|
||||
*/
|
||||
public static final String PAGE_QUERY_RESERVATION = "/reserve/queryPage";
|
||||
/**
|
||||
* 新增预约
|
||||
*/
|
||||
public static final String RESERVATION_SUBMIT = "/reserve/apply";
|
||||
/**
|
||||
* 新增预约
|
||||
*/
|
||||
public static final String RESERVATION_COUNT_HANDLING = "/reserve/countHandling";
|
||||
/**
|
||||
* 分页查询退租申请记录
|
||||
*/
|
||||
public static final String PAGE_QUERY_DISCHARGE = "/discharge/queryPage";
|
||||
/**
|
||||
* 提交退租申请
|
||||
*/
|
||||
public static final String DISCHARGE_APPLY = "/discharge/apply";
|
||||
/**
|
||||
* 下载文件
|
||||
*/
|
||||
public static final String FILE_DOWNLOAD = "/fileTransport/downloadFile";
|
||||
/**
|
||||
* 下载文件
|
||||
*/
|
||||
public static final String VIEW_RECORD_ADD = "/potential/add";
|
||||
}
|
||||
68
src/main/java/org/chenyon/contract/ContractAssetsVo.java
Normal file
68
src/main/java/org/chenyon/contract/ContractAssetsVo.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package org.chenyon.contract;
|
||||
|
||||
public class ContractAssetsVo {
|
||||
|
||||
private String assetsNo; // 资产编号
|
||||
private String assetsName; // 资产名称
|
||||
private String rentFee; //租金
|
||||
private String formId; //表单记录ID
|
||||
private String cover; //封面
|
||||
private RentFeeInfo feeInfo;
|
||||
private String footPrint; //占地大小
|
||||
|
||||
public String getAssetsNo() {
|
||||
return assetsNo;
|
||||
}
|
||||
|
||||
public void setAssetsNo(String assetsNo) {
|
||||
this.assetsNo = assetsNo;
|
||||
}
|
||||
|
||||
public String getAssetsName() {
|
||||
return assetsName;
|
||||
}
|
||||
|
||||
public void setAssetsName(String assetsName) {
|
||||
this.assetsName = assetsName;
|
||||
}
|
||||
|
||||
public String getRentFee() {
|
||||
return rentFee;
|
||||
}
|
||||
|
||||
public void setRentFee(String rentFee) {
|
||||
this.rentFee = rentFee;
|
||||
}
|
||||
|
||||
public String getFormId() {
|
||||
return formId;
|
||||
}
|
||||
|
||||
public void setFormId(String formId) {
|
||||
this.formId = formId;
|
||||
}
|
||||
|
||||
public String getCover() {
|
||||
return cover;
|
||||
}
|
||||
|
||||
public void setCover(String cover) {
|
||||
this.cover = cover;
|
||||
}
|
||||
|
||||
public RentFeeInfo getFeeInfo() {
|
||||
return feeInfo;
|
||||
}
|
||||
|
||||
public void setFeeInfo(RentFeeInfo feeInfo) {
|
||||
this.feeInfo = feeInfo;
|
||||
}
|
||||
|
||||
public String getFootPrint() {
|
||||
return footPrint;
|
||||
}
|
||||
|
||||
public void setFootPrint(String footPrint) {
|
||||
this.footPrint = footPrint;
|
||||
}
|
||||
}
|
||||
103
src/main/java/org/chenyon/contract/ContractController.java
Normal file
103
src/main/java/org/chenyon/contract/ContractController.java
Normal file
@@ -0,0 +1,103 @@
|
||||
package org.chenyon.contract;
|
||||
|
||||
import org.chenyon.user.LoginCheck;
|
||||
import org.chenyon.user.UserContext;
|
||||
import org.rcy.framework.api.entity.PageResult;
|
||||
import org.rcy.framework.api.entity.ResultMessage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/contract")
|
||||
public class ContractController {
|
||||
private static final Logger log = LoggerFactory.getLogger(ContractController.class);
|
||||
|
||||
@Autowired
|
||||
private ContractService contractService;
|
||||
|
||||
@PostMapping("/queryPage")
|
||||
@LoginCheck
|
||||
public ResultMessage queryContractPage(@RequestBody ContractQueryCondition condition) {
|
||||
try {
|
||||
UserContext userContext = UserContext.get();
|
||||
if(userContext == null || userContext.getCusNo() == null) {
|
||||
return ResultMessage.success(new PageResult());
|
||||
}
|
||||
condition.setCusNo(userContext.getCusNo());
|
||||
PageResult<ContractVo> pageResult = contractService.queryContractPage(condition);
|
||||
return ResultMessage.success(pageResult);
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return ResultMessage.success();
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
@LoginCheck
|
||||
public ResultMessage contractDetail(@RequestParam("contractNo") String contractNo){
|
||||
try {
|
||||
UserContext userContext = UserContext.get();
|
||||
if(userContext == null) {
|
||||
return ResultMessage.success();
|
||||
}
|
||||
return ResultMessage.success(contractService.queryContractDetail(userContext.getCusNo(), contractNo));
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.error("查询合同信息失败");
|
||||
}
|
||||
|
||||
@GetMapping("/countUnsign")
|
||||
@LoginCheck
|
||||
public ResultMessage countUnsign(){
|
||||
try {
|
||||
UserContext userContext = UserContext.get();
|
||||
if(userContext == null || userContext.getCusNo() == null) {
|
||||
return ResultMessage.success(0);
|
||||
}
|
||||
return ResultMessage.success(contractService.countUnsign(userContext.getCusNo()));
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.success(0);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/queryAssets")
|
||||
@LoginCheck
|
||||
public ResultMessage queryAssets(String formId,Integer pageNo,Integer pageSize) throws Exception {
|
||||
return ResultMessage.success(contractService.queryMoreContractAssets(formId,pageNo,pageSize));
|
||||
}
|
||||
|
||||
@GetMapping("/getSignLink")
|
||||
@LoginCheck
|
||||
public ResultMessage getSignLink(@RequestParam("eFlowId") String eFlowId){
|
||||
try {
|
||||
return ResultMessage.success(contractService.getSignLink(eFlowId));
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.error("获取签署链接失败");
|
||||
}
|
||||
|
||||
@GetMapping("/queryAll")
|
||||
@LoginCheck
|
||||
public ResultMessage queryAll(){
|
||||
try {
|
||||
UserContext userContext = UserContext.get();
|
||||
if(userContext == null || userContext.getCusNo() == null) {
|
||||
return ResultMessage.success();
|
||||
}
|
||||
return ResultMessage.success(contractService.queryAll(userContext.getCusNo()));
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.success(new ArrayList<>());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package org.chenyon.contract;
|
||||
|
||||
import org.rcy.framework.api.entity.PageQueryRequest;
|
||||
|
||||
public class ContractQueryCondition extends PageQueryRequest {
|
||||
|
||||
private String cusNo;
|
||||
private String contractNo;
|
||||
private String formmainId;
|
||||
private String signStatus;
|
||||
private String signWay;
|
||||
|
||||
public String getCusNo() {
|
||||
return cusNo;
|
||||
}
|
||||
|
||||
public void setCusNo(String cusNo) {
|
||||
this.cusNo = cusNo;
|
||||
}
|
||||
|
||||
public String getContractNo() {
|
||||
return contractNo;
|
||||
}
|
||||
|
||||
public void setContractNo(String contractNo) {
|
||||
this.contractNo = contractNo;
|
||||
}
|
||||
|
||||
public String getFormmainId() {
|
||||
return formmainId;
|
||||
}
|
||||
|
||||
public void setFormmainId(String formmainId) {
|
||||
this.formmainId = formmainId;
|
||||
}
|
||||
|
||||
public String getSignStatus() {
|
||||
return signStatus;
|
||||
}
|
||||
|
||||
public void setSignStatus(String signStatus) {
|
||||
this.signStatus = signStatus;
|
||||
}
|
||||
|
||||
public String getSignWay() {
|
||||
return signWay;
|
||||
}
|
||||
|
||||
public void setSignWay(String signWay) {
|
||||
this.signWay = signWay;
|
||||
}
|
||||
}
|
||||
149
src/main/java/org/chenyon/contract/ContractService.java
Normal file
149
src/main/java/org/chenyon/contract/ContractService.java
Normal file
@@ -0,0 +1,149 @@
|
||||
package org.chenyon.contract;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.chenyon.assets.vo.AssetsVo;
|
||||
import org.chenyon.file.OaFileHandlerService;
|
||||
import org.chenyon.file.OaFileLocalRefVo;
|
||||
import org.chenyon.file.OaFileVo;
|
||||
import org.chenyon.oa.OaContractService;
|
||||
import org.chenyon.oa.asset.OaAssetsVo;
|
||||
import org.chenyon.oa.contract.OaContractVo;
|
||||
import org.rcy.framework.api.entity.PageResult;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ContractService {
|
||||
|
||||
@Autowired
|
||||
private OaContractService oaContractService;
|
||||
@Autowired
|
||||
private OaFileHandlerService oaFileHandlerService;
|
||||
|
||||
private void hanldeSignStatus(ContractQueryCondition condition) {
|
||||
if (StringUtils.isNotBlank(condition.getSignStatus())) {
|
||||
switch (condition.getSignStatus()){
|
||||
case "all": condition.setSignStatus(null);break;
|
||||
case "pending" : condition.setSignStatus("待签署");break;
|
||||
case "signed" : condition.setSignStatus("已签署");break;
|
||||
case "expired" : condition.setSignStatus("已过期");break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String convertSignStatus(String status) {
|
||||
if (StringUtils.isNotBlank(status)) {
|
||||
switch (status){
|
||||
case "待签署" : return "pending";
|
||||
case "已签署" : return "signed";
|
||||
case "已过期" : return "expired";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public PageResult<ContractVo> queryContractPage(ContractQueryCondition condition) throws Exception {
|
||||
//调用OA接口查询
|
||||
hanldeSignStatus(condition);
|
||||
PageResult<OaContractVo> pageResultOa = oaContractService.pageQueryContract(condition);
|
||||
PageResult<ContractVo> pageResult = new PageResult<>();
|
||||
pageResult.setPageNo(pageResultOa.getPageNo());
|
||||
pageResult.setPageSize(pageResultOa.getPageSize());
|
||||
pageResult.setRecordTotal(pageResultOa.getRecordTotal());
|
||||
List<ContractVo> contractVoList = new ArrayList<>();
|
||||
for (OaContractVo oaContractVo : pageResultOa.getResult()) {
|
||||
ContractVo contractVo = new ContractVo();
|
||||
BeanUtils.copyProperties(oaContractVo, contractVo);
|
||||
if(oaContractVo.getAssetsVos() != null) {
|
||||
List<OaAssetsVo> assetsVos = oaContractVo.getAssetsVos();
|
||||
OaAssetsVo assetsVo = assetsVos.get(0);
|
||||
List<String> assetsDetailImgs = oaFileHandlerService.getUrls(true,assetsVo.getAssetsNo(), assetsVo.getFormId(), "AssetsDetailImg", assetsVo.getDetailImg());
|
||||
if(assetsDetailImgs != null) {
|
||||
contractVo.setCoverImgUrl(assetsDetailImgs.get(0));
|
||||
}
|
||||
}
|
||||
contractVo.setSignStatus(convertSignStatus(contractVo.getSignStatus()));
|
||||
contractVoList.add(contractVo);
|
||||
}
|
||||
pageResult.setResult(contractVoList);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
public List<ContractVo> queryAll(String cusNo) throws Exception {
|
||||
ContractQueryCondition condition = new ContractQueryCondition();
|
||||
condition.setCusNo(cusNo);
|
||||
condition.setSignStatus("已签署");
|
||||
List<ContractVo> contractVos = new ArrayList<>();
|
||||
List<OaContractVo> oaContractVos = oaContractService.queryAll(condition);
|
||||
for (OaContractVo oaContractVo : oaContractVos) {
|
||||
ContractVo contractVo = new ContractVo();
|
||||
BeanUtils.copyProperties(oaContractVo, contractVo);
|
||||
contractVos.add(contractVo);
|
||||
}
|
||||
return contractVos;
|
||||
}
|
||||
|
||||
public ContractAssetsVo queryMoreContractAssets(String formId,Integer pageNo,Integer pageSize) throws Exception {
|
||||
ContractQueryCondition condition = new ContractQueryCondition();
|
||||
condition.setFormmainId(formId);
|
||||
condition.setPageNo(pageNo);
|
||||
condition.setPageSize(pageSize);
|
||||
OaAssetsVo assetsVo = oaContractService.pageQueryContractAssets(condition);
|
||||
List<String> assetsDetailImgs = oaFileHandlerService.getUrls(true,assetsVo.getAssetsNo(), assetsVo.getFormId(), "AssetsDetailImg", assetsVo.getDetailImg());
|
||||
ContractAssetsVo assetsInfo = new ContractAssetsVo();
|
||||
BeanUtils.copyProperties(assetsVo, assetsInfo);
|
||||
RentFeeInfo rentFeeInfo = new RentFeeInfo();
|
||||
if(StringUtils.isNotBlank(assetsVo.getRentFee())){
|
||||
rentFeeInfo.setRentFee(Double.parseDouble(assetsVo.getRentFee()));
|
||||
}
|
||||
assetsInfo.setFeeInfo(rentFeeInfo);
|
||||
if(assetsDetailImgs != null) {
|
||||
assetsInfo.setCover(assetsDetailImgs.get(0));
|
||||
}
|
||||
return assetsInfo;
|
||||
}
|
||||
public Integer countUnsign(String cusNo) throws Exception {
|
||||
Integer count = oaContractService.countUnsign(cusNo);
|
||||
return count;
|
||||
}
|
||||
|
||||
public ContractVo queryContractDetail(String cusNo,String contractNo) throws Exception {
|
||||
ContractQueryCondition condition = new ContractQueryCondition();
|
||||
condition.setContractNo(contractNo);
|
||||
OaContractVo oaContractVo = oaContractService.queryContractDetail(condition);
|
||||
if(!cusNo.equals(oaContractVo.getCusNo())) {
|
||||
return null;
|
||||
}
|
||||
ContractVo contractVo = new ContractVo();
|
||||
BeanUtils.copyProperties(oaContractVo, contractVo);
|
||||
List<OaAssetsVo> assetsVos = oaContractVo.getAssetsVos();
|
||||
OaAssetsVo assetsVo = assetsVos.get(0);
|
||||
List<String> assetsDetailImgs = oaFileHandlerService.getUrls(true,assetsVo.getAssetsNo(), assetsVo.getFormId(), "AssetsDetailImg", assetsVo.getDetailImg());
|
||||
List<String> eContractUrl = oaFileHandlerService.getUrls(false,cusNo,oaContractVo.getContractNo(),oaContractVo.getFormId(),"eContractFile",oaContractVo.geteContractFile());
|
||||
ContractAssetsVo assetsInfo = new ContractAssetsVo();
|
||||
BeanUtils.copyProperties(assetsVo, assetsInfo);
|
||||
RentFeeInfo rentFeeInfo = new RentFeeInfo();
|
||||
if(StringUtils.isNotBlank(assetsVo.getRentFee())){
|
||||
rentFeeInfo.setRentFee(Double.parseDouble(assetsVo.getRentFee()));
|
||||
}
|
||||
assetsInfo.setFeeInfo(rentFeeInfo);
|
||||
if(assetsDetailImgs != null) {
|
||||
assetsInfo.setCover(assetsDetailImgs.get(0));
|
||||
}
|
||||
if(eContractUrl != null) {
|
||||
contractVo.seteContractUrl(eContractUrl.get(0));
|
||||
}
|
||||
List<ContractAssetsVo> assetsInfoList = new ArrayList<>();
|
||||
assetsInfoList.add(assetsInfo);
|
||||
contractVo.setAssetsInfos(assetsInfoList);
|
||||
return contractVo;
|
||||
}
|
||||
public String getSignLink(String eFlowId) throws Exception {
|
||||
String signLink = oaContractService.getSignLink(eFlowId);
|
||||
return signLink;
|
||||
}
|
||||
}
|
||||
107
src/main/java/org/chenyon/contract/ContractVo.java
Normal file
107
src/main/java/org/chenyon/contract/ContractVo.java
Normal file
@@ -0,0 +1,107 @@
|
||||
package org.chenyon.contract;
|
||||
|
||||
import org.chenyon.assets.vo.AssetsVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ContractVo {
|
||||
private String formId; //表单ID
|
||||
private String contractNo; //合同编号
|
||||
private String contractName; //合同名称
|
||||
private String signStatus; //签订状态
|
||||
private String startDate; //开始日期
|
||||
private String endDate; //开始日期
|
||||
private String eContractUrl; //电子合同文件地址
|
||||
private String eContractFlowId; //电子合同签署流程ID
|
||||
private List<ContractAssetsVo> assetsInfos; //资产信息
|
||||
private String coverImgUrl; //封面图片信息
|
||||
private String cusNo; //客商编码
|
||||
|
||||
public String getContractNo() {
|
||||
return contractNo;
|
||||
}
|
||||
|
||||
public void setContractNo(String contractNo) {
|
||||
this.contractNo = contractNo;
|
||||
}
|
||||
|
||||
public String getContractName() {
|
||||
return contractName;
|
||||
}
|
||||
|
||||
public void setContractName(String contractName) {
|
||||
this.contractName = contractName;
|
||||
}
|
||||
|
||||
public String getSignStatus() {
|
||||
return signStatus;
|
||||
}
|
||||
|
||||
public void setSignStatus(String signStatus) {
|
||||
this.signStatus = signStatus;
|
||||
}
|
||||
|
||||
public List<ContractAssetsVo> getAssetsInfos() {
|
||||
return assetsInfos;
|
||||
}
|
||||
|
||||
public void setAssetsInfos(List<ContractAssetsVo> assetsInfos) {
|
||||
this.assetsInfos = assetsInfos;
|
||||
}
|
||||
|
||||
public String geteContractUrl() {
|
||||
return eContractUrl;
|
||||
}
|
||||
|
||||
public void seteContractUrl(String eContractUrl) {
|
||||
this.eContractUrl = eContractUrl;
|
||||
}
|
||||
|
||||
public String getCusNo() {
|
||||
return cusNo;
|
||||
}
|
||||
|
||||
public void setCusNo(String cusNo) {
|
||||
this.cusNo = cusNo;
|
||||
}
|
||||
|
||||
public String geteContractFlowId() {
|
||||
return eContractFlowId;
|
||||
}
|
||||
|
||||
public void seteContractFlowId(String eContractFlowId) {
|
||||
this.eContractFlowId = eContractFlowId;
|
||||
}
|
||||
|
||||
public String getCoverImgUrl() {
|
||||
return coverImgUrl;
|
||||
}
|
||||
|
||||
public void setCoverImgUrl(String coverImgUrl) {
|
||||
this.coverImgUrl = coverImgUrl;
|
||||
}
|
||||
|
||||
public String getFormId() {
|
||||
return formId;
|
||||
}
|
||||
|
||||
public void setFormId(String formId) {
|
||||
this.formId = formId;
|
||||
}
|
||||
|
||||
public String getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(String startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public String getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(String endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
}
|
||||
6
src/main/java/org/chenyon/contract/FeeUnit.java
Normal file
6
src/main/java/org/chenyon/contract/FeeUnit.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package org.chenyon.contract;
|
||||
|
||||
public enum FeeUnit {
|
||||
KWT, //度
|
||||
TON //吨
|
||||
}
|
||||
59
src/main/java/org/chenyon/contract/RentFeeInfo.java
Normal file
59
src/main/java/org/chenyon/contract/RentFeeInfo.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package org.chenyon.contract;
|
||||
|
||||
public class RentFeeInfo {
|
||||
|
||||
private Double deposit; //押金
|
||||
private Double rentFee; //租金
|
||||
private Double waterFee; //水费
|
||||
private FeeUnit waterFeeUnit; //水费单位
|
||||
private Double powerFee; //电费
|
||||
private FeeUnit powerFeeUnit; //电费单位
|
||||
|
||||
public Double getDeposit() {
|
||||
return deposit;
|
||||
}
|
||||
|
||||
public void setDeposit(Double deposit) {
|
||||
this.deposit = deposit;
|
||||
}
|
||||
|
||||
public Double getRentFee() {
|
||||
return rentFee;
|
||||
}
|
||||
|
||||
public void setRentFee(Double rentFee) {
|
||||
this.rentFee = rentFee;
|
||||
}
|
||||
|
||||
public Double getWaterFee() {
|
||||
return waterFee;
|
||||
}
|
||||
|
||||
public void setWaterFee(Double waterFee) {
|
||||
this.waterFee = waterFee;
|
||||
}
|
||||
|
||||
public FeeUnit getWaterFeeUnit() {
|
||||
return waterFeeUnit;
|
||||
}
|
||||
|
||||
public void setWaterFeeUnit(FeeUnit waterFeeUnit) {
|
||||
this.waterFeeUnit = waterFeeUnit;
|
||||
}
|
||||
|
||||
public Double getPowerFee() {
|
||||
return powerFee;
|
||||
}
|
||||
|
||||
public void setPowerFee(Double powerFee) {
|
||||
this.powerFee = powerFee;
|
||||
}
|
||||
|
||||
public FeeUnit getPowerFeeUnit() {
|
||||
return powerFeeUnit;
|
||||
}
|
||||
|
||||
public void setPowerFeeUnit(FeeUnit powerFeeUnit) {
|
||||
this.powerFeeUnit = powerFeeUnit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.chenyon.discharge;
|
||||
|
||||
import org.rcy.framework.api.entity.PageQueryRequest;
|
||||
|
||||
public class DisChargeApplyQueryCondition extends PageQueryRequest {
|
||||
private String cusNo;
|
||||
|
||||
public String getCusNo() {
|
||||
return cusNo;
|
||||
}
|
||||
|
||||
public void setCusNo(String cusNo) {
|
||||
this.cusNo = cusNo;
|
||||
}
|
||||
}
|
||||
87
src/main/java/org/chenyon/discharge/DisChargeApplyVo.java
Normal file
87
src/main/java/org/chenyon/discharge/DisChargeApplyVo.java
Normal file
@@ -0,0 +1,87 @@
|
||||
package org.chenyon.discharge;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DisChargeApplyVo {
|
||||
private String contractNo;
|
||||
private String contractName;
|
||||
private List<String> assetsNoList;
|
||||
private String reason;
|
||||
private String dischargeDate;
|
||||
private String cusNo;
|
||||
private String cusName;
|
||||
private String cusType;
|
||||
private String phone;
|
||||
|
||||
public String getContractNo() {
|
||||
return contractNo;
|
||||
}
|
||||
|
||||
public void setContractNo(String contractNo) {
|
||||
this.contractNo = contractNo;
|
||||
}
|
||||
|
||||
public List<String> getAssetsNoList() {
|
||||
return assetsNoList;
|
||||
}
|
||||
|
||||
public void setAssetsNoList(List<String> assetsNoList) {
|
||||
this.assetsNoList = assetsNoList;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public String getDischargeDate() {
|
||||
return dischargeDate;
|
||||
}
|
||||
|
||||
public void setDischargeDate(String dischargeDate) {
|
||||
this.dischargeDate = dischargeDate;
|
||||
}
|
||||
|
||||
public String getCusNo() {
|
||||
return cusNo;
|
||||
}
|
||||
|
||||
public void setCusNo(String cusNo) {
|
||||
this.cusNo = cusNo;
|
||||
}
|
||||
|
||||
public String getContractName() {
|
||||
return contractName;
|
||||
}
|
||||
|
||||
public void setContractName(String contractName) {
|
||||
this.contractName = contractName;
|
||||
}
|
||||
|
||||
public String getCusName() {
|
||||
return cusName;
|
||||
}
|
||||
|
||||
public void setCusName(String cusName) {
|
||||
this.cusName = cusName;
|
||||
}
|
||||
|
||||
public String getCusType() {
|
||||
return cusType;
|
||||
}
|
||||
|
||||
public void setCusType(String cusType) {
|
||||
this.cusType = cusType;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
}
|
||||
60
src/main/java/org/chenyon/discharge/DisChargeController.java
Normal file
60
src/main/java/org/chenyon/discharge/DisChargeController.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package org.chenyon.discharge;
|
||||
|
||||
import org.chenyon.oa.OaDisChargeService;
|
||||
import org.chenyon.user.LoginCheck;
|
||||
import org.chenyon.user.UserContext;
|
||||
import org.rcy.framework.api.entity.PageResult;
|
||||
import org.rcy.framework.api.entity.ResultMessage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/discharge")
|
||||
public class DisChargeController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(DisChargeController.class);
|
||||
|
||||
@Autowired
|
||||
private OaDisChargeService oaDisChargeService;
|
||||
|
||||
@PostMapping("/queryPage")
|
||||
@LoginCheck
|
||||
public ResultMessage queryPage(@RequestBody DisChargeApplyQueryCondition condition) {
|
||||
try {
|
||||
UserContext userContext = UserContext.get();
|
||||
if(userContext == null || userContext.getCusNo() == null) {
|
||||
return ResultMessage.success(new PageResult());
|
||||
}
|
||||
condition.setCusNo(userContext.getCusNo());
|
||||
return ResultMessage.success(oaDisChargeService.pageQueryApplyRecord(condition));
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.success(new PageResult());
|
||||
}
|
||||
|
||||
@PostMapping("/apply")
|
||||
@LoginCheck
|
||||
public ResultMessage apply(@RequestBody DisChargeApplyVo applyVo) throws Exception {
|
||||
try {
|
||||
UserContext userContext = UserContext.get();
|
||||
if(userContext == null || userContext.getCusNo() == null) {
|
||||
return ResultMessage.success("您还未实名");
|
||||
}
|
||||
applyVo.setCusNo(userContext.getCusNo());
|
||||
applyVo.setCusName(userContext.getUsername());
|
||||
applyVo.setPhone(userContext.getPhone());
|
||||
applyVo.setCusType(userContext.getUserType().equals("0") ? "个人" : "单位");
|
||||
oaDisChargeService.apply(applyVo);
|
||||
return ResultMessage.success();
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.error("申请失败");
|
||||
}
|
||||
}
|
||||
58
src/main/java/org/chenyon/discharge/DisChargeRecordVo.java
Normal file
58
src/main/java/org/chenyon/discharge/DisChargeRecordVo.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package org.chenyon.discharge;
|
||||
|
||||
public class DisChargeRecordVo {
|
||||
private String contractName;
|
||||
private String dischargeItem;
|
||||
private String id;
|
||||
private String status;
|
||||
private String applyDate;
|
||||
private String remark;
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getApplyDate() {
|
||||
return applyDate;
|
||||
}
|
||||
|
||||
public void setApplyDate(String applyDate) {
|
||||
this.applyDate = applyDate;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getContractName() {
|
||||
return contractName;
|
||||
}
|
||||
|
||||
public void setContractName(String contractName) {
|
||||
this.contractName = contractName;
|
||||
}
|
||||
|
||||
public String getDischargeItem() {
|
||||
return dischargeItem;
|
||||
}
|
||||
|
||||
public void setDischargeItem(String dischargeItem) {
|
||||
this.dischargeItem = dischargeItem;
|
||||
}
|
||||
}
|
||||
73
src/main/java/org/chenyon/fallback/FallbackController.java
Normal file
73
src/main/java/org/chenyon/fallback/FallbackController.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package org.chenyon.fallback;
|
||||
|
||||
import org.chenyon.discharge.DisChargeApplyQueryCondition;
|
||||
import org.chenyon.discharge.DisChargeApplyVo;
|
||||
import org.chenyon.oa.OaFallBackService;
|
||||
import org.chenyon.user.LoginCheck;
|
||||
import org.chenyon.user.UserContext;
|
||||
import org.rcy.framework.api.entity.PageResult;
|
||||
import org.rcy.framework.api.entity.ResultMessage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/fallback")
|
||||
public class FallbackController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(FallbackController.class);
|
||||
@Autowired
|
||||
private OaFallBackService fallbackServcie;
|
||||
|
||||
@PostMapping("/queryPage")
|
||||
@LoginCheck
|
||||
public ResultMessage queryPage(@RequestBody FallbackQueryCondition condition) {
|
||||
try {
|
||||
UserContext userContext = UserContext.get();
|
||||
if(userContext == null || userContext.getCusNo() == null) {
|
||||
return ResultMessage.success(new PageResult());
|
||||
}
|
||||
condition.setCusNo(userContext.getCusNo());
|
||||
return ResultMessage.success(fallbackServcie.pageQuery(condition));
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.success(new PageResult());
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
@LoginCheck
|
||||
public ResultMessage detail(@RequestParam("id") String id) {
|
||||
try {
|
||||
UserContext userContext = UserContext.get();
|
||||
if(userContext == null ) {
|
||||
return ResultMessage.success();
|
||||
}
|
||||
return ResultMessage.success(fallbackServcie.detail(id));
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.error("查询留言详情失败");
|
||||
}
|
||||
|
||||
@PostMapping("/submit")
|
||||
@LoginCheck
|
||||
public ResultMessage submit(@RequestBody FallbackSubmitVo submitVo) {
|
||||
try {
|
||||
UserContext userContext = UserContext.get();
|
||||
if(userContext == null || userContext.getCusNo() == null) {
|
||||
return ResultMessage.success("您还未实名");
|
||||
}
|
||||
submitVo.setCusNo(userContext.getCusNo());
|
||||
submitVo.setTenantType(userContext.getUserType().equals("0") ? "个人" : "单位");
|
||||
submitVo.setTenantName(userContext.getUsername());
|
||||
submitVo.setTenantPhone(userContext.getPhone());
|
||||
fallbackServcie.submit(submitVo);
|
||||
return ResultMessage.success();
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return ResultMessage.error("提交失败");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.chenyon.fallback;
|
||||
|
||||
import org.rcy.framework.api.entity.PageQueryRequest;
|
||||
|
||||
public class FallbackQueryCondition extends PageQueryRequest {
|
||||
private String cusNo;
|
||||
private String id;
|
||||
|
||||
public String getCusNo() {
|
||||
return cusNo;
|
||||
}
|
||||
|
||||
public void setCusNo(String cusNo) {
|
||||
this.cusNo = cusNo;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
67
src/main/java/org/chenyon/fallback/FallbackSubmitVo.java
Normal file
67
src/main/java/org/chenyon/fallback/FallbackSubmitVo.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package org.chenyon.fallback;
|
||||
|
||||
public class FallbackSubmitVo {
|
||||
private String cusNo;
|
||||
private String content;
|
||||
private String status;
|
||||
private String comment;
|
||||
private String tenantName;
|
||||
private String tenantType;
|
||||
private String tenantPhone;
|
||||
|
||||
public String getCusNo() {
|
||||
return cusNo;
|
||||
}
|
||||
|
||||
public void setCusNo(String cusNo) {
|
||||
this.cusNo = cusNo;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public String getTenantName() {
|
||||
return tenantName;
|
||||
}
|
||||
|
||||
public void setTenantName(String tenantName) {
|
||||
this.tenantName = tenantName;
|
||||
}
|
||||
|
||||
public String getTenantType() {
|
||||
return tenantType;
|
||||
}
|
||||
|
||||
public void setTenantType(String tenantType) {
|
||||
this.tenantType = tenantType;
|
||||
}
|
||||
|
||||
public String getTenantPhone() {
|
||||
return tenantPhone;
|
||||
}
|
||||
|
||||
public void setTenantPhone(String tenantPhone) {
|
||||
this.tenantPhone = tenantPhone;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user