|
@@ -679,22 +679,23 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
//新增或编辑报告
|
|
|
@Override
|
|
|
public HttpRespMsg editReport(List<Report> reportList, String date, List<User> userList, BigDecimal hourCost, Integer companyId) {
|
|
|
-// System.out.println("传过来的数据"+reportList.toString()+"=========="+reportList.size()+"===="+reportList.get(0));
|
|
|
+ System.out.println("date"+date);
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
|
//删除不在本次更新名单中的老记录
|
|
|
List<Integer> idList = reportList.stream().filter(r->r.getId() != null).map(Report::getId).collect(Collectors.toList());
|
|
|
- if (date != null && !date.contains("@")) {
|
|
|
- //取到已有记录的id集合
|
|
|
- if (idList.size() > 0) {
|
|
|
+ //只有填写日报的report才会有id, 前端会把全部状态的日报都传过来
|
|
|
+ if (idList.size() > 0) {
|
|
|
+ if (date != null && !date.contains("@")) {
|
|
|
+ //取到已有记录的id集合
|
|
|
reportMapper.delete(new QueryWrapper<Report>()
|
|
|
.eq("create_date", date)
|
|
|
.eq("creator_id", reportList.get(0).getCreatorId())
|
|
|
+ .ne("state", 0)//后端也要做安全校验,把待审核和已通过的排除,防止误删
|
|
|
+ .ne("state", 1)
|
|
|
.notIn("id", idList));
|
|
|
}
|
|
|
- }
|
|
|
- //已通过和待审核状态的不需要处理
|
|
|
- if (idList.size() > 0) {
|
|
|
+ //已通过和待审核状态的不需要处理
|
|
|
List<Report> existsReportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, state").in("id", idList));
|
|
|
if (existsReportList.size() > 0) {
|
|
|
List<Integer> ignoreIds = existsReportList.stream().filter(ex -> ex.getState() == 0 || ex.getState() == 1).map(Report::getId).collect(Collectors.toList());
|