Compare commits
12 Commits
534afeded6
...
prod
| Author | SHA1 | Date | |
|---|---|---|---|
| fa33586aae | |||
| ff27979337 | |||
| 29681c0ae2 | |||
| be476453a4 | |||
| 49a15e33a9 | |||
| 2a9a9d0438 | |||
| 65bd5b7ed9 | |||
| 7b948b514a | |||
| be37a2d92b | |||
| bf8be19afd | |||
| 06fa5b4f0d | |||
| 3b15bc444b |
@@ -7,7 +7,6 @@ import com.czg.account.service.HandoverRecordService;
|
||||
import com.czg.account.vo.HandoverProductListVo;
|
||||
import com.czg.account.vo.HandoverTotalVo;
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.constants.SystemConstants;
|
||||
import com.czg.excel.ExcelExportUtil;
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.resp.CzgResult;
|
||||
@@ -38,7 +37,6 @@ public class HandoverRecordController {
|
||||
* @param endDate 结束时间 格式:yyyy-MM-dd
|
||||
*/
|
||||
@GetMapping("page")
|
||||
@OperationLog("交班记录-分页")
|
||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:page", name = "交班记录-分页")
|
||||
public CzgResult<Page<HandoverRecordDTO>> page(@RequestParam(required = false) String beginDate, @RequestParam(required = false) String endDate) {
|
||||
Page<HandoverRecordDTO> page = handoverRecordService.getHandoverRecordPage(beginDate, endDate);
|
||||
@@ -46,20 +44,33 @@ public class HandoverRecordController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 交班记录-查看
|
||||
* 交班记录-详情
|
||||
*
|
||||
* @param id 交班记录ID
|
||||
*/
|
||||
@GetMapping("/detail/{id}")
|
||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:detail", name = "交班记录-详情")
|
||||
public CzgResult<HandoverRecordDTO> detail(@PathVariable Long id) {
|
||||
HandoverRecord entity = handoverRecordService.getById(id);
|
||||
HandoverRecordDTO data = BeanUtil.copyProperties(entity, HandoverRecordDTO.class);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 交班记录-商品详情
|
||||
*
|
||||
* @param id 交班记录ID
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
@OperationLog("交班记录-查看")
|
||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:info", name = "交班记录-查看")
|
||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:detail", name = "交班记录-详情")
|
||||
public CzgResult<List<HandoverProductListVo>> info(@PathVariable Long id) {
|
||||
List<HandoverProductListVo> data = handoverRecordService.getHandoverProductListById(id);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 交班记录-导出
|
||||
* 交班记录-商品详情导出
|
||||
*
|
||||
* @param id 交班记录ID
|
||||
*/
|
||||
@@ -71,13 +82,13 @@ public class HandoverRecordController {
|
||||
ExcelExportUtil.exportToResponse(list, HandoverProductListVo.class, "交班售出商品明细", response);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 收银机-交班数据统计
|
||||
* 收银机-实时交班数据
|
||||
*/
|
||||
@GetMapping("total")
|
||||
@OperationLog("收银机-交班数据统计")
|
||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:total", name = "收银机-交班数据统计")
|
||||
public CzgResult<HandoverTotalVo> total() {
|
||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:realTime", name = "收银机-实时交班数据")
|
||||
public CzgResult<HandoverTotalVo> realTime() {
|
||||
HandoverTotalVo data = handoverRecordService.totalHandoverData();
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
@@ -92,35 +103,7 @@ public class HandoverRecordController {
|
||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:handover", name = "收银机-交班/关班")
|
||||
public CzgResult<Long> handover(@RequestParam Integer isPrint) {
|
||||
Long id = handoverRecordService.handover();
|
||||
handoverRecordService.printHandoverReceipt(id, isPrint);
|
||||
return CzgResult.success(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 收银机-交班/关班-网络打印机打印交班小票
|
||||
*
|
||||
* @param id 交班记录id
|
||||
*/
|
||||
@PostMapping("/network/print/{id}")
|
||||
@OperationLog("收银机-交班/关班-网络打印机打印交班小票")
|
||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:networkPrint", name = "收银机-交班/关班-网络打印机打印交班小票")
|
||||
public CzgResult<Void> handover(@PathVariable Long id) {
|
||||
handoverRecordService.printHandoverReceipt(id, SystemConstants.OneZero.ONE);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 交班记录-详情
|
||||
*
|
||||
* @param id 交班记录ID
|
||||
*/
|
||||
@GetMapping("/detail/{id}")
|
||||
@OperationLog("交班记录-详情")
|
||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:detail", name = "交班记录-详情")
|
||||
public CzgResult<HandoverRecordDTO> detail(@PathVariable Long id) {
|
||||
HandoverRecord entity = handoverRecordService.getById(id);
|
||||
HandoverRecordDTO data = BeanUtil.copyProperties(entity, HandoverRecordDTO.class);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -50,20 +50,28 @@ public class RabbitPublisher {
|
||||
sendMsg(RabbitConstants.Queue.ORDER_REFUND_QUEUE, refundMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 后付费订单打印消息
|
||||
*
|
||||
* @param orderId 订单id
|
||||
*/
|
||||
public void sendOrderPrintMsg(String orderId, boolean printOrder, String source) {
|
||||
log.info("订单打印消息, orderId: {}, printOrder: {}, source: {}", orderId, printOrder, source);
|
||||
//结算票 预结算单 客看单
|
||||
if (printOrder) {
|
||||
sendMsg(RabbitConstants.Queue.ORDER_PRINT_QUEUE, orderId);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 订单打印消息
|
||||
*
|
||||
* @param orderId 订单id
|
||||
* @param printOrder 是否打印结算单
|
||||
*/
|
||||
public void sendOrderPrintMsg(String orderId, boolean printOrder, String source) {
|
||||
log.info("开始发送打印mq消息, orderId: {}, printOrder: {}, source: {}", orderId, printOrder, source);
|
||||
public void sendKitchenOrderPrintMsg(String orderId, boolean printOrder, String source) {
|
||||
log.info("厨房打印消息, orderId: {}, printOrder: {}, source: {}", orderId, printOrder, source);
|
||||
//厨房票
|
||||
sendMsg(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE, new JSONObject().fluentPut("orderId", orderId).fluentPut("printOrder", printOrder).toString());
|
||||
//前台票
|
||||
if (printOrder) {
|
||||
sendMsg(RabbitConstants.Queue.ORDER_PRINT_QUEUE, orderId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,30 +53,64 @@ public class HandoverRecordDTO implements Serializable {
|
||||
* 员工姓名
|
||||
*/
|
||||
private String staffName;
|
||||
|
||||
/**
|
||||
* 当班总收入
|
||||
* 营业额
|
||||
*/
|
||||
private BigDecimal handAmount;
|
||||
private BigDecimal turnover;
|
||||
/**
|
||||
* 现金收入
|
||||
* 订单额
|
||||
*/
|
||||
private BigDecimal cashAmount;
|
||||
private BigDecimal orderTurnover;
|
||||
|
||||
/**
|
||||
* 微信收入
|
||||
* 现金收款 cash_pay
|
||||
*/
|
||||
private BigDecimal wechatAmount;
|
||||
private BigDecimal cash;
|
||||
/**
|
||||
* 支付宝收入
|
||||
* 微信支付金额 wechat_mini
|
||||
*/
|
||||
private BigDecimal alipayAmount;
|
||||
private BigDecimal wechat;
|
||||
|
||||
/**
|
||||
* 会员支付
|
||||
* 支付宝支付金额 alipay_mini
|
||||
*/
|
||||
private BigDecimal vipPay;
|
||||
private BigDecimal alipay;
|
||||
|
||||
/**
|
||||
* 会员充值
|
||||
* 二维码收款 main_scan
|
||||
*/
|
||||
private BigDecimal vipRecharge;
|
||||
private BigDecimal selfScan;
|
||||
/**
|
||||
* 扫码收款 back_scan
|
||||
*/
|
||||
private BigDecimal barScan;
|
||||
|
||||
/**
|
||||
* 充值
|
||||
*/
|
||||
private BigDecimal recharge;
|
||||
|
||||
/**
|
||||
* 挂账 credit_pay
|
||||
*/
|
||||
private BigDecimal owed;
|
||||
|
||||
/**
|
||||
* 余额支付 vip_pay
|
||||
*/
|
||||
private BigDecimal balance;
|
||||
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
/**
|
||||
* 退菜数量
|
||||
*/
|
||||
private BigDecimal returnDishCount;
|
||||
|
||||
/**
|
||||
* 分类数据 json
|
||||
*/
|
||||
@@ -87,18 +121,7 @@ public class HandoverRecordDTO implements Serializable {
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
private String productData;
|
||||
/**
|
||||
* 快捷收款金额
|
||||
*/
|
||||
private BigDecimal quickInAmount;
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
/**
|
||||
* 挂账金额
|
||||
*/
|
||||
private BigDecimal creditAmount;
|
||||
|
||||
/**
|
||||
* 订单数量
|
||||
*/
|
||||
@@ -124,11 +147,4 @@ public class HandoverRecordDTO implements Serializable {
|
||||
*/
|
||||
private List<HandoverProductListVo> productDataList;
|
||||
|
||||
public List<HandoverCategoryListVo> getCategoryDataList() {
|
||||
return JSON.parseArray(categoryData, HandoverCategoryListVo.class);
|
||||
}
|
||||
|
||||
public List<HandoverProductListVo> getProductDataList() {
|
||||
return JSON.parseArray(productData, HandoverProductListVo.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,30 +53,69 @@ public class HandoverRecord implements Serializable {
|
||||
* 员工姓名
|
||||
*/
|
||||
private String staffName;
|
||||
|
||||
/**
|
||||
* 当班总收入
|
||||
* 营业额
|
||||
*/
|
||||
private BigDecimal handAmount;
|
||||
private BigDecimal turnover;
|
||||
/**
|
||||
* 现金收入
|
||||
* 订单额
|
||||
*/
|
||||
private BigDecimal cashAmount;
|
||||
private BigDecimal orderTurnover;
|
||||
|
||||
/**
|
||||
* 微信收入
|
||||
* 现金收款 cash_pay
|
||||
*/
|
||||
private BigDecimal wechatAmount;
|
||||
private BigDecimal cash;
|
||||
/**
|
||||
* 支付宝收入
|
||||
* 微信支付金额 wechat_mini
|
||||
*/
|
||||
private BigDecimal alipayAmount;
|
||||
private BigDecimal wechat;
|
||||
|
||||
/**
|
||||
* 会员支付
|
||||
* 支付宝支付金额 alipay_mini
|
||||
*/
|
||||
private BigDecimal vipPay;
|
||||
private BigDecimal alipay;
|
||||
|
||||
/**
|
||||
* 会员充值
|
||||
* 二维码收款 main_scan
|
||||
*/
|
||||
private BigDecimal vipRecharge;
|
||||
private BigDecimal selfScan;
|
||||
/**
|
||||
* 扫码收款 back_scan
|
||||
*/
|
||||
private BigDecimal barScan;
|
||||
|
||||
/**
|
||||
* 挂账 credit_pay
|
||||
*/
|
||||
private BigDecimal owed;
|
||||
|
||||
/**
|
||||
* 余额支付 vip_pay
|
||||
*/
|
||||
private BigDecimal balance;
|
||||
|
||||
/**
|
||||
* 充值
|
||||
*/
|
||||
private BigDecimal recharge;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
/**
|
||||
* 退菜数量
|
||||
*/
|
||||
private BigDecimal returnDishCount;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 订单数量
|
||||
*/
|
||||
private Integer orderCount;
|
||||
/**
|
||||
* 分类数据 json
|
||||
*/
|
||||
@@ -85,20 +124,4 @@ public class HandoverRecord implements Serializable {
|
||||
* 商品数据 json
|
||||
*/
|
||||
private String productData;
|
||||
/**
|
||||
* 快捷收款金额
|
||||
*/
|
||||
private BigDecimal quickInAmount;
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
/**
|
||||
* 挂账金额
|
||||
*/
|
||||
private BigDecimal creditAmount;
|
||||
/**
|
||||
* 订单数量
|
||||
*/
|
||||
private Integer orderCount;
|
||||
}
|
||||
@@ -55,17 +55,62 @@ public class HandoverTotalVo implements Serializable {
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime handoverTime;
|
||||
/**
|
||||
* 现金支付
|
||||
* 营业额
|
||||
*/
|
||||
private BigDecimal cashAmount;
|
||||
private BigDecimal turnover;
|
||||
/**
|
||||
* 订单额
|
||||
*/
|
||||
private BigDecimal orderTurnover;
|
||||
|
||||
/**
|
||||
* 现金收款 cash_pay
|
||||
*/
|
||||
private BigDecimal cash;
|
||||
/**
|
||||
* 微信支付金额 wechat_mini
|
||||
*/
|
||||
private BigDecimal wechat;
|
||||
|
||||
/**
|
||||
* 支付宝支付金额 alipay_mini
|
||||
*/
|
||||
private BigDecimal alipay;
|
||||
|
||||
/**
|
||||
* 二维码收款 main_scan
|
||||
*/
|
||||
private BigDecimal selfScan;
|
||||
/**
|
||||
* 扫码收款 back_scan
|
||||
*/
|
||||
private BigDecimal barScan;
|
||||
|
||||
/**
|
||||
* 充值
|
||||
*/
|
||||
private BigDecimal recharge;
|
||||
|
||||
/**
|
||||
* 挂账 credit_pay
|
||||
*/
|
||||
private BigDecimal owed;
|
||||
|
||||
/**
|
||||
* 余额支付 vip_pay
|
||||
*/
|
||||
private BigDecimal balance;
|
||||
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
/**
|
||||
* 当班总收入(营业额)
|
||||
* 退菜数量
|
||||
*/
|
||||
private BigDecimal handAmount;
|
||||
private BigDecimal returnDishCount;
|
||||
|
||||
/**
|
||||
* 订单数量
|
||||
*/
|
||||
@@ -74,4 +119,8 @@ public class HandoverTotalVo implements Serializable {
|
||||
* 售出商品列表
|
||||
*/
|
||||
private List<HandoverProductListVo> detailList;
|
||||
/**
|
||||
* 售出商品分类列表
|
||||
*/
|
||||
private List<HandoverCategoryListVo> categoryList;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,10 @@ public class OrderInfoRefundDTO implements Serializable {
|
||||
* 是否是现金退款
|
||||
*/
|
||||
private boolean cash;
|
||||
/**
|
||||
* 是否打印退菜/退款票
|
||||
*/
|
||||
private boolean print;
|
||||
|
||||
private String refundReason;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.czg.order.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.account.entity.HandoverRecord;
|
||||
import com.czg.account.vo.HandoverCategoryListVo;
|
||||
import com.czg.account.vo.HandoverProductListVo;
|
||||
|
||||
@@ -15,126 +16,6 @@ import java.util.List;
|
||||
*/
|
||||
public interface OrderInfoRpcService {
|
||||
|
||||
/**
|
||||
* 交班现金支付统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 现金支付总额
|
||||
*/
|
||||
BigDecimal getHandoverCashAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班微信支付统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 现金支付总额
|
||||
*/
|
||||
BigDecimal getHandoverWechatAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班支付宝支付统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 支付宝支付总额
|
||||
*/
|
||||
BigDecimal getHandoverAlipayAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班VIP支付统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return VIP支付总额
|
||||
*/
|
||||
BigDecimal getHandoverVipPayAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班VIP充值统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return VIP充值总额
|
||||
*/
|
||||
BigDecimal getHandoverVipChargeAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班快捷支付统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 快捷支付总额
|
||||
*/
|
||||
BigDecimal getHandoverQuickPayAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班退款统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 退款总额
|
||||
*/
|
||||
BigDecimal getHandoverRefundAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班挂账统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 挂账总额
|
||||
*/
|
||||
BigDecimal getHandoverCreditAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班营业额统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 营业额
|
||||
*/
|
||||
BigDecimal getHandoverTotalAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班订单数统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 交班订单数
|
||||
*/
|
||||
int getHandoverOrderNum(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班售出商品明细
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 交班售出商品明细
|
||||
*/
|
||||
List<HandoverProductListVo> getHandoverDetailList(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班售出商品分类统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 售出商品分类统计
|
||||
*/
|
||||
List<HandoverCategoryListVo> getHandoverCategoryList(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 订单支付成功回调 扣减商品库存及耗材库存
|
||||
*
|
||||
@@ -162,4 +43,44 @@ public interface OrderInfoRpcService {
|
||||
* @param handoverRecordId 交班记录id
|
||||
*/
|
||||
void sendHandoverReceiptPrintMsgToMq(Long handoverRecordId);
|
||||
|
||||
/**
|
||||
* 交班售出商品明细
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 交班售出商品明细
|
||||
*/
|
||||
List<HandoverProductListVo> getHandoverDetailList(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班售出商品分类统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 售出商品分类统计
|
||||
*/
|
||||
List<HandoverCategoryListVo> getHandoverCategoryList(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------->
|
||||
|
||||
/**
|
||||
* 支付金额统计
|
||||
* 营业额为 订单收款额度 不包括充值
|
||||
*/
|
||||
HandoverRecord getOnlinePayTypeDate(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 订单退菜数量
|
||||
*/
|
||||
BigDecimal countReturnDish(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 会员充值金额 退款金额
|
||||
*/
|
||||
HandoverRecord countShopUserFlow(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public enum ShopUserFlowBizEnum {
|
||||
// 会员充值
|
||||
CASH_IN("cashIn", "会员充值"),
|
||||
CASHBACK("cashback", "消费返现"),
|
||||
CASHBACK_REFUND("cashback_refund", "消费返现扣减"),
|
||||
CASHBACK_REFUND("cashbackRefund", "消费返现扣减"),
|
||||
|
||||
FREE_IN("freeIn", "霸王餐充值"),
|
||||
// 重置奖励
|
||||
@@ -21,7 +21,7 @@ public enum ShopUserFlowBizEnum {
|
||||
// 支付宝小程序重置
|
||||
ALIPAY_IN("alipayIn", "支付宝小程序充值"),
|
||||
// 订单支付奖励
|
||||
ORDER_PAY("orderPay", "订单支付奖励"),
|
||||
ORDER_PAY("orderPay", "订单支付"),
|
||||
// 订单退款
|
||||
ORDER_REFUND("orderRefund", "订单退款"),
|
||||
// 充值退款
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
@@ -13,6 +15,7 @@ import com.czg.account.vo.HandoverCategoryListVo;
|
||||
import com.czg.account.vo.HandoverProductListVo;
|
||||
import com.czg.account.vo.HandoverTotalVo;
|
||||
import com.czg.constants.SystemConstants;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.order.service.OrderInfoRpcService;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.account.mapper.HandoverRecordMapper;
|
||||
@@ -24,7 +27,6 @@ import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@@ -40,53 +42,40 @@ public class HandoverRecordServiceImpl extends ServiceImpl<HandoverRecordMapper,
|
||||
@DubboReference
|
||||
private OrderInfoRpcService orderInfoRpcService;
|
||||
|
||||
private QueryWrapper buildQueryWrapper(HandoverRecordDTO param) {
|
||||
QueryWrapper queryWrapper = PageUtil.buildSortQueryWrapper();
|
||||
if (StrUtil.isNotEmpty(param.getBeginDate())) {
|
||||
queryWrapper.ge(HandoverRecord::getHandoverTime, param.getBeginDate() + " 00:00:00");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(param.getEndDate())) {
|
||||
queryWrapper.le(HandoverRecord::getHandoverTime, param.getEndDate() + " 23:59:59");
|
||||
}
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
queryWrapper.eq(HandoverRecord::getShopId, shopId);
|
||||
queryWrapper.isNotNull(HandoverRecord::getHandoverTime);
|
||||
queryWrapper.orderBy(HandoverRecord::getId, false);
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Page<HandoverRecordDTO> getHandoverRecordPage(String beginDate, String endDate) {
|
||||
HandoverRecordDTO param = new HandoverRecordDTO();
|
||||
param.setBeginDate(beginDate);
|
||||
param.setEndDate(endDate);
|
||||
QueryWrapper queryWrapper = buildQueryWrapper(param);
|
||||
QueryWrapper queryWrapper = query().eq(HandoverRecord::getShopId, StpKit.USER.getShopId());
|
||||
if (StrUtil.isNotEmpty(param.getBeginDate())) {
|
||||
queryWrapper.ge(HandoverRecord::getHandoverTime, param.getBeginDate() + " 00:00:00");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(param.getEndDate())) {
|
||||
queryWrapper.le(HandoverRecord::getHandoverTime, param.getEndDate() + " 23:59:59");
|
||||
}
|
||||
return super.pageAs(PageUtil.buildPage(), queryWrapper, HandoverRecordDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HandoverProductListVo> getHandoverProductListById(Long id) {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
HandoverRecord data = super.getOne(query().eq(HandoverRecord::getId, id).eq(HandoverRecord::getShopId, shopId));
|
||||
if (data == null) {
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
HandoverRecord data = getOne(query().eq(HandoverRecord::getId, id).eq(HandoverRecord::getShopId, shopId));
|
||||
if (data == null || data.getProductData() == null) {
|
||||
return List.of();
|
||||
}
|
||||
String productData = data.getProductData();
|
||||
if (StrUtil.isBlank(productData)) {
|
||||
return List.of();
|
||||
}
|
||||
return JSON.parseArray(productData, HandoverProductListVo.class);
|
||||
return JSON.parseArray(data.getProductData(), HandoverProductListVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandoverTotalVo totalHandoverData() {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
LocalDateTime handoverTime = LocalDateTime.now();
|
||||
HandoverRecord record = super.getOne(query().eq(HandoverRecord::getShopId, shopId).isNull(HandoverRecord::getHandoverTime));
|
||||
HandoverTotalVo data = new HandoverTotalVo();
|
||||
if (record == null) {
|
||||
return data;
|
||||
throw new CzgException("未处在当班状态");
|
||||
}
|
||||
data.setId(record.getId());
|
||||
data.setShopId(record.getShopId());
|
||||
@@ -98,11 +87,21 @@ public class HandoverRecordServiceImpl extends ServiceImpl<HandoverRecordMapper,
|
||||
data.setHandoverTime(handoverTime);
|
||||
String loginTimeStr = LocalDateTimeUtil.formatNormal(record.getLoginTime());
|
||||
String handoverTimeStr = LocalDateTimeUtil.formatNormal(handoverTime);
|
||||
data.setCashAmount(sumCashAmount(shopId, loginTimeStr, handoverTimeStr));
|
||||
data.setRefundAmount(sumRefundAmount(shopId, loginTimeStr, handoverTimeStr));
|
||||
data.setHandAmount(sumHandAmount(shopId, loginTimeStr, handoverTimeStr));
|
||||
data.setOrderCount(countOrderNum(shopId, loginTimeStr, handoverTimeStr));
|
||||
data.setDetailList(getDetailList(shopId, loginTimeStr, handoverTimeStr));
|
||||
data.setDetailList(orderInfoRpcService.getHandoverDetailList(shopId, loginTimeStr, handoverTimeStr));
|
||||
data.setCategoryList(orderInfoRpcService.getHandoverCategoryList(shopId, loginTimeStr, handoverTimeStr));
|
||||
HandoverRecord onlinePayTypeDate = orderInfoRpcService.getOnlinePayTypeDate(shopId, loginTimeStr, handoverTimeStr);
|
||||
// 合并结果
|
||||
CopyOptions copyOptions = CopyOptions.create().setIgnoreNullValue(true);
|
||||
if (onlinePayTypeDate != null) {
|
||||
BeanUtil.copyProperties(onlinePayTypeDate, data, copyOptions);
|
||||
data.setTurnover(onlinePayTypeDate.getOrderTurnover());
|
||||
}
|
||||
HandoverRecord handoverRecord = orderInfoRpcService.countShopUserFlow(shopId, loginTimeStr, handoverTimeStr);
|
||||
if (handoverRecord != null) {
|
||||
data.setTurnover(NumberUtil.add(data.getTurnover(), handoverRecord.getRecharge()));
|
||||
data.setRefundAmount(NumberUtil.add(data.getRefundAmount(), handoverRecord.getRefundAmount()));
|
||||
}
|
||||
data.setReturnDishCount(orderInfoRpcService.countReturnDish(shopId, loginTimeStr, handoverTimeStr));
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -113,27 +112,15 @@ public class HandoverRecordServiceImpl extends ServiceImpl<HandoverRecordMapper,
|
||||
return;
|
||||
}
|
||||
entity.setLoginTime(LocalDateTime.now());
|
||||
super.save(entity);
|
||||
save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long handover() {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
HandoverTotalVo data = totalHandoverData();
|
||||
LocalDateTime loginTime = data.getLoginTime();
|
||||
LocalDateTime handoverTime = data.getHandoverTime();
|
||||
String loginTimeStr = LocalDateTimeUtil.formatNormal(loginTime);
|
||||
String handoverTimeStr = LocalDateTimeUtil.formatNormal(handoverTime);
|
||||
HandoverRecord entity = BeanUtil.copyProperties(data, HandoverRecord.class);
|
||||
entity.setWechatAmount(orderInfoRpcService.getHandoverWechatAmount(shopId, loginTimeStr, handoverTimeStr));
|
||||
entity.setAlipayAmount(orderInfoRpcService.getHandoverAlipayAmount(shopId, loginTimeStr, handoverTimeStr));
|
||||
entity.setVipPay(orderInfoRpcService.getHandoverVipPayAmount(shopId, loginTimeStr, handoverTimeStr));
|
||||
entity.setVipRecharge(orderInfoRpcService.getHandoverVipChargeAmount(shopId, loginTimeStr, handoverTimeStr));
|
||||
entity.setQuickInAmount(orderInfoRpcService.getHandoverQuickPayAmount(shopId, loginTimeStr, handoverTimeStr));
|
||||
entity.setCreditAmount(orderInfoRpcService.getHandoverCreditAmount(shopId, loginTimeStr, handoverTimeStr));
|
||||
List<HandoverCategoryListVo> categoryData = orderInfoRpcService.getHandoverCategoryList(shopId, loginTimeStr, handoverTimeStr);
|
||||
entity.setCategoryData(JSON.toJSONString(categoryData, JSONWriter.Feature.WriteMapNullValue));
|
||||
entity.setCategoryData(JSON.toJSONString(data.getCategoryList(), JSONWriter.Feature.WriteMapNullValue));
|
||||
List<HandoverProductListVo> productData = data.getDetailList();
|
||||
entity.setProductData(JSON.toJSONString(productData, JSONWriter.Feature.WriteMapNullValue));
|
||||
super.updateById(entity);
|
||||
@@ -146,24 +133,4 @@ public class HandoverRecordServiceImpl extends ServiceImpl<HandoverRecordMapper,
|
||||
orderInfoRpcService.sendHandoverReceiptPrintMsgToMq(handoverRecordId);
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal sumCashAmount(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoRpcService.getHandoverCashAmount(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
private BigDecimal sumRefundAmount(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoRpcService.getHandoverRefundAmount(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
private BigDecimal sumHandAmount(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoRpcService.getHandoverTotalAmount(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
private int countOrderNum(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoRpcService.getHandoverOrderNum(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
private List<HandoverProductListVo> getDetailList(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoRpcService.getHandoverDetailList(shopId, loginTime, handoverTime);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.czg.service.market.mapper;
|
||||
|
||||
import com.czg.account.entity.HandoverRecord;
|
||||
import com.czg.account.vo.HandoverCategoryListVo;
|
||||
import com.czg.account.vo.HandoverProductListVo;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
@@ -16,105 +18,6 @@ import java.util.List;
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
public interface OrderInfoMapper extends BaseMapper<OrderInfo> {
|
||||
/**
|
||||
* 交班现金支付统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 现金支付总额
|
||||
*/
|
||||
BigDecimal getHandoverCashAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班微信支付统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 现金支付总额
|
||||
*/
|
||||
BigDecimal getHandoverWechatAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班支付宝支付统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 支付宝支付总额
|
||||
*/
|
||||
BigDecimal getHandoverAlipayAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班VIP支付统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return VIP支付总额
|
||||
*/
|
||||
BigDecimal getHandoverVipPayAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班VIP充值统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return VIP充值总额
|
||||
*/
|
||||
BigDecimal getHandoverVipChargeAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班快捷支付统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 快捷支付总额
|
||||
*/
|
||||
BigDecimal getHandoverQuickPayAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班退款统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 退款总额
|
||||
*/
|
||||
BigDecimal getHandoverRefundAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班挂账统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 挂账总额
|
||||
*/
|
||||
BigDecimal getHandoverCreditAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班营业额统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 营业额
|
||||
*/
|
||||
BigDecimal getHandoverTotalAmount(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班订单数统计
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param loginTime 上岗时间
|
||||
* @param handoverTime 交班时间
|
||||
* @return 交班订单数
|
||||
*/
|
||||
int getHandoverOrderNum(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 交班售出商品明细
|
||||
@@ -140,4 +43,49 @@ public interface OrderInfoMapper extends BaseMapper<OrderInfo> {
|
||||
|
||||
int updatePayOrderId(@Param("orderId") Long orderId, @Param("paymentId") Long paymentId, @Param("payType") String payType, @Param("remark") String remark);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单支付方式统计 当日实时数据
|
||||
*/
|
||||
@Select("SELECT" +
|
||||
" SUM(tb_order_info.pay_amount) AS orderTurnover," +
|
||||
" SUM(CASE WHEN pay_type = 'main_scan' THEN pay_amount ELSE 0 END) AS selfScan," +
|
||||
" SUM(CASE WHEN pay_type = 'back_scan' THEN pay_amount ELSE 0 END) AS barScan," +
|
||||
" SUM(CASE WHEN pay_type = 'wechat_mini' THEN pay_amount ELSE 0 END) AS wechat," +
|
||||
" SUM(CASE WHEN pay_type = 'alipay_mini' THEN pay_amount ELSE 0 END) AS alipay," +
|
||||
" SUM(CASE WHEN pay_type = 'vip_pay' THEN pay_amount ELSE 0 END) AS balance," +
|
||||
" SUM(CASE WHEN pay_type = 'cash_pay' THEN pay_amount ELSE 0 END) AS cash," +
|
||||
" SUM(CASE WHEN pay_type = 'credit_pay' THEN pay_amount ELSE 0 END) AS owed," +
|
||||
|
||||
" IFNULL(SUM(refund_amount), 0) as refundAmount," +
|
||||
" count(1) as orderCount " +
|
||||
" FROM" +
|
||||
" tb_order_info " +
|
||||
" WHERE" +
|
||||
" shop_id = #{shopId} " +
|
||||
"and create_time >= #{loginTime} and create_time <= #{handoverTime} " +
|
||||
"and paid_time is not null ")
|
||||
HandoverRecord getOnlinePayTypeDate(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
/**
|
||||
* 订单退菜数量
|
||||
*/
|
||||
@Select("SELECT" +
|
||||
" SUM(o.return_num) AS returnDishCount " +
|
||||
" FROM" +
|
||||
" tb_order_info left join tb_order_detail o on tb_order_info.id = o.order_id" +
|
||||
" WHERE" +
|
||||
" tb_order_info.shop_id = #{shopId} " +
|
||||
"and tb_order_info.create_time >= #{loginTime} and tb_order_info.create_time <= #{handoverTime} " +
|
||||
"and tb_order_info.paid_time is not null ")
|
||||
BigDecimal countReturnDish(Long shopId, String loginTime, String handoverTime);
|
||||
|
||||
@Select("SELECT " +
|
||||
" SUM(CASE WHEN biz_code IN ('cashIn', 'wechatIn', 'alipayIn', 'adminIn','freeIn') THEN amount ELSE 0 END) AS recharge," +
|
||||
" SUM(CASE WHEN biz_code IN ('rechargeRefund') THEN amount ELSE 0 END) AS refundAmount " +
|
||||
"FROM `tb_shop_user_flow` " +
|
||||
" WHERE" +
|
||||
" shop_id = #{shopId} " +
|
||||
"and create_time >= #{loginTime} and create_time <= #{handoverTime} ")
|
||||
HandoverRecord countShopUserFlow(Long shopId, String loginTime, String handoverTime);
|
||||
}
|
||||
|
||||
@@ -45,39 +45,7 @@
|
||||
where id = #{orderId};
|
||||
</update>
|
||||
|
||||
<select id="getHandoverCashAmount" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
ifnull(sum(t1.pay_amount),0)
|
||||
FROM tb_order_info t1
|
||||
<where>
|
||||
<include refid="handoverCommonWhere"/>
|
||||
and t1.pay_type = 'cash_pay'
|
||||
</where>
|
||||
</select>
|
||||
<select id="getHandoverRefundAmount" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
ifnull(sum(t1.refund_amount),0)
|
||||
FROM tb_order_info t1
|
||||
<where>
|
||||
<include refid="handoverCommonWhere"/>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getHandoverTotalAmount" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
ifnull(sum(t1.pay_amount),0)
|
||||
FROM tb_order_info t1
|
||||
<where>
|
||||
<include refid="handoverCommonWhere"/>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getHandoverOrderNum" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
count(*)
|
||||
FROM tb_order_info t1
|
||||
<where>
|
||||
<include refid="handoverCommonWhere"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getHandoverDetailList" resultType="com.czg.account.vo.HandoverProductListVo">
|
||||
SELECT
|
||||
t2.product_id,
|
||||
@@ -96,53 +64,7 @@
|
||||
t2.product_id,
|
||||
t2.sku_id
|
||||
</select>
|
||||
<select id="getHandoverWechatAmount" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
ifnull(sum(t1.pay_amount),0)
|
||||
FROM tb_order_info t1
|
||||
<where>
|
||||
<include refid="handoverCommonWhere"/>
|
||||
and t1.pay_type = 'wechat_mini'
|
||||
</where>
|
||||
</select>
|
||||
<select id="getHandoverAlipayAmount" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
ifnull(sum(t1.pay_amount),0)
|
||||
FROM tb_order_info t1
|
||||
<where>
|
||||
<include refid="handoverCommonWhere"/>
|
||||
and t1.pay_type = 'alipay_mini'
|
||||
</where>
|
||||
</select>
|
||||
<select id="getHandoverVipPayAmount" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
ifnull(sum(t1.pay_amount),0)
|
||||
FROM tb_order_info t1
|
||||
<where>
|
||||
<include refid="handoverCommonWhere"/>
|
||||
and t1.pay_type = 'vip_pay'
|
||||
</where>
|
||||
</select>
|
||||
<select id="getHandoverVipChargeAmount" resultType="java.math.BigDecimal">
|
||||
select ifnull(sum(t1.amount), 0)
|
||||
from tb_shop_user_flow t1
|
||||
where t1.shop_id = #{shopId}
|
||||
and t1.biz_code in ('cashIn', 'wechatIn', 'alipayIn', 'adminIn')
|
||||
and t1.recharge_id is not null
|
||||
<![CDATA[
|
||||
AND t1.create_time >= str_to_date(#{loginTime}, '%Y-%m-%d %H:%i:%s')
|
||||
AND t1.create_time <= str_to_date(#{handoverTime}, '%Y-%m-%d %H:%i:%s')
|
||||
]]>
|
||||
</select>
|
||||
<select id="getHandoverQuickPayAmount" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
ifnull(sum(pay_amount),0)
|
||||
FROM tb_order_info t1
|
||||
<where>
|
||||
<include refid="handoverCommonWhere"/>
|
||||
and t1.pay_type in ('main_scan','back_scan')
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getHandoverCategoryList" resultType="com.czg.account.vo.HandoverCategoryListVo">
|
||||
SELECT case when t3.category_id is null then 0 else t3.category_id end as category_id,
|
||||
case when t4.name is null then '未分类' else t4.name end as category_name,
|
||||
@@ -158,13 +80,4 @@
|
||||
</where>
|
||||
GROUP BY t3.category_id
|
||||
</select>
|
||||
<select id="getHandoverCreditAmount" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
ifnull(sum(t1.pay_amount),0)
|
||||
FROM tb_order_info t1
|
||||
<where>
|
||||
<include refid="handoverCommonWhere"/>
|
||||
and t1.pay_type = 'credit_pay'
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -254,7 +254,6 @@ public abstract class PrinterHandler {
|
||||
public void refundOrderHandler(String printTitle, String operator, String refundAmount, String refundReason, String refundType,
|
||||
OrderInfo orderInfo, List<OrderDetail> detailList) {
|
||||
getPrintMachine(orderInfo.getShopId(), "cash", "normal", "").forEach(machine -> {
|
||||
orderInfo.setTableName(getTableAreaAndName(orderInfo.getShopId(), orderInfo.getTableCode(), orderInfo.getTableName()));
|
||||
refundHandleRequest(machine, printTitle, operator, refundAmount, refundReason, refundType, orderInfo, detailList);
|
||||
});
|
||||
}
|
||||
@@ -648,10 +647,6 @@ public abstract class PrinterHandler {
|
||||
return StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getTakeCode() : orderInfo.getTableName();
|
||||
}
|
||||
|
||||
public String getTableAreaAndName(Long shopId, String tableCode, String tableName) {
|
||||
return shopTableService.getTableAreaAndName(shopId, tableCode, tableName);
|
||||
}
|
||||
|
||||
|
||||
public PrintInfoDTO returnOrderPrint(String printTitle, String operator, String refundAmount, String refundReason, String refundType,
|
||||
OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
||||
@@ -663,7 +658,7 @@ public abstract class PrinterHandler {
|
||||
.setReturn(true)
|
||||
.setPrintTitle(printTitle);
|
||||
printInfoDTO.setSeatNum(orderInfo.getSeatNum() == null ? "" : orderInfo.getSeatNum().toString());
|
||||
printInfoDTO.setPickupNum(getTableAreaAndName(orderInfo.getShopId(), orderInfo.getTableCode(), orderInfo.getTableName()));
|
||||
printInfoDTO.setPickupNum(orderInfo.getTableName());
|
||||
printInfoDTO.setRefundAmount(refundAmount);
|
||||
printInfoDTO.setRefundReason(refundReason);
|
||||
printInfoDTO.setRefundType("cash".equals(refundType) ? "线下退款" : "原路退回");
|
||||
@@ -757,7 +752,7 @@ public abstract class PrinterHandler {
|
||||
|
||||
PrintInfoDTO printInfoDTO = new PrintInfoDTO().setShopName(shopInfo.getShopName())
|
||||
.setPrintTitle(printTitle)
|
||||
.setPickupNum(getTableAreaAndName(orderInfo.getShopId(), orderInfo.getTableCode(), orderInfo.getTableName()))
|
||||
.setPickupNum(orderInfo.getTableName())
|
||||
.setOrderNo(orderInfo.getOrderNo()).setPayAmount(orderInfo.getPayAmount().toPlainString()).setReturn(false)
|
||||
.setOutNumber(orderInfo.getTakeCode()).setCount(count).setRemark(orderInfo.getRemark())
|
||||
// 使用累计的总优惠金额,null 表示没有优惠
|
||||
|
||||
@@ -184,28 +184,28 @@ public interface PrinterImpl {
|
||||
.append(getFormatLabel("交班小票", signLabelInfo.s, signLabelInfo.center)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel("交班时间: " + DateUtil.format(handoverRecord.getHandoverTime(), "yyyy/MM/dd HH:mm:ss"), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel("收银员: " + handoverRecord.getStaffName(), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel("交班周期: " + DateUtil.format(handoverRecord.getLoginTime(), "dd日HH:mm") + " - " +
|
||||
.append(getFormatLabel("交班周期: " + DateUtil.format(handoverRecord.getLoginTime(), "dd日HH:mm") + "--" +
|
||||
DateUtil.format(handoverRecord.getHandoverTime(), "dd日HH:mm"), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
|
||||
.append(signLabelInfo.br)
|
||||
.append(signLabelInfo.br)
|
||||
.append(getFormatLabel("当班营业总额: " + handoverRecord.getHandAmount(), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel("当班营业总额: " + handoverRecord.getTurnover(), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel("实际收款的支付方式", signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 现金:", handoverRecord.getCashAmount().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 微信:", handoverRecord.getWechatAmount().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 支付宝:", handoverRecord.getAlipayAmount().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 二维码收款:", "", 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 扫码收款:", "", 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 充值:", handoverRecord.getVipRecharge().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 现金:", handoverRecord.getCash().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 微信:", handoverRecord.getWechat().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 支付宝:", handoverRecord.getAlipay().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 二维码收款:", handoverRecord.getSelfScan().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 扫码收款:", handoverRecord.getBarScan().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 充值:", handoverRecord.getRecharge().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel("非实际收款的支付方式", signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 挂账:", handoverRecord.getCreditAmount().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 余额:", handoverRecord.getVipPay().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 挂账:", handoverRecord.getOwed().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 余额:", handoverRecord.getBalance().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel("--------------------------------", signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel("退菜/退款", signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 退款金额:", handoverRecord.getRefundAmount().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 退菜数量:", "", 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 退菜数量:", handoverRecord.getReturnDishCount().toString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel("--------------------------------", signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign("订单(数量/订单总额)", handoverRecord.getOrderCount() + "/" + handoverRecord.getHandAmount(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign("订单数量/订单总额", handoverRecord.getOrderCount() + "/" + handoverRecord.getOrderTurnover(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel("----------- 销售数据 -----------", signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(formatItemLine("商品分类", "数量", "总计", 14, 8), signLabelInfo.s))
|
||||
.append(signLabelInfo.br);
|
||||
@@ -219,7 +219,7 @@ public interface PrinterImpl {
|
||||
builder.append(getFormatLabel(formatItemLine(categoryName, quantity.toString(), amount.toPlainString(), 14, 8), signLabelInfo.s)).append(signLabelInfo.br);
|
||||
});
|
||||
}
|
||||
builder.append(getFormatLabel("退菜/退款", signLabelInfo.s)).append(signLabelInfo.br)
|
||||
builder.append(getFormatLabel("--------------------------------", signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel("打印时间: " + DateUtil.format(DateUtil.date(), "yyyy/MM/dd HH:mm:ss"), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(signLabelInfo.getOut(180))
|
||||
.append(signLabelInfo.cut);
|
||||
|
||||
@@ -328,9 +328,10 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
log.info("后付费生成订单{},第{}", orderInfo.getId(), orderInfo.getPlaceNum());
|
||||
printerHandler.orderHandler(orderInfo.getId().toString(), PrinterHandler.PrintTypeEnum.GUEST_ORDER, orderInfo.getPlaceNum());
|
||||
//发送打票信息 后付费推送多次 需要处理
|
||||
//orderId_0_0 订单ID_先付后付(1先付0后付)_订单状态 0未完成 1完成
|
||||
//orderId_0_0 订单ID_先付后付(1先付0后付)_订单状态 0未完成 1完成_第几次下单
|
||||
//orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_0"
|
||||
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId() + "_0_0", false, "后付费打印");
|
||||
rabbitPublisher.sendKitchenOrderPrintMsg(orderInfo.getId() + "_0_0", false, "后付费打印");
|
||||
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId() + "_0_0_" + orderInfo.getPlaceNum(), true, "后付费打印");
|
||||
} else {
|
||||
redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId(), "", 60 * 15);
|
||||
}
|
||||
@@ -1275,6 +1276,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
if (payType != PayEnums.BACK_SCAN) {
|
||||
// 事务成功提交后执行消息发送
|
||||
String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1";
|
||||
rabbitPublisher.sendKitchenOrderPrintMsg(printParam, isPrint, "事务环境打印");
|
||||
rabbitPublisher.sendOrderPrintMsg(printParam, isPrint, "事务环境打印");
|
||||
}
|
||||
// log.info("订单{}事务提交后,发送打印消息", orderId);
|
||||
@@ -1285,6 +1287,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
// 非事务环境下直接发送(兼容无事务场景)
|
||||
String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1";
|
||||
rabbitPublisher.sendOrderPrintMsg(printParam, isPrint, "非事务环境打印");
|
||||
rabbitPublisher.sendKitchenOrderPrintMsg(printParam, isPrint, "非事务环境打印");
|
||||
}
|
||||
// log.info("非事务环境下,直接发送订单{}打印消息", orderId);
|
||||
}
|
||||
@@ -1448,7 +1451,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
}
|
||||
if (table != null) {
|
||||
orderInfo.setTableCode(table.getTableCode());
|
||||
orderInfo.setTableName(table.getName());
|
||||
orderInfo.setTableName(shopTableService.getTableAreaAndName(shopInfo.getId(), table.getTableCode(), table.getName()));
|
||||
}
|
||||
// 餐位费
|
||||
if (shopInfo.getIsTableFee().equals(0)) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.account.entity.HandoverRecord;
|
||||
import com.czg.account.vo.HandoverCategoryListVo;
|
||||
import com.czg.account.vo.HandoverProductListVo;
|
||||
import com.czg.config.RabbitPublisher;
|
||||
@@ -12,8 +13,8 @@ import com.czg.order.entity.OrderDetail;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.order.service.OrderInfoRpcService;
|
||||
import com.czg.product.service.ProductRpcService;
|
||||
import com.czg.service.order.mapper.OrderDetailMapper;
|
||||
import com.czg.service.market.mapper.OrderInfoMapper;
|
||||
import com.czg.service.order.mapper.OrderDetailMapper;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import io.seata.spring.annotation.GlobalTransactional;
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -47,55 +48,6 @@ public class OrderInfoRpcServiceImpl implements OrderInfoRpcService {
|
||||
@Resource
|
||||
private RabbitPublisher rabbitPublisher;
|
||||
|
||||
@Override
|
||||
public BigDecimal getHandoverWechatAmount(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoMapper.getHandoverWechatAmount(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getHandoverAlipayAmount(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoMapper.getHandoverAlipayAmount(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getHandoverVipPayAmount(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoMapper.getHandoverVipPayAmount(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getHandoverVipChargeAmount(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoMapper.getHandoverVipChargeAmount(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getHandoverQuickPayAmount(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoMapper.getHandoverQuickPayAmount(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getHandoverCashAmount(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoMapper.getHandoverCashAmount(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getHandoverRefundAmount(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoMapper.getHandoverRefundAmount(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getHandoverCreditAmount(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoMapper.getHandoverCreditAmount(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getHandoverTotalAmount(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoMapper.getHandoverTotalAmount(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHandoverOrderNum(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoMapper.getHandoverOrderNum(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HandoverProductListVo> getHandoverDetailList(Long shopId, String loginTime, String handoverTime) {
|
||||
@@ -107,6 +59,22 @@ public class OrderInfoRpcServiceImpl implements OrderInfoRpcService {
|
||||
return orderInfoMapper.getHandoverCategoryList(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandoverRecord getOnlinePayTypeDate(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoMapper.getOnlinePayTypeDate(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal countReturnDish(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoMapper.countReturnDish(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandoverRecord countShopUserFlow(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoMapper.countShopUserFlow(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@GlobalTransactional
|
||||
public void paySuccessCallback(Long orderId) {
|
||||
|
||||
@@ -118,6 +118,8 @@ public class OrderPayServiceImpl implements OrderPayService {
|
||||
//发送打票信息
|
||||
//orderId_0_0 订单ID_先付后付(1先付0后付)_订单状态 0未完成 1完成
|
||||
//orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_0"
|
||||
rabbitPublisher.sendKitchenOrderPrintMsg(orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_1",
|
||||
orderInfo.getIsPrint() == 1, "0元付款");
|
||||
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_1",
|
||||
orderInfo.getIsPrint() == 1, "0元付款");
|
||||
redisService.del(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId());
|
||||
@@ -362,6 +364,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
||||
LocalDateTime.now(), paymentId, PayEnums.BACK_SCAN);
|
||||
// 事务成功提交后执行消息发送
|
||||
String printParam = orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_1";
|
||||
rabbitPublisher.sendKitchenOrderPrintMsg(printParam, orderInfo.getIsPrint() == 1, "事务环境打印");
|
||||
rabbitPublisher.sendOrderPrintMsg(printParam, orderInfo.getIsPrint() == 1, "事务环境打印");
|
||||
} else {
|
||||
upOrderPayInfo(orderInfo.getId(), PayEnums.BACK_SCAN, paymentId,
|
||||
@@ -510,9 +513,11 @@ public class OrderPayServiceImpl implements OrderPayService {
|
||||
orderInfo.setRefundRemark(orderInfo.getRefundRemark() + param.getRefundReason());
|
||||
orderInfoService.updateById(orderInfo);
|
||||
//退款后续 退款单/退菜单
|
||||
printerHandler.refundOrderHandler(printTitle, StrUtil.isNotBlank(param.getOperator()) ? param.getOperator() : ""
|
||||
, isPay ? param.getRefundAmount().toPlainString() : "0"
|
||||
, param.getRefundReason(), orderInfo.getRefundType(), orderInfo, param.getRefundDetails());
|
||||
if (param.isPrint()) {
|
||||
printerHandler.refundOrderHandler(printTitle, StrUtil.isNotBlank(param.getOperator()) ? param.getOperator() : ""
|
||||
, isPay ? param.getRefundAmount().toPlainString() : "0"
|
||||
, param.getRefundReason(), orderInfo.getRefundType(), orderInfo, param.getRefundDetails());
|
||||
}
|
||||
//退款返还库存
|
||||
if (!returnProMap.isEmpty()) {
|
||||
rabbitPublisher.sendOrderRefundMsg(JSONObject.toJSONString(Map.of("orderId", orderInfo.getId(), "returnProMap", returnProMap)));
|
||||
|
||||
Reference in New Issue
Block a user