190 lines
6.5 KiB
Java
190 lines
6.5 KiB
Java
package com.example.sso.controller;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.example.sso.util.FDaDaUtil;
|
|
import lombok.extern.log4j.Log4j;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
@RestController
|
|
@Log4j
|
|
@Async
|
|
public class AnQuanTongChou {
|
|
Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
@PostMapping("/anquantongchou")
|
|
public String dp(@RequestBody JSONObject signature) throws Exception {
|
|
logger.info(signature.toJSONString());
|
|
|
|
JSONObject data = signature.getJSONObject("data");
|
|
String flowContractno = data.getString("flow_contractno");
|
|
String flowPaname = data.getString("flow_paname");
|
|
String flowLegal = data.getString("flow_legal");
|
|
String flowName = data.getString("flow_name");
|
|
String flowPbid = data.getString("flow_pbid");
|
|
String flowPbphoneno = data.getString("flow_pbphoneno");
|
|
String flowChangedate = data.getString("flow_changedate");
|
|
|
|
|
|
//创建签署任务
|
|
JSONObject initiator = new JSONObject();
|
|
JSONObject openid = new JSONObject();
|
|
openid.put("idType", "corp");
|
|
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
|
|
initiator.put("initiator", openid);
|
|
|
|
initiator.put("signTaskSubject", "安全统筹参统协议" + "$" + flowName + "$" + flowContractno);
|
|
|
|
|
|
initiator.put("signTemplateId", "1719883223970124571");
|
|
|
|
|
|
initiator.put("businessId", "a09900c24614bd4c1de10c55712a3e0e");
|
|
//参与方数组
|
|
JSONArray jsonArray = new JSONArray();
|
|
//actor个人对象
|
|
JSONObject actor = new JSONObject();
|
|
//actor详细信息个人
|
|
JSONObject actorlist = new JSONObject();
|
|
actorlist.put("actorId", "乙方");
|
|
actorlist.put("actorType", "person");
|
|
if (flowName != null) {
|
|
actorlist.put("actorName", flowName);
|
|
}
|
|
JSONArray permissions = new JSONArray();
|
|
permissions.add("sign");
|
|
if (flowName != null) {
|
|
actorlist.put("identNameForMatch", flowName);
|
|
}
|
|
actorlist.put("certType", "id_card");
|
|
if (flowPbid != null) {
|
|
actorlist.put("certNoForMatch", flowPbid);
|
|
}
|
|
if (flowPbphoneno != null) {
|
|
actorlist.put("notifyAddress", flowPbphoneno);
|
|
}
|
|
JSONArray notifyType = new JSONArray();
|
|
notifyType.add("start");
|
|
notifyType.add("finish");
|
|
actorlist.put("notifyType", notifyType);
|
|
actorlist.put("permissions", permissions);
|
|
actor.put("actor", actorlist);
|
|
|
|
|
|
//企业方对象
|
|
JSONObject actors = new JSONObject();
|
|
//actor详细信息企业
|
|
JSONObject actorlists = new JSONObject();
|
|
actorlists.put("actorId", "参与方1");
|
|
actorlists.put("actorType", "corp");
|
|
if (flowPaname != null) {
|
|
actorlists.put("actorName", flowPaname);
|
|
}
|
|
/*JSONArray permissionss = new JSONArray();
|
|
permissionss.add("sign");
|
|
actorlists.put("permissions",permissionss);*/
|
|
|
|
actorlists.put("actorOpenId", "a9da2a884ca24aaaa03bf53b21792b06");
|
|
|
|
|
|
|
|
|
|
/*actorlists.put("notifyAddress", "13520145209");*/
|
|
JSONArray notifyTypes = new JSONArray();
|
|
notifyTypes.add("start");
|
|
notifyTypes.add("finish");
|
|
actorlists.put("notifyType", notifyTypes);
|
|
JSONArray SignField = new JSONArray();
|
|
JSONObject jsonObject2 = new JSONObject();
|
|
|
|
JSONObject ownerId = new JSONObject(); // docid
|
|
ownerId.put("ownerId", openid);
|
|
ownerId.put("signTemplateId", "1719883223970124571");
|
|
String ownerIdJSONString = ownerId.toJSONString();
|
|
String doc = FDaDaUtil.doc(ownerIdJSONString);
|
|
|
|
|
|
jsonObject2.put("fieldDocId", doc);
|
|
|
|
|
|
jsonObject2.put("sealId", 1720410919082196954l);
|
|
|
|
|
|
SignField.add(jsonObject2);
|
|
JSONObject signConfigInfo = new JSONObject();
|
|
JSONObject signConfigInfos = new JSONObject();
|
|
signConfigInfos.put("requestVerifyFree", true);
|
|
signConfigInfo.put("signConfigInfo", signConfigInfo);
|
|
|
|
|
|
actors.put("actor", actorlists);
|
|
actors.put("signFields", SignField);
|
|
actors.put("signConfigInfo", signConfigInfos);
|
|
|
|
|
|
jsonArray.add(actor);
|
|
jsonArray.add(actors);
|
|
|
|
initiator.put("actors", jsonArray);
|
|
String jsonString = initiator.toJSONString();
|
|
|
|
String fdd = FDaDaUtil.fdd(jsonString);
|
|
logger.info("安全统筹参统协议" + fdd);
|
|
JSONObject jsonObject = JSON.parseObject(fdd);
|
|
//任务id
|
|
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
|
|
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
|
|
System.out.println("signTaskId____________________" + signTaskId);
|
|
System.out.println("signTaskIds========================" + signTaskIds);
|
|
|
|
//填写控件
|
|
JSONObject sizejsonobject = new JSONObject();
|
|
sizejsonobject.put("signTaskId", signTaskId);
|
|
// jsonObject.put( "actorId", "参与方2");
|
|
JSONArray sizejsonarray = new JSONArray();
|
|
//合同编号
|
|
JSONObject dpflowChangedate = new JSONObject();
|
|
dpflowChangedate.put("fieldId", "6826496343");
|
|
if (flowChangedate != null) {
|
|
dpflowChangedate.put("fieldValue", flowChangedate);
|
|
}
|
|
dpflowChangedate.put("docId", doc);
|
|
|
|
|
|
//合同编号
|
|
JSONObject DPflowHtid1 = new JSONObject();
|
|
DPflowHtid1.put("fieldId", "3220703350");
|
|
if (flowChangedate != null) {
|
|
DPflowHtid1.put("fieldValue", flowChangedate);
|
|
}
|
|
DPflowHtid1.put("docId", doc);
|
|
|
|
|
|
|
|
|
|
|
|
sizejsonarray.add(dpflowChangedate);
|
|
sizejsonarray.add(DPflowHtid1);
|
|
|
|
|
|
|
|
sizejsonobject.put("docFieldValues", sizejsonarray);
|
|
String sizeString = sizejsonobject.toJSONString();
|
|
|
|
String sizekongjian = FDaDaUtil.sizekongjian(sizeString);
|
|
logger.info("安全统筹参统协议写控件" + sizekongjian);
|
|
System.out.println("控件填写完成=======================================");
|
|
String signtask = FDaDaUtil.signtask(signTaskIds);
|
|
logger.info("安全统筹参统协议完成" + signtask);
|
|
|
|
|
|
return "完成";
|
|
}
|
|
}
|