Commit c8b77c0c8cfb9ee9c3156f626ce6aaa148301fd7
Merge branch 'PSM-16' into qingpu
Showing
6 changed files
with
140 additions
and
7 deletions
src/main/java/com/bsth/entity/schedule/CarConfigInfo.java
| @@ -53,6 +53,10 @@ public class CarConfigInfo implements Serializable { | @@ -53,6 +53,10 @@ public class CarConfigInfo implements Serializable { | ||
| 53 | @Column(nullable = false) | 53 | @Column(nullable = false) |
| 54 | private int isSwitch; | 54 | private int isSwitch; |
| 55 | 55 | ||
| 56 | + /** 是否删除(标记) */ | ||
| 57 | + @Column(nullable = false) | ||
| 58 | + private Boolean isCancel = false; | ||
| 59 | + | ||
| 56 | /** 创建人 */ | 60 | /** 创建人 */ |
| 57 | @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) | 61 | @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) |
| 58 | private SysUser createBy; | 62 | private SysUser createBy; |
| @@ -170,4 +174,12 @@ public class CarConfigInfo implements Serializable { | @@ -170,4 +174,12 @@ public class CarConfigInfo implements Serializable { | ||
| 170 | public void setUpdateDate(Date updateDate) { | 174 | public void setUpdateDate(Date updateDate) { |
| 171 | this.updateDate = updateDate; | 175 | this.updateDate = updateDate; |
| 172 | } | 176 | } |
| 177 | + | ||
| 178 | + public Boolean getIsCancel() { | ||
| 179 | + return isCancel; | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + public void setIsCancel(Boolean isCancel) { | ||
| 183 | + this.isCancel = isCancel; | ||
| 184 | + } | ||
| 173 | } | 185 | } |
src/main/java/com/bsth/service/schedule/CarConfigInfoServiceImpl.java
| 1 | package com.bsth.service.schedule; | 1 | package com.bsth.service.schedule; |
| 2 | 2 | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 3 | import com.bsth.entity.schedule.CarConfigInfo; | 4 | import com.bsth.entity.schedule.CarConfigInfo; |
| 5 | +import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | ||
| 6 | +import com.bsth.repository.schedule.CarConfigInfoRepository; | ||
| 4 | import com.bsth.service.impl.BaseServiceImpl; | 7 | import com.bsth.service.impl.BaseServiceImpl; |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 5 | import org.springframework.stereotype.Service; | 9 | import org.springframework.stereotype.Service; |
| 6 | 10 | ||
| 11 | +import javax.transaction.Transactional; | ||
| 12 | +import java.util.*; | ||
| 13 | + | ||
| 7 | /** | 14 | /** |
| 8 | * Created by xu on 16/5/9. | 15 | * Created by xu on 16/5/9. |
| 9 | */ | 16 | */ |
| 10 | @Service | 17 | @Service |
| 11 | public class CarConfigInfoServiceImpl extends BaseServiceImpl<CarConfigInfo, Long> implements CarConfigInfoService { | 18 | public class CarConfigInfoServiceImpl extends BaseServiceImpl<CarConfigInfo, Long> implements CarConfigInfoService { |
| 19 | + @Autowired | ||
| 20 | + private CarConfigInfoRepository carConfigInfoRepository; | ||
| 21 | + @Autowired | ||
| 22 | + private ScheduleRule1FlatService scheduleRule1FlatService; | ||
| 23 | + | ||
| 24 | + @Override | ||
| 25 | + @Transactional | ||
| 26 | + public Map<String, Object> delete(Long aLong) { | ||
| 27 | + // 获取待作废的车辆配置 | ||
| 28 | + CarConfigInfo carConfigInfo = carConfigInfoRepository.findOne(aLong); | ||
| 29 | + // 查询有无规则使用过此车辆配置 | ||
| 30 | + Map<String, Object> param = new HashMap<>(); | ||
| 31 | + param.put("carConfigInfo.id_eq", carConfigInfo.getId()); | ||
| 32 | + Iterator<ScheduleRule1Flat> scheduleRule1FlatIterator = | ||
| 33 | + scheduleRule1FlatService.list(param).iterator(); | ||
| 34 | + boolean isExist = false; | ||
| 35 | + while (scheduleRule1FlatIterator.hasNext()) { | ||
| 36 | + ScheduleRule1Flat scheduleRule1Flat = scheduleRule1FlatIterator.next(); | ||
| 37 | + if (scheduleRule1Flat.getCarConfigInfo().getId().equals(carConfigInfo.getId())) { | ||
| 38 | + isExist = true; | ||
| 39 | + break; | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + Map<String, Object> map = new HashMap<>(); | ||
| 44 | + | ||
| 45 | + if (isExist) { | ||
| 46 | + throw new RuntimeException("车辆配置已被规则使用,不能删除,请先修改规则!"); | ||
| 47 | + } else { | ||
| 48 | + carConfigInfo.setIsCancel(true); | ||
| 49 | + map.put("status", ResponseCode.SUCCESS); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + return map; | ||
| 53 | + | ||
| 54 | + } | ||
| 12 | } | 55 | } |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
| @@ -198,7 +198,7 @@ angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', functi | @@ -198,7 +198,7 @@ angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', functi | ||
| 198 | return { | 198 | return { |
| 199 | rest : $resource( | 199 | rest : $resource( |
| 200 | '/cci/:id', | 200 | '/cci/:id', |
| 201 | - {order: 'createDate', direction: 'ASC', id: '@id_route'}, | 201 | + {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'}, |
| 202 | { | 202 | { |
| 203 | list: { | 203 | list: { |
| 204 | method: 'GET', | 204 | method: 'GET', |
src/main/resources/static/pages/scheduleApp/module/core/busConfig/busConfig.js
| @@ -56,6 +56,14 @@ angular.module('ScheduleApp').factory('BusConfigService', ['BusConfigService_g', | @@ -56,6 +56,14 @@ angular.module('ScheduleApp').factory('BusConfigService', ['BusConfigService_g', | ||
| 56 | */ | 56 | */ |
| 57 | saveDetail: function(obj) { | 57 | saveDetail: function(obj) { |
| 58 | return service.rest.save(obj).$promise; | 58 | return service.rest.save(obj).$promise; |
| 59 | + }, | ||
| 60 | + /** | ||
| 61 | + * 删除信息。 | ||
| 62 | + * @param id 主键id | ||
| 63 | + * @returns {*|Function|promise|n} | ||
| 64 | + */ | ||
| 65 | + deleteDetail: function(id) { | ||
| 66 | + return service.rest.delete({id: id}).$promise; | ||
| 59 | } | 67 | } |
| 60 | }; | 68 | }; |
| 61 | 69 | ||
| @@ -184,6 +192,74 @@ angular.module('ScheduleApp').controller('BusConfigListCtrl', ['BusConfigService | @@ -184,6 +192,74 @@ angular.module('ScheduleApp').controller('BusConfigListCtrl', ['BusConfigService | ||
| 184 | self.pageChanaged(); | 192 | self.pageChanaged(); |
| 185 | }; | 193 | }; |
| 186 | 194 | ||
| 195 | + // 删除时刻表 | ||
| 196 | + self.deleteEci = function(id) { | ||
| 197 | + // TODO: | ||
| 198 | + busConfigService.deleteDetail(id).then( | ||
| 199 | + function(result) { | ||
| 200 | + if (result.message) { // 暂时这样做,之后全局拦截 | ||
| 201 | + alert("失败:" + result.message); | ||
| 202 | + } else { | ||
| 203 | + alert("作废成功!"); | ||
| 204 | + | ||
| 205 | + busConfigService.getPage().then( | ||
| 206 | + function(result) { | ||
| 207 | + self.pageInfo.totalItems = result.totalElements; | ||
| 208 | + self.pageInfo.currentPage = result.number + 1; | ||
| 209 | + self.pageInfo.infos = result.content; | ||
| 210 | + busConfigService.setCurrentPageNo(result.number + 1); | ||
| 211 | + }, | ||
| 212 | + function(result) { | ||
| 213 | + alert("出错啦!"); | ||
| 214 | + } | ||
| 215 | + ); | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + }, | ||
| 219 | + function(result) { | ||
| 220 | + alert("出错啦!" + result); | ||
| 221 | + } | ||
| 222 | + ); | ||
| 223 | + }; | ||
| 224 | + | ||
| 225 | + // 撤销修改 | ||
| 226 | + self.redoDeleteEci = function(id) { | ||
| 227 | + busConfigService.getDetail(id).then( | ||
| 228 | + function(result) { | ||
| 229 | + result.isCancel = 'false'; | ||
| 230 | + busConfigService.saveDetail(result).then( | ||
| 231 | + function(result) { | ||
| 232 | + if (result.message) { // 暂时这样做,之后全局拦截 | ||
| 233 | + alert("失败:" + result.message); | ||
| 234 | + } else { | ||
| 235 | + alert("撤销成功!"); | ||
| 236 | + | ||
| 237 | + busConfigService.getPage().then( | ||
| 238 | + function(result) { | ||
| 239 | + self.pageInfo.totalItems = result.totalElements; | ||
| 240 | + self.pageInfo.currentPage = result.number + 1; | ||
| 241 | + self.pageInfo.infos = result.content; | ||
| 242 | + busConfigService.setCurrentPageNo(result.number + 1); | ||
| 243 | + }, | ||
| 244 | + function(result) { | ||
| 245 | + alert("出错啦!"); | ||
| 246 | + } | ||
| 247 | + ); | ||
| 248 | + } | ||
| 249 | + }, | ||
| 250 | + function(result) { | ||
| 251 | + // TODO:弹出框方式以后改 | ||
| 252 | + alert("出错啦!"); | ||
| 253 | + } | ||
| 254 | + ); | ||
| 255 | + }, | ||
| 256 | + function(result) { | ||
| 257 | + // TODO:弹出框方式以后改 | ||
| 258 | + alert("出错啦!"); | ||
| 259 | + } | ||
| 260 | + ); | ||
| 261 | + }; | ||
| 262 | + | ||
| 187 | }]); | 263 | }]); |
| 188 | 264 | ||
| 189 | angular.module('ScheduleApp').controller('BusConfigFormCtrl', ['BusConfigService', '$stateParams', '$state', '$scope', function(busConfigService, $stateParams, $state, $scope) { | 265 | angular.module('ScheduleApp').controller('BusConfigFormCtrl', ['BusConfigService', '$stateParams', '$state', '$scope', function(busConfigService, $stateParams, $state, $scope) { |
src/main/resources/static/pages/scheduleApp/module/core/busConfig/list.html
| @@ -27,13 +27,13 @@ | @@ -27,13 +27,13 @@ | ||
| 27 | </sa-Select3> | 27 | </sa-Select3> |
| 28 | </div> | 28 | </div> |
| 29 | </td> | 29 | </td> |
| 30 | + <td> | ||
| 31 | + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition()['cl.insideCode_like']" placeholder="输入内部编号..."/> | ||
| 32 | + </td> | ||
| 30 | <td></td> | 33 | <td></td> |
| 31 | <td></td> | 34 | <td></td> |
| 32 | <td></td> | 35 | <td></td> |
| 33 | <td> | 36 | <td> |
| 34 | - <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().tcd_like"/> | ||
| 35 | - </td> | ||
| 36 | - <td> | ||
| 37 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" | 37 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" |
| 38 | ng-click="ctrl.pageChanaged()"> | 38 | ng-click="ctrl.pageChanaged()"> |
| 39 | <i class="fa fa-search"></i> 搜索</button> | 39 | <i class="fa fa-search"></i> 搜索</button> |
| @@ -47,7 +47,7 @@ | @@ -47,7 +47,7 @@ | ||
| 47 | 47 | ||
| 48 | </thead> | 48 | </thead> |
| 49 | <tbody> | 49 | <tbody> |
| 50 | - <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX"> | 50 | + <tr ng-repeat="info in ctrl.pageInfo.infos" ng-class="{odd: true, gradeX: true, danger: info.isCancel}"> |
| 51 | <td> | 51 | <td> |
| 52 | <span ng-bind="$index + 1"></span> | 52 | <span ng-bind="$index + 1"></span> |
| 53 | </td> | 53 | </td> |
| @@ -70,7 +70,9 @@ | @@ -70,7 +70,9 @@ | ||
| 70 | <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> | 70 | <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> |
| 71 | <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>--> | 71 | <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>--> |
| 72 | <a ui-sref="busConfig_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a> | 72 | <a ui-sref="busConfig_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a> |
| 73 | - <a ui-sref="busConfig_edit({id: info.id})" class="btn default blue-stripe btn-sm"> 修改 </a> | 73 | + <a ui-sref="busConfig_edit({id: info.id})" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 修改 </a> |
| 74 | + <a ng-click="ctrl.deleteEci(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 作废 </a> | ||
| 75 | + <a ng-click="ctrl.redoDeleteEci(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a> | ||
| 74 | </td> | 76 | </td> |
| 75 | </tr> | 77 | </tr> |
| 76 | </tbody> | 78 | </tbody> |
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/form.html
| @@ -72,7 +72,7 @@ | @@ -72,7 +72,7 @@ | ||
| 72 | icnames="cl.insideCode" | 72 | icnames="cl.insideCode" |
| 73 | datatype="cci2" | 73 | datatype="cci2" |
| 74 | dataassociate="true" | 74 | dataassociate="true" |
| 75 | - dataparam="{{ {'xl.id_eq': ctrl.scheduleRuleManageForSave.xl.id} | json }}" | 75 | + dataparam="{{ {'xl.id_eq': ctrl.scheduleRuleManageForSave.xl.id, 'isCancel_eq': false} | json }}" |
| 76 | mlp="true" | 76 | mlp="true" |
| 77 | required > | 77 | required > |
| 78 | </sa-Select3> | 78 | </sa-Select3> |