Commit a16f9bfa3820f9af9fab88f8a468fcf140bfff5c

Authored by ljq
1 parent c623b441

客流记录

src/main/java/com/bsth/controller/zndd/DKlController.java 0 → 100644
  1 +package com.bsth.controller.zndd;
  2 +
  3 +
  4 +import com.bsth.controller.BaseController;
  5 +import com.bsth.entity.DKLInfo;
  6 +import com.bsth.service.DKLInfoService;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.web.bind.annotation.PathVariable;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RestController;
  12 +
  13 +@RestController
  14 +@RequestMapping("dkl_logger")
  15 +public class DKlController extends BaseController<DKLInfo, Integer> {
  16 +
  17 + @Autowired
  18 + DKLInfoService DKLInfoService;
  19 +
  20 + @RequestMapping(value = "updatedkl/{id}", method = RequestMethod.POST)
  21 + public int updatedkl(@PathVariable("id") Integer id){
  22 + return DKLInfoService.updatedkl(id);
  23 + }
  24 +}
src/main/java/com/bsth/data/zndd/OutEntrance.java
@@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSONObject; @@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSONObject;
5 import com.bsth.common.ResponseCode; 5 import com.bsth.common.ResponseCode;
6 import com.bsth.data.BasicData; 6 import com.bsth.data.BasicData;
7 import com.bsth.data.schedule.DayOfSchedule; 7 import com.bsth.data.schedule.DayOfSchedule;
  8 +import com.bsth.entity.DKLInfo;
8 import com.bsth.entity.realcontrol.ScheduleRealInfo; 9 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  10 +import com.bsth.service.DKLInfoService;
9 import com.bsth.util.SignUtils; 11 import com.bsth.util.SignUtils;
10 import com.bsth.websocket.handler.SendUtils; 12 import com.bsth.websocket.handler.SendUtils;
11 import org.slf4j.Logger; 13 import org.slf4j.Logger;
@@ -31,7 +33,8 @@ public class OutEntrance { @@ -31,7 +33,8 @@ public class OutEntrance {
31 @Autowired 33 @Autowired
32 DayOfSchedule dayOfSchedule; 34 DayOfSchedule dayOfSchedule;
33 35
34 - 36 + @Autowired
  37 + private DKLInfoService dklInfoService;
35 38
36 Logger logger = LoggerFactory.getLogger(this.getClass()); 39 Logger logger = LoggerFactory.getLogger(this.getClass());
37 40
@@ -46,7 +49,7 @@ public class OutEntrance { @@ -46,7 +49,7 @@ public class OutEntrance {
46 logger.info("大客流接口调用----"); 49 logger.info("大客流接口调用----");
47 if(!SignUtils.validation(Long.parseLong(jsonObject.getString("timestamp")),jsonObject.getString("sign"))){ 50 if(!SignUtils.validation(Long.parseLong(jsonObject.getString("timestamp")),jsonObject.getString("sign"))){
48 rtn.put("status", "验证失败"); 51 rtn.put("status", "验证失败");
49 - // return rtn; 52 + return rtn;
50 } 53 }
51 String num=jsonObject.getString("num"); 54 String num=jsonObject.getString("num");
52 JSONArray jsonArray = jsonObject.getJSONArray("stations"); 55 JSONArray jsonArray = jsonObject.getJSONArray("stations");
@@ -58,6 +61,15 @@ public class OutEntrance { @@ -58,6 +61,15 @@ public class OutEntrance {
58 String lineName=BasicData.lineCode2NameMap.get(lineCode); 61 String lineName=BasicData.lineCode2NameMap.get(lineCode);
59 String stationName=BasicData.stationCode2NameMap.get(lineCode+"_"+dir+"_"+stationCode); 62 String stationName=BasicData.stationCode2NameMap.get(lineCode+"_"+dir+"_"+stationCode);
60 63
  64 + DKLInfo dklInfo =new DKLInfo();
  65 + dklInfo.setLineCode(lineCode);
  66 + dklInfo.setLineName(lineName);
  67 + dklInfo.setStationCode(stationCode);
  68 + dklInfo.setStationName(stationName);
  69 + dklInfo.setNum(Integer.parseInt(num));
  70 + dklInfo.setUpDown(dir);
  71 + dklInfoService.save(dklInfo);
  72 +
61 Map m = new HashMap(); 73 Map m = new HashMap();
62 m.put("stationCode", stationCode); 74 m.put("stationCode", stationCode);
63 m.put("lineCode", lineCode); 75 m.put("lineCode", lineCode);
src/main/java/com/bsth/entity/zndd/DKLInfo.java renamed to src/main/java/com/bsth/entity/DKLInfo.java
1 -package com.bsth.entity.zndd; 1 +package com.bsth.entity;
2 2
3 import javax.persistence.*; 3 import javax.persistence.*;
4 import java.util.Date; 4 import java.util.Date;
src/main/java/com/bsth/repository/DKLInfoRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import com.bsth.entity.DKLInfo;
  4 +import org.springframework.data.jpa.repository.Modifying;
  5 +import org.springframework.data.jpa.repository.Query;
  6 +import org.springframework.stereotype.Repository;
  7 +import org.springframework.transaction.annotation.Transactional;
  8 +
  9 +
  10 +@Repository
  11 +public interface DKLInfoRepository extends BaseRepository<DKLInfo, Integer> {
  12 +
  13 + @Transactional
  14 + @Modifying
  15 + @Query(value = "UPDATE DKLInfo t set t.status=?2 WHERE t.id = ?1")
  16 + public void update(Integer id, String t);
  17 +}
src/main/java/com/bsth/service/DKLInfoService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import com.bsth.entity.DKLInfo;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +
  7 +public interface DKLInfoService extends BaseService<DKLInfo, Integer> {
  8 +
  9 + public int updatedkl(Integer id);
  10 +}
src/main/java/com/bsth/service/impl/DKLInfoServiceImpl.java 0 → 100644
  1 +package com.bsth.service.impl;
  2 +
  3 +import com.bsth.entity.DKLInfo;
  4 +import com.bsth.repository.DKLInfoRepository;
  5 +import com.bsth.service.DKLInfoService;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +
  10 +@Service
  11 +public class DKLInfoServiceImpl extends BaseServiceImpl<DKLInfo, Integer> implements DKLInfoService {
  12 +
  13 + @Autowired
  14 + DKLInfoRepository DKLInfoRepository;
  15 + public int updatedkl(Integer id){
  16 +
  17 + DKLInfoRepository.update(id,"1");
  18 + return 0;
  19 +
  20 + }
  21 +
  22 +}
src/main/resources/static/pages/forms/zndd/logger_dkl.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px; }
  14 +
  15 + .table > tbody + tbody {
  16 + border-top: 1px solid; }
  17 +</style>
  18 +
  19 +<div class="page-head">
  20 + <div class="page-title">
  21 + <h1>客流记录</h1>
  22 + </div>
  23 +</div>
  24 +
  25 +<div class="row">
  26 + <div class="col-md-12">
  27 + <div class="portlet light porttlet-fit bordered">
  28 + <div class="portlet-title">
  29 + <form class="form-inline" action="">
  30 +
  31 + <div style="display: inline-block;margin-left: 33px;">
  32 + <span class="item-label" style="width: 80px;">线路: </span>
  33 + <select class="form-control" name="line" id="line" style="width: 180px;">
  34 + <option value="">请选择线路...</option>
  35 + </select>
  36 + </div>
  37 + <div style="display: inline-block;margin-left: 24px;">
  38 + <span class="item-label" style="width: 80px;">&nbsp;开始时间: </span>
  39 + <input class="form-control" type="text" id="startDate" style="width: 180px;"/>
  40 + </div>
  41 +
  42 + <div style="display: inline-block;margin-left: 24px;">
  43 + <span class="item-label" style="width: 80px;">&nbsp;结束时间: </span>
  44 + <input class="form-control" type="text" id="endDate" style="width: 180px;"/>
  45 + </div>
  46 +
  47 + <!-- <div style="display: inline-block;margin-left: 24px;">
  48 + <span class="item-label" style="width: 80px;">&nbsp;时间: </span>
  49 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  50 + </div>-->
  51 + <div class="form-group">
  52 + <input class="btn btn-default" type="button" id="query" value="筛选"/><!--
  53 + <input class="btn btn-default" type="button" id="export" value="导出"/>-->
  54 + </div>
  55 + </form>
  56 + </div>
  57 + <div class="portlet-body">
  58 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  59 + <table class="table table-bordered table-hover table-checkable" id="forms">
  60 + <thead>
  61 + <tr>
  62 + <th colspan="7">智能调度执行记录</th>
  63 + </tr>
  64 +
  65 + <tr>
  66 + <td>线路名称</td>
  67 + <td>站点名称</td>
  68 + <td>方向</td>
  69 + <td>人数</td>
  70 + <td>生成班次</td>
  71 + <td>发现时间</td>
  72 + </tr>
  73 + </thead>
  74 + <tbody id="tbody">
  75 +
  76 + </tbody>
  77 + </table>
  78 + </div>
  79 + </div>
  80 + </div>
  81 + </div>
  82 +</div>
  83 +
  84 +<script>
  85 + $(function(){
  86 +
  87 + // 关闭左侧栏
  88 + if (!$('body').hasClass('page-sidebar-closed'))
  89 + $('.menu-toggler.sidebar-toggler').click();
  90 +
  91 + $("#startDate").datetimepicker({
  92 + format : 'YYYY-MM-DD',
  93 + locale : 'zh-cn'
  94 + });
  95 +
  96 + $("#endDate").datetimepicker({
  97 + format : 'YYYY-MM-DD',
  98 + locale : 'zh-cn'
  99 + });
  100 + var fage=false;
  101 + var xlList;
  102 + var obj = [];
  103 +
  104 +
  105 + $.get('/report/lineList',function(result){
  106 + xlList=result;
  107 + $.get('/user/companyData', function(result){
  108 + obj = result;
  109 + var options = '';
  110 + for(var i = 0; i < obj.length; i++){
  111 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  112 + }
  113 +
  114 + if(obj.length ==0){
  115 + $("#gsdmDiv_daily").css('display','none');
  116 + }else if(obj.length ==1){
  117 + $("#gsdmDiv_daily").css('display','none');
  118 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  119 + $('#fgsdmDiv_daily').css('display','none');
  120 + }
  121 + $('#gsdmDaily').html(options);
  122 + updateCompany();
  123 + });
  124 + })
  125 + $("#gsdmDaily").on("change",updateCompany);
  126 + function updateCompany(){
  127 + var company = $('#gsdmDaily').val();
  128 + var options = '';
  129 + for(var i = 0; i < obj.length; i++){
  130 + if(obj[i].companyCode == company){
  131 + var children = obj[i].children;
  132 + for(var j = 0; j < children.length; j++){
  133 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  134 + }
  135 + }
  136 + }
  137 + $('#fgsdmDaily').html(options);
  138 + }
  139 +
  140 + var tempData = {};
  141 + $.get('/report/lineList',function(xlList){
  142 + var data = [];
  143 + data.push({id: " ", text: "全部线路"});
  144 + $.get('/user/companyData', function(result){
  145 + for(var i = 0; i < result.length; i++){
  146 + var companyCode = result[i].companyCode;
  147 + var children = result[i].children;
  148 + for(var j = 0; j < children.length; j++){
  149 + var code = children[j].code;
  150 + for(var k=0;k < xlList.length;k++ ){
  151 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  152 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  153 +
  154 + }
  155 + }
  156 + }
  157 + initPinYinSelect2('#line',data,'');
  158 +
  159 + });
  160 + });
  161 +
  162 + $("#line").on("change", function(){
  163 + if($("#line").val() == " "){
  164 + $("#gsdmDaily").attr("disabled", false);
  165 + $("#fgsdmDaily").attr("disabled", false);
  166 + } else {
  167 + var temp = (tempData[$("#line").val()] ? tempData[$("#line").val()] : " : ").split(":");
  168 + $("#gsdmDaily").val(temp[0]);
  169 + updateCompany();
  170 + $("#fgsdmDaily").val(temp[1]);
  171 + $("#gsdmDaily").attr("disabled", true);
  172 + $("#fgsdmDaily").attr("disabled", true);
  173 + }
  174 + });
  175 +
  176 +
  177 + var line;
  178 + var startDate;
  179 + var endDate;
  180 + var gsdmDaily;
  181 + var fgsdmDaily;
  182 + var lineName=$("#select2-line-container").html();
  183 + $("#query").on("click",function(){
  184 +
  185 + line = $("#line").val();
  186 + startDate = $("#startDate").val();
  187 + endDate = $("#endDate").val();
  188 +
  189 + gsdmDaily=$("#gsdmDaily").val();
  190 + fgsdmDaily = $("#fgsdmDaily").val();
  191 + lineName=$("#select2-line-container").html();
  192 +
  193 + var fs = 'YYYY-MM-DD HH:mm';
  194 + var st = parseInt(moment(startDate, fs).format('X'));
  195 + var et = parseInt(moment(endDate, fs).format('X'));
  196 +
  197 + if(et < st)
  198 + notify_err('结束时间不能小于开始时间!');
  199 +
  200 + var i = layer.load(2);
  201 + $get('/dkl_logger/all',{lineCode_eq:line,type:'query',createDate_ge:startDate,createDate_le:endDate},function(result){
  202 +
  203 + $.each(result, function(i, obj) {
  204 + obj.createDate = moment(obj.createDate).format("YYYY-MM-DD HH:mm:ss");
  205 + });
  206 +
  207 + // 把数据填充到模版中
  208 + var tbodyHtml = template('dailyInfo',{list:result});
  209 + // 把渲染好的模版html文本追加到表格中
  210 + $('#tbody').html(tbodyHtml);
  211 + layer.close(i);
  212 +
  213 + line = $("#line").val();
  214 + startDate = $("#startDate").val();
  215 + endDate = $("#endDate").val();
  216 + $("#sDate").text(startDate);
  217 + $("#eDate").text(endDate);
  218 +
  219 + var total_zgl = 0,total_ks = 0;
  220 + var total_yh = 0,total_bc = 0;
  221 +
  222 + $.each(result, function(i, obj) {
  223 + total_zgl +=Number(obj.zlc*10000);
  224 + total_ks +=Number(obj.jzl1*10000);
  225 + total_yh += Number(obj.yh*10000);
  226 + total_bc += Number(obj.bc);
  227 +
  228 + });
  229 + $("#total_zgl").text((total_zgl/10000).toFixed(3));
  230 + $("#total_ks").text((total_ks/10000).toFixed(3));
  231 + $("#total_yh").text((total_yh/10000).toFixed(2));
  232 + $("#total_bc").text(total_bc.toFixed(0));
  233 +
  234 + var temp = {};
  235 + var today_account = 0;
  236 +
  237 + temp["line"] = $("#line").text();
  238 + $.each(result, function(i, obj) {
  239 + if(moment(obj.schedule_date_str).format("YYYY-MM-DD") == moment(obj.startDate).format("YYYY-MM-DD")){
  240 + today_account++;
  241 + }
  242 + obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss");
  243 + });
  244 + })
  245 + });
  246 +
  247 + $("#export").on("click",function(){
  248 + /* if($("#date").val() == null || $("#date").val().trim().length == 0){
  249 + layer.msg("请选择时间");
  250 + return;
  251 + }*/
  252 + line = $("#line").val();
  253 + date = $("#date").val();
  254 + gsdmDaily=$("#gsdmDaily").val();
  255 + fgsdmDaily = $("#fgsdmDaily").val();
  256 + lineName=$("#select2-line-container").html();
  257 + var i = layer.load(2);
  258 + $get('/logZndd/listall',{rq_eq:date,lineCode_eq:line,type:'export'},function(result){
  259 + window.open("/downloadFile/download?fileName="
  260 + +moment(date).format("YYYYMMDD")+"-"+lineName+"-班次日报表");
  261 + layer.close(i);
  262 + });
  263 + });
  264 + });
  265 +</script>
  266 +<script type="text/html" id="dailyInfo">
  267 + {{each list as obj i}}
  268 + <tr>
  269 + <td>{{obj.lineName}}</td>
  270 + <td>{{obj.stationName}}</td>
  271 + <td>
  272 + {{if obj.upDown == '0'}}
  273 + 上行
  274 + {{else if obj.upDown == '1'}}
  275 + 下行
  276 + {{/if}}
  277 + </td>
  278 + <td>{{obj.num}}</td>
  279 + <td>
  280 + {{if obj.status == '1'}}
  281 + 是
  282 + {{else}}
  283 + 否
  284 + {{/if}}
  285 + </td>
  286 +
  287 + <td>{{obj.createDate}}</td>
  288 + </tr>
  289 + {{/each}}
  290 + {{if list.length == 0}}
  291 + <tr>
  292 + <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td>
  293 + </tr>
  294 + {{/if}}
  295 +</script>
0 \ No newline at end of file 296 \ No newline at end of file
src/main/resources/static/pages/permission/authorize_all/user_auth.html
@@ -54,6 +54,7 @@ @@ -54,6 +54,7 @@
54 <li><label><input class="uk-checkbox" type="checkbox" data-event="form_scheduleAnaly"> 时刻表分析</label></li> 54 <li><label><input class="uk-checkbox" type="checkbox" data-event="form_scheduleAnaly"> 时刻表分析</label></li>
55 <li><label><input class="uk-checkbox" type="checkbox" data-event="form_message"> 调度消息分析</label></li> 55 <li><label><input class="uk-checkbox" type="checkbox" data-event="form_message"> 调度消息分析</label></li>
56 <li><label><input class="uk-checkbox" type="checkbox" data-event="form_changetochange"> 换人换车情况统计表</label></li> 56 <li><label><input class="uk-checkbox" type="checkbox" data-event="form_changetochange"> 换人换车情况统计表</label></li>
  57 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_loggerr_dkl"> 客流日志</label></li>
57 </ul> 58 </ul>
58 </div> 59 </div>
59 60
src/main/resources/static/real_control_v2/js/data/json/north_toolbar.json
@@ -82,6 +82,13 @@ @@ -82,6 +82,13 @@
82 "event": "form_inoutstation", 82 "event": "form_inoutstation",
83 "icon": "uk-icon-table" 83 "icon": "uk-icon-table"
84 } 84 }
  85 + ,
  86 + {
  87 + "id": 4.10,
  88 + "text": "客流记录",
  89 + "event": "form_loggerr_dkl",
  90 + "icon": "uk-icon-table"
  91 + }
85 ] 92 ]
86 }, 93 },
87 { 94 {
src/main/resources/static/real_control_v2/js/line_schedule/legend.js
@@ -75,8 +75,11 @@ var gb_sch_legend = (function () { @@ -75,8 +75,11 @@ var gb_sch_legend = (function () {
75 function popcf(data){ 75 function popcf(data){
76 if(data.num < 5){ 76 if(data.num < 5){
77 $("#"+data.lineCode+"_"+data.xlDir).text("(客流正常)"); 77 $("#"+data.lineCode+"_"+data.xlDir).text("(客流正常)");
  78 + $("#"+data.lineCode+"_"+data.xlDir).css("color", "#2765A7");
  79 +
78 }else { 80 }else {
79 $("#"+data.lineCode+"_"+data.xlDir).text("(客流拥挤)"); 81 $("#"+data.lineCode+"_"+data.xlDir).text("(客流拥挤)");
  82 + $("#"+data.lineCode+"_"+data.xlDir).css("color", "red");
80 } 83 }
81 84
82 } 85 }
src/main/resources/static/real_control_v2/js/north/toolbar.js
@@ -229,7 +229,10 @@ var gb_northToolbar = (function () { @@ -229,7 +229,10 @@ var gb_northToolbar = (function () {
229 }, 229 },
230 form_shifday: function () { 230 form_shifday: function () {
231 gb_embed_form_hanlde.open_modal_form_fragment('/pages/mforms/shifdays/shifday.html', '班次车辆人员日统计'); 231 gb_embed_form_hanlde.open_modal_form_fragment('/pages/mforms/shifdays/shifday.html', '班次车辆人员日统计');
232 - } 232 + },
  233 + form_loggerr_dkl: function () {
  234 + gb_embed_form_hanlde.open_modal_form_fragment('/pages/forms/zndd/logger_dkl.html', '客流记录');
  235 + },
233 }; 236 };
234 237
235 return { 238 return {