|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.common.BaseConstants;
|
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|
|
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
|
@ -21,6 +22,9 @@ import cn.iocoder.yudao.module.course.entity.SchoolCourseOrder;
|
|
|
|
import cn.iocoder.yudao.module.course.service.ProcessService;
|
|
|
|
import cn.iocoder.yudao.module.course.service.ProcessService;
|
|
|
|
import cn.iocoder.yudao.module.course.service.SchoolCourseOrderService;
|
|
|
|
import cn.iocoder.yudao.module.course.service.SchoolCourseOrderService;
|
|
|
|
import cn.iocoder.yudao.module.staff.service.UniqueCodeService;
|
|
|
|
import cn.iocoder.yudao.module.staff.service.UniqueCodeService;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
@ -38,6 +42,8 @@ import java.util.Comparator;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_CUS;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 驾校学员 Service 实现类
|
|
|
|
* 驾校学员 Service 实现类
|
|
|
|
*
|
|
|
|
*
|
|
|
|
@ -61,11 +67,33 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private UniqueCodeService uniqueCodeService;
|
|
|
|
private UniqueCodeService uniqueCodeService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AdminUserApi adminUserApi;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public String createDlDriveSchoolStudent(DlDriveSchoolStudentVO createReqVO) {
|
|
|
|
public String createDlDriveSchoolStudent(DlDriveSchoolStudentVO createReqVO) {
|
|
|
|
// 插入
|
|
|
|
// 插入
|
|
|
|
DlDriveSchoolStudent dlDriveSchoolStudent = BeanUtils.toBean(createReqVO, DlDriveSchoolStudent.class);
|
|
|
|
DlDriveSchoolStudent dlDriveSchoolStudent = BeanUtils.toBean(createReqVO, DlDriveSchoolStudent.class);
|
|
|
|
DlDriveSchoolStudent studentByIdCard = this.getStudentByIdCard(dlDriveSchoolStudent.getIdCard());
|
|
|
|
DlDriveSchoolStudent studentByIdCard = this.getStudentByIdCard(dlDriveSchoolStudent.getIdCard());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询当前学生的手机号是否存在users表中
|
|
|
|
|
|
|
|
AdminUserRespDTO userByMobile = adminUserApi.getUserByMobile(dlDriveSchoolStudent.getPhone());
|
|
|
|
|
|
|
|
//如果存在直接将userId赋值
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(userByMobile)) {
|
|
|
|
|
|
|
|
dlDriveSchoolStudent.setUserId(userByMobile.getId());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 如果不存在则创建用户
|
|
|
|
|
|
|
|
UserDTO userDTO = new UserDTO();
|
|
|
|
|
|
|
|
userDTO.setMobile(dlDriveSchoolStudent.getPhone());
|
|
|
|
|
|
|
|
userDTO.setUsername(dlDriveSchoolStudent.getPhone());
|
|
|
|
|
|
|
|
userDTO.setPassword(BaseConstants.PASSWORD_DEFAULT);
|
|
|
|
|
|
|
|
userDTO.setNickname(dlDriveSchoolStudent.getName());
|
|
|
|
|
|
|
|
userDTO.setSex(dlDriveSchoolStudent.getSex());
|
|
|
|
|
|
|
|
userDTO.setUserType(USER_TYPE_CUS);
|
|
|
|
|
|
|
|
Long user = adminUserApi.createUser(userDTO);
|
|
|
|
|
|
|
|
dlDriveSchoolStudent.setUserId(user);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (studentByIdCard == null) {
|
|
|
|
if (studentByIdCard == null) {
|
|
|
|
// 生成唯一推广码
|
|
|
|
// 生成唯一推广码
|
|
|
|
String uniqueCode = uniqueCodeService.createUniqueCode();
|
|
|
|
String uniqueCode = uniqueCodeService.createUniqueCode();
|
|
|
|
@ -78,7 +106,6 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
|
|
|
|
dlDriveSchoolStudentMapper.updateById(dlDriveSchoolStudent);
|
|
|
|
dlDriveSchoolStudentMapper.updateById(dlDriveSchoolStudent);
|
|
|
|
return studentByIdCard.getId();
|
|
|
|
return studentByIdCard.getId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|