package com.malk.ruisi.service.impl; import com.alibaba.fastjson.JSONObject; import com.malk.ruisi.service.QysApiService; import com.malk.ruisi.service.QysService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; import static com.malk.ruisi.constant.QysConstant.*; @Slf4j @Service public class QysServiceImpl implements QysService { @Autowired private QysApiService qysApiService; @Override public JSONObject createDraft(Map param) throws Exception { return qysApiService.sendPost(param,QYS_API_CREATEBYCATEGORY); } @Override public JSONObject createbyfile(Map da) throws Exception { return qysApiService.sendPostFile(da,QYS_API_CREATEBYFILE); } @Override public JSONObject appointurl(String contractId) throws Exception { Map data=new HashMap(); data.put("contractId",contractId); return qysApiService.sendGet(data,QYS_API_PRESIGNURL); // return qysApiService.sendPost(data,QYS_API_PRESIGNURL); } @Override public JSONObject createbycategory(Map data) throws Exception { return qysApiService.sendPost(data,QYS_API_CREATEBYCATEGORY); } @Override public JSONObject getDetail(String bizId, String tenantName) throws Exception { Map data = new HashMap(); data.put("bizId",bizId); data.put("tenantName",tenantName); return qysApiService.sendGet(data,QYS_API_CONTRACT_DETAIL); } @Override public JSONObject send(String contractId, String tenantName) throws Exception { Map data=new HashMap(); data.put("contractId",contractId); data.put("tenantName",tenantName); return qysApiService.sendPost(data,QYS_API_SEND); } public JSONObject getYWFLid(Map data) throws Exception { return qysApiService.sendGet(data,QYS_API_CATEGORIES,false); } /*** * 下载签署后文件 * @param contractId * @param file * @throws Exception */ @Override public void download(String contractId, File file) throws Exception { log.info("下载文件:{}",file.getPath()); qysApiService.getFile(new JSONObject().fluentPut("contractId",contractId),QYS_API_DOWNLOAD,file); log.info("下载完成:文件大小:{}",file.length()); } // /*** // * 下载签署后文件 // * @param contractId // * @param // * @throws Exception // */ // @Override // public void download1(String contractId) throws Exception { // log.info("下载文件:{}"); // qysApiService.getFile1(new JSONObject().fluentPut("contractId",contractId),QYS_API_DOWNLOAD); // log.info("下载完成:文件大小:{}"); // } @Override public JSONObject createseal(Map map) throws Exception { return qysApiService.sendPost(map,QYS_API_SEALBYCATEGORY); } @Override public JSONObject applyseals(Map param) throws Exception { return qysApiService.sendPost(param,QYS_API_MULTIPLE); } @Override public JSONObject signurla(Map signatory) throws Exception { return qysApiService.sendPost(signatory,QYS_API_SIGNURL); } @Override public JSONObject viewurl(String contractId, String pageType) throws Exception { Map data=new HashMap(); data.put("contractId",contractId); data.put("pageType","CONTENT"); return qysApiService.sendGet(data,QYS_API_CONTRACT_VIEWURL); } @Override public JSONObject audit(String contractId) throws Exception { Map data=new HashMap(); data.put("contractId",contractId); return qysApiService.sendPost(data,QYS_API_AUDIA); } // @Override // public JSONObject appointurldownload(String contractId) throws Exception { // return qysApiService.sendGet(data,QYS_API_CATEGORIES,false);; // } }