Browse Source

更新e签宝模板controllerBean

heyuan 4 days ago
parent
commit
90b1ec5f76

+ 31 - 0
src/com/kingdee/eas/custom/esign/app/ESignTemplateControllerBean.java

@@ -68,6 +68,37 @@ public class ESignTemplateControllerBean extends AbstractESignTemplateController
         return super._save(ctx, model);
     }
 
+    /**
+     * 更新电子签名模板数据
+     * 修复页面保存后 字段列表丢失bug
+     *
+     * @param ctx   系统上下文对象
+     * @param pk    要更新的数据主键
+     * @param model 要更新的数据
+     * @throws BOSException    业务操作异常
+     * @throws EASBizException EAS业务异常
+     */
+    @Override
+    protected void _update(Context ctx, IObjectPK pk, IObjectValue model) throws BOSException, EASBizException {
+        SelectorItemCollection sic = new SelectorItemCollection();
+        sic.add("entrys.id");
+        sic.add("entrys.fields.*");
+        ESignTemplateInfo oldInfo = getESignTemplateInfo(ctx, pk, sic);
+        ESignTemplateFileEntryCollection oldEntrys = oldInfo.getEntrys();
+        Map<String, ESignTemplateFileEntryFieldCollection> entryFieldCollectionMap = new HashMap<String, ESignTemplateFileEntryFieldCollection>();
+        for (int i = 0; i < oldEntrys.size(); i++) {
+            ESignTemplateFileEntryInfo oldEntryInfo = oldEntrys.get(i);
+            entryFieldCollectionMap.put(oldEntryInfo.getId().toString(), oldEntryInfo.getFields());
+        }
+        ESignTemplateInfo info = (ESignTemplateInfo) model;
+        ESignTemplateFileEntryCollection entrys = info.getEntrys();
+        for (int i = 0; i < entrys.size(); i++) {
+            ESignTemplateFileEntryInfo entryInfo = entrys.get(i);
+            String entryId = entryInfo.getId().toString();
+            entryInfo.getFields().addCollection(entryFieldCollectionMap.get(entryId));
+        }
+        super._update(ctx, pk, model);
+    }
 
     /**
      * 删除电子签名模板数据