diff --git a/src/main/java/com/example/sso/controller/CarBian.java b/src/main/java/com/example/sso/controller/CarBian.java new file mode 100644 index 0000000..048fd72 --- /dev/null +++ b/src/main/java/com/example/sso/controller/CarBian.java @@ -0,0 +1,181 @@ +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 CarBian { + Logger logger = LoggerFactory.getLogger(getClass()); + + @PostMapping("/jiaotongweifa") + public String qianzhang(@RequestBody JSONObject signature) throws Exception { + logger.info(signature.toJSONString()); + + + JSONObject data = signature.getJSONObject("data"); + //字段 + String flow_yname = data.getString("flow_yname"); //乙方联系电话 + String flow_yid = data.getString("flow_yid");//对班手机号 + String flow_jg = data.getString("flow_jg"); //乙方身份证号 + String flow_jchp = data.getString("flow_jchp");//对班身份号码 + String flow_cjh = data.getString("flow_cjh");//对班身份号码 + String flow_yphoneno = data.getString("flow_yphoneno");//对班身份号码 + + + + + + //创建签署任务 + JSONObject initiator = new JSONObject(); + JSONObject openid = new JSONObject(); + openid.put("idType", "corp"); + openid.put("openId", "625776ecae6742cb8eb710beedef9b4c"); + initiator.put("initiator", openid); + + initiator.put("signTaskSubject", "交通违法承诺书" + "$" + flow_jchp + "$" + flow_yname); + + + initiator.put("signTemplateId", "1760681881185137048"); + + + initiator.put("businessId", "a09900c24614bd4c1de10c55712a3e0e"); + //参与方数组 + JSONArray jsonArray = new JSONArray(); + //actor个人对象 + JSONObject actor = new JSONObject(); + //actor详细信息个人 + JSONObject actorlist = new JSONObject(); + actorlist.put("actorId", "参与方2"); + actorlist.put("actorType", "person"); + if (flow_yname != null) { + actorlist.put("actorName", flow_yname); + } + JSONArray permissions = new JSONArray(); + permissions.add("sign"); + if (flow_yname != null) { + actorlist.put("identNameForMatch", flow_yname); + } + actorlist.put("certType", "id_card"); + if (flow_yid != null) { + actorlist.put("certNoForMatch", flow_yid); + } + if (flow_yphoneno != null) { + actorlist.put("notifyAddress", flow_yphoneno); + } + JSONArray notifyType = new JSONArray(); + notifyType.add("start"); + notifyType.add("finish"); + actorlist.put("notifyType", notifyType); + actorlist.put("permissions", permissions); + actor.put("actor", actorlist); + + + JSONObject ownerId = new JSONObject(); // docid + ownerId.put("ownerId", openid); + ownerId.put("signTemplateId", "1760681881185137048"); + String ownerIdJSONString = ownerId.toJSONString(); + String doc = FDaDaUtil.doc(ownerIdJSONString); + + + + jsonArray.add(actor); + + + 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(); + //甲方名称1 + JSONObject DPflowCompany = new JSONObject(); + DPflowCompany.put("fieldId", "0677762672"); + if (flow_yname != null) { + DPflowCompany.put("fieldValue", flow_yname); + } + DPflowCompany.put("docId", doc); + + //社会信用代码 + JSONObject DPflowRegistrid = new JSONObject(); + DPflowRegistrid.put("fieldId", "0047804840"); + if (flow_yid != null) { + DPflowRegistrid.put("fieldValue", flow_yid); + } + DPflowRegistrid.put("docId", doc); + + //法人 + JSONObject DPflowLegal = new JSONObject(); + DPflowLegal.put("fieldId", "1555870498"); + if (flow_jg != null) { + DPflowLegal.put("fieldValue", flow_jg); + } + DPflowLegal.put("docId", doc); + + + //住所 + JSONObject DPflowSite = new JSONObject(); + DPflowSite.put("fieldId", "3923095361"); + if (flow_jchp != null) { + DPflowSite.put("fieldValue", flow_jchp); + } + DPflowSite.put("docId", doc); + + + //通讯地址 + JSONObject DPflowSite1 = new JSONObject(); + DPflowSite1.put("fieldId", "9307435742"); + if (flow_cjh != null) { + DPflowSite1.put("fieldValue", flow_cjh); + } + DPflowSite1.put("docId", doc); + + + + + sizejsonarray.add(DPflowCompany); + sizejsonarray.add(DPflowRegistrid); + sizejsonarray.add(DPflowLegal); + sizejsonarray.add(DPflowSite); + sizejsonarray.add(DPflowSite1); + + + + + + 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 ""; + } +} diff --git a/src/main/java/com/example/sso/test/G.java b/src/main/java/com/example/sso/test/G.java new file mode 100644 index 0000000..af464c8 --- /dev/null +++ b/src/main/java/com/example/sso/test/G.java @@ -0,0 +1,25 @@ +package com.example.sso.test; + +import java.time.LocalDateTime; +import java.time.ZoneId; + +public class G { +// public static void main(String[] args) { +// long currentTimestamp = System.currentTimeMillis(); +// System.out.println(currentTimestamp); +// +// +// } + + //时间戳 + + public static void main(String[] args) { + // 创建指定的日期时间对象 (2025年10月20日22点) + LocalDateTime specifiedDateTime = LocalDateTime.of(2025, 10, 22, 22, 0); + + // 将本地日期时间与系统默认时区结合,然后转换为时间戳(毫秒) + long timestamp = specifiedDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + + System.out.println("时间戳 (毫秒): " + timestamp); // 输出:1761562800000 + } +}