Merge branch 'refs/heads/dev'
This commit is contained in:
commit
d5a5332e78
|
|
@ -68,4 +68,8 @@ public class TbOrderInfoQueryCriteria{
|
||||||
/** BETWEEN */
|
/** BETWEEN */
|
||||||
@Query(type = Query.Type.BETWEEN)
|
@Query(type = Query.Type.BETWEEN)
|
||||||
private List<Long> createdAt;
|
private List<Long> createdAt;
|
||||||
|
|
||||||
|
|
||||||
|
@Query
|
||||||
|
private String tableName;
|
||||||
}
|
}
|
||||||
|
|
@ -6,6 +6,11 @@ import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TbPayCountQueryCriteria {
|
public class TbPayCountQueryCriteria {
|
||||||
|
|
||||||
|
|
||||||
private String shopId;
|
private String shopId;
|
||||||
|
|
||||||
|
private String tableName;
|
||||||
|
|
||||||
private List<Long> createdAt;
|
private List<Long> createdAt;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,4 +30,7 @@ public class TbProductSpecQueryCriteria{
|
||||||
*/
|
*/
|
||||||
@Query
|
@Query
|
||||||
private String shopId;
|
private String shopId;
|
||||||
|
|
||||||
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
|
private String name;
|
||||||
}
|
}
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Zheng Jie
|
* Copyright 2019-2020 Zheng Jie
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package cn.ysk.cashier.repository.order;
|
package cn.ysk.cashier.repository.order;
|
||||||
|
|
||||||
import cn.ysk.cashier.pojo.order.TbOrderInfo;
|
import cn.ysk.cashier.pojo.order.TbOrderInfo;
|
||||||
|
|
@ -32,26 +32,26 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lyf
|
* @website https://eladmin.vip
|
||||||
* @website https://eladmin.vip
|
* @author lyf
|
||||||
* @date 2024-03-02
|
* @date 2024-03-02
|
||||||
**/
|
**/
|
||||||
public interface TbOrderInfoRepository extends JpaRepository<TbOrderInfo, Integer>, JpaSpecificationExecutor<TbOrderInfo> {
|
public interface TbOrderInfoRepository extends JpaRepository<TbOrderInfo, Integer>, JpaSpecificationExecutor<TbOrderInfo> {
|
||||||
@Query("SELECT new cn.ysk.cashier.vo.TbOrderPayCountVo(info.payType, SUM(info.orderAmount)) " +
|
@Query("SELECT new cn.ysk.cashier.vo.TbOrderPayCountVo(info.payType, SUM(info.orderAmount)) " +
|
||||||
"FROM TbOrderInfo info " +
|
"FROM TbOrderInfo info " +
|
||||||
"WHERE info.shopId = :shopId " +
|
"WHERE 1=1 and (:tableName is null or info.tableName=:tableName ) and info.shopId = :shopId " +
|
||||||
"AND info.createdAt>:start AND info.createdAt<:end " +
|
"AND info.createdAt>:start AND info.createdAt<:end " +
|
||||||
"AND ((info.status = 'closed') OR (info.status = 'refund' AND info.orderType != 'return')) " +
|
"AND ((info.status = 'closed') OR (info.status = 'refund' AND info.orderType != 'return')) " +
|
||||||
"GROUP BY info.payType")
|
"GROUP BY info.payType")
|
||||||
List<TbOrderPayCountVo> queryTbOrderPayCount(@Param("shopId") String shopId, @Param("start") Long start, @Param("end") Long end);
|
List<TbOrderPayCountVo> queryTbOrderPayCount(@Param("shopId")String shopId,@Param("tableName") String tableName ,@Param("start") Long start, @Param("end") Long end);
|
||||||
|
|
||||||
|
|
||||||
@Query("SELECT new cn.ysk.cashier.vo.TbOrderPayCountVo('refund', SUM(info.orderAmount)) " +
|
@Query("SELECT new cn.ysk.cashier.vo.TbOrderPayCountVo('refund', SUM(info.orderAmount)) " +
|
||||||
"FROM TbOrderInfo info " +
|
"FROM TbOrderInfo info " +
|
||||||
"WHERE info.shopId = :shopId " +
|
"WHERE 1=1 and (:tableName is null or info.tableName=:tableName ) and info.shopId = :shopId " +
|
||||||
"AND info.status = 'refund' AND info.orderType = 'return' " +
|
"AND info.status = 'refund' AND info.orderType = 'return' " +
|
||||||
"AND info.createdAt>:start AND info.createdAt<:end")
|
"AND info.createdAt>:start AND info.createdAt<:end")
|
||||||
TbOrderPayCountVo queryTbOrderRefund(@Param("shopId") String shopId, @Param("start") Long start, @Param("end") Long end);
|
TbOrderPayCountVo queryTbOrderRefund(@Param("shopId")String shopId, @Param("tableName") String tableName ,@Param("start") Long start, @Param("end") Long end);
|
||||||
|
|
||||||
@Query(value = "SELECT COUNT(1) ,pay_type AS payType FROM tb_order_info Where shop_id = :shopId AND " +
|
@Query(value = "SELECT COUNT(1) ,pay_type AS payType FROM tb_order_info Where shop_id = :shopId AND " +
|
||||||
" created_at BETWEEN :startTime AND :endTime AND status='closed'AND order_type <>'return' GROUP BY pay_type", nativeQuery = true)
|
" created_at BETWEEN :startTime AND :endTime AND status='closed'AND order_type <>'return' GROUP BY pay_type", nativeQuery = true)
|
||||||
|
|
@ -191,4 +191,4 @@ public interface TbOrderInfoRepository extends JpaRepository<TbOrderInfo, Intege
|
||||||
|
|
||||||
@Query("select table.qrcode from TbShopTable table where table.shopId = :shopId")
|
@Query("select table.qrcode from TbShopTable table where table.shopId = :shopId")
|
||||||
List<String> queryShopTableIds(@Param("shopId") Integer shopId);
|
List<String> queryShopTableIds(@Param("shopId") Integer shopId);
|
||||||
}
|
}
|
||||||
|
|
@ -463,7 +463,7 @@ public class SummaryServiceImpl implements SummaryService {
|
||||||
endTime = new Date();
|
endTime = new Date();
|
||||||
}
|
}
|
||||||
TbOrderPayCountVo payCount = tbOrderInfoRepository.queryOrderPayCount(shopId, start, end);
|
TbOrderPayCountVo payCount = tbOrderInfoRepository.queryOrderPayCount(shopId, start, end);
|
||||||
TbOrderPayCountVo refCount = tbOrderInfoRepository.queryTbOrderRefund(shopId, start, end);
|
TbOrderPayCountVo refCount = tbOrderInfoRepository.queryTbOrderRefund(shopId, null,start, end);
|
||||||
payCount.setPayAmount(new BigDecimal(payCount.getPayAmount().toString()).subtract(new BigDecimal(refCount.getPayAmount().toString())));
|
payCount.setPayAmount(new BigDecimal(payCount.getPayAmount().toString()).subtract(new BigDecimal(refCount.getPayAmount().toString())));
|
||||||
payCount.setIcon("el-icon-coin");
|
payCount.setIcon("el-icon-coin");
|
||||||
list.add(payCount);
|
list.add(payCount);
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,10 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||||
end = createdAt.get(1);
|
end = createdAt.get(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<TbOrderPayCountVo> payCountVoList = tbOrderInfoRepository.queryTbOrderPayCount(criteria.getShopId(), start, end);
|
if(ObjectUtil.isEmpty(criteria.getTableName())){
|
||||||
|
criteria.setTableName(null);
|
||||||
|
}
|
||||||
|
List<TbOrderPayCountVo> payCountVoList = tbOrderInfoRepository.queryTbOrderPayCount(criteria.getShopId(),criteria.getTableName(), start, end);
|
||||||
BigDecimal totalPayAmount = BigDecimal.ZERO;
|
BigDecimal totalPayAmount = BigDecimal.ZERO;
|
||||||
for (TbOrderPayCountVo payCount : payCountVoList) {
|
for (TbOrderPayCountVo payCount : payCountVoList) {
|
||||||
totalPayAmount = totalPayAmount.add(new BigDecimal(payCount.getPayAmount().toString()));
|
totalPayAmount = totalPayAmount.add(new BigDecimal(payCount.getPayAmount().toString()));
|
||||||
|
|
@ -167,7 +170,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||||
result.add(payCount);
|
result.add(payCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TbOrderPayCountVo payRufund = tbOrderInfoRepository.queryTbOrderRefund(criteria.getShopId(), start, end);
|
TbOrderPayCountVo payRufund = tbOrderInfoRepository.queryTbOrderRefund(criteria.getShopId(),criteria.getTableName(), start, end);
|
||||||
if (payRufund != null) {
|
if (payRufund != null) {
|
||||||
totalPayAmount = totalPayAmount.subtract(new BigDecimal(payRufund.getPayAmount().toString()));
|
totalPayAmount = totalPayAmount.subtract(new BigDecimal(payRufund.getPayAmount().toString()));
|
||||||
payRufund.setPayType("退单");
|
payRufund.setPayType("退单");
|
||||||
|
|
@ -400,6 +403,28 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||||
.collect(Collectors.joining("/"));
|
.collect(Collectors.joining("/"));
|
||||||
map.put("商品信息", productNames);
|
map.put("商品信息", productNames);
|
||||||
//
|
//
|
||||||
|
|
||||||
|
if(ObjectUtil.isNotEmpty(tbOrderInfo.getPayType())&&ObjectUtil.isNotNull(tbOrderInfo.getPayType())){
|
||||||
|
switch (tbOrderInfo.getPayType()){
|
||||||
|
case "scanCode":
|
||||||
|
tbOrderInfo.setPayType("收款码支付");
|
||||||
|
break;
|
||||||
|
case "deposit":
|
||||||
|
tbOrderInfo.setPayType("会员卡支付");
|
||||||
|
break;
|
||||||
|
case "cash":
|
||||||
|
tbOrderInfo.setPayType("现金支付");
|
||||||
|
break;
|
||||||
|
case "wx_lite":
|
||||||
|
tbOrderInfo.setPayType("微信支付");
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
tbOrderInfo.setPayType("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
map.put("支付类型", tbOrderInfo.getPayType());
|
map.put("支付类型", tbOrderInfo.getPayType());
|
||||||
map.put("订单金额", tbOrderInfo.getOrderAmount());
|
map.put("订单金额", tbOrderInfo.getOrderAmount());
|
||||||
map.put("退单金额", tbOrderInfo.getRefundAmount());
|
map.put("退单金额", tbOrderInfo.getRefundAmount());
|
||||||
|
|
@ -442,6 +467,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||||
map.put("状态", tbOrderInfo.getStatus());
|
map.put("状态", tbOrderInfo.getStatus());
|
||||||
map.put("创建日期", DateUtil.timeStampFormatyMdHms(tbOrderInfo.getCreatedAt()));
|
map.put("创建日期", DateUtil.timeStampFormatyMdHms(tbOrderInfo.getCreatedAt()));
|
||||||
map.put("备注", tbOrderInfo.getRemark());
|
map.put("备注", tbOrderInfo.getRemark());
|
||||||
|
map.put("台桌",tbOrderInfo.getTableName());
|
||||||
list.add(map);
|
list.add(map);
|
||||||
}
|
}
|
||||||
FileUtil.downloadExcel(list, response);
|
FileUtil.downloadExcel(list, response);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue