| | |
| | | appUserService.updateById(appUser); |
| | | |
| | | //添加积分变动记录 |
| | | if(signPoint > 0){ |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(5); |
| | | userPoint.setVariablePoint(signPoint); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPoint.setChangeDirection(1); |
| | | userPointService.save(userPoint); |
| | | } |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(5); |
| | | userPoint.setVariablePoint(signPoint); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPoint.setChangeDirection(1); |
| | | userPointService.save(userPoint); |
| | | //变更等级 |
| | | appUserService.vipUpgrade(appUser.getId()); |
| | | |
| | | R<BigDecimal> bigDecimalR = systemConfigClient.redPackegeSet(); |
| | | BigDecimal data = bigDecimalR.getData(); |
| | | if(data.compareTo(BigDecimal.ZERO) > 0){ |
| | | userSignRecord.setRedAmount(data); |
| | | userSignRecord.setSignDay(LocalDate.now()); |
| | | BigDecimal sum = appUser.getTotalRedPacketAmount().add(bigDecimalR.getData()); |
| | | appUser.setTotalRedPacketAmount(sum); |
| | | BigDecimal sum2 = appUser.getBalance().add(bigDecimalR.getData()); |
| | | appUser.setBalance(sum2); |
| | | appUserService.updateById(appUser); |
| | | // 增加一条余额明细 |
| | | BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord(); |
| | | balanceChangeRecord.setAppUserId(appUser.getId()); |
| | | balanceChangeRecord.setVipId(appUser.getVipId()); |
| | | balanceChangeRecord.setChangeType(3); |
| | | balanceChangeRecord.setChangeAmount(bigDecimalR.getData()); |
| | | balanceChangeRecord.setDelFlag(0); |
| | | balanceChangeRecord.setCreateTime(LocalDateTime.now()); |
| | | balanceChangeRecord.setChangeDirection(1); |
| | | balanceChangeRecordService.save(balanceChangeRecord); |
| | | } |
| | | userSignRecordService.save(userSignRecord); |
| | | SignBackRDto signBackRDto = new SignBackRDto(); |
| | | signBackRDto.setPoint(userSignRecord.getPoint()); |
| | | signBackRDto.setRedAmount(userSignRecord.getRedAmount()); |
| | | return R.ok(signBackRDto); |
| | | } |
| | | }else { |
| | | userSignRecord.setPoint(0); |
| | | } |
| | | R<BigDecimal> bigDecimalR = systemConfigClient.redPackegeSet(); |
| | | userSignRecord.setRedAmount(bigDecimalR.getData()); |
| | | userSignRecord.setSignDay(LocalDate.now()); |
| | | BigDecimal sum = appUser.getTotalRedPacketAmount().add(bigDecimalR.getData()); |
| | | appUser.setTotalRedPacketAmount(sum); |
| | | BigDecimal sum2 = appUser.getBalance().add(bigDecimalR.getData()); |
| | | appUser.setBalance(sum2); |
| | | appUserService.updateById(appUser); |
| | | // 增加一条余额明细 |
| | | BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord(); |
| | | balanceChangeRecord.setAppUserId(appUser.getId()); |
| | | balanceChangeRecord.setVipId(appUser.getVipId()); |
| | | balanceChangeRecord.setChangeType(3); |
| | | balanceChangeRecord.setChangeAmount(bigDecimalR.getData()); |
| | | balanceChangeRecord.setDelFlag(0); |
| | | balanceChangeRecord.setCreateTime(LocalDateTime.now()); |
| | | balanceChangeRecord.setChangeDirection(1); |
| | | balanceChangeRecordService.save(balanceChangeRecord); |
| | | SignBackRDto signBackRDto = new SignBackRDto(); |
| | | signBackRDto.setPoint(userSignRecord.getPoint()); |
| | | signBackRDto.setRedAmount(userSignRecord.getRedAmount()); |
| | | userSignRecordService.save(userSignRecord); |
| | | return R.ok(signBackRDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |