|
@@ -80,27 +80,31 @@ public class ESignTemplateControllerBean extends AbstractESignTemplateController
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
protected void _update(Context ctx, IObjectPK pk, IObjectValue model) throws BOSException, EASBizException {
|
|
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;
|
|
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();
|
|
|
|
|
- ESignTemplateFileEntryFieldCollection fields = entryInfo.getFields();
|
|
|
|
|
- ESignTemplateFileEntryFieldCollection oldFields = entryFieldCollectionMap.get(entryId);
|
|
|
|
|
- for (int x=0;x<oldFields.size();x++){
|
|
|
|
|
- ESignTemplateFileEntryFieldInfo xInfo =oldFields.get(x);
|
|
|
|
|
- if (!fields.contains(xInfo)){
|
|
|
|
|
- fields.add(xInfo);
|
|
|
|
|
|
|
+ // 判断是否是同步操作,同步操作则不处理字段列表
|
|
|
|
|
+ boolean isSyncAction = info.getBoolean("isSyncAction");
|
|
|
|
|
+ if (!isSyncAction) {
|
|
|
|
|
+ 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());
|
|
|
|
|
+ }
|
|
|
|
|
+ ESignTemplateFileEntryCollection entrys = info.getEntrys();
|
|
|
|
|
+ for (int i = 0; i < entrys.size(); i++) {
|
|
|
|
|
+ ESignTemplateFileEntryInfo entryInfo = entrys.get(i);
|
|
|
|
|
+ String entryId = entryInfo.getId().toString();
|
|
|
|
|
+ ESignTemplateFileEntryFieldCollection fields = entryInfo.getFields();
|
|
|
|
|
+ ESignTemplateFileEntryFieldCollection oldFields = entryFieldCollectionMap.get(entryId);
|
|
|
|
|
+ for (int x = 0; x < oldFields.size(); x++) {
|
|
|
|
|
+ ESignTemplateFileEntryFieldInfo xInfo = oldFields.get(x);
|
|
|
|
|
+ if (!fields.contains(xInfo)) {
|
|
|
|
|
+ fields.add(xInfo);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -148,7 +152,6 @@ public class ESignTemplateControllerBean extends AbstractESignTemplateController
|
|
|
sic.add("entrys.fields.*");
|
|
sic.add("entrys.fields.*");
|
|
|
ESignTemplateInfo info = getESignTemplateInfo(ctx, new ObjectUuidPK(billId), sic);
|
|
ESignTemplateInfo info = getESignTemplateInfo(ctx, new ObjectUuidPK(billId), sic);
|
|
|
ESignTemplateFileEntryCollection entrys = info.getEntrys();
|
|
ESignTemplateFileEntryCollection entrys = info.getEntrys();
|
|
|
- IESignTemplateFileEntry field = ESignTemplateFileEntryFactory.getLocalInstance(ctx);
|
|
|
|
|
for (int i = 0; i < entrys.size(); i++) {
|
|
for (int i = 0; i < entrys.size(); i++) {
|
|
|
ESignTemplateFileEntryInfo entryInfo = entrys.get(i);
|
|
ESignTemplateFileEntryInfo entryInfo = entrys.get(i);
|
|
|
String eSignTemplateId = entryInfo.getESignTemplateId();
|
|
String eSignTemplateId = entryInfo.getESignTemplateId();
|
|
@@ -177,7 +180,7 @@ public class ESignTemplateControllerBean extends AbstractESignTemplateController
|
|
|
}
|
|
}
|
|
|
JSONObject data = jsonObject.getJSONObject("data");
|
|
JSONObject data = jsonObject.getJSONObject("data");
|
|
|
//附件下载地址
|
|
//附件下载地址
|
|
|
- String fileDownloadUrl = data.getString("fileDownloadUrl");
|
|
|
|
|
|
|
+ //String fileDownloadUrl = data.getString("fileDownloadUrl");
|
|
|
JSONArray components = data.getJSONArray("components");
|
|
JSONArray components = data.getJSONArray("components");
|
|
|
//2.比较现有模板字段,如果新增字段则添加,删除字段就更新为失效
|
|
//2.比较现有模板字段,如果新增字段则添加,删除字段就更新为失效
|
|
|
for (int j = 0; j < components.size(); j++) {
|
|
for (int j = 0; j < components.size(); j++) {
|
|
@@ -224,17 +227,9 @@ public class ESignTemplateControllerBean extends AbstractESignTemplateController
|
|
|
BigDecimal componentPositionY = componentPosition.getBigDecimal("componentPositionY");
|
|
BigDecimal componentPositionY = componentPosition.getBigDecimal("componentPositionY");
|
|
|
fieldInfo.setPositionX(componentPositionX);
|
|
fieldInfo.setPositionX(componentPositionX);
|
|
|
fieldInfo.setPositionY(componentPositionY);
|
|
fieldInfo.setPositionY(componentPositionY);
|
|
|
-// if (ComponentTypeEnum.SIGN_AREA.equals(fieldInfo.getComponentType()) && (componentPositionX == null || componentPositionY == null)) {
|
|
|
|
|
-// //签名区域没有坐标 更新为骑缝签署区
|
|
|
|
|
-// fieldInfo.setComponentType(ComponentTypeEnum.PERFORATED_SIGN_AREA);
|
|
|
|
|
-// }
|
|
|
|
|
fieldInfo.setPageNum(componentPosition.getInteger("componentPageNum"));
|
|
fieldInfo.setPageNum(componentPosition.getInteger("componentPageNum"));
|
|
|
fieldInfo.setPageRange(componentPosition.getString("componentPageRange"));
|
|
fieldInfo.setPageRange(componentPosition.getString("componentPageRange"));
|
|
|
}
|
|
}
|
|
|
-// if(null==fieldInfo.getId()) {
|
|
|
|
|
-// fieldInfo.setParent1(entryInfo);
|
|
|
|
|
-// field.save(fieldInfo);
|
|
|
|
|
-// }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (!fieldMap.isEmpty()) {
|
|
if (!fieldMap.isEmpty()) {
|
|
@@ -252,11 +247,10 @@ public class ESignTemplateControllerBean extends AbstractESignTemplateController
|
|
|
// throw new RuntimeException(e);
|
|
// throw new RuntimeException(e);
|
|
|
}
|
|
}
|
|
|
entryInfo.setSyncTime(new Time(System.currentTimeMillis()));
|
|
entryInfo.setSyncTime(new Time(System.currentTimeMillis()));
|
|
|
- //更新
|
|
|
|
|
- field.update(new ObjectUuidPK(entryInfo.getId()),entryInfo);
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- //update(ctx, new ObjectUuidPK(billId), info);
|
|
|
|
|
|
|
+ //因为重写了更新方法,所以这里需要设置isSyncAction为true
|
|
|
|
|
+ info.setBoolean("isSyncAction", true);
|
|
|
|
|
+ update(ctx, new ObjectUuidPK(billId), info);
|
|
|
//3.同步模板附件
|
|
//3.同步模板附件
|
|
|
//syncTemplateAttachments(ctx, billId);
|
|
//syncTemplateAttachments(ctx, billId);
|
|
|
}
|
|
}
|