Commit fc3b04b2d47b691b10a7a20a5be4b664664747b2
1 parent
324c6bd8
上传电子路单(可自定义日期)
Showing
3 changed files
with
30 additions
and
3 deletions
src/main/java/com/bsth/controller/schedule/TrafficManageController.java
| ... | ... | @@ -51,7 +51,16 @@ public class TrafficManageController { |
| 51 | 51 | @RequestMapping(value = "/setLD", method = RequestMethod.GET) |
| 52 | 52 | public String setLD() throws Exception { |
| 53 | 53 | try { |
| 54 | - return trManageService.setLD(); | |
| 54 | + return trManageService.setLD(null); | |
| 55 | + } catch (Exception exp) { | |
| 56 | + throw new Exception(exp.getCause()); | |
| 57 | + } | |
| 58 | + } | |
| 59 | + | |
| 60 | + @RequestMapping(value = "/setLDByDate", method = RequestMethod.GET) | |
| 61 | + public String setLDByDate(@RequestParam("theDate") String theDate) throws Exception { | |
| 62 | + try { | |
| 63 | + return trManageService.setLD(theDate); | |
| 55 | 64 | } catch (Exception exp) { |
| 56 | 65 | throw new Exception(exp.getCause()); |
| 57 | 66 | } | ... | ... |
src/main/java/com/bsth/service/TrafficManageService.java
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| ... | ... | @@ -279,14 +279,30 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
| 282 | + * 上传路单 指定日期 yyyy-MM-dd | |
| 283 | + * @param theDate | |
| 284 | + * @return | |
| 285 | + */ | |
| 286 | + public String setLD(String theDate){ | |
| 287 | + return uploadLD(theDate); | |
| 288 | + } | |
| 289 | + | |
| 290 | + /** | |
| 291 | + * 上传路单 上传前一天的路单 | |
| 292 | + * @return | |
| 293 | + */ | |
| 294 | + public String setLD(){ | |
| 295 | + return uploadLD(null); | |
| 296 | + } | |
| 297 | + /** | |
| 282 | 298 | * 上传路单 |
| 283 | 299 | * @return 上传成功标识 |
| 284 | 300 | */ |
| 285 | - public String setLD(){ | |
| 301 | + private String uploadLD(String theDate){ | |
| 286 | 302 | String result = "failure"; |
| 287 | 303 | Line line; |
| 288 | 304 | // 取昨天 的日期 |
| 289 | - String date = sdfnyr.format(DateUtils.addDays(new Date(), -1)); | |
| 305 | + String date = theDate == null ?sdfnyr.format(DateUtils.addDays(new Date(), -1)) : theDate; | |
| 290 | 306 | StringBuffer sf = new StringBuffer(); |
| 291 | 307 | String str; |
| 292 | 308 | try { | ... | ... |