Commit 65965c60 authored by libin's avatar libin

Merge branch 'dev' into base-modify

parents 5798c2e5 0ec5c89f
......@@ -51,6 +51,8 @@ public class WalletCathListDTO {
@ApiModelProperty("提现单号")
private String orderNo;
@ApiModelProperty(value = "用户账号")
@ApiModelProperty(value = "")
private String accountNumber;
private String accountName;
}
......@@ -20,6 +20,8 @@ public class AppUserDetail {
private Integer userid;
@Column(name = "is_member")
private Integer isMember;
@Column(name = "wx_nickname")
private String wxNickname;
private String nickname;
private String realname;
private String headimgurl;
......
......@@ -123,4 +123,7 @@ public class MyWalletCath implements Serializable {
@Column(name = "order_no")
@ApiModelProperty(value = "第三方订单号:如微信,支付宝,银行卡等")
private String orderNo;
@Column(name = "account_name")
private String accountName;
}
......@@ -19,6 +19,7 @@ public class AppUserDTO {
private Integer userid;
private Integer isMember;
private String username;
private String wxNickname;
private String nickname;
private String realname;
private String headimgurl;
......
......@@ -43,4 +43,7 @@ public class ApplyCathVo {
@ApiModelProperty(value = "支付类型")
private Integer cathType;
@ApiModelProperty(value = "账号名称")
private String accountName;
}
......@@ -21,9 +21,11 @@ public class PayAccountVo {
@ApiModelProperty(value = "微信用户名 | 支付宝帐号")
private String accountDesc;
@ApiModelProperty("微信用户名 | 支付宝账号")
@ApiModelProperty("微信用openid | 支付宝账号userid")
private String account;
@ApiModelProperty(value = "帐户类型 0:微信 1:支付宝 2:银行卡")
private Integer accountType;
private String nickName;
}
......@@ -53,4 +53,5 @@ public class WalletCathAdminVo {
@ApiModelProperty(value = "用户账号描述")
private String accountNumberDesc;
private String accountName;
}
......@@ -63,4 +63,9 @@ public class WalletCathVo {
@ApiModelProperty(value = "审核日期")
private Long finishTime;
@ApiModelProperty(value = "用户账号描述")
private String accountNumberDesc;
private String accountName;
}
......@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.entity.AppUserAlipay;
import com.github.wxiaoqi.security.admin.entity.AppUserDetail;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.entity.AppUserRelationTemp;
import com.github.wxiaoqi.security.admin.mapper.AppUserAlipayMapper;
......@@ -46,6 +47,9 @@ public class AppUserAlipayBiz extends BaseBiz<AppUserAlipayMapper, AppUserAlipay
@Autowired
AppUserLoginBiz appUserLoginBiz;
@Autowired
AppUserDetailBiz appUserDetailBiz;
@Autowired
ThirdFeign thirdFeign;
......@@ -97,9 +101,11 @@ public class AppUserAlipayBiz extends BaseBiz<AppUserAlipayMapper, AppUserAlipay
//微信
AppUserLogin appUserLogin = appUserLoginBiz.getUserById(userId);
if(appUserLogin != null && StringUtils.isNotBlank(appUserLogin.getWxOpenid())) {
AppUserDetail appUserDetail = appUserDetailBiz.getUserByUserid(userId);
AppUserAlipay wxAppUser = new AppUserAlipay();
wxAppUser.setType(2);
wxAppUser.setUserId(userId);
wxAppUser.setNickname(appUserDetail.getWxNickname());
wxAppUser.setTxAlipay(appUserLogin.getWxOpenid());
appUserAlipays.add(wxAppUser);
}
......
......@@ -28,7 +28,6 @@ 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 net.bytebuddy.implementation.bytecode.Throw;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
......@@ -45,10 +44,10 @@ import tk.mybatis.mapper.entity.Example;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.Instant;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
/**
......@@ -93,6 +92,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
private DateTimeFormatter dateTimeFormatter;
private static final Integer WITHDRAW_ONLINE_WAY=1;
private static final Integer WITHDRAW_OFFLINE_WAY=2;
private BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(12);
......@@ -301,6 +303,12 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
if (sumDto == null) {
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数不能为空");
}
MyWalletCath walletCath = new MyWalletCath();
walletCath.setCrtTime(Instant.now().toEpochMilli());
WithDrawRuleVo withDrawRule = configFeign.getWithDrawRule();
Integer withdrawWay = withDrawRule.getWithdrawWay();
BigDecimal commission = amount.multiply(sumDto.getProceduReates()).divide(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
BigDecimal balnece = sumDto.getBalance();
//到账金额
......@@ -309,9 +317,35 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
realAmount = balnece.subtract(commission);
}
log.info("-----提现申请-----proceduReates===" + sumDto.getProceduReates() + "----commission====" + commission + "---realAmount===" + realAmount);
//添加账号
// alipayBiz.addAlipay(userId,accountNumber);
MyWalletCath walletCath = new MyWalletCath();
//线上自动提现
if (WITHDRAW_ONLINE_WAY.equals(withdrawWay)){
String pay_no;
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)
.payeeAccount(applyCathVo.getAccountNumber())
.payerShowName("欣新房车网络科技(广东)股份有限公司")
.remark("提现转账")
.type(applyCathVo.getCathType())
.creatIp(host)
.build();
try {
//商户订单号
pay_no = thirdFeign.transferAccount(fundPayVo);
walletCath.setStauts(1);
walletCath.setCono(pay_no);
walletCath.setFinishTime(Instant.now().toEpochMilli());
}catch (BaseException baex){
throw new BaseException(baex.getMessage(),400);
}catch (Exception ex){
throw new BaseException((applyCathVo.getCathType() == 0?"微信提现":applyCathVo.getCathType() == 1?"支付宝提现":"银行提现")+"转账失败",ex);
}
}
//提现单号
String orderNo = snowflake.nextIdStr();
orderNo = String.format("%s%s", dateTimeFormatter.format(LocalDate.now()), orderNo);
......@@ -319,6 +353,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
walletCath.setUserId(userId);
walletCath.setBalance(balnece);
walletCath.setCathType(cathType);
walletCath.setAccountName(applyCathVo.getAccountName());
walletCath.setAccountNumber(accountNumber);
walletCath.setAmount(amount);
walletCath.setCommission(commission);
......@@ -335,6 +370,24 @@ 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())){
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());
}
......@@ -362,7 +415,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
BigDecimal realAmount = cath.getRealAmount();
BigDecimal commission = cath.getCommission();
if (status == 1) {
String cono = StringUtil.isEmpty(cath.getCono()) ? OrderUtil.GetOrderNumber("TX"):cath.getCono();
String cono = StringUtil.isEmpty(cath.getCono()) ? OrderUtil.GetOrderNumber(""):cath.getCono();
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String host = StringUtils.defaultIfBlank(request.getHeader("userHost"), ClientUtil.getClientIp(request));
FundPayVo fundPayVo = FundPayVo.builder()
......@@ -444,6 +497,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
PayAccountVo alipayAccount = PayAccountVo.builder()
.account(appUserAlipay.getTxAlipay())
.accountType(1)
.nickName(appUserAlipay.getNickname())
.accountDesc(String.format("%s%s%s", "支付宝余额(", appUserAlipay.getTxAlipay(), ")"))
.build();
payAccountVos.add(alipayAccount);
......@@ -453,7 +507,8 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
if (!org.springframework.util.StringUtils.isEmpty(appUserLogin.getOpenid())) {
PayAccountVo wxAccount = PayAccountVo.builder()
.account(appUserLogin.getOpenid())
.accountType(0)
.accountType(2)
.nickName(appUserDetail.getWxNickname())
.accountDesc(String.format("%s%s%s", "微信零钱(", appUserDetail.getNickname(), ")"))
.build();
payAccountVos.add(wxAccount);
......
......@@ -63,6 +63,14 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
walletCathVo = new WalletCathVo();
BeanUtils.copyProperties(walletCath, walletCathVo);
totalWithdraw = totalWithdraw.add(walletCathVo.getAmount());
//微信
if (walletCath.getCathType()==0){
walletCathVo.setAccountNumberDesc(String.format("%s%s%s","提现到微信(",walletCath.getAccountName(),")"));
}
//支付宝
if (walletCath.getCathType()==1){
walletCathVo.setAccountNumberDesc(String.format("%s%s%s","提现到支付宝(",walletCath.getAccountName(),")"));
}
walletCatchPageVos.add(walletCathVo);
}
walletCathPageVo.setPageNum(walletCathPage.getPageNum());
......@@ -105,14 +113,7 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
BeanUtils.copyProperties(walletCathListDTO, walletCathAdminVo);
walletCathAdminVo.setUsername(StringUtils.isEmpty(walletCathListDTO.getRealname()) ? walletCathListDTO.getNickname() : walletCathListDTO.getRealname());
walletCathAdminVo.setPhone(walletCathListDTO.getUsername());
//微信
if (walletCathListDTO.getCathType()==0){
walletCathAdminVo.setAccountNumberDesc(String.format("%s%s%s","提现到微信(",walletCathListDTO.getAccountNumber(),")"));
}
//支付宝
if (walletCathListDTO.getCathType()==1){
walletCathAdminVo.setAccountNumberDesc(String.format("%s%s%s","提现到支付宝(",walletCathListDTO.getAccountNumber(),")"));
}
walletCathAdminVos.add(walletCathAdminVo);
}
walletCathAdminVos.sort(Comparator.comparing(WalletCathAdminVo::getCrtTime).reversed());
......@@ -141,4 +142,9 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
criteria.andIn("userId", userIds);
mapper.deleteByExample(example);
}
@Override
public void insertSelective(MyWalletCath entity) {
mapper.insertSelective(entity);
}
}
......@@ -16,7 +16,8 @@
wc.finish_time AS `finishTime`,
wc.cono,
wc.order_no AS `orderNo`,
wc.account_number AS `accountNumber`
wc.account_number AS `accountNumber`,
wc.account_name AS `accountName`
FROM
(SELECT * FROM `my_wallet_cath` <if test="state != null">
WHERE `stauts`=#{state}
......
......@@ -102,7 +102,7 @@ public class OrderMemberService extends AbstractOrderHandle<OrderMemberDetailBiz
//设置订单状态为3
bo.getOrder().setStatus(OrderStatusEnum.ORDER_UNPAY.getCode());
//设置订单图片
bo.getOrder().setPicture(bo.getBaseUserMemberLevel().getIcon());
bo.getOrder().setPicture(bo.getBaseUserMemberLevel().getItemImg());
//设置订单名称
bo.getOrder().setName(bo.getBaseUserMemberLevel().getName());
......
......@@ -69,7 +69,7 @@ public class ActivityController extends BaseController<ActivityBiz, Activity> {
}
@PutMapping("/remove/id")
@DeleteMapping("/remove/{id}")
@ApiOperation(value = "删除",notes = "删除")
public ObjectRestResponse remove(@PathVariable Integer id ){
if (baseBiz.remove(id)) {
......
......@@ -11,7 +11,8 @@ import lombok.AllArgsConstructor;
@AllArgsConstructor
public enum AliNeedPayErrorEnum {
SYSTEM_ERROR("系统繁忙","系统繁忙");
SYSTEM_ERROR("系统繁忙","系统繁忙"),
PAYER_BALANCE_NOT_ENOUGH("余额不足","余额不足");
private String desc;
private String reason;
......
......@@ -427,7 +427,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
log.info("转账调用失败");
String subCode = response.getSubCode();
if (aliNeedPayErrorCodes.contains(subCode)) {
throw new BaseException("支付宝账号余额不足",PaySubErrorCodeEnum.PAY_NEED_ERROR.getSubCode());
throw new BaseException(AliNeedPayErrorEnum.valueOf(subCode).getDesc(),PaySubErrorCodeEnum.PAY_NEED_ERROR.getSubCode());
}
throw new BaseException("支付宝转账失败:【错误码:" + response.getSubCode() + " 错误信息:" + response.getSubMsg() + "】",PaySubErrorCodeEnum.PAY_ERROR.getSubCode());
}
......@@ -641,8 +641,14 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
public static void main(String[] args) {
OrderPayBiz orderPayBiz = new OrderPayBiz();
FundPayVo fundPayVo = new FundPayVo();
fundPayVo.setRemark("转账");
fundPayVo.setOutBizNo("12345678");
fundPayVo.setAmount("0.1");
fundPayVo.setPayeeAccount("2088212169302286");
AlipayClient alipayClient = orderPayBiz.getAlipayClient();
try {
System.out.println(orderPayBiz.getAlipayToken(""));
System.out.println(orderPayBiz.alipayfundTrans(alipayClient, fundPayVo));
} catch (AlipayApiException e) {
e.printStackTrace();
}
......
......@@ -8,6 +8,7 @@ import com.xxfc.platform.universal.constant.enumerate.FileTypeEnum;
import com.xxfc.platform.universal.service.UploadZipService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.codehaus.plexus.util.IOUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -96,7 +97,11 @@ public class UploadZipServiceImpl implements UploadZipService {
}
}
}
result.substring(0,result.length()-1);
return ObjectRestResponse.succ(result.substring(0, result.length()-1));
if (StringUtils.isNotEmpty(result.toString())) {
result.substring(0,result.length()-1);
return ObjectRestResponse.succ(result.substring(0, result.length()-1));
}
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"压缩包中无照片或照片格式不对!");
}
}
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