diff --git a/src/main/java/cn/com/tenlion/operator/service/UserRegisterService.java b/src/main/java/cn/com/tenlion/operator/service/UserRegisterService.java index 5327ead..5f8ccda 100644 --- a/src/main/java/cn/com/tenlion/operator/service/UserRegisterService.java +++ b/src/main/java/cn/com/tenlion/operator/service/UserRegisterService.java @@ -1,11 +1,15 @@ package cn.com.tenlion.operator.service; +import cn.com.tenlion.operator.pojo.vos.user.expand.UserExpandVO; import cn.com.tenlion.operator.service.account.IAccountService; +import cn.com.tenlion.operator.service.user.custom.UserCustomService; +import cn.com.tenlion.operator.service.user.expand.UserExpandServiceImpl; import ink.wgink.exceptions.SaveException; import ink.wgink.interfaces.expand.register.IRegisterHandlerService; import ink.wgink.interfaces.expand.register.IRegisterWithExpandInfoHandlerService; import ink.wgink.interfaces.role.IRoleBaseService; import ink.wgink.interfaces.user.IUserBaseService; +import ink.wgink.interfaces.user.IUserExpandBaseService; import ink.wgink.pojo.dtos.role.RoleDTO; import ink.wgink.pojo.dtos.user.UserDTO; import ink.wgink.service.role.service.IRoleUserService; @@ -30,10 +34,11 @@ public class UserRegisterService implements IRegisterHandlerService, IRegisterWi private IAccountService iAccountService; @Autowired private IRoleUserService iRoleUserService; + @Autowired + private UserExpandServiceImpl userExpandService; @Override public void handler(String userId, Map requestParams) throws Exception { - UserDTO userDTO = iUserBaseService.get(userId); String userRole = requestParams.get("userRole").toString(); RoleDTO roleDTO = iRoleBaseService.get(userRole); if (roleDTO == null) { @@ -49,6 +54,8 @@ public class UserRegisterService implements IRegisterHandlerService, IRegisterWi iAccountService.updateUserTypeToSystemUser(userId); // 3.初始化个人信息 iAccountService.saveCreate(roleName, userId); + // 4.初始化用户拓展信息 + userExpandService.saveOrUpdate(userId, new UserExpandVO()); } @Override diff --git a/src/main/java/cn/com/tenlion/operator/service/user/expand/UserExpandServiceImpl.java b/src/main/java/cn/com/tenlion/operator/service/user/expand/UserExpandServiceImpl.java index 69668ab..79b118c 100644 --- a/src/main/java/cn/com/tenlion/operator/service/user/expand/UserExpandServiceImpl.java +++ b/src/main/java/cn/com/tenlion/operator/service/user/expand/UserExpandServiceImpl.java @@ -13,6 +13,7 @@ import ink.wgink.interfaces.user.IUserExpandBaseService; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.dtos.user.UserDTO; import ink.wgink.pojo.result.SuccessResultList; +import ink.wgink.service.user.pojo.pos.UserPO; import ink.wgink.service.user.service.IUserService; import ink.wgink.util.date.DateUtil; import ink.wgink.util.map.HashMapUtil; @@ -282,16 +283,10 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx } public void updateRelationIcByUserId(String userId, UserExpandRelationIcVO userExpandIcVO) { - UserExpandPO selfPO = getPO(userId); - if (selfPO == null) { + UserPO userPO = userService.getPO(userId); + if (userPO == null) { throw new SearchException("用户不存在"); } - if (StringUtils.equals("ACTIVE", selfPO.getPostpaid())) { - throw new SearchException("后付费用户不能绑定邀请码"); - } - if (StringUtils.isNotBlank(selfPO.getRelationIc())) { - throw new SearchException("已经绑定过邀请码"); - } UserExpandPO icUserPO = getPOByIc(userExpandIcVO.getRelationIc()); if (icUserPO == null) { throw new SearchException("邀请码不正确"); @@ -299,6 +294,19 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx if (StringUtils.equals(icUserPO.getUserId(), userId)) { throw new SearchException("不能绑定自己的邀请码"); } + UserExpandPO selfPO = getPO(userId); + if (selfPO == null) { + saveOrUpdate(userId, new UserExpandVO()); + selfPO = getPO(userId); + } + if (StringUtils.equals("ACTIVE", selfPO.getPostpaid())) { + throw new SearchException("后付费用户不能绑定邀请码"); + } + if (StringUtils.isNotBlank(selfPO.getRelationIc())) { + throw new SearchException("已经绑定过邀请码"); + } + + Map params = getHashMap(4); params.put("priceAll", icUserPO.getIcPriceAll()); params.put("priceMaterial", icUserPO.getIcPriceMaterial());