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
fcccdc70
Commit
fcccdc70
authored
Sep 06, 2021
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复dmp 收入上传
parent
1b084492
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
19 deletions
+45
-19
DmpIncomeController.java
src/main/java/common/controller/DmpIncomeController.java
+2
-2
DmpIncome.java
src/main/java/common/model/DmpIncome.java
+10
-0
DmpIncomeRepository.java
src/main/java/common/repository/DmpIncomeRepository.java
+1
-0
DmpIncomeService.java
src/main/java/common/service/DmpIncomeService.java
+1
-1
DmpIncomeServiceImpl.java
src/main/java/common/service/impl/DmpIncomeServiceImpl.java
+31
-16
No files found.
src/main/java/common/controller/DmpIncomeController.java
View file @
fcccdc70
...
...
@@ -38,9 +38,9 @@ public class DmpIncomeController {
}
@PostMapping
(
"/delete"
)
public
ResultModel
deleteItem
(
Long
id
)
{
public
ResultModel
deleteItem
(
@RequestBody
DmpIncome
dmpIncome
)
{
//删除数据
return
ResultModel
.
OK
(
dmpIncomeService
.
delete
(
id
));
return
ResultModel
.
OK
(
dmpIncomeService
.
delete
(
dmpIncome
));
}
...
...
src/main/java/common/model/DmpIncome.java
View file @
fcccdc70
...
...
@@ -20,6 +20,7 @@ public class DmpIncome {
private
Date
createTime
;
private
Date
modifyTime
;
private
String
uploadUser
;
private
int
index
;
//contract_code, my_body_name, customer_body, customer_short, business_type, agreement_type
...
...
@@ -164,4 +165,13 @@ public class DmpIncome {
public
void
setAgreementType
(
String
agreementType
)
{
this
.
agreementType
=
agreementType
;
}
@Transient
public
int
getIndex
()
{
return
index
;
}
public
void
setIndex
(
int
index
)
{
this
.
index
=
index
;
}
}
src/main/java/common/repository/DmpIncomeRepository.java
View file @
fcccdc70
...
...
@@ -16,4 +16,5 @@ public interface DmpIncomeRepository extends JpaRepository<DmpIncome, Long> {
@Query
(
value
=
"select * from dmp_income where contract_code = ?1 and income_month =?2 limit 1 "
,
nativeQuery
=
true
)
DmpIncome
findByCodeMonth
(
String
contractCode
,
String
incomeMonth
);
}
src/main/java/common/service/DmpIncomeService.java
View file @
fcccdc70
...
...
@@ -18,7 +18,7 @@ public interface DmpIncomeService {
DmpIncome
update
(
DmpIncome
dmpIncome
);
Long
delete
(
Long
id
);
Long
delete
(
DmpIncome
dmpIncome
);
ResultModel
uploadFile
(
MultipartFile
file
,
String
platform
,
User
loginAccount
);
...
...
src/main/java/common/service/impl/DmpIncomeServiceImpl.java
View file @
fcccdc70
...
...
@@ -177,12 +177,12 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
}
@Override
public
Long
delete
(
Long
id
)
{
if
(
id
==
null
)
{
public
Long
delete
(
DmpIncome
dmpIncome
)
{
if
(
dmpIncome
.
getId
()
==
null
)
{
return
null
;
}
dmpIncomeRepository
.
delete
(
id
);
return
id
;
dmpIncomeRepository
.
delete
(
dmpIncome
.
getId
()
);
return
dmpIncome
.
getId
()
;
}
@Override
...
...
@@ -204,24 +204,42 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
StringBuffer
erroMessage
=
new
StringBuffer
();
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
Map
<
String
,
String
>
incomeMap
=
new
HashMap
<>();
List
<
DmpIncome
>
dmpIncomeList
=
Stream
.
iterate
(
1
,
n
->
n
+
1
).
limit
(
rowNumber
-
1
).
map
(
index
->
{
DmpIncome
income
=
saveDmpIncomeItem
(
sheet
,
index
,
loginAccount
);
String
key
=
income
.
getIncomeMonth
()
+
income
.
getContractCode
();
if
(
incomeMap
.
containsKey
(
key
))
{
return
null
;
}
incomeMap
.
put
(
key
,
"1"
);
return
income
;
}).
filter
(
in
->
in
!=
null
).
collect
(
Collectors
.
toList
());
if
(
dmpIncomeList
.
isEmpty
())
{
return
ResultModel
.
OK
();
}
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
30
);
CompletableFuture
[]
futures
=
Stream
.
iterate
(
1
,
n
->
n
+
1
).
limit
(
rowNumber
-
1
).
map
(
index
->
final
int
[]
indexLine
=
{
0
};
CompletableFuture
[]
futures
=
dmpIncomeList
.
stream
().
map
(
income
->
CompletableFuture
.
runAsync
(
()
->
{
DmpIncome
income
=
saveDmpIncomeItem
(
sheet
,
index
,
loginAccount
);
if
(
income
!=
null
)
{
DmpIncome
one
=
dmpIncomeRepository
.
findByCodeMonth
(
income
.
getContractCode
(),
income
.
getIncomeMonth
());
if
(
one
!=
null
)
{
// 同一合同同一月份不重复保存
return
;
}
indexLine
[
0
]
=
income
.
getIndex
();
if
(
"erro"
.
equals
(
income
.
getIncomeMonth
()))
{
erroMessage
.
append
(
index
).
append
(
" 行 收入月份错误"
).
append
(
";\n"
);
erroMessage
.
append
(
income
.
getIndex
()
).
append
(
" 行 收入月份错误"
).
append
(
";\n"
);
}
else
{
income
.
setConfirmSettlement
(
new
BigDecimal
(
income
.
getConfirmSettlement
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
());
dmpIncomeRepository
.
save
(
income
);
}
}
},
executorService
)
.
exceptionally
((
t
)
->
{
erroMessage
.
append
(
index
).
append
(
" 行 错误"
).
append
(
t
.
getMessage
()).
append
(
";\n"
);
logger
.
error
(
"the line "
+
index
,
t
);
erroMessage
.
append
(
indexLine
[
0
]
).
append
(
" 行 错误"
).
append
(
t
.
getMessage
()).
append
(
";\n"
);
logger
.
error
(
"the line "
+
indexLine
[
0
]
,
t
);
return
null
;
})
).
toArray
(
size
->
new
CompletableFuture
[
size
]);
...
...
@@ -461,6 +479,7 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
Row
rowItem
=
sheet
.
getRow
(
index
);
//合同编号 收入月份 结算周期 系统结算 按月结算 税率 确认收入
DmpIncome
income
=
new
DmpIncome
();
income
.
setIndex
(
index
);
income
.
setContractCode
(
getCellStringValue
(
rowItem
,
0
));
income
.
setIncomeMonth
(
getCellDateValue
(
rowItem
,
1
,
"yyyy-MM"
));
income
.
setPeriod
(
getCellStringValue
(
rowItem
,
2
));
...
...
@@ -480,11 +499,7 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
if
(
StringUtils
.
isEmpty
(
income
.
getSysSettlement
()))
{
income
.
setSysSettlement
(
"0"
);
}
DmpIncome
one
=
dmpIncomeRepository
.
findByCodeMonth
(
income
.
getContractCode
(),
income
.
getIncomeMonth
());
if
(
one
!=
null
)
{
// 同一合同同一月份不重复保存
return
null
;
}
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