Commit 07503a80eb01505baca0be98d753e03a1878302c

Authored by 姚旭斌
1 parent 07a11b16

no message

.idea/modules.xml
... ... @@ -4,9 +4,9 @@
4 4 <modules>
5 5 <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
6 6 <module fileurl="file://$PROJECT_DIR$/mvpsdk/mvpsdk.iml" filepath="$PROJECT_DIR$/mvpsdk/mvpsdk.iml" />
7   - <module fileurl="file://$PROJECT_DIR$/parentWorkHolper.iml" filepath="$PROJECT_DIR$/parentWorkHolper.iml" />
8   - <module fileurl="file://F:\parentwork\parentWorkHolper.iml" filepath="F:\parentwork\parentWorkHolper.iml" />
9 7 <module fileurl="file://E:\parentwork\parentWorkHolper.iml" filepath="E:\parentwork\parentWorkHolper.iml" />
  8 + <module fileurl="file://F:\parentwork\parentWorkHolper.iml" filepath="F:\parentwork\parentWorkHolper.iml" />
  9 + <module fileurl="file://$PROJECT_DIR$/parentwork.iml" filepath="$PROJECT_DIR$/parentwork.iml" />
10 10 <module fileurl="file://F:\parentWorkHolper\parentwork.iml" filepath="F:\parentWorkHolper\parentwork.iml" />
11 11 <module fileurl="file://$PROJECT_DIR$/processor/processor.iml" filepath="$PROJECT_DIR$/processor/processor.iml" />
12 12 <module fileurl="file://$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" filepath="$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" />
... ...
app/src/main/java/com/shunzhi/parent/api/ReportApi.java
... ... @@ -13,11 +13,21 @@ import retrofit2.http.POST;
13 13  
14 14 public interface ReportApi {
15 15 @FormUrlEncoded
16   - @POST("/api/EvaluationLabel/GetSceneAnalysisDetails")
  16 + @POST("api/EvaluationLabel/GetSceneAnalysisDetails")
17 17 Observable<JsonObject> getSceneDetial(@Field("screenId") int screenId,
18 18 @Field("ObjectId") String ObjectId,
19 19 @Field("SchoolId") int SchoolId,
20   - @Field("ObjectType") int ObjectTypev,
  20 + @Field("ObjectType") int ObjectType,
  21 + @Field("startDate") String startDate,
  22 + @Field("endDate") String endDate);
  23 +
  24 +
  25 + @FormUrlEncoded
  26 + @POST("api/EvaluationStatistics/GetStatisticalAnalysis")
  27 + Observable<JsonObject> getReportDetial(@Field("screenId") int screenId,
  28 + @Field("ObjectId") String ObjectId,
  29 + @Field("SchoolId") int SchoolId,
  30 + @Field("ObjectType") int ObjectType,
21 31 @Field("startDate") String startDate,
22 32 @Field("endDate") String endDate);
23 33 }
... ...
app/src/main/java/com/shunzhi/parent/contract/report/ReportDetialContract.java
... ... @@ -4,7 +4,7 @@ import com.google.gson.JsonObject;
4 4 import com.share.mvpsdk.base.BasePresenter;
5 5 import com.share.mvpsdk.base.IBaseModel;
6 6 import com.share.mvpsdk.base.IBaseView;
7   -import com.shunzhi.parent.bean.report.SceneDetialBean;
  7 +import com.shunzhi.parent.bean.report.DeyuDetialBean;
8 8  
9 9 import java.util.List;
10 10  
... ... @@ -22,7 +22,7 @@ public interface ReportDetialContract {
22 22 Observable<JsonObject> getReportDetialResult(int screenId, String objectId, int schoolId, int objectType, String startDate, String endDate);
23 23 }
24 24 interface IReportDetialView extends IBaseView {
25   - void showDetialList(List<SceneDetialBean> list);
  25 + void showDetialList(List<DeyuDetialBean> list);
26 26 void showDetialInfo(String rank, String scoree, String pscoree, String sceneName);
27 27  
28 28 }
... ...
app/src/main/java/com/shunzhi/parent/model/report/ReportDetialModel.java 0 → 100644
... ... @@ -0,0 +1,27 @@
  1 +package com.shunzhi.parent.model.report;
  2 +
  3 +import com.google.gson.JsonObject;
  4 +import com.share.mvpsdk.helper.RetrofitCreateHelper;
  5 +import com.share.mvpsdk.helper.RxHelper;
  6 +import com.shunzhi.parent.AppConfig;
  7 +import com.shunzhi.parent.api.ReportApi;
  8 +import com.shunzhi.parent.contract.report.ReportDetialContract;
  9 +
  10 +import io.reactivex.Observable;
  11 +
  12 +/**
  13 + * Created by Administrator on 2018/4/8 0008.
  14 + */
  15 +
  16 +public class ReportDetialModel implements ReportDetialContract.IReportDetialModel {
  17 +
  18 + public static ReportDetialModel newInstance(){
  19 + return new ReportDetialModel();
  20 + }
  21 +
  22 + @Override
  23 + public Observable<JsonObject> getReportDetialResult(int screenId, String objectId, int schoolId, int objectType, String startDate, String endDate) {
  24 + return RetrofitCreateHelper.getInstance().createApi(ReportApi.class, AppConfig.BASE_URL).getReportDetial(screenId,objectId,schoolId,objectType
  25 + ,startDate,endDate).compose(RxHelper.<JsonObject>rxSchedulerHelper());
  26 + }
  27 +}
... ...
app/src/main/java/com/shunzhi/parent/presenter/report/ReportDetialPresenter.java 0 → 100644
... ... @@ -0,0 +1,60 @@
  1 +package com.shunzhi.parent.presenter.report;
  2 +
  3 +import com.google.gson.Gson;
  4 +import com.google.gson.JsonArray;
  5 +import com.google.gson.JsonObject;
  6 +import com.share.mvpsdk.utils.ToastUtils;
  7 +import com.shunzhi.parent.bean.report.DeyuDetialBean;
  8 +import com.shunzhi.parent.contract.report.ReportDetialContract;
  9 +import com.shunzhi.parent.model.report.ReportDetialModel;
  10 +
  11 +import java.util.ArrayList;
  12 +import java.util.Iterator;
  13 +import java.util.List;
  14 +
  15 +import io.reactivex.functions.Consumer;
  16 +
  17 +/**
  18 + * Created by Administrator on 2018/4/8 0008.
  19 + */
  20 +
  21 +public class ReportDetialPresenter extends ReportDetialContract.ReportDetialPresenter {
  22 + @Override
  23 + public ReportDetialContract.IReportDetialModel getModel() {
  24 + return ReportDetialModel.newInstance();
  25 + }
  26 +
  27 + @Override
  28 + public void onStart() {
  29 +
  30 + }
  31 +
  32 + @Override
  33 + public void reportDetialResult(int screenId, String objectId, int schoolId, int objectType, String startDate, String endDate) {
  34 + mRxManager.register(mIModel.getReportDetialResult(screenId, objectId, schoolId, objectType, startDate, endDate).subscribe(new Consumer<JsonObject>() {
  35 + @Override
  36 + public void accept(JsonObject jsonObject) throws Exception {
  37 +
  38 + ToastUtils.showToast(jsonObject.toString());
  39 + JsonObject data = jsonObject.getAsJsonObject("data");
  40 + JsonArray reportDetialArray = data.getAsJsonArray("result");
  41 + Gson g = new Gson();
  42 + List<DeyuDetialBean> list = new ArrayList<>();
  43 + Iterator it = reportDetialArray.iterator(); //Iterator处理
  44 + while (it.hasNext()) { //循环
  45 + DeyuDetialBean bean = g.fromJson(it.next().toString(), DeyuDetialBean.class); //String转化成JavaBean
  46 + list.add(bean); //加入list
  47 + }
  48 + mIView.showDetialList(list);
  49 +
  50 +
  51 + }
  52 + }, new Consumer<Throwable>() {
  53 + @Override
  54 + public void accept(Throwable throwable) throws Exception {
  55 +
  56 + }
  57 + }));
  58 +
  59 + }
  60 +}
... ...
app/src/main/java/com/shunzhi/parent/ui/fragment/report/ReportDetialFragment.java
... ... @@ -14,6 +14,9 @@ import com.share.mvpsdk.view.chartview.data.InputData;
14 14 import com.shunzhi.parent.R;
15 15 import com.shunzhi.parent.adapter.DeyuDetialAdapter;
16 16 import com.shunzhi.parent.bean.report.DeyuDetialBean;
  17 +import com.shunzhi.parent.bean.report.SceneDetialBean;
  18 +import com.shunzhi.parent.contract.report.ReportDetialContract;
  19 +import com.shunzhi.parent.presenter.report.ReportDetialPresenter;
17 20  
18 21 import java.util.ArrayList;
19 22 import java.util.List;
... ... @@ -22,7 +25,8 @@ import java.util.List;
22 25 * Created by Administrator on 2018/3/28 0028.
23 26 */
24 27  
25   -public class ReportDetialFragment extends BaseMVPCompatFragment {
  28 +public class ReportDetialFragment extends BaseMVPCompatFragment<ReportDetialContract.ReportDetialPresenter,ReportDetialContract.IReportDetialModel>
  29 +implements ReportDetialContract.IReportDetialView{
26 30  
27 31 private RecyclerView recycle_deyu;
28 32 private DeyuDetialAdapter deyuDetialAdapter;
... ... @@ -32,7 +36,7 @@ public class ReportDetialFragment extends BaseMVPCompatFragment {
32 36 @NonNull
33 37 @Override
34 38 public BasePresenter initPresenter() {
35   - return null;
  39 + return new ReportDetialPresenter();
36 40 }
37 41  
38 42 @Override
... ... @@ -48,7 +52,6 @@ public class ReportDetialFragment extends BaseMVPCompatFragment {
48 52 deyuDetialAdapter=new DeyuDetialAdapter(getActivity());
49 53 deyuDetialAdapter.addAll(list);
50 54 recycle_deyu.setAdapter(deyuDetialAdapter);
51   -
52 55 initChartViews();
53 56  
54 57 }
... ... @@ -73,4 +76,14 @@ public class ReportDetialFragment extends BaseMVPCompatFragment {
73 76 chartView.setChartPaths(inputDataList1);
74 77  
75 78 }
  79 +
  80 + @Override
  81 + public void showDetialList(List<SceneDetialBean> list) {
  82 +
  83 + }
  84 +
  85 + @Override
  86 + public void showDetialInfo(String rank, String scoree, String pscoree, String sceneName) {
  87 +
  88 + }
76 89 }
... ...