|
@@ -478,6 +478,7 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
|
try {
|
|
|
User targetUser = userMapper.selectById(request.getHeader("Token"));
|
|
|
Integer companyId =targetUser.getCompanyId();
|
|
|
+ List<User> allUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
//当前用户管理部门
|
|
|
List<Integer> deptIds=null;
|
|
@@ -523,9 +524,9 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
|
BigDecimal totalCostMoney = new BigDecimal(0);
|
|
|
List<User> userList = new ArrayList<>();
|
|
|
for (Map<String, Object> map : list) {
|
|
|
- if (tempMap.containsKey(map.get("user"))) {
|
|
|
+ if (tempMap.containsKey(map.get("id"))) {
|
|
|
//这个名字已经装进数组中了
|
|
|
- List<Map<String, Object>> tempList = tempMap.get(map.get("user"));
|
|
|
+ List<Map<String, Object>> tempList = tempMap.get(map.get("id"));
|
|
|
Map<String, Object> dataMap = new HashMap<>();
|
|
|
dataMap.put("project", map.get("project"));
|
|
|
BigDecimal money = (BigDecimal) map.getOrDefault("money", 0);
|
|
@@ -553,14 +554,15 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
|
dataMap.put("time", time);
|
|
|
tempList.add(dataMap);
|
|
|
}
|
|
|
- tempMap.put((String) map.get("user"), tempList);
|
|
|
+ tempMap.put((String) map.get("id"), tempList);
|
|
|
}
|
|
|
}
|
|
|
Map<String, Object> finalMap = new HashMap<>();
|
|
|
List<Map<String, Object>> finalList = new ArrayList<>();
|
|
|
for (String key : tempMap.keySet()) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("name", key);
|
|
|
+ String name = allUserList.stream().filter(ul -> ul.getId().equals(key)).findFirst().get().getName();
|
|
|
+ map.put("name", name);
|
|
|
map.put("project", tempMap.get(key));
|
|
|
map.put("type","userName");
|
|
|
finalList.add(map);
|
|
@@ -601,6 +603,7 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
|
User targetUser = userMapper.selectById(request.getHeader("Token"));
|
|
|
Integer companyId =targetUser.getCompanyId();
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
+ List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
//当前用户管理部门
|
|
|
List<Integer> deptIds=null;
|
|
|
List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", targetUser.getId()).eq("company_id", companyId));
|
|
@@ -644,14 +647,10 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
|
List<String> names = new ArrayList<>();
|
|
|
BigDecimal totalCostMoney = new BigDecimal(0);
|
|
|
for (Map<String, Object> map : list) {
|
|
|
- if (tempMap.containsKey(((wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1)?("$userName="+(map.get("corpwxUserId")==null?"":map.get("corpwxUseid"))+"$"):map.get("user")))) {
|
|
|
+ if (tempMap.containsKey(map.get("id"))) {
|
|
|
//这个名字已经装进数组中了
|
|
|
List<Map<String, Object>> tempList;
|
|
|
- if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
- tempList = tempMap.get(("$userName="+(map.get("corpwxUserId")==null?"":map.get("corpwxUserId"))+"$"));
|
|
|
- }else {
|
|
|
- tempList = tempMap.get(map.get("user"));
|
|
|
- }
|
|
|
+ tempList = tempMap.get(map.get("id"));
|
|
|
Map<String, Object> dataMap = new HashMap<>();
|
|
|
dataMap.put("project", map.get("project"));
|
|
|
BigDecimal money = (BigDecimal) map.getOrDefault("money", 0);
|
|
@@ -661,11 +660,7 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
|
dataMap.put("time", time);
|
|
|
tempList.add(dataMap);
|
|
|
} else {
|
|
|
- if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
- names.add("$userName="+(map.get("corpwxUserId")==null?"":map.get("corpwxUserId"))+"$");
|
|
|
- }else {
|
|
|
- names.add((String)map.get("user"));
|
|
|
- }
|
|
|
+ names.add((String)map.get("id"));
|
|
|
//这个名字尚未装进数组中
|
|
|
List<Map<String, Object>> tempList = new ArrayList<>();
|
|
|
if (map.containsKey("project")) {
|
|
@@ -678,7 +673,7 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
|
dataMap.put("time", time);
|
|
|
tempList.add(dataMap);
|
|
|
}
|
|
|
- tempMap.put((String) map.get("user"), tempList);
|
|
|
+ tempMap.put((String) map.get("id"), tempList);
|
|
|
}
|
|
|
}
|
|
|
// Map<String, Object> finalMap = new HashMap<>();
|
|
@@ -702,11 +697,15 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
|
BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
|
double totalCostTime = 0;
|
|
|
for (String key : names) {
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("name", key);
|
|
|
- map.put("project", tempMap.get(key));
|
|
|
List<String> nameList = new ArrayList<String>();
|
|
|
- nameList.add(key);//姓名
|
|
|
+ String name;
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ String corpwxUserId = userList.stream().filter(ul -> ul.getId().equals(key)).findFirst().get().getCorpwxUserid();
|
|
|
+ name ="$userName="+corpwxUserId==null?"":corpwxUserId+"$";
|
|
|
+ }else {
|
|
|
+ name = userList.stream().filter(ul -> ul.getId().equals(key)).findFirst().get().getName();
|
|
|
+ }
|
|
|
+ nameList.add(name);//姓名
|
|
|
nameList.add("");//空着
|
|
|
List<Map<String, Object>> tempList = tempMap.get(key);
|
|
|
//统计个人的时间和成本
|
|
@@ -746,7 +745,8 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
|
List<String> sumRow = new ArrayList<String>();
|
|
|
//sumRow.add("合计");
|
|
|
//sumRow.add("合计");
|
|
|
- sumRow.add("entry.total");
|
|
|
+ sumRow.add(MessageUtils.message("entry.total"));
|
|
|
+ sumRow.add("");
|
|
|
if(functionTimeList.size()>0){
|
|
|
sumRow.add(""+df.format(totalCostTime));
|
|
|
}
|