车辆位置查看根据坐标
<%@ page language="java" pageEncoding="UTF-8"%> <!DOCTYPE HTML> <html> <head> <title>任务分配</title> <%@ include file="../common/header.jsp"%> <script type="text/javascript"> </script> </head> <body> <div class="list_title"> <span>任务管理</span> </div> <div class="text_input"> <form id='fm_s' action=""> 任务类型<select id="bt_tasktype_s" name="bt_tasktype_s" class="easyui-combobox"> <option value="">全部</option> <option value="0">充电</option> <option value="1">调度</option> <option value="2">整备</option> </select> 任务状态<select id="bt_taskstatus_s" name="bt_taskstatus_s" class="easyui-combobox"> <option value="">全部</option> <option value="0">待分配</option> <option value="1">已分配</option> <option value="2">处理中</option> <option value="4">完成</option> </select> 车管员姓名<input type="text" id="bcm_name_s" name="bcm_name_s" class="easyui-textbox" value="" style="width: 100px !important" /> 手机号<input type="text" id="bcm_moboile_s" name="bcm_moboile_s" class="easyui-textbox" value="" /> </br> <div style="width: 100%; height: 15px; line-height: 15px;"></div> 车牌号 <input type="text" id="bv_plateNumber_s" name="bv_plateNumber_s" class="easyui-textbox" value="" style="width: 100px !important" /> 取车车场<select id="parklotid_s" name="parklotid_s" class="easyui-combobox"> </select> 开始时间<input id="createStartTime" type="text" name="createStartTime" class="easyui-datetimebox" style="width: 100px !important" /> 结束时间<input type="text" id="createEndTime" name="createEndTime" class="easyui-datetimebox" style="width: 100px !important" /> <input type="button" class="text_input_button" onclick="search()" value="查询"> </form> </div> <div id="win" class="easyui-dialog" style="width: 460px; height: 300px;" closed="true" buttons="#dlg-buttons"> <form id="fm1" method="post"> <table class="order_info" height="100"> <td><label for="name"><span style="color: red;">*</span> 车管人员:</label></td> <td><select name="carManagerid" id="carManagerid" class="easyui-combobox" style="width: 175px;"></select> <input name="taskid" id="taskid" type="hidden"></td> </table> </form> </div> <div id="win1" class="easyui-dialog" style="width: 460px; height: 300px;" closed="true" buttons="#dlg-buttons1"> <form id="fm2" method="post"> <table class="order_info" height="100"> <td><label for="name"><span style="color: red;">*</span> 控制命令:</label></td> <td><select name="sendControl" id="sendControl" class="easyui-combobox" style="width: 175px;"> <option value="-1">请选择</option> <option value="0">任务完成</option> <option value="1">任务接收</option> <option value="2">二维码</option> <option value="3">充电</option> <option value="4">充电结束</option> <option value="5">开锁</option> <option value="6">锁门</option> <option value="7">寻车</option> </select> <input name="taskids" id="taskids" type="hidden"></td> </table> </form> </div> <table id="dg" style="width: 100%;"></table>
//添加车辆位置查看页面iframe <div id="divDetail" title="详细位置" data-options="iconCls:'icon-save',closed:'true',collapsible:false,minimizable:false,maximizable:false,closable:true" > <iframe id="iframeDetail" style="width:685px;height:510px; border:none;" src="" name="window"></iframe> </div> <div class="text_input_bottom"> <input id="btnExport" type="button" class="text_input_button text_input_button_left" value="导出Excel"> </div> <div id="updateW" class="easyui-window" data-options="iconCls:'icon-save',collapsible:false,minimizable:false,maximizable:false,closed:true" style="width: 480px; height: 550px; padding: 10px;">任务分配</div> <div id="distributeTaskW" class="easyui-window" data-options="iconCls:'icon-save',collapsible:false,minimizable:false,maximizable:false,closed:true" style="width: 680px; height: 550px; padding: 10px;">任务信息</div> <script type="text/javascript"> $(function($) { setAutoHeight(170,"dg"); //初始化网点 $("#parklotid_s").combobox({ url:'<%=request.getContextPath()%>/beiqiBranch/comboBranchList', valueField:'railId', textField:'name' }); $('#dg').datagrid({ url:'<%=request.getContextPath()%>/bqVehicleTask/list', toolbar:$('#toolbar'), rownumbers:true, emptyMsg:'无数据', columns:[[ {field:'ck',checkbox:true,id:'ck'}, {field:'bt_id',hidden:true,title:'id'}, {field:'action',title:'操作',width:'15%',formatter:formatAction}, {field:'bt_jobtype',title:'任务类型',width:'10%',formatter:formatTaskType}, {field:'bv_plate',title:'车牌号',width:'10%'}, {field:'bt_taskstatus',title:'任务状态',width:'10%',formatter:formatTaskStatus}, {field:'bcm_name',title:'车管员姓名',width:'10%'}, {field:'bt_taskuserID',hidden:true,title:'bt_taskuserID'}, {field:'bcm_mobile',title:'手机号',width:'10%'}, {field:'bt_createDate',title:'创建时间',width:'15%'}, {field:'bt_allocationtime',title:'分配时间',width:'15%'}, {field:'bt_accomplishtime',title:'完成时间',width:'15%'} ]], pagination:true, pageSize: 10, onBeforeLoad: function(param){ $($('#fm_s').serializeArray()).each(function(){ param[this.name]=this.value; }); }, onBeforeSelect:function(){ return false; } }); var pager = $('#dg').datagrid('getPager'); // get the pager of datagrid pager.pagination({ pageSize:10, pageList: [10,50,100], displayMsg:'', layout:['prev','links','next','list'] }); $("#btnExport").click(function(){ var queryParam = getFormJson($("#fm_s")[0]); var url = "<%=request.getContextPath()%>/bqVehicleTask/exportTask?"+$.param(queryParam); window.open(url); }); $('#divDetail').window({//加载iframe width:700, height:500, modal:true, closed: true }); }); // 如:{Name:'摘取天上星',position:'IT技术'} // ps:注意将同名的放在一个数组里 function getFormJson(form) { var o = {}; var a = $(form).serializeArray(); $.each(a, function() { if (o[this.name] !== undefined) { if (!o[this.name].push) { o[this.name] = [ o[this.name] ]; } o[this.name].push(this.value || ''); } else { o[this.name] = this.value || ''; } }); return o; } function formatAction(val,row){ if(row.bt_taskstatus==0){ return '<a style="" href="#" onclick="javascript:cancelTask('+row.bt_id+','+row.bt_taskstatus+','+row.bcm_moboile+')">分配任务</a>|<a class="editcls" onclick="OpenMap('+row.bt_id+')" href="javascript:void(0)">查看位置</a>'; }else if(row.bt_taskstatus==1){ return '<a style="" href="#" onclick="javascript:unCancelTask('+row.bt_id+','+row.bt_taskstatus+','+row.bcm_moboile+')">撤销任务</a>|<a style="" href="#" onclick="javascript:cancel('+row.bt_id+','+row.bt_taskstatus+','+row.bcm_moboile+')">控制</a>|<a class="editcls" onclick="OpenMap('+row.bt_id+')" href="javascript:void(0)">查看位置</a>'; }else if(row.bt_taskstatus==2){ return '<a style="" href="#" onclick="javascript:cancel('+row.bt_id+','+row.bt_taskstatus+','+row.bcm_moboile+')">控制</a>|<a class="editcls" onclick="OpenMap('+row.bt_id+')" href="javascript:void(0)">查看位置</a>'; }else{ return ''; } } function formatTaskType(val,row){ var temp="充电任务"; if('1' == val){ temp = '充电任务'; }else if('2' == val){ temp = '洗车任务'; }else if('3' == val){ temp = '调配车辆'; }else if('4' == val){ temp = '挪车(故障)'; }else if('5' == val){ temp = '挪车(事故)'; } return temp; } function formatTaskStatus(val,row){ var temp ='待分配'; if('0' == val){ temp = '待分配'; }else if('1' == val){ temp = '已分配'; }else if('2' == val){ temp = '处理中'; }else if('4' == val){ temp = '完成'; } return temp; } function cancelTask(taskid,bt_taskstatus,bcm_moboile){ $('#fm1').form('clear'); $('#carManagerid').combobox({ url: '<%=request.getContextPath()%>/bqCarManagerController/bqCarManager', editable: false, valueField: 'id', textField: 'name' }); $("#taskid").val(taskid); $('#win').dialog('open').dialog('center').dialog('setTitle', '任务分配'); $('#win').window('open'); } function OpenMap(taskid){//车辆位置查看 $('#iframeDetail').attr("src","<%=request.getContextPath()%>/jsp/beiqi/bqVehicleSiteDetail.jsp?taskid="+taskid); $('#divDetail').window('open'); } function saveCustome(){ if($("#carManagerid").combobox('getValue')=='-1') { $.messager.alert("操作提示", "请选择车管人员","warning"); return false; } $('#fm1').form('submit',{ url: '<%=request.getContextPath()%>/bqCarManagerController/saveCarManager', onSubmit : function() { return $(this).form('validate'); }, success : function(result) { if (result == 2) { $('#win').window('close'); $('#dg').datagrid('load'); $.messager.alert('消息', '任务分配成功!'); } else if (result == 3) { $.messager.alert('消息', '任务分配失败!'); } } }); } function cancel(taskid, bt_taskstatus, bcm_moboile) { $('#fm2').form('clear'); $("#taskids").val(taskid); $("#sendControl").textbox('setValue','请选择') $('#win1').dialog('open').dialog('center').dialog('setTitle', '发送控制'); $('#win1').window('open'); } function sendControl(){ if($("#sendControl").combobox('getValue')=='-1' || $("#sendControl").combobox('getValue')=='请选择'){ $.messager.alert("操作提示", "请选择控制命令","warning"); return false; }else if($("#sendControl").combobox('getValue')=='0'){ $('#fm2').form('submit',{ url: '<%=request.getContextPath()%>/bqCarManagerController/opeJobFinish', onSubmit : function() { return $(this).form('validate'); }, success : function(result) { var result = eval('(' + result + ')'); //alert(result.code); if (result.code == '10000') { $('#win1').window('close'); $('#dg').datagrid('load'); $.messager.alert('消息',result.message); } else{ $.messager.alert('消息',result.message); } } }); }else if($("#sendControl").combobox('getValue')=='1'){ $('#fm2').form('submit',{ url: '<%=request.getContextPath()%>/bqCarManagerController/opeJobStart', onSubmit : function() { return $(this).form('validate'); }, success : function(result) { var result = eval('(' + result + ')'); //alert(result.code); if (result.code == '10000') { $('#win1').window('close'); $('#dg').datagrid('load'); $.messager.alert('消息', result.message); } else { $.messager.alert('消息', result.message); } } }); }else if($("#sendControl").combobox('getValue')=='2'){ $('#fm2').form('submit',{ url: '<%=request.getContextPath()%>/bqCarManagerController/opeScan', onSubmit : function() { return $(this).form('validate'); }, success : function(result) { var result = eval('(' + result + ')'); //alert(result.code); if (result.code == '80000') { $('#win1').window('close'); $('#dg').datagrid('load'); $.messager.alert('消息', result.message); } else { $.messager.alert('消息', result.message); } } }); }else if($("#sendControl").combobox('getValue')=='3'){ $('#fm2').form('submit',{ url: '<%=request.getContextPath()%>/bqCarManagerController/opeCharge', onSubmit : function() { return $(this).form('validate'); }, success : function(result) { var result = eval('(' + result + ')'); if (result.code == '80000') { $('#win1').window('close'); $('#dg').datagrid('load'); $.messager.alert('消息', result.message); } else{ $.messager.alert('消息', result.message); } } }); }else if($("#sendControl").combobox('getValue')=='4'){ $('#fm2').form('submit',{ url: '<%=request.getContextPath()%>/bqCarManagerController/opeChargeStop', onSubmit : function() { return $(this).form('validate'); }, success : function(result) { var result = eval('(' + result + ')'); if (result.code == '80000') { $('#win1').window('close'); $('#dg').datagrid('load'); $.messager.alert('消息', result.message); } else { $.messager.alert('消息', result.message); } } }); }else if($("#sendControl").combobox('getValue')=='5'){ $('#fm2').form('submit',{ url: '<%=request.getContextPath()%>/bqCarManagerController/commandControl?kzflag=1', onSubmit : function() { return $(this).form('validate'); }, success : function(result) { var result = eval('(' + result + ')'); if (result.code == '80000') { $('#win1').window('close'); $('#dg').datagrid('load'); $.messager.alert('消息', result.message); } else{ $.messager.alert('消息', result.message); } } }); }else if($("#sendControl").combobox('getValue')=='6'){ $('#fm2').form('submit',{ url: '<%=request.getContextPath()%>/bqCarManagerController/commandControl?kzflag=2', onSubmit : function() { return $(this).form('validate'); }, success : function(result) { var result = eval('(' + result + ')'); if (result.code == '80000') { $('#win1').window('close'); $('#dg').datagrid('load'); $.messager.alert('消息', result.message); } else { $.messager.alert('消息', result.message); } } }); }else if($("#sendControl").combobox('getValue')=='7'){ $('#fm2').form('submit',{ url: '<%=request.getContextPath()%>/bqCarManagerController/commandControl?kzflag=3', onSubmit : function() { return $(this).form('validate'); }, success : function(result) { var result = eval('(' + result + ')'); if (result.code == '80000') { $('#win1').window('close'); $('#dg').datagrid('load'); $.messager.alert('消息', result.message); } else{ $.messager.alert('消息', result.message); } } }); } } function unCancelTask(taskid, bt_taskstatus, bcm_moboile){ var path = '<%=request.getContextPath()%>/bqCarManagerController/unCancelTask'; $.messager.confirm('消息','确定要撤销已分配任务么?',function(r){ if (r){ $.post(path,{taskids:taskid},function(result){ if (result==1){ $.messager.alert('消息','任务撤销成功!'); $('#dg').datagrid('reload'); // reload the user data } else { $.messager.alert('消息','任务撤销失败!'); } },'json'); } }); } function search() { $('#dg').datagrid('load'); } function formatContent(value, row, index) { if (null != value) { return '<div title='+value+' style="overflow: hidden;text-overflow:ellipsis;whitespace:nowrap;">' + value + '</div>'; } return ""; } </script> <div id="dlg-buttons"> <div class="text_input_button_float button_margin" onclick="javascript:saveCustome();">保存</div> <div class="text_input_button_float button_margin" onclick="javascript:$('#win').dialog('close')">取消</div> <div id="dlg-buttons1"> <div class="text_input_button_float button_margin" onclick="javascript:sendControl();">保存</div> <div class="text_input_button_float button_margin" onclick="javascript:$('#win1').dialog('close')">取消</div> </body> </html>
<%@ page language="java" pageEncoding="UTF-8"%> <html> <head> <title>车辆详细位置</title> <%@ include file="../common/header.jsp"%> <style type="text/css"> body { width: 680px; height: 520px; overflow: hidden; margin: 0px; padding: 0px; } </style> <style type="text/css"> * { margin: 0px; padding: 0px; } button, input, select, textarea { font: 12px/16px Verdana, Helvetica, Arial, sans-serif; } #container { min-width: 600px; min-height: 767px; } </style> <script charset="utf-8" src="http://map.qq.com/api/js?v=2.exp"></script> <script> var init = function() { var lng ="116.397128"; var lat ="39.916527"; var taskid = '<%=request.getParameter("taskid")%>'; $.ajax({ url:'<%=request.getContextPath()%>/bqCarManagerController/getLastSite', type : 'post', //数据发送方式 data : ("taskid=" +taskid), dataType : 'json',//接受数据格式 async : false, success : function(data) { if (data != "") { lat = data.split('|')[0]; lng = data.split('|')[1]; } } }); var center = new qq.maps.LatLng(lat, lng); var map = new qq.maps.Map(document.getElementById('container'), { center : center, zoom : 13 }); var anchor = new qq.maps.Point(6, 6), size = new qq.maps.Size(24, 24), origin = new qq.maps.Point( 0, 0), icon = new qq.maps.MarkerImage( 'http://lbs.qq.com/javascript_v2/img/center.gif', size, origin, anchor); var marker = new qq.maps.Marker({ icon : icon, map : map, position : map.getCenter() }); } </script> </head> <body onload="init()"> <div id="container"></div> <p id="info" style="margin-top: 10px;"></p> </body> </html>
@RequestMapping("/getLastSite") public void getLastSiteBySN(HttpServletRequest request, HttpServletResponse response) { String taskid = request.getParameter("taskid"); BqTaskInfo taskInfo = bqCarManagerService.selectByPrimaryKey(Integer.parseInt(taskid)); if (StringUtils.isEmpty(taskid)) { this.out(response, ""); return; } this.out(response, this.bqCarManagerService.getLastSiteBySn(taskInfo.getLat(),taskInfo.getLon())); return; } public String getLastSiteBySn(String lat, String lon) { String Result = ""; Result = TengXunAPIUtil.getGCJByGPS(lat + "," + lon); if (!StringUtils.isBlank(Result)) { net.joystart.vehicle.entity.ReturnResultTengXun RRNew = (net.joystart.vehicle.entity.ReturnResultTengXun) JSONProcesser .jsonProcesser(Result, net.joystart.vehicle.entity.ReturnResultTengXun.class); if (RRNew != null && RRNew.getLocations().size() > 0) { return RRNew.getLocations().get(0).getLat() + "|" + RRNew.getLocations().get(0).getLng(); } else { return ""; } } else { return ""; } }