Commit 107a0557 authored by libin's avatar libin

后台*钱包

parent f1eccdb8
package com.github.wxiaoqi.security.admin.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/17 16:29
*/
@Data
public class UserPostionDTO {
private Integer id;
@ApiModelProperty("提成比例")
private Integer extract;
}
package com.github.wxiaoqi.security.admin.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/17 20:30
*/
@Data
public class WalletCathFindDTO extends PageParam {
private String userName;
private String phone;
/**
* 转账状态
*/
private Integer state;
}
package com.github.wxiaoqi.security.admin.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/17 20:40
*/
@Data
public class WalletCathListDTO {
private Long id;
private String username;
private String nickname;
private String realname;
private String phone;
@ApiModelProperty(value = "提现类别,第三方提现类别(0-微信,1-支付宝,2-银行卡)")
private Integer cathType;
@ApiModelProperty(value = "提现金额")
private BigDecimal amount;
@ApiModelProperty(value = "订单状态:0-未提现,待审核,1-已审核")
private Integer stauts;
@ApiModelProperty(value = "提现日期", hidden = true )
private Long crtTime;
@ApiModelProperty(value = "审核日期")
private Long finishTime;
}
package com.github.wxiaoqi.security.admin.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/18 9:50
*/
@Data
public class WalletDetailListDTO {
private Integer id;
private String username;
private String nickname;
private String realname;
private String phone;
@ApiModelProperty(value = "来源:0-活动,1-佣金,2-会员充值,10-提现,11-转账,12-购买")
private Integer sourceType;
@ApiModelProperty("活动名称或佣金商品名称")
private String source;
@ApiModelProperty(value = "收入/支出:0-收入,1-支出")
private Integer itype;
@ApiModelProperty(value = "收入/支出的金额(分)")
private BigDecimal amount;
@ApiModelProperty(value = "活动类型")
private Integer type;
@ApiModelProperty(value = "活动id")
private Integer activityId;
@ApiModelProperty("活动名称")
private String activityName;
@ApiModelProperty(value = "单号")
private Integer cono;
@ApiModelProperty(value = "加上当时的收入的余额")
private BigDecimal balance;
@ApiModelProperty(value = "操作时间", hidden = true )
private Long crtTime;
}
package com.github.wxiaoqi.security.admin.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/17 14:31
*/
@Data
public class WalletFindDTO extends PageParam {
private String phone;
private String username;
}
package com.github.wxiaoqi.security.admin.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/17 15:21
*/
@Data
public class WalletListDTO {
private Integer id;
@ApiModelProperty("用户ID")
private Integer userId;
private String username;
private String nickname;
private String realname;
@ApiModelProperty(value = "余额(元)")
private BigDecimal balance;
@ApiModelProperty(value = "已提现金额")
private BigDecimal withdrawals;
@ApiModelProperty(value = "进账总额(元)")
private BigDecimal totalAmount;
@ApiModelProperty(value = "进账总额(元)")
private BigDecimal todayAmount;
@ApiModelProperty(value = "未入账金额")
private BigDecimal unbooked;
@ApiModelProperty(value = "是否冻结:0-正常,1-冻结")
private Integer isFrozen;
}
...@@ -69,6 +69,12 @@ public class MyWalletDetail implements Serializable { ...@@ -69,6 +69,12 @@ public class MyWalletDetail implements Serializable {
@Column(name = "activity_id") @Column(name = "activity_id")
@ApiModelProperty(value = "活动id") @ApiModelProperty(value = "活动id")
private Integer activityId; private Integer activityId;
/**
* 活动名称
*/
@Column(name = "activity_name")
private String activityName;
/** /**
* 单号 * 单号
......
package com.github.wxiaoqi.security.admin.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/17 20:22
*/
@Data
public class WalletCathAdminVo {
private Long id;
private String username;
private String phone;
@ApiModelProperty(value = "提现类别,第三方提现类别(0-微信,1-支付宝,2-银行卡)")
private Integer cathType;
@ApiModelProperty(value = "提现金额")
private BigDecimal amount;
@ApiModelProperty(value = "订单状态:0-未提现,待审核,1-已审核")
private Integer stauts;
@ApiModelProperty(value = "提现日期", hidden = true )
private Long crtTime;
@ApiModelProperty(value = "审核日期")
private Long finishTime;
}
...@@ -14,15 +14,16 @@ import java.math.BigDecimal; ...@@ -14,15 +14,16 @@ import java.math.BigDecimal;
@Data @Data
public class WalletPageVo { public class WalletPageVo {
@ApiModelProperty(value = "id")
private Integer id; private Integer id;
@ApiModelProperty("用户ID") @ApiModelProperty("用户ID")
private Integer userId; private Integer userId;
@ApiModelProperty(value = "余额(元)") private String username;
private String phone;
@ApiModelProperty(value = "余额(元)")
private BigDecimal balance; private BigDecimal balance;
......
package com.github.wxiaoqi.security.admin.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/17 16:17
*/
@Data
public class WalletPostionVo {
@ApiModelProperty("主键id")
private Integer id;
@ApiModelProperty(value = "角色名称")
private String name;
@ApiModelProperty(value = "等级")
private Integer level;
@ApiModelProperty(value = "每年赠送的天数")
private Integer number;
@ApiModelProperty(value = "提成比例")
private Integer extract;
}
package com.github.wxiaoqi.security.admin.biz; package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.dto.UserPostionDTO;
import com.github.wxiaoqi.security.admin.vo.WalletPostionVo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.github.wxiaoqi.security.admin.entity.AppUserPosition; import com.github.wxiaoqi.security.admin.entity.AppUserPosition;
import com.github.wxiaoqi.security.admin.mapper.AppUserPositionMapper; import com.github.wxiaoqi.security.admin.mapper.AppUserPositionMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* 用户身份职位表 * 用户身份职位表
...@@ -13,6 +22,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -13,6 +22,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
* @email 18178966185@163.com * @email 18178966185@163.com
* @date 2019-07-09 10:00:42 * @date 2019-07-09 10:00:42
*/ */
@Transactional
@Service @Service
public class AppUserPositionBiz extends BaseBiz<AppUserPositionMapper,AppUserPosition> { public class AppUserPositionBiz extends BaseBiz<AppUserPositionMapper,AppUserPosition> {
...@@ -21,4 +31,31 @@ public class AppUserPositionBiz extends BaseBiz<AppUserPositionMapper,AppUserPos ...@@ -21,4 +31,31 @@ public class AppUserPositionBiz extends BaseBiz<AppUserPositionMapper,AppUserPos
public Integer getExtract(Integer userId){ public Integer getExtract(Integer userId){
return mapper.getExtractByUserId(userId); return mapper.getExtractByUserId(userId);
} }
public List<WalletPostionVo> findAllPostions() {
List<WalletPostionVo> walletPostionVos = new ArrayList<>();
List<AppUserPosition> appUserPositions = mapper.selectAll();
if (CollectionUtils.isEmpty(appUserPositions)){
return walletPostionVos;
}
WalletPostionVo walletPostionVo;
for (AppUserPosition appUserPosition : appUserPositions) {
walletPostionVo = new WalletPostionVo();
BeanUtils.copyProperties(appUserPosition,walletPostionVo);
walletPostionVos.add(walletPostionVo);
}
return walletPostionVos;
}
public int updateUserPostionPercentage(List<UserPostionDTO> userPostionDTOS) {
AtomicInteger counter = new AtomicInteger(0);
for (UserPostionDTO userPostionDTO : userPostionDTOS) {
AppUserPosition appUserPosition = new AppUserPosition();
appUserPosition.setId(userPostionDTO.getId());
appUserPosition.setExtract(userPostionDTO.getExtract());
mapper.updateByPrimaryKeySelective(appUserPosition);
counter.incrementAndGet();
}
return counter.get();
}
} }
\ No newline at end of file
package com.github.wxiaoqi.security.admin.biz; package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.dto.WalletFindDTO;
import com.github.wxiaoqi.security.admin.dto.WalletListDTO;
import com.github.wxiaoqi.security.admin.entity.MyWallet; import com.github.wxiaoqi.security.admin.entity.MyWallet;
import com.github.wxiaoqi.security.admin.mapper.MyWalletMapper; import com.github.wxiaoqi.security.admin.mapper.MyWalletMapper;
import com.github.wxiaoqi.security.admin.vo.AppletWalletVo; import com.github.wxiaoqi.security.admin.vo.AppletWalletVo;
import com.github.wxiaoqi.security.admin.vo.WalletPageVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
/** /**
...@@ -22,17 +30,44 @@ import java.util.List; ...@@ -22,17 +30,44 @@ import java.util.List;
public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> { public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
public AppletWalletVo findMyWallet(Integer userId){ public AppletWalletVo findMyWallet(Integer userId) {
AppletWalletVo appletWalletVo = new AppletWalletVo(); AppletWalletVo appletWalletVo = new AppletWalletVo();
Example example = new Example(MyWallet.class); Example example = new Example(MyWallet.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userId",userId); criteria.andEqualTo("userId", userId);
List<MyWallet> wallets = mapper.selectByExample(example); List<MyWallet> wallets = mapper.selectByExample(example);
MyWallet myWallet = wallets.get(0); MyWallet myWallet = wallets.get(0);
BeanUtils.copyProperties(myWallet,appletWalletVo); BeanUtils.copyProperties(myWallet, appletWalletVo);
return appletWalletVo; return appletWalletVo;
} }
public PageDataVO<WalletPageVo> listWalletWithPage(WalletFindDTO walletFindDTO) {
PageDataVO<WalletPageVo> walletPageVo = new PageDataVO<>();
PageDataVO<WalletListDTO> walletPage = PageDataVO.pageInfo(walletFindDTO.getPage(), walletFindDTO.getLimit(), () -> mapper.selectByPhoneOrUserName(walletFindDTO.getPhone(), walletFindDTO.getUsername()));
List<WalletListDTO> wallets = walletPage.getData();
if(CollectionUtils.isEmpty(wallets)){
return walletPageVo;
}
List<WalletPageVo> walletPageVos = new ArrayList<>();
WalletPageVo walletpg ;
for (WalletListDTO wallet : wallets) {
walletpg = new WalletPageVo();
BeanUtils.copyProperties(wallet,walletpg);
walletpg.setUsername(StringUtils.isEmpty(wallet.getRealname())?wallet.getNickname():wallet.getRealname());
walletpg.setPhone(wallet.getUsername());
walletPageVos.add(walletpg);
}
walletPageVos.sort(Comparator.comparing(WalletPageVo::getTotalAmount).reversed());
walletPageVo.setPageNum(walletFindDTO.getPage());
walletPageVo.setPageSize(walletFindDTO.getLimit());
walletPageVo.setTotalCount(walletPage.getTotalCount());
walletPageVo.setTotalPage(walletPage.getTotalPage());
walletPageVo.setData(walletPageVos);
return walletPageVo;
}
} }
package com.github.wxiaoqi.security.admin.biz; package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.dto.WalletCathFindDTO;
import com.github.wxiaoqi.security.admin.dto.WalletCathListDTO;
import com.github.wxiaoqi.security.admin.entity.MyWalletCath; import com.github.wxiaoqi.security.admin.entity.MyWalletCath;
import com.github.wxiaoqi.security.admin.mapper.MyWalletCathMapper; import com.github.wxiaoqi.security.admin.mapper.MyWalletCathMapper;
import com.github.wxiaoqi.security.admin.vo.WalletCathAdminVo;
import com.github.wxiaoqi.security.admin.vo.WalletCathDetailVo; import com.github.wxiaoqi.security.admin.vo.WalletCathDetailVo;
import com.github.wxiaoqi.security.admin.vo.WalletCathPageVo; import com.github.wxiaoqi.security.admin.vo.WalletCathPageVo;
import com.github.wxiaoqi.security.admin.vo.WalletCathVo; import com.github.wxiaoqi.security.admin.vo.WalletCathVo;
...@@ -11,13 +14,11 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -11,13 +14,11 @@ import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
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.Collections;
import java.util.List;
import java.util.Optional;
/** /**
* @author libin * @author libin
...@@ -29,24 +30,24 @@ import java.util.Optional; ...@@ -29,24 +30,24 @@ import java.util.Optional;
@Service @Service
public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> { public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
public WalletCathPageVo findWatchCatchByWithdrawalState(Integer userId,Integer state, Integer pageNo, Integer pageSize){ public WalletCathPageVo findWatchCatchByWithdrawalState(Integer userId, Integer state, Integer pageNo, Integer pageSize) {
WalletCathPageVo walletCathPageVo = new WalletCathPageVo(); WalletCathPageVo walletCathPageVo = new WalletCathPageVo();
Example example = new Example(MyWalletCath.class); Example example = new Example(MyWalletCath.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("stauts",state); criteria.andEqualTo("stauts", state);
criteria.andEqualTo("userId",userId); criteria.andEqualTo("userId", userId);
PageDataVO<MyWalletCath> walletCathPage = PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.selectByExample(example)); PageDataVO<MyWalletCath> walletCathPage = PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.selectByExample(example));
List<MyWalletCath> walletCaths = walletCathPage.getData(); List<MyWalletCath> walletCaths = walletCathPage.getData();
if (CollectionUtils.isEmpty(walletCaths)){ if (CollectionUtils.isEmpty(walletCaths)) {
walletCathPageVo.setPageNum(pageNo); walletCathPageVo.setPageNum(pageNo);
walletCathPageVo.setPageSize(pageSize); walletCathPageVo.setPageSize(pageSize);
walletCathPageVo.setTotalCount(0); walletCathPageVo.setTotalCount(0);
walletCathPageVo.setTotalPage(0); walletCathPageVo.setTotalPage(0);
walletCathPageVo.setWalletCaths(Collections.EMPTY_LIST); walletCathPageVo.setWalletCaths(Collections.EMPTY_LIST);
return walletCathPageVo; return walletCathPageVo;
} }
WalletCathVo walletCathVo = null; WalletCathVo walletCathVo = null;
...@@ -54,7 +55,7 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> { ...@@ -54,7 +55,7 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
List<WalletCathVo> walletCatchPageVos = new ArrayList<>(); List<WalletCathVo> walletCatchPageVos = new ArrayList<>();
for (MyWalletCath walletCath : walletCaths) { for (MyWalletCath walletCath : walletCaths) {
walletCathVo = new WalletCathVo(); walletCathVo = new WalletCathVo();
BeanUtils.copyProperties(walletCath,walletCathVo); BeanUtils.copyProperties(walletCath, walletCathVo);
totalWithdraw = totalWithdraw.add(walletCathVo.getAmount()); totalWithdraw = totalWithdraw.add(walletCathVo.getAmount());
walletCatchPageVos.add(walletCathVo); walletCatchPageVos.add(walletCathVo);
} }
...@@ -72,9 +73,42 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> { ...@@ -72,9 +73,42 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
MyWalletCath myWalletCath = new MyWalletCath(); MyWalletCath myWalletCath = new MyWalletCath();
myWalletCath.setId(id); myWalletCath.setId(id);
MyWalletCath walletCath = mapper.selectByPrimaryKey(myWalletCath); MyWalletCath walletCath = mapper.selectByPrimaryKey(myWalletCath);
Optional.ofNullable(walletCath).ifPresent(wc->{ Optional.ofNullable(walletCath).ifPresent(wc -> {
BeanUtils.copyProperties(wc,walletCathDetailVo); BeanUtils.copyProperties(wc, walletCathDetailVo);
}); });
return walletCathDetailVo; return walletCathDetailVo;
} }
public PageDataVO<WalletCathAdminVo> listWalletCathWithPage(WalletCathFindDTO walletCathFindDTO) {
PageDataVO<WalletCathAdminVo> walletCathAdminVoPage = new PageDataVO<>();
// List<WalletCathListDTO> walletCathListDTOS = mapper.selectByUserNameOrPhoneOrWithDrawSate(walletCathFindDTO.getUserName(), walletCathFindDTO.getPhone(), walletCathFindDTO.getState());
PageDataVO<WalletCathListDTO> walletCathListDTOPage = PageDataVO.pageInfo(walletCathFindDTO.getPage(),
walletCathFindDTO.getLimit(),
() -> mapper.selectByUserNameOrPhoneOrWithDrawSate(walletCathFindDTO.getUserName(), walletCathFindDTO.getPhone(), walletCathFindDTO.getState()));
List<WalletCathListDTO> walletCathListDTOList = walletCathListDTOPage.getData();
if (CollectionUtils.isEmpty(walletCathListDTOList)){
return walletCathAdminVoPage;
}
List<WalletCathAdminVo> walletCathAdminVos = new ArrayList<>();
WalletCathAdminVo walletCathAdminVo ;
for (WalletCathListDTO walletCathListDTO : walletCathListDTOList) {
walletCathAdminVo = new WalletCathAdminVo();
BeanUtils.copyProperties(walletCathListDTO,walletCathAdminVo);
walletCathAdminVo.setUsername(StringUtils.isEmpty(walletCathListDTO.getRealname())?walletCathListDTO.getNickname():walletCathListDTO.getRealname());
walletCathAdminVo.setPhone(walletCathListDTO.getUsername());
walletCathAdminVos.add(walletCathAdminVo);
}
walletCathAdminVos.sort(Comparator.comparing(WalletCathAdminVo::getCrtTime).reversed());
walletCathAdminVoPage.setTotalPage(walletCathListDTOPage.getTotalPage());
walletCathAdminVoPage.setTotalCount(walletCathListDTOPage.getTotalCount());
walletCathAdminVoPage.setPageNum(walletCathFindDTO.getPage());
walletCathAdminVoPage.setPageSize(walletCathFindDTO.getLimit());
walletCathAdminVoPage.setData(walletCathAdminVos);
return walletCathAdminVoPage;
}
} }
package com.github.wxiaoqi.security.admin.mapper; package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.dto.UserPostionDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserPosition; import com.github.wxiaoqi.security.admin.entity.AppUserPosition;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/** /**
* 用户身份职位表 * 用户身份职位表
* *
...@@ -15,5 +18,5 @@ public interface AppUserPositionMapper extends Mapper<AppUserPosition> { ...@@ -15,5 +18,5 @@ public interface AppUserPositionMapper extends Mapper<AppUserPosition> {
Integer getExtractByUserId(@Param("userId")Integer userId); Integer getExtractByUserId(@Param("userId")Integer userId);
} }
package com.github.wxiaoqi.security.admin.mapper; package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.dto.WalletCathListDTO;
import com.github.wxiaoqi.security.admin.entity.MyWalletCath; import com.github.wxiaoqi.security.admin.entity.MyWalletCath;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/** /**
* 钱包提现表 * 钱包提现表
* *
...@@ -11,5 +15,8 @@ import tk.mybatis.mapper.common.Mapper; ...@@ -11,5 +15,8 @@ import tk.mybatis.mapper.common.Mapper;
* @date 2019-07-11 14:14:54 * @date 2019-07-11 14:14:54
*/ */
public interface MyWalletCathMapper extends Mapper<MyWalletCath> { public interface MyWalletCathMapper extends Mapper<MyWalletCath> {
List<WalletCathListDTO> selectByUserNameOrPhoneOrWithDrawSate(@Param("userName") String userName,
@Param("phone") String phone,
@Param("state") Integer state);
} }
package com.github.wxiaoqi.security.admin.mapper; package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.dto.WalletListDTO;
import com.github.wxiaoqi.security.admin.entity.MyWallet; import com.github.wxiaoqi.security.admin.entity.MyWallet;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/** /**
* 我的钱包 * 我的钱包
* *
...@@ -12,8 +16,7 @@ import tk.mybatis.mapper.common.Mapper; ...@@ -12,8 +16,7 @@ import tk.mybatis.mapper.common.Mapper;
*/ */
public interface MyWalletMapper extends Mapper<MyWallet> { public interface MyWalletMapper extends Mapper<MyWallet> {
void updMyWater(MyWallet myWallet);
List<WalletListDTO> selectByPhoneOrUserName(@Param("phone") String phone, @Param("username") String username);
public void updMyWater(MyWallet myWallet);
} }
package com.github.wxiaoqi.security.admin.rest.admin;
import com.github.wxiaoqi.security.admin.biz.AppUserPositionBiz;
import com.github.wxiaoqi.security.admin.dto.UserPostionDTO;
import com.github.wxiaoqi.security.admin.vo.WalletPostionVo;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/17 16:13
*/
@RestController
@RequestMapping("/postion/admin")
public class AppUserPositionController {
@Autowired
private AppUserPositionBiz appUserPositionBiz;
@GetMapping("/postions")
public ObjectRestResponse<List<WalletPostionVo>> findAllPostions(){
List<WalletPostionVo> walletPostionVos = appUserPositionBiz.findAllPostions();
return ObjectRestResponse.succ(walletPostionVos);
}
@PutMapping
public ObjectRestResponse updateUserPostionPercentage(@RequestBody List<UserPostionDTO> userPostionDTOS){
appUserPositionBiz.updateUserPostionPercentage(userPostionDTOS);
return ObjectRestResponse.succ();
}
}
package com.github.wxiaoqi.security.admin.rest.admin; package com.github.wxiaoqi.security.admin.rest.admin;
import com.github.wxiaoqi.security.admin.biz.MyWalletBiz; import com.github.wxiaoqi.security.admin.biz.MyWalletBiz;
import com.github.wxiaoqi.security.admin.dto.WalletFindDTO;
import com.github.wxiaoqi.security.admin.vo.WalletPageVo;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/** /**
...@@ -14,14 +18,16 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -14,14 +18,16 @@ import org.springframework.web.bind.annotation.RestController;
* @data 2019/7/17 14:11 * @data 2019/7/17 14:11
*/ */
@RestController @RestController
@RequestMapping("/wallet/admin")
public class MyWalletAdminController { public class MyWalletAdminController {
@Autowired @Autowired
private MyWalletBiz myWalletBiz; private MyWalletBiz myWalletBiz;
@GetMapping("") @ApiOperation("分页查询用户钱包")
public ObjectRestResponse<PageDataVO> listWalletWithPage(){ @GetMapping("/page")
public ObjectRestResponse<PageDataVO<WalletPageVo>> listWalletWithPage(WalletFindDTO walletFindDTO){
return null; PageDataVO<WalletPageVo> walletPage = myWalletBiz.listWalletWithPage(walletFindDTO);
return ObjectRestResponse.succ(walletPage);
} }
} }
package com.github.wxiaoqi.security.admin.rest.admin;
import com.github.wxiaoqi.security.admin.biz.MyWalletCathBiz;
import com.github.wxiaoqi.security.admin.dto.WalletCathFindDTO;
import com.github.wxiaoqi.security.admin.vo.WalletCathAdminVo;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/17 19:50
*/
@RestController
@RequestMapping("/walletcath/admin")
public class WalletCathAdminController {
@Autowired
private MyWalletCathBiz myWalletCathBiz;
@GetMapping("/page")
public ObjectRestResponse<PageDataVO<WalletCathAdminVo>> listWalletCathWithPage(WalletCathFindDTO walletCathFindDTO){
PageDataVO<WalletCathAdminVo> walletCathAdminVoPage = myWalletCathBiz.listWalletCathWithPage(walletCathFindDTO);
return ObjectRestResponse.succ(walletCathAdminVoPage);
}
}
...@@ -21,5 +21,4 @@ ...@@ -21,5 +21,4 @@
ON d.position_id=p.id ON d.position_id=p.id
WHERE d.userid=#{userId} LIMIT 1 WHERE d.userid=#{userId} LIMIT 1
</select> </select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.github.wxiaoqi.security.admin.mapper.MyWalletCathMapper">
<select id="selectByUserNameOrPhoneOrWithDrawSate" resultType="com.github.wxiaoqi.security.admin.dto.WalletListDTO">
SELECT
wc.id,
aud.nickname,
aud.realname,
aul.username,
wc.amount,
wc.cath_type AS `cathType`,
wc.stauts,
wc.crt_time AS `crtTime`,
wc.finish_time AS `finishTime`
FROM
(SELECT * FROM `my_wallet_cath` <if test="state != null">
WHERE `stauts`=#{state}
</if>) AS `wc`
INNER JOIN ( SELECT `id`, `username` FROM `app_user_login` <if test="phone != null and phone != ''">
WHERE `username`=#{phone}
</if> ) AS `aul` ON aul.id = w.user_id
INNER JOIN ( SELECT `userid`, `nickname`, `realname` FROM `app_user_detail` <if
test="userName != null and userName != ''">
WHERE nickname =#{username} OR realname =#{userName}
</if> ) AS `aud` ON aud.userid = aul.id
</select>
</mapper>
\ No newline at end of file
...@@ -45,4 +45,26 @@ ...@@ -45,4 +45,26 @@
</where> </where>
</update> </update>
<select id="selectByPhoneOrUserName" resultType="com.github.wxiaoqi.security.admin.dto.WalletListDTO">
SELECT
w.id,
w.user_id AS `userId`,
w.balance,
w.withdrawals,
w.total_amount AS `totalAmount`,
w.today_amount AS `todayAmount`,
w.unbooked,
w.is_frozen AS `isFrozen`,
aul.username,
aud.nickname,
aud.realname
FROM
`my_wallet` AS `w`
INNER JOIN ( SELECT `id`, `username` FROM `app_user_login` <if test="phone != null and phone != ''">
WHERE `username`=#{phone}
</if> ) AS `aul` ON aul.id = w.user_id
INNER JOIN ( SELECT `userid`, `nickname`, `realname` FROM `app_user_detail` <if test="username != null and username != ''">
WHERE nickname =#{username} OR realname =#{username}
</if> ) AS `aud` ON aud.userid = aul.id
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -65,4 +65,5 @@ public class Cofig implements Serializable { ...@@ -65,4 +65,5 @@ public class Cofig implements Serializable {
@ApiModelProperty(value = "标题") @ApiModelProperty(value = "标题")
private String title; private String title;
private String params;
} }
package com.xxfc.platform.app.entity.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/17 19:55
*/
@Data
public class WithDrawRuleVo {
/**
* 提现金额
*/
private BigDecimal amount;
/**
* 手续费率
*/
private double proceduReates;
/**
* 规则说明
*/
private String description;
}
...@@ -2,7 +2,9 @@ package com.xxfc.platform.app.feign; ...@@ -2,7 +2,9 @@ package com.xxfc.platform.app.feign;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.app.entity.Cofig; import com.xxfc.platform.app.entity.Cofig;
import com.xxfc.platform.app.entity.vo.WithDrawRuleVo;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
...@@ -10,10 +12,11 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -10,10 +12,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
/** /**
* Created by ace on 2017/9/15. * Created by ace on 2017/9/15.
*/ */
//@FeignClient(value = "${auth.serviceId}",configuration = {})
@FeignClient("xx-app") @FeignClient("xx-app")
public interface ConfigFeign { public interface ConfigFeign {
@RequestMapping(value = "/cofig/app/unauth/types",method = RequestMethod.GET) @RequestMapping(value = "/cofig/app/unauth/types",method = RequestMethod.GET)
public ObjectRestResponse<Cofig> getAllByType(String types); ObjectRestResponse<Cofig> getAllByType(String types);
@GetMapping("/app/unauth/withdraw_rule")
WithDrawRuleVo getWithDrawRule();
} }
package com.xxfc.platform.app.biz; package com.xxfc.platform.app.biz;
import com.alibaba.fastjson.JSON;
import com.github.wxiaoqi.security.common.util.EntityUtils; import com.github.wxiaoqi.security.common.util.EntityUtils;
import com.xxfc.platform.app.entity.vo.WithDrawRuleVo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.xxfc.platform.app.entity.Cofig; import com.xxfc.platform.app.entity.Cofig;
import com.xxfc.platform.app.mapper.CofigMapper; import com.xxfc.platform.app.mapper.CofigMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example;
import java.util.List; import java.util.List;
...@@ -33,4 +37,19 @@ public class CofigBiz extends BaseBiz<CofigMapper,Cofig> { ...@@ -33,4 +37,19 @@ public class CofigBiz extends BaseBiz<CofigMapper,Cofig> {
EntityUtils.setUpdatedInfo(cofig); EntityUtils.setUpdatedInfo(cofig);
return mapper.updateConfig(cofig); return mapper.updateConfig(cofig);
} }
public WithDrawRuleVo getWithDrawRule(){
WithDrawRuleVo withDrawRuleVo = new WithDrawRuleVo();
Example example = new Example(Cofig.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("type",88);
List<Cofig> cofigs = mapper.selectByExample(example);
if (CollectionUtils.isEmpty(cofigs)){
return withDrawRuleVo;
}
Cofig cofig = cofigs.get(0);
withDrawRuleVo = JSON.parseObject(cofig.getParams(),WithDrawRuleVo.class);
withDrawRuleVo.setDescription(cofig.getValue());
return withDrawRuleVo;
}
} }
\ No newline at end of file
...@@ -8,6 +8,7 @@ import com.github.wxiaoqi.security.common.rest.BaseController; ...@@ -8,6 +8,7 @@ import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.app.biz.CofigBiz; import com.xxfc.platform.app.biz.CofigBiz;
import com.xxfc.platform.app.entity.Cofig; import com.xxfc.platform.app.entity.Cofig;
import com.xxfc.platform.app.entity.vo.WithDrawRuleVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -37,4 +38,9 @@ public class CofigController extends BaseController<CofigBiz,Cofig> { ...@@ -37,4 +38,9 @@ public class CofigController extends BaseController<CofigBiz,Cofig> {
} }
return new ObjectRestResponse<>().rel(true).data(baseBiz.getConfigByType(list)); return new ObjectRestResponse<>().rel(true).data(baseBiz.getConfigByType(list));
} }
@GetMapping("/app/unauth/withdraw_rule")
public WithDrawRuleVo getWithDrawRule(){
return baseBiz.getWithDrawRule();
}
} }
\ No newline at end of file
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<result property="crtTime" column="crt_time"/> <result property="crtTime" column="crt_time"/>
<result property="updTime" column="upd_time"/> <result property="updTime" column="upd_time"/>
<result property="isDel" column="is_del"/> <result property="isDel" column="is_del"/>
<result property="params" column="params"/>
</resultMap> </resultMap>
<select id="getAllByType" resultMap="cofigMap"> <select id="getAllByType" resultMap="cofigMap">
......
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