Commit 90516b3461fe50c8431f45fd1a8f4aa209806dc4

Authored by 潘钊
1 parent 9f6fce8d

update

... ... @@ -242,4 +242,8 @@
242 242 <url>http://repo.spring.io/milestone</url>
243 243 </pluginRepository>
244 244 </pluginRepositories>
  245 +
  246 + <properties>
  247 + <start-class>com.bsth.Application</start-class>
  248 + </properties>
245 249 </project>
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -103,4 +103,30 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
103 103 public List<Map<String, String>> findCarByLine(@RequestParam String lineCode){
104 104 return scheduleRealInfoService.findCarByLine(lineCode);
105 105 }
  106 +
  107 + /**
  108 + *
  109 + * @Title: sreachNbbm
  110 + * @Description: TODO(搜索车辆内部编码)
  111 + * @throws
  112 + */
  113 + @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET)
  114 + public List<Map<String, String>> sreachVehic(@RequestParam String nbbm){
  115 + return scheduleRealInfoService.sreachVehic(nbbm);
  116 + }
  117 +
  118 + /**
  119 + *
  120 + * @Title: adjust
  121 + * @Description: TODO(调整人车)
  122 + * @param @param id 班次ID
  123 + * @param @param nbbm 内部编码
  124 + * @param @param jsy 驾驶员
  125 + * @param @param spy 售票员
  126 + * @throws
  127 + */
  128 + @RequestMapping(value = "/adjust", method = RequestMethod.POST)
  129 + public Map<String, Object> adjust(@RequestParam Long id, @RequestParam String nbbm, @RequestParam String jsy, @RequestParam String spy){
  130 + return scheduleRealInfoService.adjust(id, nbbm, jsy, spy);
  131 + }
106 132 }
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -24,4 +24,39 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
24 24  
25 25 List<Map<String, String>> findCarByLine(String lineCode);
26 26  
  27 + List<Map<String, String>> sreachVehic(String nbbm);
  28 +
  29 + Map<String, Object> adjust(Long id, String nbbm, String jsy, String spy);
  30 +
  31 + /**
  32 + *
  33 + * @Title: adjustCar
  34 + * @Description: TODO(班次调整车辆)
  35 + * @param @param schedule 班次
  36 + * @param @param car 车辆自编号
  37 + * @throws
  38 + */
  39 + void adjustCar(ScheduleRealInfo schedule, String car);
  40 +
  41 + /**
  42 + *
  43 + * @Title: adjustDriver
  44 + * @Description: TODO(班次调整驾驶员)
  45 + * @param @param schedule 班次
  46 + * @param @param driver 驾驶员工号
  47 + * @throws
  48 + */
  49 + void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName);
  50 +
  51 + /**
  52 + *
  53 + * @Title: adjustConductor
  54 + * @Description: TODO(班次调整售票员)
  55 + * @param @param schedule 班次
  56 + * @param @param conductor 售票员工号
  57 + * @throws
  58 + */
  59 + void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName);
  60 +
  61 +
27 62 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -7,9 +7,11 @@ import java.util.Date;
7 7 import java.util.HashMap;
8 8 import java.util.List;
9 9 import java.util.Map;
  10 +import java.util.Set;
10 11  
11 12 import javax.transaction.Transactional;
12 13  
  14 +import org.apache.commons.lang3.StringUtils;
13 15 import org.slf4j.Logger;
14 16 import org.slf4j.LoggerFactory;
15 17 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -17,6 +19,7 @@ import org.springframework.stereotype.Service;
17 19  
18 20 import com.bsth.common.ResponseCode;
19 21 import com.bsth.entity.Cars;
  22 +import com.bsth.entity.Line;
20 23 import com.bsth.entity.Personnel;
21 24 import com.bsth.entity.realcontrol.ScheduleRealInfo;
22 25 import com.bsth.entity.schedule.CarConfigInfo;
... ... @@ -29,6 +32,7 @@ import com.bsth.security.util.SecurityUtils;
29 32 import com.bsth.service.impl.BaseServiceImpl;
30 33 import com.bsth.service.realcontrol.ScheduleRealInfoService;
31 34 import com.bsth.service.realcontrol.buffer.ScheduleBuffer;
  35 +import com.bsth.vehicle.common.CommonMapped;
32 36 import com.google.common.base.Splitter;
33 37 import com.google.common.collect.ArrayListMultimap;
34 38 import com.google.common.collect.Lists;
... ... @@ -242,4 +246,83 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
242 246 ScheduleBuffer.put(t);
243 247 return map;
244 248 }
  249 +
  250 + @Override
  251 + public List<Map<String, String>> sreachVehic(String nbbm) {
  252 + //转大写
  253 + nbbm = nbbm.toUpperCase();
  254 +
  255 + List<Map<String, String>> list = new ArrayList<>();
  256 + Map<String, String> map;
  257 + Set<String> allSet = CommonMapped.vehicCompanyMap.keySet();
  258 +
  259 + Line line;
  260 + for(String k : allSet){
  261 + if(k.indexOf(nbbm) != -1){
  262 + //所属线路
  263 + map = new HashMap<>();
  264 + line = CommonMapped.vehicLineMap.get(k);
  265 + map.put("id", k);
  266 + map.put("text", k);
  267 + if(null != line){
  268 + map.put("lineName", line.getName());
  269 + map.put("lineCode", line.getLineCode());
  270 + }
  271 +
  272 + list.add(map);
  273 + }
  274 +
  275 + if(list.size() > 20)
  276 + break;
  277 + }
  278 + return list;
  279 + }
  280 +
  281 + @Override
  282 + public Map<String, Object> adjust(Long id, String nbbm, String jsy, String spy) {
  283 + //班次
  284 + ScheduleRealInfo schedule = ScheduleBuffer.pkSchedulMap.get(id);
  285 +
  286 + //换车
  287 + if(!StringUtils.isBlank(nbbm)){
  288 + adjustCar(schedule, nbbm);
  289 + }
  290 +
  291 + List<String> tempArray;
  292 + //换驾驶员
  293 + if(!StringUtils.isBlank(jsy)){
  294 + tempArray = Splitter.on("/").splitToList(jsy);
  295 + adjustDriver(schedule, tempArray.get(0), tempArray.get(1));
  296 + }
  297 +
  298 + //换售票员
  299 + if(!StringUtils.isBlank(spy)){
  300 + tempArray = Splitter.on("/").splitToList(spy);
  301 + adjustConductor(schedule, tempArray.get(0), tempArray.get(1));
  302 + }
  303 +
  304 + ScheduleBuffer.persistentList.add(schedule);
  305 +
  306 + Map<String, Object> map = new HashMap<>();
  307 + map.put("status", 200);
  308 + map.put("t", schedule);
  309 + return map;
  310 + }
  311 +
  312 + @Override
  313 + public void adjustCar(ScheduleRealInfo schedule, String car) {
  314 + schedule.setClZbh(car);
  315 + }
  316 +
  317 + @Override
  318 + public void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName) {
  319 + schedule.setjGh(driver);
  320 + schedule.setjName(driverName);
  321 + }
  322 +
  323 + @Override
  324 + public void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName) {
  325 + schedule.setsGh(conductor);
  326 + schedule.setsName(conductorName);
  327 + }
245 328 }
... ...
src/main/java/com/bsth/vehicle/common/CommonMapped.java
... ... @@ -2,6 +2,7 @@ package com.bsth.vehicle.common;
2 2  
3 3 import java.util.Map;
4 4  
  5 +import com.bsth.entity.Line;
5 6 import com.google.common.collect.BiMap;
6 7  
7 8 /**
... ... @@ -35,6 +36,11 @@ public class CommonMapped {
35 36 public static Map<String , String> vehicCompanyMap;
36 37  
37 38 /**
  39 + * 车辆和线路对照
  40 + */
  41 + public static Map<String, Line> vehicLineMap;
  42 +
  43 + /**
38 44 * 站点编码和名称对照,包括停车场
39 45 *(K: 站点编码 ,V:站点名称)
40 46 */
... ...
src/main/java/com/bsth/vehicle/common/CommonRefreshThread.java
... ... @@ -11,10 +11,13 @@ import org.springframework.stereotype.Component;
11 11  
12 12 import com.bsth.entity.CarPark;
13 13 import com.bsth.entity.Cars;
  14 +import com.bsth.entity.Line;
14 15 import com.bsth.entity.Station;
  16 +import com.bsth.entity.schedule.CarConfigInfo;
15 17 import com.bsth.repository.CarParkRepository;
16 18 import com.bsth.repository.CarsRepository;
17 19 import com.bsth.repository.StationRepository;
  20 +import com.bsth.repository.schedule.CarConfigInfoRepository;
18 21 import com.google.common.collect.BiMap;
19 22 import com.google.common.collect.HashBiMap;
20 23  
... ... @@ -38,6 +41,9 @@ public class CommonRefreshThread extends Thread{
38 41 @Autowired
39 42 CarParkRepository carParkRepository;
40 43  
  44 + @Autowired
  45 + CarConfigInfoRepository carConfigInfoRepository;
  46 +
41 47 Logger logger = LoggerFactory.getLogger(this.getClass());
42 48  
43 49 @Override
... ... @@ -45,13 +51,33 @@ public class CommonRefreshThread extends Thread{
45 51 try {
46 52 initVehicMapp();
47 53 initStationCodeMap();
  54 + initVehicLineMap();
48 55 } catch (Exception e) {
  56 + e.printStackTrace();
49 57 logger.error("", e);
50 58 }
51 59 }
52 60  
53 61 /**
54 62 *
  63 + * @Title: initVehicLineMap
  64 + * @Description: TODO(根据车辆配置,加载车辆和线路对照数据)
  65 + * @throws
  66 + */
  67 + private void initVehicLineMap() {
  68 + Iterator<CarConfigInfo> allIterator = carConfigInfoRepository.findAll().iterator();
  69 + Map<String, Line> ccMap = new HashMap<>();
  70 +
  71 + CarConfigInfo cci;
  72 + while(allIterator.hasNext()){
  73 + cci = allIterator.next();
  74 + ccMap.put(cci.getCl().getInsideCode(), cci.getXl());
  75 + }
  76 + CommonMapped.vehicLineMap = ccMap;
  77 + }
  78 +
  79 + /**
  80 + *
55 81 * @Title: initDeviceMapp
56 82 * @Description: TODO(初始化车辆相关对照)
57 83 */
... ...
src/main/resources/fatso/start.js
... ... @@ -11,7 +11,7 @@ var fs = require(&#39;fs&#39;)
11 11 ,crypto = require("crypto");
12 12  
13 13 //不参与的目录
14   -var excludes = ['scheduleApp']
  14 +var excludes = ['scheduleApp', 'trafficManage']
15 15 ,ep = new EventProxy()
16 16 ,pName = 'bsth_control'
17 17 ,path = process.cwd()
... ...
src/main/resources/static/index.html
... ... @@ -19,7 +19,7 @@
19 19 <!-- MULTI-select 多选下拉框美化 -->
20 20 <link href="/metronic_v4.5.4/plugins/jquery-multi-select/css/multi-select.css" rel="stylesheet" type="text/css" />
21 21 <!-- METRONIC style -->
22   -<link href="/metronic_v4.5.4/layout4/css/themes/default.min.css" rel="stylesheet" type="text/css" id="style_color" />
  22 +<link href="/metronic_v4.5.4/layout4/css/themes/light.min.css" rel="stylesheet" type="text/css" id="style_color" />
23 23 <link href="/metronic_v4.5.4/css/components.css" rel="stylesheet" type="text/css" />
24 24 <link href="/metronic_v4.5.4/css/plugins.css" rel="stylesheet" type="text/css" />
25 25 <link href="/metronic_v4.5.4/layout4/css/layout.min.css" rel="stylesheet" type="text/css" />
... ...
src/main/resources/static/pages/control/line/child_pages/child_task.html
... ... @@ -160,8 +160,10 @@ var stationRoute;
160 160 var lineInformation;
161 161  
162 162 var $mainTab = $('.custom-table-body table.mainTable');
163   -
164 163 var $subTab = $('.custom-table-body table.subTable');
  164 +
  165 +var _data; //data.js引用
  166 +var _alone; //alone.js 引用
165 167 $(function(){
166 168 //var storage = window.localStorage;
167 169 var lineCodeMaps;
... ... @@ -173,9 +175,6 @@ $(function(){
173 175 //班次ID和班次映射
174 176 var scheduleIdMap;
175 177  
176   - var _data; //data.js引用
177   - var _alone; //alone.js 引用
178   -
179 178 //滚动时固定表头
180 179 $('.custom-table-panel').on('scroll', function(){
181 180 var top = $(this).scrollTop()
... ...
src/main/resources/static/pages/control/line/child_pages/vehicAndper_adjust.html
... ... @@ -48,29 +48,28 @@
48 48 <div class="form-custom-row">
49 49 <div class="item full" >
50 50 <span class="item-label" style="width: 80px;">内部编码: </span>
51   - <select class="form-control pd90" >
52   - <option value="W2B-001">W2B-001</option>
53   - </select>
  51 + <select class="form-control pd90" id="vehicSearchSelect"></select>
54 52 </div>
55 53 </div>
56 54  
57   - <div class="form-custom-row">
  55 + <div class="form-custom-row" id="borrowInfoPanel" style="display: none;">
58 56 <div class="item full" >
59 57 <span class="item-label" style="width: 80px;">借用时间: </span>
60 58  
61 59 <div style="display: inline-block;">
62   - <input class="form-control" value="17:26">
  60 + <input type="time" class="form-control" name="borrowStart" value="17:26" style="width: 160px;">
63 61 &nbsp;&nbsp;至&nbsp;&nbsp;
64   - <input class="form-control" value="23:59" >
  62 + <input type="time" class="form-control" name="borrowEnd" value="23:59" style="width: 160px;">
65 63 </div>
  64 + &nbsp;&nbsp;
  65 + <input type="checkbox" class="icheck" checked="checked" > 本次使用完交还原线路
66 66 </div>
67 67 </div>
68   -
  68 + <hr>
69 69 <div class="form-custom-row">
70 70 <div class="item full" >
71 71 <span class="item-label" style="width: 80px;">驾驶员: </span>
72   - <select class="form-control pd90">
73   - <option value="000001/备1">000001/备1</option>
  72 + <select class="form-control pd90" name="jGh">
74 73 </select>
75 74 </div>
76 75 </div>
... ... @@ -78,8 +77,7 @@
78 77 <div class="form-custom-row">
79 78 <div class="item full" >
80 79 <span class="item-label" style="width: 80px;">售票员: </span>
81   - <select class="form-control pd90">
82   - <option value="002301/备1">002301/田华</option>
  80 + <select class="form-control pd90" name="sGh">
83 81 </select>
84 82 </div>
85 83 </div>
... ... @@ -91,6 +89,7 @@
91 89 </button>
92 90 <button type="button" class="btn layui-layer-close">取消</button>
93 91 </div>
  92 + <br>
94 93 </div>
95 94 </form>
96 95 </div>
... ... @@ -112,9 +111,6 @@
112 111 (function() {
113 112 var _data, _alone, scheduleLineMap, scheduleIdMap;
114 113  
115   - //停靠表头
116   - /* var width = $('.custom-table-body').width();
117   - $('.custom-table-header').css('position', 'fixed').css('width', width); */
118 114 //滚动时固定表头
119 115 $('.custom-table-panel').on('scroll', function(){
120 116 var top = $(this).scrollTop()
... ... @@ -186,10 +182,26 @@
186 182 refreshMainList();
187 183 });
188 184 }
189   - //人员下拉框
190   - //carAndPersInit(lineCode);
  185 +
  186 + persionInit(lineCode);
191 187 }
192 188  
  189 + //初始化人员下拉框
  190 + var placeholder = {id: ' ', text: '请选择...'};
  191 + var persionInit = function(lineCode){
  192 + //驾驶员
  193 + $.get('/realSchedule/driver', {lineCode: lineCode}, function(rs){
  194 + rs.splice(0, 0, placeholder);
  195 + initPinYinSelect2(wrap + ' select[name=jGh]', rs);
  196 +
  197 + });
  198 + //售票员
  199 + $.get('/realSchedule/conductor', {lineCode: lineCode}, function(rs){
  200 + rs.splice(0, 0, placeholder);
  201 + initPinYinSelect2(wrap + ' select[name=sGh]', rs);
  202 + });
  203 + };
  204 +
193 205 /**
194 206 * 刷新主任务列表
195 207 */
... ... @@ -216,6 +228,104 @@
216 228 increaseArea: '20%'
217 229 });
218 230 }
  231 +
  232 + //确定
  233 + $('.confirm', wrap).on('click', function(){
  234 + var nbbm = $('#vehicSearchSelect').val()
  235 + ,jsy = $('select[name=jGh]', wrap).val()
  236 + ,spy = $('select[name=sGh]', wrap).val(), id;
  237 +
  238 + console.log(nbbm, jsy, spy);
  239 + var idArray = [];
  240 + $.each($('.adjust_tr_active', wrap), function(){
  241 + idArray.push($(this).data('id'));
  242 + });
  243 +
  244 + syncSubmit(idArray, {nbbm: nbbm, jsy: jsy, spy: spy}
  245 + ,function(){
  246 + layer.msg('操作完成!');
  247 + refreshMainList();
  248 + });
  249 + });
  250 + });
  251 +
  252 + function syncSubmit(idArray, data, cb){
  253 + if(idArray.length == 0) return;
  254 + var i = 0, len = idArray.length;
  255 + (function(){
  256 + if(i == len){
  257 + cb && cb();
  258 + scheduleLineMap = _data.getLineLpMap();
  259 + return;
  260 + }
  261 + var f = arguments.callee;
  262 +
  263 + data.id = idArray[i];
  264 + $.post('/realSchedule/adjust', data, function(rs){
  265 + //更新前端缓存
  266 + if(rs.status == 200){
  267 + _data.updateSchedule(rs.t);
  268 + }
  269 +
  270 + i ++;
  271 + //做一层防护,防止缺心眼出现无限循环提交
  272 + if(i == 0)
  273 + return;
  274 + f();
  275 + });
  276 + })();
  277 + }
  278 +
  279 + //车辆内部编码下拉搜索框
  280 + $('#vehicSearchSelect').select2({
  281 + ajax: {
  282 + url: '/realSchedule/sreachVehic',
  283 + dataType: 'json',
  284 + delay: 150,
  285 + data: function(params){
  286 + return{nbbm: params.term};
  287 + },
  288 + processResults: function (data) {
  289 + return {
  290 + results: data
  291 + };
  292 + },
  293 + cache: true
  294 + },
  295 + templateResult: function(repo){
  296 + if (repo.loading) return repo.text;
  297 + var h = '<span>'+repo.text+'</span>';
  298 + h += (repo.lineName?'&nbsp;<span class="select2-desc">'+repo.lineName+'</span>':'');
  299 + return h;
  300 + },
  301 + escapeMarkup: function (markup) { return markup; },
  302 + minimumInputLength: 1,
  303 + templateSelection: function(repo){
  304 + return repo.text;
  305 + },
  306 + language: {
  307 + noResults: function(){
  308 + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>';
  309 + },
  310 + inputTooShort : function(e) {
  311 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>';
  312 + },
  313 + searching : function() {
  314 + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
  315 + }
  316 + }
  317 + })
  318 + .on('select2:select', function(e){
  319 + var lineCode = e.params.data.lineCode;
  320 + if(lineCode)
  321 + if(lineCode != lineSelect.val()){
  322 + $('#borrowInfoPanel').show();
  323 + //借用时间为选中班次的第一个发车时间
  324 + var fcsj = $.trim($('.adjust_tr_active:eq(0) td:eq(0)').text());
  325 + $('input[name=borrowStart]', wrap).val(fcsj);
  326 + }
  327 + else
  328 + $('#borrowInfoPanel').hide();
219 329 });
220 330 })();
221 331 </script>
... ...
src/main/resources/static/pages/control/line/css/lineControl.css
... ... @@ -1844,4 +1844,14 @@ a.no_and_removeLink {
1844 1844  
1845 1845 tr.adjust_tr_active td{
1846 1846 border-bottom: 1px solid #3598dc !important;
  1847 + color: #3598dc;
  1848 +}
  1849 +
  1850 +.select2-results__option .select2-desc{
  1851 + font-size: 12px;
  1852 + color: gray;
  1853 +}
  1854 +
  1855 +.select2-results__option--highlighted .select2-desc{
  1856 + color: white;
1847 1857 }
... ...
src/main/resources/static/pages/control/line/js/data.js
... ... @@ -45,6 +45,11 @@ var _data = (function(){
45 45 schedules[sch.id] = sch;
46 46 lineLpMap[sch.xlBm][sch.lpName].push(sch);
47 47 },
  48 + //更新班次信息
  49 + updateSchedule: function(sch){
  50 + schedules[sch.id] = sch;
  51 + lineLpMap[sch.xlBm][sch.lpName].push(sch);
  52 + },
48 53 getLines: function(){
49 54 return JSON.parse(storage.getItem('lineControlItems'));
50 55 },
... ...
src/main/resources/static/pages/control/line/js/rightMenu.js
... ... @@ -147,15 +147,19 @@ var _menu = (function() {
147 147 });
148 148 },
149 149 //实发调整
150   - realOutgoAdjust: function(){
  150 + realOutgoAdjust: function(schedul){
151 151 layer.open({
152 152 type: 1,
153 153 area: ['350px', '455px'],
154 154 maxmin: true,
155   - content: template('real_outgo_adjust_body_temp', {}),
  155 + content: template('real_outgo_adjust_body_temp', schedul),
156 156 shift: 5,
157 157 title: '实发调整',
158 158 success: function(){
  159 + $('.confirm', '#realOutgoAdjust').on('click', function(){
  160 + //alert('提交...');
  161 +
  162 + });
159 163 }
160 164 });
161 165 },
... ... @@ -187,7 +191,7 @@ var _menu = (function() {
187 191 $.get('/pages/control/line/child_pages/vehicAndper_adjust.html', function(content){
188 192 layer.open({
189 193 type: 1,
190   - area: ['730px', '655px'],
  194 + area: '730px',
191 195 maxmin: true,
192 196 content: content,
193 197 shift: 5,
... ...
src/main/resources/static/pages/control/line/temps/alone_tp.html
... ... @@ -367,14 +367,14 @@
367 367 <div class="form-custom-row">
368 368 <div class="item full">
369 369 <span class="item-label" style="width: 80px;">车辆: </span>
370   - <input disabled class="form-control" value="W2B-095">
  370 + <input disabled class="form-control" value="{{clZbh}}">
371 371 </div>
372 372 </div>
373 373  
374 374 <div class="form-custom-row">
375 375 <div class="item full">
376 376 <span class="item-label" style="width: 80px;">路牌: </span>
377   - <input disabled class="form-control" value="K5">
  377 + <input disabled class="form-control" value="{{lpName}}">
378 378 </div>
379 379 </div>
380 380  
... ... @@ -382,7 +382,7 @@
382 382 <div class="item full">
383 383 <span class="item-label" style="width: 80px;">计发时刻: </span>
384 384 <select class="form-control" disabled>
385   - <option value="">11:58</option>
  385 + <option value="">{{fcsj}}</option>
386 386 </select>
387 387 </div>
388 388 </div>
... ... @@ -390,7 +390,7 @@
390 390 <div class="form-custom-row">
391 391 <div class="item full">
392 392 <span class="item-label" style="width: 80px;">实发时刻: </span>
393   - <input class="form-control" value="11:58">
  393 + <input class="form-control" value="{{fcsjActual}}" type="time">
394 394 </div>
395 395 </div>
396 396  
... ...