合同导入触发报错bug
This commit is contained in:
parent
db2fbda76f
commit
99659e0273
|
@ -4,10 +4,13 @@ import com.alibaba.dubbo.common.utils.CollectionUtils;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.dataentity.metadata.IDataEntityType;
|
||||||
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
import kd.bos.entity.datamodel.BasedataItem;
|
import kd.bos.entity.datamodel.BasedataItem;
|
||||||
import kd.bos.entity.datamodel.events.BeforeImportEntryEventArgs;
|
import kd.bos.entity.datamodel.events.BeforeImportEntryEventArgs;
|
||||||
import kd.bos.entity.datamodel.events.QueryImportBasedataEventArgs;
|
import kd.bos.entity.datamodel.events.QueryImportBasedataEventArgs;
|
||||||
import kd.bos.entity.plugin.ImportLogger;
|
import kd.bos.entity.plugin.ImportLogger;
|
||||||
|
import kd.bos.form.operate.webapi.RowMapper;
|
||||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
import kd.bos.form.plugin.importentry.resolving.ImportEntryData;
|
import kd.bos.form.plugin.importentry.resolving.ImportEntryData;
|
||||||
import kd.bos.form.plugin.impt.BatchImportPlugin;
|
import kd.bos.form.plugin.impt.BatchImportPlugin;
|
||||||
|
@ -35,19 +38,26 @@ public class ContractMaterialImportPlugin extends AbstractFormPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void queryImportBasedata(QueryImportBasedataEventArgs e) {
|
public void queryImportBasedata(QueryImportBasedataEventArgs e) {
|
||||||
super.queryImportBasedata(e);
|
super.queryImportBasedata(e);
|
||||||
Map<BasedataItem, List<Object>> searchResult = e.getSearchResult();
|
DynamicObject targetObj = ((RowMapper) e.getSource()).getTargetObj();
|
||||||
for (Map.Entry<BasedataItem, List<Object>> entry : searchResult.entrySet()) {
|
IDataEntityType dataEntityType = targetObj.getDataEntityType();
|
||||||
List<Object> basedata = entry.getValue();
|
if (null!=dataEntityType){
|
||||||
if (basedata.isEmpty()) { // 查不到基础资料数据
|
String name = dataEntityType.getName();
|
||||||
Long materialId = newMaterial(entry.getKey().getSearchValue(),materialList);
|
if (StringUtils.equals("qeug_orderformentry",name)){
|
||||||
basedata.add(materialId);
|
Map<BasedataItem, List<Object>> searchResult = e.getSearchResult();
|
||||||
} else {
|
for (Map.Entry<BasedataItem, List<Object>> entry : searchResult.entrySet()) {
|
||||||
// 查到多个基础资料数据
|
List<Object> basedata = entry.getValue();
|
||||||
// 业务场景,应根据需求剔除不合法的基础资料数据(最终保留一个)
|
if (basedata.isEmpty()) { // 查不到基础资料数据
|
||||||
Iterator it = basedata.iterator();
|
Long materialId = newMaterial(entry.getKey().getSearchValue(),materialList);
|
||||||
it.next();
|
basedata.add(materialId);
|
||||||
while (it.hasNext()) {
|
} else {
|
||||||
it.remove();
|
// 查到多个基础资料数据
|
||||||
|
// 业务场景,应根据需求剔除不合法的基础资料数据(最终保留一个)
|
||||||
|
Iterator it = basedata.iterator();
|
||||||
|
it.next();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue