Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-system/src/main/java/com/ruoyi/system/model/TIntegralSettlement.java
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.*; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.IntegralChangeRecordVo; |
| | | import com.ruoyi.system.vo.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | @Autowired |
| | | private TBigGiftPackageOrderService bigGiftPackageOrderService; |
| | | |
| | | @Autowired |
| | | private TIntegralSettlementService integralSettlementService; |
| | | |
| | | |
| | | @ApiOperation(value = "用户管理分页列表") |
| | |
| | | return R.ok(tBigGiftPackageOrderPage); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "用户- 推广记录") |
| | | @PostMapping("/promotionPageList") |
| | | public R<Page<UserPromotionPageListVo>> promotionPageList(@RequestBody @Valid UserPromotionPageListQuery query) { |
| | | Page<UserPromotionPageListVo> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | List<UserPromotionPageListVo> list = appUserService.userPromotionPageList(page,query); |
| | | page.setRecords(list); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "用户-推广记录导出") |
| | | @PostMapping(value = "/exportUserPromotion") |
| | | @Log(title = "推广记录-导出", businessType = BusinessType.EXPORT) |
| | | public void exportUserPromotion(@RequestBody @Valid UserPromotionPageListQuery query){ |
| | | |
| | | List<UserPromotionPageListVo> list = appUserService.userPromotionPageListExport(query); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), UserPromotionPageListVo.class, list); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | assert response != null; |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("推广记录导出信息.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "用户收益明细") |
| | | @PostMapping("/profitUserPageList") |
| | | public R<Page<UserProfitPageListVo>> profitUserPageList(@RequestBody @Valid UserProfitPageListQuery query) { |
| | | Page<UserProfitPageListVo> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | List<UserProfitPageListVo> list = bigGiftPackageOrderService.profitUserPageList(page,query); |
| | | |
| | | page.setRecords(list); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "用户收益明细导出") |
| | | @PostMapping(value = "/exportUserProfit") |
| | | @Log(title = "收益明细-导出", businessType = BusinessType.EXPORT) |
| | | public void exportUserProfit(@RequestBody @Valid UserProfitPageListQuery query){ |
| | | |
| | | List<UserProfitPageListVo> list = bigGiftPackageOrderService.profitUserPageListExport(query); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), UserProfitPageListVo.class, list); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | assert response != null; |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("收益明细导出信息.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "用户- 结算记录") |
| | | @PostMapping("/settlementPageList") |
| | | public R<Page<TIntegralSettlement>> settlementPageList(@RequestBody @Valid GoldChangeRecordQuery query) { |
| | | Page<TIntegralSettlement> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | LambdaQueryWrapper<TIntegralSettlement> queryWrapper = new LambdaQueryWrapper<TIntegralSettlement>().eq(TIntegralSettlement::getAppUserId, query.getUserId()).orderByDesc(TIntegralSettlement::getCreateTime); |
| | | Page<TIntegralSettlement> integralSettlementPage = integralSettlementService.page(page, queryWrapper); |
| | | return R.ok(integralSettlementPage); |
| | | } |
| | | |
| | | @ApiOperation(value = "用户结算记录导出") |
| | | @PostMapping(value = "/exportSettlementPageList") |
| | | @Log(title = "结算记录-导出", businessType = BusinessType.EXPORT) |
| | | public void exportSettlementPageList(@RequestBody @Valid GoldChangeRecordQuery query){ |
| | | |
| | | List<TIntegralSettlement> list = integralSettlementService.list(new LambdaQueryWrapper<TIntegralSettlement>().eq(TIntegralSettlement::getAppUserId, query.getUserId()).orderByDesc(TIntegralSettlement::getCreateTime)); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TIntegralSettlement.class, list); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | assert response != null; |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("结算记录导出信息.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | Date now = new Date(); |
| | | List<TCommissionTransactionFlow> list = commissionTransactionFlowService.lambdaQuery().eq(TCommissionTransactionFlow::getAppUserId, userId) |
| | | .between(TCommissionTransactionFlow::getCreateTime, DateUtil.beginOfMonth(now), DateUtil.endOfMonth(now)).list(); |
| | | Integer total = list.stream().mapToInt(TCommissionTransactionFlow::getCommissionAmount).sum(); |
| | | BigDecimal total = list.stream().map(TCommissionTransactionFlow::getCommissionAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | appUser.setEstimatedMonthlyIntegral(total); |
| | | } |
| | | return R.ok(appUser); |
| | |
| | | import com.ruoyi.system.model.TAppUser; |
| | | import com.ruoyi.system.query.AppUserListQuery; |
| | | import com.ruoyi.system.query.PromotionPageListQuery; |
| | | import com.ruoyi.system.query.UserPromotionPageListQuery; |
| | | import com.ruoyi.system.vo.PromotionPageListVo; |
| | | import com.ruoyi.system.vo.UserPromotionPageListVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | List<TAppUser> transferPageUserList(@Param("query") AppUserListQuery query, @Param("pageInfo") PageInfo<TAppUser> pageInfo); |
| | | |
| | | |
| | | List<UserPromotionPageListVo> userPromotionPageList(@Param("page") Page<UserPromotionPageListVo> page, @Param("query") UserPromotionPageListQuery query); |
| | | |
| | | List<UserPromotionPageListVo> userPromotionPageListExport(@Param("query") UserPromotionPageListQuery query); |
| | | |
| | | |
| | | } |
| | |
| | | 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.vo.ProfitPageListVo; |
| | | import com.ruoyi.system.vo.UserProfitPageListVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | List<TBigGiftPackageOrder> pageOrderList(@Param("tBigGiftPackageOrderPage") Page<TBigGiftPackageOrder> tBigGiftPackageOrderPage, @Param("query") GoldChangeRecordQuery query); |
| | | |
| | | |
| | | List<UserProfitPageListVo> profitUserPageList(@Param("page") Page<UserProfitPageListVo> page, @Param("query") UserProfitPageListQuery query, @Param("sTime") String sTime, @Param("eTime") String eTime); |
| | | |
| | | List<UserProfitPageListVo> profitUserPageListExport(@Param("query") UserProfitPageListQuery query, @Param("sTime") String sTime, @Param("eTime") String eTime); |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "当月预估积分") |
| | | @TableField(exist = false) |
| | | private Integer estimatedMonthlyIntegral; |
| | | private BigDecimal estimatedMonthlyIntegral; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "佣金收入金额") |
| | | @TableField("commission_amount") |
| | | private Integer commissionAmount; |
| | | private BigDecimal commissionAmount; |
| | | |
| | | @ApiModelProperty(value = "添加时间") |
| | | @TableField("create_time") |
| | |
| | | package com.ruoyi.system.model; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import java.time.LocalDate; |
| | |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | |
| | | @ApiModelProperty(value = "结算周期") |
| | | @TableField("settlement_interval") |
| | | @Excel(name = "结算周期") |
| | | private String settlementInterval; |
| | | |
| | | @ApiModelProperty(value = "结算开始时间") |
| | | @TableField("settlement_start_time") |
| | | @Excel(name = "结算开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate settlementStartTime; |
| | | |
| | | @ApiModelProperty(value = "结算结束时间") |
| | | @TableField("settlement_end_time") |
| | | @Excel(name = "结算结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate settlementEndTime; |
| | | |
| | | @ApiModelProperty(value = "合计结算积分") |
| | | @TableField("total_settlement_integral") |
| | | private BigDecimal totalSettlementIntegral; |
| | | @Excel(name = "结算积分") |
| | | private Integer totalSettlementIntegral; |
| | | |
| | | @ApiModelProperty(value = "添加时间") |
| | | @TableField("create_time") |
| | |
| | | |
| | | @ApiModelProperty("备注") |
| | | @TableField("remark") |
| | | @Excel(name = "备注") |
| | | private String remark; |
| | | |
| | | |
| | | |
| | | |
| | | |
| New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | @ApiModel("用户收益明细分页查询参数") |
| | | public class UserProfitPageListQuery extends BasePage { |
| | | @ApiModelProperty("用户姓名") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty("用户手机号") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty("订单编号") |
| | | private String code; |
| | | |
| | | @ApiModelProperty("下单时间 2022-02-02 - 2022-03-03") |
| | | private String createTime; |
| | | |
| | | @ApiModelProperty("用户id") |
| | | @NotNull(message = "用户id不能为空") |
| | | private Integer userId; |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | |
| | | @Data |
| | | @ApiModel(value = "用户推广记录列表查询参数") |
| | | public class UserPromotionPageListQuery extends BasePage { |
| | | |
| | | |
| | | @ApiModelProperty(value = "用户名") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @NotNull(message = "用户id不能为空") |
| | | private Integer userId; |
| | | |
| | | } |
| | |
| | | import com.ruoyi.system.query.AppUserListQuery; |
| | | import com.ruoyi.system.query.ProfitPageListQuery; |
| | | import com.ruoyi.system.query.PromotionPageListQuery; |
| | | import com.ruoyi.system.query.UserPromotionPageListQuery; |
| | | import com.ruoyi.system.vo.ProfitPageListVo; |
| | | import com.ruoyi.system.vo.PromotionPageListVo; |
| | | import com.ruoyi.system.vo.UserPromotionPageListVo; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | |
| | | PageInfo<TAppUser> transferPageUserList(AppUserListQuery query); |
| | | |
| | | |
| | | List<UserPromotionPageListVo> userPromotionPageList(Page<UserPromotionPageListVo> page, @Valid UserPromotionPageListQuery query); |
| | | |
| | | List<UserPromotionPageListVo> userPromotionPageListExport(@Valid UserPromotionPageListQuery query); |
| | | |
| | | } |
| | |
| | | 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.vo.ProfitPageListVo; |
| | | import com.ruoyi.system.vo.PlaceOrderVO; |
| | | import com.ruoyi.system.vo.UserProfitPageListVo; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | |
| | | |
| | | List<TBigGiftPackageOrder> pageOrderList(Page<TBigGiftPackageOrder> tBigGiftPackageOrderPage, GoldChangeRecordQuery query); |
| | | |
| | | List<UserProfitPageListVo> profitUserPageList(Page<UserProfitPageListVo> page, @Valid UserProfitPageListQuery query); |
| | | |
| | | List<UserProfitPageListVo> profitUserPageListExport(@Valid UserProfitPageListQuery query); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.AppUserListQuery; |
| | | import com.ruoyi.system.query.PromotionPageListQuery; |
| | | import com.ruoyi.system.query.UserPromotionPageListQuery; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.PromotionPageListVo; |
| | | import com.ruoyi.system.vo.UserPromotionPageListVo; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | BigDecimal totalOne = giftPackageOrders.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TBigGiftPackageOrder::getPaymentPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | promotionPageListVo.setTotalConsume(totalOne); |
| | | |
| | | Integer totalIncome = flows.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).mapToInt(TCommissionTransactionFlow::getCommissionAmount).sum(); |
| | | BigDecimal totalIncome = flows.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TCommissionTransactionFlow::getCommissionAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | promotionPageListVo.setTotalIncome(totalIncome); |
| | | |
| | | Integer totalSettledIncome = settlements.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).mapToInt(TIntegralSettlement::getTotalSettlementIntegral).sum(); |
| | | promotionPageListVo.setTotalSettledIncome(totalSettledIncome); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | return list; |
| | | } |
| | | @Override |
| | | public List<UserPromotionPageListVo> userPromotionPageList(Page<UserPromotionPageListVo> page, UserPromotionPageListQuery query) { |
| | | List<UserPromotionPageListVo> list = this.baseMapper.userPromotionPageList(page,query); |
| | | |
| | | if (!list.isEmpty()) { |
| | | List<Integer> userIds = list.stream().map(UserPromotionPageListVo::getUserId).collect(Collectors.toList()); |
| | | // List<TPhysicalGoodsOrder> physicalGoodsOrders = tPhysicalGoodsOrderService.list(new LambdaQueryWrapper<TPhysicalGoodsOrder>().in(TPhysicalGoodsOrder::getAppUserId, userIds).notIn(TPhysicalGoodsOrder::getStatus,Arrays.asList(1,4))); |
| | | List<TBigGiftPackageOrder> giftPackageOrders = tBigGiftPackageOrderService.list(new LambdaQueryWrapper<TBigGiftPackageOrder>().in(TBigGiftPackageOrder::getAppUserId, userIds).notIn(TBigGiftPackageOrder::getStatus,Arrays.asList(1,5))); |
| | | |
| | | |
| | | List<TCommissionTransactionFlow> flows = tCommissionTransactionFlowService.list(new LambdaQueryWrapper<TCommissionTransactionFlow>().in(TCommissionTransactionFlow::getAppUserId, userIds)); |
| | | |
| | | List<TIntegralSettlement> settlements = tIntegralSettlementService.list(new LambdaQueryWrapper<TIntegralSettlement>().in(TIntegralSettlement::getAppUserId, userIds)); |
| | | for (UserPromotionPageListVo promotionPageListVo : list) { |
| | | // BigDecimal total = physicalGoodsOrders.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TPhysicalGoodsOrder::getPaymentPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal totalOne = giftPackageOrders.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TBigGiftPackageOrder::getPaymentPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | promotionPageListVo.setTotalConsume(totalOne); |
| | | |
| | | BigDecimal totalIncome = flows.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TCommissionTransactionFlow::getCommissionAmount).reduce(BigDecimal.ZERO,BigDecimal::add); |
| | | promotionPageListVo.setTotalIncome(totalIncome); |
| | | |
| | | Integer totalSettledIncome = settlements.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).mapToInt(TIntegralSettlement::getTotalSettlementIntegral).sum(); |
| | | promotionPageListVo.setTotalSettledIncome(totalSettledIncome); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<UserPromotionPageListVo> userPromotionPageListExport(UserPromotionPageListQuery query) { |
| | | List<UserPromotionPageListVo> list = this.baseMapper.userPromotionPageListExport(query); |
| | | |
| | | if (!list.isEmpty()) { |
| | | List<Integer> userIds = list.stream().map(UserPromotionPageListVo::getUserId).collect(Collectors.toList()); |
| | | // List<TPhysicalGoodsOrder> physicalGoodsOrders = tPhysicalGoodsOrderService.list(new LambdaQueryWrapper<TPhysicalGoodsOrder>().in(TPhysicalGoodsOrder::getAppUserId, userIds).notIn(TPhysicalGoodsOrder::getStatus,Arrays.asList(1,4))); |
| | | List<TBigGiftPackageOrder> giftPackageOrders = tBigGiftPackageOrderService.list(new LambdaQueryWrapper<TBigGiftPackageOrder>().in(TBigGiftPackageOrder::getAppUserId, userIds).notIn(TBigGiftPackageOrder::getStatus,Arrays.asList(1,5))); |
| | | |
| | | |
| | | List<TCommissionTransactionFlow> flows = tCommissionTransactionFlowService.list(new LambdaQueryWrapper<TCommissionTransactionFlow>().in(TCommissionTransactionFlow::getAppUserId, userIds)); |
| | | |
| | | List<TIntegralSettlement> settlements = tIntegralSettlementService.list(new LambdaQueryWrapper<TIntegralSettlement>().in(TIntegralSettlement::getAppUserId, userIds)); |
| | | for (UserPromotionPageListVo promotionPageListVo : list) { |
| | | // BigDecimal total = physicalGoodsOrders.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TPhysicalGoodsOrder::getPaymentPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal totalOne = giftPackageOrders.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TBigGiftPackageOrder::getPaymentPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | promotionPageListVo.setTotalConsume(totalOne); |
| | | |
| | | BigDecimal totalIncome = flows.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TCommissionTransactionFlow::getCommissionAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | promotionPageListVo.setTotalIncome(totalIncome); |
| | | |
| | | Integer totalSettledIncome = settlements.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).mapToInt(TIntegralSettlement::getTotalSettlementIntegral).sum(); |
| | |
| | | BigDecimal totalOne = giftPackageOrders.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TBigGiftPackageOrder::getPaymentPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | promotionPageListVo.setTotalConsume(totalOne); |
| | | |
| | | Integer totalIncome = flows.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).mapToInt(TCommissionTransactionFlow::getCommissionAmount).sum(); |
| | | BigDecimal totalIncome = flows.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TCommissionTransactionFlow::getCommissionAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | promotionPageListVo.setTotalIncome(totalIncome); |
| | | |
| | | Integer totalSettledIncome = settlements.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).mapToInt(TIntegralSettlement::getTotalSettlementIntegral).sum(); |
| | |
| | | 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. 校验商品是否存在 |
| | |
| | | flow.setOrderId(orderId); |
| | | flow.setOrderType(orderType); |
| | | flow.setOrderPrice(orderPrice); |
| | | flow.setCommissionAmount(commissionAmount.intValue()); |
| | | flow.setCommissionAmount(commissionAmount); |
| | | flow.setCreateTime(LocalDateTime.now()); |
| | | |
| | | save(flow); |
| | |
| | | |
| | | @ApiModelProperty("推广员收益") |
| | | @Excel(name = "推广员收益", orderNum = "6", width = 20) |
| | | private Integer saleProfit=0; |
| | | private BigDecimal saleProfit=BigDecimal.ZERO; |
| | | |
| | | @ApiModelProperty("合伙人收益") |
| | | @Excel(name = "合伙人收益", orderNum = "7", width = 20) |
| | | private Integer partnerProfit=0; |
| | | private BigDecimal partnerProfit=BigDecimal.ZERO; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "合计收益") |
| | | @Excel(name = "合计收益", width = 20) |
| | | private Integer totalIncome; |
| | | private BigDecimal totalIncome; |
| | | |
| | | @ApiModelProperty(value = "已结算收益") |
| | | @Excel(name = "已结算收益", width = 20) |
| New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel("收益明细Vo") |
| | | public class UserProfitPageListVo { |
| | | |
| | | @ApiModelProperty("订单id") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("订单编号") |
| | | @Excel(name = "订单编号", orderNum = "1", width = 20) |
| | | private String code; |
| | | |
| | | @ApiModelProperty("下单时间") |
| | | @Excel(name = "下单时间", orderNum = "2", width = 20,format = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("下单用户") |
| | | @Excel(name = "下单用户", orderNum = "3", width = 20) |
| | | private String userName; |
| | | |
| | | @ApiModelProperty("用户手机号") |
| | | @Excel(name = "用户手机号", orderNum = "4", width = 20) |
| | | private String phone; |
| | | |
| | | @ApiModelProperty("订单价格") |
| | | @Excel(name = "订单价格", orderNum = "5", width = 20) |
| | | private BigDecimal orderPrice; |
| | | |
| | | @ApiModelProperty("本人收益金额") |
| | | @Excel(name = "本人收益金额", orderNum = "6", width = 20) |
| | | private BigDecimal selfProfit=BigDecimal.ZERO; |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | |
| | | @Data |
| | | @ApiModel(value = "用户推广记录列表Vo") |
| | | public class UserPromotionPageListVo { |
| | | @ApiModelProperty(value = "头像") |
| | | @Excel(name = "头像", width = 20, imageType = 1, type = 2) |
| | | private String avatar; |
| | | |
| | | @ApiModelProperty(value = "用户名") |
| | | @Excel(name = "用户名", width = 20) |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "用户ID") |
| | | private Integer userId; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | @Excel(name = "联系电话", width = 20) |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "性别 1=男,2=女") |
| | | @Excel(name = "性别",width = 20,replace ={ "男_1","女_2"}) |
| | | private Integer gender; |
| | | |
| | | |
| | | @ApiModelProperty(value = "当前角色 1=游客,2=营销员,3=合伙人") |
| | | @Excel(name = "当前角色", width = 20, replace = {"游客_1", "营销员_2", "合伙人_3"}) |
| | | private Integer roleName; |
| | | |
| | | @ApiModelProperty(value = "状态 1=正常,2=冻结") |
| | | @Excel(name = "状态", width = 20, replace = {"使用中_1", "冻结_2"}) |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "合计消费") |
| | | @Excel(name = "合计消费", width = 20) |
| | | private BigDecimal totalConsume; |
| | | |
| | | @ApiModelProperty(value = "合计收益") |
| | | @Excel(name = "合计收益", width = 20) |
| | | private BigDecimal totalIncome; |
| | | |
| | | @ApiModelProperty(value = "已结算收益") |
| | | @Excel(name = "已结算收益", width = 20) |
| | | private Integer totalSettledIncome; |
| | | } |
| | |
| | | order by t1.create_time desc |
| | | </select> |
| | | |
| | | <select id="userPromotionPageList" resultType="com.ruoyi.system.vo.UserPromotionPageListVo"> |
| | | select t1.id userId,t1.name userName,t1.phone phone,t1.gender,t1.profile_photo avatar,t1.user_type roleName,t1.status status |
| | | from t_app_user t1 |
| | | where t1.referrer_user_id = #{query.userId} and t1.status !=3 and t1.referrer_status =2 |
| | | <if test="query.userName != null and query.userName != ''"> |
| | | and t1.name like concat('%',#{query.userName},'%') |
| | | </if> |
| | | <if test="query.phone != null and query.phone != ''"> |
| | | and t1.phone like concat('%',#{query.phone},'%') |
| | | </if> |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="userPromotionPageListExport" resultType="com.ruoyi.system.vo.UserPromotionPageListVo"> |
| | | select t1.id userId,t1.name userName,t1.phone phone,t1.gender,t1.profile_photo avatar,t1.user_type roleName,t1.status status |
| | | from t_app_user t1 |
| | | where t1.referrer_user_id = #{query.userId} and t1.status !=3 and t1.referrer_status =2 |
| | | <if test="query.userName != null and query.userName != ''"> |
| | | and t1.name like concat('%',#{query.userName},'%') |
| | | </if> |
| | | <if test="query.phone != null and query.phone != ''"> |
| | | and t1.phone like concat('%',#{query.phone},'%') |
| | | </if> |
| | | order by t1.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | WHERE t1.del_flag = 0 and t2.id = #{query.userId} |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="profitUserPageList" resultType="com.ruoyi.system.vo.UserProfitPageListVo"> |
| | | select t1.id,t1.code,t1.create_time,t2.name userName,t2.phone,t1.order_price |
| | | from t_big_gift_package_order t1 left join t_app_user t2 on t1.app_user_id = t2.id |
| | | where t1.del_flag = 0 and t2.referrer_user_id = #{query.userId} and t2.referrer_status =2 |
| | | <if test="query.phone != null and query.phone != ''"> |
| | | AND t2.phone = #{query.phone} |
| | | </if> |
| | | <if test="query.code != null and query.code != ''"> |
| | | AND t1.code = #{query.code} |
| | | </if> |
| | | <if test="query.userName != null and query.userName != ''"> |
| | | AND t2.name like concat('%',#{query.userName},'%') |
| | | </if> |
| | | <if test="sTime !=null "> |
| | | AND t1.create_time BETWEEN #{sTime} AND #{eTime} |
| | | </if> |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="profitUserPageListExport" resultType="com.ruoyi.system.vo.UserProfitPageListVo"> |
| | | select t1.id,t1.code,t1.create_time,t2.name userName,t2.phone,t1.order_price |
| | | from t_big_gift_package_order t1 left join t_app_user t2 on t1.app_user_id = t2.id |
| | | where t1.del_flag = 0 and t2.referrer_user_id = #{query.userId} and t2.referrer_status =2 |
| | | <if test="query.phone != null and query.phone != ''"> |
| | | AND t2.phone = #{query.phone} |
| | | </if> |
| | | <if test="query.code != null and query.code != ''"> |
| | | AND t1.code = #{query.code} |
| | | </if> |
| | | <if test="query.userName != null and query.userName != ''"> |
| | | AND t2.name like concat('%',#{query.userName},'%') |
| | | </if> |
| | | <if test="sTime !=null "> |
| | | AND t1.create_time BETWEEN #{sTime} AND #{eTime} |
| | | </if> |
| | | order by t1.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |