瀏覽代碼

教师功能Complete

bfzgs 2 年之前
父節點
當前提交
caf2281e33

+ 8 - 15
app/src/main/java/org/brynhild/graduation/activity/teacher/ui/sign/SignInFragment.kt

@@ -20,10 +20,12 @@ import org.brynhild.graduation.common.transfer.dto.FileInfo
 import org.brynhild.graduation.common.transfer.handler.ResponseHandler
 import org.brynhild.graduation.common.transfer.utils.ServiceCreator
 import org.brynhild.graduation.common.transfer.vo.timetable.AdminQueryStudentStatistic
+import org.brynhild.graduation.common.transfer.vo.timetable.QueryTeachingCourseStatisticRequest
 import org.brynhild.graduation.common.utils.FileDownloadUtil
 import org.brynhild.graduation.common.utils.JsonUtils
 import org.brynhild.graduation.databinding.FragmentSignInTeacherBinding
 import org.brynhild.graduation.service.http.CommonService
+import org.brynhild.graduation.service.http.TeacherService
 import retrofit2.Call
 import retrofit2.Callback
 import retrofit2.Response
@@ -31,9 +33,6 @@ import retrofit2.Response
 class SignInFragment : Fragment() {
 
         private var _binding: FragmentSignInTeacherBinding? = null
-
-    // This property is only valid between onCreateView and
-    // onDestroyView.
     private val binding get() = _binding!!
 
     @SuppressLint("SetJavaScriptEnabled")
@@ -45,7 +44,6 @@ class SignInFragment : Fragment() {
 
         _binding = FragmentSignInTeacherBinding.inflate(inflater, container, false)
         val root: View = binding.root
-
         val webSettings: WebSettings = binding.backupChart.settings
         webSettings.domStorageEnabled = true
         webSettings.javaScriptEnabled = true
@@ -60,9 +58,7 @@ class SignInFragment : Fragment() {
                 loadStatisticInfo()
             }
         }
-
         bindOnClick()
-
         return root
     }
 
@@ -73,7 +69,7 @@ class SignInFragment : Fragment() {
 
     private fun bindOnClick(){
         binding.downloadStatistic.setOnClickListener {
-            val service= ServiceCreator.create(CommonService::class.java)
+            val service= ServiceCreator.create(TeacherService::class.java)
             val handler=object: Callback<Result> {
                 override fun onResponse(call: Call<Result>, response: Response<Result>) {
                     ResponseHandler.handle(response,{
@@ -98,21 +94,18 @@ class SignInFragment : Fragment() {
                         ResponseHandler.showMessage(it)
                     })
                 }
-
                 override fun onFailure(call: Call<Result>, t: Throwable) {
                     t.printStackTrace()
                 }
             }
-
-            val data= AdminQueryStudentStatistic(LoginConfiguration.userInfo!!.user.id)
-            service.generateStudentStatistic(LoginConfiguration.userInfo!!.token,data).enqueue(handler)
-
+            val data= QueryTeachingCourseStatisticRequest(LoginConfiguration.userInfo!!.user.id)
+            service.generateTeachingCourseStatistic(LoginConfiguration.userInfo!!.token,data).enqueue(handler)
         }
     }
 
 
     private fun loadStatisticInfo() {
-        val service= ServiceCreator.create(CommonService::class.java)
+        val service= ServiceCreator.create(TeacherService::class.java)
         val handler=object: Callback<Result> {
             override fun onResponse(call: Call<Result>, response: Response<Result>) {
                 ResponseHandler.handle(response,{
@@ -137,8 +130,8 @@ class SignInFragment : Fragment() {
             }
         }
 
-        val data= AdminQueryStudentStatistic(LoginConfiguration.userInfo!!.user.id)
-        service.queryStudentStatistic(LoginConfiguration.userInfo!!.token,data).enqueue(handler)
+        val data= QueryTeachingCourseStatisticRequest(LoginConfiguration.userInfo!!.user.id)
+        service.queryTeachingCourseStatistic(LoginConfiguration.userInfo!!.token,data).enqueue(handler)
 
     }
 

+ 5 - 0
app/src/main/java/org/brynhild/graduation/common/transfer/vo/timetable/QueryTeachingCourseStatisticRequest.kt

@@ -0,0 +1,5 @@
+package org.brynhild.graduation.common.transfer.vo.timetable
+
+data class QueryTeachingCourseStatisticRequest(
+    val id:Long
+)

+ 13 - 0
app/src/main/java/org/brynhild/graduation/service/http/TeacherService.kt

@@ -4,6 +4,7 @@ import org.brynhild.graduation.common.constant.AccountConstant
 import org.brynhild.graduation.common.transfer.Result
 import org.brynhild.graduation.common.transfer.vo.device.QuerySignInRecordRequest
 import org.brynhild.graduation.common.transfer.vo.timetable.QueryTeachingClassRequest
+import org.brynhild.graduation.common.transfer.vo.timetable.QueryTeachingCourseStatisticRequest
 import org.brynhild.graduation.common.transfer.vo.timetable.QueryTimeTableRequest
 import org.brynhild.graduation.common.transfer.vo.user.QueryUserRequest
 import retrofit2.Call
@@ -30,4 +31,16 @@ interface TeacherService {
         @Header(AccountConstant.ACCOUNT_HEADER) token: String,
         @Body info: QueryUserRequest
     ): Call<Result>
+
+    @POST("timetable/teacher/statistic")
+    fun queryTeachingCourseStatistic(
+        @Header(AccountConstant.ACCOUNT_HEADER) token: String,
+        @Body info: QueryTeachingCourseStatisticRequest
+    ): Call<Result>
+
+    @POST("timetable/teacher/statistic/generate")
+    fun generateTeachingCourseStatistic(
+        @Header(AccountConstant.ACCOUNT_HEADER) token: String,
+        @Body info: QueryTeachingCourseStatisticRequest
+    ): Call<Result>
 }