From e938911e4a12aa70c01036bf439ab13765665e99 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Sat, 17 Aug 2024 10:03:11 +0800 Subject: [PATCH 1/9] =?UTF-8?q?1.=E4=BB=A3=E5=AE=A2=E4=B8=8B=E5=8D=95=20?= =?UTF-8?q?=E6=8C=82=E8=B5=B7=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/product/TbPlaceController.java | 5 ++-- .../mybatis/mapper/TbCashierCartMapper.java | 5 ++++ .../impl/shopimpl/TbShopTableServiceImpl.java | 26 ++++++++++++++++--- .../service/shop/TbShopTableService.java | 2 +- .../cn/ysk/cashier/vo/PendingCountVO.java | 14 ++++++++++ 5 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/vo/PendingCountVO.java diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java index 118f6870..154dd508 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java @@ -96,9 +96,10 @@ public class TbPlaceController { @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size, @RequestParam Integer shopId, - @RequestParam(required = false) Integer vipUserId + @RequestParam(required = false) Integer vipUserId, + @RequestParam String masterId ) { - return ResponseEntity.ok(tbShopTableService.getCart(tableId, page, size, shopId, vipUserId)); + return ResponseEntity.ok(tbShopTableService.getCart(tableId, page, size, shopId, vipUserId, masterId)); } @AnonymousAccess diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbCashierCartMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbCashierCartMapper.java index b0056e9f..236e460d 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbCashierCartMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbCashierCartMapper.java @@ -3,6 +3,7 @@ package cn.ysk.cashier.mybatis.mapper; import cn.ysk.cashier.mybatis.entity.Activate; import cn.ysk.cashier.pojo.order.TbCashierCart; import cn.ysk.cashier.vo.CarVO; +import cn.ysk.cashier.vo.PendingCountVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @@ -18,4 +19,8 @@ public interface TbCashierCartMapper extends BaseMapper { " ifnull(sum(total_amount),0) as totalAmount\n" + " from tb_cashier_cart where table_id is not null and shop_id = #{shopId} and status = 'refund' group by shop_Id, master_id order by trade_day desc") List selectCar(@Param("shopId") Integer shopId); + + @Select(" SELECT order_id orderId, pending_at, sum(total_amount) toalAmount, count(id) totalCount from tb_cashier_cart where status = 'refund' and shop_id=#{shopId} " + + " GROUP BY order_id ORDER BY trade_day") + List countPending(@Param("shopId") Integer shopId); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 19344eab..1938bec8 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -41,6 +41,7 @@ import cn.ysk.cashier.repository.product.TbProductRepository; import cn.ysk.cashier.repository.product.TbProductSkuRepository; import cn.ysk.cashier.repository.shop.TbShopInfoRepository; import cn.ysk.cashier.utils.*; +import cn.ysk.cashier.vo.PendingCountVO; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; @@ -395,7 +396,8 @@ public class TbShopTableServiceImpl implements TbShopTableService { } @Override - public com.baomidou.mybatisplus.extension.plugins.pagination.Page getCart(Long tableId, Integer page, Integer size, Integer shopId, Integer vipUserId) { + public com.baomidou.mybatisplus.extension.plugins.pagination.Page getCart(Long tableId, Integer page, + Integer size, Integer shopId, Integer vipUserId, String masterId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() .eq(TbCashierCart::getTableId, tableId) .eq(TbCashierCart::getStatus, "create") @@ -404,6 +406,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { if (vipUserId != null) { queryWrapper.eq(TbCashierCart::getUserId, vipUserId); }else { + queryWrapper.eq(TbCashierCart::getMasterId, masterId); queryWrapper.isNull(TbCashierCart::getUserId); } @@ -643,7 +646,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { } else { orderCode = String.valueOf(Integer.parseInt(code.replace("#", "")) + 1); } - redisTemplate.opsForValue().set("SHOP:CODE:" + clientType + ":" + shopId + ":" + day, "#" + Integer.parseInt(code.replace("#", "")) + 2); + redisTemplate.opsForValue().set("SHOP:CODE:" + clientType + ":" + shopId + ":" + day, String.valueOf(Integer.parseInt(orderCode) + 1)); boolean flag = Boolean.TRUE.equals(redisTemplate.opsForValue().setIfAbsent("SHOP:CODE:SET" + clientType + ":" + shopId + ":" + day, orderCode)); if (flag) { return generateOrderCode(day, clientType, shopId); @@ -872,7 +875,24 @@ public class TbShopTableServiceImpl implements TbShopTableService { @Override public Object getCar(Integer shopId) { - return cashierCartMapper.selectCar(shopId); + ArrayList> data = new ArrayList<>(); + + List pendingCountVOS = cashierCartMapper.countPending(shopId); + List tbCashierCarts = cashierCartMapper.selectList(new LambdaQueryWrapper() + .eq(TbCashierCart::getShopId, shopId) + .eq(TbCashierCart::getStatus, "refund")); + + HashMap> cashierMap = new HashMap<>(); + for (TbCashierCart tbCashierCart : tbCashierCarts) { + List list = cashierMap.computeIfAbsent(tbCashierCart.getOrderId().toString(), k -> new ArrayList<>()); + list.add(tbCashierCart); + } + + pendingCountVOS.forEach(item -> { + Map map = BeanUtil.beanToMap(item, false, false); + map.put("carList", cashierMap.get(item.getOrderId().toString())); + }); + return data; } @Override diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopTableService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopTableService.java index 00e4c62c..23ce9f60 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopTableService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopTableService.java @@ -102,7 +102,7 @@ public interface TbShopTableService { void clearCart(ClearCartDTO clearCartDTO); - Page getCart(Long tableId, Integer page, Integer size, Integer shopId, Integer vipUserId); + Page getCart(Long tableId, Integer page, Integer size, Integer shopId, Integer vipUserId, String masterId); TbCashierCart updateCart(UpdateCartDTO updateCartDTO); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/vo/PendingCountVO.java b/eladmin-system/src/main/java/cn/ysk/cashier/vo/PendingCountVO.java new file mode 100644 index 00000000..47c673e3 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/vo/PendingCountVO.java @@ -0,0 +1,14 @@ +package cn.ysk.cashier.vo; + +import lombok.Data; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +@Data +public class PendingCountVO { + private Long pendingAt; + private BigDecimal totalAmount; + private Integer totalCount; + private Integer orderId; +} From a53e9f7ab44e9de9ecbcb2a9aaba2b8b12ec8764 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Sat, 17 Aug 2024 11:49:01 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E8=B5=A0=E9=80=81=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ysk/cashier/mybatis/entity/Activate.java | 25 ++++++++++++++++ .../mybatis/mapper/ActivateMapper.java | 1 - .../mybatis/mapper/TbCashierCartMapper.java | 1 - .../mybatis/rest/StorageController.java | 12 ++++++-- .../cashier/mybatis/service/ShopService.java | 20 ++++--------- .../mybatis/service/impl/ShopServiceImpl.java | 29 +++++++++---------- 6 files changed, 53 insertions(+), 35 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/Activate.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/Activate.java index 47efc722..8252f2fa 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/Activate.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/Activate.java @@ -1,13 +1,19 @@ package cn.ysk.cashier.mybatis.entity; +import cn.ysk.cashier.utils.ListUtil; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.activerecord.Model; import lombok.Data; import lombok.EqualsAndHashCode; +import org.apache.commons.lang3.StringUtils; +import org.springframework.util.CollectionUtils; import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; @Data @EqualsAndHashCode(callSuper = true) @@ -23,6 +29,25 @@ public class Activate extends Model { private String handselType; private String isDel; private String isUser; + //是否赠送商品 0否 1是 + private Integer isGiftPro; + private String productIds; + @TableField(exist = false) + private List prodIds; + public void setProductIds(String productIds) { + this.productIds = productIds; + if(StringUtils.isNotBlank(productIds)){ + prodIds=ListUtil.stringChangeIntegerList(productIds); + } + } + public void setProdIds(List prodIds) { + this.prodIds = prodIds; + if(!CollectionUtils.isEmpty(prodIds)){ + productIds="["+prodIds.stream() + .map(String::valueOf) + .collect(Collectors.joining(","))+"]"; + } + } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ActivateMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ActivateMapper.java index 813f54a0..cadddeab 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ActivateMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ActivateMapper.java @@ -1,7 +1,6 @@ package cn.ysk.cashier.mybatis.mapper; import cn.ysk.cashier.mybatis.entity.Activate; -import cn.ysk.cashier.mybatis.entity.TbUserStorage; import com.baomidou.mybatisplus.core.mapper.BaseMapper; public interface ActivateMapper extends BaseMapper { diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbCashierCartMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbCashierCartMapper.java index b0056e9f..913b703d 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbCashierCartMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbCashierCartMapper.java @@ -1,6 +1,5 @@ package cn.ysk.cashier.mybatis.mapper; -import cn.ysk.cashier.mybatis.entity.Activate; import cn.ysk.cashier.pojo.order.TbCashierCart; import cn.ysk.cashier.vo.CarVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/rest/StorageController.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/rest/StorageController.java index c91459eb..a9fefcc7 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/rest/StorageController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/rest/StorageController.java @@ -2,7 +2,6 @@ package cn.ysk.cashier.mybatis.rest; import cn.hutool.core.io.IoUtil; import cn.hutool.http.HttpUtil; -import cn.ysk.cashier.annotation.rest.AnonymousPostMapping; import cn.ysk.cashier.domain.QiniuContent; import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.mybatis.entity.Activate; @@ -14,6 +13,7 @@ import cn.ysk.cashier.utils.SecurityUtils; import com.alibaba.fastjson.JSONObject; import com.google.gson.JsonObject; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -23,9 +23,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import java.io.InputStream; -import java.util.HashMap; import java.util.Map; -import java.util.concurrent.TimeUnit; @Slf4j @RestController @@ -50,11 +48,19 @@ public class StorageController { } @PostMapping("/modityActivate") public ResponseEntity modityActivate(@RequestBody Activate activate){ + if (activate.getIsGiftPro() != null && activate.getIsGiftPro() == 1 && CollectionUtils.isEmpty(activate.getProdIds())) + throw new BadRequestException("赠送商品不可为空"); String userName = SecurityUtils.getCurrentUsername(); shopService.modityActivate(activate); return new ResponseEntity<>(HttpStatus.OK); } + @GetMapping("/activate/{activateId}") + @ApiOperation("查询活动赠送商品") + public ResponseEntity queryActivatePros(@PathVariable("activateId") Integer activateId){ + return new ResponseEntity<>(shopService.findActivatePros(activateId),HttpStatus.OK); + } + /** * @param params * shopId 必填 diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/ShopService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/ShopService.java index ccd5c489..93a8462d 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/ShopService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/ShopService.java @@ -1,24 +1,12 @@ -/* -* Copyright 2019-2020 Zheng Jie -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ package cn.ysk.cashier.mybatis.service; import cn.ysk.cashier.mybatis.entity.Activate; import cn.ysk.cashier.mybatis.entity.StorageVo; +import cn.ysk.cashier.pojo.product.TbProduct; import org.springframework.data.domain.Pageable; +import java.util.List; + /** * @website https://eladmin.vip * @description 服务接口 @@ -36,4 +24,6 @@ public interface ShopService { Object findActivate(String shopId); void modityActivate(Activate activate); + + List findActivatePros(Integer activate); } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/ShopServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/ShopServiceImpl.java index 704ca82b..485d762c 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/ShopServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/ShopServiceImpl.java @@ -1,23 +1,10 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ package cn.ysk.cashier.mybatis.service.impl; import cn.ysk.cashier.mybatis.entity.Activate; import cn.ysk.cashier.mybatis.mapper.*; +import cn.ysk.cashier.pojo.product.TbProduct; import cn.ysk.cashier.pojo.shop.TbMerchantAccount; +import cn.ysk.cashier.repository.product.TbProductRepository; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -30,6 +17,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import java.util.*; @@ -50,6 +38,8 @@ public class ShopServiceImpl implements ShopService { private TbProducSkutMapper producSkutMapper; @Autowired private ActivateMapper activateMapper; + @Autowired + private TbProductRepository tbProductRepository; @Override public Object findStorage(Integer shopId, String account, Pageable pageable) { QueryWrapper queryWrapper = new QueryWrapper<>(); @@ -139,4 +129,13 @@ public class ShopServiceImpl implements ShopService { activateMapper.insert(activate); } } + + @Override + public List findActivatePros(Integer activateId) { + Activate activate = activateMapper.selectById(activateId); + if (!CollectionUtils.isEmpty(activate.getProdIds())){ + return tbProductRepository.findByIds(activate.getProdIds()); + } + return new ArrayList<>(); + } } \ No newline at end of file From df95c09724b857ad6eaed59bcdcc1560e0e0db32 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Sat, 17 Aug 2024 14:15:12 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/ysk/cashier/mybatis/mapper/ShopUserMapper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ShopUserMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ShopUserMapper.java index 0d6fa038..7aeff932 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ShopUserMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ShopUserMapper.java @@ -27,9 +27,10 @@ public interface ShopUserMapper extends BaseMapper { " or u.telephone like concat('%', #{param.name}, '%') or su.telephone like concat('%', #{param.name}, '%'))" + "" + "" + - "AND su.is_vip=#{isVip}" + + "AND su.is_vip=#{isVip} " + "" + "" + + "order by su.created_at" + "") IPage queryUser(TbShopUserQueryCriteria param, Integer isVip, Page pageInfo); From 1de1edb5372ef82638c55c1f8489200ccd8d6285 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Sat, 17 Aug 2024 14:38:00 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E5=88=86=E7=BB=84=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E7=AE=A1=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/ysk/cashier/dto/product/TbProductGroupDto.java | 11 ----------- .../impl/productimpl/TbProductGroupServiceImpl.java | 6 +----- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductGroupDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductGroupDto.java index 3c6d5e75..5bb4eeba 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductGroupDto.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductGroupDto.java @@ -54,15 +54,4 @@ public class TbProductGroupDto implements Serializable { private String saleStartTime; private String saleEndTime; - - public void upSaleEndTime() { - if (useTime != null && useTime == 1) { - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm"); - LocalTime startTime = LocalTime.parse(saleStartTime, formatter); - LocalTime endTime = LocalTime.parse(saleEndTime, formatter); - if (endTime.isBefore(startTime)) { - saleEndTime = "次日 " + saleEndTime; - } - } - } } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductGroupServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductGroupServiceImpl.java index 0b4215bd..93efc746 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductGroupServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductGroupServiceImpl.java @@ -58,11 +58,7 @@ public class TbProductGroupServiceImpl implements TbProductGroupService { PageRequest sort = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("sort")); Page page = tbProductGroupRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),sort); - Page map = page.map(tbProductGroupMapper::toDto); - map.getContent().forEach(s->{ - s.upSaleEndTime(); - }); - return PageUtil.toPage(map); + return PageUtil.toPage(page.map(tbProductGroupMapper::toDto)); } @Override From 89582d3bc8e65c2f049608cb93156eaccf6c470c Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Sat, 17 Aug 2024 15:21:45 +0800 Subject: [PATCH 5/9] =?UTF-8?q?1.=E4=BB=A3=E5=AE=A2=E4=B8=8B=E5=8D=95=20?= =?UTF-8?q?=E6=8C=82=E8=B5=B7=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ysk/cashier/dto/shoptable/PendingDTO.java | 1 + .../mybatis/mapper/TbCashierCartMapper.java | 6 +++- .../impl/shopimpl/TbShopTableServiceImpl.java | 28 +++++++++++++------ .../cn/ysk/cashier/vo/PendingCountVO.java | 1 + .../cn/ysk/cashier/vo/TbCashierCartVO.java | 11 ++++++++ 5 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/vo/TbCashierCartVO.java diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/PendingDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/PendingDTO.java index 773e3af5..7bfbedf3 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/PendingDTO.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/PendingDTO.java @@ -17,4 +17,5 @@ public class PendingDTO { private Integer vipUserId; @NotNull private Boolean isPending; + private Integer orderId; } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbCashierCartMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbCashierCartMapper.java index 236e460d..cda17036 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbCashierCartMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbCashierCartMapper.java @@ -4,6 +4,7 @@ import cn.ysk.cashier.mybatis.entity.Activate; import cn.ysk.cashier.pojo.order.TbCashierCart; import cn.ysk.cashier.vo.CarVO; import cn.ysk.cashier.vo.PendingCountVO; +import cn.ysk.cashier.vo.TbCashierCartVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @@ -20,7 +21,10 @@ public interface TbCashierCartMapper extends BaseMapper { " from tb_cashier_cart where table_id is not null and shop_id = #{shopId} and status = 'refund' group by shop_Id, master_id order by trade_day desc") List selectCar(@Param("shopId") Integer shopId); - @Select(" SELECT order_id orderId, pending_at, sum(total_amount) toalAmount, count(id) totalCount from tb_cashier_cart where status = 'refund' and shop_id=#{shopId} " + + @Select(" SELECT order_id orderId, pending_at, sum(total_amount) totalAmount, count(id) totalCount, count(total_number) totalNumber from tb_cashier_cart where status = 'refund' and shop_id=#{shopId} " + " GROUP BY order_id ORDER BY trade_day") List countPending(@Param("shopId") Integer shopId); + + @Select("select a.*, b.spec_snap from tb_cashier_cart as a left join tb_product_sku as b on a.sku_id=b.id where a.shop_id=#{shopId} and a.status='refund';") + List selectPending(Integer shopId); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 1938bec8..67d93221 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -822,14 +822,23 @@ public class TbShopTableServiceImpl implements TbShopTableService { @Override public Object pending(PendingDTO pendingDTO) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() - .eq(TbCashierCart::getShopId, pendingDTO.getShopId()) - .eq(TbCashierCart::getTableId, pendingDTO.getTableId()) - .eq(TbCashierCart::getStatus, "create"); - if (pendingDTO.getVipUserId() != null) { - queryWrapper.eq(TbCashierCart::getUserId, pendingDTO.getVipUserId()); + .eq(TbCashierCart::getShopId, pendingDTO.getShopId()); + + if (!pendingDTO.getIsPending()) { + if (pendingDTO.getOrderId() == null) { + throw new BadRequestException("取消挂起订单id不为空"); + } + queryWrapper.eq(TbCashierCart::getOrderId, pendingDTO.getOrderId()); }else { - queryWrapper.eq(TbCashierCart::getMasterId, pendingDTO.getMasterId()) - .isNull(TbCashierCart::getUserId); + queryWrapper.eq(TbCashierCart::getTableId, pendingDTO.getTableId()) + .eq(TbCashierCart::getStatus, "create"); + if (pendingDTO.getVipUserId() != null) { + queryWrapper.eq(TbCashierCart::getUserId, pendingDTO.getVipUserId()); + }else { + queryWrapper.eq(TbCashierCart::getMasterId, pendingDTO.getMasterId()) + .isNull(TbCashierCart::getUserId); + } + } List cashierCarts = cashierCartMapper .selectList(queryWrapper); @@ -875,13 +884,15 @@ public class TbShopTableServiceImpl implements TbShopTableService { @Override public Object getCar(Integer shopId) { - ArrayList> data = new ArrayList<>(); + ArrayList> data = new ArrayList<>(); List pendingCountVOS = cashierCartMapper.countPending(shopId); List tbCashierCarts = cashierCartMapper.selectList(new LambdaQueryWrapper() .eq(TbCashierCart::getShopId, shopId) .eq(TbCashierCart::getStatus, "refund")); + cashierCartMapper.selectPending(shopId); + HashMap> cashierMap = new HashMap<>(); for (TbCashierCart tbCashierCart : tbCashierCarts) { List list = cashierMap.computeIfAbsent(tbCashierCart.getOrderId().toString(), k -> new ArrayList<>()); @@ -891,6 +902,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { pendingCountVOS.forEach(item -> { Map map = BeanUtil.beanToMap(item, false, false); map.put("carList", cashierMap.get(item.getOrderId().toString())); + data.add(map); }); return data; } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/vo/PendingCountVO.java b/eladmin-system/src/main/java/cn/ysk/cashier/vo/PendingCountVO.java index 47c673e3..43bcf404 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/vo/PendingCountVO.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/vo/PendingCountVO.java @@ -10,5 +10,6 @@ public class PendingCountVO { private Long pendingAt; private BigDecimal totalAmount; private Integer totalCount; + private Integer totalNumber; private Integer orderId; } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbCashierCartVO.java b/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbCashierCartVO.java new file mode 100644 index 00000000..5268c775 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbCashierCartVO.java @@ -0,0 +1,11 @@ +package cn.ysk.cashier.vo; + +import cn.ysk.cashier.pojo.order.TbCashierCart; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class TbCashierCartVO extends TbCashierCart { + private String specSnap; +} From b13a48d5e5b13c21a73c9aba518bf8d66ecb1d9b Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Sat, 17 Aug 2024 16:49:18 +0800 Subject: [PATCH 6/9] =?UTF-8?q?1.=E5=95=86=E5=93=81=E4=B8=8D=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ysk/cashier/service/impl/productimpl/StockServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/StockServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/StockServiceImpl.java index 3f49b4c4..f4fe27b4 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/StockServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/StockServiceImpl.java @@ -365,7 +365,8 @@ public class StockServiceImpl implements StockService { break; case "pauseSale": sqlQuery.append(" set is_pause_sale = ").append(updateValueVO.getUpdateValue()); - TbProduct product1 = tbProductRepository.selectBySkuId(Integer.valueOf(updateValueVO.getTargetId())); + TbProduct product1 = tbProductRepository.getById(Integer.valueOf(updateValueVO.getTargetId())); + // 推送微信操作消息 if (product1 != null) { wxMsgUtils.aboardOperationMsg(("0".equals(updateValueVO.getUpdateValue()) ? "关闭售罄: " : "开启售罄: ") + product1.getName(), Integer.valueOf(updateValueVO.getShopId())); From 7da10ca43e0b4ae43289512552565669629f7185 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Sat, 17 Aug 2024 17:37:06 +0800 Subject: [PATCH 7/9] =?UTF-8?q?1.=E4=BB=A3=E5=AE=A2=E4=B8=8B=E5=8D=95?= =?UTF-8?q?=E6=8C=82=E5=8D=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/ysk/cashier/dto/shoptable/PendingDTO.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/PendingDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/PendingDTO.java index 7bfbedf3..f6720c7f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/PendingDTO.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/PendingDTO.java @@ -8,11 +8,9 @@ import javax.validation.constraints.NotNull; @Data public class PendingDTO { - @NotEmpty private String masterId; @NotNull private Integer shopId; - @NotNull private Long tableId; private Integer vipUserId; @NotNull From 9b8ec56b96a9380801e854428bdd32171f23c55e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=89=9B=E5=8F=89=E9=97=AA=E9=97=AA?= <18322780655@163.com> Date: Sat, 17 Aug 2024 18:25:03 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=80=97=E6=9D=90?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=8D=95=E4=BB=B7=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/ysk/cashier/cons/domain/ViewConInfoFlow.java | 5 +++++ .../cn/ysk/cashier/cons/service/dto/ViewConInfoFlowDto.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/ViewConInfoFlow.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/ViewConInfoFlow.java index d15646af..a9167784 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/ViewConInfoFlow.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/ViewConInfoFlow.java @@ -75,6 +75,11 @@ public class ViewConInfoFlow implements Serializable { private BigDecimal balance; + @Column(name = "`status`",nullable = false) + @ApiModelProperty(value = "status") + private String status; + + @Column(name = "`product_id`") @ApiModelProperty(value = "商品id") diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConInfoFlowDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConInfoFlowDto.java index 3b35c877..6e5e19ed 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConInfoFlowDto.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConInfoFlowDto.java @@ -50,7 +50,7 @@ public class ViewConInfoFlowDto implements Serializable { private String productId; private String productName; - + private String status; private String conCode; From 085ae733e296aa1fed602d8a57c97b868403ce5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=89=9B=E5=8F=89=E9=97=AA=E9=97=AA?= <18322780655@163.com> Date: Sat, 17 Aug 2024 18:33:35 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=80=97=E6=9D=90?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=8D=95=E4=BB=B7=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/ysk/cashier/cons/domain/ViewConInfoFlow.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/ViewConInfoFlow.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/ViewConInfoFlow.java index a9167784..a5848254 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/ViewConInfoFlow.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/ViewConInfoFlow.java @@ -75,7 +75,7 @@ public class ViewConInfoFlow implements Serializable { private BigDecimal balance; - @Column(name = "`status`",nullable = false) + @Column(name = "`status`") @ApiModelProperty(value = "status") private String status;