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
302ebf47
Commit
302ebf47
authored
Jul 22, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEV] ImportJournalEntryData impl
parent
55d2266d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
3 deletions
+76
-3
VoucherDtoOnlyForImport.java
.../pwc/taxtech/atms/dto/vatdto/VoucherDtoOnlyForImport.java
+32
-0
JournalEntryImportServiceImpl.java
.../atms/vat/service/impl/JournalEntryImportServiceImpl.java
+44
-3
No files found.
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/VoucherDtoOnlyForImport.java
View file @
302ebf47
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
pwc.taxtech.atms.vat.entity.Voucher
;
import
java.math.BigDecimal
;
import
java.util.Date
;
...
...
@@ -25,4 +27,34 @@ public class VoucherDtoOnlyForImport {
public
Integer
Status
;
public
Integer
PartBilledPeriod
;
public
Integer
BilledPeriod
;
public
Integer
getPeriod
()
{
return
Period
;
}
public
Voucher
extractVoucher
(){
Voucher
voucher
=
new
Voucher
();
voucher
.
setVoucherID
(
VoucherID
);
voucher
.
setVID
(
VID
);
voucher
.
setDate
(
date
);
voucher
.
setGroup
(
Group
);
voucher
.
setPeriod
(
Period
);
voucher
.
setCustomerCode
(
CustomerCode
);
voucher
.
setCustomerName
(
CustomerName
);
voucher
.
setSummary
(
Summary
);
voucher
.
setAcctCode
(
AcctCode
);
voucher
.
setDebit
(
Debit
);
voucher
.
setCredit
(
Credit
);
voucher
.
setAttach
(
Attach
);
voucher
.
setItemID
(
ItemID
);
voucher
.
setCreateTime
(
CreateTime
);
voucher
.
setImportType
(
ImportType
);
voucher
.
setCreatorID
(
CreatorID
);
voucher
.
setMonthID
(
MonthID
);
voucher
.
setOriginalPeriod
(
OriginalPeriod
);
voucher
.
setStatus
(
Status
);
voucher
.
setPartBilledPeriod
(
PartBilledPeriod
);
voucher
.
setBilledPeriod
(
BilledPeriod
);
return
voucher
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/JournalEntryImportServiceImpl.java
View file @
302ebf47
...
...
@@ -2,6 +2,8 @@ package pwc.taxtech.atms.vat.service.impl;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.constant.enums.EnumTbImportType
;
import
pwc.taxtech.atms.constant.enums.EnumValidationType
;
import
pwc.taxtech.atms.constant.enums.VatImportType
;
import
pwc.taxtech.atms.dto.FieldsMapper
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
...
...
@@ -11,13 +13,19 @@ import pwc.taxtech.atms.dto.vatdto.VoucherDto;
import
pwc.taxtech.atms.dto.vatdto.VoucherDtoOnlyForImport
;
import
pwc.taxtech.atms.vat.dao.JournalEntryImportMapper
;
import
pwc.taxtech.atms.vat.dao.ValidationInfoMapper
;
import
pwc.taxtech.atms.vat.dao.VoucherMapper
;
import
pwc.taxtech.atms.vat.entity.ValidationInfo
;
import
pwc.taxtech.atms.vat.entity.ValidationInfoExample
;
import
pwc.taxtech.atms.vat.entity.Voucher
;
import
pwc.taxtech.atms.vat.entity.VoucherExample
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
import
static
pwc
.
taxtech
.
atms
.
constant
.
Constant
.
WholeYear
;
...
...
@@ -29,6 +37,11 @@ public class JournalEntryImportServiceImpl {
@Autowired
ValidationInfoMapper
validationInfoMapper
;
private
final
static
String
_tableName
=
"Voucher"
;
private
final
static
String
_validationTableName
=
"ValidationInfo"
;
@Autowired
private
VoucherMapper
voucherMapper
;
public
PagingResultDto
<
VoucherDto
>
qeryJournalEntryData
(
QueryJeDto
queryJeDto
)
{
PagingResultDto
<
VoucherDto
>
qResult
=
new
PagingResultDto
<
VoucherDto
>();
qResult
.
setPageInfo
(
queryJeDto
.
getPageInfo
());
...
...
@@ -88,13 +101,41 @@ public class JournalEntryImportServiceImpl {
if
(
period
.
intValue
()
!=
WholeYear
)
validationInfoExample
.
createCriteria
().
andImportTypeIdEqualTo
(
type
).
andPeriodIdEqualTo
(
period
);
else
validationInfoExample
.
createCriteria
().
andImportTypeIdEqualTo
(
type
);
return
validationInfoMapper
.
selectByExample
(
validationInfoExample
);
}
public
void
ImportJournalEntryData
(
List
<
VoucherDtoOnlyForImport
>
voucherList
,
Integer
importType
,
String
id
)
{
public
void
ImportJournalEntryData
(
List
<
VoucherDtoOnlyForImport
>
journalEntryList
,
Integer
importType
,
String
userID
)
{
if
(
journalEntryList
.
size
()
>
0
)
{
Set
<
Integer
>
periods
=
journalEntryList
.
stream
().
collect
(
Collectors
.
groupingBy
(
VoucherDtoOnlyForImport:
:
getPeriod
,
Collectors
.
counting
())).
keySet
();
journalEntryList
.
forEach
(
m
->
{
m
.
VoucherID
=
UUID
.
randomUUID
().
toString
();
m
.
CreatorID
=
userID
;
m
.
CreateTime
=
new
Date
();
});
if
(
importType
==
EnumTbImportType
.
CoverImport
.
getCode
())
{
periods
.
forEach
(
m
->
ClearTableData
(
m
,
_tableName
));
}
journalEntryList
.
forEach
(
m
->
voucherMapper
.
insert
(
m
.
extractVoucher
()));
// ValidateJournalEntryByPeriods(userID);//todo:[validation] to be continue (neo)
}
}
private
void
ClearTableData
(
Integer
period
,
String
tableName
)
{
switch
(
tableName
)
{
case
_tableName:
VoucherExample
example
=
new
VoucherExample
();
example
.
createCriteria
().
andPeriodEqualTo
(
period
).
andImportTypeEqualTo
(
VatImportType
.
JournalEntry
.
getCode
());
voucherMapper
.
deleteByExample
(
period
>
0
?
example
:
null
);
break
;
case
_validationTableName:
ValidationInfoExample
example1
=
new
ValidationInfoExample
();
example1
.
createCriteria
().
andPeriodIdEqualTo
(
period
).
andImportTypeIdEqualTo
(
EnumValidationType
.
JournalEntry
.
getCode
());
validationInfoMapper
.
deleteByExample
(
period
>
0
?
example1
:
null
);
}
}
public
OperationResultDto
<
List
<
OperationResultDto
<
List
<
VoucherDtoOnlyForImport
>>>>
ImportAuditAdjust
(
List
<
VoucherDtoOnlyForImport
>
voucherList
,
...
...
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