Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
RuoYi-Vue-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
融通安全管理系统
RuoYi-Vue-master
Commits
8a390378
Commit
8a390378
authored
Jul 24, 2023
by
周昊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、开发pc端导出项目风险清单表excel文件接口
parent
09164130
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
398 additions
and
51 deletions
+398
-51
censoft-rongtong/src/main/java/com/censoft/censoftrongtong/controller/RiskPlanAppController.java
...oft/censoftrongtong/controller/RiskPlanAppController.java
+46
-46
censoft-rongtong/src/main/java/com/censoft/censoftrongtong/controller/RiskPlanController.java
...ensoft/censoftrongtong/controller/RiskPlanController.java
+15
-0
censoft-rongtong/src/main/java/com/censoft/censoftrongtong/domain/dto/RiskInherentListExportDto.java
...censoftrongtong/domain/dto/RiskInherentListExportDto.java
+123
-0
censoft-rongtong/src/main/java/com/censoft/censoftrongtong/mapper/RiskPlanInherentListMapper.java
...ft/censoftrongtong/mapper/RiskPlanInherentListMapper.java
+3
-4
censoft-rongtong/src/main/java/com/censoft/censoftrongtong/service/IRiskPlanInherentListService.java
...censoftrongtong/service/IRiskPlanInherentListService.java
+7
-0
censoft-rongtong/src/main/java/com/censoft/censoftrongtong/service/impl/RiskPlanInherentListServiceImpl.java
...ongtong/service/impl/RiskPlanInherentListServiceImpl.java
+166
-0
censoft-rongtong/src/main/resources/mapper/system/RiskPlanInherentListMapper.xml
...in/resources/mapper/system/RiskPlanInherentListMapper.xml
+37
-0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
.../main/java/com/ruoyi/framework/config/SecurityConfig.java
+1
-1
No files found.
censoft-rongtong/src/main/java/com/censoft/censoftrongtong/controller/RiskPlanAppController.java
View file @
8a390378
This diff is collapsed.
Click to expand it.
censoft-rongtong/src/main/java/com/censoft/censoftrongtong/controller/RiskPlanController.java
View file @
8a390378
...
...
@@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
import
cn.hutool.core.convert.Convert
;
import
com.censoft.censoftrongtong.domain.RiskPlan
;
import
com.censoft.censoftrongtong.domain.dto.RiskInherentListExportDto
;
import
com.censoft.censoftrongtong.domain.dto.RiskNotificationExportWordDto
;
import
com.censoft.censoftrongtong.service.IRiskPlanInherentListService
;
import
com.censoft.censoftrongtong.service.IRiskPlanService
;
...
...
@@ -128,4 +129,18 @@ public class RiskPlanController extends BaseController
WordUtil
word
=
new
WordUtil
();
word
.
exportWord
(
request
,
response
,
dataMap
,
"风险告知卡"
);
}
/**
* 导出项目风险清单表
*/
@GetMapping
(
"/exportExcel/InherentList/{inherentId}"
)
public
void
export
(
@PathVariable
Long
inherentId
,
HttpServletResponse
response
)
{
try
{
List
<
RiskInherentListExportDto
>
dtos
=
riskPlanInherentListService
.
getPlanInherentListByPlanId
(
inherentId
);
riskPlanInherentListService
.
exportPlanInherentList
(
response
,
dtos
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
censoft-rongtong/src/main/java/com/censoft/censoftrongtong/domain/dto/RiskInherentListExportDto.java
0 → 100644
View file @
8a390378
package
com
.
censoft
.
censoftrongtong
.
domain
.
dto
;
import
lombok.Data
;
/**
* 固有风险清单库对象 risk_inherent_list
*
* @author ruoyi
* @date 2023-06-26
*/
@Data
public
class
RiskInherentListExportDto
{
/**
* 项目信息-区域公司
*/
private
String
deptName
;
/**
* 项目名称
*/
private
String
projectName
;
/**
* 所属城市
*/
private
String
city
;
/**
* 项目业态
*/
private
String
businessFormat
;
/**
* 项目类型
*/
private
String
type
;
/**
* 项目风险清单-固有风险风险清单
*/
private
String
inherentName
;
/**
* 固有风险风险等级
*/
private
String
inherentLevel
;
/**
* 现有风险风险清单
*/
private
String
existingName
;
/**
* 现有风险风险等级
*/
private
String
existingLevel
;
/**
* 风险点位置
*/
private
String
presenceLocation
;
/**
* 可能导致的事故后果
*/
private
String
listType
;
/**
* 项目整体风险等级-固有风险
*/
private
String
inherentProjectLevel
;
/**
* 现有风险
*/
private
String
existingProjectLevel
;
/**
* 风险管控-应采取的管控措施
*/
private
String
inherentMeasuresAdministration
;
/**
* 已采取的管控措施
*/
private
String
existingMeasuresAdministration
;
/**
* 管控责任单位
*/
private
String
measuresDeptName
;
/**
* 管控责任人
*/
private
String
measuresUserName
;
/**
* 人员联系方式
*/
private
String
measuresUserPhone
;
/**
* 重大危险源管理-重大危险源名称
*/
private
String
hazardSourceName
;
/**
* 是否存在重大危险源
*/
private
String
majorHazardSource
;
/**
* 重大危险源描述
*/
private
String
majorHazardDescription
;
/**
* 判定依据
*/
private
String
referenceBasis
;
}
censoft-rongtong/src/main/java/com/censoft/censoftrongtong/mapper/RiskPlanInherentListMapper.java
View file @
8a390378
...
...
@@ -2,10 +2,7 @@ package com.censoft.censoftrongtong.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.censoft.censoftrongtong.domain.RiskPlanInherentList
;
import
com.censoft.censoftrongtong.domain.dto.RiskNotificationExportWordDto
;
import
com.censoft.censoftrongtong.domain.dto.RiskPlanAppExistingListDto
;
import
com.censoft.censoftrongtong.domain.dto.RiskPlanAppInherentListDetailsDto
;
import
com.censoft.censoftrongtong.domain.dto.RiskPlanAppInherentListDto
;
import
com.censoft.censoftrongtong.domain.dto.*
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -75,4 +72,6 @@ public interface RiskPlanInherentListMapper extends BaseMapper<RiskPlanInherentL
List
<
RiskPlanAppExistingListDto
>
getExistingListByInherentId
(
@Param
(
"inherentId"
)
Long
inherentId
);
RiskNotificationExportWordDto
getRiskNotificationExportWordDto
(
@Param
(
"inherentId"
)
Long
inherentId
);
List
<
RiskInherentListExportDto
>
getPlanInherentListByPlanId
(
@Param
(
"planId"
)
Long
planId
);
}
censoft-rongtong/src/main/java/com/censoft/censoftrongtong/service/IRiskPlanInherentListService.java
View file @
8a390378
...
...
@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.censoft.censoftrongtong.domain.RiskPlanInherentList
;
import
com.censoft.censoftrongtong.domain.dto.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.util.List
;
/**
...
...
@@ -72,4 +75,8 @@ public interface IRiskPlanInherentListService extends IService<RiskPlanInherentL
List
<
RiskPlanAppExistingListDto
>
getExistingListByInherentId
(
Long
inherentId
);
RiskNotificationExportWordDto
getRiskNotificationExportWordDto
(
Long
inherentId
);
void
exportPlanInherentList
(
HttpServletResponse
response
,
List
<
RiskInherentListExportDto
>
dtos
)
throws
IOException
;
List
<
RiskInherentListExportDto
>
getPlanInherentListByPlanId
(
Long
planId
);
}
censoft-rongtong/src/main/java/com/censoft/censoftrongtong/service/impl/RiskPlanInherentListServiceImpl.java
View file @
8a390378
package
com
.
censoft
.
censoftrongtong
.
service
.
impl
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
cn.hutool.poi.excel.ExcelWriter
;
import
cn.hutool.poi.excel.cell.CellUtil
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.censoft.censoftrongtong.domain.RiskPlan
;
import
com.censoft.censoftrongtong.domain.RiskPlanInherentList
;
...
...
@@ -14,11 +17,18 @@ import com.censoft.censoftrongtong.service.IRiskPlanInherentListService;
import
com.censoft.censoftrongtong.service.IRiskPlanTaskService
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.system.service.ISysUploadFileService
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -228,6 +238,162 @@ public class RiskPlanInherentListServiceImpl
return
riskPlanInherentListMapper
.
getRiskNotificationExportWordDto
(
inherentId
);
}
@Override
public
void
exportPlanInherentList
(
HttpServletResponse
response
,
List
<
RiskInherentListExportDto
>
dtos
)
throws
IOException
{
ExcelWriter
writer
=
ExcelUtil
.
getWriter
();
//创建HSSFWorkbook对象(excel的文档对象)
Workbook
workbook
=
writer
.
getWorkbook
();
//合并单元格后的标题行,使用默认标题样式
//序号
writer
.
merge
(
0
,
2
,
0
,
0
,
"序号"
,
true
);
//项目信息
writer
.
merge
(
0
,
0
,
1
,
5
,
"项目信息"
,
true
);
writer
.
merge
(
1
,
2
,
1
,
1
,
"区域公司"
,
true
);
writer
.
merge
(
1
,
2
,
2
,
2
,
"项目名称"
,
true
);
writer
.
merge
(
1
,
2
,
3
,
3
,
"所属城市"
,
true
);
writer
.
merge
(
1
,
2
,
4
,
4
,
"项目业态"
,
true
);
writer
.
merge
(
1
,
2
,
5
,
5
,
"项目类型"
,
true
);
//项目风险清单
writer
.
merge
(
0
,
0
,
6
,
11
,
"项目风险清单"
,
true
);
writer
.
merge
(
1
,
1
,
6
,
7
,
"固有风险"
,
true
);
writer
.
merge
(
1
,
1
,
8
,
9
,
"现有风险"
,
true
);
Cell
cell62
=
writer
.
getOrCreateCell
(
6
,
2
);
CellUtil
.
setCellValue
(
cell62
,
"风险清单"
,
writer
.
getHeadCellStyle
());
Cell
cell72
=
writer
.
getOrCreateCell
(
7
,
2
);
CellUtil
.
setCellValue
(
cell72
,
"风险等级"
,
writer
.
getHeadCellStyle
());
Cell
cell82
=
writer
.
getOrCreateCell
(
8
,
2
);
CellUtil
.
setCellValue
(
cell82
,
"风险清单"
,
writer
.
getHeadCellStyle
());
Cell
cell92
=
writer
.
getOrCreateCell
(
9
,
2
);
CellUtil
.
setCellValue
(
cell92
,
"风险等级"
,
writer
.
getHeadCellStyle
());
writer
.
merge
(
1
,
2
,
10
,
10
,
"风险点位置"
,
true
);
writer
.
merge
(
1
,
2
,
11
,
11
,
"可能导致的事故后果"
,
true
);
//项目整体风险等级
writer
.
merge
(
0
,
0
,
12
,
13
,
"项目整体风险等级"
,
true
);
writer
.
merge
(
1
,
2
,
12
,
12
,
"固有风险"
,
true
);
writer
.
merge
(
1
,
2
,
13
,
13
,
"现状风险"
,
true
);
//风险管控
writer
.
merge
(
0
,
0
,
14
,
18
,
"风险管控"
,
true
);
writer
.
merge
(
1
,
2
,
14
,
14
,
"应采取的管控措施"
,
true
);
writer
.
merge
(
1
,
2
,
15
,
15
,
"已采取的管控措施"
,
true
);
writer
.
merge
(
1
,
1
,
16
,
18
,
"分级管控"
,
true
);
Cell
cell162
=
writer
.
getOrCreateCell
(
16
,
2
);
CellUtil
.
setCellValue
(
cell162
,
"管控责任单位"
,
writer
.
getHeadCellStyle
());
Cell
cell172
=
writer
.
getOrCreateCell
(
17
,
2
);
CellUtil
.
setCellValue
(
cell172
,
"管控责任人"
,
writer
.
getHeadCellStyle
());
Cell
cell182
=
writer
.
getOrCreateCell
(
18
,
2
);
CellUtil
.
setCellValue
(
cell182
,
"人员联系方式"
,
writer
.
getHeadCellStyle
());
//重大危险源管理
writer
.
merge
(
0
,
0
,
19
,
21
,
"重大危险源管理"
,
true
);
writer
.
merge
(
1
,
2
,
19
,
19
,
"重大危险源名称"
,
true
);
writer
.
merge
(
1
,
2
,
20
,
20
,
"是否存在重大危险源"
,
true
);
writer
.
merge
(
1
,
2
,
21
,
21
,
"重大危险源描述"
,
true
);
//判定依据
writer
.
merge
(
0
,
2
,
22
,
22
,
"判定依据"
,
true
);
//数据
for
(
int
i
=
0
;
i
<
dtos
.
size
();
i
++)
{
RiskInherentListExportDto
dto
=
dtos
.
get
(
i
);
//项目信息
{
Cell
celli0
=
writer
.
getOrCreateCell
(
0
,
i
+
3
);
CellUtil
.
setCellValue
(
celli0
,
i
+
1
,
writer
.
getCellStyle
());
Cell
celli1
=
writer
.
getOrCreateCell
(
1
,
i
+
3
);
CellUtil
.
setCellValue
(
celli1
,
dto
.
getDeptName
(),
writer
.
getCellStyle
());
Cell
celli2
=
writer
.
getOrCreateCell
(
2
,
i
+
3
);
CellUtil
.
setCellValue
(
celli2
,
dto
.
getProjectName
(),
writer
.
getCellStyle
());
Cell
celli3
=
writer
.
getOrCreateCell
(
3
,
i
+
3
);
CellUtil
.
setCellValue
(
celli3
,
dto
.
getCity
(),
writer
.
getCellStyle
());
Cell
celli4
=
writer
.
getOrCreateCell
(
4
,
i
+
3
);
CellUtil
.
setCellValue
(
celli4
,
dto
.
getBusinessFormat
(),
writer
.
getCellStyle
());
Cell
celli5
=
writer
.
getOrCreateCell
(
5
,
i
+
3
);
CellUtil
.
setCellValue
(
celli5
,
dto
.
getType
(),
writer
.
getCellStyle
());
}
//项目风险清单
{
Cell
celli6
=
writer
.
getOrCreateCell
(
6
,
i
+
3
);
CellUtil
.
setCellValue
(
celli6
,
dto
.
getInherentName
(),
writer
.
getCellStyle
());
Cell
celli7
=
writer
.
getOrCreateCell
(
7
,
i
+
3
);
CellUtil
.
setCellValue
(
celli7
,
dto
.
getInherentLevel
(),
writer
.
getCellStyle
());
Cell
celli8
=
writer
.
getOrCreateCell
(
8
,
i
+
3
);
CellUtil
.
setCellValue
(
celli8
,
dto
.
getExistingName
(),
writer
.
getCellStyle
());
Cell
celli9
=
writer
.
getOrCreateCell
(
9
,
i
+
3
);
CellUtil
.
setCellValue
(
celli9
,
dto
.
getExistingLevel
(),
writer
.
getCellStyle
());
Cell
celli10
=
writer
.
getOrCreateCell
(
10
,
i
+
3
);
CellUtil
.
setCellValue
(
celli10
,
dto
.
getPresenceLocation
(),
writer
.
getCellStyle
());
Cell
celli11
=
writer
.
getOrCreateCell
(
11
,
i
+
3
);
CellUtil
.
setCellValue
(
celli11
,
dto
.
getListType
(),
writer
.
getCellStyle
());
}
//项目整体风险等级
{
Cell
celli12
=
writer
.
getOrCreateCell
(
12
,
i
+
3
);
CellUtil
.
setCellValue
(
celli12
,
dto
.
getInherentProjectLevel
(),
writer
.
getCellStyle
());
Cell
celli13
=
writer
.
getOrCreateCell
(
13
,
i
+
3
);
CellUtil
.
setCellValue
(
celli13
,
dto
.
getExistingProjectLevel
(),
writer
.
getCellStyle
());
}
//风险管控
{
Cell
celli14
=
writer
.
getOrCreateCell
(
14
,
i
+
3
);
CellUtil
.
setCellValue
(
celli14
,
dto
.
getInherentMeasuresAdministration
(),
writer
.
getCellStyle
());
Cell
celli15
=
writer
.
getOrCreateCell
(
15
,
i
+
3
);
CellUtil
.
setCellValue
(
celli15
,
dto
.
getExistingMeasuresAdministration
(),
writer
.
getCellStyle
());
Cell
celli16
=
writer
.
getOrCreateCell
(
16
,
i
+
3
);
CellUtil
.
setCellValue
(
celli16
,
dto
.
getMeasuresDeptName
(),
writer
.
getCellStyle
());
Cell
celli17
=
writer
.
getOrCreateCell
(
17
,
i
+
3
);
CellUtil
.
setCellValue
(
celli17
,
dto
.
getMeasuresUserName
(),
writer
.
getCellStyle
());
Cell
celli18
=
writer
.
getOrCreateCell
(
18
,
i
+
3
);
CellUtil
.
setCellValue
(
celli18
,
dto
.
getMeasuresUserPhone
(),
writer
.
getCellStyle
());
}
//重大危险源管理
{
Cell
celli19
=
writer
.
getOrCreateCell
(
19
,
i
+
3
);
CellUtil
.
setCellValue
(
celli19
,
dto
.
getHazardSourceName
(),
writer
.
getCellStyle
());
Cell
celli20
=
writer
.
getOrCreateCell
(
20
,
i
+
3
);
CellUtil
.
setCellValue
(
celli20
,
dto
.
getMajorHazardSource
(),
writer
.
getCellStyle
());
Cell
celli21
=
writer
.
getOrCreateCell
(
21
,
i
+
3
);
CellUtil
.
setCellValue
(
celli21
,
dto
.
getMajorHazardDescription
(),
writer
.
getCellStyle
());
Cell
celli22
=
writer
.
getOrCreateCell
(
22
,
i
+
3
);
CellUtil
.
setCellValue
(
celli22
,
dto
.
getReferenceBasis
(),
writer
.
getCellStyle
());
}
}
String
filename
=
URLEncoder
.
encode
(
"项目风险清单表.xls"
,
"UTF-8"
);
//输出Excel文件
OutputStream
output
=
response
.
getOutputStream
();
response
.
reset
();
response
.
setHeader
(
"Content-disposition"
,
"attachment; filename="
+
filename
+
""
);
response
.
setContentType
(
"application/msexcel"
);
workbook
.
write
(
output
);
output
.
close
();
}
@Override
public
List
<
RiskInherentListExportDto
>
getPlanInherentListByPlanId
(
Long
planId
)
{
return
riskPlanInherentListMapper
.
getPlanInherentListByPlanId
(
planId
);
}
/**
* 查询固有风险清单库
...
...
censoft-rongtong/src/main/resources/mapper/system/RiskPlanInherentListMapper.xml
View file @
8a390378
...
...
@@ -389,4 +389,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
rpil.id = #{inherentId}
</select>
<select
id=
"getPlanInherentListByPlanId"
resultType=
"com.censoft.censoftrongtong.domain.dto.RiskInherentListExportDto"
>
SELECT
sd.dept_name AS deptName,
lp.`name` AS projectName,
lp.city AS city,
lp.type AS type,
rpil.`name` AS inherentName,
rpil.`level` AS inherentLevel,
rpel.`name` AS existingName,
rpel.`level` AS existingLevel,
rpil.`level` AS inherentProjectLevel,
rpel.`level` AS existingProjectLevel,
rpil.presence_location AS presenceLocation,
rpil.type AS listType,
rpil.measures_administration AS inherentMeasuresAdministration,
rpel.measures_administration AS existingMeasuresAdministration,
rpil.measures_dept_name AS measuresDeptName,
rpil.measures_user_name AS measuresUserName,
rpil.measures_user_phone AS measuresUserPhone,
rpil.hazard_source_name AS hazardSourceName,
rpil.major_hazard_source AS majorHazardSource,
rpil.major_hazard_source_description AS majorHazardDescription,
rpil.reference_basis AS referenceBasis
FROM
risk_plan rp
LEFT JOIN ledger_project lp ON lp.id = rp.project_id
LEFT JOIN sys_dept sd ON sd.dept_id = lp.dept_id
LEFT JOIN ledger_building lb ON FIND_IN_SET( lb.id, rp.building_ids )
LEFT JOIN ledger_floor lf ON lf.building_id = lb.id
LEFT JOIN ledger_room lr ON lr.floor_id = lf.id
LEFT JOIN risk_plan_inherent_list rpil ON rpil.room_id = lr.id
LEFT JOIN risk_plan_existing_list rpel ON rpel.inherent_id = rpil.id
WHERE
rp.id = #{planId}
AND rpil.id IS NOT NULL
</select>
</mapper>
\ No newline at end of file
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
View file @
8a390378
...
...
@@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
.
authorizeRequests
()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
.
antMatchers
(
"/login"
,
"/app-api/login"
,
"/register"
,
"/captchaImage"
).
permitAll
()
.
antMatchers
(
"/login"
,
"/app-api/login"
,
"/app-api/risk/plan/test"
,
"/register"
,
"/captchaImage"
).
permitAll
()
// 静态资源,可匿名访问
.
antMatchers
(
HttpMethod
.
GET
,
"/"
,
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
,
"/profile/**"
).
permitAll
()
.
antMatchers
(
"/swagger-ui.html"
,
"/swagger-resources/**"
,
"/webjars/**"
,
"/*/api-docs"
,
"/druid/**"
).
permitAll
()
...
...
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