Browse Source

同步素材展示快手userId

yumeng 4 năm trước cách đây
mục cha
commit
46bf396c33

+ 43 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java

@@ -10,6 +10,7 @@ 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.StringUtils;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -197,6 +198,48 @@ public class UserAllocationController {
 
 
     /**
+     * 统计报表 查看所有账号
+     *
+     * @param projectId
+     * @return
+     */
+    @GetMapping(value = "/getUserIdListByProjectId")
+    public Result<List<JSONObject>> getUserIdListByProjectId(Long projectId) {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            if (Check.isNull(projectId)) {
+                throw new Exception("请选择项目id");
+            }
+            List<JSONObject> userIdList = userAllocationService.getUserIdListByProjectId(projectId);
+            result.setSuccess(true);
+            result.setResult(userIdList);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.success(e.getMessage());
+        }
+        return result;
+    }
+
+
+    @GetMapping(value = "/getAccountIdListByUserId")
+    public Result<List<JSONObject>> getAccountIdListByUserId(Long userId) {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            if (Check.isNull(userId)) {
+                throw new Exception("请选择快手id");
+            }
+            List<JSONObject> accountIdList = userAllocationService.getAccountIdListByUserId(userId);
+            result.setSuccess(true);
+            result.setResult(accountIdList);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.success(e.getMessage());
+        }
+        return result;
+    }
+
+
+    /**
      * 分页列表查询
      *
      * @param userAllocation

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

@@ -14,8 +14,13 @@ import java.util.List;
  * @Version: V1.0
  */
 public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
-    List<UserAllocation> selectAccountListByProjectId(@Param("projectId")Long projectId);
-    String queryAdvertiserId(@Param("accountId")Long accountId);
+    List<UserAllocation> selectAccountListByProjectId(@Param("projectId") Long projectId);
+
+    String queryAdvertiserId(@Param("accountId") Long accountId);
 
     List<JSONObject> getAccountListByProject(@Param("projectId") Long projectId);
+
+    List<JSONObject> getUserIdListByProjectId(@Param("projectId") Long projectId);
+
+    List<JSONObject> getAccountIdListByUserId(@Param("userId") Long userId);
 }

+ 25 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml

@@ -31,4 +31,29 @@
        where project_id = #{projectId}
        order by create_time desc
     </select>
+
+    <select id="getUserIdListByProjectId" resultType="com.alibaba.fastjson.JSONObject">
+    SELECT t2.user_id as 'userId',
+    t2.account_id as 'accountId',
+    t2.user_name  as 'userName'
+    from ctop_user_allocation t1  LEFT JOIN
+    ctop_kuaishou_advertiser_base_info t2
+    ON t1.account_id = t2.account_id
+    WHERE t1.project_id = #{projectId}
+    GROUP BY t2.user_id
+    </select>
+
+
+    <select id="getAccountIdListByUserId" resultType="com.alibaba.fastjson.JSONObject">
+    SELECT
+    t1.account_id as 'accountId',
+    t1.auth_name  as 'authName'
+    from ctop_user_allocation   t1  LEFT JOIN
+    ctop_kuaishou_advertiser_base_info t2
+    ON t1.account_id = t2.account_id
+    WHERE t2.user_id = #{userId}
+    AND t1.account_status = 0
+    </select>
+
+
 </mapper>

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

@@ -28,4 +28,8 @@ public interface IUserAllocationService extends IService<UserAllocation> {
     String getAdvertiserIdByAccountId(Long accountId);
 
     List<JSONObject> getAccountListByProject(Long projectId);
+
+    List<JSONObject> getUserIdListByProjectId(Long projectId);
+
+    List<JSONObject> getAccountIdListByUserId(Long userId);
 }

+ 16 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java

@@ -103,4 +103,20 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     public List<JSONObject> getAccountListByProject(Long projectId) {
         return userAllocationMapper.getAccountListByProject(projectId);
     }
+
+    /**
+     * 获取项目下的所有userId
+     *
+     * @param projectId
+     * @return
+     */
+    @Override
+    public List<JSONObject> getUserIdListByProjectId(Long projectId) {
+        return userAllocationMapper.getUserIdListByProjectId(projectId);
+    }
+
+    @Override
+    public List<JSONObject> getAccountIdListByUserId(Long userId) {
+        return userAllocationMapper.getAccountIdListByUserId(userId);
+    }
 }

+ 0 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouRealTimeController.java

@@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RestController;
  * @Version: V1.0
  */
 @Slf4j
-@Api(tags = "广告组-app信息")
 @RestController
 @RequestMapping("/kuaishou/realTime")
 public class KuaiShouRealTimeController {