Commit 438fe4ee authored by litengwei's avatar litengwei

Merge remote-tracking branch 'origin/develop_dl_plan6_temp' into develop_dl_plan6_temp

parents 9b5c0778 717a6d44
sonarqube-check-amos-boot-biz-temp:
image: maven:3.6.3-jdk-11
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
MAVEN_CLI_OPTS: "-s /root/.m2/settings.xml"
MAVEN_OPTS: "-Dmaven.repo.local=/root/.m2/repository"
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
- .m2/repository
script:
- mvn $MAVEN_CLI_OPTS verify sonar:sonar -Dsonar.projectKey=moa_amos-boot-biz_AYZ4D-RdsWVV_jQK869u $MAVEN_OPTS
allow_failure: true
only:
- main
\ No newline at end of file
...@@ -26,6 +26,7 @@ public class DateUtils { ...@@ -26,6 +26,7 @@ public class DateUtils {
public static final String YEAR_PATTERN = "yyyy"; public static final String YEAR_PATTERN = "yyyy";
public static final String MINUTE_ONLY_PATTERN = "mm"; public static final String MINUTE_ONLY_PATTERN = "mm";
public static final String HOUR_ONLY_PATTERN = "HH"; public static final String HOUR_ONLY_PATTERN = "HH";
public static final String MONTH_DAY_PATTERN = "MM-dd";
public static final String MONTH_DAY_HOUR_PATTERN = "MM-dd HH"; public static final String MONTH_DAY_HOUR_PATTERN = "MM-dd HH";
public static final String MONTH_DAY_HOUR_MINUTE_PATTERN = "MM-dd HH:mm"; public static final String MONTH_DAY_HOUR_MINUTE_PATTERN = "MM-dd HH:mm";
public static final String DATE_PATTERN_NUM = "yyyyMMdd"; public static final String DATE_PATTERN_NUM = "yyyyMMdd";
...@@ -911,6 +912,8 @@ public class DateUtils { ...@@ -911,6 +912,8 @@ public class DateUtils {
while (true) { while (true) {
if (MONTH_DAY_HOUR_PATTERN.equals(pattern)) { if (MONTH_DAY_HOUR_PATTERN.equals(pattern)) {
date = dateAddMinutes(date, 60); date = dateAddMinutes(date, 60);
} else if (DATE_PATTERN.equals(pattern) || MONTH_DAY_PATTERN.equals(pattern)) {
date = dateAddDays(date, 1);
} else { } else {
date = dateAddMinutes(date, 1); date = dateAddMinutes(date, 1);
} }
...@@ -1012,4 +1015,33 @@ public class DateUtils { ...@@ -1012,4 +1015,33 @@ public class DateUtils {
final LocalDateTime end = LocalDateTime.parse(sdf.format(endTime), DateTimeFormatter.ofPattern(pattern)); final LocalDateTime end = LocalDateTime.parse(sdf.format(endTime), DateTimeFormatter.ofPattern(pattern));
return Duration.between(start, end).toHours(); return Duration.between(start, end).toHours();
} }
/**
* 获取两个时间段之间的天数
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param pattern 时间格式
* @return 天数
*/
public static Long getDurationDays(String startTime, String endTime, String pattern) {
final LocalDateTime start = LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern(pattern));
final LocalDateTime end = LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern(pattern));
return Duration.between(start, end).toDays();
}
/**
* 获取两个时间段之间的天数
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param pattern 时间格式
* @return 天数
*/
public static Long getDurationDays(Date startTime, Date endTime, String pattern) {
final SimpleDateFormat sdf = new SimpleDateFormat(pattern);
final LocalDateTime start = LocalDateTime.parse(sdf.format(startTime), DateTimeFormatter.ofPattern(pattern));
final LocalDateTime end = LocalDateTime.parse(sdf.format(endTime), DateTimeFormatter.ofPattern(pattern));
return Duration.between(start, end).toDays();
}
} }
...@@ -54,14 +54,11 @@ public class WordConverterUtils { ...@@ -54,14 +54,11 @@ public class WordConverterUtils {
FileItem item = factory.createItem("textField", "text/plain", true, file.getName()); FileItem item = factory.createItem("textField", "text/plain", true, file.getName());
int bytesRead = 0; int bytesRead = 0;
byte[] buffer = new byte[8192]; byte[] buffer = new byte[8192];
try { try (FileInputStream fis = new FileInputStream(file);
FileInputStream fis = new FileInputStream(file); OutputStream os = item.getOutputStream();) {
OutputStream os = item.getOutputStream();
while ((bytesRead = fis.read(buffer, 0, 8192)) != -1) { while ((bytesRead = fis.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead); os.write(buffer, 0, bytesRead);
} }
os.close();
fis.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
package com.yeejoin.equipmanage.common.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
@Data
public class BuildingImportDto {
@ColumnWidth(40)
@ExcelProperty(value = "数据类型", index = 0)
private String dataType;
@ColumnWidth(25)
@ExcelProperty(value = "建筑类型", index = 1)
private String buildingType;
@ColumnWidth(25)
@ExcelProperty(value = "编号", index = 2)
private String code;
@ColumnWidth(25)
@ExcelProperty(value = "建筑类别", index = 3)
private String buildingCategory;
@ColumnWidth(25)
@ExcelProperty(value = "建筑地址", index = 4)
private String buildingAddress;
@ColumnWidth(25)
@ExcelProperty(value = "建筑名称", index = 5)
private String buildName;
@ColumnWidth(25)
@ExcelProperty(value = "所在建筑", index = 6)
private String inWhichBuild;
@ColumnWidth(25)
@ExcelProperty(value = "建造日期", index = 7)
private String buildDate;
@ColumnWidth(25)
@ExcelProperty(value = "保护对象", index = 8)
private String protectedObjects;
@ColumnWidth(25)
@ExcelProperty(value = "责任人", index = 9)
private String dutyUser;
@ColumnWidth(25)
@ExcelProperty(value = "投用日期", index = 10)
private String putDate;
@ColumnWidth(25)
@ExcelProperty(value = "维保单位", index = 11)
private String maintenanceCompany;
@ColumnWidth(25)
@ExcelProperty(value = "每班人数", index = 12)
private String personNumber;
@ColumnWidth(25)
@ExcelProperty(value = "安装位置描述", index = 13)
private String locationDescription;
@ColumnWidth(25)
@ExcelProperty(value = "火灾预案(有、无)", index = 14)
private String firePlan;
@ColumnWidth(25)
@ExcelProperty(value = "消防控制室操作人员持证数", index = 15)
private String licensesNumber;
}
...@@ -24,7 +24,7 @@ import java.util.Date; ...@@ -24,7 +24,7 @@ import java.util.Date;
@Accessors(chain = true) @Accessors(chain = true)
@TableName("wl_stock_detail") @TableName("wl_stock_detail")
@ApiModel(value = "StockDetail对象", description = "库存明细") @ApiModel(value = "StockDetail对象", description = "库存明细")
public class StockDetail extends BaseEntity implements Cloneable { public class StockDetail extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -90,14 +90,4 @@ public class StockDetail extends BaseEntity implements Cloneable { ...@@ -90,14 +90,4 @@ public class StockDetail extends BaseEntity implements Cloneable {
@ApiModelProperty(value = "位置信息") @ApiModelProperty(value = "位置信息")
private String area; private String area;
@Override
public StockDetail clone() {
try {
return (StockDetail) super.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return null;
}
} }
package com.yeejoin.equipmanage.common.enums;
/**
* 是否物联设备
*/
public enum IsIotEnum {
isIot("物联设备", 1),
notIot("非物联设备", 0);
private final String description;
private final int status;
IsIotEnum(String description, int status) {
this.description = description;
this.status = status;
}
public String getDescription() {
return description;
}
public int getStatus() {
return status;
}
}
...@@ -13,17 +13,18 @@ import java.util.Map; ...@@ -13,17 +13,18 @@ import java.util.Map;
public enum PressurePumpAnalysisEnum { public enum PressurePumpAnalysisEnum {
PRESSURE_PUMP_FAULT("1", "1", "稳压泵是否故障", "无", ""), PRESSURE_PUMP_FAULT("1", "1", "稳压泵是否故障", "无", ""),
PRESSURE_PUMP_INTERVAL("2", "2", "最近一次启停间隔", "0", "分钟"), PRESSURE_PUMP_INTERVAL("2", "2", "最近一次启停间隔", 0, "分钟"),
PRESSURE_PUMP_DURATION("3", "3", "最近一次启动时长", "0", "分钟"), PRESSURE_PUMP_DURATION("3", "3", "最近一次启动时长", 0, "分钟"),
PRESSURE_PUMP_HALF("4", "4", "半小时启动", "0", "次"), PRESSURE_PUMP_HALF("4", "4", "半小时启动", 0, "次"),
PRESSURE_PUMP_TWO("5", "5", "2小时启动", "0", "次"), // PRESSURE_PUMP_TWO("5", "5", "2小时启动", 0, "次"),
PRESSURE_PUMP_DAY_AVG("5", "5", "近3日平均启动", 0, "次"),
PRESSURE_PUMP_PIPE("6", "6", "管网压力", "正常", ""); PRESSURE_PUMP_PIPE("6", "6", "管网压力", "正常", "");
private final String key; private String key;
private final String code; private String code;
private final String name; private String name;
private final Object value; private Object value;
private final String unit; private String unit;
PressurePumpAnalysisEnum(String key, String code, String name, Object value, String unit) { PressurePumpAnalysisEnum(String key, String code, String name, Object value, String unit) {
this.key = key; this.key = key;
...@@ -37,22 +38,42 @@ public enum PressurePumpAnalysisEnum { ...@@ -37,22 +38,42 @@ public enum PressurePumpAnalysisEnum {
return key; return key;
} }
public void setKey(String key) {
this.key = key;
}
public String getCode() { public String getCode() {
return code; return code;
} }
public void setCode(String code) {
this.code = code;
}
public String getName() { public String getName() {
return name; return name;
} }
public void setName(String name) {
this.name = name;
}
public Object getValue() { public Object getValue() {
return value; return value;
} }
public void setValue(Object value) {
this.value = value;
}
public String getUnit() { public String getUnit() {
return unit; return unit;
} }
public void setUnit(String unit) {
this.unit = unit;
}
public static List<Map<String, Object>> getList(){ public static List<Map<String, Object>> getList(){
PressurePumpAnalysisEnum[] values = PressurePumpAnalysisEnum.values(); PressurePumpAnalysisEnum[] values = PressurePumpAnalysisEnum.values();
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
......
...@@ -13,17 +13,21 @@ public enum PressurePumpRelateEnum { ...@@ -13,17 +13,21 @@ public enum PressurePumpRelateEnum {
ONE_HOUR_MINUTE("60", "60分钟"), ONE_HOUR_MINUTE("60", "60分钟"),
IOT_INDEX_VALUE_TRUE("true", "物联指标值:true"), IOT_INDEX_VALUE_TRUE("true", "物联指标值:true"),
IOT_INDEX_VALUE_FALSE("false", "物联指标值:false"), IOT_INDEX_VALUE_FALSE("false", "物联指标值:false"),
ONE_TIME("1", "物联指标最近1条数据"),
HALF_HOUR("0.5", "半小时"), HALF_HOUR("0.5", "半小时"),
ONE_HOUR("1.0", "1小时"), ONE_HOUR("1.0", "1小时"),
TWO_HOUR("2.0", "2小时"), TWO_HOUR("2.0", "2小时"),
FOUR_HOUR("4.0", "4小时"), FOUR_HOUR("4.0", "4小时"),
DAY_AVG("-3", "今日累计启停次数,取前3天平均值"),
CRON_BEFORE_DAY("-1", "昨天定时任务"),
START_FIVE("5", "稳压泵启动5分钟"), START_FIVE("5", "稳压泵启动5分钟"),
PIPE_PRESSURE_DIFF("0.5", "管网压力差判定标准,> 0.05Mpa 异常, <= 0.05 正常"), PIPE_PRESSURE_DIFF("0.05", "管网压力差判定标准,> 0.05Mpa 异常, <= 0.05 正常"),
PRESSURE_PUMP_START_BEFORE_MINUTE("-5", "稳压泵启泵前分钟数"), PRESSURE_PUMP_START_BEFORE_MINUTE("-5", "稳压泵启泵前分钟数"),
PIPE_PRESSURE_NORMAL_STATUS("正常", "稳压泵管网压力正常状态"), PIPE_PRESSURE_NORMAL_STATUS("正常", "稳压泵管网压力正常状态"),
PIPE_PRESSURE_ABNORMAL_STATUS("异常", "稳压泵管网压力异常状态"), PIPE_PRESSURE_ABNORMAL_STATUS("异常", "稳压泵管网压力异常状态"),
START("1", "稳压泵启动"), START("1", "启动"),
STOP("0", "稳压泵停止"), STOP("0", "停止"),
RESET("2", "复位"),
CREATED_TIME("createdTime", "物联采集信号创建时间属性"), CREATED_TIME("createdTime", "物联采集信号创建时间属性"),
UN_CLEAN_TIME("false", "未消除"); UN_CLEAN_TIME("false", "未消除");
......
...@@ -23,12 +23,8 @@ import java.awt.image.BufferedImage; ...@@ -23,12 +23,8 @@ import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Base64;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.*;
import java.util.Set;
/** /**
* @author lisong * @author lisong
...@@ -76,6 +72,14 @@ public class ChartsUtils { ...@@ -76,6 +72,14 @@ public class ChartsUtils {
fis.close(); fis.close();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
} }
return fileBytes; return fileBytes;
} }
......
package com.yeejoin.equipmanage.common.utils; package com.yeejoin.equipmanage.common.utils;
import java.io.File; import org.apache.poi.hssf.usermodel.*;
import java.io.FileInputStream; import org.apache.poi.ss.usermodel.*;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
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.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.streaming.SXSSFCell; import org.apache.poi.xssf.streaming.SXSSFCell;
import org.apache.poi.xssf.streaming.SXSSFRow; import org.apache.poi.xssf.streaming.SXSSFRow;
...@@ -36,6 +9,12 @@ import org.apache.poi.xssf.streaming.SXSSFSheet; ...@@ -36,6 +9,12 @@ import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/** /**
* *
...@@ -105,22 +84,16 @@ public class ExcelUtil ...@@ -105,22 +84,16 @@ public class ExcelUtil
} }
return workbook; return workbook;
} }
public static void createXSSFExcel(String path, String fileName, List<String> headers, List<List<String>> dataList) { public static void createXSSFExcel(String path, String fileName, List<String> headers, List<List<String>> dataList) {
try { File file = new File(path + "\\" + fileName);
File file = new File(path); if (!file.isDirectory()) {
if (!file.isDirectory()) { file.mkdirs();
file.mkdirs(); }
} try (FileInputStream inputStream = new FileInputStream(file);
FileOutputStream out = new FileOutputStream(file);
file = new File(path + "\\" + fileName); XSSFWorkbook workbook = file.exists() ? new XSSFWorkbook(inputStream) : new XSSFWorkbook();
XSSFWorkbook workbook; SXSSFWorkbook sxssfWorkbook = new SXSSFWorkbook(workbook, 2000)) {
if (!file.exists()) {
workbook = new XSSFWorkbook();
} else {
workbook = new XSSFWorkbook(new FileInputStream(file));
}
SXSSFWorkbook sxssfWorkbook = new SXSSFWorkbook(workbook, 2000);
int sheetNum = sxssfWorkbook.getNumberOfSheets(); int sheetNum = sxssfWorkbook.getNumberOfSheets();
if (sheetNum == 0) { if (sheetNum == 0) {
sxssfWorkbook.createSheet(); sxssfWorkbook.createSheet();
...@@ -150,16 +123,13 @@ public class ExcelUtil ...@@ -150,16 +123,13 @@ public class ExcelUtil
} }
fillExcelContent(sheet, sheet.getLastRowNum(), dataList); fillExcelContent(sheet, sheet.getLastRowNum(), dataList);
} }
FileOutputStream out = new FileOutputStream(file);
sxssfWorkbook.write(out); sxssfWorkbook.write(out);
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static void fillExcelContent(SXSSFSheet sheet, int lastRowNum, List<List<String>> dataList) { public static void fillExcelContent(SXSSFSheet sheet, int lastRowNum, List<List<String>> dataList) {
for (int i = 0; i < dataList.size(); i++) { for (int i = 0; i < dataList.size(); i++) {
SXSSFRow row = sheet.createRow(lastRowNum + i + 1); SXSSFRow row = sheet.createRow(lastRowNum + i + 1);
...@@ -217,14 +187,14 @@ public class ExcelUtil ...@@ -217,14 +187,14 @@ public class ExcelUtil
public static void exportXlSXExcel( public static void exportXlSXExcel(
HttpServletResponse response, File file, String fileName) HttpServletResponse response, File file, String fileName)
{ {
try OutputStream output = null;
try (FileInputStream inputStream = new FileInputStream(file))
{ {
String name = new String(fileName.getBytes("UTF-8"), "ISO8859_1"); String name = new String(fileName.getBytes("UTF-8"), "ISO8859_1");
OutputStream output = response.getOutputStream(); output = response.getOutputStream();
response.setHeader("Content-disposition", response.setHeader("Content-disposition",
"attachment; filename=" + name); "attachment; filename=" + name);
response.setContentType("application/vnd.ms-excel;charset=utf-8"); response.setContentType("application/vnd.ms-excel;charset=utf-8");
FileInputStream inputStream = new FileInputStream(file);
int b = 0; int b = 0;
byte[] buffer = new byte[1024*10]; byte[] buffer = new byte[1024*10];
while (b != -1){ while (b != -1){
...@@ -232,14 +202,21 @@ public class ExcelUtil ...@@ -232,14 +202,21 @@ public class ExcelUtil
if (-1 != b) { if (-1 != b) {
output.write(buffer, 0, b); output.write(buffer, 0, b);
} }
} }
inputStream.close();
output.flush(); output.flush();
output.close(); output.close();
} }
catch (IOException e) catch (IOException e)
{ {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (output != null) {
output.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
} }
...@@ -517,11 +494,17 @@ public class ExcelUtil ...@@ -517,11 +494,17 @@ public class ExcelUtil
cell.setCellStyle(style2); cell.setCellStyle(style2);
} }
} }
return workbook;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return null; return null;
} finally {
try {
workbook.close();
} catch (IOException e) {
e.printStackTrace();
}
} }
return workbook;
} }
/** /**
......
...@@ -31,10 +31,19 @@ public class FileUtil { ...@@ -31,10 +31,19 @@ public class FileUtil {
if (!targetFile.exists()) { if (!targetFile.exists()) {
targetFile.mkdirs(); targetFile.mkdirs();
} }
FileOutputStream out = new FileOutputStream(filePath + fileName); FileOutputStream out = null;
out.write(file); try {
out.flush(); out = new FileOutputStream(filePath + fileName);
out.close(); out.write(file);
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (null != out) {
out.close();
}
}
} }
/** /**
......
...@@ -34,8 +34,9 @@ public class TikaUtils { ...@@ -34,8 +34,9 @@ public class TikaUtils {
public static String fileToTxt(File file) { public static String fileToTxt(File file) {
Parser parser = new AutoDetectParser(); Parser parser = new AutoDetectParser();
InputStream inputStream = null;
try { try {
InputStream inputStream = new FileInputStream(file); inputStream = new FileInputStream(file);
DefaultHandler handler = new BodyContentHandler(); DefaultHandler handler = new BodyContentHandler();
Metadata metadata = new Metadata(); Metadata metadata = new Metadata();
ParseContext parseContext = new ParseContext(); ParseContext parseContext = new ParseContext();
...@@ -49,6 +50,14 @@ public class TikaUtils { ...@@ -49,6 +50,14 @@ public class TikaUtils {
return handler.toString(); return handler.toString();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (null != inputStream) {
inputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return null; return null;
} }
...@@ -73,7 +82,7 @@ public class TikaUtils { ...@@ -73,7 +82,7 @@ public class TikaUtils {
} }
return null; return "";
} }
......
...@@ -202,6 +202,12 @@ public class WordTemplateUtils { ...@@ -202,6 +202,12 @@ public class WordTemplateUtils {
in.close(); in.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
} }
BASE64Encoder encoder = new BASE64Encoder(); BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(data); return encoder.encode(data);
......
package com.yeejoin.equipmanage.common.vo;
import lombok.Data;
/**
* @author Gao Jianqiang
* @title: PressurePumpCountVo
* <pre>
* @description: 稳压泵统计 Vo
* </pre>
* @date 2023/2/22 16:15
*/
@Data
public class PressurePumpCountVo {
private Integer value;
private String time;
private String iotCode;
}
...@@ -10,33 +10,14 @@ public class ImageText implements AbstractText { ...@@ -10,33 +10,14 @@ public class ImageText implements AbstractText {
public void createTxt(String inputFile, String outputFile) throws Exception { public void createTxt(String inputFile, String outputFile) throws Exception {
File file = new File(inputFile); File file = new File(inputFile);
String baseName = FilenameUtils.getBaseName(inputFile); String baseName = FilenameUtils.getBaseName(inputFile);
InputStream is = null; try (InputStream is = new FileInputStream(file);
OutputStream os = null; OutputStream os = new FileOutputStream(outputFile.substring(0, outputFile.length() - baseName.length() - 1) + ".txt")) {
try {
is = new FileInputStream(file);
os = new FileOutputStream(
outputFile.substring(0, outputFile.length() - baseName.length() - 1) + ".txt");
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
int result = -1; int result = -1;
while (-1 != (result = is.read(buffer))) { while (-1 != (result = is.read(buffer))) {
os.write(buffer, 0, result); os.write(buffer, 0, result);
} }
} finally {
try {
if (null != is) {
is.close();
}
if (null != os) {
os.close();
}
} catch (Exception exce) {
System.err.println(exce.getMessage());
}
} }
} }
} }
...@@ -18,6 +18,7 @@ import java.io.*; ...@@ -18,6 +18,7 @@ import java.io.*;
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.nio.charset.StandardCharsets;
import java.util.Iterator; import java.util.Iterator;
import java.util.TreeSet; import java.util.TreeSet;
...@@ -39,11 +40,8 @@ public class FileHelper { ...@@ -39,11 +40,8 @@ public class FileHelper {
* @return * @return
*/ */
public static boolean isExcel2003(File file) { public static boolean isExcel2003(File file) {
InputStream is = null; try (InputStream is = new FileInputStream(file);
Workbook wb = null; Workbook wb = WorkbookFactory.create(is);) {
try {
is = new FileInputStream(file);
wb = WorkbookFactory.create(is);
if (wb instanceof XSSFWorkbook) { if (wb instanceof XSSFWorkbook) {
return false; return false;
} else if (wb instanceof HSSFWorkbook) { } else if (wb instanceof HSSFWorkbook) {
...@@ -51,17 +49,6 @@ public class FileHelper { ...@@ -51,17 +49,6 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
if (null != wb) {
wb.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
...@@ -71,39 +58,19 @@ public class FileHelper { ...@@ -71,39 +58,19 @@ public class FileHelper {
* @return * @return
*/ */
public static boolean isWord2003(File file) { public static boolean isWord2003(File file) {
InputStream is = null; try (InputStream is = new FileInputStream(file);
try { HWPFDocument hwpfDocument = new HWPFDocument(is);) {
is = new FileInputStream(file);
new HWPFDocument(is);
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
public static boolean isWord2007(File file) { public static boolean isWord2007(File file) {
InputStream is = null; try (InputStream is = new FileInputStream(file);
try { XWPFDocument xwpfDocument = new XWPFDocument(is)) {
is = new FileInputStream(file);
new XWPFDocument(is).close();
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
...@@ -113,24 +80,10 @@ public class FileHelper { ...@@ -113,24 +80,10 @@ public class FileHelper {
* @return * @return
*/ */
public static boolean isPpt2003(File file) { public static boolean isPpt2003(File file) {
InputStream is = null; try (InputStream is = new FileInputStream(file);
HSLFSlideShow ppt = null; HSLFSlideShow ppt = new HSLFSlideShow(is)) {
try {
is = new FileInputStream(file);
ppt = new HSLFSlideShow(is);
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
if (null != ppt) {
ppt.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
...@@ -141,13 +94,10 @@ public class FileHelper { ...@@ -141,13 +94,10 @@ public class FileHelper {
*/ */
public static StringBuffer readFile(String path) { public static StringBuffer readFile(String path) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
InputStream is = null; File file = new File(path);
BufferedReader br = null; try (InputStream is = new FileInputStream(file);
try { BufferedReader br = new BufferedReader(new InputStreamReader(is))) {
File file = new File(path);
if (file.exists()) { if (file.exists()) {
is = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(is));
String content = br.readLine(); String content = br.readLine();
while (null != content) { while (null != content) {
buffer.append(content); buffer.append(content);
...@@ -156,19 +106,7 @@ public class FileHelper { ...@@ -156,19 +106,7 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
if (null != br) {
br.close();
}
} catch (Exception e) {
e.printStackTrace();
}
} }
return buffer; return buffer;
} }
...@@ -181,13 +119,10 @@ public class FileHelper { ...@@ -181,13 +119,10 @@ public class FileHelper {
*/ */
public static StringBuffer readFile(String path, String split) { public static StringBuffer readFile(String path, String split) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
InputStream is = null; File file = new File(path);
BufferedReader br = null; try (InputStream is = new FileInputStream(file);
try { BufferedReader br = new BufferedReader(new InputStreamReader(is));) {
File file = new File(path);
if (file.exists()) { if (file.exists()) {
is = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(is));
String content = br.readLine(); String content = br.readLine();
while (null != content) { while (null != content) {
buffer.append(content).append(split); buffer.append(content).append(split);
...@@ -196,19 +131,7 @@ public class FileHelper { ...@@ -196,19 +131,7 @@ public class FileHelper {
} }
} catch (Exception exception) { } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
if (null != br) {
br.close();
}
} catch (Exception exception2) {
exception2.printStackTrace();
}
} }
return buffer; return buffer;
} }
...@@ -219,28 +142,15 @@ public class FileHelper { ...@@ -219,28 +142,15 @@ public class FileHelper {
* @param path 写入内容的文件路径 * @param path 写入内容的文件路径
*/ */
public static void writeFile(String content, String path) { public static void writeFile(String content, String path) {
OutputStream fos = null; File file = new File(path);
BufferedWriter bw = null; try (OutputStream fos = new FileOutputStream(file);
try { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos, StandardCharsets.UTF_8));) {
File file = new File(path);
if (!file.getParentFile().exists()) { if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
} }
fos = new FileOutputStream(file);
bw = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"));
bw.write(content); bw.write(content);
} catch (FileNotFoundException fnfe) { } catch (IOException fnfe) {
fnfe.printStackTrace(); fnfe.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
if (bw != null) {
bw.close();
}
} catch (IOException ioException) {
System.err.println(ioException.getMessage());
}
} }
} }
...@@ -330,11 +240,8 @@ public class FileHelper { ...@@ -330,11 +240,8 @@ public class FileHelper {
public static void rmrBlankLines(String inputFile, String outPutFile) throws IOException { public static void rmrBlankLines(String inputFile, String outPutFile) throws IOException {
File htmFile = new File(inputFile); File htmFile = new File(inputFile);
// 以GB2312读取文件 // 以GB2312读取文件
BufferedReader br = null; try (BufferedReader br = new BufferedReader(new FileReader(htmFile));
BufferedWriter bw = null; BufferedWriter bw = new BufferedWriter(new FileWriter(new File(outPutFile)));) {
try {
br = new BufferedReader(new FileReader(htmFile));
bw = new BufferedWriter(new FileWriter(new File(outPutFile)));
String result = null; String result = null;
while (null != (result = br.readLine())) { while (null != (result = br.readLine())) {
if (!"".equals(result.trim())) { if (!"".equals(result.trim())) {
...@@ -343,20 +250,7 @@ public class FileHelper { ...@@ -343,20 +250,7 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (null != br) {
br.close();
}
if (null != bw) {
bw.close();
}
} catch (Exception e) {
}
} }
} }
/** /**
......
...@@ -34,18 +34,12 @@ public class TikaUtils { ...@@ -34,18 +34,12 @@ public class TikaUtils {
public static String fileToTxt(File file) { public static String fileToTxt(File file) {
Parser parser = new AutoDetectParser(); Parser parser = new AutoDetectParser();
try { try (InputStream inputStream = new FileInputStream(file);) {
InputStream inputStream = new FileInputStream(file);
DefaultHandler handler = new BodyContentHandler(); DefaultHandler handler = new BodyContentHandler();
Metadata metadata = new Metadata(); Metadata metadata = new Metadata();
ParseContext parseContext = new ParseContext(); ParseContext parseContext = new ParseContext();
parseContext.set(Parser.class, parser); parseContext.set(Parser.class, parser);
parser.parse(inputStream, handler, metadata, parseContext); parser.parse(inputStream, handler, metadata, parseContext);
/*
* for (String string : metadata.names()) {
* System.out.println(string+":"+metadata.get(string)); }
*/
inputStream.close();
return handler.toString(); return handler.toString();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -58,21 +52,13 @@ public class TikaUtils { ...@@ -58,21 +52,13 @@ public class TikaUtils {
ContentHandler handler = new ToHTMLContentHandler(); ContentHandler handler = new ToHTMLContentHandler();
AutoDetectParser parser = new AutoDetectParser(); AutoDetectParser parser = new AutoDetectParser();
Metadata metadata = new Metadata(); Metadata metadata = new Metadata();
InputStream stream = null; try (InputStream stream = new FileInputStream(new File(fileName));) {
try {
stream = new FileInputStream(new File(fileName));
parser.parse(stream, handler, metadata); parser.parse(stream, handler, metadata);
FileHelper.writeFile(handler.toString(), outPutFile + ".html"); FileHelper.writeFile(handler.toString(), outPutFile + ".html");
FileHelper.parse(outPutFile + ".html"); FileHelper.parse(outPutFile + ".html");
return null;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
} }
return null; return null;
} }
......
package com.yeejoin.precontrol.common.service.impl; package com.yeejoin.precontrol.common.service.impl;
import com.yeejoin.precontrol.common.service.PdfService; import com.yeejoin.precontrol.common.service.PdfService;
import com.yeejoin.precontrol.common.utils.ExtendedIOUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import sun.misc.BASE64Decoder; import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder; import sun.misc.BASE64Encoder;
...@@ -17,22 +16,16 @@ public class PdfServiceImpl implements PdfService { ...@@ -17,22 +16,16 @@ public class PdfServiceImpl implements PdfService {
@Override @Override
public void base64StringToPdf(String base64Content, String filePath) { public void base64StringToPdf(String base64Content, String filePath) {
BASE64Decoder decoder = new BASE64Decoder(); BASE64Decoder decoder = new BASE64Decoder();
BufferedInputStream bis = null; File file = new File(filePath);
FileOutputStream fos = null; try (ByteArrayInputStream byteInputStream = new ByteArrayInputStream(decoder.decodeBuffer(base64Content));
BufferedOutputStream bos = null; BufferedInputStream bis = new BufferedInputStream(byteInputStream);
FileOutputStream fos = new FileOutputStream(file);
try { BufferedOutputStream bos = new BufferedOutputStream(fos);
byte[] bytes = decoder.decodeBuffer(base64Content); ) {
ByteArrayInputStream byteInputStream = new ByteArrayInputStream(bytes);
bis = new BufferedInputStream(byteInputStream);
File file = new File(filePath);
File path = file.getParentFile(); File path = file.getParentFile();
if (!path.exists()) { if (!path.exists()) {
path.mkdirs(); path.mkdirs();
} }
fos = new FileOutputStream(file);
bos = new BufferedOutputStream(fos);
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
int length = bis.read(buffer); int length = bis.read(buffer);
while (length != -1) { while (length != -1) {
...@@ -42,26 +35,16 @@ public class PdfServiceImpl implements PdfService { ...@@ -42,26 +35,16 @@ public class PdfServiceImpl implements PdfService {
bos.flush(); bos.flush();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
ExtendedIOUtils.closeQuietly(bis);
ExtendedIOUtils.closeQuietly(fos);
ExtendedIOUtils.closeQuietly(bos);
} }
} }
@Override @Override
public String pdfToBase64(File file) { public String pdfToBase64(File file) {
BASE64Encoder encoder = new BASE64Encoder(); BASE64Encoder encoder = new BASE64Encoder();
FileInputStream fin = null; try (FileInputStream fin = new FileInputStream(file);
BufferedInputStream bin = null; BufferedInputStream bin = new BufferedInputStream(fin);
ByteArrayOutputStream baos = null; ByteArrayOutputStream baos = new ByteArrayOutputStream();
BufferedOutputStream bout = null; BufferedOutputStream bout = new BufferedOutputStream(baos);) {
try {
fin = new FileInputStream(file);
bin = new BufferedInputStream(fin);
baos = new ByteArrayOutputStream();
bout = new BufferedOutputStream(baos);
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
int len = bin.read(buffer); int len = bin.read(buffer);
while (len != -1) { while (len != -1) {
...@@ -72,18 +55,8 @@ public class PdfServiceImpl implements PdfService { ...@@ -72,18 +55,8 @@ public class PdfServiceImpl implements PdfService {
bout.flush(); bout.flush();
byte[] bytes = baos.toByteArray(); byte[] bytes = baos.toByteArray();
return encoder.encodeBuffer(bytes).trim(); return encoder.encodeBuffer(bytes).trim();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
fin.close();
bin.close();
bout.close();
} catch (IOException e) {
e.printStackTrace();
}
} }
return null; return null;
} }
......
...@@ -20,6 +20,7 @@ import java.util.Optional; ...@@ -20,6 +20,7 @@ import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -837,9 +838,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl ...@@ -837,9 +838,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
public static List<String> getContent(String filePath) { public static List<String> getContent(String filePath) {
// 读取文件 // 读取文件
List<String> lineLists = null; List<String> lineLists = null;
try { try (Stream<String> lines = Files.lines(Paths.get(filePath), Charset.defaultCharset());) {
lineLists = Files.lines(Paths.get(filePath), Charset.defaultCharset()) lineLists = lines.flatMap(line -> Arrays.stream(line.split("\n"))).collect(Collectors.toList());
.flatMap(line -> Arrays.stream(line.split("\n"))).collect(Collectors.toList());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -32,6 +32,7 @@ import java.net.URLEncoder; ...@@ -32,6 +32,7 @@ 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.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
...@@ -52,11 +53,8 @@ public class FileHelper { ...@@ -52,11 +53,8 @@ public class FileHelper {
* @return * @return
*/ */
public static boolean isExcel2003(File file) { public static boolean isExcel2003(File file) {
InputStream is = null; try (InputStream is = new FileInputStream(file);
Workbook wb = null; Workbook wb = WorkbookFactory.create(is);) {
try {
is = new FileInputStream(file);
wb = WorkbookFactory.create(is);
if (wb instanceof XSSFWorkbook) { if (wb instanceof XSSFWorkbook) {
return false; return false;
} else if (wb instanceof HSSFWorkbook) { } else if (wb instanceof HSSFWorkbook) {
...@@ -64,17 +62,6 @@ public class FileHelper { ...@@ -64,17 +62,6 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
if (null != wb) {
wb.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
...@@ -84,20 +71,10 @@ public class FileHelper { ...@@ -84,20 +71,10 @@ public class FileHelper {
* @return * @return
*/ */
public static boolean isWord2003(File file) { public static boolean isWord2003(File file) {
InputStream is = null; try (InputStream is = new FileInputStream(file);
try { HWPFDocument hwpfDocument = new HWPFDocument(is);) {
is = new FileInputStream(file);
new HWPFDocument(is);
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
...@@ -126,24 +103,10 @@ public class FileHelper { ...@@ -126,24 +103,10 @@ public class FileHelper {
* @return * @return
*/ */
public static boolean isPPT2003(File file) { public static boolean isPPT2003(File file) {
InputStream is = null; try (InputStream is = new FileInputStream(file);
HSLFSlideShow ppt = null; HSLFSlideShow ppt = new HSLFSlideShow(is);) {
try {
is = new FileInputStream(file);
ppt = new HSLFSlideShow(is);
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
if (null != ppt) {
ppt.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
...@@ -154,13 +117,10 @@ public class FileHelper { ...@@ -154,13 +117,10 @@ public class FileHelper {
*/ */
public static StringBuffer readLocalFile(String path) { public static StringBuffer readLocalFile(String path) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
InputStream is = null; File file = new File(path);
BufferedReader br = null; try (InputStream is = new FileInputStream(file);
try { BufferedReader br = new BufferedReader(new InputStreamReader(is)); ) {
File file = new File(path);
if (file.exists()) { if (file.exists()) {
is = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(is));
String content = br.readLine(); String content = br.readLine();
while (null != content) { while (null != content) {
buffer.append(content); buffer.append(content);
...@@ -169,17 +129,6 @@ public class FileHelper { ...@@ -169,17 +129,6 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
if (null != br) {
br.close();
}
} catch (Exception e) {
e.printStackTrace();
}
} }
return buffer; return buffer;
} }
...@@ -193,13 +142,10 @@ public class FileHelper { ...@@ -193,13 +142,10 @@ public class FileHelper {
*/ */
public static StringBuffer readFile(String path, String split) { public static StringBuffer readFile(String path, String split) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
InputStream is = null; File file = new File(path);
BufferedReader br = null; try (InputStream is = new FileInputStream(file);
try { BufferedReader br = new BufferedReader(new InputStreamReader(is));) {
File file = new File(path);
if (file.exists()) { if (file.exists()) {
is = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(is));
String content = br.readLine(); String content = br.readLine();
while (null != content) { while (null != content) {
buffer.append(content).append(split); buffer.append(content).append(split);
...@@ -208,17 +154,6 @@ public class FileHelper { ...@@ -208,17 +154,6 @@ public class FileHelper {
} }
} catch (Exception exception) { } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
if (null != br) {
br.close();
}
} catch (Exception exception2) {
exception2.printStackTrace();
}
} }
return buffer; return buffer;
} }
...@@ -230,28 +165,17 @@ public class FileHelper { ...@@ -230,28 +165,17 @@ public class FileHelper {
* @param path 写入内容的文件路径 * @param path 写入内容的文件路径
*/ */
public static void writeFile(String content, String path) { public static void writeFile(String content, String path) {
OutputStream fos = null; File file = new File(path);
BufferedWriter bw = null; try (OutputStream fos = new FileOutputStream(file);
try { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos, StandardCharsets.UTF_8)); ) {
File file = new File(path);
if (!file.getParentFile().exists()) { if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
} }
fos = new FileOutputStream(file);
bw = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"));
bw.write(content); bw.write(content);
} catch (FileNotFoundException fnfe) { } catch (FileNotFoundException fnfe) {
fnfe.printStackTrace(); fnfe.printStackTrace();
} catch (IOException ioe) { } catch (IOException ioe) {
ioe.printStackTrace(); ioe.printStackTrace();
} finally {
try {
if (bw != null) {
bw.close();
}
} catch (IOException ioException) {
System.err.println(ioException.getMessage());
}
} }
} }
...@@ -335,11 +259,8 @@ public class FileHelper { ...@@ -335,11 +259,8 @@ public class FileHelper {
public static void rmrBlankLines(String inputFile, String outPutFile) throws IOException { public static void rmrBlankLines(String inputFile, String outPutFile) throws IOException {
File htmFile = new File(inputFile); File htmFile = new File(inputFile);
// 以GB2312读取文件 // 以GB2312读取文件
BufferedReader br = null; try (BufferedReader br = new BufferedReader(new FileReader(htmFile));
BufferedWriter bw = null; BufferedWriter bw = new BufferedWriter(new FileWriter(new File(outPutFile)));) {
try {
br = new BufferedReader(new FileReader(htmFile));
bw = new BufferedWriter(new FileWriter(new File(outPutFile)));
String result = null; String result = null;
while (null != (result = br.readLine())) { while (null != (result = br.readLine())) {
if (!"".equals(result.trim())) { if (!"".equals(result.trim())) {
...@@ -348,16 +269,6 @@ public class FileHelper { ...@@ -348,16 +269,6 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (null != br) {
br.close();
}
if (null != bw) {
bw.close();
}
} catch (Exception e) {
}
} }
} }
...@@ -1095,13 +1006,10 @@ public class FileHelper { ...@@ -1095,13 +1006,10 @@ public class FileHelper {
*/ */
public static StringBuffer readFile(String path) { public static StringBuffer readFile(String path) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
InputStream is = null; File file = new File(path);
BufferedReader br = null; try (InputStream is = new FileInputStream(file);
try { BufferedReader br = new BufferedReader(new InputStreamReader(is));) {
File file = new File(path);
if (file.exists()) { if (file.exists()) {
is = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(is));
String content = br.readLine(); String content = br.readLine();
while (null != content) { while (null != content) {
buffer.append(content); buffer.append(content);
...@@ -1110,19 +1018,7 @@ public class FileHelper { ...@@ -1110,19 +1018,7 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
if (null != br) {
br.close();
}
} catch (Exception e) {
e.printStackTrace();
}
} }
return buffer; return buffer;
} }
} }
...@@ -26,14 +26,16 @@ public class FileUtil { ...@@ -26,14 +26,16 @@ public class FileUtil {
* @return * @return
*/ */
public static void uploadFile(byte[] file, String filePath, String fileName) throws Exception { public static void uploadFile(byte[] file, String filePath, String fileName) throws Exception {
File targetFile = new File(filePath); try (FileOutputStream out = new FileOutputStream(filePath + fileName);) {
if (!targetFile.exists()) { File targetFile = new File(filePath);
targetFile.mkdirs(); if (!targetFile.exists()) {
targetFile.mkdirs();
}
out.write(file);
out.flush();
} catch (IOException e) {
e.printStackTrace();
} }
FileOutputStream out = new FileOutputStream(filePath + fileName);
out.write(file);
out.flush();
out.close();
} }
/** /**
......
...@@ -25,29 +25,21 @@ public class HttpRequest { ...@@ -25,29 +25,21 @@ public class HttpRequest {
conn.setConnectTimeout(30 * 1000); conn.setConnectTimeout(30 * 1000);
//防止屏蔽程序抓取而返回403错误 //防止屏蔽程序抓取而返回403错误
conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)"); conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
//得到输入流
InputStream inputStream = conn.getInputStream();
//获取自己数组
byte[] getData = readInputStream(inputStream);
//文件保存位置 //文件保存位置
File saveDir = new File(savePath); File saveDir = new File(savePath);
if (!saveDir.exists()) { if (!saveDir.exists()) {
saveDir.mkdir(); saveDir.mkdir();
} }
File file = new File(saveDir + File.separator + fileName); File file = new File(saveDir + File.separator + fileName);
FileOutputStream fos = new FileOutputStream(file); try (FileOutputStream fos = new FileOutputStream(file);
fos.write(getData); //得到输入流
if (fos != null) { InputStream inputStream = conn.getInputStream();) {
fos.close(); //获取自己数组
} byte[] getData = readInputStream(inputStream);
if (inputStream != null) { fos.write(getData);
inputStream.close(); } catch (IOException e) {
e.printStackTrace();
} }
System.out.println("info:" + url + " download success");
return file; return file;
} }
......
...@@ -164,43 +164,42 @@ public class HttpUtils { ...@@ -164,43 +164,42 @@ public class HttpUtils {
NoSuchAlgorithmException, KeyStoreException, KeyManagementException { NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
Assert.hasText(url, "url invalid"); Assert.hasText(url, "url invalid");
String result; String result;
CloseableHttpClient httpClient; // 创建一个SSL信任所有证书的httpClient对象
if (url.startsWith(HTTPS)) { try ( CloseableHttpClient httpClient = url.startsWith(HTTPS) ? HttpUtils.createSslInsecureClient() : HttpClients.createDefault();) {
// 创建一个SSL信任所有证书的httpClient对象 CloseableHttpResponse response = null;
httpClient = HttpUtils.createSslInsecureClient(); HttpPost httpPost = getHttpPost(url);
} else { if (GlobalCache.header != null) {
httpClient = HttpClients.createDefault(); for (String key : GlobalCache.header.keySet()) {
} String value = GlobalCache.header.get(key);
CloseableHttpResponse response = null; httpPost.setHeader(key, value);
HttpPost httpPost = getHttpPost(url); }
if (GlobalCache.header != null) {
for (String key : GlobalCache.header.keySet()) {
String value = GlobalCache.header.get(key);
httpPost.setHeader(key, value);
} }
} //加入全局请求令牌权限
//加入全局请求令牌权限 httpPost.setHeader("Http-Authorization", GlobalCache.paramMap.get("token"));
httpPost.setHeader("Http-Authorization", GlobalCache.paramMap.get("token")); if (GlobalCache.header.get("Content-Type") != null) {
if (GlobalCache.header.get("Content-Type") != null) { String contentType = GlobalCache.header.get("Content-Type");
String contentType = GlobalCache.header.get("Content-Type"); if ("application/x-www-form-urlencoded".equals(contentType)) {
if ("application/x-www-form-urlencoded".equals(contentType)) { JSONObject jsonObject = JSONObject.parseObject(jsonParams);
JSONObject jsonObject = JSONObject.parseObject(jsonParams); List<NameValuePair> params = new ArrayList<>();
List<NameValuePair> params = new ArrayList<>(); //循环json key value 仅能解决正常对象 若Json对象中嵌套数组 则可能需要单独处理
//循环json key value 仅能解决正常对象 若Json对象中嵌套数组 则可能需要单独处理 if (jsonObject != null) {
if (jsonObject != null) { for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) { params.add(new BasicNameValuePair(entry.getKey(), entry.getValue().toString()));
params.add(new BasicNameValuePair(entry.getKey(), entry.getValue().toString())); }
httpPost.setEntity(new UrlEncodedFormEntity(params, DEFAULT_ENCODING));
} }
httpPost.setEntity(new UrlEncodedFormEntity(params, DEFAULT_ENCODING));
} }
} if ("application/json;charset=UTF-8".equals(contentType)) {
if ("application/json;charset=UTF-8".equals(contentType)) { httpPost.setEntity(new StringEntity(jsonParams, ContentType.create("application/json", DEFAULT_ENCODING)));
}
} else {
httpPost.setEntity(new StringEntity(jsonParams, ContentType.create("application/json", DEFAULT_ENCODING))); httpPost.setEntity(new StringEntity(jsonParams, ContentType.create("application/json", DEFAULT_ENCODING)));
} }
} else { return baseRequest(httpClient, httpPost);
httpPost.setEntity(new StringEntity(jsonParams, ContentType.create("application/json", DEFAULT_ENCODING))); } catch (IOException e) {
e.printStackTrace();
} }
return baseRequest(httpClient, httpPost); return new ResponeVo();
} }
/** /**
...@@ -239,44 +238,43 @@ public class HttpUtils { ...@@ -239,44 +238,43 @@ public class HttpUtils {
public static ResponeVo put(String url, String jsonParams) throws IOException, NoSuchAlgorithmException, public static ResponeVo put(String url, String jsonParams) throws IOException, NoSuchAlgorithmException,
KeyStoreException, KeyManagementException { KeyStoreException, KeyManagementException {
log.info("----->调用请求 url:" + url + " ---->json参数:" + jsonParams); log.info("----->调用请求 url:" + url + " ---->json参数:" + jsonParams);
CloseableHttpClient httpClient = null;
String content; String content;
if (url.startsWith(HTTPS)) { // 创建一个SSL信任所有证书的httpClient对象
// 创建一个SSL信任所有证书的httpClient对象 try ( CloseableHttpClient httpClient = url.startsWith(HTTPS) ? HttpUtils.createSslInsecureClient() : HttpClients.createDefault();) {
httpClient = HttpUtils.createSslInsecureClient(); CloseableHttpResponse response = null;
} else { HttpPut httpPut = new HttpPut(url);
httpClient = HttpClients.createDefault(); if (GlobalCache.header != null) {
} for (String key : GlobalCache.header.keySet()) {
CloseableHttpResponse response = null; String value = GlobalCache.header.get(key);
HttpPut httpPut = new HttpPut(url); httpPut.setHeader(key, value);
if (GlobalCache.header != null) { }
for (String key : GlobalCache.header.keySet()) {
String value = GlobalCache.header.get(key);
httpPut.setHeader(key, value);
} }
} //加入全局请求令牌权限
//加入全局请求令牌权限 httpPut.setHeader("Http-Authorization", GlobalCache.paramMap.get("token"));
httpPut.setHeader("Http-Authorization", GlobalCache.paramMap.get("token")); if (GlobalCache.header.get("Content-Type") != null) {
if (GlobalCache.header.get("Content-Type") != null) { String contentType = GlobalCache.header.get("Content-Type");
String contentType = GlobalCache.header.get("Content-Type"); if ("application/x-www-form-urlencoded".equals(contentType)) {
if ("application/x-www-form-urlencoded".equals(contentType)) { JSONObject jsonObject = JSONObject.parseObject(jsonParams);
JSONObject jsonObject = JSONObject.parseObject(jsonParams); List<NameValuePair> params = new ArrayList<>();
List<NameValuePair> params = new ArrayList<>(); //循环json key value 仅能解决正常对象 若Json对象中嵌套数组 则可能需要单独处理
//循环json key value 仅能解决正常对象 若Json对象中嵌套数组 则可能需要单独处理 if (jsonObject != null) {
if (jsonObject != null) { for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) { params.add(new BasicNameValuePair(entry.getKey(), entry.getValue().toString()));
params.add(new BasicNameValuePair(entry.getKey(), entry.getValue().toString())); }
httpPut.setEntity(new UrlEncodedFormEntity(params, DEFAULT_ENCODING));
} }
httpPut.setEntity(new UrlEncodedFormEntity(params, DEFAULT_ENCODING));
} }
if ("application/json;charset=UTF-8".equals(contentType)) {
httpPut.setEntity(new StringEntity(jsonParams, ContentType.create("application/json", DEFAULT_ENCODING)));
}
} else {
log.error("请求头为空");
} }
if ("application/json;charset=UTF-8".equals(contentType)) { return baseRequest(httpClient, httpPut);
httpPut.setEntity(new StringEntity(jsonParams, ContentType.create("application/json", DEFAULT_ENCODING))); } catch (IOException e) {
} e.printStackTrace();
} else {
log.error("请求头为空");
} }
return baseRequest(httpClient, httpPut); return new ResponeVo();
} }
/** /**
...@@ -434,16 +432,12 @@ public class HttpUtils { ...@@ -434,16 +432,12 @@ public class HttpUtils {
} }
public static void inputStreamToFile(InputStream ins, File file) { public static void inputStreamToFile(InputStream ins, File file) {
OutputStream os = null; try (OutputStream os = new FileOutputStream(file);) {
try {
os = new FileOutputStream(file);
int bytesRead = 0; int bytesRead = 0;
byte[] buffer = new byte[8192]; byte[] buffer = new byte[8192];
while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) { while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead); os.write(buffer, 0, bytesRead);
} }
os.close();
ins.close();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -33,18 +33,12 @@ public class TikaUtils { ...@@ -33,18 +33,12 @@ public class TikaUtils {
public static String fileToTxt(File file) { public static String fileToTxt(File file) {
Parser parser = new AutoDetectParser(); Parser parser = new AutoDetectParser();
try { try (InputStream inputStream = new FileInputStream(file);) {
InputStream inputStream = new FileInputStream(file);
DefaultHandler handler = new BodyContentHandler(); DefaultHandler handler = new BodyContentHandler();
Metadata metadata = new Metadata(); Metadata metadata = new Metadata();
ParseContext parseContext = new ParseContext(); ParseContext parseContext = new ParseContext();
parseContext.set(Parser.class, parser); parseContext.set(Parser.class, parser);
parser.parse(inputStream, handler, metadata, parseContext); parser.parse(inputStream, handler, metadata, parseContext);
/*
* for (String string : metadata.names()) {
* System.out.println(string+":"+metadata.get(string)); }
*/
inputStream.close();
return handler.toString(); return handler.toString();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -57,16 +51,12 @@ public class TikaUtils { ...@@ -57,16 +51,12 @@ public class TikaUtils {
ContentHandler handler = new ToHTMLContentHandler(); ContentHandler handler = new ToHTMLContentHandler();
AutoDetectParser parser = new AutoDetectParser(); AutoDetectParser parser = new AutoDetectParser();
Metadata metadata = new Metadata(); Metadata metadata = new Metadata();
InputStream stream = null; try (InputStream stream = new FileInputStream(new File(fileName))) {
try {
stream = new FileInputStream(new File(fileName));
parser.parse(stream, handler, metadata); parser.parse(stream, handler, metadata);
FileHelper.writeFile(handler.toString(), outPutFile + ".html"); FileHelper.writeFile(handler.toString(), outPutFile + ".html");
FileHelper.parse(outPutFile + ".html"); FileHelper.parse(outPutFile + ".html");
return null;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
} }
return null; return null;
} }
......
...@@ -71,6 +71,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -71,6 +71,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -1132,21 +1133,18 @@ public class CommandController extends BaseController { ...@@ -1132,21 +1133,18 @@ public class CommandController extends BaseController {
} }
File htmlFile = new File(htmlFileName); File htmlFile = new File(htmlFileName);
WordConverterUtils.wordToHtml(fileName, htmlFileName, imagePathStr, readUrl, remoteSecurityService, product, appKey, token); WordConverterUtils.wordToHtml(fileName, htmlFileName, imagePathStr, readUrl, remoteSecurityService, product, appKey, token);
FileInputStream fis = new FileInputStream(htmlFile); try (FileInputStream fis = new FileInputStream(htmlFile);
// response.setContentType("multipart/form-data"); ServletOutputStream out = response.getOutputStream();) {
// response.setCharacterEncoding("UTF-8"); int b = 0;
// response.setContentType("text/html"); byte[] buffer = new byte[1024];
ServletOutputStream out; while ((b = fis.read(buffer)) != -1) {
out = response.getOutputStream(); // 4.写到输出流(out)中
int b = 0; out.write(buffer, 0, b);
byte[] buffer = new byte[1024]; }
while ((b = fis.read(buffer)) != -1) { out.flush();
// 4.写到输出流(out)中 } catch (IOException e) {
out.write(buffer, 0, b); e.printStackTrace();
} }
fis.close();
out.flush();
out.close();
return ResponseHelper.buildResponse(""); return ResponseHelper.buildResponse("");
} else { } else {
return null; return null;
......
package com.yeejoin.equipmanage.controller; package com.yeejoin.equipmanage.controller;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.fastjson.JSON;
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.dto.OrgMenuDto; import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.equipmanage.common.dto.OrgUsrDto; import com.yeejoin.equipmanage.common.dto.OrgUsrDto;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.fegin.JcsFeign; import com.yeejoin.equipmanage.fegin.JcsFeign;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
...@@ -25,6 +33,8 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -25,6 +33,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...@@ -419,4 +429,14 @@ public class BuildingController extends AbstractBaseController { ...@@ -419,4 +429,14 @@ public class BuildingController extends AbstractBaseController {
return buildService.getBuildingTreeInMyOrgCodeList(reginParams.getPersonIdentity().getBizOrgCode()); return buildService.getBuildingTreeInMyOrgCodeList(reginParams.getPersonIdentity().getBizOrgCode());
} }
@PersonIdentify
@PostMapping(value = "/upload")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "建筑导入(实施导数据使用)", notes = "建筑导入")
public void upload(MultipartFile file) {
ReginParams reginParams = getSelectedOrgInfo();
buildService.importBuilding(file, reginParams);
}
} }
...@@ -48,7 +48,7 @@ public class ConfirmAlarmController extends AbstractBaseController { ...@@ -48,7 +48,7 @@ public class ConfirmAlarmController extends AbstractBaseController {
@GetMapping(value = "/getDetailsById") @GetMapping(value = "/getDetailsById")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据id,type查询确警页面相关数据") @ApiOperation(value = "根据id,type查询确警页面相关数据")
public Map<String, Object> getDetailsById(@RequestParam Long alamId, @RequestParam(required = false) Long equipId, @RequestParam(required = false) String type, @RequestParam String area) { public Map<String, Object> getDetailsById(@RequestParam String alamId, @RequestParam(required = false) String equipId, @RequestParam(required = false) String type, @RequestParam String area) {
return iConfirmAlarmService.getDetailsById(alamId, equipId, type, area); return iConfirmAlarmService.getDetailsById(alamId, equipId, type, area);
} }
......
...@@ -578,7 +578,7 @@ public class EmergencyController extends AbstractBaseController { ...@@ -578,7 +578,7 @@ public class EmergencyController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getPressurePumpStatusChart") @GetMapping(value = "/getPressurePumpStatusChart")
@ApiOperation(httpMethod = "GET", value = "四横八纵-稳压泵启停状态图", notes = "四横八纵-稳压泵启停状态图") @ApiOperation(httpMethod = "GET", value = "四横八纵-稳压泵启停状态图", notes = "四横八纵-稳压泵启停状态图")
public ResponseModel getPressurePumpStatusChart(@RequestParam String equipmentCode, @RequestParam String startTime, @RequestParam String endTime, public ResponseModel getPressurePumpStatusChart(@RequestParam String startTime, @RequestParam String endTime,
@RequestParam(required = false) String bizOrgCode) { @RequestParam(required = false) String bizOrgCode) {
if(StringUtils.isEmpty(bizOrgCode)) { if(StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
...@@ -590,15 +590,14 @@ public class EmergencyController extends AbstractBaseController { ...@@ -590,15 +590,14 @@ public class EmergencyController extends AbstractBaseController {
} }
} }
} }
return CommonResponseUtil.success(iEmergencyService.getPressurePumpStatusChart(startTime, endTime, bizOrgCode, getAppKey(), getProduct(), getToken())); return CommonResponseUtil.success(iEmergencyService.getPressurePumpStatusChart(startTime, endTime, bizOrgCode));
} }
@PersonIdentify @PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getPressurePumpDiagnosticAnalysis") @GetMapping(value = "/getPressurePumpDiagnosticAnalysis")
@ApiOperation(httpMethod = "GET", value = "四横八纵-稳压泵诊断分析", notes = "四横八纵-稳压泵诊断分析") @ApiOperation(httpMethod = "GET", value = "四横八纵-稳压泵诊断分析", notes = "四横八纵-稳压泵诊断分析")
public ResponseModel getPressurePumpDiagnosticAnalysis(@RequestParam String equipmentCode, @RequestParam(required = false) String nameKeys, public ResponseModel getPressurePumpDiagnosticAnalysis(@RequestParam(required = false) String bizOrgCode) {
@RequestParam(required = false) String fieldKey, @RequestParam(required = false) String bizOrgCode) {
if(StringUtils.isEmpty(bizOrgCode)) { if(StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity(); ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
...@@ -609,7 +608,44 @@ public class EmergencyController extends AbstractBaseController { ...@@ -609,7 +608,44 @@ public class EmergencyController extends AbstractBaseController {
} }
} }
} }
return CommonResponseUtil.success(iEmergencyService.getPressurePumpDiagnosticAnalysis(nameKeys, fieldKey, bizOrgCode, getAppKey(), getProduct(), getToken())); return CommonResponseUtil.success(iEmergencyService.getPressurePumpDiagnosticAnalysis(bizOrgCode));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getPressurePumpStartStatistics")
@ApiOperation(httpMethod = "GET", value = "四横八纵-稳压泵启动统计", notes = "四横八纵-稳压泵启动统计")
public ResponseModel getPressurePumpStartStatistics(@RequestParam String startTime, @RequestParam String endTime,
@RequestParam(required = false) String bizOrgCode) {
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(Collections.EMPTY_MAP);
}
}
}
return CommonResponseUtil.success(iEmergencyService.getPressurePumpStartStatistics(startTime, endTime, bizOrgCode));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getPressurePumpDay")
@ApiOperation(httpMethod = "GET", value = "手动-存储昨日稳压泵启动次数", notes = "手动-存储昨日稳压泵启动次数")
public ResponseModel getPressurePumpDay(@RequestParam(required = false) String bizOrgCode) {
if(StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(Collections.EMPTY_LIST);
}
}
}
return CommonResponseUtil.success(iEmergencyService.getPressurePumpDay(bizOrgCode));
} }
@PersonIdentify @PersonIdentify
......
...@@ -377,7 +377,7 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -377,7 +377,7 @@ public class EquipmentSpecificController extends AbstractBaseController {
@GetMapping(value = "/{buildingId}/list") @GetMapping(value = "/{buildingId}/list")
@ApiOperation(httpMethod = "GET", value = "查询指定建筑下的装备列表", notes = "查询指定建筑下的装备列表") @ApiOperation(httpMethod = "GET", value = "查询指定建筑下的装备列表", notes = "查询指定建筑下的装备列表")
public List<EquiplistSpecificBySystemVO> getListByWarehouseStructureId( @PathVariable Long buildingId){ public List<EquiplistSpecificBySystemVO> getListByWarehouseStructureId( @PathVariable Long buildingId){
return equipmentSpecificMapper.getListByWarehouseStructureId(buildingId); return equipmentSpecificMapper.getListByWarehouseStructureId(buildingId, null);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
......
...@@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Param;
public interface ConfirmAlarmMapper extends BaseMapper<EquipmentSpecificAlarm> { public interface ConfirmAlarmMapper extends BaseMapper<EquipmentSpecificAlarm> {
EquipmentSpecificAlarmLog getDetailsById(@Param("id") Long id, @Param("equipId")Long equipId); EquipmentSpecificAlarmLog getDetailsById(@Param("id") String id, @Param("equipId")String equipId);
int confirmAlam(EquipmentSpecificAlarmLog ent); int confirmAlam(EquipmentSpecificAlarmLog ent);
......
...@@ -228,7 +228,13 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> { ...@@ -228,7 +228,13 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
Equipment getEquipmentBySpecificId(@Param("specificId") Long specificId); Equipment getEquipmentBySpecificId(@Param("specificId") Long specificId);
List<EquiplistSpecificBySystemVO> getListByWarehouseStructureId(Long floorId); /**
*
* @param floorId 建筑id
* @param isIot 是否物联设备
* @return
*/
List<EquiplistSpecificBySystemVO> getListByWarehouseStructureId(Long floorId, Integer isIot);
List<Map<String,String>> getStationInfo(); List<Map<String,String>> getStationInfo();
......
...@@ -216,4 +216,11 @@ public interface FormInstanceMapper extends BaseMapper<FormInstance> { ...@@ -216,4 +216,11 @@ public interface FormInstanceMapper extends BaseMapper<FormInstance> {
int updateFormFieldValue(@Param("id") Long id, @Param("name") String name, @Param("value") String value); int updateFormFieldValue(@Param("id") Long id, @Param("name") String name, @Param("value") String value);
Long queryVideoCountByBizOrgCode(@Param("bizOrgCode") String bizOrgCode); Long queryVideoCountByBizOrgCode(@Param("bizOrgCode") String bizOrgCode);
/**
* 建筑导入-导入楼层或房间 根据编码查询父级建筑id
* @param code
* @return
*/
String selectParentBuildId(@Param("code") String code);
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.service; ...@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto; import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.feign.morphic.model.ResourceDTO; import com.yeejoin.amos.feign.morphic.model.ResourceDTO;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel; import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
...@@ -17,6 +18,7 @@ import com.yeejoin.equipmanage.common.entity.vo.PointTreeVo; ...@@ -17,6 +18,7 @@ import com.yeejoin.equipmanage.common.entity.vo.PointTreeVo;
import com.yeejoin.equipmanage.common.vo.BuildingTreeAndEquipVO; import com.yeejoin.equipmanage.common.vo.BuildingTreeAndEquipVO;
import com.yeejoin.equipmanage.common.vo.BuildingTreeVo; import com.yeejoin.equipmanage.common.vo.BuildingTreeVo;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
...@@ -351,4 +353,10 @@ public interface IBuilldService extends IService<Building> { ...@@ -351,4 +353,10 @@ public interface IBuilldService extends IService<Building> {
List<OrgMenuDto> companyTreeByUserAndType(); List<OrgMenuDto> companyTreeByUserAndType();
List<BuildingTreeVo> treeByName(String bizOrgCode, String name); List<BuildingTreeVo> treeByName(String bizOrgCode, String name);
/**
* 导入建筑信息
* @param file
*/
void importBuilding(MultipartFile file, ReginParams reginParams);
} }
...@@ -17,7 +17,7 @@ public interface IConfirmAlarmService extends IService<EquipmentSpecificAlarm> { ...@@ -17,7 +17,7 @@ public interface IConfirmAlarmService extends IService<EquipmentSpecificAlarm> {
/** /**
* 根据id查询确警页面相关数据 * 根据id查询确警页面相关数据
*/ */
Map<String ,Object> getDetailsById( Long alamId, Long equipId , String type, String area); Map<String ,Object> getDetailsById(String alamId, String equipId , String type, String area);
Map<String ,Integer> videoList(List<String> list); Map<String ,Integer> videoList(List<String> list);
......
package com.yeejoin.equipmanage.service; package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.vo.PressurePumpCountVo;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -54,9 +55,20 @@ public interface IEmergencyService { ...@@ -54,9 +55,20 @@ public interface IEmergencyService {
Map<String, Integer> getStockEquipStatistics(); Map<String, Integer> getStockEquipStatistics();
Map<String, Object> getPressurePumpStatusChart(String startTime, String endTime, String bizOrgCode, String appKey, String product, String token); Map<String, Object> getPressurePumpStatusChart(String startTime, String endTime, String bizOrgCode);
List<Map<String, Object>> getPressurePumpDiagnosticAnalysis(String nameKeys, String fieldKey, String bizOrgCode, String appKey, String product, String token); List<Map<String, Object>> getPressurePumpDiagnosticAnalysis(String bizOrgCode);
Page<Map<String, Object>> alarmList(Page<Map<String, Object>> page,String bizOrgCode, List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus, Integer handleStatus); Page<Map<String, Object>> alarmList(Page<Map<String, Object>> page,String bizOrgCode, List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus, Integer handleStatus);
Map<String, List<PressurePumpCountVo>> getPressurePumpDay(String bizOrgCode);
/**
* 稳压泵启动统计
* @param startTime
* @param endTime
* @param bizOrgCode
* @return
*/
Map<String, Object> getPressurePumpStartStatistics(String startTime, String endTime, String bizOrgCode);
} }
package com.yeejoin.equipmanage.service; package com.yeejoin.equipmanage.service;
import com.yeejoin.equipmanage.common.vo.IotDataVO; import com.yeejoin.equipmanage.common.vo.IotDataVO;
import com.yeejoin.equipmanage.common.vo.PressurePumpCountVo;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -17,18 +18,21 @@ public interface IPressurePumpService { ...@@ -17,18 +18,21 @@ public interface IPressurePumpService {
* redis缓存物联采集数据,内部读取JSON配置指定有效期 * redis缓存物联采集数据,内部读取JSON配置指定有效期
* *
* @param iotDatalist * @param iotDatalist
* @param topic * @param iotCode
* @param bizOrgCode
*/ */
void saveDataToRedis(List<IotDataVO> iotDatalist, String topic); void saveDataToRedis(List<IotDataVO> iotDatalist, String iotCode, String bizOrgCode);
/** /**
* 根据nameKey,模糊查询所有的redis缓存数据 * 根据nameKey,模糊查询所有的redis缓存数据
*
* @param infoCode * @param infoCode
* @param nameKey * @param nameKey
* @param iotCode * @param iotCode
* @param bizOrgCode
* @return * @return
*/ */
List<IotDataVO> getDataToRedis(String infoCode, String nameKey, String iotCode); List<IotDataVO> getDataToRedis(String infoCode, String nameKey, String iotCode, String bizOrgCode);
/** /**
* 获取指标配置JSON信息集合 * 获取指标配置JSON信息集合
...@@ -38,39 +42,41 @@ public interface IPressurePumpService { ...@@ -38,39 +42,41 @@ public interface IPressurePumpService {
/** /**
* 获取所有稳压泵最近一次启停间隔,min * 获取所有稳压泵最近一次启停间隔,min
* @param redisDataList *
* @param iotDataList * @param dataList
* @param dataListFilterTrue
* @param dataListFilterFalse
* @param nowStrLong * @param nowStrLong
* @param bizOrgCode
*/ */
long getAllPressurePumpStartStopInterval(List<IotDataVO> redisDataList, List<Map<String, String>> iotDataList, String nowStrLong, String bizOrgCode); long getAllPressurePumpStartStopInterval(List<IotDataVO> dataList, List<IotDataVO> dataListFilterTrue, List<IotDataVO> dataListFilterFalse, String nowStrLong);
/** /**
* 获取稳压泵一定时间内启动频率或次数 * 获取稳压泵一定时间内启动频率或次数
*
* @param hour * @param hour
* @param dataList
* @param dateNow * @param dateNow
*/ */
int getAllPressurePumpStartFrequency(double hour, Date dateNow); int getAllPressurePumpStartFrequency(double hour, List<IotDataVO> dataList, Date dateNow);
/** /**
* 获取稳压泵最近一次启停时长,min * 获取稳压泵最近一次启停时长,min
* @param redisDataList *
* @param iotDataList * @param dataList
* @param dataListFilterTrue
* @param dataListFilterFalse
* @param nowStrLong * @param nowStrLong
* @param bizOrgCode
*/ */
long getAllPressurePumpStartStopDuration(List<IotDataVO> redisDataList, List<Map<String, String>> iotDataList, String nowStrLong, String bizOrgCode); long getAllPressurePumpStartStopDuration(List<IotDataVO> dataList, List<IotDataVO> dataListFilterTrue, List<IotDataVO> dataListFilterFalse, String nowStrLong);
/** /**
* 获取稳压泵指定启泵前 minutes 分钟,管网压力差绝对值 * 获取稳压泵指定启泵前 minutes 分钟,管网压力差绝对值
* @param redisDataList * @param dataList
* @param redisDataPipeList * @param dataPipeList
* @param iotDataList
* @param iotDataPipeList
* @param nowStrLong
* @param minutes * @param minutes
* @return
*/ */
double getAllPressurePumpPipePressureDiff(List<IotDataVO> redisDataList, List<IotDataVO> redisDataPipeList, List<Map<String, String>> iotDataList, List<Map<String, String>> iotDataPipeList, String nowStrLong, String minutes); double getAllPressurePumpPipePressureDiff(List<IotDataVO> dataList, List<IotDataVO> dataPipeList, String minutes);
/** /**
* 根据指标,获取物联top数据,influxdb * 根据指标,获取物联top数据,influxdb
...@@ -84,13 +90,15 @@ public interface IPressurePumpService { ...@@ -84,13 +90,15 @@ public interface IPressurePumpService {
/** /**
* 根据时间范围,获取redis指定指标或指定指标设备的缓存数据 * 根据时间范围,获取redis指定指标或指定指标设备的缓存数据
*
* @param infoCode * @param infoCode
* @param nameKey * @param nameKey
* @param iotCode * @param iotCode
* @param startDate * @param startDate
* @param endDate * @param endDate
* @param bizOrgCode
*/ */
List<IotDataVO> getDataToRedisByDateBetween(String infoCode, String nameKey, String iotCode, Date startDate, Date endDate); List<IotDataVO> getDataToRedisByDateBetween(String infoCode, String nameKey, String iotCode, Date startDate, Date endDate, String bizOrgCode);
/** /**
* 根据时间范围获取iot物联数据集合 * 根据时间范围获取iot物联数据集合
...@@ -103,4 +111,64 @@ public interface IPressurePumpService { ...@@ -103,4 +111,64 @@ public interface IPressurePumpService {
*/ */
List<Map<String, String>> getIotCommonListData(String startTime, String endTime, String prefix, String suffix, String key, String fieldKey); List<Map<String, String>> getIotCommonListData(String startTime, String endTime, String prefix, String suffix, String key, String fieldKey);
/**
* 数据根据指定值过滤
* @param dataList
* @param value
*/
List<IotDataVO> getDataListFilter(List<IotDataVO> dataList, String value);
/**
* 获取稳压泵数据,redis没有,从iot取
*
* @param pumpInfoList
* @param infoCode
* @param equipmentCode
* @param top
* @param nameKey
* @param bizOrgCode
* @param iotCode
* @return
*/
Map<String, List<IotDataVO>> getDataList(List<Map<String, Object>> pumpInfoList, String infoCode, String equipmentCode, String top, String nameKey, String bizOrgCode, String iotCode);
/**
* map 转化为对象
* @param map
* @param aClass
* @return
*/
Object mapToObject(Map<String,String> map,Class<?> aClass, String indexKey) throws IllegalAccessException, InstantiationException;
/**
* 获取iot指标统计数据
*
* @param startTime
* @param endTime
* @param infoCode
* @param countRedisKey
* @param prefix
* @param suffix
* @param key
* @param fieldKey
* @param expire
* @param bizOrgCode
* @return
*/
List<PressurePumpCountVo> getIotCountData(String startTime, String endTime, String infoCode, String countRedisKey, String prefix, String suffix, String key, String fieldKey, long expire, String bizOrgCode);
/**
* 获取稳压泵时间范围统计数据
* @param pumpInfoList
* @param startTime
* @param endTime
* @param infoCode
* @param countRedisKey
* @param equipmentCode
* @param nameKey
* @param countExpire
* @param bizOrgCode
* @return
*/
Map<String, List<PressurePumpCountVo>> getDateRangeCountList(List<Map<String, Object>> pumpInfoList, String startTime, String endTime, String infoCode, String countRedisKey, String equipmentCode, String nameKey, long countExpire, String bizOrgCode);
} }
...@@ -21,4 +21,6 @@ public interface ISupervisionVideoService extends IService<SupervisionVideo> { ...@@ -21,4 +21,6 @@ public interface ISupervisionVideoService extends IService<SupervisionVideo> {
List<String> queryVideoAllId(String bizOrgCode); List<String> queryVideoAllId(String bizOrgCode);
Page<Map<String, Object>> queryPumpInfo(Page page, String bizOrgCode); Page<Map<String, Object>> queryPumpInfo(Page page, String bizOrgCode);
List<Map<String, Object>> selectPressureDetails(String bizOrgCode);
} }
package com.yeejoin.equipmanage.service.impl; package com.yeejoin.equipmanage.service.impl;
import com.alibaba.fastjson.JSONObject;
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.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto; import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto;
...@@ -14,16 +16,23 @@ import com.yeejoin.equipmanage.common.utils.DateUtils; ...@@ -14,16 +16,23 @@ import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.mapper.AnalysisReportLogMapper; import com.yeejoin.equipmanage.mapper.AnalysisReportLogMapper;
import com.yeejoin.equipmanage.mapper.AnalysisReportMonthMapper; import com.yeejoin.equipmanage.mapper.AnalysisReportMonthMapper;
import com.yeejoin.equipmanage.mapper.AnalysisReportSummaryMapper; import com.yeejoin.equipmanage.mapper.AnalysisReportSummaryMapper;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.IAnalysisReportLogService; import com.yeejoin.equipmanage.service.IAnalysisReportLogService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService; import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import com.yeejoin.equipmanage.service.IUploadFileService; import com.yeejoin.equipmanage.service.IUploadFileService;
import liquibase.pro.packaged.A; import liquibase.pro.packaged.A;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.text.ParseException; import java.text.ParseException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* 报告流水表 服务实现类 * 报告流水表 服务实现类
...@@ -48,6 +57,12 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM ...@@ -48,6 +57,12 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
@Autowired @Autowired
IUploadFileService iUploadFileService; IUploadFileService iUploadFileService;
@Autowired
FireFightingSystemMapper fireFightingSystemMapper;
@Value("classpath:/json/systemIndex.json")
private Resource systemIndex;
@Override @Override
public IPage<AnalysisReportLog> listPage(Page page, AnalysisReportLog analysisReportLog) { public IPage<AnalysisReportLog> listPage(Page page, AnalysisReportLog analysisReportLog) {
...@@ -74,15 +89,27 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM ...@@ -74,15 +89,27 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
this.saveAnalysisReportLog(reportEnum, beginDate, endDate); this.saveAnalysisReportLog(reportEnum, beginDate, endDate);
// 创建月分析统计报告数据 // 创建月分析统计报告数据
// 1、 查询消防系统表,捞出所有系统,新增字段,存放自定义用的告警指标模糊查询指标key,逗号分隔 // 1、 查询消防系统表,捞出所有系统,新增字段,存放自定义用的告警指标模糊查询指标key,逗号分隔
List<FireFightingSystemEntity> fightingSystemEntityList = fireFightingSystemService.getBaseMapper().selectList( List<Map<String, Object>> list = fireFightingSystemMapper.selectSystemByBizOrgCode(null);
new LambdaQueryWrapper<FireFightingSystemEntity>()
.isNotNull(FireFightingSystemEntity::getAnalysisIndexKey));
// 2、循环插入 wl_analysis_report_month、wl_analysis_report_summary // 2、循环插入 wl_analysis_report_month、wl_analysis_report_summary
String beginDateStr = DateUtils.dateFormat(beginDate,DateUtils.DATE_PATTERN); String beginDateStr = DateUtils.dateFormat(beginDate,DateUtils.DATE_PATTERN);
String endDateStr = DateUtils.dateFormat(endDate,DateUtils.DATE_PATTERN); String endDateStr = DateUtils.dateFormat(endDate,DateUtils.DATE_PATTERN);
fightingSystemEntityList.forEach(f -> { String json = null;
analysisReportMonthMapper.insertSystemMonthData(new ArrayList<>(Arrays.asList(f.getAnalysisIndexKey().split(","))), beginDateStr, endDateStr, f.getId()); try {
analysisReportSummaryMapper.insertSystemMonthSummaryData(new ArrayList<>(Arrays.asList(f.getAnalysisIndexKey().split(","))), beginDateStr, endDateStr, f.getId()); json = IOUtils.toString(systemIndex.getInputStream(), java.lang.String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
// 获取系统对应指标配置信息
List<Map> indicatorConfiguration = JSONObject.parseArray(json, Map.class);
list.forEach(f -> {
// 具体系统对应指标
List<Map> collect = indicatorConfiguration.stream().
filter(index -> index.get("code").equals(String.valueOf(f.get("typeCode")))).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(collect)) {
String indicator = String.valueOf(collect.get(0).get("index"));
analysisReportMonthMapper.insertSystemMonthData(new ArrayList<>(Arrays.asList(indicator.split(","))), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
analysisReportSummaryMapper.insertSystemMonthSummaryData(new ArrayList<>(Arrays.asList(indicator.split(","))), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
}
}); });
} }
...@@ -93,15 +120,27 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM ...@@ -93,15 +120,27 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
this.saveAnalysisReportLog(reportEnum, beginDate, endDate); this.saveAnalysisReportLog(reportEnum, beginDate, endDate);
// 创建月分析统计报告数据 // 创建月分析统计报告数据
// 1、 查询消防系统表,捞出所有系统,新增字段,存放自定义用的告警指标模糊查询指标key,逗号分隔 // 1、 查询消防系统表,捞出所有系统,新增字段,存放自定义用的告警指标模糊查询指标key,逗号分隔
List<FireFightingSystemEntity> fightingSystemEntityList = fireFightingSystemService.getBaseMapper().selectList( List<Map<String, Object>> list = fireFightingSystemMapper.selectSystemByBizOrgCode(null);
new LambdaQueryWrapper<FireFightingSystemEntity>()
.isNotNull(FireFightingSystemEntity::getAnalysisIndexKey));
// 2、循环插入 wl_analysis_report_month、wl_analysis_report_summary // 2、循环插入 wl_analysis_report_month、wl_analysis_report_summary
String beginDateStr = DateUtils.dateFormat(beginDate,DateUtils.DATE_PATTERN); String beginDateStr = DateUtils.dateFormat(beginDate,DateUtils.DATE_PATTERN);
String endDateStr = DateUtils.dateFormat(endDate,DateUtils.DATE_PATTERN); String endDateStr = DateUtils.dateFormat(endDate,DateUtils.DATE_PATTERN);
fightingSystemEntityList.forEach(f -> { String json = null;
analysisReportMonthMapper.insertSystemMonthDataTest(new ArrayList<>(Arrays.asList(f.getAnalysisIndexKey().split(","))), beginDateStr, endDateStr, f.getId(),now,num); try {
analysisReportSummaryMapper.insertSystemMonthSummaryDataTest(new ArrayList<>(Arrays.asList(f.getAnalysisIndexKey().split(","))), beginDateStr, endDateStr, f.getId(),now,num); json = IOUtils.toString(systemIndex.getInputStream(), java.lang.String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
// 获取系统对应指标配置信息
List<Map> indicatorConfiguration = JSONObject.parseArray(json, Map.class);
list.forEach(f -> {
// 具体系统对应指标
List<Map> collect = indicatorConfiguration.stream().
filter(index -> index.get("code").equals(String.valueOf(f.get("typeCode")))).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(collect)) {
String indicator = String.valueOf(collect.get(0).get("index"));
analysisReportMonthMapper.insertSystemMonthData(new ArrayList<>(Arrays.asList(indicator.split(","))), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
analysisReportSummaryMapper.insertSystemMonthSummaryData(new ArrayList<>(Arrays.asList(indicator.split(","))), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
}
}); });
} }
......
...@@ -8,6 +8,7 @@ import com.yeejoin.equipmanage.common.vo.SpeedAndTimeList; ...@@ -8,6 +8,7 @@ import com.yeejoin.equipmanage.common.vo.SpeedAndTimeList;
import com.yeejoin.equipmanage.service.ICarLonAndLatDataService; import com.yeejoin.equipmanage.service.ICarLonAndLatDataService;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
...@@ -28,30 +29,37 @@ public class CarLonAndLatDataServiceImpl implements ICarLonAndLatDataService { ...@@ -28,30 +29,37 @@ public class CarLonAndLatDataServiceImpl implements ICarLonAndLatDataService {
@Override @Override
public List<LonAndLatEntityVo> listCarLonAndLat() throws Exception { public List<LonAndLatEntityVo> listCarLonAndLat() throws Exception {
Resource resource = new ClassPathResource("car-history-track-data.xml"); Resource resource = new ClassPathResource("car-history-track-data.xml");
BufferedReader br = new BufferedReader(new InputStreamReader(resource.getInputStream())); try (InputStreamReader inputStreamReader = new InputStreamReader(resource.getInputStream());
StringBuffer buffer = new StringBuffer(); BufferedReader br = new BufferedReader(inputStreamReader);) {
String line = ""; StringBuffer buffer = new StringBuffer();
while((line = br.readLine())!=null) String line = "";
{ while((line = br.readLine())!=null)
buffer.append(line); {
buffer.append(line);
}
LonAndLatList list = (LonAndLatList) XmlBuilder.xmlStrToObject(LonAndLatList.class, buffer.toString());
return list.getDataList();
} catch (Exception e) {
e.printStackTrace();
} }
br.close(); return new ArrayList<>();
LonAndLatList list = (LonAndLatList) XmlBuilder.xmlStrToObject(LonAndLatList.class, buffer.toString());
return list.getDataList();
} }
@Override @Override
public List<SpeedAndTimeEntityVo> listCarSpeedAndGround() throws Exception { public List<SpeedAndTimeEntityVo> listCarSpeedAndGround() throws Exception {
Resource resource = new ClassPathResource("car-history-trend-data.xml"); Resource resource = new ClassPathResource("car-history-trend-data.xml");
BufferedReader br = new BufferedReader(new InputStreamReader(resource.getInputStream())); try (InputStreamReader inputStreamReader = new InputStreamReader(resource.getInputStream());
StringBuffer buffer = new StringBuffer(); BufferedReader br = new BufferedReader(inputStreamReader);) {
String line = ""; StringBuffer buffer = new StringBuffer();
while((line = br.readLine())!=null) String line = "";
{ while ((line = br.readLine()) != null) {
buffer.append(line); buffer.append(line);
}
SpeedAndTimeList list = (SpeedAndTimeList) XmlBuilder.xmlStrToObject(SpeedAndTimeList.class, buffer.toString());
return list.getDataList();
} catch (Exception e) {
e.printStackTrace();
} }
br.close(); return new ArrayList<>();
SpeedAndTimeList list = (SpeedAndTimeList) XmlBuilder.xmlStrToObject(SpeedAndTimeList.class, buffer.toString());
return list.getDataList();
} }
} }
...@@ -38,6 +38,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -38,6 +38,7 @@ import org.apache.commons.lang3.StringUtils;
import org.gavaghan.geodesy.Ellipsoid; import org.gavaghan.geodesy.Ellipsoid;
import org.gavaghan.geodesy.GeodeticCalculator; import org.gavaghan.geodesy.GeodeticCalculator;
import org.gavaghan.geodesy.GlobalCoordinates; import org.gavaghan.geodesy.GlobalCoordinates;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
...@@ -486,12 +487,13 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS ...@@ -486,12 +487,13 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
stockDetailMapper.updateById(stockDetail); stockDetailMapper.updateById(stockDetail);
addStockDetailId(stockDetail.getId()); addStockDetailId(stockDetail.getId());
StockDetail stockDetail_clone = stockDetail.clone(); StockDetail stockDetailClone = new StockDetail();
stockDetail_clone.setId(null); BeanUtils.copyProperties(stockDetail, stockDetailClone);
stockDetail_clone.setAmount(lossCount); stockDetailClone.setId(null);
stockDetail_clone.setStatus(EquipStatusEnum.LOSS.getCode().toString()); stockDetailClone.setAmount(lossCount);
stockDetailMapper.insert(stockDetail_clone); stockDetailClone.setStatus(EquipStatusEnum.LOSS.getCode().toString());
addStockDetailId(stockDetail_clone.getId()); stockDetailMapper.insert(stockDetailClone);
addStockDetailId(stockDetailClone.getId());
Stock stock = stockMapper.selectById(stockDetail.getStockId()); Stock stock = stockMapper.selectById(stockDetail.getStockId());
stock.setAmount(stock.getAmount() - lossCount); stock.setAmount(stock.getAmount() - lossCount);
stockMapper.updateById(stock); stockMapper.updateById(stock);
...@@ -501,10 +503,10 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS ...@@ -501,10 +503,10 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
// 损耗清单详情 // 损耗清单详情
WastageBillDetail detail = new WastageBillDetail(); WastageBillDetail detail = new WastageBillDetail();
detail.setAmount(BigDecimal.valueOf(lossCount)); detail.setAmount(BigDecimal.valueOf(lossCount));
detail.setStockDetailId(stockDetail_clone.getId()); detail.setStockDetailId(stockDetailClone.getId());
detail.setWastageBillId(bill.getId()); detail.setWastageBillId(bill.getId());
wastageBillDetailMapper.insert(detail); wastageBillDetailMapper.insert(detail);
journalMapper.insert(createJournal(ex, stockDetail_clone.getId(), lossCount)); journalMapper.insert(createJournal(ex, stockDetailClone.getId(), lossCount));
return 0d; return 0d;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -604,7 +606,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS ...@@ -604,7 +606,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
List<SystemDic> listd = systemDicMapper.selectByMap(columnMap); List<SystemDic> listd = systemDicMapper.selectByMap(columnMap);
p.setLossStateId(listd.get(0).getId()); p.setLossStateId(listd.get(0).getId());
}); });
lossHandlers.add(p -> this.loss(p)); lossHandlers.add(this::loss);
// 同步搜索 // 同步搜索
/* /*
...@@ -624,21 +626,21 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS ...@@ -624,21 +626,21 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
stockDetailMapper.updateById(detail); stockDetailMapper.updateById(detail);
params.addStockDetailId(r.getStockDetailId()); params.addStockDetailId(r.getStockDetailId());
StockDetail detail_onCar = null; StockDetail detailOnCar = new StockDetail();
BeanUtils.copyProperties(detail, detailOnCar);
// 新增车载记录 // 新增车载记录
detail_onCar = detail.clone(); // detail_onCar = detail.clone();
detail_onCar.setId(null); detailOnCar.setId(null);
detail_onCar.setAmount(r.getAmount()); detailOnCar.setAmount(r.getAmount());
detail_onCar.setStatus(EquipStatusEnum.ONCAR.getCode().toString()); detailOnCar.setStatus(EquipStatusEnum.ONCAR.getCode().toString());
stockDetailMapper.insert(detail_onCar); stockDetailMapper.insert(detailOnCar);
params.addStockDetailId(detail_onCar.getId()); params.addStockDetailId(detailOnCar.getId());
// 装车 // 装车
extinguishantOnCarMapper.insert(params.create(r, detail_onCar)); extinguishantOnCarMapper.insert(params.create(r, detailOnCar));
// 流水 // 流水
journalMapper.insert(params.createJournal(r, detail_onCar.getId())); journalMapper.insert(params.createJournal(r, detailOnCar.getId()));
}); });
} catch (Exception e) { } catch (Exception e) {
......
...@@ -133,11 +133,11 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ ...@@ -133,11 +133,11 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
private SourceSceneMapper sourceSceneMapper; private SourceSceneMapper sourceSceneMapper;
@Override @Override
public Map<String, Object> getDetailsById(Long alarmId, Long equipId, String type, String area) { public Map<String, Object> getDetailsById(String alarmId, String equipId, String type, String area) {
final String videoType = "video"; final String videoType = "video";
Map<String, Object> res = new HashMap<>(); Map<String, Object> res = new HashMap<>();
if (videoType.equals(type)) { if (videoType.equals(type)) {
List<AlamVideoVO> video = videoMapper.getVideoBySpeId(equipId); List<AlamVideoVO> video = videoMapper.getVideoBySpeId(Long.valueOf(equipId));
video.forEach(action -> { video.forEach(action -> {
action.setVedioFormat(vedioFormat); action.setVedioFormat(vedioFormat);
action.setUrl(videoService.getVideoUrl(action.getName(), action.getPresetPosition(), action.getUrl(), action.getCode())); action.setUrl(videoService.getVideoUrl(action.getName(), action.getPresetPosition(), action.getUrl(), action.getCode()));
...@@ -153,7 +153,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ ...@@ -153,7 +153,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
} }
List<AlamVideoVO> videoBySpeId; List<AlamVideoVO> videoBySpeId;
if (specificAlarm == null) { if (specificAlarm == null) {
videoBySpeId = videoMapper.getVideoBySpeId(equipId); videoBySpeId = videoMapper.getVideoBySpeId(Long.valueOf(equipId));
} else { } else {
videoBySpeId = videoMapper.getVideoBySpeId(specificAlarm.getEquipmentSpecificId()); videoBySpeId = videoMapper.getVideoBySpeId(specificAlarm.getEquipmentSpecificId());
} }
...@@ -449,7 +449,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ ...@@ -449,7 +449,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
// Token serverToken = remoteSecurityService.getServerToken(); // Token serverToken = remoteSecurityService.getServerToken();
IotSystemAlarmRo confirmAlamVo = new IotSystemAlarmRo(); IotSystemAlarmRo confirmAlamVo = new IotSystemAlarmRo();
confirmAlamVo.setId(ent.getId()); confirmAlamVo.setId(ent.getId());
ent = confirmAlarmMapper.getDetailsById(ent.getId(), null); ent = confirmAlarmMapper.getDetailsById(String.valueOf(ent.getId()), null);
EquipmentSpecific equipmentSpecific = equipmentSpecificSerivce.getById(ent.getEquipmentSpecificId()); EquipmentSpecific equipmentSpecific = equipmentSpecificSerivce.getById(ent.getEquipmentSpecificId());
List<FormInstance> formInstances = new ArrayList<>(); List<FormInstance> formInstances = new ArrayList<>();
......
...@@ -592,7 +592,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -592,7 +592,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
} }
private List<AlarmDataVO> getProcessInfo(Long id) { private List<AlarmDataVO> getProcessInfo(Long id) {
EquipmentSpecificAlarmLog alam = confirmAlarmMapper.getDetailsById(id, null); EquipmentSpecificAlarmLog alam = confirmAlarmMapper.getDetailsById(String.valueOf(id), null);
List<AlarmDataVO> lists = new ArrayList<>(); List<AlarmDataVO> lists = new ArrayList<>();
AlarmDataVO v1 = new AlarmDataVO(); AlarmDataVO v1 = new AlarmDataVO();
......
...@@ -408,16 +408,14 @@ public class FilePatrolReportServiceImpl implements IFirePatrolReportService { ...@@ -408,16 +408,14 @@ public class FilePatrolReportServiceImpl implements IFirePatrolReportService {
public static byte[] file2byte(File file) public static byte[] file2byte(File file)
{ {
try { try (FileInputStream in =new FileInputStream(file);) {
FileInputStream in =new FileInputStream(file);
//当文件没有结束时,每次读取一个字节显示 //当文件没有结束时,每次读取一个字节显示
byte[] data=new byte[in.available()]; byte[] data = new byte[in.available()];
in.read(data); in.read(data);
in.close();
return data; return data;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return null; return new byte[0];
} }
} }
......
...@@ -280,16 +280,14 @@ public class FireAutoSysManageReportServiceImpl implements IFireAutoSysManageRep ...@@ -280,16 +280,14 @@ public class FireAutoSysManageReportServiceImpl implements IFireAutoSysManageRep
} }
public static byte[] file2byte(File file) { public static byte[] file2byte(File file) {
try { try (FileInputStream in = new FileInputStream(file);) {
FileInputStream in = new FileInputStream(file);
//当文件没有结束时,每次读取一个字节显示 //当文件没有结束时,每次读取一个字节显示
byte[] data = new byte[in.available()]; byte[] data = new byte[in.available()];
in.read(data); in.read(data);
in.close();
return data; return data;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return null; return new byte[0];
} }
} }
} }
...@@ -1072,7 +1072,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1072,7 +1072,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
public Map<String, Object> integrationPageSysData(String systemCode, Boolean isUpdate) { public Map<String, Object> integrationPageSysData(String systemCode, Boolean isUpdate) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
if (!StringUtil.isNotEmpty(SystemTypeEnum.getEnum(systemCode))) { if (!StringUtil.isNotEmpty(SystemTypeEnum.getEnum(systemCode))) {
return null; return Collections.emptyMap();
} }
Map<String, Object> data; Map<String, Object> data;
if (isUpdate) { if (isUpdate) {
...@@ -1088,7 +1088,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1088,7 +1088,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
if (!ObjectUtils.isEmpty(data)) { if (!ObjectUtils.isEmpty(data)) {
mqttSendGateway.sendToMqtt(String.format("%s%s", "INTEGRATE_TOPIC/", systemCode), JSON.toJSONString(data)); mqttSendGateway.sendToMqtt(String.format("%s%s", "INTEGRATE_TOPIC/", systemCode), JSON.toJSONString(data));
} }
return null; return Collections.emptyMap();
} }
public Map<String, Object> saveIntegrationPageSysData(String systemCode) { public Map<String, Object> saveIntegrationPageSysData(String systemCode) {
...@@ -1682,11 +1682,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1682,11 +1682,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} }
private static byte[] file2byte(File file) { private static byte[] file2byte(File file) {
try { try (FileInputStream in = new FileInputStream(file);) {
FileInputStream in = new FileInputStream(file);
byte[] data = new byte[in.available()]; byte[] data = new byte[in.available()];
in.read(data); in.read(data);
in.close();
return data; return data;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -316,9 +316,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -316,9 +316,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
log.info(String.format("发送eqm转kafka消息失败:%s", e.getMessage())); log.info(String.format("发送eqm转kafka消息失败:%s", e.getMessage()));
} }
// redis缓存指定指标、指定时长物联数据
pressurePumpService.saveDataToRedis(iotDatalist, topic);
if (!StringUtils.isEmpty(traceId)) { if (!StringUtils.isEmpty(traceId)) {
String finalTraceId = traceId; String finalTraceId = traceId;
List<IotDataVO> collect = iotDatalist.stream().map(x -> { List<IotDataVO> collect = iotDatalist.stream().map(x -> {
...@@ -339,7 +336,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -339,7 +336,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
*/ */
public void realTimeDateProcessing(TopicEntityVo topicEntity, List<IotDataVO> iotDatalist,EquipmentSpecificVo vo) { public void realTimeDateProcessing(TopicEntityVo topicEntity, List<IotDataVO> iotDatalist,EquipmentSpecificVo vo) {
String iotCode = topicEntity.getIotCode(); String iotCode = topicEntity.getIotCode();
if (EquipAndCarEnum.equip.type.equals(topicEntity.getType())) { if (EquipAndCarEnum.equip.type.equals(topicEntity.getType())) {
List<EquipmentSpecificIndex> indexList = equipmentSpecificIndexService List<EquipmentSpecificIndex> indexList = equipmentSpecificIndexService
.getEquipmentSpeIndexBySpeIotCode(iotCode); .getEquipmentSpeIndexBySpeIotCode(iotCode);
...@@ -347,6 +343,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -347,6 +343,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
return; return;
} }
equipRealTimeDate(iotDatalist, indexList, topicEntity,vo); equipRealTimeDate(iotDatalist, indexList, topicEntity,vo);
String bizOrgCode = indexList.get(0).getBizOrgCode();
// redis缓存指定指标、指定时长物联数据
pressurePumpService.saveDataToRedis(iotDatalist, iotCode, bizOrgCode);
} else { } else {
List<CarProperty> carProperties = carPropertyService.getCarPropListByIotCode(iotCode); List<CarProperty> carProperties = carPropertyService.getCarPropListByIotCode(iotCode);
if (ObjectUtils.isEmpty(carProperties)) { if (ObjectUtils.isEmpty(carProperties)) {
...@@ -354,7 +353,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -354,7 +353,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
} }
carRealTimeDate(iotDatalist, carProperties,topicEntity); carRealTimeDate(iotDatalist, carProperties,topicEntity);
} }
} }
/** /**
......
...@@ -7,10 +7,12 @@ import java.io.FileOutputStream; ...@@ -7,10 +7,12 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.Writer; import java.io.Writer;
import java.nio.charset.StandardCharsets;
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 javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -150,9 +152,9 @@ public class FileController extends AbstractBaseController { ...@@ -150,9 +152,9 @@ public class FileController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/download/**", method = RequestMethod.GET) @RequestMapping(value = "/download/**", method = RequestMethod.GET)
public void download(HttpServletResponse response, HttpServletRequest request) throws Exception { public void download(HttpServletResponse response, HttpServletRequest request) throws Exception {
try { try (FileInputStream inputStream = new FileInputStream(fileUploadDir + request.getServletPath().substring(15));
String path = request.getServletPath().substring(15); ServletOutputStream outputStream = response.getOutputStream();) {
IOUtils.copy(new FileInputStream(fileUploadDir + path), response.getOutputStream()); IOUtils.copy(inputStream, outputStream);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
ResponseUtils.renderText(response, "File not exists!"); ResponseUtils.renderText(response, "File not exists!");
...@@ -253,12 +255,9 @@ public class FileController extends AbstractBaseController { ...@@ -253,12 +255,9 @@ public class FileController extends AbstractBaseController {
} }
String htmlContent = (String) processData.get("html"); String htmlContent = (String) processData.get("html");
try { try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(htmlFileName), StandardCharsets.UTF_8));) {
Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(htmlFileName), "UTF-8"));
writer.write(htmlContent); writer.write(htmlContent);
writer.flush(); writer.flush();
writer.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -51,8 +51,6 @@ public class PlanVisual3dController extends AbstractBaseController { ...@@ -51,8 +51,6 @@ public class PlanVisual3dController extends AbstractBaseController {
@Autowired @Autowired
HttpServletResponse response; HttpServletResponse response;
@Autowired
HttpServletRequest request;
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "预案应用树", notes = "预案应用树") @ApiOperation(value = "预案应用树", notes = "预案应用树")
...@@ -76,7 +74,7 @@ public class PlanVisual3dController extends AbstractBaseController { ...@@ -76,7 +74,7 @@ public class PlanVisual3dController extends AbstractBaseController {
if (testPlan != null) { if (testPlan != null) {
String path = testPlan.getFilePath(); String path = testPlan.getFilePath();
if (path != null && !"".equals(path)) { if (path != null && !"".equals(path)) {
try { try (InputStream fis = new BufferedInputStream(new FileInputStream(fileUploadDir + path));) {
// path是指欲下载的文件的路径。 // path是指欲下载的文件的路径。
File file = new File(fileUploadDir + path); File file = new File(fileUploadDir + path);
if (file.exists()) { if (file.exists()) {
...@@ -84,12 +82,9 @@ public class PlanVisual3dController extends AbstractBaseController { ...@@ -84,12 +82,9 @@ public class PlanVisual3dController extends AbstractBaseController {
String filename = file.getName(); String filename = file.getName();
// 取得文件的后缀名。 // 取得文件的后缀名。
String ext = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase(); String ext = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase();
// 以流的形式下载文件。 // 以流的形式下载文件。
InputStream fis = new BufferedInputStream(new FileInputStream(fileUploadDir + path));
byte[] buffer = new byte[fis.available()]; byte[] buffer = new byte[fis.available()];
fis.read(buffer); fis.read(buffer);
fis.close();
// 清空response // 清空response
// response.reset(); // response.reset();
// 设置response的Header // 设置response的Header
......
...@@ -883,7 +883,10 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -883,7 +883,10 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Override @Override
public void run() { public void run() {
boolean isRunning = true; boolean isRunning = true;
int k = 0;
while (isRunning) { while (isRunning) {
k++;
isRunning = k < Integer.MAX_VALUE;
AlarmParam deviceData = null; AlarmParam deviceData = null;
try { try {
deviceData = blockingQueue.take(); deviceData = blockingQueue.take();
......
...@@ -83,11 +83,8 @@ public class FileHelper { ...@@ -83,11 +83,8 @@ public class FileHelper {
* @return * @return
*/ */
public static boolean isExcel2003(File file) { public static boolean isExcel2003(File file) {
InputStream is = null; try (InputStream is = new FileInputStream(file);
Workbook wb = null; Workbook wb = WorkbookFactory.create(is);) {
try {
is = new FileInputStream(file);
wb = WorkbookFactory.create(is);
if (wb instanceof XSSFWorkbook) { if (wb instanceof XSSFWorkbook) {
return false; return false;
} else if (wb instanceof HSSFWorkbook) { } else if (wb instanceof HSSFWorkbook) {
...@@ -95,17 +92,6 @@ public class FileHelper { ...@@ -95,17 +92,6 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
if (null != wb) {
wb.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
...@@ -187,13 +173,10 @@ public class FileHelper { ...@@ -187,13 +173,10 @@ public class FileHelper {
*/ */
public static StringBuffer readFile(String path) { public static StringBuffer readFile(String path) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
InputStream is = null; File file = new File(path);
BufferedReader br = null; try (InputStream is = new FileInputStream(file);
try { BufferedReader br = new BufferedReader(new InputStreamReader(is))) {
File file = new File(path);
if (file.exists()) { if (file.exists()) {
is = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(is));
String content = br.readLine(); String content = br.readLine();
while (null != content) { while (null != content) {
buffer.append(content); buffer.append(content);
...@@ -202,19 +185,7 @@ public class FileHelper { ...@@ -202,19 +185,7 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
if (null != br) {
br.close();
}
} catch (Exception e) {
e.printStackTrace();
}
} }
return buffer; return buffer;
} }
...@@ -227,13 +198,10 @@ public class FileHelper { ...@@ -227,13 +198,10 @@ public class FileHelper {
*/ */
public static StringBuffer readFile(String path, String split) { public static StringBuffer readFile(String path, String split) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
InputStream is = null; File file = new File(path);
BufferedReader br = null; try (InputStream is = new FileInputStream(file);
try { BufferedReader br = new BufferedReader(new InputStreamReader(is));) {
File file = new File(path);
if (file.exists()) { if (file.exists()) {
is = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(is));
String content = br.readLine(); String content = br.readLine();
while (null != content) { while (null != content) {
buffer.append(content).append(split); buffer.append(content).append(split);
...@@ -242,19 +210,7 @@ public class FileHelper { ...@@ -242,19 +210,7 @@ public class FileHelper {
} }
} catch (Exception exception) { } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
if (null != br) {
br.close();
}
} catch (Exception exception2) {
exception2.printStackTrace();
}
} }
return buffer; return buffer;
} }
...@@ -265,28 +221,15 @@ public class FileHelper { ...@@ -265,28 +221,15 @@ public class FileHelper {
* @param path 写入内容的文件路径 * @param path 写入内容的文件路径
*/ */
public static void writeFile(String content, String path) { public static void writeFile(String content, String path) {
OutputStream fos = null; File file = new File(path);
BufferedWriter bw = null; try (OutputStream fos = new FileOutputStream(file);
try { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos, StandardCharsets.UTF_8));) {
File file = new File(path);
if (!file.getParentFile().exists()) { if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
} }
fos = new FileOutputStream(file);
bw = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"));
bw.write(content); bw.write(content);
} catch (FileNotFoundException fnfe) { } catch (IOException fnfe) {
fnfe.printStackTrace(); fnfe.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
if (bw != null) {
bw.close();
}
} catch (IOException ioException) {
System.err.println(ioException.getMessage());
}
} }
} }
...@@ -375,11 +318,8 @@ public class FileHelper { ...@@ -375,11 +318,8 @@ public class FileHelper {
public static void rmrBlankLines(String inputFile, String outPutFile) throws IOException { public static void rmrBlankLines(String inputFile, String outPutFile) throws IOException {
File htmFile = new File(inputFile); File htmFile = new File(inputFile);
// 以GB2312读取文件 // 以GB2312读取文件
BufferedReader br = null; try (BufferedReader br = new BufferedReader(new FileReader(htmFile));
BufferedWriter bw = null; BufferedWriter bw = new BufferedWriter(new FileWriter(new File(outPutFile)));) {
try {
br = new BufferedReader(new FileReader(htmFile));
bw = new BufferedWriter(new FileWriter(new File(outPutFile)));
String result = null; String result = null;
while (null != (result = br.readLine())) { while (null != (result = br.readLine())) {
if (!"".equals(result.trim())) { if (!"".equals(result.trim())) {
...@@ -388,20 +328,7 @@ public class FileHelper { ...@@ -388,20 +328,7 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (null != br) {
br.close();
}
if (null != bw) {
bw.close();
}
} catch (Exception e) {
}
} }
} }
/** /**
...@@ -1192,34 +1119,25 @@ public class FileHelper { ...@@ -1192,34 +1119,25 @@ public class FileHelper {
*/ */
public static void getExcel(String url, String fileName, HttpServletResponse response, HttpServletRequest request) { public static void getExcel(String url, String fileName, HttpServletResponse response, HttpServletRequest request) {
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
response.setContentType("multipart/form-data");
//2.设置文件头:最后一个参数是设置下载文件名
try { try {
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
response.setContentType("multipart/form-data");
//2.设置文件头:最后一个参数是设置下载文件名
response.setHeader("Content-disposition", "attachment; filename=\"" response.setHeader("Content-disposition", "attachment; filename=\""
+ encodeChineseDownloadFileName(request, fileName + ".xls") + "\""); + encodeChineseDownloadFileName(request, fileName + ".xls") + "\"");
// response.setHeader("Content-Disposition", "attachment;filename=" } catch (UnsupportedEncodingException e) {
// + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名 e.printStackTrace();
}
//通过文件路径获得File对象 try (//通过文件路径获得File对象
File file = new File(url); FileInputStream in = new FileInputStream(new File(url));
//3.通过response获取OutputStream对象(out)
FileInputStream in = new FileInputStream(file); OutputStream out = new BufferedOutputStream(response.getOutputStream());) {
//3.通过response获取OutputStream对象(out)
OutputStream out = new BufferedOutputStream(response.getOutputStream());
int b = 0; int b = 0;
byte[] buffer = new byte[2048]; byte[] buffer = new byte[2048];
while ((b = in.read(buffer)) != -1) { while ((b = in.read(buffer)) != -1) {
out.write(buffer, 0, b); //4.写到输出流(out)中 out.write(buffer, 0, b); //4.写到输出流(out)中
} }
in.close();
out.flush(); out.flush();
out.close();
} catch (IOException e) { } catch (IOException e) {
log.error("下载Excel模板异常", e); log.error("下载Excel模板异常", e);
} }
......
...@@ -75,20 +75,20 @@ public class FileUtils { ...@@ -75,20 +75,20 @@ public class FileUtils {
* @return * @return
*/ */
public static String fileToZip(List<String> list, String fileName, String ipUrl) { public static String fileToZip(List<String> list, String fileName, String ipUrl) {
InputStream fis = null;
BufferedInputStream bis = null;
FileOutputStream fos = null;
ZipOutputStream zos = null;
// 临时目录 // 临时目录
String path = System.getProperty("java.io.tmpdir") + fileName; String path = System.getProperty("java.io.tmpdir") + fileName;
File zipFile = new File(path);
zipFile.deleteOnExit();
try { try {
File zipFile = new File(path);
zipFile.deleteOnExit();
zipFile.createNewFile(); zipFile.createNewFile();
} catch (IOException e) {
fos = new FileOutputStream(zipFile); e.printStackTrace();
zos = new ZipOutputStream(new BufferedOutputStream(fos)); }
InputStream fis = null;
BufferedInputStream bis = null;
try (
FileOutputStream fos = new FileOutputStream(zipFile);
ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(fos));) {
byte[] bufs = new byte[1024 * 10]; byte[] bufs = new byte[1024 * 10];
for (String a : list) { for (String a : list) {
fis = getInputStreamFromURL(ipUrl + a); fis = getInputStreamFromURL(ipUrl + a);
...@@ -105,9 +105,6 @@ public class FileUtils { ...@@ -105,9 +105,6 @@ public class FileUtils {
} }
} }
System.out.println("压缩成功"); System.out.println("压缩成功");
} catch (FileNotFoundException e) {
e.printStackTrace();
throw new RuntimeException(e);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException(e); throw new RuntimeException(e);
...@@ -116,12 +113,11 @@ public class FileUtils { ...@@ -116,12 +113,11 @@ public class FileUtils {
if (null != bis) { if (null != bis) {
bis.close(); bis.close();
} }
if (null != zos) { if (null != fis) {
zos.close(); fis.close();
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException(e);
} }
} }
return path; return path;
......
...@@ -98,7 +98,11 @@ public class RsDataQueue { ...@@ -98,7 +98,11 @@ public class RsDataQueue {
private Runnable task_runnable = new Runnable() { private Runnable task_runnable = new Runnable() {
@Override @Override
public void run() { public void run() {
while (true) { int k = 0;
boolean b = true;
while (b) {
k++;
b = k < Integer.MAX_VALUE;
try { try {
FmeaMessage fmeaMessage = blockingQueue.take(); FmeaMessage fmeaMessage = blockingQueue.take();
if (riskSourceService != null) { if (riskSourceService != null) {
......
...@@ -21,7 +21,7 @@ public class AmosThreadPool { ...@@ -21,7 +21,7 @@ public class AmosThreadPool {
/** /**
* 单例 * 单例
*/ */
private static AmosThreadPool instance; private static volatile AmosThreadPool instance;
/** /**
* 执行服务 * 执行服务
......
...@@ -26,10 +26,12 @@ public class FileUtil { ...@@ -26,10 +26,12 @@ public class FileUtil {
if (!targetFile.exists()) { if (!targetFile.exists()) {
targetFile.mkdirs(); targetFile.mkdirs();
} }
FileOutputStream out = new FileOutputStream(filePath + fileName); try (FileOutputStream out = new FileOutputStream(filePath + fileName);) {
out.write(file); out.write(file);
out.flush(); out.flush();
out.close(); } catch (IOException e) {
e.printStackTrace();
}
} }
/** /**
......
...@@ -34,9 +34,9 @@ public class SocketClient { ...@@ -34,9 +34,9 @@ public class SocketClient {
public void processUdp(int port, int type) throws SocketException { public void processUdp(int port, int type) throws SocketException {
if (type < 0) type = 0; if (type < 0) type = 0;
if (type >= testFilePath.length) type -= 1; if (type >= testFilePath.length) type -= 1;
DatagramSocket datagramSocket = new DatagramSocket();
try { try (DatagramSocket datagramSocket = new DatagramSocket();
FileInputStream fis = new FileInputStream(new File("C:\\Users\\DELL\\Desktop\\ffmpeg-4.4-full_build-shared\\bin\\out.pcm")); FileInputStream fis = new FileInputStream(new File("C:\\Users\\DELL\\Desktop\\ffmpeg-4.4-full_build-shared\\bin\\out.pcm"));) {
byte[] b = new byte[1280]; byte[] b = new byte[1280];
int len; int len;
while ((len = fis.read(b)) > 0) { while ((len = fis.read(b)) > 0) {
...@@ -57,11 +57,10 @@ public class SocketClient { ...@@ -57,11 +57,10 @@ public class SocketClient {
if (type < 0) type = 0; if (type < 0) type = 0;
if (type >= testFilePath.length) type -= 1; if (type >= testFilePath.length) type -= 1;
Socket socket = new Socket(); try (Socket socket = new Socket();
try { FileInputStream fis = new FileInputStream(new File(testFilePath[type]));) {
socket.connect(new InetSocketAddress(InetAddress.getLocalHost().getHostAddress(), port)); socket.connect(new InetSocketAddress(InetAddress.getLocalHost().getHostAddress(), port));
OutputStream outputStream = socket.getOutputStream(); OutputStream outputStream = socket.getOutputStream();
FileInputStream fis = new FileInputStream(new File(testFilePath[type]));
byte[] b = new byte[4096]; byte[] b = new byte[4096];
int len; int len;
while ((len = fis.read(b)) > 0) { while ((len = fis.read(b)) > 0) {
......
...@@ -125,7 +125,9 @@ public class SpeechTranscriberDemo { ...@@ -125,7 +125,9 @@ public class SpeechTranscriberDemo {
public void process(String filepath) { public void process(String filepath) {
SpeechTranscriber transcriber = null; SpeechTranscriber transcriber = null;
try { File file = new File(filepath);
try (FileInputStream fis = new FileInputStream(file);
DatagramSocket datagramSocket = new DatagramSocket();) {
//创建实例、建立连接。 //创建实例、建立连接。
transcriber = new SpeechTranscriber(client, getTranscriberListener()); transcriber = new SpeechTranscriber(client, getTranscriberListener());
transcriber.setAppKey("89KKwpGXXN37Pn1G"); transcriber.setAppKey("89KKwpGXXN37Pn1G");
...@@ -164,12 +166,9 @@ public class SpeechTranscriberDemo { ...@@ -164,12 +166,9 @@ public class SpeechTranscriberDemo {
//此方法将以上参数设置序列化为JSON发送给服务端,并等待服务端确认。 //此方法将以上参数设置序列化为JSON发送给服务端,并等待服务端确认。
transcriber.start(); transcriber.start();
File file = new File(filepath);
FileInputStream fis = new FileInputStream(file);
byte[] b = new byte[320]; byte[] b = new byte[320];
int len; int len;
DatagramSocket datagramSocket = new DatagramSocket();
while ((len = fis.read(b)) > 0) { while ((len = fis.read(b)) > 0) {
// logger.info("send data pack length: " + len); // logger.info("send data pack length: " + len);
datagramSocket.send(new DatagramPacket(b, b.length, InetAddress.getLocalHost(), 25000)); datagramSocket.send(new DatagramPacket(b, b.length, InetAddress.getLocalHost(), 25000));
......
...@@ -108,9 +108,8 @@ public class SignController extends BaseController { ...@@ -108,9 +108,8 @@ public class SignController extends BaseController {
signDto.setPersonPhotos(personImg.get(0).getValue()); signDto.setPersonPhotos(personImg.get(0).getValue());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
return ResponseHelper.buildResponse(signDto);
} }
return ResponseHelper.buildResponse(signDto);
} }
......
...@@ -17,7 +17,7 @@ public class TriggerKeyQueue { ...@@ -17,7 +17,7 @@ public class TriggerKeyQueue {
/** /**
* 单例 * 单例
*/ */
private static TriggerKeyQueue instance; private static volatile TriggerKeyQueue instance;
/** /**
* 队列 * 队列
......
...@@ -60,6 +60,7 @@ import java.net.URLEncoder; ...@@ -60,6 +60,7 @@ 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.nio.charset.StandardCharsets;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -121,20 +122,10 @@ public class FileHelper { ...@@ -121,20 +122,10 @@ public class FileHelper {
* @return * @return
*/ */
public static boolean isWord2003(File file) { public static boolean isWord2003(File file) {
InputStream is = null; try (InputStream is = new FileInputStream(file);
try { HWPFDocument hwpfDocument = new HWPFDocument(is);) {
is = new FileInputStream(file);
new HWPFDocument(is);
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
...@@ -164,24 +155,10 @@ public class FileHelper { ...@@ -164,24 +155,10 @@ public class FileHelper {
* @return * @return
*/ */
public static boolean isPPT2003(File file) { public static boolean isPPT2003(File file) {
InputStream is = null; try (InputStream is = new FileInputStream(file);
HSLFSlideShow ppt = null; HSLFSlideShow ppt = new HSLFSlideShow(is);) {
try {
is = new FileInputStream(file);
ppt = new HSLFSlideShow(is);
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
if (null != ppt) {
ppt.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
...@@ -193,13 +170,10 @@ public class FileHelper { ...@@ -193,13 +170,10 @@ public class FileHelper {
*/ */
public static StringBuffer readFile(String path) { public static StringBuffer readFile(String path) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
InputStream is = null; File file = new File(path);
BufferedReader br = null; try (InputStream is = new FileInputStream(file);
try { BufferedReader br = new BufferedReader(new InputStreamReader(is));) {
File file = new File(path);
if (file.exists()) { if (file.exists()) {
is = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(is));
String content = br.readLine(); String content = br.readLine();
while (null != content) { while (null != content) {
buffer.append(content); buffer.append(content);
...@@ -208,19 +182,7 @@ public class FileHelper { ...@@ -208,19 +182,7 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
if (null != br) {
br.close();
}
} catch (Exception e) {
e.printStackTrace();
}
} }
return buffer; return buffer;
} }
...@@ -232,13 +194,10 @@ public class FileHelper { ...@@ -232,13 +194,10 @@ public class FileHelper {
*/ */
public static StringBuffer readFile(String path, String split) { public static StringBuffer readFile(String path, String split) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
InputStream is = null; File file = new File(path);
BufferedReader br = null; try (InputStream is = new FileInputStream(file);
try { BufferedReader br = new BufferedReader(new InputStreamReader(is));) {
File file = new File(path);
if (file.exists()) { if (file.exists()) {
is = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(is));
String content = br.readLine(); String content = br.readLine();
while (null != content) { while (null != content) {
buffer.append(content).append(split); buffer.append(content).append(split);
...@@ -247,19 +206,7 @@ public class FileHelper { ...@@ -247,19 +206,7 @@ public class FileHelper {
} }
} catch (Exception exception) { } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
if (null != br) {
br.close();
}
} catch (Exception exception2) {
exception2.printStackTrace();
}
} }
return buffer; return buffer;
} }
...@@ -269,28 +216,17 @@ public class FileHelper { ...@@ -269,28 +216,17 @@ public class FileHelper {
* @param path 写入内容的文件路径 * @param path 写入内容的文件路径
*/ */
public static void writeFile(String content, String path) { public static void writeFile(String content, String path) {
OutputStream fos = null; File file = new File(path);
BufferedWriter bw = null; try (OutputStream fos = new FileOutputStream(file);
try { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos, StandardCharsets.UTF_8)); ) {
File file = new File(path);
if (!file.getParentFile().exists()) { if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
} }
fos = new FileOutputStream(file);
bw = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"));
bw.write(content); bw.write(content);
} catch (FileNotFoundException fnfe) { } catch (FileNotFoundException fnfe) {
fnfe.printStackTrace(); fnfe.printStackTrace();
} catch (IOException ioe) { } catch (IOException ioe) {
ioe.printStackTrace(); ioe.printStackTrace();
} finally {
try {
if (bw != null) {
bw.close();
}
} catch (IOException ioException) {
System.err.println(ioException.getMessage());
}
} }
} }
...@@ -379,11 +315,8 @@ public class FileHelper { ...@@ -379,11 +315,8 @@ public class FileHelper {
public static void rmrBlankLines(String inputFile, String outPutFile) throws IOException { public static void rmrBlankLines(String inputFile, String outPutFile) throws IOException {
File htmFile = new File(inputFile); File htmFile = new File(inputFile);
// 以GB2312读取文件 // 以GB2312读取文件
BufferedReader br = null; try (BufferedReader br = new BufferedReader(new FileReader(htmFile));
BufferedWriter bw = null; BufferedWriter bw = new BufferedWriter(new FileWriter(new File(outPutFile)));) {
try {
br = new BufferedReader(new FileReader(htmFile));
bw = new BufferedWriter(new FileWriter(new File(outPutFile)));
String result = null; String result = null;
while (null != (result = br.readLine())) { while (null != (result = br.readLine())) {
if (!"".equals(result.trim())) { if (!"".equals(result.trim())) {
...@@ -392,17 +325,6 @@ public class FileHelper { ...@@ -392,17 +325,6 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (null != br) {
br.close();
}
if (null != bw) {
bw.close();
}
} catch (Exception e) {
}
} }
...@@ -1198,35 +1120,24 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam ...@@ -1198,35 +1120,24 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
* @throws * @throws
*/ */
public static void getExcel(String url, String fileName, HttpServletResponse response,HttpServletRequest request){ public static void getExcel(String url, String fileName, HttpServletResponse response,HttpServletRequest request){
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
try { response.setContentType("multipart/form-data");
//2.设置文件头:最后一个参数是设置下载文件名
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型 try {
response.setContentType("multipart/form-data"); response.setHeader("Content-disposition", "attachment; filename=\""
+ encodeChineseDownloadFileName(request, fileName+".xls") +"\"");
//2.设置文件头:最后一个参数是设置下载文件名 } catch (UnsupportedEncodingException e) {
response.setHeader("Content-disposition", "attachment; filename=\"" e.printStackTrace();
+ encodeChineseDownloadFileName(request, fileName+".xls") +"\""); }
// response.setHeader("Content-Disposition", "attachment;filename=" try (FileInputStream in = new FileInputStream(new File(url));
// + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名 //3.通过response获取OutputStream对象(out)
OutputStream out = new BufferedOutputStream(response.getOutputStream());) {
//通过文件路径获得File对象
File file = new File(url);
FileInputStream in = new FileInputStream(file);
//3.通过response获取OutputStream对象(out)
OutputStream out = new BufferedOutputStream(response.getOutputStream());
int b = 0; int b = 0;
byte[] buffer = new byte[2048]; byte[] buffer = new byte[2048];
while ((b=in.read(buffer)) != -1){ while ((b=in.read(buffer)) != -1){
out.write(buffer,0,b); //4.写到输出流(out)中 out.write(buffer,0,b); //4.写到输出流(out)中
} }
in.close();
out.flush(); out.flush();
out.close();
} catch (IOException e) { } catch (IOException e) {
log.error("下载Excel模板异常", e); log.error("下载Excel模板异常", e);
} }
......
...@@ -34,18 +34,12 @@ public class TikaUtils { ...@@ -34,18 +34,12 @@ public class TikaUtils {
public static String fileToTxt(File file) { public static String fileToTxt(File file) {
org.apache.tika.parser.Parser parser = new AutoDetectParser(); org.apache.tika.parser.Parser parser = new AutoDetectParser();
try { try (InputStream inputStream = new FileInputStream(file);) {
InputStream inputStream = new FileInputStream(file);
DefaultHandler handler = new BodyContentHandler(); DefaultHandler handler = new BodyContentHandler();
Metadata metadata = new Metadata(); Metadata metadata = new Metadata();
ParseContext parseContext = new ParseContext(); ParseContext parseContext = new ParseContext();
parseContext.set(Parser.class, parser); parseContext.set(Parser.class, parser);
parser.parse(inputStream, handler, metadata, parseContext); parser.parse(inputStream, handler, metadata, parseContext);
/*
* for (String string : metadata.names()) {
* System.out.println(string+":"+metadata.get(string)); }
*/
inputStream.close();
return handler.toString(); return handler.toString();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -58,22 +52,16 @@ public class TikaUtils { ...@@ -58,22 +52,16 @@ public class TikaUtils {
ContentHandler handler = new ToHTMLContentHandler(); ContentHandler handler = new ToHTMLContentHandler();
AutoDetectParser parser = new AutoDetectParser(); AutoDetectParser parser = new AutoDetectParser();
Metadata metadata = new Metadata(); Metadata metadata = new Metadata();
InputStream stream = null;
try { try {
stream = new FileInputStream(new File(fileName)); InputStream stream = new FileInputStream(new File(fileName));
InputStream stream2 = new FileInputStream(new File(fileName));
parser.parse(stream, handler, metadata); parser.parse(stream, handler, metadata);
FileHelper.writeFile(handler.toString(), outPutFile + ".html"); FileHelper.writeFile(handler.toString(), outPutFile + ".html");
FileHelper.parse(outPutFile + ".html"); FileHelper.parse(outPutFile + ".html");
return null;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
} }
return "";
return null;
} }
......
package com.yeejoin.amos.latentdanger.core.threadpool; package com.yeejoin.amos.latentdanger.core.threadpool;
import com.yeejoin.amos.latentdanger.business.constants.Constants; import com.yeejoin.amos.latentdanger.business.constants.Constants;
import com.yeejoin.amos.latentdanger.business.trigger.TriggerKeyQueue;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -20,7 +21,7 @@ public class AmosThreadPool { ...@@ -20,7 +21,7 @@ public class AmosThreadPool {
/** /**
* 单例 * 单例
*/ */
private static AmosThreadPool instance; private static volatile AmosThreadPool instance;
/** /**
* 执行服务 * 执行服务
......
...@@ -9,6 +9,7 @@ import java.util.List; ...@@ -9,6 +9,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.maintenance.business.dao.repository.IPointInputItemDao;
import com.yeejoin.amos.maintenance.core.framework.PersonIdentify; import com.yeejoin.amos.maintenance.core.framework.PersonIdentify;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
...@@ -73,6 +74,8 @@ public class InputItemController extends AbstractBaseController { ...@@ -73,6 +74,8 @@ public class InputItemController extends AbstractBaseController {
IInputItemService inputItemService; IInputItemService inputItemService;
@Autowired @Autowired
IInputItemDao inputItemDao; IInputItemDao inputItemDao;
@Autowired
IPointInputItemDao iPointInputItemDao;
/** /**
* 新增巡检项 * 新增巡检项
...@@ -155,6 +158,10 @@ public class InputItemController extends AbstractBaseController { ...@@ -155,6 +158,10 @@ public class InputItemController extends AbstractBaseController {
if (ObjectUtils.isEmpty(itemIDs)) { if (ObjectUtils.isEmpty(itemIDs)) {
return CommonResponseUtil.failure("请选择要删除的检查项"); return CommonResponseUtil.failure("请选择要删除的检查项");
} }
//查询该巡查项是否已有巡查点绑定 有就返回
if (iPointInputItemDao.selectByITemId(itemIDs) > 0) {
return CommonResponseUtil.failure("该巡检项已绑定,请先删除巡检设备的巡检项");
}
String[] ids = itemIDs.split(","); String[] ids = itemIDs.split(",");
inputItemService.batchDelInputItem(ids); inputItemService.batchDelInputItem(ids);
return CommonResponseUtil.success(); return CommonResponseUtil.success();
......
...@@ -25,6 +25,9 @@ public interface IPointInputItemDao extends BaseDao<PointInputItem, Long> { ...@@ -25,6 +25,9 @@ public interface IPointInputItemDao extends BaseDao<PointInputItem, Long> {
@Query(value = "SELECT * FROM p_point_inputitem WHERE point_id = ?1 AND input_item_id = ?2", nativeQuery = true) @Query(value = "SELECT * FROM p_point_inputitem WHERE point_id = ?1 AND input_item_id = ?2", nativeQuery = true)
PointInputItem getPointInputItem(Long pointId, Long inputItemId); PointInputItem getPointInputItem(Long pointId, Long inputItemId);
@Query(value = "SELECT count(*) FROM p_point_inputitem WHERE input_item_id IN(?1) ", nativeQuery = true)
int selectByITemId(String inputItemIds);
@Modifying @Modifying
@Transactional @Transactional
@Query(value = "DELETE FROM p_point_inputitem WHERE point_id = (?1) AND input_item_id IN (?2)", nativeQuery = true) @Query(value = "DELETE FROM p_point_inputitem WHERE point_id = (?1) AND input_item_id IN (?2)", nativeQuery = true)
......
...@@ -17,7 +17,7 @@ public class TriggerKeyQueue { ...@@ -17,7 +17,7 @@ public class TriggerKeyQueue {
/** /**
* 单例 * 单例
*/ */
private static TriggerKeyQueue instance; private static volatile TriggerKeyQueue instance;
/** /**
* 队列 * 队列
......
...@@ -40,6 +40,7 @@ import java.net.URLEncoder; ...@@ -40,6 +40,7 @@ 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.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
...@@ -64,11 +65,8 @@ public class FileHelper { ...@@ -64,11 +65,8 @@ public class FileHelper {
* @return * @return
*/ */
public static boolean isExcel2003(File file) { public static boolean isExcel2003(File file) {
InputStream is = null; try (InputStream is = new FileInputStream(file);
Workbook wb = null; Workbook wb = WorkbookFactory.create(is);) {
try {
is = new FileInputStream(file);
wb = WorkbookFactory.create(is);
if (wb instanceof XSSFWorkbook) { if (wb instanceof XSSFWorkbook) {
return false; return false;
} else if (wb instanceof HSSFWorkbook) { } else if (wb instanceof HSSFWorkbook) {
...@@ -76,17 +74,6 @@ public class FileHelper { ...@@ -76,17 +74,6 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
if (null != wb) {
wb.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
...@@ -97,20 +84,10 @@ public class FileHelper { ...@@ -97,20 +84,10 @@ public class FileHelper {
* @return * @return
*/ */
public static boolean isWord2003(File file) { public static boolean isWord2003(File file) {
InputStream is = null; try (InputStream is = new FileInputStream(file);
try { HWPFDocument hwpfDocument = new HWPFDocument(is);) {
is = new FileInputStream(file);
new HWPFDocument(is);
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
...@@ -169,34 +146,19 @@ public class FileHelper { ...@@ -169,34 +146,19 @@ public class FileHelper {
*/ */
public static StringBuffer readFile(String path) { public static StringBuffer readFile(String path) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
InputStream is = null; File file = new File(path);
BufferedReader br = null; if (file.exists()) {
try { try (InputStream is = new FileInputStream(file);
File file = new File(path); BufferedReader br = new BufferedReader(new InputStreamReader(is))) {
if (file.exists()) {
is = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(is));
String content = br.readLine(); String content = br.readLine();
while (null != content) { while (null != content) {
buffer.append(content); buffer.append(content);
content = br.readLine(); content = br.readLine();
} }
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
if (null != br) {
br.close();
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
return buffer; return buffer;
} }
...@@ -208,34 +170,19 @@ public class FileHelper { ...@@ -208,34 +170,19 @@ public class FileHelper {
*/ */
public static StringBuffer readFile(String path, String split) { public static StringBuffer readFile(String path, String split) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
InputStream is = null; File file = new File(path);
BufferedReader br = null; if (file.exists()) {
try { try (InputStream is = new FileInputStream(file);
File file = new File(path); BufferedReader br = new BufferedReader(new InputStreamReader(is))) {
if (file.exists()) {
is = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(is));
String content = br.readLine(); String content = br.readLine();
while (null != content) { while (null != content) {
buffer.append(content).append(split); buffer.append(content).append(split);
content = br.readLine(); content = br.readLine();
} }
} } catch (Exception exception) {
} catch (Exception exception) { exception.printStackTrace();
exception.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
if (null != br) {
br.close();
}
} catch (Exception exception2) {
exception2.printStackTrace();
} }
} }
return buffer; return buffer;
} }
...@@ -245,28 +192,15 @@ public class FileHelper { ...@@ -245,28 +192,15 @@ public class FileHelper {
* @param path 写入内容的文件路径 * @param path 写入内容的文件路径
*/ */
public static void writeFile(String content, String path) { public static void writeFile(String content, String path) {
OutputStream fos = null; File file = new File(path);
BufferedWriter bw = null; try (OutputStream fos = new FileOutputStream(file);
try { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos, StandardCharsets.UTF_8))) {
File file = new File(path);
if (!file.getParentFile().exists()) { if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
} }
fos = new FileOutputStream(file);
bw = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"));
bw.write(content); bw.write(content);
} catch (FileNotFoundException fnfe) { } catch (IOException fnfe) {
fnfe.printStackTrace(); fnfe.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
if (bw != null) {
bw.close();
}
} catch (IOException ioException) {
System.err.println(ioException.getMessage());
}
} }
} }
...@@ -355,11 +289,8 @@ public class FileHelper { ...@@ -355,11 +289,8 @@ public class FileHelper {
public static void rmrBlankLines(String inputFile, String outPutFile) throws IOException { public static void rmrBlankLines(String inputFile, String outPutFile) throws IOException {
File htmFile = new File(inputFile); File htmFile = new File(inputFile);
// 以GB2312读取文件 // 以GB2312读取文件
BufferedReader br = null; try (BufferedReader br = new BufferedReader(new FileReader(htmFile));
BufferedWriter bw = null; BufferedWriter bw = new BufferedWriter(new FileWriter(new File(outPutFile)));) {
try {
br = new BufferedReader(new FileReader(htmFile));
bw = new BufferedWriter(new FileWriter(new File(outPutFile)));
String result = null; String result = null;
while (null != (result = br.readLine())) { while (null != (result = br.readLine())) {
if (!"".equals(result.trim())) { if (!"".equals(result.trim())) {
...@@ -368,20 +299,7 @@ public class FileHelper { ...@@ -368,20 +299,7 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (null != br) {
br.close();
}
if (null != bw) {
bw.close();
}
} catch (Exception e) {
}
} }
} }
/** /**
...@@ -1254,38 +1172,31 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam ...@@ -1254,38 +1172,31 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
* @throws * @throws
*/ */
public static void getExcel(String url, String fileName, HttpServletResponse response,HttpServletRequest request){ public static void getExcel(String url, String fileName, HttpServletResponse response,HttpServletRequest request){
//通过文件路径获得File对象
try { File file = new File(url);
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型 response.setContentType("multipart/form-data");
response.setContentType("multipart/form-data"); //2.设置文件头:最后一个参数是设置下载文件名
try {
//2.设置文件头:最后一个参数是设置下载文件名 response.setHeader("Content-disposition", "attachment; filename=\""
response.setHeader("Content-disposition", "attachment; filename=\"" + encodeChineseDownloadFileName(request, fileName+".xls") +"\"");
+ encodeChineseDownloadFileName(request, fileName+".xls") +"\""); } catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
try ( FileInputStream in = new FileInputStream(file);
OutputStream out = new BufferedOutputStream(response.getOutputStream());) {
// response.setHeader("Content-Disposition", "attachment;filename=" // response.setHeader("Content-Disposition", "attachment;filename="
// + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名 // + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名
//3.通过response获取OutputStream对象(out)
//通过文件路径获得File对象 int b = 0;
File file = new File(url); byte[] buffer = new byte[2048];
while ((b=in.read(buffer)) != -1){
FileInputStream in = new FileInputStream(file); out.write(buffer,0,b); //4.写到输出流(out)中
//3.通过response获取OutputStream对象(out)
OutputStream out = new BufferedOutputStream(response.getOutputStream());
int b = 0;
byte[] buffer = new byte[2048];
while ((b=in.read(buffer)) != -1){
out.write(buffer,0,b); //4.写到输出流(out)中
}
in.close();
out.flush();
out.close();
} catch (IOException e) {
log.error("下载Excel模板异常", e);
} }
out.flush();
} catch (IOException e) {
log.error("下载Excel模板异常", e);
}
} }
/** /**
......
...@@ -34,17 +34,12 @@ public class TikaUtils { ...@@ -34,17 +34,12 @@ public class TikaUtils {
public static String fileToTxt(File file) { public static String fileToTxt(File file) {
org.apache.tika.parser.Parser parser = new AutoDetectParser(); org.apache.tika.parser.Parser parser = new AutoDetectParser();
try { try (InputStream inputStream = new FileInputStream(file);) {
InputStream inputStream = new FileInputStream(file);
DefaultHandler handler = new BodyContentHandler(); DefaultHandler handler = new BodyContentHandler();
Metadata metadata = new Metadata(); Metadata metadata = new Metadata();
ParseContext parseContext = new ParseContext(); ParseContext parseContext = new ParseContext();
parseContext.set(Parser.class, parser); parseContext.set(Parser.class, parser);
parser.parse(inputStream, handler, metadata, parseContext); parser.parse(inputStream, handler, metadata, parseContext);
/*
* for (String string : metadata.names()) {
* System.out.println(string+":"+metadata.get(string)); }
*/
inputStream.close(); inputStream.close();
return handler.toString(); return handler.toString();
} catch (Exception e) { } catch (Exception e) {
......
...@@ -20,7 +20,7 @@ public class AmosThreadPool { ...@@ -20,7 +20,7 @@ public class AmosThreadPool {
/** /**
* 单例 * 单例
*/ */
private static AmosThreadPool instance; private static volatile AmosThreadPool instance;
/** /**
* 执行服务 * 执行服务
......
...@@ -17,7 +17,7 @@ public class TriggerKeyQueue { ...@@ -17,7 +17,7 @@ public class TriggerKeyQueue {
/** /**
* 单例 * 单例
*/ */
private static TriggerKeyQueue instance; private static volatile TriggerKeyQueue instance;
/** /**
* 队列 * 队列
......
...@@ -41,6 +41,7 @@ import java.net.URLEncoder; ...@@ -41,6 +41,7 @@ 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.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
...@@ -98,20 +99,10 @@ public class FileHelper { ...@@ -98,20 +99,10 @@ public class FileHelper {
* @return * @return
*/ */
public static boolean isWord2003(File file) { public static boolean isWord2003(File file) {
InputStream is = null; try (InputStream is = new FileInputStream(file);
try { HWPFDocument hwpfDocument = new HWPFDocument(is);) {
is = new FileInputStream(file);
new HWPFDocument(is);
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
...@@ -141,24 +132,10 @@ public class FileHelper { ...@@ -141,24 +132,10 @@ public class FileHelper {
* @return * @return
*/ */
public static boolean isPPT2003(File file) { public static boolean isPPT2003(File file) {
InputStream is = null; try ( InputStream is = new FileInputStream(file);
HSLFSlideShow ppt = null; HSLFSlideShow ppt = new HSLFSlideShow(is);) {
try {
is = new FileInputStream(file);
ppt = new HSLFSlideShow(is);
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
if (null != ppt) {
ppt.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
...@@ -170,34 +147,19 @@ public class FileHelper { ...@@ -170,34 +147,19 @@ public class FileHelper {
*/ */
public static StringBuffer readFile(String path) { public static StringBuffer readFile(String path) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
InputStream is = null; File file = new File(path);
BufferedReader br = null; if (file.exists()) {
try { try (InputStream is = new FileInputStream(file);
File file = new File(path); BufferedReader br = new BufferedReader(new InputStreamReader(is))) {
if (file.exists()) {
is = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(is));
String content = br.readLine(); String content = br.readLine();
while (null != content) { while (null != content) {
buffer.append(content); buffer.append(content);
content = br.readLine(); content = br.readLine();
} }
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
if (null != br) {
br.close();
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
return buffer; return buffer;
} }
...@@ -209,34 +171,20 @@ public class FileHelper { ...@@ -209,34 +171,20 @@ public class FileHelper {
*/ */
public static StringBuffer readFile(String path, String split) { public static StringBuffer readFile(String path, String split) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
InputStream is = null; File file = new File(path);
BufferedReader br = null; if (file.exists()) {
try { try (InputStream is = new FileInputStream(file);
File file = new File(path); BufferedReader br = new BufferedReader(new InputStreamReader(is))) {
if (file.exists()) {
is = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(is));
String content = br.readLine(); String content = br.readLine();
while (null != content) { while (null != content) {
buffer.append(content).append(split); buffer.append(content).append(split);
content = br.readLine(); content = br.readLine();
} }
}
} catch (Exception exception) { } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
if (null != br) {
br.close();
}
} catch (Exception exception2) {
exception2.printStackTrace();
} }
} }
return buffer; return buffer;
} }
...@@ -246,28 +194,15 @@ public class FileHelper { ...@@ -246,28 +194,15 @@ public class FileHelper {
* @param path 写入内容的文件路径 * @param path 写入内容的文件路径
*/ */
public static void writeFile(String content, String path) { public static void writeFile(String content, String path) {
OutputStream fos = null; File file = new File(path);
BufferedWriter bw = null; try (OutputStream fos = new FileOutputStream(file);
try { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos, StandardCharsets.UTF_8))) {
File file = new File(path);
if (!file.getParentFile().exists()) { if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
} }
fos = new FileOutputStream(file);
bw = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"));
bw.write(content); bw.write(content);
} catch (FileNotFoundException fnfe) { } catch (IOException fnfe) {
fnfe.printStackTrace(); fnfe.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
if (bw != null) {
bw.close();
}
} catch (IOException ioException) {
System.err.println(ioException.getMessage());
}
} }
} }
...@@ -356,11 +291,8 @@ public class FileHelper { ...@@ -356,11 +291,8 @@ public class FileHelper {
public static void rmrBlankLines(String inputFile, String outPutFile) throws IOException { public static void rmrBlankLines(String inputFile, String outPutFile) throws IOException {
File htmFile = new File(inputFile); File htmFile = new File(inputFile);
// 以GB2312读取文件 // 以GB2312读取文件
BufferedReader br = null; try (BufferedReader br = new BufferedReader(new FileReader(htmFile));
BufferedWriter bw = null; BufferedWriter bw = new BufferedWriter(new FileWriter(new File(outPutFile)));) {
try {
br = new BufferedReader(new FileReader(htmFile));
bw = new BufferedWriter(new FileWriter(new File(outPutFile)));
String result = null; String result = null;
while (null != (result = br.readLine())) { while (null != (result = br.readLine())) {
if (!"".equals(result.trim())) { if (!"".equals(result.trim())) {
...@@ -369,20 +301,7 @@ public class FileHelper { ...@@ -369,20 +301,7 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (null != br) {
br.close();
}
if (null != bw) {
bw.close();
}
} catch (Exception e) {
}
} }
} }
/** /**
...@@ -1258,35 +1177,28 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam ...@@ -1258,35 +1177,28 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
* @throws * @throws
*/ */
public static void getExcel(String url, String fileName, HttpServletResponse response,HttpServletRequest request){ public static void getExcel(String url, String fileName, HttpServletResponse response,HttpServletRequest request){
//通过文件路径获得File对象
try { File file = new File(url);
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型 response.setContentType("multipart/form-data");
response.setContentType("multipart/form-data"); //2.设置文件头:最后一个参数是设置下载文件名
try {
//2.设置文件头:最后一个参数是设置下载文件名 response.setHeader("Content-disposition", "attachment; filename=\""
response.setHeader("Content-disposition", "attachment; filename=\"" + encodeChineseDownloadFileName(request, fileName+".xls") +"\"");
+ encodeChineseDownloadFileName(request, fileName+".xls") +"\""); } catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
try ( FileInputStream in = new FileInputStream(file);
OutputStream out = new BufferedOutputStream(response.getOutputStream());) {
// response.setHeader("Content-Disposition", "attachment;filename=" // response.setHeader("Content-Disposition", "attachment;filename="
// + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名 // + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名
//通过文件路径获得File对象
File file = new File(url);
FileInputStream in = new FileInputStream(file);
//3.通过response获取OutputStream对象(out) //3.通过response获取OutputStream对象(out)
OutputStream out = new BufferedOutputStream(response.getOutputStream());
int b = 0; int b = 0;
byte[] buffer = new byte[2048]; byte[] buffer = new byte[2048];
while ((b=in.read(buffer)) != -1){ while ((b=in.read(buffer)) != -1){
out.write(buffer,0,b); //4.写到输出流(out)中 out.write(buffer,0,b); //4.写到输出流(out)中
} }
in.close();
out.flush(); out.flush();
out.close();
} catch (IOException e) { } catch (IOException e) {
log.error("下载Excel模板异常", e); log.error("下载Excel模板异常", e);
} }
......
...@@ -34,8 +34,7 @@ public class TikaUtils { ...@@ -34,8 +34,7 @@ public class TikaUtils {
public static String fileToTxt(File file) { public static String fileToTxt(File file) {
org.apache.tika.parser.Parser parser = new AutoDetectParser(); org.apache.tika.parser.Parser parser = new AutoDetectParser();
try { try (InputStream inputStream = new FileInputStream(file);) {
InputStream inputStream = new FileInputStream(file);
DefaultHandler handler = new BodyContentHandler(); DefaultHandler handler = new BodyContentHandler();
Metadata metadata = new Metadata(); Metadata metadata = new Metadata();
ParseContext parseContext = new ParseContext(); ParseContext parseContext = new ParseContext();
...@@ -45,7 +44,6 @@ public class TikaUtils { ...@@ -45,7 +44,6 @@ public class TikaUtils {
* for (String string : metadata.names()) { * for (String string : metadata.names()) {
* System.out.println(string+":"+metadata.get(string)); } * System.out.println(string+":"+metadata.get(string)); }
*/ */
inputStream.close();
return handler.toString(); return handler.toString();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -58,21 +56,15 @@ public class TikaUtils { ...@@ -58,21 +56,15 @@ public class TikaUtils {
ContentHandler handler = new ToHTMLContentHandler(); ContentHandler handler = new ToHTMLContentHandler();
AutoDetectParser parser = new AutoDetectParser(); AutoDetectParser parser = new AutoDetectParser();
Metadata metadata = new Metadata(); Metadata metadata = new Metadata();
InputStream stream = null; try (InputStream stream = new FileInputStream(new File(fileName))) {
try {
stream = new FileInputStream(new File(fileName));
parser.parse(stream, handler, metadata); parser.parse(stream, handler, metadata);
FileHelper.writeFile(handler.toString(), outPutFile + ".html"); FileHelper.writeFile(handler.toString(), outPutFile + ".html");
FileHelper.parse(outPutFile + ".html"); FileHelper.parse(outPutFile + ".html");
return null;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
} }
return null; return null;
} }
......
package com.yeejoin.amos.patrol.core.threadpool; package com.yeejoin.amos.patrol.core.threadpool;
import com.yeejoin.amos.patrol.business.constants.XJConstant; import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.trigger.TriggerKeyQueue;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -20,7 +21,7 @@ public class AmosThreadPool { ...@@ -20,7 +21,7 @@ public class AmosThreadPool {
/** /**
* 单例 * 单例
*/ */
private static AmosThreadPool instance; private static volatile AmosThreadPool instance;
/** /**
* 执行服务 * 执行服务
......
...@@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -209,14 +210,10 @@ public class FileController { ...@@ -209,14 +210,10 @@ public class FileController {
} else { } else {
processData = DocUtil.processDocx(data); processData = DocUtil.processDocx(data);
} }
String htmlContent = (String) processData.get("html"); String htmlContent = (String) processData.get("html");
try { try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(htmlFileName), StandardCharsets.UTF_8));) {
Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(htmlFileName), "UTF-8"));
writer.write(htmlContent); writer.write(htmlContent);
writer.flush(); writer.flush();
writer.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -17,7 +17,7 @@ public class TriggerKeyQueue { ...@@ -17,7 +17,7 @@ public class TriggerKeyQueue {
/** /**
* 单例 * 单例
*/ */
private static TriggerKeyQueue instance; private static volatile TriggerKeyQueue instance;
/** /**
* 队列 * 队列
......
...@@ -39,6 +39,7 @@ import java.net.URLEncoder; ...@@ -39,6 +39,7 @@ 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.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
...@@ -63,11 +64,8 @@ public class FileHelper { ...@@ -63,11 +64,8 @@ public class FileHelper {
* @return * @return
*/ */
public static boolean isExcel2003(File file) { public static boolean isExcel2003(File file) {
InputStream is = null; try (InputStream is = new FileInputStream(file);
Workbook wb = null; Workbook wb = WorkbookFactory.create(is);) {
try {
is = new FileInputStream(file);
wb = WorkbookFactory.create(is);
if (wb instanceof XSSFWorkbook) { if (wb instanceof XSSFWorkbook) {
return false; return false;
} else if (wb instanceof HSSFWorkbook) { } else if (wb instanceof HSSFWorkbook) {
...@@ -75,17 +73,6 @@ public class FileHelper { ...@@ -75,17 +73,6 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
if (null != wb) {
wb.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
...@@ -96,20 +83,10 @@ public class FileHelper { ...@@ -96,20 +83,10 @@ public class FileHelper {
* @return * @return
*/ */
public static boolean isWord2003(File file) { public static boolean isWord2003(File file) {
InputStream is = null; try (InputStream is = new FileInputStream(file);
try { HWPFDocument hwpfDocument = new HWPFDocument(is);) {
is = new FileInputStream(file);
new HWPFDocument(is);
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} finally {
try {
if (null != is) {
is.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return true; return true;
} }
...@@ -168,34 +145,19 @@ public class FileHelper { ...@@ -168,34 +145,19 @@ public class FileHelper {
*/ */
public static StringBuffer readFile(String path) { public static StringBuffer readFile(String path) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
InputStream is = null; File file = new File(path);
BufferedReader br = null; if (file.exists()) {
try { try (InputStream is = new FileInputStream(file);
File file = new File(path); BufferedReader br = new BufferedReader(new InputStreamReader(is))) {
if (file.exists()) {
is = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(is));
String content = br.readLine(); String content = br.readLine();
while (null != content) { while (null != content) {
buffer.append(content); buffer.append(content);
content = br.readLine(); content = br.readLine();
} }
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
if (null != br) {
br.close();
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
return buffer; return buffer;
} }
...@@ -207,34 +169,19 @@ public class FileHelper { ...@@ -207,34 +169,19 @@ public class FileHelper {
*/ */
public static StringBuffer readFile(String path, String split) { public static StringBuffer readFile(String path, String split) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
InputStream is = null; File file = new File(path);
BufferedReader br = null; if (file.exists()) {
try { try (InputStream is = new FileInputStream(file);
File file = new File(path); BufferedReader br = new BufferedReader(new InputStreamReader(is))) {
if (file.exists()) {
is = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(is));
String content = br.readLine(); String content = br.readLine();
while (null != content) { while (null != content) {
buffer.append(content).append(split); buffer.append(content).append(split);
content = br.readLine(); content = br.readLine();
} }
} } catch (Exception exception) {
} catch (Exception exception) { exception.printStackTrace();
exception.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
if (null != br) {
br.close();
}
} catch (Exception exception2) {
exception2.printStackTrace();
} }
} }
return buffer; return buffer;
} }
...@@ -244,28 +191,15 @@ public class FileHelper { ...@@ -244,28 +191,15 @@ public class FileHelper {
* @param path 写入内容的文件路径 * @param path 写入内容的文件路径
*/ */
public static void writeFile(String content, String path) { public static void writeFile(String content, String path) {
OutputStream fos = null; File file = new File(path);
BufferedWriter bw = null; try (OutputStream fos = new FileOutputStream(file);
try { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos, StandardCharsets.UTF_8))) {
File file = new File(path);
if (!file.getParentFile().exists()) { if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
} }
fos = new FileOutputStream(file);
bw = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"));
bw.write(content); bw.write(content);
} catch (FileNotFoundException fnfe) { } catch (IOException fnfe) {
fnfe.printStackTrace(); fnfe.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
if (bw != null) {
bw.close();
}
} catch (IOException ioException) {
System.err.println(ioException.getMessage());
}
} }
} }
...@@ -354,11 +288,8 @@ public class FileHelper { ...@@ -354,11 +288,8 @@ public class FileHelper {
public static void rmrBlankLines(String inputFile, String outPutFile) throws IOException { public static void rmrBlankLines(String inputFile, String outPutFile) throws IOException {
File htmFile = new File(inputFile); File htmFile = new File(inputFile);
// 以GB2312读取文件 // 以GB2312读取文件
BufferedReader br = null; try (BufferedReader br = new BufferedReader(new FileReader(htmFile));
BufferedWriter bw = null; BufferedWriter bw = new BufferedWriter(new FileWriter(new File(outPutFile)));) {
try {
br = new BufferedReader(new FileReader(htmFile));
bw = new BufferedWriter(new FileWriter(new File(outPutFile)));
String result = null; String result = null;
while (null != (result = br.readLine())) { while (null != (result = br.readLine())) {
if (!"".equals(result.trim())) { if (!"".equals(result.trim())) {
...@@ -367,20 +298,7 @@ public class FileHelper { ...@@ -367,20 +298,7 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (null != br) {
br.close();
}
if (null != bw) {
bw.close();
}
} catch (Exception e) {
}
} }
} }
/** /**
...@@ -1253,38 +1171,31 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam ...@@ -1253,38 +1171,31 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
* @throws * @throws
*/ */
public static void getExcel(String url, String fileName, HttpServletResponse response,HttpServletRequest request){ public static void getExcel(String url, String fileName, HttpServletResponse response,HttpServletRequest request){
//通过文件路径获得File对象
try { File file = new File(url);
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型 response.setContentType("multipart/form-data");
response.setContentType("multipart/form-data"); //2.设置文件头:最后一个参数是设置下载文件名
try {
//2.设置文件头:最后一个参数是设置下载文件名 response.setHeader("Content-disposition", "attachment; filename=\""
response.setHeader("Content-disposition", "attachment; filename=\"" + encodeChineseDownloadFileName(request, fileName+".xls") +"\"");
+ encodeChineseDownloadFileName(request, fileName+".xls") +"\""); } catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
try ( FileInputStream in = new FileInputStream(file);
OutputStream out = new BufferedOutputStream(response.getOutputStream());) {
// response.setHeader("Content-Disposition", "attachment;filename=" // response.setHeader("Content-Disposition", "attachment;filename="
// + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名 // + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名
//3.通过response获取OutputStream对象(out)
//通过文件路径获得File对象 int b = 0;
File file = new File(url); byte[] buffer = new byte[2048];
while ((b=in.read(buffer)) != -1){
FileInputStream in = new FileInputStream(file); out.write(buffer,0,b); //4.写到输出流(out)中
//3.通过response获取OutputStream对象(out)
OutputStream out = new BufferedOutputStream(response.getOutputStream());
int b = 0;
byte[] buffer = new byte[2048];
while ((b=in.read(buffer)) != -1){
out.write(buffer,0,b); //4.写到输出流(out)中
}
in.close();
out.flush();
out.close();
} catch (IOException e) {
log.error("下载Excel模板异常", e);
} }
out.flush();
} catch (IOException e) {
log.error("下载Excel模板异常", e);
}
} }
/** /**
......
...@@ -34,17 +34,12 @@ public class TikaUtils { ...@@ -34,17 +34,12 @@ public class TikaUtils {
public static String fileToTxt(File file) { public static String fileToTxt(File file) {
org.apache.tika.parser.Parser parser = new AutoDetectParser(); org.apache.tika.parser.Parser parser = new AutoDetectParser();
try { try(InputStream inputStream = new FileInputStream(file);) {
InputStream inputStream = new FileInputStream(file);
DefaultHandler handler = new BodyContentHandler(); DefaultHandler handler = new BodyContentHandler();
Metadata metadata = new Metadata(); Metadata metadata = new Metadata();
ParseContext parseContext = new ParseContext(); ParseContext parseContext = new ParseContext();
parseContext.set(Parser.class, parser); parseContext.set(Parser.class, parser);
parser.parse(inputStream, handler, metadata, parseContext); parser.parse(inputStream, handler, metadata, parseContext);
/*
* for (String string : metadata.names()) {
* System.out.println(string+":"+metadata.get(string)); }
*/
inputStream.close(); inputStream.close();
return handler.toString(); return handler.toString();
} catch (Exception e) { } catch (Exception e) {
...@@ -58,21 +53,14 @@ public class TikaUtils { ...@@ -58,21 +53,14 @@ public class TikaUtils {
ContentHandler handler = new ToHTMLContentHandler(); ContentHandler handler = new ToHTMLContentHandler();
AutoDetectParser parser = new AutoDetectParser(); AutoDetectParser parser = new AutoDetectParser();
Metadata metadata = new Metadata(); Metadata metadata = new Metadata();
InputStream stream = null; try ( InputStream stream = new FileInputStream(new File(fileName));) {
try {
stream = new FileInputStream(new File(fileName));
parser.parse(stream, handler, metadata); parser.parse(stream, handler, metadata);
FileHelper.writeFile(handler.toString(), outPutFile + ".html"); FileHelper.writeFile(handler.toString(), outPutFile + ".html");
FileHelper.parse(outPutFile + ".html"); FileHelper.parse(outPutFile + ".html");
return null; return null;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
} }
return null; return null;
} }
......
...@@ -20,7 +20,7 @@ public class AmosThreadPool { ...@@ -20,7 +20,7 @@ public class AmosThreadPool {
/** /**
* 单例 * 单例
*/ */
private static AmosThreadPool instance; private static volatile AmosThreadPool instance;
/** /**
* 执行服务 * 执行服务
......
...@@ -23,12 +23,8 @@ eureka.instance.prefer-ip-address = true ...@@ -23,12 +23,8 @@ eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone=http://${spring.security.user.name}:${spring.security.user.password}@172.16.10.215:10001/eureka/ eureka.client.serviceUrl.defaultZone=http://${spring.security.user.name}:${spring.security.user.password}@172.16.10.215:10001/eureka/
spring.security.user.name=admin spring.security.user.name=admin
spring.security.user.password=a1234560 spring.security.user.password=a1234560
#security config
#security.password=a1234560
#security.loginId=fas_system
security.productApp=STUDIO_APP_MOBILE security.productApp=STUDIO_APP_MOBILE
#security.productWeb=STUDIO_APP_WEB
#security.appKeyApp=studio_normalapp_3056965
amos.system.user.user-name=fas_system amos.system.user.user-name=fas_system
...@@ -113,13 +109,14 @@ isSendIot=false ...@@ -113,13 +109,14 @@ isSendIot=false
equipment.scrap.day=30 equipment.scrap.day=30
#提醒时间 #提醒时间
equipment.scrap.cron=0 0 9 * * ? equipment.scrap.cron=0 0 9 * * ?
#?????????????
equipment.pressurepump.start.cron=0 0 0 * * ?
# 稳压泵启动信号 # 稳压泵启动信号
equipment.pressurepump.start=FHS_PressurePump_Start equipment.pressurepump.start=FHS_PressurePump_Start
# 稳压泵管网压力信号 # 稳压泵管网压力信号
equipment.pressurepump.pipepressure=FHS_PipePressureDetector_PipePressure equipment.pressurepump.pipepressure=FHS_PipePressureDetector_PipePressure
# 站端标识 # 站端标识
state.code=GW190301 state.code=GW190301
......
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://172.16.11.20:3306/autosys_business_v3.0.0.2?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai spring.datasource.url = jdbc:mysql://172.16.10.215:3307/dl_business_v3.0.1.3?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username= root spring.datasource.username=root
spring.datasource.password= root_123 spring.datasource.password=Yeejoin@2020
spring.datasource.type=com.zaxxer.hikari.HikariDataSource spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.pool-name=DatebookHikariCP spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.minimum-idle= 3 spring.datasource.hikari.minimum-idle= 3
spring.datasource.hikari.maximum-pool-size= 30 spring.datasource.hikari.maximum-pool-size= 30
spring.datasource.hikari.auto-commit= true spring.datasource.hikari.auto-commit= true
spring.datasource.hikari.idle-timeout= 10000 spring.datasource.hikari.idle-timeout= 500000
spring.datasource.hikari.max-lifetime= 1800000 spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 30000 spring.datasource.hikari.connection-timeout= 60000
spring.datasource.hikari.connection-test-query= SELECT 1 spring.datasource.hikari.connection-test-query= SELECT 1
eureka.instance.hostname= 172.16.11.20
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
#security config # \u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
#security.password=a1234560 fileserver_domain=http://172.16.10.215:9000/
#security.loginId=fas_system
#eureka.instance.ip-address= 172.16.3.135
eureka.instance.hostname= 172.16.10.215
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone=http://${spring.security.user.name}:${spring.security.user.password}@172.16.10.215:10001/eureka/
spring.security.user.name=admin
spring.security.user.password=a1234560
security.productApp=STUDIO_APP_MOBILE security.productApp=STUDIO_APP_MOBILE
#security.productWeb=STUDIO_APP_WEB
#security.appKeyApp=studio_normalapp_3056965
amos.system.user.user-name=fas_system amos.system.user.user-name=fas_system
amos.system.user.password=a1234560 amos.system.user.password=a1234560
amos.system.user.app-key=studio_normalapp_3056965 amos.system.user.app-key=studio_normalapp_3056965
amos.system.user.product=STUDIO_APP_WEB amos.system.user.product=STUDIO_APP_WEB
#redis #redis
spring.redis.database=1 spring.redis.database=1
spring.redis.host=172.16.11.20 spring.redis.host=172.16.10.215
spring.redis.port=6379 spring.redis.port=6379
spring.redis.password=1234560 spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200 spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1 spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0 spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=30000
## emqx ## emqx
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.33:1883 emqx.broker=tcp://172.16.10.215:1883
emqx.user-name=admin emqx.user-name=admin
emqx.password=public emqx.password=public
mqtt.scene.host=mqtt://172.16.11.33:8083/mqtt mqtt.scene.host=mqtt://172.16.10.215:8083/mqtt
mqtt.client.product.id=mqtt mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000 spring.mqtt.completionTimeout=3000
#定时任务
##物联报表定时任务
jobs.month.cron = 0 50 0 1 * ?
jobs.day.cron = 0 5 0 * * ?
jobs.week.cron = 0 25 0 ? * 1
jobs.day.cron.old = 0 25 0 * * ?
#数据同步开关 #数据同步开关
systemctl.sync.switch=false systemctl.sync.switch=false
#数据JCS开关 #数据JCS开关
...@@ -71,9 +82,49 @@ param.system.online.date = 2019-02-12 ...@@ -71,9 +82,49 @@ param.system.online.date = 2019-02-12
# 视频转码服务开关 hls(关)/flv(开),默认关闭,数字换流站使用时开启 # 视频转码服务开关 hls(关)/flv(开),默认关闭,数字换流站使用时开启
window.vedioFormat = hls window.vedioFormat = hls
window.vedioFormat.video = flv
# 航天视频服务地址 # 航天视频服务地址
param.htvideo.url=""; param.htvideo.url=http://192.168.4.174:9001;
# 南瑞视频转码服务地址 # 南瑞视频转码服务地址
param.nrvideo.url=""; param.nrvideo.url=http://198.87.103.158:8001;
#南瑞视频平台通过视频id获取flv格式视频播放地址 #南瑞视频平台通过视频id获取flv格式视频播放地址
param.nrflvbyvoideoid.url=http://192.168.4.159:10010/api/media/live param.nrflvbyvoideoid.url=http://192.168.4.159:10010/api/media/live
# 预案消防炮、消防泵设备维度类型
equipment.plan.monitor=92030200,92032200
equipment.plan.pump=92010600,92030600,92130400,92140200,92150300
# 机场使用特殊配置iotCode前缀,装备、车辆及导入使用到
# 机场使用
#iot.code.prefix.have.used=20210003,20210004,20210005
# 电力使用
iot.code.prefix.have.used=
#装备服务在接收到站端iot推送的装备数据后进行influxdb存库
#1.在装备接口消息处向influxdb/{productKey}/{deviceName} 消息地址推送数据,iot负责存库
#2.配置文件添加配置项开关,默认为关闭,该功能只使用于中心及系统
#是否向iot推送消息
isSendIot=false
#报废前30日 发起提醒
equipment.scrap.day=30
#提醒时间
equipment.scrap.cron=0 0 9 * * ?
# 稳压泵启动信号
equipment.pressurepump.start=FHS_PressurePump_Start
# 稳压泵管网压力信号
equipment.pressurepump.pipepressure=FHS_PipePressureDetector_PipePressure
# 站端标识
state.code=GW190301
state.name=\u9526\u5c4f\u6362\u6d41\u7ad9
#用于总部系统与站端系统逻辑区分,站端写zd总部默认为空
system.type=zd
# 是否开启遥测数据上报
is.open.telemetering=false
# 水池液位相关信号
water.level.indexKey=FHS_FirePoolDevice_WaterLevel,FHS_LevelDetector_WaterLevel,FHS_WirelessliquidDetector_WaterLevel,CAFS_FoamTank_FoamTankLevel,CAFS_WaterTank_WaterTankLevel
\ No newline at end of file
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://172.16.10.66:3306/safety-business-3.0.1?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai spring.datasource.url = jdbc:mysql://172.16.10.215:3307/dl_business_v3.0.1.3?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username= root spring.datasource.username=root
spring.datasource.password= root_123 spring.datasource.password=Yeejoin@2020
spring.datasource.type=com.zaxxer.hikari.HikariDataSource spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.pool-name=DatebookHikariCP spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.minimum-idle= 3 spring.datasource.hikari.minimum-idle= 3
spring.datasource.hikari.maximum-pool-size= 30 spring.datasource.hikari.maximum-pool-size= 30
spring.datasource.hikari.auto-commit= true spring.datasource.hikari.auto-commit= true
spring.datasource.hikari.idle-timeout= 10000 spring.datasource.hikari.idle-timeout= 500000
spring.datasource.hikari.max-lifetime= 1800000 spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 30000 spring.datasource.hikari.connection-timeout= 60000
spring.datasource.hikari.connection-test-query= SELECT 1 spring.datasource.hikari.connection-test-query= SELECT 1
fdfs.so-timeout=1501
fdfs.connect-timeout=601
fdfs.thumb-image.height=200
fdfs.thumb-image.width=200
fdfs.tracker-list[0]=39.98.246.31:22122
eureka.instance.hostname= 172.16.10.72 # \u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
eureka.instance.prefer-ip-address = true fileserver_domain=http://172.16.10.215:9000/
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
#eureka.instance.ip-address= 172.16.3.135
eureka.instance.hostname= 172.16.10.215
#security config eureka.instance.prefer-ip-address = true
#security.password=a1234560 eureka.client.serviceUrl.defaultZone=http://${spring.security.user.name}:${spring.security.user.password}@172.16.10.215:10001/eureka/
#security.loginId=fas_system spring.security.user.name=admin
spring.security.user.password=a1234560
security.productApp=STUDIO_APP_MOBILE security.productApp=STUDIO_APP_MOBILE
#security.productWeb=STUDIO_APP_WEB
#security.appKeyApp=studio_normalapp_3056965
amos.system.user.user-name=fas_system amos.system.user.user-name=fas_system
amos.system.user.password=a1234560 amos.system.user.password=a1234560
amos.system.user.app-key=studio_normalapp_3157169 amos.system.user.app-key=studio_normalapp_3056965
amos.system.user.product=STUDIO_APP_WEB amos.system.user.product=STUDIO_APP_WEB
#redis #redis
spring.redis.database=0
spring.redis.host=172.16.10.85
spring.redis.database=1
spring.redis.host=172.16.10.215
spring.redis.port=6379 spring.redis.port=6379
spring.redis.password=amos2019Redis spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200 spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1 spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0 spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=30000
mqtt.scene.host=mqtt://172.16.10.85:8083/mqtt ## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.215:1883
emqx.user-name=admin
emqx.password=public
mqtt.scene.host=mqtt://172.16.10.215:8083/mqtt
mqtt.client.product.id=mqtt mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000 spring.mqtt.completionTimeout=3000
## emqx #定时任务
emqx.clean-session=true ##物联报表定时任务
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} jobs.month.cron = 0 50 0 1 * ?
emqx.broker=tcp://172.16.10.85:1883 jobs.day.cron = 0 5 0 * * ?
emqx.user-name=super jobs.week.cron = 0 25 0 ? * 1
emqx.password=a123456 jobs.day.cron.old = 0 25 0 * * ?
#数据同步开关 #数据同步开关
systemctl.sync.switch=false systemctl.sync.switch=false
#数据JCS开关 #数据JCS开关
systemctl.jcs.switch=true systemctl.jcs.switch=false
#平台数据开关 #平台数据开关
systemctl.amos.switch=true systemctl.amos.switch=false
isSendApp=true isSendApp=false
#报表数据地址 #报表数据地址
equip.report.url=/fire-fighting-system/ureport/preview?_u=file: equip.report.url=/fire-fighting-system/ureport/preview?_u=file:
...@@ -78,9 +82,49 @@ param.system.online.date = 2019-02-12 ...@@ -78,9 +82,49 @@ param.system.online.date = 2019-02-12
# 视频转码服务开关 hls(关)/flv(开),默认关闭,数字换流站使用时开启 # 视频转码服务开关 hls(关)/flv(开),默认关闭,数字换流站使用时开启
window.vedioFormat = hls window.vedioFormat = hls
window.vedioFormat.video = flv
# 航天视频服务地址 # 航天视频服务地址
param.htvideo.url=""; param.htvideo.url=http://192.168.4.174:9001;
# 南瑞视频转码服务地址 # 南瑞视频转码服务地址
param.nrvideo.url=""; param.nrvideo.url=http://198.87.103.158:8001;
#南瑞视频平台通过视频id获取flv格式视频播放地址 #南瑞视频平台通过视频id获取flv格式视频播放地址
param.nrflvbyvoideoid.url=http://192.168.4.159:10010/api/media/live param.nrflvbyvoideoid.url=http://192.168.4.159:10010/api/media/live
# 预案消防炮、消防泵设备维度类型
equipment.plan.monitor=92030200,92032200
equipment.plan.pump=92010600,92030600,92130400,92140200,92150300
# 机场使用特殊配置iotCode前缀,装备、车辆及导入使用到
# 机场使用
#iot.code.prefix.have.used=20210003,20210004,20210005
# 电力使用
iot.code.prefix.have.used=
#装备服务在接收到站端iot推送的装备数据后进行influxdb存库
#1.在装备接口消息处向influxdb/{productKey}/{deviceName} 消息地址推送数据,iot负责存库
#2.配置文件添加配置项开关,默认为关闭,该功能只使用于中心及系统
#是否向iot推送消息
isSendIot=false
#报废前30日 发起提醒
equipment.scrap.day=30
#提醒时间
equipment.scrap.cron=0 0 9 * * ?
# 稳压泵启动信号
equipment.pressurepump.start=FHS_PressurePump_Start
# 稳压泵管网压力信号
equipment.pressurepump.pipepressure=FHS_PipePressureDetector_PipePressure
# 站端标识
state.code=GW190301
state.name=\u9526\u5c4f\u6362\u6d41\u7ad9
#用于总部系统与站端系统逻辑区分,站端写zd总部默认为空
system.type=zd
# 是否开启遥测数据上报
is.open.telemetering=false
# 水池液位相关信号
water.level.indexKey=FHS_FirePoolDevice_WaterLevel,FHS_LevelDetector_WaterLevel,FHS_WirelessliquidDetector_WaterLevel,CAFS_FoamTank_FoamTankLevel,CAFS_WaterTank_WaterTankLevel
\ No newline at end of file
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://172.16.11.20:3306/autosys_business_v3.0.0.2?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai spring.datasource.url = jdbc:mysql://172.16.10.215:3307/dl_business_v3.0.1.3?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username= root spring.datasource.username=root
spring.datasource.password= root_123 spring.datasource.password=Yeejoin@2020
spring.datasource.type=com.zaxxer.hikari.HikariDataSource spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.pool-name=DatebookHikariCP spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.minimum-idle= 3 spring.datasource.hikari.minimum-idle= 3
spring.datasource.hikari.maximum-pool-size= 30 spring.datasource.hikari.maximum-pool-size= 30
spring.datasource.hikari.auto-commit= true spring.datasource.hikari.auto-commit= true
spring.datasource.hikari.idle-timeout= 10000 spring.datasource.hikari.idle-timeout= 500000
spring.datasource.hikari.max-lifetime= 1800000 spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 30000 spring.datasource.hikari.connection-timeout= 60000
spring.datasource.hikari.connection-test-query= SELECT 1 spring.datasource.hikari.connection-test-query= SELECT 1
eureka.instance.hostname= 172.16.11.20
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
#security config # \u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
#security.password=a1234560 fileserver_domain=http://172.16.10.215:9000/
#security.loginId=fas_system
#eureka.instance.ip-address= 172.16.3.135
eureka.instance.hostname= 172.16.10.215
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone=http://${spring.security.user.name}:${spring.security.user.password}@172.16.10.215:10001/eureka/
spring.security.user.name=admin
spring.security.user.password=a1234560
security.productApp=STUDIO_APP_MOBILE security.productApp=STUDIO_APP_MOBILE
#security.productWeb=STUDIO_APP_WEB
#security.appKeyApp=studio_normalapp_3056965
amos.system.user.user-name=fas_system amos.system.user.user-name=fas_system
amos.system.user.password=a1234560 amos.system.user.password=a1234560
amos.system.user.app-key=studio_normalapp_3056965 amos.system.user.app-key=studio_normalapp_3056965
amos.system.user.product=STUDIO_APP_WEB amos.system.user.product=STUDIO_APP_WEB
#redis #redis
spring.redis.database=1 spring.redis.database=1
spring.redis.host=172.16.11.20 spring.redis.host=172.16.10.215
spring.redis.port=6379 spring.redis.port=6379
spring.redis.password=1234560 spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200 spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1 spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0 spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=30000
## emqx ## emqx
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.33:1883 emqx.broker=tcp://172.16.10.215:1883
emqx.user-name=admin emqx.user-name=admin
emqx.password=public emqx.password=public
mqtt.scene.host=mqtt://172.16.11.33:8083/mqtt mqtt.scene.host=mqtt://172.16.10.215:8083/mqtt
mqtt.client.product.id=mqtt mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000 spring.mqtt.completionTimeout=3000
#定时任务
##物联报表定时任务
jobs.month.cron = 0 50 0 1 * ?
jobs.day.cron = 0 5 0 * * ?
jobs.week.cron = 0 25 0 ? * 1
jobs.day.cron.old = 0 25 0 * * ?
#数据同步开关 #数据同步开关
systemctl.sync.switch=false systemctl.sync.switch=false
#数据JCS开关 #数据JCS开关
systemctl.jcs.switch=false systemctl.jcs.switch=false
#平台数据开关 #平台数据开关
systemctl.amos.switch=false systemctl.amos.switch=false
isSendApp=false
#报表数据地址 #报表数据地址
equip.report.url=/fire-fighting-system/ureport/preview?_u=file: equip.report.url=/fire-fighting-system/ureport/preview?_u=file:
...@@ -70,9 +82,49 @@ param.system.online.date = 2019-02-12 ...@@ -70,9 +82,49 @@ param.system.online.date = 2019-02-12
# 视频转码服务开关 hls(关)/flv(开),默认关闭,数字换流站使用时开启 # 视频转码服务开关 hls(关)/flv(开),默认关闭,数字换流站使用时开启
window.vedioFormat = hls window.vedioFormat = hls
window.vedioFormat.video = flv
# 航天视频服务地址 # 航天视频服务地址
param.htvideo.url=""; param.htvideo.url=http://192.168.4.174:9001;
# 南瑞视频转码服务地址 # 南瑞视频转码服务地址
param.nrvideo.url=""; param.nrvideo.url=http://198.87.103.158:8001;
#南瑞视频平台通过视频id获取flv格式视频播放地址 #南瑞视频平台通过视频id获取flv格式视频播放地址
param.nrflvbyvoideoid.url=http://192.168.4.159:10010/api/media/live param.nrflvbyvoideoid.url=http://192.168.4.159:10010/api/media/live
# 预案消防炮、消防泵设备维度类型
equipment.plan.monitor=92030200,92032200
equipment.plan.pump=92010600,92030600,92130400,92140200,92150300
# 机场使用特殊配置iotCode前缀,装备、车辆及导入使用到
# 机场使用
#iot.code.prefix.have.used=20210003,20210004,20210005
# 电力使用
iot.code.prefix.have.used=
#装备服务在接收到站端iot推送的装备数据后进行influxdb存库
#1.在装备接口消息处向influxdb/{productKey}/{deviceName} 消息地址推送数据,iot负责存库
#2.配置文件添加配置项开关,默认为关闭,该功能只使用于中心及系统
#是否向iot推送消息
isSendIot=false
#报废前30日 发起提醒
equipment.scrap.day=30
#提醒时间
equipment.scrap.cron=0 0 9 * * ?
# 稳压泵启动信号
equipment.pressurepump.start=FHS_PressurePump_Start
# 稳压泵管网压力信号
equipment.pressurepump.pipepressure=FHS_PipePressureDetector_PipePressure
# 站端标识
state.code=GW190301
state.name=\u9526\u5c4f\u6362\u6d41\u7ad9
#用于总部系统与站端系统逻辑区分,站端写zd总部默认为空
system.type=zd
# 是否开启遥测数据上报
is.open.telemetering=false
# 水池液位相关信号
water.level.indexKey=FHS_FirePoolDevice_WaterLevel,FHS_LevelDetector_WaterLevel,FHS_WirelessliquidDetector_WaterLevel,CAFS_FoamTank_FoamTankLevel,CAFS_WaterTank_WaterTankLevel
\ No newline at end of file
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