额外参数
This commit is contained in:
@@ -180,17 +180,18 @@ public interface ShopOrderStatisticMapper extends BaseMapper<ShopOrderStatistic>
|
||||
* memberRefund 会员充值的退款
|
||||
*/
|
||||
@Select("SELECT " +
|
||||
" SUM(CASE WHEN pay_type = 'order' THEN amount ELSE 0 END) AS onlinePayAmount," +
|
||||
" SUM(CASE WHEN pay_type = 'refund' THEN amount ELSE 0 END) AS onlineRefundAmount," +
|
||||
" SUM(CASE WHEN pay_type = 'free' THEN amount ELSE 0 END) AS backDiscountAmount," +
|
||||
" SUM(CASE WHEN pay_type = 'memberIn' THEN amount ELSE 0 END) AS onlineRechargeAmount, " +
|
||||
" SUM(CASE WHEN pay_type = 'memberRefund' THEN amount ELSE 0 END) AS onlineRechargeRefundAmount " +
|
||||
" SUM(CASE WHEN pay_type = 'pay' and source_type = 'order' THEN amount ELSE 0 END) AS onlinePayAmount," +
|
||||
" SUM(CASE WHEN pay_type = 'refund' and source_type = 'order' THEN amount ELSE 0 END) AS onlineRefundAmount," +
|
||||
" SUM(CASE WHEN pay_type = 'pay' and source_type = 'free' THEN amount ELSE 0 END) AS backDiscountAmount," +
|
||||
" SUM(CASE WHEN pay_type = 'pay' and source_type = 'memberIn' THEN amount ELSE 0 END) AS onlineRechargeAmount, " +
|
||||
" SUM(CASE WHEN pay_type = 'refund' and source_type = 'memberIn' THEN amount ELSE 0 END) AS onlineRechargeRefundAmount " +
|
||||
"FROM" +
|
||||
" tb_order_payment " +
|
||||
"WHERE " +
|
||||
" pay_status = 'success' " +
|
||||
" AND shop_id = #{shopId}" +
|
||||
" AND pay_type NOT IN ('memberPay', 'distribution', 'distributionRecharge')" +
|
||||
" AND source_type NOT IN ('memberPay', 'distribution', 'distributionRecharge', 'point' ,'ware')" +
|
||||
" AND pay_type != 'refundCompensate'" +
|
||||
" AND pay_date = #{tradeDay} ;")
|
||||
ShopOrderStatistic getOnlineStatSingleDate(Long shopId, LocalDate tradeDay);
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ import com.czg.entity.resp.CzgBaseResp;
|
||||
import com.czg.entity.resp.CzgRefundResp;
|
||||
import com.czg.order.dto.LtPayOtherDTO;
|
||||
import com.czg.order.dto.OrderInfoRefundDTO;
|
||||
import com.czg.order.dto.PointGoodsExchangeDTO;
|
||||
import com.czg.order.entity.OrderPayment;
|
||||
import com.czg.order.enums.PaymentPayTypeEnum;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.order.dto.*;
|
||||
import com.czg.service.order.dto.OrderPayParamDTO;
|
||||
import com.czg.service.order.dto.VipMemberPayParamDTO;
|
||||
import com.czg.service.order.dto.VipPayParamDTO;
|
||||
import com.czg.service.order.dto.VipRefundDTO;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -114,7 +115,7 @@ public interface PayService {
|
||||
* @param payType 暂时只有 POINT 积分 和 WARE 拼团商品
|
||||
* @param detail 操作描述 如 积分商品购买 / 拼团商品购买
|
||||
*/
|
||||
CzgResult<Map<String, Object>> ltPayOther(LtPayOtherDTO param, PaymentPayTypeEnum payType, String detail);
|
||||
CzgResult<Map<String, Object>> ltPayOther(LtPayOtherDTO param, String payType, String detail);
|
||||
|
||||
//-----------------------------------------------------------------退款-----------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.czg.market.service.MkDistributionConfigService;
|
||||
import com.czg.market.vo.MkDistributionConfigVO;
|
||||
import com.czg.order.dto.MkDistributionPayDTO;
|
||||
import com.czg.order.entity.OrderPayment;
|
||||
import com.czg.order.enums.PaymentPayTypeEnum;
|
||||
import com.czg.order.service.OrderPaymentService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.market.service.impl.WxServiceImpl;
|
||||
@@ -70,7 +71,7 @@ public class DistributionPayServiceImpl implements DistributionPayService {
|
||||
ShopUser shopUserInfo = shopUserService.getShopUserInfo(payParam.getShopId(), userId);
|
||||
|
||||
OrderPayment orderPayment = new OrderPayment().setShopId(payParam.getShopId()).setSourceId(isRecharge ? payParam.getShopId() : shopUserInfo.getId())
|
||||
.setPayType(isRecharge ? "distributionRecharge" : "distribution")
|
||||
.setPayType(isRecharge ? PaymentPayTypeEnum.SourceType.DISTRIBUTION_RECHARGE : PaymentPayTypeEnum.SourceType.DISTRIBUTION )
|
||||
.setOrderNo(payParam.getPlatformType() + IdUtil.getSnowflakeNextId())
|
||||
.setAmount(isRecharge ? payParam.getAmount() : detail.getPayAmount());
|
||||
orderPaymentService.save(orderPayment);
|
||||
|
||||
@@ -182,6 +182,7 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
|
||||
param.setPrice(ware.getGroupPrice().multiply(BigDecimal.valueOf(param.getNumber())));
|
||||
|
||||
GbOrderDetail record = new GbOrderDetail();
|
||||
record.setGroupOrderNo(param.getGroupOrderNo());
|
||||
record.setShopId(param.getShopId());
|
||||
record.setUserId(param.getUserId());
|
||||
record.setWareId(param.getParamId());
|
||||
@@ -194,7 +195,7 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
|
||||
detailService.save(record);
|
||||
param.setRecordId(record.getId());
|
||||
CzgResult<Map<String, Object>> result = CzgResult.success();
|
||||
CzgResult<Map<String, Object>> mapCzgResult = payService.ltPayOther(param, PaymentPayTypeEnum.WARE, "拼团商品购买");
|
||||
CzgResult<Map<String, Object>> mapCzgResult = payService.ltPayOther(param, PaymentPayTypeEnum.SourceType.WARE, "拼团商品购买");
|
||||
if (200 != mapCzgResult.getCode()) {
|
||||
return mapCzgResult;
|
||||
}
|
||||
|
||||
@@ -1043,10 +1043,10 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
}
|
||||
payment.setTradeNumber(czgCallBackDto.getPayOrderId());
|
||||
payment.setRespJson(resultJson.toString());
|
||||
payment.setPayStatus("fail");
|
||||
payment.setPayStatus(PaymentPayTypeEnum.PayStatus.FAIL);
|
||||
if ("TRADE_SUCCESS".equals(czgCallBackDto.getState())) {
|
||||
payment.setPayStatus("success");
|
||||
if (PaymentPayTypeEnum.ORDER.getValue().equals(payment.getPayType())) {
|
||||
payment.setPayStatus(PaymentPayTypeEnum.PayStatus.SUCCESS);
|
||||
if (PaymentPayTypeEnum.SourceType.ORDER.equals(payment.getPayType())) {
|
||||
OrderInfo orderInfo = orderInfoService.getById(payment.getSourceId());
|
||||
if (orderInfo == null) {
|
||||
log.error("订单支付回调失败,订单不存在,支付记录Id,{}", payment.getId());
|
||||
@@ -1058,8 +1058,9 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
distributionUserService.costUpgradeLevelBefore(orderInfo.getUserId(), orderInfo.getShopId());
|
||||
// 分销奖励
|
||||
distributionUserService.distribute(orderInfo.getId(), orderInfo.getOrderNo(), payment.getAmount(), orderInfo.getUserId(), orderInfo.getShopId(), "order");
|
||||
} else if (PaymentPayTypeEnum.MEMBER_IN.getValue().equals(payment.getPayType()) || PaymentPayTypeEnum.FREE.getValue().equals(payment.getPayType())) {
|
||||
boolean isFree = PaymentPayTypeEnum.FREE.getValue().equals(payment.getPayType());
|
||||
}
|
||||
else if (PaymentPayTypeEnum.SourceType.MEMBER_IN.equals(payment.getPayType()) || PaymentPayTypeEnum.SourceType.FREE.equals(payment.getPayType())) {
|
||||
boolean isFree = PaymentPayTypeEnum.SourceType.FREE.equals(payment.getPayType());
|
||||
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
||||
OrderInfo orderInfo = null;
|
||||
if (shopUser == null) {
|
||||
@@ -1159,7 +1160,8 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
// if (orderInfo != null) {
|
||||
// distributionUserService.distribute(payment.getId(), payment.getOrderNo(), payment.getAmount(), orderInfo.getUserId(), payment.getShopId(), "recharge");
|
||||
// }
|
||||
} else if (PaymentPayTypeEnum.MEMBER_PAY.getValue().equals(payment.getPayType())) {
|
||||
}
|
||||
else if (PaymentPayTypeEnum.SourceType.MEMBER_PAY.equals(payment.getPayType())) {
|
||||
//购买会员
|
||||
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
||||
memberConfigService.joinMember(payment.getShopId(), shopUser.getUserId(), payment.getRelatedId());
|
||||
@@ -1167,11 +1169,12 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
// memberConfigService.deliver(shopUser.getMainShopId(), shopUser.getUserId(), TableValueConstant.MemberExpFlow.Type.COST, payment.getAmount(), null, payment.getId());
|
||||
|
||||
// 分销员开通
|
||||
} else if (PaymentPayTypeEnum.DISTRIBUTION.getValue().equals(payment.getPayType())) {
|
||||
}
|
||||
else if (PaymentPayTypeEnum.SourceType.DISTRIBUTION.equals(payment.getPayType())) {
|
||||
distributionUserService.open(payment.getSourceId(), payment.getAmount(), payment.getShopId(), payment.getId());
|
||||
} else if (PaymentPayTypeEnum.POINT.getValue().equals(payment.getPayType())) {
|
||||
} else if (PaymentPayTypeEnum.SourceType.POINT.equals(payment.getPayType())) {
|
||||
goodPayService.payCallBack(payment.getSourceId(), payment.getId());
|
||||
} else if (PaymentPayTypeEnum.WARE.getValue().equals(payment.getPayType())) {
|
||||
} else if (PaymentPayTypeEnum.SourceType.WARE.equals(payment.getPayType())) {
|
||||
gbOrderService.payCallBack(payment.getSourceId(), payment.getId());
|
||||
}
|
||||
}
|
||||
@@ -1186,9 +1189,9 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
log.info("订单处理过,payment id:{}", payment.getId());
|
||||
return;
|
||||
}
|
||||
payment.setPayStatus("success");
|
||||
payment.setPayStatus(PaymentPayTypeEnum.PayStatus.SUCCESS);
|
||||
if (!"SUCCESS".equals(czgCallBackDto.getState())) {
|
||||
payment.setPayStatus("fail");
|
||||
payment.setPayStatus(PaymentPayTypeEnum.PayStatus.FAIL);
|
||||
if ("refund".equals(payment.getPayType())) {
|
||||
//TODO 订单退款失败 暂不考虑回滚 填充退款原因
|
||||
orderInfoService.updateById(new OrderInfo()
|
||||
|
||||
@@ -282,7 +282,7 @@ public class PayServiceImpl implements PayService {
|
||||
return CzgResult.failure("支付失败 充值金额必须大雨订单金额");
|
||||
}
|
||||
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
||||
Long paymentId = initOrderPayment(new OrderPayment(payParam.getShopId(), shopUser.getId(), "memberIn", payOrderNo,
|
||||
Long paymentId = initOrderPayment(new OrderPayment(payParam.getShopId(), shopUser.getId(), PaymentPayTypeEnum.SourceType.MEMBER_IN, PaymentPayTypeEnum.PayType.PAY, payOrderNo,
|
||||
"", rechargeDetail.getAmount(), rechargeDetail.getId()));
|
||||
upOrderPayInfo(orderInfo.getId(), PayEnums.VIP_PAY, paymentId,
|
||||
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
||||
@@ -296,7 +296,7 @@ public class PayServiceImpl implements PayService {
|
||||
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
|
||||
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
||||
Long paymentId = initOrderPayment(new OrderPayment(payParam.getShopId(), orderInfo.getId(),
|
||||
"order", payOrderNo, "", orderInfo.getOrderAmount()));
|
||||
PaymentPayTypeEnum.SourceType.ORDER, PaymentPayTypeEnum.PayType.PAY, payOrderNo, "", orderInfo.getOrderAmount()));
|
||||
upOrderPayInfo(orderInfo.getId(), PayEnums.H5_PAY, paymentId,
|
||||
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
||||
return h5Pay(payParam.getShopId(), new CzgH5PayReq(payOrderNo, orderInfo.getOrderAmount().multiply(MONEY_RATE).longValue(),
|
||||
@@ -312,7 +312,7 @@ public class PayServiceImpl implements PayService {
|
||||
AssertUtil.isBlank(payParam.getOpenId(), "用户小程序ID不能为空");
|
||||
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
||||
Long paymentId = initOrderPayment(new OrderPayment(payParam.getShopId(), orderInfo.getId(),
|
||||
"order", payOrderNo, "", orderInfo.getOrderAmount()));
|
||||
PaymentPayTypeEnum.SourceType.ORDER, PaymentPayTypeEnum.PayType.PAY, payOrderNo, "", orderInfo.getOrderAmount()));
|
||||
upOrderPayInfo(orderInfo.getId(), "aliPay".equals(payParam.getPayType()) ? PayEnums.ALIPAY_MINI : PayEnums.WECHAT_MINI, paymentId,
|
||||
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
||||
return jsPay(payParam.getShopId(), payParam.getPayType(), new CzgJsPayReq(payOrderNo, orderInfo.getOrderAmount().multiply(MONEY_RATE).longValue(),
|
||||
@@ -336,7 +336,7 @@ public class PayServiceImpl implements PayService {
|
||||
}
|
||||
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
||||
Long paymentId = initOrderPayment(new OrderPayment(payParam.getShopId(), orderInfo.getId(),
|
||||
"order", payOrderNo, "", orderInfo.getOrderAmount()));
|
||||
PaymentPayTypeEnum.SourceType.ORDER, PaymentPayTypeEnum.PayType.PAY, payOrderNo, "", orderInfo.getOrderAmount()));
|
||||
upOrderPayInfo(orderInfo.getId(), "aliPay".equals(payParam.getPayType()) ? PayEnums.ALIPAY_MINI : PayEnums.WECHAT_MINI, paymentId,
|
||||
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
||||
return jsPay(payParam.getShopId(), payParam.getPayType(), new CzgJsPayReq(payOrderNo, orderInfo.getOrderAmount().multiply(MONEY_RATE).longValue(),
|
||||
@@ -351,7 +351,7 @@ public class PayServiceImpl implements PayService {
|
||||
AssertUtil.isBlank(payParam.getOpenId(), "用户小程序ID不能为空");
|
||||
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
||||
Long paymentId = initOrderPayment(new OrderPayment(payParam.getShopId(), orderInfo.getId(),
|
||||
"order", payOrderNo, "", orderInfo.getOrderAmount()));
|
||||
PaymentPayTypeEnum.SourceType.ORDER, PaymentPayTypeEnum.PayType.PAY, payOrderNo, "", orderInfo.getOrderAmount()));
|
||||
upOrderPayInfo(orderInfo.getId(), "aliPay".equals(payParam.getPayType()) ? PayEnums.ALIPAY_MINI : PayEnums.WECHAT_MINI, paymentId,
|
||||
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
||||
return ltPay(payParam.getShopId(), payParam.getPayType(), new CzgLtPayReq(payOrderNo, orderInfo.getOrderAmount().multiply(MONEY_RATE).longValue(),
|
||||
@@ -374,7 +374,7 @@ public class PayServiceImpl implements PayService {
|
||||
payParam.setAmount(amount);
|
||||
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
||||
Long paymentId = initOrderPayment(new OrderPayment(payParam.getShopId(), orderInfo.getId(),
|
||||
"order", payOrderNo, "", orderInfo.getOrderAmount()));
|
||||
PaymentPayTypeEnum.SourceType.ORDER, PaymentPayTypeEnum.PayType.PAY, payOrderNo, "", orderInfo.getOrderAmount()));
|
||||
upOrderPayInfo(orderInfo.getId(), PayEnums.MAIN_SCAN, paymentId,
|
||||
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
||||
return scanPay(payParam.getShopId(), new CzgScanPayReq(payOrderNo, orderInfo.getOrderAmount().multiply(MONEY_RATE).longValue(),
|
||||
@@ -401,7 +401,7 @@ public class PayServiceImpl implements PayService {
|
||||
|
||||
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
||||
Long paymentId = initOrderPayment(new OrderPayment(payParam.getShopId(), orderInfo.getId(),
|
||||
"order", payOrderNo, payParam.getAuthCode(), orderInfo.getOrderAmount()));
|
||||
PaymentPayTypeEnum.SourceType.ORDER, PaymentPayTypeEnum.PayType.PAY, payOrderNo, payParam.getAuthCode(), orderInfo.getOrderAmount()));
|
||||
CzgResult<Map<String, Object>> mapCzgResult = microPay(payParam.getShopId(), new CzgMicroPayReq(payOrderNo, orderInfo.getOrderAmount().multiply(MONEY_RATE).longValue(),
|
||||
"点餐支付", payParam.getAuthCode(), payParam.getBuyerRemark(), ""));
|
||||
if (mapCzgResult.getCode() == 200) {
|
||||
@@ -449,7 +449,8 @@ public class PayServiceImpl implements PayService {
|
||||
AssertUtil.isBlank(payParam.getOpenId(), "用户小程序ID不能为空");
|
||||
AssertUtil.isBlank(payParam.getPayType(), "支付方式不能为空");
|
||||
String payOrderNo = payParam.getPlatformType() + CzgRandomUtils.snowflake();
|
||||
initOrderPayment(new OrderPayment(payParam.getShopId(), shopUser.getId(), isFree ? "free" : "memberIn", payOrderNo,
|
||||
String payType = isFree ? PaymentPayTypeEnum.SourceType.FREE : PaymentPayTypeEnum.SourceType.MEMBER_IN;
|
||||
initOrderPayment(new OrderPayment(payParam.getShopId(), shopUser.getId(), payType, PaymentPayTypeEnum.PayType.PAY, payOrderNo,
|
||||
"", payParam.getAmount(), isFree ? payParam.getOrderId() : payParam.getActivateId()));
|
||||
return jsPay(payParam.getShopId(), payParam.getPayType(), new CzgJsPayReq(payOrderNo, payParam.getAmount().multiply(MONEY_RATE).longValue(),
|
||||
"会员充值", payParam.getOpenId(), clintIp, payParam.getReturnUrl(), payParam.getBuyerRemark(), ""));
|
||||
@@ -469,7 +470,7 @@ public class PayServiceImpl implements PayService {
|
||||
AssertUtil.isBlank(payParam.getOpenId(), "用户小程序ID不能为空");
|
||||
AssertUtil.isBlank(payParam.getPayType(), "支付方式不能为空");
|
||||
String payOrderNo = payParam.getPlatformType() + CzgRandomUtils.snowflake();
|
||||
initOrderPayment(new OrderPayment(payParam.getShopId(), shopUser.getId(), "memberPay", payOrderNo,
|
||||
initOrderPayment(new OrderPayment(payParam.getShopId(), shopUser.getId(), PaymentPayTypeEnum.SourceType.MEMBER_PAY, PaymentPayTypeEnum.PayType.PAY, payOrderNo,
|
||||
"", memberOrder.getAmount(), memberOrder.getId()));
|
||||
return ltPay(payParam.getShopId(), payParam.getPayType(), new CzgLtPayReq(payOrderNo, memberOrder.getAmount().multiply(MONEY_RATE).longValue(),
|
||||
payParam.getPayType(), "会员充值", "wechatPay".equals(payParam.getPayType()) ? userInfo.getWechatOpenId() : userInfo.getAlipayOpenId(), clientIP, payParam.getReturnUrl(), payParam.getBuyerRemark(), ""));
|
||||
@@ -496,7 +497,8 @@ public class PayServiceImpl implements PayService {
|
||||
}
|
||||
|
||||
String payOrderNo = payParam.getPlatformType() + CzgRandomUtils.snowflake();
|
||||
initOrderPayment(new OrderPayment(payParam.getShopId(), shopUser.getId(), isFree ? "free" : "memberIn", payOrderNo,
|
||||
String payType = isFree ? PaymentPayTypeEnum.SourceType.FREE : PaymentPayTypeEnum.SourceType.MEMBER_IN;
|
||||
initOrderPayment(new OrderPayment(payParam.getShopId(), shopUser.getId(), payType, PaymentPayTypeEnum.PayType.PAY, payOrderNo,
|
||||
"", payParam.getAmount(), isFree ? payParam.getOrderId() : payParam.getActivateId()));
|
||||
return ltPay(payParam.getShopId(), payParam.getPayType(), new CzgLtPayReq(payOrderNo, payParam.getAmount().multiply(MONEY_RATE).longValue(),
|
||||
payParam.getPayType(), "会员充值", payParam.getOpenId(), clintIp, payParam.getReturnUrl(), payParam.getBuyerRemark(), ""));
|
||||
@@ -518,7 +520,8 @@ public class PayServiceImpl implements PayService {
|
||||
|
||||
BigDecimal amount = shopRechargeService.checkRecharge(mainShopId, rechargeDTO.getShopId(), shopUser.getUserId(), rechargeDTO.getRechargeDetailId(), rechargeDTO.getAmount());
|
||||
String payOrderNo = rechargeDTO.getPlatformType() + CzgRandomUtils.snowflake();
|
||||
initOrderPayment(new OrderPayment(rechargeDTO.getShopId(), shopUser.getId(), isFree ? "free" : "memberIn", payOrderNo,
|
||||
String payType = isFree ? PaymentPayTypeEnum.SourceType.FREE : PaymentPayTypeEnum.SourceType.MEMBER_IN;
|
||||
initOrderPayment(new OrderPayment(rechargeDTO.getShopId(), shopUser.getId(), payType, PaymentPayTypeEnum.PayType.PAY, payOrderNo,
|
||||
"", amount, isFree ? rechargeDTO.getOrderId() : rechargeDTO.getRechargeDetailId()));
|
||||
return ltPay(rechargeDTO.getShopId(), rechargeDTO.getPayType(), new CzgLtPayReq(payOrderNo, amount.multiply(MONEY_RATE).longValue(),
|
||||
rechargeDTO.getPayType(), "会员充值", "wechatPay".equals(rechargeDTO.getPayType()) ? userInfo.getWechatOpenId() : userInfo.getAlipayOpenId(),
|
||||
@@ -532,7 +535,8 @@ public class PayServiceImpl implements PayService {
|
||||
ShopUser shopUser = shopUserService.getById(payParam.getShopUserId());
|
||||
AssertUtil.isNull(shopUser, "充值失败 该店铺用户不存在");
|
||||
String payOrderNo = payParam.getPlatformType() + CzgRandomUtils.snowflake();
|
||||
initOrderPayment(new OrderPayment(payParam.getShopId(), shopUser.getId(), isFree ? "free" : "memberIn", payOrderNo,
|
||||
String payType = isFree ? PaymentPayTypeEnum.SourceType.FREE : PaymentPayTypeEnum.SourceType.MEMBER_IN;
|
||||
initOrderPayment(new OrderPayment(payParam.getShopId(), shopUser.getId(), payType, PaymentPayTypeEnum.PayType.PAY, payOrderNo,
|
||||
"", payParam.getAmount(), isFree ? payParam.getOrderId() : payParam.getActivateId()));
|
||||
return scanPay(payParam.getShopId(), new CzgScanPayReq(payOrderNo, payParam.getAmount().multiply(MONEY_RATE).longValue(),
|
||||
"会员充值", clintIp, payParam.getReturnUrl(), payParam.getBuyerRemark(), ""));
|
||||
@@ -546,7 +550,8 @@ public class PayServiceImpl implements PayService {
|
||||
ShopUser shopUser = shopUserService.getById(payParam.getShopUserId());
|
||||
AssertUtil.isNull(shopUser, "充值失败 该店铺用户不存在");
|
||||
String payOrderNo = payParam.getPlatformType() + CzgRandomUtils.snowflake();
|
||||
initOrderPayment(new OrderPayment(payParam.getShopId(), shopUser.getId(), isFree ? "free" : "memberIn", payOrderNo,
|
||||
String payType = isFree ? PaymentPayTypeEnum.SourceType.FREE : PaymentPayTypeEnum.SourceType.MEMBER_IN;
|
||||
initOrderPayment(new OrderPayment(payParam.getShopId(), shopUser.getId(), payType, PaymentPayTypeEnum.PayType.PAY, payOrderNo,
|
||||
payParam.getAuthCode(), payParam.getAmount(), isFree ? payParam.getOrderId() : payParam.getActivateId()));
|
||||
CzgResult<Map<String, Object>> mapCzgResult = microPay(payParam.getShopId(), new CzgMicroPayReq(payOrderNo, payParam.getAmount().multiply(MONEY_RATE).longValue(),
|
||||
"会员充值", payParam.getAuthCode(), payParam.getBuyerRemark(), ""));
|
||||
@@ -557,11 +562,11 @@ public class PayServiceImpl implements PayService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public CzgResult<Map<String, Object>> ltPayOther(LtPayOtherDTO param, PaymentPayTypeEnum payType, String detail) {
|
||||
public CzgResult<Map<String, Object>> ltPayOther(LtPayOtherDTO param, String payType, String detail) {
|
||||
AssertUtil.isBlank(param.getOpenId(), "用户小程序ID不能为空");
|
||||
AssertUtil.isBlank(param.getPayType(), "支付方式不能为空");
|
||||
String payOrderNo = "DH" + IdUtil.getSnowflakeNextId();
|
||||
initOrderPayment(new OrderPayment(param.getShopId(), param.getRecordId(), payType.getValue(), payOrderNo,
|
||||
initOrderPayment(new OrderPayment(param.getShopId(), param.getRecordId(), payType, PaymentPayTypeEnum.PayType.PAY, payOrderNo,
|
||||
"", param.getPrice(), null));
|
||||
return ltPay(param.getShopId(), param.getPayType(), new CzgLtPayReq(payOrderNo, param.getPrice().multiply(MONEY_RATE).longValue(),
|
||||
param.getPayType(), detail, param.getOpenId(), param.getIp(), "", "", ""));
|
||||
@@ -629,7 +634,7 @@ public class PayServiceImpl implements PayService {
|
||||
}
|
||||
String refPayOrderNo = "REFVIP" + IdUtil.getSnowflakeNextId();
|
||||
refPaymentId = initOrderPayment(new OrderPayment(refPayParam.getShopId(), shopUser.getId(),
|
||||
PaymentPayTypeEnum.MEMBER_REFUND.getValue(), refPayOrderNo, null, refPayParam.getRefAmount()));
|
||||
PaymentPayTypeEnum.SourceType.MEMBER_IN, PaymentPayTypeEnum.PayType.REFUND, refPayOrderNo, null, refPayParam.getRefAmount()));
|
||||
CzgResult<CzgRefundResp> refund = refund(refPayParam.getShopId(), new CzgRefundReq(refPayOrderNo, refPayParam.getRemark(),
|
||||
refPayParam.getRefAmount().multiply(MONEY_RATE).longValue(), payment.getOrderNo(), ""));
|
||||
if (refund.getCode() != 200 || refund.getData() == null || !"SUCCESS".equals(refund.getData().getState())) {
|
||||
@@ -639,7 +644,7 @@ public class PayServiceImpl implements PayService {
|
||||
.eq(OrderPayment::getId, refPaymentId)
|
||||
.set(OrderPayment::getPayTime, refund.getData().getRefundTime())
|
||||
.set(OrderPayment::getTradeNumber, refund.getData().getRefundOrderId())
|
||||
.set(OrderPayment::getPayStatus, "success")
|
||||
.set(OrderPayment::getPayStatus, PaymentPayTypeEnum.PayStatus.SUCCESS)
|
||||
.set(OrderPayment::getRespJson, JSONObject.toJSONString(refund.getData()))
|
||||
.update();
|
||||
}
|
||||
@@ -824,7 +829,7 @@ public class PayServiceImpl implements PayService {
|
||||
@NonNull String refundReason, @NonNull BigDecimal refundAmount) {
|
||||
OrderPayment payment = paymentService.getById(payOrderId);
|
||||
AssertUtil.isNull(payment, "退款失败支付记录不存在");
|
||||
Long refundId = initOrderPayment(new OrderPayment(shopId, orderId, PaymentPayTypeEnum.REFUND.getValue(), refPayOrderNo, null, refundAmount, payment.getId()));
|
||||
Long refundId = initOrderPayment(new OrderPayment(shopId, orderId, PaymentPayTypeEnum.SourceType.ORDER, PaymentPayTypeEnum.PayType.REFUND, refPayOrderNo, null, refundAmount, payment.getId()));
|
||||
CzgResult<CzgRefundResp> refund = refund(shopId, new CzgRefundReq(refPayOrderNo, refundReason, refundAmount.multiply(MONEY_RATE).longValue(),
|
||||
payment.getOrderNo(), ""));
|
||||
if (refund.getCode() != 200 || refund.getData() == null || !"SUCCESS".equals(refund.getData().getState())) {
|
||||
@@ -848,22 +853,16 @@ public class PayServiceImpl implements PayService {
|
||||
@NonNull String refundReason, @NonNull BigDecimal refundAmount) {
|
||||
OrderPayment payment = paymentService.getById(payOrderId);
|
||||
AssertUtil.isNull(payment, "退款失败,支付记录不存在");
|
||||
Long refundId = initOrderPayment(new OrderPayment(shopId, sourceId, PaymentPayTypeEnum.REFUND.getValue(), refPayOrderNo, null, refundAmount, payment.getId()));
|
||||
Long refundId = initOrderPayment(new OrderPayment(shopId, sourceId, payment.getSourceType(), PaymentPayTypeEnum.PayType.REFUND, refPayOrderNo, null, refundAmount, payment.getId()));
|
||||
CzgResult<CzgRefundResp> refund = refund(shopId, new CzgRefundReq(refPayOrderNo, refundReason, refundAmount.multiply(MONEY_RATE).longValue(),
|
||||
payment.getOrderNo(), ""));
|
||||
OrderPayment uOrderPayment = new OrderPayment();
|
||||
uOrderPayment.setTradeNumber(refund.getData().getRefundOrderId());
|
||||
uOrderPayment.setRespJson(JSONObject.toJSONString(refund.getData()));
|
||||
if (refund.getCode() != 200 || refund.getData() == null || !"SUCCESS".equals(refund.getData().getState())) {
|
||||
uOrderPayment.setPayStatus("fail");
|
||||
// paymentService.updateChain()
|
||||
// .eq(OrderPayment::getId, refundId)
|
||||
// .set(OrderPayment::getTradeNumber, refund.getData().getRefundOrderId())
|
||||
// .set(OrderPayment::getRespJson, JSONObject.toJSONString(refund.getData()))
|
||||
// .set(OrderPayment::getPayStatus, "fail")
|
||||
// .update();
|
||||
uOrderPayment.setPayStatus(PaymentPayTypeEnum.PayStatus.FAIL);
|
||||
} else {
|
||||
uOrderPayment.setPayStatus("success");
|
||||
uOrderPayment.setPayStatus(PaymentPayTypeEnum.PayStatus.SUCCESS);
|
||||
uOrderPayment.setPayTime(LocalDateTimeUtil.parse(refund.getData().getRefundTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
paymentService.update(uOrderPayment, QueryWrapper.create().eq(OrderPayment::getId, refundId));
|
||||
@@ -872,21 +871,24 @@ public class PayServiceImpl implements PayService {
|
||||
@Override
|
||||
@Transactional
|
||||
public void unifyRefund(OrderPayment refundPayment, String refPayOrderNo) {
|
||||
//支付的 订单
|
||||
OrderPayment payment = paymentService.getById(refundPayment.getRelatedId());
|
||||
AssertUtil.isNull(payment, "退款失败,支付记录不存在");
|
||||
Long refundId = refundPayment.getId();
|
||||
Long refundCompensate = initOrderPayment(new OrderPayment(refundPayment.getShopId(), refundPayment.getSourceId(), payment.getSourceType(), PaymentPayTypeEnum.PayType.REFUND_COMPENSATE,
|
||||
refPayOrderNo, null, refundPayment.getAmount(), refundPayment.getId()));
|
||||
CzgResult<CzgRefundResp> refund = refund(payment.getShopId(), new CzgRefundReq(refPayOrderNo, "退款补偿", refundPayment.getAmount().multiply(MONEY_RATE).longValue(),
|
||||
payment.getOrderNo(), ""));
|
||||
OrderPayment uOrderPayment = new OrderPayment();
|
||||
uOrderPayment.setTradeNumber(refund.getData().getRefundOrderId());
|
||||
uOrderPayment.setRespJson(JSONObject.toJSONString(refund.getData()));
|
||||
if (refund.getCode() != 200 || refund.getData() == null || !"SUCCESS".equals(refund.getData().getState())) {
|
||||
uOrderPayment.setPayStatus("fail");
|
||||
uOrderPayment.setPayStatus(PaymentPayTypeEnum.PayStatus.FAIL);
|
||||
} else {
|
||||
uOrderPayment.setPayStatus("success");
|
||||
uOrderPayment.setPayStatus(PaymentPayTypeEnum.PayStatus.SUCCESS);
|
||||
uOrderPayment.setPayTime(LocalDateTimeUtil.parse(refund.getData().getRefundTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
paymentService.update(uOrderPayment, QueryWrapper.create().eq(OrderPayment::getId, refundId));
|
||||
paymentService.update(uOrderPayment, QueryWrapper.create().eq(OrderPayment::getId, refundPayment.getId()));
|
||||
paymentService.update(uOrderPayment, QueryWrapper.create().eq(OrderPayment::getId, refundCompensate));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -109,7 +109,7 @@ public class PointsGoodPayServiceImpl implements PointsGoodPayService {
|
||||
goodsRecordService.save(record);
|
||||
param.setRecordId(record.getId());
|
||||
CzgResult<Map<String, Object>> result = CzgResult.success();
|
||||
CzgResult<Map<String, Object>> mapCzgResult = payService.ltPayOther(param, PaymentPayTypeEnum.POINT, "积分商品购买");
|
||||
CzgResult<Map<String, Object>> mapCzgResult = payService.ltPayOther(param, PaymentPayTypeEnum.SourceType.POINT, "积分商品购买");
|
||||
if (200 != mapCzgResult.getCode()) {
|
||||
return mapCzgResult;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
<select id="getGbOrderPage" resultType="com.czg.order.vo.GbOrderDetailVO">
|
||||
SELECT
|
||||
detail.* ,`order`.ware_json as wareJson,`order`.group_end_time as groupEndTime,`order`.group_people_num as groupPeopleNum
|
||||
,`user`.nick_name as userName,`user`.phone as userPhone,shop.shop_name as shopName,shop.address as shopAddress
|
||||
detail.* ,`order`.ware_json as wareJson,`order`.group_end_time as groupEndTime,`order`.group_people_num as groupPeopleNum,`order`.ware_group_price as wareGroupPrice,
|
||||
`order`.ware_original_price as wareOriginalPrice,`user`.nick_name as userName,`user`.phone as userPhone,shop.shop_name as shopName,shop.address as shopAddress
|
||||
FROM
|
||||
`gb_order_detail` detail
|
||||
LEFT JOIN gb_order `order` on detail.group_order_no = `order`.group_order_no and `order`.shop_id = #{shopId}
|
||||
@@ -44,8 +44,8 @@
|
||||
|
||||
<select id="getGbOrderDetail" resultType="com.czg.order.vo.GbOrderDetailVO">
|
||||
SELECT
|
||||
detail.* ,`order`.ware_json as wareJson,`order`.group_end_time as groupEndTime,`user`.nick_name as userName,
|
||||
`user`.phone as userPhone,shop.shop_name as shopName,shop.address as shopAddress
|
||||
detail.* ,`order`.ware_json as wareJson,`order`.group_end_time as groupEndTime,`order`.group_people_num as groupPeopleNum,`order`.ware_group_price as wareGroupPrice,
|
||||
`order`.ware_original_price as wareOriginalPrice,`user`.nick_name as userName,`user`.phone as userPhone,shop.shop_name as shopName,shop.address as shopAddress
|
||||
FROM
|
||||
`gb_order_detail` detail
|
||||
LEFT JOIN gb_order `order` on detail.group_order_no = `order`.group_order_no and `order`.shop_id = #{shopId}
|
||||
@@ -55,6 +55,7 @@
|
||||
detail.shop_id = #{shopId} and detail.id=#{detailId}
|
||||
order by detail.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getGbOrderDetailUsers" resultType="com.czg.order.vo.GbOrderUserVO">
|
||||
select `user`.nick_name as userName, `user`.phone as userPhone, `user`.head_img as userAvatar
|
||||
from gb_order_detail detail
|
||||
|
||||
Reference in New Issue
Block a user