财务报表
This commit is contained in:
@@ -0,0 +1,41 @@
|
|||||||
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
|
import com.czg.order.dto.FinanceStsDTO;
|
||||||
|
import com.czg.order.param.FinanceStsQueryParam;
|
||||||
|
import com.czg.order.service.FinanceStsService;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理端/财务统计
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/2/2 10:09
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/admin/finance")
|
||||||
|
public class FinanceStsController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FinanceStsService financeStsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询财务报表
|
||||||
|
*/
|
||||||
|
@GetMapping("/sts")
|
||||||
|
public CzgResult<FinanceStsDTO> getFinanceSts(@Validated(FinanceStsQueryParam.Query.class) FinanceStsQueryParam param) {
|
||||||
|
return CzgResult.success(financeStsService.getFinanceSts(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出财务报表
|
||||||
|
*/
|
||||||
|
@GetMapping("/export")
|
||||||
|
public void exportFinanceSts(@Validated(FinanceStsQueryParam.Export.class) FinanceStsQueryParam param, HttpServletResponse response) {
|
||||||
|
financeStsService.exportFinanceSts(param, response);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
package com.czg.controller.admin;
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
import com.czg.excel.ExcelExportUtil;
|
|
||||||
import com.czg.log.annotation.OperationLog;
|
import com.czg.log.annotation.OperationLog;
|
||||||
import com.czg.order.entity.ShopTableOrderStatistic;
|
import com.czg.order.entity.ShopTableOrderStatistic;
|
||||||
import com.czg.order.param.DataSummaryTradeParam;
|
import com.czg.order.param.DataSummaryTradeParam;
|
||||||
import com.czg.order.param.TableSummaryParam;
|
import com.czg.order.param.TableSummaryParam;
|
||||||
import com.czg.order.service.ShopTableOrderStatisticService;
|
import com.czg.order.service.ShopTableOrderStatisticService;
|
||||||
import com.czg.order.service.TableSummaryService;
|
import com.czg.order.service.TableSummaryService;
|
||||||
import com.czg.order.vo.TableSummaryExportVo;
|
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ import java.time.LocalDateTime;
|
|||||||
@Data
|
@Data
|
||||||
public class ShopUserExportDTO {
|
public class ShopUserExportDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主店铺Id
|
||||||
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
|
private Long mainShopId;
|
||||||
|
|
||||||
@ExcelProperty("手机号")
|
@ExcelProperty("手机号")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
@@ -99,18 +105,14 @@ public class ShopUserExportDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getDistributionShopsRemark() {
|
public String getDistributionShopsRemark() {
|
||||||
if (StrUtil.isBlank(distributionShops) || !distributionShops.contains("_")) {
|
if (StrUtil.isBlank(distributionShops)) {
|
||||||
return "否";
|
return "否";
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] split = distributionShops.split("_");
|
if (distributionShops.contains(mainShopId + "_1")) {
|
||||||
if (split.length < 2) {
|
return "是";
|
||||||
return "否";
|
|
||||||
}
|
|
||||||
if ("0".equals(split[1])) {
|
|
||||||
return "否";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "是";
|
return "否";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,258 @@
|
|||||||
|
package com.czg.order.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 财务统计数据
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/2/2 09:34
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class FinanceStsDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期
|
||||||
|
*/
|
||||||
|
private String date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业额
|
||||||
|
*/
|
||||||
|
private TurnoverSts turnover;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单
|
||||||
|
*/
|
||||||
|
private OrderSts order;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠金额
|
||||||
|
*/
|
||||||
|
private DiscountSts discount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款
|
||||||
|
*/
|
||||||
|
private RefundSts refund;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据统计
|
||||||
|
*/
|
||||||
|
private Sts sts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业额 类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class TurnoverSts {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业额
|
||||||
|
*/
|
||||||
|
private BigDecimal turnover;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付金额
|
||||||
|
*/
|
||||||
|
private BigDecimal wechat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付宝支付金额
|
||||||
|
*/
|
||||||
|
private BigDecimal alipay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主扫收款
|
||||||
|
*/
|
||||||
|
private BigDecimal selfScan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 现金收款
|
||||||
|
*/
|
||||||
|
private BigDecimal cash;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值
|
||||||
|
*/
|
||||||
|
private BigDecimal recharge;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 挂账
|
||||||
|
*/
|
||||||
|
private BigDecimal owed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额支付
|
||||||
|
*/
|
||||||
|
private BigDecimal balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单 类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class OrderSts {
|
||||||
|
/**
|
||||||
|
* 订单金额
|
||||||
|
*/
|
||||||
|
private BigDecimal orderAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单总数
|
||||||
|
*/
|
||||||
|
private Long orderCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠金额 类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class DiscountSts {
|
||||||
|
/**
|
||||||
|
* 优惠金额
|
||||||
|
*/
|
||||||
|
private BigDecimal discountAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠笔数
|
||||||
|
*/
|
||||||
|
private Long discountCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新客立减
|
||||||
|
*/
|
||||||
|
private BigDecimal newConsumerDiscount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 霸王餐
|
||||||
|
*/
|
||||||
|
private BigDecimal freeCashAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 满减活动
|
||||||
|
*/
|
||||||
|
private BigDecimal fullMinusAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券
|
||||||
|
*/
|
||||||
|
private BigDecimal couponAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员折扣
|
||||||
|
*/
|
||||||
|
private BigDecimal memberDiscount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分抵扣金额
|
||||||
|
*/
|
||||||
|
private BigDecimal pointsDiscountAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单改价
|
||||||
|
*/
|
||||||
|
private BigDecimal orderDiscount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款 类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class RefundSts {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal refundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线上退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal onlineRefundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 现金退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal cashRefundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal rechargeRefundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线上充值退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal onlineRechargeRefundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 现金充值退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal cashRechargeRefundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal memberRefundAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据统计 类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class Sts {
|
||||||
|
/**
|
||||||
|
* 就餐人数
|
||||||
|
*/
|
||||||
|
private Long customerCount;
|
||||||
|
/**
|
||||||
|
* 订单数
|
||||||
|
*/
|
||||||
|
private Long orderCount;
|
||||||
|
/**
|
||||||
|
* 桌台数
|
||||||
|
*/
|
||||||
|
private Long tableCount;
|
||||||
|
/**
|
||||||
|
* 客单价
|
||||||
|
* 实付金额(包含现金支付 包含会员支付 包含挂账)/就餐人数
|
||||||
|
* 没有具体人数时,默认一桌按照1人计算
|
||||||
|
*/
|
||||||
|
private BigDecimal avgPayAmount;
|
||||||
|
/**
|
||||||
|
* 翻台率
|
||||||
|
* (订单数-桌台数)/桌台数*100%
|
||||||
|
*/
|
||||||
|
private BigDecimal turnoverRate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 毛利润(订单实付金额-商品成本)
|
||||||
|
*/
|
||||||
|
private BigDecimal profitAmount;
|
||||||
|
/**
|
||||||
|
* 商品成本
|
||||||
|
*/
|
||||||
|
private BigDecimal productCostAmount;
|
||||||
|
/**
|
||||||
|
* 毛利率(订单实付金额-商品成本)/订单实付金额*100%
|
||||||
|
*/
|
||||||
|
private BigDecimal profitRate;
|
||||||
|
/**
|
||||||
|
* 净利润
|
||||||
|
*/
|
||||||
|
private BigDecimal netProfitAmount;
|
||||||
|
/**
|
||||||
|
* 净利润率
|
||||||
|
*/
|
||||||
|
private BigDecimal netProfitRate;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.czg.order.entity;
|
package com.czg.order.entity;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
import com.mybatisflex.annotation.Column;
|
import com.mybatisflex.annotation.Column;
|
||||||
import com.mybatisflex.annotation.Id;
|
import com.mybatisflex.annotation.Id;
|
||||||
import com.mybatisflex.annotation.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
import com.mybatisflex.annotation.Table;
|
import com.mybatisflex.annotation.Table;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@@ -105,249 +107,309 @@ public class ShopOrderStatistic implements Serializable {
|
|||||||
* 主键ID
|
* 主键ID
|
||||||
*/
|
*/
|
||||||
@Id(keyType = KeyType.Auto)
|
@Id(keyType = KeyType.Auto)
|
||||||
|
@ExcelIgnore
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店铺id
|
* 店铺id
|
||||||
*/
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
private Long shopId;
|
private Long shopId;
|
||||||
/**
|
/**
|
||||||
* 统计日期 yyyy-MM-dd
|
* 统计日期 yyyy-MM-dd
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("统计日期")
|
||||||
|
@ColumnWidth(17)
|
||||||
private LocalDate statisticDate;
|
private LocalDate statisticDate;
|
||||||
//*********************以下为订单金额********************************************************************************
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单金额 订单原金额
|
* 订单金额 订单原金额
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("订单金额")
|
||||||
private BigDecimal originAmount;
|
private BigDecimal originAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实付金额 (线上付款 现金支付 会员支付 挂账)
|
* 实付金额 (线上付款 现金支付 会员支付 挂账)
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("实付金额")
|
||||||
private BigDecimal payAmount;
|
private BigDecimal payAmount;
|
||||||
/**
|
|
||||||
* 线上付款金额
|
|
||||||
*/
|
|
||||||
private BigDecimal onlinePayAmount;
|
|
||||||
/**
|
|
||||||
* 订单退款 退款金额(原路返回 现金退款)
|
|
||||||
*/
|
|
||||||
private BigDecimal refundAmount;
|
|
||||||
/**
|
|
||||||
* 订单退款 线上退款金额
|
|
||||||
*/
|
|
||||||
private BigDecimal onlineRefundAmount;
|
|
||||||
/**
|
|
||||||
* 订单退款 线下退款金额/现金退款金额
|
|
||||||
*/
|
|
||||||
private BigDecimal cashRefundAmount;
|
|
||||||
/**
|
|
||||||
* 订单退款 会员退款金额
|
|
||||||
*/
|
|
||||||
private BigDecimal memberRefundAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员消费 会员订单支付金额
|
|
||||||
*/
|
|
||||||
private BigDecimal memberPayAmount;
|
|
||||||
/**
|
|
||||||
* 会员消费笔数
|
|
||||||
*/
|
|
||||||
private Long memberPayCount;
|
|
||||||
|
|
||||||
|
|
||||||
//*********************以下为充值金额********************************************************************************
|
|
||||||
/**
|
|
||||||
* 会员充值 充值金额(包含现金支付) 不包括赠送 多店 按 主店算
|
|
||||||
*/
|
|
||||||
private BigDecimal rechargeAmount;
|
|
||||||
/**
|
|
||||||
* 会员充值 线上充值金额
|
|
||||||
*/
|
|
||||||
private BigDecimal onlineRechargeAmount;
|
|
||||||
/**
|
|
||||||
* 会员充值 现金充值金额
|
|
||||||
*/
|
|
||||||
private BigDecimal cashRechargeAmount;
|
|
||||||
/**
|
|
||||||
* 会员充值 充值赠送金额
|
|
||||||
*/
|
|
||||||
private BigDecimal giveAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员充值退款 充值退款金额(线上退款+现金退款)
|
|
||||||
*/
|
|
||||||
private BigDecimal rechargeRefundAmount;
|
|
||||||
/**
|
|
||||||
* 会员充值退款 线上退款
|
|
||||||
*/
|
|
||||||
private BigDecimal onlineRechargeRefundAmount;
|
|
||||||
/**
|
|
||||||
* 会员充值退款 现金退款金额
|
|
||||||
*/
|
|
||||||
private BigDecimal cashRechargeRefundAmount;
|
|
||||||
/**
|
|
||||||
* 新增会员数
|
|
||||||
*/
|
|
||||||
private Long newMemberCount;
|
|
||||||
|
|
||||||
|
|
||||||
//*********************以下为客单价 翻台率 的计算********************************************************************************
|
|
||||||
/**
|
|
||||||
* 就餐人数
|
|
||||||
*/
|
|
||||||
private Long customerCount;
|
|
||||||
/**
|
|
||||||
* 订单数
|
|
||||||
*/
|
|
||||||
private Long orderCount;
|
|
||||||
/**
|
|
||||||
* 桌台数
|
|
||||||
*/
|
|
||||||
private Long tableCount;
|
|
||||||
/**
|
|
||||||
* 客单价
|
|
||||||
* 实付金额(包含现金支付 包含会员支付 包含挂账)/就餐人数
|
|
||||||
* 没有具体人数时,默认一桌按照1人计算
|
|
||||||
*/
|
|
||||||
private BigDecimal avgPayAmount;
|
|
||||||
/**
|
|
||||||
* 翻台率
|
|
||||||
* (订单数-桌台数)/桌台数*100%
|
|
||||||
*/
|
|
||||||
private BigDecimal turnoverRate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 毛利润(订单实付金额-商品成本)
|
|
||||||
*/
|
|
||||||
private BigDecimal profitAmount;
|
|
||||||
/**
|
|
||||||
* 商品成本
|
|
||||||
*/
|
|
||||||
private BigDecimal productCostAmount;
|
|
||||||
/**
|
|
||||||
* 毛利率(订单实付金额-商品成本)/订单实付金额*100%
|
|
||||||
*/
|
|
||||||
private BigDecimal profitRate;
|
|
||||||
/**
|
|
||||||
* 净利润
|
|
||||||
*/
|
|
||||||
private BigDecimal netProfitAmount;
|
|
||||||
/**
|
|
||||||
* 净利润率
|
|
||||||
*/
|
|
||||||
private BigDecimal netProfitRate;
|
|
||||||
|
|
||||||
|
|
||||||
//*********************以下为优惠金额********************************************************************************
|
|
||||||
/**
|
|
||||||
* 优惠总金额
|
|
||||||
*/
|
|
||||||
private BigDecimal discountAmount;
|
|
||||||
/**
|
|
||||||
* 优惠笔数
|
|
||||||
*/
|
|
||||||
private Long discountCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新客立减金额
|
|
||||||
*/
|
|
||||||
private BigDecimal newCustomerDiscountAmount;
|
|
||||||
/**
|
|
||||||
* 满减活动金额
|
|
||||||
*/
|
|
||||||
private BigDecimal fullDiscountAmount;
|
|
||||||
/**
|
|
||||||
* 优惠券抵扣金额
|
|
||||||
*/
|
|
||||||
private BigDecimal couponDiscountAmount;
|
|
||||||
/**
|
|
||||||
* 积分抵扣金额
|
|
||||||
*/
|
|
||||||
private BigDecimal pointDiscountAmount;
|
|
||||||
/**
|
|
||||||
* 霸王餐金额
|
|
||||||
*/
|
|
||||||
private BigDecimal backDiscountAmount;
|
|
||||||
/**
|
|
||||||
* 会员整单折扣金额
|
|
||||||
*/
|
|
||||||
private BigDecimal memberDiscountAmount;
|
|
||||||
/**
|
|
||||||
* 订单改价金额
|
|
||||||
*/
|
|
||||||
private BigDecimal orderPriceDiscountAmount;
|
|
||||||
|
|
||||||
|
|
||||||
//*********************以下为支付金额********************************************************************************
|
//*********************以下为支付金额********************************************************************************
|
||||||
/**
|
/**
|
||||||
* 现金支付金额
|
* 现金支付金额
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("现金支付金额")
|
||||||
private BigDecimal cashPayAmount;
|
private BigDecimal cashPayAmount;
|
||||||
/**
|
/**
|
||||||
* 现金支付笔数
|
* 现金支付笔数
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("现金支付笔数")
|
||||||
private Long cashPayCount;
|
private Long cashPayCount;
|
||||||
/**
|
/**
|
||||||
* 微信小程序支付金额
|
* 微信小程序支付金额
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("微信小程序支付金额")
|
||||||
private BigDecimal wechatPayAmount;
|
private BigDecimal wechatPayAmount;
|
||||||
/**
|
/**
|
||||||
* 微信小程序支付笔数
|
* 微信小程序支付笔数
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("微信小程序支付笔数")
|
||||||
private Long wechatPayCount;
|
private Long wechatPayCount;
|
||||||
/**
|
/**
|
||||||
* 支付宝小程序支付金额
|
* 支付宝小程序支付金额
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("支付宝小程序支付金额")
|
||||||
private BigDecimal alipayPayAmount;
|
private BigDecimal alipayPayAmount;
|
||||||
/**
|
/**
|
||||||
* 支付宝小程序支付笔数
|
* 支付宝小程序支付笔数
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("支付宝小程序支付笔数")
|
||||||
private Long alipayPayCount;
|
private Long alipayPayCount;
|
||||||
/**
|
/**
|
||||||
* 被扫收款金额
|
* 被扫收款金额
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("被扫收款金额")
|
||||||
private BigDecimal backScanPayAmount;
|
private BigDecimal backScanPayAmount;
|
||||||
/**
|
/**
|
||||||
* 被扫收款笔数
|
* 被扫收款笔数
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("被扫收款笔数")
|
||||||
private Long backScanPayCount;
|
private Long backScanPayCount;
|
||||||
/**
|
/**
|
||||||
* 主扫收款金额
|
* 主扫收款金额
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("主扫收款金额")
|
||||||
private BigDecimal mainScanPayAmount;
|
private BigDecimal mainScanPayAmount;
|
||||||
/**
|
/**
|
||||||
* 主扫收款笔数
|
* 主扫收款笔数
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("主扫收款笔数")
|
||||||
private Long mainScanPayCount;
|
private Long mainScanPayCount;
|
||||||
/**
|
/**
|
||||||
* 挂账支付金额
|
* 挂账支付金额
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("挂账支付金额")
|
||||||
private BigDecimal creditPayAmount;
|
private BigDecimal creditPayAmount;
|
||||||
/**
|
/**
|
||||||
* 挂账支付笔数
|
* 挂账支付笔数
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("挂账支付笔数")
|
||||||
private Long creditPayCount;
|
private Long creditPayCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员消费 会员订单支付金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员消费金额")
|
||||||
|
private BigDecimal memberPayAmount;
|
||||||
|
/**
|
||||||
|
* 会员消费笔数
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员消费笔数")
|
||||||
|
private Long memberPayCount;
|
||||||
|
|
||||||
|
//*********************以下为订单金额********************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线上付款金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("线上付款金额")
|
||||||
|
private BigDecimal onlinePayAmount;
|
||||||
|
/**
|
||||||
|
* 订单退款 退款金额(原路返回 现金退款)
|
||||||
|
*/
|
||||||
|
@ExcelProperty("订单退款金额")
|
||||||
|
private BigDecimal refundAmount;
|
||||||
|
/**
|
||||||
|
* 订单退款 线上退款金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("订单退款线上金额")
|
||||||
|
private BigDecimal onlineRefundAmount;
|
||||||
|
/**
|
||||||
|
* 订单退款 线下退款金额/现金退款金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("订单退款线下金额")
|
||||||
|
private BigDecimal cashRefundAmount;
|
||||||
|
/**
|
||||||
|
* 订单退款 会员退款金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("订单退款会员金额")
|
||||||
|
private BigDecimal memberRefundAmount;
|
||||||
|
|
||||||
|
|
||||||
|
//*********************以下为充值金额********************************************************************************
|
||||||
|
/**
|
||||||
|
* 会员充值 充值金额(包含现金支付) 不包括赠送 多店 按 主店算
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员充值金额")
|
||||||
|
private BigDecimal rechargeAmount;
|
||||||
|
/**
|
||||||
|
* 会员充值 线上充值金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员线上充值金额")
|
||||||
|
private BigDecimal onlineRechargeAmount;
|
||||||
|
/**
|
||||||
|
* 会员充值 现金充值金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员现金充值金额")
|
||||||
|
private BigDecimal cashRechargeAmount;
|
||||||
|
/**
|
||||||
|
* 会员充值 充值赠送金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员充值赠送金额")
|
||||||
|
private BigDecimal giveAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员充值退款 充值退款金额(线上退款+现金退款)
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员充值退款金额")
|
||||||
|
private BigDecimal rechargeRefundAmount;
|
||||||
|
/**
|
||||||
|
* 会员充值退款 线上退款
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员充值线上退款金额")
|
||||||
|
private BigDecimal onlineRechargeRefundAmount;
|
||||||
|
/**
|
||||||
|
* 会员充值退款 现金退款金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员充值线下退款金额")
|
||||||
|
private BigDecimal cashRechargeRefundAmount;
|
||||||
|
/**
|
||||||
|
* 新增会员数
|
||||||
|
*/
|
||||||
|
@ExcelProperty("新增会员数")
|
||||||
|
private Long newMemberCount;
|
||||||
|
|
||||||
|
|
||||||
|
//*********************以下为优惠金额********************************************************************************
|
||||||
|
/**
|
||||||
|
* 优惠总金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("优惠总金额")
|
||||||
|
private BigDecimal discountAmount;
|
||||||
|
/**
|
||||||
|
* 优惠笔数
|
||||||
|
*/
|
||||||
|
@ExcelProperty("优惠笔数")
|
||||||
|
private Long discountCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新客立减金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("新客立减金额")
|
||||||
|
private BigDecimal newCustomerDiscountAmount;
|
||||||
|
/**
|
||||||
|
* 满减活动金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("满减活动金额")
|
||||||
|
private BigDecimal fullDiscountAmount;
|
||||||
|
/**
|
||||||
|
* 优惠券抵扣金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("优惠券抵扣金额")
|
||||||
|
private BigDecimal couponDiscountAmount;
|
||||||
|
/**
|
||||||
|
* 积分抵扣金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("积分抵扣金额")
|
||||||
|
private BigDecimal pointDiscountAmount;
|
||||||
|
/**
|
||||||
|
* 霸王餐金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("霸王餐金额")
|
||||||
|
private BigDecimal backDiscountAmount;
|
||||||
|
/**
|
||||||
|
* 会员整单折扣金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员整单折扣金额")
|
||||||
|
private BigDecimal memberDiscountAmount;
|
||||||
|
/**
|
||||||
|
* 订单改价金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("订单改价金额")
|
||||||
|
private BigDecimal orderPriceDiscountAmount;
|
||||||
|
|
||||||
|
|
||||||
|
//*********************以下为客单价 翻台率 的计算********************************************************************************
|
||||||
|
/**
|
||||||
|
* 就餐人数
|
||||||
|
*/
|
||||||
|
@ExcelProperty("就餐人数")
|
||||||
|
private Long customerCount;
|
||||||
|
/**
|
||||||
|
* 订单数
|
||||||
|
*/
|
||||||
|
@ExcelProperty("订单数")
|
||||||
|
private Long orderCount;
|
||||||
|
/**
|
||||||
|
* 桌台数
|
||||||
|
*/
|
||||||
|
@ExcelProperty("桌台数")
|
||||||
|
private Long tableCount;
|
||||||
|
/**
|
||||||
|
* 客单价
|
||||||
|
* 实付金额(包含现金支付 包含会员支付 包含挂账)/就餐人数
|
||||||
|
* 没有具体人数时,默认一桌按照1人计算
|
||||||
|
*/
|
||||||
|
@ExcelProperty("客单价")
|
||||||
|
private BigDecimal avgPayAmount;
|
||||||
|
/**
|
||||||
|
* 翻台率
|
||||||
|
* (订单数-桌台数)/桌台数*100%
|
||||||
|
*/
|
||||||
|
@ExcelProperty("翻台率(%)")
|
||||||
|
private BigDecimal turnoverRate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 毛利润(订单实付金额-商品成本)
|
||||||
|
*/
|
||||||
|
@ExcelProperty("毛利率(%)")
|
||||||
|
private BigDecimal profitAmount;
|
||||||
|
/**
|
||||||
|
* 商品成本
|
||||||
|
*/
|
||||||
|
@ExcelProperty("商品成本")
|
||||||
|
private BigDecimal productCostAmount;
|
||||||
|
/**
|
||||||
|
* 毛利率(订单实付金额-商品成本)/订单实付金额*100%
|
||||||
|
*/
|
||||||
|
@ExcelProperty("利润率(%)")
|
||||||
|
private BigDecimal profitRate;
|
||||||
|
/**
|
||||||
|
* 净利润
|
||||||
|
*/
|
||||||
|
@ExcelProperty("净利润")
|
||||||
|
private BigDecimal netProfitAmount;
|
||||||
|
/**
|
||||||
|
* 净利润率
|
||||||
|
*/
|
||||||
|
@ExcelProperty("净利润率(%)")
|
||||||
|
private BigDecimal netProfitRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
@Column(onInsertValue = "now()")
|
@Column(onInsertValue = "now()")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
@Column(ignore = true)
|
@Column(ignore = true)
|
||||||
|
@ExcelIgnore
|
||||||
BigDecimal zero = BigDecimal.ZERO;
|
BigDecimal zero = BigDecimal.ZERO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否有效
|
* 是否有效
|
||||||
*/
|
*/
|
||||||
@Column(ignore = true)
|
@Column(ignore = true)
|
||||||
|
@ExcelIgnore
|
||||||
private Boolean valid = true;
|
private Boolean valid = true;
|
||||||
|
|
||||||
|
|
||||||
@@ -410,11 +472,19 @@ public class ShopOrderStatistic implements Serializable {
|
|||||||
* 合并两个统计对象
|
* 合并两个统计对象
|
||||||
*/
|
*/
|
||||||
public static ShopOrderStatistic mergeStatistics(ShopOrderStatistic stat1, ShopOrderStatistic stat2) {
|
public static ShopOrderStatistic mergeStatistics(ShopOrderStatistic stat1, ShopOrderStatistic stat2) {
|
||||||
if (stat2 == null) return stat1;
|
if (stat2 == null) {
|
||||||
if (stat1 == null) return stat2;
|
return stat1;
|
||||||
|
}
|
||||||
|
if (stat1 == null) {
|
||||||
|
return stat2;
|
||||||
|
}
|
||||||
|
|
||||||
if(!stat2.getValid()) return stat1;
|
if(!stat2.getValid()) {
|
||||||
if(!stat1.getValid()) return stat2;
|
return stat1;
|
||||||
|
}
|
||||||
|
if(!stat1.getValid()) {
|
||||||
|
return stat2;
|
||||||
|
}
|
||||||
|
|
||||||
ShopOrderStatistic result = new ShopOrderStatistic();
|
ShopOrderStatistic result = new ShopOrderStatistic();
|
||||||
|
|
||||||
@@ -477,8 +547,12 @@ public class ShopOrderStatistic implements Serializable {
|
|||||||
* 安全的BigDecimal相加
|
* 安全的BigDecimal相加
|
||||||
*/
|
*/
|
||||||
private static BigDecimal safeAdd(BigDecimal num1, BigDecimal num2) {
|
private static BigDecimal safeAdd(BigDecimal num1, BigDecimal num2) {
|
||||||
if (num1 == null) return num2;
|
if (num1 == null) {
|
||||||
if (num2 == null) return num1;
|
return num2;
|
||||||
|
}
|
||||||
|
if (num2 == null) {
|
||||||
|
return num1;
|
||||||
|
}
|
||||||
return num1.add(num2);
|
return num1.add(num2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -486,8 +560,12 @@ public class ShopOrderStatistic implements Serializable {
|
|||||||
* 安全的Long相加
|
* 安全的Long相加
|
||||||
*/
|
*/
|
||||||
private static Long safeAdd(Long num1, Long num2) {
|
private static Long safeAdd(Long num1, Long num2) {
|
||||||
if (num1 == null) return num2;
|
if (num1 == null) {
|
||||||
if (num2 == null) return num1;
|
return num2;
|
||||||
|
}
|
||||||
|
if (num2 == null) {
|
||||||
|
return num1;
|
||||||
|
}
|
||||||
return num1 + num2;
|
return num1 + num2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.czg.order.param;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 财务报表查询参数
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/2/2 10:23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class FinanceStsQueryParam implements Serializable {
|
||||||
|
|
||||||
|
public interface Query {}
|
||||||
|
public interface Export {}
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询日期 格式:yyyy-MM-dd
|
||||||
|
*/
|
||||||
|
@NotNull(message = "查询日期不能为空", groups = {Export.class, Query.class})
|
||||||
|
private LocalDate queryDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台
|
||||||
|
* czg 自己
|
||||||
|
* MTuan 美团
|
||||||
|
* CMeMe 菜么么
|
||||||
|
* KRuYun 客如云
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "平台不能为空", groups = {Export.class})
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
/**
|
||||||
|
* 主店id
|
||||||
|
*/
|
||||||
|
private Long mainShopId;
|
||||||
|
|
||||||
|
public boolean notValidDateRange() {
|
||||||
|
if (queryDate == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查开始日期是否晚于结束日期
|
||||||
|
return queryDate.isAfter(LocalDate.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.czg.order.service;
|
||||||
|
|
||||||
|
import com.czg.order.dto.FinanceStsDTO;
|
||||||
|
import com.czg.order.param.FinanceStsQueryParam;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/2/2 10:10
|
||||||
|
*/
|
||||||
|
public interface FinanceStsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询财务统计
|
||||||
|
*/
|
||||||
|
FinanceStsDTO getFinanceSts(FinanceStsQueryParam param);
|
||||||
|
|
||||||
|
void exportFinanceSts(FinanceStsQueryParam param, HttpServletResponse response);
|
||||||
|
}
|
||||||
@@ -131,7 +131,6 @@ public class AShopUserServiceImpl implements AShopUserService {
|
|||||||
public void exportUserList(String key, Integer isVip, HttpServletResponse response) {
|
public void exportUserList(String key, Integer isVip, HttpServletResponse response) {
|
||||||
Long mainIdByShopId = shopInfoService.getMainIdByShopId(StpKit.USER.getShopId());
|
Long mainIdByShopId = shopInfoService.getMainIdByShopId(StpKit.USER.getShopId());
|
||||||
ShopInfo shopInfo = shopInfoService.getById(StpKit.USER.getShopId());
|
ShopInfo shopInfo = shopInfoService.getById(StpKit.USER.getShopId());
|
||||||
PageHelper.startPage(PageUtil.buildPageHelp());
|
|
||||||
List<ShopUserDTO> dtoList = shopUserMapper.selectPageByKeyAndIsVip(mainIdByShopId, isVip, key, null);
|
List<ShopUserDTO> dtoList = shopUserMapper.selectPageByKeyAndIsVip(mainIdByShopId, isVip, key, null);
|
||||||
|
|
||||||
// 将 dtoList 转换为 ShopUserExportDTO 列表
|
// 将 dtoList 转换为 ShopUserExportDTO 列表
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package com.czg.service.order.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import com.czg.excel.ExcelExportUtil;
|
||||||
|
import com.czg.exception.CzgException;
|
||||||
|
import com.czg.order.dto.FinanceStsDTO;
|
||||||
|
import com.czg.order.entity.ShopOrderStatistic;
|
||||||
|
import com.czg.order.param.FinanceStsQueryParam;
|
||||||
|
import com.czg.order.service.FinanceStsService;
|
||||||
|
import com.czg.order.service.ShopOrderStatisticService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/2/2 10:11
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FinanceStsServiceImpl implements FinanceStsService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShopOrderStatisticService orderStatisticService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FinanceStsDTO getFinanceSts(FinanceStsQueryParam param) {
|
||||||
|
if (param.notValidDateRange()) {
|
||||||
|
throw new CzgException("日期范围无效");
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopOrderStatistic statistic = getStatisticData(param);
|
||||||
|
|
||||||
|
return new FinanceStsDTO()
|
||||||
|
.setDate(LocalDateTimeUtil.format(param.getQueryDate(), "yyyy-MM-dd"))
|
||||||
|
.setTurnover(new FinanceStsDTO.TurnoverSts()
|
||||||
|
.setTurnover(statistic.getPayAmount())
|
||||||
|
.setWechat(statistic.getWechatPayAmount())
|
||||||
|
.setAlipay(statistic.getAlipayPayAmount())
|
||||||
|
.setSelfScan(statistic.getMainScanPayAmount())
|
||||||
|
.setCash(statistic.getCashPayAmount())
|
||||||
|
.setRecharge(statistic.getRechargeAmount())
|
||||||
|
.setOwed(statistic.getCreditPayAmount())
|
||||||
|
.setBalance(statistic.getMemberPayAmount()))
|
||||||
|
.setOrder(new FinanceStsDTO.OrderSts()
|
||||||
|
.setOrderAmount(statistic.getPayAmount())
|
||||||
|
.setOrderCount(statistic.getOrderCount()))
|
||||||
|
.setDiscount(new FinanceStsDTO.DiscountSts()
|
||||||
|
.setDiscountAmount(statistic.getDiscountAmount())
|
||||||
|
.setDiscountCount(statistic.getDiscountCount())
|
||||||
|
.setNewConsumerDiscount(statistic.getNewCustomerDiscountAmount())
|
||||||
|
.setFreeCashAmount(statistic.getBackDiscountAmount())
|
||||||
|
.setFullMinusAmount(statistic.getFullDiscountAmount())
|
||||||
|
.setCouponAmount(statistic.getCouponDiscountAmount())
|
||||||
|
.setMemberDiscount(statistic.getMemberDiscountAmount())
|
||||||
|
.setPointsDiscountAmount(statistic.getPointDiscountAmount())
|
||||||
|
.setOrderDiscount(statistic.getOrderPriceDiscountAmount()))
|
||||||
|
.setRefund(new FinanceStsDTO.RefundSts()
|
||||||
|
.setRefundAmount(statistic.getRefundAmount())
|
||||||
|
.setOnlineRefundAmount(statistic.getOnlineRefundAmount())
|
||||||
|
.setCashRefundAmount(statistic.getCashRefundAmount())
|
||||||
|
.setRechargeRefundAmount(statistic.getRechargeRefundAmount())
|
||||||
|
.setOnlineRechargeRefundAmount(statistic.getOnlineRechargeRefundAmount())
|
||||||
|
.setCashRechargeRefundAmount(statistic.getCashRechargeRefundAmount())
|
||||||
|
.setMemberRefundAmount(statistic.getMemberRefundAmount()))
|
||||||
|
.setSts(new FinanceStsDTO.Sts()
|
||||||
|
.setCustomerCount(statistic.getCustomerCount())
|
||||||
|
.setOrderCount(statistic.getOrderCount())
|
||||||
|
.setTableCount(statistic.getTableCount())
|
||||||
|
.setAvgPayAmount(statistic.getAvgPayAmount())
|
||||||
|
.setTurnoverRate(statistic.getTurnoverRate())
|
||||||
|
.setProfitAmount(statistic.getProfitAmount())
|
||||||
|
.setProductCostAmount(statistic.getProductCostAmount())
|
||||||
|
.setProfitRate(statistic.getProfitRate())
|
||||||
|
.setNetProfitRate(statistic.getNetProfitRate())
|
||||||
|
.setNetProfitRate(statistic.getNetProfitRate()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exportFinanceSts(FinanceStsQueryParam param, HttpServletResponse response) {
|
||||||
|
if (param.notValidDateRange()) {
|
||||||
|
throw new CzgException("日期范围无效");
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopOrderStatistic statistic = getStatisticData(param);
|
||||||
|
|
||||||
|
if ("czg".equals(param.getPlatform())) {
|
||||||
|
ExcelExportUtil.exportToResponse(List.of(statistic), ShopOrderStatistic.class, "财务报表", response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new CzgException("平台不支持");
|
||||||
|
}
|
||||||
|
|
||||||
|
private ShopOrderStatistic getStatisticData(FinanceStsQueryParam param) {
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
if (param.getQueryDate().equals(today)) {
|
||||||
|
return orderStatisticService.getRealTimeDataByDay(param.getShopId(), param.getQueryDate());
|
||||||
|
}
|
||||||
|
return orderStatisticService.getStatSingleDate(param.getShopId(), param.getQueryDate());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -186,7 +186,7 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
|||||||
BigDecimal rechargeAmount = cashRechargeAmount.add(onlineRechargeAmount);
|
BigDecimal rechargeAmount = cashRechargeAmount.add(onlineRechargeAmount);
|
||||||
result.setRechargeAmount(rechargeAmount);
|
result.setRechargeAmount(rechargeAmount);
|
||||||
//会员充值退款 充值退款金额(线上退款+现金退款)
|
//会员充值退款 充值退款金额(线上退款+现金退款)
|
||||||
BigDecimal onlineRefundAmount = Objects.requireNonNullElse(
|
BigDecimal onlineRechargeRefundAmount = Objects.requireNonNullElse(
|
||||||
(onlineStat != null) ? onlineStat.getOnlineRechargeRefundAmount() : null,
|
(onlineStat != null) ? onlineStat.getOnlineRechargeRefundAmount() : null,
|
||||||
BigDecimal.ZERO
|
BigDecimal.ZERO
|
||||||
);
|
);
|
||||||
@@ -194,7 +194,9 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
|||||||
(userFlowStat != null) ? userFlowStat.getCashRechargeRefundAmount() : null,
|
(userFlowStat != null) ? userFlowStat.getCashRechargeRefundAmount() : null,
|
||||||
BigDecimal.ZERO
|
BigDecimal.ZERO
|
||||||
);
|
);
|
||||||
BigDecimal rechargeRefundAmountTotal = onlineRefundAmount.add(userFlowRefundAmount);
|
BigDecimal rechargeRefundAmountTotal = onlineRechargeRefundAmount.add(userFlowRefundAmount);
|
||||||
|
result.setOnlineRefundAmount(onlineStat == null ? BigDecimal.ZERO : onlineStat.getOnlineRefundAmount());
|
||||||
|
result.setOnlineRechargeRefundAmount(onlineStat == null ? BigDecimal.ZERO : onlineStat.getOnlineRechargeRefundAmount());
|
||||||
result.setRechargeRefundAmount(rechargeRefundAmountTotal);
|
result.setRechargeRefundAmount(rechargeRefundAmountTotal);
|
||||||
//实付金额 (线上付款 现金支付 会员支付 挂账)
|
//实付金额 (线上付款 现金支付 会员支付 挂账)
|
||||||
BigDecimal onlinePayAmount = (onlineStat != null)
|
BigDecimal onlinePayAmount = (onlineStat != null)
|
||||||
@@ -218,6 +220,9 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
|||||||
.add(creditPayAmount);
|
.add(creditPayAmount);
|
||||||
result.setPayAmount(totalPayAmount);
|
result.setPayAmount(totalPayAmount);
|
||||||
calculateShopOrderStatistic(result);
|
calculateShopOrderStatistic(result);
|
||||||
|
calculateProfitInfo(result);
|
||||||
|
calculateTurnoverRate(result);
|
||||||
|
calculateAvgPayAmount(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user