Commit 5c838643e927dbb00d7070f8cb3bbffa4edb7443

Authored by 徐烜
1 parent ef0e2354

调度值勤日报,修改车辆1,车辆2配置,添加remotevalidate验证,判定是否在当前线路中配置

src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.java
... ... @@ -58,4 +58,25 @@ public class CarConfigInfoController extends BController<CarConfigInfo, Long> {
58 58  
59 59 return rtn;
60 60 }
  61 +
  62 + @RequestMapping(value = "/validate_cars_config", method = RequestMethod.GET)
  63 + public Map<String, Object> validate_cars_config(@RequestParam Map<String, Object> param) {
  64 + Map<String, Object> rtn = new HashMap<>();
  65 + try {
  66 + // 车辆重复配置验证
  67 + CarConfigInfo carConfigInfo = new CarConfigInfo(
  68 + null,
  69 + param.get("xl.id_eq"),
  70 + param.get("xl.name_eq"),
  71 + param.get("cl.id_eq")
  72 + );
  73 + carConfigInfoService.validate_cars_config(carConfigInfo);
  74 + rtn.put("status", ResponseCode.SUCCESS);
  75 + } catch (ScheduleException exp) {
  76 + rtn.put("status", ResponseCode.ERROR);
  77 + rtn.put("msg", exp.getMessage());
  78 + }
  79 +
  80 + return rtn;
  81 + }
61 82 }
... ...
src/main/java/com/bsth/service/schedule/CarConfigInfoService.java
... ... @@ -8,5 +8,6 @@ import com.bsth.service.schedule.exception.ScheduleException;
8 8 */
9 9 public interface CarConfigInfoService extends BService<CarConfigInfo, Long> {
10 10 void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException;
  11 + void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException;
11 12 void toggleCancel(Long id) throws ScheduleException;
12 13 }
... ...
src/main/java/com/bsth/service/schedule/impl/CarConfigInfoServiceImpl.java
... ... @@ -73,6 +73,17 @@ public class CarConfigInfoServiceImpl extends BServiceImpl&lt;CarConfigInfo, Long&gt;
73 73  
74 74 }
75 75  
  76 + @Override
  77 + public void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException {
  78 + Map<String, Object> param = new HashMap<>();
  79 + param.put("xl.id_eq", carConfigInfo.getXl().getId());
  80 + param.put("cl.id_eq", carConfigInfo.getCl().getId());
  81 + List<CarConfigInfo> carConfigInfos = list(param);
  82 + if (CollectionUtils.isEmpty(carConfigInfos)) {
  83 + throw new ScheduleException("当前车辆没有配置在当前线路中,不属于当前线路!");
  84 + }
  85 + }
  86 +
76 87 @Transactional
77 88 @Override
78 89 public void delete(Long aLong) throws ScheduleException {
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice-legacy.js
... ... @@ -441,6 +441,18 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
441 441 }
442 442 )
443 443 },
  444 + cc_cars_config: { // 车辆是否配置在指定线路中
  445 + template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'cl.id_eq': -1}, // 查询参数模版
  446 + remote: $resource( // $resource封装对象
  447 + '/cci/validate_cars_config',
  448 + {},
  449 + {
  450 + do: {
  451 + method: 'GET'
  452 + }
  453 + }
  454 + )
  455 + },
444 456 ec_jsy: { // 驾驶员不能重复配置
445 457 template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'jsy.id_eq': -1}, // 查询参数模版
446 458 remote: $resource( // $resource封装对象
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
... ... @@ -1319,6 +1319,18 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
1319 1319 }
1320 1320 )
1321 1321 },
  1322 + cc_cars_config: { // 车辆是否配置在指定线路中
  1323 + template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'cl.id_eq': -1}, // 查询参数模版
  1324 + remote: $resource( // $resource封装对象
  1325 + '/cci/validate_cars_config',
  1326 + {},
  1327 + {
  1328 + do: {
  1329 + method: 'GET'
  1330 + }
  1331 + }
  1332 + )
  1333 + },
1322 1334 ec_jsy: { // 驾驶员不能重复配置
1323 1335 template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'jsy.id_eq': -1}, // 查询参数模版
1324 1336 remote: $resource( // $resource封装对象
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/edit.html
... ... @@ -89,6 +89,14 @@
89 89 <div class="alert alert-danger well-sm" ng-show="myForm.cl1.$error.required">
90 90 车辆1必须选择
91 91 </div>
  92 +
  93 + <input type="hidden" name="cl1_h" ng-model="ctrl.formData.cl1.id"
  94 + remote-Validation
  95 + remotevtype="cc_cars_config"
  96 + remotevparam="{{ {'xl.id_eq': ctrl.xlId, 'xl.name_eq': ctrl.xlName, 'cl.id_eq': ctrl.formData.cl1.id} | json}}" />
  97 + <div class="alert alert-danger well-sm" ng-show="myForm.cl1_h.$error.remote">
  98 + {{$remote_msg}}
  99 + </div>
92 100 </div>
93 101 <div class="form-group">
94 102 <label class="col-md-5 control-label">车辆2:</label>
... ... @@ -106,6 +114,14 @@
106 114 >
107 115 </sa-Select5>
108 116 </div>
  117 +
  118 + <input type="hidden" name="cl2_h" ng-model="ctrl.formData.cl1.id"
  119 + remote-Validation
  120 + remotevtype="cc_cars_config"
  121 + remotevparam="{{ {'xl.id_eq': ctrl.xlId, 'xl.name_eq': ctrl.xlName, 'cl.id_eq': ctrl.formData.cl2.id} | json}}" />
  122 + <div class="alert alert-danger well-sm" ng-show="myForm.cl2_h.$error.remote">
  123 + {{$remote_msg}}
  124 + </div>
109 125 </div>
110 126  
111 127 <div class="form-group has-success has-feedback">
... ...