|
@@ -14,7 +14,7 @@ import org.jeecg.modules.app.vo.course.CourseRequestVo;
|
|
|
import org.jeecg.modules.app.vo.course.CourseResponseVo;
|
|
|
import org.jeecg.modules.system.app.entity.AppCategory;
|
|
|
import org.jeecg.modules.system.app.entity.AppOrder;
|
|
|
-import org.jeecg.modules.system.app.entity.AppOrderProduct;
|
|
|
+import org.jeecg.modules.system.app.entity.AppOrderProInfo;
|
|
|
import org.jeecg.modules.system.app.mapper.*;
|
|
|
import org.jeecg.modules.system.util.PositionUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -41,8 +41,9 @@ public class CoachServiceImpl implements ICoachService {
|
|
|
AppCoursesMapper appCoursesMapper;
|
|
|
@Autowired
|
|
|
private AppOrderMapper appOrderMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
- private AppOrderProductMapper appOrderProductMapper;
|
|
|
+ private AppOrderProInfoMapper appOrderProInfoMapper;
|
|
|
|
|
|
@Override
|
|
|
public Result<List<AppCoachVO>> findCoachList() {
|
|
@@ -91,10 +92,17 @@ public class CoachServiceImpl implements ICoachService {
|
|
|
courseResponseVo.setKm(km);
|
|
|
}
|
|
|
}
|
|
|
+ Long teachingCount=0L;
|
|
|
+ Long orderNumCount=0L;
|
|
|
+ List<String> byInstructorId = appCoursesMapper.findByInstructorId(appCoachDetailsVO.getId());
|
|
|
//缺少授课人数和订单数,评价
|
|
|
+ if (byInstructorId!=null&&!byInstructorId.isEmpty()){
|
|
|
+ teachingCount= appOrderMapper.findByTeachingCount(byInstructorId);
|
|
|
+ orderNumCount= appOrderMapper.findByOrderNumCount(byInstructorId);
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ appCoachDetailsVO.setClassesNumber(teachingCount);
|
|
|
+ appCoachDetailsVO.setOrderNumber(orderNumCount);
|
|
|
return Result.ok(appCoachDetailsVO);
|
|
|
}
|
|
|
|
|
@@ -112,13 +120,13 @@ public class CoachServiceImpl implements ICoachService {
|
|
|
LocalDateTime startOfYear = now.withDayOfYear(1).atStartOfDay(); // 当前年份第一天
|
|
|
LocalDateTime endOfYear = startOfYear.plusYears(1); // 下一年第一天
|
|
|
|
|
|
- return Math.toIntExact(appOrderProductMapper.selectCount(
|
|
|
- Wrappers.<AppOrderProduct>lambdaQuery()
|
|
|
- .eq(AppOrderProduct::getProductId, id)
|
|
|
- .eq(AppOrderProduct::getStatus,0)
|
|
|
- .eq(AppOrderProduct::getDelFlag,0)
|
|
|
- .ge(AppOrderProduct::getCreateTime, Date.from(startOfYear.atZone(ZoneId.systemDefault()).toInstant())) // >= 2025-01-01
|
|
|
- .lt(AppOrderProduct::getCreateTime, Date.from(endOfYear.atZone(ZoneId.systemDefault()).toInstant())) // < 2026-01-01
|
|
|
+ return Math.toIntExact(appOrderProInfoMapper.selectCount(
|
|
|
+ Wrappers.<AppOrderProInfo>lambdaQuery()
|
|
|
+ .eq(AppOrderProInfo::getProductId, id)
|
|
|
+ .eq(AppOrderProInfo::getStatus,0)
|
|
|
+ .eq(AppOrderProInfo::getDelFlag,0)
|
|
|
+ .ge(AppOrderProInfo::getCreateTime, Date.from(startOfYear.atZone(ZoneId.systemDefault()).toInstant())) // >= 2025-01-01
|
|
|
+ .lt(AppOrderProInfo::getCreateTime, Date.from(endOfYear.atZone(ZoneId.systemDefault()).toInstant())) // < 2026-01-01
|
|
|
));
|
|
|
}
|
|
|
|
|
@@ -130,9 +138,9 @@ public class CoachServiceImpl implements ICoachService {
|
|
|
* @return int 课程年销售数
|
|
|
**/
|
|
|
private int getCourseSalesCount(String id) {
|
|
|
- return Math.toIntExact(appOrderProductMapper.selectCount(
|
|
|
- Wrappers.<AppOrderProduct>lambdaQuery()
|
|
|
- .eq(AppOrderProduct::getProductId, id)
|
|
|
+ return Math.toIntExact(appOrderProInfoMapper.selectCount(
|
|
|
+ Wrappers.<AppOrderProInfo>lambdaQuery()
|
|
|
+ .eq(AppOrderProInfo::getProductId, id)
|
|
|
));
|
|
|
}
|
|
|
|