Compare commits
27 Commits
9da67fc67f
...
test
| Author | SHA1 | Date | |
|---|---|---|---|
| a53911aaa5 | |||
| 746c5c83da | |||
| 625df4c353 | |||
| 9784695482 | |||
| 257977a000 | |||
| 624abd31b4 | |||
| 7b9dcafc53 | |||
| 04d75589a8 | |||
| bb76930920 | |||
| 8ae847d458 | |||
| bb7ca6d05b | |||
| ee78543ab8 | |||
| 4deba098ce | |||
| ec1bc6a156 | |||
| a74e099346 | |||
| d6d6477c6d | |||
| e3f58e41ca | |||
| c04a5b8fb1 | |||
| ccc18fc229 | |||
| 4a6af60352 | |||
| f32212928a | |||
| 7d640b4f9c | |||
| 3fd032c1d0 | |||
| 6b0423a2ba | |||
| 9c69c8dcbc | |||
| 19ed77b35b | |||
| d1dd806204 |
@@ -41,7 +41,7 @@ public class ADisGroupController {
|
|||||||
if (share == null) {
|
if (share == null) {
|
||||||
return CzgResult.success(mkDistributionGroupService.save(group));
|
return CzgResult.success(mkDistributionGroupService.save(group));
|
||||||
} else {
|
} else {
|
||||||
return CzgResult.success(mkDistributionGroupService.updateById(group, false));
|
return CzgResult.success(mkDistributionGroupService.updateById(group));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,6 +41,7 @@ public class AShareBaseController {
|
|||||||
if (share == null) {
|
if (share == null) {
|
||||||
return CzgResult.success(mkShareBaseService.save(shareBase));
|
return CzgResult.success(mkShareBaseService.save(shareBase));
|
||||||
} else {
|
} else {
|
||||||
|
shareBase.setCreateTime(share.getCreateTime());
|
||||||
return CzgResult.success(mkShareBaseService.updateById(shareBase, false));
|
return CzgResult.success(mkShareBaseService.updateById(shareBase, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,18 +126,18 @@ public class OrderPayController {
|
|||||||
return orderPayService.ltPayOrder(ServletUtil.getClientIP(request), payParam);
|
return orderPayService.ltPayOrder(ServletUtil.getClientIP(request), payParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 正扫
|
// * 正扫
|
||||||
*/
|
// */
|
||||||
@PostMapping("/scanPay")
|
// @PostMapping("/scanPay")
|
||||||
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
// @Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||||
public CzgResult<Map<String, Object>> scanPayOrder(@RequestHeader Long shopId, HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
// public CzgResult<Map<String, Object>> scanPayOrder(@RequestHeader Long shopId, HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||||
payParam.setShopId(shopId);
|
// payParam.setShopId(shopId);
|
||||||
return orderPayService.scanPayOrder(ServletUtil.getClientIP(request), payParam);
|
// return orderPayService.scanPayOrder(ServletUtil.getClientIP(request), payParam);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 反扫
|
* 扫码收款
|
||||||
* authCode 必填 扫描码
|
* authCode 必填 扫描码
|
||||||
*/
|
*/
|
||||||
@PostMapping("/microPay")
|
@PostMapping("/microPay")
|
||||||
@@ -181,11 +181,9 @@ public class OrderPayController {
|
|||||||
@PostMapping("/shopPayApi/js2Pay")
|
@PostMapping("/shopPayApi/js2Pay")
|
||||||
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||||
public CzgResult<Map<String, Object>> js2PayOrder(HttpServletRequest request, @RequestBody OrderPayParamDTO payParam) {
|
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);
|
payParam.setPayType(PayCst.Type.ALIPAY);
|
||||||
} else if ("aliPay".equals(payParam.getPayType())) {
|
} else if ("WECHAT".equals(payParam.getPayType())) {
|
||||||
payParam.setPayType(PayCst.Type.ALIPAY);
|
|
||||||
} else if ("wechatPay".equals(payParam.getPayType())) {
|
|
||||||
payParam.setPayType(PayCst.Type.WECHAT);
|
payParam.setPayType(PayCst.Type.WECHAT);
|
||||||
} else {
|
} else {
|
||||||
throw new CzgException(payParam.getPayType() + "支付方式错误");
|
throw new CzgException(payParam.getPayType() + "支付方式错误");
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.czg.config;
|
package com.czg.config;
|
||||||
|
|
||||||
import cn.dev33.satoken.application.ApplicationInfo;
|
|
||||||
import cn.dev33.satoken.config.SaTokenConfig;
|
import cn.dev33.satoken.config.SaTokenConfig;
|
||||||
import cn.dev33.satoken.context.SaHolder;
|
import cn.dev33.satoken.context.SaHolder;
|
||||||
import cn.dev33.satoken.interceptor.SaInterceptor;
|
import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||||
@@ -58,14 +57,17 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
|||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
// 注册路由拦截器,自定义认证规则
|
// 注册路由拦截器,自定义认证规则
|
||||||
registry.addInterceptor(new SaInterceptor(handler -> {
|
registry.addInterceptor(new SaInterceptor(handler -> {
|
||||||
log.info(SaHolder.getRequest().getRequestPath());
|
log.info("{}: {}", SaHolder.getRequest().getMethod(), SaHolder.getRequest().getRequestPath());
|
||||||
// 重置根路径,防止satoken切割根路径导致匹配不到路径
|
if ("OPTIONS".equalsIgnoreCase(SaHolder.getRequest().getMethod())) {
|
||||||
ApplicationInfo.routePrefix = "";
|
SaRouter.back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
SaRouter
|
SaRouter
|
||||||
|
.match(r -> "OPTIONS".equalsIgnoreCase(SaHolder.getRequest().getMethod()))
|
||||||
|
.stop()
|
||||||
// 完全开放的路径(不需要任何认证)
|
// 完全开放的路径(不需要任何认证)
|
||||||
.match("/user/login", "/user/geo/**", "/user/home/**",
|
.match("/user/login", "/user/geo/**", "/user/home/**",
|
||||||
"/user/dict/**", "/user/openId","/admin/auth/**",
|
"/user/dict/**", "/user/openId", "/admin/auth/**",
|
||||||
"/admin/shopMsgPush/subscribe/**",
|
"/admin/shopMsgPush/subscribe/**",
|
||||||
"/admin/coupon/grant",
|
"/admin/coupon/grant",
|
||||||
"/pay/**",
|
"/pay/**",
|
||||||
|
|||||||
@@ -67,9 +67,13 @@ public class FinanceStsDTO {
|
|||||||
private BigDecimal alipay;
|
private BigDecimal alipay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主扫收款
|
* 二维码收款
|
||||||
*/
|
*/
|
||||||
private BigDecimal selfScan;
|
private BigDecimal selfScan;
|
||||||
|
/**
|
||||||
|
* 扫码收款
|
||||||
|
*/
|
||||||
|
private BigDecimal barScan;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 现金收款
|
* 现金收款
|
||||||
@@ -182,6 +186,10 @@ public class FinanceStsDTO {
|
|||||||
* 现金退款金额
|
* 现金退款金额
|
||||||
*/
|
*/
|
||||||
private BigDecimal cashRefundAmount;
|
private BigDecimal cashRefundAmount;
|
||||||
|
/**
|
||||||
|
* 挂账退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal creditRefundAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 充值退款金额
|
* 充值退款金额
|
||||||
|
|||||||
@@ -182,13 +182,14 @@ public class OrderInfo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* {@link com.czg.order.enums.PayEnums}
|
* {@link com.czg.order.enums.PayEnums}
|
||||||
* 支付类型
|
* 支付类型
|
||||||
* 主扫 main_scan
|
* 二维码收款 main_scan
|
||||||
* 被扫 back_scan
|
* 扫码收款 back_scan
|
||||||
* 微信小程序 wechat_mini
|
* 微信小程序 wechat_mini
|
||||||
* 支付宝小程序 alipay_mini
|
* 支付宝小程序 alipay_mini
|
||||||
* 会员支付 vip_pay
|
* 会员支付 vip_pay
|
||||||
* 现金支付 cash_pay
|
* 现金支付 cash_pay
|
||||||
* 挂账支付 credit_pay
|
* 挂账支付 credit_pay
|
||||||
|
* 霸王餐支付 free_pay
|
||||||
*/
|
*/
|
||||||
private String payType;
|
private String payType;
|
||||||
|
|
||||||
|
|||||||
@@ -150,9 +150,10 @@ public class OrderPayment implements Serializable {
|
|||||||
return orderPayment;
|
return orderPayment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OrderPayment refund(@NonNull Long shopId, @NonNull Long sourceId, @NotBlank String sourceType,
|
public static OrderPayment refund(@NonNull String channel,@NonNull Long shopId, @NonNull Long sourceId, @NotBlank String sourceType,
|
||||||
@NotBlank String orderNo, @NonNull BigDecimal amount, Long relatedId, String platformType) {
|
@NotBlank String orderNo, @NonNull BigDecimal amount, Long relatedId, String platformType) {
|
||||||
OrderPayment orderPayment = getInstance(shopId, sourceId, sourceType, orderNo, amount, null, relatedId);
|
OrderPayment orderPayment = getInstance(shopId, sourceId, sourceType, orderNo, amount, null, relatedId);
|
||||||
|
orderPayment.setChannel(channel);
|
||||||
orderPayment.setPayType(PayTypeConstants.PayType.REFUND);
|
orderPayment.setPayType(PayTypeConstants.PayType.REFUND);
|
||||||
orderPayment.setPayStatus(PayTypeConstants.PayStatus.INIT);
|
orderPayment.setPayStatus(PayTypeConstants.PayStatus.INIT);
|
||||||
orderPayment.setPlatformType(platformType);
|
orderPayment.setPlatformType(platformType);
|
||||||
|
|||||||
@@ -169,22 +169,22 @@ public class ShopOrderStatistic implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 被扫收款金额
|
* 被扫收款金额
|
||||||
*/
|
*/
|
||||||
@ExcelProperty("被扫收款金额")
|
@ExcelProperty("扫码收款金额")
|
||||||
private BigDecimal backScanPayAmount;
|
private BigDecimal backScanPayAmount;
|
||||||
/**
|
/**
|
||||||
* 被扫收款笔数
|
* 被扫收款笔数
|
||||||
*/
|
*/
|
||||||
@ExcelProperty("被扫收款笔数")
|
@ExcelProperty("扫码收款笔数")
|
||||||
private Long backScanPayCount;
|
private Long backScanPayCount;
|
||||||
/**
|
/**
|
||||||
* 主扫收款金额
|
* 二维码收款金额
|
||||||
*/
|
*/
|
||||||
@ExcelProperty("主扫收款金额")
|
@ExcelProperty("二维码收款金额")
|
||||||
private BigDecimal mainScanPayAmount;
|
private BigDecimal mainScanPayAmount;
|
||||||
/**
|
/**
|
||||||
* 主扫收款笔数
|
* 二维码收款笔数
|
||||||
*/
|
*/
|
||||||
@ExcelProperty("主扫收款笔数")
|
@ExcelProperty("二维码收款笔数")
|
||||||
private Long mainScanPayCount;
|
private Long mainScanPayCount;
|
||||||
/**
|
/**
|
||||||
* 挂账支付金额
|
* 挂账支付金额
|
||||||
@@ -221,6 +221,8 @@ public class ShopOrderStatistic implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ExcelProperty("订单退款金额")
|
@ExcelProperty("订单退款金额")
|
||||||
private BigDecimal refundAmount;
|
private BigDecimal refundAmount;
|
||||||
|
@ExcelProperty("订单挂账退款金额")
|
||||||
|
private BigDecimal creditRefundAmount;
|
||||||
/**
|
/**
|
||||||
* 订单退款 线上退款金额
|
* 订单退款 线上退款金额
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,11 +17,12 @@ public enum PayEnums {
|
|||||||
/**
|
/**
|
||||||
* 主扫
|
* 主扫
|
||||||
*/
|
*/
|
||||||
MAIN_SCAN("main_scan", "主扫"),
|
MAIN_SCAN("main_scan", "二维码收款"),
|
||||||
/**
|
/**
|
||||||
* 被扫
|
* 被扫
|
||||||
*/
|
*/
|
||||||
BACK_SCAN("back_scan", "被扫"),
|
// BACK_SCAN("back_scan", "被扫"),
|
||||||
|
BACK_SCAN("back_scan", "扫码收款"),
|
||||||
/**
|
/**
|
||||||
* 微信小程序
|
* 微信小程序
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -62,7 +62,9 @@ public class MkShareBaseServiceImpl extends ServiceImpl<MkShareBaseMapper, MkSha
|
|||||||
}
|
}
|
||||||
//绑定上下级
|
//绑定上下级
|
||||||
if (StrUtil.isNotBlank(inviteCode)) {
|
if (StrUtil.isNotBlank(inviteCode)) {
|
||||||
FunUtils.safeRunVoid(() -> distributionUserService.bindInviteUser(fromUserId, toUserId, shopId), "shareClaim 绑定上下级");
|
FunUtils.safeRunVoid(() -> {
|
||||||
|
distributionUserService.bindInviteUser(fromUserId, toUserId, shopId);
|
||||||
|
}, "shareClaim绑定上下级");
|
||||||
}
|
}
|
||||||
MkShareBase shareBase = getById(shopId);
|
MkShareBase shareBase = getById(shopId);
|
||||||
if (shareBase == null || !shareBase.getIsEnabled().equals(1) || StrUtil.isBlank(shareBase.getRewardSharePages())) {
|
if (shareBase == null || !shareBase.getIsEnabled().equals(1) || StrUtil.isBlank(shareBase.getRewardSharePages())) {
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ public interface ShopOrderStatisticMapper extends BaseMapper<ShopOrderStatistic>
|
|||||||
" AND shop_id = #{shopId}" +
|
" AND shop_id = #{shopId}" +
|
||||||
" AND source_type NOT IN ('memberPay', 'distribution', 'distributionRecharge', 'point' ,'ware')" +
|
" AND source_type NOT IN ('memberPay', 'distribution', 'distributionRecharge', 'point' ,'ware')" +
|
||||||
" AND pay_type != 'refundCompensate'" +
|
" AND pay_type != 'refundCompensate'" +
|
||||||
" AND pay_date = #{tradeDay} ;")
|
" AND DATE(update_time) = #{tradeDay} ;")
|
||||||
ShopOrderStatistic getOnlineStatSingleDate(Long shopId, LocalDate tradeDay);
|
ShopOrderStatistic getOnlineStatSingleDate(Long shopId, LocalDate tradeDay);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -210,6 +210,7 @@ public interface ShopOrderStatisticMapper extends BaseMapper<ShopOrderStatistic>
|
|||||||
" SUM(CASE WHEN pay_type = 'free_pay' THEN order_amount ELSE 0 END) AS backDiscountAmount," +
|
" SUM(CASE WHEN pay_type = 'free_pay' THEN order_amount ELSE 0 END) AS backDiscountAmount," +
|
||||||
" " +
|
" " +
|
||||||
" SUM(CASE WHEN pay_type = 'vip_pay' THEN refund_amount ELSE 0 END) AS memberRefundAmount," +
|
" SUM(CASE WHEN pay_type = 'vip_pay' THEN refund_amount ELSE 0 END) AS memberRefundAmount," +
|
||||||
|
" SUM(CASE WHEN pay_type = 'credit_pay' THEN refund_amount ELSE 0 END) AS creditRefundAmount," +
|
||||||
" " +
|
" " +
|
||||||
" SUM(CASE WHEN pay_type = 'vip_pay' THEN 1 ELSE 0 END) as memberPayCount," +
|
" SUM(CASE WHEN pay_type = 'vip_pay' THEN 1 ELSE 0 END) as memberPayCount," +
|
||||||
" SUM(CASE WHEN pay_type = 'cash_pay' THEN 1 ELSE 0 END) as cashPayCount," +
|
" SUM(CASE WHEN pay_type = 'cash_pay' THEN 1 ELSE 0 END) as cashPayCount," +
|
||||||
@@ -219,15 +220,15 @@ public interface ShopOrderStatisticMapper extends BaseMapper<ShopOrderStatistic>
|
|||||||
" SUM(CASE WHEN pay_type = 'main_scan' THEN 1 ELSE 0 END) as mainScanPayCount," +
|
" SUM(CASE WHEN pay_type = 'main_scan' THEN 1 ELSE 0 END) as mainScanPayCount," +
|
||||||
" SUM(CASE WHEN pay_type = 'credit_pay' THEN 1 ELSE 0 END) as creditPayCount," +
|
" SUM(CASE WHEN pay_type = 'credit_pay' THEN 1 ELSE 0 END) as creditPayCount," +
|
||||||
" " +
|
" " +
|
||||||
" SUM(refund_amount) as refundAmount," +
|
" IFNULL(SUM(refund_amount), 0) as refundAmount," +
|
||||||
" SUM(CASE WHEN refund_type = 'cash' or pay_type = 'cash_pay' THEN refund_amount ELSE 0 END) as cashRefundAmount," +
|
" SUM(CASE WHEN refund_type = 'cash' or pay_type = 'cash_pay' THEN refund_amount ELSE 0 END) as cashRefundAmount," +
|
||||||
" " +
|
" " +
|
||||||
" SUM(new_customer_discount_amount) as newCustomerDiscountAmount," +
|
" IFNULL(SUM(new_customer_discount_amount), 0) as newCustomerDiscountAmount," +
|
||||||
" SUM(discount_act_amount) as fullDiscountAmount," +
|
" IFNULL(SUM(discount_act_amount), 0) as fullDiscountAmount," +
|
||||||
" SUM(product_coupon_discount_amount) + SUM(other_coupon_discount_amount) as couponDiscountAmount," +
|
" IFNULL(SUM(product_coupon_discount_amount), 0) + IFNULL(SUM(other_coupon_discount_amount), 0) as couponDiscountAmount," +
|
||||||
" SUM(points_discount_amount) as pointDiscountAmount," +
|
" IFNULL(SUM(points_discount_amount), 0) as pointDiscountAmount," +
|
||||||
" SUM(vip_discount_amount) as memberDiscountAmount," +
|
" IFNULL(SUM(vip_discount_amount), 0) as memberDiscountAmount," +
|
||||||
" SUM(discount_amount) as orderPriceDiscountAmount ," +
|
" IFNULL(SUM(discount_amount), 0) as orderPriceDiscountAmount ," +
|
||||||
" count(1) as orderCount," +
|
" count(1) as orderCount," +
|
||||||
" sum(CASE WHEN seat_num IS NULL OR seat_num <= 0 THEN 1 ELSE seat_num END) as customerCount " +
|
" sum(CASE WHEN seat_num IS NULL OR seat_num <= 0 THEN 1 ELSE seat_num END) as customerCount " +
|
||||||
"FROM" +
|
"FROM" +
|
||||||
|
|||||||
@@ -36,10 +36,11 @@ public class FinanceStsServiceImpl implements FinanceStsService {
|
|||||||
return new FinanceStsDTO()
|
return new FinanceStsDTO()
|
||||||
.setDate(LocalDateTimeUtil.format(param.getQueryDate(), "yyyy-MM-dd"))
|
.setDate(LocalDateTimeUtil.format(param.getQueryDate(), "yyyy-MM-dd"))
|
||||||
.setTurnover(new FinanceStsDTO.TurnoverSts()
|
.setTurnover(new FinanceStsDTO.TurnoverSts()
|
||||||
.setTurnover(statistic.getPayAmount())
|
.setTurnover(statistic.getPayAmount().add(statistic.getRechargeAmount()))
|
||||||
.setWechat(statistic.getWechatPayAmount())
|
.setWechat(statistic.getWechatPayAmount())
|
||||||
.setAlipay(statistic.getAlipayPayAmount())
|
.setAlipay(statistic.getAlipayPayAmount())
|
||||||
.setSelfScan(statistic.getMainScanPayAmount())
|
.setSelfScan(statistic.getMainScanPayAmount())
|
||||||
|
.setBarScan(statistic.getBackScanPayAmount())
|
||||||
.setCash(statistic.getCashPayAmount())
|
.setCash(statistic.getCashPayAmount())
|
||||||
.setRecharge(statistic.getRechargeAmount())
|
.setRecharge(statistic.getRechargeAmount())
|
||||||
.setOwed(statistic.getCreditPayAmount())
|
.setOwed(statistic.getCreditPayAmount())
|
||||||
@@ -58,13 +59,14 @@ public class FinanceStsServiceImpl implements FinanceStsService {
|
|||||||
.setPointsDiscountAmount(statistic.getPointDiscountAmount())
|
.setPointsDiscountAmount(statistic.getPointDiscountAmount())
|
||||||
.setOrderDiscount(statistic.getOrderPriceDiscountAmount()))
|
.setOrderDiscount(statistic.getOrderPriceDiscountAmount()))
|
||||||
.setRefund(new FinanceStsDTO.RefundSts()
|
.setRefund(new FinanceStsDTO.RefundSts()
|
||||||
.setRefundAmount(statistic.getRefundAmount())
|
.setRefundAmount(statistic.getRefundAmount().add(statistic.getRechargeRefundAmount()))
|
||||||
.setOnlineRefundAmount(statistic.getOnlineRefundAmount())
|
.setOnlineRefundAmount(statistic.getOnlineRefundAmount())
|
||||||
.setCashRefundAmount(statistic.getCashRefundAmount())
|
.setCashRefundAmount(statistic.getCashRefundAmount())
|
||||||
|
.setCreditRefundAmount(statistic.getCreditRefundAmount())
|
||||||
|
.setMemberRefundAmount(statistic.getMemberRefundAmount())
|
||||||
.setRechargeRefundAmount(statistic.getRechargeRefundAmount())
|
.setRechargeRefundAmount(statistic.getRechargeRefundAmount())
|
||||||
.setOnlineRechargeRefundAmount(statistic.getOnlineRechargeRefundAmount())
|
.setOnlineRechargeRefundAmount(statistic.getOnlineRechargeRefundAmount())
|
||||||
.setCashRechargeRefundAmount(statistic.getCashRechargeRefundAmount())
|
.setCashRechargeRefundAmount(statistic.getCashRechargeRefundAmount()))
|
||||||
.setMemberRefundAmount(statistic.getMemberRefundAmount()))
|
|
||||||
.setSts(new FinanceStsDTO.Sts()
|
.setSts(new FinanceStsDTO.Sts()
|
||||||
.setCustomerCount(statistic.getCustomerCount())
|
.setCustomerCount(statistic.getCustomerCount())
|
||||||
.setOrderCount(statistic.getOrderCount())
|
.setOrderCount(statistic.getOrderCount())
|
||||||
|
|||||||
@@ -1050,6 +1050,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
payment.setPayStatus(PayTypeConstants.PayStatus.FAIL);
|
payment.setPayStatus(PayTypeConstants.PayStatus.FAIL);
|
||||||
payment.setPlatformType(notifyRespDTO.getPlatform());
|
payment.setPlatformType(notifyRespDTO.getPlatform());
|
||||||
payment.setChannel(channel);
|
payment.setChannel(channel);
|
||||||
|
payment.setPayTime(LocalDateTimeUtil.parse(notifyRespDTO.getPaySuccessTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||||
if ("TRADE_SUCCESS".equals(notifyRespDTO.getStatus())) {
|
if ("TRADE_SUCCESS".equals(notifyRespDTO.getStatus())) {
|
||||||
payment.setPayStatus(PayTypeConstants.PayStatus.SUCCESS);
|
payment.setPayStatus(PayTypeConstants.PayStatus.SUCCESS);
|
||||||
if (PayTypeConstants.SourceType.ORDER.equals(payment.getSourceType())) {
|
if (PayTypeConstants.SourceType.ORDER.equals(payment.getSourceType())) {
|
||||||
@@ -1196,6 +1197,13 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
if (orderInfo.getCreditBuyerId() != null) {
|
if (orderInfo.getCreditBuyerId() != null) {
|
||||||
upOrderInfo.setCreditBuyerId(orderInfo.getCreditBuyerId());
|
upOrderInfo.setCreditBuyerId(orderInfo.getCreditBuyerId());
|
||||||
}
|
}
|
||||||
|
if (PayEnums.FREE_PAY.equals(payType)) {
|
||||||
|
if (orderInfo.getDiscountAllAmount() == null) {
|
||||||
|
upOrderInfo.setDiscountAllAmount(orderInfo.getOrderAmount());
|
||||||
|
} else {
|
||||||
|
upOrderInfo.setDiscountAllAmount(orderInfo.getDiscountAllAmount().add(orderInfo.getOrderAmount()));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ObjectUtil.isNotNull(payType)) {
|
if (ObjectUtil.isNotNull(payType)) {
|
||||||
upOrderInfo.setPayType(payType.getValue());
|
upOrderInfo.setPayType(payType.getValue());
|
||||||
orderInfo.setPayType(payType.getValue());
|
orderInfo.setPayType(payType.getValue());
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
}
|
}
|
||||||
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
||||||
Long paymentId = payService.initPayment(OrderPayment.orderPay(payParam.getShopId(), orderInfo.getId(), payOrderNo, orderInfo.getOrderAmount(), ""));
|
Long paymentId = payService.initPayment(OrderPayment.orderPay(payParam.getShopId(), orderInfo.getId(), payOrderNo, orderInfo.getOrderAmount(), ""));
|
||||||
upOrderPayInfo(orderInfo.getId(), PayCst.Type.ALIPAY.equals(payParam.getPayType()) ? PayEnums.ALIPAY_MINI : PayEnums.WECHAT_MINI, paymentId,
|
upOrderPayInfo(orderInfo.getId(), PayEnums.MAIN_SCAN, paymentId,
|
||||||
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
||||||
return payService.pay(payParam.getShopId(), CzgPayEnum.JS_PAY,
|
return payService.pay(payParam.getShopId(), CzgPayEnum.JS_PAY,
|
||||||
CzgPayBaseReq.jsPayReq(payOrderNo, "扫码支付", orderInfo.getOrderAmount().multiply(PayService.MONEY_RATE).longValue(),
|
CzgPayBaseReq.jsPayReq(payOrderNo, "扫码支付", orderInfo.getOrderAmount().multiply(PayService.MONEY_RATE).longValue(),
|
||||||
@@ -358,7 +358,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
orderInfoCustomService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(),
|
orderInfoCustomService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(),
|
||||||
LocalDateTime.now(), paymentId, PayEnums.BACK_SCAN);
|
LocalDateTime.now(), paymentId, PayEnums.BACK_SCAN);
|
||||||
// 事务成功提交后执行消息发送
|
// 事务成功提交后执行消息发送
|
||||||
String printParam = orderInfo.getId() + "_" + (!"after-pay".equals( orderInfo.getPayMode()) ? 1 : 0) + "_1";
|
String printParam = orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_1";
|
||||||
rabbitPublisher.sendOrderPrintMsg(printParam, orderInfo.getIsPrint() == 1, "事务环境打印");
|
rabbitPublisher.sendOrderPrintMsg(printParam, orderInfo.getIsPrint() == 1, "事务环境打印");
|
||||||
} else {
|
} else {
|
||||||
upOrderPayInfo(orderInfo.getId(), PayEnums.BACK_SCAN, paymentId,
|
upOrderPayInfo(orderInfo.getId(), PayEnums.BACK_SCAN, paymentId,
|
||||||
@@ -375,10 +375,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
if (orderInfo.getStatus().equals(OrderStatusEnums.CANCELLED.getCode())) {
|
if (orderInfo.getStatus().equals(OrderStatusEnums.CANCELLED.getCode())) {
|
||||||
throw new CzgException("订单已过期不可退单");
|
throw new CzgException("订单已过期不可退单");
|
||||||
}
|
}
|
||||||
boolean isFirstRefund = true;
|
boolean isFirstRefund = orderInfo.getRefundAmount().compareTo(BigDecimal.ZERO) == 0;
|
||||||
if (orderInfo.getRefundAmount().compareTo(BigDecimal.ZERO) != 0) {
|
|
||||||
isFirstRefund = false;
|
|
||||||
}
|
|
||||||
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
|
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
|
||||||
Map<String, BigDecimal> returnProMap = new HashMap<>();
|
Map<String, BigDecimal> returnProMap = new HashMap<>();
|
||||||
boolean isPay = true;
|
boolean isPay = true;
|
||||||
@@ -437,9 +434,8 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
returnProMap.put(Convert.toStr(orderDetail.getProductId()), refundDetail.getNum());
|
returnProMap.put(Convert.toStr(orderDetail.getProductId()), refundDetail.getNum());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
long count = orderDetailService.queryChain()
|
long count = orderDetailService.count(QueryWrapper.create().eq(OrderDetail::getOrderId, orderInfo.getId())
|
||||||
.eq(OrderDetail::getOrderId, orderInfo.getId())
|
.ne(OrderDetail::getStatus, OrderStatusEnums.REFUND.getCode()));
|
||||||
.ne(OrderDetail::getStatus, OrderStatusEnums.REFUND.getCode()).count();
|
|
||||||
if (count > 0 && isPay) {
|
if (count > 0 && isPay) {
|
||||||
orderInfo.setStatus(OrderStatusEnums.PART_REFUND.getCode());
|
orderInfo.setStatus(OrderStatusEnums.PART_REFUND.getCode());
|
||||||
} else if (isPay) {
|
} else if (isPay) {
|
||||||
@@ -447,10 +443,9 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
orderInfo.setStatus(OrderStatusEnums.REFUND.getCode());
|
orderInfo.setStatus(OrderStatusEnums.REFUND.getCode());
|
||||||
List<OrderDetail> orderDetails = orderDetailService.queryChain()
|
List<OrderDetail> orderDetails = orderDetailService.list(
|
||||||
.select(OrderDetail::getId, OrderDetail::getProductId, OrderDetail::getNum, OrderDetail::getReturnNum, OrderDetail::getPackAmount, OrderDetail::getReturnNum)
|
QueryWrapper.create().select(OrderDetail::getId, OrderDetail::getProductId, OrderDetail::getNum, OrderDetail::getReturnNum, OrderDetail::getPackAmount, OrderDetail::getReturnNum)
|
||||||
.eq(OrderDetail::getOrderId, orderInfo.getId())
|
.eq(OrderDetail::getOrderId, orderInfo.getId()));
|
||||||
.list();
|
|
||||||
for (OrderDetail orderDetail : orderDetails) {
|
for (OrderDetail orderDetail : orderDetails) {
|
||||||
if (isPay) {
|
if (isPay) {
|
||||||
if (orderDetail.getProductId() != null && orderDetail.getProductId() > 0) {
|
if (orderDetail.getProductId() != null && orderDetail.getProductId() > 0) {
|
||||||
@@ -517,7 +512,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
@NonNull String refundReason, @NonNull BigDecimal refundAmount) {
|
@NonNull String refundReason, @NonNull BigDecimal refundAmount) {
|
||||||
OrderPayment payment = paymentService.getById(payOrderId);
|
OrderPayment payment = paymentService.getById(payOrderId);
|
||||||
AssertUtil.isNull(payment, "退款失败支付记录不存在");
|
AssertUtil.isNull(payment, "退款失败支付记录不存在");
|
||||||
Long refundId = payService.initPayment(OrderPayment.refund(shopId, orderId, PayTypeConstants.SourceType.ORDER,
|
Long refundId = payService.initPayment(OrderPayment.refund(payment.getChannel(), shopId, orderId, PayTypeConstants.SourceType.ORDER,
|
||||||
refPayOrderNo, refundAmount, payment.getId(), payment.getPlatformType()));
|
refPayOrderNo, refundAmount, payment.getId(), payment.getPlatformType()));
|
||||||
|
|
||||||
CzgResult<RefundRespDTO> refund = payService.refund(shopId, new CzgRefundReq(refPayOrderNo, refundReason, refundAmount.multiply(PayService.MONEY_RATE).longValue(),
|
CzgResult<RefundRespDTO> refund = payService.refund(shopId, new CzgRefundReq(refPayOrderNo, refundReason, refundAmount.multiply(PayService.MONEY_RATE).longValue(),
|
||||||
@@ -529,6 +524,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
throw new CzgException(refund.getMsg());
|
throw new CzgException(refund.getMsg());
|
||||||
} else {
|
} else {
|
||||||
OrderPayment upPayment = new OrderPayment();
|
OrderPayment upPayment = new OrderPayment();
|
||||||
|
upPayment.setPayStatus(PayTypeConstants.PayStatus.SUCCESS);
|
||||||
upPayment.setPayTime(LocalDateTimeUtil.parse(refund.getData().getRefundTime()));
|
upPayment.setPayTime(LocalDateTimeUtil.parse(refund.getData().getRefundTime()));
|
||||||
upPayment.setTradeNumber(refund.getData().getThirdRefundNo());
|
upPayment.setTradeNumber(refund.getData().getThirdRefundNo());
|
||||||
upPayment.setRespJson(refund.getData().getOriginalData());
|
upPayment.setRespJson(refund.getData().getOriginalData());
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public class PayServiceImpl implements PayService {
|
|||||||
@NonNull String refundReason, @NonNull BigDecimal refundAmount) {
|
@NonNull String refundReason, @NonNull BigDecimal refundAmount) {
|
||||||
OrderPayment payment = paymentService.getById(payOrderId);
|
OrderPayment payment = paymentService.getById(payOrderId);
|
||||||
AssertUtil.isNull(payment, "退款失败,支付记录不存在");
|
AssertUtil.isNull(payment, "退款失败,支付记录不存在");
|
||||||
Long refundId = initPayment(OrderPayment.refund(shopId, sourceId, payment.getSourceType(), refPayOrderNo, refundAmount, payment.getId(), payment.getPlatformType()));
|
Long refundId = initPayment(OrderPayment.refund(payment.getChannel(), shopId, sourceId, payment.getSourceType(), refPayOrderNo, refundAmount, payment.getId(), payment.getPlatformType()));
|
||||||
CzgResult<RefundRespDTO> refund = refund(shopId, new CzgRefundReq(refPayOrderNo, refundReason, refundAmount.multiply(MONEY_RATE).longValue(),
|
CzgResult<RefundRespDTO> refund = refund(shopId, new CzgRefundReq(refPayOrderNo, refundReason, refundAmount.multiply(MONEY_RATE).longValue(),
|
||||||
payment.getAmount().multiply(PayService.MONEY_RATE).longValue(), payment.getOrderNo(), "", payment.getPlatformType()));
|
payment.getAmount().multiply(PayService.MONEY_RATE).longValue(), payment.getOrderNo(), "", payment.getPlatformType()));
|
||||||
OrderPayment uOrderPayment = new OrderPayment();
|
OrderPayment uOrderPayment = new OrderPayment();
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
|||||||
}
|
}
|
||||||
if (day <= 1) {
|
if (day <= 1) {
|
||||||
return List.of(onlineDataAmount);
|
return List.of(onlineDataAmount);
|
||||||
}else {
|
} else {
|
||||||
startDate = currentDate.minusDays(day - 1);
|
startDate = currentDate.minusDays(day - 1);
|
||||||
}
|
}
|
||||||
List<TotalVo> statDateRange = mapper.getStatDateRange(shopId, startDate, currentDate);
|
List<TotalVo> statDateRange = mapper.getStatDateRange(shopId, startDate, currentDate);
|
||||||
@@ -84,7 +84,7 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
|||||||
if (day <= 1) {
|
if (day <= 1) {
|
||||||
Map<String, BigDecimal> onlinePayTypeDate = mapper.getOnlinePayTypeDate(shopId, currentDate);
|
Map<String, BigDecimal> onlinePayTypeDate = mapper.getOnlinePayTypeDate(shopId, currentDate);
|
||||||
return CountPayTypeVo.realTimeDataByDay(onlinePayTypeDate);
|
return CountPayTypeVo.realTimeDataByDay(onlinePayTypeDate);
|
||||||
}else {
|
} else {
|
||||||
startDate = currentDate.minusDays(day - 1);
|
startDate = currentDate.minusDays(day - 1);
|
||||||
}
|
}
|
||||||
return CountPayTypeVo.mergePayTypeData(
|
return CountPayTypeVo.mergePayTypeData(
|
||||||
@@ -104,7 +104,7 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
|||||||
}
|
}
|
||||||
if (day <= 1) {
|
if (day <= 1) {
|
||||||
return List.of(onlineProfitRateBarChart);
|
return List.of(onlineProfitRateBarChart);
|
||||||
}else {
|
} else {
|
||||||
startDate = currentDate.minusDays(day - 1);
|
startDate = currentDate.minusDays(day - 1);
|
||||||
}
|
}
|
||||||
List<ProfitRateVO> statDateRange = mapper.profitRateBarChart(shopId, startDate, currentDate);
|
List<ProfitRateVO> statDateRange = mapper.profitRateBarChart(shopId, startDate, currentDate);
|
||||||
@@ -180,10 +180,11 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
|||||||
result.setTableCount(Optional.ofNullable(tableCount).orElse(0L));
|
result.setTableCount(Optional.ofNullable(tableCount).orElse(0L));
|
||||||
result.setProductCostAmount(Optional.ofNullable(productCostAmount).orElse(BigDecimal.ZERO));
|
result.setProductCostAmount(Optional.ofNullable(productCostAmount).orElse(BigDecimal.ZERO));
|
||||||
|
|
||||||
//会员充值退款 充值退款金额(线上退款+现金退款)
|
//会员充值金额(线上充值+现金充值+霸王餐充值)
|
||||||
BigDecimal cashRechargeAmount = Objects.requireNonNullElse(result.getCashRechargeAmount(), BigDecimal.ZERO);
|
BigDecimal cashRechargeAmount = Objects.requireNonNullElse(result.getCashRechargeAmount(), BigDecimal.ZERO);
|
||||||
BigDecimal onlineRechargeAmount = Objects.requireNonNullElse(result.getOnlineRechargeAmount(), BigDecimal.ZERO);
|
BigDecimal onlineRechargeAmount = Objects.requireNonNullElse(result.getOnlineRechargeAmount(), BigDecimal.ZERO);
|
||||||
BigDecimal rechargeAmount = cashRechargeAmount.add(onlineRechargeAmount);
|
BigDecimal freeRechargeAmount = Objects.requireNonNullElse(onlineStat != null ? onlineStat.getBackDiscountAmount() : null, BigDecimal.ZERO);
|
||||||
|
BigDecimal rechargeAmount = cashRechargeAmount.add(onlineRechargeAmount).add(freeRechargeAmount);
|
||||||
result.setRechargeAmount(rechargeAmount);
|
result.setRechargeAmount(rechargeAmount);
|
||||||
//会员充值退款 充值退款金额(线上退款+现金退款)
|
//会员充值退款 充值退款金额(线上退款+现金退款)
|
||||||
BigDecimal onlineRechargeRefundAmount = Objects.requireNonNullElse(
|
BigDecimal onlineRechargeRefundAmount = Objects.requireNonNullElse(
|
||||||
@@ -220,9 +221,6 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ public class ShopUserServiceImpl implements ShopUserPayService {
|
|||||||
return CzgResult.failure("退款失败,该充值记录不存在");
|
return CzgResult.failure("退款失败,该充值记录不存在");
|
||||||
}
|
}
|
||||||
String refPayOrderNo = "REFVIP" + IdUtil.getSnowflakeNextId();
|
String refPayOrderNo = "REFVIP" + IdUtil.getSnowflakeNextId();
|
||||||
refPaymentId = payService.initPayment(OrderPayment.refund(refPayParam.getShopId(), shopUser.getId(), PayTypeConstants.SourceType.MEMBER_IN,
|
refPaymentId = payService.initPayment(OrderPayment.refund(payment.getChannel(), refPayParam.getShopId(), shopUser.getId(), PayTypeConstants.SourceType.MEMBER_IN,
|
||||||
refPayOrderNo, refPayParam.getRefAmount(), inFlow.getId(), payment.getPlatformType()));
|
refPayOrderNo, refPayParam.getRefAmount(), inFlow.getId(), payment.getPlatformType()));
|
||||||
CzgResult<RefundRespDTO> refund = payService.refund(refPayParam.getShopId(), new CzgRefundReq(refPayOrderNo, refPayParam.getRemark(),
|
CzgResult<RefundRespDTO> refund = payService.refund(refPayParam.getShopId(), new CzgRefundReq(refPayOrderNo, refPayParam.getRemark(),
|
||||||
refPayParam.getRefAmount().multiply(PayService.MONEY_RATE).longValue(), payment.getAmount().multiply(PayService.MONEY_RATE).longValue(),
|
refPayParam.getRefAmount().multiply(PayService.MONEY_RATE).longValue(), payment.getAmount().multiply(PayService.MONEY_RATE).longValue(),
|
||||||
|
|||||||
Reference in New Issue
Block a user