Browse Source

Merge branch 'feature/0822_logoff' into develop-new

liujc 1 month ago
parent
commit
7caee30948

+ 6 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/SysUserController.java

@@ -1,9 +1,12 @@
 package com.yonge.cooleshow.admin.controller;
 
+import com.google.common.collect.Lists;
 import com.yonge.cooleshow.api.feign.dto.ApiWrapper;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.service.SysUserService;
+import com.yonge.cooleshow.biz.dal.service.im.ImGroupCoreService;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
@@ -25,6 +28,9 @@ public class SysUserController extends BaseController {
     @Autowired
     private SysUserFeignService sysUserFeignService;
 
+    @Autowired
+    private ImGroupCoreService imGroupCoreService;
+
     /**
      * 账号注销校验
      */

+ 27 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/ImUserFriendController.java

@@ -7,8 +7,10 @@ import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.entity.ImUserFriend;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.enums.MK;
+import com.yonge.cooleshow.biz.dal.mapper.SysUserMapper;
 import com.yonge.cooleshow.biz.dal.service.ImGroupService;
 import com.yonge.cooleshow.biz.dal.service.ImUserFriendService;
+import com.yonge.cooleshow.biz.dal.service.SysUserService;
 import com.yonge.cooleshow.biz.dal.vo.im.ImUserFriendVO;
 import com.yonge.cooleshow.biz.dal.wrapper.im.ImUserWrapper;
 import com.yonge.cooleshow.common.controller.BaseController;
@@ -50,6 +52,9 @@ public class ImUserFriendController extends BaseController {
     @Autowired
     private ImGroupService imGroupService;
 
+    @Autowired
+    private SysUserMapper sysUserMapper;
+
     @ApiImplicitParams({
             @ApiImplicitParam(name = "search", dataType = "String", value = "根据用户编号、昵称模糊查询")
     })
@@ -111,5 +116,27 @@ public class ImUserFriendController extends BaseController {
 
         return succeed(userFriend);
     }
+
+
+    @ApiOperation("获取聊天用户详情")
+    @PostMapping(value = "/getMessageUser/{userId}")
+    public HttpResponseResult<ImUserFriendVO.ImMessageUser> getMessageUser(@ApiParam(value = "用户编号", required = true) @PathVariable("userId") String userId) {
+
+
+        // 用户ID
+        long id = Long.parseLong(imGroupService.analysisImUserId(userId));
+
+        SysUser byUserId = sysUserMapper.getByUserId(id);
+
+        ImUserFriendVO.ImMessageUser imMessageUser = new ImUserFriendVO.ImMessageUser();
+        imMessageUser.setImUserId(userId);
+        imMessageUser.setDelFlag(true);
+        if (byUserId !=null) {
+            imMessageUser.setUserId(byUserId.getId());
+            imMessageUser.setDelFlag(byUserId.getDelFlag());
+        }
+        return succeed(imMessageUser);
+
+    }
 }
 

+ 25 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/ImUserFriendController.java

@@ -2,9 +2,11 @@ package com.yonge.cooleshow.teacher.controller;
 
 
 import com.alibaba.fastjson.JSON;
+import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.entity.ImUserFriend;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.enums.MK;
+import com.yonge.cooleshow.biz.dal.mapper.SysUserMapper;
 import com.yonge.cooleshow.biz.dal.service.ImGroupService;
 import com.yonge.cooleshow.biz.dal.service.ImUserFriendService;
 import com.yonge.cooleshow.biz.dal.service.SysUserService;
@@ -50,6 +52,9 @@ public class ImUserFriendController extends BaseController {
     @Autowired
     private ImGroupService imGroupService;
 
+    @Autowired
+    private SysUserMapper sysUserMapper;
+
     @SuppressWarnings("unchecked")//因为返回是集合,这里提示你集合内容较多排序可能回耗费性能
     @ApiImplicitParams({
             @ApiImplicitParam(name = "search", dataType = "String", value = "根据用户编号、昵称模糊查询")
@@ -113,5 +118,25 @@ public class ImUserFriendController extends BaseController {
         return succeed(userFriend);
     }
 
+    @ApiOperation("获取聊天用户详情")
+    @PostMapping(value = "/getMessageUser/{userId}")
+    public HttpResponseResult<ImUserFriendVO.ImMessageUser> getMessageUser(@ApiParam(value = "用户编号", required = true) @PathVariable("userId") String userId) {
+
+
+        // 用户ID
+        long id = Long.parseLong(imGroupService.analysisImUserId(userId));
+
+        SysUser byUserId = sysUserMapper.getByUserId(id);
+
+        ImUserFriendVO.ImMessageUser imMessageUser = new ImUserFriendVO.ImMessageUser();
+        imMessageUser.setImUserId(userId);
+        imMessageUser.setDelFlag(true);
+        if (byUserId !=null) {
+            imMessageUser.setUserId(byUserId.getId());
+            imMessageUser.setDelFlag(byUserId.getDelFlag());
+        }
+        return succeed(imMessageUser);
+
+    }
 }
 

+ 2 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/im/ImGroupCoreService.java

@@ -98,6 +98,8 @@ public interface ImGroupCoreService {
      */
     void  accountDelete(List<String> imUserIds);
 
+    void  messageDelete(String imUserId, List<String> toImUserIds);
+
     /**
      * 用户主动退出群聊
      * @param userId 用户信息

+ 18 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/im/impl/ImGroupCoreServiceImpl.java

@@ -413,6 +413,24 @@ public class ImGroupCoreServiceImpl implements ImGroupCoreService {
 
     }
 
+
+    @Override
+    public void  messageDelete(String imUserId,List<String> toImUserIds) {
+        if (CollectionUtils.isEmpty(toImUserIds)) {
+            return;
+        }
+
+        for (String toImUserId : toImUserIds) {
+            try {
+                imPluginContext.getPluginService().deletePrivateRecentContact(imUserId,null);
+            } catch (Exception e) {
+                log.error("messageDelete error",e);
+            }
+
+        }
+
+    }
+
     /**
      * 用户主动退出群聊
      *

+ 1 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseHomeworkServiceImpl.java

@@ -154,6 +154,7 @@ public class CourseHomeworkServiceImpl extends ServiceImpl<CourseHomeworkDao, Co
                 record.setStudentId(courseHomeworkVo.getStudentId());
                 record.setStudentAvatar(courseHomeworkVo.getStudentAvatar());
                 record.setStudentName(courseHomeworkVo.getStudentName());
+                record.setDelFlag(courseHomeworkVo.getDelFlag());
             }
             courseHomeworkVoList = teacherCollect.get(record.getCourseId());
             if (!CollectionUtils.isEmpty(courseHomeworkVoList)) {

+ 2 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/SysUserServiceImpl.java

@@ -493,7 +493,7 @@ public class SysUserServiceImpl implements SysUserService {
                     .remove();
 
             // 注销三方im
-            imGroupCoreService.accountDelete(Lists.newArrayList(imGroupCoreService.getImUserId(userId, ClientEnum.STUDENT)));
+//            imGroupCoreService.accountDelete(Lists.newArrayList(imGroupCoreService.getImUserId(userId, ClientEnum.STUDENT)));
         }
 
 
@@ -528,7 +528,7 @@ public class SysUserServiceImpl implements SysUserService {
                     .eq(ImUserFriend::getFriendType, EClientType.TEACHER)
                     .remove();
             // 注销三方im
-            imGroupCoreService.accountDelete(Lists.newArrayList(imGroupCoreService.getImUserId(userId, ClientEnum.TEACHER)));
+//            imGroupCoreService.accountDelete(Lists.newArrayList(imGroupCoreService.getImUserId(userId, ClientEnum.TEACHER)));
         }
     }
     public EClientType getClientType(String jpushType){

+ 14 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/CourseHomeworkVo.java

@@ -74,6 +74,9 @@ public class CourseHomeworkVo{
 	@ApiModelProperty("学员头像")
 	private String studentAvatar;
 
+    @ApiModelProperty("是否注销")
+    private Boolean delFlag = false;
+
 	@ApiModelProperty("老师id")
 	private Long teacherId;
 
@@ -95,7 +98,17 @@ public class CourseHomeworkVo{
 	@ApiModelProperty("IM用户ID")
 	private String imUserId;
 
-	public String getImGroupId() {
+
+
+    public Boolean getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(Boolean delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    public String getImGroupId() {
 		return imGroupId;
 	}
 

+ 13 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/MyCourseVo.java

@@ -21,6 +21,11 @@ public class MyCourseVo implements Serializable {
     @ApiModelProperty(value = "用户姓名")
     private String userName;
 
+
+    @ApiModelProperty("是否注销")
+    private Boolean delFlag = false;
+
+
     private String realName;
 
     @ApiModelProperty(value = "头像地址")
@@ -62,6 +67,14 @@ public class MyCourseVo implements Serializable {
     @ApiModelProperty(value = "IM聊天用户ID")
     private String imUserId;
 
+
+    public Boolean getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(Boolean delFlag) {
+        this.delFlag = delFlag;
+    }
     public Integer getStudentReplied() {
         return studentReplied;
     }

+ 11 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/StudentHomeworkVo.java

@@ -32,6 +32,17 @@ public class StudentHomeworkVo {
     @ApiModelProperty("NOTCOMMIT:未提交 ,NOTREVIEW: 未评价 REVIEWED:已评价")
     private HomeworkStatusEnum homeworkStatus;
 
+    @ApiModelProperty("是否注销")
+    private Boolean delFlag = false;
+
+    public Boolean getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(Boolean delFlag) {
+        this.delFlag = delFlag;
+    }
+
     public HomeworkStatusEnum getHomeworkStatus() {
         return homeworkStatus;
     }

+ 21 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/im/ImUserFriendVO.java

@@ -128,4 +128,25 @@ public class ImUserFriendVO {
             return Optional.ofNullable(getImUserId()).orElse(userId);
         }
     }
+
+
+    /**
+     * 用户好友信息
+     */
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class ImMessageUser implements Serializable {
+
+
+        @ApiModelProperty(value = "当前用户编号")
+        private Long userId;
+
+        @ApiModelProperty(value = "imUserId")
+        private String imUserId;
+
+        @ApiModelProperty("是否注销")
+        private Boolean delFlag = false;
+    }
+
 }

+ 2 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseHomeworkMapper.xml

@@ -265,6 +265,7 @@
         cssp.user_id_ as studentId
         ,su.username_ as studentName
         ,su.avatar_ as studentAvatar
+        ,su.del_flag_ as delFlag
         from course_schedule cs
         left join  course_schedule_student_payment cssp on cssp.course_id_ = cs.id_
         left join sys_user su on cssp.user_id_ = su.id_
@@ -349,6 +350,7 @@
         s.id_ as studentId,
         s.username_ as studentName,
         s.avatar_ as studentAvatar,
+        s.del_flag_ as delFlag,
         if(sch.id_ is not null,1,0) as submitHomework,
         (case when sch.id_ is null then 'NOTCOMMIT'
         when sch.teacher_replied_ is null or sch.teacher_replied_ = '' then 'NOTREVIEW'

+ 1 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -195,6 +195,7 @@
             cs.status_ AS `status`,
             g.subject_id_ AS subjectId,
             sb.name_ AS subjectName,
+            u.del_flag_ as delFlag,
             p.course_id_ AS courseId,
             p.course_group_id_ AS courseGoupId,
             (r.student_replied_ IS NOT NULL) AS studentReplied,

+ 1 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/SysUserMapper.xml

@@ -117,6 +117,7 @@
                username_ as username,
                password_ as password,
                salt_ as salt,
+        del_flag_ as delFlag,
                phone_ as phone,
                avatar_ as avatar,
                lock_flag_ as lockFlag,