|
@@ -4,9 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.ruoyi.common.datascope.annotation.DataScope;
|
|
|
import com.usky.common.core.bean.CommonPage;
|
|
|
import com.usky.common.core.exception.BusinessException;
|
|
|
+import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.common.security.utils.SecurityUtils;
|
|
|
import com.usky.iot.domain.PmProject;
|
|
|
import com.usky.iot.domain.PmReceive;
|
|
@@ -15,7 +15,6 @@ 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.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.iot.service.vo.ProjectWorkTimeVO;
|
|
|
import com.usky.iot.service.vo.UserWorkTimeVO;
|
|
|
import com.usky.iot.service.vo.WorkHoursStatisticsVO;
|
|
@@ -25,7 +24,6 @@ import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import com.ruoyi.common.datascope.context.DataScopeContextHolder;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDate;
|
|
@@ -90,6 +88,13 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
return rIds;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @description: 查询我收到的报告
|
|
|
+ * @author: fu
|
|
|
+ * @date: 2024/8/7 17:48
|
|
|
+ * @param: []
|
|
|
+ * @return: java.util.List<java.lang.Integer>
|
|
|
+ **/
|
|
|
private List<Integer> receive() {
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
Integer tenantId = SecurityUtils.getTenantId();
|
|
@@ -115,7 +120,14 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
}
|
|
|
return rIds;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 负责人项目id查询
|
|
|
+ * @author: fu
|
|
|
+ * @date: 2024/8/7 17:14
|
|
|
+ * @param: []
|
|
|
+ * @return: java.util.List<java.lang.Integer>
|
|
|
+ **/
|
|
|
private List<Integer> head() {
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
Integer tenantId = SecurityUtils.getTenantId();
|
|
@@ -331,6 +343,13 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
return reportList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @description: 用户名、账户名查询
|
|
|
+ * @author: fu
|
|
|
+ * @date: 2024/8/7 17:28
|
|
|
+ * @param: [userIds]
|
|
|
+ * @return: java.util.List<com.usky.system.domain.SysUser>
|
|
|
+ **/
|
|
|
@Override
|
|
|
public List<SysUser> nickNames(List<Long> userIds) {
|
|
|
LambdaQueryWrapper<SysUser> usersQuery = Wrappers.lambdaQuery();
|
|
@@ -352,12 +371,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) {
|
|
|
+ CommonPage<PmWorkReport> returnPage = new CommonPage<>(new ArrayList<>(), 0, pageSize, pageNum);
|
|
|
Integer tenantId = SecurityUtils.getTenantId();
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
String userName = SecurityUtils.getUsername();
|
|
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
|
|
List<Integer> headProjects = head();
|
|
|
+ if (projectAscription == 1 && headProjects.isEmpty()){
|
|
|
+ return returnPage;
|
|
|
+ }
|
|
|
List<Integer> receiveList2 = receive();
|
|
|
+ if (projectAscription == 2 && receiveList2.isEmpty()){
|
|
|
+ return returnPage;
|
|
|
+ }
|
|
|
List<Long> userIds = new ArrayList<>();
|
|
|
LambdaQueryWrapper<PmWorkContent> contentLambdaQuery = Wrappers.lambdaQuery();
|
|
|
contentLambdaQuery.select(PmWorkContent::getReportId, PmWorkContent::getWorkContent, PmWorkContent::getWorkTime, PmWorkContent::getProjectName);
|
|
@@ -391,7 +417,7 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
List<PmWorkContent> pmWorkContentList = pmWorkContentMapper.selectList(contentLambdaQuery);
|
|
|
Set<Integer> reportIds = pmWorkContentList.stream().map(PmWorkContent::getReportId).collect(Collectors.toSet());
|
|
|
if (reportIds.isEmpty()) {
|
|
|
- return new CommonPage<>(new ArrayList<>(), 0, pageSize, pageNum);
|
|
|
+ return returnPage;
|
|
|
}
|
|
|
|
|
|
LambdaQueryWrapper<PmWorkReport> reportQuery = Wrappers.lambdaQuery();
|
|
@@ -404,6 +430,9 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
.orderByDesc(PmWorkReport::getCreateTime);
|
|
|
}
|
|
|
IPage<PmWorkReport> reportPage = pmWorkReportMapper.selectPage(new Page<>(pageNum, pageSize), reportQuery);
|
|
|
+ if (reportPage.getRecords() == null || reportPage.getRecords().isEmpty()){
|
|
|
+ return returnPage;
|
|
|
+ }
|
|
|
List<PmWorkReport> reportList = reportPage.getRecords();
|
|
|
|
|
|
LambdaQueryWrapper<PmReceive> statusQuery = Wrappers.lambdaQuery();
|
|
@@ -429,12 +458,16 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- List<SysUser> nickNames = nickNames(userIds);
|
|
|
- Map<Long, String> userNicknameMap = nickNames.stream()
|
|
|
- .collect(Collectors.toMap(SysUser::getUserId, SysUser::getNickName));
|
|
|
- reportList.forEach(report -> {
|
|
|
- report.setCreateBy(userNicknameMap.get(report.getSubmitterId()));
|
|
|
- });
|
|
|
+ if (!userIds.isEmpty()) {
|
|
|
+ List<SysUser> nickNames = nickNames(userIds);
|
|
|
+ Map<Long, String> userNicknameMap = nickNames.stream()
|
|
|
+ .collect(Collectors.toMap(SysUser::getUserId, SysUser::getNickName));
|
|
|
+ reportList.forEach(report -> {
|
|
|
+ report.setCreateBy(userNicknameMap.get(report.getSubmitterId()));
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
return new CommonPage<>(reportList, reportPage.getTotal(), pageSize, pageNum);
|
|
|
}
|