|
@@ -1118,7 +1118,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
|
|
|
//导出查询者所在公司每个项目的工时成本,包括项目人员明细统计
|
|
|
@Override
|
|
|
- public HttpRespMsg exportTimeCost(String startDate, String endDate,Integer projectId, String userId, Boolean projectSum,Integer type,Integer deptId, Integer stateKey,HttpServletRequest request) {
|
|
|
+ public HttpRespMsg exportTimeCost(String exportContent,String startDate, String endDate,Integer projectId, String userId, Boolean projectSum,Integer type,Integer deptId, Integer stateKey,HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
try {
|
|
|
User targetUser = userMapper.selectById(request.getHeader("Token"));
|
|
@@ -1192,14 +1192,22 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
headList.add(MessageUtils.message("entry.personnel"));
|
|
|
//headList.add("部门");
|
|
|
headList.add(MessageUtils.message("excel.department"));
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+ //hours:仅导出工时;cost:导出成本;hoursAndCost:导出成本和工时;
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
//headList.add("工时(h)");
|
|
|
headList.add(MessageUtils.message("entry.workHours")+"(h)");
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
//headList.add("成本(元)");
|
|
|
headList.add(MessageUtils.message("entry.cost")+"(元)");
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ //headList.add("工时(h)");
|
|
|
+ headList.add(MessageUtils.message("entry.workHours")+"(h)");
|
|
|
+ //headList.add("成本(元)");
|
|
|
+ headList.add(MessageUtils.message("entry.cost")+"(元)");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
allList=new ArrayList<>();
|
|
|
allList.add(headList);
|
|
|
double totalCostTime = 0;
|
|
@@ -1219,11 +1227,16 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
rowData.add((String)map.get("categoryName"));
|
|
|
rowData.add("");
|
|
|
rowData.add("");
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
rowData.add(((Double)map.get("cost")).toString());
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
rowData.add(((BigDecimal)map.get("costMoney")).toString());
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ rowData.add(((Double)map.get("cost")).toString());
|
|
|
+ rowData.add(((BigDecimal)map.get("costMoney")).toString());
|
|
|
+ }
|
|
|
}
|
|
|
if (projectSum != null && projectSum == true) {
|
|
|
allList.add(rowData);
|
|
@@ -1263,12 +1276,18 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
membRowData.add((String)membMap.get("name"));
|
|
|
membRowData.add((String)membMap.get("departmentName"));
|
|
|
}
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
membRowData.add(((Double)membMap.get("cost")).toString());
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
membRowData.add(((BigDecimal)membMap.get("costMoney")).toString());
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ membRowData.add(((Double)membMap.get("cost")).toString());
|
|
|
+ membRowData.add(((BigDecimal)membMap.get("costMoney")).toString());
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
allList.add(membRowData);
|
|
|
}
|
|
|
}
|
|
@@ -1280,12 +1299,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
sumRow.add("");
|
|
|
sumRow.add("");
|
|
|
sumRow.add("");
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
sumRow.add(""+new BigDecimal(totalCostTime).setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
sumRow.add(totalMoneyCost.toString());
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ sumRow.add(""+new BigDecimal(totalCostTime).setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
+ sumRow.add(totalMoneyCost.toString());
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
allList.add(sumRow);
|
|
|
}else{
|
|
|
List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
@@ -1295,23 +1319,36 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//headList.add("人员");
|
|
|
headList.add(MessageUtils.message("entry.personnel"));
|
|
|
projectNames.forEach(pn->{
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
//headList.add(String.valueOf(pn)+"/工时");
|
|
|
headList.add(String.valueOf(pn)+"/"+MessageUtils.message("entry.workHours"));
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
//headList.add(String.valueOf(pn)+"/成本");
|
|
|
headList.add(String.valueOf(pn)+"/"+MessageUtils.message("entry.cost"));
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ //headList.add(String.valueOf(pn)+"/工时");
|
|
|
+ headList.add(String.valueOf(pn)+"/"+MessageUtils.message("entry.workHours"));
|
|
|
+ //headList.add(String.valueOf(pn)+"/成本");
|
|
|
+ headList.add(String.valueOf(pn)+"/"+MessageUtils.message("entry.cost"));
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
//headList.add("合计/工时");
|
|
|
headList.add(MessageUtils.message("entry.total")+"/"+MessageUtils.message("entry.workHours"));
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
//headList.add("合计/成本");
|
|
|
headList.add(MessageUtils.message("entry.total")+"/"+MessageUtils.message("entry.cost"));
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ //headList.add("合计/工时");
|
|
|
+ headList.add(MessageUtils.message("entry.total")+"/"+MessageUtils.message("entry.workHours"));
|
|
|
+ //headList.add("合计/成本");
|
|
|
+ headList.add(MessageUtils.message("entry.total")+"/"+MessageUtils.message("entry.cost"));
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
allList=new ArrayList<>();
|
|
|
allList.add(headList);
|
|
|
//统计当前所有项目所有人的时间成本投入
|
|
@@ -1325,28 +1362,42 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
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){
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
membRowData.add(String.valueOf(resultList.get(0).get("cost")));
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
membRowData.add(String.valueOf(resultList.get(0).get("costMoney")));
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ membRowData.add(String.valueOf(resultList.get(0).get("cost")));
|
|
|
+ membRowData.add(String.valueOf(resultList.get(0).get("costMoney")));
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
costTime += (Double)resultList.get(0).get("cost");
|
|
|
moneyCost = moneyCost.add((BigDecimal)resultList.get(0).get("costMoney"));
|
|
|
}else{
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
membRowData.add("");
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
membRowData.add("");
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ membRowData.add("");
|
|
|
+ membRowData.add("");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
membRowData.add(""+new BigDecimal(costTime).setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
membRowData.add(moneyCost.toString());
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ membRowData.add(""+new BigDecimal(costTime).setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
+ membRowData.add(moneyCost.toString());
|
|
|
+ }
|
|
|
}
|
|
|
if(mapList.size()>0){
|
|
|
allList.add(membRowData);
|
|
@@ -5430,7 +5481,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg exportTimeCostByCategory(String startDate, String endDate, Integer projectCategoryId, String userId, Boolean projectSum, Integer type, HttpServletRequest request) {
|
|
|
+ public HttpRespMsg exportTimeCostByCategory(String exportContent,String startDate, String endDate, Integer projectCategoryId, String userId, Boolean projectSum, Integer type, HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
try {
|
|
|
//根据系统配置的员工成本计算方式,按固定时薪还是固定月薪,分情况计算。
|
|
@@ -5471,14 +5522,21 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<String> headList = new ArrayList<String>();
|
|
|
//headList.add("项目分类");
|
|
|
headList.add(MessageUtils.message("entry.projectType"));
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
//headList.add("工时(h)");
|
|
|
headList.add(MessageUtils.message("entry.workHours")+"(h)");
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
//headList.add("成本(元)");
|
|
|
headList.add(MessageUtils.message("entry.cost")+"(元)");
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ //headList.add("工时(h)");
|
|
|
+ headList.add(MessageUtils.message("entry.workHours")+"(h)");
|
|
|
+ //headList.add("成本(元)");
|
|
|
+ headList.add(MessageUtils.message("entry.cost")+"(元)");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
allList=new ArrayList<>();
|
|
|
allList.add(headList);
|
|
|
double totalCostTime = 0;
|
|
@@ -5494,11 +5552,15 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
totalCostTime += (Double)map.get("cost");
|
|
|
List<String> rowData = new ArrayList<String>();
|
|
|
rowData.add((String)map.get("categoryName"));
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
rowData.add(((Double)map.get("cost")).toString());
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
rowData.add(((BigDecimal)map.get("costMoney")).toString());
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ rowData.add(((Double)map.get("cost")).toString());
|
|
|
+ rowData.add(((BigDecimal)map.get("costMoney")).toString());
|
|
|
+ }
|
|
|
}
|
|
|
allList.add(rowData);
|
|
|
}
|
|
@@ -5506,12 +5568,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
sumRow=new ArrayList<>();
|
|
|
//sumRow.add("合计");
|
|
|
sumRow.add(MessageUtils.message("entry.total"));
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
sumRow.add(""+new BigDecimal(totalCostTime).setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
sumRow.add(totalMoneyCost.toString());
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ sumRow.add(""+new BigDecimal(totalCostTime).setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
+ sumRow.add(totalMoneyCost.toString());
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
allList.add(sumRow);
|
|
|
}else{
|
|
|
List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
@@ -5521,23 +5588,37 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//headList.add("人员");
|
|
|
headList.add(MessageUtils.message("entry.personnel"));
|
|
|
projectCategoryNameS.forEach(pc->{
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
//headList.add(String.valueOf(pc)+"/工时");
|
|
|
headList.add(String.valueOf(pc)+"/"+MessageUtils.message("entry.workHours"));
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
//headList.add(String.valueOf(pc)+"/成本");
|
|
|
headList.add(String.valueOf(pc)+"/"+MessageUtils.message("entry.cost"));
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ //headList.add(String.valueOf(pc)+"/工时");
|
|
|
+ headList.add(String.valueOf(pc)+"/"+MessageUtils.message("entry.workHours"));
|
|
|
+ //headList.add(String.valueOf(pc)+"/成本");
|
|
|
+ headList.add(String.valueOf(pc)+"/"+MessageUtils.message("entry.cost"));
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
});
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
//headList.add("工时/合计");
|
|
|
headList.add(MessageUtils.message("entry.workHours")+"/"+MessageUtils.message("entry.total"));
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
//headList.add("成本/合计");
|
|
|
headList.add(MessageUtils.message("entry.cost")+"/"+MessageUtils.message("entry.total"));
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ //headList.add("工时/合计");
|
|
|
+ headList.add(MessageUtils.message("entry.workHours")+"/"+MessageUtils.message("entry.total"));
|
|
|
+ //headList.add("成本/合计");
|
|
|
+ headList.add(MessageUtils.message("entry.cost")+"/"+MessageUtils.message("entry.total"));
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
allList=new ArrayList<>();
|
|
|
allList.add(headList);
|
|
|
//统计当前所有项目所有人的时间成本投入
|
|
@@ -5555,29 +5636,43 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
for(Object i:projectCategorys){
|
|
|
List<Map<String, Object>> resultList = mapList.stream().filter(mp -> mp.get("category").equals(i)).collect(Collectors.toList());
|
|
|
if(resultList.size()>0){
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
membRowData.add(String.valueOf(resultList.get(0).get("cost")));
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
membRowData.add(String.valueOf(resultList.get(0).get("costMoney")));
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ membRowData.add(String.valueOf(resultList.get(0).get("cost")));
|
|
|
+ membRowData.add(String.valueOf(resultList.get(0).get("costMoney")));
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
costTime += (Double)resultList.get(0).get("cost");
|
|
|
moneyCost = moneyCost.add((BigDecimal)resultList.get(0).get("costMoney"));
|
|
|
}else{
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
membRowData.add("");
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
membRowData.add("");
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ membRowData.add("");
|
|
|
+ membRowData.add("");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(functionTimeList.size()>0){
|
|
|
+ if ("hours".equals(exportContent) && functionTimeList.size()>0){
|
|
|
membRowData.add(""+new BigDecimal(costTime).setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
- }
|
|
|
- if(functionCostList.size()>0){
|
|
|
+ }else if ("cost".equals(exportContent) && functionCostList.size()>0){
|
|
|
membRowData.add(moneyCost.toString());
|
|
|
+ }else {
|
|
|
+ if(functionTimeList.size()>0 && functionCostList.size()>0){
|
|
|
+ membRowData.add(""+new BigDecimal(costTime).setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
+ membRowData.add(moneyCost.toString());
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
if(mapList.size()>0){
|
|
|
allList.add(membRowData);
|
|
|
}
|