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
a7a8d2f0
Commit
a7a8d2f0
authored
Jun 19, 2018
by
frank.xa.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add get template method
parent
009c7b6b
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
298 additions
and
1 deletion
+298
-1
EnumServiceType.java
...java/pwc/taxtech/atms/constant/enums/EnumServiceType.java
+49
-0
InputInvoiceImportController.java
...taxtech/atms/controller/InputInvoiceImportController.java
+1
-1
ReportController.java
...in/java/pwc/taxtech/atms/controller/ReportController.java
+26
-0
TemplateMapper.java
...pi/src/main/java/pwc/taxtech/atms/dao/TemplateMapper.java
+4
-0
ReportDto.java
.../src/main/java/pwc/taxtech/atms/dto/vatdto/ReportDto.java
+87
-0
ReportService.java
...main/java/pwc/taxtech/atms/vat/service/ReportService.java
+11
-0
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+78
-0
VatAbstractService.java
...pwc/taxtech/atms/vat/service/impl/VatAbstractService.java
+12
-0
TemplateMapper.xml
...rc/main/resources/pwc/taxtech/atms/dao/TemplateMapper.xml
+30
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/constant/enums/EnumServiceType.java
0 → 100644
View file @
a7a8d2f0
package
pwc
.
taxtech
.
atms
.
constant
.
enums
;
public
enum
EnumServiceType
{
/// <summary>
/// 后台admin
/// </summary>
Administration
(
1
),
/// <summary>
/// 增值税申报分析
/// </summary>
VAT
(
2
),
/// <summary>
/// 电子税务管理
/// </summary>
AM
(
3
),
/// <summary>
/// 财务尽职调查
/// </summary>
FDD
(
4
),
/// <summary>
/// 税务管理平台
/// </summary>
Dashboard
(
5
),
/// <summary>
/// 企业所得税
/// </summary>
CIT
(
6
),
/// <summary>
/// 电子税务审计
/// </summary>
TCS
(
7
);
private
Integer
code
;
EnumServiceType
(
Integer
code
)
{
this
.
code
=
code
;
}
public
Integer
getCode
()
{
return
code
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/controller/InputInvoiceImportController.java
View file @
a7a8d2f0
...
...
@@ -52,7 +52,7 @@ public class InputInvoiceImportController {
private
int
getDownloadFilePath
(
InputInvoicePreviewQueryParam
paras
,
OutputStream
outputStream
)
{
List
<
InputVATInvoiceDto
>
list
=
inputInvoiceDataImportService
.
getInputInvoiceTreeViewData
(
paras
).
getList
();
if
(
list
.
size
()
==
0
)
{
//
return 0;
return
0
;
}
Map
<
String
,
String
>
header
=
new
HashMap
<>();
header
.
put
(
"PeriodID"
,
"期间"
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/controller/ReportController.java
0 → 100644
View file @
a7a8d2f0
package
pwc
.
taxtech
.
atms
.
controller
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
pwc.taxtech.atms.constant.enums.EnumServiceType
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.vatdto.ReportDto
;
import
pwc.taxtech.atms.vat.service.ReportService
;
import
java.util.List
;
@RestController
@RequestMapping
(
value
=
"api/v1/Report"
)
public
class
ReportController
{
@Autowired
ReportService
reportService
;
@RequestMapping
(
value
=
"template/{organizationID}/{period}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
OperationResultDto
<
List
<
ReportDto
>>
getTemplate
(
@PathVariable
String
organizationID
,
@PathVariable
Integer
period
)
{
return
reportService
.
getReportTemplate
(
organizationID
,
EnumServiceType
.
VAT
,
period
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/dao/TemplateMapper.java
View file @
a7a8d2f0
...
...
@@ -9,6 +9,7 @@ import org.apache.ibatis.session.RowBounds;
import
pwc.taxtech.atms.MyMapper
;
import
pwc.taxtech.atms.dto.TemplateAndGroupDbDto
;
import
pwc.taxtech.atms.dto.TemplateUniqDto
;
import
pwc.taxtech.atms.dto.vatdto.ReportDto
;
import
pwc.taxtech.atms.entitiy.Template
;
import
pwc.taxtech.atms.entitiy.TemplateExample
;
...
...
@@ -123,4 +124,6 @@ public interface TemplateMapper extends MyMapper {
TemplateAndGroupDbDto
getTemplateAndGroupByID
(
@Param
(
"ID"
)
String
ID
);
long
getCountOfTemplateAndGroupByTemplateName
(
Map
<
String
,
Object
>
map
);
List
<
ReportDto
>
getTemplateLeftJoinReport
(
Map
<
String
,
Object
>
map
);
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/ReportDto.java
0 → 100644
View file @
a7a8d2f0
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
java.util.Date
;
public
class
ReportDto
{
private
String
ID
;
private
String
templateID
;
private
String
templateCode
;
private
String
templateName
;
private
int
period
;
private
String
creator
;
private
Date
createTime
;
private
String
updater
;
private
Date
updateTime
;
public
String
getID
()
{
return
ID
;
}
public
void
setID
(
String
ID
)
{
this
.
ID
=
ID
;
}
public
String
getTemplateID
()
{
return
templateID
;
}
public
void
setTemplateID
(
String
templateID
)
{
this
.
templateID
=
templateID
;
}
public
String
getTemplateCode
()
{
return
templateCode
;
}
public
void
setTemplateCode
(
String
templateCode
)
{
this
.
templateCode
=
templateCode
;
}
public
String
getTemplateName
()
{
return
templateName
;
}
public
void
setTemplateName
(
String
templateName
)
{
this
.
templateName
=
templateName
;
}
public
int
getPeriod
()
{
return
period
;
}
public
void
setPeriod
(
int
period
)
{
this
.
period
=
period
;
}
public
String
getCreator
()
{
return
creator
;
}
public
void
setCreator
(
String
creator
)
{
this
.
creator
=
creator
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
String
getUpdater
()
{
return
updater
;
}
public
void
setUpdater
(
String
updater
)
{
this
.
updater
=
updater
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/ReportService.java
0 → 100644
View file @
a7a8d2f0
package
pwc
.
taxtech
.
atms
.
vat
.
service
;
import
pwc.taxtech.atms.constant.enums.EnumServiceType
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.vatdto.ReportDto
;
import
java.util.List
;
public
interface
ReportService
{
OperationResultDto
<
List
<
ReportDto
>>
getReportTemplate
(
String
projectID
,
EnumServiceType
serviceType
,
Integer
period
);
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
0 → 100644
View file @
a7a8d2f0
package
pwc
.
taxtech
.
atms
.
vat
.
service
.
impl
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.common.datasource.ShardingContextHolder
;
import
pwc.taxtech.atms.constant.enums.EnumServiceType
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.vatdto.ReportDto
;
import
pwc.taxtech.atms.entitiy.*
;
import
pwc.taxtech.atms.vat.service.ReportService
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
@Service
public
class
ReportServiceImpl
extends
VatAbstractService
implements
ReportService
{
@Override
public
OperationResultDto
<
List
<
ReportDto
>>
getReportTemplate
(
String
projectID
,
EnumServiceType
serviceType
,
Integer
periodParam
)
{
int
period
=
periodParam
!=
null
?
periodParam
:
0
;
OperationResultDto
<
List
<
ReportDto
>>
operationResult
=
new
OperationResultDto
<>();
Project
project
=
projectMapper
.
selectByPrimaryKey
(
projectID
);
String
organizationID
=
project
==
null
?
null
:
project
.
getOrganizationID
();
if
(
organizationID
==
null
)
{
operationResult
.
setResult
(
false
);
operationResult
.
setResultMsg
(
"NoOrganization"
);
return
operationResult
;
}
String
templateGroupID
;
/*
对于VAT,从Rule Engine中获取TemplateGroupID
对于其他Service Type,直接从ProjectServiceType中获取
*/
if
(
serviceType
.
equals
(
EnumServiceType
.
VAT
))
{
TaxPayerReportRuleExample
example
=
new
TaxPayerReportRuleExample
();
example
.
createCriteria
().
andOrganizationIDLike
(
organizationID
);
List
<
TaxPayerReportRule
>
taxPayerReportRules
=
taxPayerReportRuleMapper
.
selectByExample
(
example
);
Optional
<
TaxPayerReportRule
>
taxPayerReportRule
=
taxPayerReportRules
.
stream
().
findFirst
();
if
(!
taxPayerReportRule
.
isPresent
())
{
Optional
<
TaxPayerReportRule
>
defaultRule
=
taxPayerReportRules
.
stream
().
filter
(
x
->
x
.
getIsDefault
()).
findFirst
();
if
(!
defaultRule
.
isPresent
())
{
operationResult
.
setResultMsg
(
"NoDefaultRule"
);
return
operationResult
;
}
templateGroupID
=
defaultRule
.
get
().
getTemplateGroupID
();
}
else
{
templateGroupID
=
taxPayerReportRule
.
get
().
getTemplateGroupID
();
}
}
else
{
String
serviceTypeStr
=
serviceType
.
getCode
().
toString
();
ProjectServiceTypeExample
projectServiceTypeExample
=
new
ProjectServiceTypeExample
();
projectServiceTypeExample
.
createCriteria
().
andServiceTypeIDEqualTo
(
serviceTypeStr
).
andProjectIDEqualTo
(
projectID
);
templateGroupID
=
projectServiceTypeMapper
.
selectByExample
(
projectServiceTypeExample
).
stream
().
map
(
ProjectServiceType:
:
getTemplateGroupID
).
findFirst
().
get
();
}
String
dbName
=
ShardingContextHolder
.
getDataSourceKey
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"dbName"
,
dbName
);
map
.
put
(
"period"
,
period
);
map
.
put
(
"projectID"
,
projectID
);
map
.
put
(
"templateGroupID"
,
templateGroupID
);
List
<
ReportDto
>
reportDtos
=
templateMapper
.
getTemplateLeftJoinReport
(
map
);
if
(
reportDtos
.
isEmpty
())
{
operationResult
.
setResultMsg
(
"No Template"
);
return
operationResult
;
}
operationResult
.
setResult
(
true
);
operationResult
.
setData
(
reportDtos
);
return
operationResult
;
}
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/VatAbstractService.java
View file @
a7a8d2f0
...
...
@@ -3,6 +3,10 @@ package pwc.taxtech.atms.vat.service.impl;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
pwc.taxtech.atms.dao.ProjectMapper
;
import
pwc.taxtech.atms.dao.ProjectServiceTypeMapper
;
import
pwc.taxtech.atms.dao.TaxPayerReportRuleMapper
;
import
pwc.taxtech.atms.dao.TemplateMapper
;
import
pwc.taxtech.atms.vat.dao.*
;
public
class
VatAbstractService
{
...
...
@@ -24,4 +28,12 @@ public class VatAbstractService {
OutputVATInvoiceItemMapper
outputVATInvoiceItemMapper
;
@Autowired
InputVATInvoiceItemMapper
inputVATInvoiceItemMapper
;
@Autowired
ProjectMapper
projectMapper
;
@Autowired
TaxPayerReportRuleMapper
taxPayerReportRuleMapper
;
@Autowired
ProjectServiceTypeMapper
projectServiceTypeMapper
;
@Autowired
TemplateMapper
templateMapper
;
}
atms-api/src/main/resources/pwc/taxtech/atms/dao/TemplateMapper.xml
View file @
a7a8d2f0
...
...
@@ -461,4 +461,33 @@
</if>
</where>
</select>
<resultMap
id=
"reportDto"
type=
"pwc.taxtech.atms.dto.vatdto.ReportDto"
>
<id
column=
"ID"
jdbcType=
"VARCHAR"
property=
"ID"
/>
<result
column=
"period"
jdbcType=
"INTEGER"
property=
"period"
/>
<result
column=
"templateID"
jdbcType=
"VARCHAR"
property=
"templateID"
/>
<result
column=
"templateName"
jdbcType=
"VARCHAR"
property=
"templateName"
/>
<result
column=
"templateCode"
jdbcType=
"VARCHAR"
property=
"templateCode"
/>
</resultMap>
<select
id=
"getTemplateLeftJoinReport"
parameterType=
"map"
resultMap=
"reportDto"
>
SELECT
d.ID AS ID,
d.Period AS period,
c.ID AS templateID,
c.Name AS templateName,
c.Code AS templateCode
FROM (SELECT
a.ID,
a.Name,
a.Code
FROM tax_admin.Template a
WHERE a.TemplateGroupID = #{templateGroupID,jdbcType=VARCHAR}
AND a.IsActiveAssociation = 1
ORDER BY a.OrderIndex) c
LEFT JOIN (SELECT b.ID,b.Period,b.TemplateID
FROM ${dbName}.Report b
WHERE b.Period = #{period,jdbcType=INTEGER}
AND b.ProjectID = #{ProjectID,jdbcType=VARCHAR}) d
ON c.ID = d.TemplateID
</select>
</mapper>
\ No newline at end of file
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