增加:getBusynessKey
This commit is contained in:
parent
9ede76e085
commit
3c3a654dbd
@ -2,6 +2,7 @@ package net.ferrum.flowable.utils;
|
|||||||
|
|
||||||
import net.ferrum.common.utils.DateUtils;
|
import net.ferrum.common.utils.DateUtils;
|
||||||
import net.ferrum.common.utils.StringUtils;
|
import net.ferrum.common.utils.StringUtils;
|
||||||
|
import net.ferrum.flowable.common.constant.ProcessConstants;
|
||||||
import net.ferrum.flowable.core.domain.ProcessQuery;
|
import net.ferrum.flowable.core.domain.ProcessQuery;
|
||||||
import org.flowable.common.engine.api.query.Query;
|
import org.flowable.common.engine.api.query.Query;
|
||||||
import org.flowable.common.engine.impl.db.SuspensionState;
|
import org.flowable.common.engine.impl.db.SuspensionState;
|
||||||
@ -78,6 +79,40 @@ public class ProcessUtils {
|
|||||||
query.taskCreatedAfter(DateUtils.parseDate(params.get("beginTime")));
|
query.taskCreatedAfter(DateUtils.parseDate(params.get("beginTime")));
|
||||||
query.taskCreatedBefore(DateUtils.parseDate(params.get("endTime")));
|
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) {
|
private static void buildHistoricTaskInstanceSearch(HistoricTaskInstanceQuery query, ProcessQuery process) {
|
||||||
@ -92,6 +127,10 @@ public class ProcessUtils {
|
|||||||
query.taskCompletedAfter(DateUtils.parseDate(params.get("beginTime")));
|
query.taskCompletedAfter(DateUtils.parseDate(params.get("beginTime")));
|
||||||
query.taskCompletedBefore(DateUtils.parseDate(params.get("endTime")));
|
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;
|
String sKey = getBusynessKey(process);
|
||||||
//批次
|
|
||||||
if (StringUtils.isNotBlank(process.getSpecBatch())) {
|
|
||||||
sKey = "%" + process.getSpecBatch();
|
|
||||||
}
|
|
||||||
//规格名称
|
|
||||||
if (StringUtils.isNotBlank(process.getSpecName())) {
|
|
||||||
if(sKey == null){
|
|
||||||
sKey = "%" + process.getSpecName() + "%";
|
|
||||||
}else{
|
|
||||||
sKey += "%" + process.getSpecName() + "%";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(sKey != null) {
|
if(sKey != null) {
|
||||||
query.processInstanceBusinessKeyLike(sKey);
|
query.processInstanceBusinessKeyLike(sKey);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user