|
@@ -2625,33 +2625,35 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
int startIndex = (pageIndex-1)*pageSize;
|
|
|
int endIndex = pageSize*pageIndex;
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", companyId));
|
|
|
List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "全部项目阶段工时表");
|
|
|
List<SysRichFunction> functionInchargeList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "负责项目阶段工时表");
|
|
|
//判断查看权限
|
|
|
- List<Integer> inchagerIds=null;
|
|
|
+ List<ProjectWithStage> record = projectMapper.selectWithStage(companyId, startIndex, endIndex, projectId,null,startDate,endDate);
|
|
|
+ List<Integer> projectIds = record.stream().map(ProjectWithStage::getId).distinct().collect(Collectors.toList());
|
|
|
+ List<StageCost> allStageCostList = projectMapper.selectStageSum(projectIds,projectId,null,startDate,endDate);
|
|
|
+ String inchargerId=null;
|
|
|
if(functionAllList.size()==0){
|
|
|
- inchagerIds=new ArrayList<>();
|
|
|
if(functionInchargeList.size()>0){
|
|
|
- List<Project> list = projectList.stream().filter(pl -> (pl.getInchargerId()==null?0:pl.getInchargerId()).equals(user.getId())).collect(Collectors.toList());
|
|
|
- if(list!=null){
|
|
|
- List<Integer> collect = list.stream().map(li -> li.getId()).collect(Collectors.toList());
|
|
|
- inchagerIds.addAll(collect);
|
|
|
- }
|
|
|
- }else {
|
|
|
- inchagerIds.add(-1);
|
|
|
+ record = projectMapper.selectWithStage(companyId, startIndex, endIndex, projectId,user.getId(),startDate,endDate);
|
|
|
+ projectIds = record.stream().map(ProjectWithStage::getId).distinct().collect(Collectors.toList());
|
|
|
+ allStageCostList = projectMapper.selectStageSum(projectIds,projectId,user.getId(),startDate,endDate);
|
|
|
+ inchargerId=user.getId();
|
|
|
}
|
|
|
}
|
|
|
QueryWrapper<Project> queryWrapper = new QueryWrapper<Project>().eq("company_id", companyId);
|
|
|
if (projectId != null) {
|
|
|
queryWrapper.eq("id", projectId);
|
|
|
}
|
|
|
- if(inchagerIds!=null){
|
|
|
- queryWrapper.in("id",inchagerIds);
|
|
|
+ if(inchargerId!=null){
|
|
|
+ queryWrapper.eq("incharger_id",inchargerId);
|
|
|
}
|
|
|
Integer total = projectMapper.selectCount(queryWrapper);
|
|
|
- List<ProjectWithStage> record = projectMapper.selectWithStage(companyId, startIndex, endIndex, projectId,inchagerIds,startDate,endDate);
|
|
|
List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看阶段成本");
|
|
|
+ List<StageCost> finalAllStageCostList = allStageCostList;
|
|
|
+ record.forEach(re->{
|
|
|
+ List<StageCost> stageCosts = finalAllStageCostList.stream().filter(al -> al.getProjectId().equals(re.id)).collect(Collectors.toList());
|
|
|
+ re.setStageCostList(stageCosts);
|
|
|
+ });
|
|
|
if (functionList.size() == 0) {
|
|
|
//去掉成本
|
|
|
record.forEach(re->{
|
|
@@ -2692,24 +2694,19 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
Integer companyId = user.getCompanyId();
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", companyId));
|
|
|
List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "全部项目任务报表");
|
|
|
List<SysRichFunction> functionInchargeList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "负责项目任务报表");
|
|
|
//判断查看权限
|
|
|
+ List<ProjectWithStage> record = projectMapper.selectWithStage(companyId, null, null, null,null,startDate,endDate);
|
|
|
+ List<StageCost> allStageCostList = projectMapper.selectStageSum(null,null,null,startDate,endDate);
|
|
|
List<Integer> inchagerIds=null;
|
|
|
if(functionAllList.size()==0){
|
|
|
- inchagerIds=new ArrayList<>();
|
|
|
if(functionInchargeList.size()>0){
|
|
|
- List<Project> list = projectList.stream().filter(pl -> (pl.getInchargerId()==null?0:pl.getInchargerId()).equals(user.getId())).collect(Collectors.toList());
|
|
|
- if(list!=null){
|
|
|
- List<Integer> collect = list.stream().map(li -> li.getId()).collect(Collectors.toList());
|
|
|
- inchagerIds.addAll(collect);
|
|
|
- }
|
|
|
- }else {
|
|
|
- inchagerIds.add(-1);
|
|
|
+ record = projectMapper.selectWithStage(companyId, null, null, null,user.getId(),startDate,endDate);
|
|
|
+ allStageCostList = projectMapper.selectStageSum(null,null,user.getId(),startDate,endDate);
|
|
|
}
|
|
|
}
|
|
|
- List<ProjectWithStage> record = projectMapper.selectWithStage(companyId, null, null, null,inchagerIds,startDate,endDate);
|
|
|
+
|
|
|
//获取全部的列
|
|
|
List<Integer> collect = record.stream().map(ProjectWithStage::getId).collect(Collectors.toList());
|
|
|
final List<String> stageList = new ArrayList<>();
|
|
@@ -2733,6 +2730,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<List<String>> dataList = new ArrayList<>();
|
|
|
dataList.add(titleList);
|
|
|
List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看阶段成本");
|
|
|
+ List<StageCost> finalAllStageCostList = allStageCostList;
|
|
|
+ record.forEach(re->{
|
|
|
+ List<StageCost> stageCosts = finalAllStageCostList.stream().filter(al -> al.getProjectId().equals(re.id)).collect(Collectors.toList());
|
|
|
+ re.setStageCostList(stageCosts);
|
|
|
+ });
|
|
|
if (functionList.size() == 0) {
|
|
|
//去掉成本
|
|
|
record.forEach(re->{
|
|
@@ -2763,7 +2765,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//String fileName = "项目阶段工时报表_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.ProPeriodWork")+System.currentTimeMillis();
|
|
|
try {
|
|
|
- return excelExportService.exportGeneralExcelByTitleAndList2(wxCorpInfo,fileName, dataList, path);
|
|
|
+ return excelExportService.exportGeneralExcelByTitleAndList2(null,fileName, dataList, path);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|