Commit c2979340 authored by zhengjiangtao's avatar zhengjiangtao

重做计划结束时间不大于等于当前时间

parent fad22711
......@@ -45,8 +45,12 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
......@@ -108,6 +112,12 @@ public class PlanTaskController extends BaseController {
if (param.get("endDate") == null) {
throw new YeeException("结束日期不能为空");
}
String endTime = (String) param.get("endDate");
if(judgingTime(endTime)) {
throw new YeeException("计划结束时间应在当前时间以后");
}
if (param.get("changeFlag") == null) {
throw new YeeException("是否记为合格不能为空");
}
......@@ -620,4 +630,15 @@ public class PlanTaskController extends BaseController {
}
}
/**
* 判断结束时间是否在当前时间以前
* @param endTime
* @return
*/
private boolean judgingTime(String endData) {
LocalDate endOfFeb = LocalDate.parse(endData);
return endOfFeb.isBefore(LocalDate.now());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment