|
@@ -1,28 +1,38 @@
|
|
|
package com.yonge.cooleshow.biz.dal.service.impl;
|
|
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
import com.yonge.cooleshow.auth.api.dto.RealnameAuthReq;
|
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.Student;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.Teacher;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
|
import com.yonge.cooleshow.biz.dal.mapper.SysUserMapper;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.StudentService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.SysUserContractRecordService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.SysUserService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.TeacherService;
|
|
|
+import com.yonge.cooleshow.biz.dal.wrapper.UserInfoWrapper;
|
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
import com.yonge.cooleshow.common.enums.ContractTemplateTypeEnum;
|
|
|
import com.yonge.cooleshow.common.enums.SysUserType;
|
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
|
+import com.yonge.toolset.thirdparty.message.MessageSenderPluginContext;
|
|
|
import com.yonge.toolset.thirdparty.user.realname.RealnameAuthenticationPlugin;
|
|
|
import com.yonge.toolset.utils.idcard.IdcardInfoExtractor;
|
|
|
import com.yonge.toolset.utils.idcard.IdcardValidator;
|
|
|
+import jodd.util.StringUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Optional;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class SysUserServiceImpl implements SysUserService {
|
|
@@ -38,6 +48,15 @@ public class SysUserServiceImpl implements SysUserService {
|
|
|
@Resource
|
|
|
private SysUserContractRecordService sysUserContractRecordService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StudentService studentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TeacherService teacherService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MessageSenderPluginContext messageSenderPluginContext;
|
|
|
+
|
|
|
@Override
|
|
|
public SysUserMapper getDao() {
|
|
|
return sysUserMapper;
|
|
@@ -141,4 +160,54 @@ public class SysUserServiceImpl implements SysUserService {
|
|
|
public SysUser getByUserId(Long userId) {
|
|
|
return sysUserMapper.getByUserId(userId);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void imDeviceId(UserInfoWrapper.UpdateUser info) {
|
|
|
+
|
|
|
+ String teacherDeviceId = null;
|
|
|
+ String studentDeviceId = null;
|
|
|
+
|
|
|
+ switch (info.getClient()) {
|
|
|
+ case STUDENT:
|
|
|
+ case TENANT_STUDENT:
|
|
|
+ studentDeviceId = info.getImDeviceId();
|
|
|
+ Student student = new Student();
|
|
|
+ student.setUserId(info.getUserId().longValue());
|
|
|
+ student.setImDeviceId(info.getImDeviceId());
|
|
|
+ studentService.updateById(student);
|
|
|
+
|
|
|
+ Teacher teacher1 = teacherService.getById(info.getUserId().longValue());
|
|
|
+ if (teacher1 != null) {
|
|
|
+ if (StringUtils.isEmpty(teacher1.getImDeviceId())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ teacherDeviceId = teacher1.getImDeviceId();
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ case TEACHER:
|
|
|
+ teacherDeviceId = info.getImDeviceId();
|
|
|
+ Teacher teacher = new Teacher();
|
|
|
+ teacher.setUserId(info.getUserId().longValue());
|
|
|
+ teacher.setImDeviceId(info.getImDeviceId());
|
|
|
+ teacherService.updateById(teacher);
|
|
|
+
|
|
|
+ Student student1 = studentService.getById(info.getUserId().longValue());
|
|
|
+ if (student1 != null) {
|
|
|
+ if (StringUtils.isEmpty(student1.getImDeviceId())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ studentDeviceId = student1.getImDeviceId();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ List<String> list = Lists.newArrayList(studentDeviceId, teacherDeviceId).stream()
|
|
|
+ .filter(StringUtil::isNotBlank).collect(Collectors.toList());
|
|
|
+
|
|
|
+ messageSenderPluginContext.getMessageSenderPlugin(MessageSenderPluginContext.MessageSender.JIGUANG)
|
|
|
+ .deviceRemoveAlias(info.getUserId().toString(),list,info.getClient().getCode());
|
|
|
+ }
|
|
|
}
|