From 7c11b241c3b16bccd1dc9ea62a16d2b5d64dbc4f Mon Sep 17 00:00:00 2001 From: CeDo <cedoogle@gmail.com> Date: 星期二, 27 四月 2021 11:32:25 +0800 Subject: [PATCH] add:微心愿状态刷新任务 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java | 33 +++++++++++++++++++++++++++------ 1 files changed, 27 insertions(+), 6 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java index c1e9169..2fe7b0d 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java @@ -28,7 +28,9 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -45,6 +47,10 @@ private ComShopGoodsDAO shopGoodsDAO; @Resource private ComShopGoodsAttrDAO comShopGoodsAttrDAO; + @Resource + private ComShopOrderService orderService; + @Resource + private UserService userService; /** * 查询店铺列表 * @@ -56,13 +62,28 @@ public R pageStoreList(PageComShopStoreDTO pageComShopStoreDTO) { Page page = new Page<>(pageComShopStoreDTO.getPageNum(), pageComShopStoreDTO.getPageSize()); IPage<PageShopStoreVO> comShopStoreVOIPage = this.baseMapper.pageShopStore(page, pageComShopStoreDTO); + if(comShopStoreVOIPage!=null){ + Optional.ofNullable(comShopStoreVOIPage.getRecords()).orElse(new ArrayList<>()).forEach(shopStoreVO ->{ + List<Integer> notDoneOrderStatus = new ArrayList<>(); + notDoneOrderStatus.add(1); + notDoneOrderStatus.add(2); + notDoneOrderStatus.add(3); + notDoneOrderStatus.add(4); + Integer orderCount = orderService.getBaseMapper() + .selectCount(new LambdaQueryWrapper<ComShopOrderDO>() + .eq(ComShopOrderDO::getStoreId, shopStoreVO.getId()) + .eq(ComShopOrderDO::getDeleteStatus, 1) + .in(ComShopOrderDO::getStatus, notDoneOrderStatus) + ); + if(orderCount==null || orderCount.intValue() <= 0){ + shopStoreVO.setOrderDone(true); + }else{ + shopStoreVO.setOrderDone(false); + } + }); + } return R.ok(comShopStoreVOIPage); } - - @Resource - private UserService userService; - @Resource - private ComShopOrderService orderService; /** * 查询店铺详情 @@ -200,7 +221,7 @@ .filter(order -> order.getStatus() < ComShopOrderDO.status.dpj) .collect(Collectors.toList()); if(!filterOrder.isEmpty()){ - return R.fail("店铺下还有订单未完成"); + return R.fail("该商家还有订单未完成,不能删除"); } //删除商家下的订单 comShopOrderDOS.forEach(order->{ -- Gitblit v1.7.1