Commit 10a067b0cc6b1100f2ac64ca22dd77bbcc9682ee

Authored by 王通
1 parent 006fe995

1.历史路单维护加入T+2校验

src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -32,6 +32,7 @@ import java.util.regex.Pattern;
32 32 import org.apache.commons.io.IOUtils;
33 33 import org.apache.commons.lang3.StringEscapeUtils;
34 34 import org.apache.commons.lang3.StringUtils;
  35 +import org.joda.time.DateTime;
35 36 import org.joda.time.format.DateTimeFormat;
36 37 import org.joda.time.format.DateTimeFormatter;
37 38 import org.slf4j.Logger;
... ... @@ -621,7 +622,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf
621 622 public Map<String, Object> addToHistory(ScheduleRealInfo t) {
622 623 Map<String, Object> rs = new HashMap<>();
623 624 try {
  625 + // 检查调度日期
  626 + DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
  627 + long today = formatter.parseMillis(new DateTime().toString("yyyy-MM-dd")), scheduleDate = formatter.parseMillis(t.getScheduleDateStr());
624 628 String clZbh = t.getClZbh(), lpName = t.getLpName();
  629 + if (today < scheduleDate || today - scheduleDate > 172800000) {
  630 + rs.put("status", ResponseCode.ERROR);
  631 + rs.put("msg", "无效的调度日期");
  632 + return rs;
  633 + }
625 634 if (StringUtils.isEmpty(lpName) || StringUtils.isEmpty(lpName.trim())) {
626 635 rs.put("status", ResponseCode.ERROR);
627 636 rs.put("msg", "路牌信息缺失");
... ... @@ -4667,6 +4676,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4667 4676 rs.put("status", ResponseCode.ERROR);
4668 4677  
4669 4678 ScheduleRealInfo oldSch = super.findById(sch.getId());
  4679 + // 检查调度日期
  4680 + DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
  4681 + long today = formatter.parseMillis(new DateTime().toString("yyyy-MM-dd")), scheduleDate = formatter.parseMillis(sch.getScheduleDateStr());
  4682 + if (today < scheduleDate || today - scheduleDate > 172800000) {
  4683 + rs.put("status", ResponseCode.ERROR);
  4684 + rs.put("msg", "无效的调度日期");
  4685 + return rs;
  4686 + }
4670 4687 //事后日志记录
4671 4688 AfterwardsLogger aflog = AfterwardsLogger.start(oldSch, "事后调整");
4672 4689  
... ...