| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.system.mapper.TBigGiftPackageMapper; |
| | | import com.ruoyi.system.mapper.TCommissionTransactionFlowMapper; |
| | | import com.ruoyi.system.mapper.TCompanyMapper; |
| | | import com.ruoyi.system.model.TBigGiftPackage; |
| | | import com.ruoyi.system.model.TBigGiftPackageOrder; |
| | | import com.ruoyi.system.mapper.TBigGiftPackageOrderMapper; |
| | | import com.ruoyi.system.model.TCommissionTransactionFlow; |
| | | import com.ruoyi.system.model.TCompany; |
| | | import com.ruoyi.system.query.BigGiftPackageOrderQuery; |
| | | import com.ruoyi.system.query.ProfitPageListQuery; |
| | | import com.ruoyi.system.service.TBigGiftPackageOrderService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.service.TCommissionTransactionFlowService; |
| | | import com.ruoyi.system.vo.ProfitPageListVo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | private TBigGiftPackageMapper bigGiftPackageMapper; |
| | | |
| | | @Resource |
| | | private TCommissionTransactionFlowMapper commissionTransactionFlowMapper; |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | return tBigGiftPackageOrders ; |
| | | } |
| | | |
| | | @Override |
| | | public List<ProfitPageListVo> profitPageList(Page<ProfitPageListVo> page, ProfitPageListQuery 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<ProfitPageListVo> profitPageListVos = this.baseMapper.profitPageList(page, query, sTime, eTime); |
| | | |
| | | |
| | | if(!profitPageListVos.isEmpty()){ |
| | | List<Integer> orderIds = profitPageListVos.stream().map(ProfitPageListVo::getId).collect(Collectors.toList()); |
| | | List<TCommissionTransactionFlow> tCommissionTransactionFlows = commissionTransactionFlowMapper.selectList(new LambdaQueryWrapper<TCommissionTransactionFlow>().in(TCommissionTransactionFlow::getOrderId, orderIds)); |
| | | for (ProfitPageListVo profitPageListVo : profitPageListVos) { |
| | | TCommissionTransactionFlow flow = tCommissionTransactionFlows.stream().filter(e -> e.getOrderId().equals(profitPageListVo.getId()) && e.getAppUserType()==2).findFirst().orElse( null); |
| | | if(flow!=null){ |
| | | profitPageListVo.setSaleProfit(flow.getCommissionAmount()); |
| | | } |
| | | TCommissionTransactionFlow flow1 = tCommissionTransactionFlows.stream().filter(e -> e.getOrderId().equals(profitPageListVo.getId()) && e.getAppUserType()==3).findFirst().orElse( null); |
| | | if(flow1!=null){ |
| | | profitPageListVo.setPartnerProfit(flow1.getCommissionAmount()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return profitPageListVos; |
| | | } |
| | | |
| | | @Override |
| | | public List<ProfitPageListVo> profitPageListExport(ProfitPageListQuery 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<ProfitPageListVo> profitPageListVos = this.baseMapper.profitPageListExport(query, sTime, eTime); |
| | | |
| | | |
| | | if(!profitPageListVos.isEmpty()){ |
| | | List<Integer> orderIds = profitPageListVos.stream().map(ProfitPageListVo::getId).collect(Collectors.toList()); |
| | | List<TCommissionTransactionFlow> tCommissionTransactionFlows = commissionTransactionFlowMapper.selectList(new LambdaQueryWrapper<TCommissionTransactionFlow>().in(TCommissionTransactionFlow::getOrderId, orderIds)); |
| | | for (ProfitPageListVo profitPageListVo : profitPageListVos) { |
| | | TCommissionTransactionFlow flow = tCommissionTransactionFlows.stream().filter(e -> e.getOrderId().equals(profitPageListVo.getId()) && e.getAppUserType()==2).findFirst().orElse( null); |
| | | if(flow!=null){ |
| | | profitPageListVo.setSaleProfit(flow.getCommissionAmount()); |
| | | } |
| | | TCommissionTransactionFlow flow1 = tCommissionTransactionFlows.stream().filter(e -> e.getOrderId().equals(profitPageListVo.getId()) && e.getAppUserType()==3).findFirst().orElse( null); |
| | | if(flow1!=null){ |
| | | profitPageListVo.setPartnerProfit(flow1.getCommissionAmount()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return profitPageListVos; |
| | | } |
| | | } |