Commit 08b7799ee4224c3f6da5a31774f85131b912d235
1 parent
49837d23
Exists in
yxb_dev
and in
2 other branches
no message
Showing
11 changed files
with
189 additions
and
53 deletions
Show diff stats
app/build.gradle
... | ... | @@ -52,15 +52,15 @@ task fileCheckTask() { |
52 | 52 | //此方法执行以后会删除所有的version.sql文件,不能主动添加sql语句 |
53 | 53 | //如果已经定义、实现的注解不能满足更新要求,请自己添加sql语句,并且将下面删除文件的语句注释 |
54 | 54 | //注意 注释以后不要打开(写这个task是为了试验) |
55 | - doLast { | |
56 | - File file = new File(rootDir.getAbsolutePath() + "\\app\\src\\main\\assets\\migrations") | |
57 | - File[] files = file.listFiles() | |
58 | - for (int i = 0; i < files.length; i++) { | |
59 | - File file1 = files[i] | |
60 | - println("delete : "+file1.getAbsolutePath()) | |
61 | - file1.delete() | |
62 | - } | |
63 | - } | |
55 | +// doLast { | |
56 | +// File file = new File(rootDir.getAbsolutePath() + "\\app\\src\\main\\assets\\migrations") | |
57 | +// File[] files = file.listFiles() | |
58 | +// for (int i = 0; i < files.length; i++) { | |
59 | +// File file1 = files[i] | |
60 | +// println("delete : "+file1.getAbsolutePath()) | |
61 | +// file1.delete() | |
62 | +// } | |
63 | +// } | |
64 | 64 | } |
65 | 65 | |
66 | 66 | afterEvaluate { |
... | ... | @@ -80,6 +80,7 @@ greendao { |
80 | 80 | schemaVersion 1//数据库版本升级 |
81 | 81 | } |
82 | 82 | dependencies { |
83 | + | |
83 | 84 | implementation fileTree(include: ['*.jar'], dir: 'libs') |
84 | 85 | implementation 'com.android.support:appcompat-v7:26.1.0' |
85 | 86 | implementation 'com.android.support.constraint:constraint-layout:1.0.2' | ... | ... |
app/libs/processor.jar
No preview for this file type
app/src/main/java/com/shunzhi/parent/adapter/DeyuDetialAdapter.java
1 | 1 | package com.shunzhi.parent.adapter; |
2 | 2 | |
3 | 3 | import android.content.Context; |
4 | -import android.content.Intent; | |
5 | 4 | import android.view.LayoutInflater; |
6 | 5 | import android.view.View; |
7 | 6 | import android.view.ViewGroup; |
7 | +import android.widget.TextView; | |
8 | 8 | |
9 | 9 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; |
10 | 10 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; |
... | ... | @@ -32,21 +32,65 @@ public class DeyuDetialAdapter extends BaseRecyclerViewAdapter<DeyuDetialBean> { |
32 | 32 | |
33 | 33 | private class DeyuDetialViewHolder extends BaseRecyclerViewHolder<DeyuDetialBean> { |
34 | 34 | |
35 | + TextView txt_name,jidian,paiming,pingjia; | |
35 | 36 | |
36 | 37 | public DeyuDetialViewHolder(View itemView) { |
37 | 38 | super(itemView); |
39 | + txt_name=itemView.findViewById(R.id.txt_name); | |
40 | + jidian=itemView.findViewById(R.id.jidian); | |
41 | + paiming=itemView.findViewById(R.id.paiming); | |
42 | + pingjia=itemView.findViewById(R.id.pingjia); | |
38 | 43 | |
39 | 44 | } |
40 | 45 | |
41 | 46 | @Override |
42 | 47 | public void onBindViewHolder(final DeyuDetialBean object, int position) { |
48 | + txt_name.setText(object.getSceneName()); | |
49 | + jidian.setText("绩点:"+String.format("%.1f", object.getPointScore())+" "+object.getRisePoint()); | |
50 | + String pStr=getPaiming(object.getRanking()); | |
51 | + paiming.setText("排名:"+pStr+" "+object.getRiseRanking()); | |
52 | + | |
53 | + | |
43 | 54 | itemView.setOnClickListener(new View.OnClickListener() { |
44 | 55 | @Override |
45 | 56 | public void onClick(View v) { |
46 | - mContext.startActivity(new Intent().setClass(mContext, ReportSceneActivity.class)); | |
57 | + ReportSceneActivity.getInstance(mContext,object.getSceneId()); | |
47 | 58 | } |
48 | 59 | }); |
49 | 60 | |
50 | 61 | } |
51 | 62 | } |
63 | + | |
64 | + public String getPaiming(float ranking) { | |
65 | + String s=String.valueOf((int)ranking); | |
66 | + | |
67 | + return "第"+toChinese(s)+"名"; | |
68 | + } | |
69 | + | |
70 | + | |
71 | + public String toChinese(String string) { | |
72 | + String[] s1 = { "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" }; | |
73 | + String[] s2 = { "十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千" }; | |
74 | + | |
75 | + String result = ""; | |
76 | + | |
77 | + int n = string.length(); | |
78 | + for (int i = 0; i < n; i++) { | |
79 | + | |
80 | + int num = string.charAt(i) - '0'; | |
81 | + | |
82 | + if (i != n - 1 && num != 0) { | |
83 | + result += s1[num] + s2[n - 2 - i]; | |
84 | + } else { | |
85 | + result += s1[num]; | |
86 | + } | |
87 | + System.out.println(" "+result); | |
88 | + } | |
89 | + | |
90 | + System.out.println("----------------"); | |
91 | + System.out.println(result); | |
92 | + return result; | |
93 | + | |
94 | + } | |
95 | + | |
52 | 96 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/api/ReportApi.java
... | ... | @@ -23,11 +23,11 @@ public interface ReportApi { |
23 | 23 | |
24 | 24 | |
25 | 25 | @FormUrlEncoded |
26 | - @POST("api/EvaluationStatistics/GetStatisticalAnalysis") | |
26 | + @POST("/api/EvaluationLabel/GetStatisticalAnalysis") | |
27 | 27 | Observable<JsonObject> getReportDetial(@Field("screenId") int screenId, |
28 | - @Field("ObjectId") String ObjectId, | |
29 | - @Field("SchoolId") int SchoolId, | |
30 | - @Field("ObjectType") int ObjectType, | |
28 | + @Field("schoolId") int SchoolId, | |
29 | +// @Field("ObjectType") int ObjectType, | |
30 | + @Field("classId")String classId, | |
31 | 31 | @Field("startDate") String startDate, |
32 | 32 | @Field("endDate") String endDate); |
33 | 33 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/bean/report/DeyuDetialBean.java
... | ... | @@ -5,4 +5,77 @@ package com.shunzhi.parent.bean.report; |
5 | 5 | */ |
6 | 6 | |
7 | 7 | public class DeyuDetialBean { |
8 | + float pointScore; | |
9 | + String risePoint; | |
10 | + float ranking; | |
11 | + String riseRanking; | |
12 | + String evaluationGrade; | |
13 | + int sceneId; | |
14 | + String sceneName; | |
15 | + | |
16 | + | |
17 | + public String getSceneName() { | |
18 | + return sceneName; | |
19 | + } | |
20 | + | |
21 | + public void setSceneName(String sceneName) { | |
22 | + this.sceneName = sceneName; | |
23 | + } | |
24 | + | |
25 | + public float getPointScore() { | |
26 | + return pointScore; | |
27 | + } | |
28 | + | |
29 | + public void setPointScore(float pointScore) { | |
30 | + this.pointScore = pointScore; | |
31 | + } | |
32 | + | |
33 | + public String getRisePoint() { | |
34 | + return risePoint; | |
35 | + } | |
36 | + | |
37 | + public void setRisePoint(String risePoint) { | |
38 | + this.risePoint = risePoint; | |
39 | + } | |
40 | + | |
41 | + public float getRanking() { | |
42 | + return ranking; | |
43 | + } | |
44 | + | |
45 | + public void setRanking(float ranking) { | |
46 | + this.ranking = ranking; | |
47 | + } | |
48 | + | |
49 | + public String getRiseRanking() { | |
50 | + return riseRanking; | |
51 | + } | |
52 | + | |
53 | + public void setRiseRanking(String riseRanking) { | |
54 | + this.riseRanking = riseRanking; | |
55 | + } | |
56 | + | |
57 | + public String getEvaluationGrade() { | |
58 | + return evaluationGrade; | |
59 | + } | |
60 | + | |
61 | + public void setEvaluationGrade(String evaluationGrade) { | |
62 | + this.evaluationGrade = evaluationGrade; | |
63 | + } | |
64 | + | |
65 | + public int getSceneId() { | |
66 | + return sceneId; | |
67 | + } | |
68 | + | |
69 | + public void setSceneId(int sceneId) { | |
70 | + this.sceneId = sceneId; | |
71 | + } | |
8 | 72 | } |
73 | + | |
74 | +//score":0.0, | |
75 | +// "pointScore":2.6624999046325684, | |
76 | +// "risePoint":"同期保持一致", | |
77 | +// "ranking":1.0, | |
78 | +// "riseRanking":"与同期保持一致", | |
79 | +// "evaluationGrade":"E", | |
80 | +// "sceneId":10, | |
81 | +// "sceneName":"好人好事" | |
9 | 82 | \ No newline at end of file | ... | ... |
app/src/main/java/com/shunzhi/parent/contract/report/ReportDetialContract.java
... | ... | @@ -16,14 +16,14 @@ import io.reactivex.Observable; |
16 | 16 | |
17 | 17 | public interface ReportDetialContract { |
18 | 18 | abstract class ReportDetialPresenter extends BasePresenter<IReportDetialModel,IReportDetialView>{ |
19 | - public abstract void reportDetialResult(int screenId,String objectId,int schoolId,int objectType,String startDate,String endDate); | |
19 | + public abstract void reportDetialResult(int screenId,int schoolId,String classId,int objectType,String startDate,String endDate); | |
20 | 20 | } |
21 | 21 | interface IReportDetialModel extends IBaseModel { |
22 | - Observable<JsonObject> getReportDetialResult(int screenId, String objectId, int schoolId, int objectType, String startDate, String endDate); | |
22 | + Observable<JsonObject> getReportDetialResult(int screenId, int schoolId,String classId,int objectType, String startDate, String endDate); | |
23 | 23 | } |
24 | 24 | interface IReportDetialView extends IBaseView { |
25 | 25 | void showDetialList(List<DeyuDetialBean> list); |
26 | - void showDetialInfo(String rank, String scoree, String bijiao1,String bijiao2,String bijiao3,String bijiao4,String describe); | |
26 | + void showDetialInfo(float rank, String scoree, String bijiao1,String bijiao2,String bijiao3,String bijiao4,String describe); | |
27 | 27 | |
28 | 28 | } |
29 | 29 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/model/report/ReportDetialModel.java
... | ... | @@ -20,8 +20,7 @@ public class ReportDetialModel implements ReportDetialContract.IReportDetialMod |
20 | 20 | } |
21 | 21 | |
22 | 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()); | |
23 | + public Observable<JsonObject> getReportDetialResult(int screenId, int schoolId,String classId, int objectType, String startDate, String endDate) { | |
24 | + return RetrofitCreateHelper.getInstance().createApi(ReportApi.class, AppConfig.BASE_URL).getReportDetial(screenId,schoolId,classId,startDate,endDate).compose(RxHelper.<JsonObject>rxSchedulerHelper()); | |
26 | 25 | } |
27 | 26 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/report/ReportDetialPresenter.java
... | ... | @@ -30,14 +30,22 @@ public class ReportDetialPresenter extends ReportDetialContract.ReportDetialPres |
30 | 30 | } |
31 | 31 | |
32 | 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>() { | |
33 | + public void reportDetialResult(int screenId, int schoolId,String classId,int objectType, String startDate, String endDate) { | |
34 | + mRxManager.register(mIModel.getReportDetialResult(screenId, schoolId,classId, objectType, startDate, endDate).subscribe(new Consumer<JsonObject>() { | |
35 | 35 | @Override |
36 | 36 | public void accept(JsonObject jsonObject) throws Exception { |
37 | 37 | |
38 | 38 | ToastUtils.showToast(jsonObject.toString()); |
39 | 39 | JsonObject data = jsonObject.getAsJsonObject("data"); |
40 | - JsonArray reportDetialArray = data.getAsJsonArray("result"); | |
40 | + String risePoint=data.get("risePoint").getAsString(); | |
41 | + String pointUpAverage=data.get("pointUpAverage").getAsString(); | |
42 | + float ranking=data.get("ranking").getAsFloat(); | |
43 | + String riseRanking=data.get("riseRanking").getAsString(); | |
44 | + String averageRanking=data.get("averageRanking").getAsString(); | |
45 | + String evaluationDescripe=data.get("evaluationDescripe").getAsString(); | |
46 | + String pscore=String.format("%.1f",data.get("pscore").getAsFloat()); | |
47 | + | |
48 | + JsonArray reportDetialArray = data.getAsJsonArray("sceneStatistics"); | |
41 | 49 | Gson g = new Gson(); |
42 | 50 | List<DeyuDetialBean> list = new ArrayList<>(); |
43 | 51 | Iterator it = reportDetialArray.iterator(); //Iterator处理 |
... | ... | @@ -46,7 +54,7 @@ public class ReportDetialPresenter extends ReportDetialContract.ReportDetialPres |
46 | 54 | list.add(bean); //加入list |
47 | 55 | } |
48 | 56 | mIView.showDetialList(list); |
49 | - mIView.showDetialInfo("","","","","","",""); | |
57 | + mIView.showDetialInfo(ranking,pscore,risePoint,pointUpAverage,riseRanking,averageRanking,evaluationDescripe); | |
50 | 58 | |
51 | 59 | |
52 | 60 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/report/ReportSceneActivity.java
... | ... | @@ -20,8 +20,9 @@ import com.shunzhi.parent.ui.fragment.report.ReportSceneFragment; |
20 | 20 | */ |
21 | 21 | |
22 | 22 | public class ReportSceneActivity extends BaseMVPCompatActivity implements View.OnClickListener { |
23 | - public static void getInstance(Context context) { | |
23 | + public static void getInstance(Context context,int screenID) { | |
24 | 24 | Intent intent = new Intent(context, ReportSceneActivity.class); |
25 | + intent.putExtra("screenID",screenID); | |
25 | 26 | context.startActivity(intent); |
26 | 27 | } |
27 | 28 | |
... | ... | @@ -53,7 +54,9 @@ public class ReportSceneActivity extends BaseMVPCompatActivity implements View.O |
53 | 54 | center_title = findViewById(R.id.center_title); |
54 | 55 | center_title.setText("场景详情"); |
55 | 56 | ivBack.setOnClickListener(this); |
56 | - | |
57 | + int screenID = getIntent().getIntExtra("screenID",0); | |
58 | + Bundle bundle=new Bundle(); | |
59 | + bundle.putInt("screenID",screenID); | |
57 | 60 | fragmentTransaction = getSupportFragmentManager().beginTransaction(); |
58 | 61 | fragmentTransaction.add(R.id.frame_scene, reportSceneFragment) |
59 | 62 | .show(reportSceneFragment).commit(); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/report/ReportDetialFragment.java
... | ... | @@ -28,17 +28,20 @@ import java.util.List; |
28 | 28 | * Created by Administrator on 2018/3/28 0028. |
29 | 29 | */ |
30 | 30 | |
31 | -public class ReportDetialFragment extends BaseMVPCompatFragment<ReportDetialContract.ReportDetialPresenter,ReportDetialContract.IReportDetialModel> | |
32 | -implements ReportDetialContract.IReportDetialView{ | |
31 | +public class ReportDetialFragment extends BaseMVPCompatFragment<ReportDetialContract.ReportDetialPresenter, ReportDetialContract.IReportDetialModel> | |
32 | + implements ReportDetialContract.IReportDetialView { | |
33 | 33 | |
34 | 34 | private RecyclerView recycle_deyu; |
35 | 35 | private DeyuDetialAdapter deyuDetialAdapter; |
36 | - List<DeyuDetialBean>list=new ArrayList<>(); | |
36 | + List<DeyuDetialBean> deyulist = new ArrayList<>(); | |
37 | 37 | |
38 | - private TextView tv_source,tv_bijiao1,tv_bijiao2,tv_bijiao3,tv_bijiao4,tv_date,tv_ranking,tv_describe; | |
38 | + private TextView tv_source, tv_bijiao1, tv_bijiao2, tv_bijiao3, tv_bijiao4, tv_date, tv_ranking, tv_describe; | |
39 | 39 | |
40 | 40 | |
41 | + private String startDate = "2018-03-08", endDate = "2018-04-08"; | |
42 | + | |
41 | 43 | private ChartView chartView; |
44 | + | |
42 | 45 | @NonNull |
43 | 46 | @Override |
44 | 47 | public BasePresenter initPresenter() { |
... | ... | @@ -52,8 +55,8 @@ implements ReportDetialContract.IReportDetialView{ |
52 | 55 | |
53 | 56 | @Override |
54 | 57 | public void initUI(View view, @Nullable Bundle savedInstanceState) { |
55 | - recycle_deyu=view.findViewById(R.id.recycle_deyu); | |
56 | - chartView=view.findViewById(R.id.chartView); | |
58 | + recycle_deyu = view.findViewById(R.id.recycle_deyu); | |
59 | + chartView = view.findViewById(R.id.chartView); | |
57 | 60 | tv_source = view.findViewById(R.id.tv_source); |
58 | 61 | tv_bijiao1 = view.findViewById(R.id.tv_bijiao1); |
59 | 62 | tv_bijiao2 = view.findViewById(R.id.tv_bijiao2); |
... | ... | @@ -62,34 +65,34 @@ implements ReportDetialContract.IReportDetialView{ |
62 | 65 | tv_date = view.findViewById(R.id.tv_date); |
63 | 66 | tv_ranking = view.findViewById(R.id.tv_ranking); |
64 | 67 | tv_describe = view.findViewById(R.id.tv_describe); |
65 | - Calendar c=Calendar.getInstance(); | |
66 | - Date date=c.getTime(); | |
67 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
68 | - String dateStr=sdf.format(date); | |
68 | + Calendar c = Calendar.getInstance(); | |
69 | + Date date = c.getTime(); | |
70 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
71 | + String dateStr = sdf.format(date); | |
69 | 72 | tv_date.setText(dateStr); |
70 | 73 | |
71 | 74 | recycle_deyu.setLayoutManager(new LinearLayoutManager(getActivity())); |
72 | - deyuDetialAdapter=new DeyuDetialAdapter(getActivity()); | |
73 | - deyuDetialAdapter.addAll(list); | |
75 | + deyuDetialAdapter = new DeyuDetialAdapter(getActivity()); | |
74 | 76 | recycle_deyu.setAdapter(deyuDetialAdapter); |
75 | 77 | initChartViews(); |
78 | + mPresenter.reportDetialResult(1, 1, "70", 0, startDate, endDate); | |
76 | 79 | |
77 | 80 | } |
78 | 81 | |
79 | 82 | private void initChartViews() { |
80 | 83 | |
81 | - chartView.setColors(R.color.textColor,R.color.huodong_blue,R.color.gray); | |
82 | - List<InputData> inputDataList=new ArrayList<>(); | |
83 | - List<InputData> inputDataList1=new ArrayList<>(); | |
84 | + chartView.setColors(R.color.textColor, R.color.huodong_blue, R.color.gray); | |
85 | + List<InputData> inputDataList = new ArrayList<>(); | |
86 | + List<InputData> inputDataList1 = new ArrayList<>(); | |
84 | 87 | for (int i = 0; i < 7; i++) { |
85 | - InputData inputData=new InputData("文明",10*i); | |
88 | + InputData inputData = new InputData("文明", 10 * i); | |
86 | 89 | inputDataList.add(inputData); |
87 | 90 | } |
88 | 91 | |
89 | 92 | chartView.setChartPaths(inputDataList); |
90 | 93 | |
91 | 94 | for (int i = 0; i < 7; i++) { |
92 | - InputData inputData=new InputData("文明1",20*i); | |
95 | + InputData inputData = new InputData("文明1", 20 * i); | |
93 | 96 | inputDataList1.add(inputData); |
94 | 97 | } |
95 | 98 | |
... | ... | @@ -99,17 +102,22 @@ implements ReportDetialContract.IReportDetialView{ |
99 | 102 | |
100 | 103 | @Override |
101 | 104 | public void showDetialList(List<DeyuDetialBean> list) { |
105 | + deyulist.clear(); | |
106 | + deyulist.addAll(list); | |
107 | + deyuDetialAdapter.addAll(deyulist); | |
108 | + deyuDetialAdapter.notifyDataSetChanged(); | |
109 | + | |
102 | 110 | |
103 | 111 | } |
104 | 112 | |
105 | 113 | @Override |
106 | - public void showDetialInfo(String rank, String scoree, String bijiao1,String bijiao2,String bijiao3,String bijiao4,String describe) { | |
114 | + public void showDetialInfo(float rank, String scoree, String bijiao1, String bijiao2, String bijiao3, String bijiao4, String describe) { | |
107 | 115 | tv_source.setText(scoree); |
108 | - tv_bijiao1 .setText(bijiao1); | |
109 | - tv_bijiao2 .setText(bijiao2); | |
110 | - tv_bijiao3 .setText(bijiao3); | |
111 | - tv_bijiao4 .setText(bijiao4); | |
112 | - tv_ranking.setText(rank); | |
113 | - tv_describe .setText(describe); | |
116 | + tv_bijiao1.setText(bijiao1); | |
117 | + tv_bijiao2.setText(bijiao2); | |
118 | + tv_bijiao3.setText(bijiao3); | |
119 | + tv_bijiao4.setText(bijiao4); | |
120 | + tv_ranking.setText(deyuDetialAdapter.getPaiming(rank)); | |
121 | + tv_describe.setText(describe); | |
114 | 122 | } |
115 | 123 | } | ... | ... |
app/src/main/res/layout/item_deyu_detial.xml
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | android:orientation="vertical"> |
20 | 20 | |
21 | 21 | <TextView |
22 | - android:id="@+id/txt_childname" | |
22 | + android:id="@+id/txt_name" | |
23 | 23 | android:layout_width="wrap_content" |
24 | 24 | android:layout_height="wrap_content" |
25 | 25 | android:textSize="@dimen/txtsize_title" |
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | |
48 | 48 | |
49 | 49 | <TextView |
50 | - android:id="@+id/go_buy" | |
50 | + android:id="@+id/pingjia" | |
51 | 51 | android:layout_width="wrap_content" |
52 | 52 | android:layout_height="wrap_content" |
53 | 53 | android:paddingTop="5dp" | ... | ... |