|
@@ -13,7 +13,6 @@ import com.microsvc.toolkit.middleware.im.message.GroupMemberWrapper;
|
|
|
import com.microsvc.toolkit.middleware.im.message.MessageWrapper;
|
|
|
import com.microsvc.toolkit.middleware.im.message.TencentRequest;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
-import com.ym.mec.auth.api.enums.SysUserType;
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
|
import com.ym.mec.biz.dal.dto.ImGroupDto;
|
|
|
import com.ym.mec.biz.dal.dto.ImGroupMemberDto;
|
|
@@ -142,6 +141,9 @@ public class ImGroupServiceImpl extends BaseServiceImpl<String, ImGroup> impleme
|
|
|
@Autowired
|
|
|
private HistoryMessageTenantService historyMessageTencentService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ImGroupService imGroupService;
|
|
|
+
|
|
|
@Override
|
|
|
public BaseDAO<String, ImGroup> getDAO() {
|
|
|
return imGroupDao;
|
|
@@ -1855,6 +1857,56 @@ public class ImGroupServiceImpl extends BaseServiceImpl<String, ImGroup> impleme
|
|
|
return imGroups.stream().collect(Collectors.toMap(ImGroup::getId, item -> item));
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void deleteGroup() {
|
|
|
+
|
|
|
+ // 100个线程的无界线程池
|
|
|
+ ThreadPoolExecutor executorService = new ThreadPoolExecutor(100, 100,
|
|
|
+ 0L, TimeUnit.MILLISECONDS,
|
|
|
+ new LinkedBlockingQueue<Runnable>());
|
|
|
+
|
|
|
+ log.info("-------------------------------deleteGroup start---------------------------");
|
|
|
+
|
|
|
+
|
|
|
+ List<String> imGroupIds =
|
|
|
+ musicGroupDao.getDelImGroupId();
|
|
|
+ for (String imGroupId : imGroupIds) {
|
|
|
+ executorService.execute(() -> {
|
|
|
+ imGroupService.delGroup(imGroupId);
|
|
|
+ try {
|
|
|
+ Thread.sleep(1000);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ log.error("线程等待异常", e);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ while (executorService.getQueue().size() > 0) {
|
|
|
+ try {
|
|
|
+ log.info("线程池中正在执行的任务数量:{},等待数量:{}", executorService.getActiveCount(),executorService.getQueue().size());
|
|
|
+ Thread.sleep(1000);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ log.error("线程等待异常", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ executorService.shutdown();
|
|
|
+ log.info("------------------------------- deleteGroup end---------------------------");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void delGroup(String imGroupId) {
|
|
|
+ if (StringUtils.isEmpty(imGroupId)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ imGroupCoreService.groupDismiss(imGroupId);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("删除群组失败:{}",imGroupId, e);
|
|
|
+ throw new BizException("删除群组失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private TencentRequest.MessageBody getTimGifElem(String remoteUr,int size,int width,int height) {
|
|
|
if (StringUtils.isEmpty(remoteUr) && size == 0 && width == 0 && height == 0) {
|
|
|
return null;
|