Explorar el Código

修改学生端约课页面声部接口

Pq hace 3 meses
padre
commit
d73504535a

+ 7 - 1
BaseLibrary/src/main/java/com/cooleshow/base/bean/SubjectListBean.java

@@ -1,5 +1,6 @@
 package com.cooleshow.base.bean;
 
+import com.contrarywind.interfaces.IPickerViewData;
 import com.cooleshow.base.iml.ICommonFilterData;
 
 import java.util.ArrayList;
@@ -105,7 +106,7 @@ public class SubjectListBean {
         this.rows = rows;
     }
 
-    public static class RowsBean implements ICommonFilterData {
+    public static class RowsBean implements ICommonFilterData, IPickerViewData {
         /**
          * aiDefaultFrequency : 440
          * code : Flute
@@ -239,5 +240,10 @@ public class SubjectListBean {
         public void setUpdateTime(String updateTime) {
             this.updateTime = updateTime;
         }
+
+        @Override
+        public String getPickerViewText() {
+            return getName();
+        }
     }
 }

+ 11 - 0
student/src/main/java/com/cooleshow/student/api/APIService.java

@@ -8,6 +8,7 @@ import static com.cooleshow.base.common.BaseConstant.TEACHER_GROUP;
 
 import com.cooleshow.base.bean.CommonCourseConfigBean;
 import com.cooleshow.base.bean.QueryParamsConfigBean;
+import com.cooleshow.base.bean.SubjectListBean;
 import com.cooleshow.base.bean.TeachableInstrumentBean;
 import com.cooleshow.base.data.net.BaseResponse;
 import com.cooleshow.student.bean.AddressBean;
@@ -265,6 +266,16 @@ public interface APIService {
     @POST(STUDENT_GROUP + "student/querySubjectItem")
     Observable<BaseResponse<List<QuerySubjectBean>>> querySubjectItem();
 
+
+    /**
+     * 获取声部
+     *
+     * @return
+     */
+    @GET(STUDENT_GROUP+"open/subject/queryPage")
+    Observable<BaseResponse<SubjectListBean>> queryAllSubjectItem(@Query("queryType") String queryType, @Query("page") int page, @Query("rows") int rows);
+
+
     /**
      * 课后作业
      *

+ 22 - 0
student/src/main/java/com/cooleshow/student/contract/AppointCourseContract.java

@@ -0,0 +1,22 @@
+package com.cooleshow.student.contract;
+
+import com.cooleshow.base.bean.SubjectListBean;
+import com.cooleshow.base.presenter.view.BaseView;
+import com.cooleshow.student.bean.QuerySubjectBean;
+
+import java.util.List;
+
+/**
+ * 创建日期:2022/5/30 9:26
+ *
+ * @author Ryan
+ * 类说明:
+ */
+public interface AppointCourseContract {
+    interface View extends BaseView {
+        void querySubjectItemSuccess(SubjectListBean data);
+    }
+
+    interface Presenter {
+    }
+}

+ 37 - 0
student/src/main/java/com/cooleshow/student/presenter/course/AppointCoursePresenter.java

@@ -0,0 +1,37 @@
+package com.cooleshow.student.presenter.course;
+
+import com.cooleshow.base.bean.SubjectListBean;
+import com.cooleshow.base.presenter.BasePresenter;
+import com.cooleshow.base.rx.BaseObserver;
+import com.cooleshow.student.api.APIService;
+import com.cooleshow.student.bean.QuerySubjectBean;
+import com.cooleshow.student.contract.AppointCourseContract;
+import com.cooleshow.student.contract.MineCourseContract;
+
+import java.util.List;
+
+/**
+ * 创建日期:2022/5/30 9:25
+ *
+ * @author Ryan
+ * 类说明:
+ */
+public class AppointCoursePresenter extends BasePresenter<AppointCourseContract.View> implements AppointCourseContract.Presenter {
+
+    public void querySubjectItem() {
+        addSubscribe(create(APIService.class).queryAllSubjectItem("list", 1, Integer.MAX_VALUE), new BaseObserver<SubjectListBean>(getView()) {
+            @Override
+            protected void onSuccess(SubjectListBean data) {
+                if (getView() != null) {
+                    getView().querySubjectItemSuccess(data);
+                }
+            }
+
+            @Override
+            public void onError(Throwable e) {
+                super.onError(e);
+
+            }
+        });
+    }
+}

+ 10 - 4
student/src/main/java/com/cooleshow/student/ui/course/AppointmentCourseActivity.java

@@ -8,6 +8,7 @@ import android.view.View;
 import android.widget.TextView;
 
 import com.alibaba.android.arouter.facade.annotation.Route;
+import com.cooleshow.base.bean.SubjectListBean;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.ui.fragment.BaseMVPFragment;
@@ -16,9 +17,11 @@ import com.cooleshow.musicmerge.adapter.MyWorkPagerAdapter;
 import com.cooleshow.student.R;
 import com.cooleshow.student.adapter.MineCoursePagerAdapter;
 import com.cooleshow.student.bean.QuerySubjectBean;
+import com.cooleshow.student.contract.AppointCourseContract;
 import com.cooleshow.student.contract.MineCourseContract;
 import com.cooleshow.student.databinding.ActivityAppointmentCourseBinding;
 import com.cooleshow.student.databinding.ActivityMineCourseBinding;
+import com.cooleshow.student.presenter.course.AppointCoursePresenter;
 import com.cooleshow.student.presenter.course.MineCoursePresenter;
 import com.cooleshow.student.widgets.dialog.CourseTipDialog;
 import com.google.android.material.tabs.TabLayout;
@@ -41,7 +44,7 @@ import androidx.viewpager2.widget.ViewPager2;
  * 类说明:
  */
 @Route(path = RouterPath.CourseCenter.APPOINTMENT_COURSE)
-public class AppointmentCourseActivity extends BaseMVPActivity<ActivityAppointmentCourseBinding, MineCoursePresenter> implements MineCourseContract.MineCourseView, View.OnClickListener {
+public class AppointmentCourseActivity extends BaseMVPActivity<ActivityAppointmentCourseBinding, AppointCoursePresenter> implements AppointCourseContract.View, View.OnClickListener {
     public static final String SELECT_POSITION = "selectPosition";
     private TabLayout tabLayout;
     private ViewPager2 viewPager;
@@ -78,8 +81,8 @@ public class AppointmentCourseActivity extends BaseMVPActivity<ActivityAppointme
     }
 
     @Override
-    protected MineCoursePresenter createPresenter() {
-        return new MineCoursePresenter();
+    protected AppointCoursePresenter createPresenter() {
+        return new AppointCoursePresenter();
     }
 
     @Override
@@ -168,7 +171,7 @@ public class AppointmentCourseActivity extends BaseMVPActivity<ActivityAppointme
     }
 
     @Override
-    public void querySubjectItemSuccess(List<QuerySubjectBean> data) {
+    public void querySubjectItemSuccess(SubjectListBean data) {
         if (mVipCustomCourseListFragment != null) {
             mVipCustomCourseListFragment.querySubjectItemSuccess(data);
         }
@@ -183,6 +186,7 @@ public class AppointmentCourseActivity extends BaseMVPActivity<ActivityAppointme
         }
     }
 
+
     private TabLayout.Tab createTab(TabLayout.Tab tab, String text) {
         View view = LayoutInflater.from(this).inflate(R.layout.view_appoint_course_tab_layout, null);
         TextView tv_text = view.findViewById(R.id.tv_text);
@@ -210,4 +214,6 @@ public class AppointmentCourseActivity extends BaseMVPActivity<ActivityAppointme
         }
         mCourseTipDialog.setSelect(currentPos);
     }
+
+
 }

+ 16 - 10
student/src/main/java/com/cooleshow/student/ui/course/InterestCorrectionCourseListFragment.java

@@ -9,6 +9,7 @@ import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
 import com.bigkoo.pickerview.listener.OnDismissListener;
 import com.bigkoo.pickerview.view.OptionsPickerView;
 import com.cooleshow.base.bean.DataSortBean;
+import com.cooleshow.base.bean.SubjectListBean;
 import com.cooleshow.base.constanst.Constants;
 import com.cooleshow.base.constanst.DataSortType;
 import com.cooleshow.base.ui.fragment.BaseMVPFragment;
@@ -42,7 +43,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
  * 趣纠课约课
  */
 public class InterestCorrectionCourseListFragment extends BaseMVPFragment<FgInterestCorrectionCourseListLayoutBinding, InterestCorrectionCourseListPresenter> implements InterestCorrectionCourseListContract.View, View.OnClickListener {
-    private List<QuerySubjectBean> subjectBeanList = new ArrayList<>();
+    private List<SubjectListBean.RowsBean> subjectBeanList = new ArrayList<>();
     private OptionsPickerView pvOptions;
     private int currentSelectSubjectPosition = -1;
     private String currentSubjectId;
@@ -161,7 +162,7 @@ public class InterestCorrectionCourseListFragment extends BaseMVPFragment<FgInte
         if (pvOptions == null) {
             pvOptions = new OptionsPickerBuilder(getContext(), (options1, options2, options3, v) -> {
                 this.currentSelectSubjectPosition = options1;
-                QuerySubjectBean subjectBean = subjectBeanList.get(options1);
+                SubjectListBean.RowsBean subjectBean = subjectBeanList.get(options1);
                 this.currentSubjectId = subjectBean.getId();
                 mViewBinding.tvFilter.setText(subjectBean.getPickerViewText());
                 currentPage = 1;
@@ -245,14 +246,19 @@ public class InterestCorrectionCourseListFragment extends BaseMVPFragment<FgInte
         mViewBinding.refreshLayout.setNoMoreData(!hasNext);
     }
 
-    public void querySubjectItemSuccess(List<QuerySubjectBean> data) {
-        subjectBeanList.clear();
-        subjectBeanList.addAll(data);
-        String subjectId = UserHelper.getSubjectId();
-        for (int i = 0; i < data.size(); i++) {
-            QuerySubjectBean querySubjectBean = data.get(i);
-            if (TextUtils.equals(subjectId, querySubjectBean.getId())) {
-                currentSelectSubjectPosition = i;
+    public void querySubjectItemSuccess(SubjectListBean subjectListBean) {
+        ArrayList<SubjectListBean.RowsBean> data = subjectListBean.getRows();
+        if(data!=null){
+            subjectBeanList.clear();
+            subjectBeanList.addAll(data);
+            if (currentSelectSubjectPosition == -1) {
+                String subjectId = UserHelper.getSubjectId();
+                for (int i = 0; i < data.size(); i++) {
+                    SubjectListBean.RowsBean rowsBean = data.get(i);
+                    if (TextUtils.equals(subjectId, rowsBean.getId())) {
+                        currentSelectSubjectPosition = i;
+                    }
+                }
             }
         }
     }

+ 19 - 5
student/src/main/java/com/cooleshow/student/ui/course/LiveCourseAppointListFragment.java

@@ -1,12 +1,14 @@
 package com.cooleshow.student.ui.course;
 
 import android.graphics.Color;
+import android.text.TextUtils;
 import android.view.View;
 import android.widget.TextView;
 
 import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
 import com.bigkoo.pickerview.listener.OnDismissListener;
 import com.bigkoo.pickerview.view.OptionsPickerView;
+import com.cooleshow.base.bean.SubjectListBean;
 import com.cooleshow.base.constanst.Constants;
 import com.cooleshow.base.ui.fragment.BaseMVPFragment;
 import com.cooleshow.base.utils.LOG;
@@ -38,7 +40,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
  * 直播课约课
  */
 public class LiveCourseAppointListFragment extends BaseMVPFragment<FgLiveCourseAppointListLayoutBinding, LiveCourseAppointListPresenter> implements LiveCourseAppointListContract.View, View.OnClickListener {
-    private List<QuerySubjectBean> subjectBeanList = new ArrayList<>();
+    private List<SubjectListBean.RowsBean> subjectBeanList = new ArrayList<>();
     private LiveCourseAppointAdapter mAdapter;
     private OptionsPickerView pvOptions;
     private int currentSelectSubjectPosition = -1;
@@ -108,9 +110,21 @@ public class LiveCourseAppointListFragment extends BaseMVPFragment<FgLiveCourseA
         return new LiveCourseAppointListPresenter();
     }
 
-    public void querySubjectItemSuccess(List<QuerySubjectBean> data) {
-        subjectBeanList.clear();
-        subjectBeanList.addAll(data);
+    public void querySubjectItemSuccess(SubjectListBean subjectListBean) {
+        ArrayList<SubjectListBean.RowsBean> data = subjectListBean.getRows();
+        if (data != null) {
+            subjectBeanList.clear();
+            subjectBeanList.addAll(data);
+            if (currentSelectSubjectPosition == -1) {
+                String subjectId = UserHelper.getSubjectId();
+                for (int i = 0; i < data.size(); i++) {
+                    SubjectListBean.RowsBean rowsBean = data.get(i);
+                    if (TextUtils.equals(subjectId, rowsBean.getId())) {
+                        currentSelectSubjectPosition = i;
+                    }
+                }
+            }
+        }
     }
 
     @Override
@@ -195,7 +209,7 @@ public class LiveCourseAppointListFragment extends BaseMVPFragment<FgLiveCourseA
         if (pvOptions == null) {
             pvOptions = new OptionsPickerBuilder(getContext(), (options1, options2, options3, v) -> {
                 this.currentSelectSubjectPosition = options1;
-                QuerySubjectBean subjectBean = subjectBeanList.get(options1);
+                SubjectListBean.RowsBean subjectBean = subjectBeanList.get(options1);
                 this.currentSubjectId = subjectBean.getId();
                 mViewBinding.tvFilter.setText(subjectBean.getPickerViewText());
                 currentPage = 1;

+ 16 - 10
student/src/main/java/com/cooleshow/student/ui/course/VIPCustomCourseListFragment.java

@@ -9,6 +9,7 @@ import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
 import com.bigkoo.pickerview.listener.OnDismissListener;
 import com.bigkoo.pickerview.view.OptionsPickerView;
 import com.cooleshow.base.bean.DataSortBean;
+import com.cooleshow.base.bean.SubjectListBean;
 import com.cooleshow.base.constanst.Constants;
 import com.cooleshow.base.constanst.DataSortType;
 import com.cooleshow.base.ui.fragment.BaseMVPFragment;
@@ -39,7 +40,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
  * VIP定制课约课
  */
 public class VIPCustomCourseListFragment extends BaseMVPFragment<FgVipCustomCourseListLayoutBinding, VIPCustomCourseListPresenter> implements View.OnClickListener, VIPCustomCourseListContract.VIPCustomCourseView {
-    private List<QuerySubjectBean> subjectList = new ArrayList<>();
+    private List<SubjectListBean.RowsBean> subjectList = new ArrayList<>();
     private OptionsPickerView pvOptions;
     private int currentSelectSubjectPosition = -1;
     private String currentSubjectId;
@@ -136,14 +137,19 @@ public class VIPCustomCourseListFragment extends BaseMVPFragment<FgVipCustomCour
         return new VIPCustomCourseListPresenter();
     }
 
-    public void querySubjectItemSuccess(List<QuerySubjectBean> data) {
-        subjectList.clear();
-        subjectList.addAll(data);
-        String subjectId = UserHelper.getSubjectId();
-        for (int i = 0; i < data.size(); i++) {
-            QuerySubjectBean querySubjectBean = data.get(i);
-            if (TextUtils.equals(subjectId, querySubjectBean.getId())) {
-                currentSelectSubjectPosition = i;
+    public void querySubjectItemSuccess(SubjectListBean subjectListBean) {
+        ArrayList<SubjectListBean.RowsBean> data = subjectListBean.getRows();
+        if(data!=null){
+            subjectList.clear();
+            subjectList.addAll(data);
+            if (currentSelectSubjectPosition == -1) {
+                String subjectId = UserHelper.getSubjectId();
+                for (int i = 0; i < data.size(); i++) {
+                    SubjectListBean.RowsBean rowsBean = data.get(i);
+                    if (TextUtils.equals(subjectId, rowsBean.getId())) {
+                        currentSelectSubjectPosition = i;
+                    }
+                }
             }
         }
     }
@@ -170,7 +176,7 @@ public class VIPCustomCourseListFragment extends BaseMVPFragment<FgVipCustomCour
         if (pvOptions == null) {
             pvOptions = new OptionsPickerBuilder(getContext(), (options1, options2, options3, v) -> {
                 this.currentSelectSubjectPosition = options1;
-                QuerySubjectBean subjectBean = subjectList.get(options1);
+                SubjectListBean.RowsBean subjectBean = subjectList.get(options1);
                 this.currentSubjectId = subjectBean.getId();
                 mViewBinding.tvFilter.setText(subjectBean.getPickerViewText());
                 currentPage = 1;

+ 16 - 10
student/src/main/java/com/cooleshow/student/ui/course/VideoCourseAppointListFragment.java

@@ -8,6 +8,7 @@ import android.widget.TextView;
 import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
 import com.bigkoo.pickerview.listener.OnDismissListener;
 import com.bigkoo.pickerview.view.OptionsPickerView;
+import com.cooleshow.base.bean.SubjectListBean;
 import com.cooleshow.base.constanst.Constants;
 import com.cooleshow.base.ui.fragment.BaseMVPFragment;
 import com.cooleshow.base.utils.LOG;
@@ -40,7 +41,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
  * 视频课约课
  */
 public class VideoCourseAppointListFragment extends BaseMVPFragment<FgVideoCourseAppointListLayoutBinding, VideoCourseAppointListPresenter> implements VideoCourseAppointListContract.View, View.OnClickListener {
-    private List<QuerySubjectBean> subjectBeanList = new ArrayList<>();
+    private List<SubjectListBean.RowsBean> subjectBeanList = new ArrayList<>();
     private OptionsPickerView pvOptions;
     private int currentSelectSubjectPosition = -1;
     private String currentSubjectId;
@@ -118,14 +119,19 @@ public class VideoCourseAppointListFragment extends BaseMVPFragment<FgVideoCours
         return new VideoCourseAppointListPresenter();
     }
 
-    public void querySubjectItemSuccess(List<QuerySubjectBean> data) {
-        subjectBeanList.clear();
-        subjectBeanList.addAll(data);
-        String subjectId = UserHelper.getSubjectId();
-        for (int i = 0; i < data.size(); i++) {
-            QuerySubjectBean querySubjectBean = data.get(i);
-            if (TextUtils.equals(subjectId, querySubjectBean.getId())) {
-                currentSelectSubjectPosition = i;
+    public void querySubjectItemSuccess(SubjectListBean subjectListBean) {
+        ArrayList<SubjectListBean.RowsBean> data = subjectListBean.getRows();
+        if (data != null) {
+            subjectBeanList.clear();
+            subjectBeanList.addAll(data);
+            if (currentSelectSubjectPosition == -1) {
+                String subjectId = UserHelper.getSubjectId();
+                for (int i = 0; i < data.size(); i++) {
+                    SubjectListBean.RowsBean rowsBean = data.get(i);
+                    if (TextUtils.equals(subjectId, rowsBean.getId())) {
+                        currentSelectSubjectPosition = i;
+                    }
+                }
             }
         }
     }
@@ -152,7 +158,7 @@ public class VideoCourseAppointListFragment extends BaseMVPFragment<FgVideoCours
         if (pvOptions == null) {
             pvOptions = new OptionsPickerBuilder(getContext(), (options1, options2, options3, v) -> {
                 this.currentSelectSubjectPosition = options1;
-                QuerySubjectBean subjectBean = subjectBeanList.get(options1);
+                SubjectListBean.RowsBean subjectBean = subjectBeanList.get(options1);
                 this.currentSubjectId = subjectBean.getId();
                 mViewBinding.tvFilter.setText(subjectBean.getPickerViewText());
                 currentPage = 1;