Commit 5446a29583a9e5de8a6bf4438f25b9fdef507b3b

Authored by zlz
1 parent b020e9c6

添加按日期上传计划班次的功能

src/main/java/com/bsth/controller/schedule/TrafficManageController.java
... ... @@ -111,6 +111,15 @@ public class TrafficManageController {
111 111 }
112 112 }
113 113  
  114 + @RequestMapping(value = "/setJHBCByDate", method = RequestMethod.GET)
  115 + public String setJHBCByDate(@RequestParam("theDate") String theDate) throws Exception {
  116 + try {
  117 + return trManageService.setJHBC(theDate);
  118 + } catch (Exception exp) {
  119 + throw new Exception(exp.getCause());
  120 + }
  121 + }
  122 +
114 123 @RequestMapping(value = "/setSKB", method = RequestMethod.GET)
115 124 public String setSKB(@RequestParam("ids") String ids) throws Exception {
116 125 try {
... ...
src/main/java/com/bsth/service/TrafficManageService.java
... ... @@ -70,6 +70,8 @@ public interface TrafficManageService {
70 70 */
71 71 String setJHBC();
72 72  
  73 + String setJHBC(String theDate);
  74 +
73 75 String setLD(String theDate);
74 76  
75 77 String setLD();
... ...
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
... ... @@ -812,10 +812,26 @@ public class TrafficManageServiceImpl implements TrafficManageService{
812 812 }
813 813  
814 814 /**
  815 + * 上传计划班次 指定日期 yyyy-MM-dd
  816 + * @param theDate
  817 + * @return
  818 + */
  819 + public String setJHBC(String theDate){
  820 + return uploadJHBC(theDate);
  821 + }
  822 +
  823 + /**
  824 + * 上传计划班次
  825 + * @return
  826 + */
  827 + public String setJHBC(){
  828 + return uploadJHBC(null);
  829 + }
  830 + /**
815 831 * 上传线路计划班次表
816 832 */
817   - @Override
818   - public String setJHBC() {
  833 +
  834 + private String uploadJHBC(String theDate) {
819 835 String result = "failure";
820 836 Line line;
821 837 StringBuffer sBuffer =new StringBuffer();
... ... @@ -825,8 +841,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
825 841 SchedulePlanInfo schedulePlanInfo;
826 842 String xlbm,zbh = "";
827 843 Long lp = 0L;
828   - // 取明天的日期
829   - String tomorrow = sdfnyr.format(DateUtils.addDays(new Date(), +1));
  844 + // 取得计划班次时间
  845 + String tomorrow = theDate == null ? sdfnyr.format(DateUtils.addDays(new Date(), +1)) : theDate;
830 846 // 查询所有班次
831 847 List<SchedulePlanInfo> schedulePlanList = schedulePlanInfoRepository.findLineScheduleBc(tomorrow);
832 848 int j = 0; // 初始化标识
... ...