Commit 8a79fe7e4e1f991c71d2ec607db03ec92bcf5859

Authored by Hill
1 parent adf0b5a1

1.调度中维修上报

src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
1 1 package com.bsth.controller.realcontrol;
2 2  
  3 +import java.io.ByteArrayOutputStream;
  4 +import java.io.IOException;
  5 +import java.io.InputStream;
  6 +import java.io.OutputStream;
  7 +import java.net.HttpURLConnection;
  8 +import java.net.URL;
  9 +import java.util.ArrayList;
  10 +import java.util.Collection;
  11 +import java.util.HashMap;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +import org.apache.commons.io.IOUtils;
  16 +import org.apache.commons.lang3.StringEscapeUtils;
  17 +import org.joda.time.format.DateTimeFormat;
  18 +import org.joda.time.format.DateTimeFormatter;
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.web.bind.annotation.PathVariable;
  21 +import org.springframework.web.bind.annotation.RequestMapping;
  22 +import org.springframework.web.bind.annotation.RequestMethod;
  23 +import org.springframework.web.bind.annotation.RequestParam;
  24 +import org.springframework.web.bind.annotation.RestController;
  25 +
3 26 import com.alibaba.fastjson.JSONArray;
4 27 import com.bsth.common.ResponseCode;
5 28 import com.bsth.controller.BaseController;
... ... @@ -10,14 +33,10 @@ import com.bsth.data.schedule.DayOfSchedule;
10 33 import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
11 34 import com.bsth.entity.realcontrol.ScheduleRealInfo;
12 35 import com.bsth.entity.schedule.SchedulePlanInfo;
  36 +import com.bsth.entity.sys.SysUser;
  37 +import com.bsth.security.util.SecurityUtils;
13 38 import com.bsth.service.realcontrol.ScheduleRealInfoService;
14   -import org.apache.commons.lang3.StringEscapeUtils;
15   -import org.joda.time.format.DateTimeFormat;
16   -import org.joda.time.format.DateTimeFormatter;
17   -import org.springframework.beans.factory.annotation.Autowired;
18   -import org.springframework.web.bind.annotation.*;
19   -
20   -import java.util.*;
  39 +import com.fasterxml.jackson.databind.ObjectMapper;
21 40  
22 41 @RestController
23 42 @RequestMapping("/realSchedule")
... ... @@ -691,4 +710,62 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo,
691 710 public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){
692 711 return scheduleRealInfoService.deleteToHistory(id);
693 712 }
  713 +
  714 + /**
  715 + * 从历史库里删除临加班次
  716 + * @param sch
  717 + * @return
  718 + */
  719 + @RequestMapping(value = "wxsb", method = RequestMethod.POST)
  720 + public Map<String, Object> deleteToHistory(@RequestParam Map<String, Object> param){
  721 + SysUser user = SecurityUtils.getCurrentUser();
  722 + String uname = user.getUserName();
  723 + StringBuilder url = new StringBuilder("http://192.168.168.154:8088/jgjwsystem_j2ee/clbx/clbx_dd_gps.do?nbbm=");
  724 + url.append(param.get("nbbm")).append("&bxy=").append(uname).append("&bxbm=").append(param.get("bxType"));
  725 +
  726 + return request(url.toString());
  727 + }
  728 +
  729 + @SuppressWarnings("unchecked")
  730 + private static Map<String, Object> request(String url) {
  731 + Map<String, Object> res = new HashMap<String, Object>();
  732 + res.put("status", ResponseCode.SUCCESS);
  733 + InputStream in = null;
  734 + HttpURLConnection con = null;
  735 + try {
  736 + con = (HttpURLConnection)new URL(url).openConnection();
  737 + con.setRequestMethod("POST");
  738 + con.setRequestProperty("keep-alive", "true");
  739 + con.setRequestProperty("accept", "*/*");
  740 + con.setDoInput(true);
  741 + con.setReadTimeout(2500);
  742 + con.setConnectTimeout(2500);
  743 +
  744 + con.connect();
  745 + if (con.getResponseCode() == 200) {
  746 + in = con.getInputStream();
  747 + ByteArrayOutputStream bout = new ByteArrayOutputStream();
  748 + IOUtils.copy(in, bout); bout.close();
  749 + Map<String, Object> response = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
  750 + if (!"报修成功".equals(response.get("msg"))) {
  751 + res.put("status", ResponseCode.ERROR);
  752 + res.putAll(response);
  753 + }
  754 + }
  755 + } catch (IOException e) {
  756 + // TODO Auto-generated catch block
  757 + res.put("status", ResponseCode.ERROR);
  758 + res.put("msg", "调用上报接口异常");
  759 + } finally {
  760 + try {
  761 + if (in != null) in.close();
  762 + if (con != null) con.disconnect();
  763 + } catch (IOException e) {
  764 + // TODO Auto-generated catch block
  765 + e.printStackTrace();
  766 + }
  767 + }
  768 +
  769 + return res;
  770 + }
694 771 }
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/wxsb.html 0 → 100644
  1 +<div class="uk-modal ct-form-modal ct_move_modal" id="schedule-wxsb-modal">
  2 + <div class="uk-modal-dialog">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>维修上报</h2></div>
  6 + <form class="uk-form uk-form-horizontal">
  7 + </form>
  8 + </div>
  9 +
  10 + <script id="schedule-dftz-form-temp" type="text/html">
  11 + <input type="hidden" name="id" value="{{id}}"/>
  12 + <div class="uk-grid">
  13 + <div class="uk-width-1-2">
  14 + <div class="uk-form-row">
  15 + <label class="uk-form-label" >车辆编码</label>
  16 + <div class="uk-form-controls">
  17 + <input type="text" name="nbbm" value="{{clZbh}}" readonly>
  18 + </div>
  19 + </div>
  20 + </div>
  21 + <div class="uk-width-1-2">
  22 + <div class="uk-form-row">
  23 + <label class="uk-form-label" >报修类型</label>
  24 + <div class="uk-form-controls">
  25 + <select name="bxType"></select>
  26 + </div>
  27 + </div>
  28 + </div>
  29 + </div>
  30 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
  31 + <button type="button" class="uk-button uk-modal-close">取消</button>
  32 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  33 + </div>
  34 + </script>
  35 +
  36 + <script>
  37 + (function() {
  38 + var modal = '#schedule-wxsb-modal'
  39 + ,sch;
  40 +
  41 + $(modal).on('init', function(e, data) {
  42 + e.stopPropagation();
  43 + sch=data.sch;
  44 + var formHtml = template('schedule-dftz-form-temp', sch);
  45 + $('form', modal).html(formHtml);
  46 +
  47 + //班次类型字典
  48 + var bxtypes=[{code:"9101", des:"轨迹不连续"}, {code:"9102", des:"无轨迹"}, {code:"9103", des:"收不到调度指令"}, {code:"9104", des:"漂移"}, {code:"9109", des:"其它"}],opts='';
  49 + for(var i = 0;i < bxtypes.length;i++){
  50 + opts+='<option value="'+bxtypes[i].code+'">'+bxtypes[i].des+'</option>';
  51 + }
  52 + $('[name=bxType]', modal).html(opts);
  53 +
  54 + //submit
  55 + var f = $('form', modal).formValidation(gb_form_validation_opts);
  56 + f.on('success.form.fv', function(e) {
  57 + e.preventDefault();
  58 + $('[type=submit]', f).attr('disabled', 'disabled');
  59 + var data = $(this).serializeJSON();
  60 + gb_common.$post('/realSchedule/wxsb', data, function(rs){
  61 + //更新班次信息
  62 + notify_succ('操作成功!');
  63 + UIkit.modal(modal).hide();
  64 + });
  65 + });
  66 + });
  67 + })();
  68 + </script>
  69 +</div>
... ...
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
... ... @@ -281,6 +281,11 @@ var gb_schedule_context_menu = (function () {
281 281 open_modal(folder + '/sub_task_v2/main.html', {
282 282 sch: sch
283 283 }, modal_opts);
  284 + },
  285 + wxsb: function (sch) {
  286 + open_modal(folder + '/wxsb.html', {
  287 + sch: sch
  288 + }, modal_opts);
284 289 }
285 290 };
286 291  
... ... @@ -339,9 +344,13 @@ var gb_schedule_context_menu = (function () {
339 344 'wdtz': {
340 345 name: '误点调整'
341 346 },
342   - 'sep4': '---------',
  347 + 'sep5': '---------',
343 348 'lp_change': {
344 349 name: '路牌对调'
  350 + },
  351 + 'sep6': '---------',
  352 + 'wxsb': {
  353 + name: '维修上报'
345 354 }
346 355 }
347 356 });
... ...