Merge branch 'wq1' of SH-Arbitrate/Mediation-Backend into dev

This commit was merged in pull request #118.
This commit is contained in:
2024-03-14 17:17:11 +08:00
committed by Gitea
4 changed files with 26 additions and 5 deletions
@@ -1,11 +1,19 @@
package com.ruoyi;
import cn.hutool.core.collection.CollectionUtil;
import com.ruoyi.common.constant.CacheConstants;
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.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 springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.List;
/**
* 启动程序
*
@@ -30,5 +38,14 @@ public class RuoYiApplication
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
// 启动成功后,查询用户表,将用户信息存到redis
RedisCache redisCache = SpringUtils.getBean(RedisCache.class);
SysUserMapper userMapper = SpringUtils.getBean(SysUserMapper.class);
List<SysUser> sysUsers = userMapper.selectUserListByIds(null);
if(CollectionUtil.isNotEmpty(sysUsers)){
for (SysUser sysUser : sysUsers) {
redisCache.setCacheObject(CacheConstants.USER_KEY+sysUser.getUserId(),sysUser);
}
}
}
}
@@ -46,4 +46,8 @@ public class CacheConstants
* 案件 redis key
*/
public static final String CASE_KEY = "case_codes:";
/**
* 所有用户 redis key
*/
public static final String USER_KEY = "user_key:";
}
@@ -224,7 +224,7 @@ public interface MsCaseApplicationService {
* 调解书上传到onlyoffice服务器
* @param annexPath
*/
JSONArray uploadOnlyOffice(String annexPath);
JSONArray uploadOnlyOffice(String annexPath,Long id);
/**
* 案件受理
* @param application
@@ -3755,7 +3755,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
String annexPath=resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX);
// 如果是调解书或者调解协议上传到onlyoffice服务器
if(annexType != null && annexType.equals(AnnexTypeEnum.MEDIATE_BOOK.getCode())){
JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(annexPath);
JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(annexPath,application.getId());
if(jsonArray!=null && jsonArray.size() > 0){
for (Object obj : jsonArray) {
JSONObject jsonObject = (JSONObject) obj;
@@ -3784,13 +3784,13 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
*/
@Override
@Transactional
public JSONArray uploadOnlyOffice(String annexPath) {
public JSONArray uploadOnlyOffice(String annexPath,Long caseId) {
annexPath=annexPath.replace("/profile","/home/ruoyi/uploadPath");
File file = new File(annexPath);
if (file.exists()) {
// 调用onlyoffice
// String url = "http://121.40.189.20:9090/files/upload";
try {
onlyOfficeUrl= onlyOfficeUrl+ "?caseId="+caseId;
Map<String, Object> params = new HashMap<>();
params.put("file", file);
String postResult = HttpUtil.post(onlyOfficeUrl, params);
@@ -3806,7 +3806,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}else {
throw new ServiceException("文件不存在");
}
return null;
return null;
}
/**