|
|
@@ -9,6 +9,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
+import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
|
|
|
import com.cyksj.enums.GatewayApiCode;
|
|
|
import com.cyksj.mapper.GroupsRelationMapper;
|
|
|
import com.cyksj.mapper.UserMapper;
|
|
|
@@ -62,6 +63,8 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
|
|
|
private final MailService mailService;
|
|
|
|
|
|
+ private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();
|
|
|
+
|
|
|
@Override
|
|
|
public List<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize) {
|
|
|
User u = userMapper.selectById(userId);
|
|
|
@@ -223,8 +226,18 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
.and(qr -> qr.isNull(GroupsRelation::getAccount).or().eq(GroupsRelation::getAccount, StrUtil.EMPTY))
|
|
|
.eq(GroupsRelation::getId, relationId));
|
|
|
if (update > 0) {
|
|
|
- Long goodsId = relation.getGoodsId();
|
|
|
- mailService.sendCoursewareByGoodsId(goodsId, relation.getTitle(), email);
|
|
|
+ TASK_EXECUTOR.execute(() -> {
|
|
|
+ Long goodsId = relation.getGoodsId();
|
|
|
+ Long rid = relationId;
|
|
|
+ try {
|
|
|
+ mailService.sendCoursewareByGoodsId(goodsId, relation.getTitle(), email);
|
|
|
+ } catch (Exception e) {
|
|
|
+ groupsRelationMapper.update(null, Wrappers.lambdaUpdate(GroupsRelation.class)
|
|
|
+ .set(GroupsRelation::getAccount, null)
|
|
|
+ .eq(GroupsRelation::getId, rid)
|
|
|
+ .and(qr -> qr.isNotNull(GroupsRelation::getAccount).or().ne(GroupsRelation::getAccount, StrUtil.EMPTY)));
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}
|