|
@@ -21,6 +21,7 @@ import com.ym.mec.common.entity.ImResult;
|
|
|
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.redis.service.RedisCache;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.im.ImFeignService;
|
|
|
import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
|
|
@@ -93,6 +94,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
private ClassGroupStudentMapperService classGroupStudentMapperService;
|
|
|
@Autowired
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
+ @Autowired
|
|
|
+ private RedisCache<String, Object> redisCache;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, StudentRegistration> getDAO() {
|
|
@@ -190,6 +193,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public StudentRegistration addStudent(StudentRegistration studentRegistration) throws IOException {
|
|
|
+ String key = "_student_registration";
|
|
|
+ long threadId = Thread.currentThread().getId();
|
|
|
+ if(!redisCache.getLocked(key, threadId, 10)){
|
|
|
+ throw new BizException("系统繁忙,请稍后再试");
|
|
|
+ }
|
|
|
Date date = new Date();
|
|
|
Integer userId = 0;
|
|
|
SysUser sysUser = studentRegistrationDao.getSysUserByPhone(studentRegistration.getParentsPhone());
|
|
@@ -224,8 +232,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
studentRegistration.setCreateTime(date);
|
|
|
studentRegistration.setUpdateTime(date);
|
|
|
studentRegistration.setUserId(sysUser.getId());
|
|
|
- studentRegistrationDao.updateCurrentClass(studentRegistration);
|
|
|
studentRegistrationDao.insert(studentRegistration);
|
|
|
+ studentRegistrationDao.updateCurrentClass(studentRegistration);
|
|
|
//增加报名学生数
|
|
|
musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(), 1);
|
|
|
//报名成功后,发送短信
|
|
@@ -240,6 +248,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
MessageTypeEnum.SMS_APPLY_MESSAGE, map, null, 0, "",
|
|
|
studentRegistration.getParentsName(), subject.getName(), HttpUtil.getSortUrl(studentApplyUrl),
|
|
|
DateUtil.format(musicGroup.getApplyExpireDate(), DateUtil.DATE_FORMAT_MIN), serverPhone);
|
|
|
+
|
|
|
+ redisCache.releaseLocked(key, threadId);
|
|
|
return studentRegistration;
|
|
|
}
|
|
|
|