瀏覽代碼

20241209_sun

15143018065 4 月之前
父節點
當前提交
391ba96ec2

+ 19 - 3
ruoyi-modules/mz-lnst/src/main/java/com/ruoyi/lnst/service/impl/ZwywLrJbxxServiceImpl.java

@@ -6,17 +6,21 @@ import cn.hutool.extra.spring.SpringUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.obs.services.ObsClient;
 import com.obs.services.model.PutObjectResult;
+import com.ruoyi.common.core.constant.CacheConstants;
 import com.ruoyi.common.core.constant.SecurityConstants;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.exception.ServiceException;
 import com.ruoyi.common.core.utils.DateUtils;
+import com.ruoyi.common.core.utils.SpringUtils;
 import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.file.FileUtils;
 import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.common.redis.service.RedisService;
 import com.ruoyi.common.security.utils.DictUtils;
 import com.ruoyi.common.security.utils.EncryptionUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
@@ -58,6 +62,7 @@ import java.math.BigDecimal;
 import java.net.ConnectException;
 import java.net.URL;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -308,7 +313,7 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
             uploadBaiduBuildOnly(zwywLrJbxx);
             zwywLrJbxx = updateZwywLrJbxxBuildOnly(zwywLrJbxx);
             zwywLrJbxx.setDjsj(DateUtils.dateTimeNow());
-            return zwywLrJbxxMapper.insert(zwywLrJbxx);
+            return insertLr(zwywLrJbxx);
         }
         // 草稿
         zwywLrJbxx.setLzzt("0");
@@ -370,6 +375,17 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
             }
         } catch (Exception ignored) {}
         zwywLrJbxx.setDjsj(DateUtils.dateTimeNow());
+        return insertLr(zwywLrJbxx);
+    }
+
+    private int insertLr(InLnstLrxx zwywLrJbxx) {
+        try {
+            String content = JSONObject.toJSONString(zwywLrJbxx, SerializerFeature.WriteNullStringAsEmpty);
+            RedisService redis = SpringUtils.getBean(RedisService.class);
+            redis.setCacheObject("mz_lrxx:" + IdUtils.simpleUUID(), content, CacheConstants.EXPIRATION_BAIDU, TimeUnit.MINUTES);
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+        }
         return zwywLrJbxxMapper.insert(zwywLrJbxx);
     }
 
@@ -428,7 +444,7 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
         shxx.setLzzt(zwywLrJbxx.getLzzt());
         insertShxx(shxx);
         zwywLrJbxx.setDjsj(DateUtils.dateTimeNow());
-        return zwywLrJbxxMapper.insert(zwywLrJbxx);
+        return insertLr(zwywLrJbxx);
     }
 
     @Transactional
@@ -543,7 +559,7 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
             }
         } catch (Exception ignored) {}
         zwywLrJbxx.setDjsj(DateUtils.dateTimeNow());
-        return zwywLrJbxxMapper.insert(zwywLrJbxx);
+        return insertLr(zwywLrJbxx);
     }
 
     /**