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
d44953b1
Commit
d44953b1
authored
Jun 11, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TEMP] add import rebance impl
parent
62c08f39
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
335 additions
and
5 deletions
+335
-5
EnumTbImportType.java
...ava/pwc/taxtech/atms/constant/enums/EnumTbImportType.java
+17
-0
EnumValidationType.java
...a/pwc/taxtech/atms/constant/enums/EnumValidationType.java
+26
-0
ProjectImportDataType.java
...wc/taxtech/atms/constant/enums/ProjectImportDataType.java
+23
-0
ServiceType.java
...ain/java/pwc/taxtech/atms/constant/enums/ServiceType.java
+21
-0
CitTBDataImportMapper.java
...main/java/pwc/taxtech/atms/dao/CitTBDataImportMapper.java
+2
-1
DataImportMapper.java
.../src/main/java/pwc/taxtech/atms/dao/DataImportMapper.java
+21
-0
DataImportedStatusDto.java
.../pwc/taxtech/atms/dto/taxadmin/DataImportedStatusDto.java
+114
-0
DataImportServiceImpl.java
.../pwc/taxtech/atms/service/impl/DataImportServiceImpl.java
+109
-2
IdentityServiceImpl.java
...va/pwc/taxtech/atms/service/impl/IdentityServiceImpl.java
+1
-1
ProjectInfoServiceImpl.java
...pwc/taxtech/atms/service/impl/ProjectInfoServiceImpl.java
+1
-1
No files found.
atms-api/src/main/java/pwc/taxtech/atms/constant/enums/EnumTbImportType.java
0 → 100644
View file @
d44953b1
package
pwc
.
taxtech
.
atms
.
constant
.
enums
;
public
enum
EnumTbImportType
{
Import
(
0
),
CoverImport
(
1
),
AddImport
(
2
);
private
Integer
code
;
EnumTbImportType
(
Integer
code
)
{
this
.
code
=
code
;
}
public
Integer
getCode
()
{
return
code
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/constant/enums/EnumValidationType.java
0 → 100644
View file @
d44953b1
package
pwc
.
taxtech
.
atms
.
constant
.
enums
;
public
enum
EnumValidationType
{
TrialBalance
(
0
),
InputVoice
(
1
),
OutputVoice
(
2
),
ErpDuplicate
(
3
),
//重复数据
ErpBasicCheck
(
4
),
//基础数据校验
ErpCorrect
(
5
),
//数据正确性
JournalEntry
(
6
),
InputVoiceItem
(
7
),
CustomInvoice
(
8
),
AccountMapping
(
9
),
InvoiceMapping
(
10
),
VoucherMapping
(
11
);
private
Integer
code
;
EnumValidationType
(
Integer
code
)
{
this
.
code
=
code
;
}
public
Integer
getCode
()
{
return
code
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/constant/enums/ProjectImportDataType.java
0 → 100644
View file @
d44953b1
package
pwc
.
taxtech
.
atms
.
constant
.
enums
;
public
enum
ProjectImportDataType
{
AuditAdjust
(
1
),
//审计调整
CustomInvoice
(
2
),
//海关清单
JournalEntry
(
3
),
//序时账
ErpData
(
4
),
//财务数据
InputInvoice
(
5
),
//进项发票
InvoiceMapping
(
6
),
//发票对应
OutputInvoice
(
7
),
//销项发票
TrialBalance
(
8
),
//试算平衡表
VoucherMapping
(
9
);
//凭证对应
private
Integer
code
;
ProjectImportDataType
(
Integer
code
)
{
this
.
code
=
code
;
}
public
Integer
getCode
()
{
return
code
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/constant/enums/ServiceType.java
0 → 100644
View file @
d44953b1
package
pwc
.
taxtech
.
atms
.
constant
.
enums
;
public
enum
ServiceType
{
Administration
(
1
),
//后台admin
VAT
(
2
),
//增值税申报分析
AM
(
3
),
//电子税务管理
FDD
(
4
),
//财务尽职调查
Dashboard
(
5
),
//税务管理平台
CIT
(
6
),
// 企业所得税
TCS
(
7
);
//电子税务审计
private
Integer
code
;
ServiceType
(
Integer
code
)
{
this
.
code
=
code
;
}
public
Integer
getCode
()
{
return
code
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/dao/CitTBDataImportMapper.java
View file @
d44953b1
...
...
@@ -3,10 +3,11 @@ package pwc.taxtech.atms.dao;
import
org.apache.ibatis.annotations.Delete
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
pwc.taxtech.atms.MyMapper
;
import
pwc.taxtech.atms.constant.VatErpImportValidation
;
@Mapper
public
interface
CitTBDataImportMapper
{
public
interface
CitTBDataImportMapper
extends
MyMapper
{
@Delete
(
"<script>"
+
"<if test=\"tbName =='"
+
VatErpImportValidation
.
CompanyBalanceTbName
+
"' \">"
+
" DELETE FROM #{tbName} WHERE PeriodId = #{period}"
+
...
...
atms-api/src/main/java/pwc/taxtech/atms/dao/DataImportMapper.java
0 → 100644
View file @
d44953b1
package
pwc
.
taxtech
.
atms
.
dao
;
import
org.apache.ibatis.annotations.Delete
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Update
;
import
pwc.taxtech.atms.MyMapper
;
@Mapper
public
interface
DataImportMapper
extends
MyMapper
{
@Delete
(
"DELETE FROM #{tbName} WHERE Period =#{period}"
)
Integer
deleteByNameAndPeriod
(
@Param
(
"tbName"
)
String
tbName
,
@Param
(
"period"
)
Integer
period
);
@Update
(
"TRUNCATE TABLE #{tbName}"
)
Integer
truncateByName
(
@Param
(
"tbName"
)
String
tbName
);
@Delete
(
"DELETE FROM ValidationInfo WHERE PeriodId = #{period}and ImportTypeId=#{typeId} "
)
void
deleteTbValidation
(
@Param
(
"period"
)
int
period
,
@Param
(
"typeId"
)
Integer
typeId
);
}
atms-api/src/main/java/pwc/taxtech/atms/dto/taxadmin/DataImportedStatusDto.java
0 → 100644
View file @
d44953b1
package
pwc
.
taxtech
.
atms
.
dto
.
taxadmin
;
import
java.util.Date
;
public
class
DataImportedStatusDto
{
private
String
id
;
private
String
projectId
;
private
String
dbName
;
private
String
organizationId
;
private
Integer
year
;
private
Integer
period
;
private
Integer
dataType
;
private
Integer
totalCount
;
private
Integer
exceptionCount
;
private
Integer
successedCount
;
private
Date
startTime
;
private
Date
endTime
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getProjectId
()
{
return
projectId
;
}
public
void
setProjectId
(
String
projectId
)
{
this
.
projectId
=
projectId
;
}
public
String
getDbName
()
{
return
dbName
;
}
public
void
setDbName
(
String
dbName
)
{
this
.
dbName
=
dbName
;
}
public
String
getOrganizationId
()
{
return
organizationId
;
}
public
void
setOrganizationId
(
String
organizationId
)
{
this
.
organizationId
=
organizationId
;
}
public
Integer
getYear
()
{
return
year
;
}
public
void
setYear
(
Integer
year
)
{
this
.
year
=
year
;
}
public
Integer
getPeriod
()
{
return
period
;
}
public
void
setPeriod
(
Integer
period
)
{
this
.
period
=
period
;
}
public
Integer
getDataType
()
{
return
dataType
;
}
public
void
setDataType
(
Integer
dataType
)
{
this
.
dataType
=
dataType
;
}
public
Integer
getTotalCount
()
{
return
totalCount
;
}
public
void
setTotalCount
(
Integer
totalCount
)
{
this
.
totalCount
=
totalCount
;
}
public
Integer
getExceptionCount
()
{
return
exceptionCount
;
}
public
void
setExceptionCount
(
Integer
exceptionCount
)
{
this
.
exceptionCount
=
exceptionCount
;
}
public
Integer
getSuccessedCount
()
{
return
successedCount
;
}
public
void
setSuccessedCount
(
Integer
successedCount
)
{
this
.
successedCount
=
successedCount
;
}
public
Date
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
Date
startTime
)
{
this
.
startTime
=
startTime
;
}
public
Date
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
Date
endTime
)
{
this
.
endTime
=
endTime
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/DataImportServiceImpl.java
View file @
d44953b1
package
pwc
.
taxtech
.
atms
.
service
.
impl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.constant.enums.EnumTbImportType
;
import
pwc.taxtech.atms.constant.enums.EnumValidationType
;
import
pwc.taxtech.atms.constant.enums.ProjectImportDataType
;
import
pwc.taxtech.atms.constant.enums.ServiceType
;
import
pwc.taxtech.atms.dao.DataImportMapper
;
import
pwc.taxtech.atms.dao.EnterpriseAccountMapper
;
import
pwc.taxtech.atms.dao.ProjectMapper
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.taxadmin.DataImportedStatusDto
;
import
pwc.taxtech.atms.dto.vat.CompanyBalanceDto
;
import
pwc.taxtech.atms.entitiy.EnterpriseAccountExample
;
import
pwc.taxtech.atms.entitiy.Project
;
import
pwc.taxtech.atms.entitiy.ProjectExample
;
import
pwc.taxtech.atms.service.DataImportService
;
import
pwc.taxtech.atms.vat.dao.CompanyBalanceMapper
;
import
pwc.taxtech.atms.vat.entity.CompanyBalance
;
import
pwc.taxtech.atms.vat.entity.CompanyBalanceExample
;
import
java.util.Date
;
import
java.util.List
;
@Service
public
class
DataImportServiceImpl
implements
DataImportService
{
private
static
final
String
PROJECT_DB_NAME
=
"test_db"
;
//TODO:fixed use init db
private
static
final
String
COMPANY_BALANCE_TABLE
=
"CompanyBalance"
;
private
static
final
String
BALANCE_TABLE
=
"Balance"
;
private
static
final
int
FIRST_OR_DEFAULT
=
0
;
@Autowired
private
DataImportMapper
mapper
;
@Autowired
private
CompanyBalanceMapper
companyBalanceMapper
;
@Autowired
private
ProjectMapper
projectMapper
;
@Autowired
private
EnterpriseAccountMapper
enterpriseAccountMapper
;
@Override
public
OperationResultDto
importTrialBalance
(
List
<
CompanyBalanceDto
>
balanceList
,
Integer
importType
,
Integer
serviceTypeId
,
String
id
)
{
return
null
;
public
OperationResultDto
importTrialBalance
(
List
<
CompanyBalanceDto
>
balanceList
,
Integer
importType
,
Integer
serviceTypeId
,
String
userID
)
{
OperationResultDto
result
=
new
OperationResultDto
();
if
(
serviceTypeId
==
ServiceType
.
VAT
.
getCode
().
intValue
())
{
int
period
=
balanceList
.
get
(
0
).
getPeriodId
().
intValue
();
DataImportedStatusDto
dataImportedStatus
=
new
DataImportedStatusDto
();
dataImportedStatus
.
setPeriod
(
period
);
dataImportedStatus
.
setDbName
(
PROJECT_DB_NAME
);
dataImportedStatus
.
setDataType
(
ProjectImportDataType
.
TrialBalance
.
getCode
());
dataImportedStatus
.
setStartTime
(
new
Date
());
//覆盖导入之前删除数据
if
(
importType
==
EnumTbImportType
.
CoverImport
.
getCode
())
{
clearTableData
(
period
,
COMPANY_BALANCE_TABLE
);
}
// var sqlhelper = new SqlHelper(_projectDbConnstring);
// var companyBalance = ServiceHelper.ToDataTable(balanceList);
// sqlhelper.SqlBulkCopyInsert(_companyBalancetable, companyBalance, 10000);
// sqlhelper.Close();
//TODO: sql bulk copy insert tobe impl(neo)
//SynAccountFromTaxAdmin(period, userID);
Boolean
isSuccess
=
refreshTrialBalance
(
period
,
serviceTypeId
,
userID
);
result
.
setResult
(
isSuccess
);
}
else
if
(
serviceTypeId
==
ServiceType
.
CIT
.
getCode
()){
//TODO import cit (neo)
}
return
result
;
}
private
Boolean
refreshTrialBalance
(
int
period
,
Integer
serviceTypeId
,
String
userID
)
{
CompanyBalanceExample
companyBalanceExample
=
new
CompanyBalanceExample
();
companyBalanceExample
.
createCriteria
().
andPeriodIdEqualTo
(
period
);
List
<
CompanyBalance
>
list
=
companyBalanceMapper
.
selectByExample
(
companyBalanceExample
);
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
//同步账套 TODO: sync admin db and project db(neo)
synAccountFromTaxAdmin
(
period
,
userID
);
//先删除数据
clearTableData
(
period
,
BALANCE_TABLE
);
mapper
.
deleteTbValidation
(
period
,
EnumValidationType
.
TrialBalance
.
getCode
());
}
return
true
;
}
private
void
synAccountFromTaxAdmin
(
int
period
,
String
userID
)
{
ProjectExample
example
=
new
ProjectExample
();
example
.
createCriteria
().
andDbNameEqualTo
(
PROJECT_DB_NAME
);
List
<
Project
>
plist
=
projectMapper
.
selectByExample
(
example
);
if
(
plist
!=
null
&&
!
plist
.
isEmpty
())
{
Project
pFirst
=
plist
.
get
(
FIRST_OR_DEFAULT
);
if
(
pFirst
.
getEnterpriseAccountSetID
()
!=
null
&&
!
pFirst
.
getEnterpriseAccountSetID
().
isEmpty
())
{
String
easId
=
pFirst
.
getEnterpriseAccountSetID
();
EnterpriseAccountExample
accountExample
=
new
EnterpriseAccountExample
();
accountExample
.
createCriteria
().
andEnterpriseAccountSetIDEqualTo
(
easId
);
}
}
}
private
void
clearTableData
(
int
period
,
String
companyBalanceTable
)
{
if
(
period
>
0
)
{
mapper
.
deleteByNameAndPeriod
(
companyBalanceTable
,
period
);
}
else
{
mapper
.
truncateByName
(
companyBalanceTable
);
}
}
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/IdentityServiceImpl.java
View file @
d44953b1
...
...
@@ -9,6 +9,6 @@ import pwc.taxtech.atms.service.IdentityService;
public
class
IdentityServiceImpl
implements
IdentityService
{
@Override
public
UserDto
getIdentityUser
()
{
return
AppCachePool
.
getCachedUser
(
"cach_test"
);
//TODO:should fixed use session username
return
AppCachePool
.
getCachedUser
(
"cach_test"
);
//TODO:should fixed use session username
(neo)
}
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/ProjectInfoServiceImpl.java
View file @
d44953b1
...
...
@@ -45,7 +45,7 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
@Override
public
OperationResultDto
<
Boolean
>
isProjectImportedData
(
String
projectId
,
Integer
importTypeId
)
{
return
isProjectImportedData
(
projectId
,
importTypeId
);
return
isProjectImportedData
(
projectId
,
null
,
importTypeId
);
}
@Override
...
...
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