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
369779a7
Commit
369779a7
authored
Oct 22, 2024
by
wangqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
功能开发:ICM导入前数据校验
parent
01b18cac
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
271 additions
and
2 deletions
+271
-2
ExtICMExternalInterfacePlanController.java
...ore/controller/ExtICMExternalInterfacePlanController.java
+16
-0
ICMPlanExcelDataVerifyListenner.java
...s/plan/core/listener/ICMPlanExcelDataVerifyListenner.java
+227
-0
ICMPlanExcelListenner.java
...m/yonde/dcs/plan/core/listener/ICMPlanExcelListenner.java
+3
-2
ExtICMExternalInterfacePlanService.java
...plan/core/service/ExtICMExternalInterfacePlanService.java
+2
-0
ExtICMExternalInterfacePlanServiceImpl.java
.../service/impl/ExtICMExternalInterfacePlanServiceImpl.java
+23
-0
No files found.
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/controller/ExtICMExternalInterfacePlanController.java
View file @
369779a7
...
...
@@ -71,6 +71,22 @@ public class ExtICMExternalInterfacePlanController<V extends ExtICMExternalInter
return
ApiResult
.
ok
(
extICMExternalInterfacePlanService
.
autoImportICMPlan
(
id
),
"ICM计划自动导入成功"
);
}
/**
* 导入ICM计划校验
*
* @param fileId
* @param projectId
* @return
* @throws IOException
*/
@ApiOperation
(
"校验上传的excel中的ICM计划列表是否合法"
)
@PostMapping
(
value
=
"/verifyExcelDataIsValid"
)
public
ApiResult
verifyExcelDataIsValid
(
@RequestParam
(
value
=
"fileId"
,
required
=
true
)
Long
fileId
,
@RequestParam
(
value
=
"projectId"
,
required
=
true
)
String
projectId
)
throws
IOException
{
return
ApiResult
.
ok
(
extICMExternalInterfacePlanService
.
verifyExcelDataIsValid
(
fileId
,
projectId
),
"校验成功!"
);
}
}
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/listener/ICMPlanExcelDataVerifyListenner.java
0 → 100644
View file @
369779a7
This diff is collapsed.
Click to expand it.
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/listener/ICMPlanExcelListenner.java
View file @
369779a7
...
...
@@ -51,7 +51,7 @@ public class ICMPlanExcelListenner extends AnalysisEventListener<ExtICMPlanExcel
/**
* excel数据行数
*/
private
Integer
excelDataRow
=
0
;
private
Integer
excelDataRow
=
2
;
/**
...
...
@@ -78,9 +78,10 @@ public class ICMPlanExcelListenner extends AnalysisEventListener<ExtICMPlanExcel
@Override
public
void
invoke
(
ExtICMPlanExcelVO
extICMPlanExcelVO
,
AnalysisContext
analysisContext
)
{
excelDataRow
++;
//判断是否是空数据行
if
(!
CommonUtils
.
checkAllPropertiesIsEmpty
(
extICMPlanExcelVO
)){
excelDataRow
++;
log
.
info
(
"解析到一条数据:{}"
,
extICMPlanExcelVO
);
//检查excel数据合法性
checkDataForExcel
(
extICMPlanExcelVO
);
...
...
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/ExtICMExternalInterfacePlanService.java
View file @
369779a7
...
...
@@ -22,4 +22,6 @@ public interface ExtICMExternalInterfacePlanService<V extends ExtICMExternalInte
String
exportICMPlan
(
HttpServletResponse
response
,
List
<
String
>
ids
)
throws
IOException
;
String
autoImportICMPlan
(
long
id
);
public
String
verifyExcelDataIsValid
(
Long
fileId
,
String
projectId
);
}
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/impl/ExtICMExternalInterfacePlanServiceImpl.java
View file @
369779a7
...
...
@@ -9,7 +9,10 @@ import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
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.ExtPuchasePlanExcelVO
;
import
com.yonde.dcs.plan.core.listener.ICMPlanExcelDataVerifyListenner
;
import
com.yonde.dcs.plan.core.listener.ICMPlanExcelListenner
;
import
com.yonde.dcs.plan.core.listener.PurchasePlanExcelDataVerifyListenner
;
import
com.yonde.dcs.plan.core.repository.ExtICMExternalInterfacePlanRepository
;
import
com.yonde.dcs.plan.core.service.ExtICMExternalInterfacePlanService
;
import
com.yonde.dcs.plan.core.util.FileUtils
;
...
...
@@ -29,6 +32,7 @@ import org.apache.commons.collections.CollectionUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -164,6 +168,25 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte
return
ApiResult
.
SUCCESS
;
}
@Override
public
String
verifyExcelDataIsValid
(
Long
fileId
,
String
projectId
)
{
MultipartFile
multipartFile
=
null
;
InputStream
inputStream
=
null
;
try
{
multipartFile
=
fileManagerFeignService
.
feignDownloadIO
(
fileId
);
inputStream
=
new
ByteArrayInputStream
(
multipartFile
.
getBytes
());
}
catch
(
IOException
e
)
{
throw
new
DxBusinessException
(
"-1"
,
"文件id:"
+
fileId
+
"在系统中未找到!"
);
}
EasyExcel
.
read
(
inputStream
,
ExtPuchasePlanExcelVO
.
class
,
new
ICMPlanExcelDataVerifyListenner
(
projectId
))
.
sheet
()
.
doRead
();
return
ApiResult
.
SUCCESS
;
}
}
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