提交 6389eda0 编写于 作者: ibiz4j's avatar ibiz4j

接口实体适配

上级 613fe641
...@@ -14,6 +14,7 @@ import net.ibizsys.central.dataentity.IDataEntityRuntime; ...@@ -14,6 +14,7 @@ import net.ibizsys.central.dataentity.IDataEntityRuntime;
import net.ibizsys.central.dataentity.service.IDEMethodDTO; import net.ibizsys.central.dataentity.service.IDEMethodDTO;
import net.ibizsys.central.dataentity.service.IDEMethodDTORuntime; import net.ibizsys.central.dataentity.service.IDEMethodDTORuntime;
import net.ibizsys.central.plugin.boot.core.helper.FieldCache; import net.ibizsys.central.plugin.boot.core.helper.FieldCache;
import net.ibizsys.central.service.client.IWebClientRep;
import net.ibizsys.central.util.IEntityDTO; import net.ibizsys.central.util.IEntityDTO;
import net.ibizsys.model.dataentity.defield.IPSDEField; import net.ibizsys.model.dataentity.defield.IPSDEField;
import net.ibizsys.model.dataentity.service.IPSDEMethodDTOField; import net.ibizsys.model.dataentity.service.IPSDEMethodDTOField;
...@@ -279,7 +280,7 @@ public class BaseData implements IEntityDTO { ...@@ -279,7 +280,7 @@ public class BaseData implements IEntityDTO {
if(focusNull.contains(strName)) if(focusNull.contains(strName))
return true; return true;
FieldCache.FieldItem fieldItem= FieldCache.getField(this.getClass(),strName); FieldCache.FieldItem fieldItem= FieldCache.getField(this.getClass(),strName);
if(!StringUtils.isEmpty(fieldItem.getCodeName())) { if(fieldItem!=null&&(!StringUtils.isEmpty(fieldItem.getCodeName()))) {
if(focusNull.contains(fieldItem.getJsonName())) if(focusNull.contains(fieldItem.getJsonName()))
return true; return true;
...@@ -512,6 +513,7 @@ public class BaseData implements IEntityDTO { ...@@ -512,6 +513,7 @@ public class BaseData implements IEntityDTO {
this.resetAll(); this.resetAll();
return; return;
} }
if(bDTOData) { if(bDTOData) {
//DTO 数据为直接缓存 //DTO 数据为直接缓存
if (objData instanceof IEntityDTO) { if (objData instanceof IEntityDTO) {
...@@ -574,6 +576,14 @@ public class BaseData implements IEntityDTO { ...@@ -574,6 +576,14 @@ public class BaseData implements IEntityDTO {
if (objData instanceof IEntity) { if (objData instanceof IEntity) {
srcmap = ((IEntity)objData).any(); srcmap = ((IEntity)objData).any();
} }
else if(objData instanceof IWebClientRep) {
String body=((IWebClientRep<String>)objData).getBody();
Assert.hasText(body,String.format("接口服务返回为空"));
if(JSON.isValidObject(body))
srcmap=JSON.parseObject(body);
else
throw new Exception("无法识别的数据对象,接口服务");
}
else { else {
throw new Exception("无法识别的数据对象"); throw new Exception("无法识别的数据对象");
} }
...@@ -646,10 +656,17 @@ public class BaseData implements IEntityDTO { ...@@ -646,10 +656,17 @@ public class BaseData implements IEntityDTO {
if (objData instanceof Map) { if (objData instanceof Map) {
srcmap = (Map<String,Object>)objData; srcmap = (Map<String,Object>)objData;
} }
else else if (objData instanceof IEntity) {
if (objData instanceof IEntity) {
srcmap = ((IEntity)objData).any(); srcmap = ((IEntity)objData).any();
} }
else if(objData instanceof IWebClientRep) {
String body=((IWebClientRep<String>)objData).getBody();
Assert.hasText(body,String.format("接口服务返回为空"));
if(JSON.isValidObject(body))
srcmap=JSON.parseObject(body);
else
throw new Exception("无法识别的数据对象,接口服务");
}
else { else {
throw new Exception("无法识别的数据对象"); throw new Exception("无法识别的数据对象");
} }
......
...@@ -69,6 +69,7 @@ public interface IServiceApiService<T extends BaseData, F extends BaseFilter> ex ...@@ -69,6 +69,7 @@ public interface IServiceApiService<T extends BaseData, F extends BaseFilter> ex
K ret = JSON.parseObject(body,clazz); K ret = JSON.parseObject(body,clazz);
if(arg.getClass().isAssignableFrom(getTClass())&&clazz.isAssignableFrom(getTClass())) if(arg.getClass().isAssignableFrom(getTClass())&&clazz.isAssignableFrom(getTClass()))
((T) arg).reload(((T)ret).any(), true); ((T) arg).reload(((T)ret).any(), true);
return ret;
} }
return (K)obj; return (K)obj;
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册