Commit 7adb9148 authored by libin's avatar libin

Merge branch 'master-walletdetail'

parents ee8a11f8 0cbaea6c
package com.github.wxiaoqi.security.admin.constant;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/12 14:27
*/
public enum WalletDetailTypeEnum {
/**
* 活动
*/
ACTIVITY(0, "活动奖励金"),
/**
* 佣金
*/
COMMISSION(1, "佣金"),
/**
* 会员充值
*/
MEMBER(2, "会员充值"),
/**
* 提现
*/
WITHDRAW(10, "提现"),
/**
* 转账
*/
TRANSFER(11, "转账"),
/**
* 购买
*/
BUY(12, "购买"),
/**
* 手续费
*/
SERVICE_CHARGE(13, "手续费");
private Integer code;
private String desc;
WalletDetailTypeEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
......@@ -47,4 +47,7 @@ public class WalletDetailPageVo {
@ApiModelProperty(value = "操作时间", hidden = true )
private Long crtTime;
@ApiModelProperty("描述")
private String desc;
}
package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.constant.WalletDetailTypeEnum;
import com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO;
import com.github.wxiaoqi.security.admin.dto.WalletDetailFindDTO;
import com.github.wxiaoqi.security.admin.dto.WalletDetailListDTO;
......@@ -12,17 +13,15 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import lombok.Data;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -35,7 +34,9 @@ import java.util.stream.Collectors;
@Transactional
@Service
@Data
public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDetail> {
public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDetail> implements InitializingBean {
private Map<Integer,WalletDetailTypeEnum> typeEnumMap;
public PageDataVO<WalletDetailPageVo> findWalletDetailPage(Integer userId,Integer pageNo,Integer pageSize){
......@@ -56,6 +57,7 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet
for (MyWalletDetail walletDetailPage : walletDetails) {
walletDetail = new WalletDetailPageVo();
BeanUtils.copyProperties(walletDetailPage,walletDetail);
walletDetail.setDesc(typeEnumMap.get(walletDetail.getSource()).getDesc());
walletDetailPageVoList.add(walletDetail);
}
walletDetailPageVo.setTotalPage(walletDetailPageVoPageDataVO.getTotalPage());
......@@ -101,4 +103,9 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet
Map<Integer, BigDecimal> userIdAndPersonalConsumptionMap = personalConsumptions.stream().collect(Collectors.toMap(PersonalConsumptionDTO::getUserId, PersonalConsumptionDTO::getTotalConsumption));
return userIdAndPersonalConsumptionMap;
}
@Override
public void afterPropertiesSet() throws Exception {
typeEnumMap = EnumSet.allOf(WalletDetailTypeEnum.class).stream().collect(Collectors.toMap(WalletDetailTypeEnum::getCode, Function.identity()));
}
}
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