Merge remote-tracking branch 'origin/driver' into driver
# Conflicts: # dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DlDriveSchoolStudentServiceImpl.java
This commit is contained in:
commit
78a7a65bba
@ -144,13 +144,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>5.2.5</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>5.2.5</version>
|
||||
<version>4.1.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -50,6 +50,7 @@
|
||||
from base_company bc
|
||||
left join system_tenant st on bc.tenant_id = st.id
|
||||
where FIND_IN_SET(#{map.serviceCodes}, bc.service_codes) > 0
|
||||
and bc.deleted = 0
|
||||
<if test="map.tenantId != null">
|
||||
and bc.tenant_id = #{map.tenantId}
|
||||
</if>
|
||||
|
@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.base.entity.DriveSchoolCourseDeduct;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCourseDeductService;
|
||||
import cn.iocoder.yudao.module.base.vo.DriveSchoolCourseDeductVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/base/drive-school-course-deduct")
|
||||
@RequiredArgsConstructor
|
||||
public class DlDriveSchoolCourseDeductController {
|
||||
|
||||
private final DlDriveSchoolCourseDeductService driveSchoolCourseDeductService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param request @class DriveSchoolCourseDeductVO
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 每页条数
|
||||
* @return @class DriveSchoolCourseDeductVO
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public CommonResult<?> page(DriveSchoolCourseDeductVO request,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<DriveSchoolCourseDeductVO> page = new Page<>(pageNo, pageSize);
|
||||
return CommonResult.success(driveSchoolCourseDeductService.queryPage(page, request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param list @class DriveSchoolCourseDeductVO
|
||||
* @return id
|
||||
*/
|
||||
@PostMapping
|
||||
public CommonResult<?> add(List<DriveSchoolCourseDeductVO> list) {
|
||||
driveSchoolCourseDeductService.add(list);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.base.entity;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.annotation.Excel;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 提成配置对象 drive_school_course_deduct
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Data
|
||||
public class DriveSchoolCourseDeduct extends TenantBaseDO
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键id */
|
||||
private Long id;
|
||||
|
||||
/** 提成比例 */
|
||||
@Excel(name = "提成比例")
|
||||
private BigDecimal deduct;
|
||||
|
||||
/** 科目id */
|
||||
private String courseId;
|
||||
|
||||
/** 科目 */
|
||||
@Excel(name = "科目")
|
||||
private String courseSubject;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.base.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DriveSchoolCourseDeduct;
|
||||
import cn.iocoder.yudao.module.base.vo.DriveSchoolCourseDeductVO;
|
||||
import cn.iocoder.yudao.module.jx.domain.DriveSchoolDeduct;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.pagehelper.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 提成配置Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Mapper
|
||||
public interface DriveSchoolCourseDeductMapper extends BaseMapper<DriveSchoolCourseDeduct>
|
||||
{
|
||||
IPage<DriveSchoolCourseDeductVO> queryPage(@Param("page") Page<DriveSchoolCourseDeductVO> page, @Param("request") DriveSchoolCourseDeductVO request);
|
||||
}
|
@ -24,7 +24,7 @@ public interface DlDriveSchoolCoachCourseService extends IService<DlDriveSchoolC
|
||||
* @author PQZ
|
||||
* @date 17:14 2025/2/7
|
||||
**/
|
||||
void saveCoachCourse(String courseId, String courseName, String courseType, List<DlDriveSchoolCoachVO> coachList);
|
||||
void saveCoachCourse(String courseId, String courseName, String courseType, List<DlDriveSchoolCoachVO> coachList);
|
||||
|
||||
/**
|
||||
* 通过课程id删除课程与教练关联关系
|
||||
|
@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.base.service;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DriveSchoolCourseDeduct;
|
||||
import cn.iocoder.yudao.module.base.vo.DriveSchoolCourseDeductVO;
|
||||
import cn.iocoder.yudao.module.jx.domain.DriveSchoolDeduct;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.pagehelper.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 提成配置Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
public interface DlDriveSchoolCourseDeductService extends IService<DriveSchoolCourseDeduct> {
|
||||
|
||||
/**
|
||||
* 分页查询提成配置
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param request 查询参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<DriveSchoolCourseDeductVO> queryPage(Page<DriveSchoolCourseDeductVO> page, DriveSchoolCourseDeductVO request);
|
||||
|
||||
/**
|
||||
* 新增提成配置
|
||||
*
|
||||
* @param list 新增参数
|
||||
* @return 新增结果
|
||||
*/
|
||||
void add(List<DriveSchoolCourseDeductVO> list);
|
||||
|
||||
/**
|
||||
* 新增默认提成配置
|
||||
*
|
||||
* @param courseId 课程id
|
||||
*/
|
||||
void defaultAdd(String courseId);
|
||||
}
|
@ -180,7 +180,7 @@ public class DataViewServiceImpl implements DataViewService {
|
||||
//教练查询
|
||||
/*1.学员情况*/
|
||||
List<DlDriveSchoolStudentVO> studentVOList = studentMapper.selectStudentListCoach(coachId,startTimeStr,endTimeStr);
|
||||
int overNum = (int) studentVOList.stream().filter(item -> null != item.getGradTime()).count();
|
||||
int overNum = (int) studentVOList.stream().filter(item -> null != item.getOrderGradTime()).count();
|
||||
int noOverNum = studentVOList.size()-overNum;
|
||||
Map<String,Object> studentInfoMap = new HashMap<>();
|
||||
studentInfoMap.put("allNum",studentVOList.size());
|
||||
|
@ -0,0 +1,77 @@
|
||||
package cn.iocoder.yudao.module.base.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.base.entity.DriveSchoolCourseDeduct;
|
||||
import cn.iocoder.yudao.module.base.mapper.DriveSchoolCourseDeductMapper;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCourseDeductService;
|
||||
import cn.iocoder.yudao.module.base.vo.DriveSchoolCourseDeductVO;
|
||||
import cn.iocoder.yudao.module.jx.domain.DriveSchoolDeduct;
|
||||
import cn.iocoder.yudao.module.jx.mapper.DriveSchoolDeductMapper;
|
||||
import cn.iocoder.yudao.module.jx.service.IDriveSchoolDeductService;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 提成配置Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DlDriveSchoolCourseDeductServiceImpl extends ServiceImpl<DriveSchoolCourseDeductMapper, DriveSchoolCourseDeduct> implements DlDriveSchoolCourseDeductService {
|
||||
private final AdminUserApi userApi;
|
||||
|
||||
private final IDriveSchoolDeductService deductService;
|
||||
|
||||
/**
|
||||
* 分页查询提成配置
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param request 查询参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
@Override
|
||||
public IPage<DriveSchoolCourseDeductVO> queryPage(Page<DriveSchoolCourseDeductVO> page, DriveSchoolCourseDeductVO request) {
|
||||
return baseMapper.queryPage(page, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增提成配置
|
||||
*
|
||||
* @param list 新增参数
|
||||
* @return 新增结果
|
||||
*/
|
||||
@Override
|
||||
public void add(List<DriveSchoolCourseDeductVO> list) {
|
||||
List<DriveSchoolCourseDeduct> driveSchoolCourseDeducts = BeanUtil.copyToList(list, DriveSchoolCourseDeduct.class);
|
||||
saveBatch(driveSchoolCourseDeducts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增默认提成配置
|
||||
*
|
||||
* @param courseId 课程id
|
||||
*/
|
||||
@Override
|
||||
public void defaultAdd(String courseId) {
|
||||
//查询默认提成配置
|
||||
List<DriveSchoolDeduct> defaultDeduct = deductService.list();
|
||||
if (CollectionUtils.isNotEmpty(defaultDeduct)) {
|
||||
List<DriveSchoolCourseDeduct> driveSchoolCourseDeducts = BeanUtil.copyToList(defaultDeduct, DriveSchoolCourseDeduct.class);
|
||||
driveSchoolCourseDeducts.stream().map(driveSchoolCourseDeduct -> driveSchoolCourseDeduct.setCourseId(courseId));
|
||||
saveBatch(driveSchoolCourseDeducts);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoachCourse;
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCourse;
|
||||
import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolCourseMapper;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCoachCourseService;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCourseDeductService;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCourseService;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachVO;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO;
|
||||
@ -37,6 +38,8 @@ public class DlDriveSchoolCourseServiceImpl extends ServiceImpl<DlDriveSchoolCou
|
||||
private DlDriveSchoolCourseMapper courseMapper;
|
||||
@Resource
|
||||
private DlDriveSchoolCoachCourseService coachCourseService;
|
||||
@Resource
|
||||
private DlDriveSchoolCourseDeductService driveSchoolCourseDeductService;
|
||||
|
||||
/**
|
||||
* 分页查询驾校课程
|
||||
@ -87,6 +90,8 @@ public class DlDriveSchoolCourseServiceImpl extends ServiceImpl<DlDriveSchoolCou
|
||||
DlDriveSchoolCourse course = BeanUtils.toBean(courseVO, DlDriveSchoolCourse.class);
|
||||
saveOrUpdate(course);
|
||||
coachCourseService.saveCoachCourse(course.getId(), courseVO.getName(), courseVO.getType(), courseVO.getCoachList());
|
||||
// 保存提成信息
|
||||
driveSchoolCourseDeductService.defaultAdd(course.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,8 +1,10 @@
|
||||
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.DateUtil;
|
||||
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.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
@ -15,10 +17,14 @@ 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.StudentCountVO;
|
||||
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.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.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -32,10 +38,13 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Comparator;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_CUS;
|
||||
|
||||
/**
|
||||
* 驾校学员 Service 实现类
|
||||
*
|
||||
@ -59,11 +68,33 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
|
||||
@Resource
|
||||
private UniqueCodeService uniqueCodeService;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Override
|
||||
public String createDlDriveSchoolStudent(DlDriveSchoolStudentVO createReqVO) {
|
||||
// 插入
|
||||
DlDriveSchoolStudent dlDriveSchoolStudent = BeanUtils.toBean(createReqVO, DlDriveSchoolStudent.class);
|
||||
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) {
|
||||
// 生成唯一推广码
|
||||
String uniqueCode = uniqueCodeService.createUniqueCode();
|
||||
@ -72,13 +103,12 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
|
||||
dlDriveSchoolStudent.setDrivingStudentCode(generateDrivingStudentCode());
|
||||
dlDriveSchoolStudentMapper.insert(dlDriveSchoolStudent);
|
||||
return dlDriveSchoolStudent.getId();
|
||||
}else {
|
||||
} else {
|
||||
dlDriveSchoolStudent.setId(studentByIdCard.getId());
|
||||
dlDriveSchoolStudent.setUniqueCode(studentByIdCard.getUniqueCode());
|
||||
dlDriveSchoolStudentMapper.updateById(dlDriveSchoolStudent);
|
||||
return studentByIdCard.getId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -260,7 +290,30 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
|
||||
IPage<DlDriveSchoolStudentVO> pageResult = dlDriveSchoolStudentMapper.selectByCoachId(pageReqVO, page);
|
||||
pageResult.getRecords().forEach(item -> {
|
||||
//查每个学生的当前所处的科目
|
||||
item.setProcess(processService.selectByUserId(item.getUserId(), item.getCoachId()));
|
||||
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"));
|
||||
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;
|
||||
}
|
||||
|
@ -29,4 +29,10 @@ public class DlDriveSchoolStudentVO extends DlDriveSchoolStudent {
|
||||
private String startTime;
|
||||
/**查询时间范围--结束*/
|
||||
private String endTime;
|
||||
/**订单表中的毕业时间*/
|
||||
private String orderGradTime;
|
||||
/**课程名称*/
|
||||
private String courseName;
|
||||
/**订单ID*/
|
||||
private String orderId;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package cn.iocoder.yudao.module.base.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DriveSchoolCourseDeduct;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DriveSchoolCourseDeductVO extends DriveSchoolCourseDeduct {
|
||||
/**课程名称*/
|
||||
private String courseName;
|
||||
}
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.course.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
@ -327,12 +328,49 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
.eq(SchoolCourseOrder::getId, request.getOrderId())
|
||||
.set(SchoolCourseOrder::getIfAssignmentCoach, SchoolBaseConstants.SCHOOL_COURSE_ORDER_IS_ASSIGN_COACH));
|
||||
|
||||
// 查询进度
|
||||
List<Process> processList = list(Wrappers.lambdaQuery(Process.class)
|
||||
.eq(Process::getCourseId, courseId)
|
||||
.eq(Process::getUserId, userId));
|
||||
|
||||
Process process = processList.stream()
|
||||
.filter(p -> "1".equals(p.getStatus()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (process == null) {
|
||||
// 没有进行中的
|
||||
Process maxCompleted = processList.stream()
|
||||
.filter(p -> "2".equals(p.getStatus()))
|
||||
.max(Comparator.comparing(Process::getSubject))
|
||||
.orElse(null);
|
||||
|
||||
if (maxCompleted != null) {
|
||||
// 尝试找 subject == maxCompleted + 1 的
|
||||
Process next = processList.stream()
|
||||
.filter(p -> p.getSubject().equals(maxCompleted.getSubject() + 1))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
process = next != null ? next : maxCompleted;
|
||||
} else {
|
||||
// 没有已完成的,找 subject 最小的
|
||||
process = processList.stream()
|
||||
.min(Comparator.comparing(Process::getSubject))
|
||||
.orElse(null);
|
||||
}
|
||||
process.setStatus("1");
|
||||
//更新
|
||||
updateById(process);
|
||||
}
|
||||
|
||||
|
||||
// 发送通知内容
|
||||
String message = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_ASSIGN_COACH,
|
||||
processes.get(0).getCoachName(),
|
||||
processes.get(1).getCoachName(),
|
||||
processes.get(2).getCoachName(),
|
||||
processes.get(3).getCoachName());
|
||||
request.getProcessList().get(0).getCoachName(),
|
||||
request.getProcessList().get(1).getCoachName(),
|
||||
request.getProcessList().get(2).getCoachName(),
|
||||
request.getProcessList().get(3).getCoachName());
|
||||
|
||||
// 发送消息给学员
|
||||
schoolNotifyMessageSendService.sendMessage(userId, message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_MEMBER, null);
|
||||
|
@ -101,32 +101,35 @@
|
||||
</select>
|
||||
<select id="selectByCoachId" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
|
||||
SELECT
|
||||
temp.*
|
||||
temp.*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
dss.*
|
||||
FROM
|
||||
drive_school_process dsp
|
||||
LEFT JOIN drive_school_student dss ON dsp.user_id = dss.user_id
|
||||
WHERE
|
||||
dsp.deleted = 0
|
||||
AND dsp.coach_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 >= #{entity.startTime}
|
||||
</if>
|
||||
<if test="entity.endTime!=null and entity.endTime!=''">
|
||||
AND dss.create_time <= #{entity.endTime}
|
||||
</if>
|
||||
AND dss.id IS NOT NULL
|
||||
ORDER BY
|
||||
dss.create_time DESC
|
||||
) temp
|
||||
(
|
||||
SELECT
|
||||
dss.*,dsco.id AS orderId,dsco.course_name,dsp.coach_id,dsp.course_id
|
||||
FROM
|
||||
drive_school_process dsp
|
||||
LEFT JOIN drive_school_student dss ON dsp.user_id = dss.user_id
|
||||
LEFT JOIN drive_school_course_order dsco ON dsp.user_id = dsco.user_id AND dsp.course_id = dsco.course_id
|
||||
WHERE
|
||||
dsp.deleted = 0
|
||||
AND dsco.if_end = 0
|
||||
AND dsco.deleted = 0
|
||||
AND dsp.coach_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 >= #{entity.startTime}
|
||||
</if>
|
||||
<if test="entity.endTime!=null and entity.endTime!=''">
|
||||
AND dss.create_time <= #{entity.endTime}
|
||||
</if>
|
||||
AND dss.id IS NOT NULL
|
||||
ORDER BY
|
||||
dss.create_time DESC
|
||||
) temp
|
||||
GROUP BY
|
||||
temp.user_id
|
||||
temp.orderId
|
||||
</select>
|
||||
<select id="selectStudentList" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
|
||||
SELECT
|
||||
@ -150,14 +153,16 @@
|
||||
</select>
|
||||
<select id="selectStudentListCoach" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
|
||||
SELECT
|
||||
dss.*
|
||||
dss.*,dsco.grad_time AS orderGradTime,dsco.id AS orderId
|
||||
FROM
|
||||
drive_school_process dsp
|
||||
LEFT JOIN drive_school_student dss ON dsp.user_id = dss.user_id
|
||||
AND dss.deleted = 0
|
||||
drive_school_process dsp
|
||||
LEFT JOIN drive_school_student dss ON dsp.user_id = dss.user_id
|
||||
LEFT JOIN drive_school_course_order dsco ON dsp.user_id = dsco.user_id AND dsp.course_id = dsco.course_id
|
||||
WHERE
|
||||
dsp.deleted = 0
|
||||
AND dss.id IS NOT NULL
|
||||
dsp.deleted = 0
|
||||
AND dsco.if_end = 0
|
||||
AND dsco.deleted = 0
|
||||
AND dss.id IS NOT NULL
|
||||
<if test="coachId != null and coachId != ''">
|
||||
AND dsp.coach_id = #{coachId}
|
||||
</if>
|
||||
@ -168,7 +173,27 @@
|
||||
AND dss.create_time <= #{endTime}
|
||||
</if>
|
||||
GROUP BY
|
||||
dss.id
|
||||
dsco.id
|
||||
<!-- 旧的sql-->
|
||||
<!-- SELECT-->
|
||||
<!-- dss.*-->
|
||||
<!-- FROM-->
|
||||
<!-- drive_school_process dsp-->
|
||||
<!-- LEFT JOIN drive_school_student dss ON dsp.user_id = dss.user_id-->
|
||||
<!-- WHERE-->
|
||||
<!-- dsp.deleted = 0-->
|
||||
<!-- AND dss.id IS NOT NULL-->
|
||||
<!-- <if test="coachId != null and coachId != ''">-->
|
||||
<!-- AND dsp.coach_id = #{coachId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="startTime!=null and startTime!=''">-->
|
||||
<!-- AND dss.create_time >= #{startTime}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="endTime!=null and endTime!=''">-->
|
||||
<!-- AND dss.create_time <= #{endTime}-->
|
||||
<!-- </if>-->
|
||||
<!-- GROUP BY-->
|
||||
<!-- dsp.id-->
|
||||
</select>
|
||||
<select id="selectTrainStudent" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
|
||||
SELECT
|
||||
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.base.mapper.DriveSchoolCourseDeductMapper">
|
||||
|
||||
<select id="queryPage" resultType="cn.iocoder.yudao.module.base.vo.DriveSchoolCourseDeductVO">
|
||||
SELECT main.*, dsc.name AS courseName
|
||||
FROM drive_school_course_deduct main
|
||||
LEFT JOIN drive_school_course dsc ON main.course_id = dsc.id
|
||||
</select>
|
||||
</mapper>
|
@ -30,6 +30,12 @@
|
||||
<groupId>com.deepoove</groupId>
|
||||
<artifactId>poi-tl</artifactId>
|
||||
<version>1.10.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
|
@ -757,7 +757,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 构建数据对象
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
String fileName = "结算单.docx";
|
||||
String tmpPath = "D:\\" + fileName;
|
||||
String tmpPath = fileName;
|
||||
// 设置列表配置,如果有多个列表时需加.bind("list1", policy) 新列表配置即可
|
||||
ConfigureBuilder configureBuilder = Configure.builder();
|
||||
/*
|
||||
@ -824,7 +824,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
if (ObjectUtil.isEmpty(item.getItemDiscount())) {
|
||||
itemDiscount = new BigDecimal("1.00");
|
||||
}
|
||||
project.put("repDiscount", itemDiscount.equals(new BigDecimal("1.00")) ? "无折扣" : item.getItemDiscount());
|
||||
project.put("repDiscount", itemDiscount.equals(new BigDecimal("1.00")) ? "1" : item.getItemDiscount());
|
||||
// 工时费 项目打折后的费用
|
||||
// 取不到先给0
|
||||
project.put("labourAmount", item.getItemMoney());
|
||||
@ -1016,7 +1016,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
|
||||
Configure config = configureBuilder.build();
|
||||
try {
|
||||
InputStream inputStream = XWPFTemplate.class.getResourceAsStream("/templates/ticketTemplate.docx");
|
||||
InputStream inputStream = XWPFTemplate.class.getResourceAsStream("/templates/modified_ticketTemplate.docx");
|
||||
XWPFTemplate template = XWPFTemplate.compile(inputStream, config);
|
||||
template.render(params);
|
||||
FileOutputStream fos = new FileOutputStream(tmpPath);
|
||||
|
@ -0,0 +1,99 @@
|
||||
|
||||
泸州市蓝安汽车销售有限公司
|
||||
{{@qrCode}}
|
||||
车辆维修结算单
|
||||
工号:{{jobNumber}}
|
||||
客户名称:
|
||||
{{customerName}}
|
||||
送修人:
|
||||
{{repairer}}
|
||||
送修人电话:
|
||||
{{repairerTelephone}}
|
||||
车牌:
|
||||
{{plate}}
|
||||
车型:
|
||||
{{carType}}
|
||||
发动机号码:
|
||||
{{engineNumber}}
|
||||
车架号:
|
||||
{{frameNumber}}
|
||||
开单时间:
|
||||
{{billingTime}}
|
||||
已行里程:
|
||||
{{mileage}}
|
||||
三包单位:
|
||||
{{tripleUnit}}
|
||||
保险名称:
|
||||
{{insuranceName}}
|
||||
旧件处理:
|
||||
{{oldhandle}}
|
||||
维修内容
|
||||
{{projects}}序号
|
||||
维修项目
|
||||
单价
|
||||
数量
|
||||
折扣率
|
||||
工时费
|
||||
主修人
|
||||
备注
|
||||
性质
|
||||
[repRort]
|
||||
[repItem]
|
||||
[repPrice]
|
||||
[repCount]
|
||||
[repDiscount]
|
||||
[labourAmount]
|
||||
[major]
|
||||
[repRemark]
|
||||
[repNature]
|
||||
材料清单
|
||||
{{wares}}序号
|
||||
配件件号
|
||||
名称
|
||||
单位
|
||||
单价
|
||||
数量
|
||||
折扣率
|
||||
金额
|
||||
备注
|
||||
性质
|
||||
[matRort]
|
||||
[matNum]
|
||||
[matName]
|
||||
[matUnit]
|
||||
[matPrice]
|
||||
[matCount]
|
||||
[matDiscount]
|
||||
[matAmount]
|
||||
[matRemark]
|
||||
[matNature]
|
||||
小计
|
||||
|
||||
|
||||
|
||||
|
||||
{{matTotalAmount}}
|
||||
|
||||
|
||||
材料费:{{matCost}}
|
||||
材料费优惠:{{matFavorable}}
|
||||
管理费:{{manageCost}}
|
||||
总费用:{{matTotalCost}}
|
||||
工时费:{{labourCost}}
|
||||
工时费优惠:{{labourFavorable}}
|
||||
其他费:{{otherCost}}
|
||||
材料工时优惠:{{matlabourFavorable}}
|
||||
救援费:{{rescueCost}}
|
||||
三包费:{{tripleCost}}
|
||||
定损费:{{lossCost}}
|
||||
应收费:{{allCost}}
|
||||
大写:{{bigAllCost}}
|
||||
付款情况:
|
||||
{{costCondition}}
|
||||
工单备注:{{paperRemark}}
|
||||
客户签字:
|
||||
结算备注:{{costRemark}}
|
||||
|
||||
单位:{{corporation}} 服务顾问:{{serviceConsultant}} 联系电话:{{serviceTelephone}}
|
||||
开户行:{{bank}} 地址:{{bankAddress}}
|
||||
账号:{{account}} 结算日期:{{settleDate}}
|
Loading…
Reference in New Issue
Block a user