Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -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<Object> queryViewConInfoFlow(@RequestBody ViewConInfoFlowQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(viewConInfoFlowService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
public ResponseEntity<Object> queryViewConInfoFlow(@RequestBody ViewConInfoFlowQueryCriteria criteria){
|
||||
return new ResponseEntity<>(viewConInfoFlowService.queryAllPage(criteria),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
|
||||
@@ -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<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(ViewConInfoFlowQueryCriteria criteria, Pageable pageable);
|
||||
Map<String,Object> queryAllPage(ViewConInfoFlowQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
|
||||
@@ -32,4 +32,8 @@ public class ViewConInfoFlowQueryCriteria {
|
||||
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Date> createTime;
|
||||
|
||||
private Integer page;
|
||||
private Integer size;
|
||||
private String sort;
|
||||
}
|
||||
@@ -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<String,Object> 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);
|
||||
}
|
||||
|
||||
@@ -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<ProskuInfo> resources) throws BadRequestException,Exception {
|
||||
public TbProskuConDto create(List<ProskuInfo> resources) throws Exception {
|
||||
|
||||
log.info("List<ProskuInfo> 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);
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ 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;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -22,12 +25,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 +33,15 @@ public class ViewConInfoFlowServiceImpl implements ViewConInfoFlowService {
|
||||
private final ViewConInfoFlowMapper viewConInfoFlowMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(ViewConInfoFlowQueryCriteria criteria, Pageable pageable){
|
||||
public Map<String,Object> queryAllPage(ViewConInfoFlowQueryCriteria criteria){
|
||||
Sort sort = Sort.by(Sort.Direction.DESC, "consId");
|
||||
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<ViewConInfoFlow> page = viewConInfoFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(viewConInfoFlowMapper::toDto));
|
||||
}
|
||||
|
||||
@@ -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<String, Object> queryTbOrderInfo(@PathVariable("id") Integer id){
|
||||
return tbOrderInfoService.findById(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ public class TbProductController {
|
||||
|
||||
@PostMapping("/list/v2")
|
||||
@ApiOperation("查询商品列表 新")
|
||||
public ResponseEntity<Object> queryTbProductV2(@RequestBody TbProductQueryV2Criteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbProductService.queryAllV2(criteria,pageable),HttpStatus.OK);
|
||||
public ResponseEntity<Object> queryTbProductV2(@RequestBody TbProductQueryV2Criteria criteria){
|
||||
return new ResponseEntity<>(tbProductService.queryAllV2(criteria),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
|
||||
@@ -32,6 +32,8 @@ import static cn.ysk.cashier.annotation.Query.Type.*;
|
||||
**/
|
||||
@Data
|
||||
public class TbProductQueryV2Criteria {
|
||||
@Query
|
||||
private Integer id;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
@@ -67,9 +69,9 @@ public class TbProductQueryV2Criteria {
|
||||
@Query(type = BETWEEN)
|
||||
private List<Long> 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)){
|
||||
|
||||
@@ -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<TbOrderInfo> {
|
||||
" ) " +
|
||||
"</script>")
|
||||
List<TbOrderSaleVO> selectAllSaleInfo(@Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime, @Param("productSkuIds") List<Integer> 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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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<String, Object> findById(Integer id) {
|
||||
TbOrderInfo tbOrderInfo = tbOrderInfoRepository.findById(id).orElseGet(TbOrderInfo::new);
|
||||
ValidationUtil.isNull(tbOrderInfo.getId(), "TbOrderInfo", "id", id);
|
||||
TbOrderInfoDto dto = tbOrderInfoMapper.toDto(tbOrderInfo);
|
||||
@@ -294,9 +295,14 @@ 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<TbCashierCart>().eq(TbCashierCart::getOrderId, id).eq(TbCashierCart::getProductId, TableConstant.CART_SEAT_ID));
|
||||
TbCashierCart cashierCart = tbCashierCartMapper.selectOne(new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getOrderId, id)
|
||||
.eq(TbCashierCart::getUseType, tbOrderInfo.getUseType())
|
||||
.eq(TbCashierCart::getProductId, TableConstant.CART_SEAT_ID));
|
||||
dto.setSeatInfo(cashierCart);
|
||||
return dto;
|
||||
Map<String, Object> data = BeanUtil.beanToMap(tbOrderInfo, false, false);
|
||||
data.putAll(BeanUtil.beanToMap(dto, false, false));
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -612,6 +618,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||
return;
|
||||
}
|
||||
orderInfo.setStatus("refund");
|
||||
orderInfo.setPaidTime(cn.hutool.core.date.DateUtil.current());
|
||||
orderInfoMapper.updateById(orderInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +241,12 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAllV2(TbProductQueryV2Criteria criteria,Pageable pageable) {
|
||||
public Map<String, Object> 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<TbProduct> page = tbProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
Integer warnLine = 0;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -629,6 +629,9 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
}
|
||||
|
||||
// 餐位费直接删除
|
||||
TbOrderDetail orderDetail = orderDetailMapper.selectOne(new LambdaQueryWrapper<TbOrderDetail>()
|
||||
.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
|
||||
@@ -1205,7 +1214,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 +1294,11 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
if (cashierCart.getPlaceNum() == null) {
|
||||
cashierCart.setPlaceNum(placeNum);
|
||||
}
|
||||
|
||||
// 先付费模式,结束购物车状态
|
||||
if (shopEatTypeInfoDTO.isDineInBefore()) {
|
||||
cashierCart.setStatus("final");
|
||||
}
|
||||
cashierCartMapper.updateById(cashierCart);
|
||||
}
|
||||
|
||||
@@ -1305,19 +1318,32 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
pushConsMsg(orderInfo, cashierCarts);
|
||||
|
||||
if (!shopEatTypeInfoDTO.isTakeout()) {
|
||||
LambdaUpdateWrapper<TbShopTable> wrapper = new LambdaUpdateWrapper<TbShopTable>()
|
||||
.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<TbShopTable>()
|
||||
.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<TbShopTable> wrapper = new LambdaUpdateWrapper<TbShopTable>()
|
||||
.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);
|
||||
}
|
||||
|
||||
|
||||
@@ -1531,6 +1557,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
}
|
||||
|
||||
if (!isOnline) {
|
||||
orderInfo.setPaidTime(DateUtil.current());
|
||||
orderInfo.setPayAmount(finalAmount);
|
||||
orderInfo.setStatus("closed");
|
||||
orderInfo.setDiscountRatio(BigDecimal.valueOf(payDTO.getDiscount()));
|
||||
|
||||
@@ -62,7 +62,7 @@ public interface TbOrderInfoService {
|
||||
* @param id ID
|
||||
* @return TbOrderInfoDto
|
||||
*/
|
||||
TbOrderInfoDto findById(Integer id);
|
||||
Map<String, Object> findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
|
||||
@@ -31,7 +31,7 @@ public interface TbProductService {
|
||||
Map<String, Object> queryAll(TbProductQueryCriteria criteria, boolean isAdmin);
|
||||
|
||||
|
||||
Map<String, Object> queryAllV2(TbProductQueryV2Criteria criteria, Pageable pageable);
|
||||
Map<String, Object> queryAllV2(TbProductQueryV2Criteria criteria);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user