Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jz-dmp-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姚本章
jz-dmp-service
Commits
9f5de5a1
Commit
9f5de5a1
authored
Jan 21, 2021
by
sml
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dmp_dev' of
http://gitlab.ioubuy.cn/yaobenzhang/jz-dmp-service.git
into dmp_dev
parents
adbb2fe5
060cb2ef
Changes
46
Show whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
3383 additions
and
668 deletions
+3383
-668
update.sql
database/mcb/update.sql
+2
-0
DmpDsAgentService.java
src/main/java/com/jz/agent/service/DmpDsAgentService.java
+6
-3
JsonResult.java
src/main/java/com/jz/common/constant/JsonResult.java
+43
-0
DelFlagEnum.java
src/main/java/com/jz/common/enums/DelFlagEnum.java
+58
-0
ServiceException.java
src/main/java/com/jz/common/exception/ServiceException.java
+2
-0
HttpClientUtils.java
src/main/java/com/jz/common/utils/web/HttpClientUtils.java
+626
-595
SessionUtils.java
src/main/java/com/jz/common/utils/web/SessionUtils.java
+16
-0
DataSourceController.java
...ules/controller/DataIntegration/DataSourceController.java
+15
-2
OfflineSynchController.java
...es/controller/DataIntegration/OfflineSynchController.java
+4
-4
RealTimeSyncController.java
...es/controller/DataIntegration/RealTimeSyncController.java
+28
-1
RealTimeSyncListDto.java
.../controller/DataIntegration/bean/RealTimeSyncListDto.java
+11
-0
SourceDbNameListDto.java
.../controller/DataIntegration/bean/SourceDbNameListDto.java
+2
-2
TaskListPageReq.java
...ules/controller/DataIntegration/bean/TaskListPageReq.java
+14
-0
DataDevTaskListDto.java
...les/controller/dataOperation/bean/DataDevTaskListDto.java
+14
-0
DataDevTaskListReq.java
...les/controller/dataOperation/bean/DataDevTaskListReq.java
+9
-9
DmpApiMangeController.java
...modules/controller/dataService/DmpApiMangeController.java
+243
-0
DmpApiServiceMangeController.java
.../controller/dataService/DmpApiServiceMangeController.java
+249
-0
DmpOrgMangeController.java
...modules/controller/dataService/DmpOrgMangeController.java
+154
-0
ApiInterfaceInfoListReq.java
.../controller/dataService/bean/ApiInterfaceInfoListReq.java
+25
-0
ApiInterfaceReq.java
.../modules/controller/dataService/bean/ApiInterfaceReq.java
+82
-0
AuthListInfoReq.java
.../modules/controller/dataService/bean/AuthListInfoReq.java
+38
-0
AuthUserApiReq.java
...p/modules/controller/dataService/bean/AuthUserApiReq.java
+42
-0
LogInfoListReq.java
...p/modules/controller/dataService/bean/LogInfoListReq.java
+23
-0
MakeBigDataApiReq.java
...odules/controller/dataService/bean/MakeBigDataApiReq.java
+113
-0
OrganizationManageAddReq.java
...controller/dataService/bean/OrganizationManageAddReq.java
+54
-0
OrganizationManageDetailQueryReq.java
...er/dataService/bean/OrganizationManageDetailQueryReq.java
+25
-0
OrganizationManageListQueryReq.java
...ller/dataService/bean/OrganizationManageListQueryReq.java
+30
-0
OrganizationManageUpdateReq.java
...troller/dataService/bean/OrganizationManageUpdateReq.java
+58
-0
SoureTableColumnsReq.java
...les/controller/dataService/bean/SoureTableColumnsReq.java
+79
-0
DmpRealtimeSyncInfoDao.java
...n/java/com/jz/dmp/modules/dao/DmpRealtimeSyncInfoDao.java
+8
-0
DmpSyncingDatasourceDao.java
.../java/com/jz/dmp/modules/dao/DmpSyncingDatasourceDao.java
+1
-1
OfflineSynchDao.java
src/main/java/com/jz/dmp/modules/dao/OfflineSynchDao.java
+6
-0
DmpApiMangeService.java
...n/java/com/jz/dmp/modules/service/DmpApiMangeService.java
+86
-0
DmpApiServiceMangeService.java
...com/jz/dmp/modules/service/DmpApiServiceMangeService.java
+74
-0
DmpOrgMangeService.java
...n/java/com/jz/dmp/modules/service/DmpOrgMangeService.java
+60
-0
DmpRealtimeSyncInfoService.java
...om/jz/dmp/modules/service/DmpRealtimeSyncInfoService.java
+17
-0
OfflineSynchService.java
.../java/com/jz/dmp/modules/service/OfflineSynchService.java
+64
-1
DmpApiMangeServiceImpl.java
...m/jz/dmp/modules/service/impl/DmpApiMangeServiceImpl.java
+346
-0
DmpApiServiceMangeServiceImpl.java
...p/modules/service/impl/DmpApiServiceMangeServiceImpl.java
+267
-0
DmpOrgMangeServiceImpl.java
...m/jz/dmp/modules/service/impl/DmpOrgMangeServiceImpl.java
+210
-0
DmpRealtimeSyncInfoServiceImpl.java
.../modules/service/impl/DmpRealtimeSyncInfoServiceImpl.java
+33
-0
DmpSyncingDatasourceServiceImpl.java
...modules/service/impl/DmpSyncingDatasourceServiceImpl.java
+15
-4
OfflineSynchServiceImpl.java
.../jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
+81
-13
DmpRealtimeSyncInfoMapper.xml
src/main/resources/mapper/dmp/DmpRealtimeSyncInfoMapper.xml
+26
-8
DmpSyncingDatasourceMapper.xml
src/main/resources/mapper/dmp/DmpSyncingDatasourceMapper.xml
+8
-3
OfflineSynchMapper.xml
src/main/resources/mapper/dmp/OfflineSynchMapper.xml
+16
-22
No files found.
database/mcb/update.sql
View file @
9f5de5a1
...
...
@@ -17,3 +17,5 @@ add jaas_address varchar(128) DEFAULT NULL COMMENT 'jaas地址(Kafka)',
add
krb5_address
varchar
(
128
)
DEFAULT
NULL
COMMENT
'krb5地址(Kafka)'
,
add
kudu_master
varchar
(
128
)
DEFAULT
NULL
COMMENT
'kkudu_master(Kudu)'
,
add
impala_master_fqdn
varchar
(
128
)
DEFAULT
NULL
COMMENT
'impala_master_fqdn(Kudu)'
;
alter
table
dmp_realtime_sync_info
add
online_status
char
(
1
)
default
'N'
comment
'上下线状态:Y 上线,N 下线'
;
src/main/java/com/jz/agent/service/DmpDsAgentService.java
View file @
9f5de5a1
...
...
@@ -6,10 +6,13 @@ import com.jz.dmp.modules.model.DmpAgentDatasourceInfo;
public
interface
DmpDsAgentService
{
//jdbc连接
public
DmpAgentResult
testConnect
(
DmpAgentDatasourceInfo
ds
);
//获取数据源表库名称
public
DmpAgentResult
getTableNameList
(
DmpAgentDatasourceInfo
ds
);
//获取数据源表字段
public
DmpAgentResult
getTableColumnList
(
DmpAgentDatasourceInfo
ds
,
String
tableName
);
public
DmpAgentResult
previewData
(
DmpAgentDatasourceInfo
ds
,
String
tableName
);
...
...
src/main/java/com/jz/common/constant/JsonResult.java
View file @
9f5de5a1
...
...
@@ -67,6 +67,49 @@ public class JsonResult<T> implements Serializable {
this
.
setMessage
(
message
);
}
public
static
JsonResult
<
Object
>
ok
()
{
JsonResult
<
Object
>
result
=
new
JsonResult
<>();
result
.
setCode
(
ResultCode
.
SUCCESS
);
result
.
setMessage
(
"成功!"
);
return
result
;
}
public
static
JsonResult
<
Object
>
ok
(
String
message
)
{
JsonResult
<
Object
>
result
=
new
JsonResult
<>();
result
.
setCode
(
ResultCode
.
SUCCESS
);
result
.
setMessage
(
message
);
return
result
;
}
public
static
JsonResult
<
Object
>
ok
(
Object
data
)
{
JsonResult
<
Object
>
result
=
new
JsonResult
<>();
result
.
setCode
(
ResultCode
.
SUCCESS
);
result
.
setMessage
(
"成功!"
);
result
.
setData
(
data
);
return
result
;
}
public
static
JsonResult
<
Object
>
error
()
{
JsonResult
<
Object
>
result
=
new
JsonResult
<>();
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
ResultCode
.
INTERNAL_SERVER_ERROR
.
msg
());
return
result
;
}
public
static
JsonResult
<
Object
>
error
(
String
message
)
{
JsonResult
<
Object
>
result
=
new
JsonResult
<>();
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
message
);
return
result
;
}
public
static
JsonResult
<
Object
>
error
(
ResultCode
code
,
String
message
)
{
JsonResult
<
Object
>
result
=
new
JsonResult
<>();
result
.
setCode
(
code
);
result
.
setMessage
(
message
);
return
result
;
}
public
void
setCodes
(
com
.
jz
.
dmp
.
agent
.
ResultCode
code
)
{
this
.
code
=
code
.
val
();
}
...
...
src/main/java/com/jz/common/enums/DelFlagEnum.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
common
.
enums
;
/**
* 删除标识
*
* @author Bellamy
* @since 2020-11-30 14:30:23
*/
public
enum
DelFlagEnum
{
/**
* 删除
*/
YES
(
"YES"
,
"0"
),
/**
* 未删除
*/
NO
(
"NO"
,
"1"
),
;
private
String
code
;
private
String
value
;
private
DelFlagEnum
(
String
code
,
String
value
)
{
this
.
code
=
code
;
this
.
value
=
value
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
public
static
DelFlagEnum
get
(
String
code
)
{
if
(
code
==
null
)
{
return
null
;
}
for
(
DelFlagEnum
status
:
values
())
{
if
(
status
.
getCode
().
equalsIgnoreCase
(
code
))
{
return
status
;
}
}
return
null
;
}
}
src/main/java/com/jz/common/exception/ServiceException.java
View file @
9f5de5a1
package
com
.
jz
.
common
.
exception
;
import
com.jz.common.constant.ResultCode
;
public
class
ServiceException
extends
Exception
{
private
static
final
long
serialVersionUID
=
1859731705152111160L
;
...
...
src/main/java/com/jz/common/utils/web/HttpClientUtils.java
View file @
9f5de5a1
package
com
.
jz
.
common
.
utils
.
web
;
import
com.alibaba.fastjson.JSONObject
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.NameValuePair
;
...
...
@@ -39,11 +40,9 @@ import java.util.*;
import
java.util.Map.Entry
;
/**
*
* @author hack2003
* @date 2016-10-18
* @version v1.0
*
*
@date 2016-10-18
*/
public
class
HttpClientUtils
{
...
...
@@ -78,7 +77,7 @@ public class HttpClientUtils {
// 只允许使用TLSv1协议
SSLConnectionSocketFactory
sslsf
=
new
SSLConnectionSocketFactory
(
sslcontext
,
new
String
[]
{
"TLSv1"
},
new
String
[]{
"TLSv1"
},
null
,
SSLConnectionSocketFactory
.
BROWSER_COMPATIBLE_HOSTNAME_VERIFIER
);
httpclient
=
HttpClients
.
custom
().
setSSLSocketFactory
(
sslsf
)
...
...
@@ -123,48 +122,44 @@ public class HttpClientUtils {
}
/**
* @discription:
* @param url 访问地址
* @param token 请求头中存放token
* @param json 请求数据体
* @return
* @discription:
* @date: 2019年10月25日
*/
public
static
String
postJsonData
(
String
url
,
String
token
,
String
json
){
public
static
String
postJsonData
(
String
url
,
String
token
,
String
json
)
{
LOGGER
.
info
(
"===================postJsonData start======================="
);
LOGGER
.
info
(
"url:"
+
url
);
LOGGER
.
info
(
"token:"
+
token
);
LOGGER
.
info
(
"json:"
+
json
);
LOGGER
.
info
(
"url:"
+
url
);
LOGGER
.
info
(
"token:"
+
token
);
LOGGER
.
info
(
"json:"
+
json
);
String
charset
=
"UTF-8"
;
String
charset
=
"UTF-8"
;
CloseableHttpClient
httpClient
=
null
;
HttpPost
httpPost
=
null
;
String
result
=
null
;
try
{
try
{
httpClient
=
HttpClients
.
createDefault
();
httpPost
=
new
HttpPost
(
url
);
RequestConfig
requestConfig
=
RequestConfig
.
custom
().
setSocketTimeout
(
50000
).
setConnectTimeout
(
50000
).
build
();
//设置请求和传输超时时间
httpPost
.
setConfig
(
requestConfig
);
httpPost
.
setHeader
(
"token"
,
token
);
StringEntity
se
=
new
StringEntity
(
json
,
"UTF-8"
);
StringEntity
se
=
new
StringEntity
(
json
,
"UTF-8"
);
se
.
setContentType
(
"application/json"
);
se
.
setContentEncoding
(
new
BasicHeader
(
HTTP
.
CONTENT_TYPE
,
"application/json"
));
httpPost
.
setEntity
(
se
);
LOGGER
.
info
(
"请求开始时间:"
+
System
.
currentTimeMillis
());
LOGGER
.
info
(
"请求开始时间:"
+
System
.
currentTimeMillis
());
HttpResponse
response
=
httpClient
.
execute
(
httpPost
);
LOGGER
.
info
(
"请求结束时间:"
+
System
.
currentTimeMillis
());
if
(
response
!=
null
)
{
LOGGER
.
info
(
"请求结束时间:"
+
System
.
currentTimeMillis
());
if
(
response
!=
null
)
{
HttpEntity
resEntity
=
response
.
getEntity
();
if
(
resEntity
!=
null
)
{
result
=
EntityUtils
.
toString
(
resEntity
,
charset
);
if
(
resEntity
!=
null
)
{
result
=
EntityUtils
.
toString
(
resEntity
,
charset
);
}
}
}
catch
(
Exception
ex
)
{
LOGGER
.
info
(
"异常捕捉请求结束时间:"
+
System
.
currentTimeMillis
());
}
catch
(
Exception
ex
)
{
LOGGER
.
info
(
"异常捕捉请求结束时间:"
+
System
.
currentTimeMillis
());
ex
.
printStackTrace
();
LOGGER
.
info
(
ex
.
getMessage
());
}
...
...
@@ -273,59 +268,97 @@ public class HttpClientUtils {
/**
* 发送 post请求访问本地应用并根据传递参数不同返回不同结果
* @return
*
* @return
* @throws IOException
* @throws ClientProtocolException
*/
public
static
String
post
(
String
url
,
String
json
)
{
String
charset
=
"UTF-8"
;
public
static
String
post
(
String
url
,
String
json
)
{
LOGGER
.
info
(
"===================POST request start======================="
);
LOGGER
.
info
(
"url:"
+
url
);
LOGGER
.
info
(
"json:"
+
json
);
String
charset
=
"UTF-8"
;
CloseableHttpClient
httpClient
=
null
;
HttpPost
httpPost
=
null
;
String
result
=
null
;
try
{
try
{
httpClient
=
HttpClients
.
createDefault
();
httpPost
=
new
HttpPost
(
url
);
RequestConfig
requestConfig
=
RequestConfig
.
custom
().
setSocketTimeout
(
50000
).
setConnectTimeout
(
50000
).
build
();
//设置请求和传输超时时间
httpPost
.
setConfig
(
requestConfig
);
StringEntity
se
=
new
StringEntity
(
json
,
"UTF-8"
);
StringEntity
se
=
new
StringEntity
(
json
,
"UTF-8"
);
se
.
setContentType
(
"application/json"
);
se
.
setContentEncoding
(
new
BasicHeader
(
HTTP
.
CONTENT_TYPE
,
"application/json"
));
System
.
out
.
println
(
"-------------"
+
JSONObject
.
toJSONString
(
se
));
System
.
out
.
println
(
"-------------"
+
JSONObject
.
toJSONString
(
se
));
httpPost
.
setEntity
(
se
);
HttpResponse
response
=
httpClient
.
execute
(
httpPost
);
if
(
response
!=
null
)
{
if
(
response
!=
null
)
{
HttpEntity
resEntity
=
response
.
getEntity
();
if
(
resEntity
!=
null
)
{
result
=
EntityUtils
.
toString
(
resEntity
,
charset
);
}
}
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
LOGGER
.
info
(
"===================POST request end======================="
);
return
result
;
}
/**
* 发送 post请求访问本地应用并根据传递参数不同返回不同结果
*
* @return
* @throws IOException
* @throws ClientProtocolException
*/
public
static
String
postFormUrlencoded
(
String
url
,
String
json
)
{
LOGGER
.
info
(
"===================POST request start======================="
);
LOGGER
.
info
(
"url:"
+
url
);
LOGGER
.
info
(
"json:"
+
json
);
String
charset
=
"UTF-8"
;
CloseableHttpClient
httpClient
=
null
;
HttpPost
httpPost
=
null
;
String
result
=
null
;
try
{
httpClient
=
HttpClients
.
createDefault
();
httpPost
=
new
HttpPost
(
url
);
RequestConfig
requestConfig
=
RequestConfig
.
custom
().
setSocketTimeout
(
50000
).
setConnectTimeout
(
50000
).
build
();
//设置请求和传输超时时间
httpPost
.
setConfig
(
requestConfig
);
/* StringEntity se = new StringEntity(json, "UTF-8");
se.setContentType("application/x-www-form-urlencoded");
se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/x-www-form-urlencoded"));
System.out.println("-------------" + JSONObject.toJSONString(se));httpPost.setEntity(se);*/
httpPost
.
setEntity
(
new
StringEntity
(
json
,
"UTF-8"
));
httpPost
.
setHeader
(
"Content-type"
,
"application/x-www-form-urlencoded"
);
HttpResponse
response
=
httpClient
.
execute
(
httpPost
);
if
(
response
!=
null
)
{
HttpEntity
resEntity
=
response
.
getEntity
();
if
(
resEntity
!=
null
)
{
result
=
EntityUtils
.
toString
(
resEntity
,
charset
);
if
(
resEntity
!=
null
)
{
result
=
EntityUtils
.
toString
(
resEntity
,
charset
);
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
LOGGER
.
info
(
"===================POST request end======================="
);
return
result
;
}
/**
* 带参
*
* @param url
* @param paramName
* @param json
* @return
*/
public
static
String
post
(
String
url
,
String
paramName
,
String
json
)
{
String
charset
=
"UTF-8"
;
public
static
String
post
(
String
url
,
String
paramName
,
String
json
)
{
String
charset
=
"UTF-8"
;
CloseableHttpClient
httpClient
=
null
;
HttpPost
httpPost
=
null
;
String
result
=
null
;
try
{
try
{
httpClient
=
HttpClients
.
createDefault
();
httpPost
=
new
HttpPost
(
url
);
RequestConfig
requestConfig
=
RequestConfig
.
custom
().
setSocketTimeout
(
3000
).
setConnectTimeout
(
3000
).
build
();
//设置请求和传输超时时间
...
...
@@ -342,16 +375,13 @@ public class HttpClientUtils {
// entityParam.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
httpPost
.
setEntity
(
entityParam
);
HttpResponse
response
=
httpClient
.
execute
(
httpPost
);
if
(
response
!=
null
)
{
if
(
response
!=
null
)
{
HttpEntity
resEntity
=
response
.
getEntity
();
if
(
resEntity
!=
null
)
{
result
=
EntityUtils
.
toString
(
resEntity
,
charset
);
if
(
resEntity
!=
null
)
{
result
=
EntityUtils
.
toString
(
resEntity
,
charset
);
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
return
result
;
...
...
@@ -360,48 +390,44 @@ public class HttpClientUtils {
/**
* 提交JSON参数
*
* @param url
* @param paramName
* @param json
* @return
*/
public
static
String
postJson
(
String
url
,
String
paramName
,
String
json
)
{
String
charset
=
"UTF-8"
;
public
static
String
postJson
(
String
url
,
String
paramName
,
String
json
)
{
String
charset
=
"UTF-8"
;
CloseableHttpClient
httpClient
=
null
;
HttpPost
httpPost
=
null
;
String
result
=
null
;
try
{
try
{
httpClient
=
HttpClients
.
createDefault
();
httpPost
=
new
HttpPost
(
url
);
RequestConfig
requestConfig
=
RequestConfig
.
custom
().
setSocketTimeout
(
3000
).
setConnectTimeout
(
3000
).
build
();
//设置请求和传输超时时间
httpPost
.
setConfig
(
requestConfig
);
StringEntity
se
=
new
StringEntity
(
json
,
"UTF-8"
);
StringEntity
se
=
new
StringEntity
(
json
,
"UTF-8"
);
se
.
setContentType
(
"application/json"
);
se
.
setContentEncoding
(
new
BasicHeader
(
HTTP
.
CONTENT_TYPE
,
"application/json"
));
httpPost
.
setEntity
(
se
);
HttpResponse
response
=
httpClient
.
execute
(
httpPost
);
if
(
response
!=
null
)
{
if
(
response
!=
null
)
{
HttpEntity
resEntity
=
response
.
getEntity
();
if
(
resEntity
!=
null
)
{
result
=
EntityUtils
.
toString
(
resEntity
,
charset
);
if
(
resEntity
!=
null
)
{
result
=
EntityUtils
.
toString
(
resEntity
,
charset
);
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
return
result
;
}
public
static
String
dopost
(
String
url
,
String
json
)
throws
ClientProtocolException
,
IOException
{
String
result
=
null
;
public
static
String
dopost
(
String
url
,
String
json
)
throws
ClientProtocolException
,
IOException
{
String
result
=
null
;
String
APPLICATION_JSON
=
"application/json"
;
String
charset
=
"UTF-8"
;
String
charset
=
"UTF-8"
;
// 将JSON进行UTF-8编码,以便传输中文
String
encoderJson
=
URLEncoder
.
encode
(
json
,
charset
);
CloseableHttpClient
httpclient
=
HttpClients
.
createDefault
();
...
...
@@ -409,15 +435,15 @@ public class HttpClientUtils {
httppost
.
addHeader
(
HTTP
.
CONTENT_TYPE
,
APPLICATION_JSON
);
StringEntity
stringEntity
=
new
StringEntity
(
encoderJson
);
stringEntity
.
setContentType
(
"text/json"
);
stringEntity
.
setContentEncoding
(
new
BasicHeader
(
HTTP
.
CONTENT_TYPE
,
APPLICATION_JSON
));
stringEntity
.
setContentEncoding
(
new
BasicHeader
(
HTTP
.
CONTENT_TYPE
,
APPLICATION_JSON
));
httppost
.
setEntity
(
stringEntity
);
//System.out.println("executing request " + httppost.getURI());
CloseableHttpResponse
response
=
httpclient
.
execute
(
httppost
);
if
(
response
.
getStatusLine
().
getStatusCode
()
==
200
)
{
HttpEntity
httpEntity
=
response
.
getEntity
();
if
(
httpEntity
!=
null
)
{
System
.
out
.
println
(
"Response content: "
+
EntityUtils
.
toString
(
httpEntity
,
charset
));
result
=
EntityUtils
.
toString
(
httpEntity
,
charset
);
System
.
out
.
println
(
"Response content: "
+
EntityUtils
.
toString
(
httpEntity
,
charset
));
result
=
EntityUtils
.
toString
(
httpEntity
,
charset
);
}
}
else
{
httppost
.
abort
();
...
...
@@ -433,24 +459,26 @@ public class HttpClientUtils {
return
result
;
}
/**http请求资源,json不编码
/**
* http请求资源,json不编码
*
* @param url
* @param json
* @return
* @throws ClientProtocolException
* @throws IOException
*/
public
static
String
dopostNoEncode
(
String
url
,
String
json
)
throws
ClientProtocolException
,
IOException
{
String
result
=
null
;
public
static
String
dopostNoEncode
(
String
url
,
String
json
)
throws
ClientProtocolException
,
IOException
{
String
result
=
null
;
String
APPLICATION_JSON
=
"application/json"
;
String
charset
=
"UTF-8"
;
String
charset
=
"UTF-8"
;
// 将JSON进行UTF-8编码,以便传输中文
CloseableHttpClient
httpclient
=
HttpClients
.
createDefault
();
HttpPost
httppost
=
new
HttpPost
(
url
);
httppost
.
addHeader
(
HTTP
.
CONTENT_TYPE
,
APPLICATION_JSON
);
StringEntity
stringEntity
=
new
StringEntity
(
json
,
charset
);
stringEntity
.
setContentType
(
"text/json"
);
stringEntity
.
setContentEncoding
(
new
BasicHeader
(
HTTP
.
CONTENT_TYPE
,
APPLICATION_JSON
));
stringEntity
.
setContentEncoding
(
new
BasicHeader
(
HTTP
.
CONTENT_TYPE
,
APPLICATION_JSON
));
httppost
.
setEntity
(
stringEntity
);
//System.out.println("executing request " + httppost.getURI());
CloseableHttpResponse
response
=
httpclient
.
execute
(
httppost
);
...
...
@@ -458,7 +486,7 @@ public class HttpClientUtils {
HttpEntity
httpEntity
=
response
.
getEntity
();
if
(
httpEntity
!=
null
)
{
//System.out.println("Response content: "+ EntityUtils.toString(httpEntity, charset));
result
=
EntityUtils
.
toString
(
httpEntity
,
charset
);
result
=
EntityUtils
.
toString
(
httpEntity
,
charset
);
}
}
else
{
httppost
.
abort
();
...
...
@@ -477,19 +505,17 @@ public class HttpClientUtils {
/**
* 发送 post请求访问本地应用并根据传递参数不同返回不同结果
* @return
*
* @return
* @throws IOException
* @throws ClientProtocolException
*/
public
static
String
postJson
(
String
url
,
com
.
alibaba
.
fastjson
.
JSONObject
json
)
{
String
charset
=
"UTF-8"
;
public
static
String
postJson
(
String
url
,
com
.
alibaba
.
fastjson
.
JSONObject
json
)
{
String
charset
=
"UTF-8"
;
CloseableHttpClient
httpClient
=
null
;
HttpPost
httpPost
=
null
;
String
result
=
null
;
try
{
try
{
httpClient
=
HttpClients
.
createDefault
();
httpPost
=
new
HttpPost
(
url
);
RequestConfig
requestConfig
=
RequestConfig
.
custom
().
setSocketTimeout
(
10000
).
setConnectTimeout
(
10000
).
build
();
//设置请求和传输超时时间
...
...
@@ -499,23 +525,19 @@ public class HttpClientUtils {
se
.
setContentEncoding
(
new
BasicHeader
(
HTTP
.
CONTENT_TYPE
,
"application/json"
));
httpPost
.
setEntity
(
se
);
HttpResponse
response
=
httpClient
.
execute
(
httpPost
);
if
(
response
!=
null
)
{
if
(
response
!=
null
)
{
HttpEntity
resEntity
=
response
.
getEntity
();
if
(
resEntity
!=
null
)
{
result
=
EntityUtils
.
toString
(
resEntity
,
charset
);
if
(
resEntity
!=
null
)
{
result
=
EntityUtils
.
toString
(
resEntity
,
charset
);
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
return
result
;
}
/**
* get请求,返回字节数组
*
...
...
@@ -561,16 +583,16 @@ public class HttpClientUtils {
try
{
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpResponse
response
=
httpClient
.
execute
(
httpGet
);
HttpEntity
resEntity
=
null
;
HttpEntity
resEntity
=
null
;
if
(
response
.
getStatusLine
().
getStatusCode
()
==
200
)
{
// 请求成功状态
resEntity
=
response
.
getEntity
();
}
if
(
resEntity
!=
null
){
if
(
resEntity
!=
null
)
{
responseContent
=
EntityUtils
.
toByteArray
(
resEntity
);
// result = EntityUtils.toString(resEntity,charset);
}
}
catch
(
Exception
e
)
{
LOGGER
.
info
(
"异常捕捉请求结束时间:"
+
System
.
currentTimeMillis
());
LOGGER
.
info
(
"异常捕捉请求结束时间:"
+
System
.
currentTimeMillis
());
e
.
printStackTrace
();
LOGGER
.
info
(
e
.
getMessage
());
}
...
...
@@ -580,53 +602,52 @@ public class HttpClientUtils {
/**
* @discription:
* @param url 访问地址
* @param token 请求头中存放token
* @param json 请求数据体
* @return
* @discription:
* @date: 2019年10月25日
*/
public
static
byte
[]
postJsonDataByByte
(
String
url
,
String
token
,
String
json
){
public
static
byte
[]
postJsonDataByByte
(
String
url
,
String
token
,
String
json
)
{
LOGGER
.
info
(
"===================postJsonDataByByte start======================="
);
LOGGER
.
info
(
"url:"
+
url
);
LOGGER
.
info
(
"token:"
+
token
);
LOGGER
.
info
(
"json:"
+
json
);
LOGGER
.
info
(
"url:"
+
url
);
LOGGER
.
info
(
"token:"
+
token
);
LOGGER
.
info
(
"json:"
+
json
);
String
charset
=
"UTF-8"
;
String
charset
=
"UTF-8"
;
CloseableHttpClient
httpClient
=
null
;
HttpPost
httpPost
=
null
;
String
result
=
null
;
byte
[]
responseContent
=
null
;
try
{
try
{
httpClient
=
HttpClients
.
createDefault
();
httpPost
=
new
HttpPost
(
url
);
RequestConfig
requestConfig
=
RequestConfig
.
custom
().
setSocketTimeout
(
50000
).
setConnectTimeout
(
50000
).
build
();
//设置请求和传输超时时间
httpPost
.
setConfig
(
requestConfig
);
httpPost
.
setHeader
(
"token"
,
token
);
StringEntity
se
=
new
StringEntity
(
json
,
"UTF-8"
);
StringEntity
se
=
new
StringEntity
(
json
,
"UTF-8"
);
se
.
setContentType
(
"application/json"
);
se
.
setContentEncoding
(
new
BasicHeader
(
HTTP
.
CONTENT_TYPE
,
"application/json"
));
httpPost
.
setEntity
(
se
);
LOGGER
.
info
(
"请求开始时间:"
+
System
.
currentTimeMillis
());
LOGGER
.
info
(
"请求开始时间:"
+
System
.
currentTimeMillis
());
HttpResponse
response
=
httpClient
.
execute
(
httpPost
);
LOGGER
.
info
(
"请求结束时间:"
+
System
.
currentTimeMillis
());
if
(
response
!=
null
){
LOGGER
.
info
(
"请求结束时间:"
+
System
.
currentTimeMillis
());
if
(
response
!=
null
)
{
HttpEntity
resEntity
=
response
.
getEntity
();
if
(
response
.
getStatusLine
().
getStatusCode
()
==
200
)
{
if
(
resEntity
!=
null
){
if
(
response
.
getStatusLine
().
getStatusCode
()
==
200
)
{
if
(
resEntity
!=
null
)
{
responseContent
=
EntityUtils
.
toByteArray
(
resEntity
);
}
}
else
{
LOGGER
.
info
(
"请求失败:"
+
EntityUtils
.
toString
(
resEntity
,
charset
));
}
else
{
LOGGER
.
info
(
"请求失败:"
+
EntityUtils
.
toString
(
resEntity
,
charset
));
return
responseContent
;
}
}
}
catch
(
Exception
ex
){
LOGGER
.
info
(
"异常捕捉请求结束时间:"
+
System
.
currentTimeMillis
());
}
catch
(
Exception
ex
)
{
LOGGER
.
info
(
"异常捕捉请求结束时间:"
+
System
.
currentTimeMillis
());
ex
.
printStackTrace
();
LOGGER
.
info
(
ex
.
getMessage
());
}
...
...
@@ -636,29 +657,40 @@ public class HttpClientUtils {
/**
* 发送 getJsonForParam请求
*
* @author Bellamy
*/
public
static
String
getJsonForParam
(
String
url
,
Map
<
String
,
Object
>
paramMap
)
{
LOGGER
.
info
(
"===================
getJsonForParam start======================="
);
LOGGER
.
info
(
"===================Get request
getJsonForParam start======================="
);
LOGGER
.
info
(
"url:"
+
url
);
LOGGER
.
info
(
"json:"
+
paramMap
);
String
result
=
null
;
StringBuilder
sb
=
new
StringBuilder
();
String
fh
=
""
;
if
(
paramMap
!=
null
)
{
if
(
url
.
indexOf
(
"?"
)
==
-
1
)
{
fh
=
"?"
;
}
for
(
Entry
<
String
,
Object
>
entry
:
paramMap
.
entrySet
())
{
sb
.
append
(
"&"
);
sb
.
append
(
entry
.
getKey
());
sb
.
append
(
"="
);
sb
.
append
(
entry
.
getValue
());
}
}
if
(
StringUtils
.
isNotEmpty
(
sb
))
{
fh
+=
sb
.
toString
().
substring
(
1
);
}
String
requestUrl
=
url
+
sb
.
toString
()
;
String
requestUrl
=
url
+
fh
;
CloseableHttpClient
httpclient
=
HttpClients
.
createDefault
();
try
{
// 创建httpget.
HttpGet
httpget
=
new
HttpGet
(
requestUrl
);
System
.
out
.
println
(
"
executing request "
+
httpget
.
getURI
());
System
.
out
.
println
(
"get
executing request "
+
httpget
.
getURI
());
// 执行get请求.
CloseableHttpResponse
response
=
httpclient
.
execute
(
httpget
);
// 获取响应实体
...
...
@@ -685,7 +717,6 @@ public class HttpClientUtils {
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// 私钥
/*String privateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJzAfk55exxmvy3+pXsJINZEtmwUp6eBfDSl2YnT5bdJL3nzPnSjmaWsf8x9hR4QyGnvlV/Vo0sk36X7ATcqxfIn0+6W5f8IR4XtVDhxZsD/cK8nVThqFGQagmyNAwxP/wBnAXOy+fpwZrMOgqfosYmVsmImFWbHA87C4mx0bwoJAgMBAAECgYB4tlBOVIT3ITTW0cRT1HrCJxYoc1uMxk2FKbc1ycWceTKjgiu1nQtEp2ufaYYq2hfMZOEudRIUWygT5RFRj5HxLfL6Me3y6dtgyHvOVeMDNGAG+tsn8ObQCQjZ/hVKzFFgHlrHv5i4zX44im2IdvLqnV6cEUneduJfZAQT/XTGUQJBANAZbuTqlDRj/9ObGZEvaPe95FGAPNFEiNmRvLsCsRmruJA5h2ogwx8O4Yll5LylKV6C33Vws4pgAPBHvOzGTx0CQQDA1VYU4ihNyvMknFIAmMT2ojQmQ8ASX64hVFWY9ehf5JaJ+ZD1c1BvbrmubpIo7pPci50BmXnjq6EcxVML/VbdAkAwEH/FjczXYPV4yY0ZNIsZFZoDnQvvBdZZ8khWJWQEWt5RKYh2YcTPip9bHda8H6Wzd6TnOjWt00jENr2TLqadAkEAq0TQD/xOj8mR6xJsQtttFSE78EB8d9VDc5bT7+d5XLJKgoGGnnqtFkvh32uVpYVBDsFx0dneyLfHgSZBfISmgQJADZ71qrfCDvuoYNS4aOW52OL6LMC84Qi2EnZzl5OHkUuOv5jwBoOCRLEn0N999EMP6DBg8P5kg1llTq7bMG11ug==";
...
...
src/main/java/com/jz/common/utils/web/SessionUtils.java
View file @
9f5de5a1
...
...
@@ -110,6 +110,7 @@ public class SessionUtils {
/**
* @Title: getSessionUserId
* @Description: 获取登录用户ID
* @Author: Bellamy
* @return String 返回类型
*/
public
static
String
getCurrentUserId
(){
...
...
@@ -121,6 +122,21 @@ public class SessionUtils {
return
userId
;
}
/**
* @Title: getCurrentUserName
* @Description: 获取登录用户名称
* @Author: Bellamy
* @return String 返回类型
*/
public
static
String
getCurrentUserName
(){
String
userName
=
""
;
DmpMember
user
=
getSecurityUser
();
if
(
user
!=
null
){
userName
=
user
.
getUserName
();
}
return
userName
;
}
/**
* @Title: getAuthentication
* @Description: TODO(获取authentication)
...
...
src/main/java/com/jz/dmp/modules/controller/DataIntegration/DataSourceController.java
View file @
9f5de5a1
...
...
@@ -12,6 +12,8 @@ import io.swagger.annotations.ApiImplicitParam;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -31,6 +33,8 @@ import java.util.Map;
@Api
(
tags
=
"数据集成--数据源"
)
public
class
DataSourceController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DataSourceController
.
class
);
@Autowired
private
DmpSyncingDatasourceService
dmpSyncingDatasourceService
;
...
...
@@ -124,7 +128,16 @@ public class DataSourceController {
@ApiOperation
(
value
=
"测试连通性"
,
notes
=
"测试连通性"
)
@PostMapping
(
value
=
"/testConnection"
)
public
JsonResult
testConnection
(
@RequestBody
@Validated
DmpSyncingDatasourceReq
saveBody
,
HttpServletRequest
httpRequest
)
throws
Exception
{
JsonResult
result
=
dmpSyncingDatasourceService
.
testConnection
(
saveBody
);
if
(
StringUtils
.
isEmpty
(
saveBody
.
getDatasourceType
()))
{
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
,
"数据源类型ID不能为空"
);
}
JsonResult
result
=
new
JsonResult
();
try
{
result
=
dmpSyncingDatasourceService
.
testConnection
(
saveBody
);
}
catch
(
Exception
e
)
{
logger
.
info
(
"###################"
+
e
.
getMessage
()
+
"###################"
);
return
new
JsonResult
(
ResultCode
.
INTERNAL_SERVER_ERROR
,
e
.
getMessage
());
}
return
result
;
}
...
...
@@ -136,7 +149,7 @@ public class DataSourceController {
*/
@ApiOperation
(
value
=
"编辑数据源--根据id查询数据回显"
,
notes
=
"编辑数据源--根据id查询数据回显"
)
@GetMapping
(
value
=
"/selectDataSourceInfoById"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"datasourceId"
,
value
=
"数据源id"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"projectId"
,
value
=
"项目id"
)})
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"datasourceId"
,
value
=
"数据源id"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"projectId"
,
value
=
"项目id"
)})
public
JsonResult
getDataSourceInfoById
(
@RequestParam
String
datasourceId
,
@RequestParam
(
value
=
"projectId"
,
required
=
false
)
String
projectId
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
datasourceId
))
{
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
);
...
...
src/main/java/com/jz/dmp/modules/controller/DataIntegration/OfflineSynchController.java
View file @
9f5de5a1
...
...
@@ -34,7 +34,7 @@ public class OfflineSynchController {
private
OfflineSynchService
offlineSynchService
;
/**
* 任务列表分页查询
*
离线同步
任务列表分页查询
*
* @return
* @author Bellamy
...
...
@@ -61,7 +61,7 @@ public class OfflineSynchController {
*/
@ApiOperation
(
value
=
"获取源数据库名称-下拉框"
,
notes
=
"获取源数据库名称"
)
@GetMapping
(
value
=
"/sourceDbList"
)
@ApiImplicitParam
(
name
=
"projectId"
,
value
=
"项目id"
,
required
=
true
)
@ApiImplicitParam
(
name
=
"projectId"
,
value
=
"项目id"
,
required
=
true
)
public
JsonResult
<
List
<
SourceDbNameListDto
>>
getSourceDbList
(
@RequestParam
Integer
projectId
)
throws
Exception
{
JsonResult
<
List
<
SourceDbNameListDto
>>
jsonResult
=
offlineSynchService
.
querygSourceDbList
(
projectId
);
return
jsonResult
;
...
...
@@ -75,7 +75,7 @@ public class OfflineSynchController {
*/
@ApiOperation
(
value
=
"根据源数据库id,获取源数据表-下拉框"
,
notes
=
"根据源数据库id,获取源数据表"
)
@GetMapping
(
value
=
"/sourceTableList"
)
@ApiImplicitParam
(
name
=
"sourceDbId"
,
value
=
"源数据库id"
)
@ApiImplicitParam
(
name
=
"sourceDbId"
,
value
=
"源数据库id"
,
required
=
true
)
public
JsonResult
getSourceTableList
(
@RequestParam
Long
sourceDbId
,
@RequestParam
(
value
=
"targetName"
,
required
=
false
)
String
targetName
)
throws
Exception
{
JsonResult
list
=
offlineSynchService
.
querygSourceTableList
(
sourceDbId
,
targetName
);
return
list
;
...
...
@@ -99,7 +99,7 @@ public class OfflineSynchController {
}
/**
* 根据taskId删除任务
* 根据taskId删除
离线
任务
*
* @return
* @author Bellamy
...
...
src/main/java/com/jz/dmp/modules/controller/DataIntegration/RealTimeSyncController.java
View file @
9f5de5a1
...
...
@@ -113,7 +113,7 @@ public class RealTimeSyncController {
if
(
StringUtils
.
isEmpty
(
realTaskId
))
{
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
,
"任务id不能为空!"
);
}
boolean
jsonResult
=
dmpRealtimeSyncInfoService
.
deleteBy
Id
(
Integer
.
valueOf
(
realTaskId
)
);
boolean
jsonResult
=
dmpRealtimeSyncInfoService
.
deleteBy
realTaskId
(
realTaskId
);
if
(
jsonResult
)
{
return
new
JsonResult
();
}
else
{
...
...
@@ -302,4 +302,31 @@ public class RealTimeSyncController {
JsonResult
<
RealTimeEditDataEchoDto
>
jsonResult
=
dmpRealtimeSyncInfoService
.
selectRealtimeTaskById
(
taskId
);
return
jsonResult
;
}
/**
* 批量上下线
*
* @return
* @author Bellamy
* @since 2021-01-05
*/
@ApiOperation
(
value
=
"批量上下线"
,
notes
=
"批量上下线"
)
@GetMapping
(
value
=
"/batchUptOnlineStatus"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"realTaskId"
,
value
=
"任务id"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"onlineStatus"
,
value
=
"上下线状态:Y 上线,N 下线"
,
required
=
true
)})
public
JsonResult
batchUptOnlineStatus
(
@RequestParam
String
realTaskId
,
@RequestParam
String
onlineStatus
)
throws
Exception
{
logger
.
info
(
"###################请求参数{}taskId="
+
realTaskId
+
"###################"
);
if
(
StringUtils
.
isEmpty
(
realTaskId
))
{
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
,
"任务id不能为空!"
);
}
if
(
StringUtils
.
isEmpty
(
onlineStatus
))
{
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
,
"状态不能为空!"
);
}
boolean
jsonResult
=
dmpRealtimeSyncInfoService
.
batchUptOnlineStatus
(
realTaskId
,
onlineStatus
);
if
(
jsonResult
)
{
return
JsonResult
.
ok
();
}
else
{
return
JsonResult
.
error
(
"删除失败!"
);
}
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/controller/DataIntegration/bean/RealTimeSyncListDto.java
View file @
9f5de5a1
...
...
@@ -80,6 +80,9 @@ public class RealTimeSyncListDto {
@ApiModelProperty
(
value
=
"去向数据源类型"
)
private
String
targetDatabaseType
;
@ApiModelProperty
(
value
=
"上下线状态:Y 上线,N 下线"
)
private
String
onlineStatus
;
public
String
getId
()
{
return
id
;
}
...
...
@@ -167,4 +170,12 @@ public class RealTimeSyncListDto {
public
void
setTargetDatabaseType
(
String
targetDatabaseType
)
{
this
.
targetDatabaseType
=
targetDatabaseType
;
}
public
String
getOnlineStatus
()
{
return
onlineStatus
;
}
public
void
setOnlineStatus
(
String
onlineStatus
)
{
this
.
onlineStatus
=
onlineStatus
;
}
}
src/main/java/com/jz/dmp/modules/controller/DataIntegration/bean/SourceDbNameListDto.java
View file @
9f5de5a1
...
...
@@ -22,7 +22,7 @@ public class SourceDbNameListDto {
/*
* 源数据库名称
* */
@ApiModelProperty
(
value
=
"
源数据库
名称"
)
@ApiModelProperty
(
value
=
"
数据源
名称"
)
String
datasourceNameOrg
;
/*
...
...
@@ -40,7 +40,7 @@ public class SourceDbNameListDto {
/*
* 源数据库和数据库类型名称
* */
@ApiModelProperty
(
value
=
"
源数据库
和数据库类型名称"
)
@ApiModelProperty
(
value
=
"
数据源
和数据库类型名称"
)
String
datasourceName
;
/*
...
...
src/main/java/com/jz/dmp/modules/controller/DataIntegration/bean/TaskListPageReq.java
View file @
9f5de5a1
...
...
@@ -32,6 +32,12 @@ public class TaskListPageReq extends BasePageBean {
@ApiModelProperty
(
value
=
"创建人"
)
private
String
createUserId
;
/*
* 任务名称
* */
@ApiModelProperty
(
value
=
"任务名称"
)
private
String
treeName
;
// /*
// * 父类ID
// * */
...
...
@@ -83,4 +89,12 @@ public class TaskListPageReq extends BasePageBean {
public
void
setCreateUserId
(
String
createUserId
)
{
this
.
createUserId
=
createUserId
;
}
public
String
getTreeName
()
{
return
treeName
;
}
public
void
setTreeName
(
String
treeName
)
{
this
.
treeName
=
treeName
;
}
}
src/main/java/com/jz/dmp/modules/controller/dataOperation/bean/DataDevTaskListDto.java
View file @
9f5de5a1
...
...
@@ -21,6 +21,12 @@ public class DataDevTaskListDto {
@ApiModelProperty
(
value
=
"任务ID"
)
private
String
taskId
;
/*
* treeId
* */
@ApiModelProperty
(
value
=
"treeId"
)
private
String
treeId
;
/*
* 任务名称
* */
...
...
@@ -168,4 +174,12 @@ public class DataDevTaskListDto {
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getTreeId
()
{
return
treeId
;
}
public
void
setTreeId
(
String
treeId
)
{
this
.
treeId
=
treeId
;
}
}
src/main/java/com/jz/dmp/modules/controller/dataOperation/bean/DataDevTaskListReq.java
View file @
9f5de5a1
...
...
@@ -27,16 +27,16 @@ public class DataDevTaskListReq extends BasePageBean {
private
String
projectId
;
/*
*
节点
名称或id
*
任务
名称或id
* */
@ApiModelProperty
(
value
=
"
节点
名称或id"
)
@ApiModelProperty
(
value
=
"
任务
名称或id"
)
private
String
treeIdOrName
;
/*
*
节点
id
*
任务
id
* */
@ApiModelProperty
(
value
=
"
节点
id"
)
private
String
t
ree
Id
;
@ApiModelProperty
(
value
=
"
任务
id"
)
private
String
t
ask
Id
;
/*
* 任务类型
...
...
@@ -60,12 +60,12 @@ public class DataDevTaskListReq extends BasePageBean {
this
.
treeIdOrName
=
treeIdOrName
;
}
public
String
getT
ree
Id
()
{
return
t
ree
Id
;
public
String
getT
ask
Id
()
{
return
t
ask
Id
;
}
public
void
setT
reeId
(
String
tree
Id
)
{
this
.
t
reeId
=
tree
Id
;
public
void
setT
askId
(
String
task
Id
)
{
this
.
t
askId
=
task
Id
;
}
public
String
getTaskType
()
{
...
...
src/main/java/com/jz/dmp/modules/controller/dataService/DmpApiMangeController.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.dmp.modules.controller.dataService.bean.*
;
import
com.jz.dmp.modules.service.DmpApiMangeService
;
import
com.jz.dmp.modules.service.DmpOrgMangeService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
/**
* 数据服务Api管理--调用gateway 接口
*
* @author Bellamy
* @since 2021-01-18 10:56:18
*/
@RestController
@RequestMapping
(
"/apiMange"
)
@Api
(
tags
=
"数据服务-Api管理"
)
public
class
DmpApiMangeController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DmpApiMangeController
.
class
);
/**
* 服务对象
*/
@Autowired
private
DmpApiMangeService
dmpApiMangeService
;
/**
* 授权给他人的API-列表分页查询
*
* @return
* @author Bellamy
* @since 2021-01-18
*/
@ApiOperation
(
value
=
"授权给他人的API-列表分页查询"
,
notes
=
"列表分页查询"
)
@PostMapping
(
value
=
"/apiAuthListPage"
)
public
JsonResult
getApiAuthListPage
(
@RequestBody
@Validated
AuthListInfoReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
queryApiAuthListPage
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 取消授权
*
* @author Bellamy
* @since 2021-01-18
*/
@ApiOperation
(
value
=
"取消授权"
,
notes
=
"取消授权"
)
@GetMapping
(
value
=
"/cancelApiAuth"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"授权id"
,
required
=
true
)
public
JsonResult
getCancelApiAuth
(
@RequestParam
String
id
,
HttpServletRequest
httpRequest
)
{
if
(
StringUtils
.
isEmpty
(
id
))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"授权id不能为空!"
);
}
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
cancelApiAuth
(
id
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 发布的API-API列表分页查询
*
* @author Bellamy
* @since 2021-01-18
*/
@ApiOperation
(
value
=
"发布的API-API列表分页查询"
,
notes
=
"列表分页查询"
)
@PostMapping
(
value
=
"/listPage"
)
public
JsonResult
getApiListPage
(
@RequestBody
@Validated
ApiInterfaceInfoListReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
queryApiListPage
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 删除api
*
* @author Bellamy
* @since 2021-01-18
*/
@ApiOperation
(
value
=
"删除api"
,
notes
=
"删除api"
)
@GetMapping
(
value
=
"/delApiInfo"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"apiKey"
,
value
=
"apiKey"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"类型"
,
required
=
false
)})
public
JsonResult
delApiInfo
(
@RequestParam
String
apiKey
,
@RequestParam
(
required
=
false
)
String
type
,
HttpServletRequest
httpRequest
)
{
if
(
StringUtils
.
isEmpty
(
apiKey
))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"apiKey不能为空!"
);
}
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
delApiInfo
(
apiKey
,
type
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 根据apiid获取API详情
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation
(
value
=
"获取API详情"
,
notes
=
"获取API详情"
)
@GetMapping
(
value
=
"/getApiInfo"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"ApiId"
,
required
=
true
)
public
JsonResult
getApiInfoByApiId
(
@RequestParam
String
id
,
HttpServletRequest
httpRequest
)
{
if
(
StringUtils
.
isEmpty
(
id
))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"apiId不能为空!"
);
}
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
queryApiInfoByApiId
(
id
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 授权给组织-提交保存
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation
(
value
=
"授权给组织-提交保存"
,
notes
=
"授权给组织-提交保存"
)
@PostMapping
(
value
=
"/addApiAuthToOrg"
)
public
JsonResult
addApiAuthToOrg
(
@RequestBody
@Validated
AuthUserApiReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
addApiAuthToOrg
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* API测试
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation
(
value
=
"API测试"
,
notes
=
"API测试"
)
@GetMapping
(
value
=
"/apiTestInfo"
)
@ApiImplicitParam
(
name
=
"apiKey"
,
value
=
"apiKey"
,
required
=
true
)
public
JsonResult
getApiTestInfo
(
@RequestParam
String
apiKey
,
HttpServletRequest
httpRequest
)
{
if
(
StringUtils
.
isEmpty
(
apiKey
))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"apiKey不能为空!"
);
}
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
apiTestInfo
(
apiKey
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 查看日志
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation
(
value
=
"查看日志"
,
notes
=
"查看日志"
)
@PostMapping
(
value
=
"/checkApiLogInfo"
)
public
JsonResult
checkApiLogInfo
(
@RequestBody
LogInfoListReq
req
,
HttpServletRequest
httpRequest
)
{
if
(
StringUtils
.
isEmpty
(
req
.
getApiKey
()))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"apiKey不能为空!"
);
}
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
checkApiLogInfo
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 授权模糊查询组织信息
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation
(
value
=
"授权模糊查询组织信息"
,
notes
=
"授权模糊查询组织信息"
)
@GetMapping
(
value
=
"/authOrgList"
)
@ApiImplicitParam
(
name
=
"key"
,
value
=
"key"
,
required
=
true
)
public
JsonResult
getAuthOrgList
(
@RequestParam
String
key
,
HttpServletRequest
httpRequest
)
{
if
(
StringUtils
.
isEmpty
(
key
))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"key不能为空!"
);
}
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
getAuthOrgList
(
key
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/controller/dataService/DmpApiServiceMangeController.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.SoureAndTargetColumnsReq
;
import
com.jz.dmp.modules.controller.dataService.bean.*
;
import
com.jz.dmp.modules.service.DmpApiMangeService
;
import
com.jz.dmp.modules.service.DmpApiServiceMangeService
;
import
com.jz.dmp.modules.service.OfflineSynchService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
/**
* 数据服务-服务管理--调用gateway 接口
*
* @author Bellamy
* @since 2021-01-18 10:56:18
*/
@RestController
@RequestMapping
(
"/apiService"
)
@Api
(
tags
=
"数据服务-服务管理"
)
public
class
DmpApiServiceMangeController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DmpApiServiceMangeController
.
class
);
/**
* 服务对象
*/
@Autowired
private
DmpApiServiceMangeService
dmpApiServiceMangeService
;
@Autowired
private
DmpApiMangeService
dmpApiMangeService
;
@Autowired
private
OfflineSynchService
offlineSynchService
;
/**
* 保存API(第三方)基本信息
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation
(
value
=
"保存API(第三方)"
,
notes
=
"保存API(第三方)"
)
@PostMapping
(
value
=
"/saveApi"
)
public
JsonResult
saveApiInfo
(
@RequestBody
@Validated
ApiInterfaceReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiServiceMangeService
.
saveApiInfo
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 保存API(大数据查询/标签查询)
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation
(
value
=
"保存API(大数据查询/标签查询)"
,
notes
=
"保存API(大数据查询/标签查询)"
)
@PostMapping
(
value
=
"/saveApiBigData"
)
public
JsonResult
saveApiBigDataInfo
(
@RequestBody
@Validated
MakeBigDataApiReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiServiceMangeService
.
saveApiBigDataInfo
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 编辑API(第三方)基本信息
*
* @author Bellamy
* @since 2021-01-20
*/
@ApiOperation
(
value
=
"编辑API(第三方)"
,
notes
=
"编辑API(第三方)"
)
@PostMapping
(
value
=
"/updataApi"
)
public
JsonResult
updateApiInfo
(
@RequestBody
@Validated
ApiInterfaceReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiServiceMangeService
.
updateApiInfo
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 编辑API(大数据查询/标签查询)
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation
(
value
=
"编辑API(大数据查询/标签查询)"
,
notes
=
"编辑API(大数据查询/标签查询)"
)
@PostMapping
(
value
=
"/updateApiBigData"
)
public
JsonResult
updateApiBigDataInfo
(
@RequestBody
@Validated
MakeBigDataApiReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiServiceMangeService
.
updateApiBigDataInfo
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* API计量调用次数和执行时长
*
* @author Bellamy
* @since 2021-01-20
*/
@ApiOperation
(
value
=
"API计量--调用次数和执行时长"
,
notes
=
"API计量调用次数和执行时长"
)
@GetMapping
(
value
=
"/countAPiCallStat"
)
//@ApiImplicitParam(name = "date", value = "date", required = true)
public
JsonResult
countAPiCallStat
(
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiServiceMangeService
.
getCountAPiCallStat
();
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* API计量--API列表
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation
(
value
=
"API计量--API列表"
,
notes
=
"API计量--API列表"
)
@PostMapping
(
value
=
"/apiCountListPage"
)
public
JsonResult
apiCountListPage
(
@RequestBody
@Validated
ApiInterfaceInfoListReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
queryApiListPage
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 获取数据源库——下拉框
*
* @return
* @author Bellamy
*/
@ApiOperation
(
value
=
"获取数据源库-下拉框"
,
notes
=
"获取数据源库"
)
@GetMapping
(
value
=
"/sourceDbList"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"projectId"
,
value
=
"项目id"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"dbName"
,
value
=
"数据源类型名称"
,
required
=
true
)})
public
JsonResult
<
List
<
SourceDbNameListDto
>>
getSourceDbList
(
@RequestParam
Integer
projectId
,
@RequestParam
String
dbName
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiServiceMangeService
.
querygSourceDbList
(
projectId
,
dbName
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
"查询失败"
);
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 配置数据源——下拉框
*
* @return
* @author Bellamy
* @since 2021-01-21
*/
@ApiOperation
(
value
=
"配置数据源-下拉框"
,
notes
=
"配置数据源"
)
@GetMapping
(
value
=
"/sourceSetting"
)
public
JsonResult
getSourceSetting
()
throws
Exception
{
return
dmpApiServiceMangeService
.
getSourceSetting
();
}
/**
* 根据数据源库id,获取数据源表——下拉框
*
* @return
* @author Bellamy
*/
@ApiOperation
(
value
=
"根据数据源库id,获取数据源表-下拉框"
,
notes
=
"根据数据源库id,获取数据源表"
)
@GetMapping
(
value
=
"/sourceTableList"
)
@ApiImplicitParam
(
name
=
"sourceDbId"
,
value
=
"数据源库id"
,
required
=
true
)
public
JsonResult
getSourceTableList
(
@RequestParam
Long
sourceDbId
,
@RequestParam
(
value
=
"targetName"
,
required
=
false
)
String
targetName
)
throws
Exception
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
offlineSynchService
.
querygSourceTableList
(
sourceDbId
,
targetName
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 获取数据源表字段
*
* @return
* @author Bellamy
* @since 2021-01-21
*/
@ApiOperation
(
value
=
"获取数据源表字段"
,
notes
=
"获取数据源表字段"
)
@PostMapping
(
value
=
"/getTableColumns"
)
public
JsonResult
getTableColumns
(
@RequestBody
@Validated
SoureTableColumnsReq
req
)
throws
Exception
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
offlineSynchService
.
querySoureTableColumns
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/controller/dataService/DmpOrgMangeController.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.dmp.modules.controller.dataOperation.bean.DataDevTaskListDto
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageAddReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageListQueryReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageUpdateReq
;
import
com.jz.dmp.modules.service.DmpOrgMangeService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
/**
* 数据服务组织管理--调用gateway 接口
*
* @author Bellamy
* @since 2020-12-24 10:56:18
*/
@RestController
@RequestMapping
(
"/orgMange"
)
@Api
(
tags
=
"数据服务-组织管理"
)
public
class
DmpOrgMangeController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DmpOrgMangeController
.
class
);
/**
* 服务对象
*/
@Autowired
private
DmpOrgMangeService
dmpOrgMangeService
;
/**
* 列表分页查询
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@ApiOperation
(
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
@PostMapping
(
value
=
"/listPage"
)
public
JsonResult
getOrgListPage
(
@RequestBody
@Validated
OrganizationManageListQueryReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpOrgMangeService
.
queryOrgListPage
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 删除组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@ApiOperation
(
value
=
"删除组织"
,
notes
=
"删除组织"
)
@GetMapping
(
value
=
"/delOrg"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"组织id"
,
required
=
true
)
public
JsonResult
delOrgById
(
@RequestParam
long
id
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpOrgMangeService
.
delOrgById
(
id
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 新增组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@ApiOperation
(
value
=
"新增组织"
,
notes
=
"新增组织"
)
@PostMapping
(
value
=
"/addOrg"
)
public
JsonResult
addOrg
(
@RequestBody
@Validated
OrganizationManageAddReq
req
,
HttpServletRequest
httpRequest
)
{
if
(
StringUtils
.
isEmpty
(
req
.
getOrgName
()))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"组织名称不能为空!"
);
}
if
(
StringUtils
.
isEmpty
(
req
.
getOrgType
()))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"组织类型不能为空!"
);
}
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpOrgMangeService
.
addOrg
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 编辑组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@ApiOperation
(
value
=
"编辑组织"
,
notes
=
"编辑组织"
)
@PostMapping
(
value
=
"/updateOrg"
)
public
JsonResult
updateOrg
(
@RequestBody
@Validated
OrganizationManageUpdateReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpOrgMangeService
.
updateOrg
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 根据组织id获取组织详情
*
* @author Bellamy
* @since 2021-01-18
*/
@ApiOperation
(
value
=
"根据组织id获取组织详情"
,
notes
=
"根据组织id获取组织详情"
)
@GetMapping
(
value
=
"/orgInfo"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"组织id"
,
required
=
true
)
public
JsonResult
getOrgInfoByOrgId
(
@RequestParam
String
id
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
if
(
StringUtils
.
isEmpty
(
id
))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"组织id不能为空!"
);
}
try
{
jsonResult
=
dmpOrgMangeService
.
getOrgInfoByOrgId
(
id
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/controller/dataService/bean/ApiInterfaceInfoListReq.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
import
com.jz.common.bean.BasePageBean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @ClassName: ApiInterfaceInfoListReq
* @Description: 发布的API-APi列表请求对象
* @Author: Bellamy
* @Date 2021/1/18
* @Version 1.0
*/
@Data
@ApiModel
(
"发布的API-APi列表请求对象"
)
public
class
ApiInterfaceInfoListReq
extends
BasePageBean
implements
Serializable
{
@ApiModelProperty
(
value
=
"状态:SUCCEED 请求成功, FAIL 请求失败"
)
private
String
status
;
@ApiModelProperty
(
value
=
"ApiKey"
)
private
String
apiKey
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/ApiInterfaceReq.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @ClassName: ApiInterfaceReq
* @Description: api基本信息
* @Author: Bellamy
* @Date 2021/1/19
* @Version 1.0
*/
@Data
@ApiModel
(
value
=
"api基本信息"
)
public
class
ApiInterfaceReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
public
String
apiDesc
;
@ApiModelProperty
(
value
=
"传输方式:http https"
,
required
=
true
)
@NotNull
(
message
=
"传输方式不能为空"
)
public
String
transMode
;
@ApiModelProperty
(
value
=
"加密方式0 无,1:MD5 2:RSA"
,
required
=
true
)
@NotNull
(
message
=
"加密方式不能为空"
)
public
String
signType
;
@ApiModelProperty
(
value
=
"接入类型:对应字典表key"
,
required
=
true
)
@NotNull
(
message
=
"接入类型不能为空"
)
public
String
joinType
;
@ApiModelProperty
(
value
=
"目标地址"
,
required
=
true
)
@NotNull
(
message
=
"目标地址不能为空"
)
public
String
targetUrl
;
@ApiModelProperty
(
value
=
"超时时间"
,
required
=
true
)
@NotNull
(
message
=
"超时时间不能为空"
)
public
String
timeout
;
@ApiModelProperty
(
value
=
"限流类型:DAY 按天,MONTH 按月, YEAR 按年"
,
required
=
true
)
@NotNull
(
message
=
"限流类型不能为空"
)
public
String
reqType
;
@ApiModelProperty
(
value
=
"限制次数"
,
required
=
false
)
public
Long
reqFrequency
;
@ApiModelProperty
(
value
=
"api描述"
,
required
=
false
)
public
String
apiFunction
;
@ApiModelProperty
(
value
=
"父类文件id,一级文件夹传入0"
,
required
=
false
)
public
Long
parentId
;
@ApiModelProperty
(
value
=
"文件id"
,
required
=
false
)
public
Long
fileId
;
@ApiModelProperty
(
value
=
"项目id"
,
required
=
true
)
@NotNull
(
message
=
"项目id不能为空"
)
public
Long
projectId
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
false
)
public
String
status
;
@ApiModelProperty
(
value
=
"更新时传入api自增id"
,
required
=
false
)
public
Long
id
;
@ApiModelProperty
(
value
=
"创建用户"
)
public
String
createUser
;
@ApiModelProperty
(
value
=
"api类型:1.数据银行制作大数据表 "
+
"2 数据银行制作数据包,3,数据银行制作自定义API "
+
"4 API实时接入 6 标签查询 9自定义"
,
hidden
=
true
)
public
String
apiType
;
@ApiModelProperty
(
value
=
"请求方式"
)
public
String
reqMethod
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/AuthListInfoReq.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
import
com.jz.common.bean.BasePageBean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @ClassName: AuthListInfoReq
* @Description: 授权认证信息列表请求对象
* @Author: Bellamy
* @Date 2021/1/18
* @Version 1.0
*/
@Data
@ApiModel
(
"授权认证信息列表请求对象"
)
public
class
AuthListInfoReq
extends
BasePageBean
implements
Serializable
{
private
static
final
long
serialVersionUID
=
6807722745717042029L
;
@ApiModelProperty
(
value
=
"apiKey api唯一标识"
,
required
=
false
)
private
String
apiKey
;
@ApiModelProperty
(
value
=
"授权码"
,
required
=
false
)
private
String
authCode
;
@ApiModelProperty
(
value
=
"API名称"
,
required
=
false
)
private
String
apiName
;
@ApiModelProperty
(
value
=
"项目id"
)
private
String
projectId
;
@ApiModelProperty
(
value
=
"文件id"
)
private
String
fileId
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/AuthUserApiReq.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @ClassName: AuthUserApiReq
* @Description: API认证授权
* @Author: Bellamy
* @Date 2021/1/19
* @Version 1.0
*/
@Data
@ApiModel
(
"API认证授权"
)
public
class
AuthUserApiReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"apiKey唯一标识"
,
required
=
true
)
@NotNull
(
message
=
"apiKey唯一标识不能为空"
)
@NotEmpty
(
message
=
"apiKey唯一标识不能为空"
)
private
String
apiKey
;
@ApiModelProperty
(
value
=
"组织编码"
,
required
=
true
)
@NotNull
(
message
=
"组织编码不能为空"
)
@NotEmpty
(
message
=
"组织编码不能为空"
)
private
String
orgCode
;
@ApiModelProperty
(
value
=
"授权方式:POWER_CALL_MODE 按次调用 ,RECORD_TIME_MODE 按时间调用,PERMANENT_TIME_MODE 永久有效"
,
required
=
true
)
@NotNull
(
message
=
"授权方式不能为空"
)
private
String
authMode
;
@ApiModelProperty
(
value
=
"创建用户"
,
required
=
false
)
private
String
createUser
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/LogInfoListReq.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
import
com.jz.common.bean.BasePageBean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @ClassName: AuthListInfoReq
* @Description: 日志信息列表请求对象
* @Author: Bellamy
* @Date 2021/1/18
* @Version 1.0
*/
@Data
@ApiModel
(
"日志信息列表请求对象"
)
public
class
LogInfoListReq
extends
BasePageBean
implements
Serializable
{
@ApiModelProperty
(
value
=
"ApiKey"
)
private
String
apiKey
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/MakeBigDataApiReq.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.Map
;
/**
* @ClassName: MakeBigDataApiReq
* @Description: Api制作大数据查询
* @Author: Bellamy
* @Date 2021/1/19
* @Version 1.0
*/
@Data
@ApiModel
(
"Api制作大数据查询/标签查询请求体"
)
public
class
MakeBigDataApiReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
public
String
apiDesc
;
@ApiModelProperty
(
value
=
"传输方式:http https"
,
required
=
true
)
@NotNull
(
message
=
"传输方式不能为空"
)
public
String
transMode
;
@ApiModelProperty
(
value
=
"加密方式0 无,1:MD5 2:RSA"
,
required
=
true
)
@NotNull
(
message
=
"加密方式不能为空"
)
public
String
signType
;
@ApiModelProperty
(
value
=
"接入类型:对应字典表key"
,
required
=
true
)
@NotNull
(
message
=
"接入类型不能为空"
)
public
String
joinType
;
@ApiModelProperty
(
value
=
"目标地址"
,
required
=
true
)
@NotNull
(
message
=
"目标地址不能为空"
)
public
String
targetUrl
;
@ApiModelProperty
(
value
=
"超时时间"
,
required
=
true
)
@NotNull
(
message
=
"超时时间不能为空"
)
public
String
timeout
;
@ApiModelProperty
(
value
=
"限流类型:DAY 按天,MONTH 按月, YEAR 按年"
,
required
=
true
)
@NotNull
(
message
=
"限流类型不能为空"
)
public
String
reqType
;
@ApiModelProperty
(
value
=
"限制次数"
,
required
=
false
)
public
Long
reqFrequency
;
@ApiModelProperty
(
value
=
"api描述"
,
required
=
false
)
public
String
apiFunction
;
@ApiModelProperty
(
value
=
"父类文件id,一级文件夹传入0"
,
required
=
false
)
public
Long
parentId
;
@ApiModelProperty
(
value
=
"文件id"
,
required
=
false
)
public
Long
fileId
;
@ApiModelProperty
(
value
=
"项目id"
,
required
=
true
)
@NotNull
(
message
=
"项目id不能为空"
)
public
Long
projectId
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
false
)
public
String
status
;
@ApiModelProperty
(
value
=
"更新时传入api自增id"
,
required
=
false
)
public
Long
id
;
@ApiModelProperty
(
value
=
"api类型:1.数据银行制作大数据表 "
+
"2 数据银行制作数据包,3,数据银行制作自定义API "
+
"4 API实时接入 6 标签查询 9自定义"
,
hidden
=
true
)
public
String
apiType
;
@ApiModelProperty
(
value
=
"apiKey"
,
required
=
false
)
public
String
apiKey
;
@ApiModelProperty
(
value
=
"数据源Id"
,
required
=
true
)
@NotNull
(
message
=
"数据源Id不能为空"
)
private
String
esDataSource
;
@ApiModelProperty
(
value
=
"源库名称"
,
required
=
true
)
@NotNull
(
message
=
"源库名称不能为空"
)
private
String
esDataBase
;
@ApiModelProperty
(
value
=
"源表名称"
,
required
=
true
)
@NotNull
(
message
=
"源表名称不能为空"
)
private
String
esTable
;
@ApiModelProperty
(
value
=
"处理类型"
,
required
=
true
)
@NotNull
(
message
=
"处理类型不能为空"
)
private
String
handleType
;
@ApiModelProperty
(
value
=
"请求参数"
,
required
=
true
)
@NotNull
(
message
=
"请求参数不能为空"
)
private
String
requestParam
;
@ApiModelProperty
(
value
=
"返回参数"
,
required
=
true
)
@NotNull
(
message
=
"返回参数不能为空"
)
private
String
responseParam
;
@ApiModelProperty
(
value
=
"段列表"
,
required
=
true
)
@NotNull
(
message
=
"字段列表不能为空"
)
private
String
tableFields
;
@ApiModelProperty
(
value
=
"创建用户"
,
required
=
false
)
public
String
createUser
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/OrganizationManageAddReq.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @ClassName: OrganizationManageAddReq
* @Description: 新增组织管理请求体
* @Author: Bellamy
* @Date 2021/1/16
* @Version 1.0
*/
@Data
@ApiModel
(
"新增组织管理详情请求体"
)
public
class
OrganizationManageAddReq
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3131683881168540907L
;
@ApiModelProperty
(
value
=
"组织类型:INT 内部组织 OUT 外部组织"
,
required
=
true
)
@NotNull
(
message
=
"组织类型不能为空!"
)
@NotEmpty
(
message
=
"组织类型不能为空!"
)
private
String
orgType
;
@ApiModelProperty
(
value
=
"组织名称"
,
required
=
true
)
@NotNull
(
message
=
"组织名称不能为空"
)
@NotEmpty
(
message
=
"组织名称不能为空!"
)
private
String
orgName
;
@ApiModelProperty
(
value
=
"组织描述"
)
private
String
orgDesc
;
@ApiModelProperty
(
value
=
"组织英文名称"
)
private
String
orgCnName
;
@ApiModelProperty
(
value
=
"组织邮箱"
)
private
String
orgMail
;
@ApiModelProperty
(
value
=
"联系方式"
,
required
=
true
)
@NotEmpty
(
message
=
"联系方式不能为空!"
)
private
String
orgPhone
;
@ApiModelProperty
(
value
=
"联系人"
)
private
String
linkman
;
@ApiModelProperty
(
value
=
"状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)"
,
required
=
true
)
private
Boolean
status
;
@ApiModelProperty
(
value
=
"创建人"
)
private
String
createUser
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/OrganizationManageDetailQueryReq.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.req
* @PROJECT_NAME: jz-dm-parent
* @NAME: OrganizationManageListQueryReq
* @DATE: 2020-12-24/10:34
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Data
@ApiModel
(
"组织管理详情请求体"
)
public
class
OrganizationManageDetailQueryReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"组织id"
,
required
=
true
)
@NotNull
(
message
=
"组织id不能为空"
)
private
Long
id
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/OrganizationManageListQueryReq.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
import
com.jz.common.bean.BasePageBean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @ClassName: DmpOrgMangeService
* @Description: 组织管理列表查询请求体
* @Author: Bellamy
* @Date 2021/1/16
* @Version 1.0
*/
@Data
@ApiModel
(
"组织管理列表查询请求体"
)
public
class
OrganizationManageListQueryReq
extends
BasePageBean
implements
Serializable
{
@ApiModelProperty
(
value
=
"组织名称"
)
private
String
orgName
;
@ApiModelProperty
(
value
=
"组织编码(组织唯一标识)"
)
private
String
orgCode
;
@ApiModelProperty
(
value
=
"联系人"
)
private
String
linkman
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/OrganizationManageUpdateReq.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @ClassName: OrganizationManageUpdateReq
* @Description: 更新组织管理请求体
* @Author: Bellamy
* @Date 2021/1/16
* @Version 1.0
*/
@Data
@ApiModel
(
"更新组织管理请求体"
)
public
class
OrganizationManageUpdateReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"组织id"
,
required
=
true
)
@NotNull
(
message
=
"组织id不能为空"
)
private
Long
id
;
@ApiModelProperty
(
value
=
"组织类型:INT 内部组织 OUT 外部组织"
,
required
=
true
)
@NotNull
(
message
=
"组织类型不能为空!"
)
@NotEmpty
(
message
=
"组织类型不能为空!"
)
private
String
orgType
;
@ApiModelProperty
(
value
=
"组织名称"
,
required
=
true
)
@NotNull
(
message
=
"组织名称不能为空"
)
@NotEmpty
(
message
=
"组织名称不能为空!"
)
private
String
orgName
;
@ApiModelProperty
(
value
=
"组织描述"
)
private
String
orgDesc
;
@ApiModelProperty
(
value
=
"组织英文名称"
)
private
String
orgCnName
;
@ApiModelProperty
(
value
=
"组织邮箱"
)
private
String
orgMail
;
@ApiModelProperty
(
value
=
"联系方式"
,
required
=
true
)
@NotEmpty
(
message
=
"联系方式不能为空!"
)
private
String
orgPhone
;
@ApiModelProperty
(
value
=
"联系人"
)
private
String
linkman
;
@ApiModelProperty
(
value
=
"状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)"
,
required
=
true
)
private
Boolean
status
;
@ApiModelProperty
(
value
=
"创建人"
)
private
String
createUser
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/SoureTableColumnsReq.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @ClassName: SoureTableColumnsReq
* @Description: 获取数据源表字段
* @Author:Bellamy
* @Date 2020/12/21
* @Version 1.0
*/
@ApiModel
(
value
=
"获取数据源表字段-请求参数对象"
,
description
=
"获取数据源表字段-请求参数对象"
)
public
class
SoureTableColumnsReq
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
3931329194480499602L
;
/*
* 源数据库ID
* */
@NotNull
(
message
=
"源数据库ID不能为空"
)
@ApiModelProperty
(
value
=
"源数据库ID"
)
private
Long
sourceDbId
;
@NotNull
(
message
=
"表名称不能为空"
)
@NotEmpty
(
message
=
"表名称不能为空"
)
@ApiModelProperty
(
value
=
"表名称"
)
private
String
targetTableName
;
private
String
fileType
;
private
String
csvDelimiter
;
private
String
csvIsHaveHeader
;
public
Long
getSourceDbId
()
{
return
sourceDbId
;
}
public
void
setSourceDbId
(
Long
sourceDbId
)
{
this
.
sourceDbId
=
sourceDbId
;
}
public
String
getTargetTableName
()
{
return
targetTableName
;
}
public
void
setTargetTableName
(
String
targetTableName
)
{
this
.
targetTableName
=
targetTableName
;
}
public
String
getFileType
()
{
return
fileType
;
}
public
void
setFileType
(
String
fileType
)
{
this
.
fileType
=
fileType
;
}
public
String
getCsvDelimiter
()
{
return
csvDelimiter
;
}
public
void
setCsvDelimiter
(
String
csvDelimiter
)
{
this
.
csvDelimiter
=
csvDelimiter
;
}
public
String
getCsvIsHaveHeader
()
{
return
csvIsHaveHeader
;
}
public
void
setCsvIsHaveHeader
(
String
csvIsHaveHeader
)
{
this
.
csvIsHaveHeader
=
csvIsHaveHeader
;
}
}
src/main/java/com/jz/dmp/modules/dao/DmpRealtimeSyncInfoDao.java
View file @
9f5de5a1
...
...
@@ -177,4 +177,12 @@ public interface DmpRealtimeSyncInfoDao {
* @since 2021-01-12
*/
List
<
Map
>
selectRealtimeTaskById
(
@Param
(
"taskId"
)
String
taskId
)
throws
Exception
;
/**
* 批量删除数据源
*
* @return
* @author Bellamy
*/
int
deleteByrealTaskId
(
Map
map
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/dao/DmpSyncingDatasourceDao.java
View file @
9f5de5a1
...
...
@@ -97,7 +97,7 @@ public interface DmpSyncingDatasourceDao {
* @return
* @author Bellamy
*/
void
delDataSourceById
(
@Param
(
"ids"
)
String
[]
ids
)
throws
Exception
;
void
delDataSourceById
(
Map
map
)
throws
Exception
;
/**
* 获取数据源类型-下拉框
...
...
src/main/java/com/jz/dmp/modules/dao/OfflineSynchDao.java
View file @
9f5de5a1
...
...
@@ -29,5 +29,11 @@ public interface OfflineSynchDao {
List
<
CheckJyRlueStatusDto
>
selectCheckJyStatusInfo
(
@Param
(
"executionId"
)
String
executionId
)
throws
Exception
;
/**
* 离线同步任务列表分页查询
*
* @return
* @author Bellamy
*/
List
<
TaskListPageDto
>
selectOfflineTaskInfo
(
TaskListPageReq
taskListPageReq
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/DmpApiMangeService.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
service
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.dmp.modules.controller.dataService.bean.*
;
/**
* @ClassName: DmpApiMangeService
* @Description: 数据服务Api管理
* @Author: Bellamy
* @Date 2021/1/18
* @Version 1.0
*/
public
interface
DmpApiMangeService
{
/**
* 授权给他人的API-列表分页查询
*
* @author Bellamy
* @since 2021-01-18
*/
JsonResult
queryApiAuthListPage
(
AuthListInfoReq
req
)
throws
Exception
;
/**
* 取消授权
*
* @author Bellamy
* @since 2021-01-18
*/
JsonResult
cancelApiAuth
(
String
id
)
throws
Exception
;
/**
* 发布的API-API列表分页查询
*
* @author Bellamy
* @since 2021-01-18
*/
JsonResult
queryApiListPage
(
ApiInterfaceInfoListReq
req
)
throws
Exception
;
/**
* 删除api
*
* @author Bellamy
* @since 2021-01-18
*/
JsonResult
delApiInfo
(
String
apiKey
,
String
type
)
throws
Exception
;
/**
* 根据apiid获取API详情
*
* @author Bellamy
* @since 2021-01-19
*/
JsonResult
queryApiInfoByApiId
(
String
id
)
throws
Exception
;
/**
* 授权给组织-提交保存
*
* @author Bellamy
* @since 2021-01-19
*/
JsonResult
addApiAuthToOrg
(
AuthUserApiReq
req
)
throws
Exception
;
/**
* API测试
*
* @author Bellamy
* @since 2021-01-19
*/
JsonResult
apiTestInfo
(
String
apiKey
)
throws
Exception
;
/**
* 查看日志
*
* @author Bellamy
* @since 2021-01-19
*/
JsonResult
checkApiLogInfo
(
LogInfoListReq
req
)
throws
Exception
;
/**
* 授权模糊查询组织信息
*
* @author Bellamy
* @since 2021-01-19
*/
JsonResult
getAuthOrgList
(
String
key
)
throws
Exception
;
}
src/main/java/com/jz/dmp/modules/service/DmpApiServiceMangeService.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
service
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.dmp.modules.controller.dataService.bean.ApiInterfaceReq
;
import
com.jz.dmp.modules.controller.dataService.bean.MakeBigDataApiReq
;
import
com.jz.dmp.modules.model.DvRuleT
;
import
java.util.List
;
/**
* 数据服务-服务管理--调用gateway 接口
*
* @author Bellamy
* @since 2021-01-18 10:56:18
*/
public
interface
DmpApiServiceMangeService
{
/**
* 保存API(第三方)基本信息
*
* @author Bellamy
* @since 2021-01-19
*/
JsonResult
saveApiInfo
(
ApiInterfaceReq
req
)
throws
Exception
;
/**
* 保存API(大数据查询/标签查询)
*
* @author Bellamy
* @since 2021-01-19
*/
JsonResult
saveApiBigDataInfo
(
MakeBigDataApiReq
req
)
throws
Exception
;
/**
* 编辑API(第三方)基本信息
*
* @author Bellamy
* @since 2021-01-20
*/
JsonResult
updateApiInfo
(
ApiInterfaceReq
req
)
throws
Exception
;
/**
* 编辑API(大数据查询/标签查询)
*
* @author Bellamy
* @since 2021-01-20
*/
JsonResult
updateApiBigDataInfo
(
MakeBigDataApiReq
req
)
throws
Exception
;
/**
* API计量调用次数和执行时长
*
* @author Bellamy
* @since 2021-01-20
*/
JsonResult
getCountAPiCallStat
()
throws
Exception
;
/**
* 获取数据源库——下拉框
*
* @return
* @author Bellamy
*/
JsonResult
querygSourceDbList
(
Integer
projectId
,
String
dbName
)
throws
Exception
;
/**
* 配置数据源——下拉框
*
* @return
* @author Bellamy
* @since 2021-01-21
*/
JsonResult
getSourceSetting
()
throws
Exception
;
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/DmpOrgMangeService.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
service
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageAddReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageListQueryReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageUpdateReq
;
/**
* @ClassName: DmpOrgMangeService
* @Description: 数据服务组织管理
* @Author: Bellamy
* @Date 2021/1/15
* @Version 1.0
*/
public
interface
DmpOrgMangeService
{
/**
* 列表分页查询
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
JsonResult
queryOrgListPage
(
OrganizationManageListQueryReq
req
)
throws
Exception
;
/**
* 删除组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
JsonResult
delOrgById
(
long
id
)
throws
Exception
;
/**
* 新增组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
JsonResult
addOrg
(
OrganizationManageAddReq
req
)
throws
Exception
;
/**
* 编辑组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
JsonResult
updateOrg
(
OrganizationManageUpdateReq
req
)
throws
Exception
;
/**
* 根据组织id获取组织详情
*
* @author Bellamy
* @since 2021-01-18
*/
JsonResult
getOrgInfoByOrgId
(
String
id
)
throws
Exception
;
}
src/main/java/com/jz/dmp/modules/service/DmpRealtimeSyncInfoService.java
View file @
9f5de5a1
...
...
@@ -127,4 +127,21 @@ public interface DmpRealtimeSyncInfoService {
* @since 2021-01-12
*/
JsonResult
<
RealTimeEditDataEchoDto
>
selectRealtimeTaskById
(
String
taskId
)
throws
Exception
;
/**
* 批量删除数据源
*
* @return
* @author Bellamy
*/
boolean
deleteByrealTaskId
(
String
realTaskId
)
throws
Exception
;
/**
* 批量上下线
*
* @return
* @author Bellamy
* @since 2021-01-05
*/
boolean
batchUptOnlineStatus
(
String
realTaskId
,
String
onlineStatus
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/OfflineSynchService.java
View file @
9f5de5a1
...
...
@@ -4,6 +4,7 @@ import com.jz.common.constant.JsonResult;
import
com.jz.common.page.BasePageBean
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.*
;
import
com.jz.dmp.modules.controller.dataService.bean.SoureTableColumnsReq
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
...
...
@@ -17,26 +18,88 @@ import java.util.Map;
* @Version 1.0
*/
public
interface
OfflineSynchService
{
/**
* 离线同步任务列表分页查询
*
* @return
* @author Bellamy
*/
PageInfoResponse
<
TaskListPageDto
>
queryTaskListPage
(
TaskListPageReq
taskListPageReq
)
throws
Exception
;
/**
* 获取源数据库名称——下拉框
*
* @return
* @author Bellamy
*/
JsonResult
querygSourceDbList
(
Integer
projectId
)
throws
Exception
;
/**
* 根据源数据库id,获取源数据表——下拉框
*
* @return
* @author Bellamy
*/
JsonResult
querygSourceTableList
(
Long
sourceDbId
,
String
targetName
)
throws
Exception
;
/**
* 任务立即运行
*
* @return
* @author Bellamy
*/
JsonResult
taskRunNowByTaskId
(
String
taskId
)
throws
Exception
;
/**
* 根据taskId删除离线任务
*
* @return
* @author Bellamy
*/
JsonResult
delTaskByTaskId
(
String
taskId
)
throws
Exception
;
JsonResult
<
List
<
CheckTaskStatusPageDto
>>
queryCheckTaskStatusListPage
(
CheckTaskStatusPageReq
checkTaskStatusPageReq
)
throws
Exception
;
PageInfoResponse
<
CheckJyRlueStatusDto
>
selectCheckJyStatusInfo
(
CheckJyRlueStatusReq
checkJyRlueStatusReq
)
throws
Exception
;
/**
* 获取源表和目标表的字段
*
* @return
* @author Bellamy
*/
JsonResult
querySoureAndTargetColumnsByParams
(
SoureAndTargetColumnsReq
soureAndTargetColumnsReq
)
throws
Exception
;
/**
* 校验规则
*
* @return
* @author Bellamy
*/
PageInfoResponse
<
DvRuleTDto
>
queryJyRuleListPage
(
BasePageBean
basePageBean
,
HttpServletRequest
httpRequest
)
throws
Exception
;
/**
* 保存离线任务数据
*
* @return
* @author Bellamy
*/
JsonResult
addSyncTask
(
SyncDmpTaskAddReq
syncDmpTaskAddReq
)
throws
Exception
;
/**
* 编辑离线任务数据
*
* @return
* @author Bellamy
*/
JsonResult
updateSyncTask
(
SyncDmpTaskAddReq
syncDmpTaskAddReq
)
throws
Exception
;
/**
* 获取数据源表字段
*
* @return
* @author Bellamy
* @since 2021-01-21
*/
JsonResult
querySoureTableColumns
(
SoureTableColumnsReq
req
)
throws
Exception
;
}
src/main/java/com/jz/dmp/modules/service/impl/DmpApiMangeServiceImpl.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.utils.web.HttpClientUtils
;
import
com.jz.dmp.modules.controller.dataService.bean.*
;
import
com.jz.dmp.modules.service.DmpApiMangeService
;
import
com.jz.dmp.modules.service.DmpOrgMangeService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.message.BasicNameValuePair
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @ClassName: DmpOrgMangeServiceImpl
* @Description: 数据服务组织管理
* @Author: Bellamy
* @Date 2021/1/15
* @Version 1.0
*/
@Service
(
"dmpApiMangeService"
)
public
class
DmpApiMangeServiceImpl
implements
DmpApiMangeService
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DmpApiMangeServiceImpl
.
class
);
//授权给他人的API-列表分页查询url
private
static
final
String
apiAuthListPage
=
"/api/auth/auth-list"
;
//取消授权url
private
static
final
String
cancelApiAuth
=
"/api/auth/update-auth-info"
;
//发布的API-API列表分页查询url
private
static
final
String
apiListPage
=
"/api/interface/listApiInterface"
;
//删除APIurl
private
static
final
String
delApi
=
"/api/interface/delDMPApiInterface"
;
//根据apiid获取API详情url
private
static
final
String
getApiInfo
=
"/api/interface/getApiInterfaceDetail"
;
//授权给组织url
private
static
final
String
apiAuthToOrg
=
"/api/auth/dmp-auth-api"
;
//测试url
private
static
final
String
testApi
=
"/api/interface/apiTestApiInterface"
;
//查看日志url
private
static
final
String
checkApiLog
=
"/api/logging/listApiLog"
;
//授权模糊查询组织信息url
private
static
final
String
authOrgList
=
"/api/auth/getAuthNameList"
;
@Value
(
"${spring.gateway-url}"
)
private
String
gatewayUrl
;
/**
* 授权给他人的API-列表分页查询
*
* @author Bellamy
* @since 2021-01-18
*/
@Override
public
JsonResult
queryApiAuthListPage
(
AuthListInfoReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
apiAuthListPage
;
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
jsonObject
.
get
(
"data"
));
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
/**
* 取消授权
*
* @author Bellamy
* @since 2021-01-18
*/
@Override
public
JsonResult
cancelApiAuth
(
String
id
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
cancelApiAuth
;
Map
params
=
new
HashMap
();
params
.
put
(
"id"
,
id
);
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
params
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
jsonObject
.
get
(
"data"
));
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
/**
* 发布的API-API列表分页查询
*
* @author Bellamy
* @since 2021-01-18
*/
@Override
public
JsonResult
queryApiListPage
(
ApiInterfaceInfoListReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
apiListPage
;
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
jsonObject
.
get
(
"data"
));
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
/**
* 删除api
*
* @author Bellamy
* @since 2021-01-18
*/
@Override
public
JsonResult
delApiInfo
(
String
apiKey
,
String
type
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
delApi
;
Map
params
=
new
HashMap
();
params
.
put
(
"apiKey"
,
apiKey
);
params
.
put
(
"type"
,
type
);
String
returnData
=
HttpClientUtils
.
getJsonForParam
(
url
,
params
);
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"删除失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
map
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
();
}
}
if
(
map
.
containsKey
(
"message"
))
{
logger
.
info
(
map
.
get
(
"message"
).
toString
());
result
.
setMessage
(
map
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
/**
* 根据apiid获取API详情
*
* @author Bellamy
* @since 2021-01-19
*/
@Override
public
JsonResult
queryApiInfoByApiId
(
String
id
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
getApiInfo
;
Map
params
=
new
HashMap
();
params
.
put
(
"id"
,
id
);
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
params
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
jsonObject
.
get
(
"data"
));
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
}
return
result
;
}
/**
* 授权给组织-提交保存
*
* @author Bellamy
* @since 2021-01-19
*/
@Override
public
JsonResult
addApiAuthToOrg
(
AuthUserApiReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
apiAuthToOrg
;
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"保存失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
result
.
setData
(
jsonObject
.
get
(
"data"
));
//授权码和盐值
return
result
;
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
}
return
result
;
}
/**
* API测试
*
* @author Bellamy
* @since 2021-01-19
*/
@Override
public
JsonResult
apiTestInfo
(
String
apiKey
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
testApi
;
Map
params
=
new
HashMap
();
params
.
put
(
"apiKey"
,
apiKey
);
String
returnData
=
HttpClientUtils
.
getJsonForParam
(
url
,
params
);
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"测试失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
map
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
map
.
get
(
"data"
));
}
}
if
(
map
.
containsKey
(
"message"
))
{
logger
.
info
(
map
.
get
(
"message"
).
toString
());
result
.
setMessage
(
map
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
/**
* 查看日志
*
* @author Bellamy
* @since 2021-01-19
*/
@Override
public
JsonResult
checkApiLogInfo
(
LogInfoListReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
checkApiLog
;
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
result
.
setData
(
jsonObject
.
get
(
"data"
));
return
result
;
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
}
return
result
;
}
/**
* 授权模糊查询组织信息
*
* @author Bellamy
* @since 2021-01-19
*/
@Override
public
JsonResult
getAuthOrgList
(
String
key
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
authOrgList
;
Map
params
=
new
HashMap
();
params
.
put
(
"key"
,
key
);
String
returnData
=
HttpClientUtils
.
getJsonForParam
(
url
,
params
);
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
map
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
map
.
get
(
"data"
));
}
}
if
(
map
.
containsKey
(
"message"
))
{
logger
.
info
(
map
.
get
(
"message"
).
toString
());
result
.
setMessage
(
map
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
}
src/main/java/com/jz/dmp/modules/service/impl/DmpApiServiceMangeServiceImpl.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.utils.DateUtils
;
import
com.jz.common.utils.web.HttpClientUtils
;
import
com.jz.common.utils.web.SessionUtils
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto
;
import
com.jz.dmp.modules.controller.dataService.bean.ApiInterfaceReq
;
import
com.jz.dmp.modules.controller.dataService.bean.MakeBigDataApiReq
;
import
com.jz.dmp.modules.dao.DvRuleTDao
;
import
com.jz.dmp.modules.dao.OfflineSynchDao
;
import
com.jz.dmp.modules.model.DvRuleT
;
import
com.jz.dmp.modules.service.DmpApiServiceMangeService
;
import
com.jz.dmp.modules.service.DvRuleTService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
/**
* @ClassName: DmpApiServiceMangeServiceImpl
* @Description: 数据服务-服务管理--调用gateway 接口
* @Author: Bellamy
* @Date 2021/1/19
* @Version 1.0
*/
@Service
(
"dmpApiServiceMangeService"
)
public
class
DmpApiServiceMangeServiceImpl
implements
DmpApiServiceMangeService
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DmpApiServiceMangeServiceImpl
.
class
);
//保存API(第三方)基本信息url
private
static
final
String
addApiInfo
=
"/api/producer/addCustomApi"
;
//保存API(大数据查询/标签查询)url
private
static
final
String
addApiBigData
=
"/api/producer/makeBigDataApi"
;
//编辑API(第三方)基本信息url
private
static
final
String
updateApiInfo
=
"/api/producer/saveUpdate"
;
//API计量调用次数和执行时长url
private
static
final
String
countAPiCallStat
=
"/api/logging/countAPiCallStat"
;
@Value
(
"${spring.gateway-url}"
)
private
String
gatewayUrl
;
@Value
(
"${spring.api-bigData-setting}"
)
private
String
apiBigSetting
;
@Autowired
private
OfflineSynchDao
offlineSynchDao
;
/**
* 保存API(第三方)基本信息
*
* @author Bellamy
* @since 2021-01-19
*/
@Override
public
JsonResult
saveApiInfo
(
ApiInterfaceReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
addApiInfo
;
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"保存失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
Map
apiKey
=
JSONObject
.
parseObject
(
jsonObject
.
get
(
"data"
).
toString
());
result
.
setData
(
apiKey
.
get
(
"data"
));
// 新增API数据的apiKey
return
result
;
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
}
return
result
;
}
/**
* 保存API(大数据查询/标签查询)
*
* @author Bellamy
* @since 2021-01-19
*/
@Override
public
JsonResult
saveApiBigDataInfo
(
MakeBigDataApiReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
ApiInterfaceReq
baseInfo
=
new
ApiInterfaceReq
();
BeanUtils
.
copyProperties
(
req
,
baseInfo
);
//保存API基本信息
JsonResult
apiKeyData
=
saveApiInfo
(
baseInfo
);
String
apiKey
=
apiKeyData
.
getData
().
toString
();
if
(
StringUtils
.
isNotEmpty
(
apiKey
))
{
logger
.
info
(
"######apiKey="
+
apiKey
);
req
.
setApiKey
(
apiKey
);
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
url
=
gatewayUrl
+
addApiBigData
;
//保存API(大数据查询/标签查询)
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"保存失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
return
result
;
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
}
}
return
result
;
}
/**
* 编辑API(第三方)基本信息
*
* @author Bellamy
* @since 2021-01-20
*/
@Override
public
JsonResult
updateApiInfo
(
ApiInterfaceReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
updateApiInfo
;
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"编辑失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
return
result
;
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
}
return
result
;
}
/**
* 编辑API(大数据查询/标签查询)
*
* @author Bellamy
* @since 2021-01-20
*/
@Override
public
JsonResult
updateApiBigDataInfo
(
MakeBigDataApiReq
req
)
throws
Exception
{
ApiInterfaceReq
baseApi
=
new
ApiInterfaceReq
();
BeanUtils
.
copyProperties
(
req
,
baseApi
);
//编辑API基本信息
JsonResult
baseRes
=
updateApiInfo
(
baseApi
);
if
(!
"200"
.
equals
(
baseRes
.
getCode
()))
{
throw
new
RuntimeException
(
baseRes
.
getMessage
());
}
//编辑API(大数据查询/标签查询)
JsonResult
result
=
new
JsonResult
();
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
url
=
gatewayUrl
+
addApiBigData
;
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"编辑失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
return
result
;
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
}
return
result
;
}
/**
* API计量调用次数和执行时长
*
* @author Bellamy
* @since 2021-01-20
*/
@Override
public
JsonResult
getCountAPiCallStat
()
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
countAPiCallStat
;
Map
params
=
new
HashMap
();
params
.
put
(
"date"
,
DateUtils
.
currentDate
());
String
returnData
=
HttpClientUtils
.
getJsonForParam
(
url
,
params
);
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
map
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
map
.
get
(
"data"
));
}
}
if
(
map
.
containsKey
(
"message"
))
{
logger
.
info
(
map
.
get
(
"message"
).
toString
());
result
.
setMessage
(
map
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
/**
* 获取数据源库——下拉框
*
* @return
* @author Bellamy
*/
@Override
public
JsonResult
querygSourceDbList
(
Integer
projectId
,
String
dbName
)
throws
Exception
{
Map
map
=
new
HashMap
();
map
.
put
(
"projectId"
,
projectId
);
//项目id
map
.
put
(
"dbName"
,
dbName
);
List
<
SourceDbNameListDto
>
list
=
offlineSynchDao
.
querygSourceDbList
(
map
);
return
JsonResult
.
ok
(
list
);
}
/**
* 配置数据源——下拉框
*
* @return
* @author Bellamy
* @since 2021-01-21
*/
@Override
public
JsonResult
getSourceSetting
()
throws
Exception
{
String
[]
arr
=
apiBigSetting
.
split
(
","
);
List
<
String
>
list
=
Arrays
.
asList
(
arr
);
return
JsonResult
.
ok
(
list
);
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/impl/DmpOrgMangeServiceImpl.java
0 → 100644
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jcraft.jsch.Session
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.utils.web.HttpClientUtils
;
import
com.jz.common.utils.web.SessionUtils
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageAddReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageDetailQueryReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageListQueryReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageUpdateReq
;
import
com.jz.dmp.modules.service.DmpOrgMangeService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @ClassName: DmpOrgMangeServiceImpl
* @Description: 数据服务组织管理
* @Author: Bellamy
* @Date 2021/1/15
* @Version 1.0
*/
@Service
(
"dmpOrgMangeService"
)
public
class
DmpOrgMangeServiceImpl
implements
DmpOrgMangeService
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DmpOrgMangeServiceImpl
.
class
);
//列表分页查询url
private
static
final
String
orgListPage
=
"/api/organization/listOrg"
;
//删除组织url
private
static
final
String
delOrg
=
"/api/organization/logoutOrg"
;
//新增组织url
private
static
final
String
addOrg
=
"/api/organization/add"
;
//编辑组织url
private
static
final
String
updateOrg
=
"/api/organization/update"
;
//根据组织id获取组织详情url
private
static
final
String
orgDetail
=
"/api/organization/getOrgDetail"
;
@Value
(
"${spring.gateway-url}"
)
private
String
gatewayUrl
;
/**
* 列表分页查询
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@Override
public
JsonResult
queryOrgListPage
(
OrganizationManageListQueryReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
orgListPage
;
if
(
StringUtils
.
isNotEmpty
(
req
.
getOrgName
()))
{
req
.
setOrgName
(
req
.
getOrgName
().
trim
());
}
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
}
logger
.
info
(
"#################组织管理列数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
jsonObject
.
get
(
"data"
));
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
/**
* 删除组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@Override
public
JsonResult
delOrgById
(
long
id
)
throws
Exception
{
Map
params
=
new
HashMap
();
params
.
put
(
"id"
,
id
);
String
url
=
gatewayUrl
+
delOrg
;
String
returnData
=
HttpClientUtils
.
getJsonForParam
(
url
,
params
);
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"删除失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
map
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
();
}
}
return
JsonResult
.
error
(
"删除失败!"
);
}
/**
* 新增组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@Override
public
JsonResult
addOrg
(
OrganizationManageAddReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
addOrg
;
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
returnData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"新增失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
map
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
();
}
}
if
(
map
.
containsKey
(
"message"
))
{
logger
.
info
(
map
.
get
(
"message"
).
toString
());
result
.
setMessage
(
map
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
/**
* 编辑组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@Override
public
JsonResult
updateOrg
(
OrganizationManageUpdateReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
addOrg
;
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
returnData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"编辑失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
map
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
();
}
}
if
(
map
.
containsKey
(
"message"
))
{
logger
.
info
(
map
.
get
(
"message"
).
toString
());
result
.
setMessage
(
map
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
/**
* 根据组织id获取组织详情
*
* @author Bellamy
* @since 2021-01-18
*/
@Override
public
JsonResult
getOrgInfoByOrgId
(
String
id
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
orgDetail
;
OrganizationManageDetailQueryReq
req
=
new
OrganizationManageDetailQueryReq
();
req
.
setId
(
Long
.
valueOf
(
id
));
String
returnData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
map
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
map
.
get
(
"data"
));
}
}
if
(
map
.
containsKey
(
"message"
))
{
logger
.
info
(
map
.
get
(
"message"
).
toString
());
result
.
setMessage
(
map
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
}
src/main/java/com/jz/dmp/modules/service/impl/DmpRealtimeSyncInfoServiceImpl.java
View file @
9f5de5a1
...
...
@@ -6,6 +6,7 @@ import com.github.pagehelper.PageHelper;
import
com.github.pagehelper.PageInfo
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.enums.DelFlagEnum
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.common.persistence.BaseService
;
import
com.jz.common.utils.realTime.DBUtil
;
...
...
@@ -821,4 +822,36 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
}
return
new
JsonResult
(
returnModel
);
}
/**
* 批量删除数据源
*
* @return
* @author Bellamy
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
boolean
deleteByrealTaskId
(
String
realTaskId
)
throws
Exception
{
Map
map
=
new
HashMap
();
String
[]
ids
=
realTaskId
.
split
(
","
);
map
.
put
(
"ids"
,
ids
);
map
.
put
(
"dataStatus"
,
DelFlagEnum
.
YES
.
getValue
());
return
dmpRealtimeSyncInfoDao
.
deleteByrealTaskId
(
map
)
>
0
;
}
/**
* 批量上下线
*
* @return
* @author Bellamy
* @since 2021-01-05
*/
@Override
public
boolean
batchUptOnlineStatus
(
String
realTaskId
,
String
onlineStatus
)
throws
Exception
{
Map
map
=
new
HashMap
();
String
[]
ids
=
realTaskId
.
split
(
","
);
map
.
put
(
"ids"
,
ids
);
map
.
put
(
"onlineStatus"
,
onlineStatus
);
return
dmpRealtimeSyncInfoDao
.
deleteByrealTaskId
(
map
)
>
0
;
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/impl/DmpSyncingDatasourceServiceImpl.java
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.amazonaws.services.dynamodbv2.xspec.M
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.jz.agent.service.DmpDsAgentService
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.enums.DelFlagEnum
;
import
com.jz.common.enums.TestConnectStatusEnum
;
import
com.jz.common.exception.ServiceException
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.common.persistence.BaseService
;
import
com.jz.common.utils.JsonMapper
;
...
...
@@ -151,8 +154,11 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
JsonResult
delDataSourceById
(
String
datasourceId
)
throws
Exception
{
Map
map
=
new
HashMap
();
String
[]
ids
=
datasourceId
.
split
(
","
);
dmpSyncingDatasourceDao
.
delDataSourceById
(
ids
);
map
.
put
(
"ids"
,
ids
);
map
.
put
(
"dataStatus"
,
DelFlagEnum
.
YES
.
getValue
());
dmpSyncingDatasourceDao
.
delDataSourceById
(
map
);
return
new
JsonResult
();
}
...
...
@@ -303,11 +309,12 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
DmpAgentDatasourceInfo
ds
=
this
.
dsInfoDTO
(
saveBody
);
//查询数据源 对应的 数据库信息
DmpAgentResult
rst
=
dmpDsAgentServiceImp
.
testConnect
(
ds
);
//连接测试
if
(!
rst
.
getCode
().
val
().
equals
(
"200"
))
{
return
new
JsonResult
(
rst
.
getCode
(),
rst
.
getMessage
()
);
return
new
JsonResult
(
ResultCode
.
INTERNAL_SERVER_ERROR
,
"连接测试失败!"
);
}
else
{
//连接测试成功
rst
.
setResult
(
JsonMapper
.
fromJsonString
(
rst
.
getMessage
(),
Boolean
.
class
));
return
new
JsonResult
(
ResultCode
.
SUCCESS
,
rst
);
Object
flag
=
JsonMapper
.
fromJsonString
(
rst
.
getMessage
(),
Boolean
.
class
);
//rst.setResult(JsonMapper.fromJsonString(rst.getMessage(), Boolean.class));
return
new
JsonResult
(
ResultCode
.
SUCCESS
,
"连接测试成功!"
);
}
}
...
...
@@ -423,6 +430,10 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
ds
.
setDefaultFs
(
body
.
getDefaultFs
());
DmpProjectSystemInfo
info
=
dmpProjectDao
.
queryProjectSystemInfo
(
Long
.
valueOf
(
body
.
getProjectId
()));
if
(
info
==
null
)
{
//throw new RuntimeException("未查询到对应的项目系统配置信息");
throw
new
ServiceException
(
"未查询到对应的项目系统配置信息"
);
}
ds
.
setKerberosIsenable
(
info
.
getKerberosIsenable
());
ds
.
setKerberosJaasConf
(
info
.
getKerberosJaasConf
());
ds
.
setKerberosKrb5Conf
(
info
.
getKerberosKrb5Conf
());
...
...
src/main/java/com/jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
View file @
9f5de5a1
package
com
.
jz
.
dmp
.
modules
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.jz.agent.service.DmpDsAgentService
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.enums.DelFlagEnum
;
import
com.jz.common.page.BasePageBean
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.common.persistence.BaseService
;
...
...
@@ -17,6 +19,7 @@ import com.jz.common.utils.web.XmlUtils;
import
com.jz.dmp.agent.DmpAgentResult
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.*
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.flow.FlowExecution
;
import
com.jz.dmp.modules.controller.dataService.bean.SoureTableColumnsReq
;
import
com.jz.dmp.modules.dao.*
;
import
com.jz.dmp.modules.model.*
;
import
com.jz.dmp.modules.service.DmpDevelopTaskService
;
...
...
@@ -28,6 +31,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.security.access.method.P
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -87,6 +91,12 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
@Autowired
private
DvTaskRuleTService
dvTaskRuleTService
;
/**
* 离线同步任务列表分页查询
*
* @return
* @author Bellamy
*/
@Override
public
PageInfoResponse
<
TaskListPageDto
>
queryTaskListPage
(
TaskListPageReq
taskListPageReq
)
throws
Exception
{
PageInfoResponse
<
TaskListPageDto
>
pageInfoResponse
=
new
PageInfoResponse
<>();
...
...
@@ -120,6 +130,9 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
public
JsonResult
querygSourceTableList
(
Long
sourceDbId
,
String
targetName
)
throws
Exception
{
//通过源数据库id ,查询数据源配置
DmpAgentDatasourceInfo
dsInfo
=
offlineSynchDao
.
querySourceDbInfoBySourceId
(
sourceDbId
);
if
(
dsInfo
==
null
)
{
throw
new
RuntimeException
(
"数据源配置信息不存在!"
);
}
//解码源数据库密码
if
(
StringUtils
.
isNotBlank
(
dsInfo
.
getPassword
()))
{
dsInfo
.
setPassword
(
new
BaseService
().
decode
(
dsInfo
.
getPassword
(),
publicKey
));
...
...
@@ -133,13 +146,15 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
return
new
JsonResult
(
rst
.
getCode
(),
rst
.
getMessage
());
}
else
{
//成功
rst
.
setResult
(
JsonMapper
.
fromJsonString
(
rst
.
getMessage
(),
List
.
class
));
return
new
JsonResult
(
ResultCode
.
SUCCESS
,
rst
);
//
rst.setResult(JsonMapper.fromJsonString(rst.getMessage(), List.class));
return
new
JsonResult
(
ResultCode
.
SUCCESS
,
JsonMapper
.
fromJsonString
(
rst
.
getMessage
(),
List
.
class
)
);
}
}
/**
* 立即运行
*
* @author Bellamy
*/
@Override
public
JsonResult
taskRunNowByTaskId
(
String
taskId
)
throws
Exception
{
...
...
@@ -223,20 +238,28 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
}
/**
* 删除任务
* 批量删除离线任务
*
* @author Bellamy
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
JsonResult
delTaskByTaskId
(
String
taskId
)
throws
Exception
{
Map
params
=
new
HashMap
();
String
[]
ids
=
taskId
.
split
(
","
);
params
.
put
(
"ids"
,
ids
);
params
.
put
(
"dataStatus"
,
DelFlagEnum
.
YES
.
getValue
());
dmpDevelopTaskDao
.
deleteTaskByTaskId
(
params
);
//通过taskId,查询任务和资源是否存在
Map
map
=
dmpDevelopTaskDao
.
getDmpTaskAndTreeInfo
(
taskId
);
if
(
map
.
size
()
==
0
||
map
==
null
)
{
/*
Map map = dmpDevelopTaskDao.getDmpTaskAndTreeInfo(taskId);
if (map == null) {
return new JsonResult(ResultCode.OPERATION_DATA_NO_EXIST);
}
if (StringUtils.isEmpty(map.get("treeId").toString())) {
return new JsonResult(ResultCode.OPERATION_DATA_NO_EXIST);
}
dmpDevelopTaskDao
.
deleteTaskByTaskId
(
taskId
);
dmpDevelopTaskDao
.
deleteNavigationTreeByTreeId
(
map
.
get
(
"treeId"
).
toString
());
}*/
//dmpDevelopTaskDao.deleteNavigationTreeByTreeId(map.get("treeId").toString());
return
new
JsonResult
(
ResultCode
.
SUCCESS
);
}
...
...
@@ -292,6 +315,12 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
return
pageInfoResponse
;
}
/**
* 获取源表和目标表的字段
*
* @return
* @author Bellamy
*/
@Override
public
JsonResult
querySoureAndTargetColumnsByParams
(
SoureAndTargetColumnsReq
soureAndTargetColumnsReq
)
throws
Exception
{
//通过源数据库id ,查询数据源配置
...
...
@@ -526,15 +555,15 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
dmpNavigationTreeDao
.
update
(
dmpNavigationTree
);
//更新节点 树
logger
.
info
(
"################################## 更新节点 树 结束 ############################################"
);
//更新规则信息
List
<
DvTaskRuleT
>
list
=
new
ArrayList
<>();
List
<
DvTaskRuleT
>
list
=
new
ArrayList
<>();
//查询TaskRuleID 集合
List
<
Long
>
listRules
=
dvTaskRuleTService
.
getTaskRuleIdsList
(
taskId
);
if
(
CollectionUtils
.
isNotEmpty
(
listRules
)){
List
<
Long
>
listRules
=
dvTaskRuleTService
.
getTaskRuleIdsList
(
taskId
);
if
(
CollectionUtils
.
isNotEmpty
(
listRules
))
{
//批量删除rule信息
dvTaskRuleTService
.
delRulesByIds
(
listRules
);
List
<
Map
>
taskRules
=
(
List
<
Map
>)
reqParam
.
get
(
"taskRules"
);
List
<
Map
>
taskRules
=
(
List
<
Map
>)
reqParam
.
get
(
"taskRules"
);
//保存dmp数据校验规则信息
settRuleInfo
(
String
.
valueOf
(
taskId
),
taskRules
,
list
);
settRuleInfo
(
String
.
valueOf
(
taskId
),
taskRules
,
list
);
}
//保存时提交XML
dmpDevelopTaskService
.
submitSyncing
(
task
);
...
...
@@ -666,4 +695,43 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
//批量新增任务与规则关系表
dvTaskRuleTService
.
saveRule
(
list
);
}
/**
* 获取数据源表字段
*
* @return
* @author Bellamy
* @since 2021-01-21
*/
@Override
public
JsonResult
querySoureTableColumns
(
SoureTableColumnsReq
req
)
throws
Exception
{
//通过源数据库id ,查询数据源配置
DmpAgentDatasourceInfo
dsInfo
=
offlineSynchDao
.
querySourceDbInfoBySourceId
(
req
.
getSourceDbId
());
if
(
dsInfo
==
null
)
{
throw
new
RuntimeException
(
"数据源配置信息不存在!"
);
}
dsInfo
.
setFileType
(
req
.
getFileType
());
dsInfo
.
setDelimiter
(
req
.
getCsvDelimiter
());
dsInfo
.
setIsHaveHeader
(
req
.
getCsvIsHaveHeader
());
//解码源数据库密码
if
(
StringUtils
.
isNotBlank
(
dsInfo
.
getPassword
()))
{
dsInfo
.
setPassword
(
new
BaseService
().
decode
(
dsInfo
.
getPassword
(),
publicKey
));
}
//创建jdbc,获取数据源表字段
DmpAgentResult
rst
=
dmpDsAgentServiceImp
.
getTableColumnList
(
dsInfo
,
req
.
getTargetTableName
());
if
(!
rst
.
getCode
().
val
().
equals
(
"200"
))
{
return
new
JsonResult
(
rst
.
getCode
(),
rst
.
getMessage
());
}
else
{
//成功
List
<
Map
>
returnList
=
(
List
<
Map
>)
JsonMapper
.
fromJsonString
(
rst
.
getMessage
(),
List
.
class
);
if
(
returnList
!=
null
&&
returnList
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
returnList
.
size
();
i
++)
{
Map
map
=
returnList
.
get
(
i
);
map
.
put
(
"id"
,
i
+
1
);
}
}
return
JsonResult
.
ok
(
returnList
);
}
}
}
src/main/resources/mapper/dmp/DmpRealtimeSyncInfoMapper.xml
View file @
9f5de5a1
...
...
@@ -42,7 +42,7 @@
, src_database_type, src_database_name, connector_url, target_database_type, target_database_name, src_datasource_name
, target_datasource_name, store_type, status, create_time, update_time, cre_person, upt_person
from dmp_realtime_sync_info
where id = #{id}
where
data_status='1' and
id = #{id}
</select>
<!--查询指定行数据-->
...
...
@@ -321,12 +321,13 @@
t1.src_database_type as srcDatabaseType,
t1.target_datasource_id as targetDatasourceId,
t1.target_datasource_name as targetDatasourceName,
t1.target_database_type as targetDatabaseType
t1.target_database_type as targetDatabaseType,
t1.online_status as onlineStatus
FROM dmp_realtime_sync_info t1
left
join dmp_navigation_tree t2 on t1.tree_id=t2.id
inner
join dmp_navigation_tree t2 on t1.tree_id=t2.id
left join dmp_syncing_datasource t3 ON t1.src_datasource_id = t3.ID
left join dmp_syncing_datasource t4 ON t1.target_datasource_id = t4.ID
where 1=1 and t1.project_id=#{projectId}
where 1=1 and t1.
data_status='1' and t1.
project_id=#{projectId}
<if
test=
"taskStatus != null and taskStatus != '' "
>
AND t1.status = #{taskStatus}
</if>
<if
test=
"treeId != null and treeId != '' "
>
AND t1.id = #{treeId}
</if>
<if
test=
"targetDatabaseTypeId != null and targetDatabaseTypeId != '' "
>
AND t4.DATASOURCE_TYPE = #{targetDatabaseTypeId}
</if>
...
...
@@ -344,7 +345,7 @@
, src_database_type, src_database_name, connector_url, target_database_type, target_database_name, src_datasource_name
, target_datasource_name, store_type, status, create_time, update_time, cre_person, upt_person
from dmp_realtime_sync_info
where id in
where
1=1 and data_status='1' and
id in
<foreach
collection=
"ids"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
...
...
@@ -392,7 +393,7 @@
desensitization_field as desensitizationField,
arithmetic
from dmp_realtime_sync_info
where 1=1 and type =2
where 1=1 and
data_status='1' and
type =2
and src_datasource_id = #{srcDatasourceId}
<if
test=
"targetDatasourceId != null"
>
and target_datasource_id = #{targetDatasourceId}
</if>
<if
test=
"sourceTableName != null and sourceTableName !=''"
>
and src_table_name = #{sourceTableName}
</if>
...
...
@@ -421,7 +422,7 @@
t1.target_database_type as targetDatabaseType
FROM dmp_realtime_sync_info t1
left join dmp_navigation_tree t2 on t1.tree_id=t2.id
where 1=1
where 1=1
and t1.data_status='1'
<if
test=
"projectId !=null"
>
and t1.project_id=#{projectId}
</if>
<if
test=
"taskStatus != null and taskStatus != '' "
>
AND t1.status = #{taskStatus}
</if>
<if
test=
"treeId != null and treeId != '' "
>
AND t1.id = #{treeId}
</if>
...
...
@@ -513,6 +514,23 @@
left join dmp_realtime_sync_blacklist_table_info t2 ON t1.id = t2.realtime_id
left join dmp_realtime_sync_select_table t3 on t1.id=t3.realtime_id
WHERE
1 = 1 and id = #{taskId}
1 = 1 and
t1.data_status='1' and
id = #{taskId}
</select>
<!--批量删除 或 批量上下线-->
<update
id=
"deleteByrealTaskId"
parameterType=
"java.util.Map"
>
update dmp_realtime_sync_info
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"dataStatus != null"
>
data_status = #{dataStatus},
</if>
<if
test=
"onlineStatus != null and onlineStatus != ''"
>
online_status = #{onlineStatus},
</if>
</trim>
where id in
<foreach
collection=
"ids"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</update>
</mapper>
\ No newline at end of file
src/main/resources/mapper/dmp/DmpSyncingDatasourceMapper.xml
View file @
9f5de5a1
...
...
@@ -302,13 +302,18 @@
</select>
<!--批量删除-->
<delete
id=
"delDataSourceById"
parameterType=
"map"
>
delete from dmp_syncing_datasource
<update
id=
"delDataSourceById"
parameterType=
"map"
>
update dmp_syncing_datasource
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"dataStatus != null"
>
data_status = #{dataStatus},
</if>
</trim>
where ID in
<foreach
collection=
"ids"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</
dele
te>
</
upda
te>
<!--查询数据源类型名称-->
<select
id=
"queryDatasourceType"
resultType=
"map"
>
...
...
src/main/resources/mapper/dmp/OfflineSynchMapper.xml
View file @
9f5de5a1
...
...
@@ -49,17 +49,11 @@
dsdt.datasource_catecode as datasourceCatecode
from dmp_syncing_datasource ds
inner join dmp_syncing_datasource_type dsdt on ds.datasource_type = dsdt.id
<if
test =
'isEnableSource != null and isEnableSource == "1"'
>
and dsdt.is_enable_source = '1'
</if>
<if
test =
"isEnableTarget != null and isEnableTarget=='1'.toString()"
>
and dsdt.is_enable_target = '1'
</if>
where ds.data_status = '1'
and ds.project_id = #{projectId}
<if
test =
'datasourceType != null and datasourceType > 0 '
>
and ds.DATASOURCE_TYPE = #{datasourceType}
</if>
<if
test =
'isEnableSource != null and isEnableSource == "1"'
>
and dsdt.is_enable_source = '1'
</if>
<if
test =
"isEnableTarget != null and isEnableTarget=='1'.toString()"
>
and dsdt.is_enable_target = '1'
</if>
where ds.data_status = '1' and ds.project_id = #{projectId}
<if
test=
"dbName != null and dbName !='' "
>
and dsdt.datasource = #{dbName}
</if>
<if
test =
'datasourceType != null and datasourceType > 0 '
>
and ds.DATASOURCE_TYPE = #{datasourceType}
</if>
</select>
<!--主键查询数据源-->
...
...
@@ -144,7 +138,7 @@
from dmp_develop_task t1
inner join dmp_navigation_tree t2 on t1.TREE_ID=t2.ID
left join dmp_project_system_info t3 on t2.PROJECT_ID=t3.PROJECT_ID and t3.data_status = '1'
where 1=1 and t2.id = #{taskId}
where 1=1 and t
1.data_status ='1' and t
2.id = #{taskId}
</select>
<!-- 根据执行实例id查询规则执行结果表 -->
...
...
@@ -171,23 +165,23 @@
</if>
</select>
<!--离线同步列表-->
<select
id=
"selectOfflineTaskInfo"
resultType=
"com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto"
parameterType=
"com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq"
>
SELECT
ddt.id AS taskId,
ddt.tree_id AS treeId,
dnt.NAME AS treeName,
dnt.CREATE_USER_ID
as createUserId,
t3.real_name
as createUserId,
DATE_FORMAT( ddt.create_time, '%Y-%m-%d %H:%i:%s' ) AS createTime,
DATE_FORMAT( ddt.update_time, '%Y-%m-%d %H:%i:%s' ) AS updateTime
FROM dmp_develop_task AS ddt
INNER JOIN dmp_navigation_tree AS dnt ON ddt.TREE_ID = dnt.ID
LEFT JOIN dmp_syncing_datasource AS dsd ON instr(script,concat('"targetDbConnection":"',dsd.datasource_name,'"'))>0
WHERE ddt.data_status ='1' AND ddt.TYPE='3' AND ddt.TASK_TYPE ='2'
AND dnt.CATEGORY='2' AND dnt.TYPE ='3'
AND dnt.IS_LEVEL ='1'
AND dnt.PROJECT_ID =31
AND dsd.PROJECT_ID=31
FROM dmp_develop_task ddt
INNER join dmp_navigation_tree dnt ON ddt.TREE_ID = dnt.ID
left join dmp_member t3 on ddt.create_user_id=t3.user_id
left join dmp_syncing_datasource dsd ON instr(script,concat('"targetDbConnection":"',dsd.datasource_name,'"'))>0
WHERE ddt.data_status ='1' and dnt.TYPE ='01' and dnt.IS_LEVEL ='1'
and dnt.PROJECT_ID =#{projectId}
<if
test=
"treeName != null and treeName != ''"
>
dnt.NAME like concat('%',#{treeName},'%')
</if>
ORDER BY ddt.create_time DESC
</select>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment