大R用户-后台
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package com.accompany.admin.vo.recharge;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel
|
||||
public class HighRechargeUserAdminVo {
|
||||
|
||||
private Long uid;
|
||||
|
||||
@ApiModelProperty("类型")
|
||||
private Byte type;
|
||||
|
||||
@ApiModelProperty("ID")
|
||||
private Long erbanNo;
|
||||
|
||||
@ApiModelProperty("昵称")
|
||||
private String nick;
|
||||
|
||||
private Integer partitionId;
|
||||
|
||||
@ApiModelProperty("分区")
|
||||
private String partitionDesc;
|
||||
|
||||
private Integer regionId;
|
||||
@ApiModelProperty("国家")
|
||||
private String regionDesc;
|
||||
|
||||
@ApiModelProperty("总充值金币数")
|
||||
private BigDecimal totalGold = BigDecimal.ZERO;
|
||||
|
||||
@ApiModelProperty("充值金币数")
|
||||
private BigDecimal rechargeGold = BigDecimal.ZERO;
|
||||
|
||||
@ApiModelProperty("受转赠金币数")
|
||||
private BigDecimal giveGold = BigDecimal.ZERO;
|
||||
|
||||
@ApiModelProperty("时间")
|
||||
private String updateTime;
|
||||
|
||||
@ApiModelProperty("操作人")
|
||||
private String adminUserName;
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package com.accompany.admin.mapper.recharge;
|
||||
|
||||
import com.accompany.admin.vo.recharge.HighRechargeUserAdminVo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface HighRechargeUserAdminMapper {
|
||||
|
||||
Page<HighRechargeUserAdminVo> page(Page<HighRechargeUserAdminVo> page,
|
||||
@Param("type") Byte type,
|
||||
@Param("partitionId") Integer partitionId,
|
||||
@Param("uid") Long uid);
|
||||
|
||||
}
|
@@ -0,0 +1,95 @@
|
||||
package com.accompany.admin.service.recharge;
|
||||
|
||||
import com.accompany.admin.mapper.recharge.HighRechargeUserAdminMapper;
|
||||
import com.accompany.admin.vo.recharge.HighRechargeUserAdminVo;
|
||||
import com.accompany.business.service.user.UsersService;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.model.PageReq;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.core.exception.AdminServiceException;
|
||||
import com.accompany.core.model.Users;
|
||||
import com.accompany.payment.mapper.HighRechargeUserMapper;
|
||||
import com.accompany.payment.model.HighRechargeUser;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class HighRechargeUserAdminService {
|
||||
|
||||
@Autowired
|
||||
private UsersService usersService;
|
||||
@Autowired
|
||||
private HighRechargeUserMapper mapper;
|
||||
@Autowired
|
||||
private HighRechargeUserAdminMapper adminMapper;
|
||||
|
||||
public Page<HighRechargeUserAdminVo> page(Byte type, Integer partitionId, Long erbanNo, PageReq req) {
|
||||
Page<HighRechargeUserAdminVo> page = new Page<>(req.getPage(), req.getPageSize());
|
||||
|
||||
Long uid = null;
|
||||
if (null != erbanNo){
|
||||
Users u = usersService.getUserByErbanNo(erbanNo);
|
||||
if (null == u){
|
||||
return page;
|
||||
}
|
||||
uid = u.getUid();
|
||||
}
|
||||
|
||||
adminMapper.page(page, type, partitionId, uid);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
public void del(Long uid, int adminId) {
|
||||
HighRechargeUser u = mapper.selectById(uid);
|
||||
if (null == u || Constant.StatusV2.invalid.equals(u.getType())){
|
||||
throw new AdminServiceException(BusiStatus.USERNOTEXISTS);
|
||||
}
|
||||
|
||||
u.setUpdateTime(new Date());
|
||||
u.setAdminId(adminId);
|
||||
if (Constant.StatusV2.valid.equals(u.getType())){
|
||||
u.setType(Constant.StatusV2.delete);
|
||||
} else {
|
||||
u.setType(Constant.StatusV2.invalid);
|
||||
}
|
||||
|
||||
mapper.updateById(u);
|
||||
}
|
||||
|
||||
public void add(Long erbanNo, Byte type, int adminId) {
|
||||
Long uid = null;
|
||||
if (null != erbanNo){
|
||||
Users u = usersService.getUserByErbanNo(erbanNo);
|
||||
if (null == u){
|
||||
throw new AdminServiceException(BusiStatus.USERNOTEXISTS);
|
||||
}
|
||||
uid = u.getUid();
|
||||
}
|
||||
|
||||
HighRechargeUser u = mapper.selectById(uid);
|
||||
if (null != u && Constant.StatusV2.valid.equals(type) && Constant.StatusV2.delete.equals(u.getType())){
|
||||
throw new AdminServiceException("该用户已经被移除,需要在移除列表中先删除才可添加");
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
|
||||
if (null == u){
|
||||
u = new HighRechargeUser();
|
||||
u.setUid(uid);
|
||||
//todo gold
|
||||
u.setCreateTime(now);
|
||||
u.setAdminId(adminId);
|
||||
}
|
||||
u.setType(type);
|
||||
u.setUpdateTime(now);
|
||||
u.setAdminId(adminId);
|
||||
|
||||
mapper.insertOrUpdate(u);
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
<?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.accompany.admin.mapper.recharge.HighRechargeUserAdminMapper">
|
||||
|
||||
<select id="page" resultType="com.accompany.admin.vo.recharge.HighRechargeUserAdminVo">
|
||||
select hru.uid, hru.type, u.erban_no, u.nick,
|
||||
u.partition_id, pi.desc `partition_desc`,
|
||||
u.region_id, ri.name `region_desc`,
|
||||
hru.total_gold, hru.recharge_gold, hru.give_gold,
|
||||
hru.update_time
|
||||
from high_recharge_user hru
|
||||
inner join users u on hru.uid = u.uid
|
||||
inner join partition_info pi on u.partition_id = pi.id
|
||||
left join region_info ri on u.region_id = ri.id
|
||||
<where>
|
||||
<if test="uid != null">
|
||||
and hru.uid = #{uid}
|
||||
</if>
|
||||
<if test="type != null">
|
||||
and hru.`type` = #{type}
|
||||
</if>
|
||||
<if test="partitionId != null">
|
||||
and u.partition_id = #{partitionId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
@@ -0,0 +1,62 @@
|
||||
package com.accompany.admin.controller.recharge;
|
||||
|
||||
import com.accompany.admin.controller.BaseController;
|
||||
import com.accompany.admin.service.recharge.HighRechargeUserAdminService;
|
||||
import com.accompany.admin.vo.recharge.HighRechargeUserAdminVo;
|
||||
import com.accompany.common.model.PageReq;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.result.PageResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Api(tags = "高充值用户管理")
|
||||
@RestController
|
||||
@RequestMapping("/admin/recharge/highRechargeUser")
|
||||
public class HighRechargeUserAdminController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private HighRechargeUserAdminService service;
|
||||
|
||||
@ApiOperation("分页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "type", value = "类型 -1=移除大R,1=大R", required = true),
|
||||
@ApiImplicitParam(name = "partitionId", value = "分区ID"),
|
||||
@ApiImplicitParam(name = "erbanNo", value = "用户ID"),
|
||||
@ApiImplicitParam(name = "page", value = "页码", required = true),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页长", required = true),
|
||||
})
|
||||
@GetMapping("/page")
|
||||
public PageResult<HighRechargeUserAdminVo> page(Byte type, Integer partitionId, Long erbanNo, PageReq req) {
|
||||
return new PageResult<>(service.page(type, partitionId, erbanNo, req));
|
||||
}
|
||||
|
||||
@ApiOperation("增加")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "type", value = "类型 -1=移除大R,1=大R", required = true),
|
||||
@ApiImplicitParam(name = "erbanNo", value = "用户ID"),
|
||||
})
|
||||
@PostMapping("/add")
|
||||
public BusiResult<Void> add(Long erbanNo, Byte type) {
|
||||
int adminId = getAdminId();
|
||||
service.add(erbanNo, type, adminId);
|
||||
return BusiResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "uid", value = "uid", required = true),
|
||||
})
|
||||
@PostMapping("/del")
|
||||
public BusiResult<Void> del(Long uid) {
|
||||
int adminId = getAdminId();
|
||||
service.del(uid, adminId);
|
||||
return BusiResult.success();
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
package com.accompany.payment.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ApiModel
|
||||
@TableName("high_recharge_user")
|
||||
public class HighRechargeUser {
|
||||
|
||||
/**
|
||||
* 用户UID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
@ApiModelProperty("用户UID")
|
||||
private Long uid;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@ApiModelProperty("类型 -1=移除大R,0=什么都没有,1=大R")
|
||||
private Byte type;
|
||||
|
||||
@ApiModelProperty("总充值金币")
|
||||
private BigDecimal totalGold;
|
||||
|
||||
@ApiModelProperty("充值金币")
|
||||
private BigDecimal rechargeGold;
|
||||
|
||||
@ApiModelProperty("受转赠金币")
|
||||
private BigDecimal giveGold;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
private Integer adminId;
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.accompany.payment.mapper;
|
||||
|
||||
import com.accompany.payment.model.HighRechargeUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface HighRechargeUserMapper extends BaseMapper<HighRechargeUser> {
|
||||
// 可以在这里添加自定义的SQL方法
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package com.accompany.payment.service;
|
||||
|
||||
import com.accompany.payment.mapper.HighRechargeUserMapper;
|
||||
import com.accompany.payment.model.HighRechargeUser;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class HighRechargeUserService extends ServiceImpl<HighRechargeUserMapper, HighRechargeUser> {
|
||||
|
||||
}
|
Reference in New Issue
Block a user