Commit 8ed2f6f3bd9f60ffdab170178a2d55d175c043d3
1 parent
f7603ac9
PSM-7
Showing
6 changed files
with
115 additions
and
35 deletions
src/main/java/com/bsth/entity/search/PredicatesBuilder.java
| 1 | 1 | package com.bsth.entity.search; |
| 2 | 2 | |
| 3 | +import org.joda.time.DateTime; | |
| 4 | + | |
| 3 | 5 | import javax.persistence.criteria.CriteriaBuilder; |
| 4 | 6 | import javax.persistence.criteria.Path; |
| 5 | 7 | import javax.persistence.criteria.Predicate; |
| ... | ... | @@ -56,6 +58,10 @@ public class PredicatesBuilder { |
| 56 | 58 | } else if (leftType.isAssignableFrom(Date.class) && |
| 57 | 59 | rightType.isAssignableFrom(Date.class)) { // 判定是否是Date类型的子类 |
| 58 | 60 | return cb.greaterThanOrEqualTo((Path<Date>) expression, (Date) object); |
| 61 | + } else if (leftType.isAssignableFrom(Date.class) && | |
| 62 | + rightType.isAssignableFrom(String.class)) { // 左边是日期,右边是字符串,尝试转换字符串到日期 | |
| 63 | + DateTime dateTime = new DateTime(object); | |
| 64 | + return cb.greaterThanOrEqualTo((Path<Date>) expression, dateTime.toDate()); | |
| 59 | 65 | } else { |
| 60 | 66 | throw new RuntimeException("ge 不支持类型组合:" + expression.getJavaType() + ">=" + object.getClass()); |
| 61 | 67 | } |
| ... | ... | @@ -83,6 +89,10 @@ public class PredicatesBuilder { |
| 83 | 89 | } else if (leftType.isAssignableFrom(Date.class) && |
| 84 | 90 | rightType.isAssignableFrom(Date.class)) { // 判定是否是Date类型的子类 |
| 85 | 91 | return cb.lessThanOrEqualTo((Path<Date>) expression, (Date) object); |
| 92 | + } else if (leftType.isAssignableFrom(Date.class) && | |
| 93 | + rightType.isAssignableFrom(String.class)) { // 左边是日期,右边是字符串,尝试转换字符串到日期 | |
| 94 | + DateTime dateTime = new DateTime(object); | |
| 95 | + return cb.lessThanOrEqualTo((Path<Date>) expression, dateTime.toDate()); | |
| 86 | 96 | } else { |
| 87 | 97 | throw new RuntimeException("ge 不支持类型组合:" + expression.getJavaType() + ">=" + object.getClass()); |
| 88 | 98 | } | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/main.js
| ... | ... | @@ -63,27 +63,59 @@ ScheduleApp.factory('requestNotificationChannel', ['$rootScope', function($rootS |
| 63 | 63 | }]); |
| 64 | 64 | |
| 65 | 65 | // http 拦截器 |
| 66 | -ScheduleApp.factory('myInterceptor', ['requestNotificationChannel', function(requestNotificationChannel) { | |
| 67 | - return { | |
| 68 | - request: function(config) { | |
| 69 | - requestNotificationChannel.requestStarted(); | |
| 70 | - return config; | |
| 71 | - }, | |
| 72 | - requestError: function(rejection) { | |
| 73 | - requestNotificationChannel.requestEnded(); | |
| 74 | - return rejection; | |
| 75 | - }, | |
| 76 | - response: function(response) { | |
| 77 | - requestNotificationChannel.requestEnded(); | |
| 78 | - return response; | |
| 79 | - }, | |
| 80 | - responseError: function(rejection) { | |
| 81 | - requestNotificationChannel.requestEnded(); | |
| 82 | - return rejection; | |
| 83 | - } | |
| 84 | - }; | |
| 66 | +ScheduleApp.factory( | |
| 67 | + 'myInterceptor', | |
| 68 | + [ | |
| 69 | + 'requestNotificationChannel', | |
| 70 | + '$q', | |
| 71 | + function(requestNotificationChannel, $q) { | |
| 72 | + return { | |
| 73 | + request: function(config) { | |
| 74 | + requestNotificationChannel.requestStarted(); | |
| 75 | + return config; | |
| 76 | + }, | |
| 77 | + requestError: function(rejection) { | |
| 78 | + requestNotificationChannel.requestEnded(); | |
| 79 | + return rejection; | |
| 80 | + }, | |
| 81 | + response: function(response) { | |
| 82 | + requestNotificationChannel.requestEnded(); | |
| 85 | 83 | |
| 86 | -}]); | |
| 84 | + return response; | |
| 85 | + }, | |
| 86 | + responseError: function(rejection) { | |
| 87 | + requestNotificationChannel.requestEnded(); | |
| 88 | + | |
| 89 | + // 处理错误,springboot会包装返回的错误数据 | |
| 90 | + // 如:{"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"} | |
| 91 | + | |
| 92 | + var status = rejection.status; | |
| 93 | + var path = rejection.data.path; | |
| 94 | + var message = rejection.data.message; | |
| 95 | + var output = []; | |
| 96 | + output.push("状态编码:" + status); | |
| 97 | + output.push("访问路径:" + path); | |
| 98 | + output.push("错误消息:" + message); | |
| 99 | + if (status) { | |
| 100 | + if (status == 500) { | |
| 101 | + alert("服务端错误:" + "\n" + output.join("\n")); | |
| 102 | + } else if (status == 407) { | |
| 103 | + alert("请重新登录:" + "\n" + output.join("\n")); | |
| 104 | + } else if (status == -1) { | |
| 105 | + alert("貌似服务端连接不上"); | |
| 106 | + } else { | |
| 107 | + alert("其他错误:" + "\n" + output.join("\n")); | |
| 108 | + } | |
| 109 | + } else { | |
| 110 | + alert("我擦,后台返回连个状态码都没返回,见鬼了!"); | |
| 111 | + } | |
| 112 | + | |
| 113 | + return $q.reject(rejection); | |
| 114 | + } | |
| 115 | + }; | |
| 116 | + } | |
| 117 | + ] | |
| 118 | +); | |
| 87 | 119 | |
| 88 | 120 | ScheduleApp.config(['$httpProvider', function($httpProvider) { |
| 89 | 121 | $httpProvider.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest"; | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
| ... | ... | @@ -416,7 +416,7 @@ angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource |
| 416 | 416 | return { |
| 417 | 417 | rest : $resource( |
| 418 | 418 | '/spc/:id', |
| 419 | - {order: 'createDate', direction: 'DESC', id: '@id_route'}, | |
| 419 | + {order: 'xl.id,createDate', direction: 'DESC,DESC', id: '@id_route'}, | |
| 420 | 420 | { |
| 421 | 421 | list: { |
| 422 | 422 | method: 'GET', |
| ... | ... | @@ -452,7 +452,7 @@ angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$reso |
| 452 | 452 | return { |
| 453 | 453 | rest : $resource( |
| 454 | 454 | '/spic/:id', |
| 455 | - {order: 'scheduleDate,lp,fcno', direction: 'ASC', id: '@id_route'}, | |
| 455 | + {order: 'scheduleDate,lp,fcno', direction: 'ASC,ASC,ASC', id: '@id_route'}, | |
| 456 | 456 | { |
| 457 | 457 | list: { |
| 458 | 458 | method: 'GET', | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/list.html
| ... | ... | @@ -4,13 +4,13 @@ |
| 4 | 4 | <table class="fixTable table table-striped table-bordered table-hover table-checkable order-column"> |
| 5 | 5 | <thead> |
| 6 | 6 | <tr role="row" class="heading"> |
| 7 | - <th style="width: 5%;">序号</th> | |
| 8 | - <th style="width: 15%;">线路</th> | |
| 9 | - <th style="width: 20%;">时刻表</th> | |
| 10 | - <th>排班开始时间</th> | |
| 11 | - <th>排班结束时间</th> | |
| 12 | - <th>修改时间</th> | |
| 13 | - <th style="width: 21%">操作</th> | |
| 7 | + <th style="width: 50px;">序号</th> | |
| 8 | + <th style="width: 150px;">线路</th> | |
| 9 | + <th style="width: 100%;">关联时刻表</th> | |
| 10 | + <th style="width: 150px;">排班开始日期</th> | |
| 11 | + <th style="width: 150px;">排班结束日期</th> | |
| 12 | + <th style="width: 180px;">排班操作时间</th> | |
| 13 | + <th style="width: 180px;">操作</th> | |
| 14 | 14 | </tr> |
| 15 | 15 | <tr role="row" class="filter"> |
| 16 | 16 | <td></td> |
| ... | ... | @@ -25,9 +25,37 @@ |
| 25 | 25 | datatype="xl"> |
| 26 | 26 | </sa-Select3> |
| 27 | 27 | </td> |
| 28 | - <td></td> | |
| 29 | - <td></td> | |
| 30 | - <td></td> | |
| 28 | + <td> | |
| 29 | + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().name_like" placeholder="输入时刻表名称..."/> | |
| 30 | + </td> | |
| 31 | + <td> | |
| 32 | + <div class="input-group"> | |
| 33 | + <input type="text" class="form-control input-sm" | |
| 34 | + name="scheduleFromTime" placeholder="选择日期..." | |
| 35 | + uib-datepicker-popup="yyyy-MM-dd" | |
| 36 | + is-open="ctrl.scheduleFromTime" | |
| 37 | + ng-model="ctrl.searchCondition()['scheduleFromTime_ge']" readonly/> | |
| 38 | + <span class="input-group-btn"> | |
| 39 | + <button type="button" class="btn btn-default btn-sm" ng-click="ctrl.scheduleFromTime_open()"> | |
| 40 | + <i class="glyphicon glyphicon-calendar"></i> | |
| 41 | + </button> | |
| 42 | + </span> | |
| 43 | + </div> | |
| 44 | + </td> | |
| 45 | + <td> | |
| 46 | + <div class="input-group"> | |
| 47 | + <input type="text" class="form-control input-sm" | |
| 48 | + name="scheduleToTime" placeholder="选择日期..." | |
| 49 | + uib-datepicker-popup="yyyy-MM-dd" | |
| 50 | + is-open="ctrl.scheduleToTime" | |
| 51 | + ng-model="ctrl.searchCondition()['scheduleToTime_le']" readonly/> | |
| 52 | + <span class="input-group-btn"> | |
| 53 | + <button type="button" class="btn btn-default btn-sm" ng-click="ctrl.scheduleToTime_open()"> | |
| 54 | + <i class="glyphicon glyphicon-calendar"></i> | |
| 55 | + </button> | |
| 56 | + </span> | |
| 57 | + </div> | |
| 58 | + </td> | |
| 31 | 59 | <td></td> |
| 32 | 60 | <td> |
| 33 | 61 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" |
| ... | ... | @@ -65,9 +93,9 @@ |
| 65 | 93 | <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> |
| 66 | 94 | <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>--> |
| 67 | 95 | <a ui-sref="schedulePlanInfoManage({spid : info.id, xlname : info.xl.name, ttname : info.ttInfo.name, stime : info.scheduleFromTime, etime : info.scheduleToTime})" |
| 68 | - class="btn default blue-stripe btn-sm"> 排班明细 </a> | |
| 96 | + class="btn btn-info btn-sm"> 明细 </a> | |
| 69 | 97 | <a ng-click="ctrl.deletePlan(info.id)" |
| 70 | - class="btn default blue-stripe btn-sm"> 删除 </a> | |
| 98 | + class="btn btn-danger btn-sm"> 删除 </a> | |
| 71 | 99 | </td> |
| 72 | 100 | </tr> |
| 73 | 101 | </tbody> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/schedulePlanManage.js
| ... | ... | @@ -78,6 +78,16 @@ angular.module('ScheduleApp').controller('SchedulePlanManageListCtrl', ['Schedul |
| 78 | 78 | infos: [] |
| 79 | 79 | }; |
| 80 | 80 | |
| 81 | + // 日期 日期控件开关 | |
| 82 | + self.scheduleFromTime = false; | |
| 83 | + self.scheduleFromTime_open = function() { | |
| 84 | + self.scheduleFromTime = true; | |
| 85 | + }; | |
| 86 | + self.scheduleToTime = false; | |
| 87 | + self.scheduleToTime_open = function() { | |
| 88 | + self.scheduleToTime = true; | |
| 89 | + }; | |
| 90 | + | |
| 81 | 91 | // 初始创建的时候,获取一次列表数据 |
| 82 | 92 | schedulePlanManageService.getPage().then( |
| 83 | 93 | function(result) { | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoDetailManage/main.js
| ... | ... | @@ -109,7 +109,7 @@ angular.module('ScheduleApp').controller( |
| 109 | 109 | |
| 110 | 110 | // TODO:edit操作暂时使用旧版本的js文件 |
| 111 | 111 | |
| 112 | - // {"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"} | |
| 112 | + | |
| 113 | 113 | } |
| 114 | 114 | ] |
| 115 | 115 | ); |
| 116 | 116 | \ No newline at end of file | ... | ... |