|
|
@@ -181,17 +181,58 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
if (StringUtils.isBlank(info.getSignFlowId())) {
|
|
|
throw new EsignException("没有签署流程id");
|
|
|
}
|
|
|
- EsignHttpResponse httpRes = EsignHttpUtil.revoke_by_file(this.getCtx(), info.getSignFlowId(), revokeReason, info.getEfileId());
|
|
|
+ boolean isSess = false;
|
|
|
+ EsignHttpResponse httpRes = EsignHttpUtil.sign_flow_rescind(this.getCtx(), info.getSignFlowId(), info.getEfileId());
|
|
|
if (httpRes.getStatus() >= 200 && httpRes.getStatus() < 300) {
|
|
|
JSONObject object = JSON.parseObject(httpRes.getBody());
|
|
|
if ("0".equals(String.valueOf(object.get("code")))) {
|
|
|
-
|
|
|
BatchMessageTipsBody body = new BatchMessageTipsBody();
|
|
|
body.setMuitTipsState(Boolean.TRUE);
|
|
|
body.setMuitTipsMessage(httpRes.getBody());
|
|
|
body.setId(billId);
|
|
|
batchMessageTipsHeader.addResult(body);
|
|
|
+ info.setEsignStatus(EsignStatusEnum.REVOKED);
|
|
|
+ globalStatusOverview.save(info);
|
|
|
success++;
|
|
|
+ isSess = true;
|
|
|
+ } else {
|
|
|
+ isSess = false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ isSess = false;
|
|
|
+ }
|
|
|
+ if (!isSess) {
|
|
|
+ httpRes = EsignHttpUtil.revoke_by_file(this.getCtx(), info.getSignFlowId(), revokeReason, info.getEfileId());
|
|
|
+ if (httpRes.getStatus() >= 200 && httpRes.getStatus() < 300) {
|
|
|
+ JSONObject object = JSON.parseObject(httpRes.getBody());
|
|
|
+ if ("0".equals(String.valueOf(object.get("code")))) {
|
|
|
+
|
|
|
+ BatchMessageTipsBody body = new BatchMessageTipsBody();
|
|
|
+ body.setMuitTipsState(Boolean.TRUE);
|
|
|
+ body.setMuitTipsMessage(httpRes.getBody());
|
|
|
+ body.setId(billId);
|
|
|
+ batchMessageTipsHeader.addResult(body);
|
|
|
+ info.setEsignStatus(EsignStatusEnum.REVOKED);
|
|
|
+ globalStatusOverview.save(info);
|
|
|
+ success++;
|
|
|
+ } else {
|
|
|
+ if(httpRes.getBody().indexOf("流程不存在:")>0){
|
|
|
+ BatchMessageTipsBody body = new BatchMessageTipsBody();
|
|
|
+ body.setMuitTipsState(Boolean.TRUE);
|
|
|
+ body.setMuitTipsMessage(httpRes.getBody());
|
|
|
+ body.setId(billId);
|
|
|
+ batchMessageTipsHeader.addResult(body);
|
|
|
+ info.setEsignStatus(EsignStatusEnum.REVOKED);
|
|
|
+ globalStatusOverview.save(info);
|
|
|
+ success++;
|
|
|
+ }else {
|
|
|
+ BatchMessageTipsBody body = new BatchMessageTipsBody();
|
|
|
+ body.setMuitTipsState(Boolean.FALSE);
|
|
|
+ body.setMuitTipsMessage(httpRes.getBody());
|
|
|
+ body.setId(billId);
|
|
|
+ batchMessageTipsHeader.addResult(body);
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
BatchMessageTipsBody body = new BatchMessageTipsBody();
|
|
|
body.setMuitTipsState(Boolean.FALSE);
|
|
|
@@ -199,14 +240,7 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
body.setId(billId);
|
|
|
batchMessageTipsHeader.addResult(body);
|
|
|
}
|
|
|
- } else {
|
|
|
- BatchMessageTipsBody body = new BatchMessageTipsBody();
|
|
|
- body.setMuitTipsState(Boolean.FALSE);
|
|
|
- body.setMuitTipsMessage(httpRes.getBody());
|
|
|
- body.setId(billId);
|
|
|
- batchMessageTipsHeader.addResult(body);
|
|
|
}
|
|
|
-
|
|
|
} catch (EsignException e) {
|
|
|
e.printStackTrace();
|
|
|
throw new ShrWebBizException(e);
|
|
|
@@ -259,30 +293,8 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
if (StringUtils.isBlank(info.getSignFlowId())) {
|
|
|
throw new EsignException("没有签署流程id");
|
|
|
}
|
|
|
- String json = info.getRequestParams();
|
|
|
- JSONObject params = JSON.parseObject(json);
|
|
|
- Map<String, Object> jsonMap = Maps.newHashMap();
|
|
|
- Set<String> noticeSet = Sets.newHashSet();
|
|
|
- JSONArray jsonArray = params.getJSONArray("signers");
|
|
|
- if(null!=jsonArray) {
|
|
|
- for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
- JSONObject param = jsonArray.getJSONObject(i);
|
|
|
- JSONObject noticeConfig = param.getJSONObject("noticeConfig");
|
|
|
- if (null != noticeConfig) {
|
|
|
- String noticeTypeStr = noticeConfig.getString("noticeTypes");
|
|
|
- if (StringUtils.isNotBlank(noticeTypeStr)) {
|
|
|
- String[] noticeTypes = noticeTypeStr.split(",");
|
|
|
- for (String nts : noticeTypes) {
|
|
|
- noticeSet.add(nts);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- jsonMap.put("noticeTypes", StringUtils.join(noticeSet.toArray(), ","));
|
|
|
- }else {
|
|
|
- jsonMap.put("noticeTypes", "1,2");
|
|
|
- }
|
|
|
- EsignHttpResponse httpRes = EsignHttpUtil.urge_by_file(this.getCtx(), info.getSignFlowId(), JSON.toJSONString(jsonMap), info.getEfileId());
|
|
|
+ boolean isSess=false;
|
|
|
+ EsignHttpResponse httpRes = EsignHttpUtil.urge_filling(this.getCtx(), info.getSignFlowId(), null,info.getEfileId());
|
|
|
if (httpRes.getStatus() >= 200 && httpRes.getStatus() < 300) {
|
|
|
JSONObject object = JSON.parseObject(httpRes.getBody());
|
|
|
if ("0".equals(String.valueOf(object.get("code")))) {
|
|
|
@@ -293,6 +305,64 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
body.setId(billId);
|
|
|
batchMessageTipsHeader.addResult(body);
|
|
|
success++;
|
|
|
+ isSess=true;
|
|
|
+ } else {
|
|
|
+ if("1451001".equals(String.valueOf(object.get("code")))) {
|
|
|
+ BatchMessageTipsBody body = new BatchMessageTipsBody();
|
|
|
+ body.setMuitTipsState(Boolean.FALSE);
|
|
|
+ body.setMuitTipsMessage(httpRes.getBody());
|
|
|
+ body.setId(billId);
|
|
|
+ batchMessageTipsHeader.addResult(body);
|
|
|
+ //{"code":1451001,"message":"重复催办: 您刚刚催办过,发起半小时后每十分钟仅可催办一次。","data":null}
|
|
|
+ isSess = true;
|
|
|
+ }else {
|
|
|
+ isSess = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ isSess=false;
|
|
|
+ }
|
|
|
+ if(!isSess) {
|
|
|
+ String json = info.getRequestParams();
|
|
|
+ JSONObject params = JSON.parseObject(json);
|
|
|
+ Map<String, Object> jsonMap = Maps.newHashMap();
|
|
|
+ Set<String> noticeSet = Sets.newHashSet();
|
|
|
+ JSONArray jsonArray = params.getJSONArray("signers");
|
|
|
+ if (null != jsonArray) {
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ JSONObject param = jsonArray.getJSONObject(i);
|
|
|
+ JSONObject noticeConfig = param.getJSONObject("noticeConfig");
|
|
|
+ if (null != noticeConfig) {
|
|
|
+ String noticeTypeStr = noticeConfig.getString("noticeTypes");
|
|
|
+ if (StringUtils.isNotBlank(noticeTypeStr)) {
|
|
|
+ String[] noticeTypes = noticeTypeStr.split(",");
|
|
|
+ for (String nts : noticeTypes) {
|
|
|
+ noticeSet.add(nts);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ jsonMap.put("noticeTypes", StringUtils.join(noticeSet.toArray(), ","));
|
|
|
+ } else {
|
|
|
+ jsonMap.put("noticeTypes", "1,2");
|
|
|
+ }
|
|
|
+ httpRes = EsignHttpUtil.urge_by_file(this.getCtx(), info.getSignFlowId(), JSON.toJSONString(jsonMap), info.getEfileId());
|
|
|
+ if (httpRes.getStatus() >= 200 && httpRes.getStatus() < 300) {
|
|
|
+ JSONObject object = JSON.parseObject(httpRes.getBody());
|
|
|
+ if ("0".equals(String.valueOf(object.get("code")))) {
|
|
|
+ BatchMessageTipsBody body = new BatchMessageTipsBody();
|
|
|
+ body.setMuitTipsState(Boolean.TRUE);
|
|
|
+ body.setMuitTipsMessage(httpRes.getBody());
|
|
|
+ body.setId(billId);
|
|
|
+ batchMessageTipsHeader.addResult(body);
|
|
|
+ success++;
|
|
|
+ } else {
|
|
|
+ BatchMessageTipsBody body = new BatchMessageTipsBody();
|
|
|
+ body.setMuitTipsState(Boolean.FALSE);
|
|
|
+ body.setMuitTipsMessage(httpRes.getBody());
|
|
|
+ body.setId(billId);
|
|
|
+ batchMessageTipsHeader.addResult(body);
|
|
|
+ }
|
|
|
} else {
|
|
|
BatchMessageTipsBody body = new BatchMessageTipsBody();
|
|
|
body.setMuitTipsState(Boolean.FALSE);
|
|
|
@@ -300,12 +370,6 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
body.setId(billId);
|
|
|
batchMessageTipsHeader.addResult(body);
|
|
|
}
|
|
|
- } else {
|
|
|
- BatchMessageTipsBody body = new BatchMessageTipsBody();
|
|
|
- body.setMuitTipsState(Boolean.FALSE);
|
|
|
- body.setMuitTipsMessage(httpRes.getBody());
|
|
|
- body.setId(billId);
|
|
|
- batchMessageTipsHeader.addResult(body);
|
|
|
}
|
|
|
} catch (EsignException e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -323,6 +387,7 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
|
|
|
/**
|
|
|
* 预览附件
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @param response
|
|
|
* @param modelMap
|
|
|
@@ -380,7 +445,7 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
} else {
|
|
|
EsignHttpResponse responsesf = EsignHttpUtil.getSign_fields(this.getCtx(), info.getSignFlowId(), info.getEfileId());
|
|
|
JSONObject params = JSON.parseObject(responsesf.getBody());
|
|
|
- if ( 0 == params.getInteger("code")) {
|
|
|
+ if (0 == params.getInteger("code")) {
|
|
|
JSONObject data = params.getJSONObject("data");
|
|
|
JSONArray docs = data.getJSONArray("docs");
|
|
|
this.saveDocsPreviewFile(info, docs);
|
|
|
@@ -408,6 +473,7 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
this.writeSuccessData(batchMessageTipsHeader);
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
public void saveDocsFile(ESignGlobalStatusOverviewInfo info) throws EsignException, URISyntaxException, IOException, ShrWebBizException, BOSException, EASBizException {
|
|
|
EsignHttpResponse response1;
|
|
|
response1 = EsignHttpUtil.getFile_download_url(this.getCtx(), info.getSignFlowId(), 3600, info.getEfileId());
|
|
|
@@ -416,14 +482,14 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
if (code == 0) {
|
|
|
JSONObject jsonData = jsonObject.getJSONObject("data");
|
|
|
JSONArray files = jsonData.getJSONArray("files");
|
|
|
- if(null!=files) {
|
|
|
+ if (null != files) {
|
|
|
for (int i = 0; i < files.size(); i++) {
|
|
|
JSONObject fileMap = files.getJSONObject(i);
|
|
|
this.saveAttachment(this.getCtx(), info, fileMap, "com.kingdee.eas.custom.esign.app.ESignGlobalStatusOverview.list", "files");
|
|
|
}
|
|
|
}
|
|
|
JSONArray attachments = jsonData.getJSONArray("attachments");
|
|
|
- if(null!=attachments) {
|
|
|
+ if (null != attachments) {
|
|
|
for (int i = 0; i < attachments.size(); i++) {
|
|
|
JSONObject fileMap = attachments.getJSONObject(i);
|
|
|
this.saveAttachment(this.getCtx(), info, fileMap, "com.kingdee.eas.custom.esign.app.ESignGlobalStatusOverview.list", "attachments");
|
|
|
@@ -431,6 +497,7 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
public void saveDocsPreviewFile(ESignGlobalStatusOverviewInfo info, JSONArray docs) throws EsignException, URISyntaxException, IOException, ShrWebBizException, BOSException, EASBizException {
|
|
|
EsignHttpResponse response1;
|
|
|
for (int i = 0; i < docs.size(); i++) {
|
|
|
@@ -447,7 +514,8 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 同步签署状态信息
|
|
|
+ * 同步签署状态信息
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @param response
|
|
|
* @param modelMap
|
|
|
@@ -469,11 +537,11 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
selectorItemCollection.add(new SelectorItemInfo("person.id"));
|
|
|
selectorItemCollection.add(new SelectorItemInfo("operator.id"));
|
|
|
ESignGlobalStatusOverviewInfo info = globalStatusOverview.getESignGlobalStatusOverviewInfo(new ObjectUuidPK(billId));
|
|
|
- if (null!=info&&StringUtils.isBlank(info.getSignFlowId())) {
|
|
|
+ if (null != info && StringUtils.isBlank(info.getSignFlowId())) {
|
|
|
throw new EsignException("没有签署流程id");
|
|
|
}
|
|
|
|
|
|
- EsignHttpResponse res = EsignHttpUtil.getSign_fields(this.getCtx(),info.getSignFlowId(),info.getEfileId());
|
|
|
+ EsignHttpResponse res = EsignHttpUtil.getSign_fields(this.getCtx(), info.getSignFlowId(), info.getEfileId());
|
|
|
if (res.getStatus() >= 200 && res.getStatus() < 300) {
|
|
|
JSONObject jsonObject = JSON.parseObject(res.getBody());
|
|
|
Integer code = (Integer) jsonObject.get("code");
|
|
|
@@ -487,7 +555,7 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
SelectorItemCollection selectorUpdatePartial = new SelectorItemCollection();
|
|
|
selectorUpdatePartial.add(new SelectorItemInfo("esignStatus"));
|
|
|
selectorUpdatePartial.add(new SelectorItemInfo("description"));
|
|
|
- globalStatusOverview.updatePartial(info,selectorUpdatePartial);
|
|
|
+ globalStatusOverview.updatePartial(info, selectorUpdatePartial);
|
|
|
}
|
|
|
}
|
|
|
BatchMessageTipsBody body = new BatchMessageTipsBody();
|
|
|
@@ -509,8 +577,10 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
this.writeSuccessData(batchMessageTipsHeader);
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- * 同步签署完成附件
|
|
|
+ * 同步签署完成附件
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @param response
|
|
|
* @param modelMap
|
|
|
@@ -538,7 +608,7 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
// if (!info.isFivouchered()) {
|
|
|
// throw new EsignException("电子签全域状态总览表 [{0}],签署文件已经同步,请勿重复同步");
|
|
|
// }
|
|
|
- SyncSignedFilesUtil.syncAttachmentsForEmpPage(this.getCtx(),billId);
|
|
|
+ SyncSignedFilesUtil.syncAttachmentsForEmpPage(this.getCtx(), billId);
|
|
|
BatchMessageTipsBody body = new BatchMessageTipsBody();
|
|
|
body.setMuitTipsState(Boolean.TRUE);
|
|
|
body.setMuitTipsMessage("触发同步成功");
|
|
|
@@ -560,7 +630,6 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
private void delAttachment(Context ctx, ESignGlobalStatusOverviewInfo info) throws BOSException, EASBizException {
|
|
|
ISHRAttachmentExt SHRAttchExt = SHRAttachmentExtFactory.getLocalInstance(ctx);
|
|
|
IAttachment attachment = AttachmentFactory.getLocalInstance(ctx);
|
|
|
@@ -594,12 +663,12 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
private void saveAttachment(Context ctx, ESignGlobalStatusOverviewInfo info, JSONObject fileMap, String uipk, String propertyName) throws IOException, ShrWebBizException, BOSException, EASBizException {
|
|
|
String fileId = fileMap.getString("fileId");
|
|
|
String fileName = fileMap.getString("fileName");
|
|
|
- System.out.println("saveAttachment:fileMap"+fileMap);
|
|
|
- if(StringUtils.isBlank(fileName)) {
|
|
|
- fileName = info.getFileName()+".pdf";
|
|
|
+ System.out.println("saveAttachment:fileMap" + fileMap);
|
|
|
+ if (StringUtils.isBlank(fileName)) {
|
|
|
+ fileName = info.getFileName() + ".pdf";
|
|
|
}
|
|
|
String downloadUrl = fileMap.getString("downloadUrl");
|
|
|
- if(StringUtils.isBlank(downloadUrl)) {
|
|
|
+ if (StringUtils.isBlank(downloadUrl)) {
|
|
|
downloadUrl = fileMap.getString("fileDownloadUrl");
|
|
|
}
|
|
|
IAttachment attachment = AttachmentFactory.getLocalInstance(ctx);
|
|
|
@@ -607,14 +676,14 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
ISHRAttachmentExt SHRAttchExt = SHRAttachmentExtFactory.getLocalInstance(ctx);
|
|
|
byte[] content = DownloaderUtil.downloadFileToByteArray(downloadUrl);
|
|
|
fileName = this.checkScriptAttack(fileName);
|
|
|
- if( fileName.lastIndexOf(46)<=0) {
|
|
|
- fileName +=".pdf";
|
|
|
+ if (fileName.lastIndexOf(46) <= 0) {
|
|
|
+ fileName += ".pdf";
|
|
|
}
|
|
|
String mainname = fileName.substring(0, fileName.lastIndexOf(46));
|
|
|
String extname = fileName.substring(fileName.lastIndexOf(46) + 1, fileName.length());
|
|
|
extname = extname.toLowerCase();
|
|
|
- if ("html".equals(extname)){
|
|
|
- extname="pdf";
|
|
|
+ if ("html".equals(extname)) {
|
|
|
+ extname = "pdf";
|
|
|
}
|
|
|
SHRAttachmentExtInfo attchExt = new SHRAttachmentExtInfo();
|
|
|
AttachmentInfo ai = new AttachmentInfo();
|
|
|
@@ -632,10 +701,10 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
|
|
|
}
|
|
|
ai.setSizeInByte(size);
|
|
|
ai.setAttachID("" + System.currentTimeMillis());
|
|
|
- ai.setType(this.getFileType(mainname+"."+extname));
|
|
|
+ ai.setType(this.getFileType(mainname + "." + extname));
|
|
|
ai.setBeizhu(uipk);
|
|
|
attchExt.setAttachment(ai);
|
|
|
- this.setAttExtMulNameAndDesc(ctx, attchExt, mainname+"."+extname, fileId);
|
|
|
+ this.setAttExtMulNameAndDesc(ctx, attchExt, mainname + "." + extname, fileId);
|
|
|
attchExt.setPropertyName(propertyName);
|
|
|
attchExt.setType(AttachmentTypeEnum.PROPERTY);
|
|
|
attchExt.setState(AttachmentState.UNSAVE);
|