This commit is contained in:
hejinbo
2023-11-16 10:42:19 +08:00
parent 8b0eae8dca
commit a4e8347835
4 changed files with 39 additions and 40 deletions
@@ -30,7 +30,7 @@ public class DeptIdentifyController extends BaseController {
}
/**
* 查询部门认证数据
* 查询机构信息
*/
@GetMapping("/list")
public TableDataInfo list(DeptIdentify deptIdentify) {
@@ -135,7 +135,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
//创建机构图片印章
// String annexPath = "D:\\develop\\2.jpg";
String sealName = "自定义" + UUID.randomUUID() + ""; //自定义印章印章名称不能重复,所以用UUID确保唯一性
EsignHttpResponse response = SignAward.createOrgByImage(identify,sealName,annexPath);
EsignHttpResponse response = SignAward.createOrgByImage(identify, sealName, annexPath);
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
int code = jsonObject.getIntValue("code");
if (code == 0) { //业务码,0表示成功,非0表示异常。
@@ -297,6 +297,12 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
if (identifyType == null) {
deptIdentify.setIdentifyType(1); // 设置机构默认为仲裁机构
}
//先查询看数据库里有没有相同的机构经办人
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
if (deptIdentifies != null && deptIdentifies.size() > 0) {
//说明之前新增过
return AjaxResult.error("信息重复");
}
deptIdentify.setIdentifyStatus(0); //设置认证状态默认为未认证
deptIdentify.setIsUse(0); //设置认证状态默认为未认证
int i = deptIdentifyMapper.insertDeptIdentify(deptIdentify);//设置机构默认为未启用
@@ -0,0 +1,30 @@
package com.ruoyi.wisdomarbitrate.utils;
import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Base64;
public class ImageToBase64Converter {
public static String imageToBase64(String imagePath) throws Exception {
Path path = Paths.get(imagePath);
byte[] imageBytes = Files.readAllBytes(path);
String base64Image = Base64.getEncoder().encodeToString(imageBytes);
return base64Image;
}
public static void main(String[] args) {
String imagePath = "D:\\develop\\2.jpg";
try {
String base64Image = imageToBase64(imagePath);
System.out.println(base64Image);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -1,37 +0,0 @@
package com.ruoyi.wisdomarbitrate.utils;
import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
public class MyTest {
public static void download(String fileUrl, String saveFilePath) throws IOException {
URL url = new URL(fileUrl);
InputStream inputStream = url.openStream();
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
FileOutputStream fileOutputStream = new FileOutputStream(saveFilePath);
byte[] buffer = new byte[1024];
int bytesRead = 0;
while ((bytesRead = bufferedInputStream.read(buffer, 0, buffer.length)) != -1) {
fileOutputStream.write(buffer, 0, bytesRead);
}
fileOutputStream.close();
bufferedInputStream.close();
inputStream.close();
}
public static void main(String[] args) {
String fileUrl = "https://esignoss.esign.cn/1111563786/0e16cc53-fe2e-403b-b901-587778a8ea92/3ed8f1b0bd2640e895fcfbaffdec0a1e.pdf?Expires=1698742492&OSSAccessKeyId=LTAI4G23YViiKnxTC28ygQzF&Signature=K%2Bb5k7DqNmaxeu%2Fct5qis4qor7s%3D";
String saveFilePath = "D:\\home\\example.pdf";
try {
download(fileUrl, saveFilePath);
System.out.println("File downloaded successfully.");
} catch (IOException e) {
e.printStackTrace();
}
}
}