From bd6f2e5aef6762cb918933bca0dc927d50ba404a Mon Sep 17 00:00:00 2001 From: zjh <1084500556@qq.com> Date: 星期四, 20 六月 2024 16:50:50 +0800 Subject: [PATCH] zjh 2024/06/20-2 --- ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java | 67 +++++++++++++++++++++++++++++---- 1 files changed, 59 insertions(+), 8 deletions(-) diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java index e263826..d71ee6b 100644 --- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java +++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java @@ -1632,14 +1632,16 @@ if (null != tbTransitionList && tbTransitionList.size() > 0) { - if (redisCache.hasKey(cardId + cusId)) { - redisCache.deleteObject(cardId + cusId); - redisCache.setCacheList(cardId + cusId, tbTransitionList); - redisCache.setCacheMapValue(cardId + cusId + "cusId", cardId + cusId, getMaps(cusId, cardId)); - } else { - redisCache.setCacheList(cardId + cusId, tbTransitionList); - redisCache.setCacheMapValue(cardId + cusId + "cusId", cardId + cusId, getMaps(cusId, cardId)); - } +// if (redisCache.hasKey(cardId + cusId)) { +// redisCache.deleteObject(cardId + cusId); +// redisCache.setCacheList(cardId + cusId, tbTransitionList); +// redisCache.setCacheMapValue(cardId + cusId + "cusId", cardId + cusId, getMaps(cusId, cardId)); +// } else { +// redisCache.setCacheList(cardId + cusId, tbTransitionList); +// redisCache.setCacheMapValue(cardId + cusId + "cusId", cardId + cusId, getMaps(cusId, cardId)); +// } + List<Map<String, Object>> map1 = getMap(cusId, cardId, tbTransitionList); + return AjaxResult.success(map1); } return AjaxResult.success(); } @@ -1950,6 +1952,55 @@ return list; } + + private List<Map<String, Object>> getMap(String cusId, String cardId,List<TbTransition> transitionList) { + +// List<TbTransition> transitionList = null; +// if (redisCache.hasKey(cardId + cusId)) { +// transitionList = redisCache.getCacheList(cardId + cusId); +// } else { +// transitionList = transitionService.getTbTransitionListByCusId(cusId, cardId); +// } + if (null == transitionList) return null; + Map<Long, List<TbTransition>> collect = transitionList.stream().collect(Collectors.groupingBy(TbTransition::getParentProId)); + List<Map<String, Object>> list = new ArrayList<>(); + for (Map.Entry<Long, List<TbTransition>> entry : collect.entrySet()) { + Map<String, Object> map = new HashMap<>(); + Long pacId = entry.getValue().get(0).getPacId(); + if (null != pacId) { + TjPackage aPackage = tjPackageService.getById(entry.getValue().get(0).getPacId()); + map.put("pacName", aPackage.getPacName()); + TjProject tjProject = projectService.getById(entry.getKey()); +// TjPackageProject project = tjPackageProjectService.getOne(new LambdaQueryWrapper<TjPackageProject>().eq(TjPackageProject::getPacId, pacId) +// .eq(TjPackageProject::getProId, entry.getKey())); + map.put("ordPrice", tjProject.getProPrice()); +// if (null != project) { +// map.put("nowPrice", project.getPriceNow()); +// } else { +// map.put("nowPrice", tjProject.getProPrice()); +// } + map.put("nowPrice", transitionService.getTbTransitionDxPriceByPac(cusId, entry.getKey(), cardId, pacId)); + } else { + map.put("pacName", "鍗曢」"); + List<TbTransition> tbTransitionList = entry.getValue(); + if (null != tbTransitionList && tbTransitionList.size() > 0) { + BigDecimal money1 = new BigDecimal("0.00"); + BigDecimal money2 = new BigDecimal("0.00"); + for (TbTransition tbTransition : tbTransitionList) { + money1 = money1.add(tbTransition.getOrdPrice()); + money2 = money2.add(tbTransition.getNowPrice()); + } + map.put("ordPrice", money1); + map.put("nowPrice", money2); + } + } + map.put("parentName", projectService.getById(entry.getKey()).getProName()); + map.put("list", entry.getValue()); + list.add(map); + } + return list; + } + private AjaxResult getAjaxResult(String tjNumber) { LambdaQueryWrapper<TjOrder> wq0 = new LambdaQueryWrapper<>(); wq0.eq(TjOrder::getTjNumber, tjNumber); -- Gitblit v1.8.0