From fdda86aca0b95da666124c29da84397aa645afc1 Mon Sep 17 00:00:00 2001 From: zjh <1084500556@qq.com> Date: 星期三, 18 十月 2023 11:55:25 +0800 Subject: [PATCH] zjh 2023/10/18--1 --- ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictSfxmController.java | 32 +++++++++++++++++++++++++++----- 1 files changed, 27 insertions(+), 5 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 f368421..3ebd1df 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 @@ -1,18 +1,19 @@ package com.ltkj.web.controller.system; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; import javax.annotation.Resource; 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; @@ -41,6 +42,10 @@ private IDictSfxmService dictSfxmService; @Resource private IDictHospService dictHospService; + @Resource + private RedisCache redisCache; + @Resource + private TjAsyncService asyncService; /** * 鏌ヨ鏀惰垂椤圭洰鍒楄〃 @@ -50,6 +55,11 @@ @ApiOperation(value = "鏌ヨ") public TableDataInfo list(DictSfxm dictSfxm) { startPage(); + String pym = dictSfxm.getPym(); + if(null !=pym && !"".equals(pym)) { + pym=dictSfxm.getPym().toUpperCase(Locale.ROOT); + dictSfxm.setPym(pym); + } List<DictSfxm> list = dictSfxmService.selectDictSfxmList(dictSfxm); if (null != list && list.size() > 0) { for (DictSfxm sfxm : list) { @@ -93,6 +103,8 @@ @PostMapping @ApiOperation(value = "鏂板") public AjaxResult add(@RequestBody DictSfxm dictSfxm) { + dictSfxm.setWbm(MatchUtils.toWubi(dictSfxm.getXmmc())); + dictSfxm.setPym(PinyinUtil.getFirstLetter(dictSfxm.getXmmc(),"").toUpperCase(Locale.ROOT)); return toAjax(dictSfxmService.insertDictSfxm(dictSfxm)); } @@ -122,6 +134,16 @@ @GetMapping("/getList") @ApiOperation(value = "鎸夌収椤圭洰缂栫爜鏍戝舰鏌ヨ") public AjaxResult getList() { + asyncService.getDictSfxms(); + 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) { @@ -135,7 +157,7 @@ dictSfxm.setDictSfxms(sfxms); } } - return AjaxResult.success(dictSfxms); + return dictSfxms; } -- Gitblit v1.8.0