| | |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; |
| | | import cc.mrbird.febs.common.enumerates.FlowTypeEnum; |
| | | import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; |
| | | import cc.mrbird.febs.common.properties.XcxProperties; |
| | | import cc.mrbird.febs.common.utils.MallUtils; |
| | | import cc.mrbird.febs.common.utils.OssUtils; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.common.utils.SpringContextHolder; |
| | | import cc.mrbird.febs.mall.dto.ApiRechargeWalletDto; |
| | | import cc.mrbird.febs.mall.entity.DataDictionaryCustom; |
| | | import cc.mrbird.febs.mall.entity.MallMember; |
| | | import cc.mrbird.febs.mall.entity.MallOrderInfo; |
| | |
| | | import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallMemberMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallOrderInfoMapper; |
| | | import cc.mrbird.febs.mall.service.IMallMoneyFlowService; |
| | | import cc.mrbird.febs.pay.model.*; |
| | | import cc.mrbird.febs.pay.service.IXcxPayService; |
| | | import cc.mrbird.febs.pay.util.WechatConfigure; |
| | |
| | | WeixinServiceUtil weixinServiceUtil; |
| | | @Autowired |
| | | private DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | private final IMallMoneyFlowService mallMoneyFlowService; |
| | | @Autowired |
| | | RedisUtils redisUtils; |
| | | |
| | |
| | | private final XcxProperties xcxProperties = SpringContextHolder.getBean(XcxProperties.class); |
| | | |
| | | @Override |
| | | public BrandWCPayRequestData startRechargeWallet(ApiRechargeWalletDto apiRechargeWalletDto) throws Exception { |
| | | BigDecimal unit = new BigDecimal("100"); |
| | | BigDecimal money = new BigDecimal(apiRechargeWalletDto.getAmount().toString()); |
| | | BrandWCPayRequestData payData; |
| | | String productNames = "小程序充值"; |
| | | MallMember mallMember = mallMemberMapper.selectById(apiRechargeWalletDto.getMemberId()); |
| | | String rechargeNo = "CZ_"+MallUtils.getOrderNum(); |
| | | Boolean debug = xcxProperties.getDebug(); |
| | | String attrStr = "{'rechargeNo':"+rechargeNo+",'memberId':"+mallMember.getId()+"}"; |
| | | if (debug) { |
| | | payData = weixinServiceUtil.createRechargeWallet("[测试]" + productNames, rechargeNo, |
| | | 1, mallMember.getOpenId(), attrStr); |
| | | } else { |
| | | payData = weixinServiceUtil.createRechargeWallet(productNames, rechargeNo, |
| | | unit.multiply(money).intValue(),mallMember.getOpenId(), attrStr); |
| | | } |
| | | mallMoneyFlowService.addMoneyFlow( |
| | | mallMember.getId(), |
| | | money, |
| | | MoneyFlowTypeEnum.RECHARGE.getValue(), |
| | | rechargeNo, |
| | | FlowTypeEnum.BALANCE.getValue()); |
| | | return payData; |
| | | } |
| | | |
| | | @Override |
| | | public BrandWCPayRequestData startPayment(MallOrderInfo mallOrderInfo) throws Exception { |
| | | BigDecimal unit = new BigDecimal("100"); |
| | | BigDecimal money = new BigDecimal(mallOrderInfo.getAmount().toString()); |