Commit 1a8939afa4c0aec5ae5b65db4c7193762c4a0659

Authored by 徐烜
1 parent cda7cc42

Update

src/main/java/com/bsth/controller/schedule/basicinfo/CarDeviceController.java 0 → 100644
  1 +package com.bsth.controller.schedule.basicinfo;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.controller.schedule.BController;
  5 +import com.bsth.entity.CarDevice;
  6 +import com.bsth.service.schedule.CarDeviceService;
  7 +import com.bsth.service.schedule.ScheduleException;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import java.util.HashMap;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * Created by xu on 16/12/15.
  19 + */
  20 +@RestController(value = "carDeviceController_sc")
  21 +@RequestMapping("cde_sc")
  22 +public class CarDeviceController extends BController<CarDevice, Long> {
  23 + @Autowired
  24 + private CarDeviceService carDeviceService;
  25 +
  26 + @RequestMapping(value = "/validate_qyrq", method = RequestMethod.GET)
  27 + public Map<String, Object> validate_qyrq(@RequestParam Map<String, Object> param) {
  28 + Map<String, Object> rtn = new HashMap<>();
  29 +
  30 + try {
  31 + // 启用日期验证
  32 + CarDevice carDevice = new CarDevice(
  33 + param.get("id_eq"),
  34 + param.get("xl_eq"),
  35 + param.get("cl_eq"),
  36 + param.get("qyrq_eq")
  37 + );
  38 + carDeviceService.validate_qyrq(carDevice);
  39 + rtn.put("status", ResponseCode.SUCCESS);
  40 + } catch (ScheduleException exp) {
  41 + rtn.put("status", ResponseCode.ERROR);
  42 + rtn.put("msg", exp.getMessage());
  43 + }
  44 +
  45 + return rtn;
  46 + }
  47 +
  48 +}
... ...
src/main/java/com/bsth/entity/CarDevice.java
1 1 package com.bsth.entity;
2 2  
3 3 import com.bsth.entity.schedule.BEntity;
  4 +import org.joda.time.DateTime;
4 5  
5 6 import javax.persistence.*;
6 7 import java.util.Date;
... ... @@ -62,6 +63,27 @@ public class CarDevice extends BEntity {
62 63 @Column(nullable = false)
63 64 private Boolean isCancel = false;
64 65  
  66 + public CarDevice() {}
  67 + public CarDevice(Object id, Object xlid, Object clid, Object qyrq) {
  68 + if (id != null) {
  69 + this.id = Long.valueOf(id.toString());
  70 + }
  71 + if (xlid != null) {
  72 + this.xl = Integer.valueOf(xlid.toString());
  73 + }
  74 + if (clid != null) {
  75 + this.cl = Integer.valueOf(clid.toString());
  76 + }
  77 + if (qyrq != null) {
  78 + try {
  79 + this.qyrq = new Date();
  80 + this.qyrq.setTime(Long.parseLong(qyrq.toString()));
  81 + } catch (Exception exp) {
  82 + this.qyrq = new DateTime(qyrq.toString()).toDate();
  83 + }
  84 + }
  85 + }
  86 +
65 87 public Long getId() {
66 88 return id;
67 89 }
... ...
src/main/java/com/bsth/service/schedule/impl/CarDeviceServiceImpl.java
... ... @@ -26,8 +26,8 @@ public class CarDeviceServiceImpl extends BServiceImpl&lt;CarDevice, Long&gt; implemen
26 26 public CarDevice save(CarDevice carDevice) {
27 27 // 查找对应的车辆基础信息,更新设备编号数据
28 28 Cars cars = carsService.findById(carDevice.getCl());
29   -
30   - return null;
  29 + cars.setEquipmentCode(carDevice.getNewDeviceNo());
  30 + return super.save(carDevice);
31 31 }
32 32  
33 33 @Transactional
... ... @@ -45,9 +45,25 @@ public class CarDeviceServiceImpl extends BServiceImpl&lt;CarDevice, Long&gt; implemen
45 45 }
46 46 param.put("xl_eq", carDevice.getXl());
47 47 param.put("cl_eq", carDevice.getCl());
48   - param.put("qyrq_ne", carDevice.getQyrq());
  48 + param.put("qyrq_ge", carDevice.getQyrq());
49 49 if (!CollectionUtils.isEmpty(list(param))) {
50 50 throw new ScheduleException("启用日期必须比历史的启用日期大");
51 51 }
52 52 }
  53 +
  54 + @Transactional
  55 + @Override
  56 + public void delete(Long aLong) throws ScheduleException {
  57 + toggleCancel(aLong);
  58 + }
  59 +
  60 + @Transactional
  61 + public void toggleCancel(Long id) throws ScheduleException {
  62 + CarDevice carDevice = findById(id);
  63 + if (carDevice.getIsCancel()) {
  64 + carDevice.setIsCancel(false);
  65 + } else {
  66 + carDevice.setIsCancel(true);
  67 + }
  68 + }
53 69 }
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/edit.html
... ... @@ -147,7 +147,7 @@
147 147 ng-model="ctrl.deviceInfoForSave.qyrq" readonly
148 148 remote-Validation
149 149 remotevtype="cde1"
150   - remotevparam="{{ {'qyrq': ctrl.deviceInfoForSave.qyrq, 'xl': ctrl.deviceInfoForSave.xl, 'cl': ctrl.deviceInfoForSave.cl} | json}}"/>
  150 + remotevparam="{{ {'id_eq': ctrl.deviceInfoForSave.id, 'qyrq_eq': ctrl.deviceInfoForSave.qyrq, 'xl_eq': ctrl.deviceInfoForSave.xl, 'cl_eq': ctrl.deviceInfoForSave.cl} | json}}"/>
151 151 <span class="input-group-btn">
152 152 <button type="button" class="btn btn-default" ng-click="ctrl.qyrq_open()">
153 153 <i class="glyphicon glyphicon-calendar"></i>
... ... @@ -160,7 +160,7 @@
160 160 启用日期必须选择
161 161 </div>
162 162 <div class="alert alert-danger well-sm" ng-show="myForm.qyrq.$error.remote">
163   - 启用日期必须比历史的启用日期大
  163 + {{$remote_msg}}
164 164 </div>
165 165 </div>
166 166  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/form.html
... ... @@ -147,7 +147,7 @@
147 147 ng-model="ctrl.deviceInfoForSave.qyrq" readonly
148 148 remote-Validation
149 149 remotevtype="cde1"
150   - remotevparam="{{ {'qyrq': ctrl.deviceInfoForSave.qyrq, 'xl': ctrl.deviceInfoForSave.xl, 'cl': ctrl.deviceInfoForSave.cl} | json}}"/>
  150 + remotevparam="{{ {'qyrq_eq': ctrl.deviceInfoForSave.qyrq, 'xl_eq': ctrl.deviceInfoForSave.xl, 'cl_eq': ctrl.deviceInfoForSave.cl} | json}}"/>
151 151 <span class="input-group-btn">
152 152 <button type="button" class="btn btn-default" ng-click="ctrl.qyrq_open()">
153 153 <i class="glyphicon glyphicon-calendar"></i>
... ... @@ -160,7 +160,7 @@
160 160 启用日期必须选择
161 161 </div>
162 162 <div class="alert alert-danger well-sm" ng-show="myForm.qyrq.$error.remote">
163   - 启用日期必须比历史的启用日期大
  163 + {{$remote_msg}}
164 164 </div>
165 165 </div>
166 166  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/list.html
... ... @@ -12,7 +12,8 @@
12 12 <th>新设备编号</th>
13 13 <th>旧SIM卡</th>
14 14 <th>新SIM卡</th>
15   - <th style="width: 180px;">创建时间</th>
  15 + <th style="width: 180px;">更新时间</th>
  16 + <th style="width: 80px;" >状态</th>
16 17 <th style="width: 150pt;">操作</th>
17 18 </tr>
18 19 <tr role="row" class="filter">
... ... @@ -41,19 +42,24 @@
41 42 <td></td>
42 43 <td></td>
43 44 <td>
  45 + <label class="checkbox-inline input">
  46 + <input type="checkbox" ng-model="ctrl.searchCondition()['isCancel_eq']" />已作废
  47 + </label>
  48 + </td>
  49 + <td>
44 50 <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
45   - ng-click="ctrl.pageChanaged()">
  51 + ng-click="ctrl.doPage()">
46 52 <i class="fa fa-search"></i> 搜索</button>
47 53  
48 54 <button class="btn btn-sm red btn-outline filter-cancel"
49   - ng-click="ctrl.resetSearchCondition()">
  55 + ng-click="ctrl.reset()">
50 56 <i class="fa fa-times"></i> 重置</button>
51 57 </td>
52 58  
53 59 </tr>
54 60 </thead>
55 61 <tbody>
56   - <tr ng-repeat="info in ctrl.pageInfo.infos" ng-class="{odd: true, gradeX: true, danger: info.isCancel}">
  62 + <tr ng-repeat="info in ctrl.page()['content']" ng-class="{odd: true, gradeX: true, danger: info.isCancel}">
57 63 <td>
58 64 <span ng-bind="$index + 1"></span>
59 65 </td>
... ... @@ -79,15 +85,19 @@
79 85 <span ng-bind="info.newSimNo"></span>
80 86 </td>
81 87 <td>
82   - <span ng-bind="info.createDate | date:'yyyy-MM-dd HH:mm:ss'"></span>
  88 + <span ng-bind="info.updateDate | date:'yyyy-MM-dd HH:mm:ss'"></span>
  89 + </td>
  90 + <td>
  91 + <span class="glyphicon glyphicon-ok" ng-if="info.isCancel == '0'"></span>
  92 + <span class="glyphicon glyphicon-remove" ng-if="info.isCancel == '1'"></span>
83 93 </td>
84 94 <td>
85 95 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
86 96 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
87 97 <a ui-sref="deviceInfoManage_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a>
88 98 <a ui-sref="deviceInfoManage_edit({id: info.id})" class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
89   - <a ng-click="ctrl.toggleCde(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
90   - <a ng-click="ctrl.toggleCde(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
  99 + <a ng-click="ctrl.toggleCarDevice(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
  100 + <a ng-click="ctrl.toggleCarDevice(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
91 101 </td>
92 102 </tr>
93 103 </tbody>
... ... @@ -96,9 +106,9 @@
96 106 </div>
97 107  
98 108 <div style="text-align: right;">
99   - <uib-pagination total-items="ctrl.pageInfo.totalItems"
100   - ng-model="ctrl.pageInfo.currentPage"
101   - ng-change="ctrl.pageChanaged()"
  109 + <uib-pagination total-items="ctrl.page()['totalElements']"
  110 + ng-model="ctrl.page()['uiNumber']"
  111 + ng-change="ctrl.doPage()"
102 112 rotate="false"
103 113 max-size="10"
104 114 boundary-links="true"
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/module.js
1 1 // 设备信息维护 service controller 等写在一起
2 2  
3   -angular.module('ScheduleApp').factory('DeviceInfoManageService', ['DeviceInfoManageService_g', function(service) {
4   - /** 当前的查询条件信息 */
5   - var currentSearchCondition = {};
6   -
7   - /** 当前第几页 */
8   - var currentPageNo = 1;
9   -
10   - return {
11   - /**
12   - * 获取查询条件信息,
13   - * 用于给controller用来和页面数据绑定。
14   - */
15   - getSearchCondition: function() {
16   - return currentSearchCondition;
17   - },
18   - /**
19   - * 重置查询条件信息。
20   - */
21   - resetSearchCondition: function() {
22   - var key;
23   - for (key in currentSearchCondition) {
24   - currentSearchCondition[key] = "";
25   - }
26   - },
27   - /**
28   - * 设置当前页码。
29   - * @param cpn 从1开始,后台是从0开始的
30   - */
31   - setCurrentPageNo: function(cpn) {
32   - currentPageNo = cpn;
33   - },
34   - /**
35   - * 组装查询参数,返回一个promise查询结果。
36   - * @param params 查询参数
37   - * @return 返回一个 promise
38   - */
39   - getPage: function() {
40   - var params = currentSearchCondition; // 查询条件
41   - params.page = currentPageNo - 1; // 服务端页码从0开始
42   - return service.list(params).$promise;
43   - },
44   - /**
45   - * 获取明细信息。
46   - * @param id 车辆id
47   - * @return 返回一个 promise
48   - */
49   - getDetail: function(id) {
50   - var params = {id: id};
51   - return service.get(params).$promise;
52   - },
53   - /**
54   - * 保存信息。
55   - * @param obj 车辆详细信息
56   - * @return 返回一个 promise
57   - */
58   - saveDetail: function(obj) {
59   - return service.save(obj).$promise;
60   - },
61   - /**
62   - * 删除信息。
63   - * @param id 主键id
64   - * @returns {*|Function|promise|n}
65   - */
66   - deleteDetail: function(id) {
67   - return service.delete({id: id}).$promise;
  3 +angular.module('ScheduleApp').factory(
  4 + 'DeviceInfoManageService',
  5 + [
  6 + 'DeviceInfoManageService_g',
  7 + function(service) {
  8 + /** 当前的查询条件信息 */
  9 + var currentSearchCondition = {'isCancel_eq': false};
  10 +
  11 + // 当前查询返回的信息
  12 + var currentPage = { // 后台spring data返回的格式
  13 + totalElements: 0,
  14 + number: 0, // 后台返回的页码,spring返回从0开始
  15 + content: [],
  16 +
  17 + uiNumber: 1 // 页面绑定的页码
  18 + };
  19 +
  20 + // 查询对象
  21 + var queryClass = service;
  22 +
  23 + return {
  24 + getQueryClass: function() {
  25 + return queryClass;
  26 + },
  27 + getSearchCondition: function() {
  28 + currentSearchCondition.page = currentPage.uiNumber - 1;
  29 + return currentSearchCondition;
  30 + },
  31 + getPage: function(page) {
  32 + if (page) {
  33 + currentPage.totalElements = page.totalElements;
  34 + currentPage.number = page.number;
  35 + currentPage.content = page.content;
  36 + }
  37 + return currentPage;
  38 + },
  39 + resetStatus: function() {
  40 + currentSearchCondition = {page: 0, 'isCancel_eq': false};
  41 + currentPage = {
  42 + totalElements: 0,
  43 + number: 0,
  44 + content: [],
  45 + uiNumber: 1
  46 + };
  47 + }
  48 +
  49 + };
  50 +
68 51 }
69   - };
70   -
71   -}]);
72   -
73   -angular.module('ScheduleApp').controller('DeviceInfoManageCtrl', ['DeviceInfoManageService', '$state', function(deviceInfoManageService, $state) {
74   - var self = this;
75   -
76   - // 切换到form状态
77   - self.goForm = function() {
78   - //alert("切换");
79   - $state.go("deviceInfoManage_form");
80   - }
81   -
82   -
83   -}]);
84   -
85   -angular.module('ScheduleApp').controller('DeviceInfoManageListCtrl', ['DeviceInfoManageService', function(deviceInfoManageService) {
86   - var self = this;
87   - self.pageInfo = {
88   - totalItems : 0,
89   - currentPage : 1,
90   - infos: []
91   - };
92   -
93   - // 初始创建的时候,获取一次列表数据
94   - deviceInfoManageService.getPage().then(
95   - function(result) {
96   - self.pageInfo.totalItems = result.totalElements;
97   - self.pageInfo.currentPage = result.number + 1;
98   - self.pageInfo.infos = result.content;
99   - deviceInfoManageService.setCurrentPageNo(result.number + 1);
100   - },
101   - function(result) {
102   - alert("出错啦!");
  52 + ]
  53 +);
  54 +
  55 +// index.html控制器
  56 +angular.module('ScheduleApp').controller(
  57 + 'DeviceInfoManageCtrl',
  58 + [
  59 + 'DeviceInfoManageService',
  60 + '$state',
  61 + function(service, $state) {
  62 + var self = this;
  63 +
  64 + // 切换到form状态
  65 + self.goForm = function() {
  66 + //alert("切换");
  67 + $state.go("deviceInfoManage_form");
  68 + };
  69 +
103 70 }
104   - );
105   -
106   - // 翻页的时候调用
107   - self.pageChanaged = function() {
108   - deviceInfoManageService.setCurrentPageNo(self.pageInfo.currentPage);
109   - deviceInfoManageService.getPage().then(
110   - function(result) {
111   - self.pageInfo.totalItems = result.totalElements;
112   - self.pageInfo.currentPage = result.number + 1;
113   - self.pageInfo.infos = result.content;
114   - deviceInfoManageService.setCurrentPageNo(result.number + 1);
115   - },
116   - function(result) {
117   - alert("出错啦!");
118   - }
119   - );
120   - };
121   - // 获取查询条件数据
122   - self.searchCondition = function() {
123   - return deviceInfoManageService.getSearchCondition();
124   - };
125   - // 重置查询条件
126   - self.resetSearchCondition = function() {
127   - deviceInfoManageService.resetSearchCondition();
128   - self.pageInfo.currentPage = 1;
129   - self.pageChanaged();
130   - };
131   -
132   - // 作废/撤销
133   - self.toggleCde = function(id) {
134   - // TODO:
135   - deviceInfoManageService.deleteDetail(id).then(
136   - function(result) {
137   - if (result.message) { // 暂时这样做,之后全局拦截
138   - alert("失败:" + result.message);
139   - } else {
140   - alert("成功!");
141   -
142   - deviceInfoManageService.getPage().then(
143   - function(result) {
144   - self.pageInfo.totalItems = result.totalElements;
145   - self.pageInfo.currentPage = result.number + 1;
146   - self.pageInfo.infos = result.content;
147   - deviceInfoManageService.setCurrentPageNo(result.number + 1);
148   - },
149   - function(result) {
150   - alert("出错啦!");
151   - }
152   - );
153   - }
  71 + ]
  72 +);
  73 +
  74 +// list.html控制器
  75 +angular.module('ScheduleApp').controller(
  76 + 'DeviceInfoManageListCtrl',
  77 + [
  78 + 'DeviceInfoManageService',
  79 + function(service) {
  80 + var self = this;
  81 + var CarDevice = service.getQueryClass();
  82 +
  83 + self.page = function() {
  84 + return service.getPage();
  85 + };
  86 +
  87 + self.searchCondition = function() {
  88 + return service.getSearchCondition();
  89 + };
  90 +
  91 + self.doPage = function() {
  92 + var page = CarDevice.list(self.searchCondition(), function() {
  93 + service.getPage(page);
  94 + });
  95 + };
  96 + self.reset = function() {
  97 + service.resetStatus();
  98 + var page = CarDevice.list(self.searchCondition(), function() {
  99 + service.getPage(page);
  100 + });
  101 + };
  102 + self.toggleCarDevice = function(id) {
  103 + CarDevice.delete({id: id}, function(result) {
  104 + if (result.msg) { // 暂时这样做,之后全局拦截
  105 + alert("失败:" + result.msg);
  106 + } else {
  107 + self.doPage();
  108 + }
  109 + });
  110 + };
  111 +
  112 + self.doPage();
154 113  
155   - },
156   - function(result) {
157   - alert("出错啦!" + result);
158   - }
159   - );
160   - };
161   -
162   -}]);
163   -
164   -angular.module('ScheduleApp').controller('DeviceInfoManageFormCtrl', ['DeviceInfoManageService', '$stateParams', '$state', function(deviceInfoManageService, $stateParams, $state) {
165   - var self = this;
166   -
167   - // 启用日期 日期控件开关
168   - self.qyrqOpen = false;
169   - self.qyrq_open = function() {
170   - self.qyrqOpen = true;
171   - };
172   -
173   - // 欲保存的busInfo信息,绑定
174   - self.deviceInfoForSave = {};
175   -
176   - // 获取传过来的id,有的话就是修改,获取一遍数据
177   - var id = $stateParams.id;
178   - if (id) {
179   - self.deviceInfoForSave.id = id;
180   - deviceInfoManageService.getDetail(id).then(
181   - function(result) {
182   - var key;
183   - for (key in result) {
184   - self.deviceInfoForSave[key] = result[key];
185   - }
186   - // 填写所有的 select 控件选中框数据
187   - // 公司字典
188   - if (self.deviceInfoForSave.gsName) {
189   - angular.forEach(self.gses, function(data) {
190   - if (self.deviceInfoForSave.gsName == data.gsmc) {
191   - self.deviceInfoForSave.gs_selected = data;
192   - }
193   - });
194   - }
195   - },
196   - function(result) {
197   - alert("出错啦!");
  114 +
  115 + }
  116 + ]
  117 +);
  118 +
  119 +// form.html控制器
  120 +angular.module('ScheduleApp').controller(
  121 + 'DeviceInfoManageFormCtrl',
  122 + [
  123 + 'DeviceInfoManageService',
  124 + '$stateParams',
  125 + '$state',
  126 + function(service, $stateParams, $state) {
  127 + var self = this;
  128 + var CarDevice = service.getQueryClass();
  129 +
  130 + // 启用日期 日期控件开关
  131 + self.qyrqOpen = false;
  132 + self.qyrq_open = function() {
  133 + self.qyrqOpen = true;
  134 + };
  135 +
  136 + // 欲保存的busInfo信息,绑定
  137 + self.deviceInfoForSave = new CarDevice;
  138 +
  139 + // 获取传过来的id,有的话就是修改,获取一遍数据
  140 + var id = $stateParams.id;
  141 + if (id) {
  142 + CarDevice.get({id: id}, function(value) {
  143 + self.deviceInfoForSave = value;
  144 + });
198 145 }
199   - );
200   - }
201   -
202   - // 提交方法
203   - self.submit = function() {
204   - console.log(self.deviceInfoForSave);
205   - deviceInfoManageService.saveDetail(self.deviceInfoForSave).then(
206   - function(result) {
207   - // TODO:弹出框方式以后改
208   - if (result.status == 'SUCCESS') {
209   - alert("保存成功!");
  146 +
  147 + // 提交方法
  148 + self.submit = function() {
  149 + console.log(self.deviceInfoForSave);
  150 +
  151 + // 保存或者更新
  152 + self.deviceInfoForSave.$save(function() {
210 153 $state.go("deviceInfoManage");
211   - } else {
212   - alert("保存异常!");
213   - }
214   - },
215   - function(result) {
216   - // TODO:弹出框方式以后改
217   - alert("出错啦!");
218   - }
219   - );
220   - };
221   -
222   -}]);
223   -
224   -angular.module('ScheduleApp').controller('DeviceInfoManageDetailCtrl', ['DeviceInfoManageService', '$stateParams', function(deviceInfoManageService, $stateParams) {
225   - var self = this;
226   - self.title = "";
227   - self.deviceInfoForDetail = {};
228   - self.deviceInfoForDetail.id = $stateParams.id;
229   -
230   - // 当转向到此页面时,就获取明细信息并绑定
231   - deviceInfoManageService.getDetail($stateParams.id).then(
232   - function(result) {
233   - var key;
234   - for (key in result) {
235   - self.deviceInfoForDetail[key] = result[key];
236   - }
  154 + });
  155 + };
  156 +
  157 + }
  158 + ]
  159 +);
  160 +
  161 +// detail.html控制器
  162 +angular.module('ScheduleApp').controller(
  163 + 'DeviceInfoManageDetailCtrl',
  164 + [
  165 + 'DeviceInfoManageService',
  166 + '$stateParams',
  167 + function(service, $stateParams) {
  168 + var self = this;
  169 + var CarDevice = service.getQueryClass();
  170 + var id = $stateParams.id;
  171 +
  172 + self.title = "";
  173 + self.deviceInfoForDetail = {};
  174 +
  175 + // 当转向到此页面时,就获取明细信息并绑定
  176 + CarDevice.get({id: id}, function(value) {
  177 + self.deviceInfoForDetail = value;
  178 + self.title = "车辆 " +
  179 + self.deviceInfoForDetail.clZbh +
  180 + "设备信息";
  181 + });
237 182  
238   - self.title = "车辆 " + self.deviceInfoForDetail.clZbh + "设备信息";
239   - },
240   - function(result) {
241   - // TODO:弹出框方式以后改
242   - alert("出错啦!");
243 183 }
244   - );
245   -}]);
246 184 \ No newline at end of file
  185 + ]
  186 +);
247 187 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/service.js
1 1 // 车辆设备信息service
2 2 angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {
3 3 return $resource(
4   - '/cde/:id',
5   - {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'},
  4 + '/cde_sc/:id',
  5 + {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id'},
6 6 {
7 7 list: {
8 8 method: 'GET',
9 9 params: {
10 10 page: 0
  11 + },
  12 + transformResponse: function(rs) {
  13 + var dst = angular.fromJson(rs);
  14 + if (dst.status == 'SUCCESS') {
  15 + return dst.data;
  16 + } else {
  17 + return dst; // 业务错误留给控制器处理
  18 + }
11 19 }
12 20 },
13 21 get: {
14   - method: 'GET'
  22 + method: 'GET',
  23 + transformResponse: function(rs) {
  24 + var dst = angular.fromJson(rs);
  25 + if (dst.status == 'SUCCESS') {
  26 + return dst.data;
  27 + } else {
  28 + return dst;
  29 + }
  30 + }
15 31 },
16 32 save: {
17 33 method: 'POST'
... ...
src/main/resources/static/pages/scheduleApp/module/common/main.js
... ... @@ -104,18 +104,17 @@ ScheduleApp.factory(
104 104 // 如:{"timestamp":1478674739246,"status":500,"error":"Internal Server Error","exception":"java.lang.ClassCastException","message":"java.lang.String cannot be cast to java.lang.Long","path":"/tidc/importfile"}
105 105  
106 106 var output = [];
107   - if (!status) {
  107 + if (!rejection.status) {
108 108 alert("我擦,后台返回连个状态码都没返回,见鬼了,服务器可能重启了");
109   - } else if (status == -1) {
  109 + } else if (rejection.status == -1) {
110 110 // 服务器断开了
111 111 alert("貌似服务端连接不上");
112 112 } else {
113   - output.push("状态编码:" + status);
114   - output.push("访问路径:" + rejection.path);
115   - output.push("错误消息:" + rejection.message);
116   - if (status == 500) {
  113 + output.push("状态编码:" + rejection.status);
  114 + output.push("错误内容:" + angular.toJson(rejection.data));
  115 + if (rejection.status == 500) {
117 116 alert("服务端错误:" + "\n" + output.join("\n"));
118   - } else if (status == 407) {
  117 + } else if (rejection.status == 407) {
119 118 alert("请重新登录:" + "\n" + output.join("\n"));
120 119 } else {
121 120 alert("其他错误:" + "\n" + output.join("\n"));
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice-legacy.js
... ... @@ -388,9 +388,9 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
388 388 },
389 389  
390 390 cde1: { // 车辆设备启用日期验证
391   - template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒
  391 + template: {'xl_eq': -1, 'cl_eq': -1, 'qyrq_eq': 1}, // 日期毫秒
392 392 remote: $resource( // $resource封装对象
393   - '/cde//validate/qyrq',
  393 + '/cde_sc/validate_qyrq',
394 394 {},
395 395 {
396 396 do: {
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
... ... @@ -83,17 +83,33 @@ angular.module(&#39;ScheduleApp&#39;).factory(
83 83 // 车辆设备信息service
84 84 angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {
85 85 return $resource(
86   - '/cde/:id',
87   - {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'},
  86 + '/cde_sc/:id',
  87 + {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id'},
88 88 {
89 89 list: {
90 90 method: 'GET',
91 91 params: {
92 92 page: 0
  93 + },
  94 + transformResponse: function(rs) {
  95 + var dst = angular.fromJson(rs);
  96 + if (dst.status == 'SUCCESS') {
  97 + return dst.data;
  98 + } else {
  99 + return dst; // 业务错误留给控制器处理
  100 + }
93 101 }
94 102 },
95 103 get: {
96   - method: 'GET'
  104 + method: 'GET',
  105 + transformResponse: function(rs) {
  106 + var dst = angular.fromJson(rs);
  107 + if (dst.status == 'SUCCESS') {
  108 + return dst.data;
  109 + } else {
  110 + return dst;
  111 + }
  112 + }
97 113 },
98 114 save: {
99 115 method: 'POST'
... ... @@ -926,9 +942,9 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
926 942 },
927 943  
928 944 cde1: { // 车辆设备启用日期验证
929   - template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒
  945 + template: {'xl_eq': -1, 'cl_eq': -1, 'qyrq_eq': 1}, // 日期毫秒
930 946 remote: $resource( // $resource封装对象
931   - '/cde//validate/qyrq',
  947 + '/cde_sc/validate_qyrq',
932 948 {},
933 949 {
934 950 do: {
... ...