feat: 支付宝相关支付
parent
21a020f430
commit
bde92cebdf
|
@ -0,0 +1,47 @@
|
||||||
|
package cn.iocoder.yudao.module.shop.request.member;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Title:AlipayNotifyParamRequest
|
||||||
|
* @Description: TODO
|
||||||
|
* @author: tangqian
|
||||||
|
* @date: 2023/5/19 10:27
|
||||||
|
* @version: V1.0.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class AlipayNotifyParamRequest implements Serializable {
|
||||||
|
private static final long serialVersionUID = 5839750515063699319L;
|
||||||
|
private String appId;
|
||||||
|
private String tradeNo; // 支付宝交易凭证号
|
||||||
|
private String outTradeNo; // 原支付请求的商户订单号
|
||||||
|
private String outBizNo; // 商户业务ID,主要是退款通知中返回退款申请的流水号
|
||||||
|
private String buyerId; // 买家支付宝账号对应的支付宝唯一用户号。以2088开头的纯16位数字
|
||||||
|
private String buyerLogonId; // 买家支付宝账号
|
||||||
|
private String sellerId; // 卖家支付宝用户号
|
||||||
|
private String sellerEmail; // 卖家支付宝账号
|
||||||
|
private String tradeStatus; // 交易目前所处的状态,见交易状态说明
|
||||||
|
private String totalAmount; // 本次交易支付的订单金额
|
||||||
|
private String receiptAmount; // 商家在交易中实际收到的款项
|
||||||
|
private String buyerPayAmount; // 用户在交易中支付的金额
|
||||||
|
private String refundFee; // 退款通知中,返回总退款金额,单位为元,支持两位小数
|
||||||
|
private String subject; // 商品的标题/交易标题/订单标题/订单关键字等
|
||||||
|
private String body; // 该订单的备注、描述、明细等。对应请求时的body参数,原样通知回来
|
||||||
|
private Date gmtCreate; // 该笔交易创建的时间。格式为yyyy-MM-dd HH:mm:ss
|
||||||
|
private Date gmtPayment; // 该笔交易的买家付款时间。格式为yyyy-MM-dd HH:mm:ss
|
||||||
|
private Date notifyTime; // 通知时间。格式为yyyy-MM-dd HH:mm:ss
|
||||||
|
private Date gmtRefund; // 该笔交易的退款时间。格式为yyyy-MM-dd HH:mm:ss.S
|
||||||
|
private Date gmtClose; // 该笔交易结束时间。格式为yyyy-MM-dd HH:mm:ss
|
||||||
|
private String fundBillList; // 支付成功的各个渠道金额信息,array
|
||||||
|
private String passbackParams; // 公共回传参数,如果请求时传递了该参数,则返回给商户时会在异步通知时将该参数原样返回。
|
||||||
|
private String authAppId;
|
||||||
|
private String notifyId;
|
||||||
|
private String notifyType;
|
||||||
|
private String version;
|
||||||
|
private String invoiceAmount;//交易中可给用户开具发票的金额
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.shop.controller.admin.notify;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.module.shop.service.order.StoreOrderService;
|
import cn.iocoder.yudao.module.shop.service.order.StoreOrderService;
|
||||||
|
import com.alipay.api.AlipayApiException;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -12,6 +13,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.security.PermitAll;
|
import javax.annotation.security.PermitAll;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,12 +34,13 @@ public class AliPayNotifyController {
|
||||||
|
|
||||||
@PermitAll
|
@PermitAll
|
||||||
@PostMapping("pay_notify")
|
@PostMapping("pay_notify")
|
||||||
public Object payNotify(HttpServletRequest request, Map<String, String> params) {
|
public Object payNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, AlipayApiException {
|
||||||
return storeOrderService.aliNotify(request, params);
|
return storeOrderService.aliNotify(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PermitAll
|
@PermitAll
|
||||||
@PostMapping("refund_notify")
|
@PostMapping("refund_notify")
|
||||||
public Object refundNotify(HttpServletRequest request, @RequestBody Map<String, String> params) {
|
public Object refundNotify(HttpServletRequest request, HttpServletResponse response) {
|
||||||
return storeOrderService.refundNotify(request, params);
|
return storeOrderService.refundNotify(request, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@ public class RechargeOrderRespVO extends RechargeOrderBaseVO {
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private String stringCreateTime;
|
||||||
|
@Schema(description = "档次")
|
||||||
|
private String grade;
|
||||||
@Schema(description = "组织名称")
|
@Schema(description = "组织名称")
|
||||||
private String parentOrganizationName;
|
private String parentOrganizationName;
|
||||||
@Schema(description = "推广员名称")
|
@Schema(description = "推广员名称")
|
||||||
|
|
|
@ -50,8 +50,7 @@ public class MemberController {
|
||||||
@RequestMapping(value = "/memberOrderInfo", method = RequestMethod.GET)
|
@RequestMapping(value = "/memberOrderInfo", method = RequestMethod.GET)
|
||||||
@PreAuthenticated
|
@PreAuthenticated
|
||||||
public CommonResult<List<RechargeOrderRespVO>> memberOrderInfo() {
|
public CommonResult<List<RechargeOrderRespVO>> memberOrderInfo() {
|
||||||
List<RechargeOrderDO> orderDOS = rechargeOrderService.memberOrderInfo();
|
return CommonResult.success(rechargeOrderService.memberOrderInfo());
|
||||||
return CommonResult.success(RechargeOrderConvert.INSTANCE.convertList(orderDOS));
|
|
||||||
}
|
}
|
||||||
@Operation(summary = "会员头部信息")
|
@Operation(summary = "会员头部信息")
|
||||||
@RequestMapping(value = "/memberHeadInfo", method = RequestMethod.GET)
|
@RequestMapping(value = "/memberHeadInfo", method = RequestMethod.GET)
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class RechargeOrderDO extends BaseDO {
|
||||||
/**
|
/**
|
||||||
* 支付状态
|
* 支付状态
|
||||||
*/
|
*/
|
||||||
private Byte paid;
|
private Integer paid;
|
||||||
/**
|
/**
|
||||||
* 支付截止时间
|
* 支付截止时间
|
||||||
*/
|
*/
|
||||||
|
@ -91,7 +91,7 @@ public class RechargeOrderDO extends BaseDO {
|
||||||
/**
|
/**
|
||||||
* 0 未退款 1 申请中 2 已退款 3 退款中
|
* 0 未退款 1 申请中 2 已退款 3 退款中
|
||||||
*/
|
*/
|
||||||
private Byte refundStatus;
|
private Integer refundStatus;
|
||||||
/**
|
/**
|
||||||
* 退款图片
|
* 退款图片
|
||||||
*/
|
*/
|
||||||
|
@ -131,11 +131,11 @@ public class RechargeOrderDO extends BaseDO {
|
||||||
/**
|
/**
|
||||||
* 支付渠道(0微信公众号1微信小程序2余额)
|
* 支付渠道(0微信公众号1微信小程序2余额)
|
||||||
*/
|
*/
|
||||||
private Byte isChannel;
|
private Integer isChannel;
|
||||||
/**
|
/**
|
||||||
* 消息提醒
|
* 消息提醒
|
||||||
*/
|
*/
|
||||||
private Byte isRemind;
|
private Integer isRemind;
|
||||||
/**
|
/**
|
||||||
* 后台是否删除
|
* 后台是否删除
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.shop.response.member.ChangeOrderPayTypeResponse;
|
||||||
import cn.iocoder.yudao.module.shop.response.member.InitOrderResponse;
|
import cn.iocoder.yudao.module.shop.response.member.InitOrderResponse;
|
||||||
import cn.iocoder.yudao.module.shop.response.order.*;
|
import cn.iocoder.yudao.module.shop.response.order.*;
|
||||||
import cn.iocoder.yudao.module.shop.vo.order.LogisticsResultVo;
|
import cn.iocoder.yudao.module.shop.vo.order.LogisticsResultVo;
|
||||||
|
import com.alipay.api.AlipayApiException;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
|
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
|
||||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||||
|
@ -391,14 +392,13 @@ public interface StoreOrderService extends IService<StoreOrder> {
|
||||||
/**
|
/**
|
||||||
* 第三方回调
|
* 第三方回调
|
||||||
* @param request
|
* @param request
|
||||||
* @param params
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Object aliNotify(HttpServletRequest request, Map<String, String> params);
|
Object aliNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, AlipayApiException;
|
||||||
|
|
||||||
Object memberRefund(RefundRequest request, HttpServletRequest servletRequest);
|
Object memberRefund(RefundRequest request, HttpServletRequest servletRequest);
|
||||||
|
|
||||||
Object refundNotify(HttpServletRequest request, Map<String, String> params);
|
Object refundNotify(HttpServletRequest request, HttpServletResponse response);
|
||||||
|
|
||||||
Boolean wxPayNotify(WxPayOrderNotifyV3Result.DecryptNotifyResult result);
|
Boolean wxPayNotify(WxPayOrderNotifyV3Result.DecryptNotifyResult result);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package cn.iocoder.yudao.module.shop.service.order.impl;
|
package cn.iocoder.yudao.module.shop.service.order.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
@ -26,6 +27,7 @@ import cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderMapper;
|
||||||
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.PhoneRecordMapper;
|
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.PhoneRecordMapper;
|
||||||
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderInfoMapper;
|
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderInfoMapper;
|
||||||
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderMapper;
|
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderMapper;
|
||||||
|
import cn.iocoder.yudao.module.shop.request.member.AlipayNotifyParamRequest;
|
||||||
import cn.iocoder.yudao.module.shop.request.member.OrderContentRequest;
|
import cn.iocoder.yudao.module.shop.request.member.OrderContentRequest;
|
||||||
import cn.iocoder.yudao.module.shop.request.member.RefundRequest;
|
import cn.iocoder.yudao.module.shop.request.member.RefundRequest;
|
||||||
import cn.iocoder.yudao.module.shop.request.order.StoreOrderRefundRequest;
|
import cn.iocoder.yudao.module.shop.request.order.StoreOrderRefundRequest;
|
||||||
|
@ -41,9 +43,7 @@ import cn.iocoder.yudao.module.shop.service.order.StoreOrderService;
|
||||||
import cn.iocoder.yudao.module.shop.service.order.StoreOrderStatusService;
|
import cn.iocoder.yudao.module.shop.service.order.StoreOrderStatusService;
|
||||||
import cn.iocoder.yudao.module.shop.support.StrategySupport;
|
import cn.iocoder.yudao.module.shop.support.StrategySupport;
|
||||||
import cn.iocoder.yudao.module.shop.support.pay.IPayStrategy;
|
import cn.iocoder.yudao.module.shop.support.pay.IPayStrategy;
|
||||||
import cn.iocoder.yudao.module.shop.utils.CommonPage;
|
import cn.iocoder.yudao.module.shop.utils.*;
|
||||||
import cn.iocoder.yudao.module.shop.utils.OrderUtil;
|
|
||||||
import cn.iocoder.yudao.module.shop.utils.RedisUtil;
|
|
||||||
import cn.iocoder.yudao.module.shop.vo.order.LogisticsResultVo;
|
import cn.iocoder.yudao.module.shop.vo.order.LogisticsResultVo;
|
||||||
import cn.iocoder.yudao.module.shop.vo.order.StoreDateRangeSqlPram;
|
import cn.iocoder.yudao.module.shop.vo.order.StoreDateRangeSqlPram;
|
||||||
import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoOldVo;
|
import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoOldVo;
|
||||||
|
@ -74,6 +74,10 @@ import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -134,7 +138,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ExpressService expressService;
|
private ExpressService expressService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WxMpService wxMpService;
|
private WxMpService wxMpService;
|
||||||
|
|
||||||
|
@ -1163,36 +1167,40 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object aliNotify(HttpServletRequest request, Map<String, String> params) {
|
public Object aliNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, AlipayApiException {
|
||||||
boolean verifyResult = false;
|
Map<String, String> params = new HashMap<String, String>();
|
||||||
try {
|
Map requestParams = request.getParameterMap();
|
||||||
Map<String, String[]> map = request.getParameterMap();
|
for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) {
|
||||||
verifyResult = AlipaySignature.rsaCheckV1(params, aliPayProperties.getAlipayPublicKey(), "UTF-8", "RSA2");
|
String name = (String) iter.next();
|
||||||
log.debug("支付宝验证签名结果:{}", verifyResult);
|
String[] values = (String[]) requestParams.get(name);
|
||||||
} catch (AlipayApiException e) {
|
String valueStr = "";
|
||||||
e.printStackTrace();
|
for (int i = 0; i < values.length; i++) {
|
||||||
|
valueStr = (i == values.length - 1) ? valueStr + values[i]
|
||||||
|
: valueStr + values[i] + ",";
|
||||||
|
}
|
||||||
|
/** 乱码解决,这段代码在出现乱码时使用 **/
|
||||||
|
//valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
|
||||||
|
params.put(name, valueStr);
|
||||||
}
|
}
|
||||||
if (verifyResult) {
|
boolean flag = AlipaySignature.rsaCheckV1(params, aliPayProperties.getAlipayPublicKey(), "UTF-8", "RSA2");
|
||||||
|
log.debug("支付宝验证签名结果:{}", flag);
|
||||||
|
if (flag) {
|
||||||
log.info("ALIPAY====MAP===>{}", params);
|
log.info("ALIPAY====MAP===>{}", params);
|
||||||
String orderId = params.get("out_trade_no");
|
String orderId = params.get("out_trade_no");
|
||||||
String amount = params.get("refund_amount");
|
|
||||||
String total_amount = params.get("total_amount");
|
|
||||||
log.info("orderId:{}", orderId);
|
|
||||||
log.info("amount:{}", amount);
|
|
||||||
log.info("amount:{}", total_amount);
|
|
||||||
// 处理相关逻辑
|
|
||||||
RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getOrderId, orderId));
|
RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getOrderId, orderId));
|
||||||
if (Objects.isNull(orderDO)) {
|
if (Objects.isNull(orderDO)) {
|
||||||
log.error("订单号错误,未查询到相关信息!入参订单号:{}", orderId);
|
log.error("订单号错误,未查询到相关信息!入参订单号:{}", orderId);
|
||||||
return "failure";
|
return "failure";
|
||||||
}
|
}
|
||||||
// 验证相关参数-金额
|
// 验证相关参数-金额
|
||||||
|
String amount = params.get("receipt_amount");
|
||||||
if (new BigDecimal(amount).compareTo(orderDO.getPayPrice()) != 0) {
|
if (new BigDecimal(amount).compareTo(orderDO.getPayPrice()) != 0) {
|
||||||
log.error("支付金额不匹配,订单实际支付金额:{},支付宝入参验证金额:{}", orderDO.getPayPrice(), amount);
|
log.error("支付金额不匹配,订单实际支付金额:{},支付宝入参验证金额:{}", orderDO.getPayPrice(), amount);
|
||||||
return "failure";
|
return "failure";
|
||||||
}
|
}
|
||||||
// 修改订单状态
|
// 修改订单状态
|
||||||
orderDO.setPaid((byte) 1);
|
orderDO.setPaid(1);
|
||||||
|
orderDO.setPaySerialNumber(params.get("trade_no"));
|
||||||
rechargeOrderMapper.updateById(orderDO);
|
rechargeOrderMapper.updateById(orderDO);
|
||||||
// 写入 充值档位记录表
|
// 写入 充值档位记录表
|
||||||
addPhoneRecord(orderDO, orderId);
|
addPhoneRecord(orderDO, orderId);
|
||||||
|
@ -1244,28 +1252,32 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object refundNotify(HttpServletRequest request, Map<String, String> params) {
|
public Object refundNotify(HttpServletRequest request, HttpServletResponse response) {
|
||||||
String tradeNo = params.get("trade_no"); // 支付宝交易号
|
Map<String, String> params = new HashMap<String, String>();
|
||||||
String outTradeNo = params.get("out_trade_no"); // 商户订单号
|
Map requestParams = request.getParameterMap();
|
||||||
String refundAmount = params.get("refund_amount"); // 退款金额
|
for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) {
|
||||||
String tradeStatus = params.get("trade_status");
|
String name = (String) iter.next();
|
||||||
log.info("tradeStatus:{}", tradeStatus);
|
String[] values = (String[]) requestParams.get(name);
|
||||||
log.info("tradeNo:{}", tradeNo);
|
String valueStr = "";
|
||||||
log.info("outTradeNo:{}", outTradeNo);
|
for (int i = 0; i < values.length; i++) {
|
||||||
log.info("refundAmount:{}", refundAmount);
|
valueStr = (i == values.length - 1) ? valueStr + values[i]
|
||||||
// 2. 验证回调签名
|
: valueStr + values[i] + ",";
|
||||||
Map<String, String> paramMap = new HashMap<>(params);
|
}
|
||||||
paramMap.remove("sign_type"); // 移除sign_type参数
|
/** 乱码解决,这段代码在出现乱码时使用 **/
|
||||||
|
//valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
|
||||||
|
params.put(name, valueStr);
|
||||||
|
}
|
||||||
|
params.remove("sign_type"); // 移除sign_type参数
|
||||||
// 验证签名
|
// 验证签名
|
||||||
boolean isSignatureValid = false;
|
boolean isSignatureValid = false;
|
||||||
try {
|
try {
|
||||||
isSignatureValid = AlipaySignature.rsaCheckV1(paramMap, aliPayProperties.getAlipayPublicKey(), "UTF-8", "RSA2");
|
isSignatureValid = AlipaySignature.rsaCheckV1(params, aliPayProperties.getAlipayPublicKey(), "UTF-8", "RSA2");
|
||||||
} catch (AlipayApiException e) {
|
} catch (AlipayApiException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
log.info("支付宝退款回调验证结果{}", isSignatureValid);
|
log.info("支付宝退款回调验证结果{}", isSignatureValid);
|
||||||
if (isSignatureValid) {
|
if (isSignatureValid) {
|
||||||
if ("TRADE_SUCCESS".equals(tradeStatus)) {
|
if ("TRADE_SUCCESS".equals("")) {
|
||||||
// 处理相关逻辑
|
// 处理相关逻辑
|
||||||
// 验证相关参数-金额
|
// 验证相关参数-金额
|
||||||
// 修改订单状态
|
// 修改订单状态
|
||||||
|
@ -1288,7 +1300,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
// 验证相关参数-金额
|
// 验证相关参数-金额
|
||||||
String outTradeNo = result.getOutTradeNo();
|
String outTradeNo = result.getOutTradeNo();
|
||||||
// 用户支付金额
|
// 用户支付金额
|
||||||
BigDecimal payerTotal = NumberUtil.div(result.getAmount().getPayerTotal()+"","100",2);
|
BigDecimal payerTotal = NumberUtil.div(result.getAmount().getPayerTotal() + "", "100", 2);
|
||||||
// 处理相关逻辑
|
// 处理相关逻辑
|
||||||
RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getOrderId, outTradeNo));
|
RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getOrderId, outTradeNo));
|
||||||
if (payerTotal.compareTo(orderDO.getPayPrice()) != 0) {
|
if (payerTotal.compareTo(orderDO.getPayPrice()) != 0) {
|
||||||
|
@ -1296,7 +1308,8 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
// 修改订单状态
|
// 修改订单状态
|
||||||
orderDO.setPaid((byte) 1);
|
orderDO.setPaid(1);
|
||||||
|
orderDO.setPaySerialNumber(result.getTransactionId());
|
||||||
rechargeOrderMapper.updateById(orderDO);
|
rechargeOrderMapper.updateById(orderDO);
|
||||||
// 写入 充值档位记录表
|
// 写入 充值档位记录表
|
||||||
addPhoneRecord(orderDO, outTradeNo);
|
addPhoneRecord(orderDO, outTradeNo);
|
||||||
|
@ -1308,7 +1321,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
@Override
|
@Override
|
||||||
public Boolean memberApplyRefund(RefundRequest request) {
|
public Boolean memberApplyRefund(RefundRequest request) {
|
||||||
RechargeOrderDO orderDO = rechargeOrderMapper.selectById(request.getOrderId());
|
RechargeOrderDO orderDO = rechargeOrderMapper.selectById(request.getOrderId());
|
||||||
orderDO.setRefundStatus((byte) 1);
|
orderDO.setRefundStatus(1);
|
||||||
return rechargeOrderMapper.updateById(orderDO) > 0;
|
return rechargeOrderMapper.updateById(orderDO) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1566,6 +1579,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
// MyRecord myRecord = onePassService.expressDump(record);
|
// MyRecord myRecord = onePassService.expressDump(record);
|
||||||
// storeOrder.setDeliveryId(myRecord.getStr("kuaidinum"));
|
// storeOrder.setDeliveryId(myRecord.getStr("kuaidinum"));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验快递发货参数
|
* 校验快递发货参数
|
||||||
*/
|
*/
|
||||||
|
@ -1576,7 +1590,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
}
|
}
|
||||||
if (StrUtil.isBlank(request.getExpressCode())) throw new ServiceException("请选择快递公司");
|
if (StrUtil.isBlank(request.getExpressCode())) throw new ServiceException("请选择快递公司");
|
||||||
if (StrUtil.isBlank(request.getExpressRecordType())) throw new ServiceException("请选择发货记录类型");
|
if (StrUtil.isBlank(request.getExpressRecordType())) throw new ServiceException("请选择发货记录类型");
|
||||||
// if (StrUtil.isBlank(request.getExpressTempId())) throw new ServiceException("请选择电子面单");
|
// if (StrUtil.isBlank(request.getExpressTempId())) throw new ServiceException("请选择电子面单");
|
||||||
if (StrUtil.isBlank(request.getToName())) throw new ServiceException("请填写寄件人姓名");
|
if (StrUtil.isBlank(request.getToName())) throw new ServiceException("请填写寄件人姓名");
|
||||||
if (StrUtil.isBlank(request.getToTel())) throw new ServiceException("请填写寄件人电话");
|
if (StrUtil.isBlank(request.getToTel())) throw new ServiceException("请填写寄件人电话");
|
||||||
if (StrUtil.isBlank(request.getToAddr())) throw new ServiceException("请填写寄件人地址");
|
if (StrUtil.isBlank(request.getToAddr())) throw new ServiceException("请填写寄件人地址");
|
||||||
|
|
|
@ -68,7 +68,7 @@ public interface RechargeOrderService {
|
||||||
*/
|
*/
|
||||||
List<RechargeOrderDO> getRechargeOrderList(RechargeOrderExportReqVO exportReqVO);
|
List<RechargeOrderDO> getRechargeOrderList(RechargeOrderExportReqVO exportReqVO);
|
||||||
|
|
||||||
List<RechargeOrderDO> memberOrderInfo();
|
List<RechargeOrderRespVO> memberOrderInfo();
|
||||||
|
|
||||||
MemberHeadResponse memberHeadInfo();
|
MemberHeadResponse memberHeadInfo();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.shop.service.recharge;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
|
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO;
|
||||||
|
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderInfoMapper;
|
||||||
import cn.iocoder.yudao.module.shop.response.member.MemberHeadResponse;
|
import cn.iocoder.yudao.module.shop.response.member.MemberHeadResponse;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
@ -14,7 +16,9 @@ import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
|
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
|
||||||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
|
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
|
||||||
|
@ -37,6 +41,8 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RechargeOrderMapper rechargeOrderMapper;
|
private RechargeOrderMapper rechargeOrderMapper;
|
||||||
|
@Resource
|
||||||
|
private RechargeOrderInfoMapper infoMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer createRechargeOrder(RechargeOrderCreateReqVO createReqVO) {
|
public Integer createRechargeOrder(RechargeOrderCreateReqVO createReqVO) {
|
||||||
|
@ -93,10 +99,36 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RechargeOrderDO> memberOrderInfo() {
|
public List<RechargeOrderRespVO> memberOrderInfo() {
|
||||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
Assert.notNull(loginUser, "登录失效,请重新登录!");
|
Assert.notNull(loginUser, "登录失效,请重新登录!");
|
||||||
return rechargeOrderMapper.selectList(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getUid, loginUser.getId()));
|
List<RechargeOrderDO> orderDOS = rechargeOrderMapper.selectList(Wrappers.<RechargeOrderDO>lambdaQuery()
|
||||||
|
.eq(RechargeOrderDO::getUid, loginUser.getId()).eq(RechargeOrderDO::getPaid, 1));
|
||||||
|
if (!CollectionUtils.isEmpty(orderDOS)) {
|
||||||
|
List<RechargeOrderRespVO> rechargeOrderRespVOS = RechargeOrderConvert.INSTANCE.convertList(orderDOS);
|
||||||
|
List<String> collect1 = rechargeOrderRespVOS.stream().map(RechargeOrderBaseVO::getOrderId).collect(Collectors.toList());
|
||||||
|
List<RechargeOrderInfoDO> infoDOS = infoMapper.selectList(Wrappers.<RechargeOrderInfoDO>lambdaQuery().in(RechargeOrderInfoDO::getOrderNo, collect1));
|
||||||
|
Map<String, List<RechargeOrderInfoDO>> collect = infoDOS.stream().collect(Collectors.groupingBy(RechargeOrderInfoDO::getOrderNo));
|
||||||
|
for (RechargeOrderRespVO orderDO : rechargeOrderRespVOS) {
|
||||||
|
StringBuilder grade = new StringBuilder();
|
||||||
|
List<RechargeOrderInfoDO> infoDOS1 = collect.get(orderDO.getOrderId());
|
||||||
|
for (RechargeOrderInfoDO infoDO : infoDOS1) {
|
||||||
|
if (infoDO.getPrice().compareTo(new BigDecimal("240")) == 0) {
|
||||||
|
grade.append("套餐1,");
|
||||||
|
} else if (infoDO.getPrice().compareTo(new BigDecimal("400")) == 0) {
|
||||||
|
grade.append("套餐2,");
|
||||||
|
} else if (infoDO.getPrice().compareTo(new BigDecimal("640")) == 0) {
|
||||||
|
grade.append("套餐3");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
orderDO.setGrade(grade.toString());
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
orderDO.setStringCreateTime(orderDO.getCreateTime().format(formatter));
|
||||||
|
}
|
||||||
|
|
||||||
|
return rechargeOrderRespVOS;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -200,16 +200,17 @@ wx:
|
||||||
key-path: classpath:/2/apiclient_cert.p12
|
key-path: classpath:/2/apiclient_cert.p12
|
||||||
cert-serial-no: 47F04D51F958FFEF56A6DFC25BDE83CF89353E19
|
cert-serial-no: 47F04D51F958FFEF56A6DFC25BDE83CF89353E19
|
||||||
notify-url: http://yuxy.perrymake.com/app-api/pay/wxpay/pay_notify
|
notify-url: http://yuxy.perrymake.com/app-api/pay/wxpay/pay_notify
|
||||||
refund-notify-url: http://yuxy.perrymake.com/app-api/pay/wxpay/refund_notify
|
refund-notify-url: http://yuxy.perrymake.com/admin-api/pay/wxpay/refund_notify
|
||||||
--- #################### 芋道相关配置 ####################
|
--- #################### 芋道相关配置 ####################
|
||||||
ali:
|
ali:
|
||||||
pay:
|
pay:
|
||||||
one:
|
one:
|
||||||
appId: 2021003196623046
|
appId: 2021003196623046
|
||||||
merchantPrivateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCAhydIKD244uxHaCAE8N4KA0kfK2UkhXayUwarvc09s/JHC7WkrtwgmeHx+JyFA/QQA1WHQREJ8jyS9HrgasmmA+BaE0vGwbu/c0R4Cde5dLeITZb4w4X1RlH+xjtF34pKLH3oVi29q9jUTRii41eCBeztL/XcbJDsxAnCNnuxcak0gk4cl8j9aoMBP/opIc5sTDSqYFSSTDSMPGh90M6KowFtCHyVZxEszcIRX9cRIuf9KtfGvBzljJMjNGshIMuaHVCFpy72E0s50HmMxC4Kodhp6HEdLV1GUBZy87PYiKTqp9WVn0CndzcfmmdUUXVUvqWPKzRN3YSxExJ0Z5KFAgMBAAECggEABovbulciXaphMnnhN581D/l+3fGN40BQ/WAxNMokDAKAUpIMHGkzmQ19bp+lCTlcUvx4fL0ZqxIFd86v+4I05xnHcY8OCv+PGn86e4q0zCNfvbeF+wGqbwW342whVLvABWsitpS9G64HCzkqChHeQScgHCyXLzTwZL7PaG7x+eWnQ3WyA5KlCpUQWOz6OBPD7flkaflVRbDDZqmhcpEwwSXC9vSQb5+E0BZ118+5nJA65Wi/EPtqCzWX4k6ioiQcN5OeJrScZ4fnQm4h4j+TRLeKqkAKCZFpAZcB7RERxA/4Mzz9mEzHOBzSbrUU+miJ3oSkd4S4ldrOZU4EVkI1AQKBgQDe5t+Qij0hOPQaMpiM2hiQnMAI3TzHRbrYf6JUlMqdzad9oasY2ap+iit60TD9OLwjRGzjy7S9WL2bUgmmU4/sOjR0NMl8z3iUTYun6EubNoMUiu9UhQXBThxBCZv/H2agJ4Uswq2lBjUuGyp383lj9qSkSc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st1tCj6EkjBAwhAoGAShd1PY/QOEJ6Cj9IDXvD25DAh0dKs54PRxENetbIxPgYpH7db6n/smmbwM69U4TXZyFfqme1Bc0JwM2J7D6gs4OV88AhXJvfj091eJQhYC5e80Eo8dySserwLp8/ka6FV/EFUplg/DD4JR/jbVzO2fbOPCLm6I+sZqG3K7mg6IM=
|
||||||
alipayPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgIcnSCg9uOLsR2ggBPDeCgNJHytlJIV2slMGq73NPbPyRwu1pK7cIJnh8fichQP0EANVh0ERCfI8kvR64GrJpgPgWhNLxsG7v3NEeAnXuXS3iE2W+MOF9UZR/sY7Rd+KSix96FYtvavY1E0YouNXggXs7S/13GyQ7MQJwjZ7sXGpNIJOHJfI/WqDAT/6KSHObEw0qmBUkkw0jDxofdDOiqMBbQh8lWcRLM3CEV/XESLn/SrXxrwc5YyTIzRrISDLmh1Qhacu9hNLOdB5jMQuCqHYaehxHS1dRlAWcvOz2Iik6qfVlZ9Ap3c3H5pnVFF1VL6ljys0Td2EsRMSdGeShQIDAQAB
|
alipayPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4AmKmcg8NImIDHlY1dz/DgBlIB1EVXv5gI2S17/Ddt7kDEdY2Uq0TV5NmVxf1RQ6EXQCDpBm83IOkduMeGsnD3zad6Vpit6hdjfvMJ4au9pAaoe4nYAy0CoMVTKDIR7XunSJZqfOZTihLXD8GbqMFTMPRyuh/JNCHoeDfDhca2nD6hyVOLE7XqZK8gVq9WgUM8uVkXDHJJfPHFmQaU8jJt3pyuItsVi1id8vJvHdng/rFy0USPwSq9kVv9DaIxI2197UBvjtyt4iTTYE5esOiJeulUggwmpWoss7Cx2fbN0pLVors+DybJGZjEW3GdwL+R6FStvQNAVcIf2Ty/NgKwIDAQAB
|
||||||
gatewayUrl: https://openapi.alipay.com/gateway.do
|
gatewayUrl: https://openapi.alipay.com/gateway.do
|
||||||
notify-url: http://yuxy.perrymake.com/admin-api/notify/ali/pay_notify
|
notify-url: http://yuxy.perrymake.com/admin-api/notify/ali/pay_notify
|
||||||
|
refund-notify: http://yuxy.perrymake.com/admin-api/notify/ali/refund_notify
|
||||||
# 芋道配置项,设置当前项目所有自定义的配置
|
# 芋道配置项,设置当前项目所有自定义的配置
|
||||||
yudao:
|
yudao:
|
||||||
captcha:
|
captcha:
|
||||||
|
|
Loading…
Reference in New Issue