| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.account.entity.TAppUser; |
| | | import com.dsh.account.entity.UserIntegralChanges; |
| | | import com.dsh.account.feignclient.activity.MerChandiseClient; |
| | | import com.dsh.account.mapper.TAppUserMapper; |
| | | import com.dsh.account.mapper.UserIntegralChangesMapper; |
| | | import com.dsh.account.model.SaveUserIntegralChangesVo; |
| | | import com.dsh.account.model.vo.userBenefitDetail.IntegralDetailsResponse; |
| | | import com.dsh.account.model.vo.userBenefitDetail.ExchangeDetailsResponse; |
| | | import com.dsh.account.model.vo.userBenefitDetail.IntegralsData; |
| | | import com.dsh.account.model.vo.userBenefitDetail.PointDetailsVo; |
| | | import com.dsh.account.service.UserIntegralChangesService; |
| | | import com.dsh.account.util.DateTimeHelper; |
| | | import com.dsh.account.util.ToolUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private TAppUserMapper tauMapper; |
| | | |
| | | |
| | | @Resource |
| | | private MerChandiseClient mcClient; |
| | | |
| | | @Override |
| | | public IntegralDetailsResponse queryUserPointsDetails(String yearMonth, Integer recordId, Integer userIdFormRedis) { |
| | | IntegralDetailsResponse vo = new IntegralDetailsResponse(); |
| | | List<IntegralDetailsResponse.IntegralsData> details = new ArrayList<>(); |
| | | public List<IntegralsData> queryUserPointsDetails(String yearMonth, Integer recordId, Integer userIdFormRedis) { |
| | | List<IntegralsData> details = new ArrayList<>(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm"); |
| | | |
| | | Date monthStart = null; |
| | |
| | | .orderByDesc("insertTime")); |
| | | if (userIntegralChanges.size() > 0 ){ |
| | | for (UserIntegralChanges userIntegralChange : userIntegralChanges) { |
| | | IntegralDetailsResponse.IntegralsData detail= new IntegralDetailsResponse.IntegralsData(); |
| | | IntegralsData detail= new IntegralsData(); |
| | | switch (userIntegralChange.getType()){ |
| | | case 1: |
| | | detail.setConsumeAmount("+"+(userIntegralChange.getNewIntegral() - userIntegralChange.getOldIntegral())); |
| | |
| | | } |
| | | if (null != recordId){ |
| | | details = details.stream() |
| | | .filter(obj -> obj instanceof IntegralDetailsResponse.IntegralsData) |
| | | .filter(obj -> obj instanceof IntegralsData) |
| | | .filter(obj -> Objects.equals(obj.getDetailsType(), recordId)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | TAppUser tAppUser = tauMapper.selectById(userIdFormRedis); |
| | | vo.setWpGold(tAppUser.getIntegral()); |
| | | vo.setDetailList(details); |
| | | } |
| | | return vo; |
| | | return details; |
| | | } |
| | | |
| | | |
| | |
| | | userIntegralChanges.setInsertTime(new Date()); |
| | | this.save(userIntegralChanges); |
| | | } |
| | | |
| | | @Override |
| | | public List<ExchangeDetailsResponse> queryExchangeGoodsdetails(Integer userIdFormRedis, Integer useType, Integer goodType) { |
| | | List<ExchangeDetailsResponse> integralExchangeDetails = mcClient.getIntegralExchangeDetails(userIdFormRedis); |
| | | if (ToolUtil.isNotEmpty(useType)){ |
| | | integralExchangeDetails = integralExchangeDetails.stream() |
| | | .filter(response -> Objects.equals(response.getUseStatus(), useType)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | if (ToolUtil.isNotEmpty(goodType)){ |
| | | integralExchangeDetails = integralExchangeDetails.stream() |
| | | .filter(response -> Objects.equals(response.getGoodType(), goodType)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | return integralExchangeDetails; |
| | | } |
| | | |
| | | @Override |
| | | public PointDetailsVo queryRedemptionDetails(Integer detailsId) { |
| | | return mcClient.getSpecificsOfGoods(detailsId); |
| | | } |
| | | } |