Commit 24a5ea4a93631d0821d1a0fa730dd6475ba2eda5

Authored by 姚旭斌
1 parent b6054d7e

no message

app/libs/processor.jar
No preview for this file type
app/src/main/assets/migrations/3.sql 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +ALTER table test ADD COLUMN age INTEGER
  2 +ALTER table test ADD COLUMN area INTEGER
  3 +ALTER table test ADD COLUMN name TEXT
... ...
app/src/main/java/com/shunzhi/parent/AppConfig.java
... ... @@ -38,16 +38,16 @@ public class AppConfig {
38 38 public static String APP_IS_START = "app_is_start";
39 39  
40 40 //http://campus.myjxt.com/
41   -// public static String BASE_URL="http://60.190.202.57:1000/";
42   -// public static String BASE_URL_ORDER="http://60.190.202.57:8101/";
43   -// public static String BASE_URL_FILE="http://60.190.202.57:8196";
  41 + public static String BASE_URL="http://60.190.202.57:1000/";
  42 + public static String BASE_URL_ORDER="http://60.190.202.57:8101/";
  43 + public static String BASE_URL_FILE="http://60.190.202.57:8196";
44 44  
45 45  
46 46 //正式
47   - public static String BASE_URL="http://campus.myjxt.com/";
48   - public static String BASE_URL_ORDER="http://parent.myjxt.com/";
49   - public static String BASE_URL_FILE="http://manage.myjxt.com";
50   - public static final String url_version = BASE_URL + "api/Common/AppVersion?appType=3";
  47 +// public static String BASE_URL="http://campus.myjxt.com/";
  48 +// public static String BASE_URL_ORDER="http://parent.myjxt.com/";
  49 +// public static String BASE_URL_FILE="http://manage.myjxt.com";
  50 +// public static final String url_version = BASE_URL + "api/Common/AppVersion?appType=3";
51 51  
52 52  
53 53 //默认日志保存的路径
... ...
app/src/main/java/com/shunzhi/parent/adapter/ReportSceneAdapter.java
... ... @@ -5,6 +5,7 @@ import android.view.LayoutInflater;
5 5 import android.view.View;
6 6 import android.view.ViewGroup;
7 7 import android.widget.LinearLayout;
  8 +import android.widget.TextView;
8 9  
9 10 import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter;
10 11 import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder;
... ... @@ -32,14 +33,25 @@ public class ReportSceneAdapter extends BaseRecyclerViewAdapter<SceneDetialBean>
32 33 private class MyViewHolder extends BaseRecyclerViewHolder<SceneDetialBean> {
33 34  
34 35 LinearLayout item_view;
  36 + TextView leavel,txt_info,count,name,time;
35 37  
36 38 public MyViewHolder(View view) {
37 39 super(view);
38 40 item_view = view.findViewById(R.id.item_view);
  41 + leavel=view.findViewById(R.id.leavel);
  42 + txt_info=view.findViewById(R.id.txt_info);
  43 + count=view.findViewById(R.id.count);
  44 + name=view.findViewById(R.id.name);
  45 + time=view.findViewById(R.id.time);
39 46 }
40 47  
41 48 @Override
42 49 public void onBindViewHolder(SceneDetialBean object, int position) {
  50 + leavel.setText(object.getDimensionName());
  51 + txt_info.setText(object.getSceneName()+"-"+object.getLableName());
  52 + count.setText(object.getScore());
  53 + name.setText(object.getStudentName());
  54 + time.setText(object.getRecordTime());
43 55 item_view.setOnClickListener(new View.OnClickListener() {
44 56 @Override
45 57 public void onClick(View v) {
... ...
app/src/main/java/com/shunzhi/parent/api/ReportApi.java 0 → 100644
... ... @@ -0,0 +1,16 @@
  1 +package com.shunzhi.parent.api;
  2 +
  3 +import com.google.gson.JsonObject;
  4 +
  5 +import io.reactivex.Observable;
  6 +import retrofit2.http.GET;
  7 +import retrofit2.http.Query;
  8 +
  9 +/**
  10 + * Created by Administrator on 2018/4/3 0003.
  11 + */
  12 +
  13 +public interface ReportApi {
  14 + @GET("/api/EvaluationLabel/GetSceneAnalysisDetails")
  15 + Observable<JsonObject> getSceneDetial(@Query("ObjectId") String ObjectId, @Query("SchoolId") int SchoolId, @Query("ObjectType") int ObjectType);
  16 +}
... ...
app/src/main/java/com/shunzhi/parent/bean/report/SceneDetialBean.java
1 1 package com.shunzhi.parent.bean.report;
2 2  
  3 +import java.io.Serializable;
  4 +
3 5 /**
4 6 * Created by Administrator on 2018/3/30 0030.
5 7 */
6 8  
7   -public class SceneDetialBean {
  9 +public class SceneDetialBean implements Serializable{
  10 +String describe;
  11 +String lableName;
  12 +String dimensionName;
  13 +String sceneName;
  14 +String studentName;
  15 +String className;
  16 +String recordTime;
  17 +String score;
  18 +
  19 + public String getScore() {
  20 + return score;
  21 + }
  22 +
  23 + public void setScore(String score) {
  24 + this.score = score;
  25 + }
  26 +
  27 + public String getDescribe() {
  28 + return describe;
  29 + }
  30 +
  31 + public void setDescribe(String describe) {
  32 + this.describe = describe;
  33 + }
  34 +
  35 + public String getLableName() {
  36 + return lableName;
  37 + }
  38 +
  39 + public void setLableName(String lableName) {
  40 + this.lableName = lableName;
  41 + }
  42 +
  43 + public String getDimensionName() {
  44 + return dimensionName;
  45 + }
  46 +
  47 + public void setDimensionName(String dimensionName) {
  48 + this.dimensionName = dimensionName;
  49 + }
  50 +
  51 + public String getSceneName() {
  52 + return sceneName;
  53 + }
  54 +
  55 + public void setSceneName(String sceneName) {
  56 + this.sceneName = sceneName;
  57 + }
  58 +
  59 + public String getStudentName() {
  60 + return studentName;
  61 + }
  62 +
  63 + public void setStudentName(String studentName) {
  64 + this.studentName = studentName;
  65 + }
  66 +
  67 + public String getClassName() {
  68 + return className;
  69 + }
  70 +
  71 + public void setClassName(String className) {
  72 + this.className = className;
  73 + }
  74 +
  75 + public String getRecordTime() {
  76 + return recordTime;
  77 + }
  78 +
  79 + public void setRecordTime(String recordTime) {
  80 + this.recordTime = recordTime;
  81 + }
  82 +
  83 +
8 84 }
... ...
app/src/main/java/com/shunzhi/parent/contract/report/ReportContract.java
... ... @@ -21,7 +21,7 @@ public interface ReportContract {
21 21 }
22 22 interface IReportModel extends IBaseModel{
23 23 Observable<ReportBean> getReportResult();
24   - void getReports();
  24 +
25 25 }
26 26 interface IReportView extends IBaseView{
27 27 void UpdateList(List<ReportBean>list);
... ...
app/src/main/java/com/shunzhi/parent/contract/report/ReportSceneContract.java 0 → 100644
... ... @@ -0,0 +1,29 @@
  1 +package com.shunzhi.parent.contract.report;
  2 +
  3 +import com.google.gson.JsonObject;
  4 +import com.share.mvpsdk.base.BasePresenter;
  5 +import com.share.mvpsdk.base.IBaseModel;
  6 +import com.share.mvpsdk.base.IBaseView;
  7 +import com.shunzhi.parent.bean.report.SceneDetialBean;
  8 +
  9 +import java.util.List;
  10 +
  11 +import io.reactivex.Observable;
  12 +
  13 +/**
  14 + * Created by Administrator on 2018/4/3 0003.
  15 + */
  16 +
  17 +public interface ReportSceneContract {
  18 + abstract class ReportScenePresenter extends BasePresenter<IReportSceneModel,IReportSceneView>{
  19 + public abstract void reportSceneResult(String objectId,int schoolId,int objectType);
  20 + }
  21 + interface IReportSceneModel extends IBaseModel {
  22 + Observable<JsonObject> getReportSceneResult(String objectId, int schoolId, int objectType);
  23 + }
  24 + interface IReportSceneView extends IBaseView {
  25 + void showSceneList(List<SceneDetialBean> list);
  26 + void showSceneInfo(String rank,String scoree,String pscoree,String sceneName);
  27 +
  28 + }
  29 +}
... ...
app/src/main/java/com/shunzhi/parent/model/report/ReportModel.java
... ... @@ -18,9 +18,4 @@ public class ReportModel implements ReportContract.IReportModel {
18 18 public Observable<ReportBean> getReportResult() {
19 19 return null;
20 20 }
21   -
22   - @Override
23   - public void getReports() {
24   -
25   - }
26 21 }
... ...
app/src/main/java/com/shunzhi/parent/model/report/ReportSceneModel.java 0 → 100644
... ... @@ -0,0 +1,26 @@
  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.ReportSceneContract;
  9 +
  10 +import io.reactivex.Observable;
  11 +
  12 +/**
  13 + * Created by Administrator on 2018/4/3 0003.
  14 + */
  15 +
  16 +public class ReportSceneModel implements ReportSceneContract.IReportSceneModel {
  17 +
  18 + public static ReportSceneModel newInstance() {
  19 + return new ReportSceneModel();
  20 + }
  21 + @Override
  22 + public Observable<JsonObject> getReportSceneResult(String ObjectId, int schoolId, int objectType) {
  23 + return RetrofitCreateHelper.getInstance().createApi(ReportApi.class, AppConfig.BASE_URL)
  24 + .getSceneDetial(ObjectId,schoolId,objectType).compose(RxHelper.<JsonObject>rxSchedulerHelper());
  25 + }
  26 +}
... ...
app/src/main/java/com/shunzhi/parent/presenter/report/ReportScenePresenter.java 0 → 100644
... ... @@ -0,0 +1,66 @@
  1 +package com.shunzhi.parent.presenter.report;
  2 +
  3 +
  4 +import android.util.Log;
  5 +
  6 +import com.google.gson.Gson;
  7 +import com.google.gson.JsonArray;
  8 +import com.google.gson.JsonObject;
  9 +import com.share.mvpsdk.utils.ToastUtils;
  10 +import com.shunzhi.parent.bean.report.SceneDetialBean;
  11 +import com.shunzhi.parent.contract.report.ReportSceneContract;
  12 +import com.shunzhi.parent.model.report.ReportSceneModel;
  13 +
  14 +import java.util.ArrayList;
  15 +import java.util.Iterator;
  16 +import java.util.List;
  17 +
  18 +import io.reactivex.functions.Consumer;
  19 +
  20 +/**
  21 + * Created by Administrator on 2018/4/3 0003.
  22 + */
  23 +
  24 +public class ReportScenePresenter extends ReportSceneContract.ReportScenePresenter {
  25 + @Override
  26 + public ReportSceneContract.IReportSceneModel getModel() {
  27 + return ReportSceneModel.newInstance();
  28 + }
  29 +
  30 + @Override
  31 + public void onStart() {
  32 +
  33 + }
  34 +
  35 + @Override
  36 + public void reportSceneResult(String objectId, int schoolId, int objectType) {
  37 + mRxManager.register(mIModel.getReportSceneResult(objectId, schoolId, objectType).subscribe(new Consumer<JsonObject>() {
  38 + @Override
  39 + public void accept(JsonObject jsonObject) throws Exception {
  40 + ToastUtils.showToast(jsonObject.toString());
  41 + JsonObject data = jsonObject.getAsJsonObject("data");
  42 + JsonArray behaviorArray = data.getAsJsonArray("behavior");
  43 + String rank = data.get("rank").getAsString();
  44 + String scoree = data.get("scoree").getAsString();
  45 + String pscoree = data.get("pscoree").getAsString();
  46 + String sceneName = data.get("sceneName").getAsString();
  47 + Gson g = new Gson();
  48 + List<SceneDetialBean> list = new ArrayList<>();
  49 + Iterator it = behaviorArray.iterator(); //Iterator处理
  50 + int i=0;
  51 + while (it.hasNext()) { //循环
  52 + SceneDetialBean bean = g.fromJson(it.next().toString(), SceneDetialBean.class); //String转化成JavaBean
  53 + list.add(bean); //加入list
  54 + }
  55 + mIView.showSceneList(list);
  56 + mIView.showSceneInfo(rank,scoree,pscoree,sceneName);
  57 + }
  58 + }, new Consumer<Throwable>() {
  59 + @Override
  60 + public void accept(Throwable throwable) throws Exception {
  61 +
  62 + }
  63 + }));
  64 +
  65 + }
  66 +}
... ...
app/src/main/java/com/shunzhi/parent/ui/fragment/report/ReportSceneFragment.java
1 1 package com.shunzhi.parent.ui.fragment.report;
2 2  
  3 +import android.annotation.SuppressLint;
3 4 import android.os.Bundle;
4 5 import android.support.annotation.NonNull;
5 6 import android.support.annotation.Nullable;
6 7 import android.support.v7.widget.LinearLayoutManager;
7 8 import android.support.v7.widget.RecyclerView;
8 9 import android.view.View;
  10 +import android.widget.TextView;
9 11  
10 12 import com.share.mvpsdk.base.BasePresenter;
11 13 import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment;
... ... @@ -14,6 +16,8 @@ import com.share.mvpsdk.view.chartview.data.InputData;
14 16 import com.shunzhi.parent.R;
15 17 import com.shunzhi.parent.adapter.ReportSceneAdapter;
16 18 import com.shunzhi.parent.bean.report.SceneDetialBean;
  19 +import com.shunzhi.parent.contract.report.ReportSceneContract;
  20 +import com.shunzhi.parent.presenter.report.ReportScenePresenter;
17 21  
18 22 import java.util.ArrayList;
19 23 import java.util.List;
... ... @@ -22,17 +26,19 @@ import java.util.List;
22 26 * Created by Administrator on 2018/3/28 0028.
23 27 */
24 28  
25   -public class ReportSceneFragment extends BaseMVPCompatFragment {
  29 +public class ReportSceneFragment extends BaseMVPCompatFragment<ReportSceneContract.ReportScenePresenter, ReportSceneContract.IReportSceneModel>
  30 + implements ReportSceneContract.IReportSceneView {
26 31 private RecyclerView recycle_scene;
27   - private ReportSceneAdapter sceneDetialAdapter;
28   - List<SceneDetialBean> list=new ArrayList<>();
29   -
  32 + private ReportSceneAdapter sceneDetialAdapter;
  33 + List<SceneDetialBean> scenenlist = new ArrayList<>();
  34 + private TextView tv_rank, tv_scoree, tv_pscoree,tv_sceneName;
30 35  
31 36 private ChartView chartView;
  37 +
32 38 @NonNull
33 39 @Override
34 40 public BasePresenter initPresenter() {
35   - return null;
  41 + return new ReportScenePresenter();
36 42 }
37 43  
38 44 @Override
... ... @@ -42,17 +48,17 @@ public class ReportSceneFragment extends BaseMVPCompatFragment {
42 48  
43 49 @Override
44 50 public void initUI(View view, @Nullable Bundle savedInstanceState) {
45   - recycle_scene=view.findViewById(R.id.recycle_scene);
46   - chartView=view.findViewById(R.id.chartView);
  51 + recycle_scene = view.findViewById(R.id.recycle_scene);
  52 + chartView = view.findViewById(R.id.chartView);
  53 + tv_rank = view.findViewById(R.id.rank);
  54 + tv_scoree = view.findViewById(R.id.scoree);
  55 + tv_pscoree = view.findViewById(R.id.pscoree);
  56 + tv_sceneName = view.findViewById(R.id.sceneName);
47 57 recycle_scene.setLayoutManager(new LinearLayoutManager(getActivity()));
48   - sceneDetialAdapter=new ReportSceneAdapter(getActivity());
49   - SceneDetialBean sceneDetialBean=new SceneDetialBean();
50   - list.add(sceneDetialBean);
51   - list.add(sceneDetialBean);
52   - list.add(sceneDetialBean);
53   - sceneDetialAdapter.addAll(list);
  58 + sceneDetialAdapter = new ReportSceneAdapter(getActivity());
  59 + sceneDetialAdapter.addAll(scenenlist);
54 60 recycle_scene.setAdapter(sceneDetialAdapter);
55   -
  61 + mPresenter.reportSceneResult("102697", 1, 0);
56 62 initChartViews();
57 63  
58 64  
... ... @@ -60,26 +66,26 @@ public class ReportSceneFragment extends BaseMVPCompatFragment {
60 66  
61 67 private void initChartViews() {
62 68  
63   - chartView.setColors(R.color.textColor,R.color.huodong_blue,R.color.gray);
64   - List<InputData> inputDataList=new ArrayList<>();
65   - List<InputData> inputDataList1=new ArrayList<>();
66   - List<InputData> inputDataList2=new ArrayList<>();
  69 + chartView.setColors(R.color.textColor, R.color.huodong_blue, R.color.gray);
  70 + List<InputData> inputDataList = new ArrayList<>();
  71 + List<InputData> inputDataList1 = new ArrayList<>();
  72 + List<InputData> inputDataList2 = new ArrayList<>();
67 73 for (int i = 0; i < 7; i++) {
68   - InputData inputData=new InputData("3/"+i,10*i);
  74 + InputData inputData = new InputData("3/" + i, 10 * i);
69 75 inputDataList.add(inputData);
70 76 }
71 77  
72 78 chartView.setChartPaths(inputDataList);
73 79  
74 80 for (int i = 0; i < 7; i++) {
75   - InputData inputData=new InputData("3/"+i,20*i);
  81 + InputData inputData = new InputData("3/" + i, 20 * i);
76 82 inputDataList1.add(inputData);
77 83 }
78 84  
79 85 chartView.setChartPaths(inputDataList1);
80 86  
81 87 for (int i = 0; i < 7; i++) {
82   - InputData inputData=new InputData("3/"+i,15*i);
  88 + InputData inputData = new InputData("3/" + i, 15 * i);
83 89 inputDataList2.add(inputData);
84 90 }
85 91  
... ... @@ -88,5 +94,27 @@ public class ReportSceneFragment extends BaseMVPCompatFragment {
88 94 }
89 95  
90 96  
  97 + @Override
  98 + public void showSceneList(List<SceneDetialBean> list) {
  99 + scenenlist.clear();
  100 + scenenlist.addAll(list);
  101 + sceneDetialAdapter.addAll(scenenlist);
  102 + sceneDetialAdapter.notifyDataSetChanged();
  103 + }
  104 +
  105 + @SuppressLint("ResourceAsColor")
  106 + @Override
  107 + public void showSceneInfo(String rank, String scoree, String pscoree,String sceneName) {
  108 + tv_rank.setText("等级:" + rank);
  109 + if(!scoree.startsWith("-")){
  110 + scoree="+"+scoree;
  111 + tv_scoree.setTextColor(R.color.textGreen);
  112 + }else{
  113 + tv_scoree.setTextColor(R.color.textRed);
  114 + }
  115 + tv_scoree.setText("得分:" + scoree);
  116 + tv_pscoree.setText("绩点:" + pscoree);
  117 + tv_sceneName.setText(sceneName);
  118 + }
91 119  
92 120 }
... ...
app/src/main/res/layout/fragment_report_scene.xml
... ... @@ -64,6 +64,7 @@
64 64 android:orientation="vertical">
65 65  
66 66 <TextView
  67 + android:id="@+id/sceneName"
67 68 android:layout_width="wrap_content"
68 69 android:layout_height="wrap_content"
69 70 android:gravity="center"
... ... @@ -72,6 +73,7 @@
72 73 android:textSize="@dimen/sp_16" />
73 74  
74 75 <TextView
  76 + android:id="@+id/scoree"
75 77 android:layout_width="wrap_content"
76 78 android:layout_height="wrap_content"
77 79 android:layout_marginTop="10dp"
... ... @@ -81,6 +83,7 @@
81 83 android:textSize="@dimen/sp_16" />
82 84  
83 85 <TextView
  86 + android:id="@+id/pscoree"
84 87 android:layout_width="wrap_content"
85 88 android:layout_height="wrap_content"
86 89 android:layout_marginTop="10dp"
... ... @@ -90,6 +93,7 @@
90 93 android:textSize="@dimen/sp_16" />
91 94  
92 95 <TextView
  96 + android:id="@+id/rank"
93 97 android:layout_width="wrap_content"
94 98 android:layout_height="wrap_content"
95 99 android:layout_marginTop="5dp"
... ...
app/src/main/res/layout/item_report_deyu.xml
... ... @@ -88,7 +88,7 @@
88 88 android:height="40dp"
89 89 android:gravity="center"
90 90 android:paddingLeft="20dp"
91   - android:text="3月4日语文作业"
  91 + android:text="3月4日德育报告"
92 92 android:textColor="@color/deyu_BlueColor"
93 93 android:textSize="@dimen/sp_14" />
94 94  
... ...