Commit ce2acf080023742055049b4a66eaac69325632c3
1 parent
7f04b456
Update
Showing
12 changed files
with
142 additions
and
25 deletions
src/main/java/com/bsth/controller/schedule/core/SchedulePlanInfoController.java
| @@ -39,6 +39,23 @@ public class SchedulePlanInfoController extends BController<SchedulePlanInfo, Lo | @@ -39,6 +39,23 @@ public class SchedulePlanInfoController extends BController<SchedulePlanInfo, Lo | ||
| 39 | return resultMap; | 39 | return resultMap; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | + @RequestMapping(value = "/lastestsd/{xlid}", method = RequestMethod.GET) | ||
| 43 | + public Map<String, Object> findLastestPlanDate( | ||
| 44 | + @PathVariable(value = "xlid") Integer xlid) { | ||
| 45 | + Map<String, Object> resultMap = new HashMap<>(); | ||
| 46 | + try { | ||
| 47 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 48 | + resultMap.put("data", schedulePlanInfoService.findLastestPlanDate(xlid)); | ||
| 49 | + | ||
| 50 | + } catch (Exception exp) { | ||
| 51 | + exp.printStackTrace(); | ||
| 52 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 53 | + resultMap.put("msg", exp.getLocalizedMessage()); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + return resultMap; | ||
| 57 | + } | ||
| 58 | + | ||
| 42 | 59 | ||
| 43 | // ------------------------ 老版本 ----------------------// | 60 | // ------------------------ 老版本 ----------------------// |
| 44 | @RequestMapping(value = "/groupinfos/{xlid}/{date}", method = RequestMethod.GET) | 61 | @RequestMapping(value = "/groupinfos/{xlid}/{date}", method = RequestMethod.GET) |
src/main/java/com/bsth/entity/schedule/temp/SchedulePlanRuleResult.java
| @@ -81,8 +81,8 @@ public class SchedulePlanRuleResult { | @@ -81,8 +81,8 @@ public class SchedulePlanRuleResult { | ||
| 81 | "(xl_id,xl_name,rule_id,cc_id,cc_zbh," + | 81 | "(xl_id,xl_name,rule_id,cc_id,cc_zbh," + |
| 82 | "gids,gnames,gidindex,ecids,ecdbbms,ecindex," + | 82 | "gids,gnames,gidindex,ecids,ecdbbms,ecindex," + |
| 83 | "ttinfo_id,ttinfo_name,schedule_date," + | 83 | "ttinfo_id,ttinfo_name,schedule_date," + |
| 84 | - "sysuser_id,sysuser_name,create_date) " + | ||
| 85 | - "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; | 84 | + "sysuser_id,sysuser_name,create_date, qyrq) " + |
| 85 | + "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; | ||
| 86 | 86 | ||
| 87 | return sql; | 87 | return sql; |
| 88 | } | 88 | } |
| @@ -105,6 +105,8 @@ public class SchedulePlanRuleResult { | @@ -105,6 +105,8 @@ public class SchedulePlanRuleResult { | ||
| 105 | ps.setString(15, this.getSysuserId()); | 105 | ps.setString(15, this.getSysuserId()); |
| 106 | ps.setString(16, this.getSysuserName()); | 106 | ps.setString(16, this.getSysuserName()); |
| 107 | ps.setTimestamp(17, new java.sql.Timestamp(this.getCreateDate().getTime())); | 107 | ps.setTimestamp(17, new java.sql.Timestamp(this.getCreateDate().getTime())); |
| 108 | + ps.setDate(18, new java.sql.Date(this.getQyrq().getTime())); | ||
| 109 | + | ||
| 108 | 110 | ||
| 109 | } | 111 | } |
| 110 | 112 |
src/main/java/com/bsth/service/schedule/PeopleCarPlanServiceImpl.java
| 1 | package com.bsth.service.schedule; | 1 | package com.bsth.service.schedule; |
| 2 | 2 | ||
| 3 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 4 | +import com.bsth.entity.schedule.SchedulePlanInfo; | ||
| 5 | +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | ||
| 6 | +import com.bsth.util.ReportUtils; | ||
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 9 | +import org.springframework.jdbc.core.RowMapper; | ||
| 10 | +import org.springframework.stereotype.Service; | ||
| 11 | + | ||
| 3 | import java.math.BigDecimal; | 12 | import java.math.BigDecimal; |
| 4 | -import java.net.URLEncoder; | ||
| 5 | import java.sql.ResultSet; | 13 | import java.sql.ResultSet; |
| 6 | import java.sql.SQLException; | 14 | import java.sql.SQLException; |
| 7 | import java.text.DecimalFormat; | 15 | import java.text.DecimalFormat; |
| 8 | import java.text.NumberFormat; | 16 | import java.text.NumberFormat; |
| 9 | import java.text.ParseException; | 17 | import java.text.ParseException; |
| 10 | import java.text.SimpleDateFormat; | 18 | import java.text.SimpleDateFormat; |
| 11 | -import java.util.ArrayList; | ||
| 12 | -import java.util.Collections; | ||
| 13 | -import java.util.Date; | ||
| 14 | -import java.util.HashMap; | ||
| 15 | -import java.util.HashSet; | ||
| 16 | -import java.util.Iterator; | ||
| 17 | -import java.util.List; | ||
| 18 | -import java.util.Map; | ||
| 19 | -import java.util.Set; | ||
| 20 | - | ||
| 21 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 22 | -import org.springframework.jdbc.core.JdbcTemplate; | ||
| 23 | -import org.springframework.jdbc.core.RowMapper; | ||
| 24 | -import org.springframework.stereotype.Service; | ||
| 25 | - | ||
| 26 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 27 | -import com.bsth.entity.schedule.SchedulePlanInfo; | ||
| 28 | -import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | ||
| 29 | -import com.bsth.util.ReportUtils; | 19 | +import java.util.*; |
| 30 | 20 | ||
| 31 | @Service | 21 | @Service |
| 32 | public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | 22 | public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| @@ -760,7 +750,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -760,7 +750,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 760 | return modelMap; | 750 | return modelMap; |
| 761 | } | 751 | } |
| 762 | 752 | ||
| 763 | - @Override | 753 | +// @Override |
| 764 | public Map<String, Object> scheduleAnaly_sum(Map<String, Object> map) { | 754 | public Map<String, Object> scheduleAnaly_sum(Map<String, Object> map) { |
| 765 | DecimalFormat df = new DecimalFormat("00"); | 755 | DecimalFormat df = new DecimalFormat("00"); |
| 766 | NumberFormat nf = NumberFormat.getNumberInstance(); | 756 | NumberFormat nf = NumberFormat.getNumberInstance(); |
| @@ -1294,7 +1284,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1294,7 +1284,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1294 | return resList; | 1284 | return resList; |
| 1295 | } | 1285 | } |
| 1296 | 1286 | ||
| 1297 | - @Override | 1287 | +// @Override |
| 1298 | public List<Map<String, Object>> firstAndLastBus_sum(Map<String, Object> map) { | 1288 | public List<Map<String, Object>> firstAndLastBus_sum(Map<String, Object> map) { |
| 1299 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 1289 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 1300 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | 1290 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); |
src/main/java/com/bsth/service/schedule/SchedulePlanInfoService.java
| @@ -17,6 +17,13 @@ import java.util.List; | @@ -17,6 +17,13 @@ import java.util.List; | ||
| 17 | public interface SchedulePlanInfoService extends BService<SchedulePlanInfo, Long> { | 17 | public interface SchedulePlanInfoService extends BService<SchedulePlanInfo, Long> { |
| 18 | 18 | ||
| 19 | /** | 19 | /** |
| 20 | + * 查找最近的排班的日期。 | ||
| 21 | + * @param xlId 线路Id | ||
| 22 | + * @return | ||
| 23 | + */ | ||
| 24 | + List<Date> findLastestPlanDate(Integer xlId); | ||
| 25 | + | ||
| 26 | + /** | ||
| 20 | * 查找排班计划汇总数据。 | 27 | * 查找排班计划汇总数据。 |
| 21 | * @param xlId 线路Id | 28 | * @param xlId 线路Id |
| 22 | * @param scheduleDate 排班时间 | 29 | * @param scheduleDate 排班时间 |
src/main/java/com/bsth/service/schedule/impl/SchedulePlanInfoServiceImpl.java
| @@ -5,6 +5,7 @@ import com.bsth.repository.schedule.SchedulePlanInfoRepository; | @@ -5,6 +5,7 @@ import com.bsth.repository.schedule.SchedulePlanInfoRepository; | ||
| 5 | import com.bsth.service.schedule.SchedulePlanInfoService; | 5 | import com.bsth.service.schedule.SchedulePlanInfoService; |
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | import org.springframework.jdbc.core.JdbcTemplate; | 7 | import org.springframework.jdbc.core.JdbcTemplate; |
| 8 | +import org.springframework.jdbc.core.RowCallbackHandler; | ||
| 8 | import org.springframework.jdbc.core.RowMapper; | 9 | import org.springframework.jdbc.core.RowMapper; |
| 9 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
| 10 | import org.springframework.transaction.annotation.Transactional; | 11 | import org.springframework.transaction.annotation.Transactional; |
| @@ -25,6 +26,26 @@ public class SchedulePlanInfoServiceImpl extends BServiceImpl<SchedulePlanInfo, | @@ -25,6 +26,26 @@ public class SchedulePlanInfoServiceImpl extends BServiceImpl<SchedulePlanInfo, | ||
| 25 | private JdbcTemplate jdbcTemplate; | 26 | private JdbcTemplate jdbcTemplate; |
| 26 | 27 | ||
| 27 | @Override | 28 | @Override |
| 29 | + public List<Date> findLastestPlanDate(Integer xlId) { | ||
| 30 | + String sql = "select max(schedule_date) as sd from bsth_c_s_sp_info " + | ||
| 31 | + "where xl = ?"; | ||
| 32 | + | ||
| 33 | + final List<Date> ld = new ArrayList<>(); | ||
| 34 | + | ||
| 35 | + jdbcTemplate.query(sql, new Object[]{xlId}, new RowCallbackHandler() { | ||
| 36 | + @Override | ||
| 37 | + public void processRow(ResultSet rs) throws SQLException { | ||
| 38 | + if (rs != null && rs.getDate("sd") != null) { | ||
| 39 | + ld.add(new Date(rs.getDate("sd").getTime())); | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + }); | ||
| 43 | + | ||
| 44 | + return ld; | ||
| 45 | + | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @Override | ||
| 28 | public List<SchedulePlanGroupInfo> findSchedulePlanGroupInfo(Integer xlId, Date scheduleDate) { | 49 | public List<SchedulePlanGroupInfo> findSchedulePlanGroupInfo(Integer xlId, Date scheduleDate) { |
| 29 | String sql = SchedulePlanGroupInfo.generateSelectSql(); | 50 | String sql = SchedulePlanGroupInfo.generateSelectSql(); |
| 30 | List<SchedulePlanGroupInfo> schedulePlanGroupInfos = jdbcTemplate.query(sql, new Object[]{xlId, scheduleDate}, new RowMapper<SchedulePlanGroupInfo>() { | 51 | List<SchedulePlanGroupInfo> schedulePlanGroupInfos = jdbcTemplate.query(sql, new Object[]{xlId, scheduleDate}, new RowMapper<SchedulePlanGroupInfo>() { |
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| @@ -28,6 +28,9 @@ import org.slf4j.Logger; | @@ -28,6 +28,9 @@ import org.slf4j.Logger; | ||
| 28 | import org.slf4j.LoggerFactory; | 28 | import org.slf4j.LoggerFactory; |
| 29 | import org.springframework.beans.factory.annotation.Autowired; | 29 | import org.springframework.beans.factory.annotation.Autowired; |
| 30 | import org.springframework.stereotype.Service; | 30 | import org.springframework.stereotype.Service; |
| 31 | +import org.springframework.transaction.annotation.Isolation; | ||
| 32 | +import org.springframework.transaction.annotation.Propagation; | ||
| 33 | +import org.springframework.transaction.annotation.Transactional; | ||
| 31 | 34 | ||
| 32 | import java.util.*; | 35 | import java.util.*; |
| 33 | 36 | ||
| @@ -318,6 +321,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -318,6 +321,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 318 | 321 | ||
| 319 | } | 322 | } |
| 320 | 323 | ||
| 324 | + @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) | ||
| 321 | public SchedulePlan save(SchedulePlan schedulePlan) { | 325 | public SchedulePlan save(SchedulePlan schedulePlan) { |
| 322 | // pre、如果排班的数据之前已经有了,删除之前的数据 | 326 | // pre、如果排班的数据之前已经有了,删除之前的数据 |
| 323 | Date startpre = new Date(); | 327 | Date startpre = new Date(); |
src/main/resources/rules/validplan.drl
0 → 100644
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
| @@ -548,6 +548,24 @@ angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$reso | @@ -548,6 +548,24 @@ angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$reso | ||
| 548 | } | 548 | } |
| 549 | } | 549 | } |
| 550 | } | 550 | } |
| 551 | + ), | ||
| 552 | + latestsd: $resource( | ||
| 553 | + '/spic/lastestsd/:xlid', | ||
| 554 | + {}, | ||
| 555 | + { | ||
| 556 | + list: { | ||
| 557 | + method: 'GET', | ||
| 558 | + isArray: true, | ||
| 559 | + transformResponse: function(rs) { | ||
| 560 | + var dst = angular.fromJson(rs); | ||
| 561 | + if (dst.status == 'SUCCESS') { | ||
| 562 | + return dst.data; | ||
| 563 | + } else { | ||
| 564 | + return dst; // 业务错误留给控制器处理 | ||
| 565 | + } | ||
| 566 | + } | ||
| 567 | + } | ||
| 568 | + } | ||
| 551 | ) | 569 | ) |
| 552 | 570 | ||
| 553 | 571 |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/list.html
| 1 | <!-- ui-route employeeInfoManage.list --> | 1 | <!-- ui-route employeeInfoManage.list --> |
| 2 | <div ng-controller="SchedulePlanReportExtManageListCtrl as ctrl"> | 2 | <div ng-controller="SchedulePlanReportExtManageListCtrl as ctrl"> |
| 3 | + | ||
| 4 | + <div class="portlet"> | ||
| 5 | + <div class="portlet-title"> | ||
| 6 | + <div class="caption caption-subject font-red-sunglo bold uppercase"> | ||
| 7 | + 最近排班至 | ||
| 8 | + <span ng-bind="ctrl.lsd | date: 'yyyy年MM月dd日'"> | ||
| 9 | + </span> | ||
| 10 | + </div> | ||
| 11 | + </div> | ||
| 12 | + </div> | ||
| 13 | + | ||
| 3 | <div class="fixDiv"> | 14 | <div class="fixDiv"> |
| 4 | <table class="fixTable table table-striped table-bordered table-hover table-checkable order-column" | 15 | <table class="fixTable table table-striped table-bordered table-hover table-checkable order-column" |
| 5 | style="width: 1800px; min-height: 500px;"> | 16 | style="width: 1800px; min-height: 500px;"> |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/module.js
| @@ -46,6 +46,15 @@ angular.module('ScheduleApp').factory( | @@ -46,6 +46,15 @@ angular.module('ScheduleApp').factory( | ||
| 46 | }, | 46 | }, |
| 47 | 47 | ||
| 48 | /** | 48 | /** |
| 49 | + * 查询线路最近排班日期。 | ||
| 50 | + * @param xlid | ||
| 51 | + */ | ||
| 52 | + getLastestsd: function() { | ||
| 53 | + var params = currentSearchCondition; // 查询条件 | ||
| 54 | + return service.latestsd.list(params).$promise; | ||
| 55 | + }, | ||
| 56 | + | ||
| 57 | + /** | ||
| 49 | * 批量保存排班明细。 | 58 | * 批量保存排班明细。 |
| 50 | * @param rs | 59 | * @param rs |
| 51 | */ | 60 | */ |
| @@ -168,6 +177,8 @@ angular.module('ScheduleApp').controller( | @@ -168,6 +177,8 @@ angular.module('ScheduleApp').controller( | ||
| 168 | return service.resetSearchCondition(); | 177 | return service.resetSearchCondition(); |
| 169 | }; | 178 | }; |
| 170 | 179 | ||
| 180 | + self.lsd; | ||
| 181 | + | ||
| 171 | // 监控条件变化,触发查询 | 182 | // 监控条件变化,触发查询 |
| 172 | $scope.$watch( | 183 | $scope.$watch( |
| 173 | function() { | 184 | function() { |
| @@ -175,6 +186,22 @@ angular.module('ScheduleApp').controller( | @@ -175,6 +186,22 @@ angular.module('ScheduleApp').controller( | ||
| 175 | }, | 186 | }, |
| 176 | function(newValue, oldValue) { | 187 | function(newValue, oldValue) { |
| 177 | if (newValue) { | 188 | if (newValue) { |
| 189 | + if (newValue.xlid) { | ||
| 190 | + service.getLastestsd().then( | ||
| 191 | + function(result) { | ||
| 192 | + if (result.length > 0) { | ||
| 193 | + self.lsd = new Date(); | ||
| 194 | + self.lsd.setTime(result[0]); | ||
| 195 | + } else { | ||
| 196 | + self.lsd = "暂无排班"; | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + }, | ||
| 200 | + function() { | ||
| 201 | + } | ||
| 202 | + ); | ||
| 203 | + } | ||
| 204 | + | ||
| 178 | if (newValue.xlid && newValue.sdate) { | 205 | if (newValue.xlid && newValue.sdate) { |
| 179 | self.pageChanaged(); | 206 | self.pageChanaged(); |
| 180 | } | 207 | } |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/service.js
| @@ -126,6 +126,24 @@ angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$reso | @@ -126,6 +126,24 @@ angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$reso | ||
| 126 | } | 126 | } |
| 127 | } | 127 | } |
| 128 | } | 128 | } |
| 129 | + ), | ||
| 130 | + latestsd: $resource( | ||
| 131 | + '/spic/lastestsd/:xlid', | ||
| 132 | + {}, | ||
| 133 | + { | ||
| 134 | + list: { | ||
| 135 | + method: 'GET', | ||
| 136 | + isArray: true, | ||
| 137 | + transformResponse: function(rs) { | ||
| 138 | + var dst = angular.fromJson(rs); | ||
| 139 | + if (dst.status == 'SUCCESS') { | ||
| 140 | + return dst.data; | ||
| 141 | + } else { | ||
| 142 | + return dst; // 业务错误留给控制器处理 | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + } | ||
| 129 | ) | 147 | ) |
| 130 | 148 | ||
| 131 | 149 |
src/test/resources/testdata/problem.properties
| @@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
| 14 | 14=路牌编号自动生成 | 14 | 14=路牌编号自动生成 |
| 15 | 15=时刻表导入的时候表头后面不需要加数字 | 15 | 15=时刻表导入的时候表头后面不需要加数字 |
| 16 | ##16=时间框中文 | 16 | ##16=时间框中文 |
| 17 | -17=人员工号前公司编码自动加 | 17 | +##17=人员工号前公司编码自动加 |
| 18 | 18=排班计划明细可以修改(修改到每个班次) | 18 | 18=排班计划明细可以修改(修改到每个班次) |
| 19 | 19=线路运营概览 | 19 | 19=线路运营概览 |
| 20 | 20=排班规则备注 | 20 | 20=排班规则备注 |
| @@ -31,3 +31,4 @@ | @@ -31,3 +31,4 @@ | ||
| 31 | ##30=时刻表公里数 三位数 | 31 | ##30=时刻表公里数 三位数 |
| 32 | 32 | ||
| 33 | 31=规则修改,路牌范围,人员范围可以拖动 | 33 | 31=规则修改,路牌范围,人员范围可以拖动 |
| 34 | +32=人员配置不存在的情况下,导入规则ktr,找不到的人员不添加,人员范围不存在的,规则不导入 |