Kaynağa Gözat

在线修改

18792927508 2 yıl önce
ebeveyn
işleme
1cece4a0d1

+ 17
- 0
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java Dosyayı Görüntüle

@@ -1,11 +1,19 @@
1 1
 package com.ruoyi;
2 2
 
3
+import cn.hutool.core.collection.CollectionUtil;
4
+import com.ruoyi.common.constant.CacheConstants;
5
+import com.ruoyi.common.core.domain.entity.SysUser;
6
+import com.ruoyi.common.core.redis.RedisCache;
7
+import com.ruoyi.common.utils.spring.SpringUtils;
8
+import com.ruoyi.system.mapper.SysUserMapper;
3 9
 import org.springframework.boot.SpringApplication;
4 10
 import org.springframework.boot.autoconfigure.SpringBootApplication;
5 11
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
6 12
 import org.springframework.scheduling.annotation.EnableScheduling;
7 13
 import springfox.documentation.swagger2.annotations.EnableSwagger2;
8 14
 
15
+import java.util.List;
16
+
9 17
 /**
10 18
  * 启动程序
11 19
  * 
@@ -30,5 +38,14 @@ public class RuoYiApplication
30 38
                 " |  | \\ `'   /|   `-'  /           \n" +
31 39
                 " |  |  \\    /  \\      /           \n" +
32 40
                 " ''-'   `'-'    `-..-'              ");
41
+        // 启动成功后,查询用户表,将用户信息存到redis
42
+        RedisCache redisCache = SpringUtils.getBean(RedisCache.class);
43
+        SysUserMapper userMapper = SpringUtils.getBean(SysUserMapper.class);
44
+        List<SysUser> sysUsers = userMapper.selectUserListByIds(null);
45
+        if(CollectionUtil.isNotEmpty(sysUsers)){
46
+            for (SysUser sysUser : sysUsers) {
47
+                redisCache.setCacheObject(CacheConstants.USER_KEY+sysUser.getUserId(),sysUser);
48
+            }
49
+        }
33 50
     }
34 51
 }

+ 4
- 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java Dosyayı Görüntüle

@@ -46,4 +46,8 @@ public class CacheConstants
46 46
      * 案件 redis key
47 47
      */
48 48
     public static final String CASE_KEY = "case_codes:";
49
+    /**
50
+     * 所有用户 redis key
51
+     */
52
+    public static final String USER_KEY = "user_key:";
49 53
 }

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java Dosyayı Görüntüle

@@ -224,7 +224,7 @@ public interface MsCaseApplicationService {
224 224
      * 调解书上传到onlyoffice服务器
225 225
      * @param annexPath
226 226
      */
227
-     JSONArray uploadOnlyOffice(String annexPath);
227
+     JSONArray uploadOnlyOffice(String annexPath,Long id);
228 228
     /**
229 229
      * 案件受理
230 230
      * @param application

+ 4
- 4
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java Dosyayı Görüntüle

@@ -3755,7 +3755,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
3755 3755
        String annexPath=resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX);
3756 3756
        // 如果是调解书或者调解协议上传到onlyoffice服务器
3757 3757
         if(annexType != null   && annexType.equals(AnnexTypeEnum.MEDIATE_BOOK.getCode())){
3758
-            JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(annexPath);
3758
+            JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(annexPath,application.getId());
3759 3759
             if(jsonArray!=null && jsonArray.size() > 0){
3760 3760
                     for (Object obj : jsonArray) {
3761 3761
                         JSONObject jsonObject = (JSONObject) obj;
@@ -3784,13 +3784,13 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
3784 3784
      */
3785 3785
     @Override
3786 3786
     @Transactional
3787
-    public JSONArray uploadOnlyOffice(String annexPath) {
3787
+    public JSONArray uploadOnlyOffice(String annexPath,Long caseId) {
3788 3788
         annexPath=annexPath.replace("/profile","/home/ruoyi/uploadPath");
3789 3789
         File file = new File(annexPath);
3790 3790
         if (file.exists()) {
3791 3791
            // 调用onlyoffice
3792
-//            String url = "http://121.40.189.20:9090/files/upload";
3793 3792
             try {
3793
+                onlyOfficeUrl=  onlyOfficeUrl+ "?caseId="+caseId;
3794 3794
                 Map<String, Object> params = new HashMap<>();
3795 3795
                 params.put("file", file);
3796 3796
                 String postResult = HttpUtil.post(onlyOfficeUrl, params);
@@ -3806,7 +3806,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
3806 3806
         }else {
3807 3807
             throw new ServiceException("文件不存在");
3808 3808
         }
3809
-return null;
3809
+        return null;
3810 3810
     }
3811 3811
 
3812 3812
     /**