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
703733d3
Commit
703733d3
authored
Jul 22, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev] financeDataUpload impl and importFinancedata impl
parent
1119f37d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
135 additions
and
0 deletions
+135
-0
MyAsserts.java
...src/main/java/pwc/taxtech/atms/common/util/MyAsserts.java
+1
-0
VatErpImportValidation.java
...ava/pwc/taxtech/atms/constant/VatErpImportValidation.java
+2
-0
ImportType.java
...main/java/pwc/taxtech/atms/constant/enums/ImportType.java
+16
-0
FinanceDataImportController.java
.../taxtech/atms/controller/FinanceDataImportController.java
+0
-0
FinanceDataImportServiceImpl.java
...h/atms/vat/service/impl/FinanceDataImportServiceImpl.java
+116
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/util/MyAsserts.java
View file @
703733d3
package
pwc
.
taxtech
.
atms
.
common
.
util
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.exception.ApiException
;
import
pwc.taxtech.atms.exception.FormulaException
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/constant/VatErpImportValidation.java
View file @
703733d3
...
...
@@ -6,6 +6,8 @@ public class VatErpImportValidation {
public
static
final
String
BalanceTb
=
"Balance"
;
public
static
final
String
AccountRemapTb
=
"AccountRemap"
;
public
static
final
String
VoucherTbName
=
"Voucher"
;
public
static
final
String
ImportMethod_OneClick
=
"oneClick"
;
public
static
final
String
ImportMethod_Universal
=
"universal"
;
public
static
final
String
Const_ComBalanceAcctValidate
=
"试算平衡表科目存在于企业科目列表中"
;
public
static
final
String
Const_ComBalanceAcctUnValidate
=
"试算平衡表中出现的科目不在科目表中"
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/constant/enums/ImportType.java
0 → 100644
View file @
703733d3
package
pwc
.
taxtech
.
atms
.
constant
.
enums
;
public
enum
ImportType
{
Override
(
0
),
Append
(
1
);
private
Integer
code
;
ImportType
(
Integer
code
)
{
this
.
code
=
code
;
}
public
Integer
getCode
()
{
return
code
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/controller/FinanceDataImportController.java
View file @
703733d3
This diff is collapsed.
Click to expand it.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/FinanceDataImportServiceImpl.java
View file @
703733d3
package
pwc
.
taxtech
.
atms
.
vat
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.collect.Lists
;
import
org.apache.ibatis.jdbc.ScriptRunner
;
import
org.apache.ibatis.session.SqlSession
;
import
org.mybatis.spring.SqlSessionTemplate
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
pwc.taxtech.atms.constant.VatErpImportValidation
;
import
pwc.taxtech.atms.constant.enums.EnumValidationType
;
import
pwc.taxtech.atms.constant.enums.ErpCheckType
;
import
pwc.taxtech.atms.constant.enums.ImageType
;
import
pwc.taxtech.atms.dto.FieldsMapper
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.vatdto.DataCheckDto
;
import
pwc.taxtech.atms.dto.vatdto.ImportDataDto
;
import
pwc.taxtech.atms.dto.vatdto.VoucherAccountMto
;
import
pwc.taxtech.atms.dto.vatdto.VoucherBalanceDto
;
import
pwc.taxtech.atms.dto.vatdto.VoucherDto
;
...
...
@@ -21,10 +30,13 @@ import pwc.taxtech.atms.vat.entity.VoucherExample;
import
sun.misc.BASE64Encoder
;
import
javax.imageio.ImageIO
;
import
javax.sound.sampled.DataLine
;
import
java.awt.image.BufferedImage
;
import
java.io.BufferedReader
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.StringReader
;
import
java.net.MalformedURLException
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
...
...
@@ -45,6 +57,9 @@ public class FinanceDataImportServiceImpl {
private
ValidationInfoMapper
validationInfoMapper
;
@Autowired
private
VoucherMapper
voucherMapper
;
@Autowired
private
SqlSessionTemplate
dynamicSqlSessionTemplate
;
private
Logger
logger
=
LoggerFactory
.
getLogger
(
FinanceDataImportServiceImpl
.
class
);
public
OperationResultDto
<
List
<
DataCheckDto
>>
getBasicValidationResults
(
String
userId
)
{
Integer
number
=
1
;
...
...
@@ -322,4 +337,105 @@ public class FinanceDataImportServiceImpl {
private
List
<
ValidationInfo
>
getValidationData
(
Integer
typeId
)
{
return
getValidationData
(
typeId
,
null
);
}
public
Boolean
ClearTable
(
int
period
,
Boolean
isClearCustTb
)
{
if
(
isClearCustTb
==
null
)
isClearCustTb
=
true
;
ClearCustTable
(
period
,
VatErpImportValidation
.
CompanyBalanceTbName
);
if
(
isClearCustTb
)
{
ClearCustTable
(
period
,
VatErpImportValidation
.
CustBalanceTb
);
}
ClearCustTable
(
period
,
VatErpImportValidation
.
BalanceTb
);
ClearVoucherTable
(
period
);
ClearRemapTable
(
period
);
return
true
;
}
private
void
ClearVoucherTable
(
int
period
)
{
String
command
=
IsImportByPeriod
(
period
)
?
"DELETE FROM "
+
VatErpImportValidation
.
VoucherTbName
+
" WHERE Period = "
+
period
:
"TRUNCATE TABLE "
+
VatErpImportValidation
.
VoucherTbName
;
exeCommand
(
command
);
}
private
boolean
IsImportByPeriod
(
int
period
)
{
return
period
>=
0
;
}
private
void
ClearRemapTable
(
int
period
)
{
String
command
=
IsImportByPeriod
(
period
)
?
"DELETE FROM "
+
VatErpImportValidation
.
AccountRemapTb
+
" WHERE Period = "
+
period
:
"TRUNCATE TABLE "
+
VatErpImportValidation
.
AccountRemapTb
;
exeCommand
(
command
);
}
private
void
ClearCustTable
(
int
period
,
String
tbName
)
{
String
command
=
""
;
if
(
IsImportByPeriod
(
period
)
&&
tbName
!=
VatErpImportValidation
.
BalanceTb
)
{
if
(
tbName
==
VatErpImportValidation
.
CompanyBalanceTbName
)
{
command
=
String
.
format
(
"DELETE FROM %s WHERE PeriodId = %s"
,
tbName
,
period
);
}
if
(
tbName
==
VatErpImportValidation
.
CustBalanceTb
)
{
command
=
String
.
format
(
"DELETE FROM %s WHERE PeriodId >= %s"
,
tbName
,
period
);
}
}
else
{
command
=
"TRUNCATE TABLE "
+
tbName
;
}
exeCommand
(
command
);
}
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
));
}
}
public
void
DeleteErpValidation
()
{
List
<
Integer
>
deleteTypes
=
Lists
.<
Integer
>
newArrayList
(
EnumValidationType
.
ErpBasicCheck
.
getCode
(),
EnumValidationType
.
ErpCorrect
.
getCode
(),
EnumValidationType
.
ErpDuplicate
.
getCode
());
ValidationInfoExample
example
=
new
ValidationInfoExample
();
example
.
createCriteria
().
andImportTypeIdIn
(
deleteTypes
);
validationInfoMapper
.
deleteByExample
(
example
);
}
public
ImportDataDto
ImportData
(
String
projectYear
,
String
importMethod
,
String
importType
,
Integer
period
,
String
fileFullPath
,
MultipartFile
f
,
String
schemaPath
,
String
userId
)
{
logger
.
info
(
"开始导入数据: importMethod: {0}, importType: {1}"
,
importMethod
,
importType
);
ImportDataDto
importResult
=
new
ImportDataDto
();
String
ZipFileFolder
=
""
;
try
{
if
(
importMethod
==
VatErpImportValidation
.
ImportMethod_OneClick
)
{
// UnZipDataFile(fileFullPath, schemaPath);//todo: import data tobe continue(neo)
// ImportBalance(ZipFileFolder, period);
// ImportVoucher(ZipFileFolder, period);
}
if
(
importMethod
==
VatErpImportValidation
.
ImportMethod_Universal
)
{
// UniversalImportData(period, fileFullPath, f.getName(), schemaPath);
}
// SynAccountFromTaxAdmin(period, userId);
importResult
.
Result
=
true
;
}
catch
(
Exception
ex
)
{
importResult
.
Result
=
false
;
}
return
importResult
;
}
public
void
UpdateCompanyBalanceNullValue
()
{
String
command
=
"UPDATE CompanyBalance SET BegDebitBal = 0 WHERE BegDebitBal IS NULL"
+
" UPDATE CompanyBalance SET BegCreditBal = 0 WHERE BegCreditBal IS NULL"
+
" UPDATE CompanyBalance SET BegBal = 0 WHERE BegBal IS NULL"
+
" UPDATE CompanyBalance SET EndBal = 0 WHERE EndBal IS NULL"
+
" UPDATE CompanyBalance SET EndDebitBal = 0 WHERE EndDebitBal IS NULL"
+
" UPDATE CompanyBalance SET EndCreditBal = 0 WHERE EndCreditBal IS NULL"
+
" UPDATE CompanyBalance SET DebitBal = 0 WHERE DebitBal IS NULL"
+
" UPDATE CompanyBalance SET CreditBal = 0 WHERE CreditBal IS NULL"
;
exeCommand
(
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