From 0a469fa5898ac2b63b860d17ac10c0ebf534d82f Mon Sep 17 00:00:00 2001 From: zjh <1084500556@qq.com> Date: 星期五, 27 六月 2025 17:49:38 +0800 Subject: [PATCH] zjh20250627 --- ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictSfxmController.java | 89 ++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 80 insertions(+), 9 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..e273ca2 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,16 @@ import javax.servlet.http.HttpServletResponse; import cn.hutool.extra.pinyin.PinyinUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.domain.TjOrder; 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,22 +44,26 @@ private IDictSfxmService dictSfxmService; @Resource private IDictHospService dictHospService; + @Resource + private RedisCache redisCache; + @Resource + private TjAsyncService asyncService; /** * 鏌ヨ鏀惰垂椤圭洰鍒楄〃 */ // @PreAuthorize("@ss.hasPermi('system:sfxm:list')") - @GetMapping("/list") + @PostMapping("/list") @ApiOperation(value = "鏌ヨ") - public TableDataInfo list(DictSfxm dictSfxm) { + public TableDataInfo list(@RequestBody DictSfxm dictSfxm) { startPage(); String pym = dictSfxm.getPym(); - if(null !=pym && !"".equals(pym)) { + if(null !=pym && !pym.isEmpty()) { pym=dictSfxm.getPym().toUpperCase(Locale.ROOT); dictSfxm.setPym(pym); } List<DictSfxm> list = dictSfxmService.selectDictSfxmList(dictSfxm); - if (null != list && list.size() > 0) { + if (null != list && !list.isEmpty()) { for (DictSfxm sfxm : list) { DictHosp hosp = dictHospService.getById(sfxm.getYqid()); if (null != hosp) { @@ -97,6 +105,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 +119,7 @@ @PutMapping @ApiOperation(value = "淇敼") public AjaxResult edit(@RequestBody DictSfxm dictSfxm) { + asyncService.getDictSfxms(); return toAjax(dictSfxmService.updateDictSfxm(dictSfxm)); } @@ -121,6 +131,7 @@ @DeleteMapping("/{ids}") @ApiOperation(value = "鍒犻櫎") public AjaxResult remove(@PathVariable Long[] ids) { + asyncService.getDictSfxms(); return toAjax(dictSfxmService.deleteDictSfxmByIds(ids)); } @@ -128,6 +139,15 @@ @GetMapping("/getList") @ApiOperation(value = "鎸夌収椤圭洰缂栫爜鏍戝舰鏌ヨ") public AjaxResult getList() { + if(redisCache.hasKey("getDictSfxms")){ + List<DictSfxm> getDictSfxms = redisCache.getCacheObject("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 +161,7 @@ dictSfxm.setDictSfxms(sfxms); } } - return AjaxResult.success(dictSfxms); + return dictSfxms; } @@ -158,7 +178,7 @@ Map<String, Object> map = new HashMap<>(); if (null != xmbm && xmbm.length() == 2) { List<DictSfxm> sfxms = dictSfxmService.getEjDictSfxmList(service.getId()); - if (null != sfxms && sfxms.size() > 0) { + if (null != sfxms && !sfxms.isEmpty()) { for (DictSfxm sfxm : sfxms) { List<DictSfxm> sfx = dictSfxmService.getSjDictSfxmList(service.getId()); sfxm.setDictSfxms(sfx); @@ -168,24 +188,75 @@ map.put("date", sfxmList); map.put("total", sfxms.size()); } else { - map.put("date", 0); + map.put("date", null); map.put("total", 0); } return AjaxResult.success(map); } if (null != xmbm && xmbm.length() == 4) { List<DictSfxm> sfx = dictSfxmService.getSjDictSfxmList(service.getId()); - if (null != sfx && sfx.size() > 0) { + if (null != sfx && !sfx.isEmpty()) { List<DictSfxm> sfxmList = sfx.stream().skip((long) (page - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); + if (!sfxmList.isEmpty()) { + for (DictSfxm sfxm : sfxmList) { + DictHosp hosp = dictHospService.getById(sfxm.getYqid()); + if (null != hosp) { + sfxm.setYqName(hosp.getHospAreaName()); + } + } + } Collections.reverse(sfxmList); map.put("date", sfxmList); map.put("total", sfx.size()); } else { - map.put("date", 0); + map.put("date", null); map.put("total", 0); } return AjaxResult.success(map); } return AjaxResult.success(map); } + + +// /** +// * 鏌ヨ鏀惰垂椤圭洰鍒楄〃 +// */ +// @PostMapping("/getSfxmList") +// @ApiOperation(value = "鏌ヨ") +// public AjaxResult getSfxmList(@ApiParam(value = "椤电爜鏁�(榛樿1)") @RequestParam(defaultValue = "1") Integer page, +// @ApiParam(value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam(defaultValue = "10") Integer pageSize, +// @ApiParam(value = "鎷奸煶鐮�") @RequestParam(required = false) String pym, +// @ApiParam(value = "鍚嶇О") @RequestParam(required = false) String xmmc, +// @ApiParam(value = "id") @RequestParam(required = false) String id) { +// Map<String, Object> map = new HashMap<>(); +// List<DictSfxm> collect = null; +// LambdaQueryWrapper<DictSfxm> wq=new LambdaQueryWrapper<>(); +// if(null !=pym && !"".equals(pym)) { +// pym=pym.toUpperCase(Locale.ROOT); +// wq.like(DictSfxm::getPym,pym); +// } +// if(null !=xmmc && !"".equals(xmmc)) { +// wq.like(DictSfxm::getXmmc,xmmc); +// } +// if(null !=id && !"".equals(id)) { +// wq.like(DictSfxm::getId,id); +// } +// List<DictSfxm> list = dictSfxmService.list(wq); +// if (null != list && list.size() > 0) { +// for (DictSfxm sfxm : list) { +// DictHosp hosp = dictHospService.getById(sfxm.getYqid()); +// if (null != hosp) { +// sfxm.setYqName(hosp.getHospAreaName()); +// } +// } +// } +// collect = list.stream().skip((long) (page - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); +// if (null != collect) { +// map.put("total", collect.size()); +// } else { +// map.put("total", 0); +// } +// map.put("list", collect); +// return AjaxResult.success(map); +// } } -- Gitblit v1.8.0