|
@@ -822,46 +822,32 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
allList.add(headList);
|
|
|
//统计当前所有项目所有人的时间成本投入
|
|
|
List<Map<String, Object>> membList = projectMapper.getProjectCostGroupByProject(companyId,startDate, endDate, projectId);
|
|
|
- double lineCostTime=0;
|
|
|
- BigDecimal lineMoneyCost = BigDecimal.valueOf(0);
|
|
|
for (User user : userList) {
|
|
|
boolean flag=false;
|
|
|
List<Map<String, Object>> mapList = membList.stream().filter(mb -> mb.get("creatorId").equals(user.getId())).collect(Collectors.toList());
|
|
|
List<String> membRowData=new ArrayList<>();
|
|
|
membRowData.add(user.getName());
|
|
|
-
|
|
|
- for(Map<String, Object> membMap :mapList){
|
|
|
- for(Object i:projectIds){
|
|
|
- if(membMap.get("projectId").equals(i)){
|
|
|
- membRowData.add(String.valueOf(membMap.get("cost")));
|
|
|
- membRowData.add(String.valueOf(membMap.get("costMoney")));
|
|
|
- flag=true;
|
|
|
- }
|
|
|
+ for(Object i:projectIds){
|
|
|
+ List<Map<String, Object>> resultList = mapList.stream().filter(mp -> mp.get("projectId").equals(i)).collect(Collectors.toList());
|
|
|
+ if(resultList.size()>0){
|
|
|
+ membRowData.add(String.valueOf(resultList.get(0).get("cost")));
|
|
|
+ membRowData.add(String.valueOf(resultList.get(0).get("costMoney")));
|
|
|
+ }else{
|
|
|
+ membRowData.add("");
|
|
|
+ membRowData.add("");
|
|
|
}
|
|
|
- lineCostTime += (Double)membMap.get("cost");
|
|
|
- lineMoneyCost = lineMoneyCost.add((BigDecimal)membMap.get("costMoney"));
|
|
|
}
|
|
|
- if(flag){
|
|
|
+ if(mapList.size()>0){
|
|
|
allList.add(membRowData);
|
|
|
}
|
|
|
}
|
|
|
- //合计
|
|
|
- /*sumRow=new ArrayList<>();
|
|
|
- sumRow.add("合计");
|
|
|
- List<String> finalSumRow = sumRow;
|
|
|
- BigDecimal finalLineMoneyCost = lineMoneyCost;
|
|
|
- double finalLineCostTime = lineCostTime;
|
|
|
- projectNames.forEach(pn->{
|
|
|
- finalSumRow.add(""+new BigDecimal(String.valueOf(finalLineCostTime)).setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
- finalSumRow.add(finalLineMoneyCost.toString());
|
|
|
- });
|
|
|
- allList.add(sumRow);*/
|
|
|
}
|
|
|
//生成excel文件导出
|
|
|
String fileName = "项目成本工时统计_"+System.currentTimeMillis();
|
|
|
String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , allList, path);
|
|
|
httpRespMsg.data = resp;
|
|
|
} catch (NullPointerException e) {
|
|
|
+ e.printStackTrace();
|
|
|
httpRespMsg.setError("验证失败");
|
|
|
return httpRespMsg;
|
|
|
}
|