|
@@ -12,11 +12,19 @@ import org.springblade.manager.dto.ElementData;
|
|
|
import org.springblade.manager.dto.FormData;
|
|
|
import org.springblade.manager.entity.Formula;
|
|
|
|
|
|
+import java.io.ByteArrayInputStream;
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
+import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.util.*;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.zip.Deflater;
|
|
|
+import java.util.zip.DeflaterOutputStream;
|
|
|
+import java.util.zip.Inflater;
|
|
|
+import java.util.zip.InflaterInputStream;
|
|
|
|
|
|
/**
|
|
|
* @author yangyj
|
|
@@ -317,17 +325,40 @@ public class FormulaUtils {
|
|
|
/**从元素名称中解析项目名称*/
|
|
|
public static final Set<String> EX_WORD=new HashSet<String>(){{add("或");}};
|
|
|
public static String parseItemName(String eName){
|
|
|
- String[] candidate= StringUtils.handleNull(eName).replaceAll("[\\t\\n\\s+]","").split("[((].+[))]|_");
|
|
|
+ String[] candidate= StringUtils.handleNull(eName).replaceAll("[\\t\\n\\s+]","").split("[((_]");
|
|
|
if(candidate.length>0){
|
|
|
- return Arrays.stream(candidate).map(s->s.replaceAll("[^\\u4e00-\\u9fa5]+","").replaceAll("(总数|抽测|实测|偏差|设计|合格)[率值]?","")).filter(s->!EX_WORD.contains(s)&&StringUtils.isNotEmpty(s)).collect(Collectors.joining());
|
|
|
+ return Arrays.stream(candidate).map(s->s.replaceAll("[^\\u4e00-\\u9fa5]+","").replaceAll("(在合格标准内|满足设计要求|质量评定|评定|判定|项目|总数|抽测|实测|偏差|设计|合格)[率值]?","")).filter(s->!EX_WORD.contains(s)&&StringUtils.isNotEmpty(s)).collect(Collectors.joining());
|
|
|
}
|
|
|
return eName;
|
|
|
}
|
|
|
|
|
|
+ public static byte[] compress(String data) throws IOException {
|
|
|
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
|
+ DeflaterOutputStream dos = new DeflaterOutputStream(bos, new Deflater(Deflater.BEST_COMPRESSION));
|
|
|
+ dos.write(data.getBytes(StandardCharsets.UTF_8));
|
|
|
+ dos.close();
|
|
|
+ return bos.toByteArray();
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String decompress(byte[] data) throws IOException {
|
|
|
+ ByteArrayInputStream bis = new ByteArrayInputStream(data);
|
|
|
+ InflaterInputStream iis = new InflaterInputStream(bis, new Inflater());
|
|
|
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
|
+ byte[] buffer = new byte[1024];
|
|
|
+ int len;
|
|
|
+ while ((len = iis.read(buffer)) > 0) {
|
|
|
+ bos.write(buffer, 0, len);
|
|
|
+ }
|
|
|
+ iis.close();
|
|
|
+ bos.close();
|
|
|
+ return new String(bos.toByteArray(), StandardCharsets.UTF_8);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// public static void main(String[] args) {
|
|
|
// List<String> list =Arrays.asList(
|
|
|
-// "压 实 度 (%)下路床 特重、极重交通荷载等级 设计值"
|
|
|
+// ""
|
|
|
+// ,"压 实 度 (%)下路床 特重、极重交通荷载等级 设计值"
|
|
|
// ,"1△_压 实 度 (%)_下路床_轻、中及重交通 荷载等级_0.3m~0.8m_≧96_≧95_≧94_实测值或实测偏差值"
|
|
|
// ,"1△_压 实 度 (%)_下路提_轻、中及重交通 荷载等级_>1.5m_≧93_≧92_≧90_实测值或实测偏差值"
|
|
|
// ,"1△_压 实 度 (%)_上路提_轻、中及重交通 荷载等级_0.8m~1.5m_≧94_≧94_≧93_实测值或实测偏差值"
|
|
@@ -341,7 +372,12 @@ public class FormulaUtils {
|
|
|
// ,"受力钢筋间距 (mm)同排 梁、板、拱肋及拱上建筑 合格率"
|
|
|
// ," 箍筋、构造钢筋、螺旋筋间距(mm) 设计值"
|
|
|
// ,"箍筋、构造钢筋、螺旋筋间距(mm) 合格率"
|
|
|
-//
|
|
|
+// ,"实测项目_桩位 (mm)_群桩_≤100_质量评定_合格判定"
|
|
|
+// ,"实测项目_桩位 (mm)_群桩_≤100_实测值或实测偏差值"
|
|
|
+// ,"实测项目_桩位 (mm)_排架桩_实测值或实测偏差值"
|
|
|
+// ,"实测项目_桩位 (mm)_排架桩_质量评定_合格判定"
|
|
|
+// ,"实测项目_桩位 (mm)_群桩_≤100_质量评定_合格率(%)"
|
|
|
+// ,"实测项目_桩位 (mm)_排架桩_质量评定_合格率(%)"
|
|
|
// );
|
|
|
// list.stream().map(FormulaUtils::parseItemName).forEach(System.out::println);
|
|
|
// }
|