Merge branch 'master' of http://192.168.1.26:3000/dianliang/dl_admin
This commit is contained in:
commit
fcefa000bf
@ -116,43 +116,51 @@ public class PayApi {
|
|||||||
@RequestMapping("/entPay")
|
@RequestMapping("/entPay")
|
||||||
@ApiOperation(value = "商家转账给用户")
|
@ApiOperation(value = "商家转账给用户")
|
||||||
public JSONObject entPay(String orderNo){
|
public JSONObject entPay(String orderNo){
|
||||||
LambdaQueryWrapper<MemberPoints> queryWrapper =new LambdaQueryWrapper<>();
|
try{
|
||||||
queryWrapper.eq(MemberPoints::getOrderNo,orderNo).last("limit 1");
|
LambdaQueryWrapper<MemberPoints> queryWrapper =new LambdaQueryWrapper<>();
|
||||||
MemberPoints memberPoints = pointsService.getOne(queryWrapper);
|
queryWrapper.eq(MemberPoints::getOrderNo,orderNo).last("limit 1");
|
||||||
if (!memberPoints.getUserId().equals(SecurityUtils.getUserId())){
|
MemberPoints memberPoints = pointsService.getOne(queryWrapper);
|
||||||
throw new RuntimeException("非本人账户");
|
if (!memberPoints.getUserId().equals(SecurityUtils.getUserId())){
|
||||||
}
|
throw new RuntimeException("非本人账户");
|
||||||
SysUser sysUser = sysUserService.selectUserById(memberPoints.getUserId());
|
}
|
||||||
// 初始化商户配置
|
SysUser sysUser = sysUserService.selectUserById(memberPoints.getUserId());
|
||||||
TransferToUser.TransferToUserRequest userRequest = new TransferToUser.TransferToUserRequest();
|
// 初始化商户配置
|
||||||
userRequest.appid = appConfig.getAppId();
|
TransferToUser.TransferToUserRequest userRequest = new TransferToUser.TransferToUserRequest();
|
||||||
userRequest.openid=sysUser.getOpenId();
|
userRequest.appid = appConfig.getAppId();
|
||||||
// 将元转换为分
|
userRequest.openid=sysUser.getOpenId();
|
||||||
double pointsInYuan = memberPoints.getPoints();
|
// 将元转换为分
|
||||||
userRequest.transferAmount = BigDecimal.valueOf(pointsInYuan).multiply(BigDecimal.valueOf(100)).setScale(0, RoundingMode.HALF_UP).longValue();
|
double pointsInYuan = memberPoints.getPoints();
|
||||||
|
userRequest.transferAmount = BigDecimal.valueOf(pointsInYuan).multiply(BigDecimal.valueOf(10)).setScale(0, RoundingMode.HALF_UP).longValue();
|
||||||
|
|
||||||
|
userRequest.notifyUrl = wechatPayConfig.getZhuanNotifyUrl();
|
||||||
|
userRequest.outBillNo = orderNo;
|
||||||
|
userRequest.transferSceneId = "1000";
|
||||||
|
userRequest.transferRemark = "通告快接积分提现";
|
||||||
|
List<TransferToUser.TransferSceneReportInfo> transferSceneReportInfos = new ArrayList<>();
|
||||||
|
TransferToUser.TransferSceneReportInfo transferSceneReportInfo = new TransferToUser.TransferSceneReportInfo();
|
||||||
|
transferSceneReportInfo.infoContent = "发布通告得积分";
|
||||||
|
transferSceneReportInfo.infoType = "活动名称";
|
||||||
|
TransferToUser.TransferSceneReportInfo transferSceneReportInfo2 = new TransferToUser.TransferSceneReportInfo();
|
||||||
|
transferSceneReportInfo2.infoContent = "发布通告得积分";
|
||||||
|
transferSceneReportInfo2.infoType = "奖励说明";
|
||||||
|
transferSceneReportInfos.add(transferSceneReportInfo);
|
||||||
|
transferSceneReportInfos.add(transferSceneReportInfo2);
|
||||||
|
userRequest.transferSceneReportInfos = transferSceneReportInfos;
|
||||||
|
TransferToUser.TransferToUserResponse run = transferToUser.run(userRequest);
|
||||||
|
JSONObject res = new JSONObject();
|
||||||
|
res.put("runData",run);
|
||||||
|
JSONObject config = new JSONObject();
|
||||||
|
config.put("appId",appConfig.getAppId());
|
||||||
|
config.put("mchId",wechatPayConfig.getMchId());
|
||||||
|
res.put("config",config);
|
||||||
|
return res;
|
||||||
|
}catch (Exception e){
|
||||||
|
LambdaQueryWrapper<MemberPoints> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(MemberPoints::getOrderNo,orderNo);
|
||||||
|
pointsService.remove(queryWrapper);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
userRequest.notifyUrl = wechatPayConfig.getZhuanNotifyUrl();
|
|
||||||
userRequest.outBillNo = orderNo;
|
|
||||||
userRequest.transferSceneId = "1000";
|
|
||||||
userRequest.transferRemark = "通告快接积分提现";
|
|
||||||
List<TransferToUser.TransferSceneReportInfo> transferSceneReportInfos = new ArrayList<>();
|
|
||||||
TransferToUser.TransferSceneReportInfo transferSceneReportInfo = new TransferToUser.TransferSceneReportInfo();
|
|
||||||
transferSceneReportInfo.infoContent = "发布通告得积分";
|
|
||||||
transferSceneReportInfo.infoType = "活动名称";
|
|
||||||
TransferToUser.TransferSceneReportInfo transferSceneReportInfo2 = new TransferToUser.TransferSceneReportInfo();
|
|
||||||
transferSceneReportInfo2.infoContent = "发布通告得积分";
|
|
||||||
transferSceneReportInfo2.infoType = "奖励说明";
|
|
||||||
transferSceneReportInfos.add(transferSceneReportInfo);
|
|
||||||
transferSceneReportInfos.add(transferSceneReportInfo2);
|
|
||||||
userRequest.transferSceneReportInfos = transferSceneReportInfos;
|
|
||||||
TransferToUser.TransferToUserResponse run = transferToUser.run(userRequest);
|
|
||||||
JSONObject res = new JSONObject();
|
|
||||||
res.put("runData",run);
|
|
||||||
JSONObject config = new JSONObject();
|
|
||||||
config.put("appId",appConfig.getAppId());
|
|
||||||
config.put("mchId",wechatPayConfig.getMchId());
|
|
||||||
res.put("config",config);
|
|
||||||
return res;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import com.ruoyi.common.annotation.Log;
|
|||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.member.domain.MemberPoints;
|
import com.ruoyi.member.domain.MemberPoints;
|
||||||
import com.ruoyi.member.service.IMemberPointsService;
|
import com.ruoyi.member.service.IMemberPointsService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -47,6 +48,19 @@ public class MemberPointsController extends BaseController {
|
|||||||
return success(list);
|
return success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询在途订单
|
||||||
|
* @author PQZ
|
||||||
|
* @date 14:36 2025/4/29
|
||||||
|
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||||
|
**/
|
||||||
|
@GetMapping("/getOnWayOrder")
|
||||||
|
public AjaxResult getOnWayOrder() {
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
List<MemberPoints> list = memberPointsService.getOnWayOrder(userId);
|
||||||
|
return success(list.isEmpty()?null:list.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增博主积分变动记录
|
* 新增博主积分变动记录
|
||||||
|
|||||||
@ -61,4 +61,13 @@ public interface IMemberPointsService extends IService<MemberPoints> {
|
|||||||
* @type type 回调状态(success:成功,其他为失败)
|
* @type type 回调状态(success:成功,其他为失败)
|
||||||
**/
|
**/
|
||||||
void payoutCallback(String orderNo,String type);
|
void payoutCallback(String orderNo,String type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当前登录用户在途订单
|
||||||
|
* @author PQZ
|
||||||
|
* @date 14:32 2025/4/29
|
||||||
|
* @param userId 用户id
|
||||||
|
* @return java.util.List<com.ruoyi.member.domain.MemberPoints>
|
||||||
|
**/
|
||||||
|
List<MemberPoints> getOnWayOrder(Long userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -153,9 +153,7 @@ public class MemberPointsServiceImpl extends ServiceImpl<MemberPointsMapper, Mem
|
|||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public void payoutCallback(String orderNo,String type) {
|
public void payoutCallback(String orderNo,String type) {
|
||||||
/*防重复处理*/
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
|
||||||
double nowBalance = getBloggerBalance(userId);
|
|
||||||
//通过订单编号查询积分记录
|
//通过订单编号查询积分记录
|
||||||
LambdaQueryWrapper<MemberPoints> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<MemberPoints> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper
|
lambdaQueryWrapper
|
||||||
@ -166,6 +164,8 @@ public class MemberPointsServiceImpl extends ServiceImpl<MemberPointsMapper, Mem
|
|||||||
/*区分微信调用成功和失败*/
|
/*区分微信调用成功和失败*/
|
||||||
if (!memberPoints.isEmpty()) {
|
if (!memberPoints.isEmpty()) {
|
||||||
MemberPoints points = memberPoints.get(0);
|
MemberPoints points = memberPoints.get(0);
|
||||||
|
/*防重复处理*/
|
||||||
|
double nowBalance = getBloggerBalance(points.getUserId());
|
||||||
if ("success".equals(type)) {
|
if ("success".equals(type)) {
|
||||||
points.setBalance(nowBalance - points.getPoints());
|
points.setBalance(nowBalance - points.getPoints());
|
||||||
points.setStatus("01");
|
points.setStatus("01");
|
||||||
@ -183,7 +183,8 @@ public class MemberPointsServiceImpl extends ServiceImpl<MemberPointsMapper, Mem
|
|||||||
* @param userId 用户id
|
* @param userId 用户id
|
||||||
* @return java.util.List<com.ruoyi.member.domain.MemberPoints>
|
* @return java.util.List<com.ruoyi.member.domain.MemberPoints>
|
||||||
**/
|
**/
|
||||||
private List<MemberPoints> getOnWayOrder(Long userId){
|
@Override
|
||||||
|
public List<MemberPoints> getOnWayOrder(Long userId){
|
||||||
LambdaQueryWrapper<MemberPoints> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<MemberPoints> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper
|
lambdaQueryWrapper
|
||||||
.eq(MemberPoints::getUserId,userId)
|
.eq(MemberPoints::getUserId,userId)
|
||||||
|
|||||||
@ -155,16 +155,23 @@ wxpay:
|
|||||||
appId: wx7d10b0fa4886a583
|
appId: wx7d10b0fa4886a583
|
||||||
#商户号
|
#商户号
|
||||||
mchId: 1712447936
|
mchId: 1712447936
|
||||||
|
#商户密匙v2
|
||||||
|
mchKey: ab94673dd0cca78abd0a453d0aac9f98
|
||||||
# APIv3密钥
|
# APIv3密钥
|
||||||
apiV3Key: ab94673dd0cca78abd0a453d0aac9f98
|
apiV3Key: ab94673dd0cca78abd0a453d0aac9f98
|
||||||
|
#微信支付p12证书
|
||||||
|
keyPath: D:/任务平台项目/dl_admin/ruoyi-admin/src/main/resources/apiclient_cert.p12
|
||||||
# 微信支付V3-url前缀
|
# 微信支付V3-url前缀
|
||||||
baseUrl: https://api.mch.weixin.qq.com/v3
|
baseUrl: https://api.mch.weixin.qq.com/v3
|
||||||
# 支付通知回调, pjm6m9.natappfree.cc 为内网穿透地址
|
# 支付通知回调, pjm6m9.natappfree.cc 为内网穿透地址
|
||||||
notifyUrl: https://3w823u8516.vicp.fun/noticeApi/payApi/payNotify
|
notifyUrl: https://3w823u8516.vicp.fun/noticeApi/payApi/payNotify
|
||||||
|
# 转账通知回调, pjm6m9.natappfree.cc 为内网穿透地址
|
||||||
|
zhuanNotifyUrl: https://3w823u8516.vicp.fun/noticeApi/payApi/zhuanNotify
|
||||||
# 退款通知回调, pjm6m9.natappfree.cc 为内网穿透地址
|
# 退款通知回调, pjm6m9.natappfree.cc 为内网穿透地址
|
||||||
refundNotifyUrl: https://www.ddtg.site/notice/notify/refundNotify
|
refundNotifyUrl: https://www.ddtg.site/notice/notify/refundNotify
|
||||||
# 密钥路径,resources根目录下
|
# 密钥路径,resources根目录下
|
||||||
privateKeyPath: D:/任务平台项目/dl_admin/ruoyi-admin/src/main/resources/apiclient_key.pem
|
privateKeyPath: D:/任务平台项目/dl_admin/ruoyi-admin/src/main/resources/apiclient_key.pem
|
||||||
|
privateCertPath: D:/任务平台项目/dl_admin/ruoyi-admin/src/main/resources/apiclient_cert.pem
|
||||||
publicKeyPath: D:/任务平台项目/dl_admin/ruoyi-admin/src/main/resources/pub_key.pem
|
publicKeyPath: D:/任务平台项目/dl_admin/ruoyi-admin/src/main/resources/pub_key.pem
|
||||||
#商户证书序列号
|
#商户证书序列号
|
||||||
serialNo: 7FCDB0E72D6A928013361ACB77FA3F0DCBD370E3
|
serialNo: 7FCDB0E72D6A928013361ACB77FA3F0DCBD370E3
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user