|
@@ -11,6 +11,7 @@ import com.yonge.cooleshow.auth.api.dto.SysUserQueryInfo;
|
|
import com.yonge.cooleshow.auth.api.dto.UserSetReq;
|
|
import com.yonge.cooleshow.auth.api.dto.UserSetReq;
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
import com.yonge.cooleshow.auth.api.vo.UserSetVo;
|
|
import com.yonge.cooleshow.auth.api.vo.UserSetVo;
|
|
|
|
+import com.yonge.cooleshow.auth.config.CustomerServiceConfig;
|
|
import com.yonge.cooleshow.auth.config.RongCloudConfig;
|
|
import com.yonge.cooleshow.auth.config.RongCloudConfig;
|
|
import com.yonge.cooleshow.auth.dal.dao.SysUserDao;
|
|
import com.yonge.cooleshow.auth.dal.dao.SysUserDao;
|
|
import com.yonge.cooleshow.auth.service.SysConfigService;
|
|
import com.yonge.cooleshow.auth.service.SysConfigService;
|
|
@@ -32,19 +33,22 @@ import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.redisson.api.RedissonClient;
|
|
import org.redisson.api.RedissonClient;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
|
+import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Objects;
|
|
import java.util.Random;
|
|
import java.util.Random;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
@Service
|
|
@Service
|
|
|
|
+@RefreshScope
|
|
public class SysUserServiceImpl extends BaseServiceImpl<Long, SysUser> implements SysUserService {
|
|
public class SysUserServiceImpl extends BaseServiceImpl<Long, SysUser> implements SysUserService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -59,10 +63,8 @@ public class SysUserServiceImpl extends BaseServiceImpl<Long, SysUser> implement
|
|
private RedissonClient redissonClient;
|
|
private RedissonClient redissonClient;
|
|
@Resource
|
|
@Resource
|
|
private AdminFeignService adminFeignService;
|
|
private AdminFeignService adminFeignService;
|
|
-
|
|
|
|
- // 新用户注册,默认添加官方客服联系人配置
|
|
|
|
- @Value("${app.customer.service:17740683946}")
|
|
|
|
- private String customerService;
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private CustomerServiceConfig customerServiceConfig;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public BaseDAO<Long, SysUser> getDAO() {
|
|
public BaseDAO<Long, SysUser> getDAO() {
|
|
@@ -151,16 +153,19 @@ public class SysUserServiceImpl extends BaseServiceImpl<Long, SysUser> implement
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public SysUserInfo registerUser(String phone, String clientId, String loginUserType) {
|
|
public SysUserInfo registerUser(String phone, String clientId, String loginUserType) {
|
|
|
|
+
|
|
|
|
+ SysUserInfo userInfo = null;
|
|
if (StringUtils.equalsIgnoreCase(loginUserType, "TEACHER")) {
|
|
if (StringUtils.equalsIgnoreCase(loginUserType, "TEACHER")) {
|
|
- return registerTeacher(phone);
|
|
|
|
|
|
+ userInfo = registerTeacher(phone);
|
|
} else if (StringUtils.equalsIgnoreCase(loginUserType, "STUDENT")) {
|
|
} else if (StringUtils.equalsIgnoreCase(loginUserType, "STUDENT")) {
|
|
- return registerStudent(phone);
|
|
|
|
|
|
+ userInfo = registerStudent(phone);
|
|
} else if (StringUtils.equalsIgnoreCase(clientId, "TEACHER")) {
|
|
} else if (StringUtils.equalsIgnoreCase(clientId, "TEACHER")) {
|
|
- return registerTeacher(phone);
|
|
|
|
|
|
+ userInfo = registerTeacher(phone);
|
|
} else if (StringUtils.equalsIgnoreCase(clientId, "STUDENT")) {
|
|
} else if (StringUtils.equalsIgnoreCase(clientId, "STUDENT")) {
|
|
- return registerStudent(phone);
|
|
|
|
|
|
+ userInfo = registerStudent(phone);
|
|
}
|
|
}
|
|
- return null;
|
|
|
|
|
|
+
|
|
|
|
+ return userInfo;
|
|
}
|
|
}
|
|
|
|
|
|
private SysUserInfo registerTeacher(String phone) {
|
|
private SysUserInfo registerTeacher(String phone) {
|
|
@@ -177,9 +182,6 @@ public class SysUserServiceImpl extends BaseServiceImpl<Long, SysUser> implement
|
|
sysUser.setUsername("游客" + sysUser.getId());
|
|
sysUser.setUsername("游客" + sysUser.getId());
|
|
sysUserDao.update(sysUser);
|
|
sysUserDao.update(sysUser);
|
|
|
|
|
|
- // 自动添加系统默认IM帐号为好友,并自动发送通知消息
|
|
|
|
- sendSysCustomerServiceFriendMessage(sysUser);
|
|
|
|
-
|
|
|
|
return queryUserInfoByPhone(phone);
|
|
return queryUserInfoByPhone(phone);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -197,9 +199,6 @@ public class SysUserServiceImpl extends BaseServiceImpl<Long, SysUser> implement
|
|
sysUser.setUsername("游客" + sysUser.getId());
|
|
sysUser.setUsername("游客" + sysUser.getId());
|
|
sysUserDao.update(sysUser);
|
|
sysUserDao.update(sysUser);
|
|
|
|
|
|
- // 自动添加系统默认IM帐号为好友,并自动发送通知消息
|
|
|
|
- sendSysCustomerServiceFriendMessage(sysUser);
|
|
|
|
-
|
|
|
|
return queryUserInfoByPhone(phone);
|
|
return queryUserInfoByPhone(phone);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -207,12 +206,13 @@ public class SysUserServiceImpl extends BaseServiceImpl<Long, SysUser> implement
|
|
* 添加系统客服好友消息
|
|
* 添加系统客服好友消息
|
|
* @param sysUser SysUser
|
|
* @param sysUser SysUser
|
|
*/
|
|
*/
|
|
- private void sendSysCustomerServiceFriendMessage(SysUser sysUser) {
|
|
|
|
|
|
+ public void sendSysCustomerServiceFriendMessage(SysUser sysUser) {
|
|
|
|
|
|
try {
|
|
try {
|
|
|
|
|
|
ThreadPool.getExecutor().submit(() -> {
|
|
ThreadPool.getExecutor().submit(() -> {
|
|
|
|
|
|
|
|
+ String customerService = customerServiceConfig.getCustomerService();
|
|
if (StringUtils.isNotEmpty(customerService)) {
|
|
if (StringUtils.isNotEmpty(customerService)) {
|
|
|
|
|
|
List<String> collect = Arrays.stream(customerService.split(",")).collect(Collectors.toList());
|
|
List<String> collect = Arrays.stream(customerService.split(",")).collect(Collectors.toList());
|
|
@@ -228,7 +228,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Long, SysUser> implement
|
|
.userId(sysUser.getId())
|
|
.userId(sysUser.getId())
|
|
.friendIds(Lists.newArrayList(friend.getId()))
|
|
.friendIds(Lists.newArrayList(friend.getId()))
|
|
.build());
|
|
.build());
|
|
- log.info("sendSysCustomerServiceFriendMessage ret={}", JSON.toJSONString(result));
|
|
|
|
|
|
+ log.info("sendSysCustomerServiceFriendMessage mobile={}, ret={}", mobile, JSON.toJSONString(result));
|
|
}
|
|
}
|
|
|
|
|
|
});
|
|
});
|