mirror of
https://github.com/getrebuild/rebuild.git
synced 2024-09-20 15:35:55 +08:00
fix: 批量操作清理 TSCHAIN
This commit is contained in:
parent
896b2bbb12
commit
3458e67f48
|
@ -19,6 +19,7 @@ import com.rebuild.core.metadata.EntityRecordCreator;
|
|||
import com.rebuild.core.metadata.MetadataHelper;
|
||||
import com.rebuild.core.metadata.easymeta.DisplayType;
|
||||
import com.rebuild.core.service.general.GeneralEntityServiceContextHolder;
|
||||
import com.rebuild.core.service.trigger.impl.FieldAggregation;
|
||||
import com.rebuild.core.support.task.HeavyTask;
|
||||
import com.rebuild.utils.JSONUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -63,9 +64,7 @@ public class DataImporter extends HeavyTask<Integer> {
|
|||
}
|
||||
|
||||
Cell fc = row == null || row.length == 0 ? null : row[0];
|
||||
if (fc == null || fc.getRowNo() == 0) {
|
||||
continue;
|
||||
}
|
||||
if (fc == null || fc.getRowNo() == 0) continue;
|
||||
|
||||
try {
|
||||
Record record = checkoutRecord(row, defaultOwning);
|
||||
|
@ -83,6 +82,11 @@ public class DataImporter extends HeavyTask<Integer> {
|
|||
} catch (Exception ex) {
|
||||
traceLogs.add(new Object[] { fc.getRowNo(), "ERROR", ex.getLocalizedMessage() });
|
||||
log.error("ROW#{} > {}", fc.getRowNo(), ex.getLocalizedMessage());
|
||||
} finally {
|
||||
|
||||
// 可能有级联触发器
|
||||
Object ts = FieldAggregation.cleanTriggerChain();
|
||||
if (ts != null) log.info("Clean current-loop : {}", ts);
|
||||
}
|
||||
|
||||
this.addCompleted();
|
||||
|
|
|
@ -45,6 +45,7 @@ public class BulkAssign extends BulkOperator {
|
|||
this.addSucceeded();
|
||||
if (firstAssigned == null) firstAssigned = id;
|
||||
}
|
||||
|
||||
} else {
|
||||
log.warn("No have privileges to ASSIGN : {} < {}", id, context.getOpUser());
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.rebuild.core.Application;
|
||||
import com.rebuild.core.metadata.EntityHelper;
|
||||
import com.rebuild.core.service.DataSpecificationException;
|
||||
import com.rebuild.core.service.trigger.impl.FieldAggregation;
|
||||
import com.rebuild.core.support.general.BatchOperatorQuery;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
@ -48,6 +49,7 @@ public class BulkBacthUpdate extends BulkOperator {
|
|||
|
||||
JSONArray updateContents = ((JSONObject) context.getExtraParams().get("customData"))
|
||||
.getJSONArray("updateContents");
|
||||
|
||||
// 转化成标准 FORM 格式
|
||||
JSONObject formJson = new JSONObject();
|
||||
for (Object o : updateContents) {
|
||||
|
@ -62,6 +64,7 @@ public class BulkBacthUpdate extends BulkOperator {
|
|||
formJson.put(field, value);
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject metadata = new JSONObject();
|
||||
metadata.put("entity", context.getMainEntity().getName());
|
||||
formJson.put(JsonRecordCreator.META_FIELD, metadata);
|
||||
|
@ -80,6 +83,11 @@ public class BulkBacthUpdate extends BulkOperator {
|
|||
this.addSucceeded();
|
||||
} catch (DataSpecificationException ex) {
|
||||
log.warn("Cannot update `{}` because : {}", id, ex.getLocalizedMessage());
|
||||
|
||||
} finally {
|
||||
// 可能有级联触发器
|
||||
Object ts = FieldAggregation.cleanTriggerChain();
|
||||
if (ts != null) log.info("Clean current-loop : {}", ts);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
@ -10,6 +10,7 @@ package com.rebuild.core.service.general;
|
|||
import cn.devezhao.persist4j.engine.ID;
|
||||
import com.rebuild.core.Application;
|
||||
import com.rebuild.core.service.DataSpecificationException;
|
||||
import com.rebuild.core.service.trigger.impl.FieldAggregation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
|
@ -39,7 +40,13 @@ public class BulkDelete extends BulkOperator {
|
|||
} catch (DataSpecificationException ex) {
|
||||
lastError = ex.getLocalizedMessage();
|
||||
log.warn("Cannot delete `{}` because : {}", id, lastError);
|
||||
|
||||
} finally {
|
||||
// 可能有级联触发器
|
||||
Object ts = FieldAggregation.cleanTriggerChain();
|
||||
if (ts != null) log.info("Clean current-loop : {}", ts);
|
||||
}
|
||||
|
||||
} else {
|
||||
log.warn("No have privileges to DELETE : {} < {}", id, context.getOpUser());
|
||||
}
|
||||
|
|
|
@ -48,10 +48,9 @@ public class BulkShare extends BulkOperator {
|
|||
int a = ges.share(id, context.getToUser(), context.getCascades(), shareRights);
|
||||
if (a > 0) {
|
||||
this.addSucceeded();
|
||||
if (firstShared == null) {
|
||||
firstShared = id;
|
||||
}
|
||||
if (firstShared == null) firstShared = id;
|
||||
}
|
||||
|
||||
} else {
|
||||
log.warn("No have privileges to SHARE : {} < {}", id, context.getOpUser());
|
||||
}
|
||||
|
|
|
@ -38,9 +38,8 @@ public class BulkUnshare extends BulkOperator {
|
|||
// 这里的取消实际是删除了共享表记录
|
||||
for (ID id : records) {
|
||||
int a = ges.unshare(realTarget, id);
|
||||
if (a > 0) {
|
||||
this.addSucceeded();
|
||||
}
|
||||
if (a > 0) this.addSucceeded();
|
||||
|
||||
this.addCompleted();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue