|
@@ -272,7 +272,6 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
resultMap.put("costList", list);
|
|
resultMap.put("costList", list);
|
|
httpRespMsg.data = resultMap;
|
|
httpRespMsg.data = resultMap;
|
|
} catch (NullPointerException e) {
|
|
} catch (NullPointerException e) {
|
|
- e.printStackTrace();
|
|
|
|
httpRespMsg.setError("验证失败");
|
|
httpRespMsg.setError("验证失败");
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|
|
}
|
|
}
|
|
@@ -280,6 +279,7 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
}
|
|
}
|
|
|
|
|
|
//获取某个部门下人员的统计
|
|
//获取某个部门下人员的统计
|
|
|
|
+ @SuppressWarnings("SuspiciousMethodCalls")
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg getUserStatistics(Integer departmentId, HttpServletRequest request) {
|
|
public HttpRespMsg getUserStatistics(Integer departmentId, HttpServletRequest request) {
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
@@ -290,7 +290,39 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
if (departmentMapper.selectCount(new QueryWrapper<Department>()
|
|
if (departmentMapper.selectCount(new QueryWrapper<Department>()
|
|
.eq("department_id", departmentId)
|
|
.eq("department_id", departmentId)
|
|
.eq("company_id", companyId)) == 1) {
|
|
.eq("company_id", companyId)) == 1) {
|
|
- httpRespMsg.data = "啦啦啦";
|
|
|
|
|
|
+ List<Map<String, Object>> list = departmentMapper
|
|
|
|
+ .getCostByUser(getBranchDepartment(departmentId, companyId));
|
|
|
|
+ Map<String, List<Map<String, Object>>> tempMap = new HashMap<>();
|
|
|
|
+ for (Map<String, Object> map : list) {
|
|
|
|
+ if (tempMap.containsKey(map.get("user"))) {
|
|
|
|
+ //这个名字已经装进数组中了
|
|
|
|
+ List<Map<String, Object>> tempList = tempMap.get(map.get("user"));
|
|
|
|
+ Map<String, Object> finalMap = new HashMap<>();
|
|
|
|
+ finalMap.put("project", map.get("project"));
|
|
|
|
+ finalMap.put("money", map.getOrDefault("money", 0));
|
|
|
|
+ finalMap.put("time", map.getOrDefault("time", 0));
|
|
|
|
+ tempList.add(finalMap);
|
|
|
|
+ } else {
|
|
|
|
+ //这个名字尚未装进数组中
|
|
|
|
+ List<Map<String, Object>> tempList = new ArrayList<>();
|
|
|
|
+ if (map.containsKey("project")) {
|
|
|
|
+ Map<String, Object> dataMap = new HashMap<>();
|
|
|
|
+ dataMap.put("project", map.get("project"));
|
|
|
|
+ dataMap.put("money", map.getOrDefault("money", 0));
|
|
|
|
+ dataMap.put("time", map.getOrDefault("time", 0));
|
|
|
|
+ tempList.add(dataMap);
|
|
|
|
+ }
|
|
|
|
+ tempMap.put((String) map.get("user"), tempList);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List<Map<String, Object>> finalList = new ArrayList<>();
|
|
|
|
+ for (String key : tempMap.keySet()) {
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ map.put("name", key);
|
|
|
|
+ map.put("project", tempMap.get(key));
|
|
|
|
+ finalList.add(map);
|
|
|
|
+ }
|
|
|
|
+ httpRespMsg.data = finalList;
|
|
} else {
|
|
} else {
|
|
httpRespMsg.setError("部门不存在或无查看权限");
|
|
httpRespMsg.setError("部门不存在或无查看权限");
|
|
}
|
|
}
|