Commit a8e79b14 authored by tianbo's avatar tianbo

修改poi引用版本4.0.1

防火监督计划任务报告生成
parent 9f24cc09
...@@ -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>
......
...@@ -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
......
...@@ -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/pickupAndComtask/{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;
......
...@@ -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>
......
...@@ -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 remainderDangerCount; Integer remainingDangerCount;
@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;
} }
...@@ -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;
} // }
/** /**
* *
......
...@@ -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>
......
...@@ -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
......
...@@ -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("系统繁忙,请稍后再试");
}
}
} }
...@@ -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;
}
} }
...@@ -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);
} }
...@@ -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;
} // }
/** /**
* *
......
...@@ -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,7 +84,17 @@ ...@@ -78,7 +84,17 @@
<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>
</dependency> <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>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId> <artifactId>spring-boot-starter-mail</artifactId>
...@@ -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>
...@@ -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));
}
} }
...@@ -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;
} }
...@@ -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.setBoldweight(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);
......
...@@ -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>
......
...@@ -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>
......
...@@ -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
......
...@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment