Commit bf3f9a8e authored by 蔡镇泽's avatar 蔡镇泽

添加校验

parent 78baaeee
...@@ -129,6 +129,15 @@ public class TaskController { ...@@ -129,6 +129,15 @@ public class TaskController {
if (person1 == null) { if (person1 == null) {
return Result.failed("鉴定人员1不能为空!"); return Result.failed("鉴定人员1不能为空!");
} }
if (taskId == null) {
return Result.failed("评定任务id不能为空!");
}
if (disableLevelId == null) {
return Result.failed("失能等级id不能为空!");
}
if (StringUtils.isBlank(evaluateTime)) {
return Result.failed("评估时间不能为空!");
}
Date evaluateDate; Date evaluateDate;
try { try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
...@@ -136,7 +145,11 @@ public class TaskController { ...@@ -136,7 +145,11 @@ public class TaskController {
} catch (ParseException e) { } catch (ParseException e) {
return Result.failed("评估时间格式不正确!"); return Result.failed("评估时间格式不正确!");
} }
taskService.addReport(taskId, person1, person2, person3, evaluateDate, disableLevelId, polNo, remark); Result<Object> objectResult = taskService.addReport(taskId, person1, person2, person3, evaluateDate, disableLevelId, polNo, remark);
if (!ResultCode.SUCCESS.getCode().equals(objectResult.getCode())) {
//失败
return Result.failed(objectResult.getMsg());
}
return Result.success(); return Result.success();
} }
......
...@@ -51,7 +51,7 @@ public interface TaskService { ...@@ -51,7 +51,7 @@ public interface TaskService {
List<AprEmpVO> aprEmpList(String organName, String name, String tel, String groupLeader); List<AprEmpVO> aprEmpList(String organName, String name, String tel, String groupLeader);
void addReport(Integer taskId, Integer person1, Integer person2, Integer person3, Date evaluateTime, Integer disableLevelId, String polNo, String remark); Result<Object> addReport(Integer taskId, Integer person1, Integer person2, Integer person3, Date evaluateTime, Integer disableLevelId, String polNo, String remark);
void updateReport(Integer reportId, Integer person1, Integer person2, Integer person3, Date evaluateDate, Integer disableLevelId, String polNo, String remark); void updateReport(Integer reportId, Integer person1, Integer person2, Integer person3, Date evaluateDate, Integer disableLevelId, String polNo, String remark);
......
...@@ -63,7 +63,11 @@ public class TaskServiceImpl implements TaskService { ...@@ -63,7 +63,11 @@ public class TaskServiceImpl implements TaskService {
} }
@Override @Override
public void addReport(Integer taskId, Integer person1, Integer person2, Integer person3, Date evaluateTime, Integer disableLevelId, String polNo, String remark) { public Result<Object> addReport(Integer taskId, Integer person1, Integer person2, Integer person3, Date evaluateTime, Integer disableLevelId, String polNo, String remark) {
ChAprTask task = taskMapper.selectById(taskId);
if (task != null) {
return Result.failed("已存在的评定任务报告!");
}
ChAprReport report = new ChAprReport(); ChAprReport report = new ChAprReport();
report.setTaskId(taskId); report.setTaskId(taskId);
report.setEffTime(new Date()); report.setEffTime(new Date());
...@@ -93,6 +97,7 @@ public class TaskServiceImpl implements TaskService { ...@@ -93,6 +97,7 @@ public class TaskServiceImpl implements TaskService {
personInfo.setFcd(new Date()); personInfo.setFcd(new Date());
personInfoMapper.insert(personInfo); personInfoMapper.insert(personInfo);
} }
return Result.success();
} }
@Override @Override
......
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