|
@@ -21,6 +21,7 @@ import com.txz.cif.service.RedEnvelopeService;
|
|
|
import com.txz.cif.service.SequenceService;
|
|
|
import com.txz.cif.service.UserService;
|
|
|
import com.txz.cif.util.ShareCodeUtils;
|
|
|
+import com.txz.cif.util.UserNoUtil;
|
|
|
import com.txz.cif.web.bo.EnumBo;
|
|
|
import com.txz.cif.web.bo.UserBo;
|
|
|
import com.txz.cif.web.bo.UserInfoBO;
|
|
@@ -246,7 +247,7 @@ public class UserApiController extends AbstractApiController {
|
|
|
Integer invited2 = userService.countByCondition(c);
|
|
|
bo.setTeamNo(invited + invited2);
|
|
|
// 7日收益
|
|
|
- BigDecimal amount = redEnvelopeService.sumWithDay(DateUtil.offsetDay(DateUtil.date(),-7).toDateStr(), user.getId(), 3);
|
|
|
+ BigDecimal amount = redEnvelopeService.sumWithDay(DateUtil.offsetDay(DateUtil.date(), -7).toDateStr(), user.getId(), 3);
|
|
|
bo.setL7DEarnings(amount);
|
|
|
return ResultGenerator.genSuccessResult(bo);
|
|
|
}
|
|
@@ -264,25 +265,25 @@ public class UserApiController extends AbstractApiController {
|
|
|
}
|
|
|
User temp = new User();
|
|
|
temp.setId(userId);
|
|
|
- if (StrUtil.isNotBlank(userForm.getBank())){
|
|
|
+ if (StrUtil.isNotBlank(userForm.getBank())) {
|
|
|
temp.setBank(userForm.getBank());
|
|
|
}
|
|
|
- if (StrUtil.isNotBlank(userForm.getPhoneNo())){
|
|
|
+ if (StrUtil.isNotBlank(userForm.getPhoneNo())) {
|
|
|
temp.setPhoneNo(userForm.getPhoneNo());
|
|
|
}
|
|
|
- if (StrUtil.isNotBlank(userForm.getName())){
|
|
|
+ if (StrUtil.isNotBlank(userForm.getName())) {
|
|
|
temp.setName(userForm.getName());
|
|
|
}
|
|
|
- if (StrUtil.isNotBlank(userForm.getHeadPic())){
|
|
|
+ if (StrUtil.isNotBlank(userForm.getHeadPic())) {
|
|
|
temp.setHeadPic(userForm.getHeadPic());
|
|
|
}
|
|
|
- if (StrUtil.isNotBlank(userForm.getNickname())){
|
|
|
+ if (StrUtil.isNotBlank(userForm.getNickname())) {
|
|
|
temp.setNickname(userForm.getNickname());
|
|
|
}
|
|
|
- if (StrUtil.isNotBlank(userForm.getBankAccount())){
|
|
|
+ if (StrUtil.isNotBlank(userForm.getBankAccount())) {
|
|
|
temp.setBankAccount(userForm.getBankAccount());
|
|
|
}
|
|
|
- if (StrUtil.isNotBlank(userForm.getBankAccountName())){
|
|
|
+ if (StrUtil.isNotBlank(userForm.getBankAccountName())) {
|
|
|
temp.setBankAccountName(userForm.getBankAccountName());
|
|
|
}
|
|
|
temp.setUpdateTime(DateUtil.date());
|
|
@@ -317,13 +318,15 @@ public class UserApiController extends AbstractApiController {
|
|
|
String pwd2 = SecureUtil.md5(params.getPwd() + salt).toUpperCase();
|
|
|
log.error("[密码]" + params.getPhone() + " :" + pwd2);
|
|
|
|
|
|
- String code = getInviteCode(0);
|
|
|
- if (code == null) {
|
|
|
- return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
- }
|
|
|
- User parent = userService.findBy("userNo", params.getCode());
|
|
|
- // String userNo = sequenceService.genSerialNumber("register_rule",null);
|
|
|
- User user = User.builder().createTime(DateUtil.date()).invitedCode(code)
|
|
|
+ // String code = getInviteCode(0);
|
|
|
+ // if (code == null) {
|
|
|
+ // return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+ // }
|
|
|
+ // User parent = userService.findBy("userNo", params.getCode());
|
|
|
+ // String userNo = sequenceService.genSerialNumber("register_rule", null);
|
|
|
+ User user = User.builder()
|
|
|
+ .createTime(DateUtil.date())
|
|
|
+ // .invitedCode(code)
|
|
|
.name(params.getName())
|
|
|
.areaCode(params.getAreaCode())
|
|
|
// .userNo(userNo)
|
|
@@ -333,12 +336,19 @@ public class UserApiController extends AbstractApiController {
|
|
|
.hasLogin(1)
|
|
|
.hasOrder(1)
|
|
|
.hasWithdraw(1)
|
|
|
- .phoneNo(params.getPhone()).pwd(pwd2).salt(salt).build();
|
|
|
- if (parent != null) {
|
|
|
- user.setPid(parent.getId());
|
|
|
- if (parent.getPid() != null) {
|
|
|
- user.setPpid(parent.getPid());
|
|
|
+ .phoneNo(params.getPhone())
|
|
|
+ .pwd(pwd2)
|
|
|
+ .salt(salt)
|
|
|
+ .build();
|
|
|
+ if (StrUtil.isNotBlank(params.getCode())) {
|
|
|
+ // User parent = userService.findBy("userNo", params.getCode());
|
|
|
+ // if (parent != null) {
|
|
|
+ user.setPid(ShareCodeUtils.codeToId(params.getCode()));
|
|
|
+ User puser = userService.findById(ShareCodeUtils.codeToId(params.getCode()));
|
|
|
+ if (puser.getPid() != null) {
|
|
|
+ user.setPpid(puser.getPid());
|
|
|
}
|
|
|
+ // }
|
|
|
}
|
|
|
if (StrUtil.isBlank(user.getHeadPic())) {
|
|
|
String zm = user.getName().substring(0, 1).toUpperCase();
|
|
@@ -349,7 +359,9 @@ public class UserApiController extends AbstractApiController {
|
|
|
}
|
|
|
user.setVipLevel(0);
|
|
|
userService.add(user);
|
|
|
- user.setUserNo(ShareCodeUtils.idToInvitationCode(user.getId()));
|
|
|
+ user.setInvitedCode(ShareCodeUtils.idToInvitationCode(user.getId()));
|
|
|
+ // 补位
|
|
|
+ user.setUserNo(UserNoUtil.generateUserNo(user.getId()));
|
|
|
userService.update(user);
|
|
|
user.setPwd("***");
|
|
|
user.setSalt("***");
|
|
@@ -406,7 +418,7 @@ public class UserApiController extends AbstractApiController {
|
|
|
public Result<List<User>> myUsers(@RequestBody MyUserParam param, HttpServletRequest request) {
|
|
|
Long userId = authService.getTokenUserId(request);
|
|
|
if (userId == null) {
|
|
|
- return ResultGenerator.genFailResult(ResultCode.OAUTH_INVALID_ACCESS_TOKEN);
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.OAUTH_INVALID_ACCESS_TOKEN);
|
|
|
}
|
|
|
PageHelper.startPage(param.getPage(), param.getSize());
|
|
|
Condition condition = new Condition(User.class);
|