|
@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.entity.SysUser;
|
|
|
import cn.com.ctop.common.module.entity.UserAllocation;
|
|
|
import cn.com.ctop.common.module.mapper.UserAllocationMapper;
|
|
|
import cn.com.ctop.common.module.service.ISysRoleExtService;
|
|
|
+import cn.com.ctop.common.module.service.IUserAllocationService;
|
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -104,6 +105,9 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
|
|
|
return projectMemberList;
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserAllocationService userAllocationService;
|
|
|
+
|
|
|
@Override
|
|
|
public List<Map<String, Object>> getProjectAccountByUserId(String userId, String mediaType) {
|
|
|
List<Map<String, Object>> result = new ArrayList<>();
|
|
@@ -121,15 +125,63 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
|
|
|
if (projectMemberList.isEmpty()) {
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ // Map<Long, List<JSONObject>> accountMap = userAllocationService.getAccountListByProjectMemberList(projectMemberList);
|
|
|
+ Map<Long, List<JSONObject>> accountMap = this.getAccountListByProjectMemberList(projectMemberList);
|
|
|
+
|
|
|
+
|
|
|
+ /* temp.put("project", projectMember);
|
|
|
+ QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("project_id", projectMember.getProjectId());
|
|
|
+ queryWrapper.isNotNull("account_id");
|
|
|
+ List<UserAllocation> userAllocations = userAllocationMapper.selectList(queryWrapper);
|
|
|
+ if (userAllocations.isEmpty()) {
|
|
|
+ temp = null;
|
|
|
+ } else {
|
|
|
+ temp.put("account", userAllocations);*/
|
|
|
+
|
|
|
+/*
|
|
|
projectMemberList.forEach(ProjectMember -> {
|
|
|
Map<String, Object> temp = this.queryAccountByProjectId(ProjectMember);
|
|
|
if (temp != null) {
|
|
|
result.add(temp);
|
|
|
}
|
|
|
- });
|
|
|
+ });*/
|
|
|
+
|
|
|
+ for (ProjectMember member : projectMemberList) {
|
|
|
+ Map<String, Object> temp = new HashMap<>();
|
|
|
+ temp.put("project", member);
|
|
|
+ List<JSONObject> jsonObjects = accountMap.get(member.getProjectId());
|
|
|
+ if (Check.isNull(jsonObjects)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ temp.put("account", jsonObjects);
|
|
|
+ result.add(temp);
|
|
|
+ }
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ private Map<Long, List<JSONObject>> getAccountListByProjectMemberList(List<ProjectMember> projectMemberList) {
|
|
|
+ Map<Long, List<JSONObject>> map = new HashMap<>();
|
|
|
+ List list = new ArrayList();
|
|
|
+ for (ProjectMember member : projectMemberList) {
|
|
|
+ list.add(member.getProjectId());
|
|
|
+ map.put(member.getProjectId(), new ArrayList<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<JSONObject> jsonList = userAllocationMapper.getAccountListByProjectList(list);
|
|
|
+ for (int i = 0; i < jsonList.size(); i++) {
|
|
|
+ JSONObject jsonObject = jsonList.get(i);
|
|
|
+ Long projectId = jsonObject.getLong("projectId");
|
|
|
+ List<JSONObject> jsonObjects = map.get(projectId);
|
|
|
+ jsonObjects.add(jsonObject);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public ProjectMember getProjectByParams(Long targetProject, String userId) {
|
|
|
QueryWrapper<ProjectMember> queryWrapper = new QueryWrapper<>();
|