Commit 70f2452b authored by libin's avatar libin

Merge branch 'master-auto-pay' into dev

parents ae300919 c69f7885
......@@ -32,6 +32,8 @@ public class RabbitConstant {
//钱包
public static final String KEY_WALLET_ADD = "wallet.add";
public static final String KEY_WALLET_WITH_DRAW="wallet.withdraw";
static {
exchangeTopicSet = new HashSet<String>() {{
add(ADMIN_TOPIC);
......
package com.github.wxiaoqi.security.admin.constant;
/**
* @author libin
* @version 1.0
* @description 提现状态
* @data 2019/10/18 12:30
*/
public enum WithDrawStatusEnum {
/**
* 提现审核中
*/
AUDIT(0),
/**
* 提现成功
*/
SUCCESS(1),
/**
* 提现失败
*/
FAIL(2),
/**
* 提现审核同意
*/
AGREE(1),
/**
* 提现审核拒绝
*/
REJECT(2);
private int code;
WithDrawStatusEnum(int code) {
this.code = code;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
}
package com.github.wxiaoqi.security.admin.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
......@@ -12,6 +14,8 @@ import java.math.BigDecimal;
* @data 2019/7/18 9:50
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class WalletDetailListDTO {
private Integer id;
......
......@@ -5,7 +5,9 @@ import java.math.BigDecimal;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
......@@ -16,6 +18,8 @@ import lombok.Data;
* @date 2019-07-11 14:14:54
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "my_wallet_cath")
public class MyWalletCath implements Serializable {
private static final long serialVersionUID = 1L;
......
......@@ -129,4 +129,10 @@ public interface UserFeign {
@GetMapping("/app/user/finduserIdsByphones")
Map<String, Integer> findAppusersByUserNames(@RequestParam(value = "phones") List<String> phones);
@GetMapping("/wallet/withdraw_do")
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);
}
......@@ -2,7 +2,9 @@ package com.github.wxiaoqi.security.admin.biz;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.constant.WithDrawStatusEnum;
import com.github.wxiaoqi.security.admin.dto.WalletCathSumDto;
import com.github.wxiaoqi.security.admin.dto.WalletFindDTO;
import com.github.wxiaoqi.security.admin.dto.WalletListDTO;
......@@ -14,22 +16,22 @@ import com.github.wxiaoqi.security.admin.vo.ApplyCathVo;
import com.github.wxiaoqi.security.admin.vo.PayAccountVo;
import com.github.wxiaoqi.security.admin.vo.WalletPageVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant;
import com.github.wxiaoqi.security.common.constant.UserConstant;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.ClientUtil;
import com.github.wxiaoqi.security.common.util.OrderUtil;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.app.entity.vo.WithDrawRuleVo;
import com.xxfc.platform.app.feign.ConfigFeign;
import com.xxfc.platform.im.utils.StringUtil;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.universal.vo.FundPayVo;
import com.xxfc.platform.universal.weixin.constant.PaySubErrorCodeEnum;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -86,7 +88,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
private AppUserAlipayBiz appUserAlipayBiz;
@Autowired
private ThirdFeign thirdFeign;
RabbitTemplate rabbitTemplate;
private Snowflake snowflake;
......@@ -94,7 +96,6 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
private static final Integer WITHDRAW_ONLINE_WAY = 1;
private static final Integer WITHDRAW_OFFLINE_WAY = 2;
private static final Integer SUCCESS = 200;
private BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(12);
......@@ -306,7 +307,6 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
}
MyWalletCath walletCath = new MyWalletCath();
walletCath.setCrtTime(Instant.now().toEpochMilli());
WithDrawRuleVo withDrawRule = configFeign.getWithDrawRule();
Integer withdrawWay = withDrawRule.getWithdrawWay();
......@@ -317,38 +317,32 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
if ((realAmount.add(commission)).compareTo(balnece) > 0) {
realAmount = balnece.subtract(commission);
}
log.info("-----提现申请-----proceduReates===" + sumDto.getProceduReates() + "----commission====" + commission + "---realAmount===" + realAmount);
ObjectRestResponse<String> response = null;
//提现单号
String orderNo = snowflake.nextIdStr();
orderNo = String.format("%s%s", dateTimeFormatter.format(LocalDate.now()), orderNo);
log.info("-----提现申请-----proceduReates===" + sumDto.getProceduReates() + "----commission====" + commission + "---realAmount===" + realAmount);
//线上自动提现
if (WITHDRAW_ONLINE_WAY.equals(withdrawWay)) {
String cono = OrderUtil.GetOrderNumber("");
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String host = StringUtils.defaultIfBlank(request.getHeader("userHost"), ClientUtil.getClientIp(request));
FundPayVo fundPayVo = FundPayVo.builder()
.amount(applyCathVo.getCathType() == 0 ? String.valueOf(realAmount.multiply(new BigDecimal(100)).doubleValue()) : String.format("%.2f", realAmount.doubleValue()))
.outBizNo(cono)
.orderNo(orderNo)
.payeeAccount(applyCathVo.getAccountNumber())
.payerShowName("欣新房车网络科技(广东)股份有限公司")
.remark("提现转账")
.type(applyCathVo.getCathType())
.creatIp(host)
.build();
//商户订单号
response = thirdFeign.transferAccount(fundPayVo);
if (response.getStatus() == SUCCESS) {
walletCath.setStauts(1);
walletCath.setCono(String.valueOf(response.getData()));
walletCath.setFinishTime(Instant.now().toEpochMilli());
} else {
walletCath.setStauts(2);
walletCath.setReason(response.getMessage());
}
//发送提现申请
sendPayMessage(fundPayVo);
}
//提现单号
String orderNo = snowflake.nextIdStr();
orderNo = String.format("%s%s", dateTimeFormatter.format(LocalDate.now()), orderNo);
walletCath.setCrtTime(Instant.now().toEpochMilli());
walletCath.setOrderNo(orderNo);
walletCath.setStauts(WithDrawStatusEnum.AUDIT.getCode());
walletCath.setUserId(userId);
walletCath.setBalance(balnece);
walletCath.setCathType(cathType);
......@@ -358,12 +352,8 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
walletCath.setCommission(commission);
walletCath.setRealAmount(realAmount);
myWalletCathBiz.insertSelective(walletCath);
//提现金额
BigDecimal withdrawals = new BigDecimal(0);
if (response != null && response.getStatus() == SUCCESS) {
//提现金额
withdrawals = realAmount.add(commission);
BigDecimal withdrawals = realAmount.add(commission);
balnece = balnece.subtract(withdrawals).setScale(2, RoundingMode.HALF_UP);
log.info("------钱包----withdrawals===" + withdrawals + "----balnece====" + balnece);
MyWallet myWallet = new MyWallet();
......@@ -373,33 +363,16 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
myWallet.setWithdrawals(withdrawals);
myWallet.setVersion(sumDto.getVersion());
mapper.updMyWater(myWallet);
}
//线上提现
if (WITHDRAW_ONLINE_WAY.equals(applyCathVo.getCathType()) && response != null && response.getStatus() == SUCCESS) {
MyWalletDetail detail = new MyWalletDetail();
detail.setUserId(userId);
detail.setItype(1);
//设置提现单号
detail.setWithDrawOrderNo(orderNo);
detail.setCono(walletCath.getId().intValue());
detail.setBalance(balnece.add(withdrawals));
detail.setAmount(realAmount);
detail.setSource(10);
myWalletDetailBiz.insertSelective(detail);
detail.setId(null);
detail.setSource(13);
detail.setBalance(balnece.add(commission));
detail.setAmount(commission);
myWalletDetailBiz.insertSelective(detail);
}
return ObjectRestResponse.succ(walletCath.getId());
}
//提现审核
/**
* 提现审核
*/
public ObjectRestResponse verifyCath(Integer cathId, String reason, Integer status) {
if (status == 2 && StringUtils.isBlank(reason) || cathId == null || cathId == 0) {
boolean isvalid = status == WithDrawStatusEnum.REJECT.getCode() && StringUtils.isBlank(reason) || cathId == null || cathId == 0;
if (isvalid) {
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数不能为空");
}
MyWalletCath cath = myWalletCathBiz.selectById(cathId);
......@@ -408,83 +381,42 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "提现记录不存在");
}
boolean isContinuePay = false;
String errorMsg = "";
Integer userId = cath.getUserId();
MyWallet wallet = new MyWallet();
wallet.setUserId(userId);
wallet = selectOne(wallet);
if (wallet != null) {
//当时钱包的余额
BigDecimal balance = cath.getBalance();
BigDecimal realAmount = cath.getRealAmount();
BigDecimal commission = cath.getCommission();
ObjectRestResponse<String> response = null;
if (status == 1) {
String cono = StringUtil.isEmpty(cath.getCono()) ? OrderUtil.GetOrderNumber("") : cath.getCono();
if (status == WithDrawStatusEnum.AGREE.getCode()) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String host = StringUtils.defaultIfBlank(request.getHeader("userHost"), ClientUtil.getClientIp(request));
FundPayVo fundPayVo = FundPayVo.builder()
.amount(cath.getCathType() == 0 ? String.valueOf(cath.getRealAmount().multiply(new BigDecimal(100)).doubleValue()) : String.format("%.2f", cath.getRealAmount().doubleValue()))
.outBizNo(cono)
.payeeAccount(cath.getAccountNumber())
.orderNo(cath.getOrderNo())
.payerShowName("欣新房车网络科技(广东)股份有限公司")
.remark("提现转账")
.type(cath.getCathType())
.creatIp(host)
.build();
response = thirdFeign.transferAccount(fundPayVo);
if (response.getStatus() != SUCCESS) {
if (PaySubErrorCodeEnum.PAY_NEED_ERROR.getSubCode().equals(response.getSubCode())) {
isContinuePay = true;
errorMsg = response.getMessage();
cath.setCono(cono);
} else {
return ObjectRestResponse.createFailedResult(400, response.getMessage());
}
} else {
cath.setStauts(isContinuePay ? 0 : status);
//设置第三方单号
cath.setCono(response.getData());
cath.setFinishTime(System.currentTimeMillis());
}
if (SUCCESS == response.getStatus() || isContinuePay) {
myWalletCathBiz.updateSelectiveByIdRe(cath);
}
MyWalletDetail detail = new MyWalletDetail();
detail.setUserId(userId);
detail.setItype(1);
//设置提现单号
detail.setWithDrawOrderNo(cath.getOrderNo());
detail.setCono(cath.getId().intValue());
detail.setBalance(balance);
detail.setAmount(realAmount);
detail.setSource(10);
myWalletDetailBiz.insertSelective(detail);
detail.setId(null);
detail.setSource(13);
balance = balance.subtract(realAmount).setScale(2, RoundingMode.HALF_UP);
detail.setBalance(balance);
detail.setAmount(commission);
myWalletDetailBiz.insertSelective(detail);
sendPayMessage(fundPayVo);
log.info("发送提现消息成功:【{}】", fundPayVo);
} else {
cath.setStauts(status);
cath.setReason(reason);
cath.setFinishTime(System.currentTimeMillis());
myWalletCathBiz.updateSelectiveByIdRe(cath);
BigDecimal amount = realAmount.add(commission);
balance = wallet.getBalance().add(amount);
BigDecimal balance = wallet.getBalance().add(amount);
BigDecimal withdrawals = wallet.getWithdrawals().subtract(amount);
wallet.setBalance(balance);
wallet.setWithdrawals(withdrawals);
mapper.updMyWater(wallet);
}
}
if (isContinuePay) {
return ObjectRestResponse.createFailedResult(10001, errorMsg);
}
return ObjectRestResponse.succ();
}
......@@ -523,9 +455,60 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
return payAccountVos;
}
public void withDrawProcess(String orderNo, String cono, String reason, Boolean isSuccess) {
MyWalletCath myWalletCath = myWalletCathBiz.findWalletCatchByOrderNo(orderNo);
BigDecimal balnece = myWalletCath.getBalance();
myWalletCath.setCono(cono);
if (myWalletCath.getStauts() == WithDrawStatusEnum.AUDIT.getCode()) {
if (isSuccess) {
myWalletCath.setStauts(WithDrawStatusEnum.SUCCESS.getCode());
MyWalletDetail detail = new MyWalletDetail();
detail.setUserId(myWalletCath.getUserId());
detail.setItype(1);
//设置提现单号
detail.setWithDrawOrderNo(orderNo);
detail.setCono(myWalletCath.getId().intValue());
detail.setBalance(myWalletCath.getBalance());
detail.setAmount(myWalletCath.getAmount());
detail.setSource(10);
myWalletDetailBiz.insertSelective(detail);
detail.setId(null);
detail.setSource(13);
detail.setBalance(balnece.subtract(myWalletCath.getRealAmount()));
detail.setAmount(myWalletCath.getCommission());
myWalletDetailBiz.insertSelective(detail);
} else {
MyWallet wallet = new MyWallet();
wallet.setUserId(myWalletCath.getUserId());
wallet = selectOne(wallet);
myWalletCath.setReason(reason);
myWalletCath.setStauts(WithDrawStatusEnum.FAIL.getCode());
BigDecimal amount = myWalletCath.getRealAmount().add(myWalletCath.getCommission());
BigDecimal balance = wallet.getBalance().add(amount);
BigDecimal withdrawals = wallet.getWithdrawals().subtract(amount).setScale(2, RoundingMode.HALF_UP);
wallet.setBalance(balance);
wallet.setWithdrawals(withdrawals);
mapper.updMyWater(wallet);
}
myWalletCath.setFinishTime(Instant.now().toEpochMilli());
myWalletCathBiz.updateSelectiveByIdRe(myWalletCath);
}
}
private void sendPayMessage(FundPayVo fundPayVo) {
String json = JSON.toJSONString(fundPayVo);
Message message = MessageBuilder.withBody(json.getBytes())
.setContentType(MessageProperties.CONTENT_TYPE_JSON).setContentEncoding("utf-8")
.setMessageId(UUID.randomUUID() + "")
.setHeader("x-delay", 2000).build();
rabbitTemplate.convertAndSend(RabbitConstant.ADMIN_TOPIC, RabbitConstant.KEY_WALLET_WITH_DRAW, message);
}
@Override
public void afterPropertiesSet() throws Exception {
snowflake = new Snowflake(2, 2, false);
dateTimeFormatter = DateTimeFormatter.ofPattern("YYYYMMdd");
}
}
......@@ -12,6 +12,7 @@ import com.github.wxiaoqi.security.admin.vo.WalletCathPageVo;
import com.github.wxiaoqi.security.admin.vo.WalletCathVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.universal.constant.PayWay;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
......@@ -64,11 +65,11 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
BeanUtils.copyProperties(walletCath, walletCathVo);
totalWithdraw = totalWithdraw.add(walletCathVo.getAmount());
//微信
if (walletCath.getCathType()==0){
if (walletCath.getCathType()== PayWay.WX_PAY.getCode()){
walletCathVo.setAccountNumberDesc(String.format("%s%s%s","提现到微信(",walletCath.getAccountName(),")"));
}
//支付宝
if (walletCath.getCathType()==1){
if (walletCath.getCathType()==PayWay.ALI_PAY.getCode()){
walletCathVo.setAccountNumberDesc(String.format("%s%s%s","提现到支付宝(",walletCath.getAccountName(),")"));
}
walletCatchPageVos.add(walletCathVo);
......@@ -147,4 +148,10 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
public void insertSelective(MyWalletCath entity) {
mapper.insertSelective(entity);
}
public MyWalletCath findWalletCatchByOrderNo(String orderNo) {
MyWalletCath myWalletCath = new MyWalletCath();
myWalletCath.setOrderNo(orderNo);
return mapper.selectOne(myWalletCath);
}
}
package com.github.wxiaoqi.security.admin.biz;
import cn.hutool.core.date.DateTime;
import com.github.wxiaoqi.security.admin.dto.UserInfoDTO;
import com.github.wxiaoqi.security.admin.entity.MyWallet;
import com.github.wxiaoqi.security.admin.entity.MyWalletDetail;
import com.github.wxiaoqi.security.admin.mapper.MyWalletDetailMapper;
import com.github.wxiaoqi.security.admin.mapper.MyWalletMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
......@@ -18,7 +16,6 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.io.Serializable;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......
......@@ -7,9 +7,11 @@ import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.*;
/**
* rabbitmq配置类
* 包含: 不知道什么orderWater队列
*
* @author zhoujw
* @date 2019/7/15
*/
......@@ -24,8 +26,10 @@ public class RabbitAdminConfig extends RabbitCommonConfig {
//支付完成后永久绑定关系
public static final String ORDER_RELATION_QUEUE = "order.relation.queue";
static {
myQueue = new ArrayList<BindDTO>(){{
myQueue = new ArrayList<BindDTO>() {{
//支付完成后永久绑定关系
add(new BindDTO(ORDER_RELATION_QUEUE, ORDER_TOPIC, KEY_ORDER_PAY));
//拥金计算
......
......@@ -13,6 +13,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;
......@@ -42,7 +43,7 @@ public class MyWalletController {
@GetMapping
public ObjectRestResponse<AppletWalletVo> findMyWallet(HttpServletRequest request){
public ObjectRestResponse<AppletWalletVo> findMyWallet(HttpServletRequest request) {
try {
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
AppletWalletVo wallet = myWalletBiz.findMyWallet(Integer.valueOf(infoFromToken.getId()));
......@@ -56,35 +57,35 @@ public class MyWalletController {
@GetMapping("/checkCode")
@ApiOperation("检查验证码")
public ObjectRestResponse checkCode(
@RequestParam(value = "phone",defaultValue = "")String phone,
@RequestParam(value = "mobilecode",defaultValue = "")String mobilecod
){
return myWalletBiz.checkCode(phone,mobilecod);
@RequestParam(value = "phone", defaultValue = "") String phone,
@RequestParam(value = "mobilecode", defaultValue = "") String mobilecod
) {
return myWalletBiz.checkCode(phone, mobilecod);
}
@PostMapping("/setPwd")
@ApiOperation("设置密码")
public ObjectRestResponse setPwd(
@RequestParam(value = "phone",defaultValue = "")String phone,
@RequestParam(value = "mobilecode",defaultValue = "")String mobilecod,
@RequestParam(value = "password",defaultValue = "")String password,
@RequestParam(value = "type",defaultValue = "1")Integer type,
HttpServletRequest request){
@RequestParam(value = "phone", defaultValue = "") String phone,
@RequestParam(value = "mobilecode", defaultValue = "") String mobilecod,
@RequestParam(value = "password", defaultValue = "") String password,
@RequestParam(value = "type", defaultValue = "1") Integer type,
HttpServletRequest request) {
try {
Integer userId=Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return myWalletBiz.setPwd(userId,phone,mobilecod,password,type);
}catch (Exception e) {
Integer userId = Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return myWalletBiz.setPwd(userId, phone, mobilecod, password, type);
} catch (Exception e) {
throw new BaseException(e);
}
}
@GetMapping("/checkSetPwd")
@ApiOperation("检查用户是否设置过支付密码")
public ObjectRestResponse checkSetPwd(HttpServletRequest request){
public ObjectRestResponse checkSetPwd(HttpServletRequest request) {
try {
Integer userId=Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
Integer userId = Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return myWalletBiz.checkSetPwd(userId);
}catch (Exception e) {
} catch (Exception e) {
throw new BaseException(e);
}
}
......@@ -92,50 +93,58 @@ public class MyWalletController {
@GetMapping("/checkAmount")
@ApiOperation("检查提成下一步操作")
public ObjectRestResponse checkAmount(
@RequestParam(value = "amount",defaultValue = "0.00") BigDecimal amount,
HttpServletRequest request){
@RequestParam(value = "amount", defaultValue = "0.00") BigDecimal amount,
HttpServletRequest request) {
try {
Integer userId=Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return myWalletBiz.checkAmount(userId,amount,null);
}catch (Exception e) {
Integer userId = Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return myWalletBiz.checkAmount(userId, amount, null);
} catch (Exception e) {
throw new BaseException(e);
}
}
@PostMapping("/applyCath")
@ApiOperation("提现申请")
public ObjectRestResponse applyCath(@RequestBody ApplyCathVo applyCathVo, HttpServletRequest request){
public ObjectRestResponse applyCath(@RequestBody ApplyCathVo applyCathVo, HttpServletRequest request) {
try {
Integer userId=Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
Integer userId = Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
applyCathVo.setUserId(userId);
return myWalletBiz.applyCath(applyCathVo);
}catch (Exception e) {
} catch (Exception e) {
throw new BaseException(e);
}
}
@GetMapping("/txAlipayList")
@ApiOperation("获取支付账号列表")
public ObjectRestResponse txAlipayList(HttpServletRequest request){
public ObjectRestResponse txAlipayList(HttpServletRequest request) {
try {
Integer userId=Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return ObjectRestResponse.succ(alipayBiz.getListByUserId(userId)) ;
}catch (Exception e) {
Integer userId = Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return ObjectRestResponse.succ(alipayBiz.getListByUserId(userId));
} catch (Exception e) {
throw new BaseException(e);
}
}
@ApiOperation("获取支付账号(微信|支付宝|银行卡)")
@GetMapping("/pay_account_list")
public ObjectRestResponse listPayAccount(HttpServletRequest request){
public ObjectRestResponse listPayAccount(HttpServletRequest request) {
try {
Integer userId = Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
List<PayAccountVo> payAccountVos = myWalletBiz.listPayAccountByUserId(userId);
return ObjectRestResponse.succ(payAccountVos);
}catch (Exception ex){
} catch (Exception ex) {
throw new BaseException(ex);
}
}
@GetMapping("/withdraw_do")
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);
return ObjectRestResponse.succ();
}
}
package com.xxfc.platform.universal.constant;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/17 15:22
*/
public enum AliPayErrorEnum {
PAYEE_USER_INFO_ERROR("支付宝账号和姓名不匹配,请确认姓名是否正确", "请联系收款方确认收款用户姓名正确性"),
PAYER_USER_INFO_ERROR("付款用户姓名或其它信息不一致", "请检查接口传递的付款方用户姓名正确性。"),
PAYER_DATA_INCOMPLETE("根据监管部门的要求,需要付款用户补充身份信息才能继续操作", "根据监管部门的要求,需要付款用户登录支付宝站内或手机客户端补充身份信息才能继续操作"),
CERT_MISS_ACC_LIMIT("您连续10天余额账户的资金都超过5000元,根据监管部门的要求,需要付款用户补充身份信息才能继续操作", "您连续10天余额账户的资金都超过5000元,根据监管部门的要求,需要付款用户登录支付宝站内或手机客户端补充身份信息才能继续操作"),
PAYEE_ACC_OCUPIED("该手机号对应多个支付宝账户,请传入收款方姓名确定正确的收款账号", "如果未传入payee_real_name,请传递payee_real_name;如果传递了payee_real_name,是因为收款登录号对应多个账户且账户名相同,请联系收款方更换登录号"),
ACCOUNT_NOT_EXIST("根据监管部门的要求,请补全你的身份信息,开立余额账户", "请付款方登录支付宝站内或手机客户端补全身份信息"),
PAYER_CERT_EXPIRED("根据监管部门的要求,需要付款用户更新身份信息才能继续操作", "根据监管部门的要求,需要付款用户登录支付宝站内或手机客户端更新身份信息才能继续操作"),
PERMIT_NON_BANK_LIMIT_PAYEE("根据监管部门的要求,对方未完善身份信息或未开立余额账户,无法收款", "请联系收款方登录支付宝站内或手机客户端完善身份信息后,重试"),
EXCEED_LIMIT_PERSONAL_SM_AMOUNT("转账给个人支付宝账户单笔最多5万元", "转账给个人支付宝账户单笔最多5万元。"),
EXCEED_LIMIT_ENT_SM_AMOUNT("转账给企业支付宝账户单笔最多10万元", "转账给企业支付宝账户单笔最多10万元"),
EXCEED_LIMIT_SM_MIN_AMOUNT("单笔最低转账金额0.1元", "请修改转账金额"),
EXCEED_LIMIT_DM_MAX_AMOUNT("单日最多可转100万元", "单日最多可转100万元"),
EXCEED_LIMIT_UNRN_DM_AMOUNT("收款账户未实名,单日最多可收款1000元", "收款账户未实名,单日最多可收款1000元"),
PAYER_PAYEE_CANNOT_SAME("收付款方不能相同", "请检查一下收款方信息填写是否为付款方本人");
private String subReason;
private String solution;
AliPayErrorEnum(String subReason, String solution) {
this.subReason = subReason;
this.solution = solution;
}
public String getSubReason() {
return subReason;
}
public void setSubReason(String subReason) {
this.subReason = subReason;
}
public String getSolution() {
return solution;
}
public void setSolution(String solution) {
this.solution = solution;
}
}
package com.xxfc.platform.universal.constant;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/18 10:49
*/
public enum PayWay {
/**
* 微信支付
*/
WX_PAY(0,"微信"),
/**
* 支付宝
*/
ALI_PAY(1,"支付宝"),
/**
* 银行
*/
BANK(2,"银行");
private int code;
private String desc;
PayWay(int code,String desc) {
this.code = code;
this.desc = desc;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
package com.xxfc.platform.universal.constant;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/17 15:23
*/
public enum WxPayErrorEnum {
SEND_FAILED("付款错误,请查单确认付款结果","请查单确认付款结果,以查单结果为准"),
SYSTEMERROR("微信内部接口调用发生错误,请稍后重试","微信内部接口调用发生错误"),
FREQ_LIMIT("接口请求频率超时接口限制","调用接口过于频繁,请稍后再试,如果要继续付款必须使用原商户订单号重试"),
MONEY_LIMIT("已经达到今日付款总额上限","付款额度已经超限,请参考接口使用条件,如果要继续付款必须使用原商户订单号重试"),
V2_ACCOUNT_SIMPLE_BAN("微信支付账户未知名,无法付款","不支持给非实名用户付款,如果要继续付款必须使用原商户订单号重试"),
SENDNUM_LIMIT("今日付款次数超过限制","向用户付款的次数超限了,请参考接口使用条件,如果要继续付款必须使用原商户订单号重试");
private String subReason;
private String solution;
WxPayErrorEnum(String subReason, String solution) {
this.subReason = subReason;
this.solution = solution;
}
public String getSubReason() {
return subReason;
}
public void setSubReason(String subReason) {
this.subReason = subReason;
}
public String getSolution() {
return solution;
}
}
......@@ -5,12 +5,14 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
public class FundPayVo {
public class FundPayVo implements Serializable {
private static final long serialVersionUID = 1L;
//转账单号
private String outBizNo;
......@@ -32,5 +34,7 @@ public class FundPayVo {
private String checkName;
private String orderNo;
}
package com.xxfc.platform.universal.weixin.api;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.util.MD5Util;
import com.github.wxiaoqi.security.common.util.OrderUtil;
import com.github.wxiaoqi.security.common.util.process.SystemConfig;
......@@ -108,10 +109,9 @@ public class WXSuppToUserPay {
// System.out.println(map.get("payment_time"));
}
public static Map<String,String> WeiXinTiXian(String openid,String partnerTradeNo,String check_name,String amount,String desc,String spbill_create_ip) throws Exception
public static Map<String,String> WeiXinTiXian(String openid,String partnerTradeNo,String check_name,String amount,String desc,String spbill_create_ip)
{
WXSuppToUserPay prePay = new WXSuppToUserPay();
prePay.setMch_appid(SystemConfig.WINXIN_AppID);
prePay.setMchid(SystemConfig.WINXIN_PARTNER);
prePay.setNonce_str( OrderUtil.CreateNoncestr());
......@@ -123,7 +123,14 @@ public class WXSuppToUserPay {
prePay.setSpbill_create_ip(spbill_create_ip);
String result =postXML(suppTouser,prePay.getXMLTuiKuan());
result = result.replaceAll("<![CDATA[|]]>", "").replaceAll("支付成功", "pay sucess");
Map<String, String> map = XMLUtil.doXMLParse(result);
Map<String, String> map = null;
try {
map = XMLUtil.doXMLParse(result);
} catch (JDOMException e) {
throw new BaseException("微信转账参数xml解析错误",e);
} catch (IOException e) {
throw new BaseException("微信转账参数xml解析读写IO异常",e);
}
return map;
}
public static String postXML(String uri, String xml) {
......
......@@ -20,6 +20,7 @@ import com.github.wxiaoqi.security.common.util.UUIDUtils;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import com.xxfc.platform.universal.constant.PayWay;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.entity.OrderPay;
import com.xxfc.platform.universal.mapper.OrderPayMapper;
......@@ -27,15 +28,11 @@ import com.xxfc.platform.universal.utils.SignUtils;
import com.xxfc.platform.universal.vo.FundPayVo;
import com.xxfc.platform.universal.vo.OrderPayVo;
import com.xxfc.platform.universal.weixin.api.*;
import com.xxfc.platform.universal.weixin.constant.AliNeedPayErrorEnum;
import com.xxfc.platform.universal.weixin.constant.PaySubErrorCodeEnum;
import com.xxfc.platform.universal.weixin.constant.WxNeedPayErrorEnum;
import com.xxfc.platform.universal.weixin.constant.WxResponseProperties;
import com.xxfc.platform.universal.constant.WxResponseProperties;
import com.xxfc.platform.universal.weixin.util.HTTPUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -44,7 +41,6 @@ import tk.mybatis.mapper.entity.Example;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import static com.xxfc.platform.universal.constant.DictionaryKey.PAY_DEMOTION;
import static com.xxfc.platform.universal.constant.DictionaryKey.UNIVERSAL_PAY;
......@@ -58,7 +54,7 @@ import static com.xxfc.platform.universal.constant.DictionaryKey.UNIVERSAL_PAY;
*/
@Service
@Slf4j
public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements InitializingBean {
public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
@Autowired
DictionaryBiz dictionaryBiz;
......@@ -75,10 +71,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
@Value("${wx.appSercet}")
private String wy_secret;
private List<String> wxNeedPayErrorCodes;
private List<String> aliNeedPayErrorCodes;
private static final String SUCCESS = "SUCCESS";
......@@ -390,13 +382,15 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
* @return
* @throws Exception
*/
public String fundTrans(FundPayVo fundPayVo) throws Exception {
if (fundPayVo.getType() == 0) {
public String fundTrans(FundPayVo fundPayVo) throws BaseException {
String cono = OrderUtil.GetOrderNumber("");
fundPayVo.setOutBizNo(cono);
if (fundPayVo.getType() == PayWay.WX_PAY.getCode()) {
//微信
fundPayVo.setCheckName("NO_CHECK");
return wxpayfundTrans(fundPayVo);
}
if (fundPayVo.getType() == 1) {
if (fundPayVo.getType() == PayWay.ALI_PAY.getCode()) {
//支付宝
return alipayfundTrans(getAlipayClient(), fundPayVo);
}
......@@ -409,7 +403,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
* @param alipayClient
* @throws AlipayApiException
*/
public String alipayfundTrans(AlipayClient alipayClient, FundPayVo fundPayVo) throws AlipayApiException {
public String alipayfundTrans(AlipayClient alipayClient, FundPayVo fundPayVo){
AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest();
request.setBizContent("{" +
"\"out_biz_no\":\"" + fundPayVo.getOutBizNo() + "\"," +
......@@ -419,33 +413,25 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
"\"payer_show_name\":\"" + fundPayVo.getPayerShowName() + "\"," +
"\"remark\":\"" + fundPayVo.getRemark() + "\"" +
" }");
AlipayFundTransToaccountTransferResponse response = alipayClient.execute(request);
AlipayFundTransToaccountTransferResponse response = null;
try {
response = alipayClient.execute(request);
} catch (AlipayApiException e) {
throw new BaseException("支付宝转账api调用错误",e);
}
if (response.isSuccess()) {
log.info("转账调用成功");
return fundPayVo.getOutBizNo();
} else {
log.info("转账调用失败");
String subCode = response.getSubCode();
if (aliNeedPayErrorCodes.contains(subCode)) {
throw new BaseException(AliNeedPayErrorEnum.valueOf(subCode).getDesc(),PaySubErrorCodeEnum.PAY_NEED_ERROR.getSubCode());
}
throw new BaseException("支付宝转账失败:【错误码:" + response.getSubCode() + " 错误信息:" + response.getSubMsg() + "】",PaySubErrorCodeEnum.PAY_ERROR.getSubCode());
throw new BaseException(response.getSubMsg(),response.getSubCode());
}
}
public String wxpayfundTrans(FundPayVo fundPayVo) throws Exception {
public String wxpayfundTrans(FundPayVo fundPayVo) {
Map<String, String> map = WXSuppToUserPay.WeiXinTiXian(fundPayVo.getAmount(),fundPayVo.getOutBizNo(),fundPayVo.getCheckName(), fundPayVo.getAmount(), fundPayVo.getRemark(), fundPayVo.getCreatIp());
log.info("微信转账【{}】", map);
if (SUCCESS.equals(map.get(WxResponseProperties.RETURN_CODE)) && SUCCESS.equals(map.get(WxResponseProperties.RESULT_CODE))) {
return map.get(WxResponseProperties.PARTNER_TRADE_NO);
}
String errorCode = map.get(WxResponseProperties.ERROR_CODE);
if (wxNeedPayErrorCodes.contains(errorCode)) {
throw new BaseException(WxNeedPayErrorEnum.valueOf(errorCode).getDesc(), PaySubErrorCodeEnum.PAY_NEED_ERROR.getSubCode());
} else {
throw new BaseException("微信转账失败:【错误码" + errorCode + " 错误信息:" + map.get(WxResponseProperties.ERR_CODE_DES) + "】", PaySubErrorCodeEnum.PAY_ERROR.getSubCode());
}
throw new BaseException(map.get(WxResponseProperties.ERR_CODE_DES),map.get(WxResponseProperties.ERROR_CODE));
}
......@@ -647,16 +633,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
fundPayVo.setAmount("0.1");
fundPayVo.setPayeeAccount("2088212169302286");
AlipayClient alipayClient = orderPayBiz.getAlipayClient();
try {
System.out.println(orderPayBiz.alipayfundTrans(alipayClient, fundPayVo));
} catch (AlipayApiException e) {
e.printStackTrace();
}
}
@Override
public void afterPropertiesSet() throws Exception {
wxNeedPayErrorCodes = EnumSet.allOf(WxNeedPayErrorEnum.class).stream().map(WxNeedPayErrorEnum::name).collect(Collectors.toList());
aliNeedPayErrorCodes = EnumSet.allOf(AliNeedPayErrorEnum.class).stream().map(AliNeedPayErrorEnum::name).collect(Collectors.toList());
}
}
package com.xxfc.platform.universal.config;
import com.github.wxiaoqi.security.common.config.rabbit.BindDTO;
import com.github.wxiaoqi.security.common.config.rabbit.RabbitCommonConfig;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.ADMIN_TOPIC;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.KEY_WALLET_WITH_DRAW;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/17 17:23
*/
@Configuration
public class RabbitUniversalConfig extends RabbitCommonConfig {
/**
* 提现支付
*/
public static final String WITH_DRAW_QUEUE = "withdraw.wallet.queue";
static {
myQueue = new ArrayList<BindDTO>() {{
//钱包提现
add(new BindDTO(WITH_DRAW_QUEUE, ADMIN_TOPIC, KEY_WALLET_WITH_DRAW));
}};
}
}
package com.xxfc.platform.universal.handler;
import com.alibaba.fastjson.JSON;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.xxfc.platform.universal.biz.OrderPayBiz;
import com.xxfc.platform.universal.constant.AliPayErrorEnum;
import com.xxfc.platform.universal.constant.PayWay;
import com.xxfc.platform.universal.constant.WxPayErrorEnum;
import com.xxfc.platform.universal.vo.FundPayVo;
import com.xxfc.platform.universal.constant.AliNeedPayErrorEnum;
import com.xxfc.platform.universal.constant.WxNeedPayErrorEnum;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.stereotype.Component;
import com.rabbitmq.client.Channel;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.xxfc.platform.universal.config.RabbitUniversalConfig.WITH_DRAW_QUEUE;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/17 17:20
*/
@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Slf4j
public class WithDrawMqHandler implements InitializingBean {
private List<String> needPayErrorCodes;
private List<String> wxPayErrorCodes;
private List<String> aliPayErrorCodes;
private final UserFeign userFeign;
private final OrderPayBiz orderPayBiz;
@Resource(name = "redisTemplate")
private ValueOperations valueOperations;
private final RedisTemplate<String, String> redisTemplate;
private static final int MAX_RETRY = 3;
private static final String DEFAULT_ERROR_MSG = "当前操作有误,如有疑问请咨询客服";
/**
* 钱包提现
*
* @param
*/
@RabbitListener(queues = WITH_DRAW_QUEUE)
public void integralHandler(Message message, @Headers Map<String, Object> headers, Channel channel) {
FundPayVo fundPayVo = null;
String pay_way = "";
Integer cathType = null;
String orderNo = "";
try {
String msg = new String(message.getBody(), "UTF-8");
fundPayVo = JSON.parseObject(msg, FundPayVo.class);
cathType = fundPayVo.getType();
pay_way = fundPayVo.getType() == PayWay.WX_PAY.getCode() ?
PayWay.WX_PAY.getDesc() : fundPayVo.getType() == PayWay.ALI_PAY.getCode() ?
PayWay.ALI_PAY.getDesc() : fundPayVo.getType() == PayWay.BANK.getCode() ?
PayWay.BANK.getDesc() : "";
String cono = orderPayBiz.fundTrans(fundPayVo);
orderNo = fundPayVo.getOrderNo();
log.info("提现成功:【商户订单号:{}】-->【{}】", cono,msg);
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);
String reason = String.format("%s%s%s", pay_way, "转账失败", "[不支持的编码:UTF-8]");
userFeign.withDrawprocess(fundPayVo.getOrderNo(), "", reason, false);
log.info("{}:【{}】", reason, e);
} catch (BaseException e) {
//错误码
String subCode = e.getSubCode();
//再次发消息
if (needPayErrorCodes.contains(subCode)) {
Long count = valueOperations.increment(orderNo);
if (count <= MAX_RETRY) {
//重新把消息放回队列
basicNack(channel, message.getMessageProperties().getDeliveryTag(), false, true, pay_way);
return;
}
redisTemplate.delete(orderNo);
}
String msg = "";
if (wxPayErrorCodes.contains(subCode) && cathType != null && cathType == PayWay.WX_PAY.getCode()) {
msg = WxPayErrorEnum.valueOf(subCode).getSubReason();
}
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);
//放弃此消息
basicNack(channel, message.getMessageProperties().getDeliveryTag(), false, false, pay_way);
}
}
private void basicAck(Channel channel, long deliveryTag, boolean multiple, String pay_way) {
try {
channel.basicAck(deliveryTag, multiple);
} catch (IOException ex) {
log.info("{}提现转账消息签收失败:【{}】", pay_way, ex);
}
}
private void basicNack(Channel channel, long deliveryTag, boolean multiple, boolean requeue, String pay_way) {
try {
channel.basicNack(deliveryTag, multiple, requeue);
} catch (IOException ex) {
log.info("{}提现转账消息{}失败:【{}】", pay_way, requeue ? "重回队列" : "丢弃", ex);
}
}
@Override
public void afterPropertiesSet() throws Exception {
needPayErrorCodes = Stream.concat(EnumSet.allOf(WxNeedPayErrorEnum.class).stream().map(WxNeedPayErrorEnum::name), EnumSet.allOf(AliNeedPayErrorEnum.class).stream().map(AliNeedPayErrorEnum::name))
.distinct()
.collect(Collectors.toList());
wxPayErrorCodes = EnumSet.allOf(WxPayErrorEnum.class).stream().map(WxPayErrorEnum::name).collect(Collectors.toList());
aliPayErrorCodes = EnumSet.allOf(AliPayErrorEnum.class).stream().map(AliPayErrorEnum::name).collect(Collectors.toList());
}
}
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