| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | |
| | | private static String SERVICE_URL="https://api.sandbox.junziqian.com"; |
| | | private static String APP_KEY="dcb4bd535a09df3c"; |
| | | private static String APP_SECRET="b87c346edcb4bd535a09df3ca8c45d9a"; |
| | | @Value("${debug_model}") |
| | | private Boolean debugModel; |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | |
| | | * @param email |
| | | * @param postionJson |
| | | */ |
| | | public String applySignWidthQifengSet(String name,String fileUrl,String fullname,String creditCoe,String email,String postionJson,String singId,String notifyUrl,Float qifengSet){ |
| | | return applySignDoByParam(name,fileUrl,fullname,creditCoe,email,postionJson,singId,notifyUrl,qifengSet); |
| | | } |
| | | /** |
| | | * 发起签约 |
| | | * @param name |
| | | * @param fileUrl |
| | | * @param fullname |
| | | * @param creditCoe |
| | | * @param email |
| | | * @param postionJson |
| | | */ |
| | | public String applySign(String name,String fileUrl,String fullname,String creditCoe,String email,String postionJson,String singId,String notifyUrl){ |
| | | return applySignDoByParam(name,fileUrl,fullname,creditCoe,email,postionJson,singId,notifyUrl,null); |
| | | } |
| | | /** |
| | | * 发起签约 |
| | | * @param name |
| | | * @param fileUrl |
| | | * @param fullname |
| | | * @param creditCoe |
| | | * @param email |
| | | * @param postionJson |
| | | */ |
| | | public String applySignDoByParam(String name,String fileUrl,String fullname,String creditCoe,String email,String postionJson,String singId,String notifyUrl,Float qifengSet){ |
| | | try { |
| | | initParams(); |
| | | String url=SERVICE_URL+"/v2/sign/applySign"; |
| | |
| | | // sReq.setSearchKey(postionJson);//关键字 对应positionType=2 |
| | | sReq.setSignId(singId); |
| | | sReq.setNoNeedVerify(1); |
| | | sReq.setQiFengOffset(qifengSet); |
| | | signatories.add(sReq); |
| | | params.put("signatories",signatories.toJSONString()); |
| | | System.out.println("================"+JSONObject.toJSONString(params)); |
| | |
| | | return json.getString("data"); |
| | | } |
| | | }catch (Exception e){ |
| | | |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | |
| | |
| | | /** |
| | | * 发起签约 |
| | | * @param name |
| | | * @param fileUrl |
| | | * @param file |
| | | * @param creditCoe |
| | | * @param email |
| | |
| | | params.put("serverCa",1); //使用云证书 |
| | | params.put("file",new File(file)); |
| | | params.put("dealType",5); //指定合同文件签署方式 5 为部分自动签 |
| | | params.put("positionType",2); //指定通过表单域方式设置签字位置 |
| | | params.put("positionType",0); //指定通过表单域方式设置签字位置 |
| | | params.put("fileType",0); |
| | | params.put("needQifengSign",1); |
| | | params.put("notifyUrl",notifyUrl); |
| | |
| | | sReq.setEmail(email); //在君子签注册认证的邮箱 |
| | | // sReq.setChapteJson("[{\"page\":0,\"chaptes\":[{\"offsetX\":0.12,\"offsetY\":0.23}]},{\"page\":1,\"chaptes\":[{\"offsetX\":0.45,\"offsetY\":0.67}]}]"); |
| | | // sReq.setChapteJson(postionJson); |
| | | sReq.setSearchKey(postionJson); |
| | | // sReq.setSearchKey(postionJson); |
| | | sReq.setSignId(singId); |
| | | sReq.setSearchConvertExtend("{\"fixX\":-80,\"fixY\":-80}"); |
| | | sReq.setNoNeedVerify(1); |
| | |
| | | return json.getString("data"); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | |
| | | } |
| | | return null; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 发起签约 |
| | | * @param name |
| | | * @param file |
| | | * @param creditCoe |
| | | * @param email |
| | | * @param postionJson |
| | | */ |
| | | public String applySignLocalFileByParam(String name,String fullname,String file,String creditCoe,String email,String postionJson,String singId,String notifyUrl,Float qifengSet){ |
| | | try { initParams(); |
| | | String url=SERVICE_URL+"/v2/sign/applySign"; |
| | | Map<String, Object> params=bodyParams; |
| | | params.put("contractName",name); //合同名称 |
| | | params.put("serverCa",1); //使用云证书 |
| | | params.put("file",new File(file)); |
| | | params.put("dealType",5); //指定合同文件签署方式 5 为部分自动签 |
| | | params.put("positionType",0); //指定通过表单域方式设置签字位置 |
| | | params.put("fileType",0); |
| | | params.put("needQifengSign",1); |
| | | params.put("notifyUrl",notifyUrl); |
| | | JSONArray signatories=new JSONArray(); |
| | | SignatoryReq sReq=new SignatoryReq(); |
| | | sReq.setFullName(fullname); //企业姓名 |
| | | sReq.setIdentityType(11); //证件类型 |
| | | sReq.setIdentityCard(creditCoe);//营业执照号 |
| | | sReq.setEmail(email); //在君子签注册认证的邮箱 |
| | | // sReq.setChapteJson("[{\"page\":0,\"chaptes\":[{\"offsetX\":0.12,\"offsetY\":0.23}]},{\"page\":1,\"chaptes\":[{\"offsetX\":0.45,\"offsetY\":0.67}]}]"); |
| | | // sReq.setChapteJson(postionJson); |
| | | // sReq.setSearchKey(postionJson); |
| | | sReq.setSignId(singId); |
| | | sReq.setQiFengOffset(qifengSet); |
| | | sReq.setSearchConvertExtend("{\"fixX\":-80,\"fixY\":-80}"); |
| | | sReq.setNoNeedVerify(1); |
| | | signatories.add(sReq); |
| | | params.put("signatories",signatories.toJSONString()); |
| | | System.out.println(signatories.toJSONString()); |
| | | String str= HttpClientUtils.init().getPost(url,null,params,true); |
| | | System.out.println(str); |
| | | saveInterfaceLog(url,"【电子签】发起签约",JSONObject.toJSONString(params),str); |
| | | JSONObject json = JSONObject.parseObject(str); |
| | | if(json!=null && json.getBoolean("success")){ |
| | | return json.getString("data"); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | |
| | | } |
| | | return null; |
| | | |
| | | } |
| | | |
| | |
| | | * @param creditCode |
| | | */ |
| | | public String signLink(String applyNo,String name,String creditCode) { |
| | | try { initParams(); |
| | | try { |
| | | //延迟2秒 |
| | | // Thread.sleep(2*1000); |
| | | initParams(); |
| | | Map<String, Object> params = bodyParams; |
| | | String url = SERVICE_URL + "/v2/sign/link"; |
| | | params.put("applyNo",applyNo); //发起合同签署接口返回的APL编号 |
| | |
| | | saveInterfaceLog(url,"【电子签】获取签署链接地址",JSONObject.toJSONString(params),str); |
| | | JSONObject json = JSONObject.parseObject(str); |
| | | if(json!=null && json.getBoolean("success")){ |
| | | return json.getString("data"); |
| | | String link =json.getString("data"); |
| | | if(!debugModel){ |
| | | link = link.replace("https://h5","https://h7"); |
| | | } |
| | | return link; |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |