From 3c3a654dbdbf24fd6db51472a329023908076c18 Mon Sep 17 00:00:00 2001 From: tiezx Date: Thu, 17 Jul 2025 13:01:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=9AgetBusynessKey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ferrum/flowable/utils/ProcessUtils.java | 53 ++++++++++++++----- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/quotation-flowable/src/main/java/net/ferrum/flowable/utils/ProcessUtils.java b/quotation-flowable/src/main/java/net/ferrum/flowable/utils/ProcessUtils.java index a81c58e..901f914 100644 --- a/quotation-flowable/src/main/java/net/ferrum/flowable/utils/ProcessUtils.java +++ b/quotation-flowable/src/main/java/net/ferrum/flowable/utils/ProcessUtils.java @@ -2,6 +2,7 @@ package net.ferrum.flowable.utils; import net.ferrum.common.utils.DateUtils; import net.ferrum.common.utils.StringUtils; +import net.ferrum.flowable.common.constant.ProcessConstants; import net.ferrum.flowable.core.domain.ProcessQuery; import org.flowable.common.engine.api.query.Query; import org.flowable.common.engine.impl.db.SuspensionState; @@ -78,6 +79,40 @@ public class ProcessUtils { query.taskCreatedAfter(DateUtils.parseDate(params.get("beginTime"))); query.taskCreatedBefore(DateUtils.parseDate(params.get("endTime"))); } + + String sKey = getBusynessKey(process); + if(sKey != null) { + query.processInstanceBusinessKeyLike(sKey); + } + + + + } + + private static String getBusynessKey(ProcessQuery process){ + String sKey = null; + + if (StringUtils.isNotBlank(process.getSpecBatch()) || StringUtils.isNotBlank(process.getSpecName())) { + //批次 + if (StringUtils.isNotBlank(process.getSpecBatch())){ + sKey = "%" + process.getSpecBatch(); + //规格名称 + if (StringUtils.isNotBlank(process.getSpecName())) { + sKey += "%" + ProcessConstants.PROCESS_BUSYNESSKEY_ConnString + "%" + process.getSpecName() + "%"; + }else{ + sKey += "%" + ProcessConstants.PROCESS_BUSYNESSKEY_ConnString + "%"; + } + } + else{ + if (StringUtils.isNotBlank(process.getSpecName())) { + sKey = "%" + ProcessConstants.PROCESS_BUSYNESSKEY_ConnString + "%" + process.getSpecName() + "%"; + }else{ + sKey = "%" + ProcessConstants.PROCESS_BUSYNESSKEY_ConnString + "%"; + } + } + + } + return sKey; } private static void buildHistoricTaskInstanceSearch(HistoricTaskInstanceQuery query, ProcessQuery process) { @@ -92,6 +127,10 @@ public class ProcessUtils { query.taskCompletedAfter(DateUtils.parseDate(params.get("beginTime"))); query.taskCompletedBefore(DateUtils.parseDate(params.get("endTime"))); } + String sKey = getBusynessKey(process); + if(sKey != null) { + query.processInstanceBusinessKeyLike(sKey); + } } /** @@ -111,19 +150,7 @@ public class ProcessUtils { } */ - String sKey = null; - //批次 - if (StringUtils.isNotBlank(process.getSpecBatch())) { - sKey = "%" + process.getSpecBatch(); - } - //规格名称 - if (StringUtils.isNotBlank(process.getSpecName())) { - if(sKey == null){ - sKey = "%" + process.getSpecName() + "%"; - }else{ - sKey += "%" + process.getSpecName() + "%"; - } - } + String sKey = getBusynessKey(process); if(sKey != null) { query.processInstanceBusinessKeyLike(sKey); }