浏览代码

账号注销调整

yuanliang 9 月之前
父节点
当前提交
a7e71aefb9

+ 2 - 2
cooleshow-api/src/main/java/com/yonge/cooleshow/api/feign/AdminFeignService.java

@@ -215,6 +215,6 @@ public interface AdminFeignService {
     @PostMapping("/sysUser/logoffCheck")
     HttpResponseResult<List<String>> accountLogoffCheck(@RequestParam("phone") String phone);
 
-    @PostMapping("/sysUser/dismissFanImGroup")
-    HttpResponseResult<Boolean> dismissFanImGroup(@RequestParam("phone") String phone);
+    @PostMapping("/sysUser/logoffQuitImGroup")
+    HttpResponseResult<Boolean> logoffQuitImGroup(@RequestParam("phone") String phone);
 }

+ 14 - 0
cooleshow-api/src/main/java/com/yonge/cooleshow/api/feign/MallPortalFeignService.java

@@ -1,10 +1,19 @@
 package com.yonge.cooleshow.api.feign;
 
+import com.yonge.cooleshow.api.feign.dto.OmsOrderDetail;
 import com.yonge.cooleshow.api.feign.fallback.MallPortalFeignServiceFallback;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.toolset.feign.config.FeignConfiguration;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.List;
 
 @FeignClient(name = "${app-config.open-feign.mall-portal-server.name:mall-portal-server}", url = "${app-config.open-feign.mall-portal-server.url:}",
         configuration = FeignConfiguration.class, fallback = MallPortalFeignServiceFallback.class)
@@ -28,4 +37,9 @@ public interface MallPortalFeignService {
      */
     @GetMapping("/task/shareProfit")
     HttpResponseResult shareProfit();
+
+
+    @GetMapping("/order/queryOrderList")
+    HttpResponseResult<List<OmsOrderDetail>> queryOrderList(@RequestParam String status,
+                                                            @RequestParam Long userId);
 }

+ 224 - 0
cooleshow-api/src/main/java/com/yonge/cooleshow/api/feign/dto/OmsOrderDetail.java

@@ -0,0 +1,224 @@
+package com.yonge.cooleshow.api.feign.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class OmsOrderDetail {
+
+    private Long id;
+
+    private Long memberId;
+
+    private String couponId;
+
+    @ApiModelProperty("下单平台 STUDENT TEACHER")
+    private String platformType;
+
+    @ApiModelProperty(value = "订单编号")
+    private String orderSn;
+
+    @ApiModelProperty("购物车id(逗号隔开)")
+    private String cartIds;
+
+    @ApiModelProperty(value = "提交时间")
+    private Date createTime;
+
+    @ApiModelProperty(value = "用户帐号")
+    private String memberUsername;
+
+    @ApiModelProperty(value = "订单总金额")
+    private BigDecimal totalAmount;
+
+    @ApiModelProperty(value = "应付金额(实际支付金额)")
+    private BigDecimal payAmount;
+
+    @ApiModelProperty(value = "运费金额")
+    private BigDecimal freightAmount;
+
+    @ApiModelProperty(value = "促销优化金额(促销价、满减、阶梯价)")
+    private BigDecimal promotionAmount;
+
+    @ApiModelProperty(value = "积分抵扣金额")
+    private BigDecimal integrationAmount;
+
+    @ApiModelProperty(value = "优惠券抵扣金额")
+    private BigDecimal couponAmount;
+
+    @ApiModelProperty(value = "管理员后台调整订单使用的折扣金额")
+    private BigDecimal discountAmount;
+
+    @ApiModelProperty(value = "支付方式:0->未支付;1->支付宝;2->微信")
+    private Integer payType;
+
+    @ApiModelProperty(value = "订单来源:0->PC订单;1->app订单")
+    private Integer sourceType;
+
+    @ApiModelProperty(value = "订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单 6 ->未拉起支付")
+    private Integer status;
+
+    @ApiModelProperty(value = "订单类型:0->正常订单;1->秒杀订单")
+    private Integer orderType;
+
+    @ApiModelProperty(value = "物流公司(配送方式)")
+    private String deliveryCompany;
+
+    @ApiModelProperty(value = "物流单号")
+    private String deliverySn;
+
+    @ApiModelProperty(value = "自动确认时间(天)")
+    private Integer autoConfirmDay;
+
+    @ApiModelProperty(value = "可以获得的积分")
+    private Integer integration;
+
+    @ApiModelProperty(value = "可以活动的成长值")
+    private Integer growth;
+
+    @ApiModelProperty(value = "活动信息")
+    private String promotionInfo;
+
+    @ApiModelProperty(value = "发票类型:0->不开发票;1->电子发票;2->纸质发票")
+    private Integer billType;
+
+    @ApiModelProperty(value = "发票抬头")
+    private String billHeader;
+
+    @ApiModelProperty(value = "发票内容")
+    private String billContent;
+
+    @ApiModelProperty(value = "收票人电话")
+    private String billReceiverPhone;
+
+    @ApiModelProperty(value = "收票人邮箱")
+    private String billReceiverEmail;
+
+    @ApiModelProperty(value = "收货人姓名")
+    private String receiverName;
+
+    @ApiModelProperty(value = "收货人电话")
+    private String receiverPhone;
+
+    @ApiModelProperty(value = "收货人邮编")
+    private String receiverPostCode;
+
+    @ApiModelProperty(value = "省份/直辖市")
+    private String receiverProvince;
+
+    @ApiModelProperty(value = "城市")
+    private String receiverCity;
+
+    @ApiModelProperty(value = "区")
+    private String receiverRegion;
+
+    @ApiModelProperty(value = "详细地址")
+    private String receiverDetailAddress;
+
+    @ApiModelProperty(value = "订单备注")
+    private String note;
+
+    @ApiModelProperty(value = "确认收货状态:0->未确认;1->已确认")
+    private Integer confirmStatus;
+
+    @ApiModelProperty(value = "删除状态:0->未删除;1->已删除")
+    private Integer deleteStatus;
+
+    @ApiModelProperty(value = "下单时使用的积分")
+    private Integer useIntegration;
+
+    @ApiModelProperty(value = "支付时间")
+    private Date paymentTime;
+
+    @ApiModelProperty(value = "发货时间")
+    private Date deliveryTime;
+
+    @ApiModelProperty(value = "确认收货时间")
+    private Date receiveTime;
+
+    @ApiModelProperty(value = "评价时间")
+    private Date commentTime;
+
+    @ApiModelProperty("是否能申请售后 0:是 1:否")
+    private int afterSale;
+
+    @ApiModelProperty(value = "修改时间")
+    private Date modifyTime;
+
+    @ApiModelProperty("订单商品列表")
+    private List<OmsOrderItem> orderItemList;
+
+    @Data
+    public static class OmsOrderItem implements Serializable {
+        private Long id;
+
+        @ApiModelProperty(value = "订单id")
+        private Long orderId;
+
+        @ApiModelProperty(value = "订单编号")
+        private String orderSn;
+
+        private Long productId;
+
+        private String productPic;
+
+        private String productName;
+
+        private String productBrand;
+
+        private String productSn;
+
+        @ApiModelProperty("推广人id")
+        private Long promoterId;
+
+        @ApiModelProperty("分享比例(%)")
+        private String shareProportion;
+
+        @ApiModelProperty(value = "销售价格")
+        private BigDecimal productPrice;
+
+        @ApiModelProperty(value = "购买数量")
+        private Integer productQuantity;
+
+        @ApiModelProperty(value = "商品sku编号")
+        private Long productSkuId;
+
+        @ApiModelProperty(value = "商品sku条码")
+        private String productSkuCode;
+
+        @ApiModelProperty(value = "商品分类id")
+        private Long productCategoryId;
+
+        @ApiModelProperty(value = "商品促销名称")
+        private String promotionName;
+
+        @ApiModelProperty(value = "商品促销分解金额")
+        private BigDecimal promotionAmount;
+
+        @ApiModelProperty(value = "优惠券优惠分解金额")
+        private BigDecimal couponAmount;
+
+        @ApiModelProperty(value = "积分优惠分解金额")
+        private BigDecimal integrationAmount;
+
+        @ApiModelProperty(value = "该商品经过优惠后的分解金额")
+        private BigDecimal realAmount;
+
+        private Integer giftIntegration;
+
+        private Integer giftGrowth;
+
+        @ApiModelProperty(value = "商品销售属性:[{'key':'颜色','value':'颜色'},{'key':'容量','value':'4G'}]")
+        private String productAttr;
+
+        @ApiModelProperty("退货状态:-1 ->未退款;0->待处理;1->退货中;2->已完成;3->已拒绝")
+        private Integer returnStatus;
+
+        private BigDecimal precisionAmount;
+
+    }
+}

+ 1 - 1
cooleshow-api/src/main/java/com/yonge/cooleshow/api/feign/fallback/AdminFeignServiceFallback.java

@@ -212,7 +212,7 @@ public class AdminFeignServiceFallback implements AdminFeignService {
     }
 
     @Override
-    public HttpResponseResult<Boolean> dismissFanImGroup(String phone) {
+    public HttpResponseResult<Boolean> logoffQuitImGroup(String phone) {
         return null;
     }
 }

+ 8 - 0
cooleshow-api/src/main/java/com/yonge/cooleshow/api/feign/fallback/MallPortalFeignServiceFallback.java

@@ -2,8 +2,11 @@ package com.yonge.cooleshow.api.feign.fallback;
 
 
 import com.yonge.cooleshow.api.feign.MallPortalFeignService;
+import com.yonge.cooleshow.api.feign.dto.OmsOrderDetail;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 
+import java.util.List;
+
 /**
  * Description
  *
@@ -25,4 +28,9 @@ public class MallPortalFeignServiceFallback implements MallPortalFeignService {
     public HttpResponseResult shareProfit() {
         return null;
     }
+
+    @Override
+    public HttpResponseResult<List<OmsOrderDetail>> queryOrderList(String status, Long userId) {
+        return null;
+    }
 }

+ 3 - 4
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/SysUserController.java

@@ -5,7 +5,6 @@ import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -31,9 +30,9 @@ public class SysUserController extends BaseController {
         return HttpResponseResult.succeed(strings);
     }
 
-    @PostMapping("/sysUser/dismissFanImGroup")
-    HttpResponseResult<Boolean> dismissFanImGroup(@RequestParam("phone") String phone){
-        sysUserService.dismissFanImGroup(phone);
+    @PostMapping("/sysUser/logoffQuitImGroup")
+    HttpResponseResult<Boolean> logoffQuitImGroup(@RequestParam("phone") String phone){
+        sysUserService.logoffQuitImGroup(phone);
         return HttpResponseResult.succeed(true);
     }
 

+ 2 - 2
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/service/impl/SysUserServiceImpl.java

@@ -448,8 +448,8 @@ public class SysUserServiceImpl extends BaseServiceImpl<Long, SysUser> implement
         if(i < 1){
             throw new BizException("用户不存在或已注销");
         }
-        // 解散群
-        adminFeignService.dismissFanImGroup(phone);
+        // 解散群、退群、删除好友关系
+        adminFeignService.logoffQuitImGroup(phone);
 
         //退出登录
         tokenService.revokeTokenByPhone(phone);

+ 9 - 0
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/OmsPortalOrderController.java

@@ -1,5 +1,6 @@
 package com.yonge.cooleshow.portal.controller;
 
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.mall.common.api.CommonPage;
 import com.yonge.cooleshow.mall.common.api.CommonResult;
 import com.yonge.cooleshow.mall.common.enums.OrderCacheEnum;
@@ -115,6 +116,14 @@ public class OmsPortalOrderController {
         return CommonResult.success(orderPage);
     }
 
+    /**
+     * feign 接口
+     */
+    @RequestMapping(value = "/queryOrderList", method = RequestMethod.GET)
+    HttpResponseResult<List<OmsOrderDetail>> queryOrderList(@RequestParam String status, @RequestParam Long userId) {
+        return HttpResponseResult.succeed(portalOrderService.queryOrderList(userId, status));
+    }
+
     @ApiOperation("根据ID获取订单详情")
     @RequestMapping(value = "/detail/{orderId}", method = RequestMethod.GET)
     @ResponseBody

+ 2 - 0
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/OmsPortalOrderService.java

@@ -161,4 +161,6 @@ public interface OmsPortalOrderService {
      * @return
      */
     Boolean lockSku(Long skuId, String platform, Boolean lockState);
+
+    List<OmsOrderDetail> queryOrderList(Long userId, String status);
 }

+ 34 - 0
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/impl/OmsPortalOrderServiceImpl.java

@@ -88,6 +88,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
@@ -664,6 +665,39 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
     }
 
     @Override
+    public List<OmsOrderDetail> queryOrderList(Long userId, String status) {
+        OmsOrderExample orderExample = new OmsOrderExample();
+        OmsOrderExample.Criteria criteria = orderExample.createCriteria();
+        criteria.andMemberIdEqualTo(userId);
+        if (!StringUtils.isEmpty(status)) {
+            List<Integer> statusList = Arrays.stream(status.split(",")).map(Integer::valueOf).collect(Collectors.toList());
+            criteria.andStatusIn(statusList);
+        }
+        List<OmsOrder> omsOrders = orderMapper.selectByExample(orderExample);
+        if (omsOrders.isEmpty()) {
+            return new ArrayList<>();
+        }
+
+        //设置数据信息
+        List<Long> orderIds = omsOrders.stream().map(OmsOrder::getId).collect(Collectors.toList());
+        OmsOrderItemExample orderItemExample = new OmsOrderItemExample();
+        orderItemExample.createCriteria().andOrderIdIn(orderIds);
+        List<OmsOrderItem> orderItemList = orderItemMapper.selectByExample(orderItemExample);
+        List<OmsOrderDetail> orderDetailList = new ArrayList<>();
+        for (OmsOrder omsOrder : omsOrders) {
+            OmsOrderDetail orderDetail = new OmsOrderDetail();
+            BeanUtil.copyProperties(omsOrder, orderDetail);
+            List<OmsOrderItem> relatedItemList = orderItemList.stream()
+                    .filter(item -> item.getOrderId()
+                            .equals(orderDetail.getId()))
+                    .collect(Collectors.toList());
+            orderDetail.setOrderItemList(relatedItemList);
+            orderDetailList.add(orderDetail);
+        }
+        return orderDetailList;
+    }
+
+    @Override
     public OmsOrderDetail detail(Long orderId) {
         OmsOrder omsOrder = orderMapper.selectByPrimaryKey(orderId);
         OmsOrderItemExample example = new OmsOrderItemExample();

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/SysUserService.java

@@ -45,5 +45,5 @@ public interface SysUserService{
 
     List<String> accountLogoffCheck(String phone);
 
-    void dismissFanImGroup(String phone);
+    void logoffQuitImGroup(String phone);
 }

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

@@ -1,12 +1,16 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
+import com.dayaedu.cbs.common.enums.EClientType;
 import com.google.common.collect.Lists;
+import com.yonge.cooleshow.api.feign.MallPortalFeignService;
+import com.yonge.cooleshow.api.feign.dto.OmsOrderDetail;
 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.CourseGroup;
 import com.yonge.cooleshow.biz.dal.entity.ImGroup;
 import com.yonge.cooleshow.biz.dal.entity.ImGroupMember;
+import com.yonge.cooleshow.biz.dal.entity.ImUserFriend;
 import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.entity.Teacher;
 import com.yonge.cooleshow.biz.dal.entity.UserOrder;
@@ -29,12 +33,10 @@ 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 lombok.extern.slf4j.Slf4j;
 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.math.BigDecimal;
@@ -92,6 +94,12 @@ public class SysUserServiceImpl implements SysUserService {
     @Autowired
     private UserAccountService userAccountService;
 
+    @Autowired
+    private MallPortalFeignService mallPortalFeignService;
+
+    @Autowired
+    private ImUserFriendService imUserFriendService;
+
     @Override
     public SysUserMapper getDao() {
         return sysUserMapper;
@@ -233,20 +241,8 @@ public class SysUserServiceImpl implements SysUserService {
         Long userId = sysUser.getId();
 
         // 存在待支付、未确认收货、售后处理的订单
-        Integer count = userOrderService.lambdaQuery()
-                .eq(UserOrder::getUserId, userId)
-                .in(UserOrder::getStatus, Arrays.asList(OrderStatusEnum.WAIT_PAY, OrderStatusEnum.PAYING, OrderStatusEnum.PAID))
-                .count();
-        if (count > 0) {
+        if(hasUnfinishedOrder(userId)){
             errMsg.add("账户存在未支付、未确认收货、售后处理中的订单");
-        } else {
-            Integer refundCount = userOrderRefundService.lambdaQuery()
-                    .eq(UserOrderRefund::getUserId, userId)
-                    .eq(UserOrderRefund::getStatus, AuthStatusEnum.DOING)
-                    .count();
-            if (refundCount > 0) {
-                errMsg.add("账户存在未支付、未确认收货、售后处理中的订单");
-            }
         }
 
         Teacher teacher = teacherService.getById(userId);
@@ -292,34 +288,101 @@ public class SysUserServiceImpl implements SysUserService {
         return errMsg;
     }
 
+    private boolean hasUnfinishedOrder(Long userId) {
+        // 商城订单 0->待付款;1->待发货;2->已发货
+        HttpResponseResult<List<OmsOrderDetail>> httpResponseResult = mallPortalFeignService.queryOrderList("0,1,2", userId);
+        if (httpResponseResult == null) {
+            throw new BizException("检查订单信息失败");
+        }
+        List<OmsOrderDetail> data = httpResponseResult.getData();
+        if (!CollectionUtils.isEmpty(data)) {
+            return true;
+        }
+
+        // 酷乐秀订单
+        Integer count = userOrderService.lambdaQuery()
+                .eq(UserOrder::getUserId, userId)
+                .in(UserOrder::getStatus, Arrays.asList(OrderStatusEnum.WAIT_PAY, OrderStatusEnum.PAYING))
+                .count();
+        if (count > 0) {
+            return true;
+        }
+        Integer refundCount = userOrderRefundService.lambdaQuery()
+                .eq(UserOrderRefund::getUserId, userId)
+                .eq(UserOrderRefund::getStatus, AuthStatusEnum.DOING)
+                .count();
+        return refundCount > 0;
+    }
+
+    /**
+     * 账号注销,群聊处理
+     * 学生:退群,删除好友关系
+     * 老师:非机构群 群主,注销群,删除好友
+     */
     @Override
-    public void dismissFanImGroup(String phone) {
+    public void logoffQuitImGroup(String phone) {
         SysUser sysUser = this.getDao().findUserByPhone(phone);
         if (sysUser == null) {
             return;
         }
-        Teacher teacher = teacherService.getById(sysUser.getId());
-        if (teacher == null) {
-            return;
-        }
-        List<ImGroupMember> groupMembers = imGroupMemberService.lambdaQuery()
-                .eq(ImGroupMember::getUserId, sysUser.getId())
-                .eq(ImGroupMember::getGroupRoleType, EImGroupMemberRoleType.Owner)
-                .list();
-        List<String> groupIdList = groupMembers.stream().map(ImGroupMember::getGroupId).collect(Collectors.toList());
-        if (groupIdList.isEmpty()) {
-            return;
+        Long userId = sysUser.getId();
+        Student student = studentService.getById(userId);
+        if (student != null) {
+            List<ImGroupMember> groupMembers = imGroupMemberService.lambdaQuery()
+                    .eq(ImGroupMember::getUserId, sysUser.getId())
+                    .eq(ImGroupMember::getGroupRoleType, EImGroupMemberRoleType.Member)
+                    .list();
+            List<String> groupIdList = groupMembers.stream().map(ImGroupMember::getGroupId).collect(Collectors.toList());
+            // 退群
+            for (String groupId : groupIdList) {
+                try {
+                    imGroupService.quit(groupId, userId, ClientEnum.STUDENT, true);
+                } catch (Exception e) {
+                    log.error("学生注销退群失败->学生:" + userId + "," + e.getMessage());
+                }
+            }
+            // 删除好友
+            imUserFriendService.lambdaUpdate()
+                    .eq(ImUserFriend::getUserId, userId)
+                    .eq(ImUserFriend::getClientType, EClientType.STUDENT)
+                    .remove();
+            imUserFriendService.lambdaUpdate()
+                    .eq(ImUserFriend::getFriendId, userId)
+                    .eq(ImUserFriend::getFriendType, EClientType.STUDENT)
+                    .remove();
         }
-        Collection<ImGroup> imGroups = imGroupService.listByIds(groupIdList);
-        List<String> groupIds = imGroups.stream().filter(next -> ImGroupType.FAN.equals(next.getType()) || ImGroupType.COURSE.equals(next.getType()))
-                .map(ImGroup::getId).collect(Collectors.toList());
-
-        for (String groupId : groupIds) {
-            try {
-                imGroupService.dismiss(groupId);
-            } catch (Exception e) {
-                log.error("群解散失败:" + groupId);
+
+
+        Teacher teacher = teacherService.getById(sysUser.getId());
+        if (teacher != null) {
+            List<ImGroupMember> groupMembers = imGroupMemberService.lambdaQuery()
+                    .eq(ImGroupMember::getUserId, sysUser.getId())
+                    .eq(ImGroupMember::getGroupRoleType, EImGroupMemberRoleType.Owner)
+                    .list();
+            List<String> groupIdList = groupMembers.stream().map(ImGroupMember::getGroupId).collect(Collectors.toList());
+            if (groupIdList.isEmpty()) {
+                return;
+            }
+            Collection<ImGroup> imGroups = imGroupService.listByIds(groupIdList);
+            List<String> groupIds = imGroups.stream().filter(next -> ImGroupType.FAN.equals(next.getType()) || ImGroupType.COURSE.equals(next.getType()))
+                    .map(ImGroup::getId).collect(Collectors.toList());
+
+            for (String groupId : groupIds) {
+                try {
+                    imGroupService.dismiss(groupId);
+                } catch (Exception e) {
+                    log.error("群解散失败:" + groupId);
+                }
             }
+            // 删除好友
+            imUserFriendService.lambdaUpdate()
+                    .eq(ImUserFriend::getUserId, userId)
+                    .eq(ImUserFriend::getClientType, EClientType.TEACHER)
+                    .remove();
+            imUserFriendService.lambdaUpdate()
+                    .eq(ImUserFriend::getFriendId, userId)
+                    .eq(ImUserFriend::getFriendType, EClientType.TEACHER)
+                    .remove();
         }
     }
 }