Commit 49ca7774a0d5da7fb1c4f75ea88f60febe91e7fa

Authored by 潘钊
1 parent a1cbd957

update...

src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
... ... @@ -79,6 +79,11 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{
79 79 return lineConfigService.getByLineCode(lineCode);
80 80 }
81 81  
  82 + @RequestMapping(value = "/findByIdx")
  83 + public Map<String, Object> findByIdx(@RequestParam String idx){
  84 + return lineConfigService.findByIdx(idx);
  85 + }
  86 +
82 87 /**
83 88 * 到站缓冲区设置
84 89 * @param lineCode
... ...
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
... ... @@ -78,10 +78,11 @@ public class SchAttrCalculator {
78 78 }
79 79  
80 80 public Long getTime(String rq, String timeStr, LineConfig conf) {
81   - long t = fmtyyyyMMddHHmm.parseMillis(rq + timeStr);
82   - if (StringUtils.isNotEmpty(timeStr)
83   - && timeStr.compareTo(conf.getStartOpt()) < 0) {
84   - return t + DAY_TIME;
  81 + Long t = null;
  82 + if (StringUtils.isNotEmpty(timeStr)) {
  83 + t = fmtyyyyMMddHHmm.parseMillis(rq + timeStr);
  84 + if(timeStr.compareTo(conf.getStartOpt()) < 0)
  85 + return t + DAY_TIME;
85 86 }
86 87 return t;
87 88 }
... ...
src/main/java/com/bsth/data/schedule/edit_logs/FormLogger.java
... ... @@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
15 15 import org.springframework.stereotype.Service;
16 16  
17 17 import java.util.Date;
  18 +import java.util.LinkedList;
18 19  
19 20 /**
20 21 * 为报表写入相关的班次修改记录
... ... @@ -27,9 +28,12 @@ public class FormLogger {
27 28  
28 29 Logger log = LoggerFactory.getLogger(this.getClass());
29 30  
  31 + static LinkedList<Changetochange> ccPsts = new LinkedList<>();
  32 +
30 33 @Autowired
31 34 ChangetochangeRepository changetochangeRepository;
32 35  
  36 +
33 37 /**
34 38 * 换人换车情况表
35 39 */
... ... @@ -70,7 +74,9 @@ public class FormLogger {
70 74 if(StringUtils.isNotEmpty(newJsy))
71 75 cc.setSjgh(newJsy);
72 76  
73   - changetochangeRepository.save(cc);
  77 + //改异步入库
  78 + ccPsts.add(cc);
  79 + //changetochangeRepository.save(cc);
74 80 }catch (Exception e){
75 81 log.error("纪录换人换车情况表", e);
76 82 }
... ... @@ -82,4 +88,13 @@ public class FormLogger {
82 88 cpc.setJsy(jsy);
83 89 saveChangetochange(sch, cpc);
84 90 }
  91 +
  92 + public void saveDb(){
  93 + Changetochange cc;
  94 + for(int i = 0; i < 1000; i ++){
  95 + cc = ccPsts.poll();
  96 + if(null != cc)
  97 + changetochangeRepository.save(cc);
  98 + }
  99 + }
85 100 }
... ...
src/main/java/com/bsth/data/schedule/edit_logs/SeiPstThread.java
... ... @@ -23,6 +23,9 @@ public class SeiPstThread extends Thread{
23 23  
24 24 Logger log = LoggerFactory.getLogger(this.getClass());
25 25  
  26 + @Autowired
  27 + FormLogger formLogger;
  28 +
26 29 @Override
27 30 public void run() {
28 31 try{
... ... @@ -40,6 +43,9 @@ public class SeiPstThread extends Thread{
40 43 }
41 44  
42 45 repository.save(pstList);
  46 +
  47 + //报表结构化日志入库
  48 + formLogger.saveDb();
43 49 }catch (Exception e){
44 50 log.error("", e);
45 51 }
... ...
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
... ... @@ -718,8 +718,12 @@ public class ScheduleRealInfo {
718 718 * @throws
719 719 */
720 720 public void setFcsjActualAll(Long t){
  721 +
721 722 this.fcsjActualTime = t;
722   - this.fcsjActual = fmtHHmm.print(t);
  723 + if(null == t)
  724 + this.fcsjActual = null;
  725 + else
  726 + this.fcsjActual = fmtHHmm.print(t);
723 727  
724 728 //更新班次状态
725 729 calcStatus();
... ... @@ -733,7 +737,11 @@ public class ScheduleRealInfo {
733 737 */
734 738 public void setZdsjActualAll(Long t){
735 739 this.zdsjActualTime = t;
736   - this.zdsjActual = fmtHHmm.print(t);
  740 +
  741 + if(null == t)
  742 + this.zdsjActual = null;
  743 + else
  744 + this.zdsjActual = fmtHHmm.print(t);
737 745  
738 746 //更新班次状态
739 747 calcStatus();
... ...
src/main/java/com/bsth/service/realcontrol/LineConfigService.java
... ... @@ -24,4 +24,6 @@ public interface LineConfigService extends BaseService&lt;LineConfig, Integer&gt;{
24 24 Map<String,Object> yjtkSet(Map<String, String> map);
25 25  
26 26 Map<String,Object> parkAndStationSet(Map<String, String> map);
  27 +
  28 + Map<String,Object> findByIdx(String idx);
27 29 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/LineConfigServiceImpl.java
... ... @@ -6,6 +6,7 @@ import com.bsth.entity.realcontrol.LineConfig;
6 6 import com.bsth.repository.realcontrol.LineConfigRepository;
7 7 import com.bsth.service.impl.BaseServiceImpl;
8 8 import com.bsth.service.realcontrol.LineConfigService;
  9 +import com.google.common.base.Splitter;
9 10 import org.slf4j.Logger;
10 11 import org.slf4j.LoggerFactory;
11 12 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -203,4 +204,24 @@ public class LineConfigServiceImpl extends BaseServiceImpl&lt;LineConfig, Integer&gt;
203 204 }
204 205 return rs;
205 206 }
  207 +
  208 + @Override
  209 + public Map<String, Object> findByIdx(String idx) {
  210 + Map<String, Object> rs = new HashMap();
  211 + try{
  212 + List<LineConfig> list = new ArrayList<>();
  213 + List<String> ids = Splitter.on(",").splitToList(idx);
  214 +
  215 + for(String id : ids){
  216 + list.add(lineConfigData.get(id));
  217 + }
  218 +
  219 + rs.put("status", ResponseCode.SUCCESS);
  220 + rs.put("list", list);
  221 + }catch (Exception e){
  222 + rs.put("status", ResponseCode.ERROR);
  223 + logger.error("", e);
  224 + }
  225 + return rs;
  226 + }
206 227 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -3017,9 +3017,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3017 3017 Set<ScheduleRealInfo> set = new HashSet<>();
3018 3018  
3019 3019 ScheduleRealInfo sch;
  3020 + StringBuilder sb = new StringBuilder();
3020 3021  
3021 3022 String jGh = null,jName,sGh,sName;
3022 3023 for (ChangePersonCar cpc : cpcs) {
  3024 + sb = new StringBuilder();
3023 3025  
3024 3026 sch = dayOfSchedule.get(cpc.getSchId());
3025 3027 if (sch == null)
... ... @@ -3053,7 +3055,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3053 3055 //日志记录
3054 3056 ScheduleModifyLogger.tzrc(sch, cpc);
3055 3057  
  3058 + //换驾驶员
3056 3059 if (StringUtils.isNotEmpty(cpc.getJsy())) {
  3060 + if(!jGh.equals(sch.getjGh()))
  3061 + sb.append(sch.getjGh() + " 换 " + jGh + ";");
3057 3062 //换驾驶员
3058 3063 if(persoChange(sch, jGh))
3059 3064 set.add(sch);
... ... @@ -3068,6 +3073,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3068 3073 rs.put("status", ResponseCode.ERROR);
3069 3074 return rs;
3070 3075 }
  3076 +
  3077 + if(!sGh.equals(sch.getsGh()))
  3078 + sb.append(sch.getsGh() + " 换 " + sGh + ";");
3071 3079 if(persoChangeSPY(sch, sGh))
3072 3080 set.add(sch);
3073 3081 }
... ... @@ -3078,10 +3086,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3078 3086  
3079 3087 //换车
3080 3088 if (StringUtils.isNotEmpty(cpc.getClZbh()) && !cpc.getClZbh().equals(sch.getClZbh())) {
  3089 + sb.append(sch.getClZbh() + " 换 " + cpc.getClZbh() + ";");
3081 3090 set.add(sch);
3082 3091 set.addAll(dayOfSchedule.changeCar(sch, cpc.getClZbh()));
3083 3092 }
3084 3093  
  3094 + if(sb.length() > 0)
  3095 + sch.setRemarks(sb.toString());
  3096 +
3085 3097 dayOfSchedule.save(sch);
3086 3098 set.add(sch);
3087 3099  
... ...
src/main/resources/static/real_control_v2/css/main.css
... ... @@ -1668,4 +1668,26 @@ ul.left_tabs_lg li{
1668 1668 .sch-search-autocom input{
1669 1669 padding: 0 !important;
1670 1670 height: 100% !important;
  1671 +}
  1672 +
  1673 +label.blue_checkbox{
  1674 + margin-left: 12px;
  1675 +}
  1676 +
  1677 +label.blue_checkbox>input{
  1678 + width: 17px !important;
  1679 + height: 17px !important;
  1680 +}
  1681 +
  1682 +label.blue_checkbox>input:checked:before,
  1683 +label.blue_checkbox>input:indeterminate:before{
  1684 + line-height: 15px !important;
  1685 +}
  1686 +
  1687 +dd.disabled{
  1688 + color: #b5b3b3;
  1689 +}
  1690 +
  1691 +dl.active>dd.disabled{
  1692 + color: #ececec;
1671 1693 }
1672 1694 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/fcxxwt.html
... ... @@ -191,6 +191,12 @@
191 191 e.preventDefault();
192 192 var data = $(this).serializeJSON();
193 193  
  194 + //校验实发实达时间
  195 + if(!validation_s_e_Time(data)){
  196 + notify_err("实发时间不能晚于实达时间!");
  197 + return;
  198 + }
  199 +
194 200 if(!data.adjustExps && (data.status==-1
195 201 || (data.jhlc==0 && sch.bcType != 'in' && sch.bcType != 'out'))){
196 202 notify_err("当前操作需要选择调整原因!");
... ... @@ -280,6 +286,27 @@
280 286 })
281 287 });
282 288 });
  289 +
  290 + function validation_s_e_Time(data) {
  291 + var config = gb_data_line_config.get(sch.xlBm);
  292 + var st = get_time(sch.scheduleDateStr, data.fcsjActual, config);
  293 + var et = get_time(sch.scheduleDateStr, data.zdsjActual, config);
  294 + if(st && et && st > et)
  295 + return false;
  296 + return true;
  297 + }
  298 +
  299 + var DAY_TIME = 1000 * 60 * 60 * 24;
  300 + function get_time(rq, timeStr, config) {
  301 + var t = null;
  302 + if(timeStr){
  303 + t = moment(rq + timeStr, 'YYYY-MM-DDHH:mm');
  304 + if(timeStr.localeCompare(config.startOpt) < 0)
  305 + return t + DAY_TIME;
  306 + }
  307 +
  308 + return t;
  309 + }
283 310 })();
284 311 </script>
285 312 </div>
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/tzrc.html
... ... @@ -47,10 +47,13 @@
47 47 <div class="uk-width-1-2">
48 48 <div class="uk-form-row">
49 49 <label class="uk-form-label">车辆</label>
50   - <div class="uk-form-controls">
51   - <div class="uk-autocomplete uk-form car-autocom">
  50 + <div class="uk-form-controls" >
  51 + <div class="uk-autocomplete uk-form car-autocom" style="width: 77%;">
52 52 <input type="text" value="" name="clZbh" required>
53 53 </div>
  54 + <label class="blue_checkbox cl_enable_key_label">
  55 + <input type="checkbox" checked>
  56 + </label>
54 57 </div>
55 58 </div>
56 59 </div>
... ... @@ -58,9 +61,12 @@
58 61 <div class="uk-form-row">
59 62 <label class="uk-form-label">驾驶员 </label>
60 63 <div class="uk-form-controls">
61   - <div class="uk-autocomplete uk-form jsy-autocom">
  64 + <div class="uk-autocomplete uk-form jsy-autocom" style="width: 77%;">
62 65 <input type="text" value="" name="jsy" required>
63 66 </div>
  67 + <label class="blue_checkbox jsy_enable_key_label">
  68 + <input type="checkbox" checked>
  69 + </label>
64 70 </div>
65 71 </div>
66 72 </div>
... ... @@ -77,7 +83,7 @@
77 83 </div>
78 84 </div>
79 85 </div>
80   - <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
  86 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;position: relative;">
81 87 <button type="button" class="uk-button uk-modal-close">取消</button>
82 88 <button type="submit" class="uk-button uk-button-primary" ><i class="uk-icon-check"></i> &nbsp;保存
83 89 </button>
... ... @@ -168,8 +174,6 @@
168 174 if(!$(this).hasClass('active')){
169 175 $(this).addClass('active');
170 176 cbox.checked = true;
171   - //var lineCode = $('[name=lineSelect]', modal).val();
172   - //var sch = gb_schedule_table.findScheduleByLine(lineCode)[$(this).data('id')];
173 177 renderCell();
174 178 }
175 179 else{
... ... @@ -215,6 +219,7 @@
215 219 var f = $('form.tzrc_form', modal);
216 220 f.on('submit', function (e) {
217 221 e.stopPropagation();
  222 + $('[type=submit]', f).attr('disabled', 'disabled');
218 223  
219 224 var checkeds = $('.sch-tzrc-table .ct_table_body input[type=checkbox]:checked', modal);
220 225 if (checkeds.length == 0)
... ... @@ -258,20 +263,38 @@
258 263 renderRunFlag = false;
259 264 }, 200);
260 265 });
  266 +
  267 + $('.jsy_enable_key_label', modal).on('click', function () {
  268 + var checked = $('input[type=checkbox]', this)[0].checked;
  269 + if(checked)
  270 + enableJsy();
  271 + else
  272 + disabledJsy();
  273 + });
  274 +
  275 + $('.cl_enable_key_label', modal).on('click', function () {
  276 + var checked = $('input[type=checkbox]', this)[0].checked;
  277 + if(checked)
  278 + enableCl();
  279 + else
  280 + disabledCl();
  281 + });
261 282 });
262 283  
263   -
264 284 function renderCell() {
265   - var jsy = $('input[name=jsy]', modal).val();
  285 + var jsy = $('input[name=jsy]:enabled', modal).val();
266 286 var spy = $('input[name=spy]', modal).val();
267   - var nbbm = $('input[name=clZbh]', modal).val();
  287 + var nbbm = $('input[name=clZbh]:enabled', modal).val();
268 288 $('.sch-tzrc-table .ct_table_body>dl.active').each(function () {
269 289 var jsyCell = $(this).find('dd')[2];
270 290 var spyCell = $(this).find('dd')[3];
271 291 var clCell = $(this).find('dd')[1];
272   - $(jsyCell).text(jsy);
  292 +
  293 + if(jsy)
  294 + $(jsyCell).text(jsy);
  295 + if(nbbm)
  296 + $(clCell).text(nbbm);
273 297 $(spyCell).text(spy);
274   - $(clCell).text(nbbm);
275 298 });
276 299 }
277 300  
... ... @@ -305,6 +328,43 @@
305 328 $('.sch-tzrc-table .ct_table_body>dl', modal).each(function () {
306 329 $(this).removeClass('active');
307 330 $('input[type=checkbox]',this)[0].checked = false;
  331 +
  332 + $.each($('dd', this), function () {
  333 + if($(this).data('old'))
  334 + $(this).text($(this).data('old'));
  335 + });
  336 + });
  337 + }
  338 +
  339 + function disabledJsy() {
  340 + $('[name=jsy]',modal).attr('disabled', 'disabled');
  341 + $('.sch-tzrc-table .ct_table_body>dl').each(function () {
  342 + var jsyCell = $(this).find('dd')[2];
  343 + $(jsyCell).addClass('disabled').text($(jsyCell).data('old'));
  344 + });
  345 + }
  346 +
  347 + function enableJsy() {
  348 + $('[name=jsy]',modal).removeAttr('disabled');
  349 + $('.sch-tzrc-table .ct_table_body>dl').each(function () {
  350 + var jsyCell = $(this).find('dd')[2];
  351 + $(jsyCell).removeClass('disabled').text($(jsyCell).data('old'));
  352 + });
  353 + }
  354 +
  355 + function disabledCl() {
  356 + $('[name=clZbh]',modal).attr('disabled', 'disabled');
  357 + $('.sch-tzrc-table .ct_table_body>dl').each(function () {
  358 + var clCell = $(this).find('dd')[1];
  359 + $(clCell).addClass('disabled').text($(clCell).data('old'));
  360 + });
  361 + }
  362 +
  363 + function enableCl() {
  364 + $('[name=clZbh]',modal).removeAttr('disabled');
  365 + $('.sch-tzrc-table .ct_table_body>dl').each(function () {
  366 + var clCell = $(this).find('dd')[1];
  367 + $(clCell).removeClass('disabled').text($(clCell).data('old'));
308 368 });
309 369 }
310 370 })();
... ...
src/main/resources/static/real_control_v2/js/data/data_line_config.js 0 → 100644
  1 +/**
  2 + * 线路配置信息
  3 + * @type {{}}
  4 + */
  5 +var gb_data_line_config = (function () {
  6 +
  7 + var lineConfigMap;
  8 +
  9 + var storage = window.localStorage;
  10 + var activeLines = JSON.parse(storage.getItem('lineControlItems'));
  11 + var line_idx = (function () {
  12 + var str = '';
  13 + for (var i = 0, item; item = activeLines[i++];) {
  14 + str += (',' + item.lineCode);
  15 + }
  16 + return str.substr(1);
  17 + })();
  18 +
  19 + gb_common.$get('/lineConfig/findByIdx', {idx: line_idx}, function (rs) {
  20 + lineConfigMap = {};
  21 + $.each(rs.list, function () {
  22 + lineConfigMap[this.line.lineCode] = this;
  23 + });
  24 +
  25 + console.log('lineConfigMap', lineConfigMap);
  26 + });
  27 +
  28 + return {
  29 + get: function (lineCode) {
  30 + return lineConfigMap[lineCode];
  31 + }
  32 + };
  33 +})();
0 34 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/main.html
... ... @@ -167,6 +167,7 @@
167 167 <script src="/real_control_v2/js/data/data_basic.js" merge="custom_js"></script>
168 168 <script src="/real_control_v2/js/data/data_gps.js" merge="custom_js"></script>
169 169 <script src="/real_control_v2/js/data/gps_abnormal.js" merge="custom_js"></script>
  170 +<script src="/real_control_v2/js/data/data_line_config.js" merge="custom_js"></script>
170 171 <!-- 线路模拟图 -->
171 172 <script src="/real_control_v2/js/utils/svg_chart.js" merge="custom_js"></script>
172 173 <script src="/real_control_v2/js/utils/svg_data_convert.js" merge="custom_js"></script>
... ...