From 4d7e108f839dd27e42a4491c9f89307f87cb9780 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 11 Oct 2024 10:42:23 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E9=80=9A=E7=94=A8=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/shopimpl/TbShopUnitServiceImpl.java | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopUnitServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopUnitServiceImpl.java index d86d7deb..6587a680 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopUnitServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopUnitServiceImpl.java @@ -1,18 +1,3 @@ -/* -* 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.service.impl.shopimpl; import cn.ysk.cashier.dto.shop.TbShopUnitDto; @@ -38,10 +23,7 @@ import javax.persistence.criteria.Predicate; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.time.Instant; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @Service @RequiredArgsConstructor @@ -54,8 +36,12 @@ public class TbShopUnitServiceImpl implements TbShopUnitService { public Map queryAll(TbShopUnitQueryCriteria criteria, Pageable pageable) { Page page = tbShopUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> { Predicate predicate = QueryHelp.getPredicate(root, null, criteriaBuilder); - predicate = criteriaBuilder.or(predicate, criteriaBuilder.equal(root.get("shopId"), 1)); - predicate = criteriaBuilder.and(predicate, criteriaBuilder.equal(root.get("shopId"), criteria.getShopId())); + +// predicate = criteriaBuilder.and(predicate, criteriaBuilder.in(root.get("shopId")).value(criteria.getShopId()).value("1")); + predicate = criteriaBuilder.and(predicate, criteriaBuilder.or( + criteriaBuilder.equal(root.get("shopId"), criteria.getShopId()), + criteriaBuilder.equal(root.get("shopId"), "1"))); + if(StringUtils.isNotBlank(criteria.getName())){ predicate = criteriaBuilder.and(predicate, criteriaBuilder.like(root.get("name"), criteria.getName())); } From ee59a73d0268825b8339f820ad5aa7f5a409889c Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 11 Oct 2024 14:46:13 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=20=E6=8A=A5=E6=8D=9F=20=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/controller/product/TbProductController.java | 4 ++-- .../ysk/cashier/dto/product/TbProductQueryV2Criteria.java | 6 +++--- .../service/impl/productimpl/TbProductServiceImpl.java | 7 ++++++- .../impl/productimpl/TbProductStockDetailServiceImpl.java | 1 + .../cn/ysk/cashier/service/product/TbProductService.java | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductController.java index 31ef1c46..ce22ccaf 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductController.java @@ -37,8 +37,8 @@ public class TbProductController { @PostMapping("/list/v2") @ApiOperation("查询商品列表 新") - public ResponseEntity queryTbProductV2(@RequestBody TbProductQueryV2Criteria criteria, Pageable pageable){ - return new ResponseEntity<>(tbProductService.queryAllV2(criteria,pageable),HttpStatus.OK); + public ResponseEntity queryTbProductV2(@RequestBody TbProductQueryV2Criteria criteria){ + return new ResponseEntity<>(tbProductService.queryAllV2(criteria),HttpStatus.OK); } @GetMapping("/list") diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java index 48fc19d7..c7065ee5 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java @@ -67,9 +67,9 @@ public class TbProductQueryV2Criteria { @Query(type = BETWEEN) private List createdAt; -// private Integer page; -// -// private Integer size; + private Integer page; + private Integer size; + private String sort; public void setType(String type) { if(StringUtils.isNotBlank(type)){ diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java index 0895dd9a..fe48bb66 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java @@ -241,7 +241,12 @@ public class TbProductServiceImpl implements TbProductService { } @Override - public Map queryAllV2(TbProductQueryV2Criteria criteria,Pageable pageable) { + public Map queryAllV2(TbProductQueryV2Criteria criteria) { + String[] sortParams = criteria.getSort().split(","); + String sortField = sortParams[0]; + Sort.Direction sortDirection = Sort.Direction.fromString(sortParams[1]); + Sort sort = Sort.by(sortDirection, sortField); + Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort); //查询商品数据 Page page = tbProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); Integer warnLine = 0; diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockDetailServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockDetailServiceImpl.java index b54397db..4b556a58 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockDetailServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockDetailServiceImpl.java @@ -176,6 +176,7 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ stockDetail.setUnitName(tbShopUnit==null?"":tbShopUnit.getName()); stockDetail.setCreatedAt(System.currentTimeMillis()); stockDetail.setUpdatedAt(System.currentTimeMillis()); + stockDetail.setOperator(SecurityUtils.getCurrentUsername()); tbProductStockDetailRepository.save(stockDetail); product.setStockNumber(product.getStockNumber()-stockDetail.getStockNumber().intValue()); tbProductRepository.save(product); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductService.java index 027f6da6..82661bc2 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductService.java @@ -31,7 +31,7 @@ public interface TbProductService { Map queryAll(TbProductQueryCriteria criteria, boolean isAdmin); - Map queryAllV2(TbProductQueryV2Criteria criteria, Pageable pageable); + Map queryAllV2(TbProductQueryV2Criteria criteria); /** From e74fc42cf7cea08df244389e14cda11c8aa4d566 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Fri, 11 Oct 2024 14:46:19 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/controller/order/TbOrderInfoController.java | 3 ++- .../cashier/service/impl/order/TbOrderInfoServiceImpl.java | 7 +++++-- .../cn/ysk/cashier/service/order/TbOrderInfoService.java | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/order/TbOrderInfoController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/order/TbOrderInfoController.java index 3fe11b9c..fca15114 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/order/TbOrderInfoController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/order/TbOrderInfoController.java @@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; +import java.util.Map; /** * @website https://eladmin.vip @@ -54,7 +55,7 @@ public class TbOrderInfoController { @GetMapping("/{id}") @ApiOperation("通过Id查询订单") - public TbOrderInfoDto queryTbOrderInfo(@PathVariable("id") Integer id){ + public Map queryTbOrderInfo(@PathVariable("id") Integer id){ return tbOrderInfoService.findById(id); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java index 35c520ba..4ccaded6 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java @@ -1,5 +1,6 @@ package cn.ysk.cashier.service.impl.order; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateTime; import cn.hutool.core.util.ObjectUtil; import cn.ysk.cashier.cons.TableConstant; @@ -257,7 +258,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { @Override @Transactional - public TbOrderInfoDto findById(Integer id) { + public Map findById(Integer id) { TbOrderInfo tbOrderInfo = tbOrderInfoRepository.findById(id).orElseGet(TbOrderInfo::new); ValidationUtil.isNull(tbOrderInfo.getId(), "TbOrderInfo", "id", id); TbOrderInfoDto dto = tbOrderInfoMapper.toDto(tbOrderInfo); @@ -296,7 +297,9 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { dto.setDetailList(details); TbCashierCart cashierCart = tbCashierCartMapper.selectOne(new LambdaQueryWrapper().eq(TbCashierCart::getOrderId, id).eq(TbCashierCart::getProductId, TableConstant.CART_SEAT_ID)); dto.setSeatInfo(cashierCart); - return dto; + Map data = BeanUtil.beanToMap(tbOrderInfo, false, false); + data.putAll(BeanUtil.beanToMap(dto, false, false)); + return data; } @Override diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/order/TbOrderInfoService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/order/TbOrderInfoService.java index 5e89ef1e..dd7c0af5 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/order/TbOrderInfoService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/order/TbOrderInfoService.java @@ -62,7 +62,7 @@ public interface TbOrderInfoService { * @param id ID * @return TbOrderInfoDto */ - TbOrderInfoDto findById(Integer id); + Map findById(Integer id); /** * 创建 From 9fc2f9e7024c6e79cf599ab486581310bdacd236 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 11 Oct 2024 14:46:13 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=20=E6=8A=A5=E6=8D=9F=20=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/controller/product/TbProductController.java | 4 ++-- .../ysk/cashier/dto/product/TbProductQueryV2Criteria.java | 6 +++--- .../service/impl/productimpl/TbProductServiceImpl.java | 7 ++++++- .../impl/productimpl/TbProductStockDetailServiceImpl.java | 1 + .../cn/ysk/cashier/service/product/TbProductService.java | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductController.java index 31ef1c46..ce22ccaf 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductController.java @@ -37,8 +37,8 @@ public class TbProductController { @PostMapping("/list/v2") @ApiOperation("查询商品列表 新") - public ResponseEntity queryTbProductV2(@RequestBody TbProductQueryV2Criteria criteria, Pageable pageable){ - return new ResponseEntity<>(tbProductService.queryAllV2(criteria,pageable),HttpStatus.OK); + public ResponseEntity queryTbProductV2(@RequestBody TbProductQueryV2Criteria criteria){ + return new ResponseEntity<>(tbProductService.queryAllV2(criteria),HttpStatus.OK); } @GetMapping("/list") diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java index 48fc19d7..c7065ee5 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java @@ -67,9 +67,9 @@ public class TbProductQueryV2Criteria { @Query(type = BETWEEN) private List createdAt; -// private Integer page; -// -// private Integer size; + private Integer page; + private Integer size; + private String sort; public void setType(String type) { if(StringUtils.isNotBlank(type)){ diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java index 0895dd9a..fe48bb66 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java @@ -241,7 +241,12 @@ public class TbProductServiceImpl implements TbProductService { } @Override - public Map queryAllV2(TbProductQueryV2Criteria criteria,Pageable pageable) { + public Map queryAllV2(TbProductQueryV2Criteria criteria) { + String[] sortParams = criteria.getSort().split(","); + String sortField = sortParams[0]; + Sort.Direction sortDirection = Sort.Direction.fromString(sortParams[1]); + Sort sort = Sort.by(sortDirection, sortField); + Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort); //查询商品数据 Page page = tbProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); Integer warnLine = 0; diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockDetailServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockDetailServiceImpl.java index b54397db..4b556a58 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockDetailServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockDetailServiceImpl.java @@ -176,6 +176,7 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ stockDetail.setUnitName(tbShopUnit==null?"":tbShopUnit.getName()); stockDetail.setCreatedAt(System.currentTimeMillis()); stockDetail.setUpdatedAt(System.currentTimeMillis()); + stockDetail.setOperator(SecurityUtils.getCurrentUsername()); tbProductStockDetailRepository.save(stockDetail); product.setStockNumber(product.getStockNumber()-stockDetail.getStockNumber().intValue()); tbProductRepository.save(product); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductService.java index 027f6da6..82661bc2 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductService.java @@ -31,7 +31,7 @@ public interface TbProductService { Map queryAll(TbProductQueryCriteria criteria, boolean isAdmin); - Map queryAllV2(TbProductQueryV2Criteria criteria, Pageable pageable); + Map queryAllV2(TbProductQueryV2Criteria criteria); /** From e8a7ab070b7716926d5d0c79dcc214dc06be3c56 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 11 Oct 2024 15:40:15 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E8=80=97=E6=9D=90=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E8=80=97=E6=9D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cons/rest/ViewConInfoFlowController.java | 5 +- .../cons/service/ViewConInfoFlowService.java | 4 +- .../dto/ViewConInfoFlowQueryCriteria.java | 4 ++ .../impl/TbConsInfoFlowServiceImpl.java | 53 +++++++------------ .../service/impl/TbProskuConServiceImpl.java | 32 +++++------ .../impl/ViewConInfoFlowServiceImpl.java | 15 +++--- 6 files changed, 48 insertions(+), 65 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/ViewConInfoFlowController.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/ViewConInfoFlowController.java index 3f25bf93..ec79da5d 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/ViewConInfoFlowController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/ViewConInfoFlowController.java @@ -4,7 +4,6 @@ import cn.ysk.cashier.annotation.Log; import cn.ysk.cashier.cons.domain.ViewConInfoFlow; import cn.ysk.cashier.cons.service.ViewConInfoFlowService; import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowQueryCriteria; -import org.springframework.data.domain.Pageable; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -35,8 +34,8 @@ public class ViewConInfoFlowController { @PostMapping("get") @ApiOperation("查询获取耗材流水信息") - public ResponseEntity queryViewConInfoFlow(@RequestBody ViewConInfoFlowQueryCriteria criteria, Pageable pageable){ - return new ResponseEntity<>(viewConInfoFlowService.queryAll(criteria,pageable),HttpStatus.OK); + public ResponseEntity queryViewConInfoFlow(@RequestBody ViewConInfoFlowQueryCriteria criteria){ + return new ResponseEntity<>(viewConInfoFlowService.queryAllPage(criteria),HttpStatus.OK); } @PostMapping diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/ViewConInfoFlowService.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/ViewConInfoFlowService.java index 5e95fff2..e16f6c45 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/ViewConInfoFlowService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/ViewConInfoFlowService.java @@ -3,7 +3,6 @@ package cn.ysk.cashier.cons.service; import cn.ysk.cashier.cons.domain.ViewConInfoFlow; import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowDto; import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowQueryCriteria; -import org.springframework.data.domain.Pageable; import java.util.Map; import java.util.List; import java.io.IOException; @@ -18,10 +17,9 @@ public interface ViewConInfoFlowService { /** * 查询数据分页 * @param criteria 条件 - * @param pageable 分页参数 * @return Map */ - Map queryAll(ViewConInfoFlowQueryCriteria criteria, Pageable pageable); + Map queryAllPage(ViewConInfoFlowQueryCriteria criteria); /** * 查询所有数据不分页 diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConInfoFlowQueryCriteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConInfoFlowQueryCriteria.java index 6a045efe..b5151a1e 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConInfoFlowQueryCriteria.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConInfoFlowQueryCriteria.java @@ -32,4 +32,8 @@ public class ViewConInfoFlowQueryCriteria { @Query(type = Query.Type.BETWEEN) private List createTime; + + private Integer page; + private Integer size; + private String sort; } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoFlowServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoFlowServiceImpl.java index ee3a2aa2..4c30d2a4 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoFlowServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoFlowServiceImpl.java @@ -1,48 +1,36 @@ package cn.ysk.cashier.cons.service.impl; import cn.hutool.core.bean.copier.CopyOptions; -import cn.hutool.core.util.StrUtil; import cn.ysk.cashier.cons.domain.TbConsInfo; import cn.ysk.cashier.cons.domain.TbConsInfoFlow; -import cn.ysk.cashier.cons.repository.TbConsInfoRepository; -import cn.ysk.cashier.dto.product.TbProductStockCountQueryCriteria; -import cn.ysk.cashier.dto.product.TbProductStockDetailQueryCriteria; -import cn.ysk.cashier.dto.product.TbProductStockListDto; -import cn.ysk.cashier.exception.BadRequestException; -import cn.ysk.cashier.pojo.product.TbProduct; -import cn.ysk.cashier.pojo.product.TbProductStockDetail; -import cn.ysk.cashier.pojo.shop.TbShopUnit; -import cn.ysk.cashier.repository.product.ProductStockCountRepository; -import cn.ysk.cashier.utils.*; -import cn.ysk.cashier.vo.TbProductStockCountVo; -import lombok.RequiredArgsConstructor; import cn.ysk.cashier.cons.repository.TbConsInfoFlowRepository; +import cn.ysk.cashier.cons.repository.TbConsInfoRepository; import cn.ysk.cashier.cons.service.TbConsInfoFlowService; import cn.ysk.cashier.cons.service.dto.TbConsInfoFlowDto; import cn.ysk.cashier.cons.service.dto.TbConsInfoFlowQueryCriteria; import cn.ysk.cashier.cons.service.mapstruct.TbConsInfoFlowMapper; +import cn.ysk.cashier.dto.product.TbProductStockCountQueryCriteria; +import cn.ysk.cashier.dto.product.TbProductStockListDto; +import cn.ysk.cashier.exception.BadRequestException; +import cn.ysk.cashier.repository.product.ProductStockCountRepository; +import cn.ysk.cashier.utils.*; +import cn.ysk.cashier.vo.TbProductStockCountVo; +import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; +import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; - +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.math.BigDecimal; import java.sql.Timestamp; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -/** -* @website https://eladmin.vip -* @description 服务实现 -* @author admin -* @date 2024-06-22 -**/ @Service @RequiredArgsConstructor public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService { @@ -85,6 +73,7 @@ public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService { //报损lossNumber; frmLoss //入库stockInNumber; stockIn //出库stockOutNumber; stockout + @Override public Map queryPage(TbConsInfoFlowQueryCriteria criteria){ if(StringUtils.isNotBlank(criteria.getColumn())){ switch (criteria.getColumn()){ @@ -95,25 +84,25 @@ public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService { criteria.setBizCode(Arrays.asList("checkStockIn", "stockOtherIn")); break; case "refundNumber": - criteria.setBizCode(Arrays.asList("cancelCart")); + criteria.setBizCode(Collections.singletonList("cancelCart")); break; case "subCountNumber": criteria.setBizCode(Arrays.asList("createCart","stockout","checkStockOut")); break; case "subNumber": - criteria.setBizCode(Arrays.asList("checkStockOut")); + criteria.setBizCode(Collections.singletonList("checkStockOut")); break; case "saleNumber": - criteria.setBizCode(Arrays.asList("createCart")); + criteria.setBizCode(Collections.singletonList("createCart")); break; case "lossNumber": - criteria.setBizCode(Arrays.asList("frmLoss")); + criteria.setBizCode(Collections.singletonList("frmLoss")); break; case "stockInNumber": - criteria.setBizCode(Arrays.asList("stockIn")); + criteria.setBizCode(Collections.singletonList("stockIn")); break; case "stockOutNumber": - criteria.setBizCode(Arrays.asList("stockout")); + criteria.setBizCode(Collections.singletonList("stockout")); break; } } @@ -151,9 +140,7 @@ public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService { criteria.getCategoryId(), DateUtil.getStrTime(criteria.getStartTime()), DateUtil.getStrTime(criteria.getEndTime()), pageable); if (!stockCountDtos.isEmpty()) { - stockCountDtos.getContent().parallelStream().forEach(s->{ - s.setCountNumber(s.getStockNumber().add(s.getSubCountNumber())); - }); + stockCountDtos.getContent().parallelStream().forEach(s-> s.setCountNumber(s.getStockNumber().add(s.getSubCountNumber()))); } return PageUtil.toPage(stockCountDtos); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbProskuConServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbProskuConServiceImpl.java index 4dd0a65f..990be5e4 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbProskuConServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbProskuConServiceImpl.java @@ -34,12 +34,6 @@ import java.io.IOException; import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; -/** -* @website https://eladmin.vip -* @description 服务实现 -* @author admin -* @date 2024-06-22 -**/ @Service @RequiredArgsConstructor @Slf4j @@ -75,7 +69,7 @@ public class TbProskuConServiceImpl implements TbProskuConService { @Override @Transactional(rollbackFor = Exception.class) - public TbProskuConDto create(List resources) throws BadRequestException,Exception { + public TbProskuConDto create(List resources) throws Exception { log.info("List resources:{}",JSONUtil.toJSONString(resources)); for (ProskuInfo resource : resources) { @@ -211,18 +205,18 @@ public class TbProskuConServiceImpl implements TbProskuConService { } TbProskuCon tbConsInfo1 = new TbProskuCon(); - int count = tbProskuConRepository.countByConInfoIdAndProductSkuIdAndShopId(resource.getConInfoId(), resource.getProductSkuId(), resource.getShopId(), resource.getProductId()); - if (count <= 0) { - BeanUtil.copyProperties(resource, tbConsInfo1, CopyOptions.create().setIgnoreNullValue(true)); - newCons.add(tbConsInfo1); - } else { - StringBuilder strResult = new StringBuilder(product.getName()); - if (sku != null) { - strResult.append(" 规格" + sku.getSpecSnap()); - } - strResult.append("与耗材 " + tbConsInfo.getConName() + " 的对应关系已存在"); - throw new BadRequestException(strResult.toString()); - } +// int count = tbProskuConRepository.countByConInfoIdAndProductSkuIdAndShopId(resource.getConInfoId(), resource.getProductSkuId(), resource.getShopId(), resource.getProductId()); +// if (count <= 0) { +// BeanUtil.copyProperties(resource, tbConsInfo1, CopyOptions.create().setIgnoreNullValue(true)); +// newCons.add(tbConsInfo1); +// } else { +// StringBuilder strResult = new StringBuilder(product.getName()); +// if (sku != null) { +// strResult.append(" 规格" + sku.getSpecSnap()); +// } +// strResult.append("与耗材 " + tbConsInfo.getConName() + " 的对应关系已存在"); +// throw new BadRequestException(strResult.toString()); +// } BeanUtil.copyProperties(resource, tbConsInfo1, CopyOptions.create().setIgnoreNullValue(true)); newCons.add(tbConsInfo1); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConInfoFlowServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConInfoFlowServiceImpl.java index 6f335b0c..e9ebaeed 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConInfoFlowServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConInfoFlowServiceImpl.java @@ -11,6 +11,8 @@ import cn.ysk.cashier.cons.service.ViewConInfoFlowService; import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowDto; import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowQueryCriteria; import cn.ysk.cashier.cons.service.mapstruct.ViewConInfoFlowMapper; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.data.domain.Page; @@ -22,12 +24,6 @@ import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.LinkedHashMap; -/** -* @website https://eladmin.vip -* @description 服务实现 -* @author admin -* @date 2024-07-17 -**/ @Service @RequiredArgsConstructor public class ViewConInfoFlowServiceImpl implements ViewConInfoFlowService { @@ -36,7 +32,12 @@ public class ViewConInfoFlowServiceImpl implements ViewConInfoFlowService { private final ViewConInfoFlowMapper viewConInfoFlowMapper; @Override - public Map queryAll(ViewConInfoFlowQueryCriteria criteria, Pageable pageable){ + public Map queryAllPage(ViewConInfoFlowQueryCriteria criteria){ + String[] sortParams = criteria.getSort().split(","); + String sortField = sortParams[0]; + Sort.Direction sortDirection = Sort.Direction.fromString(sortParams[1]); + Sort sort = Sort.by(sortDirection, sortField); + Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort); Page page = viewConInfoFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); return PageUtil.toPage(page.map(viewConInfoFlowMapper::toDto)); } From 5a2a18992ae40dfaec86e81c694bbee602821b41 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 11 Oct 2024 15:47:20 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E8=80=97=E6=9D=90=E8=AE=B0=E5=BD=95=20?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ViewConInfoFlowServiceImpl.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConInfoFlowServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConInfoFlowServiceImpl.java index e9ebaeed..47ce77df 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConInfoFlowServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConInfoFlowServiceImpl.java @@ -11,6 +11,7 @@ import cn.ysk.cashier.cons.service.ViewConInfoFlowService; import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowDto; import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowQueryCriteria; import cn.ysk.cashier.cons.service.mapstruct.ViewConInfoFlowMapper; +import org.apache.commons.lang3.StringUtils; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; @@ -33,10 +34,13 @@ public class ViewConInfoFlowServiceImpl implements ViewConInfoFlowService { @Override public Map queryAllPage(ViewConInfoFlowQueryCriteria criteria){ - String[] sortParams = criteria.getSort().split(","); - String sortField = sortParams[0]; - Sort.Direction sortDirection = Sort.Direction.fromString(sortParams[1]); - Sort sort = Sort.by(sortDirection, sortField); + Sort sort = Sort.by(Sort.Direction.DESC, "id"); + if(StringUtils.isNotBlank(criteria.getSort())){ + String[] sortParams = criteria.getSort().split(","); + String sortField = sortParams[0]; + Sort.Direction sortDirection = Sort.Direction.fromString(sortParams[1]); + sort = Sort.by(sortDirection, sortField); + } Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort); Page page = viewConInfoFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); return PageUtil.toPage(page.map(viewConInfoFlowMapper::toDto)); From 080c426caade02967b48b81cc27e345278019ba3 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 11 Oct 2024 15:58:21 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E8=80=97=E6=9D=90=E8=AE=B0=E5=BD=95=20?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/cons/service/impl/ViewConInfoFlowServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConInfoFlowServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConInfoFlowServiceImpl.java index 47ce77df..d005609d 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConInfoFlowServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConInfoFlowServiceImpl.java @@ -34,7 +34,7 @@ public class ViewConInfoFlowServiceImpl implements ViewConInfoFlowService { @Override public Map queryAllPage(ViewConInfoFlowQueryCriteria criteria){ - Sort sort = Sort.by(Sort.Direction.DESC, "id"); + Sort sort = Sort.by(Sort.Direction.DESC, "consId"); if(StringUtils.isNotBlank(criteria.getSort())){ String[] sortParams = criteria.getSort().split(","); String sortField = sortParams[0]; From 857502e26ee1231bccfe02578054b4f1eaeaca2c Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Fri, 11 Oct 2024 16:42:35 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E5=85=88=E4=BB=98=E8=B4=B9=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=88=9B=E5=BB=BA=E8=AE=A2=E5=8D=95=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E8=B4=AD=E7=89=A9=E8=BD=A6=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/shopimpl/TbShopTableServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 037eadee..6b55210f 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 @@ -1205,7 +1205,6 @@ public class TbShopTableServiceImpl implements TbShopTableService { String orderNo = generateOrderNumber(null); orderInfo = new TbOrderInfo(); orderInfo.setOrderNo(orderNo); - orderInfo.setUseType(createOrderDTO.isPostPay() ? "postPay" : "afterPay"); orderInfo.setAmount(totalAmount); orderInfo.setPayAmount(BigDecimal.ZERO); orderInfo.setPackFee(packAMount); @@ -1286,6 +1285,11 @@ public class TbShopTableServiceImpl implements TbShopTableService { if (cashierCart.getPlaceNum() == null) { cashierCart.setPlaceNum(placeNum); } + + // 先付费模式,结束购物车状态 + if (shopEatTypeInfoDTO.isDineInBefore()) { + cashierCart.setStatus("final"); + } cashierCartMapper.updateById(cashierCart); } From 7c7a42d58db708a3476e384da8abe791a196a2bb Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 11 Oct 2024 16:56:11 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E5=95=86=E5=93=81id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java index c7065ee5..e4d87acd 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java @@ -32,6 +32,8 @@ import static cn.ysk.cashier.annotation.Query.Type.*; **/ @Data public class TbProductQueryV2Criteria { + @Query + private Integer id; /** 精确 */ @Query From d335268a84d7514b1284d8a810be5d581def6e57 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Fri, 11 Oct 2024 17:09:04 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E5=85=88=E4=BB=98=E8=B4=B9=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=88=9B=E5=BB=BA=E8=AE=A2=E5=8D=95=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=E5=8F=B0=E6=A1=8C=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/shopimpl/TbShopTableServiceImpl.java | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) 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 6b55210f..641f6608 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 @@ -1309,19 +1309,32 @@ public class TbShopTableServiceImpl implements TbShopTableService { pushConsMsg(orderInfo, cashierCarts); if (!shopEatTypeInfoDTO.isTakeout()) { - LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper() - .eq(TbShopTable::getShopId, createOrderDTO.getShopId()) - .eq(TbShopTable::getQrcode, createOrderDTO.getTableId()) - .set(TbShopTable::getProductNum, cashierCarts.size()) - .set(TbShopTable::getTotalAmount, orderInfo.getOrderAmount()) - .set(TbShopTable::getRealAmount, orderInfo.getOrderAmount()) - .set(TbShopTable::getUseNum, mealNum) - .set(TbShopTable::getStatus, TableStateEnum.USING.getState()); - if (isFirst) { - wrapper.set(TbShopTable::getUseTime, DateUtil.date()); + // 清空台桌信息 + if (shopEatTypeInfoDTO.isDineInBefore()) { + mpShopTableMapper.update(null, new LambdaUpdateWrapper() + .eq(TbShopTable::getShopId, createOrderDTO.getShopId()) + .eq(TbShopTable::getQrcode, createOrderDTO.getTableId()) + .set(TbShopTable::getProductNum, 0) + .set(TbShopTable::getTotalAmount, 0) + .set(TbShopTable::getRealAmount, 0) + .set(TbShopTable::getUseNum, 0) + .set(TbShopTable::getStatus, TableStateEnum.IDLE.getState())); + // 设置台桌信息 + }else { + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper() + .eq(TbShopTable::getShopId, createOrderDTO.getShopId()) + .eq(TbShopTable::getQrcode, createOrderDTO.getTableId()) + .set(TbShopTable::getProductNum, cashierCarts.size()) + .set(TbShopTable::getTotalAmount, orderInfo.getOrderAmount()) + .set(TbShopTable::getRealAmount, orderInfo.getOrderAmount()) + .set(TbShopTable::getUseNum, mealNum) + .set(TbShopTable::getStatus, TableStateEnum.USING.getState()); + if (isFirst) { + wrapper.set(TbShopTable::getUseTime, DateUtil.date()); + } + mpShopTableMapper.update(null, wrapper); + } - // 设置台桌信息 - mpShopTableMapper.update(null, wrapper); } From e1a5e491e56f3bdd345a3f74ad64a0322461e05a Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Fri, 11 Oct 2024 18:17:49 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/order/TbOrderInfoServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java index 4ccaded6..67fbd8ec 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java @@ -295,7 +295,10 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { dto.setRefundAmount(tbOrderInfos.stream().map(TbOrderInfo::getOrderAmount).reduce(BigDecimal.ZERO, BigDecimal::add)); } dto.setDetailList(details); - TbCashierCart cashierCart = tbCashierCartMapper.selectOne(new LambdaQueryWrapper().eq(TbCashierCart::getOrderId, id).eq(TbCashierCart::getProductId, TableConstant.CART_SEAT_ID)); + TbCashierCart cashierCart = tbCashierCartMapper.selectOne(new LambdaQueryWrapper() + .eq(TbCashierCart::getOrderId, id) + .eq(TbCashierCart::getUseType, tbOrderInfo.getUseType()) + .eq(TbCashierCart::getProductId, TableConstant.CART_SEAT_ID)); dto.setSeatInfo(cashierCart); Map data = BeanUtil.beanToMap(tbOrderInfo, false, false); data.putAll(BeanUtil.beanToMap(dto, false, false)); From 608fb72c785e8f82ff9d377a980afc4ada05d2b7 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Sat, 12 Oct 2024 09:15:30 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java | 1 + .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 1 + 2 files changed, 2 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java index 67fbd8ec..cd0caafc 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java @@ -618,6 +618,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { return; } orderInfo.setStatus("refund"); + orderInfo.setPaidTime(cn.hutool.core.date.DateUtil.current()); orderInfoMapper.updateById(orderInfo); } } 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 641f6608..2abca971 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 @@ -1548,6 +1548,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { } if (!isOnline) { + orderInfo.setPaidTime(DateUtil.current()); orderInfo.setPayAmount(finalAmount); orderInfo.setStatus("closed"); orderInfo.setDiscountRatio(BigDecimal.valueOf(payDTO.getDiscount())); From 7379b1d85d5a00abf7dde12eda0411f0245cbc50 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Sat, 12 Oct 2024 10:20:02 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E9=80=80=E8=8F=9C=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/ysk/cashier/mybatis/mapper/TbOrderInfoMapper.java | 8 ++++++++ .../service/impl/shopimpl/TbShopTableServiceImpl.java | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbOrderInfoMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbOrderInfoMapper.java index 7ab2daeb..d846f7f3 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbOrderInfoMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbOrderInfoMapper.java @@ -5,7 +5,9 @@ import cn.ysk.cashier.vo.TbOrderSaleVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import java.math.BigDecimal; import java.sql.Timestamp; import java.util.List; @@ -32,4 +34,10 @@ public interface TbOrderInfoMapper extends BaseMapper { " ) " + "") List selectAllSaleInfo(@Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime, @Param("productSkuIds") List productSkuIds, @Param("shopId") Integer shopId); + + @Update("update tb_order_info set settlement_amount=settlement_amount-#{priceAmount}, pack_fee=pack_fee-#{packAmount}," + + "order_amount=origin_amount-#{priceAmount}, amount=amount-#{priceAmount}," + + "order_amount=order_amount-#{priceAmount} where id=#{orderId} and origin_amount-#{priceAmount} >= 0") + int updateOrderAmount(Integer orderId, BigDecimal priceAmount, BigDecimal packAmount); + } 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 2abca971..7ee16ace 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 @@ -629,6 +629,9 @@ public class TbShopTableServiceImpl implements TbShopTableService { } // 餐位费直接删除 + TbOrderDetail orderDetail = orderDetailMapper.selectOne(new LambdaQueryWrapper() + .eq(TbOrderDetail::getCartId, cashierCart.getId())); + if (cashierCart.getId() == -999) { cashierCartMapper.deleteById(cashierCart.getId()); if (cashierCart.getOrderId() != null) { @@ -656,6 +659,12 @@ public class TbShopTableServiceImpl implements TbShopTableService { } + if (cashierCart.getOrderId() != null) { + // 减少订单金额 + orderInfoMapper.updateOrderAmount(cashierCart.getOrderId(), orderDetail.getPriceAmount(), orderDetail.getPackAmount()); + } + + } @Override