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
9f3ef673
Commit
9f3ef673
authored
Feb 22, 2019
by
zhkwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CIT数据导入功能模块
parent
01a3158a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
18 deletions
+44
-18
EnumCitImportType.java
...va/pwc/taxtech/atms/constant/enums/EnumCitImportType.java
+23
-0
CitImportExcelController.java
...pwc/taxtech/atms/controller/CitImportExcelController.java
+4
-13
CitImportExcelServiceImpl.java
.../taxtech/atms/service/impl/CitImportExcelServiceImpl.java
+17
-5
No files found.
atms-api/src/main/java/pwc/taxtech/atms/constant/enums/EnumCitImportType.java
0 → 100644
View file @
9f3ef673
package
pwc
.
taxtech
.
atms
.
constant
.
enums
;
public
enum
EnumCitImportType
{
Undefined
(
0
),
JournalAdjust
(
1
),
BalanceSheet
(
2
),
RedLetterInfoTable
(
3
),
AdjustmentTable
(
4
),
CashFlow
(
5
),
CoupaPurchasingReport
(
6
),
InvoiceData
(
7
)
;
private
Integer
code
;
EnumCitImportType
(
Integer
code
)
{
this
.
code
=
code
;
}
public
Integer
getCode
()
{
return
code
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/controller/CitImportExcelController.java
View file @
9f3ef673
...
...
@@ -34,10 +34,7 @@ public class CitImportExcelController {
*/
@RequestMapping
(
value
=
"/journalAdjustImport"
,
method
=
RequestMethod
.
POST
)
public
@ResponseBody
ApiResultDto
assetsImport
(
@RequestParam
MultipartFile
file
,
@RequestParam
String
filename
,
@RequestParam
String
tempFileName
,
@RequestParam
String
projectId
){
ApiResultDto
assetsImport
(
@RequestParam
MultipartFile
file
,
@RequestParam
String
periodDate
,
@RequestParam
Integer
importType
){
logger
.
info
(
"CIT调整版日记账导入"
);
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
try
{
...
...
@@ -49,16 +46,10 @@ public class CitImportExcelController {
}
logger
.
debug
(
"file name: "
+
file
.
getOriginalFilename
());
InputStream
input
=
null
;
try
{
input
=
file
.
getInputStream
();
//调用资产导入业务逻辑
}
catch
(
IOException
e
)
{
apiResultDto
.
setCode
(-
2
);
apiResultDto
.
setMessage
(
"获取文件流失败"
);
logger
.
warn
(
"获取文件流失败"
);
return
apiResultDto
;
}
input
=
file
.
getInputStream
();
//调用资产导入业务逻辑
citImportExcelService
.
importJournalAdjust
(
input
,
file
.
getOriginalFilename
(),
periodDate
,
importType
);
apiResultDto
.
setCode
(
1
);
apiResultDto
.
setMessage
(
"资产导入成功"
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/CitImportExcelServiceImpl.java
View file @
9f3ef673
...
...
@@ -17,6 +17,7 @@ import pwc.taxtech.atms.common.message.ErrorMessage;
import
pwc.taxtech.atms.common.message.ErrorMessageCN
;
import
pwc.taxtech.atms.common.util.DateUtils
;
import
pwc.taxtech.atms.constant.Constant
;
import
pwc.taxtech.atms.constant.enums.EnumCitImportType
;
import
pwc.taxtech.atms.constant.enums.EnumImportType
;
import
pwc.taxtech.atms.constant.enums.EnumTbImportType
;
import
pwc.taxtech.atms.dao.*
;
...
...
@@ -68,7 +69,7 @@ public class CitImportExcelServiceImpl extends BaseService {
* @throws InvalidFormatException
* @throws ParseException
*/
public
OperationResultDto
importJournalAdjust
(
InputStream
inputStream
,
String
fileName
,
Integer
importType
)
throws
IOException
,
InvalidFormatException
,
ParseException
{
public
OperationResultDto
importJournalAdjust
(
InputStream
inputStream
,
String
fileName
,
String
periodDate
,
Integer
importType
)
throws
IOException
,
InvalidFormatException
,
ParseException
{
OperationResultDto
<
Object
>
saveResult
=
new
OperationResultDto
<>();
Workbook
workbook
=
fileService
.
getWorkbook
(
inputStream
,
fileName
,
"citJournalAdjust"
);
if
(
workbook
==
null
){
...
...
@@ -85,6 +86,7 @@ public class CitImportExcelServiceImpl extends BaseService {
}
List
<
CitJournalEntryAdjust
>
journalAdjustList
=
new
ArrayList
<>();
List
<
CitDataImportLog
>
citDataImportLogList
=
new
ArrayList
<>();
Integer
period
=
new
Integer
(
CitCommonUtil
.
getValue
(
sheet
.
getRow
(
1
).
getCell
(
2
)).
toString
().
replace
(
"-"
,
""
));
String
companyName
=
CitCommonUtil
.
getValue
(
sheet
.
getRow
(
1
).
getCell
(
17
)).
toString
();
String
companyCode
=
CitCommonUtil
.
getValue
(
sheet
.
getRow
(
1
).
getCell
(
9
)).
toString
();;
...
...
@@ -119,10 +121,15 @@ public class CitImportExcelServiceImpl extends BaseService {
}
int
insertBatchNum
=
citJournalEntryAdjustMapper
.
insertBatch
(
journalAdjustList
);
CitDataImportLog
citDataImportLog
=
generalCitDataImportLog
(
companyCode
,
orgId
,
taxPayerId
,
Enum
ImportType
.
CashFlow
.
getCode
(),
period
/
100
,
Enum
CitImportType
.
JournalAdjust
.
getCode
(),
period
/
100
,
0
,
period
%
100
,
companyName
,
"
1
"
);
companyName
,
"
日记账调整
"
);
citDataImportLog
.
setRecordSize
(
insertBatchNum
);
citDataImportLogList
.
add
(
citDataImportLog
);
if
(
EnumTbImportType
.
CoverImport
.
getCode
().
equals
(
importType
)){
updateImportLog
(
1
);
}
addDataImportLog
(
citDataImportLogList
);
return
null
;
}
...
...
@@ -147,7 +154,7 @@ public class CitImportExcelServiceImpl extends BaseService {
* @throws InvalidFormatException
* @throws ParseException
*/
public
OperationResultDto
importTrialBalance
(
InputStream
inputStream
,
String
fileName
,
Integer
importType
)
throws
IOException
,
InvalidFormatException
,
ParseException
{
public
OperationResultDto
importTrialBalance
(
InputStream
inputStream
,
String
fileName
,
String
periodDate
,
Integer
importType
)
throws
IOException
,
InvalidFormatException
,
ParseException
{
OperationResultDto
<
Object
>
saveResult
=
new
OperationResultDto
<>();
Workbook
workbook
=
fileService
.
getWorkbook
(
inputStream
,
fileName
,
"citTrialBalance"
);
if
(
workbook
==
null
){
...
...
@@ -261,9 +268,14 @@ public class CitImportExcelServiceImpl extends BaseService {
}
private
int
updateImportLog
(
Integer
type
){
int
updateDisplayOld
=
citDataImportLogMapper
.
updateDisplayOld
(
type
);
return
updateDisplayOld
;
}
private
int
addDataImportLog
(
List
<
CitDataImportLog
>
dataImportLogs
)
{
//在添加import log前先将原来导入的数据版本置为旧版本
citDataImportLogMapper
.
updateDisplayOld
(
dataImportLogs
.
get
(
0
).
getType
());
//
citDataImportLogMapper.updateDisplayOld(dataImportLogs.get(0).getType());
int
res
=
0
;
for
(
CitDataImportLog
dataImportLog
:
dataImportLogs
)
{
res
+=
citDataImportLogMapper
.
insertSelective
(
dataImportLog
);
...
...
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