| | |
| | | import com.lunhan.water.entity.request.pay.ReqPayRefund; |
| | | |
| | | import com.lunhan.water.repository.impl.*; |
| | | import com.lunhan.water.repository.mapper.SysDictTypeMapper; |
| | | import com.lunhan.water.repository.po.*; |
| | | import org.slf4j.Logger; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | |
| | | private TradeRecordMapperImpl tradeRecordDao; |
| | | @Autowired |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | @Autowired |
| | | private SysDictTypeMapperImpl sysDictTypeMapper; |
| | | @Autowired |
| | | private SysDictDataMapperImpl sysDictDataMapper; |
| | | |
| | | |
| | | /** |
| | |
| | | item.setPaymentMethod(EPayType.WX_PAY.getDesc()); |
| | | item.setRechargeStatus(EYesOrNo.NO.getValue()); |
| | | item.setRechargeAmount(request.getTradeAmount()); |
| | | item.setComment("水卡充值"); |
| | | item.setComment("余额充值"); |
| | | item.setCreateTime(LocalDateTimeUtil.nowTimeStamp()); |
| | | item.setCreateUser(loginUser.getUserId()); |
| | | item.setCreateUserName(loginUser.getNickName()); |
| | |
| | | UserLoginPO user = userLoginMapper.getById(rechargeOrderPO.getUserId()); |
| | | UserLoginPO userLoginPO = new UserLoginPO(); |
| | | userLoginPO.setId(user.getId()); |
| | | //余额加上交易金额=充值后的余额 |
| | | userLoginPO.setBalance(userLoginPO.getBalance().add(trade.getTradeAmount())); |
| | | //将充值金额转换为水量 |
| | | List<SysDictDataPO> feesAmount = sysDictDataMapper.getListByType("fees_amount"); |
| | | if(ListUtil.isNotNullOrEmpty(feesAmount)){ |
| | | SysDictDataPO sysDictDataPO = feesAmount.get(0); |
| | | BigDecimal bigDecimal = trade.getTradeAmount().multiply(new BigDecimal(sysDictDataPO.getDictValue())).setScale(2, BigDecimal.ROUND_DOWN); |
| | | userLoginPO.setBalance(bigDecimal); |
| | | }else { |
| | | //默认单价 |
| | | BigDecimal bigDecimal = trade.getTradeAmount().multiply(new BigDecimal(3)).setScale(2, BigDecimal.ROUND_DOWN); |
| | | userLoginPO.setBalance(bigDecimal); |
| | | } |
| | | int modify = userLoginMapper.updateById(userLoginPO); |
| | | //添加资金明细记录 |
| | | UserCapitalChangePO changePO = new UserCapitalChangePO(); |