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
786b99a7
Commit
786b99a7
authored
Jun 28, 2018
by
neo.wang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_neo' into 'dev'
Dev neo See merge request root/atms!40
parents
56492875
f31033d6
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
53 additions
and
161 deletions
+53
-161
ProjectInfoController.java
...va/pwc/taxtech/atms/controller/ProjectInfoController.java
+1
-1
TBDataImportController.java
...a/pwc/taxtech/atms/controller/TBDataImportController.java
+23
-9
CompanyBalanceDto.java
...main/java/pwc/taxtech/atms/dto/vat/CompanyBalanceDto.java
+0
-121
ClearTableDto.java
.../main/java/pwc/taxtech/atms/dto/vatdto/ClearTableDto.java
+1
-1
ImportBalanceDto.java
...in/java/pwc/taxtech/atms/dto/vatdto/ImportBalanceDto.java
+6
-4
QueryImportType.java
...ain/java/pwc/taxtech/atms/dto/vatdto/QueryImportType.java
+1
-1
DataImportService.java
...main/java/pwc/taxtech/atms/service/DataImportService.java
+0
-10
DataImportServiceImpl.java
.../pwc/taxtech/atms/service/impl/DataImportServiceImpl.java
+3
-6
ProjectServiceImpl.java
...ava/pwc/taxtech/atms/service/impl/ProjectServiceImpl.java
+18
-8
No files found.
atms-api/src/main/java/pwc/taxtech/atms/controller/ProjectInfoController.java
View file @
786b99a7
...
...
@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import
org.springframework.web.bind.annotation.RestController
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.taxadmin.PeriodInfoDto
;
import
pwc.taxtech.atms.dto.vat.QueryImportType
;
import
pwc.taxtech.atms.dto.vat
dto
.QueryImportType
;
import
pwc.taxtech.atms.service.IdentityService
;
import
pwc.taxtech.atms.service.ProjectInfoService
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/controller/TBDataImportController.java
View file @
786b99a7
...
...
@@ -7,27 +7,41 @@ import org.apache.http.HttpStatus;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.vat.ClearTableDto
;
import
pwc.taxtech.atms.dto.vat.ImportBalanceDto
;
import
pwc.taxtech.atms.dto.vatdto.*
;
import
pwc.taxtech.atms.service.DataImportService
;
import
pwc.taxtech.atms.dto.vatdto.BalanceSubTotalDto
;
import
pwc.taxtech.atms.dto.vatdto.BalanceWithSubTotalsResultDto
;
import
pwc.taxtech.atms.dto.vatdto.ClearTableDto
;
import
pwc.taxtech.atms.dto.vatdto.ImportBalanceDto
;
import
pwc.taxtech.atms.dto.vatdto.JsonParentCodesLookup
;
import
pwc.taxtech.atms.dto.vatdto.JsonTrialBalanceTreeNode
;
import
pwc.taxtech.atms.dto.vatdto.TrialBalanceDto
;
import
pwc.taxtech.atms.dto.vatdto.TrialBalanceFilter
;
import
pwc.taxtech.atms.dto.vatdto.VatEnterpriseAccountDto
;
import
pwc.taxtech.atms.service.ICitTBDataImportService
;
import
pwc.taxtech.atms.service.IdentityService
;
import
pwc.taxtech.atms.service.impl.DataImportServiceImpl
;
import
pwc.taxtech.atms.utils.NPOIHelper
;
import
pwc.taxtech.atms.vat.dao.DataImportModel
;
import
pwc.taxtech.atms.vat.service.TBDataImportService
;
import
pwc.taxtech.atms.vat.service.impl.FileUploadAdapter
;
import
javax.ws.rs.core.Response
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
static
pwc
.
taxtech
.
atms
.
constant
.
Constant
.
DEFAULT_HAS_HEADER
;
...
...
@@ -46,7 +60,7 @@ public class TBDataImportController {
@Autowired
private
ICitTBDataImportService
citTbDataImport
;
@Autowired
private
DataImportService
dataImportService
;
private
DataImportService
Impl
dataImportService
;
@Autowired
private
IdentityService
identityService
;
@Autowired
...
...
@@ -457,7 +471,7 @@ public class TBDataImportController {
DataImportModel
dataImportModel
;
String
fullFilePath
=
fileUploadAdapter
.
getLastFilePathByFileName
(
tempFileName
);
if
(
fullFilePath
!=
null
)
{
try
(
FileInputStream
fis
=
new
FileInputStream
(
new
File
(
fullFilePath
));)
{
try
(
FileInputStream
fis
=
new
FileInputStream
(
new
File
(
fullFilePath
));)
{
dataImportModel
=
NPOIHelper
.
renderTBDataTableFromExcel
(
fis
,
selectedSheetIndex
,
HEADER_ROW_INDEX
,
DEFAULT_HAS_HEADER
,
topRowNumber
);
dataImportModel
.
setSelectedSheetIndex
(
selectedSheetIndex
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/dto/vat/CompanyBalanceDto.java
deleted
100644 → 0
View file @
56492875
package
pwc
.
taxtech
.
atms
.
dto
.
vat
;
public
class
CompanyBalanceDto
{
private
String
balanceId
;
private
Integer
periodId
;
private
String
acctCode
;
private
String
customerCode
;
private
Integer
begDebitBal
;
private
Integer
begCreditBal
;
private
Integer
begBal
;
private
Integer
endBal
;
private
Integer
endDebitBal
;
private
Integer
endCreditBal
;
private
Integer
debitBal
;
private
Integer
creditBal
;
private
Integer
monthId
;
public
String
getBalanceId
()
{
return
balanceId
;
}
public
void
setBalanceId
(
String
balanceId
)
{
this
.
balanceId
=
balanceId
;
}
public
Integer
getPeriodId
()
{
return
periodId
;
}
public
void
setPeriodId
(
Integer
periodId
)
{
this
.
periodId
=
periodId
;
}
public
String
getAcctCode
()
{
return
acctCode
;
}
public
void
setAcctCode
(
String
acctCode
)
{
this
.
acctCode
=
acctCode
;
}
public
String
getCustomerCode
()
{
return
customerCode
;
}
public
void
setCustomerCode
(
String
customerCode
)
{
this
.
customerCode
=
customerCode
;
}
public
Integer
getBegDebitBal
()
{
return
begDebitBal
;
}
public
void
setBegDebitBal
(
Integer
begDebitBal
)
{
this
.
begDebitBal
=
begDebitBal
;
}
public
Integer
getBegCreditBal
()
{
return
begCreditBal
;
}
public
void
setBegCreditBal
(
Integer
begCreditBal
)
{
this
.
begCreditBal
=
begCreditBal
;
}
public
Integer
getBegBal
()
{
return
begBal
;
}
public
void
setBegBal
(
Integer
begBal
)
{
this
.
begBal
=
begBal
;
}
public
Integer
getEndBal
()
{
return
endBal
;
}
public
void
setEndBal
(
Integer
endBal
)
{
this
.
endBal
=
endBal
;
}
public
Integer
getEndDebitBal
()
{
return
endDebitBal
;
}
public
void
setEndDebitBal
(
Integer
endDebitBal
)
{
this
.
endDebitBal
=
endDebitBal
;
}
public
Integer
getEndCreditBal
()
{
return
endCreditBal
;
}
public
void
setEndCreditBal
(
Integer
endCreditBal
)
{
this
.
endCreditBal
=
endCreditBal
;
}
public
Integer
getDebitBal
()
{
return
debitBal
;
}
public
void
setDebitBal
(
Integer
debitBal
)
{
this
.
debitBal
=
debitBal
;
}
public
Integer
getCreditBal
()
{
return
creditBal
;
}
public
void
setCreditBal
(
Integer
creditBal
)
{
this
.
creditBal
=
creditBal
;
}
public
Integer
getMonthId
()
{
return
monthId
;
}
public
void
setMonthId
(
Integer
monthId
)
{
this
.
monthId
=
monthId
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/dto/vat/ClearTableDto.java
→
atms-api/src/main/java/pwc/taxtech/atms/dto/vat
dto
/ClearTableDto.java
View file @
786b99a7
package
pwc
.
taxtech
.
atms
.
dto
.
vat
;
package
pwc
.
taxtech
.
atms
.
dto
.
vat
dto
;
import
java.util.List
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/dto/vat/ImportBalanceDto.java
→
atms-api/src/main/java/pwc/taxtech/atms/dto/vat
dto
/ImportBalanceDto.java
View file @
786b99a7
package
pwc
.
taxtech
.
atms
.
dto
.
vat
;
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
pwc.taxtech.atms.vat.entity.CompanyBalance
;
import
java.util.List
;
public
class
ImportBalanceDto
{
private
List
<
CompanyBalance
Dto
>
balanceList
;
private
List
<
CompanyBalance
>
balanceList
;
private
Integer
importType
;
private
Integer
serviceTypeId
;
private
List
<
Integer
>
periods
;
public
List
<
CompanyBalance
Dto
>
getBalanceList
()
{
public
List
<
CompanyBalance
>
getBalanceList
()
{
return
balanceList
;
}
public
void
setBalanceList
(
List
<
CompanyBalance
Dto
>
balanceList
)
{
public
void
setBalanceList
(
List
<
CompanyBalance
>
balanceList
)
{
this
.
balanceList
=
balanceList
;
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/dto/vat/QueryImportType.java
→
atms-api/src/main/java/pwc/taxtech/atms/dto/vat
dto
/QueryImportType.java
View file @
786b99a7
package
pwc
.
taxtech
.
atms
.
dto
.
vat
;
package
pwc
.
taxtech
.
atms
.
dto
.
vat
dto
;
import
java.util.List
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/DataImportService.java
deleted
100644 → 0
View file @
56492875
package
pwc
.
taxtech
.
atms
.
service
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.vat.CompanyBalanceDto
;
import
java.util.List
;
public
interface
DataImportService
{
OperationResultDto
importTrialBalance
(
List
<
CompanyBalanceDto
>
balanceList
,
Integer
importType
,
Integer
serviceTypeId
,
String
id
);
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/DataImportServiceImpl.java
View file @
786b99a7
...
...
@@ -11,11 +11,9 @@ 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
;
...
...
@@ -24,7 +22,7 @@ import java.util.Date;
import
java.util.List
;
@Service
public
class
DataImportServiceImpl
implements
DataImportService
{
public
class
DataImportServiceImpl
{
private
static
final
String
PROJECT_DB_NAME
=
"test_db"
;
//TODO:fixed use init db
private
static
final
String
COMPANY_BALANCE_TABLE
=
"CompanyBalance"
;
...
...
@@ -43,8 +41,7 @@ public class DataImportServiceImpl implements DataImportService {
@Autowired
private
EnterpriseAccountMapper
enterpriseAccountMapper
;
@Override
public
OperationResultDto
importTrialBalance
(
List
<
CompanyBalanceDto
>
balanceList
,
Integer
importType
,
public
OperationResultDto
importTrialBalance
(
List
<
CompanyBalance
>
balanceList
,
Integer
importType
,
Integer
serviceTypeId
,
String
userID
)
{
OperationResultDto
result
=
new
OperationResultDto
();
if
(
serviceTypeId
==
ServiceType
.
VAT
.
getCode
().
intValue
())
{
...
...
@@ -71,7 +68,7 @@ public class DataImportServiceImpl implements DataImportService {
Boolean
isSuccess
=
refreshTrialBalance
(
period
,
serviceTypeId
,
userID
);
result
.
setResult
(
isSuccess
);
}
else
if
(
serviceTypeId
==
ServiceType
.
CIT
.
getCode
())
{
//TODO import cit (neo)
}
else
if
(
serviceTypeId
==
ServiceType
.
CIT
.
getCode
())
{
//TODO import cit (neo)
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/ProjectServiceImpl.java
View file @
786b99a7
...
...
@@ -273,6 +273,14 @@ public class ProjectServiceImpl implements ProjectService {
return
result
;
}
static
class
DbName
{
String
dbName
;
public
DbName
(
String
dbName
)
{
this
.
dbName
=
dbName
;
}
}
private
String
generateDatabase
(
Project
project
,
String
accsetid
)
{
//TODO: should be impl future(neo)
String
maxDbName
=
projectMapper
.
maxDbName
(
project
.
getYear
());
String
dbName
=
""
;
...
...
@@ -282,12 +290,14 @@ public class ProjectServiceImpl implements ProjectService {
}
else
{
dbName
=
generateProjectDbName
(
dbName
,
project
.
getYear
()
+
""
);
}
DbName
sbDbName
=
new
DbName
(
dbName
);
createDatabaseByName
(
d
bName
,
project
);
ShardingContextHolder
.
setDataSourceKey
(
dbName
);
createDatabaseByName
(
sbD
bName
,
project
);
ShardingContextHolder
.
setDataSourceKey
(
sbDbName
.
dbName
);
try
(
SqlSession
sqlSession
=
dynamicSqlSessionTemplate
.
getSqlSessionFactory
().
openSession
();
BufferedReader
bufferedReader
=
new
BufferedReader
(
prepareRunScriptReader
(
DB_MYSQL_PATH
,
dbName
,
project
,
accsetid
));)
{
BufferedReader
bufferedReader
=
new
BufferedReader
(
prepareRunScriptReader
(
DB_MYSQL_PATH
,
sbDbName
.
dbName
,
project
,
accsetid
));)
{
ScriptRunner
scriptRunner
=
new
ScriptRunner
(
sqlSession
.
getConnection
());
//only support mysql
scriptRunner
.
setAutoCommit
(
true
);
...
...
@@ -298,7 +308,7 @@ public class ProjectServiceImpl implements ProjectService {
}
initStandardAccount
(
project
.
getIndustryID
());
return
dbName
;
return
sbDbName
.
toString
()
;
}
...
...
@@ -328,7 +338,7 @@ public class ProjectServiceImpl implements ProjectService {
}
}
prepareAccount
.
forEach
(
m
->
vatStandardAccountMapper
.
insert
(
m
));
prepareAccount
.
forEach
(
m
->
vatStandardAccountMapper
.
insert
(
m
));
}
...
...
@@ -395,11 +405,11 @@ public class ProjectServiceImpl implements ProjectService {
}
private
void
createDatabaseByName
(
String
dbName
,
Project
project
)
{
int
result
=
databaseAgent
.
createDatabase
(
dbName
);
private
void
createDatabaseByName
(
DbName
dbName
,
Project
project
)
{
int
result
=
databaseAgent
.
createDatabase
(
dbName
.
dbName
);
if
(
result
==
Constant
.
CREATE_DB_EXISTS
)
{
dbName
=
generateProjectDbName
(
dbName
,
project
.
getYear
()
+
""
);
dbName
.
dbName
=
generateProjectDbName
(
dbName
.
dbName
,
project
.
getYear
()
+
""
);
createDatabaseByName
(
dbName
,
project
);
}
else
if
(
result
==
Constant
.
CREATE_DB_FAILED
)
{
LOGGER
.
debug
(
"should throws biz exception"
);
//TODO: should shrow biz exception in futrue(neo)
...
...
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