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
38a5bf85
Commit
38a5bf85
authored
Apr 19, 2019
by
zhkwei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev_mysql' into dev_mysql
parents
f6a8c8e3
c15b2306
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
339 additions
and
11 deletions
+339
-11
DataImportErrorDto.java
.../java/pwc/taxtech/atms/dto/vatdto/DataImportErrorDto.java
+109
-0
DataImportResponseDto.java
...va/pwc/taxtech/atms/dto/vatdto/DataImportResponseDto.java
+24
-0
DataImportService.java
...java/pwc/taxtech/atms/service/impl/DataImportService.java
+194
-8
organization-manage.ctrl.js
...astructure/organizationManage/organization-manage.ctrl.js
+0
-1
import-certified-invoices-list.ctrl.js
...fied-invoices-list/import-certified-invoices-list.ctrl.js
+6
-1
import-invoice-record.ctrl.js
...mport/import-invoice-record/import-invoice-record.ctrl.js
+6
-1
No files found.
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/DataImportErrorDto.java
0 → 100644
View file @
38a5bf85
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
public
class
DataImportErrorDto
{
@JSONField
(
name
=
"行号"
)
private
Integer
cellLine
;
@JSONField
(
name
=
"发票类型"
)
private
String
invoiceType
;
@JSONField
(
name
=
"开票内容"
)
private
String
invoiceDetail
;
@JSONField
(
name
=
"开票主体"
)
private
String
org
;
@JSONField
(
name
=
"税率"
)
private
String
taxRate
;
@JSONField
(
name
=
"税额"
)
private
String
amountRate
;
@JSONField
(
name
=
"开票金额"
)
private
String
amount
;
@JSONField
(
name
=
"确认/认证日期"
)
private
String
confirmTime
;
@JSONField
(
name
=
"金额"
)
private
String
cilAmount
;
@JSONField
(
name
=
"Sheet"
)
private
Integer
sheet
;
public
Integer
getSheet
()
{
return
sheet
;
}
public
void
setSheet
(
Integer
sheet
)
{
this
.
sheet
=
sheet
;
}
public
String
getConfirmTime
()
{
return
confirmTime
;
}
public
void
setConfirmTime
(
String
confirmTime
)
{
this
.
confirmTime
=
confirmTime
;
}
public
String
getCilAmount
()
{
return
cilAmount
;
}
public
void
setCilAmount
(
String
cilAmount
)
{
this
.
cilAmount
=
cilAmount
;
}
public
Integer
getCellLine
()
{
return
cellLine
;
}
public
void
setCellLine
(
Integer
cellLine
)
{
this
.
cellLine
=
cellLine
;
}
public
String
getInvoiceType
()
{
return
invoiceType
;
}
public
void
setInvoiceType
(
String
invoiceType
)
{
this
.
invoiceType
=
invoiceType
;
}
public
String
getInvoiceDetail
()
{
return
invoiceDetail
;
}
public
void
setInvoiceDetail
(
String
invoiceDetail
)
{
this
.
invoiceDetail
=
invoiceDetail
;
}
public
String
getOrg
()
{
return
org
;
}
public
void
setOrg
(
String
org
)
{
this
.
org
=
org
;
}
public
String
getTaxRate
()
{
return
taxRate
;
}
public
void
setTaxRate
(
String
taxRate
)
{
this
.
taxRate
=
taxRate
;
}
public
String
getAmountRate
()
{
return
amountRate
;
}
public
void
setAmountRate
(
String
amountRate
)
{
this
.
amountRate
=
amountRate
;
}
public
String
getAmount
()
{
return
amount
;
}
public
void
setAmount
(
String
amount
)
{
this
.
amount
=
amount
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/DataImportResponseDto.java
0 → 100644
View file @
38a5bf85
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
java.util.List
;
public
class
DataImportResponseDto
<
T
>
{
private
List
<
DataImportErrorDto
>
dataImportErrorDtos
;
private
List
<
T
>
objectList
;
public
List
<
DataImportErrorDto
>
getDataImportErrorDtos
()
{
return
dataImportErrorDtos
;
}
public
void
setDataImportErrorDtos
(
List
<
DataImportErrorDto
>
dataImportErrorDtos
)
{
this
.
dataImportErrorDtos
=
dataImportErrorDtos
;
}
public
List
<
T
>
getObjectList
()
{
return
objectList
;
}
public
void
setObjectList
(
List
<
T
>
objectList
)
{
this
.
objectList
=
objectList
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/DataImportService.java
View file @
38a5bf85
package
pwc
.
taxtech
.
atms
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
...
...
@@ -37,6 +38,8 @@ import pwc.taxtech.atms.dto.dataimport.DataImportAllParam;
import
pwc.taxtech.atms.dto.dataimport.DataImportParam
;
import
pwc.taxtech.atms.dto.dataimport.DataProcessParam
;
import
pwc.taxtech.atms.dto.ebsdto.EbsCallResp
;
import
pwc.taxtech.atms.dto.vatdto.DataImportErrorDto
;
import
pwc.taxtech.atms.dto.vatdto.DataImportResponseDto
;
import
pwc.taxtech.atms.dto.vatdto.TrialBalanceDto
;
import
pwc.taxtech.atms.dto.vatdto.TrialBalanceParam
;
import
pwc.taxtech.atms.entity.*
;
...
...
@@ -1284,6 +1287,11 @@ public class DataImportService extends BaseService {
throw
new
ServiceException
(
ErrorMessageCN
.
DoNotSelectPeriod
);
}
List
<
DataImportLog
>
dataImportLogs
=
Lists
.
newArrayList
();
//先获取错误信息
Set
<
String
>
orgsNot
=
new
HashSet
<>();
List
<
DataImportErrorDto
>
errorDtos
=
getCILExcelError
(
workbook
,
orgsNot
);
for
(
int
i
=
0
;
i
<
workbook
.
getNumberOfSheets
();
i
++)
{
Sheet
sheet
=
workbook
.
getSheetAt
(
i
);
if
(
isSheetEmpty
(
sheet
))
continue
;
...
...
@@ -1346,6 +1354,17 @@ public class DataImportService extends BaseService {
continue
;
}
String
unit
=
getCellStringValue
(
sheet
.
getRow
(
1
).
getCell
(
11
)).
replace
(
" "
,
""
).
substring
(
3
);
String
identifyNumber
=
""
;
if
(
sheet
.
getLastRowNum
()>
1
){
Row
row1
=
sheet
.
getRow
(
1
);
identifyNumber
=
getCellStringValue
(
row1
.
getCell
(
1
));
//获取纳税人识别号,存在则整个sheet跳过
if
(
orgsNot
.
contains
(
identifyNumber
))
{
continue
;
}
}
for
(
int
j
=
3
;
j
<=
sheet
.
getLastRowNum
();
j
++)
{
Long
plId
=
idService
.
nextId
();
CertifiedInvoicesList
cil
=
new
CertifiedInvoicesList
();
...
...
@@ -1432,13 +1451,18 @@ public class DataImportService extends BaseService {
dataImportLogs
.
add
(
dataImportLog
);
}
}
if
(
addDataImportLog
(
dataImportLogs
)
<
1
)
{
return
OperationResultDto
.
error
(
ErrorMessage
.
SystemError
);
}
if
(!
dataImportLogs
.
stream
().
filter
(
dil
->
!
dil
.
getImportResult
()).
collect
(
Collectors
.
toList
()).
isEmpty
())
{
return
OperationResultDto
.
error
();
}
return
OperationResultDto
.
success
();
//导入成功并将错误信息返回
OperationResultDto
a
=
new
OperationResultDto
();
a
.
setResult
(
true
);
a
.
setResultMsg
(
JSONArray
.
toJSONString
(
errorDtos
));
return
a
;
}
catch
(
ServiceException
e
)
{
throw
e
;
}
catch
(
Exception
e
)
{
...
...
@@ -1446,6 +1470,94 @@ public class DataImportService extends BaseService {
throw
new
ServiceException
(
ErrorMessage
.
SystemError
);
}
}
private
List
<
DataImportErrorDto
>
getCILExcelError
(
Workbook
workbook
,
Set
<
String
>
orgsNot
){
//返回数据及错误信息
List
<
DataImportErrorDto
>
errorDtos
=
Lists
.
newArrayList
();
//添加校验信息
for
(
int
i
=
0
;
i
<
workbook
.
getNumberOfSheets
();
i
++)
{
Sheet
sheet
=
workbook
.
getSheetAt
(
i
);
if
(
isSheetEmpty
(
sheet
))
continue
;
//获取纳税人识别号
String
identifyNumber
=
""
;
if
(
sheet
.
getLastRowNum
()>
1
){
Row
row1
=
sheet
.
getRow
(
1
);
identifyNumber
=
getCellStringValue
(
row1
.
getCell
(
1
));
}
//先循环校验字段
for
(
int
j
=
3
;
j
<=
sheet
.
getLastRowNum
();
j
++)
{
Row
row
=
sheet
.
getRow
(
j
);
//校验纳税人识别号,存储不合规的
validCILExcelCell
(
identifyNumber
,
row
,
orgsNot
);
DataImportErrorDto
importErrorDto
=
new
DataImportErrorDto
();
//添加错误信息
importErrorDto
.
setCellLine
(
j
);
importErrorDto
.
setSheet
(
i
+
1
);
if
(
validCILExcelCellError
(
row
,
importErrorDto
))
{
errorDtos
.
add
(
importErrorDto
);
}
}
}
return
errorDtos
;
}
/**
* 导入分发-已认证发票清单,校验“金额”、“税额”、“确认/认证日期”、“发票类型”任意不为空
* 且发票类型值只能包含“增值税专票”、“机动车发票”
* 存在校验1或校验2不通过的(纳税人识别号)不进行导入
*
* @param
* @return
*/
private
Set
<
String
>
validCILExcelCell
(
String
identifyNumber
,
Row
row3
,
Set
<
String
>
orgsNot
)
{
List
<
String
>
invoiceTypes
=
Arrays
.
asList
(
new
String
[]{
"增值税专票"
,
"机动车发票"
});
//发票类型
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row3
.
getCell
(
10
))))
{
orgsNot
.
add
(
identifyNumber
);
}
else
if
(!
invoiceTypes
.
contains
(
getCellStringValue
(
row3
.
getCell
(
10
))))
{
orgsNot
.
add
(
identifyNumber
);
}
//金额
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row3
.
getCell
(
6
))))
{
orgsNot
.
add
(
identifyNumber
);
}
//税额
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row3
.
getCell
(
7
))))
{
orgsNot
.
add
(
identifyNumber
);
}
//确认日期
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row3
.
getCell
(
9
))))
{
orgsNot
.
add
(
identifyNumber
);
}
return
orgsNot
;
}
private
Boolean
validCILExcelCellError
(
Row
row3
,
DataImportErrorDto
importErrorDto
)
{
List
<
String
>
invoiceTypes
=
Arrays
.
asList
(
new
String
[]{
"增值税专票"
,
"机动车发票"
});
Boolean
fg
=
false
;
//发票类型
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row3
.
getCell
(
10
))))
{
fg
=
true
;
importErrorDto
.
setInvoiceType
(
"为空"
);
}
else
if
(!
invoiceTypes
.
contains
(
getCellStringValue
(
row3
.
getCell
(
10
))))
{
fg
=
true
;
importErrorDto
.
setInvoiceType
(
"错误"
);
}
//金额
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row3
.
getCell
(
6
))))
{
fg
=
true
;
importErrorDto
.
setCilAmount
(
"为空"
);
}
//税额
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row3
.
getCell
(
7
))))
{
fg
=
true
;
importErrorDto
.
setTaxRate
(
"为空"
);
}
//确认日期
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row3
.
getCell
(
9
))))
{
fg
=
true
;
importErrorDto
.
setConfirmTime
(
"为空"
);
}
return
fg
;
}
public
OperationResultDto
importIRExcelFile
(
MultipartFile
file
,
List
<
String
>
orgIds
,
String
periodDate
,
Integer
importType
)
throws
ServiceException
{
try
{
...
...
@@ -1456,10 +1568,14 @@ public class DataImportService extends BaseService {
}
Integer
tmsPeriod
=
DateUtils
.
strToPeriod
(
periodDate
);
List
<
DataImportLog
>
dataImportLogs
=
Lists
.
newArrayList
();
List
<
DataImportErrorDto
>
dataImportResponseDto1
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
workbook
.
getNumberOfSheets
();
i
++)
{
Sheet
sheet
=
workbook
.
getSheetAt
(
i
);
if
(
isSheetEmpty
(
sheet
))
continue
;
List
<
InvoiceRecord
>
irs
=
generalIRs
(
sheet
);
DataImportResponseDto
<
InvoiceRecord
>
dataImportResponseDto
=
generalIRs
(
sheet
);
dataImportResponseDto1
.
addAll
(
dataImportResponseDto
.
getDataImportErrorDtos
());
//List<InvoiceRecord> irs = generalIRs(sheet);
List
<
InvoiceRecord
>
irs
=
dataImportResponseDto
.
getObjectList
();
if
(
irs
.
size
()
<
1
)
continue
;
// 根据主体分组处理
Map
<
String
,
List
<
InvoiceRecord
>>
atsGroupRes
=
...
...
@@ -1474,7 +1590,12 @@ public class DataImportService extends BaseService {
if
(
isSuccess
<
1
)
{
return
OperationResultDto
.
error
(
ErrorMessage
.
ImportNotMatch
);
}
return
OperationResultDto
.
success
();
//导入成功并将错误信息返回
OperationResultDto
a
=
new
OperationResultDto
();
a
.
setResult
(
true
);
a
.
setResultMsg
(
JSONArray
.
toJSONString
(
dataImportResponseDto1
));
return
a
;
}
catch
(
ServiceException
e
)
{
throw
e
;
}
catch
(
Exception
e
)
{
...
...
@@ -1595,9 +1716,33 @@ public class DataImportService extends BaseService {
return
rlits
;
}
private
List
<
InvoiceRecord
>
generalIRs
(
Sheet
sheet
)
{
private
DataImportResponseDto
<
InvoiceRecord
>
generalIRs
(
Sheet
sheet
)
{
List
<
InvoiceRecord
>
irs
=
Lists
.
newArrayList
();
List
<
DataImportErrorDto
>
errorDtos
=
Lists
.
newArrayList
();
Set
<
String
>
orgsNot
=
new
HashSet
<>();
//先循环校验字段
for
(
int
j
=
1
;
j
<=
sheet
.
getLastRowNum
();
j
++)
{
Row
row
=
sheet
.
getRow
(
j
);
DataImportErrorDto
importErrorDto
=
new
DataImportErrorDto
();
if
(
null
==
row
.
getCell
(
0
))
{
continue
;
}
Boolean
flag
=
false
;
//所属机构
importErrorDto
.
setCellLine
(
j
);
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row
.
getCell
(
1
))))
{
flag
=
true
;
importErrorDto
.
setOrg
(
"为空"
);
}
//如果存在有错误的机构也跳过
if
(
validIRExcelCellError
(
row
,
importErrorDto
))
{
flag
=
true
;
}
if
(
flag
){
errorDtos
.
add
(
importErrorDto
);
}
}
for
(
int
j
=
1
;
j
<=
sheet
.
getLastRowNum
();
j
++)
{
InvoiceRecord
ir
=
new
InvoiceRecord
();
Long
irId
=
idService
.
nextId
();
...
...
@@ -1641,19 +1786,23 @@ public class DataImportService extends BaseService {
ir
.
setSource
(
getCellStringValue
(
row
.
getCell
(
23
)));
irs
.
add
(
ir
);
}
return
irs
;
//返回数据及错误信息
DataImportResponseDto
<
InvoiceRecord
>
dataImportResponseDto
=
new
DataImportResponseDto
<
InvoiceRecord
>();
dataImportResponseDto
.
setObjectList
(
irs
);
dataImportResponseDto
.
setDataImportErrorDtos
(
errorDtos
);
return
dataImportResponseDto
;
}
/**
* 导入分发-已开增值税发票记录,校验1-发票类型、开票内容、所属机构、税率、税额、开票金额任意不为空;
* 且校验2-校验发票类型的值只能包含“增值税专用发票”、“增值税普通发票”、“增值税电子发票”
和“机动车发票”,
* 且校验2-校验发票类型的值只能包含“增值税专用发票”、“增值税普通发票”、“增值税电子发票”
* 存在校验1或校验2不通过的机构不进行导入
*
* @param row
* @return
*/
private
Set
<
String
>
validIRExcelCell
(
Row
row
,
Set
<
String
>
orgsNot
)
{
List
<
String
>
invoiceTypes
=
Arrays
.
asList
(
new
String
[]{
"增值税专用发票"
,
"增值税普通发票"
,
"增值税电子发票"
,
"机动车发票"
});
List
<
String
>
invoiceTypes
=
Arrays
.
asList
(
new
String
[]{
"增值税专用发票"
,
"增值税普通发票"
,
"增值税电子发票"
});
String
orgName
=
getCellStringValue
(
row
.
getCell
(
1
));
//发票类型
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row
.
getCell
(
3
))))
{
...
...
@@ -1669,12 +1818,49 @@ public class DataImportService extends BaseService {
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row
.
getCell
(
5
))))
{
orgsNot
.
add
(
orgName
);
}
//税
额
//税
率
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row
.
getCell
(
20
))))
{
orgsNot
.
add
(
orgName
);
}
//税额
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row
.
getCell
(
21
))))
{
orgsNot
.
add
(
orgName
);
}
return
orgsNot
;
}
private
Boolean
validIRExcelCellError
(
Row
row
,
DataImportErrorDto
importErrorDto
)
{
List
<
String
>
invoiceTypes
=
Arrays
.
asList
(
new
String
[]{
"增值税专用发票"
,
"增值税普通发票"
,
"增值税电子发票"
});
Boolean
fg
=
false
;
//发票类型
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row
.
getCell
(
3
))))
{
fg
=
true
;
importErrorDto
.
setInvoiceType
(
"为空"
);
}
else
if
(!
invoiceTypes
.
contains
(
getCellStringValue
(
row
.
getCell
(
3
))))
{
fg
=
true
;
importErrorDto
.
setInvoiceType
(
"错误"
);
}
//开票内容
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row
.
getCell
(
4
))))
{
fg
=
true
;
importErrorDto
.
setInvoiceDetail
(
"为空"
);
}
//开票金额
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row
.
getCell
(
5
))))
{
fg
=
true
;
importErrorDto
.
setAmount
(
"为空"
);
}
//税率
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row
.
getCell
(
20
))))
{
fg
=
true
;
importErrorDto
.
setTaxRate
(
"为空"
);
}
//税额
if
(
StringUtils
.
isBlank
(
getCellStringValue
(
row
.
getCell
(
21
))))
{
fg
=
true
;
importErrorDto
.
setAmountRate
(
"为空"
);
}
return
fg
;
}
private
List
<
AdjustmentTable
>
generalATs
(
Sheet
sheet
)
{
List
<
AdjustmentTable
>
ats
=
Lists
.
newArrayList
();
...
...
atms-web/src/main/webapp/app/admin/infrastructure/organizationManage/organization-manage.ctrl.js
View file @
38a5bf85
...
...
@@ -2150,7 +2150,6 @@
// TODO 将这个方法添加到切换功能里
$scope
.
updateOrgExtraCancel
=
function
()
{
$scope
.
selectCompanyExtra
=
$scope
.
comExtraOldData
;
$scope
.
selectCompanyExtra
.
unifiedSocialCreditCode
=
$scope
.
selectCompany
.
taxPayerNumber
;
$scope
.
editOrgExtraModel
=
$scope
.
editOldData
;
generalSelectCompanyExtraText
();
cancelWebChange
();
...
...
atms-web/src/main/webapp/app/common/controls/import/import-certified-invoices-list/import-certified-invoices-list.ctrl.js
View file @
38a5bf85
...
...
@@ -190,7 +190,12 @@
if
(
ret
.
result
)
{
logDto
.
UpdateState
=
$translate
.
instant
(
'ImportSuccess'
);
vatOperationLogService
.
addOperationLog
(
logDto
);
SweetAlert
.
success
(
$translate
.
instant
(
'ImportSuccess'
));
if
(
ret
.
resultMsg
){
swal
(
$translate
.
instant
(
'ImportSuccess'
),
ret
.
resultMsg
,
"warning"
);
//SweetAlert.warning(ret.resultMsg);
}
else
{
SweetAlert
.
success
(
$translate
.
instant
(
'ImportSuccess'
));
}
}
else
{
if
(
ret
.
resultMsg
&&
ret
.
resultMsg
.
length
>
0
)
{
SweetAlert
.
warning
(
$translate
.
instant
(
ret
.
resultMsg
));
...
...
atms-web/src/main/webapp/app/common/controls/import/import-invoice-record/import-invoice-record.ctrl.js
View file @
38a5bf85
...
...
@@ -197,7 +197,12 @@
if
(
ret
.
result
)
{
logDto
.
UpdateState
=
$translate
.
instant
(
'ImportSuccess'
);
vatOperationLogService
.
addOperationLog
(
logDto
);
SweetAlert
.
success
(
$translate
.
instant
(
'ImportSuccess'
));
if
(
ret
.
resultMsg
){
swal
(
$translate
.
instant
(
'ImportSuccess'
),
ret
.
resultMsg
,
"warning"
);
//SweetAlert.warning(ret.resultMsg);
}
else
{
SweetAlert
.
success
(
$translate
.
instant
(
'ImportSuccess'
));
}
$scope
.
fileNameShow
=
false
;
}
else
{
if
(
ret
.
resultMsg
&&
ret
.
resultMsg
.
length
>
0
)
{
...
...
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