Commit 81e94da4519d9cb2ca63cd8c3c0306be037a8ce8

Authored by 潘钊
1 parent fb086f82

update...

src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -449,4 +449,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo,
449 449 public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){
450 450 return scheduleRealInfoService.currentSchedulePlan(lineCode);
451 451 }
  452 +
  453 + @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST)
  454 + public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx){
  455 + return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx);
  456 + }
452 457 }
... ...
src/main/java/com/bsth/controller/realcontrol/dto/LpData.java 0 → 100644
  1 +package com.bsth.controller.realcontrol.dto;
  2 +
  3 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  4 +
  5 +/**
  6 + * 路牌相关的数据(换路牌时要换的字段)
  7 + * Created by panzhao on 2017/3/2.
  8 + */
  9 +public class LpData {
  10 +
  11 + public LpData(ScheduleRealInfo sch) {
  12 + this.jGh = sch.getjGh();
  13 + this.jName = sch.getjName();
  14 + this.sGh = sch.getsGh();
  15 + this.sName = sch.getsName();
  16 + this.nbbm = sch.getClZbh();
  17 +
  18 + this.fcsj = sch.getFcsjActualTime();
  19 + this.zdsj = sch.getZdsjActualTime();
  20 + }
  21 +
  22 + public void appendTo(ScheduleRealInfo sch) {
  23 + sch.setjGh(this.jGh);
  24 + sch.setjName(this.jName);
  25 + sch.setsGh(this.sGh);
  26 + sch.setsName(this.sName);
  27 + sch.setClZbh(this.nbbm);
  28 +
  29 + if (this.fcsj != null)
  30 + sch.setFcsjActualAll(this.fcsj);
  31 + if (this.zdsj != null)
  32 + sch.setZdsjActualAll(this.zdsj);
  33 + }
  34 +
  35 + /**
  36 + * 驾驶员
  37 + */
  38 + private String jGh;
  39 + private String jName;
  40 +
  41 + /**
  42 + * 售票员
  43 + */
  44 + private String sGh;
  45 + private String sName;
  46 +
  47 + /**
  48 + * 车辆自编号
  49 + */
  50 + private String nbbm;
  51 +
  52 + /**
  53 + * 实际发车时间
  54 + */
  55 + private Long fcsj;
  56 +
  57 + /**
  58 + * 实际终点时间
  59 + */
  60 + private Long zdsj;
  61 +
  62 + public String getjGh() {
  63 + return jGh;
  64 + }
  65 +
  66 + public void setjGh(String jGh) {
  67 + this.jGh = jGh;
  68 + }
  69 +
  70 + public String getjName() {
  71 + return jName;
  72 + }
  73 +
  74 + public void setjName(String jName) {
  75 + this.jName = jName;
  76 + }
  77 +
  78 + public String getsGh() {
  79 + return sGh;
  80 + }
  81 +
  82 + public void setsGh(String sGh) {
  83 + this.sGh = sGh;
  84 + }
  85 +
  86 + public String getsName() {
  87 + return sName;
  88 + }
  89 +
  90 + public void setsName(String sName) {
  91 + this.sName = sName;
  92 + }
  93 +
  94 + public String getNbbm() {
  95 + return nbbm;
  96 + }
  97 +
  98 + public void setNbbm(String nbbm) {
  99 + this.nbbm = nbbm;
  100 + }
  101 +
  102 + public Long getFcsj() {
  103 + return fcsj;
  104 + }
  105 +
  106 + public void setFcsj(Long fcsj) {
  107 + this.fcsj = fcsj;
  108 + }
  109 +
  110 + public Long getZdsj() {
  111 + return zdsj;
  112 + }
  113 +
  114 + public void setZdsj(Long zdsj) {
  115 + this.zdsj = zdsj;
  116 + }
  117 +}
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -151,4 +151,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
151 151 Map<String, Object> exportWaybillMore(Map<String, Object> map);
152 152  
153 153 List<SchedulePlanInfo> currentSchedulePlan(String lineCode);
  154 +
  155 + Map<String,Object> lpChangeMulti(String leftIdx, String rightIdx);
  156 +
  157 + void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch);
154 158 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
6 6 import com.bsth.common.ResponseCode;
7 7 import com.bsth.controller.realcontrol.dto.ChangePersonCar;
8 8 import com.bsth.controller.realcontrol.dto.DfsjChange;
  9 +import com.bsth.controller.realcontrol.dto.LpData;
9 10 import com.bsth.data.BasicData;
10 11 import com.bsth.data.LineConfigData;
11 12 import com.bsth.data.arrival.ArrivalData_GPS;
... ... @@ -3247,4 +3248,50 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3247 3248 }
3248 3249 return rs;
3249 3250 }
  3251 +
  3252 +
  3253 + @Override
  3254 + public Map<String, Object> lpChangeMulti(String leftIdx, String rightIdx) {
  3255 + Map<String, Object> rs = new HashMap<>();
  3256 + List<ScheduleRealInfo> ts = new ArrayList<>();
  3257 + try {
  3258 + List<String> leftList = Splitter.on(",").splitToList(leftIdx);
  3259 + List<String> rightList = Splitter.on(",").splitToList(rightIdx);
  3260 + if(leftList.size() != rightList.size()){
  3261 + rs.put("status", ResponseCode.ERROR);
  3262 + rs.put("msg", "不对称的对调!");
  3263 + return rs;
  3264 + }
  3265 +
  3266 + ScheduleRealInfo leftSch, rightSch;
  3267 + for(int i = 0; i < leftList.size(); i ++){
  3268 + leftSch = dayOfSchedule.get(Long.parseLong(leftList.get(i)));
  3269 + rightSch = dayOfSchedule.get(Long.parseLong(rightList.get(i)));
  3270 +
  3271 + //调换路牌
  3272 + lpChange(leftSch, rightSch);
  3273 +
  3274 + ts.add(leftSch);
  3275 + ts.add(rightSch);
  3276 + }
  3277 +
  3278 + rs.put("status", ResponseCode.SUCCESS);
  3279 + rs.put("ts", ts);
  3280 + }catch(Exception e){
  3281 + logger.error("", e);
  3282 + rs.put("status", ResponseCode.ERROR);
  3283 + rs.put("msg", e.getMessage());
  3284 + }
  3285 +
  3286 + return rs;
  3287 + }
  3288 +
  3289 + @Override
  3290 + public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch) {
  3291 + LpData leftData = new LpData(leftSch);
  3292 + LpData rightData = new LpData(rightSch);
  3293 +
  3294 + leftData.appendTo(rightSch);
  3295 + rightData.appendTo(leftSch);
  3296 + }
3250 3297 }
3251 3298 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/lp_change.html
... ... @@ -61,7 +61,7 @@
61 61  
62 62 <div class="uk-modal-footer uk-text-right">
63 63 <div style="float: left;font-size: 13px;">
64   - <a> 清除未勾选班次</a>
  64 + <a class="only_show_checked" > 清除未勾选班次</a>
65 65 </div>
66 66 <button type="button" class="uk-button uk-modal-close">取消</button>
67 67 <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;提交</button>
... ... @@ -71,7 +71,7 @@
71 71 <script id="schedule-lp_change-list-temp" type="text/html">
72 72 {{if order == 0}}
73 73 {{each array as sch i}}
74   - <dl>
  74 + <dl data-id="{{sch.id}}">
75 75 <dd><input type="checkbox"></dd>
76 76 <dd>{{sch.jGh}}/{{sch.jName}}</dd>
77 77 <dd>{{sch.clZbh}}</dd>
... ... @@ -92,7 +92,7 @@
92 92 {{/each}}
93 93 {{else if order == 1}}
94 94 {{each array as sch i}}
95   - <dl>
  95 + <dl data-id="{{sch.id}}">
96 96 <dd><input type="checkbox"></dd>
97 97 <dd>{{sch.dfsj}}{{if sch.bcType == "out"}}
98 98 <span class="uk-badge uk-badge-success">出</span>
... ... @@ -188,7 +188,7 @@
188 188 else
189 189 cancelActiveDl($(this));
190 190  
191   - disabledSubmitBtnByBalance();
  191 + disabledSubmitBtn();
192 192 });
193 193  
194 194 function activeDl(dl) {
... ... @@ -208,20 +208,18 @@
208 208 var $submitBtn = $('button[type=submit]', modal);
209 209 if(leftLP == rightLP)
210 210 $submitBtn.attr('disabled', 'disabled');
211   - else
212   - $submitBtn.removeAttr('disabled');
213   - }
214   -
215   - function disabledSubmitBtnByBalance() {
216   - var leftSize = $('.sch-list:eq(0) dl.active', modal).length;
217   - var rightSize = $('.sch-list:eq(1) dl.active', modal).length;
218   - var $submitBtn = $('button[type=submit]', modal);
219   - if(leftSize != rightSize)
220   - $submitBtn.attr('disabled', 'disabled');
221   - else if(leftSize != 0)
222   - $submitBtn.removeAttr('disabled');
  211 + else{
  212 +
  213 + var leftSize = $('.sch-list:eq(0) dl.active', modal).length;
  214 + var rightSize = $('.sch-list:eq(1) dl.active', modal).length;
  215 + if(leftSize != rightSize)
  216 + $submitBtn.attr('disabled', 'disabled');
  217 + else
  218 + $submitBtn.removeAttr('disabled');
  219 + }
223 220 }
224 221  
  222 +
225 223 //全选
226 224 $('.global_box', modal).on('click', function () {
227 225 var $table = $(this).parents('.ct_table.sch-list');
... ... @@ -238,6 +236,51 @@
238 236 cancelActiveDl($(this));
239 237 });
240 238 }
  239 +
  240 + $('.only_show_checked', modal).on('click', function () {
  241 + $('.sch-list .ct_table_body dl:not(.active)').hide();
  242 + });
  243 +
  244 + //提交
  245 + $('button[type=submit]', modal).on('click', function () {
  246 + var leftList = $('.sch-list:eq(0) dl.active', modal);
  247 + var rightList = $('.sch-list:eq(1) dl.active', modal);
  248 +
  249 + if(leftList.length != rightList.length){
  250 + alert('左右不对称,无法提交!!');
  251 + return;
  252 + }
  253 +
  254 + var leftIdx = '', rightIdx = '';
  255 + $.each(leftList, function () {
  256 + leftIdx += ($(this).data('id') + ',');
  257 + });
  258 + $.each(rightList, function () {
  259 + rightIdx += ($(this).data('id') + ',');
  260 + });
  261 + leftIdx = leftIdx.substr(0, leftIdx.length - 1);
  262 + rightIdx = rightIdx.substr(0, rightIdx.length - 1);
  263 +
  264 + gb_common.$post('/realSchedule/lpChangeMulti', {leftIdx: leftIdx, rightIdx: rightIdx}, function (rs) {
  265 + console.log('rs', rs);
  266 + notify_succ("操作成功!!");
  267 + if(rs.ts)
  268 + gb_schedule_table.updateSchedule(rs.ts);
  269 +
  270 + reLoadCurrPageData();
  271 +
  272 + });
  273 + });
  274 +
  275 +
  276 + function reLoadCurrPageData(){
  277 + $('[name=lineSelect]', modal).each(function () {
  278 + var array = gb_common.get_vals(gb_schedule_table.findScheduleByLine($(this).val()));
  279 + //按路牌分组
  280 + list[$(this).data('order')] = gb_common.groupBy(array, 'lpName');
  281 + });
  282 + $('[name=lpName]', modal).trigger('change');
  283 + }
241 284 })();
242 285 </script>
243 286 </div>
... ...