修改正则表达式可以匹配'`?`'的形式

main
youHong.ai 2022-12-06 19:21:31 +08:00
parent e83d55c455
commit 501bddf2f1
5 changed files with 46 additions and 27 deletions

1
.gitignore vendored
View File

@ -39,6 +39,7 @@ DirectoryV2.xml
/lib/weaverLib/ /lib/weaverLib/
*.groovy *.groovy
*.log *.log
*.iml
src/main/resources/WEB-INF/sqllog/ src/main/resources/WEB-INF/sqllog/
java.io.tempdir/ java.io.tempdir/

View File

@ -73,8 +73,7 @@ import java.util.zip.ZipEntry;
/** /**
* @author EBU7-dev1-ayh * @author EBU7-dev1-ayh
* @date 2021/8/23 0023 11:42 * @date 2021/8/23 0023 11:42 mybatisTest.dao
* mybatisTest.dao
*/ */
@ -91,16 +90,15 @@ public class Util extends weaver.general.Util {
public static final char UNICODE_END = 65374; public static final char UNICODE_END = 65374;
public static final char DBC_SBC_STEP = 65248; // 全角半角转换间隔 public static final char DBC_SBC_STEP = 65248; // 全角半角转换间隔
public static final ExecutorService threadPool = ThreadPoolConfig.createThreadPoolInstance(); public static final ExecutorService threadPool = ThreadPoolConfig.createThreadPoolInstance();
public static final String UF_CUS_DEV_CONFIG = "uf_cus_dev_config";
private static final UtilService utilService = new UtilService(); private static final UtilService utilService = new UtilService();
private static final RecordsetUtil recordsetUtil = new RecordsetUtil(); private static final RecordsetUtil recordsetUtil = new RecordsetUtil();
private static final UtilMapper mapper = recordsetUtil.getMapper(UtilMapper.class); private static final UtilMapper mapper = recordsetUtil.getMapper(UtilMapper.class);
public static final String UF_CUS_DEV_CONFIG = "uf_cus_dev_config"; private static final Map<String, Logger> otherLog = new HashMap<>(8);
static ToolUtil toolUtil = new ToolUtil(); static ToolUtil toolUtil = new ToolUtil();
private static RecordSet rs; private static RecordSet rs;
private static volatile Logger log = null; private static volatile Logger log = null;
private static final Map<String, Logger> otherLog = new HashMap<>(8);
static { static {
try { try {
rs = new RecordSet(); rs = new RecordSet();
@ -3463,7 +3461,7 @@ public class Util extends weaver.general.Util {
// 最终通过反射调用weaver.aiyh_jitu.pushdata.service.GetAssignProcessorProcessorImpl类将参数传递给这个类 // 最终通过反射调用weaver.aiyh_jitu.pushdata.service.GetAssignProcessorProcessorImpl类将参数传递给这个类
// String pattern = "&?(?<key>([#.\\w\\u4E00-\\u9FA5]+))=(?<value>((#(\\{|sql\\{))?([()\\-$#={ }.\\w\\u4E00-\\u9FA5?]+)?}?))&?"; // String pattern = "&?(?<key>([#.\\w\\u4E00-\\u9FA5]+))=(?<value>((#(\\{|sql\\{))?([()\\-$#={ }.\\w\\u4E00-\\u9FA5?]+)?}?))&?";
String pattern = "&?(?<key>([#.\\w\\u4E00-\\u9FA5]+))=" + String pattern = "&?(?<key>([#.\\w\\u4E00-\\u9FA5]+))=" +
"(?<value>((`([():/\\-&$#={ }.\\w\\u4E00-\\u9FA5?]*)`)|" + "(?<value>((`([():/\\-&?$#={ }.\\w\\u4E00-\\u9FA5?]*)`)|" +
"((#(\\{|sql\\{))?([():/\\-$#={ }.\\w\\u4E00-\\u9FA5?]+)?}?)))&?"; "((#(\\{|sql\\{))?([():/\\-$#={ }.\\w\\u4E00-\\u9FA5?]+)?}?)))&?";
Pattern compile = Pattern.compile(pattern); Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher(paramStr); Matcher matcher = compile.matcher(paramStr);

View File

@ -57,7 +57,28 @@ public class OrgChartService {
Builder.startSet(item).with(HrmResourceDto::setShow, 1).with(HrmResourceDto::setShowBrother, 1).with(HrmResourceDto::setShowChildren, 1).with(HrmResourceDto::setCurrent, true).endSet(); Builder.startSet(item).with(HrmResourceDto::setShow, 1).with(HrmResourceDto::setShowBrother, 1).with(HrmResourceDto::setShowChildren, 1).with(HrmResourceDto::setCurrent, true).endSet();
currentUser.set(item); currentUser.set(item);
}); });
Assert.notNull(currentUser, "not find current login user info!"); /* ******************* 系统管理员默认全部展开哦 ******************* */
if (userId == 1) {
List<OrgChartNodeVo> collect = hrmResourceDtoList.stream()
.map(struct::hrmResourceDtoToVo)
.peek(item -> Builder.startSet(item)
.with(OrgChartNodeVo::setShow, 1)
.with(OrgChartNodeVo::setShowBrother, 1)
.with(OrgChartNodeVo::setShowChildren, 1)
.with(OrgChartNodeVo::setCurrent, true)
.endSet())
.collect(Collectors.toList());
return Util.listToTree(collect, OrgChartNodeVo::getId, OrgChartNodeVo::getManagerId,
OrgChartNodeVo::getChildren, OrgChartNodeVo::setChildren,
parentId -> parentId == null || parentId <= 0)
.stream().peek(item -> Builder.startSet(item)
.with(OrgChartNodeVo::setIsRoot, true)
.with(OrgChartNodeVo::setCurrentParent, true)
.endSet())
.peek(item -> recursionChildrenNums(item, 0))
.collect(Collectors.toList());
}
Assert.notNull(currentUser.get(), "not find current login user info!");
/* ******************* 查找当前登陆人员的所有上级 ******************* */ /* ******************* 查找当前登陆人员的所有上级 ******************* */
String currentUserManagerStr = currentUser.get().getManagerStr(); String currentUserManagerStr = currentUser.get().getManagerStr();
if (Objects.isNull(currentUserManagerStr)) { if (Objects.isNull(currentUserManagerStr)) {
@ -100,8 +121,7 @@ public class OrgChartService {
* *
* @param chartNodeVo * @param chartNodeVo
* @return Integer * @return Integer
* @author youHong.ai * @author youHong.ai ******************************************
* ******************************************
*/ */
private Integer recursionChildrenNums(OrgChartNodeVo chartNodeVo, int n) { private Integer recursionChildrenNums(OrgChartNodeVo chartNodeVo, int n) {
List<OrgChartNodeVo> children = chartNodeVo.getChildren(); List<OrgChartNodeVo> children = chartNodeVo.getChildren();

View File

@ -540,8 +540,7 @@ public class DealWithMapping extends ToolUtil {
* *
* <h1>:</h1> * <h1>:</h1>
* <p> * <p>
* v2.0 xuanran.wang * v2.0 xuanran.wang {?requestid}requestid {?}
* {?requestid}requestid {?}
* <p> * <p>
*/ */
private Object normalValueDeal(Map<String, Object> mainMap, Map<String, Object> detailMap, MappingDetail mappingDetail) { private Object normalValueDeal(Map<String, Object> mainMap, Map<String, Object> detailMap, MappingDetail mappingDetail) {
@ -570,7 +569,7 @@ public class DealWithMapping extends ToolUtil {
case DEFAULT_VALUE: { case DEFAULT_VALUE: {
FieldMessage fieldMassage = mappingDetail.getFieldMassage(); FieldMessage fieldMassage = mappingDetail.getFieldMassage();
String workFlowVal = ""; String workFlowVal = "";
if(fieldMassage != null){ if (fieldMassage != null) {
String fieldName = fieldMassage.getFieldName().toLowerCase(); String fieldName = fieldMassage.getFieldName().toLowerCase();
if ("1".equals(childSource)) { if ("1".equals(childSource)) {
workFlowVal = Util.null2String(detailMap.get(fieldName)); workFlowVal = Util.null2String(detailMap.get(fieldName));
@ -781,9 +780,10 @@ public class DealWithMapping extends ToolUtil {
value = Boolean.valueOf(String.valueOf(value)); value = Boolean.valueOf(String.valueOf(value));
} }
break; break;
case Object:{ case Object: {
// 当是object类型时不转换 保留原有格式 // 当是object类型时不转换 保留原有格式
}break; }
break;
default: default:
return value; return value;
} }
@ -801,8 +801,7 @@ public class DealWithMapping extends ToolUtil {
* *
* <h1>:</h1> * <h1>:</h1>
* <p> * <p>
* v2.0 xuanran.wang * v2.0 xuanran.wang {?requestid}requestid {?}
* {?requestid}requestid {?}
* <p> * <p>
*/ */
private Object normalValueDeal(Map<String, Object> mainMap, Map<String, Object> detailMap, RecordSet relationRs, MappingDetail mappingDetail) { private Object normalValueDeal(Map<String, Object> mainMap, Map<String, Object> detailMap, RecordSet relationRs, MappingDetail mappingDetail) {
@ -837,7 +836,7 @@ public class DealWithMapping extends ToolUtil {
case DEFAULT_VALUE: { case DEFAULT_VALUE: {
FieldMessage fieldMassage = mappingDetail.getFieldMassage(); FieldMessage fieldMassage = mappingDetail.getFieldMassage();
String workFlowVal = ""; String workFlowVal = "";
if(fieldMassage != null){ if (fieldMassage != null) {
String fieldName = fieldMassage.getFieldName().toLowerCase(); String fieldName = fieldMassage.getFieldName().toLowerCase();
if ("1".equals(childSource)) { if ("1".equals(childSource)) {
workFlowVal = Util.null2String(detailMap.get(fieldName)); workFlowVal = Util.null2String(detailMap.get(fieldName));
@ -1068,9 +1067,10 @@ public class DealWithMapping extends ToolUtil {
value = Boolean.valueOf(String.valueOf(value)); value = Boolean.valueOf(String.valueOf(value));
} }
break; break;
case Object:{ case Object: {
// 当是object类型时不转换 保留原有格式 // 当是object类型时不转换 保留原有格式
}break; }
break;
default: default:
return value; return value;
} }
@ -1337,7 +1337,7 @@ public class DealWithMapping extends ToolUtil {
value:haode*/ value:haode*/
// 最终通过反射调用weaver.aiyh_jitu.pushdata.service.GetAssignProcessorProcessorImpl类将参数传递给这个类 使用``包裹的字符串会被解析为一个字符串 // 最终通过反射调用weaver.aiyh_jitu.pushdata.service.GetAssignProcessorProcessorImpl类将参数传递给这个类 使用``包裹的字符串会被解析为一个字符串
String pattern = "&?(?<key>([#.\\w\\u4E00-\\u9FA5]+))=" + String pattern = "&?(?<key>([#.\\w\\u4E00-\\u9FA5]+))=" +
"(?<value>((`([():/\\-&$#={ }.\\w\\u4E00-\\u9FA5?]*)`)|" + "(?<value>((`([():/\\-&$?#={ }.\\w\\u4E00-\\u9FA5?]*)`)|" +
"((#(\\{|sql\\{))?([():/\\-$#={ }.\\w\\u4E00-\\u9FA5?]+)?}?)))&?"; "((#(\\{|sql\\{))?([():/\\-$#={ }.\\w\\u4E00-\\u9FA5?]+)?}?)))&?";
Pattern compile = Pattern.compile(pattern); Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher(paramStr); Matcher matcher = compile.matcher(paramStr);

View File

@ -195,7 +195,7 @@ public class TestOrganization extends BaseTest {
@Test @Test
public void testOrgChart() { public void testOrgChart() {
User user = new User(84); User user = new User(1);
OrgChartService orgChartService = new OrgChartService(); OrgChartService orgChartService = new OrgChartService();
List<OrgChartNodeVo> orgChartTree = orgChartService.getOrgChartTree(user); List<OrgChartNodeVo> orgChartTree = orgChartService.getOrgChartTree(user);
System.out.println(JSON.toJSONString(orgChartTree)); System.out.println(JSON.toJSONString(orgChartTree));