Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
qianhe-ydsj
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangyun
qianhe-ydsj
Commits
0d6de0de
Commit
0d6de0de
authored
Nov 29, 2025
by
wangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2025-11-29 wj 修改
parent
d0159bf8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
118 additions
and
7 deletions
+118
-7
qianhe-ydsj/src/main/java/com/qianhe/controller/SjFybpZbController.java
+116
-0
qianhe-ydsj/src/main/java/com/qianhe/domain/SjFybp.java
+2
-7
qianhe-ydsj/src/main/resources/static/fybp_drmb.xlsx
+0
-0
No files found.
qianhe-ydsj/src/main/java/com/qianhe/controller/SjFybpZbController.java
View file @
0d6de0de
package
com
.
qianhe
.
controller
;
package
com
.
qianhe
.
controller
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
com.qianhe.common.exception.BusinessException
;
import
com.qianhe.common.utils.DateUtils
;
import
com.qianhe.common.utils.DateUtils
;
import
com.qianhe.common.utils.SecurityUtils
;
import
com.qianhe.common.utils.SecurityUtils
;
import
com.qianhe.common.utils.StringUtils
;
import
com.qianhe.common.utils.StringUtils
;
import
com.qianhe.domain.SjFybp
;
import
com.qianhe.domain.SjFybp
;
import
com.qianhe.domain.SjGfjsZsdwkhpj
;
import
com.qianhe.system.domain.SysDeptCb
;
import
com.qianhe.system.domain.SysDeptCb
;
import
com.qianhe.system.mapper.SysDeptCbMapper
;
import
com.qianhe.system.mapper.SysDeptCbMapper
;
import
com.qianhe.system.mapper.SysDeptMapper
;
import
com.qianhe.system.mapper.SysDeptMapper
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.xssf.usermodel.XSSFRow
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.http.MediaType
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -24,6 +35,7 @@ import com.qianhe.domain.SjFybpZb;
...
@@ -24,6 +35,7 @@ import com.qianhe.domain.SjFybpZb;
import
com.qianhe.service.ISjFybpZbService
;
import
com.qianhe.service.ISjFybpZbService
;
import
com.qianhe.common.utils.poi.ExcelUtil
;
import
com.qianhe.common.utils.poi.ExcelUtil
;
import
com.qianhe.common.core.page.TableDataInfo
;
import
com.qianhe.common.core.page.TableDataInfo
;
import
org.springframework.web.multipart.MultipartFile
;
/**
/**
* 三基-费用报批主Controller
* 三基-费用报批主Controller
...
@@ -512,4 +524,108 @@ public class SjFybpZbController extends BaseController
...
@@ -512,4 +524,108 @@ public class SjFybpZbController extends BaseController
return
success
(
sjFybpZb
);
return
success
(
sjFybpZb
);
}
}
//导入模板 下载
@PostMapping
(
"/exportDrmb"
)
public
void
exportDrmb
(
HttpServletResponse
response
,
SjFybpZb
sjFybpZb
)
{
Workbook
exl
=
null
;
OutputStream
out
=
null
;
InputStream
in
=
null
;
try
{
in
=
this
.
getClass
().
getResourceAsStream
(
"/static/fybp_drmb.xlsx"
);
exl
=
WorkbookFactory
.
create
(
in
);
out
=
response
.
getOutputStream
();
response
.
reset
();
String
filename
=
URLEncoder
.
encode
(
"费用上报导入模板.xlsx"
,
"UTF-8"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
filename
);
response
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
);
Sheet
sheet
=
exl
.
getSheet
(
"Sheet1"
);
CellStyle
cellStyle
=
exl
.
createCellStyle
();
cellStyle
.
setWrapText
(
true
);
cellStyle
.
setAlignment
(
HorizontalAlignment
.
LEFT
);
cellStyle
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
cellStyle
.
setBorderBottom
(
BorderStyle
.
THIN
);
cellStyle
.
setBottomBorderColor
(
IndexedColors
.
BLACK
.
getIndex
());
cellStyle
.
setBorderLeft
(
BorderStyle
.
THIN
);
cellStyle
.
setLeftBorderColor
(
IndexedColors
.
BLACK
.
getIndex
());
cellStyle
.
setBorderRight
(
BorderStyle
.
THIN
);
cellStyle
.
setRightBorderColor
(
IndexedColors
.
BLACK
.
getIndex
());
cellStyle
.
setBorderTop
(
BorderStyle
.
THIN
);
cellStyle
.
setTopBorderColor
(
IndexedColors
.
BLACK
.
getIndex
());
exl
.
write
(
out
);
exl
.
close
();
}
catch
(
Exception
e
){
e
.
getMessage
();
throw
new
BusinessException
(
"导出Excel失败,请联系网站管理员!"
);
}
finally
{
if
(
exl
!=
null
)
{
try
{
exl
.
close
();
}
catch
(
IOException
e1
)
{
e1
.
printStackTrace
();
}
}
if
(
out
!=
null
)
{
try
{
out
.
close
();
}
catch
(
IOException
e1
)
{
e1
.
printStackTrace
();
}
}
}
}
//导入
@PostMapping
(
"/importData"
)
public
AjaxResult
importData
(
MultipartFile
file
,
boolean
updateSupport
)
throws
Exception
{
List
<
SjFybp
>
list
=
new
ArrayList
<>();
XSSFWorkbook
workbook
=
null
;
try
{
//装载流
workbook
=
new
XSSFWorkbook
(
file
.
getInputStream
());
// 获取一个工作表,下标从0开始
XSSFSheet
sheet
=
workbook
.
getSheetAt
(
0
);
int
lastRowNum
=
sheet
.
getLastRowNum
();
// 通过循环,逐行取出表中每行数据
for
(
int
i
=
0
;
i
<=
lastRowNum
;
i
++)
{
//跳过第一行和第二行
if
(
i
==
0
||
i
==
1
){
continue
;
}
// 获取行
XSSFRow
row
=
sheet
.
getRow
(
i
);
SjFybp
cb
=
new
SjFybp
();
System
.
out
.
println
(
row
);
//项目金额
String
fyje
=
new
DataFormatter
().
formatCellValue
(
row
.
getCell
(
0
));
cb
.
setFyje
(
new
BigDecimal
(
fyje
));
//项目内容
String
fyms
=
new
DataFormatter
().
formatCellValue
(
row
.
getCell
(
1
));
cb
.
setFyms
(
fyms
);
list
.
add
(
cb
);
}
// if(list.size()>0){
// sjGfjsZsdwkhpjService.pledit(list);
// }
}
catch
(
Exception
e
)
{
e
.
getMessage
();
e
.
printStackTrace
();
throw
new
BusinessException
(
"导入Excel失败,请检查数据格式,尤其是金额!"
);
}
finally
{
workbook
.
close
();
}
return
AjaxResult
.
success
(
list
);
}
}
}
qianhe-ydsj/src/main/java/com/qianhe/domain/SjFybp.java
View file @
0d6de0de
...
@@ -42,11 +42,11 @@ public class SjFybp extends BaseEntity
...
@@ -42,11 +42,11 @@ public class SjFybp extends BaseEntity
private
String
fylx
;
private
String
fylx
;
/** 费用描述 */
/** 费用描述 */
@Excel
(
name
=
"
费用描述
"
)
@Excel
(
name
=
"
项目内容
"
)
private
String
fyms
;
private
String
fyms
;
/** 费用金额 */
/** 费用金额 */
@Excel
(
name
=
"
费用
金额"
)
@Excel
(
name
=
"
项目
金额"
)
private
BigDecimal
fyje
;
private
BigDecimal
fyje
;
/** 文件关联id */
/** 文件关联id */
...
@@ -87,23 +87,18 @@ public class SjFybp extends BaseEntity
...
@@ -87,23 +87,18 @@ public class SjFybp extends BaseEntity
private
String
spyj
;
private
String
spyj
;
/** 预留1 */
/** 预留1 */
@Excel
(
name
=
"预留1"
)
private
String
yl1
;
private
String
yl1
;
/** 预留2 */
/** 预留2 */
@Excel
(
name
=
"预留2"
)
private
String
yl2
;
private
String
yl2
;
/** 预留3 */
/** 预留3 */
@Excel
(
name
=
"预留3"
)
private
String
yl3
;
private
String
yl3
;
/** 预留4 */
/** 预留4 */
@Excel
(
name
=
"预留4"
)
private
String
yl4
;
private
String
yl4
;
/** 预留5 */
/** 预留5 */
@Excel
(
name
=
"预留5"
)
private
String
yl5
;
private
String
yl5
;
//费用审批查询 (传1 查不等于未提交的数据,2查等于已批复的数据)
//费用审批查询 (传1 查不等于未提交的数据,2查等于已批复的数据)
...
...
qianhe-ydsj/src/main/resources/static/fybp_drmb.xlsx
0 → 100644
View file @
0d6de0de
File added
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