| | |
| | | package cc.mrbird.febs.pay.controller; |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; |
| | | import cc.mrbird.febs.common.enumerates.OrderDeliveryStateEnum; |
| | | import cc.mrbird.febs.common.enumerates.OrderStatusEnum; |
| | | 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.mapper.MallMemberWalletMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallMoneyFlowMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallOrderInfoMapper; |
| | | import cc.mrbird.febs.mall.mapper.*; |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; |
| | | import cc.mrbird.febs.pay.model.NotifyData; |
| | | import cc.mrbird.febs.pay.model.OrderStateDto; |
| | |
| | | import cc.mrbird.febs.pay.util.Signature; |
| | | import cc.mrbird.febs.pay.util.Util; |
| | | import cc.mrbird.febs.pay.util.WechatConfigure; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | |
| | | MallMoneyFlowMapper mallMoneyFlowMapper; |
| | | @Autowired |
| | | MallMemberWalletMapper mallMemberWalletMapper; |
| | | @Autowired |
| | | MallMemberMapper mallMemberMapper; |
| | | @Autowired |
| | | DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | @Autowired |
| | | RedisUtils redisUtils; |
| | | @Autowired |
| | |
| | | attrStr = data.getAttach(); |
| | | JSONObject jsonObject = JSONUtil.parseObj(attrStr); |
| | | String rechargeNo = (String) jsonObject.get("rechargeNo"); |
| | | Long memberId = (Long) jsonObject.get("memberId"); |
| | | Long memberId = Long.parseLong(jsonObject.get("memberId").toString()); |
| | | // 检验订单状态 |
| | | MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectOneByOrderNoAndMemberId(rechargeNo,memberId); |
| | | // 校验签名 |
| | |
| | | |
| | | if (ObjectUtil.isNotEmpty(mallMoneyFlow)) { |
| | | log.debug("检查支付金额payMoney={},mallMoneyFlow.getPayMoney()={}", payMoney, mallMoneyFlow.getAmount()); |
| | | memberWalletService.addBalance(payMoney,memberId); |
| | | mallMoneyFlow.setStatus(2); |
| | | mallMoneyFlowMapper.updateById(mallMoneyFlow); |
| | | |
| | | RechargeWalletMessageSendDto rechargeWalletMessageSendDto = new RechargeWalletMessageSendDto(); |
| | | rechargeWalletMessageSendDto.setRechargeNo(rechargeNo); |
| | | rechargeWalletMessageSendDto.setRechargeAmount(payMoney.toString()); |
| | | |
| | | MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); |
| | | if(ObjectUtil.isNotEmpty(mallMemberWallet)){ |
| | | memberWalletService.addBalance(payMoney,memberId); |
| | | } |
| | | rechargeWalletMessageSendDto.setBalance(mallMemberWallet.getBalance().toString()); |
| | | rechargeWalletMessageSendDto.setCreateTime(DateUtil.now()); |
| | | rechargeWalletMessageSendDto.setOpenId(mallMemberMapper.selectById(memberId).getOpenId()); |
| | | DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.WX_TEMPLATE_ID_TWO.getType(), DataDictionaryEnum.WX_TEMPLATE_ID_TWO.getCode()); |
| | | rechargeWalletMessageSendDto.setTemplateId(dataDictionaryCustom.getValue()); |
| | | iXcxPayService.rechargeWalletMessageSend(rechargeWalletMessageSendDto); |
| | | threadResult.success().message("充值成功"); |
| | | } else { |
| | | log.info("充值失败", attrStr); |
| | |
| | | return; |
| | | |
| | | } |
| | | |
| | | // public static void main(String[] args) { |
| | | // String attach="{'rechargeNo':CZ_2022083117160259880,'memberId':47}"; |
| | | // JSONObject jsonObject = JSONUtil.parseObj(attach); |
| | | // String rechargeNo = (String) jsonObject.get("rechargeNo"); |
| | | // Long memberId = Long.parseLong(jsonObject.get("memberId").toString()); |
| | | // System.out.println(memberId); |
| | | // System.out.println(rechargeNo); |
| | | // } |
| | | /** |
| | | * 微信支付回调接口 |
| | | */ |
| | |
| | | // resXml = AppConstance.RESULT_XML_FAIL.replace(ERRORMSG, "支付回调签名错误"); |
| | | } finally { |
| | | // 通知线程消息 |
| | | PayThreadPool.notifyThread(Integer.valueOf(orderId), threadResult); |
| | | // PayThreadPool.notifyThread(Integer.valueOf(orderId), threadResult); |
| | | sendResultBack(response, resXml); |
| | | } |
| | | return; |