Commit f3c64312 authored by libin's avatar libin

Merge branch 'master-auto-pay' into dev

parents a8a0c988 d2f1efac
package com.github.wxiaoqi.security.admin.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 钱包提现表
......@@ -134,4 +137,7 @@ public class MyWalletCath implements Serializable {
@Column(name = "offline_way")
@ApiModelProperty(value = "线下提现方式 1:自动 2:手动")
private Integer offlineWay;
@Column(name = "real_reason")
private String realReason;
}
......@@ -5,7 +5,6 @@ import com.github.wxiaoqi.security.admin.bo.UserStaffBo;
import com.github.wxiaoqi.security.admin.dto.AppUserSellingWaterDTO;
import com.github.wxiaoqi.security.admin.dto.UserMemberDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.entity.AppUserPosition;
import com.github.wxiaoqi.security.admin.entity.BaseUserMember;
import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
......@@ -162,7 +161,8 @@ public interface UserFeign {
public ObjectRestResponse<Void> withDrawprocess(@RequestParam(value = "orderNo") String orderNo,
@RequestParam(value = "cono",required = false) String cono,
@RequestParam(value = "reason",required = false) String reason,
@RequestParam(value = "isSuccess") Boolean isSuccess);
@RequestParam(value = "isSuccess") Boolean isSuccess,
@RequestParam(value = "realReason",required = false) String realReason);
@GetMapping("/app/user/collect/exist")
boolean isCollectionByTypeAndTypeId(@RequestParam("userId") Integer userId,
......
......@@ -408,7 +408,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
BigDecimal commission = cath.getCommission();
if (status == WithDrawStatusEnum.AGREE.getCode()) {
if(org.springframework.util.StringUtils.hasText(payMentNo)){
withDrawProcess(cath.getOrderNo(),payMentNo,null,true);
withDrawProcess(cath.getOrderNo(),payMentNo,null,null,true);
}else {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String host = StringUtils.defaultIfBlank(request.getHeader("userHost"), ClientUtil.getClientIp(request));
......@@ -425,9 +425,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
ObjectRestResponse<String> response = thirdFeign.transferAccount(fundPayVo);
if (response.getStatus() == 200){
withDrawProcess(cath.getOrderNo(),response.getData(),"",true);
withDrawProcess(cath.getOrderNo(),response.getData(),null,null,true);
}else {
withDrawProcess(cath.getOrderNo(),response.getData(),response.getMessage(),false);
withDrawProcess(cath.getOrderNo(),response.getData(),response.getMessage(),response.getMessage(),false);
}
log.info("发送提现消息成功:【{}】", fundPayVo);
......@@ -483,7 +483,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
return payAccountVos;
}
public void withDrawProcess(String orderNo, String cono, String reason, Boolean isSuccess) {
public void withDrawProcess(String orderNo, String cono, String reason, String realReason,Boolean isSuccess) {
MyWalletCath myWalletCath = myWalletCathBiz.findWalletCatchByOrderNo(orderNo);
BigDecimal balnece = myWalletCath.getBalance();
myWalletCath.setCono(cono);
......@@ -510,6 +510,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
wallet.setUserId(myWalletCath.getUserId());
wallet = selectOne(wallet);
myWalletCath.setReason(reason);
myWalletCath.setRealReason(realReason);
myWalletCath.setStauts(WithDrawStatusEnum.FAIL.getCode());
BigDecimal amount = myWalletCath.getRealAmount().add(myWalletCath.getCommission());
BigDecimal balance = wallet.getBalance().add(amount);
......
......@@ -143,8 +143,9 @@ public class MyWalletController {
public ObjectRestResponse<Void> withDrawprocess(@RequestParam(value = "orderNo") String orderNo,
@RequestParam(value = "cono", required = false) String cono,
@RequestParam(value = "reason", required = false) String reason,
@RequestParam(value = "isSuccess") Boolean isSuccess) {
myWalletBiz.withDrawProcess(orderNo, cono, reason, isSuccess);
@RequestParam(value = "isSuccess") Boolean isSuccess,
@RequestParam(value = "realReason",required = false) String realReason) {
myWalletBiz.withDrawProcess(orderNo, cono, reason,realReason,isSuccess);
return ObjectRestResponse.succ();
}
}
......@@ -78,13 +78,13 @@ public class WithDrawMqHandler implements InitializingBean {
String cono = orderPayBiz.fundTrans(fundPayVo);
orderNo = fundPayVo.getOrderNo();
log.info("提现成功:【商户订单号:{}】-->【{}】", cono,msg);
userFeign.withDrawprocess(fundPayVo.getOrderNo(), cono, "", true);
userFeign.withDrawprocess(fundPayVo.getOrderNo(), cono, "", true,"");
Long deliveryTag = (Long) headers.get(AmqpHeaders.DELIVERY_TAG);
// 手动签收
basicAck(channel, deliveryTag, false, pay_way);
} catch (UnsupportedEncodingException e) {
basicNack(channel, message.getMessageProperties().getDeliveryTag(), false, false, pay_way);
userFeign.withDrawprocess(fundPayVo.getOrderNo(), "",DEFAULT_ERROR_MSG, false);
userFeign.withDrawprocess(fundPayVo.getOrderNo(), "",DEFAULT_ERROR_MSG, false,e.getMessage());
String reason = String.format("%s%s%s", pay_way, "转账失败", "[不支持的编码:UTF-8]");
log.info("{}:【{}】", reason, e);
} catch (BaseException e) {
......@@ -112,9 +112,8 @@ public class WithDrawMqHandler implements InitializingBean {
if (aliPayErrorCodes.contains(subCode) && cathType != null && cathType == PayWay.ALI_PAY.getCode()) {
msg = AliPayErrorEnum.valueOf(subCode).getSubReason();
}
msg = StringUtils.isEmpty(msg) ? DEFAULT_ERROR_MSG : msg;
userFeign.withDrawprocess(fundPayVo.getOrderNo(), "", msg, false);
String reason = StringUtils.isEmpty(msg) ? DEFAULT_ERROR_MSG : msg;
userFeign.withDrawprocess(fundPayVo.getOrderNo(), "",reason, false,e.getMessage());
//放弃此消息
basicNack(channel, message.getMessageProperties().getDeliveryTag(), false, false, pay_way);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment