first blood
This commit is contained in:
26
.gitignore
vendored
Executable file
26
.gitignore
vendored
Executable file
@@ -0,0 +1,26 @@
|
||||
# Common
|
||||
.DS_Store
|
||||
classes/
|
||||
*/bin
|
||||
*/build
|
||||
*/target
|
||||
*buildSrc/build
|
||||
|
||||
# Spring
|
||||
/spring-*/build
|
||||
spring-test/test-output/
|
||||
|
||||
# Eclipse artifacts, including WTP generated manifests
|
||||
.classpath
|
||||
.project
|
||||
spring-*/src/main/java/META-INF/MANIFEST.MF
|
||||
|
||||
# IDEA artifacts and output dirs
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea
|
||||
out
|
||||
test-output
|
||||
atlassian-ide-plugin.xml
|
||||
.gradletasknamecache
|
||||
4
Dockerfile
Normal file
4
Dockerfile
Normal file
@@ -0,0 +1,4 @@
|
||||
FROM registry.cn-hangzhou.aliyuncs.com/xhzy/tomcat8:0.0.10
|
||||
|
||||
COPY entity-manage-web/target/entity-manage.war /home/admin/tomcat/webapps/ROOT.war
|
||||
CMD ["tomcat/bin/catalina.sh", "run"]
|
||||
2
README.md
Executable file
2
README.md
Executable file
@@ -0,0 +1,2 @@
|
||||
### 子模块及功能点
|
||||
1. search-proxy-es ElasticSearch查询封装
|
||||
21
entity-manage-api/pom.xml
Executable file
21
entity-manage-api/pom.xml
Executable file
@@ -0,0 +1,21 @@
|
||||
<?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>
|
||||
|
||||
<parent>
|
||||
<groupId>com.shuwen.data</groupId>
|
||||
<artifactId>entity-manage</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>entity-manage-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.shuwen.data.entity.manage.api.entity.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>文件名称:AbstractRequest.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2017-06-14</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public abstract class AbstractRequest extends Model implements Serializable {
|
||||
|
||||
private String requestId;
|
||||
|
||||
public String getRequestId() {
|
||||
return requestId;
|
||||
}
|
||||
|
||||
public void setRequestId(String requestId) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.shuwen.data.entity.manage.api.entity.base;
|
||||
|
||||
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>文件名称:Model.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-09-19</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public abstract class Model implements Serializable {
|
||||
@Override
|
||||
public String toString() {
|
||||
// return ReflectionToStringBuilder.toString(this);
|
||||
return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.shuwen.data.entity.manage.api.entity.base;
|
||||
|
||||
import com.shuwen.data.entity.manage.api.entity.enums.ReturnCodeEnum;
|
||||
|
||||
/**
|
||||
* <p>文件名称:RespDto.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-09-19</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class RespDto<T> extends Model {
|
||||
|
||||
private String requestId;
|
||||
private Boolean success;
|
||||
private Integer code;
|
||||
private String msg;
|
||||
private T data;
|
||||
|
||||
public RespDto() {
|
||||
this.success = false;
|
||||
}
|
||||
|
||||
public RespDto(T data) {
|
||||
this.success = true;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public RespDto(String requestId, ReturnCodeEnum returnCode, T data) {
|
||||
setRequestId(requestId);
|
||||
setSuccess(returnCode == ReturnCodeEnum.OK);
|
||||
setCode(returnCode.getId());
|
||||
setMsg(returnCode.getMsg());
|
||||
setData(data);
|
||||
}
|
||||
|
||||
public RespDto(Boolean success, Integer code, String msg, T data) {
|
||||
this.success = success;
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getRequestId() {
|
||||
return requestId;
|
||||
}
|
||||
|
||||
public void setRequestId(String requestId) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
|
||||
public Boolean getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(Boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static <T> RespDto<T> succeed(String requestId) {
|
||||
return new RespDto<>(requestId, ReturnCodeEnum.OK, null);
|
||||
}
|
||||
|
||||
public static <T> RespDto<T> succeed(String requestId, T data) {
|
||||
return new RespDto<>(requestId, ReturnCodeEnum.OK, data);
|
||||
}
|
||||
|
||||
public static <T> RespDto<T> fail(String requestId, ReturnCodeEnum returnCode, T data) {
|
||||
return new RespDto<>(requestId, returnCode, data);
|
||||
}
|
||||
|
||||
public static <T> RespDto<T> fail(String requestId, ReturnCodeEnum returnCode) {
|
||||
return new RespDto<>(requestId, returnCode, null);
|
||||
}
|
||||
|
||||
public static <T> RespDto<T> fail(ReturnCodeEnum returnCode) {
|
||||
return new RespDto<>(null, returnCode, null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.shuwen.data.entity.manage.api.entity.enums;
|
||||
|
||||
/**
|
||||
* <p>文件名称:AmbiguousStatusEnum.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-24</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public enum AmbiguousStatusEnum {
|
||||
MATCH(1, "match"),
|
||||
CONFIRM(2, "confirm"),
|
||||
REGISTER(3, "register");
|
||||
|
||||
private final int id;
|
||||
private final String msg;
|
||||
|
||||
AmbiguousStatusEnum(int id, String msg) {
|
||||
this.id = id;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static AmbiguousStatusEnum getById(int id) {
|
||||
for (AmbiguousStatusEnum e : values()) {
|
||||
if (e.getId() == id) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static AmbiguousStatusEnum getByMsg(String msg) {
|
||||
for (AmbiguousStatusEnum e : values()) {
|
||||
if (e.getMsg().equals(msg)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.shuwen.data.entity.manage.api.entity.enums;
|
||||
|
||||
/**
|
||||
* <p>文件名称:ReturnCodeEnum.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2017-06-14</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public enum ReturnCodeEnum {
|
||||
/**
|
||||
* 返回值类型
|
||||
*/
|
||||
OK(200, "ok"),
|
||||
|
||||
EMPTY(2000, "empty"),
|
||||
ERROR(1000, "error"),
|
||||
PARAM_INVALID(1001, "param_invalid"),
|
||||
TIMEOUT(1002, "timeout"),
|
||||
RESOLVE_EXCEL(2001, "resolve_excel"),
|
||||
DB_ERROR(2002, "db_error");
|
||||
|
||||
private final int id;
|
||||
private final String msg;
|
||||
|
||||
ReturnCodeEnum(int id, String msg) {
|
||||
this.id = id;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static ReturnCodeEnum getById(int id) {
|
||||
for (ReturnCodeEnum e : values()) {
|
||||
if (e.getId() == id) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.shuwen.data.entity.manage.api.entity.enums;
|
||||
|
||||
/**
|
||||
* <p>文件名称:AmbiguousStatusEnum.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-24</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public enum SearchModeEnum {
|
||||
MATCH(1, "match"),
|
||||
FUZZY(2, "fuzzy"),
|
||||
PREFIX(3, "prefix");
|
||||
|
||||
private final int id;
|
||||
private final String msg;
|
||||
|
||||
SearchModeEnum(int id, String msg) {
|
||||
this.id = id;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static SearchModeEnum getById(int id) {
|
||||
for (SearchModeEnum e : values()) {
|
||||
if (e.getId() == id) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static SearchModeEnum getByMsg(String msg) {
|
||||
for (SearchModeEnum e : values()) {
|
||||
if (e.getMsg().equals(msg)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.shuwen.data.entity.manage.api.entity.exception;
|
||||
|
||||
|
||||
import com.shuwen.data.entity.manage.api.entity.enums.ReturnCodeEnum;
|
||||
|
||||
/**
|
||||
* <p>文件名称:EntityServiceException.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-18</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class EntityServiceException extends Exception {
|
||||
private ReturnCodeEnum code;
|
||||
|
||||
public EntityServiceException() {
|
||||
super(ReturnCodeEnum.ERROR.getMsg());
|
||||
this.setCode(ReturnCodeEnum.ERROR);
|
||||
}
|
||||
|
||||
public EntityServiceException(ReturnCodeEnum code) {
|
||||
super(code.getMsg());
|
||||
this.setCode(code);
|
||||
}
|
||||
|
||||
public ReturnCodeEnum getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(ReturnCodeEnum code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
84
entity-manage-common/pom.xml
Executable file
84
entity-manage-common/pom.xml
Executable file
@@ -0,0 +1,84 @@
|
||||
<?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>
|
||||
|
||||
<parent>
|
||||
<groupId>com.shuwen.data</groupId>
|
||||
<artifactId>entity-manage</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>entity-manage-common</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- log start -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>log4j-over-slf4j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-to-slf4j</artifactId>
|
||||
</dependency>
|
||||
<!-- log end -->
|
||||
|
||||
<!-- commons start -->
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
<!-- commons end -->
|
||||
|
||||
<!-- tools start -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
<!-- tools ends -->
|
||||
|
||||
<!-- test start -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<!-- test end -->
|
||||
|
||||
<!-- json start -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
<!-- json end -->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.shuwen.data.entity.manage.common.utils;
|
||||
|
||||
import org.apache.http.Consts;
|
||||
import org.apache.http.HttpEntityEnclosingRequest;
|
||||
import org.apache.http.HttpRequest;
|
||||
import org.apache.http.NoHttpResponseException;
|
||||
import org.apache.http.client.HttpRequestRetryHandler;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.config.ConnectionConfig;
|
||||
import org.apache.http.config.Registry;
|
||||
import org.apache.http.config.RegistryBuilder;
|
||||
import org.apache.http.conn.socket.ConnectionSocketFactory;
|
||||
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
|
||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||
import org.apache.http.impl.client.*;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
|
||||
import javax.net.ssl.*;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.CodingErrorAction;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
/**
|
||||
* <p>文件名称:HttpClientFactory.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-22</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class HttpClientFactory {
|
||||
|
||||
private static CloseableHttpClient httpClient = null;
|
||||
|
||||
private static PoolingHttpClientConnectionManager httpClientConnectionManager = null;
|
||||
private static RequestConfig defaultRequestConfig = null;
|
||||
private static SSLConnectionSocketFactory sslSocketFactory = null;
|
||||
|
||||
private final static int MAX_TOTAL = 600; // 设置连接池最大数量
|
||||
private final static int MAX_ROUTE_TOTAL = 300; // 设置单个路由最大的连接线程数量
|
||||
private final static int TIMEOUT_CONNECTION = 300;
|
||||
private final static int TIMEOUT_SOCKET = 700;
|
||||
|
||||
private final static int TIMEOUT_CONNECTION_REQUEST = 100;
|
||||
private final static int MAX_RETRY = 0;
|
||||
private final static String PROTOCOL_SSL = "TLS";
|
||||
|
||||
public static CloseableHttpClient getHttpClient() {
|
||||
return httpClient;
|
||||
}
|
||||
|
||||
static {
|
||||
initSSL();
|
||||
initConnectionManager();
|
||||
// 初始化httpclient客户端
|
||||
HttpClientBuilder httpClientBuilder = HttpClients.custom();
|
||||
httpClientBuilder.setConnectionManager(httpClientConnectionManager);
|
||||
httpClientBuilder.setDefaultRequestConfig(defaultRequestConfig);
|
||||
httpClientBuilder.setSSLSocketFactory(sslSocketFactory);
|
||||
httpClientBuilder.setRedirectStrategy(new LaxRedirectStrategy());
|
||||
httpClientBuilder.setRetryHandler(new DefaultHttpRequestRetryHandler(MAX_RETRY, false));
|
||||
|
||||
httpClient = httpClientBuilder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭客户端
|
||||
*/
|
||||
public static void destroy() {
|
||||
try {
|
||||
httpClient.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化连接管理
|
||||
*/
|
||||
private static void initConnectionManager() {
|
||||
// Connection配置
|
||||
ConnectionConfig connectionConfig = ConnectionConfig.custom()
|
||||
.setMalformedInputAction(CodingErrorAction.IGNORE)
|
||||
.setUnmappableInputAction(CodingErrorAction.IGNORE)
|
||||
.setCharset(Consts.UTF_8)
|
||||
.build();
|
||||
// 默认请求配置
|
||||
defaultRequestConfig = RequestConfig.custom()
|
||||
.setSocketTimeout(TIMEOUT_SOCKET)
|
||||
.setConnectTimeout(TIMEOUT_CONNECTION)
|
||||
.setConnectionRequestTimeout(TIMEOUT_CONNECTION_REQUEST)
|
||||
.build();
|
||||
|
||||
Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("http", PlainConnectionSocketFactory.getSocketFactory())
|
||||
.register("https", sslSocketFactory)
|
||||
.build();
|
||||
// 创建httpclient连接池
|
||||
httpClientConnectionManager = new PoolingHttpClientConnectionManager(registry);
|
||||
httpClientConnectionManager.setMaxTotal(MAX_TOTAL);
|
||||
httpClientConnectionManager.setDefaultMaxPerRoute(MAX_ROUTE_TOTAL);
|
||||
httpClientConnectionManager.setDefaultConnectionConfig(connectionConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化SSL
|
||||
*/
|
||||
private static void initSSL() {
|
||||
TrustManager[] trustManagers = new TrustManager[1];
|
||||
//覆盖证书检测过程(用以非CA的https链接)
|
||||
trustManagers[0] = new X509TrustManager() {
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
SSLContext sslContext = SSLContext.getInstance(PROTOCOL_SSL);
|
||||
sslContext.init(new KeyManager[0], trustManagers, new SecureRandom());
|
||||
sslSocketFactory = new SSLConnectionSocketFactory(sslContext);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化重试策略
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static HttpRequestRetryHandler initRetryHandler() {
|
||||
return new HttpRequestRetryHandler() {
|
||||
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
|
||||
if (executionCount >= MAX_RETRY) {
|
||||
return false;
|
||||
}
|
||||
if (exception instanceof NoHttpResponseException) {
|
||||
return true;
|
||||
}
|
||||
if (exception instanceof SSLHandshakeException) {
|
||||
return false;
|
||||
}
|
||||
HttpRequest request = (HttpRequest) context.getAttribute("http.request");
|
||||
return !(request instanceof HttpEntityEnclosingRequest);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.shuwen.data.entity.manage.common.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.base.Throwables;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.http.client.CookieStore;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
import org.apache.http.client.protocol.HttpClientContext;
|
||||
import org.apache.http.impl.client.BasicCookieStore;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>文件名称:HttpClientUtils.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-22</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class HttpClientUtils {
|
||||
private static final Logger logger = LoggerFactory.getLogger(HttpClientUtils.class);
|
||||
|
||||
private static CloseableHttpClient httpClient = HttpClientFactory.getHttpClient();
|
||||
private static HttpClientContext httpClientContext = null;
|
||||
|
||||
static {
|
||||
/* 默认cookie */
|
||||
CookieStore cookieStore = new BasicCookieStore();
|
||||
|
||||
/* httpclient上下文 */
|
||||
httpClientContext = HttpClientContext.create();
|
||||
httpClientContext.setCookieStore(cookieStore);
|
||||
}
|
||||
|
||||
public static InputStream postStream(String url, HttpEntity entity, Map<String, String> headers) throws IOException {
|
||||
HttpEntity httpEntity = post(url, entity, headers);
|
||||
try {
|
||||
if (null != httpEntity)
|
||||
return httpEntity.getContent();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String postPlain(String url, HttpEntity entity, Map<String, String> headers) throws IOException {
|
||||
HttpEntity httpEntity = post(url, entity, headers);
|
||||
return handleHttpEntity(httpEntity);
|
||||
}
|
||||
|
||||
public static String getPlain(String url, Map<String, Object> params, Map<String, String> headers) throws IOException {
|
||||
HttpEntity httpEntity = get(url, params, headers);
|
||||
return handleHttpEntity(httpEntity);
|
||||
}
|
||||
|
||||
|
||||
public static HttpEntity post(String url, HttpEntity entity, Map<String, String> headers) throws IOException {
|
||||
CloseableHttpResponse response = null;
|
||||
HttpPost post = new HttpPost(url);
|
||||
post.setEntity(entity);
|
||||
handleHeader(post, headers);
|
||||
long start = System.currentTimeMillis();
|
||||
response = httpClient.execute(post, httpClientContext);
|
||||
long end = System.currentTimeMillis();
|
||||
logger.info("http|post|{}|{}ms", url, end - start);
|
||||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
if (statusCode != HttpStatus.SC_OK) {
|
||||
logger.error("http|post|{}|{}", url, statusCode);
|
||||
}
|
||||
return response.getEntity();
|
||||
}
|
||||
|
||||
public static HttpEntity get(String url, Map<String, Object> params, Map<String, String> headers) throws IOException {
|
||||
CloseableHttpResponse response = null;
|
||||
HttpGet get = new HttpGet(UrlUtils.handleURL(url, params));
|
||||
handleHeader(get, headers);
|
||||
long start = System.currentTimeMillis();
|
||||
response = httpClient.execute(get, httpClientContext);
|
||||
long end = System.currentTimeMillis();
|
||||
logger.info("http|get|{}|{}ms", get.getURI().toString(), end - start);
|
||||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
if (statusCode != HttpStatus.SC_OK) {
|
||||
logger.error("http|get|{}|{}", url, statusCode);
|
||||
}
|
||||
return response.getEntity();
|
||||
}
|
||||
|
||||
private static void release(HttpEntity httpEntity) {
|
||||
try {
|
||||
if (httpEntity != null) {
|
||||
EntityUtils.consume(httpEntity);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("http|releaseEntity|{}", Throwables.getStackTraceAsString(e));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理Header
|
||||
*
|
||||
* @param entity
|
||||
* @param headers
|
||||
*/
|
||||
private static void handleHeader(HttpRequestBase entity, Map<String, String> headers) {
|
||||
if (headers == null) {
|
||||
return;
|
||||
}
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
entity.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理HttpEntity
|
||||
*
|
||||
* @param httpEntity
|
||||
* @return
|
||||
*/
|
||||
private static String handleHttpEntity(HttpEntity httpEntity) {
|
||||
try {
|
||||
if (null != httpEntity)
|
||||
return EntityUtils.toString(httpEntity);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
release(httpEntity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.shuwen.data.entity.manage.common.utils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* <p>文件名称:IDUtils.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-26</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class IDUtils {
|
||||
public static String getUUID() {
|
||||
return UUID.randomUUID().toString().replaceAll("-", "");
|
||||
}
|
||||
|
||||
public static String generateReqId(Long uid) {
|
||||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
|
||||
return uid + "-" + dtf.format(LocalDateTime.now());
|
||||
}
|
||||
|
||||
public static String generateReqId(String type) {
|
||||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
|
||||
return type + "-" + dtf.format(LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.shuwen.data.entity.manage.common.utils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* <p>文件名称:UrlUtils.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-22</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class UrlUtils {
|
||||
private static final Logger logger = LoggerFactory.getLogger(UrlUtils.class);
|
||||
|
||||
private static final Pattern IP_ADDRESS = Pattern.compile(
|
||||
"^(([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.){3}([01]?\\d\\d?|2[0-4]\\d|25[0-5])$");
|
||||
|
||||
private static final Pattern DOMAIN_WITH_PATH = Pattern.compile("(?<=//).*(?=/)");
|
||||
private static final Pattern DOMAIN_NO_PATH = Pattern.compile("(?<=//).*");
|
||||
|
||||
/**
|
||||
* 检查IP地址是否合法
|
||||
*
|
||||
* @param ip
|
||||
* @return
|
||||
*/
|
||||
public static boolean checkValid(String ip) {
|
||||
return IP_ADDRESS.matcher(ip).matches();
|
||||
}
|
||||
|
||||
/**
|
||||
* 抽取域名
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
public static String extractHost(String url) {
|
||||
Integer len = url.split("/").length;
|
||||
Matcher matcher;
|
||||
System.out.println(len);
|
||||
if (len < 3) {
|
||||
logger.error("URL[{}] is invalid!", url);
|
||||
return null;
|
||||
} else if (len > 3) {
|
||||
matcher = DOMAIN_WITH_PATH.matcher(url);
|
||||
if (matcher.find())
|
||||
return matcher.group(0);
|
||||
}
|
||||
matcher = DOMAIN_NO_PATH.matcher(url);
|
||||
if (matcher.find())
|
||||
return matcher.group(0);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String handleURL(String baseUrl, Map<String, Object> params) {
|
||||
if (params == null) {
|
||||
return baseUrl;
|
||||
}
|
||||
logger.debug(params.toString());
|
||||
StringBuilder url = new StringBuilder(baseUrl);
|
||||
if (url.indexOf("?") < 0)
|
||||
url.append('?');
|
||||
|
||||
for (String name : params.keySet()) {
|
||||
url.append('&');
|
||||
url.append(name);
|
||||
url.append('=');
|
||||
url.append(String.valueOf(params.get(name)));
|
||||
}
|
||||
return url.toString().replace("?&", "?");
|
||||
}
|
||||
}
|
||||
BIN
entity-manage-dao/generator/mybatis-generator-core-1.3.5.jar
Normal file
BIN
entity-manage-dao/generator/mybatis-generator-core-1.3.5.jar
Normal file
Binary file not shown.
52
entity-manage-dao/generator/mybatis-generator-db.xml
Normal file
52
entity-manage-dao/generator/mybatis-generator-db.xml
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE generatorConfiguration
|
||||
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
|
||||
|
||||
<generatorConfiguration>
|
||||
<classPathEntry
|
||||
location="generator/mysql-connector-java-5.1.36.jar"/>
|
||||
|
||||
<context id="MySQLTables" targetRuntime="MyBatis3">
|
||||
|
||||
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
|
||||
|
||||
connectionURL="jdbc:mysql://rm-bp1i4352736pw1x0oo.mysql.rds.aliyuncs.com:3306/media_influence"
|
||||
userId="root" password="Rds_xhzy123" />
|
||||
|
||||
<javaTypeResolver>
|
||||
<property name="forceBigDecimals" value="false"/>
|
||||
</javaTypeResolver>
|
||||
|
||||
<plugin type="org.mybatis.generator.plugins.RowBoundsPlugin"/>
|
||||
|
||||
<javaModelGenerator targetPackage="com.shuwen.data.entity.manage.dao.model"
|
||||
targetProject="src/main/java">
|
||||
<property name="enableSubPackages" value="true"/>
|
||||
<property name="trimStrings" value="true"/>
|
||||
</javaModelGenerator>
|
||||
|
||||
<sqlMapGenerator targetPackage="mapper"
|
||||
targetProject="src/main/resources">
|
||||
<property name="enableSubPackages" value="true"/>
|
||||
</sqlMapGenerator>
|
||||
|
||||
<javaClientGenerator type="XMLMAPPER"
|
||||
targetPackage="com.shuwen.data.entity.manage.dao.mapper"
|
||||
targetProject="src/main/java">
|
||||
<property name="enableSubPackages" value="true"/>
|
||||
</javaClientGenerator>
|
||||
|
||||
<table tableName="tbl_media_category">
|
||||
<generatedKey column="id" sqlStatement="MySql" identity="true" />
|
||||
</table>
|
||||
<table tableName="tbl_media_types">
|
||||
<generatedKey column="id" sqlStatement="MySql" identity="true" />
|
||||
</table>
|
||||
<table tableName="tbl_regional_heat">
|
||||
<generatedKey column="id" sqlStatement="MySql" identity="true" />
|
||||
</table>
|
||||
|
||||
</context>
|
||||
|
||||
</generatorConfiguration>
|
||||
BIN
entity-manage-dao/generator/mysql-connector-java-5.1.36.jar
Normal file
BIN
entity-manage-dao/generator/mysql-connector-java-5.1.36.jar
Normal file
Binary file not shown.
67
entity-manage-dao/pom.xml
Normal file
67
entity-manage-dao/pom.xml
Normal file
@@ -0,0 +1,67 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<artifactId>entity-manage</artifactId>
|
||||
<groupId>com.shuwen.data</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>entity-manage-dao</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- mybatis start -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
<artifactId>mapper-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<!-- mybatis end -->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.mybatis.generator</groupId>
|
||||
<artifactId>mybatis-generator-maven-plugin</artifactId>
|
||||
<version>1.3.6</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.34</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
<artifactId>mapper</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.mybatis.generator</groupId>-->
|
||||
<!--<artifactId>mybatis-generator-core</artifactId>-->
|
||||
<!--<version>1.3.5</version>-->
|
||||
<!--</dependency>-->
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>tk.mybatis</groupId>-->
|
||||
<!--<artifactId>mapper</artifactId>-->
|
||||
<!--<version>3.4.6</version>-->
|
||||
<!--</dependency>-->
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<configurationFile>src/main/resources/generator/mybatis-generator.xml</configurationFile>
|
||||
<overwrite>true</overwrite>
|
||||
<verbose>true</verbose>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.shuwen.data.entity.manage.dao.mapper;
|
||||
|
||||
import com.shuwen.data.entity.manage.dao.model.EntityRegisterPpl;
|
||||
import com.shuwen.data.entity.manage.dao.util.BasicMapper;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
public interface EntityRegisterPplMapper extends BasicMapper<EntityRegisterPpl> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.shuwen.data.entity.manage.dao.mapper;
|
||||
|
||||
import com.shuwen.data.entity.manage.dao.model.EntityRegisterSimPpl;
|
||||
import com.shuwen.data.entity.manage.dao.util.BasicMapper;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
public interface EntityRegisterSimPplMapper extends BasicMapper<EntityRegisterSimPpl> {
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.shuwen.data.entity.manage.dao.model;
|
||||
|
||||
|
||||
import javax.persistence.Transient;
|
||||
|
||||
/**
|
||||
* <p>文件名称:BaseEntity.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-16</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class BaseEntity {
|
||||
|
||||
@Transient
|
||||
private Integer page = 1;
|
||||
|
||||
@Transient
|
||||
private Integer rows = 10;
|
||||
|
||||
public Integer getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(Integer page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public Integer getRows() {
|
||||
return rows;
|
||||
}
|
||||
|
||||
public void setRows(Integer rows) {
|
||||
this.rows = rows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,478 @@
|
||||
package com.shuwen.data.entity.manage.dao.model;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.persistence.*;
|
||||
|
||||
@Table(name = "entity_register_ppl")
|
||||
public class EntityRegisterPpl {
|
||||
/**
|
||||
* 自增ID
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 操作用户ID
|
||||
*/
|
||||
@Column(name = "user_id")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 所属项目
|
||||
*/
|
||||
private String project;
|
||||
|
||||
/**
|
||||
* 操作状态: 1已匹配, 2待确认, 3需注册
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String gender;
|
||||
|
||||
/**
|
||||
* 职业
|
||||
*/
|
||||
private String occupation;
|
||||
|
||||
/**
|
||||
* 出生年月
|
||||
*/
|
||||
@Column(name = "birth_date")
|
||||
private String birthDate;
|
||||
|
||||
/**
|
||||
* 外文名
|
||||
*/
|
||||
@Column(name = "foreign_name")
|
||||
private String foreignName;
|
||||
|
||||
/**
|
||||
* 别名
|
||||
*/
|
||||
private String alias;
|
||||
|
||||
/**
|
||||
* 国籍
|
||||
*/
|
||||
private String nation;
|
||||
|
||||
/**
|
||||
* 出生地
|
||||
*/
|
||||
@Column(name = "home_place")
|
||||
private String homePlace;
|
||||
|
||||
/**
|
||||
* 身份
|
||||
*/
|
||||
private String identity;
|
||||
|
||||
/**
|
||||
* 工作单位
|
||||
*/
|
||||
@Column(name = "work_org")
|
||||
private String workOrg;
|
||||
|
||||
/**
|
||||
* 主要成就
|
||||
*/
|
||||
@Column(name = "major_work")
|
||||
private String majorWork;
|
||||
|
||||
/**
|
||||
* 简介
|
||||
*/
|
||||
private String summary;
|
||||
|
||||
/**
|
||||
* 详细介绍信息
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 领域专属属性json
|
||||
*/
|
||||
@Column(name = "biz_info")
|
||||
private String bizInfo;
|
||||
|
||||
/**
|
||||
* 数据插入时间
|
||||
*/
|
||||
@Column(name = "gmt_create")
|
||||
private Date gmtCreate;
|
||||
|
||||
/**
|
||||
* 数据更新时间
|
||||
*/
|
||||
@Column(name = "gmt_update")
|
||||
private Date gmtUpdate;
|
||||
|
||||
/**
|
||||
* 获取自增ID
|
||||
*
|
||||
* @return id - 自增ID
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自增ID
|
||||
*
|
||||
* @param id 自增ID
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取操作用户ID
|
||||
*
|
||||
* @return user_id - 操作用户ID
|
||||
*/
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置操作用户ID
|
||||
*
|
||||
* @param userId 操作用户ID
|
||||
*/
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId == null ? null : userId.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所属项目
|
||||
*
|
||||
* @return project - 所属项目
|
||||
*/
|
||||
public String getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置所属项目
|
||||
*
|
||||
* @param project 所属项目
|
||||
*/
|
||||
public void setProject(String project) {
|
||||
this.project = project == null ? null : project.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取操作状态: 1已匹配, 2待确认, 3需注册
|
||||
*
|
||||
* @return status - 操作状态: 1已匹配, 2待确认, 3需注册
|
||||
*/
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置操作状态: 1已匹配, 2待确认, 3需注册
|
||||
*
|
||||
* @param status 操作状态: 1已匹配, 2待确认, 3需注册
|
||||
*/
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取姓名
|
||||
*
|
||||
* @return name - 姓名
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置姓名
|
||||
*
|
||||
* @param name 姓名
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name == null ? null : name.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取性别
|
||||
*
|
||||
* @return gender - 性别
|
||||
*/
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置性别
|
||||
*
|
||||
* @param gender 性别
|
||||
*/
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender == null ? null : gender.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取职业
|
||||
*
|
||||
* @return occupation - 职业
|
||||
*/
|
||||
public String getOccupation() {
|
||||
return occupation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置职业
|
||||
*
|
||||
* @param occupation 职业
|
||||
*/
|
||||
public void setOccupation(String occupation) {
|
||||
this.occupation = occupation == null ? null : occupation.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取出生年月
|
||||
*
|
||||
* @return birth_date - 出生年月
|
||||
*/
|
||||
public String getBirthDate() {
|
||||
return birthDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置出生年月
|
||||
*
|
||||
* @param birthDate 出生年月
|
||||
*/
|
||||
public void setBirthDate(String birthDate) {
|
||||
this.birthDate = birthDate == null ? null : birthDate.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取外文名
|
||||
*
|
||||
* @return foreign_name - 外文名
|
||||
*/
|
||||
public String getForeignName() {
|
||||
return foreignName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置外文名
|
||||
*
|
||||
* @param foreignName 外文名
|
||||
*/
|
||||
public void setForeignName(String foreignName) {
|
||||
this.foreignName = foreignName == null ? null : foreignName.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取别名
|
||||
*
|
||||
* @return alias - 别名
|
||||
*/
|
||||
public String getAlias() {
|
||||
return alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置别名
|
||||
*
|
||||
* @param alias 别名
|
||||
*/
|
||||
public void setAlias(String alias) {
|
||||
this.alias = alias == null ? null : alias.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取国籍
|
||||
*
|
||||
* @return nation - 国籍
|
||||
*/
|
||||
public String getNation() {
|
||||
return nation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置国籍
|
||||
*
|
||||
* @param nation 国籍
|
||||
*/
|
||||
public void setNation(String nation) {
|
||||
this.nation = nation == null ? null : nation.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取出生地
|
||||
*
|
||||
* @return home_place - 出生地
|
||||
*/
|
||||
public String getHomePlace() {
|
||||
return homePlace;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置出生地
|
||||
*
|
||||
* @param homePlace 出生地
|
||||
*/
|
||||
public void setHomePlace(String homePlace) {
|
||||
this.homePlace = homePlace == null ? null : homePlace.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取身份
|
||||
*
|
||||
* @return identity - 身份
|
||||
*/
|
||||
public String getIdentity() {
|
||||
return identity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置身份
|
||||
*
|
||||
* @param identity 身份
|
||||
*/
|
||||
public void setIdentity(String identity) {
|
||||
this.identity = identity == null ? null : identity.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工作单位
|
||||
*
|
||||
* @return work_org - 工作单位
|
||||
*/
|
||||
public String getWorkOrg() {
|
||||
return workOrg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置工作单位
|
||||
*
|
||||
* @param workOrg 工作单位
|
||||
*/
|
||||
public void setWorkOrg(String workOrg) {
|
||||
this.workOrg = workOrg == null ? null : workOrg.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主要成就
|
||||
*
|
||||
* @return major_work - 主要成就
|
||||
*/
|
||||
public String getMajorWork() {
|
||||
return majorWork;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置主要成就
|
||||
*
|
||||
* @param majorWork 主要成就
|
||||
*/
|
||||
public void setMajorWork(String majorWork) {
|
||||
this.majorWork = majorWork == null ? null : majorWork.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取简介
|
||||
*
|
||||
* @return summary - 简介
|
||||
*/
|
||||
public String getSummary() {
|
||||
return summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置简介
|
||||
*
|
||||
* @param summary 简介
|
||||
*/
|
||||
public void setSummary(String summary) {
|
||||
this.summary = summary == null ? null : summary.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取详细介绍信息
|
||||
*
|
||||
* @return content - 详细介绍信息
|
||||
*/
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置详细介绍信息
|
||||
*
|
||||
* @param content 详细介绍信息
|
||||
*/
|
||||
public void setContent(String content) {
|
||||
this.content = content == null ? null : content.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取领域专属属性json
|
||||
*
|
||||
* @return biz_info - 领域专属属性json
|
||||
*/
|
||||
public String getBizInfo() {
|
||||
return bizInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置领域专属属性json
|
||||
*
|
||||
* @param bizInfo 领域专属属性json
|
||||
*/
|
||||
public void setBizInfo(String bizInfo) {
|
||||
this.bizInfo = bizInfo == null ? null : bizInfo.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据插入时间
|
||||
*
|
||||
* @return gmt_create - 数据插入时间
|
||||
*/
|
||||
public Date getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置数据插入时间
|
||||
*
|
||||
* @param gmtCreate 数据插入时间
|
||||
*/
|
||||
public void setGmtCreate(Date gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据更新时间
|
||||
*
|
||||
* @return gmt_update - 数据更新时间
|
||||
*/
|
||||
public Date getGmtUpdate() {
|
||||
return gmtUpdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置数据更新时间
|
||||
*
|
||||
* @param gmtUpdate 数据更新时间
|
||||
*/
|
||||
public void setGmtUpdate(Date gmtUpdate) {
|
||||
this.gmtUpdate = gmtUpdate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
package com.shuwen.data.entity.manage.dao.model;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.persistence.*;
|
||||
|
||||
@Table(name = "entity_register_sim_ppl")
|
||||
public class EntityRegisterSimPpl {
|
||||
/**
|
||||
* 自增ID
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 操作用户ID
|
||||
*/
|
||||
@Column(name = "user_id")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 注册实体ID,entity_register_ppl表主键
|
||||
*/
|
||||
@Column(name = "register_id")
|
||||
private Long registerId;
|
||||
|
||||
/**
|
||||
* 实体ID
|
||||
*/
|
||||
@Column(name = "entity_id")
|
||||
private String entityId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String gender;
|
||||
|
||||
/**
|
||||
* 职业
|
||||
*/
|
||||
private String occupation;
|
||||
|
||||
/**
|
||||
* 出生年月
|
||||
*/
|
||||
@Column(name = "birth_date")
|
||||
private String birthDate;
|
||||
|
||||
/**
|
||||
* 国籍
|
||||
*/
|
||||
private String nation;
|
||||
|
||||
/**
|
||||
* 别名
|
||||
*/
|
||||
private String alias;
|
||||
|
||||
/**
|
||||
* 相似度
|
||||
*/
|
||||
private Integer similarity;
|
||||
|
||||
/**
|
||||
* 数据插入时间
|
||||
*/
|
||||
@Column(name = "gmt_create")
|
||||
private Date gmtCreate;
|
||||
|
||||
/**
|
||||
* 数据更新时间
|
||||
*/
|
||||
@Column(name = "gmt_update")
|
||||
private Date gmtUpdate;
|
||||
|
||||
/**
|
||||
* 获取自增ID
|
||||
*
|
||||
* @return id - 自增ID
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自增ID
|
||||
*
|
||||
* @param id 自增ID
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取操作用户ID
|
||||
*
|
||||
* @return user_id - 操作用户ID
|
||||
*/
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置操作用户ID
|
||||
*
|
||||
* @param userId 操作用户ID
|
||||
*/
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId == null ? null : userId.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取注册实体ID,entity_register_ppl表主键
|
||||
*
|
||||
* @return register_id - 注册实体ID,entity_register_ppl表主键
|
||||
*/
|
||||
public Long getRegisterId() {
|
||||
return registerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置注册实体ID,entity_register_ppl表主键
|
||||
*
|
||||
* @param registerId 注册实体ID,entity_register_ppl表主键
|
||||
*/
|
||||
public void setRegisterId(Long registerId) {
|
||||
this.registerId = registerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实体ID
|
||||
*
|
||||
* @return entity_id - 实体ID
|
||||
*/
|
||||
public String getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置实体ID
|
||||
*
|
||||
* @param entityId 实体ID
|
||||
*/
|
||||
public void setEntityId(String entityId) {
|
||||
this.entityId = entityId == null ? null : entityId.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取姓名
|
||||
*
|
||||
* @return name - 姓名
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置姓名
|
||||
*
|
||||
* @param name 姓名
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name == null ? null : name.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取性别
|
||||
*
|
||||
* @return gender - 性别
|
||||
*/
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置性别
|
||||
*
|
||||
* @param gender 性别
|
||||
*/
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender == null ? null : gender.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取职业
|
||||
*
|
||||
* @return occupation - 职业
|
||||
*/
|
||||
public String getOccupation() {
|
||||
return occupation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置职业
|
||||
*
|
||||
* @param occupation 职业
|
||||
*/
|
||||
public void setOccupation(String occupation) {
|
||||
this.occupation = occupation == null ? null : occupation.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取出生年月
|
||||
*
|
||||
* @return birth_date - 出生年月
|
||||
*/
|
||||
public String getBirthDate() {
|
||||
return birthDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置出生年月
|
||||
*
|
||||
* @param birthDate 出生年月
|
||||
*/
|
||||
public void setBirthDate(String birthDate) {
|
||||
this.birthDate = birthDate == null ? null : birthDate.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取国籍
|
||||
*
|
||||
* @return nation - 国籍
|
||||
*/
|
||||
public String getNation() {
|
||||
return nation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置国籍
|
||||
*
|
||||
* @param nation 国籍
|
||||
*/
|
||||
public void setNation(String nation) {
|
||||
this.nation = nation == null ? null : nation.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取别名
|
||||
*
|
||||
* @return alias - 别名
|
||||
*/
|
||||
public String getAlias() {
|
||||
return alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置别名
|
||||
*
|
||||
* @param alias 别名
|
||||
*/
|
||||
public void setAlias(String alias) {
|
||||
this.alias = alias == null ? null : alias.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取相似度
|
||||
*
|
||||
* @return similarity - 相似度
|
||||
*/
|
||||
public Integer getSimilarity() {
|
||||
return similarity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置相似度
|
||||
*
|
||||
* @param similarity 相似度
|
||||
*/
|
||||
public void setSimilarity(Integer similarity) {
|
||||
this.similarity = similarity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据插入时间
|
||||
*
|
||||
* @return gmt_create - 数据插入时间
|
||||
*/
|
||||
public Date getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置数据插入时间
|
||||
*
|
||||
* @param gmtCreate 数据插入时间
|
||||
*/
|
||||
public void setGmtCreate(Date gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据更新时间
|
||||
*
|
||||
* @return gmt_update - 数据更新时间
|
||||
*/
|
||||
public Date getGmtUpdate() {
|
||||
return gmtUpdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置数据更新时间
|
||||
*
|
||||
* @param gmtUpdate 数据更新时间
|
||||
*/
|
||||
public void setGmtUpdate(Date gmtUpdate) {
|
||||
this.gmtUpdate = gmtUpdate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.shuwen.data.entity.manage.dao.util;
|
||||
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
import tk.mybatis.mapper.common.MySqlMapper;
|
||||
|
||||
/**
|
||||
* <p>文件名称:BasicMapper.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-16</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface BasicMapper<T> extends Mapper<T>, MySqlMapper<T> {
|
||||
}
|
||||
58
entity-manage-dao/src/main/resources/context/config.mybatis.xml
Executable file
58
entity-manage-dao/src/main/resources/context/config.mybatis.xml
Executable file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
|
||||
<!-- Mybatis配置 -->
|
||||
<settings>
|
||||
|
||||
<!-- 全局映射器启用缓存 -->
|
||||
<setting name="cacheEnabled" value="true"/>
|
||||
|
||||
<!-- 查询时,关闭关联对象即时加载以提高性能 -->
|
||||
<setting name="lazyLoadingEnabled" value="true"/>
|
||||
|
||||
<!-- 对于未知的SQL查询,允许返回不同的结果集以达到通用的效果 -->
|
||||
<setting name="multipleResultSetsEnabled" value="true"/>
|
||||
|
||||
<!-- 允许使用列标签代替列名 -->
|
||||
<setting name="useColumnLabel" value="true"/>
|
||||
|
||||
<!-- 不允许使用自定义的主键值(比如由程序生成的UUID 32位编码作为键值),数据表的PK生成策略将被覆盖 -->
|
||||
<setting name="useGeneratedKeys" value="false"/>
|
||||
|
||||
<!-- 给予被嵌套的resultMap以字段-属性的映射支持 FULL,PARTIAL -->
|
||||
<setting name="autoMappingBehavior" value="PARTIAL"/>
|
||||
|
||||
<!-- 对于批量更新操作缓存SQL以提高性能 BATCH,SIMPLE -->
|
||||
<!-- <setting name="defaultExecutorType" value="BATCH" /> -->
|
||||
|
||||
<!-- 数据库超过25000秒仍未响应则超时 -->
|
||||
<!-- <setting name="defaultStatementTimeout" value="25000" /> -->
|
||||
|
||||
<!-- Allows using RowBounds on nested statements -->
|
||||
<setting name="safeRowBoundsEnabled" value="false"/>
|
||||
|
||||
<!-- Enables automatic mapping from classic database column names A_COLUMN to camel case classic Java property names aColumn. -->
|
||||
<setting name="mapUnderscoreToCamelCase" value="true"/>
|
||||
|
||||
<!-- MyBatis uses local cache to prevent circular references and speed up repeated nested queries. By default (SESSION) all queries executed during a session are cached. If localCacheScope=STATEMENT
|
||||
local session will be used just for statement execution, no data will be shared between two different calls to the same SqlSession. -->
|
||||
<setting name="localCacheScope" value="SESSION"/>
|
||||
|
||||
<!-- Specifies the JDBC type for null values when no specific JDBC type was provided for the parameter. Some drivers require specifying the column JDBC type but others work with generic values
|
||||
like NULL, VARCHAR or OTHER. -->
|
||||
<setting name="jdbcTypeForNull" value="OTHER"/>
|
||||
|
||||
<!-- Specifies which Object's methods trigger a lazy load -->
|
||||
<setting name="lazyLoadTriggerMethods" value="equals,clone,hashCode,toString"/>
|
||||
|
||||
<!-- 设置关联对象加载的形态,此处为按需加载字段(加载字段由SQL指 定),不会加载关联表的所有字段,以提高性能 -->
|
||||
<setting name="aggressiveLazyLoading" value="false"/>
|
||||
|
||||
<setting name="logPrefix" value="repository."/>
|
||||
|
||||
</settings>
|
||||
|
||||
</configuration>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE generatorConfiguration
|
||||
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
|
||||
|
||||
<generatorConfiguration>
|
||||
<classPathEntry
|
||||
location="generator/mysql-connector-java-5.1.36.jar"/>
|
||||
|
||||
<context id="MySQLTables" targetRuntime="MyBatis3Simple">
|
||||
<property name="beginningDelimiter" value="`"/>
|
||||
<property name="endingDelimiter" value="`"/>
|
||||
|
||||
<!--<plugin type="org.mybatis.generator.plugins.RowBoundsPlugin"/>-->
|
||||
|
||||
<plugin type="tk.mybatis.mapper.generator.MapperPlugin">
|
||||
<property name="mappers" value="tk.mybatis.mapper.common.Mapper"/>
|
||||
<property name="caseSensitive" value="true"/>
|
||||
</plugin>
|
||||
|
||||
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
|
||||
connectionURL="jdbc:mysql://rm-bp1i4352736pw1x0oo.mysql.rds.aliyuncs.com:3306/entity_manage"
|
||||
userId="root"
|
||||
password="Rds_xhzy123" />
|
||||
|
||||
<javaTypeResolver>
|
||||
<property name="forceBigDecimals" value="false"/>
|
||||
</javaTypeResolver>
|
||||
|
||||
<javaModelGenerator targetPackage="com.shuwen.data.entity.manage.dao.model"
|
||||
targetProject="src/main/java">
|
||||
<property name="enableSubPackages" value="true"/>
|
||||
<property name="trimStrings" value="true"/>
|
||||
</javaModelGenerator>
|
||||
|
||||
<sqlMapGenerator targetPackage="mapper"
|
||||
targetProject="src/main/resources">
|
||||
<property name="enableSubPackages" value="true"/>
|
||||
</sqlMapGenerator>
|
||||
|
||||
<javaClientGenerator type="XMLMAPPER"
|
||||
targetPackage="com.shuwen.data.entity.manage.dao.mapper"
|
||||
targetProject="src/main/java">
|
||||
<property name="enableSubPackages" value="true"/>
|
||||
</javaClientGenerator>
|
||||
|
||||
<table tableName="entity_register_ppl">
|
||||
<generatedKey column="id" sqlStatement="MySql" identity="true" />
|
||||
</table>
|
||||
|
||||
|
||||
<table tableName="entity_register_sim_ppl">
|
||||
<generatedKey column="id" sqlStatement="MySql" identity="true" />
|
||||
</table>
|
||||
|
||||
</context>
|
||||
|
||||
</generatorConfiguration>
|
||||
45
entity-manage-dao/src/main/resources/generator/table-ppl.sql
Normal file
45
entity-manage-dao/src/main/resources/generator/table-ppl.sql
Normal file
@@ -0,0 +1,45 @@
|
||||
-- 人物实体注册表
|
||||
DROP table `entity_register_ppl`;
|
||||
CREATE TABLE `entity_register_ppl` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
|
||||
`user_id` varchar(100) NOT NULL COMMENT '操作用户ID',
|
||||
`project` varchar(100) NOT NULL COMMENT '所属项目',
|
||||
`status` integer unsigned NOT NULL COMMENT '操作状态: 1已匹配, 2待确认, 3需注册',
|
||||
`name` varchar(100) NOT NULL COMMENT '姓名',
|
||||
`gender` varchar(50) DEFAULT NULL COMMENT '性别',
|
||||
`occupation` varchar(100) DEFAULT NULL COMMENT '职业',
|
||||
`birth_date` varchar(100) DEFAULT NULL COMMENT '出生年月',
|
||||
`foreign_name` varchar(100) DEFAULT NULL COMMENT '外文名',
|
||||
`alias` varchar(200) DEFAULT NULL COMMENT '别名',
|
||||
`nation` varchar(100) DEFAULT NULL COMMENT '国籍',
|
||||
`home_place` varchar(100) DEFAULT NULL COMMENT '出生地',
|
||||
`identity` varchar(200) DEFAULT NULL COMMENT '身份',
|
||||
`work_org` varchar(200) DEFAULT NULL COMMENT '工作单位',
|
||||
`major_work` varchar(200) DEFAULT NULL COMMENT '主要成就',
|
||||
`summary` varchar(500) DEFAULT NULL COMMENT '简介',
|
||||
`content` varchar(500) DEFAULT NULL COMMENT '详细介绍信息',
|
||||
`biz_info` varchar(500) DEFAULT NULL COMMENT '领域专属属性json',
|
||||
`gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '数据插入时间',
|
||||
`gmt_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '数据更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='实体人物注册表';
|
||||
|
||||
-- 人物实体注册待确认关联表
|
||||
DROP table `entity_register_sim_ppl`;
|
||||
CREATE TABLE `entity_register_sim_ppl` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
|
||||
`user_id` varchar(100) NOT NULL COMMENT '操作用户ID',
|
||||
`register_id` bigint(20) NOT NULL COMMENT '注册实体ID,entity_register_ppl表主键',
|
||||
`entity_id` varchar(100) NOT NULL COMMENT '实体ID',
|
||||
`name` varchar(100) NOT NULL COMMENT '姓名',
|
||||
`gender` varchar(50) DEFAULT NULL COMMENT '性别',
|
||||
`occupation` varchar(100) DEFAULT NULL COMMENT '职业',
|
||||
`birth_date` varchar(100) DEFAULT NULL COMMENT '出生年月',
|
||||
`nation` varchar(100) DEFAULT NULL COMMENT '国籍',
|
||||
`alias` varchar(200) DEFAULT NULL COMMENT '别名',
|
||||
`similarity` integer unsigned DEFAULT 0 COMMENT '相似度',
|
||||
`gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '数据插入时间',
|
||||
`gmt_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '数据更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `UK_ENTITY` (`user_id`,`register_id`,`entity_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='实体人物表';
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.shuwen.data.entity.manage.dao.mapper.EntityRegisterPplMapper">
|
||||
<resultMap id="BaseResultMap" type="com.shuwen.data.entity.manage.dao.model.EntityRegisterPpl">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||
<result column="project" jdbcType="VARCHAR" property="project" />
|
||||
<result column="status" jdbcType="INTEGER" property="status" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="gender" jdbcType="VARCHAR" property="gender" />
|
||||
<result column="occupation" jdbcType="VARCHAR" property="occupation" />
|
||||
<result column="birth_date" jdbcType="VARCHAR" property="birthDate" />
|
||||
<result column="foreign_name" jdbcType="VARCHAR" property="foreignName" />
|
||||
<result column="alias" jdbcType="VARCHAR" property="alias" />
|
||||
<result column="nation" jdbcType="VARCHAR" property="nation" />
|
||||
<result column="home_place" jdbcType="VARCHAR" property="homePlace" />
|
||||
<result column="identity" jdbcType="VARCHAR" property="identity" />
|
||||
<result column="work_org" jdbcType="VARCHAR" property="workOrg" />
|
||||
<result column="major_work" jdbcType="VARCHAR" property="majorWork" />
|
||||
<result column="summary" jdbcType="VARCHAR" property="summary" />
|
||||
<result column="content" jdbcType="VARCHAR" property="content" />
|
||||
<result column="biz_info" jdbcType="VARCHAR" property="bizInfo" />
|
||||
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
|
||||
<result column="gmt_update" jdbcType="TIMESTAMP" property="gmtUpdate" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.shuwen.data.entity.manage.dao.mapper.EntityRegisterSimPplMapper">
|
||||
<resultMap id="BaseResultMap" type="com.shuwen.data.entity.manage.dao.model.EntityRegisterSimPpl">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||
<result column="register_id" jdbcType="BIGINT" property="registerId" />
|
||||
<result column="entity_id" jdbcType="VARCHAR" property="entityId" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="gender" jdbcType="VARCHAR" property="gender" />
|
||||
<result column="occupation" jdbcType="VARCHAR" property="occupation" />
|
||||
<result column="birth_date" jdbcType="VARCHAR" property="birthDate" />
|
||||
<result column="nation" jdbcType="VARCHAR" property="nation" />
|
||||
<result column="alias" jdbcType="VARCHAR" property="alias" />
|
||||
<result column="similarity" jdbcType="INTEGER" property="similarity" />
|
||||
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
|
||||
<result column="gmt_update" jdbcType="TIMESTAMP" property="gmtUpdate" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
237
entity-manage-web/pom.xml
Executable file
237
entity-manage-web/pom.xml
Executable file
@@ -0,0 +1,237 @@
|
||||
<?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>
|
||||
|
||||
<parent>
|
||||
<groupId>com.shuwen.data</groupId>
|
||||
<artifactId>entity-manage</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>entity-manage-web</artifactId>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<dependencies>
|
||||
<!-- project start -->
|
||||
<dependency>
|
||||
<groupId>com.shuwen.data</groupId>
|
||||
<artifactId>entity-manage-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.shuwen.data</groupId>
|
||||
<artifactId>entity-manage-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.shuwen.data</groupId>
|
||||
<artifactId>entity-manage-dao</artifactId>
|
||||
</dependency>
|
||||
<!-- project end -->
|
||||
|
||||
<!-- shuwen start -->
|
||||
<dependency>
|
||||
<groupId>com.shuwen.search</groupId>
|
||||
<artifactId>search-proxy-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.shuwen</groupId>
|
||||
<artifactId>dingtalk-sso</artifactId>
|
||||
<version>1.6.0</version>
|
||||
</dependency>
|
||||
<!-- shuwen end -->
|
||||
|
||||
<!-- spring start -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- devtools插件,热部署 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional>
|
||||
<scope>true</scope>
|
||||
</dependency>
|
||||
<!-- spring end -->
|
||||
|
||||
<!-- commons start -->
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
</dependency>
|
||||
<!-- commons end -->
|
||||
|
||||
<!-- prometheus start -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-prometheus</artifactId>
|
||||
</dependency>
|
||||
<!-- prometheus end -->
|
||||
|
||||
<!-- MySQL start -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.shuwen.diamond</groupId>
|
||||
<artifactId>diamond-spring-client</artifactId>
|
||||
</dependency>
|
||||
<!-- MySQL end -->
|
||||
|
||||
<!-- dubbo start -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>dubbo</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.101tec</groupId>
|
||||
<artifactId>zkclient</artifactId>
|
||||
<version>${zkclient.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.javassist</groupId>
|
||||
<artifactId>javassist</artifactId>
|
||||
</dependency>
|
||||
<!-- dubbo end -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--解析Excel-->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>3.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>3.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>3.14</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!--<!– 读取csv并解析 –>-->
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>net.sourceforge.javacsv</groupId>-->
|
||||
<!--<artifactId>javacsv</artifactId>-->
|
||||
<!--<version>2.0</version>-->
|
||||
<!--</dependency>-->
|
||||
<!--<!– 读取excel并解析 –>-->
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.apache.poi</groupId>-->
|
||||
<!--<artifactId>poi</artifactId>-->
|
||||
<!--<version>3.17</version>-->
|
||||
<!--</dependency>-->
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.apache.poi</groupId>-->
|
||||
<!--<artifactId>poi-ooxml</artifactId>-->
|
||||
<!--<version>3.17</version>-->
|
||||
<!--</dependency>-->
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<properties>
|
||||
<props>src/filters/dev.properties</props>
|
||||
</properties>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>test</id>
|
||||
<properties>
|
||||
<props>src/filters/test.properties</props>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>pre</id>
|
||||
<properties>
|
||||
<props>src/filters/pre.properties</props>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>prod</id>
|
||||
<properties>
|
||||
<props>src/filters/prod.properties</props>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<finalName>entity-manage</finalName>
|
||||
<filters>
|
||||
<filter>${props}</filter>
|
||||
</filters>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
13
entity-manage-web/src/filters/dev.properties
Executable file
13
entity-manage-web/src/filters/dev.properties
Executable file
@@ -0,0 +1,13 @@
|
||||
# API
|
||||
log.path=/logs/entity-manage
|
||||
|
||||
# DB
|
||||
db.url=jdbc:mysql://rm-bp1i4352736pw1x0oo.mysql.rds.aliyuncs.com:3306/entity_manage?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false&useSSL=false
|
||||
db.username=root
|
||||
db.password=${diamond:rds.password#entity_manage}
|
||||
db.publickey=${diamond:rds.publickey#entity_manage}
|
||||
|
||||
# ES
|
||||
dubbo.es.group=xhzy_es_test
|
||||
dubbo.registry.address=116.62.230.200:2181,116.62.225.137:2181,116.62.227.195:2181
|
||||
dubbo.protocol.port=7078
|
||||
11
entity-manage-web/src/filters/prod.properties
Executable file
11
entity-manage-web/src/filters/prod.properties
Executable file
@@ -0,0 +1,11 @@
|
||||
# Log
|
||||
log.path=/home/admin/logs
|
||||
|
||||
# DB
|
||||
db.url=jdbc:mysql://rm-bp1i4352736pw1x0oo.mysql.rds.aliyuncs.com:3306/entity_manage?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false&useSSL=false
|
||||
db.username=root
|
||||
db.password=${diamond:rds.password#entity_manage}
|
||||
db.publickey=${diamond:rds.publickey#entity_manage}
|
||||
|
||||
# ES
|
||||
es.group=xhzy_es_cluster
|
||||
13
entity-manage-web/src/filters/test.properties
Executable file
13
entity-manage-web/src/filters/test.properties
Executable file
@@ -0,0 +1,13 @@
|
||||
# Log
|
||||
log.path=/home/admin/logs
|
||||
|
||||
# DB
|
||||
db.url=jdbc:mysql://rm-bp1i4352736pw1x0oo.mysql.rds.aliyuncs.com:3306/entity_manage?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false&useSSL=false
|
||||
db.username=root
|
||||
db.password=${diamond:rds.password#entity_manage}
|
||||
db.publickey=${diamond:rds.publickey#entity_manage}
|
||||
|
||||
# ES
|
||||
dubbo.es.group=xhzy_es_test
|
||||
dubbo.registry.address=116.62.230.200:2181,116.62.225.137:2181,116.62.227.195:2181
|
||||
dubbo.protocol.port=7078
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.shuwen.data.entity.manage.web;
|
||||
|
||||
import com.shuwen.diamon.spring.client.DiamondPropertySourceFactory;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import tk.mybatis.spring.annotation.MapperScan;
|
||||
|
||||
/**
|
||||
* <p>文件名称:EntityManageApplication.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-09-19</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.shuwen.data.entity.manage.dao.mapper")
|
||||
@PropertySource(name = "diamond", value = "", factory = DiamondPropertySourceFactory.class)
|
||||
@ImportResource(value = {"classpath:application-context.xml"})
|
||||
public class EntityManageApplication extends SpringBootServletInitializer {
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(EntityManageApplication.class);
|
||||
}
|
||||
|
||||
|
||||
// @Bean
|
||||
// public TomcatEmbeddedServletContainerFactory tomcatEmbedded() {
|
||||
// TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
|
||||
// tomcat.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {
|
||||
// if ((connector.getProtocolHandler() instanceof AbstractHttp11Protocol<?>)) {
|
||||
// //-1 means unlimited
|
||||
// ((AbstractHttp11Protocol<?>) connector.getProtocolHandler()).setMaxSwallowSize(-1);
|
||||
// }
|
||||
// });
|
||||
// return tomcat;
|
||||
// }
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(EntityManageApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.shuwen.data.entity.manage.web.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
|
||||
/**
|
||||
* <p>文件名称:CorsConfig.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-22</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@Configuration
|
||||
public class CorsConfig {
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean corsFilter() {
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
config.setAllowCredentials(true);
|
||||
config.addAllowedOrigin("*");
|
||||
config.addAllowedHeader("*");
|
||||
config.addAllowedMethod("*");
|
||||
source.registerCorsConfiguration("/**", config);
|
||||
FilterRegistrationBean bean = new FilterRegistrationBean<>(new CorsFilter(source));
|
||||
bean.setOrder(0);
|
||||
return bean;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.shuwen.data.entity.manage.web.config;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* <p>文件名称:StaticConfig.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-09-28</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class Preload {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Preload.class);
|
||||
|
||||
@PostConstruct
|
||||
public void load() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.shuwen.data.entity.manage.web.config;
|
||||
|
||||
import org.springframework.boot.web.servlet.MultipartConfigFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
||||
|
||||
import javax.servlet.MultipartConfigElement;
|
||||
|
||||
/**
|
||||
* <p>文件名称:WebConfig.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-09-19</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@Configuration
|
||||
public class WebConfig extends WebMvcConfigurerAdapter {
|
||||
|
||||
@Bean
|
||||
public MultipartConfigElement multipartConfigElement() {
|
||||
MultipartConfigFactory factory = new MultipartConfigFactory();
|
||||
|
||||
factory.setMaxFileSize("8MB");
|
||||
factory.setMaxRequestSize("28MB");
|
||||
|
||||
return factory.createMultipartConfig();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
package com.shuwen.data.entity.manage.web.controller;
|
||||
|
||||
import com.shuwen.data.entity.manage.api.entity.base.AbstractRequest;
|
||||
import com.shuwen.data.entity.manage.api.entity.base.RespDto;
|
||||
import com.shuwen.data.entity.manage.api.entity.enums.AmbiguousStatusEnum;
|
||||
import com.shuwen.data.entity.manage.api.entity.enums.ReturnCodeEnum;
|
||||
import com.shuwen.data.entity.manage.api.entity.exception.EntityServiceException;
|
||||
import com.shuwen.data.entity.manage.common.utils.IDUtils;
|
||||
import com.shuwen.data.entity.manage.dao.model.EntityRegisterPpl;
|
||||
import com.shuwen.data.entity.manage.dao.model.EntityRegisterSimPpl;
|
||||
import com.shuwen.data.entity.manage.web.entity.EntityAmbiguous;
|
||||
import com.shuwen.data.entity.manage.web.entity.ImportResult;
|
||||
import com.shuwen.data.entity.manage.web.entity.dto.PplRegisterSingleReqDto;
|
||||
import com.shuwen.data.entity.manage.web.entity.dto.base.PplEntity;
|
||||
import com.shuwen.data.entity.manage.web.entity.dto.common.CancelReqDto;
|
||||
import com.shuwen.data.entity.manage.web.entity.dto.common.ReregisterReqDto;
|
||||
import com.shuwen.data.entity.manage.web.entity.dto.common.SearchReqDto;
|
||||
import com.shuwen.data.entity.manage.web.entity.dto.common.TaskReqDto;
|
||||
import com.shuwen.data.entity.manage.web.entity.template.EntityPplTemplate;
|
||||
import com.shuwen.data.entity.manage.web.service.IResolveExcelService;
|
||||
import com.shuwen.data.entity.manage.web.service.db.EntityPplService;
|
||||
import com.shuwen.data.entity.manage.web.service.db.EntitySimPplService;
|
||||
import com.shuwen.data.entity.manage.web.service.external.EntityAmbiguousService;
|
||||
import com.shuwen.dingtalksso.pojo.UserInfo;
|
||||
import com.shuwen.search.proxy.api.entity.base.FieldBoost;
|
||||
import com.shuwen.search.proxy.api.entity.base.FieldFilter;
|
||||
import com.shuwen.search.proxy.api.entity.base.FieldSort;
|
||||
import com.shuwen.search.proxy.api.entity.dto.common.ItemsRespDto;
|
||||
import com.shuwen.search.proxy.api.entity.dto.common.TextFullReqDto;
|
||||
import com.shuwen.search.proxy.api.entity.enums.FieldFilterTypeEnum;
|
||||
import com.shuwen.search.proxy.api.entity.enums.FieldSortTypeEnum;
|
||||
import com.shuwen.search.proxy.api.service.ICrudService;
|
||||
import com.shuwen.search.proxy.api.service.IFilterService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.RowBounds;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>文件名称:EntityPplController.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-16</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/entity")
|
||||
public class EntityPplController {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(EntityPplController.class);
|
||||
|
||||
@Resource
|
||||
private EntityPplService pplService;
|
||||
|
||||
@Resource
|
||||
private EntitySimPplService simPplService;
|
||||
|
||||
@Resource
|
||||
private EntityAmbiguousService ambiguousService;
|
||||
|
||||
@Resource
|
||||
private ICrudService crudService;
|
||||
|
||||
@Resource
|
||||
private IFilterService filterService;
|
||||
|
||||
@Resource
|
||||
private IResolveExcelService<PplRegisterSingleReqDto> resolveExcelService;
|
||||
|
||||
@PostMapping("/register/ppl/single")
|
||||
@ResponseBody
|
||||
public RespDto singleRegister(@RequestBody PplRegisterSingleReqDto reqDto,
|
||||
HttpServletRequest request) {
|
||||
|
||||
if (StringUtils.isEmpty(reqDto.getName()))
|
||||
return RespDto.fail(ReturnCodeEnum.PARAM_INVALID);
|
||||
String requestId = getRequestId(reqDto, "ppl-register");
|
||||
|
||||
EntityRegisterPpl ppl = reqDto.generateDao();
|
||||
UserInfo user = (UserInfo) request.getSession().getAttribute("user");
|
||||
ppl.setUserId(user.getUnionId());
|
||||
RespDto<List<EntityAmbiguous<EntityRegisterSimPpl>>> ambiguous =
|
||||
ambiguousService.entityPplDisambiguate(Arrays.asList(reqDto));
|
||||
ppl.setStatus(AmbiguousStatusEnum.MATCH.getId());
|
||||
|
||||
if (pplService.insert(ppl) == 1) {
|
||||
return RespDto.succeed(requestId, 1);
|
||||
} else {
|
||||
return RespDto.fail(requestId, ReturnCodeEnum.DB_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/register/ppl/batch")
|
||||
@ResponseBody
|
||||
public RespDto batchRegister(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam("project") String project,
|
||||
@RequestParam(value = "requestId", required = false) String requestId,
|
||||
HttpServletRequest request) {
|
||||
if (file.isEmpty()) {
|
||||
return RespDto.fail(requestId, ReturnCodeEnum.PARAM_INVALID);
|
||||
}
|
||||
requestId = StringUtils.isEmpty(requestId) ?
|
||||
IDUtils.generateReqId("ppl-register") : requestId;
|
||||
UserInfo user = (UserInfo) request.getSession().getAttribute("user");
|
||||
|
||||
ImportResult<PplRegisterSingleReqDto> ppls;
|
||||
try {
|
||||
ppls = resolveExcelService.resolveExcel(file, EntityPplTemplate.class);
|
||||
|
||||
RespDto<List<EntityAmbiguous<EntityRegisterSimPpl>>> ambiguous =
|
||||
ambiguousService.entityPplDisambiguate(ppls.getItems());
|
||||
|
||||
List<EntityRegisterPpl> entityRegisterPpls = ppls.getItems().stream().map(ppl -> {
|
||||
EntityRegisterPpl entity = ppl.generateDao();
|
||||
entity.setStatus(AmbiguousStatusEnum.MATCH.getId());
|
||||
entity.setProject(project);
|
||||
entity.setUserId(user.getUnionId());
|
||||
return entity;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
pplService.insert(entityRegisterPpls);
|
||||
} catch (EntityServiceException e) {
|
||||
return RespDto.fail(requestId, e.getCode());
|
||||
}
|
||||
return RespDto.succeed(requestId, ppls);
|
||||
}
|
||||
|
||||
@PostMapping("/reregister/ppl")
|
||||
@ResponseBody
|
||||
public RespDto reregister(@RequestBody ReregisterReqDto reqDto) {
|
||||
if (reqDto.getIds() == null || reqDto.getIds().size() == 0) {
|
||||
return RespDto.fail(ReturnCodeEnum.PARAM_INVALID);
|
||||
}
|
||||
String requestId = getRequestId(reqDto, "ppl-reregister");
|
||||
int pplCode, simCode;
|
||||
EntityRegisterPpl updateTo = new EntityRegisterPpl();
|
||||
updateTo.setStatus(AmbiguousStatusEnum.REGISTER.getId());
|
||||
Example pplExample = new Example(EntityRegisterPpl.class);
|
||||
|
||||
pplExample.createCriteria().andIn("id", reqDto.getIds());
|
||||
|
||||
Example simExample = new Example(EntityRegisterSimPpl.class);
|
||||
simExample.createCriteria().andIn("registerId", reqDto.getIds());
|
||||
try {
|
||||
pplCode = pplService.updateByExample(updateTo, pplExample);
|
||||
simCode = simPplService.deleteByExample(simExample);
|
||||
} catch (Exception e) {
|
||||
return RespDto.fail(ReturnCodeEnum.DB_ERROR);
|
||||
}
|
||||
LOG.info("entity|ppl|reregister|{ppl={}, sim={}}", pplCode, simCode);
|
||||
return RespDto.succeed(requestId, pplCode);
|
||||
}
|
||||
|
||||
@PostMapping("/cancel/ppl")
|
||||
@ResponseBody
|
||||
public RespDto cancel(@RequestBody CancelReqDto reqDto) {
|
||||
if (reqDto.getIds() == null || reqDto.getIds().size() == 0) {
|
||||
return RespDto.fail(ReturnCodeEnum.PARAM_INVALID);
|
||||
}
|
||||
String requestId = getRequestId(reqDto, "ppl-cancel");
|
||||
int pplCode, simCode;
|
||||
Example pplExample = new Example(EntityRegisterPpl.class);
|
||||
pplExample.createCriteria().andIn("id", reqDto.getIds());
|
||||
|
||||
Example simExample = new Example(EntityRegisterSimPpl.class);
|
||||
simExample.createCriteria().andIn("registerId", reqDto.getIds());
|
||||
try {
|
||||
pplCode = pplService.deleteByExample(pplExample);
|
||||
simCode = simPplService.deleteByExample(simExample);
|
||||
} catch (Exception e) {
|
||||
return RespDto.fail(ReturnCodeEnum.DB_ERROR);
|
||||
}
|
||||
LOG.info("entity|ppl|cancel|{ppl={}, sim={}}", pplCode, simCode);
|
||||
return RespDto.succeed(requestId, pplCode);
|
||||
}
|
||||
|
||||
@PostMapping("/task/ppl")
|
||||
@ResponseBody
|
||||
public RespDto task(@RequestBody TaskReqDto reqDto, HttpServletRequest request) {
|
||||
if (StringUtils.isEmpty(reqDto.getProject())
|
||||
|| reqDto.getStatus() == null) {
|
||||
return RespDto.fail(ReturnCodeEnum.PARAM_INVALID);
|
||||
}
|
||||
int from = reqDto.getFrom() == null ? 0 : reqDto.getFrom();
|
||||
int size = reqDto.getSize() == null ? 10 : reqDto.getSize();
|
||||
String requestId = getRequestId(reqDto, "ppl-task");
|
||||
|
||||
UserInfo user = (UserInfo) request.getSession().getAttribute("user");
|
||||
|
||||
Example pplExample = new Example(EntityRegisterPpl.class);
|
||||
pplExample.createCriteria().andEqualTo("userId", user.getUnionId())
|
||||
.andEqualTo("project", reqDto.getProject())
|
||||
.andEqualTo("status", reqDto.getStatus().getId());
|
||||
|
||||
Example simExample = new Example(EntityRegisterSimPpl.class);
|
||||
|
||||
List<EntityRegisterPpl> ppls = pplService.selectByExample(pplExample,
|
||||
new RowBounds(from, size));
|
||||
List<Long> pplIds = ppls.stream().map(EntityRegisterPpl::getId).collect(Collectors.toList());
|
||||
simExample.createCriteria().andIn("registerId", pplIds);
|
||||
List<EntityRegisterSimPpl> simPpls = simPplService.selectByExample(simExample);
|
||||
|
||||
List<PplEntity<EntityRegisterSimPpl>> result = ppls.stream()
|
||||
.map(ppl -> {
|
||||
PplEntity<EntityRegisterSimPpl> pplEntity = PplEntity.generate(ppl);
|
||||
pplEntity.setItems(simPpls.stream()
|
||||
.filter(simPpl -> simPpl.getRegisterId().equals(ppl.getId()))
|
||||
.collect(Collectors.toList()));
|
||||
return pplEntity;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
return RespDto.succeed(requestId, result);
|
||||
}
|
||||
|
||||
@PostMapping("/search/ppl")
|
||||
@ResponseBody
|
||||
public RespDto search(@RequestBody SearchReqDto reqDto) {
|
||||
TextFullReqDto searchDto = new TextFullReqDto();
|
||||
switch (reqDto.getMode()) {
|
||||
case MATCH:
|
||||
searchDto.must(new FieldFilter("name", FieldFilterTypeEnum.TERM, reqDto.getQuery()))
|
||||
.sort(new FieldSort("_score", FieldSortTypeEnum.DESC))
|
||||
.sort(new FieldSort("hot", FieldSortTypeEnum.DESC));
|
||||
break;
|
||||
case FUZZY:
|
||||
searchDto.query(reqDto.getQuery())
|
||||
.fieldBoost(new FieldBoost("name"))
|
||||
.sort(new FieldSort("_score", FieldSortTypeEnum.DESC))
|
||||
.sort(new FieldSort("hot", FieldSortTypeEnum.DESC));
|
||||
break;
|
||||
case PREFIX:
|
||||
break;
|
||||
}
|
||||
searchDto.setIndex("ppl");
|
||||
searchDto.setType("entity");
|
||||
ItemsRespDto respDto = filterService.fullText(searchDto);
|
||||
return RespDto.succeed("null", respDto.getData().getItems());
|
||||
}
|
||||
|
||||
@PostMapping("/submit/ppl")
|
||||
@ResponseBody
|
||||
public RespDto submit(@RequestBody EntityRegisterPpl entityRegisterPpl) {
|
||||
return RespDto.succeed("world");
|
||||
}
|
||||
|
||||
private String getRequestId(AbstractRequest reqDto, String type) {
|
||||
return StringUtils.isEmpty(reqDto.getRequestId()) ?
|
||||
IDUtils.generateReqId(type) :
|
||||
reqDto.getRequestId();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.shuwen.data.entity.manage.web.controller;
|
||||
|
||||
import com.shuwen.data.entity.manage.api.entity.base.RespDto;
|
||||
import com.shuwen.data.entity.manage.web.integration.diamond.SelectorListener;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* <p>文件名称:SelectorController.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-29</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/selector")
|
||||
public class SelectorController {
|
||||
@GetMapping("/project")
|
||||
@ResponseBody
|
||||
public RespDto project() {
|
||||
return RespDto.succeed(null, SelectorListener.project);
|
||||
}
|
||||
|
||||
@GetMapping("/nation")
|
||||
@ResponseBody
|
||||
public RespDto nation() {
|
||||
return RespDto.succeed(null, SelectorListener.nation);
|
||||
}
|
||||
|
||||
@GetMapping("/org/type")
|
||||
@ResponseBody
|
||||
public RespDto orgType() {
|
||||
return RespDto.succeed(null, SelectorListener.orgType);
|
||||
}
|
||||
|
||||
@GetMapping("/ppl/identity")
|
||||
@ResponseBody
|
||||
public RespDto singleRegister() {
|
||||
return RespDto.succeed(null, SelectorListener.pplIdentity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.shuwen.data.entity.manage.web.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* <p>文件名称:TestUploadController.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-16</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/test")
|
||||
public class TestUploadController {
|
||||
@RequestMapping("/index")
|
||||
public ModelAndView index() {
|
||||
ModelAndView modelAndView = new ModelAndView("index");
|
||||
modelAndView.addObject("age", 20);
|
||||
modelAndView.addObject("name", "stone");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@GetMapping(value="/upload")
|
||||
public String upload(){
|
||||
return "upload";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.shuwen.data.entity.manage.web.controller;
|
||||
|
||||
import com.shuwen.data.entity.manage.api.entity.base.RespDto;
|
||||
import com.shuwen.dingtalksso.pojo.UserInfo;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* <p>文件名称:TestController.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-16</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
@GetMapping("/info")
|
||||
@ResponseBody
|
||||
public RespDto info(HttpServletRequest request) {
|
||||
UserInfo user = (UserInfo) request.getSession().getAttribute("user");
|
||||
return RespDto.succeed(null, user);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.shuwen.data.entity.manage.web.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>文件名称:EntityAmbiguous.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-24</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class EntityAmbiguous<T> {
|
||||
private String id;
|
||||
private String status;
|
||||
|
||||
@JSONField(name = "entity_id")
|
||||
private String entityId;
|
||||
private List<T> items;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
public void setEntityId(String entityId) {
|
||||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
public List<T> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<T> items) {
|
||||
this.items = items;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.shuwen.data.entity.manage.web.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>文件名称:ImportResult.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-25</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ImportResult<T> {
|
||||
|
||||
private Integer total;
|
||||
private Integer success;
|
||||
private Integer invalid;
|
||||
private Integer duplicate;
|
||||
|
||||
@JsonIgnore
|
||||
private List<T> items;
|
||||
|
||||
public ImportResult() {
|
||||
|
||||
}
|
||||
|
||||
public ImportResult(List<T> items, Integer total, Integer success, Integer invalid, Integer duplicate) {
|
||||
this.items = items;
|
||||
this.total = total;
|
||||
this.success = success;
|
||||
this.invalid = invalid;
|
||||
this.duplicate = duplicate;
|
||||
}
|
||||
|
||||
public List<T> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<T> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Integer total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public Integer getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(Integer success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public Integer getInvalid() {
|
||||
return invalid;
|
||||
}
|
||||
|
||||
public void setInvalid(Integer invalid) {
|
||||
this.invalid = invalid;
|
||||
}
|
||||
|
||||
public Integer getDuplicate() {
|
||||
return duplicate;
|
||||
}
|
||||
|
||||
public void setDuplicate(Integer duplicate) {
|
||||
this.duplicate = duplicate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.shuwen.data.entity.manage.web.entity.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* <p>文件名称:ExcelField.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-24</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
@Documented
|
||||
public @interface ExcelField {
|
||||
/**
|
||||
* 映射的字段名
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String name() default "";
|
||||
|
||||
/**
|
||||
* 字段列号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int column();
|
||||
|
||||
/**
|
||||
* 是否必填
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean required() default false;
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
package com.shuwen.data.entity.manage.web.entity.dto;
|
||||
|
||||
import com.shuwen.data.entity.manage.api.entity.base.AbstractRequest;
|
||||
import com.shuwen.data.entity.manage.dao.model.EntityRegisterPpl;
|
||||
|
||||
/**
|
||||
* <p>文件名称:PplRegisterSingleReqDto.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-09-20</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class PplRegisterSingleReqDto extends AbstractRequest {
|
||||
private String project;
|
||||
private String name;
|
||||
private String gender;
|
||||
private String occupation;
|
||||
private String birthDate;
|
||||
private String foreignName;
|
||||
private String alias;
|
||||
private String nation;
|
||||
private String homePlace;
|
||||
private String identity;
|
||||
private String workOrg;
|
||||
private String majorWork;
|
||||
private String summary;
|
||||
private String content;
|
||||
private String bizInfo;
|
||||
|
||||
public EntityRegisterPpl generateDao() {
|
||||
EntityRegisterPpl ppl = new EntityRegisterPpl();
|
||||
ppl.setProject(project);
|
||||
|
||||
ppl.setName(name);
|
||||
ppl.setGender(gender);
|
||||
ppl.setOccupation(occupation);
|
||||
ppl.setBirthDate(birthDate);
|
||||
|
||||
ppl.setForeignName(foreignName);
|
||||
ppl.setAlias(alias);
|
||||
ppl.setNation(nation);
|
||||
ppl.setHomePlace(homePlace);
|
||||
ppl.setIdentity(identity);
|
||||
ppl.setWorkOrg(workOrg);
|
||||
ppl.setMajorWork(majorWork);
|
||||
ppl.setSummary(summary);
|
||||
ppl.setContent(content);
|
||||
ppl.setBizInfo(bizInfo);
|
||||
return ppl;
|
||||
}
|
||||
|
||||
public String getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(String project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getOccupation() {
|
||||
return occupation;
|
||||
}
|
||||
|
||||
public void setOccupation(String occupation) {
|
||||
this.occupation = occupation;
|
||||
}
|
||||
|
||||
public String getBirthDate() {
|
||||
return birthDate;
|
||||
}
|
||||
|
||||
public void setBirthDate(String birthDate) {
|
||||
this.birthDate = birthDate;
|
||||
}
|
||||
|
||||
public String getForeignName() {
|
||||
return foreignName;
|
||||
}
|
||||
|
||||
public void setForeignName(String foreignName) {
|
||||
this.foreignName = foreignName;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return alias;
|
||||
}
|
||||
|
||||
public void setAlias(String alias) {
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
public String getNation() {
|
||||
return nation;
|
||||
}
|
||||
|
||||
public void setNation(String nation) {
|
||||
this.nation = nation;
|
||||
}
|
||||
|
||||
public String getHomePlace() {
|
||||
return homePlace;
|
||||
}
|
||||
|
||||
public void setHomePlace(String homePlace) {
|
||||
this.homePlace = homePlace;
|
||||
}
|
||||
|
||||
public String getIdentity() {
|
||||
return identity;
|
||||
}
|
||||
|
||||
public void setIdentity(String identity) {
|
||||
this.identity = identity;
|
||||
}
|
||||
|
||||
public String getWorkOrg() {
|
||||
return workOrg;
|
||||
}
|
||||
|
||||
public void setWorkOrg(String workOrg) {
|
||||
this.workOrg = workOrg;
|
||||
}
|
||||
|
||||
public String getMajorWork() {
|
||||
return majorWork;
|
||||
}
|
||||
|
||||
public void setMajorWork(String majorWork) {
|
||||
this.majorWork = majorWork;
|
||||
}
|
||||
|
||||
public String getSummary() {
|
||||
return summary;
|
||||
}
|
||||
|
||||
public void setSummary(String summary) {
|
||||
this.summary = summary;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getBizInfo() {
|
||||
return bizInfo;
|
||||
}
|
||||
|
||||
public void setBizInfo(String bizInfo) {
|
||||
this.bizInfo = bizInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.shuwen.data.entity.manage.web.entity.dto.base;
|
||||
|
||||
import com.shuwen.data.entity.manage.dao.model.EntityRegisterPpl;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>文件名称:PplEntity.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-29</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class PplEntity<T> extends EntityRegisterPpl {
|
||||
private List<T> items;
|
||||
|
||||
public static PplEntity generate(EntityRegisterPpl ppl) {
|
||||
PplEntity pplEntity = new PplEntity();
|
||||
|
||||
pplEntity.setId(ppl.getId());
|
||||
pplEntity.setProject(ppl.getProject());
|
||||
|
||||
pplEntity.setName(ppl.getName());
|
||||
pplEntity.setGender(ppl.getGender());
|
||||
pplEntity.setOccupation(ppl.getOccupation());
|
||||
pplEntity.setBirthDate(ppl.getBirthDate());
|
||||
|
||||
pplEntity.setForeignName(ppl.getForeignName());
|
||||
pplEntity.setAlias(ppl.getAlias());
|
||||
pplEntity.setNation(ppl.getNation());
|
||||
pplEntity.setHomePlace(ppl.getHomePlace());
|
||||
pplEntity.setIdentity(ppl.getIdentity());
|
||||
pplEntity.setWorkOrg(ppl.getWorkOrg());
|
||||
pplEntity.setMajorWork(ppl.getMajorWork());
|
||||
pplEntity.setSummary(ppl.getSummary());
|
||||
pplEntity.setContent(ppl.getContent());
|
||||
pplEntity.setBizInfo(ppl.getBizInfo());
|
||||
return pplEntity;
|
||||
}
|
||||
|
||||
public List<T> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<T> items) {
|
||||
this.items = items;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.shuwen.data.entity.manage.web.entity.dto.common;
|
||||
|
||||
import com.shuwen.data.entity.manage.api.entity.base.AbstractRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>文件名称:CancelReqDto.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-09-20</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class CancelReqDto extends AbstractRequest {
|
||||
private List<String> ids;
|
||||
|
||||
public List<String> getIds() {
|
||||
return ids;
|
||||
}
|
||||
|
||||
public void setIds(List<String> ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.shuwen.data.entity.manage.web.entity.dto.common;
|
||||
|
||||
import com.shuwen.data.entity.manage.api.entity.base.AbstractRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>文件名称:PplRegisterSingleReqDto.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-09-20</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ReregisterReqDto extends AbstractRequest {
|
||||
private List<String> ids;
|
||||
|
||||
public List<String> getIds() {
|
||||
return ids;
|
||||
}
|
||||
|
||||
public void setIds(List<String> ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.shuwen.data.entity.manage.web.entity.dto.common;
|
||||
|
||||
import com.shuwen.data.entity.manage.api.entity.base.AbstractRequest;
|
||||
import com.shuwen.data.entity.manage.api.entity.enums.AmbiguousStatusEnum;
|
||||
import com.shuwen.data.entity.manage.api.entity.enums.SearchModeEnum;
|
||||
|
||||
/**
|
||||
* <p>文件名称:TaskReqDto.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-26</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class SearchReqDto extends AbstractRequest {
|
||||
private String query;
|
||||
private SearchModeEnum mode = SearchModeEnum.MATCH;
|
||||
|
||||
public String getQuery() {
|
||||
return query;
|
||||
}
|
||||
|
||||
public void setQuery(String query) {
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
public SearchModeEnum getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public void setMode(SearchModeEnum mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.shuwen.data.entity.manage.web.entity.dto.common;
|
||||
|
||||
import com.shuwen.data.entity.manage.api.entity.base.AbstractRequest;
|
||||
import com.shuwen.data.entity.manage.api.entity.enums.AmbiguousStatusEnum;
|
||||
|
||||
/**
|
||||
* <p>文件名称:TaskReqDto.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-26</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class TaskReqDto extends AbstractRequest {
|
||||
private String project;
|
||||
private AmbiguousStatusEnum status;
|
||||
private Integer from;
|
||||
private Integer size;
|
||||
|
||||
public String getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(String project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public AmbiguousStatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(AmbiguousStatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
public void setFrom(Integer from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
public Integer getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Integer size) {
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.shuwen.data.entity.manage.web.entity.template;
|
||||
|
||||
/**
|
||||
* <p>文件名称:BaseTemplate.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-25</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public abstract class BaseTemplate<T> {
|
||||
protected static final byte SPLIT_CHAR[] = {0x01};
|
||||
|
||||
public abstract T generate();
|
||||
|
||||
public abstract Boolean invalid();
|
||||
|
||||
public abstract String fingerprint();
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
package com.shuwen.data.entity.manage.web.entity.template;
|
||||
|
||||
import com.shuwen.data.entity.manage.dao.model.EntityRegisterPpl;
|
||||
import com.shuwen.data.entity.manage.web.entity.annotation.ExcelField;
|
||||
import com.shuwen.data.entity.manage.web.entity.dto.PplRegisterSingleReqDto;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* <p>文件名称:EntityPplTemplate.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-24</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class EntityPplTemplate extends BaseTemplate<PplRegisterSingleReqDto> {
|
||||
|
||||
@ExcelField(column = 0, required = true)
|
||||
private String name;
|
||||
|
||||
@ExcelField(column = 1)
|
||||
private String foreignName;
|
||||
|
||||
@ExcelField(column = 2)
|
||||
private String alias;
|
||||
|
||||
@ExcelField(column = 3, required = true)
|
||||
private String gender;
|
||||
|
||||
@ExcelField(column = 4)
|
||||
private String birthDate;
|
||||
|
||||
@ExcelField(column = 5)
|
||||
private String nation;
|
||||
|
||||
@ExcelField(column = 6)
|
||||
private String homePlace;
|
||||
|
||||
@ExcelField(column = 7, required = true)
|
||||
private String occupation;
|
||||
|
||||
@ExcelField(column = 8)
|
||||
private String identity;
|
||||
|
||||
@ExcelField(column = 9)
|
||||
private String workOrg;
|
||||
|
||||
@ExcelField(column = 10)
|
||||
private String majorWork;
|
||||
|
||||
@ExcelField(column = 11)
|
||||
private String summary;
|
||||
|
||||
@ExcelField(column = 12)
|
||||
private String content;
|
||||
|
||||
@ExcelField(column = 13)
|
||||
private String bizInfo;
|
||||
|
||||
public EntityPplTemplate() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PplRegisterSingleReqDto generate() {
|
||||
PplRegisterSingleReqDto ppl = new PplRegisterSingleReqDto();
|
||||
ppl.setName(name);
|
||||
ppl.setGender(gender);
|
||||
ppl.setOccupation(occupation);
|
||||
|
||||
ppl.setForeignName(foreignName);
|
||||
ppl.setAlias(alias);
|
||||
ppl.setBirthDate(birthDate);
|
||||
ppl.setNation(nation);
|
||||
ppl.setHomePlace(homePlace);
|
||||
ppl.setIdentity(identity);
|
||||
ppl.setWorkOrg(workOrg);
|
||||
ppl.setMajorWork(majorWork);
|
||||
ppl.setSummary(summary);
|
||||
ppl.setContent(content);
|
||||
ppl.setBizInfo(bizInfo);
|
||||
return ppl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean invalid() {
|
||||
return StringUtils.isEmpty(name)
|
||||
|| StringUtils.isEmpty(gender)
|
||||
|| StringUtils.isEmpty(occupation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String fingerprint() {
|
||||
return name.trim() + new String(SPLIT_CHAR) +
|
||||
gender.trim() + new String(SPLIT_CHAR) +
|
||||
occupation.trim() + new String(SPLIT_CHAR) +
|
||||
(StringUtils.isEmpty(birthDate) ? "" : birthDate);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getForeignName() {
|
||||
return foreignName;
|
||||
}
|
||||
|
||||
public void setForeignName(String foreignName) {
|
||||
this.foreignName = foreignName;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return alias;
|
||||
}
|
||||
|
||||
public void setAlias(String alias) {
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getBirthDate() {
|
||||
return birthDate;
|
||||
}
|
||||
|
||||
public void setBirthDate(String birthDate) {
|
||||
this.birthDate = birthDate;
|
||||
}
|
||||
|
||||
public String getNation() {
|
||||
return nation;
|
||||
}
|
||||
|
||||
public void setNation(String nation) {
|
||||
this.nation = nation;
|
||||
}
|
||||
|
||||
public String getHomePlace() {
|
||||
return homePlace;
|
||||
}
|
||||
|
||||
public void setHomePlace(String homePlace) {
|
||||
this.homePlace = homePlace;
|
||||
}
|
||||
|
||||
public String getOccupation() {
|
||||
return occupation;
|
||||
}
|
||||
|
||||
public void setOccupation(String occupation) {
|
||||
this.occupation = occupation;
|
||||
}
|
||||
|
||||
public String getIdentity() {
|
||||
return identity;
|
||||
}
|
||||
|
||||
public void setIdentity(String identity) {
|
||||
this.identity = identity;
|
||||
}
|
||||
|
||||
public String getWorkOrg() {
|
||||
return workOrg;
|
||||
}
|
||||
|
||||
public void setWorkOrg(String workOrg) {
|
||||
this.workOrg = workOrg;
|
||||
}
|
||||
|
||||
public String getMajorWork() {
|
||||
return majorWork;
|
||||
}
|
||||
|
||||
public void setMajorWork(String majorWork) {
|
||||
this.majorWork = majorWork;
|
||||
}
|
||||
|
||||
public String getSummary() {
|
||||
return summary;
|
||||
}
|
||||
|
||||
public void setSummary(String summary) {
|
||||
this.summary = summary;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getBizInfo() {
|
||||
return bizInfo;
|
||||
}
|
||||
|
||||
public void setBizInfo(String bizInfo) {
|
||||
this.bizInfo = bizInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.shuwen.data.entity.manage.web.integration.diamond;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.taobao.diamond.client.Diamond;
|
||||
import com.taobao.diamond.manager.ManagerListenerAdapter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>文件名称:SelectorListener.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-07-13</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class SelectorListener {
|
||||
private Logger logger = LoggerFactory.getLogger(SelectorListener.class);
|
||||
|
||||
private static final String GROUP = "entity_manage";
|
||||
private static final String DATA_ORG_TYPE = "org_type";
|
||||
private static final String DATA_NATION = "nation";
|
||||
private static final String DATA_PPL_IDENTITY = "ppl_identity";
|
||||
private static final String DATA_PROJECT = "project";
|
||||
private static final int TIMEOUT = 1000;
|
||||
|
||||
public static List<String> project;
|
||||
public static List<String> nation;
|
||||
public static List<String> orgType;
|
||||
public static List<String> pplIdentity;
|
||||
|
||||
static {
|
||||
Diamond.addListener(DATA_PROJECT, GROUP, new ManagerListenerAdapter() {
|
||||
@Override
|
||||
public void receiveConfigInfo(String configInfo) {
|
||||
try {
|
||||
project = JSON.parseArray(Diamond.getConfig(DATA_PROJECT, GROUP, TIMEOUT), String.class);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Diamond.addListener(DATA_NATION, GROUP, new ManagerListenerAdapter() {
|
||||
@Override
|
||||
public void receiveConfigInfo(String configInfo) {
|
||||
try {
|
||||
nation = JSON.parseArray(Diamond.getConfig(DATA_NATION, GROUP, TIMEOUT), String.class);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Diamond.addListener(DATA_ORG_TYPE, GROUP, new ManagerListenerAdapter() {
|
||||
@Override
|
||||
public void receiveConfigInfo(String configInfo) {
|
||||
try {
|
||||
orgType = JSON.parseArray(Diamond.getConfig(DATA_ORG_TYPE, GROUP, TIMEOUT), String.class);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Diamond.addListener(DATA_PPL_IDENTITY, GROUP, new ManagerListenerAdapter() {
|
||||
@Override
|
||||
public void receiveConfigInfo(String configInfo) {
|
||||
try {
|
||||
pplIdentity = JSON.parseArray(Diamond.getConfig(DATA_PPL_IDENTITY, GROUP, TIMEOUT), String.class);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.shuwen.data.entity.manage.web.service;
|
||||
|
||||
import com.shuwen.data.entity.manage.dao.util.BasicMapper;
|
||||
import org.apache.ibatis.session.RowBounds;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>文件名称:BaseService.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-13</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public abstract class BaseService<T> implements IService<T> {
|
||||
|
||||
public abstract BasicMapper<T> getMapper();
|
||||
|
||||
public int insert(T entity) {
|
||||
return getMapper().insert(entity);
|
||||
}
|
||||
|
||||
public int insert(List<T> entityList) {
|
||||
return getMapper().insertList(entityList);
|
||||
}
|
||||
|
||||
public int delete(Object key) {
|
||||
return getMapper().deleteByPrimaryKey(key);
|
||||
}
|
||||
|
||||
public int deleteByExample(Example example) {
|
||||
return getMapper().deleteByExample(example);
|
||||
}
|
||||
|
||||
public int update(T entity) {
|
||||
return getMapper().updateByPrimaryKeySelective(entity);
|
||||
}
|
||||
|
||||
public int updateByExample(T entity, Example example) {
|
||||
return getMapper().updateByExampleSelective(entity, example);
|
||||
}
|
||||
|
||||
public T selectByPK(Object key) {
|
||||
return getMapper().selectByPrimaryKey(key);
|
||||
}
|
||||
|
||||
public List<T> selectByExample(Example example) {
|
||||
return getMapper().selectByExample(example);
|
||||
}
|
||||
|
||||
public List<T> selectByExample(Example example, RowBounds rowBounds) {
|
||||
return getMapper().selectByExampleAndRowBounds(example, rowBounds);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.shuwen.data.entity.manage.web.service;
|
||||
|
||||
import com.shuwen.data.entity.manage.api.entity.exception.EntityServiceException;
|
||||
import com.shuwen.data.entity.manage.web.entity.ImportResult;
|
||||
import com.shuwen.data.entity.manage.web.entity.template.BaseTemplate;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>文件名称:IResolveExcelService.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-17</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface IResolveExcelService<T> {
|
||||
/**
|
||||
* 解析Excel
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 得到的结果
|
||||
* @throws EntityServiceException 业务异常统一处理
|
||||
*/
|
||||
ImportResult<T> resolveExcel(MultipartFile file, Class<? extends BaseTemplate<T>> clazz) throws EntityServiceException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.shuwen.data.entity.manage.web.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>文件名称:IService.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-13</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@Service
|
||||
public interface IService<T> {
|
||||
|
||||
int insert(T entity);
|
||||
|
||||
int insert(List<T> entity);
|
||||
|
||||
int delete(Object key);
|
||||
|
||||
int update(T entity);
|
||||
|
||||
T selectByPK(Object key);
|
||||
|
||||
List<T> selectByExample(Example example);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.shuwen.data.entity.manage.web.service.db;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.shuwen.data.entity.manage.dao.mapper.EntityRegisterPplMapper;
|
||||
import com.shuwen.data.entity.manage.dao.model.EntityRegisterPpl;
|
||||
import com.shuwen.data.entity.manage.dao.util.BasicMapper;
|
||||
import com.shuwen.data.entity.manage.web.service.BaseService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>文件名称:EntityPplService.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-13</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
//implements IEntityPplService
|
||||
@Service("entityPplService")
|
||||
public class EntityPplService extends BaseService<EntityRegisterPpl> {
|
||||
|
||||
@Resource
|
||||
private EntityRegisterPplMapper mapper;
|
||||
|
||||
@Override
|
||||
public BasicMapper<EntityRegisterPpl> getMapper() {
|
||||
return mapper;
|
||||
}
|
||||
|
||||
|
||||
// public List<EntityRegisterPpl> getAll(EntityRegisterPpl entityPpl) {
|
||||
// if (entityPpl.getPage() != null && entityPpl.getRows() != null) {
|
||||
// PageHelper.startPage(entityPpl.getPage(), entityPpl.getRows());
|
||||
// }
|
||||
// Example example = new Example(EntityRegisterPpl.class);
|
||||
// return mapper.selectByExample(example);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.shuwen.data.entity.manage.web.service.db;
|
||||
|
||||
import com.shuwen.data.entity.manage.dao.mapper.EntityRegisterSimPplMapper;
|
||||
import com.shuwen.data.entity.manage.dao.model.EntityRegisterSimPpl;
|
||||
import com.shuwen.data.entity.manage.dao.util.BasicMapper;
|
||||
import com.shuwen.data.entity.manage.web.service.BaseService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* <p>文件名称:EntityPplService.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-13</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@Service("entitySimPplService")
|
||||
public class EntitySimPplService extends BaseService<EntityRegisterSimPpl> {
|
||||
|
||||
@Resource
|
||||
private EntityRegisterSimPplMapper mapper;
|
||||
|
||||
@Override
|
||||
public BasicMapper<EntityRegisterSimPpl> getMapper() {
|
||||
return mapper;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.shuwen.data.entity.manage.web.service.external;
|
||||
|
||||
import com.shuwen.data.entity.manage.api.entity.base.RespDto;
|
||||
import com.shuwen.data.entity.manage.dao.model.EntityRegisterSimPpl;
|
||||
import com.shuwen.data.entity.manage.web.entity.EntityAmbiguous;
|
||||
import com.shuwen.data.entity.manage.web.entity.dto.PplRegisterSingleReqDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>文件名称:EntityDisambiguateService.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-24</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@Service("entityAmbiguousService")
|
||||
public class EntityAmbiguousService {
|
||||
public RespDto<List<EntityAmbiguous<EntityRegisterSimPpl>>> entityPplDisambiguate(List<PplRegisterSingleReqDto> ppls) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.shuwen.data.entity.manage.web.service.resolve;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.shuwen.data.entity.manage.api.entity.enums.ReturnCodeEnum;
|
||||
import com.shuwen.data.entity.manage.api.entity.exception.EntityServiceException;
|
||||
import com.shuwen.data.entity.manage.web.entity.ImportResult;
|
||||
import com.shuwen.data.entity.manage.web.entity.annotation.ExcelField;
|
||||
import com.shuwen.data.entity.manage.web.entity.template.BaseTemplate;
|
||||
import com.shuwen.data.entity.manage.web.service.IResolveExcelService;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.beans.IntrospectionException;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>文件名称:ResolveExcelService.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-17</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@Service("resolveExcelService")
|
||||
public class ResolveExcelService<T> implements IResolveExcelService<T> {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ResolveExcelService.class);
|
||||
|
||||
private static final String SUFFIX_2003 = ".xls";
|
||||
private static final String SUFFIX_2007 = ".xlsx";
|
||||
|
||||
@Override
|
||||
public ImportResult<T> resolveExcel(MultipartFile file, Class<? extends BaseTemplate<T>> clazz) throws EntityServiceException {
|
||||
int total = 0;
|
||||
int success = 0;
|
||||
int duplicate = 0;
|
||||
int invalid = 0;
|
||||
List<T> items = new ArrayList<>();
|
||||
|
||||
if (file == null || file.getOriginalFilename() == null) {
|
||||
LOG.error("service|resolve|file|null");
|
||||
throw new EntityServiceException(ReturnCodeEnum.RESOLVE_EXCEL);
|
||||
}
|
||||
String filename = file.getOriginalFilename();
|
||||
Workbook workbook = null;
|
||||
Map<Integer, Method> fieldMapper = new HashMap<>();
|
||||
Set<String> fingerSet = new HashSet<>();
|
||||
|
||||
try {
|
||||
if (filename.endsWith(SUFFIX_2003)) {
|
||||
workbook = new HSSFWorkbook(file.getInputStream());
|
||||
} else if (filename.endsWith(SUFFIX_2007)) {
|
||||
workbook = new XSSFWorkbook(file.getInputStream());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.error("service|resolve|", e);
|
||||
throw new EntityServiceException(ReturnCodeEnum.RESOLVE_EXCEL);
|
||||
}
|
||||
if (workbook == null) {
|
||||
LOG.error("service|resolve|workbook|null");
|
||||
throw new EntityServiceException(ReturnCodeEnum.RESOLVE_EXCEL);
|
||||
}
|
||||
|
||||
try {
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
ExcelField excelField = field.getAnnotation(ExcelField.class);
|
||||
String fieldName = field.getName();
|
||||
PropertyDescriptor pd = new PropertyDescriptor(fieldName, clazz);
|
||||
fieldMapper.put(excelField.column(), pd.getWriteMethod());
|
||||
}
|
||||
} catch (IntrospectionException e) {
|
||||
LOG.error("service|resolve|template|", e);
|
||||
throw new EntityServiceException(ReturnCodeEnum.RESOLVE_EXCEL);
|
||||
}
|
||||
|
||||
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
|
||||
Sheet sheet = workbook.getSheetAt(i);
|
||||
|
||||
//第一行是标题,从1开始
|
||||
for (int j = 1; j <= sheet.getLastRowNum(); j++) {
|
||||
try {
|
||||
BaseTemplate<T> obj = clazz.newInstance();
|
||||
Row row = sheet.getRow(j);
|
||||
fieldMapper.forEach((column, method) -> {
|
||||
try {
|
||||
if (row.getCell(column) != null)
|
||||
method.invoke(obj, row.getCell(column).getStringCellValue());
|
||||
} catch (Exception e) {
|
||||
LOG.error("service|resolve|", e);
|
||||
}
|
||||
});
|
||||
if (obj.invalid()) {
|
||||
invalid++;
|
||||
LOG.error("service|resolve|invalid|", JSON.toJSON(obj));
|
||||
} else {
|
||||
if (fingerSet.contains(obj.fingerprint())) {
|
||||
duplicate++;
|
||||
} else {
|
||||
success++;
|
||||
fingerSet.add(obj.fingerprint());
|
||||
items.add(obj.generate());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("service|resolve|", e);
|
||||
throw new EntityServiceException(ReturnCodeEnum.RESOLVE_EXCEL);
|
||||
}
|
||||
}
|
||||
total += sheet.getLastRowNum();
|
||||
}
|
||||
return new ImportResult<>(items, total, success, invalid, duplicate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.shuwen.data.entity.manage.web.support.interceptor;
|
||||
|
||||
import com.shuwen.dingtalksso.client.DingtalkSSOClient;
|
||||
import com.shuwen.dingtalksso.pojo.UserInfo;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* <p>文件名称:DingLoginInterceptor.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-10-16</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class DingLoginInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
UserInfo user = DingtalkSSOClient.getUserInfo(request);
|
||||
if (user != null) {
|
||||
request.getSession().setAttribute("user", user);
|
||||
return true;
|
||||
} else {
|
||||
// 跳转去登录页面
|
||||
DingtalkSSOClient.doLogin(request, response);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||
ModelAndView modelAndView) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
|
||||
throws Exception {
|
||||
|
||||
}
|
||||
}
|
||||
25
entity-manage-web/src/main/resources/application-context.xml
Normal file
25
entity-manage-web/src/main/resources/application-context.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
|
||||
|
||||
<import resource="classpath:dubbo/dubbo.consumer.xml" />
|
||||
|
||||
<mvc:interceptors>
|
||||
<mvc:interceptor>
|
||||
<mvc:mapping path="/**" />
|
||||
|
||||
<mvc:exclude-mapping path="/ok" />
|
||||
<mvc:exclude-mapping path="/error" />
|
||||
<mvc:exclude-mapping path="/favicon.ico" />
|
||||
<mvc:exclude-mapping path="/assets/**" />
|
||||
|
||||
<bean name="codeInterceptor"
|
||||
class="com.shuwen.data.entity.manage.web.support.interceptor.DingLoginInterceptor">
|
||||
</bean>
|
||||
</mvc:interceptor>
|
||||
</mvc:interceptors>
|
||||
</beans>
|
||||
46
entity-manage-web/src/main/resources/application.properties
Normal file
46
entity-manage-web/src/main/resources/application.properties
Normal file
@@ -0,0 +1,46 @@
|
||||
spring.jackson.mapper.ACCEPT_CASE_INSENSITIVE_ENUMS=true
|
||||
|
||||
# 数据源配置
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
spring.datasource.url=@db.url@
|
||||
spring.datasource.username=@db.username@
|
||||
spring.datasource.password=@db.password@
|
||||
spring.datasource.druid.connection-init-sqls=SET NAMES utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
spring.datasource.druid.filters=config
|
||||
spring.datasource.druid.connectionProperties=config.decrypt=true;config.decrypt.key=@db.publickey@
|
||||
spring.datasource.druid.min-idle=5
|
||||
spring.datasource.druid.max-active=10
|
||||
spring.datasource.druid.validation-query=SELECT 1
|
||||
spring.datasource.druid.test-while-idle=true
|
||||
|
||||
# prometheus
|
||||
management.endpoint.metrics.enabled=true
|
||||
management.endpoints.web.exposure.include=*
|
||||
management.endpoint.prometheus.enabled=true
|
||||
management.endpoints.web.base-path=/
|
||||
management.endpoints.web.path-mapping.prometheus=/prometheus
|
||||
management.metrics.export.prometheus.enabled=true
|
||||
|
||||
# mybatis
|
||||
mybatis.mapper-locations=classpath:mapper/*.xml
|
||||
mybatis.type-aliases-package=com.shuwen.data.entity.manage.dao.model
|
||||
#mybatis.config-location=classpath:mybatis/mybatis-config.xml
|
||||
|
||||
mapper.mappers=com.shuwen.data.entity.manage.dao.util.BasicMapper
|
||||
mapper.not-empty=false
|
||||
mapper.identity=MYSQL
|
||||
|
||||
# pagehelper分页插件
|
||||
pagehelper.helper-dialect=mysql
|
||||
pagehelper.reasonable=true
|
||||
pagehelper.supportMethodsArguments=true
|
||||
pagehelper.params=count=countSql
|
||||
|
||||
server.port=17070
|
||||
|
||||
# thymeleaf
|
||||
spring.thymeleaf.cache=false
|
||||
spring.thymeleaf.check-template-location=true
|
||||
spring.thymeleaf.enabled=true
|
||||
spring.thymeleaf.encoding=utf-8
|
||||
33
entity-manage-web/src/main/resources/dubbo/dubbo.consumer.xml
Executable file
33
entity-manage-web/src/main/resources/dubbo/dubbo.consumer.xml
Executable file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
|
||||
|
||||
<dubbo:registry protocol="zookeeper" address="${dubbo.registry.address}"/>
|
||||
|
||||
<dubbo:application name="entity-manage"/>
|
||||
|
||||
<dubbo:protocol name="dubbo" serialization="hessian2"/>
|
||||
|
||||
<dubbo:reference protocol="dubbo" id="crudService" version="2.0" group="${dubbo.es.group}"
|
||||
interface="com.shuwen.search.proxy.api.service.ICrudService"
|
||||
filter="searchProxyConsumerFilter">
|
||||
<dubbo:parameter key="searchProxy.uid" value="y0PRg3NdybPKQJZ7pVp3cgiEiE"/>
|
||||
<dubbo:parameter key="searchProxy.project" value="kg"/>
|
||||
<dubbo:parameter key="searchProxy.indexGroup" value="entity"/>
|
||||
</dubbo:reference>
|
||||
|
||||
<dubbo:reference protocol="dubbo" id="filterService" version="2.0" group="${dubbo.es.group}"
|
||||
interface="com.shuwen.search.proxy.api.service.IFilterService"
|
||||
filter="searchProxyConsumerFilter">
|
||||
<dubbo:parameter key="searchProxy.uid" value="y0PRg3NdybPKQJZ7pVp3cgiEiE"/>
|
||||
<dubbo:parameter key="searchProxy.project" value="kg"/>
|
||||
<dubbo:parameter key="searchProxy.indexGroup" value="entity"/>
|
||||
</dubbo:reference>
|
||||
|
||||
<!--<dubbo:reference protocol="dubbo" id="bulkService" version="1.0.local"-->
|
||||
<!--interface="com.shuwen.search.proxy.api.service.IBulkService" check="false"/>-->
|
||||
|
||||
</beans>
|
||||
83
entity-manage-web/src/main/resources/logback.xml
Executable file
83
entity-manage-web/src/main/resources/logback.xml
Executable file
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<property name="stdPattern" value="%d{mm:ss} %-5level %logger{36} >>> %m%n"/>
|
||||
<property name="logPattern" value="%d{yyyy-MM-dd HH:mm:ss} %c{1} %L [%p] %m%n %caller{0}"/>
|
||||
<property name="LOG_HOME" value="${log.path}"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder charset="UTF-8">
|
||||
<pattern>${stdPattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="infoFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/info.log</file>
|
||||
<append>true</append>
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss} %c{1} %L [%p] %m%n %caller{0}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>INFO</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/info.log.%d{yyyy-MM-dd}</fileNamePattern>
|
||||
<maxHistory>7</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<appender name="errorFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/error.log</file>
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss} %c{1} %L [%p] %m%n %caller{0}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>ERROR</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/error.log.%d{yyyy-MM-dd}</fileNamePattern>
|
||||
<maxHistory>7</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<appender name="debugFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/debug.log</file>
|
||||
<append>true</append>
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss} %c{1} %L [%p] %m%n %caller{0}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>DEBUG</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/debug.log.%d{yyyy-MM-dd}</fileNamePattern>
|
||||
<maxHistory>7</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<logger name="com.shuwen.data.entity.manage.common" level="INFO" additivity="true">
|
||||
<appender-ref ref="infoFile"/>
|
||||
<appender-ref ref="errorFile"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.shuwen.data.entity.manage.dao" level="INFO" additivity="true">
|
||||
<appender-ref ref="infoFile"/>
|
||||
<appender-ref ref="errorFile"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.shuwen.data.entity.manage.web" level="DEBUG" additivity="true">
|
||||
<appender-ref ref="debugFile"/>
|
||||
<appender-ref ref="infoFile"/>
|
||||
<appender-ref ref="errorFile"/>
|
||||
</logger>
|
||||
|
||||
<root level="ERROR">
|
||||
<appender-ref ref="stdout"/>
|
||||
</root>
|
||||
</configuration>
|
||||
16
entity-manage-web/src/main/resources/templates/footer.html
Normal file
16
entity-manage-web/src/main/resources/templates/footer.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>王磊的博客</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div th:fragment="webcome(about)">
|
||||
<span th:text="'欢迎:'+${about}"></span>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
28
entity-manage-web/src/main/resources/templates/index.html
Normal file
28
entity-manage-web/src/main/resources/templates/index.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>王磊的博客</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<span th:if="${age} > 18">
|
||||
成年1
|
||||
</span>
|
||||
<span th:unless="${age > 18}">
|
||||
未成年
|
||||
</span>
|
||||
|
||||
<span th:text="|我叫${name},是一名开发工程师。|"></span>
|
||||
|
||||
<div th:switch="${age}">
|
||||
<span th:case="18">18岁</span>
|
||||
<span th:case="19">19岁</span>
|
||||
<spa th:case="*">其他</spa>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
18
entity-manage-web/src/main/resources/templates/upload.html
Normal file
18
entity-manage-web/src/main/resources/templates/upload.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>上传文件</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>文件上传测试</h1>
|
||||
<form method="POST" action="/entity/register/ppl/batch" enctype="multipart/form-data">
|
||||
<input type="text" name="project"/><br/><br/>
|
||||
<input type="file" name="file"/><br/><br/>
|
||||
<input type="submit" value="Submit"/>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.shuwen.data.entity.manage.web;
|
||||
|
||||
/**
|
||||
* <p>文件名称:ABC.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-09-28</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ABC {
|
||||
private Integer type;
|
||||
// private String _type;
|
||||
//
|
||||
// @JSONField(serialize=false,deserialize=false)
|
||||
// public String get_type() {
|
||||
// return _type;
|
||||
// }
|
||||
// @JSONField(serialize=false,deserialize=false)
|
||||
// public void set_type(String _type) {
|
||||
// this._type = _type;
|
||||
// }
|
||||
|
||||
// @JSONField(name="type")
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
// @JSONField(name="type")
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.shuwen.data.entity.manage.web;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.parser.Feature;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>文件名称:JsonTest.java</p>
|
||||
* <p>文件描述:</p>
|
||||
* <p>其他说明: </p>
|
||||
* <p>版权所有: 版权所有(C)2016-2099</p>
|
||||
* <p>公 司: 新华智云 </p>
|
||||
* <p>完成日期:2018-09-28</p>
|
||||
*
|
||||
* @author yangcongyu@shuwen.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class JsonTest {
|
||||
@Test
|
||||
public void json() {
|
||||
String abc = " {\"__type\":\"bbs\",\"type\":123}";
|
||||
ABC aa = JSONObject.parseObject(abc, ABC.class, Feature.DisableFieldSmartMatch);
|
||||
System.out.println(aa.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test1(){
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
// ((HashMap) headers).entrySet.iterator();
|
||||
headers.entrySet().iterator();
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
17
entity-manage-web/src/test/resources/logback-test.xml
Executable file
17
entity-manage-web/src/test/resources/logback-test.xml
Executable file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- %p级别 %m消息 %c.%M包+方法 %F:%L文件+行 -->
|
||||
<!--<property name="pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} | %p | %m | %c.%M | %F:%L %n"/>-->
|
||||
<property name="pattern" value="%d{mm:ss} %-5level %logger{36} >>> %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder charset="UTF-8">
|
||||
<pattern>${pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="stdout"/>
|
||||
</root>
|
||||
</configuration>
|
||||
19
entity-manage-web/src/test/resources/spring-test.xml
Executable file
19
entity-manage-web/src/test/resources/spring-test.xml
Executable file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<context:property-placeholder location="classpath*:search.query.config.properties" ignore-unresolvable="true"/>
|
||||
|
||||
<import resource="classpath*:es/sys.es.xml"/>
|
||||
|
||||
<context:component-scan base-package="com.shuwen.search.proxy"/>
|
||||
|
||||
<!--<hsf:consumer id="fenfaSearchServiceImpl"-->
|
||||
<!--interface="com.shuwen.search.proxy.api.service.IFenfaSearchService"-->
|
||||
<!--version="1.0.0.dev" group="search-group">-->
|
||||
<!--</hsf:consumer>-->
|
||||
</beans>
|
||||
163
pom.xml
Executable file
163
pom.xml
Executable file
@@ -0,0 +1,163 @@
|
||||
<?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>
|
||||
|
||||
<parent>
|
||||
<groupId>com.shuwen</groupId>
|
||||
<artifactId>bom</artifactId>
|
||||
<version>1.0.5</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.shuwen.data</groupId>
|
||||
<artifactId>entity-manage</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>entity-manage-api</module>
|
||||
<module>entity-manage-common</module>
|
||||
<module>entity-manage-dao</module>
|
||||
<module>entity-manage-web</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<spring-framework.version>5.0.9.RELEASE</spring-framework.version>
|
||||
<spring-boot.version>2.0.5.RELEASE</spring-boot.version>
|
||||
|
||||
<fastjson.version>1.2.49</fastjson.version>
|
||||
<guava.version>22.0</guava.version>
|
||||
<prometheus.version>0.3.0</prometheus.version>
|
||||
<zkclient.version>0.8</zkclient.version>
|
||||
|
||||
<search-proxy.version>1.0.1-SNAPSHOT</search-proxy.version>
|
||||
|
||||
<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>
|
||||
<mybatis-spring-boot>1.3.2</mybatis-spring-boot>
|
||||
<mapper-spring-boot>2.0.3</mapper-spring-boot>
|
||||
<pagehelper-spring-boot>1.2.5</pagehelper-spring-boot>
|
||||
|
||||
<poi.version>3.14</poi.version>
|
||||
<!--<diamond-spring-client>0.0.1-SNAPSHOT</diamond-spring-client>-->
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- project start -->
|
||||
<dependency>
|
||||
<groupId>com.shuwen.data</groupId>
|
||||
<artifactId>entity-manage-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.shuwen.data</groupId>
|
||||
<artifactId>entity-manage-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.shuwen.data</groupId>
|
||||
<artifactId>entity-manage-dao</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!-- project end -->
|
||||
|
||||
<!-- shuwen start -->
|
||||
<dependency>
|
||||
<groupId>com.shuwen.search</groupId>
|
||||
<artifactId>search-proxy-api</artifactId>
|
||||
<version>${search-proxy.version}</version>
|
||||
</dependency>
|
||||
<!-- shuwen end -->
|
||||
|
||||
<!-- db start -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>${mybatis-spring-boot}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
<artifactId>mapper-spring-boot-starter</artifactId>
|
||||
<version>${mapper-spring-boot}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>${pagehelper-spring-boot}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.1.9</version>
|
||||
</dependency>
|
||||
<!-- db end -->
|
||||
|
||||
<!-- poi start -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
<!-- poi end -->
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<!--<finalName>${project.artifactId}</finalName>-->
|
||||
<!--<resources>-->
|
||||
<!--<resource>-->
|
||||
<!--<directory>src/main/resources</directory>-->
|
||||
<!--<filtering>true</filtering>-->
|
||||
<!--</resource>-->
|
||||
<!--</resources>-->
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
Reference in New Issue
Block a user