|
@@ -67,7 +67,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
public HttpRespMsg getReport(String date, HttpServletRequest request) {
|
|
public HttpRespMsg getReport(String date, HttpServletRequest request) {
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
try {
|
|
try {
|
|
- String userId = userMapper.selectById(request.getHeader("Token")).getId();
|
|
|
|
|
|
+ String userId = request.getHeader("Token");
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
//获取某日本人的所有日志
|
|
//获取某日本人的所有日志
|
|
resultMap.put("report", reportMapper.selectList(new QueryWrapper<Report>()
|
|
resultMap.put("report", reportMapper.selectList(new QueryWrapper<Report>()
|
|
@@ -93,21 +93,28 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
|
|
|
//新增或编辑报告
|
|
//新增或编辑报告
|
|
@Override
|
|
@Override
|
|
- public HttpRespMsg editReport(Report report) {
|
|
|
|
|
|
+ public HttpRespMsg editReport(Report[] reportList, HttpServletRequest request) {
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
- if (report.getId() == null) {
|
|
|
|
- //新增报告时 需要检查项目和人员id
|
|
|
|
- if (report.getCreatorId() == null || report.getProjectId() == null) {
|
|
|
|
- httpRespMsg.setError("请填写完整信息");
|
|
|
|
- } else {
|
|
|
|
- if (reportMapper.insert(report) == 0) {
|
|
|
|
- httpRespMsg.setError("操作失败");
|
|
|
|
|
|
+ try {
|
|
|
|
+ for (Report report : reportList) {
|
|
|
|
+ report.setCreatorId(request.getHeader("Token"));
|
|
|
|
+ if (report.getId() == null) {
|
|
|
|
+ //新增报告时 需要检查项目和人员id
|
|
|
|
+ if (report.getProjectId() == null) {
|
|
|
|
+ httpRespMsg.setError("请填写完整信息");
|
|
|
|
+ } else {
|
|
|
|
+ if (reportMapper.insert(report) == 0) {
|
|
|
|
+ httpRespMsg.setError("操作失败");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (reportMapper.updateById(report) == 0) {
|
|
|
|
+ httpRespMsg.setError("操作失败");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- if (reportMapper.updateById(report) == 0) {
|
|
|
|
- httpRespMsg.setError("操作失败");
|
|
|
|
- }
|
|
|
|
|
|
+ } catch (NullPointerException e) {
|
|
|
|
+ httpRespMsg.setError("验证失败");
|
|
}
|
|
}
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|
|
}
|
|
}
|