job_report #1

Merged
wangyang merged 4 commits from job_report into main 2024-02-26 10:52:00 +08:00
4 changed files with 279 additions and 0 deletions
Showing only changes of commit 79f33983e4 - Show all commits

1
.gitignore vendored
View File

@ -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_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/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

View File

@ -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> knowledgeInfos;
@JsonKey(name: 'questionAnswerInfos')
List<QuestionAnswerInfos> questionAnswerInfos;
@JsonKey(name: 'studentAnswerInfos')
List<StudentAnswerInfos> studentAnswerInfos;
@JsonKey(name: 'overallTitles')
List<OverallTitles> 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<String, dynamic> srcJson) => _$JobReportModelFromJson(srcJson);
Map<String, dynamic> 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<String, dynamic> srcJson) => _$KnowledgeInfosFromJson(srcJson);
Map<String, dynamic> 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> 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<String, dynamic> srcJson) => _$QuestionAnswerInfosFromJson(srcJson);
Map<String, dynamic> 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<String, dynamic> srcJson) => _$FinishInfosFromJson(srcJson);
Map<String, dynamic> 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<String, dynamic> srcJson) => _$StudentAnswerInfosFromJson(srcJson);
Map<String, dynamic> 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<String, dynamic> srcJson) => _$OverallTitlesFromJson(srcJson);
Map<String, dynamic> toJson() => _$OverallTitlesToJson(this);
}

View File

@ -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<JobReport> createState() => _JobReportState();
}
class _JobReportState extends State<JobReport> with CommonMixin {
late Future<JobReportModel?> _future; //
@override
void initState() {
_future = getReport(widget.id);
super.initState();
}
Future<JobReportModel?> getReport(int jobid) async {
try {
RestClient _client = await getClient();
BaseStructureResult<JobReportModel?> 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<JobReportModel>(context, _future, (data) {
return Container();
}),
);
}
}

View File

@ -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_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_note_taking_trajectory.dart';
import 'package:marking_app/common/model/job/job_page_tab.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_review_submission.dart';
import 'package:marking_app/common/model/job/job_task_item.dart'; import 'package:marking_app/common/model/job/job_task_item.dart';
import 'package:marking_app/common/model/job/marking_text_question_job.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") @the_retrofit.POST("${RequestConfig.hwProxyKeywords}/api/Marking/auto")
Future<BaseStructureResult<bool>> toJobOneClickReview(@the_retrofit.Field() int taskId); Future<BaseStructureResult<bool>> toJobOneClickReview(@the_retrofit.Field() int taskId);
// =>
@the_retrofit.GET("${RequestConfig.hwProxyKeywords}/api/Marking/auto")
Future<BaseStructureResult<JobReportModel>> getJobReport(@the_retrofit.Field() int jobId);
} }