|
@@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@RequestMapping("studentInstrument")
|
|
@@ -80,6 +81,26 @@ public class StudentInstrumentController extends BaseController {
|
|
|
if (studentInstrument.getStudentId() == null) {
|
|
|
return failed("学生id不能为空");
|
|
|
}
|
|
|
+ Date nowDate = new Date();
|
|
|
+ //不是乐保
|
|
|
+ if (studentInstrument.getStatus().equals(0)) {
|
|
|
+ studentInstrument.setStartTime(null);
|
|
|
+ studentInstrument.setEndTime(null);
|
|
|
+ }
|
|
|
+ if (studentInstrument.getStatus().equals(1)) {
|
|
|
+ if (studentInstrument.getStartTime() == null) {
|
|
|
+ return failed("乐保开始时间不能为空");
|
|
|
+ }
|
|
|
+ if (studentInstrument.getEndTime() == null) {
|
|
|
+ return failed("乐保结束时间不能为空");
|
|
|
+ }
|
|
|
+ if (studentInstrument.getStartTime().compareTo(nowDate) > 0) {
|
|
|
+ return failed("乐保开始时间不能大于当前时间");
|
|
|
+ }
|
|
|
+ if (studentInstrument.getEndTime().compareTo(nowDate) <= 0) {
|
|
|
+ return failed("乐保结束时间不能小于当前时间");
|
|
|
+ }
|
|
|
+ }
|
|
|
studentInstrument.setOperation(sysUser.getId());
|
|
|
SysUser student = sysUserFeignService.queryUserById(studentInstrument.getStudentId());
|
|
|
studentInstrument.setOrganId(student.getOrganId());
|
|
@@ -114,6 +135,26 @@ public class StudentInstrumentController extends BaseController {
|
|
|
if (studentInstrument.getStudentId() == null) {
|
|
|
return failed("学生id不能为空");
|
|
|
}
|
|
|
+ Date nowDate = new Date();
|
|
|
+ //不是乐保
|
|
|
+ if (studentInstrument.getStatus().equals(0)) {
|
|
|
+ studentInstrument.setStartTime(null);
|
|
|
+ studentInstrument.setEndTime(null);
|
|
|
+ }
|
|
|
+ if (studentInstrument.getStatus().equals(1)) {
|
|
|
+ if (studentInstrument.getStartTime() == null) {
|
|
|
+ return failed("乐保开始时间不能为空");
|
|
|
+ }
|
|
|
+ if (studentInstrument.getEndTime() == null) {
|
|
|
+ return failed("乐保结束时间不能为空");
|
|
|
+ }
|
|
|
+ if (studentInstrument.getStartTime().compareTo(nowDate) > 0) {
|
|
|
+ return failed("乐保开始时间不能大于当前时间");
|
|
|
+ }
|
|
|
+ if (studentInstrument.getEndTime().compareTo(nowDate) <= 0) {
|
|
|
+ return failed("乐保结束时间不能小于当前时间");
|
|
|
+ }
|
|
|
+ }
|
|
|
studentInstrument.setOperation(sysUser.getId());
|
|
|
SysUser student = sysUserFeignService.queryUserById(studentInstrument.getStudentId());
|
|
|
studentInstrument.setOrganId(student.getOrganId());
|