Update FieldWriteback.java

This commit is contained in:
devezhao 2020-11-17 23:12:18 +08:00
parent b1887f4e76
commit 579302e75e

View file

@ -14,9 +14,12 @@ import com.alibaba.fastjson.JSONObject;
import com.rebuild.core.Application;
import com.rebuild.core.configuration.general.AutoFillinManager;
import com.rebuild.core.metadata.MetadataHelper;
import com.rebuild.core.metadata.easymeta.DisplayType;
import com.rebuild.core.metadata.easymeta.EasyDate;
import com.rebuild.core.metadata.easymeta.EasyField;
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.service.trigger.ActionContext;
import com.rebuild.core.service.trigger.ActionType;
import com.rebuild.core.support.general.FieldValueCompatibleConversion;
import org.apache.commons.lang.StringUtils;
import java.util.HashMap;
@ -92,7 +95,17 @@ public class FieldWriteback extends FieldAggregation {
Field sourceField = MetadataHelper.getLastJoinField(sourceEntity, e.getValue());
Field targetField = targetEntity.getField(e.getKey());
Object newValue = new FieldValueCompatibleConversion(sourceField, targetField).convert(value, exprsMap.get(e.getKey()));
Object newValue;
EasyField sourceFieldEasy = EasyMetaFactory.valueOf(sourceField);
if (sourceFieldEasy.getDisplayType() == DisplayType.DATETIME
|| sourceFieldEasy.getDisplayType() == DisplayType.DATE) {
newValue = ((EasyDate) sourceFieldEasy)
.convertCompatibleValue(value, EasyMetaFactory.valueOf(targetField), exprsMap.get(e.getKey()));
} else {
newValue = sourceFieldEasy.convertCompatibleValue(value, EasyMetaFactory.valueOf(targetField));
}
if (newValue != null) {
record.setObjectValue(targetField.getName(), newValue);
}