From 501bddf2f1464ece5c9bd008d262e7e5de1cc3a8 Mon Sep 17 00:00:00 2001 From: "youHong.ai" <774495953@qq.com> Date: Tue, 6 Dec 2022 19:21:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=AD=A3=E5=88=99=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE=E5=BC=8F=E5=8F=AF=E4=BB=A5=E5=8C=B9=E9=85=8D'`=3F`'?= =?UTF-8?q?=E7=9A=84=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + src/main/java/aiyh/utils/Util.java | 10 +++--- .../orgchart/service/OrgChartService.java | 26 ++++++++++++-- .../config/service/DealWithMapping.java | 34 +++++++++---------- .../java/youhong/ai/pcn/TestOrganization.java | 2 +- 5 files changed, 46 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 3f70b62..fd388c2 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ DirectoryV2.xml /lib/weaverLib/ *.groovy *.log +*.iml src/main/resources/WEB-INF/sqllog/ java.io.tempdir/ diff --git a/src/main/java/aiyh/utils/Util.java b/src/main/java/aiyh/utils/Util.java index ba2fa40..e4891bc 100644 --- a/src/main/java/aiyh/utils/Util.java +++ b/src/main/java/aiyh/utils/Util.java @@ -73,8 +73,7 @@ import java.util.zip.ZipEntry; /** * @author EBU7-dev1-ayh - * @date 2021/8/23 0023 11:42 - * mybatisTest.dao 工具类 + * @date 2021/8/23 0023 11:42 mybatisTest.dao 工具类 */ @@ -91,16 +90,15 @@ public class Util extends weaver.general.Util { public static final char UNICODE_END = 65374; public static final char DBC_SBC_STEP = 65248; // 全角半角转换间隔 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 RecordsetUtil recordsetUtil = new RecordsetUtil(); 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 otherLog = new HashMap<>(8); static ToolUtil toolUtil = new ToolUtil(); private static RecordSet rs; private static volatile Logger log = null; - private static final Map otherLog = new HashMap<>(8); - static { try { rs = new RecordSet(); @@ -3463,7 +3461,7 @@ public class Util extends weaver.general.Util { // 最终通过反射调用weaver.aiyh_jitu.pushdata.service.GetAssignProcessorProcessorImpl类,将参数传递给这个类, // String pattern = "&?(?([#.\\w\\u4E00-\\u9FA5]+))=(?((#(\\{|sql\\{))?([()\\-$#={ }.\\w\\u4E00-\\u9FA5?]+)?}?))&?"; String pattern = "&?(?([#.\\w\\u4E00-\\u9FA5]+))=" + - "(?((`([():/\\-&$#={ }.\\w\\u4E00-\\u9FA5?]*)`)|" + + "(?((`([():/\\-&?$#={ }.\\w\\u4E00-\\u9FA5?]*)`)|" + "((#(\\{|sql\\{))?([():/\\-$#={ }.\\w\\u4E00-\\u9FA5?]+)?}?)))&?"; Pattern compile = Pattern.compile(pattern); Matcher matcher = compile.matcher(paramStr); diff --git a/src/main/java/com/api/youhong/ai/pcn/organization/orgchart/service/OrgChartService.java b/src/main/java/com/api/youhong/ai/pcn/organization/orgchart/service/OrgChartService.java index a696908..253f57d 100644 --- a/src/main/java/com/api/youhong/ai/pcn/organization/orgchart/service/OrgChartService.java +++ b/src/main/java/com/api/youhong/ai/pcn/organization/orgchart/service/OrgChartService.java @@ -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(); currentUser.set(item); }); - Assert.notNull(currentUser, "not find current login user info!"); + /* ******************* 系统管理员默认全部展开哦 ******************* */ + if (userId == 1) { + List 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(); if (Objects.isNull(currentUserManagerStr)) { @@ -100,8 +121,7 @@ public class OrgChartService { * * @param chartNodeVo 节点对象 * @return Integer 对应节点的所有子节点的数量 - * @author youHong.ai - * ****************************************** + * @author youHong.ai ****************************************** */ private Integer recursionChildrenNums(OrgChartNodeVo chartNodeVo, int n) { List children = chartNodeVo.getChildren(); diff --git a/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java b/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java index 241415e..6263380 100644 --- a/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java +++ b/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java @@ -538,11 +538,10 @@ public class DealWithMapping extends ToolUtil { * @param detailMap 明细数据结果集 * @param mappingDetail 配置节点信息 * - *

代码版本改动说明:

- *

- * v2.0 xuanran.wang 转换类型是默认值时增加替换规则 - * 将自定义文本中的{?requestid}替换成requestid 以及将 {?} 替换成选择的流程字段对应的值 - *

+ *

代码版本改动说明:

+ *

+ * v2.0 xuanran.wang 转换类型是默认值时增加替换规则 将自定义文本中的{?requestid}替换成requestid 以及将 {?} 替换成选择的流程字段对应的值 + *

*/ private Object normalValueDeal(Map mainMap, Map detailMap, MappingDetail mappingDetail) { @@ -570,7 +569,7 @@ public class DealWithMapping extends ToolUtil { case DEFAULT_VALUE: { FieldMessage fieldMassage = mappingDetail.getFieldMassage(); String workFlowVal = ""; - if(fieldMassage != null){ + if (fieldMassage != null) { String fieldName = fieldMassage.getFieldName().toLowerCase(); if ("1".equals(childSource)) { workFlowVal = Util.null2String(detailMap.get(fieldName)); @@ -781,9 +780,10 @@ public class DealWithMapping extends ToolUtil { value = Boolean.valueOf(String.valueOf(value)); } break; - case Object:{ + case Object: { // 当是object类型时不转换 保留原有格式 - }break; + } + break; default: return value; } @@ -799,11 +799,10 @@ public class DealWithMapping extends ToolUtil { * @param mappingDetail 配置节点信息 * @param relationRs 关联流程数据集合 * - *

代码版本改动说明:

- *

- * v2.0 xuanran.wang 转换类型是默认值时增加替换规则 - * 将自定义文本中的{?requestid}替换成requestid 以及将 {?} 替换成选择的流程字段对应的值 - *

+ *

代码版本改动说明:

+ *

+ * v2.0 xuanran.wang 转换类型是默认值时增加替换规则 将自定义文本中的{?requestid}替换成requestid 以及将 {?} 替换成选择的流程字段对应的值 + *

*/ private Object normalValueDeal(Map mainMap, Map detailMap, RecordSet relationRs, MappingDetail mappingDetail) { String paramType = mappingDetail.getParamType(); @@ -837,7 +836,7 @@ public class DealWithMapping extends ToolUtil { case DEFAULT_VALUE: { FieldMessage fieldMassage = mappingDetail.getFieldMassage(); String workFlowVal = ""; - if(fieldMassage != null){ + if (fieldMassage != null) { String fieldName = fieldMassage.getFieldName().toLowerCase(); if ("1".equals(childSource)) { workFlowVal = Util.null2String(detailMap.get(fieldName)); @@ -1068,9 +1067,10 @@ public class DealWithMapping extends ToolUtil { value = Boolean.valueOf(String.valueOf(value)); } break; - case Object:{ + case Object: { // 当是object类型时不转换 保留原有格式 - }break; + } + break; default: return value; } @@ -1337,7 +1337,7 @@ public class DealWithMapping extends ToolUtil { value:haode*/ // 最终通过反射调用weaver.aiyh_jitu.pushdata.service.GetAssignProcessorProcessorImpl类,将参数传递给这个类, 使用``包裹的字符串会被解析为一个字符串 String pattern = "&?(?([#.\\w\\u4E00-\\u9FA5]+))=" + - "(?((`([():/\\-&$#={ }.\\w\\u4E00-\\u9FA5?]*)`)|" + + "(?((`([():/\\-&$?#={ }.\\w\\u4E00-\\u9FA5?]*)`)|" + "((#(\\{|sql\\{))?([():/\\-$#={ }.\\w\\u4E00-\\u9FA5?]+)?}?)))&?"; Pattern compile = Pattern.compile(pattern); Matcher matcher = compile.matcher(paramStr); diff --git a/src/test/java/youhong/ai/pcn/TestOrganization.java b/src/test/java/youhong/ai/pcn/TestOrganization.java index 8638add..4966161 100644 --- a/src/test/java/youhong/ai/pcn/TestOrganization.java +++ b/src/test/java/youhong/ai/pcn/TestOrganization.java @@ -195,7 +195,7 @@ public class TestOrganization extends BaseTest { @Test public void testOrgChart() { - User user = new User(84); + User user = new User(1); OrgChartService orgChartService = new OrgChartService(); List orgChartTree = orgChartService.getOrgChartTree(user); System.out.println(JSON.toJSONString(orgChartTree));