Commit bc56cd32 authored by libin's avatar libin

佣金明细

parent d282512b
...@@ -12,10 +12,10 @@ import java.util.List; ...@@ -12,10 +12,10 @@ import java.util.List;
* @data 2019/7/12 11:02 * @data 2019/7/12 11:02
*/ */
@Data @Data
public class SellingWaterPagVo { public class SellingWalletPagVo {
private BigDecimal totalIncome; private BigDecimal totalIncome;
private List<SellingWaterVo> sellingWaters; private List<SellingWalletVo> sellingWaters;
private Integer pageNum; private Integer pageNum;
......
...@@ -12,7 +12,7 @@ import java.math.BigDecimal; ...@@ -12,7 +12,7 @@ import java.math.BigDecimal;
* @data 2019/7/12 11:02 * @data 2019/7/12 11:02
*/ */
@Data @Data
public class SellingWaterVo { public class SellingWalletVo {
/** /**
* 用户名 * 用户名
...@@ -49,6 +49,8 @@ public class SellingWaterVo { ...@@ -49,6 +49,8 @@ public class SellingWaterVo {
private Long updTime; private Long updTime;
private Integer waiting; private Integer waiting;
private Integer status;
/** /**
* 所获佣金 * 所获佣金
*/ */
......
...@@ -6,8 +6,8 @@ import com.github.wxiaoqi.security.admin.dto.OrderWaterDTO; ...@@ -6,8 +6,8 @@ import com.github.wxiaoqi.security.admin.dto.OrderWaterDTO;
import com.github.wxiaoqi.security.admin.entity.*; import com.github.wxiaoqi.security.admin.entity.*;
import com.github.wxiaoqi.security.admin.entity.AppUserRelation; import com.github.wxiaoqi.security.admin.entity.AppUserRelation;
import com.github.wxiaoqi.security.admin.vo.AppUserVo; import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.admin.vo.SellingWaterPagVo; import com.github.wxiaoqi.security.admin.vo.SellingWalletVo;
import com.github.wxiaoqi.security.admin.vo.SellingWaterVo; import com.github.wxiaoqi.security.admin.vo.SellingWalletPagVo;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -20,10 +20,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -20,10 +20,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -236,9 +233,9 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper,Ap ...@@ -236,9 +233,9 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper,Ap
return memberIdAndIncomeMap; return memberIdAndIncomeMap;
} }
public SellingWaterPagVo findSellingWaterPageByWaiting(Integer waiting,Integer userId,Integer pageNo,Integer pageSize){ public SellingWalletPagVo findSellingWaterPageByWaiting(Integer waiting, Integer userId, Integer pageNo, Integer pageSize){
SellingWaterPagVo sellingWaterPagVo = new SellingWaterPagVo(); SellingWalletPagVo sellingWalletPagVo = new SellingWalletPagVo();
Example example = new Example(AppUserSellingWater.class); Example example = new Example(AppUserSellingWater.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
if (waiting!=null){ if (waiting!=null){
...@@ -248,7 +245,13 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper,Ap ...@@ -248,7 +245,13 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper,Ap
PageDataVO<AppUserSellingWater> appUserSellingWaterPageDataVO = PageDataVO.pageInfo(pageNo,pageSize,()->mapper.selectByExample(example)); PageDataVO<AppUserSellingWater> appUserSellingWaterPageDataVO = PageDataVO.pageInfo(pageNo,pageSize,()->mapper.selectByExample(example));
List<AppUserSellingWater> appUserSellingWaters = appUserSellingWaterPageDataVO.getData(); List<AppUserSellingWater> appUserSellingWaters = appUserSellingWaterPageDataVO.getData();
if (CollectionUtils.isEmpty(appUserSellingWaters)){ if (CollectionUtils.isEmpty(appUserSellingWaters)){
return sellingWaterPagVo; sellingWalletPagVo.setPageNum(pageNo);
sellingWalletPagVo.setPageSize(pageSize);
sellingWalletPagVo.setTotalCount(0);
sellingWalletPagVo.setTotalPage(0);
sellingWalletPagVo.setTotalIncome(new BigDecimal(0));
sellingWalletPagVo.setSellingWaters(Collections.EMPTY_LIST);
return sellingWalletPagVo;
} }
List<Integer> memberIds = appUserSellingWaters.stream().map(AppUserSellingWater::getSourceId).collect(Collectors.toList()); List<Integer> memberIds = appUserSellingWaters.stream().map(AppUserSellingWater::getSourceId).collect(Collectors.toList());
...@@ -256,11 +259,11 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper,Ap ...@@ -256,11 +259,11 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper,Ap
Map<Integer,AppUserLogin> userIdAndAppUserLoginMap = appUserLoginBiz.findUserIdAndUserLoginMapByMemberIds(memberIds); Map<Integer,AppUserLogin> userIdAndAppUserLoginMap = appUserLoginBiz.findUserIdAndUserLoginMapByMemberIds(memberIds);
Map<Integer, AppUserDetail> userIdAndAppUserDetailMap = appUserDetailBiz.findUserIdAndUserDetailMapByMemberIds(memberIds); Map<Integer, AppUserDetail> userIdAndAppUserDetailMap = appUserDetailBiz.findUserIdAndUserDetailMapByMemberIds(memberIds);
List<SellingWaterVo> sellingWaterVos = new ArrayList<>(); List<SellingWalletVo> sellingWaterVos = new ArrayList<>();
SellingWaterVo sellingWaterVo; SellingWalletVo sellingWaterVo;
BigDecimal totalIncome = new BigDecimal(0); BigDecimal totalIncome = new BigDecimal(0);
for (AppUserSellingWater appUserSellingWater : appUserSellingWaters) { for (AppUserSellingWater appUserSellingWater : appUserSellingWaters) {
sellingWaterVo = new SellingWaterVo(); sellingWaterVo = new SellingWalletVo();
BeanUtils.copyProperties(appUserSellingWater,sellingWaterVo); BeanUtils.copyProperties(appUserSellingWater,sellingWaterVo);
sellingWaterVo.setUsername(userIdAndAppUserLoginMap.get(appUserSellingWater.getSourceId()).getUsername()); sellingWaterVo.setUsername(userIdAndAppUserLoginMap.get(appUserSellingWater.getSourceId()).getUsername());
...@@ -279,13 +282,13 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper,Ap ...@@ -279,13 +282,13 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper,Ap
totalIncome = total.subtract(refund); totalIncome = total.subtract(refund);
} }
sellingWaterPagVo.setPageNum(pageNo); sellingWalletPagVo.setPageNum(pageNo);
sellingWaterPagVo.setPageSize(pageSize); sellingWalletPagVo.setPageSize(pageSize);
sellingWaterPagVo.setTotalCount(appUserSellingWaterPageDataVO.getTotalCount().intValue()); sellingWalletPagVo.setTotalCount(appUserSellingWaterPageDataVO.getTotalCount().intValue());
sellingWaterPagVo.setTotalPage(appUserSellingWaterPageDataVO.getTotalPage()); sellingWalletPagVo.setTotalPage(appUserSellingWaterPageDataVO.getTotalPage());
sellingWaterPagVo.setTotalIncome(totalIncome); sellingWalletPagVo.setTotalIncome(totalIncome);
sellingWaterPagVo.setSellingWaters(sellingWaterVos); sellingWalletPagVo.setSellingWaters(sellingWaterVos);
return sellingWaterPagVo; return sellingWalletPagVo;
} }
} }
\ No newline at end of file
package com.github.wxiaoqi.security.admin.rest; package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.AppUserSellingWaterBiz; import com.github.wxiaoqi.security.admin.biz.AppUserSellingWaterBiz;
import com.github.wxiaoqi.security.admin.vo.SellingWaterPagVo; import com.github.wxiaoqi.security.admin.vo.SellingWalletPagVo;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig; import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil; import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil;
import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo; import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo;
...@@ -35,14 +35,14 @@ public class UserSellingWaterController { ...@@ -35,14 +35,14 @@ public class UserSellingWaterController {
private UserAuthConfig userAuthConfig; private UserAuthConfig userAuthConfig;
@GetMapping("/page") @GetMapping("/page")
public ObjectRestResponse<SellingWaterPagVo> findSellingWaterPage(@RequestParam(required = false,value = "type") Integer wating, public ObjectRestResponse<SellingWalletPagVo> findSellingWaterPage(@RequestParam(required = false,value = "type") Integer wating,
@RequestParam("pageNo") Integer pageNo, @RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize, @RequestParam("pageSize") Integer pageSize,
HttpServletRequest request) { HttpServletRequest request) {
try { try {
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)); IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
SellingWaterPagVo sellingWaterPagVo = appUserSellingWaterBiz.findSellingWaterPageByWaiting(wating, Integer.valueOf(infoFromToken.getId()), pageNo, pageSize); SellingWalletPagVo sellingWalletPagVo = appUserSellingWaterBiz.findSellingWaterPageByWaiting(wating, Integer.valueOf(infoFromToken.getId()), pageNo, pageSize);
return ObjectRestResponse.succ(sellingWaterPagVo); return ObjectRestResponse.succ(sellingWalletPagVo);
} catch (Exception e) { } catch (Exception e) {
throw new BaseException(e); throw new BaseException(e);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment