Explorar el Código

去除无项目的账户

zhaoxian hace 4 años
padre
commit
dd39b41254

+ 16 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java

@@ -28,10 +28,21 @@ import org.jeecg.modules.ctop.service.IAdvertiserService;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.system.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 项目成员
@@ -178,18 +189,19 @@ public class ProjectMemberController {
                 userId = null;
             }
             List<JSONObject> projectList = projectMemberService.getProjectByUserIdAndMediaIds(userId, mediaIds);
+            List<JSONObject> haveList = new ArrayList<>();
             if (!Check.isNull(projectList)) {
                 for (int i = 0; i < projectList.size(); i++) {
                     JSONObject project = projectList.get(i);
                     List<JSONObject> accountList = userAllocationService.getAccountListByProject(project.getLong("projectId"));
                     if (!Check.isNull(accountList)) {
                         project.put("accountList", accountList);
+                        haveList.add(project);
                     }
                 }
             }
             result.setSuccess(true);
-            result.setResult(projectList);
-
+            result.setResult(haveList);
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);