|
|
@@ -2,13 +2,15 @@ package com.xjrsoft.module.courseTable.service.impl;
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
import com.xjrsoft.common.exception.MyException;
|
|
|
-import com.xjrsoft.module.activity.dto.ChangeStatusDto;
|
|
|
+import com.xjrsoft.module.concat.service.IXjrUserService;
|
|
|
+import com.xjrsoft.module.courseTable.dto.UserEnrollDto;
|
|
|
import com.xjrsoft.module.courseTable.dto.AddSecondCourseDto;
|
|
|
import com.xjrsoft.module.courseTable.dto.SecondCourseEnrollPageDto;
|
|
|
import com.xjrsoft.module.courseTable.dto.SecondCoursePageDto;
|
|
|
@@ -24,6 +26,7 @@ import com.xjrsoft.module.courseTable.mapper.SecondCourseTimeMapper;
|
|
|
import com.xjrsoft.module.courseTable.service.ISecondCourseService;
|
|
|
import com.xjrsoft.module.courseTable.vo.SecondCourseEnrollVo;
|
|
|
import com.xjrsoft.module.courseTable.vo.SecondCoursePageVo;
|
|
|
+import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -46,7 +49,7 @@ public class SecondCourseServiceImpl extends MPJBaseServiceImpl<SecondCourseMapp
|
|
|
private final SecondCourseTimeMapper courseTimeMapper;
|
|
|
private final SecondCourseEnrollRangeMapper enrollRangeMapper;
|
|
|
private final SecondCourseEnrollMapper enrollMapper;
|
|
|
-
|
|
|
+ private final IXjrUserService xjrUserService;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@@ -172,14 +175,14 @@ public class SecondCourseServiceImpl extends MPJBaseServiceImpl<SecondCourseMapp
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Boolean enroll(ChangeStatusDto dto) {
|
|
|
+ public Boolean enroll(UserEnrollDto dto) {
|
|
|
List<SecondCourseEnroll> enrollList = enrollMapper.selectList(
|
|
|
new QueryWrapper<SecondCourseEnroll>().lambda()
|
|
|
.eq(SecondCourseEnroll::getUserId, StpUtil.getLoginIdAsLong())
|
|
|
.eq(SecondCourseEnroll::getSecondCourseId, dto.getId())
|
|
|
);
|
|
|
if(!enrollList.isEmpty()){
|
|
|
- throw new MyException("已报名,无需重复报名");
|
|
|
+ throw new MyException("已报名,无需重复报名");
|
|
|
}
|
|
|
SecondCourseEnroll enroll = new SecondCourseEnroll() {{
|
|
|
setUserId(StpUtil.getLoginIdAsLong());
|
|
|
@@ -187,7 +190,11 @@ public class SecondCourseServiceImpl extends MPJBaseServiceImpl<SecondCourseMapp
|
|
|
}};
|
|
|
enrollMapper.insert(enroll);
|
|
|
|
|
|
-
|
|
|
+ XjrUser xjrUser = xjrUserService.getById(StpUtil.getLoginIdAsLong());
|
|
|
+ if(StrUtil.isNotEmpty(dto.getMobile()) && !dto.getMobile().equals(xjrUser.getMobile())){
|
|
|
+ xjrUser.setMobile(dto.getMobile());
|
|
|
+ xjrUserService.updateById(xjrUser);
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
|