Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
practical_train
Commits
38adeb62
"...model/git@gitlab.ruzhoukj.com:wujipeng/relation.git" did not exist on "ba7ba16e869b0bd9b696548ddcb070406c2614d2"
Commit
38adeb62
authored
Aug 03, 2026
by
wujipeng
Browse files
学生端-我的课程-汇总
parent
e7d4a11d
Changes
11
Hide whitespace changes
Inline
Side-by-side
practical-business/src/main/java/com/platform/business/controller/ClassController.java
View file @
38adeb62
...
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
...
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
@RestController
@RestController
@RequestMapping
(
"/class"
)
@RequestMapping
(
"/class"
)
...
@@ -72,4 +73,10 @@ public class ClassController extends BaseController {
...
@@ -72,4 +73,10 @@ public class ClassController extends BaseController {
public
Result
<
Boolean
>
todayCourseSignIn
(
@RequestBody
CalendarDTO
calendarDTO
)
{
public
Result
<
Boolean
>
todayCourseSignIn
(
@RequestBody
CalendarDTO
calendarDTO
)
{
return
Result
.
data
(
classService
.
todayCourseSignIn
(
calendarDTO
));
return
Result
.
data
(
classService
.
todayCourseSignIn
(
calendarDTO
));
}
}
@ApiModelProperty
(
"学生端-我的课程-汇总"
)
@GetMapping
(
"/student/course/summary"
)
public
Result
<
Map
<
String
,
Integer
>>
studentCourseSummary
(
@RequestBody
ClassDTO
classDTO
)
{
return
Result
.
data
(
classService
.
studentCourseSummary
(
classDTO
));
}
}
}
practical-business/src/main/java/com/platform/business/mapper/ClassSubjectAttendanceMapper.java
View file @
38adeb62
package
com.platform.business.mapper
;
package
com.platform.business.mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.platform.business.model.dto.ClassDTO
;
import
com.platform.business.model.entity.ClassSubjectAttendanceEntity
;
import
com.platform.business.model.entity.ClassSubjectAttendanceEntity
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
/**
/**
* @Author: wujipeng
* @Author: wujipeng
* @Description: TODO
* @Description: TODO
...
@@ -12,4 +15,6 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -12,4 +15,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
*/
@Mapper
@Mapper
public
interface
ClassSubjectAttendanceMapper
extends
BaseMapper
<
ClassSubjectAttendanceEntity
>
{
public
interface
ClassSubjectAttendanceMapper
extends
BaseMapper
<
ClassSubjectAttendanceEntity
>
{
List
<
ClassSubjectAttendanceEntity
>
queryOneself
(
ClassDTO
classDTO
);
}
}
practical-business/src/main/java/com/platform/business/mapper/ClassSubjectMapper.java
View file @
38adeb62
...
@@ -8,6 +8,7 @@ import com.platform.business.model.vo.ClassSubjectVO;
...
@@ -8,6 +8,7 @@ import com.platform.business.model.vo.ClassSubjectVO;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
@Mapper
@Mapper
...
@@ -19,7 +20,7 @@ public interface ClassSubjectMapper extends BaseMapper<ClassSubjectEntity> {
...
@@ -19,7 +20,7 @@ public interface ClassSubjectMapper extends BaseMapper<ClassSubjectEntity> {
List
<
ClassSubjectVO
>
countByTeacherId
(
String
id
);
List
<
ClassSubjectVO
>
countByTeacherId
(
String
id
);
List
<
ClassSubjectVO
>
queryOneself
(
@Param
(
"classIds"
)
List
<
Integer
>
classIds
);
List
<
ClassSubjectVO
>
queryOneself
(
@Param
(
"classIds"
)
List
<
Integer
>
classIds
,
@Param
(
"startDate"
)
Date
startDate
,
@Param
(
"endDate"
)
Date
endDate
);
List
<
ClassSubjectVO
>
queryOneselfTeacher
(
@Param
(
"userId"
)
String
userId
);
List
<
ClassSubjectVO
>
queryOneselfTeacher
(
@Param
(
"userId"
)
String
userId
);
...
...
practical-business/src/main/java/com/platform/business/service/ClassService.java
View file @
38adeb62
...
@@ -8,6 +8,7 @@ import com.platform.business.model.vo.CalendarVO;
...
@@ -8,6 +8,7 @@ import com.platform.business.model.vo.CalendarVO;
import
com.platform.business.model.vo.ClassVO
;
import
com.platform.business.model.vo.ClassVO
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
public
interface
ClassService
extends
IService
<
ClassEntity
>
{
public
interface
ClassService
extends
IService
<
ClassEntity
>
{
List
<
ClassVO
>
queryList
(
ClassDTO
classDTO
);
List
<
ClassVO
>
queryList
(
ClassDTO
classDTO
);
...
@@ -26,4 +27,6 @@ public interface ClassService extends IService<ClassEntity> {
...
@@ -26,4 +27,6 @@ public interface ClassService extends IService<ClassEntity> {
Boolean
todayCourseSignIn
(
CalendarDTO
calendarDTO
);
Boolean
todayCourseSignIn
(
CalendarDTO
calendarDTO
);
Map
<
String
,
Integer
>
studentCourseSummary
(
ClassDTO
classDTO
);
}
}
practical-business/src/main/java/com/platform/business/service/ClassSubjectAttendanceService.java
View file @
38adeb62
package
com.platform.business.service
;
package
com.platform.business.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.platform.business.model.dto.ClassDTO
;
import
com.platform.business.model.entity.ClassSubjectAttendanceEntity
;
import
com.platform.business.model.entity.ClassSubjectAttendanceEntity
;
import
java.util.List
;
/**
/**
* @Author: wujipeng
* @Author: wujipeng
* @Description: TODO
* @Description: TODO
...
@@ -10,4 +13,6 @@ import com.platform.business.model.entity.ClassSubjectAttendanceEntity;
...
@@ -10,4 +13,6 @@ import com.platform.business.model.entity.ClassSubjectAttendanceEntity;
* @Version: 1.0
* @Version: 1.0
*/
*/
public
interface
ClassSubjectAttendanceService
extends
IService
<
ClassSubjectAttendanceEntity
>
{
public
interface
ClassSubjectAttendanceService
extends
IService
<
ClassSubjectAttendanceEntity
>
{
List
<
ClassSubjectAttendanceEntity
>
queryOneself
(
ClassDTO
classDTO
);
}
}
practical-business/src/main/java/com/platform/business/service/ClassSubjectService.java
View file @
38adeb62
...
@@ -10,6 +10,7 @@ import com.platform.business.model.vo.SysTeacherCountVO;
...
@@ -10,6 +10,7 @@ import com.platform.business.model.vo.SysTeacherCountVO;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
public
interface
ClassSubjectService
extends
IService
<
ClassSubjectEntity
>
{
public
interface
ClassSubjectService
extends
IService
<
ClassSubjectEntity
>
{
...
@@ -26,7 +27,7 @@ public interface ClassSubjectService extends IService<ClassSubjectEntity> {
...
@@ -26,7 +27,7 @@ public interface ClassSubjectService extends IService<ClassSubjectEntity> {
SysTeacherCountVO
queryByTeacherUserName
(
String
userName
);
SysTeacherCountVO
queryByTeacherUserName
(
String
userName
);
List
<
ClassSubjectVO
>
queryOneself
(
List
<
Integer
>
classIds
);
List
<
ClassSubjectVO
>
queryOneself
(
List
<
Integer
>
classIds
,
Date
startDate
,
Date
endDate
);
List
<
ClassSubjectVO
>
queryOneselfTeacher
(
String
userId
);
List
<
ClassSubjectVO
>
queryOneselfTeacher
(
String
userId
);
...
...
practical-business/src/main/java/com/platform/business/service/impl/ClassServiceImpl.java
View file @
38adeb62
...
@@ -88,7 +88,7 @@ public class ClassServiceImpl extends ServiceImpl<ClassMapper, ClassEntity> impl
...
@@ -88,7 +88,7 @@ public class ClassServiceImpl extends ServiceImpl<ClassMapper, ClassEntity> impl
//获取班级id
//获取班级id
List
<
Integer
>
classIds
=
classStudentService
.
queryClassIdByUserId
(
classDTO
.
getUserId
());
List
<
Integer
>
classIds
=
classStudentService
.
queryClassIdByUserId
(
classDTO
.
getUserId
());
//查询课程信息
//查询课程信息
List
<
ClassSubjectVO
>
classSubjectList
=
classSubjectService
.
queryOneself
(
classIds
);
List
<
ClassSubjectVO
>
classSubjectList
=
classSubjectService
.
queryOneself
(
classIds
,
classDTO
.
getStartDate
(),
classDTO
.
getEndDate
()
);
List
<
ClassVO
>
result
=
Lists
.
newArrayList
();
List
<
ClassVO
>
result
=
Lists
.
newArrayList
();
List
<
Date
>
dateList
=
getDatesBetweenTwoDate
(
classDTO
.
getStartDate
(),
classDTO
.
getEndDate
());
List
<
Date
>
dateList
=
getDatesBetweenTwoDate
(
classDTO
.
getStartDate
(),
classDTO
.
getEndDate
());
for
(
Date
date
:
dateList
)
{
for
(
Date
date
:
dateList
)
{
...
@@ -158,7 +158,7 @@ public class ClassServiceImpl extends ServiceImpl<ClassMapper, ClassEntity> impl
...
@@ -158,7 +158,7 @@ public class ClassServiceImpl extends ServiceImpl<ClassMapper, ClassEntity> impl
classSubjectAttendanceMap
.
put
(
classSubjectAttendanceEntity
.
getSubjectId
(),
classSubjectAttendanceEntity
.
getCheckInTime
());
classSubjectAttendanceMap
.
put
(
classSubjectAttendanceEntity
.
getSubjectId
(),
classSubjectAttendanceEntity
.
getCheckInTime
());
}
}
for
(
CalendarVO
calendarVO
:
result
)
{
for
(
CalendarVO
calendarVO
:
result
)
{
if
(
classSubjectAttendanceMap
.
containsKey
(
calendarVO
.
getSubjectId
())){
if
(
classSubjectAttendanceMap
.
containsKey
(
calendarVO
.
getSubjectId
()))
{
calendarVO
.
setSignInTime
(
classSubjectAttendanceMap
.
get
(
calendarVO
.
getSubjectId
()));
calendarVO
.
setSignInTime
(
classSubjectAttendanceMap
.
get
(
calendarVO
.
getSubjectId
()));
calendarVO
.
setIsSignIn
(
true
);
calendarVO
.
setIsSignIn
(
true
);
}
else
{
}
else
{
...
@@ -177,6 +177,27 @@ public class ClassServiceImpl extends ServiceImpl<ClassMapper, ClassEntity> impl
...
@@ -177,6 +177,27 @@ public class ClassServiceImpl extends ServiceImpl<ClassMapper, ClassEntity> impl
return
classSubjectAttendanceService
.
save
(
classSubjectAttendance
);
return
classSubjectAttendanceService
.
save
(
classSubjectAttendance
);
}
}
@Override
public
Map
<
String
,
Integer
>
studentCourseSummary
(
ClassDTO
classDTO
)
{
//获取班级id
List
<
Integer
>
classIds
=
classStudentService
.
queryClassIdByUserId
(
classDTO
.
getUserId
());
//查询课程信息
List
<
ClassSubjectVO
>
classSubjectList
=
classSubjectService
.
queryOneself
(
classIds
,
classDTO
.
getStartDate
(),
classDTO
.
getEndDate
());
//查询签到信息
List
<
ClassSubjectAttendanceEntity
>
classSubjectAttendanceList
=
classSubjectAttendanceService
.
queryOneself
(
classDTO
);
//查询课程数据
HashMap
<
String
,
Integer
>
result
=
new
HashMap
<>();
//本月课程
result
.
put
(
"本月课程"
,
classSubjectList
.
size
());
//已签到
result
.
put
(
"已签到"
,
classSubjectAttendanceList
.
size
());
//待签到
result
.
put
(
"待签到"
,
classSubjectList
.
size
()
-
classSubjectAttendanceList
.
size
());
//出勤率
result
.
put
(
"出勤率"
,
classSubjectAttendanceList
.
size
()
/
classSubjectList
.
size
());
return
result
;
}
/**
/**
* 方法2: 使用SimpleDateFormat格式化比较
* 方法2: 使用SimpleDateFormat格式化比较
* 将日期格式化为"yyyyMMdd"后比较字符串
* 将日期格式化为"yyyyMMdd"后比较字符串
...
...
practical-business/src/main/java/com/platform/business/service/impl/ClassSubjectAttendanceServiceImpl.java
View file @
38adeb62
...
@@ -2,10 +2,13 @@ package com.platform.business.service.impl;
...
@@ -2,10 +2,13 @@ package com.platform.business.service.impl;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.platform.business.mapper.ClassSubjectAttendanceMapper
;
import
com.platform.business.mapper.ClassSubjectAttendanceMapper
;
import
com.platform.business.model.dto.ClassDTO
;
import
com.platform.business.model.entity.ClassSubjectAttendanceEntity
;
import
com.platform.business.model.entity.ClassSubjectAttendanceEntity
;
import
com.platform.business.service.ClassSubjectAttendanceService
;
import
com.platform.business.service.ClassSubjectAttendanceService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
/**
* @Author: wujipeng
* @Author: wujipeng
* @Description: TODO
* @Description: TODO
...
@@ -14,4 +17,8 @@ import org.springframework.stereotype.Service;
...
@@ -14,4 +17,8 @@ import org.springframework.stereotype.Service;
*/
*/
@Service
@Service
public
class
ClassSubjectAttendanceServiceImpl
extends
ServiceImpl
<
ClassSubjectAttendanceMapper
,
ClassSubjectAttendanceEntity
>
implements
ClassSubjectAttendanceService
{
public
class
ClassSubjectAttendanceServiceImpl
extends
ServiceImpl
<
ClassSubjectAttendanceMapper
,
ClassSubjectAttendanceEntity
>
implements
ClassSubjectAttendanceService
{
@Override
public
List
<
ClassSubjectAttendanceEntity
>
queryOneself
(
ClassDTO
classDTO
)
{
return
baseMapper
.
queryOneself
(
classDTO
);
}
}
}
practical-business/src/main/java/com/platform/business/service/impl/ClassSubjectServiceImpl.java
View file @
38adeb62
...
@@ -207,16 +207,6 @@ public class ClassSubjectServiceImpl extends ServiceImpl<ClassSubjectMapper, Cla
...
@@ -207,16 +207,6 @@ public class ClassSubjectServiceImpl extends ServiceImpl<ClassSubjectMapper, Cla
return
sdf
.
format
(
date
);
return
sdf
.
format
(
date
);
}
}
@Override
public
List
<
ClassSubjectVO
>
queryOneself
(
List
<
Integer
>
classIds
)
{
return
baseMapper
.
queryOneself
(
classIds
);
}
@Override
public
List
<
ClassSubjectVO
>
queryOneselfTeacher
(
String
userId
)
{
return
baseMapper
.
queryOneselfTeacher
(
userId
);
}
@Override
@Override
public
SysTeacherCountVO
queryByTeacherUserName
(
String
userName
)
{
public
SysTeacherCountVO
queryByTeacherUserName
(
String
userName
)
{
UserVO
userVO
=
userService
.
queryByUserName
(
userName
);
UserVO
userVO
=
userService
.
queryByUserName
(
userName
);
...
@@ -265,6 +255,16 @@ public class ClassSubjectServiceImpl extends ServiceImpl<ClassSubjectMapper, Cla
...
@@ -265,6 +255,16 @@ public class ClassSubjectServiceImpl extends ServiceImpl<ClassSubjectMapper, Cla
.
build
();
.
build
();
}
}
@Override
public
List
<
ClassSubjectVO
>
queryOneself
(
List
<
Integer
>
classIds
,
Date
startDate
,
Date
endDate
)
{
return
baseMapper
.
queryOneself
(
classIds
,
startDate
,
endDate
);
}
@Override
public
List
<
ClassSubjectVO
>
queryOneselfTeacher
(
String
userId
)
{
return
baseMapper
.
queryOneselfTeacher
(
userId
);
}
@Override
@Override
public
List
<
CalendarVO
>
todayCourse
(
List
<
Integer
>
classIds
)
{
public
List
<
CalendarVO
>
todayCourse
(
List
<
Integer
>
classIds
)
{
return
baseMapper
.
todayCourse
(
classIds
);
return
baseMapper
.
todayCourse
(
classIds
);
...
...
practical-business/src/main/resources/com/platform/business/mapper/ClassSubjectAttendanceMapper.xml
0 → 100644
View file @
38adeb62
<?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=
"com.platform.business.mapper.ClassSubjectAttendanceMapper"
>
<select
id=
"queryOneself"
resultType=
"com.platform.business.model.entity.ClassSubjectAttendanceEntity"
>
select
id,
subject_id,
user_id,
check_in_time
from
class_subject_attendance
where
user_id = #{userId}
and
check_in_time between #{startDate} and #{endDate}
</select>
</mapper>
practical-business/src/main/resources/com/platform/business/mapper/ClassSubjectMapper.xml
View file @
38adeb62
...
@@ -86,6 +86,8 @@
...
@@ -86,6 +86,8 @@
<foreach
item=
"item"
index=
"index"
collection=
"classIds"
open=
"("
separator=
","
close=
")"
>
<foreach
item=
"item"
index=
"index"
collection=
"classIds"
open=
"("
separator=
","
close=
")"
>
#{item}
#{item}
</foreach>
</foreach>
and
cs.date between #{startDate} and #{endDate}
</select>
</select>
<select
id=
"queryOneselfTeacher"
resultType=
"com.platform.business.model.vo.ClassSubjectVO"
>
<select
id=
"queryOneselfTeacher"
resultType=
"com.platform.business.model.vo.ClassSubjectVO"
>
select
select
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment