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
2d52fc08
Commit
2d52fc08
authored
Oct 12, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev] use page helper query input and output invoice
parent
29bd98ce
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
18 deletions
+78
-18
DateUtils.java
...src/main/java/pwc/taxtech/atms/common/util/DateUtils.java
+15
-0
Constant.java
...api/src/main/java/pwc/taxtech/atms/constant/Constant.java
+10
-0
InputInvoiceImportController.java
...taxtech/atms/controller/InputInvoiceImportController.java
+8
-6
OutputInvoiceController.java
.../pwc/taxtech/atms/controller/OutputInvoiceController.java
+4
-7
InputInvoiceDataImportServiceImpl.java
...s/vat/service/impl/InputInvoiceDataImportServiceImpl.java
+16
-2
OutputInvoiceServiceImpl.java
...xtech/atms/vat/service/impl/OutputInvoiceServiceImpl.java
+25
-3
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/util/DateUtils.java
View file @
2d52fc08
...
...
@@ -533,6 +533,21 @@ public class DateUtils {
return
true
;
}
public
static
String
getPeriodBegin
(
int
year
,
int
period
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm:ss"
);
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
set
(
year
,
period
-
1
,
1
,
0
,
0
,
0
);
return
sdf
.
format
(
calendar
.
getTime
());
}
public
static
String
getPeriodEnd
(
int
year
,
int
period
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm:ss"
);
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
set
(
year
,
period
-
1
,
-
1
,
23
,
59
,
59
);
return
sdf
.
format
(
calendar
.
getTime
());
}
// /***************************************************************************
// * //nd=1表示返回的值中包含年度 //yf=1表示返回的值中包含月份 //rq=1表示返回的值中包含日期 //format表示返回的格式 1
// * 以年月日中文返回 2 以横线-返回 // 3 以斜线/返回 4 以缩写不带其它符号形式返回 // 5 以点号.返回
...
...
atms-api/src/main/java/pwc/taxtech/atms/constant/Constant.java
View file @
2d52fc08
...
...
@@ -48,6 +48,16 @@ public final class Constant {
public
static
final
String
EMPTY
=
""
;
public
static
final
String
DateTimeFormate
=
"%d年%d月"
;
public
static
final
String
INPUT_RZJG_SUCCESS
=
"0"
;
public
static
final
String
INPUT_RZJG_FAILED
=
"1"
;
public
static
final
String
INPUT_RZZT_NOT_BEGIN
=
"0"
;
public
static
final
String
INPUT_RZZT_BEGINNING
=
"1"
;
public
static
final
String
INPUT_RZZT_OVER
=
"2"
;
public
static
final
String
OUTPUT_KPZT_NO
=
"0"
;
public
static
final
String
OUTPUT_KPZT_YES
=
"1"
;
public
static
class
DataSourceName
{
public
static
final
String
KeyValueDataSource
=
"KeyValueDataSource"
;
public
static
final
String
InputInvoiceDataSource
=
"IncomeDataSource"
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/controller/InputInvoiceImportController.java
View file @
2d52fc08
...
...
@@ -37,12 +37,14 @@ public class InputInvoiceImportController {
@RequestMapping
(
value
=
"inputInvoicePreviewList"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
@ResponseBody
PageInfo
<
InputInvoice
>
getInputInvoiceTreeViewData
(
@RequestBody
InputInvoicePreviewQueryParam
paras
)
{
return
inputInvoiceDataImportService
.
getInputInvoiceTreeViewData
(
paras
);
PageInfo
<
InputInvoice
>
getInputInvoiceTreeViewData
(
@RequestBody
InputInvoicePreviewQueryParam
paras
,
@RequestHeader
(
"from"
)
String
projectId
)
{
return
inputInvoiceDataImportService
.
getInputInvoiceTreeViewData
(
paras
,
projectId
);
}
@RequestMapping
(
value
=
"exportQueryData/get"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
void
downloadInvoiceQueryData
(
@RequestBody
InputInvoicePreviewQueryParam
paras
,
HttpServletResponse
response
)
{
public
void
downloadInvoiceQueryData
(
@RequestBody
InputInvoicePreviewQueryParam
paras
,
HttpServletResponse
response
,
@RequestHeader
(
"from"
)
String
projectId
)
{
response
.
setContentType
(
"application/vnd.ms-excel;charset=utf-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
UUID
.
randomUUID
()
+
".xlsx"
);
response
.
setHeader
(
"x-file-name"
,
UUID
.
randomUUID
()
+
".xlsx"
);
...
...
@@ -50,7 +52,7 @@ public class InputInvoiceImportController {
OutputStream
os
=
null
;
try
{
os
=
response
.
getOutputStream
();
int
count
=
getDownloadFilePath
(
paras
,
os
);
int
count
=
getDownloadFilePath
(
paras
,
os
,
projectId
);
if
(
count
==
0
)
{
response
.
setStatus
(
SC_NO_CONTENT
);
...
...
@@ -73,8 +75,8 @@ public class InputInvoiceImportController {
return
ResponseEntity
.
ok
().
body
(
inputInvoiceDataImportService
.
getInputInvoiceItemList
(
period
));
}
private
int
getDownloadFilePath
(
InputInvoicePreviewQueryParam
paras
,
OutputStream
outputStream
)
{
List
<
InputInvoice
>
list
=
inputInvoiceDataImportService
.
getInputInvoiceTreeViewData
(
paras
).
getList
();
private
int
getDownloadFilePath
(
InputInvoicePreviewQueryParam
paras
,
OutputStream
outputStream
,
String
projectId
)
{
List
<
InputInvoice
>
list
=
inputInvoiceDataImportService
.
getInputInvoiceTreeViewData
(
paras
,
projectId
).
getList
();
if
(
list
.
size
()
==
0
)
{
return
0
;
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/controller/OutputInvoiceController.java
View file @
2d52fc08
...
...
@@ -5,11 +5,7 @@ import com.github.pagehelper.util.StringUtil;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
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.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
import
pwc.taxtech.atms.constant.enums.EnumModule
;
import
pwc.taxtech.atms.dpo.PagingResultDto
;
...
...
@@ -50,8 +46,9 @@ public class OutputInvoiceController {
private
FileUploadAdapter
fileUploadAdapter
;
@RequestMapping
(
value
=
"queryOutputInvoiceList"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
PageInfo
<
OutputInvoice
>
queryOutputInvoiceList
(
@RequestBody
QueryOutputDto
queryDto
)
{
return
outputInvoiceService
.
queryOutputInvoiceList
(
queryDto
);
public
PageInfo
<
OutputInvoice
>
queryOutputInvoiceList
(
@RequestBody
QueryOutputDto
queryDto
,
@RequestHeader
(
"from"
)
String
projectId
)
{
return
outputInvoiceService
.
queryOutputInvoiceList
(
queryDto
,
projectId
);
}
@RequestMapping
(
value
=
"getExportOutputInvoiceList"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/InputInvoiceDataImportServiceImpl.java
View file @
2d52fc08
...
...
@@ -7,11 +7,14 @@ import org.apache.ibatis.session.SqlSession;
import
org.mybatis.spring.SqlSessionTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.common.util.DateUtils
;
import
pwc.taxtech.atms.constant.enums.EnumTbImportType
;
import
pwc.taxtech.atms.constant.enums.EnumValidationType
;
import
pwc.taxtech.atms.dao.ProjectMapper
;
import
pwc.taxtech.atms.dto.FieldsMapper
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.vatdto.InputVATInvoiceDto
;
import
pwc.taxtech.atms.entity.Project
;
import
pwc.taxtech.atms.invoice.InputInvoiceMapper
;
import
pwc.taxtech.atms.vat.dao.InputVatInvoiceItemMapper
;
import
pwc.taxtech.atms.vat.dao.InputVatInvoiceMapper
;
...
...
@@ -21,6 +24,9 @@ import pwc.taxtech.atms.vat.entity.*;
import
java.io.StringReader
;
import
java.util.*
;
import
static
pwc
.
taxtech
.
atms
.
constant
.
Constant
.
INPUT_RZJG_SUCCESS
;
import
static
pwc
.
taxtech
.
atms
.
constant
.
Constant
.
INPUT_RZZT_OVER
;
@Service
public
class
InputInvoiceDataImportServiceImpl
{
private
static
final
String
_tableName
=
"InputVATInvoice"
;
...
...
@@ -35,10 +41,18 @@ public class InputInvoiceDataImportServiceImpl {
private
InputVatInvoiceItemMapper
inputVATInvoiceItemMapper
;
@Autowired
private
InputInvoiceMapper
inputInvoiceMapper
;
@Autowired
private
ProjectMapper
projectMapper
;
public
PageInfo
<
InputInvoice
>
getInputInvoiceTreeViewData
(
InputInvoicePreviewQueryParam
paras
,
String
projectId
)
{
Project
project
=
projectMapper
.
selectByPrimaryKey
(
projectId
);
InputInvoiceExample
invoiceExample
=
new
InputInvoiceExample
();
invoiceExample
.
createCriteria
().
andCOMPANYIDEqualTo
(
project
.
getCode
()).
andRZSJBetween
(
DateUtils
.
getPeriodBegin
(
project
.
getYear
(),
paras
.
getPeriodStart
()),
DateUtils
.
getPeriodEnd
(
project
.
getYear
(),
paras
.
getPeriodEnd
()))
.
andRZJGEqualTo
(
INPUT_RZJG_SUCCESS
).
andRZZTEqualTo
(
INPUT_RZZT_OVER
);
public
PageInfo
<
InputInvoice
>
getInputInvoiceTreeViewData
(
InputInvoicePreviewQueryParam
paras
)
{
PageHelper
.
startPage
(
paras
.
getPageInfo
().
getPageIndex
(),
paras
.
getPageInfo
().
getPageSize
());
List
<
InputInvoice
>
invoices
=
inputInvoiceMapper
.
selectByExample
(
new
InputInvoiceExample
()
);
List
<
InputInvoice
>
invoices
=
inputInvoiceMapper
.
selectByExample
(
invoiceExample
);
PageInfo
<
InputInvoice
>
pageInfo
=
new
PageInfo
<>(
invoices
);
return
pageInfo
;
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/OutputInvoiceServiceImpl.java
View file @
2d52fc08
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.alibaba.fastjson.TypeReference
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
javafx.geometry.Orientation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
...
...
@@ -17,12 +18,19 @@ import org.reflections.util.Utils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.common.util.DateUtils
;
import
pwc.taxtech.atms.constant.enums.EnumTbImportType
;
import
pwc.taxtech.atms.dao.OrganizationMapper
;
import
pwc.taxtech.atms.dao.ProjectMapper
;
import
pwc.taxtech.atms.dpo.PagingResultDto
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.vatdto.ImportOutputInvoiceDto
;
import
pwc.taxtech.atms.dto.vatdto.QueryEvidenceDto
;
import
pwc.taxtech.atms.entity.Organization
;
import
pwc.taxtech.atms.entity.OrganizationExample
;
import
pwc.taxtech.atms.entity.Project
;
import
pwc.taxtech.atms.invoice.OutputInvoiceMapper
;
import
pwc.taxtech.atms.service.impl.Message
;
import
pwc.taxtech.atms.vat.dao.ImportFileMapper
;
import
pwc.taxtech.atms.vat.dao.OutputVatInvoiceItemMapper
;
import
pwc.taxtech.atms.vat.dao.OutputVatInvoiceMapper
;
...
...
@@ -38,6 +46,8 @@ import java.util.function.Function;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
static
pwc
.
taxtech
.
atms
.
constant
.
Constant
.
OUTPUT_KPZT_YES
;
@Service
public
class
OutputInvoiceServiceImpl
{
@Autowired
...
...
@@ -52,10 +62,22 @@ public class OutputInvoiceServiceImpl {
private
OutputVatInvoiceItemMapper
outputVATInvoiceItemMapper
;
@Autowired
private
OutputInvoiceMapper
outputInvoiceMapper
;
@Autowired
private
ProjectMapper
projectMapper
;
@Autowired
private
OrganizationMapper
organizationMapper
;
public
PageInfo
<
OutputInvoice
>
queryOutputInvoiceList
(
QueryOutputDto
queryDto
,
String
projectId
)
{
Project
project
=
projectMapper
.
selectByPrimaryKey
(
projectId
);
Organization
organization
=
organizationMapper
.
selectByPrimaryKey
(
project
.
getOrganizationId
());
OutputInvoiceExample
outputInvoiceExample
=
new
OutputInvoiceExample
();
outputInvoiceExample
.
createCriteria
().
andXFSHEqualTo
(
organization
.
getTaxPayerNumber
()).
andKPZTEqualTo
(
OUTPUT_KPZT_YES
).
andKPRQBetween
(
DateUtils
.
getPeriodBegin
(
project
.
getYear
(),
queryDto
.
getPeriodStart
()),
DateUtils
.
getPeriodEnd
(
project
.
getYear
(),
queryDto
.
getPeriodEnd
()));
public
PageInfo
<
OutputInvoice
>
queryOutputInvoiceList
(
QueryOutputDto
queryDto
)
{
PageHelper
.
startPage
(
queryDto
.
getPageInfo
().
getPageIndex
(),
queryDto
.
getPageInfo
().
getPageSize
());
List
<
OutputInvoice
>
invoices
=
outputInvoiceMapper
.
selectByExample
(
new
OutputInvoiceExample
());
PageHelper
.
startPage
(
queryDto
.
getPageInfo
().
getPageIndex
(),
queryDto
.
getPageInfo
().
getPageSize
());
List
<
OutputInvoice
>
invoices
=
outputInvoiceMapper
.
selectByExample
(
outputInvoiceExample
);
PageInfo
<
OutputInvoice
>
pageInfo
=
new
PageInfo
<>(
invoices
);
return
pageInfo
;
}
...
...
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