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
92d44427
Commit
92d44427
authored
Apr 17, 2019
by
chase
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
收入类型配置导出
parent
9bb49a2d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
4 deletions
+114
-4
RevenueConfController.java
...va/pwc/taxtech/atms/controller/RevenueConfController.java
+29
-0
RevenueConfService.java
...ava/pwc/taxtech/atms/service/impl/RevenueConfService.java
+54
-4
RevenueConfig.xlsx
...src/main/resources/Document/DataImport/RevenueConfig.xlsx
+0
-0
vat-revenue-config.ctrl.js
.../dataImport/vat-revenue-config/vat-revenue-config.ctrl.js
+28
-0
vat-revenue-config.html
...app/dataImport/vat-revenue-config/vat-revenue-config.html
+3
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/controller/RevenueConfController.java
View file @
92d44427
package
pwc
.
taxtech
.
atms
.
controller
;
package
pwc
.
taxtech
.
atms
.
controller
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
pwc.taxtech.atms.constant.enums.EnumImportType
;
import
pwc.taxtech.atms.dto.ApiResultDto
;
import
pwc.taxtech.atms.dto.ApiResultDto
;
import
pwc.taxtech.atms.dto.input.CamelPagingResultDto
;
import
pwc.taxtech.atms.dto.input.CamelPagingResultDto
;
import
pwc.taxtech.atms.dto.revenuconf.RevConfAddDto
;
import
pwc.taxtech.atms.dto.revenuconf.RevConfAddDto
;
...
@@ -11,6 +13,9 @@ import pwc.taxtech.atms.service.impl.RevenueConfService;
...
@@ -11,6 +13,9 @@ import pwc.taxtech.atms.service.impl.RevenueConfService;
import
pwc.taxtech.atms.vat.entity.RevenueConfig
;
import
pwc.taxtech.atms.vat.entity.RevenueConfig
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.util.List
;
import
java.util.List
;
@RestController
@RestController
...
@@ -46,9 +51,33 @@ public class RevenueConfController extends BaseController {
...
@@ -46,9 +51,33 @@ public class RevenueConfController extends BaseController {
revenueConfService
.
delConfig
(
idList
);
revenueConfService
.
delConfig
(
idList
);
return
ApiResultDto
.
success
();
return
ApiResultDto
.
success
();
}
}
@PostMapping
(
"upload"
)
@PostMapping
(
"upload"
)
public
ApiResultDto
upload
(
@RequestParam
MultipartFile
file
,
@RequestParam
Integer
type
)
throws
Exception
{
public
ApiResultDto
upload
(
@RequestParam
MultipartFile
file
,
@RequestParam
Integer
type
)
throws
Exception
{
List
<
String
>
unSuccessList
=
revenueConfService
.
upload
(
file
,
type
);
List
<
String
>
unSuccessList
=
revenueConfService
.
upload
(
file
,
type
);
return
ApiResultDto
.
success
(
unSuccessList
);
return
ApiResultDto
.
success
(
unSuccessList
);
}
}
@GetMapping
(
"export"
)
public
void
export
(
HttpServletResponse
response
)
throws
Exception
{
OutputStream
ouputStream
=
null
;
try
{
InputStream
inputStream
=
this
.
getClass
().
getResourceAsStream
(
"/document/DataImport/"
+
EnumImportType
.
RevenueConfig
.
name
()
+
".xlsx"
);
Workbook
tWorkbook
=
revenueConfService
.
export
(
inputStream
);
response
.
setContentType
(
"multipart/form-data"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;fileName="
+
EnumImportType
.
RevenueConfig
.
name
()
+
".xlsx"
);
ouputStream
=
response
.
getOutputStream
();
tWorkbook
.
write
(
ouputStream
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
ouputStream
!=
null
)
{
ouputStream
.
close
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/RevenueConfService.java
View file @
92d44427
...
@@ -9,6 +9,7 @@ import org.apache.poi.ss.usermodel.Row;
...
@@ -9,6 +9,7 @@ import org.apache.poi.ss.usermodel.Row;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.ss.usermodel.WorkbookFactory
;
import
org.apache.poi.ss.usermodel.WorkbookFactory
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.common.CommonUtils
;
...
@@ -19,6 +20,7 @@ import pwc.taxtech.atms.dto.ApiResultDto;
...
@@ -19,6 +20,7 @@ import pwc.taxtech.atms.dto.ApiResultDto;
import
pwc.taxtech.atms.dto.revenuconf.RevConfAddDto
;
import
pwc.taxtech.atms.dto.revenuconf.RevConfAddDto
;
import
pwc.taxtech.atms.dto.revenuconf.RevenueConfParam
;
import
pwc.taxtech.atms.dto.revenuconf.RevenueConfParam
;
import
pwc.taxtech.atms.dto.revenuconf.RevenueConfResult
;
import
pwc.taxtech.atms.dto.revenuconf.RevenueConfResult
;
import
pwc.taxtech.atms.exception.Exceptions
;
import
pwc.taxtech.atms.vat.dao.RevenueConfigMapper
;
import
pwc.taxtech.atms.vat.dao.RevenueConfigMapper
;
import
pwc.taxtech.atms.vat.entity.RevenueConfig
;
import
pwc.taxtech.atms.vat.entity.RevenueConfig
;
import
pwc.taxtech.atms.vat.entity.RevenueConfigExample
;
import
pwc.taxtech.atms.vat.entity.RevenueConfigExample
;
...
@@ -26,10 +28,7 @@ import pwc.taxtech.atms.vat.entity.RevenueConfigExample;
...
@@ -26,10 +28,7 @@ import pwc.taxtech.atms.vat.entity.RevenueConfigExample;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
@Service
...
@@ -266,4 +265,55 @@ public class RevenueConfService extends BaseService {
...
@@ -266,4 +265,55 @@ public class RevenueConfService extends BaseService {
}
}
return
msg
;
return
msg
;
}
}
public
Workbook
export
(
InputStream
is
){
Workbook
tWorkbook
=
new
XSSFWorkbook
();
try
{
tWorkbook
=
WorkbookFactory
.
create
(
is
);
Sheet
sheet
=
tWorkbook
.
getSheetAt
(
0
);
Row
sourceRow
=
sheet
.
getRow
(
1
);
//查询公司map
List
<
OrgSelectDto
>
orgDtoList
=
organizationService
.
getMyOrgList
();
Map
<
String
,
String
>
orgMap
=
orgDtoList
.
stream
().
collect
(
Collectors
.
toMap
(
OrgSelectDto:
:
getId
,
OrgSelectDto:
:
getName
,
(
value1
,
value2
)
->
{
return
value2
;
}));
if
(
CollectionUtils
.
isNotEmpty
(
orgDtoList
)){
RevenueConfigExample
example
=
new
RevenueConfigExample
();
example
.
createCriteria
().
andOrgIdIn
(
orgDtoList
.
stream
().
map
(
OrgSelectDto:
:
getId
).
collect
(
Collectors
.
toList
()));
example
.
setOrderByClause
(
"org_id"
);
List
<
RevenueConfig
>
dataList
=
revenueConfigMapper
.
selectByExample
(
example
);
if
(
CollectionUtils
.
isNotEmpty
(
dataList
)){
for
(
int
i
=
dataList
.
size
()-
1
;
i
>=
0
;
i
--){
RevenueConfig
revenueConfig
=
dataList
.
get
(
i
);
Row
row
=
POIUtil
.
createAndCloneRow
(
tWorkbook
,
sheet
,
1
,
sourceRow
);
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_1
.
getIndex
()).
setCellValue
(
revenueConfig
.
getName
());
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_2
.
getIndex
()).
setCellValue
(
orgMap
.
get
(
revenueConfig
.
getOrgId
()));
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_3
.
getIndex
()).
setCellValue
(
RevenueConfEnum
.
AccountType
.
MAPPING
.
get
(
revenueConfig
.
getAccountType
()));
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_4
.
getIndex
()).
setCellValue
(
revenueConfig
.
getTbSegment3
());
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_5
.
getIndex
()).
setCellValue
(
revenueConfig
.
getTbSegment5
());
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_6
.
getIndex
()).
setCellValue
(
revenueConfig
.
getTbSegment6
());
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_7
.
getIndex
()).
setCellValue
(
String
.
valueOf
(
revenueConfig
.
getTaxRate
().
multiply
(
new
BigDecimal
(
100
)).
intValue
())+
"%"
);
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_8
.
getIndex
()).
setCellValue
(
RevenueConfEnum
.
TaxBase
.
MAPPING
.
get
(
revenueConfig
.
getTaxBase
()));
if
(
revenueConfig
.
getTaxBase
().
intValue
()
==
4
){
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_9
.
getIndex
()).
setCellValue
(
revenueConfig
.
getBaseDrCode
());
}
else
if
(
revenueConfig
.
getTaxBase
().
intValue
()
==
5
){
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_9
.
getIndex
()).
setCellValue
(
revenueConfig
.
getBaseCrCode
());
}
else
{
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_9
.
getIndex
()).
setCellValue
(
""
);
}
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_10
.
getIndex
()).
setCellValue
(
RevenueConfEnum
.
RevenueType
.
MAPPING
.
get
(
revenueConfig
.
getRevenueType
()));
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_11
.
getIndex
()).
setCellValue
(
RevenueConfEnum
.
TaxType
.
MAPPING
.
get
(
revenueConfig
.
getTaxType
()));
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_12
.
getIndex
()).
setCellValue
(
RevenueConfEnum
.
Status
.
MAPPING
.
get
(
revenueConfig
.
getStatus
()));
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_13
.
getIndex
()).
setCellValue
(
revenueConfig
.
getStartDate
());
row
.
getCell
(
RevenueConfEnum
.
EXECLColumn
.
Column_14
.
getIndex
()).
setCellValue
(
revenueConfig
.
getEndDate
());
}
}
}
sheet
.
removeRow
(
sourceRow
);
return
tWorkbook
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"export error."
,
e
);
throw
Exceptions
.
SERVER_ERROR_EXCEPTION
;
}
}
}
}
atms-api/src/main/resources/Document/DataImport/RevenueConfig.xlsx
View file @
92d44427
No preview for this file type
atms-web/src/main/webapp/app/dataImport/vat-revenue-config/vat-revenue-config.ctrl.js
View file @
92d44427
...
@@ -85,6 +85,34 @@
...
@@ -85,6 +85,34 @@
});
});
};
};
$scope
.
exportRevenueConf
=
function
()
{
$http
.
get
(
'/revenueConf/export'
,
apiConfig
.
create
({
responseType
:
'arraybuffer'
})).
success
(
function
(
data
,
status
,
headers
)
{
var
octetStreamMime
=
'application/octet-stream'
;
var
contentType
=
headers
(
'content-type'
)
||
octetStreamMime
;
if
(
window
.
navigator
.
msSaveBlob
)
{
var
blob
=
new
Blob
([
data
],
{
type
:
contentType
});
navigator
.
msSaveBlob
(
blob
,
"收入类型配置报表"
);
}
else
{
var
urlCreator
=
window
.
URL
||
window
.
webkitURL
||
window
.
mozURL
||
window
.
msURL
;
if
(
urlCreator
)
{
var
a
=
document
.
createElement
(
'a'
);
var
blob
=
new
Blob
([
data
],
{
type
:
contentType
});
var
url
=
urlCreator
.
createObjectURL
(
blob
);
a
.
href
=
url
;
a
.
target
=
'_blank'
;
a
.
download
=
"收入类型配置报表.xlsx"
;
document
.
body
.
appendChild
(
a
);
a
.
click
();
}
}
}).
error
(
function
()
{
SweetAlert
.
error
(
$translate
.
instant
(
'PleaseContactAdministrator'
));
});
};
//表格配置
//表格配置
$scope
.
revenueGridOptions
=
$
.
extend
(
true
,
{},
dxDataGridService
.
BASIC_GRID_OPTIONS
,
{
$scope
.
revenueGridOptions
=
$
.
extend
(
true
,
{},
dxDataGridService
.
BASIC_GRID_OPTIONS
,
{
columns
:
[
columns
:
[
...
...
atms-web/src/main/webapp/app/dataImport/vat-revenue-config/vat-revenue-config.html
View file @
92d44427
...
@@ -17,6 +17,9 @@
...
@@ -17,6 +17,9 @@
<button
type=
"button"
class=
"btn btn-in-grid inline-div"
ng-click=
"downloadTemplate()"
><i
<button
type=
"button"
class=
"btn btn-in-grid inline-div"
ng-click=
"downloadTemplate()"
><i
class=
"fa fa-download"
aria-hidden=
"true"
></i>
下载模板
class=
"fa fa-download"
aria-hidden=
"true"
></i>
下载模板
</button>
</button>
<button
type=
"button"
class=
"btn btn-in-grid inline-div"
ng-click=
"exportRevenueConf()"
><i
class=
"fa fa-download"
aria-hidden=
"true"
></i>
导出报表
</button>
</div>
</div>
</form>
</form>
...
...
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