|
@@ -20,12 +20,14 @@ import com.ym.mec.common.entity.ImUserModel;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.page.QueryInfo;
|
|
|
+import com.ym.mec.common.redis.service.RedisCache;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.im.ImFeignService;
|
|
|
import com.ym.mec.jiari.JiaRiFeignService;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateConvertor;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
+
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -101,6 +103,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
@Autowired
|
|
|
private StudentApplyRefundsDao studentApplyRefundsDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisCache<String, Object> redisCache;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Integer, ClassGroup> getDAO() {
|
|
@@ -263,7 +267,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public List<HighClassGroupDto> addHighClassGroup(List<HighClassGroupDto> highClassGroupList) throws Exception {
|
|
|
- MusicGroup musicGroup = musicGroupDao.getLocked(highClassGroupList.get(0).getMusicGroupId());
|
|
|
+ String key = "addHighClassGroup";
|
|
|
+ long value = Thread.currentThread().getId();
|
|
|
+ redisCache.getLocked(key, value, 30);
|
|
|
+ MusicGroup musicGroup = musicGroupDao.get(highClassGroupList.get(0).getMusicGroupId());
|
|
|
|
|
|
int highClassGroupNum = studentRegistrationDao.findMusicGroupStudentNum(musicGroup.getId()) / 5;
|
|
|
if (highClassGroupList.size() > highClassGroupNum) {
|
|
@@ -372,6 +379,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
//加入Im群组
|
|
|
addImGroup(highClassGroup, userIdList);
|
|
|
}
|
|
|
+ redisCache.releaseLocked(key, value);
|
|
|
return highClassGroupList;
|
|
|
}
|
|
|
|