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
688f3c6a
Commit
688f3c6a
authored
Mar 03, 2021
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据服务代码修改
parent
35a165e6
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
107 additions
and
127 deletions
+107
-127
GatewayApiConstant.java
src/main/java/com/jz/common/constant/GatewayApiConstant.java
+5
-6
SynchTableColumnsReq.java
...controller/DataIntegration/bean/SynchTableColumnsReq.java
+10
-0
DmpApiMangeController.java
...modules/controller/dataService/DmpApiMangeController.java
+21
-0
DmpApiMangeService.java
...n/java/com/jz/dmp/modules/service/DmpApiMangeService.java
+8
-0
DmpApiMangeServiceImpl.java
...m/jz/dmp/modules/service/impl/DmpApiMangeServiceImpl.java
+16
-0
DmpApiServiceMangeServiceImpl.java
...p/modules/service/impl/DmpApiServiceMangeServiceImpl.java
+1
-17
DmpOrgMangeServiceImpl.java
...m/jz/dmp/modules/service/impl/DmpOrgMangeServiceImpl.java
+6
-84
DmpRealtimeSyncInfoServiceImpl.java
.../modules/service/impl/DmpRealtimeSyncInfoServiceImpl.java
+1
-0
OfflineSynchServiceImpl.java
.../jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
+31
-5
lxTaskJson.json
src/main/resources/templates/lxTaskJson.json
+8
-15
No files found.
src/main/java/com/jz/common/constant/GatewayApiConstant.java
View file @
688f3c6a
...
...
@@ -74,13 +74,12 @@ public class GatewayApiConstant {
public
static
final
String
listServerApplyApi
=
"/api/interface/listServerApplyApi"
;
//获取文件夹树
public
static
final
String
folderTree
=
"/api/producer/getFileCatalog"
;
//服务开发---获取ApiId
public
static
final
String
getApiId
=
"/api/producer/getCustomApiId"
;
//创建项目文件夹
public
static
final
String
createProjectFolder
=
"/api/producer/createProjectFolder"
;
//授权--组织名称查询
public
static
final
String
getOrgNameList
=
"/api/auth/get-org-list"
;
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
GatewayApiConstant
.
class
);
...
...
@@ -93,7 +92,7 @@ public class GatewayApiConstant {
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"failed!"
);
}
logger
.
info
(
"##############
###响应结果数据
{}"
+
resultData
);
logger
.
info
(
"##############
response results
{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
...
...
@@ -121,7 +120,7 @@ public class GatewayApiConstant {
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"failed!"
);
}
logger
.
info
(
"##############
###响应结果
{}"
+
returnData
);
logger
.
info
(
"##############
response results
{}"
+
returnData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
returnData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
...
...
@@ -149,7 +148,7 @@ public class GatewayApiConstant {
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"failed!"
);
}
logger
.
info
(
"##############
###响应结果
{}"
+
returnData
);
logger
.
info
(
"##############
response results
{}"
+
returnData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
returnData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
...
...
src/main/java/com/jz/dmp/modules/controller/DataIntegration/bean/SynchTableColumnsReq.java
View file @
688f3c6a
...
...
@@ -28,6 +28,9 @@ public class SynchTableColumnsReq implements Serializable {
@ApiModelProperty
(
value
=
"目标表名称"
)
private
String
targetTableName
;
@ApiModelProperty
(
value
=
"字段名称"
)
private
String
fieldName
;
public
Long
getSourceDbId
()
{
return
sourceDbId
;
}
...
...
@@ -44,4 +47,11 @@ public class SynchTableColumnsReq implements Serializable {
this
.
sourceDbId
=
sourceDbId
;
}
public
String
getFieldName
()
{
return
fieldName
;
}
public
void
setFieldName
(
String
fieldName
)
{
this
.
fieldName
=
fieldName
;
}
}
src/main/java/com/jz/dmp/modules/controller/dataService/DmpApiMangeController.java
View file @
688f3c6a
...
...
@@ -370,4 +370,25 @@ public class DmpApiMangeController {
return
jsonResult
;
}
/**
* 授权--组织名称查询
*
* @author Bellamy
* @since 2021-03-02
*/
@ApiOperation
(
value
=
"授权--组织名称查询"
,
notes
=
"授权--组织名称查询"
)
@GetMapping
(
value
=
"/getAuthOrgName"
)
@ApiImplicitParam
(
name
=
"orgName"
,
value
=
"组织名称"
,
required
=
true
)
public
JsonResult
getAuthOrgName
(
@RequestParam
String
orgName
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
getAuthOrgName
(
orgName
);
}
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/service/DmpApiMangeService.java
View file @
688f3c6a
...
...
@@ -132,4 +132,12 @@ public interface DmpApiMangeService {
* @since 2021-02-20
*/
JsonResult
logDetails
(
String
id
)
throws
Exception
;
/**
* 授权--组织名称查询
*
* @author Bellamy
* @since 2021-03-02
*/
JsonResult
getAuthOrgName
(
String
orgName
)
throws
Exception
;
}
src/main/java/com/jz/dmp/modules/service/impl/DmpApiMangeServiceImpl.java
View file @
688f3c6a
...
...
@@ -425,4 +425,20 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
return
result
;
}
/**
* 授权--组织名称查询
*
* @param orgName
* @author Bellamy
* @since 2021-03-02
*/
@Override
public
JsonResult
getAuthOrgName
(
String
orgName
)
throws
Exception
{
String
url
=
gatewayUrl
+
GatewayApiConstant
.
getOrgNameList
;
Map
params
=
new
HashMap
();
params
.
put
(
"orgName"
,
orgName
);
JsonResult
result
=
GatewayApiConstant
.
getRequest2GetData
(
url
,
params
);
return
result
;
}
}
src/main/java/com/jz/dmp/modules/service/impl/DmpApiServiceMangeServiceImpl.java
View file @
688f3c6a
...
...
@@ -270,7 +270,6 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
*/
@Override
public
JsonResult
getFolderTree
(
String
projectId
,
String
orgCode
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
folderTree
;
Map
params
=
new
HashMap
();
...
...
@@ -278,22 +277,7 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
params
.
put
(
"projectId"
,
projectId
);
}
params
.
put
(
"orgCode"
,
orgCode
);
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
(
"msg"
))
{
logger
.
info
(
map
.
get
(
"msg"
).
toString
());
result
.
setMessage
(
map
.
get
(
"msg"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
JsonResult
result
=
GatewayApiConstant
.
getRequest2GetData
(
url
,
params
);
return
result
;
}
...
...
src/main/java/com/jz/dmp/modules/service/impl/DmpOrgMangeServiceImpl.java
View file @
688f3c6a
...
...
@@ -41,29 +41,12 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
*/
@Override
public
JsonResult
queryOrgListPage
(
OrganizationManageListQueryReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
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
(
"msg"
))
{
logger
.
info
(
jsonObject
.
get
(
"msg"
).
toString
());
result
.
setMessage
(
jsonObject
.
get
(
"msg"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
JsonResult
result
=
GatewayApiConstant
.
postRequest2GetData
(
url
,
JSONObject
.
toJSONString
(
req
));
return
result
;
}
...
...
@@ -79,18 +62,8 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
Map
params
=
new
HashMap
();
params
.
put
(
"id"
,
id
);
String
url
=
gatewayUrl
+
GatewayApiConstant
.
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
(
"删除失败!"
);
JsonResult
result
=
GatewayApiConstant
.
getRequest2GetData
(
url
,
params
);
return
result
;
}
/**
...
...
@@ -102,26 +75,9 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
*/
@Override
public
JsonResult
addOrg
(
OrganizationManageAddReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
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
(
"msg"
))
{
logger
.
info
(
map
.
get
(
"msg"
).
toString
());
result
.
setMessage
(
map
.
get
(
"msg"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
JsonResult
result
=
GatewayApiConstant
.
postRequest2GetData
(
url
,
JSONObject
.
toJSONString
(
req
));
return
result
;
}
...
...
@@ -134,27 +90,10 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
*/
@Override
public
JsonResult
updateOrg
(
OrganizationManageUpdateReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
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
(
"msg"
))
{
logger
.
info
(
map
.
get
(
"msg"
).
toString
());
result
.
setMessage
(
map
.
get
(
"msg"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
JsonResult
result
=
GatewayApiConstant
.
postRequest2GetData
(
url
,
JSONObject
.
toJSONString
(
req
));
return
result
;
}
...
...
@@ -166,27 +105,10 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
*/
@Override
public
JsonResult
getOrgInfoByOrgId
(
String
id
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
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
(
"msg"
))
{
logger
.
info
(
map
.
get
(
"msg"
).
toString
());
result
.
setMessage
(
map
.
get
(
"msg"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
JsonResult
result
=
GatewayApiConstant
.
postRequest2GetData
(
url
,
JSONObject
.
toJSONString
(
req
));
return
result
;
}
}
src/main/java/com/jz/dmp/modules/service/impl/DmpRealtimeSyncInfoServiceImpl.java
View file @
688f3c6a
...
...
@@ -1002,6 +1002,7 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
OKHttpUtil
.
httpPut
(
url
,
""
);
//获取任务状态
String
status
=
getExecuteShellStatus
(
statusUrl
+
"/status"
,
new
HashMap
<>());
logger
.
info
(
"response status{}"
+
status
);
//执行后任务状态 :PAUSED 暂停 , RUNNING 运行中
saveBaby
.
setStatus
(
status
);
saveBaby
.
setUptPerson
(
SessionUtils
.
getCurrentUserId
());
...
...
src/main/java/com/jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
View file @
688f3c6a
...
...
@@ -553,7 +553,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
task
.
setId
(
taskId
);
dmpDevelopTaskDao
.
update
(
task
);
//更新任务
logger
.
info
(
"
################################## 更新任务数据结束 ############################################
"
);
logger
.
info
(
"
======== edit sync task end ========
"
);
//更新规则信息
List
<
DvTaskRuleT
>
list
=
new
ArrayList
<>();
...
...
@@ -649,7 +649,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
task
.
setCreateTime
(
new
Date
());
dmpDevelopTaskDao
.
insert
(
task
);
//新增任务数据
this
.
saveTaskHistory
(
task
);
//保存任务历史版本
logger
.
info
(
"
################################## 新增离线任务数据结束 ############################################
"
);
logger
.
info
(
"
======== save sync task end ========
"
);
//保存dmp数据校验规则信息
settRuleInfo
(
taskId
,
taskRules
,
list
);
}
else
{
...
...
@@ -661,8 +661,8 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
task
.
setUpdateUserId
(
SessionUtils
.
getCurrentUserId
());
task
.
setId
(
Integer
.
valueOf
(
taskId
));
dmpDevelopTaskDao
.
update
(
task
);
logger
.
info
(
"======== edit sync task end ========"
);
this
.
saveTaskHistory
(
task
);
//保存任务历史版本
logger
.
info
(
"################################## 编辑离线任务数据结束 ############################################"
);
//更新规则信息
//查询TaskRuleID 集合
List
<
Long
>
listRules
=
dvTaskRuleTService
.
getTaskRuleIdsList
(
Integer
.
valueOf
(
taskId
));
...
...
@@ -702,7 +702,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
taskHistory
.
setCreateUserId
(
Integer
.
valueOf
(
SessionUtils
.
getCurrentUserId
()));
taskHistory
.
setDataStatus
(
DelFlagEnum
.
NO
.
getValue
());
dmpDevelopTaskHistoryMapper
.
insert
(
taskHistory
);
logger
.
info
(
"
################################## 新增离线任务版本记录结束 ############################################
"
);
logger
.
info
(
"
======== save sync task history end ========
"
);
return
JsonResult
.
ok
();
}
...
...
@@ -771,7 +771,8 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
if
(
req
.
size
()
==
0
||
req
==
null
)
{
throw
new
RuntimeException
(
"请求参数不能为空!"
);
}
for
(
SynchTableColumnsReq
str
:
req
.
get
(
"params"
))
{
List
<
SynchTableColumnsReq
>
list
=
req
.
get
(
"params"
);
for
(
SynchTableColumnsReq
str
:
list
)
{
//通过源数据库id ,查询数据源配置
DmpAgentDatasourceInfo
dsInfos
=
offlineSynchDao
.
querySourceDbInfoBySourceId
(
str
.
getSourceDbId
());
DmpAgentDatasourceInfo
dsInfo
=
new
DmpAgentDatasourceInfo
();
...
...
@@ -806,9 +807,34 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
}
}
}
if
(
StringUtils
.
isNotEmpty
(
list
.
get
(
0
).
getFieldName
()))
{
List
<
Map
>
searchFieldList
=
getFieldName
(
returnData
,
list
.
get
(
0
).
getFieldName
());
return
JsonResult
.
ok
(
searchFieldList
);
}
return
JsonResult
.
ok
(
returnData
);
}
/**
* 根据参数搜索表字段
*
* @return
* @author Bellamy
* @since 2021-03-02
*/
public
List
<
Map
>
getFieldName
(
List
<
Map
>
list
,
String
fieldName
)
throws
Exception
{
List
<
Map
>
returnList
=
new
ArrayList
<>();
if
(
list
.
size
()
>
0
&&
null
!=
list
)
{
for
(
Map
str
:
list
)
{
String
name
=
(
String
)
str
.
get
(
"name"
);
if
(
name
.
contains
(
fieldName
))
{
returnList
.
add
(
str
);
}
}
}
return
returnList
;
}
/**
* 任务停止运行
*
...
...
src/main/resources/templates/lxTaskJson.json
View file @
688f3c6a
...
...
@@ -82,8 +82,6 @@
{
"params"
:
{
//
"version"
:
"1.0"
,
//版本
"treeId"
:
669
,
"projectId"
:
"31"
,
"taskId"
:
""
,
//任务id
...
...
@@ -103,7 +101,6 @@
"driverMemory"
:
""
,
//分配任务内存
"executorCore"
:
"1"
,
//单executor的cpu数
"driverCore"
:
"1"
//单executor的cpu数
//
"fieldMapping"
:
""
//字段映射关系
},
"reader"
:
{
"sourceDbId"
:
""
,
...
...
@@ -130,19 +127,13 @@
"column"
:
[
{
"name"
:
"host"
,
"type"
:
"VARCHAR"
"type"
:
"VARCHAR"
,
"fieldAlias"
:
""
},
{
"name"
:
"port"
,
"type"
:
"VARCHAR"
},
{
"name"
:
"user_name"
,
"type"
:
"VARCHAR"
},
{
"name"
:
"pass_word"
,
"type"
:
"VARCHAR"
"type"
:
"VARCHAR"
,
"fieldAlias"
:
""
}
]
},
...
...
@@ -219,8 +210,10 @@
},
"mappingRelation"
:[
{
"sourceField"
:
""
,
"targetField"
:
""
"sourceFieldId"
:
""
,
"sourceField"
:
""
,
"targetFieldId"
:
""
,
"targetField"
:
""
}
]
},
...
...
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