Browse Source

Merge remote-tracking branch 'origin/master'

syh 4 years ago
parent
commit
47504f8be5

+ 25 - 16
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml

@@ -110,28 +110,37 @@
     </select>
     </select>
 
 
     <select id="queryProjectMemberByUserId" resultType="org.jeecg.modules.ctop.entity.ProjectMember">
     <select id="queryProjectMemberByUserId" resultType="org.jeecg.modules.ctop.entity.ProjectMember">
-        select
-        distinct b.project_id as projectId,
-         (
-         select project_name  from ctop_project
-         where id = b.project_id
-        )as projectName,
-        a.advertiser_id as advertiserId,
+        SELECT
+        t1.id AS 'projectId',
+        project_name AS 'projectName',
+        t1.advertiser_id AS 'advertiserId',
         (
         (
-        select name from ctop_advertiser where id = a.advertiser_id
+        SELECT
+        NAME
+        FROM
+        ctop_advertiser
+        WHERE
+        id = t1.advertiser_id
+        ) AS 'advertiserName',
+        t1.media_id as 'mediaId'
+        FROM
+        ctop_project t1
+        WHERE
+        t1.id IN (
+        SELECT
+        project_id
+        FROM
+        ctop_project_member
+        where user_id = #{userId}
+        GROUP BY
+        project_id
         )
         )
-        as advertiserName,
-        (SELECT media_id from ctop_project c where c.id=a.project_id limit 1) as mediaId
-        from
-        ctop_user_allocation a
-        left join ctop_project_member b on a.project_id = b.project_id
-        where b.user_id = #{userId}
-        and a.media_id in
+        AND t1.media_id IN
         <foreach collection="mediaIds" item="item" separator=","
         <foreach collection="mediaIds" item="item" separator=","
                  open="(" close=")">
                  open="(" close=")">
             #{item}
             #{item}
         </foreach>
         </foreach>
-        order by b.create_time desc
+        order by t1.create_time desc
     </select>
     </select>
 
 
     <select id="getSaleProjects" resultType="org.jeecg.modules.ctop.entity.ProjectMember">
     <select id="getSaleProjects" resultType="org.jeecg.modules.ctop.entity.ProjectMember">

+ 53 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java

@@ -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.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.ISysRoleExtService;
 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.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
@@ -104,6 +105,9 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         return projectMemberList;
         return projectMemberList;
     }
     }
 
 
+    @Autowired
+    private IUserAllocationService userAllocationService;
+
     @Override
     @Override
     public List<Map<String, Object>> getProjectAccountByUserId(String userId, String mediaType) {
     public List<Map<String, Object>> getProjectAccountByUserId(String userId, String mediaType) {
         List<Map<String, Object>> result = new ArrayList<>();
         List<Map<String, Object>> result = new ArrayList<>();
@@ -121,15 +125,63 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         if (projectMemberList.isEmpty()) {
         if (projectMemberList.isEmpty()) {
             return result;
             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 -> {
         projectMemberList.forEach(ProjectMember -> {
             Map<String, Object> temp = this.queryAccountByProjectId(ProjectMember);
             Map<String, Object> temp = this.queryAccountByProjectId(ProjectMember);
             if (temp != null) {
             if (temp != null) {
                 result.add(temp);
                 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;
         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
     @Override
     public ProjectMember getProjectByParams(Long targetProject, String userId) {
     public ProjectMember getProjectByParams(Long targetProject, String userId) {
         QueryWrapper<ProjectMember> queryWrapper = new QueryWrapper<>();
         QueryWrapper<ProjectMember> queryWrapper = new QueryWrapper<>();

+ 2 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml

@@ -44,7 +44,8 @@
         t1.project_id as 'projectId',
         t1.project_id as 'projectId',
         t1.account_id as 'accountId',
         t1.account_id as 'accountId',
         (select realname from sys_user where id = t1.user_id ) as 'userName',
         (select realname from sys_user where id = t1.user_id ) as 'userName',
-        t1.auth_name as 'authName'
+        t1.auth_name as 'authName',
+        t1.account_status as 'accountStatus'
         from ctop_user_allocation t1
         from ctop_user_allocation t1
         where t1.project_id in
         where t1.project_id in
         <foreach collection="list" item="item" separator=","
         <foreach collection="list" item="item" separator=","

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java

@@ -45,4 +45,6 @@ public interface IUserAllocationService extends IService<UserAllocation> {
     List<Long> getAccountsByDeleteComment();
     List<Long> getAccountsByDeleteComment();
 
 
     Map<Long, List<JSONObject>> getAccountListByProjectList(List<JSONObject> projectList);
     Map<Long, List<JSONObject>> getAccountListByProjectList(List<JSONObject> projectList);
+
+
 }
 }

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouMaterialControer.java

@@ -94,8 +94,8 @@ public class KuaiShouMaterialControer {
                 throw new Exception("未获取账号授权信息");
                 throw new Exception("未获取账号授权信息");
             }
             }
             String appVersion = requestJson.getString("appVersion");
             String appVersion = requestJson.getString("appVersion");
-            String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-            iKuaishouInterfaceService.getVideoList(token, nowDate, nowDate);
+            // String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+            //  iKuaishouInterfaceService.getVideoList(token, nowDate, nowDate);
             KuaiShouVideoLastTime videoLastTime = lastTimeService.getById(accountId);
             KuaiShouVideoLastTime videoLastTime = lastTimeService.getById(accountId);
             Date startTime;
             Date startTime;
             Date endDate = new Date();
             Date endDate = new Date();