Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
a8e79b14
Commit
a8e79b14
authored
Nov 08, 2021
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改poi引用版本4.0.1
防火监督计划任务报告生成
parent
9f24cc09
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
551 additions
and
139 deletions
+551
-139
pom.xml
amos-boot-biz-common/pom.xml
+1
-1
DateUtils.java
...ava/com/yeejoin/amos/boot/biz/common/utils/DateUtils.java
+1
-6
WorkFlowUriEnum.java
...com/yeejoin/amos/patrol/common/enums/WorkFlowUriEnum.java
+3
-2
pom.xml
...-boot-module-api/amos-boot-module-supervision-api/pom.xml
+6
-0
CheckReportDto.java
...join/amos/supervision/core/common/dto/CheckReportDto.java
+10
-1
FileHelper.java
...m/yeejoin/amos/latentdanger/business/util/FileHelper.java
+62
-37
pom.xml
...-boot-module-biz/amos-boot-module-maintenance-biz/pom.xml
+18
-0
FileHelper.java
...om/yeejoin/amos/maintenance/business/util/FileHelper.java
+25
-24
LatentDangerController.java
...os/patrol/business/controller/LatentDangerController.java
+17
-0
LatentDangerServiceImpl.java
...patrol/business/service/impl/LatentDangerServiceImpl.java
+11
-0
ILatentDangerService.java
...s/patrol/business/service/intfc/ILatentDangerService.java
+2
-0
FileHelper.java
...ava/com/yeejoin/amos/patrol/business/util/FileHelper.java
+28
-27
pom.xml
...-boot-module-biz/amos-boot-module-supervision-biz/pom.xml
+66
-0
CheckReportController.java
...upervision/business/controller/CheckReportController.java
+12
-5
CheckReportServiceImpl.java
...rvision/business/service/impl/CheckReportServiceImpl.java
+212
-6
ICheckReportService.java
...pervision/business/service/intfc/ICheckReportService.java
+12
-0
FileHelper.java
...om/yeejoin/amos/supervision/business/util/FileHelper.java
+28
-26
pom.xml
amos-boot-module/pom.xml
+6
-0
pom.xml
amos-boot-system-supervision/pom.xml
+18
-0
CheckReportMapper.xml
...vision/src/main/resources/db/mapper/CheckReportMapper.xml
+2
-1
check-report-template.docx
...n/src/main/resources/templates/check-report-template.docx
+0
-0
pom.xml
pom.xml
+11
-3
No files found.
amos-boot-biz-common/pom.xml
View file @
a8e79b14
...
@@ -99,7 +99,7 @@
...
@@ -99,7 +99,7 @@
<dependency>
<dependency>
<groupId>
cn.afterturn
</groupId>
<groupId>
cn.afterturn
</groupId>
<artifactId>
easypoi-base
</artifactId>
<artifactId>
easypoi-base
</artifactId>
<version>
3.0.3
</version>
<version>
4.0.0
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
cn.afterturn
</groupId>
<groupId>
cn.afterturn
</groupId>
...
...
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/DateUtils.java
View file @
a8e79b14
...
@@ -26,6 +26,7 @@ public class DateUtils {
...
@@ -26,6 +26,7 @@ public class DateUtils {
public
static
final
String
DATE_PATTERN_NUM
=
"yyyyMMdd"
;
public
static
final
String
DATE_PATTERN_NUM
=
"yyyyMMdd"
;
public
static
final
String
CHN_DATE_PATTERN_YEAR
=
"yyyy年"
;
public
static
final
String
CHN_DATE_PATTERN_YEAR
=
"yyyy年"
;
public
static
final
String
CHN_DATE_PATTERN_MONTH
=
"MM月"
;
public
static
final
String
CHN_DATE_PATTERN_MONTH
=
"MM月"
;
public
static
final
String
CHN_DATE_PATTERN
=
"yyyy年MM月dd日"
;
/**
/**
* 获取 当前年、半年、季度、月、日、小时 开始结束时间
* 获取 当前年、半年、季度、月、日、小时 开始结束时间
...
@@ -799,12 +800,6 @@ public class DateUtils {
...
@@ -799,12 +800,6 @@ public class DateUtils {
return
getDate
(
calendar
.
getTime
());
return
getDate
(
calendar
.
getTime
());
}
}
public
static
String
getWeekDate
(
Date
date
)
throws
ParseException
{
String
month
=
dateFormat
(
date
,
CHN_DATE_PATTERN_MONTH
);
String
weekDateStr
=
getWeekBeginDate
(
date
)
+
"-"
+
getWeekEndDate
(
date
);
return
month
+
weekDateStr
+
"日"
;
}
/**
/**
* 将秒数转换为时分秒格式
* 将秒数转换为时分秒格式
* @param times
* @param times
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-patrol-api/src/main/java/com/yeejoin/amos/patrol/common/enums/WorkFlowUriEnum.java
View file @
a8e79b14
...
@@ -13,11 +13,12 @@ public enum WorkFlowUriEnum {
...
@@ -13,11 +13,12 @@ public enum WorkFlowUriEnum {
已执行任务有
ID
(
"已执行任务有ID"
,
"/workflow/activitiHistory/all-historytasks?processDefinitionKey={processDefinitionKey}&userId={userId}"
,
"processDefinitionKey,userId"
),
已执行任务有
ID
(
"已执行任务有ID"
,
"/workflow/activitiHistory/all-historytasks?processDefinitionKey={processDefinitionKey}&userId={userId}"
,
"processDefinitionKey,userId"
),
启动免登录流程
(
"启动免登录流程"
,
"/processes/{appKey}"
,
"appKey"
),
启动免登录流程
(
"启动免登录流程"
,
"/processes/{appKey}"
,
"appKey"
),
当前节点
(
"当前节点"
,
"/wf/taskstodo?processInstanceId={processInstanceId}"
,
"processInstanceId"
),
当前节点
(
"当前节点"
,
"/wf/taskstodo?processInstanceId={processInstanceId}"
,
"processInstanceId"
),
执行流程
(
"执行流程"
,
"/workflow/task/pickupAndCompleteTask/{taskId}"
,
"taskId"
),
执行流程
(
"执行流程"
,
"/workflow/task/pickupAndCom
task/{processInstanceId}
pleteTask/{taskId}"
,
"taskId"
),
终止流程
(
"终止流程"
,
"/wf/processes/{processInstanceId}?deleteReason={deleteReason}"
,
"processInstanceId,deleteReason"
),
终止流程
(
"终止流程"
,
"/wf/processes/{processInstanceId}?deleteReason={deleteReason}"
,
"processInstanceId,deleteReason"
),
当前子节点
(
"当前子节点"
,
"/wf/processes/{processInstanceId}/tasks?taskDefinitionKey={taskDefinitionKey}"
,
"processInstanceId,taskDefinitionKey"
),
当前子节点
(
"当前子节点"
,
"/wf/processes/{processInstanceId}/tasks?taskDefinitionKey={taskDefinitionKey}"
,
"processInstanceId,taskDefinitionKey"
),
工作流流水
(
"工作流流水"
,
"/wf/processes/{processInstanceId}/tasks"
,
"processInstanceId"
),
工作流流水
(
"工作流流水"
,
"/wf/processes/{processInstanceId}/tasks"
,
"processInstanceId"
),
子节点信息
(
"子节点信息"
,
"/workflow/task/list/all/{instanceId}"
,
"instanceId"
);
子节点信息
(
"子节点信息"
,
"/workflow/task/list/all/{instanceId}"
,
"instanceId"
),
当前任务
(
"子节点信息"
,
"/workflow/task/{processInstanceId}"
,
"processInstanceId"
);
private
String
desc
;
private
String
desc
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-supervision-api/pom.xml
View file @
a8e79b14
...
@@ -22,6 +22,12 @@
...
@@ -22,6 +22,12 @@
<groupId>
cn.afterturn
</groupId>
<groupId>
cn.afterturn
</groupId>
<artifactId>
easypoi-base
</artifactId>
<artifactId>
easypoi-base
</artifactId>
<version>
3.0.3
</version>
<version>
3.0.3
</version>
<exclusions>
<exclusion>
<artifactId>
poi-ooxml
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
cn.afterturn
</groupId>
<groupId>
cn.afterturn
</groupId>
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-supervision-api/src/main/java/com/yeejoin/amos/supervision/core/common/dto/CheckReportDto.java
View file @
a8e79b14
...
@@ -68,7 +68,7 @@ public class CheckReportDto implements Serializable {
...
@@ -68,7 +68,7 @@ public class CheckReportDto implements Serializable {
Integer
reviewReformingCount
;
Integer
reviewReformingCount
;
@ApiModelProperty
(
value
=
"剩余隐患数量"
)
@ApiModelProperty
(
value
=
"剩余隐患数量"
)
Integer
remain
der
DangerCount
;
Integer
remain
ing
DangerCount
;
@ApiModelProperty
(
value
=
"机构代码"
)
@ApiModelProperty
(
value
=
"机构代码"
)
String
orgCode
;
String
orgCode
;
...
@@ -90,4 +90,13 @@ public class CheckReportDto implements Serializable {
...
@@ -90,4 +90,13 @@ public class CheckReportDto implements Serializable {
@ApiModelProperty
(
value
=
"本次复查隐患id"
)
@ApiModelProperty
(
value
=
"本次复查隐患id"
)
String
reviewDangerIds
;
String
reviewDangerIds
;
@ApiModelProperty
(
value
=
"计划执行频次"
)
String
planCheckFrequencyType
;
@ApiModelProperty
(
value
=
"报告时期"
)
String
reportDate
;
@ApiModelProperty
(
value
=
"当前日期"
)
String
nowDate
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/business/util/FileHelper.java
View file @
a8e79b14
...
@@ -5,18 +5,26 @@ import cn.afterturn.easypoi.excel.ExcelImportUtil;
...
@@ -5,18 +5,26 @@ import cn.afterturn.easypoi.excel.ExcelImportUtil;
import
cn.afterturn.easypoi.excel.entity.ExportParams
;
import
cn.afterturn.easypoi.excel.entity.ExportParams
;
import
cn.afterturn.easypoi.excel.entity.ImportParams
;
import
cn.afterturn.easypoi.excel.entity.ImportParams
;
import
cn.afterturn.easypoi.excel.entity.enmus.ExcelType
;
import
cn.afterturn.easypoi.excel.entity.enmus.ExcelType
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.MultiFormatWriter
;
import
com.google.zxing.client.j2se.MatrixToImageWriter
;
import
com.google.zxing.common.BitMatrix
;
import
com.yeejoin.amos.latentdanger.exception.YeeException
;
import
com.yeejoin.amos.latentdanger.exception.YeeException
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.poi.hslf.usermodel.HSLFSlideShow
;
import
org.apache.poi.hslf.usermodel.HSLFSlideShow
;
import
org.apache.poi.hssf.usermodel.*
;
import
org.apache.poi.hssf.usermodel.DVConstraint
;
import
org.apache.poi.hssf.usermodel.HSSFCell
;
import
org.apache.poi.hssf.usermodel.HSSFCellStyle
;
import
org.apache.poi.hssf.usermodel.HSSFDataValidation
;
import
org.apache.poi.hssf.usermodel.HSSFFont
;
import
org.apache.poi.hssf.usermodel.HSSFRow
;
import
org.apache.poi.hssf.usermodel.HSSFSheet
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.hwpf.HWPFDocument
;
import
org.apache.poi.hwpf.HWPFDocument
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.ss.usermodel.DataValidation
;
import
org.apache.poi.ss.usermodel.DataValidationConstraint
;
import
org.apache.poi.ss.usermodel.DataValidationHelper
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.ss.util.CellRangeAddressList
;
import
org.apache.poi.ss.util.CellRangeAddressList
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbookFactory
;
import
org.apache.poi.xwpf.usermodel.XWPFDocument
;
import
org.apache.poi.xwpf.usermodel.XWPFDocument
;
import
org.jsoup.Jsoup
;
import
org.jsoup.Jsoup
;
import
org.jsoup.nodes.Document
;
import
org.jsoup.nodes.Document
;
...
@@ -28,18 +36,35 @@ import org.springframework.util.ObjectUtils;
...
@@ -28,18 +36,35 @@ import org.springframework.util.ObjectUtils;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.imageio.ImageIO
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.awt.image.BufferedImage
;
import
java.io.BufferedInputStream
;
import
java.io.*
;
import
java.io.BufferedOutputStream
;
import
java.io.BufferedReader
;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.FileReader
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.OutputStream
;
import
java.io.OutputStreamWriter
;
import
java.io.UnsupportedEncodingException
;
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.nio.channels.Channel
;
import
java.nio.channels.Channel
;
import
java.nio.channels.FileChannel
;
import
java.nio.channels.FileChannel
;
import
java.util.*
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.NoSuchElementException
;
import
java.util.TreeSet
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
import
java.util.zip.ZipOutputStream
;
...
@@ -62,33 +87,33 @@ public class FileHelper {
...
@@ -62,33 +87,33 @@ public class FileHelper {
* @param file
* @param file
* @return
* @return
*/
*/
public
static
boolean
isExcel2003
(
File
file
)
{
//
public static boolean isExcel2003(File file) {
InputStream
is
=
null
;
//
InputStream is = null;
Workbook
wb
=
null
;
//
Workbook wb = null;
try
{
//
try {
is
=
new
FileInputStream
(
file
);
//
is = new FileInputStream(file);
wb
=
WorkbookFactory
.
create
(
is
);
// wb = XSSFWorkbookFactory.createWorkbook
(is);
if
(
wb
instanceof
XSSFWorkbook
)
{
//
if (wb instanceof XSSFWorkbook) {
return
false
;
//
return false;
}
else
if
(
wb
instanceof
HSSFWorkbook
)
{
//
} else if (wb instanceof HSSFWorkbook) {
return
true
;
//
return true;
}
//
}
}
catch
(
Exception
e
)
{
//
} catch (Exception e) {
return
false
;
//
return false;
}
finally
{
//
} finally {
try
{
//
try {
if
(
null
!=
is
)
{
//
if (null != is) {
is
.
close
();
//
is.close();
}
//
}
if
(
null
!=
wb
)
{
//
if (null != wb) {
wb
.
close
();
//
wb.close();
}
//
}
}
catch
(
IOException
e
)
{
//
} catch (IOException e) {
e
.
printStackTrace
();
//
e.printStackTrace();
}
//
}
}
//
}
return
true
;
//
return true;
}
//
}
/**
/**
*
*
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/pom.xml
View file @
a8e79b14
...
@@ -15,6 +15,12 @@
...
@@ -15,6 +15,12 @@
<groupId>
com.amosframework.boot
</groupId>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-module-maintenance-api
</artifactId>
<artifactId>
amos-boot-module-maintenance-api
</artifactId>
<version>
${amos-biz-boot.version}
</version>
<version>
${amos-biz-boot.version}
</version>
<exclusions>
<exclusion>
<artifactId>
easypoi-base
</artifactId>
<groupId>
cn.afterturn
</groupId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.yeejoin
</groupId>
<groupId>
com.yeejoin
</groupId>
...
@@ -71,6 +77,12 @@
...
@@ -71,6 +77,12 @@
<groupId>
org.apache.poi
</groupId>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-scratchpad
</artifactId>
<artifactId>
poi-scratchpad
</artifactId>
<version>
3.15
</version>
<version>
3.15
</version>
<exclusions>
<exclusion>
<artifactId>
poi
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
...
@@ -87,6 +99,12 @@
...
@@ -87,6 +99,12 @@
<groupId>
org.apache.tika
</groupId>
<groupId>
org.apache.tika
</groupId>
<artifactId>
tika-parsers
</artifactId>
<artifactId>
tika-parsers
</artifactId>
<version>
1.13
</version>
<version>
1.13
</version>
<exclusions>
<exclusion>
<artifactId>
poi
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/util/FileHelper.java
View file @
a8e79b14
...
@@ -139,28 +139,28 @@ public class FileHelper {
...
@@ -139,28 +139,28 @@ public class FileHelper {
* @param file
* @param file
* @return
* @return
*/
*/
public
static
boolean
isPPT2003
(
File
file
)
{
//
public static boolean isPPT2003(File file) {
InputStream
is
=
null
;
//
InputStream is = null;
HSLFSlideShow
ppt
=
null
;
//
HSLFSlideShow ppt = null;
try
{
//
try {
is
=
new
FileInputStream
(
file
);
//
is = new FileInputStream(file);
ppt
=
new
HSLFSlideShow
(
is
);
//
ppt = new HSLFSlideShow(is);
}
catch
(
Exception
e
)
{
//
} catch (Exception e) {
return
false
;
//
return false;
}
finally
{
//
} finally {
try
{
//
try {
if
(
null
!=
is
)
{
//
if (null != is) {
is
.
close
();
//
is.close();
}
//
}
if
(
null
!=
ppt
)
{
//
if (null != ppt) {
ppt
.
close
();
//
ppt.close();
}
//
}
}
catch
(
IOException
e
)
{
//
} catch (IOException e) {
e
.
printStackTrace
();
//
e.printStackTrace();
}
//
}
}
//
}
return
true
;
//
return true;
}
//
}
/**
/**
*
*
...
@@ -1109,12 +1109,13 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
...
@@ -1109,12 +1109,13 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
//表头样式
//表头样式
HSSFCellStyle
style
=
wb
.
createCellStyle
();
HSSFCellStyle
style
=
wb
.
createCellStyle
();
style
.
setAlignment
(
HSSFCellStyle
.
ALIGN_CENTER
);
// 创建一个居中格式
// style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
style
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
// 创建一个居中格式poi 4.0.0+
//字体样式
//字体样式
HSSFFont
fontStyle
=
wb
.
createFont
();
HSSFFont
fontStyle
=
wb
.
createFont
();
fontStyle
.
setFontName
(
"微软雅黑"
);
fontStyle
.
setFontName
(
"微软雅黑"
);
fontStyle
.
setFontHeightInPoints
((
short
)
12
);
fontStyle
.
setFontHeightInPoints
((
short
)
12
);
fontStyle
.
setBoldweight
(
HSSFFont
.
BOLDWEIGHT_BOLD
);
//
fontStyle.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
style
.
setFont
(
fontStyle
);
style
.
setFont
(
fontStyle
);
//新建sheet
//新建sheet
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/controller/LatentDangerController.java
View file @
a8e79b14
...
@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -311,4 +312,20 @@ public class LatentDangerController extends AbstractBaseController {
...
@@ -311,4 +312,20 @@ public class LatentDangerController extends AbstractBaseController {
return
CommonResponseUtil
.
failure
(
e
.
getMessage
());
return
CommonResponseUtil
.
failure
(
e
.
getMessage
());
}
}
}
}
@ApiOperation
(
value
=
"隐患当前任务"
,
notes
=
"隐患当前任务"
)
@GetMapping
(
value
=
"/detail/task/{processInstanceId}"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
public
CommonResponse
detail
(
@PathVariable
String
processInstanceId
)
{
try
{
AgencyUserModel
user
=
getUserInfo
();
if
(
ObjectUtils
.
isEmpty
(
user
))
{
return
CommonResponseUtil
.
failure
(
"用户session过期"
);
}
return
CommonResponseUtil
.
success
(
iLatentDangerService
.
queryTaskByInstanceId
(
processInstanceId
));
}
catch
(
Exception
e
)
{
logger
.
error
(
"获取隐患任务出错"
,
e
.
getMessage
());
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/LatentDangerServiceImpl.java
View file @
a8e79b14
...
@@ -1666,4 +1666,15 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
...
@@ -1666,4 +1666,15 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
}
}
return
informerList
;
return
informerList
;
}
}
@Override
public
String
queryTaskByInstanceId
(
String
processInstanceId
)
{
String
taskId
=
null
;
JSONObject
taskJson
=
remoteWorkFlowService
.
queryTask
(
processInstanceId
);
if
(
null
!=
taskJson
)
{
JSONObject
dataJson
=
(
JSONObject
)
taskJson
.
get
(
"data"
);
taskId
=
(
String
)
dataJson
.
get
(
"id"
);
}
return
taskId
;
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/intfc/ILatentDangerService.java
View file @
a8e79b14
...
@@ -81,4 +81,6 @@ public interface ILatentDangerService {
...
@@ -81,4 +81,6 @@ public interface ILatentDangerService {
List
<
DangerListResponse
>
export
(
PageParam
pageParam
);
List
<
DangerListResponse
>
export
(
PageParam
pageParam
);
List
<
DangerTimeAxisVo
>
queryExecuteLog
(
Integer
dateTime
);
List
<
DangerTimeAxisVo
>
queryExecuteLog
(
Integer
dateTime
);
String
queryTaskByInstanceId
(
String
processInstanceId
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/util/FileHelper.java
View file @
a8e79b14
...
@@ -18,6 +18,7 @@ import org.apache.poi.hwpf.HWPFDocument;
...
@@ -18,6 +18,7 @@ import org.apache.poi.hwpf.HWPFDocument;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.ss.util.CellRangeAddressList
;
import
org.apache.poi.ss.util.CellRangeAddressList
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbookFactory
;
import
org.apache.poi.xwpf.usermodel.XWPFDocument
;
import
org.apache.poi.xwpf.usermodel.XWPFDocument
;
import
org.jsoup.Jsoup
;
import
org.jsoup.Jsoup
;
import
org.jsoup.nodes.Document
;
import
org.jsoup.nodes.Document
;
...
@@ -63,33 +64,33 @@ public class FileHelper {
...
@@ -63,33 +64,33 @@ public class FileHelper {
* @param file
* @param file
* @return
* @return
*/
*/
public
static
boolean
isExcel2003
(
File
file
)
{
//
public static boolean isExcel2003(File file) {
InputStream
is
=
null
;
//
InputStream is = null;
Workbook
wb
=
null
;
//
Workbook wb = null;
try
{
//
try {
is
=
new
FileInputStream
(
file
);
//
is = new FileInputStream(file);
wb
=
WorkbookFactory
.
create
(
is
);
// wb = XSSFWorkbookFactory.createWorkbook
(is);
if
(
wb
instanceof
XSSFWorkbook
)
{
//
if (wb instanceof XSSFWorkbook) {
return
false
;
//
return false;
}
else
if
(
wb
instanceof
HSSFWorkbook
)
{
//
} else if (wb instanceof HSSFWorkbook) {
return
true
;
//
return true;
}
//
}
}
catch
(
Exception
e
)
{
//
} catch (Exception e) {
return
false
;
//
return false;
}
finally
{
//
} finally {
try
{
//
try {
if
(
null
!=
is
)
{
//
if (null != is) {
is
.
close
();
//
is.close();
}
//
}
if
(
null
!=
wb
)
{
//
if (null != wb) {
wb
.
close
();
//
wb.close();
}
//
}
}
catch
(
IOException
e
)
{
//
} catch (IOException e) {
e
.
printStackTrace
();
//
e.printStackTrace();
}
//
}
}
//
}
return
true
;
//
return true;
}
//
}
/**
/**
*
*
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/pom.xml
View file @
a8e79b14
...
@@ -68,6 +68,12 @@
...
@@ -68,6 +68,12 @@
<groupId>
org.apache.poi
</groupId>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-scratchpad
</artifactId>
<artifactId>
poi-scratchpad
</artifactId>
<version>
3.15
</version>
<version>
3.15
</version>
<exclusions>
<exclusion>
<artifactId>
poi
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.apache.tika
</groupId>
<groupId>
org.apache.tika
</groupId>
...
@@ -78,6 +84,16 @@
...
@@ -78,6 +84,16 @@
<groupId>
org.apache.tika
</groupId>
<groupId>
org.apache.tika
</groupId>
<artifactId>
tika-parsers
</artifactId>
<artifactId>
tika-parsers
</artifactId>
<version>
1.13
</version>
<version>
1.13
</version>
<exclusions>
<exclusion>
<artifactId>
poi
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
<exclusion>
<artifactId>
poi-ooxml
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
...
@@ -96,6 +112,56 @@
...
@@ -96,6 +112,56 @@
<artifactId>
amos-boot-module-supervision-api
</artifactId>
<artifactId>
amos-boot-module-supervision-api
</artifactId>
<version>
1.0.0
</version>
<version>
1.0.0
</version>
<scope>
compile
</scope>
<scope>
compile
</scope>
<exclusions>
<exclusion>
<artifactId>
poi
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
<exclusion>
<artifactId>
poi-ooxml
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
<exclusion>
<artifactId>
poi-ooxml-schemas
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
com.deepoove
</groupId>
<artifactId>
poi-tl
</artifactId>
<version>
1.6.0
</version>
<scope>
compile
</scope>
<exclusions>
<exclusion>
<artifactId>
poi-ooxml
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
<exclusion>
<artifactId>
poi-ooxml-schemas
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
<exclusion>
<artifactId>
poi
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<version>
4.0.1
</version>
<exclusions>
<exclusion>
<artifactId>
poi
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
<version>
4.0.1
</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/controller/CheckReportController.java
View file @
a8e79b14
...
@@ -3,14 +3,11 @@ package com.yeejoin.amos.supervision.business.controller;
...
@@ -3,14 +3,11 @@ package com.yeejoin.amos.supervision.business.controller;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.supervision.business.feign.DangerFeignClient
;
import
com.yeejoin.amos.supervision.business.feign.DangerFeignClient
;
import
com.yeejoin.amos.supervision.business.service.intfc.ICheckReportService
;
import
com.yeejoin.amos.supervision.business.service.intfc.ICheckReportService
;
import
com.yeejoin.amos.supervision.core.common.dto.CheckReportParamDto
;
import
com.yeejoin.amos.supervision.core.common.dto.CheckReportParamDto
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
...
@@ -24,7 +21,9 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...
@@ -24,7 +21,9 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.Date
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.UnsupportedEncodingException
;
import
java.text.ParseException
;
@RestController
@RestController
@RequestMapping
(
value
=
"/check/report"
)
@RequestMapping
(
value
=
"/check/report"
)
...
@@ -48,7 +47,8 @@ public class CheckReportController extends BaseController {
...
@@ -48,7 +47,8 @@ public class CheckReportController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"分页查询检查报告"
,
notes
=
"分页查询检查报告"
)
@ApiOperation
(
value
=
"分页查询检查报告"
,
notes
=
"分页查询检查报告"
)
@PostMapping
(
value
=
"/page"
)
@PostMapping
(
value
=
"/page"
)
public
ResponseModel
queryPage
(
@RequestParam
(
value
=
"当前页"
)
int
current
,
@RequestParam
(
value
=
"分页大小"
)
int
size
,
@RequestBody
(
required
=
false
)
CheckReportParamDto
queryParam
)
{
public
ResponseModel
queryPage
(
@RequestParam
int
current
,
@RequestParam
int
size
,
@RequestBody
(
required
=
false
)
CheckReportParamDto
queryParam
)
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
loginOrgCode
=
getOrgCode
(
reginParams
);
String
loginOrgCode
=
getOrgCode
(
reginParams
);
if
(
loginOrgCode
.
contains
(
"-"
))
{
if
(
loginOrgCode
.
contains
(
"-"
))
{
...
@@ -70,4 +70,11 @@ public class CheckReportController extends BaseController {
...
@@ -70,4 +70,11 @@ public class CheckReportController extends BaseController {
public
ResponseModel
getDetailById
(
@PathVariable
(
value
=
"id"
)
String
id
)
{
public
ResponseModel
getDetailById
(
@PathVariable
(
value
=
"id"
)
String
id
)
{
return
ResponseHelper
.
buildResponse
(
iCheckReportService
.
getDetailById
(
id
));
return
ResponseHelper
.
buildResponse
(
iCheckReportService
.
getDetailById
(
id
));
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"获取检查报告文档"
,
notes
=
"获取检查报告文档"
)
@GetMapping
(
value
=
"/docx/{id}"
)
public
ResponseModel
getCheckReportDocx
(
HttpServletResponse
response
,
@PathVariable
(
name
=
"id"
)
String
reportId
)
throws
Exception
{
return
ResponseHelper
.
buildResponse
(
iCheckReportService
.
getCheckReportDocx
(
response
,
reportId
));
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/service/impl/CheckReportServiceImpl.java
View file @
a8e79b14
...
@@ -3,6 +3,14 @@ package com.yeejoin.amos.supervision.business.service.impl;
...
@@ -3,6 +3,14 @@ package com.yeejoin.amos.supervision.business.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.deepoove.poi.XWPFTemplate
;
import
com.deepoove.poi.config.Configure
;
import
com.deepoove.poi.config.ELMode
;
import
com.deepoove.poi.data.RowRenderData
;
import
com.deepoove.poi.data.style.Style
;
import
com.deepoove.poi.policy.DynamicTableRenderPolicy
;
import
com.deepoove.poi.policy.MiniTableRenderPolicy
;
import
com.deepoove.poi.util.TableTools
;
import
com.google.common.base.Joiner
;
import
com.google.common.base.Joiner
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
...
@@ -27,22 +35,40 @@ import com.yeejoin.amos.supervision.core.common.dto.DangerDto;
...
@@ -27,22 +35,40 @@ import com.yeejoin.amos.supervision.core.common.dto.DangerDto;
import
com.yeejoin.amos.supervision.dao.entity.CheckReport
;
import
com.yeejoin.amos.supervision.dao.entity.CheckReport
;
import
com.yeejoin.amos.supervision.dao.entity.Plan
;
import
com.yeejoin.amos.supervision.dao.entity.Plan
;
import
com.yeejoin.amos.supervision.dao.entity.PlanTask
;
import
com.yeejoin.amos.supervision.dao.entity.PlanTask
;
import
org.apache.poi.xwpf.usermodel.XWPFTable
;
import
org.apache.poi.xwpf.usermodel.XWPFTableRow
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.BufferedOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.function.BiConsumer
;
import
java.util.function.Consumer
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.IntStream
;
import
static
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
DateUtils
.
dateFormat
;
//import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
@Service
(
"checkReportService"
)
@Service
(
"checkReportService"
)
public
class
CheckReportServiceImpl
extends
BaseService
<
CheckReportDto
,
CheckReport
,
CheckReportMapper
>
implements
ICheckReportService
{
public
class
CheckReportServiceImpl
extends
BaseService
<
CheckReportDto
,
CheckReport
,
CheckReportMapper
>
implements
ICheckReportService
{
...
@@ -171,6 +197,16 @@ public class CheckReportServiceImpl extends BaseService<CheckReportDto, CheckRep
...
@@ -171,6 +197,16 @@ public class CheckReportServiceImpl extends BaseService<CheckReportDto, CheckRep
return
checkReportDto
;
return
checkReportDto
;
}
}
public
static
String
getWeekDate
(
Date
date
)
throws
ParseException
{
String
month
=
DateUtils
.
dateFormat
(
date
,
DateUtils
.
CHN_DATE_PATTERN_MONTH
);
String
weekDateStr
=
DateUtils
.
getWeekBeginDate
(
date
)
+
"-"
+
DateUtils
.
getWeekEndDate
(
date
);
return
month
+
weekDateStr
+
"日"
;
}
public
static
String
getMonthDate
(
Date
date
)
{
return
DateUtils
.
getMonth
(
date
)
+
"月份"
;
}
/**
/**
* 获取复查信息
* 获取复查信息
*
*
...
@@ -236,6 +272,84 @@ public class CheckReportServiceImpl extends BaseService<CheckReportDto, CheckRep
...
@@ -236,6 +272,84 @@ public class CheckReportServiceImpl extends BaseService<CheckReportDto, CheckRep
return
t1
;
return
t1
;
}
}
public
static
String
getQuarterDate
(
Date
date
)
{
int
month
=
DateUtils
.
getMonth
(
date
);
String
quarter
=
DateUtils
.
getQuarterStr
(
month
);
return
quarter
+
"季度"
;
}
public
static
<
T
>
Consumer
<
T
>
foreachWithIndex
(
BiConsumer
<
T
,
Integer
>
consumer
)
{
class
Obj
{
int
i
;
}
Obj
obj
=
new
Obj
();
return
t
->
{
int
index
=
obj
.
i
++;
consumer
.
accept
(
t
,
index
);
};
}
@Override
public
Object
getCheckReportDocx
(
HttpServletResponse
response
,
String
reportId
)
throws
ParseException
,
UnsupportedEncodingException
{
CheckReportDto
report
=
this
.
getDetailById
(
reportId
);
report
.
setReportDate
(
getCheckReportDateStr
(
report
));
report
.
setNowDate
(
DateUtils
.
dateFormat
(
new
Date
(),
DateUtils
.
CHN_DATE_PATTERN
));
if
(!
ValidationUtil
.
isEmpty
(
report
))
{
String
checkReportTemplatePath
=
this
.
getClass
().
getClassLoader
().
getResource
(
"templates/check-report-template"
+
".docx"
).
getFile
();
String
fileName
=
report
.
getName
()
+
".docx"
;
CheckDangerTablePolicy
checkDangerTablePolicy
=
new
CheckDangerTablePolicy
();
ReviewDangerTablePolicy
reviewDangerTablePolicy
=
new
ReviewDangerTablePolicy
();
Configure
.
ConfigureBuilder
configureBuilder
=
Configure
.
newBuilder
();
configureBuilder
.
setElMode
(
ELMode
.
SPEL_MODE
).
bind
(
"checkDangerList"
,
checkDangerTablePolicy
).
bind
(
"reviewDangerList"
,
reviewDangerTablePolicy
).
build
();
XWPFTemplate
template
=
XWPFTemplate
.
compile
(
checkReportTemplatePath
,
configureBuilder
.
build
()).
render
(
report
);
response
.
setContentType
(
"application/msword"
);
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
"utf-8"
));
OutputStream
out
=
null
;
BufferedOutputStream
bos
=
null
;
try
{
out
=
response
.
getOutputStream
();
bos
=
new
BufferedOutputStream
(
out
);
template
.
write
(
bos
);
bos
.
flush
();
out
.
flush
();
}
catch
(
IOException
e
)
{
log
.
error
(
"生成文档失败---------->"
);
e
.
printStackTrace
();
}
finally
{
try
{
bos
.
close
();
out
.
close
();
template
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
null
;
}
private
String
getCheckReportDateStr
(
CheckReportDto
checkReportDto
)
throws
ParseException
{
PlanFrequencyEnum
frequencyEnum
=
PlanFrequencyEnum
.
getEnumByCode
(
checkReportDto
.
getPlanCheckFrequencyType
());
String
reportDate
;
switch
(
frequencyEnum
)
{
case
WEEK:
reportDate
=
getWeekDate
(
checkReportDto
.
getStartPlanTaskDate
());
break
;
case
MONTH:
reportDate
=
getMonthDate
(
checkReportDto
.
getStartPlanTaskDate
());
break
;
case
QUARTER:
reportDate
=
getQuarterDate
(
checkReportDto
.
getStartPlanTaskDate
());
break
;
default
:
throw
new
IllegalStateException
(
"计划频次有误: "
+
frequencyEnum
);
}
return
reportDate
;
}
/**
/**
* 获取检查报告名称
* 获取检查报告名称
*
*
...
@@ -244,22 +358,114 @@ public class CheckReportServiceImpl extends BaseService<CheckReportDto, CheckRep
...
@@ -244,22 +358,114 @@ public class CheckReportServiceImpl extends BaseService<CheckReportDto, CheckRep
*/
*/
private
String
getReportName
(
Plan
plan
,
PlanTask
planTask
)
throws
ParseException
{
private
String
getReportName
(
Plan
plan
,
PlanTask
planTask
)
throws
ParseException
{
Date
planTaskBeginDate
=
DateUtils
.
dateParse
(
planTask
.
getBeginTime
(),
DateUtils
.
DATE_PATTERN
);
Date
planTaskBeginDate
=
DateUtils
.
dateParse
(
planTask
.
getBeginTime
(),
DateUtils
.
DATE_PATTERN
);
String
dateStr
=
DateUtils
.
dateFormat
(
planTaskBeginDate
,
DateUtils
.
CHN_DATE_PATTERN_YEAR
);
String
yearDateStr
=
dateFormat
(
planTaskBeginDate
,
DateUtils
.
CHN_DATE_PATTERN_YEAR
);
PlanFrequencyEnum
frequencyEnum
=
Objects
.
requireNonNull
(
PlanFrequencyEnum
.
getEnumByCode
(
plan
.
getPlanType
()));
PlanFrequencyEnum
frequencyEnum
=
Objects
.
requireNonNull
(
PlanFrequencyEnum
.
getEnumByCode
(
plan
.
getPlanType
()));
switch
(
frequencyEnum
)
{
switch
(
frequencyEnum
)
{
case
WEEK:
case
WEEK:
d
ateStr
=
yearD
ateStr
=
dateStr
+
DateUtils
.
getWeekDate
(
planTaskBeginDate
)
+
frequencyEnum
.
getExtraInfo
();
yearDateStr
+
getWeekDate
(
planTaskBeginDate
)
+
frequencyEnum
.
getExtraInfo
();
break
;
break
;
case
MONTH:
case
MONTH:
dateStr
=
d
ateStr
+
DateUtils
.
getMonth
(
planTaskBeginDate
)
+
frequencyEnum
.
getExtraInfo
();
yearDateStr
=
yearD
ateStr
+
DateUtils
.
getMonth
(
planTaskBeginDate
)
+
frequencyEnum
.
getExtraInfo
();
break
;
break
;
case
QUARTER:
case
QUARTER:
dateStr
=
d
ateStr
+
DateUtils
.
getQuarterStr
(
DateUtils
.
getMonth
(
planTaskBeginDate
))
+
frequencyEnum
.
getExtraInfo
();
yearDateStr
=
yearD
ateStr
+
DateUtils
.
getQuarterStr
(
DateUtils
.
getMonth
(
planTaskBeginDate
))
+
frequencyEnum
.
getExtraInfo
();
break
;
break
;
}
}
return
plan
.
getName
()
+
"--"
+
dateStr
;
return
plan
.
getName
()
+
"--"
+
yearDateStr
;
}
// 表格填充数据所在行数
static
int
dangerListDataStartRow
=
2
;
// 表头占两行
public
static
class
CheckDangerTablePolicy
extends
DynamicTableRenderPolicy
{
@Override
public
void
render
(
XWPFTable
table
,
Object
o
)
{
if
(
ValidationUtil
.
isEmpty
(
o
))
{
table
.
removeRow
(
dangerListDataStartRow
);
return
;
}
List
<
CheckReportDangerDto
>
reportDto
=
(
List
<
CheckReportDangerDto
>)
o
;
List
<
RowRenderData
>
checkDangerList
=
Lists
.
newArrayList
();
reportDto
.
forEach
(
foreachWithIndex
((
report
,
index
)
->
{
RowRenderData
rowRenderData
=
RowRenderData
.
build
(
String
.
valueOf
(
reportDto
.
size
()
-
index
),
report
.
getCompanyName
(),
report
.
getDangerName
(),
report
.
getDangerStateName
(),
report
.
getCompanyId
());
checkDangerList
.
add
(
rowRenderData
);
}));
generateTableData
(
table
,
checkDangerList
);
}
}
public
static
void
generateTableData
(
XWPFTable
table
,
List
<
RowRenderData
>
dangerList
)
{
if
(!
ValidationUtil
.
isEmpty
(
dangerList
))
{
// 表格渲染和列表数据下标相反,需要翻转一下列表
List
<
RowRenderData
>
reverseList
=
Lists
.
reverse
(
dangerList
);
table
.
removeRow
(
dangerListDataStartRow
);
int
lastRow
=
dangerListDataStartRow
;
String
sameCompanyId
=
dangerList
.
get
(
0
).
getCellDatas
().
get
(
4
).
getRenderData
().
getText
();
List
<
Map
<
String
,
Integer
>>
mergeRowMapList
=
Lists
.
newArrayList
();
// 循环插入行
int
listLength
=
dangerList
.
size
();
for
(
int
i
=
0
;
i
<
listLength
;
i
++)
{
String
companyId
=
dangerList
.
get
(
i
).
getCellDatas
().
get
(
4
).
getRenderData
().
getText
();
reverseList
.
get
(
i
).
getCellDatas
().
get
(
0
).
getRenderData
().
setText
(
String
.
valueOf
(
listLength
-
i
));
reverseList
.
get
(
i
).
getCellDatas
().
forEach
(
cellRenderData
->
{
Style
style
=
new
Style
();
style
.
setFontFamily
(
"仿宋"
);
style
.
setFontSize
(
12
);
cellRenderData
.
getRenderData
().
setStyle
(
style
);
});
XWPFTableRow
insertNewTableRow
=
table
.
insertNewTableRow
(
dangerListDataStartRow
);
IntStream
.
range
(
0
,
4
).
forEach
(
j
->
insertNewTableRow
.
createCell
());
if
(!
sameCompanyId
.
equals
(
companyId
))
{
sameCompanyId
=
dangerList
.
get
(
i
).
getCellDatas
().
get
(
4
).
getRenderData
().
getText
();
Map
<
String
,
Integer
>
mergeRowMap
=
Maps
.
newHashMap
();
mergeRowMap
.
put
(
"fromRow"
,
lastRow
);
mergeRowMap
.
put
(
"toRow"
,
i
+
dangerListDataStartRow
-
1
);
mergeRowMapList
.
add
(
mergeRowMap
);
lastRow
=
i
+
dangerListDataStartRow
;
}
// 到最后一行如果companyId都相等就合并到最后一行
if
(
i
==
listLength
-
1
)
{
Map
<
String
,
Integer
>
mergeRowMap
=
Maps
.
newHashMap
();
mergeRowMap
.
put
(
"fromRow"
,
lastRow
);
mergeRowMap
.
put
(
"toRow"
,
i
+
dangerListDataStartRow
);
mergeRowMapList
.
add
(
mergeRowMap
);
}
// 渲染检查隐患数据
MiniTableRenderPolicy
.
Helper
.
renderRow
(
table
,
dangerListDataStartRow
,
reverseList
.
get
(
i
));
}
mergeRowMapList
.
forEach
(
m
->
{
TableTools
.
mergeCellsVertically
(
table
,
1
,
m
.
get
(
"fromRow"
),
m
.
get
(
"toRow"
));
});
}
}
public
static
class
ReviewDangerTablePolicy
extends
DynamicTableRenderPolicy
{
// 表格填充数据所在行数
int
dangerListDataStartRow
=
2
;
@Override
public
void
render
(
XWPFTable
table
,
Object
o
)
{
if
(
ValidationUtil
.
isEmpty
(
o
))
{
table
.
removeRow
(
dangerListDataStartRow
);
return
;
}
List
<
CheckReportDangerDto
>
reportDto
=
(
List
<
CheckReportDangerDto
>)
o
;
List
<
RowRenderData
>
reviewDangerList
=
Lists
.
newArrayList
();
reportDto
.
forEach
(
foreachWithIndex
((
report
,
index
)
->
{
RowRenderData
rowRenderData
=
RowRenderData
.
build
(
String
.
valueOf
(
reportDto
.
size
()
-
index
),
report
.
getCompanyName
(),
report
.
getDangerName
(),
report
.
getDangerStateName
(),
report
.
getRemark
(),
report
.
getCompanyId
());
reviewDangerList
.
add
(
rowRenderData
);
}));
generateTableData
(
table
,
reviewDangerList
);
}
}
}
/**
/**
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/service/intfc/ICheckReportService.java
View file @
a8e79b14
...
@@ -7,6 +7,9 @@ import com.yeejoin.amos.supervision.core.common.dto.CheckReportParamDto;
...
@@ -7,6 +7,9 @@ import com.yeejoin.amos.supervision.core.common.dto.CheckReportParamDto;
import
com.yeejoin.amos.supervision.core.common.request.CommonPageable
;
import
com.yeejoin.amos.supervision.core.common.request.CommonPageable
;
import
com.yeejoin.amos.supervision.dao.entity.PlanTask
;
import
com.yeejoin.amos.supervision.dao.entity.PlanTask
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.text.ParseException
;
import
java.text.ParseException
;
public
interface
ICheckReportService
{
public
interface
ICheckReportService
{
...
@@ -27,4 +30,13 @@ public interface ICheckReportService {
...
@@ -27,4 +30,13 @@ public interface ICheckReportService {
* @return
* @return
*/
*/
CheckReportDto
getDetailById
(
String
id
);
CheckReportDto
getDetailById
(
String
id
);
/**
* 生成指定报告的word文档
*
* @param response
* @param reportId
* @return
*/
Object
getCheckReportDocx
(
HttpServletResponse
response
,
String
reportId
)
throws
Exception
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/util/FileHelper.java
View file @
a8e79b14
...
@@ -5,6 +5,7 @@ import cn.afterturn.easypoi.excel.ExcelImportUtil;
...
@@ -5,6 +5,7 @@ import cn.afterturn.easypoi.excel.ExcelImportUtil;
import
cn.afterturn.easypoi.excel.entity.ExportParams
;
import
cn.afterturn.easypoi.excel.entity.ExportParams
;
import
cn.afterturn.easypoi.excel.entity.ImportParams
;
import
cn.afterturn.easypoi.excel.entity.ImportParams
;
import
cn.afterturn.easypoi.excel.entity.enmus.ExcelType
;
import
cn.afterturn.easypoi.excel.entity.enmus.ExcelType
;
import
com.alibaba.excel.metadata.Sheet
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.MultiFormatWriter
;
import
com.google.zxing.MultiFormatWriter
;
import
com.google.zxing.client.j2se.MatrixToImageWriter
;
import
com.google.zxing.client.j2se.MatrixToImageWriter
;
...
@@ -139,28 +140,28 @@ public class FileHelper {
...
@@ -139,28 +140,28 @@ public class FileHelper {
* @param file
* @param file
* @return
* @return
*/
*/
public
static
boolean
isPPT2003
(
File
file
)
{
//
public static boolean isPPT2003(File file) {
InputStream
is
=
null
;
//
InputStream is = null;
HSLFSlideShow
ppt
=
null
;
//
HSLFSlideShow ppt = null;
try
{
//
try {
is
=
new
FileInputStream
(
file
);
//
is = new FileInputStream(file);
ppt
=
new
HSLFSlideShow
(
is
);
//
ppt = new HSLFSlideShow(is);
}
catch
(
Exception
e
)
{
//
} catch (Exception e) {
return
false
;
//
return false;
}
finally
{
//
} finally {
try
{
//
try {
if
(
null
!=
is
)
{
//
if (null != is) {
is
.
close
();
//
is.close();
}
//
}
if
(
null
!=
ppt
)
{
//
if (null != ppt) {
ppt
.
close
();
//
ppt.close();
}
//
}
}
catch
(
IOException
e
)
{
//
} catch (IOException e) {
e
.
printStackTrace
();
//
e.printStackTrace();
}
//
}
}
//
}
return
true
;
//
return true;
}
//
}
/**
/**
*
*
...
@@ -1109,12 +1110,14 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
...
@@ -1109,12 +1110,14 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
//表头样式
//表头样式
HSSFCellStyle
style
=
wb
.
createCellStyle
();
HSSFCellStyle
style
=
wb
.
createCellStyle
();
style
.
setAlignment
(
HSSFCellStyle
.
ALIGN_CENTER
);
// 创建一个居中格式
style
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
// 创建一个居中格式
//字体样式
//字体样式
HSSFFont
fontStyle
=
wb
.
createFont
();
HSSFFont
fontStyle
=
wb
.
createFont
();
fontStyle
.
setFontName
(
"微软雅黑"
);
fontStyle
.
setFontName
(
"微软雅黑"
);
fontStyle
.
setFontHeightInPoints
((
short
)
12
);
fontStyle
.
setFontHeightInPoints
((
short
)
12
);
fontStyle
.
setBold
weight
(
HSSFFont
.
BOLDWEIGHT_BOLD
);
fontStyle
.
setBold
(
true
);
style
.
setFont
(
fontStyle
);
style
.
setFont
(
fontStyle
);
//新建sheet
//新建sheet
...
@@ -1225,8 +1228,7 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
...
@@ -1225,8 +1228,7 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
* @return DataValidation
* @return DataValidation
* @throws
* @throws
*/
*/
private
static
DataValidation
setDataValidation
(
Sheet
sheet
,
String
[]
textList
,
int
firstRow
,
int
endRow
,
int
firstCol
,
int
endCol
)
{
private
static
DataValidation
setDataValidation
(
HSSFSheet
sheet
,
String
[]
textList
,
int
firstRow
,
int
endRow
,
int
firstCol
,
int
endCol
)
{
DataValidationHelper
helper
=
sheet
.
getDataValidationHelper
();
DataValidationHelper
helper
=
sheet
.
getDataValidationHelper
();
//加载下拉列表内容
//加载下拉列表内容
DataValidationConstraint
constraint
=
helper
.
createExplicitListConstraint
(
textList
);
DataValidationConstraint
constraint
=
helper
.
createExplicitListConstraint
(
textList
);
...
...
amos-boot-module/pom.xml
View file @
a8e79b14
...
@@ -18,6 +18,12 @@
...
@@ -18,6 +18,12 @@
<groupId>
com.amosframework.boot
</groupId>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-biz-common
</artifactId>
<artifactId>
amos-boot-biz-common
</artifactId>
<version>
${amos-biz-boot.version}
</version>
<version>
${amos-biz-boot.version}
</version>
<exclusions>
<exclusion>
<artifactId>
poi-ooxml
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
</exclusions>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
amos-boot-system-supervision/pom.xml
View file @
a8e79b14
...
@@ -14,6 +14,24 @@
...
@@ -14,6 +14,24 @@
<groupId>
com.amosframework.boot
</groupId>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-module-supervision-biz
</artifactId>
<artifactId>
amos-boot-module-supervision-biz
</artifactId>
<version>
${amos-biz-boot.version}
</version>
<version>
${amos-biz-boot.version}
</version>
<exclusions>
<exclusion>
<artifactId>
easypoi-base
</artifactId>
<groupId>
cn.afterturn
</groupId>
</exclusion>
<exclusion>
<artifactId>
poi-ooxml
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
<exclusion>
<artifactId>
poi-ooxml-schemas
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
<exclusion>
<artifactId>
poi-scratchpad
</artifactId>
<groupId>
org.apache.poi
</groupId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
cn.jpush.api
</groupId>
<groupId>
cn.jpush.api
</groupId>
...
...
amos-boot-system-supervision/src/main/resources/db/mapper/CheckReportMapper.xml
View file @
a8e79b14
...
@@ -67,7 +67,8 @@
...
@@ -67,7 +67,8 @@
p.check_type_name planCheckType,
p.check_type_name planCheckType,
p.check_level planCheckLevel,
p.check_level planCheckLevel,
DATE_FORMAT(pt.begin_time, '%Y-%m-%d') startPlanTaskDate,
DATE_FORMAT(pt.begin_time, '%Y-%m-%d') startPlanTaskDate,
DATE_FORMAT(pt.end_time, '%Y-%m-%d') endPlanTaskDate
DATE_FORMAT(pt.end_time, '%Y-%m-%d') endPlanTaskDate,
p.plan_type planCheckFrequencyType
from p_check_report cr
from p_check_report cr
LEFT JOIN p_plan_task pt on pt.id = cr.plan_task_id
LEFT JOIN p_plan_task pt on pt.id = cr.plan_task_id
left join p_plan p on p.id = pt.plan_id
left join p_plan p on p.id = pt.plan_id
...
...
amos-boot-system-supervision/src/main/resources/templates/check-report-template.docx
0 → 100644
View file @
a8e79b14
File added
pom.xml
View file @
a8e79b14
...
@@ -79,6 +79,14 @@
...
@@ -79,6 +79,14 @@
<groupId>
org.ow2.asm
</groupId>
<groupId>
org.ow2.asm
</groupId>
<artifactId>
asm
</artifactId>
<artifactId>
asm
</artifactId>
</exclusion>
</exclusion>
<exclusion>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
</exclusion>
</exclusions>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
...
@@ -94,7 +102,7 @@
...
@@ -94,7 +102,7 @@
<dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-scratchpad
</artifactId>
<artifactId>
poi-scratchpad
</artifactId>
<version>
3.17
</version>
<version>
4.0.1
</version>
<exclusions>
<exclusions>
<exclusion>
<exclusion>
<artifactId>
poi
</artifactId>
<artifactId>
poi
</artifactId>
...
@@ -106,7 +114,7 @@
...
@@ -106,7 +114,7 @@
<dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<artifactId>
poi-ooxml
</artifactId>
<version>
3.17
</version>
<version>
4.0.1
</version>
<exclusions>
<exclusions>
<exclusion>
<exclusion>
<artifactId>
poi
</artifactId>
<artifactId>
poi
</artifactId>
...
@@ -127,7 +135,7 @@
...
@@ -127,7 +135,7 @@
<dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml-schemas
</artifactId>
<artifactId>
poi-ooxml-schemas
</artifactId>
<version>
3.17
</version>
<version>
4.0.1
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<groupId>
org.apache.poi
</groupId>
...
...
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