| | |
| | | import com.ruoyi.common.core.utils.PhoneNumberValidator; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; |
| | | import com.ruoyi.order.model.OrderGood; |
| | | import com.ruoyi.other.api.domain.PointSetting; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.api.enums.PointChangeType; |
| | |
| | | private PointSettingService pointSettingService; |
| | | @Resource |
| | | private UserPointService userPointService; |
| | | @Resource |
| | | private RemoteOrderGoodsClient remoteOrderGoodsClient; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | UserPointVO userPointVO = new UserPointVO(); |
| | | // todo bug说取剩余积分 |
| | | userPointVO.setTotalPoint(appUser.getLavePoint()); |
| | | |
| | | R<List<OrderGood>> unDistributedOrder = remoteOrderGoodsClient.getUnDistributedOrder(userId); |
| | | List<OrderGood> unDistributedOrderList = unDistributedOrder.getData(); |
| | | Integer totalPoint = unDistributedOrderList.stream() |
| | | .mapToInt(OrderGood::getSuperiorRebatePoints) |
| | | .sum(); |
| | | |
| | | |
| | | userPointVO.setTotalPoint(appUser.getLavePoint()+totalPoint); |
| | | userPointVO.setConsumePoint(appUser.getAvailablePoint()); |
| | | userPointVO.setShopPoint(appUser.getShopPoint()); |
| | | userPointVO.setSharePoint(appUser.getSharePoint()); |
| | |
| | | if (CollectionUtil.isNotEmpty(page.getRecords())) { |
| | | List<UserPointDetailVO> collect = page.getRecords().stream().map(p -> { |
| | | UserPointDetailVO userPointDetailVO = new UserPointDetailVO(); |
| | | if (p.getType() != null && (p.getType().equals(12) || p.getType().equals(13))){ |
| | | Long appUserId = p.getObjectId(); |
| | | AppUser appUser = appUserService.getById(appUserId); |
| | | userPointDetailVO.setName(appUser.getName()); |
| | | } |
| | | userPointDetailVO.setType(p.getType()); |
| | | userPointDetailVO.setVariablePoint(p.getVariablePoint()); |
| | | String format = p.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | |
| | | appUserForPhoe.setTotalAvailablePoint(appUserForPhoe.getTotalAvailablePoint() + point); |
| | | appUserService.updateById(appUserForPhoe); |
| | | //构建积分流水记录 |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(12); |
| | | userPoint.setHistoricalPoint(lavePoint1); |
| | | userPoint.setVariablePoint(point); |
| | | userPoint.setBalance(appUserForPhoe.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUserForPhoe.getId()); |
| | | userPointService.save(userPoint); |
| | | if(point > 0){ |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(12); |
| | | userPoint.setHistoricalPoint(lavePoint1); |
| | | userPoint.setVariablePoint(point); |
| | | userPoint.setBalance(appUserForPhoe.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUserForPhoe.getId()); |
| | | userPoint.setObjectId(userid); |
| | | userPointService.save(userPoint); |
| | | } |
| | | |
| | | Integer lavePoint = appUser.getLavePoint(); |
| | | appUser.setLavePoint(appUser.getLavePoint() - point); |
| | |
| | | appUser.setAvailablePoint(appUser.getAvailablePoint() - point); |
| | | appUserService.updateById(appUser); |
| | | //构建积分流水记录 |
| | | userPoint = new UserPoint(); |
| | | userPoint.setType(13); |
| | | userPoint.setHistoricalPoint(lavePoint); |
| | | userPoint.setVariablePoint(point); |
| | | userPoint.setBalance(appUser.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPointService.save(userPoint); |
| | | if(point > 0){ |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(13); |
| | | userPoint.setHistoricalPoint(lavePoint); |
| | | userPoint.setVariablePoint(point); |
| | | userPoint.setBalance(appUser.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPoint.setObjectId(appUserForPhoe.getId()); |
| | | userPointService.save(userPoint); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |