Browse Source

修改查询项目列表接口bug

zhaoxian 3 năm trước cách đây
mục cha
commit
6123dfe00b

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

@@ -192,10 +192,12 @@ public class ProjectMemberController {
                 Map<Long, List<JSONObject>> accountMap = userAllocationService.getAccountListByProjectList(projectList);
                 for (int i = 0; i < projectList.size(); i++) {
                     JSONObject project = projectList.get(i);
-                    List<JSONObject> accountList = accountMap.get(project.getLong("projectId"));
-                    if (!Check.isNull(accountList)) {
-                        project.put("accountList", accountList);
-                        haveList.add(project);
+                    if (!Check.isNull(project)) {
+                        List<JSONObject> accountList = accountMap.get(project.getLong("projectId"));
+                        if (!Check.isNull(accountList)) {
+                            project.put("accountList", accountList);
+                            haveList.add(project);
+                        }
                     }
                 }
             }
@@ -326,7 +328,7 @@ public class ProjectMemberController {
                 throw new Exception("请选择项目");
             }
             Project project = projectService.getById(projectId);
-            if(Check.isNull(project)){
+            if (Check.isNull(project)) {
                 throw new Exception("项目不存在");
             }
             JSONArray memberArr = jsonObject.getJSONArray("memberArr");

+ 9 - 6
module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java

@@ -3,6 +3,7 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 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 cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
@@ -158,8 +159,8 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     }
 
     @Override
-    public List<UserAllocation> getAccountListByUserIdAndProductId(String userId, Long projectId,Long productId) {
-        return userAllocationMapper.getAccountListByUserIdAndProductId(userId,projectId,productId);
+    public List<UserAllocation> getAccountListByUserIdAndProductId(String userId, Long projectId, Long productId) {
+        return userAllocationMapper.getAccountListByUserIdAndProductId(userId, projectId, productId);
     }
 
     @Override
@@ -168,8 +169,10 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
         List list = new ArrayList();
         for (int i = 0; i < projectList.size(); i++) {
             JSONObject jsonObject = projectList.get(i);
-            list.add(jsonObject.getLong("projectId"));
-            map.put(jsonObject.getLong("projectId"), new ArrayList<>());
+            if (!Check.isNull(jsonObject)) {
+                list.add(jsonObject.getLong("projectId"));
+                map.put(jsonObject.getLong("projectId"), new ArrayList<>());
+            }
         }
         List<JSONObject> jsonList = userAllocationMapper.getAccountListByProjectList(list);
         for (int i = 0; i < jsonList.size(); i++) {
@@ -193,8 +196,8 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
 
     @Override
     public boolean updateProjectStrategyStatus(Long accountId, Integer projectStrategy) {
-        int num  = userAllocationMapper.updateProjectStrategyStatus(accountId, projectStrategy);
-        return num>0;
+        int num = userAllocationMapper.updateProjectStrategyStatus(accountId, projectStrategy);
+        return num > 0;
     }
 
     @Override