Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # AES/src/main/java/com/example/aes/problem/controller/ProblemController.java # AES/src/main/java/com/example/aes/problem/dao/ProblemDaoI.java # AES/src/main/java/com/example/aes/problem/dao/impl/ProblemDaoImpl.java # AES/src/main/java/com/example/aes/problem/model/PMProblem.java # AES/src/main/java/com/example/aes/problem/service/Impl/ProblemServiceImpl.java # AES/src/main/java/com/example/aes/problem/service/ProblemServiceI.java
This commit is contained in:
commit
f8bb522636
|
|
@ -86,4 +86,8 @@ export default {
|
||||||
findScoringStandardByProblemId: (data) => request.post('/problem/findScoringStandardByProblemId', data),
|
findScoringStandardByProblemId: (data) => request.post('/problem/findScoringStandardByProblemId', data),
|
||||||
editProblem:(data) => request.post('/problem/editProblem', data),
|
editProblem:(data) => request.post('/problem/editProblem', data),
|
||||||
deleteProblem:(data) => request.post('/problem/deleteProblem', 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),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,15 +33,18 @@ import ProblemActions from
|
||||||
'./ProblemActions.vue';
|
'./ProblemActions.vue';
|
||||||
import {formatDateTime} from '@/utils';
|
import {formatDateTime} from '@/utils';
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
const rules=ref(null)
|
const rules=ref(null)
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const route = useRoute()
|
||||||
|
const {problemId, history } = route.query
|
||||||
const ProblemInfoRef = ref(null)
|
const ProblemInfoRef = ref(null)
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const ScoringRubricList =
|
const ScoringRubricList =
|
||||||
ref([])
|
ref([])
|
||||||
const role=userStore.getRole()
|
const role=userStore.getRole()
|
||||||
|
const route = useRoute()
|
||||||
const paginationReactive = reactive({
|
const paginationReactive = reactive({
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 50,
|
pageSize: 50,
|
||||||
|
|
@ -65,7 +68,7 @@ let columns = [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
const queryByPage = async (currentPage)=>{
|
const queryByPage = async ()=>{
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
const res = await
|
const res = await
|
||||||
|
|
@ -112,17 +115,12 @@ const onChangePage = (page) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
|
path.value = router.currentRoute.value.fullPath
|
||||||
queryByPage()
|
queryByPage()
|
||||||
})
|
})
|
||||||
watch(
|
watch(route, () => {
|
||||||
()=>router.currentRoute.value.fullPath,
|
queryByPage() // 路由变化时重新获取数据
|
||||||
()=>{
|
});
|
||||||
if
|
|
||||||
(router.currentRoute.value.fullPath==='/admin/problem/problem-scoring-standard') {
|
|
||||||
queryByPage(paginationReactive.page)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ import ProblemActions from
|
||||||
'./ProblemActions.vue';
|
'./ProblemActions.vue';
|
||||||
import {formatDateTime} from '@/utils';
|
import {formatDateTime} from '@/utils';
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
const rules=ref(null)
|
const rules=ref(null)
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
@ -44,6 +44,7 @@ const ProblemList =
|
||||||
const options1=ref([])
|
const options1=ref([])
|
||||||
const role=userStore.getRole()
|
const role=userStore.getRole()
|
||||||
const teacherId=ref()
|
const teacherId=ref()
|
||||||
|
const route = useRoute()
|
||||||
const paginationReactive = reactive({
|
const paginationReactive = reactive({
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 50,
|
pageSize: 50,
|
||||||
|
|
@ -145,15 +146,9 @@ const onChangePage = (page) => {
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
queryByPage()
|
queryByPage()
|
||||||
})
|
})
|
||||||
watch(
|
watch(route, () => {
|
||||||
()=>router.currentRoute.value.fullPath,
|
queryByPage(); // 路由变化时重新获取数据
|
||||||
()=>{
|
});
|
||||||
if
|
|
||||||
(router.currentRoute.value.fullPath==='/admin/problem/problem-list') {
|
|
||||||
queryByPage(paginationReactive.page)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,104 +5,127 @@
|
||||||
<n-form
|
<n-form
|
||||||
ref="problemInfoRef"
|
ref="problemInfoRef"
|
||||||
:model="problemInfoValue"
|
:model="problemInfoValue"
|
||||||
:rules="problemAddRules"
|
:rules="problemPostRules"
|
||||||
label-placement="left"
|
label-placement="left"
|
||||||
label-align="right"
|
label-align="right"
|
||||||
label-width="100px"
|
label-width="100px"
|
||||||
:show-require-mark="false"
|
: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-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">
|
<div class="grid md:grid-cols-3 md:gap-x-30">
|
||||||
<n-form-item label="有效时段:"
|
<n-form-item label="有效时段:">
|
||||||
path="timeFrom">
|
|
||||||
<n-date-picker
|
<n-date-picker
|
||||||
v-model:formatted-value="problemInfoValue.timeFrom"
|
v-model:formatted-value="problemInfoValue.startTime"
|
||||||
style="width: 350px"
|
style="width: 350px"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
input-readonly
|
input-readonly
|
||||||
placeholder="请选择开始时间"
|
placeholder="请选择开始时间"
|
||||||
format="yyyy-MM-dd HH:mm"
|
format="yyyy-MM-dd HH:mm:ss"
|
||||||
update-value-on-close
|
update-value-on-close
|
||||||
:actions="['confirm']"
|
:actions="['confirm']"
|
||||||
/>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item label="到:" path="timeTo">
|
<n-form-item label="到:">
|
||||||
<n-date-picker
|
<n-date-picker
|
||||||
v-model:formatted-value="problemInfoValue.timeTo"
|
v-model:formatted-value="problemInfoValue.endTime"
|
||||||
style="width: 300px"
|
style="width: 300px"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
input-readonly
|
input-readonly
|
||||||
placeholder="请选择结束时间"
|
placeholder="请选择结束时间"
|
||||||
format="yyyy-MM-dd HH:mm"
|
format="yyyy-MM-dd HH:mm:ss"
|
||||||
update-value-on-close
|
update-value-on-close
|
||||||
:actions="['confirm']"
|
:actions="['confirm']"
|
||||||
/>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid md:grid-cols-4 md:gap-x-30">
|
<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="允许补交:"
|
<n-form-item label="允许补交:"
|
||||||
path="allow">
|
path="allow">
|
||||||
<n-checkbox
|
<n-checkbox
|
||||||
v-model:checked="problemInfoValue.allow"
|
v-model:checked="problemInfoValue.allow"
|
||||||
@update="allow"
|
|
||||||
></n-checkbox>
|
></n-checkbox>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
</div> <div flex>
|
|
||||||
<n-form-item style='margin-left: 30px'>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div flex>
|
||||||
|
<n-form-item style="margin-left: 30px">
|
||||||
<n-button type="primary"
|
<n-button type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
@click="submit">确定
|
@click="updateSetup"
|
||||||
|
>确定
|
||||||
</n-button></n-form-item>
|
</n-button></n-form-item>
|
||||||
<n-form-item style='margin-left: 20px'>
|
<n-form-item style="margin-left: 10px">
|
||||||
<n-button type="primary"
|
<n-button type="primary"
|
||||||
size="small" @click="cancel">取消
|
size="small" @click="cancel" style='margin-left:
|
||||||
</n-button>
|
20px'>取消
|
||||||
</n-form-item></div>
|
</n-button></n-form-item>
|
||||||
|
</div>
|
||||||
</div></n-form>
|
<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>
|
</div>
|
||||||
</CommonPage>
|
</CommonPage>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {useRouter} from "vue-router";
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import {ref} from "vue";
|
import {ref} from "vue";
|
||||||
import api from "@/api/admin";
|
import api from "@/api/admin";
|
||||||
import { useTagsStore } from '@/store'
|
import { useTagsStore } from '@/store'
|
||||||
import StandardsList
|
import ViewClassesPost
|
||||||
from '@/views/admin/problem/components/StandardList.vue'
|
from '@/views/admin/problem/components/view-classes-post.vue'
|
||||||
import RichTextEditor
|
|
||||||
from '@/components/common/RichTextEditor.vue'
|
|
||||||
const tagsStore = useTagsStore()
|
const tagsStore = useTagsStore()
|
||||||
const path=ref('')
|
const path=ref('')
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const rules=ref(null)
|
const rules=ref(null)
|
||||||
|
const route = useRoute()
|
||||||
|
const loading = ref(true)
|
||||||
|
const {problemId,classId, history } = route.query
|
||||||
const problemInfoValue = ref({
|
const problemInfoValue = ref({
|
||||||
name: '',
|
title: '',
|
||||||
timeFrom: [],
|
startTime: [],
|
||||||
timeTo: [],
|
endTime: [],
|
||||||
allow:true
|
allow:false
|
||||||
});
|
});
|
||||||
const problemInfoRef = ref(null)
|
const problemInfoRef = ref(null)
|
||||||
const descEditorHeight = ref('160px')
|
const descEditorHeight = ref('160px')
|
||||||
const problemName = ref('作业标题')
|
const problemName = ref('作业标题')
|
||||||
const cancel = ()=>{
|
const cancel = ()=>{
|
||||||
tagsStore.removeTag(path.value)
|
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 = ()=>{
|
const onAdd = ()=>{
|
||||||
router.push({name: 'AdminProblemPostClass'})
|
router.push({name: 'AdminProblemPostClass'})
|
||||||
|
|
@ -124,7 +147,21 @@ const submit =async ()=>{
|
||||||
$message.error("作业名称不能为空")
|
$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(()=>{
|
onMounted(()=>{
|
||||||
path.value=router.currentRoute.value.fullPath
|
path.value=router.currentRoute.value.fullPath
|
||||||
|
queryByPage()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,6 @@ let columns = [
|
||||||
]
|
]
|
||||||
const cancel = ()=>{
|
const cancel = ()=>{
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
router.push({path: 'problem-list'})
|
|
||||||
}
|
}
|
||||||
const onAdd = ()=>{
|
const onAdd = ()=>{
|
||||||
router.push({name: 'AdminProblemScoringStandard'})
|
router.push({name: 'AdminProblemScoringStandard'})
|
||||||
|
|
|
||||||
|
|
@ -10,21 +10,21 @@
|
||||||
:label-width="60" >
|
:label-width="60" >
|
||||||
<div style="display: flex;margin-top:
|
<div style="display: flex;margin-top:
|
||||||
25px">
|
25px">
|
||||||
<div v-if="userStore.getRole().length>0 && userStore.getRole().some((r)=>r==='admin')">
|
|
||||||
<div
|
<div
|
||||||
style="display: flex;align-items: flex-start">
|
style="display: flex;align-items: flex-start">
|
||||||
<n-form-item label="班级:"
|
<n-form-item label="班级:"
|
||||||
path="name" Problem="flex-item">
|
path="name" Problem="flex-item">
|
||||||
<n-select
|
<n-select
|
||||||
v-model:value="ProblemInfoValue.ProblemId"
|
v-model:value="ProblemInfoValue.classId"
|
||||||
:options="options1"
|
:options="options1"
|
||||||
|
@update:value="search"
|
||||||
style="min-width: 80px;width: 140px"></n-select>
|
style="min-width: 80px;width: 140px"></n-select>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item style="margin-left: 10px">
|
<!-- <n-form-item style="margin-left: 10px">-->
|
||||||
<n-button type="primary" @click="search" style="margin-left: 10px;margin-right: 20px">查询</n-button>
|
<!-- <n-button type="primary" @click="search" style="margin-left: 10px;margin-right: 20px">查询</n-button>-->
|
||||||
</n-form-item>
|
<!-- </n-form-item>-->
|
||||||
<div
|
<div
|
||||||
class="status-options"style='display: flex;gap: 20px'>
|
class="status-options"style='display: flex;gap: 20px;margin-left: 30px'>
|
||||||
<label>状态:</label>
|
<label>状态:</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" value="" v-model="selectedStatus" @change="filterData" />
|
<input type="radio" value="" v-model="selectedStatus" @change="filterData" />
|
||||||
|
|
@ -44,7 +44,6 @@
|
||||||
</label></div>
|
</label></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</n-form>
|
</n-form>
|
||||||
</div>
|
</div>
|
||||||
<n-data-table
|
<n-data-table
|
||||||
|
|
@ -73,33 +72,24 @@ import ProblemActions from
|
||||||
'./components/ProblemActions.vue';
|
'./components/ProblemActions.vue';
|
||||||
import {formatDateTime} from '@/utils';
|
import {formatDateTime} from '@/utils';
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
const rules=ref(null)
|
const rules=ref(null)
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const ProblemInfoRef = ref(null)
|
const ProblemInfoRef = ref(null)
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const ProblemList =
|
const ProblemList =
|
||||||
ref([{title:"C++班级",timeRange:"2025-03-01 10:00:00 - 2025-03-05 18:00:00",daipi:"50",yijiao:"60",weijiao:"20"}])
|
ref([])
|
||||||
const options1=ref([])
|
const options1=ref([])
|
||||||
const role=userStore.getRole()
|
const role=userStore.getRole()
|
||||||
const teacherId=ref()
|
const teacherId=ref()
|
||||||
const selectedStatus=ref('')
|
const selectedStatus=ref("")
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const filteredData =ref([]);
|
const filteredData =ref([]);
|
||||||
|
const route = useRoute()
|
||||||
|
const { courseId, history } = route.query
|
||||||
const filterData =() => {
|
const filterData =() => {
|
||||||
if (selectedStatus.value === '') {
|
search(paginationReactive.page)
|
||||||
filteredData.value = ProblemList.value;
|
|
||||||
} else if(selectedStatus.value=='completed'){
|
|
||||||
filteredData.value = ProblemList.value.filter(item =>
|
|
||||||
item.endTime<today);
|
|
||||||
}else if(selectedStatus.value=='not_started'){
|
|
||||||
filteredData.value = ProblemList.value.filter(item =>
|
|
||||||
item.startTime>today);
|
|
||||||
}else{
|
|
||||||
filteredData.value = ProblemList.value.filter(item =>
|
|
||||||
item.startTime<=today&&item.endTime>=today);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
const paginationReactive = reactive({
|
const paginationReactive = reactive({
|
||||||
page: 1,
|
page: 1,
|
||||||
|
|
@ -115,6 +105,8 @@ const ProblemInfoValue = ref({
|
||||||
pageSize:paginationReactive.pageSize,
|
pageSize:paginationReactive.pageSize,
|
||||||
id:0,
|
id:0,
|
||||||
teacherId:'',
|
teacherId:'',
|
||||||
|
title:"",
|
||||||
|
classId:0
|
||||||
});
|
});
|
||||||
const onAdd = ()=>{
|
const onAdd = ()=>{
|
||||||
router.push({name: 'AdminProblemAdd'})
|
router.push({name: 'AdminProblemAdd'})
|
||||||
|
|
@ -142,9 +134,7 @@ watch(()=>ProblemInfoValue.value.id,
|
||||||
options1.value=[]
|
options1.value=[]
|
||||||
queryByPage1(newVal)
|
queryByPage1(newVal)
|
||||||
})
|
})
|
||||||
let columns
|
let columns = [
|
||||||
if (role[0]=='admin'){
|
|
||||||
columns = [
|
|
||||||
{
|
{
|
||||||
key: 'title',
|
key: 'title',
|
||||||
title: '作业标题',
|
title: '作业标题',
|
||||||
|
|
@ -190,88 +180,41 @@ if (role[0]=='admin'){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}else {
|
|
||||||
columns = [
|
|
||||||
{
|
|
||||||
key: 'name',
|
|
||||||
title: '班级名称',
|
|
||||||
width: '260',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'studentNum',
|
|
||||||
title: '学生数',
|
|
||||||
width: '80',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'createTime',
|
|
||||||
title: '创建时间',
|
|
||||||
width: '190',
|
|
||||||
render: (row) => {
|
|
||||||
return row["createTime"]=formatDateTime(row["createTime"]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'inviteCode',
|
|
||||||
title: '邀请码',
|
|
||||||
width: '130',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'actions',
|
|
||||||
title: '操作',
|
|
||||||
width: '450',
|
|
||||||
render(row) {
|
|
||||||
if(role[0]==='teacher'){
|
|
||||||
return h(
|
|
||||||
ProblemActions,
|
|
||||||
{
|
|
||||||
onClickStudent: () => onStudentProblem(row),
|
|
||||||
onClickAssistant: () => onAssistantProblem(row),
|
|
||||||
onClickEdit: () => onEditProblem(row),
|
|
||||||
onClickDelete: () => onDeleteProblem(row),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if(role[0]==='assistant'){
|
|
||||||
return h(
|
|
||||||
ProblemActions,
|
|
||||||
{
|
|
||||||
onClickStudent: () => onStudentProblem(row),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
const queryByPage = async (currentPage)=>{
|
const queryByPage = async (currentPage)=>{
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
ProblemInfoValue.value.pageNum=currentPage
|
||||||
ProblemInfoValue.value.pageSize=paginationReactive.pageSize
|
ProblemInfoValue.value.pageSize=paginationReactive.pageSize
|
||||||
const res = await api.findAllProblemPage(
|
try {
|
||||||
{
|
const res1=await
|
||||||
...ProblemInfoValue.value
|
api.findClassByCourseId({
|
||||||
}
|
courseId:courseId
|
||||||
);
|
})
|
||||||
console.log(res.data)
|
const list1=res1.data
|
||||||
// if (userStore.getRole().some((r) => r === 'admin')){
|
const transformedDatas=list1.map(item => ({
|
||||||
// const res1=await api.findAllShoolsInAdminusers()
|
label: item.name,
|
||||||
// const list1=res1.data
|
value: item.id,
|
||||||
// const transformedDatas=list1.map(item => ({
|
}));
|
||||||
// label: item.name,
|
transformedDatas.unshift({
|
||||||
// value: item.id,
|
label: '无',
|
||||||
// }));
|
value: 0,
|
||||||
// transformedDatas.unshift({
|
});
|
||||||
// label: '全部',
|
options1.value=transformedDatas;
|
||||||
// value: 0,
|
|
||||||
// });
|
|
||||||
// options.value=transformedDatas;
|
|
||||||
// }
|
|
||||||
const {pageNum, pageSize, total, list} = res.data
|
|
||||||
paginationReactive.page = pageNum
|
|
||||||
paginationReactive.pageSize = pageSize
|
|
||||||
paginationReactive.itemCount = total
|
|
||||||
ProblemList.value=list.map((item,i)=>{return item;})
|
|
||||||
|
|
||||||
|
// const res = await
|
||||||
|
// api.findAllProblemByCourseId(
|
||||||
|
// {
|
||||||
|
// ...ProblemInfoValue.value,
|
||||||
|
// courseId:courseId
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// const {pageNum, pageSize, total, list} = res.data
|
||||||
|
// paginationReactive.page = pageNum
|
||||||
|
// paginationReactive.pageSize = pageSize
|
||||||
|
// paginationReactive.itemCount = total
|
||||||
|
// ProblemList.value = list.map((item,i)=>{return item;})
|
||||||
|
// filteredData.value=ProblemList.value
|
||||||
|
// console.log(ProblemList.value)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
|
@ -300,35 +243,48 @@ const onAssistantProblem = async (problemid)=>{
|
||||||
await router.push({name: 'AdminProblemAssistant', params: {clId: id}})
|
await router.push({name: 'AdminProblemAssistant', params: {clId: id}})
|
||||||
}
|
}
|
||||||
const onEditProblem = async (problemid)=>{
|
const onEditProblem = async (problemid)=>{
|
||||||
// const {id} = problemid
|
const {id} = problemid
|
||||||
const id=1
|
|
||||||
await router.push({name:
|
await router.push({name:
|
||||||
'AdminProblemEditSetup',
|
'AdminProblemEditSetup',
|
||||||
params: {clId: id}})
|
query:
|
||||||
|
{classId:ProblemInfoValue.value.classId,problemId:
|
||||||
|
id}})
|
||||||
}
|
}
|
||||||
const onReviewProblem = async (problemid)=>{
|
const onReviewProblem = async (problemid)=>{
|
||||||
// const {id} = problemid
|
const {id} = problemid
|
||||||
const id=1
|
|
||||||
await router.push({name:
|
await router.push({name:
|
||||||
'AdminProblemStudent',
|
'AdminProblemStudent',
|
||||||
params: {clId: id}})
|
query:
|
||||||
|
{classId:ProblemInfoValue.value.classId,problemId:id}})
|
||||||
}
|
}
|
||||||
const search=async ()=>{
|
// const search=async ()=>{
|
||||||
loading.value=true
|
// // ProblemInfoRef.value?.validate(async (errors) => {
|
||||||
|
// // await queryByPage(1)
|
||||||
|
// // })
|
||||||
|
// }
|
||||||
|
const search = async (currentPage)=>{
|
||||||
|
loading.value = true;
|
||||||
|
ProblemInfoValue.value.pageNum=currentPage
|
||||||
|
ProblemInfoValue.value.pageSize=paginationReactive.pageSize
|
||||||
try {
|
try {
|
||||||
if (userStore.getRole().some((r)=>r==='admin')){
|
const res = await
|
||||||
const res=await api.findAllProblemPage({
|
api.findAllProblemByCourseIdAndClassId(
|
||||||
...ProblemInfoValue.value
|
{
|
||||||
})
|
...ProblemInfoValue.value,
|
||||||
|
courseId:courseId,
|
||||||
|
selectedStatus:selectedStatus.value
|
||||||
|
}
|
||||||
|
);
|
||||||
const {pageNum, pageSize, total, list} = res.data
|
const {pageNum, pageSize, total, list} = res.data
|
||||||
paginationReactive.page = pageNum
|
paginationReactive.page = pageNum
|
||||||
paginationReactive.pageSize = pageSize
|
paginationReactive.pageSize = pageSize
|
||||||
paginationReactive.itemCount = total
|
paginationReactive.itemCount = total
|
||||||
ProblemList.value = list.map((item,i)=>{return item;})
|
ProblemList.value = list.map((item,i)=>{return item;})
|
||||||
}
|
filteredData.value=ProblemList.value
|
||||||
|
// console.log(ProblemList.value)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
} finally {
|
} finally {
|
||||||
loading.value=false
|
loading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleSearchSchool = async (query) => {
|
const handleSearchSchool = async (query) => {
|
||||||
|
|
@ -371,18 +327,11 @@ const onChangePage = (page) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
queryByPage()
|
|
||||||
filteredData.value=ProblemList.value
|
|
||||||
})
|
|
||||||
watch(
|
|
||||||
()=>router.currentRoute.value.fullPath,
|
|
||||||
()=>{
|
|
||||||
if
|
|
||||||
(router.currentRoute.value.fullPath==='/admin/problem/problem-list') {
|
|
||||||
queryByPage(paginationReactive.page)
|
queryByPage(paginationReactive.page)
|
||||||
}
|
})
|
||||||
}
|
// watch(route, () => {
|
||||||
)
|
// filterData()
|
||||||
|
// })
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ const router = useRouter()
|
||||||
const ProblemInfoRef = ref(null)
|
const ProblemInfoRef = ref(null)
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const ProblemList =
|
const ProblemList =
|
||||||
ref([{title:"C++班级",creater:"zlm"}])
|
ref([])
|
||||||
const options1=ref([])
|
const options1=ref([])
|
||||||
const role=userStore.getRole()
|
const role=userStore.getRole()
|
||||||
const teacherId=ref()
|
const teacherId=ref()
|
||||||
|
|
@ -248,15 +248,9 @@ const onChangePage = (page) => {
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
queryByPage(paginationReactive.page)
|
queryByPage(paginationReactive.page)
|
||||||
})
|
})
|
||||||
watch(
|
// watch(route, () => {
|
||||||
()=>router.currentRoute.value.fullPath,
|
// queryByPage(); // 路由变化时重新获取数据
|
||||||
()=>{
|
// });
|
||||||
if
|
|
||||||
(router.currentRoute.value.fullPath==='/admin/problem/problem-store') {
|
|
||||||
queryByPage(paginationReactive.page)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
<div style="display: flex">
|
<div style="display: flex">
|
||||||
<n-h3
|
<n-h3
|
||||||
class="show-problem-name">
|
class="show-problem-name">
|
||||||
{{ problemName }}
|
{{ problem.title }}
|
||||||
</n-h3>
|
</n-h3>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -28,25 +28,16 @@
|
||||||
<label>
|
<label>
|
||||||
<input type="radio"
|
<input type="radio"
|
||||||
value="yijiao"
|
value="yijiao"
|
||||||
v-model="selectedStatus" @change="updateColumns"/>
|
v-model="selectedStatus" @change="filterData"/>
|
||||||
已交
|
已交
|
||||||
</label><label>
|
</label><label>
|
||||||
<input type="radio"
|
<input type="radio"
|
||||||
value="weijiao"
|
value="weijiao"
|
||||||
v-model="selectedStatus" @change="updateColumns" />
|
v-model="selectedStatus" @change="filterData" />
|
||||||
未交
|
未交
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
</div>
|
</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-form-item label="学号:" path="name" class="flex-item">
|
||||||
<n-input v-model:value="studentInfoValue.studentNo"
|
<n-input v-model:value="studentInfoValue.studentNo"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
|
|
@ -55,11 +46,6 @@
|
||||||
<n-form-item label="姓名:" class="flex-item" style="margin-left: 0px">
|
<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-input v-model:value="studentInfoValue.chineseName" style="min-width: 80px" placeholder=""></n-input>
|
||||||
</n-form-item>
|
</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-form-item style="margin-left: 10px">
|
||||||
<n-button type="primary" @click="search">自定义查询</n-button>
|
<n-button type="primary" @click="search">自定义查询</n-button>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
|
@ -67,8 +53,6 @@
|
||||||
style='justify-content: flex-end'>
|
style='justify-content: flex-end'>
|
||||||
<n-form-item
|
<n-form-item
|
||||||
v-if="selectedStatus==='weijiao'" style='margin-left: 10px;margin-right: 20px'>
|
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-button type="primary" style="margin-right: 10px" @click="exportUnsubmitted">导出未交名单</n-button>
|
||||||
|
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
|
@ -89,7 +73,7 @@
|
||||||
:single-line="false"
|
:single-line="false"
|
||||||
ref="table"
|
ref="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:data="studentList"
|
:data="filteredData"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:pagination="paginationReactive"
|
:pagination="paginationReactive"
|
||||||
:row-key="rowKey"
|
:row-key="rowKey"
|
||||||
|
|
@ -108,18 +92,26 @@ import api from "@/api/admin";
|
||||||
import ProblemStudentAction
|
import ProblemStudentAction
|
||||||
from '@/views/admin/problem/components/problem-student-action.vue'
|
from '@/views/admin/problem/components/problem-student-action.vue'
|
||||||
import {formatDateTime} from '@/utils';
|
import {formatDateTime} from '@/utils';
|
||||||
|
import ProblemStudentAction2
|
||||||
|
from '@/views/admin/problem/components/problem-student-action2.vue'
|
||||||
|
import { NDataTable } from 'naive-ui'
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const rules=ref(null)
|
const rules=ref(null)
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const options=ref([])
|
const options=ref([])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const problemName =
|
const problem =
|
||||||
ref('作业标题')
|
ref({
|
||||||
|
title:''
|
||||||
|
})
|
||||||
const selectedStatus=ref('yijiao')
|
const selectedStatus=ref('yijiao')
|
||||||
|
const filteredData =ref([])
|
||||||
|
const submitList =
|
||||||
|
ref([])
|
||||||
const studentList =
|
const studentList =
|
||||||
reactive([{studentNo:"211310509",chineseName:"张三",submitDate:"2025-02-11",readDate:"2025-02-11",status:"待批",status1:"已查看",score:"89"}])
|
reactive([])
|
||||||
const filteredStudentList=ref(studentList)
|
const filteredStudentList=ref(studentList)
|
||||||
const {clId} = route.params
|
const { classId,problemId, history } = route.query
|
||||||
const paginationReactive = reactive({
|
const paginationReactive = reactive({
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 50,
|
pageSize: 50,
|
||||||
|
|
@ -129,7 +121,7 @@ const paginationReactive = reactive({
|
||||||
return `总共 ${itemCount} 条`
|
return `总共 ${itemCount} 条`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const columns=ref()
|
const columns=ref([])
|
||||||
const updateColumns=()=>{
|
const updateColumns=()=>{
|
||||||
if(selectedStatus.value==='weijiao'){
|
if(selectedStatus.value==='weijiao'){
|
||||||
columns.value = [
|
columns.value = [
|
||||||
|
|
@ -149,14 +141,10 @@ const updateColumns=()=>{
|
||||||
key: 'readTime',
|
key: 'readTime',
|
||||||
title: '领取时间',
|
title: '领取时间',
|
||||||
width: '100',
|
width: '100',
|
||||||
align:'center',
|
align:'center'
|
||||||
render: (row) => {
|
|
||||||
return
|
|
||||||
row["readTime"]=formatDateTime(row["readTime"]);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'status1',
|
key: 'submissionStatus',
|
||||||
title: '状态',
|
title: '状态',
|
||||||
width: '300',
|
width: '300',
|
||||||
},
|
},
|
||||||
|
|
@ -194,20 +182,16 @@ const updateColumns=()=>{
|
||||||
key: 'submitTime',
|
key: 'submitTime',
|
||||||
title: '提交时间',
|
title: '提交时间',
|
||||||
width: '160',
|
width: '160',
|
||||||
align:'center',
|
align:'center'
|
||||||
render: (row) => {
|
|
||||||
return
|
|
||||||
row["submitTime"]=formatDateTime(row["submitTime"]);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'status',
|
key: 'submissionStatus',
|
||||||
title: '状态',
|
title: '状态',
|
||||||
width: '150',
|
width: '150',
|
||||||
align:'center',
|
align:'center',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'score',
|
key: 'finalScore',
|
||||||
title: '成绩',
|
title: '成绩',
|
||||||
width: '170',
|
width: '170',
|
||||||
align:'center',
|
align:'center',
|
||||||
|
|
@ -228,85 +212,54 @@ const updateColumns=()=>{
|
||||||
}]
|
}]
|
||||||
|
|
||||||
}
|
}
|
||||||
filterData(); // 更新过滤数据
|
// filterData(); // 更新过滤数据
|
||||||
}
|
}
|
||||||
// 根据 selectedStatus 过滤数据
|
// 根据 selectedStatus 过滤数据
|
||||||
const filterData = () => {
|
|
||||||
if (selectedStatus.value) {
|
|
||||||
filteredStudentList.value = studentList.filter(item =>
|
|
||||||
item.status === selectedStatus.value);
|
|
||||||
} else {
|
|
||||||
filteredStudentList.value = studentList; // 显示所有数据
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const studentInfoValue = ref({
|
const studentInfoValue = ref({
|
||||||
userId:'',
|
studentId:'',
|
||||||
studentNo:'',
|
studentNo:'',
|
||||||
chineseName:'',
|
chineseName:'',
|
||||||
stu_userName:'',
|
readTime:[],
|
||||||
schoolId:0,
|
submitTime:[],
|
||||||
|
submissionStatus:'',
|
||||||
|
score:0,
|
||||||
pageNum:paginationReactive.page,
|
pageNum:paginationReactive.page,
|
||||||
pageSize:paginationReactive.pageSize
|
pageSize:paginationReactive.pageSize
|
||||||
});
|
});
|
||||||
|
const filterData =() => {
|
||||||
|
queryByPage(paginationReactive.page)
|
||||||
|
updateColumns()
|
||||||
|
}
|
||||||
const queryByPage = async (currentPage)=>{
|
const queryByPage = async (currentPage)=>{
|
||||||
loading.value = true
|
loading.value = true;
|
||||||
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.pageNum=currentPage
|
||||||
studentInfoValue.value.pageSize=paginationReactive.pageSize
|
studentInfoValue.value.pageSize=paginationReactive.pageSize
|
||||||
const res = await api.findStudentsByCondition({
|
try {
|
||||||
pageNum: paginationReactive.page,
|
const res1=await
|
||||||
pageSize:paginationReactive.pageSize,
|
api.findProblemById({id:problemId});
|
||||||
studentNo:studentInfoValue.value.studentNo,
|
problem.value=res1.data
|
||||||
chineseName:studentInfoValue.value.chineseName,
|
const res = await
|
||||||
stu_userName:studentInfoValue.value.stu_userName,
|
api.findStudentSubmit(
|
||||||
schoolId:studentInfoValue.value.schoolId
|
{
|
||||||
})
|
...studentInfoValue.value,
|
||||||
if (res.message==='获取学生信息为空'){
|
classId:classId,
|
||||||
studentList.value=[]
|
problemId:problemId,
|
||||||
paginationReactive.page = 1
|
selectedStatus:selectedStatus.value
|
||||||
paginationReactive.pageSize = 10
|
}
|
||||||
paginationReactive.itemCount = 0
|
);
|
||||||
$message.success('获取学生信息为空')
|
|
||||||
}else {
|
|
||||||
const {pageNum, pageSize, total, list} = res.data
|
const {pageNum, pageSize, total, list} = res.data
|
||||||
paginationReactive.page = pageNum
|
paginationReactive.page = pageNum
|
||||||
paginationReactive.pageSize = pageSize
|
paginationReactive.pageSize = pageSize
|
||||||
paginationReactive.itemCount = total
|
paginationReactive.itemCount = total
|
||||||
const count=(paginationReactive.page-1)*paginationReactive.pageSize
|
studentList.value =
|
||||||
studentList.value = list.map((item,i)=>{
|
list.map((item,i)=>{return item;})
|
||||||
if (item.username===''||item.username===null){
|
filteredData.value=studentList.value
|
||||||
item.username='请学生注册'
|
// console.log(res.data)
|
||||||
}
|
|
||||||
return {
|
|
||||||
...item,
|
|
||||||
stId: count + i + 1,
|
|
||||||
};
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
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 onPasswordClass = async (classId)=>{
|
||||||
// const {id} = classId
|
// const {id} = classId
|
||||||
const id=1
|
const id=1
|
||||||
|
|
@ -342,7 +295,7 @@ const onDeleteClass = async (classId)=>{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const search=async ()=>{
|
const search=async ()=>{
|
||||||
queryByPage(1)
|
await queryByPage(paginationReactive.page)
|
||||||
}
|
}
|
||||||
const handleSearchSchool = async (query) => {
|
const handleSearchSchool = async (query) => {
|
||||||
const res = await api.getSchoolByschoolName({
|
const res = await api.getSchoolByschoolName({
|
||||||
|
|
@ -370,16 +323,11 @@ const rowKey = (rowData) => {
|
||||||
}
|
}
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
queryByPage(paginationReactive.page)
|
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>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.two-line-description {
|
.two-line-description {
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,13 @@ import com.example.aes.global.model.RespBean;
|
||||||
import com.example.aes.problem.model.*;
|
import com.example.aes.problem.model.*;
|
||||||
import com.example.aes.problem.model.DataGrid;
|
import com.example.aes.problem.model.DataGrid;
|
||||||
import com.example.aes.problem.service.ProblemServiceI;
|
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 com.example.aes.user.service.ClassesServiceI;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.swing.event.ListDataEvent;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -133,6 +131,9 @@ public class ProblemController {
|
||||||
@PostMapping("/deleteProblem")
|
@PostMapping("/deleteProblem")
|
||||||
public RespBean deleteCourse(@RequestBody PMProblem pmProblem) {
|
public RespBean deleteCourse(@RequestBody PMProblem pmProblem) {
|
||||||
problemServiceI.deleteProblem(pmProblem.getId());
|
problemServiceI.deleteProblem(pmProblem.getId());
|
||||||
|
problemServiceI.deleteScoringStandard(pmProblem.getId());
|
||||||
|
//删除作业时要把发布作业的记录也删除
|
||||||
|
//那么学生提交该作业的记录也要删除
|
||||||
return RespBean.ok("删除成功");
|
return RespBean.ok("删除成功");
|
||||||
}
|
}
|
||||||
@PostMapping("/deleteScoringRubric")
|
@PostMapping("/deleteScoringRubric")
|
||||||
|
|
@ -147,12 +148,19 @@ public class ProblemController {
|
||||||
}
|
}
|
||||||
@PostMapping("/findAllProblemByCourseId")
|
@PostMapping("/findAllProblemByCourseId")
|
||||||
public RespBean findAllProblemByCourseId(@RequestBody PMProblem pmProblem){
|
public RespBean findAllProblemByCourseId(@RequestBody PMProblem pmProblem){
|
||||||
if (pmProblem.getPageNum() < 1 || pmProblem.getPageSize() < 1)
|
// if (pmProblem.getPageNum() < 1 || pmProblem.getPageSize() < 1)
|
||||||
return RespBean.error("参数错误!");
|
// return RespBean.error("参数错误!");
|
||||||
DataGrid dataGrid=
|
DataGrid dataGrid= problemServiceI.findProblemByCourseId(pmProblem);
|
||||||
problemServiceI.findProblemByCourseId(pmProblem);
|
|
||||||
return RespBean.ok("查询作业库成功",dataGrid);
|
return RespBean.ok("查询作业库成功",dataGrid);
|
||||||
|
|
||||||
|
}
|
||||||
|
@PostMapping(
|
||||||
|
"/findAllProblemByCourseIdAndClassId")
|
||||||
|
public RespBean findAllProblemByCourseIdAndClassId(@RequestBody PMProblem pmProblem){
|
||||||
|
DataGrid dataGrid=
|
||||||
|
problemServiceI.findProblemByCourseIdAndClassId(pmProblem);
|
||||||
|
return RespBean.ok("查询作业列表成功",dataGrid);
|
||||||
|
|
||||||
}
|
}
|
||||||
@PostMapping("/findProblemById")
|
@PostMapping("/findProblemById")
|
||||||
public RespBean findProblemById(@RequestBody PMProblem pmProblem){
|
public RespBean findProblemById(@RequestBody PMProblem pmProblem){
|
||||||
|
|
@ -161,6 +169,26 @@ public class ProblemController {
|
||||||
return RespBean.ok("查询作业标题成功",
|
return RespBean.ok("查询作业标题成功",
|
||||||
problems.get(0));
|
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")
|
@PostMapping("/postProblem")
|
||||||
public RespBean postProblem(@RequestBody PMPostProblem pmPostProblem){
|
public RespBean postProblem(@RequestBody PMPostProblem pmPostProblem){
|
||||||
|
|
@ -172,6 +200,15 @@ public class ProblemController {
|
||||||
return RespBean.ok("发布作业成功");
|
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")
|
@GetMapping("/getExamList")
|
||||||
public RespBean getExamList(Integer pageNum,Integer pageSize, HttpServletRequest request) {
|
public RespBean getExamList(Integer pageNum,Integer pageSize, HttpServletRequest request) {
|
||||||
|
|
@ -206,6 +243,18 @@ public class ProblemController {
|
||||||
return RespBean.error("获取作业列表失败!");
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//根据作业id和学生id获取学生当前报告成绩排名
|
//根据作业id和学生id获取学生当前报告成绩排名
|
||||||
@GetMapping("/getStudentRank")
|
@GetMapping("/getStudentRank")
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,15 @@ import com.example.aes.problem.model.PMPostProblem;
|
||||||
import com.example.aes.problem.model.PostProblem;
|
import com.example.aes.problem.model.PostProblem;
|
||||||
import com.example.aes.user.dao.BaseDaoI;
|
import com.example.aes.user.dao.BaseDaoI;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface PostProblemDaoI extends BaseDaoI<PostProblem> {
|
public interface PostProblemDaoI extends BaseDaoI<PostProblem> {
|
||||||
public void postProblem(PMPostProblem pmPostProblem, Integer classId);
|
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,14 +2,11 @@ package com.example.aes.problem.dao;
|
||||||
|
|
||||||
|
|
||||||
import com.example.aes.problem.model.*;
|
import com.example.aes.problem.model.*;
|
||||||
|
import com.example.aes.problem.model.PMProblem;
|
||||||
|
import com.example.aes.problem.model.Problem;
|
||||||
import com.example.aes.user.dao.BaseDaoI;
|
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.List;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -27,11 +24,14 @@ public interface ProblemDaoI extends BaseDaoI<Problem> {
|
||||||
public List<Problem> findProblemIdByTitle(String title);
|
public List<Problem> findProblemIdByTitle(String title);
|
||||||
public void addProblem(Problem problem);
|
public void addProblem(Problem problem);
|
||||||
public long getAllProblemsNum(int courseId);
|
public long getAllProblemsNum(int courseId);
|
||||||
|
List<Object[]> getProblemsByPage(Integer courseId,
|
||||||
|
Integer classId,String selectedStatus,
|
||||||
|
int page, int rows);
|
||||||
|
|
||||||
List<Problem> getProblemsByPage(Integer courseId,String title,
|
List<Problem> getProblemsByPage(Integer courseId,String title,
|
||||||
int page, int rows);
|
int page, int rows);
|
||||||
public List<Problem> findProblemById(int id);
|
public List<Problem> findProblemById(int id);
|
||||||
public boolean editProblem(String title,
|
public boolean editProblem(String title,
|
||||||
String description,Integer id);
|
String description,Integer id);
|
||||||
public void deleteProblem(Integer id);
|
public void deleteProblem(Integer id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import java.util.List;
|
||||||
public interface ScoringStandardDaoI extends BaseDaoI<ScoringStandard> {
|
public interface ScoringStandardDaoI extends BaseDaoI<ScoringStandard> {
|
||||||
public void addScoringStandard(PMScoringStandard pmScoringStandard);
|
public void addScoringStandard(PMScoringStandard pmScoringStandard);
|
||||||
public List<ScoringStandard> getStandardIdNoProblemId();
|
public List<ScoringStandard> getStandardIdNoProblemId();
|
||||||
|
public List<ScoringStandard> getStandardIdByProblemId(Integer problemId);
|
||||||
public List<ScoringStandard> getStandardIdNoProblemIdDesc();
|
public List<ScoringStandard> getStandardIdNoProblemIdDesc();
|
||||||
public void updateProblemId(int problemId);
|
public void updateProblemId(int problemId);
|
||||||
public List<ScoringStandard> getStandardByProblemId(Integer problemId);
|
public List<ScoringStandard> getStandardByProblemId(Integer problemId);
|
||||||
|
|
|
||||||
|
|
@ -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.PMPostProblem;
|
||||||
import com.example.aes.problem.model.PostProblem;
|
import com.example.aes.problem.model.PostProblem;
|
||||||
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
||||||
|
import org.hibernate.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Repository("PostProblemDao")
|
@Repository("PostProblemDao")
|
||||||
public class PostProblemDaoImpl extends BaseDaoImpl<PostProblem> implements PostProblemDaoI {
|
public class PostProblemDaoImpl extends BaseDaoImpl<PostProblem> implements PostProblemDaoI {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -21,4 +26,38 @@ public class PostProblemDaoImpl extends BaseDaoImpl<PostProblem> implements Post
|
||||||
else postProblem.setAllow(0);
|
else postProblem.setAllow(0);
|
||||||
this.save(postProblem);
|
this.save(postProblem);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public long getPostProblemNum(int courseId,
|
||||||
|
int classId){
|
||||||
|
String hql = "select count(*) from " +
|
||||||
|
"PostProblem where classId="+classId+" and problemId in (select id from Problem where courseId="+courseId+")";
|
||||||
|
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,21 +1,19 @@
|
||||||
package com.example.aes.problem.dao.impl;
|
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.dao.ProblemDaoI;
|
||||||
|
import com.example.aes.problem.model.PMProblem;
|
||||||
|
import com.example.aes.problem.model.Problem;
|
||||||
import com.example.aes.problem.model.*;
|
import com.example.aes.problem.model.*;
|
||||||
import com.example.aes.problem.model.ReportSubmitted;
|
import com.example.aes.problem.model.ReportSubmitted;
|
||||||
import com.example.aes.user.dao.BaseDaoI;
|
import com.example.aes.user.dao.BaseDaoI;
|
||||||
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
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.Query;
|
||||||
|
import org.hibernate.Session;
|
||||||
import com.ibm.jvm.trace.format.api.TraceContext;
|
import com.ibm.jvm.trace.format.api.TraceContext;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.security.core.parameters.P;
|
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -159,6 +157,7 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
||||||
this.find(hql,page,rows);
|
this.find(hql,page,rows);
|
||||||
return problemList;
|
return problemList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Problem> findProblemById(int id){
|
public List<Problem> findProblemById(int id){
|
||||||
String hql="from Problem where id="+id;
|
String hql="from Problem where id="+id;
|
||||||
|
|
@ -187,6 +186,7 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
||||||
long count=this.count(hql);
|
long count=this.count(hql);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean editProblem(String title,
|
public boolean editProblem(String title,
|
||||||
String description,Integer id){
|
String description,Integer id){
|
||||||
|
|
@ -204,4 +204,77 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<Object[]> getProblemsByPage(Integer courseId, Integer classId,String selectedStatus,
|
||||||
|
int page,
|
||||||
|
int rows){
|
||||||
|
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 " +
|
||||||
|
"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 "+
|
||||||
|
"AND NOW() < pp.startTime " +
|
||||||
|
"GROUP BY p.id, p.title, pp" +
|
||||||
|
".startTime, pp.endTime";
|
||||||
|
|
||||||
|
} 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 " +
|
||||||
|
"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 "+
|
||||||
|
"AND NOW() >= pp.startTime " +
|
||||||
|
"and NOW()<=pp.endTime " +
|
||||||
|
"GROUP BY p.id, p.title, pp" +
|
||||||
|
".startTime, pp.endTime";
|
||||||
|
}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 " +
|
||||||
|
"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 "+
|
||||||
|
"AND NOW() > endTime " +
|
||||||
|
"GROUP BY p.id, p.title, pp" +
|
||||||
|
".startTime, pp.endTime";
|
||||||
|
}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);
|
||||||
|
|
||||||
|
// 设置分页
|
||||||
|
query.setFirstResult((page - 1) * rows); // 计算起始行
|
||||||
|
query.setMaxResults(rows); // 设置每页行数
|
||||||
|
|
||||||
|
return query.getResultList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,13 @@ public class ScoringStandardDaoImpl extends BaseDaoImpl<ScoringStandard> impleme
|
||||||
return this.find(sql);
|
return this.find(sql);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
public List<ScoringStandard> getStandardIdByProblemId(Integer problemId){
|
||||||
|
String sql="from " +
|
||||||
|
"ScoringStandard where " +
|
||||||
|
"problemId="+problemId;
|
||||||
|
return this.find(sql);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public List<ScoringStandard> getStandardByProblemId(Integer problemId){
|
public List<ScoringStandard> getStandardByProblemId(Integer problemId){
|
||||||
String sql="from " +
|
String sql="from " +
|
||||||
"ScoringStandard where " +
|
"ScoringStandard where " +
|
||||||
|
|
|
||||||
|
|
@ -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{
|
public class PMPostProblem{
|
||||||
private int id;
|
private int id;
|
||||||
private int adminuserId;
|
private int adminuserId;
|
||||||
|
private int problemId;
|
||||||
|
private int classId;
|
||||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime startTime;
|
private LocalDateTime startTime;
|
||||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|
@ -25,17 +26,21 @@ public class PMProblem extends Problem implements java.io.Serializable{//继承P
|
||||||
|
|
||||||
|
|
||||||
// (作业列表)页面上其他需要的属性
|
// (作业列表)页面上其他需要的属性
|
||||||
private Date startTime;//开始时间,来自postproblem
|
|
||||||
private Date endTime;//结束时间
|
|
||||||
private String submissionStatus;//提交状态,来自submitproblem
|
private String submissionStatus;//提交状态,来自submitproblem
|
||||||
|
private LocalDateTime startTime;//开始时间,来自postproblem
|
||||||
|
private LocalDateTime endTime;//结束时间
|
||||||
|
private String submissonStatus;//提交状态,来自submitproblem
|
||||||
private String plagiarismStatus;//查重状态
|
private String plagiarismStatus;//查重状态
|
||||||
private Float score;//最终分数
|
private float score;//最终分数
|
||||||
private String status;//最后在页面显示的状态,取决于上面三个参数。
|
private String status;//最后在页面显示的状态,取决于上面三个参数。
|
||||||
|
private long daipi;
|
||||||
|
private long yijiao;
|
||||||
|
private long weijiao;
|
||||||
|
private String timeRange;
|
||||||
|
private String selectedStatus;
|
||||||
//(作业列表)页面需要的后台数据
|
//(作业列表)页面需要的后台数据
|
||||||
private Integer studentId;//学生id
|
private int studentId;//学生id
|
||||||
private int classId;//班级id
|
private int classId;//班级id
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.example.aes.problem.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
@Table(name = "submitreport",catalog = "aes")
|
||||||
|
public class SubmitReport {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id", unique = true, nullable = false)
|
||||||
|
private Integer id;
|
||||||
|
@Column(name = "problemId")
|
||||||
|
private int problemId;
|
||||||
|
@Column(name = "adminuserId")
|
||||||
|
private int adminuserId;
|
||||||
|
@Column(name = "studentId")
|
||||||
|
private int studentId;
|
||||||
|
@Column(name = "readTime")
|
||||||
|
private LocalDateTime readTime;
|
||||||
|
@Column(name = "submissionTime")
|
||||||
|
private LocalDateTime submissionTime;
|
||||||
|
@Column(name = "submissionStatus")
|
||||||
|
private String submissionStatus;
|
||||||
|
@Column(name = "plagiarismStatus")
|
||||||
|
private String plagiarismStatus;
|
||||||
|
@Column(name = "attachment")
|
||||||
|
private String attachment;
|
||||||
|
@Column(name = "autoscore")
|
||||||
|
private Float autoscore;
|
||||||
|
@Column(name = "autocomment")
|
||||||
|
private String autocomment;
|
||||||
|
@Column(name = "score")
|
||||||
|
private Float score;
|
||||||
|
@Column(name = "comment")
|
||||||
|
private String comment;
|
||||||
|
@Column(name = "addTime")
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
package com.example.aes.problem.service.Impl;
|
package com.example.aes.problem.service.Impl;
|
||||||
|
|
||||||
import com.example.aes.problem.dao.PostProblemDaoI;
|
import com.example.aes.problem.dao.*;
|
||||||
import com.example.aes.problem.dao.ProblemDaoI;
|
|
||||||
import com.example.aes.problem.dao.ScoringRubricDaoI;
|
|
||||||
import com.example.aes.problem.dao.ScoringStandardDaoI;
|
|
||||||
import com.example.aes.problem.model.*;
|
import com.example.aes.problem.model.*;
|
||||||
import com.example.aes.problem.model.*;
|
import com.example.aes.problem.model.*;
|
||||||
import com.example.aes.problem.service.ProblemServiceI;
|
import com.example.aes.problem.service.ProblemServiceI;
|
||||||
import com.example.aes.user.dao.AdminusersDaoI;
|
import com.example.aes.user.dao.AdminusersDaoI;
|
||||||
|
import com.example.aes.user.dao.ClassesDaoI;
|
||||||
|
import com.example.aes.user.model.DataGrid;
|
||||||
import com.example.aes.user.model.Classstudents;
|
import com.example.aes.user.model.Classstudents;
|
||||||
import com.example.aes.user.model.Course;
|
import com.example.aes.user.model.Course;
|
||||||
import com.example.aes.user.model.PMCourse;
|
import com.example.aes.user.model.PMCourse;
|
||||||
|
|
@ -15,6 +14,7 @@ import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -27,8 +27,14 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
private ProblemDaoI problemDao;
|
private ProblemDaoI problemDao;
|
||||||
private ScoringRubricDaoI scoringRubricDao;
|
private ScoringRubricDaoI scoringRubricDao;
|
||||||
private ScoringStandardDaoI scoringStandardDao;
|
private ScoringStandardDaoI scoringStandardDao;
|
||||||
|
private SubmitReportDaoI studentSubmitDao;
|
||||||
private AdminusersDaoI adminusersDao;
|
private AdminusersDaoI adminusersDao;
|
||||||
private PostProblemDaoI postProblemDao;
|
private PostProblemDaoI postProblemDao;
|
||||||
|
private ClassesDaoI classesDao;
|
||||||
|
@Autowired
|
||||||
|
public void setClassesDao(ClassesDaoI classesDao) {
|
||||||
|
this.classesDao = classesDao;
|
||||||
|
}
|
||||||
@Autowired
|
@Autowired
|
||||||
public void setPostProblemDao(PostProblemDaoI postProblemDao) {
|
public void setPostProblemDao(PostProblemDaoI postProblemDao) {
|
||||||
this.postProblemDao = postProblemDao;
|
this.postProblemDao = postProblemDao;
|
||||||
|
|
@ -80,7 +86,8 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
return uScoringRubricList;
|
return uScoringRubricList;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataGrid dataGrid(List<PMProblem> pMproblems, PMProblem pMproblem) {
|
public DataGrid dataGrid(List<PMProblem> pMproblems, PMProblem pMproblem) {
|
||||||
|
|
@ -176,9 +183,7 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ScoringStandard> findStandardIdNoProblemId(){
|
public List<ScoringStandard> findStandardIdNoProblemId(){
|
||||||
List<ScoringStandard> scoringStandardList=scoringStandardDao.getStandardIdNoProblemIdDesc();
|
return scoringStandardDao.getStandardIdNoProblemIdDesc();
|
||||||
|
|
||||||
return scoringStandardList;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -249,6 +254,18 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
public void deleteScoringStandard(Integer problemId){
|
||||||
|
//先找出无problemid的standrd的list
|
||||||
|
List<ScoringStandard> scoringStandardList=scoringStandardDao.getStandardIdByProblemId(problemId);
|
||||||
|
//再根据standardid删掉rubric
|
||||||
|
for(ScoringStandard scoringStandard:scoringStandardList){
|
||||||
|
scoringRubricDao.deleteScoringRubricByStandrdId(scoringStandard.getId());
|
||||||
|
//最后删掉无problemid的standrd
|
||||||
|
scoringStandardDao.delete(scoringStandard);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public String findProblemByTitle(String title){
|
public String findProblemByTitle(String title){
|
||||||
return problemDao.findProblemByTitle(title);
|
return problemDao.findProblemByTitle(title);
|
||||||
}
|
}
|
||||||
|
|
@ -292,6 +309,40 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
dg.setPageNum(pmProblem.getPageNum());
|
dg.setPageNum(pmProblem.getPageNum());
|
||||||
// // 设置当前页的数据行数量
|
// // 设置当前页的数据行数量
|
||||||
dg.setCurrentPageLineNum(pmProblems.size());
|
dg.setCurrentPageLineNum(pmProblems.size());
|
||||||
|
// // 设置当前页的所有数据行
|
||||||
|
dg.setList(pmProblems);
|
||||||
|
return dg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public DataGrid findProblemByCourseIdAndClassId(PMProblem pmProblem){
|
||||||
|
DataGrid dg = new DataGrid();
|
||||||
|
int totalLines;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
if (theProblemList== null) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
List<PMProblem> pmProblems=new ArrayList<>();
|
||||||
|
changeModel3(pmProblems,
|
||||||
|
theProblemList,studentNum);
|
||||||
|
dg.setTotal(totalLines);
|
||||||
|
dg.setPageSize(pmProblem.getPageSize());
|
||||||
|
dg.setTotalPages((long) (Math.ceil((double) dg.getTotal() / (double) dg.getPageSize())));
|
||||||
|
// // 设置当前显示第几页
|
||||||
|
dg.setPageNum(pmProblem.getPageNum());
|
||||||
|
// // 设置当前页的数据行数量
|
||||||
|
dg.setCurrentPageLineNum(pmProblems.size());
|
||||||
// // 设置当前页的所有数据行
|
// // 设置当前页的所有数据行
|
||||||
dg.setList(pmProblems);
|
dg.setList(pmProblems);
|
||||||
return dg;
|
return dg;
|
||||||
|
|
@ -304,6 +355,98 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
return problems;
|
return problems;
|
||||||
}
|
}
|
||||||
@Override
|
@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){
|
public void postProblem(PMPostProblem pmPostProblem, Integer classId){
|
||||||
postProblemDao.postProblem(pmPostProblem,classId);
|
postProblemDao.postProblem(pmPostProblem,classId);
|
||||||
}
|
}
|
||||||
|
|
@ -341,6 +484,67 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
pmProblem.setTitle(problem.getTitle());
|
pmProblem.setTitle(problem.getTitle());
|
||||||
pmProblem.setDescription(problem.getDescription());
|
pmProblem.setDescription(problem.getDescription());
|
||||||
pmp.add(pmProblem);
|
pmp.add(pmProblem);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void changeModel3(List<PMProblem> pmp,
|
||||||
|
List<Object[]> pmp2,int studentNum) {
|
||||||
|
if (pmp2 != null && pmp2.size() > 0) {
|
||||||
|
for (Object[] p2 : pmp2) {
|
||||||
|
PMProblem pmProblem=new PMProblem();
|
||||||
|
pmProblem.setId((int)p2[0]);
|
||||||
|
pmProblem.setTitle((String) p2[1]);
|
||||||
|
pmProblem.setStartTime((LocalDateTime) p2[2]);
|
||||||
|
pmProblem.setEndTime((LocalDateTime) p2[3]);
|
||||||
|
pmProblem.setDaipi((Long) p2[4]);
|
||||||
|
pmProblem.setYijiao((Long) p2[5]);
|
||||||
|
// pmProblem.setWeijiao((Long) p2[6]);
|
||||||
|
pmProblem.setWeijiao(studentNum-(Long)p2[5]);
|
||||||
|
String timeRange=
|
||||||
|
pmProblem.getStartTime()+"~"+pmProblem.getEndTime();
|
||||||
|
pmProblem.setTimeRange(timeRange.replace("T", " "));
|
||||||
|
pmp.add(pmProblem);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
|
||||||
|
PMProblem pmProblem=new PMProblem();
|
||||||
|
pmProblem.setId(problem.getId());
|
||||||
|
pmProblem.setCourseId(problem.getCourseId());
|
||||||
|
pmProblem.setAdminuserId(problem.getAdminuserId());
|
||||||
|
pmProblem.setTeacherName(adminusersDao.findTeacherNameByTeacherId(problem.getAdminuserId()));
|
||||||
|
pmProblem.setTitle(problem.getTitle());
|
||||||
|
pmProblem.setDescription(problem.getDescription());
|
||||||
|
pmp.add(pmProblem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import com.example.aes.problem.model.DataGrid;
|
||||||
import com.example.aes.user.model.*;
|
import com.example.aes.user.model.*;
|
||||||
|
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface ProblemServiceI {
|
public interface ProblemServiceI {
|
||||||
|
|
@ -29,7 +30,9 @@ public interface ProblemServiceI {
|
||||||
public void updateProblemId(int problemId);
|
public void updateProblemId(int problemId);
|
||||||
public void deleteScoringRubric();
|
public void deleteScoringRubric();
|
||||||
public void deleteScoringStandard();
|
public void deleteScoringStandard();
|
||||||
|
public void deleteScoringStandard(Integer problemId);
|
||||||
public DataGrid findProblemByCourseId(PMProblem pmProblem);
|
public DataGrid findProblemByCourseId(PMProblem pmProblem);
|
||||||
|
public DataGrid findProblemByCourseIdAndClassId(PMProblem pmProblem);
|
||||||
public List<Problem> findProblemById(int id);
|
public List<Problem> findProblemById(int id);
|
||||||
public void postProblem(PMPostProblem pmPostProblem, Integer classId);
|
public void postProblem(PMPostProblem pmPostProblem, Integer classId);
|
||||||
public void deleteProblem(Integer id);
|
public void deleteProblem(Integer id);
|
||||||
|
|
@ -39,4 +42,10 @@ public interface ProblemServiceI {
|
||||||
public void findStatusByStudentIdAndProblems(Integer studentId, List<PMProblem> pMproblems);
|
public void findStatusByStudentIdAndProblems(Integer studentId, List<PMProblem> pMproblems);
|
||||||
|
|
||||||
UReportSubmitted findScoreAndRankByIds(int ProblemId, int userId);
|
UReportSubmitted findScoreAndRankByIds(int ProblemId, int userId);
|
||||||
|
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 org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,7 @@ package com.example.aes.user.dao;
|
||||||
import com.example.aes.user.model.*;
|
import com.example.aes.user.model.*;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public interface ClassesDaoI extends BaseDaoI<Classes> {
|
public interface ClassesDaoI extends BaseDaoI<Classes> {
|
||||||
|
|
||||||
|
|
@ -48,4 +46,5 @@ public interface ClassesDaoI extends BaseDaoI<Classes> {
|
||||||
String className, int teacherId);
|
String className, int teacherId);
|
||||||
public List<Classstudents>findClassIdByStudentId(int studentId);//根据班级id查找学生id
|
public List<Classstudents>findClassIdByStudentId(int studentId);//根据班级id查找学生id
|
||||||
public List<Classes> findClassByCourseId(int courseId);
|
public List<Classes> findClassByCourseId(int courseId);
|
||||||
|
public List<Classes> findClassById(int classId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,21 +11,12 @@ public interface ClassstudentsDaoI extends BaseDaoI<Classstudents> {
|
||||||
|
|
||||||
public boolean findClassStudentByUserId(int userId, int classId); // 查看该同学是否已在该课程中
|
public boolean findClassStudentByUserId(int userId, int classId); // 查看该同学是否已在该课程中
|
||||||
|
|
||||||
boolean findClassInviteCode(String inviteCode);
|
|
||||||
|
|
||||||
public int getClassStudentsNum(int classId); // 获取班级的学生人数
|
public int getClassStudentsNum(int classId); // 获取班级的学生人数
|
||||||
|
|
||||||
public List<Classstudents> getClassStudentsByExamId(int examId, boolean history); // 获取考试的学生
|
|
||||||
|
|
||||||
public List<Classstudents> getClassStudentsByClassId(int classId);
|
public List<Classstudents> getClassStudentsByClassId(int classId);
|
||||||
|
|
||||||
public boolean findClassesByUserId(int userId);
|
public boolean findClassesByUserId(int userId);
|
||||||
|
|
||||||
public List<Classstudents> getClassStudentsByExamId(Integer examId);
|
|
||||||
|
|
||||||
public long addClassStudent(Classstudents classstudent);
|
|
||||||
|
|
||||||
public void deleteClassStudent(int classId, int userId);
|
|
||||||
|
|
||||||
public void deleteClassStudent(int id);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,11 @@ package com.example.aes.user.dao.impl;
|
||||||
|
|
||||||
import com.example.aes.user.dao.*;
|
import com.example.aes.user.dao.*;
|
||||||
import com.example.aes.user.model.*;
|
import com.example.aes.user.model.*;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Repository("classesDao")
|
@Repository("classesDao")
|
||||||
|
|
@ -570,6 +568,12 @@ public class ClassesDaoImpl extends BaseDaoImpl<Classes> implements ClassesDaoI
|
||||||
"courseId="+courseId;
|
"courseId="+courseId;
|
||||||
return this.find(hql);
|
return this.find(hql);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<Classes> findClassById(int classId){
|
||||||
|
String hql = "from Classes where " +
|
||||||
|
"id="+classId;
|
||||||
|
return this.find(hql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,15 +45,6 @@ public class ClassstudentsDaoImpl extends BaseDaoImpl<Classstudents> implements
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean findClassInviteCode(String inviteCode){
|
|
||||||
String hql = "from Classstudents where inviteCode=" + inviteCode;
|
|
||||||
List<Classstudents> classstudents = this.find(hql);
|
|
||||||
if(classstudents.size()>0)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getClassStudentsNum(int classId) { // 获取班级学生的总数
|
public int getClassStudentsNum(int classId) { // 获取班级学生的总数
|
||||||
|
|
@ -64,21 +55,7 @@ public class ClassstudentsDaoImpl extends BaseDaoImpl<Classstudents> implements
|
||||||
return countInt(hql, params);
|
return countInt(hql, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Classstudents> getClassStudentsByExamId(int examId, boolean history) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
String hql = "";
|
|
||||||
if(history){
|
|
||||||
hql = "from Classstudents c where c.classId in (select e.classId from Examclasses_his e where examId="
|
|
||||||
+ examId + ")";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
hql = "from Classstudents c where c.classId in (select e.classId from Examclasses e where examId="
|
|
||||||
+ examId + ")";
|
|
||||||
}
|
|
||||||
List<Classstudents> classstudents = this.find(hql);
|
|
||||||
return classstudents;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Classstudents> getClassStudentsByClassId(int classId) {
|
public List<Classstudents> getClassStudentsByClassId(int classId) {
|
||||||
|
|
@ -88,32 +65,5 @@ public class ClassstudentsDaoImpl extends BaseDaoImpl<Classstudents> implements
|
||||||
return classstudents;
|
return classstudents;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Classstudents> getClassStudentsByExamId(Integer examId) {
|
|
||||||
String hql = "FROM Classstudents WHERE classId IN (SELECT classId FROM Examclasses WHERE examId = :examId)";
|
|
||||||
Map<String, Object> params = new HashMap<>();
|
|
||||||
params.put("examId", examId);
|
|
||||||
return this.find(hql, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long addClassStudent(Classstudents classstudent) {
|
|
||||||
this.save(classstudent);
|
|
||||||
return classstudent.getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteClassStudent(int classId, int userId) {
|
|
||||||
// 删除考试对应的班级数据
|
|
||||||
String hql = "delete from Classstudents where classId=" + classId
|
|
||||||
+ " and userId=" + userId;
|
|
||||||
this.executeHql(hql);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteClassStudent(int id) {
|
|
||||||
// 删除考试对应的班级数据
|
|
||||||
String hql = "delete from Classstudents where id=" + id;
|
|
||||||
this.executeHql(hql);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,64 +1,24 @@
|
||||||
package com.example.aes.user.model;
|
package com.example.aes.user.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classstudents entity. @author MyEclipse Persistence Tools
|
* Classstudents entity. @author MyEclipse Persistence Tools
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "studentclass")
|
@Table(name = "studentclass",catalog = "aes")
|
||||||
public class Classstudents implements java.io.Serializable {
|
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
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "id", unique = true, nullable = false)
|
@Column(name = "id", unique = true, nullable = false)
|
||||||
public Integer getId() {
|
private Integer id;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@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 com.example.aes.user.model.*;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface ClassesServiceI {
|
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.dao.ClassstudentsDaoI;
|
||||||
import com.example.aes.user.model.*;
|
import com.example.aes.user.model.*;
|
||||||
import com.example.aes.user.service.ClassesServiceI;
|
import com.example.aes.user.service.ClassesServiceI;
|
||||||
import org.hibernate.Query;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue