This commit is contained in:
xyc 2025-04-29 16:06:22 +08:00
parent bf96e6f341
commit 6d79a705e9
6 changed files with 121 additions and 90 deletions

View File

@ -79,6 +79,18 @@ public interface DlDriveSchoolStudentMapper extends BaseMapper<DlDriveSchoolStud
**/
List<DlDriveSchoolStudentVO> selectStudentList(@Param("coachId") Long coachId, @Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 查学生列表---驾校层面查询
*
* @param coachId 教练ID
* @param startTime 开始时间
* @param endTime 结束时间
* @return java.util.List<cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO>
* @author vinjor-M
* @date 15:13 2025/2/14
**/
List<DlDriveSchoolStudentVO> selectStudentListByOrder(@Param("coachId") Long coachId, @Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 教练层面查询自己的学生列表
*
@ -134,4 +146,4 @@ public interface DlDriveSchoolStudentMapper extends BaseMapper<DlDriveSchoolStud
* @return java.util.List<cn.iocoder.yudao.module.base.vo.StudentCountVO>
**/
List<StudentCountVO> indexCusStudentList(String startTime, String endTime);
}
}

View File

@ -24,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -154,8 +156,8 @@ public class DataViewServiceImpl implements DataViewService {
schoolRate = (double)schoolNum / allNum;
}
}
studentInfoMap.put("coachNum",coachNum);
studentInfoMap.put("coachAmount",coachAmount);
studentInfoMap.put("coachNum", new BigDecimal(coachNum).setScale(2, RoundingMode.HALF_UP));
studentInfoMap.put("coachAmount", new BigDecimal(coachAmount).setScale(2, RoundingMode.HALF_UP));
studentInfoMap.put("coachRate",0!=coachRate?(Double.parseDouble(df.format(coachRate))*100):0);
studentInfoMap.put("schoolNum",schoolNum);
studentInfoMap.put("schoolAmount",schoolAmount);

View File

@ -288,7 +288,7 @@ public class DlDriveSchoolCoachServiceImpl extends ServiceImpl<DlDriveSchoolCoac
result.setCoachInfo(coach);
/*2.车辆信息*/
DriveSchoolCar schoolCar = new DriveSchoolCar();
if (ObjectUtil.isNotEmpty(coach.getCarId())) {
if (ObjectUtil.isNotEmpty(schoolCar)) {
if (null != coach.getUserId()) {
schoolCar = schoolCarService.selectByCoachId(coach.getUserId());
if (null != schoolCar.getCarRegisterDate()) {
@ -300,75 +300,75 @@ public class DlDriveSchoolCoachServiceImpl extends ServiceImpl<DlDriveSchoolCoac
result.setCar(schoolCar);
/*3.统计教练的学生基本信息*/
//毕业情况
List<DlDriveSchoolStudentVO> studentVOList = studentMapper.selectStudentListCoach(coach.getUserId(), null, null);
List<DlDriveSchoolStudentVO> studentVOList = studentMapper.selectStudentListCoach(coach.getUserId(),null,null);
int overNum = (int) studentVOList.stream().filter(item -> null != item.getGradTime()).count();
int noOverNum = studentVOList.size() - overNum;
Map<String, Object> studentInfoMap = new HashMap<>();
studentInfoMap.put("overNum", overNum);
studentInfoMap.put("noOverNum", noOverNum);
int noOverNum = studentVOList.size()-overNum;
Map<String,Object> studentInfoMap = new HashMap<>();
studentInfoMap.put("overNum",overNum);
studentInfoMap.put("noOverNum",noOverNum);
//考试情况
List<ExamBatchItemVO> examBatchItemVOList = examBatchItemMapper.selectByCoachId(coach.getUserId(), null, null);
List<ExamBatchItemVO> examBatchItemVOList = examBatchItemMapper.selectByCoachId(coach.getUserId(),null,null);
Double subject2Num = 0.0;
Double subject3Num = 0.0;
Double subject2PassNum = 0.0;
Double subject3PassNum = 0.0;
for (ExamBatchItemVO exam : examBatchItemVOList) {
if (2 == exam.getSubject()) {
for (ExamBatchItemVO exam:examBatchItemVOList){
if(2==exam.getSubject()){
subject2Num++;
if (null != exam.getIfPass() && exam.getIfPass()) {
if(null!=exam.getIfPass() && exam.getIfPass()){
//考试通过
subject2PassNum++;
}
} else if (3 == exam.getSubject()) {
}else if(3==exam.getSubject()){
subject3Num++;
if (null != exam.getIfPass() && exam.getIfPass()) {
if(null!=exam.getIfPass() && exam.getIfPass()){
//考试通过
subject3PassNum++;
}
}
}
double subject2Rate = 0;
double subject3Rate = 0;
if (0 != subject2Num && 0 != subject2PassNum) {
double subject2Rate=0;
double subject3Rate=0;
if(0!=subject2Num && 0!=subject2PassNum){
subject2Rate = subject2PassNum / subject2Num;
}
if (0 != subject3Num && 0 != subject3PassNum) {
if(0!=subject3Num && 0!=subject3PassNum){
subject3Rate = subject3PassNum / subject3Num;
}
studentInfoMap.put("subject2All", subject2Num);
studentInfoMap.put("subject2Pass", subject2PassNum);
studentInfoMap.put("subject2Rate", 0 != subject2Rate ? (Double.parseDouble(df.format(subject2Rate)) * 100) : 0);
studentInfoMap.put("subject3All", subject3Num);
studentInfoMap.put("subject3Pass", subject3PassNum);
studentInfoMap.put("subject3Rate", 0 != subject3Rate ? (Double.parseDouble(df.format(subject3Rate)) * 100) : 0);
studentInfoMap.put("subject2All",subject2Num);
studentInfoMap.put("subject2Pass",subject2PassNum);
studentInfoMap.put("subject2Rate",0!=subject2Rate?(Double.parseDouble(df.format(subject2Rate))*100):0);
studentInfoMap.put("subject3All",subject3Num);
studentInfoMap.put("subject3Pass",subject3PassNum);
studentInfoMap.put("subject3Rate",0!=subject3Rate?(Double.parseDouble(df.format(subject3Rate))*100):0);
//招生情况
List<DlDriveSchoolStudentVO> studentList = studentMapper.selectStudentList(coach.getUserId(), null, null);
int coachNum = 0;
double coachAmount = 0;
for (DlDriveSchoolStudentVO item : studentList) {
if ("02".equals(item.getSource())) {
int coachNum=0;
double coachAmount=0;
for (DlDriveSchoolStudentVO item:studentList){
if("02".equals(item.getSource())){
//教练自招
coachNum++;
coachAmount = coachAmount + item.getPriceAmount();
coachAmount = coachAmount+item.getPriceAmount();
}
}
studentInfoMap.put("coachNum", coachNum);
studentInfoMap.put("coachAmount", coachAmount);
studentInfoMap.put("coachNum",coachNum);
studentInfoMap.put("coachAmount",coachAmount);
//训练情况
List<TrainVO> trainList = trainMapper.selectTrainByCondition(coach.getUserId(), null, null);
List<TrainVO> trainList = trainMapper.selectTrainByCondition(coach.getUserId(),null,null);
Set<Long> allUserSet = new HashSet<>();
Double trainTime = 0.0;
for (TrainVO item : trainList) {
for (TrainVO item:trainList){
allUserSet.add(item.getUserId());
if (null != item.getTrainTime()) {
trainTime = trainTime + item.getTrainTime();
if(null!=item.getTrainTime()){
trainTime =trainTime+item.getTrainTime();
}
}
studentInfoMap.put("trainUserNum", allUserSet.size());
studentInfoMap.put("trainTime", trainTime);
studentInfoMap.put("trainUserNum",allUserSet.size());
studentInfoMap.put("trainTime",trainTime);
result.setStudentInfoMap(studentInfoMap);
/*4.财务情况*/
List<SchoolCommission> commissionList = commissionMapper.selectByCoachId(coach.getUserId(), null, null);
List<SchoolCommission> commissionList = commissionMapper.selectByCoachId(coach.getUserId(),null,null);
//科目2当月应付
Double subject2MonthShowed = 0.0;
//科目2累计已付
@ -385,39 +385,39 @@ public class DlDriveSchoolCoachServiceImpl extends ServiceImpl<DlDriveSchoolCoac
// 获取当前月份的开始时间和结束时间
DateTime startOfMonth = DateUtil.beginOfMonth(DateUtil.date());
DateTime endOfMonth = DateUtil.endOfMonth(DateUtil.date());
for (SchoolCommission item : commissionList) {
for (SchoolCommission item:commissionList){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String localDateTimeNowStr = item.getCreateTime().format(formatter);
DateTime createTime = DateUtil.parse(localDateTimeNowStr);
if ("2".equals(item.getSubject())) {
//科目二
subject2Showed = subject2Showed + item.getCommissionAmount().doubleValue();
if (null != item.getIfPay() && item.getIfPay()) {
subject2Payed = subject2Payed + item.getCommissionAmount().doubleValue();
if("2".equals(item.getSubject())){
//科目二
subject2Showed=subject2Showed+item.getCommissionAmount().doubleValue();
if(null!=item.getIfPay() && item.getIfPay()){
subject2Payed=subject2Payed+item.getCommissionAmount().doubleValue();
}
if (createTime.isAfterOrEquals(startOfMonth) && createTime.isBeforeOrEquals(endOfMonth)) {
if(createTime.isAfterOrEquals(startOfMonth) && createTime.isBeforeOrEquals(endOfMonth)){
//在当月内
subject2MonthShowed = subject2MonthShowed + item.getCommissionAmount().doubleValue();
subject2MonthShowed = subject2MonthShowed+item.getCommissionAmount().doubleValue();
}
} else if ("3".equals(item.getSubject())) {
}else if("3".equals(item.getSubject())){
//科目三
subject3Showed = subject3Showed + item.getCommissionAmount().doubleValue();
if (null != item.getIfPay() && item.getIfPay()) {
subject3Payed = subject3Payed + item.getCommissionAmount().doubleValue();
subject3Showed=subject3Showed+item.getCommissionAmount().doubleValue();
if(null!=item.getIfPay() && item.getIfPay()){
subject3Payed=subject3Payed+item.getCommissionAmount().doubleValue();
}
if (createTime.isAfterOrEquals(startOfMonth) && createTime.isBeforeOrEquals(endOfMonth)) {
if(createTime.isAfterOrEquals(startOfMonth) && createTime.isBeforeOrEquals(endOfMonth)){
//在当月内
subject3MonthShowed = subject3MonthShowed + item.getCommissionAmount().doubleValue();
subject3MonthShowed = subject3MonthShowed+item.getCommissionAmount().doubleValue();
}
}
}
Map<String, Object> financeMap = new HashMap<>();
financeMap.put("subject2MonthShowed", subject2MonthShowed);
financeMap.put("subject2Showed", subject2Showed);
financeMap.put("subject2Payed", subject2Payed);
financeMap.put("subject3MonthShowed", subject3MonthShowed);
financeMap.put("subject3Showed", subject3Showed);
financeMap.put("subject3Payed", subject3Payed);
Map<String,Object> financeMap = new HashMap<>();
financeMap.put("subject2MonthShowed",subject2MonthShowed);
financeMap.put("subject2Showed",subject2Showed);
financeMap.put("subject2Payed",subject2Payed);
financeMap.put("subject3MonthShowed",subject3MonthShowed);
financeMap.put("subject3Showed",subject3Showed);
financeMap.put("subject3Payed",subject3Payed);
result.setFinanceMap(financeMap);
return result;
}

View File

@ -41,7 +41,7 @@
LEFT JOIN drive_school_coach_course dscc ON main.id = dscc.coach_id AND dscc.deleted = 0
LEFT JOIN drive_school_car dsc ON main.user_id = dsc.user_id AND dsc.deleted = 0
<where>
main.deleted = 0
main.deleted = 0 AND dscc.is_sign = 1 AND dscc.deleted = 0 AND dscc.if_end = 0
<if test="entity.type != null and entity.type != ''">
AND main.type = #{entity.type}
</if>

View File

@ -138,7 +138,7 @@
dss.* ,SUM(dsco.reserve_money+dsco.rest_money)AS priceAmount
FROM
drive_school_student dss
LEFT JOIN drive_school_course_order dsco ON dss.user_id=dsco.user_id AND dsco.deleted=0
LEFT JOIN drive_school_course_order dsco ON dss.user_id=dsco.user_id AND dsco.deleted=0 AND dsco.if_end=0 AND dsco.is_sign = 1
WHERE
dss.deleted=0
AND dsco.id IS NOT NULL
@ -153,6 +153,22 @@
</if>
GROUP BY dss.id
</select>
<select id="selectStudentListByOrder" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
SELECT dss.*,SUM(dsco.reserve_money+dsco.rest_money)AS priceAmount
FROM drive_school_course_order dsco
LEFT JOIN drive_school_student dss ON dsco.user_id=dss.user_id AND dss.deleted=0
WHERE dsco.deleted=0
<if test="startTime!=null and startTime!=''">
AND dsco.create_time &gt;= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
AND dsco.create_time &lt;= #{endTime}
</if>
<if test="coachId!=null and coachId!=''">
AND dsco.coach_id=#{coachId}
</if>
GROUP BY dss.id
</select>
<select id="selectStudentListCoach" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
SELECT
dss.*,dsco.grad_time AS orderGradTime,dsco.id AS orderId
@ -240,21 +256,21 @@
</select>
<select id="indexGetTrainList" resultType="cn.iocoder.yudao.module.base.vo.StudentCountVO">
SELECT
c.id,
c.image AS image,
c.NAME AS coachName,
c.car_id AS carId,
c.user_id AS userId,
COUNT(DISTINCT s.user_id) AS totalNum,
COUNT(DISTINCT CASE WHEN o.course_type = 'C1' THEN o.user_id END) AS c1Num,
COUNT(DISTINCT CASE WHEN o.course_type = 'C2' THEN o.user_id END) AS c2Num
c.id,
c.image AS image,
c.NAME AS coachName,
c.car_id AS carId,
c.user_id AS userId,
COUNT(DISTINCT s.user_id) AS totalNum,
COUNT(DISTINCT CASE WHEN o.course_type = 'C1' THEN o.user_id END) AS c1Num,
COUNT(DISTINCT CASE WHEN o.course_type = 'C2' THEN o.user_id END) AS c2Num
FROM
drive_school_coach c
LEFT JOIN drive_school_student s ON c.user_id = s.source_user_id AND s.deleted=0
drive_school_coach c
LEFT JOIN drive_school_student s ON c.user_id = s.source_user_id AND s.deleted=0
<if test="type != null and type != ''">
AND s.source = #{type}
</if>
LEFT JOIN drive_school_course_order o ON s.user_id = o.user_id AND o.payment_status > 1 AND o.deleted=0
LEFT JOIN drive_school_course_order o ON s.user_id = o.user_id AND o.payment_status > 1 AND o.deleted=0 AND o.is_sign = 1 AND o.if_end = 0
<if test="startTime != null and startTime != ''">
AND o.create_time &gt;= #{startTime}
</if>
@ -262,25 +278,26 @@
AND o.create_time &lt;= #{endTime}
</if>
WHERE
c.deleted = 0
<if test="coachId != null and coachId != ''">
AND c.user_id = #{coachId}
</if>
<if test="type != null and type != ''">
<choose>
<when test="type=='01'">
AND c.type='yg'
</when>
<when test="type=='02'">
AND c.type='jl'
</when>
</choose>
</if>
c.deleted = 0
<if test="coachId != null and coachId != ''">
AND c.user_id = #{coachId}
</if>
<if test="type != null and type != ''">
<choose>
<when test="type=='01'">
AND c.type='yg'
</when>
<when test="type=='02'">
AND c.type='jl'
</when>
</choose>
</if>
GROUP BY
c.id
c.id
ORDER BY
totalNum DESC
totalNum DESC
</select>
<select id="indexGetFormList" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO">
SELECT
main.id AS id,

View File

@ -47,7 +47,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
default PageResult<AdminUserDO> selectPage(UserPageReqVO reqVO, Collection<Long> deptIds) {
return selectPage(reqVO, new LambdaQueryWrapperX<AdminUserDO>()
.likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername())
// .likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername())
.likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile())
// 这里加了个模糊查询用户名称搜索时可以模糊查用户昵称
.likeIfPresent(AdminUserDO::getNickname, reqVO.getUsername())