From 46733c602083084fba0e17e7d9d9ec2941a51819 Mon Sep 17 00:00:00 2001
From: lige <bestlige@outlook.com>
Date: 星期三, 18 十月 2023 14:01:02 +0800
Subject: [PATCH] 体检报告

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictSfxmController.java |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictSfxmController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictSfxmController.java
index 2d63f33..7f40fd8 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictSfxmController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictSfxmController.java
@@ -6,12 +6,14 @@
 import javax.servlet.http.HttpServletResponse;
 
 import cn.hutool.extra.pinyin.PinyinUtil;
+import com.ltkj.common.core.redis.RedisCache;
 import com.ltkj.framework.config.MatchUtils;
 import com.ltkj.hosp.domain.DictHosp;
 import com.ltkj.hosp.domain.DictSfxm;
 import com.ltkj.hosp.domain.TjCustomer;
 import com.ltkj.hosp.service.IDictHospService;
 import com.ltkj.hosp.service.IDictSfxmService;
+import com.ltkj.hosp.service.TjAsyncService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -40,6 +42,10 @@
     private IDictSfxmService dictSfxmService;
     @Resource
     private IDictHospService dictHospService;
+    @Resource
+    private RedisCache redisCache;
+    @Resource
+    private TjAsyncService asyncService;
 
     /**
      * 鏌ヨ鏀惰垂椤圭洰鍒楄〃
@@ -97,6 +103,7 @@
     @PostMapping
     @ApiOperation(value = "鏂板")
     public AjaxResult add(@RequestBody DictSfxm dictSfxm) {
+        asyncService.getDictSfxms();
         dictSfxm.setWbm(MatchUtils.toWubi(dictSfxm.getXmmc()));
         dictSfxm.setPym(PinyinUtil.getFirstLetter(dictSfxm.getXmmc(),"").toUpperCase(Locale.ROOT));
         return toAjax(dictSfxmService.insertDictSfxm(dictSfxm));
@@ -110,6 +117,7 @@
     @PutMapping
     @ApiOperation(value = "淇敼")
     public AjaxResult edit(@RequestBody DictSfxm dictSfxm) {
+        asyncService.getDictSfxms();
         return toAjax(dictSfxmService.updateDictSfxm(dictSfxm));
     }
 
@@ -121,6 +129,7 @@
     @DeleteMapping("/{ids}")
     @ApiOperation(value = "鍒犻櫎")
     public AjaxResult remove(@PathVariable Long[] ids) {
+        asyncService.getDictSfxms();
         return toAjax(dictSfxmService.deleteDictSfxmByIds(ids));
     }
 
@@ -128,6 +137,15 @@
     @GetMapping("/getList")
     @ApiOperation(value = "鎸夌収椤圭洰缂栫爜鏍戝舰鏌ヨ")
     public AjaxResult getList() {
+        if(redisCache.hasKey("getDictSfxms")){
+            List<DictSfxm> getDictSfxms = redisCache.getCacheList("getDictSfxms");
+            return AjaxResult.success(getDictSfxms);
+        }
+        List<DictSfxm> dictSfxms = getDictSfxms();
+        return AjaxResult.success(dictSfxms);
+    }
+
+    private List<DictSfxm> getDictSfxms() {
         List<DictSfxm> dictSfxms = dictSfxmService.getYjDictSfxmList();
         if (null != dictSfxms && dictSfxms.size() > 0) {
             for (DictSfxm dictSfxm : dictSfxms) {
@@ -141,7 +159,7 @@
                 dictSfxm.setDictSfxms(sfxms);
             }
         }
-        return AjaxResult.success(dictSfxms);
+        return dictSfxms;
     }
 
 

--
Gitblit v1.8.0