| | |
| | | import com.ruoyi.system.query.BigGiftPackageOrderQuery; |
| | | import com.ruoyi.system.query.GoldChangeRecordQuery; |
| | | import com.ruoyi.system.query.ProfitPageListQuery; |
| | | import com.ruoyi.system.query.UserProfitPageListQuery; |
| | | import com.ruoyi.system.service.TBigGiftPackageOrderService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.service.TCommissionTransactionFlowService; |
| | |
| | | import com.ruoyi.system.utils.ICBCPayUtil; |
| | | import com.ruoyi.system.utils.OrderCodeGenerator; |
| | | import com.ruoyi.system.vo.PlaceOrderVO; |
| | | import com.ruoyi.system.vo.UserProfitPageListVo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<UserProfitPageListVo> profitUserPageList(Page<UserProfitPageListVo> page, UserProfitPageListQuery query) { |
| | | String sTime = null; |
| | | String eTime = null; |
| | | if(query.getCreateTime()!=null && !query.getCreateTime().isEmpty()){ |
| | | String[] split = query.getCreateTime().split(" - "); |
| | | sTime = split[0] + " 00:00:00"; |
| | | eTime = split[1] + " 23:59:59"; |
| | | } |
| | | |
| | | List<UserProfitPageListVo> profitPageListVos = this.baseMapper.profitUserPageList(page,query, sTime, eTime); |
| | | |
| | | |
| | | if(!profitPageListVos.isEmpty()){ |
| | | List<Integer> orderIds = profitPageListVos.stream().map(UserProfitPageListVo::getId).collect(Collectors.toList()); |
| | | List<TCommissionTransactionFlow> tCommissionTransactionFlows = commissionTransactionFlowMapper.selectList(new LambdaQueryWrapper<TCommissionTransactionFlow>().in(TCommissionTransactionFlow::getOrderId, orderIds)); |
| | | for (UserProfitPageListVo profitPageListVo : profitPageListVos) { |
| | | List<TCommissionTransactionFlow> flows = tCommissionTransactionFlows.stream().filter(e -> e.getOrderId().equals(profitPageListVo.getId()) && e.getAppUserId().equals(query.getUserId())).collect(Collectors.toList()); |
| | | profitPageListVo.setSelfProfit(flows.stream().map(TCommissionTransactionFlow::getCommissionAmount).reduce(BigDecimal.ZERO,BigDecimal::add)); |
| | | } |
| | | } |
| | | |
| | | return profitPageListVos; |
| | | } |
| | | |
| | | @Override |
| | | public List<UserProfitPageListVo> profitUserPageListExport(UserProfitPageListQuery query) { |
| | | String sTime = null; |
| | | String eTime = null; |
| | | if(query.getCreateTime()!=null && !query.getCreateTime().isEmpty()){ |
| | | String[] split = query.getCreateTime().split(" - "); |
| | | sTime = split[0] + " 00:00:00"; |
| | | eTime = split[1] + " 23:59:59"; |
| | | } |
| | | |
| | | List<UserProfitPageListVo> profitPageListVos = this.baseMapper.profitUserPageListExport(query, sTime, eTime); |
| | | |
| | | |
| | | if(!profitPageListVos.isEmpty()){ |
| | | List<Integer> orderIds = profitPageListVos.stream().map(UserProfitPageListVo::getId).collect(Collectors.toList()); |
| | | List<TCommissionTransactionFlow> tCommissionTransactionFlows = commissionTransactionFlowMapper.selectList(new LambdaQueryWrapper<TCommissionTransactionFlow>().in(TCommissionTransactionFlow::getOrderId, orderIds)); |
| | | for (UserProfitPageListVo profitPageListVo : profitPageListVos) { |
| | | List<TCommissionTransactionFlow> flows = tCommissionTransactionFlows.stream().filter(e -> e.getOrderId().equals(profitPageListVo.getId()) && e.getAppUserId().equals(query.getUserId())).collect(Collectors.toList()); |
| | | profitPageListVo.setSelfProfit(flows.stream().map(TCommissionTransactionFlow::getCommissionAmount).reduce(BigDecimal.ZERO,BigDecimal::add)); |
| | | } |
| | | } |
| | | |
| | | return profitPageListVos; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public PlaceOrderVO placeOrder(BigGiftPlaceOrderDTO dto, Integer appUserId, String openid) { |
| | | // 1. 校验商品是否存在 |