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
7f78a584
Commit
7f78a584
authored
Jan 16, 2021
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
a7e7a9de
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
280 additions
and
39 deletions
+280
-39
JsonResult.java
src/main/java/com/jz/common/constant/JsonResult.java
+36
-0
DelFlagEnum.java
src/main/java/com/jz/common/enums/DelFlagEnum.java
+58
-0
DataSourceController.java
...ules/controller/DataIntegration/DataSourceController.java
+13
-3
OfflineSynchController.java
...es/controller/DataIntegration/OfflineSynchController.java
+1
-1
RealTimeSyncController.java
...es/controller/DataIntegration/RealTimeSyncController.java
+1
-1
DmpDevelopTaskDao.java
src/main/java/com/jz/dmp/modules/dao/DmpDevelopTaskDao.java
+6
-1
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
DmpRealtimeSyncInfoService.java
...om/jz/dmp/modules/service/DmpRealtimeSyncInfoService.java
+8
-0
OfflineSynchService.java
.../java/com/jz/dmp/modules/service/OfflineSynchService.java
+48
-0
DmpRealtimeSyncInfoServiceImpl.java
.../modules/service/impl/DmpRealtimeSyncInfoServiceImpl.java
+17
-0
DmpSyncingDatasourceServiceImpl.java
...modules/service/impl/DmpSyncingDatasourceServiceImpl.java
+8
-3
OfflineSynchServiceImpl.java
.../jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
+29
-11
DmpDevelopTaskMapper.xml
src/main/resources/mapper/dmp/DmpDevelopTaskMapper.xml
+16
-7
DmpRealtimeSyncInfoMapper.xml
src/main/resources/mapper/dmp/DmpRealtimeSyncInfoMapper.xml
+21
-7
DmpSyncingDatasourceMapper.xml
src/main/resources/mapper/dmp/DmpSyncingDatasourceMapper.xml
+8
-3
OfflineSynchMapper.xml
src/main/resources/mapper/dmp/OfflineSynchMapper.xml
+1
-1
No files found.
src/main/java/com/jz/common/constant/JsonResult.java
View file @
7f78a584
...
@@ -67,6 +67,42 @@ public class JsonResult<T> implements Serializable {
...
@@ -67,6 +67,42 @@ public class JsonResult<T> implements Serializable {
this
.
setMessage
(
message
);
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
(
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
)
{
public
void
setCodes
(
com
.
jz
.
dmp
.
agent
.
ResultCode
code
)
{
this
.
code
=
code
.
val
();
this
.
code
=
code
.
val
();
}
}
...
...
src/main/java/com/jz/common/enums/DelFlagEnum.java
0 → 100644
View file @
7f78a584
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/dmp/modules/controller/DataIntegration/DataSourceController.java
View file @
7f78a584
...
@@ -12,6 +12,8 @@ import io.swagger.annotations.ApiImplicitParam;
...
@@ -12,6 +12,8 @@ import io.swagger.annotations.ApiImplicitParam;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
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.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -31,6 +33,8 @@ import java.util.Map;
...
@@ -31,6 +33,8 @@ import java.util.Map;
@Api
(
tags
=
"数据集成--数据源"
)
@Api
(
tags
=
"数据集成--数据源"
)
public
class
DataSourceController
{
public
class
DataSourceController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DataSourceController
.
class
);
@Autowired
@Autowired
private
DmpSyncingDatasourceService
dmpSyncingDatasourceService
;
private
DmpSyncingDatasourceService
dmpSyncingDatasourceService
;
...
@@ -125,9 +129,15 @@ public class DataSourceController {
...
@@ -125,9 +129,15 @@ public class DataSourceController {
@PostMapping
(
value
=
"/testConnection"
)
@PostMapping
(
value
=
"/testConnection"
)
public
JsonResult
testConnection
(
@RequestBody
@Validated
DmpSyncingDatasourceReq
saveBody
,
HttpServletRequest
httpRequest
)
throws
Exception
{
public
JsonResult
testConnection
(
@RequestBody
@Validated
DmpSyncingDatasourceReq
saveBody
,
HttpServletRequest
httpRequest
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
saveBody
.
getDatasourceType
()))
{
if
(
StringUtils
.
isEmpty
(
saveBody
.
getDatasourceType
()))
{
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
,
"数据源类型ID不能为空"
);
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
());
}
}
JsonResult
result
=
dmpSyncingDatasourceService
.
testConnection
(
saveBody
);
return
result
;
return
result
;
}
}
...
@@ -139,7 +149,7 @@ public class DataSourceController {
...
@@ -139,7 +149,7 @@ public class DataSourceController {
*/
*/
@ApiOperation
(
value
=
"编辑数据源--根据id查询数据回显"
,
notes
=
"编辑数据源--根据id查询数据回显"
)
@ApiOperation
(
value
=
"编辑数据源--根据id查询数据回显"
,
notes
=
"编辑数据源--根据id查询数据回显"
)
@GetMapping
(
value
=
"/selectDataSourceInfoById"
)
@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
{
public
JsonResult
getDataSourceInfoById
(
@RequestParam
String
datasourceId
,
@RequestParam
(
value
=
"projectId"
,
required
=
false
)
String
projectId
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
datasourceId
))
{
if
(
StringUtils
.
isEmpty
(
datasourceId
))
{
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
);
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
);
...
...
src/main/java/com/jz/dmp/modules/controller/DataIntegration/OfflineSynchController.java
View file @
7f78a584
...
@@ -99,7 +99,7 @@ public class OfflineSynchController {
...
@@ -99,7 +99,7 @@ public class OfflineSynchController {
}
}
/**
/**
* 根据taskId删除任务
* 根据taskId删除
离线
任务
*
*
* @return
* @return
* @author Bellamy
* @author Bellamy
...
...
src/main/java/com/jz/dmp/modules/controller/DataIntegration/RealTimeSyncController.java
View file @
7f78a584
...
@@ -113,7 +113,7 @@ public class RealTimeSyncController {
...
@@ -113,7 +113,7 @@ public class RealTimeSyncController {
if
(
StringUtils
.
isEmpty
(
realTaskId
))
{
if
(
StringUtils
.
isEmpty
(
realTaskId
))
{
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
,
"任务id不能为空!"
);
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
,
"任务id不能为空!"
);
}
}
boolean
jsonResult
=
dmpRealtimeSyncInfoService
.
deleteBy
Id
(
Integer
.
valueOf
(
realTaskId
)
);
boolean
jsonResult
=
dmpRealtimeSyncInfoService
.
deleteBy
realTaskId
(
realTaskId
);
if
(
jsonResult
)
{
if
(
jsonResult
)
{
return
new
JsonResult
();
return
new
JsonResult
();
}
else
{
}
else
{
...
...
src/main/java/com/jz/dmp/modules/dao/DmpDevelopTaskDao.java
View file @
7f78a584
...
@@ -16,7 +16,12 @@ public interface DmpDevelopTaskDao {
...
@@ -16,7 +16,12 @@ public interface DmpDevelopTaskDao {
Map
getDmpTaskAndTreeInfo
(
String
taskId
)
throws
Exception
;
Map
getDmpTaskAndTreeInfo
(
String
taskId
)
throws
Exception
;
int
deleteTaskByTaskId
(
String
taskId
)
throws
Exception
;
/**
* 批量删除离线任务
*
* @author Bellamy
*/
int
deleteTaskByTaskId
(
Map
params
)
throws
Exception
;
int
deleteNavigationTreeByTreeId
(
String
treeId
)
throws
Exception
;
int
deleteNavigationTreeByTreeId
(
String
treeId
)
throws
Exception
;
...
...
src/main/java/com/jz/dmp/modules/dao/DmpRealtimeSyncInfoDao.java
View file @
7f78a584
...
@@ -177,4 +177,12 @@ public interface DmpRealtimeSyncInfoDao {
...
@@ -177,4 +177,12 @@ public interface DmpRealtimeSyncInfoDao {
* @since 2021-01-12
* @since 2021-01-12
*/
*/
List
<
Map
>
selectRealtimeTaskById
(
@Param
(
"taskId"
)
String
taskId
)
throws
Exception
;
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 @
7f78a584
...
@@ -97,7 +97,7 @@ public interface DmpSyncingDatasourceDao {
...
@@ -97,7 +97,7 @@ public interface DmpSyncingDatasourceDao {
* @return
* @return
* @author Bellamy
* @author Bellamy
*/
*/
void
delDataSourceById
(
@Param
(
"ids"
)
String
[]
ids
)
throws
Exception
;
void
delDataSourceById
(
Map
map
)
throws
Exception
;
/**
/**
* 获取数据源类型-下拉框
* 获取数据源类型-下拉框
...
...
src/main/java/com/jz/dmp/modules/service/DmpRealtimeSyncInfoService.java
View file @
7f78a584
...
@@ -127,4 +127,12 @@ public interface DmpRealtimeSyncInfoService {
...
@@ -127,4 +127,12 @@ public interface DmpRealtimeSyncInfoService {
* @since 2021-01-12
* @since 2021-01-12
*/
*/
JsonResult
<
RealTimeEditDataEchoDto
>
selectRealtimeTaskById
(
String
taskId
)
throws
Exception
;
JsonResult
<
RealTimeEditDataEchoDto
>
selectRealtimeTaskById
(
String
taskId
)
throws
Exception
;
/**
* 批量删除数据源
*
* @return
* @author Bellamy
*/
boolean
deleteByrealTaskId
(
String
realTaskId
)
throws
Exception
;
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/OfflineSynchService.java
View file @
7f78a584
...
@@ -25,23 +25,71 @@ public interface OfflineSynchService {
...
@@ -25,23 +25,71 @@ public interface OfflineSynchService {
*/
*/
PageInfoResponse
<
TaskListPageDto
>
queryTaskListPage
(
TaskListPageReq
taskListPageReq
)
throws
Exception
;
PageInfoResponse
<
TaskListPageDto
>
queryTaskListPage
(
TaskListPageReq
taskListPageReq
)
throws
Exception
;
/**
* 获取源数据库名称——下拉框
*
* @return
* @author Bellamy
*/
JsonResult
querygSourceDbList
(
Integer
projectId
)
throws
Exception
;
JsonResult
querygSourceDbList
(
Integer
projectId
)
throws
Exception
;
/**
* 根据源数据库id,获取源数据表——下拉框
*
* @return
* @author Bellamy
*/
JsonResult
querygSourceTableList
(
Long
sourceDbId
,
String
targetName
)
throws
Exception
;
JsonResult
querygSourceTableList
(
Long
sourceDbId
,
String
targetName
)
throws
Exception
;
/**
* 任务立即运行
*
* @return
* @author Bellamy
*/
JsonResult
taskRunNowByTaskId
(
String
taskId
)
throws
Exception
;
JsonResult
taskRunNowByTaskId
(
String
taskId
)
throws
Exception
;
/**
* 根据taskId删除离线任务
*
* @return
* @author Bellamy
*/
JsonResult
delTaskByTaskId
(
String
taskId
)
throws
Exception
;
JsonResult
delTaskByTaskId
(
String
taskId
)
throws
Exception
;
JsonResult
<
List
<
CheckTaskStatusPageDto
>>
queryCheckTaskStatusListPage
(
CheckTaskStatusPageReq
checkTaskStatusPageReq
)
throws
Exception
;
JsonResult
<
List
<
CheckTaskStatusPageDto
>>
queryCheckTaskStatusListPage
(
CheckTaskStatusPageReq
checkTaskStatusPageReq
)
throws
Exception
;
PageInfoResponse
<
CheckJyRlueStatusDto
>
selectCheckJyStatusInfo
(
CheckJyRlueStatusReq
checkJyRlueStatusReq
)
throws
Exception
;
PageInfoResponse
<
CheckJyRlueStatusDto
>
selectCheckJyStatusInfo
(
CheckJyRlueStatusReq
checkJyRlueStatusReq
)
throws
Exception
;
/**
* 获取源表和目标表的字段
*
* @return
* @author Bellamy
*/
JsonResult
querySoureAndTargetColumnsByParams
(
SoureAndTargetColumnsReq
soureAndTargetColumnsReq
)
throws
Exception
;
JsonResult
querySoureAndTargetColumnsByParams
(
SoureAndTargetColumnsReq
soureAndTargetColumnsReq
)
throws
Exception
;
/**
* 校验规则
*
* @return
* @author Bellamy
*/
PageInfoResponse
<
DvRuleTDto
>
queryJyRuleListPage
(
BasePageBean
basePageBean
,
HttpServletRequest
httpRequest
)
throws
Exception
;
PageInfoResponse
<
DvRuleTDto
>
queryJyRuleListPage
(
BasePageBean
basePageBean
,
HttpServletRequest
httpRequest
)
throws
Exception
;
/**
* 保存离线任务数据
*
* @return
* @author Bellamy
*/
JsonResult
addSyncTask
(
SyncDmpTaskAddReq
syncDmpTaskAddReq
)
throws
Exception
;
JsonResult
addSyncTask
(
SyncDmpTaskAddReq
syncDmpTaskAddReq
)
throws
Exception
;
/**
* 编辑离线任务数据
*
* @return
* @author Bellamy
*/
JsonResult
updateSyncTask
(
SyncDmpTaskAddReq
syncDmpTaskAddReq
)
throws
Exception
;
JsonResult
updateSyncTask
(
SyncDmpTaskAddReq
syncDmpTaskAddReq
)
throws
Exception
;
}
}
src/main/java/com/jz/dmp/modules/service/impl/DmpRealtimeSyncInfoServiceImpl.java
View file @
7f78a584
...
@@ -6,6 +6,7 @@ import com.github.pagehelper.PageHelper;
...
@@ -6,6 +6,7 @@ import com.github.pagehelper.PageHelper;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.enums.DelFlagEnum
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.common.persistence.BaseService
;
import
com.jz.common.persistence.BaseService
;
import
com.jz.common.utils.realTime.DBUtil
;
import
com.jz.common.utils.realTime.DBUtil
;
...
@@ -821,4 +822,20 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
...
@@ -821,4 +822,20 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
}
}
return
new
JsonResult
(
returnModel
);
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
;
}
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/impl/DmpSyncingDatasourceServiceImpl.java
View file @
7f78a584
package
com
.
jz
.
dmp
.
modules
.
service
.
impl
;
package
com
.
jz
.
dmp
.
modules
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.amazonaws.services.dynamodbv2.xspec.M
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.jz.agent.service.DmpDsAgentService
;
import
com.jz.agent.service.DmpDsAgentService
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.enums.DelFlagEnum
;
import
com.jz.common.enums.TestConnectStatusEnum
;
import
com.jz.common.enums.TestConnectStatusEnum
;
import
com.jz.common.exception.ServiceException
;
import
com.jz.common.exception.ServiceException
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.common.page.PageInfoResponse
;
...
@@ -152,8 +154,11 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
...
@@ -152,8 +154,11 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
JsonResult
delDataSourceById
(
String
datasourceId
)
throws
Exception
{
public
JsonResult
delDataSourceById
(
String
datasourceId
)
throws
Exception
{
Map
map
=
new
HashMap
();
String
[]
ids
=
datasourceId
.
split
(
","
);
String
[]
ids
=
datasourceId
.
split
(
","
);
dmpSyncingDatasourceDao
.
delDataSourceById
(
ids
);
map
.
put
(
"ids"
,
ids
);
map
.
put
(
"dataStatus"
,
DelFlagEnum
.
YES
.
getValue
());
dmpSyncingDatasourceDao
.
delDataSourceById
(
map
);
return
new
JsonResult
();
return
new
JsonResult
();
}
}
...
@@ -304,7 +309,7 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
...
@@ -304,7 +309,7 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
DmpAgentDatasourceInfo
ds
=
this
.
dsInfoDTO
(
saveBody
);
//查询数据源 对应的 数据库信息
DmpAgentDatasourceInfo
ds
=
this
.
dsInfoDTO
(
saveBody
);
//查询数据源 对应的 数据库信息
DmpAgentResult
rst
=
dmpDsAgentServiceImp
.
testConnect
(
ds
);
//连接测试
DmpAgentResult
rst
=
dmpDsAgentServiceImp
.
testConnect
(
ds
);
//连接测试
if
(!
rst
.
getCode
().
val
().
equals
(
"200"
))
{
if
(!
rst
.
getCode
().
val
().
equals
(
"200"
))
{
return
new
JsonResult
(
ResultCode
.
INTERNAL_SERVER_ERROR
,
"连接测试失败!"
);
return
new
JsonResult
(
ResultCode
.
INTERNAL_SERVER_ERROR
,
"连接测试失败!"
);
}
else
{
}
else
{
//连接测试成功
//连接测试成功
Object
flag
=
JsonMapper
.
fromJsonString
(
rst
.
getMessage
(),
Boolean
.
class
);
Object
flag
=
JsonMapper
.
fromJsonString
(
rst
.
getMessage
(),
Boolean
.
class
);
...
@@ -425,7 +430,7 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
...
@@ -425,7 +430,7 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
ds
.
setDefaultFs
(
body
.
getDefaultFs
());
ds
.
setDefaultFs
(
body
.
getDefaultFs
());
DmpProjectSystemInfo
info
=
dmpProjectDao
.
queryProjectSystemInfo
(
Long
.
valueOf
(
body
.
getProjectId
()));
DmpProjectSystemInfo
info
=
dmpProjectDao
.
queryProjectSystemInfo
(
Long
.
valueOf
(
body
.
getProjectId
()));
if
(
info
==
null
)
{
if
(
info
==
null
)
{
//throw new RuntimeException("未查询到对应的项目系统配置信息");
//throw new RuntimeException("未查询到对应的项目系统配置信息");
throw
new
ServiceException
(
"未查询到对应的项目系统配置信息"
);
throw
new
ServiceException
(
"未查询到对应的项目系统配置信息"
);
}
}
...
...
src/main/java/com/jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
View file @
7f78a584
...
@@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo;
...
@@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo;
import
com.jz.agent.service.DmpDsAgentService
;
import
com.jz.agent.service.DmpDsAgentService
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.enums.DelFlagEnum
;
import
com.jz.common.page.BasePageBean
;
import
com.jz.common.page.BasePageBean
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.common.persistence.BaseService
;
import
com.jz.common.persistence.BaseService
;
...
@@ -28,6 +29,7 @@ import org.slf4j.Logger;
...
@@ -28,6 +29,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.security.access.method.P
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -146,6 +148,8 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
...
@@ -146,6 +148,8 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
/**
/**
* 立即运行
* 立即运行
*
* @author Bellamy
*/
*/
@Override
@Override
public
JsonResult
taskRunNowByTaskId
(
String
taskId
)
throws
Exception
{
public
JsonResult
taskRunNowByTaskId
(
String
taskId
)
throws
Exception
{
...
@@ -229,20 +233,28 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
...
@@ -229,20 +233,28 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
}
}
/**
/**
* 删除任务
* 批量删除离线任务
*
* @author Bellamy
*/
*/
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
JsonResult
delTaskByTaskId
(
String
taskId
)
throws
Exception
{
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,查询任务和资源是否存在
//通过taskId,查询任务和资源是否存在
Map
map
=
dmpDevelopTaskDao
.
getDmpTaskAndTreeInfo
(
taskId
);
/*
Map map = dmpDevelopTaskDao.getDmpTaskAndTreeInfo(taskId);
if
(
map
.
size
()
==
0
||
map
==
null
)
{
if (map == null) {
return new JsonResult(ResultCode.OPERATION_DATA_NO_EXIST);
return new JsonResult(ResultCode.OPERATION_DATA_NO_EXIST);
}
}
if (StringUtils.isEmpty(map.get("treeId").toString())) {
if (StringUtils.isEmpty(map.get("treeId").toString())) {
return new JsonResult(ResultCode.OPERATION_DATA_NO_EXIST);
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
);
return
new
JsonResult
(
ResultCode
.
SUCCESS
);
}
}
...
@@ -298,6 +310,12 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
...
@@ -298,6 +310,12 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
return
pageInfoResponse
;
return
pageInfoResponse
;
}
}
/**
* 获取源表和目标表的字段
*
* @return
* @author Bellamy
*/
@Override
@Override
public
JsonResult
querySoureAndTargetColumnsByParams
(
SoureAndTargetColumnsReq
soureAndTargetColumnsReq
)
throws
Exception
{
public
JsonResult
querySoureAndTargetColumnsByParams
(
SoureAndTargetColumnsReq
soureAndTargetColumnsReq
)
throws
Exception
{
//通过源数据库id ,查询数据源配置
//通过源数据库id ,查询数据源配置
...
@@ -532,15 +550,15 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
...
@@ -532,15 +550,15 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
dmpNavigationTreeDao
.
update
(
dmpNavigationTree
);
//更新节点 树
dmpNavigationTreeDao
.
update
(
dmpNavigationTree
);
//更新节点 树
logger
.
info
(
"################################## 更新节点 树 结束 ############################################"
);
logger
.
info
(
"################################## 更新节点 树 结束 ############################################"
);
//更新规则信息
//更新规则信息
List
<
DvTaskRuleT
>
list
=
new
ArrayList
<>();
List
<
DvTaskRuleT
>
list
=
new
ArrayList
<>();
//查询TaskRuleID 集合
//查询TaskRuleID 集合
List
<
Long
>
listRules
=
dvTaskRuleTService
.
getTaskRuleIdsList
(
taskId
);
List
<
Long
>
listRules
=
dvTaskRuleTService
.
getTaskRuleIdsList
(
taskId
);
if
(
CollectionUtils
.
isNotEmpty
(
listRules
)){
if
(
CollectionUtils
.
isNotEmpty
(
listRules
))
{
//批量删除rule信息
//批量删除rule信息
dvTaskRuleTService
.
delRulesByIds
(
listRules
);
dvTaskRuleTService
.
delRulesByIds
(
listRules
);
List
<
Map
>
taskRules
=
(
List
<
Map
>)
reqParam
.
get
(
"taskRules"
);
List
<
Map
>
taskRules
=
(
List
<
Map
>)
reqParam
.
get
(
"taskRules"
);
//保存dmp数据校验规则信息
//保存dmp数据校验规则信息
settRuleInfo
(
String
.
valueOf
(
taskId
),
taskRules
,
list
);
settRuleInfo
(
String
.
valueOf
(
taskId
),
taskRules
,
list
);
}
}
//保存时提交XML
//保存时提交XML
dmpDevelopTaskService
.
submitSyncing
(
task
);
dmpDevelopTaskService
.
submitSyncing
(
task
);
...
...
src/main/resources/mapper/dmp/DmpDevelopTaskMapper.xml
View file @
7f78a584
...
@@ -37,13 +37,22 @@
...
@@ -37,13 +37,22 @@
t1.TREE_ID as treeId
t1.TREE_ID as treeId
from dmp_develop_task t1
from dmp_develop_task t1
left join dmp_navigation_tree t2 on t1.TREE_ID=t2.ID
left join dmp_navigation_tree t2 on t1.TREE_ID=t2.ID
where 1=1 and t1.id = #{taskId}
where 1=1 and t1.
data_status ='1' and t1.
id = #{taskId}
</select>
</select>
<!--根据主键删除任务-->
<!--根据主键删除任务-->
<delete
id=
"deleteTaskByTaskId"
parameterType=
"string"
>
<update
id=
"deleteTaskByTaskId"
parameterType=
"java.util.Map"
>
delete from dmp_develop_task where id = #{taskId}
update dmp_develop_task
</delete>
<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>
</update>
<!--根据主键删除资源树-->
<!--根据主键删除资源树-->
<delete
id=
"deleteNavigationTreeByTreeId"
parameterType=
"string"
>
<delete
id=
"deleteNavigationTreeByTreeId"
parameterType=
"string"
>
...
@@ -142,7 +151,7 @@
...
@@ -142,7 +151,7 @@
ID, datasource_id, TASK_TYPE, TYPE, SCHEDULE_TYPE, IS_SUBMIT, TASK_DESC, SCRIPT, DATA_STATUS
ID, datasource_id, TASK_TYPE, TYPE, SCHEDULE_TYPE, IS_SUBMIT, TASK_DESC, SCRIPT, DATA_STATUS
, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME, TREE_ID, CHK_RESULT, SYNC_RESULT, CHK_TIME, SYNC_TIME, FLOW_HEADER, FLOW_JSON, VERSION, IS_GZIPED
, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME, TREE_ID, CHK_RESULT, SYNC_RESULT, CHK_TIME, SYNC_TIME, FLOW_HEADER, FLOW_JSON, VERSION, IS_GZIPED
from dmp_develop_task
from dmp_develop_task
where TREE_ID = #{treeId}
where
data_status ='1' and
TREE_ID = #{treeId}
</select>
</select>
<!--数据运维-数据开发任务列表分页查询-->
<!--数据运维-数据开发任务列表分页查询-->
...
@@ -159,7 +168,7 @@
...
@@ -159,7 +168,7 @@
t3.real_name as userName
t3.real_name as userName
from
from
dmp_navigation_tree t1
dmp_navigation_tree t1
left join dmp_develop_task t2 on t2.TREE_ID=t1.ID
left join dmp_develop_task t2 on t2.TREE_ID=t1.ID
and t2.data_status ='1'
left join dmp_member t3 on t1.create_user_id=t3.user_id
left join dmp_member t3 on t1.create_user_id=t3.user_id
where 1=1 and t1.type='01'
where 1=1 and t1.type='01'
and t1.project_id = #{projectId}
and t1.project_id = #{projectId}
...
@@ -194,7 +203,7 @@
...
@@ -194,7 +203,7 @@
(case when t1.type='01' then '离线同步' when t1.type='02' then '实时同步' when t1.type='03' then '数据开发' end) as type
(case when t1.type='01' then '离线同步' when t1.type='02' then '实时同步' when t1.type='03' then '数据开发' end) as type
from
from
dmp_navigation_tree t1
dmp_navigation_tree t1
left join dmp_develop_task t2 on t2.TREE_ID=t1.ID
left join dmp_develop_task t2 on t2.TREE_ID=t1.ID
and t2.data_status ='1'
left join dmp_member t3 on t1.create_user_id=t3.user_id
left join dmp_member t3 on t1.create_user_id=t3.user_id
where 1=1 and t1.type='01'
where 1=1 and t1.type='01'
and t1.project_id = #{projectId}
and t1.project_id = #{projectId}
...
...
src/main/resources/mapper/dmp/DmpRealtimeSyncInfoMapper.xml
View file @
7f78a584
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
, src_database_type, src_database_name, connector_url, target_database_type, target_database_name, src_datasource_name
, 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
, target_datasource_name, store_type, status, create_time, update_time, cre_person, upt_person
from dmp_realtime_sync_info
from dmp_realtime_sync_info
where id = #{id}
where
data_status='1' and
id = #{id}
</select>
</select>
<!--查询指定行数据-->
<!--查询指定行数据-->
...
@@ -323,10 +323,10 @@
...
@@ -323,10 +323,10 @@
t1.target_datasource_name as targetDatasourceName,
t1.target_datasource_name as targetDatasourceName,
t1.target_database_type as targetDatabaseType
t1.target_database_type as targetDatabaseType
FROM dmp_realtime_sync_info t1
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 t3 ON t1.src_datasource_id = t3.ID
left join dmp_syncing_datasource t4 ON t1.target_datasource_id = t4.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=
"taskStatus != null and taskStatus != '' "
>
AND t1.status = #{taskStatus}
</if>
<if
test=
"treeId != null and treeId != '' "
>
AND t1.id = #{treeId}
</if>
<if
test=
"treeId != null and treeId != '' "
>
AND t1.id = #{treeId}
</if>
<if
test=
"targetDatabaseTypeId != null and targetDatabaseTypeId != '' "
>
AND t4.DATASOURCE_TYPE = #{targetDatabaseTypeId}
</if>
<if
test=
"targetDatabaseTypeId != null and targetDatabaseTypeId != '' "
>
AND t4.DATASOURCE_TYPE = #{targetDatabaseTypeId}
</if>
...
@@ -344,7 +344,7 @@
...
@@ -344,7 +344,7 @@
, src_database_type, src_database_name, connector_url, target_database_type, target_database_name, src_datasource_name
, 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
, target_datasource_name, store_type, status, create_time, update_time, cre_person, upt_person
from dmp_realtime_sync_info
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=
")"
>
<foreach
collection=
"ids"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
#{item}
</foreach>
</foreach>
...
@@ -392,7 +392,7 @@
...
@@ -392,7 +392,7 @@
desensitization_field as desensitizationField,
desensitization_field as desensitizationField,
arithmetic
arithmetic
from dmp_realtime_sync_info
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}
and src_datasource_id = #{srcDatasourceId}
<if
test=
"targetDatasourceId != null"
>
and target_datasource_id = #{targetDatasourceId}
</if>
<if
test=
"targetDatasourceId != null"
>
and target_datasource_id = #{targetDatasourceId}
</if>
<if
test=
"sourceTableName != null and sourceTableName !=''"
>
and src_table_name = #{sourceTableName}
</if>
<if
test=
"sourceTableName != null and sourceTableName !=''"
>
and src_table_name = #{sourceTableName}
</if>
...
@@ -421,7 +421,7 @@
...
@@ -421,7 +421,7 @@
t1.target_database_type as targetDatabaseType
t1.target_database_type as targetDatabaseType
FROM dmp_realtime_sync_info t1
FROM dmp_realtime_sync_info t1
left join dmp_navigation_tree t2 on t1.tree_id=t2.id
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=
"projectId !=null"
>
and t1.project_id=#{projectId}
</if>
<if
test=
"taskStatus != null and taskStatus != '' "
>
AND t1.status = #{taskStatus}
</if>
<if
test=
"taskStatus != null and taskStatus != '' "
>
AND t1.status = #{taskStatus}
</if>
<if
test=
"treeId != null and treeId != '' "
>
AND t1.id = #{treeId}
</if>
<if
test=
"treeId != null and treeId != '' "
>
AND t1.id = #{treeId}
</if>
...
@@ -513,6 +513,20 @@
...
@@ -513,6 +513,20 @@
left join dmp_realtime_sync_blacklist_table_info t2 ON t1.id = t2.realtime_id
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
left join dmp_realtime_sync_select_table t3 on t1.id=t3.realtime_id
WHERE
WHERE
1 = 1 and id = #{taskId}
1 = 1 and
t1.data_status='1' and
id = #{taskId}
</select>
</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>
</trim>
where id in
<foreach
collection=
"ids"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</update>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/mapper/dmp/DmpSyncingDatasourceMapper.xml
View file @
7f78a584
...
@@ -302,13 +302,18 @@
...
@@ -302,13 +302,18 @@
</select>
</select>
<!--批量删除-->
<!--批量删除-->
<delete
id=
"delDataSourceById"
parameterType=
"map"
>
<update
id=
"delDataSourceById"
parameterType=
"map"
>
delete from dmp_syncing_datasource
update dmp_syncing_datasource
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"dataStatus != null"
>
data_status = #{dataStatus},
</if>
</trim>
where ID in
where ID in
<foreach
collection=
"ids"
item=
"item"
open=
"("
separator=
","
close=
")"
>
<foreach
collection=
"ids"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
#{item}
</foreach>
</foreach>
</
dele
te>
</
upda
te>
<!--查询数据源类型名称-->
<!--查询数据源类型名称-->
<select
id=
"queryDatasourceType"
resultType=
"map"
>
<select
id=
"queryDatasourceType"
resultType=
"map"
>
...
...
src/main/resources/mapper/dmp/OfflineSynchMapper.xml
View file @
7f78a584
...
@@ -144,7 +144,7 @@
...
@@ -144,7 +144,7 @@
from dmp_develop_task t1
from dmp_develop_task t1
inner 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_project_system_info t3 on t2.PROJECT_ID=t3.PROJECT_ID and t3.data_status = '1'
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>
</select>
<!-- 根据执行实例id查询规则执行结果表 -->
<!-- 根据执行实例id查询规则执行结果表 -->
...
...
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