Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-cr20g
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
Administrator
dsk-cr20g
Commits
6d57b803
Commit
6d57b803
authored
Jun 12, 2023
by
lcl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导入成功数量返回
parent
2cd749ca
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
CustomerController.java
...a/com/dsk/web/controller/customer/CustomerController.java
+6
-2
No files found.
dsk-admin/src/main/java/com/dsk/web/controller/customer/CustomerController.java
View file @
6d57b803
...
@@ -83,7 +83,7 @@ public class CustomerController extends BaseController {
...
@@ -83,7 +83,7 @@ public class CustomerController extends BaseController {
return
AjaxResult
.
success
(
baseService
.
add
(
customer
));
return
AjaxResult
.
success
(
baseService
.
add
(
customer
));
}
}
private
void
dealWithcustomerData
(
Customer
customer
){
private
void
dealWithcustomerData
(
Customer
customer
)
{
if
(
ObjectUtils
.
isEmpty
(
customer
.
getCompanyName
()))
throw
new
BeanException
(
"企业名称不能为空"
);
if
(
ObjectUtils
.
isEmpty
(
customer
.
getCompanyName
()))
throw
new
BeanException
(
"企业名称不能为空"
);
if
(
ObjectUtils
.
isEmpty
(
customer
.
getCompanyId
()))
{
if
(
ObjectUtils
.
isEmpty
(
customer
.
getCompanyId
()))
{
try
{
try
{
...
@@ -131,6 +131,7 @@ public class CustomerController extends BaseController {
...
@@ -131,6 +131,7 @@ public class CustomerController extends BaseController {
public
AjaxResult
importData
(
@RequestPart
(
"file"
)
MultipartFile
file
)
throws
Exception
{
public
AjaxResult
importData
(
@RequestPart
(
"file"
)
MultipartFile
file
)
throws
Exception
{
List
<
Customer
>
customerList
=
new
ExcelUtil
<>(
Customer
.
class
).
importExcel
(
file
.
getInputStream
(),
2
);
List
<
Customer
>
customerList
=
new
ExcelUtil
<>(
Customer
.
class
).
importExcel
(
file
.
getInputStream
(),
2
);
List
<
String
>
resultList
=
new
ArrayList
<>();
List
<
String
>
resultList
=
new
ArrayList
<>();
int
successCount
=
0
;
for
(
Customer
customer
:
customerList
)
{
for
(
Customer
customer
:
customerList
)
{
if
(
ObjectUtils
.
isEmpty
(
customer
.
getCompanyName
()))
{
if
(
ObjectUtils
.
isEmpty
(
customer
.
getCompanyName
()))
{
continue
;
continue
;
...
@@ -152,10 +153,13 @@ public class CustomerController extends BaseController {
...
@@ -152,10 +153,13 @@ public class CustomerController extends BaseController {
customer
.
setCreditCode
(
MapUtil
.
getStr
(
obj
,
"creditCode"
));
customer
.
setCreditCode
(
MapUtil
.
getStr
(
obj
,
"creditCode"
));
}
}
baseService
.
add
(
customer
);
baseService
.
add
(
customer
);
successCount
++;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
resultList
.
add
(
customer
.
getCompanyName
().
concat
(
":"
).
concat
(
e
.
getMessage
()));
resultList
.
add
(
customer
.
getCompanyName
().
concat
(
":"
).
concat
(
e
.
getMessage
()));
}
}
}
}
return
AjaxResult
.
success
(
resultList
);
AjaxResult
success
=
AjaxResult
.
success
(
resultList
);
success
.
put
(
"successCount"
,
successCount
);
return
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