Commit 7ac2ae0561110fa3766ac045a8513c8e1da83d93

Authored by 潘钊
1 parent 151fe86f

update...

src/main/java/com/bsth/controller/real/CarParkRealController.java
@@ -27,4 +27,10 @@ public class CarParkRealController { @@ -27,4 +27,10 @@ public class CarParkRealController {
27 public Map<String, Object> realChange(@RequestParam String s, @RequestParam String d){ 27 public Map<String, Object> realChange(@RequestParam String s, @RequestParam String d){
28 return CarParkRealHandler.realChange(s, d); 28 return CarParkRealHandler.realChange(s, d);
29 } 29 }
  30 +
  31 +
  32 + @RequestMapping(value = "clear_berth", method = RequestMethod.POST)
  33 + public Map<String, Object> clear_berth(@RequestParam String b){
  34 + return CarParkRealHandler.clear_berth(b);
  35 + }
30 } 36 }
src/main/java/com/bsth/data/real_park/CarParkRealHandler.java
@@ -188,6 +188,28 @@ public class CarParkRealHandler { @@ -188,6 +188,28 @@ public class CarParkRealHandler {
188 return rs; 188 return rs;
189 } 189 }
190 190
  191 + /**
  192 + * 移除泊位上的车辆
  193 + * @param b
  194 + * @return
  195 + */
  196 + public static Map<String, Object> clear_berth(String b) {
  197 + Map<String, Object> rs = new HashMap();
  198 + try {
  199 + RealCarPark rcp1 = getByBerthName(b);
  200 +
  201 + if(null != rcp1)
  202 + busRcps.remove(rcp1.getNbbm());
  203 +
  204 + rs.put("status", ResponseCode.SUCCESS);
  205 + rs.put("list", allBus());
  206 + } catch (Exception e) {
  207 + logger.error("", e);
  208 + rs.put("status", ResponseCode.ERROR);
  209 + }
  210 + return rs;
  211 + }
  212 +
191 private static RealCarPark getByBerthName(String sName) { 213 private static RealCarPark getByBerthName(String sName) {
192 for (RealCarPark rcp : busRcps.values()) { 214 for (RealCarPark rcp : busRcps.values()) {
193 if (sName.equals(rcp.getBerthName())) 215 if (sName.equals(rcp.getBerthName()))
src/main/java/com/bsth/data/schedule/real/InOutScheduleDataBuffer.java
@@ -47,6 +47,9 @@ public class InOutScheduleDataBuffer implements CommandLineRunner { @@ -47,6 +47,9 @@ public class InOutScheduleDataBuffer implements CommandLineRunner {
47 @Autowired 47 @Autowired
48 InoutSchFixedRefreshThread fixedRefreshThread; 48 InoutSchFixedRefreshThread fixedRefreshThread;
49 49
  50 + private final static String TYPE_OUT = "out";
  51 + private final static String TYPE_IN = "in";
  52 +
50 static { 53 static {
51 allMaps = new ConcurrentHashMap<>(); 54 allMaps = new ConcurrentHashMap<>();
52 tccCode = ConfigUtil.get("tcc.code"); 55 tccCode = ConfigUtil.get("tcc.code");
@@ -62,17 +65,21 @@ public class InOutScheduleDataBuffer implements CommandLineRunner { @@ -62,17 +65,21 @@ public class InOutScheduleDataBuffer implements CommandLineRunner {
62 } 65 }
63 66
64 public static List<ScheduleInOut> getOutsByUserId(String company, String jGh){ 67 public static List<ScheduleInOut> getOutsByUserId(String company, String jGh){
65 - return filterOuts(pMultimap.get(company + "-" + jGh)); 68 + return filterByType(pMultimap.get(company + "-" + jGh), TYPE_OUT);
66 } 69 }
67 70
68 public static List<ScheduleInOut> getOutsByNbbm(String nbbm){ 71 public static List<ScheduleInOut> getOutsByNbbm(String nbbm){
69 - return filterOuts(cMultimap.get(nbbm)); 72 + return filterByType(cMultimap.get(nbbm), TYPE_OUT);
  73 + }
  74 +
  75 + public static List<ScheduleInOut> getInsByNbbm(String nbbm){
  76 + return filterByType(cMultimap.get(nbbm), TYPE_IN);
70 } 77 }
71 78
72 - private static List<ScheduleInOut> filterOuts(List<ScheduleInOut> list){ 79 + private static List<ScheduleInOut> filterByType(List<ScheduleInOut> list, String type){
73 List<ScheduleInOut> rs = new ArrayList<>(); 80 List<ScheduleInOut> rs = new ArrayList<>();
74 for(ScheduleInOut sio : list){ 81 for(ScheduleInOut sio : list){
75 - if(sio.getBcType().equals("out")) 82 + if(sio.getBcType().equals(type))
76 rs.add(sio); 83 rs.add(sio);
77 } 84 }
78 85
@@ -80,6 +87,7 @@ public class InOutScheduleDataBuffer implements CommandLineRunner { @@ -80,6 +87,7 @@ public class InOutScheduleDataBuffer implements CommandLineRunner {
80 return rs; 87 return rs;
81 } 88 }
82 89
  90 +
83 public static List<ScheduleInOut> getByNbbm(String nbbm){ 91 public static List<ScheduleInOut> getByNbbm(String nbbm){
84 return cMultimap.get(nbbm); 92 return cMultimap.get(nbbm);
85 } 93 }
@@ -116,9 +124,9 @@ public class InOutScheduleDataBuffer implements CommandLineRunner { @@ -116,9 +124,9 @@ public class InOutScheduleDataBuffer implements CommandLineRunner {
116 Collection<ScheduleInOut> vs = allMaps.values(); 124 Collection<ScheduleInOut> vs = allMaps.values();
117 for (ScheduleInOut sio : vs) { 125 for (ScheduleInOut sio : vs) {
118 try{ 126 try{
119 - if (sio.getBcType().equals("out")) 127 + if (sio.getBcType().equals(TYPE_OUT))
120 outListCopy.add(sio); 128 outListCopy.add(sio);
121 - else if (sio.getBcType().equals("in")) 129 + else if (sio.getBcType().equals(TYPE_IN))
122 inListCopy.add(sio); 130 inListCopy.add(sio);
123 131
124 }catch (Exception e){ 132 }catch (Exception e){
@@ -211,6 +219,16 @@ public class InOutScheduleDataBuffer implements CommandLineRunner { @@ -211,6 +219,16 @@ public class InOutScheduleDataBuffer implements CommandLineRunner {
211 return getNearSch(getOutsByNbbm(nbbm), t); 219 return getNearSch(getOutsByNbbm(nbbm), t);
212 } 220 }
213 221
  222 + /**
  223 + * 车辆当前要执行的进场计划
  224 + * @param nbbm
  225 + * @param t
  226 + * @return
  227 + */
  228 + public static ScheduleInOut getCurrExecIn(String nbbm, Long t){
  229 + return getNearSch(getInsByNbbm(nbbm), t);
  230 + }
  231 +
214 private static ScheduleInOut getNearSch(List<ScheduleInOut> list, Long t){ 232 private static ScheduleInOut getNearSch(List<ScheduleInOut> list, Long t){
215 List<ScheduleInOut> execs = new ArrayList<>(); 233 List<ScheduleInOut> execs = new ArrayList<>();
216 234
@@ -248,9 +266,9 @@ public class InOutScheduleDataBuffer implements CommandLineRunner { @@ -248,9 +266,9 @@ public class InOutScheduleDataBuffer implements CommandLineRunner {
248 for (ScheduleInOut sio : listCopy) { 266 for (ScheduleInOut sio : listCopy) {
249 //进场还是出场 267 //进场还是出场
250 if (sio.getQdzCode().equals(tccCode)) { 268 if (sio.getQdzCode().equals(tccCode)) {
251 - sio.setBcType("out"); 269 + sio.setBcType(TYPE_OUT);
252 } else if (sio.getZdzCode().equals(tccCode)) 270 } else if (sio.getZdzCode().equals(tccCode))
253 - sio.setBcType("in"); 271 + sio.setBcType(TYPE_IN);
254 else 272 else
255 sio.setBcType(""); 273 sio.setBcType("");
256 274
src/main/java/com/bsth/service/schedule/impl/InOutScheduleServiceImpl.java
@@ -74,7 +74,13 @@ public class InOutScheduleServiceImpl implements InOutScheduleService { @@ -74,7 +74,13 @@ public class InOutScheduleServiceImpl implements InOutScheduleService {
74 @Override 74 @Override
75 public void busInOut(CarInOutEntity cio) { 75 public void busInOut(CarInOutEntity cio) {
76 //车辆的出场计划 76 //车辆的出场计划
77 - ScheduleInOut sio = InOutScheduleDataBuffer.getCurrExecOut(cio.getNbbm(), cio.getT()); 77 + ScheduleInOut sio = null;
  78 + if(cio.getType() == 2){
  79 + sio = InOutScheduleDataBuffer.getCurrExecIn(cio.getNbbm(), cio.getT());
  80 + }
  81 + else if(cio.getType() == 4){
  82 + sio = InOutScheduleDataBuffer.getCurrExecOut(cio.getNbbm(), cio.getT());
  83 + }
78 84
79 85
80 //实时车辆进出场处理程序 86 //实时车辆进出场处理程序
src/main/resources/static/assets/css/main.css
@@ -690,6 +690,18 @@ table tr th, table tr td{ @@ -690,6 +690,18 @@ table tr th, table tr td{
690 background: #9f9f9f; 690 background: #9f9f9f;
691 } 691 }
692 692
  693 +.berth_card_list>.berth_card>.car_blank.draging{
  694 + box-shadow: inset 0px 0px 15px 3px rgba(86, 84, 84, 0.59);
  695 +}
  696 +
  697 +/*.berth_card_list>.berth_card>.car_blank.draging:before{
  698 + visibility: hidden !important;
  699 +}*/
  700 +
  701 +/*.berth_card_list>.berth_card .draging .car_name{
  702 + color: #adadad;
  703 +}*/
  704 +
693 .berth_card_list>.berth_card>.car_blank.no_elec:before{ 705 .berth_card_list>.berth_card>.car_blank.no_elec:before{
694 content: "无电量信息"; 706 content: "无电量信息";
695 width: 100%; 707 width: 100%;
@@ -848,4 +860,24 @@ table tr th, table tr td{ @@ -848,4 +860,24 @@ table tr th, table tr td{
848 .trash_wrap.show.open{ 860 .trash_wrap.show.open{
849 background-image: url(/assets/icon/trash_open.png); 861 background-image: url(/assets/icon/trash_open.png);
850 background-position: 20px 20px; 862 background-position: 20px 20px;
  863 +}
  864 +
  865 +#b_p_manager_main_wrap .scroll_down{
  866 + position: absolute;
  867 + width: 100%;
  868 + height: 40px;
  869 + bottom: 0;
  870 + box-shadow: 0px -5px 15px rgba(116, 110, 110, 0.45);
  871 + background: rgba(253, 228, 151, 0.22);
  872 + display: none;
  873 +}
  874 +
  875 +#b_p_manager_main_wrap .scroll_up{
  876 + position: absolute;
  877 + width: 100%;
  878 + height: 40px;
  879 + top: 0;
  880 + box-shadow: 0 5px 15px rgba(116, 110, 110, 0.45);
  881 + background: rgba(253, 228, 151, 0.22);
  882 + display: none;
851 } 883 }
852 \ No newline at end of file 884 \ No newline at end of file
src/main/resources/static/pages/b_p_manager/b_p_main.html
@@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
3 <div class="drag_tip"></div> 3 <div class="drag_tip"></div>
4 <div class="berth_card_list"></div> 4 <div class="berth_card_list"></div>
5 5
  6 + <div class="scroll_up"></div>
  7 + <div class="scroll_down"></div>
6 <script id="b_p_manager_main_list-temp" type="text/html"> 8 <script id="b_p_manager_main_list-temp" type="text/html">
7 {{each list as b i}} 9 {{each list as b i}}
8 <div class="berth_card"> 10 <div class="berth_card">
@@ -138,7 +140,10 @@ @@ -138,7 +140,10 @@
138 },false); 140 },false);
139 trashWrap[0].addEventListener('drop', function () { 141 trashWrap[0].addEventListener('drop', function () {
140 var s = $(drag_e).data('id'); 142 var s = $(drag_e).data('id');
141 - alert(s + '丢垃圾桶'); 143 + gb_common.$post('/car_park_real/clear_berth', {b: s}, function (rs) {
  144 + render_bus(rs.list);
  145 + });
  146 + drag_rest();
142 },false); 147 },false);
143 148
144 149
@@ -147,6 +152,8 @@ @@ -147,6 +152,8 @@
147 var handleDragStart = function (e) { 152 var handleDragStart = function (e) {
148 drag_e = this; 153 drag_e = this;
149 trashWrap.addClass('show'); 154 trashWrap.addClass('show');
  155 + $(this).addClass('draging');
  156 + $('.scroll_down,.scroll_up', wrap).show();
150 }; 157 };
151 158
152 var handleDragEnd = function () { 159 var handleDragEnd = function () {
@@ -183,14 +190,33 @@ @@ -183,14 +190,33 @@
183 gb_common.$post('/car_park_real/real_change', {s:s, d:d}, function (rs) { 190 gb_common.$post('/car_park_real/real_change', {s:s, d:d}, function (rs) {
184 render_bus(rs.list); 191 render_bus(rs.list);
185 }); 192 });
  193 + drag_rest();
  194 + };
186 195
187 - /**  
188 - * 泊位交换  
189 -  
190 - gb_common.$post('/berth/real_change', {s:s, d:d}, function (rs) {  
191 - render_cards(rs.list);  
192 - });*/ 196 + var drag_rest = function () {
  197 + $(drag_e).removeClass('draging');
  198 + drag_e = null;
  199 + $('.scroll_down,.scroll_up', wrap).hide();
193 }; 200 };
  201 + /**
  202 + * drag 时滚动条
  203 + */
  204 + var cardListWrap = $('.berth_card_list', wrap)[0];
  205 + $('.scroll_down', wrap)[0].addEventListener('dragover', function (e) {
  206 + e.preventDefault();
  207 + cardListWrap.scrollTop = cardListWrap.scrollTop + 10;
  208 + return true;
  209 + }, false);
  210 + $('.scroll_up', wrap)[0].addEventListener('dragover', function (e) {
  211 + e.preventDefault();
  212 + cardListWrap.scrollTop = cardListWrap.scrollTop - 10;
  213 + return true;
  214 + }, false);
  215 +
  216 + /*$('.scroll_down', wrap)[0].addEventListener('dragleave', function () {
  217 + berthcardListWrap.scrollTop = berthcardListWrap.scrollTop + 20;
  218 + },false)*/
  219 +
194 })(); 220 })();
195 </script> 221 </script>
196 </div> 222 </div>
197 \ No newline at end of file 223 \ No newline at end of file