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
b7cfadf6
Commit
b7cfadf6
authored
Dec 21, 2020
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
88e4a4f9
Changes
14
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1834 additions
and
3 deletions
+1834
-3
BaseDao.java
src/main/java/com/jz/common/persistence/BaseDao.java
+5
-0
BaseService.java
src/main/java/com/jz/common/persistence/BaseService.java
+70
-0
CrudDao.java
src/main/java/com/jz/common/persistence/CrudDao.java
+59
-0
OfflineSynchController.java
...es/controller/DataIntegration/OfflineSynchController.java
+14
-1
SourceDbNameListDto.java
.../controller/DataIntegration/bean/SourceDbNameListDto.java
+1
-1
DmpProjectDao.java
src/main/java/com/jz/dmp/modules/dao/DmpProjectDao.java
+33
-0
OfflineSynchDao.java
src/main/java/com/jz/dmp/modules/dao/OfflineSynchDao.java
+4
-0
DmpAgentDatasourceInfo.java
...java/com/jz/dmp/modules/model/DmpAgentDatasourceInfo.java
+523
-0
DmpSyncingDatasource.java
...n/java/com/jz/dmp/modules/model/DmpSyncingDatasource.java
+330
-0
DmpSyncingDatasourceType.java
...va/com/jz/dmp/modules/model/DmpSyncingDatasourceType.java
+177
-0
OfflineSynchService.java
.../java/com/jz/dmp/modules/service/OfflineSynchService.java
+5
-0
OfflineSynchServiceImpl.java
.../jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
+68
-1
DmpProjectMapper.xml
src/main/resources/mapper/dmp/DmpProjectMapper.xml
+514
-0
OfflineSynchMapper.xml
src/main/resources/mapper/dmp/OfflineSynchMapper.xml
+31
-0
No files found.
src/main/java/com/jz/common/persistence/BaseDao.java
0 → 100644
View file @
b7cfadf6
package
com
.
jz
.
common
.
persistence
;
public
interface
BaseDao
{
}
\ No newline at end of file
src/main/java/com/jz/common/persistence/BaseService.java
0 → 100644
View file @
b7cfadf6
package
com
.
jz
.
common
.
persistence
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.crypto.Cipher
;
import
javax.crypto.spec.SecretKeySpec
;
import
java.math.BigDecimal
;
import
java.security.Key
;
import
java.util.Base64
;
@SuppressWarnings
(
"restriction"
)
@Transactional
(
readOnly
=
true
)
public
class
BaseService
{
protected
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
@Value
(
"${spring.public-key}"
)
private
String
publicKey
;
public
BigDecimal
format
(
Object
obj
)
{
BigDecimal
bak
=
new
BigDecimal
(
0
);
if
(
obj
!=
null
)
{
if
(
obj
instanceof
String
)
{
if
(
StringUtils
.
isNotBlank
((
String
)
obj
))
{
bak
=
new
BigDecimal
((
String
)
obj
);
}
}
else
if
(
obj
instanceof
Integer
)
{
bak
=
new
BigDecimal
((
Integer
)
obj
);
}
else
if
(
obj
instanceof
Double
)
{
bak
=
new
BigDecimal
((
Double
)
obj
);
}
else
if
(
obj
instanceof
Float
)
{
bak
=
new
BigDecimal
((
Float
)
obj
);
}
else
{
bak
=
new
BigDecimal
(
String
.
valueOf
(
obj
));
}
}
return
bak
;
}
public
String
encode
(
String
pass
)
{
String
str
=
""
;
try
{
Key
key
=
new
SecretKeySpec
(
Base64
.
getMimeDecoder
().
decode
(
publicKey
),
"DESede"
);
Cipher
cipher
=
Cipher
.
getInstance
(
"DESede"
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
key
);
str
=
Base64
.
getMimeEncoder
().
encodeToString
(
cipher
.
doFinal
(
pass
.
getBytes
()));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
str
;
}
public
String
decode
(
String
pass
)
{
String
str
=
""
;
try
{
Key
key
=
new
SecretKeySpec
(
Base64
.
getMimeDecoder
().
decode
(
publicKey
),
"DESede"
);
Cipher
cipher
=
Cipher
.
getInstance
(
"DESede"
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
key
);
str
=
new
String
(
cipher
.
doFinal
(
Base64
.
getMimeDecoder
().
decode
(
pass
)));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
str
;
}
}
src/main/java/com/jz/common/persistence/CrudDao.java
0 → 100644
View file @
b7cfadf6
package
com
.
jz
.
common
.
persistence
;
import
java.util.List
;
public
interface
CrudDao
<
T
>
extends
BaseDao
{
/**
* 获取单条数据
* @param id
* @return
*/
public
T
get
(
Long
id
);
/**
* 获取单条数据
* @param entity
* @return
*/
public
T
get
(
T
entity
);
/**
* 查询数据列表,如果需要分页,请设置分页对象
*
* @param entity
* @return
*/
public
List
<
T
>
findList
(
T
entity
);
/**
* 查询所有数据列表
* @param entity
* @return
*/
public
List
<
T
>
findAllList
();
/**
* 插入数据
* @param entity
* @return
*/
public
int
insert
(
T
entity
);
/**
* 删除数据(一般为逻辑删除,更新data_state字段为0)
* @param entity
* @return
*/
public
int
delete
(
long
entity
);
/**
* 更新数据
* @param entity
* @return
*/
public
int
update
(
T
entity
);
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/controller/DataIntegration/OfflineSynchController.java
View file @
b7cfadf6
...
...
@@ -58,9 +58,22 @@ public class OfflineSynchController {
*/
@ApiOperation
(
value
=
"获取源数据库名称-下拉框"
,
notes
=
"获取源数据库名称"
)
@GetMapping
(
value
=
"/sourceDbList"
)
@ApiImplicitParam
(
name
=
"projectId"
,
value
=
"项目id"
)
@ApiImplicitParam
(
name
=
"projectId"
,
value
=
"项目id"
)
public
JsonResult
<
List
<
SourceDbNameListDto
>>
getSourceDbList
(
@RequestParam
Integer
projectId
)
throws
Exception
{
JsonResult
<
List
<
SourceDbNameListDto
>>
jsonResult
=
offlineSynchService
.
querygSourceDbList
(
projectId
);
return
jsonResult
;
}
/**
* 根据源数据库id,获取源数据表——下拉框
*
* @return
*/
@ApiOperation
(
value
=
"根据源数据库id,获取源数据表-下拉框"
,
notes
=
"根据源数据库id,获取源数据表"
)
@GetMapping
(
value
=
"/sourceTableList"
)
@ApiImplicitParam
(
name
=
"sourceDbId"
,
value
=
"源数据库id"
)
public
JsonResult
getSourceTableList
(
@RequestParam
Integer
sourceDbId
,
@RequestParam
(
value
=
"targetName"
,
required
=
false
)
String
targetName
)
throws
Exception
{
List
<
Map
>
list
=
offlineSynchService
.
querygSourceTableList
(
sourceDbId
,
targetName
);
return
new
JsonResult
(
ResultCode
.
SUCCESS
,
list
);
}
}
src/main/java/com/jz/dmp/modules/controller/DataIntegration/bean/SourceDbNameListDto.java
View file @
b7cfadf6
...
...
@@ -16,7 +16,7 @@ public class SourceDbNameListDto {
/*
* 源数据id
* */
@ApiModelProperty
(
value
=
"源数据id"
)
@ApiModelProperty
(
value
=
"源数据
库
id"
)
String
id
;
/*
...
...
src/main/java/com/jz/dmp/modules/dao/DmpProjectDao.java
0 → 100644
View file @
b7cfadf6
package
com
.
jz
.
dmp
.
modules
.
dao
;
import
com.jz.common.persistence.CrudDao
;
import
com.jz.dmp.modules.model.DmpProject
;
import
com.jz.dmp.modules.model.DmpProjectSystemInfo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
public
interface
DmpProjectDao
extends
CrudDao
<
DmpProject
>
{
public
List
<
DmpProject
>
getExampleQuery
(
Map
<
String
,
Object
>
params
);
public
List
<
Map
<
String
,
?>>
getProjectPage
(
DmpProject
params
);
public
List
<
Map
<
String
,
?>>
getHeaderProjectList
(
DmpProject
params
);
public
void
disable
(
Long
id
);
public
void
enable
(
Long
id
);
public
List
<
Map
<
String
,
?>>
getProjectOrgPermission
();
public
List
<
Map
<
String
,
?>>
getProjectInfo
(
Long
id
);
public
void
insertProjectSystemInfo
(
DmpProjectSystemInfo
systemInfo
);
public
void
updateProjectSystemInfo
(
DmpProjectSystemInfo
systemInfo
);
public
List
<
DmpProjectSystemInfo
>
getProjectSystemInfo
(
Long
projectId
);
DmpProjectSystemInfo
queryProjectSystemInfo
(
@Param
(
"projectId"
)
Integer
projectId
);
}
src/main/java/com/jz/dmp/modules/dao/OfflineSynchDao.java
View file @
b7cfadf6
...
...
@@ -3,6 +3,8 @@ package com.jz.dmp.modules.dao;
import
com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq
;
import
com.jz.dmp.modules.model.DmpSyncingDatasource
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -16,4 +18,6 @@ public interface OfflineSynchDao {
List
<
TaskListPageDto
>
queryTaskListPage
(
TaskListPageReq
taskListPageReq
)
throws
Exception
;
List
<
SourceDbNameListDto
>
querygSourceDbList
(
Map
map
)
throws
Exception
;
DmpSyncingDatasource
queryDmpSyncingDatasource
(
@Param
(
"sourceDbId"
)
Integer
sourceDbId
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/model/DmpAgentDatasourceInfo.java
0 → 100644
View file @
b7cfadf6
This diff is collapsed.
Click to expand it.
src/main/java/com/jz/dmp/modules/model/DmpSyncingDatasource.java
0 → 100644
View file @
b7cfadf6
package
com
.
jz
.
dmp
.
modules
.
model
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 数据源配置(DmpSyncingDatasource)实体类
*
* @author Bellamy
* @since 2020-12-21 17:47:18
*/
public
class
DmpSyncingDatasource
implements
Serializable
{
private
static
final
long
serialVersionUID
=
588846270711686919L
;
/**
* ID
*/
private
Integer
id
;
/**
* 数据源类型ID
*/
private
Integer
datasourceType
;
/**
* 数据源名称
*/
private
String
datasourceName
;
/**
* 数据源描述
*/
private
String
datasourceDesc
;
/**
* JDBC URL
*/
private
String
jdbcUrl
;
/**
* 数据库名
*/
private
String
dbName
;
/**
* 账号
*/
private
String
userName
;
/**
* 密码
*/
private
String
password
;
/**
* 终端信息
*/
private
String
endpoint
;
/**
* Bucket信息
*/
private
String
bucket
;
/**
* accessId
*/
private
String
accessId
;
/**
* accessKey
*/
private
String
accessKey
;
/**
* FTP协议
*/
private
String
protocol
;
/**
* IP
*/
private
String
host
;
/**
* 端口
*/
private
String
port
;
/**
* NameNode地址
*/
private
String
defaultFs
;
/**
* 表空间
*/
private
String
tableSchema
;
/**
* 数据状态
*/
private
String
dataStatus
;
/**
* 创建用户ID
*/
private
String
createUserId
;
/**
* 数据创建时间
*/
private
Date
createTime
;
/**
* 创建用户ID
*/
private
String
updateUserId
;
/**
* 数据更新时间
*/
private
Date
updateTime
;
/**
* 项目ID
*/
private
Integer
projectId
;
private
String
delimiter
;
private
String
isHaveHeader
;
private
String
targetDbName
;
private
String
targetFileName
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getDatasourceType
()
{
return
datasourceType
;
}
public
void
setDatasourceType
(
Integer
datasourceType
)
{
this
.
datasourceType
=
datasourceType
;
}
public
String
getDatasourceName
()
{
return
datasourceName
;
}
public
void
setDatasourceName
(
String
datasourceName
)
{
this
.
datasourceName
=
datasourceName
;
}
public
String
getDatasourceDesc
()
{
return
datasourceDesc
;
}
public
void
setDatasourceDesc
(
String
datasourceDesc
)
{
this
.
datasourceDesc
=
datasourceDesc
;
}
public
String
getJdbcUrl
()
{
return
jdbcUrl
;
}
public
void
setJdbcUrl
(
String
jdbcUrl
)
{
this
.
jdbcUrl
=
jdbcUrl
;
}
public
String
getDbName
()
{
return
dbName
;
}
public
void
setDbName
(
String
dbName
)
{
this
.
dbName
=
dbName
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getEndpoint
()
{
return
endpoint
;
}
public
void
setEndpoint
(
String
endpoint
)
{
this
.
endpoint
=
endpoint
;
}
public
String
getBucket
()
{
return
bucket
;
}
public
void
setBucket
(
String
bucket
)
{
this
.
bucket
=
bucket
;
}
public
String
getAccessId
()
{
return
accessId
;
}
public
void
setAccessId
(
String
accessId
)
{
this
.
accessId
=
accessId
;
}
public
String
getAccessKey
()
{
return
accessKey
;
}
public
void
setAccessKey
(
String
accessKey
)
{
this
.
accessKey
=
accessKey
;
}
public
String
getProtocol
()
{
return
protocol
;
}
public
void
setProtocol
(
String
protocol
)
{
this
.
protocol
=
protocol
;
}
public
String
getHost
()
{
return
host
;
}
public
void
setHost
(
String
host
)
{
this
.
host
=
host
;
}
public
String
getPort
()
{
return
port
;
}
public
void
setPort
(
String
port
)
{
this
.
port
=
port
;
}
public
String
getDefaultFs
()
{
return
defaultFs
;
}
public
void
setDefaultFs
(
String
defaultFs
)
{
this
.
defaultFs
=
defaultFs
;
}
public
String
getTableSchema
()
{
return
tableSchema
;
}
public
void
setTableSchema
(
String
tableSchema
)
{
this
.
tableSchema
=
tableSchema
;
}
public
String
getDataStatus
()
{
return
dataStatus
;
}
public
void
setDataStatus
(
String
dataStatus
)
{
this
.
dataStatus
=
dataStatus
;
}
public
String
getCreateUserId
()
{
return
createUserId
;
}
public
void
setCreateUserId
(
String
createUserId
)
{
this
.
createUserId
=
createUserId
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
String
getUpdateUserId
()
{
return
updateUserId
;
}
public
void
setUpdateUserId
(
String
updateUserId
)
{
this
.
updateUserId
=
updateUserId
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
Integer
getProjectId
()
{
return
projectId
;
}
public
void
setProjectId
(
Integer
projectId
)
{
this
.
projectId
=
projectId
;
}
public
String
getDelimiter
()
{
return
delimiter
;
}
public
void
setDelimiter
(
String
delimiter
)
{
this
.
delimiter
=
delimiter
;
}
public
String
getIsHaveHeader
()
{
return
isHaveHeader
;
}
public
void
setIsHaveHeader
(
String
isHaveHeader
)
{
this
.
isHaveHeader
=
isHaveHeader
;
}
public
String
getTargetDbName
()
{
return
targetDbName
;
}
public
void
setTargetDbName
(
String
targetDbName
)
{
this
.
targetDbName
=
targetDbName
;
}
public
String
getTargetFileName
()
{
return
targetFileName
;
}
public
void
setTargetFileName
(
String
targetFileName
)
{
this
.
targetFileName
=
targetFileName
;
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/model/DmpSyncingDatasourceType.java
0 → 100644
View file @
b7cfadf6
package
com
.
jz
.
dmp
.
modules
.
model
;
import
java.io.Serializable
;
/**
* 数据源类型(DmpSyncingDatasourceType)实体类
*
* @author Bellamy
* @since 2020-12-21 18:39:06
*/
public
class
DmpSyncingDatasourceType
implements
Serializable
{
private
static
final
long
serialVersionUID
=
526021146272437267L
;
/**
* ID
*/
private
Integer
id
;
/**
* 数据源名称
*/
private
String
datasource
;
/**
* 数据源分类
*/
private
String
datasourceCatecode
;
/**
* 数据源分类
*/
private
String
datasourceCatename
;
/**
* 数据源类型
*/
private
String
datasourceType
;
/**
* 数据源图标
*/
private
String
imgUrl
;
private
String
dataStatus
;
private
String
isEnabled
;
private
String
datasourceCatetype
;
private
String
driverClassName
;
private
String
isEnableTest
;
private
Object
defaultSourceScript
;
private
Object
defaultTargetScript
;
private
String
isEnableSource
;
private
String
isEnableTarget
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getDatasource
()
{
return
datasource
;
}
public
void
setDatasource
(
String
datasource
)
{
this
.
datasource
=
datasource
;
}
public
String
getDatasourceCatecode
()
{
return
datasourceCatecode
;
}
public
void
setDatasourceCatecode
(
String
datasourceCatecode
)
{
this
.
datasourceCatecode
=
datasourceCatecode
;
}
public
String
getDatasourceCatename
()
{
return
datasourceCatename
;
}
public
void
setDatasourceCatename
(
String
datasourceCatename
)
{
this
.
datasourceCatename
=
datasourceCatename
;
}
public
String
getDatasourceType
()
{
return
datasourceType
;
}
public
void
setDatasourceType
(
String
datasourceType
)
{
this
.
datasourceType
=
datasourceType
;
}
public
String
getImgUrl
()
{
return
imgUrl
;
}
public
void
setImgUrl
(
String
imgUrl
)
{
this
.
imgUrl
=
imgUrl
;
}
public
String
getDataStatus
()
{
return
dataStatus
;
}
public
void
setDataStatus
(
String
dataStatus
)
{
this
.
dataStatus
=
dataStatus
;
}
public
String
getIsEnabled
()
{
return
isEnabled
;
}
public
void
setIsEnabled
(
String
isEnabled
)
{
this
.
isEnabled
=
isEnabled
;
}
public
String
getDatasourceCatetype
()
{
return
datasourceCatetype
;
}
public
void
setDatasourceCatetype
(
String
datasourceCatetype
)
{
this
.
datasourceCatetype
=
datasourceCatetype
;
}
public
String
getDriverClassName
()
{
return
driverClassName
;
}
public
void
setDriverClassName
(
String
driverClassName
)
{
this
.
driverClassName
=
driverClassName
;
}
public
String
getIsEnableTest
()
{
return
isEnableTest
;
}
public
void
setIsEnableTest
(
String
isEnableTest
)
{
this
.
isEnableTest
=
isEnableTest
;
}
public
Object
getDefaultSourceScript
()
{
return
defaultSourceScript
;
}
public
void
setDefaultSourceScript
(
Object
defaultSourceScript
)
{
this
.
defaultSourceScript
=
defaultSourceScript
;
}
public
Object
getDefaultTargetScript
()
{
return
defaultTargetScript
;
}
public
void
setDefaultTargetScript
(
Object
defaultTargetScript
)
{
this
.
defaultTargetScript
=
defaultTargetScript
;
}
public
String
getIsEnableSource
()
{
return
isEnableSource
;
}
public
void
setIsEnableSource
(
String
isEnableSource
)
{
this
.
isEnableSource
=
isEnableSource
;
}
public
String
getIsEnableTarget
()
{
return
isEnableTarget
;
}
public
void
setIsEnableTarget
(
String
isEnableTarget
)
{
this
.
isEnableTarget
=
isEnableTarget
;
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/OfflineSynchService.java
View file @
b7cfadf6
...
...
@@ -5,6 +5,9 @@ import com.jz.common.page.PageInfoResponse;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq
;
import
java.util.List
;
import
java.util.Map
;
/**
* @ClassName: OfflineSynchService
* @Description:
...
...
@@ -17,4 +20,6 @@ public interface OfflineSynchService {
PageInfoResponse
<
TaskListPageDto
>
queryTaskListPage
(
TaskListPageReq
taskListPageReq
)
throws
Exception
;
JsonResult
querygSourceDbList
(
Integer
projectId
)
throws
Exception
;
List
<
Map
>
querygSourceTableList
(
Integer
sourceDbId
,
String
targetName
)
throws
Exception
;
}
src/main/java/com/jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
View file @
b7cfadf6
package
com
.
jz
.
dmp
.
modules
.
service
.
impl
;
import
com.fasterxml.jackson.databind.json.JsonMapper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.jz.common.constant.Constants
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.common.persistence.BaseService
;
import
com.jz.dmp.agent.DmpAgentResult
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq
;
import
com.jz.dmp.modules.dao.DmpProjectDao
;
import
com.jz.dmp.modules.dao.OfflineSynchDao
;
import
com.jz.dmp.modules.model.DmpAgentDatasourceInfo
;
import
com.jz.dmp.modules.model.DmpProjectSystemInfo
;
import
com.jz.dmp.modules.model.DmpSyncingDatasource
;
import
com.jz.dmp.modules.model.DmpSyncingDatasourceType
;
import
com.jz.dmp.modules.service.OfflineSynchService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -33,6 +41,9 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
@Autowired
private
OfflineSynchDao
offlineSynchDao
;
@Autowired
private
DmpProjectDao
dmpProjectDao
;
@Override
public
PageInfoResponse
<
TaskListPageDto
>
queryTaskListPage
(
TaskListPageReq
taskListPageReq
)
throws
Exception
{
PageInfoResponse
<
TaskListPageDto
>
pageInfoResponse
=
new
PageInfoResponse
<>();
...
...
@@ -59,4 +70,60 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
List
<
SourceDbNameListDto
>
list
=
offlineSynchDao
.
querygSourceDbList
(
map
);
return
new
JsonResult
(
ResultCode
.
SUCCESS
,
list
);
}
@Override
public
List
<
Map
>
querygSourceTableList
(
Integer
sourceDbId
,
String
targetName
)
throws
Exception
{
//通过源数据库id ,查询数据源配置
DmpSyncingDatasource
dmpSyncingDatasource
=
offlineSynchDao
.
queryDmpSyncingDatasource
(
sourceDbId
);
if
(
StringUtils
.
isNotBlank
(
dmpSyncingDatasource
.
getPassword
()))
{
dmpSyncingDatasource
.
setPassword
(
new
BaseService
().
decode
(
dmpSyncingDatasource
.
getPassword
()));
}
DmpAgentDatasourceInfo
dsInfo
=
this
.
dsInfoDTO
(
dmpSyncingDatasource
);
if
(
StringUtils
.
isNotBlank
(
targetName
))
dsInfo
.
setTargetFileName
(
targetName
);
/*DmpAgentResult rst = dmpDsAgentServiceImp.getTableNameList(dsInfo);
if (!rst.getCode().val().equals("200")) {
return new JsonResult(rst.getCode(), rst.getMessage());
} else {
rst.setResult(JsonMapper.fromJsonString(rst.getMessage(), List.class));
return new JsonResult(ResultCode.SUCCESS, rst);
}*/
return
null
;
}
private
DmpAgentDatasourceInfo
dsInfoDTO
(
DmpSyncingDatasource
body
)
{
/*DmpSyncingDatasourceType type = dmpSyncingDatasourceTypeService.get(body.getDatasourceType());
DmpAgentDatasourceInfo ds = new DmpAgentDatasourceInfo();
ds.setDatasourceType(type.getDatasourceType());
ds.setDatasourceName(body.getDatasourceName());
ds.setDbName(body.getDbName());
ds.setJdbcUrl(body.getJdbcUrl());
ds.setUserName(body.getUserName());
ds.setPassword(body.getPassword());
ds.setDriverClassName(type.getDriverClassName());
ds.setHost(body.getHost());
ds.setPort(body.getPort());
ds.setDelimiter(body.getDelimiter());
ds.setProtocol(body.getProtocol());
ds.setProjectId(body.getProjectId() + "");
ds.setAccessId(body.getAccessId());
ds.setAccessKey(body.getAccessKey());
ds.setIsHaveHeader(body.getIsHaveHeader());
ds.setEndpoint(body.getEndpoint());
ds.setDefaultFs(body.getDefaultFs());
DmpProjectSystemInfo info = dmpProjectDao.queryProjectSystemInfo(body.getProjectId());
ds.setKerberosIsenable(info.getKerberosIsenable());
ds.setKerberosJaasConf(info.getKerberosJaasConf());
ds.setKerberosKrb5Conf(info.getKerberosKrb5Conf());
ds.setKerberosFqdn(info.getKerberosFqdn());
ds.setHdfsDefaultConf(""); // info.getHdfsDefaultConf());
ds.setHdfsConfPath(""); // info.getHdfsConfPath());
ds.setHdfsAuthPath(body.getAccessKey());
ds.setHdfsUserName(info.getHdfsUserName());
ds.setHdfsSyncingPath(info.getHdfsSyncingPath());
return ds;*/
return
null
;
}
}
src/main/resources/mapper/dmp/DmpProjectMapper.xml
0 → 100644
View file @
b7cfadf6
This diff is collapsed.
Click to expand it.
src/main/resources/mapper/dmp/OfflineSynchMapper.xml
View file @
b7cfadf6
...
...
@@ -61,4 +61,35 @@
and ds.DATASOURCE_TYPE = #{datasourceType}
</if>
</select>
<!--主键查询数据源-->
<select
id=
"queryDmpSyncingDatasource"
parameterType=
"map"
resultType=
"dmpSyncingDatasource"
>
SELECT
id,
datasource_type,
datasource_name,
datasource_desc,
jdbc_url,
db_name,
user_name,
PASSWORD,
endpoint,
bucket,
access_id,
access_key,
protocol,
HOST,
PORT,
default_fs,
table_schema,
data_status,
create_user_id,
create_time,
update_user_id,
update_time,
project_id
FROM
dmp_syncing_datasource
WHERE id = #{sourceDbId}
</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