|
@@ -2,7 +2,6 @@ package com.mixsmart.utils;
|
|
|
|
|
|
|
|
|
|
import com.jfireel.expression.Expression;
|
|
import com.jfireel.expression.Expression;
|
|
-import com.mixsmart.security.SecurityUtils;
|
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
import org.apache.commons.collections4.MapUtils;
|
|
import org.springblade.core.tool.utils.CollectionUtil;
|
|
import org.springblade.core.tool.utils.CollectionUtil;
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.Func;
|
|
@@ -540,7 +539,7 @@ public class CustomFunction {
|
|
public static String createStation(Object stationType) {
|
|
public static String createStation(Object stationType) {
|
|
if(StringUtils.isNotEmpty(stationType)) {
|
|
if(StringUtils.isNotEmpty(stationType)) {
|
|
|
|
|
|
- Matcher m = matcher("[~|-]",handleNull(stationType));
|
|
|
|
|
|
+ Matcher m = RegexUtils.matcher("[~|-]",handleNull(stationType));
|
|
if(m.find()){
|
|
if(m.find()){
|
|
StringBuilder sb = new StringBuilder();
|
|
StringBuilder sb = new StringBuilder();
|
|
String splitchar = m.group(0);
|
|
String splitchar = m.group(0);
|
|
@@ -558,10 +557,6 @@ public class CustomFunction {
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|
|
|
|
|
|
- public static Matcher matcher(String regex, String value) {
|
|
|
|
- Pattern pattern = Pattern.compile(regex);
|
|
|
|
- return pattern.matcher(value);
|
|
|
|
- }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description 记录表5输入桩号代码解析,2G1#1+100>>2G1K0+100
|
|
* @Description 记录表5输入桩号代码解析,2G1#1+100>>2G1K0+100
|
|
@@ -576,7 +571,7 @@ public class CustomFunction {
|
|
String stakeStr = StringUtils.repaceBlank(stake.toString().toUpperCase());
|
|
String stakeStr = StringUtils.repaceBlank(stake.toString().toUpperCase());
|
|
Matcher m ;
|
|
Matcher m ;
|
|
if(stake.toString().contains("+")){
|
|
if(stake.toString().contains("+")){
|
|
- m = matcher("(([A-Z0-9]*)(#\\d*)?)\\+([\\d||\\.]*)", stakeStr);
|
|
|
|
|
|
+ m = RegexUtils.matcher("(([A-Z0-9]*)(#\\d*)?)\\+([\\d||\\.]*)", stakeStr);
|
|
if(m.find()){
|
|
if(m.find()){
|
|
String partNoD = m.group(1);
|
|
String partNoD = m.group(1);
|
|
String partNoV = m.group(2);
|
|
String partNoV = m.group(2);
|
|
@@ -586,7 +581,7 @@ public class CustomFunction {
|
|
result[2]=kilometer;
|
|
result[2]=kilometer;
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
- m =matcher("([A-Z]*)([\\d||\\.]*)", stakeStr);
|
|
|
|
|
|
+ m =RegexUtils.matcher("([A-Z]*)([\\d||\\.]*)", stakeStr);
|
|
if(m.find()){
|
|
if(m.find()){
|
|
String partNo = m.group(1);
|
|
String partNo = m.group(1);
|
|
String kilometer = m.group(2);
|
|
String kilometer = m.group(2);
|
|
@@ -603,8 +598,8 @@ public class CustomFunction {
|
|
String[] result = new String[]{"",""};
|
|
String[] result = new String[]{"",""};
|
|
if(StringUtils.isNotEmpty(stake)){
|
|
if(StringUtils.isNotEmpty(stake)){
|
|
String stakeStr = StringUtils.repaceBlank(stake.toString().toUpperCase());
|
|
String stakeStr = StringUtils.repaceBlank(stake.toString().toUpperCase());
|
|
- Matcher m = matcher("([A-Z0-9]{0,3})K(\\d{1,3})\\+([\\d||\\.]*)", stakeStr);
|
|
|
|
- Matcher m2 = matcher("([A-Z]{0,3})([\\d||\\.]+)", stakeStr);
|
|
|
|
|
|
+ Matcher m = RegexUtils.matcher("([A-Z0-9]{0,3})K(\\d{1,3})\\+([\\d||\\.]*)", stakeStr);
|
|
|
|
+ Matcher m2 = RegexUtils.matcher("([A-Z]{0,3})([\\d||\\.]+)", stakeStr);
|
|
if(m.find()){
|
|
if(m.find()){
|
|
String partNo = m.group(1);
|
|
String partNo = m.group(1);
|
|
double km = Double.parseDouble(m.group(2));
|
|
double km = Double.parseDouble(m.group(2));
|
|
@@ -633,7 +628,7 @@ public class CustomFunction {
|
|
if(StringUtils.isNotEmpty(n)){
|
|
if(StringUtils.isNotEmpty(n)){
|
|
String[] sa = n.toString().split(",");
|
|
String[] sa = n.toString().split(",");
|
|
for(String s:sa){
|
|
for(String s:sa){
|
|
- Matcher m = matcher("(\\d)+.(\\d)+",s);
|
|
|
|
|
|
+ Matcher m = RegexUtils.matcher("(\\d)+.(\\d)+",s);
|
|
if(m.find()){
|
|
if(m.find()){
|
|
max=Math.max(new StringBuilder(m.group()).reverse().toString().indexOf("."),max);
|
|
max=Math.max(new StringBuilder(m.group()).reverse().toString().indexOf("."),max);
|
|
}
|
|
}
|
|
@@ -1071,7 +1066,7 @@ public class CustomFunction {
|
|
* @Date 2021.09.17 14:31
|
|
* @Date 2021.09.17 14:31
|
|
**/
|
|
**/
|
|
public static boolean containsZH(Object chars){
|
|
public static boolean containsZH(Object chars){
|
|
- Matcher m =matcher("[\u4e00-\u9fa5]",handleNull(chars));
|
|
|
|
|
|
+ Matcher m =RegexUtils.matcher("[\u4e00-\u9fa5]",handleNull(chars));
|
|
return m.find();
|
|
return m.find();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1083,7 +1078,7 @@ public class CustomFunction {
|
|
* @Date 2021.09.17 14:31
|
|
* @Date 2021.09.17 14:31
|
|
**/
|
|
**/
|
|
public static boolean containsD(Object chars){
|
|
public static boolean containsD(Object chars){
|
|
- Matcher m =matcher("\\d",handleNull(chars));
|
|
|
|
|
|
+ Matcher m =RegexUtils.matcher("\\d",handleNull(chars));
|
|
return m.find();
|
|
return m.find();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1151,10 +1146,6 @@ public class CustomFunction {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- private static Object crack(String password){
|
|
|
|
-// return SecurityUtils.desDecode(password, SSOUtils.getSecretKey());
|
|
|
|
- return SecurityUtils.desDecode(password, "qazwertyuioptgb");
|
|
|
|
- }
|
|
|
|
/**
|
|
/**
|
|
* @Description 计算t1~t2,t3~t4 两个时间段的合计时间,unit 输入数值的单位
|
|
* @Description 计算t1~t2,t3~t4 两个时间段的合计时间,unit 输入数值的单位
|
|
* @Param [t1, t2, t3, t4, unit]
|
|
* @Param [t1, t2, t3, t4, unit]
|
|
@@ -1177,7 +1168,7 @@ public class CustomFunction {
|
|
**/
|
|
**/
|
|
public static Object dateFormatter(Object date,Object format){
|
|
public static Object dateFormatter(Object date,Object format){
|
|
if(StringUtils.isNotEmpty(date)&&StringUtils.isNotEmpty(format)){
|
|
if(StringUtils.isNotEmpty(date)&&StringUtils.isNotEmpty(format)){
|
|
- Matcher m = matcher("(\\d{4})\\D(\\d{2})\\D(\\d{2})日?\\s*(\\d{0,2})(\\D\\d{1,2})?",date.toString());
|
|
|
|
|
|
+ Matcher m = RegexUtils.matcher("(\\d{4})\\D(\\d{2})\\D(\\d{2})日?\\s*(\\d{0,2})(\\D\\d{1,2})?",date.toString());
|
|
if(m.find()){
|
|
if(m.find()){
|
|
String yyyy = handleNull(m.group(1));
|
|
String yyyy = handleNull(m.group(1));
|
|
String MM = handleNull(m.group(2));
|
|
String MM = handleNull(m.group(2));
|
|
@@ -1407,7 +1398,7 @@ public class CustomFunction {
|
|
}
|
|
}
|
|
if(!dateStr.contains("-")){
|
|
if(!dateStr.contains("-")){
|
|
dateStr=StringUtils.repaceBlank(dateStr);
|
|
dateStr=StringUtils.repaceBlank(dateStr);
|
|
- Matcher m = matcher("\\d{4}(.)\\d{2}(.)\\d{2}(.?)",dateStr);
|
|
|
|
|
|
+ Matcher m = RegexUtils.matcher("\\d{4}(.)\\d{2}(.)\\d{2}(.?)",dateStr);
|
|
if(m.find()){
|
|
if(m.find()){
|
|
Set<String> set = new HashSet<>();
|
|
Set<String> set = new HashSet<>();
|
|
set.add(m.group(1));
|
|
set.add(m.group(1));
|
|
@@ -1436,7 +1427,7 @@ public class CustomFunction {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
if(!dateStr.contains("-")){
|
|
if(!dateStr.contains("-")){
|
|
- Matcher m = matcher("\\d{4}(.)\\d{2}(.)\\d{2}(日?)",dateStr);
|
|
|
|
|
|
+ Matcher m = RegexUtils.matcher("\\d{4}(.)\\d{2}(.)\\d{2}(日?)",dateStr);
|
|
if(m.find()){
|
|
if(m.find()){
|
|
Set<String> set = new HashSet<>();
|
|
Set<String> set = new HashSet<>();
|
|
set.add(m.group(1));
|
|
set.add(m.group(1));
|
|
@@ -1516,7 +1507,7 @@ public class CustomFunction {
|
|
|
|
|
|
|
|
|
|
public static Object k2d(Object k){
|
|
public static Object k2d(Object k){
|
|
- Matcher mt = matcher("[A-Z]*(\\d*)\\+([\\d|\\.]*)",k.toString());
|
|
|
|
|
|
+ Matcher mt = RegexUtils.matcher("[A-Z]*(\\d*)\\+([\\d|\\.]*)",k.toString());
|
|
if(mt.find()){
|
|
if(mt.find()){
|
|
return Double.parseDouble(mt.group(1))*1000+Double.parseDouble(mt.group(2));
|
|
return Double.parseDouble(mt.group(1))*1000+Double.parseDouble(mt.group(2));
|
|
}
|
|
}
|
|
@@ -2188,7 +2179,7 @@ public class CustomFunction {
|
|
String s = handleNull(e);
|
|
String s = handleNull(e);
|
|
if(StringUtils.isNotEmpty(s)){
|
|
if(StringUtils.isNotEmpty(s)){
|
|
if(containsZH(s)){
|
|
if(containsZH(s)){
|
|
- Matcher m =matcher("[\u4e00-\u9fa5]+(\\d+)\\D*合格(\\d+)\\D+",s);
|
|
|
|
|
|
+ Matcher m =RegexUtils.matcher("[\u4e00-\u9fa5]+(\\d+)\\D*合格(\\d+)\\D+",s);
|
|
if(m.find()){
|
|
if(m.find()){
|
|
checkpoints+=Integer.parseInt(m.group(1));
|
|
checkpoints+=Integer.parseInt(m.group(1));
|
|
passpoints+=Integer.parseInt(m.group(2));
|
|
passpoints+=Integer.parseInt(m.group(2));
|
|
@@ -2603,7 +2594,7 @@ public class CustomFunction {
|
|
if(!StringUtils.isNumber(scale)){
|
|
if(!StringUtils.isNumber(scale)){
|
|
scale=0;
|
|
scale=0;
|
|
}
|
|
}
|
|
- Matcher m = matcher("(-?\\d+(\\.\\d+)?)[h|H]?[,|,](\\+?\\d+(\\.\\d+)?)[h|H]?",dev.toString().replaceAll("[(|)]",""));
|
|
|
|
|
|
+ Matcher m = RegexUtils.matcher("(-?\\d+(\\.\\d+)?)[h|H]?[,|,](\\+?\\d+(\\.\\d+)?)[h|H]?",dev.toString().replaceAll("[(|)]",""));
|
|
if(list instanceof List&&m.find()){
|
|
if(list instanceof List&&m.find()){
|
|
List<Object> arrayList = (ArrayList<Object>) list;
|
|
List<Object> arrayList = (ArrayList<Object>) list;
|
|
double tick=0;
|
|
double tick=0;
|
|
@@ -2839,7 +2830,7 @@ public class CustomFunction {
|
|
* @Date 2021.01.08 16:31
|
|
* @Date 2021.01.08 16:31
|
|
**/
|
|
**/
|
|
public static Object matcherFindGroup(String regex, String value ,int i,boolean g){
|
|
public static Object matcherFindGroup(String regex, String value ,int i,boolean g){
|
|
- Matcher m = matcher(regex,value);
|
|
|
|
|
|
+ Matcher m = RegexUtils.matcher(regex,value);
|
|
List<Object> result = new ArrayList<>();
|
|
List<Object> result = new ArrayList<>();
|
|
while (m.find()){
|
|
while (m.find()){
|
|
result.add(m.group(i));
|
|
result.add(m.group(i));
|
|
@@ -2886,7 +2877,7 @@ public class CustomFunction {
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
List<Object> datas = Arrays.asList(o.toString().split("[、, ,]"));
|
|
List<Object> datas = Arrays.asList(o.toString().split("[、, ,]"));
|
|
- Matcher m = matcher("[、, ,]",o.toString());
|
|
|
|
|
|
+ Matcher m = RegexUtils.matcher("[、, ,]",o.toString());
|
|
String s="、";
|
|
String s="、";
|
|
if(m.find()){
|
|
if(m.find()){
|
|
s=handleNull(m.group());
|
|
s=handleNull(m.group());
|
|
@@ -2965,7 +2956,7 @@ public class CustomFunction {
|
|
for(int i=0;i<stakes.size();i++){
|
|
for(int i=0;i<stakes.size();i++){
|
|
Object cp = stakes.get(i);
|
|
Object cp = stakes.get(i);
|
|
if(StringUtils.isNotEmpty(cp)&&StringUtils.isNotEquals(bmd,cp)){
|
|
if(StringUtils.isNotEmpty(cp)&&StringUtils.isNotEquals(bmd,cp)){
|
|
- Matcher m = matcher("(?i)zd\\d+",cp.toString());
|
|
|
|
|
|
+ Matcher m = RegexUtils.matcher("(?i)zd\\d+",cp.toString());
|
|
if(!m.find()){
|
|
if(!m.find()){
|
|
result.add(dx.get(i));
|
|
result.add(dx.get(i));
|
|
}
|
|
}
|
|
@@ -2986,7 +2977,7 @@ public class CustomFunction {
|
|
if(StringUtils.isNotEmpty(bmd)){
|
|
if(StringUtils.isNotEmpty(bmd)){
|
|
for (Object cp : stakes) {
|
|
for (Object cp : stakes) {
|
|
if (StringUtils.isNotEmpty(cp) && StringUtils.isNotEquals(bmd, cp)) {
|
|
if (StringUtils.isNotEmpty(cp) && StringUtils.isNotEquals(bmd, cp)) {
|
|
- Matcher m = matcher("(?i)zd\\d+", cp.toString());
|
|
|
|
|
|
+ Matcher m = RegexUtils.matcher("(?i)zd\\d+", cp.toString());
|
|
if (!m.find()) {
|
|
if (!m.find()) {
|
|
result.add(cp);
|
|
result.add(cp);
|
|
}
|
|
}
|
|
@@ -3012,7 +3003,7 @@ public class CustomFunction {
|
|
for(int i=0;i<cds.size();i++){
|
|
for(int i=0;i<cds.size();i++){
|
|
Object cp = cds.get(i);
|
|
Object cp = cds.get(i);
|
|
if(StringUtils.isNotEmpty(cp)&&StringUtils.isNotEquals(bmd,cp)){
|
|
if(StringUtils.isNotEmpty(cp)&&StringUtils.isNotEquals(bmd,cp)){
|
|
- Matcher m = matcher("(?i)zd\\d+",cp.toString());
|
|
|
|
|
|
+ Matcher m = RegexUtils.matcher("(?i)zd\\d+",cp.toString());
|
|
if(!m.find()){
|
|
if(!m.find()){
|
|
if(StringUtils.isNumber(cp)){
|
|
if(StringUtils.isNumber(cp)){
|
|
result.add("");
|
|
result.add("");
|
|
@@ -3056,7 +3047,7 @@ public class CustomFunction {
|
|
for(int i=0;i<cds.size();i++){
|
|
for(int i=0;i<cds.size();i++){
|
|
Object cp = cds.get(i);
|
|
Object cp = cds.get(i);
|
|
if(StringUtils.isNotEmpty(cp)&&StringUtils.isNotEquals(bmd,cp)){
|
|
if(StringUtils.isNotEmpty(cp)&&StringUtils.isNotEquals(bmd,cp)){
|
|
- Matcher m = matcher("(?i)zd\\d+",cp.toString());
|
|
|
|
|
|
+ Matcher m = RegexUtils.matcher("(?i)zd\\d+",cp.toString());
|
|
if(!m.find()){
|
|
if(!m.find()){
|
|
if(StringUtils.isNumber(cp)){
|
|
if(StringUtils.isNumber(cp)){
|
|
dyn.add(handleNull(dxs.get(i)));
|
|
dyn.add(handleNull(dxs.get(i)));
|
|
@@ -3089,7 +3080,7 @@ public class CustomFunction {
|
|
for(int i=0;i<cds.size();i++){
|
|
for(int i=0;i<cds.size();i++){
|
|
Object cp = cds.get(i);
|
|
Object cp = cds.get(i);
|
|
if(StringUtils.isNotEmpty(cp)&&StringUtils.isNotEquals(bmd,cp)){
|
|
if(StringUtils.isNotEmpty(cp)&&StringUtils.isNotEquals(bmd,cp)){
|
|
- Matcher m = matcher("(?i)zd\\d+",cp.toString());
|
|
|
|
|
|
+ Matcher m = RegexUtils.matcher("(?i)zd\\d+",cp.toString());
|
|
if(!m.find()){
|
|
if(!m.find()){
|
|
if(StringUtils.isEquals(mode,0)){
|
|
if(StringUtils.isEquals(mode,0)){
|
|
if(!Pattern.matches(".+(?i)v$",cp.toString())){
|
|
if(!Pattern.matches(".+(?i)v$",cp.toString())){
|