|
@@ -7,9 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ruoyi.common.datascope.annotation.DataScope;
|
|
|
import com.ruoyi.common.datascope.context.DataScopeContextHolder;
|
|
|
import com.usky.common.core.bean.CommonPage;
|
|
|
-import com.usky.common.core.domain.R;
|
|
|
import com.usky.common.core.exception.BusinessException;
|
|
|
-import com.usky.common.log.annotation.Log;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.common.security.utils.SecurityUtils;
|
|
|
import com.usky.iot.domain.PmProject;
|
|
@@ -17,7 +15,6 @@ import com.usky.iot.domain.PmReceive;
|
|
|
import com.usky.iot.domain.PmWorkContent;
|
|
|
import com.usky.iot.domain.PmWorkReport;
|
|
|
import com.usky.iot.mapper.*;
|
|
|
-import com.usky.iot.service.PmProjectService;
|
|
|
import com.usky.iot.service.PmWorkContentService;
|
|
|
import com.usky.iot.service.vo.*;
|
|
|
import com.usky.system.domain.SysUser;
|
|
@@ -178,13 +175,18 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
* @return: java.util.List<com.usky.iot.domain.PmProject>
|
|
|
**/
|
|
|
@Override
|
|
|
- public List<PmWorkContent> projectQuery(String startDate, String endDate, String projectName, Integer projectAscription) {
|
|
|
+ public List<PmWorkContent> projectQuery(String startDate, String endDate, String projectName, Integer projectAscription, Long submitterId) {
|
|
|
LocalDateTime startDateTime = null;
|
|
|
LocalDateTime endDateTime = null;
|
|
|
LocalDate start = null;
|
|
|
LocalDate end = null;
|
|
|
List<PmWorkContent> workContentList = new ArrayList<>();
|
|
|
List<Integer> reportIds = new ArrayList<>();
|
|
|
+
|
|
|
+ Set<Integer> reportIdsByDate = new HashSet<>();
|
|
|
+ Set<Integer> reportIdsBySubmitterId = new HashSet<>();
|
|
|
+ Set<Integer> finalReportIds = new HashSet<>();
|
|
|
+
|
|
|
if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) {
|
|
|
DateTimeFormatter formatter = null;
|
|
|
try {
|
|
@@ -194,15 +196,29 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
}
|
|
|
start = LocalDate.parse(startDate, formatter);
|
|
|
end = LocalDate.parse(endDate, formatter);
|
|
|
- // startDateTime = start.atStartOfDay();
|
|
|
- // endDateTime = end.atTime(23, 59, 59);
|
|
|
+ startDateTime = start.atStartOfDay();
|
|
|
+ endDateTime = end.atTime(23, 59, 59);
|
|
|
LambdaQueryWrapper<PmWorkReport> reportQuery = Wrappers.lambdaQuery();
|
|
|
- reportQuery.select(PmWorkReport::getId).between(PmWorkReport::getReportDate, start, end);
|
|
|
- reportIds = pmWorkReportMapper.selectList(reportQuery).stream().map(PmWorkReport::getId).collect(Collectors.toList());
|
|
|
- if (reportIds.isEmpty()){
|
|
|
- return workContentList;
|
|
|
- }
|
|
|
+ reportQuery.select(PmWorkReport::getId).between(PmWorkReport::getSubmitDate, startDateTime, endDateTime);
|
|
|
+ reportIdsByDate = pmWorkReportMapper.selectList(reportQuery).stream().map(PmWorkReport::getId).collect(Collectors.toSet());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (submitterId != null) {
|
|
|
+ LambdaQueryWrapper<PmWorkReport> reportQuery = Wrappers.lambdaQuery();
|
|
|
+ reportQuery.select(PmWorkReport::getId).eq(PmWorkReport::getSubmitterId, submitterId);
|
|
|
+ reportIdsBySubmitterId = pmWorkReportMapper.selectList(reportQuery).stream().map(PmWorkReport::getId).collect(Collectors.toSet());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 取交集
|
|
|
+ if (!reportIdsByDate.isEmpty() && !reportIdsBySubmitterId.isEmpty()) {
|
|
|
+ finalReportIds.addAll(reportIdsByDate);
|
|
|
+ finalReportIds.retainAll(reportIdsBySubmitterId);
|
|
|
+ } else if (!reportIdsByDate.isEmpty()) {
|
|
|
+ finalReportIds.addAll(reportIdsByDate);
|
|
|
+ } else if (!reportIdsBySubmitterId.isEmpty()) {
|
|
|
+ finalReportIds.addAll(reportIdsBySubmitterId);
|
|
|
}
|
|
|
+ reportIds = new ArrayList<>(finalReportIds);
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<PmWorkContent> contentLambdaQuery = Wrappers.lambdaQuery();
|
|
@@ -415,13 +431,6 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
return sysUserMapper.selectList(usersQuery);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public List<SysUser> allNickName() {
|
|
|
- LambdaQueryWrapper<SysUser> usersQuery = Wrappers.lambdaQuery();
|
|
|
- usersQuery.select(SysUser::getUserId, SysUser::getNickName, SysUser::getUserName).eq(SysUser::getTenantId, SecurityUtils.getTenantId()).eq(SysUser::getDelFlag, 0);
|
|
|
- return sysUserMapper.selectList(usersQuery);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @description: 报告记录分页
|
|
|
* @author: fu
|
|
@@ -432,13 +441,19 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
@Override
|
|
|
public CommonPage<PmWorkReport> reportPage(Integer projectAscription, Integer pageNum, Integer pageSize, Integer reportId,
|
|
|
String startDate, String endDate, Integer projectId, Long userId) {
|
|
|
- // LocalDateTime startDateTime = null;
|
|
|
- // LocalDateTime endDateTime = null;
|
|
|
+ LocalDateTime startDateTime = null;
|
|
|
+ LocalDateTime endDateTime = null;
|
|
|
Integer tenantId = SecurityUtils.getTenantId();
|
|
|
LocalDate start = null;
|
|
|
LocalDate end = null;
|
|
|
List<Integer> reportIds = new ArrayList<>();
|
|
|
CommonPage<PmWorkReport> returnPage = new CommonPage<>(new ArrayList<>(), 0, pageSize, pageNum);
|
|
|
+
|
|
|
+ Set<Integer> reportIdsByUser = new HashSet<>();
|
|
|
+ Set<Integer> reportIdsByDate = new HashSet<>();
|
|
|
+ Set<Integer> reportIdsByProject = new HashSet<>();
|
|
|
+ Set<Integer> reportIdsSet = new HashSet<>();
|
|
|
+
|
|
|
if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) {
|
|
|
DateTimeFormatter formatter = null;
|
|
|
try {
|
|
@@ -448,36 +463,63 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
}
|
|
|
start = LocalDate.parse(startDate, formatter);
|
|
|
end = LocalDate.parse(endDate, formatter);
|
|
|
- // startDateTime = start.atStartOfDay();
|
|
|
- // endDateTime = end.atTime(23, 59, 59);
|
|
|
+ startDateTime = start.atStartOfDay();
|
|
|
+ endDateTime = end.atTime(23, 59, 59);
|
|
|
+ LambdaQueryWrapper<PmWorkReport> reportQuery = Wrappers.lambdaQuery();
|
|
|
+ reportQuery.select(PmWorkReport::getId).eq(PmWorkReport::getReportStatus, 1).between(PmWorkReport::getSubmitDate, startDateTime, endDateTime);
|
|
|
+ reportIdsByDate = pmWorkReportMapper.selectList(reportQuery).stream().map(PmWorkReport::getId).collect(Collectors.toSet());
|
|
|
+ }
|
|
|
|
|
|
- if (userId != null && userId > 0){
|
|
|
- LambdaQueryWrapper<PmWorkReport> reportQuery = Wrappers.lambdaQuery();
|
|
|
- reportQuery.eq(PmWorkReport::getSubmitterId, userId);
|
|
|
- IPage<PmWorkReport> reportPage = pmWorkReportMapper.selectPage(new Page<>(pageNum, pageSize), reportQuery);
|
|
|
- return new CommonPage<>(reportPage.getRecords(), reportPage.getTotal(), pageSize, pageNum);
|
|
|
- }
|
|
|
+ if (projectId != null) {
|
|
|
+ LambdaQueryWrapper<PmWorkContent> contentLambdaQuery = Wrappers.lambdaQuery();
|
|
|
+ contentLambdaQuery.select(PmWorkContent::getReportId).eq(PmWorkContent::getProjectId, projectId);
|
|
|
+ reportIdsByProject = pmWorkContentMapper.selectList(contentLambdaQuery).stream().map(PmWorkContent::getReportId).collect(Collectors.toSet());
|
|
|
+ }
|
|
|
|
|
|
+ if (userId != null) {
|
|
|
LambdaQueryWrapper<PmWorkReport> reportQuery = Wrappers.lambdaQuery();
|
|
|
- reportQuery.select(PmWorkReport::getId).eq(PmWorkReport::getReportStatus, 1).between(PmWorkReport::getReportDate, start, end);
|
|
|
- reportIds = pmWorkReportMapper.selectList(reportQuery).stream().map(PmWorkReport::getId).collect(Collectors.toList());
|
|
|
- if (reportIds.isEmpty()){
|
|
|
+ reportQuery.eq(PmWorkReport::getSubmitterId, userId);
|
|
|
+ reportIdsByUser = pmWorkReportMapper.selectList(reportQuery).stream().map(PmWorkReport::getId).collect(Collectors.toSet());
|
|
|
+ if (reportIdsByProject.isEmpty() && reportIdsByUser.isEmpty()) {
|
|
|
return returnPage;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (projectId != null && projectId > 0) {
|
|
|
- LambdaQueryWrapper<PmWorkContent> contentLambdaQuery = Wrappers.lambdaQuery();
|
|
|
- contentLambdaQuery.select(PmWorkContent::getReportId).eq(PmWorkContent::getProjectId, projectId);
|
|
|
- reportIds.addAll(pmWorkContentMapper.selectList(contentLambdaQuery).stream().map(PmWorkContent::getReportId).collect(Collectors.toList()));
|
|
|
- if (reportIds.isEmpty()) {
|
|
|
+ if (!reportIdsByUser.isEmpty() && !reportIdsByProject.isEmpty() && !reportIdsByDate.isEmpty()) {
|
|
|
+ reportIdsSet.addAll(reportIdsByUser);
|
|
|
+ reportIdsSet.retainAll(reportIdsByProject);
|
|
|
+ reportIdsSet.retainAll(reportIdsByDate);
|
|
|
+ if (reportIdsSet.isEmpty()) {
|
|
|
return returnPage;
|
|
|
}
|
|
|
+ } else if (!reportIdsByUser.isEmpty() && !reportIdsByProject.isEmpty()) {
|
|
|
+ reportIdsSet.addAll(reportIdsByUser);
|
|
|
+ reportIdsSet.retainAll(reportIdsByProject);
|
|
|
+ if (reportIdsSet.isEmpty()) {
|
|
|
+ return returnPage;
|
|
|
+ }
|
|
|
+ } else if (!reportIdsByUser.isEmpty() && !reportIdsByDate.isEmpty()) {
|
|
|
+ reportIdsSet.addAll(reportIdsByUser);
|
|
|
+ reportIdsSet.retainAll(reportIdsByDate);
|
|
|
+ if (reportIdsSet.isEmpty()) {
|
|
|
+ return returnPage;
|
|
|
+ }
|
|
|
+ } else if (!reportIdsByProject.isEmpty() && !reportIdsByDate.isEmpty()) {
|
|
|
+ reportIdsSet.addAll(reportIdsByProject);
|
|
|
+ reportIdsSet.retainAll(reportIdsByDate);
|
|
|
+ if (reportIdsSet.isEmpty()) {
|
|
|
+ return returnPage;
|
|
|
+ }
|
|
|
+ } else if (!reportIdsByUser.isEmpty()) {
|
|
|
+ reportIdsSet.addAll(reportIdsByUser);
|
|
|
+ } else if (!reportIdsByProject.isEmpty()) {
|
|
|
+ reportIdsSet.addAll(reportIdsByProject);
|
|
|
+ } else if (!reportIdsByDate.isEmpty()) {
|
|
|
+ reportIdsSet.addAll(reportIdsByDate);
|
|
|
}
|
|
|
-
|
|
|
+ reportIds = new ArrayList<>(reportIdsSet);
|
|
|
|
|
|
List<PmWorkContent> pmWorkContentList = new ArrayList<>();
|
|
|
- // Integer tenantId = SecurityUtils.getTenantId();
|
|
|
Long userId2 = SecurityUtils.getUserId();
|
|
|
List<Long> userIds = new ArrayList<>();
|
|
|
List<Integer> receiveList = receive();
|
|
@@ -486,7 +528,6 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
}
|
|
|
|
|
|
LambdaQueryWrapper<PmWorkContent> contentLambdaQuery = Wrappers.lambdaQuery();
|
|
|
- // contentLambdaQuery.select(PmWorkContent::getReportId, PmWorkContent::getWorkContent, PmWorkContent::getWorkTime, PmWorkContent::getProjectName);
|
|
|
if (reportId != null && reportId >= 0) {
|
|
|
contentLambdaQuery.eq(PmWorkContent::getReportId, reportId);
|
|
|
pmWorkContentList = pmWorkContentMapper.selectList(contentLambdaQuery);
|
|
@@ -571,16 +612,11 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
// 已读未读数量查询
|
|
|
List<PmReceive> receives = new ArrayList<>();
|
|
|
if (!receiveList.isEmpty()) {
|
|
|
- receives = receives(receiveList);
|
|
|
+ receives = receives(reportIds2);
|
|
|
}
|
|
|
|
|
|
Map<Integer, List<PmReceive>> reportReceivesMap = new HashMap<>();
|
|
|
if (!receives.isEmpty()) {
|
|
|
- List<Long> uId = new ArrayList<>();
|
|
|
- for (PmReceive pmReceive : receives) {
|
|
|
- Long receiverId = pmReceive.getReceiverId();
|
|
|
- uId.add(receiverId);
|
|
|
- }
|
|
|
reportReceivesMap = receives.stream().collect(Collectors.groupingBy(PmReceive::getReportId));
|
|
|
}
|
|
|
|
|
@@ -630,7 +666,7 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * @description: 获取报告接收人
|
|
|
+ * @description: 获取报告接收人-工具
|
|
|
* @author: fu
|
|
|
* @date: 2024/8/8 19:22
|
|
|
* @param: [report]
|
|
@@ -643,7 +679,7 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @description: 获取时间段内报告列表(按报告时间查询)
|
|
|
+ * @description: 获取时间段内报告列表(按报告时间查询)-工具
|
|
|
* @author: fu
|
|
|
* @date: 2024/8/8 19:22
|
|
|
* @param: [startDate, endDate]
|
|
@@ -657,7 +693,7 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @description: 项目查询
|
|
|
+ * @description: 项目查询-工具
|
|
|
* @author: fu
|
|
|
* @date: 2024/8/8 19:22
|
|
|
* @param: [startDate, endDate]
|
|
@@ -676,31 +712,34 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
return pmProjectMapper.selectList(projectsQuery);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- private List<SysUser> userNameList(Long userId) {
|
|
|
+ /**
|
|
|
+ * @description: 获取用户列表-工具
|
|
|
+ * @author: fu
|
|
|
+ * @date: 2024/8/8 19:22
|
|
|
+ * @param: [userId]
|
|
|
+ * @return: java.util.List<com.usky.iot.domain.SysUser>
|
|
|
+ **/
|
|
|
+ private List<SysUser> userNameList(List<Long> userId) {
|
|
|
LambdaQueryWrapper<SysUser> userNameQuery = Wrappers.lambdaQuery();
|
|
|
userNameQuery.select(SysUser::getUserId, SysUser::getNickName, SysUser::getUserName, SysUser::getPhonenumber, SysUser::getAvatar,
|
|
|
SysUser::getSex, SysUser::getDeptId, SysUser::getAddress)
|
|
|
.eq(SysUser::getDelFlag, 0)
|
|
|
.eq(SysUser::getStatus, 0);
|
|
|
- if (userId != null && userId != 0) {
|
|
|
- userNameQuery.eq(SysUser::getUserId, userId);
|
|
|
+ if (!userId.isEmpty()) {
|
|
|
+ userNameQuery.in(SysUser::getUserId, userId);
|
|
|
return sysUserMapper.selectList(userNameQuery);
|
|
|
}
|
|
|
- userNameQuery.apply(Objects.nonNull(DataScopeContextHolder.getDataScopeSql()),DataScopeContextHolder.getDataScopeSql());
|
|
|
- log.info("dataScopeSql: "+DataScopeContextHolder.getDataScopeSql());
|
|
|
- //userNameQuery.eq(SysUser::getTenantId, tenantId).eq(SysUser::getDeptId, deptId);
|
|
|
+ userNameQuery.apply(Objects.nonNull(DataScopeContextHolder.getDataScopeSql()), DataScopeContextHolder.getDataScopeSql());
|
|
|
return sysUserMapper.selectList(userNameQuery);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @description: 工时统计
|
|
|
+ * @description: 工时统计-工具
|
|
|
* @author: fu
|
|
|
* @date: 2024/8/8 19:22
|
|
|
* @param: [startDate, endDate, projectName, projectAscription]
|
|
|
* @return: java.util.List<com.usky.iot.domain.PmWorkReport>
|
|
|
**/
|
|
|
- //@DataScope//数据权限注解
|
|
|
private List<PmWorkContent> workTimeCount(List<Long> users, List<Integer> project, String startDate, String endDate) {
|
|
|
List<PmWorkContent> pmWorkContentList = new ArrayList<>();
|
|
|
Integer tenantId = SecurityUtils.getTenantId();
|
|
@@ -725,7 +764,6 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
return pmWorkContentList;
|
|
|
}
|
|
|
}
|
|
|
- //workTimeQuery.apply(DataScopeContextHolder.getDataScopeSql());// 数据权限设置
|
|
|
pmWorkContentList = pmWorkContentMapper.selectList(workTimeQuery);
|
|
|
|
|
|
Map<String, PmWorkContent> workTimeMap = new HashMap<>();
|
|
@@ -742,11 +780,20 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
return new ArrayList<>(workTimeMap.values());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @description: 工时统计
|
|
|
+ * @author: fu
|
|
|
+ * @date: 2024/8/8 19:22
|
|
|
+ * @param: [userId, projectId, startDate, endDate]
|
|
|
+ * @return: java.util.List<com.usky.iot.domain.WorkTimeExportVO>
|
|
|
+ **/
|
|
|
@DataScope
|
|
|
@Override
|
|
|
- public List<Object> workHourStatistic(Long userId, Integer projectId, Integer filter, String startDate, String endDate, Integer workerOrProject) {
|
|
|
+ public List<Object> workHourStatistic(List<Long> userId, Integer projectId, Integer filter, String startDate, String endDate, Integer workerOrProject) {
|
|
|
List<ProjectWorkTimeVO> projectWorkTime = new ArrayList<>();
|
|
|
List<UserWorkTimeVO> userWorkTimeVO = new ArrayList<>();
|
|
|
+ List<ProjectWorkTimeVO> projectWorkTime1 = new ArrayList<>();
|
|
|
+ List<UserWorkTimeVO> userWorkTimeVO1 = new ArrayList<>();
|
|
|
List<Object> returnList = new ArrayList<>();
|
|
|
if (StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)) {
|
|
|
throw new BusinessException("请设置查询时间范围!");
|
|
@@ -837,6 +884,49 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
}
|
|
|
}
|
|
|
returnList.add(projectWorkTime);
|
|
|
+
|
|
|
+
|
|
|
+ returnList.add(pmProjectName);
|
|
|
+ // 重组返回数据结构
|
|
|
+ for (String uName : nickName) {
|
|
|
+ String name1 = uName;
|
|
|
+ UserWorkTimeVO userWorkTimeVO2 = new UserWorkTimeVO();
|
|
|
+ userWorkTimeVO2.setProjectOrPerson(name1);
|
|
|
+ List<BigDecimal> workTime1 = new ArrayList<>();
|
|
|
+ boolean hasNonZeroWorkTime1 = false;
|
|
|
+ if (userAndProjectD.isEmpty()) {
|
|
|
+ for (String currentNickName : pmProjectName) {
|
|
|
+ workTime1.add(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (String currentNickName : pmProjectName) {
|
|
|
+ boolean foundWorkTime = false;
|
|
|
+ for (WorkHoursStatisticsVO workHoursStatisticsVO : userAndProjectD) {
|
|
|
+ String userNickName = workHoursStatisticsVO.getNickName();
|
|
|
+ String projectName = workHoursStatisticsVO.getProjectName();
|
|
|
+ BigDecimal userProjectWorkTime = workHoursStatisticsVO.getWorkTime();
|
|
|
+ if (userNickName == name1 && projectName == currentNickName) {
|
|
|
+ workTime1.add(userProjectWorkTime);
|
|
|
+ if (userProjectWorkTime.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
+ hasNonZeroWorkTime1 = true;
|
|
|
+ }
|
|
|
+ foundWorkTime = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!foundWorkTime) {
|
|
|
+ workTime1.add(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 过滤0工时
|
|
|
+ if (filter != 2 || hasNonZeroWorkTime1) {
|
|
|
+ userWorkTimeVO2.setWorkTime(workTime1);
|
|
|
+ userWorkTimeVO.add(userWorkTimeVO2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ returnList.add(userWorkTimeVO);
|
|
|
+
|
|
|
} else {
|
|
|
returnList.add(pmProjectName);
|
|
|
// 重组返回数据结构
|
|
@@ -852,47 +942,112 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
}
|
|
|
} else {
|
|
|
for (String currentNickName : pmProjectName) {
|
|
|
- boolean foundWorkTime = false;
|
|
|
- for (WorkHoursStatisticsVO workHoursStatisticsVO : userAndProjectD) {
|
|
|
- String userNickName = workHoursStatisticsVO.getNickName();
|
|
|
- String projectName = workHoursStatisticsVO.getProjectName();
|
|
|
- BigDecimal userProjectWorkTime = workHoursStatisticsVO.getWorkTime();
|
|
|
- if (userNickName == name && projectName == currentNickName) {
|
|
|
- workTime.add(userProjectWorkTime);
|
|
|
- if (userProjectWorkTime.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
- hasNonZeroWorkTime = true;
|
|
|
+ boolean foundWorkTime = false;
|
|
|
+ for (WorkHoursStatisticsVO workHoursStatisticsVO : userAndProjectD) {
|
|
|
+ String userNickName = workHoursStatisticsVO.getNickName();
|
|
|
+ String projectName = workHoursStatisticsVO.getProjectName();
|
|
|
+ BigDecimal userProjectWorkTime = workHoursStatisticsVO.getWorkTime();
|
|
|
+ if (userNickName == name && projectName == currentNickName) {
|
|
|
+ workTime.add(userProjectWorkTime);
|
|
|
+ if (userProjectWorkTime.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
+ hasNonZeroWorkTime = true;
|
|
|
+ }
|
|
|
+ foundWorkTime = true;
|
|
|
+ break;
|
|
|
}
|
|
|
- foundWorkTime = true;
|
|
|
- break;
|
|
|
+ }
|
|
|
+ if (!foundWorkTime) {
|
|
|
+ workTime.add(BigDecimal.ZERO);
|
|
|
}
|
|
|
}
|
|
|
- if (!foundWorkTime) {
|
|
|
+ }
|
|
|
+ // 过滤0工时
|
|
|
+ if (filter != 2 || hasNonZeroWorkTime) {
|
|
|
+ userWorkTimeVO2.setWorkTime(workTime);
|
|
|
+ userWorkTimeVO.add(userWorkTimeVO2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ returnList.add(userWorkTimeVO);
|
|
|
+
|
|
|
+
|
|
|
+ returnList.add(nickName);
|
|
|
+ // 重组返回数据结构
|
|
|
+ for (String name : pmProjectName) {
|
|
|
+ ProjectWorkTimeVO projectWorkTimeVO = new ProjectWorkTimeVO();
|
|
|
+ projectWorkTimeVO.setProjectOrPerson(name);
|
|
|
+ List<BigDecimal> workTime = new ArrayList<>();
|
|
|
+ boolean hasNonZeroWorkTime = false;
|
|
|
+ if (userAndProject.isEmpty()) {
|
|
|
+ for (String currentNickName : nickName) {
|
|
|
workTime.add(BigDecimal.ZERO);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ for (String currentNickName : nickName) {
|
|
|
+ boolean foundWorkTime = false;
|
|
|
+ for (WorkHoursStatisticsVO workHoursStatisticsVO : userAndProject) {
|
|
|
+ String userNickName = workHoursStatisticsVO.getNickName();
|
|
|
+ String projectName = workHoursStatisticsVO.getProjectName();
|
|
|
+ BigDecimal userProjectWorkTime = workHoursStatisticsVO.getWorkTime();
|
|
|
+ if (projectName == name && userNickName == currentNickName) {
|
|
|
+ workTime.add(userProjectWorkTime);
|
|
|
+ if (userProjectWorkTime.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
+ hasNonZeroWorkTime = true;
|
|
|
+ }
|
|
|
+ foundWorkTime = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!foundWorkTime) {
|
|
|
+ workTime.add(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 过滤0工时
|
|
|
+ if (filter != 2 || hasNonZeroWorkTime) {
|
|
|
+ projectWorkTimeVO.setWorkTime(workTime);
|
|
|
+ projectWorkTime.add(projectWorkTimeVO);
|
|
|
}
|
|
|
}
|
|
|
- // 过滤0工时
|
|
|
- if (filter != 2 || hasNonZeroWorkTime) {
|
|
|
- userWorkTimeVO2.setWorkTime(workTime);
|
|
|
- userWorkTimeVO.add(userWorkTimeVO2);
|
|
|
- }
|
|
|
+ returnList.add(projectWorkTime);
|
|
|
}
|
|
|
- returnList.add(userWorkTimeVO);
|
|
|
- }
|
|
|
return returnList;
|
|
|
-}
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 工时-明细-导出
|
|
|
+ * @param userId
|
|
|
+ * @param projectId
|
|
|
+ * @param startDate
|
|
|
+ * @param endDate
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @DataScope(deptAlias = "u")
|
|
|
+ @Override
|
|
|
+ public List<WorkTimeExportVO> workHourStatisticExport(Long userId, Integer projectId, String startDate, String
|
|
|
+ endDate) {
|
|
|
+ Integer tenantId = SecurityUtils.getTenantId();
|
|
|
+ LocalDate start = null;
|
|
|
+ LocalDate end = null;
|
|
|
+ if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) {
|
|
|
+ start = LocalDate.parse(startDate);
|
|
|
+ end = LocalDate.parse(endDate);
|
|
|
+ }
|
|
|
+ return pmWorkContentMapper.workHourStatisticExport(userId, projectId, start, end, tenantId);
|
|
|
+ }
|
|
|
|
|
|
-@DataScope
|
|
|
-@Override
|
|
|
-public List<WorkTimeExportVO> workHourStatisticExport(Long userId, Integer projectId, String startDate, String endDate) {
|
|
|
- Integer tenantId = SecurityUtils.getTenantId();
|
|
|
- LocalDate start = null;
|
|
|
- LocalDate end = null;
|
|
|
- if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) {
|
|
|
- start = LocalDate.parse(startDate);
|
|
|
- end = LocalDate.parse(endDate);
|
|
|
+ /**
|
|
|
+ * 工时-统计-导出
|
|
|
+ * @param userId
|
|
|
+ * @param projectId
|
|
|
+ * @param startDate
|
|
|
+ * @param endDate
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @DataScope
|
|
|
+ @Override
|
|
|
+ public List<WorkTimeExportTwoVO> workHourExport(Long userId, Integer projectId, Integer filter, String
|
|
|
+ startDate, String endDate, Integer workerOrProject) {
|
|
|
+ return Collections.emptyList();
|
|
|
}
|
|
|
- return pmWorkContentMapper.workHourStatisticExport(userId, projectId, start, end, tenantId);
|
|
|
-}
|
|
|
|
|
|
}
|