18792927508 2 лет назад
Родитель
Сommit
1cece4a0d1

+ 17
- 0
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java Просмотреть файл

1
 package com.ruoyi;
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
 import org.springframework.boot.SpringApplication;
9
 import org.springframework.boot.SpringApplication;
4
 import org.springframework.boot.autoconfigure.SpringBootApplication;
10
 import org.springframework.boot.autoconfigure.SpringBootApplication;
5
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
11
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
6
 import org.springframework.scheduling.annotation.EnableScheduling;
12
 import org.springframework.scheduling.annotation.EnableScheduling;
7
 import springfox.documentation.swagger2.annotations.EnableSwagger2;
13
 import springfox.documentation.swagger2.annotations.EnableSwagger2;
8
 
14
 
15
+import java.util.List;
16
+
9
 /**
17
 /**
10
  * 启动程序
18
  * 启动程序
11
  * 
19
  * 
30
                 " |  | \\ `'   /|   `-'  /           \n" +
38
                 " |  | \\ `'   /|   `-'  /           \n" +
31
                 " |  |  \\    /  \\      /           \n" +
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 Просмотреть файл

46
      * 案件 redis key
46
      * 案件 redis key
47
      */
47
      */
48
     public static final String CASE_KEY = "case_codes:";
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 Просмотреть файл

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

+ 4
- 4
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java Просмотреть файл

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