wu 1 giorno fa
parent
commit
68e2a555c6

+ 9 - 1
src/custom/restcontroller/webmanage/sale/contracttask/WeChatContractUtil.java

@@ -7,7 +7,9 @@ import com.tencentcloudapi.common.profile.HttpProfile;
 import com.tencentcloudapi.essbasic.v20210526.EssbasicClient;
 import com.tencentcloudapi.essbasic.v20210526.models.*;
 import common.BaseClass;
+import common.YosException;
 import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang.StringUtils;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -281,7 +283,7 @@ public class WeChatContractUtil extends BaseClass {
      */
     public static Map<String, String[]> createFlowByTemplateDirectly(String flowName,
                                                                      String templateId,
-                                                                     FlowApproverInfo[] flowApproverInfos, String organizationOpenId, CompanyInfo companyInfo, ArrayList<String> fileBase64List) {
+                                                                     FlowApproverInfo[] flowApproverInfos, String organizationOpenId, CompanyInfo companyInfo, ArrayList<String> fileBase64List) throws YosException {
         Map<String, String[]> resp = new HashMap<>();
         // 设置agent参数
         Agent agent = setAgent(organizationOpenId);
@@ -335,6 +337,12 @@ public class WeChatContractUtil extends BaseClass {
 
         // 发起签署
         CreateFlowsByTemplatesResponse flowResponse = createFlowsByTemplates(agent, FlowInfos);
+        if (flowResponse.getErrorMessages().length > 0) {
+            String errorMessage = flowResponse.getErrorMessages()[0];
+            if (!StringUtils.isBlank(errorMessage)) {
+                throw new YosException(false, flowResponse.getErrorMessages()[0]);
+            }
+        }
         assert flowResponse != null;
         String[] FlowIds = flowResponse.getFlowIds();
         resp.put("FlowIds", FlowIds);