Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dcs-plan
Project
Project
Details
Activity
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
INET-TWO
server
dcs-plan
Commits
058fd9fc
Commit
058fd9fc
authored
Sep 27, 2024
by
wangyangyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建计划基线
parent
c441bf0d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
21 deletions
+80
-21
ExtPlanBaseLineController.java
...e/dcs/plan/core/controller/ExtPlanBaseLineController.java
+21
-10
ExtPlanBaseLineService.java
...m/yonde/dcs/plan/core/service/ExtPlanBaseLineService.java
+7
-0
ExtPlanBaseLineServiceImpl.java
...cs/plan/core/service/impl/ExtPlanBaseLineServiceImpl.java
+52
-11
No files found.
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/controller/ExtPlanBaseLineController.java
View file @
058fd9fc
package
com
.
yonde
.
dcs
.
plan
.
core
.
controller
;
import
com.yonde.dex.basedata.entity.vo.IdVO
;
import
org.springframework.stereotype.Controller
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.validation.annotation.Validated
;
import
java.util.List
;
import
com.yonde.dcs.plan.common.vo.ExtPlanBaseLineVO
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.*
;
import
com.yonde.dcs.plan.core.service.ExtPlanBaseLineService
;
import
com.yonde.dex.basedata.entity.api.ApiResult
;
import
com.yonde.dcs.plan.core.controller.shadow.ExtPlanBaseLineControllerShadow
;
import
javax.annotation.Resource
;
import
org.springframework.stereotype.Controller
;
import
java.util.List
;
/**
* @description: ExtPlanBaseLine-Controller
* @author: dexadmin
* @version: V
* @date: 2024-9-27 11:03:50
**/
* @description: ExtPlanBaseLine-Controller
* @author: dexadmin
* @version: V
* @date: 2024-9-27 11:03:50
**/
@Api
(
tags
=
"ExtPlanBaseLine管理服务"
)
@RequestMapping
(
"/ExtPlanBaseLine"
)
@ResponseBody
()
...
...
@@ -28,6 +27,18 @@ import org.springframework.stereotype.Controller;
public
class
ExtPlanBaseLineController
<
V
extends
ExtPlanBaseLineVO
,
S
extends
ExtPlanBaseLineService
<
V
>>
extends
ExtPlanBaseLineControllerShadow
<
V
,
S
>
{
@Autowired
ExtPlanBaseLineService
extPlanBaseLineService
;
@ApiOperation
(
"创建基线"
)
@PostMapping
(
value
=
"/create/baseline"
)
public
ApiResult
createBaseline
(
@RequestBody
ExtPlanBaseLineVO
baseLineVO
)
{
ExtPlanBaseLineVO
baseline
=
extPlanBaseLineService
.
createBaseline
(
baseLineVO
);
return
ApiResult
.
ok
(
baseline
,
"创建基线成功!"
);
}
}
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/ExtPlanBaseLineService.java
View file @
058fd9fc
...
...
@@ -2,6 +2,10 @@ package com.yonde.dcs.plan.core.service;
import
com.yonde.dcs.plan.common.vo.ExtPlanBaseLineVO
;
import
com.yonde.dcs.plan.core.service.shadow.ExtPlanBaseLineServiceShadow
;
import
com.yonde.dex.basedata.entity.vo.IdVO
;
import
java.util.List
;
/**
* @description: ExtPlanBaseLine-service
* @author: dexadmin
...
...
@@ -10,4 +14,7 @@ import com.yonde.dcs.plan.core.service.shadow.ExtPlanBaseLineServiceShadow;
**/
public
interface
ExtPlanBaseLineService
<
V
extends
ExtPlanBaseLineVO
>
extends
ExtPlanBaseLineServiceShadow
<
V
>
{
ExtPlanBaseLineVO
createBaseline
(
ExtPlanBaseLineVO
baseLineVO
);
}
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/impl/ExtPlanBaseLineServiceImpl.java
View file @
058fd9fc
package
com
.
yonde
.
dcs
.
plan
.
core
.
service
.
impl
;
import
cn.hutool.core.util.ReflectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.yonde.dcs.plan.common.vo.ExtPlanBaseLineLinkVO
;
import
com.yonde.dcs.plan.core.service.ExtPlanBaseLineLinkService
;
import
com.yonde.dcs.plan.core.util.SearchUtil
;
import
com.yonde.dex.basedata.data.search.SearchItem
;
import
com.yonde.dex.basedata.data.search.SearchQueryCondition
;
import
com.yonde.dex.basedata.entity.data.DxPageImpl
;
import
com.yonde.dex.basedata.entity.data.OperatorType
;
import
com.yonde.dex.basedata.entity.vo.IdOnlyVO
;
import
com.yonde.dex.basedata.entity.vo.IdVO
;
import
com.yonde.dex.dao.service.util.ApplicationContextUtil
;
import
com.yonde.dex.version.plugin.core.service.IterationService
;
import
org.springframework.stereotype.Service
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.List
;
import
com.yonde.dcs.plan.common.vo.ExtPlanBaseLineVO
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
import
com.yonde.dcs.plan.core.service.ExtPlanBaseLineService
;
import
com.yonde.dcs.plan.core.repository.ExtPlanBaseLineRepository
;
import
com.yonde.dcs.plan.entity.po.ExtPlanBaseLine
;
import
javax.annotation.Resource
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @description: ExtPlanBaseLine-ServiceImpl
* @author: dexadmin
* @version: V
* @date: 2024-9-27 11:03:50
**/
* @description: ExtPlanBaseLine-ServiceImpl
* @author: dexadmin
* @version: V
* @date: 2024-9-27 11:03:50
**/
@Slf4j
@Service
(
ExtPlanBaseLineServiceImpl
.
BEAN_NAME
)
public
class
ExtPlanBaseLineServiceImpl
<
V
extends
ExtPlanBaseLineVO
>
implements
ExtPlanBaseLineService
<
V
>{
public
class
ExtPlanBaseLineServiceImpl
<
V
extends
ExtPlanBaseLineVO
>
implements
ExtPlanBaseLineService
<
V
>
{
public
static
final
String
BEAN_NAME
=
"extPlanBaseLineServiceImpl"
;
...
...
@@ -29,6 +41,35 @@ public class ExtPlanBaseLineServiceImpl<V extends ExtPlanBaseLineVO> implements
@Autowired
ExtPlanBaseLineRepository
<
ExtPlanBaseLine
>
extPlanBaseLineRepository
;
@Autowired
ExtPlanBaseLineLinkService
extPlanBaseLineLinkService
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ExtPlanBaseLineVO
createBaseline
(
ExtPlanBaseLineVO
baseLineVO
)
{
Long
dxContextId
=
baseLineVO
.
getDxContextId
();
SearchQueryCondition
queryCondition
=
SearchUtil
.
buildQuery
(
"dxContextId"
,
SearchItem
.
Operator
.
EQ
,
dxContextId
);
String
beanName
=
StrUtil
.
lowerFirst
(
baseLineVO
.
getPlanType
())
+
"ServiceImpl"
;
IterationService
iterationService
=
(
IterationService
)
ApplicationContextUtil
.
getBean
(
beanName
);
DxPageImpl
recursion
=
iterationService
.
findRecursion
(
queryCondition
);
if
(
recursion
.
getTotalElements
()
!=
0
)
{
List
<
IdVO
>
result
=
recursion
.
getContent
();
List
<
ExtPlanBaseLineLinkVO
>
lineLinkVOS
=
new
ArrayList
<>();
result
.
forEach
(
idVO
->
{
idVO
.
setOperator
(
OperatorType
.
ADD
);
idVO
.
setId
(
null
);
ReflectUtil
.
setFieldValue
(
idVO
,
"dxContextId"
,
null
);
ExtPlanBaseLineLinkVO
lineLinkVO
=
new
ExtPlanBaseLineLinkVO
();
lineLinkVO
.
setOperator
(
OperatorType
.
ADD
);
lineLinkVO
.
setTarget
((
IdOnlyVO
)
idVO
);
lineLinkVOS
.
add
(
lineLinkVO
);
});
baseLineVO
.
setExtPlanBaseLineLinks
(
lineLinkVOS
);
}
baseLineVO
.
setOperator
(
OperatorType
.
ADD
);
return
this
.
saveRecursion
((
V
)
baseLineVO
);
}
}
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