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
510679e9
Commit
510679e9
authored
Jul 22, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEV] saveVourcherMappings impl
parent
1b005937
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
2 deletions
+80
-2
DataImport.java
...i/src/main/java/pwc/taxtech/atms/constant/DataImport.java
+13
-0
VoucherMappingDto.java
...n/java/pwc/taxtech/atms/dto/vatdto/VoucherMappingDto.java
+17
-0
VoucherInvoiceMappingServiceImpl.java
...ms/vat/service/impl/VoucherInvoiceMappingServiceImpl.java
+50
-2
No files found.
atms-api/src/main/java/pwc/taxtech/atms/constant/DataImport.java
0 → 100644
View file @
510679e9
package
pwc
.
taxtech
.
atms
.
constant
;
public
class
DataImport
{
public
static
final
String
DuplicateInputInvoices
=
"DuplicateInputInvoice"
;
public
static
final
String
InputInvoiceAlreadyPassed
=
"InputInvoiceAlreadyPassed"
;
public
static
final
String
NotHaveTotalInvoice
=
"NotHaveTotalInvoice"
;
public
static
final
String
LessThanDetailsTotal
=
"LessThanDetailsTotal"
;
public
static
final
String
DuplicateInDB
=
"DuplicateInDB"
;
public
static
final
String
DuplicateInFile
=
"DuplicateInFile"
;
public
static
final
String
EmptyField
=
"EmptyField"
;
public
static
final
String
OverLengthField
=
"OverLengthField"
;
}
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/VoucherMappingDto.java
View file @
510679e9
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
pwc.taxtech.atms.vat.entity.VoucherMapping
;
import
java.util.Date
;
import
java.util.List
;
public
class
VoucherMappingDto
{
public
String
ID
;
...
...
@@ -12,4 +15,18 @@ public class VoucherMappingDto {
public
String
CreatorID
;
public
Date
CreateTime
;
public
Boolean
IsDuplicate
;
public
VoucherMapping
extractVoucherMapping
(){
VoucherMapping
voucherMapping
=
new
VoucherMapping
();
voucherMapping
.
setID
(
ID
);
voucherMapping
.
setTranCode
(
TranCode
);
voucherMapping
.
setVID
(
VID
);
voucherMapping
.
setGroup
(
Group
);
voucherMapping
.
setPeriod
(
Period
);
voucherMapping
.
setItemID
(
ItemID
);
voucherMapping
.
setCreatorID
(
CreatorID
);
voucherMapping
.
setCreateTime
(
CreateTime
);
return
voucherMapping
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/VoucherInvoiceMappingServiceImpl.java
View file @
510679e9
package
pwc
.
taxtech
.
atms
.
vat
.
service
.
impl
;
import
com.mysql.jdbc.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.
dao.AreaRegionMapper
;
import
pwc.taxtech.atms.
constant.DataImport
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.vatdto.InvoiceMappingDto
;
import
pwc.taxtech.atms.dto.vatdto.VoucherMappingDto
;
...
...
@@ -13,8 +14,10 @@ import pwc.taxtech.atms.vat.entity.InvoiceMappingExample;
import
pwc.taxtech.atms.vat.entity.VoucherMapping
;
import
pwc.taxtech.atms.vat.entity.VoucherMappingExample
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
public
class
VoucherInvoiceMappingServiceImpl
{
...
...
@@ -45,7 +48,52 @@ public class VoucherInvoiceMappingServiceImpl {
public
OperationResultDto
<
List
<
OperationResultDto
<
List
<
VoucherMappingDto
>>>>
saveVourcherMappings
(
List
<
VoucherMappingDto
>
list
,
int
period
,
boolean
isAddition
)
{
return
null
;
OperationResultDto
<
List
<
OperationResultDto
<
List
<
VoucherMappingDto
>>>>
result
=
new
OperationResultDto
<>();
result
.
setResult
(
true
);
result
.
setData
(
new
ArrayList
<
OperationResultDto
<
List
<
VoucherMappingDto
>>>());
List
<
VoucherMappingDto
>
emptyItems
=
list
.
stream
().
filter
(
m
->
StringUtils
.
isEmptyOrWhitespaceOnly
(
m
.
TranCode
)
||
StringUtils
.
isEmptyOrWhitespaceOnly
(
m
.
VID
)
||
StringUtils
.
isEmptyOrWhitespaceOnly
(
m
.
Group
)
||
StringUtils
.
isEmptyOrWhitespaceOnly
(
m
.
ItemID
)).
collect
(
Collectors
.
toList
());
if
(
emptyItems
.
size
()
>
0
)
{
result
.
setResult
(
false
);
OperationResultDto
<
List
<
VoucherMappingDto
>>
rr
=
new
OperationResultDto
<>();
rr
.
setData
(
emptyItems
);
rr
.
setResult
(
false
);
rr
.
setResultMsg
(
DataImport
.
EmptyField
);
result
.
getData
().
add
(
rr
);
}
emptyItems
=
list
.
stream
().
filter
(
dto
->
dto
.
TranCode
!=
null
&&
dto
.
TranCode
.
length
()
>
50
||
(
dto
.
VID
!=
null
&&
dto
.
VID
.
length
()
>
50
)
||
(
dto
.
Group
!=
null
&&
dto
.
Group
.
length
()
>
50
)
||
(
dto
.
ItemID
!=
null
&&
dto
.
ItemID
.
length
()
>
50
)
).
collect
(
Collectors
.
toList
());
if
(
emptyItems
.
size
()
>
0
)
{
result
.
setResult
(
false
);
OperationResultDto
<
List
<
VoucherMappingDto
>>
rr
=
new
OperationResultDto
<>();
rr
.
setData
(
emptyItems
);
rr
.
setResult
(
false
);
rr
.
setResultMsg
(
DataImport
.
OverLengthField
);
result
.
getData
().
add
(
rr
);
}
if
(
result
.
getResult
())
{
if
(!
isAddition
)
{
VoucherMappingExample
voucherMappingExample
=
new
VoucherMappingExample
();
voucherMappingExample
.
createCriteria
().
andPeriodEqualTo
(
period
);
voucherMappingMapper
.
deleteByExample
(
voucherMappingExample
);
}
list
.
forEach
(
m
->
voucherMappingMapper
.
insert
(
m
.
extractVoucherMapping
()));
}
// ValidDBVoucherMapping(period); todo:[validation] to be continue (neo)
return
result
;
}
public
OperationResultDto
<
List
<
OperationResultDto
<
List
<
InvoiceMappingDto
>>>>
SaveInvoiceMappings
(
List
<
InvoiceMappingDto
>
list
,
...
...
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