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
a064a2b5
Commit
a064a2b5
authored
Nov 12, 2024
by
wangqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
标准版本升级功能开发
parent
e8e684f8
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
0 deletions
+76
-0
Constants.java
...n/java/com/yonde/dcs/plan/common/constants/Constants.java
+5
-0
ExtStandardController.java
...yonde/dcs/plan/core/controller/ExtStandardController.java
+18
-0
ExtStandardService.java
...a/com/yonde/dcs/plan/core/service/ExtStandardService.java
+9
-0
ExtStandardServiceImpl.java
...de/dcs/plan/core/service/impl/ExtStandardServiceImpl.java
+38
-0
ExtStandardServiceFeign.java
...ava/com/yonde/dcs/plan/feign/ExtStandardServiceFeign.java
+6
-0
No files found.
dcs-plan-common/src/main/java/com/yonde/dcs/plan/common/constants/Constants.java
View file @
a064a2b5
...
...
@@ -162,6 +162,11 @@ public class Constants {
* 已过时
*/
public
static
final
String
OBSOLETE
=
"obsolete"
;
/**
* 已过时 --4.0
*/
public
static
final
String
OUTMODED
=
"Outmoded"
;
/**
* 打开
*/
...
...
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/controller/ExtStandardController.java
View file @
a064a2b5
package
com
.
yonde
.
dcs
.
plan
.
core
.
controller
;
import
com.yonde.dcs.plan.entity.po.ExtStandard
;
import
org.springframework.stereotype.Controller
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.validation.annotation.Validated
;
import
java.io.IOException
;
import
java.util.List
;
import
com.yonde.dcs.plan.common.vo.ExtStandardVO
;
import
org.springframework.beans.factory.annotation.Qualifier
;
...
...
@@ -28,6 +31,21 @@ import org.springframework.stereotype.Controller;
public
class
ExtStandardController
<
V
extends
ExtStandardVO
,
S
extends
ExtStandardService
<
V
>>
extends
ExtStandardControllerShadow
<
V
,
S
>
{
@Autowired
private
ExtStandardService
extStandardService
;
@ApiOperation
(
"标准版本升级"
)
@PostMapping
(
value
=
"/upgradeVersion"
)
public
ApiResult
standardUpgradeVersion
(
@RequestBody
ExtStandardVO
extStandardVO
)
throws
IOException
{
return
ApiResult
.
ok
(
extStandardService
.
upgradeVersion
(
extStandardVO
),
"版本升级成功"
);
}
@ApiOperation
(
value
=
"标准作废"
,
notes
=
"标准升级完成后,将上一个版本置为已过时"
)
@PostMapping
(
value
=
"/setPreviousVersionOutmoded"
)
public
ApiResult
setPreviousVersionOutmoded
(
@RequestParam
(
required
=
false
,
value
=
"id"
)
Long
id
){
return
ApiResult
.
ok
(
extStandardService
.
setPreviousVersionOutmoded
(
id
),
"标准作废成功"
);
}
}
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/ExtStandardService.java
View file @
a064a2b5
...
...
@@ -2,6 +2,8 @@ package com.yonde.dcs.plan.core.service;
import
com.yonde.dcs.plan.common.vo.ExtStandardVO
;
import
com.yonde.dcs.plan.core.service.shadow.ExtStandardServiceShadow
;
import
com.yonde.dex.basedata.entity.api.ApiResult
;
/**
* @description: ExtStandard-service
* @author: dexadmin
...
...
@@ -10,4 +12,11 @@ import com.yonde.dcs.plan.core.service.shadow.ExtStandardServiceShadow;
**/
public
interface
ExtStandardService
<
V
extends
ExtStandardVO
>
extends
ExtStandardServiceShadow
<
V
>
{
public
String
upgradeVersion
(
ExtStandardVO
extStandardVO
);
public
String
setPreviousVersionOutmoded
(
Long
id
);
}
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/impl/ExtStandardServiceImpl.java
View file @
a064a2b5
package
com
.
yonde
.
dcs
.
plan
.
core
.
service
.
impl
;
import
com.yonde.dcs.plan.common.constants.Constants
;
import
com.yonde.dex.basedata.entity.api.ApiResult
;
import
com.yonde.dex.basedata.exception.DxBusinessException
;
import
org.springframework.stereotype.Service
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.List
;
...
...
@@ -7,6 +10,8 @@ import com.yonde.dcs.plan.common.vo.ExtStandardVO;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
com.yonde.dcs.plan.core.service.ExtStandardService
;
import
com.yonde.dcs.plan.core.repository.ExtStandardRepository
;
...
...
@@ -29,6 +34,39 @@ public class ExtStandardServiceImpl<V extends ExtStandardVO> implements ExtStand
@Autowired
ExtStandardRepository
<
ExtStandard
>
extStandardRepository
;
/**
* 版本升级,升大版本,并将上一个版本的最新小版置为“已作废”
* @param extStandardVO
* @return
*/
@Override
public
String
upgradeVersion
(
ExtStandardVO
extStandardVO
)
{
if
(!
ObjectUtils
.
isEmpty
(
extStandardVO
.
getId
())){
//更新,大版本升级
this
.
newVersion
((
V
)
extStandardVO
);
}
else
{
throw
new
DxBusinessException
(
"-1"
,
"id不能为空"
);
}
return
ApiResult
.
SUCCESS
;
}
/**
* 自动化任务:工作流结束之后,将上一个版本置为已过时;
* @param id 在数据库中的字段为:PREDECESSOR_ID
* @return
*/
@Override
public
String
setPreviousVersionOutmoded
(
Long
id
)
{
if
(!
ObjectUtils
.
isEmpty
(
id
)){
//将旧版本设置为作废
this
.
changeStatus
(
id
,
Constants
.
OUTMODED
,
true
);
}
else
{
//如果是空无需作废;因为是空的话,说明没有升级,所以不用做任何处理
}
return
ApiResult
.
SUCCESS
;
}
}
dcs-plan-feign/src/main/java/com/yonde/dcs/plan/feign/ExtStandardServiceFeign.java
View file @
a064a2b5
package
com
.
yonde
.
dcs
.
plan
.
feign
;
import
com.yonde.dcs.plan.common.vo.ExtStandardVO
;
import
com.yonde.dex.basedata.entity.api.ApiResult
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
import
com.yonde.dcs.plan.feign.shadow.ExtStandardServiceFeignShadow
;
...
...
@@ -16,4 +18,8 @@ import com.yonde.dcs.plan.feign.shadow.ExtStandardServiceFeignShadow;
@FeignClient
(
value
=
"${dcs.feign.INET-PLAN}"
,
path
=
"/ExtStandard"
)
public
interface
ExtStandardServiceFeign
<
V
extends
ExtStandardVO
>
extends
ExtStandardServiceFeignShadow
<
V
>
{
@ApiOperation
(
value
=
"标准作废"
,
notes
=
"标准升级完成后,将上一个版本置为已过时"
)
@PostMapping
(
value
=
"/setPreviousVersionOutmoded"
)
public
String
setPreviousVersionOutmoded
(
@RequestParam
(
required
=
false
,
value
=
"id"
)
Long
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