Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
manager
Project
Overview
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
reyun
manager
Commits
a8063e31
Commit
a8063e31
authored
Jul 23, 2021
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复收入导出
parent
a337353b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
DmpIncomeServiceImpl.java
src/main/java/common/service/impl/DmpIncomeServiceImpl.java
+16
-13
No files found.
src/main/java/common/service/impl/DmpIncomeServiceImpl.java
View file @
a8063e31
...
@@ -98,7 +98,7 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -98,7 +98,7 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
List
<
Object
[]>
contracts
=
contractRepository
.
findByDmpContractCode
(
codes
);
List
<
Object
[]>
contracts
=
contractRepository
.
findByDmpContractCode
(
codes
);
Map
<
String
,
Object
[]>
names
=
contracts
.
stream
().
collect
(
Collectors
.
toMap
(
v
->
v
[
0
]
+
""
,
v
->
v
,
(
v1
,
v2
)
->
v1
));
Map
<
String
,
Object
[]>
names
=
contracts
.
stream
().
collect
(
Collectors
.
toMap
(
v
->
v
[
0
]
+
""
,
v
->
v
,
(
v1
,
v2
)
->
v1
));
for
(
DmpIncome
dmpIncome
:
dmpIncomes
)
{
for
(
DmpIncome
dmpIncome
:
dmpIncomes
)
{
Object
[]
nameItem
=
names
.
get
(
dmpIncome
.
getC
reateTim
e
());
Object
[]
nameItem
=
names
.
get
(
dmpIncome
.
getC
ontractCod
e
());
//my_body_name, customer_body, customer_short, business_type, agreement_type
//my_body_name, customer_body, customer_short, business_type, agreement_type
if
(
nameItem
!=
null
)
{
if
(
nameItem
!=
null
)
{
dmpIncome
.
setMyBodyName
(
nameItem
[
1
]
+
""
);
dmpIncome
.
setMyBodyName
(
nameItem
[
1
]
+
""
);
...
@@ -115,8 +115,8 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -115,8 +115,8 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
public
HSSFWorkbook
exportIncomeList
(
String
startDate
,
String
endDate
,
String
bodyCode
,
String
serchName
)
{
public
HSSFWorkbook
exportIncomeList
(
String
startDate
,
String
endDate
,
String
bodyCode
,
String
serchName
)
{
List
<
DmpIncome
>
dmpIncomes
=
this
.
listByDs
(
startDate
,
endDate
);
List
<
DmpIncome
>
dmpIncomes
=
this
.
listByDs
(
startDate
,
endDate
);
dmpIncomes
=
dmpIncomes
.
stream
()
dmpIncomes
=
dmpIncomes
.
stream
()
.
filter
(
v
->
!
StringUtils
.
isEmpty
(
bodyCode
)
&&
bodyCode
.
equals
(
v
.
getMyBodyName
()))
.
filter
(
v
->
StringUtils
.
isEmpty
(
bodyCode
)
||
"all"
.
equals
(
bodyCode
)
||
bodyCode
.
equals
(
v
.
getMyBodyName
()))
.
filter
(
v
->
StringUtils
.
isEmpty
(
serchName
)
&&
(
v
.
getContractCode
().
contains
(
serchName
)
||
v
.
getCustomerBody
().
contains
(
serchName
)))
.
filter
(
v
->
StringUtils
.
isEmpty
(
serchName
)
||
(
v
.
getContractCode
().
contains
(
serchName
)
||
v
.
getCustomerBody
().
contains
(
serchName
)
||
v
.
getMyBodyName
().
contains
(
serchName
)))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
DecimalFormat
df
=
new
DecimalFormat
(
"##,##0.00"
);
DecimalFormat
df
=
new
DecimalFormat
(
"##,##0.00"
);
...
@@ -137,9 +137,10 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -137,9 +137,10 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
for
(
int
j
=
0
;
j
<
dmpIncomes
.
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
dmpIncomes
.
size
();
j
++)
{
HSSFRow
rowBody
=
sheet
.
createRow
(
j
+
1
);
HSSFRow
rowBody
=
sheet
.
createRow
(
j
+
1
);
DmpIncome
income
=
dmpIncomes
.
get
(
j
);
DmpIncome
income
=
dmpIncomes
.
get
(
j
);
String
bussinesTypeName
=
income
.
getBusinessType
()
==
null
?
""
:
bussinesName
[
Integer
.
parseInt
(
income
.
getBusinessType
())];
String
[]
dataItem
=
new
String
[]{
String
[]
dataItem
=
new
String
[]{
income
.
getMyBodyName
(),
income
.
getIncomeMonth
(),
income
.
getCustomerBody
(),
income
.
getMyBodyName
(),
income
.
getIncomeMonth
(),
income
.
getCustomerBody
(),
income
.
getCustomerShort
(),
income
.
getContractCode
(),
bussines
Name
[
Integer
.
parseInt
(
income
.
getBusinessType
())]
,
income
.
getCustomerShort
(),
income
.
getContractCode
(),
bussines
TypeName
,
income
.
getPeriod
(),
income
.
getSysSettlement
(),
income
.
getMonthSettlement
(),
income
.
getPeriod
(),
income
.
getSysSettlement
(),
income
.
getMonthSettlement
(),
income
.
getTaxRate
(),
income
.
getConfirmSettlement
()
income
.
getTaxRate
(),
income
.
getConfirmSettlement
()
};
};
...
@@ -193,13 +194,20 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -193,13 +194,20 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
}
}
Sheet
sheet
=
workbook
.
getSheetAt
(
0
);
Sheet
sheet
=
workbook
.
getSheetAt
(
0
);
DecimalFormat
df
=
new
DecimalFormat
(
"##,##0.00"
);
CompletableFuture
.
runAsync
(()
->
{
CompletableFuture
.
runAsync
(()
->
{
StopWatch
stopWatch
=
new
StopWatch
();
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
stopWatch
.
start
();
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
30
);
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
30
);
CompletableFuture
[]
futures
=
Stream
.
iterate
(
1
,
n
->
n
+
1
).
limit
(
rowNumber
-
1
).
map
(
index
->
CompletableFuture
[]
futures
=
Stream
.
iterate
(
1
,
n
->
n
+
1
).
limit
(
rowNumber
-
1
).
map
(
index
->
CompletableFuture
.
runAsync
(
CompletableFuture
.
runAsync
(
()
->
saveDmpIncomeItem
(
sheet
,
index
,
loginAccount
),
executorService
)
()
->
{
DmpIncome
income
=
saveDmpIncomeItem
(
sheet
,
index
,
loginAccount
);
if
(
income
!=
null
)
{
income
.
setConfirmSettlement
(
new
BigDecimal
(
income
.
getConfirmSettlement
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
());
dmpIncomeRepository
.
save
(
income
);
}
},
executorService
)
.
exceptionally
((
t
)
->
null
)
.
exceptionally
((
t
)
->
null
)
).
toArray
(
size
->
new
CompletableFuture
[
size
]);
).
toArray
(
size
->
new
CompletableFuture
[
size
]);
CompletableFuture
.
allOf
(
futures
).
join
();
CompletableFuture
.
allOf
(
futures
).
join
();
...
@@ -289,9 +297,9 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -289,9 +297,9 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
contract
.
setSale
(
salseMap
.
get
(
contract
.
getSaleName
()));
contract
.
setSale
(
salseMap
.
get
(
contract
.
getSaleName
()));
}
}
if
(
StringUtils
.
isEmpty
(
contract
.
getEmail
()))
{
/*
if (StringUtils.isEmpty(contract.getEmail())) {
return erroValueTip(i, "客户主账号");
return erroValueTip(i, "客户主账号");
}
}
*/
if
(
StringUtils
.
isEmpty
(
contract
.
getContractCode
()))
{
if
(
StringUtils
.
isEmpty
(
contract
.
getContractCode
()))
{
return
erroValueTip
(
i
,
"合同编号"
);
return
erroValueTip
(
i
,
"合同编号"
);
...
@@ -315,7 +323,7 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -315,7 +323,7 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
}
}
if
(!
SETAGREEMENT_TYPE_NAME
.
containsKey
(
contract
.
getAgreementTypeName
()))
{
if
(!
SETAGREEMENT_TYPE_NAME
.
containsKey
(
contract
.
getAgreementTypeName
()))
{
return
erroValueTip
(
i
,
"
业务
类型"
);
return
erroValueTip
(
i
,
"
协议
类型"
);
}
else
{
}
else
{
contract
.
setAgreementType
(
Integer
.
parseInt
(
SETAGREEMENT_TYPE_NAME
.
get
(
contract
.
getAgreementTypeName
())));
contract
.
setAgreementType
(
Integer
.
parseInt
(
SETAGREEMENT_TYPE_NAME
.
get
(
contract
.
getAgreementTypeName
())));
}
}
...
@@ -436,20 +444,15 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -436,20 +444,15 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
if
(
StringUtils
.
isEmpty
(
income
.
getContractCode
()))
{
if
(
StringUtils
.
isEmpty
(
income
.
getContractCode
()))
{
return
null
;
return
null
;
}
}
//保留小数
income
.
setConfirmSettlement
(
new
BigDecimal
(
income
.
getConfirmSettlement
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
());
//
income
.
setTaxRate
(
Double
.
parseDouble
(
income
.
getTaxRate
())
*
100
+
"%"
);
income
.
setTaxRate
(
Double
.
parseDouble
(
income
.
getTaxRate
())
*
100
+
"%"
);
if
(
StringUtils
.
isEmpty
(
income
.
getSysSettlement
()))
{
if
(
StringUtils
.
isEmpty
(
income
.
getSysSettlement
()))
{
income
.
setSysSettlement
(
"0"
);
income
.
setSysSettlement
(
"0"
);
}
}
DmpIncome
one
=
dmpIncomeRepository
.
findByCodeMonth
(
income
.
getContractCode
(),
income
.
getIncomeMonth
());
DmpIncome
one
=
dmpIncomeRepository
.
findByCodeMonth
(
income
.
getContractCode
(),
income
.
getIncomeMonth
());
if
(
one
!=
null
)
{
if
(
one
!=
null
)
{
// 同一合同同一月份不重复保存
// 同一合同同一月份不重复保存
return
null
;
return
null
;
}
}
dmpIncomeRepository
.
save
(
income
);
return
income
;
return
income
;
}
}
...
...
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