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
413e934b
Commit
413e934b
authored
Oct 12, 2024
by
wangqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IED计划更新时,更新技术文件的功能开发
parent
113def65
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
6 deletions
+61
-6
IEDPlanExcelListenner.java
...m/yonde/dcs/plan/core/listener/IEDPlanExcelListenner.java
+61
-6
No files found.
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/listener/IEDPlanExcelListenner.java
View file @
413e934b
...
...
@@ -37,9 +37,7 @@ import java.time.LocalDate;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.*
;
@Component
@Slf4j
...
...
@@ -124,7 +122,17 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
ExtIEDPlanVO
extIEDPlanVOForDB
=
getIEDPlanByFileNumber
(
extIEDPlanExcelVO
.
getFileNumber
());
extIEDPlanVOForDB
.
setOperator
(
OperatorType
.
MODIFY
);
transitionObject
(
extIEDPlanVOForDB
,
extIEDPlanExcelVO
);
extIEDPlanService
.
saveRecursion
(
extIEDPlanVOForDB
);
//更新计划 --如果是未开启状态,表示还未启动计划;所以没有技术文件,所以不用更新技术文件,只计划信息。
if
(
extIEDPlanVOForDB
.
getState
().
equals
(
Constants
.
PLAN_STATE_UNOPENED
))
{
//更新计划信息
extIEDPlanService
.
saveRecursion
(
extIEDPlanVOForDB
);
}
else
{
//更新计划信息
extIEDPlanService
.
saveRecursion
(
extIEDPlanVOForDB
);
//更新技术文件
updateDxdocumentVO
(
extIEDPlanVOForDB
);
}
}
else
{
//删除
ExtIEDPlanVO
extIEDPlanVOForDB
=
getIEDPlanByFileNumber
(
extIEDPlanExcelVO
.
getFileNumber
());
if
(
extIEDPlanVOForDB
.
getState
().
equals
(
Constants
.
PLAN_STATE_UNOPENED
)){
...
...
@@ -199,7 +207,7 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,新增IED计划的文件编号、文件代号或者管理信息系统编码已存在,不能重复添加!"
);
errorList
.
add
(
errorString
);
}
}
else
if
(
Constants
.
EXCEL_DELETE
.
equals
(
extIEDPlanExcelVO
.
getOperation
())){
}
else
if
(
Constants
.
EXCEL_DELETE
.
equals
(
extIEDPlanExcelVO
.
getOperation
())){
//删除时校验
// ExtIEDPlanVO extIEDPlanVO = getIEDPlanByFileNumberAndDeleted(extIEDPlanExcelVO.getFileNumber(),true);
// if(!ObjectUtils.isEmpty(extIEDPlanVO)){
// errorString.append("解析到数据第"+excelDataRow+"行,删除IED计划的文件编号:" + extIEDPlanExcelVO.getFileNumber() + "未查到相关数据,删除失败!");
...
...
@@ -219,12 +227,35 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
errorList
.
add
(
errorString
);
}
}
}
else
{
}
else
{
//更新时校验
ExtIEDPlanVO
iedPlan
=
getIEDPlanByFileNumberAndDeleted
(
extIEDPlanExcelVO
.
getFileNumber
(),
false
);
//如果未查看计划信息,证明更新时的编码不存在,不能更新
if
(
ObjectUtils
.
isEmpty
(
iedPlan
)){
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,更新IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"未查到相关信息,更新失败!"
);
errorList
.
add
(
errorString
);
return
;
}
//校验该计划是否被删除
ExtIEDPlanVO
extIEDPlanVO
=
getIEDPlanByFileNumberAndDeleted
(
extIEDPlanExcelVO
.
getFileNumber
(),
true
);
if
(!
ObjectUtils
.
isEmpty
(
extIEDPlanVO
)
&&
1
==
extIEDPlanVO
.
getDeleted
())
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,更新IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"已被删除,更新或删除失败!"
);
errorList
.
add
(
errorString
);
}
//已完成的计划不能被更新
if
(!
ObjectUtils
.
isEmpty
(
iedPlan
)
&&
Constants
.
COMPLETE
.
equals
(
iedPlan
.
getState
())){
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,更新IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"已完成的计划不能更新!"
);
errorList
.
add
(
errorString
);
}
//如果更新时,计划是未完成状态且不是待审阅状态时,不允许更新
if
(
Constants
.
UNFINISHED
.
equals
(
iedPlan
.
getState
())
){
DxDocumentVO
dxDocumentVO
=
getDocmentVoByPlanId
(
iedPlan
.
getId
());
if
(!
Constants
.
PENDING_REVIEW
.
equals
(
dxDocumentVO
.
getState
())){
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,更新IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的状态是未完成且审阅状态是"
+
getStateValue
(
dxDocumentVO
.
getState
())+
",不能更新!"
);
errorList
.
add
(
errorString
);
}
}
}
}
else
{
...
...
@@ -348,6 +379,7 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
.
searchItems
(
SearchItems
.
builder
()
.
item
(
new
SearchItem
(
"fileNumber"
,
SearchItem
.
Operator
.
EQ
,
fileNumber
,
null
))
.
item
(
new
SearchItem
(
"deleted"
,
SearchItem
.
Operator
.
EQ
,
deleted
,
null
))
.
item
(
new
SearchItem
(
"dxContextId"
,
SearchItem
.
Operator
.
EQ
,
projectId
,
(
Object
)
null
))
.
build
())
.
build
();
...
...
@@ -381,4 +413,27 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
return
CommonUtils
.
searchDictDataValueByDictCode
(
Constants
.
OBJ_STATUS
,
state
);
}
/**
* 更新文档新新
* @param extIEDPlanVO
*/
public
void
updateDxdocumentVO
(
ExtIEDPlanVO
extIEDPlanVO
){
DxDocumentVO
dxDocumentVO
=
getDocmentVoByPlanId
(
extIEDPlanVO
.
getId
());
dxDocumentVO
.
setOperator
(
OperatorType
.
MODIFY
);
//文件编号
dxDocumentVO
.
setNumber
(
extIEDPlanVO
.
getFileNumber
());
//文件名称
dxDocumentVO
.
setName
(
extIEDPlanVO
.
getFileName
());
Map
<
String
,
Object
>
dynamicAttrs
=
new
HashMap
<>();
//文件代号
dynamicAttrs
.
put
(
"fileNumber"
,
extIEDPlanVO
.
getFileCode
());
//管理信息系统编码
dynamicAttrs
.
put
(
"systemCode"
,
extIEDPlanVO
.
getSystemNumber
());
//阶段
dynamicAttrs
.
put
(
"phase"
,
extIEDPlanVO
.
getPhase
());
//设置动态属性
dxDocumentVO
.
setDynamicAttrs
(
dynamicAttrs
);
extDxDocumentServiceFeign
.
saveRecursion
(
dxDocumentVO
);
}
}
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