package com.tofly.ghrq_route.base.url;

import com.tofly.ghrq_route.base.BaseApp;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by Amu on 2017/2/9.
 */
public class NetRequestURL {
    public final static String SERVER_ADDR = "http://192.168.2.20:10088";
    public final static String SERVER_ADDR_EXTERNAL = "http://218.200.166.203:10088"/*"http://221.182.8.141:10088"*/;
    public static String HTTPHEAD = SERVER_ADDR_EXTERNAL;
    public static String HTTP_MAP = SERVER_ADDR_EXTERNAL;

    private static final boolean isExternalAddr = true;

    public static String getServerAddr() {
        return HTTPHEAD;
    }

    /*新的接口API*/
    public static final class newApi {
        public static final String checkVersion = "Api/AppVersion/List1";
        public static final String downloadList = "base/source/list";  //离线地图列表
        public static final String downloadList1 = "base/file/getFileList";  //离线地图更新列表
        public static final String downloadMap = "base/file/downloadFile";//下载离线文件
        public static final String mapConfig = "api/app/config";
        public static final String mapLayerIndexConfig = "api/app/fieldconfigall";
        public static final String updateAccount = "api/Account/UpdateAccount";
        public static final String updateAvatar = "api/Account/UpAvatar";
        public static final String updatePassword = "api/Account/UpdatePassword";
        public static final String userLogout = "api/Account/Logout";
        public static final String registerAccount = "api/Device/M_Add";
        public static final String registerDeviceInfo = "api/Device/M_Info";
        public static final String companyList = "api/Device/Get_Company_List";
        public static final String companyUserList = "api/Device/M_UserList";
        public static final String carList = "api/Account/CarList";
        public static final String userBindCar = "api/Account/BindCar";
        public static final String userUnbindCar = "api/Account/UnBind";
        public static final String userInfo = "api/User/Info/";
        public static final String userMList = "api/User/M_List";
        public static final String userList = "api/User/List";
        public static final String sysMsgUserList = "/base/user/getUserByDepts";//获取用户列表
        public static final String buildTypeList = "/gis/constructiontype/page";//获取工地用户类型列表
        public static final String equipmentList = "api/Equipment/List";
        public static final String pointTypeList = "api/PlanPointType/List";
        public static final String sysDeviceTypeList = "api/SysDeviceType/List";
        public static final String equipmentInfo = "api/Equipment/Info/";
        public static final String troubleTypeList = "api/TroubleType/List";
        public static final String troubleTypeInfo = "api/TroubleType/Info/";
        public static final String addTrouble = "api/Trouble/Add";
        public static final String addTroublePicture = "api/Trouble/Handle_Picture";
        public static final String confirmTroubleClear = "api/Trouble/Confirm_Handle_Trouble";
        public static final String uploadTroubleNotes = "api/Plan/Trouble_Upload_Notes";
        public static final String addTroubleRecord = "api/PlanTroubleRecord/Add";
        public static final String troubleRecordList = "api/PlanTroubleRecord/List";
        public static final String removeTroubleRecord = "api/PlanTroubleRecord/Delete/";
        public static final String addTroubleClearRecord = "api/Trouble/Handle_Clear_Picture";
        public static final String troubleRecordClear = "api/Trouble/Get_Trouble_Clear";
        public static final String troubleList = "api/Trouble/List";
        public static final String troubleInfo = "api/Trouble/Info/";
        public static final String addUploadFile = "api/File/UpFiles";
        public static final String uploadFileList = "api/File/Files";
        public static final String deleteUploadFile = "api/File/Delete/";
        public static final String signState = "api/Sign/State";
        public static final String signLastState = "api/Sign/Get_Lastest_State";
        public static final String signList = "api/Sign/List";
        public static final String signAdd = "api/Sign/Add";
        public static final String dailyAttended = "api/Plan/Group_Daily_Plan_Attended";
        private static final String gpsAdd = "api/Gps/Add";
        private static final String gpsAddBatch = "api/Gps/Add_Batch";
        public static final String planList = "api/Plan/List";
        public static final String planList1 = "api/Plan/List1";
        public static final String planInfo = "api/Plan/info/";
        public static final String planNum = "api/Plan/Get_Plan_Num";
        public static final String planPointNum = "api/Plan/Get_Plan_Num1";
        public static final String transferPlanApply = "api/Plan/Transfer_Plan_Apply";
        public static final String planPointList = "api/Plan/Plan_List_Point/";
        public static final String childPlanList = "api/Plan/Child_Plan_List";
        public static final String childPlanPointList = "/api/Plan/Child_Plan_List_Point/";
        public static final String childPlanInfo = "api/Plan/Child/";
        public static final String offlinePlanList = "api/Plan/Get_Plan_Point";
        public static final String offlinePlanList1 = "api/Plan/Get_Plan_Point1"; //下载出错后使用此接口
        public static final String updatePointOver = "api/Plan/Update_Point_Isover";
        public static final String updatePathOver = "api/Plan/Update_Path_Isover";
        public static final String updatePathOfftime = "api/Plan/UpdatePath";
        public static final String addUploadPhotoInfo = "api/UploadPhoto/Add";
        public static final String addUploadPhotoPhoto = "api/UploadPhoto/Upload_Photo";
        public static final String addDeviceInfo = "api/DeviceUpload/Add";
        public static final String addBatchDeviceInfo = "api/DeviceUpload/Add_Batch";
        public static final String recvMessageList = "/gis/message/reveipt";//接收后台消息
        public static final String sendMessageList = "/gis/message/sent";//接收已发送的消息
        public static final String markMessageReaded = "/gis/message/readByIds";//批量已读消息
        public static final String deleteSendMessage = "/gis/message/deleteByIds";
        public static final String deleteRecvMessage = "/gis/message/deleteByIds";//删除消息
        public static final String sendMessage = "/gis/message";//新建发送消息
        public static final String buildManageList = "/gis/constructionsite/page";
        public static final String addBuildManage = "api/BuildManage/Add";
        public static final String addBuildManage1 = "/gis/constructionsite";//新建工地工单
        public static final String buildProjectTypeList = "api/BuildProjectType/List";
        public static final String buildReportList = "api/BuildReport/List";
        public static final String addBuildReport = "api/BuildReport/Add";
        public static final String deleteBuildReport = "api/BuildReport/Delete/";
        public static final String buildHandleList = "api/BuildHandle/List";
        public static final String addBuildHandle = "api/BuildHandle/Submit";
        public static final String deleteBuildHandle = "api/BuildHandle/Delete/";
        public static final String updateBuildLog = "api/BuildLog/Update";
        public static final String buildLogList = "api/BuildLog/Info";
        public static final String addPlanPointRepair = "api/PlanPointRepair/Add";
        public static final String planPointRepairList = "api/PlanPointRepair/List";
        public static final String deletePlanPointRepair = "api/PlanPointRepair/Delete/";
        public static final String updatePlanPointRepair = "api/PlanPointRepair/Update";
        public static final String planPointChildRepairInfo = "api/Plan/Get_Point_Info";
        public static final String addPlanPointChildRepair = "api/PlanPointChildRepair/Add";
        public static final String addAdjustDeviceChildRepair = "api/AdjustablePressure/Add";
        public static final String addValveDeviceChildRepair = "api/Valve/Add";
        public static final String planPointChildRepairList = "api/PlanPointChildRepair/List";
        public static final String adjustDeviceChildRepairList = "api/AdjustablePressure/List";
        public static final String valveDeviceChildRepairList = "api/Valve/List";
        public static final String deletePlanChildPointRepair = "api/PlanPointChildRepair/Delete/";
        public static final String repairSysDeviceSettingList = "api/SysDeviceSetting/List";
        public static final String repairNFCInfo = "api/Nfc/info";
        public static final String sysConfigList = "api/SysConfig/List";
        public static final String sysSetting = "/gis/tfsyssetting/getSysSetting";//配置数据
        public static final String addPlanPointLog = "api/Log/M_Add";
        public static final String applyRecalculatePlan = "api/Gps/Recalculate_Apply";
        public static final String getRecalculatePoints = "api/PlanApply/Info/";
        public static final String updateRecalculateState = "api/PlanApply/Update/";
        public static final String queryMsgDetail = "/gis/message/";
        public static final String upLoadRepair = "/gis/rushrepair";//新建抢维修工单录入
    }

    public static final class newApi_2_0_3 {
        /*隐患上传*/
        public static final String addTroubleNew = "api/Trouble/AddBatch";

        public static String getTroubleAddNewUrl() {
            return getHttpHead() + newApi_2_0_3.addTroubleNew;
        }

        /*照片上传*/
        public static final String addUploadPhotoNew = "api/UploadPhoto/AddBatch";

        public static String getUploadPhotoAddNewUrl() {
            return getHttpHead() + newApi_2_0_3.addUploadPhotoNew;
        }
    }

    public static final class newApi_dyrq {
        public class Const {
            static final String PLATFORM_DIC_VALUE = "ms";  //子系统编码字典值 - 移动端
            static final String HEADER_TOKEN_KEY = "Authorization";
            static final String HEADER_BEARER_KEY = "bearer";
            static final String FIELD_CODE_KEYS = "气源点,场站,调压设备,穿越点,阀门,阴极保护,SCADA监测点,节点,套管,标志桩,高压管线,次高压管线,中压管线,低压管线,预埋管线";
            public static final String ALL_LAYER_IDS = "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15";
        }

        public static String getFormattedToken(String token) {
            return Const.HEADER_BEARER_KEY + " " + token;
        }

        static String getFormattedToken() {
            return Const.HEADER_BEARER_KEY + " " + BaseApp.getInstance().getToken();
        }

        public static Map<String, String> getHeaderParams() {
            Map<String, String> params = new HashMap<>();
            params.put(Const.HEADER_TOKEN_KEY, getFormattedToken());
            return params;
        }

        public static String getFormattedPicture(String filepath) {
            return getHttpHead() + "/base/file/loadImg?remotePath="
                    + filepath + "&access_token=" + BaseApp.getInstance().getToken();
        }

        public static String getFormattedAudio(String filepath) {
            return getHttpHead() + "/base/file/loadAudio?remotePath="
                    + filepath + "&access_token=" + BaseApp.getInstance().getToken();
        }

        public static String getFormattedDownFile(String filepath, String fileName) {
            String utf8_name = fileName;
            try {
                utf8_name = URLEncoder.encode(fileName, "UTF-8");
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
            return getHttpHead() + "/base/file/downloadFile?remotePath="
                    + filepath + "&fileName=" + utf8_name + "&access_token=" + BaseApp.getInstance().getToken();
        }

        /*用户登录*/
        private static final String userLogin = "/auth/oauth/token?project=8000";
        public static String getLoginUrl() {
            return getHttpHead() + userLogin;
        }

        /*获取用户信息*/
        private static final String accountInfo = "/base/user/getInfo";

        public static String getAccountInfoUrl() {
            return getHttpHead() + accountInfo + "?platform=" + Const.PLATFORM_DIC_VALUE;
        }

        /*修改用户信息*/
        private static final String updateUser = "/base/user";

        public static String getUpdateUserUrl() {
            return getHttpHead() + updateUser;
        }

        /*获取用户移动端菜单信息*/
        private static final String userMenus = "/base/ms/getUserMenus";

        public static String getUserMenusUrl() {
            return getHttpHead() + userMenus;
        }

        /*设备绑定校验*/
        private static final String checkPdaBind = "/gis/pdadevice/checkPda";

        public static String getCheckPdaBindUrl() {
            return getHttpHead() + checkPdaBind + "?imei=" + BaseApp.getInstance().getDevieImei();
        }

        /*设备绑定*/
        private static final String pdaDeviceBind = "/gis/pdadevice/add";

        public static String getPdaDeviceBindUrl() {
            return getHttpHead() + pdaDeviceBind;
        }

        /*当前用户工单信息分页查询*/
        private static final String jobList = "/gis/TfPda/userPdaPage";

        public static String getJobListUrl() {
            return getHttpHead() + jobList;
        }

        /*当前用户抢维修工单信息分页查询*/
        private static final String jobsList = "/gis/rushrepair/page";

        public static String getJobsListUrl() {
            return getMapHttpHead() + jobsList;
        }

        /*提交工单反馈*/
        private static final String jobHandle = "/gis/TfPda/handle";

        public static String getJobHandleUrl() {
            return getHttpHead() + jobHandle;
        }

        /*获取工单详情*/
        private static final String jobData = "/gis/TfPda/";

        public static String getJobDataUrl() {
            return getHttpHead() + jobData;
        }

        /*获取未处理工单个数和id*/
        private static final String jobUnhandled = "/gis/TfPda/unfinished";

        public static String getJobUnhandledUrl() {
            return getHttpHead() + jobUnhandled;
        }

        /*当前用户提交的疑问标识信息分页查询*/
        private static final String sketchList = "/gis/questionmark/page";

        public static String getSketchListUrl() {
            return getHttpHead() + sketchList;
        }

        /*提交疑问标识*/
        private static final String sketchUpload = "/gis/questionmark/mobile";

        public static String getSketchUploadUrl() {
            return getHttpHead() + sketchUpload;
        }

        /*获取疑问标识详情*/
        private static final String sketchData = "/gis/questionmark/";

        public static String getSketchDataUrl() {
            return getHttpHead() + sketchData;
        }

        /*获取资源列表 (在线地图)*/
        private static final String onlineMapData = "/base/user/sourceList";

        public static String getOnlineMapDataUrl() {
            return getHttpHead() + onlineMapData;
        }

        /*获取管网查询图层属性名称列表 */
        private static final String fieldConfig = "/base/code/getByKeys";

        public static String getFieldConfigUrl() {
            String keys = Const.FIELD_CODE_KEYS;
            try {
                keys = URLEncoder.encode(Const.FIELD_CODE_KEYS, "UTF-8");
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
            return getHttpHead() + fieldConfig + "?keys=" + keys;
        }

        /*系统配置参数*/
        private static final String sysConfigList = "/gis/sysconfig/page";

        public static String getSysConfigListUrl() {
            return getHttpHead() + sysConfigList;
        }

        /*照片上传*/
        public static final String uploadPhoto = "/gis/uploadphoto";
        public static String getUploadPhotoUrl() {
            return getHttpHead() + uploadPhoto;
        }

        /*照片上历史列表*/
        public static final String reportedPhoto = "/gis/uploadphoto/page";
        public static String getReportedPhotoUrl() {
            return getHttpHead() + reportedPhoto;
        }

        /*登陆后上传坐标信息 --实时监控模块用*/
        private static final String gpsAdd = "/gps/esGps";

        public static String getGpsAddUrl() {
            return getHttpHead() + gpsAdd;
        }

        private static final String gpsAddBatch = "/gps/esGps/saveBatch";

        public static String getGpsAddBatchUrl() {
            return getHttpHead() + gpsAddBatch;
        }

        /*更新坐标信息 --移动监控模块用*/
        private static final String updatgeGpsStatus = "/gis/tfgpsstatus";

        public static String getUpdateGpsStatusUrl() {
            return getHttpHead() + updatgeGpsStatus;
        }

        /*获取最新的签到状态*/
        private static final String lastSignStatus = "/gis/tfpdasign/getLastestState";

        public static String getLastSignStatusUrl() {
            return getHttpHead() + lastSignStatus;
        }

        /*获取签到记录*/
        private static final String signList = "/gis/tfpdasign/page";

        public static String getSignListUrl() {
            return getHttpHead() + signList;
        }

        /*签到上传*/
        private static final String signAdd = "/gis/tfpdasign";

        public static String getSignAddUrl() {
            return getHttpHead() + signAdd;
        }

        /*实时监控状态*/
        private static final String deviceUploadList = "/gps/rtinfo/userRTInfoPage";
        public static String getDeviceUploadListUrl() {
            return getHttpHead() + deviceUploadList;
        }

        /*车辆实时监控状态*/
        private static final String carUploadList = "/giscar/car/listCarWatch";
        public static String getCarUploadListUrl() {
            return getHttpHead() + carUploadList;
        }

        /*计划列表*/
        private static final String planList = "/gis/planchild/page";

        public static String getPlanListUrl() {
            return getHttpHead() + planList;
        }

        /*计划列表 不包含point_info*/
        private static final String planListMobile = "/gis/planchild/pageByMoblie";

        public static String getPlanLisMobiletUrl() {
            return getHttpHead() + planListMobile;
        }

        private static final String planInfo = "/gis/planchild/geoInfo/";
        public static String getPlanInfoUrl() {
            return getHttpHead() + planInfo;
        }

        /*计划申请转移*/
        private static final String transferPlanApply = "/gis/plan/transfer";

        public static String getTransferPlanApplyUrl() {
            return getHttpHead() + transferPlanApply;
        }


        /*计划离线点数据下载*/
        private static final String offlinePointList = "/gis/planchild/getPlanPoint";
        public static String getOfflinePointListUrl() {
            return getHttpHead() + offlinePointList;
        }

        /*计划离线点数据下载*/
        private static final String offlinePointListByPage = "/gis/planchild/getPlanPointPage";
        public static String getOfflinePointListByPageUrl() {
            return getHttpHead() + offlinePointListByPage;
        }

        /*计划个数,每个计划需要完成的点个数查询*/
        private static final String planPointCount = "/gis/planchild/getPointNum";

        public static String getPlanPointCountUrl() {
            return getHttpHead() + planPointCount;
        }

        /*到位数据信息上传*/
        private static final String updatePointOver = "/gis/updatepointorpathisover";

        public static String getUpdatePointOverUrl() {
            return getHttpHead() + updatePointOver;
        }

        /*设备信息上传*/
        private static final String uploadDeviceInfo = "/gps/esPdaDevice";

        public static final String getUploadDeviceInfoUrl() {
            return getHttpHead() + uploadDeviceInfo;
        }

        /*调压设备录入参数列表*/
        private static final String adjustDeviceParamList = "/gis/maintenancemenu/page";

        public static String getAdjustDeviceParamListUrl() {
            return getHttpHead() + adjustDeviceParamList;
        }

        /*通用设备录入参数列表*/
        private static final String commonDeviceParamList = "/gis/maintenancedevicetype/page";

        public static String getCommonDeviceParamListUrl() {
            return getHttpHead() + commonDeviceParamList;
        }

        /*部门列表*/
        private static final String departmentList = "/base/department/list?"; //研发部门 id=3
        private static final String departmentFilterList = "/base/department/subList?id=3&"; //研发部门 id=3

        public static String getDepartmentListUrl(boolean filtered) {
            return getHttpHead() + (filtered ? departmentFilterList : departmentList);
        }

        /*部门用户列表*/
        private static final String departmentUserList = "/gis/pdadevice/userPdaPage/mobile" /*?sfbd=1*/;  //只筛选已经绑定的人员 sfbd=1

        public static String getDepartmentUserListUrl() {
            return getHttpHead() + departmentUserList;
        }

        /*通用设备录入数据提交*/
        private static final String commonDeviceMaintain = "/gis/maintenancedevice";

        public static String getCommonDeviceMaintainUrl() {
            return getHttpHead() + commonDeviceMaintain;
        }

        /*通用设备录入数据提交历史*/
        private static final String commonDeviceRepairList = "/gis/maintenancedevice/page";

        public static String getCommonDeviceRepairListUrl() {
            return getHttpHead() + commonDeviceRepairList;
        }

        /*调压设备录入数据提交*/
        private static final String adjustDeviceMaintain = "/gis/maintenance";

        public static String getAdjustDeviceMaintainUrl() {
            return getHttpHead() + adjustDeviceMaintain;
        }

        /*调压设备录入数据提交历史*/
        private static final String adjustDeviceRepairList = "/gis/maintenance/page";

        public static String getAdjustDeviceRepairListUrl() {
            return getHttpHead() + adjustDeviceRepairList;
        }

        /*巡检设备类型列表*/
        private static final String deviceTypeList = "/gis/xjtype/page";

        public static String getDeviceTypeListUrl() {
            return getHttpHead() + deviceTypeList;
        }

        /*设备巡检参数列表*/
        private static final String routeParamList = "/gis/xjmenu/page";

        public static String getRouteParamListUrl() {
            return getHttpHead() + routeParamList;
        }

        /*设备巡检录入数据提交*/
        private static final String deviceRouteCheck = "/gis/xj";

        public static String getDeviceRouteCheckUrl() {
            return getHttpHead() + deviceRouteCheck;
        }

        /*通用设备录入数据提交历史*/
        private static final String deviceRouteCheckList = "/gis/xj/page";

        public static String getDeviceRouteCheckListUrl() {
            return getHttpHead() + deviceRouteCheckList;
        }

        /*隐患类别列表*/
        private static final String troubleTypeList = "/gis/troubletype/page";

        public static String getTroubleTypeListUrl() {
            return getHttpHead() + troubleTypeList;
        }

        /*隐患风险等级列表*/
        private static final String troubleLevelList = "/gis/troublelevel/page";

        public static String getTroubleLevelListUrl() {
            return getHttpHead() + troubleLevelList;
        }

        /*管网类型列表*/
        private static final String pipeTypeList = "/gis/planpointtype/page";

        public static String getPipeTypeListUrl() {
            return getHttpHead() + pipeTypeList;
        }

        /*隐患上报*/
        private static final String uploadTrouble = "/gis/trouble";

        public static String getUploadTroubleUrl() {
            return getHttpHead() + uploadTrouble;
        }

        /*隐患列表*/
        private static final String troubleList = "/gis/trouble/listNew";
        public static String getTroubleListUrl() {
            return getHttpHead() + troubleList;
        }

        private static final String troubleInfo = "/gis/trouble/info/";

        public static String getTroubleInfoUrl() {
            return getHttpHead() + troubleInfo;
        }

        /*隐患时间级别列表*/
        private static final String troubleEventTypeList = "/gis/troubleenenttype/page";

        public static String getTroubleEventTypeListUrl() {
            return getHttpHead() + troubleEventTypeList;
        }

        /*隐患上报*/
        private static final String updatePipeDevice = "/gis/trouble/updatePipeDevice";

        public static String getUpdatePipeDeviceUrl() {
            return getHttpHead() + updatePipeDevice;
        }

        /*值班人员现场勘察*/
        private static final String ondutyUserCheck = "/gis/trouble/ondutyUserCheck";

        public static String getOndutyUserCheckUrl() {
            return getHttpHead() + ondutyUserCheck;
        }

        /*承办班班长审核派工*/
        private static final String undertakerCheck = "/gis/trouble/undertakerCheck";

        public static String getUndertakerCheckUrl() {
            return getHttpHead() + undertakerCheck;
        }

        /*巡检人员现场核实*/
        private static final String undertakerHandle = "/gis/trouble/undertakerHandle";

        public static String getUndertakerHandleUrl() {
            return getHttpHead() + undertakerHandle;
        }

        /*班组长审核派工*/
        private static final String underSectaryCheck = "/gis/trouble/undersecretaryCheck";

        public static String getUnderSectaryCheckUrl() {
            return getHttpHead() + underSectaryCheck;
        }

        /*责任班班长编制方案*/
        private static final String ondutyMakeScheme = "/gis/trouble/designSchema";

        public static String getOndutyMakeSchemeUrl() {
            return getHttpHead() + ondutyMakeScheme;
        }

        /*部长审核方案*/
        private static final String sectaryCheck = "/gis/trouble/secretaryCheck";

        public static String getSectaryCheckUrl() {
            return getHttpHead() + sectaryCheck;
        }

        /*工单负责人处理回报*/
        private static final String ondutyHandleScheme = "/gis/trouble/handleSchema";

        public static String getOndutyHandleSchemeUrl() {
            return getHttpHead() + ondutyHandleScheme;
        }

        /*副部长审核处理回报*/
        private static final String undersectaryHandleCheck = "/gis/trouble/handleCheck";

        public static String getUndersectaryHandleCheckUrl() {
            return getHttpHead() + undersectaryHandleCheck;
        }

        /*上传本地日志文件到服务器*/
        private static final String uploadLocalLog = "/gis/mslog";

        public static String getUploadLocalLogUrl() {
            return getHttpHead() + uploadLocalLog;
        }

        /*App版本升级检测*/
        private static final String checkVersion = "/gis/appversion/new";

        public static String getCheckVersionUrl() {
            return getHttpHead() + checkVersion;
        }

        /*获取App版本信息*/
        private static final String versionInfo = "/gis/appversion/getAppInfo";

        public static String getVersionInfoUrl() {
            return getHttpHead() + versionInfo;
        }

        /*获取系统配置参数：人巡速度，上传频率*/
        private static final String sysSetting = "/gis/tfsyssetting/getSysSetting";

        public static String getSysSettingUrl() {
            return getHttpHead() + sysSetting;
        }

        /*移动端查询月签到信息*/
        private static final String dailyAttended = "/gis/tfpdasign/getMonthSign";

        public static String getDailyAttendedUrl() {
            return getHttpHead() + dailyAttended;
        }

        /*通过设备ID查询图层信息*/
        private static final String qrcodeGetLayer = "/gis/qrcode/getLayer";

        public static String getQrcodeLayerUrl() {
            return getHttpHead() + qrcodeGetLayer;
        }

        /*隐患列表*/
        private static final String restrictFile = "/gis/appfile/new";

        public static String getRestrictFileUrl() {
            return getHttpHead() + restrictFile;
        }

        /*应急调度列表*/
        private static final String emergencyList = "/gis/scheduler/page";

        public static String getEmergencyList() {
            return getHttpHead() + emergencyList;
        }

        /*应急调度上报*/
        private static final String emergencyUpload = "/gis/scheduler/save";

        public static String getEmergencyUploadUrl() {
            return getHttpHead() + emergencyUpload;
        }

        /*应急调度派工处理*/
        private static final String emergencyOverSign = "/gis/scheduler/signScheduler";

        public static String getEmergencyOverSignUrl() {
            return getHttpHead() + emergencyOverSign;
        }

        /*应急调度派工处理*/
        private static final String emergencyAssignHandle = "/gis/scheduler/dispatch";

        public static String getEmergencyAssignHandleUrl() {
            return getHttpHead() + emergencyAssignHandle;
        }

        /*调度中心抢修派工*/
        private static final String emergencyScheduleAssign = "/gis/scheduler/dispose";

        public static String getEmergencyScheduleAssignUrl() {
            return getHttpHead() + emergencyScheduleAssign;
        }

        /*责任人抢修派工*/
        private static final String emergencyRepairAssign = "/gis/scheduler/check";

        public static String getEmergencyRepairAssignUrl() {
            return getHttpHead() + emergencyRepairAssign;
        }

        /*应急调度抢修处理*/
        private static final String emergencyRepairHandle = "/gis/scheduler/handle";

        public static String getEmergencyRepairHandleUrl() {
            return getHttpHead() + emergencyRepairHandle;
        }

        /*数据采集信息批量上传*/
        private static final String dasDataBatchUpload = "/gps/appdatacollection/savaBach";

        public static String getDasDataBatchUploadUrl() {
            return getHttpHead() + dasDataBatchUpload;
        }

        /*测绘记录列表*/
        private static final String surveyList = "/gis/surver/page";

        public static String getSurveyListUrl() {
            return getHttpHead() + surveyList;
        }

        /*测绘前记录申请上报*/
        private static final String surveyBeforeUpload = "/gis/surver";

        public static String getSurveyBeforeUploadUrl() {
            return getHttpHead() + surveyBeforeUpload;
        }

        /*获取用户gisToken*/
        private static final String userGisToken = "/base/user/gisToken";

        public static String getUserGisTokenUrl() {
            return getHttpHead() + userGisToken;
        }

    }

    public static String getHttpHead() {
        return getServerAddr();
    }

    public static String getMapWebtestHttpHead() {
        return getServerAddr();
    }

    public static String getCheckVersionUrl() {
        return getMapHttpHead() + newApi.checkVersion;
    }

    public static String getMapHttpHead() {
        /*String httpHead = getHttpHead();
        String newHttpHead = null;
        try {
            if (httpHead.contains("kfxjapi")){
                newHttpHead = getMapWebtestHttpHead() + MAP_WEBTEST_KF;
            }else if (httpHead.contains("xjapi")){
                if (httpHead.contains(DEFAULT_HTTPPORT_TEST)){
                    newHttpHead = getMapWebtestHttpHead() + MAP_WEBTEST;
                }else {
                    newHttpHead = getMapWebtestHttpHead() + MAP_WEBTEST_FINAL;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            newHttpHead = httpHead;
        }
        return newHttpHead;*/
        return getMapWebtestHttpHead();
    }


    public static final String MAP_WEBTEST_KF = "/webapitestkf/";
    public static final String MAP_WEBTEST = "/webapitest/";
    public static final String MAP_WEBTEST_FINAL = "/api/";

    // TODO: 2017/6/20 修改 最终 url
    public static String getDownloadList() {
        String newHttpHead = getMapHttpHead();
        return newHttpHead + newApi.downloadList;
    }

    public static String getDownloadList1() {
        String newHttpHead = getMapHttpHead();
        return newHttpHead + newApi.downloadList1;
    }

    // TODO: 2017/6/20 to update url
    public static String getDownloadMapUrl() {
        String newHttpHead = getMapHttpHead();
        return newHttpHead + newApi.downloadMap;
    }

    public static String getMapConfigUrl() {
        String newHttpHead = getMapHttpHead();
        return newHttpHead + newApi.mapConfig;
    }

    public static String getMapLayerIndexConfigUrl() {
        String newHttpHead = getMapHttpHead();
        return newHttpHead + newApi.mapLayerIndexConfig;
    }

    public static String getMapQueryUrlHead() {
        String newHttpHead = getMapHttpHead();
        return newHttpHead.substring(0, newHttpHead.length() - 1);
    }

    public static String getAccountUpdateUrl() {
        return getHttpHead() + newApi.updateAccount;
    }

    public static String getUserAvatarUpdateUrl() {
        return getHttpHead() + newApi.updateAvatar;
    }

    public static String getPasswordUpdateUrl() {
        return getHttpHead() + newApi.updatePassword;
    }

    public static String getLogoutUrl() {
        return getHttpHead() + newApi.userLogout;
    }

    public static String getRegisterAccountUrl() {
        return getHttpHead() + newApi.registerAccount;
    }

    public static String getRegisterDeviceInfoUrl() {
        return getHttpHead() + newApi.registerDeviceInfo;
    }

    public static String getCompanyListUrl() {
        return getHttpHead() + newApi.companyList;
    }

    public static String getCompanyUserListUrl() {
        return getHttpHead() + newApi.companyUserList;
    }

    public static String getCarListUrl() {
        return getHttpHead() + newApi.carList;
    }

    public static String getUserBindCarUrl() {
        return getHttpHead() + newApi.userBindCar;
    }

    public static String getUserUnbindCarUrl() {
        return getHttpHead() + newApi.userUnbindCar;
    }

    public static String getUserInfoUrl() {
        return getHttpHead() + newApi.userInfo;
    }

    public static String getUserMListUrl() {
        return getHttpHead() + newApi.userMList;
    }

    public static String getUserListUrl() {
        return getHttpHead() + newApi.userList;
    }

    public static String getSysMsgUserList() {
        return getMapHttpHead() + newApi.sysMsgUserList;
    }

    public static String getTroubletypeEquipmentListUrl() {
        return getHttpHead() + newApi.equipmentList;
    }

    public static String getPlanPointTypeListUrl() {
        return getHttpHead() + newApi.pointTypeList;
    }

    public static String getSysDeviceTypeListUrl() {
        return getMapHttpHead() + newApi.sysDeviceTypeList;
    }

    public static String getTroubletypeEquipmentInfoUrl() {
        return getHttpHead() + newApi.equipmentInfo;
    }

    public static String getTroubletypeListUrl() {
        return getMapHttpHead() + newApi.troubleTypeList;
    }

    public static String getTroubletypeInfoUrl() {
        return getHttpHead() + newApi.troubleTypeInfo;
    }

    public static String getTroubleAddUrl() {
        return getHttpHead() + newApi.addTrouble;
    }

    public static String getTroublePictureAddUrl() {
        return getHttpHead() + newApi.addTroublePicture;
    }

    public static String getConfirmTroubleClearUrl() {
        return getHttpHead() + newApi.confirmTroubleClear;
    }

    public static String getUploadTroubleNotesUrl() {
        return getHttpHead() + newApi.uploadTroubleNotes;
    }

    public static String getAddTroubleRecordUrl() {
        return getHttpHead() + newApi.addTroubleRecord;
    }

    public static String getTroubleRecordListUrl() {
        return getHttpHead() + newApi.troubleRecordList;
    }

    public static String getRemoveTroubleRecordUrl() {
        return getHttpHead() + newApi.removeTroubleRecord;
    }

    public static String getAddTroubleClearRecordUrl() {
        return getHttpHead() + newApi.addTroubleClearRecord;
    }

    public static String getTroubleRecordClearUrl() {
        return getHttpHead() + newApi.troubleRecordClear;
    }

    public static String getBuildTypeListUrl() {
        return getMapHttpHead() + newApi.buildTypeList;
    }

    public static String getTroubleListUrl() {
        return getHttpHead() + newApi.troubleList;
    }

    public static String getTroubleInfoUrl() {
        return getHttpHead() + newApi.troubleInfo;
    }

    public static String getAddUploadFileUrl() {
        return getHttpHead() + newApi.addUploadFile;
    }

    public static String getDeleteUploadFileUrl() {
        return getHttpHead() + newApi.deleteUploadFile;
    }

    public static String getUploadFileListUrl() {
        return getHttpHead() + newApi.uploadFileList;
    }

    public static String getSignStateUrl() {
        return getHttpHead() + newApi.signState;
    }

    public static String getSignLastStateUrl() {
        return getHttpHead() + newApi.signLastState;
    }

    public static String getSignListUrl() {
        return getHttpHead() + newApi.signList;
    }

    public static String getSignAddUrl() {
        return getHttpHead() + newApi.signAdd;
    }

    public static String getDailyAttendedUrl() {
        return getHttpHead() + newApi.dailyAttended;
    }

    public static String getGpsAddUrl() {
        return getHttpHead() + newApi.gpsAdd;
    }

    public static String getGpsAddBatchUrl() {
        return getHttpHead() + newApi.gpsAddBatch;
    }

    public static String getPlanListUrl() {
        return getHttpHead() + newApi.planList;
    }

    public static String getPlanList1Url() {
        return getHttpHead() + newApi.planList1;
    }

    public static String getPlanInfoUrl() {
        return getHttpHead() + newApi.planInfo;
    }

    public static String getPlanNumUrl() {
        return getHttpHead() + newApi.planNum;
    }

    public static String getPlanPointNumUrl() {
        return getHttpHead() + newApi.planPointNum;
    }

    public static String getTransferPlanApplyUrl() {
        return getHttpHead() + newApi.transferPlanApply;
    }

    public static String getPlanPointListUrl() {
        return getHttpHead() + newApi.planPointList;
    }

    public static String getChildPlanListUrl() {
        return getHttpHead() + newApi.childPlanList;
    }

    public static String getChildPlanPointListUrl() {
        return getHttpHead() + newApi.childPlanPointList;
    }

    public static String getChildPlanInfoUrl() {
        return getHttpHead() + newApi.childPlanInfo;
    }

    public static boolean isGetPlanPointNeedLog = false;

    public static String getOfflinePlanListUrl() {
        if (isGetPlanPointNeedLog) {
            return getHttpHead() + newApi.offlinePlanList1;
        } else {
            return getHttpHead() + newApi.offlinePlanList;
        }
    }

    public static String getUpdatePointOverUrl() {
        return getHttpHead() + newApi.updatePointOver;
    }

    public static String getUpdatePathOverUrl() {
        return getHttpHead() + newApi.updatePathOver;
    }

    public static String getUpdatePathOfftimeUrl() {
        return getHttpHead() + newApi.updatePathOfftime;
    }

    public static String getUploadPhotoInfoUrl() {
        return getHttpHead() + newApi.addUploadPhotoInfo;
    }

    public static String getUploadPhotoPhotoUrl() {
        return getHttpHead() + newApi.addUploadPhotoPhoto;
    }

    public static String getUploadDeviceInfoUrl() {
        return getHttpHead() + newApi.addDeviceInfo;
    }

    public static String getUploadBatchDeviceInfoUrl() {
        return getHttpHead() + newApi.addBatchDeviceInfo;
    }

    public static String getRecvMessageListUrl() {
        return getMapHttpHead() + newApi.recvMessageList;
    }

    public static String getSendMessageListUrl() {
        return getMapHttpHead() + newApi.sendMessageList;
    }

    public static String getMarkReadMessageUrl() {
        return getMapHttpHead() + newApi.markMessageReaded;
    }

    public static String getDeleteRecvMessageUrl() {
        return getMapHttpHead() + newApi.deleteRecvMessage;
    }

    public static String getDeleteSendMessageUrl() {
        return getMapHttpHead() + newApi.deleteSendMessage;
    }

    public static String getSendMessageUrl() {
        return getMapHttpHead() + newApi.sendMessage;
    }

    public static String getMsgDetail() {
        return getMapHttpHead() + newApi.queryMsgDetail;
    }

    public static String getBuildManageListUrl() {
        return getMapHttpHead() + newApi.buildManageList;
    }

    public static String getAddBuildManageUrl() {
        return getHttpHead() + newApi.addBuildManage;
    }

    public static String getAddBuildManage1Url() {
        return getMapHttpHead() + newApi.addBuildManage1;
    }

    public static String getAddBuildProcessManageUrl() {
        return getMapHttpHead() + "/gis/constructionsite/processmanage";
    }

    public static String getRushRepairProcessManageUrl() {
        return getMapHttpHead() + "/gis/rushrepair/processmanage";
    }

    public static String getBuildProjectTypeListUrl() {
        return getMapHttpHead() + newApi.buildProjectTypeList;
    }

    public static String getBuildReportListUrl() {
        return getHttpHead() + newApi.buildReportList;
    }

    public static String getAddBuildReportUrl() {
        return getHttpHead() + newApi.addBuildReport;
    }

    public static String getDeleteBuildReportUrl() {
        return getHttpHead() + newApi.deleteBuildReport;
    }

    public static String getBuildHandleListUrl() {
        return getHttpHead() + newApi.buildHandleList;
    }

    public static String getAddBuildHandleUrl() {
        return getHttpHead() + newApi.addBuildHandle;
    }

    public static String getDeleteBuildHandleUrl() {
        return getHttpHead() + newApi.deleteBuildHandle;
    }

    public static String getUpdateBuildLogUrl() {
        return getMapHttpHead() + "/gis/constructionsite/updateapp";
    }

    public static String getRushDispatch() {
        return getMapHttpHead() + "/gis/rushrepair";
    }

    public static String getUpdateProcessUrl() {
        return getMapHttpHead() + "/gis/rushrepair/updateapp";
    }

    public static String getRepairListUrl() {
        return getMapHttpHead() + "/gis/rushrepair/page";
    }

    public static String getBuildListUrl() {
        return getMapHttpHead() + "/gis/constructionsite/pagenew";
    }

    public static String getRepairListUrl1() {
        return getMapHttpHead() + "/gis/rushrepair/pagenew";
    }

    public static String getRepairDetailUrl() {
        return getMapHttpHead() + "/gis/rushrepair/";
    }

    public static String getBuildDetailUrl() {
        return getMapHttpHead() + "/gis/constructionsite/";
    }

    public static String getExamineBuildUrl() {
        return getMapHttpHead() + "/gis/constructionsite/auditend";
    }

    public static String getExamineRushUrl() {
        return getMapHttpHead() + "/gis/rushrepair/auditend";
    }

    public static String getBuildLogListUrl() {
        return getHttpHead() + newApi.buildLogList;
    }

    public static String getAddPlanPointRepairUrl() {
        return getHttpHead() + newApi.addPlanPointRepair;
    }

    public static String getPlanPointRepairListUrl() {
        return getHttpHead() + newApi.planPointRepairList;
    }

    public static String getDeletePlanPointRepairUrl() {
        return getHttpHead() + newApi.deletePlanPointRepair;
    }

    public static String getUpdatePlanPointRepairUrl() {
        return getHttpHead() + newApi.updatePlanPointRepair;
    }

    public static String getPlanPointChildRepairInfoUrl() {
        return getHttpHead() + newApi.planPointChildRepairInfo;
    }

    public static String getAddPlanPointChildRepairUrl() {
        return getHttpHead() + newApi.addPlanPointChildRepair;
    }

    public static String getAddAdjustDeviceChildRepairUrl() {
        return getHttpHead() + newApi.addAdjustDeviceChildRepair;
    }

    public static String getAddValveDeviceChildRepairUrl() {
        return getHttpHead() + newApi.addValveDeviceChildRepair;
    }

    public static String getPlanPointChildRepairListUrl() {
        return getHttpHead() + newApi.planPointChildRepairList;
    }

    public static String getAdjustDevieChildRepairListUrl() {
        return getHttpHead() + newApi.adjustDeviceChildRepairList;
    }

    public static String getValveDeviceChildRepairListUrl() {
        return getHttpHead() + newApi.valveDeviceChildRepairList;
    }

    public static String getDeletePlanChildPointRepairUrl() {
        return getHttpHead() + newApi.deletePlanChildPointRepair;
    }

    public static String getRepairSysDeviceSettingListUrl() {
        return getHttpHead() + newApi.repairSysDeviceSettingList;
    }

    public static String getRepairNfcInfoUrl() {
        return getHttpHead() + newApi.repairNFCInfo;
    }

    public static String getSysConfigListUrl() {
        return getHttpHead() + newApi.sysConfigList;
    }

    public static String getSysSettingUrl() {
        String newHttpHead = getMapHttpHead();
        return newHttpHead + newApi.sysSetting;
    }

    public static String getAddPlanPointLogUrl() {
        return getHttpHead() + newApi.addPlanPointLog;
    }

    public static String getApplyRecalculateplanUrl() {
        return getHttpHead() + newApi.applyRecalculatePlan;
    }

    public static String getRecalculatePointsUrl() {
        return getHttpHead() + newApi.getRecalculatePoints;
    }

    public static String getUpLoadRepairUrl() {
        return getMapHttpHead() + newApi.upLoadRepair;
    }

    public static String getUpdateRecalculateStateUrl() {
        return getHttpHead() + newApi.updateRecalculateState;
    }

    private static final String PIPEANALYSISLAYER = "/MapServer/jobs/";//爆管分析图层拼接

    public static String getBurstJobUrl(String url, String jobId) {
        String burstUrl = url;
        if (!url.isEmpty() && url.indexOf("GPServer") != -1) {
            burstUrl = url.substring(0, url.indexOf("GPServer") - 1);
            burstUrl += PIPEANALYSISLAYER + jobId;
        }
        return burstUrl;
    }

    /*爆管分析*/
    public static String ONLINE_BURST_INTERNAL = "http://192.168.2.246:6080/arcgis/rest/services/deyang/tftools/GPServer/BurstPipeAnalyzenanbu";
    /*地形地图*/
    public static String ONLINE_TPK_INTERNAL = "http://192.168.2.246:6080/arcgis/rest/services/deyang/DXT_QY_DEYANG/MapServer";
    /*管线地图*/
    public static String ONLINE_PIPE_INTERNAL = "http://192.168.2.246:6080/arcgis/rest/services/dyrq/PIPE_QY_DYRQ_DYNAMIC/MapServer";
    /*影像地图*/
    public static String ONLINE_IMAGE_INTERNAL = "http://192.168.2.246:6080/arcgis/rest/services/deyang/IMAGE_QY_DEYANG/MapServer";
    /*地名地图*/
    public static String ONLINE_POI_INTERNAL = "http://192.168.2.246:6080/arcgis/rest/services/deyang/POI_QY_DEYANG/MapServer";
    /*消防栓地图*/
    public static String ONLINE_HYDRANT_INTERNAL = "http://192.168.2.103:6080/arcgis/rest/services/deyang/Hydrant_QY_DEYANG/MapServer";
    /*检查井地图*/
    public static String ONLINE_WELL_INTERNAL = "http://192.168.2.103:6080/arcgis/rest/services/deyang/Well_QY_DEYANG/MapServer";


    /*爆管分析*/
    public static String ONLINE_BURST_EXTERNAL = "http://218.200.166.203:1111/arcgis/rest/services/deyang/tftools/GPServer/BurstPipeAnalyzenanbu";
    /*管线地图*/
    public static String ONLINE_PIPE_EXTERNAL = "http://218.200.166.203:1111/arcgis/rest/services/dyrq/PIPE_QY_DYRQ/MapServer";

    public static String ONLINE_FILTER_MAP_GP_EXTERNAL = "http://218.200.166.203:1111/arcgis/rest/services/dyrq/FilterMapRQ/GPServer/FilterMapRQ";

    public static String ONLINE_FILTER_MAP_MP_EXTERNAL = "http://218.200.166.203:1111/arcgis/rest/services/dyrq/FilterMapRQ/MapServer/FilterMapRQ";


    public static String getGpServer() {
        return isExternalAddr ? ONLINE_BURST_EXTERNAL : ONLINE_BURST_INTERNAL;
    }

    public static String getMapServer() {
        return isExternalAddr ? ONLINE_PIPE_INTERNAL : ONLINE_PIPE_EXTERNAL;
    }

    public static String getReplaceUrl(String url) {
        String replaceUrl = url;
        int index = url.indexOf("/arcgis");
        if (index != -1) {
            replaceUrl = "http://218.200.166.203:1111" + url.substring(index);
        }
        return replaceUrl;
    }
}
