压缩包导入
This commit is contained in:
+13
@@ -429,4 +429,17 @@ public class CaseApplicationController extends BaseController {
|
|||||||
|
|
||||||
return success(caseApplicationService.reserveConferenceList(caseId));
|
return success(caseApplicationService.reserveConferenceList(caseId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 案件压缩包导入
|
||||||
|
* @param file
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
@PostMapping("/uploadCaseZipFile")
|
||||||
|
public AjaxResult uploadCaseZipFile(@RequestParam("file") MultipartFile file) throws IOException {
|
||||||
|
return caseApplicationService.uploadCaseZipFile(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>pay</artifactId>
|
<artifactId>pay</artifactId>
|
||||||
@@ -32,6 +33,7 @@
|
|||||||
<artifactId>tls-sig-api-v2</artifactId>
|
<artifactId>tls-sig-api-v2</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
+2
@@ -112,4 +112,6 @@ public interface ICaseApplicationService {
|
|||||||
|
|
||||||
AjaxResult deleteRoom( String roomId);
|
AjaxResult deleteRoom( String roomId);
|
||||||
|
|
||||||
|
AjaxResult uploadCaseZipFile(MultipartFile file);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+70
-2
@@ -4,6 +4,7 @@ package com.ruoyi.wisdomarbitrate.service.impl;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.IdcardUtil;
|
import cn.hutool.core.util.IdcardUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.core.util.ZipUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@@ -11,6 +12,7 @@ import com.google.gson.Gson;
|
|||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
import com.ruoyi.common.constant.CaseApplicationConstants;
|
import com.ruoyi.common.constant.CaseApplicationConstants;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.entity.*;
|
import com.ruoyi.common.core.domain.entity.*;
|
||||||
@@ -19,6 +21,7 @@ import com.ruoyi.common.enums.UpdateSubmitStatus;
|
|||||||
import com.ruoyi.common.exception.EsignDemoException;
|
import com.ruoyi.common.exception.EsignDemoException;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.utils.*;
|
import com.ruoyi.common.utils.*;
|
||||||
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||||
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
|
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.utils.thread.ThreadPoolUtil;
|
import com.ruoyi.common.utils.thread.ThreadPoolUtil;
|
||||||
@@ -49,6 +52,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
@@ -61,6 +65,8 @@ import java.time.ZoneId;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
import static com.ruoyi.common.core.domain.AjaxResult.success;
|
import static com.ruoyi.common.core.domain.AjaxResult.success;
|
||||||
import static com.ruoyi.common.utils.PageUtils.startPage;
|
import static com.ruoyi.common.utils.PageUtils.startPage;
|
||||||
@@ -360,7 +366,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
return AjaxResult.error("请选择要上传的文件");
|
return AjaxResult.error("请选择要上传的文件");
|
||||||
}
|
}
|
||||||
String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile";
|
String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile";
|
||||||
// String targetPath = "F:\\testZip\\uploadPath\\upload\\upload1\\unzipFile";
|
// String targetPath = "D:\\home\\unzip\\";
|
||||||
File zipFile = null;
|
File zipFile = null;
|
||||||
InputStream ins = null;
|
InputStream ins = null;
|
||||||
try {
|
try {
|
||||||
@@ -540,7 +546,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return success();
|
return success();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -878,6 +883,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增案件
|
* 新增案件
|
||||||
|
*
|
||||||
* @param caseApplication
|
* @param caseApplication
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -2779,8 +2785,70 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
return success(reservedConferenceMapper.deleteByRoomId(roomId));
|
return success(reservedConferenceMapper.deleteByRoomId(roomId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult uploadCaseZipFile(MultipartFile file) {
|
||||||
|
if (file.isEmpty()) {
|
||||||
|
return AjaxResult.error("请选择要上传的文件");
|
||||||
|
}
|
||||||
|
//String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile";
|
||||||
|
String targetPath = "D:\\home\\unzip\\";
|
||||||
|
File zipFile = null;
|
||||||
|
InputStream ins = null;
|
||||||
|
try {
|
||||||
|
ins = file.getInputStream();
|
||||||
|
zipFile = new File(file.getOriginalFilename());
|
||||||
|
inputChangeToFile(ins, zipFile);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
//解压缩上传的压缩包
|
||||||
|
boolean unzipSuccess = UnZipFileUtils.unZipFile(zipFile, targetPath);
|
||||||
|
if (unzipSuccess ) {
|
||||||
|
String unzipPath = targetPath + file.getOriginalFilename() + "\\";
|
||||||
|
File directory = new File(targetPath);
|
||||||
|
String pdfFilePath = findAndConvertPDF(directory);
|
||||||
|
if (pdfFilePath != null){
|
||||||
|
// 返回找到的PDF文件路径
|
||||||
|
return AjaxResult.success(pdfFilePath);
|
||||||
|
}else {
|
||||||
|
// 没有找到符合条件的文件
|
||||||
|
return AjaxResult.error("未找到符合条件的文件");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
// 解压失败
|
||||||
|
return AjaxResult.error("解压失败");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public static String findAndConvertPDF(File directory) {
|
||||||
|
|
||||||
|
File[] matches = directory.listFiles(new FilenameFilter() {
|
||||||
|
public boolean accept(File dir, String name) {
|
||||||
|
return name.contains("仲裁申请书");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (matches != null && matches.length > 0) {
|
||||||
|
for (File file : matches) {
|
||||||
|
if (file.isFile() && file.getName().toLowerCase().endsWith(".pdf")) {
|
||||||
|
// 如果是PDF格式直接返回路径
|
||||||
|
return file.getAbsolutePath();
|
||||||
|
} else {
|
||||||
|
// 如果不是PDF格式,进行转换成PDF并返回路径
|
||||||
|
String pdfPath = convertToPDF(file);
|
||||||
|
return pdfPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String convertToPDF(File file) {
|
||||||
|
// 实现文件格式转换逻辑,这里假设已经实现了转换逻辑,返回转换后的PDF文件路径
|
||||||
|
String pdfPath = "convertedFilePath.pdf"; // 这里替换为实际转换后的PDF文件路径
|
||||||
|
return pdfPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
-1
@@ -223,7 +223,6 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
|||||||
casePaymentRecordMapper.saveRecord(paymentRecord);
|
casePaymentRecordMapper.saveRecord(paymentRecord);
|
||||||
// 新增日志
|
// 新增日志
|
||||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_PAYMENT_CONFIRM, "");
|
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_PAYMENT_CONFIRM, "");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-101
@@ -182,11 +182,12 @@ public class FixSelectFlowDetailUtils {
|
|||||||
public void fixExecuteSelectDeptIndentifyUtils() throws Exception {
|
public void fixExecuteSelectDeptIndentifyUtils() throws Exception {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
DeptIdentify deptIdentify = new DeptIdentify();
|
DeptIdentify deptIdentify = new DeptIdentify();
|
||||||
deptIdentify.setIdentifyStatus(0);
|
|
||||||
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
||||||
if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
|
if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
|
||||||
for (int i = 0; i < deptIdentifysnew.size(); i++) {
|
for (int i = 0; i < deptIdentifysnew.size(); i++) {
|
||||||
DeptIdentify deptIdentify1 = deptIdentifysnew.get(i);
|
DeptIdentify deptIdentify1 = deptIdentifysnew.get(i);
|
||||||
|
Integer identifyStatus = deptIdentify1.getIdentifyStatus();
|
||||||
|
if (identifyStatus!=1){
|
||||||
String authFlowId = deptIdentify1.getAuthFlowId();
|
String authFlowId = deptIdentify1.getAuthFlowId();
|
||||||
if (authFlowId != null) {
|
if (authFlowId != null) {
|
||||||
EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentify1);
|
EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentify1);
|
||||||
@@ -267,109 +268,9 @@ public class FixSelectFlowDetailUtils {
|
|||||||
deptIdentifyMapper.updateDeptIdentify(deptIdentify1);
|
deptIdentifyMapper.updateDeptIdentify(deptIdentify1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 定时查询企业认证状态
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
@Scheduled(cron = "*/30 * * * * *")
|
|
||||||
@Transactional
|
|
||||||
public void fixExecuteSelectDeptIndentify() throws Exception {
|
|
||||||
Gson gson = new Gson();
|
|
||||||
DeptIdentify deptIdentify = new DeptIdentify();
|
|
||||||
deptIdentify.setIdentifyStatus(2);
|
|
||||||
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
|
||||||
if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
|
|
||||||
for (int i = 0; i < deptIdentifysnew.size(); i++) {
|
|
||||||
DeptIdentify deptIdentify1 = deptIdentifysnew.get(i);
|
|
||||||
String authFlowId = deptIdentify1.getAuthFlowId();
|
|
||||||
if (authFlowId != null) {
|
|
||||||
EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentify1);
|
|
||||||
JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class);
|
|
||||||
int code = identifyInfoJsonObject.get("code").getAsInt();
|
|
||||||
if (code == 0) {
|
|
||||||
JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data");
|
|
||||||
int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
|
|
||||||
if (realnameStatus == 1) {
|
|
||||||
String orgId = identifyInfoData.get("orgId").getAsString();
|
|
||||||
//查询企业内部印章
|
|
||||||
EsignHttpResponse response = SignAward.deptIdentifySealList(orgId);
|
|
||||||
JsonObject jsonObject = gson.fromJson(response.getBody(), JsonObject.class);
|
|
||||||
int code1 = jsonObject.get("code").getAsInt();
|
|
||||||
if (code1 == 0) {
|
|
||||||
JsonObject data = jsonObject.getAsJsonObject("data");
|
|
||||||
JsonArray seals = data.get("seals").getAsJsonArray();
|
|
||||||
if (seals.size() > 0) {
|
|
||||||
for (int j = 0; j < seals.size(); j++) {
|
|
||||||
//保存印章信息到数据库
|
|
||||||
JsonObject asJsonObject = seals.get(j).getAsJsonObject();
|
|
||||||
SealManage sealManage = new SealManage();
|
|
||||||
String sealName = asJsonObject.get("sealName").toString();
|
|
||||||
String sealId = asJsonObject.get("sealId").toString();
|
|
||||||
String url = asJsonObject.get("sealImageDownloadUrl").toString();
|
|
||||||
LocalDate now = LocalDate.now();
|
|
||||||
String year = Integer.toString(now.getYear());
|
|
||||||
String month = String.format("%02d", now.getMonthValue());
|
|
||||||
String day = String.format("%02d", now.getDayOfMonth());
|
|
||||||
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
|
||||||
String fileName = UUID.randomUUID().toString().replace("-", "") + ".jpg";
|
|
||||||
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
|
||||||
String savePath = "/home/ruoyi/uploadPath/upload/";
|
|
||||||
// 创建日期目录
|
|
||||||
File saveFolder = new File(saveFolderPath);
|
|
||||||
if (!saveFolder.exists()) {
|
|
||||||
saveFolder.mkdirs();
|
|
||||||
}
|
|
||||||
String resultFilePath = saveFolderPath + "/" + fileName;
|
|
||||||
File resultFilePathFile = new File(resultFilePath);
|
|
||||||
if (!resultFilePathFile.exists()) {
|
|
||||||
resultFilePathFile.createNewFile();
|
|
||||||
}
|
|
||||||
String fileDownloadUrlnew = url.substring(1, url.length() - 1);
|
|
||||||
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
|
|
||||||
if (downLoadFile) {
|
|
||||||
CaseAttach caseAttach = new CaseAttach();
|
|
||||||
caseAttach.setAnnexType(10); //10代表印章图片
|
|
||||||
caseAttach.setAnnexPath(savePath);
|
|
||||||
caseAttach.setAnnexName(saveName);
|
|
||||||
int i1 = caseAttachMapper.save(caseAttach);
|
|
||||||
if (i1 > 0) {
|
|
||||||
//将印章信息保存到公章管理表里
|
|
||||||
String sealName1 = sealName.substring(1, sealName.length() - 1);
|
|
||||||
String sealId1 = sealId.substring(1, sealId.length() - 1);
|
|
||||||
Integer annexId1 = caseAttach.getAnnexId();
|
|
||||||
sealManage.setAnnexId(annexId1);
|
|
||||||
sealManage.setSealId(sealId1);
|
|
||||||
sealManage.setSealName(sealName1);
|
|
||||||
sealManage.setIdentifyId(deptIdentify1.getId());
|
|
||||||
sealManage.setSealStatus(1);
|
|
||||||
sealManage.setIsUse(1);
|
|
||||||
sealManageMapper.insertSealManage(sealManage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//将orgId保存到数据库里
|
|
||||||
deptIdentify1.setOrgId(orgId);
|
|
||||||
deptIdentify1.setIdentifyStatus(1);
|
|
||||||
deptIdentify1.setIsUse(0); //默认机构为未启用
|
|
||||||
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify1);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
deptIdentify1.setIdentifyStatus(2);
|
|
||||||
deptIdentifyMapper.updateDeptIdentify(deptIdentify1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,38 +17,9 @@ import java.util.zip.ZipFile;
|
|||||||
public class UnZipFileUtils {
|
public class UnZipFileUtils {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// 压缩包路径
|
File file = new File("D:\\home\\ruoyi\\仲裁委项目-测试单.zip");
|
||||||
// String zipPath = "F:\\testZip\\zipFile\\上传申请书证据材料.zip";
|
String targetPath = "D:\\home\\unzip\\";
|
||||||
// 解压后存放路径
|
unZipFile(file,targetPath);
|
||||||
// String targetPath = "F:\\testZip\\unzipFile";
|
|
||||||
// unZipFile(new File(zipPath),targetPath);
|
|
||||||
|
|
||||||
|
|
||||||
// String zipPath = "F:\\testZip\\unzipFile\\上传申请书证据材料";
|
|
||||||
// File dirUnzipPath = new File(zipPath);
|
|
||||||
// List<File> allFiles = new ArrayList<>();
|
|
||||||
// getFiles(dirUnzipPath,allFiles);
|
|
||||||
// if(allFiles!=null&&allFiles.size()>0){
|
|
||||||
// for (File fileIter : allFiles) {
|
|
||||||
// System.out.println(fileIter.getName());
|
|
||||||
// System.out.println(fileIter.getAbsolutePath());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
String key = "\\";
|
|
||||||
String str = "F:\\testZip\\上传申请书证据材料\\证据材料\\仲裁裁决书模板.docx";
|
|
||||||
List<Integer> allindex = new ArrayList<>();
|
|
||||||
int a = str.indexOf(key);//*第一个出现的索引位置
|
|
||||||
allindex.add(a);
|
|
||||||
while (a != -1) {
|
|
||||||
System.out.print(a + "\t");
|
|
||||||
a = str.indexOf(key, a + 1);//*从这个索引往后开始第一个出现的位置
|
|
||||||
allindex.add(a);
|
|
||||||
}
|
|
||||||
String substr = str.substring(allindex.get(1)+1,allindex.get(2));
|
|
||||||
System.out.println("substr---"+substr);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean unZipFile(File aboriginalFile, String targetPath) {
|
public static boolean unZipFile(File aboriginalFile, String targetPath) {
|
||||||
@@ -120,7 +91,4 @@ public class UnZipFileUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user