Merge branch 'driver'

This commit is contained in:
xyc 2025-05-28 17:31:51 +08:00
commit c226a8692a
50 changed files with 1888 additions and 41 deletions

View File

@ -22,7 +22,12 @@ public enum SchoolRoleEnum {
/**
* 驾校教练
*/
COACH("instructor","驾校教练");
COACH("instructor","驾校教练"),
/**
* 驾校业务经理
*/
BUSINESS("school_business", "驾校业务经理");
/**
* 角色code

View File

@ -206,6 +206,11 @@ public class ApiAppLoginServiceImpl implements ApiAppLoginService {
flag = true;
thisRoleCodeList.add(SchoolRoleEnum.COACH.getCode());
thisRoleNameList.add(SchoolRoleEnum.COACH.getName());
} else if (roleCodeList.contains(SchoolRoleEnum.BUSINESS.getCode())) {
//驾校教练
flag = true;
thisRoleCodeList.add(SchoolRoleEnum.BUSINESS.getCode());
thisRoleNameList.add(SchoolRoleEnum.BUSINESS.getName());
}
user.setRoleCodes(String.join(",", thisRoleCodeList));
user.setRoleNames(String.join(",", thisRoleNameList));

View File

@ -43,6 +43,16 @@ public class InspectionConstants {
*/
public static final String INSPECTION_STAFF_EQUIPMENT_KEY = "equipment";
/**
* key的类型为员工
*/
public static final String DRIVE_SCHOOL_STAFF_KEY = "coach";
/**
* key的类型为设备
*/
public static final String DRIVE_SCHOOL_STUDENT_KEY = "student";
/**
* 检测接车订单表-没有接车
*/

View File

@ -11,7 +11,10 @@ import lombok.Getter;
@Getter
public enum InspectionFileEnum {
FOLDER("staff", "员工文件夹"),
FILE("equipment", "设备文件夹");
FILE("equipment", "设备文件夹"),
COACH("coach", "驾校员工文件夹"),
student("student","驾校学员文件夹");
private final String type;
private final String desc;

View File

@ -210,4 +210,13 @@ public class InspectionFileController extends BaseController {
public CommonResult<?> queryTreeFolder(){
return success(inspectionFileService.queryTreeFolder());
}
/**
* 查询文件夹树
* @return
*/
@GetMapping("/queryTreeFolderForJx")
public CommonResult<?> queryTreeFolderForJx(){
return success(inspectionFileService.queryTreeFolderForJx());
}
}

View File

@ -115,10 +115,12 @@ public interface IInspectionFileService extends IService<InspectionFile> {
* @return 文件夹id
*/
Long addFolder(String folderName, String key);
Long addFolderForJx(String folderName, String key);
/**
* 查询文件夹树
* @return 文件夹树
*/
List<TreeCommonResult> queryTreeFolder();
List<TreeCommonResult> queryTreeFolderForJx();
}

View File

@ -425,6 +425,36 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
return inspectionFile.getId();
}
@Override
public Long addFolderForJx(String folderName, String key) {
//根据key找到对应的文件夹id
InspectionFile fatherFolder = baseMapper.selectOne(new LambdaQueryWrapper<InspectionFile>().eq(InspectionFile::getDefaultKey, key));
//如果默认文件夹为空就新建
if (fatherFolder == null) {
fatherFolder = new InspectionFile();
fatherFolder.setFileName(InspectionFileEnum.getDescByType(key));
fatherFolder.setType(InspectionConstants.INSPECTION_FOLDER);
fatherFolder.setDefaultKey(key);
fatherFolder.setServicePackageId("jiaxiao");
baseMapper.insert(fatherFolder);
fatherFolder.setFileCode(fatherFolder.getId() + ",");
baseMapper.updateById(fatherFolder);
}
InspectionFile inspectionFile = new InspectionFile();
inspectionFile.setFatherId(fatherFolder.getId());
inspectionFile.setFileName(folderName + InspectionConstants.INSPECTION_FOLDER_SUFFIX);
inspectionFile.setType(InspectionConstants.INSPECTION_FOLDER);
inspectionFile.setIsStaffFile(InspectionConstants.INSPECTION_IS_STAFF_FILE);
inspectionFile.setServicePackageId("jiaxiao");
baseMapper.insert(inspectionFile);
inspectionFile.setFileCode(inspectionFile.getId() + ",");
baseMapper.updateById(inspectionFile);
return inspectionFile.getId();
}
/**
* 查询文件夹树
*
@ -441,6 +471,17 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
return buildTree(inspectionFiles);
}
@Override
public List<TreeCommonResult> queryTreeFolderForJx() {
//查询出所有文件夹
List<InspectionFile> inspectionFiles = baseMapper.selectList(new LambdaQueryWrapper<InspectionFile>()
.eq(InspectionFile::getType, InspectionConstants.INSPECTION_FOLDER).eq(InspectionFile::getServicePackageId,"jiaxiao")
.orderBy(false, false, InspectionFile::getCreateTime));
//组成属性结构
return buildTree(inspectionFiles);
}
/**
* 构建树形结构
*

View File

@ -1,13 +1,20 @@
package cn.iocoder.yudao.module.base.controller.admin;
import cn.hutool.core.lang.Assert;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCoachService;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachPageReqVO;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachSaveReqVO;
import cn.iocoder.yudao.module.base.vo.*;
import cn.iocoder.yudao.module.inspection.vo.InspectionStaffSaveVo;
import cn.iocoder.yudao.module.inspection.vo.StaffImportExcelVO;
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
@ -15,14 +22,19 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;
import java.io.IOException;
import java.util.*;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.excel.core.util.ExcelUtils.exportBlankTemplate;
@Tag(name = "管理后台 - 驾校教练")
@RestController
@ -33,6 +45,9 @@ public class DlDriveSchoolCoachController {
@Resource
private DlDriveSchoolCoachService dlDriveSchoolCoachService;
@Resource
private RoleService roleService;
/**
* 驾校教练普通员工列表
*
@ -66,6 +81,20 @@ public class DlDriveSchoolCoachController {
return success(dlDriveSchoolCoachService.listSchoolCoach(pageReqVO));
}
/**
* 不分页获取驾校人员信息
*
* @param pageReqVO {@link DlDriveSchoolCoachPageReqVO}
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<com.baomidou.mybatisplus.core.metadata.IPage < ?>>
* @author PQZ
* @date 14:25 2025/2/7
**/
@GetMapping("/listPeople")
@Operation(summary = "不分页获取教练信息")
public CommonResult<List<?>> listSchoolPeople(DlDriveSchoolCoachPageReqVO pageReqVO) {
return success(dlDriveSchoolCoachService.listSchoolPeople(pageReqVO));
}
/**
* 保存驾校教练
*
@ -141,4 +170,115 @@ public class DlDriveSchoolCoachController {
public CommonResult<?> getCoachByUserId(@RequestParam("userId") Long userId) {
return success(dlDriveSchoolCoachService.getDlDriveSchoolCoachByUserId(userId));
}
/**
* 获取检测员工详情
*
* @param id
* @return
*/
@GetMapping("/getOnInternal")
public CommonResult<?> getOnInternal(Long id) {
return success(dlDriveSchoolCoachService.getOnInternal(id));
}
@PutMapping("/update")
public CommonResult<?> update(@RequestBody CoachStaffSaveVo coachStaffSaveVo) {
Assert.notNull(coachStaffSaveVo.getUserId(), "员工id不能为空");
return success(dlDriveSchoolCoachService.edit(coachStaffSaveVo));
}
/**
* 新增驾校员工
*
* @param coachStaffSaveVo
* @return
*/
@PostMapping("/saveNew")
public CommonResult<?> saveNew(@RequestBody CoachStaffSaveVo coachStaffSaveVo) {
return success(dlDriveSchoolCoachService.saveCoachStaff(coachStaffSaveVo));
}
/**
* 新增文件夹
* @param userId 用户id
* @return
*/
@PostMapping("/addFolder")
public CommonResult<?> addFolder(@RequestBody Long userId) {
return success(dlDriveSchoolCoachService.addFolder(userId));
}
/**
* 导入
*/
@PostMapping("/import")
public CommonResult<?> importUser(@RequestParam("file") MultipartFile file) {
try {
List<SchoolStaffImportExcelVO> list = ExcelUtils.read(file, SchoolStaffImportExcelVO.class);
Map<String, Object> map = dlDriveSchoolCoachService.importStaff(list);
return success(map);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
/**
* 模板
*
* @param response
* @throws IOException
*/
@GetMapping("/get-import-template")
public void importTemplate(HttpServletResponse response) throws IOException {
String[] head = {"员工姓名", "岗位", "身份证号码", "年龄", "电话号码", "性别", "教龄", "车牌号", "居住地址", "户籍地址", "个人简介"};
// 下拉框列及选项列索引 -> 下拉框选项
Map<Integer, String[]> dropdownColumns = new HashMap<>();
//查询岗位
RoleDO roleDO = new RoleDO();
roleDO.setServicePackageId("jiaxiao");
List<RoleDO> roleDOS = roleService.pageByQuery(roleDO);
String[] roles = roleDOS.stream()
.map(RoleDO::getName)
.toArray(String[]::new);
dropdownColumns.put(1, roles);
String[] genders = {"", ""};
dropdownColumns.put(5, genders);
List<List<String>> exampleDataList = Arrays.asList(
Arrays.asList("测试员工", "岗位是下拉框选择", "xxxxxxxxxxxxxxxxx", "年龄", "电话号码", "性别", "教龄", "车牌号", "居住地址", "户籍地址", "个人简介")
);
List<Integer> textColumns = Collections.singletonList(3);
// 导出空白模板到Excel
exportBlankTemplate(response, "staff_template.xlsx", "员工信息", head, dropdownColumns, true, exampleDataList, textColumns);
}
@GetMapping("/export")
@ApiAccessLog(operateType = EXPORT)
public void exportUserList(SchoolStaffImportExcelVO query,
HttpServletResponse response) throws IOException {
List<SchoolStaffImportExcelVO> list = dlDriveSchoolCoachService.getAll(query);
// 输出 Excel
ExcelUtils.write(response, "员工数据.xls", "数据", SchoolStaffImportExcelVO.class,
list);
}
/**
* 业务经理招生信息
*/
@GetMapping("/getBusinessManager")
public CommonResult<IPage<BusinessRecordVO>> getBusinessManager(BusinessRecordVO businessRecordVO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Page<BusinessRecordVO> page = new Page<>(pageNo, pageSize);
return success(dlDriveSchoolCoachService.getBusinessManager(businessRecordVO, page));
}
}

View File

@ -1,9 +1,15 @@
package cn.iocoder.yudao.module.base.controller.admin;
import cn.hutool.core.date.DateUtil;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
import cn.iocoder.yudao.module.base.service.DlDriveSchoolStudentService;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
import cn.iocoder.yudao.module.base.vo.DriveSchoolStudentExportVo;
import cn.iocoder.yudao.module.inspection.query.InspectionStaffQuery;
import cn.iocoder.yudao.module.inspection.vo.InspectionStaffExportVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
@ -14,10 +20,13 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 驾校学员")
@ -65,6 +74,12 @@ public class DlDriveSchoolStudentController {
return success(schoolStudentService.queryStudentById(id));
}
@GetMapping("/getByUserId")
@Operation(summary = "获得驾校学员")
public CommonResult<DlDriveSchoolStudent> getDlDriveSchoolStudent(@RequestParam("id") Long id) {
return success(schoolStudentService.getStudentByUserId(id));
}
/**
* 分页获取学员列表
*
@ -114,6 +129,21 @@ public class DlDriveSchoolStudentController {
return success(schoolStudentService.queryCoachListPage(pageReqVO, page));
}
/**
* 业务经理查自己招生列表
*
* @author vinjor-M
* @date 17:20 2025/2/12
**/
@GetMapping("/myStudentBusinessPage")
@Operation(summary = "业务经理查自己招生列表")
public CommonResult<IPage<?>> myStudentBusinessPage(@Valid DlDriveSchoolStudentVO pageReqVO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Page<DlDriveSchoolStudentVO> page = new Page<>(pageNo, pageSize);
return success(schoolStudentService.queryBusinessListPage(pageReqVO, page));
}
/**
* @param type 时间查询类型01驾校统招02教练自招03自来客户
* @param timeType 时间查询类型all-全部|day-当日|month-当月|more-自定义
@ -156,7 +186,7 @@ public class DlDriveSchoolStudentController {
/**
* 查询自来学生列表
* @author PQZ
* @date 11:41 2025/2/20
* @date 11:41 2025/2/20
* @param timeType 时间查询类型all-全部|day-当日|month-当月|more-自定义
* @param startTime 查询时间范围--开始
* @param endTime 查询时间范围--结束
@ -204,5 +234,35 @@ public class DlDriveSchoolStudentController {
return success(schoolStudentService.queryStudentByUniqueCode(uniqueCode));
}
}
/**
* 新增文件夹
* @param userId 用户id
* @return
*/
@PostMapping("/addFolder")
public CommonResult<?> addFolder(@RequestBody Long userId) {
return success(schoolStudentService.addFolder(userId));
}
@GetMapping("/export")
@ApiAccessLog(operateType = EXPORT)
public void exportUserList(DlDriveSchoolStudent query,
HttpServletResponse response) throws IOException {
List<DriveSchoolStudentExportVo> list = schoolStudentService.getAll(query);
// 输出 Excel
ExcelUtils.write(response, "学员数据.xls", "数据", DriveSchoolStudentExportVo.class,
list);
}
/**
* 修改学员来源
*/
@PostMapping("/updateChannel")
public CommonResult<?> updateChannel(@RequestBody DlDriveSchoolStudent student) {
return success(schoolStudentService.updateChannel(student));
}
}

View File

@ -2,9 +2,11 @@ package cn.iocoder.yudao.module.base.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import org.apache.poi.hpsf.Decimal;
/**
* 驾校教练 DO
@ -94,5 +96,11 @@ public class DlDriveSchoolCoach extends TenantBaseDO {
* 其他证件
*/
private String otherPhoto;
/**
* 文件夹id
*/
private Long folderId;
}
}

View File

@ -86,4 +86,10 @@ public class DlDriveSchoolCourse extends TenantBaseDO {
* 课程详情
*/
private String details;
/**是否开启课程*/
private String ifDisplay;
/**是否开启课程*/
private String ageGroup;
}

View File

@ -49,13 +49,17 @@ public class DlDriveSchoolStudent extends TenantBaseDO {
*/
private String phone;
/**
* 来源01驾校统招02教练自招03自来客户
* 渠道来源01驾校统招02教练自招03自来客户,04业务经理统招
*/
private String source;
/**
* 来源id
* 渠道id来源id
*/
private Long sourceUserId;
/**
* 来源手动填写
*/
private String channel;
/**
* 身份证号
*/
@ -119,4 +123,9 @@ public class DlDriveSchoolStudent extends TenantBaseDO {
*/
private String drivingStudentCode;
/**
* 文件夹id
*/
private Long folderId;
}

View File

@ -1,15 +1,17 @@
package cn.iocoder.yudao.module.base.mapper;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachPageReqVO;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
import cn.iocoder.yudao.module.base.vo.*;
import cn.iocoder.yudao.module.inspection.vo.InspectionStaffSaveVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 驾校教练 Mapper
*
@ -44,4 +46,10 @@ public interface DlDriveSchoolCoachMapper extends BaseMapper<DlDriveSchoolCoach>
* 根据邀请码查询教练信息
*/
DlDriveSchoolCoach getCoachByUniqueCode(@Param("uniqueCode") String uniqueCode);
CoachStaffSaveVo getOnInternal(Long id);
List<SchoolStaffImportExcelVO> getAll(@Param("entity") SchoolStaffImportExcelVO query);
IPage<BusinessRecordVO> getBusinessManager(@Param("entity") BusinessRecordVO businessRecordVO, Page<BusinessRecordVO> page);
}

View File

@ -3,7 +3,10 @@ package cn.iocoder.yudao.module.base.mapper;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
import cn.iocoder.yudao.module.base.vo.DriveSchoolStudentExportVo;
import cn.iocoder.yudao.module.base.vo.StudentCountVO;
import cn.iocoder.yudao.module.inspection.query.InspectionStaffQuery;
import cn.iocoder.yudao.module.inspection.vo.InspectionStaffExportVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -66,6 +69,7 @@ public interface DlDriveSchoolStudentMapper extends BaseMapper<DlDriveSchoolStud
* @date 17:23 2025/2/12
**/
IPage<DlDriveSchoolStudentVO> selectByCoachId(@Param("entity") DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page);
IPage<DlDriveSchoolStudentVO> selectByBusinessId(@Param("entity") DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page);
/**
* 查学生列表---驾校层面查询
@ -98,6 +102,7 @@ public interface DlDriveSchoolStudentMapper extends BaseMapper<DlDriveSchoolStud
* @date 15:24 2025/2/17
**/
List<DlDriveSchoolStudentVO> selectStudentListCoach(@Param("coachId") Long coachId, @Param("startTime") String startTime, @Param("endTime") String endTime);
List<DlDriveSchoolStudentVO> selectStudentListBusiness(@Param("coachId") Long coachId, @Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* app首页查询训练学员---指定条件下
@ -146,4 +151,6 @@ public interface DlDriveSchoolStudentMapper extends BaseMapper<DlDriveSchoolStud
* @return java.util.List<cn.iocoder.yudao.module.base.vo.StudentCountVO>
**/
List<StudentCountVO> indexCusStudentList(String startTime, String endTime);
List<DriveSchoolStudentExportVo> getAll(@Param("entity") DlDriveSchoolStudent query);
}

View File

@ -1,7 +1,10 @@
package cn.iocoder.yudao.module.base.service;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
import cn.iocoder.yudao.module.base.vo.*;
import cn.iocoder.yudao.module.inspection.vo.InspectionStaffSaveVo;
import cn.iocoder.yudao.module.inspection.vo.StaffImportExcelVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
@ -9,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
* 驾校教练 Service 接口
@ -38,6 +42,7 @@ public interface DlDriveSchoolCoachService extends IService<DlDriveSchoolCoach>
**/
List<DlDriveSchoolCoach> listSchoolCoach(DlDriveSchoolCoachPageReqVO pageReqVO);
List<DlDriveSchoolCoach> listSchoolCoachApp(DlDriveSchoolCoachPageReqVO pageReqVO);
List<DlDriveSchoolCoach> listSchoolPeople(DlDriveSchoolCoachPageReqVO pageReqVO);
/**
* @param staffVO {@link DlDriveSchoolStaffVO}
@ -104,6 +109,50 @@ public interface DlDriveSchoolCoachService extends IService<DlDriveSchoolCoach>
* 根据邀请码查询教练信息
*/
DlDriveSchoolCoach getCoachByUniqueCode(String uniqueCode);
CoachStaffSaveVo getOnInternal(Long id);
/**
* 编辑驾校员工
*
* @param coachStaffSaveVo
* @return
*/
boolean edit(CoachStaffSaveVo coachStaffSaveVo);
/**
* 保存驾校员工
*
* @param coachStaffSaveVo
* @return
*/
Long saveCoachStaff(CoachStaffSaveVo coachStaffSaveVo);
/**
* 添加文件夹
*
* @param userId 用户id
* @return 文件夹id
*/
Long addFolder(Long userId);
/**
* 导入检测员工
*
* @param list 检测员工
* @return
*/
Map<String, Object> importStaff(List<SchoolStaffImportExcelVO> list);
/**
* 获取所有学员信息
*
* @param query
* @return
*/
List<SchoolStaffImportExcelVO> getAll(SchoolStaffImportExcelVO query);
IPage<BusinessRecordVO> getBusinessManager(BusinessRecordVO businessRecordVO, Page<BusinessRecordVO> page);
}

View File

@ -40,4 +40,7 @@ public interface DlDriveSchoolCourseDeductService extends IService<DriveSchoolCo
* @param courseId 课程id
*/
void defaultAdd(String courseId);
/** 根据课程id和科目查询提成配置 */
DriveSchoolCourseDeduct getDeductByCourseIdAndSubject(String courseId, Integer subject);
}

View File

@ -1,17 +1,25 @@
package cn.iocoder.yudao.module.base.service;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
import cn.iocoder.yudao.module.base.vo.DriveSchoolStudentExportVo;
import cn.iocoder.yudao.module.base.vo.StudentCountVO;
import cn.iocoder.yudao.module.inspection.query.InspectionStaffQuery;
import cn.iocoder.yudao.module.inspection.vo.InspectionStaffExportVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import javax.validation.Valid;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* 驾校学员 Service 接口
*
@ -120,6 +128,7 @@ public interface DlDriveSchoolStudentService extends IService<DlDriveSchoolStude
* @date 10:41 2025/1/18
**/
IPage<DlDriveSchoolStudentVO> queryCoachListPage(DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page);
IPage<DlDriveSchoolStudentVO> queryBusinessListPage(DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page);
/**
* @param type 时间查询类型01驾校统招02教练自招03自来客户
@ -162,4 +171,25 @@ public interface DlDriveSchoolStudentService extends IService<DlDriveSchoolStude
* @return cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO
*/
DlDriveSchoolStudentVO queryStudentByUniqueCode(String uniqueCode);
/**
* 添加文件夹
*
* @param userId 用户id
* @return 文件夹id
*/
Long addFolder(Long userId);
/**
* 获取所有学员信息
*
* @param query
* @return
*/
List<DriveSchoolStudentExportVo> getAll(DlDriveSchoolStudent query);
/**
* 修改学员来源
*/
public boolean updateChannel(DlDriveSchoolStudent student);
}

View File

@ -260,10 +260,42 @@ public class DataViewServiceImpl implements DataViewService {
List<DlDriveSchoolStudentVO> studentVOList = studentMapper.selectStudentListCoach(coachId,startTimeStr,endTimeStr);
int overNum = (int) studentVOList.stream().filter(item -> null != item.getOrderGradTime()).count();
int noOverNum = studentVOList.size()-overNum;
// courseTypeC1/C2统计
long c1Total = studentVOList.stream().filter(item -> "C1".equals(item.getCourseType())).count();
long c2Total = studentVOList.stream().filter(item -> "C2".equals(item.getCourseType())).count();
Map<String,Object> studentInfoMap = new HashMap<>();
studentInfoMap.put("allNum",studentVOList.size());
studentInfoMap.put("overNum",overNum);
studentInfoMap.put("noOverNum",noOverNum);
studentInfoMap.put("c1Total", c1Total);
studentInfoMap.put("c2Total", c2Total);
rtnObj.setStudentInfo(studentInfoMap);
/*4.财务情况-查教练自己应得的提成-*/
List<SchoolCommission> schoolCommissionList = commissionMapper.selectByCoachId(coachId,startTimeStr,endTimeStr);
double showedPay =0.0;
for (SchoolCommission item:schoolCommissionList){
if(null!=item.getCommissionAmount()){
showedPay =showedPay+item.getCommissionAmount().doubleValue();
}
}
Map<String,Object> moneyInfoMap = new HashMap<>();
moneyInfoMap.put("money",showedPay);
rtnObj.setMoneyInfo(moneyInfoMap);
}else if("business".equals(type)){
//业务经理查询
/*1.招生情况*/
List<DlDriveSchoolStudentVO> studentVOList = studentMapper.selectStudentListBusiness(coachId,startTimeStr,endTimeStr);
int overNum = (int) studentVOList.stream().filter(item -> null != item.getOrderGradTime()).count();
int noOverNum = studentVOList.size()-overNum;
// courseTypeC1/C2统计
long c1Total = studentVOList.stream().filter(item -> "C1".equals(item.getCourseType())).count();
long c2Total = studentVOList.stream().filter(item -> "C2".equals(item.getCourseType())).count();
Map<String,Object> studentInfoMap = new HashMap<>();
studentInfoMap.put("allNum",studentVOList.size());
studentInfoMap.put("overNum",overNum);
studentInfoMap.put("noOverNum",noOverNum);
studentInfoMap.put("c1Total", c1Total);
studentInfoMap.put("c2Total", c2Total);
rtnObj.setStudentInfo(studentInfoMap);
/*4.财务情况-查教练自己应得的提成-*/
List<SchoolCommission> schoolCommissionList = commissionMapper.selectByCoachId(coachId,startTimeStr,endTimeStr);

View File

@ -1,21 +1,35 @@
package cn.iocoder.yudao.module.base.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.SchoolRoleEnum;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolCoachMapper;
import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolStudentMapper;
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCoachService;
import cn.iocoder.yudao.module.base.vo.*;
import cn.iocoder.yudao.module.constant.InspectionConstants;
import cn.iocoder.yudao.module.course.entity.SchoolCommission;
import cn.iocoder.yudao.module.course.mapper.SchoolCommissionMapper;
import cn.iocoder.yudao.module.exam.mapper.ExamBatchItemMapper;
import cn.iocoder.yudao.module.exam.vo.ExamBatchItemVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
import cn.iocoder.yudao.module.inspection.entity.InspectionFile;
import cn.iocoder.yudao.module.inspection.entity.InspectionStaff;
import cn.iocoder.yudao.module.inspection.service.IInspectionFileService;
import cn.iocoder.yudao.module.inspection.vo.ImportStaffVo;
import cn.iocoder.yudao.module.inspection.vo.InspectionStaffSaveVo;
import cn.iocoder.yudao.module.inspection.vo.StaffImportExcelVO;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolCar;
import cn.iocoder.yudao.module.jx.service.IDriveSchoolCarService;
import cn.iocoder.yudao.module.jx.utils.StringUtils;
@ -26,10 +40,18 @@ import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
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 cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.module.train.mapper.TrainMapper;
import cn.iocoder.yudao.module.train.vo.TrainVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
@ -42,6 +64,7 @@ import javax.annotation.Resource;
import java.text.DecimalFormat;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.common.BaseConstants.PASSWORD_DEFAULT;
import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_STAFF;
@ -60,6 +83,8 @@ public class DlDriveSchoolCoachServiceImpl extends ServiceImpl<DlDriveSchoolCoac
@Resource
@Lazy
private AdminUserApi adminUserApi;
@Autowired
private AdminUserService userService;
@Resource
@Lazy
private CompanyStaffService companyStaffService;
@ -78,6 +103,14 @@ public class DlDriveSchoolCoachServiceImpl extends ServiceImpl<DlDriveSchoolCoac
private TrainMapper trainMapper;
@Autowired
private SchoolCommissionMapper commissionMapper;
@Autowired
private PermissionService permissionService;
@Autowired
private IInspectionFileService inspectionFileService;
@Autowired
private RoleService roleService;
/**
@ -125,6 +158,24 @@ public class DlDriveSchoolCoachServiceImpl extends ServiceImpl<DlDriveSchoolCoac
}
return list(lambdaQueryWrapper);
}
/**
* 不分页查询教练信息
*
* @param pageReqVO {@link DlDriveSchoolCoachPageReqVO}
* @return java.util.List<cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach>
* @author PQZ
* @date 14:26 2025/2/7
**/
@Override
public List<DlDriveSchoolCoach> listSchoolPeople(DlDriveSchoolCoachPageReqVO pageReqVO) {
LambdaQueryWrapper<DlDriveSchoolCoach> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(BaseDO::getDeleted, 0);
if (StringUtils.isNotEmpty(pageReqVO.getName())) {
lambdaQueryWrapper.like(DlDriveSchoolCoach::getName, pageReqVO.getName());
}
return list(lambdaQueryWrapper);
}
/**
* @param staffVO {@link DlDriveSchoolStaffVO}
@ -183,6 +234,8 @@ public class DlDriveSchoolCoachServiceImpl extends ServiceImpl<DlDriveSchoolCoac
roleCodes.add(SchoolRoleEnum.COACH.getCode());
} else if ("yg".equals(createReqVO.getType())) {
roleCodes.add(SchoolRoleEnum.STAFF.getCode());
} else if ("ywjl".equals(createReqVO.getType())) {
roleCodes.add(SchoolRoleEnum.BUSINESS.getCode());
}
permissionApi.assignUserRole(userId, roleCodes);
} else {
@ -438,5 +491,378 @@ public class DlDriveSchoolCoachServiceImpl extends ServiceImpl<DlDriveSchoolCoac
return dlDriveSchoolCoachMapper.getCoachByUniqueCode(uniqueCode);
}
@Override
public CoachStaffSaveVo getOnInternal(Long id) {
CoachStaffSaveVo coachStaffSaveVo = baseMapper.getOnInternal(id);
// 查询用户角色集合
List<UserRoleDTO> userRoleDTOS = permissionService.userRoleDTOList(Collections.singletonList(id));
coachStaffSaveVo.setRoleIds(userRoleDTOS.stream()
.filter(role -> "jiaxiao".equals(role.getServicePackageId()))
.map(UserRoleDTO::getRoleId)
.collect(Collectors.toList()));
//将驾驶证类型转为数组
/*if (ObjectUtil.isNotEmpty(coachStaffSaveVo.getDriverLicenseType())) {
coachStaffSaveVo.setDriverLicenseTypeArr(Arrays.asList(inspectionStaffSaveVo.getDriverLicenseType().split(",")));
}*/
//查询文件表文件夹id是否存在
if (ObjectUtil.isNotEmpty(coachStaffSaveVo.getFolderId())) {
InspectionFile folder = inspectionFileService.getOne(Wrappers.<InspectionFile>lambdaQuery().eq(InspectionFile::getId, coachStaffSaveVo.getFolderId()));
if (ObjectUtil.isNull(folder)) {
coachStaffSaveVo.setFolderId(null);
}
}
return coachStaffSaveVo;
}
/**
* 编辑检测员工
*
* @param coachStaffSaveVo
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public boolean edit(CoachStaffSaveVo coachStaffSaveVo) {
//更新system_users主表
UserSaveReqVO userDTO = BeanUtil.copyProperties(coachStaffSaveVo, UserSaveReqVO.class);
userDTO.setId(coachStaffSaveVo.getUserId());
userService.updateUser(userDTO);
//查询员工子表是否存在数据
DlDriveSchoolCoach staff = this.getOne(Wrappers.<DlDriveSchoolCoach>lambdaQuery().eq(DlDriveSchoolCoach::getUserId, coachStaffSaveVo.getUserId()));
if (ObjectUtil.isNull(staff)) {
staff = new DlDriveSchoolCoach();
BeanUtil.copyProperties(coachStaffSaveVo, staff);
//新增
this.save(staff);
} else {
//更新检测员工子表
String id = staff.getId();
System.out.println("复制前 staff ID: " + staff.getId());
BeanUtil.copyProperties(coachStaffSaveVo, staff);
System.out.println("复制后 staff ID: " + staff.getId());
staff.setId(id);
this.updateById(staff);
}
//查询文件夹
DlDriveSchoolCoach staff1 = this.getOne(Wrappers.<DlDriveSchoolCoach>lambdaQuery().eq(DlDriveSchoolCoach::getUserId, coachStaffSaveVo.getUserId()));
if (CollUtil.isNotEmpty(coachStaffSaveVo.getFileList())) {
addFile(coachStaffSaveVo.getFileList(), coachStaffSaveVo.getNickname(), staff1.getFolderId(), staff1.getUserId());
}
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long saveCoachStaff(CoachStaffSaveVo coachStaffSaveVo) {
//新增system_users主表
UserSaveReqVO userDTO = BeanUtil.copyProperties(coachStaffSaveVo, UserSaveReqVO.class);
userDTO.setId(coachStaffSaveVo.getUserId());
//获取当前人的租户id
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
userDTO.setTenantId(loginUser.getTenantId());
Long userId = userService.createUser(userDTO);
// //查询检测基础员工角色
// List<RoleDO> role = roleService.getRoleListByCodesTenant(Collections.singletonList(InspectionConstants.INSPECTION_BASE_STAFF_ROLE));
//
// if (ObjectUtil.isNull(role)) {
// throw new RuntimeException("检测基础员工角色不存在");
// }
//
// Set<Long> roleIds = role.stream().map(RoleDO::getId).collect(Collectors.toSet());
// //设置角色为检测基础员工
// permissionService.assignUserRole(userId, roleIds);
// DlDriveSchoolCoach dlDriveSchoolCoach = BeanUtil.copyProperties(coachStaffSaveVo, DlDriveSchoolCoach.class);
DlDriveSchoolCoach dlDriveSchoolCoach = new DlDriveSchoolCoach();
dlDriveSchoolCoach.setUserId(userId);
dlDriveSchoolCoach.setName(coachStaffSaveVo.getNickname());
dlDriveSchoolCoach.setCarId(coachStaffSaveVo.getCarId());
dlDriveSchoolCoach.setPhone(coachStaffSaveVo.getMobile());
dlDriveSchoolCoach.setIdNumber(coachStaffSaveVo.getIdNumber());
dlDriveSchoolCoach.setRegAddress(coachStaffSaveVo.getRegAddress());
dlDriveSchoolCoach.setAddress(coachStaffSaveVo.getAddress());
dlDriveSchoolCoach.setSeniority(coachStaffSaveVo.getSeniority());
dlDriveSchoolCoach.setInstructorDesc(coachStaffSaveVo.getInstructorDesc());
dlDriveSchoolCoach.setAge(coachStaffSaveVo.getAge());
dlDriveSchoolCoach.setSex(coachStaffSaveVo.getSex());
dlDriveSchoolCoach.setType(coachStaffSaveVo.getType());
//新增检测员工子表
this.save(dlDriveSchoolCoach);
if (ObjectUtil.isNotEmpty(coachStaffSaveVo.getFileList())) {
addFile(coachStaffSaveVo.getFileList(), coachStaffSaveVo.getNickname(), null, coachStaffSaveVo.getUserId());
}
return dlDriveSchoolCoach.getUserId();
}
/**
* 添加文件夹
*
* @param userId 用户id
* @return 文件夹id
*/
@Override
public Long addFolder(Long userId) {
AdminUserDO user = userService.getUser(userId);
if (ObjectUtil.isNotEmpty(user)) {
Long folderId = inspectionFileService.addFolderForJx(user.getNickname(), InspectionConstants.DRIVE_SCHOOL_STAFF_KEY);
//查询员工子表是否存在数据
DlDriveSchoolCoach staff = this.getOne(Wrappers.<DlDriveSchoolCoach>lambdaQuery().eq(DlDriveSchoolCoach::getUserId, userId));
if (ObjectUtil.isNull(staff)) {
staff = new DlDriveSchoolCoach();
staff.setUserId(userId);
staff.setFolderId(folderId);
//新增
this.save(staff);
} else {
//修改文件夹id
this.update(Wrappers.<DlDriveSchoolCoach>lambdaUpdate().eq(DlDriveSchoolCoach::getUserId, userId).set(DlDriveSchoolCoach::getFolderId, folderId));
}
return folderId;
} else {
log.error("用户不存在");
return null;
}
}
public void addFile(List<FileDO> fileList, String nickname, Long fatherId, Long userId) {
if (ObjectUtil.isEmpty(fatherId)) {
//添加文件夹
InspectionFile inspectionFile = new InspectionFile();
inspectionFile.setFileName(nickname + InspectionConstants.INSPECTION_FOLDER_SUFFIX);
inspectionFile.setType(InspectionConstants.INSPECTION_FOLDER);
inspectionFile.setServicePackageId("jiaxiao");
fatherId = inspectionFileService.insertInspectionFile(inspectionFile).getId();
//更新员工子表中的文件夹id
this.update(Wrappers.<DlDriveSchoolCoach>lambdaUpdate()
.eq(DlDriveSchoolCoach::getUserId, userId)
.set(DlDriveSchoolCoach::getFolderId, fatherId));
} else {
//删除文件下的所有文件
inspectionFileService.remove(Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getFatherId, fatherId)
.eq(InspectionFile::getType, InspectionConstants.INSPECTION_FILE)
.eq(InspectionFile::getIsStaffFile, InspectionConstants.INSPECTION_IS_STAFF_FILE));
}
//添加文件
List<InspectionFile> fileDOList = new ArrayList<>();
for (FileDO fileDO : fileList) {
InspectionFile file = new InspectionFile();
file.setFileName(removeFileExtension(fileDO.getName()));
file.setFilePath(fileDO.getUrl());
file.setType(InspectionConstants.INSPECTION_FILE);
file.setFatherId(fatherId);
file.setIsStaffFile(InspectionConstants.INSPECTION_IS_STAFF_FILE);
file.setServicePackageId("jiaxiao");
fileDOList.add(file);
}
//批量插入文件
inspectionFileService.insertBatchInspectionFile(fileDOList);
}
/**
* 去除文件名中的后缀
*
* @param filename
* @return
*/
public String removeFileExtension(String filename) {
if (filename == null) {
return null; // 或者你可以选择返回一个空字符串取决于你的业务需求
}
int lastDotIndex = filename.lastIndexOf('.');
if (lastDotIndex == -1) {
return filename; // 如果没有找到点则返回原文件名
}
return filename.substring(0, lastDotIndex);
}
/**
* 导入检测员工
*
* @param list 检测员工
* @return
*/
@Override
public Map<String, Object> importStaff(List<SchoolStaffImportExcelVO> list) {
if (CollUtil.isEmpty(list)) {
throw new RuntimeException("导入数据为空");
}
Map<String, Object> resultMap = new HashMap<>();
//校验信息
ImportSchoolStaffVo importStaffVo = validImportStaff(list);
//保存用户信息
int saveNum = saveImportStaff(importStaffVo.getSuccessList());
resultMap.put("saveNum", saveNum);
resultMap.put("failList", importStaffVo.getFailList());
resultMap.put("successList", importStaffVo.getSuccessList());
return resultMap;
}
/**
* 保存检测员工
*
* @param successList
* @return
*/
private int saveImportStaff(List<SchoolStaffImportExcelVO> successList) {
//将员工插入主表
Map<String, Long> users = new HashMap<>();
Map<Long, Long> folderMap = new HashMap<>();
for (SchoolStaffImportExcelVO schoolStaffImportExcelVO : successList) {
UserSaveReqVO createReqVO = new UserSaveReqVO();
createReqVO.setUsername(schoolStaffImportExcelVO.getMobile());
createReqVO.setMobile(schoolStaffImportExcelVO.getMobile());
createReqVO.setNickname(schoolStaffImportExcelVO.getNickname());
createReqVO.setPassword("123456");
Long userId = userService.createUser(createReqVO);
users.put(schoolStaffImportExcelVO.getMobile(), userId);
//创建员工文件夹
Long folderId = addFolder(userId);
folderMap.put(userId, folderId);
//修改文件夹id
this.update(Wrappers.<DlDriveSchoolCoach>lambdaUpdate().eq(DlDriveSchoolCoach::getUserId, userId).set(DlDriveSchoolCoach::getFolderId, folderId));
}
//插入检测员工子表
List<DlDriveSchoolCoach> dlDriveSchoolCoachList = new ArrayList<>();
for (SchoolStaffImportExcelVO schoolStaffImportExcelVO : successList) {
Long userId = users.get(schoolStaffImportExcelVO.getMobile());
DlDriveSchoolCoach dlDriveSchoolCoach = BeanUtil.copyProperties(schoolStaffImportExcelVO, DlDriveSchoolCoach.class);
dlDriveSchoolCoach.setName(schoolStaffImportExcelVO.getNickname());
dlDriveSchoolCoach.setPhone(schoolStaffImportExcelVO.getMobile());
dlDriveSchoolCoach.setUserId(userId);
dlDriveSchoolCoach.setFolderId(folderMap.get(userId));
dlDriveSchoolCoachList.add(dlDriveSchoolCoach);
permissionService.assignUserRole(userId, Collections.singleton(schoolStaffImportExcelVO.getRoleId()));
this.update(dlDriveSchoolCoach, Wrappers.<DlDriveSchoolCoach>lambdaUpdate().eq(DlDriveSchoolCoach::getUserId, userId));
}
// this.saveBatch(dlDriveSchoolCoachList);
return successList.size();
}
/**
* 验证导入员工数据
*
* @param list
* @return
*/
private ImportSchoolStaffVo validImportStaff(List<SchoolStaffImportExcelVO> list) {
List<SchoolStaffImportExcelVO> successList = new ArrayList<>();
List<SchoolStaffImportExcelVO> failList = new ArrayList<>();
//查询检测角色
RoleDO roleDO = new RoleDO();
roleDO.setServicePackageId("jiaxiao");
List<RoleDO> roleDOS = roleService.pageByQuery(roleDO);
Map<String, Long> roleMap = roleDOS.stream().collect(Collectors.toMap(RoleDO::getName, RoleDO::getId));
//根据手机号查询员工
List<AdminUserDO> list1 = userService.list(Wrappers.<AdminUserDO>lambdaQuery().in(AdminUserDO::getMobile, list.stream().map(SchoolStaffImportExcelVO::getMobile).collect(Collectors.toList())));
Map<String, Long> mobileMap = list1.stream().collect(Collectors.toMap(AdminUserDO::getMobile, AdminUserDO::getId));
//判断第一条数据是否是测试数据
if (ObjectUtil.isNotEmpty(list)) {
if ("测试员工".equals(list.get(0).getNickname())) {
list.remove(0);
}
}
for (SchoolStaffImportExcelVO staffImportExcelVO : list) {
if (ObjectUtil.isNull(staffImportExcelVO)) {
continue;
}
//判断员工姓名是否为空
if (ObjectUtil.isEmpty(staffImportExcelVO.getNickname())) {
staffImportExcelVO.setReason("员工姓名不能为空");
failList.add(staffImportExcelVO);
continue;
}
// 判断手机号是否为空
if (ObjectUtil.isEmpty(staffImportExcelVO.getMobile())) {
staffImportExcelVO.setReason("员工" + staffImportExcelVO.getNickname() + "手机号不能为空");
failList.add(staffImportExcelVO);
continue;
}
//判断手机号是否存在
if (ObjectUtil.isNotEmpty(mobileMap.get(staffImportExcelVO.getMobile()))) {
staffImportExcelVO.setReason("员工" + staffImportExcelVO.getNickname() + "的手机号已存在");
failList.add(staffImportExcelVO);
continue;
}
//如果身份证存在验证身份证是否正确
if (ObjectUtil.isNotEmpty(staffImportExcelVO.getIdNumber())) {
if (!IdcardUtil.isValidCard(staffImportExcelVO.getIdNumber())) {
staffImportExcelVO.setReason("员工" + staffImportExcelVO.getNickname() + "身份证格式不正确");
failList.add(staffImportExcelVO);
continue;
}
}
//判断员工角色是否为空
if (ObjectUtil.isEmpty(staffImportExcelVO.getRoleName())) {
staffImportExcelVO.setReason("员工" + staffImportExcelVO.getNickname() + "员工角色不能为空");
failList.add(staffImportExcelVO);
continue;
}
String sex = staffImportExcelVO.getSex();
if (ObjectUtil.isNotEmpty(sex)) {
sex = sex.trim();
if ("".equals(sex)) {
staffImportExcelVO.setSex("0");
} else if ("".equals(sex)) {
staffImportExcelVO.setSex("1");
} else {
staffImportExcelVO.setSex(null);
}
}
String roleName = staffImportExcelVO.getRoleName();
if(ObjectUtil.isNotEmpty(roleName)){
roleName = roleName.trim();
if("教练".equals(roleName)){
staffImportExcelVO.setType("jl");
} else if ("业务经理".equals(roleName)) {
staffImportExcelVO.setType("ywjl");
}else {
staffImportExcelVO.setType("yg");
}
}
//查询员工角色对应id
Long roleId = roleMap.get(staffImportExcelVO.getRoleName());
staffImportExcelVO.setRoleId(roleId);
successList.add(staffImportExcelVO);
}
ImportSchoolStaffVo importStaffVo = new ImportSchoolStaffVo();
importStaffVo.setSuccessList(successList);
importStaffVo.setFailList(failList);
return importStaffVo;
}
@Override
public List<SchoolStaffImportExcelVO> getAll(SchoolStaffImportExcelVO query) {
return baseMapper.getAll(query);
}
@Override
public IPage<BusinessRecordVO> getBusinessManager(BusinessRecordVO businessRecordVO, Page<BusinessRecordVO> page) {
return dlDriveSchoolCoachMapper.getBusinessManager(businessRecordVO, page);
}
}

View File

@ -74,4 +74,12 @@ public class DlDriveSchoolCourseDeductServiceImpl extends ServiceImpl<DriveSchoo
saveBatch(driveSchoolCourseDeducts);
}
}
@Override
public DriveSchoolCourseDeduct getDeductByCourseIdAndSubject(String courseId, Integer subject) {
return lambdaQuery()
.eq(DriveSchoolCourseDeduct::getCourseId, courseId)
.eq(DriveSchoolCourseDeduct::getCourseSubject, subject)
.one();
}
}

View File

@ -71,7 +71,7 @@ public class DlDriveSchoolCourseServiceImpl extends ServiceImpl<DlDriveSchoolCou
@Override
public List<DlDriveSchoolCourse> queryList(DlDriveSchoolCourseVO courseVO) {
LambdaQueryWrapper<DlDriveSchoolCourse> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(BaseDO::getDeleted, 0);
lambdaQueryWrapper.eq(BaseDO::getDeleted, 0).eq(DlDriveSchoolCourse::getIfDisplay,"0");
if (StringUtils.isNotEmpty(courseVO.getName())) {
lambdaQueryWrapper.like(DlDriveSchoolCourse::getName, courseVO.getName());
}

View File

@ -19,17 +19,24 @@ import cn.iocoder.yudao.module.base.service.DlDriveSchoolStudentService;
import cn.iocoder.yudao.module.base.service.SchoolNotifyMessageSendService;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
import cn.iocoder.yudao.module.base.vo.DriveSchoolStudentExportVo;
import cn.iocoder.yudao.module.base.vo.StudentCountVO;
import cn.iocoder.yudao.module.constant.InspectionConstants;
import cn.iocoder.yudao.module.course.entity.Process;
import cn.iocoder.yudao.module.course.entity.SchoolCourseOrder;
import cn.iocoder.yudao.module.course.service.ProcessService;
import cn.iocoder.yudao.module.course.service.SchoolCourseOrderService;
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
import cn.iocoder.yudao.module.inspection.entity.InspectionFile;
import cn.iocoder.yudao.module.inspection.service.IInspectionFileService;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolCourseOrder;
import cn.iocoder.yudao.module.jx.utils.uuid.UUID;
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 cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -38,6 +45,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
@ -86,6 +94,12 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
@Resource
private DlDriveSchoolCoachService dlDriveSchoolCoachService;
@Autowired
private IInspectionFileService inspectionFileService;
@Autowired
private AdminUserService userService;
@Override
public String createDlDriveSchoolStudent(DlDriveSchoolStudentVO createReqVO) {
// 插入
@ -327,7 +341,7 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
endTimeStr = DateUtil.formatDate(DateUtil.date()) + " 23:59:59";
}
pageReqVO.setStartTime(startTimeStr);
pageReqVO.setStartTime(endTimeStr);
pageReqVO.setEndTime(endTimeStr);
IPage<DlDriveSchoolStudentVO> pageResult = dlDriveSchoolStudentMapper.selectByCoachId(pageReqVO, page);
pageResult.getRecords().forEach(item -> {
//查每个学生的当前所处的科目
@ -345,7 +359,10 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
item.setProcess(newProcess);
} else {
// 判断所有进度是否都是已完成
boolean flag = list.stream().allMatch(process -> process.getStatus().equals("2"));
// boolean flag = list.stream().allMatch(process -> process.getStatus().equals("2"));
boolean flag = list.stream()
.filter(process -> process.getSubject() == 2 || process.getSubject() == 3)
.allMatch(process -> "2".equals(process.getStatus()));
if (flag) {
newProcess = list.stream().max(Comparator.comparing(Process::getSubject)).orElse(null);
} else {
@ -359,6 +376,72 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
return pageResult;
}
/**
* 教练查自己所有学生列表
*
* @param pageReqVO {@link DlDriveSchoolStudentVO}
* @param page 分页参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<?>
* @author PQZ
* @date 10:41 2025/1/18
**/
@Override
public IPage<DlDriveSchoolStudentVO> queryBusinessListPage(DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page) {
//默认查全部数据
String startTimeStr = "";
String endTimeStr = "";
if ("more".equals(pageReqVO.getTimeType())) {
if (StringUtils.isNotEmpty(pageReqVO.getStartTime())) {
startTimeStr = pageReqVO.getStartTime() + " 00:00:01";
}
if (StringUtils.isNotEmpty(pageReqVO.getEndTime())) {
endTimeStr = pageReqVO.getEndTime() + " 23:59:59";
}
} else if ("month".equals(pageReqVO.getTimeType())) {
//当月
startTimeStr = DateUtil.format(DateUtil.beginOfMonth(DateUtil.date()), "yyyy-MM-dd") + " 00:00:01";
endTimeStr = DateUtil.format(DateUtil.endOfMonth(DateUtil.date()), "yyyy-MM-dd") + " 23:59:59";
} else if ("day".equals(pageReqVO.getTimeType())) {
//当天
startTimeStr = DateUtil.formatDate(DateUtil.date()) + " 00:00:01";
endTimeStr = DateUtil.formatDate(DateUtil.date()) + " 23:59:59";
}
pageReqVO.setStartTime(startTimeStr);
pageReqVO.setEndTime(endTimeStr);
IPage<DlDriveSchoolStudentVO> pageResult = dlDriveSchoolStudentMapper.selectByBusinessId(pageReqVO, page);
/*pageResult.getRecords().forEach(item -> {
//查每个学生的当前所处的科目
List<Process> list = processService.list(Wrappers.<Process>lambdaQuery()
.eq(Process::getUserId, item.getUserId())
.eq(Process::getCoachId, item.getCoachId())
.eq(Process::getCourseId, item.getCourseId())
.orderByDesc(Process::getCreateTime));
Process newProcess = new Process();
if (CollUtil.isNotEmpty(list)) {
// 查询正在进行的课程
newProcess = list.stream().filter(process -> process.getStatus().equals("1")).findFirst().orElse(null);
if (ObjectUtil.isNotEmpty(newProcess)) {
item.setProcess(newProcess);
} else {
// 判断所有进度是否都是已完成
// boolean flag = list.stream().allMatch(process -> process.getStatus().equals("2"));
boolean flag = list.stream()
.filter(process -> process.getSubject() == 2 || process.getSubject() == 3)
.allMatch(process -> "2".equals(process.getStatus()));
if (flag) {
newProcess = list.stream().max(Comparator.comparing(Process::getSubject)).orElse(null);
} else {
newProcess = list.stream().min(Comparator.comparing(Process::getSubject)).orElse(null);
}
}
}
item.setProcess(newProcess);
});*/
return pageResult;
}
/**
* @param type 时间查询类型01驾校统招02教练自招03自来客户
* @param coachId 教练id
@ -470,5 +553,135 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
DlDriveSchoolStudentVO.class);
}
/**
* 添加文件夹
*
* @param userId 用户id
* @return 文件夹id
*/
@Override
public Long addFolder(Long userId) {
DlDriveSchoolStudent student = this.getStudentByUserId(userId);
if (ObjectUtil.isNotEmpty(student)) {
Long folderId = inspectionFileService.addFolderForJx(student.getName(), InspectionConstants.DRIVE_SCHOOL_STUDENT_KEY);
//查询员工子表是否存在数据
DlDriveSchoolStudent staff = this.getOne(Wrappers.<DlDriveSchoolStudent>lambdaQuery().eq(DlDriveSchoolStudent::getUserId, userId));
if (ObjectUtil.isNull(staff)) {
staff = new DlDriveSchoolStudent();
staff.setUserId(userId);
staff.setFolderId(folderId);
//新增
this.save(staff);
} else {
//修改文件夹id
this.update(Wrappers.<DlDriveSchoolStudent>lambdaUpdate().eq(DlDriveSchoolStudent::getUserId, userId).set(DlDriveSchoolStudent::getFolderId, folderId));
}
return folderId;
} else {
log.error("用户不存在");
return null;
}
}
/*@Override
public Long addFolder(Long userId) {
AdminUserDO user = userService.getUser(userId);
if (ObjectUtil.isNotEmpty(user)) {
Long folderId = inspectionFileService.addFolderForJx(user.getNickname(), InspectionConstants.DRIVE_SCHOOL_STUDENT_KEY);
//查询员工子表是否存在数据
DlDriveSchoolStudent staff = this.getOne(Wrappers.<DlDriveSchoolStudent>lambdaQuery().eq(DlDriveSchoolStudent::getUserId, userId));
if (ObjectUtil.isNull(staff)) {
staff = new DlDriveSchoolStudent();
staff.setUserId(userId);
staff.setFolderId(folderId);
//新增
this.save(staff);
} else {
//修改文件夹id
this.update(Wrappers.<DlDriveSchoolStudent>lambdaUpdate().eq(DlDriveSchoolStudent::getUserId, userId).set(DlDriveSchoolStudent::getFolderId, folderId));
}
return folderId;
} else {
log.error("用户不存在");
return null;
}
}*/
public void addFile(List<FileDO> fileList, String nickname, Long fatherId, Long userId) {
if (ObjectUtil.isEmpty(fatherId)) {
//添加文件夹
InspectionFile inspectionFile = new InspectionFile();
inspectionFile.setFileName(nickname + InspectionConstants.INSPECTION_FOLDER_SUFFIX);
inspectionFile.setType(InspectionConstants.INSPECTION_FOLDER);
inspectionFile.setServicePackageId("jiaxiao");
fatherId = inspectionFileService.insertInspectionFile(inspectionFile).getId();
//更新员工子表中的文件夹id
this.update(Wrappers.<DlDriveSchoolStudent>lambdaUpdate()
.eq(DlDriveSchoolStudent::getUserId, userId)
.set(DlDriveSchoolStudent::getFolderId, fatherId));
} else {
//删除文件下的所有文件
inspectionFileService.remove(Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getFatherId, fatherId)
.eq(InspectionFile::getType, InspectionConstants.INSPECTION_FILE)
.eq(InspectionFile::getIsStaffFile, InspectionConstants.INSPECTION_IS_STAFF_FILE));
}
//添加文件
List<InspectionFile> fileDOList = new ArrayList<>();
for (FileDO fileDO : fileList) {
InspectionFile file = new InspectionFile();
file.setFileName(removeFileExtension(fileDO.getName()));
file.setFilePath(fileDO.getUrl());
file.setType(InspectionConstants.INSPECTION_FILE);
file.setFatherId(fatherId);
file.setIsStaffFile(InspectionConstants.INSPECTION_IS_STAFF_FILE);
file.setServicePackageId("jiaxiao");
fileDOList.add(file);
}
//批量插入文件
inspectionFileService.insertBatchInspectionFile(fileDOList);
}
/**
* 去除文件名中的后缀
*
* @param filename
* @return
*/
public String removeFileExtension(String filename) {
if (filename == null) {
return null; // 或者你可以选择返回一个空字符串取决于你的业务需求
}
int lastDotIndex = filename.lastIndexOf('.');
if (lastDotIndex == -1) {
return filename; // 如果没有找到点则返回原文件名
}
return filename.substring(0, lastDotIndex);
}
@Override
public List<DriveSchoolStudentExportVo> getAll(DlDriveSchoolStudent query) {
return baseMapper.getAll(query);
}
/**
* 修改学员来源
*/
@Override
public boolean updateChannel(DlDriveSchoolStudent student) {
int rows = dlDriveSchoolStudentMapper.update(Wrappers.lambdaUpdate(DlDriveSchoolStudent.class)
.eq(DlDriveSchoolStudent::getUserId, student.getUserId())
.eq(DlDriveSchoolStudent::getTenantId, student.getTenantId())
.eq(DlDriveSchoolStudent::getDeleted, false)
.set(student.getChannel() != null, DlDriveSchoolStudent::getChannel, student.getChannel()));
return rows > 0;
}
}

View File

@ -0,0 +1,29 @@
package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import lombok.Data;
import org.apache.poi.hpsf.Decimal;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class BusinessRecordVO extends TenantBaseDO {
private String name;
private String phone;
private String idCard;
private Integer age;
private String sex;
private String channel;
private String courseName;
private String coachUserName;
private BigDecimal reserveMoney;
private BigDecimal restMoney;
private String paymentStatus;
private String payType;
private Integer isSign;
private String businessName;
private String businessPhone;
private LocalDateTime createTime;
}

View File

@ -0,0 +1,104 @@
package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.util.List;
@Data
public class CoachStaffSaveVo extends DlDriveSchoolCoach {
/**
* 员工编号
*/
@ExcelIgnore
private String id;
/**
* 用户账号
*/
@ExcelProperty("员工账号")
private String username;
/**
* 用户昵称
*/
@ExcelProperty("员工名称")
private String nickname;
/**
* 用户类型
*/
@ExcelIgnore
private String userType;
/**
* 备注
*/
@ExcelIgnore
private String remark;
/**
* 部门编号
*/
@ExcelIgnore
private Long deptId;
/**
* 用户手机号码
*/
@ExcelProperty("手机号")
private String mobile;
/**
* 用户密码
*/
@ExcelIgnore
private String password;
/**
* 用户头像
*/
@ExcelIgnore
private String avatar;
/**
* 用户性别
**/
@ExcelIgnore
private String sex;
/**
* 用户性别
*/
@ExcelProperty(value = "用户性别")
private String sexStr;
/**
* 用户状态
*/
@ExcelIgnore
private Integer status;
/**
* 用户状态
*/
@ExcelProperty("状态")
private String statusStr;
/**
* 用户邮箱
*/
@ExcelProperty("邮箱")
private String email;
/**
* 驾驶证类型集合
*/
private List<String> driverLicenseTypeArr;
/**
* 文件集合
*/
private List<FileDO> fileList;
/**
* 角色集合
*/
private List<Long> roleIds;
}

View File

@ -1,11 +1,12 @@
package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 驾校教练新增/修改 Request VO")
@Data
public class DlDriveSchoolCoachVO {
public class DlDriveSchoolCoachVO extends DlDriveSchoolCoach {
/**教练id*/
private String coachId;
/**教练姓名*/
@ -14,4 +15,8 @@ public class DlDriveSchoolCoachVO {
private String coachPhone;
/**任教科目*/
private String subject;
}
/**
* 角色名称 多个角色以逗号隔开
*/
private String roleNames;
}

View File

@ -53,4 +53,6 @@ public class DlDriveSchoolStaffVO {
private String startTime;
/**查询时间范围--结束*/
private String endTime;
/**是否合格*/
private String examStatus;
}

View File

@ -31,10 +31,14 @@ public class DlDriveSchoolStudentVO extends DlDriveSchoolStudent {
private String startTime;
/**查询时间范围--结束*/
private String endTime;
/**是否毕业*/
private String isGrad;
/**订单表中的毕业时间*/
private String orderGradTime;
/**课程名称*/
private String courseName;
/**订单ID*/
private String orderId;
/**排序方式asc desc*/
private String sort;
}

View File

@ -0,0 +1,148 @@
package cn.iocoder.yudao.module.base.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* @Description: 检测员工导出vo
* @Author: 86187
* @Date: 2025/01/23 17:51
* @Version: 1.0
*/
@Data
public class DriveSchoolStudentExportVo {
/**
* 姓名
*/
@ExcelProperty("姓名")
private String name;
/**
* 头像
*/
@ExcelIgnore
private String avatar;
/**
* 年龄
*/
@ExcelProperty("年龄")
private Integer age;
/**
* 性别
*/
@ExcelProperty(value = "性别")
private String sex;
/**
* 联系电话
*/
@ExcelProperty(value = "电话")
private String phone;
/**
* 来源01驾校统招02教练自招03自来客户
*/
@ExcelProperty("来源")
private String source;
/**
* 来源id
*/
@ExcelIgnore
private Long sourceUserId;
/**
* 身份证号
*/
@TableField("id_card")
@ExcelProperty("身份证号")
private String idCard;
/**
* 工作单位
*/
@TableField("work_name")
@ExcelProperty("工作单位")
private String workName;
/**
* 户籍地址
*/
@TableField("regist_address")
@ExcelProperty("户籍地址")
private String registAddress;
/**
* 家庭住址
*/
@ExcelProperty("家庭住址")
private String address;
/**
* 人员类型暂留
*/
@ExcelIgnore
private String type;
/**
* 备注
*/
@ExcelProperty("备注")
private String remark;
/**
* 用户id
*/
@ExcelIgnore
private Long userId;
/**
* 证件照
*/
@ExcelIgnore
private String idPhoto;
/**
* 生活照
*/
@ExcelIgnore
private String lifePhoto;
/**
* 其他照片
*/
@ExcelIgnore
private String otherPhoto;
/**
* 拿证时间
*/
@ExcelIgnore
private String passTime;
/**
* 毕业时间
*/
@ExcelIgnore
private String gradTime;
/**
* 唯一码
*/
@ExcelIgnore
@TableField("unique_code")
// @ExcelProperty("唯一码")
private String uniqueCode;
/**
* 体检报告
*/
@ExcelIgnore
private String examinationReport;
/**
* 学员编码
*/
@TableField("driving_student_code")
@ExcelProperty("学员编号")
private String drivingStudentCode;
/**
* 文件夹id
*/
@ExcelIgnore
private Long folderId;
@ExcelProperty("报名时间")
private String createTimeStr;
}

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.module.inspection.vo.StaffImportExcelVO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @Description: 导入检测员工返回对象
* @Author: 86187
* @Date: 2025/02/13 11:46
* @Version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ImportSchoolStaffVo {
/**
* 导入成功的集合
*/
private List<SchoolStaffImportExcelVO> successList;
/**
* 导入失败的集合
*/
private List<SchoolStaffImportExcelVO> failList;
}

View File

@ -0,0 +1,66 @@
package cn.iocoder.yudao.module.base.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* @Description: 检测员工Excel
* @Author: 86187
* @Date: 2025/01/22 17:23
* @Version: 1.0
*/
@Data
@Accessors(chain = false) // 禁用链式调用
@AllArgsConstructor
@NoArgsConstructor
public class SchoolStaffImportExcelVO {
@ExcelProperty(value = "员工姓名", index = 0)
private String nickname;
@ExcelProperty(value ="岗位", index = 1)
private String roleName;
@ExcelProperty(value ="身份证号码", index = 2)
private String idNumber;
@ExcelProperty(value ="年龄", index = 3)
private String age;
@ExcelProperty(value ="电话号码", index = 4)
private String mobile;
@ExcelProperty(value ="性别", index = 5)
private String sex;
@ExcelProperty(value = "教龄", index = 6)
private String seniority;
@ExcelProperty(value ="车牌号", index = 7)
private String carId;
@ExcelProperty(value ="居住地址", index = 8)
private String address;
@ExcelProperty(value ="户籍地址", index = 9)
private String regAddress;
@ExcelProperty(value ="个人简介", index = 10)
private String instructorDesc;
@ExcelIgnore
private String reason;
@ExcelIgnore
private String type;
/**
* 角色id
*/
@ExcelIgnore
private Long roleId;
}

View File

@ -3,19 +3,22 @@ package cn.iocoder.yudao.module.course.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.base.entity.DriveSchoolCourseDeduct;
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCourseDeductService;
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCourseService;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO;
import cn.iocoder.yudao.module.course.entity.Process;
import cn.iocoder.yudao.module.course.service.ProcessService;
import cn.iocoder.yudao.module.course.vo.ProcessAddVO;
import cn.iocoder.yudao.module.course.vo.ProcessAndExamBatchVO;
import cn.iocoder.yudao.module.course.vo.ProcessNewVO;
import cn.iocoder.yudao.module.course.vo.ProcessVO;
import cn.iocoder.yudao.module.course.service.SchoolCourseOrderService;
import cn.iocoder.yudao.module.course.vo.*;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolDeduct;
import cn.iocoder.yudao.module.jx.service.IDriveSchoolDeductService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -23,6 +26,7 @@ import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@ -37,6 +41,15 @@ public class ProcessController {
@Resource
private ProcessService processService;
@Autowired
private DlDriveSchoolCourseDeductService driveSchoolCourseDeductService;
@Autowired
private IDriveSchoolDeductService driveSchoolDeductService;
@Resource
private SchoolCourseOrderService schoolCourseOrderService;
@ -100,7 +113,38 @@ public class ProcessController {
@Operation(summary = "通过id 查询学员进度课程")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<ProcessVO> getDlDriveSchoolCoach(@RequestParam("id") String id) {
return success(BeanUtils.toBean(processService.getById(id), ProcessVO.class));
ProcessVO processVO = BeanUtils.toBean(processService.getById(id), ProcessVO.class);
Long coachId = processVO.getCoachId();
Integer subject = processVO.getSubject();
Long userId = processVO.getUserId();
String courseId = processVO.getCourseId();
BigDecimal deduct = BigDecimal.ZERO;
DriveSchoolCourseDeduct courseDeduct = driveSchoolCourseDeductService.getDeductByCourseIdAndSubject(courseId, subject);
if (courseDeduct != null) {
if (courseDeduct.getDeduct() != null) {
deduct = courseDeduct.getDeduct();
}
else if (courseDeduct.getCourseSubject() != null) {
DriveSchoolDeduct schoolDeduct = driveSchoolDeductService.queryBySubject(courseDeduct.getCourseSubject());
if (schoolDeduct != null && schoolDeduct.getDeduct() != null) {
deduct = schoolDeduct.getDeduct();
}
}
}
List<SchoolCourseOrderVO> courseByInfo = schoolCourseOrderService.getCourseByInfo(userId, courseId);
BigDecimal studentPay = BigDecimal.ZERO;
BigDecimal studentRemainingPay = BigDecimal.ZERO;
if (!courseByInfo.isEmpty()) {
studentPay = courseByInfo.get(0).getReserveMoney() != null ?
courseByInfo.get(0).getReserveMoney() : BigDecimal.ZERO;
studentRemainingPay = courseByInfo.get(0).getRestMoney() != null ?
courseByInfo.get(0).getRestMoney() : BigDecimal.ZERO;
}
processVO.setCoachCommission(deduct);
processVO.setStudentPay(studentPay);
processVO.setStudentRemainingPay(studentRemainingPay);
return success(processVO);
}
@GetMapping("/getProcessAndBatch")

View File

@ -93,6 +93,7 @@ public interface SchoolCourseOrderService extends IService<SchoolCourseOrder> {
* @return List<SchoolCourseOrderVO>
*/
List<SchoolCourseOrderVO> getCourseByLoginUser(Long loginUserId);
List<SchoolCourseOrderVO> getCourseByInfo(Long userId, String courseId);
/**
* 报名之后发送对应消息

View File

@ -207,6 +207,22 @@ public class SchoolCourseOrderServiceImpl extends ServiceImpl<SchoolCourseOrderM
return BeanUtil.copyToList(list, SchoolCourseOrderVO.class);
}
/**
* 根据获取订单信息
*
* @param userId 用户id
* @return List<SchoolCourseOrderVO>
*/
@Override
public List<SchoolCourseOrderVO> getCourseByInfo(Long userId, String courseId) {
List<SchoolCourseOrder> list = list(Wrappers.lambdaQuery(SchoolCourseOrder.class)
.eq(SchoolCourseOrder::getUserId, userId)
.eq(SchoolCourseOrder::getCourseId, courseId)
.eq(SchoolCourseOrder::getIfEnd, SchoolBaseConstants.COMMON_NO)
.eq(SchoolCourseOrder::getIfAssignmentCoach, SchoolBaseConstants.SCHOOL_COURSE_ORDER_IS_ASSIGN_COACH));
return BeanUtil.copyToList(list, SchoolCourseOrderVO.class);
}
/**
* 报名之后发送对应消息
*/

View File

@ -2,6 +2,9 @@ package cn.iocoder.yudao.module.course.vo;
import cn.iocoder.yudao.module.course.entity.Process;
import lombok.Data;
import org.apache.poi.hpsf.Decimal;
import java.math.BigDecimal;
/**
* 驾校-学员课程进度 DO
@ -17,4 +20,12 @@ public class ProcessVO extends Process {
/** 更新人姓名 */
private String updateName;
/** 学员缴纳金额*/
private BigDecimal studentPay;
/** 教练提成*/
private BigDecimal coachCommission;
/** 学生尾款*/
private BigDecimal studentRemainingPay;
}

View File

@ -80,4 +80,10 @@ public class DriveSchoolContractController extends BaseController
{
return toAjax(driveSchoolContractService.deleteDriveSchoolContractByIds(ids));
}
@GetMapping("/getContractByUserId")
public CommonResult getContractByUserId(Long userId)
{
return success(driveSchoolContractService.getContractByUserId(userId));
}
}

View File

@ -64,4 +64,6 @@ public interface DriveSchoolContractMapper
* @return 结果
*/
public int deleteDriveSchoolContractByIds(Long[] ids);
public DriveSchoolContract getContractByUserId(Long userId);
}

View File

@ -62,4 +62,6 @@ public interface IDriveSchoolContractService
* @return 结果
*/
public int deleteDriveSchoolContractById(Long id);
public DriveSchoolContract getContractByUserId(Long userId);
}

View File

@ -168,4 +168,9 @@ public class DriveSchoolContractServiceImpl implements IDriveSchoolContractServi
{
return driveSchoolContractMapper.deleteDriveSchoolContractById(id);
}
@Override
public DriveSchoolContract getContractByUserId(Long userId) {
return driveSchoolContractMapper.getContractByUserId(userId);
}
}

View File

@ -99,7 +99,7 @@ public class StudentScoreInputServiceImpl implements StudentScoreInputService {
// 更新批次通过率
examBatchItemServiceImpl.updateBatchPassRate(examBatch.getId());
}
/*if(studentScoreInput.getSubject() == 4 && "1".equals(studentScoreInput.getExamStatus())){
if(studentScoreInput.getSubject() == 4 && "1".equals(studentScoreInput.getExamStatus())){
// 修改订单表的拿证时间
schoolCourseOrderService.update(Wrappers.lambdaUpdate(SchoolCourseOrder.class)
.eq(SchoolCourseOrder::getCourseId, studentScoreInput.getCourseId())
@ -119,7 +119,7 @@ public class StudentScoreInputServiceImpl implements StudentScoreInputService {
.eq(SchoolCourseOrder::getIfEnd, false)
.eq(SchoolCourseOrder::getIfAssignmentCoach, true)
.set(SchoolCourseOrder::getGradTime, studentScoreInput.getExamTime()));
}*/
}
// 修改下一课程状态
this.updateNextSubjectStatus(studentScoreInput);
}

View File

@ -57,6 +57,110 @@
<select id="getCoachByUniqueCode" parameterType="String" resultType="cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach">
SELECT dsc.* FROM company_staff cs
LEFT JOIN drive_school_coach dsc ON cs.user_id = dsc.user_id
WHERE cs.unique_code = #{uniqueCode}
WHERE cs.unique_code = #{uniqueCode} AND dsc.DELETED = 0
ORDER BY dsc.create_time DESC
LIMIT 1
</select>
<select id="getOnInternal" resultType="cn.iocoder.yudao.module.base.vo.CoachStaffSaveVo">
SELECT distinct
su.id as userId,
su.nickname,
su.username,
su.user_type,
su.remark,
su.dept_id,
su.mobile,
su.password,
su.avatar,
su.sex,
su.status,
dsc.id_number,
dsc.car_id,
dsc.phone,
dsc.name,
dsc.reg_address,
dsc.address,
dsc.seniority,
dsc.instructor_desc,
dsc.id_photo,
dsc.life_photo,
dsc.drive_photo,
dsc.other_photo,
dsc.age,
dsc.sex,
dsc.folder_id
FROM system_users su
left join system_user_role sur on su.id = sur.user_id
left join system_role sr on sur.role_id = sr.id
INNER JOIN drive_school_coach dsc on dsc.user_id = su.id
<where>
sr.service_package_id = 'jiaxiao'
and su.id = #{id}
</where>
</select>
<select id="getAll" resultType="cn.iocoder.yudao.module.base.vo.SchoolStaffImportExcelVO">
SELECT
dsc.name AS nickname,
GROUP_CONCAT(DISTINCT sr2.name SEPARATOR ',') AS roleName,
dsc.id_number AS idNumber,
dsc.age,
dsc.phone,
CASE dsc.sex WHEN '0' THEN '男' WHEN '1' THEN '女' ELSE '未知' END AS sex,
dsc.seniority,
dsc.car_id AS carId,
dsc.address,
dsc.reg_Address AS regAddress,
dsc.instructor_desc AS instructorDesc
FROM system_users su
LEFT JOIN system_user_role sr ON su.id = sr.user_id AND sr.deleted = 0
LEFT JOIN system_role sr2 ON sr.role_id = sr2.id AND sr2.deleted = 0
INNER JOIN drive_school_coach dsc ON dsc.user_id = su.id AND dsc.deleted = 0
where
su.deleted = 0 and sr2.service_package_id = 'jiaxiao'
group by su.id
order by su.nickname
</select>
<select id="getBusinessManager" resultType="cn.iocoder.yudao.module.base.vo.BusinessRecordVO">
select dss.name,
dss.phone,
dss.id_card,
dss.age,
dss.sex,
dss.channel,
dsco.course_name,
dsco.coach_user_name,
dsco.reserve_money,
dsco.rest_money,
dsco.payment_status,
dsco.pay_type,
dsco.is_sign,
dsc.name AS businessName,
dsc.phone AS businessPhone,
dsco.create_time
from drive_school_student dss
LEFT JOIN drive_school_course_order dsco ON dss.user_id = dsco.user_id
LEFT JOIN drive_school_coach dsc ON dss.source_user_id = dsc.user_id
<where>
dss.source = '04'
AND dsc.type = 'ywjl'
AND dss.deleted = 0
AND dsco.deleted = 0
AND dsc.deleted = 0
<if test="entity.businessName != null and entity.businessName != ''">
AND dsc.name LIKE CONCAT('%', #{entity.businessName}, '%')
</if>
<if test="entity.name != null and entity.name != ''">
AND dss.name LIKE CONCAT('%', #{entity.name}, '%')
</if>
<if test="entity.phone != null and entity.phone != ''">
AND (dss.phone LIKE CONCAT('%', #{entity.phone}, '%')
OR dsc.phone LIKE CONCAT('%', #{entity.phone}, '%'))
</if>
</where>
ORDER BY dsco.create_time DESC
</select>
</mapper>

View File

@ -19,6 +19,9 @@
<where>
main.deleted = 0
<if test="entity.name != null and entity.name != ''">and main.name like concat('%', #{entity.name}, '%')</if>
<if test="entity.phone != null and entity.phone != ''">and main.phone = #{entity.phone}</if>
<if test="entity.idCard != null and entity.idCard != ''">and main.id_card like concat('%', #{entity.idCard}, '%')</if>
<if test="entity.source != null and entity.source != ''">and main.source = #{entity.source}</if>
</where>
GROUP BY main.user_id
order by main.create_time desc
@ -62,11 +65,12 @@
AND dsco.deleted = 0
AND dsco.payment_status IN ( '2', '3', '4', '5' )
AND dsco.if_end = 0
LEFT JOIN drive_school_process dsp ON main.user_id = dsp.user_id
AND dsco.course_id = dsp.course_id
AND dsp.`status` = '1'
WHERE
main.deleted = 0
main.deleted = 0 AND dsco.is_sign = 1
<if test="entity.coachId != null and entity.coachId != ''">
AND dsp.coach_id = #{entity.coachId}
</if>
@ -91,6 +95,9 @@
<if test="entity.source!=null and entity.source!=''">
AND main.source = #{entity.source}
</if>
<if test="entity.examStatus!=null and entity.examStatus!=''">
AND dsp.exam_status = #{entity.examStatus}
</if>
GROUP BY
main.id
<choose>
@ -129,6 +136,12 @@
<if test="entity.endTime!=null and entity.endTime!=''">
AND dss.create_time &lt;= #{entity.endTime}
</if>
<if test="entity.isGrad != null and entity.isGrad == 'correct'">
AND dsco.grad_time IS NOT NULL
</if>
<if test="entity.isGrad != null and entity.isGrad == 'deny'">
AND dsco.grad_time IS NULL
</if>
AND dss.id IS NOT NULL
ORDER BY
dss.create_time DESC
@ -136,6 +149,47 @@
GROUP BY
temp.orderId
</select>
<select id="selectByBusinessId" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
SELECT
dss.*,dsco.course_type AS courseType
FROM
drive_school_student dss
LEFT JOIN drive_school_course_order dsco ON dss.user_id = dsco.user_id
WHERE
dss.deleted = 0
AND dsco.if_end = 0
AND dsco.deleted = 0
AND dsco.payment_status in ( '2', '3', '4', '5' )
AND dsco.is_sign = 1
AND dss.id IS NOT NULL
AND dss.source = '04'
AND dss.source_user_id = #{entity.coachId}
<if test="entity.name != null and entity.name!=''">
AND dss.`name` LIKE CONCAT('%',#{entity.name},'%')
</if>
<if test="entity.startTime!=null and entity.startTime!=''">
AND dss.create_time &gt;= #{entity.startTime}
</if>
<if test="entity.endTime!=null and entity.endTime!=''">
AND dss.create_time &lt;= #{entity.endTime}
</if>
<if test="entity.courseType!=null and entity.courseType!=''">
AND dsco.course_type = #{entity.courseType}
</if>
GROUP BY
dss.user_id
<choose>
<when test="entity.sort=='asc'">
ORDER BY
dss.create_time ASC
</when>
<otherwise>
ORDER BY
dss.create_time DESC
</otherwise>
</choose>
</select>
<select id="selectStudentList" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
SELECT
dss.* ,SUM(dsco.reserve_money+dsco.rest_money)AS priceAmount
@ -174,7 +228,7 @@
</select>
<select id="selectStudentListCoach" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
SELECT
dss.*,dsco.grad_time AS orderGradTime,dsco.id AS orderId
dss.*,dsco.grad_time AS orderGradTime,dsco.id AS orderId,dsco.course_type AS courseType
FROM
drive_school_process dsp
LEFT JOIN drive_school_student dss ON dsp.user_id = dss.user_id
@ -216,6 +270,32 @@
<!-- GROUP BY-->
<!-- dsp.id-->
</select>
<select id="selectStudentListBusiness" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
SELECT
dss.*,dsco.course_type AS courseType
FROM
drive_school_student dss
LEFT JOIN drive_school_course_order dsco ON dss.user_id = dsco.user_id
WHERE
dss.deleted = 0
AND dsco.if_end = 0
AND dsco.deleted = 0
AND dsco.payment_status in ( '2', '3', '4', '5' )
AND dsco.is_sign = 1
AND dss.id IS NOT NULL
AND dss.source = '04'
<if test="coachId != null and coachId != ''">
AND dss.source_user_id = #{coachId}
</if>
<if test="startTime!=null and startTime!=''">
AND dss.create_time &gt;= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
AND dss.create_time &lt;= #{endTime}
</if>
GROUP BY
dsco.id
</select>
<select id="selectTrainStudent" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
SELECT
dss.*,dsc.type AS courseType,dst.subject
@ -333,15 +413,51 @@
AND dsco.deleted = 0
AND dsco.payment_status IN ( '2', '3', '4', '5' )
AND dsco.if_end = 0
LEFT JOIN drive_school_process dsp ON main.user_id = dsp.user_id
AND dsco.course_id = dsp.course_id
AND dsp.`status` = '1'
WHERE
main.deleted = 0
AND dsco.is_sign = 1
GROUP BY
main.id
</select>
<select id="indexCusStudentList" resultType="cn.iocoder.yudao.module.base.vo.StudentCountVO">
</select>
<select id="getAll" resultType="cn.iocoder.yudao.module.base.vo.DriveSchoolStudentExportVo">
SELECT
name,
age,
CASE sex WHEN '0' THEN '男' WHEN '1' THEN '女' ELSE '未知' END AS sex,
phone,
CASE source
WHEN '01' THEN '驾校统招'
WHEN '02' THEN '教练自招'
WHEN '03' THEN '自来客户'
ELSE source
END AS source,
id_card AS idCard,
work_name AS workName,
regist_address AS registAddress,
address,
remark,
driving_student_code AS drivingStudentCode,
DATE_FORMAT(create_time, '%Y-%m-%d') AS createTimeStr
FROM drive_school_student
<where>
deleted = 0
<if test="entity.name != null and entity.name != ''">
AND name LIKE CONCAT('%', #{entity.name}, '%')
</if>
<if test="entity.phone != null and entity.phone != ''">
AND phone = #{entity.phone}
</if>
<if test="entity.idCard != null and entity.idCard != ''">
AND id_card LIKE CONCAT('%', #{entity.idCard}, '%')
</if>
</where>
</select>
</mapper>

View File

@ -58,7 +58,23 @@
<if test="entity.courseName != null and entity.courseName != '' "> and dsp.name like concat('%', #{entity.courseName}, '%')</if>
<if test="entity.userId != null "> and dsp.user_id = #{entity.userId}</if>
<if test="entity.courseId != null and entity.courseId != '' "> and dsp.course_id = #{entity.courseId}</if>
<if test="entity.studentIdCard != null and entity.studentIdCard != '' "> AND RIGHT(dss.id_card, 4) = RIGHT(#{entity.studentIdCard}, 4) </if>
<!--<if test="entity.studentIdCard != null and entity.studentIdCard != '' "> AND RIGHT(dss.id_card, 4) = RIGHT(#{entity.studentIdCard}, 4) </if>-->
<if test="entity.studentIdCard != null and entity.studentIdCard != '' ">
<choose>
<!-- 精确匹配当输入18位时 -->
<when test="entity.studentIdCard.length() == 18">
AND dss.id_card = #{entity.studentIdCard}
</when>
<!-- 后4位匹配当输入正好4位时 -->
<when test="entity.studentIdCard.length() == 4">
AND RIGHT(dss.id_card, 4) = #{entity.studentIdCard}
</when>
<!-- 模糊搜索当输入大于4位但不足18位时 -->
<otherwise>
AND dss.id_card LIKE concat('%', #{entity.studentIdCard}, '%')
</otherwise>
</choose>
</if>
</where>
ORDER BY
(CASE

View File

@ -42,9 +42,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
deleted = 0
<if test="entity.brand != null and entity.brand != ''"> and brand = #{entity.brand}</if>
<if test="entity.carModel != null and entity.carModel != ''"> and car_model = #{entity.carModel}</if>
<if test="entity.carNo != null and entity.carNo != ''"> and car_no = #{entity.carNo}</if>
<!-- <if test="entity.carNo != null and entity.carNo != ''"> and car_no = #{entity.carNo}</if>-->
<if test="entity.carNo != null and entity.carNo != ''"> and car_no like concat('%', #{entity.carNo}, '%')</if>
<if test="entity.courseType != null and entity.courseType != ''"> and course_type = #{entity.courseType}</if>
<if test="entity.carPhoto != null and vcarPhoto != ''"> and car_photo = #{entity.carPhoto}</if>
<if test="entity.carPhoto != null and carPhoto != ''"> and car_photo = #{entity.carPhoto}</if>
<if test="entity.carRegisterDate != null "> and car_register_date = #{entity.carRegisterDate}</if>
<if test="entity.inspectionDate != null "> and inspection_date = #{entity.inspectionDate}</if>
<if test="entity.userName != null and entity.userName != ''"> and user_name like concat('%', #{entity.userName}, '%')</if>
@ -55,7 +56,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="entity.outlineDate != null "> and outline_date = #{entity.outlineDate}</if>
<if test="entity.repairDate != null "> and repair_date = #{entity.repairDate}</if>
</where>
order by create_time desc
-- order by create_time desc
ORDER BY create_time DESC, id DESC
</select>
<select id="selectDriveSchoolCarListAll" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCar" resultMap="DriveSchoolCarResult">
@ -100,11 +102,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectTrainCar" resultType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCar">
SELECT
dsc.*
dscc.*
FROM
drive_school_car dsc
LEFT JOIN drive_school_train dst ON dsc.user_id = dst.coach_id
AND dst.deleted = 0
drive_school_train dst
LEFT JOIN drive_school_coach dsc ON dst.coach_id = dsc.user_id AND dst.deleted = 0
LEFT JOIN drive_school_car dscc ON dsc.car_id = dscc.car_no
WHERE
dst.id IS NOT NULL
AND dsc.deleted = 0
@ -115,7 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND dsc.car_no LIKE CONCAT('%',#{searchValue},'%')
</if>
<if test="courseType != null and courseType != ''">
AND dsc.course_type =#{courseType}
AND dscc.course_type =#{courseType}
</if>
<if test="startTime!=null and startTime!=''">
AND dst.create_time &gt;= #{startTime}
@ -124,7 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND dst.create_time &lt;= #{endTime}
</if>
GROUP BY
dsc.id
dscc.id
</select>

View File

@ -91,4 +91,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="getContractByUserId" resultType="cn.iocoder.yudao.module.jx.domain.DriveSchoolContract">
SELECT *FROM drive_school_contract WHERE user_id = #{userId} AND deleted = 0 ORDER BY id DESC LIMIT 1
</select>
</mapper>

View File

@ -34,7 +34,7 @@
<select id="selectTrainByCondition" resultType="cn.iocoder.yudao.module.train.vo.TrainVO">
SELECT
dst.*,
dsc.car_id
dsc.car_id AS carNo
FROM
drive_school_train dst
LEFT JOIN drive_school_coach dsc ON dst.coach_id = dsc.user_id

View File

@ -118,6 +118,15 @@ public class RoleController {
return success(roleService.selectListByRoleId(role));
}
/**
* 通过角色id查询角色
* @return
*/
@GetMapping("/selectListByRoleIdJX")
public CommonResult selectListByRoleIdJX(RolePageReqVO role){
return success(roleService.selectListByRoleIdJX(role));
}
/**
* 通过角色code查询用户
* @param code

View File

@ -42,6 +42,7 @@ public interface UserRoleMapper extends BaseMapperX<UserRoleDO> {
List<UserDTO> selectByRoleCode(@Param("tenantId") Long tenantId, @Param("roleCode") String roleCode);
IPage<UserDTO> selectListByRoleId(@Param("page") Page<UserDTO> page,@Param("role") RolePageReqVO role);
IPage<UserDTO> selectListByRoleIdJX(@Param("page") Page<UserDTO> page,@Param("role") RolePageReqVO role);
List<UserDTO> selectByRoleId(Integer roleId);

View File

@ -172,6 +172,7 @@ public interface RoleService {
List<RoleDO> pageByQuery(RoleDO roleDO);
IPage<UserDTO> selectListByRoleId(RolePageReqVO role);
IPage<UserDTO> selectListByRoleIdJX(RolePageReqVO role);
/**
* 根据用户id查询角色

View File

@ -362,6 +362,12 @@ public class RoleServiceImpl implements RoleService {
return userRoleMapper.selectListByRoleId(page,role);
}
@Override
public IPage<UserDTO> selectListByRoleIdJX(RolePageReqVO role) {
Page<UserDTO> page = new Page<>(role.getPageNo(), role.getPageSize());
return userRoleMapper.selectListByRoleIdJX(page,role);
}
/**
* 根据用户id查询角色
*

View File

@ -39,6 +39,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by su.nickname
</select>
<select id="selectListByRoleIdJX" resultType="cn.iocoder.yudao.module.system.api.user.dto.UserDTO"
parameterType="cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO">
select
su.id,
su.username,
su.nickname,
su.user_type,
su.remark,
su.dept_id,
su.mobile,
su.password,
su.sex,
su.open_id,
su.tenant_id,
su.status,
COALESCE(dsc.image, su.avatar) AS avatar,
GROUP_CONCAT(DISTINCT sr2.name SEPARATOR ',') AS roleNames
from system_users su
left join system_user_role sr on su.id = sr.user_id and sr.deleted = 0
left join system_role sr2 on sr.role_id = sr2.id
INNER JOIN drive_school_coach dsc ON dsc.user_id = su.id
<where>
su.deleted = 0 and sr2.service_package_id = 'jiaxiao'
<if test="role.nickname != null">
and (su.nickname like CONCAT('%',#{role.nickname},'%') OR su.username like
CONCAT('%',#{role.nickname},'%'))
</if>
</where>
group by su.id
<if test="role.roleId != null">
HAVING SUM(sr.role_id = #{role.roleId}) > 0
</if>
order by su.nickname
</select>
<select id="userCodes" resultType="cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO">
SELECT
su.id AS userId,sr.code AS roleCode,sr.id AS roleId, sr.service_package_id