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
b0153f6f
Commit
b0153f6f
authored
Jan 26, 2021
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
d4b31294
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
175 additions
and
28 deletions
+175
-28
OfflineSynchController.java
...es/controller/DataIntegration/OfflineSynchController.java
+27
-0
NewSynchTaskReq.java
...ules/controller/DataIntegration/bean/NewSynchTaskReq.java
+82
-0
DmpNavigationTreeDao.java
...ain/java/com/jz/dmp/modules/dao/DmpNavigationTreeDao.java
+30
-28
OfflineSynchService.java
.../java/com/jz/dmp/modules/service/OfflineSynchService.java
+9
-0
OfflineSynchServiceImpl.java
.../jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
+27
-0
No files found.
src/main/java/com/jz/dmp/modules/controller/DataIntegration/OfflineSynchController.java
View file @
b0153f6f
...
...
@@ -5,6 +5,7 @@ import com.jz.common.constant.ResultCode;
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.service.DmpNavigationTreeService
;
import
com.jz.dmp.modules.service.OfflineSynchService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -231,4 +232,30 @@ public class OfflineSynchController {
JsonResult
list
=
offlineSynchService
.
updateSyncTask
(
syncDmpTaskAddReq
);
return
list
;
}
/**
* 新增同步任务
*
* @return
* @author Bellamy
* @since 2021-01-26
*/
@ApiOperation
(
value
=
"新增同步任务"
,
notes
=
"新增同步任务"
)
@PostMapping
(
value
=
"/newSynchTask"
)
public
JsonResult
addNewSynchTask
(
@RequestBody
@Validated
NewSynchTaskReq
newSynchTaskReq
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
newSynchTaskReq
.
getProjectId
()))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"项目ID不能为空"
);
}
if
(
StringUtils
.
isEmpty
(
newSynchTaskReq
.
getTreeName
()))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"任务名称不能为空"
);
}
if
(
StringUtils
.
isEmpty
(
newSynchTaskReq
.
getType
()))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"任务类型不能为空"
);
}
if
(
StringUtils
.
isEmpty
(
newSynchTaskReq
.
getProjectId
()))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"目标文件夹不能为空"
);
}
JsonResult
list
=
offlineSynchService
.
addNewSynchTask
(
newSynchTaskReq
);
return
list
;
}
}
src/main/java/com/jz/dmp/modules/controller/DataIntegration/bean/NewSynchTaskReq.java
0 → 100644
View file @
b0153f6f
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: NewSynchTaskReq
* @Description: 新增同步任务请求参数
* @Author:Bellamy
* @Date 2021/01/26
* @Version 1.0
*/
@ApiModel
(
value
=
"新增同步任务请求参数"
,
description
=
"新增同步任务请求参数"
)
public
class
NewSynchTaskReq
implements
Serializable
{
private
static
final
long
serialVersionUID
=
43527848022765137L
;
/*
* 任务类型
* */
@ApiModelProperty
(
value
=
"任务类型:01:离线同步,02:实时同步,03:数据开发"
)
@NotNull
(
message
=
"任务类型不能为空"
)
@NotEmpty
(
message
=
"任务类型不能为空"
)
private
String
type
;
/*
* 项目id
* */
@ApiModelProperty
(
value
=
"项目id"
)
@NotNull
(
message
=
"项目id不能为空"
)
@NotEmpty
(
message
=
"项目ID不能为空"
)
private
String
projectId
;
/*
* 任务名称
* */
@ApiModelProperty
(
value
=
"任务名称"
)
@NotNull
(
message
=
"任务名称不能为空"
)
@NotEmpty
(
message
=
"任务名称不能为空"
)
private
String
treeName
;
@ApiModelProperty
(
value
=
"目标文件夹"
)
@NotNull
(
message
=
"目标文件夹不能为空"
)
@NotEmpty
(
message
=
"目标文件夹不能为空"
)
private
String
parentId
;
public
String
getProjectId
()
{
return
projectId
;
}
public
void
setProjectId
(
String
projectId
)
{
this
.
projectId
=
projectId
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getTreeName
()
{
return
treeName
;
}
public
void
setTreeName
(
String
treeName
)
{
this
.
treeName
=
treeName
;
}
public
String
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
String
parentId
)
{
this
.
parentId
=
parentId
;
}
}
src/main/java/com/jz/dmp/modules/dao/DmpNavigationTreeDao.java
View file @
b0153f6f
...
...
@@ -11,7 +11,7 @@ import java.util.List;
* @author makejava
* @since 2020-12-29 15:08:16
*/
public
interface
DmpNavigationTreeDao
{
public
interface
DmpNavigationTreeDao
{
/**
* 通过ID查询单条数据
...
...
@@ -45,7 +45,7 @@ public interface DmpNavigationTreeDao{
* @param dmpNavigationTree 实例对象
* @return 影响行数
*/
int
insert
(
DmpNavigationTree
dmpNavigationTree
);
int
insert
(
DmpNavigationTree
dmpNavigationTree
)
throws
Exception
;
/**
* 批量新增数据(MyBatis原生foreach方法)
...
...
@@ -82,32 +82,34 @@ public interface DmpNavigationTreeDao{
int
countTreeByName
(
DmpNavigationTree
tree
);
/**
* @Title: getByProjectIdAndName
* @Description: TODO(根据项目ID和任务名称获取tree)
* @param @param projectId
* @param @param name
* @param @return
* @param @throws Exception 参数
* @return DmpNavigationTree 返回类型
* @throws
* @Title: getByProjectIdAndName
* @Description: TODO(根据项目ID和任务名称获取tree)
*/
public
DmpNavigationTree
getByProjectIdAndName
(
@Param
(
"projectId"
)
Long
projectId
,
@Param
(
"name"
)
String
name
)
throws
Exception
;
public
DmpNavigationTree
getByProjectIdAndName
(
@Param
(
"projectId"
)
Long
projectId
,
@Param
(
"name"
)
String
name
)
throws
Exception
;
/**
* @Title: getMaxSortById
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param tree
* @param @return
* @param @throws Exception 参数
* @return Integer 返回类型
* @throws
* @Title: getMaxSortById
* @Description: TODO(这里用一句话描述这个方法的作用)
*/
public
Integer
getMaxSortById
(
DmpNavigationTree
tree
)
throws
Exception
;
public
Integer
getMaxSortById
(
DmpNavigationTree
tree
)
throws
Exception
;
/**选择性增加DMP资源导航树
/**
* 选择性增加DMP资源导航树
*
* @param dmpNavigationTree
* @return
* @throws Exception
*/
public
int
insertSelective
(
DmpNavigationTree
dmpNavigationTree
)
throws
Exception
;
public
int
insertSelective
(
DmpNavigationTree
dmpNavigationTree
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/OfflineSynchService.java
View file @
b0153f6f
...
...
@@ -111,4 +111,13 @@ public interface OfflineSynchService {
* @since 2021-01-07
*/
JsonResult
stopSyncingTaskByTaskId
(
String
taskId
)
throws
Exception
;
/**
* 新增同步任务
*
* @return
* @author Bellamy
* @since 2021-01-26
*/
JsonResult
addNewSynchTask
(
NewSynchTaskReq
newSynchTaskReq
)
throws
Exception
;
}
src/main/java/com/jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
View file @
b0153f6f
...
...
@@ -15,6 +15,7 @@ import com.jz.common.utils.AzkabanApiUtils2;
import
com.jz.common.utils.FileUtils
;
import
com.jz.common.utils.JsonMapper
;
import
com.jz.common.utils.ZipUtils
;
import
com.jz.common.utils.web.SessionUtils
;
import
com.jz.common.utils.web.XmlUtils
;
import
com.jz.dmp.agent.DmpAgentResult
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.*
;
...
...
@@ -755,4 +756,30 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
return
JsonResult
.
ok
();
}
/**
* 新增同步任务
*
* @return
* @author Bellamy
* @since 2021-01-26
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
JsonResult
addNewSynchTask
(
NewSynchTaskReq
newSynchTaskReq
)
throws
Exception
{
DmpNavigationTree
tree
=
new
DmpNavigationTree
();
tree
.
setCreateTime
(
new
Date
());
tree
.
setCreateUserId
(
SessionUtils
.
getCurrentUserId
());
tree
.
setName
(
newSynchTaskReq
.
getTreeName
());
tree
.
setProjectId
(
Integer
.
valueOf
(
newSynchTaskReq
.
getProjectId
()));
tree
.
setType
(
newSynchTaskReq
.
getType
());
tree
.
setParentId
(
Integer
.
valueOf
(
newSynchTaskReq
.
getParentId
()));
tree
.
setIsLevel
(
"1"
);
tree
.
setIsEnable
(
"1"
);
tree
.
setDataStatus
(
"1"
);
int
len
=
dmpNavigationTreeDao
.
insert
(
tree
);
if
(
len
>
0
)
return
JsonResult
.
ok
();
return
JsonResult
.
error
();
}
}
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