修复已交和待批的bug,完成加时、导出成绩、导出未交名单的功能
This commit is contained in:
parent
793e29afbb
commit
50185cd723
|
|
@ -33,7 +33,9 @@ Node 安装 18 及以上
|
|||
```shell
|
||||
# Prod Environment
|
||||
pnpm build
|
||||
```
|
||||
4.导出功能的依赖
|
||||
```shell
|
||||
npm install xlsx file-saver
|
||||
|
||||
|
||||
## 技术栈
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
"dayjs": "^1.11.10",
|
||||
"docx": "^8.5.0",
|
||||
"echarts": "^5.4.3",
|
||||
"file-saver": "^2.0.5",
|
||||
"lodash-es": "^4.17.21",
|
||||
"mockjs": "^1.1.0",
|
||||
"pinia": "^2.1.7",
|
||||
|
|
@ -5135,6 +5136,12 @@
|
|||
"node": "^10.12.0 || >=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/file-saver": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmmirror.com/file-saver/-/file-saver-2.0.5.tgz",
|
||||
"integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/filelist": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/filelist/-/filelist-1.0.4.tgz",
|
||||
|
|
@ -11370,6 +11377,7 @@
|
|||
"version": "0.18.5",
|
||||
"resolved": "https://registry.npmmirror.com/xlsx/-/xlsx-0.18.5.tgz",
|
||||
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"adler-32": "~1.3.0",
|
||||
"cfb": "~1.2.1",
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
"dayjs": "^1.11.10",
|
||||
"docx": "^8.5.0",
|
||||
"echarts": "^5.4.3",
|
||||
"file-saver": "^2.0.5",
|
||||
"lodash-es": "^4.17.21",
|
||||
"mockjs": "^1.1.0",
|
||||
"pinia": "^2.1.7",
|
||||
|
|
|
|||
|
|
@ -90,4 +90,6 @@ export default {
|
|||
findPostProblem:(data)=>request.post('/problem/findPostProblem',data),
|
||||
updateSetup:(data)=>request.post('/problem/updateSetup',data),
|
||||
findStudentSubmit:(data)=>request.post('/problem/findStudentSubmit',data),
|
||||
addTime:(data)=>request.post('/problem/addTime',data),
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<script setup>
|
||||
const emit =
|
||||
defineEmits(['clickDelete','clickReview'])
|
||||
defineEmits(['clickEdit','clickReview'])
|
||||
const onEdit = ()=>{
|
||||
emit('clickEdit')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ const loading = ref(true)
|
|||
const ScoringRubricList =
|
||||
ref([])
|
||||
const role=userStore.getRole()
|
||||
const route = useRoute()
|
||||
const paginationReactive = reactive({
|
||||
page: 1,
|
||||
pageSize: 50,
|
||||
|
|
|
|||
|
|
@ -16,17 +16,17 @@
|
|||
<!-- style="--n-width: 50px;margin-left:15px">-->
|
||||
<!-- 加时-->
|
||||
<!-- </n-button>-->
|
||||
<n-modal
|
||||
v-model:show="showModal"
|
||||
:mask-closable="false"
|
||||
preset="dialog"
|
||||
title="删除"
|
||||
content="将删除该学生,确认?"
|
||||
positive-text="确认"
|
||||
negative-text="取消"
|
||||
@positive-click="onDelete"
|
||||
@negative-click="closes"
|
||||
/>
|
||||
<!-- <n-modal-->
|
||||
<!-- v-model:show="showModal"-->
|
||||
<!-- :mask-closable="false"-->
|
||||
<!-- preset="dialog"-->
|
||||
<!-- title="删除"-->
|
||||
<!-- content="将删除该学生,确认?"-->
|
||||
<!-- positive-text="确认"-->
|
||||
<!-- negative-text="取消"-->
|
||||
<!-- @positive-click="onDelete"-->
|
||||
<!-- @negative-click="closes"-->
|
||||
<!-- />-->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -43,7 +43,7 @@ const onBack = ()=>{
|
|||
const onReview = ()=>{
|
||||
emit('clickReview')
|
||||
}
|
||||
const onAddTime = ()=>{
|
||||
emit('clickAddTime')
|
||||
}
|
||||
// const onDelete = ()=>{
|
||||
// emit('clickDelete')
|
||||
// }
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<!-- 打回-->
|
||||
<!-- </n-button>-->
|
||||
<n-button type="primary" size="small"
|
||||
@click="addTime"
|
||||
@click="onAddTime"
|
||||
style="--n-width: 50px;margin-left:15px">
|
||||
加时
|
||||
</n-button>
|
||||
|
|
@ -37,12 +37,12 @@ const emit =
|
|||
defineEmits(['clickReview','clickBack','clickAddTime'])
|
||||
const showModal=ref(false)
|
||||
|
||||
const onBack = ()=>{
|
||||
emit('clickBack')
|
||||
}
|
||||
const onReview = ()=>{
|
||||
emit('clickReview')
|
||||
}
|
||||
// const onBack = ()=>{
|
||||
// emit('clickBack')
|
||||
// }
|
||||
// const onReview = ()=>{
|
||||
// emit('clickReview')
|
||||
// }
|
||||
const onAddTime = ()=>{
|
||||
emit('clickAddTime')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
label-placement="left"style="margin-top: 15px;margin-left: 2%">
|
||||
<n-form
|
||||
ref="problemInfoRef"
|
||||
:model="problemInfoValue"
|
||||
:model="addTimeValue"
|
||||
:rules="problemAddRules"
|
||||
label-placement="left"
|
||||
label-align="right"
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
<!-- <n-form-item label="有效时段:"-->
|
||||
<!-- path="timeFrom">-->
|
||||
<!-- <n-date-picker-->
|
||||
<!-- v-model:formatted-value="problemInfoValue.timeFrom"-->
|
||||
<!-- v-model:formatted-value="addTimeValue.timeFrom"-->
|
||||
<!-- style="width: 350px"-->
|
||||
<!-- type="datetime"-->
|
||||
<!-- input-readonly-->
|
||||
|
|
@ -40,15 +40,14 @@
|
|||
<!-- :actions="['confirm']"-->
|
||||
<!-- />-->
|
||||
<!-- </n-form-item>-->
|
||||
<n-form-item label="结束时间:"
|
||||
path="timeTo">
|
||||
<n-form-item label="加时:">
|
||||
<n-date-picker
|
||||
v-model:formatted-value="problemInfoValue.timeTo"
|
||||
style="width: 300px"
|
||||
v-model:formatted-value="addTimeValue.endTime"
|
||||
style="width: 280px"
|
||||
type="datetime"
|
||||
input-readonly
|
||||
placeholder="请选择结束时间"
|
||||
format="yyyy-MM-dd HH:mm"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
update-value-on-close
|
||||
:actions="['confirm']"
|
||||
/>
|
||||
|
|
@ -58,7 +57,7 @@
|
|||
<!-- <n-form-item label="允许补交:"-->
|
||||
<!-- path="allow">-->
|
||||
<!-- <n-checkbox-->
|
||||
<!-- v-model:checked="problemInfoValue.allow"-->
|
||||
<!-- v-model:checked="addTimeValue.allow"-->
|
||||
<!-- @update="allow"-->
|
||||
<!-- ></n-checkbox>-->
|
||||
<!-- </n-form-item>-->
|
||||
|
|
@ -81,52 +80,63 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {useRouter} from "vue-router";
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import {ref} from "vue";
|
||||
import api from "@/api/admin";
|
||||
import { useTagsStore } from '@/store'
|
||||
import StandardsList
|
||||
from '@/views/admin/problem/components/StandardList.vue'
|
||||
import RichTextEditor
|
||||
from '@/components/common/RichTextEditor.vue'
|
||||
const route = useRoute()
|
||||
const { classId,problemId,studentId, history } =
|
||||
route.query
|
||||
const tagsStore = useTagsStore()
|
||||
const path=ref('')
|
||||
const router = useRouter()
|
||||
const rules=ref(null)
|
||||
const problemInfoValue = ref({
|
||||
name: '',
|
||||
timeFrom: [],
|
||||
timeTo: [],
|
||||
allow:true
|
||||
});
|
||||
|
||||
const addTimeValue = ref({
|
||||
title: '',
|
||||
startTime: [],
|
||||
endTime: [],
|
||||
allow:false
|
||||
})
|
||||
const loading = ref(true)
|
||||
const problemInfoRef = ref(null)
|
||||
const descEditorHeight = ref('160px')
|
||||
const problemName = ref('作业标题')
|
||||
const cancel = ()=>{
|
||||
tagsStore.removeTag(path.value)
|
||||
router.push({path: 'problem-list'})
|
||||
}
|
||||
const onAdd = ()=>{
|
||||
router.push({name: 'AdminProblemPostClass'})
|
||||
}
|
||||
const submit =async ()=>{
|
||||
if(problemInfoValue.value.name!==''){
|
||||
const queryByPage = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
await api.Addproblem({
|
||||
...problemInfoValue.value
|
||||
const res = await api.findPostProblem({
|
||||
problemId:problemId,
|
||||
classId:classId
|
||||
})
|
||||
$message.success("添加课程成功")
|
||||
addTimeValue.value=res.data
|
||||
console.log(addTimeValue.value)
|
||||
} catch (err) {
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
const submit =async ()=>{
|
||||
try {
|
||||
await api.addTime({
|
||||
...addTimeValue.value,
|
||||
problemId:problemId,
|
||||
studentId:studentId
|
||||
})
|
||||
$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'})
|
||||
}
|
||||
}else {
|
||||
$message.error("作业名称不能为空")
|
||||
// await router.push({name: 'AdminProblemList'})
|
||||
}
|
||||
}
|
||||
onMounted(()=>{
|
||||
path.value=router.currentRoute.value.fullPath
|
||||
queryByPage()
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -130,23 +130,6 @@ const updateSetup =async ()=>{
|
|||
const onAdd = ()=>{
|
||||
router.push({name: 'AdminProblemPostClass'})
|
||||
}
|
||||
const submit =async ()=>{
|
||||
if(problemInfoValue.value.name!==''){
|
||||
try {
|
||||
await api.Addproblem({
|
||||
...problemInfoValue.value
|
||||
})
|
||||
$message.success("添加课程成功")
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemList'})
|
||||
} catch (err) {
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemList'})
|
||||
}
|
||||
}else {
|
||||
$message.error("作业名称不能为空")
|
||||
}
|
||||
}
|
||||
const queryByPage = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ const options1=ref([])
|
|||
const role=userStore.getRole()
|
||||
const teacherId=ref()
|
||||
const selectedStatus=ref("")
|
||||
const today = new Date();
|
||||
const filteredData =ref([]);
|
||||
const route = useRoute()
|
||||
const { courseId, history } = route.query
|
||||
|
|
@ -329,9 +328,16 @@ const onChangePage = (page) => {
|
|||
onMounted(()=>{
|
||||
queryByPage(paginationReactive.page)
|
||||
})
|
||||
// watch(route, () => {
|
||||
// filterData()
|
||||
// })
|
||||
watch(
|
||||
()=>router.currentRoute.value.fullPath,
|
||||
()=>{
|
||||
if
|
||||
(router.currentRoute.value.fullPath==='/admin/problem/problem-list') {
|
||||
queryByPage(paginationReactive.page)
|
||||
search(paginationReactive.page)
|
||||
}
|
||||
}
|
||||
)
|
||||
</script>
|
||||
<style>
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@
|
|||
style='justify-content: flex-end'>
|
||||
<n-form-item
|
||||
v-if="selectedStatus==='weijiao'" style='margin-left: 10px;margin-right: 20px'>
|
||||
<n-button type="primary" style="margin-right: 10px" @click="exportUnsubmitted">导出未交名单</n-button>
|
||||
<n-button type="primary"
|
||||
style="margin-right: 10px" @click="exportWeijiaoTable">导出未交名单</n-button>
|
||||
|
||||
</n-form-item>
|
||||
<n-form-item v-else style='margin-left: 10px;margin-right: 20px'>
|
||||
|
|
@ -77,6 +78,7 @@
|
|||
:loading="loading"
|
||||
:pagination="paginationReactive"
|
||||
:row-key="rowKey"
|
||||
:rows="tableData"
|
||||
:scroll-x="900"
|
||||
@update:page="onChangePage"
|
||||
@update:page-size="onUpdatePageSize"
|
||||
|
|
@ -87,6 +89,8 @@
|
|||
|
||||
<script setup>
|
||||
import {onMounted, reactive, ref, watch} from "vue";
|
||||
import { saveAs } from 'file-saver';
|
||||
import * as XLSX from 'xlsx';
|
||||
import {useRoute, useRouter} from 'vue-router'
|
||||
import api from "@/api/admin";
|
||||
import ProblemStudentAction
|
||||
|
|
@ -110,7 +114,6 @@ const submitList =
|
|||
ref([])
|
||||
const studentList =
|
||||
reactive([])
|
||||
const filteredStudentList=ref(studentList)
|
||||
const { classId,problemId, history } = route.query
|
||||
const paginationReactive = reactive({
|
||||
page: 1,
|
||||
|
|
@ -134,19 +137,19 @@ const updateColumns=()=>{
|
|||
{
|
||||
key: 'chineseName',
|
||||
title: '姓名',
|
||||
width: '50',
|
||||
width: '80',
|
||||
align:'center',
|
||||
},
|
||||
{
|
||||
key: 'readTime',
|
||||
title: '领取时间',
|
||||
width: '100',
|
||||
width: '300',
|
||||
align:'center'
|
||||
},
|
||||
{
|
||||
key: 'submissionStatus',
|
||||
title: '状态',
|
||||
width: '300',
|
||||
width: '100',
|
||||
},
|
||||
{
|
||||
key: 'actions',
|
||||
|
|
@ -157,7 +160,7 @@ const updateColumns=()=>{
|
|||
ProblemStudentAction2,
|
||||
{
|
||||
onClickAddTime: () =>
|
||||
addTime(row)
|
||||
onAddTime(row)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -216,7 +219,7 @@ const updateColumns=()=>{
|
|||
}
|
||||
// 根据 selectedStatus 过滤数据
|
||||
const studentInfoValue = ref({
|
||||
studentId:'',
|
||||
id:0,
|
||||
studentNo:'',
|
||||
chineseName:'',
|
||||
readTime:[],
|
||||
|
|
@ -274,10 +277,11 @@ const onEditClass = async (classId)=>{
|
|||
const id=1
|
||||
await router.push({name: 'StudentEdits', params: {clId: id}, query: {id: clId}})
|
||||
}
|
||||
const addTime=async ()=>{
|
||||
// const {id} = classId
|
||||
const id=1
|
||||
await router.push({name: 'AdminProblemAddTime', params: {clId: id}, query: {id: clId}})
|
||||
const onAddTime=async (studentId)=>{
|
||||
const {id} = studentId
|
||||
await router.push({name:
|
||||
'AdminProblemAddTime', query: {classId:
|
||||
classId,problemId:problemId,studentId:id}})
|
||||
}
|
||||
const onReview=async ()=>{
|
||||
// const {id} = classId
|
||||
|
|
@ -318,6 +322,63 @@ const onUpdatePageSize = (pageSize) => {
|
|||
paginationReactive.page = 1;
|
||||
queryByPage(1)
|
||||
}
|
||||
const tableRef = ref(null);
|
||||
|
||||
const exportScores = () => {
|
||||
// 1. 获取表格数据
|
||||
const data = filteredData.value;
|
||||
|
||||
// 2. 定义表头
|
||||
const headers = columns.value.map(column => column.title);
|
||||
|
||||
// 3. 转换为二维数组
|
||||
const worksheetData = [headers];
|
||||
data.forEach(row => {
|
||||
const rowData = columns.value.map(column => row[column.key]);
|
||||
worksheetData.push(rowData);
|
||||
});
|
||||
|
||||
// 4. 生成 Excel 文件
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(worksheetData);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// 5. 导出文件
|
||||
const excelBuffer = XLSX.write(workbook, {
|
||||
bookType: 'xlsx',
|
||||
type: 'array'
|
||||
});
|
||||
const blob = new Blob([excelBuffer], { type: 'application/octet-stream' });
|
||||
saveAs(blob, '导出成绩.xlsx');
|
||||
};
|
||||
// 导出 Excel 函数
|
||||
const exportWeijiaoTable = () => {
|
||||
// 1. 获取表格数据
|
||||
const data = filteredData.value;
|
||||
|
||||
// 2. 定义表头
|
||||
const headers = columns.value.map(column => column.title);
|
||||
|
||||
// 3. 转换为二维数组
|
||||
const worksheetData = [headers];
|
||||
data.forEach(row => {
|
||||
const rowData = columns.value.map(column => row[column.key]);
|
||||
worksheetData.push(rowData);
|
||||
});
|
||||
|
||||
// 4. 生成 Excel 文件
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(worksheetData);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// 5. 导出文件
|
||||
const excelBuffer = XLSX.write(workbook, {
|
||||
bookType: 'xlsx',
|
||||
type: 'array'
|
||||
});
|
||||
const blob = new Blob([excelBuffer], { type: 'application/octet-stream' });
|
||||
saveAs(blob, '导出未交名单.xlsx');
|
||||
};
|
||||
const rowKey = (rowData) => {
|
||||
return rowData.id
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,6 +161,17 @@ public class ProblemController {
|
|||
problemServiceI.findProblemByCourseIdAndClassId(pmProblem);
|
||||
return RespBean.ok("查询作业列表成功",dataGrid);
|
||||
|
||||
}
|
||||
@PostMapping(
|
||||
"/addTime")
|
||||
public RespBean addTime(@RequestBody PMPostProblem pmPostProblem){
|
||||
int num =
|
||||
problemServiceI.editSubmitReport(pmPostProblem.getEndTime(),pmPostProblem.getProblemId(),pmPostProblem.getStudentId());
|
||||
if(num == 1)
|
||||
return RespBean.ok("加时成功");
|
||||
else
|
||||
return RespBean.error("加时失败");
|
||||
|
||||
}
|
||||
@PostMapping("/findProblemById")
|
||||
public RespBean findProblemById(@RequestBody PMProblem pmProblem){
|
||||
|
|
@ -205,9 +216,9 @@ public class ProblemController {
|
|||
int num =
|
||||
problemServiceI.editPostProblem(pmPostProblem.getClassId(),pmPostProblem.getProblemId(),pmPostProblem.getStartTime(),pmPostProblem.getEndTime(),pmPostProblem.getAllow());
|
||||
if(num == 1)
|
||||
return RespBean.ok("修改课程名称成功");
|
||||
return RespBean.ok("修改作业设置成功");
|
||||
else
|
||||
return RespBean.error("修改课程名称失败");
|
||||
return RespBean.error("修改作业设置失败");
|
||||
}
|
||||
//获取作业列表
|
||||
@GetMapping("/getExamList")
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ import com.example.aes.problem.model.PMStudentSubmit;
|
|||
import com.example.aes.problem.model.SubmitReport;
|
||||
import com.example.aes.user.dao.BaseDaoI;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public interface SubmitReportDaoI extends BaseDaoI<SubmitReport> {
|
||||
public List<Object[]> findWeijiaoList(PMStudentSubmit pmStudentSubmit);
|
||||
public List<Object[]> findYijiaoList(PMStudentSubmit pmStudentSubmit);
|
||||
public int updateAddTime(LocalDateTime addTime,int problemId,int studentId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -336,8 +336,12 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
|||
// "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 " +
|
||||
"left join Classstudents cs" +
|
||||
" " +
|
||||
"on pp.classId=cs.classId " +
|
||||
"LEFT JOIN SubmitReport sr " +
|
||||
"ON cs" +
|
||||
".userId = sr.studentId " +
|
||||
"WHERE pp.classId =:classId "+
|
||||
"AND p.courseId =:courseId "+
|
||||
"AND NOW() < pp.startTime " +
|
||||
|
|
@ -351,12 +355,16 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
|||
// "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 " +
|
||||
"left join Classstudents cs" +
|
||||
" " +
|
||||
"on pp.classId=cs.classId " +
|
||||
"LEFT JOIN SubmitReport sr " +
|
||||
"ON cs" +
|
||||
".userId = sr.studentId " +
|
||||
"WHERE pp.classId =:classId "+
|
||||
"AND p.courseId =:courseId "+
|
||||
"AND NOW() >= pp.startTime " +
|
||||
"and NOW()<=pp.endTime " +
|
||||
" and NOW() BETWEEN pp" +
|
||||
".startTime AND pp.endTime " +
|
||||
"GROUP BY p.id, p.title, pp" +
|
||||
".startTime, pp.endTime";
|
||||
}else if(selectedStatus.equals("completed")){
|
||||
|
|
@ -366,22 +374,28 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
|||
// "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 " +
|
||||
"left join Classstudents cs" +
|
||||
" " +
|
||||
"on pp.classId=cs.classId " +
|
||||
"LEFT JOIN SubmitReport sr " +
|
||||
"ON cs" +
|
||||
".userId = sr.studentId " +
|
||||
"WHERE pp.classId =:classId "+
|
||||
"AND p.courseId = :courseId " +
|
||||
"AND NOW() > endTime " +
|
||||
"GROUP BY p.id, p.title, pp" +
|
||||
".startTime, pp.endTime";
|
||||
"AND NOW() > pp.endTime " + // 确保 endTime 是 pp 的字段
|
||||
"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 " +
|
||||
"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 " +
|
||||
"left join Classstudents cs" +
|
||||
" " +
|
||||
"on pp.classId=cs.classId " +
|
||||
"LEFT JOIN SubmitReport sr " +
|
||||
"ON cs" +
|
||||
".userId = sr.studentId " +
|
||||
"WHERE pp.classId =:classId "+
|
||||
"AND p.courseId =:courseId "+
|
||||
"GROUP BY p.id, p.title, pp" +
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.example.aes.user.dao.impl.BaseDaoImpl;
|
|||
import org.hibernate.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Repository("SubmitReportDao")
|
||||
|
|
@ -22,7 +23,7 @@ String chineseName=
|
|||
String hql="SELECT u.chineseName," +
|
||||
"u.studentNo, sr" +
|
||||
".readTime," +
|
||||
"sr.submissionStatus " +
|
||||
"sr.submissionStatus,u.id " +
|
||||
"FROM Classstudents cs left " +
|
||||
"join Users u on cs" +
|
||||
".userId=u.id "+
|
||||
|
|
@ -36,6 +37,7 @@ String chineseName=
|
|||
"and " +
|
||||
"pp.problemId " +
|
||||
"=:problemId" +
|
||||
" and sr.problemId=:problemId" +
|
||||
" and sr" +
|
||||
".submissionTime is null and " +
|
||||
"u.studentNo like :studentNo " +
|
||||
|
|
@ -57,6 +59,20 @@ String chineseName=
|
|||
return query.getResultList();
|
||||
}
|
||||
@Override
|
||||
public int updateAddTime(LocalDateTime addTime,int problemId,int studentId){
|
||||
String hql= "UPDATE SubmitReport sr SET" +
|
||||
" sr.addTime= :addTime "
|
||||
+ "WHERE sr.problemId = " +
|
||||
":problemId" +
|
||||
" AND sr.studentId= :studentId";
|
||||
Query q = this.getCurrentSession().createQuery(hql);
|
||||
q.setParameter("addTime",addTime);
|
||||
q.setParameter("problemId",problemId);
|
||||
q.setParameter("studentId",studentId);
|
||||
int num = q.executeUpdate();
|
||||
return num;
|
||||
}
|
||||
@Override
|
||||
public List<Object[]> findYijiaoList(PMStudentSubmit pmStudentSubmit){
|
||||
int classId= pmStudentSubmit.getClassId();
|
||||
int problemId= pmStudentSubmit.getProblemId();
|
||||
|
|
@ -70,7 +86,7 @@ String chineseName=
|
|||
"sr.submissionStatus," +
|
||||
" COALESCE(sr.score," +
|
||||
" sr.autoscore) " +
|
||||
"AS finalScore " +
|
||||
"AS finalScore ,u.id " +
|
||||
"FROM Classstudents cs left " +
|
||||
"join Users u on cs" +
|
||||
".userId=u.id "+
|
||||
|
|
@ -84,6 +100,7 @@ String chineseName=
|
|||
"and " +
|
||||
"pp.problemId " +
|
||||
"=:problemId" +
|
||||
" and sr.problemId=:problemId" +
|
||||
" and sr" +
|
||||
".submissionTime is not null " +
|
||||
"and " +
|
||||
|
|
|
|||
|
|
@ -19,4 +19,5 @@ public class PMPostProblem{
|
|||
private LocalDateTime endTime;
|
||||
private List<Integer> classList;
|
||||
private Boolean allow;
|
||||
private int studentId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import java.time.LocalDateTime;
|
|||
|
||||
@Data
|
||||
public class PMStudentSubmit {
|
||||
private int id;
|
||||
private String chineseName;
|
||||
private String studentNo;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
|
|
|||
|
|
@ -316,18 +316,22 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
|||
}
|
||||
}
|
||||
@Override
|
||||
public int editSubmitReport(LocalDateTime addTime,int problemId,int studentId){
|
||||
return studentSubmitDao.updateAddTime(addTime,problemId,studentId);
|
||||
}
|
||||
@Override
|
||||
public DataGrid findProblemByCourseIdAndClassId(PMProblem pmProblem){
|
||||
DataGrid dg = new DataGrid();
|
||||
int totalLines;
|
||||
|
||||
List<Object[]> theProblemList;
|
||||
totalLines= (int) postProblemDao.getPostProblemNum(pmProblem.getCourseId(),pmProblem.getClassId());
|
||||
// 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();
|
||||
int totalLines=theProblemList.size();
|
||||
if ((page-1)*pmProblem.getPageSize()>=totalLines){
|
||||
pmProblem.setPageNum(1);
|
||||
}
|
||||
|
|
@ -520,6 +524,7 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
|||
pmStudentSubmit.setStudentNo((String) p[1]);
|
||||
pmStudentSubmit.setReadTime((LocalDateTime) p[2]);
|
||||
pmStudentSubmit.setSubmissionStatus((String) p[3]);
|
||||
pmStudentSubmit.setId((int) p[4]);
|
||||
pmStudentSubmitList.add(pmStudentSubmit);
|
||||
|
||||
}
|
||||
|
|
@ -536,6 +541,7 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
|||
pmStudentSubmit.setSubmitTime((LocalDateTime) p[2]);
|
||||
pmStudentSubmit.setSubmissionStatus((String) p[3]);
|
||||
pmStudentSubmit.setFinalScore((float) p[4]);
|
||||
pmStudentSubmit.setId((int) p[5]);
|
||||
pmStudentSubmitList.add(pmStudentSubmit);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,4 +49,5 @@ public interface ProblemServiceI {
|
|||
LocalDateTime startTime,LocalDateTime endTime,boolean allow);
|
||||
public DataGrid findWeijiaoList(PMStudentSubmit pmStudentSubmit);
|
||||
public DataGrid findYijiaoList(PMStudentSubmit pmStudentSubmit);
|
||||
public int editSubmitReport(LocalDateTime addTime,int problemId,int studentId);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue