<file_sep>package com.xinnuo.apple.nongda.TeacherActivity.CourseAttendance;
/**
 * 查询所有教师
 * */
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.TeacherActivity.Substitute.TeacherSubstituteAddActivity;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class AllTeachersActivity extends BaseActivity {

    private OkHttpClient client;
    private ListView listView;
    private String teacherId;
    private JSONArray dataArr;
    private int positions;
    private String name;
    private String state;
    private String coordinateId;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_all_teachers);
        listView = (ListView) findViewById(R.id.all_teacher);
        Intent intent = getIntent();
        coordinateId = intent.getStringExtra("coordinateId");
        teacherId = intent.getStringExtra("teacherId");
        state = intent.getStringExtra("state");
        initOkHttp();
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                try {
                    Intent intent=new Intent(AllTeachersActivity.this,TeacherSubstituteAddActivity.class);
                    JSONObject js = dataArr.getJSONObject(position);
                    positions = position;
                    // 设置显示信息
                    final AlertDialog.Builder builder = new AlertDialog.Builder(AllTeachersActivity.this);
                    builder.setMessage("确定要提交？").
                            // 设置确定按钮
                                    setPositiveButton("是",
                                    new DialogInterface.OnClickListener() {
                                        // 单击事件
                                        public void onClick(DialogInterface dialog, int which)
                                        {
                                            //点击相应的班级进行跳转
                                            try {
                                                if (state.equals("1"))
                                                {
                                                    Intent intent=new Intent(AllTeachersActivity.this,SubstituteCourseActivity.class);
                                                    JSONObject js = dataArr.getJSONObject(positions);
                                                    //传值 班级id 所教班级id
                                                    intent.putExtra("substituteId",js.getString("substituteId"));
                                                    intent.putExtra("teacherId",teacherId);
                                                    intent.putExtra("teacherId1",js.getString("teacherId"));
                                                    intent.putExtra("teacherName",js.getString("teacherName"));
                                                    intent.putExtra("itemId",js.getString("itemId"));
                                                    Log.d("name = ",name);
                                                    startActivity(intent);
                                                }else
                                                {
                                                    Intent intent=new Intent(AllTeachersActivity.this,CombinedLessonActivity.class);

                                                    JSONObject js = dataArr.getJSONObject(positions);
                                                    //传值 班级id 所教班级id
                                                    intent.putExtra("substituteId",js.getString("substituteId"));
                                                    intent.putExtra("teacherId",teacherId);
                                                    intent.putExtra("teacherId1",js.getString("teacherId"));
                                                    intent.putExtra("teacherName",js.getString("teacherName"));
                                                    intent.putExtra("itemId",js.getString("itemId"));
                                                    Log.d("name = ",name);
                                                    startActivity(intent);
                                                }

                                                    finish();
                                            } catch (JSONException e) {
                                                e.printStackTrace();
                                            }

                                        }
                                    }).
                            // 设置取消按钮
                                    setNegativeButton("否",
                                    new DialogInterface.OnClickListener()
                                    {
                                        public void onClick(DialogInterface dialog,
                                                            int which)
                                        {

                                        }
                                    });
                    // 创建对话框
                    AlertDialog ad = builder.create();
                    // 显示对话框
                    ad.show();


                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        });
    }
    @Override
    protected void onStart() {
        super.onStart();
        requestWithUserId();
    }
    /**
     * 请求方法
     * */
    private  void requestWithUserId(){
        //菊花的开始方法
        mLoading.show();
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("subTeacherId",teacherId)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.TeacherSubstituteTeachersQuery)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }
            //接收方法
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse返回的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        //菊花结束方法
                        mLoading.dismiss();
                        try {
                            //解析json数据
                            jsonParseWithJsonStr(retStr);
                        } catch (JSONException e) {
                            mLoading.dismiss();
                            e.printStackTrace();
                        }
                    }
                });
            }
        });
    }

    /**
     * 解析数据方法
     * */
    //json解析方法

    private  void jsonParseWithJsonStr (String jsonStr) throws JSONException {

        JSONArray jsArr = new JSONArray(jsonStr);
        dataArr = jsArr;
        List<String> data = new ArrayList<String>();
        ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String,     Object>>();/*在数组中存放数据*/

        HashMap<String, Object> map2 = new HashMap<String, Object>();
        for (int i = 0; i < jsArr.length(); i++) {
            JSONObject js = jsArr.getJSONObject(i);
            name = js.optString("teacherName");
            HashMap<String, Object> map = new HashMap<String, Object>();
            map.put("name", name);
            listItem.add(map);
        }
        if (jsArr.length() == 0)
        {
            midToast("无数据",3);
        }

        SimpleAdapter qrAdapter = new SimpleAdapter(this,listItem, R.layout.item_all_teacher,
                new  String[]{"name"},
                new int[]{R.id.all_teacher1});
        listView.setAdapter(qrAdapter);
    }



    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
}
<file_sep>package com.xinnuo.apple.nongda.studentActivity.AccountSettings;
/**
 * 账号设置界面 里面包含5个功能
 * */

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.xinnuo.apple.nongda.Binding.StudentBindingActivity;
import com.xinnuo.apple.nongda.MainActivity;
import com.xinnuo.apple.nongda.R;

public class StuAccountSettingsActivity extends AppCompatActivity  {
    //定义控件
    private TextView stu_account_setting1;  //绑定手机号
    private TextView stu_account_setting2;  //修改密码
    private TextView stu_account_setting3;  //意见反馈
    private TextView stu_account_setting4;  //关于我们
    private TextView stu_sign_out;           //退出登录

    private String studentNo;
    private String id;
    private String password;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_stu_account_settings);
        Intent intent = getIntent();
        id = intent.getStringExtra("id");
        studentNo = intent.getStringExtra("studentNo");
        Log.d("stuNo =",studentNo);
        password = intent.getStringExtra("password");
        binding();
        clickJump();
    }

    //绑定控件
    private void binding()
    {
       stu_account_setting1 = (TextView) findViewById(R.id.stu_account_setting1);
       stu_account_setting2 = (TextView) findViewById(R.id.stu_account_setting2);
       stu_account_setting3 = (TextView) findViewById(R.id.stu_account_setting3);
       stu_account_setting4 = (TextView) findViewById(R.id.stu_account_setting4);
       stu_sign_out = (TextView) findViewById(R.id.sign_out);
    }

    //点击相应控件进行相应的跳转
    private void clickJump()
    {
        //绑定手机号
        stu_account_setting1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(StuAccountSettingsActivity.this,StudentBindingActivity.class);
                intent.putExtra("id",id);
                String state = "2";
                intent.putExtra("studentNo",studentNo);
                intent.putExtra("password",<PASSWORD>);
                intent.putExtra("state",state);
                startActivity(intent);
            }
        });
        //修改密码
        stu_account_setting2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(StuAccountSettingsActivity.this,StuModifyPasswordActivity.class);
                intent.putExtra("id",id);
                intent.putExtra("studentNo",studentNo);
                intent.putExtra("password",<PASSWORD>);
                startActivity(intent);
            }
        });
        //意见反馈
        stu_account_setting3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });
        //关于我们
        stu_account_setting4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });
        //退出登录
        stu_sign_out.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                loginOut();
            }
        });
    }
    //退出方法 点击注销时给出提示信息
    private void loginOut(){
        // 设置显示信息
        final AlertDialog.Builder builder = new AlertDialog.Builder(this);

        builder.setMessage("确定要退出？").
                // 设置确定按钮
                        setPositiveButton("是",
                        new DialogInterface.OnClickListener() {
                            // 单击事件
                            public void onClick(DialogInterface dialog, int which) {
                                // 设置TextView文本
                                //点击是的时候去进行提交
                                SharedPreferences sp = getSharedPreferences("userinfo",
                                        Context.MODE_PRIVATE);
                                SharedPreferences.Editor editor = sp.edit();

                                editor.putBoolean("pswd_checkBox", false);
                                editor.putString("msgDate", null);

                                editor.commit();

                                //进行页面跳转，跳回登录界面
                                Intent intent = new Intent(StuAccountSettingsActivity.this, MainActivity.class);
                                startActivity(intent);
                                finish();
                            }
                        }).
                // 取消跳转
                        setNegativeButton("否",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                                int which) {
                            }
                        });
        // 创建对话框
        AlertDialog ad = builder.create();
        // 显示对话框
        ad.show();
    }
}
<file_sep>package com.xinnuo.apple.nongda.entity;

/**
 * 教师基类
 */


public class TeacherModel {
    /**
     * birthday :
     * phone : 18904509588
     * sex : 1
     * status : 3
     * jurisdiction : 3
     * itemId : 1001
     * collegeName :
     * password : 1
     * intro : 3
     * id : 27
     * cardNo : 12345678
     * picture : t01b79970053ab4ab15.jpg
     * nationName : 汉族
     * name : 杨俊伟
     * loginSta : success
     */

    private String birthday;
    private String phone;
    private int sex;
    private int status;
    private String jurisdiction;
    private String itemId;
    private String collegeName;
    private String password;
    private String intro;
    private String id;
    private String cardNo;
    private String picture;
    private String nationName;
    private String name;
    private String loginSta;

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public int getSex() {
        return sex;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getJurisdiction() {
        return jurisdiction;
    }

    public void setJurisdiction(String jurisdiction) {
        this.jurisdiction = jurisdiction;
    }

    public String getItemId() {
        return itemId;
    }

    public void setItemId(String itemId) {
        this.itemId = itemId;
    }

    public String getCollegeName() {
        return collegeName;
    }

    public void setCollegeName(String collegeName) {
        this.collegeName = collegeName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getIntro() {
        return intro;
    }

    public void setIntro(String intro) {
        this.intro = intro;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public String getPicture() {
        return picture;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public String getNationName() {
        return nationName;
    }

    public void setNationName(String nationName) {
        this.nationName = nationName;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLoginSta() {
        return loginSta;
    }

    public void setLoginSta(String loginSta) {
        this.loginSta = loginSta;
    }
}
<file_sep>package com.xinnuo.apple.nongda.TeacherActivity.Resultquery;
/**
 * 展示学生列表
 * */

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class StudentDetailedQueryActivity extends BaseActivity {
    private OkHttpClient client;
    private ListView listView;
    private String studentId;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_student_detailed_query);
        initOkHttp();
        listView = (ListView) findViewById(R.id.list_studentDetaileds) ;
    }

    protected void onStart()
    {
        super.onStart();
        //取出上个界面传过来的id
        Intent intent = getIntent();
        studentId = intent.getStringExtra("studentId");
        requestWithUserId(studentId);
    }
    //请求方法
    private  void requestWithUserId(String id){
        mLoading.show();
        Log.d("StudentList ==== ", id);
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("studentId",id)   //id
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.StudentDetailedScore)    //请求地址
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }
            //接收后台返回值方法
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse返回的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        //菊花结束方法
                        mLoading.dismiss();
                        try {
                            //解析json数据
                            jsonParseWithJsonStr(retStr);
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }


                    }
                });
            }
        });
    }

    //json解析
    /*
    * 测试数据
    *  "result": "51.60",
        "sex": "2",
        "weight": "54.3",
        "gradeId": "4",
        "vital_capacity_mark": "0.0",
        "jump_mark": "100.0",
        "name": "董萍",
        "studentNo": "12011101",
        "kiol_awarded_marks": "0",
        "vital_capacity_evaluate": "不及格",
        "stature": "166.3",
        "kilo_evaluate": "0",
        "jump_evaluate": "优秀",
        "bend_evaluate": "及格",
        "kilo_capacity": "0",
        "lie_capacity": "0",
        "health": "不及格",
        "kilo_mark": "0",
        "jump": "211",
        "lie_awarded_marks": "0",
        "vital_capacity": "641",
        "Bmi_mark": "100.0",
        "bendl_capacity": "11.0",
        "fifty_mark": "100.0",
        "lie_mark": "0",
        "bmi_evaluate": "100.0",
        "fifty_evaluate": "优秀",
        "lie_evaluate": "0",
        "bend_mark": "66.0",
        "fifty_capacity": "6.53"
    * */

    private  void jsonParseWithJsonStr (String jsonStr) throws JSONException {




        ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String,     Object>>();/*在数组中存放数据*/



            JSONObject js = new JSONObject(jsonStr);

                HashMap<String, Object> map = new HashMap<String, Object>();
                map.put("Item1",js.getString("name"));
                map.put("Item2", js.getString("studentNo"));
                String sex;
            if (js.getString("sex").equals("1")) {
                sex= "男";

            }else{
                sex="女";
            }
                map.put("Item3", sex);
                String gradeId;
                if (js.getString("gradeId").equals("1"))
                {
                    gradeId = "一年级";
                }else if (js.getString("gradeId").equals("2"))
                {
                    gradeId = "二年级";
                }else if (js.getString("gradeId").equals("3"))
                {
                    gradeId = "三年级";
                }else
                {
                    gradeId = "四年级";
                }
                map.put("Item4", gradeId);
                //成绩
                map.put("Item6", js.getString("stature"));
                map.put("Item7", js.getString("weight"));
                map.put("Item8", js.getString("vital_capacity"));
                map.put("Item9", js.getString("jump"));
                map.put("Item10", js.getString("lie_capacity"));
                map.put("Item11", js.getString("bendl_capacity"));
                map.put("Item12", js.getString("fifty_capacity"));
                map.put("Item13", js.getString("kilo_capacity"));
                map.put("Item14", js.getString("lie_awarded_marks"));
                map.put("Item15", js.getString("kiol_awarded_marks"));
                //得分
                map.put("Item16", js.getString("Bmi_mark"));
                map.put("Item17", js.getString("Bmi_mark"));
                map.put("Item18", js.getString("vital_capacity_mark"));
                map.put("Item19", js.getString("jump_mark"));
                map.put("Item20", js.getString("lie_mark"));
                map.put("Item21", js.getString("bend_mark"));
                map.put("Item22", js.getString("fifty_mark"));
                map.put("Item23", js.getString("kilo_mark"));
                map.put("Item24", "0");
                map.put("Item25", "0");
                map.put("Item36", js.getString("result"));
                //评价
                map.put("Item26", js.getString("bmi_evaluate"));
                map.put("Item27", js.getString("bmi_evaluate"));
                map.put("Item28", js.getString("vital_capacity_evaluate"));
                map.put("Item29", js.getString("jump_evaluate"));
                map.put("Item30", js.getString("lie_evaluate"));
                map.put("Item31", js.getString("bend_evaluate"));
                map.put("Item32", js.getString("fifty_evaluate"));
                map.put("Item33", js.getString("kilo_evaluate"));
                map.put("Item34", " ");
                map.put("Item35", " ");
                map.put("Item37", js.getString("health"));
                listItem.add(map);

        if (js.length() == 0)
        {
            midToast("无数据",3);
        }
        SimpleAdapter qrAdapter;
        if (js.getString("sex").equals("1")) {
            qrAdapter = new SimpleAdapter(this, listItem, R.layout.item_student_detailed_boy_query,
                    new String[]{"Item1", "Item2", "Item3", "Item4", "Item6", "Item7", "Item8", "Item9", "Item10", "Item11", "Item12", "Item13", "Item14", "Item15", "Item16", "Item17", "Item18", "Item19", "Item20",
                            "Item21", "Item22", "Item23", "Item24", "Item25", "Item26", "Item27", "Item28", "Item29", "Item30", "Item31", "Item32", "Item33", "Item34", "Item35", "Item36", "Item37"},
                    new int[]{R.id.detailed56, R.id.detailed58, R.id.detailed52, R.id.detailed54, R.id.detailed8, R.id.detailed13, R.id.detailed18, R.id.detailed23, R.id.detailed28, R.id.detailed33
                            , R.id.detailed38, R.id.detailed43, R.id.detailed48, R.id.detailed61, R.id.detailed9, R.id.detailed14, R.id.detailed19, R.id.detailed24, R.id.detailed29, R.id.detailed34,
                            R.id.detailed39, R.id.detailed44, R.id.detailed49, R.id.detailed62, R.id.detailed10, R.id.detailed15, R.id.detailed20, R.id.detailed25, R.id.detailed30, R.id.detailed35,
                            R.id.detailed40, R.id.detailed45, R.id.detailed50, R.id.detailed63, R.id.detailed67, R.id.detailed68});
        }else {
            qrAdapter = new SimpleAdapter(this, listItem, R.layout.item_student_detailed_girl_query,
                    new String[]{"Item1", "Item2", "Item3", "Item4", "Item6", "Item7", "Item8", "Item9", "Item10", "Item11", "Item12", "Item13", "Item14", "Item15", "Item16", "Item17", "Item18", "Item19", "Item20",
                            "Item21", "Item22", "Item23", "Item24", "Item25", "Item26", "Item27", "Item28", "Item29", "Item30", "Item31", "Item32", "Item33", "Item34", "Item35", "Item36", "Item37"},
                    new int[]{R.id.detailed56, R.id.detailed58, R.id.detailed52, R.id.detailed54, R.id.detailed8, R.id.detailed13, R.id.detailed18, R.id.detailed23, R.id.detailed28, R.id.detailed33
                            , R.id.detailed38, R.id.detailed43, R.id.detailed48, R.id.detailed61, R.id.detailed9, R.id.detailed14, R.id.detailed19, R.id.detailed24, R.id.detailed29, R.id.detailed34,
                            R.id.detailed39, R.id.detailed44, R.id.detailed49, R.id.detailed62, R.id.detailed10, R.id.detailed15, R.id.detailed20, R.id.detailed25, R.id.detailed30, R.id.detailed35,
                            R.id.detailed40, R.id.detailed45, R.id.detailed50, R.id.detailed63, R.id.detailed67, R.id.detailed68});
        }

        listView.setAdapter(qrAdapter);
    }
    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
}
<file_sep>package com.xinnuo.apple.nongda.TeacherActivity.CourseAttendance;
/**
 * 考勤列表
 * */
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class TeacherAttendanceListActivity extends BaseActivity {
    private OkHttpClient client;
    private String sportclassId;
    private ListView listView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_teacher_attendance_list);
        listView = (ListView) findViewById(R.id.teacher_attendance_list);
        initOkHttp();
        Intent intent = getIntent();
        sportclassId = intent.getStringExtra("sportclassId");
        requestWithUserId();
    }
    /**
     * 请求方法
     * */
    private  void requestWithUserId(){
        //菊花的开始方法
        mLoading.show();
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("sportclassId",sportclassId)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.TeacherAttendanceList)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }
            //接收方法
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse返回的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        //菊花结束方法
                        mLoading.dismiss();
                        try {
                            //解析json数据
                            jsonParseWithJsonStr(retStr);
                        } catch (JSONException e) {
                            mLoading.dismiss();
                            e.printStackTrace();
                        }
                    }
                });
            }
        });
    }

    /**
     * 解析数据
     * 测试数据
     *   "sex": "2",
         "name": "石健美",
         "sportClass": "乒乓球",
         "type": "no",
         "sutdentNo": "11042220"
     * */


    private  void jsonParseWithJsonStr (String jsonStr) throws JSONException {

        JSONArray jsArr = new JSONArray(jsonStr);

        List<String> data = new ArrayList<String>();
        ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String,     Object>>();/*在数组中存放数据*/
        for (int i = 0; i < jsArr.length(); i++) {
            JSONObject js = jsArr.getJSONObject(i);
            String count = i+1+"";
            String sutdentNo = js.getString("sutdentNo");
            String name = js.getString("name");
            String sex;
            if (js.getString("sex").equals("1"))
            {
                sex = "男";
            }else
            {
                sex = "女";
            }
            String sportClass = js.getString("sportClass");
            String type ;
            if (js.getString("type").equals("yes"))
            {
                type = js.getString("date");
            }else
            {
                type = "未签到";
            }
            HashMap<String, Object> map = new HashMap<String, Object>();
            map.put("count",count);
            map.put("sutdentNo",sutdentNo);
            map.put("name",name);
            map.put("sex",sex);
            map.put("sportClass",sportClass);
            map.put("type",type);
            listItem.add(map);

        }
        if (jsArr.length() == 0)
        {
            midToast("无数据",3);
        }
        SimpleAdapter qrAdapter = new SimpleAdapter(this,listItem, R.layout.item_teacher_attendance_list,
                new  String[]{"count","sutdentNo","name","sex","sportClass","type"},
                new int[]{R.id.tea_att_list_number, R.id.tea_att_list_stunumber, R.id.tea_att_list_name, R.id.tea_att_list_sex, R.id.tea_att_list_class, R.id.tea_att_list_time,});
        listView.setAdapter(qrAdapter);

    }



    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
}
<file_sep>package com.xinnuo.apple.nongda.TeacherActivity.WorkPlan;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class TeacherWorkPlan extends BaseActivity {
    private ListView listView;
    private OkHttpClient client;
    private String teacherId;
    private TextView newlyAdded;
    private JSONArray dataArr;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initOkHttp();
        setContentView(R.layout.activity_teacher_work_plan);
        listView = (ListView) findViewById(R.id.list_work_plan);

        newlyAdded = (TextView) findViewById(R.id.newly_added);

        final Intent intent = getIntent();
        teacherId = intent.getStringExtra("teacherId");
        requestWithUserId(teacherId);
        newlyAdded.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent1 = new Intent(TeacherWorkPlan.this,TeacherAddWorkPlan.class);
                intent1.putExtra("teacherId",teacherId);
                startActivity(intent1);
            }
        });

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent intent1 = new Intent(TeacherWorkPlan.this,TeacherUpdateWorkPlan.class);
                try {
                    JSONObject work = dataArr.getJSONObject(position);
                    String ids = work.getString("id");
                    String title = work.getString("title");
                    String createDate = work.getString("createDate");
                    String beginDate = work.getString("beginDate");
                    String endDate = work.getString("endDate");
                    String workContent = work.getString("workContent");
                    String state = work.getString("state");
                    String summary = work.getString("summary");
                    Log.d("****",state+workContent+endDate+beginDate);
                    intent1.putExtra("id",ids);
                    intent1.putExtra("title",title);
                    intent1.putExtra("createDate",createDate);
                    intent1.putExtra("beginDate",beginDate);
                    intent1.putExtra("endDate",endDate);
                    intent1.putExtra("workContent",workContent);
                    intent1.putExtra("state",state);
                    intent1.putExtra("summary",summary);
                    intent1.putExtra("teacherId",teacherId);
                    startActivity(intent1);
                } catch (JSONException e) {
                    e.printStackTrace();
                }

            }
        });
    }

    /**
     * 请求方法
     * */
    private  void requestWithUserId(String teacherId){
        //菊花的开始方法
        mLoading.show();
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("teacherId",teacherId)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.WorkPlan)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }
            //接收方法
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse返回的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        //菊花结束方法
                        mLoading.dismiss();
                        try {
                            //解析json数据
                            jsonParseWithJsonStr(retStr);
                        } catch (JSONException e) {
                            mLoading.dismiss();
                            e.printStackTrace();
                        }
                    }
                });
            }
        });
    }

    /**
     * 解析数据方法
     * */


    private  void jsonParseWithJsonStr (String jsonStr) throws JSONException {

        JSONArray jsArr = new JSONArray(jsonStr);
        dataArr = jsArr;
        List<String> data = new ArrayList<String>();
        ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String,     Object>>();/*在数组中存放数据*/
        for (int i = 0; i < jsArr.length(); i++)
        {
            JSONObject js = jsArr.getJSONObject(i);
            String title = js.optString("title");
            String createDate = js.getString("createDate");
            String beginDate = js.getString("beginDate");
            String endDate = js.getString("endDate");
            String workContent = js.getString("workContent");
            String state = js.getString("state");
            String summary = js.getString("summary");
            HashMap<String, Object> map = new HashMap<String, Object>();
            map.put("title",title);
            map.put("createDate",createDate);
            map.put("beginDate",beginDate);
            map.put("endDate",endDate);
            map.put("workContent",workContent);
            map.put("state",state);
            map.put("summary",summary);
            listItem.add(map);
        }

        if (jsArr.length() == 0)
        {
            midToast("无数据",3);
        }
        SimpleAdapter qrAdapter = new SimpleAdapter(this,listItem, R.layout.item_teacher_work_plan,
                new  String[]{"title","createDate","beginDate","endDate","workContent","state","summary"},
                new int[]{R.id.work_title, R.id.work_createdate, R.id.work_startdate, R.id.work_enddate, R.id.work_plan, R.id.work_yesno, R.id.work_summary});
        listView.setAdapter(qrAdapter);

    }
    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
}
<file_sep>package com.xinnuo.apple.nongda.singin;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.util.Log;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.entity.StudentModel;
import com.xinnuo.apple.nongda.Binding.StudentBindingActivity;
import com.xinnuo.apple.nongda.studentActivity.StudentActivity;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * 学生登录方法
 * stu_Login 跳转方法 setSutdentInfoWith 学生对象赋值方法 stu_Binding 跳转学生绑定方法
 */

public class Student_Singin extends BaseActivity {

    /**
     * 学生跳转方法：登陆成功跳转到学生操作界面
     * 传的值 studentId：学生id studentNo：学号 studentClassId：班级id studentName：学生姓名及班级名称:
     * */
    public Intent stu_Login(Activity activity,JSONObject jsObj , StudentModel studentInfo)
    {
        Intent intent = null;
        try {
            studentInfo = setSutdentInfoWith(jsObj);
            //跳转界面
            intent = new Intent(activity, StudentActivity.class);
            Log.d("student id = ", studentInfo.getId());
            //传值 学生id 学生学号 班级id 学生姓名 班级名称
            intent.putExtra("studentId", studentInfo.getId());
            intent.putExtra("studentNo", studentInfo.getStudentNo());
            intent.putExtra("studentClassId", studentInfo.getClassId());
            intent.putExtra("studentName",studentInfo.getName());
            intent.putExtra("className",studentInfo.getClassName());
            intent.putExtra("password",studentInfo.getPassword());
            Integer gId = studentInfo.getGradeId();
            intent.putExtra("gradeId",gId.toString());
            // Log.d("~~~~~mainclassId = ", studentInfo.getClassId()+"\n"+studentInfo.getStudentNo()+"\n"+studentInfo.getName()+"\n"+studentInfo.getClassName());
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return  intent;
    }

    /**
     * 为学生对象赋值方法
     * */
    public StudentModel setSutdentInfoWith(JSONObject jsObj) throws JSONException
    {
        //学生model
        StudentModel student = new StudentModel();
        student.setCardId(jsObj.getString("cardId"));
        student.setBirthday(jsObj.getString("birthday"));
        student.setPhone(jsObj.getString("phone"));
        student.setStudentNo(jsObj.getString("studentNo"));
        student.setSex(jsObj.getString("sex"));
        student.setGradeId(jsObj.getInt("gradeId"));
        student.setStatus(jsObj.getInt("status"));
        student.setClassId(jsObj.getString("classId"));
        student.setElectiveInformation(jsObj.getString("electiveInformation"));
        student.setPassword(<PASSWORD>("<PASSWORD>"));
        student.setCollegeName(jsObj.getString("collegeName"));
        student.setNationId(jsObj.getString("nationId"));
        student.setId(jsObj.getString("id"));
        student.setStuSource(jsObj.getString("stuSource"));
        student.setHomeAddress(jsObj.getString("homeAddress"));
        student.setName(jsObj.getString("name"));
        student.setClassName(jsObj.getString("className"));
        student.setLoginSta(jsObj.getString("loginSta"));
        student.setReelect(jsObj.getInt("reelect"));
        student.setIdNumber(jsObj.getString("idNumber"));
        return student;
    }

    /**
     *学生绑定方法 跳转到学生绑定界面
     * 传的值 stuNo 学号
     *  */
    public void stu_Binding(final String stuNo, final Activity activity ,AlertDialog.Builder builder) throws Exception
    {


        //final String userNo = userIdEditText.getText().toString().trim();

        // 设置显示信息
        builder.setMessage("身份未绑定，是否绑定？").
                // 设置确定按钮
                        setPositiveButton("是",
                        new DialogInterface.OnClickListener() {
                            // 单击事件
                            public void onClick(DialogInterface dialog, int which) {
                                //进行页面跳转 跳到绑定界面需要输入身份证号和手机号进行绑定
                                Intent intent = new Intent(activity, StudentBindingActivity.class);
                                //传值学生id
                                intent.putExtra("stuNo", stuNo);
                            }
                        }).
                // 设置取消按钮
                        setNegativeButton("否",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                                int which) {
                            }
                        });
        // 创建对话框
        AlertDialog ad = builder.create();
        // 显示对话框
        ad.show();
    }

}
<file_sep>package com.xinnuo.apple.nongda.Admin.Meeting;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;

import com.xinnuo.apple.nongda.R;

import java.util.List;

public class Myadapter extends BaseAdapter {
	private List<String> arraylist;
	private List<String> arraylist1;
	private List<String> arraylist2;
	private List<String> arraylist3;
	private Context context;
	private boolean[] array;
	
	public Myadapter(Context context, List<String> arraylist,List<String> arraylist1,List<String> arraylist2,List<String> arraylist3, boolean[] array ){
		this.context = context;
		this.arraylist = arraylist;
		this.arraylist1 = arraylist1;
		this.arraylist2 = arraylist2;
		this.arraylist3 = arraylist3;
		this.array = array;
		
	}
	@Override
	public View getView(final int position, View convertView,
						ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder vh  = new ViewHolder();
		if (convertView == null) {
			convertView = LayoutInflater.from(context).inflate(R.layout.item_query_all_teacher, null);

			vh.tv = (TextView) convertView.findViewById(R.id.admin_number);
			vh.tv1 = (TextView) convertView.findViewById(R.id.admin_name);
			vh.tv2 = (TextView) convertView.findViewById(R.id.admin_subject);
			vh.tv3 = (TextView) convertView.findViewById(R.id.admin_phone);
			vh.cb = (CheckBox) convertView.findViewById(R.id.checkBox);
			convertView.setTag(vh);
		}else{
			vh = (ViewHolder) convertView.getTag();
		}	
		if(AdminQueryAllteacherActivity.visiblecheck){
			vh.cb.setVisibility(View.VISIBLE);
		}else{
			vh.cb.setVisibility(View.GONE);
		}
		
		vh.cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {

			@Override
			public void onCheckedChanged(CompoundButton buttonView,
					boolean isChecked) {
				// TODO Auto-generated method stub
				array[position] = isChecked;
			}
		});
		vh.tv.setText(arraylist.get(position));
		vh.tv1.setText(arraylist1.get(position));
		vh.tv2.setText(arraylist2.get(position));
		vh.tv3.setText(arraylist3.get(position));
		vh.cb.setChecked(array[position]);
		return convertView;
	}

	class ViewHolder {
		
		
		public TextView tv;
		public TextView tv1;
		public TextView tv2;
		public TextView tv3;
		public CheckBox cb;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return arraylist.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return arraylist.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

}
<file_sep>package com.xinnuo.apple.nongda.Admin.Meeting;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.Utils;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class MeetingInfoDetailActivity extends BaseActivity {
    private OkHttpClient client;
    private TextView leave;
    private TextView sign;
    private TextView conferencelist;
    private TextView relTime;
    private TextView meetType;
    private TextView teacherinfoName;
    private TextView theme;
    private TextView meetingTime;
    private TextView place;
    private TextView introduction;
    private String id;
    private String teacherId;
    private String relTime1;
    private String meetType1;
    private String teacherinfoName1;
    private String theme1;
    private String meetingTime1;
    private String place1;
    private String introduction1;
    private static double signLongitude;
    private static double signLatitude;
    private AMapLocationClient locationClient = null;
    private AMapLocationClientOption locationOption = new AMapLocationClientOption();
    private static final double ALERT_DISTANCE = 50;
    private static double distance;
    private static double Longitude;
    private static double Latitude;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_meeting_info_detail);
        Binding();
        initOkHttp();
        final Intent intent = getIntent();
        teacherId = intent.getStringExtra("teacherId");
        relTime.setText(intent.getStringExtra("relTime"));
        relTime1 = intent.getStringExtra("relTime");
        meetType1 = intent.getStringExtra("meetType");
        teacherinfoName1 = intent.getStringExtra("teacherinfoName");
        theme1 = intent.getStringExtra("theme");
        meetingTime1 = intent.getStringExtra("meetingTime");
        place1 = intent.getStringExtra("place");
        introduction1 = intent.getStringExtra("introduction");
        id = intent.getStringExtra("id");
        String meetTypes;
        if (intent.getStringExtra("meetType").equals("0"))
        {
            meetTypes = "签到未开始";
        }else if (intent.getStringExtra("meetType").equals("1"))
        {
            meetTypes = "签到进行中，请准备签到";
        }else
        {
            meetTypes = "签到已结束";
        }
        meetType.setText(meetTypes);
        teacherinfoName.setText(intent.getStringExtra("teacherinfoName"));
        theme.setText(intent.getStringExtra("theme"));
        meetingTime.setText(intent.getStringExtra("meetingTime"));
        place.setText(intent.getStringExtra("place"));
        introduction.setText(intent.getStringExtra("introduction"));
        id = intent.getStringExtra("id");
        Log.d("id======",id);
        conferencelist.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                initLocation();
                startLocation();
            }
        });
        leave.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 设置显示信息
                final AlertDialog.Builder builder = new AlertDialog.Builder(MeetingInfoDetailActivity.this);

                builder.setMessage("确定要删除会议？").
                        // 设置确定按钮
                                setPositiveButton("是",
                                new DialogInterface.OnClickListener() {
                                    // 单击事件
                                    public void onClick(DialogInterface dialog, int which)
                                    {
                                        // 设置TextView文本
                                        //点击是的时候去进行提交
                                        scanCodeSign(id);

                                    }
                                }).
                        // 设置取消按钮
                                setNegativeButton("否",
                                new DialogInterface.OnClickListener()
                                {
                                    public void onClick(DialogInterface dialog,
                                                        int which)
                                    {

                                    }
                                });
                // 创建对话框
                AlertDialog ad = builder.create();
                // 显示对话框
                ad.show();
            }
        });
        sign.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent1 = new Intent(MeetingInfoDetailActivity.this,AdminAttendanceListActivity.class);
                intent1.putExtra("id",id);
                startActivity(intent1);
            }
        });
    }
    //绑定控件方法
    private void Binding()
    {
        leave = (TextView) findViewById(R.id.meet_leave);
        sign= (TextView) findViewById(R.id.meet_sign);
        conferencelist = (TextView) findViewById(R.id.meet_conferencelist);
        relTime = (TextView) findViewById(R.id.admin_meeting_info1);
        meetType = (TextView) findViewById(R.id.admin_meeting_info2);
        teacherinfoName = (TextView) findViewById(R.id.admin_meeting_info3);
        theme = (TextView) findViewById(R.id.admin_meeting_info4);
        meetingTime = (TextView) findViewById(R.id.admin_meeting_info5);
        place = (TextView) findViewById(R.id.admin_meeting_info6);
        introduction = (TextView) findViewById(R.id.admin_meeting_info7);
    }
    private void initLocation(){
        //初始化client
        locationClient = new AMapLocationClient(this.getApplicationContext());
        //设置定位参数

        locationClient.setLocationOption(getDefaultOption());
        // 设置定位监听
        locationClient.setLocationListener(locationListener);
    }
    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }


    /**
     * 开始定位
     *
     * @since 2.8.0
     * @author hongming.wang
     *
     */
    private void startLocation(){

        // 设置定位参数
        locationClient.setLocationOption(locationOption);
        // 启动定位
        locationClient.startLocation();
    }
    /**
     * 默认的定位参数
     * @since 2.8.0
     * @author hongming.wang
     *
     */
    private AMapLocationClientOption getDefaultOption(){
        AMapLocationClientOption mOption = new AMapLocationClientOption();
        mOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);//可选，设置定位模式，可选的模式有高精度、仅设备、仅网络。默认为高精度模式
        mOption.setGpsFirst(false);//可选，设置是否gps优先，只在高精度模式下有效。默认关闭
        mOption.setHttpTimeOut(30000);//可选，设置网络请求超时时间。默认为30秒。在仅设备模式下无效
        mOption.setInterval(2000);//可选，设置定位间隔。默认为2秒
        mOption.setNeedAddress(true);//可选，设置是否返回逆地理地址信息。默认是ture
        mOption.setOnceLocation(true);//可选，设置是否单次定位。默认是false
        mOption.setOnceLocationLatest(false);//可选，设置是否等待wifi刷新，默认为false.如果设置为true,会自动变为单次定位，持续定位时不要使用
        AMapLocationClientOption.setLocationProtocol(AMapLocationClientOption.AMapLocationProtocol.HTTP);//可选， 设置网络请求的协议。可选HTTP或者HTTPS。默认为HTTP
        return mOption;

    }
    /**
     * 定位监听
     */
    AMapLocationListener locationListener = new AMapLocationListener() {
        @Override
        public void onLocationChanged(AMapLocation loc) {
            if (null != loc) {
                //解析定位结果
                String result = Utils.getLocationStr(loc);
                /**
                 * sb.append("经    度    : " + location.getLongitude() + "\n");
                 sb.append("纬    度    : " + location.getLatitude() + "\n");
                 */

                if (Latitude == 0.0 && Longitude == 0.0) {

                    Longitude = loc.getLongitude();
                    Latitude = loc.getLatitude();
                    final String coutent = "教师已上传定位坐标，可以定位签到了";
                    startPositioning();
                }

                String ret = ""+Longitude + Latitude;
                String jStr = Longitude+",";
                String wStr = Latitude+"";
                Log.d("定位结果：long = ",Longitude+"lat = "+Latitude);
//                statuTV.setText(jStr+wStr);
//                test3TV.setText("定位结果：long = "+Longitude+"lat = "+Latitude);



            } else {
                //statuTV.setText("定位失败，loc is null");
            }
        }
    };
    /**
     * 根据两点间经纬度坐标（double值），计算两点间距离，
     *
     * @param lat1
     * @param lng1
     * @param lat2
     * @param lng2
     * @return 距离：单位为米
     */
    public static double DistanceOfTwoPoints(double lat1,double lng1,
                                             double lat2,double lng2) {
        double radLat1 = rad(lat1);
        double radLat2 = rad(lat2);
        double a = radLat1 - radLat2;
        double b = rad(lng1) - rad(lng2);
        double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2)
                + Math.cos(radLat1) * Math.cos(radLat2)
                * Math.pow(Math.sin(b / 2), 2)));
        s = s * 6378137.0;
        s = Math.round(s * 10000) / 10000;
        return s;
    }
    /**
     * 停止定位
     *
     * @since 2.8.0
     * @author hongming.wang
     *
     */
    private void stopLocation(){
        // 停止定位
        locationClient.stopLocation();
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        destroyLocation();
    }
    /**
     * 销毁定位
     *
     * @since 2.8.0
     * @author hongming.wang
     *
     */
    private void destroyLocation(){
        if (null != locationClient) {
            /**
             * 如果AMapLocationClient是在当前Activity实例化的，
             * 在Activity的onDestroy中一定要执行AMapLocationClient的onDestroy
             */
            locationClient.onDestroy();
            locationClient = null;
            locationOption = null;
        }
    }
    private static double rad(double d) {
        return d * Math.PI / 180.0;
    }
    //存入管理员坐标
    private void startPositioning(){
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("meetingId",id)
                .add("longitude",Longitude+"")
                .add("latitude",Latitude+"")
                .add("meetType","1")
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.MeetingOpenSignIn)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {
                //signSleepTextView.setText("网络异常！");

            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                final String retStr = response.body().string();

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {

                        mLoading.dismiss();
                        try {
                            JSONObject jsObj = new JSONObject(retStr);
                            if (jsObj.getString("melodyClass").equals("yes")){
                                AlertDialog.Builder builder  = new AlertDialog.Builder(MeetingInfoDetailActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("坐标已上传,可以开始签到了！") ;
                                String ret = ""+Longitude + Latitude;
                                Log.d("ret = ",ret);
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }else if (jsObj.getString("melodyClass").equals("no")){
                                AlertDialog.Builder builder  = new AlertDialog.Builder(MeetingInfoDetailActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("坐标上传失败！") ;
                                String ret = ""+Longitude + Latitude;
                                Log.d("ret = ",ret);
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }else{
                                AlertDialog.Builder builder  = new AlertDialog.Builder(MeetingInfoDetailActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("出现异常,请重试！") ;
                                String ret = ""+Longitude + Latitude;
                                Log.d("ret = ",ret);
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }


                        } catch (JSONException e) {
                            e.printStackTrace();
                            //statuTV.setText("签到异常");
                        }


                    }
                });
            }
        });
    }
    private void scanCodeSign(String meetingId){
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("meetingId",meetingId)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.DeleteMeeting)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

                //signSleepTextView.setText("网络异常！");
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                final String retStr = response.body().string();

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {

                        Log.d("网络请求返回值",retStr);

                        try {
                            JSONObject jsObj = new JSONObject(retStr);
                            if (jsObj.getString("melodyClass").equals("yes")){
                                AlertDialog.Builder builder  = new AlertDialog.Builder(MeetingInfoDetailActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("会议删除成功！" ) ;
                                builder.setPositiveButton("确定" ,  new DialogInterface.OnClickListener() {
                                    // 单击事件
                                    public void onClick(DialogInterface dialog, int which)
                                    {
                                        // 设置TextView文本
                                        //点击是的时候去进行提交
                                        Intent intent = new Intent(MeetingInfoDetailActivity.this,AdministrationActivity.class);
                                        intent.putExtra("teacherId",teacherId);
                                        startActivity(intent);
                                    }
                                } );
                                builder.show();

                            }else {
                                AlertDialog.Builder builder  = new AlertDialog.Builder(MeetingInfoDetailActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("会议删除失败！" ) ;
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }

                        } catch (JSONException e) {
                            e.printStackTrace();
                            //statuTV.setText("签到异常");
                        }
                    }
                });
            }
        });
    }
}
<file_sep>package com.xinnuo.apple.nongda.studentActivity.OnlineTest;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class ApplyForExemptionActivity extends AppCompatActivity {
    private OkHttpClient client;
    private LinearLayout Layout_application;        //添加申请
    private LinearLayout apply_layout;               //申请列表
    private TextView stuName;                         //学生姓名
    private TextView stuNo;                           //学生编号
    private TextView stuTime;                         //申请时间
    private TextView stuState;                        //状态（1、成功 2、否 3、申请中 4、拒绝）
    private Button apply_withdraw;                   //取消申请
    private String id;
    private String name;
    private String studentNo;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_apply_for_exemption);
        initOkHttp();
        binding();
        final Intent intent = getIntent();
        id = intent.getStringExtra("id");
        name = intent.getStringExtra("name");
        studentNo = intent.getStringExtra("stuNo");
        apply_withdraw.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                final AlertDialog.Builder builder = new AlertDialog.Builder(ApplyForExemptionActivity.this);

                builder.setMessage("是否确认取消申请！").
                        // 设置确定按钮
                                setPositiveButton("确定",
                                new DialogInterface.OnClickListener() {
                                    // 单击事件
                                    public void onClick(DialogInterface dialog, int which)
                                    {
                                        // 设置TextView文本
                                        //点击是的时候去进行提交
                                        scanCodeSign1("2");


                                    }
                                }).
                        // 设置取消按钮
                                setNegativeButton("取消",
                                new DialogInterface.OnClickListener()
                                {
                                    public void onClick(DialogInterface dialog,
                                                        int which)
                                    {

                                    }
                                });
                // 创建对话框
                AlertDialog ad = builder.create();
                // 显示对话框
                ad.show();
            }
        });
        Layout_application.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent1 = new Intent(ApplyForExemptionActivity.this,AddApplicationActivity.class);
                intent1.putExtra("name",name);
                intent1.putExtra("studentNo",studentNo);
                intent1.putExtra("id",id);
                startActivity(intent1);
            }
        });

    }
    private void binding()
    {
        Layout_application = (LinearLayout) findViewById(R.id.Layout_application);
        apply_layout = (LinearLayout) findViewById(R.id.apply_layout);
        stuName = (TextView) findViewById(R.id.apply_stuName);
        stuNo = (TextView) findViewById(R.id.apply_stuNo);
        stuTime = (TextView) findViewById(R.id.apply_time);
        stuState = (TextView) findViewById(R.id.apply_state);
        apply_withdraw = (Button) findViewById(R.id.apply_withdraw);
    }
    public void onStart(){
        super.onStart();
        scanCodeSign();
    }
//添加或取消申请免试
    private void scanCodeSign1(String states){
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("studentNo",studentNo)
                .add("exemprtionStatus",states)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.AddApplication)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

                //signSleepTextView.setText("网络异常！");
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                final String retStr = response.body().string();

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {

                        Log.d("网络请求返回值",retStr);

                        try {
                            JSONObject jsObj = new JSONObject(retStr);
                            String retStr = jsObj.getString("melodyClass");
                            if (retStr.equals("yes")){
                                scanCodeSign();
                                Layout_application.setVisibility(View.VISIBLE);
                                apply_layout.setVisibility(View.VISIBLE);
                                apply_withdraw.setVisibility(View.INVISIBLE);
                            }else{

                            }
                            Layout_application.setVisibility(View.VISIBLE);
                            apply_layout.setVisibility(View.GONE);

                        } catch (JSONException e) {
                            e.printStackTrace();
                            //statuTV.setText("签到异常");
                        }
                    }
                });
            }
        });
    }
    private void scanCodeSign(){
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("id",id)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.ApplyForExemptionQueery)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

                //signSleepTextView.setText("网络异常！");
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                final String retStr = response.body().string();

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {

                        Log.d("网络请求返回值",retStr);

                        try {
                            apply_layout.setVisibility(View.VISIBLE);
                            Layout_application.setVisibility(View.GONE);
                            JSONArray jsArray = new JSONArray(retStr);
                            for (int i = 0 ; i < jsArray.length() ; i++){
                                JSONObject jsObj1 = jsArray.getJSONObject(i);
                                stuName.setText(jsObj1.getString("name"));
                                stuNo.setText(studentNo);
                                stuTime.setText(jsObj1.getString("time"));
                                String states = null;
                                if (jsObj1.getString("state").equals("1")){
                                    states = "成功";
                                }else if(jsObj1.getString("state").equals("2")){
                                    states = "否";
                                    Layout_application.setVisibility(View.VISIBLE);
                                }else if (jsObj1.getString("state").equals("3")){
                                    states = "申请中";
                                    apply_withdraw.setVisibility(View.VISIBLE);
                                }else if (jsObj1.getString("state").equals("4")){
                                    states = "拒绝";
                                }
                                stuState.setText(states);
                            }

                        } catch (JSONException e) {
                            e.printStackTrace();
                            JSONObject jsObj = null;
                            try {
                                jsObj = new JSONObject(retStr);
                                String retStr = jsObj.getString("melodyClass");
                                Layout_application.setVisibility(View.VISIBLE);
                                apply_layout.setVisibility(View.GONE);
                            } catch (JSONException e1) {
                                e1.printStackTrace();
                            }


                            //statuTV.setText("签到异常");
                        }
                    }
                });
            }
        });
    }
    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
}
<file_sep>package com.xinnuo.apple.nongda;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationClientOption.AMapLocationMode;
import com.amap.api.location.AMapLocationClientOption.AMapLocationProtocol;
import com.amap.api.location.AMapLocationListener;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

/**
 * 高精度定位模式功能演示
 *
 * @创建时间： 2015年11月24日 下午5:22:42
 * @项目名称： AMapLocationDemo2.x
 * @author hongming.wang
 * @文件名称: Hight_Accuracy_Activity.java
 * @类型名称: Hight_Accuracy_Activity
 */
public class Location_Activity extends Activity implements View.OnClickListener {
	private RadioGroup rgLocationMode;
	private EditText etInterval;
	private EditText etHttpTimeout;
	private CheckBox cbOnceLocation;
	private CheckBox cbAddress;
	private CheckBox cbGpsFirst;
	private CheckBox cbCacheAble;
	private CheckBox cbOnceLastest;
	private CheckBox cbSensorAble;
	private TextView statuTV;
	private Button btLocation;
	private static double signLongitude;
	private static double signLatitude;
	private AMapLocationClient locationClient = null;
	private AMapLocationClientOption locationOption = new AMapLocationClientOption();
	private static final double ALERT_DISTANCE = 50;
	private OkHttpClient client;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_location);
		btLocation = (Button) findViewById(R.id.bt_location);
		statuTV = (TextView) findViewById(R.id.textView);
		btLocation.setOnClickListener(this);
		//初始化定位
		initLocation();

	}
	

	
	@Override
	protected void onDestroy() {
		super.onDestroy();
		destroyLocation();
	}



	/**
	 * 设置控件的可用状态
	 */
	private void setViewEnable(boolean isEnable) {
		for(int i=0; i<rgLocationMode.getChildCount(); i++){
			rgLocationMode.getChildAt(i).setEnabled(isEnable);
		}
		etInterval.setEnabled(isEnable);
		etHttpTimeout.setEnabled(isEnable);
		cbOnceLocation.setEnabled(isEnable);
		cbGpsFirst.setEnabled(isEnable);
		cbAddress.setEnabled(isEnable);
		cbCacheAble.setEnabled(isEnable);
		cbOnceLastest.setEnabled(isEnable);
		cbSensorAble.setEnabled(isEnable);
	}




	
	/**
	 * 初始化定位
	 * 
	 * @since 2.8.0
	 * @author hongming.wang
	 *
	 */
	private void initLocation(){
		//初始化client
		locationClient = new AMapLocationClient(this.getApplicationContext());
		//设置定位参数
		locationClient.setLocationOption(getDefaultOption());
		// 设置定位监听
		locationClient.setLocationListener(locationListener);
	}
	
	/**
	 * 默认的定位参数
	 * @since 2.8.0
	 * @author hongming.wang
	 *
	 */
	private AMapLocationClientOption getDefaultOption(){
		AMapLocationClientOption mOption = new AMapLocationClientOption();
		mOption.setLocationMode(AMapLocationMode.Hight_Accuracy);//可选，设置定位模式，可选的模式有高精度、仅设备、仅网络。默认为高精度模式
		mOption.setGpsFirst(false);//可选，设置是否gps优先，只在高精度模式下有效。默认关闭
		mOption.setHttpTimeOut(30000);//可选，设置网络请求超时时间。默认为30秒。在仅设备模式下无效
		mOption.setInterval(2000);//可选，设置定位间隔。默认为2秒
		mOption.setNeedAddress(true);//可选，设置是否返回逆地理地址信息。默认是true
		mOption.setOnceLocation(false);//可选，设置是否单次定位。默认是false
		mOption.setOnceLocationLatest(false);//可选，设置是否等待wifi刷新，默认为false.如果设置为true,会自动变为单次定位，持续定位时不要使用
		AMapLocationClientOption.setLocationProtocol(AMapLocationProtocol.HTTP);//可选， 设置网络请求的协议。可选HTTP或者HTTPS。默认为HTTP
		//mOption.setSensorEnable(false);//可选，设置是否使用传感器。默认是false
		return mOption;
	}
	
	/**
	 * 定位监听
	 */
	AMapLocationListener locationListener = new AMapLocationListener() {
		@Override
		public void onLocationChanged(AMapLocation loc) {
			if (null != loc) {
				//解析定位结果
				String result = Utils.getLocationStr(loc);
				/**
				 * sb.append("经    度    : " + location.getLongitude() + "\n");
				 sb.append("纬    度    : " + location.getLatitude() + "\n");
				 */
				double Longitude =  loc.getLongitude();
				double Latitude =  loc.getLatitude();

				String ret = ""+Longitude + Latitude;
				String jStr = Longitude+",";
				String wStr = Latitude+"";
                statuTV.setText("定位结果：long = "+Longitude+"lat = "+Latitude);
//                test3TV.setText("定位结果：long = "+Longitude+"lat = "+Latitude);

				double distance = DistanceOfTwoPoints(Latitude,Longitude,signLatitude,signLongitude);
//                test4TV.setText("计算结果"+distance);


//				if (distance > ALERT_DISTANCE)
//				{
//					statuTV.setText("签到失败。距离定位点"+distance+"米");
////                    test5TV.setText("超出距离");
//
//				}
//				else
//				{
//					//立即签到
//					signRequest();
////                    test5TV.setText("在距离内");
//
//				}
//
			} else {
				statuTV.setText("定位失败，loc is null");
			}
		}
	};
	


	/**
	 * 开始定位
	 * 
	 * @since 2.8.0
	 * @author hongming.wang
	 *
	 */
	private void startLocation(){

		// 设置定位参数
		locationClient.setLocationOption(locationOption);
		// 启动定位
		locationClient.startLocation();
	}
	
	/**
	 * 停止定位
	 * 
	 * @since 2.8.0
	 * @author hongming.wang
	 *
	 */
	private void stopLocation(){
		// 停止定位
		locationClient.stopLocation();
	}
	
	/**
	 * 销毁定位
	 * 
	 * @since 2.8.0
	 * @author hongming.wang
	 *
	 */
	private void destroyLocation(){
		if (null != locationClient) {
			/**
			 * 如果AMapLocationClient是在当前Activity实例化的，
			 * 在Activity的onDestroy中一定要执行AMapLocationClient的onDestroy
			 */
			locationClient.onDestroy();
			locationClient = null;
			locationOption = null;
		}
	}

	@Override
	public void onClick(View v) {

		statuTV.setText("正在定位...");
		startLocation();
	}

	/**
	 * 根据两点间经纬度坐标（double值），计算两点间距离，
	 *
	 * @param lat1
	 * @param lng1
	 * @param lat2
	 * @param lng2
	 * @return 距离：单位为米
	 */
	public static double DistanceOfTwoPoints(double lat1,double lng1,
											 double lat2,double lng2) {
		double radLat1 = rad(lat1);
		double radLat2 = rad(lat2);
		double a = radLat1 - radLat2;
		double b = rad(lng1) - rad(lng2);
		double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2)
				+ Math.cos(radLat1) * Math.cos(radLat2)
				* Math.pow(Math.sin(b / 2), 2)));
		s = s * 6378137.0;
		s = Math.round(s * 10000) / 10000;
		return s;
	}

	private void signRequest(){
		RequestBody requestBodyPost = new FormBody.Builder()
				//.add("id", userId)
				.build();
		Request requestPost = new Request.Builder()
				//.url(makeSignSleep)
				.post(requestBodyPost)
				.build();
		client.newCall(requestPost).enqueue(new Callback() {
			@Override
			public void onFailure(Call call, IOException e) {

				//signSleepTextView.setText("网络异常！");
			}

			@Override
			public void onResponse(Call call, Response response) throws IOException {
				final String retStr = response.body().string();
				runOnUiThread(new Runnable() {
					@Override
					public void run() {
						Log.d("网络请求返回值",retStr);

						try {

							JSONObject jsObj = new JSONObject(retStr);


							String retStr = jsObj.getString("melodyClass");

							if (retStr.equals("yes")) {
								statuTV.setText("签到成功");

							}
							else if (retStr.equals("no"))
							{
								statuTV.setText("不是签到时间");

							}
							else if (retStr.equals("guiqin"))
							{
								statuTV.setText("已经签到过了");


							}else{
								statuTV.setText("服务器异常");


							}


							stopLocation();


						} catch (JSONException e) {
							e.printStackTrace();
							statuTV.setText("签到异常");

							stopLocation();

						}


					}
				});
			}
		});
	}
	private static double rad(double d) {
		return d * Math.PI / 180.0;
	}



}
<file_sep>package com.xinnuo.apple.nongda.studentActivity.TeacherEvaluation;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class TeacherScoreActivity extends BaseActivity {
    private TextView core1;
    private TextView core2;
    private TextView core3;
    private TextView core4;
    private TextView core5;
    private TextView core6,core7;
    private Button coreButton;
    private String core;
    private String teacherId;
    private String id;
    private OkHttpClient client;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_teacher_score);
        initOkHttp();
        Intent intent = getIntent();
        teacherId = intent.getStringExtra("teacherId");
        id = intent.getStringExtra("id");
        core1 = (TextView) findViewById(R.id.core1);
        core2 = (TextView) findViewById(R.id.core2);
        core3 = (TextView) findViewById(R.id.core3);
        core4 = (TextView) findViewById(R.id.core4);
        core5 = (TextView) findViewById(R.id.core5);
        core6 = (TextView) findViewById(R.id.core6);
        core7 = (TextView) findViewById(R.id.core7);
        coreButton = (Button) findViewById(R.id.core_button);
        core2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                core = "0";
                core1.setText(core);
            }
        });
        core3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                core = "2";
                core1.setText(core);
            }
        });
        core4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                core = "2";
                core1.setText(core);
            }
        });
        core5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                core = "3";
                core1.setText(core);
            }
        });
        core6.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                core = "4";
                core1.setText(core);
            }
        });
        core7.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                core = "5";
                core1.setText(core);
            }
        });
        coreButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 设置显示信息
                final AlertDialog.Builder builder = new AlertDialog.Builder(TeacherScoreActivity.this);

                builder.setMessage("确定要提交？").
                        // 设置确定按钮
                                setPositiveButton("是",
                                new DialogInterface.OnClickListener() {
                                    // 单击事件
                                    public void onClick(DialogInterface dialog, int which)
                                    {
                                        // 设置TextView文本
                                      //点击是的时候去进行提交
                                       requestWithUserId();
                                    }
                                }).
                        // 设置取消按钮
                                setNegativeButton("否",
                                new DialogInterface.OnClickListener()
                                {
                                    public void onClick(DialogInterface dialog,
                                                        int which)
                                    {

                                    }
                                });
                // 创建对话框
                AlertDialog ad = builder.create();
                // 显示对话框
                ad.show();

            }
        });
    }
    /**
     * 请求方法
     * */
    private  void requestWithUserId(){
        //菊花的开始方法
        mLoading.show();
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("teacherId",teacherId)
                .add("score",core)
                .add("id",id)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.AddTeacherEvaluation)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }
            //接收方法
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse返回的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        //菊花结束方法
                        mLoading.dismiss();
                        try {
                            //解析json数据
                            jsonParseWithJsonStr(retStr);
                        } catch (JSONException e) {
                            mLoading.dismiss();
                            e.printStackTrace();
                        }
                    }
                });
            }
        });
    }

    /**
     * 解析数据方法
     * */
    private  void jsonParseWithJsonStr (String jsonStr) throws JSONException {

        JSONArray jsArr = new JSONArray(jsonStr);
        List<String> data = new ArrayList<String>();
        ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String,     Object>>();/*在数组中存放数据*/
        for (int i = 0; i < jsArr.length(); i++)
        {
            JSONObject js = jsArr.getJSONObject(i);
            String relTime = js.optString("relTime");
            String meetType;
            if (js.getString("melodyClass").equals("成功"))
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(TeacherScoreActivity.this);
                builder.setTitle("提示");
                builder.setMessage("评价上传成功！");
                builder.setPositiveButton("确定",
                        new DialogInterface.OnClickListener() {
                            // 单击事件
                            public void onClick(DialogInterface dialog, int which)
                            {
                                // 设置TextView文本
                                //点击是的时候去进行提交
                                if (core.length() == 0){
                                    AlertDialog.Builder builder = new AlertDialog.Builder(TeacherScoreActivity.this);
                                    builder.setTitle("提示");
                                    builder.setMessage("请选择分数！");
                                    builder.setPositiveButton("确定", null);
                                    builder.show();
                                }else {
                                    Intent intent = new Intent(TeacherScoreActivity.this,TeacherEvaluationActivity.class);
                                    intent.putExtra("id",id);
                                    startActivity(intent);
                                }

                            }
                        });
                builder.show();
            }else
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(TeacherScoreActivity.this);
                builder.setTitle("提示");
                builder.setMessage("评价上传失败！");
                builder.setPositiveButton("确定", null);
                builder.show();
            }

            teacherId = js.getString("id");

        }


        if (jsArr.length() == 0)
        {
            midToast("无数据",3);
        }

    }
    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
}
<file_sep>package com.xinnuo.apple.nongda;


import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;

import com.xinnuo.apple.nongda.Admin.AdminActivity;
import com.xinnuo.apple.nongda.Binding.StudentBindingActivity;
import com.xinnuo.apple.nongda.Binding.TeacherBindingActivity;
import com.xinnuo.apple.nongda.entity.AdminModel;
import com.xinnuo.apple.nongda.entity.StudentModel;
import com.xinnuo.apple.nongda.entity.TeacherModel;
import com.xinnuo.apple.nongda.singin.Student_Singin;
import com.xinnuo.apple.nongda.singin.Teacher_Singin;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import cn.jpush.android.api.JPushInterface;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;


public class MainActivity extends BaseActivity  {
    private EditText phone_editText;
    private EditText pswd_editText;
    private CheckBox pswd_checkBox;
    private Button login_button;
    private Button Retrieve_button;
    private OkHttpClient client;
    SharedPreferences sp = null;
    private static final int REQUEST_CODE_SCAN = 0x0000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        sp = getSharedPreferences("userinfo",Context.MODE_PRIVATE);
        initView();
        initOkHttp();
        //自动登录 若选中为true 自动登录 不勾选为fouse
        if (sp.getBoolean("pswd_checkBox", true)) {
            phone_editText.setText(sp.getString("uname", null));
            pswd_editText.setText(sp.getString("upswd", null));
            //设置为勾选
            pswd_checkBox.setChecked(true);
            //取出记住的账号和密码
            String name = phone_editText.getText().toString().trim();
            String pswd = pswd_editText.getText().toString().trim();
            //若不为空自动登录
            if (name.length() > 0 && pswd.length() > 0) {
                //调用请求方法进行请求
                onClieck(name, pswd);
            }

        } else {
            //若为空 将checkboxButton设置为false
            pswd_checkBox.setChecked(false);

        }

    }
    //绑定控件
    private void initView() {
        phone_editText = (EditText) findViewById(R.id.phone_editext);
        pswd_editText = (EditText) findViewById(R.id.pswd_editText);
        pswd_checkBox = (CheckBox) findViewById(R.id.pswd_checkBox);
        login_button = (Button) findViewById(R.id.login_button);
        Retrieve_button = (Button) findViewById(R.id.Retrieve_button);
        LimitsEditEnter(phone_editText);
        login_button.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v) {

                if (v == login_button) {
                    mLoading.show();

                    //取出用户输入的账号和密码
                    final String name = phone_editText.getText().toString().trim();
                    String pswd = pswd_editText.getText().toString().trim();
                    //判断进行相应的弹窗提示
                    if (name.equals("")) {
                        midToast("用户名空", 1);
                        mLoading.dismiss();
                        return;
                    }
                    if (pswd.equals("")) {
                        midToast("密码空", 1);
                        mLoading.dismiss();
                        return;
                    }
                    //查看CheckBoxLogin是否勾选上
                    boolean CheckBoxLogin = pswd_checkBox.isChecked();
                    if (CheckBoxLogin) {
                        SharedPreferences.Editor editor = sp.edit();
                        editor.putString("uname", name);
                        editor.putString("upswd", pswd);
                        editor.putBoolean("checkboxBoolean", true);
                        editor.commit();
                    } else {
                        SharedPreferences.Editor editor = sp.edit();
                        editor.putString("uname", null);
                        editor.putString("upswd", null);
                        editor.putBoolean("checkboxBoolean", false);
                        editor.commit();
                    }
//                    //判断输入的账号格式是否正确 正确进行跳转 不正确给出提示信息 并跳出此方法
//                    if (IsPhoneNumUtil.isMobileNumber(name))
//                    {
//                        Log.d("phone","phonenumber格式正确");
//                    }else
//                    {   //菊花的结束方法
//                        mLoading.dismiss();
//                        midToast("不是电信号段", 1);
//                        return;
//                    }
                    //请求的登录方法
                    onClieck(name, pswd);

                }

            }
        });
    }

    //请求方法 参数手机号 密码
    private void onClieck(String userId, String password) {

        TelephonyManager TelephonyMgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
        String szImei = "";//TelephonyMgr.getDeviceId();
        String rid = JPushInterface.getRegistrationID(getApplicationContext());
        String phoneType = android.os.Build.MODEL;
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("name", userId)
                .add("password", <PASSWORD>)
                .add("registrationID", rid)//极光推送的id  手机类型
                .add("deviceNumber", szImei)//绑定的手机序列号
                .add("phoneType",phoneType)//手机的产品名字
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.loginUrl)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {
                Log.d("TAG", "网络请求 = onFailure: "+e);
//                midToast("登录异常:error = 3", 1);
                mLoading.dismiss();
            }
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值", retStr);
                        //菊花结束方法
                        mLoading.dismiss();
                        try {
                            //调用解析方法解析数据
                            jsonParseWithJsonStr(retStr);
                        } catch (JSONException e) {
                            e.printStackTrace();
                            mLoading.dismiss();
                            //提示信息
                            midToast("登录异常:error = 1", 1);

                        }
                    }
                });
            }
        });
    }
    //解析数据对象
    private void jsonParseWithJsonStr(String jsonStr) throws JSONException {
        Student_Singin student_singin = new Student_Singin();
        Teacher_Singin teacher_singin = new Teacher_Singin();
        StudentModel studentModel = new StudentModel();
        TeacherModel teacherModel = new TeacherModel();
        JSONArray js = new JSONArray(jsonStr);
        for (int i = 0; i < js.length(); i++)
        {
            JSONObject jsObj = js.getJSONObject(i);
            Log.d("******","********");
            String loginSta = jsObj.getString("loginSta");
            Log.d("******",loginSta);
            /**
             * loginSta:
             * fail             失败
             * success          教师登录成功
             * successToStu     学生登录成功
             * formation        立即验证学生
             * teacherFormation 立即验证教师
             * deviceNumber      不是绑定设备
             *
             */
            //fail             失败
            if (loginSta.equals("fail"))
            {
                midToast("用户名或密码错误", 1);
            }
            //success          学生登录成功
            else if (loginSta.equals("successToStu"))
            {
                /**
                 * status:
                 * status=1 学生
                 * status=2 管理员
                 * status=3 教师
                 * */
                int status = jsObj.getInt("status");
                Log.d("******",status+"");
                //学生登录
                if (status == 1)
                {
                    //为学生对象赋值
                    studentModel = student_singin.setSutdentInfoWith(jsObj);
                    //调用跳转方法返回intent
                    Intent intent =  student_singin.stu_Login(MainActivity.this,jsObj,studentModel);
                    //启动跳转
                    startActivity(intent);
                    finish();
                }
            }else if (loginSta.equals("success"))
            {
                int status = jsObj.getInt("status");
                Log.d("******",status+"");
                if (status == 3)
                {
                    midToast("登陆成功",3);
                    teacherModel = teacher_singin.setTeacherInfo(jsObj);
                    Intent intent = teacher_singin.teacher_Login(MainActivity.this,jsObj,teacherModel);
                    intent.putExtra("cardNo",teacherModel.getCardNo());
                    intent.putExtra("pswd",teacherModel.getPassword());
                    intent.putExtra("phone",teacherModel.getPhone());
                    startActivity(intent);
                    finish();
                }else if (status == 2)
                {
                    /**
                     *
                     * "birthday": "null",
                     "phone": "123456",
                     "sex": 1,
                     "status": 2,
                     "jurisdiction": "1",
                     "collegeName": "null",
                     "password": "<PASSWORD>",
                     "id": 67,
                     "cardNo": "null",
                     "picture": "03.jpg",
                     "name": "admin",
                     "itro": "null",
                     "loginSta": "success"*/
                    AdminModel adminModel = new AdminModel();
                    adminModel.setBirthday(jsObj.optString("birthday"));
                    adminModel.setPhone(jsObj.optString("phone"));
                    adminModel.setSex(jsObj.getInt("sex"));
                    adminModel.setStatus(jsObj.getInt("status"));
                    adminModel.setJurisdiction(jsObj.optString("jurisdiction"));
                    adminModel.setCollegeName(jsObj.optString("collegeName"));
                    adminModel.setPassword(jsObj.getString("password"));
                    adminModel.setId(jsObj.getString("id"));
                    adminModel.setCardNo(jsObj.getString("cardNo"));
                    adminModel.setPicture(jsObj.getString("picture"));
                    adminModel.setItro(jsObj.getString("itro"));
                    adminModel.setLoginSta(jsObj.getString("loginSta"));
                    adminModel.setName(jsObj.getString("name"));
                    Intent intent = new Intent(MainActivity.this,AdminActivity.class);
                    intent.putExtra("adminName",jsObj.getString("name"));
                    intent.putExtra("adminId",jsObj.getString("id"));
                    startActivity(intent);
                    finish();

                }

            }else if (loginSta.equals("formation"))
            {

                final AlertDialog.Builder builder = new AlertDialog.Builder(this);
                final String stuNo = phone_editText.getText().toString().trim();
                Log.d("*****",stuNo);
                // 设置显示信息
                builder.setMessage("身份未绑定，是否绑定？").
                        // 设置确定按钮
                                setPositiveButton("是",
                                new DialogInterface.OnClickListener() {
                                    // 单击事件
                                    public void onClick(DialogInterface dialog, int which) {
                                        //进行页面跳转 跳到绑定界面需要输入身份证号和手机号进行绑定
                                        Intent intent = new Intent(MainActivity.this, StudentBindingActivity.class);
                                        //传值学生id
                                        intent.putExtra("studentNo", stuNo);
                                        String state = "1";
                                        intent.putExtra("state",state);
                                        startActivity(intent);
                                        finish();
                                    }
                                }).
                        // 设置取消按钮
                                setNegativeButton("否",
                                new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog,
                                                        int which) {
                                    }
                                });
                // 创建对话框
                AlertDialog ad = builder.create();
                // 显示对话框
                ad.show();
            }else if (loginSta.equals("teacherFormation"))
            {
                final AlertDialog.Builder builder = new AlertDialog.Builder(this);
                final String userNo = phone_editText.getText().toString().trim();
                //取出教师id
                final String teacherBindId = jsObj.getString("id");


                // 设置显示信息
                builder.setMessage("身份未绑定，是否绑定？").
                        // 设置确定按钮
                                setPositiveButton("是",
                                new DialogInterface.OnClickListener() {
                                    // 单击事件
                                    public void onClick(DialogInterface dialog, int which) {
                                        //点击是进行页面跳转，输入教师工号和手机号进行绑定
                                        Intent intent = new Intent(MainActivity.this, TeacherBindingActivity.class);
                                        //传值 教师id
                                        intent.putExtra("teacherInfoId", teacherBindId);
                                        String state = "1";
                                        intent.putExtra("state",state);

                                        startActivity(intent);
                                        finish();
                                    }
                                }).
                        // 设置取消按钮
                                setNegativeButton("否",
                                new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog,
                                                        int which) {
                                    }
                                });
                // 创建对话框
                AlertDialog ad = builder.create();
                // 显示对话框
                ad.show();
            }
        }
    }
    //初始化请求
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
}
<file_sep>package com.xinnuo.apple.nongda.studentActivity.StudentResultQuery;
/**
 * 学生成绩查询
 * */
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.xinnuo.apple.nongda.R;

public class StudentResultQueryActivity extends AppCompatActivity {
    private TextView student_query1;
    private TextView student_query2;
    private TextView student_query3;
    private TextView student_query4;
    private String id;          //学生Id
    private String studentNo;   //学号
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_student_result_query);
        binding();
        clickJump();
        Intent intent = getIntent();
        id = intent.getStringExtra("id");
        studentNo = intent.getStringExtra("studentNo");
        Log.d("=============",studentNo);
    }
    /**
    * 绑定控件
    * */
    protected void binding()
    {
        student_query1 = (TextView) findViewById(R.id.student_query1);
        student_query2 = (TextView) findViewById(R.id.student_query2);
        student_query3 = (TextView) findViewById(R.id.student_query3);
        student_query4 = (TextView) findViewById(R.id.student_query4);
    }
    /**
     * 点击进行相应的跳转
     * */
    protected void clickJump()
    {
        //签到记录查询
        student_query1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(StudentResultQueryActivity.this,StuAttendanceRecordActivity.class);
                intent.putExtra("id",id);
                intent.putExtra("studentNo",studentNo);
                startActivity(intent);
            }
        });
        //体质成绩查询
        student_query2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(StudentResultQueryActivity.this,PhysicalPerformanceActivity.class);
                intent.putExtra("id",id);
                startActivity(intent);
            }
        });
        //在线考试成绩查询
        student_query3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(StudentResultQueryActivity.this,OnlineAnswerQueryActivity.class);
                intent.putExtra("id",id);
                intent.putExtra("studentNo",studentNo);
                startActivity(intent);
            }
        });
        //体育成绩查询
        student_query4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(StudentResultQueryActivity.this,SportsPerformanceQueryActivity.class);
                intent.putExtra("studentNo",studentNo);
                startActivity(intent);
            }
        });
    }
}
<file_sep>package com.xinnuo.apple.nongda.Admin;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.xinnuo.apple.nongda.Admin.Club.AdminClub;
import com.xinnuo.apple.nongda.Admin.Meeting.AdminMeetingInfoActivity;
import com.xinnuo.apple.nongda.Admin.News.AdminNewsActivity;
import com.xinnuo.apple.nongda.Admin.Substitute.AdminSubstituteActivity;
import com.xinnuo.apple.nongda.MainActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Scanner;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;


public class AdminActivity extends AppCompatActivity {
     //定义控件
    private TextView admin_meeting;
    private TextView admin_spase;
    private TextView admin_spase1;
    private TextView admin_achievement;
    private TextView admin_setup;
    private TextView admin_Replace;
    private TextView admin_check;
    private TextView admin_club;
    private TextView admin_name;
    private OkHttpClient client;
    private String adminId;
    private final static String FILE_NAME = "xth.txt"; // 设置文件的名称
    private String spDate;

    private String adminName;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_admin);
         boundControl();
        Intent intent = getIntent();
        adminName = intent.getStringExtra("adminName");
        adminId = intent.getStringExtra("adminId");
        admin_name.setText(adminName);
        assignBtnAction();
    }

    /**
     * 绑定控件
     * */
    private void boundControl()
    {
        admin_name = (TextView) findViewById(R.id.admin_name);
        admin_club = (TextView) findViewById(R.id.admin_club);
        admin_check = (TextView) findViewById(R.id.admin_check);
        admin_achievement = (TextView) findViewById(R.id.admin_achievement);
        admin_Replace = (TextView) findViewById(R.id.admin_Replace);
        admin_setup = (TextView) findViewById(R.id.admin_setup);
        admin_meeting = (TextView) findViewById(R.id.admin_meeting);
        admin_spase = (TextView) findViewById(R.id.admin_spase);
        admin_spase1 = (TextView) findViewById(R.id.admin_spase1s);

    }

    /**
     * 点击事件方法 点击相应的功能进行相应的跳转并进行传值
     * */
    private void assignBtnAction()
    {
        //俱乐部
        admin_club.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view)
            {
                Intent intent = new Intent(AdminActivity.this, AdminClub.class);
                String statu = "0";
                intent.putExtra("statu",statu);
                startActivity(intent);
            }
        });
        //考勤数据统计
        admin_check.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view)
            {
                Intent intent = new Intent(AdminActivity.this, AdminClub.class);
                String statu = "1";
                intent.putExtra("statu",statu);
                startActivity(intent);
            }
        });
        //成绩查询
        admin_achievement.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view)
            {
                Intent intent = new Intent(AdminActivity.this, AdminClub.class);
                String statu = "2";
                intent.putExtra("statu",statu);
                startActivity(intent);
            }
        });
        //会议及集体活动
        admin_meeting.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AdminActivity.this, AdminMeetingInfoActivity.class);
                intent.putExtra("teacherId",adminId);
                startActivity(intent);
            }
        });
        //账号设置
        admin_setup.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                loginOut();
            }
        });
        //代课
        admin_Replace.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AdminActivity.this, AdminSubstituteActivity.class);
                intent.putExtra("teacherId",adminId);
                startActivity(intent);
            }
        });
        //消息
        admin_spase.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SharedPreferences preferences=getSharedPreferences("userinfo",Context.MODE_PRIVATE);
                SharedPreferences.Editor editor=preferences.edit();

                editor.putString("msgDate", spDate);
                editor.commit();
                Intent intent = new Intent(AdminActivity.this,AdminNewsActivity.class);
                startActivity(intent);
            }
        });
    }
    @Override
    protected void onResume() {
        super.onResume();
        findNewMsg();
    }
    //查询是否是最新消息
    private void findNewMsg(){
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("status",1+"")
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.StuNews)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

                //signSleepTextView.setText("网络异常！");
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                final String retStr = response.body().string();

                runOnUiThread(new Runnable() {
                    public static final String TAG = "admin";

                    @Override
                    public void run() {

                        Log.d("网络请求返回值",retStr);

                        try {
                            //{"msgDate":"2017-01-18 15:27:40","msgContent":"张海里荣升一只鸡\n"}
                            JSONObject jsObj = new JSONObject(retStr);
                            String msgDate = jsObj.getString("msgDate");
                            spDate = msgDate;
                            SharedPreferences preferences=getSharedPreferences("userinfo", Context.MODE_PRIVATE);
                            String saveDate=preferences.getString("msgDate", null);

                            Log.d(TAG, "run: msgDate"+msgDate);
                            Log.d(TAG, "run: savaDate"+saveDate);
                            if (msgDate.equals(saveDate))
                            {
                                Log.d(TAG, "run: 相同");
                                admin_spase1.setVisibility(View.INVISIBLE);
                            }else
                            {
                                Log.d(TAG, "run: 不相同");

                                admin_spase1.setVisibility(View.VISIBLE);
                            }
                        } catch (JSONException e) {
                            e.printStackTrace();
                            //statuTV.setText("签到异常");
                        }
                    }
                });
            }
        });
    }
    private StringBuffer read() {
        FileInputStream in = null;
        Scanner s = null;
        StringBuffer sb = new StringBuffer();
        try {
            in = super.openFileInput(FILE_NAME);
            s = new Scanner(in);
            while (s.hasNext()) {
                sb.append(s.next());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return sb;
    }

    private void save(String data) {
        FileOutputStream out = null;
        PrintStream ps = null;
        try {
            out = super.openFileOutput(FILE_NAME, Activity.MODE_APPEND);
            ps = new PrintStream(out);
            ps.println(data);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (out != null) {
                try {
                    out.close();
                    ps.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    //退出方法 点击注销时给出提示信息
    private void loginOut(){
        // 设置显示信息
        final AlertDialog.Builder builder = new AlertDialog.Builder(this);

        builder.setMessage("确定要退出？").
                // 设置确定按钮
                        setPositiveButton("是",
                        new DialogInterface.OnClickListener() {
                            // 单击事件
                            public void onClick(DialogInterface dialog, int which) {
                                // 设置TextView文本
                                //点击是的时候去进行提交
                                SharedPreferences sp = getSharedPreferences("userinfo",
                                        Context.MODE_PRIVATE);
                                SharedPreferences.Editor editor = sp.edit();

                                editor.putBoolean("pswd_checkBox", false);
                                editor.commit();

                                //进行页面跳转，跳回登录界面
                                Intent intent = new Intent(AdminActivity.this, MainActivity.class);
                                startActivity(intent);
                                finish();
                            }
                        }).
                // 取消跳转
                        setNegativeButton("否",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                                int which) {
                            }
                        });
        // 创建对话框
        AlertDialog ad = builder.create();
        // 显示对话框
        ad.show();
    }

}
<file_sep>package com.xinnuo.apple.nongda.Admin.ResultQuery;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.TeacherActivity.Resultquery.TeacherClassQueryActivity;

public class AdminResultQueryActivity extends AppCompatActivity {
    private TextView attendanceRecord;
    private TextView constitutionQuery;
    private TextView onlineAnswer;
    private TextView sportsPerformance;
    private String teacherId;
    private String itemId;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_admin_result_query);
        Intent intent = getIntent();
        teacherId = intent.getStringExtra("id");
        itemId = intent.getStringExtra("itemId");
        BoundControl();
        PageJump();
    }
    /**
     *绑定控件方法
     * */
    private void BoundControl()
    {
        attendanceRecord = (TextView) findViewById(R.id.admin_query1);
        constitutionQuery = (TextView) findViewById(R.id.admin_query2);
        onlineAnswer = (TextView) findViewById(R.id.admin_query3);
        sportsPerformance = (TextView) findViewById(R.id.admin_query4);
    }
    /**
     * 点击事件
     * 点击相应的TextView进行页面跳转
     * */
    private void PageJump()
    {   //签到记录查询
        attendanceRecord.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view)
            {
                String state = "1";
                Intent intent = new Intent(AdminResultQueryActivity.this,TeacherClassQueryActivity.class);
                intent.putExtra("teacherId",teacherId);
                intent.putExtra("itemId",itemId);
                intent.putExtra("state",state);
                startActivity(intent);
            }
        });
        //体质测试查询
        constitutionQuery.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view)
            {
                String state = "2";
                Intent intent = new Intent(AdminResultQueryActivity.this,TeacherClassQueryActivity.class);
                intent.putExtra("teacherId",teacherId);
                intent.putExtra("itemId",itemId);
                intent.putExtra("state",state);
                startActivity(intent);
            }
        });
        //在线答题成绩查询
        onlineAnswer.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view)
            {
                String state = "3";
                Intent intent = new Intent(AdminResultQueryActivity.this,TeacherClassQueryActivity.class);
                intent.putExtra("teacherId",teacherId);
                intent.putExtra("itemId",itemId);
                intent.putExtra("state",state);
                startActivity(intent);
            }
        });
        //体育成绩查询
        sportsPerformance.setOnClickListener(new View.OnClickListener()
        {
            @Override

            public void onClick(View view)
            {
                String state = "4";
                Intent intent = new Intent(AdminResultQueryActivity.this,TeacherClassQueryActivity.class);
                intent.putExtra("teacherId",teacherId);
                intent.putExtra("itemId",itemId);
                intent.putExtra("state",state);
                startActivity(intent);
            }
        });
    }
}
<file_sep>package com.xinnuo.apple.nongda.TeacherActivity.AttendanceDataStatistics;
/**
 * 教师考勤记录 0离职 1未离职
 * */
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;
import com.xinnuo.apple.nongda.view.XListView;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class AttendanceDataStatisticsActivity extends BaseActivity implements XListView.IXListViewListener {
    private OkHttpClient client;
    private String teacherId;
    private int page;
    private ArrayList<HashMap<String, Object>> dlist;
    private boolean flag = false;
    private ArrayAdapter<String> mAdapter;
    private int number = 0;
    private Handler mHandler;
    private ListView listView;
    private boolean isFirstIn = true;
    private RelativeLayout mHeaderViewContent;
    private TextView tea_attendance_record;         //考勤情况
    private TextView tea_turnover_record;           //离职情况
    private TextView tea_tendance_times;           //考勤次数及离职次数
    private XListView mListView;
    private ArrayList<String> items;
    private ArrayList<String> items1;
    private String state;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_attendance_data_statistics);
        Intent intent = getIntent();
        teacherId = intent.getStringExtra("teacherId");
        tea_attendance_record = (TextView) findViewById(R.id.tea_attendance_record);
        tea_turnover_record = (TextView) findViewById(R.id.tea_turnover_record);
        tea_tendance_times = (TextView) findViewById(R.id.tea_number);
        initOkHttp();
        tea_attendance_record.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                items.clear();
                state = "1";
                number = 0;
                requestWithDataAdd(0,state);

            }
        });
        tea_turnover_record.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                items.clear();
                state = "0";
                number = 0;
                requestWithDataAdd(0,state);

            }
        });
    }
    protected void onStart()
    {
        super.onStart();
        state = "1";
        requestWithDataAdd(0,state);
        mListView = (XListView) findViewById(R.id.xListView);
        mListView.setPullLoadEnable(true);
        mAdapter = new ArrayAdapter<String>(AttendanceDataStatisticsActivity.this, R.layout.item_attendance_data_sta, items);
        mListView.setAdapter(mAdapter);
        mListView.setXListViewListener(AttendanceDataStatisticsActivity.this);
        mHandler = new Handler();
    }

    /**
     * 网络请求
     * @param add add = 0 刷新 add = 1 加载更多
     */
    private  void requestWithDataAdd(int add,String state){

        if (add == 0)
        {
            page = 1;
            items = new ArrayList<String>();

        }
        else
        {
            page ++;
        }
        //菊花的开始方法
        mLoading.show();
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("teacherid",teacherId)
                .add("pageNumber",page+"")
                .add("state",state)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.AttendanceDataStatistics)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }
            //接收方法
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse返回的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        //菊花结束方法
                        mLoading.dismiss();
                        try {
                            //解析json数据
                            jsonParseWithJsonStr(retStr);
                        } catch (JSONException e) {
                            mLoading.dismiss();
                            e.printStackTrace();
                        }
                    }
                });
            }
        });
    }

    /**
     * 解析数据方法
     * 0 离职 1未离职
     * */
    //json解析方法

    private  void jsonParseWithJsonStr (String jsonStr) throws JSONException {
        try{
            JSONArray jsArr = null;
            String state = null;
            if ((!jsonStr.equals("[]")) || (!jsonStr.equals("{\"nul\":\"\"}")))
            {
                jsArr = new JSONArray(jsonStr);
                String currName = null;
                String attendEndDate = null;
                for (int i = 0; i < jsArr.length(); i++)
                {
                    JSONObject js = jsArr.getJSONObject(i);
                    state = js.getString("state");

                    if (state.equals("0"))
                    {
                        JSONArray jss = js.getJSONArray("date");
                        number ++;
                        for (int j = 0 ; j < jss.length(); j++)
                        {
                            JSONObject jsonObject = jss.getJSONObject(j);
                            currName = "离职时间:" + jsonObject.getString("DepartureTime");
                            tea_tendance_times.setText("考勤:"+number+"次");
                            items.add(currName);
                        }
                    }else
                    {
                        JSONArray jss = js.getJSONArray("date");
                        number ++;
                        for (int j = 0 ; j < jss.length(); j++)
                        {
                            JSONObject jsonObject = jss.getJSONObject(j);
                            currName = "上课时间:" + jsonObject.getString("attendDate");
                            attendEndDate = "下课时间:"+ jsonObject.getString("attendEndDate");
                            String s = currName + "\n" +attendEndDate;
                            tea_tendance_times.setText("考勤:"+number+"次");
                            items.add(s);
                        }
                    }
                }
            }else if (jsonStr.equals("{\"nul\":\"\"}")){
                midToast("无数据",3);
            }else {
                midToast("无数据",3);
            }

            mAdapter = new ArrayAdapter<String>(AttendanceDataStatisticsActivity.this, R.layout.item_attendance_data_sta, items);
            mListView.setAdapter(mAdapter);
            mAdapter.notifyDataSetChanged();
            onLoad();
        }catch (Exception e)
        {
            midToast("无数据",3);
            return;
        }


    }
    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }


    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
            this.finish();
        }
        return false;
    }


    @Override
    public void onRefresh() {
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (state.equals("0"))
                {
                    requestWithDataAdd(1,state);
                    onLoad();
                }else
                {
                    requestWithDataAdd(1,state);
                    onLoad();
                }
            }
        }, 2000);

    }
    private void onLoad() {
        mListView.stopRefresh();
        mListView.stopLoadMore();
        mListView.setRefreshTime("刚刚");
    }


    @Override
    public void onLoadMore() {
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (state.equals("0"))
                {
                    requestWithDataAdd(page,state);
                    onLoad();
                }else
                {
                    requestWithDataAdd(page,state);
                    onLoad();
                }
            }
        }, 2000);
    }
}
<file_sep>package com.xinnuo.apple.nongda.TeacherActivity.Resultquery;
/**
 * 班级展示
 * */
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class StudentListQueryActivity extends BaseActivity {
    private OkHttpClient client;
    private String classId;
    private String itemId;
    private ListView listView;
    private String state;
    private JSONArray dataArr;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_student_list_query);
        initOkHttp();
        listView = (ListView) findViewById(R.id.list_stuquerys);
        Intent intent = getIntent();
        classId = intent.getStringExtra("id");
        itemId = intent.getStringExtra("itemId");
        state = intent.getStringExtra("state");
        if (state .equals("1"))
        {
            requestWithUserId(itemId,classId, httpUrl.studentListUrl);
        }else if(state.equals("2"))
        {
            requestWithUserId(itemId,classId, httpUrl.StudentPhysicalFitnessScore);
        }else  if (state.equals("3"))
        {
            requestWithUserId(itemId,classId, httpUrl.SportsClassIdQueryStudentsOnline);
        }else
        {
            requestWithUserId(itemId,classId, httpUrl.TeacherSportsPerformanceQuery);
        }

    }

    /**
     * 请求方法
     * */
    private  void requestWithUserId(String itemId,String id,String url){
        //菊花的开始方法
        mLoading.show();
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("classId",id)
                .add("sportclassId",id)
                .add("itemId",itemId)
                .build();
        Request requestPost = new Request.Builder()
                .url(url)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }
            //接收方法
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse返回的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        //菊花结束方法
                        mLoading.dismiss();
                        try {
                            //解析json数据
                            jsonParseWithJsonStr(retStr,state);
                        } catch (JSONException e) {
                            mLoading.dismiss();
                            e.printStackTrace();
                        }
                    }
                });
            }
        });
    }

    /**
     * 解析数据方法
     * */
    //json解析方法

    private  void jsonParseWithJsonStr (String jsonStr , String state) throws JSONException {

        JSONArray jsArr = new JSONArray(jsonStr);
        dataArr = jsArr;
        List<String> data = new ArrayList<String>();
        ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String,     Object>>();/*在数组中存放数据*/
        if (state .equals("1"))
        {
            HashMap<String, Object> map2 = new HashMap<String, Object>();
            map2.put("count","序 号");
            map2.put("studentNo"," 学 号");
            map2.put("stuname","姓 名");
            map2.put("number","次 数");
            map2.put("state",state);
            listItem.add(map2);
            for (int i = 0; i < jsArr.length(); i++) {
                JSONObject js = jsArr.getJSONObject(i);
            /*
            * "studentNo": "11042227  ",
            *  "name": "张烁",
            *  "number": 0
            */
                String count = i+1+"";
                String studentNo = js.optString("studentNo");
                String stuname = js.optString("name");
                String number = js.optString("number");
                Log.d("******",studentNo);
                HashMap<String, Object> map = new HashMap<String, Object>();
//            map.put("id",id);
                map.put("count",count);
                map.put("studentNo",studentNo);
                map.put("stuname",stuname);
                map.put("number",number);

                listItem.add(map);

            }

        }else if (state.equals("2")) {
            HashMap<String, Object> map2 = new HashMap<String, Object>();
            map2.put("count", "序 号");
            map2.put("studentNo", " 学 号");
            map2.put("stuname", "姓 名");
            map2.put("number", "总 分");
            listItem.add(map2);
            for (int i = 0; i < jsArr.length(); i++) {
                JSONObject js = jsArr.getJSONObject(i);

            /*
            * "studentNo": "11042227  ",
            *  "name": "张烁",
            *  "number": 0
            */
                String count = i + 1 + "";
                String studentNo = js.optString("studentId");
                String stuname = js.optString("name");
                String number = js.optString("result");
                Log.d("******", studentNo);
                HashMap<String, Object> map = new HashMap<String, Object>();
//              map.put("id",id);
                map.put("count", count);
                map.put("studentNo", studentNo);
                map.put("stuname", stuname);
                map.put("number", number);

                listItem.add(map);
            }
        }else if (state.equals("4")){
            HashMap<String, Object> map2 = new HashMap<String, Object>();
            map2.put("count", "序 号");
            map2.put("studentNo", " 学 号");
            map2.put("stuname", "姓 名");
            map2.put("number", "体育成绩");
            listItem.add(map2);
            for (int i = 0; i < jsArr.length(); i++) {
                JSONObject js = jsArr.getJSONObject(i);

            /*
            * "studentNo": "11042227  ",
            *  "name": "张烁",
            *  "number": 0
            */
                String count = i + 1 + "";
                String studentNo = js.optString("studentNo");
                String stuname = js.optString("name");
                String number = js.optString("zongFen");
                Log.d("******", studentNo);
                HashMap<String, Object> map = new HashMap<String, Object>();
//              map.put("id",id);
                map.put("count", count);
                map.put("studentNo", studentNo);
                map.put("stuname", stuname);
                map.put("number", number);

                listItem.add(map);
            }
        }else if (state.equals("3")){
            HashMap<String, Object> map2 = new HashMap<String, Object>();
            map2.put("count", "序 号");
            map2.put("studentNo", " 学 号");
            map2.put("stuname", "姓 名");
            map2.put("number", "分 数");
            listItem.add(map2);
            for (int i = 0; i < jsArr.length(); i++) {
                JSONObject js = jsArr.getJSONObject(i);

            /*
            * "studentNo": "11042227  ",
            *  "name": "张烁",
            *  "number": 0
            */
                String count = i + 1 + "";
                String studentNo = js.optString("studentNo");
                String stuname = js.optString("name");
                String number = js.optString("stuScore");
                Log.d("******", studentNo);
                HashMap<String, Object> map = new HashMap<String, Object>();
//              map.put("id",id);
                map.put("count", count);
                map.put("studentNo", studentNo);
                map.put("stuname", stuname);
                map.put("number", number);

                listItem.add(map);
            }
        }


        if (jsArr.length() == 0)
        {
            midToast("无数据",3);
        }

        SimpleAdapter qrAdapter = new SimpleAdapter(this,listItem, R.layout.item_student_list_query,
                new  String[]{"count","studentNo","stuname","number"},
                new int[]{R.id.studentlist_query1, R.id.studentlist_query2, R.id.studentlist_query3, R.id.studentlist_query4});
        listView.setAdapter(qrAdapter);



    }



    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
}
<file_sep>package com.xinnuo.apple.nongda.studentActivity.AccountSettings;
/**
 * 修改密码
 * */
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class StuModifyPasswordActivity extends BaseActivity implements View.OnClickListener{
    private OkHttpClient client;
    private EditText stu_old_pswd;
    private EditText stu_new_pswd;
    private EditText stu_confirm_pswd;
    private Button stu_button_pswd;
    private String id;
    private String studentNo;
    private String password;
    private String new_paswd;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_stu_modify_password);
        Intent intent = getIntent();
        id = intent.getStringExtra("id");
        studentNo = intent.getStringExtra("studentNo");
        Log.d("stuNo = ",studentNo);
        password = intent.getStringExtra("password");
        initOkHttp();
        binding();
    }
    //绑定控件
    private void binding()
    {
        stu_old_pswd = (EditText) findViewById(R.id.stu_old_pswd);
        stu_new_pswd = (EditText) findViewById(R.id.stu_new_pswd);
        stu_confirm_pswd = (EditText) findViewById(R.id.stu_confirm_pswd);
        stu_button_pswd = (Button) findViewById(R.id.stu_button_pswd);
        stu_button_pswd.setOnClickListener(this);
    }
    /**
     * 请求方法
     * */
    private  void requestWithUserId(String id, String studentNos ,String oldpswd,String newPswds){
        //菊花的开始方法
        mLoading.show();
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("id",id)
                .add("studentNo",studentNo)
                .add("topas",oldpswd)
                .add("pwdByStu",newPswds)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.StudentModifyPassword)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }
            //接收方法
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse返回的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        //菊花结束方法
                        mLoading.dismiss();
                        try {
                            //解析json数据
                            jsonParseWithJsonStr(retStr);
                        } catch (JSONException e) {
                            mLoading.dismiss();
                            e.printStackTrace();
                        }
                    }
                });
            }
        });
    }
    /**
     * 解析数据方法
     * */
    //json解析方法

    private  void jsonParseWithJsonStr (String jsonStr) throws JSONException {
        JSONObject js = new JSONObject(jsonStr);
        if (js.getString("melodyClass").equals("yes"))
        {
            AlertDialog.Builder builder  = new AlertDialog.Builder(StuModifyPasswordActivity.this);
            builder.setTitle("提示" ) ;
            builder.setMessage("修改成功！" ) ;
            builder.setPositiveButton("确定" , new DialogInterface.OnClickListener() {
                // 单击事件
                public void onClick(DialogInterface dialog, int which)
                {
                    // 设置TextView文本
                    //进行跳转
                    Intent intent = new Intent(StuModifyPasswordActivity.this,StuAccountSettingsActivity.class);
                    intent.putExtra("id",id);
                    intent.putExtra("studentNo",studentNo);
                    intent.putExtra("password",<PASSWORD>);
                    startActivity(intent);
                }
            }) ;
            builder.show();
        }else
        {
            AlertDialog.Builder builder  = new AlertDialog.Builder(StuModifyPasswordActivity.this);
            builder.setTitle("提示" ) ;
            builder.setMessage("修改失败，请重新提交！" ) ;
            builder.setPositiveButton("确定" ,  null );
            builder.show();
        }

    }
    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }

    @Override
    public void onClick(View view) {
        new_paswd = stu_new_pswd.getText().toString();
        if (new_paswd.length() >= 6) {
            String confirmPswd = stu_confirm_pswd.getText().toString();
            if (new_paswd.equals(confirmPswd)) {
                // 设置显示信息
                final AlertDialog.Builder builder = new AlertDialog.Builder(StuModifyPasswordActivity.this);

                builder.setMessage("确定要提交？").
                        // 设置确定按钮
                                setPositiveButton("是",
                                new DialogInterface.OnClickListener() {
                                    // 单击事件
                                    public void onClick(DialogInterface dialog, int which) {
                                        // 设置TextView文本
                                        //点击是的时候去进行提交
                                        requestWithUserId(id, studentNo, password,new_paswd);
                                    }
                                }).
                        // 设置取消按钮
                                setNegativeButton("否",
                                new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog,
                                                        int which) {
                                    }
                                });
                // 创建对话框
                AlertDialog ad = builder.create();
                // 显示对话框
                ad.show();


            } else {
                AlertDialog.Builder builder = new AlertDialog.Builder(StuModifyPasswordActivity.this);
                builder.setTitle("提示");
                builder.setMessage("两次输入的密码不一致，请重新输入！");
                builder.setPositiveButton("确定", null);
                builder.show();
            }
        }else {
            AlertDialog.Builder builder = new AlertDialog.Builder(StuModifyPasswordActivity.this);
            builder.setTitle("提示");
            builder.setMessage("密码长度必须大于6位，请重新输入！");
            builder.setPositiveButton("确定", null);
            builder.show();
        }
    }
}
<file_sep>package com.xinnuo.apple.nongda.TeacherActivity.SportsStandards;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class Sport_Class extends BaseActivity {
    private OkHttpClient client;
    private String id;
    private String sportkindSex;
    private String sportkindName;
    private String status;
    private ListView listView;
    private JSONArray dataArr;
    private String state;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sport__class);
        initOkHttp();
        listView = (ListView) findViewById(R.id.list_stu_sport_class);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long is) {
                try {
                    if (state.equals("2")){
                        //点击相应的班级进行跳转
                        Intent intent=new Intent(Sport_Class.this,SportsScore.class);
                        JSONObject js = dataArr.getJSONObject(position);
                        //传值 班级id 所教班级id
                        intent.putExtra("id",id);
                        intent.putExtra("sex",js.getString("sex"));
                        intent.putExtra("studentId",js.getString("id"));
                        intent.putExtra("studentNo",js.getString("studentNo"));
                        intent.putExtra("name",js.getString("name"));
                        intent.putExtra("sportkindSex",sportkindSex);
                        intent.putExtra("sportkindName",sportkindName);
                        intent.putExtra("status",status);
                        startActivity(intent);
                        finish();
                    }else{
                        Intent intent=new Intent(Sport_Class.this,SportSecondActivity.class);
                        intent.putExtra("status",status);
                        startActivity(intent);
                        finish();
                    }

                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        });
    }
    protected void onStart()
    {
        super.onStart();
        //取出上个界面传过来的id
        Intent intent = getIntent();
        id = intent.getStringExtra("id");
        sportkindSex = intent.getStringExtra("sportkindSex");
        sportkindName = intent.getStringExtra("sportkindName");
        status = intent.getStringExtra("status");
        state = intent.getStringExtra("state");
        Log.d("*****",status+"*****************************");
        requestWithUserId(id);
    }
    //请求方法
    private  void requestWithUserId(String id){
        mLoading.show();
        Log.d("StudentList ==== ", id);
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("id",id)   //id
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.TeacherClubStudentNumberUrl)    //请求地址
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }
            //接收后台返回值方法
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse返回的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        //菊花结束方法
                        mLoading.dismiss();
                        try {
                            //解析json数据
                            jsonParseWithJsonStr(retStr);
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }


                    }
                });
            }
        });
    }

    //json解析

    private  void jsonParseWithJsonStr (String jsonStr) throws JSONException {

        JSONArray jsArr = new JSONArray(jsonStr);
        dataArr = jsArr;
        ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String,     Object>>();/*在数组中存放数据*/

        HashMap<String, Object> map2 = new HashMap<String, Object>();
        map2.put("Item1","序 号");
        map2.put("Item2"," 学 号");
        map2.put("Item3","姓 名");
        map2.put("Item4","班 级");
        map2.put("Item5","性 别");
        listItem.add(map2);

        /*
        *   "id": 42960,
            "sex": "1",(1 = 男 、2 = 女)
            "studentNo": "14011411",
            "gradeId": 2,
            "name": "姜博",
            "className": "汉语14-4",
            "collegeName": "人文学院"*/
        for (int i = 0; i < jsArr.length(); i++) {

            String jsStr = jsArr.getString(i);
            JSONObject js = jsArr.getJSONObject(i);
            HashMap<String, Object> map = new HashMap<String, Object>();
            map.put("Item1",i+1);
            map.put("Item2", js.getString("studentNo"));
            map.put("Item3", js.getString("name"));
            map.put("Item4", js.getString("collegeName")+"\n"+js.getString("className"));
            String sex = null;
            if (js.getString("sex").equals("1")){
                sex = "男";
                map.put("Item5", sex);
            } else{
                sex = "女";
                map.put("Item5", sex);
            }
            if (sportkindSex.equals(sex)){
                listItem.add(map);
            }



        }





        if (jsArr.length() == 0)
        {
            midToast("无数据",3);
        }
        SimpleAdapter qrAdapter = new SimpleAdapter(this,listItem, R.layout.item_teacher_classsize,
                new  String[]{"Item1","Item2","Item3","Item4","Item5"},
                new int[]{R.id.teacher_stunumber1, R.id.teacher_stunumber2, R.id.teacher_stunumber3, R.id.teacher_stunumber4, R.id.teacher_stunumber5});


        listView.setAdapter(qrAdapter);
    }
    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
}
<file_sep>package com.xinnuo.apple.nongda.TeacherActivity.SportsStandards;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class SportsDetails extends BaseActivity {
    private String id;
    private OkHttpClient client;
    private ListView listView;
    private JSONArray dataArr;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sports_details);
        initOkHttp();
        Intent intent = getIntent();
        id = intent.getStringExtra("id");
        listView= (ListView)findViewById(R.id.list_sport_details);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long is) {
                try {
                    //点击相应的班级进行跳转

                    JSONObject js = dataArr.getJSONObject(position);
                    if (js.getString("sportkindName").equals("50米跑(秒)") || js.getString("sportkindName").equals("1000米跑") || js.getString("sportkindName").equals("800米跑") )
                    {
                        //传值 班级id 所教班级id
                        Intent intent=new Intent(SportsDetails.this,RunActivity.class);
                        intent.putExtra("id",id);
                        intent.putExtra("sportkindSex",js.getString("sportkindSex"));
                        intent.putExtra("sportkindName",js.getString("sportkindName"));
                        intent.putExtra("state","1");
                        String status = position+1+"";
                        intent.putExtra("status",status);
                        startActivity(intent);
                    }else{
                        //传值 班级id 所教班级id
                        Intent intent=new Intent(SportsDetails.this,Sport_Class.class);
                        intent.putExtra("id",id);
                        intent.putExtra("sportkindSex",js.getString("sportkindSex"));
                        intent.putExtra("sportkindName",js.getString("sportkindName"));
                        intent.putExtra("state","2");
                        String status = position+1+"";
                        intent.putExtra("status",status);
                        startActivity(intent);
                    }

                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        });
    }
    public void onStart(){
        super.onStart();
        requestWithUserId();
    }
    /**
     * 请求方法
     * */
    private  void requestWithUserId(){
        //菊花的开始方法
        mLoading.show();
        RequestBody requestBodyPost = new FormBody.Builder()
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.SportsDetails)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }
            //接收方法
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse返回的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        //菊花结束方法
                        mLoading.dismiss();
                        try {
                            //解析json数据
                            jsonParseWithJsonStr(retStr);
                        } catch (JSONException e) {
                            mLoading.dismiss();
                            e.printStackTrace();
                        }
                    }
                });
            }
        });
    }

    /**
     * 解析数据方法
     * */
    //json解析方法

    private  void jsonParseWithJsonStr (String jsonStr) throws JSONException {

        JSONArray jsArr = new JSONArray(jsonStr);
        dataArr = jsArr;
        List<String> data = new ArrayList<String>();
        ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String,     Object>>();/*在数组中存放数据*/
        for (int i = 0; i < jsArr.length(); i++) {
            JSONObject jss = jsArr.getJSONObject(i);
             String sportkindName = jss.getString("sportkindName");
             String sportkindSex = jss.optString("sportkindSex");

             HashMap<String, Object> map = new HashMap<String, Object>();
//          ap.put("id",id);
             map.put("sportkindName",sportkindName);
             map.put("sportkindSex",sportkindSex);


             listItem.add(map);

        }
        if (jsArr.length() == 0)
        {
            midToast("无数据",3);
        }
        SimpleAdapter qrAdapter = new SimpleAdapter(this,listItem, R.layout.item_sports_details,
                new  String[]{"sportkindName","sportkindSex"},
                new int[]{R.id.sport_detail1, R.id.sport_detail2});
        listView.setAdapter(qrAdapter);

    }
    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
}
<file_sep>package com.xinnuo.apple.nongda.Admin.Meeting;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.xinnuo.apple.nongda.Admin.widget.PickTimeView;
import com.xinnuo.apple.nongda.Admin.widget.PickValueView;
import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class NewReleaseActivity extends BaseActivity implements View.OnClickListener, PickTimeView.onSelectedChangeListener, PickValueView.onSelectedChangeListener {
    private EditText title;
    private TextView oject;
    private TextView times;
    private EditText place;
    private EditText introduction;
    private TextView immediate_release;
    private String[] strings;
    private int count = 0;
    private int state = 0;
    private OkHttpClient client;
    private String titles;
    private String places;
    private String introductions;
    private String invitationState;
    private String invitationTeachers;
    private String pushState;

    LinearLayout pvLayout;
    PickTimeView pickTime;
    PickTimeView pickDate;
    PickValueView pickValue;
    PickValueView pickValues;
    PickValueView pickString;
    SimpleDateFormat sdfTime;
    SimpleDateFormat sdfDate;
    private String meetingTime;
    private String teacherId;
    private String titles1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_new_release);
        binding();
        initOkHttp();
        Intent intent = getIntent();
        if (intent.getStringArrayExtra("string") != null){
            strings = intent.getStringArrayExtra("string");
            invitationState = "2";
            for (int i = 0; i < strings.length; i++){
                if(i == 0) invitationTeachers = strings[i];
                else invitationTeachers += "," + strings[i];
                Log.d("==============",invitationTeachers+strings[i]+"****************");
            }
            Log.d("==============",invitationTeachers+"****************");
            oject.setText("从名单选择");
        }else{
            invitationState = "1";
            invitationTeachers = "0";
            oject.setText("学校全体教师");
        }
        if (intent.getStringExtra("teacherId") != null){
            teacherId = intent.getStringExtra("teacherId");
        }
        if (intent.getStringExtra("titles1") != null){
            title.setText(intent.getStringExtra("titles1"));
        }


    }
    private void binding(){
        title = (EditText) findViewById(R.id.admin_title);
        oject = (TextView) findViewById(R.id.admin_object);
        times = (TextView) findViewById(R.id.admin_meeting_time);
        place = (EditText) findViewById(R.id.admin_meeting_place);
        introduction = (EditText) findViewById(R.id.admin_meeting_introduction);
        immediate_release = (TextView) findViewById(R.id.immediate_release);
        pvLayout = (LinearLayout) findViewById(R.id.Main_pvLayout);
        pickTime = (PickTimeView) findViewById(R.id.pickTime);
        pickDate = (PickTimeView) findViewById(R.id.pickDate);
        pickValue = (PickValueView) findViewById(R.id.pickValue);
        pickValues = (PickValueView) findViewById(R.id.pickValues);
        pickString = (PickValueView) findViewById(R.id.pickString);
        sdfTime = new SimpleDateFormat("MM-dd EEE HH:mm");
        sdfDate = new SimpleDateFormat("yyyy-MM-dd");

        pickTime.setOnSelectedChangeListener(this);
        pickDate.setOnSelectedChangeListener(this);
        pickValue.setOnSelectedChangeListener(this);
        pickValues.setOnSelectedChangeListener(this);
        pickString.setOnSelectedChangeListener(this);

        title.setOnClickListener(this);
        oject.setOnClickListener(this);
        times.setOnClickListener(this);
        place.setOnClickListener(this);
        introduction.setOnClickListener(this);
        immediate_release.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.admin_object:
                final String[] items = new String[]{"学校全体教师","从名单选择","取消"};
                final AlertDialog.Builder builder = new AlertDialog.Builder(NewReleaseActivity.this);
                builder.setItems(items, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        switch (which) {
                            case 0:
                                Toast.makeText(NewReleaseActivity.this, "您选中了："+items[0], Toast.LENGTH_SHORT).show();
                                oject.setText(items[0]);
                                state = 1;
                                invitationState = "1";
                                invitationTeachers = "0";
                                break;
                            case 1:
                                Toast.makeText(NewReleaseActivity.this, "您选中了："+items[1], Toast.LENGTH_SHORT).show();
                                Intent intent2 = new Intent(NewReleaseActivity.this, AdminQueryAllteacherActivity.class);
                                intent2.putExtra("teacherId",teacherId);
                                intent2.putExtra("titles",title.getText().toString());
                                startActivity(intent2);
                                oject.setText(items[1]);
                                state = 1;

                                break;
                            case 2:
                                Toast.makeText(NewReleaseActivity.this, "您选中了："+items[2], Toast.LENGTH_SHORT).show();
                                break;
                        }
                    }
                }).show();
                break;
            case R.id.admin_meeting_time:
                if (count == 0){
                    pvLayout.setVisibility(View.VISIBLE);
                    count++;
                }else {
                    pvLayout.setVisibility(View.GONE);
                    count = 0;
                }

                break;
            case R.id.immediate_release:
                titles = title.getText().toString();
                places = place.getText().toString();
                introductions = introduction.getText().toString();
                if (titles.length() == 0 ){
                    AlertDialog.Builder builders  = new AlertDialog.Builder(NewReleaseActivity.this);
                    builders.setTitle("提示" ) ;
                    builders.setMessage("请补全信息！" ) ;
                    builders.setPositiveButton("确定" ,  null );
                    builders.show();
                }else if (places.length() == 0){
                    AlertDialog.Builder builders  = new AlertDialog.Builder(NewReleaseActivity.this);
                    builders.setTitle("提示" ) ;
                    builders.setMessage("请补全信息！" ) ;
                    builders.setPositiveButton("确定" ,  null );
                    builders.show();
                }else if (introductions.length() == 0){
                    AlertDialog.Builder builders  = new AlertDialog.Builder(NewReleaseActivity.this);
                    builders.setTitle("提示" ) ;
                    builders.setMessage("请补全信息！" ) ;
                    builders.setPositiveButton("确定" ,  null );
                    builders.show();
                }else{
                    final String[] itemss = new String[]{"发布,并通知相关人员","发布但不通知","取消"};
                    final AlertDialog.Builder builder1 = new AlertDialog.Builder(NewReleaseActivity.this);
                    builder1.setItems(itemss, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            switch (which) {
                                case 0:
                                    pushState = "0";
                                    scanCodeSign(pushState);
                                    break;
                                case 1:
                                    pushState = "1";
                                    scanCodeSign(pushState);
                                    break;
                                case 2:
                                    Toast.makeText(NewReleaseActivity.this, "您选中了："+itemss[2], Toast.LENGTH_SHORT).show();
                                    break;
                            }
                        }
                    }).show();

                }
                break;
        }
    }

    @Override
    public void onSelected(PickTimeView view, long timeMillis) {
        if (view == pickTime) {
            String str = sdfTime.format(timeMillis);
            times.setText(str);
            meetingTime = str;
        } else if (view == pickDate) {
            String str = sdfDate.format(timeMillis);
            times.setText(str);
            meetingTime = str;
        }
    }

    @Override
    public void onSelected(PickValueView view, Object leftValue, Object middleValue, Object rightValue) {
        if (view == pickValue) {
            int left = (int) leftValue;
            times.setText("selected:" + left);
        } else if (view == pickValues) {
            int left = (int) leftValue;
            int middle = (int) middleValue;
            int right = (int) rightValue;
            times.setText("selected: left:" + left + "  middle:" + middle + "  right:" + right);
        } else {
            String selectedStr = (String) leftValue;
            times.setText(selectedStr);
        }
    }

    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
    private void scanCodeSign(String pushState){
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("meetingTime",meetingTime)
                .add("id",teacherId)
                .add("place",places)
                .add("introduction",introductions)
                .add("theme",titles)
                .add("invitationState",invitationState)
                .add("invitationTeachers",invitationTeachers)
                .add("pushState",pushState)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.AddMeeting)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

                //signSleepTextView.setText("网络异常！");
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                final String retStr = response.body().string();

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {

                        Log.d("网络请求返回值",retStr);

                        try {
                            JSONObject jsObj = new JSONObject(retStr);
                            if (jsObj.getString("melodyClass").equals("yes")){
                                AlertDialog.Builder builder  = new AlertDialog.Builder(NewReleaseActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("会议发布成功！" ) ;
                                builder.setPositiveButton("确定" ,  new DialogInterface.OnClickListener() {
                                    // 单击事件
                                    public void onClick(DialogInterface dialog, int which)
                                    {
                                        // 设置TextView文本
                                        //点击是的时候去进行提交
                                        Intent intent = new Intent(NewReleaseActivity.this,AdministrationActivity.class);
                                        intent.putExtra("teacherId",teacherId);
                                        startActivity(intent);
                                        finish();
                                    }
                                } );
                                builder.show();

                            }else {
                                AlertDialog.Builder builder  = new AlertDialog.Builder(NewReleaseActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("会议发布失败！" ) ;
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }

                        } catch (JSONException e) {
                            e.printStackTrace();
                            //statuTV.setText("签到异常");
                        }
                    }
                });
            }
        });
    }

}
<file_sep>package com.xinnuo.apple.nongda.TeacherActivity.AccountSettings;
/**
 * 修改密码
 * */
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class ModifyPasswordActivity extends BaseActivity implements View.OnClickListener{
    private OkHttpClient client;
    private EditText old_pswd;
    private EditText new_pswd;
    private EditText confirm_pswd;
    private Button button_pswd;
    private String cardNo;
    private String phone;
    private String teacherId;
    private String newPswd;
    private String oldPswd;
    private String pswd;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_modify_password);
        setTitle("农大 => 修改密码");
        binding();
        initOkHttp();
        Intent intent = getIntent();
        cardNo = intent.getStringExtra("cardNo");
        Log.d("cardNo = ", cardNo);
        phone = intent.getStringExtra("phone");
        teacherId = intent.getStringExtra("teacherId");
        pswd = intent.getStringExtra("pswd");

    }
    //绑定控件
    private void binding()
    {
        old_pswd = (EditText) findViewById(R.id.old_pswd);
        new_pswd = (EditText) findViewById(R.id.new_pswd);
        confirm_pswd = (EditText) findViewById(R.id.confirm_pswd);
        button_pswd = (Button) findViewById(R.id.button_pswd);
        button_pswd.setOnClickListener(this);
    }
    /**
     * 请求方法
     * */
    private  void requestWithUserId(String cardNos, String phones ,String newPswds){
        //菊花的开始方法
        mLoading.show();
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("cardNo",cardNo)
                .add("phone",phone)
                .add("password",<PASSWORD>)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.TeacherModifyPassword)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }
            //接收方法
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse返回的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        //菊花结束方法
                        mLoading.dismiss();
                        try {
                            //解析json数据
                            jsonParseWithJsonStr(retStr);
                        } catch (JSONException e) {
                            mLoading.dismiss();
                            e.printStackTrace();
                        }
                    }
                });
            }
        });
    }

    /**
     * 解析数据方法
     * */
    //json解析方法

    private  void jsonParseWithJsonStr (String jsonStr) throws JSONException {
        JSONObject js = new JSONObject(jsonStr);
        if (js.getString("melodyClass").equals("操作成功"))
        {
            AlertDialog.Builder builder  = new AlertDialog.Builder(ModifyPasswordActivity.this);
            builder.setTitle("提示" ) ;
            builder.setMessage("修改成功！" ) ;
            builder.setPositiveButton("确定" , new DialogInterface.OnClickListener() {
                // 单击事件
                public void onClick(DialogInterface dialog, int which)
                {
                    // 设置TextView文本
                    //进行跳转
                    Intent intent = new Intent(ModifyPasswordActivity.this,AccountSettingsActivity.class);
                    intent.putExtra("cardNo",cardNo);
                    intent.putExtra("phone",phone);
                    intent.putExtra("teacherId",teacherId);
                    startActivity(intent);
                    finish();
                }
            }) ;
            builder.show();
        }else
        {
            AlertDialog.Builder builder  = new AlertDialog.Builder(ModifyPasswordActivity.this);
            builder.setTitle("提示" ) ;
            builder.setMessage("修改失败，请重新提交！" ) ;
            builder.setPositiveButton("确定" ,  null );
            builder.show();
        }

    }



    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }

    @Override
    public void onClick(View view) {
        oldPswd = old_pswd.getText().toString();
        newPswd = new_pswd.getText().toString();
        if (oldPswd.equals(pswd)){
        if (newPswd.length() > 6) {
            String confirmPswd = confirm_pswd.getText().toString();
            if (newPswd.equals(confirmPswd)) {
                // 设置显示信息
                final AlertDialog.Builder builder = new AlertDialog.Builder(ModifyPasswordActivity.this);

                builder.setMessage("确定要提交？").
                        // 设置确定按钮
                                setPositiveButton("是",
                                new DialogInterface.OnClickListener() {
                                    // 单击事件
                                    public void onClick(DialogInterface dialog, int which) {
                                        // 设置TextView文本
                                        //点击是的时候去进行提交
                                        requestWithUserId(cardNo, phone, newPswd);
                                    }
                                }).
                        // 设置取消按钮
                                setNegativeButton("否",
                                new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog,
                                                        int which) {

                                    }
                                });
                // 创建对话框
                AlertDialog ad = builder.create();
                // 显示对话框
                ad.show();


            } else {
                AlertDialog.Builder builder = new AlertDialog.Builder(ModifyPasswordActivity.this);
                builder.setTitle("提示");
                builder.setMessage("两次输入的密码不一致，请重新输入！");
                builder.setPositiveButton("确定", null);
                builder.show();
            }
        }else {
            AlertDialog.Builder builder = new AlertDialog.Builder(ModifyPasswordActivity.this);
            builder.setTitle("提示");
            builder.setMessage("密码长度必须大于6位，请重新输入！");
            builder.setPositiveButton("确定", null);
            builder.show();
        }
    }else {
            AlertDialog.Builder builder = new AlertDialog.Builder(ModifyPasswordActivity.this);
            builder.setTitle("提示");
            builder.setMessage("旧密码输入不正确，请重新输入！");
            builder.setPositiveButton("确定", null);
            builder.show();
        }
    }
}
<file_sep>package com.xinnuo.apple.nongda.Admin.News;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;
import com.xinnuo.apple.nongda.studentActivity.News.MessageDetails;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class AdminNewsActivity extends BaseActivity {
    private OkHttpClient client;
    private ListView listView;
    private JSONArray jsonArray;
    private TextView adminNews;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_admin_news);
        initOkHttp();

        listView = (ListView) findViewById(R.id.list_admin_news);
        adminNews = (TextView) findViewById(R.id.admin_news);
        scanCodeSign();
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
            public void onItemClick(AdapterView<?> parent, View view, int position, long id)
            {
                try {
                    JSONObject jsonObject = jsonArray.getJSONObject(position);
                    Intent intent = new Intent(AdminNewsActivity.this,MessageDetails.class);
                    intent.putExtra("time",jsonObject.getString("msgDate"));
                    intent.putExtra("content",jsonObject.getString("msgContent"));
                    startActivity(intent);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        });
        adminNews.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(AdminNewsActivity.this,ReleaseMessageActivity.class);
                startActivity(intent);
            }
        });
    }
    private void scanCodeSign(){
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("status",2+"")
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.StuNews)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

                //signSleepTextView.setText("网络异常！");
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                final String retStr = response.body().string();

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {

                        Log.d("网络请求返回值",retStr);

                        try {
                            JSONArray jsa = new JSONArray(retStr);
                            jsonArray = jsa;
                            ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String,     Object>>();/*在数组中存放数据*/
                            for (int i = 0 ; i < jsa.length() ; i++)
                            {
                                JSONObject jsonObject = jsa.getJSONObject(i);
                                String masgDate = jsonObject.getString("msgDate");
                                String msgContent = jsonObject.getString("msgContent");
                                HashMap<String, Object> map = new HashMap<String, Object>();
                                map.put("masgDate",masgDate);
                                map.put("msgContent",msgContent);
                                listItem.add(map);
                            }
                            if (jsa.length() == 0)
                            {
                                midToast("无数据",3);
                            }
                            SimpleAdapter qrAdapter = new SimpleAdapter(AdminNewsActivity.this,listItem, R.layout.item_news,
                                    new  String[]{"masgDate","msgContent"},
                                    new int[]{R.id.stu_news_time, R.id.stu_news_content});
                            listView.setAdapter(qrAdapter);
                        } catch (JSONException e) {
                            e.printStackTrace();
                            //statuTV.setText("签到异常");
                        }
                    }
                });
            }
        });
    }
    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
}
<file_sep>package com.xinnuo.apple.nongda.TeacherActivity.CourseAttendance;
/**
 * e二维码签到
 * */
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import java.io.IOException;
import java.util.Random;
import java.util.concurrent.TimeUnit;

import cn.jpush.android.api.JPushInterface;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class TeacherMakeQRActivity extends AppCompatActivity {

    private OkHttpClient client;
    private String sportClassId;
    private String itemId;
    private String teacherId;
    private Button refreshBtn;
    private ImageView imageView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_teacher_make_qr);
        initOkHttp();

        //绑定 控件

        refreshBtn = (Button)findViewById(R.id.refreshBtn);
        imageView = (ImageView) findViewById(R.id.code_image);

        //取出教师id 所教课程id

        Intent intent = getIntent();
        teacherId = intent.getStringExtra("teacherId");
        itemId = intent.getStringExtra("itemId");
        sportClassId = intent.getStringExtra("sportClassId");
        makeQRImg();

        refreshBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                makeQRImg();
            }
        });

    }

    private void  makeQRImg()
    {
        String QRNumber = getRandomString(10);
        Bitmap qrcode = generateQRCode(teacherId+itemId+sportClassId+","+QRNumber);
        upLoadQR(QRNumber,"1");
        imageView.setImageBitmap(qrcode);

    }

    private void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
    private Bitmap bitMatrix2Bitmap(BitMatrix matrix) {
        int w = matrix.getWidth();
        int h = matrix.getHeight();
        int[] rawData = new int[w * h];
        for (int i = 0; i < w; i++) {
            for (int j = 0; j < h; j++) {
                int color = Color.WHITE;
                if (matrix.get(i, j)) {
                    color = Color.BLACK;
                }
                rawData[i + (j * w)] = color;
            }
        }

        Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.RGB_565);
        bitmap.setPixels(rawData, 0, w, 0, 0, w, h);
        return bitmap;
    }
    //生成二维码 参数教师id  教师所教课程id
    private Bitmap generateQRCode(String content) {
        try {
            QRCodeWriter writer = new QRCodeWriter();
            // MultiFormatWriter writer = new MultiFormatWriter();
            BitMatrix matrix = writer.encode(content, BarcodeFormat.QR_CODE, 700, 700);
            return bitMatrix2Bitmap(matrix);
        } catch (WriterException e) {
            e.printStackTrace();
        }
        return null;
    }

    public static String getRandomString(int length) { //length表示生成字符串的长度
        String base = "abcdefghijklmnopqrstuvwxyz0123456789";
        Random random = new Random();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < length; i++) {
            int number = random.nextInt(base.length());
            sb.append(base.charAt(number));
        }
        return sb.toString();
    }
    private void upLoadQR(String theKey, String status) {
        Log.d("000", "onDestroy:++++++++++++++++++++++++++ ");

        TelephonyManager TelephonyMgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
        String szImei = TelephonyMgr.getDeviceId();
        String rid = JPushInterface.getRegistrationID(getApplicationContext());
        String phoneType = android.os.Build.MODEL;
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("teacherid", teacherId)
                .add("status",status)
                .add("theKey", theKey)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.TeacherUpdateTheQrCodeKey)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {
                Log.d("000", "onFailure:++++++++++++++++++++++++++ ");

            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值", retStr);



                    }
                });
            }
        });


    }

}
<file_sep>package com.xinnuo.apple.nongda.TeacherActivity.CourseAttendance;
/**
 * 签到主界面 二维码 定位 上课 下课 合课
 * */
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.xinnuo.apple.nongda.Anticlockwise;
import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.Utils;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class ClassListDetailsActivity extends BaseActivity {
    private TextView scan_code_sign;                //扫码签到
    private TextView opening_positioning;          //开启定位
    private TextView close_location;                //关闭定位
    private TextView Attendance_list;               //考勤列表
    private TextView combined_lesson;               //合课
    private TextView course_start;                  //课程开始
    private TextView end_of_course;                 //课程结束
    private TextView refresh_position;              //刷新位置

    private OkHttpClient client;
    private String sportclassId;
    private static double Longitude;
    private static double Latitude;
    private String teacherId;
    private Anticlockwise mTimer;
    private LinearLayout layouts;
    private String classState;
    private JSONObject datrr;

    private String itemId;
    private static double distance;
    private String coordinateId;        //坐标id
    private LinearLayout layout;
    private boolean flag;
    private AMapLocationClient locationClient = null;
    private AMapLocationClientOption locationOption = new AMapLocationClientOption();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_class_list_details);
        binding();
        initOkHttp();
        Intent intent = getIntent();
        sportclassId = intent.getStringExtra("sportclassId");
        Log.d("sportclassId = ",sportclassId);
        teacherId = intent.getStringExtra("teacherId");
        itemId = intent.getStringExtra("itemId");
        //初始化时间

        clickJump();

    }
    protected void onStart()
    {
        super.onStart();
    }

    //绑定控件
    private void binding()
    {
        scan_code_sign = (TextView) findViewById(R.id.scan_code_sign);
        opening_positioning = (TextView) findViewById(R.id.opening_positioning);
        close_location = (TextView) findViewById(R.id.close_location);
        Attendance_list = (TextView) findViewById(R.id.Attendance_list);
        combined_lesson = (TextView) findViewById(R.id.combined_lesson);
        course_start = (TextView) findViewById(R.id.course_start);
        end_of_course = (TextView) findViewById(R.id.end_of_course);
        refresh_position = (TextView) findViewById(R.id.refresh_position);
        layout = (LinearLayout) findViewById(R.id.layout_effect);
        mTimer = (Anticlockwise) findViewById(R.id.id_timer);
    }

    //点击事件
    private void clickJump()
    {
        //扫码签到
        scan_code_sign.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(ClassListDetailsActivity.this,TeacherMakeQRActivity.class);
                intent.putExtra("teacherId",teacherId);
                intent.putExtra("sportClassId",sportclassId);
                intent.putExtra("itemId",itemId);
                startActivity(intent);
            }
        });
        //开启定位
        opening_positioning.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view) {
                String open = "1";
                startAndClose(open);
                Log.d("********","走的这里"+Latitude+"Latitude"+Latitude);
            }
        });
        //关闭定位
        close_location.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view) {
                if (Longitude == 0)
                {
                    AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                    builder.setTitle("提示" ) ;
                    builder.setMessage("定位失败请重新定位,然后再关闭定位！" ) ;
                    builder.setPositiveButton("确定" ,  null );
                    builder.show();
                }else {
                    String close = "2";
                    startAndClose(close);
                }

            }
        });
        //考勤列表
        Attendance_list.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(ClassListDetailsActivity.this,TeacherAttendanceListActivity.class);
                intent.putExtra("sportclassId",sportclassId);
                startActivity(intent);
            }
        });
        //合课
        combined_lesson.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view) {
                if (Latitude == 0 && Latitude == 0)
                {
                    //statuTV.setText("不是签到时间");
                    AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                    builder.setTitle("提示" ) ;
                    builder.setMessage("请先开启定位！" ) ;
                    builder.setPositiveButton("确定" ,  null );
                    builder.show();
                }else
                {
                    Intent intent = new Intent(ClassListDetailsActivity.this,CombinedLessonActivity.class);
                    intent.putExtra("coordinateId",coordinateId);
                    intent.putExtra("sportclassId1",sportclassId);
                    intent.putExtra("teacherId",teacherId);
                    startActivity(intent);
                }
            }
        });
        //课程开始
        course_start.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view) {

                    if (distance > 50){
                        mTimer.reStart();
                    }
                    signRequest();

            }
        });
        //课程结束
        end_of_course.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view) {
                endOfCourse();

            }
        });
    }


    private void initLocation(){
        //初始化client
        locationClient = new AMapLocationClient(this.getApplicationContext());
        //设置定位参数

        locationClient.setLocationOption(getDefaultOption());
        // 设置定位监听
        locationClient.setLocationListener(locationListener);
    }


    /**
     * 开始定位
     * @since 2.8.0
     * @author hongming.wang
     */
    private void startLocation(){

        // 设置定位参数
        locationClient.setLocationOption(locationOption);
        // 启动定位
        locationClient.startLocation();
    }
    /**
     * 默认的定位参数
     * @since 2.8.0
     * @author hongming.wang
     *
     */
    private AMapLocationClientOption getDefaultOption(){
        AMapLocationClientOption mOption = new AMapLocationClientOption();
        mOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);//可选，设置定位模式，可选的模式有高精度、仅设备、仅网络。默认为高精度模式
        mOption.setGpsFirst(false);//可选，设置是否gps优先，只在高精度模式下有效。默认关闭
        mOption.setHttpTimeOut(30000);//可选，设置网络请求超时时间。默认为30秒。在仅设备模式下无效
        mOption.setInterval(2000);//可选，设置定位间隔。默认为2秒
        mOption.setNeedAddress(true);//可选，设置是否返回逆地理地址信息。默认是ture
        mOption.setOnceLocation(true);//可选，设置是否单次定位。默认是false
        mOption.setOnceLocationLatest(false);//可选，设置是否等待wifi刷新，默认为false.如果设置为true,会自动变为单次定位，持续定位时不要使用
        AMapLocationClientOption.setLocationProtocol(AMapLocationClientOption.AMapLocationProtocol.HTTP);//可选， 设置网络请求的协议。可选HTTP或者HTTPS。默认为HTTP
        return mOption;

    }
    /**
     * 定位监听
     */
    AMapLocationListener locationListener = new AMapLocationListener() {
        @Override
        public void onLocationChanged(AMapLocation loc) {
            if (null != loc) {
                //解析定位结果
                String result = Utils.getLocationStr(loc);
                /**
                 * sb.append("经    度    : " + location.getLongitude() + "\n");
                 sb.append("纬    度    : " + location.getLatitude() + "\n");
                 */

                if (Latitude == 0.0 && Longitude == 0.0) {

                    Longitude = loc.getLongitude();
                    Latitude = loc.getLatitude();
                    final String coutent = "教师已上传定位坐标，可以定位签到了";
                    startPositioning(coutent);
                }else {
                    mLoading.dismiss();
                    double signLongitude  = loc.getLongitude();
                    double signLatitude  = loc.getLatitude();
                    distance = DistanceOfTwoPoints(Latitude,Longitude,signLatitude,signLongitude);
                    if (distance > 50)
                    {

                        mTimer.setOnTimeCompleteListener(new Anticlockwise.OnTimeCompleteListener()
                        {
                            @Override
                            public void onTimeComplete()
                            {
                                int num = 0;
                                startAttendance(num);
                            }
                        });

                        stopLocation();
                    }else {
                        mTimer.stop();
                        mTimer.initTime(10,0);
                    }
                }

                String ret = ""+Longitude + Latitude;
                String jStr = Longitude+",";
                String wStr = Latitude+"";
                Log.d("定位结果：long = ",Longitude+"lat = "+Latitude);
//                statuTV.setText(jStr+wStr);
//                test3TV.setText("定位结果：long = "+Longitude+"lat = "+Latitude);



            } else {
                //statuTV.setText("定位失败，loc is null");
                mLoading.dismiss();
            }
        }
    };
    /**
     * 根据两点间经纬度坐标（double值），计算两点间距离，
     * @param lat1
     * @param lng1
     * @param lat2
     * @param lng2
     * @return 距离：单位为米
     */
    public static double DistanceOfTwoPoints(double lat1,double lng1,
                                             double lat2,double lng2) {
        double radLat1 = rad(lat1);
        double radLat2 = rad(lat2);
        double a = radLat1 - radLat2;
        double b = rad(lng1) - rad(lng2);
        double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2)
                + Math.cos(radLat1) * Math.cos(radLat2)
                * Math.pow(Math.sin(b / 2), 2)));
        s = s * 6378137.0;
        s = Math.round(s * 10000) / 10000;
        return s;
    }
    //查询教师状态
    private void signRequest(){

        RequestBody requestBodyPost = new FormBody.Builder()
                .add("sportsClassId",sportclassId)
                .add("teacherId",teacherId)
                .add("HaveAclassState","0")
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.TeacherCourseStart)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

                //signSleepTextView.setText("网络异常！");
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                final String retStr = response.body().string();

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        try {
                            JSONObject jsObj = new JSONObject(retStr);
                            String retStr = jsObj.getString("melodyClass");

                            if (retStr.equals("yes")) {
                                int num = 1;
                                startAttendance(num);
                            }
                            else if (retStr.equals("BeASubstituteInThe"))
                            {
                                //statuTV.setText("不是签到时间");
                                AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("您的课程被代课中！" ) ;
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }else if (retStr.equals("NotClickOnTheClass"))
                            {
                                //statuTV.setText("服务器异常");
                                AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("请至少一名学生签到成功后开启上课！" ) ;
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }else if (retStr.equals("Error"))
                            {
                                //statuTV.setText("服务器异常");
                                AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("开启失败，数据异常1！" ) ;
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();

                            }else
                            {
                                //statuTV.setText("服务器异常");
                                AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("开启失败，数据异常2！" ) ;
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }
                        } catch (JSONException e) {
                            e.printStackTrace();
                            //statuTV.setText("签到异常");
                        }


                    }
                });
            }
        });
    }
    //开始上课录入接口
    private void startAttendance( int number){

        RequestBody requestBodyPost = new FormBody.Builder()
                .add("teacherid",teacherId)
                .add("HaveAclassState","0")
                .add("attendState",number+"")
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.TeacherStartAttendance)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

                //signSleepTextView.setText("网络异常！");
            }
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                final String retStr = response.body().string();

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);

                        try {
                            JSONObject jsObj = new JSONObject(retStr);
                            if (jsObj.getString("melodyClass").equals("离职"))
                            {
                                AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("上传考勤记录！") ;
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }else
                            {
                                AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("开始上课！") ;
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }

                        } catch (JSONException e) {
                            e.printStackTrace();
                            //statuTV.setText("签到异常");
                        }
                    }
                });
            }
        });
    }

    //开启或关闭签到通道
    private void startAndClose(final String method)
    {

        RequestBody requestBodyPost = new FormBody.Builder()
                .add("teacherid",teacherId)
                .add("theKey","0")
                .add("status",method)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.UpdateTheQrCodeKey)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

                //signSleepTextView.setText("网络异常！");
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                final String retStr = response.body().string();

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);

                        try {
                            JSONObject jsObj = new JSONObject(retStr);
                            if (jsObj.getString("melodyClass").equals("yes"))
                            {
                                if (method.equals("1"))
                                {
                                    initLocation();
                                    startLocation();

                                    mLoading.show();
                                    layout.setVisibility(View.VISIBLE);
                                    refresh_position.setOnClickListener(new View.OnClickListener() {
                                        @Override
                                        public void onClick(View view) {
                                            startLocation();

                                        }
                                    });
                                }else
                                {

                                        layout.setVisibility(View.GONE);
                                    if (Latitude == 0.0){
                                        closeLocation();
                                    }else {
                                        stopLocation();
                                        destroyLocation();
                                        closeLocation();
                                    }



                                }
                            }else
                            {
                                AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("定位关闭失败") ;
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }
                        } catch (JSONException e) {
                            e.printStackTrace();
                            //statuTV.setText("签到异常");
                        }


                    }
                });
            }
        });
    }
    //存入教师坐标
    private void startPositioning(final String content){
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("teacherId",teacherId)
                .add("longitude",Longitude+"")
                .add("latitude",Latitude+"")
                .add("classId",sportclassId)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.TeacherStartPositioning)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {
                //signSleepTextView.setText("网络异常！");
                Log.d("请求失败 teache",teacherId+"classId = "+sportclassId+"99999999999999999999999999999999999999999999");
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                final String retStr = response.body().string();

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        mLoading.dismiss();
                        try {
                            JSONObject jsObj = new JSONObject(retStr);
                            coordinateId = jsObj.getString("id");


                                AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage(content) ;
                                String ret = ""+Longitude + Latitude;
                                Log.d("ret = ",ret);
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();

                        } catch (JSONException e) {
                            e.printStackTrace();
                            //statuTV.setText("签到异常");
                        }


                    }
                });
            }
        });
    }
    //关闭定位
    private void closeLocation(){

        RequestBody requestBodyPost = new FormBody.Builder()
                .add("id",coordinateId)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.TeacherCloseLocation)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

                //signSleepTextView.setText("网络异常！");
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                final String retStr = response.body().string();

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);

                        try {
                            JSONObject jsObj = new JSONObject(retStr);
                            if (jsObj.getString("Error").equals("yes"))
                            {
                                AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("定位关闭成功！" ) ;
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }else
                            {
                                AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("定位关闭失败") ;
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }
                        } catch (JSONException e) {
                            e.printStackTrace();
                            //statuTV.setText("签到异常");
                        }


                    }
                });
            }
        });
    }
    //下课请求
    private void endOfCourse(){

        RequestBody requestBodyPost = new FormBody.Builder()
                .add("teacherId",teacherId)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.TeacherEndOfCourse)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

                //signSleepTextView.setText("网络异常！");
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                final String retStr = response.body().string();

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);

                        try {
                            JSONObject jsObj = new JSONObject(retStr);
                            datrr = new JSONObject(retStr);
                            classState = jsObj.getString("melodyClass");
                            if (classState.equals("yes")) {
                                //statuTV.setText("不是签到时间");
                                AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("成功，本节课结束！" ) ;
                                builder.setPositiveButton("确定" ,  new DialogInterface.OnClickListener() {
                                    // 单击事件
                                    public void onClick(DialogInterface dialog, int which) {

                                        //进行页面跳转，跳回界面
                                        Intent intent = new Intent(ClassListDetailsActivity.this, Class_ListActivity.class);
                                        intent.putExtra("itemId",itemId);
                                        intent.putExtra("teacherId",teacherId);
                                        startActivity(intent);
                                        finish();
                                    }
                                });
                                builder.show();
                            }
                            else if (classState.equals("noTime"))
                            {
                                AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("失败，上课时间不足，请稍后再试！" ) ;
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();

                            }else if (classState.equals("no"))
                            {
                                //statuTV.setText("服务器异常");
                                AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("失败，未查询到上课！" ) ;
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }else if (classState.equals("Error"))
                            {
                                //statuTV.setText("服务器异常");
                                AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("开启失败，数据异常1！" ) ;
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }else
                            {
                                //statuTV.setText("服务器异常");
                                AlertDialog.Builder builder  = new AlertDialog.Builder(ClassListDetailsActivity.this);
                                builder.setTitle("提示" ) ;
                                builder.setMessage("开启失败，数据异常2！" ) ;
                                builder.setPositiveButton("确定" ,  null );
                                builder.show();
                            }

                        } catch (JSONException e) {
                            e.printStackTrace();
                            //statuTV.setText("签到异常");
                        }


                    }
                });
            }
        });
    }

    /**
     * 停止定位
     *
     * @since 2.8.0
     * @author hongming.wang
     *
     */
    private void stopLocation(){
        // 停止定位
        locationClient.stopLocation();
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        destroyLocation();
    }
    /**
     * 销毁定位
     *
     * @since 2.8.0
     * @author hongming.wang
     *
     */
    private void destroyLocation(){
        if (null != locationClient) {
            /**
             * 如果AMapLocationClient是在当前Activity实例化的，
             * 在Activity的onDestroy中一定要执行AMapLocationClient的onDestroy
             */
            locationClient.onDestroy();
            locationClient = null;
            locationOption = null;
        }
    }
    private static double rad(double d) {
        return d * Math.PI / 180.0;
    }
    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }


}
<file_sep>package com.xinnuo.apple.nongda.entity;

/**
 * 管理员基类
 */


public class AdminModel {
    /**
     * birthday : null
     * phone : 123456
     * sex : 1
     * status : 2
     * jurisdiction : 1
     * collegeName : null
     * password : <PASSWORD>
     * id : 67
     * cardNo : null
     * picture : null
     * name : admin
     * itro : null
     * loginSta : success
     */

    private String birthday;
    private String phone;
    private int sex;
    private int status;
    private String jurisdiction;
    private String collegeName;
    private String password;
    private String id;
    private String cardNo;
    private String picture;
    private String name;
    private String itro;
    private String loginSta;

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public int getSex() {
        return sex;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getJurisdiction() {
        return jurisdiction;
    }

    public void setJurisdiction(String jurisdiction) {
        this.jurisdiction = jurisdiction;
    }

    public String getCollegeName() {
        return collegeName;
    }

    public void setCollegeName(String collegeName) {
        this.collegeName = collegeName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public String getPicture() {
        return picture;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getItro() {
        return itro;
    }

    public void setItro(String itro) {
        this.itro = itro;
    }

    public String getLoginSta() {
        return loginSta;
    }

    public void setLoginSta(String loginSta) {
        this.loginSta = loginSta;
    }
}
<file_sep>package com.xinnuo.apple.nongda.Binding;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.xinnuo.apple.nongda.MainActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.TeacherActivity.AccountSettings.AccountSettingsActivity;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class TeacherBindingActivity extends AppCompatActivity implements View.OnClickListener {
    //定义控件
    private EditText account;
    private TextView tvshow;
    private EditText pwd;
    private Button login;
    private static OkHttpClient client;
    private static String melodyClass;
    private String teacherId;
    private String cardNo;
    private String phone;
    private String state;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_teacher_binding);
        initOkHttp();
        Intent intent = getIntent();
        //取出登录界面传过来的教师id
        cardNo = intent.getStringExtra("cardNo");
        Log.d("cardNo = ", cardNo);
        phone = intent.getStringExtra("phone");
        teacherId = intent.getStringExtra("teacherId");
        if (intent.getStringExtra("state") != null){
            state = intent.getStringExtra("state");
        }

        //绑定控件
        this.account = (EditText) findViewById(R.id.nameEditTV);
        this.pwd = (EditText) findViewById(R.id.passwordEditTV);
        this.login = (Button) findViewById(R.id.loginBtn);
        this.tvshow = (TextView) findViewById(R.id.tv_show);
        login.setOnClickListener(this);
    }

    // 实例化AlertDailog.Builder对象
    public void onClick(View v) {
        //接收页面传过来来的手机号和身份证号
        final String userIdStr = account.getText().toString().trim();
        final String passwordStr = pwd.getText().toString().trim();


        // 设置显示信息
        final AlertDialog.Builder builder = new AlertDialog.Builder(this);

        builder.setMessage("确定要绑定？").
                // 设置确定按钮
                        setPositiveButton("是",
                        new DialogInterface.OnClickListener() {
                            // 单击事件
                            public void onClick(DialogInterface dialog, int which) {
                                // 设置TextView文本
                                //点击是的时候去进行提交
                                if (userIdStr.length() != 6 || passwordStr.length() != 11){
                                    AlertDialog.Builder builder = new AlertDialog.Builder(TeacherBindingActivity.this);
                                    builder.setTitle("提示");
                                    builder.setMessage("手机号是11位，工号为6位！");
                                    builder.setPositiveButton("确定", null);
                                    builder.show();
                                }else{
                                    requestWithUserId(userIdStr, passwordStr, teacherId);
                                }

                            }
                        }).
                // 设置取消按钮
                        setNegativeButton("否",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                                int which) {
                                tvshow.setText("取消绑定！");
                            }
                        });
        // 创建对话框
        AlertDialog ad = builder.create();
        // 显示对话框
        ad.show();
    }

    private void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();

    }

    /**
     * 请求方法 参数（工号、手机号、教师编号）
     */
    private void requestWithUserId(String IdNumber, String Phone, String teacherid) {
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("cardNo", IdNumber)
                .add("phone", Phone)
                .add("id", teacherid)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.teacherBindingUrl)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {
                tvshow.setText("网络异常！");

            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收htttpresponse请求的返回值
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值", retStr);
                        try {
                            //调用解析方法 解析数据
                            jsonParseWithJsonStr(retStr);
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
                });
            }
        });
    }

    //json数据解析
    private void jsonParseWithJsonStr(String jsonStr) throws JSONException {

        JSONArray jsArr = new JSONArray(jsonStr);
        //绑定状态
        String bindingState = null;
        //循环jsArr集合
        for (int i = 0; i < jsArr.length(); i++) {
            JSONObject jsObj = jsArr.getJSONObject(i);
            //取到state返回值
            bindingState = jsObj.getString("state");


        }
        //判断bindingState
        if (bindingState.equals("绑定成功")) {
            tvshow.setText("绑定成功！");
            //绑定成功后跳转登录界面
            if (state.equals("1")){
                Intent intent = new Intent(TeacherBindingActivity.this, MainActivity.class);
                startActivity(intent);
                finish();
            }else {
                Intent intent = new Intent(TeacherBindingActivity.this, AccountSettingsActivity.class);
                intent.putExtra("phone",phone);
                intent.putExtra("cardNo",cardNo);
                intent.putExtra("teacherId",teacherId);
                startActivity(intent);
                finish();
            }

        } else {
            //绑定失败留在本界面
            tvshow.setText("绑定失败");
        }


    }
}
<file_sep>package com.xinnuo.apple.nongda.TeacherActivity.Resultquery;
/**
 * 体质测试班级展示
 * */

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class PhysicalFitnessTestActivity extends BaseActivity {
    private OkHttpClient client;
    private String classId;
    private String sportsClassNo;
    private ListView listView;
    private String state;
    private JSONArray dataArr;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_student_list_query);
        initOkHttp();
        listView = (ListView) findViewById(R.id.list_stuquerys);
        Intent intent = getIntent();
        sportsClassNo = intent.getStringExtra("sportsClassNo");
        requestWithUserId(sportsClassNo, httpUrl.StudentPhysicalFitnessScore);
        listView= (ListView)findViewById(R.id.list_stuquerys);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                try {
                    //点击相应的班级进行跳转
                    Intent intent=new Intent(PhysicalFitnessTestActivity.this,StudentDetailedQueryActivity.class);
                    JSONObject js = dataArr.getJSONObject(position);
                    //传值 班级id 所教班级id
                    intent.putExtra("studentId",js.getString("studentId"));
                    startActivity(intent);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        });

    }

    /**
     * 请求方法
     * */
    private  void requestWithUserId(String itemId,String url){
        //菊花的开始方法
        mLoading.show();
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("itemId",itemId)
                .build();
        Request requestPost = new Request.Builder()
                .url(url)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }
            //接收方法
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse返回的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        //菊花结束方法
                        mLoading.dismiss();
                        try {
                            //解析json数据
                            jsonParseWithJsonStr(retStr,state);
                        } catch (JSONException e) {
                            mLoading.dismiss();
                            e.printStackTrace();
                        }
                    }
                });
            }
        });
    }

    /**
     * 解析数据方法
     * */
    //json解析方法

    private  void jsonParseWithJsonStr (String jsonStr , String state) throws JSONException {

        JSONArray jsArr = new JSONArray(jsonStr);
        dataArr = jsArr;
        List<String> data = new ArrayList<String>();
        ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String,     Object>>();/*在数组中存放数据*/

            HashMap<String, Object> map2 = new HashMap<String, Object>();
            map2.put("count", "序 号");
            map2.put("studentNo", " 学 号");
            map2.put("stuname", "姓 名");
            map2.put("number", "总 分");
            listItem.add(map2);
            for (int i = 0; i < jsArr.length(); i++) {
                JSONObject js = jsArr.getJSONObject(i);

            /*
            * "studentNo": "11042227  ",
            *  "name": "张烁",
            *  "number": 0
            */
                String count = i + 1 + "";
                String studentNo = js.optString("studentId");
                String stuname = js.optString("name");
                String number = js.optString("result");
                Log.d("******", studentNo);
                HashMap<String, Object> map = new HashMap<String, Object>();
//            map.put("id",id);
                map.put("count", count);
                map.put("studentNo", studentNo);
                map.put("stuname", stuname);
                map.put("number", number);

                listItem.add(map);

        }
        if (jsArr.length() == 0)
        {
            midToast("无数据",3);
        }

        SimpleAdapter qrAdapter = new SimpleAdapter(this,listItem, R.layout.item_student_list_query,
                new  String[]{"count","studentNo","stuname","number"},
                new int[]{R.id.studentlist_query1, R.id.studentlist_query2, R.id.studentlist_query3, R.id.studentlist_query4});
        listView.setAdapter(qrAdapter);



    }



    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
}
<file_sep>package com.xinnuo.apple.nongda.TeacherActivity.WorkPlan;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class TeacherAddWorkPlan extends BaseActivity {
    private EditText title1;
    private EditText createDate1;
    private EditText beginDate1;
    private EditText endDate1;
    private EditText workContent1;
    private EditText summary1;
    private CheckBox work_yes;
    private CheckBox work_no;
    private TextView workplan_submit;
    private OkHttpClient client;
    private String title;
    private String createDate;
    private String beginDate;
    private String endDate;
    private String workContent;
    private String state;
    private String summary;
    private String teacherId;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_teacher_add_work_plan);
        initOkHttp();
        binding();
        SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd");
        Date curDate = new Date(System.currentTimeMillis());//获取当前时间
        createDate = formatter.format(curDate);
        Intent intent = getIntent();
        teacherId = intent.getStringExtra("teacherId");
        state = "0";
        createDate1.setText(createDate);
        workplan_submit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                title = title1.getText().toString();
                beginDate = beginDate1.getText().toString();
                endDate = endDate1.getText().toString();
                workContent = workContent1.getText().toString();
                summary = summary1.getText().toString();
                work_no.setChecked(true);
                Log.d("dawdaw","+++"+title+"++++++++++++++++++++++++++++");
                if (title.length() == 0){
                    AlertDialog.Builder builder = new AlertDialog.Builder(TeacherAddWorkPlan.this);
                    builder.setTitle("提示");
                    builder.setMessage("标题不能为空！");
                    builder.setPositiveButton("确定", null);
                    builder.show();
                }else if (beginDate.length() == 0){
                    AlertDialog.Builder builder = new AlertDialog.Builder(TeacherAddWorkPlan.this);
                    builder.setTitle("提示");
                    builder.setMessage("开始时间不能为空！");
                    builder.setPositiveButton("确定", null);
                    builder.show();
                }else if (endDate.length() == 0){
                    AlertDialog.Builder builder = new AlertDialog.Builder(TeacherAddWorkPlan.this);
                    builder.setTitle("提示");
                    builder.setMessage("结束时间不能为空！");
                    builder.setPositiveButton("确定", null);
                    builder.show();
                }else if (workContent.length() == 0){
                    AlertDialog.Builder builder = new AlertDialog.Builder(TeacherAddWorkPlan.this);
                    builder.setTitle("提示");
                    builder.setMessage("计划不能为空！");
                    builder.setPositiveButton("确定", null);
                    builder.show();
                }else if (summary.length() == 0){
                    AlertDialog.Builder builder = new AlertDialog.Builder(TeacherAddWorkPlan.this);
                    builder.setTitle("提示");
                    builder.setMessage("总结不能为空！");
                    builder.setPositiveButton("确定", null);
                    builder.show();
                }else{
                    // 设置显示信息
                    final AlertDialog.Builder builder = new AlertDialog.Builder(TeacherAddWorkPlan.this);
                    builder.setMessage("是否提交").
                            // 设置确定按钮
                                    setPositiveButton("提交",
                                    new DialogInterface.OnClickListener() {
                                        // 单击事件
                                        public void onClick(DialogInterface dialog, int which)
                                        {
                                            // 设置TextView文本
                                            //点击是的时候去进行提交
                                            // 单击事件
                                            requestWithUserId();


                                        }
                                    }).
                            // 设置取消按钮
                                    setNegativeButton("取消",
                                    new DialogInterface.OnClickListener()
                                    {
                                        public void onClick(DialogInterface dialog,
                                                            int which)
                                        {

                                        }
                                    });
                    // 创建对话框
                    AlertDialog ad = builder.create();
                    // 显示对话框
                    ad.show();


                    builder.show();

                }
            }
        });
    }

    //绑定控件
    private void binding()
    {
        title1 = (EditText) findViewById(R.id.add_work_title);
        createDate1 = (EditText) findViewById(R.id.add_work_createdate);
        beginDate1 = (EditText) findViewById(R.id.add_work_startdate);
        endDate1 = (EditText) findViewById(R.id.add_work_enddate);
        workContent1 = (EditText) findViewById(R.id.add_work_plan);
        summary1 = (EditText) findViewById(R.id.add_work_summary);
        work_no = (CheckBox) findViewById(R.id.add_workplan_no);
        work_yes = (CheckBox) findViewById(R.id.add_workplan_yes);
        workplan_submit = (TextView) findViewById(R.id.workplan_submit);

    }
    /**
     * 请求方法
     * */
    private  void requestWithUserId(){
        //菊花的开始方法
        mLoading.show();
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("title",title)
                .add("createDate",createDate)
                .add("beginDate",beginDate)
                .add("endDate",endDate)
                .add("workContent",workContent)
                .add("state",state)
                .add("summary",summary)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.AddWorkPlan)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }
            //接收方法
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse返回的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        //菊花结束方法
                        mLoading.dismiss();
                        try {
                            //解析json数据
                            jsonParseWithJsonStr(retStr);
                        } catch (JSONException e) {
                            mLoading.dismiss();
                            e.printStackTrace();
                        }
                    }
                });
            }
        });
    }

    /**
     * 解析数据方法
     * */


    private  void jsonParseWithJsonStr (String jsonStr) throws JSONException {
        JSONArray jaArr = new JSONArray(jsonStr);
        for (int i = 0 ; i < jaArr.length() ; i++){
            JSONObject json = jaArr.getJSONObject(i);
            String updateYesOrNo = json.getString("state");
            if (updateYesOrNo.equals("增加成功"))
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(TeacherAddWorkPlan.this);
                builder.setTitle("提示");
                builder.setMessage("增加成功！");
                builder.setPositiveButton("确定",
                        new DialogInterface.OnClickListener() {
                            // 单击事件
                            public void onClick(DialogInterface dialog, int which) {
                                // 设置TextView文本
                                //点击是的时候去进行提交
                                Intent intent = new Intent(TeacherAddWorkPlan.this,TeacherWorkPlan.class);
                                intent.putExtra("teacherId",teacherId);
                                startActivity(intent);
                                finish();
                            }
                        });
                builder.show();
            }else
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(TeacherAddWorkPlan.this);
                builder.setTitle("提示");
                builder.setMessage("增加失败！");
                builder.setPositiveButton("确定", null);
                builder.show();
            }

        }


    }
    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
}
<file_sep>package com.xinnuo.apple.nongda;
/**
 * 电信号段正则表达式 根据传过来的电话号判断是否是电信号段
 * */

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by Administrator on 2016/11/1 0001.
 */

public class IsPhoneNumUtil {
    public static boolean isMobileNumber(String phoneNumber) {
        Pattern pattern = Pattern.compile("^(133|149|153|173|177|180|181|189)\\d{8}$");
        Matcher matcher = pattern.matcher(phoneNumber);
        return matcher.matches();
    }
}
<file_sep>package com.xinnuo.apple.nongda.studentActivity.TeacherEvaluation;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class TeacherEvaluationActivity extends BaseActivity {
    private String id;
    private TextView teacherName;
    private TextView teacherState;
    private LinearLayout teacherLayout;
    private OkHttpClient client;
    private String type = null,teacherId;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_teacher_evaluation);
        initOkHttp();
        final Intent intent = getIntent();
        id = intent.getStringExtra("id");
        teacherName = (TextView) findViewById(R.id.teacher_name);
        teacherState = (TextView) findViewById(R.id.teacher_state);
        teacherLayout = (LinearLayout) findViewById(R.id.teacher_Layout);
        requestWithUserId();


        teacherLayout.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 if (type.equals("未评价")){
                     Intent intent1 = new Intent(TeacherEvaluationActivity.this,TeacherScoreActivity.class);
                     intent1.putExtra("teacherId",teacherId);
                     intent1.putExtra("id",id);
                     startActivity(intent1);
                 }
             }
         });





    }
    /**
     * 请求方法
     * */
    private  void requestWithUserId(){
        //菊花的开始方法
        mLoading.show();

        RequestBody requestBodyPost = new FormBody.Builder()
                .add("id",id)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.TeacherEvaluation)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }
            //接收方法
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse返回的json数据
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        //菊花结束方法
                        mLoading.dismiss();
                        try {
                            //解析json数据
                            jsonParseWithJsonStr(retStr);
                        } catch (Exception e) {
                            mLoading.dismiss();
                            e.printStackTrace();
                        }
                    }
                });
            }
        });
    }

    /**
     * 解析数据方法
     * */
    private  void jsonParseWithJsonStr (String jsonStr){

        JSONArray jsArr = null;
        try {
            jsArr = new JSONArray(jsonStr);
            List<String> data = new ArrayList<String>();
            ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String,     Object>>();/*在数组中存放数据*/
            for (int i = 0; i < jsArr.length(); i++)
            {
                JSONObject js = jsArr.getJSONObject(i);
                String meetType;
                if (js.getString("type").equals("nul"))
                {
                    type = "未评价";
                    teacherState.setText("未评价");
                }else
                {
                    type = "已评价";
                    teacherState.setText("已评价");
                }
                teacherName.setText(js.getString("name"));
                teacherId = js.getString("id");
            }


            if (jsArr.length() == 0)
            {
                midToast("无数据",3);
            }
        } catch (JSONException e) {
            e.printStackTrace();
            AlertDialog.Builder builder = new AlertDialog.Builder(TeacherEvaluationActivity.this);
            builder.setTitle("提示");
            builder.setMessage("请先选择课程！");
            builder.setPositiveButton("确定",  new DialogInterface.OnClickListener() {
                // 单击事件
                public void onClick(DialogInterface dialog, int which)
                {
                    // 设置TextView文本
                    //点击是的时候去进行提交
                   finish();
                }
            });
            builder.show();
        }


    }
    /**
     * 初始化网络请求
     * */
    public void initOkHttp() {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();
    }
}
<file_sep>package com.xinnuo.apple.nongda.singin;

import android.app.Activity;
import android.content.Intent;
import android.util.Log;

import com.xinnuo.apple.nongda.BaseActivity;
import com.xinnuo.apple.nongda.TeacherActivity.TeacherActivity;
import com.xinnuo.apple.nongda.entity.TeacherModel;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by Administrator on 2016/11/10 0010.
 */

public class Teacher_Singin extends BaseActivity {
    public Intent teacher_Login(Activity activity, JSONObject jsObj , TeacherModel teacherInfo)
    {
        Intent intent = null;
        try {
            setTeacherInfo(jsObj);
            //跳转界面并进行传值 教师姓名 教的班级 教师姓名
            intent = new Intent(activity, TeacherActivity.class);
            intent.putExtra("teacherId", teacherInfo.getId());
            intent.putExtra("itemId", teacherInfo.getItemId());
            intent.putExtra("teacherName",teacherInfo.getName());
            Log.d("*****",teacherInfo.getName());
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return intent;
    }
    //教师model
    public TeacherModel setTeacherInfo(JSONObject jsObj) throws JSONException {
        TeacherModel teacher = new TeacherModel();

        teacher.setBirthday(jsObj.getString("birthday"));
        teacher.setPhone(jsObj.getString("phone"));
        teacher.setSex(jsObj.getInt("sex"));
        teacher.setStatus(jsObj.getInt("status"));
        teacher.setJurisdiction(jsObj.getString("jurisdiction"));

        teacher.setItemId(jsObj.getString("itemId"));
        teacher.setCollegeName(jsObj.getString("collegeName"));
        teacher.setPassword(jsObj.getString("password"));
        teacher.setIntro(jsObj.getString("intro"));
        teacher.setId(jsObj.getString("id"));

        teacher.setCardNo(jsObj.getString("cardNo"));
        teacher.setPicture(jsObj.getString("picture"));
        teacher.setNationName(jsObj.getString("nationName"));
        teacher.setName(jsObj.getString("name"));
        teacher.setLoginSta(jsObj.getString("loginSta"));

        return teacher;
    }
}
<file_sep>package com.xinnuo.apple.nongda.Binding;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.xinnuo.apple.nongda.MainActivity;
import com.xinnuo.apple.nongda.R;
import com.xinnuo.apple.nongda.httpUrl;
import com.xinnuo.apple.nongda.studentActivity.AccountSettings.StuAccountSettingsActivity;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class StudentBindingActivity extends AppCompatActivity implements View.OnClickListener {

    //定义控件
    private EditText account;
    private TextView tvshow;
    private EditText pwd;
    private Button login;

    private static OkHttpClient client;
    private static String melodyClass;
    private static String userNo;
    private String id;
    private String studentNo;
    private String password;
    private String new_paswd;
    private String state;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_student_binding);
        initOkHttp();
        Intent intent = getIntent();
        id = intent.getStringExtra("id");
        studentNo = intent.getStringExtra("studentNo");
        Log.d("stuNo = ",studentNo);
        password = intent.getStringExtra("password");
        if (intent.getStringExtra("state") != null){
            state = intent.getStringExtra("state");
        }

        initOkHttp();

        //绑定控件
        this.account = (EditText) findViewById(R.id.nameEditTV);
        this.pwd = (EditText) findViewById(R.id.passwordEditTV);
        this.login = (Button) findViewById(R.id.loginBtn);
        this.tvshow = (TextView) findViewById(R.id.tv_show);
        login.setOnClickListener(this);
    }

    // 实例化AlertDailog.Builder对象
    @Override
    public void onClick(View v) {
        //接收页面传过来来的手机号和身份证号
        final String userIdStr = account.getText().toString().trim();
        final String passwordStr = pwd.getText().toString().trim();

        Log.d("userIdStr",userIdStr);
        Log.d("passwordStr",passwordStr);

        // 设置显示信息
        final AlertDialog.Builder builder = new AlertDialog.Builder(this);

        builder.setMessage("确定要绑定？").
                // 设置确定按钮
                        setPositiveButton("是",
                        new DialogInterface.OnClickListener() {
                            // 单击事件
                            public void onClick(DialogInterface dialog, int which) {
                                // 设置TextView文本
                                //点击是的时候去进行提交
                                if (userIdStr.length() != 18 || passwordStr.length() != 11){
                                    AlertDialog.Builder builder = new AlertDialog.Builder(StudentBindingActivity.this);
                                    builder.setTitle("提示");
                                    builder.setMessage("手机号是11位，身份证号是18位！");
                                    builder.setPositiveButton("确定", null);
                                    builder.show();
                                } else {
                                    requestWithUserId(userIdStr,passwordStr,studentNo);
                                }

                            }
                        }).
                // 设置取消按钮
                        setNegativeButton("否",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                                int which) {
                                tvshow.setText("取消绑定！");
                            }
                        });
        // 创建对话框
        AlertDialog ad = builder.create();
        // 显示对话框
        ad.show();
    }
    private void initOkHttp()
    {
        client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .build();

    }
    /**
     * 请求方法 参数（身份证号、电话号、学生编号）
     * */
    private  void requestWithUserId(String IdNumber , String Phone , String StudentNo){
        RequestBody requestBodyPost = new FormBody.Builder()
                .add("IdNumber",IdNumber)
                .add("Phone",Phone)
                .add("stuNo",StudentNo)
                .build();
        Request requestPost = new Request.Builder()
                .url(httpUrl.studentBindingUrl)
                .post(requestBodyPost)
                .build();
        client.newCall(requestPost).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {
                tvshow.setText("网络异常！");

            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //接收httpresponse请求的返回值
                final String retStr = response.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d("网络请求返回值",retStr);
                        try {
                            //调用解析方法 解析数据
                            jsonParseWithJsonStr(retStr);
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
                });
            }
        });
    }
    //json数据解析
    private  void jsonParseWithJsonStr (String jsonStr) throws JSONException {
        JSONObject js = new JSONObject(jsonStr);
        melodyClass = js.getString("melodyClass");
        Log.d("*******************",melodyClass);
        //判断返回值如果是yes就跳转。如果是no就给提示信息
        if (melodyClass.equals("yes")){
            tvshow.setText("绑定成功！");
            //绑定成功后跳转登录界面
            if (state.equals("1")){
                Intent intent = new Intent(StudentBindingActivity.this,MainActivity.class);
                startActivity(intent);
                finish();
            }else{
                Intent intent = new Intent(StudentBindingActivity.this,StuAccountSettingsActivity.class);
                intent.putExtra("id",id);
                intent.putExtra("studentNo",studentNo);
                intent.putExtra("password",<PASSWORD>);
                startActivity(intent);
                //清理缓存
                finish();
            }

        }else{
            //绑定失败留在本界面
            tvshow.setText("绑定失败");
        }



    }
}
<file_sep>package com.xinnuo.apple.nongda.entity;

/**
 * 学生基类
 */


public class StudentModel {
    /**
     * cardId : 11042227
     * birthday : 1993/7/10
     * phone : 18603603980
     * studentNo : 11042227
     * sex : 2
     * gradeId : 3
     * status : 1
     * classId : 5394
     * electiveInformation : null
     * password : <PASSWORD>
     * collegeName : 工学院
     * nationId : 汉族
     * id : 37248
     * stuSource : null
     * homeAddress : null
     * name : 张烁
     * className : 食品13-2
     * loginSta : successToStu
     * reelect : 1
     * idNumber : 230107199505122016
     */

    private String cardId;
    private String birthday;
    private String phone;
    private String studentNo;
    private String sex;
    private int gradeId;
    private int status;
    private String classId;
    private String electiveInformation;
    private String password;
    private String collegeName;
    private String nationId;
    private String id;
    private String stuSource;
    private String homeAddress;
    private String name;
    private String className;
    private String loginSta;
    private int reelect;
    private String idNumber;

    public String getCardId() {
        return cardId;
    }

    public void setCardId(String cardId) {
        this.cardId = cardId;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getStudentNo() {
        return studentNo;
    }

    public void setStudentNo(String studentNo) {
        this.studentNo = studentNo;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getGradeId() {
        return gradeId;
    }

    public void setGradeId(int gradeId) {
        this.gradeId = gradeId;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getClassId() {
        return classId;
    }

    public void setClassId(String classId) {
        this.classId = classId;
    }

    public String getElectiveInformation() {
        return electiveInformation;
    }

    public void setElectiveInformation(String electiveInformation) {
        this.electiveInformation = electiveInformation;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = <PASSWORD>;
    }

    public String getCollegeName() {
        return collegeName;
    }

    public void setCollegeName(String collegeName) {
        this.collegeName = collegeName;
    }

    public String getNationId() {
        return nationId;
    }

    public void setNationId(String nationId) {
        this.nationId = nationId;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getStuSource() {
        return stuSource;
    }

    public void setStuSource(String stuSource) {
        this.stuSource = stuSource;
    }

    public String getHomeAddress() {
        return homeAddress;
    }

    public void setHomeAddress(String homeAddress) {
        this.homeAddress = homeAddress;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getLoginSta() {
        return loginSta;
    }

    public void setLoginSta(String loginSta) {
        this.loginSta = loginSta;
    }

    public int getReelect() {
        return reelect;
    }

    public void setReelect(int reelect) {
        this.reelect = reelect;
    }

    public String getIdNumber() {
        return idNumber;
    }

    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }
}
