仲裁系统bug修复

This commit is contained in:
18792927508
2024-05-14 16:54:42 +08:00
parent e637b7c511
commit 48752c2712
17 changed files with 320 additions and 95 deletions
@@ -6,6 +6,8 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Builder
@Data
@AllArgsConstructor
@@ -59,5 +61,9 @@ public class CaseAttach {
* 是否是证据上传,0-否,1-是
*/
private Integer isBatchUpload;
/**
* 附件ids
*/
private List<Long> fileIds;
}
@@ -37,4 +37,8 @@ public class CaseEvidenceVO {
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date scheduleStartTime;
/**
* 案件编号
*/
private String caseStatusName;
}
@@ -21,7 +21,7 @@ public interface CaseAttachMapper {
int updateCaseAttachBycaseid(CaseAttach caseAttach);
int deleteByFileIds(@Param("ids") List<Integer> fileIds);
int deleteByFileIds(@Param("ids") List<Long> fileIds);
List<CaseAttach> getCaseAttachByCaseIdAndType(CaseAttach caseAttach);
@@ -161,4 +161,11 @@ public interface ICaseApplicationService {
* @param annexPath
*/
JSONArray uploadOnlyOffice(String annexPath, Long id);
/**
* 保存onlyOffice在线编辑的文件
* @param
* @return
*/
AjaxResult saveOnlyOfficeFile(CaseAttach caseAttach);
}
@@ -36,7 +36,7 @@ public interface ICaseEvidenceService {
AjaxResult fileList(Long caseAppliId, List<Integer> annexTypeList);
int deleteFile( List<Integer> fileIds);
int deleteFile( List<Long> fileIds);
List<CaseEvidenceDirectoryVO> selectEvidenceTreeList(CaseEvidenceDirectory caseEvidenceDirectory);
@@ -63,6 +63,8 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.zip.ZipOutputStream;
import static cn.hutool.system.SystemUtil.getUserInfo;
import static com.google.common.io.Files.getFileExtension;
import static com.ruoyi.common.core.domain.AjaxResult.error;
import static com.ruoyi.common.core.domain.AjaxResult.success;
import static com.ruoyi.common.utils.PageUtils.startPage;
@@ -3945,7 +3947,30 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseAttachMapper.updateCaseAttach(caseAttach);
return success();
}
/**
* 保存onlyOffice在线编辑的文件
* @param
* @return
*/
@Transactional
@Override
public AjaxResult saveOnlyOfficeFile(CaseAttach caseAttach) {
if(StrUtil.isNotEmpty(caseAttach.getAnnexPath())){
String replace = caseAttach.getAnnexPath().replace("/home/ruoyi/uploadPath/", "/profile/");
caseAttach.setAnnexName(replace);
}
caseAttach.setAnnexPath("/home/ruoyi/uploadPath/onlyoffice/");
caseAttach.setAnnexType(3);
caseAttach.setUserId(SecurityUtils.getUserId());
caseAttach.setUserName(SecurityUtils.getUsername());
// 先删除之前的在新增
caseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), caseAttach.getAnnexType());
caseAttachMapper.save(caseAttach);
return AjaxResult.success();
}
}
@@ -1,7 +1,10 @@
package com.ruoyi.wisdomarbitrate.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.core.domain.AjaxResult;
@@ -11,9 +14,11 @@ import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.SmsUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.wisdomarbitrate.domain.vo.CaseEvidenceDirectoryVO;
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.wisdomarbitrate.domain.*;
@@ -32,6 +37,7 @@ import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import static com.google.common.io.Files.getFileExtension;
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
@Service
@@ -50,6 +56,8 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService {
private SysUserMapper sysUserMapper;
@Autowired
private SmsRecordMapper smsRecordMapper;
@Autowired
private ICaseApplicationService caseApplicationService;
@Override
@Transactional
@@ -134,15 +142,39 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService {
String filePath = RuoYiConfig.getUploadPath();
// 上传
String fileName = FileUploadUtils.upload(filePath, file);
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id)
.annexName(fileName)
.annexPath(filePath)
.annexType(annexType)
.userId(userId)
.userName(userName)
.build();
int count = caseAttachMapper.save(caseAttach);
if (count > 0 && annexType != null && annexType != 8) {
String suffix = getFileExtension(fileName);
if(StrUtil.isNotEmpty(suffix)&& suffix.contains("doc")){
// 上传到onlyoffice
JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(fileName,id);
if(jsonArray!=null && jsonArray.size() > 0) {
for (Object obj : jsonArray) {
JSONObject jsonObject = (JSONObject) obj;
CaseAttach caseAttach = CaseAttach.builder()
.caseAppliId(id)
.annexType(annexType)
.annexName(jsonObject.get("fileName")!=null?jsonObject.getString("fileName"):"")
.onlyOfficeFileId(jsonObject.getString("fileId"))
.build();
if(jsonObject.get("filePath")!=null){
String officePath = jsonObject.getString("filePath");
String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/");
caseAttach.setAnnexPath(replace);
}
caseAttachMapper.save(caseAttach);
}
}
}else {
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id)
.annexName(fileName)
.annexPath(filePath)
.annexType(annexType)
.userId(userId)
.userName(userName)
.build();
int count = caseAttachMapper.save(caseAttach);
}
if ( annexType != null && annexType != 8) {
if (id != null) {
//修改案件状态
CaseApplication caseApplication = new CaseApplication();
@@ -151,18 +183,7 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService {
caseApplicationMapper.submitCaseApplication(caseApplication);
}
}
CaseAttach caseAttachselect = new CaseAttach();
caseAttachselect.setAnnexId(caseAttach.getAnnexId());
String annexName = caseAttach.getAnnexName();
if(StrUtil.isNotEmpty(annexName)) {
int startIndexnew = annexName.lastIndexOf("/");
if (startIndexnew != -1) {
String annexNamenew = annexName.substring(startIndexnew + 1);
caseAttach.setAnnexName(annexNamenew);
}
}
caseAttachselect.setAnnexType(caseAttach.getAnnexType());
return AjaxResult.success("上传成功", caseAttachselect);
return AjaxResult.success();
} catch (IOException e) {
e.printStackTrace();
}
@@ -265,27 +286,44 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService {
@Transactional
@Override
public AjaxResult batchUpload(MultipartFile[] files, Integer annexType, Long id, String userName, Long userId) {
List<CaseAttach> successList = new ArrayList<>();
try {
String filePath = RuoYiConfig.getUploadPath();
for (MultipartFile file : files) {
// 上传
String fileName = FileUploadUtils.upload(filePath, file);
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id)
.annexName(fileName)
.annexPath(filePath)
.annexType(annexType)
.userId(userId)
.userName(userName)
.isBatchUpload(1)
.build();
int count = caseAttachMapper.save(caseAttach);
if (count > 0 && annexType != null && annexType != 8) {
CaseAttach caseAttachselect = new CaseAttach();
caseAttachselect.setAnnexId(caseAttach.getAnnexId());
caseAttachselect.setAnnexName(caseAttach.getAnnexName());
caseAttachselect.setAnnexType(caseAttach.getAnnexType());
successList.add(caseAttachselect);
String suffix = getFileExtension(fileName);
if (StrUtil.isNotEmpty(suffix) && suffix.contains("doc")) {
// 上传onlyoffice
JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(fileName,id);
if(jsonArray!=null && jsonArray.size() > 0) {
for (Object obj : jsonArray) {
JSONObject jsonObject = (JSONObject) obj;
CaseAttach caseAttach = CaseAttach.builder()
.caseAppliId(id)
.annexType(annexType)
.annexName(jsonObject.get("fileName")!=null?jsonObject.getString("fileName"):"")
.onlyOfficeFileId(jsonObject.getString("fileId"))
.build();
if(jsonObject.get("filePath")!=null){
String officePath = jsonObject.getString("filePath");
String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/");
caseAttach.setAnnexPath(replace);
}
caseAttachMapper.save(caseAttach);
}
}
}else {
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id)
.annexName(fileName)
.annexPath(filePath)
.annexType(annexType)
.userId(userId)
.userName(userName)
.isBatchUpload(1)
.build();
int count = caseAttachMapper.save(caseAttach);
}
}
@@ -333,7 +371,7 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService {
}
return AjaxResult.success("上传成功", successList);
return AjaxResult.success("上传成功");
}
@@ -363,7 +401,7 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService {
}
@Override
public int deleteFile(List<Integer> fileIds) {
public int deleteFile(List<Long> fileIds) {
return caseAttachMapper.deleteByFileIds(fileIds);
}
@@ -4,6 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.entity.SysDept;
@@ -47,6 +49,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static com.google.common.io.Files.getFileExtension;
import static com.ruoyi.common.core.domain.AjaxResult.error;
import static com.ruoyi.common.core.domain.AjaxResult.success;
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
@@ -93,6 +96,8 @@ public class CaseZipImportImpl {
// 申请人角色id
private long roleId;
private Integer maxCaseNum;
@Autowired
private CaseZipImportImpl caseZipImportImpl;
@Transactional
@@ -164,22 +169,39 @@ public class CaseZipImportImpl {
}
File[] files = directory.listFiles();
CaseZipImportTask caseZipImportTask = null;
try {
caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchRuleMap, userMap, dictDataList, files , deptMap, SecurityUtils.getLoginUser());
} catch (Exception e) {
// todo
List<CaseApplication> caseApplications = new ArrayList<>();
for (File file1 : files) {
if (file1.isDirectory() && file1.listFiles() != null) {
for (File file2 : file1.listFiles()) {
CaseApplication caseApplication = caseZipImportImpl.buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, userMap, dictDataList, deptMap, SecurityUtils.getLoginUser());
if (caseApplication != null) {
caseApplications.add(caseApplication);
}
}
}
}
if (CollectionUtil.isEmpty(caseApplications)) {
return error("导入失败");
}
Future<List<CaseApplication>> future = ThreadPoolUtil.submit(caseZipImportTask);
try {
if(future.get()!=null){
return success("导入成功");
}
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
return error(e.getMessage());
}
return error("导入失败");
// CaseZipImportTask caseZipImportTask = null;
// try {
// caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchRuleMap, userMap, dictDataList, files , deptMap, SecurityUtils.getLoginUser());
// } catch (Exception e) {
// return error("导入失败");
// }
// Future<List<CaseApplication>> future = ThreadPoolUtil.submit(caseZipImportTask);
// try {
// if(future.get()!=null){
// return success("导入成功");
// }
// } catch (InterruptedException | ExecutionException e) {
// e.printStackTrace();
// return error(e.getMessage());
// }
return success("导入成功");
}
@@ -207,8 +229,8 @@ public class CaseZipImportImpl {
if (fatchMap.size() > 0) {
// 尊敬的{1},您的代理的案件已接入仲裁系统,复制访问https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 进入小程序进行认证注册。如非本人操作,请忽略本短信
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1956159");
// SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
// request.setTemplateId("1956159");
// 新增的案件
// 组装案件内置字段主表内容
@@ -268,26 +290,58 @@ public class CaseZipImportImpl {
if (StrUtil.isEmpty(fileUrl)) {
continue;
}
// 上传
String filePath = RuoYiConfig.getUploadPath();
String suffix = getFileExtension(fileUrl);
if (StrUtil.isNotEmpty(suffix) && suffix.contains("doc")) {
// 上传onlyoffice
JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(fileUrl,caseApplication.getId());
if(jsonArray!=null && jsonArray.size() > 0) {
for (Object obj : jsonArray) {
JSONObject jsonObject = (JSONObject) obj;
CaseAttach caseAttach = CaseAttach.builder()
.caseAppliId(caseApplication.getId())
.annexName(jsonObject.get("fileName")!=null?jsonObject.getString("fileName"):"")
CaseAttach caseAttach = new CaseAttach();
caseAttach.setCaseAppliId(caseApplication.getId());
caseAttach.setAnnexPath(filePath);
if (StrUtil.isNotEmpty(fileUrl)) {
String fileName = fileUrl.replace(filePath, "/profile/upload");
caseAttach.setAnnexName(fileName);
}
// 申请人提供的证据材料
caseAttach.setAnnexType(2);
caseAttachs.add(caseAttach);
if (fileUrl.contains("仲裁申请书")) {
CaseAttach applyFile = new CaseAttach();
BeanUtil.copyProperties(caseAttach, applyFile);
applyFile.setAnnexType(1);
caseAttachs.add(applyFile);
}
.onlyOfficeFileId(jsonObject.getString("fileId"))
.build();
if(jsonObject.get("filePath")!=null){
String officePath = jsonObject.getString("filePath");
String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/");
caseAttach.setAnnexPath(replace);
}
if(fileUrl.contains("申请书")){
CaseAttach applyFile = new CaseAttach();
BeanUtil.copyProperties(caseAttach, applyFile);
applyFile.setAnnexType(1);
caseAttachs.add(applyFile);
}
caseAttach.setAnnexType(2);
caseAttachs.add(caseAttach);
}
}
} else {
// 上传
String filePath = RuoYiConfig.getUploadPath();
CaseAttach caseAttach = new CaseAttach();
caseAttach.setCaseAppliId(caseApplication.getId());
caseAttach.setAnnexPath(filePath);
if (StrUtil.isNotEmpty(fileUrl)) {
String fileName = fileUrl.replace(filePath, "/profile/upload");
caseAttach.setAnnexName(fileName);
}
// 申请人提供的证据材料
caseAttach.setAnnexType(2);
caseAttachs.add(caseAttach);
if (fileUrl.contains("申请书")) {
CaseAttach applyFile = new CaseAttach();
BeanUtil.copyProperties(caseAttach, applyFile);
applyFile.setAnnexType(1);
caseAttachs.add(applyFile);
}
}
}
caseApplication.setCaseAttachList(caseAttachs);
// 案件压缩包导入
@@ -300,8 +354,9 @@ public class CaseZipImportImpl {
// }
// 多线程执行
ThreadPoolUtil.execute(() -> {
// ThreadPoolUtil.execute(() -> {
try {
caseApplicationMapper.insertCaseApplication(caseApplication);
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "",loginUser);
@@ -337,10 +392,10 @@ public class CaseZipImportImpl {
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("导入失败,请检查抓取规则是否正确");
throw new RuntimeException("案件导入失败");
}
});
// });
return caseApplication;
}
}
@@ -10,6 +10,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.utils.EmailOutUtil;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
import com.ruoyi.system.mapper.SysUserMapper;
@@ -162,7 +163,11 @@ public class MsSignSealServiceImpl implements MsSignSealService {
caseAttach.setAnnexType(3);
caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName);
caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
caseAttach.setUserName(SecurityUtils.getUsername());
caseAttach.setUserId(SecurityUtils.getUserId());
// 删除已存在的
caseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, 3);
caseAttachMapper.save(caseAttach);
}
}