Compare commits
3 Commits
40398dab27
...
12228e7d09
Author | SHA1 | Date |
---|---|---|
perry | 12228e7d09 | |
perry | 46563efd16 | |
perry | 18909d4c2c |
|
@ -30,4 +30,22 @@ public class InitOrderResponse implements Serializable {
|
||||||
|
|
||||||
@Schema(description ="支付宝返回参数")
|
@Schema(description ="支付宝返回参数")
|
||||||
private String body;
|
private String body;
|
||||||
|
@Schema(description ="jsapi返回参数")
|
||||||
|
private JsapiResult jsapiResult;
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class JsapiResult implements Serializable {
|
||||||
|
private static final long serialVersionUID = 4465376277943307271L;
|
||||||
|
|
||||||
|
private String appId;
|
||||||
|
private String timeStamp;
|
||||||
|
private String nonceStr;
|
||||||
|
private String packageValue;
|
||||||
|
private String signType;
|
||||||
|
private String paySign;
|
||||||
|
|
||||||
|
private String getSignStr() {
|
||||||
|
return String.format("%s\n%s\n%s\n%s\n", appId, timeStamp, nonceStr, packageValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class PhoneRecordDO extends BaseDO {
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
@TableId
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package cn.iocoder.yudao.module.shop.service.order.impl;
|
package cn.iocoder.yudao.module.shop.service.order.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.PhoneUtil;
|
import cn.hutool.core.util.PhoneUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
@ -1281,15 +1282,15 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
@Override
|
@Override
|
||||||
public Boolean wxPayNotify(WxPayOrderNotifyV3Result.DecryptNotifyResult result) {
|
public Boolean wxPayNotify(WxPayOrderNotifyV3Result.DecryptNotifyResult result) {
|
||||||
log.info("支付通知=" + JSONUtil.toJsonPrettyStr(result));
|
log.info("支付通知=" + JSONUtil.toJsonPrettyStr(result));
|
||||||
if (StringUtils.equals("SUCCESS", result.getTradeType())) {
|
if (StringUtils.equals("SUCCESS", result.getTradeState())) {
|
||||||
log.info("WXPAY====result===>");
|
log.info("WXPAY====result===>");
|
||||||
// 验证相关参数-金额
|
// 验证相关参数-金额
|
||||||
String outTradeNo = result.getOutTradeNo();
|
String outTradeNo = result.getOutTradeNo();
|
||||||
// 用户支付金额
|
// 用户支付金额
|
||||||
Integer payerTotal = result.getAmount().getPayerTotal() / 100;
|
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 (new BigDecimal(payerTotal).compareTo(orderDO.getPayPrice()) != 0) {
|
if (payerTotal.compareTo(orderDO.getPayPrice()) != 0) {
|
||||||
log.error("支付金额不匹配,订单实际支付金额:{},微信入参验证金额:{}", orderDO.getPayPrice(), payerTotal);
|
log.error("支付金额不匹配,订单实际支付金额:{},微信入参验证金额:{}", orderDO.getPayPrice(), payerTotal);
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1332,7 +1333,8 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
||||||
orderDO.setUserPhone(StringUtils.isEmpty(request.getUserPhone()) ? user.getMobile() : request.getUserPhone());
|
orderDO.setUserPhone(StringUtils.isEmpty(request.getUserPhone()) ? user.getMobile() : request.getUserPhone());
|
||||||
orderDO.setConfirmPhone(StringUtils.isEmpty(request.getConfirmPhone()) ? user.getMobile() : request.getConfirmPhone());
|
orderDO.setConfirmPhone(StringUtils.isEmpty(request.getConfirmPhone()) ? user.getMobile() : request.getConfirmPhone());
|
||||||
orderDO.setTotalNum(orderInfos.size());
|
orderDO.setTotalNum(orderInfos.size());
|
||||||
BigDecimal sum = new BigDecimal(orderInfos.stream().mapToDouble(OrderContentRequest.OrderInfo::getGearAmount).sum());
|
// BigDecimal sum = new BigDecimal(orderInfos.stream().mapToDouble(OrderContentRequest.OrderInfo::getGearAmount).sum());
|
||||||
|
BigDecimal sum = new BigDecimal("0.01");
|
||||||
orderDO.setTotalPrice(sum);
|
orderDO.setTotalPrice(sum);
|
||||||
orderDO.setPayPrice(sum);
|
orderDO.setPayPrice(sum);
|
||||||
orderDO.setPayTime(LocalDateTime.now());
|
orderDO.setPayTime(LocalDateTime.now());
|
||||||
|
|
|
@ -43,7 +43,8 @@ public class WxPayStrategy implements IPayStrategy{
|
||||||
WxPayService wxPayService = wxPayOneAutoConfiguration.wxPayOneService();
|
WxPayService wxPayService = wxPayOneAutoConfiguration.wxPayOneService();
|
||||||
Assert.notNull(wxPayService, "获取微信支付配置失败!");
|
Assert.notNull(wxPayService, "获取微信支付配置失败!");
|
||||||
WxPayUnifiedOrderV3Request wxPayRequest = new WxPayUnifiedOrderV3Request();
|
WxPayUnifiedOrderV3Request wxPayRequest = new WxPayUnifiedOrderV3Request();
|
||||||
int sum = orderDO.getPayPrice().multiply(new BigDecimal("100")).intValue();
|
// int sum = orderDO.getPayPrice().multiply(new BigDecimal("100")).intValue();
|
||||||
|
int sum = 1;
|
||||||
wxPayRequest.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(sum));
|
wxPayRequest.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(sum));
|
||||||
wxPayRequest.setDescription("会员充值");
|
wxPayRequest.setDescription("会员充值");
|
||||||
wxPayRequest.setOutTradeNo(orderDO.getOrderId());
|
wxPayRequest.setOutTradeNo(orderDO.getOrderId());
|
||||||
|
@ -54,6 +55,10 @@ public class WxPayStrategy implements IPayStrategy{
|
||||||
wxPayRequest.setMchid(payProperties.getMchId());
|
wxPayRequest.setMchid(payProperties.getMchId());
|
||||||
try {
|
try {
|
||||||
WxPayUnifiedOrderV3Result wxPayUnifiedOrderV3Result = wxPayService.unifiedOrderV3(TradeTypeEnum.JSAPI, wxPayRequest);
|
WxPayUnifiedOrderV3Result wxPayUnifiedOrderV3Result = wxPayService.unifiedOrderV3(TradeTypeEnum.JSAPI, wxPayRequest);
|
||||||
|
WxPayUnifiedOrderV3Result.JsapiResult jsapiResult = wxPayUnifiedOrderV3Result.getPayInfo(TradeTypeEnum.JSAPI, payProperties.getAppId(), payProperties.getMchId(), wxPayService.getConfig().getPrivateKey());
|
||||||
|
InitOrderResponse.JsapiResult jsapiResultNew = new InitOrderResponse.JsapiResult();
|
||||||
|
BeanUtils.copyProperties(jsapiResult, jsapiResultNew);
|
||||||
|
response.setJsapiResult(jsapiResultNew);
|
||||||
BeanUtils.copyProperties(wxPayUnifiedOrderV3Result, response);
|
BeanUtils.copyProperties(wxPayUnifiedOrderV3Result, response);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
|
|
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.member.api.user;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
|
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.member.convert.user.UserConvert;
|
import cn.iocoder.yudao.module.member.convert.user.UserConvert;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||||
|
@ -27,22 +28,26 @@ public class MemberUserApiImpl implements MemberUserApi {
|
||||||
private MemberUserService userService;
|
private MemberUserService userService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@TenantIgnore
|
||||||
public MemberUserRespDTO getUser(Long id) {
|
public MemberUserRespDTO getUser(Long id) {
|
||||||
MemberUserDO user = userService.getUser(id);
|
MemberUserDO user = userService.getUser(id);
|
||||||
return UserConvert.INSTANCE.convert2(user);
|
return UserConvert.INSTANCE.convert2(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@TenantIgnore
|
||||||
public List<MemberUserRespDTO> getUsers(Collection<Long> ids) {
|
public List<MemberUserRespDTO> getUsers(Collection<Long> ids) {
|
||||||
return UserConvert.INSTANCE.convertList2(userService.getUserList(ids));
|
return UserConvert.INSTANCE.convertList2(userService.getUserList(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@TenantIgnore
|
||||||
public List<MemberUserRespDTO> getUserListByNickname(String nickname) {
|
public List<MemberUserRespDTO> getUserListByNickname(String nickname) {
|
||||||
return UserConvert.INSTANCE.convertList2(userService.getUserListByNickname(nickname));
|
return UserConvert.INSTANCE.convertList2(userService.getUserListByNickname(nickname));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@TenantIgnore
|
||||||
public MemberUserRespDTO getUserByMobile(String mobile) {
|
public MemberUserRespDTO getUserByMobile(String mobile) {
|
||||||
return UserConvert.INSTANCE.convert2(userService.getUserByMobile(mobile));
|
return UserConvert.INSTANCE.convert2(userService.getUserByMobile(mobile));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.user.dto.AdminUserQueryDTO;
|
import cn.iocoder.yudao.module.member.controller.admin.user.dto.AdminUserQueryDTO;
|
||||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO;
|
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO;
|
||||||
|
@ -114,6 +115,7 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@TenantIgnore
|
||||||
public MemberUserDO getUser(Long id) {
|
public MemberUserDO getUser(Long id) {
|
||||||
return memberUserMapper.selectById(id);
|
return memberUserMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ wx:
|
||||||
private-cert-path: classpath:/1/apiclient_cert.pem
|
private-cert-path: classpath:/1/apiclient_cert.pem
|
||||||
private-key-path: classpath:/1/apiclient_key.pem
|
private-key-path: classpath:/1/apiclient_key.pem
|
||||||
key-path: classpath:/1/apiclient_cert.p12
|
key-path: classpath:/1/apiclient_cert.p12
|
||||||
cert-serial-no: 58FDB503F92B6C0E258C9940BB726C2BF6022E56
|
cert-serial-no: 7F76A4ADC52CA0B440C4E5698F8A5CD1633A0FCD
|
||||||
notify-url: http://yuxy.perrymake.com/admin-api/notify/wxpay/pay_notify
|
notify-url: http://yuxy.perrymake.com/admin-api/notify/wxpay/pay_notify
|
||||||
refund-notify-url: http://yuxy.perrymake.com/admin-api/notify/wxpay/refund_notify
|
refund-notify-url: http://yuxy.perrymake.com/admin-api/notify/wxpay/refund_notify
|
||||||
two:
|
two:
|
||||||
|
|
|
@ -107,7 +107,7 @@ yudao:
|
||||||
security:
|
security:
|
||||||
permit-all_urls:
|
permit-all_urls:
|
||||||
- /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,不需要登录
|
- /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,不需要登录
|
||||||
- /admin-api/notice/wxpay/**
|
- /admin-api/notify/wxpay/**
|
||||||
websocket:
|
websocket:
|
||||||
enable: true # websocket的开关
|
enable: true # websocket的开关
|
||||||
path: /websocket/message # 路径
|
path: /websocket/message # 路径
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue