Commit 7d2f98d69b0fab75cb20f4cb282a3f90dfcae4f9

Authored by 潘钊
1 parent 57d776b7

线路添加删除功能..

src/main/java/com/bsth/controller/LineController.java
1 package com.bsth.controller; 1 package com.bsth.controller;
2 2
3 -import java.text.ParseException;  
4 -import java.text.SimpleDateFormat;  
5 -import java.util.Date;  
6 -import java.util.HashMap;  
7 -import java.util.Map;  
8 -  
9 -import org.springframework.beans.factory.annotation.Autowired;  
10 -import org.springframework.web.bind.annotation.RequestMapping;  
11 -import org.springframework.web.bind.annotation.RequestMethod;  
12 -import org.springframework.web.bind.annotation.RequestParam;  
13 -import org.springframework.web.bind.annotation.RestController;  
14 -  
15 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
16 import com.bsth.entity.Line; 4 import com.bsth.entity.Line;
17 import com.bsth.entity.LineVersions; 5 import com.bsth.entity.LineVersions;
18 import com.bsth.service.LineService; 6 import com.bsth.service.LineService;
19 import com.bsth.service.LineVersionsService; 7 import com.bsth.service.LineVersionsService;
20 import com.bsth.util.GetUIDAndCode; 8 import com.bsth.util.GetUIDAndCode;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.RequestParam;
  13 +import org.springframework.web.bind.annotation.RestController;
  14 +
  15 +import java.text.ParseException;
  16 +import java.text.SimpleDateFormat;
  17 +import java.util.Date;
  18 +import java.util.HashMap;
  19 +import java.util.Map;
21 20
22 /** 21 /**
23 * 22 *
@@ -123,4 +122,14 @@ public class LineController extends BaseController<Line, Integer> { @@ -123,4 +122,14 @@ public class LineController extends BaseController<Line, Integer> {
123 Line findByID(@RequestParam(defaultValue = "id") Integer id){ 122 Line findByID(@RequestParam(defaultValue = "id") Integer id){
124 return service.findById(id); 123 return service.findById(id);
125 } 124 }
  125 +
  126 + /**
  127 + * 删除线路
  128 + * @param id
  129 + * @return
  130 + */
  131 + @RequestMapping(value ="/remove" , method = RequestMethod.POST)
  132 + public Map<String, Object> remove(Integer id){
  133 + return service.remove(id);
  134 + }
126 } 135 }
src/main/java/com/bsth/entity/Line.java
@@ -160,6 +160,11 @@ public class Line implements Serializable { @@ -160,6 +160,11 @@ public class Line implements Serializable {
160 160
161 /** 是否在使用 <1:是;0:否> bit length(50) */ 161 /** 是否在使用 <1:是;0:否> bit length(50) */
162 private Integer inUse; 162 private Integer inUse;
  163 +
  164 + /**
  165 + * 逻辑删除标记 为 1:标识已删除
  166 + */
  167 + private Integer remove;
163 168
164 public Integer getSpacGrade() { 169 public Integer getSpacGrade() {
165 return spacGrade; 170 return spacGrade;
@@ -492,6 +497,13 @@ public class Line implements Serializable { @@ -492,6 +497,13 @@ public class Line implements Serializable {
492 public void setSfyy(Integer sfyy) { 497 public void setSfyy(Integer sfyy) {
493 this.sfyy = sfyy; 498 this.sfyy = sfyy;
494 } 499 }
495 -  
496 - 500 +
  501 +
  502 + public Integer getRemove() {
  503 + return remove;
  504 + }
  505 +
  506 + public void setRemove(Integer remove) {
  507 + this.remove = remove;
  508 + }
497 } 509 }
src/main/java/com/bsth/service/LineService.java
1 package com.bsth.service; 1 package com.bsth.service;
2 2
3 -import java.util.Map;  
4 -  
5 -import org.springframework.web.bind.annotation.RequestMapping;  
6 -import org.springframework.web.bind.annotation.RequestMethod;  
7 -  
8 import com.bsth.entity.Line; 3 import com.bsth.entity.Line;
9 4
  5 +import java.util.Map;
  6 +
10 /** 7 /**
11 * 8 *
12 * @Interface: LineService(线路service业务层实现接口) 9 * @Interface: LineService(线路service业务层实现接口)
@@ -38,4 +35,6 @@ public interface LineService extends BaseService&lt;Line, Integer&gt; { @@ -38,4 +35,6 @@ public interface LineService extends BaseService&lt;Line, Integer&gt; {
38 String lineCodeVerification(String lineCode); 35 String lineCodeVerification(String lineCode);
39 36
40 Map<String, Object> update(Line l); 37 Map<String, Object> update(Line l);
  38 +
  39 + Map<String,Object> remove(Integer id);
41 } 40 }
src/main/java/com/bsth/service/impl/LineServiceImpl.java
1 package com.bsth.service.impl; 1 package com.bsth.service.impl;
2 2
3 -import java.util.HashMap;  
4 -import java.util.Map;  
5 -  
6 -import org.springframework.beans.factory.annotation.Autowired;  
7 -import org.springframework.stereotype.Service;  
8 -import org.springframework.transaction.annotation.Transactional;  
9 -  
10 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
11 import com.bsth.entity.Line; 4 import com.bsth.entity.Line;
12 import com.bsth.repository.LineRepository; 5 import com.bsth.repository.LineRepository;
13 import com.bsth.service.LineService; 6 import com.bsth.service.LineService;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.jdbc.core.JdbcTemplate;
  9 +import org.springframework.stereotype.Service;
  10 +import org.springframework.transaction.annotation.Transactional;
  11 +
  12 +import java.util.HashMap;
  13 +import java.util.Map;
14 14
15 /** 15 /**
16 * 16 *
@@ -34,6 +34,9 @@ public class LineServiceImpl extends BaseServiceImpl&lt;Line, Integer&gt; implements L @@ -34,6 +34,9 @@ public class LineServiceImpl extends BaseServiceImpl&lt;Line, Integer&gt; implements L
34 @Autowired 34 @Autowired
35 private LineRepository repository; 35 private LineRepository repository;
36 36
  37 + @Autowired
  38 + JdbcTemplate jdbcTemplate;
  39 +
37 /** 40 /**
38 * 获取线路编码 41 * 获取线路编码
39 * 42 *
@@ -86,4 +89,32 @@ public class LineServiceImpl extends BaseServiceImpl&lt;Line, Integer&gt; implements L @@ -86,4 +89,32 @@ public class LineServiceImpl extends BaseServiceImpl&lt;Line, Integer&gt; implements L
86 return map; 89 return map;
87 } 90 }
88 91
  92 + @Override
  93 + public Map<String, Object> remove(Integer id) {
  94 + Map<String, Object> map = new HashMap<>();
  95 +
  96 + try{
  97 + if(null == id){
  98 + map.put("status", ResponseCode.ERROR);
  99 + map.put("msg", "参数异常");
  100 + return map;
  101 + }
  102 +
  103 + int destroy = jdbcTemplate.queryForObject("select destroy from bsth_c_line where id=" + id, Integer.class);
  104 +
  105 + if(destroy==0){
  106 + map.put("status", ResponseCode.ERROR);
  107 + map.put("msg", "你只能删除已撤销的线路!");
  108 + return map;
  109 + }
  110 +
  111 + jdbcTemplate.update("update bsth_c_line set `remove`=1 where id=?", id);
  112 + map.put("status", ResponseCode.SUCCESS);
  113 + }catch (Exception e){
  114 + logger.error("", e);
  115 + map.put("status", ResponseCode.ERROR);
  116 + map.put("msg", e.getMessage());
  117 + }
  118 + return map;
  119 + }
89 } 120 }
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -1234,7 +1234,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1234,7 +1234,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1234 ScheduleModifyLogger.sftz(sch, fcsjActual, remarks); 1234 ScheduleModifyLogger.sftz(sch, fcsjActual, remarks);
1235 1235
1236 sch.setFcsjActualAll(fcsjActual); 1236 sch.setFcsjActualAll(fcsjActual);
1237 - sch.addRemarks(remarks); 1237 + sch.setRemark(remarks);
1238 sch.calcStatus(); 1238 sch.calcStatus();
1239 //if(sch.isLate2()){ 1239 //if(sch.isLate2()){
1240 //取消应发未到标记 1240 //取消应发未到标记
src/main/resources/static/pages/base/line/js/line-list-table.js
@@ -180,6 +180,7 @@ @@ -180,6 +180,7 @@
180 params['order'] = 'id'; 180 params['order'] = 'id';
181 // 记录当前页数 181 // 记录当前页数
182 params['page'] = page; 182 params['page'] = page;
  183 + params['remove_ne'] = 1;
183 // 弹出正在加载层 184 // 弹出正在加载层
184 var i = layer.load(2); 185 var i = layer.load(2);
185 getComp(function(rs) { 186 getComp(function(rs) {
src/main/resources/static/pages/base/line/list.html
1 <!-- <link href="/pages/base/line/css/animate.css" rel="stylesheet" type="text/css" /> 1 <!-- <link href="/pages/base/line/css/animate.css" rel="stylesheet" type="text/css" />
2 <link href="/pages/base/line/css/tipso.css" rel="stylesheet" type="text/css" /> --> 2 <link href="/pages/base/line/css/tipso.css" rel="stylesheet" type="text/css" /> -->
3 <!-- 片段标题 START --> 3 <!-- 片段标题 START -->
  4 +<style>
  5 + a.ct_base_line_delete_link{
  6 + font-size: 12px;
  7 + color: red;
  8 + vertical-align: bottom;
  9 + display: inline-block;
  10 + margin-left: 5px;
  11 + text-decoration: underline;
  12 + }
  13 +
  14 + a.ct_base_line_delete_link:hover{
  15 + color: #d11608;
  16 + }
  17 +</style>
4 <div class="page-head"> 18 <div class="page-head">
5 <div class="page-title"> 19 <div class="page-title">
6 <h1>线路信息</h1> 20 <h1>线路信息</h1>
@@ -355,6 +369,10 @@ @@ -355,6 +369,10 @@
355 <td> 369 <td>
356 <a href="details.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a> 370 <a href="details.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a>
357 <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 修改 </a> 371 <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 修改 </a>
  372 +
  373 + {{if obj.destroy==1}}
  374 + <a class="ct_base_line_delete_link" data-id="{{obj.id}}" data-name="{{obj.name}}"> 删除 </a>
  375 + {{/if}}
358 </td> 376 </td>
359 </tr> 377 </tr>
360 {{/each}} 378 {{/each}}
@@ -365,4 +383,23 @@ @@ -365,4 +383,23 @@
365 {{/if}} 383 {{/if}}
366 </script> 384 </script>
367 <!-- 线路信息片段JS模块 --> 385 <!-- 线路信息片段JS模块 -->
368 -<script src="/pages/base/line/js/line-list-table.js"></script>  
369 \ No newline at end of file 386 \ No newline at end of file
  387 +<script src="/pages/base/line/js/line-list-table.js"></script>
  388 +<script>
  389 + (function () {
  390 + $(document).on('click', 'a.ct_base_line_delete_link', function () {
  391 + var id = $(this).data('id'),
  392 + name = $(this).data('name');
  393 +
  394 + layer.confirm('你确定要删除线路【'+name+'】?', {
  395 + btn: ['确定删除','取消'] //按钮
  396 + }, function(){
  397 + layer.msg('操作中...', {icon: 16,shade: 0.01});
  398 + $post('/line/remove', {id: id}, function (rs) {
  399 + layer.msg('删除成功!');
  400 + $('.filter-submit.margin-bottom').trigger('click');
  401 + });
  402 +
  403 + });
  404 + });
  405 + })();
  406 +</script>
370 \ No newline at end of file 407 \ No newline at end of file
src/main/resources/static/real_control_v2/css/main.css
@@ -338,6 +338,9 @@ svg.line-chart g.merge-item text { @@ -338,6 +338,9 @@ svg.line-chart g.merge-item text {
338 .tooltip span.field { 338 .tooltip span.field {
339 color: #7d7d7b; 339 color: #7d7d7b;
340 margin-right: 5px; 340 margin-right: 5px;
  341 + width: 52px;
  342 + display: inline-block;
  343 + text-align: right;
341 } 344 }
342 345
343 .tooltip .tip_map_wrap { 346 .tooltip .tip_map_wrap {
@@ -2026,4 +2029,10 @@ dl.active &gt; dd.disabled { @@ -2026,4 +2029,10 @@ dl.active &gt; dd.disabled {
2026 100% { 2029 100% {
2027 background: rgba(254, 235, 69, 0.38); 2030 background: rgba(254, 235, 69, 0.38);
2028 } 2031 }
  2032 +}
  2033 +
  2034 +.home_svg_tips>div{
  2035 + overflow: hidden;
  2036 + text-overflow: ellipsis;
  2037 + white-space: nowrap;
2029 } 2038 }
2030 \ No newline at end of file 2039 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/home/tooltip.html
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <div class="tooltip" data-id="{{deviceId}}"> 3 <div class="tooltip" data-id="{{deviceId}}">
4 <div class="tooltip-container"> 4 <div class="tooltip-container">
5 5
6 - <div class="cont-text-panel"> 6 + <div class="cont-text-panel home_svg_tips">
7 <div class="title"> 7 <div class="title">
8 <a href="javascript:;" data-for="station" class="tip_modal"> 8 <a href="javascript:;" data-for="station" class="tip_modal">
9 {{nbbm}} 9 {{nbbm}}
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 <div> 21 <div>
22 <span class="field">车牌号:</span>{{plateNo}} 22 <span class="field">车牌号:</span>{{plateNo}}
23 </div> 23 </div>
24 - <div> 24 + <div title="{{stationName}}">
25 <span class="field">站点:</span>{{stationName}} 25 <span class="field">站点:</span>{{stationName}}
26 </div> 26 </div>
27 <!-- <div> 27 <!-- <div>
@@ -30,9 +30,19 @@ @@ -30,9 +30,19 @@
30 <div> 30 <div>
31 <span class="field">设备:</span>{{deviceId}} 31 <span class="field">设备:</span>{{deviceId}}
32 </div> 32 </div>
33 - <div> 33 + <!--<div>
34 <span class="field">坐标:</span>{{lon}} {{lat}} 34 <span class="field">坐标:</span>{{lon}} {{lat}}
35 - </div> 35 + </div>-->
  36 + {{if sch!=null}}
  37 + <div>
  38 + <span class="field">驾驶员:</span>{{sch.jGh}}/{{sch.jName}}
  39 + </div>
  40 + {{if sch.sGh!=null && sch.sGh!=""}}
  41 + <div>
  42 + <span class="field">售票员:</span>{{sch.sGh}}/{{sch.sName}}
  43 + </div>
  44 + {{/if}}
  45 + {{/if}}
36 <div> 46 <div>
37 <span class="field">速度:</span>{{speed>99?'..':speed}}</div> 47 <span class="field">速度:</span>{{speed>99?'..':speed}}</div>
38 <div> 48 <div>
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
@@ -472,6 +472,11 @@ var gb_schedule_table = (function () { @@ -472,6 +472,11 @@ var gb_schedule_table = (function () {
472 //滚动到下一个班次 472 //滚动到下一个班次
473 scroToDl(nextSch); 473 scroToDl(nextSch);
474 } 474 }
  475 +
  476 + //如果有打开轨迹回放
  477 + if($('.layui-layer.play_back-layer').is(':visible')){
  478 + gb_map_play_back.setParam(sch);
  479 + }
475 }); 480 });
476 481
477 //路牌点击 482 //路牌点击
src/main/resources/static/real_control_v2/mapmonitor/js/playback.js
@@ -10,6 +10,18 @@ var gb_map_play_back = (function () { @@ -10,6 +10,18 @@ var gb_map_play_back = (function () {
10 dom = rs; 10 dom = rs;
11 }); 11 });
12 12
  13 + var setParam = function (sch) {
  14 + console.log('sch', sch);
  15 + var f = $('.play-back-form form'),
  16 + st = (sch['fcsjActualTime']?sch['fcsjActualTime']:sch['dfsjT']) - 1000 * 60 * 5,
  17 + et = (sch['zdsjActualTime']?sch['zdsjActualTime']:sch['zdsjT']) + 1000 * 60 * 5,
  18 + fs = 'YYYY-MM-DD HH:mm';
  19 +
  20 + $('[name=nbbm]', f).val(sch.clZbh);
  21 + $('[name=startTime]', f).val(moment(st).format(fs));
  22 + $('[name=endTime]', f).val(moment(et).format(fs));
  23 + };
  24 +
13 var initParams = function (deviceId, nbbm) { 25 var initParams = function (deviceId, nbbm) {
14 //关闭infowindow 26 //关闭infowindow
15 if (deviceId) 27 if (deviceId)
@@ -96,6 +108,7 @@ var gb_map_play_back = (function () { @@ -96,6 +108,7 @@ var gb_map_play_back = (function () {
96 108
97 return { 109 return {
98 initParams: initParams, 110 initParams: initParams,
99 - listToExcel: listToExcel 111 + listToExcel: listToExcel,
  112 + setParam: setParam
100 } 113 }
101 })(); 114 })();
102 \ No newline at end of file 115 \ No newline at end of file