用户列表 新增参数
This commit is contained in:
14
src/main/java/com/sqx/modules/app/dto/UserInviteDTO.java
Normal file
14
src/main/java/com/sqx/modules/app/dto/UserInviteDTO.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.sqx.modules.app.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author GYJoker
|
||||
*/
|
||||
@Data
|
||||
public class UserInviteDTO {
|
||||
private String userId;
|
||||
private BigDecimal inviteAmount;
|
||||
}
|
||||
@@ -188,6 +188,11 @@ public class UserEntity implements Serializable {
|
||||
*/
|
||||
private BigDecimal inviteAmount;
|
||||
|
||||
/**
|
||||
* 累计邀请人数
|
||||
*/
|
||||
private Integer inviteCount;
|
||||
|
||||
/**
|
||||
* 是否是新用户 1否
|
||||
*/
|
||||
@@ -212,6 +217,9 @@ public class UserEntity implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private Integer vipType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer cashCount;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private BigDecimal cashAmount;
|
||||
}
|
||||
|
||||
@@ -60,4 +60,13 @@ public class UserMoney implements Serializable {
|
||||
private BigDecimal inviteIncomeMoney;;
|
||||
private BigDecimal inviteIncomeCoin;
|
||||
|
||||
/**
|
||||
* 累计提现金额
|
||||
*/
|
||||
private BigDecimal cashAmount;
|
||||
/**
|
||||
* 累计提现次数
|
||||
*/
|
||||
private Integer cashCount;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.dto.AuthCertNoDTO;
|
||||
import com.sqx.modules.app.dto.AuthDTO;
|
||||
import com.sqx.modules.app.dto.LoginDTO;
|
||||
import com.sqx.modules.app.dto.RegisterDTO;
|
||||
import com.sqx.modules.app.dto.*;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -234,4 +231,8 @@ public interface UserService extends IService<UserEntity> {
|
||||
UserEntity queryByInvitationCodeOrUserId(Long inviterUserId, String invitationCode);
|
||||
|
||||
Result register(RegisterDTO registerDTO);
|
||||
|
||||
Result updateUserInviteAmount(UserInviteDTO userInviteDTO);
|
||||
|
||||
Result removeUserBlack(Long userId);
|
||||
}
|
||||
|
||||
@@ -1758,4 +1758,41 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
|
||||
return baseMapper.selectOne(new LambdaQueryWrapper<UserEntity>().eq(UserEntity::getUserId, inviterUserId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateUserInviteAmount(UserInviteDTO userInviteDTO) {
|
||||
if (StrUtil.isBlank(userInviteDTO.getUserId())) {
|
||||
return Result.error("用户id不能为空");
|
||||
}
|
||||
|
||||
if (userInviteDTO.getInviteAmount() == null || userInviteDTO.getInviteAmount().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return Result.error("邀请奖励金额必须大于0");
|
||||
}
|
||||
|
||||
UserEntity userEntity = baseMapper.selectById(userInviteDTO.getUserId());
|
||||
if (userEntity == null) {
|
||||
return Result.error("用户不存在");
|
||||
}
|
||||
userEntity.setInviteAmount(userInviteDTO.getInviteAmount());
|
||||
|
||||
baseMapper.update(userEntity, new LambdaUpdateWrapper<UserEntity>().eq(UserEntity::getUserId, userInviteDTO.getUserId()));
|
||||
|
||||
return Result.success("更新成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result removeUserBlack(Long userId) {
|
||||
UserEntity userEntity = getById(userId);
|
||||
if (userEntity == null) {
|
||||
return Result.error("用户不存在");
|
||||
}
|
||||
userEntity.setStatus(1);
|
||||
update(userEntity, new LambdaUpdateWrapper<UserEntity>().eq(UserEntity::getUserId, userId));
|
||||
|
||||
UserInfo userInfo = userInfoService.getOne(new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getUserId, userId));
|
||||
if (userInfo != null && StrUtil.isNotBlank(userInfo.getCertNo())) {
|
||||
tbUserBlacklistMapper.delete(new LambdaQueryWrapper<TbUserBlacklist>().eq(TbUserBlacklist::getIdCardNo, userInfo.getCertNo()));
|
||||
}
|
||||
return Result.success("解除拉黑成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,6 +214,7 @@ public class InviteServiceImpl extends ServiceImpl<InviteDao, Invite> implements
|
||||
user.setUserId(userId);
|
||||
user.setInviterCode(userEntity.getInvitationCode());
|
||||
user.setInviterUserId(userEntity.getUserId());
|
||||
user.setInviteCount((userEntity.getInviteCount() == null ? 0 : userEntity.getInviteCount()) + 1);
|
||||
userService.updateById(user);
|
||||
|
||||
// 金币
|
||||
|
||||
@@ -5,12 +5,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.pay.entity.CashOut;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author fang
|
||||
@@ -52,4 +50,7 @@ public interface CashOutDao extends BaseMapper<CashOut> {
|
||||
List<CashOut> countByUserIdList(Set<Long> userIdList);
|
||||
|
||||
Double queryUserTodayCashOutSum(@Param("userId") Long userId, @Param("time") String time);
|
||||
|
||||
@Select("select count(1) as totalCount, sum(money) as totalAmount from cash_out where user_id=#{userId}")
|
||||
Map<String, Object> getUserCashInfo(@Param("userId") Long userId);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.sqx.modules.pay.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.sqx.modules.app.entity.UserMoney;
|
||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
||||
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
||||
import com.sqx.modules.app.service.UserMoneyService;
|
||||
@@ -85,6 +86,14 @@ public class WuyouCallbackServiceImpl implements WuyouCallbackService {
|
||||
cashOut.setOutAt(DateUtil.now());
|
||||
cashOutDao.update(cashOut, new LambdaQueryWrapper<CashOut>().eq(CashOut::getUserId, cashOut.getUserId()).eq(CashOut::getId, cashOut.getId()));
|
||||
|
||||
UserMoney one = userMoneyService.getOne(new LambdaQueryWrapper<UserMoney>().eq(UserMoney::getUserId, cashOut.getUserId()));
|
||||
if (one != null) {
|
||||
one.setCashCount(one.getCashCount() + 1);
|
||||
one.setCashAmount((one.getCashAmount() == null ? BigDecimal.ZERO : one.getCashAmount().add(money)));
|
||||
|
||||
userMoneyService.update(one, new LambdaQueryWrapper<UserMoney>().eq(UserMoney::getUserId, cashOut.getUserId()));
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user