|
@@ -429,23 +429,27 @@ public class ContractbillApiPlugin implements Serializable {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
List<Map<String, Object>> atts = AttachmentServiceHelper.getAttachments(entityNumber, dynamicObject.getPkValue(),"attachmentpanel");
|
|
|
if (atts.size() > 0) {
|
|
|
-
|
|
|
Iterator<Map<String, Object>> iterator = atts.iterator();
|
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
Map map2 = iterator.next();
|
|
|
- String formId = map2.get("entityNum").toString();
|
|
|
- Object pkId = map2.get("billPkId");
|
|
|
- Object fileUid = map2.get("uid");
|
|
|
-
|
|
|
- AttachmentServiceHelper.remove(formId, pkId, fileUid);
|
|
|
+ String oldfileName = map2.get("name").toString();
|
|
|
+ if (attIsExist(allAttachmentsData,oldfileName)) {
|
|
|
+
|
|
|
+ String formId = map2.get("entityNum").toString();
|
|
|
+ Object pkId = map2.get("billPkId");
|
|
|
+ Object fileUid = map2.get("uid");
|
|
|
+
|
|
|
+ AttachmentServiceHelper.remove(formId, pkId, fileUid);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
if (allAttachmentsData != null) {
|
|
|
Map<String, Object> attachmentInfos = new HashMap<>();
|
|
|
for (Map.Entry<String, List<Map<String,Object>>> entry : allAttachmentsData.entrySet()) {
|
|
@@ -483,4 +487,30 @@ public class ContractbillApiPlugin implements Serializable {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * 检查历史附件文件名是否存在本次接口送入的附件中
|
|
|
+ * @param sendallAttachmentsData 接口送入的附件集合
|
|
|
+ * @param oldfileName 历史附件名称
|
|
|
+ * @return true:存在 ,false:不存在
|
|
|
+ */
|
|
|
+ boolean attIsExist(Map<String, List<Map<String,Object>>> sendallAttachmentsData, String oldfileName) {
|
|
|
+ if (sendallAttachmentsData != null) {
|
|
|
+ for (Map.Entry<String, List<Map<String,Object>>> entry : sendallAttachmentsData.entrySet()) {
|
|
|
+ if ("attachmentpanel".equals(entry.getKey())) {
|
|
|
+
|
|
|
+ List<Map<String, Object>> fileList = entry.getValue();
|
|
|
+ for (int i= 0; i < fileList.size(); i++) {
|
|
|
+ Map<String, Object> map = fileList.get(i);
|
|
|
+ String newfilename = map.get("fileName").toString();
|
|
|
+ if (oldfileName.equals(newfilename)) {
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
}
|