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
37c45a65
Commit
37c45a65
authored
Jul 22, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev] ImportOutputInvoiceData impl
parent
df6963f3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
28 deletions
+61
-28
ImportOutputInvoiceDto.java
...a/pwc/taxtech/atms/dto/vatdto/ImportOutputInvoiceDto.java
+5
-2
OutputVATInvoiceItemDto.java
.../pwc/taxtech/atms/dto/vatdto/OutputVATInvoiceItemDto.java
+0
-24
OutputInvoiceServiceImpl.java
...xtech/atms/vat/service/impl/OutputInvoiceServiceImpl.java
+56
-2
No files found.
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/ImportOutputInvoiceDto.java
View file @
37c45a65
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
pwc.taxtech.atms.vat.entity.OutputVATInvoice
;
import
pwc.taxtech.atms.vat.entity.OutputVATInvoiceItem
;
import
java.util.List
;
public
class
ImportOutputInvoiceDto
{
public
List
<
OutputVATInvoice
Dto
>
OutputInvoiceList
;
public
List
<
OutputVATInvoiceItem
Dto
>
OutputInvoiceItemList
;
public
List
<
OutputVATInvoice
>
OutputInvoiceList
;
public
List
<
OutputVATInvoiceItem
>
OutputInvoiceItemList
;
public
Integer
ImportType
;
}
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/OutputVATInvoiceItemDto.java
deleted
100644 → 0
View file @
df6963f3
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
java.math.BigDecimal
;
import
java.util.Date
;
public
class
OutputVATInvoiceItemDto
{
public
String
ItemID
;
public
String
InvoiceID
;
public
String
CodeVersion
;
public
String
ProductName
;
public
String
DocumentNum
;
public
String
ProductStandard
;
public
String
Unit
;
public
Integer
Quantity
;
public
Double
UnitPrice
;
public
BigDecimal
Amount
;
public
BigDecimal
TaxRate
;
public
BigDecimal
TaxAmount
;
public
int
SeqNo
;
public
String
TaxClassCode
;
public
String
CreatorID
;
public
Date
CreateTime
;
public
int
PeriodID
;
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/OutputInvoiceServiceImpl.java
View file @
37c45a65
package
pwc
.
taxtech
.
atms
.
vat
.
service
.
impl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.ibatis.jdbc.ScriptRunner
;
import
org.apache.ibatis.session.SqlSession
;
import
org.mybatis.spring.SqlSessionTemplate
;
import
org.reflections.util.Utils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.common.PagingList
;
import
pwc.taxtech.atms.constant.enums.EnumTbImportType
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.PagingResultDto
;
import
pwc.taxtech.atms.dto.vatdto.ImportOutputInvoiceDto
;
...
...
@@ -19,10 +23,12 @@ import pwc.taxtech.atms.vat.entity.OutputVATInvoiceExample;
import
pwc.taxtech.atms.vat.entity.OutputVATInvoiceItem
;
import
pwc.taxtech.atms.vat.entity.OutputVATInvoiceItemExample
;
import
java.io.StringReader
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -32,6 +38,10 @@ import java.util.stream.Stream;
public
class
OutputInvoiceServiceImpl
extends
VatAbstractService
{
@Autowired
private
ImportFileMapper
importFileMapper
;
private
static
final
String
_tableName
=
"OutputVATInvoice"
;
private
static
final
String
_itemTableName
=
"OutputVATInvoiceItem"
;
@Autowired
private
SqlSessionTemplate
dynamicSqlSessionTemplate
;
public
PagingResultDto
<
OutputVATInvoiceInfoDto
>
queryOutputInvoiceList
(
QueryOutputDto
queryDto
)
{
PagingResultDto
<
OutputVATInvoiceInfoDto
>
qResult
=
new
PagingResultDto
<>();
...
...
@@ -198,8 +208,34 @@ public class OutputInvoiceServiceImpl extends VatAbstractService {
return
stream
.
sorted
(
Comparator
.
comparing
(
OutputVATInvoiceInfoDto:
:
getInvoiceDate
)).
collect
(
Collectors
.
toList
());
}
public
OperationResultDto
ImportOutputInvoiceData
(
ImportOutputInvoiceDto
importDto
,
String
id
)
{
return
null
;
public
OperationResultDto
ImportOutputInvoiceData
(
ImportOutputInvoiceDto
importDto
,
String
userID
)
{
if
(
importDto
.
OutputInvoiceList
.
size
()
>
0
)
{
int
period
=
importDto
.
OutputInvoiceList
.
get
(
0
).
getPeriodID
();
importDto
.
OutputInvoiceList
.
forEach
(
item
->
{
item
.
setCreatorID
(
userID
);
item
.
setCreateTime
(
new
Date
());
});
importDto
.
OutputInvoiceItemList
.
forEach
(
item
->
{
item
.
setCreatorID
(
userID
);
item
.
setCreateTime
(
new
Date
());
});
//如果是覆盖导入,则先删除该期间的数据,再进行数据导入
if
(
importDto
.
ImportType
==
EnumTbImportType
.
CoverImport
.
getCode
())
{
ClearTableData
(
period
,
_tableName
);
ClearTableData
(
period
,
_itemTableName
);
}
// DeleteOutputValidation(period, 2);//todo:[validation] to be continue (neo)
//将发票数据转换为datatable
importDto
.
OutputInvoiceList
.
forEach
(
item
->
outputVATInvoiceMapper
.
insert
(
item
));
importDto
.
OutputInvoiceItemList
.
forEach
(
item
->
outputVATInvoiceItemMapper
.
insert
(
item
));
// ValidataionDuplicationData(period, userID);//todo:[validation] to be continue (neo)
// TaxRateValidation(period, userID);//todo:[validation] to be continue (neo)
// StartToSendMessage(period);//todo:[validation] to be continue (neo)
}
return
new
OperationResultDto
(
true
);
}
public
Boolean
addImportFile
(
ImportFile
fileDto
)
{
...
...
@@ -209,4 +245,22 @@ public class OutputInvoiceServiceImpl extends VatAbstractService {
public
OperationResultDto
<
List
<
OutputVATInvoiceInfoDto
>>
GetOutputInvoiceList
(
int
period
)
{
return
null
;
}
private
void
ClearTableData
(
int
period
,
String
tableName
)
{
String
clearCommand
=
""
;
if
(
period
>
0
)
{
clearCommand
=
"DELETE FROM "
+
tableName
+
" WHERE PeriodID = "
+
period
;
}
else
{
clearCommand
=
"TRUNCATE TABLE "
+
tableName
;
}
}
private
void
exeCommand
(
String
command
)
{
try
(
SqlSession
sqlSession
=
dynamicSqlSessionTemplate
.
getSqlSessionFactory
().
openSession
();)
{
ScriptRunner
scriptRunner
=
new
ScriptRunner
(
sqlSession
.
getConnection
());
scriptRunner
.
setAutoCommit
(
true
);
scriptRunner
.
runScript
(
new
StringReader
(
command
));
}
}
}
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