Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-operate-sys-cscec
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
fulixin
dsk-operate-sys-cscec
Commits
5a340148
Commit
5a340148
authored
Sep 14, 2023
by
lcl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
u
parent
447397f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
BusinessInfoServiceImpl.java
...ava/com/dsk/biz/service/impl/BusinessInfoServiceImpl.java
+15
-14
No files found.
dsk-module/dsk-biz-api/src/main/java/com/dsk/biz/service/impl/BusinessInfoServiceImpl.java
View file @
5a340148
...
@@ -190,33 +190,34 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService {
...
@@ -190,33 +190,34 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService {
List
<
String
>
result
=
new
LinkedList
();
//导入结果汇总
List
<
String
>
result
=
new
LinkedList
();
//导入结果汇总
List
<
BusinessExcelDto
>
businessInfoList
=
null
;
List
<
BusinessExcelDto
>
businessInfoList
=
null
;
try
{
try
{
businessInfoList
=
new
ExcelUtils
<>(
BusinessExcelDto
.
class
).
importExcel
(
file
.
getInputStream
(),
2
);
businessInfoList
=
new
ExcelUtils
<>(
BusinessExcelDto
.
class
).
importExcel
(
file
.
getInputStream
(),
2
);
if
(
CollectionUtil
.
isEmpty
(
businessInfoList
))
return
AjaxResult
.
error
(
"文档中无项目信息,请按照模板文档格式上传"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
throw
new
ServiceException
(
"数据导入失败,请检查文档格式是否有误!"
);
}
}
// List<BusinessExcelDto> businessInfoList = readBusinessInfoExcel.getExcelInfo(file);
// List<BusinessExcelDto> businessInfoList = readBusinessInfoExcel.getExcelInfo(file);
if
(
CollectionUtil
.
isEmpty
(
businessInfoList
))
return
AjaxResult
.
error
(
"文档中无项目信息,请按照模板文档格式上传"
);
for
(
BusinessExcelDto
businessInfo
:
businessInfoList
)
{
for
(
BusinessExcelDto
businessInfo
:
businessInfoList
)
{
//查询已有的项目名称
//
//查询已有的项目名称
Integer
count
=
businessInfoMapper
.
isRepetitionProjectName
(
businessInfo
.
getProjectName
(),
userId
,
businessInfo
.
getOwnerCompany
());
//
Integer count = businessInfoMapper.isRepetitionProjectName(businessInfo.getProjectName(), userId, businessInfo.getOwnerCompany());
row
++;
//
row++;
if
(
count
>
0
)
{
//
if (count > 0) {
//如果存在,跳过该项目,不保存
//
//如果存在,跳过该项目,不保存
// result.add("第" + row + "行的" + businessInfo.getProjectName() + "的项目已存在,跳过该项目,保存下一条");
//
//
result.add("第" + row + "行的" + businessInfo.getProjectName() + "的项目已存在,跳过该项目,保存下一条");
log
.
info
(
"第"
+
row
+
"行的"
+
businessInfo
.
getProjectName
()
+
"的项目已存在,跳过该项目,保存下一条"
);
//
log.info("第" + row + "行的" + businessInfo.getProjectName() + "的项目已存在,跳过该项目,保存下一条");
errorCount
++;
//
errorCount++;
}
else
{
//
} else {
//保存到数据库
//保存到数据库
BusinessAddDto
businessAddDto
=
new
BusinessAddDto
();
BusinessAddDto
businessAddDto
=
new
BusinessAddDto
();
BeanUtil
.
copyProperties
(
businessInfo
,
businessAddDto
);
BeanUtil
.
copyProperties
(
businessInfo
,
businessAddDto
);
businessAddDto
.
setUserId
(
userId
);
businessAddDto
.
setUserId
(
userId
);
try
{
try
{
new
BusinessInfoServiceImpl
().
insertBusinessInfo
(
businessAddDto
);
// new BusinessInfoServiceImpl().insertBusinessInfo(businessAddDto);
this
.
insertBusinessInfo
(
businessAddDto
);
rowSuccess
++;
rowSuccess
++;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
errorCount
++;
errorCount
++;
}
}
}
//
}
}
}
result
.
add
(
"导入项目成功条数"
+
rowSuccess
);
result
.
add
(
"导入项目成功条数"
+
rowSuccess
);
result
.
add
(
"导入项目去重条数"
+
errorCount
);
result
.
add
(
"导入项目去重条数"
+
errorCount
);
...
...
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