zancun
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@ public class DeptIdentifyController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门认证数据
|
||||
* 查询机构信息
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DeptIdentify deptIdentify) {
|
||||
|
||||
+8
-2
@@ -135,13 +135,13 @@ 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表示异常。
|
||||
String sealId = jsonObject.getJSONObject("data").getString("sealId");
|
||||
//保存到表里
|
||||
SealManage sealManage = new SealManage();
|
||||
SealManage sealManage = new SealManage();
|
||||
sealManage.setIdentifyId(identify.getId());
|
||||
sealManage.setSealName(sealName);
|
||||
sealManage.setSealId(sealId);
|
||||
@@ -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);//设置机构默认为未启用
|
||||
|
||||
+30
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user