订单管理 统计接口
This commit is contained in:
parent
706e3e540e
commit
8d9ba78594
|
|
@ -20,6 +20,8 @@ import java.math.BigDecimal;
|
|||
|
||||
import cn.ysk.cashier.annotation.Query;
|
||||
|
||||
import static cn.ysk.cashier.annotation.Query.Type.INNER_LIKE;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
|
|
@ -37,7 +39,7 @@ public class TbProductQueryCriteria{
|
|||
private String shopId;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
@Query(type = INNER_LIKE)
|
||||
private String name;
|
||||
|
||||
@Query
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ package cn.ysk.cashier.repository.order;
|
|||
|
||||
import cn.ysk.cashier.pojo.order.TbOrderInfo;
|
||||
import cn.ysk.cashier.repository.mapping.CountPayTypeMapping;
|
||||
import cn.ysk.cashier.vo.TbOrderPayCountVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
|
@ -32,6 +33,13 @@ import java.util.List;
|
|||
**/
|
||||
public interface TbOrderInfoRepository extends JpaRepository<TbOrderInfo, Integer>, JpaSpecificationExecutor<TbOrderInfo> {
|
||||
|
||||
@Query("SELECT new cn.ysk.cashier.vo.TbOrderPayCountVo(info.payType, SUM(info.amount)) " +
|
||||
"FROM TbOrderInfo info " +
|
||||
"WHERE info.shopId = :shopId " +
|
||||
"AND info.status ='closed'" +
|
||||
"GROUP BY info.payType")
|
||||
List<TbOrderPayCountVo> queryTbOrderPayCount(@Param("shopId")String shopId);
|
||||
|
||||
@Query(value = "SELECT COUNT(1) ,pay_type AS payType FROM tb_order_info Where shop_id = :shopId AND " +
|
||||
" created_at BETWEEN :startTime AND :endTime GROUP BY pay_type" ,nativeQuery = true)
|
||||
List<Object[]> countByShopId(@Param("shopId") String shopId, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* 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.repository.order;
|
||||
|
||||
import cn.ysk.cashier.pojo.order.TbOrderInfo;
|
||||
import cn.ysk.cashier.vo.TbOrderPayCountVo;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2024-03-02
|
||||
**/
|
||||
public interface TbOrderPayCountRepository extends JpaRepository<TbOrderInfo, Integer> {
|
||||
|
||||
@Query("SELECT new cn.ysk.cashier.vo.TbOrderPayCountVo(info.payType, SUM(info.amount)) " +
|
||||
"FROM TbOrderInfo info " +
|
||||
"WHERE info.shopId = :shopId " +
|
||||
"GROUP BY info.payType")
|
||||
List<TbOrderPayCountVo> queryTbOrderPayCount(@Param("shopId")String shopId);
|
||||
}
|
||||
|
|
@ -22,7 +22,6 @@ import cn.ysk.cashier.pojo.order.TbOrderDetail;
|
|||
import cn.ysk.cashier.pojo.order.TbOrderInfo;
|
||||
import cn.ysk.cashier.repository.order.TbOrderDetailRepository;
|
||||
import cn.ysk.cashier.repository.order.TbOrderInfoRepository;
|
||||
import cn.ysk.cashier.repository.order.TbOrderPayCountRepository;
|
||||
import cn.ysk.cashier.service.order.TbOrderInfoService;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import cn.ysk.cashier.vo.TbOrderInfoVo;
|
||||
|
|
@ -54,8 +53,6 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||
|
||||
private final TbOrderDetailRepository tbOrderDetailRepository;
|
||||
|
||||
private final TbOrderPayCountRepository tbOrderPayCountRepository;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(TbOrderInfoQueryCriteria criteria, Pageable pageable) {
|
||||
Page<TbOrderInfo> page = tbOrderInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
|
|
@ -72,7 +69,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||
|
||||
@Override
|
||||
public List<TbOrderPayCountVo> queryTbOrderPayCount(String shopId) {
|
||||
return tbOrderPayCountRepository.queryTbOrderPayCount(shopId);
|
||||
return tbOrderInfoRepository.queryTbOrderPayCount(shopId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -17,42 +17,41 @@ package cn.ysk.cashier.service.impl.productimpl;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.pojo.product.TbProduct;
|
||||
import cn.ysk.cashier.vo.TbProductVo;
|
||||
import cn.ysk.cashier.repository.product.TbProductRepository;
|
||||
import cn.ysk.cashier.service.product.TbProductService;
|
||||
import cn.ysk.cashier.dto.product.TbProductDto;
|
||||
import cn.ysk.cashier.dto.product.TbProductQueryCriteria;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mapper.product.TbProductMapper;
|
||||
import cn.ysk.cashier.pojo.product.TbProductSkuResult;
|
||||
import cn.ysk.cashier.repository.product.TbProductSkuResultRepository;
|
||||
import cn.ysk.cashier.pojo.product.TbProductSpec;
|
||||
import cn.ysk.cashier.repository.product.TbProductSpecRepository;
|
||||
import cn.ysk.cashier.pojo.product.TbProduct;
|
||||
import cn.ysk.cashier.pojo.product.TbProductSku;
|
||||
import cn.ysk.cashier.repository.product.TbProductSkuRepository;
|
||||
import cn.ysk.cashier.pojo.product.TbProductSkuResult;
|
||||
import cn.ysk.cashier.pojo.product.TbProductSpec;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopUnit;
|
||||
import cn.ysk.cashier.repository.product.TbProductRepository;
|
||||
import cn.ysk.cashier.repository.product.TbProductSkuRepository;
|
||||
import cn.ysk.cashier.repository.product.TbProductSkuResultRepository;
|
||||
import cn.ysk.cashier.repository.product.TbProductSpecRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbShopUnitRepository;
|
||||
import cn.ysk.cashier.service.product.TbProductService;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import cn.ysk.cashier.vo.TbProductVo;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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.data.redis.core.script.DefaultRedisScript;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
|
|
@ -81,7 +80,6 @@ public class TbProductServiceImpl implements TbProductService {
|
|||
Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort);
|
||||
//查询商品数据
|
||||
Page<TbProduct> page = tbProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
log.info("查到的商品为:{}",page.getContent());
|
||||
List<String> productId = new ArrayList<>();
|
||||
List<Integer> unitId = new ArrayList<>();
|
||||
List<Integer> specId = new ArrayList<>();
|
||||
|
|
|
|||
Loading…
Reference in New Issue