Browse Source

用户管理和提现审批

master
nili 7 months ago
parent
commit
874aaec4bc
  1. 2
      game-dao/src/main/java/awesome/group/game/dao/bean/MatrixMoneyRecord.java
  2. 1
      game-service/src/main/java/awesome/group/game/service/MatrixService.java
  3. 16
      game-service/src/main/java/awesome/group/game/service/bo/MatrixAdvRecordBo.java
  4. 22
      game-service/src/main/java/awesome/group/game/service/bo/citrus/UserBo.java
  5. 35
      game-service/src/main/java/awesome/group/game/service/bo/matrix/MoneyBo.java
  6. 8
      game-service/src/main/java/awesome/group/game/service/bo/matrix/MoneyQuery.java
  7. 8
      game-service/src/main/java/awesome/group/game/service/bo/matrix/UserQuery.java
  8. 2
      game-service/src/main/java/awesome/group/game/service/citrus/ScheduleService.java
  9. 2
      game-service/src/main/java/awesome/group/game/service/citrus/UserService.java
  10. 2
      game-service/src/main/java/awesome/group/game/service/matrix/AdminDeviceService.java
  11. 2
      game-service/src/main/java/awesome/group/game/service/matrix/AdminService.java
  12. 2
      game-service/src/main/java/awesome/group/game/service/matrix/AggregationService.java
  13. 2
      game-service/src/main/java/awesome/group/game/service/matrix/AggregationSubService.java
  14. 73
      game-service/src/main/java/awesome/group/game/service/matrix/MatrixMoneyService.java
  15. 54
      game-service/src/main/java/awesome/group/game/service/matrix/MatrixUserService.java
  16. 2
      game-service/src/main/java/awesome/group/game/service/matrix/OSSService.java
  17. 2
      game-service/src/test/java/awesome/group/game/service/AdminServiceTest.java
  18. 2
      game-web/src/main/java/awesome/group/game/web/controller/MatrixController.java
  19. 4
      game-web/src/main/java/awesome/group/game/web/rest/matrix/AdminController.java
  20. 2
      game-web/src/main/java/awesome/group/game/web/rest/matrix/DeviceController.java
  21. 2
      game-web/src/main/java/awesome/group/game/web/rest/matrix/MatrixAppConfigController.java
  22. 34
      game-web/src/main/java/awesome/group/game/web/rest/matrix/MatrixMoneyController.java
  23. 23
      game-web/src/main/java/awesome/group/game/web/rest/matrix/MatrixUserController.java

2
game-dao/src/main/java/awesome/group/game/dao/bean/MatrixMoneyRecord.java

@ -16,6 +16,6 @@ public class MatrixMoneyRecord {
private String aliPayAccount;
private String name;
private String reason;
private Integer status;//0发起申请,1审批成功,2转账中,3转账成功,-1转账失败
private Integer status;//0发起申请,1审批成功,2转账中,3转账成功,-1转账失败, -2审批失败
private Timestamp createdAt;
}

1
game-service/src/main/java/awesome/group/game/service/MatrixService.java

@ -7,6 +7,7 @@ import awesome.group.game.dao.mapper.MatrixAppMapper;
import awesome.group.game.service.bo.MatrixAdvRecordEditBo;
import awesome.group.game.service.bo.MatrixAdvRecordSimple;
import awesome.group.game.service.common.log.L;
import awesome.group.game.service.matrix.AdminDeviceService;
import awesome.group.game.service.util.EncryptUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

16
game-service/src/main/java/awesome/group/game/service/bo/MatrixAdvRecordBo.java

@ -32,20 +32,6 @@ public class MatrixAdvRecordBo extends MatrixAdvRecordEditBo {
}
public void setUser(MatrixUser u) {
UserBo bo = new UserBo(u);
bo.mobile = replaceWithX(bo.mobile);
bo.aliPayAccount = replaceWithX(bo.aliPayAccount);
bo.wxOpenId = replaceWithX(bo.wxOpenId);
this.user = bo;
}
public static String replaceWithX(String str) {
if (!StringUtils.hasText(str)) {
return str;
}
int mid = str.length() / 2;
StringBuilder sb = new StringBuilder(str);
sb.replace(mid, sb.length(), "x".repeat(mid));
return sb.toString();
this.user = new UserBo(u, true);
}
}

22
game-service/src/main/java/awesome/group/game/service/bo/citrus/UserBo.java

@ -1,6 +1,7 @@
package awesome.group.game.service.bo.citrus;
import awesome.group.game.dao.bean.MatrixUser;
import org.springframework.util.StringUtils;
public class UserBo {
public Integer id;
@ -16,11 +17,12 @@ public class UserBo {
public String inviteUrl;
public String wxOpenId;//微信openId
public long createdAt;
public UserBo() {
}
public UserBo(MatrixUser u) {
public UserBo(MatrixUser u, boolean encrypt) {
this.id = u.getId();
this.mobile = u.getMobile();
this.name = u.getName();
@ -33,5 +35,23 @@ public class UserBo {
this.money = u.getMoney();
this.goldCoin = u.getIncome() - (u.getMoney() * 1000);
this.wxOpenId = u.getWxOpenId();
this.createdAt = u.getCreatedAt().getTime();
if (encrypt) {
this.mobile = replaceWithX(this.mobile);
this.aliPayAccount = replaceWithX(this.aliPayAccount);
this.wxOpenId = replaceWithX(this.wxOpenId);
}
}
public static String replaceWithX(String str) {
if (!StringUtils.hasText(str)) {
return str;
}
int mid = str.length() / 2;
StringBuilder sb = new StringBuilder(str);
sb.replace(mid, sb.length(), "x".repeat(mid));
return sb.toString();
}
}

35
game-service/src/main/java/awesome/group/game/service/bo/matrix/MoneyBo.java

@ -0,0 +1,35 @@
package awesome.group.game.service.bo.matrix;
import awesome.group.game.dao.bean.MatrixMoneyRecord;
import awesome.group.game.dao.bean.MatrixUser;
import awesome.group.game.service.bo.citrus.UserBo;
public class MoneyBo {
public UserBo user;
public Integer id;
public Integer cent;
public String aliPayAccount;
public String name;
public String reason;
public Integer status;//0发起申请,1审批成功,2转账中,3转账成功,-1转账失败
public long createdAt;
public MoneyBo() {
}
public MoneyBo(MatrixUser user, MatrixMoneyRecord r, boolean encypt) {
this.user = new UserBo(user, encypt);
this.id = r.getId();
this.cent = r.getCent();
this.aliPayAccount = r.getAliPayAccount();
this.name = r.getName();
this.reason = r.getReason();
this.status = r.getStatus();
this.createdAt = r.getCreatedAt().getTime();
if (encypt) {
this.aliPayAccount = UserBo.replaceWithX(this.aliPayAccount);
this.name = UserBo.replaceWithX(this.name);
}
}
}

8
game-service/src/main/java/awesome/group/game/service/bo/matrix/MoneyQuery.java

@ -0,0 +1,8 @@
package awesome.group.game.service.bo.matrix;
import awesome.group.game.service.bo.PageParam;
public class MoneyQuery extends PageParam {
public String appCode;
public Integer status;
}

8
game-service/src/main/java/awesome/group/game/service/bo/matrix/UserQuery.java

@ -0,0 +1,8 @@
package awesome.group.game.service.bo.matrix;
import awesome.group.game.service.bo.PageParam;
public class UserQuery extends PageParam {
public String appCode;
}

2
game-service/src/main/java/awesome/group/game/service/ScheduleService.java → game-service/src/main/java/awesome/group/game/service/citrus/ScheduleService.java

@ -1,4 +1,4 @@
package awesome.group.game.service;
package awesome.group.game.service.citrus;
import awesome.group.game.dao.bean.MatrixMoneyRecord;
import awesome.group.game.dao.mapper.MatrixMoneyRecordMapper;

2
game-service/src/main/java/awesome/group/game/service/citrus/UserService.java

@ -111,7 +111,7 @@ public class UserService {
public UserBo getUser(Integer uid) {
MatrixUser u = userMapper.selectById(uid);
MatrixApp app = new MatrixApp();
UserBo res = new UserBo(u);
UserBo res = new UserBo(u, false);
if (!StringUtils.hasText(app.getUmeng())) {
return res;
}

2
game-service/src/main/java/awesome/group/game/service/AdminDeviceService.java → game-service/src/main/java/awesome/group/game/service/matrix/AdminDeviceService.java

@ -1,4 +1,4 @@
package awesome.group.game.service;
package awesome.group.game.service.matrix;
import awesome.group.game.dao.bean.*;
import awesome.group.game.dao.mapper.*;

2
game-service/src/main/java/awesome/group/game/service/AdminService.java → game-service/src/main/java/awesome/group/game/service/matrix/AdminService.java

@ -1,4 +1,4 @@
package awesome.group.game.service;
package awesome.group.game.service.matrix;
import awesome.group.game.dao.bean.*;
import awesome.group.game.dao.mapper.*;

2
game-service/src/main/java/awesome/group/game/service/AggregationService.java → game-service/src/main/java/awesome/group/game/service/matrix/AggregationService.java

@ -1,4 +1,4 @@
package awesome.group.game.service;
package awesome.group.game.service.matrix;
import awesome.group.game.dao.bean.MatrixAdvAggregation;
import awesome.group.game.dao.mapper.MatrixAdvAggregationMapper;

2
game-service/src/main/java/awesome/group/game/service/AggregationSubService.java → game-service/src/main/java/awesome/group/game/service/matrix/AggregationSubService.java

@ -1,4 +1,4 @@
package awesome.group.game.service;
package awesome.group.game.service.matrix;
import awesome.group.game.dao.bean.MatrixAdvAggregationSub;
import awesome.group.game.dao.mapper.MatrixAdvAggregationSubMapper;

73
game-service/src/main/java/awesome/group/game/service/matrix/MatrixMoneyService.java

@ -0,0 +1,73 @@
package awesome.group.game.service.matrix;
import awesome.group.game.dao.bean.MatrixApp;
import awesome.group.game.dao.bean.MatrixMoneyRecord;
import awesome.group.game.dao.bean.MatrixUser;
import awesome.group.game.dao.mapper.MatrixAppMapper;
import awesome.group.game.dao.mapper.MatrixMoneyRecordMapper;
import awesome.group.game.dao.mapper.MatrixUserMapper;
import awesome.group.game.service.bo.PageResult;
import awesome.group.game.service.bo.citrus.UserBo;
import awesome.group.game.service.bo.matrix.MoneyBo;
import awesome.group.game.service.bo.matrix.MoneyQuery;
import awesome.group.game.service.common.exception.PaganiException;
import awesome.group.game.service.common.exception.PaganiExceptionCode;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@Service
public class MatrixMoneyService {
@Autowired
private MatrixMoneyRecordMapper moneyRecordMapper;
@Autowired
private MatrixAppMapper appMapper;
@Autowired
private MatrixUserService matrixUserService;
@Autowired
private AdminService adminService;
public static final int AUDIT_FAIL= -2;
public static final int AUDIT_SUCCESS= -1;
public PageResult<MoneyBo> list(MoneyQuery query) {
MatrixApp app = appMapper.queryByCode(query.appCode);
LambdaQueryWrapper<MatrixMoneyRecord> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MatrixMoneyRecord::getAppId, app.getId());
if (query.status != null) {
wrapper.eq(MatrixMoneyRecord::getStatus, query.status);
}
wrapper.orderByDesc(MatrixMoneyRecord::getId);
int page = query.current;
int pageSize = query.pageSize;
IPage<MatrixMoneyRecord> iPage = moneyRecordMapper.selectPage(new Page<>(page, pageSize), wrapper);
PageResult<MoneyBo> res = new PageResult<>();
res.total = iPage.getTotal();
List<MatrixMoneyRecord> records = iPage.getRecords();
List<Integer> uids = records.stream().map(MatrixMoneyRecord::getUserId).toList();
Map<Integer, MatrixUser> uMap = matrixUserService.getUser(uids);
res.data = records.stream().map(r -> new MoneyBo(uMap.get(r.getUserId()), r, true)).toList();
return res;
}
public void setStatus(Integer id, int status, String reason, Integer adminId) {
Assert.isTrue(Arrays.asList(AUDIT_FAIL, AUDIT_SUCCESS).contains(status), "非法请求");
MatrixMoneyRecord record = moneyRecordMapper.selectById(id);
List<Integer> appIds = adminService.getAdminAppIds(adminId);
if (!appIds.contains(record.getAppId())) {
throw new PaganiException(PaganiExceptionCode.GENERAL_ERROR, "非法请求,多次操作将被封号");
}
moneyRecordMapper.updateStatusAndReason(id, status, reason);
}
}

54
game-service/src/main/java/awesome/group/game/service/matrix/MatrixUserService.java

@ -0,0 +1,54 @@
package awesome.group.game.service.matrix;
import awesome.group.game.dao.bean.MatrixApp;
import awesome.group.game.dao.bean.MatrixUser;
import awesome.group.game.dao.mapper.MatrixAppMapper;
import awesome.group.game.dao.mapper.MatrixUserMapper;
import awesome.group.game.service.bo.PageResult;
import awesome.group.game.service.bo.citrus.UserBo;
import awesome.group.game.service.bo.matrix.UserQuery;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class MatrixUserService {
@Autowired
private MatrixUserMapper userMapper;
@Autowired
private MatrixAppMapper appMapper;
public PageResult<UserBo> list(UserQuery query) {
MatrixApp app = appMapper.queryByCode(query.appCode);
LambdaQueryWrapper<MatrixUser> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MatrixUser::getAppId, app.getId());
int page = query.current;
int pageSize = query.pageSize;
wrapper.orderByDesc(MatrixUser::getId);
IPage<MatrixUser> iPage = userMapper.selectPage(new Page<>(page, pageSize), wrapper);
PageResult<UserBo> res = new PageResult<>();
res.total = iPage.getTotal();
res.data = iPage.getRecords().stream().map(u -> new UserBo(u, true)).toList();
return res;
}
public Map<Integer, MatrixUser> getUser(List<Integer> uidList) {
if (CollectionUtils.isEmpty(uidList)) {
return new HashMap<>();
}
LambdaQueryWrapper<MatrixUser> wrapper = new LambdaQueryWrapper<>();
wrapper.in(MatrixUser::getId, uidList);
List<MatrixUser> list = userMapper.selectList(wrapper);
return list.stream().collect(Collectors.toMap(MatrixUser::getId, x -> x));
}
}

2
game-service/src/main/java/awesome/group/game/service/OSSService.java → game-service/src/main/java/awesome/group/game/service/matrix/OSSService.java

@ -1,4 +1,4 @@
package awesome.group.game.service;
package awesome.group.game.service.matrix;
import awesome.group.game.service.bo.STSInfo;
import awesome.group.game.service.cache.CacheKey;

2
game-service/src/test/java/awesome/group/game/service/AdminServiceTest.java

@ -1,5 +1,7 @@
package awesome.group.game.service;
import awesome.group.game.service.matrix.AdminDeviceService;
import awesome.group.game.service.matrix.AdminService;
import awesome.group.game.service.util.DateUtil;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

2
game-web/src/main/java/awesome/group/game/web/controller/MatrixController.java

@ -1,6 +1,6 @@
package awesome.group.game.web.controller;
import awesome.group.game.service.AdminDeviceService;
import awesome.group.game.service.matrix.AdminDeviceService;
import awesome.group.game.service.bo.MatrixAdvRecordSimple;
import awesome.group.game.web.RequestContext;
import awesome.group.game.web.aop.RestApi;

4
game-web/src/main/java/awesome/group/game/web/rest/matrix/AdminController.java

@ -4,9 +4,9 @@ import awesome.group.game.dao.bean.MatrixAdmin;
import awesome.group.game.dao.bean.MatrixApp;
import awesome.group.game.dao.bean.MatrixMockSchedule;
import awesome.group.game.dao.bean.MatrixWhiteDevice;
import awesome.group.game.service.AdminService;
import awesome.group.game.service.matrix.AdminService;
import awesome.group.game.service.MatrixService;
import awesome.group.game.service.OSSService;
import awesome.group.game.service.matrix.OSSService;
import awesome.group.game.service.bo.*;
import awesome.group.game.service.bo.matrix.MatrixAppBo;
import awesome.group.game.service.common.response.R;

2
game-web/src/main/java/awesome/group/game/web/rest/matrix/DeviceController.java

@ -1,7 +1,7 @@
package awesome.group.game.web.rest.matrix;
import awesome.group.game.dao.bean.MatrixAdminDevice;
import awesome.group.game.service.AdminDeviceService;
import awesome.group.game.service.matrix.AdminDeviceService;
import awesome.group.game.service.bo.DateIncome;
import awesome.group.game.service.bo.IncomeQuery;
import awesome.group.game.service.bo.OverviewBo;

2
game-web/src/main/java/awesome/group/game/web/rest/matrix/MatrixAppConfigController.java

@ -8,7 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/matrix/app")
@RequestMapping("/api/admin/app")
public class MatrixAppConfigController {
@Autowired

34
game-web/src/main/java/awesome/group/game/web/rest/matrix/MatrixMoneyController.java

@ -0,0 +1,34 @@
package awesome.group.game.web.rest.matrix;
import awesome.group.game.service.bo.PageResult;
import awesome.group.game.service.bo.matrix.MoneyBo;
import awesome.group.game.service.bo.matrix.MoneyQuery;
import awesome.group.game.service.common.response.R;
import awesome.group.game.service.matrix.MatrixMoneyService;
import awesome.group.game.web.RequestContext;
import awesome.group.game.web.aop.RestApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/admin/money")
public class MatrixMoneyController {
@Autowired
private MatrixMoneyService matrixMoneyService;
@PostMapping("/list")
@RestApi
public R<PageResult<MoneyBo>> moneyApplyList(@RequestBody MoneyQuery query) {
return new R<>(matrixMoneyService.list(query));
}
@PostMapping("/audit")
@RestApi
public R<Void> audit(@RequestBody MoneyBo moneyBo) {
matrixMoneyService.setStatus(moneyBo.id, moneyBo.status, moneyBo.reason, RequestContext.getAdminID());
return new R<>(null);
}
}

23
game-web/src/main/java/awesome/group/game/web/rest/matrix/MatrixUserController.java

@ -0,0 +1,23 @@
package awesome.group.game.web.rest.matrix;
import awesome.group.game.service.bo.PageResult;
import awesome.group.game.service.bo.citrus.UserBo;
import awesome.group.game.service.bo.matrix.UserQuery;
import awesome.group.game.service.common.response.R;
import awesome.group.game.service.matrix.MatrixUserService;
import awesome.group.game.web.aop.RestApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/admin/user")
public class MatrixUserController {
@Autowired
private MatrixUserService userService;
@PostMapping("/list")
@RestApi
public R<PageResult<UserBo>> list(@RequestBody UserQuery query) {
return new R<>(userService.list(query));
}
}
Loading…
Cancel
Save