From 79f33983e4cc24f37f7488bdad542f9f19bdb055 Mon Sep 17 00:00:00 2001 From: "1147192855@qq.com" <1147192855@qq.com> Date: Tue, 20 Feb 2024 09:58:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=8A=A5=E5=91=8A=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E9=A1=B5=E9=9D=A2=E5=92=8C=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .../common/model/job/job_report_model.dart | 223 ++++++++++++++++++ .../pages/homework_correction/job_report.dart | 50 ++++ .../lib/utils/request/rest_client.dart | 5 + 4 files changed, 279 insertions(+) create mode 100644 marking_app/lib/common/model/job/job_report_model.dart diff --git a/.gitignore b/.gitignore index abbafd6..4f58acc 100644 --- a/.gitignore +++ b/.gitignore @@ -184,3 +184,4 @@ marking_app/lib/pages/homework_correction/eventBus/do_papers_job_refresh_bus.g.d marking_app/lib/pages/homework_correction/eventBus/job_do_papers_switch_operation_sub_bus.g.dart marking_app/lib/pages/homework_correction/eventBus/job_notes_view_bus.g.dart marking_app/lib/pages/homework_correction/eventBus/job_notes_view_bus.g.dart +marking_app/lib/common/model/job/job_report_model.g.dart diff --git a/marking_app/lib/common/model/job/job_report_model.dart b/marking_app/lib/common/model/job/job_report_model.dart new file mode 100644 index 0000000..b633b13 --- /dev/null +++ b/marking_app/lib/common/model/job/job_report_model.dart @@ -0,0 +1,223 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'job_report_model.g.dart'; + +@JsonSerializable() +class JobReportModel extends Object { + @JsonKey(name: 'studentCount') + int studentCount; + + @JsonKey(name: 'finishRate') + int finishRate; + + @JsonKey(name: 'correctRate') + int correctRate; + + @JsonKey(name: 'errorRate') + int errorRate; + + @JsonKey(name: 'validCount') + int validCount; + + @JsonKey(name: 'allCorrect') + int allCorrect; + + @JsonKey(name: 'passCount') + int passCount; + + @JsonKey(name: 'failCount') + int failCount; + + @JsonKey(name: 'noAnswerCount') + int noAnswerCount; + + @JsonKey(name: 'score') + int score; + + @JsonKey(name: 'scoreTitle') + String scoreTitle; + + @JsonKey(name: 'knowledgeInfos') + List knowledgeInfos; + + @JsonKey(name: 'questionAnswerInfos') + List questionAnswerInfos; + + @JsonKey(name: 'studentAnswerInfos') + List studentAnswerInfos; + + @JsonKey(name: 'overallTitles') + List overallTitles; + + JobReportModel( + this.studentCount, + this.finishRate, + this.correctRate, + this.errorRate, + this.validCount, + this.allCorrect, + this.passCount, + this.failCount, + this.noAnswerCount, + this.score, + this.scoreTitle, + this.knowledgeInfos, + this.questionAnswerInfos, + this.studentAnswerInfos, + this.overallTitles, + ); + + factory JobReportModel.fromJson(Map srcJson) => _$JobReportModelFromJson(srcJson); + + Map toJson() => _$JobReportModelToJson(this); +} + +@JsonSerializable() +class KnowledgeInfos extends Object { + @JsonKey(name: 'knowledgeId') + int knowledgeId; + + @JsonKey(name: 'knowledgeName') + String knowledgeName; + + @JsonKey(name: 'rate') + int rate; + + KnowledgeInfos( + this.knowledgeId, + this.knowledgeName, + this.rate, + ); + + factory KnowledgeInfos.fromJson(Map srcJson) => _$KnowledgeInfosFromJson(srcJson); + + Map toJson() => _$KnowledgeInfosToJson(this); +} + +@JsonSerializable() +class QuestionAnswerInfos extends Object { + @JsonKey(name: 'questionId') + int questionId; + + @JsonKey(name: 'questionType') + int questionType; + + @JsonKey(name: 'partName') + String partName; + + @JsonKey(name: 'questionNo') + String questionNo; + + @JsonKey(name: 'finishInfos') + List finishInfos; + + @JsonKey(name: 'correctRate') + int correctRate; + + @JsonKey(name: 'errorRate') + int errorRate; + + @JsonKey(name: 'noAnswerRate') + int noAnswerRate; + + QuestionAnswerInfos( + this.questionId, + this.questionType, + this.partName, + this.questionNo, + this.finishInfos, + this.correctRate, + this.errorRate, + this.noAnswerRate, + ); + + factory QuestionAnswerInfos.fromJson(Map srcJson) => _$QuestionAnswerInfosFromJson(srcJson); + + Map toJson() => _$QuestionAnswerInfosToJson(this); +} + +@JsonSerializable() +class FinishInfos extends Object { + @JsonKey(name: 'title') + String title; + + @JsonKey(name: 'finishCount') + int finishCount; + + @JsonKey(name: 'correctRate') + int correctRate; + + FinishInfos( + this.title, + this.finishCount, + this.correctRate, + ); + + factory FinishInfos.fromJson(Map srcJson) => _$FinishInfosFromJson(srcJson); + + Map toJson() => _$FinishInfosToJson(this); +} + +@JsonSerializable() +class StudentAnswerInfos extends Object { + @JsonKey(name: 'studentId') + int studentId; + + @JsonKey(name: 'studentName') + String studentName; + + @JsonKey(name: 'useTime') + int useTime; + + @JsonKey(name: 'correctRate') + int correctRate; + + @JsonKey(name: 'finishRate') + int finishRate; + + @JsonKey(name: 'noAnswerCount') + int noAnswerCount; + + @JsonKey(name: 'ranking') + int ranking; + + @JsonKey(name: 'score') + int score; + + @JsonKey(name: 'scoreTitle') + String scoreTitle; + + StudentAnswerInfos( + this.studentId, + this.studentName, + this.useTime, + this.correctRate, + this.finishRate, + this.noAnswerCount, + this.ranking, + this.score, + this.scoreTitle, + ); + + factory StudentAnswerInfos.fromJson(Map srcJson) => _$StudentAnswerInfosFromJson(srcJson); + + Map toJson() => _$StudentAnswerInfosToJson(this); +} + +@JsonSerializable() +class OverallTitles extends Object { + @JsonKey(name: 'title') + String title; + + @JsonKey(name: 'count') + int count; + + OverallTitles( + this.title, + this.count, + ); + + factory OverallTitles.fromJson(Map srcJson) => _$OverallTitlesFromJson(srcJson); + + Map toJson() => _$OverallTitlesToJson(this); +} diff --git a/marking_app/lib/pages/homework_correction/job_report.dart b/marking_app/lib/pages/homework_correction/job_report.dart index 8b13789..3ee26f8 100644 --- a/marking_app/lib/pages/homework_correction/job_report.dart +++ b/marking_app/lib/pages/homework_correction/job_report.dart @@ -1 +1,51 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:marking_app/common/mixin/common.dart'; +import 'package:marking_app/common/model/common/base_structure_result.dart'; +import 'package:marking_app/common/model/job/job_report_model.dart'; +import 'package:marking_app/utils/my_future_builder.dart'; +import 'package:marking_app/utils/my_text.dart'; +import 'package:marking_app/utils/request/rest_client.dart'; +/// 作业报告 +class JobReport extends StatefulWidget { + final int id; + final String title; + const JobReport({required this.id, required this.title, super.key}); + + @override + State createState() => _JobReportState(); +} + +class _JobReportState extends State with CommonMixin { + late Future _future; // 考试试卷 + + @override + void initState() { + _future = getReport(widget.id); + super.initState(); + } + + Future getReport(int jobid) async { + try { + RestClient _client = await getClient(); + BaseStructureResult data = await _client.getJobReport(jobid); + if (data.success) { + throw Exception(data.message ?? '获取报告失败'); + } + return data.data; + } catch (e) {} + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: quickText(widget.title, size: 18.sp, color: Colors.white), + ), + body: MyFutureBuilder.buildFutureBuilderOfSingleInstance(context, _future, (data) { + return Container(); + }), + ); + } +} diff --git a/marking_app/lib/utils/request/rest_client.dart b/marking_app/lib/utils/request/rest_client.dart index 56eb8b5..3b6d150 100644 --- a/marking_app/lib/utils/request/rest_client.dart +++ b/marking_app/lib/utils/request/rest_client.dart @@ -17,6 +17,7 @@ import 'package:marking_app/common/model/job/job_concerned_with_student.dart'; import 'package:marking_app/common/model/job/job_concerned_with_student_params.dart'; import 'package:marking_app/common/model/job/job_note_taking_trajectory.dart'; import 'package:marking_app/common/model/job/job_page_tab.dart'; +import 'package:marking_app/common/model/job/job_report_model.dart'; import 'package:marking_app/common/model/job/job_review_submission.dart'; import 'package:marking_app/common/model/job/job_task_item.dart'; import 'package:marking_app/common/model/job/marking_text_question_job.dart'; @@ -247,4 +248,8 @@ abstract class RestClient { // 作业 => 一键批阅 @the_retrofit.POST("${RequestConfig.hwProxyKeywords}/api/Marking/auto") Future> toJobOneClickReview(@the_retrofit.Field() int taskId); + + // 作业 => 一键批阅 + @the_retrofit.GET("${RequestConfig.hwProxyKeywords}/api/Marking/auto") + Future> getJobReport(@the_retrofit.Field() int jobId); }