|
@@ -7,6 +7,7 @@ import com.ruoyi.common.core.domain.entity.SysRole;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
+import com.ruoyi.common.utils.uuid.Seq;
|
|
|
import com.ruoyi.system.domain.conference.SysUserConference;
|
|
|
import com.ruoyi.system.domain.enterprise.SysUserEnterprise;
|
|
|
import com.ruoyi.system.domain.loan.LoanApplication;
|
|
@@ -20,18 +21,15 @@ import com.ruoyi.system.service.loan.ILoanApplicationService;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import java.io.File;
|
|
|
+import java.io.*;
|
|
|
+import java.nio.file.Files;
|
|
|
+import java.nio.file.Path;
|
|
|
+import java.nio.file.Paths;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
-
|
|
|
+import java.util.zip.ZipEntry;
|
|
|
+import java.util.zip.ZipOutputStream;
|
|
|
import static com.ruoyi.common.constant.CommonConstants.*;
|
|
|
-
|
|
|
-import net.lingala.zip4j.ZipFile;
|
|
|
-import net.lingala.zip4j.exception.ZipException;
|
|
|
-import net.lingala.zip4j.model.ZipParameters;
|
|
|
-import net.lingala.zip4j.model.enums.EncryptionMethod;
|
|
|
-
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
@@ -410,7 +408,7 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
|
|
|
waitRemind.setReadUserId(reviewComments.getaUserId().toString());
|
|
|
String enterpriseName = loanApplication.getEnterpriseName();
|
|
|
- waitRemind.setRemindContent(enterpriseName+"有一条贷款申请需及时处理");
|
|
|
+ waitRemind.setRemindContent(enterpriseName + "有一条贷款申请需及时处理");
|
|
|
waitRemindMapper.insertWaitRemind(waitRemind);
|
|
|
}
|
|
|
|
|
@@ -422,11 +420,11 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
loanApplication.setLoanSchedule(THR);
|
|
|
loanApplication.setAuditSchedule(String.valueOf(Integer.parseInt(auditSchedule) + 1));
|
|
|
loanApplication.setAuditType(ONE);
|
|
|
- if (auditSchedule.equals(TWO)){
|
|
|
+ if (auditSchedule.equals(TWO)) {
|
|
|
|
|
|
waitRemind.setReadUserId(loanApplication.getbUserId().toString());
|
|
|
String enterpriseName = loanApplication.getEnterpriseName();
|
|
|
- waitRemind.setRemindContent(enterpriseName+"有一条贷款申请需及时处理");
|
|
|
+ waitRemind.setRemindContent(enterpriseName + "有一条贷款申请需及时处理");
|
|
|
waitRemindMapper.insertWaitRemind(waitRemind);
|
|
|
}
|
|
|
|
|
@@ -516,7 +514,7 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
String auditSchedule = loanApplication.getAuditSchedule();
|
|
|
String loanApplicationType = loanApplication.getLoanApplicationType();
|
|
|
String auditType = loanApplication.getAuditType();
|
|
|
- reviewCommentsMapper.deleteReviewCommentsByLoanApplicationIdAndAuditSchedule(loanApplicationId,auditSchedule);
|
|
|
+ reviewCommentsMapper.deleteReviewCommentsByLoanApplicationIdAndAuditSchedule(loanApplicationId, auditSchedule);
|
|
|
if (Integer.parseInt(loanSchedule) < 2 || Integer.parseInt(auditSchedule) < 1 || Integer.parseInt(loanApplicationType) != 2) {
|
|
|
return AjaxResult.error("当前项目不可撤销");
|
|
|
}
|
|
@@ -560,7 +558,7 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
loanApplication.setLoanSchedule(TEN);
|
|
|
loanApplication.setLoanApplicationType(FOR);
|
|
|
loanApplication.setFileTime(DateUtils.getNowDate());
|
|
|
- loanApplicationMapper.updateLoanApplication(loanApplication);
|
|
|
+
|
|
|
|
|
|
LoanSchedule loanScheduleNew = new LoanSchedule();
|
|
|
loanScheduleNew.setLoanApplicationId(loanApplication.getLoanApplicationId());
|
|
@@ -570,6 +568,8 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
loanScheduleNew.setLoanApplicationNumber(loanApplication.getLoanApplicationNumber());
|
|
|
loanScheduleMapper.insertLoanSchedule(loanScheduleNew);
|
|
|
|
|
|
+
|
|
|
+ String filePath = RuoYiConfig.getUploadPath() + "/";
|
|
|
Long loanApplicationId = loanApplication.getLoanApplicationId();
|
|
|
List<LoanApplicationFj> loanApplicationFjList = loanApplicationFjMapper.selectLoanApplicationFjByLoanApplicationId(loanApplicationId);
|
|
|
|
|
@@ -579,7 +579,7 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
List<File> fileList = new ArrayList<>();
|
|
|
if (loanApplicationFjList != null && loanApplicationFjList.size() > 0) {
|
|
|
for (LoanApplicationFj loanApplicationFj : loanApplicationFjList) {
|
|
|
- fileList.add(new File(loanApplicationFj.getUrl()));
|
|
|
+ fileList.add(new File(loanApplicationFj.getUrl().replace("/profile", filePath)));
|
|
|
}
|
|
|
}
|
|
|
String corporationFront = loanApplicationOld.getCorporationFront();
|
|
@@ -589,44 +589,47 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
String guaranteeFront = loanApplicationOld.getGuaranteeFront();
|
|
|
String guaranteeBack = loanApplicationOld.getGuaranteeBack();
|
|
|
if (StringUtils.isNotEmpty(corporationFront)) {
|
|
|
- fileList.add(new File(corporationFront));
|
|
|
+ fileList.add(new File(corporationFront.replace("/profile/upload/", filePath)));
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(corporationBack)) {
|
|
|
- fileList.add(new File(corporationBack));
|
|
|
+ fileList.add(new File(corporationBack.replace("/profile/upload/", filePath)));
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(spouseFront)) {
|
|
|
- fileList.add(new File(spouseFront));
|
|
|
+ fileList.add(new File(spouseFront.replace("/profile/upload/", filePath)));
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(spouseBack)) {
|
|
|
- fileList.add(new File(spouseBack));
|
|
|
+ fileList.add(new File(spouseBack.replace("/profile/upload/", filePath)));
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(guaranteeFront)) {
|
|
|
- fileList.add(new File(guaranteeFront));
|
|
|
+ fileList.add(new File(guaranteeFront.replace("/profile/upload/", filePath)));
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(guaranteeBack)) {
|
|
|
- fileList.add(new File(guaranteeBack));
|
|
|
+ fileList.add(new File(guaranteeBack.replace("/profile/upload/", filePath)));
|
|
|
}
|
|
|
if (shareholderFjs != null && shareholderFjs.size() > 0) {
|
|
|
for (ShareholderFj shareholderFj : shareholderFjs) {
|
|
|
- fileList.add(new File(shareholderFj.getShareholderZxUrl()));
|
|
|
- fileList.add(new File(shareholderFj.getShareholderFrontUrl()));
|
|
|
- fileList.add(new File(shareholderFj.getShareholderBackUrl()));
|
|
|
+ fileList.add(new File(shareholderFj.getShareholderZxUrl().replace("/profile/upload/", filePath)));
|
|
|
+ fileList.add(new File(shareholderFj.getShareholderFrontUrl().replace("/profile/upload/", filePath)));
|
|
|
+ fileList.add(new File(shareholderFj.getShareholderBackUrl().replace("/profile/upload/", filePath)));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- String filePath = RuoYiConfig.getUploadPath() + "/";
|
|
|
- String name = loanApplicationOld.getEnterpriseName() + loanApplicationOld.getLoanApplicationNumber() + "文档.zip";
|
|
|
- zipEncryptExample(fileList, filePath + name, "123");
|
|
|
+
|
|
|
+
|
|
|
+ String name = StringUtils.format("{}_{}.{}",
|
|
|
+ loanApplicationOld.getEnterpriseName(), Seq.getId(Seq.uploadSeqType) + "文档", "zip");
|
|
|
+
|
|
|
+ zipEncryptExample(fileList, filePath + loanApplicationOld.getLoanApplicationNumber(), name, "123");
|
|
|
|
|
|
LoanApplicationFj loanApplicationFj = new LoanApplicationFj();
|
|
|
loanApplicationFj.setLoanApplicationId(loanApplicationId);
|
|
|
- loanApplicationFj.setLoanApplicationNumber(loanApplicationOld.getEnterpriseName());
|
|
|
+ loanApplicationFj.setLoanApplicationNumber(loanApplicationOld.getLoanApplicationNumber());
|
|
|
loanApplicationFj.setOldName(name);
|
|
|
loanApplicationFj.setName(name);
|
|
|
- loanApplicationFj.setUrl(filePath + name);
|
|
|
+ loanApplicationFj.setUrl("/profile/upload/"+name);
|
|
|
loanApplicationFj.setBigType("e");
|
|
|
loanApplicationFj.setCreateTime(DateUtils.getNowDate());
|
|
|
loanApplicationFjMapper.insertLoanApplicationFj(loanApplicationFj);
|
|
|
+ loanApplicationMapper.updateLoanApplication(loanApplication);
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
@@ -634,19 +637,47 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
* 压缩文件,返回地址
|
|
|
*
|
|
|
* @param fileList 源文件或目录路径
|
|
|
- * @param zipFilePath ZIP文件输出路径
|
|
|
+ * @param zipPathDir ZIP文件输出路径
|
|
|
+ * @param zipFileName ZIP文件名称
|
|
|
* @param password 加密密码
|
|
|
* @return
|
|
|
*/
|
|
|
- public String zipEncryptExample(List<File> fileList, String zipFilePath, String password) {
|
|
|
+ public String zipEncryptExample(List<File> fileList, String zipPathDir, String zipFileName, String password) {
|
|
|
+ String zipFilePath = zipPathDir +"/"+ zipFileName;
|
|
|
try {
|
|
|
- ZipParameters zipParameters = new ZipParameters();
|
|
|
+
|
|
|
+
|
|
|
zipParameters.setEncryptFiles(true);
|
|
|
zipParameters.setEncryptionMethod(EncryptionMethod.ZIP_STANDARD);
|
|
|
- ZipFile zipFile = new ZipFile(zipFilePath, password.toCharArray());
|
|
|
- zipFile.addFiles(fileList, zipParameters);
|
|
|
+ ZipFile zipFile = new ZipFile(zipPathDir, password.toCharArray());
|
|
|
+ zipFile.addFiles(fileList, zipParameters);*/
|
|
|
+
|
|
|
+ ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(new File(zipFilePath)));
|
|
|
+ BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(zos));
|
|
|
+ File zipFile = new File(zipPathDir);
|
|
|
+ if (!zipFile.exists()) {
|
|
|
+ zipFile.mkdirs();
|
|
|
+ }
|
|
|
+ for (File file : fileList) {
|
|
|
+ if (file.exists()) {
|
|
|
+ ZipEntry zipEntry = new ZipEntry(file.getName());
|
|
|
+ zos.putNextEntry(zipEntry);
|
|
|
+ Path path = Paths.get(file.getAbsolutePath());
|
|
|
+ BufferedReader reader = new BufferedReader(new InputStreamReader(Files.newInputStream(path)));
|
|
|
+ while (reader.ready()) {
|
|
|
+ writer.write(reader.readLine());
|
|
|
+ }
|
|
|
+ writer.flush();
|
|
|
+ reader.close();
|
|
|
+ zos.closeEntry();
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ zos.flush();
|
|
|
+ writer.close();
|
|
|
System.out.println("文件加密成功,保存位置:" + zipFilePath);
|
|
|
- } catch (ZipException e) {
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return zipFilePath;
|