From 48752c2712dffb73543ec6a385008974b023ef89 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Tue, 14 May 2024 16:54:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=B2=E8=A3=81=E7=B3=BB=E7=BB=9Fbug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/RuoYiApplication.java | 27 ++++ .../CaseApplicationController.java | 13 ++ .../CaseEvidenceController.java | 9 +- .../src/main/resources/application-druid.yml | 3 +- .../src/main/resources/application.yml | 20 ++- .../ruoyi/common/constant/CacheConstants.java | 12 ++ .../wisdomarbitrate/domain/CaseAttach.java | 6 + .../domain/vo/CaseEvidenceVO.java | 4 + .../mapper/CaseAttachMapper.java | 2 +- .../service/ICaseApplicationService.java | 7 + .../service/ICaseEvidenceService.java | 2 +- .../impl/CaseApplicationServiceImpl.java | 25 ++++ .../service/impl/CaseEvidenceServiceImpl.java | 116 ++++++++++------ .../service/impl/CaseZipImportImpl.java | 129 +++++++++++++----- .../service/impl/MsSignSealServiceImpl.java | 7 +- .../wisdomarbitrate/CaseApplicationMapper.xml | 2 +- .../wisdomarbitrate/CaseEvidenceMapper.xml | 31 ++++- 17 files changed, 320 insertions(+), 95 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index 52a33e2..6aa07d8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -1,10 +1,20 @@ package com.ruoyi; +import cn.hutool.core.collection.CollectionUtil; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.system.mapper.SysRoleMapper; +import com.ruoyi.system.mapper.SysUserMapper; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.scheduling.annotation.EnableScheduling; +import java.util.List; + /** * 启动程序 * @@ -24,5 +34,22 @@ public class RuoYiApplication " / /_/ / / / /_/ / / / / /_/ / / /__/ /_/ / / \n" + "/___/_/ /_/\\____/_/ /_/\\__, / \\___/\\__,_/_/ \n" + " /____/ "); + // 启动成功后,查询用户表,将用户信息存到redis + RedisCache redisCache = SpringUtils.getBean(RedisCache.class); + SysUserMapper userMapper = SpringUtils.getBean(SysUserMapper.class); + List sysUsers = userMapper.selectUserListByIds(null); + if(CollectionUtil.isNotEmpty(sysUsers)){ + for (SysUser sysUser : sysUsers) { + redisCache.setCacheObject(CacheConstants.USER_KEY+sysUser.getUserId(),sysUser); + } + } + // 初始化角色redis + SysRoleMapper roleMapper = SpringUtils.getBean(SysRoleMapper.class); + List roles = roleMapper.selectRoleList(new SysRole()); + if(CollectionUtil.isNotEmpty(roles)){ + for (SysRole role : roles) { + redisCache.setCacheObject(CacheConstants.ROLE_KEY+role.getRoleName(),role.getRoleId()); + } + } } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index 2ea1a73..a490cc9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -585,4 +585,17 @@ public class CaseApplicationController extends BaseController { } return caseApplicationService.updateCaseIdByAnnexId(caseAttach); } + /** + * 保存onlyOffice在线编辑的文件 + * @param + * @return + */ + @PostMapping("/saveOnlyOfficeFile") + public AjaxResult saveOnlyOfficeFile( @RequestBody CaseAttach caseAttach) { + if(caseAttach.getCaseAppliId()==null||StrUtil.isEmpty(caseAttach.getOnlyOfficeFileId())||StrUtil.isEmpty(caseAttach.getAnnexPath())){ + return error("参数校验失败"); + } + + return caseApplicationService.saveOnlyOfficeFile(caseAttach); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java index 8e1b22c..c7f29ec 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java @@ -6,6 +6,7 @@ import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; +import com.ruoyi.wisdomarbitrate.domain.CaseAttach; import com.ruoyi.wisdomarbitrate.domain.CaseEvidenceDirectory; import com.ruoyi.wisdomarbitrate.domain.dto.CaseEvidenceDTO; import com.ruoyi.wisdomarbitrate.domain.vo.CaseEvidenceVO; @@ -101,16 +102,16 @@ public class CaseEvidenceController extends BaseController { /** * 删除附件 - * @param fileIds + * @param caseAttach * @return */ @PostMapping("/deleteFile") - public AjaxResult deleteFile( @RequestParam("fileIds") List fileIds){ + public AjaxResult deleteFile(@RequestBody CaseAttach caseAttach){ - if(CollectionUtil.isEmpty(fileIds)){ + if(CollectionUtil.isEmpty(caseAttach.getFileIds())){ return error("附件id不能为空"); } - return toAjax(caseEvidenceService.deleteFile( fileIds)); + return success(caseEvidenceService.deleteFile( caseAttach.getFileIds())); } diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index fb697f9..2058ef9 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -6,7 +6,8 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://121.40.189.20:3306/test_smart_arbitration?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false + url: jdbc:mysql://121.40.189.20:3306/test_smart_arbitration?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false +# url: jdbc:mysql://121.40.189.20:3306/smart_arbitration?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false username: root password: YMzc157# # 从库数据源 diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 22aa6db..e9ecfa1 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -17,7 +17,7 @@ ruoyi: # 开发环境配置 server: - # 服务器的HTTP端口,默认为8080 + # 服务器的HTTP端口,默认为8001,正式9001 port: 8001 servlet: # 应用的访问路径 @@ -58,9 +58,9 @@ spring: servlet: multipart: # 单个文件大小 - max-file-size: 50MB + max-file-size: 1000MB # 设置总上传的文件大小 - max-request-size: 500MB + max-request-size: 10000MB # 服务模块 devtools: restart: @@ -72,8 +72,8 @@ spring: host: 121.40.189.20 # 端口,默认为6379 port: 6389 - # 数据库索引 - database: 0 + # 数据库索引,2-正式,3-测试 + database: 3 # 密码 password: # 连接超时时间 @@ -121,7 +121,7 @@ token: # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) - expireTime: 30 + expireTime: 1200 # MyBatis配置 mybatis: @@ -183,6 +183,14 @@ imConfig: secretId: AKID3xfHgroY4MQHvLXUXMwIQL1UjmbBX1Tv # 腾讯云密钥 secretKey: INDrIXcT8YmomZBcsy0oNirnU0LTN4X7 +# onlyOffice系统url配置 +onlyOfficeConfig: + # url: http://172.16.0.254:9090/files/upload + url: http://121.40.189.20:9090/files/upload +# 调解机构代码配置 +organizeConfig: + # creditCode + creditCode: 910000058386410044 #jodconverter: # local: # host: 121.40.189.20 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java index 30d3a56..3b8220a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java @@ -42,4 +42,16 @@ public class CacheConstants */ public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; public static final String WE_CHAT_SMS_VERIFY_CODE_KEY="we_chat_sms_verify_code:"; + /** + * 所有用户 redis key + */ +public static final String USER_KEY = "user_key:"; + /** + * 用户邮箱 redis key + */ +// public static final String USER_EMAIL_KEY = "user_email_key:"; + /** + * 角色 redis key + */ + public static final String ROLE_KEY = "role_key:"; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java index 31c502f..14cea94 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java @@ -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 fileIds; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseEvidenceVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseEvidenceVO.java index da1e6f2..8abeccf 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseEvidenceVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseEvidenceVO.java @@ -37,4 +37,8 @@ public class CaseEvidenceVO { */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date scheduleStartTime; + /** + * 案件编号 + */ + private String caseStatusName; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAttachMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAttachMapper.java index e59296f..37fd106 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAttachMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAttachMapper.java @@ -21,7 +21,7 @@ public interface CaseAttachMapper { int updateCaseAttachBycaseid(CaseAttach caseAttach); - int deleteByFileIds(@Param("ids") List fileIds); + int deleteByFileIds(@Param("ids") List fileIds); List getCaseAttachByCaseIdAndType(CaseAttach caseAttach); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java index 2276ed7..c3667e2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java @@ -161,4 +161,11 @@ public interface ICaseApplicationService { * @param annexPath */ JSONArray uploadOnlyOffice(String annexPath, Long id); + /** + * 保存onlyOffice在线编辑的文件 + * @param + * @return + */ + + AjaxResult saveOnlyOfficeFile(CaseAttach caseAttach); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseEvidenceService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseEvidenceService.java index 1e8d4d1..7d8affe 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseEvidenceService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseEvidenceService.java @@ -36,7 +36,7 @@ public interface ICaseEvidenceService { AjaxResult fileList(Long caseAppliId, List annexTypeList); - int deleteFile( List fileIds); + int deleteFile( List fileIds); List selectEvidenceTreeList(CaseEvidenceDirectory caseEvidenceDirectory); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 60eba70..aae1376 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -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(); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java index dd2a5b9..afce097 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java @@ -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 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 fileIds) { + public int deleteFile(List fileIds) { return caseAttachMapper.deleteByFileIds(fileIds); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java index 3635d83..c904ec1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java @@ -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 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> 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> 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; } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/MsSignSealServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/MsSignSealServiceImpl.java index 28e2199..357bc84 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/MsSignSealServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/MsSignSealServiceImpl.java @@ -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); } } diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml index e3a8e2f..4a95010 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml @@ -1113,7 +1113,7 @@ c.batch_number, c.facts, c.appli_iswrit_hear,c.respon_isWrit_hear, - c.mediation_agreement,c.template_id templateId + c.mediation_agreement,c.template_id templateId,c.appli_iswrit_hear,c.respon_isWrit_hear from case_application c LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1 diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseEvidenceMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseEvidenceMapper.xml index 7bed4fe..93edae9 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseEvidenceMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseEvidenceMapper.xml @@ -7,12 +7,24 @@ + - + \ No newline at end of file