app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java
@@ -40,6 +40,7 @@
import com.google.gson.Gson;
import org.jetbrains.annotations.NotNull;
import org.json.JSONException;
import org.json.JSONObject;
@@ -632,73 +633,55 @@
                            }else if (res == SelectDialogThree.THIRD){
                                sendJK0202(4);
                            }else{
                                Toast.makeText(_mActivity, "线路采集", Toast.LENGTH_SHORT).show();
                                ExamPlatformData.getInstance().setTrainingMode(ExamPlatformData.TRAINING_MODE);
                                exam_type = 5;
                                examStatusViewModel.updateStartExam(exam_type);
                                items.setVisibility(View.GONE);
                                items_score.setVisibility(View.GONE);
                                route_collect.setVisibility(View.VISIBLE);
                                MyInputDialog myDialog = MyInputDialog.Companion.newInstance("您将退出系统,请确认数据已保存");
                                myDialog.show(getFragmentManager(),"MyInputDialog");
                                myDialog.setOnClick(new MyInputDialog.MyOnClickListener() {
                                    @Override
                                    public void onSure(@NotNull String string) {
                                        //输入线路名称之后 点击确定才能认为是开始采集
                                        boolean flag = false;//标记是否有重名的线路,如果有则为true
                                        for (RouteBean bean:mRouteBeans){
                                            if (string.equalsIgnoreCase(bean.getRouteName())){
                                                //有重名的线路,提示用户并不开启线路采集
                                                Toast.makeText(_mActivity, "该线路名称已被使用,请更换", Toast.LENGTH_SHORT).show();
                                                flag = true;
                                                break;
                                            }
                                        }
                                        if (!flag){
                                            RouteBean routeBean = new RouteBean();
                                            routeBean.setRouteName(string);
                                            routeLineViewModel.insertRouteBean(routeBean);
                                            Toast.makeText(_mActivity, "线路采集", Toast.LENGTH_SHORT).show();
                                            ExamPlatformData.getInstance().setTrainingMode(ExamPlatformData.TRAINING_MODE);
                                            exam_type = 5;
                                            examStatusViewModel.updateStartExam(exam_type);
                                            items.setVisibility(View.GONE);
                                            items_score.setVisibility(View.GONE);
                                            route_collect.setVisibility(View.VISIBLE);
                                        }
                                    }
                                    @Override
                                    public void onCancle() {
                                    }
                                });
                            }
                        }
                    });
                    selectDialog.show(getFragmentManager(),"selectdialog");
                }else{
                    if (exam_type == ROUTE_COLLECT){
                        List<RouteCollect.CrossingActiveBean> crossingActiveBeans = new ArrayList<>();
                        List<RouteCollect.TriggerLineBean> triggerLineBeans = new ArrayList<>();
                        List<Double> xy = new ArrayList<>();
                        RemoteRouteCollect remoteRouteCollect = new RemoteRouteCollect();
                        RouteCollect routeCollect = new RouteCollect();
                        List<RouteCollect> routeCollects = new ArrayList<>();
                        Toast.makeText(_mActivity, "结束采集", Toast.LENGTH_SHORT).show();
                        CThreadPoolExecutor.runInBackground(new Runnable() {
                            @Override
                            public void run() {
                                for (RouteBean routeBean:mRouteBeans){
                                    int id = routeBean.getId();
                                    routeCollect.setName(routeBean.getRouteName());
                                    List<RouteTriggerLine> routeTriggerLines = WorkRoomDataBase.getWorkRoomDataBase(getContext().getApplicationContext()).getRouteTriggerLineDao().getAllRouteTriggerLine(id);
                                    List<RouteCross> routeCrosses = WorkRoomDataBase.getWorkRoomDataBase(getContext().getApplicationContext()).getRouteCrooDao().getAllRouteCross(id);
                                    for (RouteTriggerLine line:routeTriggerLines){
                                        RouteCollect.TriggerLineBean triggerLineBean = new RouteCollect.TriggerLineBean();
                                        int road = line.getRoad();
                                        int type = line.getType();
                                        double x = line.getX();
                                        double y = line.getY();
                                        xy.clear();
                                        xy.add(x);
                                        xy.add(y);
                                        triggerLineBean.setRoad(road);
                                        triggerLineBean.setType(type);
                                        triggerLineBean.setX_y(xy);
                                        triggerLineBeans.add(triggerLineBean);
                                    }
                                    routeCollect.setTrigger_line(triggerLineBeans);
                                    for (RouteCross routeCross:routeCrosses){
                                        int idx = routeCross.getIdx();
                                        int road = routeCross.getRoad();
                                        int active = routeCross.getActive();
                                        RouteCollect.CrossingActiveBean crossingActiveBean = new RouteCollect.CrossingActiveBean();
                                        crossingActiveBean.setActive(active);
                                        crossingActiveBean.setIdx(idx);
                                        crossingActiveBean.setRoad(road);
                                        crossingActiveBeans.add(crossingActiveBean);
                                    }
                                    routeCollect.setCrossing_active(crossingActiveBeans);
                                    routeCollects.add(routeCollect);
                                }
                                remoteRouteCollect.setScheme(routeCollects);
                                String str = new Gson().toJson(remoteRouteCollect);
                                Log.i(TAG,"json====="+str);
                            }
                        });
                        ExamPlatformData.getInstance().setTrainingMode(ExamPlatformData.MODE_NONE);
                        exam_type = 0;
                        examStatusViewModel.updateStartExam(exam_type);
@@ -723,11 +706,7 @@
//                startArcGisMapFragment(url);
//                StatusDialog.with(_mActivity).setCancelable(true).setPrompt("加载中,请稍后...").setType(StatusDialog.Type.PROGRESS).show();
                SelectMutliDialog myDialog = SelectMutliDialog.newInstance("您将退出系统,请确认数据已保存");
                myDialog.show(getFragmentManager(),"mydialog");
                break;
            case R.id.iv_head:
                MyLog.i(TAG,"学员签到");
@@ -799,18 +778,27 @@
    }
    private void sendJK0202(int type) {
        if (type==3|| type==4){
            sendRouteLine();
        }
        //隐藏采集项目
        items_score.setVisibility(View.VISIBLE);
        items.setVisibility(View.VISIBLE);
    route_collect.setVisibility(View.GONE);
        final JKMessage0202 jkMessage0202 = new JKMessage0202();
        exam_type = type;
        ExamPlatformData.getInstance().setTrainingMode(ExamPlatformData.TRAINING_MODE);
        ExamPlatformData.getInstance().setExamType(exam_type);
        examStatusViewModel.updateStartExam(exam_type);
        sendExamJson(1,exam_type);
        ExamPlatformData.getInstance().getTTS().speak("开始训练");
    }
    private void sendMessage() {
        sendExamJson(1,exam_type);
        final JKMessage0202 jkMessage0202 = new JKMessage0202();
        Date date = new Date();
        wokViewModel.updateBeginTime(date.getTime());
        jkMessage0202.timeBCD = date;
@@ -818,7 +806,7 @@
        jkMessage0202.stu_id = ExamPlatformData.getInstance().getID();
        jkMessage0202.coach_id = ExamPlatformData.getInstance().getCoachID();
        jkMessage0202.exam_id = ExamPlatformData.getInstance().getExam_id();
        if (type > ExamPlatformData.EXAM_TYPE_ChangKAO){
        if (exam_type > ExamPlatformData.EXAM_TYPE_ChangKAO){
            jkMessage0202.curr_exam = 1;//  跟移动站服务定义的场考是2  ,平台是0 ;  移动站路考是3 ,平台是1
        }else{
@@ -829,6 +817,71 @@
        MessageProcessor.getInstance().sendMessage(jkMessage0202);
    }
    private void sendRouteLine() {
        SelectMutliDialog selectMutliDialog = SelectMutliDialog.newInstance(mRouteBeans);
        selectMutliDialog.show(getFragmentManager(),"multidialog");
        selectMutliDialog.setSelectedListener(new SelectMutliDialog.OnSelectedListener() {
            @Override
            public void makeYourChoice(int res) {
                List<RouteCollect.CrossingActiveBean> crossingActiveBeans = new ArrayList<>();
                List<RouteCollect.TriggerLineBean> triggerLineBeans = new ArrayList<>();
                List<Double> xy = new ArrayList<>();
                RemoteRouteCollect remoteRouteCollect = new RemoteRouteCollect();
                RouteCollect routeCollect = new RouteCollect();
                List<RouteCollect> routeCollects = new ArrayList<>();
                int id = res;
                CThreadPoolExecutor.runInBackground(new Runnable() {
                    @Override
                    public void run() {
                            routeCollect.setName(mRouteBeans.get(id).getRouteName());
                            List<RouteTriggerLine> routeTriggerLines = WorkRoomDataBase.getWorkRoomDataBase(getContext().getApplicationContext()).getRouteTriggerLineDao().getAllRouteTriggerLine(id);
                            List<RouteCross> routeCrosses = WorkRoomDataBase.getWorkRoomDataBase(getContext().getApplicationContext()).getRouteCrooDao().getAllRouteCross(id);
                            for (RouteTriggerLine line:routeTriggerLines){
                                RouteCollect.TriggerLineBean triggerLineBean = new RouteCollect.TriggerLineBean();
                                int road = line.getRoad();
                                int type = line.getType();
                                double x = line.getX();
                                double y = line.getY();
                                xy.clear();
                                xy.add(x);
                                xy.add(y);
                                triggerLineBean.setRoad(road);
                                triggerLineBean.setType(type);
                                triggerLineBean.setX_y(xy);
                                triggerLineBeans.add(triggerLineBean);
                            }
                            routeCollect.setTrigger_line(triggerLineBeans);
                            for (RouteCross routeCross:routeCrosses){
                                int idx = routeCross.getIdx();
                                int road = routeCross.getRoad();
                                int active = routeCross.getActive();
                                RouteCollect.CrossingActiveBean crossingActiveBean = new RouteCollect.CrossingActiveBean();
                                crossingActiveBean.setActive(active);
                                crossingActiveBean.setIdx(idx);
                                crossingActiveBean.setRoad(road);
                                crossingActiveBeans.add(crossingActiveBean);
                            }
                            routeCollect.setCrossing_active(crossingActiveBeans);
                            routeCollects.add(routeCollect);
                        remoteRouteCollect.setScheme(routeCollects);
                        String str = new Gson().toJson(remoteRouteCollect);
                        Log.i(TAG,"json====="+str);
                        //todo 发送线路
                        sendMessage();
                    }
                });
            }
        });
    }
    private void sendExamJson(int i,int type) {
        try {