src/main/java/cc/mrbird/febs/common/enumerates/DataDictionaryEnum.java
@@ -22,6 +22,8 @@ BONUS_PERCENT("LEADERBONUS_SETTING", "BONUS_PERCENT"), //订单7天自动确认收货 OEDER_AUTO_CONFIRM("OEDER_AUTO_CONFIRM", "OEDER_AUTO_CONFIRM"), //提现最小金额 MEMBER_WITHDRAWAL_CNT("MEMBER_WITHDRAWAL", "MEMBER_WITHDRAWAL_CNT"), SCORE_SIGN_SETTING("SCORE_SETTING", "SCORE_SIGN_SETTING"), STATIC_BONUS("BONUS_TYPE", "STATIC_BONUS"), src/main/java/cc/mrbird/febs/mall/dto/WithdrawalDto.java
@@ -26,9 +26,9 @@ @ApiModelProperty(value = "交易密码") private String tradePwd; @ApiModelProperty(value = "银行卡号") private String bankNo; @ApiModelProperty(value = "姓名") private String name; // @ApiModelProperty(value = "银行卡号") // private String bankNo; // // @ApiModelProperty(value = "姓名") // private String name; } src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java
@@ -439,15 +439,7 @@ public BigDecimal canMoney() { Long memberId = LoginUserUtil.getLoginUser().getId(); MallMemberWallet wallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); BigDecimal profit = mallMoneyFlowMapper.selectProfitByDateAndMemberId(memberId); BigDecimal canMoney = wallet.getCommission(); if (profit != null) { if(canMoney.compareTo(BigDecimal.ZERO) > 0) { canMoney = canMoney.subtract(profit); } } return canMoney; return wallet.getBalance().setScale(2,BigDecimal.ROUND_DOWN); } @Override src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java
@@ -14,6 +14,7 @@ import cc.mrbird.febs.mall.service.IMallMemberWithdrawService; import cc.mrbird.febs.mall.service.MallMemberService; import cc.mrbird.febs.mall.vo.CashOutSettingVo; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.crypto.SecureUtil; import com.alibaba.fastjson.JSONObject; @@ -52,45 +53,40 @@ throw new FebsException("支付密码错误"); } if (withdrawalDto.getAmount().compareTo(BigDecimal.valueOf(100)) < 0) { throw new FebsException("最小提现金额为100"); } MallMemberPayment payment = mallMemberPaymentMapper.selectByMemberId(memberId); if (payment == null) { throw new FebsException("未设置收款方式"); } BigDecimal profit = mallMoneyFlowMapper.selectProfitByDateAndMemberId(memberId); MallMemberWallet wallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); if (profit != null) { // 可提现 BigDecimal canMoney = wallet.getCommission().subtract(profit); if(withdrawalDto.getAmount().compareTo(canMoney) > 0) { throw new FebsException("提现金额不足"); } } CashOutSettingVo cashOutSettingVo = new CashOutSettingVo(); DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.CASHOUT_SETTING.getType(), DataDictionaryEnum.CASHOUT_SETTING.getCode()); if (dic != null) { cashOutSettingVo = JSONObject.parseObject(dic.getValue(), CashOutSettingVo.class); } DataDictionaryCustom withdrawalCnt = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.MEMBER_WITHDRAWAL_CNT.getType(), DataDictionaryEnum.MEMBER_WITHDRAWAL_CNT.getCode()); if (withdrawalDto.getAmount().compareTo(cashOutSettingVo.getMinCashOut()) < 0) { throw new FebsException("最小提现金额为"+withdrawalCnt.getValue()+"元"); } BigDecimal serviceFee = cashOutSettingVo.getServiceFee().multiply(BigDecimal.valueOf(0.01)); String openId = mallMember.getOpenId(); if(StrUtil.isEmpty(openId)){ throw new FebsException("没有绑定微信"); } walletService.reduce(withdrawalDto.getAmount(), memberId, "commission"); String orderNo = MallUtils.getOrderNum("W"); MallMemberWallet wallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); if (ObjectUtil.isNotEmpty(wallet)) { // 可提现 BigDecimal canMoney = wallet.getBalance(); if(withdrawalDto.getAmount().compareTo(canMoney) > 0) { throw new FebsException("提现金额不足"); } } walletService.reduce(withdrawalDto.getAmount(), memberId, "balance"); String withdrawalNo = "TX."+MallUtils.getOrderNum(); MallMemberWithdraw withdraw = new MallMemberWithdraw(); withdraw.setWithdrawNo(orderNo); withdraw.setWithdrawNo(withdrawalNo); withdraw.setMemberId(memberId); withdraw.setAmount(withdrawalDto.getAmount()); withdraw.setStatus(1); withdraw.setAmountFee(serviceFee.multiply(withdrawalDto.getAmount())); this.baseMapper.insert(withdraw); mallMemberService.addMoneyFlow(memberId, withdrawalDto.getAmount().negate(), MoneyFlowTypeEnum.WITHDRAWAL.getValue(), orderNo, null, null, null, 1, FlowTypeEnum.COMMISSION.getValue()); mallMemberService.addMoneyFlow(memberId, withdrawalDto.getAmount().negate(), MoneyFlowTypeEnum.WITHDRAWAL.getValue(), withdrawalNo, null, null, null, 1, FlowTypeEnum.BALANCE.getValue()); } } src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java
@@ -76,7 +76,7 @@ BrandWCPayRequestData payData; String productNames = "小程序充值"; MallMember mallMember = mallMemberMapper.selectById(apiRechargeWalletDto.getMemberId()); String rechargeNo = "CZ_"+MallUtils.getOrderNum(); String rechargeNo = "CZ."+MallUtils.getOrderNum(); Boolean debug = xcxProperties.getDebug(); String attrStr = "{'rechargeNo':"+rechargeNo+",'memberId':"+mallMember.getId()+"}"; if (debug) { src/main/java/cc/mrbird/febs/pay/util/WeixinServiceUtil.java
@@ -4,6 +4,7 @@ import cc.mrbird.febs.common.properties.XcxProperties; import cc.mrbird.febs.common.utils.SpringContextHolder; import cc.mrbird.febs.pay.model.*; import cc.mrbird.febs.pay.service.impl.JsApiPayComService; import cc.mrbird.febs.pay.service.impl.RefundService; import cn.hutool.core.util.StrUtil; import lombok.extern.slf4j.Slf4j; @@ -128,6 +129,50 @@ return flag; } /**@Description 用户提现提现审核,企业付款到个人 @date 2017年5月26日 @atuhor jiangyouyao * @param desc 描述 * @param outTradeNo 提现申请编号 * @param totalFee 提现金额(分) * @param openid * @return */ public boolean comPay(String desc, String outTradeNo,int totalFee, String openid){ boolean flag=false; try { JsApiPayBusiness jsApiPayBusiness = new JsApiPayBusiness(); String paySecret = xcxProperties.getWecharpaySecret(); String appId = xcxProperties.getXcxAppid(); String certLocalPath = xcxProperties.getCertLocalPath(); String mchID = xcxProperties.getWecharpayMchid(); JsApiPayComReqData jsApiPayComReqData=new JsApiPayComReqData(mchID, appId, paySecret, desc,outTradeNo,totalFee,openid,"NO_CHECK",""); JsApiPayComService jsApiPayComService=new JsApiPayComService(); HttpsRequest2 request2= (HttpsRequest2) jsApiPayComService.getServiceRequest(); request2.setCertLocalPath(certLocalPath); request2.setMchId(mchID); JsApiPayComResData result = jsApiPayBusiness.payComOrder(jsApiPayComService, jsApiPayComReqData); log.info("#提现,企业付款到个人---result:{}",result); if (result.getResult_code().equals("SUCCESS")) { flag=true; }else{ log.info("#提现,企业付款到个人失败,{}!", "商户余额不足"); flag=false; } } catch (Exception e) { log.error("#企业付款到个人异常#提现#outTradeNo:{}#opUserID:{}", e, outTradeNo,openid); flag=false; } return flag; } /**@Description 支付获取远程设备的ip @date 2017年6月27日 @atuhor jiangyouyao