作业列表的修改设置完成,作业提交情况的查询完成
This commit is contained in:
parent
d14d16fd37
commit
4ee3589ed0
|
|
@ -87,4 +87,7 @@ export default {
|
|||
editProblem:(data) => request.post('/problem/editProblem', data),
|
||||
deleteProblem:(data) => request.post('/problem/deleteProblem', data),
|
||||
findAllProblemByCourseIdAndClassId:(data)=>request.post('/problem/findAllProblemByCourseIdAndClassId',data),
|
||||
findPostProblem:(data)=>request.post('/problem/findPostProblem',data),
|
||||
updateSetup:(data)=>request.post('/problem/updateSetup',data),
|
||||
findStudentSubmit:(data)=>request.post('/problem/findStudentSubmit',data),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ import { useRoute, useRouter } from 'vue-router'
|
|||
const rules=ref(null)
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const {problemId, history } = route.query
|
||||
const ProblemInfoRef = ref(null)
|
||||
const loading = ref(true)
|
||||
const ScoringRubricList =
|
||||
|
|
@ -66,7 +68,7 @@ let columns = [
|
|||
}
|
||||
]
|
||||
|
||||
const queryByPage = async (currentPage)=>{
|
||||
const queryByPage = async ()=>{
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await
|
||||
|
|
@ -113,6 +115,7 @@ const onChangePage = (page) => {
|
|||
}
|
||||
}
|
||||
onMounted(()=>{
|
||||
path.value = router.currentRoute.value.fullPath
|
||||
queryByPage()
|
||||
})
|
||||
watch(route, () => {
|
||||
|
|
|
|||
|
|
@ -5,104 +5,127 @@
|
|||
<n-form
|
||||
ref="problemInfoRef"
|
||||
:model="problemInfoValue"
|
||||
:rules="problemAddRules"
|
||||
:rules="problemPostRules"
|
||||
label-placement="left"
|
||||
label-align="right"
|
||||
label-width="100px"
|
||||
:show-require-mark="false"
|
||||
>
|
||||
<div class="exam-name-div">
|
||||
<n-h2
|
||||
class="show-problem-name">
|
||||
{{ problemName }}
|
||||
</n-h2>
|
||||
<!-- <div class="grid md:grid-cols-2 md:gap-x-30">-->
|
||||
<!-- <n-form-item label="发放对象:" path="class">-->
|
||||
<!-- <n-button type="primary" size="small"-->
|
||||
<!-- @click="onAdd"-->
|
||||
<!-- style="margin-left: 5px">-->
|
||||
<!-- 添加对象</n-button>-->
|
||||
<!-- </n-form-item>-->
|
||||
|
||||
<!-- </div>-->
|
||||
<div class="grid md:grid-cols-3 md:gap-x-30">
|
||||
<n-form-item label="有效时段:"
|
||||
path="timeFrom">
|
||||
<n-date-picker
|
||||
v-model:formatted-value="problemInfoValue.timeFrom"
|
||||
style="width: 350px"
|
||||
type="datetime"
|
||||
input-readonly
|
||||
placeholder="请选择开始时间"
|
||||
format="yyyy-MM-dd HH:mm"
|
||||
update-value-on-close
|
||||
:actions="['confirm']"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item label="到:" path="timeTo">
|
||||
<n-date-picker
|
||||
v-model:formatted-value="problemInfoValue.timeTo"
|
||||
style="width: 300px"
|
||||
type="datetime"
|
||||
input-readonly
|
||||
placeholder="请选择结束时间"
|
||||
format="yyyy-MM-dd HH:mm"
|
||||
update-value-on-close
|
||||
:actions="['confirm']"
|
||||
/>
|
||||
</n-form-item>
|
||||
</div>
|
||||
<div class="grid md:grid-cols-4 md:gap-x-30">
|
||||
<n-form-item label="允许补交:"
|
||||
path="allow">
|
||||
<n-checkbox
|
||||
v-model:checked="problemInfoValue.allow"
|
||||
@update="allow"
|
||||
></n-checkbox>
|
||||
</n-form-item>
|
||||
</div> <div flex>
|
||||
<n-form-item style='margin-left: 30px'>
|
||||
<!-- <div class="grid md:grid-cols-2 md:gap-x-30">-->
|
||||
<!-- <n-form-item-->
|
||||
<!-- style='margin-left: 30px;margin-bottom: -10px'><n-h2>-->
|
||||
<!-- {{problemInfoValue.title}}-->
|
||||
<!-- </n-h2></n-form-item></div>-->
|
||||
<div class="grid md:grid-cols-3 md:gap-x-30">
|
||||
<n-form-item label="有效时段:">
|
||||
<n-date-picker
|
||||
v-model:formatted-value="problemInfoValue.startTime"
|
||||
style="width: 350px"
|
||||
type="datetime"
|
||||
input-readonly
|
||||
placeholder="请选择开始时间"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
update-value-on-close
|
||||
:actions="['confirm']"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item label="到:">
|
||||
<n-date-picker
|
||||
v-model:formatted-value="problemInfoValue.endTime"
|
||||
style="width: 300px"
|
||||
type="datetime"
|
||||
input-readonly
|
||||
placeholder="请选择结束时间"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
update-value-on-close
|
||||
:actions="['confirm']"
|
||||
/>
|
||||
</n-form-item>
|
||||
</div>
|
||||
<div style="display: flex">
|
||||
<!-- <n-form-item label="发放对象:" path="class">-->
|
||||
<!-- <n-button type="primary" size="small"-->
|
||||
<!-- @click="onAddClass=!onAddClass"-->
|
||||
<!-- style="margin-left: 5px">-->
|
||||
<!-- 添加对象 </n-button>-->
|
||||
<!-- </n-form-item>-->
|
||||
<n-form-item label="允许补交:"
|
||||
path="allow">
|
||||
<n-checkbox
|
||||
v-model:checked="problemInfoValue.allow"
|
||||
></n-checkbox>
|
||||
</n-form-item>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div flex>
|
||||
<n-form-item style="margin-left: 30px">
|
||||
<n-button type="primary"
|
||||
size="small"
|
||||
@click="submit">确定
|
||||
@click="updateSetup"
|
||||
>确定
|
||||
</n-button></n-form-item>
|
||||
<n-form-item style='margin-left: 20px'>
|
||||
<n-form-item style="margin-left: 10px">
|
||||
<n-button type="primary"
|
||||
size="small" @click="cancel">取消
|
||||
</n-button>
|
||||
</n-form-item></div>
|
||||
|
||||
</div></n-form>
|
||||
size="small" @click="cancel" style='margin-left:
|
||||
20px'>取消
|
||||
</n-button></n-form-item>
|
||||
</div>
|
||||
<div flex>
|
||||
</div>
|
||||
<div class="grid md:grid-cols-2 md:gap-x-30">
|
||||
<n-form-item>
|
||||
<view-classes-post v-if='onAddClass'
|
||||
@clickAdd="handleAdd"
|
||||
></view-classes-post></n-form-item>
|
||||
</div>
|
||||
</n-form>
|
||||
</div>
|
||||
</CommonPage>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {useRouter} from "vue-router";
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import {ref} from "vue";
|
||||
import api from "@/api/admin";
|
||||
import { useTagsStore } from '@/store'
|
||||
import StandardsList
|
||||
from '@/views/admin/problem/components/StandardList.vue'
|
||||
import RichTextEditor
|
||||
from '@/components/common/RichTextEditor.vue'
|
||||
import ViewClassesPost
|
||||
from '@/views/admin/problem/components/view-classes-post.vue'
|
||||
const tagsStore = useTagsStore()
|
||||
const path=ref('')
|
||||
const router = useRouter()
|
||||
const rules=ref(null)
|
||||
const route = useRoute()
|
||||
const loading = ref(true)
|
||||
const {problemId,classId, history } = route.query
|
||||
const problemInfoValue = ref({
|
||||
name: '',
|
||||
timeFrom: [],
|
||||
timeTo: [],
|
||||
allow:true
|
||||
title: '',
|
||||
startTime: [],
|
||||
endTime: [],
|
||||
allow:false
|
||||
});
|
||||
const problemInfoRef = ref(null)
|
||||
const descEditorHeight = ref('160px')
|
||||
const problemName = ref('作业标题')
|
||||
const cancel = ()=>{
|
||||
tagsStore.removeTag(path.value)
|
||||
router.push({path: 'problem-list'})
|
||||
// router.push({path: 'problem-list'})
|
||||
}
|
||||
const updateSetup =async ()=>{
|
||||
try {
|
||||
await api.updateSetup({
|
||||
...problemInfoValue.value,
|
||||
classId:classId,
|
||||
problemId:problemId
|
||||
})
|
||||
$message.success("修改作业设置成功")
|
||||
tagsStore.removeTag(path.value)
|
||||
} catch (err) {
|
||||
tagsStore.removeTag(path.value)
|
||||
}
|
||||
}
|
||||
const onAdd = ()=>{
|
||||
router.push({name: 'AdminProblemPostClass'})
|
||||
|
|
@ -124,7 +147,21 @@ const submit =async ()=>{
|
|||
$message.error("作业名称不能为空")
|
||||
}
|
||||
}
|
||||
const queryByPage = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await api.findPostProblem({
|
||||
problemId:problemId,
|
||||
classId:classId
|
||||
})
|
||||
problemInfoValue.value=res.data
|
||||
} catch (err) {
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
onMounted(()=>{
|
||||
path.value=router.currentRoute.value.fullPath
|
||||
queryByPage()
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
:label-width="60" >
|
||||
<div style="display: flex;margin-top:
|
||||
25px">
|
||||
<div v-if="userStore.getRole().length>0 && userStore.getRole().some((r)=>r==='admin')">
|
||||
<div
|
||||
style="display: flex;align-items: flex-start">
|
||||
<n-form-item label="班级:"
|
||||
|
|
@ -44,7 +43,6 @@
|
|||
已结束
|
||||
</label></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</n-form>
|
||||
</div>
|
||||
|
|
@ -245,18 +243,19 @@ const onAssistantProblem = async (problemid)=>{
|
|||
await router.push({name: 'AdminProblemAssistant', params: {clId: id}})
|
||||
}
|
||||
const onEditProblem = async (problemid)=>{
|
||||
// const {id} = problemid
|
||||
const id=1
|
||||
const {id} = problemid
|
||||
await router.push({name:
|
||||
'AdminProblemEditSetup',
|
||||
params: {clId: id}})
|
||||
query:
|
||||
{classId:ProblemInfoValue.value.classId,problemId:
|
||||
id}})
|
||||
}
|
||||
const onReviewProblem = async (problemid)=>{
|
||||
// const {id} = problemid
|
||||
const id=1
|
||||
const {id} = problemid
|
||||
await router.push({name:
|
||||
'AdminProblemStudent',
|
||||
params: {clId: id}})
|
||||
query:
|
||||
{classId:ProblemInfoValue.value.classId,problemId:id}})
|
||||
}
|
||||
// const search=async ()=>{
|
||||
// // ProblemInfoRef.value?.validate(async (errors) => {
|
||||
|
|
@ -330,15 +329,9 @@ const onChangePage = (page) => {
|
|||
onMounted(()=>{
|
||||
queryByPage(paginationReactive.page)
|
||||
})
|
||||
watch(
|
||||
()=>router.currentRoute.value.fullPath,
|
||||
()=>{
|
||||
if
|
||||
(router.currentRoute.value.fullPath==='/admin/problem/problem-list') {
|
||||
queryByPage(paginationReactive.page)
|
||||
}
|
||||
}
|
||||
)
|
||||
// watch(route, () => {
|
||||
// filterData()
|
||||
// })
|
||||
</script>
|
||||
<style>
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<div style="display: flex">
|
||||
<n-h3
|
||||
class="show-problem-name">
|
||||
{{ problemName }}
|
||||
{{ problem.title }}
|
||||
</n-h3>
|
||||
|
||||
|
||||
|
|
@ -28,25 +28,16 @@
|
|||
<label>
|
||||
<input type="radio"
|
||||
value="yijiao"
|
||||
v-model="selectedStatus" @change="updateColumns"/>
|
||||
v-model="selectedStatus" @change="filterData"/>
|
||||
已交
|
||||
</label><label>
|
||||
<input type="radio"
|
||||
value="weijiao"
|
||||
v-model="selectedStatus" @change="updateColumns" />
|
||||
v-model="selectedStatus" @change="filterData" />
|
||||
未交
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <n-form-item label="学校:" class="flex-item" style="margin-left: -30px">-->
|
||||
<!-- <n-select-->
|
||||
<!-- v-model:value="studentInfoValue.schoolId"-->
|
||||
<!-- :options="options"-->
|
||||
<!-- filterable-->
|
||||
<!-- placeholder=""-->
|
||||
<!-- style="min-width: 140px"></n-select>-->
|
||||
<!-- </n-form-item>-->
|
||||
<n-form-item label="学号:" path="name" class="flex-item">
|
||||
<n-input v-model:value="studentInfoValue.studentNo"
|
||||
placeholder=""
|
||||
|
|
@ -55,11 +46,6 @@
|
|||
<n-form-item label="姓名:" class="flex-item" style="margin-left: 0px">
|
||||
<n-input v-model:value="studentInfoValue.chineseName" style="min-width: 80px" placeholder=""></n-input>
|
||||
</n-form-item>
|
||||
<!-- <n-form-item label="用户名:" class="flex-item">-->
|
||||
<!-- <n-input v-model:value="studentInfoValue.stu_userName"-->
|
||||
<!-- placeholder=""-->
|
||||
<!-- style="min-width: 80px; width: 140px;"></n-input>-->
|
||||
<!-- </n-form-item>-->
|
||||
<n-form-item style="margin-left: 10px">
|
||||
<n-button type="primary" @click="search">自定义查询</n-button>
|
||||
</n-form-item>
|
||||
|
|
@ -67,8 +53,6 @@
|
|||
style='justify-content: flex-end'>
|
||||
<n-form-item
|
||||
v-if="selectedStatus==='weijiao'" style='margin-left: 10px;margin-right: 20px'>
|
||||
<!-- <n-button type="primary"-->
|
||||
<!-- style="margin-right: 10px" @click="addTime">加时</n-button>-->
|
||||
<n-button type="primary" style="margin-right: 10px" @click="exportUnsubmitted">导出未交名单</n-button>
|
||||
|
||||
</n-form-item>
|
||||
|
|
@ -89,7 +73,7 @@
|
|||
:single-line="false"
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:data="studentList"
|
||||
:data="filteredData"
|
||||
:loading="loading"
|
||||
:pagination="paginationReactive"
|
||||
:row-key="rowKey"
|
||||
|
|
@ -108,18 +92,26 @@ import api from "@/api/admin";
|
|||
import ProblemStudentAction
|
||||
from '@/views/admin/problem/components/problem-student-action.vue'
|
||||
import {formatDateTime} from '@/utils';
|
||||
import ProblemStudentAction2
|
||||
from '@/views/admin/problem/components/problem-student-action2.vue'
|
||||
import { NDataTable } from 'naive-ui'
|
||||
const router = useRouter()
|
||||
const rules=ref(null)
|
||||
const route = useRoute()
|
||||
const options=ref([])
|
||||
const loading = ref(false)
|
||||
const problemName =
|
||||
ref('作业标题')
|
||||
const problem =
|
||||
ref({
|
||||
title:''
|
||||
})
|
||||
const selectedStatus=ref('yijiao')
|
||||
const filteredData =ref([])
|
||||
const submitList =
|
||||
ref([])
|
||||
const studentList =
|
||||
reactive([{studentNo:"211310509",chineseName:"张三",submitDate:"2025-02-11",readDate:"2025-02-11",status:"待批",status1:"已查看",score:"89"}])
|
||||
reactive([])
|
||||
const filteredStudentList=ref(studentList)
|
||||
const {clId} = route.params
|
||||
const { classId,problemId, history } = route.query
|
||||
const paginationReactive = reactive({
|
||||
page: 1,
|
||||
pageSize: 50,
|
||||
|
|
@ -129,7 +121,7 @@ const paginationReactive = reactive({
|
|||
return `总共 ${itemCount} 条`
|
||||
}
|
||||
})
|
||||
const columns=ref()
|
||||
const columns=ref([])
|
||||
const updateColumns=()=>{
|
||||
if(selectedStatus.value==='weijiao'){
|
||||
columns.value = [
|
||||
|
|
@ -149,14 +141,10 @@ const updateColumns=()=>{
|
|||
key: 'readTime',
|
||||
title: '领取时间',
|
||||
width: '100',
|
||||
align:'center',
|
||||
render: (row) => {
|
||||
return
|
||||
row["readTime"]=formatDateTime(row["readTime"]);
|
||||
}
|
||||
align:'center'
|
||||
},
|
||||
{
|
||||
key: 'status1',
|
||||
key: 'submissionStatus',
|
||||
title: '状态',
|
||||
width: '300',
|
||||
},
|
||||
|
|
@ -194,20 +182,16 @@ const updateColumns=()=>{
|
|||
key: 'submitTime',
|
||||
title: '提交时间',
|
||||
width: '160',
|
||||
align:'center',
|
||||
render: (row) => {
|
||||
return
|
||||
row["submitTime"]=formatDateTime(row["submitTime"]);
|
||||
}
|
||||
align:'center'
|
||||
},
|
||||
{
|
||||
key: 'status',
|
||||
key: 'submissionStatus',
|
||||
title: '状态',
|
||||
width: '150',
|
||||
align:'center',
|
||||
},
|
||||
{
|
||||
key: 'score',
|
||||
key: 'finalScore',
|
||||
title: '成绩',
|
||||
width: '170',
|
||||
align:'center',
|
||||
|
|
@ -228,85 +212,54 @@ const updateColumns=()=>{
|
|||
}]
|
||||
|
||||
}
|
||||
filterData(); // 更新过滤数据
|
||||
// filterData(); // 更新过滤数据
|
||||
}
|
||||
// 根据 selectedStatus 过滤数据
|
||||
const filterData = () => {
|
||||
if (selectedStatus.value) {
|
||||
filteredStudentList.value = studentList.filter(item =>
|
||||
item.status === selectedStatus.value);
|
||||
} else {
|
||||
filteredStudentList.value = studentList; // 显示所有数据
|
||||
}
|
||||
};
|
||||
const studentInfoValue = ref({
|
||||
userId:'',
|
||||
studentId:'',
|
||||
studentNo:'',
|
||||
chineseName:'',
|
||||
stu_userName:'',
|
||||
schoolId:0,
|
||||
readTime:[],
|
||||
submitTime:[],
|
||||
submissionStatus:'',
|
||||
score:0,
|
||||
pageNum:paginationReactive.page,
|
||||
pageSize:paginationReactive.pageSize
|
||||
});
|
||||
const filterData =() => {
|
||||
queryByPage(paginationReactive.page)
|
||||
updateColumns()
|
||||
}
|
||||
const queryByPage = async (currentPage)=>{
|
||||
loading.value = true
|
||||
loading.value = true;
|
||||
studentInfoValue.value.pageNum=currentPage
|
||||
studentInfoValue.value.pageSize=paginationReactive.pageSize
|
||||
try {
|
||||
const res1=await api.findAllShoolsInAdminusers()
|
||||
const list1=res1.data
|
||||
const transformedDatas=list1.map(item => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
transformedDatas.unshift({
|
||||
label: '全部',
|
||||
value: 0,
|
||||
});
|
||||
options.value=transformedDatas;
|
||||
studentInfoValue.value.pageNum=currentPage
|
||||
studentInfoValue.value.pageSize=paginationReactive.pageSize
|
||||
const res = await api.findStudentsByCondition({
|
||||
pageNum: paginationReactive.page,
|
||||
pageSize:paginationReactive.pageSize,
|
||||
studentNo:studentInfoValue.value.studentNo,
|
||||
chineseName:studentInfoValue.value.chineseName,
|
||||
stu_userName:studentInfoValue.value.stu_userName,
|
||||
schoolId:studentInfoValue.value.schoolId
|
||||
})
|
||||
if (res.message==='获取学生信息为空'){
|
||||
studentList.value=[]
|
||||
paginationReactive.page = 1
|
||||
paginationReactive.pageSize = 10
|
||||
paginationReactive.itemCount = 0
|
||||
$message.success('获取学生信息为空')
|
||||
}else {
|
||||
const {pageNum, pageSize, total, list} = res.data
|
||||
paginationReactive.page = pageNum
|
||||
paginationReactive.pageSize = pageSize
|
||||
paginationReactive.itemCount = total
|
||||
const count=(paginationReactive.page-1)*paginationReactive.pageSize
|
||||
studentList.value = list.map((item,i)=>{
|
||||
if (item.username===''||item.username===null){
|
||||
item.username='请学生注册'
|
||||
const res1=await
|
||||
api.findProblemById({id:problemId});
|
||||
problem.value=res1.data
|
||||
const res = await
|
||||
api.findStudentSubmit(
|
||||
{
|
||||
...studentInfoValue.value,
|
||||
classId:classId,
|
||||
problemId:problemId,
|
||||
selectedStatus:selectedStatus.value
|
||||
}
|
||||
return {
|
||||
...item,
|
||||
stId: count + i + 1,
|
||||
};
|
||||
})
|
||||
}
|
||||
);
|
||||
const {pageNum, pageSize, total, list} = res.data
|
||||
paginationReactive.page = pageNum
|
||||
paginationReactive.pageSize = pageSize
|
||||
paginationReactive.itemCount = total
|
||||
studentList.value =
|
||||
list.map((item,i)=>{return item;})
|
||||
filteredData.value=studentList.value
|
||||
// console.log(res.data)
|
||||
} catch (err) {
|
||||
}finally{
|
||||
loading.value = false
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
const selectYijiao=()=>{
|
||||
selectedStatus.value='yijiao'
|
||||
console.log(selectedStatus.value)
|
||||
}
|
||||
const selectWeijiao=()=>{
|
||||
selectedStatus.value='weijiao'
|
||||
console.log(selectedStatus.value)
|
||||
}
|
||||
const onPasswordClass = async (classId)=>{
|
||||
// const {id} = classId
|
||||
const id=1
|
||||
|
|
@ -342,7 +295,7 @@ const onDeleteClass = async (classId)=>{
|
|||
}
|
||||
}
|
||||
const search=async ()=>{
|
||||
queryByPage(1)
|
||||
await queryByPage(paginationReactive.page)
|
||||
}
|
||||
const handleSearchSchool = async (query) => {
|
||||
const res = await api.getSchoolByschoolName({
|
||||
|
|
@ -370,16 +323,11 @@ const rowKey = (rowData) => {
|
|||
}
|
||||
onMounted(()=>{
|
||||
queryByPage(paginationReactive.page)
|
||||
updateColumns();
|
||||
updateColumns()
|
||||
})
|
||||
watch(route, () => {
|
||||
filterData()
|
||||
})
|
||||
watch(
|
||||
()=>router.currentRoute.value.fullPath,
|
||||
()=>{
|
||||
if (router.currentRoute.value.fullPath==='/admin/student/student-list') {
|
||||
queryByPage(paginationReactive.page)
|
||||
}
|
||||
}
|
||||
)
|
||||
</script>
|
||||
<style>
|
||||
.two-line-description {
|
||||
|
|
|
|||
|
|
@ -5,16 +5,14 @@ import com.example.aes.global.model.DecodeToken;
|
|||
import com.example.aes.global.model.RespBean;
|
||||
import com.example.aes.problem.model.*;
|
||||
import com.example.aes.problem.service.ProblemServiceI;
|
||||
import com.example.aes.user.model.*;
|
||||
import com.example.aes.user.model.Classstudents;
|
||||
import com.example.aes.user.service.ClassesServiceI;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.example.aes.user.model.DataGrid;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.swing.event.ListDataEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
|
@ -170,6 +168,26 @@ public class ProblemController {
|
|||
return RespBean.ok("查询作业标题成功",
|
||||
problems.get(0));
|
||||
|
||||
}
|
||||
@PostMapping("/findPostProblem")
|
||||
public RespBean findPostProblem(@RequestBody PMPostProblem pmPostProblem){
|
||||
List<PostProblem> postProblems=problemServiceI.findPostProblem(pmPostProblem.getProblemId(),pmPostProblem.getClassId());
|
||||
List<PMPostProblem>pmPostProblems=
|
||||
new ArrayList<>();
|
||||
for(PostProblem postProblem:postProblems){
|
||||
PMPostProblem pmPostProblem1=
|
||||
new PMPostProblem();
|
||||
if(postProblem.getAllow()==0)
|
||||
pmPostProblem1.setAllow(false);
|
||||
else pmPostProblem1.setAllow(true);
|
||||
pmPostProblem1.setStartTime(postProblem.getStartTime());
|
||||
pmPostProblem1.setEndTime(postProblem.getEndTime());
|
||||
pmPostProblems.add(pmPostProblem1);
|
||||
}
|
||||
|
||||
return RespBean.ok("查询作业标题成功",
|
||||
pmPostProblems.get(0));
|
||||
|
||||
}
|
||||
@PostMapping("/postProblem")
|
||||
public RespBean postProblem(@RequestBody PMPostProblem pmPostProblem){
|
||||
|
|
@ -181,6 +199,15 @@ public class ProblemController {
|
|||
return RespBean.ok("发布作业成功");
|
||||
|
||||
}
|
||||
@PostMapping("/updateSetup")
|
||||
public RespBean updateSetup(@RequestBody PMPostProblem pmPostProblem){
|
||||
int num =
|
||||
problemServiceI.editPostProblem(pmPostProblem.getClassId(),pmPostProblem.getProblemId(),pmPostProblem.getStartTime(),pmPostProblem.getEndTime(),pmPostProblem.getAllow());
|
||||
if(num == 1)
|
||||
return RespBean.ok("修改课程名称成功");
|
||||
else
|
||||
return RespBean.error("修改课程名称失败");
|
||||
}
|
||||
//获取作业列表
|
||||
@GetMapping("/getExamList")
|
||||
public RespBean getExamList(Integer pageNum,Integer pageSize, HttpServletRequest request) {
|
||||
|
|
@ -210,6 +237,16 @@ public class ProblemController {
|
|||
return RespBean.error("获取作业列表失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("findStudentSubmit")
|
||||
public RespBean findStudentSubmit(@RequestBody PMStudentSubmit pmStudentSubmit){
|
||||
DataGrid dataGrid;
|
||||
if(pmStudentSubmit.getSelectedStatus().equals("weijiao"))
|
||||
dataGrid=
|
||||
problemServiceI.findWeijiaoList(pmStudentSubmit);
|
||||
else dataGrid=
|
||||
problemServiceI.findYijiaoList(pmStudentSubmit);
|
||||
return RespBean.ok("获取学生提交报告列表成功!",
|
||||
dataGrid);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,15 @@ import com.example.aes.problem.model.PMPostProblem;
|
|||
import com.example.aes.problem.model.PostProblem;
|
||||
import com.example.aes.user.dao.BaseDaoI;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public interface PostProblemDaoI extends BaseDaoI<PostProblem> {
|
||||
public void postProblem(PMPostProblem pmPostProblem, Integer classId);
|
||||
public long getPostProblemNum(int courseId,
|
||||
int classId);
|
||||
public List<PostProblem> findPostProblem(int problemId,
|
||||
int classId);
|
||||
public int editPostProblem(int classId,
|
||||
int problemId,LocalDateTime startTime, LocalDateTime endTime,int allow);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,18 +2,11 @@ package com.example.aes.problem.dao;
|
|||
|
||||
|
||||
import com.example.aes.problem.model.PMProblem;
|
||||
import com.example.aes.problem.model.PMScoringRubric;
|
||||
import com.example.aes.problem.model.Problem;
|
||||
import com.example.aes.user.dao.BaseDaoI;
|
||||
import com.example.aes.user.model.Classstudents;
|
||||
import com.example.aes.user.model.Course;
|
||||
import com.example.aes.user.model.DataGrid;
|
||||
import com.example.aes.user.model.PMCourse;
|
||||
|
||||
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public interface ProblemDaoI extends BaseDaoI<Problem> {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package com.example.aes.problem.dao;
|
||||
|
||||
import com.example.aes.problem.model.PMStudentSubmit;
|
||||
import com.example.aes.problem.model.SubmitReport;
|
||||
import com.example.aes.user.dao.BaseDaoI;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SubmitReportDaoI extends BaseDaoI<SubmitReport> {
|
||||
public List<Object[]> findWeijiaoList(PMStudentSubmit pmStudentSubmit);
|
||||
public List<Object[]> findYijiaoList(PMStudentSubmit pmStudentSubmit);
|
||||
|
||||
}
|
||||
|
|
@ -4,8 +4,13 @@ import com.example.aes.problem.dao.PostProblemDaoI;
|
|||
import com.example.aes.problem.model.PMPostProblem;
|
||||
import com.example.aes.problem.model.PostProblem;
|
||||
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
@Repository("PostProblemDao")
|
||||
public class PostProblemDaoImpl extends BaseDaoImpl<PostProblem> implements PostProblemDaoI {
|
||||
@Override
|
||||
|
|
@ -29,4 +34,30 @@ public class PostProblemDaoImpl extends BaseDaoImpl<PostProblem> implements Post
|
|||
long count=this.count(hql);
|
||||
return count;
|
||||
}
|
||||
@Override
|
||||
public List<PostProblem> findPostProblem(int problemId,
|
||||
int classId){
|
||||
String hql=
|
||||
"from PostProblem where " +
|
||||
"problemId="+problemId+
|
||||
" and classId="+classId;
|
||||
return this.find(hql);
|
||||
}
|
||||
@Override
|
||||
public int editPostProblem(int classId,
|
||||
int problemId,LocalDateTime startTime, LocalDateTime endTime, int allow){
|
||||
// 构建参数化更新语句
|
||||
String hql= "UPDATE PostProblem p SET p" +
|
||||
".startTime = :startTime, p.endTime = :endTime, p.allow = :allow "
|
||||
+ "WHERE p.classId = :classId AND p.problemId = :problemId";
|
||||
Query q = this.getCurrentSession().createQuery(hql);
|
||||
q.setParameter("startTime",startTime);
|
||||
q.setParameter("endTime",endTime);
|
||||
q.setParameter("allow",allow);
|
||||
q.setParameter("classId",classId);
|
||||
q.setParameter("problemId",problemId);
|
||||
int num = q.executeUpdate();
|
||||
return num;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,16 @@
|
|||
package com.example.aes.problem.dao.impl;
|
||||
|
||||
import cn.hutool.poi.excel.cell.CellSetter;
|
||||
import com.example.aes.problem.dao.ProblemDaoI;
|
||||
import com.example.aes.problem.model.PMProblem;
|
||||
import com.example.aes.problem.model.PMScoringRubric;
|
||||
import com.example.aes.problem.model.Problem;
|
||||
import com.example.aes.user.dao.BaseDaoI;
|
||||
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
||||
import com.example.aes.user.model.Classstudents;
|
||||
import com.example.aes.user.model.Course;
|
||||
import com.example.aes.user.model.PMCourse;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.Session;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Repository("ProblemDao")
|
||||
public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
||||
|
|
@ -139,25 +131,12 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
|||
public List<Object[]> getProblemsByPage(Integer courseId, Integer classId,String selectedStatus,
|
||||
int page,
|
||||
int rows){
|
||||
String hql=new String();
|
||||
if(selectedStatus.equals("")){
|
||||
hql = "SELECT p.id as id, p.title as title, pp.startTime as startTime, pp.endTime as endTime," +
|
||||
"COUNT(CASE WHEN sr.score IS NULL AND sr.autoscore IS NOT NULL THEN 1 END) AS daipi," +
|
||||
"COUNT(CASE WHEN sr.submissionTime IS NOT NULL THEN 1 END) AS yijiao, " +
|
||||
"COUNT(CASE WHEN sr.submissionTime IS NULL THEN 1 END) AS weijiao " +
|
||||
"FROM Problem p " +
|
||||
"INNER JOIN PostProblem pp ON p.id = pp.problemId " +
|
||||
"LEFT JOIN SubmitReport sr ON " +
|
||||
"p.id = sr.problemId " +
|
||||
"WHERE pp.classId =:classId "+
|
||||
"AND p.courseId =:courseId "+
|
||||
"GROUP BY p.id, p.title, pp" +
|
||||
".startTime, pp.endTime";}
|
||||
else if (selectedStatus.equals("not_started")) {
|
||||
String hql;
|
||||
if (selectedStatus.equals("not_started")) {
|
||||
hql = "SELECT p.id as id, p.title as title, pp.startTime as startTime, pp.endTime as endTime, " +
|
||||
"COUNT(CASE WHEN sr.score IS NULL AND sr.autoscore IS NOT NULL THEN 1 END) AS daipi, " +
|
||||
"COUNT(CASE WHEN sr.submissionTime IS NOT NULL THEN 1 END) AS yijiao, " +
|
||||
"COUNT(CASE WHEN sr.submissionTime IS NULL THEN 1 END) AS weijiao " +
|
||||
"COUNT(CASE WHEN sr.submissionTime IS NOT NULL THEN 1 END) AS yijiao " +
|
||||
// "COUNT(CASE WHEN sr.submissionTime IS NULL THEN 1 END) AS weijiao " +
|
||||
"FROM Problem p " +
|
||||
"INNER JOIN PostProblem pp ON p.id = pp.problemId " +
|
||||
"LEFT JOIN SubmitReport sr ON " +
|
||||
|
|
@ -171,8 +150,8 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
|||
} else if (selectedStatus.equals("in_progress")) {
|
||||
hql = "SELECT p.id as id, p.title as title, pp.startTime as startTime, pp.endTime as endTime, " +
|
||||
"COUNT(CASE WHEN sr.score IS NULL AND sr.autoscore IS NOT NULL THEN 1 END) AS daipi, " +
|
||||
"COUNT(CASE WHEN sr.submissionTime IS NOT NULL THEN 1 END) AS yijiao, " +
|
||||
"COUNT(CASE WHEN sr.submissionTime IS NULL THEN 1 END) AS weijiao " +
|
||||
"COUNT(CASE WHEN sr.submissionTime IS NOT NULL THEN 1 END) AS yijiao " +
|
||||
// "COUNT(CASE WHEN sr.submissionTime IS NULL THEN 1 END) AS weijiao " +
|
||||
"FROM Problem p " +
|
||||
"INNER JOIN PostProblem pp ON p.id = pp.problemId " +
|
||||
"LEFT JOIN SubmitReport sr ON " +
|
||||
|
|
@ -183,11 +162,11 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
|||
"and NOW()<=pp.endTime " +
|
||||
"GROUP BY p.id, p.title, pp" +
|
||||
".startTime, pp.endTime";
|
||||
}else{
|
||||
}else if(selectedStatus.equals("completed")){
|
||||
hql = "SELECT p.id as id, p.title as title, pp.startTime as startTime, pp.endTime as endTime, " +
|
||||
"COUNT(CASE WHEN sr.score IS NULL AND sr.autoscore IS NOT NULL THEN 1 END) AS daipi, " +
|
||||
"COUNT(CASE WHEN sr.submissionTime IS NOT NULL THEN 1 END) AS yijiao, " +
|
||||
"COUNT(CASE WHEN sr.submissionTime IS NULL THEN 1 END) AS weijiao " +
|
||||
"COUNT(CASE WHEN sr.submissionTime IS NOT NULL THEN 1 END) AS yijiao " +
|
||||
// "COUNT(CASE WHEN sr.submissionTime IS NULL THEN 1 END) AS weijiao " +
|
||||
"FROM Problem p " +
|
||||
"INNER JOIN PostProblem pp ON p.id = pp.problemId " +
|
||||
"LEFT JOIN SubmitReport sr ON " +
|
||||
|
|
@ -197,9 +176,21 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
|||
"AND NOW() > endTime " +
|
||||
"GROUP BY p.id, p.title, pp" +
|
||||
".startTime, pp.endTime";
|
||||
}
|
||||
Session session =this.getCurrentSession();
|
||||
Query<Object[]> query = session.createQuery(hql, Object[].class);
|
||||
}else{
|
||||
hql = "SELECT p.id as id, p.title as title, pp.startTime as startTime, pp.endTime as endTime," +
|
||||
"COUNT(CASE WHEN sr.score IS NULL AND sr.autoscore IS NOT NULL THEN 1 END) AS daipi," +
|
||||
"COUNT(CASE WHEN sr" +
|
||||
".submissionTime IS NOT NULL THEN 1 END) AS yijiao " +
|
||||
"FROM Problem p " +
|
||||
"INNER JOIN PostProblem pp ON p.id = pp.problemId " +
|
||||
"LEFT JOIN SubmitReport sr ON " +
|
||||
"p.id = sr.problemId " +
|
||||
"WHERE pp.classId =:classId "+
|
||||
"AND p.courseId =:courseId "+
|
||||
"GROUP BY p.id, p.title, pp" +
|
||||
".startTime, pp.endTime";}
|
||||
Query<Object[]> query =
|
||||
this.getCurrentSession().createQuery(hql,Object[].class);
|
||||
query.setParameter("classId", classId);
|
||||
query.setParameter("courseId", courseId);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,108 @@
|
|||
package com.example.aes.problem.dao.impl;
|
||||
|
||||
import com.example.aes.problem.dao.SubmitReportDaoI;
|
||||
import com.example.aes.problem.model.PMStudentSubmit;
|
||||
import com.example.aes.problem.model.SubmitReport;
|
||||
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository("SubmitReportDao")
|
||||
public class SubmitReportDaoImpl extends BaseDaoImpl<SubmitReport> implements SubmitReportDaoI {
|
||||
@Override
|
||||
public List<Object[]> findWeijiaoList(PMStudentSubmit pmStudentSubmit){
|
||||
int classId= pmStudentSubmit.getClassId();
|
||||
int problemId= pmStudentSubmit.getProblemId();
|
||||
String studentNo=
|
||||
'%'+pmStudentSubmit.getStudentNo()+'%';
|
||||
String chineseName=
|
||||
'%'+pmStudentSubmit.getChineseName()+'%';
|
||||
String hql="SELECT u.chineseName," +
|
||||
"u.studentNo, sr" +
|
||||
".readTime," +
|
||||
"sr.submissionStatus " +
|
||||
"FROM Classstudents cs left " +
|
||||
"join Users u on cs" +
|
||||
".userId=u.id "+
|
||||
"left join PostProblem pp on cs" +
|
||||
".classId=pp.classId "+
|
||||
"left JOIN"+
|
||||
" SubmitReport sr ON " +
|
||||
"sr" +
|
||||
".studentId=u.id"+
|
||||
" WHERE cs.classId=:classId " +
|
||||
"and " +
|
||||
"pp.problemId " +
|
||||
"=:problemId" +
|
||||
" and sr" +
|
||||
".submissionTime is null and " +
|
||||
"u.studentNo like :studentNo " +
|
||||
"and u" +
|
||||
".chineseName like :chineseName";
|
||||
Query<Object[]> query =
|
||||
this.getCurrentSession().createQuery(hql,Object[].class);
|
||||
query.setParameter("classId", classId);
|
||||
query.setParameter("problemId", problemId);
|
||||
query.setParameter("studentNo",studentNo);
|
||||
query.setParameter("chineseName",
|
||||
chineseName);
|
||||
int page= pmStudentSubmit.getPageNum();
|
||||
int rows= pmStudentSubmit.getPageSize();
|
||||
// 设置分页
|
||||
query.setFirstResult((page - 1) * rows); // 计算起始行
|
||||
query.setMaxResults(rows); // 设置每页行数
|
||||
|
||||
return query.getResultList();
|
||||
}
|
||||
@Override
|
||||
public List<Object[]> findYijiaoList(PMStudentSubmit pmStudentSubmit){
|
||||
int classId= pmStudentSubmit.getClassId();
|
||||
int problemId= pmStudentSubmit.getProblemId();
|
||||
String studentNo=
|
||||
'%'+pmStudentSubmit.getStudentNo()+'%';
|
||||
String chineseName=
|
||||
'%'+pmStudentSubmit.getChineseName()+'%';
|
||||
String hql="SELECT u.chineseName," +
|
||||
"u.studentNo, sr" +
|
||||
".submissionTime," +
|
||||
"sr.submissionStatus," +
|
||||
" COALESCE(sr.score," +
|
||||
" sr.autoscore) " +
|
||||
"AS finalScore " +
|
||||
"FROM Classstudents cs left " +
|
||||
"join Users u on cs" +
|
||||
".userId=u.id "+
|
||||
"left join PostProblem pp on cs" +
|
||||
".classId=pp.classId "+
|
||||
"left JOIN"+
|
||||
" SubmitReport sr ON " +
|
||||
"sr" +
|
||||
".studentId=u.id"+
|
||||
" WHERE cs.classId=:classId " +
|
||||
"and " +
|
||||
"pp.problemId " +
|
||||
"=:problemId" +
|
||||
" and sr" +
|
||||
".submissionTime is not null " +
|
||||
"and " +
|
||||
"u.studentNo like :studentNo " +
|
||||
"and u" +
|
||||
".chineseName like :chineseName";
|
||||
Query<Object[]> query =
|
||||
this.getCurrentSession().createQuery(hql,Object[].class);
|
||||
query.setParameter("classId", classId);
|
||||
query.setParameter("problemId", problemId);
|
||||
query.setParameter("studentNo",studentNo);
|
||||
query.setParameter("chineseName",
|
||||
chineseName);
|
||||
int page= pmStudentSubmit.getPageNum();
|
||||
int rows= pmStudentSubmit.getPageSize();
|
||||
// 设置分页
|
||||
query.setFirstResult((page - 1) * rows); // 计算起始行
|
||||
query.setMaxResults(rows); // 设置每页行数
|
||||
|
||||
return query.getResultList();
|
||||
}
|
||||
}
|
||||
|
|
@ -11,6 +11,8 @@ import java.util.List;
|
|||
public class PMPostProblem{
|
||||
private int id;
|
||||
private int adminuserId;
|
||||
private int problemId;
|
||||
private int classId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startTime;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.example.aes.problem.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class PMStudentSubmit {
|
||||
private String chineseName;
|
||||
private String studentNo;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime readTime;
|
||||
private String submissionStatus;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime submitTime;
|
||||
private int problemId;
|
||||
private int classId;
|
||||
private int studentId;
|
||||
private String selectedStatus;
|
||||
private int pageNum;
|
||||
private int pageSize;
|
||||
private float finalScore;
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import com.example.aes.problem.dao.*;
|
|||
import com.example.aes.problem.model.*;
|
||||
import com.example.aes.problem.service.ProblemServiceI;
|
||||
import com.example.aes.user.dao.AdminusersDaoI;
|
||||
import com.example.aes.user.dao.ClassesDaoI;
|
||||
import com.example.aes.user.model.DataGrid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -17,8 +18,14 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
|||
private ProblemDaoI problemDao;
|
||||
private ScoringRubricDaoI scoringRubricDao;
|
||||
private ScoringStandardDaoI scoringStandardDao;
|
||||
private SubmitReportDaoI studentSubmitDao;
|
||||
private AdminusersDaoI adminusersDao;
|
||||
private PostProblemDaoI postProblemDao;
|
||||
private ClassesDaoI classesDao;
|
||||
@Autowired
|
||||
public void setClassesDao(ClassesDaoI classesDao) {
|
||||
this.classesDao = classesDao;
|
||||
}
|
||||
@Autowired
|
||||
public void setPostProblemDao(PostProblemDaoI postProblemDao) {
|
||||
this.postProblemDao = postProblemDao;
|
||||
|
|
@ -70,12 +77,10 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
|||
return uScoringRubricList;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public List<ScoringStandard> findStandardIdNoProblemId(){
|
||||
List<ScoringStandard> scoringStandardList=scoringStandardDao.getStandardIdNoProblemIdDesc();
|
||||
|
||||
return scoringStandardList;
|
||||
return scoringStandardDao.getStandardIdNoProblemIdDesc();
|
||||
|
||||
}
|
||||
@Override
|
||||
|
|
@ -211,18 +216,21 @@ changeModel2(pmProblems,theProblemList);
|
|||
List<Object[]> theProblemList;
|
||||
totalLines= (int) postProblemDao.getPostProblemNum(pmProblem.getCourseId(),pmProblem.getClassId());
|
||||
int page= pmProblem.getPageNum();
|
||||
|
||||
int studentNum=
|
||||
classesDao.findClassById(pmProblem.getClassId()).get(0).getStudentNum();
|
||||
theProblemList=
|
||||
problemDao.getProblemsByPage(pmProblem.getCourseId(),pmProblem.getClassId(),pmProblem.getSelectedStatus(),pmProblem.getPageNum(), pmProblem.getPageSize());
|
||||
// totalLines=theProblemList.size();
|
||||
if ((page-1)*pmProblem.getPageSize()>=totalLines){
|
||||
pmProblem.setPageNum(1);
|
||||
}
|
||||
|
||||
theProblemList=
|
||||
problemDao.getProblemsByPage(pmProblem.getCourseId(),pmProblem.getClassId(),pmProblem.getSelectedStatus(),pmProblem.getPageNum(), pmProblem.getPageSize());
|
||||
if (theProblemList== null) {
|
||||
return null;
|
||||
} else {
|
||||
List<PMProblem> pmProblems=new ArrayList<>();
|
||||
changeModel3(pmProblems,
|
||||
theProblemList);
|
||||
theProblemList,studentNum);
|
||||
dg.setTotal(totalLines);
|
||||
dg.setPageSize(pmProblem.getPageSize());
|
||||
dg.setTotalPages((long) (Math.ceil((double) dg.getTotal() / (double) dg.getPageSize())));
|
||||
|
|
@ -242,6 +250,98 @@ changeModel2(pmProblems,theProblemList);
|
|||
return problems;
|
||||
}
|
||||
@Override
|
||||
public List<PostProblem> findPostProblem(int problemId,int classId){
|
||||
List<PostProblem> postProblems=
|
||||
postProblemDao.findPostProblem(problemId,classId);
|
||||
return postProblems;
|
||||
}
|
||||
@Autowired
|
||||
public void setStudentSubmitDao(SubmitReportDaoI studentSubmitDao) {
|
||||
this.studentSubmitDao = studentSubmitDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataGrid findWeijiaoList(PMStudentSubmit pmStudentSubmit){
|
||||
DataGrid dg = new DataGrid();
|
||||
int totalLines;
|
||||
List<Object[]> theSubmitList;
|
||||
// totalLines=
|
||||
// (int) studentSubmitDao.getStudentSubmitNum(pmStudentSubmit.getProblemId(),pmStudentSubmit.getClassId());
|
||||
int page= pmStudentSubmit.getPageNum();
|
||||
|
||||
// int studentNum=
|
||||
// classesDao.findClassById(pmProblem.getClassId()).get(0).getStudentNum();
|
||||
theSubmitList=
|
||||
studentSubmitDao.findWeijiaoList(pmStudentSubmit);
|
||||
// problemDao.getProblemsByPage(pmProblem.getCourseId(),pmProblem.getClassId(),pmProblem.getSelectedStatus(),pmProblem.getPageNum(), pmProblem.getPageSize());
|
||||
totalLines= theSubmitList.size();
|
||||
if ((page-1)*pmStudentSubmit.getPageSize()>=totalLines){
|
||||
pmStudentSubmit.setPageNum(1);
|
||||
}
|
||||
if (theSubmitList== null) {
|
||||
return null;
|
||||
} else {
|
||||
List<PMStudentSubmit> pmStudentSubmitList=
|
||||
new ArrayList<>();
|
||||
changeModel4(pmStudentSubmitList,
|
||||
theSubmitList);
|
||||
dg.setTotal(totalLines);
|
||||
dg.setPageSize(pmStudentSubmit.getPageSize());
|
||||
dg.setTotalPages((long) (Math.ceil((double) dg.getTotal() / (double) dg.getPageSize())));
|
||||
// // 设置当前显示第几页
|
||||
dg.setPageNum(pmStudentSubmit.getPageNum());
|
||||
// // 设置当前页的数据行数量
|
||||
dg.setCurrentPageLineNum(pmStudentSubmitList.size());
|
||||
// // 设置当前页的所有数据行
|
||||
dg.setList(pmStudentSubmitList);
|
||||
return dg;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public DataGrid findYijiaoList(PMStudentSubmit pmStudentSubmit){
|
||||
DataGrid dg = new DataGrid();
|
||||
int totalLines;
|
||||
List<Object[]> theSubmitList;
|
||||
// totalLines=
|
||||
// (int) studentSubmitDao.getStudentSubmitNum(pmStudentSubmit.getProblemId(),pmStudentSubmit.getClassId());
|
||||
int page= pmStudentSubmit.getPageNum();
|
||||
|
||||
// int studentNum=
|
||||
// classesDao.findClassById(pmProblem.getClassId()).get(0).getStudentNum();
|
||||
theSubmitList=
|
||||
studentSubmitDao.findYijiaoList(pmStudentSubmit);
|
||||
// problemDao.getProblemsByPage(pmProblem.getCourseId(),pmProblem.getClassId(),pmProblem.getSelectedStatus(),pmProblem.getPageNum(), pmProblem.getPageSize());
|
||||
totalLines= theSubmitList.size();
|
||||
if ((page-1)*pmStudentSubmit.getPageSize()>=totalLines){
|
||||
pmStudentSubmit.setPageNum(1);
|
||||
}
|
||||
if (theSubmitList== null) {
|
||||
return null;
|
||||
} else {
|
||||
List<PMStudentSubmit> pmStudentSubmitList=
|
||||
new ArrayList<>();
|
||||
changeModel5(pmStudentSubmitList,
|
||||
theSubmitList);
|
||||
dg.setTotal(totalLines);
|
||||
dg.setPageSize(pmStudentSubmit.getPageSize());
|
||||
dg.setTotalPages((long) (Math.ceil((double) dg.getTotal() / (double) dg.getPageSize())));
|
||||
// // 设置当前显示第几页
|
||||
dg.setPageNum(pmStudentSubmit.getPageNum());
|
||||
// // 设置当前页的数据行数量
|
||||
dg.setCurrentPageLineNum(pmStudentSubmitList.size());
|
||||
// // 设置当前页的所有数据行
|
||||
dg.setList(pmStudentSubmitList);
|
||||
return dg;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int editPostProblem(int classId,
|
||||
int problemId,LocalDateTime startTime,LocalDateTime endTime,boolean allow){
|
||||
int n=0;
|
||||
if(allow==true)n=1;
|
||||
return postProblemDao.editPostProblem(classId,problemId,startTime,endTime,n);
|
||||
}
|
||||
@Override
|
||||
public void postProblem(PMPostProblem pmPostProblem, Integer classId){
|
||||
postProblemDao.postProblem(pmPostProblem,classId);
|
||||
}
|
||||
|
|
@ -284,7 +384,7 @@ changeModel2(pmProblems,theProblemList);
|
|||
}
|
||||
}
|
||||
private void changeModel3(List<PMProblem> pmp,
|
||||
List<Object[]> pmp2) {
|
||||
List<Object[]> pmp2,int studentNum) {
|
||||
if (pmp2 != null && pmp2.size() > 0) {
|
||||
for (Object[] p2 : pmp2) {
|
||||
PMProblem pmProblem=new PMProblem();
|
||||
|
|
@ -294,7 +394,8 @@ changeModel2(pmProblems,theProblemList);
|
|||
pmProblem.setEndTime((LocalDateTime) p2[3]);
|
||||
pmProblem.setDaipi((Long) p2[4]);
|
||||
pmProblem.setYijiao((Long) p2[5]);
|
||||
pmProblem.setWeijiao((Long) p2[6]);
|
||||
// pmProblem.setWeijiao((Long) p2[6]);
|
||||
pmProblem.setWeijiao(studentNum-(Long)p2[5]);
|
||||
String timeRange=
|
||||
pmProblem.getStartTime()+"~"+pmProblem.getEndTime();
|
||||
pmProblem.setTimeRange(timeRange.replace("T", " "));
|
||||
|
|
@ -303,4 +404,35 @@ changeModel2(pmProblems,theProblemList);
|
|||
}
|
||||
}
|
||||
}
|
||||
private void changeModel4(List<PMStudentSubmit> pmStudentSubmitList,
|
||||
List<Object[]> pmObject) {
|
||||
if (pmObject != null && pmObject.size() > 0) {
|
||||
for (Object[] p : pmObject) {
|
||||
PMStudentSubmit pmStudentSubmit=
|
||||
new PMStudentSubmit();
|
||||
pmStudentSubmit.setChineseName((String) p[0]);
|
||||
pmStudentSubmit.setStudentNo((String) p[1]);
|
||||
pmStudentSubmit.setReadTime((LocalDateTime) p[2]);
|
||||
pmStudentSubmit.setSubmissionStatus((String) p[3]);
|
||||
pmStudentSubmitList.add(pmStudentSubmit);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
private void changeModel5(List<PMStudentSubmit> pmStudentSubmitList,
|
||||
List<Object[]> pmObject) {
|
||||
if (pmObject != null && pmObject.size() > 0) {
|
||||
for (Object[] p : pmObject) {
|
||||
PMStudentSubmit pmStudentSubmit=
|
||||
new PMStudentSubmit();
|
||||
pmStudentSubmit.setChineseName((String) p[0]);
|
||||
pmStudentSubmit.setStudentNo((String) p[1]);
|
||||
pmStudentSubmit.setSubmitTime((LocalDateTime) p[2]);
|
||||
pmStudentSubmit.setSubmissionStatus((String) p[3]);
|
||||
pmStudentSubmit.setFinalScore((float) p[4]);
|
||||
pmStudentSubmitList.add(pmStudentSubmit);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.example.aes.problem.model.*;
|
|||
import com.example.aes.user.model.*;
|
||||
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public interface ProblemServiceI {
|
||||
|
|
@ -34,5 +35,10 @@ public interface ProblemServiceI {
|
|||
public List<Problem> findProblemById(int id);
|
||||
public void postProblem(PMPostProblem pmPostProblem, Integer classId);
|
||||
public void deleteProblem(Integer id);
|
||||
|
||||
public List<PostProblem> findPostProblem(int problemId,int classId);
|
||||
public int editPostProblem( int classId,
|
||||
int problemId,
|
||||
LocalDateTime startTime,LocalDateTime endTime,boolean allow);
|
||||
public DataGrid findWeijiaoList(PMStudentSubmit pmStudentSubmit);
|
||||
public DataGrid findYijiaoList(PMStudentSubmit pmStudentSubmit);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ package com.example.aes.user.dao;
|
|||
import com.example.aes.user.model.*;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ClassesDaoI extends BaseDaoI<Classes> {
|
||||
|
||||
|
|
@ -48,4 +46,5 @@ public interface ClassesDaoI extends BaseDaoI<Classes> {
|
|||
String className, int teacherId);
|
||||
public List<Classstudents>findClassIdByStudentId(int studentId);//根据班级id查找学生id
|
||||
public List<Classes> findClassByCourseId(int courseId);
|
||||
public List<Classes> findClassById(int classId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,11 @@ package com.example.aes.user.dao.impl;
|
|||
|
||||
import com.example.aes.user.dao.*;
|
||||
import com.example.aes.user.model.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Repository("classesDao")
|
||||
|
|
@ -570,6 +568,12 @@ public class ClassesDaoImpl extends BaseDaoImpl<Classes> implements ClassesDaoI
|
|||
"courseId="+courseId;
|
||||
return this.find(hql);
|
||||
}
|
||||
@Override
|
||||
public List<Classes> findClassById(int classId){
|
||||
String hql = "from Classes where " +
|
||||
"id="+classId;
|
||||
return this.find(hql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,64 +1,24 @@
|
|||
package com.example.aes.user.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* Classstudents entity. @author MyEclipse Persistence Tools
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "studentclass")
|
||||
@Table(name = "studentclass",catalog = "aes")
|
||||
public class Classstudents implements java.io.Serializable {
|
||||
|
||||
// Fields
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8050828329203855066L;
|
||||
private Integer id;
|
||||
private Integer classId;
|
||||
private Integer userId;
|
||||
|
||||
// Constructors
|
||||
|
||||
/** default constructor */
|
||||
public Classstudents() {
|
||||
}
|
||||
|
||||
/** full constructor */
|
||||
public Classstudents(Integer classId, Integer userId) {
|
||||
this.classId = classId;
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
// Property accessors
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", unique = true, nullable = false)
|
||||
public Integer getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "classId", nullable = false)
|
||||
public Integer getClassId() {
|
||||
return this.classId;
|
||||
}
|
||||
|
||||
public void setClassId(Integer classId) {
|
||||
this.classId = classId;
|
||||
}
|
||||
|
||||
@Column(name = "userId", nullable = false)
|
||||
public Integer getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "userId")
|
||||
private Integer userId;
|
||||
@Column(name = "classId")
|
||||
private Integer classId;
|
||||
}
|
||||
|
|
@ -4,7 +4,6 @@ package com.example.aes.user.service;
|
|||
|
||||
import com.example.aes.user.model.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface ClassesServiceI {
|
||||
|
|
|
|||
|
|
@ -4,12 +4,10 @@ import com.example.aes.user.dao.ClassesDaoI;
|
|||
import com.example.aes.user.dao.ClassstudentsDaoI;
|
||||
import com.example.aes.user.model.*;
|
||||
import com.example.aes.user.service.ClassesServiceI;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
|
|
|||
Loading…
Reference in New Issue