| | |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.enumerates.*; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.properties.XcxProperties; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.common.utils.SpringContextHolder; |
| | | import cc.mrbird.febs.mall.dto.RechargeWalletMessageSendDto; |
| | | import cc.mrbird.febs.mall.entity.DataDictionaryCustom; |
| | | import cc.mrbird.febs.mall.entity.MallMemberWallet; |
| | | import cc.mrbird.febs.mall.entity.MallMoneyFlow; |
| | | import cc.mrbird.febs.mall.entity.MallOrderInfo; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.*; |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberService; |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; |
| | |
| | | import cc.mrbird.febs.pay.util.Signature; |
| | | import cc.mrbird.febs.pay.util.Util; |
| | | import cc.mrbird.febs.pay.util.WechatConfigure; |
| | | import cc.mrbird.febs.rabbit.producter.AgentProducer; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.json.JSONObject; |
| | |
| | | private IApiMallMemberWalletService memberWalletService; |
| | | @Autowired |
| | | private IApiMallMemberService mallMemberService; |
| | | @Autowired |
| | | private MallAgentRecordMapper mallAgentRecordMapper; |
| | | @Autowired |
| | | private AgentProducer agentProducer; |
| | | |
| | | @Autowired |
| | | private IXcxPayService iXcxPayService; |
| | |
| | | String rechargeNo = (String) jsonObject.get("rechargeNo"); |
| | | Integer type = (Integer) jsonObject.get("type"); |
| | | Long memberId = Long.parseLong(jsonObject.get("memberId").toString()); |
| | | Long agentApplyId = Long.parseLong(jsonObject.get("agentApplyId").toString()); |
| | | // 检验订单状态 |
| | | MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectOneByOrderNoAndMemberId(rechargeNo,memberId); |
| | | // 校验签名 |
| | |
| | | log.debug("检查支付金额payMoney={},mallMoneyFlow.getPayMoney()={}", payMoney, mallMoneyFlow.getAmount()); |
| | | //合伙人申请的充值,要更新会员状态为FIRST_LEVEL |
| | | if(2 == type){ |
| | | mallMemberService.updateMemberAgent(memberId); |
| | | log.info("微信充值回调" + agentApplyId); |
| | | MallAgentRecord mallAgentRecord = mallAgentRecordMapper.selectById(agentApplyId); |
| | | mallMemberService.updateMemberAgent(agentApplyId,mallAgentRecord.getAgentLevel()); |
| | | } |
| | | memberWalletService.addBalance(payMoney,memberId); |
| | | mallMoneyFlow.setStatus(2); |
| | |
| | | |
| | | |
| | | if (order != null && OrderStatusEnum.WAIT_PAY.getValue() == order.getStatus()) { |
| | | if(order.getPayMethod().equals("余额加微信")){ |
| | | MallMemberWallet mallMemberWalletThree = mallMemberWalletMapper.selectWalletByMemberId(order.getMemberId()); |
| | | BigDecimal balanceThree = mallMemberWalletThree.getBalance(); |
| | | |
| | | int reduceThree = memberWalletService.reduce(balanceThree, order.getMemberId(), "balance"); |
| | | if (reduceThree == 2) { |
| | | throw new FebsException("余额不足"); |
| | | } |
| | | mallMoneyFlowService.addMoneyFlow(order.getMemberId(), balanceThree.negate(), MoneyFlowTypeEnum.PAY.getValue(), |
| | | order.getOrderNo(), FlowTypeEnum.BALANCE.getValue(),"余额支付",2); |
| | | } |
| | | log.debug("检查支付金额payMoney={},order.getPayMoney()={}", payMoney, order.getAmount()); |
| | | order.setStatus(OrderStatusEnum.WAIT_SHIPPING.getValue()); |
| | | order.setPayResult("1"); |
| | |
| | | |
| | | mallMoneyFlowService.addMoneyFlow( |
| | | order.getMemberId(), |
| | | order.getAmount(), |
| | | payMoney.negate(), |
| | | MoneyFlowTypeEnum.WECHAT_PAY.getValue(), |
| | | order.getOrderNo(), |
| | | FlowTypeEnum.WECHAT.getValue(), |
| | | "微信支付", |
| | | 2); |
| | | |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(order.getId().toString()); |
| | | stringBuffer.append("@"); |
| | | stringBuffer.append(order.getAmount().toString()); |
| | | agentProducer.sendOrderGetMsg(stringBuffer.toString()); |
| | | |
| | | threadResult.success().message("支付成功"); |
| | | } else { |
| | | log.info("订单状态不为待付款,order status=", order.getStatus()); |