Merge branch 'refs/heads/dev'
This commit is contained in:
commit
d5a5332e78
|
|
@ -68,4 +68,8 @@ public class TbOrderInfoQueryCriteria{
|
|||
/** BETWEEN */
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Long> createdAt;
|
||||
|
||||
|
||||
@Query
|
||||
private String tableName;
|
||||
}
|
||||
|
|
@ -6,6 +6,11 @@ import java.util.List;
|
|||
|
||||
@Data
|
||||
public class TbPayCountQueryCriteria {
|
||||
|
||||
|
||||
private String shopId;
|
||||
|
||||
private String tableName;
|
||||
|
||||
private List<Long> createdAt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,4 +30,7 @@ public class TbProductSpecQueryCriteria{
|
|||
*/
|
||||
@Query
|
||||
private String shopId;
|
||||
|
||||
@Query(type = Query.Type.INNER_LIKE)
|
||||
private String name;
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
* 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;
|
||||
|
|
@ -32,26 +32,26 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
* @website https://eladmin.vip
|
||||
* @date 2024-03-02
|
||||
**/
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2024-03-02
|
||||
**/
|
||||
public interface TbOrderInfoRepository extends JpaRepository<TbOrderInfo, Integer>, JpaSpecificationExecutor<TbOrderInfo> {
|
||||
@Query("SELECT new cn.ysk.cashier.vo.TbOrderPayCountVo(info.payType, SUM(info.orderAmount)) " +
|
||||
"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.status = 'closed') OR (info.status = 'refund' AND info.orderType != 'return')) " +
|
||||
"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)) " +
|
||||
"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.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 " +
|
||||
" 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")
|
||||
List<String> queryShopTableIds(@Param("shopId") Integer shopId);
|
||||
}
|
||||
}
|
||||
|
|
@ -463,7 +463,7 @@ public class SummaryServiceImpl implements SummaryService {
|
|||
endTime = new Date();
|
||||
}
|
||||
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.setIcon("el-icon-coin");
|
||||
list.add(payCount);
|
||||
|
|
|
|||
|
|
@ -150,7 +150,10 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||
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;
|
||||
for (TbOrderPayCountVo payCount : payCountVoList) {
|
||||
totalPayAmount = totalPayAmount.add(new BigDecimal(payCount.getPayAmount().toString()));
|
||||
|
|
@ -167,7 +170,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||
result.add(payCount);
|
||||
}
|
||||
}
|
||||
TbOrderPayCountVo payRufund = tbOrderInfoRepository.queryTbOrderRefund(criteria.getShopId(), start, end);
|
||||
TbOrderPayCountVo payRufund = tbOrderInfoRepository.queryTbOrderRefund(criteria.getShopId(),criteria.getTableName(), start, end);
|
||||
if (payRufund != null) {
|
||||
totalPayAmount = totalPayAmount.subtract(new BigDecimal(payRufund.getPayAmount().toString()));
|
||||
payRufund.setPayType("退单");
|
||||
|
|
@ -400,6 +403,28 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||
.collect(Collectors.joining("/"));
|
||||
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.getOrderAmount());
|
||||
map.put("退单金额", tbOrderInfo.getRefundAmount());
|
||||
|
|
@ -442,6 +467,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||
map.put("状态", tbOrderInfo.getStatus());
|
||||
map.put("创建日期", DateUtil.timeStampFormatyMdHms(tbOrderInfo.getCreatedAt()));
|
||||
map.put("备注", tbOrderInfo.getRemark());
|
||||
map.put("台桌",tbOrderInfo.getTableName());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
|
|
|
|||
Loading…
Reference in New Issue