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; package com.yeejoin.amos.fas.core.common.request;
import java.security.SecureRandom;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.ParsePosition; import java.text.ParsePosition;
...@@ -1071,8 +1072,10 @@ public class DateUtil { ...@@ -1071,8 +1072,10 @@ public class DateUtil {
{ {
; ;
} }
long day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000); if (null != date && null != mydate) {
return day; return (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
}
return 0;
} }
/** /**
...@@ -1115,7 +1118,7 @@ public class DateUtil { ...@@ -1115,7 +1118,7 @@ public class DateUtil {
*/ */
private static String getRandom(int i) private static String getRandom(int i)
{ {
Random jjj = new Random(); SecureRandom jjj = new SecureRandom();
// int suiJiShu = jjj.nextInt(9); // int suiJiShu = jjj.nextInt(9);
if (i == 0) return ""; if (i == 0) return "";
String jj = ""; String jj = "";
......
...@@ -117,9 +117,17 @@ public class FileController extends BaseController { ...@@ -117,9 +117,17 @@ public class FileController extends BaseController {
ResponseUtils.renderText(response, "File not exists!"); ResponseUtils.renderText(response, "File not exists!");
return; return;
} }
FileInputStream fis = new FileInputStream(file); FileInputStream fis = null;
try {
fis = new FileInputStream(file);
ResponseUtils.downFileByInputStream(file.getName(), fis, response, open); ResponseUtils.downFileByInputStream(file.getName(), fis, response, open);
IOUtils.closeQuietly(fis); } catch (IOException e) {
} finally {
if (null != fis) {
fis.close();
}
}
} }
@Permission @Permission
...@@ -228,14 +236,40 @@ public class FileController extends BaseController { ...@@ -228,14 +236,40 @@ public class FileController extends BaseController {
} }
String htmlContent = (String) processData.get("html"); String htmlContent = (String) processData.get("html");
FileOutputStream fileOutputStream = null;
OutputStreamWriter outputStreamWriter = null;
Writer writer = null;
try { 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.write(htmlContent);
writer.flush(); writer.flush();
writer.close(); writer.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); 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"); String filePath = obj.getString("file");
processData.put("html", "/" + filePath.substring(0, filePath.lastIndexOf(".")) + ".html"); processData.put("html", "/" + filePath.substring(0, filePath.lastIndexOf(".")) + ".html");
......
...@@ -69,6 +69,8 @@ public class PlanVisual3dController extends BaseController { ...@@ -69,6 +69,8 @@ public class PlanVisual3dController extends BaseController {
if (testPlan != null) { if (testPlan != null) {
String path = testPlan.getFilePath(); String path = testPlan.getFilePath();
if (path != null && !"".equals(path)) { if (path != null && !"".equals(path)) {
FileInputStream inputStream = null;
InputStream fis = null;
try { try {
// path是指欲下载的文件的路径。 // path是指欲下载的文件的路径。
File file = new File(fileUploadDir + path); File file = new File(fileUploadDir + path);
...@@ -79,10 +81,12 @@ public class PlanVisual3dController extends BaseController { ...@@ -79,10 +81,12 @@ public class PlanVisual3dController extends BaseController {
String ext = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase(); String ext = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase();
// 以流的形式下载文件。 // 以流的形式下载文件。
InputStream fis = new BufferedInputStream(new FileInputStream(fileUploadDir + path)); inputStream = new FileInputStream(fileUploadDir + path);
if (null != inputStream) {
fis = new BufferedInputStream(inputStream);
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
...@@ -94,11 +98,23 @@ public class PlanVisual3dController extends BaseController { ...@@ -94,11 +98,23 @@ public class PlanVisual3dController extends BaseController {
toClient.write(buffer); toClient.write(buffer);
toClient.flush(); toClient.flush();
toClient.close(); toClient.close();
}
} else { } else {
response.setStatus(404); response.setStatus(404);
} }
} catch (IOException ex) { } catch (IOException ex) {
ex.printStackTrace(); ex.printStackTrace();
} finally {
try {
if (null != inputStream) {
inputStream.close();
}
if (null != fis) {
fis.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
} }
} else { } else {
......
...@@ -35,6 +35,8 @@ public class WeatherController extends BaseController { ...@@ -35,6 +35,8 @@ public class WeatherController extends BaseController {
String result = ""; String result = "";
BufferedReader in = null; BufferedReader in = null;
BufferedReader responseReader = null;
InputStreamReader res = null;
try { try {
String urlNameString = weatherUrl + address; String urlNameString = weatherUrl + address;
URL realUrl = new URL(urlNameString); URL realUrl = new URL(urlNameString);
...@@ -55,12 +57,13 @@ public class WeatherController extends BaseController { ...@@ -55,12 +57,13 @@ public class WeatherController extends BaseController {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
String readLine = new String(); String readLine = new String();
GZIPInputStream gZipS=new GZIPInputStream(connection.getInputStream()); GZIPInputStream gZipS=new GZIPInputStream(connection.getInputStream());
InputStreamReader res = new InputStreamReader(gZipS,"UTF-8"); res = new InputStreamReader(gZipS,"UTF-8");
BufferedReader responseReader = new BufferedReader(res); responseReader = new BufferedReader(res);
while ((readLine = responseReader.readLine()) != null) { while ((readLine = responseReader.readLine()) != null) {
sb.append(readLine); sb.append(readLine);
} }
responseReader.close();
result = sb.toString(); result = sb.toString();
System.out.println(result); System.out.println(result);
...@@ -75,6 +78,12 @@ public class WeatherController extends BaseController { ...@@ -75,6 +78,12 @@ public class WeatherController extends BaseController {
if (in != null) { if (in != null) {
in.close(); in.close();
} }
if (null != responseReader) {
responseReader.close();
}
if (null != res) {
res.close();
}
} catch (Exception e2) { } catch (Exception e2) {
e2.printStackTrace(); e2.printStackTrace();
} }
......
...@@ -161,9 +161,9 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen ...@@ -161,9 +161,9 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
} }
} }
} }
if (!CollectionUtils.isEmpty(map)) { if (null != map &&!CollectionUtils.isEmpty(map)) {
Integer total = Integer.parseInt(map.get("total").toString()); Integer total = Integer.parseInt(map.getOrDefault("total", 0).toString());
Integer count = Integer.parseInt(map.get("count").toString()); Integer count = Integer.parseInt(map.getOrDefault("count", 0).toString());
if (SqlKeyWordEnum.AND.getKey().equalsIgnoreCase(type)) { if (SqlKeyWordEnum.AND.getKey().equalsIgnoreCase(type)) {
return total.equals(count); return total.equals(count);
} else if (SqlKeyWordEnum.OR.getKey().equalsIgnoreCase(type)) { } else if (SqlKeyWordEnum.OR.getKey().equalsIgnoreCase(type)) {
......
...@@ -325,7 +325,7 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -325,7 +325,7 @@ public class EquipmentServiceImpl implements IEquipmentService {
if(date.isPresent()){ if(date.isPresent()){
equipment2=date.get(); equipment2=date.get();
} }
equipment.setCreateDate(equipment2.getCreateDate()); equipment.setCreateDate(null != equipment2 ? equipment2.getCreateDate() : new Date());
} }
preplanPictureDao.saveAndFlush(pp); preplanPictureDao.saveAndFlush(pp);
...@@ -369,8 +369,7 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -369,8 +369,7 @@ public class EquipmentServiceImpl implements IEquipmentService {
if(date.isPresent()){ if(date.isPresent()){
equipment2=date.get(); equipment2=date.get();
} }
equipment.setCreateDate(null != equipment2 && null != equipment2.getCreateDate() ? equipment2.getCreateDate() : new Date());
equipment.setCreateDate(equipment2.getCreateDate() == null ? new Date() : equipment2.getCreateDate());
} }
} else { } else {
equipment = save(equipment); equipment = save(equipment);
...@@ -382,7 +381,7 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -382,7 +381,7 @@ public class EquipmentServiceImpl implements IEquipmentService {
equipment2=date.get(); 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()); Long equipmentId = Long.valueOf(equipment.getId());
for (int i = 0; i < imgs.length; i++) { for (int i = 0; i < imgs.length; i++) {
......
...@@ -210,6 +210,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -210,6 +210,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setStatus(FasConstant.RISK_SOURCE_STATUS_NORMAL); riskSource.setStatus(FasConstant.RISK_SOURCE_STATUS_NORMAL);
riskSource.setCreateDate(new Date()); riskSource.setCreateDate(new Date());
} else {// 更新 } else {// 更新
if (null != oldRiskSource) {
riskSource.setCreateDate(oldRiskSource.getCreateDate()); riskSource.setCreateDate(oldRiskSource.getCreateDate());
riskSource.setFmeaList(oldRiskSource.getFmeaList()); riskSource.setFmeaList(oldRiskSource.getFmeaList());
riskSource.setIncrement(oldRiskSource.getIncrement()); riskSource.setIncrement(oldRiskSource.getIncrement());
...@@ -218,6 +219,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -218,6 +219,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setRpni(oldRiskSource.getRpni()); riskSource.setRpni(oldRiskSource.getRpni());
riskSource.setStatus(oldRiskSource.getStatus()); riskSource.setStatus(oldRiskSource.getStatus());
} }
}
iRiskSourceDao.saveAndFlush(riskSource); iRiskSourceDao.saveAndFlush(riskSource);
return riskSource; return riskSource;
} }
......
...@@ -97,36 +97,48 @@ public class DesUtil { ...@@ -97,36 +97,48 @@ public class DesUtil {
int[] tempBt; int[] tempBt;
int x, y, z; int x, y, z;
tempBt = bt; tempBt = bt;
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) { for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
} }
}
if (null != secondKeyBt) {
for (y = 0; y < secondLength; y++) { for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y)); tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
} }
}
if (null != thirdKeyBt) {
for (z = 0; z < thirdLength; z++) { for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z)); tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
} }
}
encByte = tempBt; encByte = tempBt;
} else { } else {
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") { if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
int[] tempBt; int[] tempBt;
int x, y; int x, y;
tempBt = bt; tempBt = bt;
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) { for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
} }
}
if (null != secondKeyBt) {
for (y = 0; y < secondLength; y++) { for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y)); tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
} }
}
encByte = tempBt; encByte = tempBt;
} else { } else {
if (firstKey != null && firstKey != "") { if (firstKey != null && firstKey != "") {
int[] tempBt; int[] tempBt;
int x = 0; int x = 0;
tempBt = bt; tempBt = bt;
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) { for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
} }
}
encByte = tempBt; encByte = tempBt;
} }
} }
...@@ -144,36 +156,48 @@ public class DesUtil { ...@@ -144,36 +156,48 @@ public class DesUtil {
int[] tempBt; int[] tempBt;
int x, y, z; int x, y, z;
tempBt = tempByte; tempBt = tempByte;
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) { for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
} }
}
if (null != secondKeyBt) {
for (y = 0; y < secondLength; y++) { for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y)); tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
} }
}
if (null != thirdKeyBt) {
for (z = 0; z < thirdLength; z++) { for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z)); tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
} }
}
encByte = tempBt; encByte = tempBt;
} else { } else {
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") { if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
int[] tempBt; int[] tempBt;
int x, y; int x, y;
tempBt = tempByte; tempBt = tempByte;
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) { for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
} }
}
if (null != secondKeyBt) {
for (y = 0; y < secondLength; y++) { for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y)); tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
} }
}
encByte = tempBt; encByte = tempBt;
} else { } else {
if (firstKey != null && firstKey != "") { if (firstKey != null && firstKey != "") {
int[] tempBt; int[] tempBt;
int x; int x;
tempBt = tempByte; tempBt = tempByte;
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) { for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
} }
}
encByte = tempBt; encByte = tempBt;
} }
} }
...@@ -188,36 +212,48 @@ public class DesUtil { ...@@ -188,36 +212,48 @@ public class DesUtil {
int[] tempBt; int[] tempBt;
int x, y, z; int x, y, z;
tempBt = tempByte; tempBt = tempByte;
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) { for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
} }
}
if (null != secondKeyBt) {
for (y = 0; y < secondLength; y++) { for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y)); tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
} }
}
if (null != thirdKeyBt) {
for (z = 0; z < thirdLength; z++) { for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z)); tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
} }
}
encByte = tempBt; encByte = tempBt;
} else { } else {
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") { if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
int[] tempBt; int[] tempBt;
int x, y; int x, y;
tempBt = tempByte; tempBt = tempByte;
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) { for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
} }
}
if (null != secondKeyBt) {
for (y = 0; y < secondLength; y++) { for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y)); tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
} }
}
encByte = tempBt; encByte = tempBt;
} else { } else {
if (firstKey != null && firstKey != "") { if (firstKey != null && firstKey != "") {
int[] tempBt; int[] tempBt;
int x; int x;
tempBt = tempByte; tempBt = tempByte;
if (null != firstKeyBt) {
for (x = 0; x < firstLength; x++) { for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
} }
}
encByte = tempBt; encByte = tempBt;
} }
} }
...@@ -267,36 +303,48 @@ public class DesUtil { ...@@ -267,36 +303,48 @@ public class DesUtil {
int[] tempBt; int[] tempBt;
int x, y, z; int x, y, z;
tempBt = intByte; tempBt = intByte;
if (null != thirdKeyBt) {
for (x = thirdLength - 1; x >= 0; x--) { for (x = thirdLength - 1; x >= 0; x--) {
tempBt = dec(tempBt, (int[]) thirdKeyBt.get(x)); tempBt = dec(tempBt, (int[]) thirdKeyBt.get(x));
} }
}
if (null != secondKeyBt) {
for (y = secondLength - 1; y >= 0; y--) { for (y = secondLength - 1; y >= 0; y--) {
tempBt = dec(tempBt, (int[]) secondKeyBt.get(y)); tempBt = dec(tempBt, (int[]) secondKeyBt.get(y));
} }
}
if (null != firstKeyBt) {
for (z = firstLength - 1; z >= 0; z--) { for (z = firstLength - 1; z >= 0; z--) {
tempBt = dec(tempBt, (int[]) firstKeyBt.get(z)); tempBt = dec(tempBt, (int[]) firstKeyBt.get(z));
} }
}
decByte = tempBt; decByte = tempBt;
} else { } else {
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") { if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
int[] tempBt; int[] tempBt;
int x, y, z; int x, y, z;
tempBt = intByte; tempBt = intByte;
if (null != secondKeyBt) {
for (x = secondLength - 1; x >= 0; x--) { for (x = secondLength - 1; x >= 0; x--) {
tempBt = dec(tempBt, (int[]) secondKeyBt.get(x)); tempBt = dec(tempBt, (int[]) secondKeyBt.get(x));
} }
}
if (null != firstKeyBt) {
for (y = firstLength - 1; y >= 0; y--) { for (y = firstLength - 1; y >= 0; y--) {
tempBt = dec(tempBt, (int[]) firstKeyBt.get(y)); tempBt = dec(tempBt, (int[]) firstKeyBt.get(y));
} }
}
decByte = tempBt; decByte = tempBt;
} else { } else {
if (firstKey != null && firstKey != "") { if (firstKey != null && firstKey != "") {
int[] tempBt; int[] tempBt;
int x, y, z; int x, y, z;
tempBt = intByte; tempBt = intByte;
if (null != firstKeyBt) {
for (x = firstLength - 1; x >= 0; x--) { for (x = firstLength - 1; x >= 0; x--) {
tempBt = dec(tempBt, (int[]) firstKeyBt.get(x)); tempBt = dec(tempBt, (int[]) firstKeyBt.get(x));
} }
}
decByte = tempBt; decByte = tempBt;
} }
} }
......
...@@ -267,13 +267,15 @@ public class FileHelper { ...@@ -267,13 +267,15 @@ public class FileHelper {
public static void writeFile(String content, String path) { public static void writeFile(String content, String path) {
OutputStream fos = null; OutputStream fos = null;
BufferedWriter bw = null; BufferedWriter bw = null;
OutputStreamWriter outputStreamWriter = null;
try { try {
File file = new File(path); File file = new File(path);
if (!file.getParentFile().exists()) { if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
} }
fos = new FileOutputStream(file); 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); bw.write(content);
} catch (FileNotFoundException fnfe) { } catch (FileNotFoundException fnfe) {
fnfe.printStackTrace(); fnfe.printStackTrace();
...@@ -281,11 +283,17 @@ public class FileHelper { ...@@ -281,11 +283,17 @@ public class FileHelper {
ioe.printStackTrace(); ioe.printStackTrace();
} finally { } finally {
try { try {
if (bw != null) { if (null != bw) {
bw.close(); bw.close();
} }
} catch (IOException ioException) { if (null != fos) {
System.err.println(ioException.getMessage()); fos.close();
}
if (null != outputStreamWriter) {
outputStreamWriter.close();
}
} catch (IOException e) {
e.printStackTrace();
} }
} }
} }
...@@ -377,9 +385,12 @@ public class FileHelper { ...@@ -377,9 +385,12 @@ public class FileHelper {
// 以GB2312读取文件 // 以GB2312读取文件
BufferedReader br = null; BufferedReader br = null;
BufferedWriter bw = null; BufferedWriter bw = null;
FileWriter fileWriter = null;
try { try {
br = new BufferedReader(new FileReader(htmFile)); FileReader fileReader = new FileReader(htmFile);
bw = new BufferedWriter(new FileWriter(new File(outPutFile))); br = new BufferedReader(fileReader);
fileWriter = new FileWriter(new File(outPutFile));
bw = new BufferedWriter(fileWriter);
String result = null; String result = null;
while (null != (result = br.readLine())) { while (null != (result = br.readLine())) {
if (!"".equals(result.trim())) { if (!"".equals(result.trim())) {
...@@ -393,11 +404,22 @@ public class FileHelper { ...@@ -393,11 +404,22 @@ public class FileHelper {
if (null != br) { if (null != br) {
br.close(); br.close();
} }
} catch (Exception e) {
e.printStackTrace();
}
try {
if (null != bw) { if (null != bw) {
bw.close(); bw.close();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
}
try {
if (null != fileWriter) {
fileWriter.close();
}
} catch (Exception e) {
e.printStackTrace();
} }
} }
...@@ -578,37 +600,27 @@ public class FileHelper { ...@@ -578,37 +600,27 @@ public class FileHelper {
} }
public static void nioTransferCopy(File source, File target) { public static void nioTransferCopy(File source, File target) {
FileChannel in = null; try (
FileChannel out = null; FileInputStream inStream = new FileInputStream(source);
FileInputStream inStream = null; FileOutputStream outStream = new FileOutputStream(target);
FileOutputStream outStream = null; FileChannel in = inStream.getChannel();
try { FileChannel out = outStream.getChannel();
inStream = new FileInputStream(source); ) {
outStream = new FileOutputStream(target);
in = inStream.getChannel();
out = outStream.getChannel();
in.transferTo(0, in.size(), out); in.transferTo(0, in.size(), out);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally {
close(inStream);
close(in);
close(outStream);
close(out);
} }
} }
private static boolean nioBufferCopy(File source, File target) { private static boolean nioBufferCopy(File source, File target) {
FileChannel in = null;
FileChannel out = null; try (
FileInputStream inStream = null; FileInputStream inStream = new FileInputStream(source);
FileOutputStream outStream = null; FileOutputStream outStream = new FileOutputStream(target);
try { FileChannel in = inStream.getChannel();
inStream = new FileInputStream(source); FileChannel out = outStream.getChannel();
outStream = new FileOutputStream(target); ) {
in = inStream.getChannel();
out = outStream.getChannel();
ByteBuffer buffer = ByteBuffer.allocate(4096); ByteBuffer buffer = ByteBuffer.allocate(4096);
while (in.read(buffer) != -1) { while (in.read(buffer) != -1) {
buffer.flip(); buffer.flip();
...@@ -618,22 +630,16 @@ public class FileHelper { ...@@ -618,22 +630,16 @@ public class FileHelper {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
return false; return false;
} finally {
close(inStream);
close(in);
close(outStream);
close(out);
} }
return true; return true;
} }
public static void customBufferStreamCopy(File source, File target) { public static void customBufferStreamCopy(File source, File target) {
InputStream fis = null; try (
OutputStream fos = null; InputStream fis = new FileInputStream(source);
try { OutputStream fos = new FileOutputStream(target);
fis = new FileInputStream(source); ) {
fos = new FileOutputStream(target);
byte[] buf = new byte[4096]; byte[] buf = new byte[4096];
int i; int i;
while ((i = fis.read(buf)) != -1) { while ((i = fis.read(buf)) != -1) {
...@@ -641,9 +647,6 @@ public class FileHelper { ...@@ -641,9 +647,6 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
close(fis);
close(fos);
} }
} }
...@@ -1190,10 +1193,7 @@ public class FileHelper { ...@@ -1190,10 +1193,7 @@ public class FileHelper {
* @Title: getExcel * @Title: getExcel
* @Description: 下载指定路径的Excel文件 * @Description: 下载指定路径的Excel文件
*/ */
public static void getExcel(String url, String fileName, HttpServletResponse response, HttpServletRequest request) { public static void getExcel(String url, String fileName, HttpServletResponse response, HttpServletRequest request) throws UnsupportedEncodingException {
try {
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型 //1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
response.setContentType("multipart/form-data"); response.setContentType("multipart/form-data");
...@@ -1204,22 +1204,17 @@ public class FileHelper { ...@@ -1204,22 +1204,17 @@ public class FileHelper {
// + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名 // + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名
//通过文件路径获得File对象 //通过文件路径获得File对象
File file = new File(url); try (
FileInputStream in = new FileInputStream(new File(url));
FileInputStream in = new FileInputStream(file);
//3.通过response获取OutputStream对象(out) //3.通过response获取OutputStream对象(out)
OutputStream out = new BufferedOutputStream(response.getOutputStream()); 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);
} }
......
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; package com.yeejoin.amos.fas.business.util;
import java.security.SecureRandom;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Random; import java.util.Random;
...@@ -12,7 +13,7 @@ public class RandomUtil { ...@@ -12,7 +13,7 @@ public class RandomUtil {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String newDate = sdf.format(new Date()); String newDate = sdf.format(new Date());
String result = ""; String result = "";
Random random = new Random(); SecureRandom random = new SecureRandom();
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
result += random.nextInt(10); result += random.nextInt(10);
} }
......
...@@ -26,7 +26,7 @@ public class SSLClient extends DefaultHttpClient { ...@@ -26,7 +26,7 @@ public class SSLClient extends DefaultHttpClient {
public SSLClient() throws Exception { public SSLClient() throws Exception {
super(); super();
//传输协议需要根据自己的判断 //传输协议需要根据自己的判断
SSLContext ctx = SSLContext.getInstance("TLS"); SSLContext ctx = SSLContext.getInstance("TLSv1.2");
X509TrustManager tm = new X509TrustManager() { X509TrustManager tm = new X509TrustManager() {
@Override @Override
public void checkClientTrusted(X509Certificate[] chain, public void checkClientTrusted(X509Certificate[] chain,
......
...@@ -402,8 +402,10 @@ public static Time formatStrToTime(String strDate){ ...@@ -402,8 +402,10 @@ public static Time formatStrToTime(String strDate){
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
Time date = new Time(d.getTime()); if (null != d) {
return date; return new Time(d.getTime());
}
return null;
} }
/** /**
......
...@@ -26,10 +26,15 @@ public class FileUtil { ...@@ -26,10 +26,15 @@ public class FileUtil {
if (!targetFile.exists()) { if (!targetFile.exists()) {
targetFile.mkdirs(); targetFile.mkdirs();
} }
try (
FileOutputStream out = new FileOutputStream(filePath + fileName); FileOutputStream out = new FileOutputStream(filePath + fileName);
) {
out.write(file); out.write(file);
out.flush(); out.flush();
out.close(); } catch (IOException e) {
e.printStackTrace();
}
} }
/** /**
......
...@@ -41,19 +41,11 @@ public class MyImageExtractor implements IImageExtractor { ...@@ -41,19 +41,11 @@ public class MyImageExtractor implements IImageExtractor {
imagePath = s1 + pre + s2; imagePath = s1 + pre + s2;
File imageFile = new File(baseDir, imagePath); File imageFile = new File(baseDir, imagePath);
imageFile.getParentFile().mkdirs(); imageFile.getParentFile().mkdirs();
InputStream in = null; try (
OutputStream out = null; InputStream in = new ByteArrayInputStream(imageData);
try { OutputStream out = new FileOutputStream(imageFile);
in = new ByteArrayInputStream(imageData); ) {
out = new FileOutputStream(imageFile);
IOUtils.copy(in, out); IOUtils.copy(in, out);
} finally {
if (in != null) {
IOUtils.closeQuietly(in);
}
if (out != null) {
IOUtils.closeQuietly(out);
}
} }
} }
......
...@@ -27,7 +27,7 @@ public class WordConverterUtils { ...@@ -27,7 +27,7 @@ public class WordConverterUtils {
/** /**
* 图片存储相对文档路径 * 图片存储相对文档路径
*/ */
private static String imgPath = "\\image\\"; private static String imgPath = File.separator + "image" + File.separator;
/** /**
* word文档转html文档 * word文档转html文档
...@@ -78,7 +78,10 @@ public class WordConverterUtils { ...@@ -78,7 +78,10 @@ public class WordConverterUtils {
* @param readUrl html中img标签的图片存储路径 * @param readUrl html中img标签的图片存储路径
*/ */
private static void docToHtml(File srcFile, File targetFile, String readUrl) { 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; String imagePathStr = srcFile.getParentFile().getAbsolutePath() + imgPath;
File imagePath = new File(imagePathStr); File imagePath = new File(imagePathStr);
if (!imagePath.exists()) { if (!imagePath.exists()) {
...@@ -86,13 +89,14 @@ public class WordConverterUtils { ...@@ -86,13 +89,14 @@ public class WordConverterUtils {
} }
String srcName = srcFile.getName(); String srcName = srcFile.getName();
String suffix = srcName.substring(0, srcName.lastIndexOf(".")) + "_"; String suffix = srcName.substring(0, srcName.lastIndexOf(".")) + "_";
HWPFDocument wordDocument = new HWPFDocument(new FileInputStream(srcFile));
org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document); WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document);
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs")); String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
wordToHtmlConverter.setPicturesManager((content, pictureType, name, width, height) -> { wordToHtmlConverter.setPicturesManager((content, pictureType, name, width, height) -> {
try { try (
FileOutputStream out = new FileOutputStream(imagePathStr + suffix + name); FileOutputStream out = new FileOutputStream(imagePathStr + suffix + name);
) {
out.write(content); out.write(content);
return uri + suffix + name; return uri + suffix + name;
} catch (Exception e) { } catch (Exception e) {
...@@ -124,7 +128,10 @@ public class WordConverterUtils { ...@@ -124,7 +128,10 @@ public class WordConverterUtils {
* @return * @return
*/ */
private static String docToHtmlString(File srcFile, String readUrl) { 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; String imagePathStr = srcFile.getParentFile().getAbsolutePath() + imgPath;
File imagePath = new File(imagePathStr); File imagePath = new File(imagePathStr);
if (!imagePath.exists()) { if (!imagePath.exists()) {
...@@ -132,7 +139,6 @@ public class WordConverterUtils { ...@@ -132,7 +139,6 @@ public class WordConverterUtils {
} }
String srcName = srcFile.getName(); String srcName = srcFile.getName();
String suffix = srcName.substring(0, srcName.lastIndexOf(".")) + "_"; String suffix = srcName.substring(0, srcName.lastIndexOf(".")) + "_";
HWPFDocument wordDocument = new HWPFDocument(new FileInputStream(srcFile));
org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document); WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document);
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs")); String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
...@@ -183,30 +189,22 @@ public class WordConverterUtils { ...@@ -183,30 +189,22 @@ public class WordConverterUtils {
} }
String temp = srcFile.getName(); String temp = srcFile.getName();
String suffix = temp.substring(0, temp.lastIndexOf(".")) + "_"; String suffix = temp.substring(0, temp.lastIndexOf(".")) + "_";
OutputStreamWriter outputStreamWriter = null; try (
try { FileInputStream inputStream = new FileInputStream(srcFile);
XWPFDocument document = new XWPFDocument(new FileInputStream(srcFile)); XWPFDocument document = new XWPFDocument(inputStream);
FileOutputStream fileOutputStream = new FileOutputStream(targetFile);
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, "utf-8");
) {
XHTMLOptions options = XHTMLOptions.create(); XHTMLOptions options = XHTMLOptions.create();
options.setExtractor(new MyImageExtractor(imagePath, suffix)); options.setExtractor(new MyImageExtractor(imagePath, suffix));
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs")); String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
System.out.println("uri :" + uri); System.out.println("uri :" + uri);
options.URIResolver(new MyURIResolver(uri)); options.URIResolver(new MyURIResolver(uri));
outputStreamWriter = new OutputStreamWriter(new FileOutputStream(targetFile), "utf-8");
XHTMLConverter xhtmlConverter = (XHTMLConverter) XHTMLConverter.getInstance(); XHTMLConverter xhtmlConverter = (XHTMLConverter) XHTMLConverter.getInstance();
xhtmlConverter.convert(document, outputStreamWriter, options); xhtmlConverter.convert(document, outputStreamWriter, options);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (outputStreamWriter != null) {
outputStreamWriter.close();
} }
} catch (Exception e2) {
e2.printStackTrace();
}
}
} }
/** /**
...@@ -223,9 +221,11 @@ public class WordConverterUtils { ...@@ -223,9 +221,11 @@ public class WordConverterUtils {
} }
String temp = srcFile.getName(); String temp = srcFile.getName();
String suffix = temp.substring(0, temp.lastIndexOf(".")) + "_"; String suffix = temp.substring(0, temp.lastIndexOf(".")) + "_";
OutputStreamWriter outputStreamWriter = null; try (
try { FileInputStream inputStream = new FileInputStream(srcFile);
XWPFDocument document = new XWPFDocument(new FileInputStream(srcFile)); XWPFDocument document = new XWPFDocument(inputStream);
)
{
XHTMLOptions options = XHTMLOptions.create(); XHTMLOptions options = XHTMLOptions.create();
options.setExtractor(new MyImageExtractor(imagePath, suffix)); options.setExtractor(new MyImageExtractor(imagePath, suffix));
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs")); String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
...@@ -237,15 +237,6 @@ public class WordConverterUtils { ...@@ -237,15 +237,6 @@ public class WordConverterUtils {
return stringWriter.toString(); return stringWriter.toString();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (outputStreamWriter != null) {
outputStreamWriter.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
} }
return null; 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; ...@@ -19,6 +19,7 @@ import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
...@@ -70,13 +71,15 @@ public class YeeAmosFireAutoSysStart implements ApplicationContextAware { ...@@ -70,13 +71,15 @@ public class YeeAmosFireAutoSysStart implements ApplicationContextAware {
*/ */
public static void main(String[] args) { public static void main(String[] args) {
log.info("start Service.........."); log.info("start Service..........");
try { ApplicationContext context = SpringApplication.run(YeeAmosFireAutoSysStart.class, args);
SpringApplication application = new SpringApplication(YeeAmosFireAutoSysStart.class); Environment env = context.getEnvironment();
Environment environment = application.run(args).getEnvironment(); String appName = env.getProperty("spring.application.name");
log.info("SwaggerUI: http://" + InetAddress.getLocalHost().getHostAddress() + ":" + environment.getProperty("server.port") + environment.getProperty("server.servlet.context-path") + "/swagger-ui.html"); log.info(
} catch (Exception e) { "\n----------------------------------------------------------\n\t"
System.out.println("error occur when run server! " + e); + "Application {} is running!\n"
} + "----------------------------------------------------------\n"
, appName
);
} }
/** /**
......
#DB properties: #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.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.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.driver-class-name = com.mysql.cj.jdbc.Driver
spring.datasource.hikari.maxLifetime = 1765000 spring.datasource.hikari.maxLifetime = 1765000
spring.datasource.hikari.maximum-pool-size = 10 spring.datasource.hikari.maximum-pool-size = 10
...@@ -10,7 +10,7 @@ spring.datasource.validationQuery = SELECT 1 ...@@ -10,7 +10,7 @@ spring.datasource.validationQuery = SELECT 1
#\u7CFB\u7EDF\u670D\u52A1\u8D26\u53F7\uFF0C\u7528\u6237\u540E\u7AEF\u670D\u52A1\u8C03\u7528 #\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.user-name=fas_autosys
amos.system.user.password=a1234560 amos.system.user.password=ENC(QDC3/GhtV5hj5GLxaVkYd1Sk3gFSlW1BWS7ieC2+FL56U9U9LV9BpcMBrhk7xFWM)
#\u5E94\u7528product appkey #\u5E94\u7528product appkey
amos.system.user.app-key=studio_normalapp_3056965 amos.system.user.app-key=studio_normalapp_3056965
...@@ -29,7 +29,7 @@ eureka.instance.status-page-url-path=/actuator/info ...@@ -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 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.name=admin
spring.security.user.password=a1234560 spring.security.user.password=ENC(QDC3/GhtV5hj5GLxaVkYd1Sk3gFSlW1BWS7ieC2+FL56U9U9LV9BpcMBrhk7xFWM)
...@@ -40,7 +40,7 @@ spring.security.user.password=a1234560 ...@@ -40,7 +40,7 @@ spring.security.user.password=a1234560
spring.redis.database=1 spring.redis.database=1
spring.redis.host=172.16.11.201 spring.redis.host=172.16.11.201
spring.redis.port=6379 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-active=200
spring.redis.jedis.pool.max-wait=-1 spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=10 spring.redis.jedis.pool.max-idle=10
...@@ -58,7 +58,7 @@ emqx.clean-session=true ...@@ -58,7 +58,7 @@ 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.201:1883 emqx.broker=tcp://172.16.11.201:1883
emqx.client-user-name=admin emqx.client-user-name=admin
emqx.client-password=public emqx.client-password=ENC(IWhwMSgko6moJ+JDuh5cq41ixOfhyyiaoRiOCw5Iv3f+YAO8Ib5KpWattlT6h57p)
emqx.max-inflight=1000 emqx.max-inflight=1000
riskSourceService riskSourceService
#\u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740 #\u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
......
#DB properties: #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.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.username=root
spring.datasource.password=Yeejoin@2020 spring.datasource.password=ENC(HauNTLfKmT6iwEk9dxFRUucZvEzc7S648Wflgrom3lCGmm1YP0dnKds7jUF74fkH)
spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver
spring.datasource.hikari.maxLifetime = 1765000 spring.datasource.hikari.maxLifetime = 1765000
spring.datasource.hikari.maximum-pool-size = 10 spring.datasource.hikari.maximum-pool-size = 10
...@@ -10,7 +10,7 @@ spring.datasource.validationQuery = SELECT 1 ...@@ -10,7 +10,7 @@ spring.datasource.validationQuery = SELECT 1
#\u7CFB\u7EDF\u670D\u52A1\u8D26\u53F7\uFF0C\u7528\u6237\u540E\u7AEF\u670D\u52A1\u8C03\u7528 #\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.user-name=fas_autosys
amos.system.user.password=a1234560 amos.system.user.password=ENC(dkh6A2t7bFXQHO1uR7R49d6p2nxEHjbxxEh1Rvzc88iAjx6OVRN7eh8hA0XmZecg)
#\u5E94\u7528product appkey #\u5E94\u7528product appkey
amos.system.user.app-key=studio_normalapp_3056965 amos.system.user.app-key=studio_normalapp_3056965
...@@ -27,7 +27,7 @@ eureka.instance.prefer-ip-address=true ...@@ -27,7 +27,7 @@ eureka.instance.prefer-ip-address=true
spring.redis.database=1 spring.redis.database=1
spring.redis.host=172.16.11.201 spring.redis.host=172.16.11.201
spring.redis.port=6379 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-active=200
spring.redis.jedis.pool.max-wait=-1 spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=10 spring.redis.jedis.pool.max-idle=10
...@@ -45,7 +45,7 @@ emqx.clean-session=true ...@@ -45,7 +45,7 @@ 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.201:1883 emqx.broker=tcp://172.16.11.201:1883
emqx.user-name=admin emqx.user-name=admin
emqx.password=public emqx.password=ENC(vlnMOpNNk7wWAcVgqh/C61LOajZY3f1XOFZEqcJ774SdtZeKnOCoNL3u4idRVr+S)
#\u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740 #\u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
file.downLoad.url=http://172.16.11.201:9000/ file.downLoad.url=http://172.16.11.201:9000/
......
#DB properties: #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.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.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.driver-class-name = com.mysql.cj.jdbc.Driver
spring.datasource.hikari.maxLifetime = 1765000 spring.datasource.hikari.maxLifetime = 1765000
spring.datasource.hikari.maximum-pool-size = 10 spring.datasource.hikari.maximum-pool-size = 10
...@@ -10,7 +10,7 @@ spring.datasource.validationQuery = SELECT 1 ...@@ -10,7 +10,7 @@ spring.datasource.validationQuery = SELECT 1
#\u7CFB\u7EDF\u670D\u52A1\u8D26\u53F7\uFF0C\u7528\u6237\u540E\u7AEF\u670D\u52A1\u8C03\u7528 #\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.user-name=fas_autosys
amos.system.user.password=a1234560 amos.system.user.password=ENC(IrXh5LXTKhcu0kC90lBN4nMLIhrTVxPcCOL2BsM3UVXn9yitiDZHQ8p4O1c3BS4z)
#\u5E94\u7528product appkey #\u5E94\u7528product appkey
amos.system.user.app-key=studio_normalapp_3056965 amos.system.user.app-key=studio_normalapp_3056965
...@@ -27,7 +27,7 @@ eureka.instance.prefer-ip-address=true ...@@ -27,7 +27,7 @@ eureka.instance.prefer-ip-address=true
spring.redis.database=1 spring.redis.database=1
spring.redis.host=172.16.11.201 spring.redis.host=172.16.11.201
spring.redis.port=6379 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-active=200
spring.redis.jedis.pool.max-wait=-1 spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=10 spring.redis.jedis.pool.max-idle=10
...@@ -45,7 +45,7 @@ emqx.clean-session=true ...@@ -45,7 +45,7 @@ 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.201:1883 emqx.broker=tcp://172.16.11.201:1883
emqx.user-name=admin emqx.user-name=admin
emqx.password=public emqx.password=ENC(JcSMTcnJjJsR/wlfW4MqxYnTVVxymsc7iZN3l+gRadRsplNeScSxFa3gbCv30oDt)
#\u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740 #\u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
file.downLoad.url=http://172.16.11.201:9000/ file.downLoad.url=http://172.16.11.201:9000/
......
...@@ -91,7 +91,7 @@ data.type.fireMonitor=3103 ...@@ -91,7 +91,7 @@ data.type.fireMonitor=3103
outSystem.fegin.name=unKnow outSystem.fegin.name=unKnow
outSystem.user.password=a1234560 outSystem.user.password=ENC(69BvVP221DPXcNRGhdAMYCm3nPJMSCDutwnqJoH+jfXDt5NXvvi9ajv0qFSpBtIg)
privilege.fegin.name=AMOS-API-PRIVILEGE privilege.fegin.name=AMOS-API-PRIVILEGE
#\u9884\u6848\u6307\u6807\u914D\u7F6E #\u9884\u6848\u6307\u6807\u914D\u7F6E
......
...@@ -25,7 +25,7 @@ CREATE TABLE `s_company` ( ...@@ -25,7 +25,7 @@ CREATE TABLE `s_company` (
UNIQUE KEY `comp_code` (`comp_code`) USING BTREE, UNIQUE KEY `comp_code` (`comp_code`) USING BTREE,
UNIQUE KEY `comp_code_2` (`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 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`; DROP TABLE IF EXISTS `s_department`;
CREATE TABLE `s_department` ( CREATE TABLE `s_department` (
...@@ -42,7 +42,7 @@ CREATE TABLE `s_department` ( ...@@ -42,7 +42,7 @@ CREATE TABLE `s_department` (
`is_delete` bit(1) NOT NULL COMMENT '是否删除:0表示未删除,1表示已删除', `is_delete` bit(1) NOT NULL COMMENT '是否删除:0表示未删除,1表示已删除',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `FK__s_departm__compa__74794A92` (`company_id`) USING BTREE 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`; DROP TABLE IF EXISTS `s_user`;
CREATE TABLE `s_user` ( CREATE TABLE `s_user` (
...@@ -73,6 +73,6 @@ 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__departme__7D0E9093` (`department_id`) USING BTREE,
KEY `FK__s_user__role_id__7E02B4CC` (`role_id`) USING BTREE, KEY `FK__s_user__role_id__7E02B4CC` (`role_id`) USING BTREE,
KEY `FK__s_user__company___7C1A6C5A` (`company_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 @@ ...@@ -6,7 +6,7 @@
UPDATE UPDATE
contingency_plan_instance contingency_plan_instance
SET SET
runstate = ${runStatus} runstate = #{runStatus}
<if test="content != null and content != ''"> <if test="content != null and content != ''">
, content = #{content} , content = #{content}
</if> </if>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
UPDATE UPDATE
contingency_plan_instance contingency_plan_instance
SET SET
runstate = ${runStatus} runstate = #{runStatus}
<if test="content != null and content != ''"> <if test="content != null and content != ''">
, content = #{content} , content = #{content}
</if> </if>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
m.batch_no = #{batchNo} m.batch_no = #{batchNo}
</if> </if>
<if test="stepIndex != null"> <if test="stepIndex != null">
AND m.step_index = ${stepIndex} AND m.step_index = #{stepIndex}
</if> </if>
</where> </where>
ORDER BY ORDER BY
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
m.batch_no = #{batchNo} m.batch_no = #{batchNo}
</if> </if>
<if test="stepIndex != null"> <if test="stepIndex != null">
AND m.step_index = ${stepIndex} AND m.step_index = #{stepIndex}
</if> </if>
<if test="indexUpdateTime != null"> <if test="indexUpdateTime != null">
AND m.index_create_time = #{indexUpdateTime} AND m.index_create_time = #{indexUpdateTime}
......
...@@ -13,19 +13,19 @@ ...@@ -13,19 +13,19 @@
WHERE WHERE
1=1 1=1
<if test="time!=null"> <if test="time!=null">
and TO_DAYS(m.time) = TO_DAYS('${time}') and TO_DAYS(m.time) = TO_DAYS(#{time})
</if> </if>
<if test="type!=null"> <if test="type!=null">
AND m.type = '${type}' AND m.type = #{type}
</if> </if>
<if test="title!=null"> <if test="title!=null">
AND m.title LIKE '%${title}%' AND m.title LIKE CONCAT('%',#{title},'%')
</if> </if>
<if test="orgCode!=null"> <if test="orgCode!=null">
AND ( AND (
m.org_code = '${orgCode}' m.org_code = #{orgCode}
OR m.org_code LIKE '${orgCode}*%' OR m.org_code LIKE CONCAT('%',#{orgCode},'*%')
) )
</if> </if>
</select> </select>
...@@ -39,22 +39,22 @@ ...@@ -39,22 +39,22 @@
WHERE WHERE
1=1 1=1
<if test="time!=null"> <if test="time!=null">
and TO_DAYS(m.time) = TO_DAYS('${time}') and TO_DAYS(m.time) = TO_DAYS('#{time}')
</if> </if>
<if test="type!=null"> <if test="type!=null">
AND m.type = '${type}' AND m.type = #{type}
</if> </if>
<if test="title!=null"> <if test="title!=null">
AND m.title LIKE '%${title}%' AND m.title LIKE CONCAT('%',#{title},'%')
</if> </if>
<if test="orgCode!=null"> <if test="orgCode!=null">
AND ( AND (
m.org_code = '${orgCode}' m.org_code = #{orgCode}
OR m.org_code LIKE '${orgCode}*%' OR m.org_code LIKE CONCAT('%',#{orgCode},'%')
) )
</if> </if>
LIMIT ${start},${length} ; LIMIT #{start},#{length} ;
</select> </select>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<!-- FROM--> <!-- FROM-->
<!-- f_fire_station fs--> <!-- f_fire_station fs-->
<!-- WHERE--> <!-- WHERE-->
<!-- fs.id = ${id}--> <!-- fs.id = #{id}-->
<!-- </select>--> <!-- </select>-->
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<!-- f_fire_station_equipment fs--> <!-- f_fire_station_equipment fs-->
<!-- JOIN f_fire_equipment f ON fs.fire_equipment_id = f.id--> <!-- JOIN f_fire_equipment f ON fs.fire_equipment_id = f.id-->
<!-- WHERE--> <!-- WHERE-->
<!-- fs.fire_station_id = ${fireStationId}--> <!-- fs.fire_station_id = #{fireStationId}-->
<!-- </select>--> <!-- </select>-->
<!-- <select id="queryForFireEqumntPage" resultType="java.util.Map">--> <!-- <select id="queryForFireEqumntPage" resultType="java.util.Map">-->
<!-- SELECT--> <!-- SELECT-->
...@@ -44,9 +44,9 @@ ...@@ -44,9 +44,9 @@
<!-- left join f_fire_equipment f ON fs.fire_equipment_id = f.id--> <!-- 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--> <!-- left join f_risk_source frs on frs.id = f.risk_source_id-->
<!-- WHERE--> <!-- WHERE-->
<!-- fs.fire_station_id = ${fireStationId}--> <!-- fs.fire_station_id = #{fireStationId}-->
<!-- and f.id is not null--> <!-- and f.id is not null-->
<!-- LIMIT ${start}, ${length};--> <!-- LIMIT #{start}, #{length};-->
<!-- </select>--> <!-- </select>-->
<!-- <select id="queryCountForPage" resultType="long">--> <!-- <select id="queryCountForPage" resultType="long">-->
...@@ -58,13 +58,13 @@ ...@@ -58,13 +58,13 @@
<!-- WHERE--> <!-- WHERE-->
<!-- 1=1--> <!-- 1=1-->
<!-- <if test="name!=null">--> <!-- <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>-->
<!-- <if test="code!=null">--> <!-- <if test="code!=null">-->
<!-- AND fs.`code` LIKE '%${code}%'--> <!-- AND fs.`code` LIKE '%#{code}%'-->
<!-- </if>--> <!-- </if>-->
<!-- <if test="type!=null">--> <!-- <if test="type!=null">-->
<!-- AND fs.`type` LIKE '%${type}%';--> <!-- AND fs.`type` LIKE '%#{type}%';-->
<!-- </if>--> <!-- </if>-->
<!-- </select>--> <!-- </select>-->
<!-- <select id="queryForPage" resultType="java.util.Map">--> <!-- <select id="queryForPage" resultType="java.util.Map">-->
...@@ -85,15 +85,15 @@ ...@@ -85,15 +85,15 @@
<!-- 1=1--> <!-- 1=1-->
<!-- <if test="name!=null">--> <!-- <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>-->
<!-- <if test="code!=null">--> <!-- <if test="code!=null">-->
<!-- AND fs.`code` LIKE '%${code}%'--> <!-- AND fs.`code` LIKE '%#{code}%'-->
<!-- </if>--> <!-- </if>-->
<!-- <if test="type!=null">--> <!-- <if test="type!=null">-->
<!-- AND fs.`type` LIKE '%${type}%'--> <!-- AND fs.`type` LIKE '%#{type}%'-->
<!-- </if>--> <!-- </if>-->
<!-- LIMIT ${start},${length} ;--> <!-- LIMIT #{start},#{length} ;-->
<!-- </select>--> <!-- </select>-->
...@@ -126,14 +126,14 @@ ...@@ -126,14 +126,14 @@
a.instance_id a.instance_id
) s ) s
<if test="name!=null"> <if test="name!=null">
AND s.name LIKE '%${name}%' AND s.name LIKE CONCAT('%',#{name},'%')
</if> </if>
<if test="code!=null"> <if test="code!=null">
AND s.`code` LIKE '%${code}%' AND s.`code` LIKE CONCAT('%',#{code},'%')
</if> </if>
<if test="type!=null"> <if test="type!=null">
AND s.`type` LIKE '%${type}%'; AND s.`type` LIKE CONCAT('%',#{type},'%');
</if> </if>
</select> </select>
......
...@@ -139,10 +139,10 @@ ...@@ -139,10 +139,10 @@
) d ) d
<where> <where>
<if test="fireEquipmentName!=null"> <if test="fireEquipmentName!=null">
AND d.fireEquipmentName LIKE '%${fireEquipmentName}%' AND d.fireEquipmentName LIKE CONCAT('%',#{fireEquipmentName},'%')
</if> </if>
<if test="equipmentName!=null"> <if test="equipmentName!=null">
AND d.equipmentName LIKE '%${equipmentName}%' AND d.equipmentName LIKE CONCAT('%',#{equipmentName},'%')
</if> </if>
<if test="startTime != null and startTime != ''"> <if test="startTime != null and startTime != ''">
AND d.update_date &gt;= #{startTime} AND d.update_date &gt;= #{startTime}
...@@ -194,10 +194,10 @@ ...@@ -194,10 +194,10 @@
) d ) d
<where> <where>
<if test="fireEquipmentName!=null"> <if test="fireEquipmentName!=null">
AND d.fireEquipmentName LIKE '%${fireEquipmentName}%' AND d.fireEquipmentName LIKE CONCAT('%',#{fireEquipmentName},'%')
</if> </if>
<if test="equipmentName!=null"> <if test="equipmentName!=null">
AND d.equipmentName LIKE '%${equipmentName}%' AND d.equipmentName LIKE CONCAT('%',#{equipmentName},'%')
</if> </if>
<if test="startTime != null and startTime != ''"> <if test="startTime != null and startTime != ''">
AND d.create_date &gt;= #{startTime} AND d.create_date &gt;= #{startTime}
...@@ -207,7 +207,7 @@ ...@@ -207,7 +207,7 @@
</if> </if>
</where> </where>
ORDER BY d.create_date desc ORDER BY d.create_date desc
LIMIT ${start},${length} LIMIT #{start},#{length}
</select> </select>
...@@ -218,14 +218,14 @@ ...@@ -218,14 +218,14 @@
<!-- where--> <!-- where-->
<!-- 1=1--> <!-- 1=1-->
<!-- <if test="equipClassify!=null">--> <!-- <if test="equipClassify!=null">-->
<!-- and fe.equip_classify in ( ${equipClassify} )--> <!-- and fe.equip_classify in ( #{equipClassify} )-->
<!-- </if>--> <!-- </if>-->
<!-- <if test="code!=null">--> <!-- <if test="code!=null">-->
<!-- and fe.`code` like '%${code}%'--> <!-- and fe.`code` like '%#{code}%'-->
<!-- </if>--> <!-- </if>-->
<!-- <if test="name!=null">--> <!-- <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>--> <!-- </if>-->
<!-- &lt;!&ndash; 筛选未绑定的配套设施--> <!-- &lt;!&ndash; 筛选未绑定的配套设施-->
<!-- &ndash;&gt;--> <!-- &ndash;&gt;-->
...@@ -258,14 +258,14 @@ ...@@ -258,14 +258,14 @@
<!-- where 1=1) tmp--> <!-- where 1=1) tmp-->
<!-- <where>--> <!-- <where>-->
<!-- <if test="equipClassify!=null">--> <!-- <if test="equipClassify!=null">-->
<!-- and tmp.equip_classify in ( ${equipClassify} )--> <!-- and tmp.equip_classify in ( #{equipClassify} )-->
<!-- </if>--> <!-- </if>-->
<!-- <if test="code!=null">--> <!-- <if test="code!=null">-->
<!-- and tmp.`code` like '%${code}%'--> <!-- and tmp.`code` like '%#{code}%'-->
<!-- </if>--> <!-- </if>-->
<!-- <if test="name!=null">--> <!-- <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>--> <!-- </if>-->
<!-- &lt;!&ndash; 筛选未绑定的配套设施--> <!-- &lt;!&ndash; 筛选未绑定的配套设施-->
<!-- &ndash;&gt;--> <!-- &ndash;&gt;-->
...@@ -273,7 +273,7 @@ ...@@ -273,7 +273,7 @@
<!-- AND tmp.bindStation is not true--> <!-- AND tmp.bindStation is not true-->
<!-- </if>--> <!-- </if>-->
<!-- </where>--> <!-- </where>-->
<!-- LIMIT ${start},${length}--> <!-- LIMIT #{start},#{length}-->
<!-- </select>--> <!-- </select>-->
...@@ -291,7 +291,7 @@ ...@@ -291,7 +291,7 @@
<!-- FROM--> <!-- FROM-->
<!-- f_fire_station_equipment se--> <!-- f_fire_station_equipment se-->
<!-- WHERE--> <!-- WHERE-->
<!-- se.fire_station_id = ${fireStationId}--> <!-- se.fire_station_id = #{fireStationId}-->
<!-- AND se.fire_equipment_id = fe.id--> <!-- AND se.fire_equipment_id = fe.id-->
<!-- )--> <!-- )-->
<!-- </select>--> <!-- </select>-->
...@@ -507,12 +507,12 @@ ...@@ -507,12 +507,12 @@
f_equipment_fire_equipment efe f_equipment_fire_equipment efe
JOIN f_fire_equipment fe ON efe.fire_equipment_id = fe.id JOIN f_fire_equipment fe ON efe.fire_equipment_id = fe.id
WHERE WHERE
efe.equipment_id = ${equipmentId} efe.equipment_id = #{equipmentId}
<if test="fname != null"> <if test="fname != null">
AND fe.`name` like '%${fname}%' AND fe.`name` like CONCAT('%',#{fname},'%')
</if> </if>
<if test="length > 0"> <if test="length > 0">
LIMIT ${start},${length} ; LIMIT #{start},#{length} ;
</if> </if>
</select> </select>
...@@ -525,9 +525,9 @@ ...@@ -525,9 +525,9 @@
f_equipment_fire_equipment efe f_equipment_fire_equipment efe
JOIN wl_equipment_specific fe ON efe.fire_equipment_id = fe.id JOIN wl_equipment_specific fe ON efe.fire_equipment_id = fe.id
WHERE WHERE
efe.equipment_id = ${equipmentId} efe.equipment_id = #{equipmentId}
<if test="fname != null"> <if test="fname != null">
AND fe.`name` like '%${fname}%' AND fe.`name` like CONCAT('%',#{fname},'%')
</if> </if>
</select> </select>
......
...@@ -149,7 +149,6 @@ ...@@ -149,7 +149,6 @@
<!-- HANDLE_STATE =#{doneResult} ,--> <!-- HANDLE_STATE =#{doneResult} ,-->
<!-- FILE_PATH =#{filePath}--> <!-- FILE_PATH =#{filePath}-->
<!-- where SEQUENCE_NBR = #{req}--> <!-- where SEQUENCE_NBR = #{req}-->
<!-- </update>--> <!-- </update>-->
<!-- <update id="updateDanger">--> <!-- <update id="updateDanger">-->
<!-- UPDATE--> <!-- UPDATE-->
......
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
FROM FROM
f_fmea f f_fmea f
WHERE WHERE
f.risk_source_id = ${riskSourceId}; f.risk_source_id = #{riskSourceId};
</select> </select>
<select id="getById" resultType="com.yeejoin.amos.fas.dao.entity.Fmea"> <select id="getById" resultType="com.yeejoin.amos.fas.dao.entity.Fmea">
......
...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
WHERE WHERE
1=1 1=1
<if test="fireEquipmentId != null"> <if test="fireEquipmentId != null">
and t.fire_equipment_id = ${fireEquipmentId} and t.fire_equipment_id = #{fireEquipmentId}
</if> </if>
<if test="equipmentId != null"> <if test="equipmentId != null">
AND t.equipment_id = ${equipmentId}; AND t.equipment_id = #{equipmentId};
</if> </if>
</select> </select>
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
FROM FROM
f_equipment_fire_equipment t f_equipment_fire_equipment t
WHERE WHERE
t.fire_equipment_id = ${fireEquipmentId} t.fire_equipment_id = #{fireEquipmentId}
AND t.equipment_id = ${equipmentId}; AND t.equipment_id = #{equipmentId};
</select> </select>
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
FROM FROM
f_equipment_fire_equipment efe f_equipment_fire_equipment efe
WHERE WHERE
efe.fire_equipment_id = ${fireEquipmentId} efe.fire_equipment_id = #{fireEquipmentId}
) )
LIMIT 0,1 ; LIMIT 0,1 ;
</select> </select>
...@@ -81,11 +81,11 @@ ...@@ -81,11 +81,11 @@
FROM FROM
f_equipment_fire_equipment efe f_equipment_fire_equipment efe
WHERE WHERE
efe.equipment_id = ${equipmentId} efe.equipment_id = #{equipmentId}
AND efe.fire_equipment_id = fe.id AND efe.fire_equipment_id = fe.id
) )
<if test="start != -1 and length != -1"> <if test="start != -1 and length != -1">
LIMIT ${start},${length} ; LIMIT #{start},#{length} ;
</if> </if>
</select> </select>
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
FROM FROM
f_equipment_fire_equipment efe f_equipment_fire_equipment efe
WHERE WHERE
efe.equipment_id = ${equipmentId} efe.equipment_id = #{equipmentId}
AND efe.fire_equipment_id = fe.id AND efe.fire_equipment_id = fe.id
) )
</select>--> </select>-->
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
FROM FROM
f_equipment_fire_equipment efe f_equipment_fire_equipment efe
WHERE WHERE
efe.equipment_id =${equipmentId} efe.equipment_id =#{equipmentId}
and f.id = efe.fire_equipment_id and f.id = efe.fire_equipment_id
) )
</select> </select>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
FROM FROM
f_equipment_fire_equipment efe f_equipment_fire_equipment efe
WHERE WHERE
efe.fire_equipment_id = ${fireEquipmentId} efe.fire_equipment_id = #{fireEquipmentId}
AND efe.equipment_id = fe.id AND efe.equipment_id = fe.id
) )
</select> </select>
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
ORDER BY ORDER BY
a.id a.id
<if test="start != -1 and length != -1"> <if test="start != -1 and length != -1">
LIMIT ${start},${length} ; LIMIT #{start},#{length} ;
</if> </if>
</select> </select>
...@@ -103,6 +103,6 @@ ...@@ -103,6 +103,6 @@
FROM FROM
f_equipment f_equipment
WHERE WHERE
id = ${id} id = #{id}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -10,6 +10,6 @@ ...@@ -10,6 +10,6 @@
FROM FROM
f_preplan_picture p f_preplan_picture p
WHERE WHERE
p.equipment_id = ${equipmentId} p.equipment_id = #{equipmentId}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
f_rpn_change_log cl f_rpn_change_log cl
WHERE WHERE
cl.type = 0 cl.type = 0
and cl.create_date BETWEEN '${startTime}' and '${endTime}' and cl.create_date BETWEEN #{startTime} and #{endTime}
)d )d
</select> </select>
...@@ -362,7 +362,7 @@ ...@@ -362,7 +362,7 @@
<!-- FROM--> <!-- FROM-->
<!-- f_risk_source_equipment se--> <!-- f_risk_source_equipment se-->
<!-- WHERE--> <!-- WHERE-->
<!-- se.fire_equipment_id = ${fireEquipmentId}--> <!-- se.fire_equipment_id = #{fireEquipmentId}-->
<!-- AND se.risk_source_id = rs.id--> <!-- AND se.risk_source_id = rs.id-->
<!-- )--> <!-- )-->
<!-- </select>--> <!-- </select>-->
...@@ -380,7 +380,7 @@ ...@@ -380,7 +380,7 @@
<!-- FROM--> <!-- FROM-->
<!-- f_risk_source_point_inputitem pi--> <!-- f_risk_source_point_inputitem pi-->
<!-- WHERE--> <!-- WHERE-->
<!-- pi.point_id = ${pointId}--> <!-- pi.point_id = #{pointId}-->
<!-- AND rs.id = pi.risk_source_id--> <!-- AND rs.id = pi.risk_source_id-->
<!-- )--> <!-- )-->
<!-- </select>--> <!-- </select>-->
...@@ -526,7 +526,7 @@ ...@@ -526,7 +526,7 @@
FROM FROM
f_risk_source rs f_risk_source rs
WHERE WHERE
rs.id = ${riskSourceId}; rs.id = #{riskSourceId};
</select> </select>
<select id="queryForRiskSourceRpni" resultType="map"> <select id="queryForRiskSourceRpni" resultType="map">
...@@ -535,7 +535,7 @@ ...@@ -535,7 +535,7 @@
FROM FROM
f_risk_source rs f_risk_source rs
WHERE WHERE
rs.parent_id = ${parentId}; rs.parent_id = #{parentId};
</select> </select>
<select id="queryForUnqualified" resultType="map"> <select id="queryForUnqualified" resultType="map">
...@@ -638,7 +638,7 @@ ...@@ -638,7 +638,7 @@
f_fmea ff f_fmea ff
JOIN f_risk_factor rf ON ff.risk_factors_id = rf.id JOIN f_risk_factor rf ON ff.risk_factors_id = rf.id
WHERE WHERE
rf.id = ${factorId} rf.id = #{factorId}
) )
</select> </select>
<!-- <select id="queryContingencyWater" resultType="com.yeejoin.amos.fas.business.vo.FormInstanceVo">--> <!-- <select id="queryContingencyWater" resultType="com.yeejoin.amos.fas.business.vo.FormInstanceVo">-->
...@@ -734,8 +734,8 @@ ...@@ -734,8 +734,8 @@
INNER JOIN p_point_inputitem ppi ON ppi.ID = ffpi.point_inputitem_id) ffpi INNER JOIN p_point_inputitem ppi ON ppi.ID = ffpi.point_inputitem_id) ffpi
ON ffpi.fmea_id = ff.id ON ffpi.fmea_id = ff.id
WHERE WHERE
ffpi.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 f_risk_source_point_inputitem frspi WHERE frspi.risk_source_id = frs.id AND frspi.point_id = #{pointId} )
# EXISTS ( SELECT # EXISTS ( SELECT
# 1 # 1
# FROM # FROM
...@@ -744,7 +744,7 @@ ...@@ -744,7 +744,7 @@
# LEFT JOIN p_point_inputitem ppi on ppi.id = fpi.point_inputitem_id # LEFT JOIN p_point_inputitem ppi on ppi.id = fpi.point_inputitem_id
# WHERE # WHERE
# f.risk_source_id = frs.id # f.risk_source_id = frs.id
# AND ppi.point_id = ${pointId} # AND ppi.point_id = #{pointId}
# ) # )
</select> </select>
......
...@@ -612,8 +612,8 @@ ...@@ -612,8 +612,8 @@
<where> <where>
<if test="inputText!=null and inputText != ''"> <if test="inputText!=null and inputText != ''">
( (
tmp.code LIKE '%${inputText}%' tmp.code LIKE '%#{inputText}%'
OR tmp.name LIKE '%${inputText}%' OR tmp.name LIKE '%#{inputText}%'
) )
</if> </if>
<if test="type!=null and type!=''"> <if test="type!=null and type!=''">
...@@ -1070,8 +1070,8 @@ ...@@ -1070,8 +1070,8 @@
<where> <where>
<if test="inputText!=null and inputText != ''"> <if test="inputText!=null and inputText != ''">
AND ( AND (
tmp.code LIKE '%${inputText}%' tmp.code LIKE CONCAT('%',#{inputText},'%')
OR tmp.name LIKE '%${inputText}%' OR tmp.name LIKE CONCAT('%',#{inputText},'%')
) )
</if> </if>
<if test="type!=null and type!=''"> <if test="type!=null and type!=''">
...@@ -1081,7 +1081,7 @@ ...@@ -1081,7 +1081,7 @@
AND tmp.riskSourceId = #{riskSourceId} AND tmp.riskSourceId = #{riskSourceId}
</if> </if>
</where> </where>
LIMIT ${start},${length} LIMIT #{start},#{length}
</select> </select>
<select id="retrieve3AllCount" resultType="long"> <select id="retrieve3AllCount" resultType="long">
SELECT count(1) FROM ( SELECT count(1) FROM (
...@@ -1277,8 +1277,8 @@ ...@@ -1277,8 +1277,8 @@
<where> <where>
<if test="inputText!=null and inputText != ''"> <if test="inputText!=null and inputText != ''">
AND ( AND (
tmp.code LIKE '%${inputText}%' tmp.code LIKE CONCAT('%',#{inputText},'%')
OR tmp.name LIKE '%${inputText}%' OR tmp.name LIKE CONCAT('%',#{inputText},'%')
) )
</if> </if>
<if test="type!=null and type!=''"> <if test="type!=null and type!=''">
...@@ -1486,8 +1486,8 @@ ...@@ -1486,8 +1486,8 @@
<where> <where>
<if test="inputText!=null and inputText != ''"> <if test="inputText!=null and inputText != ''">
AND ( AND (
tmp.code LIKE '%${inputText}%' tmp.code LIKE '%#{inputText}%'
OR tmp.name LIKE '%${inputText}%' OR tmp.name LIKE '%#{inputText}%'
) )
</if> </if>
<if test="type!=null and type!=''"> <if test="type!=null and type!=''">
...@@ -1500,7 +1500,7 @@ ...@@ -1500,7 +1500,7 @@
AND (tmp.orgCode = #{orgCode} OR tmp.orgCode like CONCAT(#{orgCode},'-%') ) AND (tmp.orgCode = #{orgCode} OR tmp.orgCode like CONCAT(#{orgCode},'-%') )
</if> </if>
</where> </where>
LIMIT ${start},${length} LIMIT #{start},#{length}
</select> </select>
<select id="getPlanAlarmInfo" resultType="com.yeejoin.amos.fas.business.bo.FirePlanAlarmBo"> <select id="getPlanAlarmInfo" resultType="com.yeejoin.amos.fas.business.bo.FirePlanAlarmBo">
SELECT SELECT
......
...@@ -214,6 +214,11 @@ ...@@ -214,6 +214,11 @@
<artifactId>easypoi-annotation</artifactId> <artifactId>easypoi-annotation</artifactId>
<version>3.0.3</version> <version>3.0.3</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <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