Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # 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/service/Impl/ProblemServiceImpl.java
This commit is contained in:
commit
e3722fa5b7
|
|
@ -70,6 +70,14 @@ export default {
|
|||
addClassAssistant: (data) => request.post('/assistantClass/addClassAssistant', data),
|
||||
getAssistantNotBelongClass: (data) =>
|
||||
request.post('/adminusers/getAssistantNotBelongClass', data),
|
||||
AddScoringRubric: (data) => request.post('/problem/addScoringRubric', data),
|
||||
findScoringRubricNoStandardId:(data)=>request.post('/problem/findScoringRubricNoStandardId',data)
|
||||
addScoringRubric: (data) => request.post('/problem/addScoringRubric', data),
|
||||
findScoringRubricNoStandardId:(data)=>request.post('/problem/findScoringRubricNoStandardId',data),
|
||||
addScoringStandard: (data) => request.post('/problem/addScoringStandard', data),
|
||||
findScoringStandardNoProblemId: (data) => request.post('/problem/findScoringStandardNoProblemId', data),
|
||||
addProblem:(data) => request.post('/problem/addProblem', data),
|
||||
findClassById: (data) => request.post('/classes/findClassById', data),
|
||||
editClassMessage: (data) => request.post('/classes/editClassMessage', data),
|
||||
deleteScoringRubric:(data)=>request.post('/problem/deleteScoringRubric',data),
|
||||
deleteScoringStandard:(data)=>request.post('/problem/deleteScoringStandard',data),
|
||||
findAllProblemByCourseId:(data)=>request.post('/problem/findAllProblemByCourseId',data),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,8 +272,7 @@ const onAssistantClass = async (classid)=>{
|
|||
await router.push({name: 'AdminClassAssistant', params: {clId: id}})
|
||||
}
|
||||
const onEditClass = async (classid)=>{
|
||||
// const {id} = classid
|
||||
const id=1
|
||||
const {id} = classid
|
||||
await router.push({name: 'AdminClassEdit', params: {clId: id}})
|
||||
}
|
||||
const search=async ()=>{
|
||||
|
|
|
|||
|
|
@ -175,8 +175,10 @@ const onAddProblem= async (courseId)=>{
|
|||
'AdminProblemAdd', query: { courseId: id
|
||||
} })
|
||||
}
|
||||
const onProblemStore= ()=>{
|
||||
router.push({name: 'AdminProblemStore'})
|
||||
const onProblemStore=async (courseId)=>{
|
||||
const { id } = courseId
|
||||
await router.push({name: 'AdminProblemStore',
|
||||
query: { courseId: id}})
|
||||
}
|
||||
const rowKey = (rowData) => {
|
||||
return rowData.id
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ const onAssistantClass = async (classId)=>{
|
|||
|
||||
const queryByPage1 = async (query) => {
|
||||
const res = await api.findAllTeacher({
|
||||
// schoolId: query,
|
||||
schoolId: query,
|
||||
})
|
||||
const transformedData = res.data.map((item) => ({
|
||||
label: item.name,
|
||||
|
|
|
|||
|
|
@ -42,6 +42,15 @@ const loading = ref(true)
|
|||
const ScoringRubricList =
|
||||
ref([])
|
||||
const role=userStore.getRole()
|
||||
const paginationReactive = reactive({
|
||||
page: 1,
|
||||
pageSize: 50,
|
||||
showSizePicker: true,
|
||||
pageSizes: [50, 100,150],
|
||||
prefix ({ itemCount }) {
|
||||
return `总共 ${itemCount} 条`
|
||||
}
|
||||
})
|
||||
let columns = [
|
||||
{
|
||||
key: 'range',
|
||||
|
|
@ -110,7 +119,7 @@ watch(
|
|||
()=>{
|
||||
if
|
||||
(router.currentRoute.value.fullPath==='/admin/problem/problem-scoring-standard') {
|
||||
queryByPage()
|
||||
queryByPage(paginationReactive.page)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2,27 +2,24 @@
|
|||
<n-scrollbar x-scrollable style="max-height: 100vh">
|
||||
<CommonPage show-footer>
|
||||
<div style="margin-top: 0px">
|
||||
<n-form ref="ProblemInfoRef"
|
||||
:model="ProblemInfoValue"
|
||||
:rules="rules"
|
||||
label-placement="left"
|
||||
size="small"
|
||||
:label-width="60" >
|
||||
</n-form>
|
||||
<!-- <n-form ref="ProblemInfoRef"-->
|
||||
<!-- :model="ScoringStandardInfoValue"-->
|
||||
<!-- :rules="rules"-->
|
||||
<!-- label-placement="left"-->
|
||||
<!-- size="small"-->
|
||||
<!-- :label-width="60" >-->
|
||||
<!-- </n-form>-->
|
||||
</div>
|
||||
<n-data-table
|
||||
remote
|
||||
:single-line="false"
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:data="ProblemList"
|
||||
:data="ScoringStandardList"
|
||||
:loading="loading"
|
||||
:pagination="paginationReactive"
|
||||
:row-key="rowKey"
|
||||
:scroll-x="900"
|
||||
style="width: 1180px;--n-td-padding:0px 5px;"
|
||||
@update:page="onChangePage"
|
||||
@update:page-size="onUpdatePageSize"
|
||||
/>
|
||||
|
||||
</CommonPage>
|
||||
|
|
@ -56,12 +53,11 @@ const paginationReactive = reactive({
|
|||
return `总共 ${itemCount} 条`
|
||||
}
|
||||
})
|
||||
const ProblemInfoValue = ref({
|
||||
pageNum:paginationReactive.page,
|
||||
pageSize:paginationReactive.pageSize,
|
||||
id:0,
|
||||
teacherId:'',
|
||||
});
|
||||
const ScoringStandardInfoValue = ref({
|
||||
|
||||
|
||||
})
|
||||
const ScoringStandardList=ref([])
|
||||
const queryByPage1=async (value)=>{
|
||||
if (userStore.getRole().some((r) => r === 'admin')) {
|
||||
const res = await api.findAllAdminusersBySchoolId({
|
||||
|
|
@ -75,19 +71,19 @@ const queryByPage1=async (value)=>{
|
|||
label: '全部',
|
||||
value: 0,
|
||||
})
|
||||
ProblemInfoValue.value.teacherId = 0
|
||||
ScoringStandardInfoValue.value.teacherId = 0
|
||||
options1.value = transformedData
|
||||
}
|
||||
}
|
||||
watch(()=>ProblemInfoValue.value.id,
|
||||
watch(()=>ScoringStandardInfoValue.value.id,
|
||||
(newVal)=>{
|
||||
ProblemInfoValue.value.teacherId=''
|
||||
ScoringStandardInfoValue.value.teacherId=''
|
||||
options1.value=[]
|
||||
queryByPage1(newVal)
|
||||
})
|
||||
let columns = [
|
||||
{
|
||||
key: 'demension',
|
||||
key: 'dimension',
|
||||
title: '维度',
|
||||
width: '50',
|
||||
align:'center'
|
||||
|
|
@ -99,7 +95,7 @@ let columns = [
|
|||
align:'center'
|
||||
},
|
||||
{
|
||||
key: 'rubics',
|
||||
key: 'rubrics',
|
||||
title: '评分细则',
|
||||
width: '300',
|
||||
}
|
||||
|
|
@ -108,32 +104,8 @@ let columns = [
|
|||
const queryByPage = async (currentPage)=>{
|
||||
loading.value = true;
|
||||
try {
|
||||
ProblemInfoValue.value.pageSize=paginationReactive.pageSize
|
||||
const res = await api.findAllProblemPage(
|
||||
{
|
||||
...ProblemInfoValue.value
|
||||
}
|
||||
);
|
||||
console.log(res.data)
|
||||
if (userStore.getRole().some((r) => r === 'admin')){
|
||||
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;
|
||||
}
|
||||
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.findScoringStandardNoProblemId({})
|
||||
ScoringStandardList.value=res.data
|
||||
} catch (err) {
|
||||
} finally {
|
||||
loading.value = false;
|
||||
|
|
@ -165,7 +137,7 @@ const onUpdatePageSize = (pageSize) => {
|
|||
}
|
||||
const onChangePage = (page) => {
|
||||
paginationReactive.page = page;
|
||||
ProblemInfoValue.value.pageNum=page
|
||||
ScoringStandardInfoValue.value.pageNum=page
|
||||
if (!loading.value) {
|
||||
queryByPage(page)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {useRouter} from "vue-router";
|
||||
import {ref} from "vue";
|
||||
import api from "@/api/admin";
|
||||
import { useTagsStore } from '@/store'
|
||||
|
|
@ -58,38 +57,48 @@ import StandardsList
|
|||
from '@/views/admin/problem/components/StandardList.vue'
|
||||
import RichTextEditor
|
||||
from '@/components/common/RichTextEditor.vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
const tagsStore = useTagsStore()
|
||||
const path=ref('')
|
||||
const router = useRouter()
|
||||
const rules=ref(null)
|
||||
const route = useRoute()
|
||||
const { courseId, history } = route.query
|
||||
const problemInfoValue = ref({
|
||||
name: ''
|
||||
title: "",
|
||||
description:"",
|
||||
courseId:courseId
|
||||
});
|
||||
const problemInfoRef = ref(null)
|
||||
const descEditorHeight = ref('160px')
|
||||
|
||||
const cancel = ()=>{
|
||||
const cancel = async () => {
|
||||
await api.deleteScoringStandard({})
|
||||
tagsStore.removeTag(path.value)
|
||||
router.push({path: 'problem-list'})
|
||||
}
|
||||
const onAdd = ()=>{
|
||||
router.push({name: 'AdminProblemScoringStandard'})
|
||||
router.push({name:
|
||||
'AdminProblemScoringStandard',query:{courseId:courseId}})
|
||||
}
|
||||
const submit =async ()=>{
|
||||
if(problemInfoValue.value.name!==''){
|
||||
const submit =async ()=> {
|
||||
if (problemInfoValue.value.title !== '' && problemInfoValue.value.description !== '') {
|
||||
try {
|
||||
await api.Addproblem({
|
||||
...problemInfoValue.value
|
||||
|
||||
await api.addProblem({
|
||||
...problemInfoValue.value,
|
||||
courseId:courseId
|
||||
})
|
||||
$message.success("添加课程成功")
|
||||
$message.success("添加作业成功")
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemList'})
|
||||
// await router.push({ name: 'AdminProblemList' })
|
||||
} catch (err) {
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemList'})
|
||||
// await router.push({ name: 'AdminProblemList' })
|
||||
}
|
||||
}else {
|
||||
} else if (problemInfoValue.value.title == "") {
|
||||
$message.error("作业名称不能为空")
|
||||
} else{
|
||||
$message.error("题目描述不能为空")
|
||||
}
|
||||
}
|
||||
onMounted(()=>{
|
||||
|
|
|
|||
|
|
@ -58,10 +58,12 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {useRouter} from "vue-router";
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import {ref} from "vue";
|
||||
import api from "@/api/admin";
|
||||
import { useTagsStore } from '@/store'
|
||||
const route = useRoute()
|
||||
const { courseId, history } = route.query
|
||||
import RichTextEditor
|
||||
from '@/components/common/RichTextEditor.vue'
|
||||
import { once } from '@/utils'
|
||||
|
|
@ -81,23 +83,20 @@ const handleDescEditorFocus = once(() => {
|
|||
})
|
||||
const cancel = ()=>{
|
||||
tagsStore.removeTag(path.value)
|
||||
router.push({path: 'problem-scoring-standard'})
|
||||
}
|
||||
const onAdd = ()=>{
|
||||
router.push({name: 'AdminProblemScoringRubric'})
|
||||
router.push({path: 'problem-scoring-standard',query:{courseId:courseId}})
|
||||
}
|
||||
const submit =async ()=>{
|
||||
if(problemInfoValue.value.lowerLimit!==''&&problemInfoValue.value.upperLimit!==''&&problemInfoValue.value.description!==''){
|
||||
try {
|
||||
await api.AddScoringRubric({
|
||||
await api.addScoringRubric({
|
||||
...problemInfoValue.value
|
||||
})
|
||||
$message.success("添加评分细则成功")
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemScoringStandard'})
|
||||
await router.push({name: 'AdminProblemScoringStandard',query:{courseId:courseId}})
|
||||
} catch (err) {
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemScoringStandard'})
|
||||
await router.push({name: 'AdminProblemScoringStandard',query:{courseId:courseId}})
|
||||
}
|
||||
}else {
|
||||
$message.error("评分细则不能为空")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div>
|
||||
<n-form ref="problemInfoRef"
|
||||
:model="problemInfoValue"
|
||||
:model="ScoringStandardInfoValue"
|
||||
:rules="rules"
|
||||
label-placement="left"style="margin-top: 15px;margin-left: 5%">
|
||||
<div class="flex" style='align-items:
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
path="demension"
|
||||
>
|
||||
<n-input
|
||||
v-model:value="problemInfoValue.demension"
|
||||
v-model:value="ScoringStandardInfoValue.dimension"
|
||||
placeholder="输入维度"
|
||||
style='width: 800px'/>
|
||||
</n-form-item>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
style="margin-left: 30px"
|
||||
>
|
||||
<n-input
|
||||
v-model:value="problemInfoValue.weight"
|
||||
v-model:value="ScoringStandardInfoValue.weight"
|
||||
placeholder="输入权重"
|
||||
style='width: 800px'/>
|
||||
</n-form-item>
|
||||
|
|
@ -51,47 +51,55 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {useRouter} from "vue-router";
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import api from "@/api/admin";
|
||||
import { useTagsStore } from '@/store'
|
||||
import RubricList from
|
||||
'@/views/admin/problem/components/RubricList.vue'
|
||||
import RichTextEditor
|
||||
from '@/components/common/RichTextEditor.vue'
|
||||
const route = useRoute()
|
||||
const { courseId, history } = route.query
|
||||
const tagsStore = useTagsStore()
|
||||
const path=ref('')
|
||||
const router = useRouter()
|
||||
const rules=ref(null)
|
||||
const problemInfoValue = ref({
|
||||
demension:"",
|
||||
weight:"",
|
||||
problemId:''
|
||||
const ScoringStandardInfoValue = ref({
|
||||
dimension:'',
|
||||
weight:'',
|
||||
id:''
|
||||
});
|
||||
const problemInfoRef = ref(null)
|
||||
|
||||
const cancel = ()=>{
|
||||
const cancel = async () => {
|
||||
await api.deleteScoringRubric({})
|
||||
tagsStore.removeTag(path.value)
|
||||
router.push({path: 'problem-add'})
|
||||
await router.push({name:
|
||||
'AdminProblemAdd',query:{courseId:courseId}})
|
||||
}
|
||||
const onAdd = ()=>{
|
||||
router.push({name: 'AdminProblemScoringRubric'})
|
||||
router.push({name:
|
||||
'AdminProblemScoringRubric',query:{courseId:courseId}})
|
||||
}
|
||||
const submit =async ()=>{
|
||||
if(problemInfoValue.value.name!==''){
|
||||
if(ScoringStandardInfoValue.value.dimension!==''&&ScoringStandardInfoValue.value.weight!==''){
|
||||
try {
|
||||
await api.Addproblem({
|
||||
...problemInfoValue.value
|
||||
await api.addScoringStandard({
|
||||
...ScoringStandardInfoValue.value
|
||||
})
|
||||
$message.success("添加课程成功")
|
||||
$message.success("添加评分标准成功")
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemList'})
|
||||
await router.push({name:
|
||||
'AdminProblemAdd', query: {
|
||||
courseId: courseId
|
||||
}})
|
||||
} catch (err) {
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemList'})
|
||||
await router.push({name: 'AdminProblemAdd', query: {
|
||||
courseId: courseId
|
||||
}})
|
||||
}
|
||||
}else {
|
||||
$message.error("作业名称不能为空")
|
||||
$message.error("维度或权重不能为空")
|
||||
}
|
||||
}
|
||||
onMounted(()=>{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
class="flex-item"
|
||||
style="margin-left: -30px">
|
||||
<n-input
|
||||
v-model:value="ProblemInfoValue.ProblemId"
|
||||
v-model:value="ProblemInfoValue.title"
|
||||
style="min-width: 80px" placeholder=""></n-input>
|
||||
</n-form-item>
|
||||
<n-form-item style="margin-left: 20px">
|
||||
|
|
@ -56,9 +56,11 @@ import ProblemActions from
|
|||
'./components/ProblemActions.vue';
|
||||
import {formatDateTime} from '@/utils';
|
||||
import { useUserStore } from '@/store';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import ProblemActions2
|
||||
from '@/views/admin/problem/components/ProblemActions2.vue'
|
||||
import problem
|
||||
from '@/views/user/problem/index.vue'
|
||||
const rules=ref(null)
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
|
|
@ -69,6 +71,8 @@ const ProblemList =
|
|||
const options1=ref([])
|
||||
const role=userStore.getRole()
|
||||
const teacherId=ref()
|
||||
const route = useRoute()
|
||||
const { courseId, history } = route.query
|
||||
const paginationReactive = reactive({
|
||||
page: 1,
|
||||
pageSize: 50,
|
||||
|
|
@ -83,6 +87,7 @@ const ProblemInfoValue = ref({
|
|||
pageSize:paginationReactive.pageSize,
|
||||
id:0,
|
||||
teacherId:'',
|
||||
title:""
|
||||
});
|
||||
const onAdd = ()=>{
|
||||
router.push({name: 'AdminProblemAdd'})
|
||||
|
|
@ -110,9 +115,7 @@ watch(()=>ProblemInfoValue.value.id,
|
|||
options1.value=[]
|
||||
queryByPage1(newVal)
|
||||
})
|
||||
let columns
|
||||
if (role[0]=='admin'){
|
||||
columns = [
|
||||
let columns = [
|
||||
{
|
||||
key: 'title',
|
||||
title: '作业标题',
|
||||
|
|
@ -120,7 +123,7 @@ if (role[0]=='admin'){
|
|||
},
|
||||
|
||||
{
|
||||
key: 'creater',
|
||||
key: 'teacherName',
|
||||
title: '创建者',
|
||||
width: '60',
|
||||
align:'center'
|
||||
|
|
@ -143,93 +146,37 @@ 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(
|
||||
ProblemActions2,
|
||||
{
|
||||
onClickStudent: () => onStudentProblem(row),
|
||||
onClickAssistant: () => onAssistantProblem(row),
|
||||
onClickEdit: () => onEditProblem(row),
|
||||
onClickDelete: () => onDeleteProblem(row),
|
||||
}
|
||||
);
|
||||
}
|
||||
if(role[0]==='assistant'){
|
||||
return h(
|
||||
ProblemActions2,
|
||||
{
|
||||
onClickStudent: () => onStudentProblem(row),
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
const queryByPage = async (currentPage)=>{
|
||||
loading.value = true;
|
||||
ProblemInfoValue.value.pageNum=currentPage
|
||||
ProblemInfoValue.value.pageSize=paginationReactive.pageSize
|
||||
try {
|
||||
ProblemInfoValue.value.pageSize=paginationReactive.pageSize
|
||||
const res = await api.findAllProblemPage(
|
||||
|
||||
const res = await
|
||||
api.findAllProblemByCourseId(
|
||||
{
|
||||
...ProblemInfoValue.value
|
||||
...ProblemInfoValue.value,
|
||||
courseId:courseId
|
||||
}
|
||||
);
|
||||
console.log(res.data)
|
||||
if (userStore.getRole().some((r) => r === 'admin')){
|
||||
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;
|
||||
}
|
||||
const {pageNum, pageSize, total, list} = res.data
|
||||
paginationReactive.page = pageNum
|
||||
paginationReactive.pageSize = pageSize
|
||||
paginationReactive.itemCount = total
|
||||
ProblemList.value=list.map((item,i)=>{return item;})
|
||||
ProblemList.value =
|
||||
list.map((item,i)=>{return item;})
|
||||
|
||||
} catch (err) {
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
const search=async ()=>{
|
||||
ProblemInfoRef.value?.validate(async (errors) => {
|
||||
await queryByPage(1)
|
||||
})
|
||||
}
|
||||
const onDeleteProblem = async (problemid)=>{
|
||||
const {id} = problemid
|
||||
try {
|
||||
|
|
@ -263,24 +210,7 @@ const onPostProblem = async (problemid)=>{
|
|||
await router.push({name: 'AdminProblemPost',
|
||||
params: {clId: id}})
|
||||
}
|
||||
const search=async ()=>{
|
||||
loading.value=true
|
||||
try {
|
||||
if (userStore.getRole().some((r)=>r==='admin')){
|
||||
const res=await api.findAllProblemPage({
|
||||
...ProblemInfoValue.value
|
||||
})
|
||||
const { pageNum, pageSize, total, list } = res.data
|
||||
paginationReactive.page = pageNum
|
||||
paginationReactive.pageSize = pageSize
|
||||
paginationReactive.itemCount = total
|
||||
ProblemList.value=list.map((item,i)=>{return item;})
|
||||
}
|
||||
}catch (err){
|
||||
}finally {
|
||||
loading.value=false
|
||||
}
|
||||
}
|
||||
|
||||
const handleSearchSchool = async (query) => {
|
||||
const res = await api.getSchoolByschoolName({
|
||||
name: query,
|
||||
|
|
@ -321,7 +251,7 @@ const onChangePage = (page) => {
|
|||
}
|
||||
}
|
||||
onMounted(()=>{
|
||||
queryByPage()
|
||||
queryByPage(paginationReactive.page)
|
||||
})
|
||||
watch(
|
||||
()=>router.currentRoute.value.fullPath,
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ export default {
|
|||
{
|
||||
name: 'AdminProblemTest',
|
||||
path: 'problem-test',
|
||||
isHidden: true,
|
||||
component: () => import('@/views/admin/problem/test.vue'),
|
||||
meta: {
|
||||
title: '测试页',
|
||||
|
|
|
|||
|
|
@ -3,17 +3,16 @@ package com.example.aes.problem.controller;
|
|||
|
||||
import com.example.aes.global.model.DecodeToken;
|
||||
import com.example.aes.global.model.RespBean;
|
||||
import com.example.aes.problem.model.PMProblem;
|
||||
import com.example.aes.problem.model.PMScoringRubric;
|
||||
import com.example.aes.problem.model.UScoringRubric;
|
||||
import com.example.aes.problem.model.*;
|
||||
import com.example.aes.problem.service.ProblemServiceI;
|
||||
import com.example.aes.user.model.*;
|
||||
import com.example.aes.user.service.ClassesServiceI;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.example.aes.user.model.DataGrid;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.swing.event.ListDataEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
@ -35,6 +34,46 @@ public class ProblemController {
|
|||
problemServiceI.addScoringRubric(scoringRubric);
|
||||
return RespBean.ok("添加评分细则成功");
|
||||
}
|
||||
@PostMapping("/addScoringStandard")
|
||||
public RespBean addScoringStandard(@RequestBody PMScoringStandard pmScoringStandard) {
|
||||
problemServiceI.addScoringStandard(pmScoringStandard);
|
||||
List<ScoringStandard> scoringStandardList=problemServiceI.findStandardIdNoProblemId();
|
||||
if(scoringStandardList.size()>1) {
|
||||
problemServiceI.updateStandardId(scoringStandardList.get(0).getId());
|
||||
}
|
||||
else{
|
||||
for(ScoringStandard scoringStandard:scoringStandardList){
|
||||
problemServiceI.updateStandardId(scoringStandard.getId());
|
||||
}
|
||||
} return RespBean.ok("添加评分标准成功");
|
||||
|
||||
}
|
||||
@PostMapping("/addProblem")
|
||||
public RespBean addProblem(@RequestBody Problem problem, HttpServletRequest request) {
|
||||
String title= problem.getTitle();
|
||||
//作业名称不能重复
|
||||
String result=
|
||||
problemServiceI.findProblemByTitle(title);
|
||||
if(result.equals("true"))
|
||||
return RespBean.error(
|
||||
"不能重复添加相同标题的作业");
|
||||
//添加作业
|
||||
DecodeToken decodeToken = new DecodeToken(request);
|
||||
String userId = decodeToken.getUserId();
|
||||
problem.setAdminuserId(Integer.parseInt(userId));
|
||||
problemServiceI.addProblem(problem);
|
||||
//更新评分标准标中的problemId
|
||||
List<Problem> problems=
|
||||
problemServiceI.findProblemIdByTitle(title);
|
||||
if(problems.size()>1){
|
||||
problemServiceI.updateProblemId(problems.get(0).getId());
|
||||
}else{
|
||||
for(Problem problem1:problems){
|
||||
problemServiceI.updateProblemId(problem1.getId());
|
||||
}
|
||||
}
|
||||
return RespBean.ok("添加作业成功");
|
||||
}
|
||||
@PostMapping("/findScoringRubricNoStandardId")
|
||||
public RespBean findScoringRubricNoStandardId() {
|
||||
List<UScoringRubric> uScoringRubricList=
|
||||
|
|
@ -46,6 +85,37 @@ public class ProblemController {
|
|||
return RespBean.error("获取评分细则列表失败!");
|
||||
}
|
||||
|
||||
}
|
||||
@PostMapping("/findScoringStandardNoProblemId")
|
||||
public RespBean findScoringStandardNoProblemId() {
|
||||
List<UScoringStandard> uScoringStandardList=
|
||||
problemServiceI.findScoringStandardNoProblemId();
|
||||
if (uScoringStandardList != null) {
|
||||
return RespBean.ok("获取评分标准列表成功!",
|
||||
uScoringStandardList);
|
||||
} else {
|
||||
return RespBean.error("获取评分标准列表失败!");
|
||||
}
|
||||
|
||||
}
|
||||
@PostMapping("/deleteScoringRubric")
|
||||
public RespBean deleteScoringRubric(){
|
||||
problemServiceI.deleteScoringRubric();
|
||||
return RespBean.ok("删除评分细则成功");
|
||||
}
|
||||
@PostMapping("/deleteScoringStandard")
|
||||
public RespBean deleteScoringStandrd(){
|
||||
problemServiceI.deleteScoringStandard();
|
||||
return RespBean.ok("删除评分标准成功");
|
||||
}
|
||||
@PostMapping("/findAllProblemByCourseId")
|
||||
public RespBean findAllProblemByCourseId(@RequestBody PMProblem pmProblem){
|
||||
if (pmProblem.getPageNum() < 1 || pmProblem.getPageSize() < 1)
|
||||
return RespBean.error("参数错误!");
|
||||
DataGrid dataGrid=
|
||||
problemServiceI.findProblemByCourseId(pmProblem);
|
||||
return RespBean.ok("查询作业库成功",dataGrid);
|
||||
|
||||
}
|
||||
//获取作业列表
|
||||
@GetMapping("/getExamList")
|
||||
|
|
|
|||
|
|
@ -7,8 +7,11 @@ import com.example.aes.problem.model.Problem;
|
|||
import com.example.aes.problem.model.ReportSubmitted;
|
||||
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.PMCourse;
|
||||
|
||||
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
|
@ -18,5 +21,11 @@ public interface ProblemDaoI extends BaseDaoI<Problem> {
|
|||
|
||||
List<ReportSubmitted> findPMProblemStatusesByStudentIdAndProblemsIds(List<Integer> problemIds, Integer studentId);
|
||||
|
||||
public String findProblemByTitle(String title);
|
||||
public List<Problem> findProblemIdByTitle(String title);
|
||||
public void addProblem(Problem problem);
|
||||
public long getAllProblemsNum(int courseId);
|
||||
List<Problem> getProblemsByPage(Integer courseId,String title,
|
||||
int page, int rows);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,4 +9,8 @@ import java.util.List;
|
|||
public interface ScoringRubricDaoI extends BaseDaoI<ScoringRubric> {
|
||||
public void addScoringRubric(PMScoringRubric pmScoringRubric);
|
||||
public List<ScoringRubric> getScoringRubricNoStandardId();
|
||||
public void updateStandardId(Integer standardId);
|
||||
public void deleteScoringRubric();
|
||||
public void deleteScoringRubricByStandrdId(Integer standardId);
|
||||
public List<ScoringRubric> getScoringRubricByStandardId(Integer standardId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package com.example.aes.problem.dao;
|
||||
|
||||
import com.example.aes.problem.model.PMScoringStandard;
|
||||
import com.example.aes.problem.model.ScoringStandard;
|
||||
import com.example.aes.user.dao.BaseDaoI;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ScoringStandardDaoI extends BaseDaoI<ScoringStandard> {
|
||||
public void addScoringStandard(PMScoringStandard pmScoringStandard);
|
||||
public List<ScoringStandard> getStandardIdNoProblemId();
|
||||
public List<ScoringStandard> getStandardIdNoProblemIdDesc();
|
||||
public void updateProblemId(int problemId);
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.example.aes.problem.dao.impl;
|
||||
|
||||
import cn.hutool.poi.excel.cell.CellSetter;
|
||||
import com.example.aes.problem.dao.ProblemDaoI;
|
||||
import com.example.aes.problem.model.PMProblem;
|
||||
import com.example.aes.problem.model.PMScoringRubric;
|
||||
|
|
@ -8,11 +9,14 @@ import com.example.aes.problem.model.ReportSubmitted;
|
|||
import com.example.aes.user.dao.BaseDaoI;
|
||||
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
||||
import com.example.aes.user.model.Classstudents;
|
||||
import com.example.aes.user.model.Course;
|
||||
import com.example.aes.user.model.PMCourse;
|
||||
import com.ibm.jvm.trace.format.api.TraceContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -20,6 +24,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.Objects;
|
||||
|
||||
@Repository("ProblemDao")
|
||||
public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
||||
|
|
@ -93,8 +98,54 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
|||
return queryResults;
|
||||
|
||||
}
|
||||
@Override
|
||||
public String findProblemByTitle(String title){
|
||||
String hql =
|
||||
"from Problem where title=" +
|
||||
"'" + title + "'";
|
||||
List<Problem> problemList = this.find(hql);
|
||||
if(problemList.size()>0)
|
||||
return "true";
|
||||
else
|
||||
return "false";
|
||||
}
|
||||
@Override
|
||||
public List<Problem> findProblemIdByTitle(String title){
|
||||
String hql =
|
||||
"from Problem where title=" +
|
||||
"'" + title + "'";
|
||||
List<Problem> problemList = this.find(hql);
|
||||
return problemList;
|
||||
}
|
||||
@Override
|
||||
public List<Problem> getProblemsByPage(Integer courseId,String title,
|
||||
int page,
|
||||
int rows){
|
||||
String hql="from Problem where courseId=" +
|
||||
courseId+" and title like '%"+title+
|
||||
"%'";
|
||||
List<Problem> problemList =
|
||||
this.find(hql,page,rows);
|
||||
return problemList;
|
||||
}
|
||||
|
||||
public void addScoringRubric(PMScoringRubric pmScoringRubric){
|
||||
public void addScoringRubric(PMScoringRubric pmScoringRubric) {}
|
||||
|
||||
};
|
||||
@Override
|
||||
public void addProblem(Problem problem) {
|
||||
// TODO Auto-generated method stub
|
||||
Problem problem1=new Problem();
|
||||
problem1.setAdminuserId(problem.getAdminuserId());
|
||||
problem1.setCourseId(problem.getCourseId());
|
||||
problem1.setTitle(problem.getTitle());
|
||||
problem1.setDescription(problem.getDescription());
|
||||
this.save(problem1);
|
||||
}
|
||||
@Override
|
||||
public long getAllProblemsNum(int courseId){
|
||||
String hql = "select count(*) from " +
|
||||
"Problem where courseId="+courseId;
|
||||
long count=this.count(hql);
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@ package com.example.aes.problem.dao.impl;
|
|||
import com.example.aes.problem.dao.ScoringRubricDaoI;
|
||||
import com.example.aes.problem.model.PMScoringRubric;
|
||||
import com.example.aes.problem.model.ScoringRubric;
|
||||
import com.example.aes.user.dao.CourseDaoI;
|
||||
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
||||
import com.example.aes.user.model.Course;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -29,5 +27,34 @@ public class ScoringRubricDaoImpl extends BaseDaoImpl<ScoringRubric> implements
|
|||
List<ScoringRubric> scoringRubricList =
|
||||
this.find(hql);
|
||||
return scoringRubricList;
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public void updateStandardId(Integer standardId){
|
||||
String hql =
|
||||
"update ScoringRubric set " +
|
||||
"standardId=" + standardId + " where standardId is null";
|
||||
this.executeHql(hql);
|
||||
}
|
||||
@Override
|
||||
public List<ScoringRubric> getScoringRubricByStandardId(Integer standardId){
|
||||
String hql ="from ScoringRubric where " +
|
||||
"standardId="+standardId;
|
||||
List<ScoringRubric> scoringRubricList =
|
||||
this.find(hql);
|
||||
return scoringRubricList;
|
||||
}
|
||||
@Override
|
||||
public void deleteScoringRubric(){
|
||||
String hql =
|
||||
"delete from ScoringRubric where" +
|
||||
" standardId is null";
|
||||
this.executeHql(hql);
|
||||
}
|
||||
@Override
|
||||
public void deleteScoringRubricByStandrdId(Integer standardId){
|
||||
String hql =
|
||||
"delete from ScoringRubric where" +
|
||||
" standardId="+standardId;
|
||||
this.executeHql(hql);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package com.example.aes.problem.dao.impl;
|
||||
|
||||
import com.example.aes.problem.dao.ScoringStandardDaoI;
|
||||
import com.example.aes.problem.model.PMScoringStandard;
|
||||
import com.example.aes.problem.model.ScoringStandard;
|
||||
import com.example.aes.problem.model.UScoringStandard;
|
||||
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository("ScoringStandardDao")
|
||||
public class ScoringStandardDaoImpl extends BaseDaoImpl<ScoringStandard> implements ScoringStandardDaoI {
|
||||
@Override
|
||||
public void addScoringStandard(PMScoringStandard pmScoringStandard){
|
||||
ScoringStandard scoringStandard=
|
||||
new ScoringStandard();
|
||||
scoringStandard.setDimension(pmScoringStandard.getDimension());
|
||||
scoringStandard.setWeight(pmScoringStandard.getWeight());
|
||||
this.save(scoringStandard);
|
||||
|
||||
}
|
||||
@Override
|
||||
public List<ScoringStandard> getStandardIdNoProblemId(){
|
||||
String sql="from " +
|
||||
"ScoringStandard where " +
|
||||
"problemId is null";
|
||||
return this.find(sql);
|
||||
}
|
||||
@Override
|
||||
public List<ScoringStandard> getStandardIdNoProblemIdDesc(){
|
||||
String sql="from " +
|
||||
"ScoringStandard where " +
|
||||
"problemId is null order by id " +
|
||||
"desc";
|
||||
return this.find(sql);
|
||||
}
|
||||
@Override
|
||||
public void updateProblemId(int problemId){
|
||||
String hql =
|
||||
"update ScoringStandard set " +
|
||||
"problemId=" + problemId +
|
||||
" where problemId is " +
|
||||
"null";
|
||||
this.executeHql(hql);
|
||||
}
|
||||
// @Override
|
||||
// public List<UScoringStandard> getScoringStandardNoProblemId(){
|
||||
// List<UScoringStandard> uScoringStandardList;
|
||||
// String sql="from " +
|
||||
// "ScoringStandard where " +
|
||||
// "problemId is null";
|
||||
// List<ScoringStandard> scoringStandardList=this.find(sql);
|
||||
// for(ScoringStandard scoringStandard:scoringStandardList){
|
||||
// UScoringStandard uScoringStandard=
|
||||
// new UScoringStandard();
|
||||
// uScoringStandard.setDimension(scoringStandard.getDimension());
|
||||
// uScoringStandard.setWeight(scoringStandard.getWeight());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
@ -21,6 +21,7 @@ public class PMProblem extends Problem implements java.io.Serializable{//继承P
|
|||
// 作业列表分页exam
|
||||
private int pageNum;
|
||||
private int pageSize;
|
||||
private String teacherName;
|
||||
|
||||
|
||||
// (作业列表)页面上其他需要的属性
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package com.example.aes.problem.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
|
||||
@Data
|
||||
public class PMScoringStandard {
|
||||
private int id;
|
||||
private String dimension;
|
||||
private Float weight;
|
||||
}
|
||||
|
|
@ -4,24 +4,32 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table(name = "Problem")
|
||||
@Entity
|
||||
@Table(name = "Problem",catalog = "aes")
|
||||
public class Problem implements java.io.Serializable{ //Problem父类
|
||||
|
||||
//作业problem基本属性
|
||||
@javax.persistence.Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", unique = true, nullable = false)
|
||||
private int Id;//此处为ProblemId
|
||||
@Column(name = "courseId")
|
||||
private int courseId;
|
||||
@Column(name = "adminuserId")
|
||||
private int adminuserId;
|
||||
@Column(name = "title",length = 30)
|
||||
private String title;
|
||||
@Column(name = "description",length=1000)
|
||||
private String description;
|
||||
|
||||
// 作业列表分页exam
|
||||
private int pageNum;
|
||||
private int pageSize;
|
||||
// // 作业列表分页exam
|
||||
// private int pageNum;
|
||||
// private int pageSize;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
package com.example.aes.problem.model;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "scoringstandard",catalog = "aes")
|
||||
public class ScoringStandard {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", unique = true, nullable = false)
|
||||
private Integer id;
|
||||
@Column(name = "problemId")
|
||||
private Integer problemId;
|
||||
@Column(name = "dimension",length = 100)
|
||||
private String dimension;
|
||||
@Column(name = "weight")
|
||||
private Float weight;
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getProblemId() {
|
||||
return problemId;
|
||||
}
|
||||
|
||||
public void setProblemId(Integer problemId) {
|
||||
this.problemId = problemId;
|
||||
}
|
||||
|
||||
public String getDimension() {
|
||||
return dimension;
|
||||
}
|
||||
|
||||
public void setDimension(String dimension) {
|
||||
this.dimension = dimension;
|
||||
}
|
||||
|
||||
public Float getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(Float weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
package com.example.aes.problem.model;
|
||||
|
||||
public class UProblem {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.example.aes.problem.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UScoringStandard {
|
||||
private String dimension;
|
||||
private Float weight;
|
||||
private String rubrics;
|
||||
}
|
||||
|
|
@ -2,8 +2,11 @@ package com.example.aes.problem.service.Impl;
|
|||
|
||||
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.service.ProblemServiceI;
|
||||
import com.example.aes.user.dao.AdminusersDaoI;
|
||||
import com.example.aes.user.model.Classstudents;
|
||||
import com.example.aes.user.model.Course;
|
||||
import com.example.aes.user.model.DataGrid;
|
||||
|
|
@ -23,6 +26,18 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
|||
|
||||
private ProblemDaoI problemDao;
|
||||
private ScoringRubricDaoI scoringRubricDao;
|
||||
private ScoringStandardDaoI scoringStandardDao;
|
||||
private AdminusersDaoI adminusersDao;
|
||||
@Autowired
|
||||
public void setAdminusersDao(AdminusersDaoI adminusersDao) {
|
||||
this.adminusersDao = adminusersDao;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setScoringStandardDao(ScoringStandardDaoI scoringStandardDao) {
|
||||
this.scoringStandardDao = scoringStandardDao;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setScoringRubricDao(ScoringRubricDaoI scoringRubricDao) {
|
||||
this.scoringRubricDao = scoringRubricDao;
|
||||
|
|
@ -42,6 +57,10 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
|||
scoringRubricDao.addScoringRubric(pmscoringRubric);
|
||||
}
|
||||
@Override
|
||||
public void addScoringStandard(PMScoringStandard pmScoringStandard){
|
||||
scoringStandardDao.addScoringStandard(pmScoringStandard);
|
||||
}
|
||||
@Override
|
||||
public List<UScoringRubric> findScoringRubricNoStandardId(){
|
||||
List<ScoringRubric> scoringRubricList;
|
||||
scoringRubricList=
|
||||
|
|
@ -50,12 +69,12 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
|||
return null;
|
||||
} else {
|
||||
List<UScoringRubric> uScoringRubricList=new ArrayList<>();
|
||||
changeModel2(scoringRubricList,
|
||||
changeModel(scoringRubricList,
|
||||
uScoringRubricList);
|
||||
return uScoringRubricList;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public DataGrid dataGrid(List<PMProblem> pMproblems, PMProblem pMproblem) {
|
||||
|
|
@ -144,28 +163,129 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
|||
}
|
||||
}
|
||||
|
||||
;
|
||||
private void changeModel1(List<ScoringRubric> l,
|
||||
List<PMScoringRubric> nl) {
|
||||
if (l != null && l.size() > 0) {
|
||||
for (ScoringRubric t : l) {
|
||||
PMScoringRubric u = new PMScoringRubric();
|
||||
BeanUtils.copyProperties(t, u);
|
||||
nl.add(u);
|
||||
}
|
||||
@Override
|
||||
public List<ScoringStandard> findStandardIdNoProblemId(){
|
||||
List<ScoringStandard> scoringStandardList=scoringStandardDao.getStandardIdNoProblemIdDesc();
|
||||
|
||||
return scoringStandardList;
|
||||
|
||||
}
|
||||
@Override
|
||||
public List<UScoringStandard> findScoringStandardNoProblemId(){
|
||||
List<UScoringStandard> uScoringStandardList=new ArrayList<>();
|
||||
|
||||
List<ScoringStandard> scoringStandardList=scoringStandardDao.getStandardIdNoProblemId();
|
||||
for(ScoringStandard scoringStandard:scoringStandardList){
|
||||
List<ScoringRubric> scoringRubricList=
|
||||
scoringRubricDao.getScoringRubricByStandardId(scoringStandard.getId());
|
||||
UScoringStandard uScoringStandard=
|
||||
new UScoringStandard();
|
||||
uScoringStandard.setDimension(scoringStandard.getDimension());
|
||||
uScoringStandard.setWeight(scoringStandard.getWeight());
|
||||
StringBuffer strb=new StringBuffer();
|
||||
for(ScoringRubric scoringRubric:scoringRubricList){
|
||||
strb.append(scoringRubric.getLowerLimit()+"~"+scoringRubric.getUpperLimit()+":"+scoringRubric.getDescription().replaceAll("<\\/?.*?>", "").trim()+";");
|
||||
}uScoringStandard.setRubrics(strb.toString());
|
||||
uScoringStandardList.add(uScoringStandard);
|
||||
}
|
||||
|
||||
return uScoringStandardList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateStandardId(Integer standardId){
|
||||
scoringRubricDao.updateStandardId(standardId);
|
||||
}
|
||||
@Override
|
||||
public void updateProblemId(int problemId){
|
||||
scoringStandardDao.updateProblemId(problemId);
|
||||
}
|
||||
@Override
|
||||
public void deleteScoringRubric(){
|
||||
scoringRubricDao.deleteScoringRubric();
|
||||
}
|
||||
@Override
|
||||
public void deleteScoringStandard(){
|
||||
//先找出无problemid的standrd的list
|
||||
List<ScoringStandard> scoringStandardList=scoringStandardDao.getStandardIdNoProblemId();
|
||||
//再根据standardid删掉rubric
|
||||
for(ScoringStandard scoringStandard:scoringStandardList){
|
||||
scoringRubricDao.deleteScoringRubricByStandrdId(scoringStandard.getId());
|
||||
//最后删掉无problemid的standrd
|
||||
scoringStandardDao.delete(scoringStandard);
|
||||
}
|
||||
}
|
||||
private void changeModel2(List<ScoringRubric> l,
|
||||
@Override
|
||||
public String findProblemByTitle(String title){
|
||||
return problemDao.findProblemByTitle(title);
|
||||
}
|
||||
@Override
|
||||
public List<Problem> findProblemIdByTitle(String title){
|
||||
|
||||
return problemDao.findProblemIdByTitle(title);
|
||||
|
||||
}
|
||||
@Override
|
||||
public DataGrid findProblemByCourseId(PMProblem pmProblem){
|
||||
DataGrid dg = new DataGrid();
|
||||
int totalLines;
|
||||
List<Problem> theProblemList;
|
||||
totalLines=
|
||||
(int) problemDao.getAllProblemsNum(pmProblem.getCourseId());
|
||||
int page= pmProblem.getPageNum();
|
||||
if ((page-1)*pmProblem.getPageSize()>=totalLines){
|
||||
pmProblem.setPageNum(1);
|
||||
} theProblemList =
|
||||
problemDao.getProblemsByPage(pmProblem.getCourseId(),pmProblem.getTitle(),pmProblem.getPageNum(), pmProblem.getPageSize());
|
||||
if (theProblemList == null) {
|
||||
return null;
|
||||
} else {
|
||||
List<PMProblem> pmProblems=new ArrayList<>();
|
||||
changeModel2(pmProblems,theProblemList);
|
||||
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);
|
||||
return dg;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void addProblem(Problem problem) {
|
||||
// TODO Auto-generated method stub
|
||||
problemDao.addProblem(problem);
|
||||
}
|
||||
private void changeModel(List<ScoringRubric> l,
|
||||
List<UScoringRubric> nl) {
|
||||
if (l != null && l.size() > 0) {
|
||||
for (ScoringRubric t : l) {
|
||||
UScoringRubric u =
|
||||
new UScoringRubric();
|
||||
u.setRange(t.getLowerLimit()+
|
||||
"~"+t.getUpperLimit());
|
||||
"~"+t.getUpperLimit());
|
||||
u.setDescription(t.getDescription().replaceAll("<\\/?.*?>", "").trim());
|
||||
nl.add(u);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void changeModel2(List<PMProblem> pmp,
|
||||
List<Problem> p) {
|
||||
if (p != null && p.size() > 0) {
|
||||
for (Problem problem : p) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ package com.example.aes.problem.service;
|
|||
|
||||
|
||||
|
||||
import com.example.aes.problem.model.PMProblem;
|
||||
import com.example.aes.problem.model.PMScoringRubric;
|
||||
import com.example.aes.problem.model.UScoringRubric;
|
||||
import com.example.aes.problem.model.*;
|
||||
import com.example.aes.user.model.*;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -13,6 +11,17 @@ public interface ProblemServiceI {
|
|||
public List<PMProblem> getProblemsByClassIds(List<Integer> classIds);
|
||||
public void addScoringRubric(PMScoringRubric pmscoringRubric);
|
||||
public List<UScoringRubric> findScoringRubricNoStandardId();
|
||||
public List<UScoringStandard> findScoringStandardNoProblemId();
|
||||
public void addScoringStandard(PMScoringStandard pmScoringStandard);
|
||||
public List<ScoringStandard> findStandardIdNoProblemId();
|
||||
public void updateStandardId(Integer standardId);
|
||||
public String findProblemByTitle(String title);
|
||||
public List<Problem> findProblemIdByTitle(String title);
|
||||
public void addProblem(Problem problem);
|
||||
public void updateProblemId(int problemId);
|
||||
public void deleteScoringRubric();
|
||||
public void deleteScoringStandard();
|
||||
public DataGrid findProblemByCourseId(PMProblem pmProblem);
|
||||
|
||||
DataGrid dataGrid(List<PMProblem> pMproblems, PMProblem pMproblem);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
|
|
@ -112,6 +113,34 @@ public class ClassesController{
|
|||
classesServiceI.addClassToCourse(uClass);
|
||||
return RespBean.ok("添加班级成功");
|
||||
}
|
||||
@PostMapping("/findClassById")
|
||||
public RespBean findClassById(@RequestBody UClass uClass) {
|
||||
Classes onclass = classesServiceI.findClassById(uClass.getClassId());
|
||||
return RespBean.ok("查询班级成功", onclass);
|
||||
}
|
||||
@PostMapping("/editClassMessage")
|
||||
public RespBean editClassMessage(@RequestBody PMClasses pmclasses, HttpServletRequest request) // int id, String className, int teacherId
|
||||
{
|
||||
DecodeToken decodeToken=new DecodeToken(request);
|
||||
int teacherId= Integer.parseInt(decodeToken.getUserId());
|
||||
String role = decodeToken.getRole();
|
||||
|
||||
// 修改班级信息
|
||||
int id = pmclasses.getId();
|
||||
String className = pmclasses.getName();
|
||||
// int advance = pmclasses.getAdvance();
|
||||
// int late = pmclasses.getLate();
|
||||
// int reject = pmclasses.getReject();
|
||||
// String weektime = pmclasses.getWeektime();
|
||||
// Date first_week_monday = pmclasses.getFirst_week_monday();
|
||||
|
||||
boolean result = classesServiceI.editClassMessage(id, className,teacherId);
|
||||
if (result == true) {
|
||||
return RespBean.ok("修改班级信息成功", result);
|
||||
} else {
|
||||
return RespBean.error("修改班级信息失败", result);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/addClass")
|
||||
public RespBean addClass(@RequestBody PMClasses pmclasses) // 添加班级
|
||||
|
|
|
|||
|
|
@ -35,4 +35,5 @@ public interface AdminusersDaoI extends BaseDaoI<Adminusers> {
|
|||
|
||||
public long getAssistantNotBelongClassNum(int classId,
|
||||
String account, String name, String email, String no);
|
||||
public String findTeacherNameByTeacherId(int teacherId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ public interface BaseDaoI<T> {
|
|||
// 查询用户,并返回用户信息
|
||||
public T get(Class<T> c, Serializable id); // 用ID查询
|
||||
|
||||
|
||||
public T get(String hql);
|
||||
|
||||
public T get(String hql, Object[] params);
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ public interface ClassesDaoI extends BaseDaoI<Classes> {
|
|||
public long findClassStudentsByIdNum(int classId);
|
||||
public List<PMUser> findClassStudentsByIdPage(int classId, int pageNum, int pageSize);
|
||||
public boolean deleteClassStudentsByUserId(int classId, int userId); // 通过userId删除班级学生
|
||||
|
||||
public boolean editClassMessage(int id,
|
||||
String className, int teacherId);
|
||||
public List<Classstudents>findClassIdByStudentId(int studentId);//根据班级id查找学生id
|
||||
}
|
||||
|
|
|
|||
|
|
@ -446,4 +446,10 @@ public class AdminusersDaoImpl extends BaseDaoImpl<Adminusers> implements
|
|||
q.setParameter("no", "%" + no + "%");
|
||||
return q.list().size();
|
||||
}
|
||||
@Override
|
||||
public String findTeacherNameByTeacherId(int teacherId){
|
||||
String hql=
|
||||
"from Adminusers where id="+teacherId;
|
||||
return this.find(hql).get(0).getName();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ public class BaseDaoImpl<T> implements BaseDaoI<T> {
|
|||
// this.getCurrentSession().getTransaction().commit();
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* 检查登录信息
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -155,7 +155,27 @@ public class ClassesDaoImpl extends BaseDaoImpl<Classes> implements ClassesDaoI
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean editClassMessage(int id, String className, int teacherId) { // 执行修改班级信息
|
||||
// TODO Auto-generated method stub
|
||||
StringBuilder hql = new StringBuilder();
|
||||
hql.append("update Classes set name=:className");
|
||||
hql.append(" where id=:id");
|
||||
// String hql = "update Classes set name=:className,teacherId=:teacherId,advance=:advance,late=:late,reject=:reject,weektime=:weektime,first_week_monday=:first_week_monday where id=:id";
|
||||
Query q = this.getCurrentSession().createQuery(hql.toString());
|
||||
q.setParameter("className", className);
|
||||
q.setParameter("id", id);
|
||||
// q.setParameter("advance", advance);
|
||||
// q.setParameter("late", late);
|
||||
// q.setParameter("reject", reject);
|
||||
// q.setParameter("weektime", weektime);
|
||||
// q.setParameter("first_week_monday", first_week_monday);
|
||||
int num = q.executeUpdate();
|
||||
if (num != 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long findAllClassNum(int teacherId, String role){
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ public interface ClassesServiceI {
|
|||
|
||||
public void addClass(PMClasses pclass); // 添加班级
|
||||
public void addClassToCourse(UClass uClass);//添加班级到课程
|
||||
public Classes findClassById(int classId);
|
||||
public boolean editClassMessage(int id, String className, int teacherId); // 修改班级信息
|
||||
public DataGrid findClassStudentsByIdPage(int classId,int pageNum, int pageSize);
|
||||
public boolean deleteClassStudentsByUserId(int classId, int userId);
|
||||
public DataGrid findClassNotInCourse(UClass uClass, int pageNum, int pageSize); // 获取未参加课程的班级
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ import com.example.aes.user.dao.ClassesDaoI;
|
|||
import com.example.aes.user.dao.ClassstudentsDaoI;
|
||||
import com.example.aes.user.model.*;
|
||||
import com.example.aes.user.service.ClassesServiceI;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
|
@ -184,9 +186,20 @@ public void setclassstudentsDao(ClassstudentsDaoI classstudentsDao) {
|
|||
}
|
||||
classesDao.addClass(pclass);
|
||||
}
|
||||
@Override
|
||||
public void addClassToCourse(UClass uClass){
|
||||
classesDao.addClassToCourse(uClass);
|
||||
};
|
||||
@Override
|
||||
public Classes findClassById(int classId) {
|
||||
// TODO Auto-generated method stub
|
||||
return classesDao.get(Classes.class, classId);
|
||||
}
|
||||
@Override
|
||||
public boolean editClassMessage(int id, String className, int teacherId) {
|
||||
// TODO Auto-generated method stub
|
||||
return classesDao.editClassMessage(id, className, teacherId);
|
||||
}
|
||||
// addclass要用的方法
|
||||
public String getInviteCode() {
|
||||
// 1.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>룬2.<EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>
|
||||
|
|
|
|||
Loading…
Reference in New Issue