Commit d101ec1d678367c589c681e62f43fc84f45c7855

Authored by zlz
1 parent f3240571

查询车载上报停靠信息

src/main/java/com/bsth/entity/search/PredicatesBuilder.java
... ... @@ -108,7 +108,10 @@ public class PredicatesBuilder {
108 108 String.class.isAssignableFrom(rightType)) { // Date >= String
109 109 DateTime dateTime = new DateTime(object);
110 110 return cb.greaterThanOrEqualTo((Path<Date>) expression, dateTime.toDate());
111   - } else {
  111 + } else if (long.class.isAssignableFrom(leftType) &&
  112 + String.class.isAssignableFrom(rightType)) { // Long >= String
  113 + return cb.greaterThanOrEqualTo((Path<Long>) expression, Long.valueOf(object+""));
  114 + } else {
112 115 throw new RuntimeException("ge 不支持类型组合:" + expression.getJavaType() + ">=" + object.getClass());
113 116 }
114 117 }
... ... @@ -140,7 +143,10 @@ public class PredicatesBuilder {
140 143 String.class.isAssignableFrom(rightType)) { // Date <= String
141 144 DateTime dateTime = new DateTime(object);
142 145 return cb.lessThanOrEqualTo((Path<Date>) expression, dateTime.toDate());
143   - } else {
  146 + }else if (long.class.isAssignableFrom(leftType) &&
  147 + String.class.isAssignableFrom(rightType)) { // Long <= String
  148 + return cb.lessThanOrEqualTo((Path<Long>) expression, Long.valueOf(object + "") );
  149 + } else {
144 150 throw new RuntimeException("le 不支持类型组合:" + expression.getJavaType() + "<=" + object.getClass());
145 151 }
146 152 }
... ...
src/main/java/com/bsth/entity/traffic/VehicleInoutStop.java
... ... @@ -46,7 +46,7 @@ public class VehicleInoutStop {
46 46 private Integer inOutStop;
47 47  
48 48 // 上报时间
49   - private Date reportDate;
  49 + private long reportDate;
50 50  
51 51 public Integer getId() {
52 52 return id;
... ... @@ -104,11 +104,7 @@ public class VehicleInoutStop {
104 104 this.inOutStop = inOutStop;
105 105 }
106 106  
107   - public Date getReportDate() {
108   - return reportDate;
109   - }
  107 + public long getReportDate() { return reportDate; }
110 108  
111   - public void setReportDate(Date reportDate) {
112   - this.reportDate = reportDate;
113   - }
  109 + public void setReportDate(long reportDate) { this.reportDate = reportDate; }
114 110 }
... ...
src/main/resources/static/pages/trafficManage/js/lineStationUploadRecord.js
... ... @@ -13,16 +13,57 @@
13 13 */
14 14  
15 15 (function(){
  16 + var page = 0, initPag;
16 17 // 关闭左侧栏
17 18 if (!$('body').hasClass('page-sidebar-closed'))
18 19 $('.menu-toggler.sidebar-toggler').click();
19   - // 日期控件
20   - $('#dateInput').datetimepicker({
21   - // 日期控件时间格式
22   - format : 'YYYY-MM-DD',
23   - // 语言
24   - locale: 'zh-cn'
25   - });
  20 +
  21 + $("#dateInput").datetimepicker({
  22 + format : 'YYYY-MM-DD',
  23 + locale : 'zh-cn'
  24 + });
  25 +
  26 + var lines = new Array();
  27 +
  28 + $('#line').select2({
  29 + ajax: {
  30 + url: '/realSchedule/findLine',
  31 + type: 'post',
  32 + dataType: 'json',
  33 + delay: 150,
  34 + data: function(params){
  35 + return{line: params.term};
  36 + },
  37 + processResults: function (data) {
  38 + return {
  39 + results: data
  40 + };
  41 + },
  42 + cache: true
  43 + },
  44 + templateResult: function(repo){
  45 + if (repo.loading) return repo.text;
  46 + var h = '<span>'+repo.text+'</span>';
  47 + return h;
  48 + },
  49 + escapeMarkup: function (markup) { return markup; },
  50 + minimumInputLength: 1,
  51 + templateSelection: function(repo){
  52 + return repo.text;
  53 + },
  54 + language: {
  55 + noResults: function(){
  56 + return '<span style="color:red;font-size: 12px;">没有搜索到线路!</span>';
  57 + },
  58 + inputTooShort : function(e) {
  59 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入线路搜索线路</span>';
  60 + },
  61 + searching : function() {
  62 + return '<span style="color:gray;font-size: 12px;"> 正在搜索线路...</span>';
  63 + }
  64 + }
  65 + });
  66 +
26 67 // 日期范围输入框限制,绑定按键和粘贴事件
27 68 $(".dateRange").keyup(function(){
28 69 var tmptxt=$(this).val();
... ... @@ -48,81 +89,112 @@
48 89 if(tmptxt < 0){
49 90 $(this).val(00);
50 91 }
51   - }).css("ime-mode", "disabled");
52   - /**
53   - * 取得编码-公司map
54   - * gsmap["5"] = 南汇公司
55   - * gsmap["5_3"] = 芦潮港分公司
56   - */
57   - function getBusMap(){
58   - // 取得公司信息,替换公司编码
59   - var gsmap = {};
60   - $get('/business/all', null, function(array){
61   - $.each(array, function(i, gs){
62   - var k = gs.upCode + '_' + gs.businessCode;
63   - if(gs.upCode === '88'){
64   - k = gs.businessCode;
65   - }
66   - gsmap[k] = gs.businessName;
67   - });
68   - });
69   - return gsmap;
70   - }
71   - /**
72   - * 设置公司自动完成
73   - */
74   - var lines = new Array();
75   - var gsmap = getBusMap();
76   - // 取得所有线路
77   - $get('/line/all', null, function(allLine) {
78   - // 遍历数组
79   - $.each(allLine, function(i, e) {
80   - var companyCode = e.company;
81   - e.company = gsmap[e.company];
82   - e.brancheCompany = gsmap[companyCode+"_"+e.brancheCompany];
83   - var line = '{"hex":"' + e.company + '","label":"' + e.name
84   - + '"}';
85   - var obj = jQuery.parseJSON(line);
86   - lines[i] = obj;
87   - });
88   - });
89   - // 给输入框绑定autocomplete事件
90   - $("input[name='xl.name_eq']").autocompleter({
91   - highlightMatches : true,
92   - source : lines,
93   - template : '{{ label }} <span>({{ hex }})</span>',
94   - hint : true,
95   - empty : false,
96   - limit : 5,
97   - });
98   - // 设置autocompleter的宽度和输入框一样
99   - $(".autocompleter").css("width",
100   - $("input[name='xl.name_eq']").css("width"));
101   -
102   - /**
103   - * 设置内部编码自动完成
104   - */
105   - var cars = new Array();
106   - // 取得所有车辆
107   - $get('/cars/all', null, function(allCars) {
108   - // 遍历数组
109   - $.each(allCars, function(i, e) {
110   - var car = '{"hex":"' + e.insideCode + '","label":"' + e.insideCode
111   - + '"}';
112   - var obj = jQuery.parseJSON(car);
113   - cars[i] = obj;
114   - });
115   - });
116   - // 给输入框绑定autocomplete事件
117   - $("input[name='xl.insideCode_eq']").autocompleter({
118   - highlightMatches : true,
119   - source : cars,
120   - template : '{{ label }}',
121   - hint : true,
122   - empty : false,
123   - limit : 5,
124   - });
125   - // 设置autocompleter的宽度和输入框一样
126   - $(".autocompleter").css("width",
127   - $("input[name='xl.insideCode_eq']").css("width"));
  92 + }).css("ime-mode", "disabled");
  93 +
  94 + // 绑定查询事件
  95 + $("#search").click(searchM);
  96 + // 查询方法
  97 + function searchM(pagination) {
  98 + if($("#dateInput").val() == ""){
  99 + alert("请选择时间");
  100 + return ;
  101 + }
  102 + var params = {};
  103 + // 排序(按方向与序号)
  104 + params['order'] = 'reportDate';
  105 + // 排序方向.
  106 + params['direction'] = 'ASC';
  107 + // 记录当前页数
  108 + params['page'] = page;
  109 + // 弹出正在加载层
  110 + var i = layer.load(2);
  111 + // 取得输入框的值
  112 + var inputs = $(".form-inline input,select");
  113 + // 遍历数组
  114 + $.each(inputs, function(i, element) {
  115 + params[$(element).attr("name")] = $(element).val();
  116 + });
  117 +
  118 + var startDate = params['startDate'];
  119 + var endDate = params['endDate'];
  120 + var reportDate = params['reportDate'];
  121 + if($("#carPlate").val() != ''){
  122 + params['cars.carPlate_eq'] = changeCarPlate($("#carPlate").val());
  123 + }
  124 + if($("#insideCode").val() != ''){
  125 + params['cars.insideCode_eq'] = $("#insideCode").val().toUpperCase();
  126 + }
  127 + // 默认开始时间
  128 + params['reportDate_ge'] = str2datetime(reportDate+" 00:00:00");
  129 + // 默认结束时间
  130 + params['reportDate_le'] = str2datetime(reportDate+" 23:59:59");
  131 +
  132 + // 指定的开始时间
  133 + if(startDate != ''){
  134 + params['reportDate_gt'] = str2datetime(reportDate+" "+ (startDate > 9 ? startDate : "0"+startDate + ":00:00"));
  135 + }
  136 + // 指定的结束时间
  137 + if(endDate != ''){
  138 + params['reportDate_lt'] = str2datetime(reportDate+" "+ (endDate > 9 ? endDate : "0"+endDate + ":59:59"));
  139 + }
  140 + $get('/vehicle_stop', params, function(data) {
  141 + var content = data.content;
  142 + _dateFormat(content);
  143 + var bodyHtm = template('lineStationUploadRecord_list_temp', {
  144 + list : content
  145 + });
  146 + $('#vehicle_stop tbody').html(bodyHtm);
  147 + if(pagination && data.content.length > 0){
  148 + //重新分页
  149 + initPag = true;
  150 + showPagination(data);
  151 + }
  152 + layer.close(i);
  153 + });
  154 + }
  155 +
  156 + /** 分页栏组件 */
  157 + function showPagination(data){
  158 + // 分页组件
  159 + $('#pagination').jqPaginator({
  160 + // 总页数
  161 + totalPages: data.totalPages,
  162 + // 中间显示页数
  163 + visiblePages: 6,
  164 + // 当前页
  165 + currentPage: page + 1,
  166 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  167 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  168 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  169 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  170 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  171 + onPageChange: function (num, type) {
  172 + if(initPag){
  173 + initPag = false;
  174 + return;
  175 + }
  176 + page = num - 1;
  177 + searchM(false);
  178 + }
  179 + });
  180 + }
  181 +
  182 + //转换时间格式
  183 + function _dateFormat(list) {
  184 + var fs = 'YYYY-MM-DD HH:mm:ss';
  185 + $.each(list, function(i, obj) {
  186 + obj.reportDate = moment(obj.reportDate).format(fs);
  187 + });
  188 + }
  189 +
  190 + // 时间字符串转成时间戳
  191 + function str2datetime(stringTime){
  192 + return Date.parse(new Date(stringTime));
  193 + }
  194 +
  195 + // 时间字符串转成时间戳
  196 + function changeCarPlate(carPlate){
  197 + var tmp = "沪" + carPlate.substr(0, 1) + "-" + carPlate.substr(1, carPlate.length);
  198 + return tmp.toUpperCase();;
  199 + }
128 200 })();
129 201 \ No newline at end of file
... ...
src/main/resources/static/pages/trafficManage/lineStationUploadRecord.html
... ... @@ -8,30 +8,40 @@
8 8 </ul>
9 9 <div class="tab_line">
10 10 <div class="col-md-12">
11   - <ul class="breadcrumb">
12   - <li>筛选数据:</li>
13   - <li>日期:</li>
14   - <li><input type="text" class="inputCommon dateTime" name="date" id="dateInput" placeholder="日期"></li>
15   - <li>时间范围:</li>
16   - <li><input type="text" class="inputCommon dateRange" name="startDate">至
17   - <input type="text" class="inputCommon dateRange" name="endDate">时</li>
18   - <li>线路名称:</li>
19   - <li><input type="text" class="form-control form-filter input-sm"
20   - name="xl.name_eq" maxlength="40" /></li>
21   - <li>内部编码:</li>
22   - <li><input type="text" class="form-control form-filter input-sm"
23   - name="xl.insideCode_eq" maxlength="40" /></li>
24   - <li>车牌号:</li>
25   - <li><input type="text" class="inputCommon inputCarPlate"
26   - name="xl.carPlate_eq" maxlength="40" /></li>
27   - <li><a class="btn btn-circle blue" id="search">筛选</a></li>
28   - </ul>
  11 + <form class="form-inline" action="">
  12 + <div class="inLine_block" class="param">
  13 + <span class="item-label" style="width: 80px;">筛选数据:日期:</span>
  14 + <input class="form-control" name="reportDate" type="text" id="dateInput" style="width: 180px;"/>
  15 + </div>
  16 + <div class="inLine_block" style="display: inline-block;margin-left: 15px;">
  17 + <span class="item-label" style="width: 80px;">时间范围:</span>
  18 + <input type="text" name="startDate" class="inputCommon dateRange">至
  19 + <input type="text" name="endDate" class="inputCommon dateRange">时
  20 + </div>
  21 + <div class="inLine_block" style="display: inline-block;margin-left: 15px;">
  22 + <span class="item-label" style="width: 80px;">线路名称:</span>
  23 + <select class="form-control" name="line.id_eq" id="line" style="width: 150px;"></select>
  24 + </div>
  25 + <div class="inLine_block" style="display: inline-block;margin-left: 15px;">
  26 + <span class="item-label" style="width: 80px;">内部编码:</span>
  27 + <input type="text" name="cars.insideCode_eq" id="insideCode" style="width: 120px;" maxlength="40"/>
  28 + </div>
  29 + <div class="inLine_block" style="display: inline-block;margin-left: 15px;">
  30 + <span class="item-label" style="width: 80px;">车牌号:</span>
  31 + <input type="text" name="cars.carPlate_eq" id="carPlate" style="width: 120px;" maxlength="40"/>
  32 + <span style="color: red;width: 80px;">(沪D-12345 '沪'和'-'去掉)</span>
  33 + </div>
  34 + <div class="form-group" style="display: inline-block;margin-left: 15px;">
  35 + <a class="btn btn-circle blue" id="search">筛选</a>
  36 + </div>
  37 + </form>
29 38 </div>
30 39 <div class="col-md-12 panel-wrap">
31 40 <div class="_panel">
32 41 <div class="table-container">
33 42 <table
34   - class="table table-striped table-bordered table-advance pb-table head">
  43 + class="table table-striped table-bordered table-advance pb-table head"
  44 + id="vehicle_stop">
35 45 <thead>
36 46 <tr>
37 47 <th>序号</th>
... ... @@ -59,53 +69,127 @@
59 69 </div>
60 70 </div>
61 71 </div>
62   -<script id="lineStationRecord_list_temp" type="text/html">
  72 +<script id="lineStationUploadRecord_list_temp" type="text/html">
63 73 {{each list as obj i}}
64 74 <tr>
65 75 <td class="seq" style="vertical-align: middle;">
66 76 {{i+1}}
67 77 </td>
68 78 <td>
69   - {{obj.name}}
  79 + {{if obj.line.company == '55'}}
  80 + 上南公司
  81 + {{else if obj.line.company == '22'}}
  82 + 金高公司
  83 + {{else if obj.line.company == '05'}}
  84 + 杨高公司
  85 + {{else if obj.line.company == '26'}}
  86 + 南汇公司
  87 + {{else if obj.line.company == '77'}}
  88 + 闵行公司
  89 + {{/if}}
70 90 </td>
71   - <td class="ttInfoId">
72   - {{obj.company}}
  91 + <td>
  92 + {{if obj.line.company == '55'}}
  93 +
  94 + {{if obj.line.brancheCompany == '1'}}
  95 + 上南二分公司
  96 + {{else if obj.line.brancheCompany == '2'}}
  97 + 上南三分公司
  98 + {{else if obj.line.brancheCompany == '3'}}
  99 + 上南六分公司
  100 + {{else if obj.line.brancheCompany == '4'}}
  101 + 上南一分公司
  102 + {{/if}}
  103 +
  104 + {{else if obj.line.company == '22'}}
  105 +
  106 + {{if obj.line.brancheCompany == '1'}}
  107 + 四分公司
  108 + {{else if obj.line.brancheCompany == '2'}}
  109 + 二分公司
  110 + {{else if obj.line.brancheCompany == '3'}}
  111 + 三分公司
  112 + {{else if obj.line.brancheCompany == '5'}}
  113 + 一分公司
  114 + {{/if}}
  115 +
  116 + {{else if obj.line.company == '05'}}
  117 +
  118 + {{if obj.line.brancheCompany == '1'}}
  119 + 川沙分公司
  120 + {{else if obj.line.brancheCompany == '2'}}
  121 + 金桥分公司
  122 + {{else if obj.line.brancheCompany == '3'}}
  123 + 芦潮港分公司
  124 + {{else if obj.line.brancheCompany == '5'}}
  125 + 杨高分公司
  126 + {{else if obj.line.brancheCompany == '6'}}
  127 + 周浦分公司
  128 + {{/if}}
  129 +
  130 + {{else if obj.line.company == '26'}}
  131 +
  132 + {{if obj.line.brancheCompany == '1'}}
  133 + 南汇一分
  134 + {{else if obj.line.brancheCompany == '2'}}
  135 + 南汇二分
  136 + {{else if obj.line.brancheCompany == '3'}}
  137 + 南汇三分
  138 + {{else if obj.line.brancheCompany == '4'}}
  139 + 南汇维修公司
  140 + {{else if obj.line.brancheCompany == '5'}}
  141 + 南汇公司
  142 + {{/if}}
  143 +
  144 + {{/if}}
73 145 </td>
74 146 <td>
75   -
  147 + {{obj.line.name}}
76 148 </td>
77   - <td >
78   -
  149 + <td>
  150 + {{obj.line.shanghaiLinecode}}
79 151 </td>
80 152 <td>
81   - {{obj.name}}
  153 + {{obj.cars.insideCode}}
82 154 </td>
83 155 <td>
84   - {{obj.company}}
  156 + {{obj.cars.equipmentCode}}
85 157 </td>
86 158 <td>
87   -
  159 + {{obj.cars.carPlate}}
88 160 </td>
89   - <td >
90   -
  161 + <td>
  162 + {{obj.stop}}
91 163 </td>
92 164 <td>
93   - {{obj.name}}
  165 + {{if obj.serviceState == 0}}
  166 + 营运
  167 + {{else if obj.serviceState == 1}}
  168 + 停运
  169 + {{/if}}
94 170 </td>
95 171 <td>
96   - {{obj.company}}
  172 + {{if obj.upDown == 0}}
  173 + 上行
  174 + {{else if obj.upDown == 1}}
  175 + 下行
  176 + {{/if}}
97 177 </td>
98 178 <td>
99   -
  179 + {{if obj.inOutStop == 0}}
  180 + 站内
  181 + {{else if obj.inOutStop == 1}}
  182 + 站外
  183 + {{/if}}
100 184 </td>
101   - <td >
102   -
  185 + <td>
  186 + {{obj.reportDate}}
103 187 </td>
104 188 </tr>
105 189 {{/each}}
106 190 {{if list.length == 0}}
107 191 <tr class="muted">
108   - <td colspan=5 style="text-align: center;"><h6>没有找到相关数据</h6></td>
  192 + <td colspan=13 style="text-align: center;"><h6>没有找到相关数据</h6></td>
109 193 </tr>
110 194 {{/if}}
111 195 </script>
... ...