|
|
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.kingdee.eas.base.permission.UserInfo;
|
|
|
-import com.kingdee.eas.framework.CoreBaseCollection;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import com.kingdee.bos.BOSException;
|
|
|
import com.kingdee.bos.Context;
|
|
|
@@ -26,6 +25,7 @@ import com.kingdee.shr.base.syssetting.ml.SHRWebResource;
|
|
|
import com.kingdee.shr.ml.util.MutilanUtils;
|
|
|
import com.kingdee.util.LocaleUtils;
|
|
|
import com.kingdee.util.STConverter;
|
|
|
+import org.apache.log4j.Logger;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.text.MessageFormat;
|
|
|
@@ -39,6 +39,8 @@ import java.util.Set;
|
|
|
* @Created by heyuan
|
|
|
*/
|
|
|
public class SyncSignedFilesUtil {
|
|
|
+ private static Logger logger = Logger.getLogger(SyncSignedFilesUtil.class);
|
|
|
+
|
|
|
// 员工页签的uipk
|
|
|
private static final String EMPPAGEUIPK = "com.kingdee.eas.custom.esign.app.FileTab.form";
|
|
|
|
|
|
@@ -85,13 +87,13 @@ public class SyncSignedFilesUtil {
|
|
|
}
|
|
|
IFileTab iFileTab = FileTabFactory.getLocalInstance(ctx);
|
|
|
FileTabCollection fileTabCollection = iFileTab.getFileTabCollection("where person.id ='" + person.getId() + "'");
|
|
|
- FileTabInfo fileTabInfo = null;
|
|
|
+ FileTabInfo fileTabInfo = null;
|
|
|
if (fileTabCollection.isEmpty()) {
|
|
|
fileTabInfo = new FileTabInfo();
|
|
|
fileTabInfo.setPerson(person);
|
|
|
iFileTab.addnew(fileTabInfo);
|
|
|
- }else {
|
|
|
- fileTabInfo=fileTabCollection.get(0);
|
|
|
+ } else {
|
|
|
+ fileTabInfo = fileTabCollection.get(0);
|
|
|
}
|
|
|
// 调用e签宝接口获取文件下载地址
|
|
|
EsignHttpResponse response = EsignHttpUtil.getFile_download_url(ctx, signFlowId, 3600, info.getEfileId());
|
|
|
@@ -127,7 +129,7 @@ public class SyncSignedFilesUtil {
|
|
|
Context ctx,
|
|
|
FileTabInfo fileTabInfo,
|
|
|
JSONArray attachments
|
|
|
- ) throws IOException, ShrWebBizException, BOSException, EASBizException {
|
|
|
+ ) throws IOException, BOSException, EASBizException {
|
|
|
IESignTemplateFileEntry ieSignTemplateFileEntry = ESignTemplateFileEntryFactory.getLocalInstance(ctx);
|
|
|
IAttachment iAttachment = AttachmentFactory.getLocalInstance(ctx);
|
|
|
IBoAttchAsso iBoAttchAsso = BoAttchAssoFactory.getLocalInstance(ctx);
|
|
|
@@ -140,6 +142,11 @@ public class SyncSignedFilesUtil {
|
|
|
String fileName = fileMap.getString("fileName");
|
|
|
String downloadUrl = fileMap.getString("downloadUrl");
|
|
|
String fileId = "fileTab" + fileMap.getString("fileId");
|
|
|
+ logger.error("fileId: " + fileId);
|
|
|
+ if (StringUtils.isBlank(downloadUrl)) {
|
|
|
+ logger.error("下载地址为空!");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
// 查询对应模板文件的组件ID
|
|
|
String componentId = ieSignTemplateFileEntry.findByFileName(fileName);
|
|
|
// 查询附件是否存在,如果存在需要删除
|
|
|
@@ -181,8 +188,9 @@ public class SyncSignedFilesUtil {
|
|
|
try {
|
|
|
//保存附件对象
|
|
|
iAttachment.addnew(ai);
|
|
|
- } catch (Exception var20) {
|
|
|
- throw new ShrWebBizException(SHRWebResource.getString("com.kingdee.shr.base.syssetting.SHRSyssettingResource", "upload_error"), var20);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw e;
|
|
|
}
|
|
|
attchExt.setState(AttachmentState.SAVE);
|
|
|
//保存附件扩展
|
|
|
@@ -219,7 +227,6 @@ public class SyncSignedFilesUtil {
|
|
|
|
|
|
//判断是否存在附件
|
|
|
if (iAttachment.exists(filterInfo)) {
|
|
|
- System.out.println(filterInfo.toSql());
|
|
|
// 获取附件集合
|
|
|
AttachmentCollection attachmentCol = iAttachment.getAttachmentCollection(viewInfo);
|
|
|
ObjectUuidPK[] attachMentIds = new ObjectUuidPK[attachmentCol.size()];
|