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
cc0d2675
Commit
cc0d2675
authored
Jan 29, 2021
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
dc687f4c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
33 deletions
+83
-33
OfflineSynchController.java
...es/controller/DataIntegration/OfflineSynchController.java
+2
-2
SynchTableColumnsReq.java
...controller/DataIntegration/bean/SynchTableColumnsReq.java
+47
-0
DmpApiServiceMangeController.java
.../controller/dataService/DmpApiServiceMangeController.java
+2
-2
OfflineSynchService.java
.../java/com/jz/dmp/modules/service/OfflineSynchService.java
+1
-1
OfflineSynchServiceImpl.java
.../jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
+31
-28
No files found.
src/main/java/com/jz/dmp/modules/controller/DataIntegration/OfflineSynchController.java
View file @
cc0d2675
...
@@ -202,10 +202,10 @@ public class OfflineSynchController {
...
@@ -202,10 +202,10 @@ public class OfflineSynchController {
*/
*/
@ApiOperation
(
value
=
"获取数据源表字段"
,
notes
=
"获取数据源表字段"
)
@ApiOperation
(
value
=
"获取数据源表字段"
,
notes
=
"获取数据源表字段"
)
@PostMapping
(
value
=
"/getSoureAndTargetColumns"
)
@PostMapping
(
value
=
"/getSoureAndTargetColumns"
)
public
JsonResult
getSoureAndTargetColumns
(
@RequestBody
@Validated
SoureTableColumnsReq
soureAndTargetColumnsR
eq
)
throws
Exception
{
public
JsonResult
getSoureAndTargetColumns
(
@RequestBody
@Validated
List
<
SynchTableColumnsReq
>
r
eq
)
throws
Exception
{
JsonResult
jsonResult
=
new
JsonResult
();
JsonResult
jsonResult
=
new
JsonResult
();
try
{
try
{
jsonResult
=
offlineSynchService
.
querySoureTableColumns
(
soureAndTargetColumnsR
eq
);
jsonResult
=
offlineSynchService
.
querySoureTableColumns
(
r
eq
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
...
...
src/main/java/com/jz/dmp/modules/controller/DataIntegration/bean/SynchTableColumnsReq.java
0 → 100644
View file @
cc0d2675
package
com
.
jz
.
dmp
.
modules
.
controller
.
DataIntegration
.
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: SynchTableColumnsReq
* @Description: 获取表字段-请求对象
* @Author:Bellamy
* @Date 2020/12/21
* @Version 1.0
*/
@ApiModel
(
value
=
"获取表字段-请求对象"
,
description
=
"获取表字段-请求对象"
)
public
class
SynchTableColumnsReq
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2235510265678437967L
;
/*
* 源数据库ID
* */
@NotNull
(
message
=
"源数据库ID不能为空"
)
@ApiModelProperty
(
value
=
"源数据库ID"
)
private
Long
sourceDbId
;
@ApiModelProperty
(
value
=
"目标表名称"
)
private
String
targetTableName
;
public
Long
getSourceDbId
()
{
return
sourceDbId
;
}
public
String
getTargetTableName
()
{
return
targetTableName
;
}
public
void
setTargetTableName
(
String
targetTableName
)
{
this
.
targetTableName
=
targetTableName
;
}
public
void
setSourceDbId
(
Long
sourceDbId
)
{
this
.
sourceDbId
=
sourceDbId
;
}
}
src/main/java/com/jz/dmp/modules/controller/dataService/DmpApiServiceMangeController.java
View file @
cc0d2675
...
@@ -252,7 +252,7 @@ public class DmpApiServiceMangeController {
...
@@ -252,7 +252,7 @@ public class DmpApiServiceMangeController {
* @author Bellamy
* @author Bellamy
* @since 2021-01-21
* @since 2021-01-21
*/
*/
@ApiOperation
(
value
=
"获取数据源表字段"
,
notes
=
"获取数据源表字段"
)
/*
@ApiOperation(value = "获取数据源表字段", notes = "获取数据源表字段")
@PostMapping(value = "/getTableColumns")
@PostMapping(value = "/getTableColumns")
public JsonResult getTableColumns(@RequestBody @Validated SoureTableColumnsReq req) throws Exception {
public JsonResult getTableColumns(@RequestBody @Validated SoureTableColumnsReq req) throws Exception {
JsonResult jsonResult = new JsonResult();
JsonResult jsonResult = new JsonResult();
...
@@ -264,6 +264,6 @@ public class DmpApiServiceMangeController {
...
@@ -264,6 +264,6 @@ public class DmpApiServiceMangeController {
e.printStackTrace();
e.printStackTrace();
}
}
return jsonResult;
return jsonResult;
}
}
*/
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/OfflineSynchService.java
View file @
cc0d2675
...
@@ -101,7 +101,7 @@ public interface OfflineSynchService {
...
@@ -101,7 +101,7 @@ public interface OfflineSynchService {
* @author Bellamy
* @author Bellamy
* @since 2021-01-21
* @since 2021-01-21
*/
*/
JsonResult
querySoureTableColumns
(
SoureTableColumnsReq
req
)
throws
Exception
;
JsonResult
querySoureTableColumns
(
List
<
SynchTableColumnsReq
>
req
)
throws
Exception
;
/**
/**
* 任务停止运行
* 任务停止运行
...
...
src/main/java/com/jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
View file @
cc0d2675
...
@@ -19,7 +19,6 @@ import com.jz.common.utils.web.XmlUtils;
...
@@ -19,7 +19,6 @@ import com.jz.common.utils.web.XmlUtils;
import
com.jz.dmp.agent.DmpAgentResult
;
import
com.jz.dmp.agent.DmpAgentResult
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.*
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.*
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.flow.FlowExecution
;
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.dao.*
;
import
com.jz.dmp.modules.model.*
;
import
com.jz.dmp.modules.model.*
;
import
com.jz.dmp.modules.service.DmpDevelopTaskService
;
import
com.jz.dmp.modules.service.DmpDevelopTaskService
;
...
@@ -114,7 +113,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
...
@@ -114,7 +113,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
* 获取源数据库名称——下拉框
* 获取源数据库名称——下拉框
*/
*/
@Override
@Override
public
JsonResult
<
List
<
SourceDbNameListDto
>>
querygSourceDbList
(
Integer
projectId
,
String
datasourceTypeId
)
throws
Exception
{
public
JsonResult
<
List
<
SourceDbNameListDto
>>
querygSourceDbList
(
Integer
projectId
,
String
datasourceTypeId
)
throws
Exception
{
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
();
map
.
put
(
"projectId"
,
projectId
);
//项目id
map
.
put
(
"projectId"
,
projectId
);
//项目id
map
.
put
(
"datasourceTypeId"
,
datasourceTypeId
);
map
.
put
(
"datasourceTypeId"
,
datasourceTypeId
);
...
@@ -703,36 +702,40 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
...
@@ -703,36 +702,40 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
* @since 2021-01-21
* @since 2021-01-21
*/
*/
@Override
@Override
public
JsonResult
querySoureTableColumns
(
SoureTableColumnsReq
req
)
throws
Exception
{
public
JsonResult
querySoureTableColumns
(
List
<
SynchTableColumnsReq
>
req
)
throws
Exception
{
//通过源数据库id ,查询数据源配置
List
<
Map
>
returnData
=
new
ArrayList
<>();
DmpAgentDatasourceInfo
dsInfo
=
offlineSynchDao
.
querySourceDbInfoBySourceId
(
req
.
getSourceDbId
());
int
len
=
0
;
if
(
dsInfo
==
null
)
{
if
(
req
.
size
()
==
0
||
req
==
null
)
{
throw
new
RuntimeException
(
"数据源配置信息不存在!"
);
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,获取数据源表字段
for
(
SynchTableColumnsReq
str
:
req
)
{
DmpAgentResult
rst
=
dmpDsAgentServiceImp
.
getTableColumnList
(
dsInfo
,
req
.
getTargetTableName
());
//通过源数据库id ,查询数据源配置
if
(!
rst
.
getCode
().
val
().
equals
(
"200"
))
{
DmpAgentDatasourceInfo
dsInfo
=
offlineSynchDao
.
querySourceDbInfoBySourceId
(
str
.
getSourceDbId
());
return
new
JsonResult
(
rst
.
getCode
(),
rst
.
getMessage
());
if
(
dsInfo
==
null
)
{
}
else
{
throw
new
RuntimeException
(
"数据源配置信息不存在!"
);
//成功
}
List
<
Map
>
returnList
=
(
List
<
Map
>)
JsonMapper
.
fromJsonString
(
rst
.
getMessage
(),
List
.
class
);
//解码源数据库密码
if
(
returnList
!=
null
&&
returnList
.
size
()
>
0
)
{
if
(
StringUtils
.
isNotBlank
(
dsInfo
.
getPassword
()))
{
for
(
int
i
=
0
;
i
<
returnList
.
size
();
i
++)
{
dsInfo
.
setPassword
(
new
BaseService
().
decode
(
dsInfo
.
getPassword
(),
publicKey
));
Map
map
=
returnList
.
get
(
i
);
}
map
.
put
(
"id"
,
i
+
1
);
}
//创建jdbc,获取数据源表字段
DmpAgentResult
rst
=
dmpDsAgentServiceImp
.
getTableColumnList
(
dsInfo
,
str
.
getTargetTableName
());
if
(!
rst
.
getCode
().
val
().
equals
(
"200"
))
{
return
new
JsonResult
(
rst
.
getCode
(),
rst
.
getMessage
());
}
else
{
}
else
{
throw
new
RuntimeException
(
"无数据!"
);
//成功
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"
,
++
len
);
returnData
.
add
(
map
);
}
}
}
}
return
JsonResult
.
ok
(
returnList
);
}
}
return
JsonResult
.
ok
(
returnData
);
}
}
/**
/**
...
...
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