转账到零钱参数完善
This commit is contained in:
parent
0c3d5a0fcc
commit
e19457de26
|
|
@ -72,6 +72,23 @@ public class NotifyController {
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/native/wx/transfer")
|
||||
public String nativeTransferNotify(HttpServletRequest request) throws IOException {
|
||||
log.info("接收到微信转账回调");
|
||||
JSONObject jsonObject = wxService.verifySignature(request);
|
||||
log.info("参数信息: {}", jsonObject.toJSONString());
|
||||
String outBillNo = jsonObject.getString("out_bill_no");
|
||||
String state = jsonObject.getString("state");
|
||||
try {
|
||||
distributionUserService.withdrawNotify(outBillNo, state);
|
||||
}catch (Exception e) {
|
||||
log.warn("转账回调失败", e);
|
||||
}
|
||||
return "SUCCESS";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/native/wx/pay/distributionRecharge")
|
||||
public String nativeNotify(HttpServletRequest request) throws IOException {
|
||||
String timestamp = request.getHeader("Wechatpay-Timestamp");
|
||||
|
|
|
|||
|
|
@ -131,4 +131,18 @@ public interface MkDistributionUserService extends IService<MkDistributionUser>
|
|||
Boolean withdraw(long userId, MkDistributionWithdrawFlowDTO withdrawFlowDTO);
|
||||
|
||||
Map<String, Object> withdrawDetail(long userId, Long id);
|
||||
|
||||
/**
|
||||
* 微信转账回调
|
||||
* @param outBillNo 转账单号
|
||||
* @param state ACCEPTED:单据已受理
|
||||
* PROCESSING:单据处理中,转账结果尚未明确,如一直处于此状态,建议检查账户余额是否足够
|
||||
* WAIT_USER_CONFIRM:待收款用户确认,可拉起微信收款确认页面进行收款确认
|
||||
* TRANSFERING:转账中,转账结果尚未明确,可拉起微信收款确认页面再次重试确认收款
|
||||
* SUCCESS: 转账成功
|
||||
* FAIL: 转账失败
|
||||
* CANCELING: 撤销中
|
||||
* CANCELLED: 已撤销
|
||||
*/
|
||||
void withdrawNotify(String outBillNo, String state);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,10 +64,11 @@ public interface TableValueConstant {
|
|||
@Getter
|
||||
enum Status {
|
||||
PENDING("pending", "提现中"),
|
||||
REFUND("refund", "提现中"),
|
||||
SUB("sub", "系统扣减"),
|
||||
OPEN("open", "分销员购买"),
|
||||
FINISH("finish", "已提现"),
|
||||
SELF_RECHARGE("self_recharge", "自助充值");
|
||||
SELF_RECHARGE("self_recharge", "自助充值"), FAIL("fail", "失败");
|
||||
private final String code;
|
||||
private final String msg;
|
||||
|
||||
|
|
|
|||
|
|
@ -159,8 +159,6 @@ public abstract class BaseWx {
|
|||
}
|
||||
|
||||
public JSONObject verifySignature(HttpServletRequest request) {
|
||||
|
||||
|
||||
try {
|
||||
log.info("开始校验签名并解密");
|
||||
String timestamp = request.getHeader("Wechatpay-Timestamp");
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||
JSONObject jsonObject = appWxService.transferBalance(userInfo.getWechatOpenId(), userInfo.getRealName(), finalAmount, "提现", withdrawFlow.getBillNo());
|
||||
withdrawFlow.setPackageInfo(jsonObject.getString("package_info"));
|
||||
// 扣减余额
|
||||
userInfoService.updateDistributionAmount(userId, withdrawFlow.getAmount().negate());
|
||||
userInfoService.updateDistributionAmount(userId, withdrawFlowDTO.getAmount().negate());
|
||||
return withdrawFlowService.save(withdrawFlow);
|
||||
}
|
||||
|
||||
|
|
@ -679,4 +679,24 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||
"package", flow.getPackageInfo()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withdrawNotify(String outBillNo, String state) {
|
||||
MkDistributionWithdrawFlow flow = withdrawFlowService.getOne(new QueryWrapper().eq(MkDistributionWithdrawFlow::getBillNo, outBillNo));
|
||||
AssertUtil.isNull(flow, "提现记录不存在");
|
||||
switch (state) {
|
||||
case "SUCCESS":
|
||||
flow.setStatus(TableValueConstant.DistributionWithdrawFlow.Status.FINISH.getCode());
|
||||
break;
|
||||
case "FAIL":
|
||||
flow.setStatus(TableValueConstant.DistributionWithdrawFlow.Status.FAIL.getCode());
|
||||
case "CANCELLED":
|
||||
flow.setStatus(TableValueConstant.DistributionWithdrawFlow.Status.FAIL.getCode());
|
||||
// 扣减余额
|
||||
userInfoService.updateDistributionAmount(flow.getUserId(), flow.getAmount().add(flow.getServiceFee()));
|
||||
break;
|
||||
|
||||
}
|
||||
withdrawFlowService.updateById(flow);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue