|
@@ -17,6 +17,7 @@ import com.zhongzheng.common.exception.BaseException;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.*;
|
|
|
import com.zhongzheng.common.utils.ip.IpUtils;
|
|
|
+import com.zhongzheng.modules.alisms.service.IAliSmsService;
|
|
|
import com.zhongzheng.modules.collect.domain.CollectBank;
|
|
|
import com.zhongzheng.modules.collect.domain.CollectCourse;
|
|
|
import com.zhongzheng.modules.collect.domain.CollectNote;
|
|
@@ -77,7 +78,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
@Autowired
|
|
|
private IUserService userService;
|
|
|
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private IAliSmsService iSmsService;
|
|
|
|
|
|
@Autowired
|
|
|
private UserMapper userMapper;
|
|
@@ -227,7 +229,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean updateByEditBo(UserEditBo bo) throws IllegalAccessException {
|
|
|
User update = BeanUtil.toBean(bo, User.class);
|
|
|
- validEntityBeforeSave(update);
|
|
|
+ validEntityBeforeUpdate(update);
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
|
//增加客户端信息进行添加积分
|
|
@@ -253,6 +255,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
*/
|
|
|
private void validEntityBeforeSave(User entity) {
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void validEntityBeforeUpdate(User entity) {
|
|
|
+ //TODO 做一些数据校验,如唯一约束
|
|
|
}
|
|
|
|
|
|
public Integer countUser(UserEditBo userVo) throws IllegalAccessException {
|
|
@@ -417,6 +424,53 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
return baseMapper.selectLookNum(userId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Long systemRegisterUser(UserSystemRegisterBo bo) {
|
|
|
+ if(bo.getTel()==null){
|
|
|
+ throw new CustomException("手机号不能为空");
|
|
|
+ }
|
|
|
+ if(bo.getIdCard()==null){
|
|
|
+ throw new CustomException("身份证不能为空");
|
|
|
+ }
|
|
|
+ if(bo.getRealname()==null){
|
|
|
+ throw new CustomException("真实姓名不能为空");
|
|
|
+ }
|
|
|
+ User user = getOne(new LambdaQueryWrapper<User>()
|
|
|
+ .eq(User::getTelphone,bo.getTel()).last("limit 1"));
|
|
|
+ if(Validator.isNotNull(user)){
|
|
|
+ throw new CustomException("该手机号已注册");
|
|
|
+ }
|
|
|
+ User user2 = getOne(new LambdaQueryWrapper<User>()
|
|
|
+ .eq(User::getIdCard,bo.getIdCard()).last("limit 1"));
|
|
|
+ if(Validator.isNotNull(user2)){
|
|
|
+ throw new CustomException("该身份证已被使用");
|
|
|
+ }
|
|
|
+ User inertData = new User();
|
|
|
+ inertData.setTelphone(bo.getTel());
|
|
|
+ //隐藏手机号作为初始昵称
|
|
|
+ inertData.setNickname(TelPhoneUtils.hideTelPhone(bo.getTel()));
|
|
|
+ //雪花算法产生账号ID
|
|
|
+ SnowflakeIdUtils idWorker = new SnowflakeIdUtils(3, 1);
|
|
|
+ inertData.setUserAccount(String.valueOf(idWorker.nextId()));
|
|
|
+ inertData.setSex(1);
|
|
|
+ inertData.setIdCard(bo.getIdCard());
|
|
|
+ inertData.setRealname(bo.getRealname());
|
|
|
+ inertData.setStatus(1);
|
|
|
+ inertData.setRegisterPlat("3");
|
|
|
+ inertData.setAvatar(Constants.DEFAULT_AVATAR);
|
|
|
+ inertData.setLastLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
|
|
+ inertData.setLastLoginTime(DateUtils.getNowTime());
|
|
|
+ inertData.setCreateTime(DateUtils.getNowTime());
|
|
|
+ inertData.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ String pwd = ToolsUtils.getSmsCode(); // 随机密码
|
|
|
+ inertData.setPassword(SecurityUtils.encryptPassword(pwd));
|
|
|
+ if(!save(inertData)){
|
|
|
+ throw new CustomException("注册失败");
|
|
|
+ }
|
|
|
+ iSmsService.sendPwdSms(bo.getTel(),pwd);
|
|
|
+ return inertData.getUserId();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Boolean registerUser(UserAppRegisterBo bo) {
|
|
|
if(bo.getTel()==null){
|