压缩包导入
This commit is contained in:
+2
@@ -112,4 +112,6 @@ public interface ICaseApplicationService {
|
||||
|
||||
AjaxResult deleteRoom( String roomId);
|
||||
|
||||
AjaxResult uploadCaseZipFile(MultipartFile file);
|
||||
|
||||
}
|
||||
|
||||
+101
-33
@@ -4,6 +4,7 @@ package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdcardUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -11,6 +12,7 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.CaseApplicationConstants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
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.ServiceException;
|
||||
import com.ruoyi.common.utils.*;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
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.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
@@ -61,6 +65,8 @@ import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
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.utils.PageUtils.startPage;
|
||||
@@ -157,7 +163,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
}
|
||||
|
||||
for (SysRole role : roles) {
|
||||
if(StrUtil.isEmpty(role.getRoleName())){
|
||||
if (StrUtil.isEmpty(role.getRoleName())) {
|
||||
continue;
|
||||
}
|
||||
// 超级管理员和仲裁委(部门长)案件,可查看所有案件 √
|
||||
@@ -188,7 +194,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
caseApplication.setDeptIds(deptIds);
|
||||
}
|
||||
if ("申请人".equals(role.getRoleName())) {
|
||||
// caseApplication.setIsOtherRole(1);
|
||||
// caseApplication.setIsOtherRole(1);
|
||||
// 查询有关的用户部门
|
||||
caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
|
||||
}
|
||||
@@ -200,7 +206,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
if ("代理人".equals(role.getRoleName())) {
|
||||
caseApplication.setIsOtherRole(1);
|
||||
// 查询角色有关的用户部门
|
||||
// List<Long> agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
|
||||
// List<Long> agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
|
||||
List<Long> agentDeptIds = new ArrayList<>();
|
||||
agentDeptIds.add(sysUser.getDeptId());
|
||||
caseApplication.setAgentDeptIds(agentDeptIds);
|
||||
@@ -233,7 +239,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
List<Integer> caseStatusList = new ArrayList<>();
|
||||
for (SysRole role : roles) {
|
||||
if(StrUtil.isEmpty(role.getRoleName())){
|
||||
if (StrUtil.isEmpty(role.getRoleName())) {
|
||||
continue;
|
||||
}
|
||||
// 超级管理员和仲裁委(部门长)案件,可查看所有案件 √
|
||||
@@ -264,7 +270,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
caseApplication.setDeptIds(deptIds);
|
||||
}
|
||||
if ("申请人".equals(role.getRoleName())) {
|
||||
// caseApplication.setIsOtherRole(1);
|
||||
// caseApplication.setIsOtherRole(1);
|
||||
// 查询角色有关的用户部门
|
||||
caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
|
||||
}
|
||||
@@ -286,7 +292,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
|
||||
// 根据条件查询申请人,被申请人,仲裁员,法律顾问案件
|
||||
ToDoCount toDoCount = caseApplicationMapper.selectTodoCountByRole(caseApplication);
|
||||
if(toDoCount==null){
|
||||
if (toDoCount == null) {
|
||||
return new ToDoCount();
|
||||
}
|
||||
return toDoCount;
|
||||
@@ -360,7 +366,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
return AjaxResult.error("请选择要上传的文件");
|
||||
}
|
||||
String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile";
|
||||
// String targetPath = "F:\\testZip\\uploadPath\\upload\\upload1\\unzipFile";
|
||||
// String targetPath = "D:\\home\\unzip\\";
|
||||
File zipFile = null;
|
||||
InputStream ins = null;
|
||||
try {
|
||||
@@ -540,7 +546,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return success();
|
||||
|
||||
}
|
||||
@@ -878,6 +883,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
|
||||
/**
|
||||
* 新增案件
|
||||
*
|
||||
* @param caseApplication
|
||||
* @return
|
||||
*/
|
||||
@@ -898,7 +904,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
caseApplication.setVersion(1);
|
||||
// 新增立案信息
|
||||
int rows = caseApplicationMapper.insertCaseApplication(caseApplication);
|
||||
if(rows==0){
|
||||
if (rows == 0) {
|
||||
return rows;
|
||||
}
|
||||
List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
|
||||
@@ -1010,12 +1016,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
caseApplication.setFeePayable(feePayable);
|
||||
caseApplication.setUpdateBy(getUsername());
|
||||
// 立案申请状态直接修改主表信息
|
||||
if(caseApplication.getCaseStatus()!=null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) {
|
||||
if (caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) {
|
||||
|
||||
caseApplicationMapper.updataCaseApplication(caseApplication);
|
||||
// 修改记录表状态为同意提交修改的内容
|
||||
caseApplication.setUpdateSubmitStatus(0);
|
||||
}else {
|
||||
} else {
|
||||
// 修改记录表状态为已提交修改的内容
|
||||
caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.COMMITTED.getCode());
|
||||
}
|
||||
@@ -1064,7 +1070,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
|
||||
}
|
||||
// 立案申请状态直接修改主表信息
|
||||
if(caseApplication.getCaseStatus()!=null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) {
|
||||
if (caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) {
|
||||
|
||||
caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
|
||||
}
|
||||
@@ -1084,11 +1090,11 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
if (maxVersion == null) {
|
||||
maxVersion = 1;
|
||||
}
|
||||
caseApplication.setVersion(maxVersion+1);
|
||||
caseApplication.setVersion(maxVersion + 1);
|
||||
// 将修改提交状态改为未提交
|
||||
// caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
|
||||
// caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
|
||||
// 修改案件表的版本号
|
||||
// caseApplicationMapper.updateVersionById(caseApplication.getId(),caseApplication.getVersion());
|
||||
// caseApplicationMapper.updateVersionById(caseApplication.getId(),caseApplication.getVersion());
|
||||
|
||||
// 异步新增案件日志
|
||||
ThreadPoolUtil.execute(() -> {
|
||||
@@ -1307,7 +1313,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
int successNum = 0;
|
||||
List<CaseAffiliate> caseAffiliateLogList=new ArrayList<>();
|
||||
List<CaseAffiliate> caseAffiliateLogList = new ArrayList<>();
|
||||
if (caseApplicationList != null && caseApplicationList.size() > 0) {
|
||||
// 1,查询所有的组织机构,组装成map
|
||||
List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
|
||||
@@ -1374,7 +1380,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
caseApplicationItera.setCreateBy(getUsername());
|
||||
caseApplicationItera.setImportFlag(1);
|
||||
int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera);
|
||||
if(rows==0){
|
||||
if (rows == 0) {
|
||||
continue;
|
||||
}
|
||||
// 新增日志
|
||||
@@ -1394,7 +1400,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
caseApplicationItera.setVersion(1);
|
||||
|
||||
int insertRow = caseApplicationLogMapper.insert(caseApplicationItera);
|
||||
if(insertRow>0){
|
||||
if (insertRow > 0) {
|
||||
caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplicationItera.getId()));
|
||||
caseAffiliateLogList.addAll(caseAffiliates);
|
||||
}
|
||||
@@ -1408,7 +1414,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
}
|
||||
// 异步新增案件日志
|
||||
ThreadPoolUtil.execute(() -> {
|
||||
if ( CollectionUtil.isNotEmpty(caseAffiliateLogList)) {
|
||||
if (CollectionUtil.isNotEmpty(caseAffiliateLogList)) {
|
||||
// 插入案件日志人员相关表
|
||||
caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliateLogList);
|
||||
}
|
||||
@@ -1457,7 +1463,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNumAgent())) {
|
||||
failureMsg.append("【被申请人主体信息-代理人身份证号】字段不能为空;");
|
||||
} else if (! IdcardUtil.isValidCard((caseApplication.getDebtorIdentityNumAgent()))) {
|
||||
} else if (!IdcardUtil.isValidCard((caseApplication.getDebtorIdentityNumAgent()))) {
|
||||
failureMsg.append("【被申请人主体信息-代理人身份证号】不合法;");
|
||||
}
|
||||
String debtorContactTelphoneAgent = caseApplication.getDebtorContactTelphoneAgent();
|
||||
@@ -1487,7 +1493,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNum())) {
|
||||
failureMsg.append("【被申请人主体信息-身份证号】字段不能为空;");
|
||||
} else if (! IdcardUtil.isValidCard(caseApplication.getDebtorIdentityNum())) {
|
||||
} else if (!IdcardUtil.isValidCard(caseApplication.getDebtorIdentityNum())) {
|
||||
failureMsg.append("【被申请人主体信息-身份证号】不合法;");
|
||||
}
|
||||
String debtorContactTelphone = caseApplication.getDebtorContactTelphone();
|
||||
@@ -1524,7 +1530,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getDebtorEmail())) {
|
||||
failureMsg.append("【被申请人主体信息-邮箱】字段不能为空;");
|
||||
} else if(!EMAIL_PATTERN.matcher(caseApplication.getDebtorEmail()).matches()){
|
||||
} else if (!EMAIL_PATTERN.matcher(caseApplication.getDebtorEmail()).matches()) {
|
||||
|
||||
failureMsg.append("【被申请人主体信息-邮箱】字段不合法;");
|
||||
}
|
||||
@@ -1630,7 +1636,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getEmail())) {
|
||||
failureMsg.append("【申请人主体信息-邮箱】字段不能为空;");
|
||||
} else if(!EMAIL_PATTERN.matcher(caseApplication.getEmail()).matches()){
|
||||
} else if (!EMAIL_PATTERN.matcher(caseApplication.getEmail()).matches()) {
|
||||
|
||||
failureMsg.append("【申请人主体信息-邮箱】字段不合法;");
|
||||
}
|
||||
@@ -1928,7 +1934,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord, sealIdList);
|
||||
|
||||
JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
|
||||
if (jsonObject3 != null){
|
||||
if (jsonObject3 != null) {
|
||||
if (jsonObject3.getIntValue("code") == 0) {
|
||||
//获取签署流程ID
|
||||
JSONObject data1 = jsonObject3.getJSONObject("data");
|
||||
@@ -1941,7 +1947,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
} else {
|
||||
throw new ServiceException("发起签署流程失败,请检查参数是否有误");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@@ -2692,14 +2698,14 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public AjaxResult reservedConference(ReservedConferenceVO reservedConferenceVO) {
|
||||
public AjaxResult reservedConference(ReservedConferenceVO reservedConferenceVO) {
|
||||
|
||||
// 新增预约会议表
|
||||
ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(),SecurityUtils.getUserId(), reservedConferenceVO.getRoomId(),
|
||||
reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime());
|
||||
ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(), SecurityUtils.getUserId(), reservedConferenceVO.getRoomId(),
|
||||
reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime());
|
||||
|
||||
reservedConferenceMapper.insert(conference);
|
||||
return success("预约会议成功");
|
||||
reservedConferenceMapper.insert(conference);
|
||||
return success("预约会议成功");
|
||||
}
|
||||
|
||||
|
||||
@@ -2728,10 +2734,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
// 查询最大房间号
|
||||
Long maxRoomId = caseApplicationMapper.selectMaxRoomId();
|
||||
|
||||
if (null == maxRoomId || maxRoomId >4294967294L) {
|
||||
if (null == maxRoomId || maxRoomId > 4294967294L) {
|
||||
return 1L;
|
||||
} else {
|
||||
return maxRoomId+1;
|
||||
return maxRoomId + 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2776,10 +2782,72 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
@Override
|
||||
public AjaxResult deleteRoom(String roomId) {
|
||||
|
||||
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);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_PAYMENT_CONFIRM, "");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user