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
505a08da
Commit
505a08da
authored
Oct 16, 2024
by
侯彦文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改文档依赖
parent
ea954424
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
136 additions
and
149 deletions
+136
-149
IEDPlanExcelListenner.java
...m/yonde/dcs/plan/core/listener/IEDPlanExcelListenner.java
+93
-94
DxMessageService.java
...ava/com/yonde/dcs/plan/core/service/DxMessageService.java
+0
-1
ExtICMExternalInterfacePlanServiceImpl.java
.../service/impl/ExtICMExternalInterfacePlanServiceImpl.java
+18
-28
ExtIEDPlanServiceImpl.java
...nde/dcs/plan/core/service/impl/ExtIEDPlanServiceImpl.java
+3
-3
ExtPlanServiceImpl.java
.../yonde/dcs/plan/core/service/impl/ExtPlanServiceImpl.java
+1
-1
ExtPuchasePlanAttributeServiceImpl.java
...core/service/impl/ExtPuchasePlanAttributeServiceImpl.java
+21
-22
No files found.
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/listener/IEDPlanExcelListenner.java
View file @
505a08da
...
@@ -4,20 +4,18 @@ import com.alibaba.excel.context.AnalysisContext;
...
@@ -4,20 +4,18 @@ import com.alibaba.excel.context.AnalysisContext;
import
com.alibaba.excel.event.AnalysisEventListener
;
import
com.alibaba.excel.event.AnalysisEventListener
;
import
com.alibaba.excel.util.ListUtils
;
import
com.alibaba.excel.util.ListUtils
;
import
com.alibaba.excel.util.StringUtils
;
import
com.alibaba.excel.util.StringUtils
;
import
com.inet.dcs.document.feign.expand.ExtDxDocumentServiceFeign
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.document.feign.expand.ExtDxDocumentServiceFeign
;
import
com.yonde.dcs.plan.common.constants.Constants
;
import
com.yonde.dcs.plan.common.constants.Constants
;
import
com.yonde.dcs.plan.common.utils.SearchUtil
;
import
com.yonde.dcs.plan.common.utils.SearchUtil
;
import
com.yonde.dcs.plan.common.vo.ExtIEDPlanDocLinkVO
;
import
com.yonde.dcs.plan.common.vo.ExtIEDPlanDocLinkVO
;
import
com.yonde.dcs.plan.common.vo.ExtIEDPlanExcelVO
;
import
com.yonde.dcs.plan.common.vo.ExtIEDPlanExcelVO
;
import
com.yonde.dcs.plan.common.vo.ExtIEDPlanVO
;
import
com.yonde.dcs.plan.common.vo.ExtIEDPlanVO
;
import
com.yonde.dcs.plan.common.vo.ExtPuchasePlanAttributeVO
;
import
com.yonde.dcs.plan.core.service.ExtIEDPlanDocLinkService
;
import
com.yonde.dcs.plan.core.service.ExtIEDPlanDocLinkService
;
import
com.yonde.dcs.plan.core.service.ExtIEDPlanService
;
import
com.yonde.dcs.plan.core.service.ExtIEDPlanService
;
import
com.yonde.dcs.plan.core.util.CommonUtils
;
import
com.yonde.dcs.plan.core.util.CommonUtils
;
import
com.yonde.dcs.plan.core.util.UserUtils
;
import
com.yonde.dcs.plan.core.util.UserUtils
;
import
com.yonde.dcs.plan.core.util.WorkFlowUtil
;
import
com.yonde.dcs.plan.core.util.WorkFlowUtil
;
import
com.yonde.dcs.plan.entity.po.ExtIEDPlanDocLink
;
import
com.yonde.dex.basedata.data.search.SearchItem
;
import
com.yonde.dex.basedata.data.search.SearchItem
;
import
com.yonde.dex.basedata.data.search.SearchItems
;
import
com.yonde.dex.basedata.data.search.SearchItems
;
import
com.yonde.dex.basedata.data.search.SearchQueryCondition
;
import
com.yonde.dex.basedata.data.search.SearchQueryCondition
;
...
@@ -27,10 +25,7 @@ import com.yonde.dex.basedata.exception.DxBusinessException;
...
@@ -27,10 +25,7 @@ import com.yonde.dex.basedata.exception.DxBusinessException;
import
com.yonde.dex.dao.service.util.ApplicationContextUtil
;
import
com.yonde.dex.dao.service.util.ApplicationContextUtil
;
import
com.yonde.dex.dao.service.util.DxPageUtils
;
import
com.yonde.dex.dao.service.util.DxPageUtils
;
import
com.yonde.dex.user.common.vo.DxUserInfoVO
;
import
com.yonde.dex.user.common.vo.DxUserInfoVO
;
import
com.yonde.dex.user.feign.DxUserInfoFeign
;
import
com.yonde.dex.wfc.common.vo.DxWfProcessVO
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
...
@@ -82,7 +77,8 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
...
@@ -82,7 +77,8 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
*/
*/
List
<
String
>
operationList
=
Arrays
.
asList
(
Constants
.
EXCEL_ADD
,
Constants
.
EXCEL_UPDATE
,
Constants
.
EXCEL_DELETE
);
List
<
String
>
operationList
=
Arrays
.
asList
(
Constants
.
EXCEL_ADD
,
Constants
.
EXCEL_UPDATE
,
Constants
.
EXCEL_DELETE
);
public
IEDPlanExcelListenner
()
{}
public
IEDPlanExcelListenner
()
{
}
public
IEDPlanExcelListenner
(
String
projectId
)
{
public
IEDPlanExcelListenner
(
String
projectId
)
{
this
.
extIEDPlanService
=
ApplicationContextUtil
.
getBean
(
ExtIEDPlanService
.
class
);
this
.
extIEDPlanService
=
ApplicationContextUtil
.
getBean
(
ExtIEDPlanService
.
class
);
...
@@ -97,14 +93,13 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
...
@@ -97,14 +93,13 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
public
void
invoke
(
ExtIEDPlanExcelVO
extIEDPlanExcelVO
,
AnalysisContext
analysisContext
)
{
public
void
invoke
(
ExtIEDPlanExcelVO
extIEDPlanExcelVO
,
AnalysisContext
analysisContext
)
{
excelDataRow
++;
excelDataRow
++;
//判断是否是空数据行
//判断是否是空数据行
if
(!
CommonUtils
.
checkAllPropertiesIsEmpty
(
extIEDPlanExcelVO
))
{
if
(!
CommonUtils
.
checkAllPropertiesIsEmpty
(
extIEDPlanExcelVO
))
{
log
.
info
(
"解析到一条数据:{}"
,
extIEDPlanExcelVO
);
log
.
info
(
"解析到一条数据:{}"
,
extIEDPlanExcelVO
);
//检查excel数据合法性
//检查excel数据合法性
checkDataForExcel
(
extIEDPlanExcelVO
);
checkDataForExcel
(
extIEDPlanExcelVO
);
}
}
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
@@ -126,12 +121,12 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
...
@@ -126,12 +121,12 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
}
else
if
(
Constants
.
EXCEL_UPDATE
.
equals
(
extIEDPlanExcelVO
.
getOperation
()))
{
//更新
}
else
if
(
Constants
.
EXCEL_UPDATE
.
equals
(
extIEDPlanExcelVO
.
getOperation
()))
{
//更新
ExtIEDPlanVO
extIEDPlanVOForDB
=
getIEDPlanByFileNumber
(
extIEDPlanExcelVO
.
getFileNumber
());
ExtIEDPlanVO
extIEDPlanVOForDB
=
getIEDPlanByFileNumber
(
extIEDPlanExcelVO
.
getFileNumber
());
extIEDPlanVOForDB
.
setOperator
(
OperatorType
.
MODIFY
);
extIEDPlanVOForDB
.
setOperator
(
OperatorType
.
MODIFY
);
transitionObject
(
extIEDPlanVOForDB
,
extIEDPlanExcelVO
);
transitionObject
(
extIEDPlanVOForDB
,
extIEDPlanExcelVO
);
//更新计划 --如果是未开启状态,表示还未启动计划;所以没有技术文件,所以不用更新技术文件,只计划信息。
//更新计划 --如果是未开启状态,表示还未启动计划;所以没有技术文件,所以不用更新技术文件,只计划信息。
if
(
extIEDPlanVOForDB
.
getState
().
equals
(
Constants
.
PLAN_STATE_UNOPENED
))
{
if
(
extIEDPlanVOForDB
.
getState
().
equals
(
Constants
.
PLAN_STATE_UNOPENED
))
{
//更新计划信息
//更新计划信息
extIEDPlanService
.
saveRecursion
(
extIEDPlanVOForDB
);
extIEDPlanService
.
saveRecursion
(
extIEDPlanVOForDB
);
}
else
{
}
else
{
//更新计划信息
//更新计划信息
extIEDPlanService
.
saveRecursion
(
extIEDPlanVOForDB
);
extIEDPlanService
.
saveRecursion
(
extIEDPlanVOForDB
);
//更新技术文件
//更新技术文件
...
@@ -140,21 +135,20 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
...
@@ -140,21 +135,20 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
}
else
{
//删除
}
else
{
//删除
ExtIEDPlanVO
extIEDPlanVOForDB
=
getIEDPlanByFileNumber
(
extIEDPlanExcelVO
.
getFileNumber
());
ExtIEDPlanVO
extIEDPlanVOForDB
=
getIEDPlanByFileNumber
(
extIEDPlanExcelVO
.
getFileNumber
());
if
(
extIEDPlanVOForDB
.
getState
().
equals
(
Constants
.
PLAN_STATE_UNOPENED
))
{
if
(
extIEDPlanVOForDB
.
getState
().
equals
(
Constants
.
PLAN_STATE_UNOPENED
))
{
//删除计划 --如果是未开启状态,表示还未启动计划;所以没有技术文件及流程,所以不用删除技术文件及流程,只删除计划。
//删除计划 --如果是未开启状态,表示还未启动计划;所以没有技术文件及流程,所以不用删除技术文件及流程,只删除计划。
extIEDPlanService
.
remove
(
extIEDPlanVOForDB
.
getId
());
extIEDPlanService
.
remove
(
extIEDPlanVOForDB
.
getId
());
}
else
{
}
else
{
//删除计划
//删除计划
extIEDPlanService
.
remove
(
extIEDPlanVOForDB
.
getId
());
extIEDPlanService
.
remove
(
extIEDPlanVOForDB
.
getId
());
//删除技术文件
//删除技术文件
DxDocumentVO
dxDocumentVO
=
getDocmentVoByPlanId
(
extIEDPlanVOForDB
.
getId
());
DxDocumentVO
dxDocumentVO
=
getDocmentVoByPlanId
(
extIEDPlanVOForDB
.
getId
());
extDxDocumentServiceFeign
.
delete
(
dxDocumentVO
.
getId
());
extDxDocumentServiceFeign
.
delete
(
dxDocumentVO
.
getId
());
//删除流程
//删除流程
workFlowUtil
.
stopWf
(
dxDocumentVO
);
workFlowUtil
.
stopWf
(
dxDocumentVO
);
}
}
}
}
}
}
...
@@ -188,60 +182,60 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
...
@@ -188,60 +182,60 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
//校验数据
//校验数据
if
(!
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getOperation
())
&&
!
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getFileNumber
()))
{
if
(!
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getOperation
())
&&
!
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getFileNumber
()))
{
//校验excel必填字段是否有效
//校验excel必填字段是否有效
verifyExcelRequiredFields
(
extIEDPlanExcelVO
,
errorString
);
verifyExcelRequiredFields
(
extIEDPlanExcelVO
,
errorString
);
//如果是新增,查看一下数据库中是不是已经存在
//如果是新增,查看一下数据库中是不是已经存在
if
(
Constants
.
EXCEL_ADD
.
equals
(
extIEDPlanExcelVO
.
getOperation
()))
{
if
(
Constants
.
EXCEL_ADD
.
equals
(
extIEDPlanExcelVO
.
getOperation
()))
{
//文件编码、文件代号、管理系统编码只要有一个为删除存在就不能新增。
//文件编码、文件代号、管理系统编码只要有一个为删除存在就不能新增。
ExtIEDPlanVO
extIEDPlanVO
=
getIEDPlanByFileNumberAndFileCodeAndSystemNumber
(
extIEDPlanExcelVO
.
getFileNumber
(),
extIEDPlanExcelVO
.
getFileCode
(),
extIEDPlanExcelVO
.
getSystemNumber
());
ExtIEDPlanVO
extIEDPlanVO
=
getIEDPlanByFileNumberAndFileCodeAndSystemNumber
(
extIEDPlanExcelVO
.
getFileNumber
(),
extIEDPlanExcelVO
.
getFileCode
(),
extIEDPlanExcelVO
.
getSystemNumber
());
if
(!
ObjectUtils
.
isEmpty
(
extIEDPlanVO
))
{
if
(!
ObjectUtils
.
isEmpty
(
extIEDPlanVO
))
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,新增IED计划的文件编号、文件代号或者管理信息系统编码已存在,不能重复添加!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,新增IED计划的文件编号、文件代号或者管理信息系统编码已存在,不能重复添加!"
);
errorList
.
add
(
errorString
);
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);
// ExtIEDPlanVO extIEDPlanVO = getIEDPlanByFileNumberAndDeleted(extIEDPlanExcelVO.getFileNumber(),true);
// if(!ObjectUtils.isEmpty(extIEDPlanVO)){
// if(!ObjectUtils.isEmpty(extIEDPlanVO)){
// errorString.append("解析到数据第"+excelDataRow+"行,删除IED计划的文件编号:" + extIEDPlanExcelVO.getFileNumber() + "未查到相关数据,删除失败!");
// errorString.append("解析到数据第"+excelDataRow+"行,删除IED计划的文件编号:" + extIEDPlanExcelVO.getFileNumber() + "未查到相关数据,删除失败!");
// errorList.add(errorString);
// errorList.add(errorString);
// }
// }
ExtIEDPlanVO
iedPlan
=
getIEDPlanByFileNumberAndDeleted
(
extIEDPlanExcelVO
.
getFileNumber
(),
false
);
ExtIEDPlanVO
iedPlan
=
getIEDPlanByFileNumberAndDeleted
(
extIEDPlanExcelVO
.
getFileNumber
(),
false
);
//已完成的计划不允许删除
//已完成的计划不允许删除
if
(!
ObjectUtils
.
isEmpty
(
iedPlan
)
&&
Constants
.
COMPLETE
.
equals
(
iedPlan
.
getState
()))
{
if
(!
ObjectUtils
.
isEmpty
(
iedPlan
)
&&
Constants
.
COMPLETE
.
equals
(
iedPlan
.
getState
()))
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,删除IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"已完成的计划不能删除!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,删除IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"已完成的计划不能删除!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
}
}
//未完成的计划且技术文件不是待审阅状态不允许删除
//未完成的计划且技术文件不是待审阅状态不允许删除
if
(
Constants
.
UNFINISHED
.
equals
(
iedPlan
.
getState
())
)
{
if
(
Constants
.
UNFINISHED
.
equals
(
iedPlan
.
getState
()))
{
DxDocumentVO
dxDocumentVO
=
getDocmentVoByPlanId
(
iedPlan
.
getId
());
DxDocumentVO
dxDocumentVO
=
getDocmentVoByPlanId
(
iedPlan
.
getId
());
if
(!
Constants
.
PENDING_REVIEW
.
equals
(
dxDocumentVO
.
getState
()))
{
if
(!
Constants
.
PENDING_REVIEW
.
equals
(
dxDocumentVO
.
getState
()))
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,删除IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的状态是未完成且审阅状态是"
+
getStateValue
(
dxDocumentVO
.
getState
())+
"不能删除!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,删除IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的状态是未完成且审阅状态是"
+
getStateValue
(
dxDocumentVO
.
getState
())
+
"不能删除!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
}
}
}
}
}
else
{
//更新时校验
}
else
{
//更新时校验
ExtIEDPlanVO
iedPlan
=
getIEDPlanByFileNumberAndDeleted
(
extIEDPlanExcelVO
.
getFileNumber
(),
false
);
ExtIEDPlanVO
iedPlan
=
getIEDPlanByFileNumberAndDeleted
(
extIEDPlanExcelVO
.
getFileNumber
(),
false
);
//如果未查看计划信息,证明更新时的编码不存在,不能更新
//如果未查看计划信息,证明更新时的编码不存在,不能更新
if
(
ObjectUtils
.
isEmpty
(
iedPlan
))
{
if
(
ObjectUtils
.
isEmpty
(
iedPlan
))
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,更新IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"未查到相关信息,更新失败!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,更新IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"未查到相关信息,更新失败!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
return
;
return
;
}
}
//校验该计划是否被删除
//校验该计划是否被删除
ExtIEDPlanVO
extIEDPlanVO
=
getIEDPlanByFileNumberAndDeleted
(
extIEDPlanExcelVO
.
getFileNumber
(),
true
);
ExtIEDPlanVO
extIEDPlanVO
=
getIEDPlanByFileNumberAndDeleted
(
extIEDPlanExcelVO
.
getFileNumber
(),
true
);
if
(!
ObjectUtils
.
isEmpty
(
extIEDPlanVO
)
&&
1
==
extIEDPlanVO
.
getDeleted
())
{
if
(!
ObjectUtils
.
isEmpty
(
extIEDPlanVO
)
&&
1
==
extIEDPlanVO
.
getDeleted
())
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,更新IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"已被删除,更新或删除失败!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,更新IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"已被删除,更新或删除失败!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
}
}
//已完成的计划不能被更新
//已完成的计划不能被更新
if
(!
ObjectUtils
.
isEmpty
(
iedPlan
)
&&
Constants
.
COMPLETE
.
equals
(
iedPlan
.
getState
()))
{
if
(!
ObjectUtils
.
isEmpty
(
iedPlan
)
&&
Constants
.
COMPLETE
.
equals
(
iedPlan
.
getState
()))
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,更新IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"已完成的计划不能更新!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,更新IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"已完成的计划不能更新!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
}
}
//如果更新时,计划是未完成状态且不是待审阅状态时,不允许更新
//如果更新时,计划是未完成状态且不是待审阅状态时,不允许更新
if
(
Constants
.
UNFINISHED
.
equals
(
iedPlan
.
getState
())
)
{
if
(
Constants
.
UNFINISHED
.
equals
(
iedPlan
.
getState
()))
{
DxDocumentVO
dxDocumentVO
=
getDocmentVoByPlanId
(
iedPlan
.
getId
());
DxDocumentVO
dxDocumentVO
=
getDocmentVoByPlanId
(
iedPlan
.
getId
());
if
(!
Constants
.
PENDING_REVIEW
.
equals
(
dxDocumentVO
.
getState
()))
{
if
(!
Constants
.
PENDING_REVIEW
.
equals
(
dxDocumentVO
.
getState
()))
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,更新IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的状态是未完成且审阅状态是"
+
getStateValue
(
dxDocumentVO
.
getState
())+
",不能更新!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行,更新IED计划的文件编号:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的状态是未完成且审阅状态是"
+
getStateValue
(
dxDocumentVO
.
getState
())
+
",不能更新!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
}
}
}
}
...
@@ -249,7 +243,7 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
...
@@ -249,7 +243,7 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
}
}
}
else
{
}
else
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
",文件编号、操作符均不能为空!!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
",文件编号、操作符均不能为空!!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
}
}
...
@@ -257,7 +251,6 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
...
@@ -257,7 +251,6 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
}
}
/**
/**
* 转换数据,将EXCEL对象转换为PO对象
* 转换数据,将EXCEL对象转换为PO对象
*/
*/
...
@@ -270,26 +263,26 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
...
@@ -270,26 +263,26 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
extIEDPlanVO
.
setSystemNumber
(
extIEDPlanExcelVO
.
getSystemNumber
());
extIEDPlanVO
.
setSystemNumber
(
extIEDPlanExcelVO
.
getSystemNumber
());
extIEDPlanVO
.
setDeviceNumber
(
extIEDPlanExcelVO
.
getDeviceNumber
());
extIEDPlanVO
.
setDeviceNumber
(
extIEDPlanExcelVO
.
getDeviceNumber
());
extIEDPlanVO
.
setPhase
(
extIEDPlanExcelVO
.
getPhase
());
extIEDPlanVO
.
setPhase
(
extIEDPlanExcelVO
.
getPhase
());
if
(!
ObjectUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getAuditTime
()))
{
if
(!
ObjectUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getAuditTime
()))
{
try
{
try
{
LocalDateTime
auditTime
=
LocalDateTime
.
of
(
LocalDate
.
parse
(
extIEDPlanExcelVO
.
getAuditTime
(),
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
)),
LocalTime
.
MIDNIGHT
);
LocalDateTime
auditTime
=
LocalDateTime
.
of
(
LocalDate
.
parse
(
extIEDPlanExcelVO
.
getAuditTime
(),
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
)),
LocalTime
.
MIDNIGHT
);
extIEDPlanVO
.
setAuditTime
(
auditTime
);
extIEDPlanVO
.
setAuditTime
(
auditTime
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
DxBusinessException
(
"-1"
,
"审核时间格式不正确!"
);
throw
new
DxBusinessException
(
"-1"
,
"审核时间格式不正确!"
);
}
}
}
}
if
(!
ObjectUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getFileSubmitTime
()))
{
if
(!
ObjectUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getFileSubmitTime
()))
{
try
{
try
{
LocalDateTime
submitTime
=
LocalDateTime
.
of
(
LocalDate
.
parse
(
extIEDPlanExcelVO
.
getFileSubmitTime
(),
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
)),
LocalTime
.
MIDNIGHT
);
LocalDateTime
submitTime
=
LocalDateTime
.
of
(
LocalDate
.
parse
(
extIEDPlanExcelVO
.
getFileSubmitTime
(),
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
)),
LocalTime
.
MIDNIGHT
);
extIEDPlanVO
.
setFileSubmitTime
(
submitTime
);
extIEDPlanVO
.
setFileSubmitTime
(
submitTime
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
DxBusinessException
(
"-1"
,
"文件提交时间格式不正确!"
);
throw
new
DxBusinessException
(
"-1"
,
"文件提交时间格式不正确!"
);
}
}
}
}
extIEDPlanVO
.
setEditor
(
extIEDPlanExcelVO
.
getEditor
());
extIEDPlanVO
.
setEditor
(
extIEDPlanExcelVO
.
getEditor
());
Map
<
String
,
Object
>
dynamicAttrs
=
new
HashMap
<>();
Map
<
String
,
Object
>
dynamicAttrs
=
new
HashMap
<>();
dynamicAttrs
.
put
(
"editorName"
,
userUtils
.
getUserById
(
Long
.
valueOf
(
extIEDPlanExcelVO
.
getEditor
())).
getName
());
dynamicAttrs
.
put
(
"editorName"
,
userUtils
.
getUserById
(
Long
.
valueOf
(
extIEDPlanExcelVO
.
getEditor
())).
getName
());
extIEDPlanVO
.
setDynamicAttrs
(
dynamicAttrs
);
extIEDPlanVO
.
setDynamicAttrs
(
dynamicAttrs
);
extIEDPlanVO
.
setChecker
(
extIEDPlanExcelVO
.
getChecker
());
extIEDPlanVO
.
setChecker
(
extIEDPlanExcelVO
.
getChecker
());
...
@@ -308,8 +301,8 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
...
@@ -308,8 +301,8 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
public
ExtIEDPlanVO
getIEDPlanByFileNumber
(
String
fileNumber
)
{
public
ExtIEDPlanVO
getIEDPlanByFileNumber
(
String
fileNumber
)
{
SearchItems
iedPlanSearch
=
new
SearchItems
();
SearchItems
iedPlanSearch
=
new
SearchItems
();
SearchItem
fileNumberFilter
=
new
SearchItem
(
"fileNumber"
,
SearchItem
.
Operator
.
EQ
,
fileNumber
,
(
Object
)
null
);
SearchItem
fileNumberFilter
=
new
SearchItem
(
"fileNumber"
,
SearchItem
.
Operator
.
EQ
,
fileNumber
,
(
Object
)
null
);
SearchItem
projectIdFilter
=
new
SearchItem
(
"dxContextId"
,
SearchItem
.
Operator
.
EQ
,
projectId
,
(
Object
)
null
);
SearchItem
projectIdFilter
=
new
SearchItem
(
"dxContextId"
,
SearchItem
.
Operator
.
EQ
,
projectId
,
(
Object
)
null
);
iedPlanSearch
.
addItem
(
fileNumberFilter
);
iedPlanSearch
.
addItem
(
fileNumberFilter
);
iedPlanSearch
.
addItem
(
projectIdFilter
);
iedPlanSearch
.
addItem
(
projectIdFilter
);
SearchQueryCondition
searchQuery
=
SearchQueryCondition
.
builder
().
searchItems
(
iedPlanSearch
).
build
();
SearchQueryCondition
searchQuery
=
SearchQueryCondition
.
builder
().
searchItems
(
iedPlanSearch
).
build
();
...
@@ -328,23 +321,24 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
...
@@ -328,23 +321,24 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
/**
/**
* 查询系统中文件编码、文件代号、管理系统编码是否存在,保证数据在数据库中是唯一。
* 查询系统中文件编码、文件代号、管理系统编码是否存在,保证数据在数据库中是唯一。
*
* @param fileNumber
* @param fileNumber
* @param fileCode
* @param fileCode
* @param systemNumber
* @param systemNumber
* @return
* @return
*/
*/
public
ExtIEDPlanVO
getIEDPlanByFileNumberAndFileCodeAndSystemNumber
(
String
fileNumber
,
String
fileCode
,
String
systemNumber
)
{
public
ExtIEDPlanVO
getIEDPlanByFileNumberAndFileCodeAndSystemNumber
(
String
fileNumber
,
String
fileCode
,
String
systemNumber
)
{
SearchQueryCondition
searchQuery
=
SearchQueryCondition
.
builder
().
SearchQueryCondition
searchQuery
=
SearchQueryCondition
.
builder
().
searchItems
(
SearchItems
.
builder
().
child
(
searchItems
(
SearchItems
.
builder
().
child
(
SearchItems
.
builder
()
SearchItems
.
builder
()
.
item
(
new
SearchItem
(
"fileNumber"
,
SearchItem
.
Operator
.
EQ
,
fileNumber
,
(
Object
)
null
))
.
item
(
new
SearchItem
(
"fileNumber"
,
SearchItem
.
Operator
.
EQ
,
fileNumber
,
(
Object
)
null
))
.
item
(
new
SearchItem
(
"fileCode"
,
SearchItem
.
Operator
.
EQ
,
fileCode
,
(
Object
)
null
))
.
item
(
new
SearchItem
(
"fileCode"
,
SearchItem
.
Operator
.
EQ
,
fileCode
,
(
Object
)
null
))
.
item
(
new
SearchItem
(
"systemNumber"
,
SearchItem
.
Operator
.
EQ
,
systemNumber
,
(
Object
)
null
))
.
item
(
new
SearchItem
(
"systemNumber"
,
SearchItem
.
Operator
.
EQ
,
systemNumber
,
(
Object
)
null
))
.
operator
(
SearchItems
.
BooleanOperator
.
OR
).
build
())
.
operator
(
SearchItems
.
BooleanOperator
.
OR
).
build
())
.
item
(
new
SearchItem
(
"dxContextId"
,
SearchItem
.
Operator
.
EQ
,
projectId
,
(
Object
)
null
))
.
item
(
new
SearchItem
(
"dxContextId"
,
SearchItem
.
Operator
.
EQ
,
projectId
,
(
Object
)
null
))
.
item
(
new
SearchItem
(
"deleted"
,
SearchItem
.
Operator
.
EQ
,
false
,
(
Object
)
null
))
.
item
(
new
SearchItem
(
"deleted"
,
SearchItem
.
Operator
.
EQ
,
false
,
(
Object
)
null
))
.
operator
(
SearchItems
.
BooleanOperator
.
AND
)
.
operator
(
SearchItems
.
BooleanOperator
.
AND
)
.
build
()
.
build
()
...
@@ -364,16 +358,17 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
...
@@ -364,16 +358,17 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
/**
/**
* 根据fileNumber查询已经删除的计划
* 根据fileNumber查询已经删除的计划
*
* @param fileNumber
* @param fileNumber
* @return
* @return
*/
*/
private
ExtIEDPlanVO
getIEDPlanByFileNumberAndDeleted
(
String
fileNumber
,
Boolean
deleted
)
{
private
ExtIEDPlanVO
getIEDPlanByFileNumberAndDeleted
(
String
fileNumber
,
Boolean
deleted
)
{
SearchQueryCondition
condition
=
SearchQueryCondition
.
builder
()
SearchQueryCondition
condition
=
SearchQueryCondition
.
builder
()
.
searchItems
(
SearchItems
.
builder
()
.
searchItems
(
SearchItems
.
builder
()
.
item
(
new
SearchItem
(
"fileNumber"
,
SearchItem
.
Operator
.
EQ
,
fileNumber
,
null
))
.
item
(
new
SearchItem
(
"fileNumber"
,
SearchItem
.
Operator
.
EQ
,
fileNumber
,
null
))
.
item
(
new
SearchItem
(
"deleted"
,
SearchItem
.
Operator
.
EQ
,
deleted
,
null
))
.
item
(
new
SearchItem
(
"deleted"
,
SearchItem
.
Operator
.
EQ
,
deleted
,
null
))
.
item
(
new
SearchItem
(
"dxContextId"
,
SearchItem
.
Operator
.
EQ
,
projectId
,
(
Object
)
null
))
.
item
(
new
SearchItem
(
"dxContextId"
,
SearchItem
.
Operator
.
EQ
,
projectId
,
(
Object
)
null
))
.
build
())
.
build
())
.
build
();
.
build
();
...
@@ -387,31 +382,34 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
...
@@ -387,31 +382,34 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
}
}
return
null
;
return
null
;
}
}
public
DxDocumentVO
getDocmentVoByPlanId
(
Long
planId
){
DxPageImpl
iedDocLinkPage
=
extIEDPlanDocLinkService
.
findRecursion
(
SearchUtil
.
buildQuery
(
"sourceId"
,
SearchItem
.
Operator
.
EQ
,
planId
));
public
DxDocumentVO
getDocmentVoByPlanId
(
Long
planId
)
{
if
(!
ObjectUtils
.
isEmpty
(
iedDocLinkPage
.
getContent
())){
DxPageImpl
iedDocLinkPage
=
extIEDPlanDocLinkService
.
findRecursion
(
SearchUtil
.
buildQuery
(
"sourceId"
,
SearchItem
.
Operator
.
EQ
,
planId
));
if
(!
ObjectUtils
.
isEmpty
(
iedDocLinkPage
.
getContent
()))
{
ExtIEDPlanDocLinkVO
extIEDPlanDocLink
=
(
ExtIEDPlanDocLinkVO
)
iedDocLinkPage
.
getContent
().
get
(
0
);
ExtIEDPlanDocLinkVO
extIEDPlanDocLink
=
(
ExtIEDPlanDocLinkVO
)
iedDocLinkPage
.
getContent
().
get
(
0
);
DxPageImpl
docPage
=
extDxDocumentServiceFeign
.
findRecursion
(
SearchUtil
.
buildQuery
(
"id"
,
SearchItem
.
Operator
.
EQ
,
extIEDPlanDocLink
.
getTargetId
()));
DxPageImpl
docPage
=
extDxDocumentServiceFeign
.
findRecursion
(
SearchUtil
.
buildQuery
(
"id"
,
SearchItem
.
Operator
.
EQ
,
extIEDPlanDocLink
.
getTargetId
()));
return
(
DxDocumentVO
)
docPage
.
getContent
().
get
(
0
);
return
(
DxDocumentVO
)
docPage
.
getContent
().
get
(
0
);
}
}
return
null
;
return
null
;
}
}
/**
/**
* 状态英文转中文
* 状态英文转中文
*
* @param state
* @param state
* @return
* @return
*/
*/
public
String
getStateValue
(
String
state
){
public
String
getStateValue
(
String
state
)
{
return
CommonUtils
.
searchDictDataValueByDictCode
(
Constants
.
OBJ_STATUS
,
state
);
return
CommonUtils
.
searchDictDataValueByDictCode
(
Constants
.
OBJ_STATUS
,
state
);
}
}
/**
/**
* 更新文档新新
* 更新文档新新
*
* @param extIEDPlanVO
* @param extIEDPlanVO
*/
*/
public
void
updateDxdocumentVO
(
ExtIEDPlanVO
extIEDPlanVO
){
public
void
updateDxdocumentVO
(
ExtIEDPlanVO
extIEDPlanVO
)
{
DxDocumentVO
dxDocumentVO
=
getDocmentVoByPlanId
(
extIEDPlanVO
.
getId
());
DxDocumentVO
dxDocumentVO
=
getDocmentVoByPlanId
(
extIEDPlanVO
.
getId
());
dxDocumentVO
.
setOperator
(
OperatorType
.
MODIFY
);
dxDocumentVO
.
setOperator
(
OperatorType
.
MODIFY
);
//文件编号
//文件编号
...
@@ -432,79 +430,80 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
...
@@ -432,79 +430,80 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
/**
/**
* 校验excel必填字段
* 校验excel必填字段
*
* @param extIEDPlanExcelVO
* @param extIEDPlanExcelVO
* @param errorString
* @param errorString
*/
*/
public
void
verifyExcelRequiredFields
(
ExtIEDPlanExcelVO
extIEDPlanExcelVO
,
StringBuffer
errorString
)
{
public
void
verifyExcelRequiredFields
(
ExtIEDPlanExcelVO
extIEDPlanExcelVO
,
StringBuffer
errorString
)
{
if
(!
operationList
.
contains
(
extIEDPlanExcelVO
.
getOperation
()))
{
if
(!
operationList
.
contains
(
extIEDPlanExcelVO
.
getOperation
()))
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的操作符无法识别!!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的操作符无法识别!!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
return
;
return
;
}
}
//文件代号不能为空
//文件代号不能为空
if
(
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getFileCode
()))
{
if
(
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getFileCode
()))
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的文件代号不能为空!!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的文件代号不能为空!!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
return
;
return
;
}
}
//管理系统编码不能为空
//管理系统编码不能为空
if
(
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getSystemNumber
()))
{
if
(
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getSystemNumber
()))
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的管理信息系统编码不能为空!!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的管理信息系统编码不能为空!!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
return
;
return
;
}
}
//文件提交时间不能为空
//文件提交时间不能为空
if
(
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getFileSubmitTime
()))
{
if
(
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getFileSubmitTime
()))
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的提交时间不能为空!!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的提交时间不能为空!!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
return
;
return
;
}
}
//编写者不能为空
//编写者不能为空
if
(
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getEditor
()))
{
if
(
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getEditor
()))
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的编写者不能为空!!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的编写者不能为空!!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
return
;
return
;
}
else
{
}
else
{
DxUserInfoVO
dxUserInfoVO
=
userUtils
.
getUserByName
(
extIEDPlanExcelVO
.
getEditor
());
DxUserInfoVO
dxUserInfoVO
=
userUtils
.
getUserByName
(
extIEDPlanExcelVO
.
getEditor
());
if
(
ObjectUtils
.
isEmpty
(
dxUserInfoVO
))
{
if
(
ObjectUtils
.
isEmpty
(
dxUserInfoVO
))
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的编写者在系统中未查到!!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的编写者在系统中未查到!!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
return
;
return
;
}
else
{
}
else
{
extIEDPlanExcelVO
.
setEditor
(
String
.
valueOf
(
dxUserInfoVO
.
getId
()));
extIEDPlanExcelVO
.
setEditor
(
String
.
valueOf
(
dxUserInfoVO
.
getId
()));
}
}
}
}
//审核不是空,判断该用户是否存在,存在的话,将用户id保存
//审核不是空,判断该用户是否存在,存在的话,将用户id保存
if
(!
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getAuditor
()))
{
if
(!
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getAuditor
()))
{
DxUserInfoVO
dxUserInfoVO
=
userUtils
.
getUserByName
(
extIEDPlanExcelVO
.
getAuditor
());
DxUserInfoVO
dxUserInfoVO
=
userUtils
.
getUserByName
(
extIEDPlanExcelVO
.
getAuditor
());
if
(
ObjectUtils
.
isEmpty
(
dxUserInfoVO
))
{
if
(
ObjectUtils
.
isEmpty
(
dxUserInfoVO
))
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的审核者在系统中未查到!!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的审核者在系统中未查到!!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
return
;
return
;
}
else
{
}
else
{
extIEDPlanExcelVO
.
setAuditor
(
String
.
valueOf
(
dxUserInfoVO
.
getId
()));
extIEDPlanExcelVO
.
setAuditor
(
String
.
valueOf
(
dxUserInfoVO
.
getId
()));
}
}
}
}
//审定不是空,判断该用户是否存在,存在的话,将用户id保存
//审定不是空,判断该用户是否存在,存在的话,将用户id保存
if
(!
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getInvestigator
()))
{
if
(!
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getInvestigator
()))
{
DxUserInfoVO
dxUserInfoVO
=
userUtils
.
getUserByName
(
extIEDPlanExcelVO
.
getInvestigator
());
DxUserInfoVO
dxUserInfoVO
=
userUtils
.
getUserByName
(
extIEDPlanExcelVO
.
getInvestigator
());
if
(
ObjectUtils
.
isEmpty
(
dxUserInfoVO
))
{
if
(
ObjectUtils
.
isEmpty
(
dxUserInfoVO
))
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的审定者在系统中未查到!!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的审定者在系统中未查到!!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
return
;
return
;
}
else
{
}
else
{
extIEDPlanExcelVO
.
setInvestigator
(
String
.
valueOf
(
dxUserInfoVO
.
getId
()));
extIEDPlanExcelVO
.
setInvestigator
(
String
.
valueOf
(
dxUserInfoVO
.
getId
()));
}
}
}
}
//批准不是空,判断该用户是否存在,存在的话,将用户id保存
//批准不是空,判断该用户是否存在,存在的话,将用户id保存
if
(!
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getRatifier
()))
{
if
(!
StringUtils
.
isEmpty
(
extIEDPlanExcelVO
.
getRatifier
()))
{
DxUserInfoVO
dxUserInfoVO
=
userUtils
.
getUserByName
(
extIEDPlanExcelVO
.
getRatifier
());
DxUserInfoVO
dxUserInfoVO
=
userUtils
.
getUserByName
(
extIEDPlanExcelVO
.
getRatifier
());
if
(
ObjectUtils
.
isEmpty
(
dxUserInfoVO
))
{
if
(
ObjectUtils
.
isEmpty
(
dxUserInfoVO
))
{
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的审定者在系统中未查到!!"
);
errorString
.
append
(
"解析到数据第"
+
excelDataRow
+
"行文件编号为:"
+
extIEDPlanExcelVO
.
getFileNumber
()
+
"的审定者在系统中未查到!!"
);
errorList
.
add
(
errorString
);
errorList
.
add
(
errorString
);
return
;
return
;
}
else
{
}
else
{
extIEDPlanExcelVO
.
setRatifier
(
String
.
valueOf
(
dxUserInfoVO
.
getId
()));
extIEDPlanExcelVO
.
setRatifier
(
String
.
valueOf
(
dxUserInfoVO
.
getId
()));
}
}
}
}
...
...
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/DxMessageService.java
View file @
505a08da
...
@@ -2,7 +2,6 @@ package com.yonde.dcs.plan.core.service;
...
@@ -2,7 +2,6 @@ package com.yonde.dcs.plan.core.service;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.document.feign.expand.ExtDxDocumentServiceFeign
;
public
interface
DxMessageService
{
public
interface
DxMessageService
{
DxDocumentVO
designDocumentsMessage
();
DxDocumentVO
designDocumentsMessage
();
...
...
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/impl/ExtICMExternalInterfacePlanServiceImpl.java
View file @
505a08da
...
@@ -4,16 +4,17 @@ import cn.hutool.core.bean.BeanUtil;
...
@@ -4,16 +4,17 @@ import cn.hutool.core.bean.BeanUtil;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.io.FileUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy
;
import
com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy
;
import
com.inet.dcs.document.feign.expand.ExtDxDocumentServiceFeign
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.document.feign.expand.ExtDxDocumentServiceFeign
;
import
com.yonde.dcs.plan.common.constants.Constants
;
import
com.yonde.dcs.plan.common.constants.Constants
;
import
com.yonde.dcs.plan.common.vo.ExtICMExternalInterfacePlanVO
;
import
com.yonde.dcs.plan.common.vo.ExtICMPlanExcelVO
;
import
com.yonde.dcs.plan.common.vo.ExtICMPlanExcelVO
;
import
com.yonde.dcs.plan.core.listener.ICMPlanExcelListenner
;
import
com.yonde.dcs.plan.core.listener.ICMPlanExcelListenner
;
import
com.yonde.dcs.plan.core.repository.ExtICMExternalInterfacePlanRepository
;
import
com.yonde.dcs.plan.core.service.ExtICMExternalInterfacePlanService
;
import
com.yonde.dcs.plan.core.util.FileUtils
;
import
com.yonde.dcs.plan.core.util.FileUtils
;
import
com.yonde.dcs.plan.core.util.ResourceHelper
;
import
com.yonde.dcs.plan.core.util.ResourceHelper
;
import
com.yonde.dcs.plan.entity.po.ExtICMExternalInterfacePlan
;
import
com.yonde.dex.basedata.data.search.SearchItem
;
import
com.yonde.dex.basedata.data.search.SearchItem
;
import
com.yonde.dex.basedata.data.search.SearchItems
;
import
com.yonde.dex.basedata.data.search.SearchItems
;
import
com.yonde.dex.basedata.data.search.SearchQueryCondition
;
import
com.yonde.dex.basedata.data.search.SearchQueryCondition
;
...
@@ -21,38 +22,28 @@ import com.yonde.dex.basedata.entity.api.ApiResult;
...
@@ -21,38 +22,28 @@ import com.yonde.dex.basedata.entity.api.ApiResult;
import
com.yonde.dex.basedata.entity.api.CustomMultipartFile
;
import
com.yonde.dex.basedata.entity.api.CustomMultipartFile
;
import
com.yonde.dex.basedata.entity.data.DxPageImpl
;
import
com.yonde.dex.basedata.entity.data.DxPageImpl
;
import
com.yonde.dex.basedata.exception.DxBusinessException
;
import
com.yonde.dex.basedata.exception.DxBusinessException
;
import
com.yonde.dex.dao.business.events.DaoPluginBusinessEvent
;
import
com.yonde.dex.dfs.feign.FileManagerFeignService
;
import
com.yonde.dex.dfs.feign.FileManagerFeignService
;
import
com.yonde.dex.systemfile.feign.SystemFileFeignService
;
import
com.yonde.dex.systemfile.feign.SystemFileFeignService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.util.ObjectUtils
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
com.yonde.dcs.plan.common.vo.ExtICMExternalInterfacePlanVO
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
import
com.yonde.dcs.plan.core.service.ExtICMExternalInterfacePlanService
;
import
com.yonde.dcs.plan.core.repository.ExtICMExternalInterfacePlanRepository
;
import
com.yonde.dcs.plan.entity.po.ExtICMExternalInterfacePlan
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
/**
/**
* @description: ExtICMExternalInterfacePlan-ServiceImpl
* @description: ExtICMExternalInterfacePlan-ServiceImpl
* @author: dexadmin
* @author: dexadmin
* @version: V
* @version: V
* @date: 2024-9-14 10:04:10
* @date: 2024-9-14 10:04:10
**/
**/
@Slf4j
@Slf4j
@Service
(
ExtICMExternalInterfacePlanServiceImpl
.
BEAN_NAME
)
@Service
(
ExtICMExternalInterfacePlanServiceImpl
.
BEAN_NAME
)
public
class
ExtICMExternalInterfacePlanServiceImpl
<
V
extends
ExtICMExternalInterfacePlanVO
>
implements
ExtICMExternalInterfacePlanService
<
V
>
{
public
class
ExtICMExternalInterfacePlanServiceImpl
<
V
extends
ExtICMExternalInterfacePlanVO
>
implements
ExtICMExternalInterfacePlanService
<
V
>
{
...
@@ -132,12 +123,11 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte
...
@@ -132,12 +123,11 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte
}
}
private
List
<
ExtICMPlanExcelVO
>
transformationObject
(
List
<
V
>
extICMPlanList
)
{
private
List
<
ExtICMPlanExcelVO
>
transformationObject
(
List
<
V
>
extICMPlanList
)
{
List
<
ExtICMPlanExcelVO
>
extICMPlanExcelVOList
=
new
ArrayList
<>();
List
<
ExtICMPlanExcelVO
>
extICMPlanExcelVOList
=
new
ArrayList
<>();
for
(
ExtICMExternalInterfacePlanVO
extICMPlanVO
:
extICMPlanList
)
{
for
(
ExtICMExternalInterfacePlanVO
extICMPlanVO
:
extICMPlanList
)
{
ExtICMPlanExcelVO
extICMPlanExcelVO
=
new
ExtICMPlanExcelVO
();
ExtICMPlanExcelVO
extICMPlanExcelVO
=
new
ExtICMPlanExcelVO
();
BeanUtil
.
copyProperties
(
extICMPlanVO
,
extICMPlanExcelVO
);
BeanUtil
.
copyProperties
(
extICMPlanVO
,
extICMPlanExcelVO
);
extICMPlanExcelVOList
.
add
(
extICMPlanExcelVO
);
extICMPlanExcelVOList
.
add
(
extICMPlanExcelVO
);
}
}
return
extICMPlanExcelVOList
;
return
extICMPlanExcelVOList
;
...
@@ -149,7 +139,7 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte
...
@@ -149,7 +139,7 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte
CustomMultipartFile
multipartFile
=
null
;
CustomMultipartFile
multipartFile
=
null
;
Long
fileId
=
null
;
Long
fileId
=
null
;
DxDocumentVO
dxDocumentVO
=
docCenterFeignService
.
getDocumentWithFiles
(
id
);
DxDocumentVO
dxDocumentVO
=
docCenterFeignService
.
getDocumentWithFiles
(
id
);
if
(!
ObjectUtils
.
isEmpty
(
dxDocumentVO
))
{
if
(!
ObjectUtils
.
isEmpty
(
dxDocumentVO
))
{
try
{
try
{
//todo 取固定类型附件
//todo 取固定类型附件
fileId
=
dxDocumentVO
.
getObjFileLinks
().
get
(
0
).
getTarget
().
getId
();
fileId
=
dxDocumentVO
.
getObjFileLinks
().
get
(
0
).
getTarget
().
getId
();
...
@@ -160,12 +150,12 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte
...
@@ -160,12 +150,12 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte
}
}
try
{
try
{
inputStream
=
new
ByteArrayInputStream
(
multipartFile
.
getBytes
());
inputStream
=
new
ByteArrayInputStream
(
multipartFile
.
getBytes
());
importICMPlan
(
inputStream
,
dxDocumentVO
.
getDxContextId
().
toString
());
importICMPlan
(
inputStream
,
dxDocumentVO
.
getDxContextId
().
toString
());
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
log
.
info
(
"[自动导入ICM计划] >>> 文件服务下载的文件:{}--转换为输入流失败!"
,
fileId
);
log
.
info
(
"[自动导入ICM计划] >>> 文件服务下载的文件:{}--转换为输入流失败!"
,
fileId
);
throw
new
DxBusinessException
(
"500"
,
"文件服务下载的文件转换为输入流失败:"
+
fileId
);
throw
new
DxBusinessException
(
"500"
,
"文件服务下载的文件转换为输入流失败:"
+
fileId
);
}
}
}
else
{
}
else
{
log
.
info
(
"根据计划文档id:"
+
id
+
"未查到相关数据"
);
log
.
info
(
"根据计划文档id:"
+
id
+
"未查到相关数据"
);
}
}
...
...
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/impl/ExtIEDPlanServiceImpl.java
View file @
505a08da
...
@@ -5,9 +5,9 @@ import cn.hutool.core.util.ObjectUtil;
...
@@ -5,9 +5,9 @@ import cn.hutool.core.util.ObjectUtil;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.util.StringUtils
;
import
com.alibaba.excel.util.StringUtils
;
import
com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy
;
import
com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy
;
import
com.inet.dcs.document.feign.expand.ExtDxDocumentServiceFeign
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.document.expand.entity.DxDocumentVOExpand
;
import
com.yonde.dcs.document.expand.entity.DxDocumentVOExpand
;
import
com.yonde.dcs.document.feign.expand.ExtDxDocumentServiceFeign
;
import
com.yonde.dcs.plan.common.constants.Constants
;
import
com.yonde.dcs.plan.common.constants.Constants
;
import
com.yonde.dcs.plan.common.vo.ExtIEDPlanDocLinkVO
;
import
com.yonde.dcs.plan.common.vo.ExtIEDPlanDocLinkVO
;
import
com.yonde.dcs.plan.common.vo.ExtIEDPlanExcelVO
;
import
com.yonde.dcs.plan.common.vo.ExtIEDPlanExcelVO
;
...
@@ -146,10 +146,10 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
...
@@ -146,10 +146,10 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
extIEDPlanExcelVO
.
setSystemNumber
(
extIEDPlanVO
.
getSystemNumber
());
extIEDPlanExcelVO
.
setSystemNumber
(
extIEDPlanVO
.
getSystemNumber
());
extIEDPlanExcelVO
.
setDeviceNumber
(
extIEDPlanVO
.
getDeviceNumber
());
extIEDPlanExcelVO
.
setDeviceNumber
(
extIEDPlanVO
.
getDeviceNumber
());
extIEDPlanExcelVO
.
setPhase
(
extIEDPlanVO
.
getPhase
());
extIEDPlanExcelVO
.
setPhase
(
extIEDPlanVO
.
getPhase
());
if
(!
ObjectUtil
.
isEmpty
(
extIEDPlanVO
.
getAuditTime
()))
{
if
(!
ObjectUtil
.
isEmpty
(
extIEDPlanVO
.
getAuditTime
()))
{
extIEDPlanExcelVO
.
setAuditTime
(
extIEDPlanVO
.
getAuditTime
().
format
(
DateTimeFormatter
.
ISO_DATE
));
extIEDPlanExcelVO
.
setAuditTime
(
extIEDPlanVO
.
getAuditTime
().
format
(
DateTimeFormatter
.
ISO_DATE
));
}
}
if
(!
ObjectUtil
.
isEmpty
(
extIEDPlanVO
.
getFileSubmitTime
()))
{
if
(!
ObjectUtil
.
isEmpty
(
extIEDPlanVO
.
getFileSubmitTime
()))
{
extIEDPlanExcelVO
.
setFileSubmitTime
(
extIEDPlanVO
.
getFileSubmitTime
().
format
(
DateTimeFormatter
.
ISO_DATE
));
extIEDPlanExcelVO
.
setFileSubmitTime
(
extIEDPlanVO
.
getFileSubmitTime
().
format
(
DateTimeFormatter
.
ISO_DATE
));
}
}
extIEDPlanExcelVO
.
setEditor
(
extIEDPlanVO
.
getEditor
());
extIEDPlanExcelVO
.
setEditor
(
extIEDPlanVO
.
getEditor
());
...
...
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/impl/ExtPlanServiceImpl.java
View file @
505a08da
...
@@ -4,9 +4,9 @@ import cn.hutool.core.collection.CollectionUtil;
...
@@ -4,9 +4,9 @@ import cn.hutool.core.collection.CollectionUtil;
import
cn.hutool.poi.excel.ExcelReader
;
import
cn.hutool.poi.excel.ExcelReader
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
cn.hutool.poi.excel.ExcelWriter
;
import
cn.hutool.poi.excel.ExcelWriter
;
import
com.inet.dcs.document.feign.expand.ExtDxDocumentServiceFeign
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.document.expand.entity.DxDocumentVOExpand
;
import
com.yonde.dcs.document.expand.entity.DxDocumentVOExpand
;
import
com.yonde.dcs.document.feign.expand.ExtDxDocumentServiceFeign
;
import
com.yonde.dcs.plan.common.constants.Constants
;
import
com.yonde.dcs.plan.common.constants.Constants
;
import
com.yonde.dcs.plan.common.utils.ExcelUtils
;
import
com.yonde.dcs.plan.common.utils.ExcelUtils
;
import
com.yonde.dcs.plan.common.utils.FileUtils
;
import
com.yonde.dcs.plan.common.utils.FileUtils
;
...
...
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/impl/ExtPuchasePlanAttributeServiceImpl.java
View file @
505a08da
...
@@ -3,14 +3,18 @@ package com.yonde.dcs.plan.core.service.impl;
...
@@ -3,14 +3,18 @@ package com.yonde.dcs.plan.core.service.impl;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.io.FileUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy
;
import
com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy
;
import
com.inet.dcs.document.feign.expand.ExtDxDocumentServiceFeign
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.document.feign.expand.ExtDxDocumentServiceFeign
;
import
com.yonde.dcs.plan.common.constants.Constants
;
import
com.yonde.dcs.plan.common.constants.Constants
;
import
com.yonde.dcs.plan.common.vo.ExtPuchasePlanAttributeVO
;
import
com.yonde.dcs.plan.common.vo.ExtPuchasePlanExcelVO
;
import
com.yonde.dcs.plan.common.vo.ExtPuchasePlanExcelVO
;
import
com.yonde.dcs.plan.core.listener.PurchasePlanExcelReadListenner
;
import
com.yonde.dcs.plan.core.listener.PurchasePlanExcelReadListenner
;
import
com.yonde.dcs.plan.core.repository.ExtPuchasePlanAttributeRepository
;
import
com.yonde.dcs.plan.core.service.ExtPuchasePlanAttributeService
;
import
com.yonde.dcs.plan.core.util.CommonUtils
;
import
com.yonde.dcs.plan.core.util.CommonUtils
;
import
com.yonde.dcs.plan.core.util.FileUtils
;
import
com.yonde.dcs.plan.core.util.FileUtils
;
import
com.yonde.dcs.plan.core.util.ResourceHelper
;
import
com.yonde.dcs.plan.core.util.ResourceHelper
;
import
com.yonde.dcs.plan.entity.po.ExtPuchasePlanAttribute
;
import
com.yonde.dex.basedata.data.search.SearchItem
;
import
com.yonde.dex.basedata.data.search.SearchItem
;
import
com.yonde.dex.basedata.data.search.SearchItems
;
import
com.yonde.dex.basedata.data.search.SearchItems
;
import
com.yonde.dex.basedata.data.search.SearchQueryCondition
;
import
com.yonde.dex.basedata.data.search.SearchQueryCondition
;
...
@@ -21,26 +25,19 @@ import com.yonde.dex.basedata.exception.DxBusinessException;
...
@@ -21,26 +25,19 @@ import com.yonde.dex.basedata.exception.DxBusinessException;
import
com.yonde.dex.dfs.feign.FileManagerFeignService
;
import
com.yonde.dex.dfs.feign.FileManagerFeignService
;
import
com.yonde.dex.dfs.feign.RepoFileFeignService
;
import
com.yonde.dex.dfs.feign.RepoFileFeignService
;
import
com.yonde.dex.systemfile.feign.SystemFileFeignService
;
import
com.yonde.dex.systemfile.feign.SystemFileFeignService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.stereotype.Service
;
import
io.swagger.annotations.ApiOperation
;
import
java.io.*
;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.yonde.dcs.plan.common.vo.ExtPuchasePlanAttributeVO
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
com.yonde.dcs.plan.core.service.ExtPuchasePlanAttributeService
;
import
com.yonde.dcs.plan.core.repository.ExtPuchasePlanAttributeRepository
;
import
com.yonde.dcs.plan.entity.po.ExtPuchasePlanAttribute
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.ByteArrayInputStream
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
/**
* @description: ExtPuchasePlanAttribute-ServiceImpl
* @description: ExtPuchasePlanAttribute-ServiceImpl
...
@@ -68,7 +65,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
...
@@ -68,7 +65,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
@Override
@Override
public
String
importPurchasePlan
(
InputStream
inputStream
,
String
projectId
)
{
public
String
importPurchasePlan
(
InputStream
inputStream
,
String
projectId
)
{
EasyExcel
.
read
(
inputStream
,
ExtPuchasePlanExcelVO
.
class
,
EasyExcel
.
read
(
inputStream
,
ExtPuchasePlanExcelVO
.
class
,
new
PurchasePlanExcelReadListenner
(
projectId
))
new
PurchasePlanExcelReadListenner
(
projectId
))
.
sheet
()
.
sheet
()
...
@@ -108,7 +105,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
...
@@ -108,7 +105,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
throw
new
DxBusinessException
(
"500"
,
"文件服务下载的文件转换为输入流失败:"
+
fileId
);
throw
new
DxBusinessException
(
"500"
,
"文件服务下载的文件转换为输入流失败:"
+
fileId
);
}
}
String
dir
=
ResourceHelper
.
CreateTemDir
().
getPath
();
String
dir
=
ResourceHelper
.
CreateTemDir
().
getPath
();
String
filePath
=
dir
+
Constants
.
PURCHASE_PLAN_EXCEL_NAME
;
String
filePath
=
dir
+
Constants
.
PURCHASE_PLAN_EXCEL_NAME
;
//创建采购计划列表.xlsx 文件
//创建采购计划列表.xlsx 文件
FileUtils
.
inputToFile
(
inputStream
,
filePath
);
FileUtils
.
inputToFile
(
inputStream
,
filePath
);
//向表格中写入数据
//向表格中写入数据
...
@@ -129,7 +126,8 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
...
@@ -129,7 +126,8 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
/**
/**
* 计划文件签审通过之后,调用该方法,自动导入计划
* 计划文件签审通过之后,调用该方法,自动导入计划
* @param id 文档id
*
* @param id 文档id
* @return
* @return
*/
*/
@Override
@Override
...
@@ -139,7 +137,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
...
@@ -139,7 +137,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
CustomMultipartFile
multipartFile
=
null
;
CustomMultipartFile
multipartFile
=
null
;
Long
fileId
=
null
;
Long
fileId
=
null
;
DxDocumentVO
dxDocumentVO
=
docCenterFeignService
.
getDocumentWithFiles
(
id
);
DxDocumentVO
dxDocumentVO
=
docCenterFeignService
.
getDocumentWithFiles
(
id
);
if
(!
ObjectUtils
.
isEmpty
(
dxDocumentVO
))
{
if
(!
ObjectUtils
.
isEmpty
(
dxDocumentVO
))
{
try
{
try
{
//todo 取固定类型附件
//todo 取固定类型附件
fileId
=
dxDocumentVO
.
getObjFileLinks
().
get
(
0
).
getTarget
().
getId
();
fileId
=
dxDocumentVO
.
getObjFileLinks
().
get
(
0
).
getTarget
().
getId
();
...
@@ -150,12 +148,12 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
...
@@ -150,12 +148,12 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
}
}
try
{
try
{
inputStream
=
new
ByteArrayInputStream
(
multipartFile
.
getBytes
());
inputStream
=
new
ByteArrayInputStream
(
multipartFile
.
getBytes
());
importPurchasePlan
(
inputStream
,
dxDocumentVO
.
getDxContextId
().
toString
());
importPurchasePlan
(
inputStream
,
dxDocumentVO
.
getDxContextId
().
toString
());
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
log
.
info
(
"[自动导入采购计划] >>> 文件服务下载的文件:{}--转换为输入流失败!"
,
fileId
);
log
.
info
(
"[自动导入采购计划] >>> 文件服务下载的文件:{}--转换为输入流失败!"
,
fileId
);
throw
new
DxBusinessException
(
"500"
,
"文件服务下载的文件转换为输入流失败:"
+
fileId
);
throw
new
DxBusinessException
(
"500"
,
"文件服务下载的文件转换为输入流失败:"
+
fileId
);
}
}
}
else
{
}
else
{
log
.
info
(
"根据计划文档id:"
+
id
+
"未查到相关数据"
);
log
.
info
(
"根据计划文档id:"
+
id
+
"未查到相关数据"
);
}
}
...
@@ -164,6 +162,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
...
@@ -164,6 +162,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
/**
/**
* 数据转换,将PO转换成EXCEL-VO;
* 数据转换,将PO转换成EXCEL-VO;
*
* @param content
* @param content
* @return
* @return
*/
*/
...
...
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