Commit 7256fc0f authored by KeYong's avatar KeYong

Merge branch 'develop_dl_bugfix' of…

Merge branch 'develop_dl_bugfix' of http://36.40.66.175:5000/station/YeeAmosFireAutoSysRoot into develop_dl_bugfix # Conflicts: # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/util/FileUtils.java # YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_fire_rectification.xml
parents e5e55dca 619349ea
package com.yeejoin.amos.fas.core.common.request;
import java.security.SecureRandom;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
......@@ -1071,8 +1072,10 @@ public class DateUtil {
{
;
}
long day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
return day;
if (null != date && null != mydate) {
return (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
}
return 0;
}
/**
......@@ -1115,7 +1118,7 @@ public class DateUtil {
*/
private static String getRandom(int i)
{
Random jjj = new Random();
SecureRandom jjj = new SecureRandom();
// int suiJiShu = jjj.nextInt(9);
if (i == 0) return "";
String jj = "";
......
......@@ -117,9 +117,17 @@ public class FileController extends BaseController {
ResponseUtils.renderText(response, "File not exists!");
return;
}
FileInputStream fis = new FileInputStream(file);
ResponseUtils.downFileByInputStream(file.getName(), fis, response, open);
IOUtils.closeQuietly(fis);
FileInputStream fis = null;
try {
fis = new FileInputStream(file);
ResponseUtils.downFileByInputStream(file.getName(), fis, response, open);
} catch (IOException e) {
} finally {
if (null != fis) {
fis.close();
}
}
}
@Permission
......@@ -228,14 +236,40 @@ public class FileController extends BaseController {
}
String htmlContent = (String) processData.get("html");
FileOutputStream fileOutputStream = null;
OutputStreamWriter outputStreamWriter = null;
Writer writer = null;
try {
Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(htmlFileName), "UTF-8"));
fileOutputStream = new FileOutputStream(htmlFileName);
outputStreamWriter = new OutputStreamWriter(fileOutputStream, "UTF-8");
writer = new BufferedWriter(outputStreamWriter);
writer.write(htmlContent);
writer.flush();
writer.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (null != writer) {
writer.close();
}
} catch (IOException e) {
e.printStackTrace();
}
try {
if (null != outputStreamWriter) {
outputStreamWriter.close();
}
} catch (IOException e) {
e.printStackTrace();
}
try {
if (null != fileOutputStream) {
fileOutputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
String filePath = obj.getString("file");
processData.put("html", "/" + filePath.substring(0, filePath.lastIndexOf(".")) + ".html");
......
......@@ -69,6 +69,8 @@ public class PlanVisual3dController extends BaseController {
if (testPlan != null) {
String path = testPlan.getFilePath();
if (path != null && !"".equals(path)) {
FileInputStream inputStream = null;
InputStream fis = null;
try {
// path是指欲下载的文件的路径。
File file = new File(fileUploadDir + path);
......@@ -79,26 +81,40 @@ public class PlanVisual3dController extends BaseController {
String ext = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase();
// 以流的形式下载文件。
InputStream fis = new BufferedInputStream(new FileInputStream(fileUploadDir + path));
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
fis.close();
// 清空response
inputStream = new FileInputStream(fileUploadDir + path);
if (null != inputStream) {
fis = new BufferedInputStream(inputStream);
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
// 清空response
// response.reset();
// 设置response的Header
response.addHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes()));
response.addHeader("Content-Length", "" + file.length());
response.setContentType("application/x-download");
OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
response.setContentType("application/octet-stream");
toClient.write(buffer);
toClient.flush();
toClient.close();
// 设置response的Header
response.addHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes()));
response.addHeader("Content-Length", "" + file.length());
response.setContentType("application/x-download");
OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
response.setContentType("application/octet-stream");
toClient.write(buffer);
toClient.flush();
toClient.close();
}
} else {
response.setStatus(404);
}
} catch (IOException ex) {
ex.printStackTrace();
} finally {
try {
if (null != inputStream) {
inputStream.close();
}
if (null != fis) {
fis.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
} else {
......
......@@ -35,6 +35,8 @@ public class WeatherController extends BaseController {
String result = "";
BufferedReader in = null;
BufferedReader responseReader = null;
InputStreamReader res = null;
try {
String urlNameString = weatherUrl + address;
URL realUrl = new URL(urlNameString);
......@@ -55,12 +57,13 @@ public class WeatherController extends BaseController {
StringBuffer sb = new StringBuffer();
String readLine = new String();
GZIPInputStream gZipS=new GZIPInputStream(connection.getInputStream());
InputStreamReader res = new InputStreamReader(gZipS,"UTF-8");
BufferedReader responseReader = new BufferedReader(res);
res = new InputStreamReader(gZipS,"UTF-8");
responseReader = new BufferedReader(res);
while ((readLine = responseReader.readLine()) != null) {
sb.append(readLine);
}
responseReader.close();
result = sb.toString();
System.out.println(result);
......@@ -75,6 +78,12 @@ public class WeatherController extends BaseController {
if (in != null) {
in.close();
}
if (null != responseReader) {
responseReader.close();
}
if (null != res) {
res.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
......
......@@ -161,9 +161,9 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
}
}
}
if (!CollectionUtils.isEmpty(map)) {
Integer total = Integer.parseInt(map.get("total").toString());
Integer count = Integer.parseInt(map.get("count").toString());
if (null != map &&!CollectionUtils.isEmpty(map)) {
Integer total = Integer.parseInt(map.getOrDefault("total", 0).toString());
Integer count = Integer.parseInt(map.getOrDefault("count", 0).toString());
if (SqlKeyWordEnum.AND.getKey().equalsIgnoreCase(type)) {
return total.equals(count);
} else if (SqlKeyWordEnum.OR.getKey().equalsIgnoreCase(type)) {
......
......@@ -325,7 +325,7 @@ public class EquipmentServiceImpl implements IEquipmentService {
if(date.isPresent()){
equipment2=date.get();
}
equipment.setCreateDate(equipment2.getCreateDate());
equipment.setCreateDate(null != equipment2 ? equipment2.getCreateDate() : new Date());
}
preplanPictureDao.saveAndFlush(pp);
......@@ -369,8 +369,7 @@ public class EquipmentServiceImpl implements IEquipmentService {
if(date.isPresent()){
equipment2=date.get();
}
equipment.setCreateDate(equipment2.getCreateDate() == null ? new Date() : equipment2.getCreateDate());
equipment.setCreateDate(null != equipment2 && null != equipment2.getCreateDate() ? equipment2.getCreateDate() : new Date());
}
} else {
equipment = save(equipment);
......@@ -382,7 +381,7 @@ public class EquipmentServiceImpl implements IEquipmentService {
equipment2=date.get();
}
equipment.setCreateDate(equipment2.getCreateDate() == null ? new Date() : equipment2.getCreateDate());
equipment.setCreateDate(null != equipment2 && null != equipment2.getCreateDate() ? equipment2.getCreateDate() : new Date());
}
Long equipmentId = Long.valueOf(equipment.getId());
for (int i = 0; i < imgs.length; i++) {
......
......@@ -210,13 +210,15 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setStatus(FasConstant.RISK_SOURCE_STATUS_NORMAL);
riskSource.setCreateDate(new Date());
} else {// 更新
riskSource.setCreateDate(oldRiskSource.getCreateDate());
riskSource.setFmeaList(oldRiskSource.getFmeaList());
riskSource.setIncrement(oldRiskSource.getIncrement());
riskSource.setRpn(oldRiskSource.getRpn());
riskSource.setRpnChangeLogList(oldRiskSource.getRpnChangeLogList());
riskSource.setRpni(oldRiskSource.getRpni());
riskSource.setStatus(oldRiskSource.getStatus());
if (null != oldRiskSource) {
riskSource.setCreateDate(oldRiskSource.getCreateDate());
riskSource.setFmeaList(oldRiskSource.getFmeaList());
riskSource.setIncrement(oldRiskSource.getIncrement());
riskSource.setRpn(oldRiskSource.getRpn());
riskSource.setRpnChangeLogList(oldRiskSource.getRpnChangeLogList());
riskSource.setRpni(oldRiskSource.getRpni());
riskSource.setStatus(oldRiskSource.getStatus());
}
}
iRiskSourceDao.saveAndFlush(riskSource);
return riskSource;
......
......@@ -97,14 +97,20 @@ public class DesUtil {
int[] tempBt;
int x, y, z;
tempBt = bt;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
if (null != secondKeyBt) {
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
}
for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
if (null != thirdKeyBt) {
for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
}
}
encByte = tempBt;
} else {
......@@ -112,11 +118,15 @@ public class DesUtil {
int[] tempBt;
int x, y;
tempBt = bt;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
if (null != secondKeyBt) {
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
}
encByte = tempBt;
} else {
......@@ -124,8 +134,10 @@ public class DesUtil {
int[] tempBt;
int x = 0;
tempBt = bt;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
}
encByte = tempBt;
}
......@@ -144,14 +156,20 @@ public class DesUtil {
int[] tempBt;
int x, y, z;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
if (null != secondKeyBt) {
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
}
for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
if (null != thirdKeyBt) {
for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
}
}
encByte = tempBt;
} else {
......@@ -159,11 +177,15 @@ public class DesUtil {
int[] tempBt;
int x, y;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
if (null != secondKeyBt) {
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
}
encByte = tempBt;
} else {
......@@ -171,8 +193,10 @@ public class DesUtil {
int[] tempBt;
int x;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
}
encByte = tempBt;
}
......@@ -188,14 +212,20 @@ public class DesUtil {
int[] tempBt;
int x, y, z;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
if (null != secondKeyBt) {
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
}
for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
if (null != thirdKeyBt) {
for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
}
}
encByte = tempBt;
} else {
......@@ -203,11 +233,15 @@ public class DesUtil {
int[] tempBt;
int x, y;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
if (null != secondKeyBt) {
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
}
encByte = tempBt;
} else {
......@@ -215,8 +249,10 @@ public class DesUtil {
int[] tempBt;
int x;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
}
encByte = tempBt;
}
......@@ -267,14 +303,20 @@ public class DesUtil {
int[] tempBt;
int x, y, z;
tempBt = intByte;
for (x = thirdLength - 1; x >= 0; x--) {
tempBt = dec(tempBt, (int[]) thirdKeyBt.get(x));
if (null != thirdKeyBt) {
for (x = thirdLength - 1; x >= 0; x--) {
tempBt = dec(tempBt, (int[]) thirdKeyBt.get(x));
}
}
for (y = secondLength - 1; y >= 0; y--) {
tempBt = dec(tempBt, (int[]) secondKeyBt.get(y));
if (null != secondKeyBt) {
for (y = secondLength - 1; y >= 0; y--) {
tempBt = dec(tempBt, (int[]) secondKeyBt.get(y));
}
}
for (z = firstLength - 1; z >= 0; z--) {
tempBt = dec(tempBt, (int[]) firstKeyBt.get(z));
if (null != firstKeyBt) {
for (z = firstLength - 1; z >= 0; z--) {
tempBt = dec(tempBt, (int[]) firstKeyBt.get(z));
}
}
decByte = tempBt;
} else {
......@@ -282,11 +324,15 @@ public class DesUtil {
int[] tempBt;
int x, y, z;
tempBt = intByte;
for (x = secondLength - 1; x >= 0; x--) {
tempBt = dec(tempBt, (int[]) secondKeyBt.get(x));
if (null != secondKeyBt) {
for (x = secondLength - 1; x >= 0; x--) {
tempBt = dec(tempBt, (int[]) secondKeyBt.get(x));
}
}
for (y = firstLength - 1; y >= 0; y--) {
tempBt = dec(tempBt, (int[]) firstKeyBt.get(y));
if (null != firstKeyBt) {
for (y = firstLength - 1; y >= 0; y--) {
tempBt = dec(tempBt, (int[]) firstKeyBt.get(y));
}
}
decByte = tempBt;
} else {
......@@ -294,8 +340,10 @@ public class DesUtil {
int[] tempBt;
int x, y, z;
tempBt = intByte;
for (x = firstLength - 1; x >= 0; x--) {
tempBt = dec(tempBt, (int[]) firstKeyBt.get(x));
if (null != firstKeyBt) {
for (x = firstLength - 1; x >= 0; x--) {
tempBt = dec(tempBt, (int[]) firstKeyBt.get(x));
}
}
decByte = tempBt;
}
......
......@@ -267,13 +267,15 @@ public class FileHelper {
public static void writeFile(String content, String path) {
OutputStream fos = null;
BufferedWriter bw = null;
OutputStreamWriter outputStreamWriter = null;
try {
File file = new File(path);
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
fos = new FileOutputStream(file);
bw = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"));
outputStreamWriter = new OutputStreamWriter(fos, "UTF-8");
bw = new BufferedWriter(outputStreamWriter);
bw.write(content);
} catch (FileNotFoundException fnfe) {
fnfe.printStackTrace();
......@@ -281,11 +283,17 @@ public class FileHelper {
ioe.printStackTrace();
} finally {
try {
if (bw != null) {
if (null != bw) {
bw.close();
}
} catch (IOException ioException) {
System.err.println(ioException.getMessage());
if (null != fos) {
fos.close();
}
if (null != outputStreamWriter) {
outputStreamWriter.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
......@@ -377,9 +385,12 @@ public class FileHelper {
// 以GB2312读取文件
BufferedReader br = null;
BufferedWriter bw = null;
FileWriter fileWriter = null;
try {
br = new BufferedReader(new FileReader(htmFile));
bw = new BufferedWriter(new FileWriter(new File(outPutFile)));
FileReader fileReader = new FileReader(htmFile);
br = new BufferedReader(fileReader);
fileWriter = new FileWriter(new File(outPutFile));
bw = new BufferedWriter(fileWriter);
String result = null;
while (null != (result = br.readLine())) {
if (!"".equals(result.trim())) {
......@@ -393,11 +404,22 @@ public class FileHelper {
if (null != br) {
br.close();
}
} catch (Exception e) {
e.printStackTrace();
}
try {
if (null != bw) {
bw.close();
}
} catch (Exception e) {
e.printStackTrace();
}
try {
if (null != fileWriter) {
fileWriter.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
......@@ -578,37 +600,27 @@ public class FileHelper {
}
public static void nioTransferCopy(File source, File target) {
FileChannel in = null;
FileChannel out = null;
FileInputStream inStream = null;
FileOutputStream outStream = null;
try {
inStream = new FileInputStream(source);
outStream = new FileOutputStream(target);
in = inStream.getChannel();
out = outStream.getChannel();
try (
FileInputStream inStream = new FileInputStream(source);
FileOutputStream outStream = new FileOutputStream(target);
FileChannel in = inStream.getChannel();
FileChannel out = outStream.getChannel();
) {
in.transferTo(0, in.size(), out);
} catch (IOException e) {
e.printStackTrace();
} finally {
close(inStream);
close(in);
close(outStream);
close(out);
}
}
private static boolean nioBufferCopy(File source, File target) {
FileChannel in = null;
FileChannel out = null;
FileInputStream inStream = null;
FileOutputStream outStream = null;
try {
inStream = new FileInputStream(source);
outStream = new FileOutputStream(target);
in = inStream.getChannel();
out = outStream.getChannel();
try (
FileInputStream inStream = new FileInputStream(source);
FileOutputStream outStream = new FileOutputStream(target);
FileChannel in = inStream.getChannel();
FileChannel out = outStream.getChannel();
) {
ByteBuffer buffer = ByteBuffer.allocate(4096);
while (in.read(buffer) != -1) {
buffer.flip();
......@@ -618,22 +630,16 @@ public class FileHelper {
} catch (IOException e) {
e.printStackTrace();
return false;
} finally {
close(inStream);
close(in);
close(outStream);
close(out);
}
return true;
}
public static void customBufferStreamCopy(File source, File target) {
InputStream fis = null;
OutputStream fos = null;
try {
fis = new FileInputStream(source);
fos = new FileOutputStream(target);
try (
InputStream fis = new FileInputStream(source);
OutputStream fos = new FileOutputStream(target);
) {
byte[] buf = new byte[4096];
int i;
while ((i = fis.read(buf)) != -1) {
......@@ -641,9 +647,6 @@ public class FileHelper {
}
} catch (Exception e) {
e.printStackTrace();
} finally {
close(fis);
close(fos);
}
}
......@@ -1190,36 +1193,28 @@ public class FileHelper {
* @Title: getExcel
* @Description: 下载指定路径的Excel文件
*/
public static void getExcel(String url, String fileName, HttpServletResponse response, HttpServletRequest request) {
try {
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
response.setContentType("multipart/form-data");
//2.设置文件头:最后一个参数是设置下载文件名
response.setHeader("Content-disposition", "attachment; filename=\""
+ encodeChineseDownloadFileName(request, fileName + ".xls") + "\"");
// response.setHeader("Content-Disposition", "attachment;filename="
public static void getExcel(String url, String fileName, HttpServletResponse response, HttpServletRequest request) throws UnsupportedEncodingException {
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
response.setContentType("multipart/form-data");
//2.设置文件头:最后一个参数是设置下载文件名
response.setHeader("Content-disposition", "attachment; filename=\""
+ encodeChineseDownloadFileName(request, fileName + ".xls") + "\"");
// response.setHeader("Content-Disposition", "attachment;filename="
// + 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)
OutputStream out = new BufferedOutputStream(response.getOutputStream());
//通过文件路径获得File对象
try (
FileInputStream in = new FileInputStream(new File(url));
//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);
}
......
package com.yeejoin.amos.fas.business.util;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* 文件下载 工具类
*
* @author 郑嘉伟
* @since 2020-08-05
*/
public class FileUtils {
private static final Logger logger = LogManager.getLogger(FileUtils.class);
/**
* 获取压缩好zip——>设置消息头——>输出
* @param response
* @param list
* @param ipUrl
* @throws IOException
*/
public static void downloadZIP(HttpServletResponse response, List<String> list, String ipUrl) throws IOException {
//构建zip
String zipname = "单据相关附件.zip";
String zippath = fileToZip(list, zipname, ipUrl);
OutputStream out = null;
BufferedInputStream br = null;
try {
String fileName = new String(zipname.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1);
br = new BufferedInputStream(Files.newInputStream(Paths.get(zippath)));
byte[] buf = new byte[1024];
int len = 0;
response.reset();
response.setHeader("Content-Type", "application/octet-stream;charset=utf-8");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
response.setHeader("Access-Control-Expose-Headers", "access_token");
response.setHeader("Access-Control-Allow-Origin", "*");
response.setContentType("application/zip");
out = response.getOutputStream();
while ((len = br.read(buf)) > 0) {
out.write(buf, 0, len);
out.flush();
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
if (null != br) {
br.close();
}
if (null != out) {
out.close();
}
}
}
/**
* 通过文件服务器——>获取流——>输出——>压缩
*
* @param list
* @param fileName
* @return
*/
public static String fileToZip(List<String> list, String fileName, String ipUrl) {
if (StringUtils.isBlank(fileName)) {
throw new RuntimeException("文件名不能为空");
}
fileName = FilenameUtils.normalize(fileName);
// 临时目录
String tmpdir = System.getProperty("java.io.tmpdir");
if (StringUtils.isNotBlank(tmpdir) && !tmpdir.endsWith(File.separator)) {
tmpdir += File.separator;
} else if (StringUtils.isBlank(tmpdir)){
tmpdir = "";
}
String path = FilenameUtils.normalize(tmpdir + fileName);
File zipFile = new File(path);
zipFile.deleteOnExit();
try {
zipFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
try (
FileOutputStream fos = new FileOutputStream(zipFile);
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fos);
ZipOutputStream zos = new ZipOutputStream(bufferedOutputStream);
) {
byte[] bufs = new byte[1024 * 10];
for (String a : list) {
try (
InputStream fis = getInputStreamFromURL(ipUrl + a)
) {
assert fis != null;
try (BufferedInputStream bis = new BufferedInputStream(fis, 1024 * 10)
) {
String subFileName = new File(ipUrl + a).getName();
//创建ZIP实体,并添加进压缩包
ZipEntry zipEntry = new ZipEntry(subFileName);
zos.putNextEntry(zipEntry);
int read = 0;
while ((read = bis.read(bufs, 0, 1024 * 10)) != -1) {
zos.write(bufs, 0, read);
}
} catch (IOException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println("压缩成功");
} catch (FileNotFoundException e) {
e.printStackTrace();
throw new RuntimeException(e);
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
return path;
}
/**
* 从URL中读取图片,转换成流形式.
*
* @param destUrl
* @return
*/
public static InputStream getInputStreamFromURL(String destUrl) {
HttpURLConnection httpUrl = null;
URL url = null;
InputStream in = null;
try {
url = new URL(destUrl);
httpUrl = (HttpURLConnection) url.openConnection();
httpUrl.connect();
in = httpUrl.getInputStream();
return in;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
\ No newline at end of file
package com.yeejoin.amos.fas.business.util;
import java.security.SecureRandom;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
......@@ -12,7 +13,7 @@ public class RandomUtil {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String newDate = sdf.format(new Date());
String result = "";
Random random = new Random();
SecureRandom random = new SecureRandom();
for (int i = 0; i < 3; i++) {
result += random.nextInt(10);
}
......
......@@ -26,7 +26,7 @@ public class SSLClient extends DefaultHttpClient {
public SSLClient() throws Exception {
super();
//传输协议需要根据自己的判断
SSLContext ctx = SSLContext.getInstance("TLS");
SSLContext ctx = SSLContext.getInstance("TLSv1.2");
X509TrustManager tm = new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain,
......
......@@ -401,9 +401,11 @@ public static Time formatStrToTime(String strDate){
d = format.parse(str);
} catch (Exception e) {
e.printStackTrace();
}
Time date = new Time(d.getTime());
return date;
}
if (null != d) {
return new Time(d.getTime());
}
return null;
}
/**
......
......@@ -26,10 +26,15 @@ public class FileUtil {
if (!targetFile.exists()) {
targetFile.mkdirs();
}
FileOutputStream out = new FileOutputStream(filePath + fileName);
out.write(file);
out.flush();
out.close();
try (
FileOutputStream out = new FileOutputStream(filePath + fileName);
) {
out.write(file);
out.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
......
......@@ -41,19 +41,11 @@ public class MyImageExtractor implements IImageExtractor {
imagePath = s1 + pre + s2;
File imageFile = new File(baseDir, imagePath);
imageFile.getParentFile().mkdirs();
InputStream in = null;
OutputStream out = null;
try {
in = new ByteArrayInputStream(imageData);
out = new FileOutputStream(imageFile);
try (
InputStream in = new ByteArrayInputStream(imageData);
OutputStream out = new FileOutputStream(imageFile);
) {
IOUtils.copy(in, out);
} finally {
if (in != null) {
IOUtils.closeQuietly(in);
}
if (out != null) {
IOUtils.closeQuietly(out);
}
}
}
......
......@@ -17,7 +17,7 @@ import java.io.*;
/**
* 文档转换工具
*
*
* @date
* @author nihuanshan
*
......@@ -27,11 +27,11 @@ public class WordConverterUtils {
/**
* 图片存储相对文档路径
*/
private static String imgPath = "\\image\\";
private static String imgPath = File.separator + "image" + File.separator;
/**
* word文档转html文档
*
*
* @author: nihuanshan
* @date: 2018年12月6日 下午2:55:32
* @param srcFile 原文档
......@@ -51,7 +51,7 @@ public class WordConverterUtils {
}
}
}
/**
* word转html字符串
* @param srcFile
......@@ -70,7 +70,7 @@ public class WordConverterUtils {
/**
* .doc文档转换成html
*
*
* @author: nihuanshan
* @date: 2018年12月6日 下午2:53:43
* @param srcFile
......@@ -78,7 +78,10 @@ public class WordConverterUtils {
* @param readUrl html中img标签的图片存储路径
*/
private static void docToHtml(File srcFile, File targetFile, String readUrl) {
try {
try (
FileInputStream inputStream = new FileInputStream(srcFile);
HWPFDocument wordDocument = new HWPFDocument(inputStream);
) {
String imagePathStr = srcFile.getParentFile().getAbsolutePath() + imgPath;
File imagePath = new File(imagePathStr);
if (!imagePath.exists()) {
......@@ -86,13 +89,14 @@ public class WordConverterUtils {
}
String srcName = srcFile.getName();
String suffix = srcName.substring(0, srcName.lastIndexOf(".")) + "_";
HWPFDocument wordDocument = new HWPFDocument(new FileInputStream(srcFile));
org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document);
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
wordToHtmlConverter.setPicturesManager((content, pictureType, name, width, height) -> {
try {
FileOutputStream out = new FileOutputStream(imagePathStr + suffix + name);
try (
FileOutputStream out = new FileOutputStream(imagePathStr + suffix + name);
) {
out.write(content);
return uri + suffix + name;
} catch (Exception e) {
......@@ -116,7 +120,7 @@ public class WordConverterUtils {
}
}
/**
* doc转htmlString
* @param srcFile
......@@ -124,7 +128,10 @@ public class WordConverterUtils {
* @return
*/
private static String docToHtmlString(File srcFile, String readUrl) {
try {
try (
FileInputStream inputStream = new FileInputStream(srcFile);
HWPFDocument wordDocument = new HWPFDocument(inputStream);
) {
String imagePathStr = srcFile.getParentFile().getAbsolutePath() + imgPath;
File imagePath = new File(imagePathStr);
if (!imagePath.exists()) {
......@@ -132,7 +139,6 @@ public class WordConverterUtils {
}
String srcName = srcFile.getName();
String suffix = srcName.substring(0, srcName.lastIndexOf(".")) + "_";
HWPFDocument wordDocument = new HWPFDocument(new FileInputStream(srcFile));
org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document);
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
......@@ -159,7 +165,7 @@ public class WordConverterUtils {
serializer.setOutputProperty(OutputKeys.METHOD, "html");
serializer.transform(domSource, streamResult);
return stringWriter.toString();
} catch (Exception e) {
e.printStackTrace();
}
......@@ -183,34 +189,26 @@ public class WordConverterUtils {
}
String temp = srcFile.getName();
String suffix = temp.substring(0, temp.lastIndexOf(".")) + "_";
OutputStreamWriter outputStreamWriter = null;
try {
XWPFDocument document = new XWPFDocument(new FileInputStream(srcFile));
try (
FileInputStream inputStream = new FileInputStream(srcFile);
XWPFDocument document = new XWPFDocument(inputStream);
FileOutputStream fileOutputStream = new FileOutputStream(targetFile);
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, "utf-8");
) {
XHTMLOptions options = XHTMLOptions.create();
options.setExtractor(new MyImageExtractor(imagePath, suffix));
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
System.out.println("uri :" + uri);
options.URIResolver(new MyURIResolver(uri));
outputStreamWriter = new OutputStreamWriter(new FileOutputStream(targetFile), "utf-8");
XHTMLConverter xhtmlConverter = (XHTMLConverter) XHTMLConverter.getInstance();
xhtmlConverter.convert(document, outputStreamWriter, options);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (outputStreamWriter != null) {
outputStreamWriter.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
/**
*docx转htmlString
*docx转htmlString
* @param srcFile
* @param readUrl
* @return
......@@ -223,9 +221,11 @@ public class WordConverterUtils {
}
String temp = srcFile.getName();
String suffix = temp.substring(0, temp.lastIndexOf(".")) + "_";
OutputStreamWriter outputStreamWriter = null;
try {
XWPFDocument document = new XWPFDocument(new FileInputStream(srcFile));
try (
FileInputStream inputStream = new FileInputStream(srcFile);
XWPFDocument document = new XWPFDocument(inputStream);
)
{
XHTMLOptions options = XHTMLOptions.create();
options.setExtractor(new MyImageExtractor(imagePath, suffix));
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
......@@ -237,15 +237,6 @@ public class WordConverterUtils {
return stringWriter.toString();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (outputStreamWriter != null) {
outputStreamWriter.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
return null;
......
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hwpf.converter;
import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.HWPFDocumentCore;
import org.apache.poi.hwpf.converter.FontReplacer.Triplet;
import org.apache.poi.hwpf.usermodel.*;
import org.apache.poi.util.Beta;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
import org.apache.poi.util.XMLHelper;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.File;
import java.util.List;
import java.util.Stack;
import static org.apache.poi.hwpf.converter.AbstractWordUtils.TWIPS_PER_INCH;
/**
* Converts Word files (95-2007) into HTML files.
* <p>
* This implementation doesn't create images or links to them. This can be
* changed by overriding {@link #processImage(Element, boolean, Picture)}
* method.
*
* @author Sergey Vladimirov (vlsergey {at} gmail {dot} com)
*/
@Beta
public class WordToHtmlConverter extends AbstractWordConverter
{
/**
* Holds properties values, applied to current <tt>p</tt> element. Those
* properties shall not be doubled in children <tt>span</tt> elements.
*/
private static class BlockProperies
{
final String pFontName;
final int pFontSize;
public BlockProperies( String pFontName, int pFontSize )
{
this.pFontName = pFontName;
this.pFontSize = pFontSize;
}
}
private static final POILogger logger = POILogFactory
.getLogger( WordToHtmlConverter.class );
private static String getSectionStyle( Section section )
{
float leftMargin = section.getMarginLeft() / TWIPS_PER_INCH;
float rightMargin = section.getMarginRight() / TWIPS_PER_INCH;
float topMargin = section.getMarginTop() / TWIPS_PER_INCH;
float bottomMargin = section.getMarginBottom() / TWIPS_PER_INCH;
String style = "margin: " + topMargin + "in " + rightMargin + "in "
+ bottomMargin + "in " + leftMargin + "in;";
if ( section.getNumColumns() > 1 )
{
style += "column-count: " + ( section.getNumColumns() ) + ";";
if ( section.isColumnsEvenlySpaced() )
{
float distance = section.getDistanceBetweenColumns()
/ TWIPS_PER_INCH;
style += "column-gap: " + distance + "in;";
}
else
{
style += "column-gap: 0.25in;";
}
}
return style;
}
/**
* Java main() interface to interact with {@link WordToHtmlConverter}
*
* <p>
* Usage: WordToHtmlConverter infile outfile
* </p>
* Where infile is an input .doc file ( Word 95-2007) which will be rendered
* as HTML into outfile
*/
public static void main( String[] args ) throws Exception
{
if ( args.length < 2 )
{
System.err
.println( "Usage: WordToHtmlConverter <inputFile.doc> <saveTo.html>" );
return;
}
System.out.println( "Converting " + args[0] );
System.out.println( "Saving output to " + args[1] );
Document doc = WordToHtmlConverter.process( new File( args[0] ) );
DOMSource domSource = new DOMSource( doc );
StreamResult streamResult = new StreamResult( new File(args[1]) );
TransformerFactory tf = TransformerFactory.newInstance();
Transformer serializer = tf.newTransformer();
// TODO set encoding from a command argument
serializer.setOutputProperty( OutputKeys.ENCODING, "UTF-8" );
serializer.setOutputProperty( OutputKeys.INDENT, "yes" );
serializer.setOutputProperty( OutputKeys.METHOD, "html" );
serializer.transform( domSource, streamResult );
}
static Document process( File docFile ) throws Exception
{
final HWPFDocumentCore wordDocument = WordToHtmlUtils.loadDoc( docFile );
WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(
XMLHelper.getDocumentBuilderFactory().newDocumentBuilder()
.newDocument() );
wordToHtmlConverter.processDocument( wordDocument );
return wordToHtmlConverter.getDocument();
}
private final Stack<BlockProperies> blocksProperies = new Stack<BlockProperies>();
private final HtmlDocumentFacade htmlDocumentFacade;
private Element notes = null;
/**
* Creates new instance of {@link WordToHtmlConverter}. Can be used for
* output several {@link HWPFDocument}s into single HTML document.
*
* @param document
* XML DOM Document used as HTML document
*/
public WordToHtmlConverter(Document document )
{
this.htmlDocumentFacade = new HtmlDocumentFacade( document );
}
public WordToHtmlConverter(HtmlDocumentFacade htmlDocumentFacade )
{
this.htmlDocumentFacade = htmlDocumentFacade;
}
@Override
protected void afterProcess()
{
if ( notes != null )
htmlDocumentFacade.getBody().appendChild( notes );
htmlDocumentFacade.updateStylesheet();
}
public Document getDocument()
{
return htmlDocumentFacade.getDocument();
}
@Override
protected void outputCharacters( Element pElement,
CharacterRun characterRun, String text )
{
Element span = htmlDocumentFacade.document.createElement( "span" );
pElement.appendChild( span );
StringBuilder style = new StringBuilder();
BlockProperies blockProperies = this.blocksProperies.peek();
Triplet triplet = getCharacterRunTriplet( characterRun );
if ( WordToHtmlUtils.isNotEmpty( triplet.fontName )
&& !WordToHtmlUtils.equals( triplet.fontName,
blockProperies.pFontName ) )
{
style.append( "font-family:" + triplet.fontName + ";" );
}
if ( characterRun.getFontSize() / 2 != blockProperies.pFontSize )
{
style.append( "font-size:" + characterRun.getFontSize() / 2 + "pt;" );
}
if ( triplet.bold )
{
style.append( "font-weight:bold;" );
}
if ( triplet.italic )
{
style.append( "font-style:italic;" );
}
WordToHtmlUtils.addCharactersProperties( characterRun, style );
if ( style.length() != 0 )
htmlDocumentFacade.addStyleClass( span, "s", style.toString() );
Text textNode = htmlDocumentFacade.createText( text );
span.appendChild( textNode );
}
@Override
protected void processBookmarks( HWPFDocumentCore wordDocument,
Element currentBlock, Range range, int currentTableLevel,
List<Bookmark> rangeBookmarks )
{
Element parent = currentBlock;
for ( Bookmark bookmark : rangeBookmarks )
{
Element bookmarkElement = htmlDocumentFacade
.createBookmark( bookmark.getName() );
parent.appendChild( bookmarkElement );
parent = bookmarkElement;
}
if ( range != null )
processCharacters( wordDocument, currentTableLevel, range, parent );
}
@Override
protected void processDocumentInformation(
SummaryInformation summaryInformation )
{
if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getTitle() ) )
htmlDocumentFacade.setTitle( summaryInformation.getTitle() );
if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getAuthor() ) )
htmlDocumentFacade.addAuthor( summaryInformation.getAuthor() );
if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getKeywords() ) )
htmlDocumentFacade.addKeywords( summaryInformation.getKeywords() );
if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getComments() ) )
htmlDocumentFacade
.addDescription( summaryInformation.getComments() );
}
@Override
public void processDocumentPart( HWPFDocumentCore wordDocument, Range range )
{
super.processDocumentPart( wordDocument, range );
afterProcess();
}
@Override
protected void processDropDownList( Element block,
CharacterRun characterRun, String[] values, int defaultIndex )
{
Element select = htmlDocumentFacade.createSelect();
for ( int i = 0; i < values.length; i++ )
{
select.appendChild( htmlDocumentFacade.createOption( values[i],
defaultIndex == i ) );
}
block.appendChild( select );
}
@Override
protected void processDrawnObject( HWPFDocument doc,
CharacterRun characterRun, OfficeDrawing officeDrawing,
String path, Element block )
{
Element img = htmlDocumentFacade.createImage( path );
block.appendChild( img );
}
@Override
protected void processEndnoteAutonumbered( HWPFDocument wordDocument,
int noteIndex, Element block, Range endnoteTextRange )
{
processNoteAutonumbered( wordDocument, "end", noteIndex, block,
endnoteTextRange );
}
@Override
protected void processFootnoteAutonumbered( HWPFDocument wordDocument,
int noteIndex, Element block, Range footnoteTextRange )
{
processNoteAutonumbered( wordDocument, "foot", noteIndex, block,
footnoteTextRange );
}
@Override
protected void processHyperlink( HWPFDocumentCore wordDocument,
Element currentBlock, Range textRange, int currentTableLevel,
String hyperlink )
{
Element basicLink = htmlDocumentFacade.createHyperlink( hyperlink );
currentBlock.appendChild( basicLink );
if ( textRange != null )
processCharacters( wordDocument, currentTableLevel, textRange,
basicLink );
}
protected void processImage( Element currentBlock, boolean inlined,
Picture picture, String imageSourcePath )
{
final int aspectRatioX = picture.getHorizontalScalingFactor();
final int aspectRatioY = picture.getVerticalScalingFactor();
StringBuilder style = new StringBuilder();
final float imageWidth;
final float imageHeight;
final float cropTop;
final float cropBottom;
final float cropLeft;
final float cropRight;
if ( aspectRatioX > 0 )
{
imageWidth = picture.getDxaGoal() * aspectRatioX / 1000.f
/ TWIPS_PER_INCH;
cropRight = picture.getDxaCropRight() * aspectRatioX / 1000.f
/ TWIPS_PER_INCH;
cropLeft = picture.getDxaCropLeft() * aspectRatioX / 1000.f
/ TWIPS_PER_INCH;
}
else
{
imageWidth = picture.getDxaGoal() / TWIPS_PER_INCH;
cropRight = picture.getDxaCropRight() / TWIPS_PER_INCH;
cropLeft = picture.getDxaCropLeft() / TWIPS_PER_INCH;
}
if ( aspectRatioY > 0 )
{
imageHeight = picture.getDyaGoal() * aspectRatioY / 1000.f
/ TWIPS_PER_INCH;
cropTop = picture.getDyaCropTop() * aspectRatioY / 1000.f
/ TWIPS_PER_INCH;
cropBottom = picture.getDyaCropBottom() * aspectRatioY / 1000.f
/ TWIPS_PER_INCH;
}
else
{
imageHeight = picture.getDyaGoal() / TWIPS_PER_INCH;
cropTop = picture.getDyaCropTop() / TWIPS_PER_INCH;
cropBottom = picture.getDyaCropBottom() / TWIPS_PER_INCH;
}
Element root;
if ( cropTop != 0 || cropRight != 0 || cropBottom != 0 || cropLeft != 0 )
{
float visibleWidth = Math
.max( 0, imageWidth - cropLeft - cropRight );
float visibleHeight = Math.max( 0, imageHeight - cropTop
- cropBottom );
root = htmlDocumentFacade.createBlock();
htmlDocumentFacade.addStyleClass( root, "d",
"vertical-align:text-bottom;width:" + visibleWidth
+ "in;height:" + visibleHeight + "in;" );
// complex
Element inner = htmlDocumentFacade.createBlock();
htmlDocumentFacade.addStyleClass( inner, "d",
"position:relative;width:" + visibleWidth + "in;height:"
+ visibleHeight + "in;overflow:hidden;" );
root.appendChild( inner );
Element image = htmlDocumentFacade.createImage( imageSourcePath );
htmlDocumentFacade.addStyleClass( image, "i",
"position:absolute;left:-" + cropLeft + ";top:-" + cropTop
+ ";width:" + imageWidth + "in;height:"
+ imageHeight + "in;" );
inner.appendChild( image );
style.append( "overflow:hidden;" );
}
else
{
root = htmlDocumentFacade.createImage( imageSourcePath );
root.setAttribute( "style", "width:" + imageWidth + "in;height:"
+ imageHeight + "in;vertical-align:text-bottom;" );
}
currentBlock.appendChild( root );
}
@Override
protected void processImageWithoutPicturesManager( Element currentBlock,
boolean inlined, Picture picture )
{
// no default implementation -- skip
currentBlock.appendChild( htmlDocumentFacade.document
.createComment( "Image link to '"
+ picture.suggestFullFileName() + "' can be here" ) );
}
@Override
protected void processLineBreak( Element block, CharacterRun characterRun )
{
block.appendChild( htmlDocumentFacade.createLineBreak() );
}
protected void processNoteAutonumbered( HWPFDocument doc, String type,
int noteIndex, Element block, Range noteTextRange )
{
final String textIndex = String.valueOf( noteIndex + 1 );
final String textIndexClass = htmlDocumentFacade.getOrCreateCssClass(
"a", "vertical-align:super;font-size:smaller;" );
final String forwardNoteLink = type + "note_" + textIndex;
final String backwardNoteLink = type + "note_back_" + textIndex;
Element anchor = htmlDocumentFacade.createHyperlink( "#"
+ forwardNoteLink );
anchor.setAttribute( "name", backwardNoteLink );
anchor.setAttribute( "class", textIndexClass + " " + type
+ "noteanchor" );
anchor.setTextContent( textIndex );
block.appendChild( anchor );
if ( notes == null )
{
notes = htmlDocumentFacade.createBlock();
notes.setAttribute( "class", "notes" );
}
Element note = htmlDocumentFacade.createBlock();
note.setAttribute( "class", type + "note" );
notes.appendChild( note );
Element bookmark = htmlDocumentFacade.createBookmark( forwardNoteLink );
bookmark.setAttribute( "href", "#" + backwardNoteLink );
bookmark.setTextContent( textIndex );
bookmark.setAttribute( "class", textIndexClass + " " + type
+ "noteindex" );
note.appendChild( bookmark );
note.appendChild( htmlDocumentFacade.createText( " " ) );
Element span = htmlDocumentFacade.getDocument().createElement( "span" );
span.setAttribute( "class", type + "notetext" );
note.appendChild( span );
this.blocksProperies.add( new BlockProperies( "", -1 ) );
try
{
processCharacters( doc, Integer.MIN_VALUE, noteTextRange, span );
}
finally
{
this.blocksProperies.pop();
}
}
@Override
protected void processPageBreak( HWPFDocumentCore wordDocument, Element flow )
{
flow.appendChild( htmlDocumentFacade.createLineBreak() );
}
protected void processPageref( HWPFDocumentCore hwpfDocument,
Element currentBlock, Range textRange, int currentTableLevel,
String pageref )
{
Element basicLink = htmlDocumentFacade.createHyperlink( "#" + pageref );
currentBlock.appendChild( basicLink );
if ( textRange != null )
processCharacters( hwpfDocument, currentTableLevel, textRange,
basicLink );
}
protected void processParagraph( HWPFDocumentCore hwpfDocument,
Element parentElement, int currentTableLevel, Paragraph paragraph,
String bulletText )
{
final Element pElement = htmlDocumentFacade.createParagraph();
parentElement.appendChild( pElement );
StringBuilder style = new StringBuilder();
WordToHtmlUtils.addParagraphProperties( paragraph, style );
final int charRuns = paragraph.numCharacterRuns();
if ( charRuns == 0 )
{
return;
}
{
final String pFontName;
final int pFontSize;
final CharacterRun characterRun = paragraph.getCharacterRun( 0 );
if ( characterRun != null )
{
Triplet triplet = getCharacterRunTriplet( characterRun );
pFontSize = characterRun.getFontSize() / 2;
pFontName = triplet.fontName;
WordToHtmlUtils.addFontFamily( pFontName, style );
WordToHtmlUtils.addFontSize( pFontSize, style );
}
else
{
pFontSize = -1;
pFontName = WordToHtmlUtils.EMPTY;
}
blocksProperies.push( new BlockProperies( pFontName, pFontSize ) );
}
try
{
if ( WordToHtmlUtils.isNotEmpty( bulletText ) )
{
if ( bulletText.endsWith( "\t" ) )
{
/*
* We don't know how to handle all cases in HTML, but at
* least simplest case shall be handled
*/
final float defaultTab = TWIPS_PER_INCH / 2;
float firstLinePosition = paragraph.getIndentFromLeft()
+ paragraph.getFirstLineIndent() + 20; // char have
// some space
float nextStop = (float) ( Math.ceil( firstLinePosition
/ defaultTab ) * defaultTab );
final float spanMinWidth = nextStop - firstLinePosition;
Element span = htmlDocumentFacade.getDocument()
.createElement( "span" );
htmlDocumentFacade
.addStyleClass( span, "s",
"display: inline-block; text-indent: 0; min-width: "
+ ( spanMinWidth / TWIPS_PER_INCH )
+ "in;" );
pElement.appendChild( span );
Text textNode = htmlDocumentFacade.createText( bulletText
.substring( 0, bulletText.length() - 1 )
+ UNICODECHAR_ZERO_WIDTH_SPACE
+ UNICODECHAR_NO_BREAK_SPACE );
span.appendChild( textNode );
}
else
{
Text textNode = htmlDocumentFacade.createText( bulletText
.substring( 0, bulletText.length() - 1 ) );
pElement.appendChild( textNode );
}
}
processCharacters( hwpfDocument, currentTableLevel, paragraph,
pElement );
}
finally
{
blocksProperies.pop();
}
if ( style.length() > 0 )
htmlDocumentFacade.addStyleClass( pElement, "p", style.toString() );
if(paragraph.getStyleIndex()>0){
pElement.setAttribute("id", "p"+System.nanoTime()%100000000+"-"+paragraph.getStyleIndex());
}
WordToHtmlUtils.compactSpans( pElement );
return;
}
protected void processSection( HWPFDocumentCore wordDocument,
Section section, int sectionCounter )
{
Element div = htmlDocumentFacade.createBlock();
htmlDocumentFacade.addStyleClass( div, "d", getSectionStyle( section ) );
htmlDocumentFacade.body.appendChild( div );
processParagraphes( wordDocument, div, section, Integer.MIN_VALUE );
}
@Override
protected void processSingleSection( HWPFDocumentCore wordDocument,
Section section )
{
htmlDocumentFacade.addStyleClass( htmlDocumentFacade.body, "b",
getSectionStyle( section ) );
processParagraphes( wordDocument, htmlDocumentFacade.body, section,
Integer.MIN_VALUE );
}
protected void processTable( HWPFDocumentCore hwpfDocument, Element flow,
Table table )
{
Element tableHeader = htmlDocumentFacade.createTableHeader();
Element tableBody = htmlDocumentFacade.createTableBody();
final int[] tableCellEdges = WordToHtmlUtils
.buildTableCellEdgesArray( table );
final int tableRows = table.numRows();
int maxColumns = Integer.MIN_VALUE;
for ( int r = 0; r < tableRows; r++ )
{
maxColumns = Math.max( maxColumns, table.getRow( r ).numCells() );
}
for ( int r = 0; r < tableRows; r++ )
{
TableRow tableRow = table.getRow( r );
Element tableRowElement = htmlDocumentFacade.createTableRow();
StringBuilder tableRowStyle = new StringBuilder();
WordToHtmlUtils.addTableRowProperties( tableRow, tableRowStyle );
// index of current element in tableCellEdges[]
int currentEdgeIndex = 0;
final int rowCells = tableRow.numCells();
for ( int c = 0; c < rowCells; c++ )
{
TableCell tableCell = tableRow.getCell( c );
if ( tableCell.isVerticallyMerged()
&& !tableCell.isFirstVerticallyMerged() )
{
currentEdgeIndex += getNumberColumnsSpanned(
tableCellEdges, currentEdgeIndex, tableCell );
continue;
}
Element tableCellElement;
if ( tableRow.isTableHeader() )
{
tableCellElement = htmlDocumentFacade
.createTableHeaderCell();
}
else
{
tableCellElement = htmlDocumentFacade.createTableCell();
}
StringBuilder tableCellStyle = new StringBuilder();
WordToHtmlUtils.addTableCellProperties( tableRow, tableCell,
r == 0, r == tableRows - 1, c == 0, c == rowCells - 1,
tableCellStyle );
int colSpan = getNumberColumnsSpanned( tableCellEdges,
currentEdgeIndex, tableCell );
currentEdgeIndex += colSpan;
if ( colSpan == 0 )
continue;
if ( colSpan != 1 )
tableCellElement.setAttribute( "colspan",
String.valueOf( colSpan ) );
final int rowSpan = getNumberRowsSpanned( table,
tableCellEdges, r, c, tableCell );
if ( rowSpan > 1 )
tableCellElement.setAttribute( "rowspan",
String.valueOf( rowSpan ) );
processParagraphes( hwpfDocument, tableCellElement, tableCell,
table.getTableLevel() );
if ( !tableCellElement.hasChildNodes() )
{
tableCellElement.appendChild( htmlDocumentFacade
.createParagraph() );
}
if ( tableCellStyle.length() > 0 )
htmlDocumentFacade.addStyleClass( tableCellElement,
tableCellElement.getTagName(),
tableCellStyle.toString() );
tableRowElement.appendChild( tableCellElement );
}
if ( tableRowStyle.length() > 0 )
tableRowElement.setAttribute( "class", htmlDocumentFacade
.getOrCreateCssClass( "r", tableRowStyle.toString() ) );
if ( tableRow.isTableHeader() )
{
tableHeader.appendChild( tableRowElement );
}
else
{
tableBody.appendChild( tableRowElement );
}
}
final Element tableElement = htmlDocumentFacade.createTable();
tableElement
.setAttribute(
"class",
htmlDocumentFacade
.getOrCreateCssClass( "t",
"table-layout:fixed;border-collapse:collapse;border-spacing:0;" ) );
if ( tableHeader.hasChildNodes() )
{
tableElement.appendChild( tableHeader );
}
if ( tableBody.hasChildNodes() )
{
tableElement.appendChild( tableBody );
flow.appendChild( tableElement );
}
else
{
logger.log( POILogger.WARN, "Table without body starting at [",
Integer.valueOf( table.getStartOffset() ), "; ",
Integer.valueOf( table.getEndOffset() ), ")" );
}
}
}
......@@ -19,6 +19,7 @@ import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
......@@ -35,7 +36,7 @@ import com.yeejoin.amos.filter.CrossDomainFilter;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
*
*
* <pre>
* 服务启动类
* </pre>
......@@ -70,13 +71,15 @@ public class YeeAmosFireAutoSysStart implements ApplicationContextAware {
*/
public static void main(String[] args) {
log.info("start Service..........");
try {
SpringApplication application = new SpringApplication(YeeAmosFireAutoSysStart.class);
Environment environment = application.run(args).getEnvironment();
log.info("SwaggerUI: http://" + InetAddress.getLocalHost().getHostAddress() + ":" + environment.getProperty("server.port") + environment.getProperty("server.servlet.context-path") + "/swagger-ui.html");
} catch (Exception e) {
System.out.println("error occur when run server! " + e);
}
ApplicationContext context = SpringApplication.run(YeeAmosFireAutoSysStart.class, args);
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
log.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
/**
......@@ -90,7 +93,7 @@ public class YeeAmosFireAutoSysStart implements ApplicationContextAware {
}
/**
*
*
* <pre>
* 跨域处理的FilterBean
* </pre>
......
#DB properties:
spring.datasource.url = jdbc:mysql://172.16.11.201:3306/dl_business_v3.0.1.3_pyh_0510?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
spring.datasource.password=ENC(ymcOoS7xaghkc/E5jSK3Yi9Zz42LWTls9jVGpYgsRTqLxPpXfqkIXAtXHwCSPOcw)
spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver
spring.datasource.hikari.maxLifetime = 1765000
spring.datasource.hikari.maximum-pool-size = 10
......@@ -10,7 +10,7 @@ spring.datasource.validationQuery = SELECT 1
#\u7CFB\u7EDF\u670D\u52A1\u8D26\u53F7\uFF0C\u7528\u6237\u540E\u7AEF\u670D\u52A1\u8C03\u7528
amos.system.user.user-name=fas_autosys
amos.system.user.password=a1234560
amos.system.user.password=ENC(QDC3/GhtV5hj5GLxaVkYd1Sk3gFSlW1BWS7ieC2+FL56U9U9LV9BpcMBrhk7xFWM)
#\u5E94\u7528product appkey
amos.system.user.app-key=studio_normalapp_3056965
......@@ -29,7 +29,7 @@ eureka.instance.status-page-url-path=/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
spring.security.user.name=admin
spring.security.user.password=a1234560
spring.security.user.password=ENC(QDC3/GhtV5hj5GLxaVkYd1Sk3gFSlW1BWS7ieC2+FL56U9U9LV9BpcMBrhk7xFWM)
......@@ -40,7 +40,7 @@ spring.security.user.password=a1234560
spring.redis.database=1
spring.redis.host=172.16.11.201
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.password=ENC(u0Z/KZ7xhkx8sQj+mpBpE3EQJwCWR8JeRZSFQwnetsc4Bhswn2dDiqmUFGSiUM2x)
spring.redis.jedis.pool.max-active=200
spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=10
......@@ -58,7 +58,7 @@ emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.201:1883
emqx.client-user-name=admin
emqx.client-password=public
emqx.client-password=ENC(IWhwMSgko6moJ+JDuh5cq41ixOfhyyiaoRiOCw5Iv3f+YAO8Ib5KpWattlT6h57p)
emqx.max-inflight=1000
riskSourceService
#\u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
......
#DB properties:
spring.datasource.url = jdbc:mysql://172.16.11.201:3306/dl_business_v3.0.1.3?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
spring.datasource.password=ENC(HauNTLfKmT6iwEk9dxFRUucZvEzc7S648Wflgrom3lCGmm1YP0dnKds7jUF74fkH)
spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver
spring.datasource.hikari.maxLifetime = 1765000
spring.datasource.hikari.maximum-pool-size = 10
......@@ -10,7 +10,7 @@ spring.datasource.validationQuery = SELECT 1
#\u7CFB\u7EDF\u670D\u52A1\u8D26\u53F7\uFF0C\u7528\u6237\u540E\u7AEF\u670D\u52A1\u8C03\u7528
amos.system.user.user-name=fas_autosys
amos.system.user.password=a1234560
amos.system.user.password=ENC(dkh6A2t7bFXQHO1uR7R49d6p2nxEHjbxxEh1Rvzc88iAjx6OVRN7eh8hA0XmZecg)
#\u5E94\u7528product appkey
amos.system.user.app-key=studio_normalapp_3056965
......@@ -27,7 +27,7 @@ eureka.instance.prefer-ip-address=true
spring.redis.database=1
spring.redis.host=172.16.11.201
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.password=ENC(hb6Rn2N41E6vFwxZuwNhPHzZb5+ZvrbxBUjYPOiST8VYm3Ri1n5lH3bxADVZOs4m)
spring.redis.jedis.pool.max-active=200
spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=10
......@@ -45,7 +45,7 @@ emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.201:1883
emqx.user-name=admin
emqx.password=public
emqx.password=ENC(vlnMOpNNk7wWAcVgqh/C61LOajZY3f1XOFZEqcJ774SdtZeKnOCoNL3u4idRVr+S)
#\u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
file.downLoad.url=http://172.16.11.201:9000/
......
#DB properties:
spring.datasource.url = jdbc:mysql://172.16.11.201:3306/dl_business_v3.0.1.3?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
spring.datasource.password=ENC(+tRgnqfLe7fs+SbrhFCw1DlfsKfZcqVeJL1Qy/hnvD44o2xcLwZ+wyszup80n57p)
spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver
spring.datasource.hikari.maxLifetime = 1765000
spring.datasource.hikari.maximum-pool-size = 10
......@@ -10,7 +10,7 @@ spring.datasource.validationQuery = SELECT 1
#\u7CFB\u7EDF\u670D\u52A1\u8D26\u53F7\uFF0C\u7528\u6237\u540E\u7AEF\u670D\u52A1\u8C03\u7528
amos.system.user.user-name=fas_autosys
amos.system.user.password=a1234560
amos.system.user.password=ENC(IrXh5LXTKhcu0kC90lBN4nMLIhrTVxPcCOL2BsM3UVXn9yitiDZHQ8p4O1c3BS4z)
#\u5E94\u7528product appkey
amos.system.user.app-key=studio_normalapp_3056965
......@@ -27,7 +27,7 @@ eureka.instance.prefer-ip-address=true
spring.redis.database=1
spring.redis.host=172.16.11.201
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.password=ENC(OflloIPxMWWfgucq8aru16+lhCH0aZq9bmlW6zjjjDSiGy/yCE9HFu3Fe1D/6bpi)
spring.redis.jedis.pool.max-active=200
spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=10
......@@ -45,7 +45,7 @@ emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.201:1883
emqx.user-name=admin
emqx.password=public
emqx.password=ENC(JcSMTcnJjJsR/wlfW4MqxYnTVVxymsc7iZN3l+gRadRsplNeScSxFa3gbCv30oDt)
#\u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
file.downLoad.url=http://172.16.11.201:9000/
......
......@@ -4,7 +4,7 @@ server.port = 8085
#environment
spring.profiles.active=dev
#spring.freemarker.cache=false
#spring.freemarker.cache=false
spring.devtools.restart.enabled=true
spring.devtools.restart.additional-paths=src/main/java
spring.devtools.restart.exclude=WEB-INF/**
......@@ -91,7 +91,7 @@ data.type.fireMonitor=3103
outSystem.fegin.name=unKnow
outSystem.user.password=a1234560
outSystem.user.password=ENC(69BvVP221DPXcNRGhdAMYCm3nPJMSCDutwnqJoH+jfXDt5NXvvi9ajv0qFSpBtIg)
privilege.fegin.name=AMOS-API-PRIVILEGE
#\u9884\u6848\u6307\u6807\u914D\u7F6E
......
......@@ -25,7 +25,7 @@ CREATE TABLE `s_company` (
UNIQUE KEY `comp_code` (`comp_code`) USING BTREE,
UNIQUE KEY `comp_code_2` (`comp_code`) USING BTREE,
KEY `FK__s_company__s_site_id__38495279` (`site_id`) USING BTREE
) ENGINE=FEDERATED DEFAULT CHARSET=utf8 CONNECTION='mysql://root:admin_1234@172.16.11.33:3306/safety-precontrol_security_60/s_company';
) ENGINE=FEDERATED DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `s_department`;
CREATE TABLE `s_department` (
......@@ -42,7 +42,7 @@ CREATE TABLE `s_department` (
`is_delete` bit(1) NOT NULL COMMENT '是否删除:0表示未删除,1表示已删除',
PRIMARY KEY (`id`),
KEY `FK__s_departm__compa__74794A92` (`company_id`) USING BTREE
) ENGINE=FEDERATED DEFAULT CHARSET=utf8 CONNECTION='mysql://root:admin_1234@172.16.11.33:3306/safety-precontrol_security_60/s_department';
) ENGINE=FEDERATED DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `s_user`;
CREATE TABLE `s_user` (
......@@ -73,6 +73,6 @@ CREATE TABLE `s_user` (
KEY `FK__s_user__departme__7D0E9093` (`department_id`) USING BTREE,
KEY `FK__s_user__role_id__7E02B4CC` (`role_id`) USING BTREE,
KEY `FK__s_user__company___7C1A6C5A` (`company_id`) USING BTREE
) ENGINE=FEDERATED DEFAULT CHARSET=utf8 CONNECTION='mysql://root:admin_1234@172.16.11.33:3306/safety-precontrol_security_60/s_user';
) ENGINE=FEDERATED DEFAULT CHARSET=utf8;
......@@ -6,7 +6,7 @@
UPDATE
contingency_plan_instance
SET
runstate = ${runStatus}
runstate = #{runStatus}
<if test="content != null and content != ''">
, content = #{content}
</if>
......@@ -17,7 +17,7 @@
UPDATE
contingency_plan_instance
SET
runstate = ${runStatus}
runstate = #{runStatus}
<if test="content != null and content != ''">
, content = #{content}
</if>
......
......@@ -18,7 +18,7 @@
m.batch_no = #{batchNo}
</if>
<if test="stepIndex != null">
AND m.step_index = ${stepIndex}
AND m.step_index = #{stepIndex}
</if>
</where>
ORDER BY
......@@ -35,7 +35,7 @@
m.batch_no = #{batchNo}
</if>
<if test="stepIndex != null">
AND m.step_index = ${stepIndex}
AND m.step_index = #{stepIndex}
</if>
<if test="indexUpdateTime != null">
AND m.index_create_time = #{indexUpdateTime}
......
......@@ -13,19 +13,19 @@
WHERE
1=1
<if test="time!=null">
and TO_DAYS(m.time) = TO_DAYS('${time}')
and TO_DAYS(m.time) = TO_DAYS(#{time})
</if>
<if test="type!=null">
AND m.type = '${type}'
AND m.type = #{type}
</if>
<if test="title!=null">
AND m.title LIKE '%${title}%'
AND m.title LIKE CONCAT('%',#{title},'%')
</if>
<if test="orgCode!=null">
AND (
m.org_code = '${orgCode}'
OR m.org_code LIKE '${orgCode}*%'
m.org_code = #{orgCode}
OR m.org_code LIKE CONCAT('%',#{orgCode},'*%')
)
</if>
</select>
......@@ -39,22 +39,22 @@
WHERE
1=1
<if test="time!=null">
and TO_DAYS(m.time) = TO_DAYS('${time}')
and TO_DAYS(m.time) = TO_DAYS('#{time}')
</if>
<if test="type!=null">
AND m.type = '${type}'
AND m.type = #{type}
</if>
<if test="title!=null">
AND m.title LIKE '%${title}%'
AND m.title LIKE CONCAT('%',#{title},'%')
</if>
<if test="orgCode!=null">
AND (
m.org_code = '${orgCode}'
OR m.org_code LIKE '${orgCode}*%'
m.org_code = #{orgCode}
OR m.org_code LIKE CONCAT('%',#{orgCode},'%')
)
</if>
LIMIT ${start},${length} ;
LIMIT #{start},#{length} ;
</select>
......
......@@ -19,7 +19,7 @@
<!-- FROM-->
<!-- f_fire_station fs-->
<!-- WHERE-->
<!-- fs.id = ${id}-->
<!-- fs.id = #{id}-->
<!-- </select>-->
......@@ -30,7 +30,7 @@
<!-- f_fire_station_equipment fs-->
<!-- JOIN f_fire_equipment f ON fs.fire_equipment_id = f.id-->
<!-- WHERE-->
<!-- fs.fire_station_id = ${fireStationId}-->
<!-- fs.fire_station_id = #{fireStationId}-->
<!-- </select>-->
<!-- <select id="queryForFireEqumntPage" resultType="java.util.Map">-->
<!-- SELECT-->
......@@ -44,9 +44,9 @@
<!-- left join f_fire_equipment f ON fs.fire_equipment_id = f.id-->
<!-- left join f_risk_source frs on frs.id = f.risk_source_id-->
<!-- WHERE-->
<!-- fs.fire_station_id = ${fireStationId}-->
<!-- fs.fire_station_id = #{fireStationId}-->
<!-- and f.id is not null-->
<!-- LIMIT ${start}, ${length};-->
<!-- LIMIT #{start}, #{length};-->
<!-- </select>-->
<!-- <select id="queryCountForPage" resultType="long">-->
......@@ -58,13 +58,13 @@
<!-- WHERE-->
<!-- 1=1-->
<!-- <if test="name!=null">-->
<!-- AND (fs.name LIKE '%${name}%' or fs.`code` LIKE '%${name}%')-->
<!-- AND (fs.name LIKE '%#{name}%' or fs.`code` LIKE '%#{name}%')-->
<!-- </if>-->
<!-- <if test="code!=null">-->
<!-- AND fs.`code` LIKE '%${code}%'-->
<!-- AND fs.`code` LIKE '%#{code}%'-->
<!-- </if>-->
<!-- <if test="type!=null">-->
<!-- AND fs.`type` LIKE '%${type}%';-->
<!-- AND fs.`type` LIKE '%#{type}%';-->
<!-- </if>-->
<!-- </select>-->
<!-- <select id="queryForPage" resultType="java.util.Map">-->
......@@ -85,15 +85,15 @@
<!-- 1=1-->
<!-- <if test="name!=null">-->
<!-- AND (fs.name LIKE '%${name}%' or fs.`code` LIKE '%${name}%')-->
<!-- AND (fs.name LIKE '%#{name}%' or fs.`code` LIKE '%#{name}%')-->
<!-- </if>-->
<!-- <if test="code!=null">-->
<!-- AND fs.`code` LIKE '%${code}%'-->
<!-- AND fs.`code` LIKE '%#{code}%'-->
<!-- </if>-->
<!-- <if test="type!=null">-->
<!-- AND fs.`type` LIKE '%${type}%'-->
<!-- AND fs.`type` LIKE '%#{type}%'-->
<!-- </if>-->
<!-- LIMIT ${start},${length} ;-->
<!-- LIMIT #{start},#{length} ;-->
<!-- </select>-->
......@@ -126,14 +126,14 @@
a.instance_id
) s
<if test="name!=null">
AND s.name LIKE '%${name}%'
AND s.name LIKE CONCAT('%',#{name},'%')
</if>
<if test="code!=null">
AND s.`code` LIKE '%${code}%'
AND s.`code` LIKE CONCAT('%',#{code},'%')
</if>
<if test="type!=null">
AND s.`type` LIKE '%${type}%';
AND s.`type` LIKE CONCAT('%',#{type},'%');
</if>
</select>
......
......@@ -139,10 +139,10 @@
) d
<where>
<if test="fireEquipmentName!=null">
AND d.fireEquipmentName LIKE '%${fireEquipmentName}%'
AND d.fireEquipmentName LIKE CONCAT('%',#{fireEquipmentName},'%')
</if>
<if test="equipmentName!=null">
AND d.equipmentName LIKE '%${equipmentName}%'
AND d.equipmentName LIKE CONCAT('%',#{equipmentName},'%')
</if>
<if test="startTime != null and startTime != ''">
AND d.update_date &gt;= #{startTime}
......@@ -194,10 +194,10 @@
) d
<where>
<if test="fireEquipmentName!=null">
AND d.fireEquipmentName LIKE '%${fireEquipmentName}%'
AND d.fireEquipmentName LIKE CONCAT('%',#{fireEquipmentName},'%')
</if>
<if test="equipmentName!=null">
AND d.equipmentName LIKE '%${equipmentName}%'
AND d.equipmentName LIKE CONCAT('%',#{equipmentName},'%')
</if>
<if test="startTime != null and startTime != ''">
AND d.create_date &gt;= #{startTime}
......@@ -207,7 +207,7 @@
</if>
</where>
ORDER BY d.create_date desc
LIMIT ${start},${length}
LIMIT #{start},#{length}
</select>
......@@ -218,14 +218,14 @@
<!-- where-->
<!-- 1=1-->
<!-- <if test="equipClassify!=null">-->
<!-- and fe.equip_classify in ( ${equipClassify} )-->
<!-- and fe.equip_classify in ( #{equipClassify} )-->
<!-- </if>-->
<!-- <if test="code!=null">-->
<!-- and fe.`code` like '%${code}%'-->
<!-- and fe.`code` like '%#{code}%'-->
<!-- </if>-->
<!-- <if test="name!=null">-->
<!-- and (fe.`name` like '%${name}%' or fe.`code` like '%${name}%')-->
<!-- and (fe.`name` like '%#{name}%' or fe.`code` like '%#{name}%')-->
<!-- </if>-->
<!-- &lt;!&ndash; 筛选未绑定的配套设施-->
<!-- &ndash;&gt;-->
......@@ -258,14 +258,14 @@
<!-- where 1=1) tmp-->
<!-- <where>-->
<!-- <if test="equipClassify!=null">-->
<!-- and tmp.equip_classify in ( ${equipClassify} )-->
<!-- and tmp.equip_classify in ( #{equipClassify} )-->
<!-- </if>-->
<!-- <if test="code!=null">-->
<!-- and tmp.`code` like '%${code}%'-->
<!-- and tmp.`code` like '%#{code}%'-->
<!-- </if>-->
<!-- <if test="name!=null">-->
<!-- and (tmp.`name` like '%${name}%' or tmp.`code` like '%${name}%')-->
<!-- and (tmp.`name` like '%#{name}%' or tmp.`code` like '%#{name}%')-->
<!-- </if>-->
<!-- &lt;!&ndash; 筛选未绑定的配套设施-->
<!-- &ndash;&gt;-->
......@@ -273,7 +273,7 @@
<!-- AND tmp.bindStation is not true-->
<!-- </if>-->
<!-- </where>-->
<!-- LIMIT ${start},${length}-->
<!-- LIMIT #{start},#{length}-->
<!-- </select>-->
......@@ -291,7 +291,7 @@
<!-- FROM-->
<!-- f_fire_station_equipment se-->
<!-- WHERE-->
<!-- se.fire_station_id = ${fireStationId}-->
<!-- se.fire_station_id = #{fireStationId}-->
<!-- AND se.fire_equipment_id = fe.id-->
<!-- )-->
<!-- </select>-->
......@@ -507,12 +507,12 @@
f_equipment_fire_equipment efe
JOIN f_fire_equipment fe ON efe.fire_equipment_id = fe.id
WHERE
efe.equipment_id = ${equipmentId}
efe.equipment_id = #{equipmentId}
<if test="fname != null">
AND fe.`name` like '%${fname}%'
AND fe.`name` like CONCAT('%',#{fname},'%')
</if>
<if test="length > 0">
LIMIT ${start},${length} ;
LIMIT #{start},#{length} ;
</if>
</select>
......@@ -525,9 +525,9 @@
f_equipment_fire_equipment efe
JOIN wl_equipment_specific fe ON efe.fire_equipment_id = fe.id
WHERE
efe.equipment_id = ${equipmentId}
efe.equipment_id = #{equipmentId}
<if test="fname != null">
AND fe.`name` like '%${fname}%'
AND fe.`name` like CONCAT('%',#{fname},'%')
</if>
</select>
......
......@@ -149,7 +149,6 @@
<!-- HANDLE_STATE =#{doneResult} ,-->
<!-- FILE_PATH =#{filePath}-->
<!-- where SEQUENCE_NBR = #{req}-->
<!-- </update>-->
<!-- <update id="updateDanger">-->
<!-- UPDATE-->
......
......@@ -90,7 +90,7 @@
FROM
f_fmea f
WHERE
f.risk_source_id = ${riskSourceId};
f.risk_source_id = #{riskSourceId};
</select>
<select id="getById" resultType="com.yeejoin.amos.fas.dao.entity.Fmea">
......
......@@ -14,11 +14,11 @@
WHERE
1=1
<if test="fireEquipmentId != null">
and t.fire_equipment_id = ${fireEquipmentId}
and t.fire_equipment_id = #{fireEquipmentId}
</if>
<if test="equipmentId != null">
AND t.equipment_id = ${equipmentId};
AND t.equipment_id = #{equipmentId};
</if>
</select>
......@@ -29,8 +29,8 @@
FROM
f_equipment_fire_equipment t
WHERE
t.fire_equipment_id = ${fireEquipmentId}
AND t.equipment_id = ${equipmentId};
t.fire_equipment_id = #{fireEquipmentId}
AND t.equipment_id = #{equipmentId};
</select>
......@@ -46,7 +46,7 @@
FROM
f_equipment_fire_equipment efe
WHERE
efe.fire_equipment_id = ${fireEquipmentId}
efe.fire_equipment_id = #{fireEquipmentId}
)
LIMIT 0,1 ;
</select>
......@@ -81,11 +81,11 @@
FROM
f_equipment_fire_equipment efe
WHERE
efe.equipment_id = ${equipmentId}
efe.equipment_id = #{equipmentId}
AND efe.fire_equipment_id = fe.id
)
<if test="start != -1 and length != -1">
LIMIT ${start},${length} ;
LIMIT #{start},#{length} ;
</if>
</select>
......@@ -102,7 +102,7 @@
FROM
f_equipment_fire_equipment efe
WHERE
efe.equipment_id = ${equipmentId}
efe.equipment_id = #{equipmentId}
AND efe.fire_equipment_id = fe.id
)
</select>-->
......@@ -121,7 +121,7 @@
FROM
f_equipment_fire_equipment efe
WHERE
efe.equipment_id =${equipmentId}
efe.equipment_id =#{equipmentId}
and f.id = efe.fire_equipment_id
)
</select>
......
......@@ -22,7 +22,7 @@
FROM
f_equipment_fire_equipment efe
WHERE
efe.fire_equipment_id = ${fireEquipmentId}
efe.fire_equipment_id = #{fireEquipmentId}
AND efe.equipment_id = fe.id
)
</select>
......@@ -76,7 +76,7 @@
ORDER BY
a.id
<if test="start != -1 and length != -1">
LIMIT ${start},${length} ;
LIMIT #{start},#{length} ;
</if>
</select>
......@@ -103,6 +103,6 @@
FROM
f_equipment
WHERE
id = ${id}
id = #{id}
</select>
</mapper>
\ No newline at end of file
......@@ -10,6 +10,6 @@
FROM
f_preplan_picture p
WHERE
p.equipment_id = ${equipmentId}
p.equipment_id = #{equipmentId}
</select>
</mapper>
\ No newline at end of file
......@@ -99,7 +99,7 @@
f_rpn_change_log cl
WHERE
cl.type = 0
and cl.create_date BETWEEN '${startTime}' and '${endTime}'
and cl.create_date BETWEEN #{startTime} and #{endTime}
)d
</select>
......@@ -362,7 +362,7 @@
<!-- FROM-->
<!-- f_risk_source_equipment se-->
<!-- WHERE-->
<!-- se.fire_equipment_id = ${fireEquipmentId}-->
<!-- se.fire_equipment_id = #{fireEquipmentId}-->
<!-- AND se.risk_source_id = rs.id-->
<!-- )-->
<!-- </select>-->
......@@ -380,7 +380,7 @@
<!-- FROM-->
<!-- f_risk_source_point_inputitem pi-->
<!-- WHERE-->
<!-- pi.point_id = ${pointId}-->
<!-- pi.point_id = #{pointId}-->
<!-- AND rs.id = pi.risk_source_id-->
<!-- )-->
<!-- </select>-->
......@@ -526,7 +526,7 @@
FROM
f_risk_source rs
WHERE
rs.id = ${riskSourceId};
rs.id = #{riskSourceId};
</select>
<select id="queryForRiskSourceRpni" resultType="map">
......@@ -535,7 +535,7 @@
FROM
f_risk_source rs
WHERE
rs.parent_id = ${parentId};
rs.parent_id = #{parentId};
</select>
<select id="queryForUnqualified" resultType="map">
......@@ -638,7 +638,7 @@
f_fmea ff
JOIN f_risk_factor rf ON ff.risk_factors_id = rf.id
WHERE
rf.id = ${factorId}
rf.id = #{factorId}
)
</select>
<!-- <select id="queryContingencyWater" resultType="com.yeejoin.amos.fas.business.vo.FormInstanceVo">-->
......@@ -734,8 +734,8 @@
INNER JOIN p_point_inputitem ppi ON ppi.ID = ffpi.point_inputitem_id) ffpi
ON ffpi.fmea_id = ff.id
WHERE
ffpi.point_id = ${pointId}
# EXISTS ( SELECT 1 FROM f_risk_source_point_inputitem frspi WHERE frspi.risk_source_id = frs.id AND frspi.point_id = ${pointId} )
ffpi.point_id = #{pointId}
# EXISTS ( SELECT 1 FROM f_risk_source_point_inputitem frspi WHERE frspi.risk_source_id = frs.id AND frspi.point_id = #{pointId} )
# EXISTS ( SELECT
# 1
# FROM
......@@ -744,7 +744,7 @@
# LEFT JOIN p_point_inputitem ppi on ppi.id = fpi.point_inputitem_id
# WHERE
# f.risk_source_id = frs.id
# AND ppi.point_id = ${pointId}
# AND ppi.point_id = #{pointId}
# )
</select>
......
......@@ -612,8 +612,8 @@
<where>
<if test="inputText!=null and inputText != ''">
(
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
tmp.code LIKE '%#{inputText}%'
OR tmp.name LIKE '%#{inputText}%'
)
</if>
<if test="type!=null and type!=''">
......@@ -1070,8 +1070,8 @@
<where>
<if test="inputText!=null and inputText != ''">
AND (
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
tmp.code LIKE CONCAT('%',#{inputText},'%')
OR tmp.name LIKE CONCAT('%',#{inputText},'%')
)
</if>
<if test="type!=null and type!=''">
......@@ -1081,7 +1081,7 @@
AND tmp.riskSourceId = #{riskSourceId}
</if>
</where>
LIMIT ${start},${length}
LIMIT #{start},#{length}
</select>
<select id="retrieve3AllCount" resultType="long">
SELECT count(1) FROM (
......@@ -1277,8 +1277,8 @@
<where>
<if test="inputText!=null and inputText != ''">
AND (
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
tmp.code LIKE CONCAT('%',#{inputText},'%')
OR tmp.name LIKE CONCAT('%',#{inputText},'%')
)
</if>
<if test="type!=null and type!=''">
......@@ -1486,8 +1486,8 @@
<where>
<if test="inputText!=null and inputText != ''">
AND (
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
tmp.code LIKE '%#{inputText}%'
OR tmp.name LIKE '%#{inputText}%'
)
</if>
<if test="type!=null and type!=''">
......@@ -1500,7 +1500,7 @@
AND (tmp.orgCode = #{orgCode} OR tmp.orgCode like CONCAT(#{orgCode},'-%') )
</if>
</where>
LIMIT ${start},${length}
LIMIT #{start},#{length}
</select>
<select id="getPlanAlarmInfo" resultType="com.yeejoin.amos.fas.business.bo.FirePlanAlarmBo">
SELECT
......
......@@ -214,6 +214,11 @@
<artifactId>easypoi-annotation</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
</dependencies>
<dependencyManagement>
......
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