Compare commits
14 Commits
9da67fc67f
...
prod
| Author | SHA1 | Date | |
|---|---|---|---|
| ec1bc6a156 | |||
| a74e099346 | |||
| d6d6477c6d | |||
| e3f58e41ca | |||
| c04a5b8fb1 | |||
| ccc18fc229 | |||
| 4a6af60352 | |||
| f32212928a | |||
| 7d640b4f9c | |||
| 3fd032c1d0 | |||
| 6b0423a2ba | |||
| 9c69c8dcbc | |||
| 19ed77b35b | |||
| d1dd806204 |
@@ -40,8 +40,8 @@ public class ShopInfoController {
|
||||
@SaAdminCheckRole("管理员")
|
||||
@SaAdminCheckPermission(parentName = "店铺管理接口", value = "shopInfo:list", name = "店铺列表")
|
||||
@GetMapping
|
||||
public CzgResult<Page<ShopInfo>> get(PageDTO pageDTO, String profiles, String phone, String shopName, Integer status, Integer isHeadShop) {
|
||||
return CzgResult.success(shopInfoService.get(pageDTO, profiles, phone, shopName, status, isHeadShop));
|
||||
public CzgResult<Page<ShopInfo>> get(PageDTO pageDTO, String shopName, Integer status, Integer isHeadShop) {
|
||||
return CzgResult.success(shopInfoService.get(pageDTO, shopName, status, isHeadShop));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ADisGroupController {
|
||||
if (share == null) {
|
||||
return CzgResult.success(mkDistributionGroupService.save(group));
|
||||
} else {
|
||||
return CzgResult.success(mkDistributionGroupService.updateById(group, false));
|
||||
return CzgResult.success(mkDistributionGroupService.updateById(group));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,7 @@ public class AShareBaseController {
|
||||
if (share == null) {
|
||||
return CzgResult.success(mkShareBaseService.save(shareBase));
|
||||
} else {
|
||||
shareBase.setCreateTime(share.getCreateTime());
|
||||
return CzgResult.success(mkShareBaseService.updateById(shareBase, false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
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,11 +1,13 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.excel.ExcelExportUtil;
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.order.entity.ShopTableOrderStatistic;
|
||||
import com.czg.order.param.DataSummaryTradeParam;
|
||||
import com.czg.order.param.TableSummaryParam;
|
||||
import com.czg.order.service.ShopTableOrderStatisticService;
|
||||
import com.czg.order.service.TableSummaryService;
|
||||
import com.czg.order.vo.TableSummaryExportVo;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
@@ -181,11 +181,9 @@ public class OrderPayController {
|
||||
@PostMapping("/shopPayApi/js2Pay")
|
||||
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
public CzgResult<Map<String, Object>> js2PayOrder(HttpServletRequest request, @RequestBody OrderPayParamDTO payParam) {
|
||||
if ("alipay".equals(payParam.getPayType())) {
|
||||
if ("ALIPAY".equals(payParam.getPayType())) {
|
||||
payParam.setPayType(PayCst.Type.ALIPAY);
|
||||
} else if ("aliPay".equals(payParam.getPayType())) {
|
||||
payParam.setPayType(PayCst.Type.ALIPAY);
|
||||
} else if ("wechatPay".equals(payParam.getPayType())) {
|
||||
} else if ("WECHAT".equals(payParam.getPayType())) {
|
||||
payParam.setPayType(PayCst.Type.WECHAT);
|
||||
} else {
|
||||
throw new CzgException(payParam.getPayType() + "支付方式错误");
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.czg.config;
|
||||
|
||||
import cn.dev33.satoken.application.ApplicationInfo;
|
||||
import cn.dev33.satoken.config.SaTokenConfig;
|
||||
import cn.dev33.satoken.context.SaHolder;
|
||||
import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||
@@ -58,11 +57,14 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 注册路由拦截器,自定义认证规则
|
||||
registry.addInterceptor(new SaInterceptor(handler -> {
|
||||
log.info(SaHolder.getRequest().getRequestPath());
|
||||
// 重置根路径,防止satoken切割根路径导致匹配不到路径
|
||||
ApplicationInfo.routePrefix = "";
|
||||
|
||||
log.info("{}: {}", SaHolder.getRequest().getMethod(), SaHolder.getRequest().getRequestPath());
|
||||
if ("OPTIONS".equalsIgnoreCase(SaHolder.getRequest().getMethod())) {
|
||||
SaRouter.back();
|
||||
return;
|
||||
}
|
||||
SaRouter
|
||||
.match(r -> "OPTIONS".equalsIgnoreCase(SaHolder.getRequest().getMethod()))
|
||||
.stop()
|
||||
// 完全开放的路径(不需要任何认证)
|
||||
.match("/user/login", "/user/geo/**", "/user/home/**",
|
||||
"/user/dict/**", "/user/openId", "/admin/auth/**",
|
||||
|
||||
@@ -15,12 +15,6 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class ShopUserExportDTO {
|
||||
|
||||
/**
|
||||
* 主店铺Id
|
||||
*/
|
||||
@ExcelIgnore
|
||||
private Long mainShopId;
|
||||
|
||||
@ExcelProperty("手机号")
|
||||
private String phone;
|
||||
|
||||
@@ -105,14 +99,18 @@ public class ShopUserExportDTO {
|
||||
}
|
||||
|
||||
public String getDistributionShopsRemark() {
|
||||
if (StrUtil.isBlank(distributionShops)) {
|
||||
if (StrUtil.isBlank(distributionShops) || !distributionShops.contains("_")) {
|
||||
return "否";
|
||||
}
|
||||
|
||||
String[] split = distributionShops.split("_");
|
||||
if (split.length < 2) {
|
||||
return "否";
|
||||
}
|
||||
if ("0".equals(split[1])) {
|
||||
return "否";
|
||||
}
|
||||
|
||||
if (distributionShops.contains(mainShopId + "_1")) {
|
||||
return "是";
|
||||
}
|
||||
|
||||
return "否";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class ShopInfo implements Serializable {
|
||||
private String businessTime;
|
||||
|
||||
/**
|
||||
* probation试用版,release正式
|
||||
* trial试用版,release正式
|
||||
*/
|
||||
private String profiles;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public interface ShopInfoService extends IService<ShopInfo> {
|
||||
*/
|
||||
boolean checkSwitch(Long shopId, ShopSwitchTypeEnum switchType) throws ValidateException;
|
||||
|
||||
Page<ShopInfo> get(PageDTO pageDTO, String profiles, String phone, String shopName, Integer status, Integer isHeadShop);
|
||||
Page<ShopInfo> get(PageDTO pageDTO, String shopName, Integer status, Integer isHeadShop);
|
||||
|
||||
Page<ShopInfo> getShopByMainId(PageDTO pageDTO, String shopName, Integer status);
|
||||
|
||||
|
||||
@@ -1,258 +0,0 @@
|
||||
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,13 +1,11 @@
|
||||
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.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@@ -107,309 +105,249 @@ public class ShopOrderStatistic implements Serializable {
|
||||
* 主键ID
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
@ExcelIgnore
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
@ExcelIgnore
|
||||
private Long shopId;
|
||||
/**
|
||||
* 统计日期 yyyy-MM-dd
|
||||
*/
|
||||
@ExcelProperty("统计日期")
|
||||
@ColumnWidth(17)
|
||||
private LocalDate statisticDate;
|
||||
//*********************以下为订单金额********************************************************************************
|
||||
|
||||
/**
|
||||
* 订单金额 订单原金额
|
||||
*/
|
||||
@ExcelProperty("订单金额")
|
||||
private BigDecimal originAmount;
|
||||
|
||||
/**
|
||||
* 实付金额 (线上付款 现金支付 会员支付 挂账)
|
||||
*/
|
||||
@ExcelProperty("实付金额")
|
||||
private BigDecimal payAmount;
|
||||
|
||||
|
||||
//*********************以下为支付金额********************************************************************************
|
||||
/**
|
||||
* 现金支付金额
|
||||
*/
|
||||
@ExcelProperty("现金支付金额")
|
||||
private BigDecimal cashPayAmount;
|
||||
/**
|
||||
* 现金支付笔数
|
||||
*/
|
||||
@ExcelProperty("现金支付笔数")
|
||||
private Long cashPayCount;
|
||||
/**
|
||||
* 微信小程序支付金额
|
||||
*/
|
||||
@ExcelProperty("微信小程序支付金额")
|
||||
private BigDecimal wechatPayAmount;
|
||||
/**
|
||||
* 微信小程序支付笔数
|
||||
*/
|
||||
@ExcelProperty("微信小程序支付笔数")
|
||||
private Long wechatPayCount;
|
||||
/**
|
||||
* 支付宝小程序支付金额
|
||||
*/
|
||||
@ExcelProperty("支付宝小程序支付金额")
|
||||
private BigDecimal alipayPayAmount;
|
||||
/**
|
||||
* 支付宝小程序支付笔数
|
||||
*/
|
||||
@ExcelProperty("支付宝小程序支付笔数")
|
||||
private Long alipayPayCount;
|
||||
/**
|
||||
* 被扫收款金额
|
||||
*/
|
||||
@ExcelProperty("被扫收款金额")
|
||||
private BigDecimal backScanPayAmount;
|
||||
/**
|
||||
* 被扫收款笔数
|
||||
*/
|
||||
@ExcelProperty("被扫收款笔数")
|
||||
private Long backScanPayCount;
|
||||
/**
|
||||
* 主扫收款金额
|
||||
*/
|
||||
@ExcelProperty("主扫收款金额")
|
||||
private BigDecimal mainScanPayAmount;
|
||||
/**
|
||||
* 主扫收款笔数
|
||||
*/
|
||||
@ExcelProperty("主扫收款笔数")
|
||||
private Long mainScanPayCount;
|
||||
/**
|
||||
* 挂账支付金额
|
||||
*/
|
||||
@ExcelProperty("挂账支付金额")
|
||||
private BigDecimal creditPayAmount;
|
||||
/**
|
||||
* 挂账支付笔数
|
||||
*/
|
||||
@ExcelProperty("挂账支付笔数")
|
||||
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;
|
||||
|
||||
/**
|
||||
* 会员消费 会员订单支付金额
|
||||
*/
|
||||
private BigDecimal memberPayAmount;
|
||||
/**
|
||||
* 会员消费笔数
|
||||
*/
|
||||
private Long memberPayCount;
|
||||
|
||||
|
||||
//*********************以下为充值金额********************************************************************************
|
||||
/**
|
||||
* 会员充值 充值金额(包含现金支付) 不包括赠送 多店 按 主店算
|
||||
*/
|
||||
@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;
|
||||
|
||||
|
||||
//*********************以下为优惠金额********************************************************************************
|
||||
/**
|
||||
* 优惠总金额
|
||||
*/
|
||||
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;
|
||||
|
||||
|
||||
//*********************以下为支付金额********************************************************************************
|
||||
/**
|
||||
* 现金支付金额
|
||||
*/
|
||||
private BigDecimal cashPayAmount;
|
||||
/**
|
||||
* 现金支付笔数
|
||||
*/
|
||||
private Long cashPayCount;
|
||||
/**
|
||||
* 微信小程序支付金额
|
||||
*/
|
||||
private BigDecimal wechatPayAmount;
|
||||
/**
|
||||
* 微信小程序支付笔数
|
||||
*/
|
||||
private Long wechatPayCount;
|
||||
/**
|
||||
* 支付宝小程序支付金额
|
||||
*/
|
||||
private BigDecimal alipayPayAmount;
|
||||
/**
|
||||
* 支付宝小程序支付笔数
|
||||
*/
|
||||
private Long alipayPayCount;
|
||||
/**
|
||||
* 被扫收款金额
|
||||
*/
|
||||
private BigDecimal backScanPayAmount;
|
||||
/**
|
||||
* 被扫收款笔数
|
||||
*/
|
||||
private Long backScanPayCount;
|
||||
/**
|
||||
* 主扫收款金额
|
||||
*/
|
||||
private BigDecimal mainScanPayAmount;
|
||||
/**
|
||||
* 主扫收款笔数
|
||||
*/
|
||||
private Long mainScanPayCount;
|
||||
/**
|
||||
* 挂账支付金额
|
||||
*/
|
||||
private BigDecimal creditPayAmount;
|
||||
/**
|
||||
* 挂账支付笔数
|
||||
*/
|
||||
private Long creditPayCount;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ExcelIgnore
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ExcelIgnore
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Column(ignore = true)
|
||||
@ExcelIgnore
|
||||
BigDecimal zero = BigDecimal.ZERO;
|
||||
|
||||
/**
|
||||
* 是否有效
|
||||
*/
|
||||
@Column(ignore = true)
|
||||
@ExcelIgnore
|
||||
private Boolean valid = true;
|
||||
|
||||
|
||||
@@ -472,19 +410,11 @@ public class ShopOrderStatistic implements Serializable {
|
||||
* 合并两个统计对象
|
||||
*/
|
||||
public static ShopOrderStatistic mergeStatistics(ShopOrderStatistic stat1, ShopOrderStatistic stat2) {
|
||||
if (stat2 == null) {
|
||||
return stat1;
|
||||
}
|
||||
if (stat1 == null) {
|
||||
return stat2;
|
||||
}
|
||||
if (stat2 == null) return stat1;
|
||||
if (stat1 == null) return stat2;
|
||||
|
||||
if(!stat2.getValid()) {
|
||||
return stat1;
|
||||
}
|
||||
if(!stat1.getValid()) {
|
||||
return stat2;
|
||||
}
|
||||
if(!stat2.getValid()) return stat1;
|
||||
if(!stat1.getValid()) return stat2;
|
||||
|
||||
ShopOrderStatistic result = new ShopOrderStatistic();
|
||||
|
||||
@@ -547,12 +477,8 @@ public class ShopOrderStatistic implements Serializable {
|
||||
* 安全的BigDecimal相加
|
||||
*/
|
||||
private static BigDecimal safeAdd(BigDecimal num1, BigDecimal num2) {
|
||||
if (num1 == null) {
|
||||
return num2;
|
||||
}
|
||||
if (num2 == null) {
|
||||
return num1;
|
||||
}
|
||||
if (num1 == null) return num2;
|
||||
if (num2 == null) return num1;
|
||||
return num1.add(num2);
|
||||
}
|
||||
|
||||
@@ -560,12 +486,8 @@ public class ShopOrderStatistic implements Serializable {
|
||||
* 安全的Long相加
|
||||
*/
|
||||
private static Long safeAdd(Long num1, Long num2) {
|
||||
if (num1 == null) {
|
||||
return num2;
|
||||
}
|
||||
if (num2 == null) {
|
||||
return num1;
|
||||
}
|
||||
if (num1 == null) return num2;
|
||||
if (num2 == null) return num1;
|
||||
return num1 + num2;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
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,6 +131,7 @@ public class AShopUserServiceImpl implements AShopUserService {
|
||||
public void exportUserList(String key, Integer isVip, HttpServletResponse response) {
|
||||
Long mainIdByShopId = shopInfoService.getMainIdByShopId(StpKit.USER.getShopId());
|
||||
ShopInfo shopInfo = shopInfoService.getById(StpKit.USER.getShopId());
|
||||
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||
List<ShopUserDTO> dtoList = shopUserMapper.selectPageByKeyAndIsVip(mainIdByShopId, isVip, key, null);
|
||||
|
||||
// 将 dtoList 转换为 ShopUserExportDTO 列表
|
||||
|
||||
@@ -113,14 +113,8 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ShopInfo> get(PageDTO pageDTO, String profiles, String phone, String shopName, Integer status, Integer isHeadShop) {
|
||||
public Page<ShopInfo> get(PageDTO pageDTO, String shopName, Integer status, Integer isHeadShop) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
if (StrUtil.isNotBlank(profiles)) {
|
||||
queryWrapper.eq(ShopInfo::getProfiles, profiles);
|
||||
}
|
||||
if (StrUtil.isNotBlank(phone)) {
|
||||
queryWrapper.like(ShopInfo::getPhone, phone);
|
||||
}
|
||||
if (StrUtil.isNotBlank(shopName)) {
|
||||
queryWrapper.like(ShopInfo::getShopName, shopName);
|
||||
}
|
||||
@@ -131,8 +125,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||
queryWrapper.eq(ShopInfo::getIsHeadShop, isHeadShop);
|
||||
}
|
||||
|
||||
List<ShopInfo> shopAllList = getMapper().selectListByQuery(query().select(ShopInfo::getId, ShopInfo::getShopName)
|
||||
.eq(ShopInfo::getIsHeadShop, 1).ne(ShopInfo::getShopType, ShopTypeEnum.ONLY.getValue()));
|
||||
List<ShopInfo> shopAllList = getMapper().selectListByQuery(query().select(ShopInfo::getId, ShopInfo::getShopName));
|
||||
Map<Long, String> shopKv = shopAllList.stream().collect(Collectors.toMap(ShopInfo::getId, ShopInfo::getShopName));
|
||||
queryWrapper.orderBy(ShopInfo::getCreateTime, false);
|
||||
Page<ShopInfo> page = page(new Page<>(pageDTO.page(), pageDTO.size()), queryWrapper);
|
||||
|
||||
@@ -62,7 +62,9 @@ public class MkShareBaseServiceImpl extends ServiceImpl<MkShareBaseMapper, MkSha
|
||||
}
|
||||
//绑定上下级
|
||||
if (StrUtil.isNotBlank(inviteCode)) {
|
||||
FunUtils.safeRunVoid(() -> distributionUserService.bindInviteUser(fromUserId, toUserId, shopId), "shareClaim 绑定上下级");
|
||||
FunUtils.safeRunVoid(() -> {
|
||||
distributionUserService.bindInviteUser(fromUserId, toUserId, shopId);
|
||||
}, "shareClaim绑定上下级");
|
||||
}
|
||||
MkShareBase shareBase = getById(shopId);
|
||||
if (shareBase == null || !shareBase.getIsEnabled().equals(1) || StrUtil.isBlank(shareBase.getRewardSharePages())) {
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
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);
|
||||
result.setRechargeAmount(rechargeAmount);
|
||||
//会员充值退款 充值退款金额(线上退款+现金退款)
|
||||
BigDecimal onlineRechargeRefundAmount = Objects.requireNonNullElse(
|
||||
BigDecimal onlineRefundAmount = Objects.requireNonNullElse(
|
||||
(onlineStat != null) ? onlineStat.getOnlineRechargeRefundAmount() : null,
|
||||
BigDecimal.ZERO
|
||||
);
|
||||
@@ -194,9 +194,7 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
||||
(userFlowStat != null) ? userFlowStat.getCashRechargeRefundAmount() : null,
|
||||
BigDecimal.ZERO
|
||||
);
|
||||
BigDecimal rechargeRefundAmountTotal = onlineRechargeRefundAmount.add(userFlowRefundAmount);
|
||||
result.setOnlineRefundAmount(onlineStat == null ? BigDecimal.ZERO : onlineStat.getOnlineRefundAmount());
|
||||
result.setOnlineRechargeRefundAmount(onlineStat == null ? BigDecimal.ZERO : onlineStat.getOnlineRechargeRefundAmount());
|
||||
BigDecimal rechargeRefundAmountTotal = onlineRefundAmount.add(userFlowRefundAmount);
|
||||
result.setRechargeRefundAmount(rechargeRefundAmountTotal);
|
||||
//实付金额 (线上付款 现金支付 会员支付 挂账)
|
||||
BigDecimal onlinePayAmount = (onlineStat != null)
|
||||
@@ -220,9 +218,6 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
||||
.add(creditPayAmount);
|
||||
result.setPayAmount(totalPayAmount);
|
||||
calculateShopOrderStatistic(result);
|
||||
calculateProfitInfo(result);
|
||||
calculateTurnoverRate(result);
|
||||
calculateAvgPayAmount(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user