Jelajahi Sumber

修改学生端约课默认参数传参

Pq 7 bulan lalu
induk
melakukan
3d4928bc41

+ 5 - 1
student/src/main/java/com/cooleshow/student/contract/InterestCorrectionCourseListContract.java

@@ -1,6 +1,7 @@
 package com.cooleshow.student.contract;
 
 import com.cooleshow.base.presenter.view.BaseView;
+import com.cooleshow.student.bean.AppointCourseTeacherListBean;
 
 /**
  * Author by pq, Date on 2022/4/20.
@@ -9,9 +10,12 @@ public interface InterestCorrectionCourseListContract {
 
     interface View extends BaseView {
 
+        void onGetTeacherListSuccess(int page, AppointCourseTeacherListBean data);
+
+        void onGetTeacherListError(int page);
+
     }
 
     interface Presenter {
-        void queryVideoCourse(boolean isShowLoading, String studentId,int subjectId, int page);
     }
 }

+ 24 - 9
student/src/main/java/com/cooleshow/student/presenter/course/InterestCorrectionCourseListPresenter.java

@@ -1,10 +1,13 @@
 package com.cooleshow.student.presenter.course;
 
+import android.text.TextUtils;
+
 import com.cooleshow.base.constanst.Constants;
 import com.cooleshow.base.presenter.BasePresenter;
 import com.cooleshow.base.rx.BaseObserver;
 import com.cooleshow.base.utils.RequestBodyUtil;
 import com.cooleshow.student.api.APIService;
+import com.cooleshow.student.bean.AppointCourseTeacherListBean;
 import com.cooleshow.student.bean.SelectMyGroupBean;
 import com.cooleshow.student.contract.InterestCorrectionCourseListContract;
 import com.cooleshow.student.contract.VIPCustomCourseListContract;
@@ -19,28 +22,40 @@ import org.json.JSONObject;
  */
 public class InterestCorrectionCourseListPresenter extends BasePresenter<InterestCorrectionCourseListContract.View> implements InterestCorrectionCourseListContract.Presenter {
 
-    @Override
-    public void queryVideoCourse(boolean isShowLoading, String studentId,int subjectId, int page) {
+    public void queryCourseTeachers(boolean isShowLoading, String subjectId, String sortField, String sortRule, String search, boolean isRecentFreeTime, int page) {
         if (isShowLoading && getView() != null) {
             getView().showLoading();
         }
         JSONObject jsonObject = new JSONObject();
         try {
-            if (subjectId != 0) {
+            //类型
+            jsonObject.putOpt("courseType", "PRACTICE");
+            if (!TextUtils.isEmpty(subjectId)) {
+                //声部id
                 jsonObject.putOpt("subjectId", subjectId);
             }
-            jsonObject.putOpt("platform", "android");
-            jsonObject.putOpt("version", "1");
+            if (isRecentFreeTime) {
+                //最近三十天有空
+                jsonObject.putOpt("recentFreeTime", isRecentFreeTime);
+            }
+            if (!TextUtils.isEmpty(sortField)) {
+                //排序key
+                jsonObject.putOpt("sortField", sortField);
+                //排序值 ASC DESC
+                jsonObject.putOpt("sortRule", sortRule);
+            }
+            //搜索条件
+            jsonObject.putOpt("search", search);
             jsonObject.putOpt("page", page);
             jsonObject.putOpt("rows", Constants.DEFAULT_DATA_SIZE);
         } catch (JSONException e) {
             e.printStackTrace();
         }
-        addSubscribe(create(APIService.class).selectMyGroup(RequestBodyUtil.convertToRequestBodyJson(jsonObject.toString())), new BaseObserver<SelectMyGroupBean>(getView()) {
+        addSubscribe(create(APIService.class).getAppointCourseTeachers(RequestBodyUtil.convertToRequestBodyJson(jsonObject.toString())), new BaseObserver<AppointCourseTeacherListBean>(getView()) {
             @Override
-            protected void onSuccess(SelectMyGroupBean data) {
+            protected void onSuccess(AppointCourseTeacherListBean data) {
                 if (getView() != null) {
-//                    getView().onGetVideoCourseSuccess(page, data);
+                    getView().onGetTeacherListSuccess(page, data);
                 }
             }
 
@@ -48,7 +63,7 @@ public class InterestCorrectionCourseListPresenter extends BasePresenter<Interes
             public void onError(Throwable e) {
                 super.onError(e);
                 if (getView() != null) {
-//                    getView().onGetCourseError(page);
+                    getView().onGetTeacherListError(page);
                 }
             }
         });

+ 221 - 4
student/src/main/java/com/cooleshow/student/ui/course/InterestCorrectionCourseListFragment.java

@@ -1,25 +1,57 @@
 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.DataSortBean;
+import com.cooleshow.base.constanst.Constants;
+import com.cooleshow.base.constanst.DataSortType;
 import com.cooleshow.base.ui.fragment.BaseMVPFragment;
+import com.cooleshow.base.utils.LOG;
+import com.cooleshow.base.utils.UiUtils;
+import com.cooleshow.base.widgets.CommonSortView;
+import com.cooleshow.base.widgets.EmptyViewLayout;
+import com.cooleshow.student.R;
+import com.cooleshow.student.adapter.VIPCourseCourseListAdapter;
+import com.cooleshow.student.bean.AppointCourseTeacherListBean;
 import com.cooleshow.student.bean.QuerySubjectBean;
 import com.cooleshow.student.contract.InterestCorrectionCourseListContract;
 import com.cooleshow.student.databinding.FgInterestCorrectionCourseListLayoutBinding;
 import com.cooleshow.student.databinding.FgVipCustomCourseListLayoutBinding;
 import com.cooleshow.student.presenter.course.InterestCorrectionCourseListPresenter;
 import com.cooleshow.student.presenter.course.VIPCustomCourseListPresenter;
+import com.cooleshow.usercenter.helper.UserHelper;
+import com.scwang.smart.refresh.footer.ClassicsFooter;
+import com.scwang.smart.refresh.layout.api.RefreshLayout;
+import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
 
 import java.util.ArrayList;
 import java.util.List;
 
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.LinearLayoutManager;
+
 /**
  * Author by pq, Date on 2024/11/13.
  * 趣纠课约课
  */
-public class InterestCorrectionCourseListFragment extends BaseMVPFragment<FgInterestCorrectionCourseListLayoutBinding, InterestCorrectionCourseListPresenter> implements InterestCorrectionCourseListContract.View {
+public class InterestCorrectionCourseListFragment extends BaseMVPFragment<FgInterestCorrectionCourseListLayoutBinding, InterestCorrectionCourseListPresenter> implements InterestCorrectionCourseListContract.View, View.OnClickListener {
     private List<QuerySubjectBean> subjectBeanList = new ArrayList<>();
-
+    private OptionsPickerView pvOptions;
+    private int currentSelectSubjectPosition = -1;
+    private String currentSubjectId;
+    private String sortField;
+    private String sortRule;
+    private boolean isRecentFreeTime;
+    private String searchCondition;
+    private int currentPage = 1;
+    private VIPCourseCourseListAdapter mAdapter;
+    private boolean hasNext = true;
 
     public static InterestCorrectionCourseListFragment newInstance() {
         InterestCorrectionCourseListFragment fragment = new InterestCorrectionCourseListFragment();
@@ -31,13 +63,73 @@ public class InterestCorrectionCourseListFragment extends BaseMVPFragment<FgInte
         return FgInterestCorrectionCourseListLayoutBinding.inflate(getLayoutInflater());
     }
 
+
     @Override
     protected void initView(View rootView) {
-
     }
 
     @Override
     protected void initData() {
+        currentSubjectId = UserHelper.getSubjectId();
+        String subjectName = UserHelper.getSubjectName();
+        mViewBinding.tvFilter.setText(subjectName);
+
+        initListener();
+        DataSortBean dataSortBean = new DataSortBean(DataSortType.RECENT_FREE_TIME);
+        DataSortBean dataSortBean2 = new DataSortBean(DataSortType.HAS_COURSE);
+        DataSortBean dataSortBean3 = new DataSortBean(DataSortType.COURSE_PRICE);
+        DataSortBean dataSortBean4 = new DataSortBean(DataSortType.COURSE_MARK);
+        ArrayList<DataSortBean> list = new ArrayList();
+        list.add(dataSortBean);
+        list.add(dataSortBean2);
+        list.add(dataSortBean3);
+        list.add(dataSortBean4);
+        mViewBinding.sortView.setData(list);
+
+        mAdapter = new VIPCourseCourseListAdapter();
+        EmptyViewLayout emptyViewLayout = new EmptyViewLayout(getContext());
+        emptyViewLayout.setContent(com.cooleshow.base.R.drawable.icon_empty_course, "暂无课程");
+        mViewBinding.recyclerViewList.setLayoutManager(new LinearLayoutManager(getContext()));
+        mViewBinding.recyclerViewList.setAdapter(mAdapter);
+        mAdapter.setEmptyView(emptyViewLayout);
+
+        getData(true);
+    }
+
+    private void initListener() {
+        mViewBinding.tvFilter.setOnClickListener(this);
+        mViewBinding.tvSearch.setOnClickListener(this);
+        mViewBinding.refreshLayout.setRefreshFooter(new ClassicsFooter(getContext()).setDrawableSize(20));
+        mViewBinding.refreshLayout.setOnRefreshListener(new OnRefreshListener() {
+            @Override
+            public void onRefresh(@NonNull RefreshLayout refreshLayout) {
+                currentPage = 1;
+                getData(false);
+            }
+        });
+        mViewBinding.refreshLayout.setOnLoadMoreListener(new com.scwang.smart.refresh.layout.listener.OnLoadMoreListener() {
+            @Override
+            public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
+                //上拉加载
+                if (hasNext) {
+                    currentPage++;
+                    getData(false);
+                } else {
+                    mViewBinding.refreshLayout.finishLoadMoreWithNoMoreData();
+                }
+            }
+        });
+
+        mViewBinding.sortView.setEventListener(new CommonSortView.OnEventListener() {
+            @Override
+            public void onFilterResult(boolean isRecentFreeTime, String sortField, String sortRule) {
+                InterestCorrectionCourseListFragment.this.isRecentFreeTime = isRecentFreeTime;
+                InterestCorrectionCourseListFragment.this.sortField = sortField;
+                InterestCorrectionCourseListFragment.this.sortRule = sortRule;
+                currentPage = 1;
+                getData(false);
+            }
+        });
 
     }
 
@@ -46,10 +138,135 @@ public class InterestCorrectionCourseListFragment extends BaseMVPFragment<FgInte
         return new InterestCorrectionCourseListPresenter();
     }
 
+    @Override
+    public void onClick(View v) {
+        int id = v.getId();
+        if (id == R.id.tv_filter) {
+            selectSubjectType();
+            return;
+        }
+        if (id == R.id.tv_search) {
+            currentPage = 1;
+            searchCondition = mViewBinding.etTargetName.getText().toString().trim();
+            getData(false);
+            return;
+        }
+    }
+
+    private void selectSubjectType() {
+        if (subjectBeanList.size() == 0) {
+            return;
+        }
+        if (pvOptions == null) {
+            pvOptions = new OptionsPickerBuilder(getContext(), (options1, options2, options3, v) -> {
+                this.currentSelectSubjectPosition = options1;
+                QuerySubjectBean subjectBean = subjectBeanList.get(options1);
+                this.currentSubjectId = subjectBean.getId();
+                mViewBinding.tvFilter.setText(subjectBean.getPickerViewText());
+                currentPage = 1;
+                getData(false);
+            }).setLayoutRes(com.cooleshow.base.R.layout.pickerview_select_options_layout, v -> {
+                        //自定义布局中的控件初始化及事件处理
+                        final TextView tvSubmit = (TextView) v.findViewById(com.cooleshow.base.R.id.tv_finish);
+                        TextView ivCancel = (TextView) v.findViewById(com.cooleshow.base.R.id.tv_cancel);
+                        tvSubmit.setOnClickListener(v12 -> {
+                            pvOptions.returnData();
+                            pvOptions.dismiss();
+                        });
+                        ivCancel.setOnClickListener(v1 -> pvOptions.dismiss());
+
+                    }).setTextColorOut(getResources().getColor(com.cooleshow.base.R.color.color_aaaaaa))
+                    .setDividerColor(Color.TRANSPARENT)
+                    .setBgColor(Color.TRANSPARENT).isDialog(false).build();
+            pvOptions.setOnDismissListener(new OnDismissListener() {
+                @Override
+                public void onDismiss(Object o) {
+                    UiUtils.refreshFilterTextStyle(false, mViewBinding.tvFilter);
+                }
+
+                @Override
+                public void onShow() {
+                    UiUtils.refreshFilterTextStyle(true, mViewBinding.tvFilter);
+                }
+            });
+        }
+        pvOptions.setPicker(subjectBeanList);
+        if (currentSelectSubjectPosition != -1 && currentSelectSubjectPosition < subjectBeanList.size()) {
+            pvOptions.setSelectOptions(currentSelectSubjectPosition);
+        }
+        pvOptions.show();
+
+    }
+
+    private void getData(boolean isShowLoading) {
+        if (currentPage == 1) {
+            mViewBinding.refreshLayout.resetNoMoreData();
+        }
+        presenter.queryCourseTeachers(isShowLoading, currentSubjectId, sortField, sortRule, searchCondition, isRecentFreeTime, currentPage);
+    }
+
+    @Override
+    public void onGetTeacherListSuccess(int page, AppointCourseTeacherListBean dataList) {
+        if (isDetached()) {
+            return;
+        }
+        LOG.i("pq", "interest queryGroupNoticeSuccess:" + dataList);
+        if (dataList != null) {
+            if (page == 1) {
+                //第一页
+                mViewBinding.refreshLayout.finishRefresh();
+                if (mAdapter != null) {
+                    mAdapter.getData().clear();
+                    mAdapter.notifyDataSetChanged();
+                    if (dataList.getRows() != null && dataList.getRows().size() > 0) {
+                        checkHasNext(dataList.getRows().size());
+                        mAdapter.setNewInstance(dataList.getRows());
+                    }
+                }
+            } else {
+                //加载更多
+                if (mAdapter != null) {
+                    if (dataList.getRows() != null && dataList.getRows().size() > 0) {
+                        mViewBinding.refreshLayout.finishLoadMore();
+                        checkHasNext(dataList.getRows().size());
+                        mAdapter.addData(dataList.getRows());
+                    } else {
+                        mViewBinding.refreshLayout.finishLoadMoreWithNoMoreData();
+                    }
+                }
+            }
+        }
+
+    }
+
+    private void checkHasNext(int dataSize) {
+        hasNext = dataSize >= Constants.DEFAULT_DATA_SIZE;
+    }
+
     public void querySubjectItemSuccess(List<QuerySubjectBean> data) {
         subjectBeanList.clear();
-        subjectBeanList.add(new QuerySubjectBean("全部声部", 0));
         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;
+            }
+        }
     }
 
+    @Override
+    public void onGetTeacherListError(int page) {
+        if (isDetached()) {
+            return;
+        }
+        if (page == 1) {
+            mViewBinding.refreshLayout.finishRefresh();
+        } else {
+            if (mAdapter != null) {
+                currentPage--;
+                mViewBinding.refreshLayout.finishLoadMore(false);
+            }
+        }
+    }
 }

+ 18 - 1
student/src/main/java/com/cooleshow/student/ui/course/VIPCustomCourseListFragment.java

@@ -1,6 +1,7 @@
 package com.cooleshow.student.ui.course;
 
 import android.graphics.Color;
+import android.text.TextUtils;
 import android.view.View;
 import android.widget.TextView;
 
@@ -22,6 +23,7 @@ import com.cooleshow.student.bean.QuerySubjectBean;
 import com.cooleshow.student.contract.VIPCustomCourseListContract;
 import com.cooleshow.student.databinding.FgVipCustomCourseListLayoutBinding;
 import com.cooleshow.student.presenter.course.VIPCustomCourseListPresenter;
+import com.cooleshow.usercenter.helper.UserHelper;
 import com.scwang.smart.refresh.footer.ClassicsFooter;
 import com.scwang.smart.refresh.layout.api.RefreshLayout;
 import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
@@ -65,6 +67,11 @@ public class VIPCustomCourseListFragment extends BaseMVPFragment<FgVipCustomCour
 
     @Override
     protected void initData() {
+        currentSubjectId = UserHelper.getSubjectId();
+        String subjectName = UserHelper.getSubjectName();
+        mViewBinding.tvFilter.setText(subjectName);
+
+
         initListener();
         DataSortBean dataSortBean = new DataSortBean(DataSortType.RECENT_FREE_TIME);
         DataSortBean dataSortBean2 = new DataSortBean(DataSortType.HAS_COURSE);
@@ -131,8 +138,14 @@ public class VIPCustomCourseListFragment extends BaseMVPFragment<FgVipCustomCour
 
     public void querySubjectItemSuccess(List<QuerySubjectBean> data) {
         subjectList.clear();
-        subjectList.add(new QuerySubjectBean("全部声部", 0));
         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;
+            }
+        }
     }
 
     @Override
@@ -144,6 +157,7 @@ public class VIPCustomCourseListFragment extends BaseMVPFragment<FgVipCustomCour
         }
         if (id == R.id.tv_search) {
             searchCondition = mViewBinding.etTargetName.getText().toString().trim();
+            currentPage = 1;
             getData(false);
             return;
         }
@@ -195,6 +209,9 @@ public class VIPCustomCourseListFragment extends BaseMVPFragment<FgVipCustomCour
     }
 
     private void getData(boolean isShowLoading) {
+        if (currentPage == 1) {
+            mViewBinding.refreshLayout.resetNoMoreData();
+        }
         presenter.queryCourseTeachers(isShowLoading, currentSubjectId, sortField, sortRule, searchCondition, isRecentFreeTime, currentPage);
     }
 

+ 17 - 47
student/src/main/res/layout/fg_interest_correction_course_list_layout.xml

@@ -2,6 +2,7 @@
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
+    android:paddingTop="12dp"
     android:layout_height="match_parent">
 
     <TextView
@@ -55,7 +56,8 @@
         android:includeFontPadding="false"
         android:maxLines="1"
         android:paddingStart="8dp"
-        android:textColor="@color/color_999999"
+        android:textColorHint="@color/color_66000000"
+        android:textColor="@color/color_333333"
         android:textCursorDrawable="@drawable/shape_2dc7aa_1dp"
         android:textSize="@dimen/sp_14"
         android:theme="@style/MyEditText"
@@ -79,68 +81,36 @@
         app:layout_constraintRight_toRightOf="@+id/view_search_bg"
         app:layout_constraintTop_toTopOf="@+id/view_search_bg" />
 
-    <RadioGroup
-        android:id="@+id/rg_filter"
+    <com.cooleshow.base.widgets.CommonSortView
         android:layout_width="match_parent"
-        android:layout_height="40dp"
-        android:orientation="horizontal"
+        android:id="@+id/sort_view"
+        android:layout_marginTop="12dp"
+        android:layout_marginStart="14dp"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/view_search_bg">
+        app:layout_constraintTop_toBottomOf="@+id/view_search_bg"
+        android:layout_height="wrap_content"/>
 
-        <RadioButton
-            android:layout_width="wrap_content"
-            android:layout_height="match_parent"
-            android:button="@null"
-            android:paddingStart="5dp"
-            android:paddingEnd="5dp"
-            android:text="仅看未来30天有空" />
-
-        <RadioButton
-            android:layout_width="wrap_content"
-            android:layout_height="match_parent"
-            android:button="@null"
-            android:paddingStart="5dp"
-            android:paddingEnd="5dp"
-            android:text="已上课时" />
-
-        <RadioButton
-            android:layout_width="wrap_content"
-            android:layout_height="match_parent"
-            android:button="@null"
-            android:paddingStart="5dp"
-            android:paddingEnd="5dp"
-            android:text="课时单价" />
-
-        <RadioButton
-            android:layout_width="wrap_content"
-            android:layout_height="match_parent"
-            android:button="@null"
-            android:paddingStart="5dp"
-            android:paddingEnd="5dp"
-            android:text="评分" />
-    </RadioGroup>
 
     <com.scwang.smart.refresh.layout.SmartRefreshLayout
         android:id="@+id/refreshLayout"
         android:layout_width="match_parent"
         android:layout_height="0dp"
+        android:layout_marginTop="12dp"
+        app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintTop_toBottomOf="@id/rg_filter"
-        app:srlEnableLoadMore="false">
+        app:layout_constraintTop_toBottomOf="@+id/sort_view"
+        app:srlEnableLoadMore="true">
 
         <androidx.recyclerview.widget.RecyclerView
-            android:id="@+id/recyclerView"
+            android:id="@+id/recyclerView_list"
+            android:layout_marginEnd="14dp"
+            android:layout_marginStart="14dp"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:overScrollMode="never"
-            android:scrollbars="none"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toStartOf="@id/liv_letters"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/view_search_bg"
-            app:layout_constraintVertical_bias="0.0" />
+            android:scrollbars="none" />
     </com.scwang.smart.refresh.layout.SmartRefreshLayout>
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 1 - 1
student/src/main/res/layout/fg_vip_custom_course_list_layout.xml

@@ -96,6 +96,7 @@
         android:id="@+id/refreshLayout"
         android:layout_width="match_parent"
         android:layout_height="0dp"
+        android:layout_marginTop="12dp"
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintLeft_toLeftOf="parent"
@@ -105,7 +106,6 @@
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView_list"
             android:layout_marginEnd="14dp"
-            android:layout_marginTop="12dp"
             android:layout_marginStart="14dp"
             android:layout_width="match_parent"
             android:layout_height="match_parent"

+ 16 - 0
usercenter/src/main/java/com/cooleshow/usercenter/bean/StudentUserInfo.java

@@ -77,6 +77,22 @@ public class StudentUserInfo implements Serializable {
     private int customerServiceNum;
     private String userType;
 
+    public String getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(String subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public String getSubjectName() {
+        return subjectName;
+    }
+
+    public void setSubjectName(String subjectName) {
+        this.subjectName = subjectName;
+    }
+
     public String getUserType() {
         return userType;
     }

+ 17 - 0
usercenter/src/main/java/com/cooleshow/usercenter/helper/UserHelper.java

@@ -28,6 +28,8 @@ public class UserHelper {
     public static final String USER_IM_TOKEN = "imToken";
     public static final String USER_PHONE = "phone";
     public static final String USER_AVATAR = "avatar";
+    public static final String SUBJECT_ID = "subjectId";
+    public static final String SUBJECT_NAME = "subjectName";
     public static final String TEACHER_CERT_STATUS = "teacherCert";
     public static final String TEACHER_LIVE_FLAG_STATUS = "teacherLiveFlag";
     public static final String PRIVACY_KEY = "privacy_key";
@@ -143,6 +145,10 @@ public class UserHelper {
         SPUtils.getInstance().put(USER_PHONE, userInfo.phone);
         //头像
         SPUtils.getInstance().put(USER_AVATAR, userInfo.heardUrl);
+        //声部id
+        SPUtils.getInstance().put(SUBJECT_ID,userInfo.getSubjectId());
+        //声部名称
+        SPUtils.getInstance().put(SUBJECT_NAME,userInfo.getSubjectName());
         //机构id
         SPUtils.getInstance().put(TENANTID_KEY + "_" + getUserId(), userInfo.tenantId);
         //机构名称
@@ -278,6 +284,9 @@ public class UserHelper {
         SPUtils.getInstance().put(USER_PHONE, "");
         //头像
         SPUtils.getInstance().put(USER_AVATAR, "");
+        //声部
+        SPUtils.getInstance().put(SUBJECT_ID, "");
+        SPUtils.getInstance().put(SUBJECT_NAME, "");
         //机构端默认选中的专辑id
         setCustomCache(DEFAULT_ALBUM_ID, "");
     }
@@ -345,4 +354,12 @@ public class UserHelper {
         String tenantId = getTenantId();
         return isTenantAccount(tenantId);
     }
+
+    public static String getSubjectId(){
+        return SPUtils.getInstance().getString(SUBJECT_ID);
+    }
+
+    public static String getSubjectName(){
+        return SPUtils.getInstance().getString(SUBJECT_NAME);
+    }
 }