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
b9b317ba
Commit
b9b317ba
authored
Jun 20, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEV] journal entry validation
parent
a33d964a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
176 additions
and
5 deletions
+176
-5
Constant.java
...api/src/main/java/pwc/taxtech/atms/constant/Constant.java
+4
-0
JournalEntryImportController.java
...taxtech/atms/controller/JournalEntryImportController.java
+6
-0
TBDataImportController.java
...a/pwc/taxtech/atms/controller/TBDataImportController.java
+5
-1
ValidationInfoDto.java
...n/java/pwc/taxtech/atms/dto/vatdto/ValidationInfoDto.java
+115
-0
NPOIHelper.java
...-api/src/main/java/pwc/taxtech/atms/utils/NPOIHelper.java
+3
-0
JournalEntryImportService.java
...c/taxtech/atms/vat/service/JournalEntryImportService.java
+5
-0
JournalEntryImportServiceImpl.java
.../atms/vat/service/impl/JournalEntryImportServiceImpl.java
+38
-4
No files found.
atms-api/src/main/java/pwc/taxtech/atms/constant/Constant.java
View file @
b9b317ba
...
...
@@ -30,4 +30,7 @@ public final class Constant {
public
static
final
boolean
DEFAULT_RESULT
=
true
;
public
static
final
int
FIRST_OR_DEFAULT
=
0
;
public
static
final
int
HEADER_ROW_INDEX
=
0
;
public
static
final
boolean
DEFAULT_HAS_HEADER
=
true
;
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/controller/JournalEntryImportController.java
View file @
b9b317ba
...
...
@@ -23,5 +23,11 @@ public class JournalEntryImportController {
public
ResponseEntity
queryJournalEntryData
(
@RequestBody
QueryJeDto
queryJeDto
)
{
return
ResponseEntity
.
ok
(
journalEntryDataImportService
.
qeryJournalEntryData
(
queryJeDto
));
}
@ApiOperation
(
value
=
"getValidationInfo"
,
notes
=
""
)
@RequestMapping
(
value
=
"getValidationInfo/{type}/{period}"
,
method
=
RequestMethod
.
GET
)
public
ResponseEntity
getValidationInfo
(
@PathVariable
Integer
type
,
@PathVariable
Integer
period
)
{
return
ResponseEntity
.
ok
(
journalEntryDataImportService
.
getValidationInfoList
(
type
,
period
));
}
}
atms-api/src/main/java/pwc/taxtech/atms/controller/TBDataImportController.java
View file @
b9b317ba
...
...
@@ -30,6 +30,9 @@ import java.math.BigDecimal;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
pwc
.
taxtech
.
atms
.
constant
.
Constant
.
DEFAULT_HAS_HEADER
;
import
static
pwc
.
taxtech
.
atms
.
constant
.
Constant
.
HEADER_ROW_INDEX
;
@RequestMapping
(
value
=
"api/v1/DataImport"
)
@RestController
public
class
TBDataImportController
{
...
...
@@ -455,7 +458,8 @@ public class TBDataImportController {
String
fullFilePath
=
fileUploadAdapter
.
getLastFilePathByFileName
(
tempFileName
);
if
(
fullFilePath
!=
null
)
{
try
(
FileInputStream
fis
=
new
FileInputStream
(
new
File
(
fullFilePath
));)
{
dataImportModel
=
NPOIHelper
.
renderTBDataTableFromExcel
(
fis
,
selectedSheetIndex
,
0
,
true
,
topRowNumber
);
dataImportModel
=
NPOIHelper
.
renderTBDataTableFromExcel
(
fis
,
selectedSheetIndex
,
HEADER_ROW_INDEX
,
DEFAULT_HAS_HEADER
,
topRowNumber
);
dataImportModel
.
setSelectedSheetIndex
(
selectedSheetIndex
);
return
ResponseEntity
.
ok
(
dataImportModel
);
}
catch
(
FileNotFoundException
e
)
{
//TODO: replace exception filter (neo)
...
...
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/ValidationInfoDto.java
0 → 100644
View file @
b9b317ba
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
java.util.Date
;
public
class
ValidationInfoDto
{
private
String
ID
;
private
Integer
importTypeId
;
private
String
validationResult
;
private
String
validationDetails
;
private
String
validationTips
;
private
Integer
number
;
private
String
creatorId
;
private
Date
createTime
;
private
Integer
periodId
;
private
Integer
erpCheckTypeId
;
private
Integer
errorLevel
;
public
String
getID
()
{
return
ID
;
}
public
void
setID
(
String
ID
)
{
this
.
ID
=
ID
;
}
public
Integer
getImportTypeId
()
{
return
importTypeId
;
}
public
void
setImportTypeId
(
Integer
importTypeId
)
{
this
.
importTypeId
=
importTypeId
;
}
public
String
getValidationResult
()
{
return
validationResult
;
}
public
void
setValidationResult
(
String
validationResult
)
{
this
.
validationResult
=
validationResult
;
}
public
String
getValidationDetails
()
{
return
validationDetails
;
}
public
void
setValidationDetails
(
String
validationDetails
)
{
this
.
validationDetails
=
validationDetails
;
}
public
String
getValidationTips
()
{
return
validationTips
;
}
public
void
setValidationTips
(
String
validationTips
)
{
this
.
validationTips
=
validationTips
;
}
public
Integer
getNumber
()
{
return
number
;
}
public
void
setNumber
(
Integer
number
)
{
this
.
number
=
number
;
}
public
String
getCreatorId
()
{
return
creatorId
;
}
public
void
setCreatorId
(
String
creatorId
)
{
this
.
creatorId
=
creatorId
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Integer
getPeriodId
()
{
return
periodId
;
}
public
void
setPeriodId
(
Integer
periodId
)
{
this
.
periodId
=
periodId
;
}
public
Integer
getErpCheckTypeId
()
{
return
erpCheckTypeId
;
}
public
void
setErpCheckTypeId
(
Integer
erpCheckTypeId
)
{
this
.
erpCheckTypeId
=
erpCheckTypeId
;
}
public
Integer
getErrorLevel
()
{
return
errorLevel
;
}
public
void
setErrorLevel
(
Integer
errorLevel
)
{
this
.
errorLevel
=
errorLevel
;
}
public
Integer
getIsShowDetail
()
{
return
isShowDetail
;
}
public
void
setIsShowDetail
(
Integer
isShowDetail
)
{
this
.
isShowDetail
=
isShowDetail
;
}
private
Integer
isShowDetail
;
}
atms-api/src/main/java/pwc/taxtech/atms/utils/NPOIHelper.java
View file @
b9b317ba
...
...
@@ -80,7 +80,10 @@ public class NPOIHelper {
if
(
topRowNumber
>
0
)
{
//第一行为列头的话就多输出一行
int
topNum
=
haveHeader
?
topRowNumber
+
1
:
topRowNumber
;
if
(
topNum
<
dataImportModel
.
getDataList
().
size
())
dataImportModel
.
setDataList
(
dataImportModel
.
getDataList
().
subList
(
0
,
topNum
));
// dataImportModel.setDataList(dataImportModel.getDataList().subList(0,topRowNumber));
}
return
dataImportModel
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/JournalEntryImportService.java
View file @
b9b317ba
...
...
@@ -2,8 +2,13 @@ package pwc.taxtech.atms.vat.service;
import
pwc.taxtech.atms.dto.PagingResultDto
;
import
pwc.taxtech.atms.dto.vatdto.QueryJeDto
;
import
pwc.taxtech.atms.dto.vatdto.ValidationInfoDto
;
import
pwc.taxtech.atms.dto.vatdto.VoucherDto
;
import
java.util.List
;
public
interface
JournalEntryImportService
{
PagingResultDto
<
VoucherDto
>
qeryJournalEntryData
(
QueryJeDto
queryJeDto
);
List
<
ValidationInfoDto
>
getValidationInfoList
(
Integer
type
,
Integer
period
);
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/JournalEntryImportServiceImpl.java
View file @
b9b317ba
...
...
@@ -6,8 +6,12 @@ import pwc.taxtech.atms.constant.enums.VatImportType;
import
pwc.taxtech.atms.dto.FieldsMapper
;
import
pwc.taxtech.atms.dto.PagingResultDto
;
import
pwc.taxtech.atms.dto.vatdto.QueryJeDto
;
import
pwc.taxtech.atms.dto.vatdto.ValidationInfoDto
;
import
pwc.taxtech.atms.dto.vatdto.VoucherDto
;
import
pwc.taxtech.atms.vat.dao.JournalEntryImportMapper
;
import
pwc.taxtech.atms.vat.dao.ValidationInfoMapper
;
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.service.JournalEntryImportService
;
...
...
@@ -15,11 +19,16 @@ import java.math.BigDecimal;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
pwc
.
taxtech
.
atms
.
constant
.
Constant
.
WholeYear
;
@Service
public
class
JournalEntryImportServiceImpl
implements
JournalEntryImportService
{
@Autowired
JournalEntryImportMapper
journalEntryImportMapper
;
@Autowired
ValidationInfoMapper
validationInfoMapper
;
@Override
public
PagingResultDto
<
VoucherDto
>
qeryJournalEntryData
(
QueryJeDto
queryJeDto
)
{
PagingResultDto
<
VoucherDto
>
qResult
=
new
PagingResultDto
<
VoucherDto
>();
...
...
@@ -28,7 +37,7 @@ public class JournalEntryImportServiceImpl implements JournalEntryImportService
qResult
.
setCalculateData
(
new
VoucherDto
());
List
<
Voucher
>
pageResultList
=
journalEntryImportMapper
.
pageQuery
(
VatImportType
.
JournalEntry
.
getCode
(),
queryJeDto
.
getPeriodId
(),
queryJeDto
.
getPageInfo
().
getPageIndex
()
*
queryJeDto
.
getPageInfo
().
getPageSize
(),
queryJeDto
.
getPeriodId
(),
queryJeDto
.
getPageInfo
().
getPageIndex
()
*
queryJeDto
.
getPageInfo
().
getPageSize
(),
queryJeDto
.
getPageInfo
().
getPageSize
());
Integer
pageCount
=
journalEntryImportMapper
.
pageQueryCount
(
VatImportType
.
JournalEntry
.
getCode
(),
...
...
@@ -41,9 +50,9 @@ public class JournalEntryImportServiceImpl implements JournalEntryImportService
//查询结果总数
qResult
.
getPageInfo
().
setTotalCount
(
pageCount
);
//分录总数
qResult
.
getCalculateData
().
setItemIDCount
(
pageCount
==
null
?
0
:
pageCount
);
qResult
.
getCalculateData
().
setItemIDCount
(
pageCount
==
null
?
0
:
pageCount
);
//凭证总数
qResult
.
getCalculateData
().
setvIDCount
(
vIDCount
==
null
?
0
:
vIDCount
);
qResult
.
getCalculateData
().
setvIDCount
(
vIDCount
==
null
?
0
:
vIDCount
);
//所有凭证的借贷方sum
BigDecimal
debitSum
=
new
BigDecimal
(
0
);
BigDecimal
creditSum
=
new
BigDecimal
(
0
);
...
...
@@ -63,7 +72,7 @@ public class JournalEntryImportServiceImpl implements JournalEntryImportService
VoucherDto
voucherDto
=
new
VoucherDto
();
try
{
FieldsMapper
.
map
(
voucher
,
voucherDto
);
FieldsMapper
.
map
(
voucher
,
voucherDto
);
}
catch
(
ClassNotFoundException
e
)
{
//TODO replace exception filter (neo)
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
...
...
@@ -74,4 +83,29 @@ public class JournalEntryImportServiceImpl implements JournalEntryImportService
return
qResult
;
}
@Override
public
List
<
ValidationInfoDto
>
getValidationInfoList
(
Integer
type
,
Integer
period
)
{
ValidationInfoExample
validationInfoExample
=
new
ValidationInfoExample
();
if
(
period
.
intValue
()
!=
WholeYear
)
validationInfoExample
.
createCriteria
().
andImportTypeIdEqualTo
(
type
).
andPeriodIdEqualTo
(
period
);
else
validationInfoExample
.
createCriteria
().
andImportTypeIdEqualTo
(
type
);
List
<
ValidationInfo
>
result
=
validationInfoMapper
.
selectByExample
(
validationInfoExample
);
List
<
ValidationInfoDto
>
validationInfoDtos
=
new
ArrayList
<>(
result
.
size
());
result
.
forEach
(
m
->{
ValidationInfoDto
dto
=
new
ValidationInfoDto
();
try
{
FieldsMapper
.
map
(
result
,
dto
);
}
catch
(
ClassNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
});
return
validationInfoDtos
;
}
}
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