9060 4 weeks ago
parent
commit
3fd92b971b

+ 176 - 0
websrc/com/kingdee/eas/custom/esign/osf/CallBackToOSFService.java

@@ -0,0 +1,176 @@
+package com.kingdee.eas.custom.esign.osf;
+
+import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.Maps;
+import com.kingdee.bos.BOSException;
+import com.kingdee.bos.Context;
+import com.kingdee.bos.bsf.service.app.IHRMsfService;
+import com.kingdee.bos.metadata.entity.*;
+import com.kingdee.eas.common.EASBizException;
+import com.kingdee.eas.custom.esign.ESignGlobalStatusOverviewCollection;
+import com.kingdee.eas.custom.esign.ESignGlobalStatusOverviewFactory;
+import com.kingdee.eas.custom.esign.ESignGlobalStatusOverviewInfo;
+import com.kingdee.eas.custom.esign.IESignGlobalStatusOverview;
+import com.kingdee.eas.custom.esign.bizEnum.EsignStatusEnum;
+
+import java.util.Map;
+
+/**
+ * https://open.esign.cn/doc/opendoc/notify3/sblzg8
+ * 签署类通知事件
+ *
+ * 签署方-已读通知:OPERATOR_READ
+ *
+ * 签署方-签署结果通知:SIGN_MISSON_COMPLETE
+ *
+ * 流程结束通知:SIGN_FLOW_COMPLETE
+ *
+ * 签署发起成功通知:SIGN_FLOW_INITIATED
+ *
+ * 签署人更正个人信息回调通知:OPERATOR_CORRECT_IDENTITY
+ *
+ * 经办人转交签署任务通知:TRANSMISS_SIGN
+ *
+ * 用印审批驳回通知:SIGN_SEAL_EXAMINE_REJECTED
+ *
+ * 合同发起解约通知:SIGN_FILE_RESCISSION_INITIATE
+ *
+ * 合同解约成功通知:SIGN_FILE_RESCINDED
+ *
+ * 抄送方-已读通知:COPIER_READ
+ *
+ * 批量签署结果通知:BATCH_SIGN_FLOW_COMPLETE
+ *
+ *
+ * description: CallBackToOSFService <br>
+ * date: 24/11/2025 下午 5:11 <br>
+ * author: lhbj <br>
+ * version: 1.0 <br>
+ */
+public class CallBackToOSFService implements IHRMsfService {
+    @Override
+    public Object process(Context ctx, Map<String, Object> map) throws EASBizException, BOSException {
+        String data = (String) map.get("data");
+        JSONObject jsonObject =JSONObject.parseObject(data);
+        String action = jsonObject.getString("action");
+        if("SIGN_FLOW_COMPLETE".equals(action)){
+            return SIGN_FLOW_COMPLETE(ctx,jsonObject);
+        }
+
+        return "success";
+    }
+
+    /**
+     * 签署人打开签署文件
+     * {
+     *     "action": "OPERATOR_READ",
+     *     "timestamp": 1763969581086,
+     *     "signFlowId": "f106295489f7421b82c8c78ca1673aed",
+     *     "customBizNum": "62453221152523",
+     *     "signOrder": 1,
+     *     "readTime": "2025-11-24 15:33:01",
+     *     "operator": {
+     *         "psnId": "8f69856a21584a04b4b7be84ca49ed0c",
+     *         "psnAccount": {
+     *             "accountMobile": "17620530018"
+     *         }
+     *     }
+     * }
+     * @param jsonObject
+     * @return
+     */
+    public Map<String,Object> OPERATOR_READ(Context ctx,JSONObject jsonObject){
+        Map<String,Object> map = Maps.newHashMap();
+        map.put("state","success");
+        return map;
+    }
+
+    /**
+     * 签署人签名消息任务完成
+     *
+     * {
+     *     "action": "SIGN_MISSON_COMPLETE",
+     *     "timestamp": 1763969637171,
+     *     "signFlowId": "f106295489f7421b82c8c78ca1673aed",
+     *     "customBizNum": "62453221152523",
+     *     "signOrder": 1,
+     *     "operateTime": 1763969637000,
+     *     "signResult": 4,(2 - 签署完成,4 - 拒签)
+     *     "resultDescription": "测试回调",
+     *     "operator": {
+     *         "psnId": "8f69856a21584a04b4b7be84ca49ed0c",
+     *         "psnAccount": {
+     *             "accountMobile": "17620530018"
+     *         }
+     *     }
+     * }
+     * @param jsonObject
+     * @return
+     */
+    public Map<String,Object> SIGN_MISSON_COMPLETE(Context ctx,JSONObject jsonObject){
+        Map<String,Object> map = Maps.newHashMap();
+        map.put("state","success");
+
+        return map;
+    }
+
+    /**
+     * 签署人签名流程任务完成
+     * {
+     *     "action": "SIGN_FLOW_COMPLETE",
+     *     "timestamp": 1763969637153,
+     *     "signFlowId": "f106295489f7421b82c8c78ca1673aed",
+     *     "signFlowTitle": "测试签署",
+     *     "signFlowStatus": "7",
+     *     "statusDescription": "测试回调",
+     *     "signFlowCreateTime": 1763969482000,
+     *     "signFlowStartTime": 1763969483000,
+     *     "signFlowFinishTime": 1763969637000
+     * }
+     * signFlowStatus:
+     *  2 - 已完成(所有签署方完成签署)
+     *  3 - 已撤销(发起方撤销签署任务)
+     *  5 - 已过期(签署截止日到期后触发)
+     *  7 - 已拒签(签署方拒绝签署)
+     *
+     * @param jsonObject
+     * @return
+     */
+    public Map<String,Object> SIGN_FLOW_COMPLETE(Context ctx,JSONObject jsonObject) throws BOSException, EASBizException {
+        Map<String, Object> map = getStringObjectMap(ctx, jsonObject);
+        this.afterComplete(ctx, jsonObject);
+        return map;
+    }
+
+    public Map<String, Object> getStringObjectMap(Context ctx, JSONObject jsonObject) throws BOSException, EASBizException {
+        Map<String,Object> map = Maps.newHashMap();
+        map.put("state","success");
+        String signFlowStatus = jsonObject.getString("signFlowStatus");
+        String signFlowId = jsonObject.getString("signFlowId");
+        String statusDescription = jsonObject.getString("statusDescription");
+        EntityViewInfo view = new EntityViewInfo();
+        FilterInfo filterInfo = new FilterInfo();
+        filterInfo.getFilterItems().add(new FilterItemInfo("signFlowId='"+signFlowId+"'"));
+        view.setFilter(filterInfo);
+        SelectorItemCollection selectorItemCollection = new SelectorItemCollection();
+        selectorItemCollection.add(new SelectorItemInfo("*"));
+        view.setSelector(selectorItemCollection);
+        IESignGlobalStatusOverview globalStatusOverview = ESignGlobalStatusOverviewFactory.getLocalInstance(ctx);
+        ESignGlobalStatusOverviewCollection collection = globalStatusOverview.getESignGlobalStatusOverviewCollection(view);
+        for( int i=0;i<collection.size();i++){
+            ESignGlobalStatusOverviewInfo info = collection.get(i);
+            info.setEsignStatus(EsignStatusEnum.getEnum(Integer.parseInt(signFlowStatus)));
+            info.setDescription(statusDescription);
+        }
+        SelectorItemCollection selectorUpdatePartial = new SelectorItemCollection();
+        selectorUpdatePartial.add(new SelectorItemInfo("esignStatus"));
+        selectorUpdatePartial.add(new SelectorItemInfo("description"));
+        globalStatusOverview.updatePartialBatchData(collection,selectorUpdatePartial);
+        return map;
+    }
+
+
+    public void afterComplete(Context ctx, JSONObject jsonObject) {
+
+    }
+}

+ 401 - 0
websrc/com/kingdee/eas/custom/esign/osf/Create_by_fileOSFService.java

@@ -0,0 +1,401 @@
+package com.kingdee.eas.custom.esign.osf;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.kingdee.bos.BOSException;
+import com.kingdee.bos.Context;
+import com.kingdee.bos.bsf.service.app.IHRMsfService;
+import com.kingdee.eas.common.EASBizException;
+
+import com.kingdee.eas.custom.esign.tsign.hz.comm.EsignHttpResponse;
+import com.kingdee.eas.custom.esign.tsign.hz.exception.EsignException;
+import com.kingdee.eas.custom.esign.util.EsignConfig;
+import com.kingdee.eas.custom.esign.util.EsignHttpUtil;
+import org.apache.commons.lang3.StringUtils;
+
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * description: Create_by_fileOSFService <br>
+ * date: 28/11/2025 上午 9:46 <br>
+ * author: lhbj <br>
+ * version: 1.0 <br>
+ */
+public class Create_by_fileOSFService implements IHRMsfService {
+
+    public static void main(String[] args) {
+        JSONObject jsonObject = JSON.parseObject("{\"tableName\":\"3-信息安全承诺书.pdf\",\"tableId\":\"4b19400154d1444e969bf69a6ce0c83c\",\"fields\":{\"49e2cabb3fff4e0090d580f7d4d6e0fc\":{\"name\":\"单行文本1\",\"dataType\":\"单行文本\",\"dataFormat\":\"undefined\",\"value\":\"大王大大\"},\"700825a785484185a6e3fd02e358792c\":{\"name\":\"工号\",\"dataType\":\"单行文本\",\"dataFormat\":\"undefined\",\"value\":\"1234534\"},\"a95f4a5d491d473cbba755a9bb84a04a\":{\"name\":\"日期1\",\"dataType\":\"Date\",\"dataFormat\":\"undefined\",\"value\":\"2024-12-03 00:00:00\"},\"35e09954d6aa41538bd27ffc42da59aa\":{\"name\":\"部门\",\"dataType\":\"String\",\"dataFormat\":\"undefined\",\"value\":\"HR产品处\"},\"df8743514be54648a1bc755cd51e315c\":{\"name\":\"多行文本1\",\"dataType\":\"String\",\"dataFormat\":\"undefined\",\"value\":\"4-1-3\"}}}");
+        for (Map.Entry<String, Object> fileEntry : jsonObject.entrySet()) {
+            JSONObject fieldObject = (JSONObject) fileEntry.getValue();
+
+        }
+    }
+
+    @Override
+    public Object process(Context context, Map<String, Object> map) throws EASBizException, BOSException {
+        String mack = (String) map.get("mack");
+        String data = (String) map.get("data");
+        Map<String, Object> resul = Maps.newHashMap();
+        try {
+            JSONObject jsonObject = JSON.parseObject(data);
+            if ("preview".equals(mack)) {
+
+                EsignHttpResponse response = this.previewFile(context, jsonObject, "预览");
+                if (response.getStatus() >= 200 && response.getStatus() < 300) {
+                    JSONObject body = JSON.parseObject(response.getBody());
+                    resul.putAll(body);
+                } else {
+                    resul.put("code", response.getStatus());
+                    resul.put("message", "网络异常");
+                    resul.put("data", null);
+                }
+
+            } else {
+                Map<String, Object> signMap = Maps.newHashMap();
+                String sourceId = jsonObject.getString("sourceId");
+                String signFlowTitle = jsonObject.getString("signFlowTitle");
+                //文件
+                JSONObject templateInfo = jsonObject.getJSONObject("templateInfo");
+                //设置待签署文件信息
+                List<Map<String, Object>> docs = this.addDocs(context, jsonObject, templateInfo);
+                signMap.put("docs", docs);
+                //签署流程配置项
+                Map<String, Object> signFlowConfig = this.addSignFlowConfig(context, signFlowTitle, jsonObject);
+                signMap.put("signFlowConfig", signFlowConfig);
+                //签署方信息
+                JSONObject signInfo = jsonObject.getJSONObject("signInfo");
+                JSONArray signs = signInfo.getJSONArray("signers");
+                List<Map<String, Object>> signers = this.addSigners(context, signs, docs, sourceId);
+                signMap.put("signers", signers);
+                //抄送方信息
+                JSONArray copis = signInfo.getJSONArray("copiers");
+                List<Map<String, Object>> copiers = this.addCopiers(context, copis);
+                if (copiers.size() > 0) {
+                    signMap.put("copiers", copiers);
+                }
+            }
+        } catch (EsignException | URISyntaxException e) {
+            e.printStackTrace();
+        }
+        return resul;
+    }
+
+    /**
+     * 设置待签署文件信息
+     *
+     * @param context
+     * @param jsonObject
+     * @param templateInfo
+     * @return
+     * @throws EsignException
+     */
+    public List<Map<String, Object>> addDocs(Context context, JSONObject jsonObject, JSONObject templateInfo) throws EsignException {
+        //设置待签署文件信息
+        Map<String, Object> resul = Maps.newHashMap();
+        List<Map<String, Object>> docs = Lists.newArrayList();
+        for (Map.Entry<String, Object> fileEntry : templateInfo.entrySet()) {
+            JSONObject fieldObject = (JSONObject) fileEntry.getValue();
+            String docTemplateId = jsonObject.getString("id");
+            String fileName = jsonObject.getString("name");
+            Object order = jsonObject.get("order");
+            String sourceId = jsonObject.getString("sourceId");
+            EsignHttpResponse response = this.previewFile(context, fieldObject, sourceId);
+            if (response.getStatus() >= 200 && response.getStatus() < 300) {
+                JSONObject body = JSON.parseObject(response.getBody());
+                if ("0".equals(String.valueOf(body.get("code")))) {
+                    JSONObject file = body.getJSONObject("data");
+                    Map<String, Object> doc = Maps.newHashMap();
+                    doc.put("fileId", file.get("fileId"));
+                    doc.put("fileName", fileName);
+                    if (null != order) {
+                        doc.put("order", Integer.parseInt(String.valueOf(order)));
+                    }
+                    docs.add(doc);
+                } else {
+                    //文件模板生成失败
+                    resul.putAll(body);
+                    throw new EsignException(JSON.toJSONString(resul));
+                }
+            } else {
+                throw new EsignException("网络异常:" + JSON.toJSONString(response));
+            }
+        }
+        return docs;
+    }
+
+    /**
+     * 抄送方信息
+     *
+     * @param copis
+     * @return
+     */
+    public List<Map<String, Object>> addCopiers(Context context, JSONArray copis) {
+        List<Map<String, Object>> copiers = Lists.newArrayList();
+        for (int i = 0; i < copis.size(); i++) {
+            JSONObject cop = copis.getJSONObject(i);
+            Map<String, Object> copierPsn = Maps.newHashMap();
+            Map<String, Object> copierPsnInfo = Maps.newHashMap();
+            copierPsnInfo.put("psnAccount", cop.getString("psnAccount"));
+            copierPsn.put("copierPsnInfo", copierPsnInfo);
+            copiers.add(copierPsn);
+        }
+        return copiers;
+    }
+
+    /**
+     * @param context
+     * @param orgSignerInfo
+     * @param docs
+     * @param sourceId
+     * @return
+     * @throws EsignException
+     * @throws URISyntaxException
+     */
+    public Map<String, Object> addOrgSignerInfo(Context context, JSONObject orgSignerInfo, List<Map<String, Object>> docs, String sourceId) throws EsignException, URISyntaxException {
+        Map<String, Object> resul = Maps.newHashMap();
+        Map<String, Object> signMapInfo = Maps.newHashMap();
+        Map<String, Object> orgPsnSignMap = Maps.newHashMap();
+        String orgName = orgSignerInfo.getString("orgName");
+        EsignHttpResponse response = EsignHttpUtil.getOrgIdentity_infoByOrgName(context, orgName);
+        if (response.getStatus() >= 200 && response.getStatus() < 300) {
+            JSONObject body = JSON.parseObject(response.getBody());
+            if ("0".equals(String.valueOf(body.get("code")))) {
+                JSONObject orgPsn = body.getJSONObject("data");
+                String orgId = orgPsn.getString("orgId");
+                orgName = orgPsn.getString("orgName");
+                orgPsnSignMap.put("orgId", orgId);
+                orgPsnSignMap.put("orgName", orgName);
+                orgPsnSignMap.put("orgInfo", orgPsn.getJSONObject("orgInfo"));
+            } else {
+                //失败
+                resul.putAll(body);
+                throw new EsignException(JSON.toJSONString(resul));
+            }
+        } else {
+            throw new EsignException("网络异常:" + JSON.toJSONString(response));
+        }
+        Integer signOrder = orgSignerInfo.getInteger("signOrder");
+        //设置签署方的签署顺序
+        if (null != signOrder) {
+            Map<String, Object> signConfig = Maps.newHashMap();
+            signConfig.put("signOrder", signOrder);
+            signMapInfo.put("signConfig", signConfig);
+        }
+        signMapInfo.put("orgSignerInfo", orgPsnSignMap);
+        //设置签署方的通知方式
+        String noticeTypes = orgSignerInfo.getString("noticeTypes");
+        Map<String, String> noticeConfig = Maps.newHashMap();
+        if (StringUtils.isNotBlank(noticeTypes)) {
+            noticeConfig.put("noticeTypes", noticeTypes);
+        } else {
+            noticeConfig.put("noticeTypes", "1,2");
+        }
+        signMapInfo.put("noticeConfig", noticeConfig);
+        //签署区信息
+        List<Map<String, Object>> signFields = Lists.newArrayList();
+        for (Map<String, Object> doc : docs) {
+            Map<String, Object> field = Maps.newHashMap();
+            field.put("fileId", doc.get("fileId"));
+            field.put("customBizNum", sourceId);
+            field.put("signFieldType", 0);
+            //签章区配置项(指定signFieldType为 0 - 签章区时,该参数为必传项)
+            Map<String, Object> normalSignFieldConfig = Maps.newHashMap();
+            normalSignFieldConfig.put("freeMode", true);
+            field.put("normalSignFieldConfig", normalSignFieldConfig);
+            signFields.add(field);
+        }
+        signMapInfo.put("signFields", signFields);
+        return signMapInfo;
+    }
+
+    /**
+     * @param context
+     * @param psnSignerInfo
+     * @param docs
+     * @param sourceId
+     * @return
+     * @throws EsignException
+     * @throws URISyntaxException
+     */
+    public Map<String, Object> addPsnSignerInfo(Context context, JSONObject psnSignerInfo, List<Map<String, Object>> docs, String sourceId) throws EsignException, URISyntaxException {
+        Map<String, Object> resul = Maps.newHashMap();
+        Map<String, Object> signMapInfo = Maps.newHashMap();
+        Map<String, Object> orgPsnSignMap = Maps.newHashMap();
+        //个人签署方信息
+        String psnAccount = psnSignerInfo.getString("psnAccount");
+        String psnName = psnSignerInfo.getString("psnName");
+        Integer signOrder = psnSignerInfo.getInteger("signOrder");
+        //设置签署方的签署顺序
+        if (null != signOrder) {
+            Map<String, Object> signConfig = Maps.newHashMap();
+            signConfig.put("signOrder", signOrder);
+            signMapInfo.put("signConfig", signConfig);
+        }
+        orgPsnSignMap.put("psnAccount", psnAccount);
+        Map<String, String> psnInfo = Maps.newHashMap();
+        psnInfo.put("psnName", psnName);
+        orgPsnSignMap.put("psnInfo", psnInfo);
+        //个人签署方信息
+        signMapInfo.put("psnSignerInfo", orgPsnSignMap);
+        //设置签署方的通知方式
+        String noticeTypes = psnSignerInfo.getString("noticeTypes");
+        Map<String, String> noticeConfig = Maps.newHashMap();
+        if (StringUtils.isNotBlank(noticeTypes)) {
+            noticeConfig.put("noticeTypes", noticeTypes);
+        } else {
+            noticeConfig.put("noticeTypes", "1,2");
+        }
+        signMapInfo.put("noticeConfig", noticeConfig);
+        //签署区信息
+        List<Map<String, Object>> signFields = Lists.newArrayList();
+        for (Map<String, Object> doc : docs) {
+            Map<String, Object> field = Maps.newHashMap();
+            field.put("fileId", doc.get("fileId"));
+            field.put("customBizNum", sourceId);
+            field.put("signFieldType", 0);
+            //签章区配置项(指定signFieldType为 0 - 签章区时,该参数为必传项)
+            Map<String, Object> normalSignFieldConfig = Maps.newHashMap();
+            normalSignFieldConfig.put("freeMode", true);
+            field.put("normalSignFieldConfig", normalSignFieldConfig);
+            signFields.add(field);
+        }
+        signMapInfo.put("signFields", signFields);
+        return signMapInfo;
+    }
+
+    /**
+     * 签署方信息
+     *
+     * @param context
+     * @param signs
+     * @param docs
+     * @param sourceId
+     * @return
+     * @throws EsignException
+     * @throws URISyntaxException
+     */
+    public List<Map<String, Object>> addSigners(Context context, JSONArray signs, List<Map<String, Object>> docs, String sourceId) throws EsignException, URISyntaxException {
+        List<Map<String, Object>> signers = Lists.newArrayList();
+        for (int i = 0; i < signs.size(); i++) {
+            Map<String, Object> signMapInfo = Maps.newHashMap();
+            JSONObject sign = signs.getJSONObject(i);
+            Map<String, Object> orgPsnSignMap = Maps.newHashMap();
+            JSONObject orgSignerInfo = sign.getJSONObject("orgSignerInfo");
+            JSONObject psnSignerInfo = sign.getJSONObject("psnSignerInfo");
+            //企业/机构签署方信息
+            if (null != orgSignerInfo) {
+                signMapInfo = addOrgSignerInfo(context, orgSignerInfo, docs, sourceId);
+            } else {
+                //个人签署方信息
+                signMapInfo = addPsnSignerInfo(context, psnSignerInfo, docs, sourceId);
+            }
+            signers.add(signMapInfo);
+        }
+        return signers;
+    }
+
+    /**
+     * 签署流程配置项
+     *
+     * @param context
+     * @param signFlowTitle
+     * @param jsonObject
+     * @return
+     */
+    public Map<String, Object> addSignFlowConfig(Context context, String signFlowTitle, JSONObject jsonObject) {
+        Map<String, Object> signFlowConfig = Maps.newHashMap();
+        signFlowConfig.put("signFlowTitle", signFlowTitle);
+        Boolean autoStart = jsonObject.getBoolean("autoStart");
+        if (null != autoStart) {
+            signFlowConfig.put("autoStart", autoStart);
+        } else {
+            signFlowConfig.put("autoStart", true);
+        }
+        Boolean autoFinish = jsonObject.getBoolean("autoFinish");
+        if (null != autoFinish) {
+            signFlowConfig.put("autoFinish", autoFinish);
+        } else {
+            signFlowConfig.put("autoFinish", true);
+        }
+        String notifyUrl = jsonObject.getString("notifyUrl");
+        if (null != notifyUrl) {
+            signFlowConfig.put("notifyUrl", notifyUrl);
+        } else {
+            notifyUrl = EsignConfig.getInstance().get("notifyUrl");
+            signFlowConfig.put("notifyUrl", notifyUrl);
+        }
+        return signFlowConfig;
+    }
+
+
+    /**
+     * {
+     * "name": "信息安全承诺书.html",
+     * "id": "c964cb6a67dd40f4a92d4f8e67462e17",
+     * "fields": {
+     * "5b5d7563808d457ea125b000ff2a8d1d": {
+     * "name": "部门",
+     * "dataType": "单行文本",
+     * "value": null
+     * },
+     * "5fcd7b97621c4cd1a5f514e7f06cb0da": {
+     * "name": "工号",
+     * "dataType": "单行文本",
+     * "value": null
+     * }
+     * }
+     * {
+     * "docTemplateId":"8726f6b***03a56d",
+     * "fileName":"某公司的交易协议签署文件",
+     * "components":[
+     * {
+     * "componentId":"59af7766***36ef41b",
+     * "componentKey":"",
+     * "componentValue":"这里是填充的文本"
+     * },
+     * {
+     * "componentId":"7315e9af**72d2dac40",
+     * "componentKey":"",
+     * "componentValue":"2022/01/01"
+     * }
+     * ]
+     * }
+     *
+     * @param jsonObject
+     * @return
+     */
+    public EsignHttpResponse previewFile(Context context, JSONObject jsonObject, String sourceId) throws EsignException {
+        String docTemplateId = jsonObject.getString("id");
+        String fileName = jsonObject.getString("name");
+        if (StringUtils.isBlank(docTemplateId)) {
+            docTemplateId = jsonObject.getString("tableId");
+        }
+        if (StringUtils.isBlank(fileName)) {
+            fileName = jsonObject.getString("tableName");
+        }
+        Map<String, Object> map = Maps.newHashMap();
+        map.put("docTemplateId", docTemplateId);
+        map.put("fileName", fileName);
+        List<Map<String, Object>> components = Lists.newArrayList();
+        JSONObject fields = jsonObject.getJSONObject("fields");
+        for (Map.Entry<String, Object> field : fields.entrySet()) {
+            Map<String, Object> component = Maps.newHashMap();
+            component.put("componentId", field.getKey());
+            JSONObject fieldInfo = (JSONObject) field.getValue();
+            component.put("componentValue", fieldInfo.get("value"));
+            components.add(component);
+        }
+        map.put("components", components);
+        EsignHttpResponse response = EsignHttpUtil.createByDocTemplate(context, JSON.toJSONString(map), sourceId);
+        //html 文件需要等待转换完成
+        return response;
+    }
+
+
+}

+ 25 - 0
websrc/com/kingdee/eas/custom/esign/osf/EsignConfigOSFService.java

@@ -0,0 +1,25 @@
+package com.kingdee.eas.custom.esign.osf;
+
+import com.kingdee.bos.BOSException;
+import com.kingdee.bos.Context;
+import com.kingdee.bos.bsf.service.app.IHRMsfService;
+import com.kingdee.eas.common.EASBizException;
+import com.kingdee.eas.custom.esign.util.EsignConfig;
+
+import java.util.Map;
+
+/**
+ * description: EsignConfigOSFService <br>
+ * date: 24/11/2025 ÏÂÎç 4:02 <br>
+ * author: lhbj <br>
+ * version: 1.0 <br>
+ */
+public class EsignConfigOSFService implements IHRMsfService {
+
+    @Override
+    public Object process(Context context, Map<String, Object> map) throws EASBizException, BOSException {
+        String filePath = (String) map.get("filePath");
+        EsignConfig.getInstance().initConfig(filePath);
+        return null;
+    }
+}