Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
a3a74c96
Commit
a3a74c96
authored
Jul 22, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev] ImportAuditAdjust impl
parent
302ebf47
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
3 deletions
+64
-3
JournalEntryImportServiceImpl.java
.../atms/vat/service/impl/JournalEntryImportServiceImpl.java
+64
-3
No files found.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/JournalEntryImportServiceImpl.java
View file @
a3a74c96
package
pwc
.
taxtech
.
atms
.
vat
.
service
.
impl
;
import
com.google.common.collect.Lists
;
import
com.mysql.jdbc.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.constant.DataImport
;
import
pwc.taxtech.atms.constant.enums.EnumTbImportType
;
import
pwc.taxtech.atms.constant.enums.EnumValidationType
;
import
pwc.taxtech.atms.constant.enums.VatImportType
;
...
...
@@ -20,7 +23,9 @@ import pwc.taxtech.atms.vat.entity.Voucher;
import
pwc.taxtech.atms.vat.entity.VoucherExample
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Set
;
...
...
@@ -119,7 +124,7 @@ public class JournalEntryImportServiceImpl {
periods
.
forEach
(
m
->
ClearTableData
(
m
,
_tableName
));
}
journalEntryList
.
forEach
(
m
->
voucherMapper
.
insert
(
m
.
extractVoucher
()));
journalEntryList
.
forEach
(
m
->
voucherMapper
.
insert
(
m
.
extractVoucher
()));
// ValidateJournalEntryByPeriods(userID);//todo:[validation] to be continue (neo)
}
}
...
...
@@ -139,8 +144,64 @@ public class JournalEntryImportServiceImpl {
}
public
OperationResultDto
<
List
<
OperationResultDto
<
List
<
VoucherDtoOnlyForImport
>>>>
ImportAuditAdjust
(
List
<
VoucherDtoOnlyForImport
>
voucherList
,
int
period
,
Integer
importType
,
String
id
)
{
return
null
;
int
period
,
Integer
importType
,
String
userID
)
{
OperationResultDto
<
List
<
OperationResultDto
<
List
<
VoucherDtoOnlyForImport
>>>>
result
=
new
OperationResultDto
<>();
result
.
setResult
(
true
);
int
num
=
1
;
for
(
VoucherDtoOnlyForImport
v
:
voucherList
)
{
v
.
VoucherID
=
UUID
.
randomUUID
().
toString
();
v
.
VID
=
String
.
format
(
"%sNO%s"
,
new
SimpleDateFormat
(
"MMddHHmmss"
).
format
(
new
Date
()),
num
);
v
.
Group
=
v
.
VID
;
num
++;
v
.
CreatorID
=
userID
;
if
(
v
.
CreateTime
==
null
)
{
v
.
date
=
new
Date
();
v
.
CreateTime
=
v
.
date
;
}
v
.
ImportType
=
VatImportType
.
AuditAdjust
.
getCode
();
}
result
.
setData
(
new
ArrayList
<>());
List
<
VoucherDtoOnlyForImport
>
emptyItems
=
voucherList
.
stream
().
filter
(
dto
->
StringUtils
.
isEmptyOrWhitespaceOnly
(
dto
.
AcctCode
)
||
dto
.
Credit
==
null
||
dto
.
Debit
==
null
).
collect
(
Collectors
.
toList
());
if
(
emptyItems
.
size
()>
0
){
result
.
setResult
(
false
);
OperationResultDto
<
List
<
VoucherDtoOnlyForImport
>>
rr
=
new
OperationResultDto
<>();
rr
.
setData
(
emptyItems
);
rr
.
setResult
(
false
);
rr
.
setResultMsg
(
DataImport
.
EmptyField
);
result
.
getData
().
add
(
rr
);
}
emptyItems
=
voucherList
.
stream
().
filter
(
dto
->(
dto
.
AcctCode
!=
null
&&
dto
.
AcctCode
.
length
()
>
50
)
||
(
dto
.
Summary
!=
null
&&
dto
.
Summary
.
length
()
>
500
)).
collect
(
Collectors
.
toList
());
if
(
emptyItems
.
size
()>
0
){
result
.
setResult
(
false
);
result
.
setResult
(
false
);
OperationResultDto
<
List
<
VoucherDtoOnlyForImport
>>
rr
=
new
OperationResultDto
<>();
rr
.
setData
(
emptyItems
);
rr
.
setResult
(
false
);
rr
.
setResultMsg
(
DataImport
.
OverLengthField
);
result
.
getData
().
add
(
rr
);
}
if
(
result
.
getResult
()){
if
(
importType
==
EnumTbImportType
.
CoverImport
.
getCode
()){
Set
<
Integer
>
perods
=
voucherList
.
stream
().
collect
(
Collectors
.
groupingBy
(
VoucherDtoOnlyForImport:
:
getPeriod
,
Collectors
.
counting
())).
keySet
();
VoucherExample
example
=
new
VoucherExample
();
example
.
createCriteria
().
andPeriodIn
(
Lists
.
newArrayList
(
period
)).
andImportTypeEqualTo
(
VatImportType
.
AuditAdjust
.
getCode
());
voucherMapper
.
deleteByExample
(
example
);
}
voucherList
.
forEach
(
m
->
voucherMapper
.
insert
(
m
.
extractVoucher
()));
}
return
result
;
}
public
List
<
VoucherDto
>
GetAuditAdjust
(
int
period
)
{
...
...
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