|
@@ -1,5 +1,6 @@
|
|
|
package com.txz.cif.web;
|
|
|
|
|
|
+import java.lang.reflect.Member;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -15,6 +16,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.crypto.SecureUtil;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import com.txz.cif.dubbo.client.OperatingConfigDubboServiceClient;
|
|
|
import com.txz.cif.enums.BizTypeEnum;
|
|
|
import com.txz.cif.enums.RechargeStatusEnum;
|
|
|
import com.txz.cif.enums.RedEnvelopeStatusEnum;
|
|
@@ -31,6 +33,7 @@ import com.txz.cif.core.*;
|
|
|
import com.txz.cif.model.*;
|
|
|
import com.txz.cif.service.*;
|
|
|
import com.txz.cif.core.AuthService;
|
|
|
+import com.txz.operating.dto.ConfigDTO;
|
|
|
import io.swagger.annotations.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -50,6 +53,9 @@ public class UserApiController extends AbstractApiController {
|
|
|
@Resource
|
|
|
private UserService userService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private ConfigMemberService configMemberService;
|
|
|
+
|
|
|
@Resource
|
|
|
private AuthService authService;
|
|
|
|
|
@@ -60,6 +66,9 @@ public class UserApiController extends AbstractApiController {
|
|
|
@Resource
|
|
|
private RedEnvelopeService redEnvelopeService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private OperatingConfigDubboServiceClient configDubboServiceClient;
|
|
|
+
|
|
|
@GetMapping("/getEnum")
|
|
|
@ApiOperation(value = "获取枚举(1业务类型 2充值状态 3提现状态 4收益状态 5收益业务类型)",httpMethod = "GET")
|
|
|
public Result<List<EnumBo>> getEnum(@RequestParam Integer id) {
|
|
@@ -177,6 +186,15 @@ public class UserApiController extends AbstractApiController {
|
|
|
return ResultGenerator.genSuccessResult(result.getData().toString());
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "获取会员等级配置", notes = "",httpMethod = "GET")
|
|
|
+ @GetMapping("/memberConfigs")
|
|
|
+ public Result<List<ConfigMember>> memberConfigs() {
|
|
|
+ List<ConfigMember> result = configMemberService.findAll();
|
|
|
+ return ResultGenerator.genSuccessResult(result);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
@ApiOperation(value = "查询用户资料", notes = "",httpMethod = "GET")
|
|
|
@GetMapping("/getUserInfo")
|
|
@@ -186,11 +204,26 @@ public class UserApiController extends AbstractApiController {
|
|
|
if (user == null){
|
|
|
return ResultGenerator.genFailResult(ResultCode.USER_IS_NULL);
|
|
|
}
|
|
|
+ if (StrUtil.isBlank(user.getHeadPic())){
|
|
|
+ String zm = user.getName().substring(0,1).toUpperCase();
|
|
|
+ Integer index = RandomUtil.randomInt(10);
|
|
|
+ com.txz.operating.result.Result<ConfigDTO> defaultAvatar = configDubboServiceClient.getConfigByCode("default_avatar");
|
|
|
+ String headPic = defaultAvatar.getData().getValueInfo()+ zm +"/"+zm+"_gradient_"+index+".png" ;
|
|
|
+ user.setHeadPic(headPic);
|
|
|
+ userService.update(User.builder().id(userId).headPic(headPic).build());
|
|
|
+ }
|
|
|
UserInfoBO bo = user.generator();
|
|
|
Condition c = new Condition(User.class);
|
|
|
c.createCriteria().andEqualTo("pid",user.getId());
|
|
|
Integer invited = userService.countByCondition(c);
|
|
|
bo.setInvitedNo(invited);
|
|
|
+ //下级要人数
|
|
|
+ ConfigMember nextLevel = configMemberService.findBy("level", user.getVipLevel() + 1);
|
|
|
+ if (nextLevel == null){
|
|
|
+ bo.setNextInvitedNo(invited);
|
|
|
+ } else {
|
|
|
+ bo.setNextInvitedNo(nextLevel.getInvitedNo());
|
|
|
+ }
|
|
|
c = new Condition(User.class);
|
|
|
c.createCriteria().andEqualTo("ppid",user.getId());
|
|
|
Integer invited2 = userService.countByCondition(c);
|
|
@@ -257,6 +290,13 @@ public class UserApiController extends AbstractApiController {
|
|
|
user.setPpid(parent.getPid());
|
|
|
}
|
|
|
}
|
|
|
+ if (StrUtil.isBlank(user.getHeadPic())){
|
|
|
+ String zm = user.getName().substring(0,1).toUpperCase();
|
|
|
+ Integer index = RandomUtil.randomInt(10);
|
|
|
+ com.txz.operating.result.Result<ConfigDTO> defaultAvatar = configDubboServiceClient.getConfigByCode("default_avatar");
|
|
|
+ String headPic = defaultAvatar.getData().getValueInfo()+ zm +"/"+zm+"_gradient_"+index+".png" ;
|
|
|
+ user.setHeadPic(headPic);
|
|
|
+ }
|
|
|
user.setVipLevel(1);
|
|
|
userService.add(user);
|
|
|
user.setPwd("***");
|