|
@@ -628,13 +628,13 @@ public class TestPlugin extends AbstractListPlugin {
|
|
|
|
|
|
//读取行名行号,存入对应基础资料中
|
|
|
if("hmhh".equals(e.getOperateKey())) {
|
|
|
- String fileurl=getFileUrl("hmhhurl");
|
|
|
+// String fileurl=getFileUrl("hmhhurl");
|
|
|
//行名行号表字段
|
|
|
List<String> selector = Arrays.asList(
|
|
|
"number", "name"
|
|
|
);
|
|
|
//文件路径
|
|
|
-// String fileurl="D:/hmhh.dat";
|
|
|
+ String fileurl="D:/hmhh.dat";
|
|
|
//行名行号表标识
|
|
|
String bd_bebank="bd_bebank";
|
|
|
try {
|
|
@@ -643,12 +643,14 @@ public class TestPlugin extends AbstractListPlugin {
|
|
|
//国家基础资料(中国)
|
|
|
DynamicObject country=BusinessDataServiceHelper
|
|
|
.loadSingle("bd_country","number", new QFilter[]{new QFilter("number", QCP.equals, "001")});
|
|
|
-
|
|
|
List<DynamicObject> createdataList = new ArrayList<>();
|
|
|
List<DynamicObject> updatedataList = new ArrayList<>();
|
|
|
//查出所有现有的数据
|
|
|
DynamicObject[] existingData = BusinessDataServiceHelper
|
|
|
- .load(dynamicObjectType.getName(), String.join(",", selector), null);
|
|
|
+ .load(dynamicObjectType.getName(), String.join(",", selector)+",enable,nckd_datasource", null);
|
|
|
+ //查找文件更新的数据
|
|
|
+
|
|
|
+
|
|
|
Map<String, DynamicObject> existingDataMap = new HashMap<>();
|
|
|
for (DynamicObject obj : existingData) {
|
|
|
//单据号
|
|
@@ -702,10 +704,31 @@ public class TestPlugin extends AbstractListPlugin {
|
|
|
data.set("citytxt","南昌");
|
|
|
//联行号等于行号
|
|
|
data.set("union_number",fields[0]);
|
|
|
+ //设置可用状态
|
|
|
+ data.set("enable","1");
|
|
|
+ //设置数据来源,0为手动更新,1为文件自动更新
|
|
|
+ data.set("nckd_datasource","1");
|
|
|
createdataList.add(data);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //获取自动添加的数据
|
|
|
+ DynamicObject[] autoData = BusinessDataServiceHelper
|
|
|
+ .load(dynamicObjectType.getName()
|
|
|
+ , String.join(",", selector)+",enable,nckd_datasource",
|
|
|
+ new QFilter[]{new QFilter("nckd_datasource", QCP.equals, "1")});
|
|
|
+ for (int i=0;i< autoData.length;i++)
|
|
|
+ {
|
|
|
+ //如果导入的数据在系统中没有则禁用
|
|
|
+ if (!processeddubilidSet.contains(autoData[i].getString("number"))) {
|
|
|
+ //设置禁用
|
|
|
+ autoData[i].set("enable","0");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ SaveServiceHelper.save(autoData);
|
|
|
+
|
|
|
+
|
|
|
//查找更新数据
|
|
|
for (Map.Entry<String, DynamicObject> entry : existingDataMap.entrySet()) {
|
|
|
String dubil_id = entry.getKey();
|
|
@@ -715,6 +738,8 @@ public class TestPlugin extends AbstractListPlugin {
|
|
|
updatedataList.add(data);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
//新增数据不为空则更新到数据库中
|
|
|
if (!createdataList.isEmpty()) {
|
|
|
SaveServiceHelper.save(dynamicObjectType, createdataList.toArray(new DynamicObject[0]));
|