Commit c0288e96d59e3ec06ee95bac5a50283353f267e8

Authored by 徐烜
1 parent 3ee4a802

update

src/main/java/com/bsth/Application.java
1 1 package com.bsth;
2 2  
3   -import com.fasterxml.jackson.databind.ObjectMapper;
4   -import com.fasterxml.jackson.databind.SerializationFeature;
5 3 import org.springframework.boot.SpringApplication;
6   -import org.springframework.boot.autoconfigure.*;
7   -import org.springframework.context.annotation.Bean;
8   -import org.springframework.context.annotation.Primary;
  4 +import org.springframework.boot.autoconfigure.SpringBootApplication;
9 5  
10 6 @SpringBootApplication
11 7 public class Application{
12 8  
13   - @Bean
14   - @Primary
15   - public ObjectMapper objectMapper() {
16   - ObjectMapper objectMapper = new ObjectMapper();
17   - objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
18   -
19   - return objectMapper;
20   - }
  9 +// @Bean
  10 +// @Primary
  11 +// public ObjectMapper objectMapper() {
  12 +// ObjectMapper objectMapper = new ObjectMapper();
  13 +// objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
  14 +//
  15 +// return objectMapper;
  16 +// }
21 17  
22 18 public static void main(String[] args) throws Exception {
23 19 SpringApplication.run(Application.class, args);
... ...
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
... ... @@ -73,12 +73,16 @@ public class SchedulePlanInfo {
73 73 /** 起点站id,根据班次类型,会关联 bsth_c_station,或 bsth_c_car_park,不做mapping */
74 74 @Column(nullable = false)
75 75 private Integer qdz;
  76 + /** 起点站code */
  77 + private String qdzCode;
76 78 /** 起点站名字 */
77 79 @Column(nullable = false)
78 80 private String qdzName;
79 81 /** 终点站id,根据班次类型,会关联 bsth_c_station,或 bsth_c_car_park,不做mapping */
80 82 @Column(nullable = false)
81 83 private Integer zdz;
  84 + /** 终点站code */
  85 + private String zdzCode;
82 86 /** 终点站名字 */
83 87 @Column(nullable = false)
84 88 private String zdzName;
... ... @@ -365,4 +369,20 @@ public class SchedulePlanInfo {
365 369 public void setUpdateDate(Date updateDate) {
366 370 this.updateDate = updateDate;
367 371 }
  372 +
  373 + public String getQdzCode() {
  374 + return qdzCode;
  375 + }
  376 +
  377 + public void setQdzCode(String qdzCode) {
  378 + this.qdzCode = qdzCode;
  379 + }
  380 +
  381 + public String getZdzCode() {
  382 + return zdzCode;
  383 + }
  384 +
  385 + public void setZdzCode(String zdzCode) {
  386 + this.zdzCode = zdzCode;
  387 + }
368 388 }
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/detail.html
... ... @@ -218,48 +218,28 @@
218 218 <div class="form-group">
219 219 <label class="col-md-2 control-label">是否空调车:</label>
220 220 <div class="col-md-3">
221   - <label class="radio-inline">
222   - <input type="radio" name="hvacCar" ng-value="true" ng-model="ctrl.busInfoForDetail.hvacCar" disabled/>是
223   - </label>
224   - <label class="radio-inline">
225   - <input type="radio" name="hvacCar" ng-value="false" ng-model="ctrl.busInfoForDetail.hvacCar" disabled/>否
226   - </label>
  221 + <truefalse-Dic model="ctrl.busInfoForDetail.hvacCar" disabled="true" dicgroup="truefalseType" name="hvacCar"></truefalse-Dic>
227 222 </div>
228 223 </div>
229 224  
230 225 <div class="form-group">
231 226 <label class="col-md-2 control-label">有无人售票:</label>
232 227 <div class="col-md-3">
233   - <label class="radio-inline">
234   - <input type="radio" name="ticketType" ng-value="true" ng-model="ctrl.busInfoForDetail.ticketType" disabled/>是
235   - </label>
236   - <label class="radio-inline">
237   - <input type="radio" name="ticketType" ng-value="false" ng-model="ctrl.busInfoForDetail.ticketType" disabled/>否
238   - </label>
  228 + <truefalse-Dic model="ctrl.busInfoForDetail.ticketType" disabled="true" dicgroup="truefalseType" name="ticketType"></truefalse-Dic>
239 229 </div>
240 230 </div>
241 231  
242 232 <div class="form-group">
243 233 <label class="col-md-2 control-label">是否有LED服务屏:</label>
244 234 <div class="col-md-3">
245   - <label class="radio-inline">
246   - <input type="radio" name="ledScreen" ng-value="true" ng-model="ctrl.busInfoForDetail.ledScreen" disabled/>是
247   - </label>
248   - <label class="radio-inline">
249   - <input type="radio" name="ledScreen" ng-value="false" ng-model="ctrl.busInfoForDetail.ledScreen" disabled/>否
250   - </label>
  235 + <truefalse-Dic model="ctrl.busInfoForDetail.ledScreen" disabled="true" dicgroup="truefalseType" name="ledScreen"></truefalse-Dic>
251 236 </div>
252 237 </div>
253 238  
254 239 <div class="form-group">
255 240 <label class="col-md-2 control-label">是否有TV视屏:</label>
256 241 <div class="col-md-3">
257   - <label class="radio-inline">
258   - <input type="radio" name="tvVideoType" ng-value="true" ng-model="ctrl.busInfoForDetail.tvVideoType" disabled/>是
259   - </label>
260   - <label class="radio-inline">
261   - <input type="radio" name="tvVideoType" ng-value="false" ng-model="ctrl.busInfoForDetail.tvVideoType" disabled/>否
262   - </label>
  242 + <truefalse-Dic model="ctrl.busInfoForDetail.tvVideoType" disabled="true" dicgroup="truefalseType" name="tvVideoType"></truefalse-Dic>
263 243 </div>
264 244 </div>
265 245  
... ... @@ -299,12 +279,7 @@
299 279 <div class="form-group">
300 280 <label class="col-md-2 control-label">是否电车:</label>
301 281 <div class="col-md-3">
302   - <label class="radio-inline">
303   - <input type="radio" name="sfdc" ng-value="true" ng-model="ctrl.busInfoForDetail.sfdc" disabled/>是
304   - </label>
305   - <label class="radio-inline">
306   - <input type="radio" name="sfdc" ng-value="true" ng-model="ctrl.busInfoForDetail.sfdc" disabled/>否
307   - </label>
  282 + <truefalse-Dic model="ctrl.busInfoForDetail.sfdc" disabled="true" dicgroup="truefalseType" name="sfdc"></truefalse-Dic>
308 283 </div>
309 284 </div>
310 285  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/edit.html
... ... @@ -320,56 +320,28 @@
320 320 <div class="form-group">
321 321 <label class="col-md-2 control-label">是否空调车:</label>
322 322 <div class="col-md-3">
323   - <label class="radio-inline">
324   - <input type="radio" name="hvacCar"
325   - ng-value="true" ng-model="ctrl.busInfoForSave.hvacCar"/>是
326   - </label>
327   - <label class="radio-inline">
328   - <input type="radio" name="hvacCar"
329   - ng-value="false" ng-model="ctrl.busInfoForSave.hvacCar"/>否
330   - </label>
  323 + <truefalse-Dic model="ctrl.busInfoForSave.hvacCar" dicgroup="truefalseType" name="hvacCar"></truefalse-Dic>
331 324 </div>
332 325 </div>
333 326  
334 327 <div class="form-group">
335 328 <label class="col-md-2 control-label">有无人售票:</label>
336 329 <div class="col-md-3">
337   - <label class="radio-inline">
338   - <input type="radio" name="ticketType"
339   - ng-value="true" ng-model="ctrl.busInfoForSave.ticketType"/>是
340   - </label>
341   - <label class="radio-inline">
342   - <input type="radio" name="ticketType"
343   - ng-value="false" ng-model="ctrl.busInfoForSave.ticketType"/>否
344   - </label>
  330 + <truefalse-Dic model="ctrl.busInfoForSave.ticketType" dicgroup="truefalseType" name="ticketType"></truefalse-Dic>
345 331 </div>
346 332 </div>
347 333  
348 334 <div class="form-group">
349 335 <label class="col-md-2 control-label">是否有LED服务屏:</label>
350 336 <div class="col-md-3">
351   - <label class="radio-inline">
352   - <input type="radio" name="ledScreen"
353   - ng-value="true" ng-model="ctrl.busInfoForSave.ledScreen"/>是
354   - </label>
355   - <label class="radio-inline">
356   - <input type="radio" name="ledScreen"
357   - ng-value="false" ng-model="ctrl.busInfoForSave.ledScreen"/>否
358   - </label>
  337 + <truefalse-Dic model="ctrl.busInfoForSave.ledScreen" dicgroup="truefalseType" name="ledScreen"></truefalse-Dic>
359 338 </div>
360 339 </div>
361 340  
362 341 <div class="form-group">
363 342 <label class="col-md-2 control-label">是否有TV视屏:</label>
364 343 <div class="col-md-3">
365   - <label class="radio-inline">
366   - <input type="radio" name="tvVideoType"
367   - ng-value="true" ng-model="ctrl.busInfoForSave.tvVideoType"/>是
368   - </label>
369   - <label class="radio-inline">
370   - <input type="radio" name="tvVideoType"
371   - ng-value="false" ng-model="ctrl.busInfoForSave.tvVideoType"/>否
372   - </label>
  344 + <truefalse-Dic model="ctrl.busInfoForSave.tvVideoType" dicgroup="truefalseType" name="tvVideoType"></truefalse-Dic>
373 345 </div>
374 346 </div>
375 347  
... ... @@ -439,14 +411,7 @@
439 411 <div class="form-group">
440 412 <label class="col-md-2 control-label">是否电车:</label>
441 413 <div class="col-md-3">
442   - <label class="radio-inline">
443   - <input type="radio" name="sfdc"
444   - ng-value="true" ng-model="ctrl.busInfoForSave.sfdc"/>是
445   - </label>
446   - <label class="radio-inline">
447   - <input type="radio" name="sfdc"
448   - ng-value="false" ng-model="ctrl.busInfoForSave.sfdc"/>否
449   - </label>
  414 + <truefalse-Dic model="ctrl.busInfoForSave.sfdc" dicgroup="truefalseType" name="sfdc"></truefalse-Dic>
450 415 </div>
451 416 </div>
452 417  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/form.html
... ... @@ -45,7 +45,8 @@
45 45 <div class="col-md-3">
46 46 <input type="text" class="form-control"
47 47 name="insideCode" ng-model="ctrl.busInfoForSave.insideCode"
48   - required ng-maxlength="8" placeholder="请输入车辆内部编码"/>
  48 + required ng-maxlength="8" remote-Validaton rvtype="zbh"
  49 + placeholder="请输入车辆内部编码"/>
49 50 </div>
50 51 <!-- 隐藏块,显示验证信息 -->
51 52 <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.required">
... ... @@ -54,6 +55,9 @@
54 55 <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.maxlength">
55 56 内部编号长度不能超过8位
56 57 </div>
  58 + <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.remote">
  59 + 内部编号不能重复
  60 + </div>
57 61 </div>
58 62  
59 63 <div class="form-group has-success has-feedback">
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/list.html
... ... @@ -91,7 +91,7 @@
91 91 <span ng-bind="info.brancheCompany"></span>
92 92 </td>
93 93 <td>
94   - <span ng-bind="info.sfdc"></span>
  94 + <span ng-bind="info.sfdc | dict:'truefalseType':'未知' "></span>
95 95 </td>
96 96 <td>
97 97 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
... ...
src/main/resources/static/pages/scheduleApp/module/main.js
... ... @@ -657,6 +657,10 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
657 657 ;
658 658 }]);
659 659  
  660 +// 自定义的一些指令
  661 +
  662 +
  663 +
660 664 // 全局service放置在此处,
661 665 // 一般这种服务会被其他模块调用的,所以干脆放到main.js里
662 666  
... ... @@ -875,6 +879,88 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;BusLineInfoStatService_g&#39;, [&#39;$resource&#39;,
875 879 }]);
876 880  
877 881  
  882 +//--------------------------- 通用filter和directive -----------------------------//
  883 +angular.module('ScheduleApp').filter("dict", [function() {
  884 + /**
  885 + * 字典过滤器,将后台的字典编码转换成文字说明。
  886 + * code,过滤的值,group,过滤的参数(字典group类型),dv没有匹配到的默认值
  887 + * 用例:sfdc | dict:'dctype'
  888 + */
  889 + return function(code, group, dv) {
  890 + if (code == null) {
  891 + return dv;
  892 + } else {
  893 + return dictionaryUtils.transformCode(group, code);
  894 + }
  895 + };
  896 +}]);
  897 +
  898 +angular.module('ScheduleApp').directive("truefalseDic", [function() {
  899 + /**
  900 + * true,false组合的单元按钮组的指令。
  901 + * 指令名称:truefalse-Dic
  902 + */
  903 + return {
  904 + restrict: 'E',
  905 + templateUrl: '/pages/scheduleApp/module/other/truefalseRadioGroupTemplate.html',
  906 + scope: {
  907 + model: "="
  908 + },
  909 + /**
  910 + * model 是绑定外部值。
  911 + * disabled 说明是否不能修改
  912 + * dicgroup 字典组的类型
  913 + */
  914 + link: function(scope, element, attr) {
  915 + if (attr["name"]) {
  916 + scope["nv"] = attr["name"];
  917 + }
  918 +
  919 + if (attr["disabled"]) {
  920 + element.find("input").attr("disabled", "");
  921 + }
  922 + if (attr["dicgroup"]) {
  923 + var obj = dictionaryUtils.getByGroup(attr['dicgroup']);
  924 + if (obj["true"])
  925 + scope["trueDesc"] = obj["true"];
  926 + else
  927 + scope["trueDesc"] = "未知true";
  928 +
  929 + if (obj["false"])
  930 + scope["falseDesc"] = obj["false"];
  931 + else
  932 + scope["falseDesc"] = "未知false";
  933 + } else {
  934 + scope["trueDesc"] = "未知true";
  935 + scope["falseDesc"] = "未知false";
  936 + }
  937 + }
  938 + };
  939 +}]);
  940 +
  941 +angular.module('ScheduleApp').directive("remoteValidaton", [function() {
  942 + /**
  943 + * 远端验证指令,依赖于ngModel
  944 + * 指令名称 remote-Validation
  945 + * 需要属性 rvtype 表示验证类型
  946 + */
  947 + return {
  948 + restrict: "A",
  949 + require: "ngModel",
  950 + link: function(scope, element, attr, ngModelCtrl) {
  951 + element.bind("keyup", function() {
  952 + if (attr["rvtype"]) {
  953 + // 根据rvtype的值,确定使用那个远端验证的url,
  954 + // 这个貌似没法通用,根据业务变换
  955 + console.log(attr['rvtype']);
  956 + } else {
  957 + // 没有rvtype,就不用远端验证了
  958 + ngModelCtrl.$setValidity('remote', true);
  959 + }
  960 + });
  961 + }
  962 + };
  963 +}]);
878 964  
879 965  
880 966  
... ...
src/main/resources/static/pages/scheduleApp/module/other/truefalseRadioGroupTemplate.html 0 → 100644
  1 +<div>
  2 + <label class="radio-inline">
  3 + <input type="radio" name="{{nv}}"
  4 + ng-value="true" ng-model="model" {{disabled}}/>{{trueDesc}}
  5 + </label>
  6 + <label class="radio-inline">
  7 + <input type="radio" name="{{nv}}"
  8 + ng-value="false" ng-model="model" {{disabled}}/>{{falseDesc}}
  9 + </label>
  10 +</div>
0 11 \ No newline at end of file
... ...