|
@@ -7,14 +7,12 @@ import com.usky.common.security.utils.SecurityUtils;
|
|
import com.usky.iot.domain.PmProject;
|
|
import com.usky.iot.domain.PmProject;
|
|
import com.usky.iot.domain.PmWorkContent;
|
|
import com.usky.iot.domain.PmWorkContent;
|
|
import com.usky.iot.domain.PmWorkReport;
|
|
import com.usky.iot.domain.PmWorkReport;
|
|
-import com.usky.iot.mapper.PmProjectMapper;
|
|
|
|
import com.usky.iot.mapper.PmWorkContentMapper;
|
|
import com.usky.iot.mapper.PmWorkContentMapper;
|
|
import com.usky.iot.mapper.PmWorkReportMapper;
|
|
import com.usky.iot.mapper.PmWorkReportMapper;
|
|
import com.usky.iot.service.PmProjectService;
|
|
import com.usky.iot.service.PmProjectService;
|
|
import com.usky.iot.service.PmWorkContentService;
|
|
import com.usky.iot.service.PmWorkContentService;
|
|
import com.usky.iot.service.PmWorkReportService;
|
|
import com.usky.iot.service.PmWorkReportService;
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
-import com.usky.iot.service.vo.PmProjectTotalWorkTimeVo;
|
|
|
|
import com.usky.iot.service.vo.PmProjectWorkTimeVo;
|
|
import com.usky.iot.service.vo.PmProjectWorkTimeVo;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -24,7 +22,6 @@ import java.math.RoundingMode;
|
|
import java.time.DayOfWeek;
|
|
import java.time.DayOfWeek;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
-import java.time.LocalTime;
|
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
import java.time.temporal.TemporalAdjusters;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
@@ -61,7 +58,10 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public List<PmWorkReport> weekWork(String startDate, String endDate, Integer reportId) {
|
|
|
|
|
|
+ public List<Map<String, List<PmWorkReport>>> weekWork(String startDate, String endDate, Integer reportId) {
|
|
|
|
+ List<Map<String, List<PmWorkReport>>> returnList2 = new ArrayList<>();
|
|
|
|
+ Map<String, List<PmWorkReport>> weekData = new HashMap<>();
|
|
|
|
+ Map<String, List<PmWorkReport>> newData = new HashMap<>();
|
|
LocalDate startDate1 = null;
|
|
LocalDate startDate1 = null;
|
|
LocalDate endDate1 = null;
|
|
LocalDate endDate1 = null;
|
|
if (startDate == null && endDate == null) {
|
|
if (startDate == null && endDate == null) {
|
|
@@ -84,7 +84,7 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
|
|
.between(PmWorkReport::getReportDate, startDate1, endDate1)
|
|
.between(PmWorkReport::getReportDate, startDate1, endDate1)
|
|
.orderByAsc(PmWorkReport::getReportDate)
|
|
.orderByAsc(PmWorkReport::getReportDate)
|
|
.apply(reportId != 0, "id = " + reportId);
|
|
.apply(reportId != 0, "id = " + reportId);
|
|
- List<PmWorkReport> reports = this.list(queryWrapperR);
|
|
|
|
|
|
+ List<PmWorkReport> reports = baseMapper.selectList(queryWrapperR);
|
|
if (reports.isEmpty()) {
|
|
if (reports.isEmpty()) {
|
|
List<PmWorkReport> reports1 = new ArrayList<>();
|
|
List<PmWorkReport> reports1 = new ArrayList<>();
|
|
for (int f = 0; f < dates.size(); f++) {
|
|
for (int f = 0; f < dates.size(); f++) {
|
|
@@ -94,7 +94,12 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
|
|
report1.setWorkContents(content);
|
|
report1.setWorkContents(content);
|
|
reports1.add(report1);
|
|
reports1.add(report1);
|
|
}
|
|
}
|
|
- return reports1;
|
|
|
|
|
|
+ weekData.put("weekData", reports1);
|
|
|
|
+ List<PmWorkReport> report = new ArrayList<>();
|
|
|
|
+ newData.put("newData", report);
|
|
|
|
+ returnList2.add(weekData);
|
|
|
|
+ returnList2.add(newData);
|
|
|
|
+ return returnList2;
|
|
}
|
|
}
|
|
List<Integer> ids = new ArrayList<>();
|
|
List<Integer> ids = new ArrayList<>();
|
|
for (PmWorkReport pwr : reports) {
|
|
for (PmWorkReport pwr : reports) {
|
|
@@ -118,7 +123,21 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
|
|
reports.get(i).setWorkContents(contentList);
|
|
reports.get(i).setWorkContents(contentList);
|
|
}
|
|
}
|
|
if (reports.size() == 7 || reportId != 0) {
|
|
if (reports.size() == 7 || reportId != 0) {
|
|
- return reports;
|
|
|
|
|
|
+ weekData.put("weekData", reports);
|
|
|
|
+ returnList2.add(weekData);
|
|
|
|
+ LambdaQueryWrapper<PmWorkReport> wrapper1 = Wrappers.lambdaQuery();
|
|
|
|
+ wrapper1.eq(PmWorkReport::getSubmitterId, SecurityUtils.getUserId())
|
|
|
|
+ .orderByDesc(PmWorkReport::getReportDate)
|
|
|
|
+ .last("LIMIT 1");
|
|
|
|
+ List<PmWorkReport> report = this.list(wrapper1);
|
|
|
|
+ Integer rId = report.get(0).getId();
|
|
|
|
+ LambdaQueryWrapper<PmWorkContent> wrapperC = Wrappers.lambdaQuery();
|
|
|
|
+ wrapperC.eq(PmWorkContent::getProjectId, rId);
|
|
|
|
+ List<PmWorkContent> pmWorkContents = pmWorkContentMapper.selectList(wrapperC);
|
|
|
|
+ report.get(0).setWorkContents(pmWorkContents);
|
|
|
|
+ newData.put("newData", report);
|
|
|
|
+ returnList2.add(newData);
|
|
|
|
+ return returnList2;
|
|
}
|
|
}
|
|
List<PmWorkReport> reportList = new ArrayList<>();
|
|
List<PmWorkReport> reportList = new ArrayList<>();
|
|
for (int d = 0; d < dates.size(); d++) {
|
|
for (int d = 0; d < dates.size(); d++) {
|
|
@@ -138,7 +157,23 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
|
|
reportList.add(newReport);
|
|
reportList.add(newReport);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return reportList;
|
|
|
|
|
|
+ //返回最新的一条数据给前端填充
|
|
|
|
+ LambdaQueryWrapper<PmWorkReport> wrapper2 = Wrappers.lambdaQuery();
|
|
|
|
+ wrapper2.eq(PmWorkReport::getSubmitterId, SecurityUtils.getUserId())
|
|
|
|
+ .orderByDesc(PmWorkReport::getReportDate)
|
|
|
|
+ .last("LIMIT 1");
|
|
|
|
+ List<PmWorkReport> report = baseMapper.selectList(wrapper2);
|
|
|
|
+ Integer rId = report.get(0).getId();
|
|
|
|
+ LambdaQueryWrapper<PmWorkContent> wrapperC = Wrappers.lambdaQuery();
|
|
|
|
+ wrapperC.eq(PmWorkContent::getProjectId, rId);
|
|
|
|
+ List<PmWorkContent> pmWorkContents = pmWorkContentMapper.selectList(wrapperC);
|
|
|
|
+ report.get(0).setWorkContents(pmWorkContents);
|
|
|
|
+ newData.put("newData", report);
|
|
|
|
+ weekData.put("weekData", reportList);
|
|
|
|
+ List<Map<String, List<PmWorkReport>>> returnList = new ArrayList<>();
|
|
|
|
+ returnList.add(newData);
|
|
|
|
+ returnList.add(weekData);
|
|
|
|
+ return returnList;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|